@depup/webpack 5.105.4-depup.37 → 5.106.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +6 -3
  2. package/changes.json +50 -0
  3. package/lib/BannerPlugin.js +13 -13
  4. package/lib/Chunk.js +25 -0
  5. package/lib/ChunkGraph.js +8 -4
  6. package/lib/CleanPlugin.js +23 -20
  7. package/lib/CompatibilityPlugin.js +1 -1
  8. package/lib/Compilation.js +34 -11
  9. package/lib/Compiler.js +59 -1
  10. package/lib/CssModule.js +17 -2
  11. package/lib/Dependency.js +1 -1
  12. package/lib/DllPlugin.js +17 -17
  13. package/lib/DllReferencePlugin.js +20 -18
  14. package/lib/DotenvPlugin.js +29 -27
  15. package/lib/ExternalModule.js +39 -6
  16. package/lib/FileSystemInfo.js +3 -1
  17. package/lib/IgnorePlugin.js +12 -11
  18. package/lib/LoaderOptionsPlugin.js +17 -15
  19. package/lib/ManifestPlugin.js +27 -25
  20. package/lib/Module.js +69 -4
  21. package/lib/ModuleGraph.js +3 -0
  22. package/lib/ModuleParseError.js +1 -1
  23. package/lib/ModuleTypeConstants.js +1 -1
  24. package/lib/NormalModule.js +7 -3
  25. package/lib/NormalModuleFactory.js +20 -1
  26. package/lib/ProgressPlugin.js +39 -29
  27. package/lib/RuntimeGlobals.js +6 -0
  28. package/lib/RuntimeTemplate.js +1 -1
  29. package/lib/SourceMapDevToolPlugin.js +13 -11
  30. package/lib/TemplatedPathPlugin.js +4 -3
  31. package/lib/WatchIgnorePlugin.js +15 -13
  32. package/lib/WebpackOptionsApply.js +4 -4
  33. package/lib/asset/AssetModulesPlugin.js +50 -29
  34. package/lib/cli.js +3 -1
  35. package/lib/config/defaults.js +27 -13
  36. package/lib/config/normalization.js +3 -2
  37. package/lib/container/ContainerPlugin.js +46 -42
  38. package/lib/container/ContainerReferencePlugin.js +42 -26
  39. package/lib/container/FallbackModule.js +1 -1
  40. package/lib/container/ModuleFederationPlugin.js +17 -13
  41. package/lib/css/CssGenerator.js +306 -192
  42. package/lib/css/CssInjectStyleRuntimeModule.js +179 -0
  43. package/lib/css/CssLoadingRuntimeModule.js +1 -4
  44. package/lib/css/CssModulesPlugin.js +197 -98
  45. package/lib/css/CssParser.js +231 -134
  46. package/lib/css/walkCssTokens.js +115 -12
  47. package/lib/debug/ProfilingPlugin.js +16 -13
  48. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +20 -15
  49. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +4 -3
  50. package/lib/dependencies/CommonJsExportRequireDependency.js +4 -2
  51. package/lib/dependencies/CommonJsExportsDependency.js +1 -1
  52. package/lib/dependencies/CommonJsExportsParserPlugin.js +1 -1
  53. package/lib/dependencies/CommonJsFullRequireDependency.js +1 -1
  54. package/lib/dependencies/CommonJsImportsParserPlugin.js +63 -2
  55. package/lib/dependencies/CommonJsRequireContextDependency.js +21 -0
  56. package/lib/dependencies/CommonJsRequireDependency.js +42 -1
  57. package/lib/dependencies/CommonJsSelfReferenceDependency.js +1 -1
  58. package/lib/dependencies/ContextElementDependency.js +1 -1
  59. package/lib/dependencies/CssIcssExportDependency.js +210 -87
  60. package/lib/dependencies/CssIcssImportDependency.js +13 -70
  61. package/lib/dependencies/CssIcssSymbolDependency.js +19 -30
  62. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +13 -2
  63. package/lib/dependencies/HarmonyExportExpressionDependency.js +28 -2
  64. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +13 -3
  65. package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
  66. package/lib/dependencies/HarmonyImportDependency.js +21 -8
  67. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +4 -1
  68. package/lib/dependencies/HarmonyImportSideEffectDependency.js +2 -2
  69. package/lib/dependencies/HarmonyImportSpecifierDependency.js +13 -2
  70. package/lib/dependencies/ImportContextDependency.js +1 -1
  71. package/lib/dependencies/ImportDependency.js +16 -2
  72. package/lib/dependencies/ImportMetaPlugin.js +39 -29
  73. package/lib/dependencies/ImportParserPlugin.js +4 -5
  74. package/lib/dependencies/ImportPhase.js +65 -22
  75. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
  76. package/lib/esm/ModuleChunkFormatPlugin.js +1 -4
  77. package/lib/ids/HashedModuleIdsPlugin.js +21 -23
  78. package/lib/ids/OccurrenceChunkIdsPlugin.js +15 -11
  79. package/lib/ids/OccurrenceModuleIdsPlugin.js +15 -11
  80. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -4
  81. package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -4
  82. package/lib/javascript/EnableChunkLoadingPlugin.js +1 -2
  83. package/lib/javascript/JavascriptModulesPlugin.js +38 -12
  84. package/lib/javascript/JavascriptParser.js +5 -3
  85. package/lib/json/JsonModulesPlugin.js +28 -21
  86. package/lib/library/AssignLibraryPlugin.js +1 -1
  87. package/lib/library/ExportPropertyLibraryPlugin.js +1 -1
  88. package/lib/library/ModuleLibraryPlugin.js +35 -13
  89. package/lib/library/SystemLibraryPlugin.js +1 -1
  90. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +22 -0
  91. package/lib/optimize/AggressiveSplittingPlugin.js +18 -31
  92. package/lib/optimize/ConcatenatedModule.js +4 -3
  93. package/lib/optimize/InnerGraphPlugin.js +11 -5
  94. package/lib/optimize/LimitChunkCountPlugin.js +22 -18
  95. package/lib/optimize/MergeDuplicateChunksPlugin.js +15 -12
  96. package/lib/optimize/MinChunkSizePlugin.js +20 -16
  97. package/lib/optimize/RemoveEmptyChunksPlugin.js +0 -1
  98. package/lib/rules/RuleSetCompiler.js +1 -0
  99. package/lib/schemes/HttpUriPlugin.js +20 -11
  100. package/lib/schemes/VirtualUrlPlugin.js +77 -30
  101. package/lib/serialization/FileMiddleware.js +7 -7
  102. package/lib/sharing/ConsumeSharedPlugin.js +32 -25
  103. package/lib/sharing/ProvideSharedPlugin.js +29 -25
  104. package/lib/util/{propertyName.js → property.js} +26 -1
  105. package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +148 -0
  106. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +54 -0
  107. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +105 -0
  108. package/lib/wasm-async/AsyncWebAssemblyParser.js +30 -6
  109. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +26 -2
  110. package/lib/web/FetchCompileAsyncWasmPlugin.js +23 -0
  111. package/lib/web/JsonpTemplatePlugin.js +1 -0
  112. package/lib/webpack.js +34 -4
  113. package/package.json +45 -27
  114. package/schemas/WebpackOptions.check.js +1 -1
  115. package/schemas/WebpackOptions.json +82 -22
  116. package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
  117. package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
  118. package/schemas/plugins/css/CssParserOptions.check.js +1 -1
  119. package/schemas/plugins/optimize/LimitChunkCountPlugin.json +1 -1
  120. package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +1 -1
  121. package/schemas/plugins/schemes/VirtualUrlPlugin.json +8 -0
  122. package/types.d.ts +511 -114
  123. package/lib/util/create-schema-validation.js +0 -41
  124. package/lib/util/propertyAccess.js +0 -30
