mirror of https://github.com/vuejs/core.git
chore: codegen
This commit is contained in:
parent
d02629efa2
commit
e44d616c80
|
@ -1,16 +1,10 @@
|
||||||
import type {
|
import type { CodegenOptions, CodegenResult } from '@vue/compiler-dom'
|
||||||
CodegenContext,
|
|
||||||
CodegenOptions,
|
|
||||||
CodegenResult,
|
|
||||||
} from '@vue/compiler-dom'
|
|
||||||
import { type DynamicChildren, type RootIRNode, IRNodeTypes } from './ir'
|
import { type DynamicChildren, type RootIRNode, IRNodeTypes } from './ir'
|
||||||
|
|
||||||
// IR -> JS codegen
|
// IR -> JS codegen
|
||||||
export function generate(
|
export function generate(
|
||||||
ir: RootIRNode,
|
ir: RootIRNode,
|
||||||
options: CodegenOptions & {
|
options: CodegenOptions = {},
|
||||||
onContextCreated?: (context: CodegenContext) => void
|
|
||||||
} = {},
|
|
||||||
): CodegenResult {
|
): CodegenResult {
|
||||||
let code = ''
|
let code = ''
|
||||||
let preamble = ''
|
let preamble = ''
|
||||||
|
@ -25,6 +19,7 @@ export function generate(
|
||||||
vaporHelpers.add('template')
|
vaporHelpers.add('template')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO multiple-template
|
||||||
code += `const root = t0()\n`
|
code += `const root = t0()\n`
|
||||||
if (ir.children[0]) {
|
if (ir.children[0]) {
|
||||||
code += `const {${genChildren(ir.children[0].children)}} = children(root)\n`
|
code += `const {${genChildren(ir.children[0].children)}} = children(root)\n`
|
||||||
|
|
Loading…
Reference in New Issue