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
Export @babel/parser#tokTypes in @babel/core #8986
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9471/ |
Doesn't |
Oh nvm, I saw the babel-eslint pr |
@nicolo-ribaudo For the PR I'm working on, all I actually need is I do think it's weird/confusing to have |
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.
Missing documentation on the website, but LGTM, thanks
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.
We should document it under advanced documentation or not document it in my opinion, because babelCore.parse
and babelCore.parser.parse
do different things in terms of config, and I could see people getting confused about this.
Revisiting this after my one-off comment that prompted this, I'm concerned because everything we add to the root by default is exposed in plugins/presets on the I'm not necessarily against this being exported from |
I agree with Logan, and I'm not a big fan of this implicitly exposed API. Would it be possible to change the API to be a fixed object? and then you can expose the parse function. |
@xtuc For this PR I actually need access to |
I would greatly appreciate being able to use the parser in a transform without needing an explicit dependency on it; it would be great to find a way to do that. |
As @ljharb mentioned, exposing the parser in a transform and correctly configured does solve a problem. I would be in favor of leaving this open for discussion, because we should figure a way to do it I guess. |
Actually, seems like an issue would be a better way to track this discussion. At this point, I'm not going to pursue this change since it's not necessary for the babel-eslint PR. |
@kaicataldo Can we just re-export
|
60667e2
to
63a6a9b
Compare
63a6a9b
to
08734cc
Compare
@loganfsmyth Apologies for the delay - PR updated. |
This exposes
@babel/parser
in@babel/core
, as proposed here. Figured it would be best to just make a PR that we could discuss on :) I wasn't sure if testing deeper than this would be worth it or not, given it would have to change any time@babel/parser
's API changes, but happy to update as the team sees fit. Thanks!