Home / Function/ constructor() — vue Function Reference

constructor() — vue Function Reference

Architecture documentation for the constructor() function in index.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  cb7fcd4e_839f_4b0e_63b8_6edbf71089f4["constructor()"]
  6267c156_f90f_17b7_4f37_300535e21f45["TemplateRenderer"]
  cb7fcd4e_839f_4b0e_63b8_6edbf71089f4 -->|defined in| 6267c156_f90f_17b7_4f37_300535e21f45
  3288e0bb_762b_d897_a5dc_75b8394d701c["constructor()"]
  3288e0bb_762b_d897_a5dc_75b8394d701c -->|calls| cb7fcd4e_839f_4b0e_63b8_6edbf71089f4
  3288e0bb_762b_d897_a5dc_75b8394d701c["constructor()"]
  cb7fcd4e_839f_4b0e_63b8_6edbf71089f4 -->|calls| 3288e0bb_762b_d897_a5dc_75b8394d701c
  5e6bd556_e2df_8a9e_92d8_4dd8802c1afb["parseTemplate()"]
  cb7fcd4e_839f_4b0e_63b8_6edbf71089f4 -->|calls| 5e6bd556_e2df_8a9e_92d8_4dd8802c1afb
  3374bf24_e427_7785_d006_3cebda20e675["createMapper()"]
  cb7fcd4e_839f_4b0e_63b8_6edbf71089f4 -->|calls| 3374bf24_e427_7785_d006_3cebda20e675
  style cb7fcd4e_839f_4b0e_63b8_6edbf71089f4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/template-renderer/index.ts lines 58–92

  constructor(options: TemplateRendererOptions) {
    this.options = options
    this.inject = options.inject !== false
    // if no template option is provided, the renderer is created
    // as a utility object for rendering assets like preload links and scripts.

    const { template } = options
    this.parsedTemplate = template
      ? typeof template === 'string'
        ? parseTemplate(template)
        : template
      : null

    // function used to serialize initial state JSON
    this.serialize =
      options.serializer ||
      (state => {
        return serialize(state, { isJSON: true })
      })

    // extra functionality with client manifest
    if (options.clientManifest) {
      const clientManifest = (this.clientManifest = options.clientManifest)
      // ensure publicPath ends with /
      this.publicPath =
        clientManifest.publicPath === ''
          ? ''
          : clientManifest.publicPath.replace(/([^\/])$/, '$1/')
      // preload/prefetch directives
      this.preloadFiles = (clientManifest.initial || []).map(normalizeFile)
      this.prefetchFiles = (clientManifest.async || []).map(normalizeFile)
      // initial async chunk mapping
      this.mapFiles = createMapper(clientManifest)
    }
  }

Subdomains

Called By

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the vue codebase, defined in packages/server-renderer/src/template-renderer/index.ts.
Where is constructor() defined?
constructor() is defined in packages/server-renderer/src/template-renderer/index.ts at line 58.
What does constructor() call?
constructor() calls 3 function(s): constructor, createMapper, parseTemplate.
What calls constructor()?
constructor() is called by 1 function(s): constructor.

Analyze Your Own Codebase

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

Try Supermodel Free