Skip to content
Merged
Show file tree
Hide file tree
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 Oct 22, 2026
939d707
build: move to pnpm 12 with the global virtual store, scope jest to t…
quantizor Oct 22, 2026
71f52df
perf(detectors): find styled-components imports by scanning the progr…
quantizor Oct 22, 2026
9aa0e0a
perf(css-prop): inject one styled-components default import per file
quantizor Oct 22, 2026
96bff0e
perf(displayNameAndId): check whether a callee is styled once per call
quantizor Oct 22, 2026
0402da3
perf(options): compile topLevelImportPaths matchers once per config
quantizor Oct 22, 2026
6081b1d
chore(bench): add an A/B benchmark and profiler
quantizor Oct 22, 2026
0f548ae
fix(detectors): ignore imports inside ambient module declarations
quantizor Oct 22, 2026
077af23
fix(detectors): track namespace imports apart from the default import…
quantizor Oct 22, 2026
051da43
fix(detectors): decorate styled.default(Component) call forms
quantizor Oct 22, 2026
a99a6d6
fix(detectors): ignore type-only styled-components imports
quantizor Oct 22, 2026
4e7685a
fix(css-prop): track the default binding injected as a require in scr…
quantizor Oct 22, 2026
f8c4928
fix(detectors): use the real local name for required and aliased styl…
quantizor Oct 22, 2026
f5e7ade
test: snapshot fixture errors without machine paths
quantizor Oct 22, 2026
8bc1644
ci: run tests on Windows with a per-project store and keep checkouts LF
quantizor Oct 22, 2026
6c23a38
style: format src with prettier
quantizor Oct 22, 2026
4a48ca7
docs(agents): distill agent instructions and record this branch's rules
quantizor Oct 22, 2026
33c6157
docs(agents): avoid snapshot churn, note the css-prop numbering edge
quantizor Oct 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/css-prop-script-mode.md
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.
5 changes: 5 additions & 0 deletions .changeset/faster-transforms.md
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.
Comment thread
quantizor marked this conversation as resolved.
5 changes: 5 additions & 0 deletions .changeset/ignore-ambient-module-imports.md
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`.
5 changes: 5 additions & 0 deletions .changeset/ignore-type-only-imports.md
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.
5 changes: 5 additions & 0 deletions .changeset/keep-namespace-import-recognized.md
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.
5 changes: 5 additions & 0 deletions .changeset/namespace-default-call-form.md
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`.
5 changes: 5 additions & 0 deletions .changeset/real-styled-binding-names.md
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')`.
5 changes: 5 additions & 0 deletions .changeset/string-aware-minify.md
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`).
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
runs-on: ubuntu-latest
env:
PNPM_CONFIG_VIRTUAL_STORE_TYPE: project
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v6.1.0

- uses: actions/setup-node@v4
with:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
env:
PNPM_CONFIG_VIRTUAL_STORE_TYPE: project
strategy:
matrix:
os: [ubuntu-latest]
node: ["22", "24"]
include:
- os: windows-latest
node: "24"
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v6.1.0

- name: Setup node
uses: actions/setup-node@v4
Expand Down
109 changes: 83 additions & 26 deletions AGENTS.md

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"build": "babel src -d lib",
"test": "jest",
"test:watch": "pnpm test -- --watch",
"bench": "node scripts/bench/index.js",
"bench:profile": "node scripts/bench/profile.js",
"prepublishOnly": "pnpm clean && pnpm build",
"changeset": "changeset",
"changeset-publish": "pnpm build && changeset publish"
Expand All @@ -60,6 +62,9 @@
"displayName"
],
"jest": {
"roots": [
"<rootDir>/test"
],
"testEnvironment": "node",
"snapshotSerializers": [
"<rootDir>/test/whitespaceTrimmingSerializer.js"
Expand All @@ -68,5 +73,5 @@
"fixtures\\/[^/]+\\/(output|error)\\.js"
]
},
"packageManager": "pnpm@11.1.3"
"packageManager": "pnpm@12.14.0"
}
33 changes: 33 additions & 0 deletions patches/babel-test@0.2.4.patch
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,
};
}
Loading
Loading