interface SourceMapDecoder

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

import * as SourceMap from './source-map.ts';

const decoder: SourceMap.SourceMapDecoder = SourceMap.parse('{"sources":["src/a.ts"],"mappings":"AAAA"}', '/proj/tmp');
decoder.outDir; // '/proj/tmp' — relative `sources` entries resolve against it

Properties

Decoded segments indexed by 0-based generated line number.

sources: string[]

Raw source paths from the map (may be relative to outDir).

sourceRoot: string

Source-root prefix from the map JSON (usually "" for esbuild output).

outDir: string

Absolute directory of the bundle file, used to resolve relative source paths.

sourcesContent: (string | null)[]

Original source texts verbatim from the map JSON; one entry per sources element.

Usage

import { type SourceMapDecoder } from "lib/utils/source-map.ts";