webcontainer-sandbox-react
Version:
A React component library for WebContainer-based code sandboxes
21 lines (20 loc) • 875 B
TypeScript
import { WebContainerProcess } from '@webcontainer/api';
import { default as ProcessOutput } from '../core/ProcessOutput';
import { SessionError } from '../components/SessionProvider';
interface SessionContextType {
loading: boolean;
loadingContent: string;
startProcess: WebContainerProcess | null;
writer: WritableStreamDefaultWriter | null;
output: ReadableStream | null;
processOutput: ProcessOutput | null;
sessionErrors: SessionError[];
clearErrors: (() => void) | null;
onError?: (error: SessionError) => void;
files: Record<string, string>;
setFile: ((fileName: string, content: string) => Promise<void>) | null;
spawn: ((command: string) => Promise<void>) | null;
}
export declare const SessionContext: import('react').Context<SessionContextType>;
export declare const useSession: () => SessionContextType;
export {};