-- like require with: --   + dependecy injection --   + instrumentation --   + (TODO) lazy loading
509855
function $require(dir, file, dependencies) {
  var requiredFile = join(dir,file)
  try {
    var req = require(requiredFile)
    $logIt('app.require', `require`, `${dependencies?'wDeps'.yellow.dim:''}`.reset + requiredFile.gray)
    return dependencies ? req.apply(this,dependencies) : req
  } catch (e) {
    if (e.stack.match('SyntaxError')) {
      var src = fs.readFileSync(requiredFile+'.js')
      var err = syntax(src, requiredFile)
      console.log('\n\n$require.SyntaxError'.red, e.message.gray,
        err ? `\n\t${err} | col ${err.column}\n\n\n\n`.red : requiredFile.white)
      process.exit(1)
    }
    else
      console.log('\n\n\n$require.err'.red, requiredFile.white, e.message, '\n\n\n')

    throw e
  }

}
1218048
function lazy(arg) {
  var conf = this.configure();
  var action = arg.action();
  if(!conf.command.dir || action !== undefined) return false;
  var file = path.join(conf.command.dir, getModulePath.call(this, arg))
  try{
    action = require(file);
    if(typeof action !== 'function') {
      return this.raise(this.errors.ECMD_TYPE, [file]);
    }
    arg.action(action);
  }catch(e) {
    return this.raise(this.errors.ECMD_REQUIRE, [file, e.message], e);
  }
}
677498
function (dependencies) {
            this._dependsOn = dependencies[this._name] || [];
            this._dependencyOf = [];
            Object.keys(dependencies).forEach(function (name) {
                var nameDependencies = dependencies[name];
                if (nameDependencies.indexOf(this._name) !== NOT_FOUND) {
                    this._dependencyOf.push(name);
                }
            }, this);
        }
1235465
public static void addDependency(Dependency depend)
  {
    ClassLoader loader = Thread.currentThread().getContextClassLoader();

    addDependency(depend, loader);
  }
197968
function (fn) {
            var requires = [];
            // Remove comments from the callback string,
            // look for require calls, and pull them into the dependencies,
            // but only if there are function args.
            fn.toString()
                .replace(commentRegExp, '')
                .replace(requireRegExp, function (match, _, dep) {
                    requires.push(dep);
                });
            return requires;
        }
283632
function amdefineWorkaround(requiredModule)
{
  // prepare define function
  var define = amdefine(requiredModule, this.pretendRequire(requiredModule));

  // return wrapper
  function wrapper(id, deps, initializer)
  {
    // init module
    define(id, deps, initializer);

    // if module provides id
    // force it to be executed anyway
    if (typeof id == 'string')
    {
      requiredModule.exports = define.require(id);
    }
  }

  // make it look like legit thing
  if (this.exposeAmdefine)
  {
    wrapper.amd     = define.amd;
    wrapper.require = define.require;
  }

  return wrapper;
}
305460
def task_requires(*dependencies):
    
    def entangle(task):
        "Decorator wrapper."
        if not isinstance(task, tasks.Task):
            task = tasks.Task(task)

        def tool_task(*args, **kw):
            "Install requirements, then call original task."
            install_tools(dependencies)
            return task_body(*args, **kw)

        # Apply our wrapper to original task
        task_body, task.func = task.func, tool_task
        return task

    return entangle
176885
function requireNJS() {
  try {
    var module = ru(this.path);
  } catch(o_O) {
    console.error(o_O);
    return internalServerError.call(this, o_O);
  }
  module.onload(
    this.request,
    this.response,
    this
  );
}
1324259
def require( file )
      return if key?( file )

      self[ file ] = deps( file )
      self[ file ].each do |dependency|
        self.require dependency
      end
    end
