Bootstrap an injector from a list of modules, instantiating a number of default components

@ignore
@param {Array<didi.Module>} bootstrapModules

@return {didi.Injector} a injector to use to access the components
767840
function bootstrap(bootstrapModules) {

  var modules = [],
      components = [];

  function hasModule(m) {
    return modules.indexOf(m) >= 0;
  }

  function addModule(m) {
    modules.push(m);
  }

  function visit(m) {
    if (hasModule(m)) {
      return;
    }

    (m.__depends__ || []).forEach(visit);

    if (hasModule(m)) {
      return;
    }

    addModule(m);

    (m.__init__ || []).forEach(function(c) {
      components.push(c);
    });
  }

  bootstrapModules.forEach(visit);

  var injector = new Injector(modules);

  components.forEach(function(c) {

    try {
      // eagerly resolve component (fn or string)
      injector[typeof c === 'string' ? 'get' : 'invoke'](c);
    } catch (e) {
      console.error('Failed to instantiate component');
      console.error(e.stack);

      throw e;
    }
  });

  return injector;
}
868053
protected function bootstrap()
    {
        if ($this->extensions === null) {
            $file = Zilf::getAlias('@vendor/Zilfsoft/extensions.php');
            $this->extensions = is_file($file) ? include $file : [];
        }
        foreach ($this->extensions as $extension) {
            if (!empty($extension['alias'])) {
                foreach ($extension['alias'] as $name => $path) {
                    Zilf::setAlias($name, $path);
                }
            }
            if (isset($extension['bootstrap'])) {
                $component = Zilf::createObject($extension['bootstrap']);
                if ($component instanceof BootstrapInterface) {
                    Zilf::debug('Bootstrap with ' . get_class($component) . '::bootstrap()', __METHOD__);
                    $component->bootstrap($this);
                } else {
                    Zilf::debug('Bootstrap with ' . get_class($component), __METHOD__);
                }
            }
        }

        foreach ($this->bootstrap as $mixed) {
            $component = null;
            if ($mixed instanceof \Closure) {
                Zilf::debug('Bootstrap with Closure', __METHOD__);
                if (!$component = call_user_func($mixed, $this)) {
                    continue;
                }
            } elseif (is_string($mixed)) {
                if ($this->has($mixed)) {
                    $component = $this->get($mixed);
                } elseif ($this->hasModule($mixed)) {
                    $component = $this->getModule($mixed);
                } elseif (strpos($mixed, '\\') === false) {
                    throw new InvalidConfigException("Unknown bootstrapping component ID: $mixed");
                }
            }

            if (!isset($component)) {
                $component = Zilf::createObject($mixed);
            }

            if ($component instanceof BootstrapInterface) {
                Zilf::debug('Bootstrap with ' . get_class($component) . '::bootstrap()', __METHOD__);
                $component->bootstrap($this);
            } else {
                Zilf::debug('Bootstrap with ' . get_class($component), __METHOD__);
            }
        }
    }
952486
function () {
      warning(deprecated, recommand);
      
      let args = [];
      for (var i = 0, len = argsString.length; i < len; i++) {
        args.push($injector.get(argsString[i]));
      }
      
      let instance = Object.create(controller.prototype || null);
      angular.merge(instance,this);
      controller.apply(instance,args);
      
      return instance;
    }
925806
function inject(moduleName) {
                    var localParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
                    var real = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];

                    var self = this,
                        deferred = $q.defer();
                    if (angular.isDefined(moduleName) && moduleName !== null) {
                        if (angular.isArray(moduleName)) {
                            var promisesList = [];
                            angular.forEach(moduleName, function (module) {
                                promisesList.push(self.inject(module, localParams, real));
                            });
                            return $q.all(promisesList);
                        } else {
                            self._addToLoadList(self._getModuleName(moduleName), true, real);
                        }
                    }
                    if (modulesToLoad.length > 0) {
                        var res = modulesToLoad.slice(); // clean copy
                        var loadNext = function loadNext(moduleName) {
                            moduleCache.push(moduleName);
                            modulePromises[moduleName] = deferred.promise;
                            self._loadDependencies(moduleName, localParams).then(function success() {
                                try {
                                    justLoaded = [];
                                    _register(providers, moduleCache, localParams);
                                } catch (e) {
                                    self._$log.error(e.message);
                                    deferred.reject(e);
                                    return;
                                }

                                if (modulesToLoad.length > 0) {
                                    loadNext(modulesToLoad.shift()); // load the next in list
                                } else {
                                        deferred.resolve(res); // everything has been loaded, resolve
                                    }
                            }, function error(err) {
                                deferred.reject(err);
                            });
                        };

                        // load the first in list
                        loadNext(modulesToLoad.shift());
                    } else if (localParams && localParams.name && modulePromises[localParams.name]) {
                        return modulePromises[localParams.name];
                    } else {
                        deferred.resolve();
                    }
                    return deferred.promise;
                }
