feat: expose compiler APIs
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/vue#readme",
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.0.0-alpha.1",
|
||||
"@vue/runtime-dom": "3.0.0-alpha.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,13 @@
|
||||
|
||||
// TODO hook up the runtime to compile templates on the fly
|
||||
|
||||
export * from '@vue/compiler-dom'
|
||||
import { compile as baseCompile, CompilerOptions } from '@vue/compiler-dom'
|
||||
|
||||
export function compile(template: string, options?: CompilerOptions): Function {
|
||||
const { code } = baseCompile(template, options)
|
||||
return new Function(`with(this){return ${code}}`)
|
||||
}
|
||||
|
||||
export * from '@vue/runtime-dom'
|
||||
|
||||
if (__BROWSER__ && __DEV__) {
|
||||
|
||||
Reference in New Issue
Block a user