Home / Function/ getScriptInfo() — vite Function Reference

getScriptInfo() — vite Function Reference

Architecture documentation for the getScriptInfo() function in html.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  a37f0802_91ab_f008_65a6_1e79c811c37f["getScriptInfo()"]
  f8fe0737_718a_5509_b722_473f207d5906["html.ts"]
  a37f0802_91ab_f008_65a6_1e79c811c37f -->|defined in| f8fe0737_718a_5509_b722_473f207d5906
  39f26be8_b1d9_a756_3043_474687a6bbb7["buildHtmlPlugin()"]
  39f26be8_b1d9_a756_3043_474687a6bbb7 -->|calls| a37f0802_91ab_f008_65a6_1e79c811c37f
  c7929a5b_9791_180a_9c0b_4f479fb4cf3f["devHtmlHook()"]
  c7929a5b_9791_180a_9c0b_4f479fb4cf3f -->|calls| a37f0802_91ab_f008_65a6_1e79c811c37f
  style a37f0802_91ab_f008_65a6_1e79c811c37f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/html.ts lines 225–253

export function getScriptInfo(node: DefaultTreeAdapterMap['element']): {
  src: Token.Attribute | undefined
  srcSourceCodeLocation: Token.Location | undefined
  isModule: boolean
  isAsync: boolean
  isIgnored: boolean
} {
  let src: Token.Attribute | undefined
  let srcSourceCodeLocation: Token.Location | undefined
  let isModule = false
  let isAsync = false
  let isIgnored = false
  for (const p of node.attrs) {
    if (p.prefix !== undefined) continue
    if (p.name === 'src') {
      if (!src) {
        src = p
        srcSourceCodeLocation = node.sourceCodeLocation?.attrs!['src']
      }
    } else if (p.name === 'type' && p.value === 'module') {
      isModule = true
    } else if (p.name === 'async') {
      isAsync = true
    } else if (p.name === 'vite-ignore') {
      isIgnored = true
    }
  }
  return { src, srcSourceCodeLocation, isModule, isAsync, isIgnored }
}

Domain

Subdomains

Frequently Asked Questions

What does getScriptInfo() do?
getScriptInfo() is a function in the vite codebase, defined in packages/vite/src/node/plugins/html.ts.
Where is getScriptInfo() defined?
getScriptInfo() is defined in packages/vite/src/node/plugins/html.ts at line 225.
What calls getScriptInfo()?
getScriptInfo() is called by 2 function(s): buildHtmlPlugin, devHtmlHook.

Analyze Your Own Codebase

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

Try Supermodel Free