chore(compiler-core/codegen): avoid generate indent spaces of empty lines. (#701)

This commit is contained in:
djy0
2020-02-10 22:33:04 +08:00
committed by GitHub
parent 42db2fef9d
commit 782db6d7f5
14 changed files with 99 additions and 86 deletions

View File

@@ -216,11 +216,11 @@ export function generate(
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
.join(', ')} } = _Vue`
)
newline()
if (ast.cached > 0) {
push(`const _cache = $cache`)
newline()
push(`const _cache = $cache`)
}
push(`\n`)
newline()
}
} else if (!__BROWSER__ && !ssr) {
@@ -235,18 +235,24 @@ export function generate(
// generate asset resolution statements
if (ast.components.length) {
genAssets(ast.components, 'component', context)
if (ast.directives.length || ast.temps > 0) {
newline()
}
}
if (ast.directives.length) {
genAssets(ast.directives, 'directive', context)
if (ast.temps > 0) {
newline()
}
}
if (ast.temps > 0) {
push(`let `)
for (let i = 0; i < ast.temps; i++) {
push(`${i > 0 ? `, ` : ``}_temp${i}`)
}
push(`\n`)
}
if (ast.components.length || ast.directives.length || ast.temps) {
push(`\n`)
newline()
}
@@ -419,8 +425,6 @@ function genAssets(
)
if (i < assets.length - 1) {
newline()
} else {
push(`\n`)
}
}
}