opfs-worker 1.3.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -106
- package/dist/{facade.d.ts → OPFSFacade.d.ts} +22 -5
- package/dist/OPFSFacade.d.ts.map +1 -0
- package/dist/{worker.d.ts → OPFSWorker.d.ts} +10 -6
- package/dist/OPFSWorker.d.ts.map +1 -0
- package/dist/assets/worker.entry-DUlEoroc.js.map +1 -0
- package/dist/createOPFSWorker.d.ts +17 -0
- package/dist/createOPFSWorker.d.ts.map +1 -0
- package/dist/helpers-DNj8ZoMu.cjs +4 -0
- package/dist/helpers-DNj8ZoMu.cjs.map +1 -0
- package/dist/{helpers-Ca2c767K.js → helpers-WY2jfbOT.js} +221 -221
- package/dist/helpers-WY2jfbOT.js.map +1 -0
- package/dist/index.cjs +296 -285
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +369 -340
- package/dist/index.js.map +1 -1
- package/dist/index.pure.cjs +2 -0
- package/dist/index.pure.cjs.map +1 -0
- package/dist/index.pure.d.ts +6 -0
- package/dist/index.pure.d.ts.map +1 -0
- package/dist/{raw.js → index.pure.js} +241 -186
- package/dist/index.pure.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts +11 -1
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/worker.entry.d.ts +2 -0
- package/dist/worker.entry.d.ts.map +1 -0
- package/docs/api-reference.md +815 -0
- package/docs/file-descriptors.md +696 -0
- package/docs/types.md +232 -0
- package/package.json +14 -8
- package/src/OPFSFacade.ts +460 -0
- package/src/OPFSWorker.ts +1544 -0
- package/src/createOPFSWorker.ts +57 -0
- package/src/index.pure.ts +7 -0
- package/src/index.ts +15 -0
- package/src/types.ts +99 -0
- package/src/utils/encoder.ts +205 -0
- package/src/utils/errors.ts +297 -0
- package/src/utils/helpers.ts +465 -0
- package/src/worker.entry.ts +6 -0
- package/dist/assets/worker-1Wh1cr7P.js.map +0 -1
- package/dist/assets/worker-BeJaVyBV.js.map +0 -1
- package/dist/assets/worker-DYYLzR1Y.js.map +0 -1
- package/dist/facade.d.ts.map +0 -1
- package/dist/helpers-BuGfPAg0.js +0 -1439
- package/dist/helpers-BuGfPAg0.js.map +0 -1
- package/dist/helpers-CF7A2WQG.cjs +0 -4
- package/dist/helpers-CF7A2WQG.cjs.map +0 -1
- package/dist/helpers-CIiblZ8d.cjs +0 -4
- package/dist/helpers-CIiblZ8d.cjs.map +0 -1
- package/dist/helpers-CKOebsbw.js +0 -1423
- package/dist/helpers-CKOebsbw.js.map +0 -1
- package/dist/helpers-Ca2c767K.js.map +0 -1
- package/dist/helpers-Dwc92hv9.cjs +0 -4
- package/dist/helpers-Dwc92hv9.cjs.map +0 -1
- package/dist/raw.cjs +0 -2
- package/dist/raw.cjs.map +0 -1
- package/dist/raw.d.ts +0 -13
- package/dist/raw.d.ts.map +0 -1
- package/dist/raw.js.map +0 -1
- package/dist/worker.d.ts.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
var lt = /* @__PURE__ */ ((s) => (s.Added = "added", s.Changed = "changed", s.Removed = "removed", s))(lt || {});
|
|
2
|
+
const ht = {
|
|
2
3
|
ENOENT: -2,
|
|
3
4
|
// No such file or directory
|
|
4
5
|
EISDIR: -21,
|
|
@@ -35,10 +36,10 @@ class y extends Error {
|
|
|
35
36
|
syscall;
|
|
36
37
|
path;
|
|
37
38
|
constructor(t, e, n, r, i) {
|
|
38
|
-
super(t, { cause: i }), this.name = e, this.errno =
|
|
39
|
+
super(t, { cause: i }), this.name = e, this.errno = ht[e] || -1, this.path = n, this.syscall = r;
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
class
|
|
42
|
+
class ut extends y {
|
|
42
43
|
constructor(t) {
|
|
43
44
|
super("OPFS is not supported in this browser", "ENOTSUP", void 0, void 0, t);
|
|
44
45
|
}
|
|
@@ -48,7 +49,7 @@ class Te extends y {
|
|
|
48
49
|
super(t, "INVALID_PATH", e, "access", n);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
class
|
|
52
|
+
class ft extends y {
|
|
52
53
|
constructor(t, e, n) {
|
|
53
54
|
const r = {
|
|
54
55
|
file: `File not found: ${e}`,
|
|
@@ -58,17 +59,17 @@ class ut extends y {
|
|
|
58
59
|
super(r[t], "ENOENT", e, "access", n);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
class
|
|
62
|
+
class pt extends y {
|
|
62
63
|
constructor(t, e, n) {
|
|
63
64
|
super(`Permission denied for ${e} on: ${t}`, "EACCES", t, e, n);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
class
|
|
67
|
+
class dt extends y {
|
|
67
68
|
constructor(t, e, n) {
|
|
68
69
|
super(t, "ENOSPC", e, "write", n);
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
|
-
class
|
|
72
|
+
class gt extends y {
|
|
72
73
|
constructor(t, e) {
|
|
73
74
|
super(`File is busy: ${t}`, "EBUSY", t, "open", e);
|
|
74
75
|
}
|
|
@@ -90,7 +91,7 @@ class b extends y {
|
|
|
90
91
|
super(e, i[t], n, "validate", r);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
class
|
|
94
|
+
class mt extends y {
|
|
94
95
|
constructor(t, e) {
|
|
95
96
|
super(`Operation aborted: ${t}`, "EINTR", t, "interrupt", e);
|
|
96
97
|
}
|
|
@@ -100,7 +101,7 @@ class U extends y {
|
|
|
100
101
|
super(t, "EIO", e, "io", n);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
class
|
|
104
|
+
class wt extends y {
|
|
104
105
|
constructor(t, e) {
|
|
105
106
|
super(`Operation not supported: ${t}`, "ENOTSUP", t, "operation", e);
|
|
106
107
|
}
|
|
@@ -138,168 +139,30 @@ function Z(s, t) {
|
|
|
138
139
|
const e = t?.path, n = t?.isDirectory, r = t?.existenceType ?? "file", i = t?.operation;
|
|
139
140
|
switch (s.name) {
|
|
140
141
|
case "InvalidStateError":
|
|
141
|
-
return new
|
|
142
|
+
return new gt(e || "unknown", s);
|
|
142
143
|
case "QuotaExceededError":
|
|
143
|
-
return new
|
|
144
|
+
return new dt(`No space left on device: ${e || "unknown"}`, e, s);
|
|
144
145
|
case "NotFoundError":
|
|
145
|
-
return new
|
|
146
|
+
return new ft(r, e, s);
|
|
146
147
|
case "TypeMismatchError":
|
|
147
148
|
return n !== void 0 ? n ? new W("directory", e || "unknown", s) : new W("file", e || "unknown", s) : new b("argument", `Type mismatch: ${e || "unknown"}`, e, s);
|
|
148
149
|
case "NotAllowedError":
|
|
149
150
|
case "SecurityError":
|
|
150
|
-
return new
|
|
151
|
+
return new pt(e, "unknown", s);
|
|
151
152
|
case "InvalidModificationError":
|
|
152
153
|
return i === "remove" ? new z("ENOTEMPTY", e, s) : new b("argument", `Invalid modification: ${e || "unknown"}`, e, s);
|
|
153
154
|
case "AbortError":
|
|
154
|
-
return new
|
|
155
|
+
return new mt(e || "unknown", s);
|
|
155
156
|
case "OperationError":
|
|
156
157
|
return new U(`Operation failed: ${e || "unknown"}`, e, s);
|
|
157
158
|
case "TypeError":
|
|
158
|
-
return new
|
|
159
|
+
return new wt(e || "unknown", s);
|
|
159
160
|
default:
|
|
160
161
|
return i === "remove" ? new z("RM_FAILED", e, s) : new U(`I/O error: ${e || "unknown"}`, e, s);
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
|
-
const wt = [
|
|
164
|
-
// Images
|
|
165
|
-
".jpg",
|
|
166
|
-
".jpeg",
|
|
167
|
-
".png",
|
|
168
|
-
".gif",
|
|
169
|
-
".bmp",
|
|
170
|
-
".webp",
|
|
171
|
-
".ico",
|
|
172
|
-
".tiff",
|
|
173
|
-
".tga",
|
|
174
|
-
// Audio
|
|
175
|
-
".mp3",
|
|
176
|
-
".wav",
|
|
177
|
-
".ogg",
|
|
178
|
-
".flac",
|
|
179
|
-
".aac",
|
|
180
|
-
".wma",
|
|
181
|
-
".m4a",
|
|
182
|
-
// Video
|
|
183
|
-
".mp4",
|
|
184
|
-
".avi",
|
|
185
|
-
".mov",
|
|
186
|
-
".wmv",
|
|
187
|
-
".flv",
|
|
188
|
-
".webm",
|
|
189
|
-
".mkv",
|
|
190
|
-
".m4v",
|
|
191
|
-
// Documents
|
|
192
|
-
".pdf",
|
|
193
|
-
".doc",
|
|
194
|
-
".docx",
|
|
195
|
-
".xls",
|
|
196
|
-
".xlsx",
|
|
197
|
-
".ppt",
|
|
198
|
-
".pptx",
|
|
199
|
-
// Archives
|
|
200
|
-
".zip",
|
|
201
|
-
".rar",
|
|
202
|
-
".7z",
|
|
203
|
-
".tar",
|
|
204
|
-
".gz",
|
|
205
|
-
".bz2",
|
|
206
|
-
// Executables
|
|
207
|
-
".exe",
|
|
208
|
-
".dll",
|
|
209
|
-
".so",
|
|
210
|
-
".dylib",
|
|
211
|
-
// Other binary formats
|
|
212
|
-
".dat",
|
|
213
|
-
".db",
|
|
214
|
-
".sqlite",
|
|
215
|
-
".bin",
|
|
216
|
-
".obj",
|
|
217
|
-
".fbx",
|
|
218
|
-
".3ds"
|
|
219
|
-
];
|
|
220
|
-
function Ie(s) {
|
|
221
|
-
const t = s.lastIndexOf(".");
|
|
222
|
-
if (t <= 0)
|
|
223
|
-
return !0;
|
|
224
|
-
const e = s.slice(t).toLowerCase();
|
|
225
|
-
return wt.includes(e);
|
|
226
|
-
}
|
|
227
|
-
function yt(s, t = "utf-8") {
|
|
228
|
-
switch (t) {
|
|
229
|
-
case "utf8":
|
|
230
|
-
case "utf-8":
|
|
231
|
-
return new TextEncoder().encode(s);
|
|
232
|
-
case "utf16le":
|
|
233
|
-
case "utf-16le":
|
|
234
|
-
case "ucs2":
|
|
235
|
-
case "ucs-2":
|
|
236
|
-
return Et(s);
|
|
237
|
-
case "ascii":
|
|
238
|
-
return Ot(s);
|
|
239
|
-
case "latin1":
|
|
240
|
-
return St(s);
|
|
241
|
-
case "binary":
|
|
242
|
-
return Uint8Array.from(s, (e) => e.charCodeAt(0));
|
|
243
|
-
case "base64":
|
|
244
|
-
return Uint8Array.from(atob(s), (e) => e.charCodeAt(0));
|
|
245
|
-
case "hex":
|
|
246
|
-
if (!/^[\da-f]+$/i.test(s) || s.length % 2 !== 0)
|
|
247
|
-
throw new b("format", "Invalid hex string");
|
|
248
|
-
return Uint8Array.from(s.match(/.{1,2}/g).map((e) => parseInt(e, 16)));
|
|
249
|
-
default:
|
|
250
|
-
return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function De(s, t = "utf-8") {
|
|
254
|
-
switch (t) {
|
|
255
|
-
case "utf8":
|
|
256
|
-
case "utf-8":
|
|
257
|
-
return new TextDecoder().decode(s);
|
|
258
|
-
case "utf16le":
|
|
259
|
-
case "utf-16le":
|
|
260
|
-
case "ucs2":
|
|
261
|
-
case "ucs-2":
|
|
262
|
-
return xt(s);
|
|
263
|
-
case "latin1":
|
|
264
|
-
return String.fromCharCode(...s);
|
|
265
|
-
case "ascii":
|
|
266
|
-
return String.fromCharCode(...s.map((e) => e & 127));
|
|
267
|
-
case "base64":
|
|
268
|
-
return btoa(String.fromCharCode(...s));
|
|
269
|
-
case "hex":
|
|
270
|
-
return Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
271
|
-
default:
|
|
272
|
-
return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function Et(s) {
|
|
276
|
-
const t = new Uint8Array(s.length * 2);
|
|
277
|
-
for (let e = 0; e < s.length; e++) {
|
|
278
|
-
const n = s.charCodeAt(e);
|
|
279
|
-
t[e * 2] = n & 255, t[e * 2 + 1] = n >> 8;
|
|
280
|
-
}
|
|
281
|
-
return t;
|
|
282
|
-
}
|
|
283
|
-
function xt(s) {
|
|
284
|
-
s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
|
|
285
|
-
const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
|
|
286
|
-
return String.fromCharCode(...t);
|
|
287
|
-
}
|
|
288
|
-
function St(s) {
|
|
289
|
-
const t = new Uint8Array(s.length);
|
|
290
|
-
for (let e = 0; e < s.length; e++)
|
|
291
|
-
t[e] = s.charCodeAt(e) & 255;
|
|
292
|
-
return t;
|
|
293
|
-
}
|
|
294
|
-
function Ot(s) {
|
|
295
|
-
const t = new Uint8Array(s.length);
|
|
296
|
-
for (let e = 0; e < s.length; e++)
|
|
297
|
-
t[e] = s.charCodeAt(e) & 127;
|
|
298
|
-
return t;
|
|
299
|
-
}
|
|
300
|
-
var At = /* @__PURE__ */ ((s) => (s.Added = "added", s.Changed = "changed", s.Removed = "removed", s))(At || {});
|
|
301
164
|
const J = (s, t, e) => {
|
|
302
|
-
const n = s instanceof RegExp ? B(s, e) : s, r = t instanceof RegExp ? B(t, e) : t, i = n !== null && r != null &&
|
|
165
|
+
const n = s instanceof RegExp ? B(s, e) : s, r = t instanceof RegExp ? B(t, e) : t, i = n !== null && r != null && yt(n, r, e);
|
|
303
166
|
return i && {
|
|
304
167
|
start: i[0],
|
|
305
168
|
end: i[1],
|
|
@@ -310,7 +173,7 @@ const J = (s, t, e) => {
|
|
|
310
173
|
}, B = (s, t) => {
|
|
311
174
|
const e = t.match(s);
|
|
312
175
|
return e ? e[0] : null;
|
|
313
|
-
},
|
|
176
|
+
}, yt = (s, t, e) => {
|
|
314
177
|
let n, r, i, o, a, l = e.indexOf(s), h = e.indexOf(t, l + 1), c = l;
|
|
315
178
|
if (l >= 0 && h > 0) {
|
|
316
179
|
if (s === t)
|
|
@@ -328,15 +191,15 @@ const J = (s, t, e) => {
|
|
|
328
191
|
n.length && o !== void 0 && (a = [i, o]);
|
|
329
192
|
}
|
|
330
193
|
return a;
|
|
331
|
-
}, X = "\0SLASH" + Math.random() + "\0", K = "\0OPEN" + Math.random() + "\0", k = "\0CLOSE" + Math.random() + "\0", Q = "\0COMMA" + Math.random() + "\0", tt = "\0PERIOD" + Math.random() + "\0",
|
|
194
|
+
}, X = "\0SLASH" + Math.random() + "\0", K = "\0OPEN" + Math.random() + "\0", k = "\0CLOSE" + Math.random() + "\0", Q = "\0COMMA" + Math.random() + "\0", tt = "\0PERIOD" + Math.random() + "\0", Et = new RegExp(X, "g"), xt = new RegExp(K, "g"), St = new RegExp(k, "g"), Ot = new RegExp(Q, "g"), At = new RegExp(tt, "g"), Nt = /\\\\/g, bt = /\\{/g, vt = /\\}/g, $t = /\\,/g, Tt = /\\./g;
|
|
332
195
|
function L(s) {
|
|
333
196
|
return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
|
|
334
197
|
}
|
|
335
|
-
function
|
|
336
|
-
return s.replace(
|
|
198
|
+
function Rt(s) {
|
|
199
|
+
return s.replace(Nt, X).replace(bt, K).replace(vt, k).replace($t, Q).replace(Tt, tt);
|
|
337
200
|
}
|
|
338
|
-
function
|
|
339
|
-
return s.replace(
|
|
201
|
+
function Mt(s) {
|
|
202
|
+
return s.replace(Et, "\\").replace(xt, "{").replace(St, "}").replace(Ot, ",").replace(At, ".");
|
|
340
203
|
}
|
|
341
204
|
function et(s) {
|
|
342
205
|
if (!s)
|
|
@@ -349,19 +212,19 @@ function et(s) {
|
|
|
349
212
|
const a = et(i);
|
|
350
213
|
return i.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
|
|
351
214
|
}
|
|
352
|
-
function
|
|
353
|
-
return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), R(
|
|
215
|
+
function Ct(s) {
|
|
216
|
+
return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), R(Rt(s), !0).map(Mt)) : [];
|
|
354
217
|
}
|
|
355
|
-
function
|
|
218
|
+
function Pt(s) {
|
|
356
219
|
return "{" + s + "}";
|
|
357
220
|
}
|
|
358
|
-
function
|
|
221
|
+
function It(s) {
|
|
359
222
|
return /^-?0\d/.test(s);
|
|
360
223
|
}
|
|
361
|
-
function
|
|
224
|
+
function Dt(s, t) {
|
|
362
225
|
return s <= t;
|
|
363
226
|
}
|
|
364
|
-
function
|
|
227
|
+
function Lt(s, t) {
|
|
365
228
|
return s >= t;
|
|
366
229
|
}
|
|
367
230
|
function R(s, t) {
|
|
@@ -381,14 +244,14 @@ function R(s, t) {
|
|
|
381
244
|
let c;
|
|
382
245
|
if (l)
|
|
383
246
|
c = n.body.split(/\.\./);
|
|
384
|
-
else if (c = et(n.body), c.length === 1 && c[0] !== void 0 && (c = R(c[0], !1).map(
|
|
247
|
+
else if (c = et(n.body), c.length === 1 && c[0] !== void 0 && (c = R(c[0], !1).map(Pt), c.length === 1))
|
|
385
248
|
return i.map((f) => n.pre + c[0] + f);
|
|
386
249
|
let p;
|
|
387
250
|
if (l && c[0] !== void 0 && c[1] !== void 0) {
|
|
388
251
|
const f = L(c[0]), u = L(c[1]), g = Math.max(c[0].length, c[1].length);
|
|
389
|
-
let d = c.length === 3 && c[2] !== void 0 ? Math.abs(L(c[2])) : 1, x =
|
|
390
|
-
u < f && (d *= -1, x =
|
|
391
|
-
const v = c.some(
|
|
252
|
+
let d = c.length === 3 && c[2] !== void 0 ? Math.abs(L(c[2])) : 1, x = Dt;
|
|
253
|
+
u < f && (d *= -1, x = Lt);
|
|
254
|
+
const v = c.some(It);
|
|
392
255
|
p = [];
|
|
393
256
|
for (let S = f; x(S, u); S += d) {
|
|
394
257
|
let m;
|
|
@@ -416,12 +279,12 @@ function R(s, t) {
|
|
|
416
279
|
}
|
|
417
280
|
return e;
|
|
418
281
|
}
|
|
419
|
-
const
|
|
282
|
+
const kt = 1024 * 64, I = (s) => {
|
|
420
283
|
if (typeof s != "string")
|
|
421
284
|
throw new TypeError("invalid pattern");
|
|
422
|
-
if (s.length >
|
|
285
|
+
if (s.length > kt)
|
|
423
286
|
throw new TypeError("pattern is too long");
|
|
424
|
-
},
|
|
287
|
+
}, Ft = {
|
|
425
288
|
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
426
289
|
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
427
290
|
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
@@ -436,7 +299,7 @@ const Bt = 1024 * 64, I = (s) => {
|
|
|
436
299
|
"[:upper:]": ["\\p{Lu}", !0],
|
|
437
300
|
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
438
301
|
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
439
|
-
}, T = (s) => s.replace(/[[\]\\-]/g, "\\$&"),
|
|
302
|
+
}, T = (s) => s.replace(/[[\]\\-]/g, "\\$&"), jt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), _ = (s) => s.join(""), Wt = (s, t) => {
|
|
440
303
|
const e = t;
|
|
441
304
|
if (s.charAt(e) !== "[")
|
|
442
305
|
throw new Error("not in a brace expression");
|
|
@@ -457,7 +320,7 @@ const Bt = 1024 * 64, I = (s) => {
|
|
|
457
320
|
continue;
|
|
458
321
|
}
|
|
459
322
|
if (d === "[" && !l) {
|
|
460
|
-
for (const [x, [N, v, S]] of Object.entries(
|
|
323
|
+
for (const [x, [N, v, S]] of Object.entries(Ft))
|
|
461
324
|
if (s.startsWith(x, i)) {
|
|
462
325
|
if (p)
|
|
463
326
|
return ["$.", !1, s.length - e, !0];
|
|
@@ -485,11 +348,11 @@ const Bt = 1024 * 64, I = (s) => {
|
|
|
485
348
|
return ["$.", !1, s.length - e, !0];
|
|
486
349
|
if (r.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !h) {
|
|
487
350
|
const d = n[0].length === 2 ? n[0].slice(-1) : n[0];
|
|
488
|
-
return [
|
|
351
|
+
return [jt(d), !1, c - e, !1];
|
|
489
352
|
}
|
|
490
353
|
const f = "[" + (h ? "^" : "") + _(n) + "]", u = "[" + (h ? "" : "^") + _(r) + "]";
|
|
491
354
|
return [n.length && r.length ? "(" + f + "|" + u + ")" : n.length ? f : u, a, c - e, !0];
|
|
492
|
-
}, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"),
|
|
355
|
+
}, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"), Ut = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), q = (s) => Ut.has(s), zt = "(?!(?:^|/)\\.\\.?(?:$|/))", P = "(?!\\.)", Bt = /* @__PURE__ */ new Set(["[", "."]), _t = /* @__PURE__ */ new Set(["..", "."]), qt = new Set("().*{}+?[]^$\\!"), Gt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), F = "[^/]", G = F + "*?", H = F + "+?";
|
|
493
356
|
class E {
|
|
494
357
|
type;
|
|
495
358
|
#s;
|
|
@@ -746,14 +609,14 @@ class E {
|
|
|
746
609
|
return this.#n = this.#n || x, this.#i = this.#i || N, g;
|
|
747
610
|
}).join("");
|
|
748
611
|
let c = "";
|
|
749
|
-
if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 &&
|
|
750
|
-
const g =
|
|
612
|
+
if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && _t.has(this.#t[0]))) {
|
|
613
|
+
const g = Bt, d = (
|
|
751
614
|
// dots are allowed, and the pattern starts with [ or .
|
|
752
615
|
e && g.has(h.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
753
616
|
h.startsWith("\\.") && g.has(h.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
754
617
|
h.startsWith("\\.\\.") && g.has(h.charAt(4))
|
|
755
618
|
), x = !e && !t && g.has(h.charAt(0));
|
|
756
|
-
c = d ?
|
|
619
|
+
c = d ? zt : x ? P : "";
|
|
757
620
|
}
|
|
758
621
|
let p = "";
|
|
759
622
|
return this.isEnd() && this.#s.#c && this.#e?.type === "!" && (p = "(?:$|\\/)"), [
|
|
@@ -801,7 +664,7 @@ class E {
|
|
|
801
664
|
for (let a = 0; a < t.length; a++) {
|
|
802
665
|
const l = t.charAt(a);
|
|
803
666
|
if (r) {
|
|
804
|
-
r = !1, i += (
|
|
667
|
+
r = !1, i += (qt.has(l) ? "\\" : "") + l;
|
|
805
668
|
continue;
|
|
806
669
|
}
|
|
807
670
|
if (l === "\\") {
|
|
@@ -809,7 +672,7 @@ class E {
|
|
|
809
672
|
continue;
|
|
810
673
|
}
|
|
811
674
|
if (l === "[") {
|
|
812
|
-
const [h, c, p, f] =
|
|
675
|
+
const [h, c, p, f] = Wt(t, a);
|
|
813
676
|
if (p) {
|
|
814
677
|
i += h, o = o || c, a += p - 1, e = e || f;
|
|
815
678
|
continue;
|
|
@@ -823,21 +686,21 @@ class E {
|
|
|
823
686
|
i += F, e = !0;
|
|
824
687
|
continue;
|
|
825
688
|
}
|
|
826
|
-
i +=
|
|
689
|
+
i += Gt(l);
|
|
827
690
|
}
|
|
828
691
|
return [i, M(t), !!e, o];
|
|
829
692
|
}
|
|
830
693
|
}
|
|
831
|
-
const
|
|
694
|
+
const Ht = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), w = (s, t, e = {}) => (I(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(s)), Vt = /^\*+([^+@!?\*\[\(]*)$/, Yt = (s) => (t) => !t.startsWith(".") && t.endsWith(s), Zt = (s) => (t) => t.endsWith(s), Jt = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Xt = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Kt = /^\*+\.\*+$/, Qt = (s) => !s.startsWith(".") && s.includes("."), te = (s) => s !== "." && s !== ".." && s.includes("."), ee = /^\.\*+$/, se = (s) => s !== "." && s !== ".." && s.startsWith("."), ne = /^\*+$/, re = (s) => s.length !== 0 && !s.startsWith("."), ie = (s) => s.length !== 0 && s !== "." && s !== "..", oe = /^\?+([^+@!?\*\[\(]*)?$/, ce = ([s, t = ""]) => {
|
|
832
695
|
const e = st([s]);
|
|
833
696
|
return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
|
|
834
|
-
},
|
|
697
|
+
}, ae = ([s, t = ""]) => {
|
|
835
698
|
const e = nt([s]);
|
|
836
699
|
return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
|
|
837
|
-
},
|
|
700
|
+
}, le = ([s, t = ""]) => {
|
|
838
701
|
const e = nt([s]);
|
|
839
702
|
return t ? (n) => e(n) && n.endsWith(t) : e;
|
|
840
|
-
},
|
|
703
|
+
}, he = ([s, t = ""]) => {
|
|
841
704
|
const e = st([s]);
|
|
842
705
|
return t ? (n) => e(n) && n.endsWith(t) : e;
|
|
843
706
|
}, st = ([s]) => {
|
|
@@ -849,13 +712,13 @@ const Kt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]
|
|
|
849
712
|
}, rt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", V = {
|
|
850
713
|
win32: { sep: "\\" },
|
|
851
714
|
posix: { sep: "/" }
|
|
852
|
-
},
|
|
853
|
-
w.sep =
|
|
715
|
+
}, ue = rt === "win32" ? V.win32.sep : V.posix.sep;
|
|
716
|
+
w.sep = ue;
|
|
854
717
|
const A = Symbol("globstar **");
|
|
855
718
|
w.GLOBSTAR = A;
|
|
856
|
-
const
|
|
857
|
-
w.filter =
|
|
858
|
-
const O = (s, t = {}) => Object.assign({}, s, t),
|
|
719
|
+
const fe = "[^/]", pe = fe + "*?", de = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", ge = "(?:(?!(?:\\/|^)\\.).)*?", me = (s, t = {}) => (e) => w(e, s, t);
|
|
720
|
+
w.filter = me;
|
|
721
|
+
const O = (s, t = {}) => Object.assign({}, s, t), we = (s) => {
|
|
859
722
|
if (!s || typeof s != "object" || !Object.keys(s).length)
|
|
860
723
|
return w;
|
|
861
724
|
const t = w;
|
|
@@ -889,17 +752,17 @@ const O = (s, t = {}) => Object.assign({}, s, t), Ae = (s) => {
|
|
|
889
752
|
GLOBSTAR: A
|
|
890
753
|
});
|
|
891
754
|
};
|
|
892
|
-
w.defaults =
|
|
893
|
-
const it = (s, t = {}) => (I(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] :
|
|
755
|
+
w.defaults = we;
|
|
756
|
+
const it = (s, t = {}) => (I(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : Ct(s));
|
|
894
757
|
w.braceExpand = it;
|
|
895
|
-
const
|
|
896
|
-
w.makeRe =
|
|
897
|
-
const
|
|
758
|
+
const ye = (s, t = {}) => new D(s, t).makeRe();
|
|
759
|
+
w.makeRe = ye;
|
|
760
|
+
const Ee = (s, t, e = {}) => {
|
|
898
761
|
const n = new D(t, e);
|
|
899
762
|
return s = s.filter((r) => n.match(r)), n.options.nonull && !s.length && s.push(t), s;
|
|
900
763
|
};
|
|
901
|
-
w.match =
|
|
902
|
-
const Y = /[?*]|[+@!]\(.*?\)|\[|\]/,
|
|
764
|
+
w.match = Ee;
|
|
765
|
+
const Y = /[?*]|[+@!]\(.*?\)|\[|\]/, xe = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
903
766
|
class D {
|
|
904
767
|
options;
|
|
905
768
|
set;
|
|
@@ -1186,7 +1049,7 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
1186
1049
|
if (t === "")
|
|
1187
1050
|
return "";
|
|
1188
1051
|
let n, r = null;
|
|
1189
|
-
(n = t.match(
|
|
1052
|
+
(n = t.match(ne)) ? r = e.dot ? ie : re : (n = t.match(Vt)) ? r = (e.nocase ? e.dot ? Xt : Jt : e.dot ? Zt : Yt)(n[1]) : (n = t.match(oe)) ? r = (e.nocase ? e.dot ? ae : ce : e.dot ? le : he)(n) : (n = t.match(Kt)) ? r = e.dot ? te : Qt : (n = t.match(ee)) && (r = se);
|
|
1190
1053
|
const i = E.fromGlob(t, this.options).toMMPattern();
|
|
1191
1054
|
return r && typeof i == "object" && Reflect.defineProperty(i, "test", { value: r }), i;
|
|
1192
1055
|
}
|
|
@@ -1196,13 +1059,13 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
1196
1059
|
const t = this.set;
|
|
1197
1060
|
if (!t.length)
|
|
1198
1061
|
return this.regexp = !1, this.regexp;
|
|
1199
|
-
const e = this.options, n = e.noglobstar ?
|
|
1062
|
+
const e = this.options, n = e.noglobstar ? pe : e.dot ? de : ge, r = new Set(e.nocase ? ["i"] : []);
|
|
1200
1063
|
let i = t.map((l) => {
|
|
1201
1064
|
const h = l.map((c) => {
|
|
1202
1065
|
if (c instanceof RegExp)
|
|
1203
1066
|
for (const p of c.flags.split(""))
|
|
1204
1067
|
r.add(p);
|
|
1205
|
-
return typeof c == "string" ?
|
|
1068
|
+
return typeof c == "string" ? xe(c) : c === A ? A : c._src;
|
|
1206
1069
|
});
|
|
1207
1070
|
return h.forEach((c, p) => {
|
|
1208
1071
|
const f = h[p + 1], u = h[p - 1];
|
|
@@ -1252,14 +1115,151 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
1252
1115
|
}
|
|
1253
1116
|
w.AST = E;
|
|
1254
1117
|
w.Minimatch = D;
|
|
1255
|
-
w.escape =
|
|
1118
|
+
w.escape = Ht;
|
|
1256
1119
|
w.unescape = M;
|
|
1120
|
+
const Se = [
|
|
1121
|
+
// Images
|
|
1122
|
+
".jpg",
|
|
1123
|
+
".jpeg",
|
|
1124
|
+
".png",
|
|
1125
|
+
".gif",
|
|
1126
|
+
".bmp",
|
|
1127
|
+
".webp",
|
|
1128
|
+
".ico",
|
|
1129
|
+
".tiff",
|
|
1130
|
+
".tga",
|
|
1131
|
+
// Audio
|
|
1132
|
+
".mp3",
|
|
1133
|
+
".wav",
|
|
1134
|
+
".ogg",
|
|
1135
|
+
".flac",
|
|
1136
|
+
".aac",
|
|
1137
|
+
".wma",
|
|
1138
|
+
".m4a",
|
|
1139
|
+
// Video
|
|
1140
|
+
".mp4",
|
|
1141
|
+
".avi",
|
|
1142
|
+
".mov",
|
|
1143
|
+
".wmv",
|
|
1144
|
+
".flv",
|
|
1145
|
+
".webm",
|
|
1146
|
+
".mkv",
|
|
1147
|
+
".m4v",
|
|
1148
|
+
// Documents
|
|
1149
|
+
".pdf",
|
|
1150
|
+
".doc",
|
|
1151
|
+
".docx",
|
|
1152
|
+
".xls",
|
|
1153
|
+
".xlsx",
|
|
1154
|
+
".ppt",
|
|
1155
|
+
".pptx",
|
|
1156
|
+
// Archives
|
|
1157
|
+
".zip",
|
|
1158
|
+
".rar",
|
|
1159
|
+
".7z",
|
|
1160
|
+
".tar",
|
|
1161
|
+
".gz",
|
|
1162
|
+
".bz2",
|
|
1163
|
+
// Executables
|
|
1164
|
+
".exe",
|
|
1165
|
+
".dll",
|
|
1166
|
+
".so",
|
|
1167
|
+
".dylib",
|
|
1168
|
+
// Other binary formats
|
|
1169
|
+
".dat",
|
|
1170
|
+
".db",
|
|
1171
|
+
".sqlite",
|
|
1172
|
+
".bin",
|
|
1173
|
+
".obj",
|
|
1174
|
+
".fbx",
|
|
1175
|
+
".3ds"
|
|
1176
|
+
];
|
|
1177
|
+
function Le(s) {
|
|
1178
|
+
const t = s.lastIndexOf(".");
|
|
1179
|
+
if (t <= 0)
|
|
1180
|
+
return !0;
|
|
1181
|
+
const e = s.slice(t).toLowerCase();
|
|
1182
|
+
return Se.includes(e);
|
|
1183
|
+
}
|
|
1184
|
+
function Oe(s, t = "utf-8") {
|
|
1185
|
+
switch (t) {
|
|
1186
|
+
case "utf8":
|
|
1187
|
+
case "utf-8":
|
|
1188
|
+
return new TextEncoder().encode(s);
|
|
1189
|
+
case "utf16le":
|
|
1190
|
+
case "utf-16le":
|
|
1191
|
+
case "ucs2":
|
|
1192
|
+
case "ucs-2":
|
|
1193
|
+
return Ae(s);
|
|
1194
|
+
case "ascii":
|
|
1195
|
+
return ve(s);
|
|
1196
|
+
case "latin1":
|
|
1197
|
+
return be(s);
|
|
1198
|
+
case "binary":
|
|
1199
|
+
return Uint8Array.from(s, (e) => e.charCodeAt(0));
|
|
1200
|
+
case "base64":
|
|
1201
|
+
return Uint8Array.from(atob(s), (e) => e.charCodeAt(0));
|
|
1202
|
+
case "hex":
|
|
1203
|
+
if (!/^[\da-f]+$/i.test(s) || s.length % 2 !== 0)
|
|
1204
|
+
throw new b("format", "Invalid hex string");
|
|
1205
|
+
return Uint8Array.from(s.match(/.{1,2}/g).map((e) => parseInt(e, 16)));
|
|
1206
|
+
default:
|
|
1207
|
+
return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
function ke(s, t = "utf-8") {
|
|
1211
|
+
switch (t) {
|
|
1212
|
+
case "utf8":
|
|
1213
|
+
case "utf-8":
|
|
1214
|
+
return new TextDecoder().decode(s);
|
|
1215
|
+
case "utf16le":
|
|
1216
|
+
case "utf-16le":
|
|
1217
|
+
case "ucs2":
|
|
1218
|
+
case "ucs-2":
|
|
1219
|
+
return Ne(s);
|
|
1220
|
+
case "latin1":
|
|
1221
|
+
return String.fromCharCode(...s);
|
|
1222
|
+
case "ascii":
|
|
1223
|
+
return String.fromCharCode(...s.map((e) => e & 127));
|
|
1224
|
+
case "base64":
|
|
1225
|
+
return btoa(String.fromCharCode(...s));
|
|
1226
|
+
case "hex":
|
|
1227
|
+
return Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
1228
|
+
default:
|
|
1229
|
+
return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
function Ae(s) {
|
|
1233
|
+
const t = new Uint8Array(s.length * 2);
|
|
1234
|
+
for (let e = 0; e < s.length; e++) {
|
|
1235
|
+
const n = s.charCodeAt(e);
|
|
1236
|
+
t[e * 2] = n & 255, t[e * 2 + 1] = n >> 8;
|
|
1237
|
+
}
|
|
1238
|
+
return t;
|
|
1239
|
+
}
|
|
1240
|
+
function Ne(s) {
|
|
1241
|
+
s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
|
|
1242
|
+
const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
|
|
1243
|
+
return String.fromCharCode(...t);
|
|
1244
|
+
}
|
|
1245
|
+
function be(s) {
|
|
1246
|
+
const t = new Uint8Array(s.length);
|
|
1247
|
+
for (let e = 0; e < s.length; e++)
|
|
1248
|
+
t[e] = s.charCodeAt(e) & 255;
|
|
1249
|
+
return t;
|
|
1250
|
+
}
|
|
1251
|
+
function ve(s) {
|
|
1252
|
+
const t = new Uint8Array(s.length);
|
|
1253
|
+
for (let e = 0; e < s.length; e++)
|
|
1254
|
+
t[e] = s.charCodeAt(e) & 127;
|
|
1255
|
+
return t;
|
|
1256
|
+
}
|
|
1257
1257
|
function Fe() {
|
|
1258
1258
|
if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
|
|
1259
|
-
throw new
|
|
1259
|
+
throw new ut();
|
|
1260
1260
|
}
|
|
1261
|
-
async function $e(s, t
|
|
1262
|
-
return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/")}`, { mode:
|
|
1261
|
+
async function $e(s, t) {
|
|
1262
|
+
return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/")}`, { mode: "exclusive" }, t) : t();
|
|
1263
1263
|
}
|
|
1264
1264
|
function j(s) {
|
|
1265
1265
|
return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
|
|
@@ -1310,7 +1310,7 @@ function _e(s) {
|
|
|
1310
1310
|
return e <= 0 || e === t.length - 1 ? "" : t.slice(e);
|
|
1311
1311
|
}
|
|
1312
1312
|
function qe(s, t = "utf-8") {
|
|
1313
|
-
return typeof s == "string" ?
|
|
1313
|
+
return typeof s == "string" ? Oe(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
|
|
1314
1314
|
}
|
|
1315
1315
|
async function Ge(s, t = "SHA-1", e = 50 * 1024 * 1024) {
|
|
1316
1316
|
if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
|
|
@@ -1332,7 +1332,7 @@ async function Ve(s) {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
async function Ye(s, t, e = {}) {
|
|
1334
1334
|
const n = ct(t);
|
|
1335
|
-
return $e(t,
|
|
1335
|
+
return $e(t, async () => {
|
|
1336
1336
|
const r = e.recursive ?? !1, i = e.force ?? !1;
|
|
1337
1337
|
try {
|
|
1338
1338
|
await s.removeEntry(n, { recursive: r });
|
|
@@ -1383,29 +1383,29 @@ export {
|
|
|
1383
1383
|
He as B,
|
|
1384
1384
|
Ve as C,
|
|
1385
1385
|
z as D,
|
|
1386
|
-
|
|
1387
|
-
|
|
1386
|
+
ft as E,
|
|
1387
|
+
gt as F,
|
|
1388
1388
|
Ye as G,
|
|
1389
1389
|
Ze as H,
|
|
1390
1390
|
U as I,
|
|
1391
1391
|
Je as J,
|
|
1392
1392
|
Xe as K,
|
|
1393
1393
|
Ke as L,
|
|
1394
|
-
|
|
1394
|
+
Se as M,
|
|
1395
1395
|
y as O,
|
|
1396
1396
|
Te as P,
|
|
1397
|
-
|
|
1397
|
+
dt as S,
|
|
1398
1398
|
b as V,
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1399
|
+
lt as W,
|
|
1400
|
+
ut as a,
|
|
1401
|
+
pt as b,
|
|
1402
1402
|
W as c,
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1403
|
+
ke as d,
|
|
1404
|
+
Oe as e,
|
|
1405
|
+
mt as f,
|
|
1406
|
+
wt as g,
|
|
1407
1407
|
Re as h,
|
|
1408
|
-
|
|
1408
|
+
Le as i,
|
|
1409
1409
|
Me as j,
|
|
1410
1410
|
Pe as k,
|
|
1411
1411
|
Fe as l,
|
|
@@ -1424,4 +1424,4 @@ export {
|
|
|
1424
1424
|
qe as y,
|
|
1425
1425
|
Ge as z
|
|
1426
1426
|
};
|
|
1427
|
-
//# sourceMappingURL=helpers-
|
|
1427
|
+
//# sourceMappingURL=helpers-WY2jfbOT.js.map
|