Skip to content

Commit a8c2669

Browse files
committed
chore: upgrade to babel-plugin-emotion
I didn't do __extensive__ testing, but the tests pass and @kentcdodds said there were no breaking changes… fixes #515
1 parent b1db578 commit a8c2669

File tree

12 files changed

+20
-14
lines changed

12 files changed

+20
-14
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"babel-eslint": "^7.2.3",
4040
"babel-flow-types": "^1.2.2",
4141
"babel-jest": "^20.0.3",
42-
"babel-macros": "^1.2.0",
42+
"babel-plugin-macros": "^2.0.0",
4343
"babel-plugin-closure-elimination": "^1.3.0",
4444
"babel-plugin-codegen": "^1.2.0",
4545
"babel-plugin-external-helpers": "^6.22.0",

packages/babel-plugin-emotion/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ from `createEmotion`,
306306

307307
## Babel Macros
308308

309-
Instead of using `babel-plugin-emotion`, you can use emotion with [`babel-macros`](https://github.com/kentcdodds/babel-macros). Add `babel-macros` to your babel config and import whatever you want from emotion but add `/macro` to the end. Currently every API except for the css prop is supported by the macro.
309+
Instead of using `babel-plugin-emotion`, you can use emotion with [`babel-plugin-macros`](https://github.com/kentcdodds/babel-plugin-macros). Add `babel-plugin-macros` to your babel config and import whatever you want from emotion but add `/macro` to the end. Currently every API except for the css prop is supported by the macro.
310310

311311
```jsx
312312
import styled from 'react-emotion/macro'

packages/babel-plugin-emotion/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@babel/helper-module-imports": "7.0.0-beta.32",
18-
"babel-macros": "^1.2.0",
18+
"babel-plugin-macros": "^2.0.0",
1919
"babel-plugin-syntax-jsx": "^6.18.0",
2020
"convert-source-map": "^1.5.0",
2121
"emotion-utils": "^9.0.0-0",

packages/babel-plugin-emotion/src/macro-styled.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// @flow
22
import {
33
buildStyledCallExpression,
4-
buildStyledObjectCallExpression
4+
buildStyledObjectCallExpression,
55
} from './index'
66
import { buildMacroRuntimeNode, omit } from './babel-utils'
77
import emotionMacro from './macro'
8-
import { createMacro } from 'babel-macros'
8+
import { createMacro } from 'babel-plugin-macros'
99

1010
module.exports = createMacro(macro)
1111

packages/babel-plugin-emotion/src/macro.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22
import { replaceCssWithCallExpression } from './index'
33
import { buildMacroRuntimeNode, addRuntimeImports } from './babel-utils'
4-
import { createMacro } from 'babel-macros'
4+
import { createMacro } from 'babel-plugin-macros'
55

66
module.exports = createMacro(macro)
77

packages/babel-plugin-emotion/test/macro/.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"env",
55
{
66
"loose": true,
7-
"exclude": ["transform-es2015-typeof-symbol"]
7+
"exclude": ["transform-es2015-typeof-symbol"]
88
}
99
],
1010
"stage-0",

packages/babel-plugin-emotion/test/macro/babel-macros-register.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path')
33
require('module-alias').addAliases({
44
'emotion-utils': path.join(__dirname, '../../../emotion-utils/src'),
55
'react-emotion/macro': path.join(__dirname, '../../src/macro-styled'),
6-
'emotion/macro': path.join(__dirname, '../../src/macro')
6+
'emotion/macro': path.join(__dirname, '../../src/macro'),
77
})
88

9-
module.exports = require('babel-macros')
9+
module.exports = require('babel-plugin-macros')

packages/babel-plugin-emotion/test/util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const createMacroTester = transform => opts => {
9797
transform(opts.code, {
9898
plugins: [
9999
[
100-
require('babel-macros'),
100+
require('babel-plugin-macros'),
101101
{
102102
...opts.opts
103103
}

packages/benchmarks/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"devDependencies": {
1919
"babel-loader": "^7.1.1",
20-
"babel-macros": "^1.0.2",
20+
"babel-plugin-macros": "^2.0.0",
2121
"babel-polyfill": "^6.26.0",
2222
"cli-chart": "^0.3.1",
2323
"cli-table": "^0.3.1",

packages/benchmarks/webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
'react',
3737
'stage-0'
3838
],
39-
plugins: ['babel-macros'],
39+
plugins: ['babel-plugin-macros'],
4040
cacheDirectory: true
4141
}
4242
}

packages/emotion/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ minimizes the runtime cost of css-in-js dramatically by parsing your styles with
5151
- [fontFace](https://github.com/emotion-js/emotion/tree/master/docs/font-face.md)
5252
- [injectGlobal](https://github.com/emotion-js/emotion/tree/master/docs/inject-global.md)
5353

54-
- [Usage with babel-macros](https://github.com/emotion-js/emotion/tree/master/docs/babel.md#usage-with-babel-macros)
54+
- [Usage with babel-plugin-macros](https://github.com/emotion-js/emotion/tree/master/docs/babel.md#usage-with-babel-macros)
5555
- [Usage with Preact](https://github.com/emotion-js/emotion/tree/master/docs/preact.md)
5656

5757
- Ecosystem

yarn.lock

+7-1
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ babel-loader@^7.1.1:
13781378
loader-utils "^1.0.2"
13791379
mkdirp "^0.5.1"
13801380

1381-
babel-macros@^1.0.0, babel-macros@^1.0.2:
1381+
babel-macros@^1.0.0:
13821382
version "1.0.2"
13831383
resolved "https://registry.yarnpkg.com/babel-macros/-/babel-macros-1.0.2.tgz#04475889990243cc58a0afb5ea3308ec6b89e797"
13841384

@@ -1453,6 +1453,12 @@ babel-plugin-jest-hoist@^21.2.0:
14531453
version "21.2.0"
14541454
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz#2cef637259bd4b628a6cace039de5fcd14dbb006"
14551455

1456+
babel-plugin-macros@^2.0.0:
1457+
version "2.0.0"
1458+
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.0.0.tgz#fd3aee135f7dec0b82898b7c8f1aed6fa75f9af9"
1459+
dependencies:
1460+
cosmiconfig "3.1.0"
1461+
14561462
babel-plugin-syntax-async-functions@^6.8.0:
14571463
version "6.13.0"
14581464
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95"

0 commit comments

Comments
 (0)