Finds or creates a dependency for Closure's base.js (which provides the
`goog` symbol).

@param {!Array<!depGraph.Dependency>} deps
@param {!Arguments} args
@return {!depGraph.Dependency}
335920
function getClosureDep(deps, args) {
  let closureDep = deps.find(d => d.closureSymbols.indexOf('goog') >= 0);

  // We need the path to Closure Library to be able to write a dependency file.
  // Note that if we find base.js via a dependency file (like Closure's deps.js)
  // it doesn't help us - we need the actual path of base.js, but the dependency
  // only knows the relative path from Closure Library to base.js, which is
  // always "base.js".
  if (!args.closurePath && (!closureDep || closureDep.isParsedFromDepsFile())) {
    throw new Error(
        'Could not find path to Closure. Closure\'s base.js either needs to ' +
        'be included or --closure-path provided.');
  }

  if (args.closurePath && closureDep && !closureDep.isParsedFromDepsFile()) {
    throw new Error(
        'Both --closure-path and Closure\'s base.js file should not be ' +
        'inputs.');
  }

  if (args.closurePath && closureDep && closureDep.isParsedFromDepsFile()) {
    closureDep.setClosurePath(args.closurePath);
  }

  if (!closureDep) {
    closureDep = new depGraph.Dependency(
        depGraph.DependencyType.SCRIPT, path.join(args.closurePath, 'base.js'),
        ['goog'], []);
    deps.push(closureDep);
  }

  return closureDep;
}
1116332
function generateDependenciesFiles ({ suffix, factories, entryFolder }) {
  const braceOpen = '{' // a hack to be able to create a single brace open character in handlebars

  // a map containing:
  // {
  //   'sqrt': true,
  //   'subset': true,
  //   ...
  // }
  const exists = {}
  Object.keys(factories).forEach(factoryName => {
    const factory = factories[factoryName]
    exists[factory.fn] = true
  })

  mkdirSyncIfNotExists(path.join(entryFolder, 'dependencies' + suffix))

  const data = {
    suffix,
    factories: Object.keys(factories).map((factoryName) => {
      const factory = factories[factoryName]

      return {
        suffix,
        factoryName,
        braceOpen,
        name: getDependenciesName(factoryName, factories), // FIXME: rename name with dependenciesName, and functionName with name
        fileName: './dependencies' + suffix + '/' + getDependenciesFileName(factoryName) + '.generated',
        eslintComment: factoryName === 'createSQRT1_2'
          ? ' // eslint-disable-line camelcase'
          : undefined,

        dependencies: factory.dependencies
          .map(stripOptionalNotation)
          .filter(dependency => !IGNORED_DEPENDENCIES[dependency])
          .filter(dependency => {
            if (!exists[dependency]) {
              if (factory.dependencies.indexOf(dependency) !== -1) {
                throw new Error(`Required dependency "${dependency}" missing for factory "${factory.fn}"`)
              }

              return false
            }

            return true
          })
          .map(dependency => {
            const factoryName = findFactoryName(factories, dependency)
            const name = getDependenciesName(factoryName, factories)
            const fileName = './' + getDependenciesFileName(factoryName) + '.generated'

            return {
              suffix,
              name,
              fileName
            }
          })
      }
    })
  }

  // generate a file for every dependency
  data.factories.forEach(factoryData => {
    const generatedFactory = dependenciesFileTemplate(factoryData)

    const p = path.join(entryFolder, factoryData.fileName + '.js')
    fs.writeFileSync(p, generatedFactory)
  })

  // generate a file with links to all dependencies
  const generated = dependenciesIndexTemplate(data)
  fs.writeFileSync(path.join(entryFolder, 'dependencies' + suffix + '.generated.js'), generated)
}
622768
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);
  }
