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/ExportsInfo.js |  110 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 69 insertions(+), 41 deletions(-)

diff --git a/node_modules/webpack/lib/ExportsInfo.js b/node_modules/webpack/lib/ExportsInfo.js
index 451b02e..59ab6ff 100644
--- a/node_modules/webpack/lib/ExportsInfo.js
+++ b/node_modules/webpack/lib/ExportsInfo.js
@@ -13,6 +13,7 @@
 
 /** @typedef {import("./Dependency")} Dependency */
 /** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */
+/** @typedef {import("./Dependency").ExportInfoName} ExportInfoName */
 /** @typedef {import("./Dependency").ExportsSpecExcludeExports} ExportsSpecExcludeExports */
 /** @typedef {import("./dependencies/HarmonyImportDependency")} HarmonyImportDependency */
 /** @typedef {import("./Module")} Module */
@@ -24,8 +25,6 @@
 
 /** @typedef {typeof UsageState.OnlyPropertiesUsed | typeof UsageState.NoInfo | typeof UsageState.Unknown | typeof UsageState.Used} RuntimeUsageStateType */
 /** @typedef {typeof UsageState.Unused | RuntimeUsageStateType} UsageStateType */
-
-/** @typedef {string} ExportInfoName */
 
 /** @typedef {Map<string, RuntimeUsageStateType>} UsedInRuntime */
 /** @typedef {{ module: Module, export: ExportInfoName[], deferred: boolean }} TargetItemWithoutConnection */
@@ -43,6 +42,7 @@
 /** @typedef {Set<ExportInfo>} AlreadyVisitedExportInfo */
 
 /**
+ * Defines the restore provided data exports type used by this module.
  * @typedef {object} RestoreProvidedDataExports
  * @property {ExportInfoName} name
  * @property {ExportInfo["provided"]} provided
@@ -65,6 +65,7 @@
 
 class RestoreProvidedData {
 	/**
+	 * Creates an instance of RestoreProvidedData.
 	 * @param {RestoreProvidedDataExports[]} exports exports
 	 * @param {ExportInfo["provided"]} otherProvided other provided
 	 * @param {ExportInfo["canMangleProvide"]} otherCanMangleProvide other can mangle provide
@@ -83,6 +84,7 @@
 	}
 
 	/**
+	 * Serializes this instance into the provided serializer context.
 	 * @param {ObjectSerializerContext} context context
 	 */
 	serialize({ write }) {
@@ -93,6 +95,7 @@
 	}
 
 	/**
+	 * Restores this instance from the provided deserializer context.
 	 * @param {ObjectDeserializerContext} context context
 	 * @returns {RestoreProvidedData} RestoreProvidedData
 	 */
@@ -111,14 +114,18 @@
 	constructor() {
 		/** @type {Exports} */
 		this._exports = new Map();
+		/** @type {ExportInfo} */
 		this._otherExportsInfo = new ExportInfo(null);
+		/** @type {ExportInfo} */
 		this._sideEffectsOnlyInfo = new ExportInfo("*side effects only*");
+		/** @type {boolean} */
 		this._exportsAreOrdered = false;
 		/** @type {ExportsInfo=} */
 		this._redirectTo = undefined;
 	}
 
 	/**
+	 * Gets owned exports.
 	 * @returns {Iterable<ExportInfo>} all owned exports in any order
 	 */
 	get ownedExports() {
@@ -126,6 +133,7 @@
 	}
 
 	/**
+	 * Gets ordered owned exports.
 	 * @returns {Iterable<ExportInfo>} all owned exports in order
 	 */
 	get orderedOwnedExports() {
@@ -136,6 +144,7 @@
 	}
 
 	/**
+	 * Returns all exports in any order.
 	 * @returns {Iterable<ExportInfo>} all exports in any order
 	 */
 	get exports() {
@@ -150,6 +159,7 @@
 	}
 
 	/**
+	 * Gets ordered exports.
 	 * @returns {Iterable<ExportInfo>} all exports in order
 	 */
 	get orderedExports() {
@@ -173,6 +183,7 @@
 	}
 
 	/**
+	 * Gets other exports info.
 	 * @returns {ExportInfo} the export info of unlisted exports
 	 */
 	get otherExportsInfo() {
@@ -183,6 +194,7 @@
 	}
 
 	/**
+	 * Processes the provided export.
 	 * @param {Exports} exports exports
 	 * @private
 	 */
@@ -215,6 +227,7 @@
 	}
 
 	/**
+	 * Sets redirect named to.
 	 * @param {ExportsInfo | undefined} exportsInfo exports info
 	 * @returns {boolean} result
 	 */
