/// export { traceImportsToConsole } from './helpers'; import { _FS } from './memfs'; export declare type Environment = { [key: string]: string; }; /** * ProcessExit is thrown when `proc_exit` is called * @public */ export declare class ProcessExit extends Error { /** * The exit code passed to `proc_exit` */ code: number; constructor(code: number); } /** * Options to configure the {@link WASI} interface * * @public */ export interface WASIOptions { /** * Command-line arguments * * @defaultValue `[]` * */ args?: string[]; /** * Environment variables * * @defaultValue `{}` * */ env?: Environment; /** * By default WASI applications that call `proc_exit` will throw a {@link ProcessExit} exception, setting this option to true will cause {@link WASI.start} to return the the exit code instead. * * @defaultValue `false` * */ returnOnExit?: boolean; /** * A list of directories that will be accessible in the WebAssembly application's sandbox. * * @defaultValue `[]` * */ preopens?: string[]; /** * Input stream that the application will be able to read from via stdin */ stdin?: ReadableStream; /** * Output stream that the application will be able to write to via stdin */ stdout?: WritableStream; /** * Output stream that the application will be able to write to via stderr */ stderr?: WritableStream; /** * Enable async IO for stdio streams, requires the application is built with {@link asyncify|https://web.dev/asyncify/} * * @experimental * @defaultValue `false` * */ streamStdio?: boolean; /** * Initial filesystem contents, currently used for testing with * existing WASI test suites * @internal * */ fs?: _FS; } /** * @public */ export declare class WASI { #private; constructor(options?: WASIOptions); /** * See {@link https://nodejs.org/api/wasi.html} * * @throws {@link ProcessExit} * * This exception is thrown if {@link WASIOptions.returnOnExit} is set to `false` * and `proc_exit` is called * */ start(instance: WebAssembly.Instance): Promise; get wasiImport(): Record; } export type { _FS };