Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5469 from yavorsky/fix-commonjs-destructuring
Fix commonjs exports with destructuring.
- Loading branch information
Showing
15 changed files
with
75 additions
and
5 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
1 change: 1 addition & 0 deletions
1
...s-commonjs/test/fixtures/strict/export-const-destructuring-array-default-params/actual.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 @@ | ||
export const [foo, bar = 2] = []; |
5 changes: 5 additions & 0 deletions
5
...commonjs/test/fixtures/strict/export-const-destructuring-array-default-params/expected.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,5 @@ | ||
"use strict"; | ||
|
||
const [foo, bar = 2] = []; | ||
exports.foo = foo; | ||
exports.bar = bar; |
1 change: 1 addition & 0 deletions
1
...015-modules-commonjs/test/fixtures/strict/export-const-destructuring-array-rest/actual.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 @@ | ||
export const [foo, bar, ...baz] = []; |
6 changes: 6 additions & 0 deletions
6
...5-modules-commonjs/test/fixtures/strict/export-const-destructuring-array-rest/expected.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 @@ | ||
"use strict"; | ||
|
||
const [foo, bar, ...baz] = []; | ||
exports.foo = foo; | ||
exports.bar = bar; | ||
exports.baz = baz; |
1 change: 1 addition & 0 deletions
1
...m-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-array/actual.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 @@ | ||
export const [foo, bar] = []; |
5 changes: 5 additions & 0 deletions
5
...es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-array/expected.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,5 @@ | ||
"use strict"; | ||
|
||
const [foo, bar] = []; | ||
exports.foo = foo; | ||
exports.bar = bar; |
1 change: 1 addition & 0 deletions
1
...-commonjs/test/fixtures/strict/export-const-destructuring-object-default-params/actual.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 @@ | ||
export const { foo, bar = 1 } = {}; |
5 changes: 5 additions & 0 deletions
5
...ommonjs/test/fixtures/strict/export-const-destructuring-object-default-params/expected.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,5 @@ | ||
"use strict"; | ||
|
||
const { foo, bar = 1 } = {}; | ||
exports.foo = foo; | ||
exports.bar = bar; |
1 change: 1 addition & 0 deletions
1
...15-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-rest/actual.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 @@ | ||
export const { foo, ...bar } = {}; |
5 changes: 5 additions & 0 deletions
5
...-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-rest/expected.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,5 @@ | ||
"use strict"; | ||
|
||
const { foo, ...bar } = {}; | ||
exports.foo = foo; | ||
exports.bar = bar; |
1 change: 1 addition & 0 deletions
1
...-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object/actual.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 @@ | ||
export const { foo: bar, baz } = {}; |
5 changes: 5 additions & 0 deletions
5
...s2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object/expected.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,5 @@ | ||
"use strict"; | ||
|
||
const { foo: bar, baz } = {}; | ||
exports.bar = bar; | ||
exports.baz = baz; |
5 changes: 4 additions & 1 deletion
5
packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/options.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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"plugins": ["external-helpers", ["transform-es2015-modules-commonjs", { "strict": true }]] | ||
"plugins": [ | ||
"external-helpers", | ||
"syntax-object-rest-spread", | ||
["transform-es2015-modules-commonjs", { "strict": true }]] | ||
} |