opfs-worker 0.5.1 → 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.
@@ -13,12 +13,12 @@ class me extends x {
13
13
  super("OPFS is not mounted", "OPFS_NOT_MOUNTED", void 0, t);
14
14
  }
15
15
  }
16
- class ye extends x {
16
+ class we extends x {
17
17
  constructor(t, e, n) {
18
18
  super(t, "INVALID_PATH", e, n);
19
19
  }
20
20
  }
21
- class we extends x {
21
+ class ye extends x {
22
22
  constructor(t, e) {
23
23
  super(`File not found: ${t}`, "FILE_NOT_FOUND", t, e);
24
24
  }
@@ -77,10 +77,10 @@ const H = (s, t, e) => {
77
77
  function L(s) {
78
78
  return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
79
79
  }
80
- function yt(s) {
80
+ function wt(s) {
81
81
  return s.replace(ft, Z).replace(pt, J).replace(dt, F).replace(gt, V).replace(mt, X);
82
82
  }
83
- function wt(s) {
83
+ function yt(s) {
84
84
  return s.replace(ct, "\\").replace(at, "{").replace(ht, "}").replace(lt, ",").replace(ut, ".");
85
85
  }
86
86
  function Y(s) {
@@ -95,7 +95,7 @@ function Y(s) {
95
95
  return r.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
96
96
  }
97
97
  function Et(s) {
98
- return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(yt(s), !0).map(wt)) : [];
98
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(wt(s), !0).map(yt)) : [];
99
99
  }
100
100
  function xt(s) {
101
101
  return "{" + s + "}";
@@ -235,7 +235,7 @@ const vt = 1024 * 64, C = (s) => {
235
235
  const f = "[" + (l ? "^" : "") + k(n) + "]", u = "[" + (l ? "" : "^") + k(i) + "]";
236
236
  return [n.length && i.length ? "(" + f + "|" + u + ")" : n.length ? f : u, a, c - e, !0];
237
237
  }, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"), Tt = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), z = (s) => Tt.has(s), Mt = "(?!(?:^|/)\\.\\.?(?:$|/))", R = "(?!\\.)", Pt = /* @__PURE__ */ new Set(["[", "."]), Rt = /* @__PURE__ */ new Set(["..", "."]), Ct = new Set("().*{}+?[]^$\\!"), Dt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), j = "[^/]", _ = j + "*?", B = j + "+?";
238
- class w {
238
+ class y {
239
239
  type;
240
240
  #s;
241
241
  #n;
@@ -291,7 +291,7 @@ class w {
291
291
  push(...t) {
292
292
  for (const e of t)
293
293
  if (e !== "") {
294
- if (typeof e != "string" && !(e instanceof w && e.#e === this))
294
+ if (typeof e != "string" && !(e instanceof y && e.#e === this))
295
295
  throw new Error("invalid part: " + e);
296
296
  this.#t.push(e);
297
297
  }
@@ -310,7 +310,7 @@ class w {
310
310
  const t = this.#e;
311
311
  for (let e = 0; e < this.#o; e++) {
312
312
  const n = t.#t[e];
313
- if (!(n instanceof w && n.type === "!"))
313
+ if (!(n instanceof y && n.type === "!"))
314
314
  return !1;
315
315
  }
316
316
  return !0;
@@ -329,7 +329,7 @@ class w {
329
329
  typeof t == "string" ? this.push(t) : this.push(t.clone(this));
330
330
  }
331
331
  clone(t) {
332
- const e = new w(this.type, t);
332
+ const e = new y(this.type, t);
333
333
  for (const n of this.#t)
334
334
  e.copyIn(n);
335
335
  return e;
@@ -353,15 +353,15 @@ class w {
353
353
  }
354
354
  if (!i.noext && z(d) && t.charAt(u) === "(") {
355
355
  e.push(g), g = "";
356
- const E = new w(d, e);
357
- u = w.#l(t, E, u, i), e.push(E);
356
+ const E = new y(d, e);
357
+ u = y.#l(t, E, u, i), e.push(E);
358
358
  continue;
359
359
  }
360
360
  g += d;
361
361
  }
362
362
  return e.push(g), u;
363
363
  }
364
- let l = n + 1, c = new w(null, e);
364
+ let l = n + 1, c = new y(null, e);
365
365
  const p = [];
366
366
  let f = "";
367
367
  for (; l < t.length; ) {
@@ -379,12 +379,12 @@ class w {
379
379
  }
380
380
  if (z(u) && t.charAt(l) === "(") {
381
381
  c.push(f), f = "";
382
- const g = new w(u, c);
383
- c.push(g), l = w.#l(t, g, l, i);
382
+ const g = new y(u, c);
383
+ c.push(g), l = y.#l(t, g, l, i);
384
384
  continue;
385
385
  }
386
386
  if (u === "|") {
387
- c.push(f), f = "", p.push(c), c = new w(null, e);
387
+ c.push(f), f = "", p.push(c), c = new y(null, e);
388
388
  continue;
389
389
  }
390
390
  if (u === ")")
@@ -394,8 +394,8 @@ class w {
394
394
  return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)], l;
395
395
  }
396
396
  static fromGlob(t, e = {}) {
397
- const n = new w(null, void 0, e);
398
- return w.#l(t, n, 0, e), n;
397
+ const n = new y(null, void 0, e);
398
+ return y.#l(t, n, 0, e), n;
399
399
  }
400
400
  // returns the regular expression if there's magic, or the unescaped
401
401
  // string if not.
@@ -487,7 +487,7 @@ class w {
487
487
  const e = t ?? !!this.#i.dot;
488
488
  if (this.#s === this && this.#p(), !this.type) {
489
489
  const h = this.isStart() && this.isEnd(), l = this.#t.map((u) => {
490
- const [g, d, E, v] = typeof u == "string" ? w.#d(u, this.#n, h) : u.toRegExpSource(t);
490
+ const [g, d, E, v] = typeof u == "string" ? y.#d(u, this.#n, h) : u.toRegExpSource(t);
491
491
  return this.#n = this.#n || E, this.#r = this.#r || v, g;
492
492
  }).join("");
493
493
  let c = "";
@@ -573,7 +573,7 @@ class w {
573
573
  return [r, M(t), !!e, o];
574
574
  }
575
575
  }
576
- const Lt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), y = (s, t, e = {}) => (C(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(s)), Ft = /^\*+([^+@!?\*\[\(]*)$/, jt = (s) => (t) => !t.startsWith(".") && t.endsWith(s), It = (s) => (t) => t.endsWith(s), Ut = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Wt = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), kt = /^\*+\.\*+$/, zt = (s) => !s.startsWith(".") && s.includes("."), _t = (s) => s !== "." && s !== ".." && s.includes("."), Bt = /^\.\*+$/, qt = (s) => s !== "." && s !== ".." && s.startsWith("."), Gt = /^\*+$/, Ht = (s) => s.length !== 0 && !s.startsWith("."), Zt = (s) => s.length !== 0 && s !== "." && s !== "..", Jt = /^\?+([^+@!?\*\[\(]*)?$/, Vt = ([s, t = ""]) => {
576
+ const Lt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), w = (s, t, e = {}) => (C(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(s)), Ft = /^\*+([^+@!?\*\[\(]*)$/, jt = (s) => (t) => !t.startsWith(".") && t.endsWith(s), It = (s) => (t) => t.endsWith(s), Ut = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Wt = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), kt = /^\*+\.\*+$/, zt = (s) => !s.startsWith(".") && s.includes("."), _t = (s) => s !== "." && s !== ".." && s.includes("."), Bt = /^\.\*+$/, qt = (s) => s !== "." && s !== ".." && s.startsWith("."), Gt = /^\*+$/, Ht = (s) => s.length !== 0 && !s.startsWith("."), Zt = (s) => s.length !== 0 && s !== "." && s !== "..", Jt = /^\?+([^+@!?\*\[\(]*)?$/, Vt = ([s, t = ""]) => {
577
577
  const e = K([s]);
578
578
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
579
579
  }, Xt = ([s, t = ""]) => {
@@ -595,15 +595,15 @@ const Lt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]
595
595
  win32: { sep: "\\" },
596
596
  posix: { sep: "/" }
597
597
  }, Qt = tt === "win32" ? q.win32.sep : q.posix.sep;
598
- y.sep = Qt;
598
+ w.sep = Qt;
599
599
  const O = Symbol("globstar **");
600
- y.GLOBSTAR = O;
601
- const te = "[^/]", ee = te + "*?", se = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", ne = "(?:(?!(?:\\/|^)\\.).)*?", ie = (s, t = {}) => (e) => y(e, s, t);
602
- y.filter = ie;
600
+ w.GLOBSTAR = O;
601
+ const te = "[^/]", ee = te + "*?", se = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", ne = "(?:(?!(?:\\/|^)\\.).)*?", ie = (s, t = {}) => (e) => w(e, s, t);
602
+ w.filter = ie;
603
603
  const b = (s, t = {}) => Object.assign({}, s, t), re = (s) => {
604
604
  if (!s || typeof s != "object" || !Object.keys(s).length)
605
- return y;
606
- const t = y;
605
+ return w;
606
+ const t = w;
607
607
  return Object.assign((n, i, r = {}) => t(n, i, b(s, r)), {
608
608
  Minimatch: class extends t.Minimatch {
609
609
  constructor(i, r = {}) {
@@ -634,16 +634,16 @@ const b = (s, t = {}) => Object.assign({}, s, t), re = (s) => {
634
634
  GLOBSTAR: O
635
635
  });
636
636
  };
637
- y.defaults = re;
637
+ w.defaults = re;
638
638
  const et = (s, t = {}) => (C(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : Et(s));
639
- y.braceExpand = et;
639
+ w.braceExpand = et;
640
640
  const oe = (s, t = {}) => new D(s, t).makeRe();
641
- y.makeRe = oe;
641
+ w.makeRe = oe;
642
642
  const ce = (s, t, e = {}) => {
643
643
  const n = new D(t, e);
644
644
  return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
645
645
  };
646
- y.match = ce;
646
+ w.match = ce;
647
647
  const G = /[?*]|[+@!]\(.*?\)|\[|\]/, ae = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
648
648
  class D {
649
649
  options;
@@ -932,7 +932,7 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
932
932
  return "";
933
933
  let n, i = null;
934
934
  (n = t.match(Gt)) ? i = e.dot ? Zt : Ht : (n = t.match(Ft)) ? i = (e.nocase ? e.dot ? Wt : Ut : e.dot ? It : jt)(n[1]) : (n = t.match(Jt)) ? i = (e.nocase ? e.dot ? Xt : Vt : e.dot ? Yt : Kt)(n) : (n = t.match(kt)) ? i = e.dot ? _t : zt : (n = t.match(Bt)) && (i = qt);
935
- const r = w.fromGlob(t, this.options).toMMPattern();
935
+ const r = y.fromGlob(t, this.options).toMMPattern();
936
936
  return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
937
937
  }
938
938
  makeRe() {
@@ -992,13 +992,13 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
992
992
  return n.flipNegate ? !1 : this.negate;
993
993
  }
994
994
  static defaults(t) {
995
- return y.defaults(t).Minimatch;
995
+ return w.defaults(t).Minimatch;
996
996
  }
997
997
  }
998
- y.AST = w;
999
- y.Minimatch = D;
1000
- y.escape = Lt;
1001
- y.unescape = M;
998
+ w.AST = y;
999
+ w.Minimatch = D;
1000
+ w.escape = Lt;
1001
+ w.unescape = M;
1002
1002
  function he(s, t = "utf-8") {
1003
1003
  switch (t) {
1004
1004
  case "utf8":
@@ -1030,13 +1030,12 @@ function Ae(s, t = "utf-8") {
1030
1030
  case "utf-8":
1031
1031
  return new TextDecoder().decode(s);
1032
1032
  case "utf16le":
1033
+ case "utf-16le":
1033
1034
  case "ucs2":
1034
1035
  case "ucs-2":
1035
1036
  return ue(s);
1036
1037
  case "latin1":
1037
1038
  return String.fromCharCode(...s);
1038
- case "binary":
1039
- return String.fromCharCode(...s);
1040
1039
  case "ascii":
1041
1040
  return String.fromCharCode(...s.map((e) => e & 127));
1042
1041
  case "base64":
@@ -1163,7 +1162,7 @@ function Me(s, t = !1) {
1163
1162
  return s = s.replace(/\/$/, ""), t && !s.includes("*") ? `${s}/**` : s;
1164
1163
  }
1165
1164
  function Pe(s, t) {
1166
- return y(s, t, {
1165
+ return w(s, t, {
1167
1166
  dot: !0,
1168
1167
  matchBase: !0
1169
1168
  });
@@ -1172,7 +1171,7 @@ function Re(s, t) {
1172
1171
  if (!t || Array.isArray(t) && t.length === 0)
1173
1172
  return !1;
1174
1173
  const e = it(s);
1175
- return (Array.isArray(t) ? t : [t]).some((i) => y(e, i, { dot: !0 }));
1174
+ return (Array.isArray(t) ? t : [t]).some((i) => w(e, i, { dot: !0 }));
1176
1175
  }
1177
1176
  function Ce(s) {
1178
1177
  const t = it(s), e = U(t), n = [];
@@ -1242,6 +1241,7 @@ async function We(s, t, e = {}) {
1242
1241
  const n = nt(t);
1243
1242
  return I(t, "exclusive", async () => {
1244
1243
  const i = e.recursive ?? !1, r = e.force ?? !1;
1244
+ e.useTrash;
1245
1245
  try {
1246
1246
  await s.removeEntry(n, { recursive: i });
1247
1247
  } catch (o) {
@@ -1255,9 +1255,9 @@ async function We(s, t, e = {}) {
1255
1255
  export {
1256
1256
  de as B,
1257
1257
  Ee as D,
1258
- we as F,
1258
+ ye as F,
1259
1259
  x as O,
1260
- ye as P,
1260
+ we as P,
1261
1261
  Se as S,
1262
1262
  be as T,
1263
1263
  rt as a,
@@ -1286,4 +1286,4 @@ export {
1286
1286
  he as x,
1287
1287
  Ae as y
1288
1288
  };
1289
- //# sourceMappingURL=helpers-DcIl7KL0.js.map
1289
+ //# sourceMappingURL=helpers-CTCvNFs1.js.map