2019-09-16 19:06:45 +00:00
|
|
|
// This package is the "full-build" that includes both the runtime
|
2019-09-20 04:24:16 +00:00
|
|
|
// and the compiler, and supports on-the-fly compilation of the template option.
|
2019-09-20 16:16:19 +00:00
|
|
|
import { compile, CompilerOptions } from '@vue/compiler-dom'
|
|
|
|
import { registerRuntimeCompiler, RenderFunction } from '@vue/runtime-dom'
|
2019-09-20 04:12:37 +00:00
|
|
|
|
2019-09-20 16:16:19 +00:00
|
|
|
function compileToFunction(
|
|
|
|
template: string,
|
|
|
|
options?: CompilerOptions
|
|
|
|
): RenderFunction {
|
2019-10-04 03:30:25 +00:00
|
|
|
const { code } = compile(template, {
|
2019-10-04 13:03:00 +00:00
|
|
|
hoistStatic: true,
|
2019-10-04 03:30:25 +00:00
|
|
|
...options
|
|
|
|
})
|
2019-09-22 20:50:57 +00:00
|
|
|
return new Function(code)() as RenderFunction
|
2019-09-20 04:12:37 +00:00
|
|
|
}
|
|
|
|
|
2019-09-20 16:16:19 +00:00
|
|
|
registerRuntimeCompiler(compileToFunction)
|
2019-09-20 04:24:16 +00:00
|
|
|
|
2019-09-20 16:16:19 +00:00
|
|
|
export { compileToFunction as compile }
|
2018-10-26 19:44:50 +00:00
|
|
|
export * from '@vue/runtime-dom'
|
2019-09-04 00:51:42 +00:00
|
|
|
|
2019-09-17 15:57:25 +00:00
|
|
|
if (__BROWSER__ && __DEV__) {
|
2019-09-04 00:51:42 +00:00
|
|
|
console[console.info ? 'info' : 'log'](
|
|
|
|
`You are running a development build of Vue.\n` +
|
|
|
|
`Make sure to use the production build (*.prod.js) when deploying for production.`
|
|
|
|
)
|
|
|
|
}
|