source: frontend/node_modules/webpack/lib/javascript/ChunkHelpers.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const Entrypoint = require("../Entrypoint");
9
10/** @typedef {import("../Chunk")} Chunk */
11
12/**
13 * Returns chunks.
14 * @param {Entrypoint} entrypoint a chunk group
15 * @param {(Chunk | null)=} excludedChunk1 current chunk which is excluded
16 * @param {(Chunk | null)=} excludedChunk2 runtime chunk which is excluded
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;
Note: See TracBrowser for help on using the repository browser.