Home / Function/ getModuleSourceMapById() — vite Function Reference

getModuleSourceMapById() — vite Function Reference

Architecture documentation for the getModuleSourceMapById() function in evaluatedModules.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  e81a4d92_bae8_27e6_4a9c_4bd47c82e4ad["getModuleSourceMapById()"]
  d84d2810_d37a_ae7f_1268_3cbf7c3dad5f["EvaluatedModules"]
  e81a4d92_bae8_27e6_4a9c_4bd47c82e4ad -->|defined in| d84d2810_d37a_ae7f_1268_3cbf7c3dad5f
  94a96327_7ba3_9fa8_c1c1_02a5f405e143["getRunnerSourceMap()"]
  94a96327_7ba3_9fa8_c1c1_02a5f405e143 -->|calls| e81a4d92_bae8_27e6_4a9c_4bd47c82e4ad
  24b233d7_77c1_26bc_480a_2a23dd944099["getModuleById()"]
  e81a4d92_bae8_27e6_4a9c_4bd47c82e4ad -->|calls| 24b233d7_77c1_26bc_480a_2a23dd944099
  1f98cd6a_b860_9dfb_69e1_70665d44d35c["decodeBase64()"]
  e81a4d92_bae8_27e6_4a9c_4bd47c82e4ad -->|calls| 1f98cd6a_b860_9dfb_69e1_70665d44d35c
  style e81a4d92_bae8_27e6_4a9c_4bd47c82e4ad fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/module-runner/evaluatedModules.ts lines 107–123

  getModuleSourceMapById(id: string): DecodedMap | null {
    const mod = this.getModuleById(id)
    if (!mod) return null
    if (mod.map) return mod.map
    if (!mod.meta || !('code' in mod.meta)) return null

    const pattern = `//# ${SOURCEMAPPING_URL}=data:application/json;base64,`
    const lastIndex = mod.meta.code.lastIndexOf(pattern)
    if (lastIndex === -1) return null

    const mapString = MODULE_RUNNER_SOURCEMAPPING_REGEXP.exec(
      mod.meta.code.slice(lastIndex),
    )?.[1]
    if (!mapString) return null
    mod.map = new DecodedMap(JSON.parse(decodeBase64(mapString)), mod.file)
    return mod.map
  }

Domain

Subdomains

Frequently Asked Questions

What does getModuleSourceMapById() do?
getModuleSourceMapById() is a function in the vite codebase, defined in packages/vite/src/module-runner/evaluatedModules.ts.
Where is getModuleSourceMapById() defined?
getModuleSourceMapById() is defined in packages/vite/src/module-runner/evaluatedModules.ts at line 107.
What does getModuleSourceMapById() call?
getModuleSourceMapById() calls 2 function(s): decodeBase64, getModuleById.
What calls getModuleSourceMapById()?
getModuleSourceMapById() is called by 1 function(s): getRunnerSourceMap.

Analyze Your Own Codebase

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

Try Supermodel Free