/** * Node.js adapter package for bijou. * * Re-exports the individual port adapters ({@link nodeRuntime}, * {@link nodeIO}, {@link chalkStyle}) and provides convenience * functions for constructing a fully-wired {@link BijouContext} * bound to the current Node.js process. * * @packageDocumentation */ import type { BijouContext } from '@flyingrobots/bijou'; import { type App, type RunOptions } from '@flyingrobots/bijou-tui'; import type { CreateNodeContextOptions, InitDefaultContextOptions } from './options.js'; /** Re-export the Node.js {@link RuntimePort} factory. */ export { nodeRuntime, detectRefreshRate } from './runtime.js'; /** Re-export the Node.js {@link IOPort} factory. */ export { nodeIO, scopedNodeIO, ScopedNodeIOError, type ScopedNodeIO, type ScopedNodeIOOptions, type NodeIOOptions, type NodeWriteStream, } from './io.js'; /** Re-export the Chalk-based {@link StylePort} factory and its options type. */ export { chalkStyle, type ChalkStyleOptions } from './style.js'; export type { CreateNodeContextOptions, InitDefaultContextOptions, NodeThemeEntry, NodeThemeMode, NodeThemeOptions, } from './options.js'; /** Re-export Worker utilities for multi-threaded applications. */ export { isBijouWorker, runInWorker, sendToMain, startWorkerApp, type RunWorkerOptions } from './worker/worker.js'; export { recordDemoGif, rasterizeSurface, writeSurfaceGif, type NativeDemoSpec, type RecorderResult, type SurfaceGifOptions, } from './recorder.js'; /** Structured bootstrap failure for Node host initialization. */ export declare class BijouBootstrapError extends Error { /** Human-readable reason for the failure. */ readonly reason: string; /** Practical hint to recover from the failure. */ readonly hint: string; /** Original error that triggered this bootstrap error, when available. */ cause?: unknown; /** * @param reason - Root cause summary. * @param hint - Suggested recovery path. * @param cause - Optional originating error. */ constructor(reason: string, hint: string, cause?: unknown); } /** Options for {@link startApp}. */ export type StartAppOptions = RunOptions & CreateNodeContextOptions; /** Test-only helper that restores the Node ambient-context initializer after resets. */ export declare function _registerDefaultContextInitializerForTesting(): void; /** * Create a {@link BijouContext} wired to Node.js adapters. * * Assembles {@link nodeRuntime}, {@link nodeIO}, and {@link chalkStyle} * into a single context via `createBijou`. Automatically respects the * `NO_COLOR` environment variable by passing it through to the style * adapter. * * @returns A fresh {@link BijouContext} backed by the current Node.js process. */ export declare function createNodeContext(options?: CreateNodeContextOptions): BijouContext; /** * Reset the initialization guard. * * **Test-only** -- allows test suites to re-trigger * {@link initDefaultContext}'s first-call behavior. */ export declare function _resetInitializedForTesting(): void; /** * Initialize and register the global default {@link BijouContext}. * * On the first call, creates a Node.js context via {@link createNodeContext} * and registers it with `setDefaultContext` for ambient `ctx` use. * * Subsequent calls return a fresh (unregistered) context without * overwriting the global default. * * @returns The {@link BijouContext} created during initialization, or a * fresh context on subsequent calls. */ export declare function initDefaultContext(options?: InitDefaultContextOptions): BijouContext; /** * Start a Bijou TUI app on the current Node.js host. * * This is the first-app convenience path for Node hosts. When no context is * provided, it initializes and registers the default Node context so apps that * rely on ambient `ctx` resolution still behave correctly. Callers that need * explicit ownership can pass `options.ctx` directly. Self-running framed apps * are delegated to their hosted runner instead of being forced through raw * `run(app, ...)`. * * @param app - The TEA application to run. * @param options - Runtime options forwarded to {@link run}. */ export declare function startApp(app: App, options?: StartAppOptions): Promise; //# sourceMappingURL=index.d.ts.map