Repository navigation
material 3.7.0
ES2022 browser JS.
Changed
-
The browser JavaScript compiles at ES2022 (#264).
The published browser JavaScript now compiles at ES2022 instead of
ES2020, as one whole-dist target;useDefineForClassFields: falsekeeps
today's assignment semantics for class fields, where at ES2022 the
TypeScript default flips them toObject.definePropertydefinitions (the
flag differs from that default in two shipped files). The floor is
measured, not assumed: parsing all 642 JS files of the published 3.5.4
package with acorn 8.18 finds 186 that fail ES2019, 185 of which parse at
ES2020 — so the browser floor today is ES2020, carried by optional
chaining (153 files) and??(127 files) — and exactly one file,
dist/ssr/index.js, that already fails ES2020 and ES2021 and ships
logical assignment and native private fields; no file fails ES2022. The
README's browser-support section names the new floor, and
npm-readme.mdcarries the same sentence. The emit is smaller: of the
560 shipped tsc-emitted files, 545 are byte-identical and 15 shrink by
4,223 bytes raw in all — 4,026 of themdist/elements/define.js, the
only file with native private members and methods (it also gains two
static blocks for its static class fields) — while the other 14 drop 9 to
21 bytes each as??=stays native. Element pages measured from the
packed package — each component'sdefine*element plus its CSS, in
brotli — are all down and none grows: 15,695 bytes over all 40 rows,
mean 392, range 289 to 463. The component initial and deferred rows
(SIZES.md, gzip) are byte-identical to main's — the factory pages carry
none of the element runtime, and every deferred value is unchanged — so
the table needs no update. The packed-consumer rows that do move:
all-js127,444 → 127,428 bytes gzip (−16),form20,393 → 20,387 (−6),
button-initial7,566 → 7,563 (−3), andbutton,slider,
navigation-railandtext-fieldby 2 to 3; apart from the SSR entry
below, no gzip row grows, and every budget stays green. (all-jsbrotli
moves +160 bytes andbutton+6 bytes: cross-chunk dictionary drift;
sizeandsize:checkare the gate and both pass.) The one row whose
gzip grows is the SSR entry: 112,599 → 112,609 bytes gzip (+10; raw
308,694 → 308,739, +45; brotli +77). Cause: thedist/ssrbuild now
applies the explicituseDefineForClassFields: false, so its copy of the
classes assigns instance fields in the constructor where Bun left them
native — which is how the browser dist has always emitted them — and it
stays insidesize:check's SSR budget, with the SSR consumer and browser
checks green.Compatibility: The browser JS now requires an ES2022-capable parser
(it was ES2020); bundlers that parse ES2020 but not ES2022 should update.
Internal
-
The published syntax floor is checked (#264).
bun run syntax:checkparses every.js,.mjsand.cjsfile the
package ships atecmaVersion: 2022with acorn 8, and fails with
file:line:column on the first file that needs a later edition. It runs in
the package job on the build's dist, so the floor cannot drift silently.
test/build/syntax-floor.test.tspasses what the ES2022 target emits —
private members, a static block, class fields, private-in — and fails a
regexvfixture (ES2024, first asserted valid atecmaVersion: 2024)
with file, line and message; it reads.js,.mjsand.cjsin
subdirectories and ignores declarations, CSS and JSON.
test/build/ci-commands.test.tskeeps the command in the CI list. -
The size cost of the ES2022 target: a smaller package, and one row
larger.
Against 3.6.0's published package job:all-js414,644 raw / 127,428
gzip / 105,827 brotli against 414,669 / 127,444 / 105,667; the full
stylesheet 628,272 / 58,669 / 42,164 and the inline SSR page 253,639 /
5,325 / 2,906, byte-identical; and the packed tarball 862,802 bytes
compressed, 4,830,984 unpacked in 1,582 files against 863,526 and
4,837,005 in 1,582 files — 724 bytes smaller packed and 6,021 unpacked in
the same number of files. Every one of the 40adapters:sizeelement
pages is smaller, like-for-like: 15,695 bytes brotli in all, mean 392,
range 289 to 463; every adapter import stays within the check's
1,700-byte brotli ceiling over its element. The component rows that move
(raw / gzip / brotli):form65,250 / 20,387 / 18,174 against 65,257 /
20,393 / 18,225;button-initial22,463 / 7,563 / 6,778 against 22,466
/ 7,566 / 6,774;button41,301 / 13,940 / 12,648 against 41,304 /
13,942 / 12,642;slider34,967 / 12,165 / 11,018 against 34,970 /
12,167 / 11,036;navigation-rail19,340 / 7,072 / 6,407 against
19,346 / 7,075 / 6,412;text-field30,836 / 9,517 / 8,571 against
30,842 / 9,520 / 8,574; and the SSR entry 308,739 / 112,609 / 91,640
against 308,694 / 112,599 / 91,563 (+45 / +10 / +77, the cause in the
Changed section). base-lite-css is 12,999 / 1,644 / 1,306 against its
1,750-byte budget, and thesizetable's 41 rows are byte-identical to
main's, so SIZES.md needs no update. Measured on main at 5fc52c2, push
run 41800107765, package job 126473784266; this release changes only the
CHANGELOG and the version field. No ceiling moved, every budget check
passed, and every README size row stands as printed.
npm: material@3.7.0 · Docs: md3.io · Full history: CHANGELOG.md
The history before 3.0.0 was developed in floor/mtrl; #numbers in commit subjects before 3.0.0 refer to pull requests there.