function load_plugin(plugin_desc, start_module, eraro) {
  var current_module = start_module
  var builtin = true
  var level = 0
  var reqfunc
  var funcdesc = {}

  // Each loop ascends the module.parent hierarchy
  while (
    null == funcdesc.initfunc &&
    (reqfunc = make_reqfunc(current_module))
  ) {
    funcdesc = perform_require(reqfunc, plugin_desc, builtin, level)

    if (funcdesc.error) {
      throw handle_load_error(
        funcdesc.error,
        funcdesc.found,
        plugin_desc,
        eraro
      )
    }
    
    builtin = false
    level++
    current_module = current_module.parent
  }

  // Record the details of where we found the plugin.
  // This is useful for debugging, especially if the "wrong" plugin is loaded.
  plugin_desc.modulepath = funcdesc.module
  plugin_desc.requirepath = funcdesc.require
  plugin_desc.found = funcdesc.found

  // The function name of the initfunc, if defined,
  // sets the final name of the plugin.
  // This replaces relative path references (like "../myplugins/foo")
  // with a clean name ("foo").
  if (
    funcdesc.initfunc &&
    null != funcdesc.initfunc.name &&
    '' !== funcdesc.initfunc.name
  ) {
    plugin_desc.name = funcdesc.initfunc.name
  }

  plugin_desc.init = funcdesc.initfunc

  // Init function can also provide options
  if (plugin_desc.init && 'object' === typeof plugin_desc.init.defaults) {
    plugin_desc.defaults = Object.assign({}, plugin_desc.init.defaults)
  }
}
//     7.   IF NOT FOUND module = module.parent
7.   IF NOT FOUND module = module.parent
7 . IF NOT FOUND module = module . parent
function load_plugin(plugin_desc, start_module, eraro) {
  var current_module = start_module
  var builtin = true
  var level = 0
  var reqfunc
  var funcdesc = {}
  while (
    null == funcdesc.initfunc &&
    (reqfunc = make_reqfunc(current_module))
  ) {
    funcdesc = perform_require(reqfunc, plugin_desc, builtin, level)
    if (funcdesc.error) {
      throw handle_load_error(
        funcdesc.error,
        funcdesc.found,
        plugin_desc,
        eraro
      )
    }
    builtin = false
    level++
    current_module = current_module.parent
  }
  plugin_desc.modulepath = funcdesc.module
  plugin_desc.requirepath = funcdesc.require
  plugin_desc.found = funcdesc.found
  if (
    funcdesc.initfunc &&
    null != funcdesc.initfunc.name &&
    '' !== funcdesc.initfunc.name
  ) {
    plugin_desc.name = funcdesc.initfunc.name
  }
  plugin_desc.init = funcdesc.initfunc
  if (plugin_desc.init && 'object' === typeof plugin_desc.init.defaults) {
    plugin_desc.defaults = Object.assign({}, plugin_desc.init.defaults)
  }
}
function load_plugin ( plugin_desc , start_module , eraro ) { var current_module = start_module var builtin = true var level = 0 var reqfunc var funcdesc = { } while ( null == funcdesc . initfunc && ( reqfunc = make_reqfunc ( current_module ) ) ) { funcdesc = perform_require ( reqfunc , plugin_desc , builtin , level ) if ( funcdesc . error ) { throw handle_load_error ( funcdesc . error , funcdesc . found , plugin_desc , eraro ) } builtin = false level ++ current_module = current_module . parent } plugin_desc . modulepath = funcdesc . module plugin_desc . requirepath = funcdesc . require plugin_desc . found = funcdesc . found if ( funcdesc . initfunc && null != funcdesc . initfunc . name && '' !== funcdesc . initfunc . name ) { plugin_desc . name = funcdesc . initfunc . name } plugin_desc . init = funcdesc . initfunc if ( plugin_desc . init && 'object' === typeof plugin_desc . init . defaults ) { plugin_desc . defaults = Object . assign ( { } , plugin_desc . init . defaults ) } }
7.
7 .
// Each loop ascends the module.parent hierarchy // Record the details of where we found the plugin. // This is useful for debugging, especially if the "wrong" plugin is loaded. // The function name of the initfunc, if defined, // sets the final name of the plugin. // This replaces relative path references (like "../myplugins/foo") // with a clean name ("foo"). // Init function can also provide options