Sign In

@jsonjoy.com/fs-fsa

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsonjoy.com/fs-fsa - npm Package Compare versions

Comparing version
4.66.0
to
4.66.1
+1
-1
lib/CoreFileSystemDirectoryHandle.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"CoreFileSystemDirectoryHandle.js","sourceRoot":"","sources":["../src/CoreFileSystemDirectoryHandle.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAC9D,iCAQgB;AAChB,yEAAsE;AAYtE,8EAA2E;AAC3E,8DAAyD;AAEzD;;GAEG;AACH,MAAa,6BAA8B,SAAQ,2CAAoB;IAKrE,YACqB,KAAiB,EACpC,IAAY,EACZ,MAA+B,EAAE;QAEjC,MAAM,OAAO,GAAG,IAAA,UAAS,EAAC,GAAG,CAAC,CAAC;QAC/B,KAAK,CAAC,WAAW,EAAE,IAAA,eAAQ,EAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;QAL5C,UAAK,GAAL,KAAK,CAAY;QAMpC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;IAChG,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,CAAC,IAAI;QAChB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC/B,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,EAAE,CAA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AAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5C,IAAI,QAAQ,KAAK,EAAE;gBAAE,OAAO,EAAE,CAAC;YAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAU,CAAC;YACtC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS;gBAAE,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5D,OAAO,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,YAAY,CAAC,KAAU,EAAE,MAAc;QAC7C,IAAI,KAAK,YAAY,YAAY;YAAE,MAAM,KAAK,CAAC;QAC/C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;gBACnB;oBACE,MAAM,IAAA,uBAAgB,GAAE,CAAC;gBAC3B;oBACE,MAAM,IAAA,yBAAkB,GAAE,CAAC;YAC/B,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;CACF;AAzPD,sEAyPC","sourcesContent":["import { CoreFileSystemHandle } from './CoreFileSystemHandle';\nimport {\n assertCanWrite,\n assertName,\n basename,\n ctx as createCtx,\n newNotAllowedError,\n newNotFoundError,\n newTypeMismatchError,\n} from './util';\nimport { CoreFileSystemFileHandle } from './CoreFileSystemFileHandle';\nimport type {\n CoreFsaContext,\n GetDirectoryHandleOptions,\n GetFileHandleOptions,\n IFileSystemDirectoryHandle,\n IFileSystemFileHandle,\n IFileSystemHandle,\n RemoveEntryOptions,\n} from './types';\nimport type { Superblock } from '@jsonjoy.com/fs-core';\nimport { ERROR_CODE } from '@jsonjoy.com/fs-core';\nimport { Buffer } from '@jsonjoy.com/fs-node-builtins/lib/internal/buffer';\nimport { MODE, FLAGS } from '@jsonjoy.com/fs-node-utils';\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle\n */\nexport class CoreFileSystemDirectoryHandle extends CoreFileSystemHandle implements IFileSystemDirectoryHandle {\n protected readonly ctx: CoreFsaContext;\n /** Directory path with trailing slash. */\n public readonly __path: string;\n\n public constructor(\n protected readonly _core: Superblock,\n path: string,\n ctx: Partial<CoreFsaContext> = {},\n ) {\n const fullCtx = createCtx(ctx);\n super('directory', basename(path, fullCtx.separator), fullCtx);\n this.ctx = fullCtx;\n this.__path = path[path.length - 1] === this.ctx.separator ? path : path + this.ctx.separator;\n }\n\n /**\n * Returns a new array iterator containing the keys for each item in\n * {@link CoreFileSystemDirectoryHandle} object.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/keys\n */\n public async *keys(): AsyncIterableIterator<string> {\n try {\n const link = this._core.getResolvedLinkOrThrow(this.__path);\n const children = link.children;\n for (const [name] of children) {\n if (name !== '.' && name !== '..') {\n yield name;\n }\n }\n } catch (error) {\n this._handleError(error, 'keys');\n }\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/entries\n */\n public async *entries(): AsyncIterableIterator<[string, CoreFileSystemHandle]> {\n const { __path: path, _core, ctx } = this;\n try {\n const link = _core.getResolvedLinkOrThrow(path);\n const children = link.children;\n for (const [name, childLink] of children) {\n if (name !== '.' && name !== '..' && childLink) {\n const childPath = path + name;\n const node = childLink.getNode();\n if (node.isDirectory()) {\n yield [name, new CoreFileSystemDirectoryHandle(_core, childPath, ctx)];\n } else if (node.isFile()) {\n yield [name, new CoreFileSystemFileHandle(_core, childPath, ctx)];\n }\n }\n }\n } catch (error) {\n this._handleError(error, 'entries');\n }\n }\n\n /**\n * Returns a new array iterator containing the values for each index in the\n * {@link FileSystemDirectoryHandle} object.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/values\n */\n public async *values(): AsyncIterableIterator<CoreFileSystemHandle> {\n for await (const [, value] of this.entries()) yield value;\n }\n\n /**\n * Returns a {@link CoreFileSystemDirectoryHandle} for a subdirectory with the specified\n * name within the directory handle on which the method is called.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle\n * @param name A string representing the {@link CoreFileSystemHandle} name of\n * the subdirectory you wish to retrieve.\n * @param options An optional object containing options for the retrieved\n * subdirectory.\n */\n public async getDirectoryHandle(\n name: string,\n options?: GetDirectoryHandleOptions,\n ): Promise<IFileSystemDirectoryHandle> {\n assertName(name, 'getDirectoryHandle', 'FileSystemDirectoryHandle');\n const filename = this.__path + name;\n try {\n const link = this._core.getResolvedLink(filename);\n if (link) {\n const node = link.getNode();\n if (!node.isDirectory()) throw newTypeMismatchError();\n return new CoreFileSystemDirectoryHandle(this._core, filename, this.ctx);\n } else {\n throw new Error('ENOENT'); // Simulate error for consistency with catch block\n }\n } catch (error) {\n if (error instanceof DOMException) throw error;\n if (error && typeof error === 'object') {\n if (error.code === ERROR_CODE.ENOENT || error.message === 'ENOENT') {\n if (options?.create) {\n assertCanWrite(this.ctx.mode!);\n try {\n this._core.mkdir(filename, 0o755);\n return new CoreFileSystemDirectoryHandle(this._core, filename, this.ctx);\n } catch (createError) {\n if (createError && typeof createError === 'object' && createError.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw createError;\n }\n }\n throw newNotFoundError();\n }\n if (error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n }\n throw error;\n }\n }\n\n /**\n * Returns a {@link CoreFileSystemFileHandle} for a file with the specified name,\n * within the directory the method is called.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/getFileHandle\n * @param name A string representing the {@link CoreFileSystemHandle} name of\n * the file you wish to retrieve.\n * @param options An optional object containing options for the retrieved file.\n */\n public async getFileHandle(name: string, options?: GetFileHandleOptions): Promise<IFileSystemFileHandle> {\n assertName(name, 'getFileHandle', 'FileSystemDirectoryHandle');\n const filename = this.__path + name;\n try {\n const link = this._core.getResolvedLink(filename);\n if (link) {\n const node = link.getNode();\n if (!node.isFile()) throw newTypeMismatchError();\n return new CoreFileSystemFileHandle(this._core, filename, this.ctx);\n } else {\n throw new Error('ENOENT'); // Simulate error for consistency with catch block\n }\n } catch (error) {\n if (error instanceof DOMException) throw error;\n if (error && typeof error === 'object') {\n if (error.code === ERROR_CODE.ENOENT || error.message === 'ENOENT') {\n if (options?.create) {\n assertCanWrite(this.ctx.mode!);\n try {\n this._core.writeFile(filename, Buffer.alloc(0), FLAGS.w, MODE.FILE);\n return new CoreFileSystemFileHandle(this._core, filename, this.ctx);\n } catch (createError) {\n if (createError && typeof createError === 'object' && createError.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw createError;\n }\n }\n throw newNotFoundError();\n }\n if (error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n }\n throw error;\n }\n }\n\n /**\n * Attempts to remove an entry if the directory handle contains a file or\n * directory called the name specified.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/removeEntry\n * @param name A string representing the {@link CoreFileSystemHandle} name of the\n * entry you wish to remove.\n * @param options An optional object containing options.\n */\n public async removeEntry(name: string, { recursive = false }: RemoveEntryOptions = {}): Promise<void> {\n assertCanWrite(this.ctx.mode!);\n assertName(name, 'removeEntry', 'FileSystemDirectoryHandle');\n const filename = this.__path + name;\n try {\n const link = this._core.getResolvedLinkOrThrow(filename);\n const node = link.getNode();\n if (node.isFile()) {\n this._core.unlink(filename);\n } else if (node.isDirectory()) {\n this._core.rmdir(filename, recursive);\n } else {\n throw newTypeMismatchError();\n }\n } catch (error) {\n if (error instanceof DOMException) throw error;\n if (error && typeof error === 'object') {\n switch (error.code) {\n case ERROR_CODE.ENOENT: {\n throw newNotFoundError();\n }\n case ERROR_CODE.EACCES:\n throw newNotAllowedError();\n case ERROR_CODE.ENOTEMPTY:\n throw new DOMException('The object can not be modified in this way.', 'InvalidModificationError');\n }\n }\n throw error;\n }\n }\n\n /**\n * The `resolve()` method of the {@link FileSystemDirectoryHandle} interface\n * returns an {@link Array} of directory names from the parent handle to the specified\n * child entry, with the name of the child entry as the last array item.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/resolve\n * @param possibleDescendant The {@link CoreFileSystemHandle} from which\n * to return the relative path.\n */\n public async resolve(possibleDescendant: IFileSystemHandle): Promise<string[] | null> {\n if (\n possibleDescendant instanceof CoreFileSystemDirectoryHandle ||\n possibleDescendant instanceof CoreFileSystemFileHandle\n ) {\n // First check if they are from the same core instance\n if ((possibleDescendant as any)._core !== this._core) return null;\n\n const path = this.__path;\n const childPath = possibleDescendant.__path;\n if (!childPath.startsWith(path)) return null;\n let relative = childPath.slice(path.length);\n if (relative === '') return [];\n const separator = this.ctx.separator!;\n if (relative[0] === separator) relative = relative.slice(1);\n return relative.split(separator);\n }\n return null;\n }\n\n private _handleError(error: any, method: string): never {\n if (error instanceof DOMException) throw error;\n if (error && typeof error === 'object') {\n switch (error.code) {\n case ERROR_CODE.ENOENT:\n throw newNotFoundError();\n case ERROR_CODE.EACCES:\n throw newNotAllowedError();\n }\n }\n throw error;\n }\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"CoreFileSystemFileHandle.js","sourceRoot":"","sources":["../src/CoreFileSystemFileHandle.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAC9D,qFAAkF;AAClF,iCAAuH;AACvH,yFAAsF;AAUtF,MAAa,wBAAyB,SAAQ,2CAAoB;IAGhE,YACqB,KAAiB,EACpB,MAAc,EAC9B,MAA+B,EAAE;QAEjC,MAAM,OAAO,GAAG,IAAA,UAAS,EAAC,GAAG,CAAC,CAAC;QAC/B,KAAK,CAAC,MAAM,EAAE,IAAA,eAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;QALzC,UAAK,GAAL,KAAK,CAAY;QACpB,WAA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AK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAW,sBAAsB;QAC/B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB;YAAE,OAAO,SAAS,CAAC;QAClD,OAAO,KAAK,IAAI,EAAE;YAChB,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzC,MAAM,IAAA,oCAA6B,GAAE,CAAC;YACxC,CAAC;YACD,OAAO,IAAI,+DAA8B,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/E,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,cAAc,CACzB,EAAE,gBAAgB,GAAG,KAAK,KAA4B,EAAE,gBAAgB,EAAE,KAAK,EAAE;QAEjF,IAAA,qBAAc,EAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,MAAM,IAAA,oCAA6B,GAAE,CAAC;QACxC,CAAC;QACD,OAAO,IAAI,mEAAgC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACnG,CAAC;CACF;AA3ED,4DA2EC","sourcesContent":["import { CoreFileSystemHandle } from './CoreFileSystemHandle';\nimport { CoreFileSystemSyncAccessHandle } from './CoreFileSystemSyncAccessHandle';\nimport { assertCanWrite, basename, ctx as createCtx, newNotAllowedError, newNoModificationAllowedError } from './util';\nimport { CoreFileSystemWritableFileStream } from './CoreFileSystemWritableFileStream';\nimport type {\n CoreFsaContext,\n CreateWritableOptions,\n IFileSystemFileHandle,\n IFileSystemSyncAccessHandle,\n} from './types';\nimport type { Superblock } from '@jsonjoy.com/fs-core';\nimport { ERROR_CODE } from '@jsonjoy.com/fs-core';\n\nexport class CoreFileSystemFileHandle extends CoreFileSystemHandle implements IFileSystemFileHandle {\n protected readonly ctx: CoreFsaContext;\n\n constructor(\n protected readonly _core: Superblock,\n public readonly __path: string,\n ctx: Partial<CoreFsaContext> = {},\n ) {\n const fullCtx = createCtx(ctx);\n super('file', basename(__path, fullCtx.separator), fullCtx);\n this.ctx = fullCtx;\n }\n\n /**\n * Returns a {@link Promise} which resolves to a {@link File} object\n * representing the state on disk of the entry represented by the handle.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/getFile\n */\n public async getFile(): Promise<File> {\n try {\n const path = this.__path;\n const link = this._core.getResolvedLinkOrThrow(path);\n const node = link.getNode();\n\n if (!node.isFile()) {\n throw new Error('Not a file');\n }\n\n // Get file stats for lastModified\n const lastModified = node.mtime ? node.mtime.getTime() : Date.now();\n\n // Read file content\n const buffer = node.getBuffer();\n const data = new Uint8Array(buffer);\n\n const file = new File([data], this.name, { lastModified });\n return file;\n } catch (error) {\n if (error instanceof DOMException) throw error;\n if (error && typeof error === 'object') {\n switch (error.code) {\n case ERROR_CODE.EACCES:\n throw newNotAllowedError();\n }\n }\n throw error;\n }\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createSyncAccessHandle\n */\n public get createSyncAccessHandle(): undefined | (() => Promise<IFileSystemSyncAccessHandle>) {\n if (!this.ctx.syncHandleAllowed) return undefined;\n return async () => {\n if (this.ctx.locks.isLocked(this.__path)) {\n throw newNoModificationAllowedError();\n }\n return new CoreFileSystemSyncAccessHandle(this._core, this.__path, this.ctx);\n };\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle/createWritable\n */\n public async createWritable(\n { keepExistingData = false }: CreateWritableOptions = { keepExistingData: false },\n ): Promise<CoreFileSystemWritableFileStream> {\n assertCanWrite(this.ctx.mode);\n if (this.ctx.locks.isLocked(this.__path)) {\n throw newNoModificationAllowedError();\n }\n return new CoreFileSystemWritableFileStream(this._core, this.__path, keepExistingData, this.ctx);\n }\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"CoreFileSystemHandle.js","sourceRoot":"","sources":["../src/CoreFileSystemHandle.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAG9D;;;;;GAKG;AACH,MAAsB,oBAAoB;IAGxC,YACkB,IAA0B,EAC1B,IAAY,EAC5B,GAAmB;QAFH,SAAI,GAAJ,IAAI,CAAsB;QAC1B,SAAI,GAAJ,IAAI,CAAQ;QAG5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,gBAAsC;QACvD,OAAO,CACL,IAAI,CAAC,WAAW,KAAK,gBAAgB,CAAC,WAAW,IAAK,IAAY,CAAC,MAAM,KAAM,gBAAwB,CAAC,MAAM,CAC/G,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,eAAe,CAC1B,oCAA0E;QAE1E,kEAAkE;QAClE,MAAM,aAAa,GAAG,oCAAoC,CAAC,IAAI,CAAC;QAChE,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;QAElC,6DAA6D;QAC7D,IAAI,aAAa,KAAK,WAAW,IAAI,WAAW,KAAK,MAAM,EAAE,CAAC;YAC5D,OAAO,IAAI,2CAAoB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC3D,CAAC;QAED,iCAAiC;QACjC,OAAO,IAAI,2CAAoB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,KAA8B,EAAE,SAAS,EAAE,KAAK,EAAE;QAC/E,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,iBAAiB,CACtB,oCAA0E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AC,CAAC;IACrC,CAAC;CACF;AAxDD,oDAwDC","sourcesContent":["import { CorePermissionStatus } from './CorePermissionStatus';\nimport type { IFileSystemHandle, FileSystemHandlePermissionDescriptor, CoreFsaContext } from './types';\n\n/**\n * Represents a File System Access API file handle `FileSystemHandle` object,\n * which was created from a core `Superblock`.\n *\n * @see [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle)\n */\nexport abstract class CoreFileSystemHandle implements IFileSystemHandle {\n protected readonly ctx: CoreFsaContext;\n\n constructor(\n public readonly kind: 'file' | 'directory',\n public readonly name: string,\n ctx: CoreFsaContext,\n ) {\n this.ctx = ctx;\n }\n\n /**\n * Compares two handles to see if the associated entries (either a file or directory) match.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/isSameEntry\n */\n public isSameEntry(fileSystemHandle: CoreFileSystemHandle): boolean {\n return (\n this.constructor === fileSystemHandle.constructor && (this as any).__path === (fileSystemHandle as any).__path\n );\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/queryPermission\n */\n public async queryPermission(\n fileSystemHandlePermissionDescriptor: FileSystemHandlePermissionDescriptor,\n ): Promise<CorePermissionStatus> {\n // Check if the requested mode is compatible with the context mode\n const requestedMode = fileSystemHandlePermissionDescriptor.mode;\n const contextMode = this.ctx.mode;\n\n // If requesting readwrite but context only allows read, deny\n if (requestedMode === 'readwrite' && contextMode === 'read') {\n return new CorePermissionStatus('denied', requestedMode);\n }\n\n // Otherwise grant the permission\n return new CorePermissionStatus('granted', requestedMode);\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/remove\n */\n public async remove({ recursive }: { recursive?: boolean } = { recursive: false }): Promise<void> {\n throw new Error('Not implemented');\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/requestPermission\n */\n public requestPermission(\n fileSystemHandlePermissionDescriptor: FileSystemHandlePermissionDescriptor,\n ): CorePermissionStatus {\n throw new Error('Not implemented');\n }\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"CoreFileSystemObserver.js","sourceRoot":"","sources":["../src/CoreFileSystemObserver.ts"],"names":[],"mappings":";;;AAAA,mFAAgF;AAChF,yEAAsE;AACtE,iCAA8D;AAC9D,kDAA4E;AAa5E;;GAEG;AACH,MAAa,sBAAsB;IACjC,YACkB,IAAkF,EAClF,IAAqC,EACrC,aAAkG,EAClG,sBAAgC,EAChC,wBAAyC,IAAI;QAJ7C,SAAI,GAAJ,IAAI,CAA8E;QAClF,SAAI,GAAJ,IAAI,CAAiC;QACrC,kBAAa,GAAb,aAAa,CAAqF;QAClG,2BAAsB,GAAtB,sBAAsB,CAAU;QAChC,0BAAqB,GAArB,qBAAqB,CAAwB;IAC5D,CAAC;CACL;AARD,wDAQC;AAED;;GAEG;AACH,MAAa,sBAAsB;IAQjC,YACqB,KAAiB,EACjB,QAAqF;QADrF,UAAK,GAAL,KAAK,CAAY;QACjB,aAAQ,GAAR,QAAQ,CAA6E;QATvF,kBAAa,GAAG,IAAI,GAAG,EAGvC,CAAC;QACM,aAAQ,GAA8B,EAAE,CAAC;QACzC,oBAAe,GAAY,KAAK,CAAC;IAKxC,CAAC;IAEG,KAAK,CAAC,OAAO,CAClB,MAAwF,EACxF,OAA2C;QAE3C,MAAM,IAAI,GAAI,MAA0C,CAAC,MAAM,CAAC;QAChE,IAAI,OAAO,IAAI,KAAK,QAAQ;YAC1B,MAAM,IAAI,SAAS,CAAC,sEAAsE,CAAC,CAAC;QAC9F,MAAM,WAAW,GAAI,MAA4B,CAAC,IAAI,KAAK,WAAW,CAAC;QACvE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IA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SAAS,CAAC;QAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;QACrE,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE;YAC7B,CAAC,CAAC,IAAI,6DAA6B,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC;YAC1D,CAAC,CAAC,IAAI,mDAAwB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;IAEO,QAAQ,CAAC,MAA+B;QAC9C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,IAAI,CAAC,eAAe;YAAE,OAAO;QACjC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,cAAc,CAAC,GAAG,EAAE;YAClB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;YAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC9B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;YACnB,IAAI,OAAO,CAAC,MAAM;gBAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA7GD,wDA6GC","sourcesContent":["import { CoreFileSystemDirectoryHandle } from './CoreFileSystemDirectoryHandle';\nimport { CoreFileSystemFileHandle } from './CoreFileSystemFileHandle';\nimport { newNotAllowedError, newNotFoundError } from './util';\nimport { CoreWatcher, ERROR_CODE, FsEventType } from '@jsonjoy.com/fs-core';\nimport type { CoreWatchEvent, Superblock } from '@jsonjoy.com/fs-core';\nimport type {\n CoreFsaContext,\n IFileSystemChangeRecord,\n IFileSystemDirectoryHandle,\n IFileSystemFileHandle,\n IFileSystemHandle,\n IFileSystemObserver,\n IFileSystemObserverObserveOptions,\n IFileSystemSyncAccessHandle,\n} from './types';\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemChangeRecord\n */\nexport class FileSystemChangeRecord implements IFileSystemChangeRecord {\n constructor(\n public readonly root: IFileSystemHandle | IFileSystemSyncAccessHandle | IFileSystemDirectoryHandle,\n public readonly type: IFileSystemChangeRecord['type'],\n public readonly changedHandle: IFileSystemHandle | IFileSystemSyncAccessHandle | IFileSystemDirectoryHandle | null,\n public readonly relativePathComponents: string[],\n public readonly relativePathMovedFrom: string[] | null = null,\n ) {}\n}\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemObserver\n */\nexport class CoreFileSystemObserver implements IFileSystemObserver {\n protected readonly _observations = new Map<\n IFileSystemFileHandle | IFileSystemDirectoryHandle | IFileSystemSyncAccessHandle,\n CoreWatcher\n >();\n protected _records: IFileSystemChangeRecord[] = [];\n protected _flushScheduled: boolean = false;\n\n constructor(\n protected readonly _core: Superblock,\n protected readonly callback: (records: IFileSystemChangeRecord[], observer: IFileSystemObserver) => void,\n ) {}\n\n public async observe(\n handle: IFileSystemFileHandle | IFileSystemDirectoryHandle | IFileSystemSyncAccessHandle,\n options?: IFileSystemObserverObserveOptions,\n ): Promise<void> {\n const path = (handle as unknown as { __path?: unknown }).__path;\n if (typeof path !== 'string')\n throw new TypeError(\"Failed to execute 'observe' on 'FileSystemObserver': Invalid handle.\");\n const isDirectory = (handle as IFileSystemHandle).kind === 'directory';\n const last = path[path.length - 1];\n const target = path.length > 1 && (last === '/' || last === '\\\\') ? path.slice(0, -1) : path;\n const ctx = ((handle as any).ctx ?? (handle as any)._ctx) as CoreFsaContext;\n try {\n const watcher = new CoreWatcher(this._core, target, { recursive: isDirectory && !!options?.recursive });\n watcher.changes.listen(event => this._onEvent(event, handle, watcher, ctx));\n this._observations.get(handle)?.close();\n this._observations.set(handle, watcher);\n } catch (error) {\n if (error && typeof error === 'object') {\n switch (error.code) {\n case ERROR_CODE.ENOENT:\n throw newNotFoundError();\n case ERROR_CODE.EACCES:\n throw newNotAllowedError();\n }\n }\n throw error;\n }\n }\n\n public unobserve(handle: IFileSystemFileHandle | IFileSystemDirectoryHandle | IFileSystemSyncAccessHandle): void {\n const watcher = this._observations.get(handle);\n if (!watcher) return;\n watcher.close();\n this._observations.delete(handle);\n }\n\n /** Disconnect and stop all observations. */\n public disconnect(): void {\n for (const watcher of this._observations.values()) watcher.close();\n this._observations.clear();\n this._records = [];\n }\n\n private _onEvent(\n event: CoreWatchEvent,\n root: IFileSystemFileHandle | IFileSystemDirectoryHandle | IFileSystemSyncAccessHandle,\n watcher: CoreWatcher,\n ctx: CoreFsaContext,\n ): void {\n let type: IFileSystemChangeRecord['type'];\n let changedHandle: IFileSystemHandle | null = null;\n let relativePathMovedFrom: string[] | null = null;\n switch (event.type) {\n case FsEventType.CREATE:\n type = 'appeared';\n changedHandle = this._changedHandle(event, watcher, ctx);\n break;\n case FsEventType.DELETE:\n if (!event.steps.length) {\n type = 'errored';\n if (this._observations.get(root) === watcher) this._observations.delete(root);\n } else {\n type = 'disappeared';\n }\n break;\n case FsEventType.MOVE:\n type = 'moved';\n changedHandle = this._changedHandle(event, watcher, ctx);\n relativePathMovedFrom = event.oldSteps ?? null;\n break;\n default:\n type = 'modified';\n changedHandle = this._changedHandle(event, watcher, ctx);\n }\n this._enqueue(new FileSystemChangeRecord(root, type, changedHandle, event.steps, relativePathMovedFrom));\n }\n\n private _changedHandle(event: CoreWatchEvent, watcher: CoreWatcher, ctx: CoreFsaContext): IFileSystemHandle {\n const sep = ctx.separator;\n const path = watcher.link.steps.concat(event.steps).join(sep) || sep;\n return event.node.isDirectory()\n ? new CoreFileSystemDirectoryHandle(this._core, path, ctx)\n : new CoreFileSystemFileHandle(this._core, path, ctx);\n }\n\n private _enqueue(record: IFileSystemChangeRecord): void {\n this._records.push(record);\n if (this._flushScheduled) return;\n this._flushScheduled = true;\n queueMicrotask(() => {\n this._flushScheduled = false;\n const records = this._records;\n this._records = [];\n if (records.length) this.callback(records, this);\n });\n }\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"CoreFileSystemSyncAccessHandle.js","sourceRoot":"","sources":["../src/CoreFileSystemSyncAccessHandle.ts"],"names":[],"mappings":";;;AAGA,8EAA2E;AAC3E,iCAA4C;AAC5C,8DAAmD;AAEnD;;GAEG;AACH,MAAa,8BAA8B;IAIzC,YACmB,KAAiB,EAClB,MAAc,EACb,IAAoB;QAFpB,UAAK,GAAL,KAAK,CAAY;QAClB,WAAM,GAAN,MAAM,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAgB;QAN/B,QAAG,GAAkB,IAAI,CAAC;QAC1B,YAAO,GAAG,KAAK,CAAC;QAOtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEO,WAAW;QACjB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,YAAY,CAAC,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACtB,2BAA2B;YAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,qBAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAK,CAAC,CAAC,CAAC;YACrE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,KAAK;QAChB,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAA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,WAAW,EAAE,CAAC;QAC9B,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;QAErC,MAAM,GAAG,GAAG,eAAM,CAAC,IAAI,CAAC,MAAoB,CAAC,CAAC;QAC9C,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,qCAAsB,EAAE,CAAC;gBAC3E,MAAM,IAAA,yBAAkB,GAAE,CAAC;YAC7B,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA1HD,wEA0HC","sourcesContent":["import type { IFileSystemSyncAccessHandle, FileSystemReadWriteOptions, CoreFsaContext } from './types';\nimport type { Superblock } from '@jsonjoy.com/fs-core';\nimport { ERROR_CODE } from '@jsonjoy.com/fs-core';\nimport { Buffer } from '@jsonjoy.com/fs-node-builtins/lib/internal/buffer';\nimport { newNotAllowedError } from './util';\nimport { FLAGS } from '@jsonjoy.com/fs-node-utils';\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle\n */\nexport class CoreFileSystemSyncAccessHandle implements IFileSystemSyncAccessHandle {\n private _fd: number | null = null;\n private _closed = false;\n\n constructor(\n private readonly _core: Superblock,\n public readonly __path: string,\n private readonly _ctx: CoreFsaContext,\n ) {\n this._ctx.locks.acquireLock(this.__path);\n }\n\n private _ensureOpen(): number {\n if (this._closed) {\n throw new DOMException('The file handle is closed.', 'InvalidStateError');\n }\n if (this._fd === null) {\n // Open file for read/write\n const flags = this._ctx.mode === 'readwrite' ? FLAGS['r+'] : FLAGS.r;\n this._fd = this._core.open(this.__path, flags, 0o644);\n }\n return this._fd;\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/close\n */\n public async close(): Promise<void> {\n if (this._fd !== null) {\n this._core.close(this._fd);\n this._fd = null;\n }\n this._closed = true;\n this._ctx.locks.releaseLock(this.__path);\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/flush\n */\n public async flush(): Promise<void> {\n const fd = this._ensureOpen();\n // Core doesn't have an explicit flush method, but we can try to sync if available\n // For now, this is a no-op as the core writes are synchronous\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/getSize\n */\n public async getSize(): Promise<number> {\n try {\n const link = this._core.getResolvedLinkOrThrow(this.__path);\n const node = link.getNode();\n return node.getSize();\n } catch (error) {\n if (error && typeof error === 'object' && error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw error;\n }\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/read\n */\n public async read(buffer: ArrayBuffer | ArrayBufferView, options: FileSystemReadWriteOptions = {}): Promise<number> {\n const fd = this._ensureOpen();\n const { at: position = 0 } = options;\n\n const buf = Buffer.from(buffer as Uint8Array);\n try {\n return this._core.read(fd, buf, 0, buf.length, position);\n } catch (error) {\n if (error && typeof error === 'object' && error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw error;\n }\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/truncate\n */\n public async truncate(newSize: number): Promise<void> {\n if (this._ctx.mode !== 'readwrite') {\n throw newNotAllowedError();\n }\n\n try {\n const fd = this._ensureOpen();\n this._core.ftruncate(fd, newSize);\n } catch (error) {\n if (error && typeof error === 'object' && error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw error;\n }\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemSyncAccessHandle/write\n */\n public async write(\n buffer: ArrayBuffer | ArrayBufferView | DataView,\n options: FileSystemReadWriteOptions = {},\n ): Promise<number> {\n if (this._ctx.mode !== 'readwrite') {\n throw newNotAllowedError();\n }\n\n const fd = this._ensureOpen();\n const { at: position = 0 } = options;\n\n const buf = Buffer.from(buffer as Uint8Array);\n try {\n return this._core.write(fd, buf, 0, buf.length, position);\n } catch (error) {\n if (error && typeof error === 'object' && error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw error;\n }\n }\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"CoreFileSystemWritableFileStream.js","sourceRoot":"","sources":["../src/CoreFileSystemWritableFileStream.ts"],"names":[],"mappings":";;;AAGA,8EAA2E;AAC3E,iCAA2E;AAC3E,8DAAyD;AAGzD,MAAM,EAAE,GAAG,CACT,OAAO,cAAc,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CACrE,CAAC;AAE3B;;GAEG;AACH,MAAa,gCAAiC,SAAQ,EAAE;IAQtD,YAAY,IAAgB,EAAE,IAAY,EAAE,mBAA4B,KAAK,EAAE,GAAmB;QAChG,IAAI,EAAsB,CAAC;QAE3B,KAAK,CAAC;YACJ,KAAK,EAAE,UAAU,CAAC,EAAE;gBAClB,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC7B,MAAM,IAAA,oCAA6B,GAAE,CAAC;gBACxC,CAAC;gBACD,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC5B,MAAM,KAAK,GAAG,gBAAgB,CAAC,CAAC,CAAC,qBAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAK,CAAC,CAAC,CAAC;gBACvD,IAAI,CAAC;oBACH,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,sBAAY,CAAC;gBACzC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CAAC,2DAA2D,CAAC,CAAC;QAC/E,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;CACF;AAvKD,4EAuKC","sourcesContent":["import type { IFileSystemWritableFileStream, FileSystemWritableFileStreamParams, Data, CoreFsaContext } from './types';\nimport type { Superblock } from '@jsonjoy.com/fs-core';\nimport { ERROR_CODE } from '@jsonjoy.com/fs-core';\nimport { Buffer } from '@jsonjoy.com/fs-node-builtins/lib/internal/buffer';\nimport { newNotAllowedError, newNoModificationAllowedError } from './util';\nimport { FLAGS, MODE } from '@jsonjoy.com/fs-node-utils';\n\ndeclare const require: any;\nconst WS = (\n typeof WritableStream === 'undefined' ? require('stream/web').WritableStream : WritableStream\n) as typeof WritableStream;\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream\n */\nexport class CoreFileSystemWritableFileStream extends WS implements IFileSystemWritableFileStream {\n private _fd: number | undefined;\n private _position: number = 0;\n private _closed = false;\n private readonly _core: Superblock;\n private readonly _path: string;\n private readonly _ctx: CoreFsaContext;\n\n constructor(core: Superblock, path: string, keepExistingData: boolean = false, ctx: CoreFsaContext) {\n let fd: number | undefined;\n\n super({\n start: controller => {\n if (ctx.locks.isLocked(path)) {\n throw newNoModificationAllowedError();\n }\n ctx.locks.acquireLock(path);\n const flags = keepExistingData ? FLAGS['r+'] : FLAGS.w;\n try {\n fd = core.open(path, flags, MODE.FILE);\n } catch (error) {\n ctx.locks.releaseLock(path);\n if (error && typeof error === 'object' && error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw error;\n }\n },\n write: async (chunk: Data | FileSystemWritableFileStreamParams) => {\n await this._write(chunk);\n },\n close: async () => {\n if (!this._closed && this._fd !== undefined) {\n core.close(this._fd);\n this._closed = true;\n ctx.locks.releaseLock(path);\n }\n },\n abort: async () => {\n if (!this._closed && this._fd !== undefined) {\n core.close(this._fd);\n this._closed = true;\n ctx.locks.releaseLock(path);\n }\n },\n });\n\n this._core = core;\n this._path = path;\n this._fd = fd;\n this._ctx = ctx;\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/seek\n */\n public async seek(position: number): Promise<void> {\n if (this._closed) {\n throw new DOMException('The stream is closed.', 'InvalidStateError');\n }\n this._position = position;\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/truncate\n */\n public async truncate(size: number): Promise<void> {\n if (this._closed) {\n throw new DOMException('The stream is closed.', 'InvalidStateError');\n }\n try {\n if (this._fd === undefined) {\n throw new DOMException('The stream is not ready.', 'InvalidStateError');\n }\n this._core.ftruncate(this._fd, size);\n } catch (error) {\n if (error && typeof error === 'object' && error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw error;\n }\n }\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemWritableFileStream/write\n */\n public async write(chunk: Data): Promise<void>;\n public async write(params: FileSystemWritableFileStreamParams): Promise<void>;\n public async write(chunkOrParams: Data | FileSystemWritableFileStreamParams): Promise<void> {\n await this._write(chunkOrParams);\n }\n\n private async _write(chunkOrParams: Data | FileSystemWritableFileStreamParams): Promise<void> {\n if (this._closed) {\n throw new DOMException('The stream is closed.', 'InvalidStateError');\n }\n\n if (this._fd === undefined) {\n throw new DOMException('The stream is not ready.', 'InvalidStateError');\n }\n\n try {\n if (this._isParams(chunkOrParams)) {\n const params = chunkOrParams;\n switch (params.type) {\n case 'write': {\n if (params.data !== undefined) {\n const buffer = this._dataToBuffer(params.data);\n const position = params.position !== undefined ? params.position : this._position;\n const written = this._core.write(this._fd, buffer, 0, buffer.length, position);\n if (params.position === undefined) {\n this._position += written;\n }\n }\n break;\n }\n case 'seek': {\n if (params.position !== undefined) {\n this._position = params.position;\n }\n break;\n }\n case 'truncate': {\n if (params.size !== undefined) {\n await this.truncate(params.size);\n }\n break;\n }\n }\n } else {\n // Direct data write\n const buffer = this._dataToBuffer(chunkOrParams);\n const written = this._core.write(this._fd, buffer, 0, buffer.length, this._position);\n this._position += written;\n }\n } catch (error) {\n if (error && typeof error === 'object' && error.code === ERROR_CODE.EACCES) {\n throw newNotAllowedError();\n }\n throw error;\n }\n }\n\n private _isParams(chunk: Data | FileSystemWritableFileStreamParams): chunk is FileSystemWritableFileStreamParams {\n return !!(chunk && typeof chunk === 'object' && 'type' in chunk);\n }\n\n private _dataToBuffer(data: Data): Buffer {\n if (typeof data === 'string') {\n return Buffer.from(data, 'utf8');\n }\n if (data instanceof Buffer) {\n return data;\n }\n if (data instanceof ArrayBuffer) {\n return Buffer.from(data);\n }\n if (ArrayBuffer.isView(data)) {\n return Buffer.from(data.buffer, data.byteOffset, data.byteLength);\n }\n if (data instanceof Blob) {\n // For Blob, we would need to read it asynchronously\n // This is a simplified implementation\n throw new Error('Blob data type not fully supported in this implementation');\n }\n throw new Error('Unsupported data type');\n }\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"CorePermissionStatus.js","sourceRoot":"","sources":["../src/CorePermissionStatus.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAa,oBAAoB;IAI/B,YAAY,KAAsC,EAAE,OAAe,EAAE;QACnE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AARD,oDAQC"}
{"version":3,"file":"CorePermissionStatus.js","sourceRoot":"","sources":["../src/CorePermissionStatus.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAa,oBAAoB;IAI/B,YAAY,KAAsC,EAAE,OAAe,EAAE;QACnE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AARD,oDAQC","sourcesContent":["import type { IPermissionStatus } from './types';\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus\n */\nexport class CorePermissionStatus implements IPermissionStatus {\n public readonly name: string;\n public readonly state: 'granted' | 'denied' | 'prompt';\n\n constructor(state: 'granted' | 'denied' | 'prompt', name: string = '') {\n this.name = name;\n this.state = state;\n }\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"FileLockManager.js","sourceRoot":"","sources":["../src/FileLockManager.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAA5B;QACU,UAAK,GAAyB,IAAI,GAAG,EAAE,CAAC;IAqBlD,CAAC;IAnBQ,WAAW,CAAC,IAAY;QAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,WAAW,CAAC,IAAY;QAC7B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAEM,QAAQ,CAAC,IAAY;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;IACvC,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF;AAtBD,0CAsBC"}
{"version":3,"file":"FileLockManager.js","sourceRoot":"","sources":["../src/FileLockManager.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAA5B;QACU,UAAK,GAAyB,IAAI,GAAG,EAAE,CAAC;IAqBlD,CAAC;IAnBQ,WAAW,CAAC,IAAY;QAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,WAAW,CAAC,IAAY;QAC7B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAEM,QAAQ,CAAC,IAAY;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;IACvC,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF;AAtBD,0CAsBC","sourcesContent":["export class FileLockManager {\n private locks: Map<string, boolean> = new Map();\n\n public acquireLock(path: string): boolean {\n if (this.locks.get(path)) {\n return false;\n }\n this.locks.set(path, true);\n return true;\n }\n\n public releaseLock(path: string): void {\n this.locks.delete(path);\n }\n\n public isLocked(path: string): boolean {\n return this.locks.get(path) ?? false;\n }\n\n public clear(): void {\n this.locks.clear();\n }\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mFAAgF;AAOhF,kDAAkD;AAClD,qEAAkE;AAElE,kDAAwB;AACxB,iEAAuC;AACvC,0EAAgD;AAChD,qEAA2C;AAC3C,2EAAiD;AACjD,6EAAmD;AACnD,mEAAyC;AACzC,iEAAuC;AACvC,4DAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AACI,MAAM,GAAG,GAAG,CAAC,GAA6B,EAAE,IAAI,GAAG,IAAI,oBAAU,EAAE,EAAE,UAAkB,GAAG,EAAE,EAAE;IACnG,MAAM,GAAG,GAAG,IAAI,6DAA6B,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAClE,MAAM,kBAAkB,GAAqC,MAAM,kBAAmB,SAAQ,+CAAsB;QAClH,YAAY,QAAqF;YAC/F,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxB,CAAC;KACF,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAC;AAC3C,CAAC,CAAC;AARW,QAAA,GAAG,OAQd"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mFAAgF;AAOhF,kDAAkD;AAClD,qEAAkE;AAElE,kDAAwB;AACxB,iEAAuC;AACvC,0EAAgD;AAChD,qEAA2C;AAC3C,2EAAiD;AACjD,6EAAmD;AACnD,mEAAyC;AACzC,iEAAuC;AACvC,4DAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AACI,MAAM,GAAG,GAAG,CAAC,GAA6B,EAAE,IAAI,GAAG,IAAI,oBAAU,EAAE,EAAE,UAAkB,GAAG,EAAE,EAAE;IACnG,MAAM,GAAG,GAAG,IAAI,6DAA6B,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAClE,MAAM,kBAAkB,GAAqC,MAAM,kBAAmB,SAAQ,+CAAsB;QAClH,YAAY,QAAqF;YAC/F,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxB,CAAC;KACF,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAC;AAC3C,CAAC,CAAC;AARW,QAAA,GAAG,OAQd","sourcesContent":["import { CoreFileSystemDirectoryHandle } from './CoreFileSystemDirectoryHandle';\nimport {\n CoreFsaContext,\n IFileSystemChangeRecord,\n IFileSystemObserver,\n IFileSystemObserverConstructable,\n} from './types';\nimport { Superblock } from '@jsonjoy.com/fs-core';\nimport { CoreFileSystemObserver } from './CoreFileSystemObserver';\n\nexport * from './types';\nexport * from './CoreFileSystemHandle';\nexport * from './CoreFileSystemDirectoryHandle';\nexport * from './CoreFileSystemFileHandle';\nexport * from './CoreFileSystemSyncAccessHandle';\nexport * from './CoreFileSystemWritableFileStream';\nexport * from './CoreFileSystemObserver';\nexport * from './CorePermissionStatus';\nexport * from './FileLockManager';\n\n/**\n * Create a new instance of an in-memory File System Access API\n * implementation rooted at the root directory of the filesystem.\n *\n * @param ctx Optional context for the File System Access API.\n * @param core Optional low-level file system implementation to\n * back the File System Access API. If not provided, a new empty\n * Superblock instance will be created.\n * @param dirPath Optional path within the filesystem to use as the root\n * directory of the File System Access API. Defaults to `/`.\n * @returns A File System Access API implementation `dir` rooted at\n * the root directory of the filesystem, as well as the `core`,\n * a low-level file system implementation itself. Also, returns\n * `FileSystemObserver`, a class that can be used to create\n * observers that watch for changes to files and directories.\n */\nexport const fsa = (ctx?: Partial<CoreFsaContext>, core = new Superblock(), dirPath: string = '/') => {\n const dir = new CoreFileSystemDirectoryHandle(core, dirPath, ctx);\n const FileSystemObserver: IFileSystemObserverConstructable = class FileSystemObserver extends CoreFileSystemObserver {\n constructor(callback: (records: IFileSystemChangeRecord[], observer: IFileSystemObserver) => void) {\n super(core, callback);\n }\n };\n return { core, dir, FileSystemObserver };\n};\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { FileLockManager } from './FileLockManager';\n\nexport interface IPermissionStatus {\n name: string;\n state: 'granted' | 'denied' | 'prompt';\n}\n\nexport interface IFileSystemHandle {\n kind: 'file' | 'directory';\n name: string;\n isSameEntry(fileSystemHandle: IFileSystemHandle): boolean;\n queryPermission(\n fileSystemHandlePermissionDescriptor: FileSystemHandlePermissionDescriptor,\n ): Promise<IPermissionStatus>;\n remove(options?: { recursive?: boolean }): Promise<void>;\n requestPermission(fileSystemHandlePermissionDescriptor: FileSystemHandlePermissionDescriptor): IPermissionStatus;\n}\n\nexport interface FileSystemHandlePermissionDescriptor {\n mode: 'read' | 'readwrite';\n}\n\nexport interface IFileSystemDirectoryHandle extends IFileSystemHandle {\n keys(): AsyncIterableIterator<string>;\n entries(): AsyncIterableIterator<[string, IFileSystemHandle]>;\n values(): AsyncIterableIterator<IFileSystemHandle>;\n getDirectoryHandle(name: string, options?: GetDirectoryHandleOptions): Promise<IFileSystemDirectoryHandle>;\n getFileHandle(name: string, options?: GetFileHandleOptions): Promise<IFileSystemFileHandle>;\n removeEntry(name: string, options?: RemoveEntryOptions): Promise<void>;\n resolve(possibleDescendant: IFileSystemHandle): Promise<string[] | null>;\n}\n\n/**\n * Context for Core FSA operations - similar to NodeFsaContext but for Superblock\n */\nexport interface CoreFsaContext {\n separator: '/' | '\\\\';\n /** Whether synchronous file handles are allowed. */\n syncHandleAllowed: boolean;\n /** Whether writes are allowed, defaults to `read`. */\n mode: 'read' | 'readwrite';\n /** File lock manager for this context. */\n locks: FileLockManager;\n}\n\nexport interface CreateWritableOptions {\n keepExistingData?: boolean;\n}\n\nexport interface GetDirectoryHandleOptions {\n /**\n * A boolean value, which defaults to `false`. When set to `true` if the directory\n * is not found, one with the specified name will be created and returned.\n */\n create?: boolean;\n}\n\nexport interface GetFileHandleOptions {\n /**\n * A Boolean. Default `false`. When set to `true` if the file is not found,\n * one with the specified name will be created and returned.\n */\n create?: boolean;\n}\n\nexport interface RemoveEntryOptions {\n /**\n * A boolean value, which defaults to `false`. When set to true entries will\n * be removed recursively.\n */\n recursive?: boolean;\n}\n\nexport interface IFileSystemFileHandle extends IFileSystemHandle {\n getFile(): Promise<File>;\n createSyncAccessHandle: undefined | (() => Promise<IFileSystemSyncAccessHandle>);\n createWritable(options?: CreateWritableOptions): Promise<IFileSystemWritableFileStream>;\n}\n\nexport interface CreateWritableOptions {\n keepExistingData?: boolean;\n}\n\nexport interface IFileSystemSyncAccessHandle {\n close(): Promise<void>;\n flush(): Promise<void>;\n getSize(): Promise<number>;\n read(buffer: ArrayBuffer | ArrayBufferView, options?: FileSystemReadWriteOptions): Promise<number>;\n truncate(newSize: number): Promise<void>;\n write(buffer: ArrayBuffer | ArrayBufferView | DataView, options?: FileSystemReadWriteOptions): Promise<number>;\n}\n\nexport interface FileSystemReadWriteOptions {\n /**\n * A number representing the offset in bytes that the file should be read from.\n */\n at?: number;\n}\n\nexport interface IFileSystemWritableFileStream extends WritableStream {\n seek(position: number): Promise<void>;\n truncate(size: number): Promise<void>;\n write(chunk: Data): Promise<void>;\n write(params: FileSystemWritableFileStreamParams): Promise<void>;\n}\n\nexport interface FileSystemWritableFileStreamParams {\n type: 'write' | 'truncate' | 'seek';\n data?: Data;\n position?: number;\n size?: number;\n}\n\nexport type Data =\n | ArrayBuffer\n | ArrayBufferView\n | Uint8Array\n | Uint8ClampedArray\n | Int8Array\n | Uint16Array\n | Int16Array\n | Uint32Array\n | Int32Array\n | Float32Array\n | Float64Array\n | BigUint64Array\n | BigInt64Array\n | DataView\n | Blob\n | string;\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemChangeRecord\n */\nexport interface IFileSystemChangeRecord {\n /**\n * A reference to the file system handle that the change was observed on. This\n * property will be null for records with a \"disappeared\", \"errored\", or\n * \"unknown\" type.\n */\n changedHandle: IFileSystemHandle | IFileSystemSyncAccessHandle | IFileSystemDirectoryHandle | null;\n\n /**\n * An array containing the path components that make up the relative file path\n * from the `root` to the `changedHandle`, including the `changedHandle`\n * filename.\n */\n relativePathComponents: string[];\n\n /**\n * An array containing the path components that make up the relative file path\n * from the `root` to the `changedHandle`'s former location, in the case of\n * observations with a `\"moved\"` type. If the type is not `\"moved\"`, this\n * property will be `null`.\n */\n relativePathMovedFrom: string[] | null;\n\n /**\n * A reference to the root file system handle, that is, the one passed to the\n * `observe()` call that started the observation.\n */\n root: IFileSystemHandle | IFileSystemSyncAccessHandle | IFileSystemDirectoryHandle;\n\n /**\n * The type of change that occurred.\n */\n type: /** The file or directory was created or moved into the `root` file structure. */\n | 'appeared'\n\n /**\n * The file or directory was deleted or moved out of the root file structure.\n * To find out which file or directory `disappeared`, you can query the\n * `relativePathComponents` property.\n */\n | 'disappeared'\n\n /** An error state occurred in the observed directory. */\n | 'errored'\n\n /** The file or directory was modified. */\n | 'modified'\n\n /**\n * The file or directory was moved within the root file structure.\n *\n * Chrome note: On Windows, \"moved\" observations aren't supported between\n * directories. They are reported as a \"disappeared\" observation in the\n * source directory and an \"appeared\" observation in the destination directory.\n */\n | 'moved'\n\n /**\n * Indicates that some observations were missed. If you wish to find out\n * information on what changed in the missed observations, you could fall\n * back to polling the observed directory.\n */\n | 'unknown';\n}\n\nexport interface IFileSystemObserverObserveOptions {\n /** Whether to observe changes recursively in subdirectories. */\n recursive?: boolean;\n}\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemObserver\n */\nexport interface IFileSystemObserver {\n /**\n * Start observing changes to a given file or directory.\n *\n * @param handle The file or directory handle to observe.\n * @param options Optional settings for the observation.\n */\n observe(\n handle: IFileSystemFileHandle | IFileSystemDirectoryHandle | IFileSystemSyncAccessHandle,\n options?: IFileSystemObserverObserveOptions,\n ): Promise<void>;\n\n /**\n * Stop observing changes to a given file or directory, which was previously\n * passed to {@link observe}.\n *\n * @param handle The file or directory handle to stop observing.\n */\n unobserve(handle: IFileSystemFileHandle | IFileSystemDirectoryHandle | IFileSystemSyncAccessHandle): void;\n\n /** Disconnect and stop all observations. */\n disconnect(): void;\n}\n\nexport interface IFileSystemObserverConstructable {\n /**\n * Constructor for creating a FileSystemObserver.\n *\n * @param callback Function called with file system change records and the\n * observer instance\n */\n new (callback: (records: IFileSystemChangeRecord[], observer: IFileSystemObserver) => void): IFileSystemObserver;\n}\n"]}

@@ -1,1 +0,1 @@

{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAGpD;;GAEG;AACI,MAAM,GAAG,GAAG,CAAC,UAAmC,EAAE,EAAkB,EAAE;IAC3E,OAAO;QACL,SAAS,EAAE,GAAG;QACd,iBAAiB,EAAE,KAAK;QACxB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,IAAI,iCAAe,EAAE;QAC5B,GAAG,OAAO;KACX,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,GAAG,OAQd;AAEK,MAAM,QAAQ,G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AI,SAAS;QAAE,MAAM,IAAI,SAAS,CAAC,sBAAsB,MAAM,SAAS,KAAK,yBAAyB,CAAC,CAAC;AAC1G,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB;AAEK,MAAM,cAAc,GAAG,CAAC,IAA0B,EAAE,EAAE;IAC3D,IAAI,IAAI,KAAK,WAAW;QACtB,MAAM,IAAI,YAAY,CACpB,sFAAsF,EACtF,iBAAiB,CAClB,CAAC;AACN,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEK,MAAM,gBAAgB,GAAG,GAAG,EAAE,CACnC,IAAI,YAAY,CACd,0FAA0F,EAC1F,eAAe,CAChB,CAAC;AAJS,QAAA,gBAAgB,oBAIzB;AAEG,MAAM,oBAAoB,GAAG,GAAG,EAAE,CACvC,IAAI,YAAY,CAAC,mEAAmE,EAAE,mBAAmB,CAAC,CAAC;AADhG,QAAA,oBAAoB,wBAC4E;AAEtG,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,yBAAyB,EAAE,iBAAiB,CAAC,CAAC;AAA1F,QAAA,kBAAkB,sBAAwE;AAEhG,MAAM,6BAA6B,GAAG,GAAG,EAAE,CAChD,IAAI,YAAY,CAAC,4CAA4C,EAAE,4BAA4B,CAAC,CAAC;AADlF,QAAA,6BAA6B,iCACqD","sourcesContent":["import { FileLockManager } from './FileLockManager';\nimport type { CoreFsaContext } from './types';\n\n/**\n * Creates a new {@link CoreFsaContext}.\n */\nexport const ctx = (partial: Partial<CoreFsaContext> = {}): CoreFsaContext => {\n return {\n separator: '/',\n syncHandleAllowed: false,\n mode: 'read',\n locks: new FileLockManager(),\n ...partial,\n };\n};\n\nexport const basename = (path: string, separator: string) => {\n if (path[path.length - 1] === separator) path = path.slice(0, -1);\n const lastSlashIndex = path.lastIndexOf(separator);\n return lastSlashIndex === -1 ? path : path.slice(lastSlashIndex + 1);\n};\n\nconst nameRegex = /^(\\.{1,2})$|[\\/\\\\]/;\n\nexport const assertName = (name: string, method: string, klass: string) => {\n const isInvalid = !name || nameRegex.test(name);\n if (isInvalid) throw new TypeError(`Failed to execute '${method}' on '${klass}': Name is not allowed.`);\n};\n\nexport const assertCanWrite = (mode: 'read' | 'readwrite') => {\n if (mode !== 'readwrite')\n throw new DOMException(\n 'The request is not allowed by the user agent or the platform in the current context.',\n 'NotAllowedError',\n );\n};\n\nexport const newNotFoundError = () =>\n new DOMException(\n 'A requested file or directory could not be found at the time an operation was processed.',\n 'NotFoundError',\n );\n\nexport const newTypeMismatchError = () =>\n new DOMException('The path supplied exists, but was not an entry of requested type.', 'TypeMismatchError');\n\nexport const newNotAllowedError = () => new DOMException('Permission not granted.', 'NotAllowedError');\n\nexport const newNoModificationAllowedError = () =>\n new DOMException('The file is locked and cannot be modified.', 'NoModificationAllowedError');\n"]}

@@ -6,3 +6,3 @@ {

},
"version": "4.66.0",
"version": "4.66.1",
"description": "File System Access API implementation backed by core filesystem primitives",

@@ -84,7 +84,7 @@ "author": {

"dependencies": {
"@jsonjoy.com/fs-core": "4.66.0",
"@jsonjoy.com/fs-node-builtins": "4.66.0",
"@jsonjoy.com/fs-node-utils": "4.66.0",
"@jsonjoy.com/fs-core": "4.66.1",
"@jsonjoy.com/fs-node-builtins": "4.66.1",
"@jsonjoy.com/fs-node-utils": "4.66.1",
"thingies": "^2.5.0"
}
}