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/stats/DefaultStatsPrinterPlugin.js | 51 ++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/node_modules/webpack/lib/stats/DefaultStatsPrinterPlugin.js b/node_modules/webpack/lib/stats/DefaultStatsPrinterPlugin.js
index 8beab5e..011a08b 100644
--- a/node_modules/webpack/lib/stats/DefaultStatsPrinterPlugin.js
+++ b/node_modules/webpack/lib/stats/DefaultStatsPrinterPlugin.js
@@ -36,6 +36,7 @@
const MAX_MODULE_IDENTIFIER_LENGTH = 80;
/**
+ * Returns if n is 1, singular, else plural.
* @param {number} n a number
* @param {string} singular singular
* @param {string} plural plural
@@ -44,6 +45,7 @@
const plural = (n, singular, plural) => (n === 1 ? singular : plural);
/**
+ * Returns text.
* @param {Record<string, number>} sizes sizes by source type
* @param {StatsPrinterContext} options options
* @returns {string | undefined} text
@@ -58,6 +60,7 @@
};
/**
+ * Gets resource name.
* @param {string | null} resource resource
* @returns {string} resource name for display
*/
@@ -75,8 +78,9 @@
};
/**
+ * Returns prefix and module name.
* @param {string} name module name
- * @returns {[string,string]} prefix and module name
+ * @returns {[string, string]} prefix and module name
*/
const getModuleName = (name) => {
const [, prefix, resource] =
@@ -99,6 +103,7 @@
};
/**
+ * Returns joined string.
* @param {string} str string
* @param {(item: string) => string} fn function to apply to each line
* @returns {string} joined string
@@ -106,12 +111,14 @@
const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
/**
+ * Returns number as two digit string, leading 0.
* @param {number} n a number
* @returns {string} number as two digit string, leading 0
*/
const twoDigit = (n) => (n >= 10 ? `${n}` : `0${n}`);
/**
+ * Checks whether this object is valid id.
* @param {string | number | null} id an id
* @returns {id is string | number} is i
*/
@@ -124,6 +131,7 @@
};
/**
+ * Returns string representation of list.
* @template T
* @param {T[] | undefined} list of items
* @param {number} count number of items to show
@@ -133,28 +141,33 @@
list && list.length > 0 ? `+ ${count}` : `${count}`;
/**
+ * Defines the with required type used by this module.
* @template T
* @template {keyof T} K
* @typedef {{ [P in K]-?: T[P] }} WithRequired
*/
/**
+ * Defines the define stats printer context type used by this module.
* @template {keyof StatsPrinterContext} RequiredStatsPrinterContextKeys
* @typedef {StatsPrinterContextWithExtra & WithRequired<StatsPrinterContext, "compilation" | RequiredStatsPrinterContextKeys>} DefineStatsPrinterContext
*/
/**
+ * Defines the simple printer type used by this module.
* @template T
* @template {keyof StatsPrinterContext} RequiredStatsPrinterContextKeys
* @typedef {(thing: Exclude<T, undefined>, context: DefineStatsPrinterContext<RequiredStatsPrinterContextKeys>, printer: StatsPrinter) => string | undefined} SimplePrinter
*/
/**
+ * Defines the unpacked type used by this module.
* @template T
* @typedef {T extends (infer U)[] ? U : T} Unpacked
*/
/**
+ * Defines the property name type used by this module.
* @template {object} O
* @template {keyof O} K
* @template {string} B
@@ -162,6 +175,7 @@
*/
/**
+ * Defines the array property name type used by this module.
* @template {object} O
* @template {keyof O} K
* @template {string} B
@@ -169,6 +183,7 @@
*/
/**
+ * Defines the exclamation type used by this module.
* @template {object} O
* @template {string} K
* @template {string} E
@@ -176,6 +191,7 @@
*/
/**
+ * Defines the shared type used by this module.
* @template {object} O
* @template {string} B
* @template {string} [R=B]
@@ -184,6 +200,7 @@
*/
/**
+ * Defines the shared type used by this module.
* @typedef {Printers<KnownStatsCompilation, "compilation"> &
* { ["compilation.summary!"]?: SimplePrinter<KnownStatsCompilation, "compilation"> } &
* { ["compilation.errorsInChildren!"]?: SimplePrinter<KnownStatsCompilation, "compilation"> } &
@@ -245,6 +262,7 @@
nameMessage && versionMessage
? `${nameMessage} (${versionMessage})`
: versionMessage || nameMessage || "webpack";
+ /** @type {string} */
let statusMessage;
if (errorsMessage && warningsMessage) {
statusMessage = `compiled with ${errorsMessage} and ${warningsMessage}`;
@@ -405,6 +423,7 @@
};
/**
+ * Defines the shared type used by this module.
* @typedef {Printers<KnownStatsAsset, "asset"> &
* Printers<KnownStatsAsset["info"], "asset.info"> &
* Exclamation<KnownStatsAsset, "asset.separator", "asset"> &
@@ -466,6 +485,7 @@
};
/**
+ * Defines the shared type used by this module.
* @typedef {Printers<KnownStatsModule, "module"> &
* Exclamation<KnownStatsModule, "module.separator", "module"> &
* { ["module.filteredChildren"]?: SimplePrinter<number, "module"> } &
@@ -587,8 +607,8 @@
};
/**
- * @typedef {Printers<KnownStatsModuleIssuer, "moduleIssuer"> &
- * Printers<KnownStatsModuleIssuer["profile"], "moduleIssuer.profile", "moduleIssuer">} ModuleIssuerPrinters
+ * Defines the module issuer printers type used by this module.
+ * @typedef {Printers<KnownStatsModuleIssuer, "moduleIssuer"> & Printers<KnownStatsModuleIssuer["profile"], "moduleIssuer.profile", "moduleIssuer">} ModuleIssuerPrinters
*/
/** @type {ModuleIssuerPrinters} */
@@ -598,8 +618,8 @@
};
/**
- * @typedef {Printers<KnownStatsModuleReason, "moduleReason"> &
- * { ["moduleReason.filteredChildren"]?: SimplePrinter<number, "moduleReason"> }} ModuleReasonsPrinters
+ * Defines the module reasons printers type used by this module.
+ * @typedef {Printers<KnownStatsModuleReason, "moduleReason"> & { ["moduleReason.filteredChildren"]?: SimplePrinter<number, "moduleReason"> }} ModuleReasonsPrinters
*/
/** @type {ModuleReasonsPrinters} */
@@ -653,6 +673,7 @@
};
/**
+ * Defines the shared type used by this module.
* @typedef {Exclamation<KnownStatsChunkGroup, "chunkGroup.kind", "chunkGroupKind"> &
* Exclamation<KnownStatsChunkGroup, "chunkGroup.separator", "chunkGroup"> &
* Printers<KnownStatsChunkGroup, "chunkGroup"> &
@@ -717,6 +738,7 @@
};
/**
+ * Defines the shared type used by this module.
* @typedef {Printers<KnownStatsChunk, "chunk"> &
* { ["chunk.childrenByOrder[].type"]: SimplePrinter<string, "chunk"> } &
* { ["chunk.childrenByOrder[].children[]"]: SimplePrinter<ChunkId, "chunk"> } &
@@ -779,6 +801,7 @@
};
/**
+ * Defines the shared type used by this module.
* @typedef {Printers<KnownStatsError, "error"> &
* { ["error.filteredDetails"]?: SimplePrinter<number, "error"> } &
* Exclamation<KnownStatsError, "error.separator", "error">} ErrorPrinters
@@ -799,7 +822,7 @@
"error.file": (file, { bold }) => bold(file),
"error.moduleName": (moduleName, { bold }) =>
moduleName.includes("!")
- ? `${bold(moduleName.replace(/^(\s|\S)*!/, ""))} (${moduleName})`
+ ? `${bold(moduleName.replace(/^([\s\S])*!/, ""))} (${moduleName})`
: `${bold(moduleName)}`,
"error.loc": (loc, { green }) => green(loc),
"error.message": (message, { bold, formatError }) =>
@@ -823,6 +846,7 @@
};
/**
+ * Defines the shared type used by this module.
* @typedef {Printers<KnownStatsLoggingEntry, `loggingEntry(${LogTypeEnum}).loggingEntry`> &
* { ["loggingEntry(clear).loggingEntry"]?: SimplePrinter<KnownStatsLoggingEntry, "logging"> } &
* { ["loggingEntry.trace[]"]?: SimplePrinter<Exclude<KnownStatsLoggingEntry["trace"], undefined>[number], "logging"> } &
@@ -1179,6 +1203,7 @@
};
/**
+ * Returns result.
* @param {Item[]} items items
* @returns {string} result
*/
@@ -1189,10 +1214,12 @@
.join(" ");
/**
+ * Returns result.
* @param {Item[]} items items
* @returns {string} result
*/
const joinInBrackets = (items) => {
+ /** @type {string[]} */
const res = [];
let mode = 0;
for (const item of items) {
@@ -1235,6 +1262,7 @@
};
/**
+ * Returns result.
* @param {string} str a string
* @param {string} prefix prefix
* @param {boolean=} noPrefixInFirstLine need prefix in the first line?
@@ -1248,6 +1276,7 @@
};
/**
+ * Join explicit new line.
* @param {(false | Item)[]} items items
* @param {string} indenter indenter
* @returns {string} result
@@ -1274,12 +1303,14 @@
};
/**
+ * Returns joiner.
* @param {boolean} error is an error
* @returns {SimpleElementJoiner} joiner
*/
const joinError =
(error) =>
/**
+ * Handles the callback logic for this hook.
* @param {Item[]} items items
* @param {StatsPrinterContextWithExtra} ctx context
* @returns {string} result
@@ -1296,6 +1327,7 @@
/** @type {Record<string, SimpleElementJoiner>} */
const SIMPLE_ELEMENT_JOINERS = {
compilation: (items) => {
+ /** @type {string[]} */
const result = [];
let lastNeedMore = false;
for (const item of items) {
@@ -1446,11 +1478,13 @@
};
/**
+ * Defines the tail type used by this module.
* @template T
* @typedef {T extends [infer Head, ...infer Tail] ? Tail : undefined} Tail
*/
/**
+ * Defines the tail parameters type used by this module.
* @template {(...args: EXPECTED_ANY[]) => EXPECTED_ANY} T
* @typedef {T extends (firstArg: EXPECTED_ANY, ...rest: infer R) => EXPECTED_ANY ? R : never} TailParameters
*/
@@ -1537,6 +1571,7 @@
message = message.replace(
regExp,
/**
+ * Handles the format callback for this hook.
* @param {string} match match
* @param {string} content content
* @returns {string} result
@@ -1555,6 +1590,7 @@
};
/**
+ * Creates an order from the provided array.
* @param {string[]} array array
* @param {string[]} preferredOrder preferred order
* @returns {string[]} result
@@ -1584,7 +1620,7 @@
class DefaultStatsPrinterPlugin {
/**
- * Apply the plugin
+ * Applies the plugin by registering its hooks on the compiler.
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
@@ -1625,6 +1661,7 @@
}\u001B[39m\u001B[22m`;
} else {
/**
+ * Returns str string.
* @param {string} str string
* @returns {string} str string
*/
--
Gitblit v1.9.3