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/parser] Add "allowUndeclaredExports" option #9864

Merged

Conversation

nicolo-ribaudo
Copy link
Member

Q                       A
Fixed Issues? #9720 (comment)
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Ref: https://github.com/babel/notes/blob/master/2019/04/09.md#export-changes-in-scope-pr-break-meteor-issue

cc @benjamn Would this work for meteor?

@nicolo-ribaudo nicolo-ribaudo added PR: New Feature 🚀 A type of pull request used for our changelog categories pkg: parser labels Apr 16, 2019
@babel-bot
Copy link
Collaborator

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

Copy link
Contributor

@benjamn benjamn left a comment

Choose a reason for hiding this comment

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

This works for me (and for Meteor)! Thanks @nicolo-ribaudo!

@nicolo-ribaudo nicolo-ribaudo added this to the v7.5.0 milestone Apr 26, 2019
@nicolo-ribaudo nicolo-ribaudo added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label Apr 27, 2019
@mlrawlings
Copy link

mlrawlings commented Jun 11, 2019

We (Marko) are working on integrating babel to parse the JavaScript sections of our templates.
In many cases we are parsing statements and expressions in isolation, where they may not be valid on their own. We were also broken by #9589 and were a bit surprised by that coming in a minor release. This PR fixes the immediate issue, but something like loose mode would be useful so we wouldn't have to worry about early errors in the future.

Copy link
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

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

👍, docs on this too

@benjamn
Copy link
Contributor

benjamn commented Jun 18, 2019

Anything I can do to move this along? Happy to write the docs if I can get a quick checklist of places to look. 🙏

@nicolo-ribaudo
Copy link
Member Author

I'm writing the release blog post, hopefully I will release this PR in the following days.

Happy to write the docs if I can get a quick checklist of places to look.

❤️ ❤️ ❤️
It should be documented at https://github.com/babel/website/blob/master/docs/parser.md

benjamn added a commit to benjamn/website that referenced this pull request Jun 18, 2019
@benjamn
Copy link
Contributor

benjamn commented Jun 18, 2019

@nicolo-ribaudo done!

benjamn added a commit to benjamn/website that referenced this pull request Jun 18, 2019
benjamn added a commit to benjamn/reify that referenced this pull request Jun 20, 2019
babel/babel#9864

This hack narrowly targets @babel/parser@7.4.x by tricking
Array.from(this.scope.undefinedExports) into returning an empty array,
thereby simulating the effect of enabling the allowUndeclaredExports
option (which will become available in @babel/parser@7.5.0).
@benjamn
Copy link
Contributor

benjamn commented Jun 20, 2019

If you need any additional motivation to get this shipped, check out the unholy workaround I came up with in benjamn/reify#230. 😉

benjamn added a commit to benjamn/reify that referenced this pull request Jun 20, 2019
)

babel/babel#9864

This hack narrowly targets @babel/parser@7.4.x by tricking
Array.from(this.scope.undefinedExports) into returning an empty array,
thereby simulating the effect of enabling the allowUndeclaredExports
option (which will become available in @babel/parser@7.5.0).
@nicolo-ribaudo nicolo-ribaudo merged commit ca67637 into babel:master Jun 30, 2019
@nicolo-ribaudo nicolo-ribaudo deleted the parser-allowUndeclaredExports branch June 30, 2019 09:16
nicolo-ribaudo pushed a commit to babel/website that referenced this pull request Jul 4, 2019
* docs(@babel/parser): Document allowUndeclaredExports option.

Documents the changes from babel/babel#9864
implemented by @nicolo-ribaudo.

* Clarify when allowUndeclaredExports is intended to be used.
benjamn added a commit to benjamn/reify that referenced this pull request Jul 4, 2019
After updating @babel/parser to version 7.5.0, I can verify that the
monkey-patching changes in PR #230 are no longer necessary, though it
doesn't hurt to leave them in place, since the interception logic is
restricted to versions in the 7.4.x range.

The allowUndeclaredExports option is now required, as anticipated:
babel/babel#9864
benjamn added a commit to meteor/babel that referenced this pull request Jul 4, 2019
Now that @babel/parser@7.5.0 is out, we no longer need to simulate the
effect of babel/babel#9864.

See also benjamn/reify#230.
nicolo-ribaudo pushed a commit that referenced this pull request Jul 25, 2019
This should have been included in #9864 but was not.
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants