Home / Function/ generateComponentTrace() — vue Function Reference

generateComponentTrace() — vue Function Reference

Architecture documentation for the generateComponentTrace() function in debug.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  73c89571_1794_e614_730a_f2e51e73ac21["generateComponentTrace()"]
  fe63f7db_7077_78bd_e854_a2db4c9c8fd9["onCompilationError()"]
  fe63f7db_7077_78bd_e854_a2db4c9c8fd9 -->|calls| 73c89571_1794_e614_730a_f2e51e73ac21
  e3484a9f_f8a5_4082_0208_641d58b965c3["warn()"]
  e3484a9f_f8a5_4082_0208_641d58b965c3 -->|calls| 73c89571_1794_e614_730a_f2e51e73ac21
  d36a898a_2693_93f3_9d5a_3c914ee38d2e["tip()"]
  d36a898a_2693_93f3_9d5a_3c914ee38d2e -->|calls| 73c89571_1794_e614_730a_f2e51e73ac21
  c31c37ce_bc29_d04b_3422_a3504303dbe3["repeat()"]
  73c89571_1794_e614_730a_f2e51e73ac21 -->|calls| c31c37ce_bc29_d04b_3422_a3504303dbe3
  8d5fd9dd_3c22_737f_cb3e_509698d89d76["formatComponentName()"]
  73c89571_1794_e614_730a_f2e51e73ac21 -->|calls| 8d5fd9dd_3c22_737f_cb3e_509698d89d76
  style 73c89571_1794_e614_730a_f2e51e73ac21 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/util/debug.ts lines 67–104

  generateComponentTrace = (vm: Component | undefined) => {
    if ((vm as any)._isVue && vm!.$parent) {
      const tree: any[] = []
      let currentRecursiveSequence = 0
      while (vm) {
        if (tree.length > 0) {
          const last = tree[tree.length - 1]
          if (last.constructor === vm.constructor) {
            currentRecursiveSequence++
            vm = vm.$parent!
            continue
          } else if (currentRecursiveSequence > 0) {
            tree[tree.length - 1] = [last, currentRecursiveSequence]
            currentRecursiveSequence = 0
          }
        }
        tree.push(vm)
        vm = vm.$parent!
      }
      return (
        '\n\nfound in\n\n' +
        tree
          .map(
            (vm, i) =>
              `${i === 0 ? '---> ' : repeat(' ', 5 + i * 2)}${
                isArray(vm)
                  ? `${formatComponentName(vm[0])}... (${
                      vm[1]
                    } recursive calls)`
                  : formatComponentName(vm)
              }`
          )
          .join('\n')
      )
    } else {
      return `\n\n(found in ${formatComponentName(vm!)})`
    }
  }

Subdomains

Frequently Asked Questions

What does generateComponentTrace() do?
generateComponentTrace() is a function in the vue codebase.
What does generateComponentTrace() call?
generateComponentTrace() calls 2 function(s): formatComponentName, repeat.
What calls generateComponentTrace()?
generateComponentTrace() is called by 3 function(s): onCompilationError, tip, warn.

Analyze Your Own Codebase

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

Try Supermodel Free