function sourceAbsolutePath
sourceAbsolutePath(
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.

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

const decoder = SourceMap.parse('{"sources":["src/a.ts"],"mappings":"AAAA"}', '/proj/tmp');

SourceMap.sourceAbsolutePath(decoder, 0); // '/proj/tmp/src/a.ts'
SourceMap.sourceAbsolutePath(decoder, 7); // null — index out of range

Parameters

sourceIndex: number

Return Type

string | null

Usage

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