Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
importInterop: "node"
option for module transforms (#12838)
- Loading branch information
1 parent
22b0eb0
commit be03be1
Showing
101 changed files
with
834 additions
and
32 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
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
1 change: 1 addition & 0 deletions
1
...ugin-transform-modules-amd/test/fixtures/importInterop-node/export-default-from/input.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 @@ | ||
export { default } from 'dep'; |
8 changes: 8 additions & 0 deletions
8
...ugin-transform-modules-amd/test/fixtures/importInterop-node/export-default-from/output.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,8 @@ | ||
define(["exports", "dep"], function (_exports, _dep) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
_exports.default = _dep; | ||
}); |
1 change: 1 addition & 0 deletions
1
...form-modules-amd/test/fixtures/importInterop-node/export-named-and-default-from/input.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 @@ | ||
export { default, name } from 'dep'; |
20 changes: 20 additions & 0 deletions
20
...form-modules-amd/test/fixtures/importInterop-node/export-named-and-default-from/output.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 @@ | ||
define(["exports", "dep"], function (_exports, _dep) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(_exports, "default", { | ||
enumerable: true, | ||
get: function () { | ||
return _dep.default; | ||
} | ||
}); | ||
Object.defineProperty(_exports, "name", { | ||
enumerable: true, | ||
get: function () { | ||
return _dep.name; | ||
} | ||
}); | ||
_dep = babelHelpers.interopRequireWildcard(_dep, true); | ||
}); |
1 change: 1 addition & 0 deletions
1
...plugin-transform-modules-amd/test/fixtures/importInterop-node/export-named-from/input.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 @@ | ||
export { name } from 'dep'; |
13 changes: 13 additions & 0 deletions
13
...plugin-transform-modules-amd/test/fixtures/importInterop-node/export-named-from/output.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,13 @@ | ||
define(["exports", "dep"], function (_exports, _dep) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(_exports, "name", { | ||
enumerable: true, | ||
get: function () { | ||
return _dep.name; | ||
} | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...el-plugin-transform-modules-amd/test/fixtures/importInterop-node/import-default/input.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,3 @@ | ||
import foo from "foo"; | ||
|
||
foo(); |
5 changes: 5 additions & 0 deletions
5
...el-plugin-transform-modules-amd/test/fixtures/importInterop-node/import-default/output.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 @@ | ||
define(["foo"], function (_foo) { | ||
"use strict"; | ||
|
||
_foo(); | ||
}); |
4 changes: 4 additions & 0 deletions
4
...transform-modules-amd/test/fixtures/importInterop-node/import-named-and-default/input.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,4 @@ | ||
import foo, { named } from "foo"; | ||
|
||
foo(); | ||
named(); |
7 changes: 7 additions & 0 deletions
7
...transform-modules-amd/test/fixtures/importInterop-node/import-named-and-default/output.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,7 @@ | ||
define(["foo"], function (_foo) { | ||
"use strict"; | ||
|
||
_foo = babelHelpers.interopRequireWildcard(_foo, true); | ||
(0, _foo.default)(); | ||
(0, _foo.named)(); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...abel-plugin-transform-modules-amd/test/fixtures/importInterop-node/import-named/input.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,3 @@ | ||
import { named } from "foo"; | ||
|
||
named(); |
5 changes: 5 additions & 0 deletions
5
...abel-plugin-transform-modules-amd/test/fixtures/importInterop-node/import-named/output.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 @@ | ||
define(["foo"], function (_foo) { | ||
"use strict"; | ||
|
||
(0, _foo.named)(); | ||
}); |
4 changes: 4 additions & 0 deletions
4
...l-plugin-transform-modules-amd/test/fixtures/importInterop-node/import-wildcard/input.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,4 @@ | ||
import * as foo from 'foo'; | ||
|
||
foo.bar(); | ||
foo.baz(); |
7 changes: 7 additions & 0 deletions
7
...l-plugin-transform-modules-amd/test/fixtures/importInterop-node/import-wildcard/output.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,7 @@ | ||
define(["foo"], function (foo) { | ||
"use strict"; | ||
|
||
foo = babelHelpers.interopRequireWildcard(foo, true); | ||
foo.bar(); | ||
foo.baz(); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-transform-modules-amd/test/fixtures/importInterop-node/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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": [["transform-modules-amd", { "importInterop": "node" }]] | ||
} |
1 change: 1 addition & 0 deletions
1
...babel-plugin-transform-modules-amd/test/fixtures/importInterop-none/export-from/input.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 @@ | ||
export { default } from 'foo'; |
13 changes: 13 additions & 0 deletions
13
...babel-plugin-transform-modules-amd/test/fixtures/importInterop-none/export-from/output.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,13 @@ | ||
define(["exports", "foo"], function (_exports, _foo) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(_exports, "default", { | ||
enumerable: true, | ||
get: function () { | ||
return _foo.default; | ||
} | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...ugin-transform-modules-amd/test/fixtures/importInterop-none/import-default-only/input.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,3 @@ | ||
import foo from "foo"; | ||
|
||
foo(); |
Oops, something went wrong.