-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(es/minifier): avoid preserved name collisions #12172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
labor0-bot
wants to merge
9
commits into
main
Choose a base branch
from
fix-12155-preserved-mangle-collision
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+399
−16
Open
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1b7271d
fix(es/minifier): avoid preserved name collisions
labor0-bot[bot] e39e63e
fix(es/minifier): scope loop binding preservation
labor0-bot[bot] 54bb148
fix(es/minifier): preserve loop body vars
labor0-bot[bot] c4a2c64
fix(es/minifier): preserve nested loop body vars
labor0-bot[bot] 9fb2943
fix(es/minifier): reserve preserved names first
labor0-bot[bot] 6b6324b
fix(es/renamer): reserve descendant preserved names
labor0-bot[bot] 4de37c7
fix(es/minifier): preserve loop-hoisted declarations
labor0-bot[bot] 8291763
fix(es/minifier): restrict loop function preservation
labor0-bot[bot] 5d1cbd8
chore(changeset): release transforms base
labor0-bot[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
crates/swc_ecma_minifier/tests/fixture/issues/12155/config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "defaults": true, | ||
| "toplevel": false | ||
| } |
1 change: 1 addition & 0 deletions
1
crates/swc_ecma_minifier/tests/fixture/issues/12155/expected.stdout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| let a; | ||
| console.log(a); | ||
| for (const a of [1]); |
3 changes: 3 additions & 0 deletions
3
crates/swc_ecma_minifier/tests/fixture/issues/12155/mangle.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "toplevel": false | ||
| } |
4 changes: 4 additions & 0 deletions
4
crates/swc_ecma_minifier/tests/fixture/issues/12155/output.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| let a; | ||
| for (const o of (console.log(a), [ | ||
| 1 | ||
| ])); |
4 changes: 4 additions & 0 deletions
4
crates/swc_ecma_minifier/tests/fixture/issues/12155/unbraced-loop-body/config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "defaults": false, | ||
| "toplevel": false | ||
| } |
6 changes: 6 additions & 0 deletions
6
crates/swc_ecma_minifier/tests/fixture/issues/12155/unbraced-loop-body/input.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| for (key in {}) var forInBody; | ||
| for (value of []) var forOfBody; | ||
| for (; false;) var classicForBody; | ||
| for (; false;) if (flag) var conditionalBody; | ||
| for (; false;) label: var labeledBody; | ||
| for (; false;) for (; false;) var nestedLoopBody; |
3 changes: 3 additions & 0 deletions
3
crates/swc_ecma_minifier/tests/fixture/issues/12155/unbraced-loop-body/mangle.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "toplevel": false | ||
| } |
6 changes: 6 additions & 0 deletions
6
crates/swc_ecma_minifier/tests/fixture/issues/12155/unbraced-loop-body/output.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| for(key in {})var forInBody; | ||
| for (value of [])var forOfBody; | ||
| for(; false;)var classicForBody; | ||
| for(; false;)if (flag) var conditionalBody; | ||
| for(; false;)o: var labeledBody; | ||
| for(; false;)for(; false;)var nestedLoopBody; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.