You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1e8bbd0
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(javascript): generate the minifier's folded built-ins from browser-compat-data
`tooling/generate-js-data.js` now writes the built-ins `improve` evaluates
on literals into `syntax-printer-data.js`. Every member
@mdn/browser-compat-data lists of `Math`, `Number`, `String`, `Array` and
the global functions is placed as folded, or left out with a reason, and a
bump that lists a new one fails generation until it is placed. A folded
built-in must be in every Node `engines.node` allows, so `at` and
`replaceAll` are no longer folded and output no longer depends on the
build's Node; `fromCodePoint` and `normalize` (on ASCII) are now folded.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,7 +240,7 @@ Re-run `yarn fix:special` **before the next commit** after touching:
240
240
241
241
- An option type in `lib/**/*.js` or `declarations/**/*.ts` — rewrites that schema, its validator and `types.d.ts`.
242
242
- JSDoc in `lib/**/*.js` reachable from a public export — `types.d.ts`.
243
-
-`tooling/generate-runtime-code.js`, `generate-wasm-code.js`, `generate-css-data.js`, `generate-html-data.js`, `generate-js-data.js`, or anything they consume (incl. the `acorn` / `mdn-data` / `color-name` / `@webref/*` versions in `package.json` and `tooling/html-entities.json`).
243
+
-`tooling/generate-runtime-code.js`, `generate-wasm-code.js`, `generate-css-data.js`, `generate-html-data.js`, `generate-js-data.js`, or anything they consume (incl. the `acorn` / `mdn-data` / `@mdn/browser-compat-data` / `color-name` / `@webref/*` versions in `package.json` and `tooling/html-entities.json`).
244
244
245
245
CI's `lint` job verifies these are current; `yarn fix` (`fix:code` + `fix:special` + `fmt`) is the preferred final step.
Copy file name to clipboardExpand all lines: docs/syntax.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Read this before touching the CSS, HTML or JavaScript parser, printer or minifie
24
24
-`lib/css/data.js` — every table the CSS minifier looks names up in, plus the arithmetic its math-function descriptors bind to: from `mdn-data` + `color-name` (box shorthands, color-argument and math functions, named colors) and the generator's `SUPPLEMENT` of spec-prose tables and math primitives, by `tooling/generate-css-data.js` — which also holds the value-definition-syntax parser those grammars are read with, and runs generation only as the entry point so its tests can require it.
25
25
-`lib/html/data.js` — every table the HTML parser and minifier look names up in: reflected-attribute tables from webref's HTML IDL (`@webref/idl`, `@webref/elements`) plus the generator's `SUPPLEMENT` and `PARSER_TABLES` of §13.2 tree-construction vocabulary, by `tooling/generate-html-data.js` — which also emits the `// #region html entities` block in `lib/html/syntax-parser.js` from the vendored `tooling/html-entities.json` (WHATWG's named character references).
26
26
-`lib/javascript/data.js` — the JS parser's and printer's Unicode tables: run-length identifier ranges the tokenizer decodes at its first non-ASCII code point, and per-edition `\p{...}` property names (reached only for a pattern the engine rejected), which `tooling/generate-js-data.js` reads from the pinned acorn devDependency — bumping it moves them; plus the Unicode 8.0 identifier ranges the printer writes unescaped (so older engines read its output), read from terser's own frozen tables.
27
-
- `lib/javascript/syntax-printer-data.js` — the tables only the printer reads, in their own module so a build that parses without minifying through the printer never loads them: the native-object tables of pure globals, calls, methods and static properties the compressor reads (`NATIVE_*`, built only when `nativeObjectTables()` is called, so loading the module allocates none), each name with its `unsafe` / `builtins_ecma >= N` conditions in terser's order, parsed with acorn out of terser's `lib/compress/native-objects.js`. Plus terser's node classes (`nodeClasses()`, built on call too): each class's base, the fields its constructor copies, the values on its prototype, and its children in the order its `_walk` and `_children_backwards` reach them, parsed out of terser's `lib/ast.js` — the printer builds every node class and its walk from them. Plus the tokenizer's and parser's tables (`parserTables()`), parsed out of terser's `lib/parse.js`, and the DOM property names property mangling keeps (`domProperties()`), out of its `tools/domprops.js`.
27
+
- `lib/javascript/syntax-printer-data.js` — the tables only the printer reads, in their own module so a build that parses without minifying through the printer never loads them: the native-object tables of pure globals, calls, methods and static properties the compressor reads (`NATIVE_*`, built only when `nativeObjectTables()` is called, so loading the module allocates none), each name with its `unsafe` / `builtins_ecma >= N` conditions in terser's order, parsed with acorn out of terser's `lib/compress/native-objects.js`. Plus terser's node classes (`nodeClasses()`, built on call too): each class's base, the fields its constructor copies, the values on its prototype, and its children in the order its `_walk` and `_children_backwards` reach them, parsed out of terser's `lib/ast.js` — the printer builds every node class and its walk from them. Plus the tokenizer's and parser's tables (`parserTables()`), parsed out of terser's `lib/parse.js`, and the DOM property names property mangling keeps (`domProperties()`), out of its `tools/domprops.js`. Plus the built-ins `improve` evaluates on literals (`foldedBuiltIns()`): `tooling/generate-js-data.js` places every member `@mdn/browser-compat-data` lists of `Math`, `Number`, `String`, `Array` and the global functions in `FOLDED_BUILT_INS` or, with the reason, `UNFOLDED_BUILT_INS`, and fails when a bump lists one in neither, or a folded one is missing, misplaced, or newer in Node than `engines.node` (folding it would tie the output to the build's Node).
"oxc folds `at` and `replaceAll` on literals, which webpack leaves to the engine: the oldest Node it builds on lacks them, and folding them would tie the output to the build's Node",
0 commit comments