From 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 18:09:58 +0800
Subject: [PATCH] 上报转运调试
---
node_modules/webpack/lib/FlagDependencyUsagePlugin.js | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/node_modules/webpack/lib/FlagDependencyUsagePlugin.js b/node_modules/webpack/lib/FlagDependencyUsagePlugin.js
index c49c609..b962bed 100644
--- a/node_modules/webpack/lib/FlagDependencyUsagePlugin.js
+++ b/node_modules/webpack/lib/FlagDependencyUsagePlugin.js
@@ -28,14 +28,16 @@
class FlagDependencyUsagePlugin {
/**
+ * Creates an instance of FlagDependencyUsagePlugin.
* @param {boolean} global do a global analysis instead of per runtime
*/
constructor(global) {
+ /** @type {boolean} */
this.global = global;
}
/**
- * Apply the plugin
+ * Applies the plugin by registering its hooks on the compiler.
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
@@ -59,6 +61,7 @@
const queue = new TupleQueue();
/**
+ * Process referenced module.
* @param {Module} module module to process
* @param {ReferencedExports} usedExports list of used exports
* @param {RuntimeSpec} runtime part of which runtime
@@ -80,6 +83,7 @@
return;
}
for (const usedExportInfo of usedExports) {
+ /** @type {string[]} */
let usedExport;
let canMangle = true;
if (Array.isArray(usedExportInfo)) {
@@ -161,13 +165,15 @@
};
/**
+ * Processes the provided module.
* @param {DependenciesBlock} module the module
* @param {RuntimeSpec} runtime part of which runtime
* @param {boolean} forceSideEffects always apply side effects
* @returns {void}
*/
const processModule = (module, runtime, forceSideEffects) => {
- /** @type {Map<Module, ReferencedExports | Map<string, string[] | ReferencedExport>>} */
+ /** @typedef {Map<string, string[] | ReferencedExport>} ExportMaps */
+ /** @type {Map<Module, ReferencedExports | ExportMaps>} */
const map = new Map();
/** @type {ArrayQueue<DependenciesBlock>} */
@@ -177,14 +183,12 @@
const block = queue.dequeue();
if (block === undefined) break;
for (const b of block.blocks) {
- if (
- !this.global &&
- b.groupOptions &&
- b.groupOptions.entryOptions
- ) {
+ if (b.groupOptions && b.groupOptions.entryOptions) {
processModule(
b,
- b.groupOptions.entryOptions.runtime || undefined,
+ this.global
+ ? undefined
+ : b.groupOptions.entryOptions.runtime || undefined,
true
);
} else {
@@ -221,6 +225,7 @@
) {
continue;
} else {
+ /** @type {undefined | ExportMaps} */
let exportsMap;
if (Array.isArray(oldReferencedExports)) {
exportsMap = new Map();
@@ -292,6 +297,7 @@
logger.time("trace exports usage in graph");
/**
+ * Process entry dependency.
* @param {Dependency} dep dependency
* @param {RuntimeSpec} runtime runtime
*/
--
Gitblit v1.9.3