Runs recursively through modules and their dependency-modules
and creates an array with handlers to invoke later by app-instance after startup.
@param  {Object} module Module instance
@return {Array}        Array of run handlers.
508934
function createRunQueue(modules) {

	return modules
		.map((mod) => mod._runQueue)
		.reduce((acc, res) => acc.concat(res), []);

}
682413
function Request__handleModule(path) {
        var moduleToLoad = path + this.module,
            LoadedModule,
            module;

        try {
            LoadedModule = di.load(moduleToLoad);
        } catch (e) {
            throw new error.HttpError(500, {path: moduleToLoad}, 'Missing module', e);
        }

        if (!Type.assert(Type.FUNCTION, LoadedModule)) {
            throw new error.HttpError(500, {path: moduleToLoad}, 'Module must be function type');
        }

        module = new LoadedModule(this.module);

        if (!(module instanceof  ModuleInterface)) {
            throw new error.HttpError(500, {module: module}, 'Module must be instance of ModuleInterface "core/module"');
        }


        return this._handleController(module.getControllersPath(), module.getViewsPath());
    }
789145
function defineModule() {

    /* Object based definition */
    if ((arguments.length == 1)
      && arguments[0].name
      && arguments[0].constructor) {
        var module = arguments[0];
        return defineModule(module.name,
                            module.dependencies || [], //optional
                            module.constructor);
    }

    /* Normal arguments-based definition */
    var args = normalize(arguments);

    /* Our variables */
    var name;
    var dependencies = [];
    var constructor;

    /* Name and dependencies */
    if (!args.arguments.length) {
      throw new EsquireError("No module name specified");
    } else {
      name = globalName(args.arguments.splice(0, 1)[0]);
      dependencies = args.arguments;
    }

    /* Watch out for double definitions */
    if (modules[name]) {
      throw new EsquireError("Module '" + name + "' already defined");
    }

    /* Constructor function */
    if (!args.function) {
      throw new EsquireError("No constructor function specified for module '" + name + "'");
    } else {
      constructor = args.function;
    }

    /* Create and remember our new module */
    var module = modules[name] = new Module(name, dependencies, constructor);

    /* Notify all "define" listeners */
    for (var i in listeners['define']) {
      try {
        listeners['define'][i](module);
      } catch (error) {
        console.error("Error notifying listener", error);
      }
    }

    /* Resolve our deferred if someone was waiting for this */
    if (deferredModules[module.name]) {
      deferredModules[module.name].resolve(module);
      delete deferredModules[module.name];
    }

    /* Return our defined module */
    return module;
  }
796522
function Module(id, parent) {
  this.id = id
  this.parent = parent;
  if (parent && parent.children) {
    parent.children.push(this);
  }
  this.children = [];
  
  this.filename = null;
  this.format = undefined;
  this.loaded = false;
}
1242015
function initModule (config, module) {
    // recursively load app dir(s)
    _.each(module.dir.app, appDir => {
        initAppDir(config, module, appDir)
    })
}
1194533
def run_module(mod_name, init_globals=None,
               run_name=None, alter_sys=False):
    
    mod_name, loader, code, fname = _get_module_details(mod_name)
    if run_name is None:
        run_name = mod_name
    pkg_name = mod_name.rpartition('.')[0]
    if alter_sys:
        return _run_module_code(code, init_globals, run_name,
                                fname, loader, pkg_name)
    else:
        # Leave the sys module alone
        return _run_code(code, {}, init_globals, run_name,
                         fname, loader, pkg_name)
871419
private LifecycleInjector run(Module externalModule, final String[] args) {
        return InjectorBuilder
             .fromModules(modules)
             .combineWith(externalModule)
             .map(new ModuleTransformer() {
                @Override
                public Module transform(Module module) {
                    List<Module> modulesToTransform = Collections.singletonList(module);
                    for (ModuleListTransformer transformer : transformers) {
                        modulesToTransform = transformer.transform(Collections.unmodifiableList(modulesToTransform));
                    }

                    return Modules.combine(modulesToTransform);
                }
             })
             .overrideWith(overrideModules)
             .createInjector(new LifecycleInjectorCreator()
                 .withArguments(args)
                 .withFeatures(featureOverrides)
                 .withProfiles(profiles));
    }
