(entrypoint, excludedChunk1, excludedChunk2)
| 17 | * @returns {Set<Chunk>} chunks |
| 18 | */ |
| 19 | const 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 | |
| 46 | module.exports.getAllChunks = getAllChunks; |
no test coverage detected