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/config/defaults.js |  335 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 244 insertions(+), 91 deletions(-)

diff --git a/node_modules/webpack/lib/config/defaults.js b/node_modules/webpack/lib/config/defaults.js
index b576026..2eb2e39 100644
--- a/node_modules/webpack/lib/config/defaults.js
+++ b/node_modules/webpack/lib/config/defaults.js
@@ -8,6 +8,11 @@
 const fs = require("fs");
 const path = require("path");
 const {
+	CSS_TYPE,
+	JAVASCRIPT_TYPE,
+	UNKNOWN_TYPE
+} = require("../ModuleSourceTypeConstants");
+const {
 	ASSET_MODULE_TYPE,
 	ASSET_MODULE_TYPE_BYTES,
 	ASSET_MODULE_TYPE_INLINE,
@@ -34,6 +39,7 @@
 
 /** @typedef {import("../../declarations/WebpackOptions").CacheOptionsNormalized} CacheOptionsNormalized */
 /** @typedef {import("../../declarations/WebpackOptions").Context} Context */
+/** @typedef {import("../../declarations/WebpackOptions").DevTool} Devtool */
 /** @typedef {import("../../declarations/WebpackOptions").CssGeneratorOptions} CssGeneratorOptions */
 /** @typedef {import("../../declarations/WebpackOptions").EntryDescription} EntryDescription */
 /** @typedef {import("../../declarations/WebpackOptions").EntryNormalized} Entry */
@@ -52,6 +58,10 @@
 /** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
 /** @typedef {import("../../declarations/WebpackOptions").Loader} Loader */
 /** @typedef {import("../../declarations/WebpackOptions").Mode} Mode */
+/** @typedef {import("../../declarations/WebpackOptions").HashFunction} HashFunction */
+/** @typedef {import("../../declarations/WebpackOptions").HashSalt} HashSalt */
+/** @typedef {import("../../declarations/WebpackOptions").HashDigest} HashDigest */
+/** @typedef {import("../../declarations/WebpackOptions").HashDigestLength} HashDigestLength */
 /** @typedef {import("../../declarations/WebpackOptions").ModuleOptionsNormalized} ModuleOptions */
 /** @typedef {import("../../declarations/WebpackOptions").Node} WebpackNode */
 /** @typedef {import("../../declarations/WebpackOptions").OptimizationNormalized} Optimization */
@@ -64,15 +74,19 @@
 /** @typedef {import("../../declarations/WebpackOptions").SnapshotOptions} SnapshotOptions */
 /** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
 /** @typedef {import("../Module")} Module */
+/** @typedef {import("../javascript/EnableChunkLoadingPlugin").ChunkLoadingTypes} ChunkLoadingTypes */
+/** @typedef {import("../wasm/EnableWasmLoadingPlugin").WasmLoadingTypes} WasmLoadingTypes */
 /** @typedef {import("./target").PlatformTargetProperties} PlatformTargetProperties */
 /** @typedef {import("./target").TargetProperties} TargetProperties */
 
 /**
+ * Defines the recursive non nullable type used by this module.
  * @template T
  * @typedef {{ [P in keyof T]-?: T[P] extends object ? RecursiveNonNullable<NonNullable<T[P]>> : NonNullable<T[P]> }} RecursiveNonNullable
  */
 
 /**
+ * Defines the shared type used by this module.
  * @typedef {Output & {
  * uniqueName: NonNullable<Output["uniqueName"]>,
  * filename: NonNullable<Output["filename"]>,
@@ -82,14 +96,14 @@
  * hotUpdateChunkFilename: NonNullable<Output["hotUpdateChunkFilename"]>,
  * hotUpdateGlobal: NonNullable<Output["hotUpdateGlobal"]>,
  * assetModuleFilename: NonNullable<Output["assetModuleFilename"]>,
- * webassemblyModuleFilename: NonNullable<Output["webassemblyModuleFilename"]>
+ * webassemblyModuleFilename: NonNullable<Output["webassemblyModuleFilename"]>,
  * sourceMapFilename: NonNullable<Output["sourceMapFilename"]>,
  * hotUpdateMainFilename: NonNullable<Output["hotUpdateMainFilename"]>,
  * devtoolNamespace: NonNullable<Output["devtoolNamespace"]>,
- * publicPath: NonNullable<Output["publicPath"]>
- * workerPublicPath: NonNullable<Output["workerPublicPath"]>
- * workerWasmLoading: NonNullable<Output["workerWasmLoading"]>
- * workerChunkLoading: NonNullable<Output["workerChunkLoading"]>
+ * publicPath: NonNullable<Output["publicPath"]>,
+ * workerPublicPath: NonNullable<Output["workerPublicPath"]>,
+ * workerWasmLoading: NonNullable<Output["workerWasmLoading"]>,
+ * workerChunkLoading: NonNullable<Output["workerChunkLoading"]>,
  * chunkFormat: NonNullable<Output["chunkFormat"]>,
  * module: NonNullable<Output["module"]>,
  * asyncChunks: NonNullable<Output["asyncChunks"]>,
@@ -117,6 +131,7 @@
  */
 
 /**
+ * Defines the shared type used by this module.
  * @typedef {SnapshotOptions & {
  * managedPaths: NonNullable<SnapshotOptions["managedPaths"]>,
  * unmanagedPaths: NonNullable<SnapshotOptions["unmanagedPaths"]>,
@@ -129,6 +144,7 @@
  */
 
 /**
+ * Defines the shared type used by this module.
  * @typedef {Optimization & {
  * runtimeChunk: NonNullable<Optimization["runtimeChunk"]>,
  * splitChunks: NonNullable<Optimization["splitChunks"]>,
@@ -157,6 +173,7 @@
  */
 
 /**
+ * Defines the shared type used by this module.
  * @typedef {ExternalsPresets & {
  * web: NonNullable<ExternalsPresets["web"]>,
  * node: NonNullable<ExternalsPresets["node"]>,
@@ -169,6 +186,7 @@
  */
 
 /**
+ * Defines the shared type used by this module.
  * @typedef {InfrastructureLogging & {
  * stream: NonNullable<InfrastructureLogging["stream"]>,
  * level: NonNullable<InfrastructureLogging["level"]>,
@@ -179,34 +197,17 @@
  */
 
 /**
- * @typedef {WebpackOptionsNormalized
- * & { context: NonNullable<WebpackOptionsNormalized["context"]> }
- * & { infrastructureLogging: InfrastructureLoggingNormalizedWithDefaults }
- * } WebpackOptionsNormalizedWithBaseDefaults
+ * Defines the webpack options normalized with base defaults type used by this module.
+ * @typedef {WebpackOptionsNormalized & { context: NonNullable<WebpackOptionsNormalized["context"]> } & { infrastructureLogging: InfrastructureLoggingNormalizedWithDefaults }} WebpackOptionsNormalizedWithBaseDefaults
  */
 
 /**
- * @typedef {WebpackOptionsNormalizedWithBaseDefaults
- * & { target: NonNullable<WebpackOptionsNormalized["target"]> }
- * & { output: OutputNormalizedWithDefaults }
- * & { optimization: OptimizationNormalizedWithDefaults }
- * & { devtool: NonNullable<WebpackOptionsNormalized["devtool"]> }
- * & { stats: NonNullable<WebpackOptionsNormalized["stats"]>  }
- * & { node: NonNullable<WebpackOptionsNormalized["node"]> }
- * & { profile: NonNullable<WebpackOptionsNormalized["profile"]> }
- * & { parallelism: NonNullable<WebpackOptionsNormalized["parallelism"]> }
- * & { snapshot: SnapshotNormalizedWithDefaults }
- * & { externalsPresets: ExternalsPresetsNormalizedWithDefaults }
- * & { externalsType: NonNullable<WebpackOptionsNormalized["externalsType"]> }
- * & { watch: NonNullable<WebpackOptionsNormalized["watch"]> }
- * & { performance: NonNullable<WebpackOptionsNormalized["performance"]> }
- * & { recordsInputPath: NonNullable<WebpackOptionsNormalized["recordsInputPath"]> }
- * & { recordsOutputPath: NonNullable<WebpackOptionsNormalized["recordsOutputPath"]>
- * & { dotenv: NonNullable<WebpackOptionsNormalized["dotenv"]> }
- * }} WebpackOptionsNormalizedWithDefaults
+ * Defines the webpack options normalized with defaults type used by this module.
+ * @typedef {WebpackOptionsNormalizedWithBaseDefaults & { target: NonNullable<WebpackOptionsNormalized["target"]> } & { output: OutputNormalizedWithDefaults } & { optimization: OptimizationNormalizedWithDefaults } & { devtool: NonNullable<WebpackOptionsNormalized["devtool"]> } & { stats: NonNullable<WebpackOptionsNormalized["stats"]> } & { node: NonNullable<WebpackOptionsNormalized["node"]> } & { profile: NonNullable<WebpackOptionsNormalized["profile"]> } & { parallelism: NonNullable<WebpackOptionsNormalized["parallelism"]> } & { snapshot: SnapshotNormalizedWithDefaults } & { externalsPresets: ExternalsPresetsNormalizedWithDefaults } & { externalsType: NonNullable<WebpackOptionsNormalized["externalsType"]> } & { watch: NonNullable<WebpackOptionsNormalized["watch"]> } & { performance: NonNullable<WebpackOptionsNormalized["performance"]> } & { recordsInputPath: NonNullable<WebpackOptionsNormalized["recordsInputPath"]> } & { recordsOutputPath: NonNullable<WebpackOptionsNormalized["recordsOutputPath"]> } & { dotenv: NonNullable<WebpackOptionsNormalized["dotenv"]> }} WebpackOptionsNormalizedWithDefaults
  */
 
 /**
+ * Defines the resolved options type used by this module.
  * @typedef {object} ResolvedOptions
  * @property {PlatformTargetProperties | false} platform - platform target properties
  */
@@ -219,7 +220,7 @@
 };
 
 /**
- * Sets a constant default value when undefined
+ * Processes the provided obj.
  * @template T
  * @template {keyof T} P
  * @param {T} obj an object
@@ -234,7 +235,7 @@
 };
 
 /**
- * Sets a dynamic default value when undefined, by calling the factory function
+ * Processes the provided obj.
  * @template T
  * @template {keyof T} P
  * @param {T} obj an object
@@ -290,6 +291,7 @@
 };
 
 /**
+ * Apply webpack options base defaults.
  * @param {WebpackOptionsNormalized} options options to be modified
  * @returns {void}
  */
