feat(filetree): add filesystem watch support to WebContainer environment and auto-refresh file tree; improve icon handling and context menu behavior

This commit is contained in:
2025-12-31 08:53:01 +00:00
parent 9e229543eb
commit e193e28fe9
7 changed files with 345 additions and 27 deletions

View File

@@ -7,6 +7,14 @@ export interface IFileEntry {
path: string;
}
/**
* Handle to a file system watcher
*/
export interface IFileWatcher {
/** Stop watching for changes */
stop(): void;
}
/**
* Handle to a spawned process with I/O streams
*/
@@ -68,6 +76,19 @@ export interface IExecutionEnvironment {
*/
exists(path: string): Promise<boolean>;
/**
* Watch a file or directory for changes
* @param path - Absolute path to watch
* @param callback - Called when changes occur
* @param options - Optional: { recursive: true } to watch subdirectories
* @returns Watcher handle with stop() method
*/
watch(
path: string,
callback: (event: 'rename' | 'change', filename: string | null) => void,
options?: { recursive?: boolean }
): IFileWatcher;
// ============ Process Execution ============
/**