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/json/JsonModulesPlugin.js |   51 +++++++++++++++++++++++++++++----------------------
 1 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/node_modules/webpack/lib/json/JsonModulesPlugin.js b/node_modules/webpack/lib/json/JsonModulesPlugin.js
index 3841fc0..0e2c87f 100644
--- a/node_modules/webpack/lib/json/JsonModulesPlugin.js
+++ b/node_modules/webpack/lib/json/JsonModulesPlugin.js
@@ -6,29 +6,10 @@
 "use strict";
 
 const { JSON_MODULE_TYPE } = require("../ModuleTypeConstants");
-const createSchemaValidation = require("../util/create-schema-validation");
 const JsonGenerator = require("./JsonGenerator");
 const JsonParser = require("./JsonParser");
 
 /** @typedef {import("../Compiler")} Compiler */
-
-const validate = createSchemaValidation(
-	require("../../schemas/plugins/json/JsonModulesPluginParser.check"),
-	() => require("../../schemas/plugins/json/JsonModulesPluginParser.json"),
-	{
-		name: "Json Modules Plugin",
-		baseDataPath: "parser"
-	}
-);
-
-const validateGenerator = createSchemaValidation(
-	require("../../schemas/plugins/json/JsonModulesPluginGenerator.check"),
-	() => require("../../schemas/plugins/json/JsonModulesPluginGenerator.json"),
-	{
-		name: "Json Modules Plugin",
-		baseDataPath: "generator"
-	}
-);
 
 const PLUGIN_NAME = "JsonModulesPlugin";
 
@@ -38,7 +19,7 @@
  */
 class JsonModulesPlugin {
 	/**
-	 * Apply the plugin
+	 * Applies the plugin by registering its hooks on the compiler.
 	 * @param {Compiler} compiler the compiler instance
 	 * @returns {void}
 	 */
@@ -49,13 +30,39 @@
 				normalModuleFactory.hooks.createParser
 					.for(JSON_MODULE_TYPE)
 					.tap(PLUGIN_NAME, (parserOptions) => {
-						validate(parserOptions);
+						compiler.validate(
+							() =>
+								require("../../schemas/plugins/json/JsonModulesPluginParser.json"),
+							parserOptions,
+							{
+								name: "Json Modules Plugin",
+								baseDataPath: "parser"
+							},
+							(options) =>
+								require("../../schemas/plugins/json/JsonModulesPluginParser.check")(
+									options
+								)
+						);
+
 						return new JsonParser(parserOptions);
 					});
 				normalModuleFactory.hooks.createGenerator
 					.for(JSON_MODULE_TYPE)
 					.tap(PLUGIN_NAME, (generatorOptions) => {
-						validateGenerator(generatorOptions);
+						compiler.validate(
+							() =>
+								require("../../schemas/plugins/json/JsonModulesPluginGenerator.json"),
+							generatorOptions,
+							{
+								name: "Json Modules Plugin",
+								baseDataPath: "generator"
+							},
+							(options) =>
+								require("../../schemas/plugins/json/JsonModulesPluginGenerator.check")(
+									options
+								)
+						);
+
 						return new JsonGenerator(generatorOptions);
 					});
 			}

--
Gitblit v1.9.3