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

add Dynamic Imports and BigInt as ES2020 #198

Merged
merged 5 commits into from Aug 12, 2019

Conversation

mysticatea
Copy link
Contributor

@mysticatea mysticatea commented Jun 4, 2019

Dynamic Imports and BigInt syntaxes have arrived at Stage 4. This PR adds those syntaxes as ES2020.

es2020.md

  • I extended Literal as separated from BigIntLiteral because of consistent. Literal has RegExp value and RegExpLiteral extends only regex property.
  • [EDIT] I represented Dynamic Imports as CallExpression as same as the current experimental spec. However, I think that another way such as ImportExpression is better: Revisit Dynamic Imports #197. Thoughts? I changed the AST of Dynamic Imports because of Revisit Dynamic Imports #197. I believe that the Import node way will confuse us in the future.

Fixes #197, fixes #169, closes #179.

@adrianheine
Copy link
Member

There's already #179 for BigInts (but I don't care which one is merged). I'm still in favor of not having value for them in the spec.

@mysticatea
Copy link
Contributor Author

Because that was adding the spec into experimental directory, I have written this to move both syntaxes to es2020.md.

I prefer having value. The Literal node has value property, so the derived interface must have value property. We have experienced this behavior already when new syntaxes were added in RegExp. Indeed, nullable is odd, but I'm not worried because it's temporary.

@michaelficarra
Copy link
Member

@mysticatea In a bunch of places, you've mistyped BigInt as BitInt.

es2020.md Outdated Show resolved Hide resolved
@mysticatea
Copy link
Contributor Author

I'm leaning toward, we should change the representation of dynamic imports: #197.

@mysticatea
Copy link
Contributor Author

What should I do to advance this PR?

@mysticatea
Copy link
Contributor Author

@RReverser @ariya would you take a look this PR?

es2020.md Outdated Show resolved Hide resolved
@mysticatea
Copy link
Contributor Author

What should I do to advance this PR?

Copy link
Member

@RReverser RReverser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me overall.

@mercmobily
Copy link

Are ther any more steps needed/revisions before this PR can be merged? Adding this in case this slipped

@mercmobily
Copy link

I am typing here as ESlint depends on this to get dynamic imports happening!

eslint/eslint#11803

@aladdin-add
Copy link

any news?

@RReverser
Copy link
Member

@adrianheine Still would like your input on your PR vs this one.

@mikesherov
Copy link
Contributor

I don't think we can land this as is. Unless I'm mistaken, both Webpack and Acorn have adopted the current experimental design for dynamic import. Seems it's too late and not worth the effort to undo the change. Just my 2 cents here.

@mysticatea
Copy link
Contributor Author

mysticatea commented Jul 11, 2019

I know Acorn's release was a mistake. I think they will make a major release after this PR merged. (acornjs/acorn#834 (comment))

@mikesherov
Copy link
Contributor

@mysticatea and what about Webpack? This would need to get merged and released before Webpack 5 was released.

@mysticatea
Copy link
Contributor Author

The AST was experimental. I believe we should fix it before getting stable, rather than leaving the pain for the future.

This would need to get merged and released before Webpack 5 was released.

I hope this PR to be merged as soon as possible. I have been waiting for the decide of ESTree team since a month ago. I'm just waiting.

@mikesherov
Copy link
Contributor

mikesherov commented Jul 11, 2019

ok, so:

Approvals needed:
[x] @mysticatea I suppose you serve as approval from the ESLint side of things.
[x] @RReverser speaks for Acorn.
[ ] @adrianheine still waiting on your approval as per @RReverser's comment.
[x] @michaelficarra you've reviewed. Would be nice to get an explicit approval from you.

People to inform:

  • Pinging @sokra as a heads up that there will be an AST change coming up to hopefully get it into Webpack 5.
  • And pinging @hzoo on the Babel side of things that this change is coming.

Copy link
Contributor

@mikesherov mikesherov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that my approval matters as an inactive member, but just figured one more couldn't hurt.

@aladdin-add
Copy link

friendly ping @adrianheine

@mysticatea
Copy link
Contributor Author

We have over a month (40 days) since the last commit. Is there any chance to be merged?

@mikesherov
Copy link
Contributor

@RReverser I think we should merge this one and also credit @adrianheine in the commit message. The two pull requests are fundamentally the same thing (with respect to BigInt), no? Alternatively, we could land the dynamic import stuff (since we have wide agreement here), and slice off BigInt until Adrian replies.

Either way it's time to move this forward :-)

@mikesherov
Copy link
Contributor

@RReverser once you're settled in at your new gig, perhaps you can merge this PR, or are we still waiting on anyone?

papandreou added a commit to papandreou/escodegen that referenced this pull request Aug 5, 2019
papandreou added a commit to papandreou/estraverse that referenced this pull request Aug 5, 2019
Munter added a commit to Munter/estraverse that referenced this pull request Aug 5, 2019
papandreou added a commit to assetgraph/assetgraph that referenced this pull request Aug 11, 2019
@mysticatea
Copy link
Contributor Author

We have over two months since the last commit. Is there any chance to be merged?

@RReverser RReverser merged commit 9a38106 into estree:master Aug 12, 2019
@mikesherov
Copy link
Contributor

Thanks @RReverser! @mysticatea do have any PRs open against Acorn acknowledging this change?

@mysticatea
Copy link
Contributor Author

Thank you for merged!

Yes, I have acornjs/acorn#844

@mysticatea mysticatea deleted the update-june-2019 branch August 12, 2019 12:27
@mikesherov
Copy link
Contributor

FYI, I've also pinged @sokra about the change so hopefully it can land in Acorn before Webpack 5.

michaelficarra pushed a commit to estools/estraverse that referenced this pull request Aug 12, 2019
* Add support for dynamic Import expressions. See https://tc39.github.io/proposal-dynamic-import/

* Added skipped failing tests for dynamic import. Tests depend on espree supporting dynamic import

* Update dynamic import test with literal parse tree instead of depending on espree having dynamic import support

* Align with estree/estree#198
michaelficarra pushed a commit to estools/escodegen that referenced this pull request Aug 13, 2019
* feat: support dynamic import

* Add a couple of tests

* Align with estree/estree#198

* Update escodegen.js

Co-Authored-By: Michael Ficarra <github@michael.ficarra.me>

* Remove outdated "State 3" from comment

* Add test of a SequenceExpression as a dynamic import source

#395 (comment)

* Properly parenthesize when used with a higher precedence operator

#395 (comment)
@mikesherov
Copy link
Contributor

Just for record keeping:
This has landed in Acorn 7.0.0 and will be in Webpack 5 alpha 21.

bizob2828 pushed a commit to Contrast-Security-OSS/escodegen that referenced this pull request Apr 2, 2020
* feat: support dynamic import

* Add a couple of tests

* Align with estree/estree#198

* Update escodegen.js

Co-Authored-By: Michael Ficarra <github@michael.ficarra.me>

* Remove outdated "State 3" from comment

* Add test of a SequenceExpression as a dynamic import source

estools#395 (comment)

* Properly parenthesize when used with a higher precedence operator

estools#395 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revisit Dynamic Imports BigInt
8 participants