-
Notifications
You must be signed in to change notification settings - Fork 1.9k
JS: Support import assertions #12382
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
Conversation
a83329d to
7f96fe7
Compare
erik-krogh
left a comment
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.
Really nice work 👍
And very easy to follow in a commit-by-commit review 👍
A single very optional comment.
| Expression attributes = null; | ||
| if (this.eat(TokenType.comma)) { | ||
| attributes = this.parseMaybeAssign(false, null, null); | ||
| if (this.type != TokenType.parenR) { // Skip if the comma was a trailing comma |
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.
Optional: Trailing commas in dynamic imports is not part of the tests?
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.
Added a trap test
Adds support for import assertions. For example:
For TypeScript these were tolerated but not extracted, and for plain JS they caused a parse error. Now they are supported and extracted in both dialects.
The language feature was recently downgraded to stage 2, but based on the discussion it seems unlikely that the syntax will change.
Evaluation was uneventful.
Commit-by-commit review recommended.