+- `tooling/` — Repo-internal scripts: build/codegen (runtime/wasm generators, hash-debug tool, and `generate-types.js`, the one entry point and one file for everything derived from `schemas/**/*.json` — it reads each schema once, emits that schema's declaration and its precompiled validator, then emits `types.d.ts`, so ordering is internal and one check run names every stale output) invoked by `yarn fix:special`, plus standalone analysis tools such as `compare-css-tools.js` / `compare-html-tools.js` / `compare-js-tools.js` (`yarn benchmark:css-tools`, `yarn benchmark:html-tools`, `yarn benchmark:js-tools`), which share the measuring harness in `compare-tools-harness.js`. Those three need no arguments and no reading of their source: each runs what webpack owns for that language and the ecosystem's equivalents over popular framework stylesheets, real documents and shipped JavaScript bundles, printing **three tables per fixture** — parsing alone, parsing and printing readably (`beautify`), and parsing and printing minified (`minify`) — so what a parse costs is separated from what the printing and the transforms on top of it cost. Every table reports best-of-3 wall and cpu ms and the worker's own peak RSS (each tool × fixture measured in its own process, so the numbers are attributable; read from `/proc/self/status`, since Linux carries `maxRSS` across `fork`+`exec` and a worker asking for its own would report the parent's). **Read wall and cpu together**: cpu above wall is a tool using more than one core (V8's background threads, a native thread pool), cpu below it is a tool waiting rather than computing. A tool that works in a service process of its own says so in its name and reports `-` for cpu and peak, which are spent where nothing here can see them — esbuild is the one today. The two printing tables add output size raw and under gzip/brotli/zstd (the `test:size` settings) and whether the output lost classes / changed the DOM / stopped naming a property ("rejects it" rows mean the tool errored on that input), plus what printing the output a second time moved (`2nd`). The JavaScript one is shaped by webpack owning a parser there and no printer: webpack has a row in the parse table only, and that table's last column holds every ESTree parser against acorn's tree and names the first node where the two differ — which is how a divergence in `lib/javascript/syntax.js` is caught — while a parser answering in a dialect of its own reads as `own dialect` rather than as a disagreement. A round-trip printer that reformats nothing — postcss for CSS, parse5 for HTML — sits in the `beautify` table as the floor the others are read against. `FIXTURE=`, `TOOL=` and `STAGE=` narrow a run to matching rows. They install the packages they compare against into `node_modules/.cache/` on first run rather than into webpack's dependencies; expect the first run to install for a minute and every full run to take upwards of ten. `type-coverage.js` (`yarn types:cover`) reports how much of `lib/` is precisely typed. `find-deep-webpack-imports.js` (`yarn find-deep-imports`) answers which `webpack/lib/…` paths the published ecosystem imports directly: it ranks the most downloaded `webpack`, `webpack-plugin` and `webpack-loader` packages off the registry's search endpoint — which carries weekly downloads with each hit, so `api.npmjs.org` is never needed — then reads each one's tarball rather than installing it, so no lifecycle script of a stranger's package runs. It counts a path only where it is imported, never a bare string, because a package that bundled webpack carries webpack's own `makeSerializable` requests and imports none of them. What it finds is kept in `tooling/deep-webpack-imports.json`, which `--write` refreshes and whose `removed` map names the paths no webpack 5 build can reach with the reason — deleted with the webpack 4 API, imported only by a package that is webpack 4 only, or probed for inside a `try` to detect webpack 4, where a re-export would pick the wrong branch — so only a genuine break fails. `--check` reads that record and nothing else — no network, and no install, so the `Deep Imports` job runs it on every pull request in under a second, comments what broke and what imports it, and fails; it names the packages and the downloads behind each one, and retracts the comment once the paths resolve again; `test/unitCases/deepPathShims.unittest.js` asserts the same thing off the same record, so a move out of `lib/` root learns it owes a re-export from a test rather than from a bug report. `COUNT=` sets how many packages per keyword (default 200), and a package the broad keyword shares with a narrow one is scanned once; tarballs cache under `node_modules/.cache/`, so a re-run costs nothing. Only the collecting half needs the network. `measure-color-agreement.js` (`yarn measure:color-agreement`) is the third: it asks a real browser for its own color conversions rather than for a pixel, and prints how far they sit from webpack's — which is where the rounding margins in `lib/css/syntax.js` and the list of spaces an engine reads through another transfer come from. Re-run it (a few seconds; `PUPPETEER_EXECUTABLE_PATH` picks the binary) rather than adjusting either by hand. **The CSS and HTML comparisons open with a section no one has to ask for**: before the install, each holds webpack's own printer to what it owes whatever it printed, over `test/**/*.css` / `test/**/*.html` plus its own fixtures and whatever the cache already holds, in seconds rather than minutes. `--invariants` runs that section and stops, for a caller that wants the relations without the comparison behind them. Two relations, under each option set the script's own webpack rows are measured with: minifying an already-minified source changes nothing, and (HTML) how a value was spelled does not decide what it minifies to. This is the shape of defect a comparison cannot see, because being a few bytes off its own best is not being worse than another tool: `method=GET` folding only where the source quoted it went unnoticed until this sweep, which is what #22095 fixed. A respelling is lexical (a delimiter, a character reference, the case of a name) and is checked against webpack's own tokenizer before use, so a mutation that moved the document is dropped rather than reported; whitespace inside a tag is deliberately not one, since a tag nothing beats is echoed as written, and a tag another language writes into is skipped whole, since `=""` on a `{% endif %}` restates no value. Each finding is bisected to what carries it and re-run on the enclosing tag alone, so the report names a repro, and groups by it — one printer defect reaches hundreds of pages. `FIXTURE=`, `RELATION=`, `PRESET=` and `SPELLING=` narrow a run. `--invariants` exits non-zero on any finding, which is what the `invariants` job gates every pull request on (`yarn test:invariants`, or `:css` / `:html` for one of them) — a relation is cheap to hold and a regression in one is a defect, so it fails rather than reporting. A divergence the printer owes nothing for is carried in the script's own `EXPECTED` table with the reason beside it, never suppressed by a passing gate, and an entry there that stops matching is itself a finding, so a fix retires its expectation rather than leaving it to rot. No embedded body is minified: the CSS minifier has a fixed point of its own and reaching it here would report every page holding a `<style>`. The same question is asked of every other tool in the comparison's own tables, where the `2nd` column is what a second pass over the tool's own output moved — `-` being the answer a printer that is done printing gives.
0 commit comments