Functions

f
decodeMappings(mappings: string): Segment[][]

Parses the compact mappings string from a source-map V3 object into a per-line array of segments, sorted by generatedCol (esbuild always emits them in order).

f
extractInline(
bundle: ArrayBufferView | string | null,
outDir: string
): SourceMapDecoder | null

Extracts and decodes the inline source map that esbuild appends to a bundle as //# sourceMappingURL=data:application/json;base64,…. Returns null when no inline map is present or parsing fails.

f
isBundleUrl(url: string): boolean

Returns true when url points to a test bundle (/tests.js or /filtered-tests.js) served by the local HTTP server.

f
lookupPosition(
decoder: SourceMapDecoder,
generatedLine: number,
generatedCol: number
):
{ absolutePath: string; line: number; col: number; sourceText: string | null; }
| null

Returns the original source position for a generated (line, col) pair. Both coordinates are 1-based (the format Chrome uses in Error.stack). Returns null when the position cannot be mapped.

f
parse(
json: string,
outDir: string
): SourceMapDecoder

Parses a source-map V3 JSON string into a SourceMapDecoder ready for position lookup.

f
parseFrameLocation(text: string): { url: string; line: number; col: number; } | null

Parses the trailing URL:LINE:COL suffix of a stack frame. The greedy (.+) group captures URLs that contain colons (e.g. http://host:PORT/path); the regex anchors mean the last two :digits sequences are always the line/col.

f
readVLQ(
text: string,
position: number
): [number, number]

Reads one VLQ-encoded integer from text starting at position. Returns [decodedValue, positionAfterLastConsumedChar].

f
resolveFrame(
frame: string,
decoder: SourceMapDecoder,
projectRoot: string
):
{ resolved: string; userPath: string | null; sourceText: string | null; }
| null

Attempts to resolve a single stack-frame line to its original source location. Handles Chrome named (at FUNC (URL:L:C)), Chrome anonymous (at [async] URL:L:C), and Firefox/WebKit (FUNC@URL:L:C) formats.

f
sourceAbsolutePath(
decoder: SourceMapDecoder,
sourceIndex: number
): string | null

Resolves the absolute path of the source at sourceIndex in the map's sources array, applying the same sourceRoot + outDir rules as position lookups. Returns null when the index is out of range or the entry is empty. Used by the coverage collector to key accumulated line coverage by absolute source path.

Interfaces

I
Segment

One decoded mapping entry. All coordinates are 0-based.

I
SourceMapDecoder

Parsed representation of a source-map V3 JSON, ready for position lookup.