formatSourcemapForSnapshot() — vite Function Reference
Architecture documentation for the formatSourcemapForSnapshot() function in test-utils.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD fbb1ff59_446a_02d0_bbb2_117c052d903c["formatSourcemapForSnapshot()"] c68b21f4_9cd3_3abe_8169_0de2c9650f53["test-utils.ts"] fbb1ff59_446a_02d0_bbb2_117c052d903c -->|defined in| c68b21f4_9cd3_3abe_8169_0de2c9650f53 style fbb1ff59_446a_02d0_bbb2_117c052d903c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
playground/test-utils.ts lines 358–378
export const formatSourcemapForSnapshot = (
map: any,
code: string,
withoutContent = false,
): any => {
const root = normalizePath(testDir)
const m = { ...map }
delete m.file
if (m.names && m.names.length === 0) {
delete m.names
}
if (m.debugId) {
m.debugId = '00000000-0000-0000-0000-000000000000'
}
m.sources = m.sources.map((source) => source.replace(root, '/root'))
if (m.sourceRoot) {
m.sourceRoot = m.sourceRoot.replace(root, '/root')
}
const c = removeComments(code.replace(/\?v=[\da-f]{8}/g, '?v=00000000'))
return { map: m, code: c, [sourcemapSnapshot]: { withoutContent } }
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does formatSourcemapForSnapshot() do?
formatSourcemapForSnapshot() is a function in the vite codebase, defined in playground/test-utils.ts.
Where is formatSourcemapForSnapshot() defined?
formatSourcemapForSnapshot() is defined in playground/test-utils.ts at line 358.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free