@jadeja/ts 1.0.0-alpha.2 → 1.0.0-alpha.4
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.
|
@@ -1,3105 +0,0 @@
|
|
|
1
|
-
import { require___vite_browser_external as e } from "../../../../../../../_virtual/__vite-browser-external.js";
|
|
2
|
-
import { posix as t, win32 as n } from "node:path";
|
|
3
|
-
import { fileURLToPath as r } from "node:url";
|
|
4
|
-
import * as i from "node:fs";
|
|
5
|
-
import { lstat as a, readdir as o, readlink as s, realpath as c } from "node:fs/promises";
|
|
6
|
-
import { EventEmitter as l } from "node:events";
|
|
7
|
-
import u from "node:stream";
|
|
8
|
-
import { StringDecoder as d } from "node:string_decoder";
|
|
9
|
-
//#region node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
|
|
10
|
-
var f = e(), p = (e, t, n) => {
|
|
11
|
-
let r = e instanceof RegExp ? m(e, n) : e, i = t instanceof RegExp ? m(t, n) : t, a = r !== null && i != null && ee(r, i, n);
|
|
12
|
-
return a && {
|
|
13
|
-
start: a[0],
|
|
14
|
-
end: a[1],
|
|
15
|
-
pre: n.slice(0, a[0]),
|
|
16
|
-
body: n.slice(a[0] + r.length, a[1]),
|
|
17
|
-
post: n.slice(a[1] + i.length)
|
|
18
|
-
};
|
|
19
|
-
}, m = (e, t) => {
|
|
20
|
-
let n = t.match(e);
|
|
21
|
-
return n ? n[0] : null;
|
|
22
|
-
}, ee = (e, t, n) => {
|
|
23
|
-
let r, i, a, o, s, c = n.indexOf(e), l = n.indexOf(t, c + 1), u = c;
|
|
24
|
-
if (c >= 0 && l > 0) {
|
|
25
|
-
if (e === t) return [c, l];
|
|
26
|
-
for (r = [], a = n.length; u >= 0 && !s;) {
|
|
27
|
-
if (u === c) r.push(u), c = n.indexOf(e, u + 1);
|
|
28
|
-
else if (r.length === 1) {
|
|
29
|
-
let e = r.pop();
|
|
30
|
-
e !== void 0 && (s = [e, l]);
|
|
31
|
-
} else i = r.pop(), i !== void 0 && i < a && (a = i, o = l), l = n.indexOf(t, u + 1);
|
|
32
|
-
u = c < l && c >= 0 ? c : l;
|
|
33
|
-
}
|
|
34
|
-
r.length && o !== void 0 && (s = [a, o]);
|
|
35
|
-
}
|
|
36
|
-
return s;
|
|
37
|
-
}, h = "\0SLASH" + Math.random() + "\0", g = "\0OPEN" + Math.random() + "\0", _ = "\0CLOSE" + Math.random() + "\0", v = "\0COMMA" + Math.random() + "\0", te = "\0PERIOD" + Math.random() + "\0", ne = new RegExp(h, "g"), re = new RegExp(g, "g"), ie = new RegExp(_, "g"), ae = new RegExp(v, "g"), oe = new RegExp(te, "g"), se = /\\\\/g, ce = /\\{/g, le = /\\}/g, ue = /\\,/g, de = /\\./g, fe = 1e5;
|
|
38
|
-
function pe(e) {
|
|
39
|
-
return isNaN(e) ? e.charCodeAt(0) : parseInt(e, 10);
|
|
40
|
-
}
|
|
41
|
-
function me(e) {
|
|
42
|
-
return e.replace(se, h).replace(ce, g).replace(le, _).replace(ue, v).replace(de, te);
|
|
43
|
-
}
|
|
44
|
-
function he(e) {
|
|
45
|
-
return e.replace(ne, "\\").replace(re, "{").replace(ie, "}").replace(ae, ",").replace(oe, ".");
|
|
46
|
-
}
|
|
47
|
-
function ge(e) {
|
|
48
|
-
if (!e) return [""];
|
|
49
|
-
let t = [], n = p("{", "}", e);
|
|
50
|
-
if (!n) return e.split(",");
|
|
51
|
-
let { pre: r, body: i, post: a } = n, o = r.split(",");
|
|
52
|
-
o[o.length - 1] += "{" + i + "}";
|
|
53
|
-
let s = ge(a);
|
|
54
|
-
return a.length && (o[o.length - 1] += s.shift(), o.push.apply(o, s)), t.push.apply(t, o), t;
|
|
55
|
-
}
|
|
56
|
-
function _e(e, t = {}) {
|
|
57
|
-
if (!e) return [];
|
|
58
|
-
let { max: n = fe } = t;
|
|
59
|
-
return e.slice(0, 2) === "{}" && (e = "\\{\\}" + e.slice(2)), y(me(e), n, !0).map(he);
|
|
60
|
-
}
|
|
61
|
-
function ve(e) {
|
|
62
|
-
return "{" + e + "}";
|
|
63
|
-
}
|
|
64
|
-
function ye(e) {
|
|
65
|
-
return /^-?0\d/.test(e);
|
|
66
|
-
}
|
|
67
|
-
function be(e, t) {
|
|
68
|
-
return e <= t;
|
|
69
|
-
}
|
|
70
|
-
function xe(e, t) {
|
|
71
|
-
return e >= t;
|
|
72
|
-
}
|
|
73
|
-
function y(e, t, n) {
|
|
74
|
-
let r = [], i = p("{", "}", e);
|
|
75
|
-
if (!i) return [e];
|
|
76
|
-
let a = i.pre, o = i.post.length ? y(i.post, t, !1) : [""];
|
|
77
|
-
if (/\$$/.test(i.pre)) for (let e = 0; e < o.length && e < t; e++) {
|
|
78
|
-
let t = a + "{" + i.body + "}" + o[e];
|
|
79
|
-
r.push(t);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
let s = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), c = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = s || c, u = i.body.indexOf(",") >= 0;
|
|
83
|
-
if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (e = i.pre + "{" + i.body + _ + i.post, y(e, t, !0)) : [e];
|
|
84
|
-
let d;
|
|
85
|
-
if (l) d = i.body.split(/\.\./);
|
|
86
|
-
else if (d = ge(i.body), d.length === 1 && d[0] !== void 0 && (d = y(d[0], t, !1).map(ve), d.length === 1)) return o.map((e) => i.pre + d[0] + e);
|
|
87
|
-
let f;
|
|
88
|
-
if (l && d[0] !== void 0 && d[1] !== void 0) {
|
|
89
|
-
let e = pe(d[0]), t = pe(d[1]), n = Math.max(d[0].length, d[1].length), r = d.length === 3 && d[2] !== void 0 ? Math.abs(pe(d[2])) : 1, i = be;
|
|
90
|
-
t < e && (r *= -1, i = xe);
|
|
91
|
-
let a = d.some(ye);
|
|
92
|
-
f = [];
|
|
93
|
-
for (let o = e; i(o, t); o += r) {
|
|
94
|
-
let e;
|
|
95
|
-
if (c) e = String.fromCharCode(o), e === "\\" && (e = "");
|
|
96
|
-
else if (e = String(o), a) {
|
|
97
|
-
let t = n - e.length;
|
|
98
|
-
if (t > 0) {
|
|
99
|
-
let n = Array(t + 1).join("0");
|
|
100
|
-
e = o < 0 ? "-" + n + e.slice(1) : n + e;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
f.push(e);
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
f = [];
|
|
107
|
-
for (let e = 0; e < d.length; e++) f.push.apply(f, y(d[e], t, !1));
|
|
108
|
-
}
|
|
109
|
-
for (let e = 0; e < f.length; e++) for (let i = 0; i < o.length && r.length < t; i++) {
|
|
110
|
-
let t = a + f[e] + o[i];
|
|
111
|
-
(!n || l || t) && r.push(t);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return r;
|
|
115
|
-
}
|
|
116
|
-
var Se = (e) => {
|
|
117
|
-
if (typeof e != "string") throw TypeError("invalid pattern");
|
|
118
|
-
if (e.length > 65536) throw TypeError("pattern is too long");
|
|
119
|
-
}, Ce = {
|
|
120
|
-
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
121
|
-
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
122
|
-
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
123
|
-
"[:blank:]": ["\\p{Zs}\\t", !0],
|
|
124
|
-
"[:cntrl:]": ["\\p{Cc}", !0],
|
|
125
|
-
"[:digit:]": ["\\p{Nd}", !0],
|
|
126
|
-
"[:graph:]": [
|
|
127
|
-
"\\p{Z}\\p{C}",
|
|
128
|
-
!0,
|
|
129
|
-
!0
|
|
130
|
-
],
|
|
131
|
-
"[:lower:]": ["\\p{Ll}", !0],
|
|
132
|
-
"[:print:]": ["\\p{C}", !0],
|
|
133
|
-
"[:punct:]": ["\\p{P}", !0],
|
|
134
|
-
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
|
|
135
|
-
"[:upper:]": ["\\p{Lu}", !0],
|
|
136
|
-
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
137
|
-
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
138
|
-
}, b = (e) => e.replace(/[[\]\\-]/g, "\\$&"), we = (e) => e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Te = (e) => e.join(""), Ee = (e, t) => {
|
|
139
|
-
let n = t;
|
|
140
|
-
if (e.charAt(n) !== "[") throw Error("not in a brace expression");
|
|
141
|
-
let r = [], i = [], a = n + 1, o = !1, s = !1, c = !1, l = !1, u = n, d = "";
|
|
142
|
-
t: for (; a < e.length;) {
|
|
143
|
-
let t = e.charAt(a);
|
|
144
|
-
if ((t === "!" || t === "^") && a === n + 1) {
|
|
145
|
-
l = !0, a++;
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
if (t === "]" && o && !c) {
|
|
149
|
-
u = a + 1;
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
if (o = !0, t === "\\" && !c) {
|
|
153
|
-
c = !0, a++;
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
if (t === "[" && !c) {
|
|
157
|
-
for (let [t, [o, c, l]] of Object.entries(Ce)) if (e.startsWith(t, a)) {
|
|
158
|
-
if (d) return [
|
|
159
|
-
"$.",
|
|
160
|
-
!1,
|
|
161
|
-
e.length - n,
|
|
162
|
-
!0
|
|
163
|
-
];
|
|
164
|
-
a += t.length, l ? i.push(o) : r.push(o), s ||= c;
|
|
165
|
-
continue t;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (c = !1, d) {
|
|
169
|
-
t > d ? r.push(b(d) + "-" + b(t)) : t === d && r.push(b(t)), d = "", a++;
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
if (e.startsWith("-]", a + 1)) {
|
|
173
|
-
r.push(b(t + "-")), a += 2;
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
if (e.startsWith("-", a + 1)) {
|
|
177
|
-
d = t, a += 2;
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
r.push(b(t)), a++;
|
|
181
|
-
}
|
|
182
|
-
if (u < a) return [
|
|
183
|
-
"",
|
|
184
|
-
!1,
|
|
185
|
-
0,
|
|
186
|
-
!1
|
|
187
|
-
];
|
|
188
|
-
if (!r.length && !i.length) return [
|
|
189
|
-
"$.",
|
|
190
|
-
!1,
|
|
191
|
-
e.length - n,
|
|
192
|
-
!0
|
|
193
|
-
];
|
|
194
|
-
if (i.length === 0 && r.length === 1 && /^\\?.$/.test(r[0]) && !l) return [
|
|
195
|
-
we(r[0].length === 2 ? r[0].slice(-1) : r[0]),
|
|
196
|
-
!1,
|
|
197
|
-
u - n,
|
|
198
|
-
!1
|
|
199
|
-
];
|
|
200
|
-
let f = "[" + (l ? "^" : "") + Te(r) + "]", p = "[" + (l ? "" : "^") + Te(i) + "]";
|
|
201
|
-
return [
|
|
202
|
-
r.length && i.length ? "(" + f + "|" + p + ")" : r.length ? f : p,
|
|
203
|
-
s,
|
|
204
|
-
u - n,
|
|
205
|
-
!0
|
|
206
|
-
];
|
|
207
|
-
}, x = (e, { windowsPathsNoEscape: t = !1, magicalBraces: n = !0 } = {}) => n ? t ? e.replace(/\[([^\/\\])\]/g, "$1") : e.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? e.replace(/\[([^\/\\{}])\]/g, "$1") : e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1"), De = new Set([
|
|
208
|
-
"!",
|
|
209
|
-
"?",
|
|
210
|
-
"+",
|
|
211
|
-
"*",
|
|
212
|
-
"@"
|
|
213
|
-
]), Oe = (e) => De.has(e), ke = "(?!(?:^|/)\\.\\.?(?:$|/))", Ae = "(?!\\.)", je = new Set(["[", "."]), Me = new Set(["..", "."]), Ne = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), Pe = (e) => e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Fe = "[^/]", Ie = Fe + "*?", Le = Fe + "+?", Re = class e {
|
|
214
|
-
type;
|
|
215
|
-
#e;
|
|
216
|
-
#t;
|
|
217
|
-
#n = !1;
|
|
218
|
-
#r = [];
|
|
219
|
-
#i;
|
|
220
|
-
#a;
|
|
221
|
-
#o;
|
|
222
|
-
#s = !1;
|
|
223
|
-
#c;
|
|
224
|
-
#l;
|
|
225
|
-
#u = !1;
|
|
226
|
-
constructor(e, t, n = {}) {
|
|
227
|
-
this.type = e, e && (this.#t = !0), this.#i = t, this.#e = this.#i ? this.#i.#e : this, this.#c = this.#e === this ? n : this.#e.#c, this.#o = this.#e === this ? [] : this.#e.#o, e === "!" && !this.#e.#s && this.#o.push(this), this.#a = this.#i ? this.#i.#r.length : 0;
|
|
228
|
-
}
|
|
229
|
-
get hasMagic() {
|
|
230
|
-
if (this.#t !== void 0) return this.#t;
|
|
231
|
-
for (let e of this.#r) if (typeof e != "string" && (e.type || e.hasMagic)) return this.#t = !0;
|
|
232
|
-
return this.#t;
|
|
233
|
-
}
|
|
234
|
-
toString() {
|
|
235
|
-
return this.#l === void 0 ? this.type ? this.#l = this.type + "(" + this.#r.map((e) => String(e)).join("|") + ")" : this.#l = this.#r.map((e) => String(e)).join("") : this.#l;
|
|
236
|
-
}
|
|
237
|
-
#d() {
|
|
238
|
-
if (this !== this.#e) throw Error("should only call on root");
|
|
239
|
-
if (this.#s) return this;
|
|
240
|
-
this.toString(), this.#s = !0;
|
|
241
|
-
let e;
|
|
242
|
-
for (; e = this.#o.pop();) {
|
|
243
|
-
if (e.type !== "!") continue;
|
|
244
|
-
let t = e, n = t.#i;
|
|
245
|
-
for (; n;) {
|
|
246
|
-
for (let r = t.#a + 1; !n.type && r < n.#r.length; r++) for (let t of e.#r) {
|
|
247
|
-
if (typeof t == "string") throw Error("string part in extglob AST??");
|
|
248
|
-
t.copyIn(n.#r[r]);
|
|
249
|
-
}
|
|
250
|
-
t = n, n = t.#i;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return this;
|
|
254
|
-
}
|
|
255
|
-
push(...t) {
|
|
256
|
-
for (let n of t) if (n !== "") {
|
|
257
|
-
if (typeof n != "string" && !(n instanceof e && n.#i === this)) throw Error("invalid part: " + n);
|
|
258
|
-
this.#r.push(n);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
toJSON() {
|
|
262
|
-
let e = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
|
|
263
|
-
return this.isStart() && !this.type && e.unshift([]), this.isEnd() && (this === this.#e || this.#e.#s && this.#i?.type === "!") && e.push({}), e;
|
|
264
|
-
}
|
|
265
|
-
isStart() {
|
|
266
|
-
if (this.#e === this) return !0;
|
|
267
|
-
if (!this.#i?.isStart()) return !1;
|
|
268
|
-
if (this.#a === 0) return !0;
|
|
269
|
-
let t = this.#i;
|
|
270
|
-
for (let n = 0; n < this.#a; n++) {
|
|
271
|
-
let r = t.#r[n];
|
|
272
|
-
if (!(r instanceof e && r.type === "!")) return !1;
|
|
273
|
-
}
|
|
274
|
-
return !0;
|
|
275
|
-
}
|
|
276
|
-
isEnd() {
|
|
277
|
-
if (this.#e === this || this.#i?.type === "!") return !0;
|
|
278
|
-
if (!this.#i?.isEnd()) return !1;
|
|
279
|
-
if (!this.type) return this.#i?.isEnd();
|
|
280
|
-
let e = this.#i ? this.#i.#r.length : 0;
|
|
281
|
-
return this.#a === e - 1;
|
|
282
|
-
}
|
|
283
|
-
copyIn(e) {
|
|
284
|
-
typeof e == "string" ? this.push(e) : this.push(e.clone(this));
|
|
285
|
-
}
|
|
286
|
-
clone(t) {
|
|
287
|
-
let n = new e(this.type, t);
|
|
288
|
-
for (let e of this.#r) n.copyIn(e);
|
|
289
|
-
return n;
|
|
290
|
-
}
|
|
291
|
-
static #f(t, n, r, i) {
|
|
292
|
-
let a = !1, o = !1, s = -1, c = !1;
|
|
293
|
-
if (n.type === null) {
|
|
294
|
-
let l = r, u = "";
|
|
295
|
-
for (; l < t.length;) {
|
|
296
|
-
let r = t.charAt(l++);
|
|
297
|
-
if (a || r === "\\") {
|
|
298
|
-
a = !a, u += r;
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
if (o) {
|
|
302
|
-
l === s + 1 ? (r === "^" || r === "!") && (c = !0) : r === "]" && !(l === s + 2 && c) && (o = !1), u += r;
|
|
303
|
-
continue;
|
|
304
|
-
} else if (r === "[") {
|
|
305
|
-
o = !0, s = l, c = !1, u += r;
|
|
306
|
-
continue;
|
|
307
|
-
}
|
|
308
|
-
if (!i.noext && Oe(r) && t.charAt(l) === "(") {
|
|
309
|
-
n.push(u), u = "";
|
|
310
|
-
let a = new e(r, n);
|
|
311
|
-
l = e.#f(t, a, l, i), n.push(a);
|
|
312
|
-
continue;
|
|
313
|
-
}
|
|
314
|
-
u += r;
|
|
315
|
-
}
|
|
316
|
-
return n.push(u), l;
|
|
317
|
-
}
|
|
318
|
-
let l = r + 1, u = new e(null, n), d = [], f = "";
|
|
319
|
-
for (; l < t.length;) {
|
|
320
|
-
let r = t.charAt(l++);
|
|
321
|
-
if (a || r === "\\") {
|
|
322
|
-
a = !a, f += r;
|
|
323
|
-
continue;
|
|
324
|
-
}
|
|
325
|
-
if (o) {
|
|
326
|
-
l === s + 1 ? (r === "^" || r === "!") && (c = !0) : r === "]" && !(l === s + 2 && c) && (o = !1), f += r;
|
|
327
|
-
continue;
|
|
328
|
-
} else if (r === "[") {
|
|
329
|
-
o = !0, s = l, c = !1, f += r;
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
if (Oe(r) && t.charAt(l) === "(") {
|
|
333
|
-
u.push(f), f = "";
|
|
334
|
-
let n = new e(r, u);
|
|
335
|
-
u.push(n), l = e.#f(t, n, l, i);
|
|
336
|
-
continue;
|
|
337
|
-
}
|
|
338
|
-
if (r === "|") {
|
|
339
|
-
u.push(f), f = "", d.push(u), u = new e(null, n);
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
if (r === ")") return f === "" && n.#r.length === 0 && (n.#u = !0), u.push(f), f = "", n.push(...d, u), l;
|
|
343
|
-
f += r;
|
|
344
|
-
}
|
|
345
|
-
return n.type = null, n.#t = void 0, n.#r = [t.substring(r - 1)], l;
|
|
346
|
-
}
|
|
347
|
-
static fromGlob(t, n = {}) {
|
|
348
|
-
let r = new e(null, void 0, n);
|
|
349
|
-
return e.#f(t, r, 0, n), r;
|
|
350
|
-
}
|
|
351
|
-
toMMPattern() {
|
|
352
|
-
if (this !== this.#e) return this.#e.toMMPattern();
|
|
353
|
-
let e = this.toString(), [t, n, r, i] = this.toRegExpSource();
|
|
354
|
-
if (!(r || this.#t || this.#c.nocase && !this.#c.nocaseMagicOnly && e.toUpperCase() !== e.toLowerCase())) return n;
|
|
355
|
-
let a = (this.#c.nocase ? "i" : "") + (i ? "u" : "");
|
|
356
|
-
return Object.assign(RegExp(`^${t}$`, a), {
|
|
357
|
-
_src: t,
|
|
358
|
-
_glob: e
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
get options() {
|
|
362
|
-
return this.#c;
|
|
363
|
-
}
|
|
364
|
-
toRegExpSource(t) {
|
|
365
|
-
let n = t ?? !!this.#c.dot;
|
|
366
|
-
if (this.#e === this && this.#d(), !this.type) {
|
|
367
|
-
let r = this.isStart() && this.isEnd() && !this.#r.some((e) => typeof e != "string"), i = this.#r.map((n) => {
|
|
368
|
-
let [i, a, o, s] = typeof n == "string" ? e.#m(n, this.#t, r) : n.toRegExpSource(t);
|
|
369
|
-
return this.#t = this.#t || o, this.#n = this.#n || s, i;
|
|
370
|
-
}).join(""), a = "";
|
|
371
|
-
if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Me.has(this.#r[0]))) {
|
|
372
|
-
let e = je, r = n && e.has(i.charAt(0)) || i.startsWith("\\.") && e.has(i.charAt(2)) || i.startsWith("\\.\\.") && e.has(i.charAt(4)), o = !n && !t && e.has(i.charAt(0));
|
|
373
|
-
a = r ? ke : o ? Ae : "";
|
|
374
|
-
}
|
|
375
|
-
let o = "";
|
|
376
|
-
return this.isEnd() && this.#e.#s && this.#i?.type === "!" && (o = "(?:$|\\/)"), [
|
|
377
|
-
a + i + o,
|
|
378
|
-
x(i),
|
|
379
|
-
this.#t = !!this.#t,
|
|
380
|
-
this.#n
|
|
381
|
-
];
|
|
382
|
-
}
|
|
383
|
-
let r = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", a = this.#p(n);
|
|
384
|
-
if (this.isStart() && this.isEnd() && !a && this.type !== "!") {
|
|
385
|
-
let e = this.toString();
|
|
386
|
-
return this.#r = [e], this.type = null, this.#t = void 0, [
|
|
387
|
-
e,
|
|
388
|
-
x(this.toString()),
|
|
389
|
-
!1,
|
|
390
|
-
!1
|
|
391
|
-
];
|
|
392
|
-
}
|
|
393
|
-
let o = !r || t || n || !Ae ? "" : this.#p(!0);
|
|
394
|
-
o === a && (o = ""), o && (a = `(?:${a})(?:${o})*?`);
|
|
395
|
-
let s = "";
|
|
396
|
-
if (this.type === "!" && this.#u) s = (this.isStart() && !n ? Ae : "") + Le;
|
|
397
|
-
else {
|
|
398
|
-
let e = this.type === "!" ? "))" + (this.isStart() && !n && !t ? Ae : "") + Ie + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
399
|
-
s = i + a + e;
|
|
400
|
-
}
|
|
401
|
-
return [
|
|
402
|
-
s,
|
|
403
|
-
x(a),
|
|
404
|
-
this.#t = !!this.#t,
|
|
405
|
-
this.#n
|
|
406
|
-
];
|
|
407
|
-
}
|
|
408
|
-
#p(e) {
|
|
409
|
-
return this.#r.map((t) => {
|
|
410
|
-
if (typeof t == "string") throw Error("string type in extglob ast??");
|
|
411
|
-
let [n, r, i, a] = t.toRegExpSource(e);
|
|
412
|
-
return this.#n = this.#n || a, n;
|
|
413
|
-
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
414
|
-
}
|
|
415
|
-
static #m(e, t, n = !1) {
|
|
416
|
-
let r = !1, i = "", a = !1, o = !1;
|
|
417
|
-
for (let s = 0; s < e.length; s++) {
|
|
418
|
-
let c = e.charAt(s);
|
|
419
|
-
if (r) {
|
|
420
|
-
r = !1, i += (Ne.has(c) ? "\\" : "") + c;
|
|
421
|
-
continue;
|
|
422
|
-
}
|
|
423
|
-
if (c === "*") {
|
|
424
|
-
if (o) continue;
|
|
425
|
-
o = !0, i += n && /^[*]+$/.test(e) ? Le : Ie, t = !0;
|
|
426
|
-
continue;
|
|
427
|
-
} else o = !1;
|
|
428
|
-
if (c === "\\") {
|
|
429
|
-
s === e.length - 1 ? i += "\\\\" : r = !0;
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
if (c === "[") {
|
|
433
|
-
let [n, r, o, c] = Ee(e, s);
|
|
434
|
-
if (o) {
|
|
435
|
-
i += n, a ||= r, s += o - 1, t ||= c;
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
if (c === "?") {
|
|
440
|
-
i += Fe, t = !0;
|
|
441
|
-
continue;
|
|
442
|
-
}
|
|
443
|
-
i += Pe(c);
|
|
444
|
-
}
|
|
445
|
-
return [
|
|
446
|
-
i,
|
|
447
|
-
x(e),
|
|
448
|
-
!!t,
|
|
449
|
-
a
|
|
450
|
-
];
|
|
451
|
-
}
|
|
452
|
-
}, ze = (e, { windowsPathsNoEscape: t = !1, magicalBraces: n = !1 } = {}) => n ? t ? e.replace(/[?*()[\]{}]/g, "[$&]") : e.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? e.replace(/[?*()[\]]/g, "[$&]") : e.replace(/[?*()[\]\\]/g, "\\$&"), S = (e, t, n = {}) => (Se(t), !n.nocomment && t.charAt(0) === "#" ? !1 : new T(t, n).match(e)), Be = /^\*+([^+@!?\*\[\(]*)$/, Ve = (e) => (t) => !t.startsWith(".") && t.endsWith(e), He = (e) => (t) => t.endsWith(e), Ue = (e) => (e = e.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(e)), We = (e) => (e = e.toLowerCase(), (t) => t.toLowerCase().endsWith(e)), Ge = /^\*+\.\*+$/, Ke = (e) => !e.startsWith(".") && e.includes("."), qe = (e) => e !== "." && e !== ".." && e.includes("."), Je = /^\.\*+$/, Ye = (e) => e !== "." && e !== ".." && e.startsWith("."), Xe = /^\*+$/, Ze = (e) => e.length !== 0 && !e.startsWith("."), Qe = (e) => e.length !== 0 && e !== "." && e !== "..", $e = /^\?+([^+@!?\*\[\(]*)?$/, et = ([e, t = ""]) => {
|
|
453
|
-
let n = it([e]);
|
|
454
|
-
return t ? (t = t.toLowerCase(), (e) => n(e) && e.toLowerCase().endsWith(t)) : n;
|
|
455
|
-
}, tt = ([e, t = ""]) => {
|
|
456
|
-
let n = at([e]);
|
|
457
|
-
return t ? (t = t.toLowerCase(), (e) => n(e) && e.toLowerCase().endsWith(t)) : n;
|
|
458
|
-
}, nt = ([e, t = ""]) => {
|
|
459
|
-
let n = at([e]);
|
|
460
|
-
return t ? (e) => n(e) && e.endsWith(t) : n;
|
|
461
|
-
}, rt = ([e, t = ""]) => {
|
|
462
|
-
let n = it([e]);
|
|
463
|
-
return t ? (e) => n(e) && e.endsWith(t) : n;
|
|
464
|
-
}, it = ([e]) => {
|
|
465
|
-
let t = e.length;
|
|
466
|
-
return (e) => e.length === t && !e.startsWith(".");
|
|
467
|
-
}, at = ([e]) => {
|
|
468
|
-
let t = e.length;
|
|
469
|
-
return (e) => e.length === t && e !== "." && e !== "..";
|
|
470
|
-
}, ot = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", st = {
|
|
471
|
-
win32: { sep: "\\" },
|
|
472
|
-
posix: { sep: "/" }
|
|
473
|
-
};
|
|
474
|
-
S.sep = ot === "win32" ? st.win32.sep : st.posix.sep;
|
|
475
|
-
var C = Symbol("globstar **");
|
|
476
|
-
S.GLOBSTAR = C;
|
|
477
|
-
var ct = "[^/]*?", lt = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", ut = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
478
|
-
S.filter = (e, t = {}) => (n) => S(n, e, t);
|
|
479
|
-
var w = (e, t = {}) => Object.assign({}, e, t);
|
|
480
|
-
S.defaults = (e) => {
|
|
481
|
-
if (!e || typeof e != "object" || !Object.keys(e).length) return S;
|
|
482
|
-
let t = S;
|
|
483
|
-
return Object.assign((n, r, i = {}) => t(n, r, w(e, i)), {
|
|
484
|
-
Minimatch: class extends t.Minimatch {
|
|
485
|
-
constructor(t, n = {}) {
|
|
486
|
-
super(t, w(e, n));
|
|
487
|
-
}
|
|
488
|
-
static defaults(n) {
|
|
489
|
-
return t.defaults(w(e, n)).Minimatch;
|
|
490
|
-
}
|
|
491
|
-
},
|
|
492
|
-
AST: class extends t.AST {
|
|
493
|
-
constructor(t, n, r = {}) {
|
|
494
|
-
super(t, n, w(e, r));
|
|
495
|
-
}
|
|
496
|
-
static fromGlob(n, r = {}) {
|
|
497
|
-
return t.AST.fromGlob(n, w(e, r));
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
unescape: (n, r = {}) => t.unescape(n, w(e, r)),
|
|
501
|
-
escape: (n, r = {}) => t.escape(n, w(e, r)),
|
|
502
|
-
filter: (n, r = {}) => t.filter(n, w(e, r)),
|
|
503
|
-
defaults: (n) => t.defaults(w(e, n)),
|
|
504
|
-
makeRe: (n, r = {}) => t.makeRe(n, w(e, r)),
|
|
505
|
-
braceExpand: (n, r = {}) => t.braceExpand(n, w(e, r)),
|
|
506
|
-
match: (n, r, i = {}) => t.match(n, r, w(e, i)),
|
|
507
|
-
sep: t.sep,
|
|
508
|
-
GLOBSTAR: C
|
|
509
|
-
});
|
|
510
|
-
};
|
|
511
|
-
var dt = (e, t = {}) => (Se(e), t.nobrace || !/\{(?:(?!\{).)*\}/.test(e) ? [e] : _e(e, { max: t.braceExpandMax }));
|
|
512
|
-
S.braceExpand = dt, S.makeRe = (e, t = {}) => new T(e, t).makeRe(), S.match = (e, t, n = {}) => {
|
|
513
|
-
let r = new T(t, n);
|
|
514
|
-
return e = e.filter((e) => r.match(e)), r.options.nonull && !e.length && e.push(t), e;
|
|
515
|
-
};
|
|
516
|
-
var ft = /[?*]|[+@!]\(.*?\)|\[|\]/, pt = (e) => e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), T = class {
|
|
517
|
-
options;
|
|
518
|
-
set;
|
|
519
|
-
pattern;
|
|
520
|
-
windowsPathsNoEscape;
|
|
521
|
-
nonegate;
|
|
522
|
-
negate;
|
|
523
|
-
comment;
|
|
524
|
-
empty;
|
|
525
|
-
preserveMultipleSlashes;
|
|
526
|
-
partial;
|
|
527
|
-
globSet;
|
|
528
|
-
globParts;
|
|
529
|
-
nocase;
|
|
530
|
-
isWindows;
|
|
531
|
-
platform;
|
|
532
|
-
windowsNoMagicRoot;
|
|
533
|
-
regexp;
|
|
534
|
-
constructor(e, t = {}) {
|
|
535
|
-
Se(e), t ||= {}, this.options = t, this.pattern = e, this.platform = t.platform || ot, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!t.windowsPathsNoEscape || t.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!t.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!t.nonegate, this.comment = !1, this.empty = !1, this.partial = !!t.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = t.windowsNoMagicRoot === void 0 ? !!(this.isWindows && this.nocase) : t.windowsNoMagicRoot, this.globSet = [], this.globParts = [], this.set = [], this.make();
|
|
536
|
-
}
|
|
537
|
-
hasMagic() {
|
|
538
|
-
if (this.options.magicalBraces && this.set.length > 1) return !0;
|
|
539
|
-
for (let e of this.set) for (let t of e) if (typeof t != "string") return !0;
|
|
540
|
-
return !1;
|
|
541
|
-
}
|
|
542
|
-
debug(...e) {}
|
|
543
|
-
make() {
|
|
544
|
-
let e = this.pattern, t = this.options;
|
|
545
|
-
if (!t.nocomment && e.charAt(0) === "#") {
|
|
546
|
-
this.comment = !0;
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
if (!e) {
|
|
550
|
-
this.empty = !0;
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], t.debug && (this.debug = (...e) => console.error(...e)), this.debug(this.pattern, this.globSet);
|
|
554
|
-
let n = this.globSet.map((e) => this.slashSplit(e));
|
|
555
|
-
this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
|
|
556
|
-
let r = this.globParts.map((e, t, n) => {
|
|
557
|
-
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
558
|
-
let t = e[0] === "" && e[1] === "" && (e[2] === "?" || !ft.test(e[2])) && !ft.test(e[3]), n = /^[a-z]:/i.test(e[0]);
|
|
559
|
-
if (t) return [...e.slice(0, 4), ...e.slice(4).map((e) => this.parse(e))];
|
|
560
|
-
if (n) return [e[0], ...e.slice(1).map((e) => this.parse(e))];
|
|
561
|
-
}
|
|
562
|
-
return e.map((e) => this.parse(e));
|
|
563
|
-
});
|
|
564
|
-
if (this.debug(this.pattern, r), this.set = r.filter((e) => e.indexOf(!1) === -1), this.isWindows) for (let e = 0; e < this.set.length; e++) {
|
|
565
|
-
let t = this.set[e];
|
|
566
|
-
t[0] === "" && t[1] === "" && this.globParts[e][2] === "?" && typeof t[3] == "string" && /^[a-z]:$/i.test(t[3]) && (t[2] = "?");
|
|
567
|
-
}
|
|
568
|
-
this.debug(this.pattern, this.set);
|
|
569
|
-
}
|
|
570
|
-
preprocess(e) {
|
|
571
|
-
if (this.options.noglobstar) for (let t = 0; t < e.length; t++) for (let n = 0; n < e[t].length; n++) e[t][n] === "**" && (e[t][n] = "*");
|
|
572
|
-
let { optimizationLevel: t = 1 } = this.options;
|
|
573
|
-
return t >= 2 ? (e = this.firstPhasePreProcess(e), e = this.secondPhasePreProcess(e)) : e = t >= 1 ? this.levelOneOptimize(e) : this.adjascentGlobstarOptimize(e), e;
|
|
574
|
-
}
|
|
575
|
-
adjascentGlobstarOptimize(e) {
|
|
576
|
-
return e.map((e) => {
|
|
577
|
-
let t = -1;
|
|
578
|
-
for (; (t = e.indexOf("**", t + 1)) !== -1;) {
|
|
579
|
-
let n = t;
|
|
580
|
-
for (; e[n + 1] === "**";) n++;
|
|
581
|
-
n !== t && e.splice(t, n - t);
|
|
582
|
-
}
|
|
583
|
-
return e;
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
levelOneOptimize(e) {
|
|
587
|
-
return e.map((e) => (e = e.reduce((e, t) => {
|
|
588
|
-
let n = e[e.length - 1];
|
|
589
|
-
return t === "**" && n === "**" ? e : t === ".." && n && n !== ".." && n !== "." && n !== "**" ? (e.pop(), e) : (e.push(t), e);
|
|
590
|
-
}, []), e.length === 0 ? [""] : e));
|
|
591
|
-
}
|
|
592
|
-
levelTwoFileOptimize(e) {
|
|
593
|
-
Array.isArray(e) || (e = this.slashSplit(e));
|
|
594
|
-
let t = !1;
|
|
595
|
-
do {
|
|
596
|
-
if (t = !1, !this.preserveMultipleSlashes) {
|
|
597
|
-
for (let n = 1; n < e.length - 1; n++) {
|
|
598
|
-
let r = e[n];
|
|
599
|
-
n === 1 && r === "" && e[0] === "" || (r === "." || r === "") && (t = !0, e.splice(n, 1), n--);
|
|
600
|
-
}
|
|
601
|
-
e[0] === "." && e.length === 2 && (e[1] === "." || e[1] === "") && (t = !0, e.pop());
|
|
602
|
-
}
|
|
603
|
-
let n = 0;
|
|
604
|
-
for (; (n = e.indexOf("..", n + 1)) !== -1;) {
|
|
605
|
-
let r = e[n - 1];
|
|
606
|
-
r && r !== "." && r !== ".." && r !== "**" && (t = !0, e.splice(n - 1, 2), n -= 2);
|
|
607
|
-
}
|
|
608
|
-
} while (t);
|
|
609
|
-
return e.length === 0 ? [""] : e;
|
|
610
|
-
}
|
|
611
|
-
firstPhasePreProcess(e) {
|
|
612
|
-
let t = !1;
|
|
613
|
-
do {
|
|
614
|
-
t = !1;
|
|
615
|
-
for (let n of e) {
|
|
616
|
-
let r = -1;
|
|
617
|
-
for (; (r = n.indexOf("**", r + 1)) !== -1;) {
|
|
618
|
-
let i = r;
|
|
619
|
-
for (; n[i + 1] === "**";) i++;
|
|
620
|
-
i > r && n.splice(r + 1, i - r);
|
|
621
|
-
let a = n[r + 1], o = n[r + 2], s = n[r + 3];
|
|
622
|
-
if (a !== ".." || !o || o === "." || o === ".." || !s || s === "." || s === "..") continue;
|
|
623
|
-
t = !0, n.splice(r, 1);
|
|
624
|
-
let c = n.slice(0);
|
|
625
|
-
c[r] = "**", e.push(c), r--;
|
|
626
|
-
}
|
|
627
|
-
if (!this.preserveMultipleSlashes) {
|
|
628
|
-
for (let e = 1; e < n.length - 1; e++) {
|
|
629
|
-
let r = n[e];
|
|
630
|
-
e === 1 && r === "" && n[0] === "" || (r === "." || r === "") && (t = !0, n.splice(e, 1), e--);
|
|
631
|
-
}
|
|
632
|
-
n[0] === "." && n.length === 2 && (n[1] === "." || n[1] === "") && (t = !0, n.pop());
|
|
633
|
-
}
|
|
634
|
-
let i = 0;
|
|
635
|
-
for (; (i = n.indexOf("..", i + 1)) !== -1;) {
|
|
636
|
-
let e = n[i - 1];
|
|
637
|
-
if (e && e !== "." && e !== ".." && e !== "**") {
|
|
638
|
-
t = !0;
|
|
639
|
-
let e = i === 1 && n[i + 1] === "**" ? ["."] : [];
|
|
640
|
-
n.splice(i - 1, 2, ...e), n.length === 0 && n.push(""), i -= 2;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
} while (t);
|
|
645
|
-
return e;
|
|
646
|
-
}
|
|
647
|
-
secondPhasePreProcess(e) {
|
|
648
|
-
for (let t = 0; t < e.length - 1; t++) for (let n = t + 1; n < e.length; n++) {
|
|
649
|
-
let r = this.partsMatch(e[t], e[n], !this.preserveMultipleSlashes);
|
|
650
|
-
if (r) {
|
|
651
|
-
e[t] = [], e[n] = r;
|
|
652
|
-
break;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
return e.filter((e) => e.length);
|
|
656
|
-
}
|
|
657
|
-
partsMatch(e, t, n = !1) {
|
|
658
|
-
let r = 0, i = 0, a = [], o = "";
|
|
659
|
-
for (; r < e.length && i < t.length;) if (e[r] === t[i]) a.push(o === "b" ? t[i] : e[r]), r++, i++;
|
|
660
|
-
else if (n && e[r] === "**" && t[i] === e[r + 1]) a.push(e[r]), r++;
|
|
661
|
-
else if (n && t[i] === "**" && e[r] === t[i + 1]) a.push(t[i]), i++;
|
|
662
|
-
else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
|
|
663
|
-
if (o === "b") return !1;
|
|
664
|
-
o = "a", a.push(e[r]), r++, i++;
|
|
665
|
-
} else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
|
|
666
|
-
if (o === "a") return !1;
|
|
667
|
-
o = "b", a.push(t[i]), r++, i++;
|
|
668
|
-
} else return !1;
|
|
669
|
-
return e.length === t.length && a;
|
|
670
|
-
}
|
|
671
|
-
parseNegate() {
|
|
672
|
-
if (this.nonegate) return;
|
|
673
|
-
let e = this.pattern, t = !1, n = 0;
|
|
674
|
-
for (let r = 0; r < e.length && e.charAt(r) === "!"; r++) t = !t, n++;
|
|
675
|
-
n && (this.pattern = e.slice(n)), this.negate = t;
|
|
676
|
-
}
|
|
677
|
-
matchOne(e, t, n = !1) {
|
|
678
|
-
let r = this.options;
|
|
679
|
-
if (this.isWindows) {
|
|
680
|
-
let n = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), r = !n && e[0] === "" && e[1] === "" && e[2] === "?" && /^[a-z]:$/i.test(e[3]), i = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), a = !i && t[0] === "" && t[1] === "" && t[2] === "?" && typeof t[3] == "string" && /^[a-z]:$/i.test(t[3]), o = r ? 3 : n ? 0 : void 0, s = a ? 3 : i ? 0 : void 0;
|
|
681
|
-
if (typeof o == "number" && typeof s == "number") {
|
|
682
|
-
let [n, r] = [e[o], t[s]];
|
|
683
|
-
n.toLowerCase() === r.toLowerCase() && (t[s] = n, s > o ? t = t.slice(s) : o > s && (e = e.slice(o)));
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
let { optimizationLevel: i = 1 } = this.options;
|
|
687
|
-
i >= 2 && (e = this.levelTwoFileOptimize(e)), this.debug("matchOne", this, {
|
|
688
|
-
file: e,
|
|
689
|
-
pattern: t
|
|
690
|
-
}), this.debug("matchOne", e.length, t.length);
|
|
691
|
-
for (var a = 0, o = 0, s = e.length, c = t.length; a < s && o < c; a++, o++) {
|
|
692
|
-
this.debug("matchOne loop");
|
|
693
|
-
var l = t[o], u = e[a];
|
|
694
|
-
if (this.debug(t, l, u), l === !1) return !1;
|
|
695
|
-
if (l === C) {
|
|
696
|
-
this.debug("GLOBSTAR", [
|
|
697
|
-
t,
|
|
698
|
-
l,
|
|
699
|
-
u
|
|
700
|
-
]);
|
|
701
|
-
var d = a, f = o + 1;
|
|
702
|
-
if (f === c) {
|
|
703
|
-
for (this.debug("** at the end"); a < s; a++) if (e[a] === "." || e[a] === ".." || !r.dot && e[a].charAt(0) === ".") return !1;
|
|
704
|
-
return !0;
|
|
705
|
-
}
|
|
706
|
-
for (; d < s;) {
|
|
707
|
-
var p = e[d];
|
|
708
|
-
if (this.debug("\nglobstar while", e, d, t, f, p), this.matchOne(e.slice(d), t.slice(f), n)) return this.debug("globstar found match!", d, s, p), !0;
|
|
709
|
-
if (p === "." || p === ".." || !r.dot && p.charAt(0) === ".") {
|
|
710
|
-
this.debug("dot detected!", e, d, t, f);
|
|
711
|
-
break;
|
|
712
|
-
}
|
|
713
|
-
this.debug("globstar swallow a segment, and continue"), d++;
|
|
714
|
-
}
|
|
715
|
-
return !!(n && (this.debug("\n>>> no match, partial?", e, d, t, f), d === s));
|
|
716
|
-
}
|
|
717
|
-
let i;
|
|
718
|
-
if (typeof l == "string" ? (i = u === l, this.debug("string match", l, u, i)) : (i = l.test(u), this.debug("pattern match", l, u, i)), !i) return !1;
|
|
719
|
-
}
|
|
720
|
-
if (a === s && o === c) return !0;
|
|
721
|
-
if (a === s) return n;
|
|
722
|
-
if (o === c) return a === s - 1 && e[a] === "";
|
|
723
|
-
throw Error("wtf?");
|
|
724
|
-
}
|
|
725
|
-
braceExpand() {
|
|
726
|
-
return dt(this.pattern, this.options);
|
|
727
|
-
}
|
|
728
|
-
parse(e) {
|
|
729
|
-
Se(e);
|
|
730
|
-
let t = this.options;
|
|
731
|
-
if (e === "**") return C;
|
|
732
|
-
if (e === "") return "";
|
|
733
|
-
let n, r = null;
|
|
734
|
-
(n = e.match(Xe)) ? r = t.dot ? Qe : Ze : (n = e.match(Be)) ? r = (t.nocase ? t.dot ? We : Ue : t.dot ? He : Ve)(n[1]) : (n = e.match($e)) ? r = (t.nocase ? t.dot ? tt : et : t.dot ? nt : rt)(n) : (n = e.match(Ge)) ? r = t.dot ? qe : Ke : (n = e.match(Je)) && (r = Ye);
|
|
735
|
-
let i = Re.fromGlob(e, this.options).toMMPattern();
|
|
736
|
-
return r && typeof i == "object" && Reflect.defineProperty(i, "test", { value: r }), i;
|
|
737
|
-
}
|
|
738
|
-
makeRe() {
|
|
739
|
-
if (this.regexp || this.regexp === !1) return this.regexp;
|
|
740
|
-
let e = this.set;
|
|
741
|
-
if (!e.length) return this.regexp = !1, this.regexp;
|
|
742
|
-
let t = this.options, n = t.noglobstar ? ct : t.dot ? lt : ut, r = new Set(t.nocase ? ["i"] : []), i = e.map((e) => {
|
|
743
|
-
let t = e.map((e) => {
|
|
744
|
-
if (e instanceof RegExp) for (let t of e.flags.split("")) r.add(t);
|
|
745
|
-
return typeof e == "string" ? pt(e) : e === C ? C : e._src;
|
|
746
|
-
});
|
|
747
|
-
t.forEach((e, r) => {
|
|
748
|
-
let i = t[r + 1], a = t[r - 1];
|
|
749
|
-
e !== C || a === C || (a === void 0 ? i !== void 0 && i !== C ? t[r + 1] = "(?:\\/|" + n + "\\/)?" + i : t[r] = n : i === void 0 ? t[r - 1] = a + "(?:\\/|\\/" + n + ")?" : i !== C && (t[r - 1] = a + "(?:\\/|\\/" + n + "\\/)" + i, t[r + 1] = C));
|
|
750
|
-
});
|
|
751
|
-
let i = t.filter((e) => e !== C);
|
|
752
|
-
if (this.partial && i.length >= 1) {
|
|
753
|
-
let e = [];
|
|
754
|
-
for (let t = 1; t <= i.length; t++) e.push(i.slice(0, t).join("/"));
|
|
755
|
-
return "(?:" + e.join("|") + ")";
|
|
756
|
-
}
|
|
757
|
-
return i.join("/");
|
|
758
|
-
}).join("|"), [a, o] = e.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
759
|
-
i = "^" + a + i + o + "$", this.partial && (i = "^(?:\\/|" + a + i.slice(1, -1) + o + ")$"), this.negate && (i = "^(?!" + i + ").+$");
|
|
760
|
-
try {
|
|
761
|
-
this.regexp = new RegExp(i, [...r].join(""));
|
|
762
|
-
} catch {
|
|
763
|
-
this.regexp = !1;
|
|
764
|
-
}
|
|
765
|
-
return this.regexp;
|
|
766
|
-
}
|
|
767
|
-
slashSplit(e) {
|
|
768
|
-
return this.preserveMultipleSlashes ? e.split("/") : this.isWindows && /^\/\/[^\/]+/.test(e) ? ["", ...e.split(/\/+/)] : e.split(/\/+/);
|
|
769
|
-
}
|
|
770
|
-
match(e, t = this.partial) {
|
|
771
|
-
if (this.debug("match", e, this.pattern), this.comment) return !1;
|
|
772
|
-
if (this.empty) return e === "";
|
|
773
|
-
if (e === "/" && t) return !0;
|
|
774
|
-
let n = this.options;
|
|
775
|
-
this.isWindows && (e = e.split("\\").join("/"));
|
|
776
|
-
let r = this.slashSplit(e);
|
|
777
|
-
this.debug(this.pattern, "split", r);
|
|
778
|
-
let i = this.set;
|
|
779
|
-
this.debug(this.pattern, "set", i);
|
|
780
|
-
let a = r[r.length - 1];
|
|
781
|
-
if (!a) for (let e = r.length - 2; !a && e >= 0; e--) a = r[e];
|
|
782
|
-
for (let e = 0; e < i.length; e++) {
|
|
783
|
-
let o = i[e], s = r;
|
|
784
|
-
if (n.matchBase && o.length === 1 && (s = [a]), this.matchOne(s, o, t)) return n.flipNegate ? !0 : !this.negate;
|
|
785
|
-
}
|
|
786
|
-
return n.flipNegate ? !1 : this.negate;
|
|
787
|
-
}
|
|
788
|
-
static defaults(e) {
|
|
789
|
-
return S.defaults(e).Minimatch;
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
S.AST = Re, S.Minimatch = T, S.escape = ze, S.unescape = x;
|
|
793
|
-
var mt = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, ht = /* @__PURE__ */ new Set(), gt = typeof process == "object" && process ? process : {}, _t = (e, t, n, r) => {
|
|
794
|
-
typeof gt.emitWarning == "function" ? gt.emitWarning(e, t, n, r) : console.error(`[${n}] ${t}: ${e}`);
|
|
795
|
-
}, vt = globalThis.AbortController, yt = globalThis.AbortSignal;
|
|
796
|
-
if (typeof vt > "u") {
|
|
797
|
-
yt = class {
|
|
798
|
-
onabort;
|
|
799
|
-
_onabort = [];
|
|
800
|
-
reason;
|
|
801
|
-
aborted = !1;
|
|
802
|
-
addEventListener(e, t) {
|
|
803
|
-
this._onabort.push(t);
|
|
804
|
-
}
|
|
805
|
-
}, vt = class {
|
|
806
|
-
constructor() {
|
|
807
|
-
t();
|
|
808
|
-
}
|
|
809
|
-
signal = new yt();
|
|
810
|
-
abort(e) {
|
|
811
|
-
if (!this.signal.aborted) {
|
|
812
|
-
this.signal.reason = e, this.signal.aborted = !0;
|
|
813
|
-
for (let t of this.signal._onabort) t(e);
|
|
814
|
-
this.signal.onabort?.(e);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
let e = gt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
819
|
-
e && (e = !1, _t("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
var bt = (e) => !ht.has(e), E = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), xt = (e) => E(e) ? e <= 2 ** 8 ? Uint8Array : e <= 2 ** 16 ? Uint16Array : e <= 2 ** 32 ? Uint32Array : e <= 2 ** 53 - 1 ? St : null : null, St = class extends Array {
|
|
823
|
-
constructor(e) {
|
|
824
|
-
super(e), this.fill(0);
|
|
825
|
-
}
|
|
826
|
-
}, Ct = class e {
|
|
827
|
-
heap;
|
|
828
|
-
length;
|
|
829
|
-
static #e = !1;
|
|
830
|
-
static create(t) {
|
|
831
|
-
let n = xt(t);
|
|
832
|
-
if (!n) return [];
|
|
833
|
-
e.#e = !0;
|
|
834
|
-
let r = new e(t, n);
|
|
835
|
-
return e.#e = !1, r;
|
|
836
|
-
}
|
|
837
|
-
constructor(t, n) {
|
|
838
|
-
if (!e.#e) throw TypeError("instantiate Stack using Stack.create(n)");
|
|
839
|
-
this.heap = new n(t), this.length = 0;
|
|
840
|
-
}
|
|
841
|
-
push(e) {
|
|
842
|
-
this.heap[this.length++] = e;
|
|
843
|
-
}
|
|
844
|
-
pop() {
|
|
845
|
-
return this.heap[--this.length];
|
|
846
|
-
}
|
|
847
|
-
}, wt = class e {
|
|
848
|
-
#e;
|
|
849
|
-
#t;
|
|
850
|
-
#n;
|
|
851
|
-
#r;
|
|
852
|
-
#i;
|
|
853
|
-
#a;
|
|
854
|
-
#o;
|
|
855
|
-
#s;
|
|
856
|
-
get perf() {
|
|
857
|
-
return this.#s;
|
|
858
|
-
}
|
|
859
|
-
ttl;
|
|
860
|
-
ttlResolution;
|
|
861
|
-
ttlAutopurge;
|
|
862
|
-
updateAgeOnGet;
|
|
863
|
-
updateAgeOnHas;
|
|
864
|
-
allowStale;
|
|
865
|
-
noDisposeOnSet;
|
|
866
|
-
noUpdateTTL;
|
|
867
|
-
maxEntrySize;
|
|
868
|
-
sizeCalculation;
|
|
869
|
-
noDeleteOnFetchRejection;
|
|
870
|
-
noDeleteOnStaleGet;
|
|
871
|
-
allowStaleOnFetchAbort;
|
|
872
|
-
allowStaleOnFetchRejection;
|
|
873
|
-
ignoreFetchAbort;
|
|
874
|
-
#c;
|
|
875
|
-
#l;
|
|
876
|
-
#u;
|
|
877
|
-
#d;
|
|
878
|
-
#f;
|
|
879
|
-
#p;
|
|
880
|
-
#m;
|
|
881
|
-
#h;
|
|
882
|
-
#g;
|
|
883
|
-
#_;
|
|
884
|
-
#v;
|
|
885
|
-
#y;
|
|
886
|
-
#b;
|
|
887
|
-
#x;
|
|
888
|
-
#S;
|
|
889
|
-
#C;
|
|
890
|
-
#w;
|
|
891
|
-
#T;
|
|
892
|
-
#E;
|
|
893
|
-
static unsafeExposeInternals(e) {
|
|
894
|
-
return {
|
|
895
|
-
starts: e.#b,
|
|
896
|
-
ttls: e.#x,
|
|
897
|
-
autopurgeTimers: e.#S,
|
|
898
|
-
sizes: e.#y,
|
|
899
|
-
keyMap: e.#u,
|
|
900
|
-
keyList: e.#d,
|
|
901
|
-
valList: e.#f,
|
|
902
|
-
next: e.#p,
|
|
903
|
-
prev: e.#m,
|
|
904
|
-
get head() {
|
|
905
|
-
return e.#h;
|
|
906
|
-
},
|
|
907
|
-
get tail() {
|
|
908
|
-
return e.#g;
|
|
909
|
-
},
|
|
910
|
-
free: e.#_,
|
|
911
|
-
isBackgroundFetch: (t) => e.#V(t),
|
|
912
|
-
backgroundFetch: (t, n, r, i) => e.#B(t, n, r, i),
|
|
913
|
-
moveToTail: (t) => e.#U(t),
|
|
914
|
-
indexes: (t) => e.#I(t),
|
|
915
|
-
rindexes: (t) => e.#L(t),
|
|
916
|
-
isStale: (t) => e.#j(t)
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
get max() {
|
|
920
|
-
return this.#e;
|
|
921
|
-
}
|
|
922
|
-
get maxSize() {
|
|
923
|
-
return this.#t;
|
|
924
|
-
}
|
|
925
|
-
get calculatedSize() {
|
|
926
|
-
return this.#l;
|
|
927
|
-
}
|
|
928
|
-
get size() {
|
|
929
|
-
return this.#c;
|
|
930
|
-
}
|
|
931
|
-
get fetchMethod() {
|
|
932
|
-
return this.#a;
|
|
933
|
-
}
|
|
934
|
-
get memoMethod() {
|
|
935
|
-
return this.#o;
|
|
936
|
-
}
|
|
937
|
-
get dispose() {
|
|
938
|
-
return this.#n;
|
|
939
|
-
}
|
|
940
|
-
get onInsert() {
|
|
941
|
-
return this.#r;
|
|
942
|
-
}
|
|
943
|
-
get disposeAfter() {
|
|
944
|
-
return this.#i;
|
|
945
|
-
}
|
|
946
|
-
constructor(t) {
|
|
947
|
-
let { max: n = 0, ttl: r, ttlResolution: i = 1, ttlAutopurge: a, updateAgeOnGet: o, updateAgeOnHas: s, allowStale: c, dispose: l, onInsert: u, disposeAfter: d, noDisposeOnSet: f, noUpdateTTL: p, maxSize: m = 0, maxEntrySize: ee = 0, sizeCalculation: h, fetchMethod: g, memoMethod: _, noDeleteOnFetchRejection: v, noDeleteOnStaleGet: te, allowStaleOnFetchRejection: ne, allowStaleOnFetchAbort: re, ignoreFetchAbort: ie, perf: ae } = t;
|
|
948
|
-
if (ae !== void 0 && typeof ae?.now != "function") throw TypeError("perf option must have a now() method if specified");
|
|
949
|
-
if (this.#s = ae ?? mt, n !== 0 && !E(n)) throw TypeError("max option must be a nonnegative integer");
|
|
950
|
-
let oe = n ? xt(n) : Array;
|
|
951
|
-
if (!oe) throw Error("invalid max value: " + n);
|
|
952
|
-
if (this.#e = n, this.#t = m, this.maxEntrySize = ee || this.#t, this.sizeCalculation = h, this.sizeCalculation) {
|
|
953
|
-
if (!this.#t && !this.maxEntrySize) throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
954
|
-
if (typeof this.sizeCalculation != "function") throw TypeError("sizeCalculation set to non-function");
|
|
955
|
-
}
|
|
956
|
-
if (_ !== void 0 && typeof _ != "function") throw TypeError("memoMethod must be a function if defined");
|
|
957
|
-
if (this.#o = _, g !== void 0 && typeof g != "function") throw TypeError("fetchMethod must be a function if specified");
|
|
958
|
-
if (this.#a = g, this.#w = !!g, this.#u = /* @__PURE__ */ new Map(), this.#d = Array(n).fill(void 0), this.#f = Array(n).fill(void 0), this.#p = new oe(n), this.#m = new oe(n), this.#h = 0, this.#g = 0, this.#_ = Ct.create(n), this.#c = 0, this.#l = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof d == "function" ? (this.#i = d, this.#v = []) : (this.#i = void 0, this.#v = void 0), this.#C = !!this.#n, this.#E = !!this.#r, this.#T = !!this.#i, this.noDisposeOnSet = !!f, this.noUpdateTTL = !!p, this.noDeleteOnFetchRejection = !!v, this.allowStaleOnFetchRejection = !!ne, this.allowStaleOnFetchAbort = !!re, this.ignoreFetchAbort = !!ie, this.maxEntrySize !== 0) {
|
|
959
|
-
if (this.#t !== 0 && !E(this.#t)) throw TypeError("maxSize must be a positive integer if specified");
|
|
960
|
-
if (!E(this.maxEntrySize)) throw TypeError("maxEntrySize must be a positive integer if specified");
|
|
961
|
-
this.#M();
|
|
962
|
-
}
|
|
963
|
-
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!te, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution = E(i) || i === 0 ? i : 1, this.ttlAutopurge = !!a, this.ttl = r || 0, this.ttl) {
|
|
964
|
-
if (!E(this.ttl)) throw TypeError("ttl must be a positive integer if specified");
|
|
965
|
-
this.#D();
|
|
966
|
-
}
|
|
967
|
-
if (this.#e === 0 && this.ttl === 0 && this.#t === 0) throw TypeError("At least one of max, maxSize, or ttl is required");
|
|
968
|
-
if (!this.ttlAutopurge && !this.#e && !this.#t) {
|
|
969
|
-
let t = "LRU_CACHE_UNBOUNDED";
|
|
970
|
-
bt(t) && (ht.add(t), _t("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", t, e));
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
getRemainingTTL(e) {
|
|
974
|
-
return this.#u.has(e) ? Infinity : 0;
|
|
975
|
-
}
|
|
976
|
-
#D() {
|
|
977
|
-
let e = new St(this.#e), t = new St(this.#e);
|
|
978
|
-
this.#x = e, this.#b = t;
|
|
979
|
-
let n = this.ttlAutopurge ? Array(this.#e) : void 0;
|
|
980
|
-
this.#S = n, this.#A = (r, i, a = this.#s.now()) => {
|
|
981
|
-
if (t[r] = i === 0 ? 0 : a, e[r] = i, n?.[r] && (clearTimeout(n[r]), n[r] = void 0), i !== 0 && n) {
|
|
982
|
-
let e = setTimeout(() => {
|
|
983
|
-
this.#j(r) && this.#W(this.#d[r], "expire");
|
|
984
|
-
}, i + 1);
|
|
985
|
-
e.unref && e.unref(), n[r] = e;
|
|
986
|
-
}
|
|
987
|
-
}, this.#O = (n) => {
|
|
988
|
-
t[n] = e[n] === 0 ? 0 : this.#s.now();
|
|
989
|
-
}, this.#k = (n, a) => {
|
|
990
|
-
if (e[a]) {
|
|
991
|
-
let o = e[a], s = t[a];
|
|
992
|
-
if (!o || !s) return;
|
|
993
|
-
n.ttl = o, n.start = s, n.now = r || i(), n.remainingTTL = o - (n.now - s);
|
|
994
|
-
}
|
|
995
|
-
};
|
|
996
|
-
let r = 0, i = () => {
|
|
997
|
-
let e = this.#s.now();
|
|
998
|
-
if (this.ttlResolution > 0) {
|
|
999
|
-
r = e;
|
|
1000
|
-
let t = setTimeout(() => r = 0, this.ttlResolution);
|
|
1001
|
-
t.unref && t.unref();
|
|
1002
|
-
}
|
|
1003
|
-
return e;
|
|
1004
|
-
};
|
|
1005
|
-
this.getRemainingTTL = (n) => {
|
|
1006
|
-
let a = this.#u.get(n);
|
|
1007
|
-
if (a === void 0) return 0;
|
|
1008
|
-
let o = e[a], s = t[a];
|
|
1009
|
-
return !o || !s ? Infinity : o - ((r || i()) - s);
|
|
1010
|
-
}, this.#j = (n) => {
|
|
1011
|
-
let a = t[n], o = e[n];
|
|
1012
|
-
return !!o && !!a && (r || i()) - a > o;
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
#O = () => {};
|
|
1016
|
-
#k = () => {};
|
|
1017
|
-
#A = () => {};
|
|
1018
|
-
#j = () => !1;
|
|
1019
|
-
#M() {
|
|
1020
|
-
let e = new St(this.#e);
|
|
1021
|
-
this.#l = 0, this.#y = e, this.#N = (t) => {
|
|
1022
|
-
this.#l -= e[t], e[t] = 0;
|
|
1023
|
-
}, this.#F = (e, t, n, r) => {
|
|
1024
|
-
if (this.#V(t)) return 0;
|
|
1025
|
-
if (!E(n)) if (r) {
|
|
1026
|
-
if (typeof r != "function") throw TypeError("sizeCalculation must be a function");
|
|
1027
|
-
if (n = r(t, e), !E(n)) throw TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
1028
|
-
} else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
1029
|
-
return n;
|
|
1030
|
-
}, this.#P = (t, n, r) => {
|
|
1031
|
-
if (e[t] = n, this.#t) {
|
|
1032
|
-
let n = this.#t - e[t];
|
|
1033
|
-
for (; this.#l > n;) this.#z(!0);
|
|
1034
|
-
}
|
|
1035
|
-
this.#l += e[t], r && (r.entrySize = n, r.totalCalculatedSize = this.#l);
|
|
1036
|
-
};
|
|
1037
|
-
}
|
|
1038
|
-
#N = (e) => {};
|
|
1039
|
-
#P = (e, t, n) => {};
|
|
1040
|
-
#F = (e, t, n, r) => {
|
|
1041
|
-
if (n || r) throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
1042
|
-
return 0;
|
|
1043
|
-
};
|
|
1044
|
-
*#I({ allowStale: e = this.allowStale } = {}) {
|
|
1045
|
-
if (this.#c) for (let t = this.#g; !(!this.#R(t) || ((e || !this.#j(t)) && (yield t), t === this.#h));) t = this.#m[t];
|
|
1046
|
-
}
|
|
1047
|
-
*#L({ allowStale: e = this.allowStale } = {}) {
|
|
1048
|
-
if (this.#c) for (let t = this.#h; !(!this.#R(t) || ((e || !this.#j(t)) && (yield t), t === this.#g));) t = this.#p[t];
|
|
1049
|
-
}
|
|
1050
|
-
#R(e) {
|
|
1051
|
-
return e !== void 0 && this.#u.get(this.#d[e]) === e;
|
|
1052
|
-
}
|
|
1053
|
-
*entries() {
|
|
1054
|
-
for (let e of this.#I()) this.#f[e] !== void 0 && this.#d[e] !== void 0 && !this.#V(this.#f[e]) && (yield [this.#d[e], this.#f[e]]);
|
|
1055
|
-
}
|
|
1056
|
-
*rentries() {
|
|
1057
|
-
for (let e of this.#L()) this.#f[e] !== void 0 && this.#d[e] !== void 0 && !this.#V(this.#f[e]) && (yield [this.#d[e], this.#f[e]]);
|
|
1058
|
-
}
|
|
1059
|
-
*keys() {
|
|
1060
|
-
for (let e of this.#I()) {
|
|
1061
|
-
let t = this.#d[e];
|
|
1062
|
-
t !== void 0 && !this.#V(this.#f[e]) && (yield t);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
*rkeys() {
|
|
1066
|
-
for (let e of this.#L()) {
|
|
1067
|
-
let t = this.#d[e];
|
|
1068
|
-
t !== void 0 && !this.#V(this.#f[e]) && (yield t);
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
*values() {
|
|
1072
|
-
for (let e of this.#I()) this.#f[e] !== void 0 && !this.#V(this.#f[e]) && (yield this.#f[e]);
|
|
1073
|
-
}
|
|
1074
|
-
*rvalues() {
|
|
1075
|
-
for (let e of this.#L()) this.#f[e] !== void 0 && !this.#V(this.#f[e]) && (yield this.#f[e]);
|
|
1076
|
-
}
|
|
1077
|
-
[Symbol.iterator]() {
|
|
1078
|
-
return this.entries();
|
|
1079
|
-
}
|
|
1080
|
-
[Symbol.toStringTag] = "LRUCache";
|
|
1081
|
-
find(e, t = {}) {
|
|
1082
|
-
for (let n of this.#I()) {
|
|
1083
|
-
let r = this.#f[n], i = this.#V(r) ? r.__staleWhileFetching : r;
|
|
1084
|
-
if (i !== void 0 && e(i, this.#d[n], this)) return this.get(this.#d[n], t);
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
forEach(e, t = this) {
|
|
1088
|
-
for (let n of this.#I()) {
|
|
1089
|
-
let r = this.#f[n], i = this.#V(r) ? r.__staleWhileFetching : r;
|
|
1090
|
-
i !== void 0 && e.call(t, i, this.#d[n], this);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
rforEach(e, t = this) {
|
|
1094
|
-
for (let n of this.#L()) {
|
|
1095
|
-
let r = this.#f[n], i = this.#V(r) ? r.__staleWhileFetching : r;
|
|
1096
|
-
i !== void 0 && e.call(t, i, this.#d[n], this);
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
purgeStale() {
|
|
1100
|
-
let e = !1;
|
|
1101
|
-
for (let t of this.#L({ allowStale: !0 })) this.#j(t) && (this.#W(this.#d[t], "expire"), e = !0);
|
|
1102
|
-
return e;
|
|
1103
|
-
}
|
|
1104
|
-
info(e) {
|
|
1105
|
-
let t = this.#u.get(e);
|
|
1106
|
-
if (t === void 0) return;
|
|
1107
|
-
let n = this.#f[t], r = this.#V(n) ? n.__staleWhileFetching : n;
|
|
1108
|
-
if (r === void 0) return;
|
|
1109
|
-
let i = { value: r };
|
|
1110
|
-
if (this.#x && this.#b) {
|
|
1111
|
-
let e = this.#x[t], n = this.#b[t];
|
|
1112
|
-
e && n && (i.ttl = e - (this.#s.now() - n), i.start = Date.now());
|
|
1113
|
-
}
|
|
1114
|
-
return this.#y && (i.size = this.#y[t]), i;
|
|
1115
|
-
}
|
|
1116
|
-
dump() {
|
|
1117
|
-
let e = [];
|
|
1118
|
-
for (let t of this.#I({ allowStale: !0 })) {
|
|
1119
|
-
let n = this.#d[t], r = this.#f[t], i = this.#V(r) ? r.__staleWhileFetching : r;
|
|
1120
|
-
if (i === void 0 || n === void 0) continue;
|
|
1121
|
-
let a = { value: i };
|
|
1122
|
-
if (this.#x && this.#b) {
|
|
1123
|
-
a.ttl = this.#x[t];
|
|
1124
|
-
let e = this.#s.now() - this.#b[t];
|
|
1125
|
-
a.start = Math.floor(Date.now() - e);
|
|
1126
|
-
}
|
|
1127
|
-
this.#y && (a.size = this.#y[t]), e.unshift([n, a]);
|
|
1128
|
-
}
|
|
1129
|
-
return e;
|
|
1130
|
-
}
|
|
1131
|
-
load(e) {
|
|
1132
|
-
this.clear();
|
|
1133
|
-
for (let [t, n] of e) {
|
|
1134
|
-
if (n.start) {
|
|
1135
|
-
let e = Date.now() - n.start;
|
|
1136
|
-
n.start = this.#s.now() - e;
|
|
1137
|
-
}
|
|
1138
|
-
this.set(t, n.value, n);
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
set(e, t, n = {}) {
|
|
1142
|
-
if (t === void 0) return this.delete(e), this;
|
|
1143
|
-
let { ttl: r = this.ttl, start: i, noDisposeOnSet: a = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: s } = n, { noUpdateTTL: c = this.noUpdateTTL } = n, l = this.#F(e, t, n.size || 0, o);
|
|
1144
|
-
if (this.maxEntrySize && l > this.maxEntrySize) return s && (s.set = "miss", s.maxEntrySizeExceeded = !0), this.#W(e, "set"), this;
|
|
1145
|
-
let u = this.#c === 0 ? void 0 : this.#u.get(e);
|
|
1146
|
-
if (u === void 0) u = this.#c === 0 ? this.#g : this.#_.length === 0 ? this.#c === this.#e ? this.#z(!1) : this.#c : this.#_.pop(), this.#d[u] = e, this.#f[u] = t, this.#u.set(e, u), this.#p[this.#g] = u, this.#m[u] = this.#g, this.#g = u, this.#c++, this.#P(u, l, s), s && (s.set = "add"), c = !1, this.#E && this.#r?.(t, e, "add");
|
|
1147
|
-
else {
|
|
1148
|
-
this.#U(u);
|
|
1149
|
-
let n = this.#f[u];
|
|
1150
|
-
if (t !== n) {
|
|
1151
|
-
if (this.#w && this.#V(n)) {
|
|
1152
|
-
n.__abortController.abort(/* @__PURE__ */ Error("replaced"));
|
|
1153
|
-
let { __staleWhileFetching: t } = n;
|
|
1154
|
-
t !== void 0 && !a && (this.#C && this.#n?.(t, e, "set"), this.#T && this.#v?.push([
|
|
1155
|
-
t,
|
|
1156
|
-
e,
|
|
1157
|
-
"set"
|
|
1158
|
-
]));
|
|
1159
|
-
} else a || (this.#C && this.#n?.(n, e, "set"), this.#T && this.#v?.push([
|
|
1160
|
-
n,
|
|
1161
|
-
e,
|
|
1162
|
-
"set"
|
|
1163
|
-
]));
|
|
1164
|
-
if (this.#N(u), this.#P(u, l, s), this.#f[u] = t, s) {
|
|
1165
|
-
s.set = "replace";
|
|
1166
|
-
let e = n && this.#V(n) ? n.__staleWhileFetching : n;
|
|
1167
|
-
e !== void 0 && (s.oldValue = e);
|
|
1168
|
-
}
|
|
1169
|
-
} else s && (s.set = "update");
|
|
1170
|
-
this.#E && this.onInsert?.(t, e, t === n ? "update" : "replace");
|
|
1171
|
-
}
|
|
1172
|
-
if (r !== 0 && !this.#x && this.#D(), this.#x && (c || this.#A(u, r, i), s && this.#k(s, u)), !a && this.#T && this.#v) {
|
|
1173
|
-
let e = this.#v, t;
|
|
1174
|
-
for (; t = e?.shift();) this.#i?.(...t);
|
|
1175
|
-
}
|
|
1176
|
-
return this;
|
|
1177
|
-
}
|
|
1178
|
-
pop() {
|
|
1179
|
-
try {
|
|
1180
|
-
for (; this.#c;) {
|
|
1181
|
-
let e = this.#f[this.#h];
|
|
1182
|
-
if (this.#z(!0), this.#V(e)) {
|
|
1183
|
-
if (e.__staleWhileFetching) return e.__staleWhileFetching;
|
|
1184
|
-
} else if (e !== void 0) return e;
|
|
1185
|
-
}
|
|
1186
|
-
} finally {
|
|
1187
|
-
if (this.#T && this.#v) {
|
|
1188
|
-
let e = this.#v, t;
|
|
1189
|
-
for (; t = e?.shift();) this.#i?.(...t);
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
#z(e) {
|
|
1194
|
-
let t = this.#h, n = this.#d[t], r = this.#f[t];
|
|
1195
|
-
return this.#w && this.#V(r) ? r.__abortController.abort(/* @__PURE__ */ Error("evicted")) : (this.#C || this.#T) && (this.#C && this.#n?.(r, n, "evict"), this.#T && this.#v?.push([
|
|
1196
|
-
r,
|
|
1197
|
-
n,
|
|
1198
|
-
"evict"
|
|
1199
|
-
])), this.#N(t), this.#S?.[t] && (clearTimeout(this.#S[t]), this.#S[t] = void 0), e && (this.#d[t] = void 0, this.#f[t] = void 0, this.#_.push(t)), this.#c === 1 ? (this.#h = this.#g = 0, this.#_.length = 0) : this.#h = this.#p[t], this.#u.delete(n), this.#c--, t;
|
|
1200
|
-
}
|
|
1201
|
-
has(e, t = {}) {
|
|
1202
|
-
let { updateAgeOnHas: n = this.updateAgeOnHas, status: r } = t, i = this.#u.get(e);
|
|
1203
|
-
if (i !== void 0) {
|
|
1204
|
-
let e = this.#f[i];
|
|
1205
|
-
if (this.#V(e) && e.__staleWhileFetching === void 0) return !1;
|
|
1206
|
-
if (this.#j(i)) r && (r.has = "stale", this.#k(r, i));
|
|
1207
|
-
else return n && this.#O(i), r && (r.has = "hit", this.#k(r, i)), !0;
|
|
1208
|
-
} else r && (r.has = "miss");
|
|
1209
|
-
return !1;
|
|
1210
|
-
}
|
|
1211
|
-
peek(e, t = {}) {
|
|
1212
|
-
let { allowStale: n = this.allowStale } = t, r = this.#u.get(e);
|
|
1213
|
-
if (r === void 0 || !n && this.#j(r)) return;
|
|
1214
|
-
let i = this.#f[r];
|
|
1215
|
-
return this.#V(i) ? i.__staleWhileFetching : i;
|
|
1216
|
-
}
|
|
1217
|
-
#B(e, t, n, r) {
|
|
1218
|
-
let i = t === void 0 ? void 0 : this.#f[t];
|
|
1219
|
-
if (this.#V(i)) return i;
|
|
1220
|
-
let a = new vt(), { signal: o } = n;
|
|
1221
|
-
o?.addEventListener("abort", () => a.abort(o.reason), { signal: a.signal });
|
|
1222
|
-
let s = {
|
|
1223
|
-
signal: a.signal,
|
|
1224
|
-
options: n,
|
|
1225
|
-
context: r
|
|
1226
|
-
}, c = (r, i = !1) => {
|
|
1227
|
-
let { aborted: o } = a.signal, c = n.ignoreFetchAbort && r !== void 0, l = n.ignoreFetchAbort || !!(n.allowStaleOnFetchAbort && r !== void 0);
|
|
1228
|
-
if (n.status && (o && !i ? (n.status.fetchAborted = !0, n.status.fetchError = a.signal.reason, c && (n.status.fetchAbortIgnored = !0)) : n.status.fetchResolved = !0), o && !c && !i) return u(a.signal.reason, l);
|
|
1229
|
-
let d = f, p = this.#f[t];
|
|
1230
|
-
return (p === f || c && i && p === void 0) && (r === void 0 ? d.__staleWhileFetching === void 0 ? this.#W(e, "fetch") : this.#f[t] = d.__staleWhileFetching : (n.status && (n.status.fetchUpdated = !0), this.set(e, r, s.options))), r;
|
|
1231
|
-
}, l = (e) => (n.status && (n.status.fetchRejected = !0, n.status.fetchError = e), u(e, !1)), u = (r, i) => {
|
|
1232
|
-
let { aborted: o } = a.signal, s = o && n.allowStaleOnFetchAbort, c = s || n.allowStaleOnFetchRejection, l = c || n.noDeleteOnFetchRejection, u = f;
|
|
1233
|
-
if (this.#f[t] === f && (!l || !i && u.__staleWhileFetching === void 0 ? this.#W(e, "fetch") : s || (this.#f[t] = u.__staleWhileFetching)), c) return n.status && u.__staleWhileFetching !== void 0 && (n.status.returnedStale = !0), u.__staleWhileFetching;
|
|
1234
|
-
if (u.__returned === u) throw r;
|
|
1235
|
-
}, d = (t, r) => {
|
|
1236
|
-
let o = this.#a?.(e, i, s);
|
|
1237
|
-
o && o instanceof Promise && o.then((e) => t(e === void 0 ? void 0 : e), r), a.signal.addEventListener("abort", () => {
|
|
1238
|
-
(!n.ignoreFetchAbort || n.allowStaleOnFetchAbort) && (t(void 0), n.allowStaleOnFetchAbort && (t = (e) => c(e, !0)));
|
|
1239
|
-
});
|
|
1240
|
-
};
|
|
1241
|
-
n.status && (n.status.fetchDispatched = !0);
|
|
1242
|
-
let f = new Promise(d).then(c, l), p = Object.assign(f, {
|
|
1243
|
-
__abortController: a,
|
|
1244
|
-
__staleWhileFetching: i,
|
|
1245
|
-
__returned: void 0
|
|
1246
|
-
});
|
|
1247
|
-
return t === void 0 ? (this.set(e, p, {
|
|
1248
|
-
...s.options,
|
|
1249
|
-
status: void 0
|
|
1250
|
-
}), t = this.#u.get(e)) : this.#f[t] = p, p;
|
|
1251
|
-
}
|
|
1252
|
-
#V(e) {
|
|
1253
|
-
if (!this.#w) return !1;
|
|
1254
|
-
let t = e;
|
|
1255
|
-
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof vt;
|
|
1256
|
-
}
|
|
1257
|
-
async fetch(e, t = {}) {
|
|
1258
|
-
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, ttl: a = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: s = 0, sizeCalculation: c = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: m, forceRefresh: ee = !1, status: h, signal: g } = t;
|
|
1259
|
-
if (!this.#w) return h && (h.fetch = "get"), this.get(e, {
|
|
1260
|
-
allowStale: n,
|
|
1261
|
-
updateAgeOnGet: r,
|
|
1262
|
-
noDeleteOnStaleGet: i,
|
|
1263
|
-
status: h
|
|
1264
|
-
});
|
|
1265
|
-
let _ = {
|
|
1266
|
-
allowStale: n,
|
|
1267
|
-
updateAgeOnGet: r,
|
|
1268
|
-
noDeleteOnStaleGet: i,
|
|
1269
|
-
ttl: a,
|
|
1270
|
-
noDisposeOnSet: o,
|
|
1271
|
-
size: s,
|
|
1272
|
-
sizeCalculation: c,
|
|
1273
|
-
noUpdateTTL: l,
|
|
1274
|
-
noDeleteOnFetchRejection: u,
|
|
1275
|
-
allowStaleOnFetchRejection: d,
|
|
1276
|
-
allowStaleOnFetchAbort: p,
|
|
1277
|
-
ignoreFetchAbort: f,
|
|
1278
|
-
status: h,
|
|
1279
|
-
signal: g
|
|
1280
|
-
}, v = this.#u.get(e);
|
|
1281
|
-
if (v === void 0) {
|
|
1282
|
-
h && (h.fetch = "miss");
|
|
1283
|
-
let t = this.#B(e, v, _, m);
|
|
1284
|
-
return t.__returned = t;
|
|
1285
|
-
} else {
|
|
1286
|
-
let t = this.#f[v];
|
|
1287
|
-
if (this.#V(t)) {
|
|
1288
|
-
let e = n && t.__staleWhileFetching !== void 0;
|
|
1289
|
-
return h && (h.fetch = "inflight", e && (h.returnedStale = !0)), e ? t.__staleWhileFetching : t.__returned = t;
|
|
1290
|
-
}
|
|
1291
|
-
let i = this.#j(v);
|
|
1292
|
-
if (!ee && !i) return h && (h.fetch = "hit"), this.#U(v), r && this.#O(v), h && this.#k(h, v), t;
|
|
1293
|
-
let a = this.#B(e, v, _, m), o = a.__staleWhileFetching !== void 0 && n;
|
|
1294
|
-
return h && (h.fetch = i ? "stale" : "refresh", o && i && (h.returnedStale = !0)), o ? a.__staleWhileFetching : a.__returned = a;
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
async forceFetch(e, t = {}) {
|
|
1298
|
-
let n = await this.fetch(e, t);
|
|
1299
|
-
if (n === void 0) throw Error("fetch() returned undefined");
|
|
1300
|
-
return n;
|
|
1301
|
-
}
|
|
1302
|
-
memo(e, t = {}) {
|
|
1303
|
-
let n = this.#o;
|
|
1304
|
-
if (!n) throw Error("no memoMethod provided to constructor");
|
|
1305
|
-
let { context: r, forceRefresh: i, ...a } = t, o = this.get(e, a);
|
|
1306
|
-
if (!i && o !== void 0) return o;
|
|
1307
|
-
let s = n(e, o, {
|
|
1308
|
-
options: a,
|
|
1309
|
-
context: r
|
|
1310
|
-
});
|
|
1311
|
-
return this.set(e, s, a), s;
|
|
1312
|
-
}
|
|
1313
|
-
get(e, t = {}) {
|
|
1314
|
-
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, status: a } = t, o = this.#u.get(e);
|
|
1315
|
-
if (o !== void 0) {
|
|
1316
|
-
let t = this.#f[o], s = this.#V(t);
|
|
1317
|
-
return a && this.#k(a, o), this.#j(o) ? (a && (a.get = "stale"), s ? (a && n && t.__staleWhileFetching !== void 0 && (a.returnedStale = !0), n ? t.__staleWhileFetching : void 0) : (i || this.#W(e, "expire"), a && n && (a.returnedStale = !0), n ? t : void 0)) : (a && (a.get = "hit"), s ? t.__staleWhileFetching : (this.#U(o), r && this.#O(o), t));
|
|
1318
|
-
} else a && (a.get = "miss");
|
|
1319
|
-
}
|
|
1320
|
-
#H(e, t) {
|
|
1321
|
-
this.#m[t] = e, this.#p[e] = t;
|
|
1322
|
-
}
|
|
1323
|
-
#U(e) {
|
|
1324
|
-
e !== this.#g && (e === this.#h ? this.#h = this.#p[e] : this.#H(this.#m[e], this.#p[e]), this.#H(this.#g, e), this.#g = e);
|
|
1325
|
-
}
|
|
1326
|
-
delete(e) {
|
|
1327
|
-
return this.#W(e, "delete");
|
|
1328
|
-
}
|
|
1329
|
-
#W(e, t) {
|
|
1330
|
-
let n = !1;
|
|
1331
|
-
if (this.#c !== 0) {
|
|
1332
|
-
let r = this.#u.get(e);
|
|
1333
|
-
if (r !== void 0) if (this.#S?.[r] && (clearTimeout(this.#S?.[r]), this.#S[r] = void 0), n = !0, this.#c === 1) this.#G(t);
|
|
1334
|
-
else {
|
|
1335
|
-
this.#N(r);
|
|
1336
|
-
let n = this.#f[r];
|
|
1337
|
-
if (this.#V(n) ? n.__abortController.abort(/* @__PURE__ */ Error("deleted")) : (this.#C || this.#T) && (this.#C && this.#n?.(n, e, t), this.#T && this.#v?.push([
|
|
1338
|
-
n,
|
|
1339
|
-
e,
|
|
1340
|
-
t
|
|
1341
|
-
])), this.#u.delete(e), this.#d[r] = void 0, this.#f[r] = void 0, r === this.#g) this.#g = this.#m[r];
|
|
1342
|
-
else if (r === this.#h) this.#h = this.#p[r];
|
|
1343
|
-
else {
|
|
1344
|
-
let e = this.#m[r];
|
|
1345
|
-
this.#p[e] = this.#p[r];
|
|
1346
|
-
let t = this.#p[r];
|
|
1347
|
-
this.#m[t] = this.#m[r];
|
|
1348
|
-
}
|
|
1349
|
-
this.#c--, this.#_.push(r);
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
if (this.#T && this.#v?.length) {
|
|
1353
|
-
let e = this.#v, t;
|
|
1354
|
-
for (; t = e?.shift();) this.#i?.(...t);
|
|
1355
|
-
}
|
|
1356
|
-
return n;
|
|
1357
|
-
}
|
|
1358
|
-
clear() {
|
|
1359
|
-
return this.#G("delete");
|
|
1360
|
-
}
|
|
1361
|
-
#G(e) {
|
|
1362
|
-
for (let t of this.#L({ allowStale: !0 })) {
|
|
1363
|
-
let n = this.#f[t];
|
|
1364
|
-
if (this.#V(n)) n.__abortController.abort(/* @__PURE__ */ Error("deleted"));
|
|
1365
|
-
else {
|
|
1366
|
-
let r = this.#d[t];
|
|
1367
|
-
this.#C && this.#n?.(n, r, e), this.#T && this.#v?.push([
|
|
1368
|
-
n,
|
|
1369
|
-
r,
|
|
1370
|
-
e
|
|
1371
|
-
]);
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
if (this.#u.clear(), this.#f.fill(void 0), this.#d.fill(void 0), this.#x && this.#b) {
|
|
1375
|
-
this.#x.fill(0), this.#b.fill(0);
|
|
1376
|
-
for (let e of this.#S ?? []) e !== void 0 && clearTimeout(e);
|
|
1377
|
-
this.#S?.fill(void 0);
|
|
1378
|
-
}
|
|
1379
|
-
if (this.#y && this.#y.fill(0), this.#h = 0, this.#g = 0, this.#_.length = 0, this.#l = 0, this.#c = 0, this.#T && this.#v) {
|
|
1380
|
-
let e = this.#v, t;
|
|
1381
|
-
for (; t = e?.shift();) this.#i?.(...t);
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
}, Tt = typeof process == "object" && process ? process : {
|
|
1385
|
-
stdout: null,
|
|
1386
|
-
stderr: null
|
|
1387
|
-
}, Et = (e) => !!e && typeof e == "object" && (e instanceof Xt || e instanceof u || Dt(e) || Ot(e)), Dt = (e) => !!e && typeof e == "object" && e instanceof l && typeof e.pipe == "function" && e.pipe !== u.Writable.prototype.pipe, Ot = (e) => !!e && typeof e == "object" && e instanceof l && typeof e.write == "function" && typeof e.end == "function", D = Symbol("EOF"), O = Symbol("maybeEmitEnd"), k = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), A = Symbol("emittedError"), At = Symbol("closed"), jt = Symbol("read"), Mt = Symbol("flush"), Nt = Symbol("flushChunk"), j = Symbol("encoding"), M = Symbol("decoder"), N = Symbol("flowing"), P = Symbol("paused"), F = Symbol("resume"), I = Symbol("buffer"), L = Symbol("pipes"), R = Symbol("bufferLength"), Pt = Symbol("bufferPush"), Ft = Symbol("bufferShift"), z = Symbol("objectMode"), B = Symbol("destroyed"), It = Symbol("error"), Lt = Symbol("emitData"), Rt = Symbol("emitEnd"), zt = Symbol("emitEnd2"), V = Symbol("async"), Bt = Symbol("abort"), Vt = Symbol("aborted"), H = Symbol("signal"), U = Symbol("dataListeners"), W = Symbol("discarded"), G = (e) => Promise.resolve().then(e), Ht = (e) => e(), Ut = (e) => e === "end" || e === "finish" || e === "prefinish", Wt = (e) => e instanceof ArrayBuffer || !!e && typeof e == "object" && e.constructor && e.constructor.name === "ArrayBuffer" && e.byteLength >= 0, Gt = (e) => !Buffer.isBuffer(e) && ArrayBuffer.isView(e), Kt = class {
|
|
1388
|
-
src;
|
|
1389
|
-
dest;
|
|
1390
|
-
opts;
|
|
1391
|
-
ondrain;
|
|
1392
|
-
constructor(e, t, n) {
|
|
1393
|
-
this.src = e, this.dest = t, this.opts = n, this.ondrain = () => e[F](), this.dest.on("drain", this.ondrain);
|
|
1394
|
-
}
|
|
1395
|
-
unpipe() {
|
|
1396
|
-
this.dest.removeListener("drain", this.ondrain);
|
|
1397
|
-
}
|
|
1398
|
-
proxyErrors(e) {}
|
|
1399
|
-
end() {
|
|
1400
|
-
this.unpipe(), this.opts.end && this.dest.end();
|
|
1401
|
-
}
|
|
1402
|
-
}, qt = class extends Kt {
|
|
1403
|
-
unpipe() {
|
|
1404
|
-
this.src.removeListener("error", this.proxyErrors), super.unpipe();
|
|
1405
|
-
}
|
|
1406
|
-
constructor(e, t, n) {
|
|
1407
|
-
super(e, t, n), this.proxyErrors = (e) => this.dest.emit("error", e), e.on("error", this.proxyErrors);
|
|
1408
|
-
}
|
|
1409
|
-
}, Jt = (e) => !!e.objectMode, Yt = (e) => !e.objectMode && !!e.encoding && e.encoding !== "buffer", Xt = class extends l {
|
|
1410
|
-
[N] = !1;
|
|
1411
|
-
[P] = !1;
|
|
1412
|
-
[L] = [];
|
|
1413
|
-
[I] = [];
|
|
1414
|
-
[z];
|
|
1415
|
-
[j];
|
|
1416
|
-
[V];
|
|
1417
|
-
[M];
|
|
1418
|
-
[D] = !1;
|
|
1419
|
-
[k] = !1;
|
|
1420
|
-
[kt] = !1;
|
|
1421
|
-
[At] = !1;
|
|
1422
|
-
[A] = null;
|
|
1423
|
-
[R] = 0;
|
|
1424
|
-
[B] = !1;
|
|
1425
|
-
[H];
|
|
1426
|
-
[Vt] = !1;
|
|
1427
|
-
[U] = 0;
|
|
1428
|
-
[W] = !1;
|
|
1429
|
-
writable = !0;
|
|
1430
|
-
readable = !0;
|
|
1431
|
-
constructor(...e) {
|
|
1432
|
-
let t = e[0] || {};
|
|
1433
|
-
if (super(), t.objectMode && typeof t.encoding == "string") throw TypeError("Encoding and objectMode may not be used together");
|
|
1434
|
-
Jt(t) ? (this[z] = !0, this[j] = null) : Yt(t) ? (this[j] = t.encoding, this[z] = !1) : (this[z] = !1, this[j] = null), this[V] = !!t.async, this[M] = this[j] ? new d(this[j]) : null, t && t.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[I] }), t && t.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[L] });
|
|
1435
|
-
let { signal: n } = t;
|
|
1436
|
-
n && (this[H] = n, n.aborted ? this[Bt]() : n.addEventListener("abort", () => this[Bt]()));
|
|
1437
|
-
}
|
|
1438
|
-
get bufferLength() {
|
|
1439
|
-
return this[R];
|
|
1440
|
-
}
|
|
1441
|
-
get encoding() {
|
|
1442
|
-
return this[j];
|
|
1443
|
-
}
|
|
1444
|
-
set encoding(e) {
|
|
1445
|
-
throw Error("Encoding must be set at instantiation time");
|
|
1446
|
-
}
|
|
1447
|
-
setEncoding(e) {
|
|
1448
|
-
throw Error("Encoding must be set at instantiation time");
|
|
1449
|
-
}
|
|
1450
|
-
get objectMode() {
|
|
1451
|
-
return this[z];
|
|
1452
|
-
}
|
|
1453
|
-
set objectMode(e) {
|
|
1454
|
-
throw Error("objectMode must be set at instantiation time");
|
|
1455
|
-
}
|
|
1456
|
-
get async() {
|
|
1457
|
-
return this[V];
|
|
1458
|
-
}
|
|
1459
|
-
set async(e) {
|
|
1460
|
-
this[V] = this[V] || !!e;
|
|
1461
|
-
}
|
|
1462
|
-
[Bt]() {
|
|
1463
|
-
this[Vt] = !0, this.emit("abort", this[H]?.reason), this.destroy(this[H]?.reason);
|
|
1464
|
-
}
|
|
1465
|
-
get aborted() {
|
|
1466
|
-
return this[Vt];
|
|
1467
|
-
}
|
|
1468
|
-
set aborted(e) {}
|
|
1469
|
-
write(e, t, n) {
|
|
1470
|
-
if (this[Vt]) return !1;
|
|
1471
|
-
if (this[D]) throw Error("write after end");
|
|
1472
|
-
if (this[B]) return this.emit("error", Object.assign(/* @__PURE__ */ Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
|
|
1473
|
-
typeof t == "function" && (n = t, t = "utf8"), t ||= "utf8";
|
|
1474
|
-
let r = this[V] ? G : Ht;
|
|
1475
|
-
if (!this[z] && !Buffer.isBuffer(e)) {
|
|
1476
|
-
if (Gt(e)) e = Buffer.from(e.buffer, e.byteOffset, e.byteLength);
|
|
1477
|
-
else if (Wt(e)) e = Buffer.from(e);
|
|
1478
|
-
else if (typeof e != "string") throw Error("Non-contiguous data written to non-objectMode stream");
|
|
1479
|
-
}
|
|
1480
|
-
return this[z] ? (this[N] && this[R] !== 0 && this[Mt](!0), this[N] ? this.emit("data", e) : this[Pt](e), this[R] !== 0 && this.emit("readable"), n && r(n), this[N]) : e.length ? (typeof e == "string" && !(t === this[j] && !this[M]?.lastNeed) && (e = Buffer.from(e, t)), Buffer.isBuffer(e) && this[j] && (e = this[M].write(e)), this[N] && this[R] !== 0 && this[Mt](!0), this[N] ? this.emit("data", e) : this[Pt](e), this[R] !== 0 && this.emit("readable"), n && r(n), this[N]) : (this[R] !== 0 && this.emit("readable"), n && r(n), this[N]);
|
|
1481
|
-
}
|
|
1482
|
-
read(e) {
|
|
1483
|
-
if (this[B]) return null;
|
|
1484
|
-
if (this[W] = !1, this[R] === 0 || e === 0 || e && e > this[R]) return this[O](), null;
|
|
1485
|
-
this[z] && (e = null), this[I].length > 1 && !this[z] && (this[I] = [this[j] ? this[I].join("") : Buffer.concat(this[I], this[R])]);
|
|
1486
|
-
let t = this[jt](e || null, this[I][0]);
|
|
1487
|
-
return this[O](), t;
|
|
1488
|
-
}
|
|
1489
|
-
[jt](e, t) {
|
|
1490
|
-
if (this[z]) this[Ft]();
|
|
1491
|
-
else {
|
|
1492
|
-
let n = t;
|
|
1493
|
-
e === n.length || e === null ? this[Ft]() : typeof n == "string" ? (this[I][0] = n.slice(e), t = n.slice(0, e), this[R] -= e) : (this[I][0] = n.subarray(e), t = n.subarray(0, e), this[R] -= e);
|
|
1494
|
-
}
|
|
1495
|
-
return this.emit("data", t), !this[I].length && !this[D] && this.emit("drain"), t;
|
|
1496
|
-
}
|
|
1497
|
-
end(e, t, n) {
|
|
1498
|
-
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = "utf8"), e !== void 0 && this.write(e, t), n && this.once("end", n), this[D] = !0, this.writable = !1, (this[N] || !this[P]) && this[O](), this;
|
|
1499
|
-
}
|
|
1500
|
-
[F]() {
|
|
1501
|
-
this[B] || (!this[U] && !this[L].length && (this[W] = !0), this[P] = !1, this[N] = !0, this.emit("resume"), this[I].length ? this[Mt]() : this[D] ? this[O]() : this.emit("drain"));
|
|
1502
|
-
}
|
|
1503
|
-
resume() {
|
|
1504
|
-
return this[F]();
|
|
1505
|
-
}
|
|
1506
|
-
pause() {
|
|
1507
|
-
this[N] = !1, this[P] = !0, this[W] = !1;
|
|
1508
|
-
}
|
|
1509
|
-
get destroyed() {
|
|
1510
|
-
return this[B];
|
|
1511
|
-
}
|
|
1512
|
-
get flowing() {
|
|
1513
|
-
return this[N];
|
|
1514
|
-
}
|
|
1515
|
-
get paused() {
|
|
1516
|
-
return this[P];
|
|
1517
|
-
}
|
|
1518
|
-
[Pt](e) {
|
|
1519
|
-
this[z] ? this[R] += 1 : this[R] += e.length, this[I].push(e);
|
|
1520
|
-
}
|
|
1521
|
-
[Ft]() {
|
|
1522
|
-
return this[z] ? --this[R] : this[R] -= this[I][0].length, this[I].shift();
|
|
1523
|
-
}
|
|
1524
|
-
[Mt](e = !1) {
|
|
1525
|
-
do ;
|
|
1526
|
-
while (this[Nt](this[Ft]()) && this[I].length);
|
|
1527
|
-
!e && !this[I].length && !this[D] && this.emit("drain");
|
|
1528
|
-
}
|
|
1529
|
-
[Nt](e) {
|
|
1530
|
-
return this.emit("data", e), this[N];
|
|
1531
|
-
}
|
|
1532
|
-
pipe(e, t) {
|
|
1533
|
-
if (this[B]) return e;
|
|
1534
|
-
this[W] = !1;
|
|
1535
|
-
let n = this[k];
|
|
1536
|
-
return t ||= {}, e === Tt.stdout || e === Tt.stderr ? t.end = !1 : t.end = t.end !== !1, t.proxyErrors = !!t.proxyErrors, n ? t.end && e.end() : (this[L].push(t.proxyErrors ? new qt(this, e, t) : new Kt(this, e, t)), this[V] ? G(() => this[F]()) : this[F]()), e;
|
|
1537
|
-
}
|
|
1538
|
-
unpipe(e) {
|
|
1539
|
-
let t = this[L].find((t) => t.dest === e);
|
|
1540
|
-
t && (this[L].length === 1 ? (this[N] && this[U] === 0 && (this[N] = !1), this[L] = []) : this[L].splice(this[L].indexOf(t), 1), t.unpipe());
|
|
1541
|
-
}
|
|
1542
|
-
addListener(e, t) {
|
|
1543
|
-
return this.on(e, t);
|
|
1544
|
-
}
|
|
1545
|
-
on(e, t) {
|
|
1546
|
-
let n = super.on(e, t);
|
|
1547
|
-
if (e === "data") this[W] = !1, this[U]++, !this[L].length && !this[N] && this[F]();
|
|
1548
|
-
else if (e === "readable" && this[R] !== 0) super.emit("readable");
|
|
1549
|
-
else if (Ut(e) && this[k]) super.emit(e), this.removeAllListeners(e);
|
|
1550
|
-
else if (e === "error" && this[A]) {
|
|
1551
|
-
let e = t;
|
|
1552
|
-
this[V] ? G(() => e.call(this, this[A])) : e.call(this, this[A]);
|
|
1553
|
-
}
|
|
1554
|
-
return n;
|
|
1555
|
-
}
|
|
1556
|
-
removeListener(e, t) {
|
|
1557
|
-
return this.off(e, t);
|
|
1558
|
-
}
|
|
1559
|
-
off(e, t) {
|
|
1560
|
-
let n = super.off(e, t);
|
|
1561
|
-
return e === "data" && (this[U] = this.listeners("data").length, this[U] === 0 && !this[W] && !this[L].length && (this[N] = !1)), n;
|
|
1562
|
-
}
|
|
1563
|
-
removeAllListeners(e) {
|
|
1564
|
-
let t = super.removeAllListeners(e);
|
|
1565
|
-
return (e === "data" || e === void 0) && (this[U] = 0, !this[W] && !this[L].length && (this[N] = !1)), t;
|
|
1566
|
-
}
|
|
1567
|
-
get emittedEnd() {
|
|
1568
|
-
return this[k];
|
|
1569
|
-
}
|
|
1570
|
-
[O]() {
|
|
1571
|
-
!this[kt] && !this[k] && !this[B] && this[I].length === 0 && this[D] && (this[kt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[At] && this.emit("close"), this[kt] = !1);
|
|
1572
|
-
}
|
|
1573
|
-
emit(e, ...t) {
|
|
1574
|
-
let n = t[0];
|
|
1575
|
-
if (e !== "error" && e !== "close" && e !== B && this[B]) return !1;
|
|
1576
|
-
if (e === "data") return !this[z] && !n ? !1 : this[V] ? (G(() => this[Lt](n)), !0) : this[Lt](n);
|
|
1577
|
-
if (e === "end") return this[Rt]();
|
|
1578
|
-
if (e === "close") {
|
|
1579
|
-
if (this[At] = !0, !this[k] && !this[B]) return !1;
|
|
1580
|
-
let e = super.emit("close");
|
|
1581
|
-
return this.removeAllListeners("close"), e;
|
|
1582
|
-
} else if (e === "error") {
|
|
1583
|
-
this[A] = n, super.emit(It, n);
|
|
1584
|
-
let e = !this[H] || this.listeners("error").length ? super.emit("error", n) : !1;
|
|
1585
|
-
return this[O](), e;
|
|
1586
|
-
} else if (e === "resume") {
|
|
1587
|
-
let e = super.emit("resume");
|
|
1588
|
-
return this[O](), e;
|
|
1589
|
-
} else if (e === "finish" || e === "prefinish") {
|
|
1590
|
-
let t = super.emit(e);
|
|
1591
|
-
return this.removeAllListeners(e), t;
|
|
1592
|
-
}
|
|
1593
|
-
let r = super.emit(e, ...t);
|
|
1594
|
-
return this[O](), r;
|
|
1595
|
-
}
|
|
1596
|
-
[Lt](e) {
|
|
1597
|
-
for (let t of this[L]) t.dest.write(e) === !1 && this.pause();
|
|
1598
|
-
let t = this[W] ? !1 : super.emit("data", e);
|
|
1599
|
-
return this[O](), t;
|
|
1600
|
-
}
|
|
1601
|
-
[Rt]() {
|
|
1602
|
-
return this[k] ? !1 : (this[k] = !0, this.readable = !1, this[V] ? (G(() => this[zt]()), !0) : this[zt]());
|
|
1603
|
-
}
|
|
1604
|
-
[zt]() {
|
|
1605
|
-
if (this[M]) {
|
|
1606
|
-
let e = this[M].end();
|
|
1607
|
-
if (e) {
|
|
1608
|
-
for (let t of this[L]) t.dest.write(e);
|
|
1609
|
-
this[W] || super.emit("data", e);
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
for (let e of this[L]) e.end();
|
|
1613
|
-
let e = super.emit("end");
|
|
1614
|
-
return this.removeAllListeners("end"), e;
|
|
1615
|
-
}
|
|
1616
|
-
async collect() {
|
|
1617
|
-
let e = Object.assign([], { dataLength: 0 });
|
|
1618
|
-
this[z] || (e.dataLength = 0);
|
|
1619
|
-
let t = this.promise();
|
|
1620
|
-
return this.on("data", (t) => {
|
|
1621
|
-
e.push(t), this[z] || (e.dataLength += t.length);
|
|
1622
|
-
}), await t, e;
|
|
1623
|
-
}
|
|
1624
|
-
async concat() {
|
|
1625
|
-
if (this[z]) throw Error("cannot concat in objectMode");
|
|
1626
|
-
let e = await this.collect();
|
|
1627
|
-
return this[j] ? e.join("") : Buffer.concat(e, e.dataLength);
|
|
1628
|
-
}
|
|
1629
|
-
async promise() {
|
|
1630
|
-
return new Promise((e, t) => {
|
|
1631
|
-
this.on(B, () => t(/* @__PURE__ */ Error("stream destroyed"))), this.on("error", (e) => t(e)), this.on("end", () => e());
|
|
1632
|
-
});
|
|
1633
|
-
}
|
|
1634
|
-
[Symbol.asyncIterator]() {
|
|
1635
|
-
this[W] = !1;
|
|
1636
|
-
let e = !1, t = async () => (this.pause(), e = !0, {
|
|
1637
|
-
value: void 0,
|
|
1638
|
-
done: !0
|
|
1639
|
-
});
|
|
1640
|
-
return {
|
|
1641
|
-
next: () => {
|
|
1642
|
-
if (e) return t();
|
|
1643
|
-
let n = this.read();
|
|
1644
|
-
if (n !== null) return Promise.resolve({
|
|
1645
|
-
done: !1,
|
|
1646
|
-
value: n
|
|
1647
|
-
});
|
|
1648
|
-
if (this[D]) return t();
|
|
1649
|
-
let r, i, a = (e) => {
|
|
1650
|
-
this.off("data", o), this.off("end", s), this.off(B, c), t(), i(e);
|
|
1651
|
-
}, o = (e) => {
|
|
1652
|
-
this.off("error", a), this.off("end", s), this.off(B, c), this.pause(), r({
|
|
1653
|
-
value: e,
|
|
1654
|
-
done: !!this[D]
|
|
1655
|
-
});
|
|
1656
|
-
}, s = () => {
|
|
1657
|
-
this.off("error", a), this.off("data", o), this.off(B, c), t(), r({
|
|
1658
|
-
done: !0,
|
|
1659
|
-
value: void 0
|
|
1660
|
-
});
|
|
1661
|
-
}, c = () => a(/* @__PURE__ */ Error("stream destroyed"));
|
|
1662
|
-
return new Promise((e, t) => {
|
|
1663
|
-
i = t, r = e, this.once(B, c), this.once("error", a), this.once("end", s), this.once("data", o);
|
|
1664
|
-
});
|
|
1665
|
-
},
|
|
1666
|
-
throw: t,
|
|
1667
|
-
return: t,
|
|
1668
|
-
[Symbol.asyncIterator]() {
|
|
1669
|
-
return this;
|
|
1670
|
-
},
|
|
1671
|
-
[Symbol.asyncDispose]: async () => {}
|
|
1672
|
-
};
|
|
1673
|
-
}
|
|
1674
|
-
[Symbol.iterator]() {
|
|
1675
|
-
this[W] = !1;
|
|
1676
|
-
let e = !1, t = () => (this.pause(), this.off(It, t), this.off(B, t), this.off("end", t), e = !0, {
|
|
1677
|
-
done: !0,
|
|
1678
|
-
value: void 0
|
|
1679
|
-
});
|
|
1680
|
-
return this.once("end", t), this.once(It, t), this.once(B, t), {
|
|
1681
|
-
next: () => {
|
|
1682
|
-
if (e) return t();
|
|
1683
|
-
let n = this.read();
|
|
1684
|
-
return n === null ? t() : {
|
|
1685
|
-
done: !1,
|
|
1686
|
-
value: n
|
|
1687
|
-
};
|
|
1688
|
-
},
|
|
1689
|
-
throw: t,
|
|
1690
|
-
return: t,
|
|
1691
|
-
[Symbol.iterator]() {
|
|
1692
|
-
return this;
|
|
1693
|
-
},
|
|
1694
|
-
[Symbol.dispose]: () => {}
|
|
1695
|
-
};
|
|
1696
|
-
}
|
|
1697
|
-
destroy(e) {
|
|
1698
|
-
if (this[B]) return e ? this.emit("error", e) : this.emit(B), this;
|
|
1699
|
-
this[B] = !0, this[W] = !0, this[I].length = 0, this[R] = 0;
|
|
1700
|
-
let t = this;
|
|
1701
|
-
return typeof t.close == "function" && !this[At] && t.close(), e ? this.emit("error", e) : this.emit(B), this;
|
|
1702
|
-
}
|
|
1703
|
-
static get isStream() {
|
|
1704
|
-
return Et;
|
|
1705
|
-
}
|
|
1706
|
-
}, K = {
|
|
1707
|
-
lstatSync: f.lstatSync,
|
|
1708
|
-
readdir: f.readdir,
|
|
1709
|
-
readdirSync: f.readdirSync,
|
|
1710
|
-
readlinkSync: f.readlinkSync,
|
|
1711
|
-
realpathSync: f.realpathSync.native,
|
|
1712
|
-
promises: {
|
|
1713
|
-
lstat: a,
|
|
1714
|
-
readdir: o,
|
|
1715
|
-
readlink: s,
|
|
1716
|
-
realpath: c
|
|
1717
|
-
}
|
|
1718
|
-
}, Zt = (e) => !e || e === K || e === i ? K : {
|
|
1719
|
-
...K,
|
|
1720
|
-
...e,
|
|
1721
|
-
promises: {
|
|
1722
|
-
...K.promises,
|
|
1723
|
-
...e.promises || {}
|
|
1724
|
-
}
|
|
1725
|
-
}, Qt = /^\\\\\?\\([a-z]:)\\?$/i, $t = (e) => e.replace(/\//g, "\\").replace(Qt, "$1\\"), en = /[\\\/]/, q = 0, tn = 1, nn = 2, J = 4, rn = 6, an = 8, Y = 10, on = 12, X = 15, sn = ~X, cn = 16, ln = 32, un = 64, Z = 128, dn = 256, fn = 512, pn = un | Z | fn, mn = 1023, hn = (e) => e.isFile() ? an : e.isDirectory() ? J : e.isSymbolicLink() ? Y : e.isCharacterDevice() ? nn : e.isBlockDevice() ? rn : e.isSocket() ? on : e.isFIFO() ? tn : q, gn = new wt({ max: 2 ** 12 }), _n = (e) => {
|
|
1726
|
-
let t = gn.get(e);
|
|
1727
|
-
if (t) return t;
|
|
1728
|
-
let n = e.normalize("NFKD");
|
|
1729
|
-
return gn.set(e, n), n;
|
|
1730
|
-
}, vn = new wt({ max: 2 ** 12 }), yn = (e) => {
|
|
1731
|
-
let t = vn.get(e);
|
|
1732
|
-
if (t) return t;
|
|
1733
|
-
let n = _n(e.toLowerCase());
|
|
1734
|
-
return vn.set(e, n), n;
|
|
1735
|
-
}, bn = class extends wt {
|
|
1736
|
-
constructor() {
|
|
1737
|
-
super({ max: 256 });
|
|
1738
|
-
}
|
|
1739
|
-
}, xn = class extends wt {
|
|
1740
|
-
constructor(e = 16 * 1024) {
|
|
1741
|
-
super({
|
|
1742
|
-
maxSize: e,
|
|
1743
|
-
sizeCalculation: (e) => e.length + 1
|
|
1744
|
-
});
|
|
1745
|
-
}
|
|
1746
|
-
}, Sn = Symbol("PathScurry setAsCwd"), Q = class {
|
|
1747
|
-
name;
|
|
1748
|
-
root;
|
|
1749
|
-
roots;
|
|
1750
|
-
parent;
|
|
1751
|
-
nocase;
|
|
1752
|
-
isCWD = !1;
|
|
1753
|
-
#e;
|
|
1754
|
-
#t;
|
|
1755
|
-
get dev() {
|
|
1756
|
-
return this.#t;
|
|
1757
|
-
}
|
|
1758
|
-
#n;
|
|
1759
|
-
get mode() {
|
|
1760
|
-
return this.#n;
|
|
1761
|
-
}
|
|
1762
|
-
#r;
|
|
1763
|
-
get nlink() {
|
|
1764
|
-
return this.#r;
|
|
1765
|
-
}
|
|
1766
|
-
#i;
|
|
1767
|
-
get uid() {
|
|
1768
|
-
return this.#i;
|
|
1769
|
-
}
|
|
1770
|
-
#a;
|
|
1771
|
-
get gid() {
|
|
1772
|
-
return this.#a;
|
|
1773
|
-
}
|
|
1774
|
-
#o;
|
|
1775
|
-
get rdev() {
|
|
1776
|
-
return this.#o;
|
|
1777
|
-
}
|
|
1778
|
-
#s;
|
|
1779
|
-
get blksize() {
|
|
1780
|
-
return this.#s;
|
|
1781
|
-
}
|
|
1782
|
-
#c;
|
|
1783
|
-
get ino() {
|
|
1784
|
-
return this.#c;
|
|
1785
|
-
}
|
|
1786
|
-
#l;
|
|
1787
|
-
get size() {
|
|
1788
|
-
return this.#l;
|
|
1789
|
-
}
|
|
1790
|
-
#u;
|
|
1791
|
-
get blocks() {
|
|
1792
|
-
return this.#u;
|
|
1793
|
-
}
|
|
1794
|
-
#d;
|
|
1795
|
-
get atimeMs() {
|
|
1796
|
-
return this.#d;
|
|
1797
|
-
}
|
|
1798
|
-
#f;
|
|
1799
|
-
get mtimeMs() {
|
|
1800
|
-
return this.#f;
|
|
1801
|
-
}
|
|
1802
|
-
#p;
|
|
1803
|
-
get ctimeMs() {
|
|
1804
|
-
return this.#p;
|
|
1805
|
-
}
|
|
1806
|
-
#m;
|
|
1807
|
-
get birthtimeMs() {
|
|
1808
|
-
return this.#m;
|
|
1809
|
-
}
|
|
1810
|
-
#h;
|
|
1811
|
-
get atime() {
|
|
1812
|
-
return this.#h;
|
|
1813
|
-
}
|
|
1814
|
-
#g;
|
|
1815
|
-
get mtime() {
|
|
1816
|
-
return this.#g;
|
|
1817
|
-
}
|
|
1818
|
-
#_;
|
|
1819
|
-
get ctime() {
|
|
1820
|
-
return this.#_;
|
|
1821
|
-
}
|
|
1822
|
-
#v;
|
|
1823
|
-
get birthtime() {
|
|
1824
|
-
return this.#v;
|
|
1825
|
-
}
|
|
1826
|
-
#y;
|
|
1827
|
-
#b;
|
|
1828
|
-
#x;
|
|
1829
|
-
#S;
|
|
1830
|
-
#C;
|
|
1831
|
-
#w;
|
|
1832
|
-
#T;
|
|
1833
|
-
#E;
|
|
1834
|
-
#D;
|
|
1835
|
-
#O;
|
|
1836
|
-
get parentPath() {
|
|
1837
|
-
return (this.parent || this).fullpath();
|
|
1838
|
-
}
|
|
1839
|
-
get path() {
|
|
1840
|
-
return this.parentPath;
|
|
1841
|
-
}
|
|
1842
|
-
constructor(e, t = q, n, r, i, a, o) {
|
|
1843
|
-
this.name = e, this.#y = i ? yn(e) : _n(e), this.#T = t & mn, this.nocase = i, this.roots = r, this.root = n || this, this.#E = a, this.#x = o.fullpath, this.#C = o.relative, this.#w = o.relativePosix, this.parent = o.parent, this.parent ? this.#e = this.parent.#e : this.#e = Zt(o.fs);
|
|
1844
|
-
}
|
|
1845
|
-
depth() {
|
|
1846
|
-
return this.#b === void 0 ? this.parent ? this.#b = this.parent.depth() + 1 : this.#b = 0 : this.#b;
|
|
1847
|
-
}
|
|
1848
|
-
childrenCache() {
|
|
1849
|
-
return this.#E;
|
|
1850
|
-
}
|
|
1851
|
-
resolve(e) {
|
|
1852
|
-
if (!e) return this;
|
|
1853
|
-
let t = this.getRootString(e), n = e.substring(t.length).split(this.splitSep);
|
|
1854
|
-
return t ? this.getRoot(t).#k(n) : this.#k(n);
|
|
1855
|
-
}
|
|
1856
|
-
#k(e) {
|
|
1857
|
-
let t = this;
|
|
1858
|
-
for (let n of e) t = t.child(n);
|
|
1859
|
-
return t;
|
|
1860
|
-
}
|
|
1861
|
-
children() {
|
|
1862
|
-
let e = this.#E.get(this);
|
|
1863
|
-
if (e) return e;
|
|
1864
|
-
let t = Object.assign([], { provisional: 0 });
|
|
1865
|
-
return this.#E.set(this, t), this.#T &= ~cn, t;
|
|
1866
|
-
}
|
|
1867
|
-
child(e, t) {
|
|
1868
|
-
if (e === "" || e === ".") return this;
|
|
1869
|
-
if (e === "..") return this.parent || this;
|
|
1870
|
-
let n = this.children(), r = this.nocase ? yn(e) : _n(e);
|
|
1871
|
-
for (let e of n) if (e.#y === r) return e;
|
|
1872
|
-
let i = this.parent ? this.sep : "", a = this.#x ? this.#x + i + e : void 0, o = this.newChild(e, q, {
|
|
1873
|
-
...t,
|
|
1874
|
-
parent: this,
|
|
1875
|
-
fullpath: a
|
|
1876
|
-
});
|
|
1877
|
-
return this.canReaddir() || (o.#T |= Z), n.push(o), o;
|
|
1878
|
-
}
|
|
1879
|
-
relative() {
|
|
1880
|
-
if (this.isCWD) return "";
|
|
1881
|
-
if (this.#C !== void 0) return this.#C;
|
|
1882
|
-
let e = this.name, t = this.parent;
|
|
1883
|
-
if (!t) return this.#C = this.name;
|
|
1884
|
-
let n = t.relative();
|
|
1885
|
-
return n + (!n || !t.parent ? "" : this.sep) + e;
|
|
1886
|
-
}
|
|
1887
|
-
relativePosix() {
|
|
1888
|
-
if (this.sep === "/") return this.relative();
|
|
1889
|
-
if (this.isCWD) return "";
|
|
1890
|
-
if (this.#w !== void 0) return this.#w;
|
|
1891
|
-
let e = this.name, t = this.parent;
|
|
1892
|
-
if (!t) return this.#w = this.fullpathPosix();
|
|
1893
|
-
let n = t.relativePosix();
|
|
1894
|
-
return n + (!n || !t.parent ? "" : "/") + e;
|
|
1895
|
-
}
|
|
1896
|
-
fullpath() {
|
|
1897
|
-
if (this.#x !== void 0) return this.#x;
|
|
1898
|
-
let e = this.name, t = this.parent;
|
|
1899
|
-
if (!t) return this.#x = this.name;
|
|
1900
|
-
let n = t.fullpath() + (t.parent ? this.sep : "") + e;
|
|
1901
|
-
return this.#x = n;
|
|
1902
|
-
}
|
|
1903
|
-
fullpathPosix() {
|
|
1904
|
-
if (this.#S !== void 0) return this.#S;
|
|
1905
|
-
if (this.sep === "/") return this.#S = this.fullpath();
|
|
1906
|
-
if (!this.parent) {
|
|
1907
|
-
let e = this.fullpath().replace(/\\/g, "/");
|
|
1908
|
-
return /^[a-z]:\//i.test(e) ? this.#S = `//?/${e}` : this.#S = e;
|
|
1909
|
-
}
|
|
1910
|
-
let e = this.parent, t = e.fullpathPosix(), n = t + (!t || !e.parent ? "" : "/") + this.name;
|
|
1911
|
-
return this.#S = n;
|
|
1912
|
-
}
|
|
1913
|
-
isUnknown() {
|
|
1914
|
-
return (this.#T & X) === q;
|
|
1915
|
-
}
|
|
1916
|
-
isType(e) {
|
|
1917
|
-
return this[`is${e}`]();
|
|
1918
|
-
}
|
|
1919
|
-
getType() {
|
|
1920
|
-
return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
|
|
1921
|
-
}
|
|
1922
|
-
isFile() {
|
|
1923
|
-
return (this.#T & X) === an;
|
|
1924
|
-
}
|
|
1925
|
-
isDirectory() {
|
|
1926
|
-
return (this.#T & X) === J;
|
|
1927
|
-
}
|
|
1928
|
-
isCharacterDevice() {
|
|
1929
|
-
return (this.#T & X) === nn;
|
|
1930
|
-
}
|
|
1931
|
-
isBlockDevice() {
|
|
1932
|
-
return (this.#T & X) === rn;
|
|
1933
|
-
}
|
|
1934
|
-
isFIFO() {
|
|
1935
|
-
return (this.#T & X) === tn;
|
|
1936
|
-
}
|
|
1937
|
-
isSocket() {
|
|
1938
|
-
return (this.#T & X) === on;
|
|
1939
|
-
}
|
|
1940
|
-
isSymbolicLink() {
|
|
1941
|
-
return (this.#T & Y) === Y;
|
|
1942
|
-
}
|
|
1943
|
-
lstatCached() {
|
|
1944
|
-
return this.#T & ln ? this : void 0;
|
|
1945
|
-
}
|
|
1946
|
-
readlinkCached() {
|
|
1947
|
-
return this.#D;
|
|
1948
|
-
}
|
|
1949
|
-
realpathCached() {
|
|
1950
|
-
return this.#O;
|
|
1951
|
-
}
|
|
1952
|
-
readdirCached() {
|
|
1953
|
-
let e = this.children();
|
|
1954
|
-
return e.slice(0, e.provisional);
|
|
1955
|
-
}
|
|
1956
|
-
canReadlink() {
|
|
1957
|
-
if (this.#D) return !0;
|
|
1958
|
-
if (!this.parent) return !1;
|
|
1959
|
-
let e = this.#T & X;
|
|
1960
|
-
return !(e !== q && e !== Y || this.#T & dn || this.#T & Z);
|
|
1961
|
-
}
|
|
1962
|
-
calledReaddir() {
|
|
1963
|
-
return !!(this.#T & cn);
|
|
1964
|
-
}
|
|
1965
|
-
isENOENT() {
|
|
1966
|
-
return !!(this.#T & Z);
|
|
1967
|
-
}
|
|
1968
|
-
isNamed(e) {
|
|
1969
|
-
return this.nocase ? this.#y === yn(e) : this.#y === _n(e);
|
|
1970
|
-
}
|
|
1971
|
-
async readlink() {
|
|
1972
|
-
let e = this.#D;
|
|
1973
|
-
if (e) return e;
|
|
1974
|
-
if (this.canReadlink() && this.parent) try {
|
|
1975
|
-
let e = await this.#e.promises.readlink(this.fullpath()), t = (await this.parent.realpath())?.resolve(e);
|
|
1976
|
-
if (t) return this.#D = t;
|
|
1977
|
-
} catch (e) {
|
|
1978
|
-
this.#L(e.code);
|
|
1979
|
-
return;
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
readlinkSync() {
|
|
1983
|
-
let e = this.#D;
|
|
1984
|
-
if (e) return e;
|
|
1985
|
-
if (this.canReadlink() && this.parent) try {
|
|
1986
|
-
let e = this.#e.readlinkSync(this.fullpath()), t = this.parent.realpathSync()?.resolve(e);
|
|
1987
|
-
if (t) return this.#D = t;
|
|
1988
|
-
} catch (e) {
|
|
1989
|
-
this.#L(e.code);
|
|
1990
|
-
return;
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
#A(e) {
|
|
1994
|
-
this.#T |= cn;
|
|
1995
|
-
for (let t = e.provisional; t < e.length; t++) {
|
|
1996
|
-
let n = e[t];
|
|
1997
|
-
n && n.#j();
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
#j() {
|
|
2001
|
-
this.#T & Z || (this.#T = (this.#T | Z) & sn, this.#M());
|
|
2002
|
-
}
|
|
2003
|
-
#M() {
|
|
2004
|
-
let e = this.children();
|
|
2005
|
-
e.provisional = 0;
|
|
2006
|
-
for (let t of e) t.#j();
|
|
2007
|
-
}
|
|
2008
|
-
#N() {
|
|
2009
|
-
this.#T |= fn, this.#P();
|
|
2010
|
-
}
|
|
2011
|
-
#P() {
|
|
2012
|
-
if (this.#T & un) return;
|
|
2013
|
-
let e = this.#T;
|
|
2014
|
-
(e & X) === J && (e &= sn), this.#T = e | un, this.#M();
|
|
2015
|
-
}
|
|
2016
|
-
#F(e = "") {
|
|
2017
|
-
e === "ENOTDIR" || e === "EPERM" ? this.#P() : e === "ENOENT" ? this.#j() : this.children().provisional = 0;
|
|
2018
|
-
}
|
|
2019
|
-
#I(e = "") {
|
|
2020
|
-
e === "ENOTDIR" ? this.parent.#P() : e === "ENOENT" && this.#j();
|
|
2021
|
-
}
|
|
2022
|
-
#L(e = "") {
|
|
2023
|
-
let t = this.#T;
|
|
2024
|
-
t |= dn, e === "ENOENT" && (t |= Z), (e === "EINVAL" || e === "UNKNOWN") && (t &= sn), this.#T = t, e === "ENOTDIR" && this.parent && this.parent.#P();
|
|
2025
|
-
}
|
|
2026
|
-
#R(e, t) {
|
|
2027
|
-
return this.#B(e, t) || this.#z(e, t);
|
|
2028
|
-
}
|
|
2029
|
-
#z(e, t) {
|
|
2030
|
-
let n = hn(e), r = this.newChild(e.name, n, { parent: this }), i = r.#T & X;
|
|
2031
|
-
return i !== J && i !== Y && i !== q && (r.#T |= un), t.unshift(r), t.provisional++, r;
|
|
2032
|
-
}
|
|
2033
|
-
#B(e, t) {
|
|
2034
|
-
for (let n = t.provisional; n < t.length; n++) {
|
|
2035
|
-
let r = t[n];
|
|
2036
|
-
if ((this.nocase ? yn(e.name) : _n(e.name)) === r.#y) return this.#V(e, r, n, t);
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
#V(e, t, n, r) {
|
|
2040
|
-
let i = t.name;
|
|
2041
|
-
return t.#T = t.#T & sn | hn(e), i !== e.name && (t.name = e.name), n !== r.provisional && (n === r.length - 1 ? r.pop() : r.splice(n, 1), r.unshift(t)), r.provisional++, t;
|
|
2042
|
-
}
|
|
2043
|
-
async lstat() {
|
|
2044
|
-
if ((this.#T & Z) === 0) try {
|
|
2045
|
-
return this.#H(await this.#e.promises.lstat(this.fullpath())), this;
|
|
2046
|
-
} catch (e) {
|
|
2047
|
-
this.#I(e.code);
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
lstatSync() {
|
|
2051
|
-
if ((this.#T & Z) === 0) try {
|
|
2052
|
-
return this.#H(this.#e.lstatSync(this.fullpath())), this;
|
|
2053
|
-
} catch (e) {
|
|
2054
|
-
this.#I(e.code);
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
#H(e) {
|
|
2058
|
-
let { atime: t, atimeMs: n, birthtime: r, birthtimeMs: i, blksize: a, blocks: o, ctime: s, ctimeMs: c, dev: l, gid: u, ino: d, mode: f, mtime: p, mtimeMs: m, nlink: ee, rdev: h, size: g, uid: _ } = e;
|
|
2059
|
-
this.#h = t, this.#d = n, this.#v = r, this.#m = i, this.#s = a, this.#u = o, this.#_ = s, this.#p = c, this.#t = l, this.#a = u, this.#c = d, this.#n = f, this.#g = p, this.#f = m, this.#r = ee, this.#o = h, this.#l = g, this.#i = _;
|
|
2060
|
-
let v = hn(e);
|
|
2061
|
-
this.#T = this.#T & sn | v | ln, v !== q && v !== J && v !== Y && (this.#T |= un);
|
|
2062
|
-
}
|
|
2063
|
-
#U = [];
|
|
2064
|
-
#W = !1;
|
|
2065
|
-
#G(e) {
|
|
2066
|
-
this.#W = !1;
|
|
2067
|
-
let t = this.#U.slice();
|
|
2068
|
-
this.#U.length = 0, t.forEach((t) => t(null, e));
|
|
2069
|
-
}
|
|
2070
|
-
readdirCB(e, t = !1) {
|
|
2071
|
-
if (!this.canReaddir()) {
|
|
2072
|
-
t ? e(null, []) : queueMicrotask(() => e(null, []));
|
|
2073
|
-
return;
|
|
2074
|
-
}
|
|
2075
|
-
let n = this.children();
|
|
2076
|
-
if (this.calledReaddir()) {
|
|
2077
|
-
let r = n.slice(0, n.provisional);
|
|
2078
|
-
t ? e(null, r) : queueMicrotask(() => e(null, r));
|
|
2079
|
-
return;
|
|
2080
|
-
}
|
|
2081
|
-
if (this.#U.push(e), this.#W) return;
|
|
2082
|
-
this.#W = !0;
|
|
2083
|
-
let r = this.fullpath();
|
|
2084
|
-
this.#e.readdir(r, { withFileTypes: !0 }, (e, t) => {
|
|
2085
|
-
if (e) this.#F(e.code), n.provisional = 0;
|
|
2086
|
-
else {
|
|
2087
|
-
for (let e of t) this.#R(e, n);
|
|
2088
|
-
this.#A(n);
|
|
2089
|
-
}
|
|
2090
|
-
this.#G(n.slice(0, n.provisional));
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
#K;
|
|
2094
|
-
async readdir() {
|
|
2095
|
-
if (!this.canReaddir()) return [];
|
|
2096
|
-
let e = this.children();
|
|
2097
|
-
if (this.calledReaddir()) return e.slice(0, e.provisional);
|
|
2098
|
-
let t = this.fullpath();
|
|
2099
|
-
if (this.#K) await this.#K;
|
|
2100
|
-
else {
|
|
2101
|
-
let n = () => {};
|
|
2102
|
-
this.#K = new Promise((e) => n = e);
|
|
2103
|
-
try {
|
|
2104
|
-
for (let n of await this.#e.promises.readdir(t, { withFileTypes: !0 })) this.#R(n, e);
|
|
2105
|
-
this.#A(e);
|
|
2106
|
-
} catch (t) {
|
|
2107
|
-
this.#F(t.code), e.provisional = 0;
|
|
2108
|
-
}
|
|
2109
|
-
this.#K = void 0, n();
|
|
2110
|
-
}
|
|
2111
|
-
return e.slice(0, e.provisional);
|
|
2112
|
-
}
|
|
2113
|
-
readdirSync() {
|
|
2114
|
-
if (!this.canReaddir()) return [];
|
|
2115
|
-
let e = this.children();
|
|
2116
|
-
if (this.calledReaddir()) return e.slice(0, e.provisional);
|
|
2117
|
-
let t = this.fullpath();
|
|
2118
|
-
try {
|
|
2119
|
-
for (let n of this.#e.readdirSync(t, { withFileTypes: !0 })) this.#R(n, e);
|
|
2120
|
-
this.#A(e);
|
|
2121
|
-
} catch (t) {
|
|
2122
|
-
this.#F(t.code), e.provisional = 0;
|
|
2123
|
-
}
|
|
2124
|
-
return e.slice(0, e.provisional);
|
|
2125
|
-
}
|
|
2126
|
-
canReaddir() {
|
|
2127
|
-
if (this.#T & pn) return !1;
|
|
2128
|
-
let e = X & this.#T;
|
|
2129
|
-
return e === q || e === J || e === Y;
|
|
2130
|
-
}
|
|
2131
|
-
shouldWalk(e, t) {
|
|
2132
|
-
return (this.#T & J) === J && !(this.#T & pn) && !e.has(this) && (!t || t(this));
|
|
2133
|
-
}
|
|
2134
|
-
async realpath() {
|
|
2135
|
-
if (this.#O) return this.#O;
|
|
2136
|
-
if (!((fn | dn | Z) & this.#T)) try {
|
|
2137
|
-
let e = await this.#e.promises.realpath(this.fullpath());
|
|
2138
|
-
return this.#O = this.resolve(e);
|
|
2139
|
-
} catch {
|
|
2140
|
-
this.#N();
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
realpathSync() {
|
|
2144
|
-
if (this.#O) return this.#O;
|
|
2145
|
-
if (!((fn | dn | Z) & this.#T)) try {
|
|
2146
|
-
let e = this.#e.realpathSync(this.fullpath());
|
|
2147
|
-
return this.#O = this.resolve(e);
|
|
2148
|
-
} catch {
|
|
2149
|
-
this.#N();
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
[Sn](e) {
|
|
2153
|
-
if (e === this) return;
|
|
2154
|
-
e.isCWD = !1, this.isCWD = !0;
|
|
2155
|
-
let t = /* @__PURE__ */ new Set([]), n = [], r = this;
|
|
2156
|
-
for (; r && r.parent;) t.add(r), r.#C = n.join(this.sep), r.#w = n.join("/"), r = r.parent, n.push("..");
|
|
2157
|
-
for (r = e; r && r.parent && !t.has(r);) r.#C = void 0, r.#w = void 0, r = r.parent;
|
|
2158
|
-
}
|
|
2159
|
-
}, Cn = class e extends Q {
|
|
2160
|
-
sep = "\\";
|
|
2161
|
-
splitSep = en;
|
|
2162
|
-
constructor(e, t = q, n, r, i, a, o) {
|
|
2163
|
-
super(e, t, n, r, i, a, o);
|
|
2164
|
-
}
|
|
2165
|
-
newChild(t, n = q, r = {}) {
|
|
2166
|
-
return new e(t, n, this.root, this.roots, this.nocase, this.childrenCache(), r);
|
|
2167
|
-
}
|
|
2168
|
-
getRootString(e) {
|
|
2169
|
-
return n.parse(e).root;
|
|
2170
|
-
}
|
|
2171
|
-
getRoot(e) {
|
|
2172
|
-
if (e = $t(e.toUpperCase()), e === this.root.name) return this.root;
|
|
2173
|
-
for (let [t, n] of Object.entries(this.roots)) if (this.sameRoot(e, t)) return this.roots[e] = n;
|
|
2174
|
-
return this.roots[e] = new En(e, this).root;
|
|
2175
|
-
}
|
|
2176
|
-
sameRoot(e, t = this.root.name) {
|
|
2177
|
-
return e = e.toUpperCase().replace(/\//g, "\\").replace(Qt, "$1\\"), e === t;
|
|
2178
|
-
}
|
|
2179
|
-
}, wn = class e extends Q {
|
|
2180
|
-
splitSep = "/";
|
|
2181
|
-
sep = "/";
|
|
2182
|
-
constructor(e, t = q, n, r, i, a, o) {
|
|
2183
|
-
super(e, t, n, r, i, a, o);
|
|
2184
|
-
}
|
|
2185
|
-
getRootString(e) {
|
|
2186
|
-
return e.startsWith("/") ? "/" : "";
|
|
2187
|
-
}
|
|
2188
|
-
getRoot(e) {
|
|
2189
|
-
return this.root;
|
|
2190
|
-
}
|
|
2191
|
-
newChild(t, n = q, r = {}) {
|
|
2192
|
-
return new e(t, n, this.root, this.roots, this.nocase, this.childrenCache(), r);
|
|
2193
|
-
}
|
|
2194
|
-
}, Tn = class {
|
|
2195
|
-
root;
|
|
2196
|
-
rootPath;
|
|
2197
|
-
roots;
|
|
2198
|
-
cwd;
|
|
2199
|
-
#e;
|
|
2200
|
-
#t;
|
|
2201
|
-
#n;
|
|
2202
|
-
nocase;
|
|
2203
|
-
#r;
|
|
2204
|
-
constructor(e = process.cwd(), t, n, { nocase: i, childrenCacheSize: a = 16 * 1024, fs: o = K } = {}) {
|
|
2205
|
-
this.#r = Zt(o), (e instanceof URL || e.startsWith("file://")) && (e = r(e));
|
|
2206
|
-
let s = t.resolve(e);
|
|
2207
|
-
this.roots = Object.create(null), this.rootPath = this.parseRootPath(s), this.#e = new bn(), this.#t = new bn(), this.#n = new xn(a);
|
|
2208
|
-
let c = s.substring(this.rootPath.length).split(n);
|
|
2209
|
-
if (c.length === 1 && !c[0] && c.pop(), i === void 0) throw TypeError("must provide nocase setting to PathScurryBase ctor");
|
|
2210
|
-
this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
|
|
2211
|
-
let l = this.root, u = c.length - 1, d = t.sep, f = this.rootPath, p = !1;
|
|
2212
|
-
for (let e of c) {
|
|
2213
|
-
let t = u--;
|
|
2214
|
-
l = l.child(e, {
|
|
2215
|
-
relative: Array(t).fill("..").join(d),
|
|
2216
|
-
relativePosix: Array(t).fill("..").join("/"),
|
|
2217
|
-
fullpath: f += (p ? "" : d) + e
|
|
2218
|
-
}), p = !0;
|
|
2219
|
-
}
|
|
2220
|
-
this.cwd = l;
|
|
2221
|
-
}
|
|
2222
|
-
depth(e = this.cwd) {
|
|
2223
|
-
return typeof e == "string" && (e = this.cwd.resolve(e)), e.depth();
|
|
2224
|
-
}
|
|
2225
|
-
childrenCache() {
|
|
2226
|
-
return this.#n;
|
|
2227
|
-
}
|
|
2228
|
-
resolve(...e) {
|
|
2229
|
-
let t = "";
|
|
2230
|
-
for (let n = e.length - 1; n >= 0; n--) {
|
|
2231
|
-
let r = e[n];
|
|
2232
|
-
if (!(!r || r === ".") && (t = t ? `${r}/${t}` : r, this.isAbsolute(r))) break;
|
|
2233
|
-
}
|
|
2234
|
-
let n = this.#e.get(t);
|
|
2235
|
-
if (n !== void 0) return n;
|
|
2236
|
-
let r = this.cwd.resolve(t).fullpath();
|
|
2237
|
-
return this.#e.set(t, r), r;
|
|
2238
|
-
}
|
|
2239
|
-
resolvePosix(...e) {
|
|
2240
|
-
let t = "";
|
|
2241
|
-
for (let n = e.length - 1; n >= 0; n--) {
|
|
2242
|
-
let r = e[n];
|
|
2243
|
-
if (!(!r || r === ".") && (t = t ? `${r}/${t}` : r, this.isAbsolute(r))) break;
|
|
2244
|
-
}
|
|
2245
|
-
let n = this.#t.get(t);
|
|
2246
|
-
if (n !== void 0) return n;
|
|
2247
|
-
let r = this.cwd.resolve(t).fullpathPosix();
|
|
2248
|
-
return this.#t.set(t, r), r;
|
|
2249
|
-
}
|
|
2250
|
-
relative(e = this.cwd) {
|
|
2251
|
-
return typeof e == "string" && (e = this.cwd.resolve(e)), e.relative();
|
|
2252
|
-
}
|
|
2253
|
-
relativePosix(e = this.cwd) {
|
|
2254
|
-
return typeof e == "string" && (e = this.cwd.resolve(e)), e.relativePosix();
|
|
2255
|
-
}
|
|
2256
|
-
basename(e = this.cwd) {
|
|
2257
|
-
return typeof e == "string" && (e = this.cwd.resolve(e)), e.name;
|
|
2258
|
-
}
|
|
2259
|
-
dirname(e = this.cwd) {
|
|
2260
|
-
return typeof e == "string" && (e = this.cwd.resolve(e)), (e.parent || e).fullpath();
|
|
2261
|
-
}
|
|
2262
|
-
async readdir(e = this.cwd, t = { withFileTypes: !0 }) {
|
|
2263
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e, e = this.cwd);
|
|
2264
|
-
let { withFileTypes: n } = t;
|
|
2265
|
-
if (e.canReaddir()) {
|
|
2266
|
-
let t = await e.readdir();
|
|
2267
|
-
return n ? t : t.map((e) => e.name);
|
|
2268
|
-
} else return [];
|
|
2269
|
-
}
|
|
2270
|
-
readdirSync(e = this.cwd, t = { withFileTypes: !0 }) {
|
|
2271
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e, e = this.cwd);
|
|
2272
|
-
let { withFileTypes: n = !0 } = t;
|
|
2273
|
-
return e.canReaddir() ? n ? e.readdirSync() : e.readdirSync().map((e) => e.name) : [];
|
|
2274
|
-
}
|
|
2275
|
-
async lstat(e = this.cwd) {
|
|
2276
|
-
return typeof e == "string" && (e = this.cwd.resolve(e)), e.lstat();
|
|
2277
|
-
}
|
|
2278
|
-
lstatSync(e = this.cwd) {
|
|
2279
|
-
return typeof e == "string" && (e = this.cwd.resolve(e)), e.lstatSync();
|
|
2280
|
-
}
|
|
2281
|
-
async readlink(e = this.cwd, { withFileTypes: t } = { withFileTypes: !1 }) {
|
|
2282
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e.withFileTypes, e = this.cwd);
|
|
2283
|
-
let n = await e.readlink();
|
|
2284
|
-
return t ? n : n?.fullpath();
|
|
2285
|
-
}
|
|
2286
|
-
readlinkSync(e = this.cwd, { withFileTypes: t } = { withFileTypes: !1 }) {
|
|
2287
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e.withFileTypes, e = this.cwd);
|
|
2288
|
-
let n = e.readlinkSync();
|
|
2289
|
-
return t ? n : n?.fullpath();
|
|
2290
|
-
}
|
|
2291
|
-
async realpath(e = this.cwd, { withFileTypes: t } = { withFileTypes: !1 }) {
|
|
2292
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e.withFileTypes, e = this.cwd);
|
|
2293
|
-
let n = await e.realpath();
|
|
2294
|
-
return t ? n : n?.fullpath();
|
|
2295
|
-
}
|
|
2296
|
-
realpathSync(e = this.cwd, { withFileTypes: t } = { withFileTypes: !1 }) {
|
|
2297
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e.withFileTypes, e = this.cwd);
|
|
2298
|
-
let n = e.realpathSync();
|
|
2299
|
-
return t ? n : n?.fullpath();
|
|
2300
|
-
}
|
|
2301
|
-
async walk(e = this.cwd, t = {}) {
|
|
2302
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e, e = this.cwd);
|
|
2303
|
-
let { withFileTypes: n = !0, follow: r = !1, filter: i, walkFilter: a } = t, o = [];
|
|
2304
|
-
(!i || i(e)) && o.push(n ? e : e.fullpath());
|
|
2305
|
-
let s = /* @__PURE__ */ new Set(), c = (e, t) => {
|
|
2306
|
-
s.add(e), e.readdirCB((e, l) => {
|
|
2307
|
-
if (e) return t(e);
|
|
2308
|
-
let u = l.length;
|
|
2309
|
-
if (!u) return t();
|
|
2310
|
-
let d = () => {
|
|
2311
|
-
--u === 0 && t();
|
|
2312
|
-
};
|
|
2313
|
-
for (let e of l) (!i || i(e)) && o.push(n ? e : e.fullpath()), r && e.isSymbolicLink() ? e.realpath().then((e) => e?.isUnknown() ? e.lstat() : e).then((e) => e?.shouldWalk(s, a) ? c(e, d) : d()) : e.shouldWalk(s, a) ? c(e, d) : d();
|
|
2314
|
-
}, !0);
|
|
2315
|
-
}, l = e;
|
|
2316
|
-
return new Promise((e, t) => {
|
|
2317
|
-
c(l, (n) => {
|
|
2318
|
-
if (n) return t(n);
|
|
2319
|
-
e(o);
|
|
2320
|
-
});
|
|
2321
|
-
});
|
|
2322
|
-
}
|
|
2323
|
-
walkSync(e = this.cwd, t = {}) {
|
|
2324
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e, e = this.cwd);
|
|
2325
|
-
let { withFileTypes: n = !0, follow: r = !1, filter: i, walkFilter: a } = t, o = [];
|
|
2326
|
-
(!i || i(e)) && o.push(n ? e : e.fullpath());
|
|
2327
|
-
let s = new Set([e]);
|
|
2328
|
-
for (let e of s) {
|
|
2329
|
-
let t = e.readdirSync();
|
|
2330
|
-
for (let e of t) {
|
|
2331
|
-
(!i || i(e)) && o.push(n ? e : e.fullpath());
|
|
2332
|
-
let t = e;
|
|
2333
|
-
if (e.isSymbolicLink()) {
|
|
2334
|
-
if (!(r && (t = e.realpathSync()))) continue;
|
|
2335
|
-
t.isUnknown() && t.lstatSync();
|
|
2336
|
-
}
|
|
2337
|
-
t.shouldWalk(s, a) && s.add(t);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
return o;
|
|
2341
|
-
}
|
|
2342
|
-
[Symbol.asyncIterator]() {
|
|
2343
|
-
return this.iterate();
|
|
2344
|
-
}
|
|
2345
|
-
iterate(e = this.cwd, t = {}) {
|
|
2346
|
-
return typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e, e = this.cwd), this.stream(e, t)[Symbol.asyncIterator]();
|
|
2347
|
-
}
|
|
2348
|
-
[Symbol.iterator]() {
|
|
2349
|
-
return this.iterateSync();
|
|
2350
|
-
}
|
|
2351
|
-
*iterateSync(e = this.cwd, t = {}) {
|
|
2352
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e, e = this.cwd);
|
|
2353
|
-
let { withFileTypes: n = !0, follow: r = !1, filter: i, walkFilter: a } = t;
|
|
2354
|
-
(!i || i(e)) && (yield n ? e : e.fullpath());
|
|
2355
|
-
let o = new Set([e]);
|
|
2356
|
-
for (let e of o) {
|
|
2357
|
-
let t = e.readdirSync();
|
|
2358
|
-
for (let e of t) {
|
|
2359
|
-
(!i || i(e)) && (yield n ? e : e.fullpath());
|
|
2360
|
-
let t = e;
|
|
2361
|
-
if (e.isSymbolicLink()) {
|
|
2362
|
-
if (!(r && (t = e.realpathSync()))) continue;
|
|
2363
|
-
t.isUnknown() && t.lstatSync();
|
|
2364
|
-
}
|
|
2365
|
-
t.shouldWalk(o, a) && o.add(t);
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
stream(e = this.cwd, t = {}) {
|
|
2370
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e, e = this.cwd);
|
|
2371
|
-
let { withFileTypes: n = !0, follow: r = !1, filter: i, walkFilter: a } = t, o = new Xt({ objectMode: !0 });
|
|
2372
|
-
(!i || i(e)) && o.write(n ? e : e.fullpath());
|
|
2373
|
-
let s = /* @__PURE__ */ new Set(), c = [e], l = 0, u = () => {
|
|
2374
|
-
let e = !1;
|
|
2375
|
-
for (; !e;) {
|
|
2376
|
-
let t = c.shift();
|
|
2377
|
-
if (!t) {
|
|
2378
|
-
l === 0 && o.end();
|
|
2379
|
-
return;
|
|
2380
|
-
}
|
|
2381
|
-
l++, s.add(t);
|
|
2382
|
-
let d = (t, p, m = !1) => {
|
|
2383
|
-
if (t) return o.emit("error", t);
|
|
2384
|
-
if (r && !m) {
|
|
2385
|
-
let e = [];
|
|
2386
|
-
for (let t of p) t.isSymbolicLink() && e.push(t.realpath().then((e) => e?.isUnknown() ? e.lstat() : e));
|
|
2387
|
-
if (e.length) {
|
|
2388
|
-
Promise.all(e).then(() => d(null, p, !0));
|
|
2389
|
-
return;
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
for (let t of p) t && (!i || i(t)) && (o.write(n ? t : t.fullpath()) || (e = !0));
|
|
2393
|
-
l--;
|
|
2394
|
-
for (let e of p) {
|
|
2395
|
-
let t = e.realpathCached() || e;
|
|
2396
|
-
t.shouldWalk(s, a) && c.push(t);
|
|
2397
|
-
}
|
|
2398
|
-
e && !o.flowing ? o.once("drain", u) : f || u();
|
|
2399
|
-
}, f = !0;
|
|
2400
|
-
t.readdirCB(d, !0), f = !1;
|
|
2401
|
-
}
|
|
2402
|
-
};
|
|
2403
|
-
return u(), o;
|
|
2404
|
-
}
|
|
2405
|
-
streamSync(e = this.cwd, t = {}) {
|
|
2406
|
-
typeof e == "string" ? e = this.cwd.resolve(e) : e instanceof Q || (t = e, e = this.cwd);
|
|
2407
|
-
let { withFileTypes: n = !0, follow: r = !1, filter: i, walkFilter: a } = t, o = new Xt({ objectMode: !0 }), s = /* @__PURE__ */ new Set();
|
|
2408
|
-
(!i || i(e)) && o.write(n ? e : e.fullpath());
|
|
2409
|
-
let c = [e], l = 0, u = () => {
|
|
2410
|
-
let e = !1;
|
|
2411
|
-
for (; !e;) {
|
|
2412
|
-
let t = c.shift();
|
|
2413
|
-
if (!t) {
|
|
2414
|
-
l === 0 && o.end();
|
|
2415
|
-
return;
|
|
2416
|
-
}
|
|
2417
|
-
l++, s.add(t);
|
|
2418
|
-
let u = t.readdirSync();
|
|
2419
|
-
for (let t of u) (!i || i(t)) && (o.write(n ? t : t.fullpath()) || (e = !0));
|
|
2420
|
-
l--;
|
|
2421
|
-
for (let e of u) {
|
|
2422
|
-
let t = e;
|
|
2423
|
-
if (e.isSymbolicLink()) {
|
|
2424
|
-
if (!(r && (t = e.realpathSync()))) continue;
|
|
2425
|
-
t.isUnknown() && t.lstatSync();
|
|
2426
|
-
}
|
|
2427
|
-
t.shouldWalk(s, a) && c.push(t);
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
|
-
e && !o.flowing && o.once("drain", u);
|
|
2431
|
-
};
|
|
2432
|
-
return u(), o;
|
|
2433
|
-
}
|
|
2434
|
-
chdir(e = this.cwd) {
|
|
2435
|
-
let t = this.cwd;
|
|
2436
|
-
this.cwd = typeof e == "string" ? this.cwd.resolve(e) : e, this.cwd[Sn](t);
|
|
2437
|
-
}
|
|
2438
|
-
}, En = class extends Tn {
|
|
2439
|
-
sep = "\\";
|
|
2440
|
-
constructor(e = process.cwd(), t = {}) {
|
|
2441
|
-
let { nocase: r = !0 } = t;
|
|
2442
|
-
super(e, n, "\\", {
|
|
2443
|
-
...t,
|
|
2444
|
-
nocase: r
|
|
2445
|
-
}), this.nocase = r;
|
|
2446
|
-
for (let e = this.cwd; e; e = e.parent) e.nocase = this.nocase;
|
|
2447
|
-
}
|
|
2448
|
-
parseRootPath(e) {
|
|
2449
|
-
return n.parse(e).root.toUpperCase();
|
|
2450
|
-
}
|
|
2451
|
-
newRoot(e) {
|
|
2452
|
-
return new Cn(this.rootPath, J, void 0, this.roots, this.nocase, this.childrenCache(), { fs: e });
|
|
2453
|
-
}
|
|
2454
|
-
isAbsolute(e) {
|
|
2455
|
-
return e.startsWith("/") || e.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(e);
|
|
2456
|
-
}
|
|
2457
|
-
}, Dn = class extends Tn {
|
|
2458
|
-
sep = "/";
|
|
2459
|
-
constructor(e = process.cwd(), n = {}) {
|
|
2460
|
-
let { nocase: r = !1 } = n;
|
|
2461
|
-
super(e, t, "/", {
|
|
2462
|
-
...n,
|
|
2463
|
-
nocase: r
|
|
2464
|
-
}), this.nocase = r;
|
|
2465
|
-
}
|
|
2466
|
-
parseRootPath(e) {
|
|
2467
|
-
return "/";
|
|
2468
|
-
}
|
|
2469
|
-
newRoot(e) {
|
|
2470
|
-
return new wn(this.rootPath, J, void 0, this.roots, this.nocase, this.childrenCache(), { fs: e });
|
|
2471
|
-
}
|
|
2472
|
-
isAbsolute(e) {
|
|
2473
|
-
return e.startsWith("/");
|
|
2474
|
-
}
|
|
2475
|
-
}, On = class extends Dn {
|
|
2476
|
-
constructor(e = process.cwd(), t = {}) {
|
|
2477
|
-
let { nocase: n = !0 } = t;
|
|
2478
|
-
super(e, {
|
|
2479
|
-
...t,
|
|
2480
|
-
nocase: n
|
|
2481
|
-
});
|
|
2482
|
-
}
|
|
2483
|
-
};
|
|
2484
|
-
process.platform;
|
|
2485
|
-
var kn = process.platform === "win32" ? En : process.platform === "darwin" ? On : Dn, An = (e) => e.length >= 1, jn = (e) => e.length >= 1, Mn = Symbol.for("nodejs.util.inspect.custom"), Nn = class e {
|
|
2486
|
-
#e;
|
|
2487
|
-
#t;
|
|
2488
|
-
#n;
|
|
2489
|
-
length;
|
|
2490
|
-
#r;
|
|
2491
|
-
#i;
|
|
2492
|
-
#a;
|
|
2493
|
-
#o;
|
|
2494
|
-
#s;
|
|
2495
|
-
#c;
|
|
2496
|
-
#l = !0;
|
|
2497
|
-
constructor(e, t, n, r) {
|
|
2498
|
-
if (!An(e)) throw TypeError("empty pattern list");
|
|
2499
|
-
if (!jn(t)) throw TypeError("empty glob list");
|
|
2500
|
-
if (t.length !== e.length) throw TypeError("mismatched pattern list and glob list lengths");
|
|
2501
|
-
if (this.length = e.length, n < 0 || n >= this.length) throw TypeError("index out of range");
|
|
2502
|
-
if (this.#e = e, this.#t = t, this.#n = n, this.#r = r, this.#n === 0) {
|
|
2503
|
-
if (this.isUNC()) {
|
|
2504
|
-
let [e, t, n, r, ...i] = this.#e, [a, o, s, c, ...l] = this.#t;
|
|
2505
|
-
i[0] === "" && (i.shift(), l.shift());
|
|
2506
|
-
let u = [
|
|
2507
|
-
e,
|
|
2508
|
-
t,
|
|
2509
|
-
n,
|
|
2510
|
-
r,
|
|
2511
|
-
""
|
|
2512
|
-
].join("/"), d = [
|
|
2513
|
-
a,
|
|
2514
|
-
o,
|
|
2515
|
-
s,
|
|
2516
|
-
c,
|
|
2517
|
-
""
|
|
2518
|
-
].join("/");
|
|
2519
|
-
this.#e = [u, ...i], this.#t = [d, ...l], this.length = this.#e.length;
|
|
2520
|
-
} else if (this.isDrive() || this.isAbsolute()) {
|
|
2521
|
-
let [e, ...t] = this.#e, [n, ...r] = this.#t;
|
|
2522
|
-
t[0] === "" && (t.shift(), r.shift());
|
|
2523
|
-
let i = e + "/", a = n + "/";
|
|
2524
|
-
this.#e = [i, ...t], this.#t = [a, ...r], this.length = this.#e.length;
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
[Mn]() {
|
|
2529
|
-
return "Pattern <" + this.#t.slice(this.#n).join("/") + ">";
|
|
2530
|
-
}
|
|
2531
|
-
pattern() {
|
|
2532
|
-
return this.#e[this.#n];
|
|
2533
|
-
}
|
|
2534
|
-
isString() {
|
|
2535
|
-
return typeof this.#e[this.#n] == "string";
|
|
2536
|
-
}
|
|
2537
|
-
isGlobstar() {
|
|
2538
|
-
return this.#e[this.#n] === C;
|
|
2539
|
-
}
|
|
2540
|
-
isRegExp() {
|
|
2541
|
-
return this.#e[this.#n] instanceof RegExp;
|
|
2542
|
-
}
|
|
2543
|
-
globString() {
|
|
2544
|
-
return this.#a = this.#a || (this.#n === 0 ? this.isAbsolute() ? this.#t[0] + this.#t.slice(1).join("/") : this.#t.join("/") : this.#t.slice(this.#n).join("/"));
|
|
2545
|
-
}
|
|
2546
|
-
hasMore() {
|
|
2547
|
-
return this.length > this.#n + 1;
|
|
2548
|
-
}
|
|
2549
|
-
rest() {
|
|
2550
|
-
return this.#i === void 0 ? this.hasMore() ? (this.#i = new e(this.#e, this.#t, this.#n + 1, this.#r), this.#i.#c = this.#c, this.#i.#s = this.#s, this.#i.#o = this.#o, this.#i) : this.#i = null : this.#i;
|
|
2551
|
-
}
|
|
2552
|
-
isUNC() {
|
|
2553
|
-
let e = this.#e;
|
|
2554
|
-
return this.#s === void 0 ? this.#s = this.#r === "win32" && this.#n === 0 && e[0] === "" && e[1] === "" && typeof e[2] == "string" && !!e[2] && typeof e[3] == "string" && !!e[3] : this.#s;
|
|
2555
|
-
}
|
|
2556
|
-
isDrive() {
|
|
2557
|
-
let e = this.#e;
|
|
2558
|
-
return this.#o === void 0 ? this.#o = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]) : this.#o;
|
|
2559
|
-
}
|
|
2560
|
-
isAbsolute() {
|
|
2561
|
-
let e = this.#e;
|
|
2562
|
-
return this.#c === void 0 ? this.#c = e[0] === "" && e.length > 1 || this.isDrive() || this.isUNC() : this.#c;
|
|
2563
|
-
}
|
|
2564
|
-
root() {
|
|
2565
|
-
let e = this.#e[0];
|
|
2566
|
-
return typeof e == "string" && this.isAbsolute() && this.#n === 0 ? e : "";
|
|
2567
|
-
}
|
|
2568
|
-
checkFollowGlobstar() {
|
|
2569
|
-
return !(this.#n === 0 || !this.isGlobstar() || !this.#l);
|
|
2570
|
-
}
|
|
2571
|
-
markFollowGlobstar() {
|
|
2572
|
-
return this.#n === 0 || !this.isGlobstar() || !this.#l ? !1 : (this.#l = !1, !0);
|
|
2573
|
-
}
|
|
2574
|
-
}, Pn = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Fn = class {
|
|
2575
|
-
relative;
|
|
2576
|
-
relativeChildren;
|
|
2577
|
-
absolute;
|
|
2578
|
-
absoluteChildren;
|
|
2579
|
-
platform;
|
|
2580
|
-
mmopts;
|
|
2581
|
-
constructor(e, { nobrace: t, nocase: n, noext: r, noglobstar: i, platform: a = Pn }) {
|
|
2582
|
-
this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = a, this.mmopts = {
|
|
2583
|
-
dot: !0,
|
|
2584
|
-
nobrace: t,
|
|
2585
|
-
nocase: n,
|
|
2586
|
-
noext: r,
|
|
2587
|
-
noglobstar: i,
|
|
2588
|
-
optimizationLevel: 2,
|
|
2589
|
-
platform: a,
|
|
2590
|
-
nocomment: !0,
|
|
2591
|
-
nonegate: !0
|
|
2592
|
-
};
|
|
2593
|
-
for (let t of e) this.add(t);
|
|
2594
|
-
}
|
|
2595
|
-
add(e) {
|
|
2596
|
-
let t = new T(e, this.mmopts);
|
|
2597
|
-
for (let e = 0; e < t.set.length; e++) {
|
|
2598
|
-
let n = t.set[e], r = t.globParts[e];
|
|
2599
|
-
if (!n || !r) throw Error("invalid pattern object");
|
|
2600
|
-
for (; n[0] === "." && r[0] === ".";) n.shift(), r.shift();
|
|
2601
|
-
let i = new Nn(n, r, 0, this.platform), a = new T(i.globString(), this.mmopts), o = r[r.length - 1] === "**", s = i.isAbsolute();
|
|
2602
|
-
s ? this.absolute.push(a) : this.relative.push(a), o && (s ? this.absoluteChildren.push(a) : this.relativeChildren.push(a));
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
ignored(e) {
|
|
2606
|
-
let t = e.fullpath(), n = `${t}/`, r = e.relative() || ".", i = `${r}/`;
|
|
2607
|
-
for (let e of this.relative) if (e.match(r) || e.match(i)) return !0;
|
|
2608
|
-
for (let e of this.absolute) if (e.match(t) || e.match(n)) return !0;
|
|
2609
|
-
return !1;
|
|
2610
|
-
}
|
|
2611
|
-
childrenIgnored(e) {
|
|
2612
|
-
let t = e.fullpath() + "/", n = (e.relative() || ".") + "/";
|
|
2613
|
-
for (let e of this.relativeChildren) if (e.match(n)) return !0;
|
|
2614
|
-
for (let e of this.absoluteChildren) if (e.match(t)) return !0;
|
|
2615
|
-
return !1;
|
|
2616
|
-
}
|
|
2617
|
-
}, In = class e {
|
|
2618
|
-
store;
|
|
2619
|
-
constructor(e = /* @__PURE__ */ new Map()) {
|
|
2620
|
-
this.store = e;
|
|
2621
|
-
}
|
|
2622
|
-
copy() {
|
|
2623
|
-
return new e(new Map(this.store));
|
|
2624
|
-
}
|
|
2625
|
-
hasWalked(e, t) {
|
|
2626
|
-
return this.store.get(e.fullpath())?.has(t.globString());
|
|
2627
|
-
}
|
|
2628
|
-
storeWalked(e, t) {
|
|
2629
|
-
let n = e.fullpath(), r = this.store.get(n);
|
|
2630
|
-
r ? r.add(t.globString()) : this.store.set(n, new Set([t.globString()]));
|
|
2631
|
-
}
|
|
2632
|
-
}, Ln = class {
|
|
2633
|
-
store = /* @__PURE__ */ new Map();
|
|
2634
|
-
add(e, t, n) {
|
|
2635
|
-
let r = (t ? 2 : 0) | !!n, i = this.store.get(e);
|
|
2636
|
-
this.store.set(e, i === void 0 ? r : r & i);
|
|
2637
|
-
}
|
|
2638
|
-
entries() {
|
|
2639
|
-
return [...this.store.entries()].map(([e, t]) => [
|
|
2640
|
-
e,
|
|
2641
|
-
!!(t & 2),
|
|
2642
|
-
!!(t & 1)
|
|
2643
|
-
]);
|
|
2644
|
-
}
|
|
2645
|
-
}, Rn = class {
|
|
2646
|
-
store = /* @__PURE__ */ new Map();
|
|
2647
|
-
add(e, t) {
|
|
2648
|
-
if (!e.canReaddir()) return;
|
|
2649
|
-
let n = this.store.get(e);
|
|
2650
|
-
n ? n.find((e) => e.globString() === t.globString()) || n.push(t) : this.store.set(e, [t]);
|
|
2651
|
-
}
|
|
2652
|
-
get(e) {
|
|
2653
|
-
let t = this.store.get(e);
|
|
2654
|
-
if (!t) throw Error("attempting to walk unknown path");
|
|
2655
|
-
return t;
|
|
2656
|
-
}
|
|
2657
|
-
entries() {
|
|
2658
|
-
return this.keys().map((e) => [e, this.store.get(e)]);
|
|
2659
|
-
}
|
|
2660
|
-
keys() {
|
|
2661
|
-
return [...this.store.keys()].filter((e) => e.canReaddir());
|
|
2662
|
-
}
|
|
2663
|
-
}, zn = class e {
|
|
2664
|
-
hasWalkedCache;
|
|
2665
|
-
matches = new Ln();
|
|
2666
|
-
subwalks = new Rn();
|
|
2667
|
-
patterns;
|
|
2668
|
-
follow;
|
|
2669
|
-
dot;
|
|
2670
|
-
opts;
|
|
2671
|
-
constructor(e, t) {
|
|
2672
|
-
this.opts = e, this.follow = !!e.follow, this.dot = !!e.dot, this.hasWalkedCache = t ? t.copy() : new In();
|
|
2673
|
-
}
|
|
2674
|
-
processPatterns(e, t) {
|
|
2675
|
-
this.patterns = t;
|
|
2676
|
-
let n = t.map((t) => [e, t]);
|
|
2677
|
-
for (let [e, t] of n) {
|
|
2678
|
-
this.hasWalkedCache.storeWalked(e, t);
|
|
2679
|
-
let n = t.root(), r = t.isAbsolute() && this.opts.absolute !== !1;
|
|
2680
|
-
if (n) {
|
|
2681
|
-
e = e.resolve(n === "/" && this.opts.root !== void 0 ? this.opts.root : n);
|
|
2682
|
-
let r = t.rest();
|
|
2683
|
-
if (r) t = r;
|
|
2684
|
-
else {
|
|
2685
|
-
this.matches.add(e, !0, !1);
|
|
2686
|
-
continue;
|
|
2687
|
-
}
|
|
2688
|
-
}
|
|
2689
|
-
if (e.isENOENT()) continue;
|
|
2690
|
-
let i, a, o = !1;
|
|
2691
|
-
for (; typeof (i = t.pattern()) == "string" && (a = t.rest());) e = e.resolve(i), t = a, o = !0;
|
|
2692
|
-
if (i = t.pattern(), a = t.rest(), o) {
|
|
2693
|
-
if (this.hasWalkedCache.hasWalked(e, t)) continue;
|
|
2694
|
-
this.hasWalkedCache.storeWalked(e, t);
|
|
2695
|
-
}
|
|
2696
|
-
if (typeof i == "string") {
|
|
2697
|
-
let t = i === ".." || i === "" || i === ".";
|
|
2698
|
-
this.matches.add(e.resolve(i), r, t);
|
|
2699
|
-
continue;
|
|
2700
|
-
} else if (i === C) {
|
|
2701
|
-
(!e.isSymbolicLink() || this.follow || t.checkFollowGlobstar()) && this.subwalks.add(e, t);
|
|
2702
|
-
let n = a?.pattern(), i = a?.rest();
|
|
2703
|
-
if (!a || (n === "" || n === ".") && !i) this.matches.add(e, r, n === "" || n === ".");
|
|
2704
|
-
else if (n === "..") {
|
|
2705
|
-
let t = e.parent || e;
|
|
2706
|
-
i ? this.hasWalkedCache.hasWalked(t, i) || this.subwalks.add(t, i) : this.matches.add(t, r, !0);
|
|
2707
|
-
}
|
|
2708
|
-
} else i instanceof RegExp && this.subwalks.add(e, t);
|
|
2709
|
-
}
|
|
2710
|
-
return this;
|
|
2711
|
-
}
|
|
2712
|
-
subwalkTargets() {
|
|
2713
|
-
return this.subwalks.keys();
|
|
2714
|
-
}
|
|
2715
|
-
child() {
|
|
2716
|
-
return new e(this.opts, this.hasWalkedCache);
|
|
2717
|
-
}
|
|
2718
|
-
filterEntries(e, t) {
|
|
2719
|
-
let n = this.subwalks.get(e), r = this.child();
|
|
2720
|
-
for (let e of t) for (let t of n) {
|
|
2721
|
-
let n = t.isAbsolute(), i = t.pattern(), a = t.rest();
|
|
2722
|
-
i === C ? r.testGlobstar(e, t, a, n) : i instanceof RegExp ? r.testRegExp(e, i, a, n) : r.testString(e, i, a, n);
|
|
2723
|
-
}
|
|
2724
|
-
return r;
|
|
2725
|
-
}
|
|
2726
|
-
testGlobstar(e, t, n, r) {
|
|
2727
|
-
if ((this.dot || !e.name.startsWith(".")) && (t.hasMore() || this.matches.add(e, r, !1), e.canReaddir() && (this.follow || !e.isSymbolicLink() ? this.subwalks.add(e, t) : e.isSymbolicLink() && (n && t.checkFollowGlobstar() ? this.subwalks.add(e, n) : t.markFollowGlobstar() && this.subwalks.add(e, t)))), n) {
|
|
2728
|
-
let t = n.pattern();
|
|
2729
|
-
if (typeof t == "string" && t !== ".." && t !== "" && t !== ".") this.testString(e, t, n.rest(), r);
|
|
2730
|
-
else if (t === "..") {
|
|
2731
|
-
let t = e.parent || e;
|
|
2732
|
-
this.subwalks.add(t, n);
|
|
2733
|
-
} else t instanceof RegExp && this.testRegExp(e, t, n.rest(), r);
|
|
2734
|
-
}
|
|
2735
|
-
}
|
|
2736
|
-
testRegExp(e, t, n, r) {
|
|
2737
|
-
t.test(e.name) && (n ? this.subwalks.add(e, n) : this.matches.add(e, r, !1));
|
|
2738
|
-
}
|
|
2739
|
-
testString(e, t, n, r) {
|
|
2740
|
-
e.isNamed(t) && (n ? this.subwalks.add(e, n) : this.matches.add(e, r, !1));
|
|
2741
|
-
}
|
|
2742
|
-
}, Bn = (e, t) => typeof e == "string" ? new Fn([e], t) : Array.isArray(e) ? new Fn(e, t) : e, Vn = class {
|
|
2743
|
-
path;
|
|
2744
|
-
patterns;
|
|
2745
|
-
opts;
|
|
2746
|
-
seen = /* @__PURE__ */ new Set();
|
|
2747
|
-
paused = !1;
|
|
2748
|
-
aborted = !1;
|
|
2749
|
-
#e = [];
|
|
2750
|
-
#t;
|
|
2751
|
-
#n;
|
|
2752
|
-
signal;
|
|
2753
|
-
maxDepth;
|
|
2754
|
-
includeChildMatches;
|
|
2755
|
-
constructor(e, t, n) {
|
|
2756
|
-
if (this.patterns = e, this.path = t, this.opts = n, this.#n = !n.posix && n.platform === "win32" ? "\\" : "/", this.includeChildMatches = n.includeChildMatches !== !1, (n.ignore || !this.includeChildMatches) && (this.#t = Bn(n.ignore ?? [], n), !this.includeChildMatches && typeof this.#t.add != "function")) throw Error("cannot ignore child matches, ignore lacks add() method.");
|
|
2757
|
-
this.maxDepth = n.maxDepth || Infinity, n.signal && (this.signal = n.signal, this.signal.addEventListener("abort", () => {
|
|
2758
|
-
this.#e.length = 0;
|
|
2759
|
-
}));
|
|
2760
|
-
}
|
|
2761
|
-
#r(e) {
|
|
2762
|
-
return this.seen.has(e) || !!this.#t?.ignored?.(e);
|
|
2763
|
-
}
|
|
2764
|
-
#i(e) {
|
|
2765
|
-
return !!this.#t?.childrenIgnored?.(e);
|
|
2766
|
-
}
|
|
2767
|
-
pause() {
|
|
2768
|
-
this.paused = !0;
|
|
2769
|
-
}
|
|
2770
|
-
resume() {
|
|
2771
|
-
if (this.signal?.aborted) return;
|
|
2772
|
-
this.paused = !1;
|
|
2773
|
-
let e;
|
|
2774
|
-
for (; !this.paused && (e = this.#e.shift());) e();
|
|
2775
|
-
}
|
|
2776
|
-
onResume(e) {
|
|
2777
|
-
this.signal?.aborted || (this.paused ? this.#e.push(e) : e());
|
|
2778
|
-
}
|
|
2779
|
-
async matchCheck(e, t) {
|
|
2780
|
-
if (t && this.opts.nodir) return;
|
|
2781
|
-
let n;
|
|
2782
|
-
if (this.opts.realpath) {
|
|
2783
|
-
if (n = e.realpathCached() || await e.realpath(), !n) return;
|
|
2784
|
-
e = n;
|
|
2785
|
-
}
|
|
2786
|
-
let r = e.isUnknown() || this.opts.stat ? await e.lstat() : e;
|
|
2787
|
-
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
2788
|
-
let e = await r.realpath();
|
|
2789
|
-
e && (e.isUnknown() || this.opts.stat) && await e.lstat();
|
|
2790
|
-
}
|
|
2791
|
-
return this.matchCheckTest(r, t);
|
|
2792
|
-
}
|
|
2793
|
-
matchCheckTest(e, t) {
|
|
2794
|
-
return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!t || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#r(e) ? e : void 0;
|
|
2795
|
-
}
|
|
2796
|
-
matchCheckSync(e, t) {
|
|
2797
|
-
if (t && this.opts.nodir) return;
|
|
2798
|
-
let n;
|
|
2799
|
-
if (this.opts.realpath) {
|
|
2800
|
-
if (n = e.realpathCached() || e.realpathSync(), !n) return;
|
|
2801
|
-
e = n;
|
|
2802
|
-
}
|
|
2803
|
-
let r = e.isUnknown() || this.opts.stat ? e.lstatSync() : e;
|
|
2804
|
-
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
2805
|
-
let e = r.realpathSync();
|
|
2806
|
-
e && (e?.isUnknown() || this.opts.stat) && e.lstatSync();
|
|
2807
|
-
}
|
|
2808
|
-
return this.matchCheckTest(r, t);
|
|
2809
|
-
}
|
|
2810
|
-
matchFinish(e, t) {
|
|
2811
|
-
if (this.#r(e)) return;
|
|
2812
|
-
if (!this.includeChildMatches && this.#t?.add) {
|
|
2813
|
-
let t = `${e.relativePosix()}/**`;
|
|
2814
|
-
this.#t.add(t);
|
|
2815
|
-
}
|
|
2816
|
-
let n = this.opts.absolute === void 0 ? t : this.opts.absolute;
|
|
2817
|
-
this.seen.add(e);
|
|
2818
|
-
let r = this.opts.mark && e.isDirectory() ? this.#n : "";
|
|
2819
|
-
if (this.opts.withFileTypes) this.matchEmit(e);
|
|
2820
|
-
else if (n) {
|
|
2821
|
-
let t = this.opts.posix ? e.fullpathPosix() : e.fullpath();
|
|
2822
|
-
this.matchEmit(t + r);
|
|
2823
|
-
} else {
|
|
2824
|
-
let t = this.opts.posix ? e.relativePosix() : e.relative(), n = this.opts.dotRelative && !t.startsWith(".." + this.#n) ? "." + this.#n : "";
|
|
2825
|
-
this.matchEmit(t ? n + t + r : "." + r);
|
|
2826
|
-
}
|
|
2827
|
-
}
|
|
2828
|
-
async match(e, t, n) {
|
|
2829
|
-
let r = await this.matchCheck(e, n);
|
|
2830
|
-
r && this.matchFinish(r, t);
|
|
2831
|
-
}
|
|
2832
|
-
matchSync(e, t, n) {
|
|
2833
|
-
let r = this.matchCheckSync(e, n);
|
|
2834
|
-
r && this.matchFinish(r, t);
|
|
2835
|
-
}
|
|
2836
|
-
walkCB(e, t, n) {
|
|
2837
|
-
this.signal?.aborted && n(), this.walkCB2(e, t, new zn(this.opts), n);
|
|
2838
|
-
}
|
|
2839
|
-
walkCB2(e, t, n, r) {
|
|
2840
|
-
if (this.#i(e)) return r();
|
|
2841
|
-
if (this.signal?.aborted && r(), this.paused) {
|
|
2842
|
-
this.onResume(() => this.walkCB2(e, t, n, r));
|
|
2843
|
-
return;
|
|
2844
|
-
}
|
|
2845
|
-
n.processPatterns(e, t);
|
|
2846
|
-
let i = 1, a = () => {
|
|
2847
|
-
--i === 0 && r();
|
|
2848
|
-
};
|
|
2849
|
-
for (let [e, t, r] of n.matches.entries()) this.#r(e) || (i++, this.match(e, t, r).then(() => a()));
|
|
2850
|
-
for (let e of n.subwalkTargets()) {
|
|
2851
|
-
if (this.maxDepth !== Infinity && e.depth() >= this.maxDepth) continue;
|
|
2852
|
-
i++;
|
|
2853
|
-
let t = e.readdirCached();
|
|
2854
|
-
e.calledReaddir() ? this.walkCB3(e, t, n, a) : e.readdirCB((t, r) => this.walkCB3(e, r, n, a), !0);
|
|
2855
|
-
}
|
|
2856
|
-
a();
|
|
2857
|
-
}
|
|
2858
|
-
walkCB3(e, t, n, r) {
|
|
2859
|
-
n = n.filterEntries(e, t);
|
|
2860
|
-
let i = 1, a = () => {
|
|
2861
|
-
--i === 0 && r();
|
|
2862
|
-
};
|
|
2863
|
-
for (let [e, t, r] of n.matches.entries()) this.#r(e) || (i++, this.match(e, t, r).then(() => a()));
|
|
2864
|
-
for (let [e, t] of n.subwalks.entries()) i++, this.walkCB2(e, t, n.child(), a);
|
|
2865
|
-
a();
|
|
2866
|
-
}
|
|
2867
|
-
walkCBSync(e, t, n) {
|
|
2868
|
-
this.signal?.aborted && n(), this.walkCB2Sync(e, t, new zn(this.opts), n);
|
|
2869
|
-
}
|
|
2870
|
-
walkCB2Sync(e, t, n, r) {
|
|
2871
|
-
if (this.#i(e)) return r();
|
|
2872
|
-
if (this.signal?.aborted && r(), this.paused) {
|
|
2873
|
-
this.onResume(() => this.walkCB2Sync(e, t, n, r));
|
|
2874
|
-
return;
|
|
2875
|
-
}
|
|
2876
|
-
n.processPatterns(e, t);
|
|
2877
|
-
let i = 1, a = () => {
|
|
2878
|
-
--i === 0 && r();
|
|
2879
|
-
};
|
|
2880
|
-
for (let [e, t, r] of n.matches.entries()) this.#r(e) || this.matchSync(e, t, r);
|
|
2881
|
-
for (let e of n.subwalkTargets()) {
|
|
2882
|
-
if (this.maxDepth !== Infinity && e.depth() >= this.maxDepth) continue;
|
|
2883
|
-
i++;
|
|
2884
|
-
let t = e.readdirSync();
|
|
2885
|
-
this.walkCB3Sync(e, t, n, a);
|
|
2886
|
-
}
|
|
2887
|
-
a();
|
|
2888
|
-
}
|
|
2889
|
-
walkCB3Sync(e, t, n, r) {
|
|
2890
|
-
n = n.filterEntries(e, t);
|
|
2891
|
-
let i = 1, a = () => {
|
|
2892
|
-
--i === 0 && r();
|
|
2893
|
-
};
|
|
2894
|
-
for (let [e, t, r] of n.matches.entries()) this.#r(e) || this.matchSync(e, t, r);
|
|
2895
|
-
for (let [e, t] of n.subwalks.entries()) i++, this.walkCB2Sync(e, t, n.child(), a);
|
|
2896
|
-
a();
|
|
2897
|
-
}
|
|
2898
|
-
}, Hn = class extends Vn {
|
|
2899
|
-
matches = /* @__PURE__ */ new Set();
|
|
2900
|
-
constructor(e, t, n) {
|
|
2901
|
-
super(e, t, n);
|
|
2902
|
-
}
|
|
2903
|
-
matchEmit(e) {
|
|
2904
|
-
this.matches.add(e);
|
|
2905
|
-
}
|
|
2906
|
-
async walk() {
|
|
2907
|
-
if (this.signal?.aborted) throw this.signal.reason;
|
|
2908
|
-
return this.path.isUnknown() && await this.path.lstat(), await new Promise((e, t) => {
|
|
2909
|
-
this.walkCB(this.path, this.patterns, () => {
|
|
2910
|
-
this.signal?.aborted ? t(this.signal.reason) : e(this.matches);
|
|
2911
|
-
});
|
|
2912
|
-
}), this.matches;
|
|
2913
|
-
}
|
|
2914
|
-
walkSync() {
|
|
2915
|
-
if (this.signal?.aborted) throw this.signal.reason;
|
|
2916
|
-
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
|
|
2917
|
-
if (this.signal?.aborted) throw this.signal.reason;
|
|
2918
|
-
}), this.matches;
|
|
2919
|
-
}
|
|
2920
|
-
}, Un = class extends Vn {
|
|
2921
|
-
results;
|
|
2922
|
-
constructor(e, t, n) {
|
|
2923
|
-
super(e, t, n), this.results = new Xt({
|
|
2924
|
-
signal: this.signal,
|
|
2925
|
-
objectMode: !0
|
|
2926
|
-
}), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
|
|
2927
|
-
}
|
|
2928
|
-
matchEmit(e) {
|
|
2929
|
-
this.results.write(e), this.results.flowing || this.pause();
|
|
2930
|
-
}
|
|
2931
|
-
stream() {
|
|
2932
|
-
let e = this.path;
|
|
2933
|
-
return e.isUnknown() ? e.lstat().then(() => {
|
|
2934
|
-
this.walkCB(e, this.patterns, () => this.results.end());
|
|
2935
|
-
}) : this.walkCB(e, this.patterns, () => this.results.end()), this.results;
|
|
2936
|
-
}
|
|
2937
|
-
streamSync() {
|
|
2938
|
-
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
|
|
2939
|
-
}
|
|
2940
|
-
}, Wn = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", $ = class {
|
|
2941
|
-
absolute;
|
|
2942
|
-
cwd;
|
|
2943
|
-
root;
|
|
2944
|
-
dot;
|
|
2945
|
-
dotRelative;
|
|
2946
|
-
follow;
|
|
2947
|
-
ignore;
|
|
2948
|
-
magicalBraces;
|
|
2949
|
-
mark;
|
|
2950
|
-
matchBase;
|
|
2951
|
-
maxDepth;
|
|
2952
|
-
nobrace;
|
|
2953
|
-
nocase;
|
|
2954
|
-
nodir;
|
|
2955
|
-
noext;
|
|
2956
|
-
noglobstar;
|
|
2957
|
-
pattern;
|
|
2958
|
-
platform;
|
|
2959
|
-
realpath;
|
|
2960
|
-
scurry;
|
|
2961
|
-
stat;
|
|
2962
|
-
signal;
|
|
2963
|
-
windowsPathsNoEscape;
|
|
2964
|
-
withFileTypes;
|
|
2965
|
-
includeChildMatches;
|
|
2966
|
-
opts;
|
|
2967
|
-
patterns;
|
|
2968
|
-
constructor(e, t) {
|
|
2969
|
-
if (!t) throw TypeError("glob options required");
|
|
2970
|
-
if (this.withFileTypes = !!t.withFileTypes, this.signal = t.signal, this.follow = !!t.follow, this.dot = !!t.dot, this.dotRelative = !!t.dotRelative, this.nodir = !!t.nodir, this.mark = !!t.mark, t.cwd ? (t.cwd instanceof URL || t.cwd.startsWith("file://")) && (t.cwd = r(t.cwd)) : this.cwd = "", this.cwd = t.cwd || "", this.root = t.root, this.magicalBraces = !!t.magicalBraces, this.nobrace = !!t.nobrace, this.noext = !!t.noext, this.realpath = !!t.realpath, this.absolute = t.absolute, this.includeChildMatches = t.includeChildMatches !== !1, this.noglobstar = !!t.noglobstar, this.matchBase = !!t.matchBase, this.maxDepth = typeof t.maxDepth == "number" ? t.maxDepth : Infinity, this.stat = !!t.stat, this.ignore = t.ignore, this.withFileTypes && this.absolute !== void 0) throw Error("cannot set absolute and withFileTypes:true");
|
|
2971
|
-
if (typeof e == "string" && (e = [e]), this.windowsPathsNoEscape = !!t.windowsPathsNoEscape || t.allowWindowsEscape === !1, this.windowsPathsNoEscape && (e = e.map((e) => e.replace(/\\/g, "/"))), this.matchBase) {
|
|
2972
|
-
if (t.noglobstar) throw TypeError("base matching requires globstar");
|
|
2973
|
-
e = e.map((e) => e.includes("/") ? e : `./**/${e}`);
|
|
2974
|
-
}
|
|
2975
|
-
if (this.pattern = e, this.platform = t.platform || Wn, this.opts = {
|
|
2976
|
-
...t,
|
|
2977
|
-
platform: this.platform
|
|
2978
|
-
}, t.scurry) {
|
|
2979
|
-
if (this.scurry = t.scurry, t.nocase !== void 0 && t.nocase !== t.scurry.nocase) throw Error("nocase option contradicts provided scurry option");
|
|
2980
|
-
} else {
|
|
2981
|
-
let e = t.platform === "win32" ? En : t.platform === "darwin" ? On : t.platform ? Dn : kn;
|
|
2982
|
-
this.scurry = new e(this.cwd, {
|
|
2983
|
-
nocase: t.nocase,
|
|
2984
|
-
fs: t.fs
|
|
2985
|
-
});
|
|
2986
|
-
}
|
|
2987
|
-
this.nocase = this.scurry.nocase;
|
|
2988
|
-
let n = this.platform === "darwin" || this.platform === "win32", i = {
|
|
2989
|
-
braceExpandMax: 1e4,
|
|
2990
|
-
...t,
|
|
2991
|
-
dot: this.dot,
|
|
2992
|
-
matchBase: this.matchBase,
|
|
2993
|
-
nobrace: this.nobrace,
|
|
2994
|
-
nocase: this.nocase,
|
|
2995
|
-
nocaseMagicOnly: n,
|
|
2996
|
-
nocomment: !0,
|
|
2997
|
-
noext: this.noext,
|
|
2998
|
-
nonegate: !0,
|
|
2999
|
-
optimizationLevel: 2,
|
|
3000
|
-
platform: this.platform,
|
|
3001
|
-
windowsPathsNoEscape: this.windowsPathsNoEscape,
|
|
3002
|
-
debug: !!this.opts.debug
|
|
3003
|
-
}, [a, o] = this.pattern.map((e) => new T(e, i)).reduce((e, t) => (e[0].push(...t.set), e[1].push(...t.globParts), e), [[], []]);
|
|
3004
|
-
this.patterns = a.map((e, t) => {
|
|
3005
|
-
let n = o[t];
|
|
3006
|
-
if (!n) throw Error("invalid pattern object");
|
|
3007
|
-
return new Nn(e, n, 0, this.platform);
|
|
3008
|
-
});
|
|
3009
|
-
}
|
|
3010
|
-
async walk() {
|
|
3011
|
-
return [...await new Hn(this.patterns, this.scurry.cwd, {
|
|
3012
|
-
...this.opts,
|
|
3013
|
-
maxDepth: this.maxDepth === Infinity ? Infinity : this.maxDepth + this.scurry.cwd.depth(),
|
|
3014
|
-
platform: this.platform,
|
|
3015
|
-
nocase: this.nocase,
|
|
3016
|
-
includeChildMatches: this.includeChildMatches
|
|
3017
|
-
}).walk()];
|
|
3018
|
-
}
|
|
3019
|
-
walkSync() {
|
|
3020
|
-
return [...new Hn(this.patterns, this.scurry.cwd, {
|
|
3021
|
-
...this.opts,
|
|
3022
|
-
maxDepth: this.maxDepth === Infinity ? Infinity : this.maxDepth + this.scurry.cwd.depth(),
|
|
3023
|
-
platform: this.platform,
|
|
3024
|
-
nocase: this.nocase,
|
|
3025
|
-
includeChildMatches: this.includeChildMatches
|
|
3026
|
-
}).walkSync()];
|
|
3027
|
-
}
|
|
3028
|
-
stream() {
|
|
3029
|
-
return new Un(this.patterns, this.scurry.cwd, {
|
|
3030
|
-
...this.opts,
|
|
3031
|
-
maxDepth: this.maxDepth === Infinity ? Infinity : this.maxDepth + this.scurry.cwd.depth(),
|
|
3032
|
-
platform: this.platform,
|
|
3033
|
-
nocase: this.nocase,
|
|
3034
|
-
includeChildMatches: this.includeChildMatches
|
|
3035
|
-
}).stream();
|
|
3036
|
-
}
|
|
3037
|
-
streamSync() {
|
|
3038
|
-
return new Un(this.patterns, this.scurry.cwd, {
|
|
3039
|
-
...this.opts,
|
|
3040
|
-
maxDepth: this.maxDepth === Infinity ? Infinity : this.maxDepth + this.scurry.cwd.depth(),
|
|
3041
|
-
platform: this.platform,
|
|
3042
|
-
nocase: this.nocase,
|
|
3043
|
-
includeChildMatches: this.includeChildMatches
|
|
3044
|
-
}).streamSync();
|
|
3045
|
-
}
|
|
3046
|
-
iterateSync() {
|
|
3047
|
-
return this.streamSync()[Symbol.iterator]();
|
|
3048
|
-
}
|
|
3049
|
-
[Symbol.iterator]() {
|
|
3050
|
-
return this.iterateSync();
|
|
3051
|
-
}
|
|
3052
|
-
iterate() {
|
|
3053
|
-
return this.stream()[Symbol.asyncIterator]();
|
|
3054
|
-
}
|
|
3055
|
-
[Symbol.asyncIterator]() {
|
|
3056
|
-
return this.iterate();
|
|
3057
|
-
}
|
|
3058
|
-
}, Gn = (e, t = {}) => {
|
|
3059
|
-
Array.isArray(e) || (e = [e]);
|
|
3060
|
-
for (let n of e) if (new T(n, t).hasMagic()) return !0;
|
|
3061
|
-
return !1;
|
|
3062
|
-
};
|
|
3063
|
-
function Kn(e, t = {}) {
|
|
3064
|
-
return new $(e, t).streamSync();
|
|
3065
|
-
}
|
|
3066
|
-
function qn(e, t = {}) {
|
|
3067
|
-
return new $(e, t).stream();
|
|
3068
|
-
}
|
|
3069
|
-
function Jn(e, t = {}) {
|
|
3070
|
-
return new $(e, t).walkSync();
|
|
3071
|
-
}
|
|
3072
|
-
async function Yn(e, t = {}) {
|
|
3073
|
-
return new $(e, t).walk();
|
|
3074
|
-
}
|
|
3075
|
-
function Xn(e, t = {}) {
|
|
3076
|
-
return new $(e, t).iterateSync();
|
|
3077
|
-
}
|
|
3078
|
-
function Zn(e, t = {}) {
|
|
3079
|
-
return new $(e, t).iterate();
|
|
3080
|
-
}
|
|
3081
|
-
var Qn = Kn, $n = Object.assign(qn, { sync: Kn }), er = Xn, tr = Object.assign(Zn, { sync: Xn }), nr = Object.assign(Jn, {
|
|
3082
|
-
stream: Kn,
|
|
3083
|
-
iterate: Xn
|
|
3084
|
-
}), rr = Object.assign(Yn, {
|
|
3085
|
-
glob: Yn,
|
|
3086
|
-
globSync: Jn,
|
|
3087
|
-
sync: nr,
|
|
3088
|
-
globStream: qn,
|
|
3089
|
-
stream: $n,
|
|
3090
|
-
globStreamSync: Kn,
|
|
3091
|
-
streamSync: Qn,
|
|
3092
|
-
globIterate: Zn,
|
|
3093
|
-
iterate: tr,
|
|
3094
|
-
globIterateSync: Xn,
|
|
3095
|
-
iterateSync: er,
|
|
3096
|
-
Glob: $,
|
|
3097
|
-
hasMagic: Gn,
|
|
3098
|
-
escape: ze,
|
|
3099
|
-
unescape: x
|
|
3100
|
-
});
|
|
3101
|
-
rr.glob = rr;
|
|
3102
|
-
//#endregion
|
|
3103
|
-
export { rr as Ze };
|
|
3104
|
-
|
|
3105
|
-
//# sourceMappingURL=index.min.js.map
|