import { ComponentInstance , VNodeChild , VNode , } from '../shared/svu' ; import { Comment , Text , createVnode , Fragment } from './vnode' ; import { isArray } from '../shared' ; export function renderComponentRoot ( instance ) { const { render , setupState } = instance ; return normalizeVNode ( render ( setupState ) ) ; } export function normalizeVNode ( child ) { if ( child == null || typeof child === 'boolean' ) { return createVnode ( Comment ) ; } else if ( isArray ( child ) ) { return createVnode ( Fragment , null , child ) ; } else if ( typeof child === 'object' ) { return child ; } else { return createVnode ( Text , null , String ( child ) ) ; } }