webpack 5.77.0 → 5.79.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.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

Files changed (82) hide show
  1. package/bin/webpack.js +0 -0
  2. package/lib/APIPlugin.js +25 -18
  3. package/lib/CompatibilityPlugin.js +80 -62
  4. package/lib/Compiler.js +7 -4
  5. package/lib/ConstPlugin.js +22 -15
  6. package/lib/ContextModule.js +3 -2
  7. package/lib/DefinePlugin.js +62 -42
  8. package/lib/DelegatedModule.js +2 -1
  9. package/lib/DllModule.js +2 -1
  10. package/lib/ErrorHelpers.js +61 -22
  11. package/lib/ExportsInfoApiPlugin.js +16 -9
  12. package/lib/ExternalModule.js +2 -1
  13. package/lib/FlagAllModulesAsUsedPlugin.js +22 -27
  14. package/lib/FlagDependencyExportsPlugin.js +336 -348
  15. package/lib/FlagDependencyUsagePlugin.js +6 -8
  16. package/lib/FlagEntryExportAsUsedPlugin.js +22 -23
  17. package/lib/HotModuleReplacementPlugin.js +50 -45
  18. package/lib/JavascriptMetaInfoPlugin.js +16 -9
  19. package/lib/LibManifestPlugin.js +2 -1
  20. package/lib/ModuleTypeConstants.js +50 -0
  21. package/lib/NodeStuffPlugin.js +35 -31
  22. package/lib/NormalModule.js +2 -1
  23. package/lib/NormalModuleFactory.js +7 -1
  24. package/lib/NormalModuleReplacementPlugin.js +1 -1
  25. package/lib/ProvidePlugin.js +17 -10
  26. package/lib/RawModule.js +2 -1
  27. package/lib/RequireJsStuffPlugin.js +15 -15
  28. package/lib/UseStrictPlugin.js +15 -8
  29. package/lib/WebpackIsIncludedPlugin.js +16 -9
  30. package/lib/config/defaults.js +16 -8
  31. package/lib/config/normalization.js +4 -0
  32. package/lib/container/ContainerEntryModule.js +2 -1
  33. package/lib/css/CssLoadingRuntimeModule.js +1 -1
  34. package/lib/css/CssParser.js +28 -8
  35. package/lib/css/walkCssTokens.js +6 -1
  36. package/lib/debug/ProfilingPlugin.js +20 -12
  37. package/lib/dependencies/AMDPlugin.js +26 -20
  38. package/lib/dependencies/CommonJsImportsParserPlugin.js +5 -4
  39. package/lib/dependencies/CommonJsPlugin.js +29 -25
  40. package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -1
  41. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +4 -0
  42. package/lib/dependencies/HarmonyImportSpecifierDependency.js +28 -3
  43. package/lib/dependencies/HarmonyModulesPlugin.js +11 -5
  44. package/lib/dependencies/ImportMetaContextPlugin.js +11 -5
  45. package/lib/dependencies/ImportMetaPlugin.js +26 -20
  46. package/lib/dependencies/ImportPlugin.js +14 -7
  47. package/lib/dependencies/RequireContextPlugin.js +12 -6
  48. package/lib/dependencies/RequireEnsurePlugin.js +13 -7
  49. package/lib/dependencies/RequireIncludePlugin.js +11 -5
  50. package/lib/dependencies/SystemPlugin.js +21 -15
  51. package/lib/dependencies/URLPlugin.js +15 -9
  52. package/lib/dependencies/WorkerPlugin.js +14 -8
  53. package/lib/index.js +5 -0
  54. package/lib/javascript/JavascriptModulesPlugin.js +157 -164
  55. package/lib/javascript/JavascriptParser.js +88 -0
  56. package/lib/json/JsonModulesPlugin.js +13 -5
  57. package/lib/library/AmdLibraryPlugin.js +22 -6
  58. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +2 -1
  59. package/lib/node/ReadFileCompileWasmPlugin.js +2 -1
  60. package/lib/optimize/ConcatenatedModule.js +2 -1
  61. package/lib/optimize/InnerGraphPlugin.js +47 -46
  62. package/lib/optimize/SideEffectsFlagPlugin.js +43 -43
  63. package/lib/sharing/ConsumeSharedPlugin.js +4 -0
  64. package/lib/stats/DefaultStatsPrinterPlugin.js +14 -0
  65. package/lib/util/hash/md4.js +2 -2
  66. package/lib/util/hash/xxhash64.js +1 -1
  67. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +9 -6
  68. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +42 -43
  69. package/lib/web/FetchCompileAsyncWasmPlugin.js +2 -1
  70. package/lib/web/FetchCompileWasmPlugin.js +40 -40
  71. package/lib/webpack.js +1 -1
  72. package/package.json +41 -36
  73. package/schemas/WebpackOptions.check.js +1 -1
  74. package/schemas/WebpackOptions.json +18 -0
  75. package/schemas/plugins/ProgressPlugin.check.js +1 -1
  76. package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
  77. package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
  78. package/schemas/plugins/container/ContainerPlugin.json +8 -0
  79. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  80. package/schemas/plugins/container/ModuleFederationPlugin.json +8 -0
  81. package/schemas/plugins/sharing/SharePlugin.check.js +1 -1
  82. package/types.d.ts +152 -122
