Problem
Browsers report column numbers in stack traces as 1-based, but the source-map library's originalPositionFor expects 0-based columns (lines are 1-based). In src/lib.ts:37 the column from the parsed stack frame is passed as-is:
result = bindings[file].consumer.originalPositionFor({ column, line })
Symmetrically, on output (generateStackTraceLine, src/lib.ts:44) the column returned by originalPositionFor is 0-based but is printed directly, while users expect the browser's 1-based convention.
Existing tests don't catch this because the default GREATEST_LOWER_BOUND bias usually resolves the +1-shifted column to the same mapping.
Suggested fix
- Pass
column - 1 into originalPositionFor.
- Print
column + 1 for mapped positions.
- Add a test fixture where the off-by-one produces a visibly different result.
Problem
Browsers report column numbers in stack traces as 1-based, but the
source-maplibrary'soriginalPositionForexpects 0-based columns (lines are 1-based). Insrc/lib.ts:37the column from the parsed stack frame is passed as-is:Symmetrically, on output (
generateStackTraceLine,src/lib.ts:44) the column returned byoriginalPositionForis 0-based but is printed directly, while users expect the browser's 1-based convention.Existing tests don't catch this because the default
GREATEST_LOWER_BOUNDbias usually resolves the +1-shifted column to the same mapping.Suggested fix
column - 1intooriginalPositionFor.column + 1for mapped positions.