1020873
function(map, callback) {

            // Walk through all modules in parallel
            async.map(map, function(module, callback) {

                logger.info('Loading ' + (module.name).blue + ' module');

                // Walk through all possible controllers of the module
                async.map(module.paths, function(path, callback) {

                    self.loadController(
                        path,
                        basename(path.replace(/\.js$/g, '')),
                        module.name,
                        callback
                    );

                }, function(err, controllers) {
                    module.controllers = controllers;
                    callback(err, module);
                });

            }, callback);
        }
580598
protected function runAllAppModules()
    {
        $tree = $this->moduleList->getLoadTree();

        foreach ($tree as $firstLine) {
            foreach ($firstLine as $secondLine) {
                foreach ($secondLine as $moduleName) {
                    $this->runModule($moduleName);
                }
            }
        }
    }
77536
function getModule (name) {
    // create new module if it does not already exist
    if (!defined(immutableApp.modules[name])) {
        // create module
        immutableApp.modules[name] = new ImmutableAppModule(name)
        // add to list
        immutableApp.moduleNames.push(name)
    }
    // return module
    return immutableApp.modules[name]
}
597856
function getModules(argv,modules){
    if(argv.module){
        var which = getModuleConfig(argv.module,modules);
        if(which){
            return [which];
        }else{
            return [];
        }
    }
    return modules;
}
997852
function useModule(name, moduleClass) {
    if (arguments.length === 1) {
        moduleClass = name;
        name = null;
    }

    // create module
    var module = new moduleClass(),
        bootResponse = void 0;

    // Wrapper methods
    function boot() {
        var initialResponse = typeof module.boot === "function" ? module.boot() : null;

        if (initialResponse === false) {
            return false;
        }

        return initialResponse instanceof _es6Promise.Promise ? initialResponse.then(function (response) {
            bootResponse = response;
            return module;
        }) : module;
    }

    function ready() {
        if (typeof module.ready === "function") {
            return module.ready(bootResponse);
        }
    }

    return typeof name === "string" ? (0, _packages.define)(name, boot).then(ready) : (0, _packages.define)(boot).then(ready);
}
200854
function(callback) {
            async.map(modules, function(module, callback) {
                callback && callback(
                    null,
                    {
                        name: module,
                        path: process.cwd() + '/modules/' +
                              module + '/controllers/'
                    }
                );
            }, callback);
        }
900706
function resolveTransitiveDependencies(module, hash) {
    if (!(module instanceof Module)) {
      return Promise.reject("Unable to resolve module of type " + typeof(module));
    }

    var promises = [];
    for (var i in module.dependencies) {
      (function(dependencyName) {

        /* Ignore already resolved dependencies */
        if (hash[dependencyName]) return;

        /* Get a module or a promise to it and put it in the hash NOW! */
        var dependency = hash[dependencyName] = moduleOrPromise(dependencyName);

        /* Transitively resolve the dependency */
        promises.push(Promise.resolve(dependency).then(function(dependency) {
          hash[dependencyName] = dependency;
          return resolveTransitiveDependencies(dependency, hash);
        }));

      })(module.dependencies[i]);
    }

    return Promise.all(promises).then(function() {
      return hash;
    });
  }
719807
function getModulesTasks(baseTask, app) {
	var tasks = [];
	var modules = getModules(app);

	if (modules) {
		for (index = 0; index < modules.length; ++index) {
		    tasks.push(baseTask + '.' + modules[index]);
		}
	}

	return tasks;
}
1183755
def instantiate_modules
      mods = Array(modules)
      mods = load!(mods) if callback?(:load)
      Array(mods).map do |klass|
        init!(klass) || klass.new(fetchable)
      end
    end
876193
function request(module) {
		var dispatch;

		if (!/^[a-z0-9_-]+$/.test(module.name)) {
			return error('Invalid module name: ' + module.name);
		}

		dispatch = shallow(module);
		dispatch.accept = function() {
			setImmediate(function() {
				install(module);
			});
		};

		dispatch.reject = function() {
			setImmediate(function() {
				module.skipped = true;
				processed(module);
			});
		};

		if (EventEmitter.listenerCount(wanted, 'install') > 0) {
			wanted.emit('install', dispatch);
		}
		else if (module.options.autoAccept) {
			dispatch.accept();
		}
		else {
			dispatch.reject();
		}
	}