Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure default exports snapshot synthetic named exports (#3946)
- Loading branch information
1 parent
683cc6a
commit bab3d3d
Showing
15 changed files
with
47 additions
and
19 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
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
2 changes: 1 addition & 1 deletion
2
test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { named } from './lib-reexport2.js'; | ||
console.log('side-effect', named); | ||
export default named; | ||
export { named as default }; |
2 changes: 1 addition & 1 deletion
2
test/chunking-form/samples/synthetic-named-exports/chained-default-reexport/lib-reexport2.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { named } from './lib.js'; | ||
console.log('side-effect', named); | ||
export default named; | ||
export { named as default }; |
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
3 changes: 1 addition & 2 deletions
3
test/function/samples/synthetic-named-exports/circular-synthetic-exports/dep.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 |
---|---|---|
@@ -1,2 +1 @@ | ||
import { foo } from './main.js'; | ||
export default foo; | ||
export { foo as default } from './main.js'; |
11 changes: 11 additions & 0 deletions
11
test/function/samples/synthetic-named-exports/circular-synthetic-exports2/_config.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,11 @@ | ||
module.exports = { | ||
description: 'handles circular synthetic exports', | ||
warnings: [ | ||
{ | ||
code: 'CIRCULAR_DEPENDENCY', | ||
cycle: ['dep1.js', 'dep2.js', 'dep1.js'], | ||
importer: 'dep1.js', | ||
message: 'Circular dependency: dep1.js -> dep2.js -> dep1.js' | ||
} | ||
] | ||
}; |
2 changes: 2 additions & 0 deletions
2
test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep1.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,2 @@ | ||
import dep2 from './dep2'; | ||
export default dep2; |
2 changes: 2 additions & 0 deletions
2
test/function/samples/synthetic-named-exports/circular-synthetic-exports2/dep2.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,2 @@ | ||
import dep1 from './dep1'; | ||
export default dep1; |
2 changes: 2 additions & 0 deletions
2
test/function/samples/synthetic-named-exports/circular-synthetic-exports2/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,2 @@ | ||
import dep1 from './dep1'; | ||
assert.strictEqual(dep1, undefined); |
10 changes: 10 additions & 0 deletions
10
test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/_config.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,10 @@ | ||
module.exports = { | ||
description: 'makes sure default exports of synthetic named exports are snapshots', | ||
options: { | ||
plugins: { | ||
transform() { | ||
return { syntheticNamedExports: '__synthetic' }; | ||
} | ||
} | ||
} | ||
}; |
2 changes: 2 additions & 0 deletions
2
test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/dep.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,2 @@ | ||
import { foo } from './synthetic'; | ||
export default foo; |
6 changes: 6 additions & 0 deletions
6
test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/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,6 @@ | ||
import foo from './dep'; | ||
import { update } from './synthetic'; | ||
|
||
assert.strictEqual(foo, 'original'); | ||
update(); | ||
assert.strictEqual(foo, 'original'); |
2 changes: 2 additions & 0 deletions
2
test/function/samples/synthetic-named-exports/synthetic-named-export-as-default/synthetic.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,2 @@ | ||
export const __synthetic = { foo: 'original' }; | ||
export const update = () => (__synthetic.foo = 'reassigned'); |