462124
function requirejs(deps, callback, errback) {
  if (!Array.isArray(deps)) throw new Error('missing deps array');
  if (callback && typeof callback !== 'function') throw new Error('callback is not a function');
  if (errback && typeof errback !== 'function') throw new Error('errback is not a function');

  // return AMD require function or commonjs require function
  function requireFunc() {
    if (typeof arguments[0] === 'string') {
      const dep = arguments[0];
      const got = defined(dep);
      if (got) return got.val;
      throw new Error(`commonjs dependency "${dep}" is not prepared.`);
    }

    return requirejs.apply(null, arguments);
  }

  requireFunc.toUrl = toUrl;

  const depValues = serialResults(deps, d => {
    if (d === 'require') return requireFunc;
    if (d instanceof RegExp) {
      const expanded = [...userSpace.ids(), ...packageSpace.ids()].filter(id => id.match(d));
      return serialResults(expanded, e => userSpace.req(e));
    }
    return userSpace.req(mappedId(d));
  });

  const finalize = results => {
    if (callback) return callback.apply(_global, results);
    else return results;
  };

  const errHandler = err => {
    if (errback) return errback(err);
    else console.error(err); // eslint-disable-line no-console
  };

  if (depValues && typeof depValues.then === 'function') {
    // asynchronous callback
    return depValues.then(finalize, errHandler);
  }

  // synchronous callback
  return new Promise(resolve => {
    resolve(finalize(depValues));
  });
}
1362209
function load(target) {
      if (!loaded[target]) {
        var def = componentDirectory[target];
        // Initialize component, this won't cause an infinite loop because
        // we've already check that the componentDirectory is a DAG
        let requires = def.requires || [];
        return loaded[target] = Promise.all(requires.map(load)).then(deps => {
          let ctx = {};
          for (let i = 0; i < deps.length; i++) {
            ctx[def.requires[i]] = deps[i];
          }
          return new Promise((resolve, reject) => {
            try {
              resolve(def.setup.call(null, ctx));
            } catch (err) {
              reject(err);
            }
          }).catch(function(err) {
            debug(`error while loading component '${target}': ${err}`);
            throw err;
          });
        });
      }
      return loaded[target];
    }
1173400
function (placeholder, dependencies, lazy) {
            var modules = this._pageModules, refpath, moduleDesc, typeUtils = ariaUtilsType;
            if (!typeUtils.isObject(placeholder)) {
                return;
            }
            var isLazy = (placeholder.lazy);
            if ((lazy && !isLazy) || (!lazy && isLazy)) {
                return;
            }
            if ("module" in placeholder) {
                refpath = placeholder.module;
                if (refpath.match(/^common:/)) {
                    this._utils.addIfMissing(refpath.replace(/^common:/, ""), dependencies.modules.common);
                } else {
                    moduleDesc = modules[refpath];
                    if (moduleDesc) {
                        this._utils.addIfMissing(moduleDesc.classpath, dependencies.classes);
                        this._utils.addIfMissing(refpath, dependencies.modules.page);
                    }
                }
            }
            if ("template" in placeholder) {
                this._utils.addIfMissing(placeholder.template, dependencies.templates);
            }
            if ("css" in placeholder) {
                this._utils.wiseConcat(dependencies.css, placeholder.css);
            }
        }
1049701
function DependencyInjector(opts) {
    var rootDefault = p.join(__dirname, '../../..');
    this.rootDir = opts.rootDir || rootDefault;                 // project base dir (default is a guess)
    this.require = opts.require || require;                     // we need require from the project
    this.container = opts.container || 'api';                   // resource has diff profiles for diff containers
    this.servicesDir = opts.servicesDir || 'services';          // dir where services reside
    this.tplDir = opts.tplDir || 'dist/tpls';                   // precompiled templates
    this.debug = opts.debug || false;                           // debug mode will have us firing more events
    this.debugPattern = opts.debugPattern;                      // by default if debug on, we view EVERYTHING
    this.debugHandler = opts.debugHandler;                      // function used when debug event occurs
    this.adapters = opts.adapters || {};                        // if client uses plugins, they will pass in adapters
    this.reactors = opts.reactors || {};                        // if client uses plugins, they will pass in reactors
    this.adapterMap = this.loadAdapterMap(opts);                // mappings from adapter type to impl
    this.aliases = this.loadAliases(opts);                      // mapping of names to locations
    this.factories = this.loadFactories(opts);                  // load all the factories
}
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;
                }
