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 } comparator

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

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

compareLocations(a, b): void
  • a {DependencyLocation} A location node
  • b {DependencyLocation} 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} comparator
  • Returns: {Comparator} 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} comparator
  • c2 {Comparator} comparator
  • cRest {Comparator[]} comparators
  • Returns: {Comparator} comparator

keepOriginalOrder(iterable): void
  • iterable {Iterable} original ordered list
  • Returns: {Comparator} 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