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/EvalSourceMapDevToolPlugin.js | 43 ++++++++++++++++++++++++++++---------------
1 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js b/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js
index de7f211..ffef615 100644
--- a/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js
+++ b/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js
@@ -17,10 +17,13 @@
/** @typedef {import("webpack-sources").RawSourceMap} RawSourceMap */
/** @typedef {import("webpack-sources").Source} Source */
+/** @typedef {import("../declarations/WebpackOptions").DevtoolNamespace} DevtoolNamespace */
+/** @typedef {import("../declarations/WebpackOptions").DevtoolModuleFilenameTemplate} DevtoolModuleFilenameTemplate */
/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").Rules} Rules */
-/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
/** @typedef {import("./Compiler")} Compiler */
+/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
+/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
/** @type {WeakMap<Source, Source>} */
const cache = new WeakMap();
@@ -39,6 +42,7 @@
class EvalSourceMapDevToolPlugin {
/**
+ * Creates an instance of EvalSourceMapDevToolPlugin.
* @param {SourceMapDevToolPluginOptions | string=} inputOptions Options object
*/
constructor(inputOptions = {}) {
@@ -51,19 +55,23 @@
} else {
options = inputOptions;
}
+ /** @type {string} */
this.sourceMapComment =
options.append && typeof options.append !== "function"
? options.append
: "//# sourceURL=[module]\n//# sourceMappingURL=[url]";
+ /** @type {DevtoolModuleFilenameTemplate} */
this.moduleFilenameTemplate =
options.moduleFilenameTemplate ||
"webpack://[namespace]/[resource-path]?[hash]";
+ /** @type {DevtoolNamespace} */
this.namespace = options.namespace || "";
+ /** @type {SourceMapDevToolPluginOptions} */
this.options = options;
}
/**
- * Apply the plugin
+ * Applies the plugin by registering its hooks on the compiler.
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
@@ -85,6 +93,7 @@
}
/**
+ * Returns result.
* @param {Source} r result
* @returns {Source} result
*/
@@ -119,6 +128,7 @@
});
/** @type {RawSourceMap} */
let sourceMap;
+ /** @type {string | Buffer} */
let content;
if (source.sourceAndMap) {
const sourceAndMap = source.sourceAndMap(options);
@@ -164,20 +174,23 @@
}
);
sourceMap.sources = moduleFilenames;
- sourceMap.ignoreList = options.ignoreList
- ? sourceMap.sources.reduce(
- /** @type {(acc: number[], sourceName: string, idx: number) => number[]} */ (
- (acc, sourceName, idx) => {
- const rule = /** @type {Rules} */ (options.ignoreList);
- if (ModuleFilenameHelpers.matchPart(sourceName, rule)) {
- acc.push(idx);
- }
- return acc;
+ if (options.ignoreList) {
+ const ignoreList = sourceMap.sources.reduce(
+ /** @type {(acc: number[], sourceName: string, idx: number) => number[]} */ (
+ (acc, sourceName, idx) => {
+ const rule = /** @type {Rules} */ (options.ignoreList);
+ if (ModuleFilenameHelpers.matchPart(sourceName, rule)) {
+ acc.push(idx);
}
- ),
- []
- )
- : [];
+ return acc;
+ }
+ ),
+ []
+ );
+ if (ignoreList.length > 0) {
+ sourceMap.ignoreList = ignoreList;
+ }
+ }
if (options.noSources) {
sourceMap.sourcesContent = undefined;
--
Gitblit v1.9.3