@@ -14,6 +14,7 @@ const Template = require("../Template");
14
14
  const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
15
15
 
16
16
  /** @typedef {import("webpack-sources").Source} Source */
17
+ /** @typedef {import("./AsyncWebAssemblyModulesPlugin").AsyncWasmModuleClass} AsyncWasmModule */
17
18
  /** @typedef {import("../Generator").GenerateContext} GenerateContext */
18
19
  /** @typedef {import("../Module")} Module */
19
20
  /** @typedef {import("../Module").SourceType} SourceType */
@@ -39,6 +40,12 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator {
39
40
  * @returns {number} estimate size of the module
40
41
  */
41
42
  getSize(module, type) {
43
+ // it's only estimated so this number is probably fine
44
+ // Example: m.exports=s.v(e,_.id,"6db474f11db19c35388a")
45
+ if (/** @type {AsyncWasmModule} */ (module).phase === "source") {
46
+ return 44;
47
+ }
48
+
42
49
  return 40 + module.dependencies.length * 10;
43
50
  }
44
51
 
@@ -55,6 +62,12 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator {
55
62
  runtimeRequirements,
56
63
  runtime
57
64
  } = generateContext;
65
+
66
+ // Check if this is a source phase import
67
+ if (/** @type {AsyncWasmModule} */ (module).phase === "source") {
68
+ return this._generateSourcePhase(module, generateContext);
69
+ }
70
+
58
71
  runtimeRequirements.add(RuntimeGlobals.module);
59
72
  runtimeRequirements.add(RuntimeGlobals.moduleId);
60
73
  runtimeRequirements.add(RuntimeGlobals.exports);
@@ -198,6 +211,47 @@ class AsyncWebAssemblyJavascriptGenerator extends Generator {
198
211
  return InitFragment.addToSource(source, initFragments, generateContext);
199
212
  }
200
213
 
214
+ /**
215
+ * Generate code for source phase import (returns WebAssembly.Module)
216
+ * @param {NormalModule} module module for which the code should be generated
217
+ * @param {GenerateContext} generateContext context for generate
218
+ * @returns {Source} generated code
219
+ */
220
+ _generateSourcePhase(module, generateContext) {
221
+ const { chunkGraph, runtimeTemplate, runtimeRequirements, runtime } =
222
+ generateContext;
223
+
224
+ runtimeRequirements.add(RuntimeGlobals.module);
225
+ runtimeRequirements.add(RuntimeGlobals.moduleId);
226
+ runtimeRequirements.add(RuntimeGlobals.exports);
227
+ runtimeRequirements.add(RuntimeGlobals.compileWasm);
228
+ runtimeRequirements.add(RuntimeGlobals.asyncModule);
229
+ runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
230
+
231
+ // Source phase: export default WebAssembly.Module (via compileWasm)
232
+ const compileCall = `${RuntimeGlobals.compileWasm}(${
233
+ module.moduleArgument
234
+ }.id, ${JSON.stringify(chunkGraph.getRenderedModuleHash(module, runtime))})`;
235
+
236
+ // Use async module wrapper to handle the Promise from compileWasm
237
+ return new RawSource(
238
+ Template.asString([
239
+ `${RuntimeGlobals.asyncModule}(${
240
+ module.moduleArgument
241
+ }, async ${runtimeTemplate.basicFunction(
242
+ "__webpack_handle_async_dependencies__, __webpack_async_result__",
243
+ [
244
+ "try {",
245
+ `var __webpack_wasm_module__ = await ${compileCall};`,
246
+ `${RuntimeGlobals.definePropertyGetters}(${module.exportsArgument}, { "default": ${runtimeTemplate.returningFunction("__webpack_wasm_module__")} });`,
247
+ "__webpack_async_result__();",
248
+ "} catch(e) { __webpack_async_result__(e); }"
249
+ ]
250
+ )}, 1);`
251
+ ])
252
+ );
253
+ }
254
+
201
255
  /**
202
256
  * @param {Error} error the error
203
257
  * @param {NormalModule} module module for which the code should be generated
@@ -10,8 +10,10 @@ const Compilation = require("../Compilation");
10
10
  const Generator = require("../Generator");
11
11
  const { tryRunOrWebpackError } = require("../HookWebpackError");
12
12
  const { WEBASSEMBLY_MODULE_TYPE_ASYNC } = require("../ModuleTypeConstants");
13
+ const NormalModule = require("../NormalModule");
13
14
  const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
14
15
  const { compareModulesByFullName } = require("../util/comparators");
16
+ const makeSerializable = require("../util/makeSerializable");
15
17
  const memoize = require("../util/memoize");
16
18
 
17
19
  /** @typedef {import("webpack-sources").Source} Source */
@@ -21,9 +23,13 @@ const memoize = require("../util/memoize");
21
23
  /** @typedef {import("../Compiler")} Compiler */
22
24
  /** @typedef {import("../DependencyTemplates")} DependencyTemplates */
23
25
  /** @typedef {import("../Module")} Module */
26
+ /** @typedef {import("../dependencies/ImportPhase").ImportPhaseName} ImportPhaseName */
27
+ /** @typedef {import("../NormalModule").NormalModuleCreateData} NormalModuleCreateData */
24
28
  /** @typedef {import("../ModuleGraph")} ModuleGraph */
25
29
  /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
26
30
  /** @typedef {import("../WebpackError")} WebpackError */
31
+ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
32
+ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
27
33
 
28
34
  const getAsyncWebAssemblyGenerator = memoize(() =>
29
35
  require("./AsyncWebAssemblyGenerator")
@@ -35,6 +41,93 @@ const getAsyncWebAssemblyParser = memoize(() =>
35
41
  require("./AsyncWebAssemblyParser")
36
42
  );
37
43
 
44
+ /** @typedef {NormalModule & { phase: ImportPhaseName | undefined }} AsyncWasmModuleClass */
45
+
46
+ class AsyncWasmModule extends NormalModule {
47
+ /**
48
+ * @param {NormalModuleCreateData & { phase: ImportPhaseName | undefined }} options options object
49
+ */
50
+ constructor(options) {
51
+ super(options);
52
+ this.phase = options.phase;
53
+ }
54
+
55
+ /**
56
+ * @returns {string} a unique identifier of the module
57
+ */
58
+ identifier() {
59
+ let str = super.identifier();
60
+
61
+ if (this.phase) {
62
+ str = `${str}|${this.phase}`;
63
+ }
64
+
65
+ return str;
66
+ }
67
+
68
+ /**
69
+ * Assuming this module is in the cache. Update the (cached) module with
70
+ * the fresh module from the factory. Usually updates internal references
71
+ * and properties.
72
+ * @param {Module} module fresh module
73
+ * @returns {void}
74
+ */
75
+ updateCacheModule(module) {
76
+ super.updateCacheModule(module);
77
+ const m = /** @type {AsyncWasmModule} */ (module);
78
+ this.phase = m.phase;
79
+ }
80
+
81
+ /**
82
+ * @param {ObjectSerializerContext} context context
83
+ */
84
+ serialize(context) {
85
+ const { write } = context;
86
+ write(this.phase);
87
+ super.serialize(context);
88
+ }
89
+
90
+ /**
91
+ * @param {ObjectDeserializerContext} context context
92
+ * @returns {AsyncWasmModule} the deserialized object
93
+ */
94
+ static deserialize(context) {
95
+ const obj = new AsyncWasmModule({
96
+ // will be deserialized by Module
97
+ layer: /** @type {EXPECTED_ANY} */ (null),
98
+ type: "",
99
+ // will be filled by updateCacheModule
100
+ resource: "",
101
+ context: "",
102
+ request: /** @type {EXPECTED_ANY} */ (null),
103
+ userRequest: /** @type {EXPECTED_ANY} */ (null),
104
+ rawRequest: /** @type {EXPECTED_ANY} */ (null),
105
+ loaders: /** @type {EXPECTED_ANY} */ (null),
106
+ matchResource: /** @type {EXPECTED_ANY} */ (null),
107
+ parser: /** @type {EXPECTED_ANY} */ (null),
108
+ parserOptions: /** @type {EXPECTED_ANY} */ (null),
109
+ generator: /** @type {EXPECTED_ANY} */ (null),
110
+ generatorOptions: /** @type {EXPECTED_ANY} */ (null),
111
+ resolveOptions: /** @type {EXPECTED_ANY} */ (null),
112
+ extractSourceMap: /** @type {EXPECTED_ANY} */ (null),
113
+ phase: /** @type {EXPECTED_ANY} */ (null)
114
+ });
115
+ obj.deserialize(context);
116
+ return obj;
117
+ }
118
+
119
+ /**
120
+ * @param {ObjectDeserializerContext} context context
121
+ */
122
+ deserialize(context) {
123
+ const { read } = context;
124
+ this.phase = read();
125
+ super.deserialize(context);
126
+ }
127
+ }
128
+
129
+ makeSerializable(AsyncWasmModule, "webpack/lib/wasm-async/AsyncWasmModule");
130
+
38
131
  /**
39
132
  * @typedef {object} WebAssemblyRenderContext
40
133
  * @property {Chunk} chunk the chunk
@@ -109,6 +202,18 @@ class AsyncWebAssemblyModulesPlugin {
109
202
  normalModuleFactory
110
203
  );
111
204
 
205
+ normalModuleFactory.hooks.createModuleClass
206
+ .for(WEBASSEMBLY_MODULE_TYPE_ASYNC)
207
+ .tap(
208
+ PLUGIN_NAME,
209
+ (createData, resolveData) =>
210
+ new AsyncWasmModule({
211
+ .../** @type {NormalModuleCreateData & { type: string }} */
212
+ (createData),
213
+ phase: resolveData.phase
214
+ })
215
+ );
216
+
112
217
  normalModuleFactory.hooks.createParser
