MCPcopy
hub / github.com/webpack/webpack / getAllAsyncChunks

Method getAllAsyncChunks

lib/Chunk.js:658–693  ·  view source on GitHub ↗

* Gets all async chunks. * @returns {Chunks} a set of all the async chunks

()

Source from the content-addressed store, hash-verified

656 * @returns {Chunks} a set of all the async chunks
657 */
658 getAllAsyncChunks() {
659 /** @type {Queue} */
660 const queue = new Set();
661 /** @type {Chunks} */
662 const chunks = new Set();
663
664 const initialChunks = intersect(
665 Array.from(this.groupsIterable, (g) => new Set(g.chunks))
666 );
667
668 /** @type {Queue} */
669 const initialQueue = new Set(this.groupsIterable);
670
671 for (const chunkGroup of initialQueue) {
672 for (const child of chunkGroup.childrenIterable) {
673 if (child instanceof Entrypoint) {
674 initialQueue.add(child);
675 } else {
676 queue.add(child);
677 }
678 }
679 }
680
681 for (const chunkGroup of queue) {
682 for (const chunk of chunkGroup.chunks) {
683 if (!initialChunks.has(chunk)) {
684 chunks.add(chunk);
685 }
686 }
687 for (const child of chunkGroup.childrenIterable) {
688 queue.add(child);
689 }
690 }
691
692 return chunks;
693 }
694
695 /**
696 * Gets all initial chunks.

Callers 8

getChunkModuleMapsMethod · 0.95
getChunkMapsMethod · 0.95
hasChildByOrderMethod · 0.95
getChunkModuleIdMapMethod · 0.80
getAllWasmModulesFunction · 0.80
generateMethod · 0.80

Calls 3

intersectFunction · 0.85
addMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected