Class SortedDependencies<InputT extends DependencyInfo>
- java.lang.Object
-
- com.google.javascript.jscomp.deps.SortedDependencies<InputT>
-
public final class SortedDependencies<InputT extends DependencyInfo> extends java.lang.Object
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 Modifier and Type Class Description static class
SortedDependencies.MissingProvideException
-
Constructor Summary
Constructors Constructor Description SortedDependencies(java.util.List<InputT> userOrderedInputs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputT
getInputProviding(java.lang.String symbolName)
Return the input that gives us the given symbol.com.google.common.collect.ImmutableList<InputT>
getInputsWithoutProvides()
java.util.List<InputT>
getSortedList()
com.google.common.collect.ImmutableList<InputT>
getSortedStrongDependenciesOf(java.util.List<InputT> roots)
Gets all the strong dependencies of the given roots.com.google.common.collect.ImmutableList<InputT>
getSortedWeakDependenciesOf(java.util.List<InputT> rootInputs)
Gets all the weak dependencies of the given roots.com.google.common.collect.ImmutableList<InputT>
getStrongDependenciesOf(java.util.List<InputT> rootInputs, boolean sorted)
Gets all the strong dependencies of the given roots.InputT
maybeGetInputProviding(java.lang.String symbol)
Return the input that gives us the given symbol, or null.
-
-
-
Constructor Detail
-
SortedDependencies
public SortedDependencies(java.util.List<InputT> userOrderedInputs)
-
-
Method Detail
-
getStrongDependenciesOf
public com.google.common.collect.ImmutableList<InputT> getStrongDependenciesOf(java.util.List<InputT> rootInputs, boolean sorted)
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.- Parameters:
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 InputT getInputProviding(java.lang.String symbolName) throws SortedDependencies.MissingProvideException
Return the input that gives us the given symbol.- Throws:
SortedDependencies.MissingProvideException
- An exception if there is no input for this symbol.
-
getInputsWithoutProvides
public com.google.common.collect.ImmutableList<InputT> getInputsWithoutProvides()
-
getSortedStrongDependenciesOf
public com.google.common.collect.ImmutableList<InputT> getSortedStrongDependenciesOf(java.util.List<InputT> roots)
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.
-
getSortedWeakDependenciesOf
public com.google.common.collect.ImmutableList<InputT> getSortedWeakDependenciesOf(java.util.List<InputT> rootInputs)
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.
-
getSortedList
public java.util.List<InputT> getSortedList()
-
maybeGetInputProviding
public InputT maybeGetInputProviding(java.lang.String symbol)
Return the input that gives us the given symbol, or null.
-
-