@@ -258,6 +271,7 @@
 	}
 
 	/**
+	 * Gets own export info.
 	 * @param {ExportInfoName} name export name
 	 * @returns {ExportInfo} export info for this name
 	 */
@@ -271,6 +285,7 @@
 	}
 
 	/**
+	 * Returns export info for this name.
 	 * @param {ExportInfoName} name export name
 	 * @returns {ExportInfo} export info for this name
 	 */
@@ -287,6 +302,7 @@
 	}
 
 	/**
+	 * Gets read only export info.
 	 * @param {ExportInfoName} name export name
 	 * @returns {ExportInfo} export info for this name
 	 */
@@ -300,6 +316,7 @@
 	}
 
 	/**
+	 * Gets read only export info recursive.
 	 * @param {ExportInfoName[]} name export name
 	 * @returns {ExportInfo | undefined} export info for this name
 	 */
@@ -311,6 +328,7 @@
 	}
 
 	/**
+	 * Gets nested exports info.
 	 * @param {ExportInfoName[]=} name the export name
 	 * @returns {ExportsInfo | undefined} the nested exports info
 	 */
@@ -324,6 +342,7 @@
 	}
 
 	/**
+	 * Sets unknown exports provided.
 	 * @param {boolean=} canMangle true, if exports can still be mangled (defaults to false)
 	 * @param {ExportsSpecExcludeExports=} excludeExports list of unaffected exports
 	 * @param {Dependency=} targetKey use this as key for the target
@@ -402,6 +421,7 @@
 	}
 
 	/**
+	 * Sets used in unknown way.
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {boolean} true, when something changed
 	 */
@@ -435,6 +455,7 @@
 	}
 
 	/**
+	 * Sets used without info.
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {boolean} true, when something changed
 	 */
@@ -462,6 +483,7 @@
 	}
 
 	/**
+	 * Sets all known exports used.
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {boolean} true, when something changed
 	 */
@@ -477,6 +499,7 @@
 	}
 
 	/**
+	 * Sets used for side effects only.
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {boolean} true, when something changed
 	 */
@@ -489,6 +512,7 @@
 	}
 
 	/**
+	 * Checks whether this exports info is used.
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {boolean} true, when the module exports are used in any way
 	 */
@@ -509,6 +533,7 @@
 	}
 
 	/**
+	 * Checks whether this exports info is module used.
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {boolean} true, when the module is used in any way
 	 */
@@ -521,6 +546,7 @@
 	}
 
 	/**
+	 * Returns set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown).
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {SortableSet<ExportInfoName> | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown)
 	 */
