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/dependencies/HarmonyExportInitFragment.js | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/node_modules/webpack/lib/dependencies/HarmonyExportInitFragment.js b/node_modules/webpack/lib/dependencies/HarmonyExportInitFragment.js
index d81cbad..ad6401b 100644
--- a/node_modules/webpack/lib/dependencies/HarmonyExportInitFragment.js
+++ b/node_modules/webpack/lib/dependencies/HarmonyExportInitFragment.js
@@ -8,12 +8,14 @@
const InitFragment = require("../InitFragment");
const RuntimeGlobals = require("../RuntimeGlobals");
const { first } = require("../util/SetHelpers");
-const { propertyName } = require("../util/propertyName");
+const { propertyName } = require("../util/property");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
+/** @typedef {import("../ExportsInfo").UsedName} UsedName */
/**
+ * Join iterable with comma.
* @param {Iterable<string>} iterable iterable strings
* @returns {string} result
*/
@@ -33,17 +35,24 @@
return str;
};
+/** @typedef {Map<UsedName, string>} ExportMap */
+/** @typedef {Set<string>} UnusedExports */
+
+/** @type {ExportMap} */
const EMPTY_MAP = new Map();
+/** @type {UnusedExports} */
const EMPTY_SET = new Set();
/**
+ * Represents HarmonyExportInitFragment.
* @extends {InitFragment<GenerateContext>} Context
*/
class HarmonyExportInitFragment extends InitFragment {
/**
+ * Creates an instance of HarmonyExportInitFragment.
* @param {string} exportsArgument the exports identifier
- * @param {Map<string, string>} exportMap mapping from used name to exposed variable name
- * @param {Set<string>} unusedExports list of unused export names
+ * @param {ExportMap} exportMap mapping from used name to exposed variable name
+ * @param {UnusedExports} unusedExports list of unused export names
*/
constructor(
exportsArgument,
@@ -51,18 +60,24 @@
unusedExports = EMPTY_SET
) {
super(undefined, InitFragment.STAGE_HARMONY_EXPORTS, 1, "harmony-exports");
+ /** @type {string} */
this.exportsArgument = exportsArgument;
+ /** @type {ExportMap} */
this.exportMap = exportMap;
+ /** @type {UnusedExports} */
this.unusedExports = unusedExports;
}
/**
+ * Merges the provided values into a single result.
* @param {HarmonyExportInitFragment[]} fragments all fragments to merge
* @returns {HarmonyExportInitFragment} merged fragment
*/
mergeAll(fragments) {
+ /** @type {undefined | ExportMap} */
let exportMap;
let exportMapOwned = false;
+ /** @type {undefined | UnusedExports} */
let unusedExports;
let unusedExportsOwned = false;
@@ -104,10 +119,12 @@
}
/**
+ * Returns merged result.
* @param {HarmonyExportInitFragment} other other
* @returns {HarmonyExportInitFragment} merged result
*/
merge(other) {
+ /** @type {ExportMap} */
let exportMap;
if (this.exportMap.size === 0) {
exportMap = other.exportMap;
@@ -119,6 +136,7 @@
if (!exportMap.has(key)) exportMap.set(key, value);
}
}
+ /** @type {UnusedExports} */
let unusedExports;
if (this.unusedExports.size === 0) {
unusedExports = other.unusedExports;
@@ -138,6 +156,7 @@
}
/**
+ * Returns the source code that will be included as initialization code.
* @param {GenerateContext} context context
* @returns {string | Source | undefined} the source code that will be included as initialization code
*/
@@ -153,6 +172,7 @@
: this.unusedExports.size > 0
? `/* unused harmony export ${first(this.unusedExports)} */\n`
: "";
+ /** @type {string[]} */
const definitions = [];
const orderedExportMap = [...this.exportMap].sort(([a], [b]) =>
a < b ? -1 : 1
@@ -160,7 +180,7 @@
for (const [key, value] of orderedExportMap) {
definitions.push(
`\n/* harmony export */ ${propertyName(
- key
+ /** @type {string} */ (key)
)}: ${runtimeTemplate.returningFunction(value)}`
);
}
--
Gitblit v1.9.3