webpack 5.24.2 → 5.24.3

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.

package/bin/webpack.js CHANGED
File without changes
@@ -28,6 +28,27 @@ const addToList = (itemOrItems, list) => {
28
28
  }
29
29
  };
30
30
 
31
+ /**
32
+ * @template T
33
+ * @param {T[]} input list
34
+ * @param {function(T): Buffer} fn map function
35
+ * @returns {Buffer[]} buffers without duplicates
36
+ */
37
+ const mapAndDeduplicateBuffers = (input, fn) => {
38
+ // Buffer.equals compares size first so this should be efficient enough
39
+ // If it becomes a performance problem we can use a map and group by size
40
+ // instead of looping over all assets.
41
+ const result = [];
42
+ outer: for (const value of input) {
43
+ const buf = fn(value);
44
+ for (const other of result) {
45
+ if (buf.equals(other)) continue outer;
46
+ }
47
+ result.push(buf);
48
+ }
49
+ return result;
50
+ };
51
+
31
52
  /**
32
53
  * Escapes regular expression metacharacters
33
54
  * @param {string} str String to quote
@@ -331,7 +352,7 @@ ${referencingAssets
331
352
  : computeNewContent(asset)
332
353
  )
333
354
  );
334
- const assetsContent = assets.map(asset => {
355
+ const assetsContent = mapAndDeduplicateBuffers(assets, asset => {
335
356
  if (asset.ownHashes.has(oldHash)) {
336
357
  return asset.newSourceWithoutOwn
337
358
  ? asset.newSourceWithoutOwn.buffer()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.24.2",
3
+ "version": "5.24.3",
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",
@@ -60,7 +60,7 @@
60
60
  "eslint-plugin-prettier": "^3.1.4",
61
61
  "file-loader": "^6.0.0",
62
62
  "fork-ts-checker-webpack-plugin": "^6.0.5",
63
- "husky": "^5.0.9",
63
+ "husky": "^5.1.2",
64
64
  "is-ci": "^2.0.0",
65
65
  "istanbul": "^0.4.5",
66
66
  "jest": "^26.6.3",
@@ -154,6 +154,7 @@
154
154
  "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/generate-types --no-template-literals",
155
155
  "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/generate-types --no-template-literals --write",
156
156
  "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
157
+ "prepare": "husky install",
157
158
  "pretty-lint-base": "prettier \"*.{ts,json,yml,yaml,md}\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.json\" \"examples/*.md\"",
158
159
  "pretty-lint-base-all": "yarn pretty-lint-base \"*.js\" \"{setup,lib,bin,hot,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/helpers/*.js\" \"test/{configCases,watchCases,statsCases,hotCases,benchmarkCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
159
160
  "pretty-lint-fix": "yarn pretty-lint-base-all --loglevel warn --write",