mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Runtime.fs() must return a promise
This commit is contained in:
4 files changed
+7
-11
No files matched your search
@@ -7,16 +7,13 @@ import type { JSRuntime, JSRuntimeFS, DirectoryEntry } from './JSRuntime';
|
||||
export class WebContainerAdapter implements JSRuntime {
|
||||
private webcontainer: WebContainer | null = null;
|
||||
private bootPromise: Promise<WebContainer> | null = null;
|
||||
private _fs: JSRuntimeFS | null = null;
|
||||
|
||||
/**
|
||||
* Get the filesystem interface
|
||||
*/
|
||||
get fs(): JSRuntimeFS {
|
||||
if (!this._fs) {
|
||||
throw new Error('WebContainer not initialized. Call spawn() first to initialize.');
|
||||
}
|
||||
return this._fs;
|
||||
async fs(): Promise<JSRuntimeFS> {
|
||||
const webcontainer = await this.ensureBooted();
|
||||
return new WebContainerFSAdapter(webcontainer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +29,6 @@ export class WebContainerAdapter implements JSRuntime {
|
||||
}
|
||||
|
||||
this.webcontainer = await this.bootPromise;
|
||||
this._fs = new WebContainerFSAdapter(this.webcontainer);
|
||||
return this.webcontainer;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user