-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: transform import name only when no other import
- Loading branch information
Showing
9 changed files
with
50 additions
and
34 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
11 changes: 6 additions & 5 deletions
11
packages/babel-plugin-transform-modules-amd/test/fixtures/amd/overview/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 |
---|---|---|
@@ -1,19 +1,20 @@ | ||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (_exports, foo2, _fooBar, _fooBar2) { | ||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (_exports, _foo, _fooBar, _fooBar2) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
_exports.test2 = _exports.test = _exports.default = void 0; | ||
foo2 = babelHelpers.interopRequireWildcard(foo2); | ||
_foo = babelHelpers.interopRequireWildcard(_foo); | ||
var foo2 = _foo; | ||
var test; | ||
_exports.test = test; | ||
var test2 = 5; | ||
_exports.test2 = test2; | ||
var _default = test; | ||
_exports.default = _default; | ||
foo2.default; | ||
_foo.default; | ||
foo2; | ||
foo2.bar; | ||
foo2.foo; | ||
_foo.bar; | ||
_foo.foo; | ||
}); |
11 changes: 6 additions & 5 deletions
11
packages/babel-plugin-transform-modules-amd/test/fixtures/loose/overview/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 |
---|---|---|
@@ -1,17 +1,18 @@ | ||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (_exports, foo2, _fooBar, _fooBar2) { | ||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (_exports, _foo, _fooBar, _fooBar2) { | ||
"use strict"; | ||
|
||
_exports.__esModule = true; | ||
_exports.test2 = _exports.test = _exports.default = void 0; | ||
foo2 = babelHelpers.interopRequireWildcard(foo2); | ||
_foo = babelHelpers.interopRequireWildcard(_foo); | ||
var foo2 = _foo; | ||
var test; | ||
_exports.test = test; | ||
var test2 = 5; | ||
_exports.test2 = test2; | ||
var _default = test; | ||
_exports.default = _default; | ||
foo2.default; | ||
_foo.default; | ||
foo2; | ||
foo2.bar; | ||
foo2.foo; | ||
_foo.bar; | ||
_foo.foo; | ||
}); |
7 changes: 4 additions & 3 deletions
7
...ages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/lazy-7176/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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
"use strict"; | ||
|
||
function mod() { | ||
function _mod() { | ||
const data = babelHelpers.interopRequireWildcard(require("mod")); | ||
mod = function () { | ||
_mod = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
mod().named; | ||
var mod = _mod(); | ||
_mod().named; | ||
mod(); |
9 changes: 9 additions & 0 deletions
9
...sform-modules-commonjs/test/fixtures/shadowed-namespace-import/transformed-name/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,9 @@ | ||
"use strict"; | ||
|
||
var _stdFormat = babelHelpers.interopRequireWildcard(require("xxx/std-format")); | ||
var e = _stdFormat; | ||
const Ws = e => { | ||
return { | ||
amount: _stdFormat.default.format(1) | ||
}; | ||
}; |
15 changes: 8 additions & 7 deletions
15
packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
"use strict"; | ||
|
||
var foo4 = babelHelpers.interopRequireWildcard(require("foo")); | ||
foo4.default; | ||
foo4.default; | ||
foo4.foo3; | ||
(0, foo4.foo3)(); | ||
(0, foo4.foo3)``; | ||
(0, foo4.foo3)?.(); | ||
var _foo = babelHelpers.interopRequireWildcard(require("foo")); | ||
var foo4 = _foo; | ||
_foo.default; | ||
_foo.default; | ||
_foo.foo3; | ||
(0, _foo.foo3)(); | ||
(0, _foo.foo3)``; | ||
(0, _foo.foo3)?.(); |
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