@@ -570,6 +596,7 @@
 	}
 
 	/**
+	 * Gets provided exports.
 	 * @returns {null | true | ExportInfoName[]} list of exports when known
 	 */
 	getProvidedExports() {
@@ -609,10 +636,12 @@
 	}
 
 	/**
+	 * Gets relevant exports.
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {ExportInfo[]} exports that are relevant (not unused and potential provided)
 	 */
 	getRelevantExports(runtime) {
+		/** @type {ExportInfo[]} */
 		const list = [];
 		for (const exportInfo of this._exports.values()) {
 			const used = exportInfo.getUsed(runtime);
@@ -635,6 +664,7 @@
 	}
 
 	/**
+	 * Checks whether this exports info is export provided.
 	 * @param {ExportInfoName | ExportInfoName[]} name the name of the export
 	 * @returns {boolean | undefined | null} if the export is provided
 	 */
@@ -651,10 +681,12 @@
 	}
 
 	/**
+	 * Returns key representing the usage.
 	 * @param {RuntimeSpec} runtime runtime
 	 * @returns {string} key representing the usage
 	 */
 	getUsageKey(runtime) {
+		/** @type {(string | number)[]} */
 		const key = [];
 		if (this._redirectTo !== undefined) {
 			key.push(this._redirectTo.getUsageKey(runtime));
@@ -669,6 +701,7 @@
 	}
 
 	/**
+	 * Checks whether this exports info is equally used.
 	 * @param {RuntimeSpec} runtimeA first runtime
 	 * @param {RuntimeSpec} runtimeB second runtime
 	 * @returns {boolean} true, when equally used
@@ -697,6 +730,7 @@
 	}
 
 	/**
+	 * Returns usage status.
 	 * @param {ExportInfoName | ExportInfoName[]} name export name
 	 * @param {RuntimeSpec} runtime check usage for this runtime only
 	 * @returns {UsageStateType} usage status
@@ -715,6 +749,7 @@
 	}
 
 	/**
+	 * Returns the used name.
 	 * @param {ExportInfoName | ExportInfoName[]} name the export name
 	 * @param {RuntimeSpec} runtime check usage for this runtime only
 	 * @returns {UsedName} the used name
@@ -751,6 +786,7 @@
 	}
 
 	/**
+	 * Updates the hash with the data contributed by this instance.
 	 * @param {Hash} hash the hash
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {void}
@@ -760,6 +796,7 @@
 	}
 
 	/**
+	 * Updates hash using the provided hash.
 	 * @param {Hash} hash the hash
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @param {Set<ExportsInfo>} alreadyVisitedExportsInfo for circular references
@@ -781,6 +818,7 @@
 	}
 
 	/**
+	 * Gets restore provided data.
 	 * @returns {RestoreProvidedData} restore provided data
 	 */
 	getRestoreProvidedData() {
@@ -817,6 +855,7 @@
 	}
 
 	/**
+	 * Processes the provided data.
 	 * @param {RestoreProvidedData} data data
 	 */
 	restoreProvided({
@@ -851,6 +890,7 @@
 
 class ExportInfo {
 	/**
+	 * Creates an instance of ExportInfo.
 	 * @param {ExportInfoName | null} name the original name of the export
 	 * @param {ExportInfo=} initFrom init values from this ExportInfo
 	 */
@@ -916,7 +956,7 @@
 		/** @type {Target | undefined} */
 		this._target = undefined;
 		if (initFrom && initFrom._target) {
-			this._target = new Map();
+			this._target = /** @type {Target} */ (new Map());
 			for (const [key, value] of initFrom._target) {
 				this._target.set(key, {
 					connection: value.connection,
@@ -927,36 +967,6 @@
 		}
 		/** @type {Target | undefined} */
 		this._maxTarget = undefined;
-	}
-
-	// TODO webpack 5 remove
-	/**
-	 * @private
-	 * @param {EXPECTED_ANY} v v
-	 */
-	set used(v) {
-		throw new Error("REMOVED");
-	}
-
-	// TODO webpack 5 remove
-	/** @private */
-	get used() {
-		throw new Error("REMOVED");
-	}
-
-	// TODO webpack 5 remove
-	/**
-	 * @private
-	 * @param {EXPECTED_ANY} v v
-	 */
-	set usedName(v) {
-		throw new Error("REMOVED");
-	}
-
-	// TODO webpack 5 remove
-	/** @private */
-	get usedName() {
-		throw new Error("REMOVED");
 	}
 
 	get canMangle() {
@@ -981,6 +991,7 @@
 	}
 
 	/**
+	 * Sets used in unknown way.
 	 * @param {RuntimeSpec} runtime only apply to this runtime
 	 * @returns {boolean} true, when something changed
 	 */
@@ -1003,6 +1014,7 @@
 	}
 
 	/**
+	 * Sets used without info.
 	 * @param {RuntimeSpec} runtime only apply to this runtime
 	 * @returns {boolean} true, when something changed
 	 */
@@ -1032,6 +1044,7 @@
 	}
 
 	/**
+	 * Sets used conditionally.
 	 * @param {(condition: UsageStateType) => boolean} condition compare with old value
 	 * @param {UsageStateType} newValue set when condition is true
 	 * @param {RuntimeSpec} runtime only apply to this runtime
@@ -1085,6 +1098,7 @@
 	}
 
 	/**
+	 * Updates used using the provided new value.
 	 * @param {UsageStateType} newValue new value of the used state
 	 * @param {RuntimeSpec} runtime only apply to this runtime
 	 * @returns {boolean} true when something has changed
@@ -1133,6 +1147,7 @@
 	}
 
 	/**
+	 * Returns true, if something has changed.
 	 * @param {Dependency} key the key
 	 * @returns {boolean} true, if something has changed
 	 */
@@ -1146,6 +1161,7 @@
 	}
 
 	/**
+	 * Updates target using the provided key.
 	 * @param {Dependency} key the key
 	 * @param {ModuleGraphConnection} connection the target module if a single one
 	 * @param {ExportInfoName[] | null=} exportName the exported name
@@ -1155,7 +1171,7 @@
 	setTarget(key, connection, exportName, priority = 0) {
 		if (exportName) exportName = [...exportName];
 		if (!this._target) {
-			this._target = new Map();
+			this._target = /** @type {Target} */ (new Map());
 			this._target.set(key, {
 				connection,
 				export: /** @type {ExportInfoName[]} */ (exportName),
@@ -1191,6 +1207,7 @@
 	}
 
 	/**
+	 * Returns usage state.
 	 * @param {RuntimeSpec} runtime for this runtime
 	 * @returns {UsageStateType} usage state
 	 */
@@ -1229,7 +1246,7 @@
 	}
 
 	/**
-	 * get used name
+	 * Returns used name.
 	 * @param {string | undefined} fallbackName fallback name for used exports with no name
 	 * @param {RuntimeSpec} runtime check usage for this runtime only
 	 * @returns {string | false} used name
@@ -1260,6 +1277,7 @@
 	}
 
 	/**
+	 * Checks whether this export info has used name.
 	 * @returns {boolean} true, when a mangled name of this export is set
 	 */
 	hasUsedName() {
@@ -1267,7 +1285,7 @@
 	}
 
 	/**
-	 * Sets the mangled name of this export
+	 * Updates used name using the provided name.
 	 * @param {string} name the new name
 	 * @returns {void}
 	 */
@@ -1276,6 +1294,7 @@
 	}
 
 	/**
+	 * Gets terminal binding.
 	 * @param {ModuleGraph} moduleGraph the module graph
 	 * @param {ResolveTargetFilter} resolveTargetFilter filter function to further resolve target
 	 * @returns {ExportInfo | ExportsInfo | undefined} the terminal binding export(s) info if known
@@ -1320,6 +1339,7 @@
 	}
 
 	/**
+	 * Returns the target, undefined when there is no target, false when no target is valid.
 	 * @param {ModuleGraph} moduleGraph the module graph
 	 * @param {ValidTargetModuleFilter} validTargetModuleFilter a valid target module
 	 * @returns {TargetItemWithoutConnection | null | undefined | false} the target, undefined when there is no target, false when no target is valid
@@ -1329,6 +1349,7 @@
 	}
 
 	/**
+	 * Returns the target, undefined when there is no target, false when no target is valid.
 	 * @param {ModuleGraph} moduleGraph the module graph
 	 * @param {ValidTargetModuleFilter} validTargetModuleFilter a valid target module
 	 * @param {AlreadyVisitedExportInfo} alreadyVisited set of already visited export info to avoid circular references
@@ -1346,11 +1367,11 @@
 			export: rawTarget.export,
 			deferred: Boolean(
 				rawTarget.connection.dependency &&
-					ImportPhaseUtils.isDefer(
-						/** @type {HarmonyImportDependency} */ (
-							rawTarget.connection.dependency
-						).phase
-					)
+				ImportPhaseUtils.isDefer(
+					/** @type {HarmonyImportDependency} */ (
+						rawTarget.connection.dependency
+					).phase
+				)
 			)
 		};
 		for (;;) {
@@ -1379,6 +1400,7 @@
 	}
 
 	/**
+	 * Returns the target.
 	 * @param {ModuleGraph} moduleGraph the module graph
 	 * @param {ResolveTargetFilter} resolveTargetFilter filter function to further resolve target
 	 * @returns {TargetItemWithConnection | undefined} the target
@@ -1390,6 +1412,7 @@
 	}
 
 	/**
+	 * Returns the target.
 	 * @param {ModuleGraph} moduleGraph the module graph
 	 * @param {ResolveTargetFilter} resolveTargetFilter filter function to further resolve target
 	 * @param {AlreadyVisitedExportInfo | undefined} alreadyVisited set of already visited export info to avoid circular references
@@ -1397,6 +1420,7 @@
 	 */
 	_getTarget(moduleGraph, resolveTargetFilter, alreadyVisited) {
 		/**
+		 * Returns resolved target.
 		 * @param {TargetItem | undefined | null} inputTarget unresolved target
 		 * @param {AlreadyVisitedExportInfo} alreadyVisited set of already visited export info to avoid circular references
 		 * @returns {TargetItemWithConnection | CIRCULAR | null} resolved target
@@ -1527,6 +1551,7 @@
 	}
 
 	/**
+	 * Creates a nested exports info.
 	 * @returns {ExportsInfo} an exports info
 	 */
 	createNestedExportsInfo() {
@@ -1548,6 +1573,7 @@
 	}
 
 	/**
+	 * Checks whether this export info contains the base info.
 	 * @param {ExportInfo} baseInfo base info
 	 * @param {RuntimeSpec} runtime runtime
 	 * @returns {boolean} true when has info, otherwise false
@@ -1562,6 +1588,7 @@
 	}
 
 	/**
+	 * Updates the hash with the data contributed by this instance.
 	 * @param {Hash} hash the hash
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @returns {void}
@@ -1571,6 +1598,7 @@
 	}
 
 	/**
+	 * Updates hash using the provided hash.
 	 * @param {Hash} hash the hash
 	 * @param {RuntimeSpec} runtime the runtime
 	 * @param {Set<ExportsInfo>} alreadyVisitedExportsInfo for circular references

--
Gitblit v1.9.3