styled-components / babel-plugin-styled-components

Improve the debugging experience and add server-side rendering support to styled-components
MIT License
1.07k stars 141 forks source link

Use picomatch instead of regex #369

Closed rockwotj closed 2 years ago

rockwotj commented 2 years ago

Honestly should have done this in https://github.com/styled-components/babel-plugin-styled-components/pull/354 but I didn't realize you could match relative path patterns using picomatch.

agriffis commented 2 years ago

Apart from my minor question about the test above, this looks great to me.

agriffis commented 2 years ago

As mentioned in #368, this will need to bump the major version of the plugin. Additionally we might want to consider changing the dep string in styled-components for the macro to ^1 || ^3 or along those lines.

agriffis commented 2 years ago

Rounding up some of the issues that will be fixed by this:

https://github.com/styled-components/styled-components/issues/3635 https://github.com/styled-components/styled-components/issues/3645 https://github.com/styled-components/babel-plugin-styled-components/issues/350

esetnik commented 2 years ago

Looks great to me. Thanks for the proper solution @rockwotj. What's left to get this merged?

agriffis commented 2 years ago

Just need to get @probablyup to notice it :eyes:

agriffis commented 2 years ago

Interesting, I thought you'd want to bump the major version for this. I suppose there probably aren't that many people relying on the regex matching, though, and this change will fix problems for a bunch of people (especially people using the macro), so maybe it's for the best.

davidcostadev commented 2 years ago

OMG, this fixed my issue, thanks! I'm using it for displayNames on the react-scripts env <3