oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.67k stars 2.62k forks source link

support `node:inspector` #2445

Open ivawzh opened 1 year ago

ivawzh commented 1 year ago

What is the problem this feature would solve?

Due to lacking support of node:inspector, our bun projects cannot support typedoc. This is very troubling as we own a significant amount of repos and rely on typedoc to generate all-in-one documentation.

What is the feature you are proposing to solve the problem?

Support inspector or having alternative way to walk around.

What alternatives have you considered?

No response

Electroid commented 1 year ago

We do plan on having a better debugging experience, which might include node:inspector. However, for typedoc, it looks like it's just doing a simple see if it's in debug mode.

import { url } from "inspector";
// ...
const isDebugging = () => !!url();

Code

In the interim, we should consider adding a no-op polyfill. cc @Jarred-Sumner

klippx commented 9 months ago

@Electroid I want to flag another possible use case for something similar to node:inspector. As discussed in this thread we are interested in exposing the length of the runtime micro task queue as a metric for our app.

As an orthogonal task to this we are also looking into Bun.

So... Marrying the two concepts here: Is there a way to do what we want in Bun today? Perhaps via some 'bun:inspector' API, or via JavaScriptCore directly perhaps?

mProjectsCode commented 9 months ago

Is it possible to write a polyfill for it so that i can use typedoc with bun or is this something that needs to be fixed on buns side?

klippx commented 9 months ago

In our case we have decided against this feature as it was a significant cost to scan the JS heap looking for promises. It was so slow there is no way we can afford to run it in prod.

Now, if there was a simple atomic counter counting the promises in the micro task queue that would be much more efficient. IDK how feasible that would be.

BeatsuDev commented 8 months ago

This error comes up when trying to run vite --profile too.

Robbson commented 7 months ago

I also get this error when trying to compile my docs via Typedoc.

NoNameLmao commented 4 months ago

+1, same with @pm2/io

pragmatta commented 4 months ago

Also hit this trying to use typedoc.

yus-ham commented 3 months ago

From pm2 log-rotate

NotImplementedError: node:inspector Session is not yet implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/2445
 code: "ERR_NOT_IMPLEMENTED"

      at new NotImplementedError (internal:shared:19:27)
      at internal:shared:2:69
      at new Session (node:inspector:13:27)
      at init (/home/portal/.bun/install/global/node_modules/@pm2/io/build/main/services/inspector.js:13:24)
      at init (/home/portal/.bun/install/global/node_modules/@pm2/io/build/main/pmx.js:77:13)
      at /home/portal/.bun/install/global/node_modules/@pm2/io/build/main/index.js:5:45
      at injectModules (/home/portal/.bun/install/global/node_modules/pm2/lib/ProcessUtils.js:6:13)
      at /home/portal/.bun/install/global/node_modules/pm2/lib/ProcessContainerFork.js:9:1

Bun v1.1.7-canary.1+bbb906c66 (Linux x64 baseline)
0pilatos0 commented 1 month ago

also running into this issue with vitest ui mode


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯NotImplementedError: node:inspector is not yet implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/2445
 ❯ new ::bunternal:: internal:shared:19:14
 ❯ ::bunternal:: internal:shared:2:35
 ❯ new ::bunternal:: node:inspector:13:14
 ❯ module code node_modules/@vitest/coverage-v8/dist/index.js:4:17

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯Serialized Error: { code: 'ERR_NOT_IMPLEMENTED', originalLine: 19, originalColumn: 14, line: 19, column: 14, sourceURL: 'internal:shared' }