opfs-worker 1.2.4 → 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-1Wh1cr7P.js.map +1 -0
- package/dist/assets/worker-BeJaVyBV.js.map +1 -0
- package/dist/helpers-BuGfPAg0.js +1439 -0
- package/dist/helpers-BuGfPAg0.js.map +1 -0
- package/dist/helpers-CF7A2WQG.cjs +4 -0
- package/dist/helpers-CF7A2WQG.cjs.map +1 -0
- package/dist/helpers-CIiblZ8d.cjs +4 -0
- package/dist/helpers-CIiblZ8d.cjs.map +1 -0
- package/dist/{helpers-BXhw_-Ar.js → helpers-CKOebsbw.js} +573 -480
- package/dist/helpers-CKOebsbw.js.map +1 -0
- package/dist/index.cjs +711 -600
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +768 -650
- package/dist/index.js.map +1 -1
- package/dist/raw.cjs +1 -1
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.js +88 -89
- package/dist/raw.js.map +1 -1
- package/dist/utils/errors.d.ts +65 -22
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/worker.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/assets/worker-BEh95XuP.js.map +0 -1
- package/dist/assets/worker-CS9nvwsF.js.map +0 -1
- package/dist/assets/worker-Dy3EFYv_.js.map +0 -1
- package/dist/helpers-04x7UBul.cjs +0 -4
- package/dist/helpers-04x7UBul.cjs.map +0 -1
- package/dist/helpers-BXhw_-Ar.js.map +0 -1
- package/dist/helpers-BwklIUit.js +0 -1329
- package/dist/helpers-BwklIUit.js.map +0 -1
- package/dist/helpers-ppMRzIAJ.cjs +0 -4
- package/dist/helpers-ppMRzIAJ.cjs.map +0 -1
|
@@ -1,79 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const lt = {
|
|
2
|
+
ENOENT: -2,
|
|
3
|
+
// No such file or directory
|
|
4
|
+
EISDIR: -21,
|
|
5
|
+
// Is a directory
|
|
6
|
+
ENOTDIR: -20,
|
|
7
|
+
// Not a directory
|
|
8
|
+
EACCES: -13,
|
|
9
|
+
// Permission denied
|
|
10
|
+
EEXIST: -17,
|
|
11
|
+
// File exists
|
|
12
|
+
ENOTEMPTY: -39,
|
|
13
|
+
// Directory not empty
|
|
14
|
+
EINVAL: -22,
|
|
15
|
+
// Invalid argument
|
|
16
|
+
EIO: -5,
|
|
17
|
+
// I/O error
|
|
18
|
+
ENOSPC: -28,
|
|
19
|
+
// No space left on device
|
|
20
|
+
EBUSY: -16,
|
|
21
|
+
// Device or resource busy
|
|
22
|
+
EINTR: -4,
|
|
23
|
+
// Interrupted system call
|
|
24
|
+
ENOTSUP: -95,
|
|
25
|
+
// Operation not supported
|
|
26
|
+
ERANGE: -34,
|
|
27
|
+
// Result too large
|
|
28
|
+
EBADF: -9,
|
|
29
|
+
// Bad file descriptor
|
|
30
|
+
EROOT: -1
|
|
31
|
+
// Custom: Cannot remove root directory
|
|
32
|
+
};
|
|
33
|
+
class y extends Error {
|
|
34
|
+
errno;
|
|
35
|
+
syscall;
|
|
36
|
+
path;
|
|
37
|
+
constructor(t, e, n, r, i) {
|
|
38
|
+
super(t, { cause: i }), this.name = e, this.errno = lt[e] || -1, this.path = n, this.syscall = r;
|
|
4
39
|
}
|
|
5
40
|
}
|
|
6
|
-
class
|
|
41
|
+
class ht extends y {
|
|
7
42
|
constructor(t) {
|
|
8
|
-
super("OPFS is not supported in this browser", "
|
|
43
|
+
super("OPFS is not supported in this browser", "ENOTSUP", void 0, void 0, t);
|
|
9
44
|
}
|
|
10
45
|
}
|
|
11
|
-
class
|
|
12
|
-
constructor(t) {
|
|
13
|
-
super(
|
|
46
|
+
class Te extends y {
|
|
47
|
+
constructor(t, e, n) {
|
|
48
|
+
super(t, "INVALID_PATH", e, "access", n);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class Z extends y {
|
|
52
|
+
constructor(t, e, n) {
|
|
53
|
+
const r = {
|
|
54
|
+
file: `File not found: ${e}`,
|
|
55
|
+
directory: `Directory not found: ${e}`,
|
|
56
|
+
source: `Source does not exist: ${e}`
|
|
57
|
+
};
|
|
58
|
+
super(r[t], "ENOENT", e, "access", n);
|
|
14
59
|
}
|
|
15
60
|
}
|
|
16
|
-
class
|
|
61
|
+
class ut extends y {
|
|
17
62
|
constructor(t, e, n) {
|
|
18
|
-
super(t
|
|
63
|
+
super(`Permission denied for ${e} on: ${t}`, "EACCES", t, e, n);
|
|
19
64
|
}
|
|
20
65
|
}
|
|
21
|
-
class
|
|
66
|
+
class ft extends y {
|
|
67
|
+
constructor(t, e, n) {
|
|
68
|
+
super(t, "ENOSPC", e, "write", n);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class pt extends y {
|
|
22
72
|
constructor(t, e) {
|
|
23
|
-
super(`File
|
|
73
|
+
super(`File is busy: ${t}`, "EBUSY", t, "open", e);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
class k extends y {
|
|
77
|
+
constructor(t, e, n) {
|
|
78
|
+
const r = t === "directory" ? `Is a directory: ${e}` : `Not a directory: ${e}`, i = t === "directory" ? "EISDIR" : "ENOTDIR";
|
|
79
|
+
super(r, i, e, "access", n);
|
|
24
80
|
}
|
|
25
81
|
}
|
|
26
|
-
class
|
|
82
|
+
class b extends y {
|
|
83
|
+
constructor(t, e, n, r) {
|
|
84
|
+
const i = {
|
|
85
|
+
argument: "EINVAL",
|
|
86
|
+
format: "INVALID_FORMAT",
|
|
87
|
+
descriptor: "EBADF",
|
|
88
|
+
overflow: "ERANGE"
|
|
89
|
+
};
|
|
90
|
+
super(e, i[t], n, "validate", r);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
class dt extends y {
|
|
27
94
|
constructor(t, e) {
|
|
28
|
-
super(`
|
|
95
|
+
super(`Operation aborted: ${t}`, "EINTR", t, "interrupt", e);
|
|
29
96
|
}
|
|
30
97
|
}
|
|
31
|
-
class
|
|
98
|
+
class U extends y {
|
|
32
99
|
constructor(t, e, n) {
|
|
33
|
-
super(
|
|
100
|
+
super(t, "EIO", e, "io", n);
|
|
34
101
|
}
|
|
35
102
|
}
|
|
36
|
-
class
|
|
103
|
+
class gt extends y {
|
|
104
|
+
constructor(t, e) {
|
|
105
|
+
super(`Operation not supported: ${t}`, "ENOTSUP", t, "operation", e);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
class z extends y {
|
|
37
109
|
constructor(t, e, n) {
|
|
38
|
-
|
|
110
|
+
const r = {
|
|
111
|
+
RM_FAILED: `Failed to remove entry: ${e}`,
|
|
112
|
+
ENOTEMPTY: `Directory not empty: ${e}. Use recursive option to force removal.`,
|
|
113
|
+
EROOT: "Cannot remove root directory"
|
|
114
|
+
};
|
|
115
|
+
super(r[t] || `Directory operation failed: ${e}`, t, e, "unlink", n);
|
|
39
116
|
}
|
|
40
117
|
}
|
|
41
|
-
class
|
|
118
|
+
class Me extends y {
|
|
119
|
+
constructor(t, e) {
|
|
120
|
+
super("Failed to initialize OPFS", "INIT_FAILED", t, "init", e);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
class Re extends y {
|
|
42
124
|
constructor(t, e, n) {
|
|
43
|
-
super(`
|
|
125
|
+
super(`Failed to ${t}: ${e}`, `${t.toUpperCase()}_FAILED`, e, t, n);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
class Ce extends y {
|
|
129
|
+
constructor(t, e) {
|
|
130
|
+
super(`Destination already exists: ${t}`, "EEXIST", t, "open", e);
|
|
44
131
|
}
|
|
45
132
|
}
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
return new
|
|
133
|
+
function Pe(s, t, e, n) {
|
|
134
|
+
const r = `${s.toUpperCase()}_FAILED`;
|
|
135
|
+
return new y(`Failed to ${s} file descriptor: ${t}`, r, e, s, n);
|
|
49
136
|
}
|
|
50
|
-
function
|
|
137
|
+
function mt(s, t) {
|
|
51
138
|
const e = t?.path, n = t?.isDirectory;
|
|
52
139
|
switch (s.name) {
|
|
53
140
|
case "InvalidStateError":
|
|
54
|
-
return new
|
|
141
|
+
return new pt(e || "unknown", s);
|
|
55
142
|
case "QuotaExceededError":
|
|
56
|
-
return new
|
|
143
|
+
return new ft(`No space left on device: ${e || "unknown"}`, e, s);
|
|
57
144
|
case "NotFoundError":
|
|
58
|
-
return new
|
|
145
|
+
return new Z("file", e, s);
|
|
59
146
|
case "TypeMismatchError":
|
|
60
|
-
return n !== void 0 ? n ? new
|
|
147
|
+
return n !== void 0 ? n ? new k("directory", e || "unknown", s) : new k("file", e || "unknown", s) : new b("argument", `Type mismatch: ${e || "unknown"}`, e, s);
|
|
61
148
|
case "NotAllowedError":
|
|
62
149
|
case "SecurityError":
|
|
63
|
-
return new
|
|
150
|
+
return new ut(e, "unknown", s);
|
|
64
151
|
case "InvalidModificationError":
|
|
65
|
-
return new
|
|
152
|
+
return new b("argument", `Invalid modification: ${e || "unknown"}`, e, s);
|
|
66
153
|
case "AbortError":
|
|
67
|
-
return new
|
|
154
|
+
return new dt(e || "unknown", s);
|
|
68
155
|
case "OperationError":
|
|
69
|
-
return new
|
|
156
|
+
return new U(`Operation failed: ${e || "unknown"}`, e, s);
|
|
70
157
|
case "TypeError":
|
|
71
|
-
return new
|
|
158
|
+
return new gt(e || "unknown", s);
|
|
72
159
|
default:
|
|
73
|
-
return new
|
|
160
|
+
return new U(`I/O error: ${e || "unknown"}`, e, s);
|
|
74
161
|
}
|
|
75
162
|
}
|
|
76
|
-
const
|
|
163
|
+
const wt = [
|
|
77
164
|
// Images
|
|
78
165
|
".jpg",
|
|
79
166
|
".jpeg",
|
|
@@ -130,14 +217,14 @@ const ot = [
|
|
|
130
217
|
".fbx",
|
|
131
218
|
".3ds"
|
|
132
219
|
];
|
|
133
|
-
function
|
|
220
|
+
function Ie(s) {
|
|
134
221
|
const t = s.lastIndexOf(".");
|
|
135
222
|
if (t <= 0)
|
|
136
223
|
return !0;
|
|
137
224
|
const e = s.slice(t).toLowerCase();
|
|
138
|
-
return
|
|
225
|
+
return wt.includes(e);
|
|
139
226
|
}
|
|
140
|
-
function
|
|
227
|
+
function yt(s, t = "utf-8") {
|
|
141
228
|
switch (t) {
|
|
142
229
|
case "utf8":
|
|
143
230
|
case "utf-8":
|
|
@@ -146,24 +233,24 @@ function ct(s, t = "utf-8") {
|
|
|
146
233
|
case "utf-16le":
|
|
147
234
|
case "ucs2":
|
|
148
235
|
case "ucs-2":
|
|
149
|
-
return
|
|
236
|
+
return Et(s);
|
|
150
237
|
case "ascii":
|
|
151
|
-
return
|
|
238
|
+
return Ot(s);
|
|
152
239
|
case "latin1":
|
|
153
|
-
return
|
|
240
|
+
return St(s);
|
|
154
241
|
case "binary":
|
|
155
242
|
return Uint8Array.from(s, (e) => e.charCodeAt(0));
|
|
156
243
|
case "base64":
|
|
157
244
|
return Uint8Array.from(atob(s), (e) => e.charCodeAt(0));
|
|
158
245
|
case "hex":
|
|
159
246
|
if (!/^[\da-f]+$/i.test(s) || s.length % 2 !== 0)
|
|
160
|
-
throw new
|
|
247
|
+
throw new b("format", "Invalid hex string");
|
|
161
248
|
return Uint8Array.from(s.match(/.{1,2}/g).map((e) => parseInt(e, 16)));
|
|
162
249
|
default:
|
|
163
250
|
return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
|
|
164
251
|
}
|
|
165
252
|
}
|
|
166
|
-
function
|
|
253
|
+
function De(s, t = "utf-8") {
|
|
167
254
|
switch (t) {
|
|
168
255
|
case "utf8":
|
|
169
256
|
case "utf-8":
|
|
@@ -172,7 +259,7 @@ function ve(s, t = "utf-8") {
|
|
|
172
259
|
case "utf-16le":
|
|
173
260
|
case "ucs2":
|
|
174
261
|
case "ucs-2":
|
|
175
|
-
return
|
|
262
|
+
return xt(s);
|
|
176
263
|
case "latin1":
|
|
177
264
|
return String.fromCharCode(...s);
|
|
178
265
|
case "ascii":
|
|
@@ -185,7 +272,7 @@ function ve(s, t = "utf-8") {
|
|
|
185
272
|
return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
|
|
186
273
|
}
|
|
187
274
|
}
|
|
188
|
-
function
|
|
275
|
+
function Et(s) {
|
|
189
276
|
const t = new Uint8Array(s.length * 2);
|
|
190
277
|
for (let e = 0; e < s.length; e++) {
|
|
191
278
|
const n = s.charCodeAt(e);
|
|
@@ -193,148 +280,148 @@ function at(s) {
|
|
|
193
280
|
}
|
|
194
281
|
return t;
|
|
195
282
|
}
|
|
196
|
-
function
|
|
283
|
+
function xt(s) {
|
|
197
284
|
s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
|
|
198
285
|
const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
|
|
199
286
|
return String.fromCharCode(...t);
|
|
200
287
|
}
|
|
201
|
-
function
|
|
288
|
+
function St(s) {
|
|
202
289
|
const t = new Uint8Array(s.length);
|
|
203
290
|
for (let e = 0; e < s.length; e++)
|
|
204
291
|
t[e] = s.charCodeAt(e) & 255;
|
|
205
292
|
return t;
|
|
206
293
|
}
|
|
207
|
-
function
|
|
294
|
+
function Ot(s) {
|
|
208
295
|
const t = new Uint8Array(s.length);
|
|
209
296
|
for (let e = 0; e < s.length; e++)
|
|
210
297
|
t[e] = s.charCodeAt(e) & 127;
|
|
211
298
|
return t;
|
|
212
299
|
}
|
|
213
|
-
var
|
|
214
|
-
const
|
|
215
|
-
const n = s instanceof RegExp ?
|
|
216
|
-
return
|
|
217
|
-
start:
|
|
218
|
-
end:
|
|
219
|
-
pre: e.slice(0,
|
|
220
|
-
body: e.slice(
|
|
221
|
-
post: e.slice(
|
|
300
|
+
var At = /* @__PURE__ */ ((s) => (s.Added = "added", s.Changed = "changed", s.Removed = "removed", s))(At || {});
|
|
301
|
+
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 && Nt(n, r, e);
|
|
303
|
+
return i && {
|
|
304
|
+
start: i[0],
|
|
305
|
+
end: i[1],
|
|
306
|
+
pre: e.slice(0, i[0]),
|
|
307
|
+
body: e.slice(i[0] + n.length, i[1]),
|
|
308
|
+
post: e.slice(i[1] + r.length)
|
|
222
309
|
};
|
|
223
|
-
},
|
|
310
|
+
}, B = (s, t) => {
|
|
224
311
|
const e = t.match(s);
|
|
225
312
|
return e ? e[0] : null;
|
|
226
|
-
},
|
|
227
|
-
let n,
|
|
228
|
-
if (
|
|
313
|
+
}, Nt = (s, t, e) => {
|
|
314
|
+
let n, r, i, o, a, l = e.indexOf(s), h = e.indexOf(t, l + 1), c = l;
|
|
315
|
+
if (l >= 0 && h > 0) {
|
|
229
316
|
if (s === t)
|
|
230
|
-
return [
|
|
231
|
-
for (n = [],
|
|
232
|
-
if (c ===
|
|
233
|
-
n.push(c),
|
|
317
|
+
return [l, h];
|
|
318
|
+
for (n = [], i = e.length; c >= 0 && !a; ) {
|
|
319
|
+
if (c === l)
|
|
320
|
+
n.push(c), l = e.indexOf(s, c + 1);
|
|
234
321
|
else if (n.length === 1) {
|
|
235
322
|
const p = n.pop();
|
|
236
|
-
p !== void 0 && (a = [p,
|
|
323
|
+
p !== void 0 && (a = [p, h]);
|
|
237
324
|
} else
|
|
238
|
-
|
|
239
|
-
c =
|
|
325
|
+
r = n.pop(), r !== void 0 && r < i && (i = r, o = h), h = e.indexOf(t, c + 1);
|
|
326
|
+
c = l < h && l >= 0 ? l : h;
|
|
240
327
|
}
|
|
241
|
-
n.length && o !== void 0 && (a = [
|
|
328
|
+
n.length && o !== void 0 && (a = [i, o]);
|
|
242
329
|
}
|
|
243
330
|
return a;
|
|
244
|
-
},
|
|
245
|
-
function
|
|
331
|
+
}, X = "\0SLASH" + Math.random() + "\0", K = "\0OPEN" + Math.random() + "\0", F = "\0CLOSE" + Math.random() + "\0", Q = "\0COMMA" + Math.random() + "\0", tt = "\0PERIOD" + Math.random() + "\0", bt = new RegExp(X, "g"), vt = new RegExp(K, "g"), $t = new RegExp(F, "g"), Tt = new RegExp(Q, "g"), Mt = new RegExp(tt, "g"), Rt = /\\\\/g, Ct = /\\{/g, Pt = /\\}/g, It = /\\,/g, Dt = /\\./g;
|
|
332
|
+
function L(s) {
|
|
246
333
|
return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
|
|
247
334
|
}
|
|
248
|
-
function
|
|
249
|
-
return s.replace(
|
|
335
|
+
function Lt(s) {
|
|
336
|
+
return s.replace(Rt, X).replace(Ct, K).replace(Pt, F).replace(It, Q).replace(Dt, tt);
|
|
250
337
|
}
|
|
251
|
-
function
|
|
252
|
-
return s.replace(
|
|
338
|
+
function kt(s) {
|
|
339
|
+
return s.replace(bt, "\\").replace(vt, "{").replace($t, "}").replace(Tt, ",").replace(Mt, ".");
|
|
253
340
|
}
|
|
254
|
-
function
|
|
341
|
+
function et(s) {
|
|
255
342
|
if (!s)
|
|
256
343
|
return [""];
|
|
257
|
-
const t = [], e =
|
|
344
|
+
const t = [], e = J("{", "}", s);
|
|
258
345
|
if (!e)
|
|
259
346
|
return s.split(",");
|
|
260
|
-
const { pre: n, body:
|
|
261
|
-
o[o.length - 1] += "{" +
|
|
262
|
-
const a =
|
|
263
|
-
return
|
|
347
|
+
const { pre: n, body: r, post: i } = e, o = n.split(",");
|
|
348
|
+
o[o.length - 1] += "{" + r + "}";
|
|
349
|
+
const a = et(i);
|
|
350
|
+
return i.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
|
|
264
351
|
}
|
|
265
|
-
function
|
|
266
|
-
return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)),
|
|
352
|
+
function Ft(s) {
|
|
353
|
+
return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), M(Lt(s), !0).map(kt)) : [];
|
|
267
354
|
}
|
|
268
|
-
function
|
|
355
|
+
function jt(s) {
|
|
269
356
|
return "{" + s + "}";
|
|
270
357
|
}
|
|
271
|
-
function
|
|
358
|
+
function Wt(s) {
|
|
272
359
|
return /^-?0\d/.test(s);
|
|
273
360
|
}
|
|
274
|
-
function
|
|
361
|
+
function Ut(s, t) {
|
|
275
362
|
return s <= t;
|
|
276
363
|
}
|
|
277
|
-
function
|
|
364
|
+
function zt(s, t) {
|
|
278
365
|
return s >= t;
|
|
279
366
|
}
|
|
280
|
-
function
|
|
281
|
-
const e = [], n =
|
|
367
|
+
function M(s, t) {
|
|
368
|
+
const e = [], n = J("{", "}", s);
|
|
282
369
|
if (!n)
|
|
283
370
|
return [s];
|
|
284
|
-
const
|
|
371
|
+
const r = n.pre, i = n.post.length ? M(n.post, !1) : [""];
|
|
285
372
|
if (/\$$/.test(n.pre))
|
|
286
|
-
for (let o = 0; o <
|
|
287
|
-
const a =
|
|
373
|
+
for (let o = 0; o < i.length; o++) {
|
|
374
|
+
const a = r + "{" + n.body + "}" + i[o];
|
|
288
375
|
e.push(a);
|
|
289
376
|
}
|
|
290
377
|
else {
|
|
291
|
-
const o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),
|
|
292
|
-
if (!
|
|
293
|
-
return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body +
|
|
378
|
+
const o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body), l = o || a, h = n.body.indexOf(",") >= 0;
|
|
379
|
+
if (!l && !h)
|
|
380
|
+
return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body + F + n.post, M(s)) : [s];
|
|
294
381
|
let c;
|
|
295
|
-
if (
|
|
382
|
+
if (l)
|
|
296
383
|
c = n.body.split(/\.\./);
|
|
297
|
-
else if (c =
|
|
298
|
-
return
|
|
384
|
+
else if (c = et(n.body), c.length === 1 && c[0] !== void 0 && (c = M(c[0], !1).map(jt), c.length === 1))
|
|
385
|
+
return i.map((f) => n.pre + c[0] + f);
|
|
299
386
|
let p;
|
|
300
|
-
if (
|
|
301
|
-
const f =
|
|
302
|
-
let d = c.length === 3 && c[2] !== void 0 ? Math.abs(
|
|
303
|
-
u < f && (d *= -1,
|
|
304
|
-
const
|
|
387
|
+
if (l && c[0] !== void 0 && c[1] !== void 0) {
|
|
388
|
+
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 = Ut;
|
|
390
|
+
u < f && (d *= -1, x = zt);
|
|
391
|
+
const v = c.some(Wt);
|
|
305
392
|
p = [];
|
|
306
|
-
for (let
|
|
307
|
-
let
|
|
393
|
+
for (let S = f; x(S, u); S += d) {
|
|
394
|
+
let m;
|
|
308
395
|
if (a)
|
|
309
|
-
|
|
310
|
-
else if (
|
|
311
|
-
const
|
|
312
|
-
if (
|
|
313
|
-
const
|
|
314
|
-
|
|
396
|
+
m = String.fromCharCode(S), m === "\\" && (m = "");
|
|
397
|
+
else if (m = String(S), v) {
|
|
398
|
+
const $ = g - m.length;
|
|
399
|
+
if ($ > 0) {
|
|
400
|
+
const C = new Array($ + 1).join("0");
|
|
401
|
+
S < 0 ? m = "-" + C + m.slice(1) : m = C + m;
|
|
315
402
|
}
|
|
316
403
|
}
|
|
317
|
-
p.push(
|
|
404
|
+
p.push(m);
|
|
318
405
|
}
|
|
319
406
|
} else {
|
|
320
407
|
p = [];
|
|
321
408
|
for (let f = 0; f < c.length; f++)
|
|
322
|
-
p.push.apply(p,
|
|
409
|
+
p.push.apply(p, M(c[f], !1));
|
|
323
410
|
}
|
|
324
411
|
for (let f = 0; f < p.length; f++)
|
|
325
|
-
for (let u = 0; u <
|
|
326
|
-
const
|
|
327
|
-
(!t ||
|
|
412
|
+
for (let u = 0; u < i.length; u++) {
|
|
413
|
+
const g = r + p[f] + i[u];
|
|
414
|
+
(!t || l || g) && e.push(g);
|
|
328
415
|
}
|
|
329
416
|
}
|
|
330
417
|
return e;
|
|
331
418
|
}
|
|
332
|
-
const
|
|
419
|
+
const Bt = 1024 * 64, I = (s) => {
|
|
333
420
|
if (typeof s != "string")
|
|
334
421
|
throw new TypeError("invalid pattern");
|
|
335
|
-
if (s.length >
|
|
422
|
+
if (s.length > Bt)
|
|
336
423
|
throw new TypeError("pattern is too long");
|
|
337
|
-
},
|
|
424
|
+
}, _t = {
|
|
338
425
|
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
339
426
|
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
340
427
|
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
@@ -349,77 +436,77 @@ const Rt = 1024 * 64, C = (s) => {
|
|
|
349
436
|
"[:upper:]": ["\\p{Lu}", !0],
|
|
350
437
|
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
351
438
|
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
352
|
-
},
|
|
439
|
+
}, T = (s) => s.replace(/[[\]\\-]/g, "\\$&"), qt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), _ = (s) => s.join(""), Gt = (s, t) => {
|
|
353
440
|
const e = t;
|
|
354
441
|
if (s.charAt(e) !== "[")
|
|
355
442
|
throw new Error("not in a brace expression");
|
|
356
|
-
const n = [],
|
|
357
|
-
let
|
|
358
|
-
t: for (;
|
|
359
|
-
const d = s.charAt(
|
|
360
|
-
if ((d === "!" || d === "^") &&
|
|
361
|
-
|
|
443
|
+
const n = [], r = [];
|
|
444
|
+
let i = e + 1, o = !1, a = !1, l = !1, h = !1, c = e, p = "";
|
|
445
|
+
t: for (; i < s.length; ) {
|
|
446
|
+
const d = s.charAt(i);
|
|
447
|
+
if ((d === "!" || d === "^") && i === e + 1) {
|
|
448
|
+
h = !0, i++;
|
|
362
449
|
continue;
|
|
363
450
|
}
|
|
364
|
-
if (d === "]" && o && !
|
|
365
|
-
c =
|
|
451
|
+
if (d === "]" && o && !l) {
|
|
452
|
+
c = i + 1;
|
|
366
453
|
break;
|
|
367
454
|
}
|
|
368
|
-
if (o = !0, d === "\\" && !
|
|
369
|
-
|
|
455
|
+
if (o = !0, d === "\\" && !l) {
|
|
456
|
+
l = !0, i++;
|
|
370
457
|
continue;
|
|
371
458
|
}
|
|
372
|
-
if (d === "[" && !
|
|
373
|
-
for (const [
|
|
374
|
-
if (s.startsWith(
|
|
459
|
+
if (d === "[" && !l) {
|
|
460
|
+
for (const [x, [N, v, S]] of Object.entries(_t))
|
|
461
|
+
if (s.startsWith(x, i)) {
|
|
375
462
|
if (p)
|
|
376
463
|
return ["$.", !1, s.length - e, !0];
|
|
377
|
-
|
|
464
|
+
i += x.length, S ? r.push(N) : n.push(N), a = a || v;
|
|
378
465
|
continue t;
|
|
379
466
|
}
|
|
380
467
|
}
|
|
381
|
-
if (
|
|
382
|
-
d > p ? n.push(
|
|
468
|
+
if (l = !1, p) {
|
|
469
|
+
d > p ? n.push(T(p) + "-" + T(d)) : d === p && n.push(T(d)), p = "", i++;
|
|
383
470
|
continue;
|
|
384
471
|
}
|
|
385
|
-
if (s.startsWith("-]",
|
|
386
|
-
n.push(
|
|
472
|
+
if (s.startsWith("-]", i + 1)) {
|
|
473
|
+
n.push(T(d + "-")), i += 2;
|
|
387
474
|
continue;
|
|
388
475
|
}
|
|
389
|
-
if (s.startsWith("-",
|
|
390
|
-
p = d,
|
|
476
|
+
if (s.startsWith("-", i + 1)) {
|
|
477
|
+
p = d, i += 2;
|
|
391
478
|
continue;
|
|
392
479
|
}
|
|
393
|
-
n.push(
|
|
480
|
+
n.push(T(d)), i++;
|
|
394
481
|
}
|
|
395
|
-
if (c <
|
|
482
|
+
if (c < i)
|
|
396
483
|
return ["", !1, 0, !1];
|
|
397
|
-
if (!n.length && !
|
|
484
|
+
if (!n.length && !r.length)
|
|
398
485
|
return ["$.", !1, s.length - e, !0];
|
|
399
|
-
if (
|
|
486
|
+
if (r.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !h) {
|
|
400
487
|
const d = n[0].length === 2 ? n[0].slice(-1) : n[0];
|
|
401
|
-
return [
|
|
488
|
+
return [qt(d), !1, c - e, !1];
|
|
402
489
|
}
|
|
403
|
-
const f = "[" + (
|
|
404
|
-
return [n.length &&
|
|
405
|
-
},
|
|
490
|
+
const f = "[" + (h ? "^" : "") + _(n) + "]", u = "[" + (h ? "" : "^") + _(r) + "]";
|
|
491
|
+
return [n.length && r.length ? "(" + f + "|" + u + ")" : n.length ? f : u, a, c - e, !0];
|
|
492
|
+
}, R = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"), Ht = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), q = (s) => Ht.has(s), Vt = "(?!(?:^|/)\\.\\.?(?:$|/))", P = "(?!\\.)", Yt = /* @__PURE__ */ new Set(["[", "."]), Zt = /* @__PURE__ */ new Set(["..", "."]), Jt = new Set("().*{}+?[]^$\\!"), Xt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), j = "[^/]", G = j + "*?", H = j + "+?";
|
|
406
493
|
class E {
|
|
407
494
|
type;
|
|
408
495
|
#s;
|
|
409
496
|
#n;
|
|
410
|
-
#
|
|
497
|
+
#i = !1;
|
|
411
498
|
#t = [];
|
|
412
499
|
#e;
|
|
413
500
|
#o;
|
|
414
501
|
#a;
|
|
415
502
|
#c = !1;
|
|
416
|
-
#
|
|
417
|
-
#
|
|
503
|
+
#r;
|
|
504
|
+
#l;
|
|
418
505
|
// set to true if it's an extglob with no children
|
|
419
506
|
// (which really means one child of '')
|
|
420
507
|
#u = !1;
|
|
421
508
|
constructor(t, e, n = {}) {
|
|
422
|
-
this.type = t, t && (this.#n = !0), this.#e = e, this.#s = this.#e ? this.#e.#s : this, this.#
|
|
509
|
+
this.type = t, t && (this.#n = !0), this.#e = e, this.#s = this.#e ? this.#e.#s : this, this.#r = this.#s === this ? n : this.#s.#r, this.#a = this.#s === this ? [] : this.#s.#a, t === "!" && !this.#s.#c && this.#a.push(this), this.#o = this.#e ? this.#e.#t.length : 0;
|
|
423
510
|
}
|
|
424
511
|
get hasMagic() {
|
|
425
512
|
if (this.#n !== void 0)
|
|
@@ -431,7 +518,7 @@ class E {
|
|
|
431
518
|
}
|
|
432
519
|
// reconstructs the pattern
|
|
433
520
|
toString() {
|
|
434
|
-
return this.#
|
|
521
|
+
return this.#l !== void 0 ? this.#l : this.type ? this.#l = this.type + "(" + this.#t.map((t) => String(t)).join("|") + ")" : this.#l = this.#t.map((t) => String(t)).join("");
|
|
435
522
|
}
|
|
436
523
|
#p() {
|
|
437
524
|
if (this !== this.#s)
|
|
@@ -445,11 +532,11 @@ class E {
|
|
|
445
532
|
continue;
|
|
446
533
|
let e = t, n = e.#e;
|
|
447
534
|
for (; n; ) {
|
|
448
|
-
for (let
|
|
449
|
-
for (const
|
|
450
|
-
if (typeof
|
|
535
|
+
for (let r = e.#o + 1; !n.type && r < n.#t.length; r++)
|
|
536
|
+
for (const i of t.#t) {
|
|
537
|
+
if (typeof i == "string")
|
|
451
538
|
throw new Error("string part in extglob AST??");
|
|
452
|
-
|
|
539
|
+
i.copyIn(n.#t[r]);
|
|
453
540
|
}
|
|
454
541
|
e = n, n = e.#e;
|
|
455
542
|
}
|
|
@@ -502,53 +589,53 @@ class E {
|
|
|
502
589
|
e.copyIn(n);
|
|
503
590
|
return e;
|
|
504
591
|
}
|
|
505
|
-
static #
|
|
506
|
-
let
|
|
592
|
+
static #h(t, e, n, r) {
|
|
593
|
+
let i = !1, o = !1, a = -1, l = !1;
|
|
507
594
|
if (e.type === null) {
|
|
508
|
-
let u = n,
|
|
595
|
+
let u = n, g = "";
|
|
509
596
|
for (; u < t.length; ) {
|
|
510
597
|
const d = t.charAt(u++);
|
|
511
|
-
if (
|
|
512
|
-
|
|
598
|
+
if (i || d === "\\") {
|
|
599
|
+
i = !i, g += d;
|
|
513
600
|
continue;
|
|
514
601
|
}
|
|
515
602
|
if (o) {
|
|
516
|
-
u === a + 1 ? (d === "^" || d === "!") && (
|
|
603
|
+
u === a + 1 ? (d === "^" || d === "!") && (l = !0) : d === "]" && !(u === a + 2 && l) && (o = !1), g += d;
|
|
517
604
|
continue;
|
|
518
605
|
} else if (d === "[") {
|
|
519
|
-
o = !0, a = u,
|
|
606
|
+
o = !0, a = u, l = !1, g += d;
|
|
520
607
|
continue;
|
|
521
608
|
}
|
|
522
|
-
if (!
|
|
523
|
-
e.push(
|
|
524
|
-
const
|
|
525
|
-
u = E.#
|
|
609
|
+
if (!r.noext && q(d) && t.charAt(u) === "(") {
|
|
610
|
+
e.push(g), g = "";
|
|
611
|
+
const x = new E(d, e);
|
|
612
|
+
u = E.#h(t, x, u, r), e.push(x);
|
|
526
613
|
continue;
|
|
527
614
|
}
|
|
528
|
-
|
|
615
|
+
g += d;
|
|
529
616
|
}
|
|
530
|
-
return e.push(
|
|
617
|
+
return e.push(g), u;
|
|
531
618
|
}
|
|
532
|
-
let
|
|
619
|
+
let h = n + 1, c = new E(null, e);
|
|
533
620
|
const p = [];
|
|
534
621
|
let f = "";
|
|
535
|
-
for (;
|
|
536
|
-
const u = t.charAt(
|
|
537
|
-
if (
|
|
538
|
-
|
|
622
|
+
for (; h < t.length; ) {
|
|
623
|
+
const u = t.charAt(h++);
|
|
624
|
+
if (i || u === "\\") {
|
|
625
|
+
i = !i, f += u;
|
|
539
626
|
continue;
|
|
540
627
|
}
|
|
541
628
|
if (o) {
|
|
542
|
-
|
|
629
|
+
h === a + 1 ? (u === "^" || u === "!") && (l = !0) : u === "]" && !(h === a + 2 && l) && (o = !1), f += u;
|
|
543
630
|
continue;
|
|
544
631
|
} else if (u === "[") {
|
|
545
|
-
o = !0, a =
|
|
632
|
+
o = !0, a = h, l = !1, f += u;
|
|
546
633
|
continue;
|
|
547
634
|
}
|
|
548
|
-
if (
|
|
635
|
+
if (q(u) && t.charAt(h) === "(") {
|
|
549
636
|
c.push(f), f = "";
|
|
550
|
-
const
|
|
551
|
-
c.push(
|
|
637
|
+
const g = new E(u, c);
|
|
638
|
+
c.push(g), h = E.#h(t, g, h, r);
|
|
552
639
|
continue;
|
|
553
640
|
}
|
|
554
641
|
if (u === "|") {
|
|
@@ -556,31 +643,31 @@ class E {
|
|
|
556
643
|
continue;
|
|
557
644
|
}
|
|
558
645
|
if (u === ")")
|
|
559
|
-
return f === "" && e.#t.length === 0 && (e.#u = !0), c.push(f), f = "", e.push(...p, c),
|
|
646
|
+
return f === "" && e.#t.length === 0 && (e.#u = !0), c.push(f), f = "", e.push(...p, c), h;
|
|
560
647
|
f += u;
|
|
561
648
|
}
|
|
562
|
-
return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)],
|
|
649
|
+
return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)], h;
|
|
563
650
|
}
|
|
564
651
|
static fromGlob(t, e = {}) {
|
|
565
652
|
const n = new E(null, void 0, e);
|
|
566
|
-
return E.#
|
|
653
|
+
return E.#h(t, n, 0, e), n;
|
|
567
654
|
}
|
|
568
655
|
// returns the regular expression if there's magic, or the unescaped
|
|
569
656
|
// string if not.
|
|
570
657
|
toMMPattern() {
|
|
571
658
|
if (this !== this.#s)
|
|
572
659
|
return this.#s.toMMPattern();
|
|
573
|
-
const t = this.toString(), [e, n,
|
|
574
|
-
if (!(
|
|
660
|
+
const t = this.toString(), [e, n, r, i] = this.toRegExpSource();
|
|
661
|
+
if (!(r || this.#n || this.#r.nocase && !this.#r.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
|
|
575
662
|
return n;
|
|
576
|
-
const a = (this.#
|
|
663
|
+
const a = (this.#r.nocase ? "i" : "") + (i ? "u" : "");
|
|
577
664
|
return Object.assign(new RegExp(`^${e}$`, a), {
|
|
578
665
|
_src: e,
|
|
579
666
|
_glob: t
|
|
580
667
|
});
|
|
581
668
|
}
|
|
582
669
|
get options() {
|
|
583
|
-
return this.#
|
|
670
|
+
return this.#r;
|
|
584
671
|
}
|
|
585
672
|
// returns the string match, the regexp source, whether there's magic
|
|
586
673
|
// in the regexp (so a regular expression is required) and whether or
|
|
@@ -652,168 +739,168 @@ class E {
|
|
|
652
739
|
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
653
740
|
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
654
741
|
toRegExpSource(t) {
|
|
655
|
-
const e = t ?? !!this.#
|
|
742
|
+
const e = t ?? !!this.#r.dot;
|
|
656
743
|
if (this.#s === this && this.#p(), !this.type) {
|
|
657
|
-
const
|
|
658
|
-
const [
|
|
659
|
-
return this.#n = this.#n ||
|
|
744
|
+
const l = this.isStart() && this.isEnd(), h = this.#t.map((u) => {
|
|
745
|
+
const [g, d, x, N] = typeof u == "string" ? E.#d(u, this.#n, l) : u.toRegExpSource(t);
|
|
746
|
+
return this.#n = this.#n || x, this.#i = this.#i || N, g;
|
|
660
747
|
}).join("");
|
|
661
748
|
let c = "";
|
|
662
|
-
if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 &&
|
|
663
|
-
const
|
|
749
|
+
if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Zt.has(this.#t[0]))) {
|
|
750
|
+
const g = Yt, d = (
|
|
664
751
|
// dots are allowed, and the pattern starts with [ or .
|
|
665
|
-
e &&
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
),
|
|
669
|
-
c = d ?
|
|
752
|
+
e && g.has(h.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
753
|
+
h.startsWith("\\.") && g.has(h.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
754
|
+
h.startsWith("\\.\\.") && g.has(h.charAt(4))
|
|
755
|
+
), x = !e && !t && g.has(h.charAt(0));
|
|
756
|
+
c = d ? Vt : x ? P : "";
|
|
670
757
|
}
|
|
671
758
|
let p = "";
|
|
672
759
|
return this.isEnd() && this.#s.#c && this.#e?.type === "!" && (p = "(?:$|\\/)"), [
|
|
673
|
-
c +
|
|
674
|
-
|
|
760
|
+
c + h + p,
|
|
761
|
+
R(h),
|
|
675
762
|
this.#n = !!this.#n,
|
|
676
|
-
this.#
|
|
763
|
+
this.#i
|
|
677
764
|
];
|
|
678
765
|
}
|
|
679
|
-
const n = this.type === "*" || this.type === "+",
|
|
680
|
-
let
|
|
681
|
-
if (this.isStart() && this.isEnd() && !
|
|
682
|
-
const
|
|
683
|
-
return this.#t = [
|
|
766
|
+
const n = this.type === "*" || this.type === "+", r = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
767
|
+
let i = this.#f(e);
|
|
768
|
+
if (this.isStart() && this.isEnd() && !i && this.type !== "!") {
|
|
769
|
+
const l = this.toString();
|
|
770
|
+
return this.#t = [l], this.type = null, this.#n = void 0, [l, R(this.toString()), !1, !1];
|
|
684
771
|
}
|
|
685
|
-
let o = !n || t || e || !
|
|
686
|
-
o ===
|
|
772
|
+
let o = !n || t || e || !P ? "" : this.#f(!0);
|
|
773
|
+
o === i && (o = ""), o && (i = `(?:${i})(?:${o})*?`);
|
|
687
774
|
let a = "";
|
|
688
775
|
if (this.type === "!" && this.#u)
|
|
689
|
-
a = (this.isStart() && !e ?
|
|
776
|
+
a = (this.isStart() && !e ? P : "") + H;
|
|
690
777
|
else {
|
|
691
|
-
const
|
|
778
|
+
const l = this.type === "!" ? (
|
|
692
779
|
// !() must match something,but !(x) can match ''
|
|
693
|
-
"))" + (this.isStart() && !e && !t ?
|
|
780
|
+
"))" + (this.isStart() && !e && !t ? P : "") + G + ")"
|
|
694
781
|
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
695
|
-
a =
|
|
782
|
+
a = r + i + l;
|
|
696
783
|
}
|
|
697
784
|
return [
|
|
698
785
|
a,
|
|
699
|
-
|
|
786
|
+
R(i),
|
|
700
787
|
this.#n = !!this.#n,
|
|
701
|
-
this.#
|
|
788
|
+
this.#i
|
|
702
789
|
];
|
|
703
790
|
}
|
|
704
791
|
#f(t) {
|
|
705
792
|
return this.#t.map((e) => {
|
|
706
793
|
if (typeof e == "string")
|
|
707
794
|
throw new Error("string type in extglob ast??");
|
|
708
|
-
const [n,
|
|
709
|
-
return this.#
|
|
795
|
+
const [n, r, i, o] = e.toRegExpSource(t);
|
|
796
|
+
return this.#i = this.#i || o, n;
|
|
710
797
|
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
711
798
|
}
|
|
712
799
|
static #d(t, e, n = !1) {
|
|
713
|
-
let
|
|
800
|
+
let r = !1, i = "", o = !1;
|
|
714
801
|
for (let a = 0; a < t.length; a++) {
|
|
715
|
-
const
|
|
716
|
-
if (
|
|
717
|
-
|
|
802
|
+
const l = t.charAt(a);
|
|
803
|
+
if (r) {
|
|
804
|
+
r = !1, i += (Jt.has(l) ? "\\" : "") + l;
|
|
718
805
|
continue;
|
|
719
806
|
}
|
|
720
|
-
if (
|
|
721
|
-
a === t.length - 1 ?
|
|
807
|
+
if (l === "\\") {
|
|
808
|
+
a === t.length - 1 ? i += "\\\\" : r = !0;
|
|
722
809
|
continue;
|
|
723
810
|
}
|
|
724
|
-
if (
|
|
725
|
-
const [
|
|
811
|
+
if (l === "[") {
|
|
812
|
+
const [h, c, p, f] = Gt(t, a);
|
|
726
813
|
if (p) {
|
|
727
|
-
|
|
814
|
+
i += h, o = o || c, a += p - 1, e = e || f;
|
|
728
815
|
continue;
|
|
729
816
|
}
|
|
730
817
|
}
|
|
731
|
-
if (
|
|
732
|
-
n && t === "*" ?
|
|
818
|
+
if (l === "*") {
|
|
819
|
+
n && t === "*" ? i += H : i += G, e = !0;
|
|
733
820
|
continue;
|
|
734
821
|
}
|
|
735
|
-
if (
|
|
736
|
-
|
|
822
|
+
if (l === "?") {
|
|
823
|
+
i += j, e = !0;
|
|
737
824
|
continue;
|
|
738
825
|
}
|
|
739
|
-
|
|
826
|
+
i += Xt(l);
|
|
740
827
|
}
|
|
741
|
-
return [
|
|
828
|
+
return [i, R(t), !!e, o];
|
|
742
829
|
}
|
|
743
830
|
}
|
|
744
|
-
const
|
|
745
|
-
const e =
|
|
831
|
+
const Kt = (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)), Qt = /^\*+([^+@!?\*\[\(]*)$/, te = (s) => (t) => !t.startsWith(".") && t.endsWith(s), ee = (s) => (t) => t.endsWith(s), se = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), ne = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), re = /^\*+\.\*+$/, ie = (s) => !s.startsWith(".") && s.includes("."), oe = (s) => s !== "." && s !== ".." && s.includes("."), ce = /^\.\*+$/, ae = (s) => s !== "." && s !== ".." && s.startsWith("."), le = /^\*+$/, he = (s) => s.length !== 0 && !s.startsWith("."), ue = (s) => s.length !== 0 && s !== "." && s !== "..", fe = /^\?+([^+@!?\*\[\(]*)?$/, pe = ([s, t = ""]) => {
|
|
832
|
+
const e = st([s]);
|
|
746
833
|
return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
|
|
747
|
-
},
|
|
748
|
-
const e =
|
|
834
|
+
}, de = ([s, t = ""]) => {
|
|
835
|
+
const e = nt([s]);
|
|
749
836
|
return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
|
|
750
|
-
},
|
|
751
|
-
const e =
|
|
837
|
+
}, ge = ([s, t = ""]) => {
|
|
838
|
+
const e = nt([s]);
|
|
752
839
|
return t ? (n) => e(n) && n.endsWith(t) : e;
|
|
753
|
-
},
|
|
754
|
-
const e =
|
|
840
|
+
}, me = ([s, t = ""]) => {
|
|
841
|
+
const e = st([s]);
|
|
755
842
|
return t ? (n) => e(n) && n.endsWith(t) : e;
|
|
756
|
-
},
|
|
843
|
+
}, st = ([s]) => {
|
|
757
844
|
const t = s.length;
|
|
758
845
|
return (e) => e.length === t && !e.startsWith(".");
|
|
759
|
-
},
|
|
846
|
+
}, nt = ([s]) => {
|
|
760
847
|
const t = s.length;
|
|
761
848
|
return (e) => e.length === t && e !== "." && e !== "..";
|
|
762
|
-
},
|
|
849
|
+
}, rt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", V = {
|
|
763
850
|
win32: { sep: "\\" },
|
|
764
851
|
posix: { sep: "/" }
|
|
765
|
-
},
|
|
766
|
-
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
const
|
|
770
|
-
|
|
771
|
-
const
|
|
852
|
+
}, we = rt === "win32" ? V.win32.sep : V.posix.sep;
|
|
853
|
+
w.sep = we;
|
|
854
|
+
const A = Symbol("globstar **");
|
|
855
|
+
w.GLOBSTAR = A;
|
|
856
|
+
const ye = "[^/]", Ee = ye + "*?", xe = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", Se = "(?:(?!(?:\\/|^)\\.).)*?", Oe = (s, t = {}) => (e) => w(e, s, t);
|
|
857
|
+
w.filter = Oe;
|
|
858
|
+
const O = (s, t = {}) => Object.assign({}, s, t), Ae = (s) => {
|
|
772
859
|
if (!s || typeof s != "object" || !Object.keys(s).length)
|
|
773
|
-
return
|
|
774
|
-
const t =
|
|
775
|
-
return Object.assign((n,
|
|
860
|
+
return w;
|
|
861
|
+
const t = w;
|
|
862
|
+
return Object.assign((n, r, i = {}) => t(n, r, O(s, i)), {
|
|
776
863
|
Minimatch: class extends t.Minimatch {
|
|
777
|
-
constructor(
|
|
778
|
-
super(
|
|
864
|
+
constructor(r, i = {}) {
|
|
865
|
+
super(r, O(s, i));
|
|
779
866
|
}
|
|
780
|
-
static defaults(
|
|
781
|
-
return t.defaults(
|
|
867
|
+
static defaults(r) {
|
|
868
|
+
return t.defaults(O(s, r)).Minimatch;
|
|
782
869
|
}
|
|
783
870
|
},
|
|
784
871
|
AST: class extends t.AST {
|
|
785
872
|
/* c8 ignore start */
|
|
786
|
-
constructor(
|
|
787
|
-
super(
|
|
873
|
+
constructor(r, i, o = {}) {
|
|
874
|
+
super(r, i, O(s, o));
|
|
788
875
|
}
|
|
789
876
|
/* c8 ignore stop */
|
|
790
|
-
static fromGlob(
|
|
791
|
-
return t.AST.fromGlob(
|
|
877
|
+
static fromGlob(r, i = {}) {
|
|
878
|
+
return t.AST.fromGlob(r, O(s, i));
|
|
792
879
|
}
|
|
793
880
|
},
|
|
794
|
-
unescape: (n,
|
|
795
|
-
escape: (n,
|
|
796
|
-
filter: (n,
|
|
797
|
-
defaults: (n) => t.defaults(
|
|
798
|
-
makeRe: (n,
|
|
799
|
-
braceExpand: (n,
|
|
800
|
-
match: (n,
|
|
881
|
+
unescape: (n, r = {}) => t.unescape(n, O(s, r)),
|
|
882
|
+
escape: (n, r = {}) => t.escape(n, O(s, r)),
|
|
883
|
+
filter: (n, r = {}) => t.filter(n, O(s, r)),
|
|
884
|
+
defaults: (n) => t.defaults(O(s, n)),
|
|
885
|
+
makeRe: (n, r = {}) => t.makeRe(n, O(s, r)),
|
|
886
|
+
braceExpand: (n, r = {}) => t.braceExpand(n, O(s, r)),
|
|
887
|
+
match: (n, r, i = {}) => t.match(n, r, O(s, i)),
|
|
801
888
|
sep: t.sep,
|
|
802
|
-
GLOBSTAR:
|
|
889
|
+
GLOBSTAR: A
|
|
803
890
|
});
|
|
804
891
|
};
|
|
805
|
-
|
|
806
|
-
const
|
|
807
|
-
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
const
|
|
811
|
-
const n = new
|
|
812
|
-
return s = s.filter((
|
|
892
|
+
w.defaults = Ae;
|
|
893
|
+
const it = (s, t = {}) => (I(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : Ft(s));
|
|
894
|
+
w.braceExpand = it;
|
|
895
|
+
const Ne = (s, t = {}) => new D(s, t).makeRe();
|
|
896
|
+
w.makeRe = Ne;
|
|
897
|
+
const be = (s, t, e = {}) => {
|
|
898
|
+
const n = new D(t, e);
|
|
899
|
+
return s = s.filter((r) => n.match(r)), n.options.nonull && !s.length && s.push(t), s;
|
|
813
900
|
};
|
|
814
|
-
|
|
815
|
-
const
|
|
816
|
-
class
|
|
901
|
+
w.match = be;
|
|
902
|
+
const Y = /[?*]|[+@!]\(.*?\)|\[|\]/, ve = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
903
|
+
class D {
|
|
817
904
|
options;
|
|
818
905
|
set;
|
|
819
906
|
pattern;
|
|
@@ -832,7 +919,7 @@ class I {
|
|
|
832
919
|
windowsNoMagicRoot;
|
|
833
920
|
regexp;
|
|
834
921
|
constructor(t, e = {}) {
|
|
835
|
-
|
|
922
|
+
I(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || rt, 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();
|
|
836
923
|
}
|
|
837
924
|
hasMagic() {
|
|
838
925
|
if (this.options.magicalBraces && this.set.length > 1)
|
|
@@ -855,23 +942,23 @@ class I {
|
|
|
855
942
|
this.empty = !0;
|
|
856
943
|
return;
|
|
857
944
|
}
|
|
858
|
-
this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...
|
|
859
|
-
const n = this.globSet.map((
|
|
945
|
+
this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...i) => console.error(...i)), this.debug(this.pattern, this.globSet);
|
|
946
|
+
const n = this.globSet.map((i) => this.slashSplit(i));
|
|
860
947
|
this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
|
|
861
|
-
let
|
|
948
|
+
let r = this.globParts.map((i, o, a) => {
|
|
862
949
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
863
|
-
const
|
|
864
|
-
if (h)
|
|
865
|
-
return [...r.slice(0, 4), ...r.slice(4).map((c) => this.parse(c))];
|
|
950
|
+
const l = i[0] === "" && i[1] === "" && (i[2] === "?" || !Y.test(i[2])) && !Y.test(i[3]), h = /^[a-z]:/i.test(i[0]);
|
|
866
951
|
if (l)
|
|
867
|
-
return [
|
|
952
|
+
return [...i.slice(0, 4), ...i.slice(4).map((c) => this.parse(c))];
|
|
953
|
+
if (h)
|
|
954
|
+
return [i[0], ...i.slice(1).map((c) => this.parse(c))];
|
|
868
955
|
}
|
|
869
|
-
return
|
|
956
|
+
return i.map((l) => this.parse(l));
|
|
870
957
|
});
|
|
871
|
-
if (this.debug(this.pattern,
|
|
872
|
-
for (let
|
|
873
|
-
const o = this.set[
|
|
874
|
-
o[0] === "" && o[1] === "" && this.globParts[
|
|
958
|
+
if (this.debug(this.pattern, r), this.set = r.filter((i) => i.indexOf(!1) === -1), this.isWindows)
|
|
959
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
960
|
+
const o = this.set[i];
|
|
961
|
+
o[0] === "" && o[1] === "" && this.globParts[i][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
|
|
875
962
|
}
|
|
876
963
|
this.debug(this.pattern, this.set);
|
|
877
964
|
}
|
|
@@ -883,8 +970,8 @@ class I {
|
|
|
883
970
|
preprocess(t) {
|
|
884
971
|
if (this.options.noglobstar)
|
|
885
972
|
for (let n = 0; n < t.length; n++)
|
|
886
|
-
for (let
|
|
887
|
-
t[n][
|
|
973
|
+
for (let r = 0; r < t[n].length; r++)
|
|
974
|
+
t[n][r] === "**" && (t[n][r] = "*");
|
|
888
975
|
const { optimizationLevel: e = 1 } = this.options;
|
|
889
976
|
return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
|
|
890
977
|
}
|
|
@@ -893,19 +980,19 @@ class I {
|
|
|
893
980
|
return t.map((e) => {
|
|
894
981
|
let n = -1;
|
|
895
982
|
for (; (n = e.indexOf("**", n + 1)) !== -1; ) {
|
|
896
|
-
let
|
|
897
|
-
for (; e[
|
|
898
|
-
|
|
899
|
-
|
|
983
|
+
let r = n;
|
|
984
|
+
for (; e[r + 1] === "**"; )
|
|
985
|
+
r++;
|
|
986
|
+
r !== n && e.splice(n, r - n);
|
|
900
987
|
}
|
|
901
988
|
return e;
|
|
902
989
|
});
|
|
903
990
|
}
|
|
904
991
|
// get rid of adjascent ** and resolve .. portions
|
|
905
992
|
levelOneOptimize(t) {
|
|
906
|
-
return t.map((e) => (e = e.reduce((n,
|
|
907
|
-
const
|
|
908
|
-
return
|
|
993
|
+
return t.map((e) => (e = e.reduce((n, r) => {
|
|
994
|
+
const i = n[n.length - 1];
|
|
995
|
+
return r === "**" && i === "**" ? n : r === ".." && i && i !== ".." && i !== "." && i !== "**" ? (n.pop(), n) : (n.push(r), n);
|
|
909
996
|
}, []), e.length === 0 ? [""] : e));
|
|
910
997
|
}
|
|
911
998
|
levelTwoFileOptimize(t) {
|
|
@@ -913,16 +1000,16 @@ class I {
|
|
|
913
1000
|
let e = !1;
|
|
914
1001
|
do {
|
|
915
1002
|
if (e = !1, !this.preserveMultipleSlashes) {
|
|
916
|
-
for (let
|
|
917
|
-
const
|
|
918
|
-
|
|
1003
|
+
for (let r = 1; r < t.length - 1; r++) {
|
|
1004
|
+
const i = t[r];
|
|
1005
|
+
r === 1 && i === "" && t[0] === "" || (i === "." || i === "") && (e = !0, t.splice(r, 1), r--);
|
|
919
1006
|
}
|
|
920
1007
|
t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
|
|
921
1008
|
}
|
|
922
1009
|
let n = 0;
|
|
923
1010
|
for (; (n = t.indexOf("..", n + 1)) !== -1; ) {
|
|
924
|
-
const
|
|
925
|
-
|
|
1011
|
+
const r = t[n - 1];
|
|
1012
|
+
r && r !== "." && r !== ".." && r !== "**" && (e = !0, t.splice(n - 1, 2), n -= 2);
|
|
926
1013
|
}
|
|
927
1014
|
} while (e);
|
|
928
1015
|
return t.length === 0 ? [""] : t;
|
|
@@ -950,19 +1037,19 @@ class I {
|
|
|
950
1037
|
do {
|
|
951
1038
|
e = !1;
|
|
952
1039
|
for (let n of t) {
|
|
953
|
-
let
|
|
954
|
-
for (; (
|
|
955
|
-
let o =
|
|
1040
|
+
let r = -1;
|
|
1041
|
+
for (; (r = n.indexOf("**", r + 1)) !== -1; ) {
|
|
1042
|
+
let o = r;
|
|
956
1043
|
for (; n[o + 1] === "**"; )
|
|
957
1044
|
o++;
|
|
958
|
-
o >
|
|
959
|
-
let a = n[
|
|
960
|
-
const
|
|
961
|
-
if (a !== ".." || !
|
|
1045
|
+
o > r && n.splice(r + 1, o - r);
|
|
1046
|
+
let a = n[r + 1];
|
|
1047
|
+
const l = n[r + 2], h = n[r + 3];
|
|
1048
|
+
if (a !== ".." || !l || l === "." || l === ".." || !h || h === "." || h === "..")
|
|
962
1049
|
continue;
|
|
963
|
-
e = !0, n.splice(
|
|
1050
|
+
e = !0, n.splice(r, 1);
|
|
964
1051
|
const c = n.slice(0);
|
|
965
|
-
c[
|
|
1052
|
+
c[r] = "**", t.push(c), r--;
|
|
966
1053
|
}
|
|
967
1054
|
if (!this.preserveMultipleSlashes) {
|
|
968
1055
|
for (let o = 1; o < n.length - 1; o++) {
|
|
@@ -971,13 +1058,13 @@ class I {
|
|
|
971
1058
|
}
|
|
972
1059
|
n[0] === "." && n.length === 2 && (n[1] === "." || n[1] === "") && (e = !0, n.pop());
|
|
973
1060
|
}
|
|
974
|
-
let
|
|
975
|
-
for (; (
|
|
976
|
-
const o = n[
|
|
1061
|
+
let i = 0;
|
|
1062
|
+
for (; (i = n.indexOf("..", i + 1)) !== -1; ) {
|
|
1063
|
+
const o = n[i - 1];
|
|
977
1064
|
if (o && o !== "." && o !== ".." && o !== "**") {
|
|
978
1065
|
e = !0;
|
|
979
|
-
const
|
|
980
|
-
n.splice(
|
|
1066
|
+
const l = i === 1 && n[i + 1] === "**" ? ["."] : [];
|
|
1067
|
+
n.splice(i - 1, 2, ...l), n.length === 0 && n.push(""), i -= 2;
|
|
981
1068
|
}
|
|
982
1069
|
}
|
|
983
1070
|
}
|
|
@@ -994,31 +1081,31 @@ class I {
|
|
|
994
1081
|
secondPhasePreProcess(t) {
|
|
995
1082
|
for (let e = 0; e < t.length - 1; e++)
|
|
996
1083
|
for (let n = e + 1; n < t.length; n++) {
|
|
997
|
-
const
|
|
998
|
-
if (
|
|
999
|
-
t[e] = [], t[n] =
|
|
1084
|
+
const r = this.partsMatch(t[e], t[n], !this.preserveMultipleSlashes);
|
|
1085
|
+
if (r) {
|
|
1086
|
+
t[e] = [], t[n] = r;
|
|
1000
1087
|
break;
|
|
1001
1088
|
}
|
|
1002
1089
|
}
|
|
1003
1090
|
return t.filter((e) => e.length);
|
|
1004
1091
|
}
|
|
1005
1092
|
partsMatch(t, e, n = !1) {
|
|
1006
|
-
let
|
|
1007
|
-
for (;
|
|
1008
|
-
if (t[
|
|
1009
|
-
o.push(a === "b" ? e[
|
|
1010
|
-
else if (n && t[
|
|
1011
|
-
o.push(t[
|
|
1012
|
-
else if (n && e[
|
|
1013
|
-
o.push(e[
|
|
1014
|
-
else if (t[
|
|
1093
|
+
let r = 0, i = 0, o = [], a = "";
|
|
1094
|
+
for (; r < t.length && i < e.length; )
|
|
1095
|
+
if (t[r] === e[i])
|
|
1096
|
+
o.push(a === "b" ? e[i] : t[r]), r++, i++;
|
|
1097
|
+
else if (n && t[r] === "**" && e[i] === t[r + 1])
|
|
1098
|
+
o.push(t[r]), r++;
|
|
1099
|
+
else if (n && e[i] === "**" && t[r] === e[i + 1])
|
|
1100
|
+
o.push(e[i]), i++;
|
|
1101
|
+
else if (t[r] === "*" && e[i] && (this.options.dot || !e[i].startsWith(".")) && e[i] !== "**") {
|
|
1015
1102
|
if (a === "b")
|
|
1016
1103
|
return !1;
|
|
1017
|
-
a = "a", o.push(t[
|
|
1018
|
-
} else if (e[
|
|
1104
|
+
a = "a", o.push(t[r]), r++, i++;
|
|
1105
|
+
} else if (e[i] === "*" && t[r] && (this.options.dot || !t[r].startsWith(".")) && t[r] !== "**") {
|
|
1019
1106
|
if (a === "a")
|
|
1020
1107
|
return !1;
|
|
1021
|
-
a = "b", o.push(e[
|
|
1108
|
+
a = "b", o.push(e[i]), r++, i++;
|
|
1022
1109
|
} else
|
|
1023
1110
|
return !1;
|
|
1024
1111
|
return t.length === e.length && o;
|
|
@@ -1028,7 +1115,7 @@ class I {
|
|
|
1028
1115
|
return;
|
|
1029
1116
|
const t = this.pattern;
|
|
1030
1117
|
let e = !1, n = 0;
|
|
1031
|
-
for (let
|
|
1118
|
+
for (let r = 0; r < t.length && t.charAt(r) === "!"; r++)
|
|
1032
1119
|
e = !e, n++;
|
|
1033
1120
|
n && (this.pattern = t.slice(n)), this.negate = e;
|
|
1034
1121
|
}
|
|
@@ -1038,70 +1125,70 @@ class I {
|
|
|
1038
1125
|
// out of pattern, then that's fine, as long as all
|
|
1039
1126
|
// the parts match.
|
|
1040
1127
|
matchOne(t, e, n = !1) {
|
|
1041
|
-
const
|
|
1128
|
+
const r = this.options;
|
|
1042
1129
|
if (this.isWindows) {
|
|
1043
|
-
const d = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]),
|
|
1044
|
-
if (typeof
|
|
1045
|
-
const [
|
|
1046
|
-
|
|
1130
|
+
const d = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), x = !d && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), N = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), v = !N && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), S = x ? 3 : d ? 0 : void 0, m = v ? 3 : N ? 0 : void 0;
|
|
1131
|
+
if (typeof S == "number" && typeof m == "number") {
|
|
1132
|
+
const [$, C] = [t[S], e[m]];
|
|
1133
|
+
$.toLowerCase() === C.toLowerCase() && (e[m] = $, m > S ? e = e.slice(m) : S > m && (t = t.slice(S)));
|
|
1047
1134
|
}
|
|
1048
1135
|
}
|
|
1049
|
-
const { optimizationLevel:
|
|
1050
|
-
|
|
1051
|
-
for (var o = 0, a = 0,
|
|
1136
|
+
const { optimizationLevel: i = 1 } = this.options;
|
|
1137
|
+
i >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
|
|
1138
|
+
for (var o = 0, a = 0, l = t.length, h = e.length; o < l && a < h; o++, a++) {
|
|
1052
1139
|
this.debug("matchOne loop");
|
|
1053
1140
|
var c = e[a], p = t[o];
|
|
1054
1141
|
if (this.debug(e, c, p), c === !1)
|
|
1055
1142
|
return !1;
|
|
1056
|
-
if (c ===
|
|
1143
|
+
if (c === A) {
|
|
1057
1144
|
this.debug("GLOBSTAR", [e, c, p]);
|
|
1058
1145
|
var f = o, u = a + 1;
|
|
1059
|
-
if (u ===
|
|
1060
|
-
for (this.debug("** at the end"); o <
|
|
1061
|
-
if (t[o] === "." || t[o] === ".." || !
|
|
1146
|
+
if (u === h) {
|
|
1147
|
+
for (this.debug("** at the end"); o < l; o++)
|
|
1148
|
+
if (t[o] === "." || t[o] === ".." || !r.dot && t[o].charAt(0) === ".")
|
|
1062
1149
|
return !1;
|
|
1063
1150
|
return !0;
|
|
1064
1151
|
}
|
|
1065
|
-
for (; f <
|
|
1066
|
-
var
|
|
1152
|
+
for (; f < l; ) {
|
|
1153
|
+
var g = t[f];
|
|
1067
1154
|
if (this.debug(`
|
|
1068
|
-
globstar while`, t, f, e, u,
|
|
1069
|
-
return this.debug("globstar found match!", f,
|
|
1070
|
-
if (
|
|
1155
|
+
globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
|
|
1156
|
+
return this.debug("globstar found match!", f, l, g), !0;
|
|
1157
|
+
if (g === "." || g === ".." || !r.dot && g.charAt(0) === ".") {
|
|
1071
1158
|
this.debug("dot detected!", t, f, e, u);
|
|
1072
1159
|
break;
|
|
1073
1160
|
}
|
|
1074
1161
|
this.debug("globstar swallow a segment, and continue"), f++;
|
|
1075
1162
|
}
|
|
1076
1163
|
return !!(n && (this.debug(`
|
|
1077
|
-
>>> no match, partial?`, t, f, e, u), f ===
|
|
1164
|
+
>>> no match, partial?`, t, f, e, u), f === l));
|
|
1078
1165
|
}
|
|
1079
1166
|
let d;
|
|
1080
1167
|
if (typeof c == "string" ? (d = p === c, this.debug("string match", c, p, d)) : (d = c.test(p), this.debug("pattern match", c, p, d)), !d)
|
|
1081
1168
|
return !1;
|
|
1082
1169
|
}
|
|
1083
|
-
if (o ===
|
|
1170
|
+
if (o === l && a === h)
|
|
1084
1171
|
return !0;
|
|
1085
|
-
if (o ===
|
|
1172
|
+
if (o === l)
|
|
1086
1173
|
return n;
|
|
1087
|
-
if (a ===
|
|
1088
|
-
return o ===
|
|
1174
|
+
if (a === h)
|
|
1175
|
+
return o === l - 1 && t[o] === "";
|
|
1089
1176
|
throw new Error("wtf?");
|
|
1090
1177
|
}
|
|
1091
1178
|
braceExpand() {
|
|
1092
|
-
return
|
|
1179
|
+
return it(this.pattern, this.options);
|
|
1093
1180
|
}
|
|
1094
1181
|
parse(t) {
|
|
1095
|
-
|
|
1182
|
+
I(t);
|
|
1096
1183
|
const e = this.options;
|
|
1097
1184
|
if (t === "**")
|
|
1098
|
-
return
|
|
1185
|
+
return A;
|
|
1099
1186
|
if (t === "")
|
|
1100
1187
|
return "";
|
|
1101
|
-
let n,
|
|
1102
|
-
(n = t.match(
|
|
1103
|
-
const
|
|
1104
|
-
return
|
|
1188
|
+
let n, r = null;
|
|
1189
|
+
(n = t.match(le)) ? r = e.dot ? ue : he : (n = t.match(Qt)) ? r = (e.nocase ? e.dot ? ne : se : e.dot ? ee : te)(n[1]) : (n = t.match(fe)) ? r = (e.nocase ? e.dot ? de : pe : e.dot ? ge : me)(n) : (n = t.match(re)) ? r = e.dot ? oe : ie : (n = t.match(ce)) && (r = ae);
|
|
1190
|
+
const i = E.fromGlob(t, this.options).toMMPattern();
|
|
1191
|
+
return r && typeof i == "object" && Reflect.defineProperty(i, "test", { value: r }), i;
|
|
1105
1192
|
}
|
|
1106
1193
|
makeRe() {
|
|
1107
1194
|
if (this.regexp || this.regexp === !1)
|
|
@@ -1109,23 +1196,23 @@ globstar while`, t, f, e, u, m), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
1109
1196
|
const t = this.set;
|
|
1110
1197
|
if (!t.length)
|
|
1111
1198
|
return this.regexp = !1, this.regexp;
|
|
1112
|
-
const e = this.options, n = e.noglobstar ?
|
|
1113
|
-
let
|
|
1114
|
-
const
|
|
1199
|
+
const e = this.options, n = e.noglobstar ? Ee : e.dot ? xe : Se, r = new Set(e.nocase ? ["i"] : []);
|
|
1200
|
+
let i = t.map((l) => {
|
|
1201
|
+
const h = l.map((c) => {
|
|
1115
1202
|
if (c instanceof RegExp)
|
|
1116
1203
|
for (const p of c.flags.split(""))
|
|
1117
|
-
|
|
1118
|
-
return typeof c == "string" ?
|
|
1204
|
+
r.add(p);
|
|
1205
|
+
return typeof c == "string" ? ve(c) : c === A ? A : c._src;
|
|
1119
1206
|
});
|
|
1120
|
-
return
|
|
1121
|
-
const f =
|
|
1122
|
-
c !==
|
|
1123
|
-
}),
|
|
1207
|
+
return h.forEach((c, p) => {
|
|
1208
|
+
const f = h[p + 1], u = h[p - 1];
|
|
1209
|
+
c !== A || u === A || (u === void 0 ? f !== void 0 && f !== A ? h[p + 1] = "(?:\\/|" + n + "\\/)?" + f : h[p] = n : f === void 0 ? h[p - 1] = u + "(?:\\/|" + n + ")?" : f !== A && (h[p - 1] = u + "(?:\\/|\\/" + n + "\\/)" + f, h[p + 1] = A));
|
|
1210
|
+
}), h.filter((c) => c !== A).join("/");
|
|
1124
1211
|
}).join("|");
|
|
1125
1212
|
const [o, a] = t.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1126
|
-
|
|
1213
|
+
i = "^" + o + i + a + "$", this.negate && (i = "^(?!" + i + ").+$");
|
|
1127
1214
|
try {
|
|
1128
|
-
this.regexp = new RegExp(
|
|
1215
|
+
this.regexp = new RegExp(i, [...r].join(""));
|
|
1129
1216
|
} catch {
|
|
1130
1217
|
this.regexp = !1;
|
|
1131
1218
|
}
|
|
@@ -1143,95 +1230,95 @@ globstar while`, t, f, e, u, m), this.matchOne(t.slice(f), e.slice(u), n))
|
|
|
1143
1230
|
return !0;
|
|
1144
1231
|
const n = this.options;
|
|
1145
1232
|
this.isWindows && (t = t.split("\\").join("/"));
|
|
1146
|
-
const
|
|
1147
|
-
this.debug(this.pattern, "split",
|
|
1148
|
-
const
|
|
1149
|
-
this.debug(this.pattern, "set",
|
|
1150
|
-
let o =
|
|
1233
|
+
const r = this.slashSplit(t);
|
|
1234
|
+
this.debug(this.pattern, "split", r);
|
|
1235
|
+
const i = this.set;
|
|
1236
|
+
this.debug(this.pattern, "set", i);
|
|
1237
|
+
let o = r[r.length - 1];
|
|
1151
1238
|
if (!o)
|
|
1152
|
-
for (let a =
|
|
1153
|
-
o =
|
|
1154
|
-
for (let a = 0; a <
|
|
1155
|
-
const
|
|
1156
|
-
let
|
|
1157
|
-
if (n.matchBase &&
|
|
1239
|
+
for (let a = r.length - 2; !o && a >= 0; a--)
|
|
1240
|
+
o = r[a];
|
|
1241
|
+
for (let a = 0; a < i.length; a++) {
|
|
1242
|
+
const l = i[a];
|
|
1243
|
+
let h = r;
|
|
1244
|
+
if (n.matchBase && l.length === 1 && (h = [o]), this.matchOne(h, l, e))
|
|
1158
1245
|
return n.flipNegate ? !0 : !this.negate;
|
|
1159
1246
|
}
|
|
1160
1247
|
return n.flipNegate ? !1 : this.negate;
|
|
1161
1248
|
}
|
|
1162
1249
|
static defaults(t) {
|
|
1163
|
-
return
|
|
1250
|
+
return w.defaults(t).Minimatch;
|
|
1164
1251
|
}
|
|
1165
1252
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
function
|
|
1253
|
+
w.AST = E;
|
|
1254
|
+
w.Minimatch = D;
|
|
1255
|
+
w.escape = Kt;
|
|
1256
|
+
w.unescape = R;
|
|
1257
|
+
function Fe() {
|
|
1171
1258
|
if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
|
|
1172
|
-
throw new
|
|
1259
|
+
throw new ht();
|
|
1173
1260
|
}
|
|
1174
|
-
async function
|
|
1261
|
+
async function $e(s, t, e) {
|
|
1175
1262
|
return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/")}`, { mode: t }, e) : e();
|
|
1176
1263
|
}
|
|
1177
|
-
function
|
|
1264
|
+
function W(s) {
|
|
1178
1265
|
return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
|
|
1179
1266
|
}
|
|
1180
|
-
function
|
|
1267
|
+
function ot(s) {
|
|
1181
1268
|
return typeof s == "string" ? s ?? "/" : `/${s.join("/")}`;
|
|
1182
1269
|
}
|
|
1183
|
-
function
|
|
1184
|
-
const t =
|
|
1270
|
+
function ct(s) {
|
|
1271
|
+
const t = W(s);
|
|
1185
1272
|
return t[t.length - 1] || "";
|
|
1186
1273
|
}
|
|
1187
|
-
function
|
|
1188
|
-
const t =
|
|
1189
|
-
return t.pop(),
|
|
1274
|
+
function je(s) {
|
|
1275
|
+
const t = W(s);
|
|
1276
|
+
return t.pop(), ot(t);
|
|
1190
1277
|
}
|
|
1191
|
-
function
|
|
1278
|
+
function at(s) {
|
|
1192
1279
|
return !s || s === "/" ? "/" : s.startsWith("~/") ? `/${s.slice(2)}` : s.startsWith("/") ? s : `/${s}`;
|
|
1193
1280
|
}
|
|
1194
|
-
function
|
|
1281
|
+
function We(s, t = !1) {
|
|
1195
1282
|
return s = s.replace(/\/$/, ""), t && !s.includes("*") ? `${s}/**` : s;
|
|
1196
1283
|
}
|
|
1197
|
-
function
|
|
1198
|
-
return
|
|
1284
|
+
function Ue(s, t) {
|
|
1285
|
+
return w(s, t, {
|
|
1199
1286
|
dot: !0,
|
|
1200
1287
|
matchBase: !0
|
|
1201
1288
|
});
|
|
1202
1289
|
}
|
|
1203
|
-
function
|
|
1290
|
+
function ze(s, t) {
|
|
1204
1291
|
if (!t || Array.isArray(t) && t.length === 0)
|
|
1205
1292
|
return !1;
|
|
1206
|
-
const e =
|
|
1207
|
-
return (Array.isArray(t) ? t : [t]).some((
|
|
1293
|
+
const e = at(s);
|
|
1294
|
+
return (Array.isArray(t) ? t : [t]).some((r) => w(e, r, { dot: !0 }));
|
|
1208
1295
|
}
|
|
1209
|
-
function
|
|
1210
|
-
const t =
|
|
1211
|
-
for (const
|
|
1212
|
-
if (!(
|
|
1213
|
-
if (
|
|
1296
|
+
function Be(s) {
|
|
1297
|
+
const t = at(s), e = W(t), n = [];
|
|
1298
|
+
for (const r of e)
|
|
1299
|
+
if (!(r === "." || r === ""))
|
|
1300
|
+
if (r === "..") {
|
|
1214
1301
|
if (n.length === 0)
|
|
1215
1302
|
continue;
|
|
1216
1303
|
n.pop();
|
|
1217
1304
|
} else
|
|
1218
|
-
n.push(
|
|
1219
|
-
return
|
|
1305
|
+
n.push(r);
|
|
1306
|
+
return ot(n);
|
|
1220
1307
|
}
|
|
1221
|
-
function
|
|
1222
|
-
const t =
|
|
1308
|
+
function _e(s) {
|
|
1309
|
+
const t = ct(s), e = t.lastIndexOf(".");
|
|
1223
1310
|
return e <= 0 || e === t.length - 1 ? "" : t.slice(e);
|
|
1224
1311
|
}
|
|
1225
|
-
function
|
|
1226
|
-
return typeof s == "string" ?
|
|
1312
|
+
function qe(s, t = "utf-8") {
|
|
1313
|
+
return typeof s == "string" ? yt(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
|
|
1227
1314
|
}
|
|
1228
|
-
async function
|
|
1315
|
+
async function Ge(s, t = "SHA-1", e = 50 * 1024 * 1024) {
|
|
1229
1316
|
if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
|
|
1230
1317
|
throw new Error(`File size ${s.byteLength} bytes exceeds maximum allowed size ${e} bytes`);
|
|
1231
|
-
const n = new Uint8Array(s),
|
|
1232
|
-
return Array.from(new Uint8Array(
|
|
1318
|
+
const n = new Uint8Array(s), r = await crypto.subtle.digest(t, n);
|
|
1319
|
+
return Array.from(new Uint8Array(r)).map((o) => o.toString(16).padStart(2, "0")).join("");
|
|
1233
1320
|
}
|
|
1234
|
-
function
|
|
1321
|
+
function He(s, t) {
|
|
1235
1322
|
if (s.length !== t.length)
|
|
1236
1323
|
return !1;
|
|
1237
1324
|
for (let e = 0; e < s.length; e++)
|
|
@@ -1239,92 +1326,98 @@ function je(s, t) {
|
|
|
1239
1326
|
return !1;
|
|
1240
1327
|
return !0;
|
|
1241
1328
|
}
|
|
1242
|
-
async function
|
|
1329
|
+
async function Ve(s) {
|
|
1243
1330
|
const t = await s.arrayBuffer();
|
|
1244
1331
|
return new Uint8Array(t);
|
|
1245
1332
|
}
|
|
1246
|
-
async function
|
|
1247
|
-
const n =
|
|
1248
|
-
return
|
|
1249
|
-
const
|
|
1250
|
-
e.useTrash;
|
|
1333
|
+
async function Ye(s, t, e = {}) {
|
|
1334
|
+
const n = ct(t);
|
|
1335
|
+
return $e(t, "exclusive", async () => {
|
|
1336
|
+
const r = e.recursive ?? !1, i = e.force ?? !1;
|
|
1251
1337
|
try {
|
|
1252
|
-
await s.removeEntry(n, { recursive:
|
|
1338
|
+
await s.removeEntry(n, { recursive: r });
|
|
1253
1339
|
} catch (o) {
|
|
1254
1340
|
if (o.name === "NotFoundError") {
|
|
1255
|
-
if (!
|
|
1256
|
-
throw new
|
|
1257
|
-
} else throw o.name === "InvalidModificationError" ? new
|
|
1341
|
+
if (!i)
|
|
1342
|
+
throw new Z("file", t, o);
|
|
1343
|
+
} else throw o.name === "InvalidModificationError" ? new z("ENOTEMPTY", t, o) : o.name === "TypeMismatchError" && !r ? new k("directory", t, o) : new z("RM_FAILED", t, o);
|
|
1258
1344
|
}
|
|
1259
1345
|
});
|
|
1260
1346
|
}
|
|
1261
|
-
function
|
|
1347
|
+
function Ze(s, t, e, n) {
|
|
1262
1348
|
if (!Number.isInteger(t) || !Number.isInteger(e))
|
|
1263
|
-
throw new
|
|
1349
|
+
throw new b("argument", "Invalid offset or length");
|
|
1264
1350
|
if (t < 0 || e < 0)
|
|
1265
|
-
throw new
|
|
1351
|
+
throw new b("argument", "Negative offset or length not allowed");
|
|
1266
1352
|
if (t + e > s)
|
|
1267
|
-
throw new
|
|
1353
|
+
throw new b("overflow", "Operation would overflow buffer");
|
|
1268
1354
|
if (n != null && (!Number.isInteger(n) || n < 0))
|
|
1269
|
-
throw new
|
|
1355
|
+
throw new b("argument", "Invalid position");
|
|
1270
1356
|
}
|
|
1271
|
-
function
|
|
1357
|
+
function Je(s, t, e) {
|
|
1272
1358
|
try {
|
|
1273
1359
|
t.flush(), t.close();
|
|
1274
1360
|
} catch (n) {
|
|
1275
1361
|
console.warn(`Warning: Failed to properly close file descriptor ${s} (${e}):`, n);
|
|
1276
1362
|
}
|
|
1277
1363
|
}
|
|
1278
|
-
function
|
|
1364
|
+
function Xe(s, t, e) {
|
|
1279
1365
|
if (s >= e)
|
|
1280
1366
|
return { isEOF: !0, actualLength: 0 };
|
|
1281
1367
|
const n = Math.min(t, e - s);
|
|
1282
1368
|
return n <= 0 ? { isEOF: !0, actualLength: 0 } : { isEOF: !1, actualLength: n };
|
|
1283
1369
|
}
|
|
1284
|
-
async function
|
|
1370
|
+
async function Ke(s, t) {
|
|
1285
1371
|
try {
|
|
1286
1372
|
return await s.createSyncAccessHandle();
|
|
1287
1373
|
} catch (e) {
|
|
1288
|
-
throw
|
|
1374
|
+
throw mt(e, { path: t, isDirectory: !1 });
|
|
1289
1375
|
}
|
|
1290
1376
|
}
|
|
1291
1377
|
export {
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1378
|
+
Ce as A,
|
|
1379
|
+
He as B,
|
|
1380
|
+
Ve as C,
|
|
1381
|
+
z as D,
|
|
1382
|
+
Z as E,
|
|
1383
|
+
pt as F,
|
|
1384
|
+
Ye as G,
|
|
1385
|
+
Ze as H,
|
|
1386
|
+
U as I,
|
|
1387
|
+
Je as J,
|
|
1388
|
+
Xe as K,
|
|
1389
|
+
Ke as L,
|
|
1390
|
+
wt as M,
|
|
1391
|
+
y as O,
|
|
1392
|
+
Te as P,
|
|
1393
|
+
ft as S,
|
|
1394
|
+
b as V,
|
|
1395
|
+
At as W,
|
|
1396
|
+
ht as a,
|
|
1397
|
+
ut as b,
|
|
1398
|
+
k as c,
|
|
1399
|
+
De as d,
|
|
1400
|
+
yt as e,
|
|
1401
|
+
dt as f,
|
|
1402
|
+
gt as g,
|
|
1403
|
+
Me as h,
|
|
1404
|
+
Ie as i,
|
|
1405
|
+
Re as j,
|
|
1313
1406
|
Pe as k,
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1407
|
+
Fe as l,
|
|
1408
|
+
mt as m,
|
|
1409
|
+
ot as n,
|
|
1410
|
+
ct as o,
|
|
1411
|
+
je as p,
|
|
1412
|
+
at as q,
|
|
1413
|
+
We as r,
|
|
1414
|
+
W as s,
|
|
1415
|
+
Ue as t,
|
|
1416
|
+
ze as u,
|
|
1417
|
+
Be as v,
|
|
1418
|
+
$e as w,
|
|
1419
|
+
_e as x,
|
|
1420
|
+
qe as y,
|
|
1421
|
+
Ge as z
|
|
1329
1422
|
};
|
|
1330
|
-
//# sourceMappingURL=helpers-
|
|
1423
|
+
//# sourceMappingURL=helpers-CKOebsbw.js.map
|