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

Baseline Acorn plugins #3478

Closed
guybedford opened this issue Mar 31, 2020 · 8 comments
Closed

Baseline Acorn plugins #3478

guybedford opened this issue Mar 31, 2020 · 8 comments

Comments

@guybedford
Copy link
Contributor

I'd like to propose that RollupJS provide support-by-default for a baseline set of Acorn plugins matching the ~stage 4 support.

Since any new syntax feature needs Rollup support from an analysis perspective anyway, it seems like it would improve safety in providing a fully supported baseline.

Acorn plugins can be a pain to use due to the indirect plugin injection system, version mismatch issues and conventions and lack of support and maintenance from the Acorn ecosystem. Acorn has been historically over-conservative, and will continue to be so this would help users a lot to simply provide this support out of the box.

For example, static class fields is almost impossible to set up currently despite being a feature shipping in Chrome - it should always be possible to ship JS from Rollup that Chrome supports!

Feature Proposal

The proposal is to include by default numeric separators and static class fields for now, even though Acorn core doesn't ship with these by default. Then to update this list to match what is shipping in browsers.

This feature could be opt-in or opt-out to use only full ECMA-262 stability.

@lukastaegert
Copy link
Member

Yes. In the past this was not a problem as acorn was usually quick to support stage 4. I guess we need to take this into our own hands now... PR welcome.

@lukastaegert
Copy link
Member

lukastaegert commented Mar 31, 2020

I would make it neither opt-in nor opt-out. I do not see any issues for people not using these features, and options always have their own maintenance fee.

@lukastaegert
Copy link
Member

Then to update this list to match what is shipping in browsers

This would basically also add some stage-3 features. Not sure about that.

@guybedford
Copy link
Contributor Author

I'd be glad to add them, but currently don't know how to. I just tried to configure https://github.com/acornjs/acorn-class-fields and https://www.npmjs.com/package/acorn-static-class-features but both throw due to being for the v6 version of Acorn.

Maybe @adrianheine might have suggestions here.

Yes not all stage3 is necessary, but I think there's a sort of user-consensus that can be found on what to include.

@lukastaegert
Copy link
Member

Well, I think THAT is the reason why they are not part of acorn yet...

@guybedford
Copy link
Contributor Author

First step: acornjs/acorn-class-fields#8

Next problem is that Acorn is required as a peer dependencies in these libraries - another argument for building this stuff into rollup.

@lukastaegert
Copy link
Member

True, a "correct" fix would require a rework of these plugins to use the acorn instance that is passed in instead of requiring it, and that would still not solve the issue of the plugin-interdependency.

@guybedford
Copy link
Contributor Author

Looks like progress is being made here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants