Puts the JS files into a topologically sorted order by their dependencies.
481156
public void sortInputsByDeps(AbstractCompiler compiler) {
    // Set the compiler, so that we can parse requires/provides and report
    // errors properly.
    for (CompilerInput input : inputs) {
      input.setCompiler(compiler);
    }

    // Sort the JSModule in this order.
    List<CompilerInput> sortedList = new Es6SortedDependencies<>(inputs).getSortedList();
    inputs.clear();
    inputs.addAll(sortedList);
  }
691191
function prepareSortOrder ( pkg ) {
	const index = SORT_ORDER.indexOf('repository');
	const unknownKeys = difference(Object.keys(pkg), SORT_ORDER).sort();
	return flatten(insert(SORT_ORDER, index, unknownKeys));
}
1145788
def turn_off_automated_sorting
      js_file = File.join(@dirs[:output_dir], 'html_files/js/gv.compiled.min.js')
      original_content = File.read(js_file)
      # removes the automatic sort on page load
      updated_content = original_content.gsub(',sortList:[[0,0]]', '')
      File.open("#{script_file}.tmp", 'w') { |f| f.puts updated_content }
      FileUtils.mv("#{script_file}.tmp", script_file)
    end
1067715
function distJsFiles() {
        return [{src: cog.pathDist() + cog.getConfig('name') + '.js', dst: cog.pathDist() + cog.getConfig('name') + '.min.js'}];
    }
107610
function watchjs(sources, outdir, outfile, opt_options) {
  var bundler = watchify(browserify({
    entries: sources,
    debug: false,
    // Watchify options:
    cache: {},
    packageCache: {},
    fullPaths: true
  }));

  bundler.on('update', function() {
    gutil.log('recompiling js...');
    rebundle_(bundler, outdir, outfile, opt_options);
    gutil.log('finished recompiling js');
  });
  return rebundle_(bundler, outdir, outfile, opt_options);
}
386203
protected function _includeComponents(): void
    {
        // for now, we just include all components
        $appComponentFolder = WWW_ROOT . 'js/app/components/';
        $folder = new Folder($appComponentFolder);
        $files = $folder->find('.*\.js');
        if (!empty($files)) {
            foreach ($files as $file) {
                $this->_dependencies[] = 'app/components/' . $file;
            }
        }

        // Add Plugin Components
        foreach (Plugin::loaded() as $pluginName) {
            $pluginJsComponentsFolder = Plugin::path($pluginName) . '/webroot/js/app/components/';
            if (is_dir($pluginJsComponentsFolder)) {
                $folder = new Folder($pluginJsComponentsFolder);
                $files = $folder->find('.*\.js');
                foreach ($files as $file) {
                    $this->_dependencies[] = '/' . Inflector::underscore($pluginName) . '/js/app/components/' . $file;
                }
            }
        }
    }
729020
def javascript_bundle(key, files = nil)
      javascript_bundles[key] = JavascriptBundle.new(self, key.to_s, files)
    end
1287703
function compilejs(sources, outdir, outfile, opt_options) {
  var bundler = browserify({
    entries: sources,
    debug: false
  });
  return rebundle_(bundler, outdir, outfile, opt_options);
}
1102795
def sorted(self, wantdirs=False):
        

        def add_dir(dirs, d):
            dirs.add(d)
            logger.debug('add_dir added %s', d)
            if d != self.base:
                parent, _ = os.path.split(d)
                assert parent not in ('', '/')
                add_dir(dirs, parent)

        result = set(self.files)    # make a copy!
        if wantdirs:
            dirs = set()
            for f in result:
                add_dir(dirs, os.path.dirname(f))
            result |= dirs
        return [os.path.join(*path_tuple) for path_tuple in
                sorted(os.path.split(path) for path in result)]
1129727
function(loader, packageJSON, isRoot){
		var deps = crawl.getDependencyMap(loader, packageJSON, isRoot);

		var dependencies = [];
		for(var name in deps) {
			dependencies.push(deps[name]);
		}

		return dependencies;
	}
936008
function installMutations(modules, enclosingFolder) {
  makeFolderLibraryIfNotExist(enclosingFolder);
  if (modules.length === 0) {
    return new Promise(resolve => resolve({}));
  }

  return npm.install(modules, {
    cwd: pathToMutations(enclosingFolder),
    save: true
  });
}
986079
function allJavascriptFiles() {
        return srcFiles().concat(otherJsFiles()).concat(unitTestFiles()).concat(unitTestHelperFiles()).concat(taskFiles()).concat(commonJsFiles());
    }
