Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const transformCssCallExpression = ({ babel, state, path }: *) => {
let t = babel.types
let sourceMap = ''
if (t.isTaggedTemplateExpression(path)) {
const expressions = getExpressionsFromTemplateLiteral(path.node.quasi, t)
if (state.emotionSourceMap && path.node.quasi.loc !== undefined) {
sourceMap = getSourceMap(path.node.quasi.loc.start, state)
}
path.replaceWith(t.callExpression(path.node.tag, expressions))
}
if (t.isCallExpression(path)) {
const label = getLabelFromPath(path, t)
let isPure = true
path.get('arguments').forEach(node => {
if (!node.isPure()) {
isPure = false
}
if (t.isObjectExpression(node)) {
})
}
if (t.isMemberExpression(reference.parent)) {
reference.parentPath.replaceWith(
t.callExpression(t.cloneDeep(styledIdentifier), [
t.stringLiteral(reference.parent.property.name)
])
)
} else {
reference.replaceWith(t.cloneDeep(styledIdentifier))
}
let sourceMap = ''
if (reference.parentPath && reference.parentPath.parentPath) {
const styledCallPath = reference.parentPath.parentPath
if (t.isTaggedTemplateExpression(styledCallPath)) {
const expressions = getExpressionsFromTemplateLiteral(
styledCallPath.node.quasi,
t
)
if (
state.emotionSourceMap &&
styledCallPath.node.quasi.loc !== undefined
) {
sourceMap = getSourceMap(styledCallPath.node.quasi.loc.start, state)
}
styledCallPath.replaceWith(
t.callExpression(styledCallPath.node.tag, expressions)
)
}
}
if (t.isCallExpression(reference.parentPath)) {
reference.parentPath.node.arguments[1] = t.objectExpression([