/** * The main entrypoint when using Bun as the runtime */ import { IRuntime, RunTimeType } from '../common/runtime.ts'; import { process } from '../common/runtime/node.ts'; import TerminalIO from '../common/runtime/terminal_io.ts'; import FileIO from '../common/runtime/file_io.ts'; /** * The Bun Runtime implementation */ const BunRuntime: IRuntime = { name: RunTimeType.Bun, file: FileIO, term: TerminalIO, onEvent: (eventName: string, handler) => process.on(eventName, handler), onExit: (cb: () => void): void => { process.on('beforeExit', cb); process.on('exit', cb); process.on('SIGINT', cb); }, exit: (code?: number) => process.exit(code), }; export default BunRuntime;