[Babel 8] Parse export import = as an ExportNamedDeclaration#17073
Merged
JLHwung merged 4 commits intobabel:mainfrom Jan 24, 2025
Merged
[Babel 8] Parse export import = as an ExportNamedDeclaration#17073JLHwung merged 4 commits intobabel:mainfrom
export import = as an ExportNamedDeclaration#17073JLHwung merged 4 commits intobabel:mainfrom
Conversation
a0efb71 to
f074683
Compare
11 tasks
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/58625 |
JLHwung
commented
Jan 21, 2025
| if (this.match(tt._import)) { | ||
| // `export import A = B;` | ||
| const nodeImportEquals = process.env.BABEL_8_BREAKING | ||
| ? this.startNode<N.TsImportEqualsDeclaration>() |
Contributor
Author
There was a problem hiding this comment.
Note that in Babel 8, TSImportEqualsDeclaration always starts with the import keyword, while the preceding export keyword starts the ExportNamedDeclaration.
JLHwung
commented
Jan 21, 2025
| !isExport && | ||
| (process.env.BABEL_8_BREAKING || | ||
| // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST | ||
| !stmt.node.isExport) && |
Contributor
Author
There was a problem hiding this comment.
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.
nicolo-ribaudo
approved these changes
Jan 22, 2025
| | VariableDeclaration | ||
| | ClassDeclaration | ||
| | FunctionDeclaration | ||
| | TsImportEqualsDeclaration |
Member
There was a problem hiding this comment.
We need to do the same thing in @babel/types.
liuxingbaoyu
approved these changes
Jan 23, 2025
laine-hallot
pushed a commit
to laine-hallot/uwu-parser
that referenced
this pull request
Mar 31, 2025
…#17073) * breaking: parse export import = as ExportNamedDeclaration * update AST fixtures * fix Babel 8 typing errors * add TSImportEqualsDeclaration to Declaration
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we parse the
TSImportEqualsDeclaration { isExport: true }as a vanillaTSImportEqualsDeclarationwithin anExportNamedDeclaration. TheisExportfield is therefore removed.