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
feat: macro can customize importModuleName #3422
feat: macro can customize importModuleName #3422
Conversation
@@ -66,7 +66,7 @@ | |||
"@babel/traverse": "^7.4.5", | |||
"@emotion/is-prop-valid": "^0.8.8", | |||
"@emotion/unitless": "^0.7.4", | |||
"babel-plugin-styled-components": ">= 1", | |||
"babel-plugin-styled-components": "^1.12.0", |
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'd prefer to continue using the >=
notation so we don't have to update the library here if v2 comes out that doesn't contain incompatible changes with styled-components core
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.
np, will force push that change
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.
Code looks great to me! If you could make that one change and write up a short changelog entry, that would be much appreciated.
c1aaffb
to
18d8c32
Compare
If `styled` should come from a wrapper instead of directly from styled-components, this enables users of the macro to customize the import by configuring in `packages.json`: "babelMacros": { "styledComponents": { "importModuleName": "my-styled-components" } } Previously similar functionality landed in babel-plugin-styled-components so users of the plugin could use a wrapper at that level, but it wasn't available to users of the macro. This builds on that work by passing the customized module name through to the plugin. Consequently we also update the dependency to ensure the plugin supports `topLevelImportPaths` See styled-components/babel-plugin-styled-components@325167b Fixes styled-components/xstyled#44
18d8c32
to
83c8b0c
Compare
@probablyup That should be all set now. I force-pushed twice because I hadn't run yarn the first time, so Would you mind cherry-picking this to |
Another PR please |
See #3432, thanks! |
If
styled
should come from a wrapper instead of directly fromstyled-components, this enables users of the macro to customize the
import by configuring in
packages.json
:Previously similar functionality landed in
babel-plugin-styled-components so users of the plugin could use
a wrapper at that level, but it wasn't available to users of the macro.
This builds on that work by passing the customized module name through
to the plugin. Consequently we also update the dependency to ensure the
plugin supports
topLevelImportPaths
See styled-components/babel-plugin-styled-components@325167b
Fixes styled-components/xstyled#44