From 5957edb39b0e3119ac9b9c92a2d6fea8cc893266 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Wed, 20 Aug 2025 17:02:52 -0400 Subject: [PATCH] Handle infinite lastGeneratedColumn If I understand correctly, the source-map library may set lastGeneratedColumn to infinity for the end of a mapping range: https://github.com/mozilla/source-map/blob/v0.7.4/lib/source-map-consumer.js#L405 I believe it makes sense to represent this as the last valid column. See #248 --- src/lib/explore.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/explore.ts b/src/lib/explore.ts index 0ad3fb9..450d9ef 100644 --- a/src/lib/explore.ts +++ b/src/lib/explore.ts @@ -179,7 +179,9 @@ function checkInvalidMappingColumn(context: ComputeFileSizesContext): void { const { line, generatedLine, generatedColumn } = context; const maxColumnIndex = line.length - 1; - if (generatedColumn > maxColumnIndex) { + if (generatedColumn === Infinity) { + context.generatedColumn = maxColumnIndex; + } else if (generatedColumn > maxColumnIndex) { if (isReferencingEOL(context, maxColumnIndex)) { return; }