Skip to content

Commit a615521

Browse files
build(deps): bump webpack-sources to 3.7.0 and minimizer-webpack-plugin to 5.14.0 (#23022)
* build(deps): bump webpack-sources to 3.7.0 and minimizer-webpack-plugin to 5.14.0 * build(deps-dev): bump webpack-cli to 7.3.0 * test: give the webpack-cli mock a version, which webpack-cli 7.3 reads * build: show installed and duplicated dependencies in one table * build: read the webpack version npm 11 links instead of installing * build: give separate advice for duplicated versions and unhoisted copies * build: move packages nested under a linked webpack along with it * build(deps-dev): bump webpack-cli to 7.3.1 * build: list duplicated dependencies without advice
1 parent 6aef449 commit a615521

7 files changed

Lines changed: 80 additions & 65 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"webpack": patch
3+
---
4+
5+
Require `minimizer-webpack-plugin` 5.14 for exact source map columns.

‎docs/architecture.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ This is the canonical repository map. **When you add, rename or remove a top-lev
6666
- `check-redundant-type-assertions.js` (`yarn lint:redundant-casts`, inside `yarn lint`) — fails on a `/** @type {T} */ (expr)` whose `expr` already has exactly type `T`; `--write` removes them.
6767
- `find-deep-webpack-imports.js` (`yarn find-deep-imports`) — which `webpack/lib/…` paths published packages import directly; `--check` (offline, run by the `Deep Imports` job) reads `tooling/deep-webpack-imports.json`. How it collects, and its `removed` map: [tooling/DEEP_IMPORTS.md](../tooling/DEEP_IMPORTS.md).
6868
- `measure-color-agreement.js` (`yarn measure:color-agreement`) — asks a real browser for its own color conversions (not pixels) and prints how far webpack's sit from them; it is the source of the rounding margins in `lib/css/syntax-parser.js` and the list of spaces an engine reads through another transfer. Re-run it (seconds; `CHROME_EXECUTABLE_PATH` picks the binary) rather than adjusting either by hand.
69-
- `dependency-report.js` (`yarn report:dependencies`) — installs `webpack` as this checkout's `package.json` declares its dependencies (a stub, since `npm pack` runs `prepare` even with `--ignore-scripts`) with the latest `webpack-cli` and `webpack-dev-server` into a temporary directory (the packages are listed in its `PACKAGES` array) and prints every package they pull in (devDependencies excluded) with its version, size on disk, parent packages with the range each asks for, and the shortest path to it, plus a table of duplicated packages; `--base <checkout>` adds what changed against another checkout (🔴 added or grew, 🟢 removed or shrank), and `--output` / `--json` / `--comment` write the Markdown / JSON report and the pull request comment. The `Dependency Report` workflow runs it against the base commit when `package.json` or `yarn.lock` changes, puts it in the job summary, uploads both files and keeps one comment on the pull request up to date (a fork's through `pr-reports.yml`).
69+
- `dependency-report.js` (`yarn report:dependencies`) — installs `webpack` as this checkout's `package.json` declares its dependencies (a stub, since `npm pack` runs `prepare` even with `--ignore-scripts`) with the latest `webpack-cli` and `webpack-dev-server` into a temporary directory (the packages are listed in its `PACKAGES` array) and prints one table of every package they pull in (devDependencies excluded): its versions, size on disk, parent packages with the range each asks for, and the shortest path to each version, duplicated packages flagged and listed first; `--base <checkout>` adds what changed against another checkout (🔴 added or grew, 🟢 removed or shrank), and `--output` / `--json` / `--comment` write the Markdown / JSON report and the pull request comment. The `Dependency Report` workflow runs it against the base commit when `package.json` or `yarn.lock` changes, puts it in the job summary, uploads both files and keeps one comment on the pull request up to date (a fork's through `pr-reports.yml`).
7070
- `retry.js` — reruns a failing setup command so a registry 503 or dropped browser download reds no job. Every network-reaching command in `.github/workflows/` (installs, `yarn upgrade`, Firefox/WebKit downloads, `git submodule update` fetches) runs as `node tooling/retry.js <command>`, tuned by `RETRY_ATTEMPTS` (3) and `RETRY_DELAY` (5000ms). A value that isn't a positive integer / non-negative number is refused, not defaulted (one reaching the loop as `NaN` retried until the job timed out). Node builtins only — callers run before `yarn install`.
7171
- `assembly/` — WebAssembly source for the hash function.
7272
- `setup/` — one-time setup; `setup.js` (`yarn setup`) is the only entry point and safe to re-run. A contributor at a terminal gets the interactive path (installs yarn if missing, links through yarn's registry); everything else gets the non-interactive one (verifies the lockfile instead of rewriting it, installs no global yarn, links the checkout as `node_modules/webpack` without touching yarn's machine-global registry). It decides from both streams being a TTY with `CI` unset — never a vendor-variable list, so an unknown agent takes the safe path. An agent allocating a PTY reads as a contributor and should set `WEBPACK_SETUP=automated` (`interactive` forces the other path).

