Home / Function/ text() — vite Function Reference

text() — vite Function Reference

Architecture documentation for the text() function in overlay.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  b2324c1b_ec31_980c_8408_543ca7920038["text()"]
  033d9b63_5269_212a_e5d9_bd61baab6243["ErrorOverlay"]
  b2324c1b_ec31_980c_8408_543ca7920038 -->|defined in| 033d9b63_5269_212a_e5d9_bd61baab6243
  fa7ed98c_b01d_f7ac_6336_e938d321dd76["constructor()"]
  fa7ed98c_b01d_f7ac_6336_e938d321dd76 -->|calls| b2324c1b_ec31_980c_8408_543ca7920038
  style b2324c1b_ec31_980c_8408_543ca7920038 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/client/overlay.ts lines 264–294

  text(selector: string, text: string, linkFiles = false): void {
    const el = this.root.querySelector(selector)!
    if (!linkFiles) {
      el.textContent = text
    } else {
      let curIndex = 0
      let match: RegExpExecArray | null
      fileRE.lastIndex = 0
      while ((match = fileRE.exec(text))) {
        const { 0: file, index } = match
        const frag = text.slice(curIndex, index)
        el.appendChild(document.createTextNode(frag))
        const link = document.createElement('a')
        link.textContent = file
        link.className = 'file-link'
        link.onclick = () => {
          fetch(
            new URL(
              `${base}__open-in-editor?file=${encodeURIComponent(file)}`,
              import.meta.url,
            ),
          )
        }
        el.appendChild(link)
        curIndex += frag.length + file.length
      }
      if (curIndex < text.length) {
        el.appendChild(document.createTextNode(text.slice(curIndex)))
      }
    }
  }

Domain

Subdomains

Called By

Frequently Asked Questions

What does text() do?
text() is a function in the vite codebase, defined in packages/vite/src/client/overlay.ts.
Where is text() defined?
text() is defined in packages/vite/src/client/overlay.ts at line 264.
What calls text()?
text() 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