import { CodegenResult , baseParse , parserOptions , transform , generate , CompilerOptions , transformExpression , trackVForSlotScopes , trackSlotScopes , noopDirectiveTransform , transformBind , transformStyle } from '@vue/compiler-dom' ; import { ssrCodegenTransform } from './ssrCodegenTransform' ; import { ssrTransformElement } from './transforms/ssrTransformElement' ; import { ssrTransformComponent , rawOptionsMap } from './transforms/ssrTransformComponent' ; import { ssrTransformSlotOutlet } from './transforms/ssrTransformSlotOutlet' ; import { ssrTransformIf } from './transforms/ssrVIf' ; import { ssrTransformFor } from './transforms/ssrVFor' ; import { ssrTransformModel } from './transforms/ssrVModel' ; import { ssrTransformShow } from './transforms/ssrVShow' ; import { ssrInjectFallthroughAttrs } from './transforms/ssrInjectFallthroughAttrs' ; import { ssrInjectCssVars } from './transforms/ssrInjectCssVars' ; export function compile ( template , options = { } ) { options = { ... options , ... parserOptions , ssr : true , inSSR : true , scopeId : options . mode === 'function' ? null : options . scopeId , prefixIdentifiers : true , cacheHandlers : false , hoistStatic : false } ; const ast = baseParse ( template , options ) ; rawOptionsMap . set ( ast , options ) ; transform ( ast , { ... options , hoistStatic : false , nodeTransforms : [ ssrTransformIf , ssrTransformFor , trackVForSlotScopes , transformExpression , ssrTransformSlotOutlet , ssrInjectFallthroughAttrs , ssrInjectCssVars , ssrTransformElement , ssrTransformComponent , trackSlotScopes , transformStyle , ... ( options . nodeTransforms || [ ] ) ] , directiveTransforms : { bind : transformBind , model : ssrTransformModel , show : ssrTransformShow , on : noopDirectiveTransform , cloak : noopDirectiveTransform , once : noopDirectiveTransform , ... ( options . directiveTransforms || { } ) } } ) ; ssrCodegenTransform ( ast , options ) ; return generate ( ast , options ) ; }