New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix reexporting init-less variable in systemjs #12110
Fix reexporting init-less variable in systemjs #12110
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/28836/ |
exportNames.push(specifier.exported.name); | ||
exportValues.push(t.cloneNode(specifier.local)); | ||
} | ||
// only globals also exported this way | ||
else if (!binding) { |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
@@ -3,7 +3,7 @@ System.register([], function (_export, _context) { | |||
|
|||
var foo; | |||
|
|||
_export("foo", void 0); | |||
_export("bar", void 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI
Lines 1 to 2 in 63d9f53
export {foo as bar}; | |
var foo; |
@@ -3,7 +3,7 @@ System.register([], function (_export, _context) { | |||
|
|||
var foo; | |||
|
|||
_export("foo", void 0); | |||
_export("default", void 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 1 to 2 in 63d9f53
export {foo as default}; | |
var foo; |
@@ -4,7 +4,7 @@ System.register([], function (_export, _context) { | |||
var foo, bar; | |||
|
|||
_export({ | |||
foo: void 0, | |||
default: void 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 1 to 2 in 63d9f53
export {foo as default, bar}; | |
var foo, bar; |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 0fe715e:
|
nextOdd: nextOdd, | ||
a: void 0 | ||
}); | ||
_export("nextOdd", nextOdd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 1 to 17 in 63d9f53
import { isEven } from "./evens"; | |
export function nextOdd(n) { | |
return p = isEven(n) ? n + 1 : n + 2; | |
} | |
export var p = 5; | |
for (var a in b) ; | |
for (var i = 0, j = 0;;) ; | |
export var isOdd = (function (isEven) { | |
return function (n) { | |
return !isEven(n); | |
}; | |
})(isEven); |
8bbd608
to
0fe715e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @JLHwung for finding these.
* feat: parse moduleExportName * feat: add validators * Support string specifier name in commonjs transform * Support string specifier name in export-ns-from * test: add loose testcases * test: add testcases for amd and umd * feat: support systemjs * test: update fixtures fixed in #12110 * add plugin name typings * test: rename test layout * feat: implement under moduleStringNames flag * chore: add plugin syntax module string names * feat: support ModuleExportName as ModuleExportName * test: update test fixtures * fix flow errors * docs: update AST spec * feat: support { "some imports" as "some exports" } * feat: support { "some imports" as "some exports" } in systemjs * test: add test on `import { "foo" }` * Address review comments * add moduleStringNames to missing plugin helpers * Apply suggestions from code review * update test fixtures * Update packages/babel-parser/src/parser/error-message.js * update test fixtures Co-Authored-By: Kai Cataldo <kai@kaicataldo.com> Co-authored-by: Brian Ng <bng412@gmail.com>
This PR checks exportMap when hoisting variables so we don't accidentally push unexported variables to
_export
call. We also pushexported
instead of thelocal
variable so it respects cases like/cc @guybedford