@@ -299,6 +301,7 @@
 };
 
 /**
+ * Apply webpack options defaults.
  * @param {WebpackOptionsNormalized} options options to be modified
  * @param {number=} compilerIndex index of compiler
  * @returns {ResolvedOptions} Resolved options after apply defaults
@@ -334,7 +337,28 @@
 		}
 	}
 
-	F(options, "devtool", () => (development ? "eval" : false));
+	F(
+		options,
+		"devtool",
+		() =>
+			/** @type {Devtool} */ (
+				development
+					? [
+							options.experiments.css
+								? {
+										type: "css",
+										use: "source-map"
+									}
+								: undefined,
+							{
+								type: "javascript",
+								use: "eval"
+							}
+						].filter(Boolean)
+					: false
+			)
+	);
+
 	D(options, "watch", false);
 	D(options, "profile", false);
 	D(options, "parallelism", 100);
@@ -350,6 +374,8 @@
 	const futureDefaults =
 		/** @type {NonNullable<ExperimentsNormalized["futureDefaults"]>} */
 		(options.experiments.futureDefaults);
+
+	F(options, "validate", () => !(futureDefaults === true && production));
 
 	F(options, "cache", () =>
 		development ? { type: /** @type {"memory"} */ ("memory") } : false
@@ -390,6 +416,12 @@
 
 	applyModuleDefaults(options.module, {
 		cache,
+		hashSalt: /** @type {NonNullable<Output["hashSalt"]>} */ (
+			options.output.hashSalt
+		),
+		hashFunction: /** @type {NonNullable<Output["hashFunction"]>} */ (
+			options.output.hashFunction
+		),
 		syncWebAssembly:
 			/** @type {NonNullable<ExperimentsNormalized["syncWebAssembly"]>} */
 			(options.experiments.syncWebAssembly),
@@ -402,11 +434,17 @@
 		deferImport:
 			/** @type {NonNullable<ExperimentsNormalized["deferImport"]>} */
 			(options.experiments.deferImport),
+		sourceImport:
+			/** @type {NonNullable<ExperimentsNormalized["sourceImport"]>} */
+			(options.experiments.sourceImport),
 		futureDefaults,
 		isNode: targetProperties && targetProperties.node === true,
 		uniqueName: /** @type {string} */ (options.output.uniqueName),
 		targetProperties,
-		mode: options.mode
+		mode: options.mode,
+		outputModule:
+			/** @type {NonNullable<WebpackOptionsNormalized["output"]["module"]>} */
+			(options.output.module)
 	});
 
 	applyExternalsPresetsDefaults(options.externalsPresets, {
@@ -504,6 +542,7 @@
 };
 
 /**
+ * Apply experiments defaults.
  * @param {ExperimentsNormalized} experiments options
  * @param {object} options options
  * @param {boolean} options.production is production
@@ -525,6 +564,7 @@
 	D(experiments, "buildHttp", undefined);
 	D(experiments, "cacheUnaffected", experiments.futureDefaults);
 	D(experiments, "deferImport", false);
+	D(experiments, "sourceImport", false);
 	F(experiments, "css", () => (experiments.futureDefaults ? true : undefined));
 
 	if (typeof experiments.buildHttp === "object") {
@@ -534,6 +574,7 @@
 };
 
 /**
+ * Apply cache defaults.
  * @param {CacheOptionsNormalized} cache options
  * @param {object} options options
  * @param {string} options.name name
@@ -616,6 +657,7 @@
 };
 
 /**
+ * Apply snapshot defaults.
  * @param {SnapshotOptions} snapshot options
  * @param {object} options options
  * @param {boolean} options.production is production
@@ -693,16 +735,19 @@
 };
 
 /**
+ * Apply javascript parser options defaults.
  * @param {JavascriptParserOptions} parserOptions parser options
  * @param {object} options options
  * @param {boolean} options.futureDefaults is future defaults enabled
  * @param {boolean} options.deferImport is defer import enabled
+ * @param {boolean} options.sourceImport is import source enabled
  * @param {boolean} options.isNode is node target platform
+ * @param {boolean} options.outputModule is output.module enabled
  * @returns {void}
  */
 const applyJavascriptParserOptionsDefaults = (
 	parserOptions,
-	{ futureDefaults, deferImport, isNode }
+	{ futureDefaults, deferImport, sourceImport, isNode, outputModule }
 ) => {
 	D(parserOptions, "unknownContextRequest", ".");
 	D(parserOptions, "unknownContextRegExp", false);
@@ -716,7 +761,7 @@
 	D(parserOptions, "wrappedContextRecursive", true);
 	D(parserOptions, "wrappedContextCritical", false);
 	D(parserOptions, "strictThisContextOnImports", false);
-	D(parserOptions, "importMeta", true);
+	D(parserOptions, "importMeta", outputModule ? "preserve-unknown" : true);
 	D(parserOptions, "dynamicImportMode", "lazy");
 	D(parserOptions, "dynamicImportPrefetch", false);
 	D(parserOptions, "dynamicImportPreload", false);
@@ -724,10 +769,12 @@
 	D(parserOptions, "createRequire", isNode);
 	D(parserOptions, "dynamicUrl", true);
 	D(parserOptions, "deferImport", deferImport);
+	D(parserOptions, "sourceImport", sourceImport);
 	if (futureDefaults) D(parserOptions, "exportsPresence", "error");
 };
 
 /**
+ * Apply json generator options defaults.
  * @param {JsonGeneratorOptions} generatorOptions generator options
  * @returns {void}
  */
@@ -736,6 +783,7 @@
 };
 
 /**
+ * Apply css generator options defaults.
  * @param {CssGeneratorOptions} generatorOptions generator options
  * @param {object} options options
  * @param {TargetProperties | false} options.targetProperties target properties
@@ -754,6 +802,7 @@
 };
 
 /**
+ * Apply module defaults.
  * @param {ModuleOptions} module options
  * @param {object} options options
  * @param {boolean} options.cache is caching enabled
@@ -764,13 +813,19 @@
  * @param {string} options.uniqueName the unique name
  * @param {boolean} options.isNode is node target platform
  * @param {boolean} options.deferImport is defer import enabled
+ * @param {boolean} options.sourceImport is import source enabled
  * @param {TargetProperties | false} options.targetProperties target properties
  * @param {Mode | undefined} options.mode mode
+ * @param {HashSalt} options.hashSalt hash salt
+ * @param {HashFunction} options.hashFunction hash function
+ * @param {boolean} options.outputModule is output.module enabled
  * @returns {void}
  */
 const applyModuleDefaults = (
 	module,
 	{
+		hashSalt,
+		hashFunction,
 		cache,
 		syncWebAssembly,
 		asyncWebAssembly,
@@ -780,7 +835,9 @@
 		uniqueName,
 		targetProperties,
 		mode,
-		deferImport
+		deferImport,
+		sourceImport,
+		outputModule
 	}
 ) => {
 	if (cache) {
@@ -788,6 +845,7 @@
 			module,
 			"unsafeCache",
 			/**
+			 * Handles the callback logic for this hook.
 			 * @param {Module} module module
 			 * @returns {boolean} true, if we want to cache the module
 			 */
@@ -839,7 +897,9 @@
 		{
 			futureDefaults,
 			deferImport,
-			isNode
+			sourceImport,
+			isNode,
+			outputModule
 		}
 	);
 
@@ -871,6 +931,51 @@
 			true
 		);
 
+		for (const type of [
+			CSS_MODULE_TYPE_AUTO,
+			CSS_MODULE_TYPE_MODULE,
+			CSS_MODULE_TYPE_GLOBAL
+		]) {
+			F(module.parser, type, () => ({}));
+
+			D(
+				/** @type {NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.parser[type]),
+				"animation",
+				true
+			);
+			D(
+				/** @type {NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.parser[type]),
+				"container",
+				true
+			);
+			D(
+				/** @type {NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.parser[type]),
+				"customIdents",
+				true
+			);
+			D(
+				/** @type {NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.parser[type]),
+				"dashedIdents",
+				true
+			);
+			D(
+				/** @type {NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.parser[type]),
+				"function",
+				true
+			);
+			D(
+				/** @type {NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<ParserOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.parser[type]),
+				"grid",
+				true
+			);
+		}
+
 		F(module.generator, CSS_MODULE_TYPE, () => ({}));
 
 		applyCssGeneratorOptionsDefaults(
@@ -880,49 +985,65 @@
 		);
 
 		const localIdentName =
-			uniqueName.length > 0 ? "[uniqueName]-[id]-[local]" : "[id]-[local]";
+			mode === "development"
+				? uniqueName.length > 0
+					? "[uniqueName]-[id]-[local]"
+					: "[id]-[local]"
+				: "[fullhash]";
+		const localIdentHashSalt = hashSalt;
+		const localIdentHashDigest = "base64url";
+		const localIdentHashDigestLength = 6;
+		const exportsConvention = "as-is";
 
-		F(module.generator, CSS_MODULE_TYPE_AUTO, () => ({}));
-		D(
-			/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]>} */
-			(module.generator[CSS_MODULE_TYPE_AUTO]),
-			"localIdentName",
-			localIdentName
-		);
-		D(
-			/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]>} */
-			(module.generator[CSS_MODULE_TYPE_AUTO]),
-			"exportsConvention",
-			"as-is"
-		);
+		for (const type of [
+			CSS_MODULE_TYPE_AUTO,
+			CSS_MODULE_TYPE_MODULE,
+			CSS_MODULE_TYPE_GLOBAL
+		]) {
+			F(module.generator, type, () => ({}));
 
-		F(module.generator, CSS_MODULE_TYPE_MODULE, () => ({}));
-		D(
-			/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]>} */
-			(module.generator[CSS_MODULE_TYPE_MODULE]),
-			"localIdentName",
-			localIdentName
-		);
-		D(
-			/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]>} */
-			(module.generator[CSS_MODULE_TYPE_MODULE]),
-			"exportsConvention",
-			"as-is"
-		);
+			D(
+				/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.generator[type]),
+				"localIdentName",
+				localIdentName
+			);
 
