bare-inspector
Reference for bare-inspector: V8 inspector support for Bare—drive the inspector protocol from a session and capture heap snapshots.
bare-inspector exposes the V8 inspector protocol to Bare programs: open a Session, send protocol commands, receive notifications, and capture heap snapshots. It's the in-process counterpart to the bare --inspect flag, and what pear-inspect exposes remotely over Hyperswarm. It's a native addon and requires Bare >=1.25.0 <1.29.0.
npm i bare-inspectorUsage
const { Session } = require('bare-inspector')
const session = new Session()
session.connect()
const { result } = await session.post('Runtime.evaluate', { expression: '1 + 2' })
console.log(result)API
Session
const session = new Session()
Create an inspector session.
session.connect() · session.post(method[, params]) · session.destroy()
Connect, send an inspector-protocol command (returns its result), and tear down.
session.on('<inspector-protocol-method>', message) · session.on('inspectorNotification', message)
Subscribe to a specific protocol notification, or all of them.
HeapSnapshot
const snapshot = new HeapSnapshot(session)
Capture a heap snapshot; iterate it for chunks with for await (const chunk of snapshot).
Related modules
Builds on bare-events, bare-http1, bare-stream, bare-url, and bare-ws.
See also
bareCLI—the--inspectflag.bare-console—everyday logging and timing.- Bare modules—the full
bare-*catalog.