main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
949 bytes
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Tobias Koppers @sokra
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | const Entrypoint = require("../Entrypoint");
|
---|
9 |
|
---|
10 | /** @typedef {import("../Chunk")} Chunk */
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * @param {Entrypoint} entrypoint a chunk group
|
---|
14 | * @param {(Chunk | null)=} excludedChunk1 current chunk which is excluded
|
---|
15 | * @param {(Chunk | null)=} excludedChunk2 runtime chunk which is excluded
|
---|
16 | * @returns {Set<Chunk>} chunks
|
---|
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 | module.exports.getAllChunks = getAllChunks;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.