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/WatchIgnorePlugin.js |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/node_modules/webpack/lib/WatchIgnorePlugin.js b/node_modules/webpack/lib/WatchIgnorePlugin.js
index f8c8530..42177c7 100644
--- a/node_modules/webpack/lib/WatchIgnorePlugin.js
+++ b/node_modules/webpack/lib/WatchIgnorePlugin.js
@@ -6,28 +6,19 @@
 "use strict";
 
 const { groupBy } = require("./util/ArrayHelpers");
-const createSchemaValidation = require("./util/create-schema-validation");
 
+/** @typedef {import("watchpack").TimeInfoEntries} TimeInfoEntries */
 /** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */
 /** @typedef {import("./Compiler")} Compiler */
-/** @typedef {import("./util/fs").TimeInfoEntries} TimeInfoEntries */
 /** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */
 /** @typedef {import("./util/fs").WatchMethod} WatchMethod */
 /** @typedef {import("./util/fs").Watcher} Watcher */
-
-const validate = createSchemaValidation(
-	require("../schemas/plugins/WatchIgnorePlugin.check"),
-	() => require("../schemas/plugins/WatchIgnorePlugin.json"),
-	{
-		name: "Watch Ignore Plugin",
-		baseDataPath: "options"
-	}
-);
 
 const IGNORE_TIME_ENTRY = "ignore";
 
 class IgnoringWatchFileSystem {
 	/**
+	 * Creates an instance of IgnoringWatchFileSystem.
 	 * @param {WatchFileSystem} wfs original file system
 	 * @param {WatchIgnorePluginOptions["paths"]} paths ignored paths
 	 */
@@ -41,6 +32,7 @@
 		files = [...files];
 		dirs = [...dirs];
 		/**
+		 * Returns true, if path is ignored.
 		 * @param {string} path path to check
 		 * @returns {boolean} true, if path is ignored
 		 */
@@ -129,24 +121,37 @@
 
 class WatchIgnorePlugin {
 	/**
+	 * Creates an instance of WatchIgnorePlugin.
 	 * @param {WatchIgnorePluginOptions} options options
 	 */
 	constructor(options) {
-		validate(options);
-		this.paths = options.paths;
+		/** @type {WatchIgnorePluginOptions} */
+		this.options = options;
 	}
 
 	/**
-	 * Apply the plugin
+	 * Applies the plugin by registering its hooks on the compiler.
 	 * @param {Compiler} compiler the compiler instance
 	 * @returns {void}
 	 */
 	apply(compiler) {
+		compiler.hooks.validate.tap(PLUGIN_NAME, () => {
+			compiler.validate(
+				() => require("../schemas/plugins/WatchIgnorePlugin.json"),
+				this.options,
+				{
+					name: "Watch Ignore Plugin",
+					baseDataPath: "options"
+				},
+				(options) =>
+					require("../schemas/plugins/WatchIgnorePlugin.check")(options)
+			);
+		});
 		compiler.hooks.afterEnvironment.tap(PLUGIN_NAME, () => {
 			compiler.watchFileSystem = new IgnoringWatchFileSystem(
 				/** @type {WatchFileSystem} */
 				(compiler.watchFileSystem),
-				this.paths
+				this.options.paths
 			);
 		});
 	}

--
Gitblit v1.9.3