import { RootNode, BlockStatement, TemplateLiteral, createCallExpression, createTemplateLiteral, NodeTypes, TemplateChildNode, ElementTypes, createBlockStatement, CompilerOptions, IfStatement, CallExpression, isText, processExpression, createSimpleExpression, createCompoundExpression, createTransformContext, createRoot } from '@vue/compiler-dom' import { isString, escapeHtml } from '@vue/shared' import { SSR_INTERPOLATE, ssrHelpers } from './runtimeHelpers' import { ssrProcessIf } from './transforms/ssrVIf' import { ssrProcessFor } from './transforms/ssrVFor' import { ssrProcessSlotOutlet } from './transforms/ssrTransformSlotOutlet' import { ssrProcessComponent } from './transforms/ssrTransformComponent' import { ssrProcessElement } from './transforms/ssrTransformElement' import { createSSRCompilerError, SSRErrorCodes } from './errors' // Because SSR codegen output is completely different from client-side output // (e.g. multiple elements can be concatenated into a single template literal // instead of each getting a corresponding call), we need to apply an extra // transform pass to convert the template AST into a fresh JS AST before // passing it to codegen. export function ssrCodegenTransform(ast: RootNode, options: CompilerOptions) { const context = createSSRTransformContext(ast, options) // inject SFC