Content-Length: 313824 | pFad | http://redirect.github.com/babel/babel/pull/17073

EC [Babel 8] Parse `export import =` as an ExportNamedDeclaration by JLHwung · Pull Request #17073 · babel/babel · GitHub
Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jan 21, 2025

Q                       A
Fixed Issues? #16679
Patch: Bug Fix?
Major: Breaking Change? Yes
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link babel/website#3043
Any Dependency Changes?
License MIT

In this PR we parse the TSImportEqualsDeclaration { isExport: true } as a vanilla TSImportEqualsDeclaration within an ExportNamedDeclaration. The isExport field is therefore removed.

@JLHwung JLHwung added PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release pkg: parser PR: Needs Docs labels Jan 21, 2025
@babel-bot
Copy link
Collaborator

babel-bot commented Jan 21, 2025

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/58612

@JLHwung JLHwung marked this pull request as ready for review January 21, 2025 17:11
@@ -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>()
Copy link
Contributor Author

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) &&
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: parser PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://redirect.github.com/babel/babel/pull/17073

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy