From 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期二, 21 四月 2026 11:46:41 +0800
Subject: [PATCH] 推送
---
node_modules/webpack/lib/ConcatenationScope.js | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/node_modules/webpack/lib/ConcatenationScope.js b/node_modules/webpack/lib/ConcatenationScope.js
index d58d610..fb7691e 100644
--- a/node_modules/webpack/lib/ConcatenationScope.js
+++ b/node_modules/webpack/lib/ConcatenationScope.js
@@ -20,16 +20,24 @@
/^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(_deferredImport)?(?:_asiSafe(\d))?__$/;
/**
+ * Encodes how a concatenated module reference should be interpreted when it is
+ * later reconstructed from its placeholder identifier.
* @typedef {object} ModuleReferenceOptions
- * @property {Ids} ids the properties/exports of the module
+ * @property {Ids} ids the properties or exports selected from the referenced module
* @property {boolean} call true, when this referenced export is called
* @property {boolean} directImport true, when this referenced export is directly imported (not via property access)
* @property {boolean} deferredImport true, when this referenced export is deferred
* @property {boolean | undefined} asiSafe if the position is ASI safe or unknown
*/
+/**
+ * Tracks the symbols and cross-module references needed while rendering a
+ * concatenated module.
+ */
class ConcatenationScope {
/**
+ * Creates the mutable scope object used while rendering a concatenated
+ * module and its cross-module references.
* @param {ModuleInfo[] | Map<Module, ModuleInfo>} modulesMap all module info by module
* @param {ConcatenatedModuleInfo} currentModule the current module info
* @param {Set<string>} usedNames all used names
@@ -37,9 +45,10 @@
constructor(modulesMap, currentModule, usedNames) {
this._currentModule = currentModule;
if (Array.isArray(modulesMap)) {
+ /** @type {Map<Module, ConcatenatedModuleInfo>} */
const map = new Map();
for (const info of modulesMap) {
- map.set(info.module, info);
+ map.set(info.module, /** @type {ConcatenatedModuleInfo} */ (info));
}
modulesMap = map;
}
@@ -48,6 +57,7 @@
}
/**
+ * Checks whether a module participates in the current concatenation scope.
* @param {Module} module the referenced module
* @returns {boolean} true, when it's in the scope
*/
@@ -56,6 +66,8 @@
}
/**
+ * Records the symbol that should be used when the current module exports a
+ * named binding.
* @param {string} exportName name of the export
* @param {string} symbol identifier of the export in source code
*/
@@ -69,6 +81,8 @@
}
/**
+ * Records a raw expression that can be used to reference an export without
+ * going through the normal symbol map.
* @param {string} exportName name of the export
* @param {string} expression expression to be used
*/
@@ -82,6 +96,7 @@
}
/**
+ * Returns the raw expression registered for an export, if one exists.
* @param {string} exportName name of the export
* @returns {string | undefined} the expression of the export
*/
@@ -93,6 +108,8 @@
}
/**
+ * Replaces the raw expression for an export only when that export already
+ * has an entry in the raw export map.
* @param {string} exportName name of the export
* @param {string} expression expression to be used
*/
@@ -106,6 +123,7 @@
}
/**
+ * Records the symbol that should be used for the synthetic namespace export.
* @param {string} symbol identifier of the export in source code
*/
registerNamespaceExport(symbol) {
@@ -113,6 +131,8 @@
}
/**
+ * Encodes a reference to another concatenated module as a placeholder
+ * identifier that can be parsed later during code generation.
* @param {Module} module the referenced module
* @param {Partial<ModuleReferenceOptions>} options options
* @returns {string} the reference as identifier
@@ -144,6 +164,8 @@
}
/**
+ * Checks whether an identifier is one of webpack's encoded concatenation
+ * module references.
* @param {string} name the identifier
* @returns {boolean} true, when it's an module reference
*/
@@ -152,6 +174,8 @@
}
/**
+ * Parses an encoded module reference back into its module index and
+ * reference flags.
* @param {string} name the identifier
* @returns {ModuleReferenceOptions & { index: number } | null} parsed options and index
*/
--
Gitblit v1.9.3