-
-
Notifications
You must be signed in to change notification settings - Fork 140
Expand file tree
/
Copy pathsourceMapConfig.js
More file actions
19 lines (18 loc) · 701 Bytes
/
sourceMapConfig.js
File metadata and controls
19 lines (18 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { getSourceMap } from '../utils/sourceMap'
import { useSourceMap } from '../utils/options'
import { isCreateGlobalStyleHelper } from '../utils/detectors'
import { isUnconfiguredStyled } from './displayNameAndId'
export default t => (path, state) => {
const isUnconfiguredCreateGlobalStyle =
path.node.tag && isCreateGlobalStyleHelper(t)(path.node.tag, state)
if (isUnconfiguredCreateGlobalStyle || isUnconfiguredStyled(t)(path, state)) {
const sourceMap =
useSourceMap(state) && getSourceMap(path.node.quasi.loc.start, state)
if (sourceMap) {
return [
t.objectProperty(t.identifier('sourceMap'), t.stringLiteral(sourceMap)),
]
}
}
return []
}