Class Es6SortedDependencies<INPUT extends DependencyInfo>
- java.lang.Object
-
- com.google.javascript.jscomp.deps.Es6SortedDependencies<INPUT>
-
- All Implemented Interfaces:
SortedDependencies<INPUT>
public final class Es6SortedDependencies<INPUT extends DependencyInfo> extends java.lang.Object implements SortedDependencies<INPUT>
A sorted list of inputs following the ES6 module ordering spec.Orders such that each input always comes after its dependencies. Circular references are allowed by emitting the current input in the moment before a loop would complete.
The resulting order is not the same as the user-provided order but is influenced by it since it may take more than one graph traversal to account for all provided inputs and the graph traversals start with the first user provided input and continue from there.
Also exposes other information about the inputs, like which inputs do not provide symbols.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.javascript.jscomp.deps.SortedDependencies
SortedDependencies.MissingProvideException
-
-
Constructor Summary
Constructors Constructor Description Es6SortedDependencies(java.util.List<INPUT> userOrderedInputs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description INPUT
getInputProviding(java.lang.String symbolName)
Return the input that gives us the given symbol.com.google.common.collect.ImmutableList<INPUT>
getInputsWithoutProvides()
java.util.List<INPUT>
getSortedList()
com.google.common.collect.ImmutableList<INPUT>
getSortedStrongDependenciesOf(java.util.List<INPUT> roots)
Gets all the strong dependencies of the given roots.java.util.List<INPUT>
getSortedWeakDependenciesOf(java.util.List<INPUT> rootInputs)
Gets all the weak dependencies of the given roots.com.google.common.collect.ImmutableList<INPUT>
getStrongDependenciesOf(java.util.List<INPUT> rootInputs, boolean sorted)
Gets all the strong dependencies of the given roots.INPUT
maybeGetInputProviding(java.lang.String symbol)
Return the input that gives us the given symbol, or null.
-
-
-
Constructor Detail
-
Es6SortedDependencies
public Es6SortedDependencies(java.util.List<INPUT> userOrderedInputs)
-
-
Method Detail
-
getStrongDependenciesOf
public com.google.common.collect.ImmutableList<INPUT> getStrongDependenciesOf(java.util.List<INPUT> rootInputs, boolean sorted)
Description copied from interface:SortedDependencies
Gets all the strong dependencies of the given roots. The inputs must be returned in a stable order. In other words, if A comes before B, and A does not transitively depend on B, then A must also come before B in the returned list.- Specified by:
getStrongDependenciesOf
in interfaceSortedDependencies<INPUT extends DependencyInfo>
sorted
- If true, get them in topologically sorted order. If false, get them in the original order they were passed to the compiler.
-
getInputProviding
public INPUT getInputProviding(java.lang.String symbolName) throws SortedDependencies.MissingProvideException
Description copied from interface:SortedDependencies
Return the input that gives us the given symbol.- Specified by:
getInputProviding
in interfaceSortedDependencies<INPUT extends DependencyInfo>
- Throws:
SortedDependencies.MissingProvideException
- An exception if there is no input for this symbol.
-
getInputsWithoutProvides
public com.google.common.collect.ImmutableList<INPUT> getInputsWithoutProvides()
- Specified by:
getInputsWithoutProvides
in interfaceSortedDependencies<INPUT extends DependencyInfo>
-
getSortedStrongDependenciesOf
public com.google.common.collect.ImmutableList<INPUT> getSortedStrongDependenciesOf(java.util.List<INPUT> roots)
Description copied from interface:SortedDependencies
Gets all the strong dependencies of the given roots. The inputs must be returned in a stable order. In other words, if A comes before B, and A does not transitively depend on B, then A must also come before B in the returned list.- Specified by:
getSortedStrongDependenciesOf
in interfaceSortedDependencies<INPUT extends DependencyInfo>
-
getSortedWeakDependenciesOf
public java.util.List<INPUT> getSortedWeakDependenciesOf(java.util.List<INPUT> rootInputs)
Description copied from interface:SortedDependencies
Gets all the weak dependencies of the given roots. The inputs must be returned in stable order. In other words, if A comes before B, and A does not * transitively depend on B, then A must also come before B in the returned * list.The weak dependencies are those that are only reachable via type requires from the roots. Note that if a root weakly requires another input, then all of its transitive dependencies (strong or weak) that are not strongly reachable from the roots will be included. e.g. if A weakly requires B, and B strongly requires C, and A is the sole root, then this will return B and C. However, if we add D as a root, and D strongly requires C, then this will only return B.
Root inputs will never be in the returned list as they are all considered strong.
- Specified by:
getSortedWeakDependenciesOf
in interfaceSortedDependencies<INPUT extends DependencyInfo>
-
getSortedList
public java.util.List<INPUT> getSortedList()
- Specified by:
getSortedList
in interfaceSortedDependencies<INPUT extends DependencyInfo>
-
maybeGetInputProviding
public INPUT maybeGetInputProviding(java.lang.String symbol)
Description copied from interface:SortedDependencies
Return the input that gives us the given symbol, or null.- Specified by:
maybeGetInputProviding
in interfaceSortedDependencies<INPUT extends DependencyInfo>
-
-