On this page

compareChunkGroupsByIndex(a, b): 0 | 1 | -1
Attributes
first chunk group
second chunk group
Returns:
{0|1|-1} compare result

Type:
{ParameterizedComparator< ChunkGraph, Chunk >}

compareChunksById(a, b): 0 | 1 | -1
Attributes
chunk
chunk
Returns:
{0|1|-1} compare result

compareChunksNatural(chunkGraph): Comparator< Chunk >
Attributes
chunkGraph:<ChunkGraph>
the chunk graph
Returns:
{Comparator< Chunk >} comparator

compareIds(a, b): 0 | 1 | -1
Attributes
first id
second id
Returns:
{0|1|-1} compare result

compareIterables(elementComparator): void
  • elementComparator {Comparator< T >} comparator for elements
  • Returns: {Comparator< Iterable< T > >} comparator for iterables of elements

compareLocations(a, b): 0 | 1 | -1
Attributes
A location node
A location node
Returns:
{0|1|-1} sorting comparator value

Compare two locations


Type:
{ParameterizedComparator< Compiler, Module >}

Compare modules by their full name. This differs from comparing by identifier in that the values have been normalized to be relative to the compiler context.


Type:
{ParameterizedComparator< ChunkGraph, Module >}

compareModulesByIdentifier(a, b): 0 | 1 | -1
Attributes
module
module
Returns:
{0|1|-1} compare result

Type:
{ParameterizedComparator< ChunkGraph, Module >}

Type:
{ParameterizedComparator< ModuleGraph, Module >}

Type:
{ParameterizedComparator< ModuleGraph, Module >}

compareNumbers(a, b): 0 | 1 | -1
Attributes
number
number
Returns:
{0|1|-1} compare result

compareSelect(getter, comparator): void
  • getter {Selector< T, R >} getter for value
  • comparator {Comparator< R >} comparator
  • Returns: {Comparator< T >} comparator

compareStrings(a, b): 0 | 1 | -1
Attributes
first string
second string
Returns:
{0|1|-1} compare result

compareStringsNumeric(a, b): 0 | 1 | -1
Attributes
string
string
Returns:
{0|1|-1} compare result

concatComparators(c1, c2, ...cRest): void
  • c1 {Comparator< T >} comparator
  • c2 {Comparator< T >} comparator
  • cRest {Comparator< T >[]} comparators
  • Returns: {Comparator< T >} comparator

keepOriginalOrder(iterable): void
  • iterable {Iterable< T >} original ordered list
  • Returns: {Comparator< T >} comparator

sortWithSourceOrder(dependencies, dependencySourceOrderMap, onDependencyReSort?): void
Attributes
dependencies:<Dependency[]>
dependencies
dependencySourceOrderMap:
{WeakMap< Dependency, DependencySourceOrder >} dependency source order map
onDependencyReSort:<object>
optional callback to set index for each dependency
Returns:
{void}

For HarmonyImportSideEffectDependency and HarmonyImportSpecifierDependency, we should prioritize import order to match the behavior of running modules directly in a JS engine without a bundler. For other types like ConstDependency, we can instead prioritize usage order. https://github.com/webpack/webpack/pull/19686