@zenfs/dom 0.2.17 → 1.0.0

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/dist/utils.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import { ErrnoError } from '@zenfs/core';
2
- /**
3
- * @internal
4
- */
2
+ /** @internal */
5
3
  export type ConvertException = ErrnoError | DOMException | Error;
6
4
  /**
7
5
  * Handles converting errors, then rethrowing them
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zenfs/dom",
3
- "version": "0.2.17",
3
+ "version": "1.0.0",
4
4
  "description": "DOM backends for ZenFS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
8
8
  "homepage": "https://github.com/zen-fs/dom",
9
- "author": "James Prevett <jp@jamespre.dev>",
9
+ "author": "James Prevett <jp@jamespre.dev> (https://jamespre.dev)",
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
@@ -31,16 +31,14 @@
31
31
  "scripts": {
32
32
  "format": "prettier --write .",
33
33
  "format:check": "prettier --check .",
34
- "lint": "tsc -p tsconfig.json --noEmit && eslint src",
35
- "build": "npx build --package=@zenfs/core --globalName ZenFS_DOM --entry src/index.ts",
34
+ "lint": "eslint src",
35
+ "build": "tsc -p tsconfig.json",
36
36
  "build:docs": "typedoc --out docs --name 'ZenFS DOM' src/index.ts",
37
37
  "test": "echo No tests yet",
38
38
  "prepublishOnly": "npm run build"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@eslint/js": "^9.12.0",
42
- "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
43
- "esbuild": "^0.21.0",
44
42
  "eslint": "^9.12.0",
45
43
  "globals": "^15.10.0",
46
44
  "prettier": "^3.2.5",
@@ -49,7 +47,7 @@
49
47
  "typescript-eslint": "^8.8.1"
50
48
  },
51
49
  "peerDependencies": {
52
- "@zenfs/core": "^1.0.4"
50
+ "@zenfs/core": "^1.0.5"
53
51
  },
54
52
  "keywords": [
55
53
  "filesystem",
package/readme.md CHANGED
@@ -18,7 +18,7 @@ For more information, see the [API documentation](https://zen-fs.github.io/dom).
18
18
  > [!NOTE]
19
19
  > The examples are written in ESM.
20
20
  > For CJS, you can `require` the package.
21
- > For a browser environment without support for `type=module` in `script` tags, you can add a `script` tag to your HTML pointing to the `browser.min.js` and use the global `ZenFS_DOM` object.
21
+ > If using a browser environment, you can use a `<script>` with `type=module` (you may need to use import maps)
22
22
 
23
23
  ```js
24
24
  import { configure, fs } from '@zenfs/core';
package/src/utils.ts CHANGED
@@ -54,9 +54,7 @@ function errnoForDOMException(ex: DOMException): keyof typeof Errno {
54
54
  }
55
55
  }
56
56
 
57
- /**
58
- * @internal
59
- */
57
+ /** @internal */
60
58
  export type ConvertException = ErrnoError | DOMException | Error;
61
59
 
