Repository navigation
Commit aa41f7f
authored
fix(javascript): keep what fuzzing modules, classes and bundles found the parser and minifier changed (#22611)
* fix(javascript): read a regular expression after `yield` in a generator method
The tokenizer took a generator from the `function` keyword's context, which
a method's `*` never pushes, so `*m() { yield /a/ }` read `/` as division.
A parse now reads the enclosing scope instead.
Claude-Session: https://claude.ai/code/session_011CuRTB8fAv8PE7di49qDL4
* fix(javascript): keep what fuzzing modules, classes and bundles found the minifier changed
- Parenthesize a named function or class expression after `export default`,
and one a member, call or tag after it starts.
- Keep a sloppy function out of a class or other strict code where it reads
`this`, `arguments` or `with`, deletes, or writes a property or an
undeclared name.
- Keep an object `hoist_props` would split whole where it is read bare.
- Read `NaN` and `Infinity` in a catch clause whose parameter is a pattern,
where the minifier threw.
Claude-Session: https://claude.ai/code/session_011CuRTB8fAv8PE7di49qDL4
* fix(javascript): read `yield` after a nested function body in the enclosing generator
The token after a function body's `}` is read before its scope exits, so
`function* g() { function f() {} yield /a/g; }` read `/` as division and
failed to parse. The `yield` there is now classified again once the
scope exits.
Claude-Session: https://claude.ai/code/session_011CuRTB8fAv8PE7di49qDL4
* fix(javascript): read a function's `"use strict"` directive when keeping sloppy code out of a class
The check read `value`, which a directive has no field for, so a function
already strict by a directive was kept out of a class too. It reads
`directive` now, which leaves emotion, syncfusion, 2257 and 7568 as small
as before and 8173 back among the cases swc minifies smaller.
Claude-Session: https://claude.ai/code/session_011CuRTB8fAv8PE7di49qDL4
* fix(javascript): classify `yield` after a function body without base parser code on the lazy path
The lazy path runs no base prototype method, so it checks the token after
a body itself instead of calling `rereadYieldContext`.
Claude-Session: https://claude.ai/code/session_011CuRTB8fAv8PE7di49qDL4
* fix(javascript): keep a sloppy function writing a `for-in` or `for-of` target out of a class
A loop head writes its target without an assignment, so a function that
creates a global through `for (x of ...)` was still moved into a class,
where the write throws.
Claude-Session: https://claude.ai/code/session_011CuRTB8fAv8PE7di49qDL4
* test(javascript): drop the `vercel/006` corpus entry the rebase onto main made stale
With the minifier fixes from main, its own options no longer print it
bigger than swc, so the entry lists a difference that is gone.
Claude-Session: https://claude.ai/code/session_011CuRTB8fAv8PE7di49qDL41 parent 2289141 commit aa41f7f
7 files changed
Lines changed: 358 additions & 12 deletions
File tree
- .changeset
- lib/javascript
- test
- helpers
- unitCases
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3550 | 3550 | | |
3551 | 3551 | | |
3552 | 3552 | | |
3553 | | - | |
| 3553 | + | |
| 3554 | + | |
| 3555 | + | |
| 3556 | + | |
| 3557 | + | |
3554 | 3558 | | |
| 3559 | + | |
3555 | 3560 | | |
3556 | 3561 | | |
3557 | 3562 | | |
| |||
5263 | 5268 | | |
5264 | 5269 | | |
5265 | 5270 | | |
| 5271 | + | |
| 5272 | + | |
| 5273 | + | |
| 5274 | + | |
| 5275 | + | |
| 5276 | + | |
| 5277 | + | |
| 5278 | + | |
| 5279 | + | |
| 5280 | + | |
| 5281 | + | |
| 5282 | + | |
5266 | 5283 | | |
5267 | 5284 | | |
5268 | 5285 | | |
| |||
9885 | 9902 | | |
9886 | 9903 | | |
9887 | 9904 | | |
9888 | | - | |
| 9905 | + | |
| 9906 | + | |
| 9907 | + | |
| 9908 | + | |
| 9909 | + | |
9889 | 9910 | | |
| 9911 | + | |
9890 | 9912 | | |
9891 | 9913 | | |
9892 | 9914 | | |
| |||
13881 | 13903 | | |
13882 | 13904 | | |
13883 | 13905 | | |
| 13906 | + | |
| 13907 | + | |
| 13908 | + | |
| 13909 | + | |
13884 | 13910 | | |
13885 | 13911 | | |
13886 | 13912 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3940 | 3940 | | |
3941 | 3941 | | |
3942 | 3942 | | |
3943 | | - | |
| 3943 | + | |
| 3944 | + | |
3944 | 3945 | | |
3945 | 3946 | | |
3946 | 3947 | | |
| |||
4102 | 4103 | | |
4103 | 4104 | | |
4104 | 4105 | | |
4105 | | - | |
| 4106 | + | |
| 4107 | + | |
| 4108 | + | |
| 4109 | + | |
| 4110 | + | |
| 4111 | + | |
| 4112 | + | |
| 4113 | + | |
| 4114 | + | |
| 4115 | + | |
| 4116 | + | |
| 4117 | + | |
| 4118 | + | |
| 4119 | + | |
| 4120 | + | |
4106 | 4121 | | |
4107 | 4122 | | |
| 4123 | + | |
| 4124 | + | |
| 4125 | + | |
| 4126 | + | |
| 4127 | + | |
| 4128 | + | |
| 4129 | + | |
| 4130 | + | |
| 4131 | + | |
| 4132 | + | |
| 4133 | + | |
| 4134 | + | |
| 4135 | + | |
| 4136 | + | |
| 4137 | + | |
| 4138 | + | |
| 4139 | + | |
| 4140 | + | |
| 4141 | + | |
| 4142 | + | |
| 4143 | + | |
| 4144 | + | |
| 4145 | + | |
4108 | 4146 | | |
4109 | 4147 | | |
4110 | 4148 | | |
| |||
17257 | 17295 | | |
17258 | 17296 | | |
17259 | 17297 | | |
| 17298 | + | |
| 17299 | + | |
| 17300 | + | |
| 17301 | + | |
| 17302 | + | |
| 17303 | + | |
| 17304 | + | |
| 17305 | + | |
| 17306 | + | |
| 17307 | + | |
| 17308 | + | |
| 17309 | + | |
| 17310 | + | |
| 17311 | + | |
| 17312 | + | |
| 17313 | + | |
| 17314 | + | |
| 17315 | + | |
| 17316 | + | |
| 17317 | + | |
| 17318 | + | |
| 17319 | + | |
| 17320 | + | |
| 17321 | + | |
| 17322 | + | |
| 17323 | + | |
| 17324 | + | |
| 17325 | + | |
| 17326 | + | |
| 17327 | + | |
| 17328 | + | |
| 17329 | + | |
| 17330 | + | |
| 17331 | + | |
| 17332 | + | |
| 17333 | + | |
| 17334 | + | |
| 17335 | + | |
| 17336 | + | |
| 17337 | + | |
| 17338 | + | |
| 17339 | + | |
| 17340 | + | |
| 17341 | + | |
| 17342 | + | |
| 17343 | + | |
| 17344 | + | |
| 17345 | + | |
| 17346 | + | |
| 17347 | + | |
| 17348 | + | |
| 17349 | + | |
| 17350 | + | |
| 17351 | + | |
| 17352 | + | |
| 17353 | + | |
| 17354 | + | |
| 17355 | + | |
| 17356 | + | |
| 17357 | + | |
| 17358 | + | |
| 17359 | + | |
| 17360 | + | |
| 17361 | + | |
| 17362 | + | |
| 17363 | + | |
| 17364 | + | |
| 17365 | + | |
| 17366 | + | |
| 17367 | + | |
| 17368 | + | |
| 17369 | + | |
| 17370 | + | |
| 17371 | + | |
17260 | 17372 | | |
17261 | 17373 | | |
17262 | 17374 | | |
17263 | 17375 | | |
| 17376 | + | |
| 17377 | + | |
| 17378 | + | |
| 17379 | + | |
| 17380 | + | |
| 17381 | + | |
17264 | 17382 | | |
17265 | 17383 | | |
17266 | | - | |
17267 | 17384 | | |
17268 | 17385 | | |
17269 | 17386 | | |
| |||
30115 | 30232 | | |
30116 | 30233 | | |
30117 | 30234 | | |
| 30235 | + | |
30118 | 30236 | | |
30119 | 30237 | | |
30120 | 30238 | | |
| |||
30197 | 30315 | | |
30198 | 30316 | | |
30199 | 30317 | | |
30200 | | - | |
| 30318 | + | |
| 30319 | + | |
30201 | 30320 | | |
30202 | 30321 | | |
30203 | 30322 | | |
| |||
30352 | 30471 | | |
30353 | 30472 | | |
30354 | 30473 | | |
| 30474 | + | |
| 30475 | + | |
| 30476 | + | |
| 30477 | + | |
| 30478 | + | |
| 30479 | + | |
| 30480 | + | |
| 30481 | + | |
| 30482 | + | |
30355 | 30483 | | |
30356 | 30484 | | |
30357 | 30485 | | |
| |||
36816 | 36944 | | |
36817 | 36945 | | |
36818 | 36946 | | |
36819 | | - | |
| 36947 | + | |
| 36948 | + | |
| 36949 | + | |
| 36950 | + | |
| 36951 | + | |
36820 | 36952 | | |
36821 | 36953 | | |
36822 | 36954 | | |
| |||
37597 | 37729 | | |
37598 | 37730 | | |
37599 | 37731 | | |
| 37732 | + | |
37600 | 37733 | | |
37601 | 37734 | | |
37602 | | - | |
| 37735 | + | |
37603 | 37736 | | |
37604 | 37737 | | |
37605 | 37738 | | |
37606 | 37739 | | |
37607 | 37740 | | |
37608 | 37741 | | |
37609 | 37742 | | |
| 37743 | + | |
| 37744 | + | |
| 37745 | + | |
| 37746 | + | |
| 37747 | + | |
| 37748 | + | |
| 37749 | + | |
| 37750 | + | |
37610 | 37751 | | |
37611 | 37752 | | |
37612 | 37753 | | |
| |||
38746 | 38887 | | |
38747 | 38888 | | |
38748 | 38889 | | |
| 38890 | + | |
| 38891 | + | |
| 38892 | + | |
| 38893 | + | |
| 38894 | + | |
| 38895 | + | |
| 38896 | + | |
| 38897 | + | |
| 38898 | + | |
| 38899 | + | |
| 38900 | + | |
| 38901 | + | |
| 38902 | + | |
| 38903 | + | |
| 38904 | + | |
38749 | 38905 | | |
38750 | 38906 | | |
38751 | 38907 | | |
| |||
39229 | 39385 | | |
39230 | 39386 | | |
39231 | 39387 | | |
| 39388 | + | |
| 39389 | + | |
| 39390 | + | |
| 39391 | + | |
| 39392 | + | |
39232 | 39393 | | |
39233 | 39394 | | |
39234 | 39395 | | |
39235 | | - | |
| 39396 | + | |
| 39397 | + | |
| 39398 | + | |
39236 | 39399 | | |
39237 | 39400 | | |
39238 | 39401 | | |
| |||
39271 | 39434 | | |
39272 | 39435 | | |
39273 | 39436 | | |
39274 | | - | |
| 39437 | + | |
| 39438 | + | |
39275 | 39439 | | |
39276 | 39440 | | |
39277 | 39441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
547 | 546 | | |
548 | 547 | | |
549 | 548 | | |
| |||
0 commit comments