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
Make @babel/plugin-class-features a normal helper package #9083
Make @babel/plugin-class-features a normal helper package #9083
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9487/ |
@@ -1,5 +1,5 @@ | |||
{ | |||
"name": "@babel/plugin-class-features", | |||
"name": "@babel/helper-class-features-plugin", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe @babel/helper-create-class-feature-plugin
or @babel/helper-class-feature-factory
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the first name 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@babel/helper-create-class-feature-plugin
👍
packages/babel-helper-create-class-features-plugin/src/index.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome, it's a good idea. It seems weird to have another way to turn on a plugin (otherwise I would move all experimental features into the same plugin). Each plugin is separately turned on in a consistent way this way.
return { | ||
name: "class-features", | ||
name: "class-features/" + name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather keep the names consistent with the other plugins. Maybe we can delete this line and have the plugin do:
return {
name: "...",
...createClassFeaturePlugin({ /* ... */ })
};
?
This effectively disallows using it directly.
3ac73e3
to
1f53808
Compare
This is a better alternative to #9050.
This PR removes the
@babel/plugin-class-features
package, which becames@babel/helper-create-class-features-plugin
and can only be used inside other plugins.The problem with the
@babel/plugin-class-features
plugin is that, in order to allow using@babel/plugin-proposal-class-properties
, etc., it behaves differently when declared multiple times:For any other plugin, the last specified options override the others, but in this case they are merged.
In #9050 I removed direct options to that plugin, but it doesn't make sense to allow using it as
plugins: ["@babel/plugin-class-features"]
since it does nothing.