Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const filenameArr = path.hub.file.opts.filename.split('.')
filenameArr.pop()
filenameArr.push('emotion', 'css')
const cssFilename = filenameArr.join('.')
const exists = fs.existsSync(cssFilename)
path.node.body.unshift(
t.importDeclaration(
[],
t.stringLiteral('./' + basename(cssFilename))
)
)
if (
exists ? fs.readFileSync(cssFilename, 'utf8') !== toWrite : true
) {
if (!exists) {
touchSync(cssFilename)
}
fs.writeFileSync(cssFilename, toWrite)
}
}
if (state.cssPropIdentifier) {
path.node.body.unshift(
t.importDeclaration(
[
t.importSpecifier(
state.cssPropIdentifier,
t.identifier('css')
)
],
t.stringLiteral('emotion')
)
)
const filenameArr = path.hub.file.opts.filename.split('.')
filenameArr.pop()
filenameArr.push('emotion', 'css')
const cssFilename = filenameArr.join('.')
const exists = fs.existsSync(cssFilename)
path.node.body.unshift(
t.importDeclaration(
[],
t.stringLiteral('./' + basename(cssFilename))
)
)
if (
exists ? fs.readFileSync(cssFilename, 'utf8') !== toWrite : true
) {
if (!exists) {
touchSync(cssFilename)
}
fs.writeFileSync(cssFilename, toWrite)
}
}
}
},