Repository navigation
Commit 8741598
authored
feat(minify): fold string methods on constants and more aliases written through (#22823)
* feat(minify): fold a string method called on a constant holding a string
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* feat(minify): read a name set once from another through it, after a write through the copy
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* chore: shorten the changeset summary
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* feat(minify): write x -= 1 as --x, and x += 1 as ++x where x holds only numbers
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* feat(minify): keep the spelling gzip writes smaller
Re-run a small program with each measured spelling (literals last, lets)
switched off and keep the output gzip writes smallest.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* feat(minify): also try names in oxc's letter order, where gzip writes it smaller
In a small program, re-run with mangled names taken in English letter order
instead of by counted characters, and keep whichever gzips smaller.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* fix(minify): keep `+= 1` on a name a for-in or for-of head declares
Also run the measured spellings one after another in their test, and retire
two rival cases no longer bigger.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* test: count tree prints of one run, without the size choice
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* fix(minify): choose spellings one call at a time, and only for small sources
The switches the choice flips are shared, so concurrent calls now wait their
turn; a source over 32 KiB is minified once. Regenerate the schema
validators, which the names choice writes up to 9 B smaller gzipped.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* fix(minify): ask a comments callback once per comment across size-choice runs
A callback keeping a license comment only the first time it is asked would
otherwise drop it from a trial run, which then measures smaller.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* test: let a late file event invalidate the multi-compiler restart case
On Windows the step's own writes can report a change after watching starts,
adding an invalidation or a run; the case asserts the restart, not the count.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* test: retire the corpus cases now no bigger, and compare them with shorthand kept
The gzip-guided choice closes 76 listed gaps, among them both literal-last
groups. Re-printing at ECMAScript 5 wrote `{a}` as `{a:a}`, measuring text
neither minifier emits; it now keeps shorthand properties.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* test(minify): cover every changed line of the numeric and size-choice paths
Drop two branches no input reaches: a source the first run accepted is never
null, and a `for-in` target already counts as a pattern write.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* fix(minify): measure the program without its inline map, and choose `--x` by size too
A source map written inline no longer sways the size choice. `--x` and a
shorthand name nothing else reads are measured spellings, and the spellings
are also tried off together. Regenerate the validators: 254 B smaller gzipped.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
* test: retire one oxc case and list a quote-style gzip tie
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD1 parent f48f90e commit 8741598
42 files changed
Lines changed: 732 additions & 166 deletions
File tree
- .changeset
- lib/javascript
- schemas/plugins
- asset
- container
- css
- debug
- define
- dll
- ids
- json
- optimize
- output
- schemes
- sharing
- test
- helpers
- specCases
- unitCases/javascript
- watchCases/simple/multi-compiler-watch-restart/0
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1705 | 1705 | | |
1706 | 1706 | | |
1707 | 1707 | | |
| 1708 | + | |
| 1709 | + | |
1708 | 1710 | | |
1709 | 1711 | | |
1710 | 1712 | | |
| |||
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments