Skip to content

Commit 6d49017

Browse files
Kent C. DoddsKye Hohenberger
authored andcommitted
upgrade to babel-macros 1.0.0 (#298)
* Update package.json * Update macro.js * Update macro-styled.js
1 parent 0d951f9 commit 6d49017

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

packages/babel-plugin-emotion/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"dependencies": {
1616
"autoprefixer": "^7.1.2",
1717
"babel-plugin-syntax-jsx": "^6.18.0",
18+
"babel-macros": "^1.0.1",
1819
"emotion-utils": "^7.2.2",
1920
"postcss": "^6.0.9",
2021
"postcss-js": "^1.0.0",

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ import {
55
import { buildMacroRuntimeNode } from './babel-utils'
66
import emotionMacro from './macro'
77
import { omit } from 'emotion-utils'
8+
import { createMacro } from 'babel-macros'
89

9-
module.exports = function macro(options) {
10+
module.exports = createMacro(macro)
11+
12+
function macro(options) {
1013
const { references, state, babel: { types: t } } = options
1114
if (!state.inline) state.inline = true
1215
let referencesWithoutDefault = references

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import {
44
} from './index'
55
import { buildMacroRuntimeNode, addRuntimeImports } from './babel-utils'
66
import { forEach, keys } from 'emotion-utils'
7+
import { createMacro } from 'babel-macros'
78

8-
module.exports = function macro({ references, state, babel: { types: t } }) {
9+
module.exports = createMacro(macro)
10+
11+
function macro({ references, state, babel: { types: t } }) {
912
if (!state.inline) state.inline = true
1013
forEach(keys(references), referenceKey => {
1114
if (referenceKey === 'injectGlobal') {

0 commit comments

Comments
 (0)