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