Class Es6SortedDependencies<INPUT extends DependencyInfo>

  • 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.

    • 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 interface SortedDependencies<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.
      • 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 interface SortedDependencies<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 interface SortedDependencies<INPUT extends DependencyInfo>