Skip to content

Conversation

@liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented May 13, 2024

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

@babel-bot
Copy link
Collaborator

babel-bot commented May 13, 2024

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, {
Copy link
Member

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>;

Comment on lines 258 to 265
...(!process.env.BABEL_8_BREAKING && !USE_ESM
? {
arrowFunctionToShadowed:
// workaround for rollup
// @ts-expect-error babel 7 only
NodePath_conversion[String("arrowFunctionToShadowed")],
}
: {}),
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo May 13, 2024

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.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a 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?

@liuxingbaoyu
Copy link
Member Author

Sure! I'm a little unsure if anyone is using methods starting with _, but it probably doesn't matter.

@nicolo-ribaudo
Copy link
Member

Well _ usually means "private" -- if they need it they can open an issue and we can talk about making it part of the public API.

@nicolo-ribaudo
Copy link
Member

Could you rebase this on top of main and make sure that it still type checks properly? :)

@liuxingbaoyu
Copy link
Member Author

liuxingbaoyu commented May 15, 2024

The CI failure is from node v22.2.0.

Ref: nodejs/node#52827

Reported in nodejs/node#53011

@nicolo-ribaudo nicolo-ribaudo changed the title Explicitly define path.prototype.* Explicitly define NodePath.prototype.* May 16, 2024
@nicolo-ribaudo nicolo-ribaudo merged commit 1f010df into babel:main May 16, 2024
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 16, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2024
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants