MCPcopy
hub / github.com/webpack/webpack / compareChunksNatural

Function compareChunksNatural

lib/util/comparators.js:534–550  ·  view source on GitHub ↗
(chunkGraph)

Source from the content-addressed store, hash-verified

532 * @returns {Comparator<Chunk>} comparator
533 */
534const compareChunksNatural = (chunkGraph) => {
535 const cmpFn = module.exports.compareModulesById(chunkGraph);
536 const cmpIterableFn = compareIterables(cmpFn);
537 return concatComparators(
538 compareSelect((chunk) => /** @type {ChunkName} */ (chunk.name), compareIds),
539 compareSelect((chunk) => chunk.runtime, compareRuntime),
540 compareSelect(
541 /**
542 * Handles the callback logic for this hook.
543 * @param {Chunk} chunk a chunk
544 * @returns {Iterable<Module>} modules
545 */
546 (chunk) => chunkGraph.getOrderedChunkModulesIterable(chunk, cmpFn),
547 cmpIterableFn
548 )
549 );
550};
551
552/**
553 * For HarmonyImportSideEffectDependency and HarmonyImportSpecifierDependency, we should prioritize import order to match the behavior of running modules directly in a JS engine without a bundler.

Callers 4

applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85

Calls 4

compareIterablesFunction · 0.85
concatComparatorsFunction · 0.85
compareSelectFunction · 0.85

Tested by

no test coverage detected