Home / File/ init.ts — vue Source File

init.ts — vue Source File

Architecture documentation for init.ts, a typescript file in the vue codebase. 22 imports, 1 dependents.

File typescript CoreRuntime Instance 22 imports 1 dependents 4 functions

Entity Profile

Dependency Diagram

graph LR
  9e587547_0a20_aaaa_ba5c_6103ca27ef79["init.ts"]
  d22f3dff_cc24_705a_1193_eec206dcb1d5["config.ts"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> d22f3dff_cc24_705a_1193_eec206dcb1d5
  18330ec4_c733_5eb5_21fe_6f99d09ac84f["proxy.ts"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> 18330ec4_c733_5eb5_21fe_6f99d09ac84f
  28312ac3_ad7f_97ae_dcab_e5134fb1881f["initProxy"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> 28312ac3_ad7f_97ae_dcab_e5134fb1881f
  910d3a96_5984_cf85_40a3_47933bd75818["state.ts"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> 910d3a96_5984_cf85_40a3_47933bd75818
  ceeb400a_fb7f_c638_1feb_8311db20c105["initState"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> ceeb400a_fb7f_c638_1feb_8311db20c105
  a8c0285c_59b2_d81b_1af0_c0cd9c2afe2d["render.ts"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> a8c0285c_59b2_d81b_1af0_c0cd9c2afe2d
  f4a31343_8d36_5571_8c89_ce5e074a5044["initRender"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> f4a31343_8d36_5571_8c89_ce5e074a5044
  7b0cc275_96e5_15f9_3ca6_626be691c291["events.ts"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> 7b0cc275_96e5_15f9_3ca6_626be691c291
  0641f0aa_39b1_9512_4e37_1f438403b4c0["initEvents"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> 0641f0aa_39b1_9512_4e37_1f438403b4c0
  d5415a1d_c2b2_5cd9_ec65_daba30665c8f["perf.ts"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> d5415a1d_c2b2_5cd9_ec65_daba30665c8f
  c66f2b7c_7247_ba1e_a44e_c9fbf576a0f8["mark"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> c66f2b7c_7247_ba1e_a44e_c9fbf576a0f8
  3dba2c58_eaa7_9043_7b9a_5564624e9333["measure"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> 3dba2c58_eaa7_9043_7b9a_5564624e9333
  f3560440_54c1_5663_36f8_c7de54d7310b["lifecycle.ts"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> f3560440_54c1_5663_36f8_c7de54d7310b
  82b26b02_c18b_b13d_066b_5fc68534d307["initLifecycle"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> 82b26b02_c18b_b13d_066b_5fc68534d307
  style 9e587547_0a20_aaaa_ba5c_6103ca27ef79 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import config from '../config'
import { initProxy } from './proxy'
import { initState } from './state'
import { initRender } from './render'
import { initEvents } from './events'
import { mark, measure } from '../util/perf'
import { initLifecycle, callHook } from './lifecycle'
import { initProvide, initInjections } from './inject'
import { extend, mergeOptions, formatComponentName } from '../util/index'
import type { Component } from 'types/component'
import type { InternalComponentOptions } from 'types/options'
import { EffectScope } from 'v3/reactivity/effectScope'

let uid = 0

export function initMixin(Vue: typeof Component) {
  Vue.prototype._init = function (options?: Record<string, any>) {
    const vm: Component = this
    // a uid
    vm._uid = uid++

    let startTag, endTag
    /* istanbul ignore if */
    if (__DEV__ && config.performance && mark) {
      startTag = `vue-perf-start:${vm._uid}`
      endTag = `vue-perf-end:${vm._uid}`
      mark(startTag)
    }

    // a flag to mark this as a Vue instance without having to do instanceof
    // check
    vm._isVue = true
    // avoid instances from being observed
    vm.__v_skip = true
    // effect scope
    vm._scope = new EffectScope(true /* detached */)
    // #13134 edge case where a child component is manually created during the
    // render of a parent component
    vm._scope.parent = undefined
    vm._scope._vm = true
    // merge options
    if (options && options._isComponent) {
      // optimize internal component instantiation
      // since dynamic options merging is pretty slow, and none of the
      // internal component options needs special treatment.
      initInternalComponent(vm, options as any)
    } else {
      vm.$options = mergeOptions(
        resolveConstructorOptions(vm.constructor as any),
        options || {},
        vm
      )
    }
    /* istanbul ignore else */
    if (__DEV__) {
      initProxy(vm)
    } else {
      vm._renderProxy = vm
    }
    // expose real self
// ... (84 more lines)

Domain

Subdomains

Frequently Asked Questions

What does init.ts do?
init.ts is a source file in the vue codebase, written in typescript. It belongs to the CoreRuntime domain, Instance subdomain.
What functions are defined in init.ts?
init.ts defines 4 function(s): initInternalComponent, initMixin, resolveConstructorOptions, resolveModifiedOptions.
What does init.ts depend on?
init.ts imports 22 module(s): callHook, component, config.ts, effectScope, events.ts, index.ts, initEvents, initInjections, and 14 more.
What files import init.ts?
init.ts is imported by 1 file(s): index.ts.
Where is init.ts in the architecture?
init.ts is located at src/core/instance/init.ts (domain: CoreRuntime, subdomain: Instance, directory: src/core/instance).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free