import { type ArrayExpression, type AttributeNode, type CallExpression, type DirectiveNode, ElementTypes, ErrorCodes, type ExpressionNode, type InterpolationNode, type JSChildNode, MERGE_PROPS, Namespaces, type NodeTransform, NodeTypes, type PlainElementNode, type PropsExpression, type TemplateLiteral, type TextNode, type TransformContext, buildDirectiveArgs, buildProps, createArrayExpression, createAssignmentExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createInterpolation, createSequenceExpression, createSimpleExpression, createTemplateLiteral, findDir, findProp, hasDynamicKeyVBind, isStaticArgOf, isStaticExp, transformStyle, } from '@vue/compiler-dom' import { NO, escapeHtml, isBooleanAttr, isBuiltInDirective, isSSRSafeAttrName, parseStringStyle, propsToAttrMap, stringifyStyle, } from '@vue/shared' import { SSRErrorCodes, createSSRCompilerError } from '../errors' import { SSR_GET_DIRECTIVE_PROPS, SSR_GET_DYNAMIC_MODEL_PROPS, SSR_INCLUDE_BOOLEAN_ATTR, SSR_INTERPOLATE, SSR_RENDER_ATTR, SSR_RENDER_ATTRS, SSR_RENDER_CLASS, SSR_RENDER_DYNAMIC_ATTR, SSR_RENDER_STYLE, } from '../runtimeHelpers' import { type SSRTransformContext, processChildren, } from '../ssrCodegenTransform' // for directives with children overwrite (e.g. v-html & v-text), we need to // store the raw children so that they can be added in the 2nd pass. const rawChildrenMap = new WeakMap< PlainElementNode, TemplateLiteral['elements'][0] >() // These DOM properties reflect attributes only on specific HTML elements. const tagSpecificDOMProps: Record = { form: 'acceptCharset', label: 'htmlFor', output: 'htmlFor', script: 'htmlFor', meta: 'httpEquiv', } /** * Resolve the attribute name a DOM prop alias should be rendered as, e.g. * `htmlFor` -> `for`. Only props that actually reflect an attribute on the * element are mapped: `htmlFor` is an alias of `for` on `