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

Move environment-visitor helper into @babel/traverse #16577

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicolo-ribaudo
Copy link
Member

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

I'm working on removing cycles between packages caused by type-only imports. My motivation is that, even if it's a type-only import, it's an actual conceptual cycle and those packages will always be used together anyway. For example:

  • @babel/traverse depends on @babel/helper-environment-visitor
  • @babel/helper-environment-visitor does not explicitly depend @babel/traverse, but it can only be used on NodePaths so it can only be used when @babel/traverse

This has two benefits:

  • when publishing TS types we'll need to mark them as actual dependencies, and having cycles between packages causes problems
  • we reduce the number of packages

@nicolo-ribaudo nicolo-ribaudo added this to the v7.25.0 milestone Jun 19, 2024
@nicolo-ribaudo nicolo-ribaudo added the PR: New Feature 🚀 A type of pull request used for our changelog categories label Jun 19, 2024
@babel-bot
Copy link
Collaborator

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

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

I recall previously we imported the traverse from their peer dependent @babel/core because of compatibility issues. Specifically we want the core, even if it is an old version, to explode any AST alias so that the traverser, imported from core, will not complain about any new AST types beyond its knowledge.

Now that visitors.environmentVisitor will explode the visitors via merge from the latest traverse, maybe we have to defer this change to Babel 8?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: New Feature 🚀 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants