-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[Babel 8] Parse export import =
as an ExportNamedDeclaration
#17073
base: main
Are you sure you want to change the base?
Conversation
a0efb71
to
f074683
Compare
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/58612 |
@@ -2893,8 +2894,10 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) => | |||
): N.AnyExport { | |||
if (this.match(tt._import)) { | |||
// `export import A = B;` | |||
const nodeImportEquals = process.env.BABEL_8_BREAKING | |||
? this.startNode<N.TsImportEqualsDeclaration>() |
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.
Note that in Babel 8, TSImportEqualsDeclaration
always starts with the import
keyword, while the preceding export
keyword starts the ExportNamedDeclaration
.
!isExport && | ||
(process.env.BABEL_8_BREAKING || | ||
// @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST | ||
!stmt.node.isExport) && |
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.
Here we are checking top level statements, since a top-level TSImportEqualsDeclaration will be always an import declaration in Babel 8, we don't need the !isExport
check here.
In this PR we parse the
TSImportEqualsDeclaration { isExport: true }
as a vanillaTSImportEqualsDeclaration
within anExportNamedDeclaration
. TheisExport
field is therefore removed.