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

Inline one-line syntax plugins #16824

Merged

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 was looking at the install size of our packages, and I noticed that we can easily reduce it by a bit. Currently many transform plugins depend on their corresponding syntax plugin, which weight roughtly 1.4kB when compressed (size of https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz) and 2.5kB when unpacked (according to npm view @babel/plugin-syntax-object-rest-spread).

Most of those plugins can be inlined into a single line, reducing their effective size to a few bytes. This PR inlines all usages of trivial syntax plugins. I still left the current transform/syntax plugin split for syntax plugins that are non trivial, for example because they validate options or interact with other syntax plugins.

@nicolo-ribaudo nicolo-ribaudo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Sep 9, 2024
@babel-bot
Copy link
Collaborator

babel-bot commented Sep 9, 2024

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

Copy link
Member

@liuxingbaoyu liuxingbaoyu left a comment

Choose a reason for hiding this comment

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

This looks great!

@nicolo-ribaudo nicolo-ribaudo requested a review from JLHwung October 9, 2024 10:55
@nicolo-ribaudo nicolo-ribaudo merged commit a6b0f54 into babel:main Oct 9, 2024
52 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the inline-easy-syntax-plugins branch October 9, 2024 12:01
@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 Jan 9, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 9, 2025
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 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