Home / File/ apiSetup.ts — vue Source File

apiSetup.ts — vue Source File

Architecture documentation for apiSetup.ts, a typescript file in the vue codebase. 17 imports, 0 dependents.

File typescript VueCore VDom 17 imports 14 functions

Entity Profile

Dependency Diagram

graph LR
  3a7c7919_1905_22a7_f604_9084d5e5d0df["apiSetup.ts"]
  e5c4d6ab_2495_a6d4_d962_9d9f71bf3114["dep.ts"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> e5c4d6ab_2495_a6d4_d962_9d9f71bf3114
  e4823f37_5db2_5310_aa9c_5b3593b02b07["popTarget"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> e4823f37_5db2_5310_aa9c_5b3593b02b07
  d9fae33f_7845_7289_de16_bee11c7f60e1["pushTarget"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> d9fae33f_7845_7289_de16_bee11c7f60e1
  76672dd6_4e87_4468_a48b_f4da793fd211["index.ts"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 76672dd6_4e87_4468_a48b_f4da793fd211
  5164a61d_92b2_9c7f_8acb_b18093afdb59["vnode.ts"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 5164a61d_92b2_9c7f_8acb_b18093afdb59
  5ad3a184_20dd_3738_991b_41d3120e21c9["VNode"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 5ad3a184_20dd_3738_991b_41d3120e21c9
  b7977953_caa1_d867_207c_74cfbf6421e0["util.ts"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> b7977953_caa1_d867_207c_74cfbf6421e0
  82a7440d_c9f9_b86f_d255_d7b035940ca2["isFunction"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 82a7440d_c9f9_b86f_d255_d7b035940ca2
  6c50c697_3e50_26c1_85ed_ce95cf6e8b72["isObject"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 6c50c697_3e50_26c1_85ed_ce95cf6e8b72
  9f3b1774_ebd5_0845_1a85_868e0c1fd480["currentInstance.ts"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 9f3b1774_ebd5_0845_1a85_868e0c1fd480
  d455acb0_4874_02b0_4271_588c2e7f6b9b["setCurrentInstance"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> d455acb0_4874_02b0_4271_588c2e7f6b9b
  e84ea476_9f30_e7b9_aaa0_4026f0c97365["reactive.ts"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> e84ea476_9f30_e7b9_aaa0_4026f0c97365
  752741bd_d268_dc94_2907_951371b7b204["shallowReactive"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 752741bd_d268_dc94_2907_951371b7b204
  22b44e72_ad0a_6a98_e36a_e325291fd02b["ref.ts"]
  3a7c7919_1905_22a7_f604_9084d5e5d0df --> 22b44e72_ad0a_6a98_e36a_e325291fd02b
  style 3a7c7919_1905_22a7_f604_9084d5e5d0df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { Component } from 'types/component'
import { PropOptions } from 'types/options'
import { popTarget, pushTarget } from '../core/observer/dep'
import { def, invokeWithErrorHandling, isReserved, warn } from '../core/util'
import VNode from '../core/vdom/vnode'
import {
  bind,
  emptyObject,
  isArray,
  isFunction,
  isObject
} from '../shared/util'
import { currentInstance, setCurrentInstance } from './currentInstance'
import { shallowReactive } from './reactivity/reactive'
import { proxyWithRefUnwrap } from './reactivity/ref'

/**
 * @internal
 */
export interface SetupContext {
  attrs: Record<string, any>
  listeners: Record<string, Function | Function[]>
  slots: Record<string, () => VNode[]>
  emit: (event: string, ...args: any[]) => any
  expose: (exposed: Record<string, any>) => void
}

export function initSetup(vm: Component) {
  const options = vm.$options
  const setup = options.setup
  if (setup) {
    const ctx = (vm._setupContext = createSetupContext(vm))

    setCurrentInstance(vm)
    pushTarget()
    const setupResult = invokeWithErrorHandling(
      setup,
      null,
      [vm._props || shallowReactive({}), ctx],
      vm,
      `setup`
    )
    popTarget()
    setCurrentInstance()

    if (isFunction(setupResult)) {
      // render function
      // @ts-ignore
      options.render = setupResult
    } else if (isObject(setupResult)) {
      // bindings
      if (__DEV__ && setupResult instanceof VNode) {
        warn(
          `setup() should not return VNodes directly - ` +
            `return a render function instead.`
        )
      }
      vm._setupState = setupResult
      // __sfc indicates compiled bindings from <script setup>
      if (!setupResult.__sfc) {
// ... (187 more lines)

Domain

Subdomains

Types

Frequently Asked Questions

What does apiSetup.ts do?
apiSetup.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 apiSetup.ts?
apiSetup.ts defines 14 function(s): VNode, createSetupContext, defineProxyAttr, event, exposed, getContext, initSetup, initSlotsProxy, mergeDefaults, syncSetupProxy, and 4 more.
What does apiSetup.ts depend on?
apiSetup.ts imports 17 module(s): VNode, component, currentInstance.ts, dep.ts, index.ts, isFunction, isObject, options, and 9 more.
Where is apiSetup.ts in the architecture?
apiSetup.ts is located at src/v3/apiSetup.ts (domain: VueCore, subdomain: VDom, directory: src/v3).

Analyze Your Own Codebase

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

Try Supermodel Free