@@ -5,6 +5,7 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ const { WEBASSEMBLY_MODULE_TYPE_SYNC } = require("../ModuleTypeConstants");
8
9
  const RuntimeGlobals = require("../RuntimeGlobals");
9
10
  const WasmChunkLoadingRuntimeModule = require("../wasm-sync/WasmChunkLoadingRuntimeModule");
10
11
 
@@ -12,6 +13,8 @@ const WasmChunkLoadingRuntimeModule = require("../wasm-sync/WasmChunkLoadingRunt
12
13
 
13
14
  // TODO webpack 6 remove
14
15
 
16
+ const PLUGIN_NAME = "FetchCompileWasmPlugin";
17
+
15
18
  class FetchCompileWasmPlugin {
16
19
  constructor(options) {
17
20
  this.options = options || {};
@@ -23,48 +26,45 @@ class FetchCompileWasmPlugin {
23
26
  * @returns {void}
24
27
  */
25
28
  apply(compiler) {
26
- compiler.hooks.thisCompilation.tap(
27
- "FetchCompileWasmPlugin",
28
- compilation => {
29
- const globalWasmLoading = compilation.outputOptions.wasmLoading;
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
- const generateLoadBinaryCode = path =>
39
- `fetch(${RuntimeGlobals.publicPath} + ${path})`;
29
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
30
+ const globalWasmLoading = compilation.outputOptions.wasmLoading;
31
+ const isEnabledForChunk = chunk => {
32
+ const options = chunk.getEntryOptions();
33
+ const wasmLoading =
34
+ options && options.wasmLoading !== undefined
35
+ ? options.wasmLoading
36
+ : globalWasmLoading;
37
+ return wasmLoading === "fetch";
38
+ };
39
+ const generateLoadBinaryCode = path =>
40
+ `fetch(${RuntimeGlobals.publicPath} + ${path})`;
40
41
 
41
- compilation.hooks.runtimeRequirementInTree
42
- .for(RuntimeGlobals.ensureChunkHandlers)
43
- .tap("FetchCompileWasmPlugin", (chunk, set) => {
44
- if (!isEnabledForChunk(chunk)) return;
45
- const chunkGraph = compilation.chunkGraph;
46
- if (
47
- !chunkGraph.hasModuleInGraph(
48
- chunk,
49
- m => m.type === "webassembly/sync"
50
- )
51
- ) {
52
- return;
53
- }
54
- set.add(RuntimeGlobals.moduleCache);
55
- set.add(RuntimeGlobals.publicPath);
56
- compilation.addRuntimeModule(
42
+ compilation.hooks.runtimeRequirementInTree
43
+ .for(RuntimeGlobals.ensureChunkHandlers)
44
+ .tap(PLUGIN_NAME, (chunk, set) => {
45
+ if (!isEnabledForChunk(chunk)) return;
46
+ const chunkGraph = compilation.chunkGraph;
47
+ if (
48
+ !chunkGraph.hasModuleInGraph(
57
49
  chunk,
58
- new WasmChunkLoadingRuntimeModule({
59
- generateLoadBinaryCode,
60
- supportsStreaming: true,
61
- mangleImports: this.options.mangleImports,
62
- runtimeRequirements: set
63
- })
64
- );
65
- });
66
- }
67
- );
50
+ m => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC
51
+ )
52
+ ) {
53
+ return;
54
+ }
55
+ set.add(RuntimeGlobals.moduleCache);
56
+ set.add(RuntimeGlobals.publicPath);
57
+ compilation.addRuntimeModule(
58
+ chunk,
59
+ new WasmChunkLoadingRuntimeModule({
60
+ generateLoadBinaryCode,
61
+ supportsStreaming: true,
62
+ mangleImports: this.options.mangleImports,
63
+ runtimeRequirements: set
64
+ })
65
+ );
66
+ });
67
+ });
68
68
  }
69
69
  }
70
70
 
package/lib/webpack.js CHANGED
@@ -103,7 +103,7 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
103
103
  /**
104
104
  * @param {WebpackOptions | (ReadonlyArray<WebpackOptions> & MultiCompilerOptions)} options options
105
105
  * @param {Callback<Stats> & Callback<MultiStats>=} callback callback
106
- * @returns {Compiler | MultiCompiler}
106
+ * @returns {Compiler | MultiCompiler} Compiler or MultiCompiler
107
107
  */
108
108
  (options, callback) => {
109
109
  const create = () => {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.77.0",
3
+ "version": "5.79.0",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support 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.3",
9
- "@types/estree": "^0.0.51",
9
+ "@types/estree": "^1.0.0",
10
10
  "@webassemblyjs/ast": "1.11.1",
11
11
  "@webassemblyjs/wasm-edit": "1.11.1",
12
12
  "@webassemblyjs/wasm-parser": "1.11.1",
@@ -15,7 +15,7 @@
15
15
  "browserslist": "^4.14.5",
16
16
  "chrome-trace-event": "^1.0.2",
17
17
  "enhanced-resolve": "^5.10.0",
18
- "es-module-lexer": "^0.9.0",
18
+ "es-module-lexer": "^1.2.1",
19
19
  "eslint-scope": "5.1.1",
20
20
  "events": "^3.2.0",
21
21
  "glob-to-regexp": "^0.4.1",
@@ -26,7 +26,7 @@
26
26
  "neo-async": "^2.6.2",
27
27
  "schema-utils": "^3.1.0",
28
28
  "tapable": "^2.1.1",
29
- "terser-webpack-plugin": "^5.1.3",
29
+ "terser-webpack-plugin": "^5.3.7",
30
30
  "watchpack": "^2.4.0",
31
31
  "webpack-sources": "^3.2.3"
32
32
  },
@@ -36,12 +36,12 @@
36
36
  }
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "^7.11.1",
40
- "@babel/preset-react": "^7.10.4",
39
+ "@babel/core": "^7.21.4",
40
+ "@babel/preset-react": "^7.18.6",
41
41
  "@types/es-module-lexer": "^0.4.1",
42
- "@types/jest": "^27.4.0",
43
- "@types/node": "^17.0.16",
44
- "assemblyscript": "^0.19.16",
42
+ "@types/jest": "^29.5.0",
43
+ "@types/node": "^18.15.11",
44
+ "assemblyscript": "^0.25.2",
45
45
  "babel-loader": "^8.1.0",
46
46
  "benchmark": "^2.1.4",
47
47
  "bundle-loader": "^0.5.6",
@@ -49,65 +49,66 @@
49
49
  "coffeescript": "^2.5.1",
50
50
  "core-js": "^3.6.5",
51
51
  "coveralls": "^3.1.0",
52
- "cspell": "^4.0.63",
52
+ "cspell": "^6.31.1",
53
53
  "css-loader": "^5.0.1",
54
54
  "date-fns": "^2.15.0",
55
55
  "es5-ext": "^0.10.53",
56
56
  "es6-promise-polyfill": "^1.2.0",
57
- "eslint": "^7.14.0",
57
+ "eslint": "^8.38.0",
58
58
  "eslint-config-prettier": "^8.1.0",
59
- "eslint-plugin-jest": "^24.7.0",
60
- "eslint-plugin-jsdoc": "^33.0.0",
59
+ "eslint-plugin-jest": "^27.2.1",
60
+ "eslint-plugin-jsdoc": "^41.1.1",
61
61
  "eslint-plugin-node": "^11.0.0",
62
- "eslint-plugin-prettier": "^4.0.0",
62
+ "eslint-plugin-prettier": "^4.2.1",
63
63
  "file-loader": "^6.0.0",
64
- "fork-ts-checker-webpack-plugin": "^6.0.5",
64
+ "fork-ts-checker-webpack-plugin": "^8.0.0",
65
65
  "hash-wasm": "^4.9.0",
66
- "husky": "^6.0.0",
66
+ "husky": "^8.0.3",
67
67
  "is-ci": "^3.0.0",
68
68
  "istanbul": "^0.4.5",
69
- "jest": "^27.5.0",
70
- "jest-circus": "^27.5.0",
71
- "jest-cli": "^27.5.0",
72
- "jest-diff": "^27.5.0",
73
- "jest-junit": "^13.0.0",
69
+ "jest": "^29.5.0",
70
+ "jest-circus": "^29.5.0",
71
+ "jest-cli": "^29.5.0",
72
+ "jest-diff": "^29.5.0",
73
+ "jest-environment-node": "^29.5.0",
74
+ "jest-junit": "^15.0.0",
74
75
  "json-loader": "^0.5.7",
75
76
  "json5": "^2.1.3",
76
77
  "less": "^4.0.0",
77
78
  "less-loader": "^8.0.0",
78
- "lint-staged": "^11.0.0",
79
+ "lint-staged": "^13.2.1",
79
80
  "loader-utils": "^2.0.3",
80
81
  "lodash": "^4.17.19",
81
82
  "lodash-es": "^4.17.15",
82
- "memfs": "^3.2.0",
83
+ "memfs": "^3.5.0",
83
84
  "mini-css-extract-plugin": "^1.6.1",
84
85
  "mini-svg-data-uri": "^1.2.3",
85
86
  "nyc": "^15.1.0",
86
- "open-cli": "^6.0.1",
87
+ "open-cli": "^7.2.0",
87
88
  "prettier": "^2.7.1",
88
- "pretty-format": "^27.0.2",
89
+ "pretty-format": "^29.5.0",
89
90
  "pug": "^3.0.0",
90
91
  "pug-loader": "^2.4.0",
91
92
  "raw-loader": "^4.0.1",
92
- "react": "^17.0.1",
93
- "react-dom": "^17.0.1",
93
+ "react": "^18.2.0",
94
+ "react-dom": "^18.2.0",
94
95
  "rimraf": "^3.0.2",
95
96
  "script-loader": "^0.7.2",
96
- "simple-git": "^2.17.0",
97
+ "simple-git": "^3.17.0",
97
98
  "strip-ansi": "^6.0.0",
98
99
  "style-loader": "^2.0.0",
99
- "terser": "^5.7.0",
100
+ "terser": "^5.16.9",
100
101
  "toml": "^3.0.0",
101
- "tooling": "webpack/tooling#v1.22.0",
102
- "ts-loader": "^8.0.2",
102
+ "tooling": "webpack/tooling#v1.22.1",
103
+ "ts-loader": "^9.4.2",
103
104
  "typescript": "^4.8.4",
104
105
  "url-loader": "^4.1.0",
105
106
  "wast-loader": "^1.11.0",
106
107
  "webassembly-feature": "1.3.0",
107
- "webpack-cli": "^4.3.0",
108
+ "webpack-cli": "^5.0.1",
108
109
  "xxhashjs": "^0.2.2",
109
110
  "yamljs": "^0.3.0",
110
- "yarn-deduplicate": "^3.1.0"
111
+ "yarn-deduplicate": "^6.0.1"
111
112
  },
112
113
  "engines": {
113
114
  "node": ">=10.13.0"
@@ -153,7 +154,7 @@
153
154
  "type-lint": "tsc",
154
155
  "typings-test": "tsc -p tsconfig.types.test.json",
155
156
  "module-typings-test": "tsc -p tsconfig.module.test.json",
156
- "spellcheck": "cspell \"**/*\"",
157
+ "spellcheck": "cspell --no-progress \"**\"",
157
158
  "special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals",
158
159
  "special-lint-fix": "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/format-file-header --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",
159
160
  "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
@@ -235,9 +236,13 @@
235
236
  "<rootDir>/schemas",
236
237
  "<rootDir>/node_modules"
237
238
  ],
238
- "testEnvironment": "node",
239
+ "testEnvironment": "./test/patch-node-env.js",
239
240
  "coverageReporters": [
240
241
  "json"
241
- ]
242
+ ],
243
+ "snapshotFormat": {
244
+ "escapeString": true,
245
+ "printBasicPrototype": true
246
+ }
242
247
  }
243
248
  }