Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[
"@babel/preset-env",
{
"modules": "commonjs",
"targets": {
"node": 12
}
Expand Down
5 changes: 5 additions & 0 deletions .changeset/support-babel-8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'babel-plugin-styled-components': minor
---

Support Babel 8. The plugin now installs alongside `@babel/core@8` without peer dependency warnings or errors, and the `css` prop transform no longer crashes with `t.jSXIdentifier is not a function` on Babel 8. The plugin also no longer depends on `@babel/plugin-syntax-jsx`, which only accepted Babel 7 as a peer. Babel 7 output is unchanged.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ jobs:

- name: Run tests
run: pnpm test

- name: Run fixtures on Babel 8
run: pnpm build && pnpm test:babel8
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Commands
- `pnpm exec jest -u`: regenerate fixture outputs, only after the snapshot-drift rule below is satisfied
- `pnpm exec jest --coverage`: prints live coverage
- `pnpm build`: compile `src/` to `lib/`; run it to verify every set of changes. Don't start a dev server unless asked
- `pnpm test:babel8`: the built `lib/` over the fixtures on Babel 8, outside Jest because Babel 8 is ESM-only; run `pnpm build` first
- `pnpm bench [--base <ref>] [--config default|all|bare] [--rounds N] [--normalize-aliases]`: interleaved A/B of the plugin at `<ref>` (default `origin/main`) against the working tree over generated inputs; fails when outputs differ
- `pnpm bench:profile [--input small|medium|large|large-cjs]`: CPU profile with the plugin frames that drive Babel's work
- `node scripts/compat.js [--base <ref>]`: styled-components v5, v6, and v7 prerelease smoke against the working tree and `<ref>` (default `origin/main`)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This plugin is a highly recommended supplement to the base styled-components lib

This plugin is tested against:

- `@babel/core` `^7`
- `@babel/core` `^7` and `^8`
- `styled-components` `>= 6` (earlier majors may still work but aren't exercised in CI)

## Quick start
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
"devDependencies": {
"@babel/cli": "^7.26.4",
"@babel/core": "^7.26.0",
"@babel/plugin-syntax-jsx": "^7.28.6",
"@babel/plugin-transform-class-properties": "^7.25.9",
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
"@babel/preset-env": "^7.26.0",
"@changesets/cli": "2.31.0",
"babel-test": "^0.2.4",
"babel8": "npm:@babel/core@^8.0.9",
"babel8-preset-typescript": "npm:@babel/preset-typescript@^8",
"jest": "^29.7.0",
"jest-file-snapshot": "^0.5.0",
"prettier": "^3.4.2",
Expand All @@ -37,18 +40,18 @@
"dependencies": {
"@babel/helper-annotate-as-pure": "^7.25.9",
"@babel/helper-module-imports": "^7.25.9",
"@babel/plugin-syntax-jsx": "^7.25.9",
"picomatch": "^4.0.2"
},
"peerDependencies": {
"@babel/core": "^7.0.0",
"@babel/core": "^7.0.0 || ^8.0.0",
"styled-components": ">= 2"
},
"scripts": {
"clean": "rimraf lib",
"style": "prettier --write src/**/*.js",
"build": "babel src -d lib",
"test": "jest",
"test:babel8": "node scripts/babel8.js",
"test:watch": "pnpm test -- --watch",
"bench": "node scripts/bench/index.js",
"bench:profile": "node scripts/bench/profile.js",
Expand Down
Loading