mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
* Improve support for \`debug-adapter-protocol\` * More improvements, fix formatting in debug console * Fix attaching * Prepare for source maps * Start of source map support, breakpoints work * Source map support * add some package.jsons * wip * Update package.json * More fixes * Make source maps safer if exception occurs * Check bun version if it fails * Fix console.log formatting * Fix source maps partly * More source map fixes * Prepare for extension * watch mode with dap * Improve preview code * Prepare for extension 2 --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import type { JSC } from "..";
|
|
|
|
/**
|
|
* A client that can send and receive messages to/from a debugger.
|
|
*/
|
|
export abstract class Inspector {
|
|
constructor(listener?: InspectorListener);
|
|
/**
|
|
* Starts the inspector.
|
|
*/
|
|
start(...args: unknown[]): void;
|
|
/**
|
|
* Sends a request to the debugger.
|
|
*/
|
|
send<M extends keyof JSC.RequestMap & keyof JSC.ResponseMap>(
|
|
method: M,
|
|
params?: JSC.RequestMap[M],
|
|
): Promise<JSC.ResponseMap[M]>;
|
|
/**
|
|
* Accepts a message from the debugger.
|
|
* @param message the unparsed message from the debugger
|
|
*/
|
|
accept(message: string): void;
|
|
/**
|
|
* If the inspector is closed.
|
|
*/
|
|
get closed(): boolean;
|
|
/**
|
|
* Closes the inspector.
|
|
*/
|
|
close(...args: unknown[]): void;
|
|
}
|
|
|
|
export type InspectorListener = {
|
|
/**
|
|
* Defines a handler when a debugger event is received.
|
|
*/
|
|
[M in keyof JSC.EventMap]?: (event: JSC.EventMap[M]) => void;
|
|
} & {
|
|
/**
|
|
* Defines a handler when the debugger is connected or reconnected.
|
|
*/
|
|
["Inspector.connected"]?: () => void;
|
|
/**
|
|
* Defines a handler when the debugger is disconnected.
|
|
* @param error the error that caused the disconnect, if any
|
|
*/
|
|
["Inspector.disconnected"]?: (error?: Error) => void;
|
|
};
|