Package com.google.javascript.jscomp
Class JSModuleGraph
- java.lang.Object
- 
- com.google.javascript.jscomp.JSModuleGraph
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public final class JSModuleGraph extends java.lang.Object implements java.io.SerializableAJSModuledependency 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.- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classJSModuleGraph.MissingModuleExceptionAnother exception classprotected static classJSModuleGraph.ModuleDependenceExceptionException 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 SummaryConstructors Constructor Description JSModuleGraph(JSModule[] modulesInDepOrder)Creates a module graph from a list of modules in dependency order.JSModuleGraph(java.util.List<JSModule> modulesInDepOrder)Creates a module graph from a list of modules in dependency order.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandependsOn(JSModule src, JSModule m)Determines whether this module depends on a given module.JSModulegetDeepestCommonDependencyInclusive(JSModule m1, JSModule m2)Finds the deepest common dependency of two modules, including the modules themselves.JSModulegetDeepestCommonDependencyInclusive(java.util.Collection<JSModule> modules)Returns the deepest common dependency of the given modules.JSModulegetSmallestCoveringSubtree(JSModule parentTree, java.util.BitSet dependentModules)Finds the module with the fewest transitive dependents on which all of the given modules depend and that is a subtree of the given parent module tree.com.google.common.collect.ImmutableList<CompilerInput>manageDependencies(AbstractCompiler compiler, DependencyOptions dependencyOptions)Apply the dependency options to the list of sources, returning a new source list re-ordering and dropping files as necessary.
 
- 
- 
- 
Method Detail- 
dependsOnpublic boolean dependsOn(JSModule src, JSModule m) Determines whether this module depends on a given module. Note that a module never depends on itself, as that dependency would be cyclic.
 - 
getSmallestCoveringSubtreepublic JSModule getSmallestCoveringSubtree(JSModule parentTree, java.util.BitSet dependentModules) Finds the module with the fewest transitive dependents on which all of the given modules depend and that is a subtree of the given parent module tree.If no such subtree can be found, the parent module is returned. If multiple candidates have the same number of dependents, the module farthest down in the total ordering of modules will be chosen. - Parameters:
- parentTree- module on which the result must depend
- dependentModules- indices of modules to consider
- Returns:
- A module on which all of the argument modules depend
 
 - 
getDeepestCommonDependencyInclusivepublic JSModule getDeepestCommonDependencyInclusive(JSModule m1, JSModule m2) Finds the deepest common dependency of two modules, including the modules themselves.- Parameters:
- m1- A module in this graph
- m2- A module in this graph
- Returns:
- The deepest common dep of m1andm2, or null if they have no common dependencies
 
 - 
getDeepestCommonDependencyInclusivepublic JSModule getDeepestCommonDependencyInclusive(java.util.Collection<JSModule> modules) Returns the deepest common dependency of the given modules.
 - 
manageDependenciespublic com.google.common.collect.ImmutableList<CompilerInput> manageDependencies(AbstractCompiler compiler, DependencyOptions dependencyOptions) throws SortedDependencies.MissingProvideException, JSModuleGraph.MissingModuleException Apply the dependency options to the list of sources, returning a new source list re-ordering and dropping files as necessary. This module graph will be updated to reflect the new list.See DependencyOptionsfor more information on how this works.- Throws:
- SortedDependencies.MissingProvideException- if an entry point was not provided by any of the inputs.
- JSModuleGraph.MissingModuleException
 
 
- 
 
-