opfs-worker 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/worker-BeJaVyBV.js.map +1 -0
- package/dist/helpers-CIiblZ8d.cjs +4 -0
- package/dist/helpers-CIiblZ8d.cjs.map +1 -0
- package/dist/helpers-CKOebsbw.js +1423 -0
- package/dist/helpers-CKOebsbw.js.map +1 -0
- package/dist/index.cjs +46 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +74 -80
- package/dist/index.js.map +1 -1
- package/dist/raw.cjs +1 -1
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.js +12 -12
- package/dist/raw.js.map +1 -1
- package/dist/utils/errors.d.ts +2 -14
- package/dist/utils/errors.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("comlink"),e=require("./helpers-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("comlink"),e=require("./helpers-CIiblZ8d.cjs"),l=`/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
const bt = Symbol("Comlink.proxy"), Ht = Symbol("Comlink.endpoint"), Wt = Symbol("Comlink.releaseProxy"), J = Symbol("Comlink.finalizer"), U = Symbol("Comlink.thrown"), Ot = (s) => typeof s == "object" && s !== null || typeof s == "function",
|
|
6
|
+
const bt = Symbol("Comlink.proxy"), Ht = Symbol("Comlink.endpoint"), Wt = Symbol("Comlink.releaseProxy"), J = Symbol("Comlink.finalizer"), U = Symbol("Comlink.thrown"), Ot = (s) => typeof s == "object" && s !== null || typeof s == "function", jt = {
|
|
7
7
|
canHandle: (s) => Ot(s) && s[bt],
|
|
8
8
|
serialize(s) {
|
|
9
9
|
const { port1: t, port2: e } = new MessageChannel();
|
|
@@ -12,7 +12,7 @@ const bt = Symbol("Comlink.proxy"), Ht = Symbol("Comlink.endpoint"), Wt = Symbol
|
|
|
12
12
|
deserialize(s) {
|
|
13
13
|
return s.start(), Gt(s);
|
|
14
14
|
}
|
|
15
|
-
},
|
|
15
|
+
}, _t = {
|
|
16
16
|
canHandle: (s) => Ot(s) && U in s,
|
|
17
17
|
serialize({ value: s }) {
|
|
18
18
|
let t;
|
|
@@ -29,8 +29,8 @@ const bt = Symbol("Comlink.proxy"), Ht = Symbol("Comlink.endpoint"), Wt = Symbol
|
|
|
29
29
|
throw s.isError ? Object.assign(new Error(s.value.message), s.value) : s.value;
|
|
30
30
|
}
|
|
31
31
|
}, Dt = /* @__PURE__ */ new Map([
|
|
32
|
-
["proxy",
|
|
33
|
-
["throw",
|
|
32
|
+
["proxy", jt],
|
|
33
|
+
["throw", _t]
|
|
34
34
|
]);
|
|
35
35
|
function Ut(s, t) {
|
|
36
36
|
for (const e of s)
|
|
@@ -288,7 +288,7 @@ class w extends Error {
|
|
|
288
288
|
}
|
|
289
289
|
class Qt extends w {
|
|
290
290
|
constructor(t) {
|
|
291
|
-
super("OPFS is not supported in this browser", "
|
|
291
|
+
super("OPFS is not supported in this browser", "ENOTSUP", void 0, void 0, t);
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
class Kt extends w {
|
|
@@ -308,7 +308,7 @@ class F extends w {
|
|
|
308
308
|
}
|
|
309
309
|
class te extends w {
|
|
310
310
|
constructor(t, e, n) {
|
|
311
|
-
super(\`Permission denied for \${e} on: \${t}\`, "
|
|
311
|
+
super(\`Permission denied for \${e} on: \${t}\`, "EACCES", t, e, n);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
class ee extends w {
|
|
@@ -321,10 +321,10 @@ class se extends w {
|
|
|
321
321
|
super(\`File is busy: \${t}\`, "EBUSY", t, "open", e);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
class
|
|
325
|
-
constructor(t, e, n
|
|
326
|
-
const
|
|
327
|
-
super(
|
|
324
|
+
class z extends w {
|
|
325
|
+
constructor(t, e, n) {
|
|
326
|
+
const r = t === "directory" ? \`Is a directory: \${e}\` : \`Not a directory: \${e}\`, i = t === "directory" ? "EISDIR" : "ENOTDIR";
|
|
327
|
+
super(r, i, e, "access", n);
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
class N extends w {
|
|
@@ -356,15 +356,11 @@ class Ct extends w {
|
|
|
356
356
|
class rt extends w {
|
|
357
357
|
constructor(t, e, n) {
|
|
358
358
|
const r = {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}, i = {
|
|
363
|
-
remove: "RM_FAILED",
|
|
364
|
-
clear: "ENOTEMPTY",
|
|
365
|
-
root: "EROOT"
|
|
359
|
+
RM_FAILED: \`Failed to remove entry: \${e}\`,
|
|
360
|
+
ENOTEMPTY: \`Directory not empty: \${e}. Use recursive option to force removal.\`,
|
|
361
|
+
EROOT: "Cannot remove root directory"
|
|
366
362
|
};
|
|
367
|
-
super(r[t]
|
|
363
|
+
super(r[t] || \`Directory operation failed: \${e}\`, t, e, "unlink", n);
|
|
368
364
|
}
|
|
369
365
|
}
|
|
370
366
|
class re extends w {
|
|
@@ -382,7 +378,7 @@ class K extends w {
|
|
|
382
378
|
super(\`Destination already exists: \${t}\`, "EEXIST", t, "open", e);
|
|
383
379
|
}
|
|
384
380
|
}
|
|
385
|
-
function
|
|
381
|
+
function j(s, t, e, n) {
|
|
386
382
|
const r = \`\${s.toUpperCase()}_FAILED\`;
|
|
387
383
|
return new w(\`Failed to \${s} file descriptor: \${t}\`, r, e, s, n);
|
|
388
384
|
}
|
|
@@ -396,7 +392,7 @@ function A(s, t) {
|
|
|
396
392
|
case "NotFoundError":
|
|
397
393
|
return new F("file", e, s);
|
|
398
394
|
case "TypeMismatchError":
|
|
399
|
-
return n !== void 0 ? n ? new
|
|
395
|
+
return n !== void 0 ? n ? new z("directory", e || "unknown", s) : new z("file", e || "unknown", s) : new N("argument", \`Type mismatch: \${e || "unknown"}\`, e, s);
|
|
400
396
|
case "NotAllowedError":
|
|
401
397
|
case "SecurityError":
|
|
402
398
|
return new te(e, "unknown", s);
|
|
@@ -603,7 +599,7 @@ const Oe = 1024 * 64, Z = (s) => {
|
|
|
603
599
|
}
|
|
604
600
|
const u = "[" + (h ? "^" : "") + dt(n) + "]", d = "[" + (h ? "" : "^") + dt(r) + "]";
|
|
605
601
|
return [n.length && r.length ? "(" + u + "|" + d + ")" : n.length ? u : d, a, c - e, !0];
|
|
606
|
-
}, k = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), Ne = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), pt = (s) => Ne.has(s), Ce = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))",
|
|
602
|
+
}, k = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), Ne = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), pt = (s) => Ne.has(s), Ce = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", _ = "(?!\\\\.)", Fe = /* @__PURE__ */ new Set(["[", "."]), $e = /* @__PURE__ */ new Set(["..", "."]), Me = new Set("().*{}+?[]^$\\\\!"), Pe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), ct = "[^/]", gt = ct + "*?", wt = ct + "+?";
|
|
607
603
|
class E {
|
|
608
604
|
type;
|
|
609
605
|
#s;
|
|
@@ -867,7 +863,7 @@ class E {
|
|
|
867
863
|
h.startsWith("\\\\.") && g.has(h.charAt(2)) || // the pattern starts with \\.\\., and then [ or .
|
|
868
864
|
h.startsWith("\\\\.\\\\.") && g.has(h.charAt(4))
|
|
869
865
|
), S = !e && !t && g.has(h.charAt(0));
|
|
870
|
-
c = p ? Ce : S ?
|
|
866
|
+
c = p ? Ce : S ? _ : "";
|
|
871
867
|
}
|
|
872
868
|
let f = "";
|
|
873
869
|
return this.isEnd() && this.#s.#a && this.#e?.type === "!" && (f = "(?:$|\\\\/)"), [
|
|
@@ -883,15 +879,15 @@ class E {
|
|
|
883
879
|
const l = this.toString();
|
|
884
880
|
return this.#t = [l], this.type = null, this.#n = void 0, [l, k(this.toString()), !1, !1];
|
|
885
881
|
}
|
|
886
|
-
let o = !n || t || e || !
|
|
882
|
+
let o = !n || t || e || !_ ? "" : this.#f(!0);
|
|
887
883
|
o === i && (o = ""), o && (i = \`(?:\${i})(?:\${o})*?\`);
|
|
888
884
|
let a = "";
|
|
889
885
|
if (this.type === "!" && this.#u)
|
|
890
|
-
a = (this.isStart() && !e ?
|
|
886
|
+
a = (this.isStart() && !e ? _ : "") + wt;
|
|
891
887
|
else {
|
|
892
888
|
const l = this.type === "!" ? (
|
|
893
889
|
// !() must match something,but !(x) can match ''
|
|
894
|
-
"))" + (this.isStart() && !e && !t ?
|
|
890
|
+
"))" + (this.isStart() && !e && !t ? _ : "") + gt + ")"
|
|
895
891
|
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : \`)\${this.type}\`;
|
|
896
892
|
a = r + i + l;
|
|
897
893
|
}
|
|
@@ -942,7 +938,7 @@ class E {
|
|
|
942
938
|
return [i, k(t), !!e, o];
|
|
943
939
|
}
|
|
944
940
|
}
|
|
945
|
-
const Te = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (s, t, e = {}) => (Z(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new X(t, e).match(s)), Re = /^\\*+([^+@!?\\*\\[\\(]*)$/, Ie = (s) => (t) => !t.startsWith(".") && t.endsWith(s), ke = (s) => (t) => t.endsWith(s),
|
|
941
|
+
const Te = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (s, t, e = {}) => (Z(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new X(t, e).match(s)), Re = /^\\*+([^+@!?\\*\\[\\(]*)$/, Ie = (s) => (t) => !t.startsWith(".") && t.endsWith(s), ke = (s) => (t) => t.endsWith(s), Le = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), ze = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), He = /^\\*+\\.\\*+$/, We = (s) => !s.startsWith(".") && s.includes("."), je = (s) => s !== "." && s !== ".." && s.includes("."), _e = /^\\.\\*+$/, Ue = (s) => s !== "." && s !== ".." && s.startsWith("."), Be = /^\\*+$/, Ge = (s) => s.length !== 0 && !s.startsWith("."), qe = (s) => s.length !== 0 && s !== "." && s !== "..", Ve = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Ye = ([s, t = ""]) => {
|
|
946
942
|
const e = It([s]);
|
|
947
943
|
return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
|
|
948
944
|
}, Ze = ([s, t = ""]) => {
|
|
@@ -960,10 +956,10 @@ const Te = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\
|
|
|
960
956
|
}, kt = ([s]) => {
|
|
961
957
|
const t = s.length;
|
|
962
958
|
return (e) => e.length === t && e !== "." && e !== "..";
|
|
963
|
-
},
|
|
959
|
+
}, Lt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", mt = {
|
|
964
960
|
win32: { sep: "\\\\" },
|
|
965
961
|
posix: { sep: "/" }
|
|
966
|
-
}, Qe =
|
|
962
|
+
}, Qe = Lt === "win32" ? mt.win32.sep : mt.posix.sep;
|
|
967
963
|
y.sep = Qe;
|
|
968
964
|
const O = Symbol("globstar **");
|
|
969
965
|
y.GLOBSTAR = O;
|
|
@@ -1004,8 +1000,8 @@ const b = (s, t = {}) => Object.assign({}, s, t), rs = (s) => {
|
|
|
1004
1000
|
});
|
|
1005
1001
|
};
|
|
1006
1002
|
y.defaults = rs;
|
|
1007
|
-
const
|
|
1008
|
-
y.braceExpand =
|
|
1003
|
+
const zt = (s, t = {}) => (Z(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : ye(s));
|
|
1004
|
+
y.braceExpand = zt;
|
|
1009
1005
|
const is = (s, t = {}) => new X(s, t).makeRe();
|
|
1010
1006
|
y.makeRe = is;
|
|
1011
1007
|
const os = (s, t, e = {}) => {
|
|
@@ -1033,7 +1029,7 @@ class X {
|
|
|
1033
1029
|
windowsNoMagicRoot;
|
|
1034
1030
|
regexp;
|
|
1035
1031
|
constructor(t, e = {}) {
|
|
1036
|
-
Z(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform ||
|
|
1032
|
+
Z(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Lt, 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();
|
|
1037
1033
|
}
|
|
1038
1034
|
hasMagic() {
|
|
1039
1035
|
if (this.options.magicalBraces && this.set.length > 1)
|
|
@@ -1290,7 +1286,7 @@ globstar while\`, t, u, e, d, g), this.matchOne(t.slice(u), e.slice(d), n))
|
|
|
1290
1286
|
throw new Error("wtf?");
|
|
1291
1287
|
}
|
|
1292
1288
|
braceExpand() {
|
|
1293
|
-
return
|
|
1289
|
+
return zt(this.pattern, this.options);
|
|
1294
1290
|
}
|
|
1295
1291
|
parse(t) {
|
|
1296
1292
|
Z(t);
|
|
@@ -1300,7 +1296,7 @@ globstar while\`, t, u, e, d, g), this.matchOne(t.slice(u), e.slice(d), n))
|
|
|
1300
1296
|
if (t === "")
|
|
1301
1297
|
return "";
|
|
1302
1298
|
let n, r = null;
|
|
1303
|
-
(n = t.match(Be)) ? r = e.dot ? qe : Ge : (n = t.match(Re)) ? r = (e.nocase ? e.dot ?
|
|
1299
|
+
(n = t.match(Be)) ? r = e.dot ? qe : Ge : (n = t.match(Re)) ? r = (e.nocase ? e.dot ? ze : Le : e.dot ? ke : Ie)(n[1]) : (n = t.match(Ve)) ? r = (e.nocase ? e.dot ? Ze : Ye : e.dot ? Xe : Je)(n) : (n = t.match(He)) ? r = e.dot ? je : We : (n = t.match(_e)) && (r = Ue);
|
|
1304
1300
|
const i = E.fromGlob(t, this.options).toMMPattern();
|
|
1305
1301
|
return r && typeof i == "object" && Reflect.defineProperty(i, "test", { value: r }), i;
|
|
1306
1302
|
}
|
|
@@ -1372,7 +1368,7 @@ function cs() {
|
|
|
1372
1368
|
if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
|
|
1373
1369
|
throw new Qt();
|
|
1374
1370
|
}
|
|
1375
|
-
async function
|
|
1371
|
+
async function L(s, t, e) {
|
|
1376
1372
|
return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(\`opfs:\${s.replace(/\\/+/g, "/")}\`, { mode: t }, e) : e();
|
|
1377
1373
|
}
|
|
1378
1374
|
function M(s) {
|
|
@@ -1425,7 +1421,7 @@ async function us(s) {
|
|
|
1425
1421
|
}
|
|
1426
1422
|
async function fs(s, t, e = {}) {
|
|
1427
1423
|
const n = it(t);
|
|
1428
|
-
return
|
|
1424
|
+
return L(t, "exclusive", async () => {
|
|
1429
1425
|
const r = e.recursive ?? !1, i = e.force ?? !1;
|
|
1430
1426
|
try {
|
|
1431
1427
|
await s.removeEntry(n, { recursive: r });
|
|
@@ -1433,7 +1429,7 @@ async function fs(s, t, e = {}) {
|
|
|
1433
1429
|
if (o.name === "NotFoundError") {
|
|
1434
1430
|
if (!i)
|
|
1435
1431
|
throw new F("file", t, o);
|
|
1436
|
-
} else throw o.name === "InvalidModificationError" ? new rt("
|
|
1432
|
+
} else throw o.name === "InvalidModificationError" ? new rt("ENOTEMPTY", t, o) : o.name === "TypeMismatchError" && !r ? new z("directory", t, o) : new rt("RM_FAILED", t, o);
|
|
1437
1433
|
}
|
|
1438
1434
|
});
|
|
1439
1435
|
}
|
|
@@ -1706,7 +1702,7 @@ class gs {
|
|
|
1706
1702
|
async readFile(t) {
|
|
1707
1703
|
await this.mount();
|
|
1708
1704
|
try {
|
|
1709
|
-
return await
|
|
1705
|
+
return await L(t, "shared", async () => {
|
|
1710
1706
|
const e = await this.open(t);
|
|
1711
1707
|
try {
|
|
1712
1708
|
const { size: n } = await this.fstat(e), r = new Uint8Array(n);
|
|
@@ -1744,7 +1740,7 @@ class gs {
|
|
|
1744
1740
|
async writeFile(t, e) {
|
|
1745
1741
|
await this.mount();
|
|
1746
1742
|
const n = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1747
|
-
await
|
|
1743
|
+
await L(t, "exclusive", async () => {
|
|
1748
1744
|
const r = await this.exists(t), i = await this.open(t, { create: !0, truncate: !0 });
|
|
1749
1745
|
try {
|
|
1750
1746
|
await this.write(i, n, 0, n.length, null, !1), await this.fsync(i);
|
|
@@ -1779,7 +1775,7 @@ class gs {
|
|
|
1779
1775
|
async appendFile(t, e) {
|
|
1780
1776
|
await this.mount();
|
|
1781
1777
|
const n = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1782
|
-
await
|
|
1778
|
+
await L(t, "exclusive", async () => {
|
|
1783
1779
|
const r = await this.open(t, { create: !0 });
|
|
1784
1780
|
try {
|
|
1785
1781
|
const { size: i } = await this.fstat(r);
|
|
@@ -1820,7 +1816,7 @@ class gs {
|
|
|
1820
1816
|
try {
|
|
1821
1817
|
i = await i.getDirectoryHandle(a, { create: n || o === r.length - 1 });
|
|
1822
1818
|
} catch (l) {
|
|
1823
|
-
throw l.name === "NotFoundError" ? new F("directory", lt(r.slice(0, o + 1)), l) : l.name === "TypeMismatchError" ? new
|
|
1819
|
+
throw l.name === "NotFoundError" ? new F("directory", lt(r.slice(0, o + 1)), l) : l.name === "TypeMismatchError" ? new z("file", a, l) : new Q("create directory", a, l);
|
|
1824
1820
|
}
|
|
1825
1821
|
}
|
|
1826
1822
|
await this.notifyChange({ path: t, type: D.Added, isDirectory: !0 });
|
|
@@ -2029,7 +2025,7 @@ class gs {
|
|
|
2029
2025
|
*/
|
|
2030
2026
|
async remove(t, e) {
|
|
2031
2027
|
if (await this.mount(), t === "/")
|
|
2032
|
-
throw new rt("
|
|
2028
|
+
throw new rt("EROOT", t);
|
|
2033
2029
|
const { recursive: n = !1, force: r = !1 } = e || {}, i = await this.getDirectoryHandle(et(t), !1), o = await this.stat(t);
|
|
2034
2030
|
await fs(i, t, { recursive: n, force: r }), await this.notifyChange({ path: t, type: D.Removed, isDirectory: o.isDirectory });
|
|
2035
2031
|
}
|
|
@@ -2133,7 +2129,7 @@ class gs {
|
|
|
2133
2129
|
await this.writeFile(e, h);
|
|
2134
2130
|
} else {
|
|
2135
2131
|
if (!r)
|
|
2136
|
-
throw new
|
|
2132
|
+
throw new z("directory", t);
|
|
2137
2133
|
await this.mkdir(e, { recursive: !0 });
|
|
2138
2134
|
const h = await this.readDir(t);
|
|
2139
2135
|
for (const c of h) {
|
|
@@ -2217,7 +2213,7 @@ class gs {
|
|
|
2217
2213
|
await this.mount();
|
|
2218
2214
|
const { create: n = !1, exclusive: r = !1, truncate: i = !1 } = e || {}, o = G(Et(t));
|
|
2219
2215
|
try {
|
|
2220
|
-
return n && r ? await
|
|
2216
|
+
return n && r ? await L(o, "exclusive", async () => {
|
|
2221
2217
|
if (await this.exists(o))
|
|
2222
2218
|
throw new K(o);
|
|
2223
2219
|
return this._openFile(o, n, i);
|
|
@@ -2299,7 +2295,7 @@ class gs {
|
|
|
2299
2295
|
const f = e.subarray(n, n + c), u = o.syncHandle.read(f, { at: a });
|
|
2300
2296
|
return i == null && (o.position = a + u), B({ bytesRead: u, buffer: e }, [e.buffer]);
|
|
2301
2297
|
} catch (a) {
|
|
2302
|
-
throw
|
|
2298
|
+
throw j("read", t, o.path, a);
|
|
2303
2299
|
}
|
|
2304
2300
|
}
|
|
2305
2301
|
/**
|
|
@@ -2330,7 +2326,7 @@ class gs {
|
|
|
2330
2326
|
const h = i ?? a.position, c = e.subarray(n, n + l), f = a.syncHandle.write(c, { at: h });
|
|
2331
2327
|
return (i == null || i === a.position) && (a.position = h + f), o && await this.notifyChange({ path: a.path, type: D.Changed, isDirectory: !1 }), f;
|
|
2332
2328
|
} catch (h) {
|
|
2333
|
-
throw
|
|
2329
|
+
throw j("write", t, a.path, h);
|
|
2334
2330
|
}
|
|
2335
2331
|
}
|
|
2336
2332
|
/**
|
|
@@ -2378,7 +2374,7 @@ class gs {
|
|
|
2378
2374
|
try {
|
|
2379
2375
|
n.syncHandle.truncate(e), n.syncHandle.flush(), n.position > e && (n.position = e), await this.notifyChange({ path: n.path, type: D.Changed, isDirectory: !1 });
|
|
2380
2376
|
} catch (r) {
|
|
2381
|
-
throw
|
|
2377
|
+
throw j("truncate", t, n.path, r);
|
|
2382
2378
|
}
|
|
2383
2379
|
}
|
|
2384
2380
|
/**
|
|
@@ -2400,7 +2396,7 @@ class gs {
|
|
|
2400
2396
|
try {
|
|
2401
2397
|
e.syncHandle.flush();
|
|
2402
2398
|
} catch (n) {
|
|
2403
|
-
throw
|
|
2399
|
+
throw j("sync", t, e.path, n);
|
|
2404
2400
|
}
|
|
2405
2401
|
}
|
|
2406
2402
|
/**
|
|
@@ -2457,6 +2453,6 @@ class gs {
|
|
|
2457
2453
|
}
|
|
2458
2454
|
}
|
|
2459
2455
|
typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && ot(new gs());
|
|
2460
|
-
//# sourceMappingURL=worker-
|
|
2461
|
-
`,h=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=h&&(self.URL||self.webkitURL).createObjectURL(h),!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 a(o){return o instanceof URL?o.pathname:o}class p{#n;promises=this;constructor(n){this.#n=d.wrap(new u),n&&(n.broadcastChannel&&n.broadcastChannel instanceof BroadcastChannel&&(n.broadcastChannel=n.broadcastChannel.name),this.setOptions(n))}watch(n,t){const r=a(n);return this.#n.watch(r,t),()=>this.unwatch(r)}unwatch(n){const t=a(n);this.#n.unwatch(t)}async setOptions(n){return this.#n.setOptions(n)}async index(){return this.#n.index()}async readFile(n,t){const r=a(n);let s;typeof t=="string"?s=t:t&&typeof t=="object"&&(s=t.encoding);const i=await this.#n.readFile(r);return s||(s=e.isBinaryFileExtension(r)?"binary":"utf-8"),s==="binary"?i:e.decodeBuffer(i,s)}async writeFile(n,t,r){const s=a(n);let i;typeof r=="string"?i=r:r&&typeof r=="object"&&(i=r.encoding),i||(i=typeof t!="string"||e.isBinaryFileExtension(s)?"binary":"utf-8");const c=typeof t=="string"?e.encodeString(t,i):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.writeFile(s,c)}async appendFile(n,t,r){const s=a(n);r||(r=typeof t!="string"||e.isBinaryFileExtension(s)?"binary":"utf-8");const i=typeof t=="string"?e.encodeString(t,r):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.appendFile(s,i)}async mkdir(n,t){const r=a(n);let s;return typeof t=="number"?s={recursive:!1}:s=t,this.#n.mkdir(r,s)}async stat(n){const t=a(n);return this.#n.stat(t)}async readDir(n){const t=a(n);return this.#n.readDir(t)}async exists(n){const t=a(n);return this.#n.exists(t)}async clear(n){const t=n?a(n):void 0;return this.#n.clear(t)}async remove(n,t){const r=a(n);return this.#n.remove(r,t)}async unlink(n){return this.remove(n)}async rm(n,t){return this.remove(n,t)}async rmdir(n){return this.remove(n)}async readdir(n,t){return this.readDir(n)}async lstat(n){return this.stat(n)}async chmod(n,t){return Promise.resolve()}async realpath(n){const t=a(n);return this.#n.realpath(t)}async rename(n,t,r){const s=a(n),i=a(t);return this.#n.rename(s,i,r)}async copy(n,t,r){const s=a(n),i=a(t);return this.#n.copy(s,i,r)}async open(n,t){const r=a(n);return this.#n.open(r,t)}async close(n){return this.#n.close(n)}async read(n,t,r,s,i){const{bytesRead:c,buffer:f}=await this.#n.read(n,new Uint8Array(s),0,s,i);return c>0&&t.set(f.subarray(0,c),r),{bytesRead:c,buffer:t}}async write(n,t,r,s,i,c){return this.#n.write(n,t,r,s,i,c)}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,s])=>[a(r),s]);return this.#n.createIndex(t)}async readText(n,t="utf-8"){const r=a(n),s=await this.#n.readFile(r);return e.decodeBuffer(s,t)}async writeText(n,t,r="utf-8"){const s=a(n),i=e.encodeString(t,r);return this.#n.writeFile(s,i)}async appendText(n,t,r="utf-8"){const s=a(n),i=e.encodeString(t,r);return this.#n.appendFile(s,i)}}function m(o){return new p(o)}exports.AlreadyExistsError=e.AlreadyExistsError;exports.BINARY_FILE_EXTENSIONS=e.BINARY_FILE_EXTENSIONS;exports.DirectoryOperationError=e.DirectoryOperationError;exports.ExistenceError=e.ExistenceError;exports.FileBusyError=e.FileBusyError;exports.FileSystemOperationError=e.FileSystemOperationError;exports.FileTypeError=e.FileTypeError;exports.IOError=e.IOError;exports.InitializationFailedError=e.InitializationFailedError;exports.OPFSError=e.OPFSError;exports.OPFSNotSupportedError=e.OPFSNotSupportedError;exports.OperationAbortedError=e.OperationAbortedError;exports.OperationNotSupportedError=e.OperationNotSupportedError;exports.PathError=e.PathError;exports.
|
|
2456
|
+
//# sourceMappingURL=worker-BeJaVyBV.js.map
|
|
2457
|
+
`,h=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=h&&(self.URL||self.webkitURL).createObjectURL(h),!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 a(o){return o instanceof URL?o.pathname:o}class p{#n;promises=this;constructor(n){this.#n=d.wrap(new u),n&&(n.broadcastChannel&&n.broadcastChannel instanceof BroadcastChannel&&(n.broadcastChannel=n.broadcastChannel.name),this.setOptions(n))}watch(n,t){const r=a(n);return this.#n.watch(r,t),()=>this.unwatch(r)}unwatch(n){const t=a(n);this.#n.unwatch(t)}async setOptions(n){return this.#n.setOptions(n)}async index(){return this.#n.index()}async readFile(n,t){const r=a(n);let s;typeof t=="string"?s=t:t&&typeof t=="object"&&(s=t.encoding);const i=await this.#n.readFile(r);return s||(s=e.isBinaryFileExtension(r)?"binary":"utf-8"),s==="binary"?i:e.decodeBuffer(i,s)}async writeFile(n,t,r){const s=a(n);let i;typeof r=="string"?i=r:r&&typeof r=="object"&&(i=r.encoding),i||(i=typeof t!="string"||e.isBinaryFileExtension(s)?"binary":"utf-8");const c=typeof t=="string"?e.encodeString(t,i):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.writeFile(s,c)}async appendFile(n,t,r){const s=a(n);r||(r=typeof t!="string"||e.isBinaryFileExtension(s)?"binary":"utf-8");const i=typeof t=="string"?e.encodeString(t,r):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.appendFile(s,i)}async mkdir(n,t){const r=a(n);let s;return typeof t=="number"?s={recursive:!1}:s=t,this.#n.mkdir(r,s)}async stat(n){const t=a(n);return this.#n.stat(t)}async readDir(n){const t=a(n);return this.#n.readDir(t)}async exists(n){const t=a(n);return this.#n.exists(t)}async clear(n){const t=n?a(n):void 0;return this.#n.clear(t)}async remove(n,t){const r=a(n);return this.#n.remove(r,t)}async unlink(n){return this.remove(n)}async rm(n,t){return this.remove(n,t)}async rmdir(n){return this.remove(n)}async readdir(n,t){return this.readDir(n)}async lstat(n){return this.stat(n)}async chmod(n,t){return Promise.resolve()}async realpath(n){const t=a(n);return this.#n.realpath(t)}async rename(n,t,r){const s=a(n),i=a(t);return this.#n.rename(s,i,r)}async copy(n,t,r){const s=a(n),i=a(t);return this.#n.copy(s,i,r)}async open(n,t){const r=a(n);return this.#n.open(r,t)}async close(n){return this.#n.close(n)}async read(n,t,r,s,i){const{bytesRead:c,buffer:f}=await this.#n.read(n,new Uint8Array(s),0,s,i);return c>0&&t.set(f.subarray(0,c),r),{bytesRead:c,buffer:t}}async write(n,t,r,s,i,c){return this.#n.write(n,t,r,s,i,c)}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,s])=>[a(r),s]);return this.#n.createIndex(t)}async readText(n,t="utf-8"){const r=a(n),s=await this.#n.readFile(r);return e.decodeBuffer(s,t)}async writeText(n,t,r="utf-8"){const s=a(n),i=e.encodeString(t,r);return this.#n.writeFile(s,i)}async appendText(n,t,r="utf-8"){const s=a(n),i=e.encodeString(t,r);return this.#n.appendFile(s,i)}}function m(o){return new p(o)}exports.AlreadyExistsError=e.AlreadyExistsError;exports.BINARY_FILE_EXTENSIONS=e.BINARY_FILE_EXTENSIONS;exports.DirectoryOperationError=e.DirectoryOperationError;exports.ExistenceError=e.ExistenceError;exports.FileBusyError=e.FileBusyError;exports.FileSystemOperationError=e.FileSystemOperationError;exports.FileTypeError=e.FileTypeError;exports.IOError=e.IOError;exports.InitializationFailedError=e.InitializationFailedError;exports.OPFSError=e.OPFSError;exports.OPFSNotSupportedError=e.OPFSNotSupportedError;exports.OperationAbortedError=e.OperationAbortedError;exports.OperationNotSupportedError=e.OperationNotSupportedError;exports.PathError=e.PathError;exports.PermissionError=e.PermissionError;exports.StorageError=e.StorageError;exports.ValidationError=e.ValidationError;exports.WatchEventType=e.WatchEventType;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;
|
|
2462
2458
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/facade.ts","../src/index.ts"],"sourcesContent":["import { wrap } from 'comlink';\n\nimport { decodeBuffer, encodeString, isBinaryFileExtension } from './utils/encoder';\nimport WorkerCtor from './worker?worker&inline';\n\nimport type {\n BinaryEncoding,\n DirentData,\n Encoding,\n FileOpenOptions,\n FileStat,\n OPFSOptions,\n PathLike,\n RemoteOPFSWorker,\n RenameOptions,\n StringEncoding,\n WatchOptions\n} from './types';\n\n/**\n * Utility function to convert a PathLike to a string path\n * If it's a URI, extracts the pathname; otherwise returns the string as-is\n */\nfunction normalizePath(path: PathLike): string {\n if (path instanceof URL) {\n return path.pathname;\n }\n\n return path;\n}\n\n/**\n * Facade class that provides a clean interface for communicating with the OPFS worker\n * while hiding Comlink implementation details.\n */\nexport class OPFSFileSystem {\n #worker: RemoteOPFSWorker;\n promises: OPFSFileSystem = this;\n\n constructor(options?: OPFSOptions) {\n this.#worker = wrap<RemoteOPFSWorker>(new WorkerCtor());\n\n // Set up options if provided\n if (options) {\n // We can't pass a BroadcastChannel instance to the worker, so we need to convert it to a string first\n if (options.broadcastChannel && options.broadcastChannel instanceof BroadcastChannel) {\n options.broadcastChannel = options.broadcastChannel.name;\n }\n\n // Initialize options asynchronously\n void this.setOptions(options);\n }\n }\n\n /**\n * Start watching a file or directory for changes\n */\n watch(path: PathLike, options?: WatchOptions): () => void {\n const normalizedPath = normalizePath(path);\n\n void this.#worker.watch(normalizedPath, options);\n\n return () => this.unwatch(normalizedPath);\n }\n\n /**\n * Stop watching a previously watched path\n */\n unwatch(path: PathLike) {\n const normalizedPath = normalizePath(path);\n\n void this.#worker.unwatch(normalizedPath);\n }\n\n /**\n * Update configuration options\n */\n async setOptions(options: OPFSOptions) {\n return this.#worker.setOptions(options);\n }\n\n /**\n * Get a complete index of all files and directories in the file system\n */\n async index(): Promise<Map<string, FileStat>> {\n return this.#worker.index();\n }\n\n /**\n * Read a file from the file system\n */\n // Overload for explicit string encoding - returns string\n async readFile(path: PathLike, encoding: StringEncoding): Promise<string>;\n // Overload for explicit binary encoding - returns Uint8Array\n async readFile(path: PathLike, encoding: BinaryEncoding): Promise<Uint8Array>;\n // Overload for options object with string encoding - returns string\n async readFile(path: PathLike, options: { encoding: StringEncoding }): Promise<string>;\n // Overload for options object with binary encoding - returns Uint8Array\n async readFile(path: PathLike, options: { encoding: BinaryEncoding }): Promise<Uint8Array>;\n // Overload for no encoding (auto-detected) - returns string | Uint8Array based on file extension\n async readFile(path: PathLike): Promise<string | Uint8Array>;\n // Implementation\n async readFile(\n path: PathLike,\n optionsOrEncoding?: Encoding | { encoding?: Encoding }\n ): Promise<string | Uint8Array> {\n const normalizedPath = normalizePath(path);\n\n // Handle both options object and direct encoding parameter for backward compatibility\n let encoding: Encoding | undefined;\n\n if (typeof optionsOrEncoding === 'string') {\n encoding = optionsOrEncoding;\n }\n else if (optionsOrEncoding && typeof optionsOrEncoding === 'object') {\n encoding = optionsOrEncoding.encoding;\n }\n\n // Get binary data from worker\n const buffer = await this.#worker.readFile(normalizedPath);\n\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = isBinaryFileExtension(normalizedPath) ? 'binary' : 'utf-8';\n }\n\n // Return binary data or decode to string\n return (encoding === 'binary') ? buffer : decodeBuffer(buffer, encoding);\n }\n\n /**\n * Write data to a file\n */\n async writeFile(\n path: PathLike,\n data: string | Uint8Array | ArrayBuffer,\n options?: { encoding?: Encoding } | Encoding\n ): Promise<void> {\n const normalizedPath = normalizePath(path);\n\n let encoding: Encoding | undefined;\n\n if (typeof options === 'string') {\n encoding = options;\n }\n else if (options && typeof options === 'object') {\n encoding = options.encoding;\n }\n\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = (typeof data !== 'string' || isBinaryFileExtension(normalizedPath)) ? 'binary' : 'utf-8';\n }\n\n // Convert data to Uint8Array\n const buffer = typeof data === 'string'\n ? encodeString(data, encoding)\n : (data instanceof Uint8Array ? data : new Uint8Array(data));\n\n return this.#worker.writeFile(normalizedPath, buffer);\n }\n\n /**\n * Append data to a file\n */\n async appendFile(\n path: PathLike,\n data: string | Uint8Array | ArrayBuffer,\n encoding?: Encoding\n ): Promise<void> {\n const normalizedPath = normalizePath(path);\n\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = (typeof data !== 'string' || isBinaryFileExtension(normalizedPath)) ? 'binary' : 'utf-8';\n }\n\n // Convert data to Uint8Array\n const buffer = typeof data === 'string'\n ? encodeString(data, encoding)\n : (data instanceof Uint8Array ? data : new Uint8Array(data));\n\n return this.#worker.appendFile(normalizedPath, buffer);\n }\n\n /**\n * Create a directory\n */\n async mkdir(path: PathLike, mode?: number | { recursive?: boolean }): Promise<void> {\n const normalizedPath = normalizePath(path);\n\n let options: { recursive?: boolean } | undefined;\n\n // OPFS doesn't support file modes, so we ignore the mode parameter\n if (typeof mode === 'number') {\n options = { recursive: false };\n }\n else {\n options = mode;\n }\n\n return this.#worker.mkdir(normalizedPath, options);\n }\n\n /**\n * Get file or directory statistics\n */\n async stat(path: PathLike): Promise<FileStat> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.stat(normalizedPath);\n }\n\n /**\n * Read a directory's contents\n */\n async readDir(path: PathLike): Promise<DirentData[]> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.readDir(normalizedPath);\n }\n\n /**\n * Check if a file or directory exists\n */\n async exists(path: PathLike): Promise<boolean> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.exists(normalizedPath);\n }\n\n /**\n * Clear all contents of a directory without removing the directory itself\n */\n async clear(path?: PathLike): Promise<void> {\n const normalizedPath = path ? normalizePath(path) : undefined;\n\n return this.#worker.clear(normalizedPath);\n }\n\n /**\n * Remove files and directories\n */\n async remove(path: PathLike, options?: { recursive?: boolean; force?: boolean }): Promise<void> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.remove(normalizedPath, options);\n }\n\n /**\n * Alias for remove() for NodeJS like API compatibility\n */\n async unlink(path: PathLike): Promise<void> {\n return this.remove(path);\n }\n\n /**\n * Alias for remove() for NodeJS like API compatibility\n */\n async rm(path: PathLike, options?: { recursive?: boolean; force?: boolean }): Promise<void> {\n return this.remove(path, options);\n }\n\n /**\n * Alias for remove() for NodeJS like API compatibility\n */\n async rmdir(path: PathLike): Promise<void> {\n return this.remove(path);\n }\n\n /**\n * Alias for readDir() for NodeJS like API compatibility\n */\n async readdir(path: PathLike, _options?: unknown): Promise<DirentData[]> {\n return this.readDir(path);\n }\n\n /**\n * Alias for stat() for NodeJS like API compatibility\n */\n async lstat(path: PathLike): Promise<FileStat> {\n return this.stat(path);\n }\n\n /**\n * Note: OPFS doesn't support file modes, so this is a no-op and exists only for compatibility with tools like isomorphic-git\n */\n async chmod(_path: PathLike, _mode: number): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Resolve a path to an absolute path\n */\n async realpath(path: PathLike): Promise<string> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.realpath(normalizedPath);\n }\n\n /**\n * Rename a file or directory\n */\n async rename(oldPath: PathLike, newPath: PathLike, options?: RenameOptions): Promise<void> {\n const normalizedOldPath = normalizePath(oldPath);\n const normalizedNewPath = normalizePath(newPath);\n\n return this.#worker.rename(normalizedOldPath, normalizedNewPath, options);\n }\n\n /**\n * Copy files and directories\n */\n async copy(source: PathLike, destination: PathLike, options?: { recursive?: boolean; overwrite?: boolean }): Promise<void> {\n const normalizedSource = normalizePath(source);\n const normalizedDestination = normalizePath(destination);\n\n return this.#worker.copy(normalizedSource, normalizedDestination, options);\n }\n\n /**\n * Open a file and return a file descriptor\n */\n async open(path: PathLike, options?: FileOpenOptions): Promise<number> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.open(normalizedPath, options);\n }\n\n /**\n * Close a file descriptor\n */\n async close(fd: number): Promise<void> {\n return this.#worker.close(fd);\n }\n\n /**\n * Read data from a file descriptor\n * \n * This method requires special handling due to Comlink transfer requirements.\n * The buffer is transferred to the worker and back, so the original buffer\n * becomes unusable after the call.\n */\n async read(\n fd: number,\n buffer: Uint8Array,\n offset: number,\n length: number,\n position?: number | null | undefined\n ): Promise<{ bytesRead: number; buffer: Uint8Array }> {\n const { bytesRead, buffer: transferred } = await this.#worker.read(\n fd,\n // Temp buffer to preserve the original buffer\n new Uint8Array(length),\n 0,\n length,\n position\n );\n\n // Copy the data from the transferred buffer to the original buffer\n if (bytesRead > 0) {\n buffer.set(transferred.subarray(0, bytesRead), offset);\n }\n\n return { bytesRead, buffer };\n }\n\n /**\n * Write data to a file descriptor\n */\n async write(\n fd: number,\n buffer: Uint8Array,\n offset?: number,\n length?: number,\n position?: number | null | undefined,\n emitEvent?: boolean\n ): Promise<number> {\n return this.#worker.write(fd, buffer, offset, length, position, emitEvent);\n }\n\n /**\n * Get file status information by file descriptor\n */\n async fstat(fd: number): Promise<FileStat> {\n return this.#worker.fstat(fd);\n }\n\n /**\n * Truncate file to specified size\n */\n async ftruncate(fd: number, size?: number): Promise<void> {\n return this.#worker.ftruncate(fd, size);\n }\n\n /**\n * Synchronize file data to storage (fsync equivalent)\n */\n async fsync(fd: number): Promise<void> {\n return this.#worker.fsync(fd);\n }\n\n /**\n * Dispose of resources and clean up the file system instance\n */\n dispose() {\n void this.#worker.dispose();\n }\n\n /**\n * Synchronize the file system with external data\n */\n async createIndex(entries: [PathLike, string | Uint8Array | Blob][]): Promise<void> {\n const normalizedEntries = entries.map(([path, data]) => [normalizePath(path), data] as [string, string | Uint8Array | Blob]);\n\n return this.#worker.createIndex(normalizedEntries);\n }\n\n /**\n * Read a file as text with automatic encoding detection\n */\n async readText(path: PathLike, encoding: Encoding = 'utf-8'): Promise<string> {\n const normalizedPath = normalizePath(path);\n const buffer = await this.#worker.readFile(normalizedPath);\n\n return decodeBuffer(buffer, encoding);\n }\n\n /**\n * Write text to a file with specified encoding\n */\n async writeText(path: PathLike, text: string, encoding: Encoding = 'utf-8'): Promise<void> {\n const normalizedPath = normalizePath(path);\n const buffer = encodeString(text, encoding);\n\n return this.#worker.writeFile(normalizedPath, buffer);\n }\n\n /**\n * Append text to a file with specified encoding\n */\n async appendText(path: PathLike, text: string, encoding: Encoding = 'utf-8'): Promise<void> {\n const normalizedPath = normalizePath(path);\n const buffer = encodeString(text, encoding);\n\n return this.#worker.appendFile(normalizedPath, buffer);\n }\n}\n","import { OPFSFileSystem } from './facade';\n\nimport type { OPFSOptions } from './types';\n\nexport * from './types';\nexport * from './utils/errors';\nexport * from './utils/helpers';\nexport * from './utils/encoder';\nexport * from './facade';\n\n/**\n * Creates a new file system instance with inline worker\n * @param options - Optional configuration options\n * @returns Promise resolving to the file system interface\n */\nexport function createWorker(\n options?: OPFSOptions\n): OPFSFileSystem {\n return new OPFSFileSystem(options);\n}\n"],"names":["normalizePath","path","OPFSFileSystem","#worker","options","wrap","WorkerCtor","normalizedPath","optionsOrEncoding","encoding","buffer","isBinaryFileExtension","decodeBuffer","data","encodeString","mode","_options","_path","_mode","oldPath","newPath","normalizedOldPath","normalizedNewPath","source","destination","normalizedSource","normalizedDestination","fd","offset","length","position","bytesRead","transferred","emitEvent","size","entries","normalizedEntries","text","createWorker"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAE1C,OAAO,KAAKN,GAAQ,WAAWI,EAAgBG,CAAM,CACzD,CACJ,CChbO,SAAS4B,EACZlC,EACc,CACd,OAAO,IAAIF,EAAeE,CAAO,CACrC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/facade.ts","../src/index.ts"],"sourcesContent":["import { wrap } from 'comlink';\n\nimport { decodeBuffer, encodeString, isBinaryFileExtension } from './utils/encoder';\nimport WorkerCtor from './worker?worker&inline';\n\nimport type {\n BinaryEncoding,\n DirentData,\n Encoding,\n FileOpenOptions,\n FileStat,\n OPFSOptions,\n PathLike,\n RemoteOPFSWorker,\n RenameOptions,\n StringEncoding,\n WatchOptions\n} from './types';\n\n/**\n * Utility function to convert a PathLike to a string path\n * If it's a URI, extracts the pathname; otherwise returns the string as-is\n */\nfunction normalizePath(path: PathLike): string {\n if (path instanceof URL) {\n return path.pathname;\n }\n\n return path;\n}\n\n/**\n * Facade class that provides a clean interface for communicating with the OPFS worker\n * while hiding Comlink implementation details.\n */\nexport class OPFSFileSystem {\n #worker: RemoteOPFSWorker;\n promises: OPFSFileSystem = this;\n\n constructor(options?: OPFSOptions) {\n this.#worker = wrap<RemoteOPFSWorker>(new WorkerCtor());\n\n // Set up options if provided\n if (options) {\n // We can't pass a BroadcastChannel instance to the worker, so we need to convert it to a string first\n if (options.broadcastChannel && options.broadcastChannel instanceof BroadcastChannel) {\n options.broadcastChannel = options.broadcastChannel.name;\n }\n\n // Initialize options asynchronously\n void this.setOptions(options);\n }\n }\n\n /**\n * Start watching a file or directory for changes\n */\n watch(path: PathLike, options?: WatchOptions): () => void {\n const normalizedPath = normalizePath(path);\n\n void this.#worker.watch(normalizedPath, options);\n\n return () => this.unwatch(normalizedPath);\n }\n\n /**\n * Stop watching a previously watched path\n */\n unwatch(path: PathLike) {\n const normalizedPath = normalizePath(path);\n\n void this.#worker.unwatch(normalizedPath);\n }\n\n /**\n * Update configuration options\n */\n async setOptions(options: OPFSOptions) {\n return this.#worker.setOptions(options);\n }\n\n /**\n * Get a complete index of all files and directories in the file system\n */\n async index(): Promise<Map<string, FileStat>> {\n return this.#worker.index();\n }\n\n /**\n * Read a file from the file system\n */\n // Overload for explicit string encoding - returns string\n async readFile(path: PathLike, encoding: StringEncoding): Promise<string>;\n // Overload for explicit binary encoding - returns Uint8Array\n async readFile(path: PathLike, encoding: BinaryEncoding): Promise<Uint8Array>;\n // Overload for options object with string encoding - returns string\n async readFile(path: PathLike, options: { encoding: StringEncoding }): Promise<string>;\n // Overload for options object with binary encoding - returns Uint8Array\n async readFile(path: PathLike, options: { encoding: BinaryEncoding }): Promise<Uint8Array>;\n // Overload for no encoding (auto-detected) - returns string | Uint8Array based on file extension\n async readFile(path: PathLike): Promise<string | Uint8Array>;\n // Implementation\n async readFile(\n path: PathLike,\n optionsOrEncoding?: Encoding | { encoding?: Encoding }\n ): Promise<string | Uint8Array> {\n const normalizedPath = normalizePath(path);\n\n // Handle both options object and direct encoding parameter for backward compatibility\n let encoding: Encoding | undefined;\n\n if (typeof optionsOrEncoding === 'string') {\n encoding = optionsOrEncoding;\n }\n else if (optionsOrEncoding && typeof optionsOrEncoding === 'object') {\n encoding = optionsOrEncoding.encoding;\n }\n\n // Get binary data from worker\n const buffer = await this.#worker.readFile(normalizedPath);\n\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = isBinaryFileExtension(normalizedPath) ? 'binary' : 'utf-8';\n }\n\n // Return binary data or decode to string\n return (encoding === 'binary') ? buffer : decodeBuffer(buffer, encoding);\n }\n\n /**\n * Write data to a file\n */\n async writeFile(\n path: PathLike,\n data: string | Uint8Array | ArrayBuffer,\n options?: { encoding?: Encoding } | Encoding\n ): Promise<void> {\n const normalizedPath = normalizePath(path);\n\n let encoding: Encoding | undefined;\n\n if (typeof options === 'string') {\n encoding = options;\n }\n else if (options && typeof options === 'object') {\n encoding = options.encoding;\n }\n\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = (typeof data !== 'string' || isBinaryFileExtension(normalizedPath)) ? 'binary' : 'utf-8';\n }\n\n // Convert data to Uint8Array\n const buffer = typeof data === 'string'\n ? encodeString(data, encoding)\n : (data instanceof Uint8Array ? data : new Uint8Array(data));\n\n return this.#worker.writeFile(normalizedPath, buffer);\n }\n\n /**\n * Append data to a file\n */\n async appendFile(\n path: PathLike,\n data: string | Uint8Array | ArrayBuffer,\n encoding?: Encoding\n ): Promise<void> {\n const normalizedPath = normalizePath(path);\n\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = (typeof data !== 'string' || isBinaryFileExtension(normalizedPath)) ? 'binary' : 'utf-8';\n }\n\n // Convert data to Uint8Array\n const buffer = typeof data === 'string'\n ? encodeString(data, encoding)\n : (data instanceof Uint8Array ? data : new Uint8Array(data));\n\n return this.#worker.appendFile(normalizedPath, buffer);\n }\n\n /**\n * Create a directory\n */\n async mkdir(path: PathLike, mode?: number | { recursive?: boolean }): Promise<void> {\n const normalizedPath = normalizePath(path);\n\n let options: { recursive?: boolean } | undefined;\n\n // OPFS doesn't support file modes, so we ignore the mode parameter\n if (typeof mode === 'number') {\n options = { recursive: false };\n }\n else {\n options = mode;\n }\n\n return this.#worker.mkdir(normalizedPath, options);\n }\n\n /**\n * Get file or directory statistics\n */\n async stat(path: PathLike): Promise<FileStat> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.stat(normalizedPath);\n }\n\n /**\n * Read a directory's contents\n */\n async readDir(path: PathLike): Promise<DirentData[]> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.readDir(normalizedPath);\n }\n\n /**\n * Check if a file or directory exists\n */\n async exists(path: PathLike): Promise<boolean> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.exists(normalizedPath);\n }\n\n /**\n * Clear all contents of a directory without removing the directory itself\n */\n async clear(path?: PathLike): Promise<void> {\n const normalizedPath = path ? normalizePath(path) : undefined;\n\n return this.#worker.clear(normalizedPath);\n }\n\n /**\n * Remove files and directories\n */\n async remove(path: PathLike, options?: { recursive?: boolean; force?: boolean }): Promise<void> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.remove(normalizedPath, options);\n }\n\n /**\n * Alias for remove() for NodeJS like API compatibility\n */\n async unlink(path: PathLike): Promise<void> {\n return this.remove(path);\n }\n\n /**\n * Alias for remove() for NodeJS like API compatibility\n */\n async rm(path: PathLike, options?: { recursive?: boolean; force?: boolean }): Promise<void> {\n return this.remove(path, options);\n }\n\n /**\n * Alias for remove() for NodeJS like API compatibility\n */\n async rmdir(path: PathLike): Promise<void> {\n return this.remove(path);\n }\n\n /**\n * Alias for readDir() for NodeJS like API compatibility\n */\n async readdir(path: PathLike, _options?: unknown): Promise<DirentData[]> {\n return this.readDir(path);\n }\n\n /**\n * Alias for stat() for NodeJS like API compatibility\n */\n async lstat(path: PathLike): Promise<FileStat> {\n return this.stat(path);\n }\n\n /**\n * Note: OPFS doesn't support file modes, so this is a no-op and exists only for compatibility with tools like isomorphic-git\n */\n async chmod(_path: PathLike, _mode: number): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Resolve a path to an absolute path\n */\n async realpath(path: PathLike): Promise<string> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.realpath(normalizedPath);\n }\n\n /**\n * Rename a file or directory\n */\n async rename(oldPath: PathLike, newPath: PathLike, options?: RenameOptions): Promise<void> {\n const normalizedOldPath = normalizePath(oldPath);\n const normalizedNewPath = normalizePath(newPath);\n\n return this.#worker.rename(normalizedOldPath, normalizedNewPath, options);\n }\n\n /**\n * Copy files and directories\n */\n async copy(source: PathLike, destination: PathLike, options?: { recursive?: boolean; overwrite?: boolean }): Promise<void> {\n const normalizedSource = normalizePath(source);\n const normalizedDestination = normalizePath(destination);\n\n return this.#worker.copy(normalizedSource, normalizedDestination, options);\n }\n\n /**\n * Open a file and return a file descriptor\n */\n async open(path: PathLike, options?: FileOpenOptions): Promise<number> {\n const normalizedPath = normalizePath(path);\n\n return this.#worker.open(normalizedPath, options);\n }\n\n /**\n * Close a file descriptor\n */\n async close(fd: number): Promise<void> {\n return this.#worker.close(fd);\n }\n\n /**\n * Read data from a file descriptor\n * \n * This method requires special handling due to Comlink transfer requirements.\n * The buffer is transferred to the worker and back, so the original buffer\n * becomes unusable after the call.\n */\n async read(\n fd: number,\n buffer: Uint8Array,\n offset: number,\n length: number,\n position?: number | null | undefined\n ): Promise<{ bytesRead: number; buffer: Uint8Array }> {\n const { bytesRead, buffer: transferred } = await this.#worker.read(\n fd,\n // Temp buffer to preserve the original buffer\n new Uint8Array(length),\n 0,\n length,\n position\n );\n\n // Copy the data from the transferred buffer to the original buffer\n if (bytesRead > 0) {\n buffer.set(transferred.subarray(0, bytesRead), offset);\n }\n\n return { bytesRead, buffer };\n }\n\n /**\n * Write data to a file descriptor\n */\n async write(\n fd: number,\n buffer: Uint8Array,\n offset?: number,\n length?: number,\n position?: number | null | undefined,\n emitEvent?: boolean\n ): Promise<number> {\n return this.#worker.write(fd, buffer, offset, length, position, emitEvent);\n }\n\n /**\n * Get file status information by file descriptor\n */\n async fstat(fd: number): Promise<FileStat> {\n return this.#worker.fstat(fd);\n }\n\n /**\n * Truncate file to specified size\n */\n async ftruncate(fd: number, size?: number): Promise<void> {\n return this.#worker.ftruncate(fd, size);\n }\n\n /**\n * Synchronize file data to storage (fsync equivalent)\n */\n async fsync(fd: number): Promise<void> {\n return this.#worker.fsync(fd);\n }\n\n /**\n * Dispose of resources and clean up the file system instance\n */\n dispose() {\n void this.#worker.dispose();\n }\n\n /**\n * Synchronize the file system with external data\n */\n async createIndex(entries: [PathLike, string | Uint8Array | Blob][]): Promise<void> {\n const normalizedEntries = entries.map(([path, data]) => [normalizePath(path), data] as [string, string | Uint8Array | Blob]);\n\n return this.#worker.createIndex(normalizedEntries);\n }\n\n /**\n * Read a file as text with automatic encoding detection\n */\n async readText(path: PathLike, encoding: Encoding = 'utf-8'): Promise<string> {\n const normalizedPath = normalizePath(path);\n const buffer = await this.#worker.readFile(normalizedPath);\n\n return decodeBuffer(buffer, encoding);\n }\n\n /**\n * Write text to a file with specified encoding\n */\n async writeText(path: PathLike, text: string, encoding: Encoding = 'utf-8'): Promise<void> {\n const normalizedPath = normalizePath(path);\n const buffer = encodeString(text, encoding);\n\n return this.#worker.writeFile(normalizedPath, buffer);\n }\n\n /**\n * Append text to a file with specified encoding\n */\n async appendText(path: PathLike, text: string, encoding: Encoding = 'utf-8'): Promise<void> {\n const normalizedPath = normalizePath(path);\n const buffer = encodeString(text, encoding);\n\n return this.#worker.appendFile(normalizedPath, buffer);\n }\n}\n","import { OPFSFileSystem } from './facade';\n\nimport type { OPFSOptions } from './types';\n\nexport * from './types';\nexport * from './utils/errors';\nexport * from './utils/helpers';\nexport * from './utils/encoder';\nexport * from './facade';\n\n/**\n * Creates a new file system instance with inline worker\n * @param options - Optional configuration options\n * @returns Promise resolving to the file system interface\n */\nexport function createWorker(\n options?: OPFSOptions\n): OPFSFileSystem {\n return new OPFSFileSystem(options);\n}\n"],"names":["normalizePath","path","OPFSFileSystem","#worker","options","wrap","WorkerCtor","normalizedPath","optionsOrEncoding","encoding","buffer","isBinaryFileExtension","decodeBuffer","data","encodeString","mode","_options","_path","_mode","oldPath","newPath","normalizedOldPath","normalizedNewPath","source","destination","normalizedSource","normalizedDestination","fd","offset","length","position","bytesRead","transferred","emitEvent","size","entries","normalizedEntries","text","createWorker"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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