vue3-core/packages/compiler-dom/src/index.ts

25 lines
839 B
TypeScript
Raw Normal View History

import { baseCompile, CompilerOptions, CodegenResult } from '@vue/compiler-core'
import { parserOptionsMinimal } from './parserOptionsMinimal'
import { parserOptionsStandard } from './parserOptionsStandard'
import { transformStyle } from './transforms/transformStyle'
import { transformCloak } from './transforms/vCloak'
import { transformVHtml } from './transforms/vHtml'
2019-09-20 12:12:37 +08:00
export function compile(
template: string,
options: CompilerOptions = {}
): CodegenResult {
return baseCompile(template, {
...options,
...(__BROWSER__ ? parserOptionsMinimal : parserOptionsStandard),
nodeTransforms: [transformStyle, ...(options.nodeTransforms || [])],
2019-09-22 05:42:12 +08:00
directiveTransforms: {
cloak: transformCloak,
html: transformVHtml,
2019-09-22 05:42:12 +08:00
...(options.directiveTransforms || {})
}
2019-09-20 12:12:37 +08:00
})
}
2019-09-23 04:50:57 +08:00
export * from '@vue/compiler-core'