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

commented Apr 16, 2019

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?

@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Apr 16, 2019

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

@benjamn
Copy link
Contributor

left a comment

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

@danez
danez approved these changes Apr 17, 2019
@mlrawlings

This comment has been minimized.

Copy link

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.

@hzoo
hzoo approved these changes Jun 12, 2019
Copy link
Member

left a comment

👍, docs on this too

@benjamn

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member Author

commented Jun 18, 2019

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

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

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
Tolerate undeclared exports until @babel/parser@7.5.0 is released.
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

This comment has been minimized.

Copy link
Contributor

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
Tolerate undeclared exports until @babel/parser@7.5.0 is released. (#230
)

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

5 checks passed

babel/repl REPL preview is available
Details
buildsize No significant change
Details
ci/circleci Your tests passed on CircleCI!
Details
codecov/project 87.32% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@nicolo-ribaudo nicolo-ribaudo deleted the nicolo-ribaudo:parser-allowUndeclaredExports branch Jun 30, 2019

nicolo-ribaudo added a commit to babel/website that referenced this pull request Jul 4, 2019
docs(@babel/parser): Document allowUndeclaredExports option. (#2047)
* 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
Remove comment about now-released @babel/parser@7.5.0.
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
Remove tolerantParse workaround from parser.js.
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.
eventualbuddha added a commit to eventualbuddha/babel that referenced this pull request Jul 24, 2019
Add `allowUndeclaredExports` option to typings.
This should have been included in babel#9864 but was not.
nicolo-ribaudo added a commit that referenced this pull request Jul 25, 2019
Add `allowUndeclaredExports` option to typings. (#10263)
This should have been included in #9864 but was not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.