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 CompilerSFC StyleProcessor 3 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  cbff02ff_d07c_20c5_3983_6117ca41c317["assets.ts"]
  2a298df2_21b8_7e5a_c372_51ba50c9d92d["index.ts"]
  cbff02ff_d07c_20c5_3983_6117ca41c317 --> 2a298df2_21b8_7e5a_c372_51ba50c9d92d
  19d0b34b_7289_2457_32d9_273105740f2a["constants"]
  cbff02ff_d07c_20c5_3983_6117ca41c317 --> 19d0b34b_7289_2457_32d9_273105740f2a
  51931e9b_f9dc_de8e_3f55_263f1372f144["global-api"]
  cbff02ff_d07c_20c5_3983_6117ca41c317 --> 51931e9b_f9dc_de8e_3f55_263f1372f144
  6090fc15_0543_136f_4e4a_ce1860382ce6["index.ts"]
  6090fc15_0543_136f_4e4a_ce1860382ce6 --> cbff02ff_d07c_20c5_3983_6117ca41c317
  style cbff02ff_d07c_20c5_3983_6117ca41c317 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 CompilerSFC domain, StyleProcessor 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: CompilerSFC, subdomain: StyleProcessor, 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