552131
public InjectorBuilder combineWith(Module ... modules) {
        List<Module> m = new ArrayList<>();
        m.add(module);
        m.addAll(Arrays.asList(modules));
        this.module = Modules.combine(m);
        return this;
    }
716210
@SafeVarargs
    public static <M extends AbstractModule> Injector injector(Class<M>... modules) {
        List<String> names = new ArrayList<String>(modules.length);
        for (Class<?> klass : modules) {
            names.add(klass.getName());
        }
        return ngo.injector(JSArray.create(names.toArray(EMPTY_STRING_ARRAY)));
    }
683372
protected List<ManagedModule> createAndStartModules() {
        final List<ManagedModule> managedModuleInstances = new ArrayList<>();

        // create and start each managed module
        for(final Class<? extends ManagedModule> module:managedModules) {
            final ManagedModule mm = injector.getInstance(module);
            managedModuleInstances.add(mm);
            mm.start();
        }

        return managedModuleInstances;
    }
1235648
function loadModulePlugins(modulePlugins) {
        var serverModules = {};
        var me = this;

        // add modules from each plugin to the serverModules map
        _.each(modulePlugins, function (modulePlugin) {
            _.extend(serverModules, me.loadModules(modulePlugin.rootDir, modulePlugin.serverModuleDirs));
        });

        return serverModules;
    }
732220
function AdapterFactory(injector) {
    if (!injector.adapters) { return; }
    var me = this;

    this.adapterMap = {};
    _.each(injector.adapterMap, function (adapterName, adapterType) {
        var adapter = injector.adapters[adapterName];
        if (adapter) {
            me.adapterMap[adapterType + 'adapter'] = adapter;
        }
    });
}
1132285
function getDependencies (injector, dependencies) {
  return dependencies.map((name) => {
    let dependency = injector.getComponent(name);

    if (!dependency) {
      /* Anything starting 'npm:' is automatically included */
      if (/^npm:/.test(name)) {
        const npmModule = name.substr(4);

        injector.registerComponent({
          // eslint-disable-next-line import/no-dynamic-require, global-require
          factory: () => require(npmModule),
          name,
        });

        dependency = injector.getComponent(name);
      } else {
        throw new Error(`Missing dependency: ${name}`);
      }
    }

    /* If instance hasn't already been processed, process it */
    if (!dependency.instance) {
      dependency.instance = injector.process(dependency.factory, dependency.deps);
    }

    return dependency.instance;
  });
}
624940
function (moduleName) {
            var requiresModule = createModule(moduleName);
            var mods = requiresModule.getNormalizedModules();
            Utils.each(mods, function (m) {
                m.undef();
            });
        }
318924
function _initModulesOnElement(enabledElement) {
  const modules = store.modules;

  Object.keys(modules).forEach(function(key) {
    if (typeof modules[key].enabledElementCallback === 'function') {
      modules[key].enabledElementCallback(enabledElement);
    }
  });
}
133585
function () {
            var self = this,
                runtime = self.runtime;
            return S.map(self.getNormalizedRequires(), function (r) {
                return Utils.createModuleInfo(runtime, r);
            });
        }
814996
function(compiler, compilation, params){
    compilation.dependencyFactories.set(AngularModuleDependency,
                                        params.normalModuleFactory);
    compilation.dependencyTemplates.set(AngularModuleDependency,
                                        new AngularModuleDependency.Template());
    compilation.dependencyFactories.set(AngularModuleDefinition,
                                        new NullFactory());
    compilation.dependencyTemplates.set(AngularModuleDefinition,
                                        new AngularModuleDefinition.Template());
  }
54535
def inject(target)
      unless injectable?(target)
        raise ArgumentError, 'The given object does not include Dio module'
      end
      loader = @loader_factory.create(@container, target)
      target.__dio_inject__(loader)
      target
    end
1255758
function loadBootstrap(appPath, modules, type = 'worker') {
  let bootstrapPath = '';
  if (modules.length) {
    bootstrapPath = path.join(appPath, 'common/bootstrap');
  } else {
    bootstrapPath = path.join(appPath, 'bootstrap');
  }
  const filepath = path.join(bootstrapPath, `${type}.js`);
  if (helper.isFile(filepath)) {
    debug(`load file: ${filepath}`);
    return require(filepath);
  }
}
498033
function modules() {
  // Bootstrap
  var bootstrap = gulp.src('./node_modules/bootstrap/dist/**/*')
    .pipe(gulp.dest('./vendor/bootstrap'));
  // Font Awesome
  var fontAwesome = gulp.src('./node_modules/@fortawesome/**/*')
    .pipe(gulp.dest('./vendor'));
  // jQuery
  var jquery = gulp.src([
      './node_modules/jquery/dist/*',
      '!./node_modules/jquery/dist/core.js'
    ])
    .pipe(gulp.dest('./vendor/jquery'));
  return merge(bootstrap, fontAwesome, jquery);
}