vnode.ts — vue Source File
Architecture documentation for vnode.ts, a typescript file in the vue codebase. 3 imports, 13 dependents.
Entity Profile
Dependency Diagram
graph LR 5164a61d_92b2_9c7f_8acb_b18093afdb59["vnode.ts"] 64c87498_c46a_6944_ab9d_8e45519852a8["component"] 5164a61d_92b2_9c7f_8acb_b18093afdb59 --> 64c87498_c46a_6944_ab9d_8e45519852a8 3ed3b2ba_4c48_e327_9f2c_3cce3e4de21f["options"] 5164a61d_92b2_9c7f_8acb_b18093afdb59 --> 3ed3b2ba_4c48_e327_9f2c_3cce3e4de21f ba925ef2_b0f4_efe3_c23d_fe293c46b2c1["vnode"] 5164a61d_92b2_9c7f_8acb_b18093afdb59 --> ba925ef2_b0f4_efe3_c23d_fe293c46b2c1 d937f76e_061f_a631_9587_336503c9a15c["lifecycle.ts"] d937f76e_061f_a631_9587_336503c9a15c --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 2c65c43e_4691_415f_689a_805ec38ae46c["render.ts"] 2c65c43e_4691_415f_689a_805ec38ae46c --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 af395f8e_1ac5_a239_71b7_fd29a1c03d2c["index.ts"] af395f8e_1ac5_a239_71b7_fd29a1c03d2c --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 19a79cc7_5fb4_4746_0453_f0f304dd29a7["traverse.ts"] 19a79cc7_5fb4_4746_0453_f0f304dd29a7 --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 82e2e746_8f28_fbf0_8cf7_69eca6423e4a["create-component.ts"] 82e2e746_8f28_fbf0_8cf7_69eca6423e4a --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 4b23edff_adcb_6cfb_ca7d_b6d38b4a1921["create-element.ts"] 4b23edff_adcb_6cfb_ca7d_b6d38b4a1921 --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 414b37af_5f63_dee7_31a2_9a7cad5979ec["create-functional-component.ts"] 414b37af_5f63_dee7_31a2_9a7cad5979ec --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 cee7daab_a792_66d9_098d_15ff5961e47f["get-first-component-child.ts"] cee7daab_a792_66d9_098d_15ff5961e47f --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 80e29c1b_c807_b450_d82b_2036fd4401e3["is-async-placeholder.ts"] 80e29c1b_c807_b450_d82b_2036fd4401e3 --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 2fe22abf_9073_15d3_f856_f421b0fe047a["merge-hook.ts"] 2fe22abf_9073_15d3_f856_f421b0fe047a --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 091d06a8_6793_746a_7499_d22a1d025196["normalize-scoped-slots.ts"] 091d06a8_6793_746a_7499_d22a1d025196 --> 5164a61d_92b2_9c7f_8acb_b18093afdb59 style 5164a61d_92b2_9c7f_8acb_b18093afdb59 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { Component } from 'types/component'
import type { ComponentOptions } from 'types/options'
import type { VNodeComponentOptions, VNodeData } from 'types/vnode'
/**
* @internal
*/
export default class VNode {
tag?: string
data: VNodeData | undefined
children?: Array<VNode> | null
text?: string
elm: Node | undefined
ns?: string
context?: Component // rendered in this component's scope
key: string | number | undefined
componentOptions?: VNodeComponentOptions
componentInstance?: Component // component instance
parent: VNode | undefined | null // component placeholder node
// strictly internal
raw: boolean // contains raw HTML? (server only)
isStatic: boolean // hoisted static node
isRootInsert: boolean // necessary for enter transition check
isComment: boolean // empty comment placeholder?
isCloned: boolean // is a cloned node?
isOnce: boolean // is a v-once node?
asyncFactory?: Function // async component factory function
asyncMeta: Object | void
isAsyncPlaceholder: boolean
ssrContext?: Object | void
fnContext: Component | void // real context vm for functional nodes
fnOptions?: ComponentOptions | null // for SSR caching
devtoolsMeta?: Object | null // used to store functional render context for devtools
fnScopeId?: string | null // functional scope id support
isComponentRootElement?: boolean | null // for SSR directives
constructor(
tag?: string,
data?: VNodeData,
children?: Array<VNode> | null,
text?: string,
elm?: Node,
context?: Component,
componentOptions?: VNodeComponentOptions,
asyncFactory?: Function
) {
this.tag = tag
this.data = data
this.children = children
this.text = text
this.elm = elm
this.ns = undefined
this.context = context
this.fnContext = undefined
this.fnOptions = undefined
this.fnScopeId = undefined
this.key = data && data.key
this.componentOptions = componentOptions
this.componentInstance = undefined
this.parent = undefined
this.raw = false
this.isStatic = false
this.isRootInsert = true
this.isComment = false
this.isCloned = false
this.isOnce = false
this.asyncFactory = asyncFactory
this.asyncMeta = undefined
this.isAsyncPlaceholder = false
}
// DEPRECATED: alias for componentInstance for backwards compat.
/* istanbul ignore next */
get child(): Component | void {
return this.componentInstance
}
}
export const createEmptyVNode = (text: string = '') => {
const node = new VNode()
node.text = text
node.isComment = true
return node
}
export function createTextVNode(val: string | number) {
return new VNode(undefined, undefined, undefined, String(val))
}
// optimized shallow clone
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
export function cloneVNode(vnode: VNode): VNode {
const cloned = new VNode(
vnode.tag,
vnode.data,
// #7975
// clone children array to avoid mutating original in case of cloning
// a child.
vnode.children && vnode.children.slice(),
vnode.text,
vnode.elm,
vnode.context,
vnode.componentOptions,
vnode.asyncFactory
)
cloned.ns = vnode.ns
cloned.isStatic = vnode.isStatic
cloned.key = vnode.key
cloned.isComment = vnode.isComment
cloned.fnContext = vnode.fnContext
cloned.fnOptions = vnode.fnOptions
cloned.fnScopeId = vnode.fnScopeId
cloned.asyncMeta = vnode.asyncMeta
cloned.isCloned = true
return cloned
}
Domain
Subdomains
Classes
Dependencies
- component
- options
- vnode
Imported By
- src/v3/apiSetup.ts
- src/core/vdom/create-component.ts
- src/core/vdom/create-element.ts
- src/core/vdom/create-functional-component.ts
- src/core/vdom/helpers/get-first-component-child.ts
- src/core/observer/index.ts
- src/core/vdom/helpers/is-async-placeholder.ts
- src/core/instance/lifecycle.ts
- src/core/vdom/helpers/merge-hook.ts
- src/core/vdom/helpers/normalize-scoped-slots.ts
- src/core/vdom/patch.ts
- src/core/instance/render.ts
- src/core/observer/traverse.ts
Source
Frequently Asked Questions
What does vnode.ts do?
vnode.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, VDom subdomain.
What functions are defined in vnode.ts?
vnode.ts defines 3 function(s): cloneVNode, createEmptyVNode, createTextVNode.
What does vnode.ts depend on?
vnode.ts imports 3 module(s): component, options, vnode.
What files import vnode.ts?
vnode.ts is imported by 13 file(s): apiSetup.ts, create-component.ts, create-element.ts, create-functional-component.ts, get-first-component-child.ts, index.ts, is-async-placeholder.ts, lifecycle.ts, and 5 more.
Where is vnode.ts in the architecture?
vnode.ts is located at src/core/vdom/vnode.ts (domain: VueCore, subdomain: VDom, directory: src/core/vdom).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free