public final class JSModuleGraph extends Object
JSModule
dependency graph that assigns a depth to each module and can answer
depth-related queries about them. For the purposes of this class, a module's depth is defined as
the number of hops in the longest (non cyclic) path from the module to a module with no
dependencies.Modifier and Type | Class and Description |
---|---|
static class |
JSModuleGraph.MissingModuleException
Another exception class
|
protected static class |
JSModuleGraph.ModuleDependenceException
Exception class for declaring when the modules being fed into a
JSModuleGraph as input aren't in dependence order, and so can't be
processed for caching of various dependency-related queries.
|
Constructor and Description |
---|
JSModuleGraph(JSModule[] modulesInDepOrder)
Creates a module graph from a list of modules in dependency order.
|
JSModuleGraph(List<JSModule> modulesInDepOrder)
Creates a module graph from a list of modules in dependency order.
|
Modifier and Type | Method and Description |
---|---|
void |
breakThisGraphSoItsModulesCanBeReused()
Deprecated.
Fix the tests that use this.
|
boolean |
dependsOn(JSModule src,
JSModule m)
Determines whether this module depends on a given module.
|
JSModule |
getDeepestCommonDependencyInclusive(Collection<JSModule> modules)
Returns the deepest common dependency of the given modules.
|
JSModule |
getDeepestCommonDependencyInclusive(JSModule m1,
JSModule m2)
Finds the deepest common dependency of two modules, including the
modules themselves.
|
JSModule |
getSmallestCoveringDependency(Collection<JSModule> dependentModules)
Finds the module with the fewest transitive dependents on which all of the given modules
depend.
|
List<CompilerInput> |
manageDependencies(DependencyOptions depOptions,
List<CompilerInput> inputs)
Apply the dependency options to the list of sources, returning a new
source list re-ordering and dropping files as necessary.
|
List<CompilerInput> |
manageDependencies(List<ModuleIdentifier> entryPoints,
List<CompilerInput> inputs)
Applies a DependencyOptions in "dependency sorting" and "dependency pruning"
mode to the given list of inputs.
|
public JSModuleGraph(JSModule[] modulesInDepOrder)
@Deprecated public void breakThisGraphSoItsModulesCanBeReused()
public boolean dependsOn(JSModule src, JSModule m)
public JSModule getSmallestCoveringDependency(Collection<JSModule> dependentModules)
If multiple candidates have the same number of dependents, the module farthest down in the total ordering of modules will be chosen.
dependentModules
- to considerpublic JSModule getDeepestCommonDependencyInclusive(JSModule m1, JSModule m2)
m1
- A module in this graphm2
- A module in this graphm1
and m2
, or null if
they have no common dependenciespublic JSModule getDeepestCommonDependencyInclusive(Collection<JSModule> modules)
public List<CompilerInput> manageDependencies(List<ModuleIdentifier> entryPoints, List<CompilerInput> inputs) throws JSModuleGraph.MissingModuleException, SortedDependencies.MissingProvideException
manageDependencies(DependencyOptions, List<CompilerInput>)
.entryPoints
- The entry points into the program.
Expressed as JS symbols.inputs
- The original list of sources. Used to ensure that the sort
is stable.SortedDependencies.MissingProvideException
- if an entry point was not provided
by any of the inputs.JSModuleGraph.MissingModuleException
for more info on how this works.
public List<CompilerInput> manageDependencies(DependencyOptions depOptions, List<CompilerInput> inputs) throws SortedDependencies.MissingProvideException, JSModuleGraph.MissingModuleException
inputs
- The original list of sources. Used to ensure that the sort
is stable.SortedDependencies.MissingProvideException
- if an entry point was not provided
by any of the inputs.JSModuleGraph.MissingModuleException
for more info on how this works.
Copyright © 2009-2017 Google. All Rights Reserved.