62
60
  /**
@@ -1,2 +0,0 @@
1
- "use strict";var ZenFS_DOM=(()=>{var p=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var a=(t,o)=>p(t,"name",{value:o,configurable:!0});var $=(t,o)=>{for(var e in o)p(t,e,{get:o[e],enumerable:!0})},j=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of U(o))!z.call(t,n)&&n!==e&&p(t,n,{get:()=>o[n],enumerable:!(r=L(o,n))||r.enumerable});return t};var Y=t=>j(p({},"__esModule",{value:!0}),t);var re={};$(re,{IndexedDB:()=>ee,IndexedDBStore:()=>F,IndexedDBTransaction:()=>w,WebAccess:()=>Z,WebAccessFS:()=>I,WebStorage:()=>M,WebStorageStore:()=>_});var oe=ZenFS,{Async:x,AsyncTransaction:R,BigIntStats:ie,BigIntStatsFs:se,Dir:ae,Dirent:ce,Errno:d,ErrnoError:l,Fetch:le,FetchFS:de,File:fe,FileSystem:A,InMemory:g,InMemoryStore:ue,Index:me,IndexFS:Se,Inode:ye,MutexLock:pe,Mutexed:xe,NoSyncFile:ge,Overlay:he,OverlayFS:be,Port:Ee,PortFS:Ie,PortFile:we,PreloadFile:H,ReadStream:Fe,Readonly:_e,SimpleAsyncStore:De,SimpleTransaction:N,Stats:h,StatsCommon:Oe,StatsFs:ve,StoreFS:b,Sync:Te,SyncTransaction:We,Transaction:ke,UnmutexedOverlayFS:Re,WriteStream:Ae,ZenFsType:He,_InMemory:Ne,_Port:Be,__MutexedFS:Ce,_toUnixTimestamp:Pe,access:Me,accessSync:Le,appendFile:Ue,appendFileSync:ze,attachFS:$e,checkOptions:je,chmod:Ye,chmodSync:Xe,chown:Ke,chownSync:qe,close:Ge,closeSync:Ve,configure:Ze,configureSingle:Qe,constants:Je,copyFile:et,copyFileSync:tt,cp:rt,cpSync:nt,createReadStream:ot,createWriteStream:it,credentials:st,decode:B,decodeDirListing:at,detachFS:ct,encode:C,encodeDirListing:lt,errorMessages:dt,exists:ft,existsSync:ut,fchmod:mt,fchmodSync:St,fchown:yt,fchownSync:pt,fdatasync:xt,fdatasyncSync:gt,flagToMode:ht,flagToNumber:bt,flagToString:Et,fs:It,fstat:wt,fstatSync:Ft,fsync:_t,fsyncSync:Dt,ftruncate:Ot,ftruncateSync:vt,futimes:Tt,futimesSync:Wt,handleRequest:kt,isAppendable:Rt,isBackend:At,isBackendConfig:Ht,isExclusive:Nt,isReadable:Bt,isStatsEqual:Ct,isSynchronous:Pt,isTruncating:Mt,isWriteable:Lt,lchmod:Ut,lchmodSync:zt,lchown:$t,lchownSync:jt,levenshtein:Yt,link:Xt,linkSync:Kt,lopenSync:qt,lstat:Gt,lstatSync:Vt,lutimes:Zt,lutimesSync:Qt,mkdir:Jt,mkdirSync:er,mkdirpSync:tr,mkdtemp:rr,mkdtempSync:nr,mount:or,mountObject:ir,mounts:sr,normalizeMode:ar,normalizeOptions:cr,normalizePath:lr,normalizeTime:dr,open:fr,openAsBlob:ur,openSync:mr,opendir:Sr,opendirSync:yr,parseFlag:pr,promises:xr,randomIno:gr,read:hr,readFile:br,readFileSync:Er,readSync:Ir,readdir:wr,readdirSync:Fr,readlink:_r,readlinkSync:Dr,readv:Or,readvSync:vr,realpath:Tr,realpathSync:Wr,rename:kr,renameSync:Rr,resolveMountConfig:Ar,resolveRemoteMount:Hr,rm:Nr,rmSync:Br,rmdir:Cr,rmdirSync:Pr,rootCredentials:Mr,rootIno:Lr,setImmediate:Ur,size_max:zr,stat:$r,statSync:jr,statfs:Yr,statfsSync:Xr,symlink:Kr,symlinkSync:qr,truncate:Gr,truncateSync:Vr,umount:Zr,unlink:Qr,unlinkSync:Jr,unwatchFile:en,utimes:tn,utimesSync:rn,version:nn,watch:on,watchFile:sn,write:an,writeFile:cn,writeFileSync:ln,writeSync:dn,writev:fn,writevSync:un}=ZenFS;function X(t,o){let e="",r=0,n=-1,i=0,c="\0";for(let s=0;s<=t.length;++s){if(s<t.length)c=t[s];else{if(c=="/")break;c="/"}if(c=="/"){if(!(n===s-1||i===1))if(i===2){if(e.length<2||r!==2||e.at(-1)!=="."||e.at(-2)!=="."){if(e.length>2){let u=e.lastIndexOf("/");u===-1?(e="",r=0):(e=e.slice(0,u),r=e.length-1-e.lastIndexOf("/")),n=s,i=0;continue}else if(e.length!==0){e="",r=0,n=s,i=0;continue}}o&&(e+=e.length>0?"/..":"..",r=2)}else e.length>0?e+="/"+t.slice(n+1,s):e=t.slice(n+1,s),r=s-n-1;n=s,i=0}else c==="."&&i!==-1?++i:i=-1}return e}a(X,"normalizeString");function K(t){if(!t.length)return".";let o=t.startsWith("/"),e=t.endsWith("/");return t=X(t,!o),t.length?(e&&(t+="/"),o?`/${t}`:t):o?"/":e?"./":"."}a(K,"normalize");function E(...t){if(!t.length)return".";let o=t.join("/");return o?.length?K(o):"."}a(E,"join");function S(t){if(t.length===0)return".";let o=t[0]==="/",e=-1,r=!0;for(let n=t.length-1;n>=1;--n)if(t[n]==="/"){if(!r){e=n;break}}else r=!1;return e===-1?o?"/":".":o&&e===1?"//":t.slice(0,e)}a(S,"dirname");function y(t,o){let e=0,r=-1,n=!0;if(o!==void 0&&o.length>0&&o.length<=t.length){if(o===t)return"";let i=o.length-1,c=-1;for(let s=t.length-1;s>=0;--s)if(t[s]==="/"){if(!n){e=s+1;break}}else c===-1&&(n=!1,c=s+1),i>=0&&(t[s]===o[i]?--i===-1&&(r=s):(i=-1,r=c));return e===r?r=c:r===-1&&(r=t.length),t.slice(e,r)}for(let i=t.length-1;i>=0;--i)if(t[i]==="/"){if(!n){e=i+1;break}}else r===-1&&(n=!1,r=i+1);return r===-1?"":t.slice(e,r)}a(y,"basename");function q(t){switch(t.name){case"IndexSizeError":case"HierarchyRequestError":case"InvalidCharacterError":case"InvalidStateError":case"SyntaxError":case"NamespaceError":case"TypeMismatchError":case"ConstraintError":case"VersionError":case"URLMismatchError":case"InvalidNodeTypeError":return"EINVAL";case"WrongDocumentError":return"EXDEV";case"NoModificationAllowedError":case"InvalidModificationError":case"InvalidAccessError":case"SecurityError":case"NotAllowedError":return"EACCES";case"NotFoundError":return"ENOENT";case"NotSupportedError":return"ENOTSUP";case"InUseAttributeError":return"EBUSY";case"NetworkError":return"ENETDOWN";case"AbortError":return"EINTR";case"QuotaExceededError":return"ENOSPC";case"TimeoutError":return"ETIMEDOUT";case"ReadOnlyError":return"EROFS";case"DataCloneError":case"EncodingError":case"NotReadableError":case"DataError":case"TransactionInactiveError":case"OperationError":case"UnknownError":default:return"EIO"}}a(q,"errnoForDOMException");function f(t,o,e){if(t instanceof l)return t;let r=t instanceof DOMException?d[q(t)]:d.EIO,n=new l(r,t.message,o,e);return n.stack=t.stack,n.cause=t.cause,n}a(f,"convertException");var D=class D extends x(A){constructor(e){super();this._handles=new Map;this._sync=g.create({name:"accessfs-cache"});this._handles.set("/",e)}metadata(){return{...super.metadata(),name:"WebAccess",noResizableBuffers:!0}}async sync(e,r,n){let i=await this.stat(e);n.mtime!==i.mtime&&await this.writeFile(e,r)}async rename(e,r){try{let n=await this.getHandle(e);if(n instanceof FileSystemDirectoryHandle){let W=await this.readdir(e);if(await this.mkdir(r),W.length==0)await this.unlink(e);else for(let k of W)await this.rename(E(e,k),E(r,k)),await this.unlink(e)}if(!(n instanceof FileSystemFileHandle))return;let i=await n.getFile(),c=await this.getHandle(S(r));if(!(c instanceof FileSystemDirectoryHandle))return;let u=await(await c.getFileHandle(y(r),{create:!0})).createWritable();await u.write(await i.arrayBuffer()),await u.close(),await this.unlink(e)}catch(n){throw f(n,e,"rename")}}async writeFile(e,r){if(r.buffer.resizable)throw new l(d.EINVAL,"Resizable buffers can not be written",e,"write");let n=await this.getHandle(S(e));if(!(n instanceof FileSystemDirectoryHandle))return;let c=await(await n.getFileHandle(y(e),{create:!0})).createWritable();await c.write(r),await c.close()}async createFile(e,r){return await this.writeFile(e,new Uint8Array),this.openFile(e,r)}async stat(e){let r=await this.getHandle(e);if(!r)throw l.With("ENOENT",e,"stat");if(r instanceof FileSystemDirectoryHandle)return new h({mode:16895,size:4096});if(r instanceof FileSystemFileHandle){let{lastModified:n,size:i}=await r.getFile();return new h({mode:33279,size:i,mtimeMs:n})}throw new l(d.EBADE,"Handle is not a directory or file",e,"stat")}async openFile(e,r){let n=await this.getHandle(e);if(!(n instanceof FileSystemFileHandle))throw l.With("EISDIR",e,"openFile");try{let i=await n.getFile(),c=new Uint8Array(await i.arrayBuffer()),s=new h({mode:33279,size:i.size,mtimeMs:i.lastModified});return new H(this,e,r,s,c)}catch(i){throw f(i,e,"openFile")}}async unlink(e){let r=await this.getHandle(S(e));if(r instanceof FileSystemDirectoryHandle)try{await r.removeEntry(y(e),{recursive:!0})}catch(n){throw f(n,e,"unlink")}}async link(e){throw l.With("ENOSYS",e,"WebAccessFS.link")}async rmdir(e){return this.unlink(e)}async mkdir(e){if(await this.getHandle(e))throw l.With("EEXIST",e,"mkdir");let n=await this.getHandle(S(e));if(!(n instanceof FileSystemDirectoryHandle))throw l.With("ENOTDIR",e,"mkdir");await n.getDirectoryHandle(y(e),{create:!0})}async readdir(e){let r=await this.getHandle(e);if(!(r instanceof FileSystemDirectoryHandle))throw l.With("ENOTDIR",e,"readdir");return Array.from(r.keys())}async getHandle(e){if(this._handles.has(e))return this._handles.get(e);let r="/";for(let n of e.split("/").slice(1)){let i=this._handles.get(r);if(!(i instanceof FileSystemDirectoryHandle))throw l.With("ENOTDIR",r,"getHandle");r=E(r,n);try{let c=await i.getDirectoryHandle(n);this._handles.set(r,c)}catch(c){let s=c;if(s.name=="TypeMismatchError")try{let u=await i.getFileHandle(n);this._handles.set(r,u)}catch(u){f(u,r,"getHandle")}if(s.name==="TypeError")throw new l(d.ENOENT,s.message,r,"getHandle");f(s,r,"getHandle")}}return this._handles.get(e)}};a(D,"WebAccessFS");var I=D,V={name:"WebAccess",options:{handle:{type:"object",required:!0,description:"The directory handle to use for the root"}},isAvailable:a(function(){return typeof FileSystemHandle=="function"},"isAvailable"),create:a(function(t){return new I(t.handle)},"create")},Z=V;function m(t){return new Promise((o,e)=>{t.onsuccess=()=>o(t.result),t.onerror=r=>{r.preventDefault(),e(f(t.error))}})}a(m,"wrap");var O=class O extends R{constructor(e,r){super(r);this.tx=e;this.store=r;this._idb=e.objectStore(r.name)}get(e){return m(this._idb.get(e.toString()))}async set(e,r){await m(this._idb.put(r,e.toString()))}remove(e){return m(this._idb.delete(e.toString()))}async commit(){if(this.done)return;let{promise:e,resolve:r,reject:n}=Promise.withResolvers();return this.done=!0,this.tx.oncomplete=()=>r(),this.tx.onerror=()=>n(f(this.tx.error)),this.tx.commit(),e}async abort(){if(this.done)return;this.done=!0;let{promise:e,resolve:r,reject:n}=Promise.withResolvers();return this.tx.onabort=()=>r(),this.tx.onerror=()=>n(f(this.tx.error)),this.tx.abort(),e}};a(O,"IndexedDBTransaction");var w=O;async function Q(t,o=globalThis.indexedDB){let e=o.open(t);return e.onupgradeneeded=()=>{let n=e.result;n.objectStoreNames.contains(t)&&n.deleteObjectStore(t),n.createObjectStore(t)},await m(e)}a(Q,"createDB");var v=class v{constructor(o){this.db=o}sync(){throw new Error("Method not implemented.")}get name(){return this.db.name}clear(){return m(this.db.transaction(this.name,"readwrite").objectStore(this.name).clear())}clearSync(){throw l.With("ENOSYS",void 0,"IndexedDBStore.clearSync")}transaction(){let o=this.db.transaction(this.name,"readwrite");return new w(o,this)}};a(v,"IndexedDBStore");var F=v,J={name:"IndexedDB",options:{storeName:{type:"string",required:!1,description:"The name of this file system. You can have multiple IndexedDB file systems operating at once, but each must have a different name."},idbFactory:{type:"object",required:!1,description:"The IDBFactory to use. Defaults to globalThis.indexedDB."}},isAvailable:a(async function(t=globalThis.indexedDB){try{if(!(t instanceof IDBFactory))return!1;let o=t.open("__zenfs_test");return await m(o),t.deleteDatabase("__zenfs_test"),!0}catch{return t.deleteDatabase("__zenfs_test"),!1}},"isAvailable"),create:a(async function(t){let o=await Q(t.storeName||"zenfs",t.idbFactory),e=new F(o),r=new(x(b))(e);return t?.disableAsyncCache||(r._sync=g.create({name:"idb-cache"})),r},"create")},ee=J;var T=class T{constructor(o){this._storage=o}get name(){return M.name}clear(){this._storage.clear()}clearSync(){this._storage.clear()}async sync(){}transaction(){return new N(this)}get(o){let e=this._storage.getItem(o.toString());if(typeof e=="string")return C(e)}set(o,e){try{this._storage.setItem(o.toString(),B(e))}catch{throw new l(d.ENOSPC,"Storage is full.")}}delete(o){try{this._storage.removeItem(o.toString())}catch(e){throw new l(d.EIO,"Unable to delete key "+o+": "+e)}}};a(T,"WebStorageStore");var _=T,te={name:"WebStorage",options:{storage:{type:"object",required:!1,description:"The Storage to use. Defaults to globalThis.localStorage."}},isAvailable:a(function(t=globalThis.localStorage){return t instanceof globalThis.Storage},"isAvailable"),create:a(function({storage:t=globalThis.localStorage}){return new b(new _(t))},"create")},M=te;return Y(re);})();
2
- //# sourceMappingURL=browser.min.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts", "global-externals:@zenfs/core", "../node_modules/@zenfs/core/dist/emulation/path.js", "../src/utils.ts", "../src/access.ts", "../src/IndexedDB.ts", "../src/Storage.ts"],
4
- "sourcesContent": ["export * from './access.js';\nexport * from './IndexedDB.js';\nexport * from './Storage.js';\n", "export default ZenFS;\nconst { Async, AsyncTransaction, BigIntStats, BigIntStatsFs, Dir, Dirent, Errno, ErrnoError, Fetch, FetchFS, File, FileSystem, InMemory, InMemoryStore, Index, IndexFS, Inode, MutexLock, Mutexed, NoSyncFile, Overlay, OverlayFS, Port, PortFS, PortFile, PreloadFile, ReadStream, Readonly, SimpleAsyncStore, SimpleTransaction, Stats, StatsCommon, StatsFs, StoreFS, Sync, SyncTransaction, Transaction, UnmutexedOverlayFS, WriteStream, ZenFsType, _InMemory, _Port, __MutexedFS, _toUnixTimestamp, access, accessSync, appendFile, appendFileSync, attachFS, checkOptions, chmod, chmodSync, chown, chownSync, close, closeSync, configure, configureSingle, constants, copyFile, copyFileSync, cp, cpSync, createReadStream, createWriteStream, credentials, decode, decodeDirListing, detachFS, encode, encodeDirListing, errorMessages, exists, existsSync, fchmod, fchmodSync, fchown, fchownSync, fdatasync, fdatasyncSync, flagToMode, flagToNumber, flagToString, fs, fstat, fstatSync, fsync, fsyncSync, ftruncate, ftruncateSync, futimes, futimesSync, handleRequest, isAppendable, isBackend, isBackendConfig, isExclusive, isReadable, isStatsEqual, isSynchronous, isTruncating, isWriteable, lchmod, lchmodSync, lchown, lchownSync, levenshtein, link, linkSync, lopenSync, lstat, lstatSync, lutimes, lutimesSync, mkdir, mkdirSync, mkdirpSync, mkdtemp, mkdtempSync, mount, mountObject, mounts, normalizeMode, normalizeOptions, normalizePath, normalizeTime, open, openAsBlob, openSync, opendir, opendirSync, parseFlag, promises, randomIno, read, readFile, readFileSync, readSync, readdir, readdirSync, readlink, readlinkSync, readv, readvSync, realpath, realpathSync, rename, renameSync, resolveMountConfig, resolveRemoteMount, rm, rmSync, rmdir, rmdirSync, rootCredentials, rootIno, setImmediate, size_max, stat, statSync, statfs, statfsSync, symlink, symlinkSync, truncate, truncateSync, umount, unlink, unlinkSync, unwatchFile, utimes, utimesSync, version, watch, watchFile, write, writeFile, writeFileSync, writeSync, writev, writevSync } = ZenFS;\nexport { Async, AsyncTransaction, BigIntStats, BigIntStatsFs, Dir, Dirent, Errno, ErrnoError, Fetch, FetchFS, File, FileSystem, InMemory, InMemoryStore, Index, IndexFS, Inode, MutexLock, Mutexed, NoSyncFile, Overlay, OverlayFS, Port, PortFS, PortFile, PreloadFile, ReadStream, Readonly, SimpleAsyncStore, SimpleTransaction, Stats, StatsCommon, StatsFs, StoreFS, Sync, SyncTransaction, Transaction, UnmutexedOverlayFS, WriteStream, ZenFsType, _InMemory, _Port, __MutexedFS, _toUnixTimestamp, access, accessSync, appendFile, appendFileSync, attachFS, checkOptions, chmod, chmodSync, chown, chownSync, close, closeSync, configure, configureSingle, constants, copyFile, copyFileSync, cp, cpSync, createReadStream, createWriteStream, credentials, decode, decodeDirListing, detachFS, encode, encodeDirListing, errorMessages, exists, existsSync, fchmod, fchmodSync, fchown, fchownSync, fdatasync, fdatasyncSync, flagToMode, flagToNumber, flagToString, fs, fstat, fstatSync, fsync, fsyncSync, ftruncate, ftruncateSync, futimes, futimesSync, handleRequest, isAppendable, isBackend, isBackendConfig, isExclusive, isReadable, isStatsEqual, isSynchronous, isTruncating, isWriteable, lchmod, lchmodSync, lchown, lchownSync, levenshtein, link, linkSync, lopenSync, lstat, lstatSync, lutimes, lutimesSync, mkdir, mkdirSync, mkdirpSync, mkdtemp, mkdtempSync, mount, mountObject, mounts, normalizeMode, normalizeOptions, normalizePath, normalizeTime, open, openAsBlob, openSync, opendir, opendirSync, parseFlag, promises, randomIno, read, readFile, readFileSync, readSync, readdir, readdirSync, readlink, readlinkSync, readv, readvSync, realpath, realpathSync, rename, renameSync, resolveMountConfig, resolveRemoteMount, rm, rmSync, rmdir, rmdirSync, rootCredentials, rootIno, setImmediate, size_max, stat, statSync, statfs, statfsSync, symlink, symlinkSync, truncate, truncateSync, umount, unlink, unlinkSync, unwatchFile, utimes, utimesSync, version, watch, watchFile, write, writeFile, writeFileSync, writeSync, writev, writevSync };", "/*\nCopyright Joyent, Inc. and other Node contributors.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the\nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\nNO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nexport let cwd = '/';\nexport function cd(path) {\n cwd = resolve(cwd, path);\n}\nexport const sep = '/';\nfunction validateObject(str, name) {\n if (typeof str != 'object') {\n throw new TypeError(`\"${name}\" is not an object`);\n }\n}\n// Resolves . and .. elements in a path with directory names\nexport function normalizeString(path, allowAboveRoot) {\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char = '\\x00';\n for (let i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n char = path[i];\n }\n else if (char == '/') {\n break;\n }\n else {\n char = '/';\n }\n if (char == '/') {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n }\n else if (dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.at(-1) !== '.' || res.at(-2) !== '.') {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n }\n else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n else if (res.length !== 0) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? '/..' : '..';\n lastSegmentLength = 2;\n }\n }\n else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (char === '.' && dots !== -1) {\n ++dots;\n }\n else {\n dots = -1;\n }\n }\n return res;\n}\nexport function formatExt(ext) {\n return ext ? `${ext[0] === '.' ? '' : '.'}${ext}` : '';\n}\nexport function resolve(...parts) {\n let resolved = '';\n for (const part of [...parts.reverse(), cwd]) {\n if (!part.length) {\n continue;\n }\n resolved = `${part}/${resolved}`;\n if (part.startsWith('/')) {\n break;\n }\n }\n const absolute = resolved.startsWith('/');\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when cwd fails)\n // Normalize the path\n resolved = normalizeString(resolved, !absolute);\n if (absolute) {\n return `/${resolved}`;\n }\n return resolved.length ? resolved : '/';\n}\nexport function normalize(path) {\n if (!path.length)\n return '.';\n const isAbsolute = path.startsWith('/');\n const trailingSeparator = path.endsWith('/');\n // Normalize the path\n path = normalizeString(path, !isAbsolute);\n if (!path.length) {\n if (isAbsolute)\n return '/';\n return trailingSeparator ? './' : '.';\n }\n if (trailingSeparator)\n path += '/';\n return isAbsolute ? `/${path}` : path;\n}\nexport function isAbsolute(path) {\n return path.startsWith('/');\n}\nexport function join(...parts) {\n if (!parts.length)\n return '.';\n const joined = parts.join('/');\n if (!joined?.length)\n return '.';\n return normalize(joined);\n}\nexport function relative(from, to) {\n if (from === to)\n return '';\n // Trim leading forward slashes.\n from = resolve(from);\n to = resolve(to);\n if (from === to)\n return '';\n const fromStart = 1;\n const fromEnd = from.length;\n const fromLen = fromEnd - fromStart;\n const toStart = 1;\n const toLen = to.length - toStart;\n // Compare paths to find the longest common path from root\n const length = fromLen < toLen ? fromLen : toLen;\n let lastCommonSep = -1;\n let i = 0;\n for (; i < length; i++) {\n const fromCode = from[fromStart + i];\n if (fromCode !== to[toStart + i])\n break;\n else if (fromCode === '/')\n lastCommonSep = i;\n }\n if (i === length) {\n if (toLen > length) {\n if (to[toStart + i] === '/') {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n }\n if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n }\n else if (fromLen > length) {\n if (from[fromStart + i] === '/') {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n }\n else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo/bar'; to='/'\n lastCommonSep = 0;\n }\n }\n }\n let out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`.\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from[i] === '/') {\n out += out.length === 0 ? '..' : '/..';\n }\n }\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts.\n return `${out}${to.slice(toStart + lastCommonSep)}`;\n}\nexport function dirname(path) {\n if (path.length === 0)\n return '.';\n const hasRoot = path[0] === '/';\n let end = -1;\n let matchedSlash = true;\n for (let i = path.length - 1; i >= 1; --i) {\n if (path[i] === '/') {\n if (!matchedSlash) {\n end = i;\n break;\n }\n }\n else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n if (end === -1)\n return hasRoot ? '/' : '.';\n if (hasRoot && end === 1)\n return '//';\n return path.slice(0, end);\n}\nexport function basename(path, suffix) {\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n if (suffix !== undefined && suffix.length > 0 && suffix.length <= path.length) {\n if (suffix === path)\n return '';\n let extIdx = suffix.length - 1;\n let firstNonSlashEnd = -1;\n for (let i = path.length - 1; i >= 0; --i) {\n if (path[i] === '/') {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (path[i] === suffix[extIdx]) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n if (start === end)\n end = firstNonSlashEnd;\n else if (end === -1)\n end = path.length;\n return path.slice(start, end);\n }\n for (let i = path.length - 1; i >= 0; --i) {\n if (path[i] === '/') {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n if (end === -1)\n return '';\n return path.slice(start, end);\n}\nexport function extname(path) {\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n for (let i = path.length - 1; i >= 0; --i) {\n if (path[i] === '/') {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (path[i] === '.') {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {\n return '';\n }\n return path.slice(startDot, end);\n}\nexport function format(pathObject) {\n validateObject(pathObject, 'pathObject');\n const dir = pathObject.dir || pathObject.root;\n const base = pathObject.base || `${pathObject.name || ''}${formatExt(pathObject.ext)}`;\n if (!dir) {\n return base;\n }\n return dir === pathObject.root ? `${dir}${base}` : `${dir}/${base}`;\n}\nexport function parse(path) {\n const isAbsolute = path.startsWith('/');\n const ret = { root: isAbsolute ? '/' : '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0)\n return ret;\n const start = isAbsolute ? 1 : 0;\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n // Get non-dir info\n for (; i >= start; --i) {\n if (path[i] === '/') {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (path[i] === '.') {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (end !== -1) {\n const start = startPart === 0 && isAbsolute ? 1 : startPart;\n if (startDot === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {\n ret.base = ret.name = path.slice(start, end);\n }\n else {\n ret.name = path.slice(start, startDot);\n ret.base = path.slice(start, end);\n ret.ext = path.slice(startDot, end);\n }\n }\n if (startPart > 0)\n ret.dir = path.slice(0, startPart - 1);\n else if (isAbsolute)\n ret.dir = '/';\n return ret;\n}\n", "import { ErrnoError, Errno } from '@zenfs/core';\n\n/**\n * Converts a DOMException into an Errno\n * @see https://developer.mozilla.org/Web/API/DOMException\n */\nfunction errnoForDOMException(ex: DOMException): keyof typeof Errno {\n\tswitch (ex.name) {\n\t\tcase 'IndexSizeError':\n\t\tcase 'HierarchyRequestError':\n\t\tcase 'InvalidCharacterError':\n\t\tcase 'InvalidStateError':\n\t\tcase 'SyntaxError':\n\t\tcase 'NamespaceError':\n\t\tcase 'TypeMismatchError':\n\t\tcase 'ConstraintError':\n\t\tcase 'VersionError':\n\t\tcase 'URLMismatchError':\n\t\tcase 'InvalidNodeTypeError':\n\t\t\treturn 'EINVAL';\n\t\tcase 'WrongDocumentError':\n\t\t\treturn 'EXDEV';\n\t\tcase 'NoModificationAllowedError':\n\t\tcase 'InvalidModificationError':\n\t\tcase 'InvalidAccessError':\n\t\tcase 'SecurityError':\n\t\tcase 'NotAllowedError':\n\t\t\treturn 'EACCES';\n\t\tcase 'NotFoundError':\n\t\t\treturn 'ENOENT';\n\t\tcase 'NotSupportedError':\n\t\t\treturn 'ENOTSUP';\n\t\tcase 'InUseAttributeError':\n\t\t\treturn 'EBUSY';\n\t\tcase 'NetworkError':\n\t\t\treturn 'ENETDOWN';\n\t\tcase 'AbortError':\n\t\t\treturn 'EINTR';\n\t\tcase 'QuotaExceededError':\n\t\t\treturn 'ENOSPC';\n\t\tcase 'TimeoutError':\n\t\t\treturn 'ETIMEDOUT';\n\t\tcase 'ReadOnlyError':\n\t\t\treturn 'EROFS';\n\t\tcase 'DataCloneError':\n\t\tcase 'EncodingError':\n\t\tcase 'NotReadableError':\n\t\tcase 'DataError':\n\t\tcase 'TransactionInactiveError':\n\t\tcase 'OperationError':\n\t\tcase 'UnknownError':\n\t\tdefault:\n\t\t\treturn 'EIO';\n\t}\n}\n\n/**\n * @internal\n */\nexport type ConvertException = ErrnoError | DOMException | Error;\n\n/**\n * Handles converting errors, then rethrowing them\n * @internal\n */\nexport function convertException(ex: ConvertException, path?: string, syscall?: string): ErrnoError {\n\tif (ex instanceof ErrnoError) {\n\t\treturn ex;\n\t}\n\n\tconst code = ex instanceof DOMException ? Errno[errnoForDOMException(ex)] : Errno.EIO;\n\tconst error = new ErrnoError(code, ex.message, path, syscall);\n\terror.stack = ex.stack!;\n\terror.cause = ex.cause;\n\treturn error;\n}\n", "import type { Backend, FileSystemMetadata } from '@zenfs/core';\nimport { Async, Errno, ErrnoError, FileSystem, InMemory, PreloadFile, Stats } from '@zenfs/core';\nimport { S_IFDIR, S_IFREG } from '@zenfs/core/emulation/constants.js';\nimport { basename, dirname, join } from '@zenfs/core/emulation/path.js';\nimport { convertException, type ConvertException } from './utils.js';\n\ndeclare global {\n\tinterface FileSystemDirectoryHandle {\n\t\t[Symbol.iterator](): IterableIterator<[string, FileSystemHandle]>;\n\t\tentries(): IterableIterator<[string, FileSystemHandle]>;\n\t\tkeys(): IterableIterator<string>;\n\t\tvalues(): IterableIterator<FileSystemHandle>;\n\t}\n}\n\nexport interface WebAccessOptions {\n\thandle: FileSystemDirectoryHandle;\n}\n\nexport class WebAccessFS extends Async(FileSystem) {\n\tprivate _handles: Map<string, FileSystemHandle> = new Map();\n\n\t/**\n\t * @hidden\n\t */\n\t_sync: FileSystem = InMemory.create({ name: 'accessfs-cache' });\n\n\tpublic constructor(handle: FileSystemDirectoryHandle) {\n\t\tsuper();\n\t\tthis._handles.set('/', handle);\n\t}\n\n\tpublic metadata(): FileSystemMetadata {\n\t\treturn {\n\t\t\t...super.metadata(),\n\t\t\tname: 'WebAccess',\n\t\t\tnoResizableBuffers: true,\n\t\t};\n\t}\n\n\tpublic async sync(path: string, data: Uint8Array, stats: Stats): Promise<void> {\n\t\tconst currentStats = await this.stat(path);\n\t\tif (stats.mtime !== currentStats.mtime) {\n\t\t\tawait this.writeFile(path, data);\n\t\t}\n\t}\n\n\tpublic async rename(oldPath: string, newPath: string): Promise<void> {\n\t\ttry {\n\t\t\tconst handle = await this.getHandle(oldPath);\n\t\t\tif (handle instanceof FileSystemDirectoryHandle) {\n\t\t\t\tconst files = await this.readdir(oldPath);\n\n\t\t\t\tawait this.mkdir(newPath);\n\t\t\t\tif (files.length == 0) {\n\t\t\t\t\tawait this.unlink(oldPath);\n\t\t\t\t} else {\n\t\t\t\t\tfor (const file of files) {\n\t\t\t\t\t\tawait this.rename(join(oldPath, file), join(newPath, file));\n\t\t\t\t\t\tawait this.unlink(oldPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!(handle instanceof FileSystemFileHandle)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst oldFile = await handle.getFile(),\n\t\t\t\tdestFolder = await this.getHandle(dirname(newPath));\n\t\t\tif (!(destFolder instanceof FileSystemDirectoryHandle)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst newFile = await destFolder.getFileHandle(basename(newPath), { create: true });\n\t\t\tconst writable = await newFile.createWritable();\n\t\t\tawait writable.write(await oldFile.arrayBuffer());\n\n\t\t\tawait writable.close();\n\t\t\tawait this.unlink(oldPath);\n\t\t} catch (ex) {\n\t\t\tthrow convertException(ex as ConvertException, oldPath, 'rename');\n\t\t}\n\t}\n\n\tpublic async writeFile(path: string, data: Uint8Array): Promise<void> {\n\t\tif (data.buffer.resizable) {\n\t\t\tthrow new ErrnoError(Errno.EINVAL, 'Resizable buffers can not be written', path, 'write');\n\t\t}\n\n\t\tconst handle = await this.getHandle(dirname(path));\n\t\tif (!(handle instanceof FileSystemDirectoryHandle)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst file = await handle.getFileHandle(basename(path), { create: true });\n\t\tconst writable = await file.createWritable();\n\t\tawait writable.write(data);\n\t\tawait writable.close();\n\t}\n\n\tpublic async createFile(path: string, flag: string): Promise<PreloadFile<this>> {\n\t\tawait this.writeFile(path, new Uint8Array());\n\t\treturn this.openFile(path, flag);\n\t}\n\n\tpublic async stat(path: string): Promise<Stats> {\n\t\tconst handle = await this.getHandle(path);\n\t\tif (!handle) {\n\t\t\tthrow ErrnoError.With('ENOENT', path, 'stat');\n\t\t}\n\t\tif (handle instanceof FileSystemDirectoryHandle) {\n\t\t\treturn new Stats({ mode: 0o777 | S_IFDIR, size: 4096 });\n\t\t}\n\t\tif (handle instanceof FileSystemFileHandle) {\n\t\t\tconst { lastModified, size } = await handle.getFile();\n\t\t\treturn new Stats({ mode: 0o777 | S_IFREG, size, mtimeMs: lastModified });\n\t\t}\n\t\tthrow new ErrnoError(Errno.EBADE, 'Handle is not a directory or file', path, 'stat');\n\t}\n\n\tpublic async openFile(path: string, flag: string): Promise<PreloadFile<this>> {\n\t\tconst handle = await this.getHandle(path);\n\t\tif (!(handle instanceof FileSystemFileHandle)) {\n\t\t\tthrow ErrnoError.With('EISDIR', path, 'openFile');\n\t\t}\n\t\ttry {\n\t\t\tconst file = await handle.getFile();\n\t\t\tconst data = new Uint8Array(await file.arrayBuffer());\n\t\t\tconst stats = new Stats({ mode: 0o777 | S_IFREG, size: file.size, mtimeMs: file.lastModified });\n\t\t\treturn new PreloadFile(this, path, flag, stats, data);\n\t\t} catch (ex) {\n\t\t\tthrow convertException(ex as ConvertException, path, 'openFile');\n\t\t}\n\t}\n\n\tpublic async unlink(path: string): Promise<void> {\n\t\tconst handle = await this.getHandle(dirname(path));\n\t\tif (handle instanceof FileSystemDirectoryHandle) {\n\t\t\ttry {\n\t\t\t\tawait handle.removeEntry(basename(path), { recursive: true });\n\t\t\t} catch (ex) {\n\t\t\t\tthrow convertException(ex as ConvertException, path, 'unlink');\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async link(srcpath: string): Promise<void> {\n\t\tthrow ErrnoError.With('ENOSYS', srcpath, 'WebAccessFS.link');\n\t}\n\n\tpublic async rmdir(path: string): Promise<void> {\n\t\treturn this.unlink(path);\n\t}\n\n\tpublic async mkdir(path: string): Promise<void> {\n\t\tconst existingHandle = await this.getHandle(path);\n\t\tif (existingHandle) {\n\t\t\tthrow ErrnoError.With('EEXIST', path, 'mkdir');\n\t\t}\n\n\t\tconst handle = await this.getHandle(dirname(path));\n\t\tif (!(handle instanceof FileSystemDirectoryHandle)) {\n\t\t\tthrow ErrnoError.With('ENOTDIR', path, 'mkdir');\n\t\t}\n\t\tawait handle.getDirectoryHandle(basename(path), { create: true });\n\t}\n\n\tpublic async readdir(path: string): Promise<string[]> {\n\t\tconst handle = await this.getHandle(path);\n\t\tif (!(handle instanceof FileSystemDirectoryHandle)) {\n\t\t\tthrow ErrnoError.With('ENOTDIR', path, 'readdir');\n\t\t}\n\n\t\treturn Array.from(handle.keys());\n\t}\n\n\tprotected async getHandle(path: string): Promise<FileSystemHandle> {\n\t\tif (this._handles.has(path)) {\n\t\t\treturn this._handles.get(path)!;\n\t\t}\n\n\t\tlet walked = '/';\n\n\t\tfor (const part of path.split('/').slice(1)) {\n\t\t\tconst handle = this._handles.get(walked);\n\t\t\tif (!(handle instanceof FileSystemDirectoryHandle)) {\n\t\t\t\tthrow ErrnoError.With('ENOTDIR', walked, 'getHandle');\n\t\t\t}\n\t\t\twalked = join(walked, part);\n\n\t\t\ttry {\n\t\t\t\tconst dirHandle = await handle.getDirectoryHandle(part);\n\t\t\t\tthis._handles.set(walked, dirHandle);\n\t\t\t} catch (_ex) {\n\t\t\t\tconst ex = _ex as DOMException;\n\t\t\t\tif (ex.name == 'TypeMismatchError') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst fileHandle = await handle.getFileHandle(part);\n\t\t\t\t\t\tthis._handles.set(walked, fileHandle);\n\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\tconvertException(ex as ConvertException, walked, 'getHandle');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ex.name === 'TypeError') {\n\t\t\t\t\tthrow new ErrnoError(Errno.ENOENT, ex.message, walked, 'getHandle');\n\t\t\t\t}\n\n\t\t\t\tconvertException(ex, walked, 'getHandle');\n\t\t\t}\n\t\t}\n\n\t\treturn this._handles.get(path)!;\n\t}\n}\n\nconst _WebAccess = {\n\tname: 'WebAccess',\n\n\toptions: {\n\t\thandle: {\n\t\t\ttype: 'object',\n\t\t\trequired: true,\n\t\t\tdescription: 'The directory handle to use for the root',\n\t\t},\n\t},\n\n\tisAvailable(): boolean {\n\t\treturn typeof FileSystemHandle == 'function';\n\t},\n\n\tcreate(options: WebAccessOptions) {\n\t\treturn new WebAccessFS(options.handle);\n\t},\n} as const satisfies Backend<WebAccessFS, WebAccessOptions>;\ntype _WebAccess = typeof _WebAccess;\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface WebAccess extends _WebAccess {}\nexport const WebAccess: WebAccess = _WebAccess;\n", "import type { Backend, Ino, SharedConfig, Store } from '@zenfs/core';\nimport { Async, AsyncTransaction, ErrnoError, InMemory, StoreFS } from '@zenfs/core';\nimport { convertException } from './utils.js';\n\nfunction wrap<T>(request: IDBRequest<T>): Promise<T> {\n\treturn new Promise((resolve, reject) => {\n\t\trequest.onsuccess = () => resolve(request.result);\n\t\trequest.onerror = e => {\n\t\t\te.preventDefault();\n\t\t\treject(convertException(request.error!));\n\t\t};\n\t});\n}\n\n/**\n * @hidden\n */\nexport class IndexedDBTransaction extends AsyncTransaction<IndexedDBStore> {\n\tprivate _idb: IDBObjectStore;\n\n\tpublic constructor(\n\t\tpublic tx: IDBTransaction,\n\t\tpublic store: IndexedDBStore\n\t) {\n\t\tsuper(store);\n\t\tthis._idb = tx.objectStore(store.name);\n\t}\n\n\tpublic get(key: Ino): Promise<Uint8Array> {\n\t\treturn wrap(this._idb.get(key.toString()));\n\t}\n\n\tpublic async set(key: Ino, data: Uint8Array): Promise<void> {\n\t\tawait wrap(this._idb.put(data, key.toString()));\n\t}\n\n\tpublic remove(key: Ino): Promise<void> {\n\t\treturn wrap(this._idb.delete(key.toString()));\n\t}\n\n\tpublic async commit(): Promise<void> {\n\t\tif (this.done) {\n\t\t\treturn;\n\t\t}\n\t\tconst { promise, resolve, reject } = Promise.withResolvers<void>();\n\t\tthis.done = true;\n\t\tthis.tx.oncomplete = () => resolve();\n\t\tthis.tx.onerror = () => reject(convertException(this.tx.error!));\n\t\tthis.tx.commit();\n\t\treturn promise;\n\t}\n\n\tpublic async abort(): Promise<void> {\n\t\tif (this.done) {\n\t\t\treturn;\n\t\t}\n\t\tthis.done = true;\n\t\tconst { promise, resolve, reject } = Promise.withResolvers<void>();\n\t\tthis.tx.onabort = () => resolve();\n\t\tthis.tx.onerror = () => reject(convertException(this.tx.error!));\n\t\tthis.tx.abort();\n\t\treturn promise;\n\t}\n}\n\nasync function createDB(name: string, indexedDB: IDBFactory = globalThis.indexedDB): Promise<IDBDatabase> {\n\tconst req: IDBOpenDBRequest = indexedDB.open(name);\n\n\treq.onupgradeneeded = () => {\n\t\tconst db: IDBDatabase = req.result;\n\t\t// This should never happen; we're at version 1. Why does another database exist?\n\t\tif (db.objectStoreNames.contains(name)) {\n\t\t\tdb.deleteObjectStore(name);\n\t\t}\n\t\tdb.createObjectStore(name);\n\t};\n\n\tconst result = await wrap(req);\n\treturn result;\n}\n\nexport class IndexedDBStore implements Store {\n\tpublic constructor(protected db: IDBDatabase) {}\n\n\tpublic sync(): Promise<void> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\n\tpublic get name(): string {\n\t\treturn this.db.name;\n\t}\n\n\tpublic clear(): Promise<void> {\n\t\treturn wrap(this.db.transaction(this.name, 'readwrite').objectStore(this.name).clear());\n\t}\n\n\tpublic clearSync(): void {\n\t\tthrow ErrnoError.With('ENOSYS', undefined, 'IndexedDBStore.clearSync');\n\t}\n\n\tpublic transaction(): IndexedDBTransaction {\n\t\tconst tx = this.db.transaction(this.name, 'readwrite');\n\t\treturn new IndexedDBTransaction(tx, this);\n\t}\n}\n\n/**\n * Configuration options for the IndexedDB file system.\n */\nexport interface IndexedDBOptions {\n\t/**\n\t * The name of this file system. You can have multiple IndexedDB file systems operating at once, but each must have a different name.\n\t */\n\tstoreName?: string;\n\n\t/**\n\t * The IDBFactory to use. Defaults to `globalThis.indexedDB`.\n\t */\n\tidbFactory?: IDBFactory;\n}\n\n/**\n * A file system that uses the IndexedDB key value file system.\n */\n\nconst _IndexedDB = {\n\tname: 'IndexedDB',\n\n\toptions: {\n\t\tstoreName: {\n\t\t\ttype: 'string',\n\t\t\trequired: false,\n\t\t\tdescription: 'The name of this file system. You can have multiple IndexedDB file systems operating at once, but each must have a different name.',\n\t\t},\n\t\tidbFactory: {\n\t\t\ttype: 'object',\n\t\t\trequired: false,\n\t\t\tdescription: 'The IDBFactory to use. Defaults to globalThis.indexedDB.',\n\t\t},\n\t},\n\n\tasync isAvailable(idbFactory: IDBFactory = globalThis.indexedDB): Promise<boolean> {\n\t\ttry {\n\t\t\tif (!(idbFactory instanceof IDBFactory)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst req = idbFactory.open('__zenfs_test');\n\t\t\tawait wrap(req);\n\t\t\tidbFactory.deleteDatabase('__zenfs_test');\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\tidbFactory.deleteDatabase('__zenfs_test');\n\t\t\treturn false;\n\t\t}\n\t},\n\n\tasync create(options: IndexedDBOptions & Partial<SharedConfig>) {\n\t\tconst db = await createDB(options.storeName || 'zenfs', options.idbFactory);\n\t\tconst store = new IndexedDBStore(db);\n\t\tconst fs = new (Async(StoreFS))(store);\n\t\tif (!options?.disableAsyncCache) {\n\t\t\tfs._sync = InMemory.create({ name: 'idb-cache' });\n\t\t}\n\t\treturn fs;\n\t},\n} as const satisfies Backend<StoreFS, IndexedDBOptions>;\ntype _IndexedDB = typeof _IndexedDB;\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface IndexedDB extends _IndexedDB {}\nexport const IndexedDB: IndexedDB = _IndexedDB;\n", "import type { Backend, Ino, SimpleSyncStore, Store } from '@zenfs/core';\nimport { ErrnoError, Errno, SimpleTransaction, StoreFS, decode, encode } from '@zenfs/core';\n\n/**\n * A synchronous key-value store backed by Storage.\n */\nexport class WebStorageStore implements Store, SimpleSyncStore {\n\tpublic get name(): string {\n\t\treturn WebStorage.name;\n\t}\n\n\tpublic constructor(protected _storage: Storage) {}\n\n\tpublic clear(): void {\n\t\tthis._storage.clear();\n\t}\n\n\tpublic clearSync(): void {\n\t\tthis._storage.clear();\n\t}\n\n\tpublic async sync(): Promise<void> {}\n\n\tpublic transaction(): SimpleTransaction {\n\t\t// No need to differentiate.\n\t\treturn new SimpleTransaction(this);\n\t}\n\n\tpublic get(key: Ino): Uint8Array | undefined {\n\t\tconst data = this._storage.getItem(key.toString());\n\t\tif (typeof data != 'string') {\n\t\t\treturn;\n\t\t}\n\n\t\treturn encode(data);\n\t}\n\n\tpublic set(key: Ino, data: Uint8Array): void {\n\t\ttry {\n\t\t\tthis._storage.setItem(key.toString(), decode(data));\n\t\t} catch (e) {\n\t\t\tthrow new ErrnoError(Errno.ENOSPC, 'Storage is full.');\n\t\t}\n\t}\n\n\tpublic delete(key: Ino): void {\n\t\ttry {\n\t\t\tthis._storage.removeItem(key.toString());\n\t\t} catch (e) {\n\t\t\tthrow new ErrnoError(Errno.EIO, 'Unable to delete key ' + key + ': ' + e);\n\t\t}\n\t}\n}\n\n/**\n * Options to pass to the StorageFileSystem\n */\nexport interface WebStorageOptions {\n\t/**\n\t * The Storage to use. Defaults to globalThis.localStorage.\n\t */\n\tstorage?: Storage;\n}\n\n/**\n * A synchronous file system backed by a `Storage` (e.g. localStorage).\n */\nconst _WebStorage = {\n\tname: 'WebStorage',\n\n\toptions: {\n\t\tstorage: {\n\t\t\ttype: 'object',\n\t\t\trequired: false,\n\t\t\tdescription: 'The Storage to use. Defaults to globalThis.localStorage.',\n\t\t},\n\t},\n\n\tisAvailable(storage: Storage = globalThis.localStorage): boolean {\n\t\treturn storage instanceof globalThis.Storage;\n\t},\n\n\tcreate({ storage = globalThis.localStorage }: WebStorageOptions) {\n\t\treturn new StoreFS(new WebStorageStore(storage));\n\t},\n} as const satisfies Backend<StoreFS, WebStorageOptions>;\ntype _WebStorage = typeof _WebStorage;\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\ninterface WebStorage extends _WebStorage {}\nexport const WebStorage: WebStorage = _WebStorage;\n"],
5
- "mappings": "gfAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,eAAAE,GAAA,mBAAAC,EAAA,yBAAAC,EAAA,cAAAC,EAAA,gBAAAC,EAAA,eAAAC,EAAA,oBAAAC,ICAA,IAAOC,GAAQ,MACT,CAAE,MAAAC,EAAO,iBAAAC,EAAkB,YAAAC,GAAa,cAAAC,GAAe,IAAAC,GAAK,OAAAC,GAAQ,MAAAC,EAAO,WAAAC,EAAY,MAAAC,GAAO,QAAAC,GAAS,KAAAC,GAAM,WAAAC,EAAY,SAAAC,EAAU,cAAAC,GAAe,MAAAC,GAAO,QAAAC,GAAS,MAAAC,GAAO,UAAAC,GAAW,QAAAC,GAAS,WAAAC,GAAY,QAAAC,GAAS,UAAAC,GAAW,KAAAC,GAAM,OAAAC,GAAQ,SAAAC,GAAU,YAAAC,EAAa,WAAAC,GAAY,SAAAC,GAAU,iBAAAC,GAAkB,kBAAAC,EAAmB,MAAAC,EAAO,YAAAC,GAAa,QAAAC,GAAS,QAAAC,EAAS,KAAAC,GAAM,gBAAAC,GAAiB,YAAAC,GAAa,mBAAAC,GAAoB,YAAAC,GAAa,UAAAC,GAAW,UAAAC,GAAW,MAAAC,GAAO,YAAAC,GAAa,iBAAAC,GAAkB,OAAAC,GAAQ,WAAAC,GAAY,WAAAC,GAAY,eAAAC,GAAgB,SAAAC,GAAU,aAAAC,GAAc,MAAAC,GAAO,UAAAC,GAAW,MAAAC,GAAO,UAAAC,GAAW,MAAAC,GAAO,UAAAC,GAAW,UAAAC,GAAW,gBAAAC,GAAiB,UAAAC,GAAW,SAAAC,GAAU,aAAAC,GAAc,GAAAC,G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AAK,SAAS,QAAQD,EAAI,SAAS,CAAC,EACjD,GAAI,OAAOC,GAAQ,SAInB,OAAOC,EAAOD,CAAI,CACnB,CAEO,IAAID,EAAUC,EAAwB,CAC5C,GAAI,CACH,KAAK,SAAS,QAAQD,EAAI,SAAS,EAAGG,EAAOF,CAAI,CAAC,CACnD,MAAY,CACX,MAAM,IAAIG,EAAWC,EAAM,OAAQ,kBAAkB,CACtD,CACD,CAEO,OAAOL,EAAgB,CAC7B,GAAI,CACH,KAAK,SAAS,WAAWA,EAAI,SAAS,CAAC,CACxC,OAAS,EAAG,CACX,MAAM,IAAII,EAAWC,EAAM,IAAK,wBAA0BL,EAAM,KAAO,CAAC,CACzE,CACD,CACD,EA9C+DM,EAAAV,EAAA,mBAAxD,IAAMW,EAANX,EA6DDY,GAAc,CACnB,KAAM,aAEN,QAAS,CACR,QAAS,CACR,KAAM,SACN,SAAU,GACV,YAAa,0DACd,CACD,EAEA,YAAWF,EAAA,SAACG,EAAmB,WAAW,aAAuB,CAChE,OAAOA,aAAmB,WAAW,OACtC,EAFW,eAIX,OAAMH,EAAA,SAAC,CAAE,QAAAG,EAAU,WAAW,YAAa,EAAsB,CAChE,OAAO,IAAIC,EAAQ,IAAIH,EAAgBE,CAAO,CAAC,CAChD,EAFM,SAGP,EAIaX,EAAyBU",
6
- "names": ["src_exports", "__export", "IndexedDB", "IndexedDBStore", "IndexedDBTransaction", "WebAccess", "WebAccessFS", "WebStorage", "WebStorageStore", "core_default", "Async", "AsyncTransaction", "BigIntStats", "BigIntStatsFs", "Dir", "Dirent", "Errno", "ErrnoError", "Fetch", "FetchFS", "File", "FileSystem", "InMemory", "InMemoryStore", "Index", "IndexFS", "Inode", "MutexLock", "Mutexed", "NoSyncFile", "Overlay", "OverlayFS", "Port", "PortFS", "PortFile", "PreloadFile", "ReadStream", "Readonly", "SimpleAsyncStore", "SimpleTransaction", "Stats", "StatsCommon", "StatsFs", "StoreFS", "Sync", "SyncTransaction", "Transaction", "UnmutexedOverlayFS", "WriteStream", "ZenFsType", "_InMemory", "_Port", "__MutexedFS", "_toUnixTimestamp", "access", "accessSync", "appendFile", "appendFileSync", "attachFS", "checkOptions", "chmod", "chmodSync", "chown", "chownSync", "close", "closeSync", "configure", "configureSingle", "constants", "copyFile", "copyFileSync", "cp", "cpSync", "createReadStream", "createWriteStream", "credentials", "decode", "decodeDirListing", "detachFS", "encode", "encodeDirListing", "errorMessages", "exists", "existsSync", "fchmod", "fchmodSync", "fchown", "fchownSync", "fdatasync", "fdatasyncSync", "flagToMode", "flagToNumber", "flagToString", "fs", "fstat", "fstatSync", "fsync", "fsyncSync", "ftruncate", "ftruncateSync", "futimes", "futimesSync", "handleRequest", "isAppendable", "isBackend", "isBackendConfig", "isExclusive", "isReadable", "isStatsEqual", "isSynchronous", "isTruncating", "isWriteable", "lchmod", "lchmodSync", "lchown", "lchownSync", "levenshtein", "link", "linkSync", "lopenSync", "lstat", "lstatSync", "lutimes", "lutimesSync", "mkdir", "mkdirSync", "mkdirpSync", "mkdtemp", "mkdtempSync", "mount", "mountObject", "mounts", "normalizeMode", "normalizeOptions", "normalizePath", "normalizeTime", "open", "openAsBlob", "openSync", "opendir", "opendirSync", "parseFlag", "promises", "randomIno", "read", "readFile", "readFileSync", "readSync", "readdir", "readdirSync", "readlink", "readlinkSync", "readv", "readvSync", "realpath", "realpathSync", "rename", "renameSync", "resolveMountConfig", "resolveRemoteMount", "rm", "rmSync", "rmdir", "rmdirSync", "rootCredentials", "rootIno", "setImmediate", "size_max", "stat", "statSync", "statfs", "statfsSync", "symlink", "symlinkSync", "truncate", "truncateSync", "umount", "unlink", "unlinkSync", "unwatchFile", "utimes", "utimesSync", "version", "watch", "watchFile", "write", "writeFile", "writeFileSync", "writeSync", "writev", "writevSync", "normalizeString", "path", "allowAboveRoot", "res", "lastSegmentLength", "lastSlash", "dots", "char", "i", "lastSlashIndex", "__name", "normalize", "path", "isAbsolute", "trailingSeparator", "normalizeString", "__name", "join", "parts", "joined", "normalize", "__name", "dirname", "path", "hasRoot", "end", "matchedSlash", "i", "__name", "basename", "suffix", "start", "extIdx", "firstNonSlashEnd", "errnoForDOMException", "ex", "__name", "convertException", "path", "syscall", "ErrnoError", "code", "Errno", "error", "_WebAccessFS", "Async", "FileSystem", "handle", "InMemory", "path", "data", "stats", "currentStats", "oldPath", "newPath", "files", "file", "join", "oldFile", "destFolder", "dirname", "writable", "basename", "ex", "convertException", "ErrnoError", "Errno", "flag", "Stats", "lastModified", "size", "PreloadFile", "srcpath", "walked", "part", "dirHandle", "_ex", "fileHandle", "__name", "WebAccessFS", "_WebAccess", "options", "WebAccess", "wrap", "request", "resolve", "reject", "e", "convertException", "__name", "_IndexedDBTransaction", "AsyncTransaction", "tx", "store", "key", "data", "promise", "IndexedDBTransaction", "createDB", "name", "indexedDB", "req", "db", "_IndexedDBStore", "ErrnoError", "IndexedDBStore", "_IndexedDB", "idbFactory", "options", "fs", "Async", "StoreFS", "InMemory", "IndexedDB", "_WebStorageStore", "_storage", "WebStorage", "SimpleTransaction", "key", "data", "encode", "decode", "ErrnoError", "Errno", "__name", "WebStorageStore", "_WebStorage", "storage", "StoreFS"]
7
- }