-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Explicitly define NodePath.prototype.*
#16488
Conversation
liuxingbaoyu
commented
May 13, 2024
•
edited
Loading
edited
Q | A |
---|---|
Fixed Issues? | Ref: #16443 |
Patch: Bug Fix? | |
Major: Breaking Change? | |
Minor: New Feature? | |
Tests Added + Pass? | Yes |
Documentation PR Link | |
Any Dependency Changes? | |
License | MIT |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/56905 |
NodePath_family, | ||
NodePath_comments, | ||
); | ||
Object.assign(NodePath_Final.prototype, { |
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.
Thanks! Could you declare this object outside of Object.assign
, and then use it for NodePathMixins
below so that they use the same data source?
const methods = {
findParent: findParent: NodePath_ancestry.findParent,
// ...
}
Object.assign(NodePath_Final.prototype, methods);
type NodePathMixins = Omit<typeof methods, keyof NodePathOverwrites>;
...(!process.env.BABEL_8_BREAKING && !USE_ESM | ||
? { | ||
arrowFunctionToShadowed: | ||
// workaround for rollup | ||
// @ts-expect-error babel 7 only | ||
NodePath_conversion[String("arrowFunctionToShadowed")], | ||
} | ||
: {}), |
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.
Please keep this in a separate statement, otherwise TS will include its type also in the Babel 8 build.
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.
Thanks!
After this, could you open a new PR removing in Babel 8
- all the methods that start in
_
- all the methods that are not used outside of
@babel/traverse
?
Sure! I'm a little unsure if anyone is using methods starting with |
Well |
Could you rebase this on top of |
6a98195
to
7846fca
Compare
The CI failure is from node v22.2.0. Ref: nodejs/node#52827 Reported in nodejs/node#53011 |
path.prototype.*
NodePath.prototype.*