Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add debugger info endpoint (/json) for external tool discovery... #13219

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

june07
Copy link

@june07 june07 commented Aug 10, 2024

including browser DevTools similar to Node.js

What does this PR do?

Fixes this issue #9609 by adding a /json endpoint which lists the debugger metadata similar to Node.js

image

This is useful to allow Bun to be debugged with browser DevTools (i.e. Chrome, Edge, etc) in addition to the Bun web debugger.

…ry including browser DevTools similar to Node.js
@Jarred-Sumner
Copy link
Collaborator

Thank you for this

We tried doing this early on, but unfortunately the V8 inspector protocol and the WebKit debugger protocol has diverged quite a bit and much of the debugger when used this way doesn't work. It needs a bunch of code to translate between the two protocols.

@june07
Copy link
Author

june07 commented Aug 10, 2024

Ah! My fault I guess for not digging deep enough... I didn't know that. Thanks for the fast reply! And best of luck with the project moving forward. Cheers!

@june07 june07 closed this Aug 10, 2024
@june07
Copy link
Author

june07 commented Aug 10, 2024

After reflecting on this, I realize I may have closed the discussion prematurely. The JSON endpoint would still be valuable for tools like NiM and potentially others that don’t have direct access to the execution context (e.g., Bun’s CLI entry-point for parsing data).

Currently, NiM supports Deno and Node.js, and adding Bun to this list would be beneficial since all these runtimes are based on the V8 engine. Given that Bun’s debugging isn’t integrated into the browser like Node.js with Chrome DevTools, Bun developers could greatly benefit from NiM’s features for debug session management and more.

Here’s a demonstration of debugging across all three runtimes, including NiM auto-connecting to the Bun debug process:

v8Trifecta

I’ve updated this commit to set the devtoolsFrontendUrl to Bun’s WebKit URL and removed the Chrome DevTools entries.

I’d love to get your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants