Skip to content

Commit 4e172c2

Browse files
authoredFeb 16, 2023
Remove peer dependency on @babel/core from most packages (#2985)
1 parent 88ce707 commit 4e172c2

File tree

9 files changed

+25
-66
lines changed

9 files changed

+25
-66
lines changed
 

‎.changeset/healthy-squids-wait.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@emotion/babel-plugin': patch
3+
'@emotion/css': patch
4+
'@emotion/native': patch
5+
'@emotion/primitives': patch
6+
'@emotion/react': patch
7+
'@emotion/styled': patch
8+
---
9+
10+
Remove peer dependency on `@babel/core`

‎packages/babel-plugin/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
],
1919
"dependencies": {
2020
"@babel/helper-module-imports": "^7.16.7",
21-
"@babel/plugin-syntax-jsx": "^7.17.12",
2221
"@babel/runtime": "^7.18.3",
2322
"@emotion/hash": "^0.9.0",
2423
"@emotion/memoize": "^0.8.0",
@@ -30,9 +29,6 @@
3029
"source-map": "^0.5.7",
3130
"stylis": "4.1.3"
3231
},
33-
"peerDependencies": {
34-
"@babel/core": "^7.0.0"
35-
},
3632
"devDependencies": {
3733
"@babel/core": "^7.18.5",
3834
"babel-check-duplicated-nodes": "^1.0.0"

‎packages/babel-plugin/src/index.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// @flow
2-
import syntaxJsx from '@babel/plugin-syntax-jsx'
32
import {
43
createEmotionMacro,
54
transformers as vanillaTransformers
@@ -90,7 +89,21 @@ export default function (babel: *, options: *) {
9089
let t = babel.types
9190
return {
9291
name: '@emotion',
93-
inherits: syntaxJsx,
92+
// https://github.com/babel/babel/blob/0c97749e0fe8ad845b902e0b23a24b308b0bf05d/packages/babel-plugin-syntax-jsx/src/index.ts#L9-L18
93+
manipulateOptions(opts: *, parserOpts: *) {
94+
const { plugins } = parserOpts
95+
96+
if (
97+
plugins.some(p => {
98+
const plugin = Array.isArray(p) ? p[0] : p
99+
return plugin === 'typescript' || plugin === 'jsx'
100+
})
101+
) {
102+
return
103+
}
104+
105+
plugins.push('jsx')
106+
},
94107
visitor: {
95108
ImportDeclaration(path: *, state: *) {
96109
const macro = state.pluginMacros[path.node.source.value]

‎packages/css/package.json

-9
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,7 @@
2424
"@emotion/sheet": "^1.2.1",
2525
"@emotion/utils": "^1.2.0"
2626
},
27-
"peerDependencies": {
28-
"@babel/core": "^7.0.0"
29-
},
30-
"peerDependenciesMeta": {
31-
"@babel/core": {
32-
"optional": true
33-
}
34-
},
3527
"devDependencies": {
36-
"@babel/core": "^7.18.5",
3728
"@definitelytyped/dtslint": "0.0.112",
3829
"typescript": "^4.5.5"
3930
},

‎packages/native/package.json

-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
],
2424
"types": "types/index.d.ts",
2525
"devDependencies": {
26-
"@babel/core": "^7.18.5",
2726
"@definitelytyped/dtslint": "0.0.112",
2827
"@types/react-native": "^0.63.2",
2928
"react": "16.14.0",
@@ -34,14 +33,8 @@
3433
"@emotion/primitives-core": "^11.10.0"
3534
},
3635
"peerDependencies": {
37-
"@babel/core": "^7.0.0",
3836
"react-native": ">=0.14.0 <1"
3937
},
40-
"peerDependenciesMeta": {
41-
"@babel/core": {
42-
"optional": true
43-
}
44-
},
4538
"homepage": "https://emotion.sh",
4639
"license": "MIT",
4740
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/native",

‎packages/primitives/package.json

-7
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,10 @@
1414
"@emotion/primitives-core": "^11.10.0"
1515
},
1616
"peerDependencies": {
17-
"@babel/core": "^7.0.0",
1817
"react": ">=16.8.0",
1918
"react-primitives": "^0.8.1"
2019
},
21-
"peerDependenciesMeta": {
22-
"@babel/core": {
23-
"optional": true
24-
}
25-
},
2620
"devDependencies": {
27-
"@babel/core": "^7.18.5",
2821
"enzyme": "^3.11.0",
2922
"enzyme-adapter-react-16": "^1.15.5",
3023
"react": "16.14.0",

‎packages/react/package.json

-5
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,14 @@
7272
"hoist-non-react-statics": "^3.3.1"
7373
},
7474
"peerDependencies": {
75-
"@babel/core": "^7.0.0",
7675
"react": ">=16.8.0"
7776
},
7877
"peerDependenciesMeta": {
79-
"@babel/core": {
80-
"optional": true
81-
},
8278
"@types/react": {
8379
"optional": true
8480
}
8581
},
8682
"devDependencies": {
87-
"@babel/core": "^7.18.5",
8883
"@definitelytyped/dtslint": "0.0.112",
8984
"@emotion/css": "11.10.5",
9085
"@emotion/css-prettifier": "1.1.1",

‎packages/styled/package.json

-5
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,15 @@
1919
"@emotion/utils": "^1.2.0"
2020
},
2121
"peerDependencies": {
22-
"@babel/core": "^7.0.0",
2322
"@emotion/react": "^11.0.0-rc.0",
2423
"react": ">=16.8.0"
2524
},
2625
"peerDependenciesMeta": {
27-
"@babel/core": {
28-
"optional": true
29-
},
3026
"@types/react": {
3127
"optional": true
3228
}
3329
},
3430
"devDependencies": {
35-
"@babel/core": "^7.18.5",
3631
"@definitelytyped/dtslint": "0.0.112",
3732
"@emotion/react": "11.10.5",
3833
"react": "16.14.0",

‎yarn.lock

-27
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,6 @@ __metadata:
23502350
dependencies:
23512351
"@babel/core": ^7.18.5
23522352
"@babel/helper-module-imports": ^7.16.7
2353-
"@babel/plugin-syntax-jsx": ^7.17.12
23542353
"@babel/runtime": ^7.18.3
23552354
"@emotion/hash": ^0.9.0
23562355
"@emotion/memoize": ^0.8.0
@@ -2362,8 +2361,6 @@ __metadata:
23622361
find-root: ^1.1.0
23632362
source-map: ^0.5.7
23642363
stylis: 4.1.3
2365-
peerDependencies:
2366-
"@babel/core": ^7.0.0
23672364
languageName: unknown
23682365
linkType: soft
23692366

@@ -2409,19 +2406,13 @@ __metadata:
24092406
version: 0.0.0-use.local
24102407
resolution: "@emotion/css@workspace:packages/css"
24112408
dependencies:
2412-
"@babel/core": ^7.18.5
24132409
"@definitelytyped/dtslint": 0.0.112
24142410
"@emotion/babel-plugin": ^11.10.5
24152411
"@emotion/cache": ^11.10.5
24162412
"@emotion/serialize": ^1.1.1
24172413
"@emotion/sheet": ^1.2.1
24182414
"@emotion/utils": ^1.2.0
24192415
typescript: ^4.5.5
2420-
peerDependencies:
2421-
"@babel/core": ^7.0.0
2422-
peerDependenciesMeta:
2423-
"@babel/core":
2424-
optional: true
24252416
languageName: unknown
24262417
linkType: soft
24272418

@@ -2519,19 +2510,14 @@ __metadata:
25192510
version: 0.0.0-use.local
25202511
resolution: "@emotion/native@workspace:packages/native"
25212512
dependencies:
2522-
"@babel/core": ^7.18.5
25232513
"@definitelytyped/dtslint": 0.0.112
25242514
"@emotion/primitives-core": ^11.10.0
25252515
"@types/react-native": ^0.63.2
25262516
react: 16.14.0
25272517
react-native: ^0.63.2
25282518
typescript: ^4.5.5
25292519
peerDependencies:
2530-
"@babel/core": ^7.0.0
25312520
react-native: ">=0.14.0 <1"
2532-
peerDependenciesMeta:
2533-
"@babel/core":
2534-
optional: true
25352521
languageName: unknown
25362522
linkType: soft
25372523

@@ -2552,7 +2538,6 @@ __metadata:
25522538
version: 0.0.0-use.local
25532539
resolution: "@emotion/primitives@workspace:packages/primitives"
25542540
dependencies:
2555-
"@babel/core": ^7.18.5
25562541
"@emotion/babel-plugin": ^11.10.0
25572542
"@emotion/is-prop-valid": ^1.2.0
25582543
"@emotion/primitives-core": ^11.10.0
@@ -2561,20 +2546,15 @@ __metadata:
25612546
react: 16.14.0
25622547
react-primitives: ^0.8.1
25632548
peerDependencies:
2564-
"@babel/core": ^7.0.0
25652549
react: ">=16.8.0"
25662550
react-primitives: ^0.8.1
2567-
peerDependenciesMeta:
2568-
"@babel/core":
2569-
optional: true
25702551
languageName: unknown
25712552
linkType: soft
25722553

25732554
"@emotion/react@11.10.5, @emotion/react@^11.4.1, @emotion/react@workspace:packages/react":
25742555
version: 0.0.0-use.local
25752556
resolution: "@emotion/react@workspace:packages/react"
25762557
dependencies:
2577-
"@babel/core": ^7.18.5
25782558
"@babel/runtime": ^7.18.3
25792559
"@definitelytyped/dtslint": 0.0.112
25802560
"@emotion/babel-plugin": ^11.10.5
@@ -2593,11 +2573,8 @@ __metadata:
25932573
svg-tag-names: ^1.1.1
25942574
typescript: ^4.5.5
25952575
peerDependencies:
2596-
"@babel/core": ^7.0.0
25972576
react: ">=16.8.0"
25982577
peerDependenciesMeta:
2599-
"@babel/core":
2600-
optional: true
26012578
"@types/react":
26022579
optional: true
26032580
languageName: unknown
@@ -2652,7 +2629,6 @@ __metadata:
26522629
version: 0.0.0-use.local
26532630
resolution: "@emotion/styled@workspace:packages/styled"
26542631
dependencies:
2655-
"@babel/core": ^7.18.5
26562632
"@babel/runtime": ^7.18.3
26572633
"@definitelytyped/dtslint": 0.0.112
26582634
"@emotion/babel-plugin": ^11.10.5
@@ -2664,12 +2640,9 @@ __metadata:
26642640
react: 16.14.0
26652641
typescript: ^4.5.5
26662642
peerDependencies:
2667-
"@babel/core": ^7.0.0
26682643
"@emotion/react": ^11.0.0-rc.0
26692644
react: ">=16.8.0"
26702645
peerDependenciesMeta:
2671-
"@babel/core":
2672-
optional: true
26732646
"@types/react":
26742647
optional: true
26752648
languageName: unknown

0 commit comments

Comments
 (0)
Please sign in to comment.