1060741
function() {

			// afterwards we load our dependencies!
			var oDep = this.getEntry("/sap.ui5/dependencies"),
				sComponentName = this.getComponentName();

			if (oDep) {

				// load the libraries
				var mLibraries = oDep["libs"];
				if (mLibraries) {
					for (var sLib in mLibraries) {
						if (!mLibraries[sLib].lazy) {
							Log.info("Component \"" + sComponentName + "\" is loading library: \"" + sLib + "\"");
							sap.ui.getCore().loadLibrary(sLib);
						}
					}
				}

				// load the components
				var mComponents = oDep["components"];
				if (mComponents) {
					for (var sName in mComponents) {
						if (!mComponents[sName].lazy) {
							// TODO: refactor component/library loading code within Manifest / Component
							// Only load component if not (pre-)loaded already
							// Usually the dependencies are already loaded beforehand within Component.create
							var sControllerModule = sName.replace(/\./g, "/") + "/Component";
							var iModuleState = sap.ui.loader._.getModuleState(sControllerModule + ".js");
							if (iModuleState === -1 /* PRELOADED */) {
								// Execute preloaded component controller module
								sap.ui.requireSync(sControllerModule);
							} else if (iModuleState === 0 /* INITIAL */) {
								Log.info("Component \"" + sComponentName + "\" is loading component: \"" + sName + ".Component\"");
								// This can't be migrated to "Component.load" as the contract is sync
								sap.ui.requireSync("sap/ui/core/Component");
								sap.ui.component.load({
									name: sName
								});
							}
						}
					}
				}

			}

		}
979335
function injectAllRequirements(funcArtifact) {
  if (this.options.layer) {
    // The requirements will be placed in a Layer, so just resolve
    return BbPromise.resolve();
  }

  this.serverless.cli.log('Injecting required Python packages to package...');

  if (this.serverless.service.package.individually) {
    return BbPromise.resolve(this.targetFuncs)
      .filter(func =>
        (func.runtime || this.serverless.service.provider.runtime).match(
          /^python.*/
        )
      )
      .map(func => {
        if (!get(func, 'module')) {
          set(func, ['module'], '.');
        }
        return func;
      })
      .map(func => {
        if (func.module !== '.') {
          const artifact = func.package ? func.package.artifact : funcArtifact;
          const newArtifact = path.join(
            '.serverless',
            `${func.module}-${func.name}.zip`
          );
          func.package.artifact = newArtifact;
          return moveModuleUp(artifact, newArtifact, func.module).then(
            () => func
          );
        } else {
          return func;
        }
      })
      .map(func => {
        return this.options.zip
          ? func
          : injectRequirements(
              path.join('.serverless', func.module, 'requirements'),
              func.package.artifact,
              this.options
            );
      });
  } else if (!this.options.zip) {
    return injectRequirements(
      path.join('.serverless', 'requirements'),
      this.serverless.service.package.artifact || funcArtifact,
      this.options
    );
  }
}
40636
function (options, callback) {
        options = extend({}, DEPENDENCY_WRITE_DEFAULTS, options)
        var json = require(options.jsonUri)

        // the JSON DSL has the option to have "/foo" in <moduleNameLeft>
        after.reduce(json, createFoldersIntoFilesIterator(options.uri), 
            {}, runDependencyMapper)

        function runDependencyMapper(err, data) {
            if (err) {
                return callback(err)
            }
            after.map(data, mapToDependencies, callback)
        }

        function mapToDependencies(dependencies, moduleName, callback) {
            if (isFile.test(moduleName)) {
                // the JSON DSL has the option to have "/foo" or ["/foo"]
                // in <moduleNameRight>.
                after.map(dependencies, createConvertToProxyNameIterator({
                    moduleName: moduleName,
                    uri: options.uri
                }), callback)
            }
        }
    }