113
218
  .for(WEBASSEMBLY_MODULE_TYPE_ASYNC)
114
219
  .tap(PLUGIN_NAME, () => {
@@ -12,11 +12,15 @@ const Parser = require("../Parser");
12
12
  const StaticExportsDependency = require("../dependencies/StaticExportsDependency");
13
13
  const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
14
14
 
15
+ /** @typedef {import("./AsyncWebAssemblyModulesPlugin").AsyncWasmModuleClass} AsyncWasmModule */
15
16
  /** @typedef {import("../Module").BuildInfo} BuildInfo */
16
17
  /** @typedef {import("../Module").BuildMeta} BuildMeta */
18
+ /** @typedef {import("../NormalModule")} NormalModule */
17
19
  /** @typedef {import("../Parser").ParserState} ParserState */
18
20
  /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */
19
21
 
22
+ const WASM_HEADER = Buffer.from([0x00, 0x61, 0x73, 0x6d]);
23
+
20
24
  const decoderOpts = {
21
25
  ignoreCodeSection: true,
22
26
  ignoreDataSection: true,
@@ -36,18 +40,38 @@ class WebAssemblyParser extends Parser {
36
40
  throw new Error("WebAssemblyParser input must be a Buffer");
37
41
  }
38
42
 
39
- // flag it as async module
40
- const buildInfo = /** @type {BuildInfo} */ (state.module.buildInfo);
41
- buildInfo.strict = true;
42
- const BuildMeta = /** @type {BuildMeta} */ (state.module.buildMeta);
43
- BuildMeta.exportsType = "namespace";
44
- BuildMeta.async = true;
43
+ const buildMeta = /** @type {BuildMeta} */ (state.module.buildMeta);
44
+ buildMeta.exportsType = "namespace";
45
+ buildMeta.async = true;
46
+
45
47
  EnvironmentNotSupportAsyncWarning.check(
46
48
  state.module,
47
49
  state.compilation.runtimeTemplate,
48
50
  "asyncWebAssembly"
49
51
  );
50
52
 
53
+ // flag it as async module
54
+ const buildInfo = /** @type {BuildInfo} */ (state.module.buildInfo);
55
+
56
+ buildInfo.strict = true;
57
+
58
+ if (/** @type {AsyncWasmModule} */ (state.module).phase === "source") {
59
+ // For source phase, only validate magic header
60
+ if (source.length < 4 || !source.subarray(0, 4).equals(WASM_HEADER)) {
61
+ throw new Error(
62
+ "Source phase imports require valid WebAssembly modules. Invalid magic header (expected \\0asm)."
63
+ );
64
+ }
65
+
66
+ // Source phase exports the WebAssembly.Module as default
67
+ state.module.addDependency(
68
+ new StaticExportsDependency(["default"], false)
69
+ );
70
+
71
+ // Skip full parsing - no exports/imports needed for source phase
72
+ return state;
73
+ }
74
+
51
75
  // parse it
52
76
  const program = decode(source, decoderOpts);
53
77
  const module = program.body[0];
@@ -8,6 +8,7 @@
8
8
  const { WEBASSEMBLY_MODULE_TYPE_ASYNC } = require("../ModuleTypeConstants");
9
9
  const RuntimeGlobals = require("../RuntimeGlobals");
10
10
  const Template = require("../Template");
11
+ const AsyncWasmCompileRuntimeModule = require("../wasm-async/AsyncWasmCompileRuntimeModule");
11
12
  const AsyncWasmLoadingRuntimeModule = require("../wasm-async/AsyncWasmLoadingRuntimeModule");
12
13
 
13
14
  /** @typedef {import("../Chunk")} Chunk */
@@ -36,7 +37,7 @@ class UniversalCompileAsyncWasmPlugin {
36
37
  : globalWasmLoading;
37
38
  return wasmLoading === "universal";
38
39
  };
39
- const generateBeforeInstantiateStreaming = () =>
40
+ const generateBeforeStreaming = () =>
40
41
  Template.asString([
41
42
  "if (!useFetch) {",
42
43
  Template.indent(["return fallback();"]),
@@ -95,7 +96,30 @@ class UniversalCompileAsyncWasmPlugin {
95
96
  new AsyncWasmLoadingRuntimeModule({
96
97
  generateBeforeLoadBinaryCode,
97
98
  generateLoadBinaryCode,
98
- generateBeforeInstantiateStreaming,
99
+ generateBeforeInstantiateStreaming: generateBeforeStreaming,
100
+ supportsStreaming: true
101
+ })
102
+ );
103
+ });
104
+
105
+ compilation.hooks.runtimeRequirementInTree
106
+ .for(RuntimeGlobals.compileWasm)
107
+ .tap(PLUGIN_NAME, (chunk, set, { chunkGraph }) => {
108
+ if (!isEnabledForChunk(chunk)) return;
109
+ if (
110
+ !chunkGraph.hasModuleInGraph(
111
+ chunk,
112
+ (m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
113
+ )
114
+ ) {
115
+ return;
116
+ }
117
+ compilation.addRuntimeModule(
118
+ chunk,
119
+ new AsyncWasmCompileRuntimeModule({
120
+ generateBeforeLoadBinaryCode,
121
+ generateLoadBinaryCode,
122
+ generateBeforeCompileStreaming: generateBeforeStreaming,
99
123
  supportsStreaming: true
100
124
  })
101
125
  );
@@ -7,6 +7,7 @@
7
7
 
8
8
  const { WEBASSEMBLY_MODULE_TYPE_ASYNC } = require("../ModuleTypeConstants");
9
9
  const RuntimeGlobals = require("../RuntimeGlobals");
10
+ const AsyncWasmCompileRuntimeModule = require("../wasm-async/AsyncWasmCompileRuntimeModule");
10
11
  const AsyncWasmLoadingRuntimeModule = require("../wasm-async/AsyncWasmLoadingRuntimeModule");
11
12
 
12
13
  /** @typedef {import("../Chunk")} Chunk */
@@ -63,6 +64,28 @@ class FetchCompileAsyncWasmPlugin {
63
64
  })
64
65
  );
65
66
  });
67
+
68
+ compilation.hooks.runtimeRequirementInTree
69
+ .for(RuntimeGlobals.compileWasm)
70
+ .tap(PLUGIN_NAME, (chunk, set, { chunkGraph }) => {
71
+ if (!isEnabledForChunk(chunk)) return;
72
+ if (
73
+ !chunkGraph.hasModuleInGraph(
74
+ chunk,
75
+ (m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
76
+ )
77
+ ) {
78
+ return;
79
+ }
80
+ set.add(RuntimeGlobals.publicPath);
81
+ compilation.addRuntimeModule(
82
+ chunk,
83
+ new AsyncWasmCompileRuntimeModule({
84
+ generateLoadBinaryCode,
85
+ supportsStreaming: true
86
+ })
87
+ );
88
+ });
66
89
  });
67
90
  }
