aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/inspector.exports.js
blob: eccb39c10253a9568d222d518f371ccf8d84967f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// This is a stub! None of this is actually implemented yet.

function hideFromStack(fns) {
  for (const fn of fns) {
    Object.defineProperty(fn, "name", {
      value: "::bunternal::",
    });
  }
}

class TODO extends Error {
  constructor(messageName) {
    const message = messageName
      ? `node:inspector ${messageName} is not implemented yet in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/2445`
      : `node:inspector is not implemented yet in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/2445`;
    super(message);
    this.name = "TODO";
  }
}

function notimpl(message) {
  throw new TODO(message);
}

const { EventEmitter } = import.meta.require("node:events");

function open() {
  notimpl("open");
}

function close() {
  notimpl("close");
}

function url() {
  notimpl("url");
}

function waitForDebugger() {
  notimpl("waitForDebugger");
}

class Session extends EventEmitter {
  constructor() {
    super();
    notimpl("Session");
  }
}

const console = {
  ...globalThis.console,
  context: {
    console: globalThis.console,
  },
};

var defaultObject = {
  console,
  open,
  close,
  url,
  waitForDebugger,
  Session,
  [Symbol.for("CommonJS")]: 0,
};

export { console, open, close, url, waitForDebugger, Session, defaultObject as default };
hideFromStack([notimpl, TODO.prototype.constructor, open, close, url, waitForDebugger, Session.prototype.constructor]);