2019-09-26 23:51:04 +08:00
|
|
|
import { baseCompile, CompilerOptions, CodegenResult } from '@vue/compiler-core'
|
2019-09-17 23:57:25 +08:00
|
|
|
import { parserOptionsMinimal } from './parserOptionsMinimal'
|
|
|
|
import { parserOptionsStandard } from './parserOptionsStandard'
|
2019-10-04 04:55:14 +08:00
|
|
|
import { transformStyle } from './transforms/transformStyle'
|
2019-10-09 22:41:31 +08:00
|
|
|
import { transformCloak } from './transforms/vCloak'
|
2019-10-09 03:35:57 +08:00
|
|
|
import { transformVHtml } from './transforms/vHtml'
|
2019-09-17 23:57:25 +08:00
|
|
|
|
2019-09-20 12:12:37 +08:00
|
|
|
export function compile(
|
|
|
|
template: string,
|
|
|
|
options: CompilerOptions = {}
|
|
|
|
): CodegenResult {
|
2019-09-21 00:16:19 +08:00
|
|
|
return baseCompile(template, {
|
|
|
|
...options,
|
|
|
|
...(__BROWSER__ ? parserOptionsMinimal : parserOptionsStandard),
|
2019-10-04 04:55:14 +08:00
|
|
|
nodeTransforms: [transformStyle, ...(options.nodeTransforms || [])],
|
2019-09-22 05:42:12 +08:00
|
|
|
directiveTransforms: {
|
2019-10-09 22:41:31 +08:00
|
|
|
cloak: transformCloak,
|
2019-10-09 03:35:57 +08:00
|
|
|
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'
|