Skip to content

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

Closes #15042, closes #11118, closes #9924

I still dislike the idea of adding a dependency that is only needed for type-checking and not at runtime, but:

  • TS is so popular that at this point a "type dependency" can be considered the same as a runtime dependency
  • We are publishing .d.ts for @babel/parser already in v7, but it's broken because of the missing dep
  • We are going to make TS first-class in Babel 8

So here we are.

Co-authored-by: Spencer Elliott <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: merceyz <[email protected]>
@nicolo-ribaudo nicolo-ribaudo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Jul 29, 2024
@nicolo-ribaudo nicolo-ribaudo force-pushed the babel-parser-types-dep branch from 853d023 to d154c71 Compare July 29, 2024 13:39
@babel-bot
Copy link
Collaborator

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

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.

If we can get rid of the parser's node clone method in Babel 8, we can consider using the babel types node builder to create AST nodes directly, which will make @babel/types a runtime dependency. This approach should be better than our current approach where a blanket node is assigned with random new properties depending on different AST types.

@nicolo-ribaudo
Copy link
Member Author

nicolo-ribaudo commented Jul 29, 2024

I like that currently @babel/parser is a single ESM file with no deps, so it can trivially loaded in browsers, but yes we should think about it.

@nicolo-ribaudo nicolo-ribaudo merged commit 782e0ea into babel:main Jul 30, 2024
@nicolo-ribaudo nicolo-ribaudo deleted the babel-parser-types-dep branch July 30, 2024 11:44
@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 Oct 30, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 30, 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 pkg: parser PR: Internal 🏠 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants