webpack 5.53.0 → 5.54.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 (51) hide show
  1. package/lib/AsyncDependenciesBlock.js +9 -2
  2. package/lib/CacheFacade.js +10 -3
  3. package/lib/ChunkGraph.js +19 -8
  4. package/lib/CodeGenerationResults.js +7 -2
  5. package/lib/Compilation.js +207 -16
  6. package/lib/Compiler.js +9 -1
  7. package/lib/DependencyTemplates.js +8 -2
  8. package/lib/EvalDevToolModulePlugin.js +2 -1
  9. package/lib/EvalSourceMapDevToolPlugin.js +2 -1
  10. package/lib/ExternalModule.js +18 -9
  11. package/lib/FileSystemInfo.js +101 -170
  12. package/lib/FlagDependencyExportsPlugin.js +43 -16
  13. package/lib/JavascriptMetaInfoPlugin.js +6 -1
  14. package/lib/MemCache.js +45 -0
  15. package/lib/ModuleFilenameHelpers.js +21 -7
  16. package/lib/SourceMapDevToolPlugin.js +7 -3
  17. package/lib/WebpackOptionsApply.js +19 -1
  18. package/lib/cache/PackFileCacheStrategy.js +2 -1
  19. package/lib/cache/getLazyHashedEtag.js +35 -8
  20. package/lib/config/defaults.js +18 -7
  21. package/lib/dependencies/CachedConstDependency.js +4 -3
  22. package/lib/dependencies/ConstDependency.js +12 -4
  23. package/lib/dependencies/JsonExportsDependency.js +7 -1
  24. package/lib/dependencies/ModuleDecoratorDependency.js +5 -2
  25. package/lib/dependencies/ProvidedDependency.js +6 -2
  26. package/lib/dependencies/PureExpressionDependency.js +5 -1
  27. package/lib/dependencies/RuntimeRequirementsDependency.js +5 -1
  28. package/lib/ids/IdHelpers.js +21 -8
  29. package/lib/ids/NamedChunkIdsPlugin.js +3 -0
  30. package/lib/ids/NamedModuleIdsPlugin.js +3 -1
  31. package/lib/index.js +6 -0
  32. package/lib/javascript/BasicEvaluatedExpression.js +3 -0
  33. package/lib/javascript/JavascriptParser.js +22 -4
  34. package/lib/javascript/JavascriptParserHelpers.js +0 -2
  35. package/lib/optimize/ConcatenatedModule.js +25 -4
  36. package/lib/optimize/InnerGraph.js +22 -2
  37. package/lib/optimize/ModuleConcatenationPlugin.js +2 -1
  38. package/lib/schemes/HttpUriPlugin.js +1 -2
  39. package/lib/serialization/BinaryMiddleware.js +11 -2
  40. package/lib/serialization/FileMiddleware.js +24 -7
  41. package/lib/serialization/ObjectMiddleware.js +19 -8
  42. package/lib/util/createHash.js +10 -0
  43. package/lib/util/hash/BatchedHash.js +65 -0
  44. package/lib/util/hash/xxhash64.js +154 -0
  45. package/lib/util/serialization.js +4 -4
  46. package/package.json +10 -6
  47. package/schemas/WebpackOptions.check.js +1 -1
  48. package/schemas/WebpackOptions.json +12 -0
  49. package/schemas/plugins/HashedModuleIdsPlugin.check.js +1 -1
  50. package/schemas/plugins/HashedModuleIdsPlugin.json +20 -2
  51. package/types.d.ts +157 -10
@@ -0,0 +1,154 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+
6
+ "use strict";
7
+
8
+ //#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1
9
+ const xxhash64 = new WebAssembly.Module(
10
+ Buffer.from(
11
+ // 1180 bytes
12
+ "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrwIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vm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kLwgcCHgJ6A+ACDQgSIhCICQoaMmLDgwIGDBnxCBIhCgYKEiJCgwIABg0InfiACQrDgwIGDhoyYMIR8NwMACw==",
13
+ "base64"
14
+ )
15
+ );
16
+ //#endregion
17
+
18
+ class XxHash64 {
19
+ /**
20
+ * @param {WebAssembly.Instance} instance wasm instance
21
+ */
22
+ constructor(instance) {
23
+ const exports = /** @type {any} */ (instance.exports);
24
+ exports.init();
25
+ this.exports = exports;
26
+ this.mem = Buffer.from(exports.memory.buffer, 0, 65536);
27
+ this.buffered = 0;
28
+ }
29
+
30
+ reset() {
31
+ this.buffered = 0;
32
+ this.exports.init();
33
+ }
34
+
35
+ /**
36
+ * @param {Buffer | string} data data
37
+ * @param {BufferEncoding=} encoding encoding
38
+ * @returns {this} itself
39
+ */
40
+ update(data, encoding) {
41
+ if (typeof data === "string") {
42
+ if (data.length < 21845) {
43
+ this._updateWithShortString(data, encoding);
44
+ return this;
45
+ } else {
46
+ data = Buffer.from(data, encoding);
47
+ }
48
+ }
49
+ this._updateWithBuffer(data);
50
+ return this;
51
+ }
52
+
53
+ /**
54
+ * @param {string} data data
55
+ * @param {BufferEncoding=} encoding encoding
56
+ * @returns {void}
57
+ */
58
+ _updateWithShortString(data, encoding) {
59
+ const { exports, buffered, mem } = this;
60
+ let endPos;
61
+ if (data.length < 70) {
62
+ if (!encoding || encoding === "utf-8" || encoding === "utf8") {
63
+ endPos = buffered;
64
+ for (let i = 0; i < data.length; i++) {
65
+ const cc = data.charCodeAt(i);
66
+ if (cc < 0x80) mem[endPos++] = cc;
67
+ else if (cc < 0x800) {
68
+ mem[endPos] = (cc >> 6) | 0xc0;
69
+ mem[endPos + 1] = (cc & 0x3f) | 0x80;
70
+ endPos += 2;
71
+ } else {
72
+ // bail-out for weird chars
73
+ endPos += mem.write(data.slice(endPos), endPos, encoding);
74
+ break;
75
+ }
76
+ }
77
+ } else if (encoding === "latin1") {
78
+ endPos = buffered;
79
+ for (let i = 0; i < data.length; i++) {
80
+ const cc = data.charCodeAt(i);
81
+ mem[endPos++] = cc;
82
+ }
83
+ } else {
84
+ endPos = buffered + mem.write(data, buffered, encoding);
85
+ }
86
+ } else {
87
+ endPos = buffered + mem.write(data, buffered, encoding);
88
+ }
89
+ if (endPos < 32) {
90
+ this.buffered = endPos;
91
+ } else {
92
+ const l = (endPos >> 5) << 5;
93
+ exports.update(l);
94
+ const newBuffered = endPos - l;
95
+ this.buffered = newBuffered;
96
+ if (newBuffered > 0) mem.copyWithin(0, l, endPos);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * @param {Buffer} data data
102
+ * @returns {void}
103
+ */
104
+ _updateWithBuffer(data) {
105
+ const { exports, buffered, mem } = this;
106
+ const length = data.length;
107
+ if (buffered + length < 32) {
108
+ data.copy(mem, buffered, 0, length);
109
+ this.buffered += length;
110
+ } else {
111
+ const l = ((buffered + length) >> 5) << 5;
112
+ if (l > 65536) {
113
+ let i = 65536 - buffered;
114
+ data.copy(mem, buffered, 0, i);
115
+ exports.update(65536);
116
+ const stop = l - buffered - 65536;
117
+ while (i < stop) {
118
+ data.copy(mem, 0, i, i + 65536);
119
+ exports.update(65536);
120
+ i += 65536;
121
+ }
122
+ data.copy(mem, 0, i, l - buffered);
123
+ exports.update(l - buffered - i);
124
+ } else {
125
+ data.copy(mem, buffered, 0, l - buffered);
126
+ exports.update(l);
127
+ }
128
+ const newBuffered = length + buffered - l;
129
+ this.buffered = newBuffered;
130
+ if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length);
131
+ }
132
+ }
133
+
134
+ digest(type) {
135
+ const { exports, buffered, mem } = this;
136
+ exports.final(buffered);
137
+ instancesPool.push(this);
138
+ return mem.toString("latin1", 0, 16);
139
+ }
140
+ }
141
+
142
+ const instancesPool = [];
143
+
144
+ const create = () => {
145
+ if (instancesPool.length > 0) {
146
+ const old = instancesPool.pop();
147
+ old.reset();
148
+ return old;
149
+ } else {
150
+ return new XxHash64(new WebAssembly.Instance(xxhash64));
151
+ }
152
+ };
153
+
154
+ module.exports = create;
@@ -89,15 +89,15 @@ module.exports = {
89
89
  );
90
90
  };
