Home / Function/ supportRelativeURL() — vite Function Reference

supportRelativeURL() — vite Function Reference

Architecture documentation for the supportRelativeURL() function in interceptor.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  63f2556d_48de_27dc_3e1e_e91767d1afcf["supportRelativeURL()"]
  95cae2f2_ad8c_91c1_5a74_93d939dbc47b["interceptor.ts"]
  63f2556d_48de_27dc_3e1e_e91767d1afcf -->|defined in| 95cae2f2_ad8c_91c1_5a74_93d939dbc47b
  06f9b71d_962e_e798_0173_2861abfd51c7["retrieveSourceMap()"]
  06f9b71d_962e_e798_0173_2861abfd51c7 -->|calls| 63f2556d_48de_27dc_3e1e_e91767d1afcf
  f5792b49_242f_3f04_074c_c9ee1ff25728["mapSourcePosition()"]
  f5792b49_242f_3f04_074c_c9ee1ff25728 -->|calls| 63f2556d_48de_27dc_3e1e_e91767d1afcf
  f094d39d_cd97_2548_86c3_38902c2f3301["slash()"]
  63f2556d_48de_27dc_3e1e_e91767d1afcf -->|calls| f094d39d_cd97_2548_86c3_38902c2f3301
  style 63f2556d_48de_27dc_3e1e_e91767d1afcf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/module-runner/sourcemap/interceptor.ts lines 90–102

function supportRelativeURL(file: string, url: string) {
  if (!file) return url
  const dir = posixDirname(slash(file))
  const match = /^\w+:\/\/[^/]*/.exec(dir)
  let protocol = match ? match[0] : ''
  const startPath = dir.slice(protocol.length)
  if (protocol && /^\/\w:/.test(startPath)) {
    // handle file:///C:/ paths
    protocol += '/'
    return protocol + slash(posixResolve(startPath, url))
  }
  return protocol + posixResolve(startPath, url)
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does supportRelativeURL() do?
supportRelativeURL() is a function in the vite codebase, defined in packages/vite/src/module-runner/sourcemap/interceptor.ts.
Where is supportRelativeURL() defined?
supportRelativeURL() is defined in packages/vite/src/module-runner/sourcemap/interceptor.ts at line 90.
What does supportRelativeURL() call?
supportRelativeURL() calls 1 function(s): slash.
What calls supportRelativeURL()?
supportRelativeURL() is called by 2 function(s): mapSourcePosition, retrieveSourceMap.

Analyze Your Own Codebase

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

Try Supermodel Free