‎package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@
148148
"events": "^3.2.0",
149149
"graceful-fs": "^4.2.11",
150150
"mime-db": "^1.54.0",
151-
"minimizer-webpack-plugin": "^5.13.0",
151+
"minimizer-webpack-plugin": "^5.14.0",
152152
"schema-utils": "^4.8.1",
153153
"tapable": "^2.3.0",
154154
"watchpack": "^2.6.3",
155-
"webpack-sources": "^3.6.0"
155+
"webpack-sources": "^3.7.0"
156156
},
157157
"devDependencies": {
158158
"@babel/core": "^8.0.1",
@@ -251,7 +251,7 @@
251251
"url-loader": "^4.1.0",
252252
"wast-loader": "^1.12.1",
253253
"webassembly-feature": "1.3.0",
254-
"webpack-cli": "^7.2.1",
254+
"webpack-cli": "^7.3.1",
255255
"webpack-dev-server": "^6.0.0",
256256
"xxhashjs": "^0.2.2",
257257
"yamljs": "^0.3.0"

‎test/fixtures/webpack-cli/mock-webpack.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const webpack = (options) => {
4141
return { options };
4242
};
4343

44+
// webpack-cli reads it to tell which features the webpack it drives supports.
45+
webpack.version = require("../../../package.json").version;
46+
4447
// build only calls getArguments(undefined); ignore it and describe our schema.
4548
webpack.cli = {
4649
getArguments: () => cli.getArguments(schema),

‎tooling/dependency-report.js‎

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const DIRECT = "(direct)";
3232
* @property {Record<string, string>=} dependencies
3333
* @property {Record<string, string>=} optionalDependencies
3434
* @property {Record<string, string>=} peerDependencies
35+
* @property {boolean=} link whether the location links to another one
36+
* @property {string=} resolved the location a link points to
3537
*/
3638

3739
/**
@@ -102,6 +104,20 @@ const collect = (dir) => {
102104
const packages = JSON.parse(
103105
fs.readFileSync(path.join(dir, "package-lock.json"), "utf8")
104106
).packages;
107+
// npm 11 links a `file:` dependency despite `--install-links`, leaving the
108+
// link without a version: its target and all nested under it move to it.
109+
for (const location of Object.keys(packages)) {
110+
const entry = packages[location];
111+
// A target already folded into its link is gone.
112+
if (!entry || !entry.link || !entry.resolved) continue;
113+
const { resolved } = entry;
114+
if (!packages[resolved]) continue;
115+
for (const nested of Object.keys(packages)) {
116+
if (nested !== resolved && !nested.startsWith(`${resolved}/`)) continue;
117+
packages[location + nested.slice(resolved.length)] = packages[nested];
118+
delete packages[nested];
119+
}
120+
}
105121
// Copies of one version npm could not hoist share a row.
106122
/** @type {Map<string, ReportRow>} */
107123
const rows = new Map();
@@ -374,61 +390,53 @@ const toMarkdown = (rows, installed, base, comment) => {
374390
const requested = Object.keys(installed)
375391
.map((name) => `\`${name}@${installed[name]}\``)
376392
.join(", ");
377-
const versions = groupByName(rows);
378-
const duplicated = [...versions.values()].filter(
379-
(list) => list.length > 1 || list[0].copies > 1
380-
);
393+
const packages = [...groupByName(rows).values()];
394+
/**
395+
* @param {ReportRow[]} list rows of one package
396+
* @returns {boolean} whether npm installed it more than once
397+
*/
398+
const isDuplicated = (list) => list.length > 1 || list[0].copies > 1;
399+
const duplicated = packages.filter(isDuplicated);
400+
// Duplicated packages lead, as removing a copy is what the table is for.
401+
const ordered = [
402+
...duplicated,
403+
...packages.filter((list) => !isDuplicated(list))
404+
];
381405
const installedSection = [
382406
"## Installed dependencies",
383407
"",
384-
`Installing ${requested} pulls in **${versions.size}** packages (${
408+
`Installing ${requested} pulls in **${packages.length}** packages (${
385409
rows.length
386410
} versions, ${copies} copies on disk), **${formatSize(
387411
total
388412
)}** in total (dependencies only, no devDependencies).`,
389413
"",
390-
"Parent packages name the version range each one asks for; the path is the shortest chain from a requested package.",
414+
`⚠️ ${duplicated.length} packages are installed more than once, in several versions or copies; they come first.`,
391415
"",
392-
"| Name | Version | Copies | Size | Parent packages | Path |",
393-
"| ---- | ------- | -----: | ---: | --------------- | ---- |",
394-
...rows.map(
395-
(row) =>
396-
`| ${row.name} | ${row.version} | ${row.copies} | ${formatSize(
397-
row.size
398-
)} | ${escapeCell(row.parents.join(", "))} | ${row.path.join(" › ")} |`
399-
),
400-
""
401-
];
402-
const duplicatedSection = [
403-
"## Duplicated packages",
404-
"",
405-
`${duplicated.length} packages are installed more than once: in several versions, or one version npm could not hoist. Widening or upgrading the parent whose range excludes the newest version removes a copy.`,
416+
"Parent packages name the version range each one asks for; the path is the shortest chain from a requested package.",
406417
"",
407-
"| Name | Versions | Size | Parent packages and path per version |",
408-
"| ---- | -------- | ---: | ------------------------------------ |",
409-
...duplicated.map(
410-
(list) =>
411-
`| ${list[0].name} | ${formatVersions(list)} | ${formatSize(
412-
sumSize(list)
413-
)} | ${list
414-
.map(
415-
(row) =>
416-
`**${row.version}**: ${escapeCell(row.parents.join(", "))}<br>path: ${row.path.join(" › ")}`
417-
)
418-
.join("<br>")} |`
419-
),
418+
"| Name | Versions | Size | Parent packages and path |",
419+
"| ---- | -------- | ---: | ------------------------ |",
420+
...ordered.map((list) => {
421+
const name = isDuplicated(list) ? `⚠️ ${list[0].name}` : list[0].name;
422+
const origins = list.map((row) => {
423+
const origin = `${escapeCell(row.parents.join(", "))}<br>path: ${row.path.join(" › ")}`;
424+
return list.length > 1 ? `**${row.version}**: ${origin}` : origin;
425+
});
426+
return `| ${name} | ${formatVersions(list)} | ${formatSize(
427+
sumSize(list)
428+
)} | ${origins.join("<br>")} |`;
429+
}),
420430
""
421431
];
422432
const changes = base ? toChanges(base, rows) : [];
423433
if (!comment) {
424-
return [...changes, ...installedSection, ...duplicatedSection].join("\n");
434+
return [...changes, ...installedSection].join("\n");
425435
}
426436
// A scoped name such as `@types/node` would mention a GitHub user or team.
427-
const head = [COMMENT_MARKER, ...changes, ...duplicatedSection]
428-
.join("\n")
429-
.replace(/@/g, "@\u200B");
437+
const head = [COMMENT_MARKER, ...changes].join("\n").replace(/@/g, "@\u200B");
430438
const table = [
431-
"<details><summary>All installed dependencies</summary>",
439+
`<details><summary>Installed dependencies: ${packages.length} packages, ${duplicated.length} duplicated</summary>`,
432440
"",
433441
...installedSection,
434442
"</details>",

‎types.d.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ import {
135135
createScopesWriter,
136136
encodeScopes
137137
} from "webpack-sources/types/helpers/scopes";
138+
import { originalPositionFor } from "webpack-sources/types/helpers/sourceMap";
138139
import {
139140
disableDualStringBufferCaching,
140141
enableDualStringBufferCaching,
@@ -40099,6 +40100,9 @@ declare namespace exports {
4009940100
encodeScopes
4010040101
};
4010140102
}
40103+
export namespace sourceMap {
40104+
export { originalPositionFor };
40105+
}
4010240106
export namespace stringBufferUtils {
4010340107
export {
4010440108
disableDualStringBufferCaching,

‎yarn.lock‎

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7630,12 +7630,11 @@ minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.8:
76307630
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
76317631
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
76327632

7633-
minimizer-webpack-plugin@^5.13.0:
7634-
version "5.13.1"
7635-
resolved "https://registry.yarnpkg.com/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.13.1.tgz#664cdfbab756e1b93ae17eb7ff70f1a5620584d7"
7636-
integrity sha512-1mhAfvachWYYOm8tpmany5NLuvP+F2wxZWBSX8DC0uFS2wJpM9q3rWgN9wBooAH9d5V12wX0BjyJe4fMjHMarQ==
7633+
minimizer-webpack-plugin@^5.14.0:
7634+
version "5.14.0"
7635+
resolved "https://registry.yarnpkg.com/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.14.0.tgz#5ab341c84ce3a57daf533e84d52d96a42e707298"
7636+
integrity sha512-PnvQXCJxhgH2ZVVO7Lj0sM6q8L1XGxnUvd8wVQIRwi8khMCLq5wg0Ngxe44bcuZL2FSN81RdVE7YHEVzTKsQDQ==
76377637
dependencies:
7638-
"@jridgewell/trace-mapping" "^0.3.31"
76397638
jest-worker "^27.4.5"
76407639
schema-utils "^4.6.0"
76417640
terser "^5.51.0"
@@ -8655,12 +8654,10 @@ readdirp@^5.0.0:
86558654
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-5.1.1.tgz#520bca06f9d1ae1b96cc0800dbe84b983d19422c"
86568655
integrity sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==
86578656

8658-
rechoir@^0.8.0:
8659-
version "0.8.0"
8660-
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22"
8661-
integrity sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==
8662-
dependencies:
8663-
resolve "^1.20.0"
8657+
rechoir@^1.0.0:
8658+
version "1.0.0"
8659+
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-1.0.0.tgz#7302d3ef55a2aae97b0de22ae61147002780870e"
8660+
integrity sha512-vyBa7bWz11iJRwzJR0nGLt6r45bymWfYXAgd1FmP08BNP/DHAVabgpGPyEXQmBtKvhgxi17SQz2szhvkberQsg==
86648661

86658662
reflect-metadata@^0.2.2:
86668663
version "0.2.2"
@@ -8833,7 +8830,7 @@ [email protected]:
88338830
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
88348831
integrity sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg==
88358832

8836-
resolve@^1.15.1, resolve@^1.20.0:
8833+
resolve@^1.15.1:
88378834
version "1.22.12"
88388835
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.12.tgz#f5b2a680897c69c238a13cd16b15671f8b73549f"
88398836
integrity sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==
@@ -10040,18 +10037,16 @@ [email protected]:
1004010037
resolved "https://registry.yarnpkg.com/webassembly-feature/-/webassembly-feature-1.3.0.tgz#2966668bfb6be7abf9821ea0b71f87623f49a54f"
1004110038
integrity sha512-tvszvOBbV/X6gj0Nh3hxmrLUSZzXIxEwL6EzDrqU4OPLRuUVMne/bg8kFFRxwDMJVM+1R+c+O2ajrxa8HIkRwA==
1004210039

10043-
webpack-cli@^7.2.1:
10044-
version "7.2.3"
10045-
resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-7.2.3.tgz#becafbd777df5ff3e1a35ec398ad2ad54ec4d456"
10046-
integrity sha512-vDFU7jrfCctnN7jJQWPl+V26B51GLp11prVZXg50oeonsgeBzSTJEWmXkjHsOjTgMjlPOQM8GWLh33X9RN/0ow==
10040+
webpack-cli@^7.3.1:
10041+
version "7.3.1"
10042+
resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-7.3.1.tgz#039d55cfdd94221802ced7c42084a551c86e1a54"
10043+
integrity sha512-enXzN0/2fWHX3tP2gpTV6U8/zz5RSbfWjSAc0VXOi0+hOY4ePdHanA+2kxrAC/SX0LHO4fOX5c9G1TdwpvUj/g==
1004710044
dependencies:
1004810045
"@discoveryjs/json-ext" "^1.1.0"
1004910046
commander "^14.0.3"
10050-
cross-spawn "^7.0.6"
1005110047
envinfo "^7.21.0"
10052-
import-local "^3.2.0"
1005310048
interpret "^3.1.1"
10054-
rechoir "^0.8.0"
10049+
rechoir "^1.0.0"
1005510050
webpack-merge "^6.0.1"
1005610051

1005710052
webpack-dev-middleware@^8.4.0:
@@ -10105,10 +10100,10 @@ webpack-merge@^6.0.1:
1010510100
flat "^5.0.2"
1010610101
wildcard "^2.0.1"
1010710102

10108-
webpack-sources@^3.6.0:
10109-
version "3.6.0"
10110-
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.6.0.tgz#b2e4a4f1aef1a0d60f3011eb47736c5bf7f1ed7f"
10111-
integrity sha512-EIMmPVvNI0CYXyRPp34F2Qk7W37/BZVZIofS6LAUnrNjCVahS+hO4mxwFJDjQjODTGZDtVzLYoN2+1dYkhk9qA==
10103+
webpack-sources@^3.7.0:
10104+
version "3.7.0"
10105+
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.7.0.tgz#6c145ac83f8220ef20d4b01b9e7d5c15b1598b09"
10106+
integrity sha512-PdUhbCycwEgiS1hB/FBDksWKg/ashAIuJKqwdbPn8/dFVgU5LxQiBvG0js6VRRIzPujMrStYCczywp82P0KWng==
1011210107

1011310108
which-boxed-primitive@^1.1.0, which-boxed-primitive@^1.1.1:
1011410109
version "1.1.1"

0 commit comments

Comments
 (0)