FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add `@babel/types` as a dependency of `@babel/parser` by nicolo-ribaudo · Pull Request #16688 · babel/babel · GitHub

/ babel Public

Add @babel/types as a dependency of @babel/parser - #16688

Merged
nicolo-ribaudo merged 1 commit into
babel:mainfrom
nicolo-ribaudo:babel-parser-types-dep
Jul 30, 2024
Merged

nicolo-ribaudo merged 1 commit into
babel:mainfrom
nicolo-ribaudo:babel-parser-types-dep

Conversation

Copy link
Copy Markdown
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 <me@elliottsj.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Co-authored-by: merceyz <merceyz@users.noreply.github.com>
nicolo-ribaudo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Jul 29, 2024
nicolo-ribaudo force-pushed the babel-parser-types-dep branch from 853d023 to d154c71 Compare July 29, 2024 13:39

Copy link
Copy Markdown
Collaborator

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

JLHwung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 commented Jul 29, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

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 merged commit 782e0ea into babel:main Jul 30, 2024
nicolo-ribaudo deleted the babel-parser-types-dep branch July 30, 2024 11:44
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 Bot locked as resolved and limited conversation to collaborators Oct 30, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL