import { type ComponentInternalInstance, type Data, type FunctionalComponent, getComponentName, } from './component' import { Comment, type VNode, type VNodeArrayChildren, blockStack, cloneVNode, createVNode, isVNode, normalizeVNode, } from './vnode' import { ErrorCodes, handleError } from './errorHandling' import { PatchFlags, ShapeFlags, isModelListener, isOn } from '@vue/shared' import { warn } from './warning' import { isHmrUpdating } from './hmr' import type { NormalizedProps } from './componentProps' import { isEmitListener } from './componentEmits' import { setCurrentRenderingInstance } from './componentRenderContext' import { DeprecationTypes, isCompatEnabled, warnDeprecation, } from './compat/compatConfig' import { shallowReadonly } from '@vue/reactivity' import { setTransitionHooks } from './components/BaseTransition' /** * dev only flag to track whether $attrs was used during render. * If $attrs was used during render then the warning for failed attrs * fallthrough can be suppressed. */ let accessedAttrs: boolean = false export function markAttrsAccessed(): void { accessedAttrs = true } type SetRootFn = ((root: VNode) => void) | undefined export function renderComponentRoot( instance: ComponentInternalInstance, ): VNode { const { type: Component, vnode, proxy, withProxy, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, props, data, setupState, ctx, inheritAttrs, } = instance const prev = setCurrentRenderingInstance(instance) let result let fallthroughAttrs if (__DEV__) { accessedAttrs = false } try { if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) { // withProxy is a proxy with a different `has` trap only for // runtime-compiled render functions using `with` block. const proxyToUse = withProxy || proxy // 'this' isn't available in production builds with `