MCPcopy
hub / github.com/webpack/webpack / assignAscendingChunkIds

Function assignAscendingChunkIds

lib/ids/IdHelpers.js:479–501  ·  view source on GitHub ↗
(chunks, compilation)

Source from the content-addressed store, hash-verified

477 * @returns {void}
478 */
479const assignAscendingChunkIds = (chunks, compilation) => {
480 const usedIds = getUsedChunkIds(compilation);
481
482 let nextId = 0;
483 if (usedIds.size > 0) {
484 for (const chunk of chunks) {
485 if (chunk.id === null) {
486 while (usedIds.has(String(nextId))) nextId++;
487 chunk.id = nextId;
488 chunk.ids = [nextId];
489 nextId++;
490 }
491 }
492 } else {
493 for (const chunk of chunks) {
494 if (chunk.id === null) {
495 chunk.id = nextId;
496 chunk.ids = [nextId];
497 nextId++;
498 }
499 }
500 }
501};
502
503module.exports.assignAscendingChunkIds = assignAscendingChunkIds;
504module.exports.assignAscendingModuleIds = assignAscendingModuleIds;

Callers 3

applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85

Calls 2

getUsedChunkIdsFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected