-
-
Notifications
You must be signed in to change notification settings - Fork 142
/
index.js
38 lines (37 loc) · 1.11 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import syntax from 'babel-plugin-syntax-jsx'
import pureAnnotation from './visitors/pure'
import minify from './visitors/minify'
import displayNameAndId from './visitors/displayNameAndId'
import templateLiterals from './visitors/templateLiterals'
import assignStyledRequired from './visitors/assignStyledRequired'
import transpileCssProp from './visitors/transpileCssProp'
export default function({ types: t }) {
return {
inherits: syntax,
visitor: {
Program(path, state) {
path.traverse(
{
JSXAttribute(path, state) {
transpileCssProp(t)(path, state)
},
VariableDeclarator(path, state) {
assignStyledRequired(t)(path, state)
},
},
state
)
},
CallExpression(path, state) {
displayNameAndId(t)(path, state)
pureAnnotation(t)(path, state)
},
TaggedTemplateExpression(path, state) {
minify(t)(path, state)
displayNameAndId(t)(path, state)
templateLiterals(t)(path, state)
pureAnnotation(t)(path, state)
},
},
}
}