Skip to content

API reference / @jsprismarine/prismarine / scripting/ScriptDebugger

scripting/ScriptDebugger ​

Classes ​

Interfaces ​

DebuggableScripts ​

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:52

The scripts a debugger attaches to.

Methods ​

plugins() ​

plugins(): readonly DebuggerPlugin[]

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:54

The packs the extension may pick, as the protocol event lists them.

Returns ​

readonly DebuggerPlugin[]

target() ​

target(moduleUuid): ScriptDebugTargetPack | undefined

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:56

The pack whose script module has moduleUuid, while it runs.

Parameters ​
moduleUuid ​

string

Returns ​

ScriptDebugTargetPack | undefined


ScriptDebugTargetPack ​

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:45

A pack the extension can debug: where its scripts run, and its files.

Properties ​

context ​

readonly context: number

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:47

engine ​

readonly engine: ScriptEngine

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:46

pack ​

readonly pack: ScriptPack

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:48


ScriptDebuggerHost ​

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:32

The script host modules the debugger runs, which the caller imports.

Properties ​

DebuggerThread ​

readonly DebuggerThread: typeof DebuggerThread

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:35

DEFAULT_DEBUGGER_PORT ​

readonly DEFAULT_DEBUGGER_PORT: number

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:39

The port the extension and BDS use when none is given.

LogLevel ​

readonly LogLevel: object

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:37

LogLevel of the extension's protocol.

error ​

readonly error: number

log ​

readonly log: number

warn ​

readonly warn: number

PortDebuggerChannel ​

readonly PortDebuggerChannel: typeof PortDebuggerChannel

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:34

readPackFile ​

readonly readPackFile: (pack, path) => string | undefined

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:41

Reads a file of a pack, by its path relative to the pack; undefined outside it or when missing.

Parameters ​
pack ​

ScriptPack

path ​

string

Returns ​

string | undefined

ScriptDebugSession ​

readonly ScriptDebugSession: typeof ScriptDebugSession

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:33


ScriptDebuggerOptions ​

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:60

What the debugger needs from the server.

Properties ​

host ​

readonly host: ScriptDebuggerHost

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:63

log ​

readonly log: ScriptLog

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:65

The server's log, which gets BDS's lines.

replay ​

readonly replay: boolean

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:67

Whether the server replays a recorded session, when the debugger never opens a socket.

runCommand? ​

readonly optional runCommand?: (command, dimension) => void

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:72

Runs a command the extension's command box sent, in a dimension the extension names, such as overworld. It runs between ticks, never inside a script.

Parameters ​
command ​

string

dimension ​

string

Returns ​

void

scripts ​

readonly scripts: DebuggableScripts

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:62

settings ​

readonly settings: ScriptDebuggerConfig

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:61

sleep? ​

readonly optional sleep?: (seconds) => Promise<void>

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:77

Resolves after seconds, for auto-attach's timeout and its retries. It waits on the wall clock only at startup, before the first tick, where nothing simulated reads it.

Parameters ​
seconds ​

number

Returns ​

Promise<void>

Type Aliases ​

ScriptDebuggerReply ​

ScriptDebuggerReply = { message: string; ok: boolean; } | undefined

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:81

What a /script debugger command prints: feedback, an error, or nothing, as on BDS.

Variables ​

DEFAULT_CONNECT_HOST ​

const DEFAULT_CONNECT_HOST: "localhost" = 'localhost'

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:106

The host /script debugger connect reaches when it names none.


ScriptDebuggerMessages ​

const ScriptDebuggerMessages: object

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:84

The lines BDS prints for the debugger, from the pinned server's binary and its en_US.lang.

Type Declaration ​

attached ​

readonly attached: (address, port) => string

Parameters ​
address ​

string

port ​

number

Returns ​

string

autoAttachBadAddress ​

readonly autoAttachBadAddress: "Debugger auto-attach failed, outbound address or port is not valid." = 'Debugger auto-attach failed, outbound address or port is not valid.'

autoAttachInboundDisabled ​

readonly autoAttachInboundDisabled: "Debugger auto-attach failed, inbound connections are disabled." = 'Debugger auto-attach failed, inbound connections are disabled.'

autoAttachNoConnection ​

readonly autoAttachNoConnection: "Debugger auto-attach did not connect." = 'Debugger auto-attach did not connect.'

autoAttachOutboundDisabled ​

readonly autoAttachOutboundDisabled: "Debugger auto-attach failed, outbound connections are disabled." = 'Debugger auto-attach failed, outbound connections are disabled.'

autoAttachStillListening ​

readonly autoAttachStillListening: "Debugger auto-attach did not connect, but is still listening." = 'Debugger auto-attach did not connect, but is still listening.'

autoAttachWaiting ​

readonly autoAttachWaiting: (seconds) => string

Parameters ​
seconds ​

number

Returns ​

string

closed ​

readonly closed: "Debugger closed" = 'Debugger closed'

connected ​

readonly connected: (host, port) => string

Parameters ​
host ​

string

port ​

number

Returns ​

string

connectionClosed ​

readonly connectionClosed: "Debugger connection closed." = 'Debugger connection closed.'

failed ​

readonly failed: "Failed to start debugger" = 'Failed to start debugger'

inboundDisabled ​

readonly inboundDisabled: "Inbound connections are disabled" = 'Inbound connections are disabled'

invalidConnectAddress ​

readonly invalidConnectAddress: "Invalid script debugger connect address, format must be host:port with port in the range [ 1, 65535 ]" = 'Invalid script debugger connect address, format must be host:port with port in the range [ 1, 65535 ]'

invalidPort ​

readonly invalidPort: (port, fallback) => string

Parameters ​
port ​

number

fallback ​

number

Returns ​

string

listening ​

readonly listening: (port) => string

Parameters ​
port ​

number

Returns ​

string

outboundDisabled ​

readonly outboundDisabled: "Outbound connections are disabled" = 'Outbound connections are disabled'

Functions ​

parseConnectAddress() ​

parseConnectAddress(address): { host: string; port: number; } | undefined

Defined in: packages/prismarine/src/scripting/ScriptDebugger.ts:121

Reads script-debugger-auto-attach-connect-address, host:port.

Parameters ​

address ​

string

Returns ​

{ host: string; port: number; } | undefined

The host and port, or undefined when the text is not that form or the port is out of range.