Repository navigation
Minifier and import-detection fixes, faster transforms, pnpm 12 #429
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
06d2240
fix(minify): track strings and parens the way the runtime does
quantizor 939d707
build: move to pnpm 12 with the global virtual store, scope jest to t…
quantizor 71f52df
perf(detectors): find styled-components imports by scanning the progr…
quantizor 9aa0e0a
perf(css-prop): inject one styled-components default import per file
quantizor 96bff0e
perf(displayNameAndId): check whether a callee is styled once per call
quantizor 0402da3
perf(options): compile topLevelImportPaths matchers once per config
quantizor 6081b1d
chore(bench): add an A/B benchmark and profiler
quantizor 0f548ae
fix(detectors): ignore imports inside ambient module declarations
quantizor 077af23
fix(detectors): track namespace imports apart from the default import…
quantizor 051da43
fix(detectors): decorate styled.default(Component) call forms
quantizor a99a6d6
fix(detectors): ignore type-only styled-components imports
quantizor 4e7685a
fix(css-prop): track the default binding injected as a require in scr…
quantizor f8c4928
fix(detectors): use the real local name for required and aliased styl…
quantizor f5e7ade
test: snapshot fixture errors without machine paths
quantizor 8bc1644
ci: run tests on Windows with a per-project store and keep checkouts LF
quantizor 6c23a38
style: format src with prettier
quantizor 4a48ca7
docs(agents): distill agent instructions and record this branch's rules
quantizor 33c6157
docs(agents): avoid snapshot churn, note the css-prop numbering edge
quantizor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'babel-plugin-styled-components': patch | ||
| --- | ||
|
|
||
| Fix a crash when the `css` prop is used in a CommonJS file without a `styled-components` import. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'babel-plugin-styled-components': patch | ||
| --- | ||
|
|
||
| Faster transforms: the plugin's own time drops about 2–4× on typical files and up to ~28× on CommonJS files with many `css` props. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'babel-plugin-styled-components': patch | ||
| --- | ||
|
|
||
| Fix components losing displayName and componentId when a `declare module` block also imports `styled-components`. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'babel-plugin-styled-components': patch | ||
| --- | ||
|
|
||
| Ignore `import type` from `styled-components` when finding the real `styled` import. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'babel-plugin-styled-components': patch | ||
| --- | ||
|
|
||
| Fix `styled.default.x` losing displayName and componentId with `import * as styled` alongside the css prop or a default import. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'babel-plugin-styled-components': patch | ||
| --- | ||
|
|
||
| Fix broken output for `styled.default(Component)` with `import * as styled` or `require`. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'babel-plugin-styled-components': patch | ||
| --- | ||
|
|
||
| Recognize `styled` under any local name, such as `import { styled as sc }` or `const sc = require('styled-components')`. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'babel-plugin-styled-components': patch | ||
| --- | ||
|
|
||
| Fix minification dropping rules after a commented line whose string contains an apostrophe, escaped quote, or parenthesis (e.g. `content: "it's"; // note`). |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * text=auto eol=lf |
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| diff --git a/src/index.js b/src/index.js | ||
| index cfe5f4f399845caba48b245b953194dc02d11a81..32edeacdb7dffca0fa5a2233df4f4291d6b5e842 100644 | ||
| --- a/src/index.js | ||
| +++ b/src/index.js | ||
| @@ -191,13 +191,22 @@ exports.create = function create(config) { | ||
| filename: error, | ||
| // Errors might have ansi colors, for example babel codeframe error | ||
| // Strip them so the error is more readable | ||
| - // Also replace the current working directory with a placeholder | ||
| - // This makes sure that the stacktraces are same across machines | ||
| + // Snapshot the message (which carries Babel's code frame), not the | ||
| + // stack: stack frames point into dependency installs outside the | ||
| + // working directory and change with every dependency release. | ||
| + // Also replace the current working directory with a placeholder, in | ||
| + // either separator style and any drive-letter case, and write the | ||
| + // rest of each such path with forward slashes so Windows matches | ||
| content: | ||
| - stripAnsi(e.stack).replace( | ||
| - new RegExp(escapeRegexp(process.cwd()), 'g'), | ||
| - '<cwd>' | ||
| - ) + '\n', | ||
| + stripAnsi(String(e)) | ||
| + .replace( | ||
| + new RegExp( | ||
| + escapeRegexp(process.cwd()).replace(/\\\\|\//g, '[\\\\/]'), | ||
| + 'gi' | ||
| + ), | ||
| + '<cwd>' | ||
| + ) | ||
| + .replace(/<cwd>[^\s:]*/g, (p) => p.replace(/\\/g, '/')) + '\n', | ||
| stack, | ||
| }; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.