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/dependencies/HarmonyExportDependencyParserPlugin.js | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
index bfed2cc..4b1edc9 100644
--- a/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
+++ b/node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
@@ -21,6 +21,7 @@
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
const { ImportPhaseUtils, createGetImportPhase } = require("./ImportPhase");
+/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").ClassDeclaration} ClassDeclaration */
@@ -35,27 +36,28 @@
module.exports = class HarmonyExportDependencyParserPlugin {
/**
- * @param {import("../../declarations/WebpackOptions").JavascriptParserOptions} options options
+ * Creates an instance of HarmonyExportDependencyParserPlugin.
+ * @param {JavascriptParserOptions} options options
*/
constructor(options) {
this.options = options;
- this.exportPresenceMode =
- options.reexportExportsPresence !== undefined
- ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence)
- : options.exportsPresence !== undefined
- ? ExportPresenceModes.fromUserOption(options.exportsPresence)
- : options.strictExportPresence
- ? ExportPresenceModes.ERROR
- : ExportPresenceModes.AUTO;
+ this.exportPresenceMode = ExportPresenceModes.resolveFromOptions(
+ options.reexportExportsPresence,
+ options
+ );
}
/**
+ * Applies the plugin by registering its hooks on the compiler.
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
apply(parser) {
const { exportPresenceMode } = this;
- const getImportPhase = createGetImportPhase(this.options.deferImport);
+ const getImportPhase = createGetImportPhase(
+ this.options.deferImport,
+ false
+ );
parser.hooks.export.tap(PLUGIN_NAME, (statement) => {
const dep = new HarmonyExportHeaderDependency(
@@ -123,7 +125,7 @@
})
.join(""),
node.type.endsWith("Declaration") &&
- /** @type {FunctionDeclaration | ClassDeclaration} */ (node).id
+ /** @type {FunctionDeclaration | ClassDeclaration} */ (node).id
? /** @type {FunctionDeclaration | ClassDeclaration} */
(node).id.name
: isFunctionDeclaration
@@ -141,6 +143,13 @@
}
: undefined
);
+ dep.isAnonymousDefault =
+ node.type === "ArrowFunctionExpression" ||
+ ((node.type === "FunctionDeclaration" ||
+ node.type === "FunctionExpression" ||
+ node.type === "ClassDeclaration" ||
+ node.type === "ClassExpression") &&
+ !node.id);
dep.loc = Object.create(
/** @type {DependencyLocation} */ (statement.loc)
);
@@ -224,7 +233,8 @@
const dep = new HarmonyExportImportedSpecifierDependency(
/** @type {string} */
(source),
- parser.state.lastHarmonyImportOrder,
+ /** @type {number} */
+ (parser.state.lastHarmonyImportOrder),
id ? [id] : [],
name,
harmonyNamedExports,
--
Gitblit v1.9.3