///
import { EventEmitter } from 'events';
import { IFs } from 'memfs';
import { WASI, WASIConfig } from '@wasmer/wasi/lib';
import { WasmFs } from '@wasmer/wasmfs/lib';
import { SimplexStream } from './streams';
import { Tty } from './bits/tty';
import { Proc, ProcOptions } from './bits/proc';
import { SharedVolume } from './services/shared-fs';
declare class ExecCore extends EventEmitter {
opts: ExecCoreOptions;
stdin: SimplexStream;
wasmFs: WasmFs;
env: Environ;
argv: string[];
wasi: WASI;
wasm: WebAssembly.WebAssemblyInstantiatedSource;
stdioFds: any[];
tty: Tty;
proc: Proc;
exited: boolean;
cached: Map>;
debug: (...args: any) => void;
trace: {
user: (ui8a: Uint8Array) => void;
syscalls: (...args: any) => void;
};
constructor(opts?: ExecCoreOptions);
initTraces(): void;
init(): void;
configure(opts: ExecCoreOptions): void;
reset(): void;
start(wasmUri: string, argv?: string[], env?: {}): Promise;
get fs(): IFs;
fetch(uri: string): Promise;
fetchCompile(uri: string): Promise;
/**
* @todo warn about unresolved symbols such as `__SIG_IGN` that stem
* from not linking some wasi-sdk emulation lib (`-lwasi-emulated-signal`).
*/
getImports(wamodule: WebAssembly.Module): {
wasik_ext: {};
env: {
__indirect_function_table: WebAssembly.Table;
debug: (message: string) => void;
};
};
/**
* Returns an object that can be shared with a parent thread
* (via e.g. `Worker.postMessage`) to communicate with this core.
*/
share(): any;
emitWrite(fd: number, buffer: Buffer | Uint8Array): number;
/**
* Initial environment variables
*/
initialEnv(): Environ;
defaultEnv(): {
PATH: string;
PWD: string;
};
extraWASIConfig(): WASIConfig;
registerStdio(): void;
mountFs(volume: SharedVolume): void;
/**
* Bootstrapping filesystem contents
*/
populateRootFs(): void;
_debugPrint(): {
(...data: any[]): void;
(message?: any, ...optionalParams: any[]): void;
};
_tracePrint(): (ui8a: Uint8Array) => void;
_tracePrintAny(): (...args: any) => void;
}
declare type ExecCoreOptions = {
stdin?: boolean;
tty?: boolean | number | [number];
proc?: ProcOptions;
env?: Environ;
cacheBins?: boolean;
debug?: boolean;
trace?: {
syscalls?: boolean;
};
};
declare type Environ = {
[k: string]: string;
};
/**
* `@wasmer/wasi` exports this class as ES5 :/
* This kills instanceof. So redefining it here. -_-
*/
export declare class WASIExitError {
code: number | null;
constructor(code: number | null);
}
export { ExecCore, Environ, ExecCoreOptions };