webpack 5.96.1 → 5.97.1

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 (67) hide show
  1. package/lib/CssModule.js +5 -0
  2. package/lib/DefinePlugin.js +7 -1
  3. package/lib/DependencyTemplate.js +2 -2
  4. package/lib/EvalSourceMapDevToolPlugin.js +5 -0
  5. package/lib/FalseIIFEUmdWarning.js +19 -0
  6. package/lib/HotModuleReplacementPlugin.js +4 -0
  7. package/lib/Module.js +6 -0
  8. package/lib/ModuleSourceTypesConstants.js +12 -0
  9. package/lib/NormalModule.js +1 -0
  10. package/lib/RuntimeTemplate.js +7 -0
  11. package/lib/SourceMapDevToolPlugin.js +8 -0
  12. package/lib/WebpackOptionsApply.js +3 -1
  13. package/lib/asset/AssetModulesPlugin.js +7 -2
  14. package/lib/config/defaults.js +52 -36
  15. package/lib/config/normalization.js +0 -1
  16. package/lib/config/target.js +8 -8
  17. package/lib/css/CssGenerator.js +139 -35
  18. package/lib/css/CssLoadingRuntimeModule.js +108 -198
  19. package/lib/css/CssModulesPlugin.js +78 -124
  20. package/lib/css/CssParser.js +545 -121
  21. package/lib/css/walkCssTokens.js +41 -19
  22. package/lib/dependencies/CachedConstDependency.js +2 -1
  23. package/lib/dependencies/ContextDependencyTemplateAsId.js +3 -2
  24. package/lib/dependencies/{CssExportDependency.js → CssIcssExportDependency.js} +35 -35
  25. package/lib/dependencies/CssIcssImportDependency.js +118 -0
  26. package/lib/dependencies/CssIcssSymbolDependency.js +132 -0
  27. package/lib/dependencies/CssImportDependency.js +0 -8
  28. package/lib/dependencies/CssLocalIdentifierDependency.js +69 -73
  29. package/lib/dependencies/CssUrlDependency.js +1 -0
  30. package/lib/esm/ModuleChunkFormatPlugin.js +8 -4
  31. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +17 -10
  32. package/lib/hmr/HotModuleReplacementRuntimeModule.js +0 -1
  33. package/lib/index.js +9 -3
  34. package/lib/javascript/EnableChunkLoadingPlugin.js +2 -4
  35. package/lib/javascript/JavascriptParser.js +1 -0
  36. package/lib/library/AssignLibraryPlugin.js +1 -1
  37. package/lib/library/EnableLibraryPlugin.js +17 -0
  38. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +81 -78
  39. package/lib/node/ReadFileCompileWasmPlugin.js +76 -57
  40. package/lib/optimize/MergeDuplicateChunksPlugin.js +22 -2
  41. package/lib/sharing/ConsumeSharedPlugin.js +35 -12
  42. package/lib/sharing/utils.js +35 -4
  43. package/lib/stats/DefaultStatsFactoryPlugin.js +0 -5
  44. package/lib/util/Queue.js +1 -6
  45. package/lib/util/generateDebugId.js +33 -0
  46. package/lib/util/internalSerializables.js +6 -2
  47. package/lib/wasm/EnableWasmLoadingPlugin.js +36 -25
  48. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +26 -2
  49. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +103 -0
  50. package/lib/wasm-sync/WebAssemblyParser.js +1 -1
  51. package/lib/web/FetchCompileAsyncWasmPlugin.js +43 -44
  52. package/lib/web/FetchCompileWasmPlugin.js +4 -4
  53. package/package.json +4 -4
  54. package/schemas/WebpackOptions.check.js +1 -1
  55. package/schemas/WebpackOptions.json +34 -12
  56. package/schemas/plugins/BannerPlugin.json +1 -1
  57. package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
  58. package/schemas/plugins/SourceMapDevToolPlugin.json +4 -0
  59. package/schemas/plugins/css/CssAutoParserOptions.check.js +1 -1
  60. package/schemas/plugins/css/CssGlobalParserOptions.check.js +1 -1
  61. package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
  62. package/schemas/plugins/css/CssParserOptions.check.js +1 -1
  63. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.d.ts +7 -0
  64. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.js +6 -0
  65. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.json +11 -0
  66. package/types.d.ts +94 -27
  67. package/lib/css/CssExportsGenerator.js +0 -207