171602
function(moduleName, deps, callback) {
  //if (moduleName === "jquery/selector") { debugger; }
  if (!deps && !callback) {
    return;
  }

  // Allow deps to be optional.
  if (!callback && typeof deps === "function") {
    callback = deps;
    deps = undefined;
  }

  // Ensure dependencies is never falsey.
  deps = deps || [];

  // Normalize the dependencies.
  deps = deps.map(function(dep) {
    if (dep.indexOf("./") === -1) {
      return dep;
    }

    // Take off the last path.
    var normalize = moduleName.split("/").slice(0, -1).join("/");

    //console.log(normalize, dep, define.join(normalize, dep));
    return define.join(normalize, dep);
  });

  // Attach to the module map.
  define.map[moduleName] = {
    moduleName: moduleName,
    deps: deps,
    callback: callback
  };
}
1195905
function () {
      var getConflictingDependencies = function (dependencies) {
        var conflicts = [];
        if (!dependencies) {
          return conflicts;
        }
        // for each dependency, extract and check the qualified artifactId
        dependencies.forEach(function (dependency) {
          function filterByDependencyString (dep) {
            return typeof dependency === 'string' ? dependency === dep : _.isEqual(dependency, dep);
          }

          var arrayOfEqualDependencies = dependencies.filter(
            filterByDependencyString);

          // find dependency in conflicts if dependency is n object
          var findedDep;
          if (typeof dependency === 'object') {
            findedDep = conflicts.find(function (dep) {
              return dep.artifactId === dependency.artifactId && dep.webpackageId === dependency.webpackageId && dep.endpointId === dependency.endpointId;
            });
          }
          if (arrayOfEqualDependencies.length > 1 && conflicts.indexOf(dependency) < 0 && !findedDep) {
            conflicts.push(dependency);
          }
        });
        return conflicts;
      };

      var doUniqueDependenciesCheck = function (artifact) {
        var conflictingDependencies = [];
        if (doc.modelVersion.indexOf('8.') === 0) { // we do have at least one endpoints for each artifact (modelVersion 8.x.x)
          // for each artifacts endpoint, check it's dependencies
          artifact.endpoints.forEach(function (endpoint) {
            conflictingDependencies = endpoint.dependencies ? getConflictingDependencies(endpoint.dependencies) : [];

            conflictingDependencies.forEach(function (dependency) {
              errors.push('RuleViolation identified: Artifact \'' + artifact.artifactId + '\' / endpoint \'' +
                endpoint.endpointId + '\' contains multiple references to dependency \'' + dependency +
                '\'');
            });
          });
        } else { // we don't have endpoints in artifact (modelVersion 9.x.x)
          // for each artifact, check it's dependencies
          conflictingDependencies = artifact.dependencies ? getConflictingDependencies(artifact.dependencies) : [];

          conflictingDependencies.forEach(function (dependency) {
            var dependencyStr = typeof dependency === 'object' ? JSON.stringify(dependency) : dependency;
            errors.push('RuleViolation identified: Artifact \'' + artifact.artifactId +
              '\' contains multiple references to dependency \'' + dependencyStr + '\'');
          });
        }
      };
      //
      var allArtifacts = [];
      // collect artifacts
      if (doc.artifacts) {
        var artifactTypes = Object.keys(doc.artifacts);
        artifactTypes.forEach(function (artifactType) {
          allArtifacts = allArtifacts.concat(doc.artifacts[ artifactType ]);
        });
      }
      // call rule for each artifact
      allArtifacts.forEach(function (artifact) {
        if (artifact.endpoints || artifact.dependencies) {
          doUniqueDependenciesCheck(artifact);
        }
      });
    }