68
91
  }
@@ -12,6 +12,7 @@ const JsonpChunkLoadingRuntimeModule = require("./JsonpChunkLoadingRuntimeModule
12
12
  /** @typedef {import("../Compilation")} Compilation */
13
13
  /** @typedef {import("../Compiler")} Compiler */
14
14
 
15
+ // TODO webpack 6 remove this class
15
16
  class JsonpTemplatePlugin {
16
17
  /**
17
18
  * @deprecated use JsonpChunkLoadingRuntimeModule.getCompilationHooks instead
package/lib/webpack.js CHANGED
@@ -105,6 +105,9 @@ const createCompiler = (rawOptions, compilerIndex) => {
105
105
  if (resolvedDefaultOptions.platform) {
106
106
  compiler.platform = resolvedDefaultOptions.platform;
107
107
  }
108
+ if (options.validate) {
109
+ compiler.hooks.validate.call();
110
+ }
108
111
  compiler.hooks.environment.call();
109
112
  compiler.hooks.afterEnvironment.call();
110
113
  new WebpackOptionsApply().process(
@@ -125,6 +128,24 @@ const createCompiler = (rawOptions, compilerIndex) => {
125
128
  const asArray = (options) =>
126
129
  Array.isArray(options) ? [...options] : [options];
127
130
 
131
+ /**
132
+ * @param {WebpackOptions | null | undefined} options options
133
+ * @returns {boolean} true when need to validate, otherwise false
134
+ */
135
+ const needValidate = (options) => {
136
+ if (
137
+ options &&
138
+ (options.validate === false ||
139
+ (options.experiments &&
140
+ options.experiments.futureDefaults === true &&
141
+ (options.mode === "production" || !options.mode)))
142
+ ) {
143
+ return false;
144
+ }
145
+
146
+ return true;
147
+ };
148
+
128
149
  /**
129
150
  * @overload
130
151
  * @param {WebpackOptions} options options object
@@ -154,12 +175,21 @@ const asArray = (options) =>
154
175
  */
155
176
  const webpack = (options, callback) => {
156
177
  const create = () => {
178
+ const isMultiCompiler = Array.isArray(options);
179
+
157
180
  if (
158
- !asArray(/** @type {WebpackOptions} */ (options)).every(
159
- webpackOptionsSchemaCheck
181
+ !asArray(/** @type {WebpackOptions} */ (options)).every((options) =>
182
+ needValidate(options) ? webpackOptionsSchemaCheck(options) : true
160
183
  )
161
184
  ) {
162
- getValidateSchema()(webpackOptionsSchema, options);
185
+ getValidateSchema()(
186
+ webpackOptionsSchema,
187
+ isMultiCompiler
188
+ ? options.map((options) => (needValidate(options) ? options : {}))
189
+ : needValidate(options)
190
+ ? options
191
+ : {}
192
+ );
163
193
  util.deprecate(
164
194
  () => {},
165
195
  "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.",
@@ -172,7 +202,7 @@ const webpack = (options, callback) => {
172
202
  let watch = false;
173
203
  /** @type {WatchOptions | WatchOptions[]} */
174
204
  let watchOptions;
175
- if (Array.isArray(options)) {
205
+ if (isMultiCompiler) {
176
206
  /** @type {MultiCompiler} */
177
207
  compiler = createMultiCompiler(
178
208
  options,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depup/webpack",
3
- "version": "5.105.4-depup.37",
4
- "description": "[DepUp] Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
3
+ "version": "5.106.0-depup.0",
4
+ "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff. (with updated dependencies)",
5
5
  "homepage": "https://github.com/webpack/webpack",
6
6
  "bugs": "https://github.com/webpack/webpack/issues",
7
7
  "repository": {
@@ -26,7 +26,9 @@
26
26
  "schemas/",
27
27
  "SECURITY.md",
28
28
  "module.d.ts",
29
- "types.d.ts"
29
+ "types.d.ts",
30
+ "changes.json",
31
+ "README.md"
30
32
  ],
31
33
  "scripts": {
32
34
  "setup": "node ./setup/setup.js",
@@ -40,6 +42,7 @@
40
42
  "lint:types-hot": "tsc -p tsconfig.hot.json",
41
43
  "lint:types-module-test": "tsc -p tsconfig.module.test.json",
42
44
  "lint:spellcheck": "cspell --cache --no-must-find-files --quiet \"**/*.*\"",
45
+ "validate:changeset": "node .changeset/changeset-validate.mjs",
43
46
  "validate:types": "tsc -p tsconfig.validation.json",
44
47
  "fmt": "yarn fmt:base --log-level warn --write",
45
48
  "fmt:check": "yarn fmt:base --check",
@@ -48,7 +51,7 @@
48
51
  "fix:code": "yarn lint:code --fix",
49
52
  "fix:special": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write",
50
53
  "build:examples": "cd examples && node buildAll.js",
51
- "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./test/BenchmarkTestCases.benchmark.mjs",
54
+ "benchmark": "node --max-old-space-size=6144 --experimental-vm-modules --trace-deprecation --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./test/BenchmarkTestCases.benchmark.mjs",
52
55
  "pretest": "yarn lint",
53
56
  "test": "yarn test:base",
54
57
  "test:base": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage",
@@ -92,9 +95,9 @@
92
95
  "@webassemblyjs/wasm-parser": "^1.14.1",
93
96
  "acorn": "^8.16.0",
94
97
  "acorn-import-phases": "^1.0.4",
95
- "browserslist": "^4.28.1",
98
+ "browserslist": "^4.28.2",
96
99
  "chrome-trace-event": "^1.0.4",
97
- "enhanced-resolve": "^5.20.0",
100
+ "enhanced-resolve": "^5.20.1",
98
101
  "es-module-lexer": "^2.0.0",
99
102
  "eslint-scope": "^9.1.2",
100
103
  "events": "^3.3.0",
@@ -105,7 +108,7 @@
105
108
  "mime-types": "^3.0.2",
106
109
  "neo-async": "^2.6.2",
107
110
  "schema-utils": "^4.3.3",
108
- "tapable": "^2.3.0",
111
+ "tapable": "^2.3.2",
109
112
  "terser-webpack-plugin": "^5.4.0",
110
113
  "watchpack": "^2.5.1",
111
114
  "webpack-sources": "^3.3.4"
@@ -114,7 +117,7 @@
114
117
  "@babel/core": "^7.27.1",
115
118
  "@babel/preset-react": "^7.27.1",
116
119
  "@changesets/cli": "^2.29.8",
117
- "@changesets/get-github-info": "^0.7.0",
120
+ "@changesets/get-github-info": "^0.8.0",
118
121
  "@codspeed/core": "^5.2.0",
119
122
  "@types/glob-to-regexp": "^0.4.4",
120
123
  "@types/graceful-fs": "^4.1.9",
@@ -123,6 +126,7 @@
123
126
  "@types/neo-async": "^2.6.7",
124
127
  "@types/node": "^25.1.0",
125
128
  "@types/xxhashjs": "^0.2.4",
129
+ "@webdiscus/pug-loader": "^2.11.1",
126
130
  "assemblyscript": "^0.28.9",
127
131
  "babel-loader": "^10.0.0",
128
132
  "bundle-loader": "^0.5.6",
@@ -143,16 +147,17 @@
143
147
  "html-loader": "^5.1.0",
144
148
  "husky": "^9.0.11",
145
149
  "istanbul": "^0.4.5",
146
- "jest": "^30.2.0",
147
- "jest-circus": "^30.2.0",
148
- "jest-cli": "^30.2.0",
149
- "jest-diff": "^30.2.0",
150
- "jest-environment-node": "^30.2.0",
150
+ "jest": "^30.3.0",
151
+ "jest-circus": "^30.3.0",
152
+ "jest-cli": "^30.3.0",
153
+ "jest-diff": "^30.3.0",
154
+ "jest-environment-node": "^30.3.0",
155
+ "jest-snapshot": "^30.3.0",
151
156
  "jest-junit": "^16.0.0",
152
157
  "json-loader": "^0.5.7",
153
158
  "json5": "^2.1.3",
154
- "less": "^4.5.1",
155
- "less-loader": "^12.2.0",
159
+ "less": "^4.6.4",
160
+ "less-loader": "^12.3.2",
156
161
  "lint-staged": "^16.2.3",
157
162
  "lodash": "^4.17.19",
158
163
  "lodash-es": "^4.17.15",
@@ -163,13 +168,12 @@
163
168
  "node-gyp": "^12.1.0",
164
169
  "nyc": "^18.0.0",
165
170
  "open-cli": "^8.0.0",
166
- "oxc-parser": "^0.115.0",
167
- "pkg-pr-new": "^0.0.63",
171
+ "oxc-parser": "^0.123.0",
172
+ "pkg-pr-new": "^0.0.66",
168
173
  "prettier": "^3.7.4",
169
174
  "prettier-2": "npm:prettier@^2",
170
175
  "pretty-format": "^30.0.5",
171
176
  "pug": "^3.0.3",
172
- "pug-loader": "^2.4.0",
173
177
  "raw-loader": "^4.0.1",
174
178
  "react": "^19.2.3",
175
179
  "react-dom": "^19.2.3",
@@ -187,15 +191,15 @@
187
191
  "terser": "^5.43.1",
188
192
  "three": "^0.183.1",
189
193
  "tinybench": "^6.0.0",
190
- "toml": "^3.0.0",
191
- "tooling": "webpack/tooling#v1.24.6",
194
+ "toml": "^4.1.1",
195
+ "tooling": "webpack/tooling#v1.25.0",
192
196
  "ts-loader": "^9.5.4",
193
197
  "typescript": "^5.9.3",
194
198
  "unified": "^11.0.5",
195
199
  "url-loader": "^4.1.0",
196
200
  "wast-loader": "^1.12.1",
197
201
  "webassembly-feature": "1.3.0",
198
- "webpack-cli": "^6.0.1",
202
+ "webpack-cli": "^7.0.2",
199
203
  "xxhashjs": "^0.2.2",
200
204
  "yamljs": "^0.3.0"
201
205
  },
@@ -209,10 +213,12 @@
209
213
  "node": ">=10.13.0"
210
214
  },
211
215
  "keywords": [
216
+ "webpack",
212
217
  "depup",
213
- "dependency-bumped",
214
- "updated-deps",
215
- "webpack"
218
+ "updated-dependencies",
219
+ "security",
220
+ "latest",
221
+ "patched"
216
222
  ],
217
223
  "depup": {
218
224
  "changes": {
@@ -224,10 +230,18 @@
224
230
  "from": "^1.0.3",
225
231
  "to": "^1.0.4"
226
232
  },
233
+ "browserslist": {
234
+ "from": "^4.28.1",
235
+ "to": "^4.28.2"
236
+ },
227
237
  "chrome-trace-event": {
228
238
  "from": "^1.0.2",
229
239
  "to": "^1.0.4"
230
240
  },
241
+ "enhanced-resolve": {
242
+ "from": "^5.20.0",
243
+ "to": "^5.20.1"
244
+ },
231
245
  "eslint-scope": {
232
246
  "from": "5.1.1",
233
247
  "to": "^9.1.2"
@@ -244,15 +258,19 @@
244
258
  "from": "^2.1.27",
245
259
  "to": "^3.0.2"
246
260
  },
261
+ "tapable": {
262
+ "from": "^2.3.0",
263
+ "to": "^2.3.2"
264
+ },
247
265
  "terser-webpack-plugin": {
248
266
  "from": "^5.3.17",
249
267
  "to": "^5.4.0"
250
268
  }
251
269
  },
252
- "depsUpdated": 8,
270
+ "depsUpdated": 11,
253
271
  "originalPackage": "webpack",
254
- "originalVersion": "5.105.4",
255
- "processedAt": "2026-03-14T21:05:40.299Z",
272
+ "originalVersion": "5.106.0",
273
+ "processedAt": "2026-04-08T16:33:01.842Z",
256
274
  "smokeTest": "passed"
257
275
  }
258
276
  }