opfs-worker 1.2.0 → 1.2.2

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/facade.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DirentData, Encoding, FileOpenOptions, FileStat, OPFSOptions, RenameOptions, WatchOptions } from './types';
1
+ import type { DirentData, Encoding, FileOpenOptions, FileStat, OPFSOptions, PathLike, RenameOptions, WatchOptions } from './types';
2
2
  /**
3
3
  * Facade class that provides a clean interface for communicating with the OPFS worker
4
4
  * while hiding Comlink implementation details.
@@ -17,73 +17,73 @@ export declare class OPFSFileSystem {
17
17
  /**
18
18
  * Read a file from the file system
19
19
  */
20
- readFile(path: string, encoding: 'binary'): Promise<Uint8Array>;
21
- readFile(path: string, encoding: Encoding): Promise<string>;
22
- readFile(path: string, encoding?: Encoding | 'binary'): Promise<string | Uint8Array>;
20
+ readFile(path: PathLike, encoding: 'binary'): Promise<Uint8Array>;
21
+ readFile(path: PathLike, encoding: Encoding): Promise<string>;
22
+ readFile(path: PathLike, encoding?: Encoding | 'binary'): Promise<string | Uint8Array>;
23
23
  /**
24
24
  * Write data to a file
25
25
  */
26
- writeFile(path: string, data: string | Uint8Array | ArrayBuffer, encoding?: Encoding): Promise<void>;
26
+ writeFile(path: PathLike, data: string | Uint8Array | ArrayBuffer, encoding?: Encoding): Promise<void>;
27
27
  /**
28
28
  * Append data to a file
29
29
  */
30
- appendFile(path: string, data: string | Uint8Array | ArrayBuffer, encoding?: Encoding): Promise<void>;
30
+ appendFile(path: PathLike, data: string | Uint8Array | ArrayBuffer, encoding?: Encoding): Promise<void>;
31
31
  /**
32
32
  * Create a directory
33
33
  */
