MCPcopy
hub / github.com/webpack/webpack / getAllChunks

Function getAllChunks

lib/javascript/ChunkHelpers.js:19–44  ·  view source on GitHub ↗
(entrypoint, excludedChunk1, excludedChunk2)

Source from the content-addressed store, hash-verified

17 * @returns {Set<Chunk>} chunks
18 */
19const getAllChunks = (entrypoint, excludedChunk1, excludedChunk2) => {
20 /** @type {Set<Entrypoint>} */
21 const queue = new Set([entrypoint]);
22 /** @type {Set<Entrypoint>} */
23 const groups = new Set();
24 for (const group of queue) {
25 if (group !== entrypoint) {
26 groups.add(group);
27 }
28 for (const parent of group.parentsIterable) {
29 if (parent instanceof Entrypoint) queue.add(parent);
30 }
31 }
32 groups.add(entrypoint);
33
34 /** @type {Set<Chunk>} */
35 const chunks = new Set();
36 for (const group of groups) {
37 for (const chunk of group.chunks) {
38 if (chunk === excludedChunk1) continue;
39 if (chunk === excludedChunk2) continue;
40 chunks.add(chunk);
41 }
42 }
43 return chunks;
44};
45
46module.exports.getAllChunks = getAllChunks;

Callers 2

applyMethod · 0.85
StartupHelpers.jsFile · 0.85

Calls 1

addMethod · 0.45

Tested by

no test coverage detected