Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7860fad
test: vendor 13 upstream node:inspector tests that already pass
cirospaciari Jul 24, 2026
cdc6e24
inspector: Node-shaped inspector.console, CLI-started inspector url()…
cirospaciari Jul 24, 2026
b6be750
node inspect: port the CLI debugger client and probe mode
cirospaciari Jul 24, 2026
4a8854d
test: vendor 31 node inspect debugger tests from Node v26.3.0
cirospaciari Jul 24, 2026
aaf6869
node inspect: match V8 remote-object and step-pause shapes; vendor 5 …
cirospaciari Jul 24, 2026
fa80583
inspector: don't SIGUSR1 the target from process._debugProcess; keep …
cirospaciari Jul 24, 2026
b4fe061
test: drop test-debugger-preserve-breaks.js
cirospaciari Jul 24, 2026
f96815c
test: drop debugger fixtures with no vendored consumer
cirospaciari Jul 24, 2026
9969fe5
node inspect: revert process._debugProcess to a stub, rename the REPL…
cirospaciari Jul 24, 2026
588e296
inspector: release the throw scope on the entry-point promise return
cirospaciari Jul 24, 2026
e907324
Merge node-inspector-domains into combined 34719 stack
cirospaciari Jul 24, 2026
6bdea12
Merge node-inspect-debugger into combined 34719 stack
cirospaciari Jul 24, 2026
e605c13
debugger: read debug.cdpUrl into a local before the CDP report
cirospaciari Jul 24, 2026
df9e98e
ci: allow the binary-size increase for the node inspect subsystem [al…
cirospaciari Jul 24, 2026
fdbcc23
node inspect: match either path separator inside a probe suffix on Wi…
cirospaciari Jul 24, 2026
c46c9ab
ci: allow the binary-size increase for the node inspect subsystem [al…
cirospaciari Jul 24, 2026
7325092
inspector: fix four V8-fidelity gaps in the CDP adapter
cirospaciari Jul 24, 2026
76630c5
process: reflect the bound CLI inspector port in process.debugPort
cirospaciari Jul 24, 2026
2dbee2d
inspector: console.profile events, heap snapshots, and error-preview …
cirospaciari Jul 24, 2026
4899d4b
inspector: finish server startup before the inspected thread runs
cirospaciari Jul 24, 2026
f7a8595
test: sync common/inspector-helper.js with Node v26.3.0 (adds waitUntil)
cirospaciari Jul 24, 2026
65ecb96
inspector: breakpoint replies in original coordinates; drop stale pre…
cirospaciari Jul 25, 2026
0cca2f5
cli: parse --inspect-port
cirospaciari Jul 25, 2026
0153d33
inspector: only swallow a stale pre-parse breakpoint pause when it la…
cirospaciari Jul 25, 2026
7c41669
node inspect: strip Bun's inspector banner from probe stderr reports
cirospaciari Jul 25, 2026
f9bddd5
test: vendor 17 node inspector/debugger tests from Node v26.3.0
cirospaciari Jul 25, 2026
7aa5bb8
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 25, 2026
a88b213
Merge remote-tracking branch 'origin/claude/node-v26-combined-34719' …
cirospaciari Jul 25, 2026
c929be0
Merge remote-tracking branch 'origin/claude/inspector-cdp-on-cli' int…
robobun Aug 3, 2026
6aecc40
trim comments to <=3 lines, cite spec/node source
robobun Aug 3, 2026
3824042
Merge remote-tracking branch 'origin/claude/inspector-cdp-on-cli' int…
robobun Aug 3, 2026
aedc725
Merge remote-tracking branch 'origin/claude/inspector-cdp-on-cli' int…
robobun Aug 4, 2026
0498461
Merge remote-tracking branch 'origin/claude/inspector-cdp-on-cli' int…
robobun Aug 4, 2026
d3d881a
Merge remote-tracking branch 'origin/claude/inspector-cdp-on-cli' int…
robobun Aug 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions src/js/internal/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,15 @@ export default function (
return;
}

if (isNodeInspector) {
// inspector.open(): CDP connections, URL reported back, control callback for close/forward.
// https://github.com/nodejs/node/blob/main/lib/inspector.js
let debug: Debugger | undefined;
// Control channel from the inspected thread to a node:inspector-owned
// server: close() stops it, open() restarts it here, and an in-process
// Session forwards Debugger.* to the shared backend. `initial` may be nil.
function createNodeInspectorControl(initial: Debugger | undefined) {
let debug = initial;
let sessionBackend: Backend | undefined;
let sessionAdapter: any;
let sessionRefs = 0;
const control = (message: string) => {
function control(message: string) {
let parsed: any;
try {
parsed = JSON.parse(message);
Expand Down Expand Up @@ -246,8 +247,15 @@ export default function (
return;
}
}
};
}
return control;
}

if (isNodeInspector) {
// node:inspector's inspector.open(): serve CDP, report the URL back (for
// Node's "Debugger listening on ..." line), and hand back a control
// callback so the inspected thread can close the server / forward commands.
let debug: Debugger | undefined;
try {
debug = new Debugger(
executionContextId,
Expand All @@ -264,11 +272,15 @@ export default function (
// Register the control callback even though the server failed to start
// (e.g. the port is in use), so a later inspector.open() can retry with
// an "open" control message on this already-running debugger thread.
reportNodeInspectorServerStarted("", control, nodeInspectorListenErrorDetail(error));
reportNodeInspectorServerStarted(
"",
createNodeInspectorControl(undefined),
nodeInspectorListenErrorDetail(error),
);
return;
}

reportNodeInspectorServerStarted(debug.url!.href, control, undefined);
reportNodeInspectorServerStarted(debug.url!.href, createNodeInspectorControl(debug), undefined);
return;
}

Expand All @@ -289,8 +301,11 @@ export default function (
exit("Failed to start inspector:\n", error);
}

// If the user types --inspect, we print the URL to the console.
// If the user is using an editor extension, don't print anything.
const { cdpUrl } = debug;

// Print the URL for --inspect (not for editor extensions), *before*
// reportNodeInspectorServerStarted releases the inspected thread: Node's
// banner precedes script output and stderr-scraping tools rely on that order.
if (!isAutomatic) {
const debugUrl = debug.url;
if (debugUrl) {
Expand Down Expand Up @@ -319,6 +334,13 @@ export default function (
}
}

// Report --inspect's CDP endpoint so node:inspector's url()/open()/close()
// behave as Node does for a CLI-started inspector; this also releases the
// inspected thread, which blocks on the report.
if (enableNodeCDP && cdpUrl) {
reportNodeInspectorServerStarted(cdpUrl, createNodeInspectorControl(debug), undefined);
}

const notifyUrl = process.env["BUN_INSPECT_NOTIFY"] || "";
if (notifyUrl) {
// Only send this once.
Expand Down
Loading
Loading