globals.d.ts
1 /** 2 * Global declarations for build-time constants and runtime checks. 3 */ 4 5 /** 6 * MACRO — Bun bundler build-time constants. 7 * In external builds, these are replaced with static values. 8 */ 9 declare const MACRO: { 10 VERSION: string; 11 PACKAGE_URL: string; 12 NATIVE_PACKAGE_URL: string; 13 FEEDBACK_CHANNEL: string; 14 [key: string]: any; 15 }; 16 17 /** 18 * Bun — global Bun runtime object. 19 * Only accessed via `typeof Bun !== 'undefined'` runtime checks. 20 */ 21 declare const Bun: { 22 which(name: string): string | null; 23 YAML: { 24 parse(input: string): any; 25 }; 26 env: Record<string, string | undefined>; 27 version: string; 28 serve(options: any): any; 29 write(dest: any, data: any): Promise<number>; 30 file(path: string): any; 31 sleep(ms: number): Promise<void>; 32 spawn(cmd: string[], options?: any): any; 33 [key: string]: any; 34 }; 35 36 /** 37 * ErrnoException — Node.js error with errno fields. 38 */ 39 interface ErrnoException extends Error { 40 errno?: number; 41 code?: string; 42 path?: string; 43 syscall?: string; 44 }