Generate addDependency for single module.
@param {string} scriptPath
@return {string}
180905
function genModuleDeps(scriptPath) {
  var provideMap = new ProvideMap_();
  var requireMap = new RequireMap_();
  scanFiles([scriptPath], provideMap, requireMap);
  var dumpValues = function(map) {
    var results = [];
    map.forEach(function(value, key) {
      results = results.concat(value);
    });
    return results;
  };

  var relativePath = pathMod.join('../..', scriptPath);
  if (osMod.platform().indexOf('win') != -1) {
    relativePath = relativePath.replace(/\\/g, '\\\\');
  }

  var provide = provideMap.getAllProvides();
  var require = requireMap.getAllRequires();
  return 'goog.addDependency("' + relativePath + '", ' +
      JSON.stringify(dumpValues(provide)) + ', ' +
      JSON.stringify(dumpValues(require)) + ', true);';
}
976440
function combo(filepath) {
    var linkPattern = /<link\s([^>]+)>/g;
    var scriptPattern = /<script\s([^>]+)>/g;

    var html = grunt.file.read(filepath);

    html = html.replace(linkPattern, function (content) {
      var href = getAttribute(content, 'href');
      var ignore = getAttribute(content, 'ignore');

      if (href.match(/\/\//) || isTruthy(ignore)) {
        return content;
      }
      return '<style>\n' + grunt.file.read(path.join(filepath, '../', href)) + '\n</style>';
    });

    html = html.replace(scriptPattern, function (content) {
      var src = getAttribute(content, 'src');
      var ignore = getAttribute(content, 'ignore');

      if (src.match(/\/\//) || isTruthy(ignore)) {
        return content;
      }
      return '<script>\n' + grunt.file.read(path.join(filepath, '../', src)) + '\n';
    });

    return html;
  }
1052388
function modulePathToId(path) {
    // We can only transform if there's no plugin used.
    if (path.indexOf('!') === -1) {
        // If it ends with ".js", chop it off.
        var extension = '.js'
        if (path.slice(-extension.length) === '.js') {
            path = path.slice(0, path.length - extension.length);
        }
    }
    return path;
}
245942
function buildExcludeCheck (transpileDependencies = []) {
  const dependencyChecks = transpileDependencies.map((dependency) => (
    new RegExp(`node_modules.${dependency}`)
  ))

  // see: https://webpack.js.org/configuration/module/#condition
  return function (assetPath) {
    const shouldTranspile = dependencyChecks
      .reduce((result, check) => result || assetPath.match(check), false)

    if (shouldTranspile) { return false }
    return !!assetPath.match(/node_modules/)
  }
}
1020574
public static Set<ModuleId> getDependencyScriptModuleIds(ModuleSpec moduleSpec) {
        Objects.requireNonNull(moduleSpec, "moduleSpec");
        if (!(moduleSpec instanceof ConcreteModuleSpec)) {
            throw new IllegalArgumentException("Unsupported ModuleSpec implementation: " + moduleSpec.getClass().getName());
        }
        Set<ModuleId> dependencyNames = new LinkedHashSet<ModuleId>();
        ConcreteModuleSpec concreteSpec = (ConcreteModuleSpec)moduleSpec;
        for (DependencySpec dependencSpec : concreteSpec.getDependencies()) {
            if (dependencSpec instanceof ModuleDependencySpec) {
                ModuleIdentifier revisionId = ((ModuleDependencySpec)dependencSpec).getIdentifier();
                dependencyNames.add(ModuleId.fromString(revisionId.getName()));
            }
        }
        return dependencyNames;
    }
342378
function buildDependencyPaths(self, context) {
  var dependencies = {};

  context.__dependencyPaths__.forEach(function (p) {
    var dep = new DependencyFile(p, self.environment.stat(p).mtime,
                                 self.environment.getFileDigest(p));
    dependencies[JSON.stringify(dep)] = dep;
  });

  _.forEach(context.__dependencyAssets__, function (p) {
    var dep, asset;

    if (p === self.pathname) {
      dep = new DependencyFile(p, self.environment.stat(p).mtime,
                               self.environment.getFileDigest(p));
      dependencies[JSON.stringify(dep)] = dep;
      return;
    }

    asset = self.environment.findAsset(p, { bundle: false });

    if (asset) {
      asset.dependencyPaths.forEach(function (dep) {
        dependencies[JSON.stringify(dep)] = dep;
      });
    }
  });

  prop(self, '__dependencyPaths__', _.values(dependencies));
}
822881
def add_elm_dependencies(filepath, context)
      # Turn e.g. ~/NoRedInk/app/assets/javascripts/Quiz/QuestionStoreAPI.js.elm
      # into just ~/NoRedInk/app/assets/javascripts/
      dirname = context.pathname.to_s.gsub Regexp.new(context.logical_path + ".+$"), ""

      File.read(filepath).each_line do |line|
        # e.g. `import Quiz.QuestionStore exposing (..)`
        match = line.match(/^import\s+([^\s]+)/)

        next unless match

        # e.g. Quiz.QuestionStore
        module_name = match.captures[0]

        # e.g. Quiz/QuestionStore
        dependency_logical_name = module_name.tr(".", "/")

        # e.g. ~/NoRedInk/app/assets/javascripts/Quiz/QuestionStore.elm
        dependency_filepath = dirname + dependency_logical_name + ".elm"

        # If we don't find the dependency in our filesystem, assume it's because
        # it comes in through a third-party package rather than our sources.
        next unless File.file? dependency_filepath

        context.depend_on dependency_logical_name
        add_elm_dependencies dependency_filepath, context
      end
    end
585162
public void addDependency(JSModule dep) {
    checkNotNull(dep);
    Preconditions.checkState(dep != this, "Cannot add dependency on self", this);
    deps.add(dep);
  }
1103927
function addModuleProperty(module, symbol, modulePath, opt_wrap, opt_obj) {
    var val = null;
    if (opt_wrap) {
        module.exports[symbol] = function() {
            val = val || module.require(modulePath);
            if (arguments.length && typeof arguments[arguments.length - 1] === 'function') {
                // If args exist and the last one is a function, it's the callback.
                var args = Array.prototype.slice.call(arguments);
                var cb = args.pop();
                val.apply(module.exports, args).done(function(result) { cb(undefined, result); }, cb);
            } else {
                val.apply(module.exports, arguments).done(null, function(err) { throw err; });
            }
        };
    } else {
        Object.defineProperty(opt_obj || module.exports, symbol, {
            get : function() { val = val || module.require(modulePath); return val; },
            set : function(v) { val = v; }
        });
    }

    // Add the module.raw.foo as well.
    if(module.exports.raw) {
        Object.defineProperty(module.exports.raw, symbol, {
            get : function() { val = val || module.require(modulePath); return val; },
            set : function(v) { val = v; }
        });
    }
}
124060
function loadModule(moduleName, moduleFileName, oxModulesDirPath, options) {
    var Module;
    try {
        Module = require(path.join(oxModulesDirPath, moduleFileName));
    } catch (e) {
        if (e instanceof ModuleUnavailableError) {
            logger.warn('Loading module: ' + moduleName + '. Failed to load - ' + e.message);
            return;
        } else {
            throw e;
        }
    }

    var mod = new Module(options, ctx, resultStore, logger);

    // load external commands
    var cmdDir = path.join(oxModulesDirPath, 'module-' + moduleName, 'commands');
    if (fs.existsSync(cmdDir)) {
        var commandName = null;
        try {
            var files = fs.readdirSync(cmdDir);
            for (var fileName of files) {
                commandName = fileName.slice(0, -3);
                if (commandName.indexOf('.') !== 0) {   // ignore possible hidden files (i.e. starting with '.')
                    var cmdFunc = require(path.join(cmdDir, commandName));
                    // bind function's "this" to module's "this"
                    var fnc = cmdFunc.bind(mod._this || mod);
                    mod[commandName] = fnc;
                    // since commands have access only to _this, reference all
                    // commands on it, so commands could have access to each other.
                    // note that command defined in the main module won't be referenced.
                    mod._this[commandName] = fnc;
                }
            }
        } catch (e) {
            logger.error("Can't load command '" + commandName + ': ' + e.message);
            logger.debug(e.stack);
        }
    }

    // apply this for functions inside 'helpers' methods collection if found
    if (mod.helpers || (mod._this && mod._this.helpers)) {
        var helpers = mod.helpers || mod._this.helpers;
        for (var funcName in helpers) {
            if (typeof helpers[funcName] === 'function') {
                helpers[funcName] = helpers[funcName].bind(mod._this || mod);
            }
        }
    }

    logger.debug('Loading module: ' + moduleName);
    modules[moduleName] = sandbox[moduleName] = global.ox[moduleName] = moduleWrapper(moduleName, mod, resultStore);
}
1112717
public function addScript($handle, $script, array $dependency = [])
    {
        if (is_null($handle)) {
            $handle = $script;
        }

        $this->package->js($handle, $script, $dependency, true);

        return $this;
    }
1181878
function injectDependencies(globalConfig) {
  config = globalConfig;
  var stream = config.get('stream');

  globalDependenciesSorted = config.get('global-dependencies-sorted');
  ignorePath = config.get('ignore-path');
  fileTypes = config.get('file-types');

  if (stream.src) {
    config.set('stream', {
      src: injectScriptsStream(stream.path, stream.src, stream.fileType),
      fileType: stream.fileType
    });
  } else {
    config.get('src').forEach(injectScripts);
  }

  return config;
}
1192872
public String prettyDependencies() {
        StringBuilder b = new StringBuilder();
        b.append(id()).append('\n');
        for (Iterator<Script> ite = dependencies.iterator(); ite.hasNext(); ) {
            Script n = ite.next();
            prettyDependencies(b, !ite.hasNext(), 0, n);
        }
        return b.toString();
    }
110382
async function getJSXConfig(asset, isSourceModule) {
  // Don't enable JSX in node_modules
  if (!isSourceModule) {
    return null;
  }

  let pkg = await asset.getPackage();

  // Find a dependency that we can map to a JSX pragma
  let pragma = null;
  for (let dep in JSX_PRAGMA) {
    if (
      pkg &&
      ((pkg.dependencies && pkg.dependencies[dep]) ||
        (pkg.devDependencies && pkg.devDependencies[dep]))
    ) {
      pragma = JSX_PRAGMA[dep];
      break;
    }
  }

  if (!pragma) {
    pragma = maybeCreateFallbackPragma(asset);
  }

  if (pragma || JSX_EXTENSIONS[path.extname(asset.name)]) {
    return {
      internal: true,
      babelVersion: 7,
      config: {
        plugins: [
          [
            require('@babel/plugin-transform-react-jsx'),
            {
              pragma,
              pragmaFrag: 'React.Fragment'
            }
          ]
        ]
      }
    };
  }
}
1030479
private void addRelevantProjectDependenciesToClasspath(Set<URL> path) throws MojoExecutionException {
        if (this.includeProjectDependencies) {
            try {
                getLog().debug("Project Dependencies will be included.");

                URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI().toURL();
                getLog().debug("Adding to classpath : " + mainClasses);
                path.add(mainClasses);

                Set<Artifact> dependencies = CastUtils.cast(project.getArtifacts());

                // system scope dependencies are not returned by maven 2.0. See
                // MEXEC-17
                dependencies.addAll(getAllNonTestScopedDependencies());

                Iterator<Artifact> iter = dependencies.iterator();
                while (iter.hasNext()) {
                    Artifact classPathElement = iter.next();
                    getLog().debug("Adding project dependency artifact: " + classPathElement.getArtifactId()
                        + " to classpath");
                    File file = classPathElement.getFile();
                    if (file != null) {
                        path.add(file.toURI().toURL());
                    }
                }

            } catch (MalformedURLException e) {
                throw new MojoExecutionException("Error during setting up classpath", e);
            }
        } else {
            getLog().debug("Project Dependencies will be excluded.");
        }

    }
665191
function (dirname, indexpath) {
    var extensions = {js: 1},
        modules = {};

    indexpath = indexpath || path.join(dirname, 'index.js');

    // Load all exported objects into a single module.
    fs.readdirSync(dirname).forEach(function (filename) {
      var fullpath = path.join(dirname, filename),
          parts    = filename.split('.'),
          module, name;

      if (fullpath !== indexpath && extensions[parts.pop()] && '.' !== filename[0]) {
        name = parts.join('.');
        module = require(fullpath);

        // Grab the function name or module name if possible.
        if (typeof module.name === 'string') {
          name = module.name;
        }

        modules[name] = module;
      }
    });

    return modules;
  }
1243876
function (out) {
            var tplParam = out.templateParam;
            if (tplParam.$hasScript) {
                out.scriptClasspath = tplParam.$classpath + "Script";
                out.scriptClassName = this._getClassName(out.scriptClasspath);
                out.addDependency(out.scriptClasspath);
            }
        }