@ai-ecoverse/slicc-kernel 1.119.2 → 1.120.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -4
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +52 -12
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +72 -36
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +52 -12
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +69 -33
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/opfs.d.ts +6 -0
- package/dist/types/fs/ranged.d.ts +1 -0
- package/dist/types/fs/types.d.ts +5 -0
- package/dist/types/kernel/fd-table.d.ts +1 -0
- package/dist/types/kernel/host-ops.d.ts +1 -0
- package/dist/types/kernel/lock-service.d.ts +8 -1
- package/dist/types/kernel/process.d.ts +1 -0
- package/dist/types/kernel/vfs-file.d.ts +1 -0
- package/dist/types/launcher.d.ts +1 -0
- package/dist/types/process/wasi/slicc-lock.d.ts +3 -2
- package/dist/types/process/wasi/wasi-fds.d.ts +1 -0
- package/dist/types/process/wasi/wasi-files.d.ts +1 -0
- package/dist/types/process/wasi/wasi-host.d.ts +1 -0
- package/package.json +1 -1
package/dist/meta.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/fs/path-map.ts", "../src/fs/meta.ts", "../src/fs/types.ts", "../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["function parentOf(path: string): string | undefined {\n if (path === '/' || path === '') return undefined;\n const at = path.lastIndexOf('/');\n return at <= 0 ? '/' : path.slice(0, at);\n}\n\nexport class PathMap<V> {\n private readonly values = new Map<string, V>();\n private readonly children = new Map<string, Set<string>>();\n\n get size(): number {\n return this.values.size;\n }\n\n has(path: string): boolean {\n return this.values.has(path);\n }\n\n get(path: string): V | undefined {\n return this.values.get(path);\n }\n\n keys(): IterableIterator<string> {\n return this.values.keys();\n }\n\n set(path: string, value: V): this {\n if (!this.values.has(path)) this.link(path);\n this.values.set(path, value);\n return this;\n }\n\n delete(path: string): boolean {\n if (!this.values.delete(path)) return false;\n this.prune(path);\n return true;\n }\n\n subtree(root: string): string[] {\n const out: string[] = [];\n const stack = [root];\n for (let path = stack.pop(); path !== undefined; path = stack.pop()) {\n if (this.values.has(path)) out.push(path);\n const below = this.children.get(path);\n if (below) for (const child of below) stack.push(child);\n }\n return out;\n }\n\n entries(): IterableIterator<[string, V]> {\n return this.values.entries();\n }\n\n deleteTree(root: string): void {\n const stack = [root];\n for (let path = stack.pop(); path !== undefined; path = stack.pop()) {\n this.values.delete(path);\n const below = this.children.get(path);\n if (below) for (const child of below) stack.push(child);\n this.children.delete(path);\n }\n this.prune(root);\n }\n\n clear(): void {\n this.values.clear();\n this.children.clear();\n }\n\n private link(path: string): void {\n for (let child = path, parent = parentOf(path); parent !== undefined; ) {\n const set = this.children.get(parent);\n if (set?.has(child)) return;\n if (set) set.add(child);\n else this.children.set(parent, new Set([child]));\n child = parent;\n parent = parentOf(parent);\n }\n }\n\n private prune(path: string): void {\n for (let child = path, parent = parentOf(path); parent !== undefined; ) {\n if (this.values.has(child) || this.children.has(child)) return;\n const set = this.children.get(parent);\n set?.delete(child);\n if (set && set.size > 0) return;\n this.children.delete(parent);\n child = parent;\n parent = parentOf(parent);\n }\n }\n}\n", "import { PathMap } from './path-map.ts';\nexport interface MetaEntry {\n path: string;\n mode?: number;\n atimeMs?: number;\n mtimeMs?: number;\n mtimeFor?: number;\n timesAt?: number;\n timesBy?: string;\n ctimeMs?: number;\n ino?: number;\n link?: string;\n socket?: true;\n fifo?: true;\n dir?: string;\n uid?: number;\n gid?: number;\n heir?: [number, number];\n writes?: number;\n epoch?: number;\n}\n\nexport type MetaChange = (entry: MetaEntry | undefined) => MetaEntry | undefined;\n\nexport interface MetaUpdate {\n path: string;\n change: MetaChange;\n}\n\nexport interface MetaStore {\n get(paths: readonly string[]): Promise<Array<MetaEntry | undefined>>;\n fresh?(paths: readonly string[]): Promise<Array<MetaEntry | undefined>>;\n update(path: string, change: MetaChange): Promise<void>;\n updateMany?(changes: ReadonlyArray<MetaUpdate>): Promise<void>;\n move(from: string, to: string, root: (entry: MetaEntry | undefined) => MetaEntry): Promise<void>;\n remove(paths: readonly string[]): Promise<void>;\n links(dir: string): Promise<MetaEntry[]>;\n under(path: string): Promise<MetaEntry[]>;\n all(): Promise<MetaEntry[]>;\n absent?(path: string): boolean;\n removeFile?(path: string): Promise<void>;\n}\n\nexport const META_DB = 'slicc-kernel';\nexport const META_VERSION = 1;\nexport const META_STORE = 'entries';\n\nfunction parentOf(path: string): string {\n return path.slice(0, path.lastIndexOf('/')) || '/';\n}\n\nfunction moved(entry: MetaEntry, path: string): MetaEntry {\n return entry.link === undefined ? { ...entry, path } : { ...entry, path, dir: parentOf(path) };\n}\n\nfunction under(path: string, root: string): boolean {\n return path === root || path.startsWith(`${root}/`);\n}\n\nexport class MemoryMeta implements MetaStore {\n private readonly entries = new PathMap<MetaEntry>();\n\n async get(paths: readonly string[]): Promise<Array<MetaEntry | undefined>> {\n return paths.map((path) => this.entries.get(path));\n }\n\n async fresh(paths: readonly string[]): Promise<Array<MetaEntry | undefined>> {\n return this.get(paths);\n }\n\n async update(path: string, change: MetaChange): Promise<void> {\n this.set(path, change(this.entries.get(path)));\n }\n\n private set(path: string, entry: MetaEntry | undefined): void {\n if (entry) this.entries.set(path, entry);\n else this.entries.delete(path);\n }\n\n async move(from: string, to: string, root: (entry: MetaEntry | undefined) => MetaEntry) {\n await this.remove([to]);\n const carried = this.entries.subtree(from).map((path) => this.entries.get(path) as MetaEntry);\n for (const entry of carried) this.entries.delete(entry.path);\n for (const entry of carried) {\n const path = to + entry.path.slice(from.length);\n if (path !== to) this.entries.set(path, moved(entry, path));\n }\n this.entries.set(to, moved(root(carried.find((entry) => entry.path === from)), to));\n }\n\n async remove(paths: readonly string[]): Promise<void> {\n for (const path of paths) this.entries.deleteTree(path);\n }\n\n absent(path: string): boolean {\n return !this.entries.has(path);\n }\n\n async links(dir: string): Promise<MetaEntry[]> {\n return [...this.entries.entries()].map(([, e]) => e).filter((entry) => entry.dir === dir);\n }\n\n async under(path: string): Promise<MetaEntry[]> {\n return [...this.entries.entries()].map(([, e]) => e).filter((entry) => under(entry.path, path));\n }\n\n async all(): Promise<MetaEntry[]> {\n return [...this.entries.entries()].map(([, e]) => e);\n }\n}\n\nfunction descendants(path: string): IDBKeyRange {\n return IDBKeyRange.bound(`${path}/`, `${path}0`, false, true);\n}\n\nfunction settle<T>(transaction: IDBTransaction, value: () => T): Promise<T> {\n return new Promise((resolve, reject) => {\n transaction.oncomplete = () => resolve(value());\n transaction.onabort = () =>\n reject(transaction.error ?? new Error('metadata transaction aborted'));\n });\n}\n\ninterface Invalidation {\n paths?: readonly string[];\n trees?: readonly string[];\n}\n\nconst REMOVE_BATCH = 256;\nconst REMOVE_WAIT_MS = 5;\n\nexport class IndexedDbMeta implements MetaStore {\n private readonly db: IDBDatabase;\n private readonly cache = new PathMap<MetaEntry | null>();\n private readonly channel: BroadcastChannel;\n private generation = 0;\n private readonly listeners = new Set<(change: Invalidation) => void>();\n\n listen(listener: (change: Invalidation) => void): void {\n this.listeners.add(listener);\n }\n\n constructor(db: IDBDatabase) {\n this.db = db;\n db.onversionchange = () => db.close();\n this.channel = new BroadcastChannel(`slicc-kernel-meta:${db.name}`);\n this.channel.onmessage = ({ data }) => {\n this.drop(data as Invalidation);\n for (const listener of this.listeners) listener(data as Invalidation);\n };\n (this.channel as BroadcastChannel & { unref?: () => void }).unref?.();\n }\n\n private drop({ paths = [], trees = [] }: Invalidation): void {\n this.generation++;\n for (const path of paths) this.cache.delete(path);\n for (const tree of trees) this.cache.deleteTree(tree);\n }\n\n private changed(invalidation: Invalidation): void {\n this.drop(invalidation);\n this.channel.postMessage(invalidation);\n }\n\n private transaction(mode: IDBTransactionMode): [IDBTransaction, IDBObjectStore] {\n const transaction = this.db.transaction(META_STORE, mode);\n return [transaction, transaction.objectStore(META_STORE)];\n }\n\n async get(paths: readonly string[]): Promise<Array<MetaEntry | undefined>> {\n const missing = paths.filter((path) => !this.cache.has(path));\n if (missing.length > 0) {\n this.settleRemoves();\n const generation = this.generation;\n const [transaction, store] = this.transaction('readonly');\n const found = new Map<string, MetaEntry | null>();\n for (const path of missing) {\n const request = store.get(path);\n request.onsuccess = () => void found.set(path, request.result ?? null);\n }\n await settle(transaction, () => undefined);\n if (generation === this.generation)\n for (const [path, entry] of found) this.cache.set(path, entry);\n return paths.map(\n (path) => (found.has(path) ? found.get(path) : this.cache.get(path)) ?? undefined\n );\n }\n return paths.map((path) => this.cache.get(path) ?? undefined);\n }\n\n async fresh(paths: readonly string[]): Promise<Array<MetaEntry | undefined>> {\n const [transaction, store] = this.transaction('readonly');\n const requests = paths.map((path) => store.get(path));\n return settle(transaction, () =>\n requests.map((request) => (request.result as MetaEntry | undefined) ?? undefined)\n );\n }\n\n async update(path: string, change: MetaChange): Promise<void> {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readwrite');\n const request = store.get(path);\n let next: MetaEntry | undefined;\n request.onsuccess = () => {\n next = change(request.result);\n if (next) store.put(next);\n else store.delete(path);\n };\n await settle(transaction, () => undefined);\n this.changed({ paths: [path] });\n this.cache.set(path, next ?? null);\n }\n\n async updateMany(changes: ReadonlyArray<MetaUpdate>): Promise<void> {\n if (changes.length === 0) return;\n this.settleRemoves();\n const [transaction, store] = this.transaction('readwrite');\n const next = new Map<string, MetaEntry | null>();\n for (const { path, change } of changes) {\n const request = store.get(path);\n request.onsuccess = () => {\n const entry = change(request.result);\n next.set(path, entry ?? null);\n if (entry) store.put(entry);\n else store.delete(path);\n };\n }\n await settle(transaction, () => undefined);\n this.changed({ paths: changes.map(({ path }) => path) });\n for (const [path, entry] of next) this.cache.set(path, entry);\n }\n\n close(): void {\n this.channel.close();\n this.db.close();\n }\n\n async move(from: string, to: string, root: (entry: MetaEntry | undefined) => MetaEntry) {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readwrite');\n store.delete(to);\n store.delete(descendants(to));\n const source = store.get(from);\n const below = store.getAll(descendants(from));\n below.onsuccess = () => {\n store.delete(from);\n store.delete(descendants(from));\n for (const entry of below.result as MetaEntry[]) {\n store.put(moved(entry, to + entry.path.slice(from.length)));\n }\n store.put(moved(root(source.result), to));\n };\n await settle(transaction, () => undefined);\n this.changed({ trees: [from, to] });\n }\n\n absent(path: string): boolean {\n return this.cache.has(path) && this.cache.get(path) === null;\n }\n\n private removing = new Map<string, string>();\n private removeTimer: ReturnType<typeof setTimeout> | undefined;\n\n async remove(paths: readonly string[]): Promise<void> {\n this.settleRemoves();\n return this.removeNow(paths);\n }\n\n async removeFile(path: string): Promise<void> {\n const known = this.cache.get(path);\n if (!known) return this.remove([path]);\n this.generation++;\n this.cache.set(path, null);\n this.removing.set(path, JSON.stringify(known));\n if (this.removing.size >= REMOVE_BATCH) return this.flushRemoves();\n this.removeTimer ??= setTimeout(\n () => void this.flushRemoves().catch(() => undefined),\n REMOVE_WAIT_MS\n );\n }\n\n private async removeNow(paths: readonly string[]): Promise<void> {\n const [transaction, store] = this.transaction('readwrite');\n for (const path of paths) {\n store.delete(path);\n store.delete(descendants(path));\n }\n await settle(transaction, () => undefined);\n this.changed({ trees: paths });\n }\n\n private settleRemoves(): void {\n if (this.removing.size > 0) void this.flushRemoves().catch(() => undefined);\n }\n\n private flushRemoves(): Promise<void> {\n clearTimeout(this.removeTimer);\n this.removeTimer = undefined;\n const batch = this.removing;\n if (batch.size === 0) return Promise.resolve();\n this.removing = new Map();\n const [transaction, store] = this.transaction('readwrite');\n for (const [path, seen] of batch) {\n const request = store.get(path);\n request.onsuccess = () => {\n if (request.result && JSON.stringify(request.result) === seen) store.delete(path);\n };\n }\n const paths = [...batch.keys()];\n return settle(transaction, () => void this.channel.postMessage({ paths }));\n }\n\n async links(dir: string): Promise<MetaEntry[]> {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readonly');\n const request = store.index('dir').getAll(dir);\n return settle(transaction, () => request.result as MetaEntry[]);\n }\n\n async under(path: string): Promise<MetaEntry[]> {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readonly');\n const self = store.get(path);\n const below = store.getAll(descendants(path));\n return settle(transaction, () =>\n [self.result as MetaEntry | undefined, ...(below.result as MetaEntry[])].filter(\n (entry): entry is MetaEntry => entry !== undefined\n )\n );\n }\n\n async all(): Promise<MetaEntry[]> {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readonly');\n const request = store.getAll();\n return settle(transaction, () => request.result as MetaEntry[]);\n }\n}\n\nexport function openMeta(name: string, factory: IDBFactory): Promise<IndexedDbMeta> {\n return new Promise((resolve, reject) => {\n const request = factory.open(name, META_VERSION);\n request.onupgradeneeded = (event) => {\n if (event.oldVersion < 1) {\n request.result.createObjectStore(META_STORE, { keyPath: 'path' }).createIndex('dir', 'dir');\n }\n };\n request.onsuccess = () => resolve(new IndexedDbMeta(request.result));\n request.onerror = () => reject(request.error);\n });\n}\n", "export interface FsStat {\n isFile: boolean;\n isDirectory: boolean;\n isSymbolicLink: boolean;\n isSocket?: boolean;\n isFifo?: boolean;\n size: number;\n mode: number;\n mtime: Date;\n atime: Date;\n ctime: Date;\n ino: number;\n nlink?: number;\n dev?: number;\n readonly?: boolean;\n maxFile?: number;\n ranged?: boolean;\n linkable?: boolean;\n version?: string;\n uid?: number;\n gid?: number;\n}\n\nexport type UsersMode = 'off' | 'report' | 'enforce';\n\nexport const DEFAULT_USERS: UsersMode = 'enforce';\n\nexport interface Owner {\n uid: number;\n gid: number;\n}\n\nexport interface Perm {\n uid: number;\n gid: number;\n mode?: number;\n link?: string;\n}\n\nexport interface NewOwner extends Owner {\n mode?: number;\n parents?: number;\n socket?: boolean;\n fifo?: boolean;\n}\n\nexport interface OwnerChange {\n uid?: number;\n gid?: number;\n follow?: boolean;\n kind?: 'chown' | 'adopt' | 'new';\n mode?: number;\n}\n\nexport interface HeldEntry {\n writeFile: KernelFs['writeFile'];\n direct: boolean;\n}\n\nexport interface KernelFs {\n resolvePath(base: string, path: string): string;\n exclusive?<T>(path: string, run: (held: HeldEntry) => Promise<T>, follow?: boolean): Promise<T>;\n readFile(path: string): Promise<string>;\n readFileBuffer(path: string): Promise<Uint8Array>;\n writeFile(path: string, content: Uint8Array | string, owner?: NewOwner): Promise<void>;\n exists(path: string): Promise<boolean>;\n stat(path: string): Promise<FsStat>;\n lstat(path: string): Promise<FsStat>;\n readdir(path: string): Promise<string[]>;\n readdirStat(path: string): Promise<Array<[string, FsStat | null]>>;\n mkdir(path: string, options?: { recursive?: boolean; owner?: NewOwner }): Promise<void>;\n rm(\n path: string,\n options?: { recursive?: boolean; force?: boolean; file?: boolean }\n ): Promise<void>;\n rename(from: string, to: string): Promise<void>;\n link(from: string, to: string, follow?: boolean): Promise<void>;\n links?(path: string): boolean;\n symlink(target: string, path: string, owner?: NewOwner): Promise<void>;\n readlink(path: string): Promise<string>;\n realpath?(path: string, follow: boolean): Promise<string>;\n createExclusive?(path: string, owner?: NewOwner): Promise<void>;\n readonly rootName?: string;\n chown?(path: string, change: OwnerChange): Promise<void>;\n trackOwners?(): void;\n crossings?(mounted: (path: string) => boolean): void;\n ancestry?(path: string): Promise<Array<Perm | undefined>>;\n hasOwner?(path: string): Promise<boolean>;\n chmod(path: string, mode: number): Promise<void>;\n append?(path: string, bytes: Uint8Array): Promise<number>;\n utimes(path: string, atime: Date, mtime: Date): Promise<void>;\n lutimes?(path: string, atime: Date, mtime: Date): Promise<void>;\n pread?(path: string, offset: number, length: number, version?: string): Promise<Uint8Array>;\n pwrite?(path: string, offset: number, bytes: Uint8Array, transfer?: boolean): Promise<void>;\n truncate?(path: string, size: number): Promise<void>;\n protect?(prefixes: readonly string[], versions?: boolean): void;\n unguarded?(): KernelFs;\n noLinks?(): KernelFs;\n mayChange?(path: string, follow: boolean, whole?: boolean): Promise<void>;\n commandTarget?(path: string): Promise<string | undefined>;\n readVersioned?(path: string, cached?: boolean): Promise<{ bytes: Uint8Array; version: string }>;\n version?(path: string, cached?: boolean): Promise<string>;\n}\n\nexport type RangedOps = Required<Pick<KernelFs, 'pread' | 'pwrite' | 'truncate'>>;\n\nexport function rangedOps(fs: Partial<RangedOps>): RangedOps | undefined {\n const { pread, pwrite, truncate } = fs;\n if (!pread || !pwrite || !truncate) return undefined;\n return { pread: pread.bind(fs), pwrite: pwrite.bind(fs), truncate: truncate.bind(fs) };\n}\n\nexport async function lutimesOf(\n fs: KernelFs,\n path: string,\n atime: Date,\n mtime: Date\n): Promise<void> {\n if (fs.lutimes) return fs.lutimes(path, atime, mtime);\n if ((await fs.lstat(path)).isSymbolicLink) throw fsError('EOPNOTSUPP', path);\n return fs.utimes(path, atime, mtime);\n}\n\nexport function mayLink(fs: { links?(path: string): boolean }, path: string): boolean {\n return fs.links?.(path) ?? true;\n}\n\nexport function modeOption(mode: unknown): number {\n if (!Number.isInteger(mode) || (mode as number) < 0 || (mode as number) > 0o7777) {\n throw fsError('EINVAL', `not a mode: ${String(mode)}`);\n }\n return mode as number;\n}\n\nexport function fsError(code: string, path: string): Error & { code: string } {\n return Object.assign(new Error(`${code}: ${path}`), { code });\n}\n\nexport function normalizePath(path: string): string {\n const parts: string[] = [];\n for (const part of path.split('/')) {\n if (part === '' || part === '.') continue;\n if (part === '..') parts.pop();\n else parts.push(part);\n }\n return `/${parts.join('/')}`;\n}\n\nexport function resolvePath(base: string, path: string): string {\n return normalizePath(path.startsWith('/') ? path : `${base}/${path}`);\n}\n\nexport function inodeOf(path: string): number {\n let h1 = 0xdeadbeef;\n let h2 = 0x41c6ce57;\n for (let i = 0; i < path.length; i++) {\n const c = path.charCodeAt(i);\n h1 = Math.imul(h1 ^ c, 2654435761);\n h2 = Math.imul(h2 ^ c, 1597334677);\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n return 4294967296 * (2097151 & h2) + (h1 >>> 0) || 1;\n}\n\nexport interface Redirect {\n of: string;\n to: string;\n}\n\nexport function redirected(of: string, to: string): Error {\n return Object.assign(fsError('EXDEV', `${of} leads to the mount at ${to}`), {\n redirect: { of: normalizePath(of), to: normalizePath(to) },\n });\n}\n\nexport function redirectOf(err: unknown): Redirect | undefined {\n return (err as { redirect?: Redirect } | null)?.redirect;\n}\n", "import { META_DB, type MetaEntry, openMeta } from './fs/meta.ts';\nimport { fsError, normalizePath } from './fs/types.ts';\n\nexport interface MetadataEntry {\n path: string;\n mode?: number;\n uid?: number;\n gid?: number;\n}\n\nexport interface WriteMetadataOptions {\n metadata?: string;\n indexedDB?: IDBFactory;\n}\n\nconst MAX_ID = 0xfffffffe;\n\nfunction id(value: unknown, what: string): number {\n if (!Number.isInteger(value) || (value as number) < 0 || (value as number) > MAX_ID) {\n throw fsError('EINVAL', `not a ${what}: ${String(value)}`);\n }\n return value as number;\n}\n\nfunction checked(entry: MetadataEntry): MetadataEntry {\n if (!String(entry.path).startsWith('/'))\n throw fsError('EINVAL', `not an absolute path: ${entry.path}`);\n const path = normalizePath(String(entry.path));\n if ((entry.uid === undefined) !== (entry.gid === undefined)) {\n throw fsError('EINVAL', `${path}: give both uid and gid, or neither`);\n }\n const mode = entry.mode;\n if (mode !== undefined && (!Number.isInteger(mode) || mode < 0 || mode > 0o7777)) {\n throw fsError('EINVAL', `${path}: not a mode: ${String(mode)}`);\n }\n return {\n path,\n ...(mode !== undefined ? { mode } : {}),\n ...(entry.uid !== undefined ? { uid: id(entry.uid, 'uid'), gid: id(entry.gid, 'gid') } : {}),\n };\n}\n\nasync function present(root: FileSystemDirectoryHandle, path: string): Promise<boolean> {\n const parts = path.split('/').filter(Boolean);\n let dir = root;\n for (const [i, name] of parts.entries()) {\n const last = i === parts.length - 1;\n try {\n dir = await dir.getDirectoryHandle(name);\n } catch {\n if (!last) return false;\n return dir.getFileHandle(name).then(\n () => true,\n () => false\n );\n }\n }\n return true;\n}\n\nexport async function writeMetadata(\n root: FileSystemDirectoryHandle,\n entries: readonly MetadataEntry[],\n options: WriteMetadataOptions = {}\n): Promise<void> {\n const merged = new Map<string, MetadataEntry>();\n for (const want of entries.map(checked))\n merged.set(want.path, { ...merged.get(want.path), ...want });\n const wanted = [...merged.values()];\n for (const { path } of wanted) {\n if (!(await present(root, path))) throw fsError('ENOENT', path);\n }\n const factory = options.indexedDB ?? globalThis.indexedDB;\n const store = await openMeta(options.metadata ?? META_DB, factory);\n const ctimeMs = Date.now();\n try {\n await store.updateMany(\n wanted.map((want) => ({\n path: want.path,\n change: (entry: MetaEntry | undefined): MetaEntry => ({\n ...entry,\n path: want.path,\n ...(want.mode !== undefined ? { mode: want.mode } : {}),\n ...(want.uid !== undefined ? { uid: want.uid, gid: want.gid as number } : {}),\n ctimeMs,\n }),\n }))\n );\n } finally {\n store.close();\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,SAAS,MAAkC;AAClD,MAAI,SAAS,OAAO,SAAS,GAAI,QAAO;AACxC,QAAM,KAAK,KAAK,YAAY,GAAG;AAC/B,SAAO,MAAM,IAAI,MAAM,KAAK,MAAM,GAAG,EAAE;AACzC;AAEO,IAAM,UAAN,MAAiB;AAAA,EACL,SAAS,oBAAI,IAAe;AAAA,EAC5B,WAAW,oBAAI,IAAyB;AAAA,EAEzD,IAAI,OAAe;AACjB,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,MAAuB;AACzB,WAAO,KAAK,OAAO,IAAI,IAAI;AAAA,EAC7B;AAAA,EAEA,IAAI,MAA6B;AAC/B,WAAO,KAAK,OAAO,IAAI,IAAI;AAAA,EAC7B;AAAA,EAEA,OAAiC;AAC/B,WAAO,KAAK,OAAO,KAAK;AAAA,EAC1B;AAAA,EAEA,IAAI,MAAc,OAAgB;AAChC,QAAI,CAAC,KAAK,OAAO,IAAI,IAAI,EAAG,M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I;AAAA,EAChE;AACA,QAAM,UAAU,QAAQ,aAAa,WAAW;AAChD,QAAM,QAAQ,MAAM,SAAS,QAAQ,YAAY,SAAS,OAAO;AACjE,QAAM,UAAU,KAAK,IAAI;AACzB,MAAI;AACF,UAAM,MAAM;AAAA,MACV,OAAO,IAAI,CAAC,UAAU;AAAA,QACpB,MAAM,KAAK;AAAA,QACX,QAAQ,CAAC,WAA6C;AAAA,UACpD,GAAG;AAAA,UACH,MAAM,KAAK;AAAA,UACX,GAAI,KAAK,SAAS,SAAY,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC;AAAA,UACrD,GAAI,KAAK,QAAQ,SAAY,EAAE,KAAK,KAAK,KAAK,KAAK,KAAK,IAAc,IAAI,CAAC;AAAA,UAC3E;AAAA,QACF;AAAA,MACF,EAAE;AAAA,IACJ;AAAA,EACF,UAAE;AACA,UAAM,MAAM;AAAA,EACd;AACF;",
|
|
4
|
+
"sourcesContent": ["function parentOf(path: string): string | undefined {\n if (path === '/' || path === '') return undefined;\n const at = path.lastIndexOf('/');\n return at <= 0 ? '/' : path.slice(0, at);\n}\n\nexport class PathMap<V> {\n private readonly values = new Map<string, V>();\n private readonly children = new Map<string, Set<string>>();\n\n get size(): number {\n return this.values.size;\n }\n\n has(path: string): boolean {\n return this.values.has(path);\n }\n\n get(path: string): V | undefined {\n return this.values.get(path);\n }\n\n keys(): IterableIterator<string> {\n return this.values.keys();\n }\n\n set(path: string, value: V): this {\n if (!this.values.has(path)) this.link(path);\n this.values.set(path, value);\n return this;\n }\n\n delete(path: string): boolean {\n if (!this.values.delete(path)) return false;\n this.prune(path);\n return true;\n }\n\n subtree(root: string): string[] {\n const out: string[] = [];\n const stack = [root];\n for (let path = stack.pop(); path !== undefined; path = stack.pop()) {\n if (this.values.has(path)) out.push(path);\n const below = this.children.get(path);\n if (below) for (const child of below) stack.push(child);\n }\n return out;\n }\n\n entries(): IterableIterator<[string, V]> {\n return this.values.entries();\n }\n\n deleteTree(root: string): void {\n const stack = [root];\n for (let path = stack.pop(); path !== undefined; path = stack.pop()) {\n this.values.delete(path);\n const below = this.children.get(path);\n if (below) for (const child of below) stack.push(child);\n this.children.delete(path);\n }\n this.prune(root);\n }\n\n clear(): void {\n this.values.clear();\n this.children.clear();\n }\n\n private link(path: string): void {\n for (let child = path, parent = parentOf(path); parent !== undefined; ) {\n const set = this.children.get(parent);\n if (set?.has(child)) return;\n if (set) set.add(child);\n else this.children.set(parent, new Set([child]));\n child = parent;\n parent = parentOf(parent);\n }\n }\n\n private prune(path: string): void {\n for (let child = path, parent = parentOf(path); parent !== undefined; ) {\n if (this.values.has(child) || this.children.has(child)) return;\n const set = this.children.get(parent);\n set?.delete(child);\n if (set && set.size > 0) return;\n this.children.delete(parent);\n child = parent;\n parent = parentOf(parent);\n }\n }\n}\n", "import { PathMap } from './path-map.ts';\nexport interface MetaEntry {\n path: string;\n mode?: number;\n atimeMs?: number;\n mtimeMs?: number;\n mtimeFor?: number;\n timesAt?: number;\n timesBy?: string;\n ctimeMs?: number;\n ino?: number;\n link?: string;\n socket?: true;\n fifo?: true;\n dir?: string;\n uid?: number;\n gid?: number;\n heir?: [number, number];\n writes?: number;\n epoch?: number;\n}\n\nexport type MetaChange = (entry: MetaEntry | undefined) => MetaEntry | undefined;\n\nexport interface MetaUpdate {\n path: string;\n change: MetaChange;\n}\n\nexport interface MetaStore {\n get(paths: readonly string[]): Promise<Array<MetaEntry | undefined>>;\n fresh?(paths: readonly string[]): Promise<Array<MetaEntry | undefined>>;\n update(path: string, change: MetaChange): Promise<void>;\n updateMany?(changes: ReadonlyArray<MetaUpdate>): Promise<void>;\n move(from: string, to: string, root: (entry: MetaEntry | undefined) => MetaEntry): Promise<void>;\n remove(paths: readonly string[]): Promise<void>;\n links(dir: string): Promise<MetaEntry[]>;\n under(path: string): Promise<MetaEntry[]>;\n all(): Promise<MetaEntry[]>;\n absent?(path: string): boolean;\n removeFile?(path: string): Promise<void>;\n}\n\nexport const META_DB = 'slicc-kernel';\nexport const META_VERSION = 1;\nexport const META_STORE = 'entries';\n\nfunction parentOf(path: string): string {\n return path.slice(0, path.lastIndexOf('/')) || '/';\n}\n\nfunction moved(entry: MetaEntry, path: string): MetaEntry {\n return entry.link === undefined ? { ...entry, path } : { ...entry, path, dir: parentOf(path) };\n}\n\nfunction under(path: string, root: string): boolean {\n return path === root || path.startsWith(`${root}/`);\n}\n\nexport class MemoryMeta implements MetaStore {\n private readonly entries = new PathMap<MetaEntry>();\n\n async get(paths: readonly string[]): Promise<Array<MetaEntry | undefined>> {\n return paths.map((path) => this.entries.get(path));\n }\n\n async fresh(paths: readonly string[]): Promise<Array<MetaEntry | undefined>> {\n return this.get(paths);\n }\n\n async update(path: string, change: MetaChange): Promise<void> {\n this.set(path, change(this.entries.get(path)));\n }\n\n private set(path: string, entry: MetaEntry | undefined): void {\n if (entry) this.entries.set(path, entry);\n else this.entries.delete(path);\n }\n\n async move(from: string, to: string, root: (entry: MetaEntry | undefined) => MetaEntry) {\n await this.remove([to]);\n const carried = this.entries.subtree(from).map((path) => this.entries.get(path) as MetaEntry);\n for (const entry of carried) this.entries.delete(entry.path);\n for (const entry of carried) {\n const path = to + entry.path.slice(from.length);\n if (path !== to) this.entries.set(path, moved(entry, path));\n }\n this.entries.set(to, moved(root(carried.find((entry) => entry.path === from)), to));\n }\n\n async remove(paths: readonly string[]): Promise<void> {\n for (const path of paths) this.entries.deleteTree(path);\n }\n\n absent(path: string): boolean {\n return !this.entries.has(path);\n }\n\n async links(dir: string): Promise<MetaEntry[]> {\n return [...this.entries.entries()].map(([, e]) => e).filter((entry) => entry.dir === dir);\n }\n\n async under(path: string): Promise<MetaEntry[]> {\n return [...this.entries.entries()].map(([, e]) => e).filter((entry) => under(entry.path, path));\n }\n\n async all(): Promise<MetaEntry[]> {\n return [...this.entries.entries()].map(([, e]) => e);\n }\n}\n\nfunction descendants(path: string): IDBKeyRange {\n return IDBKeyRange.bound(`${path}/`, `${path}0`, false, true);\n}\n\nfunction settle<T>(transaction: IDBTransaction, value: () => T): Promise<T> {\n return new Promise((resolve, reject) => {\n transaction.oncomplete = () => resolve(value());\n transaction.onabort = () =>\n reject(transaction.error ?? new Error('metadata transaction aborted'));\n });\n}\n\ninterface Invalidation {\n paths?: readonly string[];\n trees?: readonly string[];\n}\n\nconst REMOVE_BATCH = 256;\nconst REMOVE_WAIT_MS = 5;\n\nexport class IndexedDbMeta implements MetaStore {\n private readonly db: IDBDatabase;\n private readonly cache = new PathMap<MetaEntry | null>();\n private readonly channel: BroadcastChannel;\n private generation = 0;\n private readonly listeners = new Set<(change: Invalidation) => void>();\n\n listen(listener: (change: Invalidation) => void): void {\n this.listeners.add(listener);\n }\n\n constructor(db: IDBDatabase) {\n this.db = db;\n db.onversionchange = () => db.close();\n this.channel = new BroadcastChannel(`slicc-kernel-meta:${db.name}`);\n this.channel.onmessage = ({ data }) => {\n this.drop(data as Invalidation);\n for (const listener of this.listeners) listener(data as Invalidation);\n };\n (this.channel as BroadcastChannel & { unref?: () => void }).unref?.();\n }\n\n private drop({ paths = [], trees = [] }: Invalidation): void {\n this.generation++;\n for (const path of paths) this.cache.delete(path);\n for (const tree of trees) this.cache.deleteTree(tree);\n }\n\n private changed(invalidation: Invalidation): void {\n this.drop(invalidation);\n this.channel.postMessage(invalidation);\n }\n\n private transaction(mode: IDBTransactionMode): [IDBTransaction, IDBObjectStore] {\n const transaction = this.db.transaction(META_STORE, mode);\n return [transaction, transaction.objectStore(META_STORE)];\n }\n\n async get(paths: readonly string[]): Promise<Array<MetaEntry | undefined>> {\n const missing = paths.filter((path) => !this.cache.has(path));\n if (missing.length > 0) {\n this.settleRemoves();\n const generation = this.generation;\n const [transaction, store] = this.transaction('readonly');\n const found = new Map<string, MetaEntry | null>();\n for (const path of missing) {\n const request = store.get(path);\n request.onsuccess = () => void found.set(path, request.result ?? null);\n }\n await settle(transaction, () => undefined);\n if (generation === this.generation)\n for (const [path, entry] of found) this.cache.set(path, entry);\n return paths.map(\n (path) => (found.has(path) ? found.get(path) : this.cache.get(path)) ?? undefined\n );\n }\n return paths.map((path) => this.cache.get(path) ?? undefined);\n }\n\n async fresh(paths: readonly string[]): Promise<Array<MetaEntry | undefined>> {\n const [transaction, store] = this.transaction('readonly');\n const requests = paths.map((path) => store.get(path));\n return settle(transaction, () =>\n requests.map((request) => (request.result as MetaEntry | undefined) ?? undefined)\n );\n }\n\n async update(path: string, change: MetaChange): Promise<void> {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readwrite');\n const request = store.get(path);\n let next: MetaEntry | undefined;\n request.onsuccess = () => {\n next = change(request.result);\n if (next) store.put(next);\n else store.delete(path);\n };\n await settle(transaction, () => undefined);\n this.changed({ paths: [path] });\n this.cache.set(path, next ?? null);\n }\n\n async updateMany(changes: ReadonlyArray<MetaUpdate>): Promise<void> {\n if (changes.length === 0) return;\n this.settleRemoves();\n const [transaction, store] = this.transaction('readwrite');\n const next = new Map<string, MetaEntry | null>();\n for (const { path, change } of changes) {\n const request = store.get(path);\n request.onsuccess = () => {\n const entry = change(request.result);\n next.set(path, entry ?? null);\n if (entry) store.put(entry);\n else store.delete(path);\n };\n }\n await settle(transaction, () => undefined);\n this.changed({ paths: changes.map(({ path }) => path) });\n for (const [path, entry] of next) this.cache.set(path, entry);\n }\n\n close(): void {\n this.channel.close();\n this.db.close();\n }\n\n async move(from: string, to: string, root: (entry: MetaEntry | undefined) => MetaEntry) {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readwrite');\n store.delete(to);\n store.delete(descendants(to));\n const source = store.get(from);\n const below = store.getAll(descendants(from));\n below.onsuccess = () => {\n store.delete(from);\n store.delete(descendants(from));\n for (const entry of below.result as MetaEntry[]) {\n store.put(moved(entry, to + entry.path.slice(from.length)));\n }\n store.put(moved(root(source.result), to));\n };\n await settle(transaction, () => undefined);\n this.changed({ trees: [from, to] });\n }\n\n absent(path: string): boolean {\n return this.cache.has(path) && this.cache.get(path) === null;\n }\n\n private removing = new Map<string, string>();\n private removeTimer: ReturnType<typeof setTimeout> | undefined;\n\n async remove(paths: readonly string[]): Promise<void> {\n this.settleRemoves();\n return this.removeNow(paths);\n }\n\n async removeFile(path: string): Promise<void> {\n const known = this.cache.get(path);\n if (!known) return this.remove([path]);\n this.generation++;\n this.cache.set(path, null);\n this.removing.set(path, JSON.stringify(known));\n if (this.removing.size >= REMOVE_BATCH) return this.flushRemoves();\n this.removeTimer ??= setTimeout(\n () => void this.flushRemoves().catch(() => undefined),\n REMOVE_WAIT_MS\n );\n }\n\n private async removeNow(paths: readonly string[]): Promise<void> {\n const [transaction, store] = this.transaction('readwrite');\n for (const path of paths) {\n store.delete(path);\n store.delete(descendants(path));\n }\n await settle(transaction, () => undefined);\n this.changed({ trees: paths });\n }\n\n private settleRemoves(): void {\n if (this.removing.size > 0) void this.flushRemoves().catch(() => undefined);\n }\n\n private flushRemoves(): Promise<void> {\n clearTimeout(this.removeTimer);\n this.removeTimer = undefined;\n const batch = this.removing;\n if (batch.size === 0) return Promise.resolve();\n this.removing = new Map();\n const [transaction, store] = this.transaction('readwrite');\n for (const [path, seen] of batch) {\n const request = store.get(path);\n request.onsuccess = () => {\n if (request.result && JSON.stringify(request.result) === seen) store.delete(path);\n };\n }\n const paths = [...batch.keys()];\n return settle(transaction, () => void this.channel.postMessage({ paths }));\n }\n\n async links(dir: string): Promise<MetaEntry[]> {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readonly');\n const request = store.index('dir').getAll(dir);\n return settle(transaction, () => request.result as MetaEntry[]);\n }\n\n async under(path: string): Promise<MetaEntry[]> {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readonly');\n const self = store.get(path);\n const below = store.getAll(descendants(path));\n return settle(transaction, () =>\n [self.result as MetaEntry | undefined, ...(below.result as MetaEntry[])].filter(\n (entry): entry is MetaEntry => entry !== undefined\n )\n );\n }\n\n async all(): Promise<MetaEntry[]> {\n this.settleRemoves();\n const [transaction, store] = this.transaction('readonly');\n const request = store.getAll();\n return settle(transaction, () => request.result as MetaEntry[]);\n }\n}\n\nexport function openMeta(name: string, factory: IDBFactory): Promise<IndexedDbMeta> {\n return new Promise((resolve, reject) => {\n const request = factory.open(name, META_VERSION);\n request.onupgradeneeded = (event) => {\n if (event.oldVersion < 1) {\n request.result.createObjectStore(META_STORE, { keyPath: 'path' }).createIndex('dir', 'dir');\n }\n };\n request.onsuccess = () => resolve(new IndexedDbMeta(request.result));\n request.onerror = () => reject(request.error);\n });\n}\n", "export interface FsStat {\n isFile: boolean;\n isDirectory: boolean;\n isSymbolicLink: boolean;\n isSocket?: boolean;\n isFifo?: boolean;\n size: number;\n mode: number;\n mtime: Date;\n atime: Date;\n ctime: Date;\n ino: number;\n nlink?: number;\n dev?: number;\n readonly?: boolean;\n maxFile?: number;\n ranged?: boolean;\n linkable?: boolean;\n version?: string;\n uid?: number;\n gid?: number;\n}\n\nexport type UsersMode = 'off' | 'report' | 'enforce';\n\nexport const DEFAULT_USERS: UsersMode = 'enforce';\n\nexport interface Owner {\n uid: number;\n gid: number;\n}\n\nexport interface Perm {\n uid: number;\n gid: number;\n mode?: number;\n link?: string;\n}\n\nexport interface NewOwner extends Owner {\n mode?: number;\n parents?: number;\n socket?: boolean;\n fifo?: boolean;\n}\n\nexport interface OwnerChange {\n uid?: number;\n gid?: number;\n follow?: boolean;\n kind?: 'chown' | 'adopt' | 'new';\n mode?: number;\n}\n\nexport interface HeldEntry {\n writeFile: KernelFs['writeFile'];\n direct: boolean;\n}\n\nexport interface KernelFs {\n resolvePath(base: string, path: string): string;\n exclusive?<T>(path: string, run: (held: HeldEntry) => Promise<T>, follow?: boolean): Promise<T>;\n readFile(path: string): Promise<string>;\n readFileBuffer(path: string): Promise<Uint8Array>;\n writeFile(path: string, content: Uint8Array | string, owner?: NewOwner): Promise<void>;\n exists(path: string): Promise<boolean>;\n stat(path: string): Promise<FsStat>;\n lstat(path: string): Promise<FsStat>;\n readdir(path: string): Promise<string[]>;\n readdirStat(path: string): Promise<Array<[string, FsStat | null]>>;\n mkdir(path: string, options?: { recursive?: boolean; owner?: NewOwner }): Promise<void>;\n rm(\n path: string,\n options?: { recursive?: boolean; force?: boolean; file?: boolean }\n ): Promise<void>;\n rename(from: string, to: string): Promise<void>;\n link(from: string, to: string, follow?: boolean): Promise<void>;\n links?(path: string): boolean;\n symlink(target: string, path: string, owner?: NewOwner): Promise<void>;\n readlink(path: string): Promise<string>;\n realpath?(path: string, follow: boolean): Promise<string>;\n createExclusive?(path: string, owner?: NewOwner): Promise<void>;\n readonly rootName?: string;\n chown?(path: string, change: OwnerChange): Promise<void>;\n trackOwners?(): void;\n onPeer?(settle: () => Promise<void>): void;\n peers?(): { joined(): Promise<unknown>; crowded(): boolean } | undefined;\n crossings?(mounted: (path: string) => boolean): void;\n ancestry?(path: string): Promise<Array<Perm | undefined>>;\n hasOwner?(path: string): Promise<boolean>;\n chmod(path: string, mode: number): Promise<void>;\n append?(path: string, bytes: Uint8Array): Promise<number>;\n utimes(path: string, atime: Date, mtime: Date): Promise<void>;\n lutimes?(path: string, atime: Date, mtime: Date): Promise<void>;\n pread?(path: string, offset: number, length: number, version?: string): Promise<Uint8Array>;\n pwrite?(path: string, offset: number, bytes: Uint8Array, transfer?: boolean): Promise<void>;\n truncate?(path: string, size: number): Promise<void>;\n protect?(prefixes: readonly string[], versions?: boolean): void;\n unguarded?(): KernelFs;\n noLinks?(): KernelFs;\n mayChange?(path: string, follow: boolean, whole?: boolean): Promise<void>;\n commandTarget?(path: string): Promise<string | undefined>;\n readVersioned?(path: string, cached?: boolean): Promise<{ bytes: Uint8Array; version: string }>;\n version?(path: string, cached?: boolean): Promise<string>;\n}\n\nexport type RangedOps = Required<Pick<KernelFs, 'pread' | 'pwrite' | 'truncate'>>;\n\nexport function rangedOps(fs: Partial<RangedOps>): RangedOps | undefined {\n const { pread, pwrite, truncate } = fs;\n if (!pread || !pwrite || !truncate) return undefined;\n return { pread: pread.bind(fs), pwrite: pwrite.bind(fs), truncate: truncate.bind(fs) };\n}\n\nexport async function lutimesOf(\n fs: KernelFs,\n path: string,\n atime: Date,\n mtime: Date\n): Promise<void> {\n if (fs.lutimes) return fs.lutimes(path, atime, mtime);\n if ((await fs.lstat(path)).isSymbolicLink) throw fsError('EOPNOTSUPP', path);\n return fs.utimes(path, atime, mtime);\n}\n\nexport function mayLink(fs: { links?(path: string): boolean }, path: string): boolean {\n return fs.links?.(path) ?? true;\n}\n\nexport function modeOption(mode: unknown): number {\n if (!Number.isInteger(mode) || (mode as number) < 0 || (mode as number) > 0o7777) {\n throw fsError('EINVAL', `not a mode: ${String(mode)}`);\n }\n return mode as number;\n}\n\nexport function fsError(code: string, path: string): Error & { code: string } {\n return Object.assign(new Error(`${code}: ${path}`), { code });\n}\n\nexport function normalizePath(path: string): string {\n const parts: string[] = [];\n for (const part of path.split('/')) {\n if (part === '' || part === '.') continue;\n if (part === '..') parts.pop();\n else parts.push(part);\n }\n return `/${parts.join('/')}`;\n}\n\nexport function resolvePath(base: string, path: string): string {\n return normalizePath(path.startsWith('/') ? path : `${base}/${path}`);\n}\n\nexport function inodeOf(path: string): number {\n let h1 = 0xdeadbeef;\n let h2 = 0x41c6ce57;\n for (let i = 0; i < path.length; i++) {\n const c = path.charCodeAt(i);\n h1 = Math.imul(h1 ^ c, 2654435761);\n h2 = Math.imul(h2 ^ c, 1597334677);\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n return 4294967296 * (2097151 & h2) + (h1 >>> 0) || 1;\n}\n\nexport interface Redirect {\n of: string;\n to: string;\n}\n\nexport function redirected(of: string, to: string): Error {\n return Object.assign(fsError('EXDEV', `${of} leads to the mount at ${to}`), {\n redirect: { of: normalizePath(of), to: normalizePath(to) },\n });\n}\n\nexport function redirectOf(err: unknown): Redirect | undefined {\n return (err as { redirect?: Redirect } | null)?.redirect;\n}\n", "import { META_DB, type MetaEntry, openMeta } from './fs/meta.ts';\nimport { fsError, normalizePath } from './fs/types.ts';\n\nexport interface MetadataEntry {\n path: string;\n mode?: number;\n uid?: number;\n gid?: number;\n}\n\nexport interface WriteMetadataOptions {\n metadata?: string;\n indexedDB?: IDBFactory;\n}\n\nconst MAX_ID = 0xfffffffe;\n\nfunction id(value: unknown, what: string): number {\n if (!Number.isInteger(value) || (value as number) < 0 || (value as number) > MAX_ID) {\n throw fsError('EINVAL', `not a ${what}: ${String(value)}`);\n }\n return value as number;\n}\n\nfunction checked(entry: MetadataEntry): MetadataEntry {\n if (!String(entry.path).startsWith('/'))\n throw fsError('EINVAL', `not an absolute path: ${entry.path}`);\n const path = normalizePath(String(entry.path));\n if ((entry.uid === undefined) !== (entry.gid === undefined)) {\n throw fsError('EINVAL', `${path}: give both uid and gid, or neither`);\n }\n const mode = entry.mode;\n if (mode !== undefined && (!Number.isInteger(mode) || mode < 0 || mode > 0o7777)) {\n throw fsError('EINVAL', `${path}: not a mode: ${String(mode)}`);\n }\n return {\n path,\n ...(mode !== undefined ? { mode } : {}),\n ...(entry.uid !== undefined ? { uid: id(entry.uid, 'uid'), gid: id(entry.gid, 'gid') } : {}),\n };\n}\n\nasync function present(root: FileSystemDirectoryHandle, path: string): Promise<boolean> {\n const parts = path.split('/').filter(Boolean);\n let dir = root;\n for (const [i, name] of parts.entries()) {\n const last = i === parts.length - 1;\n try {\n dir = await dir.getDirectoryHandle(name);\n } catch {\n if (!last) return false;\n return dir.getFileHandle(name).then(\n () => true,\n () => false\n );\n }\n }\n return true;\n}\n\nexport async function writeMetadata(\n root: FileSystemDirectoryHandle,\n entries: readonly MetadataEntry[],\n options: WriteMetadataOptions = {}\n): Promise<void> {\n const merged = new Map<string, MetadataEntry>();\n for (const want of entries.map(checked))\n merged.set(want.path, { ...merged.get(want.path), ...want });\n const wanted = [...merged.values()];\n for (const { path } of wanted) {\n if (!(await present(root, path))) throw fsError('ENOENT', path);\n }\n const factory = options.indexedDB ?? globalThis.indexedDB;\n const store = await openMeta(options.metadata ?? META_DB, factory);\n const ctimeMs = Date.now();\n try {\n await store.updateMany(\n wanted.map((want) => ({\n path: want.path,\n change: (entry: MetaEntry | undefined): MetaEntry => ({\n ...entry,\n path: want.path,\n ...(want.mode !== undefined ? { mode: want.mode } : {}),\n ...(want.uid !== undefined ? { uid: want.uid, gid: want.gid as number } : {}),\n ctimeMs,\n }),\n }))\n );\n } finally {\n store.close();\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,SAAS,MAAkC;AAClD,MAAI,SAAS,OAAO,SAAS,GAAI,QAAO;AACxC,QAAM,KAAK,KAAK,YAAY,GAAG;AAC/B,SAAO,MAAM,IAAI,MAAM,KAAK,MAAM,GAAG,EAAE;AACzC;AAEO,IAAM,UAAN,MAAiB;AAAA,EACL,SAAS,oBAAI,IAAe;AAAA,EAC5B,WAAW,oBAAI,IAAyB;AAAA,EAEzD,IAAI,OAAe;AACjB,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAI,MAAuB;AACzB,WAAO,KAAK,OAAO,IAAI,IAAI;AAAA,EAC7B;AAAA,EAEA,IAAI,MAA6B;AAC/B,WAAO,KAAK,OAAO,IAAI,IAAI;AAAA,EAC7B;AAAA,EAEA,OAAiC;AAC/B,WAAO,KAAK,OAAO,KAAK;AAAA,EAC1B;AAAA,EAEA,IAAI,MAAc,OAAgB;AAChC,QAAI,CAAC,KAAK,OAAO,IAAI,IAAI,EAAG,MAAK,KAAK,IAAI;AAC1C,SAAK,OAAO,IAAI,MAAM,KAAK;AAC3B,WAAO;AAAA,EACT;AAAA,EAEA,OAAO,MAAuB;AAC5B,QAAI,CAAC,KAAK,OAAO,OAAO,IAAI,EAAG,QAAO;AACtC,SAAK,MAAM,IAAI;AACf,WAAO;AAAA,EACT;AAAA,EAEA,QAAQ,MAAwB;AAC9B,UAAM,MAAgB,CAAC;AACvB,UAAM,QAAQ,CAAC,IAAI;AACnB,aAAS,OAAO,MAAM,IAAI,GAAG,S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SAAY,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC;AAAA,UACrD,GAAI,KAAK,QAAQ,SAAY,EAAE,KAAK,KAAK,KAAK,KAAK,KAAK,IAAc,IAAI,CAAC;AAAA,UAC3E;AAAA,QACF;AAAA,MACF,EAAE;AAAA,IACJ;AAAA,EACF,UAAE;AACA,UAAM,MAAM;AAAA,EACd;AACF;",
|
|
6
6
|
"names": ["parentOf"]
|
|
7
7
|
}
|
|
@@ -494,7 +494,11 @@ var init_ranged = __esm({
|
|
|
494
494
|
if (!watch || this.pinned) return;
|
|
495
495
|
const { now, changed: changed2 } = watchedChange(watch, this.seen, this.path);
|
|
496
496
|
this.seen = now;
|
|
497
|
-
if (
|
|
497
|
+
if (changed2) this.reread();
|
|
498
|
+
}
|
|
499
|
+
reread() {
|
|
500
|
+
const watch = this.watch;
|
|
501
|
+
if (!watch || this.pinned || this.pages.changed) return;
|
|
498
502
|
let st;
|
|
499
503
|
try {
|
|
500
504
|
st = watch.stat(this.path);
|
|
@@ -857,6 +861,9 @@ function cachingBridge(bridge, now = () => performance.now(), shared) {
|
|
|
857
861
|
...bridge.create ? {
|
|
858
862
|
create: (p, mode, opening2) => mutating(() => bridge.create?.(p, mode, opening2), ...entry(p))
|
|
859
863
|
} : {},
|
|
864
|
+
...bridge.mkfifo ? {
|
|
865
|
+
mkfifo: (p, mode) => mutating(() => bridge.mkfifo?.(p, mode), ...entry(p))
|
|
866
|
+
} : {},
|
|
860
867
|
...chown ? {
|
|
861
868
|
chown: (p, ...rest2) => rewriting(p, () => chown.call(bridge, p, ...rest2))
|
|
862
869
|
} : {},
|
|
@@ -1034,6 +1041,11 @@ var init_wasi_files = __esm({
|
|
|
1034
1041
|
this.orphaned = true;
|
|
1035
1042
|
this.ranged?.pin();
|
|
1036
1043
|
}
|
|
1044
|
+
reread() {
|
|
1045
|
+
if (this.dirty || this.orphaned) return;
|
|
1046
|
+
if (this.ranged) this.ranged.reread();
|
|
1047
|
+
else this.data = void 0;
|
|
1048
|
+
}
|
|
1037
1049
|
isOrphan() {
|
|
1038
1050
|
return this.orphaned;
|
|
1039
1051
|
}
|
|
@@ -1729,7 +1741,8 @@ function lockImports(host) {
|
|
|
1729
1741
|
host.promote(fd);
|
|
1730
1742
|
const kind = FLOCK_OPS[op & ~LOCK_NB];
|
|
1731
1743
|
if (!kind) throw new WasiError("EINVAL");
|
|
1732
|
-
host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
|
|
1744
|
+
const shared = host.calls.flock(fd, kind, kind !== "unlock" && (op & LOCK_NB) === 0);
|
|
1745
|
+
if (kind !== "unlock" && shared === true) host.reread(fd);
|
|
1733
1746
|
},
|
|
1734
1747
|
fcntl_lock: (fd, cmd, at) => {
|
|
1735
1748
|
if (cmd !== F_GETLK && cmd !== F_SETLK && cmd !== F_SETLKW) throw new WasiError("EINVAL");
|
|
@@ -1747,8 +1760,10 @@ function lockImports(host) {
|
|
|
1747
1760
|
if (kind === "read" && file.readable === false || kind === "write" && file.writable === false)
|
|
1748
1761
|
throw new WasiError("EBADF");
|
|
1749
1762
|
if (kind !== "write") host.flush(file);
|
|
1750
|
-
host.calls.set(file.target, kind, start2, len, cmd === F_SETLKW);
|
|
1751
|
-
if (kind
|
|
1763
|
+
const shared = host.calls.set(file.target, kind, start2, len, cmd === F_SETLKW);
|
|
1764
|
+
if (kind === "unlock") return;
|
|
1765
|
+
host.locked();
|
|
1766
|
+
if (shared === true) host.reread(fd);
|
|
1752
1767
|
}
|
|
1753
1768
|
};
|
|
1754
1769
|
}
|
|
@@ -2450,6 +2465,10 @@ var init_wasi_fds = __esm({
|
|
|
2450
2465
|
}
|
|
2451
2466
|
}
|
|
2452
2467
|
}
|
|
2468
|
+
reread(fd) {
|
|
2469
|
+
const e = this.get(fd);
|
|
2470
|
+
if (e.type === "file") e.file.buffer.reread();
|
|
2471
|
+
}
|
|
2453
2472
|
flushPath(path) {
|
|
2454
2473
|
for (const [p, buffer] of this.buffers) if (within(p, path)) buffer.flush();
|
|
2455
2474
|
if (this.shared && !this.fs.changes?.clean()) this.kernel.call({ op: "fd-path-flush", path });
|
|
@@ -3729,7 +3748,7 @@ function wrap(table) {
|
|
|
3729
3748
|
}
|
|
3730
3749
|
return out;
|
|
3731
3750
|
}
|
|
3732
|
-
var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW, AT_EACCESS, ROOT_IDS, GONE, S_IFIFO, S_IFLNK, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
|
|
3751
|
+
var WasiExit, IDS, NS_PER_MS4, AT_SYMLINK_NOFOLLOW, AT_FDCWD, AT_EACCESS, ROOT_IDS, GONE, S_IFIFO, S_IFLNK, DEFAULT_UMASK, MONOTONIC_BASE, MAX_READ, SIGINFO_BYTES, FD_ALIAS, STDIO_FDS, SIGPIPE_EXIT, SIG_IGN, SEALED_MODE, WasiHost;
|
|
3733
3752
|
var init_wasi_host = __esm({
|
|
3734
3753
|
"src/process/wasi/wasi-host.ts"() {
|
|
3735
3754
|
"use strict";
|
|
@@ -3760,6 +3779,7 @@ var init_wasi_host = __esm({
|
|
|
3760
3779
|
IDS = ["ruid", "euid", "suid", "rgid", "egid", "sgid"];
|
|
3761
3780
|
NS_PER_MS4 = 1000000n;
|
|
3762
3781
|
AT_SYMLINK_NOFOLLOW = 1;
|
|
3782
|
+
AT_FDCWD = -2;
|
|
3763
3783
|
AT_EACCESS = 2;
|
|
3764
3784
|
ROOT_IDS = Object.freeze({ uid: 0, gid: 0 });
|
|
3765
3785
|
GONE = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR"]);
|
|
@@ -3942,6 +3962,18 @@ var init_wasi_host = __esm({
|
|
|
3942
3962
|
},
|
|
3943
3963
|
fd_chmod: (fd, mode) => void this.o.fs.chmod(pathOf(fd), mode & 4095),
|
|
3944
3964
|
path_chmod: (dirfd, p, l, mode, flags) => void this.o.fs.chmod(target(at(dirfd, p, l), flags), mode & 4095),
|
|
3965
|
+
path_mkfifo: (dirfd, p, l, mode) => {
|
|
3966
|
+
const { mkfifo } = this.o.fs;
|
|
3967
|
+
if (!mkfifo) return E.NOSYS;
|
|
3968
|
+
const raw = mem.string(p, l);
|
|
3969
|
+
const path = dirfd === AT_FDCWD && !raw.startsWith("/") ? fds.resolve(3, `${this.cwd}/${raw}`) : at(dirfd, p, l);
|
|
3970
|
+
const umask = this.o.kernel.call({ op: "proc-umask" });
|
|
3971
|
+
const want = mode & 4095 & ~umask;
|
|
3972
|
+
mkfifo.call(this.o.fs, path, want);
|
|
3973
|
+
const made = (this.o.fs.lstat(path).mode ?? 0) & 4095;
|
|
3974
|
+
if ((made & ~want) !== 0) this.o.fs.chmod(path, made & want);
|
|
3975
|
+
return E.SUCCESS;
|
|
3976
|
+
},
|
|
3945
3977
|
umask: (mask, out) => {
|
|
3946
3978
|
const old = this.o.kernel.call({ op: "proc-umask", mask });
|
|
3947
3979
|
mem.view().setUint32(out, old, true);
|
|
@@ -3965,6 +3997,35 @@ var init_wasi_host = __esm({
|
|
|
3965
3997
|
}
|
|
3966
3998
|
});
|
|
3967
3999
|
}
|
|
4000
|
+
lockHost(mem) {
|
|
4001
|
+
return {
|
|
4002
|
+
mem,
|
|
4003
|
+
file: (fd) => this.lockedFile(fd),
|
|
4004
|
+
flush: (file) => {
|
|
4005
|
+
if (file.path !== void 0) this.fds.flushPath(file.path);
|
|
4006
|
+
else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
|
|
4007
|
+
},
|
|
4008
|
+
locked: () => this.fds.holdLocks(),
|
|
4009
|
+
promote: (fd, moved) => this.fds.promote(fd, moved),
|
|
4010
|
+
reread: (fd) => this.fds.reread(fd),
|
|
4011
|
+
calls: {
|
|
4012
|
+
flock: (fd, kind, wait2) => this.fds.restarting(
|
|
4013
|
+
() => this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} })
|
|
4014
|
+
),
|
|
4015
|
+
set: (target, kind, start2, len, wait2) => this.fds.restarting(
|
|
4016
|
+
() => this.o.kernel.call({
|
|
4017
|
+
op: "lk-set",
|
|
4018
|
+
...target,
|
|
4019
|
+
kind,
|
|
4020
|
+
start: start2,
|
|
4021
|
+
len,
|
|
4022
|
+
...wait2 ? { wait: wait2 } : {}
|
|
4023
|
+
})
|
|
4024
|
+
),
|
|
4025
|
+
get: (target, kind, start2, len) => this.o.kernel.call({ op: "lk-get", ...target, kind, start: start2, len })
|
|
4026
|
+
}
|
|
4027
|
+
};
|
|
4028
|
+
}
|
|
3968
4029
|
sliccImports() {
|
|
3969
4030
|
const { mem } = this;
|
|
3970
4031
|
const path = (p, l) => {
|
|
@@ -3995,32 +4056,7 @@ var init_wasi_host = __esm({
|
|
|
3995
4056
|
void this.creds.change(() => this.o.kernel.call({ op: "proc-setcred", change }));
|
|
3996
4057
|
},
|
|
3997
4058
|
...semImports(this),
|
|
3998
|
-
...lockImports(
|
|
3999
|
-
mem,
|
|
4000
|
-
file: (fd) => this.lockedFile(fd),
|
|
4001
|
-
flush: (file) => {
|
|
4002
|
-
if (file.path !== void 0) this.fds.flushPath(file.path);
|
|
4003
|
-
else if (file.target.fd !== void 0) this.o.kernel.sys.flush(file.target.fd);
|
|
4004
|
-
},
|
|
4005
|
-
locked: () => this.fds.holdLocks(),
|
|
4006
|
-
promote: (fd, moved) => this.fds.promote(fd, moved),
|
|
4007
|
-
calls: {
|
|
4008
|
-
flock: (fd, kind, wait2) => void this.fds.restarting(
|
|
4009
|
-
() => this.o.kernel.call({ op: "flock", fd, kind, ...wait2 ? { wait: wait2 } : {} })
|
|
4010
|
-
),
|
|
4011
|
-
set: (target, kind, start2, len, wait2) => void this.fds.restarting(
|
|
4012
|
-
() => this.o.kernel.call({
|
|
4013
|
-
op: "lk-set",
|
|
4014
|
-
...target,
|
|
4015
|
-
kind,
|
|
4016
|
-
start: start2,
|
|
4017
|
-
len,
|
|
4018
|
-
...wait2 ? { wait: wait2 } : {}
|
|
4019
|
-
})
|
|
4020
|
-
),
|
|
4021
|
-
get: (target, kind, start2, len) => this.o.kernel.call({ op: "lk-get", ...target, kind, start: start2, len })
|
|
4022
|
-
}
|
|
4023
|
-
}),
|
|
4059
|
+
...lockImports(this.lockHost(mem)),
|
|
4024
4060
|
groups_get: (buf, cap, count) => {
|
|
4025
4061
|
const { groups } = this.creds.get();
|
|
4026
4062
|
if (cap !== 0 && cap < groups.length) throw new WasiError("EINVAL");
|
|
@@ -5395,7 +5431,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
5395
5431
|
var init_version = __esm({
|
|
5396
5432
|
"src/version.ts"() {
|
|
5397
5433
|
"use strict";
|
|
5398
|
-
KERNEL_VERSION = true ? "1.
|
|
5434
|
+
KERNEL_VERSION = true ? "1.120.1" : "0.0.0-dev";
|
|
5399
5435
|
OS_RELEASE = "6.0.0-slicc";
|
|
5400
5436
|
}
|
|
5401
5437
|
});
|
|
@@ -9337,7 +9373,7 @@ function cString(memory, at) {
|
|
|
9337
9373
|
return new TextDecoder().decode(bytes.subarray(0, bytes.indexOf(0)));
|
|
9338
9374
|
}
|
|
9339
9375
|
function baseOf3(Fs, dirfd) {
|
|
9340
|
-
return dirfd ===
|
|
9376
|
+
return dirfd === AT_FDCWD2 ? Fs.cwd?.() ?? "/" : Fs.getStream?.(dirfd)?.path ?? "/";
|
|
9341
9377
|
}
|
|
9342
9378
|
function readonlyRefusal(Fs, memory, call2) {
|
|
9343
9379
|
if (!(call2.amode & W_ACCESS)) return 0;
|
|
@@ -9504,7 +9540,7 @@ function linuxDevices(Fs) {
|
|
|
9504
9540
|
}
|
|
9505
9541
|
}
|
|
9506
9542
|
}
|
|
9507
|
-
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW2, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY5, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_TRUNC2, S_IFMT_BITS, S_IFIFO_BITS, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME,
|
|
9543
|
+
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW2, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY5, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_TRUNC2, S_IFMT_BITS, S_IFIFO_BITS, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD2, AT_EACCESS2, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
9508
9544
|
var init_process_fds = __esm({
|
|
9509
9545
|
"src/process/process-fds.ts"() {
|
|
9510
9546
|
"use strict";
|
|
@@ -9571,7 +9607,7 @@ var init_process_fds = __esm({
|
|
|
9571
9607
|
field = (text) => (text || "none").replace(/[\s\\]/g, (c) => `\\${c.charCodeAt(0).toString(8).padStart(3, "0")}`);
|
|
9572
9608
|
rootKind = () => globalThis.navigator?.storage ? "opfs" : "memory";
|
|
9573
9609
|
NAME = /^[a-z_][a-z0-9_-]*$/i;
|
|
9574
|
-
|
|
9610
|
+
AT_FDCWD2 = -100;
|
|
9575
9611
|
AT_EACCESS2 = 512;
|
|
9576
9612
|
W_ACCESS = 2;
|
|
9577
9613
|
X_ACCESS = 1;
|
|
@@ -10362,7 +10398,7 @@ var init_wasi_procfs = __esm({
|
|
|
10362
10398
|
}
|
|
10363
10399
|
};
|
|
10364
10400
|
FOLLOWING = ["writeFile", "chmod", "utimes", "pwrite", "truncate"];
|
|
10365
|
-
NOT_FOLLOWING = ["mkdir", "rm", "unlink", "rmdir", "lutimes", "create"];
|
|
10401
|
+
NOT_FOLLOWING = ["mkdir", "rm", "unlink", "rmdir", "lutimes", "create", "mkfifo"];
|
|
10366
10402
|
MAX_HOPS2 = 40;
|
|
10367
10403
|
}
|
|
10368
10404
|
});
|