Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async compile (code) {
this.code = code
if (!code) {
return
}
const imports = []
const { template, script, styles, customBlocks } = parseComponent(code)
let config
if ((config = customBlocks.find(n => n.type === 'config'))) {
params.clear()
params.parse(config.content)
}
let compiled
const pkgs = []
let scriptContent = 'exports = { default: {} }'
if (script) {
try {
compiled = window.Babel.transform(script.content, {
presets: ['es2015', 'es2016', 'es2017', 'stage-0'],
plugins: [[getImports, { imports }]]
}).code