Home / Function/ mapEvalOrigin() — vite Function Reference

mapEvalOrigin() — vite Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f40eaafa_db1a_03b4_c837_94e817990f37["mapEvalOrigin()"]
  95cae2f2_ad8c_91c1_5a74_93d939dbc47b["interceptor.ts"]
  f40eaafa_db1a_03b4_c837_94e817990f37 -->|defined in| 95cae2f2_ad8c_91c1_5a74_93d939dbc47b
  b30dd025_db49_148b_f0bc_60f33ba97a2d["wrapCallSite()"]
  b30dd025_db49_148b_f0bc_60f33ba97a2d -->|calls| f40eaafa_db1a_03b4_c837_94e817990f37
  f5792b49_242f_3f04_074c_c9ee1ff25728["mapSourcePosition()"]
  f40eaafa_db1a_03b4_c837_94e817990f37 -->|calls| f5792b49_242f_3f04_074c_c9ee1ff25728
  style f40eaafa_db1a_03b4_c837_94e817990f37 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/module-runner/sourcemap/interceptor.ts lines 239–258

function mapEvalOrigin(origin: string): string {
  // Most eval() calls are in this format
  let match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin)
  if (match) {
    const position = mapSourcePosition({
      name: null,
      source: match[2],
      line: +match[3],
      column: +match[4] - 1,
    })
    return `eval at ${match[1]} (${position.source}:${position.line}:${position.column + 1})`
  }

  // Parse nested eval() calls using recursion
  match = /^eval at ([^(]+) \((.+)\)$/.exec(origin)
  if (match) return `eval at ${match[1]} (${mapEvalOrigin(match[2])})`

  // Make sure we still return useful information if we didn't find anything
  return origin
}

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free