decoder.ts — vite Source File
Architecture documentation for decoder.ts, a typescript file in the vite codebase. 2 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR d4f6d186_baf8_38ee_e63e_b58f4d86f016["decoder.ts"] 81939ddb_795d_a69b_d1ea_fb1af459ccc2["utils.ts"] d4f6d186_baf8_38ee_e63e_b58f4d86f016 --> 81939ddb_795d_a69b_d1ea_fb1af459ccc2 b84d7b55_2c14_7c59_01d9_b663416bfad1["trace-mapping"] d4f6d186_baf8_38ee_e63e_b58f4d86f016 --> b84d7b55_2c14_7c59_01d9_b663416bfad1 9f67d7a4_f300_a592_a5b0_c8f97c2d3564["evaluatedModules.ts"] 9f67d7a4_f300_a592_a5b0_c8f97c2d3564 --> d4f6d186_baf8_38ee_e63e_b58f4d86f016 95cae2f2_ad8c_91c1_5a74_93d939dbc47b["interceptor.ts"] 95cae2f2_ad8c_91c1_5a74_93d939dbc47b --> d4f6d186_baf8_38ee_e63e_b58f4d86f016 style d4f6d186_baf8_38ee_e63e_b58f4d86f016 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { OriginalMapping } from '@jridgewell/trace-mapping'
import { originalPositionFor } from '@jridgewell/trace-mapping'
import { posixDirname, posixResolve } from '../utils'
interface SourceMapLike {
version: number
mappings?: string
names?: string[]
sources?: string[]
sourcesContent?: string[]
}
type Needle = {
line: number
column: number
}
export class DecodedMap {
_encoded: string
_decoded: undefined | number[][][]
_decodedMemo: Stats
url: string
file: string
version: number
names: string[] = []
resolvedSources: string[]
constructor(
public map: SourceMapLike,
from: string,
) {
const { mappings, names, sources } = map
this.version = map.version
this.names = names || []
this._encoded = mappings || ''
this._decodedMemo = memoizedState()
this.url = from
this.file = from
const originDir = posixDirname(from)
this.resolvedSources = (sources || []).map((s) =>
posixResolve(originDir, s || ''),
)
}
}
interface Stats {
lastKey: number
lastNeedle: number
lastIndex: number
}
function memoizedState(): Stats {
return {
lastKey: -1,
lastNeedle: -1,
lastIndex: -1,
}
}
export function getOriginalPosition(
map: DecodedMap,
needle: Needle,
): OriginalMapping | null {
const result = originalPositionFor(map as any, needle)
if (result.column == null) {
return null
}
return result
}
Domain
Subdomains
Functions
Classes
Types
Dependencies
- trace-mapping
- utils.ts
Imported By
Source
Frequently Asked Questions
What does decoder.ts do?
decoder.ts is a source file in the vite codebase, written in typescript. It belongs to the ModuleRunner domain, SSRRuntime subdomain.
What functions are defined in decoder.ts?
decoder.ts defines 2 function(s): getOriginalPosition, memoizedState.
What does decoder.ts depend on?
decoder.ts imports 2 module(s): trace-mapping, utils.ts.
What files import decoder.ts?
decoder.ts is imported by 2 file(s): evaluatedModules.ts, interceptor.ts.
Where is decoder.ts in the architecture?
decoder.ts is located at packages/vite/src/module-runner/sourcemap/decoder.ts (domain: ModuleRunner, subdomain: SSRRuntime, directory: packages/vite/src/module-runner/sourcemap).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free