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/rules/RuleSetCompiler.js | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/node_modules/webpack/lib/rules/RuleSetCompiler.js b/node_modules/webpack/lib/rules/RuleSetCompiler.js
index 2fa4ce7..d7dbf1d 100644
--- a/node_modules/webpack/lib/rules/RuleSetCompiler.js
+++ b/node_modules/webpack/lib/rules/RuleSetCompiler.js
@@ -9,16 +9,19 @@
/** @typedef {import("enhanced-resolve").ResolveRequest} ResolveRequest */
/** @typedef {import("../../declarations/WebpackOptions").Falsy} Falsy */
+/** @typedef {import("../../declarations/WebpackOptions").RuleSetUseItem} RuleSetUseItem */
/** @typedef {import("../../declarations/WebpackOptions").RuleSetLoaderOptions} RuleSetLoaderOptions */
/** @typedef {import("../../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
/** @typedef {(Falsy | RuleSetRule)[]} RuleSetRules */
/**
+ * Defines the rule condition function type used by this module.
* @typedef {(value: EffectData[keyof EffectData]) => boolean} RuleConditionFunction
*/
/**
+ * Defines the rule condition type used by this module.
* @typedef {object} RuleCondition
* @property {string | string[]} property
* @property {boolean} matchWhenEmpty
@@ -26,12 +29,14 @@
*/
/**
+ * Defines the condition type used by this module.
* @typedef {object} Condition
* @property {boolean} matchWhenEmpty
* @property {RuleConditionFunction} fn
*/
/**
+ * Defines the effect data type used by this module.
* @typedef {object} EffectData
* @property {string=} resource
* @property {string=} realResource
@@ -45,9 +50,11 @@
* @property {string=} compiler
* @property {string} issuer
* @property {string} issuerLayer
+ * @property {string=} phase
*/
/**
+ * Defines the compiled rule type used by this module.
* @typedef {object} CompiledRule
* @property {RuleCondition[]} conditions
* @property {(Effect | ((effectData: EffectData) => Effect[]))[]} effects
@@ -58,12 +65,14 @@
/** @typedef {"use" | "use-pre" | "use-post"} EffectUseType */
/**
+ * Defines the effect use type used by this module.
* @typedef {object} EffectUse
* @property {EffectUseType} type
* @property {{ loader: string, options?: string | null | Record<string, EXPECTED_ANY>, ident?: string }} value
*/
/**
+ * Defines the effect basic type used by this module.
* @typedef {object} EffectBasic
* @property {string} type
* @property {EXPECTED_ANY} value
@@ -74,23 +83,29 @@
/** @typedef {Map<string, RuleSetLoaderOptions>} References */
/**
+ * Defines the rule set type used by this module.
* @typedef {object} RuleSet
* @property {References} references map of references in the rule set (may grow over time)
* @property {(effectData: EffectData) => Effect[]} exec execute the rule set
*/
/**
+ * Defines the keys of types type used by this module.
* @template T
* @template {T[keyof T]} V
- * @typedef {({ [P in keyof Required<T>]: Required<T>[P] extends V ? P : never })[keyof T]} KeysOfTypes
+ * @typedef {({ [key in keyof Required<T>]: Required<T>[key] extends V ? key : never })[keyof T]} KeysOfTypes
*/
/** @typedef {Set<string>} UnhandledProperties */
+
+/** @typedef {(data: EffectData) => (RuleSetUseItem | (Falsy | RuleSetUseItem)[])} RuleSetUseFn */
+/** @typedef {(value: string) => boolean} RuleSetConditionFn */
/** @typedef {{ apply: (ruleSetCompiler: RuleSetCompiler) => void }} RuleSetPlugin */
class RuleSetCompiler {
/**
+ * Creates an instance of RuleSetCompiler.
* @param {RuleSetPlugin[]} plugins plugins
*/
constructor(plugins) {
@@ -112,14 +127,17 @@
}
/**
+ * Returns compiled RuleSet.
* @param {RuleSetRules} ruleSet raw user provided rules
* @returns {RuleSet} compiled RuleSet
*/
compile(ruleSet) {
+ /** @type {References} */
const refs = new Map();
const rules = this.compileRules("ruleSet", ruleSet, refs);
/**
+ * Returns true, if the rule has matched.
* @param {EffectData} data data passed in
* @param {CompiledRule} rule the compiled rule
* @param {Effect[]} effects an array where effects are pushed to
@@ -197,6 +215,7 @@
}
/**
+ * Returns rules.
* @param {string} path current path
* @param {RuleSetRules} rules the raw rules provided by user
* @param {References} refs references
@@ -215,6 +234,7 @@
}
/**
+ * Returns normalized and compiled rule for processing.
* @param {string} path current path
* @param {RuleSetRule} rule the raw rule provided by user
* @param {References} refs references
@@ -268,6 +288,7 @@
}
/**
+ * Returns compiled condition.
* @param {string} path current path
* @param {RuleSetLoaderOptions} condition user provided condition value
* @returns {Condition} compiled condition
@@ -327,6 +348,7 @@
);
}
+ /** @type {Condition[]} */
const conditions = [];
for (const key of Object.keys(condition)) {
const value = condition[key];
@@ -388,6 +410,7 @@
}
/**
+ * Combine conditions or.
* @param {Condition[]} conditions some conditions
* @returns {Condition} merged condition
*/
@@ -407,6 +430,7 @@
}
/**
+ * Combine conditions and.
* @param {Condition[]} conditions some conditions
* @returns {Condition} merged condition
*/
@@ -426,6 +450,7 @@
}
/**
+ * Returns an error object.
* @param {string} path current path
* @param {EXPECTED_ANY} value value at the error location
* @param {string} message message explaining the problem
--
Gitblit v1.9.3