91
91
  }
92
- }),
92
+ }, "md4"),
93
93
  binaryMiddleware
94
94
  ]));
95
95
  },
96
- createFileSerializer: fs => {
96
+ createFileSerializer: (fs, hashFunction) => {
97
97
  registerSerializers();
98
98
  const Serializer = getSerializer();
99
99
  const FileMiddleware = require("../serialization/FileMiddleware");
100
- const fileMiddleware = new FileMiddleware(fs);
100
+ const fileMiddleware = new FileMiddleware(fs, hashFunction);
101
101
  const binaryMiddleware = getBinaryMiddlewareInstance();
102
102
  const SerializerMiddleware = getSerializerMiddleware();
103
103
  const SingleItemMiddleware = getSingleItemMiddleware();
@@ -120,7 +120,7 @@ module.exports = {
120
120
  return lazy;
121
121
  };
122
122
  }
123
- }),
123
+ }, hashFunction),
124
124
  binaryMiddleware,
125
125
  fileMiddleware
126
126
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.53.0",
3
+ "version": "5.54.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",
@@ -14,8 +14,8 @@
14
14
  "acorn-import-assertions": "^1.7.6",
15
15
  "browserslist": "^4.14.5",
16
16
  "chrome-trace-event": "^1.0.2",
17
- "enhanced-resolve": "^5.8.0",
18
- "es-module-lexer": "^0.7.1",
17
+ "enhanced-resolve": "^5.8.3",
18
+ "es-module-lexer": "^0.9.0",
19
19
  "eslint-scope": "5.1.1",
20
20
  "events": "^3.2.0",
21
21
  "glob-to-regexp": "^0.4.1",
@@ -41,6 +41,7 @@
41
41
  "@types/es-module-lexer": "^0.4.1",
42
42
  "@types/jest": "^27.0.1",
43
43
  "@types/node": "^15.0.1",
44
+ "assemblyscript": "^0.19.16",
44
45
  "babel-loader": "^8.1.0",
45
46
  "benchmark": "^2.1.4",
46
47
  "bundle-loader": "^0.5.6",
@@ -61,6 +62,7 @@
61
62
  "eslint-plugin-prettier": "^4.0.0",
62
63
  "file-loader": "^6.0.0",
63
64
  "fork-ts-checker-webpack-plugin": "^6.0.5",
65
+ "hash-wasm": "^4.9.0",
64
66
  "husky": "^6.0.0",
65
67
  "is-ci": "^3.0.0",
66
68
  "istanbul": "^0.4.5",
@@ -96,7 +98,7 @@
96
98
  "style-loader": "^2.0.0",
97
99
  "terser": "^5.7.0",
98
100
  "toml": "^3.0.0",
99
- "tooling": "webpack/tooling#v1.19.0",
101
+ "tooling": "webpack/tooling#v1.20.0",
100
102
  "ts-loader": "^8.0.2",
101
103
  "typescript": "^4.2.0-beta",
102
104
  "url-loader": "^4.1.0",
@@ -156,8 +158,8 @@
156
158
  "type-lint": "tsc",
157
159
  "typings-lint": "tsc -p tsconfig.test.json",
158
160
  "spellcheck": "cspell \"{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}\" \"*.md\"",
159
- "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 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",
160
- "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 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",
161
+ "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",
162
+ "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",
161
163
  "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
162
164
  "prepare": "husky install",
163
165
  "pretty-lint-base": "prettier \"*.{ts,json,yml,yaml,md}\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.json\" \"examples/*.md\"",
@@ -209,6 +211,8 @@
209
211
  "<rootDir>/test/fixtures/temp-cache-fixture",
210
212
  "<rootDir>/test/fixtures/temp-",
211
213
  "<rootDir>/benchmark",
214
+ "<rootDir>/assembly",
215
+ "<rootDir>/tooling",
212
216
  "<rootDir>/examples/*/dist",
213
217
  "<rootDir>/coverage",
214
218
  "<rootDir>/.eslintcache"