Add missing FS methods needed by isomorphic-git

This commit is contained in:
Alex Gleason committed 2025-07-20 17:03:48 -05:00
1 parent 0b0696e624
commit 0fbd5f0b84
4 files changed
+26 -4

No files matched your search

+12 -2
View File
@@ -77,9 +77,9 @@ class WebContainerFSAdapter implements JSRuntimeFS {
async readdir(path: string, options?: { withFileTypes?: boolean }): Promise<string[] | DirectoryEntry[]>;
async readdir(path: string, options?: { withFileTypes?: boolean }): Promise<string[] | DirectoryEntry[]> {
if (options?.withFileTypes) {
return this.webcontainer.fs.readdir(path, { withFileTypes: true }) as Promise<DirectoryEntry[]>;
return this.webcontainer.fs.readdir(path, { withFileTypes: true });
} else {
return this.webcontainer.fs.readdir(path) as Promise<string[]>;
return this.webcontainer.fs.readdir(path);
}
}
@@ -156,4 +156,14 @@ class WebContainerFSAdapter implements JSRuntimeFS {
// Note: We can't delete the old file since WebContainer doesn't expose unlink
console.warn('WebContainer rename: copied file but could not delete original');
}
async readlink(_path: string): Promise<string> {
// WebContainer doesn't support symlinks, so we'll throw an error
throw new Error('readlink operation not supported in WebContainer');
}
async symlink(_target: string, _path: string): Promise<void> {
// WebContainer doesn't support symlinks, so we'll throw an error
throw new Error('symlink operation not supported in WebContainer');
}
}