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/url/URLParserPlugin.js | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/node_modules/webpack/lib/url/URLParserPlugin.js b/node_modules/webpack/lib/url/URLParserPlugin.js
index 4140567..4a65c63 100644
--- a/node_modules/webpack/lib/url/URLParserPlugin.js
+++ b/node_modules/webpack/lib/url/URLParserPlugin.js
@@ -28,12 +28,14 @@
const PLUGIN_NAME = "URLParserPlugin";
/**
+ * Returns file url.
* @param {NormalModule} module module
* @returns {URL} file url
*/
const getUrl = (module) => pathToFileURL(module.resource);
/**
+ * Checks whether this object is meta url.
* @param {JavascriptParser} parser parser parser
* @param {MemberExpression} arg arg
* @returns {boolean} true when it is `meta.url`, otherwise false
@@ -54,12 +56,11 @@
return true;
};
-/**
- * @type {WeakMap<NewExpressionNode, BasicEvaluatedExpression | undefined>}
- */
+/** @type {WeakMap<NewExpressionNode, BasicEvaluatedExpression | undefined>} */
const getEvaluatedExprCache = new WeakMap();
/**
+ * Gets evaluated expr.
* @param {NewExpressionNode} expr expression
* @param {JavascriptParser} parser parser parser
* @returns {BasicEvaluatedExpression | undefined} basic evaluated expression
@@ -69,6 +70,7 @@
if (result !== undefined) return result;
/**
+ * Returns basic evaluated expression.
* @returns {BasicEvaluatedExpression | undefined} basic evaluated expression
*/
const evaluate = () => {
@@ -92,13 +94,16 @@
class URLParserPlugin {
/**
+ * Creates an instance of URLParserPlugin.
* @param {JavascriptParserOptions} options options
*/
constructor(options) {
+ /** @type {JavascriptParserOptions} */
this.options = options;
}
/**
+ * Applies the plugin by registering its hooks on the compiler.
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
@@ -167,6 +172,7 @@
const evaluatedExpr = getEvaluatedExpr(expr, parser);
if (!evaluatedExpr) return;
+ /** @type {string | undefined} */
let request;
// static URL
@@ -190,7 +196,9 @@
if (this.options.dynamicUrl === false) return;
// context URL
+ /** @type {undefined | RegExp} */
let include;
+ /** @type {undefined | RegExp} */
let exclude;
if (importOptions) {
--
Gitblit v1.9.3