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/ids/ChunkModuleIdRangePlugin.js | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/node_modules/webpack/lib/ids/ChunkModuleIdRangePlugin.js b/node_modules/webpack/lib/ids/ChunkModuleIdRangePlugin.js
index a3233bb..b5efa43 100644
--- a/node_modules/webpack/lib/ids/ChunkModuleIdRangePlugin.js
+++ b/node_modules/webpack/lib/ids/ChunkModuleIdRangePlugin.js
@@ -13,8 +13,10 @@
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */
+/** @typedef {import("../ChunkGraph").ModuleComparator} ModuleComparator */
/**
+ * Defines the chunk module id range plugin options type used by this module.
* @typedef {object} ChunkModuleIdRangePluginOptions
* @property {string} name the chunk name
* @property {("index" | "index2" | "preOrderIndex" | "postOrderIndex")=} order order
@@ -26,38 +28,40 @@
class ChunkModuleIdRangePlugin {
/**
+ * Creates an instance of ChunkModuleIdRangePlugin.
* @param {ChunkModuleIdRangePluginOptions} options options object
*/
constructor(options) {
+ /** @type {ChunkModuleIdRangePluginOptions} */
this.options = options;
}
/**
- * Apply the plugin
+ * Applies the plugin by registering its hooks on the compiler.
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
- const options = this.options;
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
const moduleGraph = compilation.moduleGraph;
compilation.hooks.moduleIds.tap(PLUGIN_NAME, (modules) => {
const chunkGraph = compilation.chunkGraph;
const chunk = find(
compilation.chunks,
- (chunk) => chunk.name === options.name
+ (chunk) => chunk.name === this.options.name
);
if (!chunk) {
throw new Error(
- `${PLUGIN_NAME}: Chunk with name '${options.name}"' was not found`
+ `${PLUGIN_NAME}: Chunk with name '${this.options.name}"' was not found`
);
}
/** @type {Module[]} */
let chunkModules;
- if (options.order) {
+ if (this.options.order) {
+ /** @type {ModuleComparator} */
let cmpFn;
- switch (options.order) {
+ switch (this.options.order) {
case "index":
case "preOrderIndex":
cmpFn = compareModulesByPreOrderIndexOrIdentifier(moduleGraph);
@@ -76,13 +80,13 @@
.sort(compareModulesByPreOrderIndexOrIdentifier(moduleGraph));
}
- let currentId = options.start || 0;
+ let currentId = this.options.start || 0;
for (let i = 0; i < chunkModules.length; i++) {
const m = chunkModules[i];
if (m.needId && chunkGraph.getModuleId(m) === null) {
chunkGraph.setModuleId(m, currentId++);
}
- if (options.end && currentId > options.end) break;
+ if (this.options.end && currentId > this.options.end) break;
}
});
});
--
Gitblit v1.9.3