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/logging/Logger.js | 40 +++++++++++++++++++++++++++++++---------
1 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/node_modules/webpack/lib/logging/Logger.js b/node_modules/webpack/lib/logging/Logger.js
index 2987e2a..b385fb8 100644
--- a/node_modules/webpack/lib/logging/Logger.js
+++ b/node_modules/webpack/lib/logging/Logger.js
@@ -30,24 +30,31 @@
module.exports.LogType = LogType;
/** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */
+/** @typedef {Map<string | undefined, [number, number]>} TimersMap */
const LOG_SYMBOL = Symbol("webpack logger raw log method");
const TIMERS_SYMBOL = Symbol("webpack logger times");
const TIMERS_AGGREGATES_SYMBOL = Symbol("webpack logger aggregated times");
/** @typedef {EXPECTED_ANY[]} Args */
+/** @typedef {(type: LogTypeEnum, args?: Args) => void} LogFn */
+/** @typedef {(name: string | (() => string)) => WebpackLogger} GetChildLogger */
class WebpackLogger {
/**
- * @param {(type: LogTypeEnum, args?: Args) => void} log log function
- * @param {(name: string | (() => string)) => WebpackLogger} getChildLogger function to create child logger
+ * Creates an instance of WebpackLogger.
+ * @param {LogFn} log log function
+ * @param {GetChildLogger} getChildLogger function to create child logger
*/
constructor(log, getChildLogger) {
+ /** @type {LogFn} */
this[LOG_SYMBOL] = log;
+ /** @type {GetChildLogger} */
this.getChildLogger = getChildLogger;
}
/**
+ * Processes the provided arg.
* @param {Args} args args
*/
error(...args) {
@@ -55,6 +62,7 @@
}
/**
+ * Processes the provided arg.
* @param {Args} args args
*/
warn(...args) {
@@ -62,6 +70,7 @@
}
/**
+ * Processes the provided arg.
* @param {Args} args args
*/
info(...args) {
@@ -69,6 +78,7 @@
}
/**
+ * Processes the provided arg.
* @param {Args} args args
*/
log(...args) {
@@ -76,6 +86,7 @@
}
/**
+ * Processes the provided arg.
* @param {Args} args args
*/
debug(...args) {
@@ -83,11 +94,12 @@
}
/**
- * @param {EXPECTED_ANY} assertion assertion
+ * Processes the provided condition.
+ * @param {boolean=} condition condition
* @param {Args} args args
*/
- assert(assertion, ...args) {
- if (!assertion) {
+ assert(condition, ...args) {
+ if (!condition) {
this[LOG_SYMBOL](LogType.error, args);
}
}
@@ -101,6 +113,7 @@
}
/**
+ * Processes the provided arg.
* @param {Args} args args
*/
status(...args) {
@@ -108,6 +121,7 @@
}
/**
+ * Processes the provided arg.
* @param {Args} args args
*/
group(...args) {
@@ -115,6 +129,7 @@
}
/**
+ * Processes the provided arg.
* @param {Args} args args
*/
groupCollapsed(...args) {
@@ -126,6 +141,7 @@
}
/**
+ * Processes the provided label.
* @param {string=} label label
*/
profile(label) {
@@ -133,6 +149,7 @@
}
/**
+ * Processes the provided label.
* @param {string=} label label
*/
profileEnd(label) {
@@ -140,15 +157,17 @@
}
/**
+ * Processes the provided label.
* @param {string} label label
*/
time(label) {
- /** @type {Map<string | undefined, [number, number]>} */
+ /** @type {TimersMap} */
this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map();
this[TIMERS_SYMBOL].set(label, process.hrtime());
}
/**
+ * Processes the provided label.
* @param {string=} label label
*/
timeLog(label) {
@@ -161,6 +180,7 @@
}
/**
+ * Processes the provided label.
* @param {string=} label label
*/
timeEnd(label) {
@@ -169,12 +189,13 @@
throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`);
}
const time = process.hrtime(prev);
- /** @type {Map<string | undefined, [number, number]>} */
+ /** @type {TimersMap} */
(this[TIMERS_SYMBOL]).delete(label);
this[LOG_SYMBOL](LogType.time, [label, ...time]);
}
/**
+ * Processes the provided label.
* @param {string=} label label
*/
timeAggregate(label) {
@@ -185,9 +206,9 @@
);
}
const time = process.hrtime(prev);
- /** @type {Map<string | undefined, [number, number]>} */
+ /** @type {TimersMap} */
(this[TIMERS_SYMBOL]).delete(label);
- /** @type {Map<string | undefined, [number, number]>} */
+ /** @type {TimersMap} */
this[TIMERS_AGGREGATES_SYMBOL] =
this[TIMERS_AGGREGATES_SYMBOL] || new Map();
const current = this[TIMERS_AGGREGATES_SYMBOL].get(label);
@@ -204,6 +225,7 @@
}
/**
+ * Time aggregate end.
* @param {string=} label label
*/
timeAggregateEnd(label) {
--
Gitblit v1.9.3