@@ -12,6 +12,8 @@ const AsyncWasmLoadingRuntimeModule = require("../wasm-async/AsyncWasmLoadingRun
12
12
  /** @typedef {import("../Chunk")} Chunk */
13
13
  /** @typedef {import("../Compiler")} Compiler */
14
14
 
15
+ const PLUGIN_NAME = "FetchCompileAsyncWasmPlugin";
16
+
15
17
  class FetchCompileAsyncWasmPlugin {
16
18
  /**
17
19
  * Apply the plugin
@@ -19,52 +21,49 @@ class FetchCompileAsyncWasmPlugin {
19
21
  * @returns {void}
20
22
  */
21
23
  apply(compiler) {
22
- compiler.hooks.thisCompilation.tap(
23
- "FetchCompileAsyncWasmPlugin",
24
- compilation => {
25
- const globalWasmLoading = compilation.outputOptions.wasmLoading;
26
- /**
27
- * @param {Chunk} chunk chunk
28
- * @returns {boolean} true, if wasm loading is enabled for the chunk
29
- */
30
- const isEnabledForChunk = chunk => {
31
- const options = chunk.getEntryOptions();
32
- const wasmLoading =
33
- options && options.wasmLoading !== undefined
34
- ? options.wasmLoading
35
- : globalWasmLoading;
36
- return wasmLoading === "fetch";
37
- };
38
- /**
39
- * @param {string} path path to the wasm file
40
- * @returns {string} code to load the wasm file
41
- */
42
- const generateLoadBinaryCode = path =>
43
- `fetch(${RuntimeGlobals.publicPath} + ${path})`;
24
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
25
+ const globalWasmLoading = compilation.outputOptions.wasmLoading;
26
+ /**
27
+ * @param {Chunk} chunk chunk
28
+ * @returns {boolean} true, if wasm loading is enabled for the chunk
29
+ */
30
+ const isEnabledForChunk = chunk => {
31
+ const options = chunk.getEntryOptions();
32
+ const wasmLoading =
33
+ options && options.wasmLoading !== undefined
34
+ ? options.wasmLoading
35
+ : globalWasmLoading;
36
+ return wasmLoading === "fetch";
37
+ };
38
+ /**
39
+ * @param {string} path path to the wasm file
40
+ * @returns {string} code to load the wasm file
41
+ */
42
+ const generateLoadBinaryCode = path =>
43
+ `fetch(${RuntimeGlobals.publicPath} + ${path})`;
44
44
 
45
- compilation.hooks.runtimeRequirementInTree
46
- .for(RuntimeGlobals.instantiateWasm)
47
- .tap("FetchCompileAsyncWasmPlugin", (chunk, set, { chunkGraph }) => {
48
- if (!isEnabledForChunk(chunk)) return;
49
- if (
50
- !chunkGraph.hasModuleInGraph(
51
- chunk,
52
- m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
53
- )
54
- ) {
55
- return;
56
- }
57
- set.add(RuntimeGlobals.publicPath);
58
- compilation.addRuntimeModule(
45
+ compilation.hooks.runtimeRequirementInTree
46
+ .for(RuntimeGlobals.instantiateWasm)
47
+ .tap(PLUGIN_NAME, (chunk, set, { chunkGraph }) => {
48
+ if (!isEnabledForChunk(chunk)) return;
49
+ if (
50
+ !chunkGraph.hasModuleInGraph(
59
51
  chunk,
60
- new AsyncWasmLoadingRuntimeModule({
61
- generateLoadBinaryCode,
62
- supportsStreaming: true
63
- })
64
- );
65
- });
66
- }
67
- );
52
+ m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
53
+ )
54
+ ) {
55
+ return;
56
+ }
57
+ set.add(RuntimeGlobals.publicPath);
58
+ compilation.addRuntimeModule(
59
+ chunk,
60
+ new AsyncWasmLoadingRuntimeModule({
61
+ generateLoadBinaryCode,
62
+ supportsStreaming: true
63
+ })
64
+ );
65
+ });
66
+ });
68
67
  }
69
68
  }
70
69
 
@@ -12,15 +12,15 @@ const WasmChunkLoadingRuntimeModule = require("../wasm-sync/WasmChunkLoadingRunt
12
12
  /** @typedef {import("../Chunk")} Chunk */
13
13
  /** @typedef {import("../Compiler")} Compiler */
14
14
 
15
- // TODO webpack 6 remove
16
-
17
- const PLUGIN_NAME = "FetchCompileWasmPlugin";
18
-
19
15
  /**
20
16
  * @typedef {object} FetchCompileWasmPluginOptions
21
17
  * @property {boolean} [mangleImports] mangle imports
22
18
  */
23
19
 
20
+ // TODO webpack 6 remove
21
+
22
+ const PLUGIN_NAME = "FetchCompileWasmPlugin";
23
+
24
24
  class FetchCompileWasmPlugin {
25
25
  /**
26
26
  * @param {FetchCompileWasmPluginOptions} [options] options
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.96.1",
3
+ "version": "5.97.1",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "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.",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "@types/eslint-scope": "^3.7.7",
9
9
  "@types/estree": "^1.0.6",
10
- "@webassemblyjs/ast": "^1.12.1",
11
- "@webassemblyjs/wasm-edit": "^1.12.1",
12
- "@webassemblyjs/wasm-parser": "^1.12.1",
10
+ "@webassemblyjs/ast": "^1.14.1",
11
+ "@webassemblyjs/wasm-edit": "^1.14.1",
12
+ "@webassemblyjs/wasm-parser": "^1.14.1",
13
13
  "acorn": "^8.14.0",
14
14
  "browserslist": "^4.24.0",
15
15
  "chrome-trace-event": "^1.0.2",