-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: should rewrite symbols in complex patterns correctly (#193)
<!-- Thank you for contributing! --> ### Description https://github.com/rolldown-rs/rolldown/blob/626ea15c90e6cb1dc4a87ae8bc92be7c04599aca/crates/rolldown/tests/fixtures/deconflict/decl_complex_patterns/artifacts.snap <!-- Please insert your description here and provide especially info about the "what" this PR is solving --> ### Test Plan <!-- e.g. is there anything you'd like reviewers to focus on? --> ---
- Loading branch information
Showing
13 changed files
with
183 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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
13 changes: 13 additions & 0 deletions
13
crates/rolldown/tests/fixtures/deconflict/decl_complex_patterns/_test.mjs
This file contains 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,13 @@ | ||
import assert from 'node:assert' | ||
import * as main from './dist/main.mjs' | ||
|
||
assert.equal(main.a, 'a1') | ||
assert.equal(main.b, 'b1') | ||
assert.equal(main.c, 'c1') | ||
assert.equal(main.d, 'd1') | ||
assert.equal(main.e, 'e1') | ||
assert.equal(main.a2, 'a2') | ||
assert.equal(main.b2, 'b2') | ||
assert.equal(main.c2, 'c2') | ||
assert.equal(main.d2, 'd2') | ||
assert.equal(main.e2, 'e2') |
44 changes: 44 additions & 0 deletions
44
crates/rolldown/tests/fixtures/deconflict/decl_complex_patterns/artifacts.snap
This file contains 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,44 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/fixtures/deconflict/decl_complex_patterns | ||
--- | ||
# Assets | ||
|
||
## main.mjs | ||
|
||
```js | ||
import { default as assert_default } from "assert"; | ||
// names.js | ||
const [a] = ['a2'] | ||
const { b } = { b: 'b2' } | ||
const { b: c } = { b: 'c2' } | ||
const { d = '' } = { d: 'd2' } | ||
const { d: e = '' } = { d: 'e2' } | ||
// main.js | ||
const [a$1] = ['a1'] | ||
const { b: b$1 } = { b: 'b1' } | ||
const { b: c$1 } = { b: 'c1' } | ||
const { d: d$1 = '' } = { d: 'd1' } | ||
const { d: e$1 = '' } = { d: 'e1' } | ||
assert_default.equal(a$1, 'a1') | ||
assert_default.equal(a, 'a2') | ||
assert_default.equal(b$1, 'b1') | ||
assert_default.equal(b, 'b2') | ||
assert_default.equal(c$1, 'c1') | ||
assert_default.equal(c, 'c2') | ||
assert_default.equal(d$1, 'd1') | ||
assert_default.equal(d, 'd2') | ||
assert_default.equal(e$1, 'e1') | ||
assert_default.equal(e, 'e2') | ||
export { a$1 as a, a as a2, b$1 as b, b as b2, c$1 as c, c as c2, d$1 as d, d as d2, e$1 as e, e as e2 }; | ||
``` |
20 changes: 20 additions & 0 deletions
20
crates/rolldown/tests/fixtures/deconflict/decl_complex_patterns/main.js
This file contains 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,20 @@ | ||
import assert from 'assert' | ||
import { a as a2, b as b2, c as c2, d as d2, e as e2 } from './names.js' | ||
export const [a] = ['a1'] | ||
export const { b } = { b: 'b1' } | ||
export const { b: c } = { b: 'c1' } | ||
export const { d = '' } = { d: 'd1' } | ||
export const { d: e = '' } = { d: 'e1' } | ||
export { a2, b2, c2, d2, e2 } | ||
|
||
assert.equal(a, 'a1') | ||
assert.equal(a2, 'a2') | ||
assert.equal(b, 'b1') | ||
assert.equal(b2, 'b2') | ||
assert.equal(c, 'c1') | ||
assert.equal(c2, 'c2') | ||
assert.equal(d, 'd1') | ||
assert.equal(d2, 'd2') | ||
assert.equal(e, 'e1') | ||
assert.equal(e2, 'e2') | ||
|
6 changes: 6 additions & 0 deletions
6
crates/rolldown/tests/fixtures/deconflict/decl_complex_patterns/names.js
This file contains 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 @@ | ||
export const [a] = ['a2'] | ||
export const { b } = { b: 'b2' } | ||
export const { b: c } = { b: 'c2' } | ||
export const { d = '' } = { d: 'd2' } | ||
export const { d: e = '' } = { d: 'e2' } | ||
|
1 change: 1 addition & 0 deletions
1
crates/rolldown/tests/fixtures/deconflict/decl_complex_patterns/test.config.json
This file contains 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 @@ | ||
{} |
This file contains 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 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 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