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/ChunkGraph.js | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 157 insertions(+), 19 deletions(-)
diff --git a/node_modules/webpack/lib/ChunkGraph.js b/node_modules/webpack/lib/ChunkGraph.js
index 48497d2..22d8b01 100644
--- a/node_modules/webpack/lib/ChunkGraph.js
+++ b/node_modules/webpack/lib/ChunkGraph.js
@@ -35,14 +35,15 @@
/** @typedef {import("./Chunk").Entrypoints} Entrypoints */
/** @typedef {import("./Chunk").ChunkId} ChunkId */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
-/** @typedef {import("./Generator").SourceTypes} SourceTypes */
/** @typedef {import("./Module")} Module */
+/** @typedef {import("./Module").SourceType} SourceType */
+/** @typedef {import("./Module").SourceTypes} SourceTypes */
/** @typedef {import("./Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
/** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */
/** @typedef {import("./RuntimeModule")} RuntimeModule */
-/** @typedef {typeof import("./util/Hash")} Hash */
+/** @typedef {import("./util/Hash").HashFunction} HashFunction */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/** @type {ReadonlySet<string>} */
@@ -57,6 +58,7 @@
/** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */
/**
+ * Represents the module hash info runtime component.
* @typedef {object} ChunkSizeOptions
* @property {number=} chunkOverhead constant overhead for a chunk
* @property {number=} entryChunkMultiplicator multiplicator for initial chunks
@@ -64,16 +66,20 @@
class ModuleHashInfo {
/**
+ * Creates an instance of ModuleHashInfo.
* @param {string} hash hash
* @param {string} renderedHash rendered hash
*/
constructor(hash, renderedHash) {
+ /** @type {string} */
this.hash = hash;
+ /** @type {string} */
this.renderedHash = renderedHash;
}
}
/**
+ * Returns set as array.
* @template T
* @param {SortableSet<T>} set the set
* @returns {T[]} set as array
@@ -81,6 +87,7 @@
const getArray = (set) => [...set];
/**
+ * Gets module runtimes.
* @param {SortableChunks} chunks the chunks
* @returns {RuntimeSpecSet} runtimes
*/
@@ -93,11 +100,13 @@
};
/**
+ * Modules by source type.
* @param {SourceTypesByModule | undefined} sourceTypesByModule sourceTypesByModule
- * @returns {(set: SortableSet<Module>) => Map<string, SortableSet<Module>>} modules by source type
+ * @returns {ModulesBySourceType} modules by source type
*/
const modulesBySourceType = (sourceTypesByModule) => (set) => {
- /** @type {Map<string, SortableSet<Module>>} */
+ /** @typedef {SortableSet<Module>} ModuleSortableSet */
+ /** @type {Map<SourceType, ModuleSortableSet>} */
const map = new Map();
for (const module of set) {
const sourceTypes =
@@ -106,6 +115,7 @@
for (const sourceType of sourceTypes) {
let innerSet = map.get(sourceType);
if (innerSet === undefined) {
+ /** @type {ModuleSortableSet} */
innerSet = new SortableSet();
map.set(sourceType, innerSet);
}
@@ -121,9 +131,14 @@
}
return map;
};
+
+/** @typedef {(set: SortableSet<Module>) => Map<string, SortableSet<Module>>} ModulesBySourceType */
+
+/** @type {ModulesBySourceType} */
const defaultModulesBySourceType = modulesBySourceType(undefined);
/**
+ * Defines the module set to array function type used by this module.
* @typedef {(set: SortableSet<Module>) => Module[]} ModuleSetToArrayFunction
*/
@@ -134,6 +149,7 @@
const createOrderedArrayFunctionMap = new WeakMap();
/**
+ * Creates an ordered array function.
* @template T
* @param {ModuleComparator} comparator comparator function
* @returns {ModuleSetToArrayFunction} set as ordered array
@@ -150,6 +166,7 @@
};
/**
+ * Returns the size of the modules.
* @param {Iterable<Module>} modules the modules to get the count/size of
* @returns {number} the size of the modules
*/
@@ -163,11 +180,15 @@
return size;
};
+/** @typedef {Record<string, number>} SizesOfModules */
+
/**
+ * Gets modules sizes.
* @param {Iterable<Module>} modules the sortable Set to get the size of
- * @returns {Record<string, number>} the sizes of the modules
+ * @returns {SizesOfModules} the sizes of the modules
*/
const getModulesSizes = (modules) => {
+ /** @type {SizesOfModules} */
const sizes = Object.create(null);
for (const module of modules) {
for (const type of module.getSourceTypes()) {
@@ -178,6 +199,7 @@
};
/**
+ * Checks whether this module hash info is available chunk.
* @param {Chunk} a chunk
* @param {Chunk} b chunk
* @returns {boolean} true, if a is always a parent of b
@@ -198,6 +220,7 @@
/** @typedef {Set<Chunk>} EntryInChunks */
/** @typedef {Set<Chunk>} RuntimeInChunks */
/** @typedef {string | number} ModuleId */
+/** @typedef {RuntimeSpecMap<Set<string>, RuntimeRequirements>} ChunkGraphRuntimeRequirements */
class ChunkGraphModule {
constructor() {
@@ -211,7 +234,7 @@
this.hashes = undefined;
/** @type {ModuleId | null} */
this.id = null;
- /** @type {RuntimeSpecMap<Set<string>, RuntimeRequirements> | undefined} */
+ /** @type {ChunkGraphRuntimeRequirements | undefined} */
this.runtimeRequirements = undefined;
/** @type {RuntimeSpecMap<string, bigint> | undefined} */
this.graphHashes = undefined;
@@ -220,7 +243,7 @@
}
}
-/** @typedef {WeakMap<Module, Set<string>>} SourceTypesByModule */
+/** @typedef {WeakMap<Module, SourceTypes>} SourceTypesByModule */
/** @typedef {Map<Module, Entrypoint>} EntryModules */
class ChunkGraphChunk {
@@ -241,7 +264,7 @@
this.runtimeRequirements = undefined;
/** @type {Set<string>} */
this.runtimeRequirementsInTree = new Set();
-
+ /** @type {ModulesBySourceType} */
this._modulesBySourceType = defaultModulesBySourceType;
}
}
@@ -250,13 +273,15 @@
/** @typedef {Record<ModuleId, string>} IdToHashMap */
/** @typedef {Record<ChunkId, IdToHashMap>} ChunkModuleHashMap */
/** @typedef {Record<ChunkId, ModuleId[]>} ChunkModuleIdMap */
+/** @typedef {Record<ChunkId, boolean>} ChunkConditionMap */
/** @typedef {(a: Module, b: Module) => -1 | 0 | 1} ModuleComparator */
class ChunkGraph {
/**
+ * Creates an instance of ChunkGraph.
* @param {ModuleGraph} moduleGraph the module graph
- * @param {string | Hash} hashFunction the hash function to use
+ * @param {HashFunction} hashFunction the hash function to use
*/
constructor(moduleGraph, hashFunction = DEFAULTS.HASH_FUNCTION) {
/**
@@ -288,6 +313,7 @@
}
/**
+ * Get chunk graph module.
* @private
* @param {Module} module the module
* @returns {ChunkGraphModule} internal module
@@ -302,6 +328,7 @@
}
/**
+ * Get chunk graph chunk.
* @private
* @param {Chunk} chunk the chunk
* @returns {ChunkGraphChunk} internal chunk
@@ -316,6 +343,7 @@
}
/**
+ * Returns the graph roots.
* @param {SortableSet<Module>} set the sortable Set to get the roots of
* @returns {Module[]} the graph roots
*/
@@ -326,6 +354,7 @@
/** @type {Set<Module>} */
const set = new Set();
/**
+ * Adds the provided module to the chunk graph.
* @param {Module} module module
*/
const addDependencies = (module) => {
@@ -347,6 +376,7 @@
}
/**
+ * Connects chunk and module.
* @param {Chunk} chunk the new chunk
* @param {Module} module the module
* @returns {void}
@@ -359,6 +389,7 @@
}
/**
+ * Disconnects chunk and module.
* @param {Chunk} chunk the chunk
* @param {Module} module the module
* @returns {void}
@@ -373,6 +404,7 @@
}
/**
+ * Processes the provided chunk.
* @param {Chunk} chunk the chunk which will be disconnected
* @returns {void}
*/
@@ -388,6 +420,7 @@
}
/**
+ * Processes the provided chunk.
* @param {Chunk} chunk the chunk
* @param {Iterable<Module>} modules the modules
* @returns {void}
@@ -400,6 +433,7 @@
}
/**
+ * Attach runtime modules.
* @param {Chunk} chunk the chunk
* @param {Iterable<RuntimeModule>} modules the runtime modules
* @returns {void}
@@ -412,6 +446,7 @@
}
/**
+ * Attach full hash modules.
* @param {Chunk} chunk the chunk
* @param {Iterable<RuntimeModule>} modules the modules that require a full hash
* @returns {void}
@@ -425,6 +460,7 @@
}
/**
+ * Attach dependent hash modules.
* @param {Chunk} chunk the chunk
* @param {Iterable<RuntimeModule>} modules the modules that require a full hash
* @returns {void}
@@ -440,6 +476,7 @@
}
/**
+ * Processes the provided old module.
* @param {Module} oldModule the replaced module
* @param {Module} newModule the replacing module
* @returns {void}
@@ -511,6 +548,7 @@
}
/**
+ * Checks whether this chunk graph is module in chunk.
* @param {Module} module the checked module
* @param {Chunk} chunk the checked chunk
* @returns {boolean} true, if the chunk contains the module
@@ -521,6 +559,7 @@
}
/**
+ * Checks whether this chunk graph is module in chunk group.
* @param {Module} module the checked module
* @param {ChunkGroup} chunkGroup the checked chunk group
* @returns {boolean} true, if the chunk contains the module
@@ -533,6 +572,7 @@
}
/**
+ * Checks whether this chunk graph is entry module.
* @param {Module} module the checked module
* @returns {boolean} true, if the module is entry of any chunk
*/
@@ -542,6 +582,7 @@
}
/**
+ * Gets module chunks iterable.
* @param {Module} module the module
* @returns {Iterable<Chunk>} iterable of chunks (do not modify)
*/
@@ -551,6 +592,7 @@
}
/**
+ * Gets ordered module chunks iterable.
* @param {Module} module the module
* @param {(a: Chunk, b: Chunk) => -1 | 0 | 1} sortFn sort function
* @returns {Iterable<Chunk>} iterable of chunks (do not modify)
@@ -562,6 +604,7 @@
}
/**
+ * Gets module chunks.
* @param {Module} module the module
* @returns {Chunk[]} array of chunks (cached, do not modify)
*/
@@ -571,6 +614,7 @@
}
/**
+ * Gets number of module chunks.
* @param {Module} module the module
* @returns {number} the number of chunk which contain the module
*/
@@ -580,6 +624,7 @@
}
/**
+ * Gets module runtimes.
* @param {Module} module the module
* @returns {RuntimeSpecSet} runtimes
*/
@@ -589,6 +634,7 @@
}
/**
+ * Gets number of chunk modules.
* @param {Chunk} chunk the chunk
* @returns {number} the number of modules which are contained in this chunk
*/
@@ -598,6 +644,7 @@
}
/**
+ * Gets number of chunk full hash modules.
* @param {Chunk} chunk the chunk
* @returns {number} the number of full hash modules which are contained in this chunk
*/
@@ -607,6 +654,7 @@
}
/**
+ * Gets chunk modules iterable.
* @param {Chunk} chunk the chunk
* @returns {Iterable<Module>} return the modules for this chunk
*/
@@ -616,6 +664,7 @@
}
/**
+ * Gets chunk modules iterable by source type.
* @param {Chunk} chunk the chunk
* @param {string} sourceType source type
* @returns {Iterable<Module> | undefined} return the modules for this chunk
@@ -629,9 +678,10 @@
}
/**
+ * Sets chunk module source types.
* @param {Chunk} chunk chunk
* @param {Module} module chunk module
- * @param {Set<string>} sourceTypes source types
+ * @param {SourceTypes} sourceTypes source types
*/
setChunkModuleSourceTypes(chunk, module, sourceTypes) {
const cgc = this._getChunkGraphChunk(chunk);
@@ -644,6 +694,7 @@
}
/**
+ * Gets chunk module source types.
* @param {Chunk} chunk chunk
* @param {Module} module chunk module
* @returns {SourceTypes} source types
@@ -657,6 +708,7 @@
}
/**
+ * Gets module source types.
* @param {Module} module module
* @returns {SourceTypes} source types
*/
@@ -667,11 +719,13 @@
}
/**
+ * Get overwritten module source types.
* @param {Module} module module
- * @returns {Set<string> | undefined} source types
+ * @returns {SourceTypes | undefined} source types
*/
_getOverwrittenModuleSourceTypes(module) {
let newSet = false;
+ /** @type {Set<SourceType> | undefined} */
let sourceTypes;
for (const chunk of this.getModuleChunksIterable(module)) {
const cgc = this._getChunkGraphChunk(chunk);
@@ -679,7 +733,7 @@
const st = cgc.sourceTypesByModule.get(module);
if (st === undefined) return;
if (!sourceTypes) {
- sourceTypes = st;
+ sourceTypes = /** @type {Set<SourceType>} */ (st);
} else if (!newSet) {
for (const type of st) {
if (!newSet) {
@@ -701,6 +755,7 @@
}
/**
+ * Gets ordered chunk modules iterable.
* @param {Chunk} chunk the chunk
* @param {ModuleComparator} comparator comparator function
* @returns {Iterable<Module>} return the modules for this chunk
@@ -712,6 +767,7 @@
}
/**
+ * Gets ordered chunk modules iterable by source type.
* @param {Chunk} chunk the chunk
* @param {string} sourceType source type
* @param {ModuleComparator} comparator comparator function
@@ -728,6 +784,7 @@
}
/**
+ * Gets chunk modules.
* @param {Chunk} chunk the chunk
* @returns {Module[]} return the modules for this chunk (cached, do not modify)
*/
@@ -737,6 +794,7 @@
}
/**
+ * Gets ordered chunk modules.
* @param {Chunk} chunk the chunk
* @param {ModuleComparator} comparator comparator function
* @returns {Module[]} return the modules for this chunk (cached, do not modify)
@@ -748,6 +806,7 @@
}
/**
+ * Gets chunk module id map.
* @param {Chunk} chunk the chunk
* @param {ModuleFilterPredicate} filterFn function used to filter modules
* @param {boolean} includeAllChunks all chunks or only async chunks
@@ -781,6 +840,7 @@
}
/**
+ * Gets chunk module rendered hash map.
* @param {Chunk} chunk the chunk
* @param {ModuleFilterPredicate} filterFn function used to filter modules
* @param {number} hashLength length of the hash
@@ -807,6 +867,7 @@
)) {
if (filterFn(module)) {
if (idToHashMap === undefined) {
+ /** @type {IdToHashMap} */
idToHashMap = Object.create(null);
chunkModuleHashMap[/** @type {ChunkId} */ (asyncChunk.id)] =
/** @type {IdToHashMap} */
@@ -826,11 +887,13 @@
}
/**
+ * Gets chunk condition map.
* @param {Chunk} chunk the chunk
* @param {ChunkFilterPredicate} filterFn function used to filter chunks
- * @returns {Record<ChunkId, boolean>} chunk map
+ * @returns {ChunkConditionMap} chunk condition map
*/
getChunkConditionMap(chunk, filterFn) {
+ /** @type {ChunkConditionMap} */
const map = Object.create(null);
for (const c of chunk.getAllReferencedChunks()) {
map[/** @type {ChunkId} */ (c.id)] = filterFn(c, this);
@@ -839,6 +902,7 @@
}
/**
+ * Checks whether this chunk graph contains the chunk.
* @param {Chunk} chunk the chunk
* @param {ModuleFilterPredicate} filterFn predicate function used to filter modules
* @param {ChunkFilterPredicate=} filterChunkFn predicate function used to filter chunks
@@ -846,6 +910,7 @@
*/
hasModuleInGraph(chunk, filterFn, filterChunkFn) {
const queue = new Set(chunk.groupsIterable);
+ /** @type {Set<Chunk>} */
const chunksProcessed = new Set();
for (const chunkGroup of queue) {
@@ -869,9 +934,10 @@
}
/**
+ * Compares the provided values and returns their ordering.
* @param {Chunk} chunkA first chunk
* @param {Chunk} chunkB second chunk
- * @returns {-1|0|1} this is a comparator function like sort and returns -1, 0, or 1 based on sort order
+ * @returns {-1 | 0 | 1} this is a comparator function like sort and returns -1, 0, or 1 based on sort order
*/
compareChunks(chunkA, chunkB) {
const cgcA = this._getChunkGraphChunk(chunkA);
@@ -884,6 +950,7 @@
}
/**
+ * Gets chunk modules size.
* @param {Chunk} chunk the chunk
* @returns {number} total size of all modules in the chunk
*/
@@ -893,6 +960,7 @@
}
/**
+ * Gets chunk modules sizes.
* @param {Chunk} chunk the chunk
* @returns {Record<string, number>} total sizes of all modules in the chunk by source type
*/
@@ -902,6 +970,7 @@
}
/**
+ * Gets chunk root modules.
* @param {Chunk} chunk the chunk
* @returns {Module[]} root modules of the chunks (ordered by identifier)
*/
@@ -911,6 +980,7 @@
}
/**
+ * Returns total size of the chunk.
* @param {Chunk} chunk the chunk
* @param {ChunkSizeOptions} options options object
* @returns {number} total size of the chunk
@@ -931,6 +1001,7 @@
}
/**
+ * Gets integrated chunks size.
* @param {Chunk} chunkA chunk
* @param {Chunk} chunkB chunk
* @param {ChunkSizeOptions} options options object
@@ -958,6 +1029,7 @@
}
/**
+ * Checks whether it can chunks be integrated.
* @param {Chunk} chunkA chunk
* @param {Chunk} chunkB chunk
* @returns {boolean} true, if chunks could be integrated
@@ -991,6 +1063,7 @@
}
/**
+ * Processes the provided chunk a.
* @param {Chunk} chunkA the target chunk
* @param {Chunk} chunkB the chunk to integrate
* @returns {void}
@@ -1054,6 +1127,7 @@
}
/**
+ * Upgrade dependent to full hash modules.
* @param {Chunk} chunk the chunk to upgrade
* @returns {void}
*/
@@ -1071,6 +1145,7 @@
}
/**
+ * Checks whether this chunk graph is entry module in chunk.
* @param {Module} module the checked module
* @param {Chunk} chunk the checked chunk
* @returns {boolean} true, if the chunk contains the module as entry
@@ -1081,6 +1156,7 @@
}
/**
+ * Connects chunk and entry module.
* @param {Chunk} chunk the new chunk
* @param {Module} module the entry module
* @param {Entrypoint} entrypoint the chunk group which must be loaded before the module is executed
@@ -1097,6 +1173,7 @@
}
/**
+ * Connects chunk and runtime module.
* @param {Chunk} chunk the new chunk
* @param {RuntimeModule} module the runtime module
* @returns {void}
@@ -1112,6 +1189,7 @@
}
/**
+ * Adds full hash module to chunk.
* @param {Chunk} chunk the new chunk
* @param {RuntimeModule} module the module that require a full hash
* @returns {void}
@@ -1123,6 +1201,7 @@
}
/**
+ * Adds dependent hash module to chunk.
* @param {Chunk} chunk the new chunk
* @param {RuntimeModule} module the module that require a full hash
* @returns {void}
@@ -1136,6 +1215,7 @@
}
/**
+ * Disconnects chunk and entry module.
* @param {Chunk} chunk the new chunk
* @param {Module} module the entry module
* @returns {void}
@@ -1152,6 +1232,7 @@
}
/**
+ * Disconnects chunk and runtime module.
* @param {Chunk} chunk the new chunk
* @param {RuntimeModule} module the runtime module
* @returns {void}
@@ -1168,6 +1249,7 @@
}
/**
+ * Disconnects entry module.
* @param {Module} module the entry module, it will no longer be entry
* @returns {void}
*/
@@ -1181,6 +1263,7 @@
}
/**
+ * Disconnects entries.
* @param {Chunk} chunk the chunk, for which all entries will be removed
* @returns {void}
*/
@@ -1198,6 +1281,7 @@
}
/**
+ * Gets number of entry modules.
* @param {Chunk} chunk the chunk
* @returns {number} the amount of entry modules in chunk
*/
@@ -1207,6 +1291,7 @@
}
/**
+ * Gets number of runtime modules.
* @param {Chunk} chunk the chunk
* @returns {number} the amount of entry modules in chunk
*/
@@ -1216,6 +1301,7 @@
}
/**
+ * Gets chunk entry modules iterable.
* @param {Chunk} chunk the chunk
* @returns {Iterable<Module>} iterable of modules (do not modify)
*/
@@ -1225,6 +1311,7 @@
}
/**
+ * Gets chunk entry dependent chunks iterable.
* @param {Chunk} chunk the chunk
* @returns {Iterable<Chunk>} iterable of chunks
*/
@@ -1249,6 +1336,7 @@
}
/**
+ * Gets runtime chunk dependent chunks iterable.
* @param {Chunk} chunk the chunk
* @returns {Iterable<Chunk>} iterable of chunks and include chunks from children entrypoints
*/
@@ -1303,6 +1391,7 @@
}
/**
+ * Checks whether this chunk graph contains the chunk.
* @param {Chunk} chunk the chunk
* @returns {boolean} true, when it has dependent chunks
*/
@@ -1319,6 +1408,7 @@
}
/**
+ * Gets chunk runtime modules iterable.
* @param {Chunk} chunk the chunk
* @returns {Iterable<RuntimeModule>} iterable of modules (do not modify)
*/
@@ -1328,6 +1418,7 @@
}
/**
+ * Gets chunk runtime modules in order.
* @param {Chunk} chunk the chunk
* @returns {RuntimeModule[]} array of modules in order of execution
*/
@@ -1347,6 +1438,7 @@
}
/**
+ * Gets chunk full hash modules iterable.
* @param {Chunk} chunk the chunk
* @returns {Iterable<RuntimeModule> | undefined} iterable of modules (do not modify)
*/
@@ -1356,6 +1448,7 @@
}
/**
+ * Gets chunk full hash modules set.
* @param {Chunk} chunk the chunk
* @returns {ReadonlySet<RuntimeModule> | undefined} set of modules (do not modify)
*/
@@ -1365,6 +1458,7 @@
}
/**
+ * Gets chunk dependent hash modules iterable.
* @param {Chunk} chunk the chunk
* @returns {Iterable<RuntimeModule> | undefined} iterable of modules (do not modify)
*/
@@ -1374,6 +1468,7 @@
}
/**
+ * Gets chunk entry modules with chunk group iterable.
* @param {Chunk} chunk the chunk
* @returns {Iterable<EntryModuleWithChunkGroup>} iterable of modules (do not modify)
*/
@@ -1383,6 +1478,7 @@
}
/**
+ * Gets block chunk group.
* @param {AsyncDependenciesBlock} depBlock the async block
* @returns {ChunkGroup | undefined} the chunk group
*/
@@ -1391,6 +1487,7 @@
}
/**
+ * Connects block and chunk group.
* @param {AsyncDependenciesBlock} depBlock the async block
* @param {ChunkGroup} chunkGroup the chunk group
* @returns {void}
@@ -1401,6 +1498,7 @@
}
/**
+ * Disconnects chunk group.
* @param {ChunkGroup} chunkGroup the chunk group
* @returns {void}
*/
@@ -1413,6 +1511,7 @@
}
/**
+ * Returns the id of the module.
* @param {Module} module the module
* @returns {ModuleId | null} the id of the module
*/
@@ -1422,6 +1521,7 @@
}
/**
+ * Updates module id using the provided module.
* @param {Module} module the module
* @param {ModuleId} id the id of the module
* @returns {void}
@@ -1432,6 +1532,7 @@
}
/**
+ * Returns the id of the runtime.
* @param {string} runtime runtime
* @returns {RuntimeId} the id of the runtime
*/
@@ -1440,6 +1541,7 @@
}
/**
+ * Updates runtime id using the provided runtime.
* @param {string} runtime runtime
* @param {RuntimeId} id the id of the runtime
* @returns {void}
@@ -1449,6 +1551,7 @@
}
/**
+ * Get module hash info.
* @template T
* @param {Module} module the module
* @param {RuntimeSpecMap<T>} hashes hashes data
@@ -1491,6 +1594,7 @@
}
/**
+ * Checks whether this chunk graph contains the module.
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @returns {boolean} true, if the module has hashes for this runtime
@@ -1502,6 +1606,7 @@
}
/**
+ * Returns hash.
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @returns {string} hash
@@ -1513,6 +1618,7 @@
}
/**
+ * Gets rendered module hash.
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @returns {string} hash
@@ -1524,6 +1630,7 @@
}
/**
+ * Sets module hashes.
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @param {string} hash the full hash
@@ -1539,6 +1646,7 @@
}
/**
+ * Adds module runtime requirements.
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @param {RuntimeRequirements} items runtime requirements to be added (ownership of this Set is given to ChunkGraph when transferOwnership not false)
@@ -1554,6 +1662,7 @@
const cgm = this._getChunkGraphModule(module);
const runtimeRequirementsMap = cgm.runtimeRequirements;
if (runtimeRequirementsMap === undefined) {
+ /** @type {ChunkGraphRuntimeRequirements} */
const map = new RuntimeSpecMap();
// TODO avoid cloning item and track ownership instead
map.set(runtime, transferOwnership ? items : new Set(items));
@@ -1574,6 +1683,7 @@
}
/**
+ * Adds chunk runtime requirements.
* @param {Chunk} chunk the chunk
* @param {RuntimeRequirements} items runtime requirements to be added (ownership of this Set is given to ChunkGraph)
* @returns {void}
@@ -1592,6 +1702,7 @@
}
/**
+ * Adds tree runtime requirements.
* @param {Chunk} chunk the chunk
* @param {Iterable<string>} items runtime requirements to be added
* @returns {void}
@@ -1603,6 +1714,7 @@
}
/**
+ * Gets module runtime requirements.
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @returns {ReadOnlyRuntimeRequirements} runtime requirements
@@ -1615,6 +1727,7 @@
}
/**
+ * Gets chunk runtime requirements.
* @param {Chunk} chunk the chunk
* @returns {ReadOnlyRuntimeRequirements} runtime requirements
*/
@@ -1625,6 +1738,7 @@
}
/**
+ * Gets module graph hash.
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @param {boolean} withConnections include connections
@@ -1638,6 +1752,7 @@
}
/**
+ * Gets module graph hash big int.
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
* @param {boolean} withConnections include connections
@@ -1653,6 +1768,7 @@
}
/**
+ * Get module graph hash big int.
* @param {ChunkGraphModule} cgm the ChunkGraphModule
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
@@ -1676,6 +1792,7 @@
}
/**
+ * Get module graph hash with connections.
* @param {ChunkGraphModule} cgm the ChunkGraphModule
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
@@ -1687,6 +1804,7 @@
}
/**
+ * Active state to string.
* @param {ConnectionState} state state
* @returns {"F" | "T" | "O"} result
*/
@@ -1709,6 +1827,7 @@
/** @type {Map<string, Module | Set<Module>>} */
const connectedModules = new Map();
/**
+ * Process connection.
* @param {ModuleGraphConnection} connection connection
* @param {string} stateInfo state info
*/
@@ -1738,6 +1857,7 @@
} else {
// cspell:word Tnamespace
for (const connection of connections) {
+ /** @type {Set<ConnectionState>} */
const states = new Set();
let stateInfo = "";
forEachRuntime(
@@ -1752,7 +1872,10 @@
if (states.size === 1) {
const state = first(states);
if (state === false) continue;
- stateInfo = activeStateToString(state);
+ stateInfo = activeStateToString(
+ /** @type {ConnectionState} */
+ (state)
+ );
}
processConnection(connection, stateInfo);
}
@@ -1767,6 +1890,7 @@
: connectedModules;
const hash = createHash(this._hashFunction);
/**
+ * Adds module to hash.
* @param {Module} module module
*/
const addModuleToHash = (module) => {
@@ -1779,6 +1903,7 @@
);
};
/**
+ * Adds modules to hash.
* @param {Set<Module>} modules modules
*/
const addModulesToHash = (modules) => {
@@ -1813,6 +1938,7 @@
}
/**
+ * Gets tree runtime requirements.
* @param {Chunk} chunk the chunk
* @returns {ReadOnlyRuntimeRequirements} runtime requirements
*/
@@ -1823,6 +1949,8 @@
// TODO remove in webpack 6
/**
+ * Gets chunk graph for module.
+ * @deprecated
* @param {Module} module the module
* @param {string} deprecateMessage message for the deprecation message
* @param {string} deprecationCode code for the deprecation
@@ -1833,6 +1961,7 @@
if (fn) return fn(module);
const newFn = util.deprecate(
/**
+ * Handles the callback logic for this hook.
* @param {Module} module the module
* @returns {ChunkGraph} the chunk graph
*/
@@ -1855,7 +1984,10 @@
}
// TODO remove in webpack 6
+ // BACKWARD-COMPAT START
/**
+ * Sets chunk graph for module.
+ * @deprecated
* @param {Module} module the module
* @param {ChunkGraph} chunkGraph the chunk graph
* @returns {void}
@@ -1864,8 +1996,9 @@
chunkGraphForModuleMap.set(module, chunkGraph);
}
- // TODO remove in webpack 6
/**
+ * Clear chunk graph for module.
+ * @deprecated
* @param {Module} module the module
* @returns {void}
*/
@@ -1873,8 +2006,9 @@
chunkGraphForModuleMap.delete(module);
}
- // TODO remove in webpack 6
/**
+ * Gets chunk graph for chunk.
+ * @deprecated
* @param {Chunk} chunk the chunk
* @param {string} deprecateMessage message for the deprecation message
* @param {string} deprecationCode code for the deprecation
@@ -1885,6 +2019,7 @@
if (fn) return fn(chunk);
const newFn = util.deprecate(
/**
+ * Handles the callback logic for this hook.
* @param {Chunk} chunk the chunk
* @returns {ChunkGraph} the chunk graph
*/
@@ -1906,8 +2041,9 @@
return newFn(chunk);
}
- // TODO remove in webpack 6
/**
+ * Sets chunk graph for chunk.
+ * @deprecated
* @param {Chunk} chunk the chunk
* @param {ChunkGraph} chunkGraph the chunk graph
* @returns {void}
@@ -1916,14 +2052,16 @@
chunkGraphForChunkMap.set(chunk, chunkGraph);
}
- // TODO remove in webpack 6
/**
+ * Clear chunk graph for chunk.
+ * @deprecated
* @param {Chunk} chunk the chunk
* @returns {void}
*/
static clearChunkGraphForChunk(chunk) {
chunkGraphForChunkMap.delete(chunk);
}
+ // BACKWARD-COMPAT END
}
// TODO remove in webpack 6
--
Gitblit v1.9.3