-		F(module.generator, CSS_MODULE_TYPE_GLOBAL, () => ({}));
-		D(
-			/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
-			(module.generator[CSS_MODULE_TYPE_GLOBAL]),
-			"localIdentName",
-			localIdentName
-		);
-		D(
-			/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
-			(module.generator[CSS_MODULE_TYPE_GLOBAL]),
-			"exportsConvention",
-			"as-is"
-		);
+			D(
+				/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.generator[type]),
+				"localIdentHashSalt",
+				localIdentHashSalt
+			);
+
+			D(
+				/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]>} */
+				(module.generator[type]),
+				"localIdentHashFunction",
+				hashFunction
+			);
+
+			D(
+				/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]>} */
+				(module.generator[type]),
+				"localIdentHashDigest",
+				localIdentHashDigest
+			);
+
+			D(
+				/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]>} */
+				(module.generator[type]),
+				"localIdentHashDigestLength",
+				localIdentHashDigestLength
+			);
+
+			D(
+				/** @type {NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_AUTO]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_MODULE]> | NonNullable<GeneratorOptionsByModuleTypeKnown[CSS_MODULE_TYPE_GLOBAL]>} */
+				(module.generator[type]),
+				"exportsConvention",
+				exportsConvention
+			);
+		}
 	}
 
 	A(module, "defaultRules", () => {
@@ -1114,6 +1235,7 @@
 };
 
 /**
+ * Apply output defaults.
  * @param {Output} output options
  * @param {object} options options
  * @param {string} options.context context
@@ -1140,6 +1262,7 @@
 	}
 ) => {
 	/**
+	 * Returns a readable library name.
 	 * @param {Library=} library the library option
 	 * @returns {string} a readable library name
 	 */
@@ -1191,11 +1314,13 @@
 
 	const environment = /** @type {Environment} */ (output.environment);
 	/**
+	 * Returns true, when v is truthy or undefined.
 	 * @param {boolean | undefined} v value
 	 * @returns {boolean} true, when v is truthy or undefined
 	 */
 	const optimistic = (v) => v || v === undefined;
 	/**
+	 * Conditionally optimistic.
 	 * @param {boolean | undefined} v value
 	 * @param {boolean | undefined} c condition
 	 * @returns {boolean | undefined} true, when v is truthy or undefined, or c is truthy
@@ -1217,6 +1342,12 @@
 		environment,
 		"const",
 		() => tp && optimistic(/** @type {boolean | undefined} */ (tp.const))
