import type { RuntimeVFS } from '../vfs.ts'; import type { QuickJSAsyncContext } from 'quickjs-emscripten'; export declare const MIRAGE_FS_BOOTSTRAP = "\nstd.open = (path, mode) => {\n const fd = __mirage_open(String(path), String(mode === undefined ? 'r' : mode));\n if (fd === -2) throw new TypeError('invalid file mode');\n if (fd < 0) return null;\n return {\n readAsString: (max) => __mirage_read(fd, max === undefined ? -1 : (max | 0)),\n read: () => __mirage_read(fd, -1),\n getline: () => __mirage_getline(fd),\n puts: (s) => { __mirage_write(fd, String(s)); },\n write: (s) => { __mirage_write(fd, String(s)); return String(s).length; },\n seek: (offset, whence) => { __mirage_seek(fd, offset | 0, whence === undefined ? 0 : (whence | 0)); return 0; },\n tell: () => __mirage_tell(fd),\n eof: () => __mirage_eof(fd),\n flush: () => {},\n close: () => { __mirage_close(fd); return 0; },\n };\n};\nglobalThis.os = globalThis.os || {};\nos.readdir = (path) => __mirage_readdir(String(path));\nos.stat = (path) => __mirage_stat(String(path));\nos.remove = (path) => __mirage_remove(String(path));\nos.mkdir = (path) => __mirage_mkdir(String(path));\nos.rename = (a, b) => __mirage_rename(String(a), String(b));\nos.utimes = (path, atime, mtime) => __mirage_utimes(String(path), atime, mtime);\nos.S_IFMT = 61440;\nos.S_IFDIR = 16384;\nos.S_IFCHR = 8192;\nos.S_IFREG = 32768;\nos.S_IFLNK = 40960;\n"; /** * Install the `std.open`/`os.readdir` host functions on an asyncified * quickjs context, backed by the runtime vfs. A null vfs (no * workspace mounts wired) still installs the surface, but every open * and readdir fails cleanly — `std.open` returns null and `os.readdir` * reports ENOENT — so guest code sees an empty filesystem rather than a * missing global. * * @param ctx - the asyncified quickjs context * @param vfs - the runtime's mount vocabulary, or null when no mounts are wired */ export declare function installMirageFs(ctx: QuickJSAsyncContext, vfs: RuntimeVFS | null): void; //# sourceMappingURL=vfs.d.ts.map