284909
function TransformPlaceholderArgs({
    rawDependencies,
    args,
    replaceArgs = {}
}) {
    const dependencies = [...rawDependencies];
    // clone

    const dependenciesArgs = dependencies.map((dependency, i) => {
        const arg = args[i];
        if (dependency && replaceArgs[dependency]) {
            return replaceArgs[dependency];
        }
        return arg;
    });
    return [...dependenciesArgs, ...args.slice(dependenciesArgs.length)];
}
691342
function closureRequire(symbol) {
  closure.goog.require(symbol);
  return closure.goog.getObjectByName(symbol);
}
915846
function getDefineArgs({ id, factory, exports, _deps: deps, _special: special, }) {
	if (!factory) {
		factory = `() => (${ nl +'\t'+ JSON.stringify(exports) +' // eslint-disable-line'+ nl })`; deps = [ ];
	} else { factory += ''; }
	if (special) {
		factory =
		(/^.*?[(]/).exec(factory +'') + nl +'\t'+
		deps.map(({ name, use, }) => use ? use.replace(/^:\s*/, '') : name +',')
		.join(nl +'\t') + nl + factory.slice(deps.lastIndex + 1);
		deps = deps.map(_=>_.id);
	}
	return [ id, deps, factory, ];
}
1131927
function copy(args) {
  // TODO: Split arguments with destructure in the future
  const source = splitArg(args.source);
  const sourceApp = source[0];
  const sourcePath = source[1];
  const dest = splitArg(args.dest);
  const destApp = dest[0];
  const destPath = dest[1];

  return login(sourceApp, destApp).then((dbs) => {
    const sourceDB = dbs[0];
    const destDB = dbs[1];

    return normalizeArgs(sourceDB, sourcePath, destDB, destPath).then((paths) => {
      const sourcePath = paths[0];
      const destPath = paths[1];

      return streamFrom(sourceDB, sourcePath).then((args) => {
        const rs = args[0];
        const size = args[1];

        return streamTo(destDB, destPath, rs, size);
      });
    });
  });
}
1191651
function extractDependencyIds(options) {
  const dependencies = [];

  function extract(items) {
    // Invalid if not Array
    if (Array.isArray(items)) {
      items.reduce((dependencies, item) => {
        // Items can be Array with depedency as first param
        const dep = Array.isArray(item) ? item[0] : item;

        // Only gather string references, not functions/modules
        if ('string' == typeof dep) dependencies.push(dep);
        return dependencies;
      }, dependencies);
    }
  }

  if (options.plugins) extract(options.plugins);
  if (options.presets) extract(options.presets);

  return dependencies;
}
134921
function getFilterPattern(options) {
	var pattern;

	// if the --dev flag is passed, generate a bundle with the
	// node_modules dependencies AND StealJS @config graph
	if (options.dev) {
		pattern = ["node_modules/**/*", "package.json"];
	}
	// make a bundle of dependencies in node_modules folder
	// when the --deps flag is used
	else if (options.deps) {
		pattern = "node_modules/**/*";
	}

	return pattern;
}
348190
def dependency_tree(args = {}, &bl)
      dependencies = {}
      args = {:recursive    => true,
              :dev_deps     => true,
              :matching     => :latest,
              :dependencies => dependencies}.merge(args)

      process = []
      deps.each do |dep|
        resolved = nil
        begin
          resolved = Polisher::Gem.matching(dep, args[:matching])
        rescue
        end
        yield self, dep, resolved
        process << resolved unless resolved.nil?
      end

      process.each { |dep|
        dependencies.merge!(dep.dependency_tree(args, &bl))
      }

      dependencies
    end
373386
function substArguments(str, args, key) {
        var reArgs = /\{\{\s*(.+?)\s*\}\}/g;
        return str.replace(reArgs, function(matched_text, arg) {
            if (args && arg in args) {
                return args[arg];
            }
            if (arg in gL10nData) {
                return gL10nData[arg];
            }
            console.log("argument {{" + arg + "}} for #" + key + " is undefined.");
            return matched_text;
        });
    }
1350639
function lookupArgs (args, cb) {
  if (!args.length) return readInstalled([], function (er, inst) {
    if (er) return cb(er)
    var a = []
    asyncMap(Object.keys(inst), function (p, cb) {
      cb(null, Object.keys(inst[p]).map(function (v) {
        var o = {}
        o[p] = {}
        o[p][v] = inst[p][v]
        if (o[p][v].active) o[p].active = v
        return o
      }))
    }, cb)
  })
  var req = {}
  args.forEach(function (a) {
    a = a.split("@")
    var n = a.shift()
      , v = a.join("@")
    ;(req[n] = req[n] || []).push(v)
  })
  log.silly(req, "rebuild request")
  readInstalled(Object.keys(req), function (er, inst) {
    asyncMap(Object.keys(inst), function (p, cb) {
      if (!req.hasOwnProperty(p)) return cb()
      var matches = []
      Object.keys(inst[p]).forEach(function (v) {
        req[p].forEach(function (r) {
          var o = {}
          o[p] = {}
          if (inst[p][v].active) o[p].active = v
          if (semver.satisfies(v, r)) o[p][v] = inst[p][v]
          matches.push(o)
        })
      })
      log.verbose(p, "rebuild")
      cb(null, matches)
    }, cb)
  })
}
1264213
def _needs_dependencies(p_function):
    
    def build_dependency_information(p_todolist):
        for todo in p_todolist._todos:
            p_todolist._register_todo(todo)

    def inner(self, *args, **kwargs):
        if not self._initialized:
            self._initialized = True

            from topydo.lib.Graph import DirectedGraph
            self._depgraph = DirectedGraph()

            build_dependency_information(self)

        return p_function(self, *args, **kwargs)

    return inner
744526
function parseArgs(args) {
  var options = {
    arch: process.arch,
    platform: process.platform,
    force: process.env.npm_config_force === 'true',
  };

  options.args = args.filter(function(arg) {
    if (arg === '-f' || arg === '--force') {
      options.force = true;
      return false;
    } else if (arg.substring(0, 13) === '--target_arch') {
      options.arch = arg.substring(14);
    } else if (arg === '-d' || arg === '--debug') {
      options.debug = true;
    } else if (arg.substring(0, 13) === '--libsass_ext' && arg.substring(14) !== 'no') {
      options.libsassExt = true;
    }

    return true;
  });

  return options;
}
781256
function buildFirebaseUiJs(locale) {
  const flags = {
    closure_entry_point: 'firebaseui.auth.exports',
    define: `goog.LOCALE='${locale}'`,
    externs: [
      'node_modules/firebase/externs/firebase-app-externs.js',
      'node_modules/firebase/externs/firebase-auth-externs.js',
      'node_modules/firebase/externs/firebase-client-auth-externs.js'
    ],
    only_closure_dependencies: true,
    output_wrapper: OUTPUT_WRAPPER,

    // This is required to match XTB IDs to the JS/Soy messages.
    translations_project: 'FirebaseUI'
  };
  if (locale !== DEFAULT_LOCALE) {
    flags.translations_file = `translations/${locale}.xtb`;
  }
  return compile([
    'node_modules/google-closure-templates/javascript/soyutils_usegoog.js',
    'node_modules/google-closure-library/closure/goog/**/*.js',
    'node_modules/google-closure-library/third_party/closure/goog/**/*.js',
    `${TMP_DIR}/**/*.js`,
    'javascript/**/*.js'
  ], getTmpJsPath(locale), flags);
}