Home / Function/ retrieveSourceMapURL() — vite Function Reference

retrieveSourceMapURL() — vite Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ce4b11bc_7b1a_430f_6b4b_8988491e4e1a["retrieveSourceMapURL()"]
  95cae2f2_ad8c_91c1_5a74_93d939dbc47b["interceptor.ts"]
  ce4b11bc_7b1a_430f_6b4b_8988491e4e1a -->|defined in| 95cae2f2_ad8c_91c1_5a74_93d939dbc47b
  06f9b71d_962e_e798_0173_2861abfd51c7["retrieveSourceMap()"]
  06f9b71d_962e_e798_0173_2861abfd51c7 -->|calls| ce4b11bc_7b1a_430f_6b4b_8988491e4e1a
  b9bf4fd4_6edf_1b84_791a_2250b81be54d["retrieveFile()"]
  ce4b11bc_7b1a_430f_6b4b_8988491e4e1a -->|calls| b9bf4fd4_6edf_1b84_791a_2250b81be54d
  style ce4b11bc_7b1a_430f_6b4b_8988491e4e1a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/module-runner/sourcemap/interceptor.ts lines 128–141

function retrieveSourceMapURL(source: string) {
  // Get the URL of the source map
  const fileData = retrieveFile(source)
  if (!fileData) return null
  const re =
    /\/\/[@#]\s*sourceMappingURL=([^\s'"]+)\s*$|\/\*[@#]\s*sourceMappingURL=[^\s*'"]+\s*\*\/\s*$/gm
  // Keep executing the search to find the *last* sourceMappingURL to avoid
  // picking up sourceMappingURLs from comments, strings, etc.
  let lastMatch, match

  while ((match = re.exec(fileData))) lastMatch = match
  if (!lastMatch) return null
  return lastMatch[1]
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free