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