+	);
+	F(
+		environment,
+		"methodShorthand",
+		() =>
+			tp && optimistic(/** @type {boolean | undefined} */ (tp.methodShorthand))
 	);
 	F(
 		environment,
@@ -1331,7 +1462,7 @@
 		}
 		return "[id].css";
 	});
-	D(output, "assetModuleFilename", "[hash][ext][query]");
+	D(output, "assetModuleFilename", "[hash][ext][query][fragment]");
 	D(output, "webassemblyModuleFilename", "[hash].module.wasm");
 	D(output, "compareBeforeEmit", true);
 	D(output, "charset", !futureDefaults);
@@ -1360,9 +1491,7 @@
 				throw new Error(
 					"For the selected environment is no default ESM chunk format available:\n" +
 						"ESM exports can be chosen when 'import()' is available.\n" +
-						`JSONP Array push can be chosen when 'document' is available.\n${
-							helpMessage
-						}`
+						`JSONP Array push can be chosen when 'document' is available.\n${helpMessage}`
 				);
 			} else {
 				if (tp.document) return "array-push";
@@ -1377,9 +1506,7 @@
 								: ""
 						}\n` +
 						"JSONP Array push ('array-push') can be chosen when 'document' or 'importScripts' is available.\n" +
-						`CommonJs exports ('commonjs') can be chosen when 'require' or node builtins are available.\n${
-							helpMessage
-						}`
+						`CommonJs exports ('commonjs') can be chosen when 'require' or node builtins are available.\n${helpMessage}`
 				);
 			}
 		}
@@ -1411,7 +1538,7 @@
 				output.module &&
 				environment.dynamicImport
 			) {
-				return "universal";
+				return "import";
 			}
 		}
 		return false;
@@ -1437,7 +1564,7 @@
 				output.module &&
 				environment.dynamicImportInWorker
 			) {
-				return "universal";
+				return "import";
 			}
 		}
 		return false;
@@ -1505,18 +1632,19 @@
 			"policyName",
 			() =>
 				/** @type {NonNullable<Output["uniqueName"]>} */
-				(output.uniqueName).replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, "_") || "webpack"
+				(output.uniqueName).replace(/[^a-z0-9\-#=_/@.%]+/gi, "_") || "webpack"
 		);
 		D(trustedTypes, "onPolicyCreationFailure", "stop");
 	}
 
 	/**
+	 * Processes the provided fn.
 	 * @param {(entryDescription: EntryDescription) => void} fn iterator
 	 * @returns {void}
 	 */
 	const forEachEntry = (fn) => {
 		for (const name of Object.keys(entry)) {
-			fn(/** @type {{[k: string] : EntryDescription}} */ (entry)[name]);
+			fn(/** @type {{ [k: string]: EntryDescription }} */ (entry)[name]);
 		}
 	};
 	A(output, "enabledLibraryTypes", () => {
@@ -1534,6 +1662,7 @@
 	});
 
 	A(output, "enabledChunkLoadingTypes", () => {
+		/** @type {ChunkLoadingTypes} */
 		const enabledChunkLoadingTypes = new Set();
 		if (output.chunkLoading) {
 			enabledChunkLoadingTypes.add(output.chunkLoading);
@@ -1550,6 +1679,7 @@
 	});
 
 	A(output, "enabledWasmLoadingTypes", () => {
+		/** @type {WasmLoadingTypes} */
 		const enabledWasmLoadingTypes = new Set();
 		if (output.wasmLoading) {
 			enabledWasmLoadingTypes.add(output.wasmLoading);
@@ -1567,6 +1697,7 @@
 };
 
 /**
+ * Apply externals presets defaults.
  * @param {ExternalsPresets} externalsPresets options
  * @param {object} options options
  * @param {TargetProperties | false} options.targetProperties target properties
@@ -1579,6 +1710,7 @@
 	{ targetProperties, buildHttp, outputModule }
 ) => {
 	/**
+	 * Checks whether this object is universal.
 	 * @param {keyof TargetProperties} key a key
 	 * @returns {boolean} true when target is universal, otherwise false
 	 */
@@ -1646,6 +1778,7 @@
 };
 
 /**
+ * Apply loader defaults.
  * @param {Loader} loader options
  * @param {object} options options
  * @param {TargetProperties | false} options.targetProperties target properties
@@ -1670,6 +1803,7 @@
 };
 
 /**
+ * Apply node defaults.
  * @param {WebpackNode} node options
  * @param {object} options options
  * @param {TargetProperties | false} options.targetProperties target properties
@@ -1715,6 +1849,7 @@
 };
 
 /**
+ * Apply performance defaults.
  * @param {Performance} performance options
  * @param {object} options options
  * @param {boolean} options.production is production
@@ -1728,6 +1863,7 @@
 };
 
 /**
+ * Apply optimization defaults.
  * @param {Optimization} optimization options
  * @param {object} options options
  * @param {boolean} options.production is production
@@ -1792,7 +1928,9 @@
 	const { splitChunks } = optimization;
 	if (splitChunks) {
 		A(splitChunks, "defaultSizeTypes", () =>
-			css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"]
+			css
+				? [JAVASCRIPT_TYPE, CSS_TYPE, UNKNOWN_TYPE]
+				: [JAVASCRIPT_TYPE, UNKNOWN_TYPE]
 		);
 		D(splitChunks, "hidePathInfo", production);
 		D(splitChunks, "chunks", "async");
@@ -1823,6 +1961,7 @@
 };
 
 /**
+ * Gets resolve defaults.
  * @param {object} options options
  * @param {boolean} options.cache is cache enable
  * @param {string} options.context build context
@@ -1872,6 +2011,20 @@
 		extensions: [...jsExtensions]
 	});
 
+	/** @type {() => ResolveOptions} */
+	const workerDeps = () => {
+		const options = esmDeps();
+
+		const conditionNames = options.conditionNames
+			? ["worker", ...options.conditionNames]
+			: options.conditionNames;
+		return {
+			...options,
+			conditionNames,
+			preferRelative: true
+		};
+	};
+
 	/** @type {ResolveOptions} */
 	const resolveOptions = {
 		cache,
@@ -1891,10 +2044,7 @@
 			url: {
 				preferRelative: true
 			},
-			worker: {
-				...esmDeps(),
-				preferRelative: true
-			},
+			worker: workerDeps(),
 			commonjs: cjsDeps(),
 			amd: cjsDeps(),
 			// for backward-compat: loadModule
@@ -1907,6 +2057,7 @@
 	};
 
 	if (css) {
+		/** @type {string[]} */
 		const styleConditions = [];
 
 		styleConditions.push("webpack");
@@ -1941,6 +2092,7 @@
 };
 
 /**
+ * Gets resolve loader defaults.
  * @param {object} options options
  * @param {boolean} options.cache is cache enable
  * @returns {ResolveOptions} resolve options
@@ -1960,6 +2112,7 @@
 };
 
 /**
+ * Apply infrastructure logging defaults.
  * @param {InfrastructureLogging} infrastructureLogging options
  * @returns {void}
  */

--
Gitblit v1.9.3