34
- mkdir(path: string, options?: {
34
+ mkdir(path: PathLike, options?: {
35
35
  recursive?: boolean;
36
36
  }): Promise<void>;
37
37
  /**
38
38
  * Get file or directory statistics
39
39
  */
40
- stat(path: string): Promise<FileStat>;
40
+ stat(path: PathLike): Promise<FileStat>;
41
41
  /**
42
42
  * Read a directory's contents
43
43
  */
44
- readDir(path: string): Promise<DirentData[]>;
44
+ readDir(path: PathLike): Promise<DirentData[]>;
45
45
  /**
46
46
  * Check if a file or directory exists
47
47
  */
48
- exists(path: string): Promise<boolean>;
48
+ exists(path: PathLike): Promise<boolean>;
49
49
  /**
50
50
  * Clear all contents of a directory without removing the directory itself
51
51
  */
52
- clear(path?: string): Promise<void>;
52
+ clear(path?: PathLike): Promise<void>;
53
53
  /**
54
54
  * Remove files and directories
55
55
  */
56
- remove(path: string, options?: {
56
+ remove(path: PathLike, options?: {
57
57
  recursive?: boolean;
58
58
  force?: boolean;
59
59
  }): Promise<void>;
60
60
  /**
61
61
  * Resolve a path to an absolute path
62
62
  */
63
- realpath(path: string): Promise<string>;
63
+ realpath(path: PathLike): Promise<string>;
64
64
  /**
65
65
  * Rename a file or directory
66
66
  */
67
- rename(oldPath: string, newPath: string, options?: RenameOptions): Promise<void>;
67
+ rename(oldPath: PathLike, newPath: PathLike, options?: RenameOptions): Promise<void>;
68
68
  /**
69
69
  * Copy files and directories
70
70
  */
71
- copy(source: string, destination: string, options?: {
71
+ copy(source: PathLike, destination: PathLike, options?: {
72
72
  recursive?: boolean;
73
73
  overwrite?: boolean;
74
74
  }): Promise<void>;
75
75
  /**
76
76
  * Start watching a file or directory for changes
77
77
  */
78
- watch(path: string, options?: WatchOptions): () => void;
78
+ watch(path: PathLike, options?: WatchOptions): () => void;
79
79
  /**
80
80
  * Stop watching a previously watched path
81
81
  */
82
- unwatch(path: string): void;
82
+ unwatch(path: PathLike): void;
83
83
  /**
84
84
  * Open a file and return a file descriptor
85
85
  */
86
- open(path: string, options?: FileOpenOptions): Promise<number>;
86
+ open(path: PathLike, options?: FileOpenOptions): Promise<number>;
87
87
  /**
88
88
  * Close a file descriptor
89
89
  */
@@ -122,20 +122,18 @@ export declare class OPFSFileSystem {
122
122
  /**
123
123
  * Synchronize the file system with external data
124
124
  */
125
- sync(entries: [string, string | Uint8Array | Blob][], options?: {
126
- cleanBefore?: boolean;
127
- }): Promise<void>;
125
+ createIndex(entries: [PathLike, string | Uint8Array | Blob][]): Promise<void>;
128
126
  /**
129
127
  * Read a file as text with automatic encoding detection
130
128
  */
131
- readText(path: string, encoding?: Encoding): Promise<string>;
129
+ readText(path: PathLike, encoding?: Encoding): Promise<string>;
132
130
  /**
133
131
  * Write text to a file with specified encoding
134
132
  */
135
- writeText(path: string, text: string, encoding?: Encoding): Promise<void>;
133
+ writeText(path: PathLike, text: string, encoding?: Encoding): Promise<void>;
136
134
  /**
137
135
  * Append text to a file with specified encoding
138
136
  */
139
- appendText(path: string, text: string, encoding?: Encoding): Promise<void>;
137
+ appendText(path: PathLike, text: string, encoding?: Encoding): Promise<void>;
140
138
  }
141
139
  //# sourceMappingURL=facade.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,UAAU,EACV,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,WAAW,EAEX,aAAa,EACb,YAAY,EACf,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,cAAc;;gBAGX,OAAO,CAAC,EAAE,WAAW;IAiBjC;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,WAAW;IAIrC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAI7C;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC;IAiB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O,CAAC,QAAQ,CAAC;IAI1C;;OAEG;IACG,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD;;OAEG;IACG,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC;;OAEG;IACH,OAAO;IAIP;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnF;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAE,QAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAO7E;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1F;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAM9F"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("comlink"),e=require("./helpers-TAynP0fb.cjs"),c=`/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("comlink"),e=require("./helpers-TAynP0fb.cjs"),l=`/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
@@ -12,7 +12,7 @@ const pt = Symbol("Comlink.proxy"), Ct = Symbol("Comlink.endpoint"), Tt = Symbol
12
12
  deserialize(s) {
13
13
  return s.start(), Rt(s);
14
14
  }
15
- }, Pt = {
15
+ }, It = {
16
16
  canHandle: (s) => gt(s) && z in s,
17
17
  serialize({ value: s }) {
18
18
  let t;
@@ -30,9 +30,9 @@ const pt = Symbol("Comlink.proxy"), Ct = Symbol("Comlink.endpoint"), Tt = Symbol
30
30
  }
31
31
  }, wt = /* @__PURE__ */ new Map([
32
32
  ["proxy", Mt],
33
- ["throw", Pt]
33
+ ["throw", It]
34
34
  ]);
35
- function It(s, t) {
35
+ function Pt(s, t) {
36
36
  for (const e of s)
37
37
  if (t === e || e === "*" || e instanceof RegExp && e.test(t))
38
38
  return !0;
@@ -42,7 +42,7 @@ function K(s, t = globalThis, e = ["*"]) {
42
42
  t.addEventListener("message", function n(i) {
43
43
  if (!i || !i.data)
44
44
  return;
45
- if (!It(e, i.origin)) {
45
+ if (!Pt(e, i.origin)) {
46
46
  console.warn(\`Invalid origin '\${i.origin}' for comlink proxy\`);
47
47
  return;
48
48
  }
@@ -82,10 +82,10 @@ function K(s, t = globalThis, e = ["*"]) {
82
82
  h = { value: c, [z]: 0 };
83
83
  }
84
84
  Promise.resolve(h).catch((c) => ({ value: c, [z]: 0 })).then((c) => {
85
- const [f, u] = B(c);
86
- t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u), o === "RELEASE" && (t.removeEventListener("message", n), yt(t), q in s && typeof s[q] == "function" && s[q]());
85
+ const [f, u] = U(c);
86
+ t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u), o === "RELEASE" && (t.removeEventListener("message", n), mt(t), q in s && typeof s[q] == "function" && s[q]());
87
87
  }).catch((c) => {
88
- const [f, u] = B({
88
+ const [f, u] = U({
89
89
  value: new TypeError("Unserializable return value"),
90
90
  [z]: 0
91
91
  });
@@ -96,7 +96,7 @@ function K(s, t = globalThis, e = ["*"]) {
96
96
  function kt(s) {
97
97
  return s.constructor.name === "MessagePort";
98
98
  }
99
- function yt(s) {
99
+ function mt(s) {
100
100
  kt(s) && s.close();
101
101
  }
102
102
  function Rt(s, t) {
@@ -118,16 +118,16 @@ function k(s) {
118
118
  if (s)
119
119
  throw new Error("Proxy has been released and is not useable");
120
120
  }
121
- function mt(s) {
121
+ function yt(s) {
122
122
  return N(s, /* @__PURE__ */ new Map(), {
123
123
  type: "RELEASE"
124
124
  }).then(() => {
125
- yt(s);
125
+ mt(s);
126
126
  });
127
127
  }
128
128
  const _ = /* @__PURE__ */ new WeakMap(), j = "FinalizationRegistry" in globalThis && new FinalizationRegistry((s) => {
129
129
  const t = (_.get(s) || 0) - 1;
130
- _.set(s, t), t === 0 && mt(s);
130
+ _.set(s, t), t === 0 && yt(s);
131
131
  });
132
132
  function Lt(s, t) {
133
133
  const e = (_.get(t) || 0) + 1;
@@ -143,7 +143,7 @@ function Z(s, t, e = [], n = function() {
143
143
  get(o, a) {
144
144
  if (k(i), a === Tt)
145
145
  return () => {
146
- zt(r), mt(s), t.clear(), i = !0;
146
+ zt(r), yt(s), t.clear(), i = !0;
147
147
  };
148
148
  if (a === "then") {
149
149
  if (e.length === 0)
@@ -158,7 +158,7 @@ function Z(s, t, e = [], n = function() {
158
158
  },
159
159
  set(o, a, l) {
160
160
  k(i);
161
- const [h, c] = B(l);
161
+ const [h, c] = U(l);
162
162
  return N(s, t, {
163
163
  type: "SET",
164
164
  path: [...e, a].map((f) => f.toString()),
@@ -197,7 +197,7 @@ function Ht(s) {
197
197
  return Array.prototype.concat.apply([], s);
198
198
  }
199
199
  function st(s) {
200
- const t = s.map(B);
200
+ const t = s.map(U);
201
201
  return [t.map((e) => e[0]), Ht(t.map((e) => e[1]))];
202
202
  }
203
203
  const Et = /* @__PURE__ */ new WeakMap();
@@ -207,7 +207,7 @@ function H(s, t) {
207
207
  function Wt(s) {
208
208
  return Object.assign(s, { [pt]: !0 });
209
209
  }
210
- function B(s) {
210
+ function U(s) {
211
211
  for (const [t, e] of wt)
212
212
  if (e.canHandle(s)) {
213
213
  const [n, i] = e.serialize(s);
@@ -255,7 +255,7 @@ class jt extends p {
255
255
  super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
256
256
  }
257
257
  }
258
- class Bt extends p {
258
+ class Ut extends p {
259
259
  constructor(t, e, n) {
260
260
  super(t, "INVALID_PATH", e, n);
261
261
  }
@@ -269,7 +269,7 @@ function R(s, t, e, n) {
269
269
  const i = \`\${s.toUpperCase()}_FAILED\`;
270
270
  return new p(\`Failed to \${s} file descriptor: \${t}\`, i, e, n);
271
271
  }
272
- function Ut(s, t) {
272
+ function Bt(s, t) {
273
273
  const e = t?.path;
274
274
  switch (s.name) {
275
275
  case "InvalidStateError":
@@ -388,17 +388,17 @@ function T(s, t) {
388
388
  const O = c.some(oe);
389
389
  f = [];
390
390
  for (let x = u; S(x, d); x += g) {
391
- let y;
391
+ let m;
392
392
  if (a)
393
- y = String.fromCharCode(x), y === "\\\\" && (y = "");
394
- else if (y = String(x), O) {
395
- const $ = w - y.length;
393
+ m = String.fromCharCode(x), m === "\\\\" && (m = "");
394
+ else if (m = String(x), O) {
395
+ const $ = w - m.length;
396
396
  if ($ > 0) {
397
- const I = new Array($ + 1).join("0");
398
- x < 0 ? y = "-" + I + y.slice(1) : y = I + y;
397
+ const P = new Array($ + 1).join("0");
398
+ x < 0 ? m = "-" + P + m.slice(1) : m = P + m;
399
399
  }
400
400
  }
401
- f.push(y);
401
+ f.push(m);
402
402
  }
403
403
  } else {
404
404
  f = [];
@@ -413,7 +413,7 @@ function T(s, t) {
413
413
  }
414
414
  return e;
415
415
  }
416
- const le = 1024 * 64, U = (s) => {
416
+ const le = 1024 * 64, B = (s) => {
417
417
  if (typeof s != "string")
418
418
  throw new TypeError("invalid pattern");
419
419
  if (s.length > le)
@@ -486,7 +486,7 @@ const le = 1024 * 64, U = (s) => {
486
486
  }
487
487
  const u = "[" + (h ? "^" : "") + rt(n) + "]", d = "[" + (h ? "" : "^") + rt(i) + "]";
488
488
  return [n.length && i.length ? "(" + u + "|" + d + ")" : n.length ? u : d, a, c - e, !0];
489
- }, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), de = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), ot = (s) => de.has(s), pe = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", L = "(?!\\\\.)", ge = /* @__PURE__ */ new Set(["[", "."]), we = /* @__PURE__ */ new Set(["..", "."]), ye = new Set("().*{}+?[]^$\\\\!"), me = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), tt = "[^/]", at = tt + "*?", ct = tt + "+?";
489
+ }, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), de = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), ot = (s) => de.has(s), pe = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", L = "(?!\\\\.)", ge = /* @__PURE__ */ new Set(["[", "."]), we = /* @__PURE__ */ new Set(["..", "."]), me = new Set("().*{}+?[]^$\\\\!"), ye = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), tt = "[^/]", at = tt + "*?", ct = tt + "+?";
490
490
  class E {
491
491
  type;
492
492
  #s;
@@ -798,7 +798,7 @@ class E {
798
798
  for (let a = 0; a < t.length; a++) {
799
799
  const l = t.charAt(a);
800
800
  if (i) {
801
- i = !1, r += (ye.has(l) ? "\\\\" : "") + l;
801
+ i = !1, r += (me.has(l) ? "\\\\" : "") + l;
802
802
  continue;
803
803
  }
804
804
  if (l === "\\\\") {
@@ -820,12 +820,12 @@ class E {
820
820
  r += tt, e = !0;
821
821
  continue;
822
822
  }
823
- r += me(l);
823
+ r += ye(l);
824
824
  }
825
825
  return [r, M(t), !!e, o];
826
826
  }
827
827
  }
828
- const Ee = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), m = (s, t, e = {}) => (U(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new G(t, e).match(s)), Se = /^\\*+([^+@!?\\*\\[\\(]*)$/, xe = (s) => (t) => !t.startsWith(".") && t.endsWith(s), be = (s) => (t) => t.endsWith(s), ve = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Ae = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Fe = /^\\*+\\.\\*+$/, Ne = (s) => !s.startsWith(".") && s.includes("."), De = (s) => s !== "." && s !== ".." && s.includes("."), Oe = /^\\.\\*+$/, $e = (s) => s !== "." && s !== ".." && s.startsWith("."), Ce = /^\\*+$/, Te = (s) => s.length !== 0 && !s.startsWith("."), Me = (s) => s.length !== 0 && s !== "." && s !== "..", Pe = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Ie = ([s, t = ""]) => {
828
+ const Ee = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (s, t, e = {}) => (B(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new G(t, e).match(s)), Se = /^\\*+([^+@!?\\*\\[\\(]*)$/, xe = (s) => (t) => !t.startsWith(".") && t.endsWith(s), be = (s) => (t) => t.endsWith(s), ve = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Ae = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Fe = /^\\*+\\.\\*+$/, Ne = (s) => !s.startsWith(".") && s.includes("."), De = (s) => s !== "." && s !== ".." && s.includes("."), Oe = /^\\.\\*+$/, $e = (s) => s !== "." && s !== ".." && s.startsWith("."), Ce = /^\\*+$/, Te = (s) => s.length !== 0 && !s.startsWith("."), Me = (s) => s.length !== 0 && s !== "." && s !== "..", Ie = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Pe = ([s, t = ""]) => {
829
829
  const e = Nt([s]);
830
830
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
831
831
  }, ke = ([s, t = ""]) => {
@@ -847,15 +847,15 @@ const Ee = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\
847
847
  win32: { sep: "\\\\" },
848
848
  posix: { sep: "/" }
849
849
  }, ze = Ot === "win32" ? lt.win32.sep : lt.posix.sep;
850
- m.sep = ze;
850
+ y.sep = ze;
851
851
  const v = Symbol("globstar **");
852
- m.GLOBSTAR = v;
853
- const He = "[^/]", We = He + "*?", _e = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", je = "(?:(?!(?:\\\\/|^)\\\\.).)*?", Be = (s, t = {}) => (e) => m(e, s, t);
854
- m.filter = Be;
855
- const b = (s, t = {}) => Object.assign({}, s, t), Ue = (s) => {
852
+ y.GLOBSTAR = v;
853
+ const He = "[^/]", We = He + "*?", _e = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", je = "(?:(?!(?:\\\\/|^)\\\\.).)*?", Ue = (s, t = {}) => (e) => y(e, s, t);
854
+ y.filter = Ue;
855
+ const b = (s, t = {}) => Object.assign({}, s, t), Be = (s) => {
856
856
  if (!s || typeof s != "object" || !Object.keys(s).length)
857
- return m;
858
- const t = m;
857
+ return y;
858
+ const t = y;
859
859
  return Object.assign((n, i, r = {}) => t(n, i, b(s, r)), {
860
860
  Minimatch: class extends t.Minimatch {
861
861
  constructor(i, r = {}) {
@@ -886,16 +886,16 @@ const b = (s, t = {}) => Object.assign({}, s, t), Ue = (s) => {
886
886
  GLOBSTAR: v
887
887
  });
888
888
  };
889
- m.defaults = Ue;
890
- const $t = (s, t = {}) => (U(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : ie(s));
891
- m.braceExpand = $t;
889
+ y.defaults = Be;
890
+ const $t = (s, t = {}) => (B(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : ie(s));
891
+ y.braceExpand = $t;
892
892
  const Ge = (s, t = {}) => new G(s, t).makeRe();
893
- m.makeRe = Ge;
893
+ y.makeRe = Ge;
894
894
  const qe = (s, t, e = {}) => {
895
895
  const n = new G(t, e);
896
896
  return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
897
897
  };
898
- m.match = qe;
898
+ y.match = qe;
899
899
  const ht = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, Ve = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
900
900
  class G {
901
901
  options;
@@ -916,7 +916,7 @@ class G {
916
916
  windowsNoMagicRoot;
917
917
  regexp;
918
918
  constructor(t, e = {}) {
919
- U(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ot, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
919
+ B(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ot, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
920
920
  }
921
921
  hasMagic() {
922
922
  if (this.options.magicalBraces && this.set.length > 1)
@@ -1124,10 +1124,10 @@ class G {
1124
1124
  matchOne(t, e, n = !1) {
1125
1125
  const i = this.options;
1126
1126
  if (this.isWindows) {
1127
- const g = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !g && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), A = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), O = !A && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : g ? 0 : void 0, y = O ? 3 : A ? 0 : void 0;
1128
- if (typeof x == "number" && typeof y == "number") {
1129
- const [$, I] = [t[x], e[y]];
1130
- $.toLowerCase() === I.toLowerCase() && (e[y] = $, y > x ? e = e.slice(y) : x > y && (t = t.slice(x)));
1127
+ const g = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !g && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), A = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), O = !A && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : g ? 0 : void 0, m = O ? 3 : A ? 0 : void 0;
1128
+ if (typeof x == "number" && typeof m == "number") {
1129
+ const [$, P] = [t[x], e[m]];
1130
+ $.toLowerCase() === P.toLowerCase() && (e[m] = $, m > x ? e = e.slice(m) : x > m && (t = t.slice(x)));
1131
1131
  }
1132
1132
  }
1133
1133
  const { optimizationLevel: r = 1 } = this.options;
@@ -1176,14 +1176,14 @@ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), n))
1176
1176
  return $t(this.pattern, this.options);
1177
1177
  }
1178
1178
  parse(t) {
1179
- U(t);
1179
+ B(t);
1180
1180
  const e = this.options;
1181
1181
  if (t === "**")
1182
1182
  return v;
1183
1183
  if (t === "")
1184
1184
  return "";
1185
1185
  let n, i = null;
1186
- (n = t.match(Ce)) ? i = e.dot ? Me : Te : (n = t.match(Se)) ? i = (e.nocase ? e.dot ? Ae : ve : e.dot ? be : xe)(n[1]) : (n = t.match(Pe)) ? i = (e.nocase ? e.dot ? ke : Ie : e.dot ? Re : Le)(n) : (n = t.match(Fe)) ? i = e.dot ? De : Ne : (n = t.match(Oe)) && (i = $e);
1186
+ (n = t.match(Ce)) ? i = e.dot ? Me : Te : (n = t.match(Se)) ? i = (e.nocase ? e.dot ? Ae : ve : e.dot ? be : xe)(n[1]) : (n = t.match(Ie)) ? i = (e.nocase ? e.dot ? ke : Pe : e.dot ? Re : Le)(n) : (n = t.match(Fe)) ? i = e.dot ? De : Ne : (n = t.match(Oe)) && (i = $e);
1187
1187
  const r = E.fromGlob(t, this.options).toMMPattern();
1188
1188
  return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
1189
1189
  }
@@ -1244,18 +1244,18 @@ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), n))
1244
1244
  return n.flipNegate ? !1 : this.negate;
1245
1245
  }
1246
1246
  static defaults(t) {
1247
- return m.defaults(t).Minimatch;
1247
+ return y.defaults(t).Minimatch;
1248
1248
  }
1249
1249
  }
1250
- m.AST = E;
1251
- m.Minimatch = G;
1252
- m.escape = Ee;
1253
- m.unescape = M;
1250
+ y.AST = E;
1251
+ y.Minimatch = G;
1252
+ y.escape = Ee;
1253
+ y.unescape = M;
1254
1254
  function Xe() {
1255
1255
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1256
1256
  throw new jt();
1257
1257
  }
1258
- async function P(s, t, e) {
1258
+ async function I(s, t, e) {
1259
1259
  return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(\`opfs:\${s.replace(/\\/+/g, "/")}\`, { mode: t }, e) : e();
1260
1260
  }
1261
1261
  function D(s) {
@@ -1279,7 +1279,7 @@ function Ye(s, t = !1) {
1279
1279
  return s = s.replace(/\\/$/, ""), t && !s.includes("*") ? \`\${s}/**\` : s;
1280
1280
  }
1281
1281
  function Y(s, t) {
1282
- return m(s, t, {
1282
+ return y(s, t, {
1283
1283
  dot: !0,
1284
1284
  matchBase: !0
1285
1285
  });
@@ -1308,7 +1308,7 @@ async function Je(s) {
1308
1308
  }
1309
1309
  async function Ke(s, t, e = {}) {
1310
1310
  const n = J(t);
1311
- return P(t, "exclusive", async () => {
1311
+ return I(t, "exclusive", async () => {
1312
1312
  const i = e.recursive ?? !1, r = e.force ?? !1;
1313
1313
  e.useTrash;
1314
1314
  try {
@@ -1348,7 +1348,7 @@ async function ts(s, t) {
1348
1348
  try {
1349
1349
  return await s.createSyncAccessHandle();
1350
1350
  } catch (e) {
1351
- throw Ut(e, { path: t });
1351
+ throw Bt(e, { path: t });
1352
1352
  }
1353
1353
  }
1354
1354
  class es {
@@ -1523,7 +1523,7 @@ class es {
1523
1523
  async getFileHandle(t, e = !1, n = this.root) {
1524
1524
  const i = D(t);
1525
1525
  if (i.length === 0)
1526
- throw new Bt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1526
+ throw new Ut("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1527
1527
  const r = i.pop();
1528
1528
  return (await this.getDirectoryHandle(i, e, n)).getFileHandle(r, { create: e });
1529
1529
  }
@@ -1590,7 +1590,7 @@ class es {
1590
1590
  async readFile(t) {
1591
1591
  await this.mount();
1592
1592
  try {
1593
- return await P(t, "shared", async () => {
1593
+ return await I(t, "shared", async () => {
1594
1594
  const e = await this.open(t);
1595
1595
  try {
1596
1596
  const { size: n } = await this.fstat(e), i = new Uint8Array(n);
@@ -1628,7 +1628,7 @@ class es {
1628
1628
  async writeFile(t, e) {
1629
1629
  await this.mount();
1630
1630
  const n = e instanceof Uint8Array ? e : new Uint8Array(e);
1631
- await P(t, "exclusive", async () => {
1631
+ await I(t, "exclusive", async () => {
1632
1632
  const i = await this.exists(t), r = await this.open(t, { create: !0, truncate: !0 });
1633
1633
  try {
1634
1634
  await this.write(r, n, 0, n.length, null, !1), await this.fsync(r);
@@ -1663,7 +1663,7 @@ class es {
1663
1663
  async appendFile(t, e) {
1664
1664
  await this.mount();
1665
1665
  const n = e instanceof Uint8Array ? e : new Uint8Array(e);
1666
- await P(t, "exclusive", async () => {
1666
+ await I(t, "exclusive", async () => {
1667
1667
  const i = await this.open(t, { create: !0 });
1668
1668
  try {
1669
1669
  const { size: r } = await this.fstat(i);
@@ -2100,7 +2100,7 @@ class es {
2100
2100
  await this.mount();
2101
2101
  const { create: n = !1, exclusive: i = !1, truncate: r = !1 } = e || {}, o = W(ut(t));
2102
2102
  try {
2103
- return n && i ? await P(o, "exclusive", async () => {
2103
+ return n && i ? await I(o, "exclusive", async () => {
2104
2104
  if (await this.exists(o))
2105
2105
  throw new p(\`File already exists: \${o}\`, "EEXIST", o);
2106
2106
  return this._openFile(o, n, r);
@@ -2326,21 +2326,20 @@ class es {
2326
2326
  * await fs.sync(entries, { cleanBefore: true });
2327
2327
  * \`\`\`
2328
2328
  */
2329
- async sync(t, e) {
2329
+ async createIndex(t) {
2330
2330
  await this.mount();
2331
2331
  try {
2332
- (e?.cleanBefore ?? !1) && await this.clear("/");
2333
- for (const [i, r] of t) {
2334
- const o = W(i);
2335
- let a;
2336
- r instanceof Blob ? a = await Je(r) : typeof r == "string" ? a = new TextEncoder().encode(r) : a = r, await this.writeFile(o, a);
2332
+ for (const [e, n] of t) {
2333
+ const i = W(e);
2334
+ let r;
2335
+ n instanceof Blob ? r = await Je(n) : typeof n == "string" ? r = new TextEncoder().encode(n) : r = n, await this.writeFile(i, r);
2337
2336
  }
2338
- } catch (n) {
2339
- throw n instanceof p ? n : new p("Failed to sync file system", "SYNC_FAILED", void 0, n);
2337
+ } catch (e) {
2338
+ throw e instanceof p ? e : new p("Failed to sync file system", "SYNC_FAILED", void 0, e);
2340
2339
  }
2341
2340
  }
2342
2341
  }
2343
2342
  typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && K(new es());
2344
- //# sourceMappingURL=worker-CLvhwwfc.js.map
2345
- `,h=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",c],{type:"text/javascript;charset=utf-8"});function d(s){let n;try{if(n=h&&(self.URL||self.webkitURL).createObjectURL(h),!n)throw"";const t=new Worker(n,{type:"module",name:s?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(n)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(c),{type:"module",name:s?.name})}}class l{#n;constructor(n){const t=f.wrap(new d);this.#n=t,n&&(n.broadcastChannel&&n.broadcastChannel instanceof BroadcastChannel&&(n.broadcastChannel=n.broadcastChannel.name),this.setOptions(n))}async setOptions(n){return this.#n.setOptions(n)}async index(){return this.#n.index()}async readFile(n,t){const r=await this.#n.readFile(n);return t||(t=e.isBinaryFileExtension(n)?"binary":"utf-8"),t==="binary"?r:e.decodeBuffer(r,t)}async writeFile(n,t,r){r||(r=typeof t!="string"||e.isBinaryFileExtension(n)?"binary":"utf-8");const i=typeof t=="string"?e.encodeString(t,r):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.writeFile(n,i)}async appendFile(n,t,r){r||(r=typeof t!="string"||e.isBinaryFileExtension(n)?"binary":"utf-8");const i=typeof t=="string"?e.encodeString(t,r):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.appendFile(n,i)}async mkdir(n,t){return this.#n.mkdir(n,t)}async stat(n){return this.#n.stat(n)}async readDir(n){return this.#n.readDir(n)}async exists(n){return this.#n.exists(n)}async clear(n){return this.#n.clear(n)}async remove(n,t){return this.#n.remove(n,t)}async realpath(n){return this.#n.realpath(n)}async rename(n,t,r){return this.#n.rename(n,t,r)}async copy(n,t,r){return this.#n.copy(n,t,r)}watch(n,t){return this.#n.watch(n,t),()=>this.unwatch(n)}unwatch(n){this.#n.unwatch(n)}async open(n,t){return this.#n.open(n,t)}async close(n){return this.#n.close(n)}async read(n,t,r,i,o){const{bytesRead:a,buffer:p}=await this.#n.read(n,new Uint8Array(i),0,i,o);return a>0&&t.set(p.subarray(0,a),r),{bytesRead:a,buffer:t}}async write(n,t,r,i,o,a){return this.#n.write(n,t,r,i,o,a)}async fstat(n){return this.#n.fstat(n)}async ftruncate(n,t){return this.#n.ftruncate(n,t)}async fsync(n){return this.#n.fsync(n)}dispose(){this.#n.dispose()}async sync(n,t){return this.#n.sync(n,t)}async readText(n,t="utf-8"){const r=await this.#n.readFile(n);return e.decodeBuffer(r,t)}async writeText(n,t,r="utf-8"){const i=e.encodeString(t,r);return this.#n.writeFile(n,i)}async appendText(n,t,r="utf-8"){const i=e.encodeString(t,r);return this.#n.appendFile(n,i)}}function u(s){return new l(s)}exports.BINARY_FILE_EXTENSIONS=e.BINARY_FILE_EXTENSIONS;exports.DirectoryNotFoundError=e.DirectoryNotFoundError;exports.FileNotFoundError=e.FileNotFoundError;exports.OPFSError=e.OPFSError;exports.OPFSNotMountedError=e.OPFSNotMountedError;exports.OPFSNotSupportedError=e.OPFSNotSupportedError;exports.PathError=e.PathError;exports.PermissionError=e.PermissionError;exports.StorageError=e.StorageError;exports.TimeoutError=e.TimeoutError;exports.basename=e.basename;exports.buffersEqual=e.buffersEqual;exports.calculateFileHash=e.calculateFileHash;exports.calculateReadLength=e.calculateReadLength;exports.checkOPFSSupport=e.checkOPFSSupport;exports.convertBlobToUint8Array=e.convertBlobToUint8Array;exports.createBuffer=e.createBuffer;exports.createFDError=e.createFDError;exports.createSyncHandleSafe=e.createSyncHandleSafe;exports.decodeBuffer=e.decodeBuffer;exports.dirname=e.dirname;exports.encodeString=e.encodeString;exports.extname=e.extname;exports.isBinaryFileExtension=e.isBinaryFileExtension;exports.isPathExcluded=e.isPathExcluded;exports.joinPath=e.joinPath;exports.mapDomError=e.mapDomError;exports.matchMinimatch=e.matchMinimatch;exports.normalizeMinimatch=e.normalizeMinimatch;exports.normalizePath=e.normalizePath;exports.removeEntry=e.removeEntry;exports.resolvePath=e.resolvePath;exports.safeCloseSyncHandle=e.safeCloseSyncHandle;exports.splitPath=e.splitPath;exports.validateReadWriteArgs=e.validateReadWriteArgs;exports.withLock=e.withLock;exports.OPFSFileSystem=l;exports.createWorker=u;
2343
+ //# sourceMappingURL=worker-BuPeqKqw.js.map
2344
+ `,c=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",l],{type:"text/javascript;charset=utf-8"});function u(o){let n;try{if(n=c&&(self.URL||self.webkitURL).createObjectURL(c),!n)throw"";const t=new Worker(n,{type:"module",name:o?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(n)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(l),{type:"module",name:o?.name})}}function s(o){return o instanceof URL?o.pathname:o}class p{#n;constructor(n){const t=d.wrap(new u);this.#n=t,n&&(n.broadcastChannel&&n.broadcastChannel instanceof BroadcastChannel&&(n.broadcastChannel=n.broadcastChannel.name),this.setOptions(n))}async setOptions(n){return this.#n.setOptions(n)}async index(){return this.#n.index()}async readFile(n,t){const r=s(n),i=await this.#n.readFile(r);return t||(t=e.isBinaryFileExtension(r)?"binary":"utf-8"),t==="binary"?i:e.decodeBuffer(i,t)}async writeFile(n,t,r){const i=s(n);r||(r=typeof t!="string"||e.isBinaryFileExtension(i)?"binary":"utf-8");const a=typeof t=="string"?e.encodeString(t,r):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.writeFile(i,a)}async appendFile(n,t,r){const i=s(n);r||(r=typeof t!="string"||e.isBinaryFileExtension(i)?"binary":"utf-8");const a=typeof t=="string"?e.encodeString(t,r):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.appendFile(i,a)}async mkdir(n,t){const r=s(n);return this.#n.mkdir(r,t)}async stat(n){const t=s(n);return this.#n.stat(t)}async readDir(n){const t=s(n);return this.#n.readDir(t)}async exists(n){const t=s(n);return this.#n.exists(t)}async clear(n){const t=n?s(n):void 0;return this.#n.clear(t)}async remove(n,t){const r=s(n);return this.#n.remove(r,t)}async realpath(n){const t=s(n);return this.#n.realpath(t)}async rename(n,t,r){const i=s(n),a=s(t);return this.#n.rename(i,a,r)}async copy(n,t,r){const i=s(n),a=s(t);return this.#n.copy(i,a,r)}watch(n,t){const r=s(n);return this.#n.watch(r,t),()=>this.unwatch(r)}unwatch(n){const t=s(n);this.#n.unwatch(t)}async open(n,t){const r=s(n);return this.#n.open(r,t)}async close(n){return this.#n.close(n)}async read(n,t,r,i,a){const{bytesRead:h,buffer:f}=await this.#n.read(n,new Uint8Array(i),0,i,a);return h>0&&t.set(f.subarray(0,h),r),{bytesRead:h,buffer:t}}async write(n,t,r,i,a,h){return this.#n.write(n,t,r,i,a,h)}async fstat(n){return this.#n.fstat(n)}async ftruncate(n,t){return this.#n.ftruncate(n,t)}async fsync(n){return this.#n.fsync(n)}dispose(){this.#n.dispose()}async createIndex(n){const t=n.map(([r,i])=>[s(r),i]);return this.#n.createIndex(t)}async readText(n,t="utf-8"){const r=s(n),i=await this.#n.readFile(r);return e.decodeBuffer(i,t)}async writeText(n,t,r="utf-8"){const i=s(n),a=e.encodeString(t,r);return this.#n.writeFile(i,a)}async appendText(n,t,r="utf-8"){const i=s(n),a=e.encodeString(t,r);return this.#n.appendFile(i,a)}}function m(o){return new p(o)}exports.BINARY_FILE_EXTENSIONS=e.BINARY_FILE_EXTENSIONS;exports.DirectoryNotFoundError=e.DirectoryNotFoundError;exports.FileNotFoundError=e.FileNotFoundError;exports.OPFSError=e.OPFSError;exports.OPFSNotMountedError=e.OPFSNotMountedError;exports.OPFSNotSupportedError=e.OPFSNotSupportedError;exports.PathError=e.PathError;exports.PermissionError=e.PermissionError;exports.StorageError=e.StorageError;exports.TimeoutError=e.TimeoutError;exports.basename=e.basename;exports.buffersEqual=e.buffersEqual;exports.calculateFileHash=e.calculateFileHash;exports.calculateReadLength=e.calculateReadLength;exports.checkOPFSSupport=e.checkOPFSSupport;exports.convertBlobToUint8Array=e.convertBlobToUint8Array;exports.createBuffer=e.createBuffer;exports.createFDError=e.createFDError;exports.createSyncHandleSafe=e.createSyncHandleSafe;exports.decodeBuffer=e.decodeBuffer;exports.dirname=e.dirname;exports.encodeString=e.encodeString;exports.extname=e.extname;exports.isBinaryFileExtension=e.isBinaryFileExtension;exports.isPathExcluded=e.isPathExcluded;exports.joinPath=e.joinPath;exports.mapDomError=e.mapDomError;exports.matchMinimatch=e.matchMinimatch;exports.normalizeMinimatch=e.normalizeMinimatch;exports.normalizePath=e.normalizePath;exports.removeEntry=e.removeEntry;exports.resolvePath=e.resolvePath;exports.safeCloseSyncHandle=e.safeCloseSyncHandle;exports.splitPath=e.splitPath;exports.validateReadWriteArgs=e.validateReadWriteArgs;exports.withLock=e.withLock;exports.OPFSFileSystem=p;exports.createWorker=m;
2346
2345
  //# sourceMappingURL=index.cjs.map