1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const Entrypoint = require("../Entrypoint");
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | const getAllChunks = (entrypoint, excludedChunk1, excludedChunk2) => {
|
19 | const queue = new Set([entrypoint]);
|
20 | const chunks = new Set();
|
21 | for (const entrypoint of queue) {
|
22 | for (const chunk of entrypoint.chunks) {
|
23 | if (chunk === excludedChunk1) continue;
|
24 | if (chunk === excludedChunk2) continue;
|
25 | chunks.add(chunk);
|
26 | }
|
27 | for (const parent of entrypoint.parentsIterable) {
|
28 | if (parent instanceof Entrypoint) queue.add(parent);
|
29 | }
|
30 | }
|
31 | return chunks;
|
32 | };
|
33 | exports.getAllChunks = getAllChunks;
|