( push: PushFn, vnode: VNode, parentComponent: ComponentInternalInstance, slotScopeId?: string, )
| 222 | } |
| 223 | |
| 224 | export function renderVNode( |
| 225 | push: PushFn, |
| 226 | vnode: VNode, |
| 227 | parentComponent: ComponentInternalInstance, |
| 228 | slotScopeId?: string, |
| 229 | ): void { |
| 230 | const { type, shapeFlag, children, dirs, props } = vnode |
| 231 | if (dirs) { |
| 232 | vnode.props = applySSRDirectives(vnode, props, dirs) |
| 233 | } |
| 234 | |
| 235 | switch (type) { |
| 236 | case Text: |
| 237 | push(escapeHtml(children as string)) |
| 238 | break |
| 239 | case Comment: |
| 240 | push( |
| 241 | children |
| 242 | ? `<!--${escapeHtmlComment(children as string)}-->` |
| 243 | : `<!---->`, |
| 244 | ) |
| 245 | break |
| 246 | case Static: |
| 247 | push(children as string) |
| 248 | break |
| 249 | case Fragment: |
| 250 | if (vnode.slotScopeIds) { |
| 251 | slotScopeId = |
| 252 | (slotScopeId ? slotScopeId + ' ' : '') + vnode.slotScopeIds.join(' ') |
| 253 | } |
| 254 | push(`<!--[-->`) // open |
| 255 | renderVNodeChildren( |
| 256 | push, |
| 257 | children as VNodeArrayChildren, |
| 258 | parentComponent, |
| 259 | slotScopeId, |
| 260 | ) |
| 261 | push(`<!--]-->`) // close |
| 262 | break |
| 263 | default: |
| 264 | if (shapeFlag & ShapeFlags.ELEMENT) { |
| 265 | renderElementVNode(push, vnode, parentComponent, slotScopeId) |
| 266 | } else if (shapeFlag & ShapeFlags.COMPONENT) { |
| 267 | push(renderComponentVNode(vnode, parentComponent, slotScopeId)) |
| 268 | } else if (shapeFlag & ShapeFlags.TELEPORT) { |
| 269 | renderTeleportVNode(push, vnode, parentComponent, slotScopeId) |
| 270 | } else if (shapeFlag & ShapeFlags.SUSPENSE) { |
| 271 | renderVNode(push, vnode.ssContent!, parentComponent, slotScopeId) |
| 272 | } else { |
| 273 | warn( |
| 274 | '[@vue/server-renderer] Invalid VNode type:', |
| 275 | type, |
| 276 | `(${typeof type})`, |
| 277 | ) |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 |
no test coverage detected