opfs-worker 1.0.1 → 1.2.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 +38 -6
- package/dist/assets/worker-CLvhwwfc.js.map +1 -0
- package/dist/facade.d.ts +141 -0
- package/dist/facade.d.ts.map +1 -0
- package/dist/{helpers-CTCvNFs1.js → helpers-CkNHswLp.js} +412 -373
- package/dist/helpers-CkNHswLp.js.map +1 -0
- package/dist/helpers-TAynP0fb.cjs +4 -0
- package/dist/helpers-TAynP0fb.cjs.map +1 -0
- package/dist/index.cjs +641 -474
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +886 -522
- package/dist/index.js.map +1 -1
- package/dist/raw.cjs +1 -1
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.d.ts +13 -0
- package/dist/raw.d.ts.map +1 -0
- package/dist/raw.js +331 -59
- package/dist/raw.js.map +1 -1
- package/dist/types.d.ts +8 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/encoder.d.ts +20 -2
- package/dist/utils/encoder.d.ts.map +1 -1
- package/dist/utils/errors.d.ts +23 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts +42 -40
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/worker.d.ts +178 -31
- package/dist/worker.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/assets/worker-CccfxYdr.js.map +0 -1
- package/dist/helpers-CTCvNFs1.js.map +0 -1
- package/dist/helpers-Cvjm0f_r.cjs +0 -4
- package/dist/helpers-Cvjm0f_r.cjs.map +0 -1
|
@@ -1,50 +1,217 @@
|
|
|
1
|
-
class
|
|
1
|
+
class g extends Error {
|
|
2
2
|
constructor(t, e, n, i) {
|
|
3
3
|
super(t, { cause: i }), this.code = e, this.path = n, this.name = "OPFSError";
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
class
|
|
6
|
+
class it extends g {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
class me extends
|
|
11
|
+
class me extends g {
|
|
12
12
|
constructor(t) {
|
|
13
13
|
super("OPFS is not mounted", "OPFS_NOT_MOUNTED", void 0, t);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
class we extends
|
|
16
|
+
class we extends g {
|
|
17
17
|
constructor(t, e, n) {
|
|
18
18
|
super(t, "INVALID_PATH", e, n);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class ye extends
|
|
21
|
+
class ye extends g {
|
|
22
22
|
constructor(t, e) {
|
|
23
23
|
super(`File not found: ${t}`, "FILE_NOT_FOUND", t, e);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
class Ee extends
|
|
26
|
+
class Ee extends g {
|
|
27
27
|
constructor(t, e) {
|
|
28
28
|
super(`Directory not found: ${t}`, "DIRECTORY_NOT_FOUND", t, e);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
class
|
|
31
|
+
class Se extends g {
|
|
32
32
|
constructor(t, e, n) {
|
|
33
33
|
super(`Permission denied for ${e} on: ${t}`, "PERMISSION_DENIED", t, n);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
class
|
|
36
|
+
class xe extends g {
|
|
37
37
|
constructor(t, e, n) {
|
|
38
38
|
super(t, "STORAGE_ERROR", e, n);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
class
|
|
41
|
+
class Ne extends g {
|
|
42
42
|
constructor(t, e, n) {
|
|
43
43
|
super(`Operation timed out: ${t}`, "TIMEOUT_ERROR", e, n);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
const
|
|
46
|
+
function Oe(s, t, e, n) {
|
|
47
|
+
const i = `${s.toUpperCase()}_FAILED`;
|
|
48
|
+
return new g(`Failed to ${s} file descriptor: ${t}`, i, e, n);
|
|
49
|
+
}
|
|
50
|
+
function rt(s, t) {
|
|
51
|
+
const e = t?.path, n = t?.isDirectory;
|
|
52
|
+
switch (s.name) {
|
|
53
|
+
case "InvalidStateError":
|
|
54
|
+
return new g(`File is busy: ${e || "unknown"}`, "EBUSY", e, s);
|
|
55
|
+
case "QuotaExceededError":
|
|
56
|
+
return new g(`No space left on device: ${e || "unknown"}`, "ENOSPC", e, s);
|
|
57
|
+
case "NotFoundError":
|
|
58
|
+
return new g(`No such file or directory: ${e || "unknown"}`, "ENOENT", e, s);
|
|
59
|
+
case "TypeMismatchError":
|
|
60
|
+
return n !== void 0 ? n ? new g(`Not a directory: ${e || "unknown"}`, "ENOTDIR", e, s) : new g(`Is a directory: ${e || "unknown"}`, "EISDIR", e, s) : new g(`Type mismatch: ${e || "unknown"}`, "EINVAL", e, s);
|
|
61
|
+
case "NotAllowedError":
|
|
62
|
+
case "SecurityError":
|
|
63
|
+
return new g(`Permission denied: ${e || "unknown"}`, "EACCES", e, s);
|
|
64
|
+
case "InvalidModificationError":
|
|
65
|
+
return new g(`Invalid modification: ${e || "unknown"}`, "EINVAL", e, s);
|
|
66
|
+
case "AbortError":
|
|
67
|
+
return new g(`Operation aborted: ${e || "unknown"}`, "EINTR", e, s);
|
|
68
|
+
case "OperationError":
|
|
69
|
+
return new g(`Operation failed: ${e || "unknown"}`, "EIO", e, s);
|
|
70
|
+
case "TypeError":
|
|
71
|
+
return new g(`Operation not supported: ${e || "unknown"}`, "ENOTSUP", e, s);
|
|
72
|
+
default:
|
|
73
|
+
return new g(`I/O error: ${e || "unknown"}`, "EIO", e, s);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const ot = [
|
|
77
|
+
// Images
|
|
78
|
+
".jpg",
|
|
79
|
+
".jpeg",
|
|
80
|
+
".png",
|
|
81
|
+
".gif",
|
|
82
|
+
".bmp",
|
|
83
|
+
".webp",
|
|
84
|
+
".ico",
|
|
85
|
+
".tiff",
|
|
86
|
+
".tga",
|
|
87
|
+
// Audio
|
|
88
|
+
".mp3",
|
|
89
|
+
".wav",
|
|
90
|
+
".ogg",
|
|
91
|
+
".flac",
|
|
92
|
+
".aac",
|
|
93
|
+
".wma",
|
|
94
|
+
".m4a",
|
|
95
|
+
// Video
|
|
96
|
+
".mp4",
|
|
97
|
+
".avi",
|
|
98
|
+
".mov",
|
|
99
|
+
".wmv",
|
|
100
|
+
".flv",
|
|
101
|
+
".webm",
|
|
102
|
+
".mkv",
|
|
103
|
+
".m4v",
|
|
104
|
+
// Documents
|
|
105
|
+
".pdf",
|
|
106
|
+
".doc",
|
|
107
|
+
".docx",
|
|
108
|
+
".xls",
|
|
109
|
+
".xlsx",
|
|
110
|
+
".ppt",
|
|
111
|
+
".pptx",
|
|
112
|
+
// Archives
|
|
113
|
+
".zip",
|
|
114
|
+
".rar",
|
|
115
|
+
".7z",
|
|
116
|
+
".tar",
|
|
117
|
+
".gz",
|
|
118
|
+
".bz2",
|
|
119
|
+
// Executables
|
|
120
|
+
".exe",
|
|
121
|
+
".dll",
|
|
122
|
+
".so",
|
|
123
|
+
".dylib",
|
|
124
|
+
// Other binary formats
|
|
125
|
+
".dat",
|
|
126
|
+
".db",
|
|
127
|
+
".sqlite",
|
|
128
|
+
".bin",
|
|
129
|
+
".obj",
|
|
130
|
+
".fbx",
|
|
131
|
+
".3ds"
|
|
132
|
+
];
|
|
133
|
+
function be(s) {
|
|
134
|
+
const t = s.lastIndexOf(".");
|
|
135
|
+
if (t <= 0)
|
|
136
|
+
return !0;
|
|
137
|
+
const e = s.slice(t).toLowerCase();
|
|
138
|
+
return ot.includes(e);
|
|
139
|
+
}
|
|
140
|
+
function ct(s, t = "utf-8") {
|
|
141
|
+
switch (t) {
|
|
142
|
+
case "utf8":
|
|
143
|
+
case "utf-8":
|
|
144
|
+
return new TextEncoder().encode(s);
|
|
145
|
+
case "utf16le":
|
|
146
|
+
case "utf-16le":
|
|
147
|
+
case "ucs2":
|
|
148
|
+
case "ucs-2":
|
|
149
|
+
return at(s);
|
|
150
|
+
case "ascii":
|
|
151
|
+
return ut(s);
|
|
152
|
+
case "latin1":
|
|
153
|
+
return lt(s);
|
|
154
|
+
case "binary":
|
|
155
|
+
return Uint8Array.from(s, (e) => e.charCodeAt(0));
|
|
156
|
+
case "base64":
|
|
157
|
+
return Uint8Array.from(atob(s), (e) => e.charCodeAt(0));
|
|
158
|
+
case "hex":
|
|
159
|
+
if (!/^[\da-f]+$/i.test(s) || s.length % 2 !== 0)
|
|
160
|
+
throw new g("Invalid hex string", "INVALID_HEX_FORMAT");
|
|
161
|
+
return Uint8Array.from(s.match(/.{1,2}/g).map((e) => parseInt(e, 16)));
|
|
162
|
+
default:
|
|
163
|
+
return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function Ae(s, t = "utf-8") {
|
|
167
|
+
switch (t) {
|
|
168
|
+
case "utf8":
|
|
169
|
+
case "utf-8":
|
|
170
|
+
return new TextDecoder().decode(s);
|
|
171
|
+
case "utf16le":
|
|
172
|
+
case "utf-16le":
|
|
173
|
+
case "ucs2":
|
|
174
|
+
case "ucs-2":
|
|
175
|
+
return ht(s);
|
|
176
|
+
case "latin1":
|
|
177
|
+
return String.fromCharCode(...s);
|
|
178
|
+
case "ascii":
|
|
179
|
+
return String.fromCharCode(...s.map((e) => e & 127));
|
|
180
|
+
case "base64":
|
|
181
|
+
return btoa(String.fromCharCode(...s));
|
|
182
|
+
case "hex":
|
|
183
|
+
return Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
184
|
+
default:
|
|
185
|
+
return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function at(s) {
|
|
189
|
+
const t = new Uint8Array(s.length * 2);
|
|
190
|
+
for (let e = 0; e < s.length; e++) {
|
|
191
|
+
const n = s.charCodeAt(e);
|
|
192
|
+
t[e * 2] = n & 255, t[e * 2 + 1] = n >> 8;
|
|
193
|
+
}
|
|
194
|
+
return t;
|
|
195
|
+
}
|
|
196
|
+
function ht(s) {
|
|
197
|
+
s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
|
|
198
|
+
const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
|
|
199
|
+
return String.fromCharCode(...t);
|
|
200
|
+
}
|
|
201
|
+
function lt(s) {
|
|
202
|
+
const t = new Uint8Array(s.length);
|
|
203
|
+
for (let e = 0; e < s.length; e++)
|
|
204
|
+
t[e] = s.charCodeAt(e) & 255;
|
|
205
|
+
return t;
|
|
206
|
+
}
|
|
207
|
+
function ut(s) {
|
|
208
|
+
const t = new Uint8Array(s.length);
|
|
209
|
+
for (let e = 0; e < s.length; e++)
|
|
210
|
+
t[e] = s.charCodeAt(e) & 127;
|
|
211
|
+
return t;
|
|
212
|
+
}
|
|
213
|
+
const G = (s, t, e) => {
|
|
214
|
+
const n = s instanceof RegExp ? W(s, e) : s, i = t instanceof RegExp ? W(t, e) : t, r = n !== null && i != null && ft(n, i, e);
|
|
48
215
|
return r && {
|
|
49
216
|
start: r[0],
|
|
50
217
|
end: r[1],
|
|
@@ -55,7 +222,7 @@ const H = (s, t, e) => {
|
|
|
55
222
|
}, W = (s, t) => {
|
|
56
223
|
const e = t.match(s);
|
|
57
224
|
return e ? e[0] : null;
|
|
58
|
-
},
|
|
225
|
+
}, ft = (s, t, e) => {
|
|
59
226
|
let n, i, r, o, a, h = e.indexOf(s), l = e.indexOf(t, h + 1), c = h;
|
|
60
227
|
if (h >= 0 && l > 0) {
|
|
61
228
|
if (s === t)
|
|
@@ -73,44 +240,44 @@ const H = (s, t, e) => {
|
|
|
73
240
|
n.length && o !== void 0 && (a = [r, o]);
|
|
74
241
|
}
|
|
75
242
|
return a;
|
|
76
|
-
},
|
|
77
|
-
function
|
|
243
|
+
}, H = "\0SLASH" + Math.random() + "\0", V = "\0OPEN" + Math.random() + "\0", L = "\0CLOSE" + Math.random() + "\0", Z = "\0COMMA" + Math.random() + "\0", Y = "\0PERIOD" + Math.random() + "\0", pt = new RegExp(H, "g"), dt = new RegExp(V, "g"), gt = new RegExp(L, "g"), mt = new RegExp(Z, "g"), wt = new RegExp(Y, "g"), yt = /\\\\/g, Et = /\\{/g, St = /\\}/g, xt = /\\,/g, Nt = /\\./g;
|
|
244
|
+
function D(s) {
|
|
78
245
|
return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
|
|
79
246
|
}
|
|
80
|
-
function
|
|
81
|
-
return s.replace(
|
|
247
|
+
function Ot(s) {
|
|
248
|
+
return s.replace(yt, H).replace(Et, V).replace(St, L).replace(xt, Z).replace(Nt, Y);
|
|
82
249
|
}
|
|
83
|
-
function
|
|
84
|
-
return s.replace(
|
|
250
|
+
function bt(s) {
|
|
251
|
+
return s.replace(pt, "\\").replace(dt, "{").replace(gt, "}").replace(mt, ",").replace(wt, ".");
|
|
85
252
|
}
|
|
86
|
-
function
|
|
253
|
+
function J(s) {
|
|
87
254
|
if (!s)
|
|
88
255
|
return [""];
|
|
89
|
-
const t = [], e =
|
|
256
|
+
const t = [], e = G("{", "}", s);
|
|
90
257
|
if (!e)
|
|
91
258
|
return s.split(",");
|
|
92
259
|
const { pre: n, body: i, post: r } = e, o = n.split(",");
|
|
93
260
|
o[o.length - 1] += "{" + i + "}";
|
|
94
|
-
const a =
|
|
261
|
+
const a = J(r);
|
|
95
262
|
return r.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
|
|
96
263
|
}
|
|
97
|
-
function
|
|
98
|
-
return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(
|
|
264
|
+
function At(s) {
|
|
265
|
+
return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(Ot(s), !0).map(bt)) : [];
|
|
99
266
|
}
|
|
100
|
-
function
|
|
267
|
+
function vt(s) {
|
|
101
268
|
return "{" + s + "}";
|
|
102
269
|
}
|
|
103
|
-
function
|
|
270
|
+
function $t(s) {
|
|
104
271
|
return /^-?0\d/.test(s);
|
|
105
272
|
}
|
|
106
|
-
function
|
|
273
|
+
function Tt(s, t) {
|
|
107
274
|
return s <= t;
|
|
108
275
|
}
|
|
109
|
-
function
|
|
276
|
+
function Mt(s, t) {
|
|
110
277
|
return s >= t;
|
|
111
278
|
}
|
|
112
279
|
function T(s, t) {
|
|
113
|
-
const e = [], n =
|
|
280
|
+
const e = [], n = G("{", "}", s);
|
|
114
281
|
if (!n)
|
|
115
282
|
return [s];
|
|
116
283
|
const i = n.pre, r = n.post.length ? T(n.post, !1) : [""];
|
|
@@ -122,31 +289,31 @@ function T(s, t) {
|
|
|
122
289
|
else {
|
|
123
290
|
const o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body), h = o || a, l = n.body.indexOf(",") >= 0;
|
|
124
291
|
if (!h && !l)
|
|
125
|
-
return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body +
|
|
292
|
+
return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body + L + n.post, T(s)) : [s];
|
|
126
293
|
let c;
|
|
127
294
|
if (h)
|
|
128
295
|
c = n.body.split(/\.\./);
|
|
129
|
-
else if (c =
|
|
296
|
+
else if (c = J(n.body), c.length === 1 && c[0] !== void 0 && (c = T(c[0], !1).map(vt), c.length === 1))
|
|
130
297
|
return r.map((f) => n.pre + c[0] + f);
|
|
131
298
|
let p;
|
|
132
299
|
if (h && c[0] !== void 0 && c[1] !== void 0) {
|
|
133
|
-
const f =
|
|
134
|
-
let d = c.length === 3 && c[2] !== void 0 ? Math.abs(
|
|
135
|
-
u < f && (d *= -1,
|
|
136
|
-
const A = c.some(
|
|
300
|
+
const f = D(c[0]), u = D(c[1]), m = Math.max(c[0].length, c[1].length);
|
|
301
|
+
let d = c.length === 3 && c[2] !== void 0 ? Math.abs(D(c[2])) : 1, S = Tt;
|
|
302
|
+
u < f && (d *= -1, S = Mt);
|
|
303
|
+
const A = c.some($t);
|
|
137
304
|
p = [];
|
|
138
|
-
for (let
|
|
139
|
-
let
|
|
305
|
+
for (let x = f; S(x, u); x += d) {
|
|
306
|
+
let w;
|
|
140
307
|
if (a)
|
|
141
|
-
|
|
142
|
-
else if (
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
145
|
-
const P = new Array(
|
|
146
|
-
|
|
308
|
+
w = String.fromCharCode(x), w === "\\" && (w = "");
|
|
309
|
+
else if (w = String(x), A) {
|
|
310
|
+
const v = m - w.length;
|
|
311
|
+
if (v > 0) {
|
|
312
|
+
const P = new Array(v + 1).join("0");
|
|
313
|
+
x < 0 ? w = "-" + P + w.slice(1) : w = P + w;
|
|
147
314
|
}
|
|
148
315
|
}
|
|
149
|
-
p.push(
|
|
316
|
+
p.push(w);
|
|
150
317
|
}
|
|
151
318
|
} else {
|
|
152
319
|
p = [];
|
|
@@ -155,18 +322,18 @@ function T(s, t) {
|
|
|
155
322
|
}
|
|
156
323
|
for (let f = 0; f < p.length; f++)
|
|
157
324
|
for (let u = 0; u < r.length; u++) {
|
|
158
|
-
const
|
|
159
|
-
(!t || h ||
|
|
325
|
+
const m = i + p[f] + r[u];
|
|
326
|
+
(!t || h || m) && e.push(m);
|
|
160
327
|
}
|
|
161
328
|
}
|
|
162
329
|
return e;
|
|
163
330
|
}
|
|
164
|
-
const
|
|
331
|
+
const Pt = 1024 * 64, C = (s) => {
|
|
165
332
|
if (typeof s != "string")
|
|
166
333
|
throw new TypeError("invalid pattern");
|
|
167
|
-
if (s.length >
|
|
334
|
+
if (s.length > Pt)
|
|
168
335
|
throw new TypeError("pattern is too long");
|
|
169
|
-
},
|
|
336
|
+
}, Rt = {
|
|
170
337
|
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
171
338
|
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
172
339
|
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
@@ -181,7 +348,7 @@ const vt = 1024 * 64, C = (s) => {
|
|
|
181
348
|
"[:upper:]": ["\\p{Lu}", !0],
|
|
182
349
|
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
183
350
|
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
184
|
-
}, $ = (s) => s.replace(/[[\]\\-]/g, "\\$&"),
|
|
351
|
+
}, $ = (s) => s.replace(/[[\]\\-]/g, "\\$&"), Ct = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), j = (s) => s.join(""), It = (s, t) => {
|
|
185
352
|
const e = t;
|
|
186
353
|
if (s.charAt(e) !== "[")
|
|
187
354
|
throw new Error("not in a brace expression");
|
|
@@ -202,11 +369,11 @@ const vt = 1024 * 64, C = (s) => {
|
|
|
202
369
|
continue;
|
|
203
370
|
}
|
|
204
371
|
if (d === "[" && !h) {
|
|
205
|
-
for (const [
|
|
206
|
-
if (s.startsWith(
|
|
372
|
+
for (const [S, [b, A, x]] of Object.entries(Rt))
|
|
373
|
+
if (s.startsWith(S, r)) {
|
|
207
374
|
if (p)
|
|
208
375
|
return ["$.", !1, s.length - e, !0];
|
|
209
|
-
r +=
|
|
376
|
+
r += S.length, x ? i.push(b) : n.push(b), a = a || A;
|
|
210
377
|
continue t;
|
|
211
378
|
}
|
|
212
379
|
}
|
|
@@ -230,12 +397,12 @@ const vt = 1024 * 64, C = (s) => {
|
|
|
230
397
|
return ["$.", !1, s.length - e, !0];
|
|
231
398
|
if (i.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !l) {
|
|
232
399
|
const d = n[0].length === 2 ? n[0].slice(-1) : n[0];
|
|
233
|
-
return [
|
|
400
|
+
return [Ct(d), !1, c - e, !1];
|
|
234
401
|
}
|
|
235
|
-
const f = "[" + (l ? "^" : "") +
|
|
402
|
+
const f = "[" + (l ? "^" : "") + j(n) + "]", u = "[" + (l ? "" : "^") + j(i) + "]";
|
|
236
403
|
return [n.length && i.length ? "(" + f + "|" + u + ")" : n.length ? f : u, a, c - e, !0];
|
|
237
|
-
}, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"),
|
|
238
|
-
class
|
|
404
|
+
}, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"), Dt = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), U = (s) => Dt.has(s), Lt = "(?!(?:^|/)\\.\\.?(?:$|/))", R = "(?!\\.)", kt = /* @__PURE__ */ new Set(["[", "."]), Ft = /* @__PURE__ */ new Set(["..", "."]), Wt = new Set("().*{}+?[]^$\\!"), jt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), k = "[^/]", z = k + "*?", _ = k + "+?";
|
|
405
|
+
class E {
|
|
239
406
|
type;
|
|
240
407
|
#s;
|
|
241
408
|
#n;
|
|
@@ -291,7 +458,7 @@ class y {
|
|
|
291
458
|
push(...t) {
|
|
292
459
|
for (const e of t)
|
|
293
460
|
if (e !== "") {
|
|
294
|
-
if (typeof e != "string" && !(e instanceof
|
|
461
|
+
if (typeof e != "string" && !(e instanceof E && e.#e === this))
|
|
295
462
|
throw new Error("invalid part: " + e);
|
|
296
463
|
this.#t.push(e);
|
|
297
464
|
}
|
|
@@ -310,7 +477,7 @@ class y {
|
|
|
310
477
|
const t = this.#e;
|
|
311
478
|
for (let e = 0; e < this.#o; e++) {
|
|
312
479
|
const n = t.#t[e];
|
|
313
|
-
if (!(n instanceof
|
|
480
|
+
if (!(n instanceof E && n.type === "!"))
|
|
314
481
|
return !1;
|
|
315
482
|
}
|
|
316
483
|
return !0;
|
|
@@ -329,7 +496,7 @@ class y {
|
|
|
329
496
|
typeof t == "string" ? this.push(t) : this.push(t.clone(this));
|
|
330
497
|
}
|
|
331
498
|
clone(t) {
|
|
332
|
-
const e = new
|
|
499
|
+
const e = new E(this.type, t);
|
|
333
500
|
for (const n of this.#t)
|
|
334
501
|
e.copyIn(n);
|
|
335
502
|
return e;
|
|
@@ -337,31 +504,31 @@ class y {
|
|
|
337
504
|
static #l(t, e, n, i) {
|
|
338
505
|
let r = !1, o = !1, a = -1, h = !1;
|
|
339
506
|
if (e.type === null) {
|
|
340
|
-
let u = n,
|
|
507
|
+
let u = n, m = "";
|
|
341
508
|
for (; u < t.length; ) {
|
|
342
509
|
const d = t.charAt(u++);
|
|
343
510
|
if (r || d === "\\") {
|
|
344
|
-
r = !r,
|
|
511
|
+
r = !r, m += d;
|
|
345
512
|
continue;
|
|
346
513
|
}
|
|
347
514
|
if (o) {
|
|
348
|
-
u === a + 1 ? (d === "^" || d === "!") && (h = !0) : d === "]" && !(u === a + 2 && h) && (o = !1),
|
|
515
|
+
u === a + 1 ? (d === "^" || d === "!") && (h = !0) : d === "]" && !(u === a + 2 && h) && (o = !1), m += d;
|
|
349
516
|
continue;
|
|
350
517
|
} else if (d === "[") {
|
|
351
|
-
o = !0, a = u, h = !1,
|
|
518
|
+
o = !0, a = u, h = !1, m += d;
|
|
352
519
|
continue;
|
|
353
520
|
}
|
|
354
|
-
if (!i.noext &&
|
|
355
|
-
e.push(
|
|
356
|
-
const
|
|
357
|
-
u =
|
|
521
|
+
if (!i.noext && U(d) && t.charAt(u) === "(") {
|
|
522
|
+
e.push(m), m = "";
|
|
523
|
+
const S = new E(d, e);
|
|
524
|
+
u = E.#l(t, S, u, i), e.push(S);
|
|
358
525
|
continue;
|
|
359
526
|
}
|
|
360
|
-
|
|
527
|
+
m += d;
|
|
361
528
|
}
|
|
362
|
-
return e.push(
|
|
529
|
+
return e.push(m), u;
|
|
363
530
|
}
|
|
364
|
-
let l = n + 1, c = new
|
|
531
|
+
let l = n + 1, c = new E(null, e);
|
|
365
532
|
const p = [];
|
|
366
533
|
let f = "";
|
|
367
534
|
for (; l < t.length; ) {
|
|
@@ -377,14 +544,14 @@ class y {
|
|
|
377
544
|
o = !0, a = l, h = !1, f += u;
|
|
378
545
|
continue;
|
|
379
546
|
}
|
|
380
|
-
if (
|
|
547
|
+
if (U(u) && t.charAt(l) === "(") {
|
|
381
548
|
c.push(f), f = "";
|
|
382
|
-
const
|
|
383
|
-
c.push(
|
|
549
|
+
const m = new E(u, c);
|
|
550
|
+
c.push(m), l = E.#l(t, m, l, i);
|
|
384
551
|
continue;
|
|
385
552
|
}
|
|
386
553
|
if (u === "|") {
|
|
387
|
-
c.push(f), f = "", p.push(c), c = new
|
|
554
|
+
c.push(f), f = "", p.push(c), c = new E(null, e);
|
|
388
555
|
continue;
|
|
389
556
|
}
|
|
390
557
|
if (u === ")")
|
|
@@ -394,8 +561,8 @@ class y {
|
|
|
394
561
|
return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)], l;
|
|
395
562
|
}
|
|
396
563
|
static fromGlob(t, e = {}) {
|
|
397
|
-
const n = new
|
|
398
|
-
return
|
|
564
|
+
const n = new E(null, void 0, e);
|
|
565
|
+
return E.#l(t, n, 0, e), n;
|
|
399
566
|
}
|
|
400
567
|
// returns the regular expression if there's magic, or the unescaped
|
|
401
568
|
// string if not.
|
|
@@ -487,18 +654,18 @@ class y {
|
|
|
487
654
|
const e = t ?? !!this.#i.dot;
|
|
488
655
|
if (this.#s === this && this.#p(), !this.type) {
|
|
489
656
|
const h = this.isStart() && this.isEnd(), l = this.#t.map((u) => {
|
|
490
|
-
const [
|
|
491
|
-
return this.#n = this.#n ||
|
|
657
|
+
const [m, d, S, b] = typeof u == "string" ? E.#d(u, this.#n, h) : u.toRegExpSource(t);
|
|
658
|
+
return this.#n = this.#n || S, this.#r = this.#r || b, m;
|
|
492
659
|
}).join("");
|
|
493
660
|
let c = "";
|
|
494
|
-
if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 &&
|
|
495
|
-
const
|
|
661
|
+
if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Ft.has(this.#t[0]))) {
|
|
662
|
+
const m = kt, d = (
|
|
496
663
|
// dots are allowed, and the pattern starts with [ or .
|
|
497
|
-
e &&
|
|
498
|
-
l.startsWith("\\.") &&
|
|
499
|
-
l.startsWith("\\.\\.") &&
|
|
500
|
-
),
|
|
501
|
-
c = d ?
|
|
664
|
+
e && m.has(l.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
665
|
+
l.startsWith("\\.") && m.has(l.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
666
|
+
l.startsWith("\\.\\.") && m.has(l.charAt(4))
|
|
667
|
+
), S = !e && !t && m.has(l.charAt(0));
|
|
668
|
+
c = d ? Lt : S ? R : "";
|
|
502
669
|
}
|
|
503
670
|
let p = "";
|
|
504
671
|
return this.isEnd() && this.#s.#c && this.#e?.type === "!" && (p = "(?:$|\\/)"), [
|
|
@@ -518,11 +685,11 @@ class y {
|
|
|
518
685
|
o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
|
|
519
686
|
let a = "";
|
|
520
687
|
if (this.type === "!" && this.#u)
|
|
521
|
-
a = (this.isStart() && !e ? R : "") +
|
|
688
|
+
a = (this.isStart() && !e ? R : "") + _;
|
|
522
689
|
else {
|
|
523
690
|
const h = this.type === "!" ? (
|
|
524
691
|
// !() must match something,but !(x) can match ''
|
|
525
|
-
"))" + (this.isStart() && !e && !t ? R : "") +
|
|
692
|
+
"))" + (this.isStart() && !e && !t ? R : "") + z + ")"
|
|
526
693
|
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
527
694
|
a = i + r + h;
|
|
528
695
|
}
|
|
@@ -546,7 +713,7 @@ class y {
|
|
|
546
713
|
for (let a = 0; a < t.length; a++) {
|
|
547
714
|
const h = t.charAt(a);
|
|
548
715
|
if (i) {
|
|
549
|
-
i = !1, r += (
|
|
716
|
+
i = !1, r += (Wt.has(h) ? "\\" : "") + h;
|
|
550
717
|
continue;
|
|
551
718
|
}
|
|
552
719
|
if (h === "\\") {
|
|
@@ -554,98 +721,98 @@ class y {
|
|
|
554
721
|
continue;
|
|
555
722
|
}
|
|
556
723
|
if (h === "[") {
|
|
557
|
-
const [l, c, p, f] =
|
|
724
|
+
const [l, c, p, f] = It(t, a);
|
|
558
725
|
if (p) {
|
|
559
726
|
r += l, o = o || c, a += p - 1, e = e || f;
|
|
560
727
|
continue;
|
|
561
728
|
}
|
|
562
729
|
}
|
|
563
730
|
if (h === "*") {
|
|
564
|
-
n && t === "*" ? r +=
|
|
731
|
+
n && t === "*" ? r += _ : r += z, e = !0;
|
|
565
732
|
continue;
|
|
566
733
|
}
|
|
567
734
|
if (h === "?") {
|
|
568
|
-
r +=
|
|
735
|
+
r += k, e = !0;
|
|
569
736
|
continue;
|
|
570
737
|
}
|
|
571
|
-
r +=
|
|
738
|
+
r += jt(h);
|
|
572
739
|
}
|
|
573
740
|
return [r, M(t), !!e, o];
|
|
574
741
|
}
|
|
575
742
|
}
|
|
576
|
-
const
|
|
577
|
-
const e =
|
|
743
|
+
const Ut = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), y = (s, t, e = {}) => (C(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new I(t, e).match(s)), zt = /^\*+([^+@!?\*\[\(]*)$/, _t = (s) => (t) => !t.startsWith(".") && t.endsWith(s), Bt = (s) => (t) => t.endsWith(s), qt = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Gt = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Ht = /^\*+\.\*+$/, Vt = (s) => !s.startsWith(".") && s.includes("."), Zt = (s) => s !== "." && s !== ".." && s.includes("."), Yt = /^\.\*+$/, Jt = (s) => s !== "." && s !== ".." && s.startsWith("."), Xt = /^\*+$/, Qt = (s) => s.length !== 0 && !s.startsWith("."), Kt = (s) => s.length !== 0 && s !== "." && s !== "..", te = /^\?+([^+@!?\*\[\(]*)?$/, ee = ([s, t = ""]) => {
|
|
744
|
+
const e = X([s]);
|
|
578
745
|
return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
|
|
579
|
-
},
|
|
746
|
+
}, se = ([s, t = ""]) => {
|
|
580
747
|
const e = Q([s]);
|
|
581
748
|
return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
|
|
582
|
-
},
|
|
749
|
+
}, ne = ([s, t = ""]) => {
|
|
583
750
|
const e = Q([s]);
|
|
584
751
|
return t ? (n) => e(n) && n.endsWith(t) : e;
|
|
585
|
-
},
|
|
586
|
-
const e =
|
|
752
|
+
}, ie = ([s, t = ""]) => {
|
|
753
|
+
const e = X([s]);
|
|
587
754
|
return t ? (n) => e(n) && n.endsWith(t) : e;
|
|
588
|
-
},
|
|
755
|
+
}, X = ([s]) => {
|
|
589
756
|
const t = s.length;
|
|
590
757
|
return (e) => e.length === t && !e.startsWith(".");
|
|
591
758
|
}, Q = ([s]) => {
|
|
592
759
|
const t = s.length;
|
|
593
760
|
return (e) => e.length === t && e !== "." && e !== "..";
|
|
594
|
-
},
|
|
761
|
+
}, K = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", B = {
|
|
595
762
|
win32: { sep: "\\" },
|
|
596
763
|
posix: { sep: "/" }
|
|
597
|
-
},
|
|
598
|
-
|
|
764
|
+
}, re = K === "win32" ? B.win32.sep : B.posix.sep;
|
|
765
|
+
y.sep = re;
|
|
599
766
|
const O = Symbol("globstar **");
|
|
600
|
-
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
const
|
|
767
|
+
y.GLOBSTAR = O;
|
|
768
|
+
const oe = "[^/]", ce = oe + "*?", ae = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", he = "(?:(?!(?:\\/|^)\\.).)*?", le = (s, t = {}) => (e) => y(e, s, t);
|
|
769
|
+
y.filter = le;
|
|
770
|
+
const N = (s, t = {}) => Object.assign({}, s, t), ue = (s) => {
|
|
604
771
|
if (!s || typeof s != "object" || !Object.keys(s).length)
|
|
605
|
-
return
|
|
606
|
-
const t =
|
|
607
|
-
return Object.assign((n, i, r = {}) => t(n, i,
|
|
772
|
+
return y;
|
|
773
|
+
const t = y;
|
|
774
|
+
return Object.assign((n, i, r = {}) => t(n, i, N(s, r)), {
|
|
608
775
|
Minimatch: class extends t.Minimatch {
|
|
609
776
|
constructor(i, r = {}) {
|
|
610
|
-
super(i,
|
|
777
|
+
super(i, N(s, r));
|
|
611
778
|
}
|
|
612
779
|
static defaults(i) {
|
|
613
|
-
return t.defaults(
|
|
780
|
+
return t.defaults(N(s, i)).Minimatch;
|
|
614
781
|
}
|
|
615
782
|
},
|
|
616
783
|
AST: class extends t.AST {
|
|
617
784
|
/* c8 ignore start */
|
|
618
785
|
constructor(i, r, o = {}) {
|
|
619
|
-
super(i, r,
|
|
786
|
+
super(i, r, N(s, o));
|
|
620
787
|
}
|
|
621
788
|
/* c8 ignore stop */
|
|
622
789
|
static fromGlob(i, r = {}) {
|
|
623
|
-
return t.AST.fromGlob(i,
|
|
790
|
+
return t.AST.fromGlob(i, N(s, r));
|
|
624
791
|
}
|
|
625
792
|
},
|
|
626
|
-
unescape: (n, i = {}) => t.unescape(n,
|
|
627
|
-
escape: (n, i = {}) => t.escape(n,
|
|
628
|
-
filter: (n, i = {}) => t.filter(n,
|
|
629
|
-
defaults: (n) => t.defaults(
|
|
630
|
-
makeRe: (n, i = {}) => t.makeRe(n,
|
|
631
|
-
braceExpand: (n, i = {}) => t.braceExpand(n,
|
|
632
|
-
match: (n, i, r = {}) => t.match(n, i,
|
|
793
|
+
unescape: (n, i = {}) => t.unescape(n, N(s, i)),
|
|
794
|
+
escape: (n, i = {}) => t.escape(n, N(s, i)),
|
|
795
|
+
filter: (n, i = {}) => t.filter(n, N(s, i)),
|
|
796
|
+
defaults: (n) => t.defaults(N(s, n)),
|
|
797
|
+
makeRe: (n, i = {}) => t.makeRe(n, N(s, i)),
|
|
798
|
+
braceExpand: (n, i = {}) => t.braceExpand(n, N(s, i)),
|
|
799
|
+
match: (n, i, r = {}) => t.match(n, i, N(s, r)),
|
|
633
800
|
sep: t.sep,
|
|
634
801
|
GLOBSTAR: O
|
|
635
802
|
});
|
|
636
803
|
};
|
|
637
|
-
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
const
|
|
643
|
-
const n = new
|
|
804
|
+
y.defaults = ue;
|
|
805
|
+
const tt = (s, t = {}) => (C(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : At(s));
|
|
806
|
+
y.braceExpand = tt;
|
|
807
|
+
const fe = (s, t = {}) => new I(s, t).makeRe();
|
|
808
|
+
y.makeRe = fe;
|
|
809
|
+
const pe = (s, t, e = {}) => {
|
|
810
|
+
const n = new I(t, e);
|
|
644
811
|
return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
|
|
645
812
|
};
|
|
646
|
-
|
|
647
|
-
const
|
|
648
|
-
class
|
|
813
|
+
y.match = pe;
|
|
814
|
+
const q = /[?*]|[+@!]\(.*?\)|\[|\]/, de = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
815
|
+
class I {
|
|
649
816
|
options;
|
|
650
817
|
set;
|
|
651
818
|
pattern;
|
|
@@ -664,7 +831,7 @@ class D {
|
|
|
664
831
|
windowsNoMagicRoot;
|
|
665
832
|
regexp;
|
|
666
833
|
constructor(t, e = {}) {
|
|
667
|
-
C(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform ||
|
|
834
|
+
C(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || K, 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();
|
|
668
835
|
}
|
|
669
836
|
hasMagic() {
|
|
670
837
|
if (this.options.magicalBraces && this.set.length > 1)
|
|
@@ -692,7 +859,7 @@ class D {
|
|
|
692
859
|
this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
|
|
693
860
|
let i = this.globParts.map((r, o, a) => {
|
|
694
861
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
695
|
-
const h = r[0] === "" && r[1] === "" && (r[2] === "?" || !
|
|
862
|
+
const h = r[0] === "" && r[1] === "" && (r[2] === "?" || !q.test(r[2])) && !q.test(r[3]), l = /^[a-z]:/i.test(r[0]);
|
|
696
863
|
if (h)
|
|
697
864
|
return [...r.slice(0, 4), ...r.slice(4).map((c) => this.parse(c))];
|
|
698
865
|
if (l)
|
|
@@ -872,10 +1039,10 @@ class D {
|
|
|
872
1039
|
matchOne(t, e, n = !1) {
|
|
873
1040
|
const i = this.options;
|
|
874
1041
|
if (this.isWindows) {
|
|
875
|
-
const d = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]),
|
|
876
|
-
if (typeof
|
|
877
|
-
const [
|
|
878
|
-
|
|
1042
|
+
const d = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !d && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), b = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), A = !b && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : d ? 0 : void 0, w = A ? 3 : b ? 0 : void 0;
|
|
1043
|
+
if (typeof x == "number" && typeof w == "number") {
|
|
1044
|
+
const [v, P] = [t[x], e[w]];
|
|
1045
|
+
v.toLowerCase() === P.toLowerCase() && (e[w] = v, w > x ? e = e.slice(w) : x > w && (t = t.slice(x)));
|
|
879
1046
|
}
|
|
880
1047
|
}
|
|
881
1048
|
const { optimizationLevel: r = 1 } = this.options;
|
|
@@ -895,11 +1062,11 @@ class D {
|
|
|
895
1062
|
return !0;
|
|
896
1063
|
}
|
|
897
1064
|
for (; f < h; ) {
|
|
898
|
-
var
|
|
1065
|
+
var m = t[f];
|
|
899
1066
|
if (this.debug(`
|
|
900
|
-
globstar while`, t, f, e, u,
|
|
901
|
-
return this.debug("globstar found match!", f, h,
|
|
902
|
-
if (
|
|
1067
|
+
globstar while`, t, f, e, u, m), this.matchOne(t.slice(f), e.slice(u), n))
|
|
1068
|
+
return this.debug("globstar found match!", f, h, m), !0;
|
|
1069
|
+
if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") {
|
|
903
1070
|
this.debug("dot detected!", t, f, e, u);
|
|
904
1071
|
break;
|
|
905
1072
|
}
|
|
@@ -921,7 +1088,7 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
921
1088
|
throw new Error("wtf?");
|
|
922
1089
|
}
|
|
923
1090
|
braceExpand() {
|
|
924
|
-
return
|
|
1091
|
+
return tt(this.pattern, this.options);
|
|
925
1092
|
}
|
|
926
1093
|
parse(t) {
|
|
927
1094
|
C(t);
|
|
@@ -931,8 +1098,8 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
931
1098
|
if (t === "")
|
|
932
1099
|
return "";
|
|
933
1100
|
let n, i = null;
|
|
934
|
-
(n = t.match(
|
|
935
|
-
const r =
|
|
1101
|
+
(n = t.match(Xt)) ? i = e.dot ? Kt : Qt : (n = t.match(zt)) ? i = (e.nocase ? e.dot ? Gt : qt : e.dot ? Bt : _t)(n[1]) : (n = t.match(te)) ? i = (e.nocase ? e.dot ? se : ee : e.dot ? ne : ie)(n) : (n = t.match(Ht)) ? i = e.dot ? Zt : Vt : (n = t.match(Yt)) && (i = Jt);
|
|
1102
|
+
const r = E.fromGlob(t, this.options).toMMPattern();
|
|
936
1103
|
return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
|
|
937
1104
|
}
|
|
938
1105
|
makeRe() {
|
|
@@ -941,13 +1108,13 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
941
1108
|
const t = this.set;
|
|
942
1109
|
if (!t.length)
|
|
943
1110
|
return this.regexp = !1, this.regexp;
|
|
944
|
-
const e = this.options, n = e.noglobstar ?
|
|
1111
|
+
const e = this.options, n = e.noglobstar ? ce : e.dot ? ae : he, i = new Set(e.nocase ? ["i"] : []);
|
|
945
1112
|
let r = t.map((h) => {
|
|
946
1113
|
const l = h.map((c) => {
|
|
947
1114
|
if (c instanceof RegExp)
|
|
948
1115
|
for (const p of c.flags.split(""))
|
|
949
1116
|
i.add(p);
|
|
950
|
-
return typeof c == "string" ?
|
|
1117
|
+
return typeof c == "string" ? de(c) : c === O ? O : c._src;
|
|
951
1118
|
});
|
|
952
1119
|
return l.forEach((c, p) => {
|
|
953
1120
|
const f = l[p + 1], u = l[p - 1];
|
|
@@ -992,189 +1159,54 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
992
1159
|
return n.flipNegate ? !1 : this.negate;
|
|
993
1160
|
}
|
|
994
1161
|
static defaults(t) {
|
|
995
|
-
return
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
w.AST = y;
|
|
999
|
-
w.Minimatch = D;
|
|
1000
|
-
w.escape = Lt;
|
|
1001
|
-
w.unescape = M;
|
|
1002
|
-
function he(s, t = "utf-8") {
|
|
1003
|
-
switch (t) {
|
|
1004
|
-
case "utf8":
|
|
1005
|
-
case "utf-8":
|
|
1006
|
-
return new TextEncoder().encode(s);
|
|
1007
|
-
case "utf16le":
|
|
1008
|
-
case "ucs2":
|
|
1009
|
-
case "ucs-2":
|
|
1010
|
-
return le(s);
|
|
1011
|
-
case "ascii":
|
|
1012
|
-
return pe(s);
|
|
1013
|
-
case "latin1":
|
|
1014
|
-
return fe(s);
|
|
1015
|
-
case "binary":
|
|
1016
|
-
return Uint8Array.from(s, (e) => e.charCodeAt(0));
|
|
1017
|
-
case "base64":
|
|
1018
|
-
return Uint8Array.from(atob(s), (e) => e.charCodeAt(0));
|
|
1019
|
-
case "hex":
|
|
1020
|
-
if (!/^[\da-f]+$/i.test(s) || s.length % 2 !== 0)
|
|
1021
|
-
throw new x("Invalid hex string", "INVALID_HEX_FORMAT");
|
|
1022
|
-
return Uint8Array.from(s.match(/.{1,2}/g).map((e) => parseInt(e, 16)));
|
|
1023
|
-
default:
|
|
1024
|
-
return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
function Ae(s, t = "utf-8") {
|
|
1028
|
-
switch (t) {
|
|
1029
|
-
case "utf8":
|
|
1030
|
-
case "utf-8":
|
|
1031
|
-
return new TextDecoder().decode(s);
|
|
1032
|
-
case "utf16le":
|
|
1033
|
-
case "utf-16le":
|
|
1034
|
-
case "ucs2":
|
|
1035
|
-
case "ucs-2":
|
|
1036
|
-
return ue(s);
|
|
1037
|
-
case "latin1":
|
|
1038
|
-
return String.fromCharCode(...s);
|
|
1039
|
-
case "ascii":
|
|
1040
|
-
return String.fromCharCode(...s.map((e) => e & 127));
|
|
1041
|
-
case "base64":
|
|
1042
|
-
return btoa(String.fromCharCode(...s));
|
|
1043
|
-
case "hex":
|
|
1044
|
-
return Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
1045
|
-
default:
|
|
1046
|
-
return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
|
|
1162
|
+
return y.defaults(t).Minimatch;
|
|
1047
1163
|
}
|
|
1048
1164
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
}
|
|
1055
|
-
return t;
|
|
1056
|
-
}
|
|
1057
|
-
function ue(s) {
|
|
1058
|
-
s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
|
|
1059
|
-
const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
|
|
1060
|
-
return String.fromCharCode(...t);
|
|
1061
|
-
}
|
|
1062
|
-
function fe(s) {
|
|
1063
|
-
const t = new Uint8Array(s.length);
|
|
1064
|
-
for (let e = 0; e < s.length; e++)
|
|
1065
|
-
t[e] = s.charCodeAt(e) & 255;
|
|
1066
|
-
return t;
|
|
1067
|
-
}
|
|
1068
|
-
function pe(s) {
|
|
1069
|
-
const t = new Uint8Array(s.length);
|
|
1070
|
-
for (let e = 0; e < s.length; e++)
|
|
1071
|
-
t[e] = s.charCodeAt(e) & 127;
|
|
1072
|
-
return t;
|
|
1073
|
-
}
|
|
1074
|
-
const de = [
|
|
1075
|
-
// Images
|
|
1076
|
-
".jpg",
|
|
1077
|
-
".jpeg",
|
|
1078
|
-
".png",
|
|
1079
|
-
".gif",
|
|
1080
|
-
".bmp",
|
|
1081
|
-
".webp",
|
|
1082
|
-
".svg",
|
|
1083
|
-
".ico",
|
|
1084
|
-
".tiff",
|
|
1085
|
-
".tga",
|
|
1086
|
-
// Audio
|
|
1087
|
-
".mp3",
|
|
1088
|
-
".wav",
|
|
1089
|
-
".ogg",
|
|
1090
|
-
".flac",
|
|
1091
|
-
".aac",
|
|
1092
|
-
".wma",
|
|
1093
|
-
".m4a",
|
|
1094
|
-
// Video
|
|
1095
|
-
".mp4",
|
|
1096
|
-
".avi",
|
|
1097
|
-
".mov",
|
|
1098
|
-
".wmv",
|
|
1099
|
-
".flv",
|
|
1100
|
-
".webm",
|
|
1101
|
-
".mkv",
|
|
1102
|
-
".m4v",
|
|
1103
|
-
// Documents
|
|
1104
|
-
".pdf",
|
|
1105
|
-
".doc",
|
|
1106
|
-
".docx",
|
|
1107
|
-
".xls",
|
|
1108
|
-
".xlsx",
|
|
1109
|
-
".ppt",
|
|
1110
|
-
".pptx",
|
|
1111
|
-
// Archives
|
|
1112
|
-
".zip",
|
|
1113
|
-
".rar",
|
|
1114
|
-
".7z",
|
|
1115
|
-
".tar",
|
|
1116
|
-
".gz",
|
|
1117
|
-
".bz2",
|
|
1118
|
-
// Executables
|
|
1119
|
-
".exe",
|
|
1120
|
-
".dll",
|
|
1121
|
-
".so",
|
|
1122
|
-
".dylib",
|
|
1123
|
-
".bin",
|
|
1124
|
-
// Other binary formats
|
|
1125
|
-
".dat",
|
|
1126
|
-
".db",
|
|
1127
|
-
".sqlite",
|
|
1128
|
-
".bin",
|
|
1129
|
-
".obj",
|
|
1130
|
-
".fbx",
|
|
1131
|
-
".3ds"
|
|
1132
|
-
];
|
|
1133
|
-
function Ne(s) {
|
|
1134
|
-
const t = s.toLowerCase().substring(s.lastIndexOf("."));
|
|
1135
|
-
return de.includes(t);
|
|
1136
|
-
}
|
|
1137
|
-
function $e() {
|
|
1165
|
+
y.AST = E;
|
|
1166
|
+
y.Minimatch = I;
|
|
1167
|
+
y.escape = Ut;
|
|
1168
|
+
y.unescape = M;
|
|
1169
|
+
function Te() {
|
|
1138
1170
|
if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
|
|
1139
|
-
throw new
|
|
1171
|
+
throw new it();
|
|
1140
1172
|
}
|
|
1141
|
-
async function
|
|
1142
|
-
return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/")
|
|
1173
|
+
async function ge(s, t, e) {
|
|
1174
|
+
return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/")}`, { mode: t }, e) : e();
|
|
1143
1175
|
}
|
|
1144
|
-
function
|
|
1176
|
+
function F(s) {
|
|
1145
1177
|
return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
|
|
1146
1178
|
}
|
|
1147
|
-
function
|
|
1179
|
+
function et(s) {
|
|
1148
1180
|
return typeof s == "string" ? s ?? "/" : `/${s.join("/")}`;
|
|
1149
1181
|
}
|
|
1150
|
-
function
|
|
1151
|
-
const t =
|
|
1182
|
+
function st(s) {
|
|
1183
|
+
const t = F(s);
|
|
1152
1184
|
return t[t.length - 1] || "";
|
|
1153
1185
|
}
|
|
1154
|
-
function
|
|
1155
|
-
const t =
|
|
1156
|
-
return t.pop(),
|
|
1186
|
+
function Me(s) {
|
|
1187
|
+
const t = F(s);
|
|
1188
|
+
return t.pop(), et(t);
|
|
1157
1189
|
}
|
|
1158
|
-
function
|
|
1190
|
+
function nt(s) {
|
|
1159
1191
|
return !s || s === "/" ? "/" : s.startsWith("~/") ? `/${s.slice(2)}` : s.startsWith("/") ? s : `/${s}`;
|
|
1160
1192
|
}
|
|
1161
|
-
function
|
|
1193
|
+
function Pe(s, t = !1) {
|
|
1162
1194
|
return s = s.replace(/\/$/, ""), t && !s.includes("*") ? `${s}/**` : s;
|
|
1163
1195
|
}
|
|
1164
|
-
function
|
|
1165
|
-
return
|
|
1196
|
+
function Re(s, t) {
|
|
1197
|
+
return y(s, t, {
|
|
1166
1198
|
dot: !0,
|
|
1167
1199
|
matchBase: !0
|
|
1168
1200
|
});
|
|
1169
1201
|
}
|
|
1170
|
-
function
|
|
1202
|
+
function Ce(s, t) {
|
|
1171
1203
|
if (!t || Array.isArray(t) && t.length === 0)
|
|
1172
1204
|
return !1;
|
|
1173
|
-
const e =
|
|
1174
|
-
return (Array.isArray(t) ? t : [t]).some((i) =>
|
|
1205
|
+
const e = nt(s);
|
|
1206
|
+
return (Array.isArray(t) ? t : [t]).some((i) => y(e, i, { dot: !0 }));
|
|
1175
1207
|
}
|
|
1176
|
-
function
|
|
1177
|
-
const t =
|
|
1208
|
+
function Ie(s) {
|
|
1209
|
+
const t = nt(s), e = F(t), n = [];
|
|
1178
1210
|
for (const i of e)
|
|
1179
1211
|
if (!(i === "." || i === ""))
|
|
1180
1212
|
if (i === "..") {
|
|
@@ -1183,49 +1215,22 @@ function Ce(s) {
|
|
|
1183
1215
|
n.pop();
|
|
1184
1216
|
} else
|
|
1185
1217
|
n.push(i);
|
|
1186
|
-
return
|
|
1218
|
+
return et(n);
|
|
1187
1219
|
}
|
|
1188
1220
|
function De(s) {
|
|
1189
|
-
const t =
|
|
1221
|
+
const t = st(s), e = t.lastIndexOf(".");
|
|
1190
1222
|
return e <= 0 || e === t.length - 1 ? "" : t.slice(e);
|
|
1191
1223
|
}
|
|
1192
|
-
function
|
|
1193
|
-
return typeof s == "string" ?
|
|
1194
|
-
}
|
|
1195
|
-
async function Le(s, t) {
|
|
1196
|
-
return I(t, "shared", async () => {
|
|
1197
|
-
const n = await (await s.getFile()).arrayBuffer();
|
|
1198
|
-
return new Uint8Array(n);
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
async function Fe(s, t, e, n, i = {}) {
|
|
1202
|
-
const r = async () => {
|
|
1203
|
-
let o = null;
|
|
1204
|
-
const a = i.append || !1, h = !a && (i.truncate ?? !0);
|
|
1205
|
-
try {
|
|
1206
|
-
o = await s.createSyncAccessHandle();
|
|
1207
|
-
const l = ge(t, e), c = a ? o.getSize() : 0;
|
|
1208
|
-
o.write(l, { at: c }), h && o.truncate(l.byteLength), o.flush();
|
|
1209
|
-
} catch (l) {
|
|
1210
|
-
console.error(l);
|
|
1211
|
-
const c = a ? "append" : "write";
|
|
1212
|
-
throw new x(`Failed to ${c} file`, `${c.toUpperCase()}_FAILED`, void 0, l);
|
|
1213
|
-
} finally {
|
|
1214
|
-
try {
|
|
1215
|
-
o?.close();
|
|
1216
|
-
} catch {
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
};
|
|
1220
|
-
return n ? I(n, "exclusive", r) : r();
|
|
1224
|
+
function Le(s, t = "utf-8") {
|
|
1225
|
+
return typeof s == "string" ? ct(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
|
|
1221
1226
|
}
|
|
1222
|
-
async function
|
|
1227
|
+
async function ke(s, t = "SHA-1", e = 50 * 1024 * 1024) {
|
|
1223
1228
|
if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
|
|
1224
1229
|
throw new Error(`File size ${s.byteLength} bytes exceeds maximum allowed size ${e} bytes`);
|
|
1225
1230
|
const n = new Uint8Array(s), i = await crypto.subtle.digest(t, n);
|
|
1226
1231
|
return Array.from(new Uint8Array(i)).map((o) => o.toString(16).padStart(2, "0")).join("");
|
|
1227
1232
|
}
|
|
1228
|
-
function
|
|
1233
|
+
function Fe(s, t) {
|
|
1229
1234
|
if (s.length !== t.length)
|
|
1230
1235
|
return !1;
|
|
1231
1236
|
for (let e = 0; e < s.length; e++)
|
|
@@ -1233,13 +1238,13 @@ function Ie(s, t) {
|
|
|
1233
1238
|
return !1;
|
|
1234
1239
|
return !0;
|
|
1235
1240
|
}
|
|
1236
|
-
async function
|
|
1241
|
+
async function We(s) {
|
|
1237
1242
|
const t = await s.arrayBuffer();
|
|
1238
1243
|
return new Uint8Array(t);
|
|
1239
1244
|
}
|
|
1240
|
-
async function
|
|
1241
|
-
const n =
|
|
1242
|
-
return
|
|
1245
|
+
async function je(s, t, e = {}) {
|
|
1246
|
+
const n = st(t);
|
|
1247
|
+
return ge(t, "exclusive", async () => {
|
|
1243
1248
|
const i = e.recursive ?? !1, r = e.force ?? !1;
|
|
1244
1249
|
e.useTrash;
|
|
1245
1250
|
try {
|
|
@@ -1247,43 +1252,77 @@ async function We(s, t, e = {}) {
|
|
|
1247
1252
|
} catch (o) {
|
|
1248
1253
|
if (o.name === "NotFoundError") {
|
|
1249
1254
|
if (!r)
|
|
1250
|
-
throw new
|
|
1251
|
-
} else throw o.name === "InvalidModificationError" ? new
|
|
1255
|
+
throw new g(`No such file or directory: ${t}`, "ENOENT", void 0, o);
|
|
1256
|
+
} else throw o.name === "InvalidModificationError" ? new g(`Directory not empty: ${t}. Use recursive option to force removal.`, "ENOTEMPTY", void 0, o) : o.name === "TypeMismatchError" && !i ? new g(`Cannot remove directory without recursive option: ${t}`, "EISDIR", void 0, o) : new g(`Failed to remove entry: ${t}`, "RM_FAILED", void 0, o);
|
|
1252
1257
|
}
|
|
1253
1258
|
});
|
|
1254
1259
|
}
|
|
1260
|
+
function Ue(s, t, e, n) {
|
|
1261
|
+
if (!Number.isInteger(t) || !Number.isInteger(e))
|
|
1262
|
+
throw new g("Invalid offset or length", "EINVAL");
|
|
1263
|
+
if (t < 0 || e < 0)
|
|
1264
|
+
throw new g("Negative offset or length not allowed", "EINVAL");
|
|
1265
|
+
if (t + e > s)
|
|
1266
|
+
throw new g("Operation would overflow buffer", "ERANGE");
|
|
1267
|
+
if (n != null && (!Number.isInteger(n) || n < 0))
|
|
1268
|
+
throw new g("Invalid position", "EINVAL");
|
|
1269
|
+
}
|
|
1270
|
+
function ze(s, t, e) {
|
|
1271
|
+
try {
|
|
1272
|
+
t.flush(), t.close();
|
|
1273
|
+
} catch (n) {
|
|
1274
|
+
console.warn(`Warning: Failed to properly close file descriptor ${s} (${e}):`, n);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
function _e(s, t, e) {
|
|
1278
|
+
if (s >= e)
|
|
1279
|
+
return { isEOF: !0, actualLength: 0 };
|
|
1280
|
+
const n = Math.min(t, e - s);
|
|
1281
|
+
return n <= 0 ? { isEOF: !0, actualLength: 0 } : { isEOF: !1, actualLength: n };
|
|
1282
|
+
}
|
|
1283
|
+
async function Be(s, t) {
|
|
1284
|
+
try {
|
|
1285
|
+
return await s.createSyncAccessHandle();
|
|
1286
|
+
} catch (e) {
|
|
1287
|
+
throw rt(e, { path: t, isDirectory: !1 });
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1255
1290
|
export {
|
|
1256
|
-
|
|
1291
|
+
ze as A,
|
|
1292
|
+
_e as B,
|
|
1293
|
+
Be as C,
|
|
1257
1294
|
Ee as D,
|
|
1295
|
+
ot as E,
|
|
1258
1296
|
ye as F,
|
|
1259
|
-
|
|
1297
|
+
g as O,
|
|
1260
1298
|
we as P,
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1299
|
+
xe as S,
|
|
1300
|
+
Ne as T,
|
|
1301
|
+
it as a,
|
|
1264
1302
|
me as b,
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1303
|
+
Se as c,
|
|
1304
|
+
Ae as d,
|
|
1305
|
+
ct as e,
|
|
1306
|
+
Oe as f,
|
|
1307
|
+
Te as g,
|
|
1308
|
+
st as h,
|
|
1309
|
+
be as i,
|
|
1310
|
+
et as j,
|
|
1311
|
+
Me as k,
|
|
1312
|
+
Pe as l,
|
|
1313
|
+
rt as m,
|
|
1314
|
+
nt as n,
|
|
1315
|
+
Re as o,
|
|
1316
|
+
Ce as p,
|
|
1317
|
+
De as q,
|
|
1318
|
+
Ie as r,
|
|
1319
|
+
F as s,
|
|
1320
|
+
Le as t,
|
|
1321
|
+
ke as u,
|
|
1322
|
+
Fe as v,
|
|
1323
|
+
ge as w,
|
|
1324
|
+
We as x,
|
|
1325
|
+
je as y,
|
|
1326
|
+
Ue as z
|
|
1288
1327
|
};
|
|
1289
|
-
//# sourceMappingURL=helpers-
|
|
1328
|
+
//# sourceMappingURL=helpers-CkNHswLp.js.map
|