JSRuntime: remove WebContainer type dependency

This commit is contained in:
Alex Gleason committed 2025-07-20 17:57:07 -05:00
1 parent a7d44e7ec5
commit 68d852b5b8
2 files changed
+43 -22

No files matched your search

+40 -19
View File
@@ -1,12 +1,20 @@
import type { WebContainerProcess } from '@webcontainer/api';
/**
* Directory entry with file type information
* JavaScript runtime interface for executing code and managing files
*/
export interface DirectoryEntry {
name: string;
isDirectory(): boolean;
isFile(): boolean;
export interface JSRuntime {
/**
* Filesystem access
*/
fs(): Promise<JSRuntimeFS>;
/**
* Spawn a process in the runtime environment
* @param command Command to execute
* @param args Command arguments
* @param options Spawn options
* @returns Process handle
*/
spawn(command: string, args?: string[], options?: Record<string, unknown>): Promise<JSRuntimeChildProcess>;
}
/**
@@ -50,20 +58,33 @@ export interface JSRuntimeFS {
}
/**
* JavaScript runtime interface for executing code and managing files
* Directory entry with file type information
*/
export interface JSRuntime {
/**
* Filesystem access
*/
fs(): Promise<JSRuntimeFS>;
export interface DirectoryEntry {
name: string;
isDirectory(): boolean;
isFile(): boolean;
}
/**
* Unified child process interface
*/
export interface JSRuntimeChildProcess {
/**
* Spawn a process in the runtime environment
* @param command Command to execute
* @param args Command arguments
* @param options Spawn options
* @returns Process handle
* A promise for the exit code of the process.
*/
spawn(command: string, args?: string[], options?: Record<string, unknown>): Promise<WebContainerProcess>;
exit: Promise<number>;
/**
* An input stream for the attached pseudoterminal device.
*/
input: WritableStream<string>;
/**
* A stream that receives all terminal output, including the stdout and stderr emitted by the spawned process
* _and_ its descendants.
*/
output: ReadableStream<string>;
/**
* Kills the process.
*/
kill(): void;
}