302494
function addAllFilesAndSubdirectories(dir, doneCallback) {
            FileSystem.resolve(dir, function (err, directory) {
                function visitor(entry) {
                    if (entry.isFile) {
                        if (!isFileExcluded(entry)) { // ignore .dotfiles and non-.js files
                            addFilesToTern([entry.fullPath]);
                        }
                    } else {
                        return !isDirectoryExcluded(entry.fullPath) &&
                            entry.name.indexOf(".") !== 0 &&
                            !stopAddingFiles;
                    }
                }

                if (err) {
                    return;
                }

                if (dir === FileSystem.getDirectoryForPath(rootTernDir)) {
                    doneCallback();
                    return;
                }

                directory.visit(visitor, doneCallback);
            });
        }
798150
function (allDependencies, patterns) {
    return _.transform(allDependencies, function (result, dependencies, fileType) {
        result[fileType] = _.reject(dependencies, function (dependency) {
            return _.find(patterns, function (pattern) {
                return dependency.match(pattern);
            });
        });
    });
}
403237
async function buildDirectDependentTree() {
  const dependents = new Map();

  for (const packageName of await _list()) {
    dependents.set(packageName, new Set());
  }

  for (const packageName of await _list()) {
    for (const dep of tree.get(packageName)) {
      dependents.get(dep).add(packageName);
    }
  }

  return dependents;
}
608796
public function sortByDependencies() : self
    {
        /** @var $packages Package[] */
        $packages = $this->packages;
        $sortedPackages = [];

        while (!empty($packages)) {
            foreach ($packages as $packageName => $package) {
                $dependentPackages = $package->getDependencies()->toArray();
                if (empty(array_diff_key($dependentPackages, $sortedPackages))) {
                    // all of this packages dependencies are already in the sorted array, so it can be appended
                    $sortedPackages[$packageName] = $package;
                    unset($packages[$packageName]);
                    continue(2);
                }
            }
            throw new \LogicException('Packages have circular dependencies');
        }

        return new static($sortedPackages);
    }
1017788
function bowerMainFiles(destination, allDone) {
			async.parallel({
				map: bowerList('map'),
				components: bowerList('paths')
			}, function(err, lists) {
				// Ensure all manual defined dependencies are contained in an array
				if (dependencies) {
					_.map(dependencies, function(value, key) {
						dependencies[key] = ensureArray(value);
					});
				}

				// Exclude devDependencies
				var devDependencies = lists.map.pkgMeta.devDependencies;
				if (devDependencies && !includeDev) {
					excludes = excludes.concat(Object.keys(devDependencies));
				}

				// Resolve dependency graph to ensure correct order of components when concat them
				var resolvedDependencies = resolveDependencies(lists.map);

				// List of main files
				var files = {};
				var groupStats = {};

				_.each(lists.components, function(component, name) {
					if (includes.length && _.indexOf(includes, name) === -1) return;
					if (excludes.length && _.indexOf(excludes, name) !== -1) return;

					var mainFiles = findMainFiles(name, component, lists.map.dependencies[name]);
					if (mainFiles.length) {
						if (callback) mainFiles = callback(mainFiles, name);

						var filteredMainFiles = mainFiles.filter(function(file) {
							return isFileExtension(file, '.' + destination.assetType);
						});
						if (grunt.option('verbose')) {
							groupStats[name]  = filteredMainFiles.map(_.partial(toFileStats, name));
						}

						files[name] = filteredMainFiles.map(grunt.file.read);
					}
					else {
						// Try to find and concat minispade package: packages/_name_/lib/main.js
						var pkg = getNpmPackage(name, component);
						if (pkg) {
							files[name] = pkg;
						}
						else {
							grunt.log.error('Can’t detect any .' + destination.path + ' on main files for "' +
								name + '" component. ' +
								'You should explicitly define it via bower_concat’s mainFiles option. ' +
								'See Readme for details.'
								);
						}
					}
				});

				if (grunt.option('verbose')) {
					logGroupStats(destination.assetType, resolvedDependencies, destination.path, groupStats);
					grunt.verbose.writeln();
				}

				// Gather files by respecting the order of resolved dependencies
				var modules = [];
				_.each(resolvedDependencies, function(name) {
					if (files[name]) {
						modules = modules.concat(files[name]);
					}
				});

				allDone(modules);
			});
		}