aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts
diff options
context:
space:
mode:
authorGravatar Ashcon Partovi <ashcon@partovi.net> 2023-08-29 23:44:39 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-29 23:44:39 -0700
commitf2553d24543d72a777ba60213473332809866cb2 (patch)
tree61faac4292dbdf1b4d0543e33d3f5d2c792825c5 /packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts
parentc028b206bce3f9b5c3cba7899c6bf34856efe43f (diff)
downloadbun-f2553d24543d72a777ba60213473332809866cb2.tar.gz
bun-f2553d24543d72a777ba60213473332809866cb2.tar.zst
bun-f2553d24543d72a777ba60213473332809866cb2.zip
More support for DAP (#4380)
* Fix reconnect with --watch * Support setVariable * Support setExpression * Support watch variables * Conditional and hit breakpoints * Support exceptionInfo * Support goto and gotoTargets * Support completions * Support both a URL and UNIX inspector at the same time * Fix url * WIP, add timeouts to figure out issue * Fix messages being dropped from debugger.ts * Progress * Fix breakpoints and ref-event-loop * More fixes * Fix exit * Make hovers better * Fix --hot
Diffstat (limited to 'packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts')
-rw-r--r--packages/bun-debug-adapter-protocol/src/debugger/sourcemap.ts12
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");