diff options
Diffstat (limited to 'packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts')
-rw-r--r-- | packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts b/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts index 3b3f05c6b..cae0eb526 100644 --- a/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts +++ b/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts @@ -80,7 +80,7 @@ class ActualSourceMap implements SourceMap { const { line: gline, column: gcolumn } = lineRange; return { - line: lineToLine(gline), + line: lineTo0BasedLine(gline), column: columnToColumn(gcolumn), verified: true, }; @@ -144,9 +144,17 @@ class NoopSourceMap implements SourceMap { const defaultSourceMap = new NoopSourceMap(); export function SourceMap(url?: string): SourceMap { - if (!url || !url.startsWith("data:")) { + if (!url) { return defaultSourceMap; } + if (!url.startsWith("data:")) { + const match = url.match(/\/\/[#@]\s*sourceMappingURL=(.*)$/m); + if (!match) { + return defaultSourceMap; + } + const [_, sourceMapUrl] = match; + url = sourceMapUrl; + } try { const [_, base64] = url.split(",", 2); const decoded = Buffer.from(base64, "base64url").toString("utf8"); |