From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送
---
node_modules/webpack/lib/Chunk.js | 87 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 81 insertions(+), 6 deletions(-)
diff --git a/node_modules/webpack/lib/Chunk.js b/node_modules/webpack/lib/Chunk.js
index 0ff363a..0492553 100644
--- a/node_modules/webpack/lib/Chunk.js
+++ b/node_modules/webpack/lib/Chunk.js
@@ -37,6 +37,7 @@
const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files");
/**
+ * Defines the chunk maps type used by this module.
* @deprecated
* @typedef {object} ChunkMaps
* @property {Record<ChunkId, string>} hash
@@ -45,16 +46,19 @@
*/
/**
+ * Defines the chunk module id map type used by this module.
* @deprecated
* @typedef {Record<ChunkId, ChunkId[]>} ChunkModuleIdMap
*/
/**
+ * Defines the chunk module hash map type used by this module.
* @deprecated
* @typedef {Record<ModuleId, string>} chunkModuleHashMap
*/
/**
+ * Defines the chunk module maps type used by this module.
* @deprecated
* @typedef {object} ChunkModuleMaps
* @property {ChunkModuleIdMap} id
@@ -67,6 +71,7 @@
/** @typedef {SortableSet<ChunkGroup>} SortableChunkGroups */
/** @typedef {Record<string, ChunkId[]>} ChunkChildIdsByOrdersMap */
/** @typedef {Record<string, ChunkChildIdsByOrdersMap>} ChunkChildIdsByOrdersMapByData */
+/** @typedef {{ onChunks: Chunk[], chunks: Chunks }} ChunkChildOfTypeInOrder */
let debugId = 1000;
@@ -76,6 +81,7 @@
*/
class Chunk {
/**
+ * Creates an instance of Chunk.
* @param {ChunkName=} name of chunk being created, is optional (for subclasses)
* @param {boolean} backCompat enable backward-compatibility
*/
@@ -123,6 +129,11 @@
// TODO remove in webpack 6
// BACKWARD-COMPAT START
+ /**
+ * Returns entry module.
+ * @deprecated
+ * @returns {Module | undefined} entry module
+ */
get entryModule() {
const entryModules = [
...ChunkGraph.getChunkGraphForChunk(
@@ -143,6 +154,8 @@
}
/**
+ * Checks whether this chunk has an entry module.
+ * @deprecated
* @returns {boolean} true, if the chunk contains an entry module
*/
hasEntryModule() {
@@ -156,6 +169,8 @@
}
/**
+ * Adds the provided module to the chunk.
+ * @deprecated
* @param {Module} module the module
* @returns {boolean} true, if the chunk could be added
*/
@@ -171,6 +186,8 @@
}
/**
+ * Removes the provided module from the chunk.
+ * @deprecated
* @param {Module} module the module
* @returns {void}
*/
@@ -183,6 +200,8 @@
}
/**
+ * Gets the number of modules in this chunk.
+ * @deprecated
* @returns {number} the number of module which are contained in this chunk
*/
getNumberOfModules() {
@@ -193,6 +212,10 @@
).getNumberOfChunkModules(this);
}
+ /**
+ * @deprecated
+ * @returns {Iterable<Module>} modules
+ */
get modulesIterable() {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
this,
@@ -206,8 +229,10 @@
}
/**
+ * Compares this chunk with another chunk.
+ * @deprecated
* @param {Chunk} otherChunk the chunk to compare with
- * @returns {-1|0|1} the comparison result
+ * @returns {-1 | 0 | 1} the comparison result
*/
compareTo(otherChunk) {
const chunkGraph = ChunkGraph.getChunkGraphForChunk(
@@ -219,6 +244,8 @@
}
/**
+ * Checks whether this chunk contains the module.
+ * @deprecated
* @param {Module} module the module
* @returns {boolean} true, if the chunk contains the module
*/
@@ -231,6 +258,8 @@
}
/**
+ * Returns the modules for this chunk.
+ * @deprecated
* @returns {Module[]} the modules for this chunk
*/
getModules() {
@@ -242,6 +271,8 @@
}
/**
+ * Removes this chunk from the chunk graph and chunk groups.
+ * @deprecated
* @returns {void}
*/
remove() {
@@ -255,6 +286,8 @@
}
/**
+ * Moves a module from this chunk to another chunk.
+ * @deprecated
* @param {Module} module the module
* @param {Chunk} otherChunk the target chunk
* @returns {void}
@@ -270,6 +303,8 @@
}
/**
+ * Integrates another chunk into this chunk when possible.
+ * @deprecated
* @param {Chunk} otherChunk the other chunk
* @returns {boolean} true, if the specified chunk has been integrated
*/
@@ -288,6 +323,8 @@
}
/**
+ * Checks whether this chunk can be integrated with another chunk.
+ * @deprecated
* @param {Chunk} otherChunk the other chunk
* @returns {boolean} true, if chunks could be integrated
*/
@@ -301,6 +338,8 @@
}
/**
+ * Checks whether this chunk is empty.
+ * @deprecated
* @returns {boolean} true, if this chunk contains no module
*/
isEmpty() {
@@ -313,6 +352,8 @@
}
/**
+ * Returns the total size of all modules in this chunk.
+ * @deprecated
* @returns {number} total size of all modules in this chunk
*/
modulesSize() {
@@ -325,6 +366,8 @@
}
/**
+ * Returns the estimated size for the requested source type.
+ * @deprecated
* @param {ChunkSizeOptions} options options object
* @returns {number} total size of this chunk
*/
@@ -338,6 +381,8 @@
}
/**
+ * Returns the integrated size with another chunk.
+ * @deprecated
* @param {Chunk} otherChunk the other chunk
* @param {ChunkSizeOptions} options options object
* @returns {number} total size of the chunk or false if the chunk can't be integrated
@@ -352,6 +397,8 @@
}
/**
+ * Gets chunk module maps.
+ * @deprecated
* @param {ModuleFilterPredicate} filterFn function used to filter modules
* @returns {ChunkModuleMaps} module map information
*/
@@ -397,6 +444,8 @@
}
/**
+ * Checks whether this chunk contains a matching module in the graph.
+ * @deprecated
* @param {ModuleFilterPredicate} filterFn predicate function used to filter modules
* @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks
* @returns {boolean} return true if module exists in graph
@@ -411,6 +460,7 @@
}
/**
+ * Returns the chunk map information.
* @deprecated
* @param {boolean} realHash whether the full hash or the rendered hash is to be used
* @returns {ChunkMaps} the chunk map information
@@ -448,6 +498,7 @@
// BACKWARD-COMPAT END
/**
+ * Checks whether this chunk has runtime.
* @returns {boolean} whether or not the Chunk will have a runtime
*/
hasRuntime() {
@@ -463,6 +514,7 @@
}
/**
+ * Checks whether it can be initial.
* @returns {boolean} whether or not this chunk can be an initial chunk
*/
canBeInitial() {
@@ -473,6 +525,7 @@
}
/**
+ * Checks whether this chunk is only initial.
* @returns {boolean} whether this chunk can only be an initial chunk
*/
isOnlyInitial() {
@@ -484,6 +537,7 @@
}
/**
+ * Gets entry options.
* @returns {EntryOptions | undefined} the entry options for this chunk
*/
getEntryOptions() {
@@ -496,6 +550,7 @@
}
/**
+ * Adds the provided chunk group to the chunk.
* @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being added
* @returns {void}
*/
@@ -504,6 +559,7 @@
}
/**
+ * Removes the provided chunk group from the chunk.
* @param {ChunkGroup} chunkGroup the chunkGroup the chunk is being removed from
* @returns {void}
*/
@@ -512,6 +568,7 @@
}
/**
+ * Checks whether this chunk is in group.
* @param {ChunkGroup} chunkGroup the chunkGroup to check
* @returns {boolean} returns true if chunk has chunkGroup reference and exists in chunkGroup
*/
@@ -520,6 +577,7 @@
}
/**
+ * Gets number of groups.
* @returns {number} the amount of groups that the said chunk is in
*/
getNumberOfGroups() {
@@ -527,6 +585,7 @@
}
/**
+ * Gets groups iterable.
* @returns {SortableChunkGroups} the chunkGroups that the said chunk is referenced in
*/
get groupsIterable() {
@@ -535,6 +594,7 @@
}
/**
+ * Disconnects from groups.
* @returns {void}
*/
disconnectFromGroups() {
@@ -544,6 +604,7 @@
}
/**
+ * Processes the provided new chunk.
* @param {Chunk} newChunk the new chunk that will be split out of
* @returns {void}
*/
@@ -559,6 +620,7 @@
}
/**
+ * Updates the hash with the data contributed by this instance.
* @param {Hash} hash hash (will be modified)
* @param {ChunkGraph} chunkGraph the chunk graph
* @returns {void}
@@ -584,6 +646,7 @@
}
/**
+ * Gets all async chunks.
* @returns {Chunks} a set of all the async chunks
*/
getAllAsyncChunks() {
@@ -624,6 +687,7 @@
}
/**
+ * Gets all initial chunks.
* @returns {Chunks} a set of all the initial chunks (including itself)
*/
getAllInitialChunks() {
@@ -641,6 +705,7 @@
}
/**
+ * Gets all referenced chunks.
* @returns {Chunks} a set of all the referenced chunks (including itself)
*/
getAllReferencedChunks() {
@@ -662,6 +727,7 @@
}
/**
+ * Gets all referenced async entrypoints.
* @returns {Entrypoints} a set of all the referenced entrypoints
*/
getAllReferencedAsyncEntrypoints() {
@@ -683,6 +749,7 @@
}
/**
+ * Checks whether this chunk has async chunks.
* @returns {boolean} true, if the chunk references async chunks
*/
hasAsyncChunks() {
@@ -714,12 +781,13 @@
}
/**
+ * Gets child ids by orders.
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {ChunkFilterPredicate=} filterFn function used to filter chunks
* @returns {Record<string, ChunkId[]>} a record object of names to lists of child ids(?)
*/
getChildIdsByOrders(chunkGraph, filterFn) {
- /** @type {Map<string, {order: number, group: ChunkGroup}[]>} */
+ /** @type {Map<string, { order: number, group: ChunkGroup }[]>} */
const lists = new Map();
for (const group of this.groupsIterable) {
if (group.chunks[group.chunks.length - 1] === this) {
@@ -772,16 +840,19 @@
}
/**
+ * Gets children of type in order.
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {string} type option name
- * @returns {{ onChunks: Chunk[], chunks: Chunks }[] | undefined} referenced chunks for a specific type
+ * @returns {ChunkChildOfTypeInOrder[] | undefined} referenced chunks for a specific type
*/
getChildrenOfTypeInOrder(chunkGraph, type) {
+ /** @type {{ order: number, group: ChunkGroup, childGroup: ChunkGroup }[]} */
const list = [];
for (const group of this.groupsIterable) {
for (const childGroup of group.childrenIterable) {
const order =
- childGroup.options[/** @type {keyof ChunkGroupOptions} */ (type)];
+ /** @type {number} */
+ (childGroup.options[/** @type {keyof ChunkGroupOptions} */ (type)]);
if (order === undefined) continue;
list.push({
order,
@@ -792,12 +863,13 @@
}
if (list.length === 0) return;
list.sort((a, b) => {
- const cmp =
- /** @type {number} */ (b.order) - /** @type {number} */ (a.order);
+ const cmp = b.order - a.order;
if (cmp !== 0) return cmp;
return a.group.compareTo(chunkGraph, b.group);
});
+ /** @type {ChunkChildOfTypeInOrder[]} */
const result = [];
+ /** @type {undefined | ChunkChildOfTypeInOrder} */
let lastEntry;
for (const { group, childGroup } of list) {
if (lastEntry && lastEntry.onChunks === group.chunks) {
@@ -817,6 +889,7 @@
}
/**
+ * Gets child ids by orders map.
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included)
* @param {ChunkFilterPredicate=} filterFn function used to filter chunks
@@ -827,6 +900,7 @@
const chunkMaps = Object.create(null);
/**
+ * Adds child ids by orders to map.
* @param {Chunk} chunk a chunk
* @returns {void}
*/
@@ -862,6 +936,7 @@
}
/**
+ * Checks whether this chunk contains the chunk graph.
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {string} type option name
* @param {boolean=} includeDirectChildren include direct children (by default only children of async children are included)
--
Gitblit v1.9.3