Home / File/ assets.ts — vue Source File

assets.ts — vue Source File

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

File typescript VueCore GlobalAPI 3 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  b44eb3a4_7cb3_6229_eafe_c01a5edb54b3["assets.ts"]
  76672dd6_4e87_4468_a48b_f4da793fd211["index.ts"]
  b44eb3a4_7cb3_6229_eafe_c01a5edb54b3 --> 76672dd6_4e87_4468_a48b_f4da793fd211
  ab8fc425_80ef_461f_288a_985447c26d02["constants"]
  b44eb3a4_7cb3_6229_eafe_c01a5edb54b3 --> ab8fc425_80ef_461f_288a_985447c26d02
  e113c728_56e1_b7c8_935f_f89af3e6c5fc["global-api"]
  b44eb3a4_7cb3_6229_eafe_c01a5edb54b3 --> e113c728_56e1_b7c8_935f_f89af3e6c5fc
  65cf792e_a676_cf99_19ca_1e38df384bdc["index.ts"]
  65cf792e_a676_cf99_19ca_1e38df384bdc --> b44eb3a4_7cb3_6229_eafe_c01a5edb54b3
  style b44eb3a4_7cb3_6229_eafe_c01a5edb54b3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { ASSET_TYPES } from 'shared/constants'
import type { GlobalAPI } from 'types/global-api'
import { isFunction, isPlainObject, validateComponentName } from '../util/index'

export function initAssetRegisters(Vue: GlobalAPI) {
  /**
   * Create asset registration methods.
   */
  ASSET_TYPES.forEach(type => {
    // @ts-expect-error function is not exact same type
    Vue[type] = function (
      id: string,
      definition?: Function | Object
    ): Function | Object | void {
      if (!definition) {
        return this.options[type + 's'][id]
      } else {
        /* istanbul ignore if */
        if (__DEV__ && type === 'component') {
          validateComponentName(id)
        }
        if (type === 'component' && isPlainObject(definition)) {
          // @ts-expect-error
          definition.name = definition.name || id
          definition = this.options._base.extend(definition)
        }
        if (type === 'directive' && isFunction(definition)) {
          definition = { bind: definition, update: definition }
        }
        this.options[type + 's'][id] = definition
        return definition
      }
    }
  })
}

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does assets.ts do?
assets.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, GlobalAPI subdomain.
What functions are defined in assets.ts?
assets.ts defines 1 function(s): initAssetRegisters.
What does assets.ts depend on?
assets.ts imports 3 module(s): constants, global-api, index.ts.
What files import assets.ts?
assets.ts is imported by 1 file(s): index.ts.
Where is assets.ts in the architecture?
assets.ts is located at src/core/global-api/assets.ts (domain: VueCore, subdomain: GlobalAPI, directory: src/core/global-api).

Analyze Your Own Codebase

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

Try Supermodel Free