clanka 0.24.4 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Agent.js +1 -1
- package/dist/Agent.js.map +1 -1
- package/dist/AgentCallerConfig.test.js +8 -2
- package/dist/AgentCallerConfig.test.js.map +1 -1
- package/dist/AgentExecutor.js +1 -1
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.js +14 -0
- package/dist/AgentExecutor.test.js.map +1 -1
- package/dist/AgentTools.d.ts +112 -88
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +43 -35
- package/dist/AgentTools.js.map +1 -1
- package/dist/bin/{AiError-fiHIiGOy.mjs → AiError-CsvdOsKR.mjs} +67 -43
- package/dist/bin/Latch-B3e9629m.mjs +5 -0
- package/dist/bin/{McpClient-CXwyRd_3.mjs → McpClient-BCxZZgnA.mjs} +1 -1
- package/dist/bin/{OutputFormatter-B8yF7iiq.mjs → OutputFormatter-ByMjyBhe.mjs} +2 -2
- package/dist/bin/{Schema-D629S5yu.mjs → Schema-BfUmMefy.mjs} +224 -163
- package/dist/bin/{SemanticSearch-BlcfFvPr.mjs → SemanticSearch-DMzIsoZb.mjs} +68 -55
- package/dist/bin/cli.mjs +506 -381
- package/dist/bin/{helpers-CljL9OKa.mjs → helpers-Bb68A2Sv.mjs} +2 -2
- package/dist/bin/{index.min-ClUfQ5ji.mjs → index.min-CuA3AuA-.mjs} +1448 -1348
- package/dist/bin/{rolldown-runtime-5zChB7MF.mjs → rolldown-runtime-CXhmmSW5.mjs} +4 -4
- package/dist/bin/{server-HlLriZxF.mjs → server-D4nrvZHH.mjs} +2 -2
- package/dist/bin/{turndown.cjs-C2WBxeA-.mjs → turndown.cjs-CwE2EFNQ.mjs} +15 -10
- package/dist/bin/{types-LcwjLVkt.mjs → types-N9Z-HYP0.mjs} +1 -1
- package/dist/bin/{upgrade-E_f-q2h8.mjs → upgrade-t590zYhO.mjs} +4 -4
- package/package.json +15 -15
- package/src/Agent.ts +1 -1
- package/src/AgentCallerConfig.test.ts +39 -28
- package/src/AgentExecutor.test.ts +38 -0
- package/src/AgentExecutor.ts +1 -1
- package/src/AgentTools.ts +59 -44
- package/dist/bin/Latch-D1909CI6.mjs +0 -5
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ys from "node:stream";
|
|
2
2
|
import { StringDecoder } from "node:string_decoder";
|
|
3
|
-
import * as
|
|
3
|
+
import * as Qi from "node:fs";
|
|
4
4
|
import { posix, win32 } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { lstatSync, readdir, readdirSync, readlinkSync, realpathSync } from "fs";
|
|
7
7
|
import { EventEmitter } from "node:events";
|
|
8
8
|
import { channel, tracingChannel } from "node:diagnostics_channel";
|
|
9
9
|
import { lstat, readdir as readdir$1, readlink, realpath } from "node:fs/promises";
|
|
10
|
-
// node_modules/.pnpm/glob@14.0.
|
|
11
|
-
var
|
|
12
|
-
let s = r instanceof RegExp ?
|
|
10
|
+
// node_modules/.pnpm/glob@14.0.4/node_modules/glob/dist/esm/index.min.js
|
|
11
|
+
var re = (r, t, e) => {
|
|
12
|
+
let s = r instanceof RegExp ? We(r, e) : r, i = t instanceof RegExp ? We(t, e) : t, n = s !== null && i != null && js(s, i, e);
|
|
13
13
|
return n && {
|
|
14
14
|
start: n[0],
|
|
15
15
|
end: n[1],
|
|
@@ -18,171 +18,211 @@ var se = (r, t, e) => {
|
|
|
18
18
|
post: e.slice(n[1] + i.length)
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
var
|
|
21
|
+
var We = (r, t) => {
|
|
22
22
|
let e = t.match(r);
|
|
23
23
|
return e ? e[0] : null;
|
|
24
24
|
};
|
|
25
|
-
var
|
|
26
|
-
let s, i, n, o,
|
|
27
|
-
if (
|
|
28
|
-
if (r === t) return [
|
|
29
|
-
for (s = [], n = e.length; c >= 0 && !
|
|
30
|
-
if (c ===
|
|
25
|
+
var js = (r, t, e) => {
|
|
26
|
+
let s, i, n, o, h, a = e.indexOf(r), l = e.indexOf(t, a + 1), c = a;
|
|
27
|
+
if (a >= 0 && l > 0) {
|
|
28
|
+
if (r === t) return [a, l];
|
|
29
|
+
for (s = [], n = e.length; c >= 0 && !h;) {
|
|
30
|
+
if (c === a) s.push(c), a = e.indexOf(r, c + 1);
|
|
31
31
|
else if (s.length === 1) {
|
|
32
32
|
let f = s.pop();
|
|
33
|
-
f !== void 0 && (
|
|
33
|
+
f !== void 0 && (h = [f, l]);
|
|
34
34
|
} else i = s.pop(), i !== void 0 && i < n && (n = i, o = l), l = e.indexOf(t, c + 1);
|
|
35
|
-
c =
|
|
36
|
-
}
|
|
37
|
-
s.length && o !== void 0 && (
|
|
38
|
-
}
|
|
39
|
-
return
|
|
40
|
-
};
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
function
|
|
35
|
+
c = a < l && a >= 0 ? a : l;
|
|
36
|
+
}
|
|
37
|
+
s.length && o !== void 0 && (h = [n, o]);
|
|
38
|
+
}
|
|
39
|
+
return h;
|
|
40
|
+
};
|
|
41
|
+
var $e = "\0SLASH" + Math.random() + "\0";
|
|
42
|
+
var Ie = "\0OPEN" + Math.random() + "\0";
|
|
43
|
+
var le = "\0CLOSE" + Math.random() + "\0";
|
|
44
|
+
var Be = "\0COMMA" + Math.random() + "\0";
|
|
45
|
+
var Ue = "\0PERIOD" + Math.random() + "\0";
|
|
46
|
+
var Ws = new RegExp($e, "g");
|
|
47
|
+
var $s = new RegExp(Ie, "g");
|
|
48
|
+
var Is = new RegExp(le, "g");
|
|
49
|
+
var Bs = new RegExp(Be, "g");
|
|
50
|
+
var Us = new RegExp(Ue, "g");
|
|
51
|
+
var Gs = /\\\\/g;
|
|
52
|
+
var Hs = /\\{/g;
|
|
53
|
+
var qs = /\\}/g;
|
|
54
|
+
var Ks = /\\,/g;
|
|
55
|
+
var Xs = /\\\./g;
|
|
56
|
+
var Vs = 1e5;
|
|
57
|
+
var Ys = 4e6;
|
|
58
|
+
var Js = 1e3;
|
|
59
|
+
var Zs = 1e3;
|
|
60
|
+
function oe(r) {
|
|
61
61
|
return isNaN(r) ? r.charCodeAt(0) : parseInt(r, 10);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
return r.replace(
|
|
63
|
+
function Qs(r) {
|
|
64
|
+
return r.replace(Gs, $e).replace(Hs, Ie).replace(qs, le).replace(Ks, Be).replace(Xs, Ue);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return r.replace(
|
|
66
|
+
function ti(r) {
|
|
67
|
+
return r.replace(Ws, "\\").replace($s, "{").replace(Is, "}").replace(Bs, ",").replace(Us, ".");
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function he(r, t) {
|
|
70
70
|
for (let e = 0; e < t.length; e++) r.push(t[e]);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function ei(r) {
|
|
73
73
|
let t = [], e = "";
|
|
74
74
|
for (;;) {
|
|
75
|
-
let s =
|
|
75
|
+
let s = re("{", "}", r);
|
|
76
76
|
if (!s) {
|
|
77
|
-
let
|
|
78
|
-
return
|
|
77
|
+
let a = r.split(",");
|
|
78
|
+
return a[0] = e + a[0], he(t, a), t;
|
|
79
79
|
}
|
|
80
|
-
let { pre: i, body: n, post: o } = s,
|
|
81
|
-
if (
|
|
82
|
-
e =
|
|
80
|
+
let { pre: i, body: n, post: o } = s, h = i.split(",");
|
|
81
|
+
if (h[0] = e + h[0], h[h.length - 1] += "{" + n + "}", !o.length) return he(t, h), t;
|
|
82
|
+
e = h.pop(), he(t, h), r = o;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function Ge(r, t = {}) {
|
|
86
86
|
if (!r) return [];
|
|
87
|
-
let { max: e =
|
|
88
|
-
return r.slice(0, 2) === "{}" && (r = "\\{\\}" + r.slice(2)),
|
|
87
|
+
let { max: e = Vs, maxLength: s = Ys, maxDepth: i = Js, maxRewrites: n = Zs } = t;
|
|
88
|
+
return r.slice(0, 2) === "{}" && (r = "\\{\\}" + r.slice(2)), ae(Qs(r), e, s, i, 0, n, !0).map(ti);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function si(r) {
|
|
91
91
|
return "{" + r + "}";
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function ii(r) {
|
|
94
94
|
return /^-?0\d/.test(r);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function ni(r, t) {
|
|
97
97
|
return r <= t;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function ri(r, t) {
|
|
100
100
|
return r >= t;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
let o = [],
|
|
104
|
-
for (let
|
|
102
|
+
function ct(r, t, e, s, i, n) {
|
|
103
|
+
let o = [], h = 0;
|
|
104
|
+
for (let a = 0; a < r.length; a++) for (let l = 0; l < e.length; l++) {
|
|
105
105
|
if (o.length >= s) return o;
|
|
106
|
-
let c = r[
|
|
106
|
+
let c = r[a] + t + e[l];
|
|
107
107
|
if (!(n && !c)) {
|
|
108
|
-
if (
|
|
109
|
-
o.push(c),
|
|
108
|
+
if (h + c.length > i) return o;
|
|
109
|
+
o.push(c), h += c.length;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
return o;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function oi(r, t, e, s) {
|
|
115
115
|
let i = r.split(/\.\./), n = [];
|
|
116
116
|
if (i[0] === void 0 || i[1] === void 0) return n;
|
|
117
|
-
let o =
|
|
118
|
-
|
|
119
|
-
let
|
|
120
|
-
for (let g = o; c(g,
|
|
121
|
-
let
|
|
122
|
-
if (t)
|
|
123
|
-
else if (
|
|
124
|
-
let w =
|
|
117
|
+
let o = oe(i[0]), h = oe(i[1]), a = Math.max(i[0].length, i[1].length), l = i.length === 3 && i[2] !== void 0 ? Math.max(Math.abs(oe(i[2])), 1) : 1, c = ni;
|
|
118
|
+
h < o && (l *= -1, c = ri);
|
|
119
|
+
let u = i.some(ii), p = 0;
|
|
120
|
+
for (let g = o; c(g, h) && n.length < e; g += l) {
|
|
121
|
+
let d;
|
|
122
|
+
if (t) d = String.fromCharCode(g), d === "\\" && (d = "");
|
|
123
|
+
else if (d = String(g), u) {
|
|
124
|
+
let w = a - d.length;
|
|
125
125
|
if (w > 0) {
|
|
126
126
|
let m = new Array(w + 1).join("0");
|
|
127
|
-
g < 0 ?
|
|
127
|
+
g < 0 ? d = "-" + m + d.slice(1) : d = m + d;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
if (
|
|
131
|
-
n.push(
|
|
130
|
+
if (p + d.length > s) break;
|
|
131
|
+
n.push(d), p += d.length;
|
|
132
132
|
}
|
|
133
133
|
return n;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function ae(r, t, e, s, i, n, o) {
|
|
136
136
|
if (i > s) return [r];
|
|
137
|
-
let
|
|
137
|
+
let h = [""], a = 0, l = !1, c = !0;
|
|
138
138
|
for (;;) {
|
|
139
|
-
let f =
|
|
140
|
-
if (!f) return
|
|
141
|
-
let
|
|
142
|
-
if (/\$$/.test(
|
|
143
|
-
if (
|
|
139
|
+
let f = re("{", "}", r);
|
|
140
|
+
if (!f) return ct(h, r, [""], t, e, l);
|
|
141
|
+
let u = f.pre;
|
|
142
|
+
if (/\$$/.test(u)) {
|
|
143
|
+
if (h = ct(h, u + "{" + f.body + "}", [""], t, e, l && !f.post.length), c = !1, !f.post.length) break;
|
|
144
144
|
r = f.post;
|
|
145
145
|
continue;
|
|
146
146
|
}
|
|
147
|
-
let
|
|
148
|
-
if (!
|
|
149
|
-
if (
|
|
150
|
-
|
|
147
|
+
let p = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(f.body), g = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(f.body), d = p || g, w = f.body.indexOf(",") >= 0;
|
|
148
|
+
if (!d && !w) {
|
|
149
|
+
if (a < n && f.post.match(/,(?!,).*\}/)) {
|
|
150
|
+
a++, r = f.pre + "{" + f.body + le + f.post, o = !0;
|
|
151
151
|
continue;
|
|
152
152
|
}
|
|
153
|
-
return
|
|
153
|
+
return ct(h, u + "{" + f.body + "}" + f.post, [""], t, e, l);
|
|
154
154
|
}
|
|
155
|
-
c && (l = o && !
|
|
155
|
+
c && (l = o && !d, c = !1);
|
|
156
156
|
let m;
|
|
157
|
-
if (
|
|
157
|
+
if (d) m = oi(f.body, g, t, e);
|
|
158
158
|
else {
|
|
159
|
-
let b =
|
|
160
|
-
if (b.length === 1 && b[0] !== void 0 && (b =
|
|
161
|
-
if (
|
|
159
|
+
let b = ei(f.body);
|
|
160
|
+
if (b.length === 1 && b[0] !== void 0 && (b = ae(b[0], t, e, s, i + 1, n, !1).map(si), b.length === 1)) {
|
|
161
|
+
if (h = ct(h, u + b[0], [""], t, e, l && !f.post.length), !f.post.length) break;
|
|
162
162
|
r = f.post;
|
|
163
163
|
continue;
|
|
164
164
|
}
|
|
165
|
-
let
|
|
166
|
-
for (let y = 0;
|
|
165
|
+
let x = l && !f.post.length && !u;
|
|
166
|
+
for (let y = 0; x && y < h.length; y++) h[y] && (x = !1);
|
|
167
167
|
m = [];
|
|
168
168
|
let S = 0;
|
|
169
169
|
t: for (let y = 0; y < b.length; y++) {
|
|
170
|
-
let q =
|
|
170
|
+
let q = ae(b[y], t, e, s, i + 1, n, !1);
|
|
171
171
|
for (let W = 0; W < q.length; W++) {
|
|
172
|
-
let
|
|
173
|
-
if (!(
|
|
174
|
-
if (m.length >= t || S +
|
|
175
|
-
m.push(
|
|
172
|
+
let B = q[W];
|
|
173
|
+
if (!(x && !B)) {
|
|
174
|
+
if (m.length >= t || S + B.length > e) break t;
|
|
175
|
+
m.push(B), S += B.length;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
if (
|
|
180
|
+
if (h = ct(h, u, m, t, e, l && !f.post.length), !f.post.length) break;
|
|
181
181
|
r = f.post;
|
|
182
182
|
}
|
|
183
|
-
return
|
|
183
|
+
return h;
|
|
184
184
|
}
|
|
185
|
-
var
|
|
185
|
+
var fe = (r, t) => r === t ? {
|
|
186
|
+
t: "lit",
|
|
187
|
+
ch: String(r)
|
|
188
|
+
} : {
|
|
189
|
+
t: "class",
|
|
190
|
+
re: new RegExp(`^[${r}-${t}]$`)
|
|
191
|
+
};
|
|
192
|
+
var ce = (r, t) => t.map((e) => [fe(r, r), ...e]);
|
|
193
|
+
var ft = (r, t) => {
|
|
194
|
+
if (!r) return [[]];
|
|
195
|
+
let e = +r[0], s = +t[0], i = r.slice(1), n = t.slice(1);
|
|
196
|
+
if (e === s) return ce(e, ft(i, n));
|
|
197
|
+
let o = "0".repeat(i.length), h = "9".repeat(i.length), a = [];
|
|
198
|
+
i !== o && a.push(...ce(e++, ft(i, h)));
|
|
199
|
+
let l = n === h ? [] : ce(s--, ft(o, n));
|
|
200
|
+
return e <= s && a.push([fe(e, s), ...Array.from(i, () => fe(0, 9))]), a.push(...l), a;
|
|
201
|
+
};
|
|
202
|
+
var He = (r, t, e) => {
|
|
203
|
+
if (e) return ft(String(r).padStart(e, "0"), String(t).padStart(e, "0"));
|
|
204
|
+
let s = [];
|
|
205
|
+
for (let i = String(r).length; i <= String(t).length; i++) {
|
|
206
|
+
let n = Math.max(r, i === 1 ? 0 : 10 ** (i - 1)), o = Math.min(t, 10 ** i - 1);
|
|
207
|
+
s.push(...ft(String(n), String(o)));
|
|
208
|
+
}
|
|
209
|
+
return s;
|
|
210
|
+
};
|
|
211
|
+
var qe = (r, t) => {
|
|
212
|
+
let e = Number(r), s = Number(t);
|
|
213
|
+
if (!Number.isSafeInteger(e) || !Number.isSafeInteger(s)) return;
|
|
214
|
+
e > s && ([e, s] = [s, e]);
|
|
215
|
+
let n = /^-?0\d/.test(r) || /^-?0\d/.test(t) ? Math.max(r.length, t.length) : 0, o = [];
|
|
216
|
+
if (e < 0) {
|
|
217
|
+
let h = He(Math.max(-s, 1), -e, n && n - 1);
|
|
218
|
+
o.push(...h.map((a) => [{
|
|
219
|
+
t: "lit",
|
|
220
|
+
ch: "-"
|
|
221
|
+
}, ...a]));
|
|
222
|
+
}
|
|
223
|
+
return s >= 0 && o.push(...He(Math.max(e, 0), s, n)), o;
|
|
224
|
+
};
|
|
225
|
+
var hi = {
|
|
186
226
|
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"],
|
|
187
227
|
"[:alpha:]": ["\\p{L}\\p{Nl}"],
|
|
188
228
|
"[:ascii:]": ["\\x00-\\x7f"],
|
|
@@ -198,69 +238,74 @@ var Js = {
|
|
|
198
238
|
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],
|
|
199
239
|
"[:xdigit:]": ["A-Fa-f0-9"]
|
|
200
240
|
};
|
|
201
|
-
var
|
|
202
|
-
var
|
|
203
|
-
var
|
|
241
|
+
var ut = (r) => r.replace(/[[\]\\-]/g, "\\$&");
|
|
242
|
+
var ue = /$./;
|
|
243
|
+
var Ke = (r, t, e = !1, s) => {
|
|
204
244
|
let i = (m) => {
|
|
205
245
|
let b = s ? m.normalize(s) : m;
|
|
206
246
|
return [...b].length === 1 ? b : m;
|
|
207
247
|
}, n = t;
|
|
208
248
|
if (r.charAt(n) !== "[") throw new Error("not in a brace expression");
|
|
209
|
-
let o = [],
|
|
210
|
-
t: for (;
|
|
211
|
-
let m = String.fromCodePoint(r.codePointAt(
|
|
212
|
-
if ((m === "!" || m === "^") &&
|
|
213
|
-
f = !0,
|
|
249
|
+
let o = [], h = [], a = n + 1, l = !1, c = !1, f = !1, u = n, p = "";
|
|
250
|
+
t: for (; a < r.length;) {
|
|
251
|
+
let m = String.fromCodePoint(r.codePointAt(a));
|
|
252
|
+
if ((m === "!" || m === "^") && a === n + 1) {
|
|
253
|
+
f = !0, a++;
|
|
214
254
|
continue;
|
|
215
255
|
}
|
|
216
256
|
if (m === "]" && l && !c) {
|
|
217
|
-
|
|
257
|
+
u = a + 1;
|
|
218
258
|
break;
|
|
219
259
|
}
|
|
220
260
|
if (l = !0, m === "\\" && !c) {
|
|
221
|
-
c = !0,
|
|
261
|
+
c = !0, a++;
|
|
222
262
|
continue;
|
|
223
263
|
}
|
|
224
264
|
if (m === "[" && !c) {
|
|
225
|
-
for (let [
|
|
226
|
-
if (
|
|
227
|
-
|
|
265
|
+
for (let [x, [S, y]] of Object.entries(hi)) if (r.startsWith(x, a)) {
|
|
266
|
+
if (p) return [ue, r.length - n];
|
|
267
|
+
a += x.length, y ? h.push(S) : o.push(S);
|
|
228
268
|
continue t;
|
|
229
269
|
}
|
|
230
270
|
}
|
|
231
271
|
c = !1;
|
|
232
272
|
let b = i(m);
|
|
233
|
-
if (
|
|
234
|
-
b.codePointAt(0) >
|
|
273
|
+
if (p) {
|
|
274
|
+
b.codePointAt(0) > p.codePointAt(0) ? o.push(ut(p) + "-" + ut(b)) : b === p && o.push(ut(b)), p = "", a += m.length;
|
|
235
275
|
continue;
|
|
236
276
|
}
|
|
237
|
-
if (r.startsWith("-]",
|
|
238
|
-
o.push(
|
|
277
|
+
if (r.startsWith("-]", a + m.length)) {
|
|
278
|
+
o.push(ut(b + "-")), a += m.length + 1;
|
|
239
279
|
continue;
|
|
240
280
|
}
|
|
241
|
-
if (r.startsWith("-",
|
|
242
|
-
|
|
281
|
+
if (r.startsWith("-", a + m.length)) {
|
|
282
|
+
p = b, a += m.length + 1;
|
|
243
283
|
continue;
|
|
244
284
|
}
|
|
245
|
-
o.push(
|
|
285
|
+
o.push(ut(b)), a += m.length;
|
|
246
286
|
}
|
|
247
|
-
if (
|
|
248
|
-
if (!o.length && !
|
|
249
|
-
let g = "[" + (f ? "^" : "") + o.join("") + "]",
|
|
250
|
-
return [new RegExp(w, e ? "iu" : "u"),
|
|
287
|
+
if (u < a) return [ue, 0];
|
|
288
|
+
if (!o.length && !h.length) return [ue, r.length - n];
|
|
289
|
+
let g = "[" + (f ? "^" : "") + o.join("") + "]", d = "[" + (f ? "" : "^") + h.join("") + "]", w = "^" + (o.length && h.length ? "(" + g + "|" + d + ")" : o.length ? g : d);
|
|
290
|
+
return [new RegExp(w, e ? "iu" : "u"), u - n];
|
|
251
291
|
};
|
|
252
|
-
var
|
|
292
|
+
var de = {
|
|
253
293
|
t: "match",
|
|
254
294
|
id: 0
|
|
255
295
|
};
|
|
256
|
-
var
|
|
257
|
-
var
|
|
296
|
+
var ai = "!?+*@";
|
|
297
|
+
var Z = (r) => ({
|
|
258
298
|
t: "lit",
|
|
259
299
|
ch: r
|
|
260
300
|
});
|
|
261
|
-
var
|
|
262
|
-
var
|
|
263
|
-
var
|
|
301
|
+
var li = (r) => r.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&");
|
|
302
|
+
var Je = (r) => new RegExp(`^${li(r)}$`, "iu");
|
|
303
|
+
var Dt = new Map();
|
|
304
|
+
var Ze = (r) => {
|
|
305
|
+
let t = Dt.get(r);
|
|
306
|
+
return t || (t = Je(r), Dt.size >= 1e3 && Dt.clear(), Dt.set(r, t)), t;
|
|
307
|
+
};
|
|
308
|
+
var ge = (r, t) => {
|
|
264
309
|
if (t === r.ch) return !0;
|
|
265
310
|
if (!r.re) return !1;
|
|
266
311
|
let e = t.charCodeAt(0);
|
|
@@ -268,60 +313,74 @@ var ue = (r, t) => {
|
|
|
268
313
|
let s = r.ascii ??= new Uint8Array(128);
|
|
269
314
|
return s[e] ||= r.re.test(t) ? 1 : 2, s[e] === 1;
|
|
270
315
|
};
|
|
271
|
-
var
|
|
272
|
-
let
|
|
273
|
-
for (let
|
|
274
|
-
let
|
|
275
|
-
if (
|
|
276
|
-
let a = r.
|
|
277
|
-
|
|
316
|
+
var ci = (r, t, e, s, i) => {
|
|
317
|
+
let n = [];
|
|
318
|
+
for (let o = 0; o < r.length;) {
|
|
319
|
+
let h = String.fromCodePoint(r.codePointAt(o));
|
|
320
|
+
if (i) {
|
|
321
|
+
let a = h === "\\" && r.startsWith(i, o + 1) ? 1 : 0;
|
|
322
|
+
if (a || h === i) {
|
|
323
|
+
let l = o + a + i.length, c = r.indexOf(i, l), f = /^(-?\d+)\.\.(-?\d+)$/.exec(r.slice(l, c)), u = c !== -1 && f && qe(f[1], f[2]);
|
|
324
|
+
if (u) {
|
|
325
|
+
n.push({
|
|
326
|
+
t: "ext",
|
|
327
|
+
type: "@",
|
|
328
|
+
alts: u
|
|
329
|
+
}), o = c + i.length;
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (h === "\\") {
|
|
335
|
+
let a = r.codePointAt(o + 1), l = a === void 0 ? h : String.fromCodePoint(a);
|
|
336
|
+
n.push(Z(l)), o += 1 + l.length;
|
|
278
337
|
continue;
|
|
279
338
|
}
|
|
280
|
-
if (
|
|
281
|
-
let [a,
|
|
282
|
-
if (
|
|
283
|
-
|
|
339
|
+
if (h === "[") {
|
|
340
|
+
let [a, l] = Ke(r, o, t, s);
|
|
341
|
+
if (l) {
|
|
342
|
+
n.push({
|
|
284
343
|
t: "class",
|
|
285
344
|
re: a
|
|
286
|
-
}),
|
|
345
|
+
}), o += l;
|
|
287
346
|
continue;
|
|
288
347
|
}
|
|
289
348
|
}
|
|
290
|
-
if (!e &&
|
|
291
|
-
|
|
349
|
+
if (!e && ai.includes(h) && r[o + 1] === "(") {
|
|
350
|
+
n.push({
|
|
292
351
|
t: "open",
|
|
293
|
-
type:
|
|
294
|
-
}),
|
|
352
|
+
type: h
|
|
353
|
+
}), o += 2;
|
|
295
354
|
continue;
|
|
296
355
|
}
|
|
297
|
-
|
|
356
|
+
n.push(!e && h === "|" ? { t: "bar" } : !e && h === ")" ? { t: "close" } : h === "*" ? { t: "star" } : h === "?" ? { t: "any" } : Z(h)), o += h.length;
|
|
298
357
|
}
|
|
299
|
-
return
|
|
358
|
+
return n;
|
|
300
359
|
};
|
|
301
|
-
var
|
|
360
|
+
var fi = (r) => {
|
|
302
361
|
let t = new Map(), e = [];
|
|
303
362
|
return r.forEach((s, i) => {
|
|
304
363
|
s.t === "open" ? e.push(i) : s.t === "close" && e.length && t.set(e.pop(), i);
|
|
305
364
|
}), t;
|
|
306
365
|
};
|
|
307
|
-
var
|
|
366
|
+
var Qe = (r, t, e, s, i) => {
|
|
308
367
|
let n = [], o = [n];
|
|
309
|
-
for (let
|
|
310
|
-
let
|
|
311
|
-
if (
|
|
312
|
-
let c =
|
|
368
|
+
for (let h = e; h < s; h++) {
|
|
369
|
+
let a = r[h], l = t.get(h);
|
|
370
|
+
if (a.t === "open" && l !== void 0) {
|
|
371
|
+
let c = Qe(r, t, h + 1, l, !1);
|
|
313
372
|
n.push({
|
|
314
373
|
t: "ext",
|
|
315
|
-
type:
|
|
374
|
+
type: a.type,
|
|
316
375
|
alts: c
|
|
317
|
-
}),
|
|
318
|
-
} else
|
|
376
|
+
}), h = l;
|
|
377
|
+
} else a.t === "bar" && !i ? o.push(n = []) : a.t === "open" ? n.push(Z(a.type), Z("(")) : a.t === "bar" ? n.push(Z("|")) : a.t === "close" ? n.push(Z(")")) : n.push(a);
|
|
319
378
|
}
|
|
320
379
|
return o;
|
|
321
380
|
};
|
|
322
|
-
var
|
|
381
|
+
var ts = (r, t) => {
|
|
323
382
|
let e = [], s = "", i = () => {
|
|
324
|
-
for (let n of s.normalize(t)) e.push(
|
|
383
|
+
for (let n of s.normalize(t)) e.push(Z(n));
|
|
325
384
|
s = "";
|
|
326
385
|
};
|
|
327
386
|
for (let n of r) {
|
|
@@ -331,81 +390,81 @@ var Ge = (r, t) => {
|
|
|
331
390
|
}
|
|
332
391
|
i(), e.push(n.t === "ext" ? {
|
|
333
392
|
...n,
|
|
334
|
-
alts: n.alts.map((o) =>
|
|
393
|
+
alts: n.alts.map((o) => ts(o, t))
|
|
335
394
|
} : n);
|
|
336
395
|
}
|
|
337
396
|
return i(), e;
|
|
338
397
|
};
|
|
339
|
-
var
|
|
340
|
-
let e = 1, s = (
|
|
398
|
+
var ui = (r, t) => {
|
|
399
|
+
let e = 1, s = (h) => ({
|
|
341
400
|
t: "split",
|
|
342
401
|
id: e++,
|
|
343
|
-
out:
|
|
344
|
-
}), i = (
|
|
345
|
-
switch (
|
|
402
|
+
out: h
|
|
403
|
+
}), i = (h, a) => h.reduceRight((l, c) => n(c, l), a), n = (h, a) => {
|
|
404
|
+
switch (h.t) {
|
|
346
405
|
case "lit":
|
|
347
|
-
let
|
|
406
|
+
let u = t ? Ze(h.ch) : void 0;
|
|
348
407
|
return {
|
|
349
408
|
t: "lit",
|
|
350
409
|
id: e++,
|
|
351
|
-
ch:
|
|
352
|
-
re:
|
|
353
|
-
next:
|
|
410
|
+
ch: h.ch,
|
|
411
|
+
re: u,
|
|
412
|
+
next: a
|
|
354
413
|
};
|
|
355
414
|
case "any":
|
|
356
415
|
case "star": return {
|
|
357
|
-
t:
|
|
416
|
+
t: h.t,
|
|
358
417
|
id: e++,
|
|
359
|
-
next:
|
|
418
|
+
next: a
|
|
360
419
|
};
|
|
361
420
|
case "class": return {
|
|
362
421
|
t: "class",
|
|
363
422
|
id: e++,
|
|
364
|
-
re:
|
|
365
|
-
next:
|
|
423
|
+
re: h.re,
|
|
424
|
+
next: a
|
|
366
425
|
};
|
|
367
426
|
}
|
|
368
|
-
let l = (
|
|
369
|
-
switch (
|
|
370
|
-
case "@": return s(l(
|
|
371
|
-
case "?": return s([
|
|
427
|
+
let l = (u) => h.alts.map((p) => i(p, u));
|
|
428
|
+
switch (h.type) {
|
|
429
|
+
case "@": return s(l(a));
|
|
430
|
+
case "?": return s([a, ...l(a)]);
|
|
372
431
|
case "!": return {
|
|
373
432
|
t: "neg",
|
|
374
433
|
id: e++,
|
|
375
|
-
sub: s(l(
|
|
376
|
-
next:
|
|
434
|
+
sub: s(l(de)),
|
|
435
|
+
next: a
|
|
377
436
|
};
|
|
378
437
|
}
|
|
379
438
|
let c = s([]), f = s(l(c));
|
|
380
|
-
return c.out.push(
|
|
439
|
+
return c.out.push(a, f), h.type === "*" ? c : f;
|
|
381
440
|
};
|
|
382
|
-
return [i(r,
|
|
441
|
+
return [i(r, de), e];
|
|
383
442
|
};
|
|
384
|
-
var
|
|
443
|
+
var di = (r) => {
|
|
385
444
|
let t = [], e = new Set(), s = (n) => n.t === "match" ? "match" : String(n.id), i = (n, o) => {
|
|
386
445
|
if (n.t === "match" || e.has(n)) return;
|
|
387
446
|
e.add(n);
|
|
388
|
-
let
|
|
447
|
+
let h = (a) => t.push(`${o}${n.id}: ${a}`);
|
|
389
448
|
switch (n.t) {
|
|
390
449
|
case "split":
|
|
391
|
-
|
|
392
|
-
for (let
|
|
450
|
+
h(`split -> ${n.out.map(s).join(", ")}`);
|
|
451
|
+
for (let a of n.out) i(a, o);
|
|
393
452
|
return;
|
|
394
|
-
case "neg": return
|
|
453
|
+
case "neg": return h(`!(${s(n.sub)}) -> ${s(n.next)}`), i(n.sub, o + " "), i(n.next, o);
|
|
395
454
|
case "lit":
|
|
396
|
-
|
|
455
|
+
h(`${JSON.stringify(n.ch)} -> ${s(n.next)}`);
|
|
397
456
|
break;
|
|
398
457
|
case "class":
|
|
399
|
-
|
|
458
|
+
h(`${n.re} -> ${s(n.next)}`);
|
|
400
459
|
break;
|
|
401
|
-
default:
|
|
460
|
+
default: h(`${n.t === "any" ? "?" : "*"} -> ${s(n.next)}`);
|
|
402
461
|
}
|
|
403
462
|
i(n.next, o);
|
|
404
463
|
};
|
|
405
464
|
return i(r, ""), [`start -> ${s(r)}`, ...t].join(`
|
|
406
465
|
`);
|
|
407
466
|
};
|
|
408
|
-
var
|
|
467
|
+
var pe = class {
|
|
409
468
|
gen;
|
|
410
469
|
threads = [];
|
|
411
470
|
match = !1;
|
|
@@ -418,13 +477,13 @@ var ce = class {
|
|
|
418
477
|
return !this.threads.length && !this.match && !this.runs.length;
|
|
419
478
|
}
|
|
420
479
|
};
|
|
421
|
-
var
|
|
422
|
-
var
|
|
480
|
+
var es = (r, t) => r.ids.length !== t.ids.length || r.runs.length !== t.runs.length || r.ids.some((e, s) => e !== t.ids[s]) ? !1 : r.runs.every((e) => t.runs.some((s) => s.neg === e.neg && es(s.state, e.state)));
|
|
481
|
+
var Xe = (r) => ({
|
|
423
482
|
has: new Float64Array(r),
|
|
424
483
|
seen: new Float64Array(r),
|
|
425
484
|
gen: 0
|
|
426
485
|
});
|
|
427
|
-
var
|
|
486
|
+
var dt = class {
|
|
428
487
|
dots;
|
|
429
488
|
dotStart;
|
|
430
489
|
#t;
|
|
@@ -432,16 +491,16 @@ var ft = class {
|
|
|
432
491
|
this.dots = t, this.dotStart = e, this.#t = s;
|
|
433
492
|
}
|
|
434
493
|
state() {
|
|
435
|
-
return new
|
|
494
|
+
return new pe(++this.#t.gen);
|
|
436
495
|
}
|
|
437
496
|
done(t) {
|
|
438
|
-
return t.ids = t.threads.map((e) => e.id).sort((e, s) => e - s), t.match && t.ids.unshift(
|
|
497
|
+
return t.ids = t.threads.map((e) => e.id).sort((e, s) => e - s), t.match && t.ids.unshift(de.id), t;
|
|
439
498
|
}
|
|
440
|
-
#
|
|
499
|
+
#n(t, e) {
|
|
441
500
|
let { seen: s } = this.#t;
|
|
442
501
|
return s[e.id] === t.gen ? !1 : (s[e.id] = t.gen, !0);
|
|
443
502
|
}
|
|
444
|
-
#
|
|
503
|
+
#i(t, e) {
|
|
445
504
|
let { has: s } = this.#t;
|
|
446
505
|
return s[e.id] === t.gen ? !1 : (s[e.id] = t.gen, t.threads.push(e), !0);
|
|
447
506
|
}
|
|
@@ -451,11 +510,11 @@ var ft = class {
|
|
|
451
510
|
add(t, e, s, i) {
|
|
452
511
|
switch (e.t) {
|
|
453
512
|
case "split":
|
|
454
|
-
if (!this.#
|
|
513
|
+
if (!this.#n(t, e)) return;
|
|
455
514
|
for (let o of e.out) this.add(t, o, s, i);
|
|
456
515
|
return;
|
|
457
516
|
case "neg":
|
|
458
|
-
if (!this.#
|
|
517
|
+
if (!this.#n(t, e)) return;
|
|
459
518
|
let n = this.state();
|
|
460
519
|
return this.add(n, e.sub, s, !1), this.done(n), this.addRun(t, {
|
|
461
520
|
t: "run",
|
|
@@ -464,23 +523,23 @@ var ft = class {
|
|
|
464
523
|
}, s, i);
|
|
465
524
|
case "star":
|
|
466
525
|
if (this.restricted(s, i)) return;
|
|
467
|
-
this.#
|
|
526
|
+
this.#i(t, e) && this.add(t, e.next, s, i);
|
|
468
527
|
return;
|
|
469
528
|
case "match":
|
|
470
529
|
t.match = !0;
|
|
471
530
|
return;
|
|
472
|
-
default: this.#
|
|
531
|
+
default: this.#i(t, e);
|
|
473
532
|
}
|
|
474
533
|
}
|
|
475
534
|
addRun(t, e, s, i) {
|
|
476
|
-
for (let n of t.runs) if (n.neg === e.neg &&
|
|
535
|
+
for (let n of t.runs) if (n.neg === e.neg && es(n.state, e.state)) return;
|
|
477
536
|
t.runs.push(e), e.state.match || this.add(t, e.neg.next, s, i);
|
|
478
537
|
}
|
|
479
538
|
step(t, e, s, i) {
|
|
480
539
|
let n = this.state();
|
|
481
540
|
for (let o of t.threads) switch (o.t) {
|
|
482
541
|
case "lit":
|
|
483
|
-
|
|
542
|
+
ge(o, e) && this.add(n, o.next, s + 1, i);
|
|
484
543
|
break;
|
|
485
544
|
case "any":
|
|
486
545
|
this.restricted(s, i) || this.add(n, o.next, s + 1, i);
|
|
@@ -495,34 +554,34 @@ var ft = class {
|
|
|
495
554
|
this.addRun(n, o, s + 1, i);
|
|
496
555
|
continue;
|
|
497
556
|
}
|
|
498
|
-
let
|
|
557
|
+
let h = this.step(o.state, e, s, !1);
|
|
499
558
|
this.addRun(n, {
|
|
500
559
|
t: "run",
|
|
501
560
|
neg: o.neg,
|
|
502
|
-
state:
|
|
561
|
+
state: h
|
|
503
562
|
}, s + 1, i);
|
|
504
563
|
}
|
|
505
564
|
return this.done(n);
|
|
506
565
|
}
|
|
507
566
|
};
|
|
508
|
-
var
|
|
567
|
+
var ss = (r) => {
|
|
509
568
|
let t = r.ids.join();
|
|
510
569
|
if (!r.runs.length) return t;
|
|
511
|
-
return `${t}|${r.runs.map((s) => `${s.neg.id}(${
|
|
570
|
+
return `${t}|${r.runs.map((s) => `${s.neg.id}(${ss(s.state)})`).sort().join("|")}`;
|
|
512
571
|
};
|
|
513
|
-
var
|
|
514
|
-
var
|
|
572
|
+
var pi = 1 << 18;
|
|
573
|
+
var me = class {
|
|
515
574
|
#t;
|
|
516
|
-
#
|
|
517
|
-
#
|
|
575
|
+
#n = new Map();
|
|
576
|
+
#i = 0;
|
|
518
577
|
#o;
|
|
519
578
|
#r;
|
|
520
579
|
#d;
|
|
521
|
-
#
|
|
580
|
+
#u;
|
|
522
581
|
constructor(t, e) {
|
|
523
|
-
this.#t = t, this.#d = new
|
|
582
|
+
this.#t = t, this.#d = new dt(!1, !1, e), this.#u = new dt(!1, !0, e);
|
|
524
583
|
}
|
|
525
|
-
#
|
|
584
|
+
#f(t) {
|
|
526
585
|
return {
|
|
527
586
|
state: t,
|
|
528
587
|
match: t.match,
|
|
@@ -531,20 +590,20 @@ var fe = class {
|
|
|
531
590
|
};
|
|
532
591
|
}
|
|
533
592
|
#h(t) {
|
|
534
|
-
let e =
|
|
593
|
+
let e = ss(t), s = this.#n.get(e);
|
|
535
594
|
if (s) return s;
|
|
536
|
-
this.#
|
|
537
|
-
let i = this.#
|
|
538
|
-
return this.#
|
|
595
|
+
this.#i > pi && this.#m();
|
|
596
|
+
let i = this.#f(t);
|
|
597
|
+
return this.#n.set(e, i), this.#i += e.length + 1, i;
|
|
539
598
|
}
|
|
540
599
|
#m() {
|
|
541
|
-
this.#
|
|
600
|
+
this.#n.clear(), this.#i = 0, this.#o = void 0, this.#r = void 0;
|
|
542
601
|
}
|
|
543
602
|
start(t) {
|
|
544
603
|
if (t) {
|
|
545
604
|
if (this.#r) return this.#r;
|
|
546
|
-
let s = this.#
|
|
547
|
-
return this.#
|
|
605
|
+
let s = this.#u.state();
|
|
606
|
+
return this.#u.add(s, this.#t, 0, !0), this.#r = this.#f(this.#u.done(s));
|
|
548
607
|
}
|
|
549
608
|
if (this.#o) return this.#o;
|
|
550
609
|
let e = this.#d.state();
|
|
@@ -553,11 +612,11 @@ var fe = class {
|
|
|
553
612
|
next(t, e) {
|
|
554
613
|
let s = e.charCodeAt(0), i = s < 128 ? void 0 : t.next.get(e);
|
|
555
614
|
if (i) return i;
|
|
556
|
-
let n = t === this.#r ? this.#h(this.#
|
|
557
|
-
return s < 128 ? (t.ascii || (t.ascii = new Array(128), this.#
|
|
615
|
+
let n = t === this.#r ? this.#h(this.#u.step(t.state, e, 0, !0)) : this.#h(this.#d.step(t.state, e, 1, !0));
|
|
616
|
+
return s < 128 ? (t.ascii || (t.ascii = new Array(128), this.#i += 128), t.ascii[s] = n) : t.next.set(e, n), this.#i++, n;
|
|
558
617
|
}
|
|
559
618
|
};
|
|
560
|
-
var
|
|
619
|
+
var mi = (r) => {
|
|
561
620
|
let t = [];
|
|
562
621
|
for (let e = r; e.t !== "match"; e = e.next) {
|
|
563
622
|
if (e.t === "split" || e.t === "neg") return;
|
|
@@ -565,172 +624,179 @@ var oi = (r) => {
|
|
|
565
624
|
}
|
|
566
625
|
return t;
|
|
567
626
|
};
|
|
568
|
-
var
|
|
569
|
-
let i = 0, n = e, o = -1,
|
|
627
|
+
var gi = (r, t, e, s) => {
|
|
628
|
+
let i = 0, n = e, o = -1, h = 0;
|
|
570
629
|
for (; n < s;) {
|
|
571
|
-
let
|
|
572
|
-
if (
|
|
573
|
-
o = i++,
|
|
630
|
+
let a = r[i];
|
|
631
|
+
if (a?.t === "star") {
|
|
632
|
+
o = i++, h = n;
|
|
574
633
|
continue;
|
|
575
634
|
}
|
|
576
635
|
let l = t[n];
|
|
577
|
-
if (
|
|
636
|
+
if (a && (a.t === "any" || a.t === "lit" && ge(a, l) || a.t === "class" && a.re.test(l))) {
|
|
578
637
|
i++, n++;
|
|
579
638
|
continue;
|
|
580
639
|
}
|
|
581
640
|
if (o === -1) return !1;
|
|
582
|
-
i = o + 1, n = ++
|
|
641
|
+
i = o + 1, n = ++h;
|
|
583
642
|
}
|
|
584
643
|
for (; r[i]?.t === "star";) i++;
|
|
585
644
|
return i === r.length;
|
|
586
645
|
};
|
|
587
|
-
var
|
|
646
|
+
var is = (r) => {
|
|
588
647
|
let t = 0, e = 0;
|
|
589
648
|
for (let s of r) {
|
|
590
|
-
let [i, n] =
|
|
649
|
+
let [i, n] = wi(s);
|
|
591
650
|
t += i, e += n;
|
|
592
651
|
}
|
|
593
652
|
return [t, e];
|
|
594
653
|
};
|
|
595
|
-
var
|
|
654
|
+
var wi = (r) => {
|
|
596
655
|
if (r.t === "star") return [0, 1 / 0];
|
|
597
656
|
if (r.t !== "ext") return [1, 1];
|
|
598
657
|
if (r.type === "!") return [0, 1 / 0];
|
|
599
|
-
let t = r.alts.map(
|
|
658
|
+
let t = r.alts.map(is), e = Math.min(...t.map((n) => n[0])), s = Math.max(...t.map((n) => n[1])), i = s === 0 ? 0 : 1 / 0;
|
|
600
659
|
return r.type === "@" ? [e, s] : r.type === "?" ? [0, s] : r.type === "*" ? [0, i] : [e, i];
|
|
601
660
|
};
|
|
602
|
-
var
|
|
603
|
-
for (let s = 0; s < r.length; s++) if (!
|
|
661
|
+
var Ve = (r, t, e) => {
|
|
662
|
+
for (let s = 0; s < r.length; s++) if (!ge(r[s], t[e + s])) return !1;
|
|
604
663
|
return !0;
|
|
605
664
|
};
|
|
606
|
-
var
|
|
607
|
-
var
|
|
608
|
-
var
|
|
609
|
-
var
|
|
665
|
+
var bi = /[/\ud800-\udfff]/;
|
|
666
|
+
var yi = /[\ud800-\udfff]/;
|
|
667
|
+
var Nt = (r) => yi.test(r) ? [...r] : r;
|
|
668
|
+
var Ye = (r) => {
|
|
610
669
|
if (r.includes("/")) throw new Error("can only match a single path portion, got: " + r);
|
|
611
670
|
};
|
|
612
|
-
var
|
|
671
|
+
var pt = class {
|
|
613
672
|
pattern;
|
|
614
673
|
options;
|
|
615
674
|
#t;
|
|
675
|
+
#n;
|
|
616
676
|
#i;
|
|
617
|
-
#e;
|
|
618
677
|
#o;
|
|
619
678
|
#r;
|
|
620
|
-
#d;
|
|
621
|
-
#
|
|
622
|
-
#
|
|
623
|
-
#h =
|
|
624
|
-
#m =
|
|
679
|
+
#d = !1;
|
|
680
|
+
#u;
|
|
681
|
+
#f;
|
|
682
|
+
#h = !1;
|
|
683
|
+
#m = 0;
|
|
684
|
+
#l = 1 / 0;
|
|
625
685
|
#a = [];
|
|
626
|
-
#
|
|
627
|
-
#n;
|
|
628
|
-
#w;
|
|
629
|
-
#x = !1;
|
|
686
|
+
#s = [];
|
|
630
687
|
#b;
|
|
631
|
-
#
|
|
688
|
+
#E;
|
|
689
|
+
#y = !1;
|
|
690
|
+
#g;
|
|
691
|
+
#w;
|
|
632
692
|
constructor(t, e = {}) {
|
|
633
693
|
if (t.includes("/")) throw new Error("can only match a single path portion, got pattern: " + t);
|
|
634
694
|
this.pattern = t, this.options = e;
|
|
635
695
|
let { nocase: s = !1, noext: i = !1, normalize: n } = e;
|
|
636
|
-
this.#
|
|
637
|
-
let o = /^[?*+@]\(\)$/.test(t),
|
|
638
|
-
this.#
|
|
639
|
-
let [l, c] =
|
|
640
|
-
if (this.#t = l, this.#
|
|
696
|
+
this.#w = n === !0 ? "NFC" : n || void 0;
|
|
697
|
+
let o = /^[?*+@]\(\)$/.test(t), h = ci(t, s, i || o, this.#w, e.rangeMark), [a] = Qe(h, fi(h), 0, h.length, !0);
|
|
698
|
+
this.#w && (a = ts(a, this.#w));
|
|
699
|
+
let [l, c] = ui(a, s);
|
|
700
|
+
if (this.#t = l, this.#n = c, a.every((f) => f.t === "lit")) this.#r = a.map((f) => f.ch).join(""), this.#d = s;
|
|
641
701
|
else {
|
|
642
702
|
let f = (g) => g.t !== "lit" ? void 0 : s ? {
|
|
643
703
|
ch: g.ch,
|
|
644
|
-
re:
|
|
704
|
+
re: Ze(g.ch)
|
|
645
705
|
} : { ch: g.ch };
|
|
646
|
-
for (let g of
|
|
647
|
-
let
|
|
648
|
-
if (!
|
|
649
|
-
this.#a.push(
|
|
706
|
+
for (let g of a) {
|
|
707
|
+
let d = f(g);
|
|
708
|
+
if (!d) break;
|
|
709
|
+
this.#a.push(d);
|
|
650
710
|
}
|
|
651
|
-
for (let g =
|
|
652
|
-
let
|
|
653
|
-
if (!
|
|
654
|
-
this.#
|
|
711
|
+
for (let g = a.length - 1; g >= 0; g--) {
|
|
712
|
+
let d = f(a[g]);
|
|
713
|
+
if (!d) break;
|
|
714
|
+
this.#s.unshift(d);
|
|
655
715
|
}
|
|
656
|
-
this.#
|
|
657
|
-
let [
|
|
658
|
-
this.#
|
|
716
|
+
this.#y = !!(this.#a.length || this.#s.length), s || (this.#b = this.#a.map((g) => g.ch).join(""), this.#E = this.#s.map((g) => g.ch).join("")), this.#f = mi(this.#t)?.slice(this.#a.length, -this.#s.length || void 0), this.#h = !!this.#f?.every((g) => g.t === "star" || g.t === "any");
|
|
717
|
+
let [u, p] = is(a);
|
|
718
|
+
this.#m = u, this.#l = p;
|
|
659
719
|
}
|
|
660
720
|
}
|
|
661
721
|
test(t) {
|
|
662
|
-
return this.#
|
|
722
|
+
return this.#w ? (Ye(t), this.#p(t.normalize(this.#w))) : bi.test(t) ? (Ye(t), this.#p(t, [...t])) : this.#p(t, t);
|
|
663
723
|
}
|
|
664
724
|
testUnchecked(t) {
|
|
665
|
-
return this.#
|
|
725
|
+
return this.#p(this.#w ? t.normalize(this.#w) : t);
|
|
666
726
|
}
|
|
667
|
-
#
|
|
668
|
-
if (this.#r !== void 0) return this.#d ? this.#
|
|
669
|
-
let s = this.#
|
|
727
|
+
#p(t, e) {
|
|
728
|
+
if (this.#r !== void 0) return this.#d ? (this.#u ??= Je(this.#r)).test(t) : t === this.#r;
|
|
729
|
+
let s = this.#m, i = this.#l;
|
|
670
730
|
if (e === void 0) {
|
|
671
731
|
let c = t.length, f = c + 1 >> 1;
|
|
672
732
|
if (c < s || f > i) return !1;
|
|
673
|
-
(f < s || c > i) && (e =
|
|
733
|
+
(f < s || c > i) && (e = Nt(t));
|
|
674
734
|
}
|
|
675
735
|
if (e !== void 0 && (e.length < s || e.length > i)) return !1;
|
|
676
736
|
let n = this.#a.length;
|
|
677
|
-
if (this.#
|
|
678
|
-
if (!t.startsWith(this.#
|
|
737
|
+
if (this.#y) if (this.#b !== void 0 && this.#E !== void 0) {
|
|
738
|
+
if (!t.startsWith(this.#b) || !t.endsWith(this.#E)) return !1;
|
|
679
739
|
} else {
|
|
680
|
-
e ??=
|
|
681
|
-
let c = e.length - this.#
|
|
682
|
-
if (!
|
|
740
|
+
e ??= Nt(t);
|
|
741
|
+
let c = e.length - this.#s.length;
|
|
742
|
+
if (!Ve(this.#a, e, 0) || !Ve(this.#s, e, c)) return !1;
|
|
683
743
|
}
|
|
684
744
|
let o = !this.options.dot && t.startsWith(".");
|
|
685
|
-
if (this.#
|
|
745
|
+
if (this.#f) {
|
|
686
746
|
if (t === "." || t === ".." || o && !n) return !1;
|
|
687
|
-
if (this.#
|
|
688
|
-
e ??=
|
|
689
|
-
let c = e.length - this.#
|
|
690
|
-
return
|
|
691
|
-
}
|
|
692
|
-
if (e ??=
|
|
693
|
-
this.#
|
|
694
|
-
let c = this.#o ??= new
|
|
747
|
+
if (this.#h) return !0;
|
|
748
|
+
e ??= Nt(t);
|
|
749
|
+
let c = e.length - this.#s.length;
|
|
750
|
+
return gi(this.#f, e, n, c);
|
|
751
|
+
}
|
|
752
|
+
if (e ??= Nt(t), t === "." || t === "..") {
|
|
753
|
+
this.#i ??= Xe(this.#n);
|
|
754
|
+
let c = this.#o ??= new dt(!0, !1, this.#i), f = c.state();
|
|
695
755
|
c.add(f, this.#t, 0, !0);
|
|
696
|
-
let
|
|
697
|
-
for (let
|
|
698
|
-
return
|
|
756
|
+
let u = c.done(f);
|
|
757
|
+
for (let p = 0; p < e.length; p++) u = c.step(u, e[p], p, !0);
|
|
758
|
+
return u.match;
|
|
699
759
|
}
|
|
700
|
-
this.#
|
|
701
|
-
let
|
|
760
|
+
this.#i ??= Xe(this.#n);
|
|
761
|
+
let h = this.#g ??= new me(this.#t, this.#i), a = h.start(o), l = e === t;
|
|
702
762
|
for (let c = 0; c < e.length; c++) {
|
|
703
|
-
if (
|
|
763
|
+
if (a.dead) return !1;
|
|
704
764
|
let f = l ? t.charCodeAt(c) : e[c].charCodeAt(0);
|
|
705
|
-
|
|
765
|
+
a = a.ascii?.[f] ?? h.next(a, e[c]);
|
|
706
766
|
}
|
|
707
|
-
return
|
|
767
|
+
return a.match;
|
|
708
768
|
}
|
|
709
769
|
toString() {
|
|
710
|
-
return
|
|
770
|
+
return di(this.#t);
|
|
711
771
|
}
|
|
712
772
|
};
|
|
713
|
-
var
|
|
773
|
+
var mt = (r) => {
|
|
714
774
|
if (typeof r != "string") throw new TypeError("invalid pattern");
|
|
715
775
|
if (r.length > 65536) throw new TypeError("pattern is too long");
|
|
716
776
|
};
|
|
717
777
|
var K = (r, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? r.replace(/[?*()[\]{}]/g, "[$&]") : r.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? r.replace(/[?*()[\]]/g, "[$&]") : r.replace(/[?*()[\]\\]/g, "\\$&");
|
|
718
778
|
var st = (r, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? r.replace(/\[([^/\\])\]/g, "$1") : r.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1") : t ? r.replace(/\[([^/\\{}])\]/g, "$1") : r.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
|
|
719
|
-
var
|
|
720
|
-
var
|
|
721
|
-
var
|
|
779
|
+
var T = (r, t, e = {}) => (mt(t), !e.nocomment && t.charAt(0) === "#" ? !1 : xi(t, e).match(r));
|
|
780
|
+
var it = new Map();
|
|
781
|
+
var Si = 256;
|
|
782
|
+
var xi = (r, t) => {
|
|
783
|
+
let e = r + "\0" + JSON.stringify(t), s = it.get(e);
|
|
784
|
+
return s ? it.delete(e) : (s = new D(r, { ...t }), it.size >= Si && it.delete(it.keys().next().value)), it.set(e, s), s;
|
|
785
|
+
};
|
|
786
|
+
var ls = typeof process == "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
787
|
+
var ns = {
|
|
722
788
|
win32: { sep: "\\" },
|
|
723
789
|
posix: { sep: "/" }
|
|
724
790
|
};
|
|
725
|
-
|
|
726
|
-
var
|
|
727
|
-
|
|
728
|
-
var
|
|
729
|
-
|
|
791
|
+
T.sep = ls === "win32" ? ns.win32.sep : ns.posix.sep;
|
|
792
|
+
var v = Symbol("globstar **");
|
|
793
|
+
T.GLOBSTAR = v;
|
|
794
|
+
var Ei = (r, t = {}) => (e) => T(e, r, t);
|
|
795
|
+
T.filter = Ei;
|
|
730
796
|
var U = (r, t = {}) => Object.assign({}, r, t);
|
|
731
|
-
var
|
|
732
|
-
if (!r || typeof r != "object" || !Object.keys(r).length) return
|
|
733
|
-
let t =
|
|
797
|
+
var ki = (r) => {
|
|
798
|
+
if (!r || typeof r != "object" || !Object.keys(r).length) return T;
|
|
799
|
+
let t = T;
|
|
734
800
|
return Object.assign((s, i, n = {}) => t(s, i, U(r, n)), {
|
|
735
801
|
Minimatch: class extends t.Minimatch {
|
|
736
802
|
constructor(i, n = {}) {
|
|
@@ -747,19 +813,21 @@ var di = (r) => {
|
|
|
747
813
|
braceExpand: (s, i = {}) => t.braceExpand(s, U(r, i)),
|
|
748
814
|
match: (s, i, n = {}) => t.match(s, i, U(r, n)),
|
|
749
815
|
sep: t.sep,
|
|
750
|
-
GLOBSTAR:
|
|
816
|
+
GLOBSTAR: v
|
|
751
817
|
});
|
|
752
818
|
};
|
|
753
|
-
|
|
754
|
-
var
|
|
755
|
-
|
|
756
|
-
var
|
|
819
|
+
T.defaults = ki;
|
|
820
|
+
var xe = (r, t = {}) => (mt(r), t.nobrace || !/\{(?:(?!\{).)*\}/.test(r) ? [r] : Ge(r, { max: t.braceExpandMax }));
|
|
821
|
+
T.braceExpand = xe;
|
|
822
|
+
var Ci = 100;
|
|
823
|
+
var Ai = /(?<![\\$])\{(-?\d+)\.\.(-?\d+)\}/g;
|
|
824
|
+
var Mi = (r, t, e = {}) => {
|
|
757
825
|
let s = new D(t, e);
|
|
758
826
|
return r = r.filter((i) => s.match(i)), s.options.nonull && !r.length && r.push(t), r;
|
|
759
827
|
};
|
|
760
|
-
|
|
761
|
-
var
|
|
762
|
-
var
|
|
828
|
+
T.match = Mi;
|
|
829
|
+
var rs = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
830
|
+
var cs = (r, t) => {
|
|
763
831
|
let e = t + 1;
|
|
764
832
|
(r.charAt(e) === "!" || r.charAt(e) === "^") && e++;
|
|
765
833
|
let s = !1;
|
|
@@ -770,7 +838,7 @@ var es = (r, t) => {
|
|
|
770
838
|
}
|
|
771
839
|
return -1;
|
|
772
840
|
};
|
|
773
|
-
var
|
|
841
|
+
var Ri = (r, t) => {
|
|
774
842
|
if (!t && (r === "+()" || r === "@()")) return r;
|
|
775
843
|
let e = "";
|
|
776
844
|
for (let s = 0; s < r.length; s++) {
|
|
@@ -779,7 +847,7 @@ var mi = (r, t) => {
|
|
|
779
847
|
else {
|
|
780
848
|
if (i === "*" || i === "?") return;
|
|
781
849
|
if (i === "[") {
|
|
782
|
-
let n =
|
|
850
|
+
let n = cs(r, s);
|
|
783
851
|
if (n === -1) {
|
|
784
852
|
e += i;
|
|
785
853
|
continue;
|
|
@@ -795,7 +863,7 @@ var mi = (r, t) => {
|
|
|
795
863
|
}
|
|
796
864
|
return e;
|
|
797
865
|
};
|
|
798
|
-
var
|
|
866
|
+
var Oi = (r) => {
|
|
799
867
|
if (/^[?*+@]\(\)$/.test(r) || r.includes("[:")) return !1;
|
|
800
868
|
let t = 0;
|
|
801
869
|
for (let e = 0; e < r.length; e++) {
|
|
@@ -803,7 +871,7 @@ var gi = (r) => {
|
|
|
803
871
|
if (s === "\\") {
|
|
804
872
|
if (++e === r.length) return !1;
|
|
805
873
|
} else if (s === "[") {
|
|
806
|
-
let i =
|
|
874
|
+
let i = cs(r, e);
|
|
807
875
|
i !== -1 && (e = i);
|
|
808
876
|
} else if ("+@!?*".includes(s) && r.charAt(e + 1) === "(") t++, e++;
|
|
809
877
|
else if (s === ")") {
|
|
@@ -812,39 +880,40 @@ var gi = (r) => {
|
|
|
812
880
|
}
|
|
813
881
|
return !t;
|
|
814
882
|
};
|
|
815
|
-
var
|
|
816
|
-
var
|
|
883
|
+
var we;
|
|
884
|
+
var os;
|
|
817
885
|
var X = (r, t) => typeof r == "string" ? t === r : t !== "" && r.testUnchecked(t);
|
|
818
|
-
var
|
|
819
|
-
var
|
|
820
|
-
var
|
|
821
|
-
var
|
|
822
|
-
var
|
|
886
|
+
var hs = (r, t, e, s, i) => X(r, t) ? e : s !== void 0 && X(r, s) ? i : -1;
|
|
887
|
+
var ve = (r) => r === "." || r === "..";
|
|
888
|
+
var be = (r) => typeof r == "string" && /^[a-z]:$/i.test(r);
|
|
889
|
+
var zt = (r) => typeof r == "string" && /^unc$/i.test(r);
|
|
890
|
+
var ye = (r) => {
|
|
823
891
|
if (r[0] !== "" || r[1] !== "") return -1;
|
|
824
|
-
let t = r[2] !== "?" ? 2 :
|
|
825
|
-
return t !== -1 && e !== void 0 && e !== "" && e !==
|
|
892
|
+
let t = r[2] !== "?" ? 2 : zt(r[3]) ? 4 : -1, e = r[t], s = r[t + 1];
|
|
893
|
+
return t !== -1 && e !== void 0 && e !== "" && e !== v && s !== void 0 && s !== "" && s !== v ? t : -1;
|
|
826
894
|
};
|
|
827
|
-
var
|
|
828
|
-
var
|
|
895
|
+
var Pt = (r, t) => !ve(r) && (t || !r.startsWith("."));
|
|
896
|
+
var gt = (r, t, e, s, i) => {
|
|
829
897
|
for (let n = t; n < e;) {
|
|
830
898
|
if (r.charCodeAt(n) === 46) {
|
|
831
899
|
if (!s) return !0;
|
|
832
|
-
let
|
|
833
|
-
if (
|
|
900
|
+
let h = r.charCodeAt(n + 1) === 46 ? n + 2 : n + 1;
|
|
901
|
+
if (h >= e || Lt(r.charCodeAt(h), i)) return !0;
|
|
834
902
|
}
|
|
835
|
-
let o =
|
|
903
|
+
let o = Ee(r, n, i);
|
|
836
904
|
if (o === -1) return !1;
|
|
837
|
-
for (n = o + 1; n < e &&
|
|
905
|
+
for (n = o + 1; n < e && Lt(r.charCodeAt(n), i);) n++;
|
|
838
906
|
}
|
|
839
907
|
return !1;
|
|
840
908
|
};
|
|
841
|
-
var
|
|
842
|
-
var
|
|
909
|
+
var Lt = (r, t) => t === "/" ? r === 47 : t === "\\" ? r === 92 : r === 47 || r === 92;
|
|
910
|
+
var Ee = (r, t, e) => {
|
|
843
911
|
if (e !== "both") return r.indexOf(e, t);
|
|
844
912
|
let s = r.indexOf("/", t), i = r.indexOf("\\", t);
|
|
845
913
|
return s === -1 ? i : i === -1 ? s : Math.min(s, i);
|
|
846
914
|
};
|
|
847
|
-
var
|
|
915
|
+
var as = (r, t, e) => e !== "both" ? r.lastIndexOf(e, t) : Math.max(r.lastIndexOf("/", t), r.lastIndexOf("\\", t));
|
|
916
|
+
var Se = {};
|
|
848
917
|
var D = class {
|
|
849
918
|
options;
|
|
850
919
|
set;
|
|
@@ -864,42 +933,44 @@ var D = class {
|
|
|
864
933
|
windowsNoMagicRoot;
|
|
865
934
|
maxGlobstarRecursion;
|
|
866
935
|
#t;
|
|
936
|
+
#n;
|
|
867
937
|
#i;
|
|
868
|
-
#e;
|
|
869
938
|
#o;
|
|
870
939
|
#r = [];
|
|
871
940
|
#d = [];
|
|
872
|
-
#
|
|
873
|
-
#
|
|
874
|
-
#h =
|
|
941
|
+
#u = [];
|
|
942
|
+
#f = new Map();
|
|
943
|
+
#h = !1;
|
|
944
|
+
#m;
|
|
945
|
+
#l = new WeakMap();
|
|
875
946
|
constructor(t, e = {}) {
|
|
876
|
-
|
|
947
|
+
mt(t), e = e || {}, this.options = e, this.maxGlobstarRecursion = e.maxGlobstarRecursion ?? 200, this.pattern = t, this.platform = e.platform || ls, this.isWindows = this.platform === "win32";
|
|
877
948
|
let s = "allowWindowsEscape";
|
|
878
|
-
this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.#t = !this.preserveMultipleSlashes, this.#
|
|
949
|
+
this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.#t = !this.preserveMultipleSlashes, this.#i = (e.optimizationLevel ?? 1) >= 2;
|
|
879
950
|
let i = e.normalize;
|
|
880
951
|
this.#o = i === !0 ? "NFC" : i || void 0, this.make();
|
|
881
|
-
let n = this.set.map((o) => this.#
|
|
882
|
-
this.#
|
|
883
|
-
let
|
|
952
|
+
let n = this.set.map((o) => this.#s(o));
|
|
953
|
+
this.#u = this.set.map((o, h) => this.#t && o.length - 1 > n[h]), this.#r = this.set.map((o, h) => {
|
|
954
|
+
let a = this.#u[h] ? o.length - 1 : o.length, l = o.slice(n[h] + 1, a).filter((c) => typeof c == "string" && !!c);
|
|
884
955
|
return [...new Set(l)];
|
|
885
|
-
}), this.#
|
|
886
|
-
let [
|
|
887
|
-
if (this.#
|
|
888
|
-
if (this.#
|
|
889
|
-
if (!(!this.#t || n[
|
|
890
|
-
if (o.length === 3 &&
|
|
891
|
-
if (o.length === 2 && l ===
|
|
956
|
+
}), this.#n = this.#r.some((o) => o.length), this.#d = this.set.map((o, h) => {
|
|
957
|
+
let [a, l, c] = o;
|
|
958
|
+
if (this.#u[h] && o.length === 2 && a === v && l !== v) return "tail";
|
|
959
|
+
if (this.#u[h] && e.matchBase && o.length === 1 && a !== v && a !== "") return "base";
|
|
960
|
+
if (!(!this.#t || n[h] !== -1)) {
|
|
961
|
+
if (o.length === 3 && a === v && c === v && l !== v && l !== "" && this.maxGlobstarRecursion > 0) return "mid";
|
|
962
|
+
if (o.length === 2 && l === v && a !== v && a !== "") return "head";
|
|
892
963
|
}
|
|
893
964
|
});
|
|
894
965
|
}
|
|
895
|
-
#
|
|
966
|
+
#a(t) {
|
|
896
967
|
return this.#o ? t.normalize(this.#o) : t;
|
|
897
968
|
}
|
|
898
|
-
#
|
|
969
|
+
#s(t) {
|
|
899
970
|
if (!this.isWindows) return -1;
|
|
900
|
-
if (
|
|
901
|
-
if (t[0] === "" && t[1] === "" && t[2] === "?" &&
|
|
902
|
-
let s =
|
|
971
|
+
if (be(t[0])) return 0;
|
|
972
|
+
if (t[0] === "" && t[1] === "" && t[2] === "?" && be(t[3])) return 3;
|
|
973
|
+
let s = ye(t);
|
|
903
974
|
return s === -1 ? -1 : s + 1;
|
|
904
975
|
}
|
|
905
976
|
hasMagic() {
|
|
@@ -917,22 +988,24 @@ var D = class {
|
|
|
917
988
|
this.empty = !0;
|
|
918
989
|
return;
|
|
919
990
|
}
|
|
920
|
-
this.parseNegate(), this.globSet = [...new Set(this
|
|
921
|
-
let s = this.globSet.map((n) => this.#
|
|
922
|
-
this.globParts = this.preprocess(s);
|
|
923
|
-
let i = this.globParts.map((n, o,
|
|
991
|
+
this.parseNegate(), this.globSet = [...new Set(this.#M())];
|
|
992
|
+
let s = this.globSet.map((n) => this.#e(n));
|
|
993
|
+
this.globParts = this.preprocess(s), this.#h = !0;
|
|
994
|
+
let i = this.globParts.map((n, o, h) => {
|
|
924
995
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
925
|
-
let
|
|
926
|
-
if (l) return [...n.slice(0,
|
|
927
|
-
if (c) return [this.#
|
|
996
|
+
let a = n[2] === "?" && zt(n[3]) ? 6 : 4, l = n[0] === "" && n[1] === "" && (n[2] === "?" || !rs.test(n[2])) && n.slice(3, a).every((f) => !rs.test(f)), c = /^[a-z]:/i.test(n[0]);
|
|
997
|
+
if (l) return [...n.slice(0, a).map((f) => this.#a(f)), ...n.slice(a).map((f) => this.parse(f))];
|
|
998
|
+
if (c) return [this.#a(n[0]), ...n.slice(1).map((f) => this.parse(f))];
|
|
928
999
|
}
|
|
929
|
-
return n.map((
|
|
1000
|
+
return n.map((a) => this.parse(a));
|
|
930
1001
|
});
|
|
931
1002
|
if (this.set = i.filter((n) => n.indexOf(!1) === -1), this.isWindows) for (let n = 0; n < this.set.length; n++) {
|
|
932
1003
|
let o = this.set[n];
|
|
933
|
-
o[0] === "" && o[1] === "" && this.globParts[n][2] === "?" && (
|
|
1004
|
+
o[0] === "" && o[1] === "" && this.globParts[n][2] === "?" && (be(o[3]) || zt(this.globParts[n][3])) && (zt(this.globParts[n][3]) && (o[3] = "UNC"), o[2] = "?");
|
|
934
1005
|
}
|
|
935
|
-
e.noext || this.mergeRows()
|
|
1006
|
+
e.noext || this.mergeRows(), this.#h = !1, this.set.forEach((n, o) => {
|
|
1007
|
+
for (let h = 0; h < n.length; h++) n[h] === Se && (n[h] = this.parse(this.globParts[o][h]));
|
|
1008
|
+
});
|
|
936
1009
|
}
|
|
937
1010
|
mergeRows() {
|
|
938
1011
|
let t = !0;
|
|
@@ -941,21 +1014,21 @@ var D = class {
|
|
|
941
1014
|
let e = Math.max(0, ...this.set.map((s) => s.length));
|
|
942
1015
|
for (let s = 0; s < e; s++) {
|
|
943
1016
|
let i = new Map();
|
|
944
|
-
this.set.forEach((o,
|
|
945
|
-
if (!(o[s] instanceof
|
|
946
|
-
let
|
|
947
|
-
|
|
948
|
-
let l = `${o.length}/${
|
|
949
|
-
c ? c.push(
|
|
1017
|
+
this.set.forEach((o, h) => {
|
|
1018
|
+
if (!(o[s] instanceof pt || o[s] === Se) || !Oi(this.globParts[h][s])) return;
|
|
1019
|
+
let a = [...this.globParts[h]];
|
|
1020
|
+
a[s] = "";
|
|
1021
|
+
let l = `${o.length}/${a.join("/")}`, c = i.get(l);
|
|
1022
|
+
c ? c.push(h) : i.set(l, [h]);
|
|
950
1023
|
});
|
|
951
1024
|
let n = new Set();
|
|
952
1025
|
for (let o of i.values()) {
|
|
953
1026
|
if (o.length < 2) continue;
|
|
954
|
-
let [
|
|
955
|
-
this.globParts[
|
|
956
|
-
for (let f of
|
|
1027
|
+
let [h, ...a] = o, c = `@(${o.map((f) => this.globParts[f][s]).join("|")})`;
|
|
1028
|
+
this.globParts[h][s] = c, this.set[h][s] = this.parse(c);
|
|
1029
|
+
for (let f of a) n.add(f);
|
|
957
1030
|
}
|
|
958
|
-
n.size && (t = !0, this.set = this.set.filter((o,
|
|
1031
|
+
n.size && (t = !0, this.set = this.set.filter((o, h) => !n.has(h)), this.globParts = this.globParts.filter((o, h) => !n.has(h)));
|
|
959
1032
|
}
|
|
960
1033
|
}
|
|
961
1034
|
}
|
|
@@ -977,110 +1050,110 @@ var D = class {
|
|
|
977
1050
|
}
|
|
978
1051
|
levelOneOptimize(t) {
|
|
979
1052
|
return t.map((e) => {
|
|
980
|
-
let s = this.#
|
|
1053
|
+
let s = this.#s(e) + 1;
|
|
981
1054
|
return e = e.reduce((i, n) => {
|
|
982
1055
|
let o = i[i.length - 1];
|
|
983
1056
|
return n === "**" && o === "**" ? i : n === ".." && i.length > s && o && o !== ".." && o !== "." && o !== "**" ? (i.pop(), i) : (i.push(n), i);
|
|
984
1057
|
}, []), e.length === 0 ? [""] : e;
|
|
985
1058
|
});
|
|
986
1059
|
}
|
|
987
|
-
#
|
|
988
|
-
let e = !this.isWindows || !t.includes("\\") ? "/" : t.includes("/") ? "both" : "\\", s = this.#t ? 0 : -1, i = "", n = 0, o,
|
|
1060
|
+
#b(t) {
|
|
1061
|
+
let e = !this.isWindows || !t.includes("\\") ? "/" : t.includes("/") ? "both" : "\\", s = this.#t ? 0 : -1, i = "", n = 0, o, h = 0, a = !!this.options.dot;
|
|
989
1062
|
t: for (let l = 0; l < this.set.length; l++) {
|
|
990
|
-
let c = this.set[l], f = c[c.length - 1],
|
|
991
|
-
if (
|
|
992
|
-
let
|
|
993
|
-
if (n =
|
|
994
|
-
let m =
|
|
995
|
-
for (; m > 0 &&
|
|
996
|
-
|
|
1063
|
+
let c = this.set[l], f = c[c.length - 1], u = s !== -1 && this.#u[l] && f !== v;
|
|
1064
|
+
if (u && s === 0) {
|
|
1065
|
+
let d = as(t, t.length, e);
|
|
1066
|
+
if (n = d + 1, i = t.slice(n), i === "" && d >= 0) {
|
|
1067
|
+
let m = d;
|
|
1068
|
+
for (; m > 0 && Lt(t.charCodeAt(m - 1), e);) m--;
|
|
1069
|
+
h = m === 0 ? 0 : as(t, m - 1, e) + 1, o = t.slice(h, m);
|
|
997
1070
|
}
|
|
998
|
-
let w = this.#
|
|
999
|
-
s = w ? -1 : 1,
|
|
1071
|
+
let w = this.#i && (ve(i) || i === "" && o !== void 0 && ve(o));
|
|
1072
|
+
s = w ? -1 : 1, u = !w;
|
|
1000
1073
|
}
|
|
1001
|
-
let
|
|
1002
|
-
if (
|
|
1003
|
-
if (this.#
|
|
1004
|
-
for (let
|
|
1074
|
+
let p = -1;
|
|
1075
|
+
if (u && typeof f == "string" && (p = hs(f, i, n, o, h), p === -1)) continue;
|
|
1076
|
+
if (this.#n) {
|
|
1077
|
+
for (let d of this.#r[l]) if (!t.includes(d)) continue t;
|
|
1005
1078
|
}
|
|
1006
|
-
if (
|
|
1079
|
+
if (u && typeof f == "object" && (p = hs(f, i, n, o, h), p === -1)) continue;
|
|
1007
1080
|
let g = this.#d[l];
|
|
1008
|
-
if (g === "base" &&
|
|
1009
|
-
if (g === "tail" &&
|
|
1010
|
-
if (this.#
|
|
1011
|
-
if (!
|
|
1081
|
+
if (g === "base" && u) return "yes";
|
|
1082
|
+
if (g === "tail" && u) {
|
|
1083
|
+
if (this.#i && gt(t, 0, p, !0, e)) return "maybe";
|
|
1084
|
+
if (!gt(t, 0, p, a, e)) return "yes";
|
|
1012
1085
|
continue;
|
|
1013
1086
|
}
|
|
1014
1087
|
if (g === "mid" || g === "head") {
|
|
1015
|
-
let
|
|
1016
|
-
if (
|
|
1088
|
+
let d = this.#y(t, c, g === "head", a, e);
|
|
1089
|
+
if (d !== "no") return d;
|
|
1017
1090
|
continue;
|
|
1018
1091
|
}
|
|
1019
1092
|
return "maybe";
|
|
1020
1093
|
}
|
|
1021
1094
|
return "no";
|
|
1022
1095
|
}
|
|
1023
|
-
#
|
|
1096
|
+
#E(t, e, s) {
|
|
1024
1097
|
let i = !!this.options.dot, n = t.length;
|
|
1025
1098
|
if (s === "head") {
|
|
1026
1099
|
if (n < 2 || !X(e[0], t[0])) return !1;
|
|
1027
|
-
for (let
|
|
1100
|
+
for (let h = 1; h < n; h++) if (!Pt(t[h], i)) return !1;
|
|
1028
1101
|
return !0;
|
|
1029
1102
|
}
|
|
1030
1103
|
let o = e[1];
|
|
1031
1104
|
if (s === "tail") {
|
|
1032
|
-
let
|
|
1033
|
-
if (!X(o, t[
|
|
1034
|
-
for (let
|
|
1105
|
+
let h = n - 1;
|
|
1106
|
+
if (!X(o, t[h]) && (t[h] !== "" || n === 1 || !X(o, t[--h]))) return !1;
|
|
1107
|
+
for (let a = 0; a < h; a++) if (!Pt(t[a], i)) return !1;
|
|
1035
1108
|
return !0;
|
|
1036
1109
|
}
|
|
1037
|
-
for (let
|
|
1038
|
-
if (X(o, t[
|
|
1039
|
-
let
|
|
1040
|
-
for (;
|
|
1041
|
-
if (
|
|
1110
|
+
for (let h = 0; h < n; h++) {
|
|
1111
|
+
if (X(o, t[h]) && h + 1 < n) {
|
|
1112
|
+
let a = h + 1;
|
|
1113
|
+
for (; a < n && Pt(t[a], i);) a++;
|
|
1114
|
+
if (a === n) return !0;
|
|
1042
1115
|
}
|
|
1043
|
-
if (!
|
|
1116
|
+
if (!Pt(t[h], i)) return !1;
|
|
1044
1117
|
}
|
|
1045
1118
|
return !1;
|
|
1046
1119
|
}
|
|
1047
|
-
#
|
|
1048
|
-
if (this.#
|
|
1049
|
-
let o = e[s ? 0 : 1],
|
|
1050
|
-
for (let
|
|
1051
|
-
let l =
|
|
1052
|
-
for (; l < t.length &&
|
|
1053
|
-
if ((typeof o == "string" ?
|
|
1054
|
-
if (s ||
|
|
1055
|
-
|
|
1120
|
+
#y(t, e, s, i, n) {
|
|
1121
|
+
if (this.#i && gt(t, 0, t.length, !0, n)) return "maybe";
|
|
1122
|
+
let o = e[s ? 0 : 1], h = 0;
|
|
1123
|
+
for (let a = Ee(t, h, n); a !== -1; a = Ee(t, h, n)) {
|
|
1124
|
+
let l = a + 1;
|
|
1125
|
+
for (; l < t.length && Lt(t.charCodeAt(l), n);) l++;
|
|
1126
|
+
if ((typeof o == "string" ? a - h === o.length && t.startsWith(o, h) : a > h && o.testUnchecked(t.slice(h, a))) && !gt(t, l, t.length, i, n)) return "yes";
|
|
1127
|
+
if (s || gt(t, h, l, i, n)) return "no";
|
|
1128
|
+
h = l;
|
|
1056
1129
|
}
|
|
1057
1130
|
return "no";
|
|
1058
1131
|
}
|
|
1059
|
-
#
|
|
1060
|
-
let e =
|
|
1132
|
+
#g(t) {
|
|
1133
|
+
let e = we;
|
|
1061
1134
|
return e?.f === t && e.isWindows === this.isWindows && e.preserveMultipleSlashes === this.preserveMultipleSlashes && e.normalize === this.#o ? e : void 0;
|
|
1062
1135
|
}
|
|
1063
|
-
#
|
|
1064
|
-
let { isWindows: e, preserveMultipleSlashes: s } = this, i = this.#
|
|
1065
|
-
return n && (i = i.map((o) => o.normalize(n))),
|
|
1136
|
+
#w(t) {
|
|
1137
|
+
let { isWindows: e, preserveMultipleSlashes: s } = this, i = this.#e(e ? t.split("\\").join("/") : t), n = this.#o;
|
|
1138
|
+
return n && (i = i.map((o) => o.normalize(n))), we = {
|
|
1066
1139
|
f: t,
|
|
1067
1140
|
isWindows: e,
|
|
1068
1141
|
preserveMultipleSlashes: s,
|
|
1069
1142
|
normalize: n,
|
|
1070
1143
|
parts: i
|
|
1071
|
-
},
|
|
1144
|
+
}, we;
|
|
1072
1145
|
}
|
|
1073
|
-
#
|
|
1146
|
+
#p(t) {
|
|
1074
1147
|
let e = [...t], s = !1;
|
|
1075
1148
|
do {
|
|
1076
1149
|
if (s = !1, !this.preserveMultipleSlashes) {
|
|
1077
1150
|
for (let o = 1; o < e.length - 1; o++) {
|
|
1078
|
-
let
|
|
1079
|
-
o === 1 &&
|
|
1151
|
+
let h = e[o];
|
|
1152
|
+
o === 1 && h === "" && e[0] === "" || (h === "." || h === "") && (s = !0, e.splice(o, 1), o--);
|
|
1080
1153
|
}
|
|
1081
1154
|
e[0] === "." && e.length === 2 && (e[1] === "." || e[1] === "") && (s = !0, e.pop());
|
|
1082
1155
|
}
|
|
1083
|
-
let i = this.#
|
|
1156
|
+
let i = this.#s(e) + 1, n = i;
|
|
1084
1157
|
for (; (n = e.indexOf("..", n + 1)) !== -1;) {
|
|
1085
1158
|
let o = e[n - 1];
|
|
1086
1159
|
o && o !== "." && o !== ".." && o !== "**" && (s = !0, e.splice(n - 1, 2), n = Math.max(n - 2, i));
|
|
@@ -1089,65 +1162,73 @@ var D = class {
|
|
|
1089
1162
|
return e.length === 0 ? [""] : e;
|
|
1090
1163
|
}
|
|
1091
1164
|
firstPhasePreProcess(t) {
|
|
1092
|
-
let { braceExpandMax: e = 1e5 } = this.options, s = !1;
|
|
1165
|
+
let { braceExpandMax: e = 1e5 } = this.options, s = 0, i = 1e6, n = !1;
|
|
1093
1166
|
do {
|
|
1094
|
-
|
|
1095
|
-
for (let
|
|
1096
|
-
let
|
|
1097
|
-
for (; (
|
|
1098
|
-
let
|
|
1099
|
-
for (;
|
|
1100
|
-
|
|
1101
|
-
let
|
|
1102
|
-
if (
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1167
|
+
n = !1;
|
|
1168
|
+
for (let o of t) {
|
|
1169
|
+
let h = -1;
|
|
1170
|
+
for (; (h = o.indexOf("**", h + 1)) !== -1;) {
|
|
1171
|
+
let c = h;
|
|
1172
|
+
for (; o[c + 1] === "**";) c++;
|
|
1173
|
+
c > h && o.splice(h + 1, c - h);
|
|
1174
|
+
let f = o[h + 1], u = o[h + 2], p = o[h + 3];
|
|
1175
|
+
if (f !== ".." || !u || u === "." || u === ".." || !p || p === "." || p === "..") continue;
|
|
1176
|
+
let g = o.length - 1;
|
|
1177
|
+
if (t.length >= e || s + g > i) throw new RangeError("optimizationLevel 2: too many patterns from '**/..'");
|
|
1178
|
+
n = !0, o.splice(h, 1);
|
|
1179
|
+
let d = o.slice(0);
|
|
1180
|
+
d[h] = "**", s += g, t.push(d), h--;
|
|
1106
1181
|
}
|
|
1107
1182
|
if (!this.preserveMultipleSlashes) {
|
|
1108
|
-
for (let
|
|
1109
|
-
let
|
|
1110
|
-
|
|
1183
|
+
for (let c = 1; c < o.length - 1; c++) {
|
|
1184
|
+
let f = o[c];
|
|
1185
|
+
c === 1 && f === "" && o[0] === "" || (f === "." || f === "") && (n = !0, o.splice(c, 1), c--);
|
|
1111
1186
|
}
|
|
1112
|
-
|
|
1187
|
+
o[0] === "." && o.length === 2 && (o[1] === "." || o[1] === "") && (n = !0, o.pop());
|
|
1113
1188
|
}
|
|
1114
|
-
let
|
|
1115
|
-
for (; (
|
|
1116
|
-
let
|
|
1117
|
-
if (
|
|
1118
|
-
|
|
1119
|
-
let
|
|
1120
|
-
|
|
1189
|
+
let a = this.#s(o) + 1, l = a;
|
|
1190
|
+
for (; (l = o.indexOf("..", l + 1)) !== -1;) {
|
|
1191
|
+
let c = o[l - 1];
|
|
1192
|
+
if (c && c !== "." && c !== ".." && c !== "**") {
|
|
1193
|
+
n = !0;
|
|
1194
|
+
let u = l === 1 && o[l + 1] === "**" ? ["."] : [];
|
|
1195
|
+
o.splice(l - 1, 2, ...u), o.length === 0 && o.push(""), l = Math.max(l - 2, a);
|
|
1121
1196
|
}
|
|
1122
1197
|
}
|
|
1123
1198
|
}
|
|
1124
|
-
} while (
|
|
1199
|
+
} while (n);
|
|
1125
1200
|
return t;
|
|
1126
1201
|
}
|
|
1127
1202
|
secondPhasePreProcess(t) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1203
|
+
let e = new Set(), s = t.filter((o) => {
|
|
1204
|
+
let h = o.join("/");
|
|
1205
|
+
return e.has(h) ? !1 : (e.add(h), !0);
|
|
1206
|
+
}), i = new Map();
|
|
1207
|
+
for (let o of s) {
|
|
1208
|
+
let h = [];
|
|
1209
|
+
for (let a = 0; a < o.length; a++) o[a] === "*" && h.push(a);
|
|
1210
|
+
h.length && i.set(h.join(","), h);
|
|
1211
|
+
}
|
|
1212
|
+
if (!i.size || s.length * i.size > 1e5) return s;
|
|
1213
|
+
let { dot: n } = this.options;
|
|
1214
|
+
return s.filter((o) => {
|
|
1215
|
+
for (let h of i.values()) {
|
|
1216
|
+
if (h[h.length - 1] >= o.length) continue;
|
|
1217
|
+
let a = [...o], l = !0, c = !1;
|
|
1218
|
+
for (let f of h) {
|
|
1219
|
+
let u = o[f];
|
|
1220
|
+
if (u !== "*") {
|
|
1221
|
+
if (!u || u === "**" || !n && u.startsWith(".")) {
|
|
1222
|
+
l = !1;
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
a[f] = "*", c = !0;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
if (l && c && e.has(a.join("/"))) return !1;
|
|
1134
1229
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
}
|
|
1138
|
-
partsMatch(t, e, s = !1) {
|
|
1139
|
-
let i = 0, n = 0, o = [], a = "";
|
|
1140
|
-
for (; i < t.length && n < e.length;) if (t[i] === e[n]) o.push(a === "b" ? e[n] : t[i]), i++, n++;
|
|
1141
|
-
else if (s && t[i] === "**" && e[n] === t[i + 1]) o.push(t[i]), i++;
|
|
1142
|
-
else if (s && e[n] === "**" && t[i] === e[n + 1]) o.push(e[n]), n++;
|
|
1143
|
-
else if (t[i] === "*" && e[n] && (this.options.dot || !e[n].startsWith(".")) && e[n] !== "**") {
|
|
1144
|
-
if (a === "b") return !1;
|
|
1145
|
-
a = "a", o.push(t[i]), i++, n++;
|
|
1146
|
-
} else if (e[n] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
|
|
1147
|
-
if (a === "a") return !1;
|
|
1148
|
-
a = "b", o.push(e[n]), i++, n++;
|
|
1149
|
-
} else return !1;
|
|
1150
|
-
return t.length === e.length && o;
|
|
1230
|
+
return !0;
|
|
1231
|
+
});
|
|
1151
1232
|
}
|
|
1152
1233
|
parseNegate() {
|
|
1153
1234
|
if (this.nonegate) return;
|
|
@@ -1155,182 +1236,201 @@ var D = class {
|
|
|
1155
1236
|
for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++;
|
|
1156
1237
|
s && (this.pattern = t.slice(s)), this.negate = e;
|
|
1157
1238
|
}
|
|
1158
|
-
#
|
|
1159
|
-
let n = 0, o = 0,
|
|
1160
|
-
if (
|
|
1161
|
-
let l = s[
|
|
1162
|
-
typeof l != "string" || typeof c != "string" ? (n =
|
|
1239
|
+
#k(t, e, s, i) {
|
|
1240
|
+
let n = 0, o = 0, h = this.isWindows ? ye(e) : -1, a = h === -1 ? -1 : ye(s);
|
|
1241
|
+
if (a !== -1) {
|
|
1242
|
+
let l = s[a], c = s[a + 1];
|
|
1243
|
+
typeof l != "string" || typeof c != "string" ? (n = h, o = a) : e[h].toLowerCase() === l.toLowerCase() && e[h + 1].toLowerCase() === c.toLowerCase() && (n = h + 2, o = a + 2);
|
|
1163
1244
|
} else if (this.isWindows) {
|
|
1164
|
-
let l = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), c = !l && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), f = typeof s[0] == "string" && /^[a-z]:$/i.test(s[0]),
|
|
1165
|
-
if (typeof
|
|
1166
|
-
let [
|
|
1167
|
-
|
|
1245
|
+
let l = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), c = !l && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), f = typeof s[0] == "string" && /^[a-z]:$/i.test(s[0]), u = !f && s[0] === "" && s[1] === "" && s[2] === "?" && typeof s[3] == "string" && /^[a-z]:$/i.test(s[3]), p = c ? 3 : l ? 0 : void 0, g = u ? 3 : f ? 0 : void 0;
|
|
1246
|
+
if (typeof p == "number" && typeof g == "number") {
|
|
1247
|
+
let [d, w] = [t[p], s[g]];
|
|
1248
|
+
d.toLowerCase() === w.toLowerCase() && (o = g + 1, n = p + 1);
|
|
1168
1249
|
}
|
|
1169
1250
|
}
|
|
1170
|
-
return t = e, s.includes(
|
|
1251
|
+
return t = e, s.includes(v) ? this.#C(t, s, i, n, o) : this.#S(t, s, i, n, o);
|
|
1171
1252
|
}
|
|
1172
|
-
#
|
|
1173
|
-
let { head: o, body:
|
|
1253
|
+
#C(t, e, s, i, n) {
|
|
1254
|
+
let { head: o, body: h, tail: a, segments: l } = this.#x(e, s, n);
|
|
1174
1255
|
if (o.length) {
|
|
1175
1256
|
let f = i + o.length;
|
|
1176
|
-
if (!this.#
|
|
1257
|
+
if (!this.#S(t, o, s, i, 0, f)) return !1;
|
|
1177
1258
|
i += o.length, n += o.length;
|
|
1178
1259
|
}
|
|
1179
1260
|
let c = 0;
|
|
1180
|
-
if (
|
|
1181
|
-
if (
|
|
1182
|
-
let f = t.length -
|
|
1183
|
-
if (this.#
|
|
1261
|
+
if (a.length) {
|
|
1262
|
+
if (a.length + i > t.length) return !1;
|
|
1263
|
+
let f = t.length - a.length;
|
|
1264
|
+
if (this.#S(t, a, s, f, 0)) c = a.length;
|
|
1184
1265
|
else {
|
|
1185
|
-
if (t[t.length - 1] !== "" || i +
|
|
1186
|
-
c =
|
|
1266
|
+
if (t[t.length - 1] !== "" || i + a.length === t.length || (f--, !this.#S(t, a, s, f, 0))) return !1;
|
|
1267
|
+
c = a.length + 1;
|
|
1187
1268
|
}
|
|
1188
1269
|
}
|
|
1189
|
-
if (!
|
|
1270
|
+
if (!h.length) {
|
|
1190
1271
|
let f = !!c;
|
|
1191
|
-
for (let
|
|
1192
|
-
let
|
|
1193
|
-
if (f = !0,
|
|
1272
|
+
for (let u = i; u < t.length - c; u++) {
|
|
1273
|
+
let p = String(t[u]);
|
|
1274
|
+
if (f = !0, p === "." || p === ".." || !this.options.dot && p.startsWith(".")) return !1;
|
|
1194
1275
|
}
|
|
1195
1276
|
return s || f;
|
|
1196
1277
|
}
|
|
1197
|
-
return !!this.#
|
|
1278
|
+
return !!this.#v(t, l, t.length - c, i, 0, s, 0, !!c, new Set());
|
|
1198
1279
|
}
|
|
1199
|
-
#
|
|
1200
|
-
let i = this.#
|
|
1201
|
-
i || (i = [], this.#
|
|
1280
|
+
#x(t, e, s) {
|
|
1281
|
+
let i = this.#l.get(t);
|
|
1282
|
+
i || (i = [], this.#l.set(t, i));
|
|
1202
1283
|
let n = s * 2 + (e ? 1 : 0), o = i[n];
|
|
1203
1284
|
if (o) return o;
|
|
1204
|
-
let
|
|
1205
|
-
for (let m of c) m ===
|
|
1206
|
-
|
|
1207
|
-
m[1] = g -
|
|
1285
|
+
let h = t.indexOf(v, s), a = t.lastIndexOf(v), l = t.slice(s, h), c = t.slice(h + 1, e ? void 0 : a), f = e ? [] : t.slice(a + 1), u = [[[], 0]], p = u[0], g = 0, d = [0];
|
|
1286
|
+
for (let m of c) m === v ? (d.push(g), p = [[], 0], u.push(p)) : (p[0].push(m), g++);
|
|
1287
|
+
u.forEach((m, b) => {
|
|
1288
|
+
m[1] = g - d[b];
|
|
1208
1289
|
});
|
|
1209
1290
|
let w = {
|
|
1210
1291
|
head: l,
|
|
1211
1292
|
body: c,
|
|
1212
1293
|
tail: f,
|
|
1213
|
-
segments:
|
|
1294
|
+
segments: u
|
|
1214
1295
|
};
|
|
1215
1296
|
return i[n] = w, w;
|
|
1216
1297
|
}
|
|
1217
|
-
#
|
|
1298
|
+
#v(t, e, s, i, n, o, h, a, l) {
|
|
1218
1299
|
let c = e[n];
|
|
1219
1300
|
if (!c) {
|
|
1220
1301
|
if (o) return i >= s || i === s - 1 && t[i] === "";
|
|
1221
1302
|
for (let g = i; g < s; g++) {
|
|
1222
|
-
|
|
1223
|
-
let
|
|
1224
|
-
if (
|
|
1303
|
+
a = !0;
|
|
1304
|
+
let d = t[g];
|
|
1305
|
+
if (d === "." || d === ".." || !this.options.dot && d.startsWith(".")) return !1;
|
|
1225
1306
|
}
|
|
1226
|
-
return
|
|
1307
|
+
return a;
|
|
1227
1308
|
}
|
|
1228
|
-
let [f,
|
|
1229
|
-
for (; i <=
|
|
1309
|
+
let [f, u] = c, p = o ? s : s - u;
|
|
1310
|
+
for (; i <= p;) {
|
|
1230
1311
|
let g = n * (t.length + 1) + i;
|
|
1231
1312
|
if (l.has(g)) return !1;
|
|
1232
|
-
if (l.add(g), this.#
|
|
1233
|
-
let m = this.#
|
|
1313
|
+
if (l.add(g), this.#S(t, f, o, i, 0, i + f.length) && h < this.maxGlobstarRecursion) {
|
|
1314
|
+
let m = this.#v(t, e, s, i + f.length, n + 1, o, h + 1, a, l);
|
|
1234
1315
|
if (m !== !1) return m;
|
|
1235
1316
|
}
|
|
1236
|
-
if (i ===
|
|
1317
|
+
if (i === p) break;
|
|
1237
1318
|
let w = t[i];
|
|
1238
1319
|
if (w === "." || w === ".." || !this.options.dot && w.startsWith(".")) return !1;
|
|
1239
1320
|
i++;
|
|
1240
1321
|
}
|
|
1241
1322
|
return o || null;
|
|
1242
1323
|
}
|
|
1243
|
-
#
|
|
1244
|
-
let
|
|
1245
|
-
for (
|
|
1246
|
-
let f = e[
|
|
1247
|
-
if (f === !1 || f ===
|
|
1324
|
+
#S(t, e, s, i, n, o = t.length) {
|
|
1325
|
+
let h, a, l, c;
|
|
1326
|
+
for (h = i, a = n, c = Math.min(o, t.length), l = e.length; h < c && a < l; h++, a++) {
|
|
1327
|
+
let f = e[a], u = t[h];
|
|
1328
|
+
if (f === !1 || f === v || !X(f, u)) return !1;
|
|
1248
1329
|
}
|
|
1249
|
-
if (
|
|
1250
|
-
if (
|
|
1251
|
-
if (
|
|
1330
|
+
if (h === c && a === l) return !0;
|
|
1331
|
+
if (h === c) return s;
|
|
1332
|
+
if (a === l) return h === c - 1 && t[h] === "";
|
|
1252
1333
|
throw new Error("wtf?");
|
|
1253
1334
|
}
|
|
1254
1335
|
braceExpand() {
|
|
1255
|
-
return
|
|
1336
|
+
return xe(this.pattern, this.options);
|
|
1337
|
+
}
|
|
1338
|
+
#M() {
|
|
1339
|
+
let { pattern: t } = this;
|
|
1340
|
+
if (this.options.nobrace) return this.braceExpand();
|
|
1341
|
+
let e = 57344;
|
|
1342
|
+
for (; t.includes(String.fromCharCode(e));) if (++e > 63743) return this.braceExpand();
|
|
1343
|
+
let s = String.fromCharCode(e), i = !1, n = t.replace(Ai, (h, a, l) => {
|
|
1344
|
+
let c = Number(a), f = Number(l);
|
|
1345
|
+
return !Number.isSafeInteger(c) || !Number.isSafeInteger(f) || Math.abs(c - f) + 1 < Ci ? h : (i = !0, `${s}${a}..${l}${s}`);
|
|
1346
|
+
});
|
|
1347
|
+
if (!i) return this.braceExpand();
|
|
1348
|
+
let o = xe(n, this.options);
|
|
1349
|
+
for (let h of o) for (let a of h.split("/")) {
|
|
1350
|
+
let l = a.indexOf("[");
|
|
1351
|
+
if (l !== -1 && l < a.lastIndexOf(s)) return this.braceExpand();
|
|
1352
|
+
}
|
|
1353
|
+
return this.#m = s, o;
|
|
1256
1354
|
}
|
|
1257
1355
|
parse(t) {
|
|
1258
|
-
|
|
1356
|
+
mt(t);
|
|
1259
1357
|
let e = this.options;
|
|
1260
|
-
if (t === "**") return
|
|
1358
|
+
if (t === "**") return v;
|
|
1261
1359
|
if (t === "") return "";
|
|
1262
|
-
let { nocase: s, nocaseMagicOnly: i, noext: n = !1, dot: o, normalize:
|
|
1263
|
-
if (
|
|
1264
|
-
|
|
1265
|
-
|
|
1360
|
+
let { nocase: s, nocaseMagicOnly: i, noext: n = !1, dot: o, normalize: h } = e, a = this.#m, l = a && t.includes(a) ? void 0 : Ri(t, n);
|
|
1361
|
+
if (l !== void 0 && !(s && !i && t.toUpperCase() !== t.toLowerCase())) return this.#a(l);
|
|
1362
|
+
if (this.#h) return Se;
|
|
1363
|
+
let c = this.#f.get(t);
|
|
1364
|
+
return c || (c = new pt(t, {
|
|
1266
1365
|
nocase: s,
|
|
1267
1366
|
noext: n,
|
|
1268
1367
|
dot: o,
|
|
1269
|
-
normalize:
|
|
1270
|
-
|
|
1368
|
+
normalize: h,
|
|
1369
|
+
...a && { rangeMark: a }
|
|
1370
|
+
}), this.#f.set(t, c)), c;
|
|
1271
1371
|
}
|
|
1272
|
-
#
|
|
1372
|
+
#e(t) {
|
|
1273
1373
|
return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
|
|
1274
1374
|
}
|
|
1275
1375
|
match(t, e = this.partial) {
|
|
1276
1376
|
if (this.comment) return !1;
|
|
1277
1377
|
if (this.empty) return t === "";
|
|
1278
1378
|
if (t === "/" && e) return !0;
|
|
1279
|
-
let s = this.options, i = this.#
|
|
1379
|
+
let s = this.options, i = this.#g(t);
|
|
1280
1380
|
if (!i) {
|
|
1281
|
-
if (!e && !this.#o && (this.#t || this.#
|
|
1282
|
-
|
|
1283
|
-
let l = this.#
|
|
1381
|
+
if (!e && !this.#o && (this.#t || this.#n) && os !== t) {
|
|
1382
|
+
os = t;
|
|
1383
|
+
let l = this.#b(t);
|
|
1284
1384
|
if (l === "no") return s.flipNegate ? !1 : this.negate;
|
|
1285
1385
|
if (l === "yes") return s.flipNegate ? !0 : !this.negate;
|
|
1286
1386
|
}
|
|
1287
|
-
i = this.#
|
|
1387
|
+
i = this.#w(t);
|
|
1288
1388
|
}
|
|
1289
|
-
let n = i.parts, o = this.#
|
|
1290
|
-
if (!
|
|
1291
|
-
for (let l = 0; l <
|
|
1292
|
-
let c =
|
|
1293
|
-
if (f === "base" ? X(c[0],
|
|
1389
|
+
let n = i.parts, o = this.#i ? i.resolved ??= this.#p(n) : n, h = this.set, a = n[n.length - 1];
|
|
1390
|
+
if (!a) for (let l = n.length - 2; !a && l >= 0; l--) a = n[l];
|
|
1391
|
+
for (let l = 0; l < h.length; l++) {
|
|
1392
|
+
let c = h[l], f = e ? void 0 : this.#d[l];
|
|
1393
|
+
if (f === "base" ? X(c[0], a) : f ? this.#E(o, c, f) : s.matchBase && c.length === 1 ? this.#k([a], [a], c, e) : this.#k(n, o, c, e)) return s.flipNegate ? !0 : !this.negate;
|
|
1294
1394
|
}
|
|
1295
1395
|
return s.flipNegate ? !1 : this.negate;
|
|
1296
1396
|
}
|
|
1297
1397
|
static defaults(t) {
|
|
1298
|
-
return
|
|
1299
|
-
}
|
|
1300
|
-
};
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
var
|
|
1305
|
-
var
|
|
1306
|
-
var
|
|
1307
|
-
var
|
|
1308
|
-
var
|
|
1309
|
-
var
|
|
1310
|
-
var
|
|
1311
|
-
typeof
|
|
1312
|
-
};
|
|
1313
|
-
var
|
|
1398
|
+
return T.defaults(t).Minimatch;
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
T.Minimatch = D;
|
|
1402
|
+
T.escape = K;
|
|
1403
|
+
T.unescape = st;
|
|
1404
|
+
var M = channel("lru-cache:metrics");
|
|
1405
|
+
var wt = tracingChannel("lru-cache");
|
|
1406
|
+
var _i = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
1407
|
+
var ke = () => M.hasSubscribers || wt.hasSubscribers;
|
|
1408
|
+
var us = new Set();
|
|
1409
|
+
var fs = typeof process == "object" && process ? process : {};
|
|
1410
|
+
var Di = (r, t, e, s) => {
|
|
1411
|
+
typeof fs.emitWarning == "function" ? fs.emitWarning(r, t, e, s) : console.error(`[${e}] ${t}: ${r}`);
|
|
1412
|
+
};
|
|
1413
|
+
var Ni = (r) => !us.has(r);
|
|
1314
1414
|
var V = (r) => !!r && r === Math.floor(r) && r > 0 && isFinite(r);
|
|
1315
|
-
var
|
|
1316
|
-
var
|
|
1415
|
+
var ds = (r) => V(r) ? r <= Math.pow(2, 8) ? Uint8Array : r <= Math.pow(2, 16) ? Uint16Array : r <= Math.pow(2, 32) ? Uint32Array : r <= Number.MAX_SAFE_INTEGER ? jt : null : null;
|
|
1416
|
+
var jt = class extends Array {
|
|
1317
1417
|
constructor(r) {
|
|
1318
1418
|
super(r), this.fill(0);
|
|
1319
1419
|
}
|
|
1320
1420
|
};
|
|
1321
|
-
var
|
|
1421
|
+
var Pi = class bt {
|
|
1322
1422
|
heap;
|
|
1323
1423
|
length;
|
|
1324
1424
|
static #t = !1;
|
|
1325
1425
|
static create(t) {
|
|
1326
|
-
let e =
|
|
1426
|
+
let e = ds(t);
|
|
1327
1427
|
if (!e) return [];
|
|
1328
|
-
|
|
1329
|
-
let s = new
|
|
1330
|
-
return
|
|
1428
|
+
bt.#t = !0;
|
|
1429
|
+
let s = new bt(t, e);
|
|
1430
|
+
return bt.#t = !1, s;
|
|
1331
1431
|
}
|
|
1332
1432
|
constructor(t, e) {
|
|
1333
|
-
if (!
|
|
1433
|
+
if (!bt.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
1334
1434
|
this.heap = new e(t), this.length = 0;
|
|
1335
1435
|
}
|
|
1336
1436
|
push(t) {
|
|
@@ -1340,17 +1440,17 @@ var xi = class gt {
|
|
|
1340
1440
|
return this.heap[--this.length];
|
|
1341
1441
|
}
|
|
1342
1442
|
};
|
|
1343
|
-
var
|
|
1443
|
+
var yt = class ps {
|
|
1344
1444
|
#t;
|
|
1445
|
+
#n;
|
|
1345
1446
|
#i;
|
|
1346
|
-
#e;
|
|
1347
1447
|
#o;
|
|
1348
1448
|
#r;
|
|
1349
1449
|
#d;
|
|
1350
|
-
#
|
|
1351
|
-
#
|
|
1450
|
+
#u;
|
|
1451
|
+
#f;
|
|
1352
1452
|
get perf() {
|
|
1353
|
-
return this.#
|
|
1453
|
+
return this.#f;
|
|
1354
1454
|
}
|
|
1355
1455
|
ttl;
|
|
1356
1456
|
ttlResolution;
|
|
@@ -1370,46 +1470,46 @@ var wt = class rs {
|
|
|
1370
1470
|
backgroundFetchSize;
|
|
1371
1471
|
#h;
|
|
1372
1472
|
#m;
|
|
1373
|
-
#a;
|
|
1374
1473
|
#l;
|
|
1375
|
-
#
|
|
1376
|
-
#
|
|
1377
|
-
#x;
|
|
1474
|
+
#a;
|
|
1475
|
+
#s;
|
|
1378
1476
|
#b;
|
|
1379
|
-
#f;
|
|
1380
|
-
#v;
|
|
1381
|
-
#y;
|
|
1382
1477
|
#E;
|
|
1383
|
-
#
|
|
1478
|
+
#y;
|
|
1384
1479
|
#g;
|
|
1385
|
-
#
|
|
1480
|
+
#w;
|
|
1481
|
+
#p;
|
|
1482
|
+
#k;
|
|
1386
1483
|
#C;
|
|
1387
|
-
#
|
|
1388
|
-
#
|
|
1389
|
-
#
|
|
1484
|
+
#x;
|
|
1485
|
+
#v;
|
|
1486
|
+
#S;
|
|
1487
|
+
#M;
|
|
1488
|
+
#e;
|
|
1489
|
+
#T;
|
|
1390
1490
|
static unsafeExposeInternals(t) {
|
|
1391
1491
|
return {
|
|
1392
|
-
starts: t.#
|
|
1393
|
-
ttls: t.#
|
|
1394
|
-
autopurgeTimers: t.#
|
|
1395
|
-
sizes: t.#
|
|
1396
|
-
keyMap: t.#
|
|
1397
|
-
keyList: t.#
|
|
1398
|
-
valList: t.#
|
|
1399
|
-
next: t.#
|
|
1400
|
-
prev: t.#
|
|
1492
|
+
starts: t.#C,
|
|
1493
|
+
ttls: t.#x,
|
|
1494
|
+
autopurgeTimers: t.#v,
|
|
1495
|
+
sizes: t.#k,
|
|
1496
|
+
keyMap: t.#l,
|
|
1497
|
+
keyList: t.#a,
|
|
1498
|
+
valList: t.#s,
|
|
1499
|
+
next: t.#b,
|
|
1500
|
+
prev: t.#E,
|
|
1401
1501
|
get head() {
|
|
1402
|
-
return t.#
|
|
1502
|
+
return t.#y;
|
|
1403
1503
|
},
|
|
1404
1504
|
get tail() {
|
|
1405
|
-
return t.#
|
|
1505
|
+
return t.#g;
|
|
1406
1506
|
},
|
|
1407
|
-
free: t.#
|
|
1408
|
-
isBackgroundFetch: (e) => t.#
|
|
1507
|
+
free: t.#w,
|
|
1508
|
+
isBackgroundFetch: (e) => t.#c(e),
|
|
1409
1509
|
backgroundFetch: (e, s, i, n) => t.#L(e, s, i, n),
|
|
1410
1510
|
moveToTail: (e) => t.#X(e),
|
|
1411
|
-
indexes: (e) => t.#
|
|
1412
|
-
rindexes: (e) => t.#
|
|
1511
|
+
indexes: (e) => t.#O(e),
|
|
1512
|
+
rindexes: (e) => t.#F(e),
|
|
1413
1513
|
isStale: (e) => t.#A(e)
|
|
1414
1514
|
};
|
|
1415
1515
|
}
|
|
@@ -1417,7 +1517,7 @@ var wt = class rs {
|
|
|
1417
1517
|
return this.#t;
|
|
1418
1518
|
}
|
|
1419
1519
|
get maxSize() {
|
|
1420
|
-
return this.#
|
|
1520
|
+
return this.#n;
|
|
1421
1521
|
}
|
|
1422
1522
|
get calculatedSize() {
|
|
1423
1523
|
return this.#m;
|
|
@@ -1429,10 +1529,10 @@ var wt = class rs {
|
|
|
1429
1529
|
return this.#d;
|
|
1430
1530
|
}
|
|
1431
1531
|
get memoMethod() {
|
|
1432
|
-
return this.#
|
|
1532
|
+
return this.#u;
|
|
1433
1533
|
}
|
|
1434
1534
|
get dispose() {
|
|
1435
|
-
return this.#
|
|
1535
|
+
return this.#i;
|
|
1436
1536
|
}
|
|
1437
1537
|
get onInsert() {
|
|
1438
1538
|
return this.#o;
|
|
@@ -1441,80 +1541,80 @@ var wt = class rs {
|
|
|
1441
1541
|
return this.#r;
|
|
1442
1542
|
}
|
|
1443
1543
|
constructor(t) {
|
|
1444
|
-
let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas:
|
|
1445
|
-
if (this.backgroundFetchSize =
|
|
1446
|
-
if (this.#
|
|
1447
|
-
let
|
|
1448
|
-
if (!
|
|
1449
|
-
if (this.#t = e, this.#
|
|
1450
|
-
if (!this.#
|
|
1544
|
+
let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: l, onInsert: c, disposeAfter: f, noDisposeOnSet: u, noUpdateTTL: p, maxSize: g = 0, maxEntrySize: d = 0, sizeCalculation: w, fetchMethod: m, memoMethod: b, noDeleteOnFetchRejection: x, noDeleteOnStaleGet: S, allowStaleOnFetchRejection: y, allowStaleOnFetchAbort: q, ignoreFetchAbort: W, backgroundFetchSize: B = 1, perf: et } = t;
|
|
1545
|
+
if (this.backgroundFetchSize = B, et !== void 0 && typeof et?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
1546
|
+
if (this.#f = et ?? _i, e !== 0 && !V(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
1547
|
+
let ie = e ? ds(e) : Array;
|
|
1548
|
+
if (!ie) throw new Error("invalid max value: " + e);
|
|
1549
|
+
if (this.#t = e, this.#n = g, this.maxEntrySize = d || this.#n, this.sizeCalculation = w, this.sizeCalculation) {
|
|
1550
|
+
if (!this.#n && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
1451
1551
|
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
1452
1552
|
}
|
|
1453
1553
|
if (b !== void 0 && typeof b != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
1454
|
-
if (this.#
|
|
1455
|
-
if (this.#d = m, this.#
|
|
1456
|
-
if (this.#
|
|
1554
|
+
if (this.#u = b, m !== void 0 && typeof m != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
1555
|
+
if (this.#d = m, this.#M = !!m, this.#l = new Map(), this.#a = Array.from({ length: e }).fill(void 0), this.#s = Array.from({ length: e }).fill(void 0), this.#b = new ie(e), this.#E = new ie(e), this.#y = 0, this.#g = 0, this.#w = Pi.create(e), this.#h = 0, this.#m = 0, typeof l == "function" && (this.#i = l), typeof c == "function" && (this.#o = c), typeof f == "function" ? (this.#r = f, this.#p = []) : (this.#r = void 0, this.#p = void 0), this.#S = !!this.#i, this.#T = !!this.#o, this.#e = !!this.#r, this.noDisposeOnSet = !!u, this.noUpdateTTL = !!p, this.noDeleteOnFetchRejection = !!x, this.allowStaleOnFetchRejection = !!y, this.allowStaleOnFetchAbort = !!q, this.ignoreFetchAbort = !!W, this.maxEntrySize !== 0) {
|
|
1556
|
+
if (this.#n !== 0 && !V(this.#n)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
1457
1557
|
if (!V(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
1458
1558
|
this.#G();
|
|
1459
1559
|
}
|
|
1460
|
-
if (this.allowStale = !!
|
|
1560
|
+
if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!S, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = V(i) || i === 0 ? i : 1, this.ttlAutopurge = !!n, this.ttl = s || 0, this.ttl) {
|
|
1461
1561
|
if (!V(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
1462
1562
|
this.#_();
|
|
1463
1563
|
}
|
|
1464
|
-
if (this.#t === 0 && this.ttl === 0 && this.#
|
|
1465
|
-
if (!this.ttlAutopurge && !this.#t && !this.#
|
|
1466
|
-
let
|
|
1467
|
-
|
|
1564
|
+
if (this.#t === 0 && this.ttl === 0 && this.#n === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
1565
|
+
if (!this.ttlAutopurge && !this.#t && !this.#n) {
|
|
1566
|
+
let ne = "LRU_CACHE_UNBOUNDED";
|
|
1567
|
+
Ni(ne) && (us.add(ne), Di("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", ne, ps));
|
|
1468
1568
|
}
|
|
1469
1569
|
}
|
|
1470
1570
|
getRemainingTTL(t) {
|
|
1471
|
-
return this.#
|
|
1571
|
+
return this.#l.has(t) ? 1 / 0 : 0;
|
|
1472
1572
|
}
|
|
1473
1573
|
#_() {
|
|
1474
|
-
let t = new
|
|
1475
|
-
this.#
|
|
1574
|
+
let t = new jt(this.#t), e = new jt(this.#t);
|
|
1575
|
+
this.#x = t, this.#C = e;
|
|
1476
1576
|
let s = this.ttlAutopurge ? Array.from({ length: this.#t }) : void 0;
|
|
1477
|
-
this.#
|
|
1478
|
-
e[
|
|
1479
|
-
}, this.#R = (
|
|
1480
|
-
e[
|
|
1577
|
+
this.#v = s, this.#W = (a, l, c = this.#f.now()) => {
|
|
1578
|
+
e[a] = l !== 0 ? c : 0, t[a] = l, i(a, l);
|
|
1579
|
+
}, this.#R = (a) => {
|
|
1580
|
+
e[a] = t[a] !== 0 ? this.#f.now() : 0, i(a, t[a]);
|
|
1481
1581
|
};
|
|
1482
|
-
let i = this.ttlAutopurge ? (
|
|
1483
|
-
if (s?.[
|
|
1582
|
+
let i = this.ttlAutopurge ? (a, l) => {
|
|
1583
|
+
if (s?.[a] && (clearTimeout(s[a]), s[a] = void 0), l && l !== 0 && s) {
|
|
1484
1584
|
let c = setTimeout(() => {
|
|
1485
|
-
this.#A(
|
|
1585
|
+
this.#A(a) ? (this.#j(this.#a[a], "expire"), s[a] = void 0) : i(a, h(a));
|
|
1486
1586
|
}, l + 1);
|
|
1487
|
-
c.unref && c.unref(), s[
|
|
1587
|
+
c.unref && c.unref(), s[a] = c;
|
|
1488
1588
|
}
|
|
1489
1589
|
} : () => {};
|
|
1490
|
-
this.#D = (
|
|
1590
|
+
this.#D = (a, l) => {
|
|
1491
1591
|
if (t[l]) {
|
|
1492
1592
|
let c = t[l], f = e[l];
|
|
1493
1593
|
if (!c || !f) return;
|
|
1494
|
-
|
|
1495
|
-
|
|
1594
|
+
a.ttl = c, a.start = f, a.now = n || o();
|
|
1595
|
+
a.remainingTTL = c - (a.now - f);
|
|
1496
1596
|
}
|
|
1497
1597
|
};
|
|
1498
1598
|
let n = 0, o = () => {
|
|
1499
|
-
let
|
|
1599
|
+
let a = this.#f.now();
|
|
1500
1600
|
if (this.ttlResolution > 0) {
|
|
1501
|
-
n =
|
|
1601
|
+
n = a;
|
|
1502
1602
|
let l = setTimeout(() => n = 0, this.ttlResolution);
|
|
1503
1603
|
l.unref && l.unref();
|
|
1504
1604
|
}
|
|
1505
|
-
return
|
|
1605
|
+
return a;
|
|
1506
1606
|
};
|
|
1507
|
-
this.getRemainingTTL = (
|
|
1508
|
-
let l = this.#
|
|
1509
|
-
return l === void 0 ? 0 :
|
|
1607
|
+
this.getRemainingTTL = (a) => {
|
|
1608
|
+
let l = this.#l.get(a);
|
|
1609
|
+
return l === void 0 ? 0 : h(l);
|
|
1510
1610
|
};
|
|
1511
|
-
let
|
|
1512
|
-
let l = t[
|
|
1611
|
+
let h = (a) => {
|
|
1612
|
+
let l = t[a], c = e[a];
|
|
1513
1613
|
if (!l || !c) return 1 / 0;
|
|
1514
1614
|
return l - ((n || o()) - c);
|
|
1515
1615
|
};
|
|
1516
|
-
this.#A = (
|
|
1517
|
-
let l = e[
|
|
1616
|
+
this.#A = (a) => {
|
|
1617
|
+
let l = e[a], c = t[a];
|
|
1518
1618
|
return !!c && !!l && (n || o()) - l > c;
|
|
1519
1619
|
};
|
|
1520
1620
|
}
|
|
@@ -1523,12 +1623,12 @@ var wt = class rs {
|
|
|
1523
1623
|
#W = () => {};
|
|
1524
1624
|
#A = () => !1;
|
|
1525
1625
|
#G() {
|
|
1526
|
-
let t = new
|
|
1527
|
-
this.#m = 0, this.#
|
|
1626
|
+
let t = new jt(this.#t);
|
|
1627
|
+
this.#m = 0, this.#k = t, this.#P = (e) => {
|
|
1528
1628
|
this.#m -= t[e], t[e] = 0;
|
|
1529
1629
|
}, this.#$ = (e, s, i, n) => {
|
|
1530
1630
|
if (!V(i)) {
|
|
1531
|
-
if (this.#
|
|
1631
|
+
if (this.#c(s)) return this.backgroundFetchSize;
|
|
1532
1632
|
if (n) {
|
|
1533
1633
|
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
1534
1634
|
if (i = n(s, e), !V(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
@@ -1536,8 +1636,8 @@ var wt = class rs {
|
|
|
1536
1636
|
}
|
|
1537
1637
|
return i;
|
|
1538
1638
|
}, this.#N = (e, s, i) => {
|
|
1539
|
-
if (t[e] = s, this.#
|
|
1540
|
-
let n = this.#
|
|
1639
|
+
if (t[e] = s, this.#n) {
|
|
1640
|
+
let n = this.#n - t[e];
|
|
1541
1641
|
for (; this.#m > n;) this.#U(!0);
|
|
1542
1642
|
}
|
|
1543
1643
|
this.#m += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#m);
|
|
@@ -1549,90 +1649,90 @@ var wt = class rs {
|
|
|
1549
1649
|
if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
1550
1650
|
return 0;
|
|
1551
1651
|
};
|
|
1552
|
-
*#
|
|
1553
|
-
if (this.#h) for (let e = this.#
|
|
1652
|
+
*#O({ allowStale: t = this.allowStale } = {}) {
|
|
1653
|
+
if (this.#h) for (let e = this.#g; this.#I(e) && ((t || !this.#A(e)) && (yield e), e !== this.#y);) e = this.#E[e];
|
|
1554
1654
|
}
|
|
1555
|
-
*#
|
|
1556
|
-
if (this.#h) for (let e = this.#
|
|
1655
|
+
*#F({ allowStale: t = this.allowStale } = {}) {
|
|
1656
|
+
if (this.#h) for (let e = this.#y; this.#I(e) && ((t || !this.#A(e)) && (yield e), e !== this.#g);) e = this.#b[e];
|
|
1557
1657
|
}
|
|
1558
|
-
#
|
|
1559
|
-
return t !== void 0 && this.#
|
|
1658
|
+
#I(t) {
|
|
1659
|
+
return t !== void 0 && this.#l.get(this.#a[t]) === t;
|
|
1560
1660
|
}
|
|
1561
1661
|
*entries() {
|
|
1562
|
-
for (let t of this.#
|
|
1662
|
+
for (let t of this.#O()) this.#s[t] !== void 0 && this.#a[t] !== void 0 && !this.#c(this.#s[t]) && (yield [this.#a[t], this.#s[t]]);
|
|
1563
1663
|
}
|
|
1564
1664
|
*rentries() {
|
|
1565
|
-
for (let t of this.#
|
|
1665
|
+
for (let t of this.#F()) this.#s[t] !== void 0 && this.#a[t] !== void 0 && !this.#c(this.#s[t]) && (yield [this.#a[t], this.#s[t]]);
|
|
1566
1666
|
}
|
|
1567
1667
|
*keys() {
|
|
1568
|
-
for (let t of this.#
|
|
1569
|
-
let e = this.#
|
|
1570
|
-
e !== void 0 && !this.#
|
|
1668
|
+
for (let t of this.#O()) {
|
|
1669
|
+
let e = this.#a[t];
|
|
1670
|
+
e !== void 0 && !this.#c(this.#s[t]) && (yield e);
|
|
1571
1671
|
}
|
|
1572
1672
|
}
|
|
1573
1673
|
*rkeys() {
|
|
1574
|
-
for (let t of this.#
|
|
1575
|
-
let e = this.#
|
|
1576
|
-
e !== void 0 && !this.#
|
|
1674
|
+
for (let t of this.#F()) {
|
|
1675
|
+
let e = this.#a[t];
|
|
1676
|
+
e !== void 0 && !this.#c(this.#s[t]) && (yield e);
|
|
1577
1677
|
}
|
|
1578
1678
|
}
|
|
1579
1679
|
*values() {
|
|
1580
|
-
for (let t of this.#
|
|
1680
|
+
for (let t of this.#O()) this.#s[t] !== void 0 && !this.#c(this.#s[t]) && (yield this.#s[t]);
|
|
1581
1681
|
}
|
|
1582
1682
|
*rvalues() {
|
|
1583
|
-
for (let t of this.#
|
|
1683
|
+
for (let t of this.#F()) this.#s[t] !== void 0 && !this.#c(this.#s[t]) && (yield this.#s[t]);
|
|
1584
1684
|
}
|
|
1585
1685
|
[Symbol.iterator]() {
|
|
1586
1686
|
return this.entries();
|
|
1587
1687
|
}
|
|
1588
1688
|
[Symbol.toStringTag] = "LRUCache";
|
|
1589
1689
|
find(t, e = {}) {
|
|
1590
|
-
for (let s of this.#
|
|
1591
|
-
let i = this.#
|
|
1592
|
-
if (n !== void 0 && t(n, this.#
|
|
1690
|
+
for (let s of this.#O()) {
|
|
1691
|
+
let i = this.#s[s], n = this.#c(i) ? i.__staleWhileFetching : i;
|
|
1692
|
+
if (n !== void 0 && t(n, this.#a[s], this)) return this.#K(this.#a[s], e);
|
|
1593
1693
|
}
|
|
1594
1694
|
}
|
|
1595
1695
|
forEach(t, e = this) {
|
|
1596
|
-
for (let s of this.#
|
|
1597
|
-
let i = this.#
|
|
1598
|
-
n !== void 0 && t.call(e, n, this.#
|
|
1696
|
+
for (let s of this.#O()) {
|
|
1697
|
+
let i = this.#s[s], n = this.#c(i) ? i.__staleWhileFetching : i;
|
|
1698
|
+
n !== void 0 && t.call(e, n, this.#a[s], this);
|
|
1599
1699
|
}
|
|
1600
1700
|
}
|
|
1601
1701
|
rforEach(t, e = this) {
|
|
1602
|
-
for (let s of this.#
|
|
1603
|
-
let i = this.#
|
|
1604
|
-
n !== void 0 && t.call(e, n, this.#
|
|
1702
|
+
for (let s of this.#F()) {
|
|
1703
|
+
let i = this.#s[s], n = this.#c(i) ? i.__staleWhileFetching : i;
|
|
1704
|
+
n !== void 0 && t.call(e, n, this.#a[s], this);
|
|
1605
1705
|
}
|
|
1606
1706
|
}
|
|
1607
1707
|
purgeStale() {
|
|
1608
1708
|
let t = !1;
|
|
1609
|
-
for (let e of this.#
|
|
1709
|
+
for (let e of this.#F({ allowStale: !0 })) this.#A(e) && (this.#j(this.#a[e], "expire"), t = !0);
|
|
1610
1710
|
return t;
|
|
1611
1711
|
}
|
|
1612
1712
|
info(t) {
|
|
1613
|
-
let e = this.#
|
|
1713
|
+
let e = this.#l.get(t);
|
|
1614
1714
|
if (e === void 0) return;
|
|
1615
|
-
let s = this.#
|
|
1715
|
+
let s = this.#s[e], i = this.#c(s) ? s.__staleWhileFetching : s;
|
|
1616
1716
|
if (i === void 0) return;
|
|
1617
1717
|
let n = { value: i };
|
|
1618
|
-
if (this.#
|
|
1619
|
-
let o = this.#
|
|
1620
|
-
if (o &&
|
|
1718
|
+
if (this.#x && this.#C) {
|
|
1719
|
+
let o = this.#x[e], h = this.#C[e];
|
|
1720
|
+
if (o && h) n.ttl = o - (this.#f.now() - h), n.start = Date.now();
|
|
1621
1721
|
}
|
|
1622
|
-
return this.#
|
|
1722
|
+
return this.#k && (n.size = this.#k[e]), n;
|
|
1623
1723
|
}
|
|
1624
1724
|
dump() {
|
|
1625
1725
|
let t = [];
|
|
1626
|
-
for (let e of this.#
|
|
1627
|
-
let s = this.#
|
|
1726
|
+
for (let e of this.#O({ allowStale: !0 })) {
|
|
1727
|
+
let s = this.#a[e], i = this.#s[e], n = this.#c(i) ? i.__staleWhileFetching : i;
|
|
1628
1728
|
if (n === void 0 || s === void 0) continue;
|
|
1629
1729
|
let o = { value: n };
|
|
1630
|
-
if (this.#
|
|
1631
|
-
o.ttl = this.#
|
|
1632
|
-
let
|
|
1633
|
-
o.start = Math.floor(Date.now() -
|
|
1730
|
+
if (this.#x && this.#C) {
|
|
1731
|
+
o.ttl = this.#x[e];
|
|
1732
|
+
let h = this.#f.now() - this.#C[e];
|
|
1733
|
+
o.start = Math.floor(Date.now() - h);
|
|
1634
1734
|
}
|
|
1635
|
-
this.#
|
|
1735
|
+
this.#k && (o.size = this.#k[e]), t.unshift([s, o]);
|
|
1636
1736
|
}
|
|
1637
1737
|
return t;
|
|
1638
1738
|
}
|
|
@@ -1641,253 +1741,253 @@ var wt = class rs {
|
|
|
1641
1741
|
for (let [e, s] of t) {
|
|
1642
1742
|
if (s.start) {
|
|
1643
1743
|
let i = Date.now() - s.start;
|
|
1644
|
-
s.start = this.#
|
|
1744
|
+
s.start = this.#f.now() - i;
|
|
1645
1745
|
}
|
|
1646
1746
|
this.#z(e, s.value, s);
|
|
1647
1747
|
}
|
|
1648
1748
|
}
|
|
1649
1749
|
set(t, e, s = {}) {
|
|
1650
|
-
let { status: i =
|
|
1750
|
+
let { status: i = M.hasSubscribers ? {} : void 0 } = s;
|
|
1651
1751
|
s.status = i, i && (i.op = "set", i.key = t, e !== void 0 && (i.value = e), i.cache = this);
|
|
1652
1752
|
let n = this.#z(t, e, s);
|
|
1653
|
-
return i &&
|
|
1753
|
+
return i && M.hasSubscribers && M.publish(i), n;
|
|
1654
1754
|
}
|
|
1655
1755
|
#z(t, e, s, i) {
|
|
1656
|
-
let { ttl: n = this.ttl, start: o, noDisposeOnSet:
|
|
1756
|
+
let { ttl: n = this.ttl, start: o, noDisposeOnSet: h = this.noDisposeOnSet, sizeCalculation: a = this.sizeCalculation, status: l } = s, c = this.#c(e);
|
|
1657
1757
|
if (e === void 0) return l && (l.set = "deleted"), this.delete(t), this;
|
|
1658
1758
|
let { noUpdateTTL: f = this.noUpdateTTL } = s;
|
|
1659
1759
|
l && !c && (l.value = e);
|
|
1660
|
-
let
|
|
1661
|
-
if (this.maxEntrySize &&
|
|
1662
|
-
let
|
|
1663
|
-
if (
|
|
1760
|
+
let u = this.#$(t, e, s.size || 0, a, l);
|
|
1761
|
+
if (this.maxEntrySize && u > this.maxEntrySize) return this.#j(t, "set"), l && (l.set = "miss", l.maxEntrySizeExceeded = !0), this;
|
|
1762
|
+
let p = this.#h === 0 ? void 0 : this.#l.get(t);
|
|
1763
|
+
if (p === void 0) p = this.#h === 0 ? this.#g : this.#w.length !== 0 ? this.#w.pop() : this.#h === this.#t ? this.#U(!1) : this.#h, this.#a[p] = t, this.#s[p] = e, this.#l.set(t, p), this.#b[this.#g] = p, this.#E[p] = this.#g, this.#g = p, this.#h++, this.#N(p, u, l), l && (l.set = "add"), f = !1, this.#T && !c && this.#o?.(e, t, "add");
|
|
1664
1764
|
else {
|
|
1665
|
-
this.#X(
|
|
1666
|
-
let g = this.#
|
|
1765
|
+
this.#X(p);
|
|
1766
|
+
let g = this.#s[p];
|
|
1667
1767
|
if (e !== g) {
|
|
1668
|
-
if (!
|
|
1768
|
+
if (!h) if (this.#c(g)) {
|
|
1669
1769
|
g !== i && g.__abortController.abort(new Error("replaced"));
|
|
1670
|
-
let { __staleWhileFetching:
|
|
1671
|
-
|
|
1672
|
-
|
|
1770
|
+
let { __staleWhileFetching: d } = g;
|
|
1771
|
+
d !== void 0 && d !== e && (this.#S && this.#i?.(d, t, "set"), this.#e && this.#p?.push([
|
|
1772
|
+
d,
|
|
1673
1773
|
t,
|
|
1674
1774
|
"set"
|
|
1675
1775
|
]));
|
|
1676
|
-
} else this.#
|
|
1776
|
+
} else this.#S && this.#i?.(g, t, "set"), this.#e && this.#p?.push([
|
|
1677
1777
|
g,
|
|
1678
1778
|
t,
|
|
1679
1779
|
"set"
|
|
1680
1780
|
]);
|
|
1681
|
-
if (this.#P(
|
|
1682
|
-
let
|
|
1683
|
-
l && (l.set = w,
|
|
1781
|
+
if (this.#P(p), this.#N(p, u, l), this.#s[p] = e, !c) {
|
|
1782
|
+
let d = g && this.#c(g) ? g.__staleWhileFetching : g, w = d === void 0 ? "add" : e !== d ? "replace" : "update";
|
|
1783
|
+
l && (l.set = w, d !== void 0 && (l.oldValue = d)), this.#T && this.onInsert?.(e, t, w);
|
|
1684
1784
|
}
|
|
1685
|
-
} else c || (l && (l.set = "update"), this.#
|
|
1785
|
+
} else c || (l && (l.set = "update"), this.#T && this.onInsert?.(e, t, "update"));
|
|
1686
1786
|
}
|
|
1687
|
-
if (n !== 0 && !this.#
|
|
1688
|
-
let g = this.#
|
|
1689
|
-
for (;
|
|
1787
|
+
if (n !== 0 && !this.#x && this.#_(), this.#x && (f || this.#W(p, n, o), l && this.#D(l, p)), !h && this.#e && this.#p) {
|
|
1788
|
+
let g = this.#p, d;
|
|
1789
|
+
for (; d = g?.shift();) this.#r?.(...d);
|
|
1690
1790
|
}
|
|
1691
1791
|
return this;
|
|
1692
1792
|
}
|
|
1693
1793
|
pop() {
|
|
1694
1794
|
try {
|
|
1695
1795
|
for (; this.#h;) {
|
|
1696
|
-
let t = this.#
|
|
1697
|
-
if (this.#U(!0), this.#
|
|
1796
|
+
let t = this.#s[this.#y];
|
|
1797
|
+
if (this.#U(!0), this.#c(t)) {
|
|
1698
1798
|
if (t.__staleWhileFetching) return t.__staleWhileFetching;
|
|
1699
1799
|
} else if (t !== void 0) return t;
|
|
1700
1800
|
}
|
|
1701
1801
|
} finally {
|
|
1702
|
-
if (this.#
|
|
1703
|
-
let t = this.#
|
|
1802
|
+
if (this.#e && this.#p) {
|
|
1803
|
+
let t = this.#p, e;
|
|
1704
1804
|
for (; e = t?.shift();) this.#r?.(...e);
|
|
1705
1805
|
}
|
|
1706
1806
|
}
|
|
1707
1807
|
}
|
|
1708
1808
|
#U(t) {
|
|
1709
|
-
let e = this.#
|
|
1809
|
+
let e = this.#y, s = this.#a[e], i = this.#s[e], n = this.#c(i);
|
|
1710
1810
|
n && i.__abortController.abort(new Error("evicted"));
|
|
1711
1811
|
let o = n ? i.__staleWhileFetching : i;
|
|
1712
|
-
return (this.#
|
|
1812
|
+
return (this.#S || this.#e) && o !== void 0 && (this.#S && this.#i?.(o, s, "evict"), this.#e && this.#p?.push([
|
|
1713
1813
|
o,
|
|
1714
1814
|
s,
|
|
1715
1815
|
"evict"
|
|
1716
|
-
])), this.#P(e), this.#
|
|
1816
|
+
])), this.#P(e), this.#v?.[e] && (clearTimeout(this.#v[e]), this.#v[e] = void 0), t && (this.#a[e] = void 0, this.#s[e] = void 0, this.#w.push(e)), this.#h === 1 ? (this.#y = this.#g = 0, this.#w.length = 0) : this.#y = this.#b[e], this.#l.delete(s), this.#h--, e;
|
|
1717
1817
|
}
|
|
1718
1818
|
has(t, e = {}) {
|
|
1719
|
-
let { status: s =
|
|
1819
|
+
let { status: s = M.hasSubscribers ? {} : void 0 } = e;
|
|
1720
1820
|
e.status = s, s && (s.op = "has", s.key = t, s.cache = this);
|
|
1721
1821
|
let i = this.#V(t, e);
|
|
1722
|
-
return
|
|
1822
|
+
return M.hasSubscribers && M.publish(s), i;
|
|
1723
1823
|
}
|
|
1724
1824
|
#V(t, e = {}) {
|
|
1725
|
-
let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, n = this.#
|
|
1825
|
+
let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, n = this.#l.get(t);
|
|
1726
1826
|
if (n !== void 0) {
|
|
1727
|
-
let o = this.#
|
|
1728
|
-
if (this.#
|
|
1827
|
+
let o = this.#s[n];
|
|
1828
|
+
if (this.#c(o) && o.__staleWhileFetching === void 0) return !1;
|
|
1729
1829
|
if (this.#A(n)) i && (i.has = "stale", this.#D(i, n));
|
|
1730
1830
|
else return s && this.#R(n), i && (i.has = "hit", this.#D(i, n)), !0;
|
|
1731
1831
|
} else i && (i.has = "miss");
|
|
1732
1832
|
return !1;
|
|
1733
1833
|
}
|
|
1734
1834
|
peek(t, e = {}) {
|
|
1735
|
-
let { status: s =
|
|
1835
|
+
let { status: s = ke() ? {} : void 0 } = e;
|
|
1736
1836
|
s && (s.op = "peek", s.key = t, s.cache = this), e.status = s;
|
|
1737
1837
|
let i = this.#H(t, e);
|
|
1738
|
-
return
|
|
1838
|
+
return M.hasSubscribers && M.publish(s), i;
|
|
1739
1839
|
}
|
|
1740
1840
|
#H(t, e) {
|
|
1741
|
-
let { status: s, allowStale: i = this.allowStale } = e, n = this.#
|
|
1841
|
+
let { status: s, allowStale: i = this.allowStale } = e, n = this.#l.get(t);
|
|
1742
1842
|
if (n === void 0 || !i && this.#A(n)) {
|
|
1743
1843
|
s && (s.peek = n === void 0 ? "miss" : "stale");
|
|
1744
1844
|
return;
|
|
1745
1845
|
}
|
|
1746
|
-
let o = this.#
|
|
1747
|
-
return s && (
|
|
1846
|
+
let o = this.#s[n], h = this.#c(o) ? o.__staleWhileFetching : o;
|
|
1847
|
+
return s && (h !== void 0 ? (s.peek = "hit", s.value = h) : s.peek = "miss"), h;
|
|
1748
1848
|
}
|
|
1749
1849
|
#L(t, e, s, i) {
|
|
1750
|
-
let n = e === void 0 ? void 0 : this.#
|
|
1751
|
-
if (this.#
|
|
1752
|
-
let o = new AbortController(), { signal:
|
|
1753
|
-
|
|
1754
|
-
let
|
|
1850
|
+
let n = e === void 0 ? void 0 : this.#s[e];
|
|
1851
|
+
if (this.#c(n)) return n;
|
|
1852
|
+
let o = new AbortController(), { signal: h } = s;
|
|
1853
|
+
h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
|
|
1854
|
+
let a = {
|
|
1755
1855
|
signal: o.signal,
|
|
1756
1856
|
options: s,
|
|
1757
1857
|
context: i
|
|
1758
|
-
}, l = (
|
|
1759
|
-
let { aborted: m } = o.signal, b = s.ignoreFetchAbort &&
|
|
1760
|
-
if (s.status && (m && !w ? (s.status.fetchAborted = !0, s.status.fetchError = o.signal.reason, b && (s.status.fetchAbortIgnored = !0)) : s.status.fetchResolved = !0), m && !b && !w) return f(o.signal.reason,
|
|
1761
|
-
let S =
|
|
1762
|
-
return (y ===
|
|
1763
|
-
}, c = (
|
|
1764
|
-
let { aborted: m } = o.signal, b = m && s.allowStaleOnFetchAbort,
|
|
1765
|
-
if (this.#
|
|
1766
|
-
if (y.__returned === y) throw
|
|
1767
|
-
},
|
|
1768
|
-
let m = this.#d?.(t, n,
|
|
1858
|
+
}, l = (d, w = !1) => {
|
|
1859
|
+
let { aborted: m } = o.signal, b = s.ignoreFetchAbort && d !== void 0, x = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && d !== void 0);
|
|
1860
|
+
if (s.status && (m && !w ? (s.status.fetchAborted = !0, s.status.fetchError = o.signal.reason, b && (s.status.fetchAbortIgnored = !0)) : s.status.fetchResolved = !0), m && !b && !w) return f(o.signal.reason, x);
|
|
1861
|
+
let S = p, y = this.#s[e];
|
|
1862
|
+
return (y === p || y === void 0 && b && w) && (d === void 0 ? S.__staleWhileFetching !== void 0 ? this.#s[e] = S.__staleWhileFetching : this.#j(t, "fetch") : (s.status && (s.status.fetchUpdated = !0), this.#z(t, d, a.options, S))), d;
|
|
1863
|
+
}, c = (d) => (s.status && (s.status.fetchRejected = !0, s.status.fetchError = d), f(d, !1)), f = (d, w) => {
|
|
1864
|
+
let { aborted: m } = o.signal, b = m && s.allowStaleOnFetchAbort, x = b || s.allowStaleOnFetchRejection, S = x || s.noDeleteOnFetchRejection, y = p;
|
|
1865
|
+
if (this.#s[e] === p && (!S || !w && y.__staleWhileFetching === void 0 ? this.#j(t, "fetch") : b || (this.#s[e] = y.__staleWhileFetching)), x) return s.status && y.__staleWhileFetching !== void 0 && (s.status.returnedStale = !0), y.__staleWhileFetching;
|
|
1866
|
+
if (y.__returned === y) throw d;
|
|
1867
|
+
}, u = (d, w) => {
|
|
1868
|
+
let m = this.#d?.(t, n, a);
|
|
1769
1869
|
o.signal.addEventListener("abort", () => {
|
|
1770
|
-
(!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (
|
|
1771
|
-
}), m && m instanceof Promise ? m.then((b) =>
|
|
1870
|
+
(!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (d(void 0), s.allowStaleOnFetchAbort && (d = (b) => l(b, !0)));
|
|
1871
|
+
}), m && m instanceof Promise ? m.then((b) => d(b === void 0 ? void 0 : b), w) : m !== void 0 && d(m);
|
|
1772
1872
|
};
|
|
1773
1873
|
s.status && (s.status.fetchDispatched = !0);
|
|
1774
|
-
let
|
|
1874
|
+
let p = new Promise(u).then(l, c), g = Object.assign(p, {
|
|
1775
1875
|
__abortController: o,
|
|
1776
1876
|
__staleWhileFetching: n,
|
|
1777
1877
|
__returned: void 0
|
|
1778
1878
|
});
|
|
1779
1879
|
return e === void 0 ? (this.#z(t, g, {
|
|
1780
|
-
...
|
|
1880
|
+
...a.options,
|
|
1781
1881
|
status: void 0
|
|
1782
|
-
}), e = this.#
|
|
1882
|
+
}), e = this.#l.get(t)) : this.#s[e] = g, g;
|
|
1783
1883
|
}
|
|
1784
|
-
#
|
|
1785
|
-
if (!this.#
|
|
1884
|
+
#c(t) {
|
|
1885
|
+
if (!this.#M) return !1;
|
|
1786
1886
|
let e = t;
|
|
1787
1887
|
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController;
|
|
1788
1888
|
}
|
|
1789
1889
|
fetch(t, e = {}) {
|
|
1790
|
-
let s =
|
|
1890
|
+
let s = wt.hasSubscribers, { status: i = ke() ? {} : void 0 } = e;
|
|
1791
1891
|
e.status = i, i && e.context && (i.context = e.context);
|
|
1792
1892
|
let n = this.#q(t, e);
|
|
1793
|
-
return i && s && (i.trace = !0,
|
|
1893
|
+
return i && s && (i.trace = !0, wt.tracePromise(() => n, i).catch(() => {})), n;
|
|
1794
1894
|
}
|
|
1795
1895
|
async #q(t, e = {}) {
|
|
1796
|
-
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet:
|
|
1797
|
-
if (m && (m.op = "fetch", m.key = t, w && (m.forceRefresh = !0), m.cache = this), !this.#
|
|
1896
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: f = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: u = this.allowStaleOnFetchRejection, ignoreFetchAbort: p = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: d, forceRefresh: w = !1, status: m, signal: b } = e;
|
|
1897
|
+
if (m && (m.op = "fetch", m.key = t, w && (m.forceRefresh = !0), m.cache = this), !this.#M) return m && (m.fetch = "get"), this.#K(t, {
|
|
1798
1898
|
allowStale: s,
|
|
1799
1899
|
updateAgeOnGet: i,
|
|
1800
1900
|
noDeleteOnStaleGet: n,
|
|
1801
1901
|
status: m
|
|
1802
1902
|
});
|
|
1803
|
-
let
|
|
1903
|
+
let x = {
|
|
1804
1904
|
allowStale: s,
|
|
1805
1905
|
updateAgeOnGet: i,
|
|
1806
1906
|
noDeleteOnStaleGet: n,
|
|
1807
1907
|
ttl: o,
|
|
1808
|
-
noDisposeOnSet:
|
|
1809
|
-
size:
|
|
1908
|
+
noDisposeOnSet: h,
|
|
1909
|
+
size: a,
|
|
1810
1910
|
sizeCalculation: l,
|
|
1811
1911
|
noUpdateTTL: c,
|
|
1812
1912
|
noDeleteOnFetchRejection: f,
|
|
1813
|
-
allowStaleOnFetchRejection:
|
|
1913
|
+
allowStaleOnFetchRejection: u,
|
|
1814
1914
|
allowStaleOnFetchAbort: g,
|
|
1815
|
-
ignoreFetchAbort:
|
|
1915
|
+
ignoreFetchAbort: p,
|
|
1816
1916
|
status: m,
|
|
1817
1917
|
signal: b
|
|
1818
|
-
}, S = this.#
|
|
1918
|
+
}, S = this.#l.get(t);
|
|
1819
1919
|
if (S === void 0) {
|
|
1820
1920
|
m && (m.fetch = "miss");
|
|
1821
|
-
let y = this.#L(t, S,
|
|
1921
|
+
let y = this.#L(t, S, x, d);
|
|
1822
1922
|
return y.__returned = y;
|
|
1823
1923
|
} else {
|
|
1824
|
-
let y = this.#
|
|
1825
|
-
if (this.#
|
|
1924
|
+
let y = this.#s[S];
|
|
1925
|
+
if (this.#c(y)) {
|
|
1826
1926
|
let et = s && y.__staleWhileFetching !== void 0;
|
|
1827
1927
|
return m && (m.fetch = "inflight", et && (m.returnedStale = !0)), et ? y.__staleWhileFetching : y.__returned = y;
|
|
1828
1928
|
}
|
|
1829
1929
|
let q = this.#A(S);
|
|
1830
1930
|
if (!w && !q) return m && (m.fetch = "hit"), this.#X(S), i && this.#R(S), m && this.#D(m, S), y;
|
|
1831
|
-
let W = this.#L(t, S,
|
|
1832
|
-
return m && (m.fetch = q ? "stale" : "refresh",
|
|
1931
|
+
let W = this.#L(t, S, x, d), B = W.__staleWhileFetching !== void 0 && s;
|
|
1932
|
+
return m && (m.fetch = q ? "stale" : "refresh", B && q && (m.returnedStale = !0)), B ? W.__staleWhileFetching : W.__returned = W;
|
|
1833
1933
|
}
|
|
1834
1934
|
}
|
|
1835
1935
|
forceFetch(t, e = {}) {
|
|
1836
|
-
let s =
|
|
1936
|
+
let s = wt.hasSubscribers, { status: i = ke() ? {} : void 0 } = e;
|
|
1837
1937
|
e.status = i, i && e.context && (i.context = e.context);
|
|
1838
|
-
let n = this.#
|
|
1839
|
-
return i && s && (i.trace = !0,
|
|
1938
|
+
let n = this.#B(t, e);
|
|
1939
|
+
return i && s && (i.trace = !0, wt.tracePromise(() => n, i).catch(() => {})), n;
|
|
1840
1940
|
}
|
|
1841
|
-
async #
|
|
1941
|
+
async #B(t, e = {}) {
|
|
1842
1942
|
let s = await this.#q(t, e);
|
|
1843
1943
|
if (s === void 0) throw new Error("fetch() returned undefined");
|
|
1844
1944
|
return s;
|
|
1845
1945
|
}
|
|
1846
1946
|
memo(t, e = {}) {
|
|
1847
|
-
let { status: s =
|
|
1947
|
+
let { status: s = M.hasSubscribers ? {} : void 0 } = e;
|
|
1848
1948
|
e.status = s, s && (s.op = "memo", s.key = t, e.context && (s.context = e.context), s.cache = this);
|
|
1849
|
-
let i = this.#
|
|
1850
|
-
return s && (s.value = i),
|
|
1949
|
+
let i = this.#Z(t, e);
|
|
1950
|
+
return s && (s.value = i), M.hasSubscribers && M.publish(s), i;
|
|
1851
1951
|
}
|
|
1852
|
-
#
|
|
1853
|
-
let s = this.#
|
|
1952
|
+
#Z(t, e = {}) {
|
|
1953
|
+
let s = this.#u;
|
|
1854
1954
|
if (!s) throw new Error("no memoMethod provided to constructor");
|
|
1855
|
-
let { context: i, status: n, forceRefresh: o, ...
|
|
1955
|
+
let { context: i, status: n, forceRefresh: o, ...h } = e;
|
|
1856
1956
|
n && o && (n.forceRefresh = !0);
|
|
1857
|
-
let
|
|
1858
|
-
if (n && (n.memo = l ? "miss" : "hit", l || (n.value =
|
|
1859
|
-
let c = s(t,
|
|
1860
|
-
options:
|
|
1957
|
+
let a = this.#K(t, h), l = o || a === void 0;
|
|
1958
|
+
if (n && (n.memo = l ? "miss" : "hit", l || (n.value = a)), !l) return a;
|
|
1959
|
+
let c = s(t, a, {
|
|
1960
|
+
options: h,
|
|
1861
1961
|
context: i
|
|
1862
1962
|
});
|
|
1863
|
-
return n && (n.value = c), this.#z(t, c,
|
|
1963
|
+
return n && (n.value = c), this.#z(t, c, h), c;
|
|
1864
1964
|
}
|
|
1865
1965
|
get(t, e = {}) {
|
|
1866
|
-
let { status: s =
|
|
1966
|
+
let { status: s = M.hasSubscribers ? {} : void 0 } = e;
|
|
1867
1967
|
e.status = s, s && (s.op = "get", s.key = t, s.cache = this);
|
|
1868
1968
|
let i = this.#K(t, e);
|
|
1869
|
-
return s && (i !== void 0 && (s.value = i),
|
|
1969
|
+
return s && (i !== void 0 && (s.value = i), M.hasSubscribers && M.publish(s)), i;
|
|
1870
1970
|
}
|
|
1871
1971
|
#K(t, e = {}) {
|
|
1872
|
-
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = e,
|
|
1873
|
-
if (
|
|
1972
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = e, h = this.#l.get(t);
|
|
1973
|
+
if (h === void 0) {
|
|
1874
1974
|
o && (o.get = "miss");
|
|
1875
1975
|
return;
|
|
1876
1976
|
}
|
|
1877
|
-
let
|
|
1878
|
-
return o && this.#D(o,
|
|
1977
|
+
let a = this.#s[h], l = this.#c(a);
|
|
1978
|
+
return o && this.#D(o, h), this.#A(h) ? l ? (o && (o.get = "stale-fetching"), s && a.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = !0), a.__staleWhileFetching) : void 0) : (n || this.#j(t, "expire"), o && (o.get = "stale"), s ? (o && (o.returnedStale = !0), a) : void 0) : (o && (o.get = l ? "fetching" : "hit"), this.#X(h), i && this.#R(h), l ? a.__staleWhileFetching : a);
|
|
1879
1979
|
}
|
|
1880
1980
|
#Y(t, e) {
|
|
1881
|
-
this.#
|
|
1981
|
+
this.#E[e] = t, this.#b[t] = e;
|
|
1882
1982
|
}
|
|
1883
1983
|
#X(t) {
|
|
1884
|
-
t !== this.#
|
|
1984
|
+
t !== this.#g && (t === this.#y ? this.#y = this.#b[t] : this.#Y(this.#E[t], this.#b[t]), this.#Y(this.#g, t), this.#g = t);
|
|
1885
1985
|
}
|
|
1886
1986
|
delete(t) {
|
|
1887
1987
|
return this.#j(t, "delete");
|
|
1888
1988
|
}
|
|
1889
1989
|
#j(t, e) {
|
|
1890
|
-
|
|
1990
|
+
M.hasSubscribers && M.publish({
|
|
1891
1991
|
op: "delete",
|
|
1892
1992
|
delete: e,
|
|
1893
1993
|
key: t,
|
|
@@ -1895,109 +1995,109 @@ var wt = class rs {
|
|
|
1895
1995
|
});
|
|
1896
1996
|
let s = !1;
|
|
1897
1997
|
if (this.#h !== 0) {
|
|
1898
|
-
let i = this.#
|
|
1899
|
-
if (i !== void 0) if (this.#
|
|
1998
|
+
let i = this.#l.get(t);
|
|
1999
|
+
if (i !== void 0) if (this.#v?.[i] && (clearTimeout(this.#v[i]), this.#v[i] = void 0), s = !0, this.#h === 1) this.#J(e);
|
|
1900
2000
|
else {
|
|
1901
2001
|
this.#P(i);
|
|
1902
|
-
let n = this.#
|
|
1903
|
-
if (this.#
|
|
2002
|
+
let n = this.#s[i];
|
|
2003
|
+
if (this.#c(n) ? n.__abortController.abort(new Error("deleted")) : (this.#S || this.#e) && (this.#S && this.#i?.(n, t, e), this.#e && this.#p?.push([
|
|
1904
2004
|
n,
|
|
1905
2005
|
t,
|
|
1906
2006
|
e
|
|
1907
|
-
])), this.#
|
|
1908
|
-
else if (i === this.#
|
|
2007
|
+
])), this.#l.delete(t), this.#a[i] = void 0, this.#s[i] = void 0, i === this.#g) this.#g = this.#E[i];
|
|
2008
|
+
else if (i === this.#y) this.#y = this.#b[i];
|
|
1909
2009
|
else {
|
|
1910
|
-
let o = this.#
|
|
1911
|
-
this.#
|
|
1912
|
-
let
|
|
1913
|
-
this.#
|
|
2010
|
+
let o = this.#E[i];
|
|
2011
|
+
this.#b[o] = this.#b[i];
|
|
2012
|
+
let h = this.#b[i];
|
|
2013
|
+
this.#E[h] = this.#E[i];
|
|
1914
2014
|
}
|
|
1915
|
-
this.#h--, this.#
|
|
2015
|
+
this.#h--, this.#w.push(i);
|
|
1916
2016
|
}
|
|
1917
2017
|
}
|
|
1918
|
-
if (this.#
|
|
1919
|
-
let i = this.#
|
|
2018
|
+
if (this.#e && this.#p?.length) {
|
|
2019
|
+
let i = this.#p, n;
|
|
1920
2020
|
for (; n = i?.shift();) this.#r?.(...n);
|
|
1921
2021
|
}
|
|
1922
2022
|
return s;
|
|
1923
2023
|
}
|
|
1924
2024
|
clear() {
|
|
1925
|
-
return this.#
|
|
2025
|
+
return this.#J("delete");
|
|
1926
2026
|
}
|
|
1927
|
-
#
|
|
1928
|
-
for (let e of this.#
|
|
1929
|
-
let s = this.#
|
|
1930
|
-
if (this.#
|
|
2027
|
+
#J(t) {
|
|
2028
|
+
for (let e of this.#F({ allowStale: !0 })) {
|
|
2029
|
+
let s = this.#s[e];
|
|
2030
|
+
if (this.#c(s)) s.__abortController.abort(new Error("deleted"));
|
|
1931
2031
|
else {
|
|
1932
|
-
let i = this.#
|
|
1933
|
-
this.#
|
|
2032
|
+
let i = this.#a[e];
|
|
2033
|
+
this.#S && this.#i?.(s, i, t), this.#e && this.#p?.push([
|
|
1934
2034
|
s,
|
|
1935
2035
|
i,
|
|
1936
2036
|
t
|
|
1937
2037
|
]);
|
|
1938
2038
|
}
|
|
1939
2039
|
}
|
|
1940
|
-
if (this.#
|
|
1941
|
-
this.#
|
|
1942
|
-
for (let e of this.#
|
|
1943
|
-
this.#
|
|
2040
|
+
if (this.#l.clear(), this.#s.fill(void 0), this.#a.fill(void 0), this.#x && this.#C) {
|
|
2041
|
+
this.#x.fill(0), this.#C.fill(0);
|
|
2042
|
+
for (let e of this.#v ?? []) e !== void 0 && clearTimeout(e);
|
|
2043
|
+
this.#v?.fill(void 0);
|
|
1944
2044
|
}
|
|
1945
|
-
if (this.#
|
|
1946
|
-
let e = this.#
|
|
2045
|
+
if (this.#k && this.#k.fill(0), this.#y = 0, this.#g = 0, this.#w.length = 0, this.#m = 0, this.#h = 0, this.#e && this.#p) {
|
|
2046
|
+
let e = this.#p, s;
|
|
1947
2047
|
for (; s = e?.shift();) this.#r?.(...s);
|
|
1948
2048
|
}
|
|
1949
2049
|
}
|
|
1950
2050
|
};
|
|
1951
|
-
var
|
|
2051
|
+
var ms = typeof process == "object" && process ? process : {
|
|
1952
2052
|
stdout: null,
|
|
1953
2053
|
stderr: null
|
|
1954
2054
|
};
|
|
1955
|
-
var
|
|
1956
|
-
var
|
|
1957
|
-
var
|
|
2055
|
+
var Li = (r) => !!r && typeof r == "object" && (r instanceof J || r instanceof ys || ji(r) || Wi(r));
|
|
2056
|
+
var ji = (r) => !!r && typeof r == "object" && r instanceof EventEmitter && typeof r.pipe == "function" && r.pipe !== ys.Writable.prototype.pipe;
|
|
2057
|
+
var Wi = (r) => !!r && typeof r == "object" && r instanceof EventEmitter && typeof r.write == "function" && typeof r.end == "function";
|
|
1958
2058
|
var G = Symbol("EOF");
|
|
1959
2059
|
var H = Symbol("maybeEmitEnd");
|
|
1960
2060
|
var Y = Symbol("emittedEnd");
|
|
1961
|
-
var
|
|
1962
|
-
var
|
|
1963
|
-
var
|
|
1964
|
-
var
|
|
1965
|
-
var
|
|
1966
|
-
var
|
|
2061
|
+
var Wt = Symbol("emittingEnd");
|
|
2062
|
+
var St = Symbol("emittedError");
|
|
2063
|
+
var $t = Symbol("closed");
|
|
2064
|
+
var gs = Symbol("read");
|
|
2065
|
+
var It = Symbol("flush");
|
|
2066
|
+
var ws = Symbol("flushChunk");
|
|
1967
2067
|
var z = Symbol("encoding");
|
|
1968
|
-
var
|
|
2068
|
+
var nt = Symbol("decoder");
|
|
1969
2069
|
var k = Symbol("flowing");
|
|
1970
|
-
var
|
|
1971
|
-
var
|
|
2070
|
+
var xt = Symbol("paused");
|
|
2071
|
+
var rt = Symbol("resume");
|
|
1972
2072
|
var C = Symbol("buffer");
|
|
1973
|
-
var
|
|
2073
|
+
var F = Symbol("pipes");
|
|
1974
2074
|
var A = Symbol("bufferLength");
|
|
1975
|
-
var
|
|
1976
|
-
var
|
|
1977
|
-
var
|
|
2075
|
+
var Ce = Symbol("bufferPush");
|
|
2076
|
+
var Bt = Symbol("bufferShift");
|
|
2077
|
+
var R = Symbol("objectMode");
|
|
1978
2078
|
var E = Symbol("destroyed");
|
|
1979
|
-
var
|
|
1980
|
-
var
|
|
1981
|
-
var
|
|
1982
|
-
var
|
|
2079
|
+
var Ae = Symbol("error");
|
|
2080
|
+
var Me = Symbol("emitData");
|
|
2081
|
+
var bs = Symbol("emitEnd");
|
|
2082
|
+
var Re = Symbol("emitEnd2");
|
|
1983
2083
|
var $ = Symbol("async");
|
|
1984
|
-
var
|
|
1985
|
-
var
|
|
1986
|
-
var
|
|
2084
|
+
var Oe = Symbol("abort");
|
|
2085
|
+
var Ut = Symbol("aborted");
|
|
2086
|
+
var vt = Symbol("signal");
|
|
1987
2087
|
var Q = Symbol("dataListeners");
|
|
1988
2088
|
var _ = Symbol("discarded");
|
|
1989
|
-
var
|
|
1990
|
-
var
|
|
1991
|
-
var
|
|
1992
|
-
var
|
|
1993
|
-
var
|
|
1994
|
-
var
|
|
2089
|
+
var Et = (r) => Promise.resolve().then(r);
|
|
2090
|
+
var $i = (r) => r();
|
|
2091
|
+
var Ii = (r) => r === "end" || r === "finish" || r === "prefinish";
|
|
2092
|
+
var Bi = (r) => r instanceof ArrayBuffer || !!r && typeof r == "object" && r.constructor && r.constructor.name === "ArrayBuffer" && r.byteLength >= 0;
|
|
2093
|
+
var Ui = (r) => !Buffer.isBuffer(r) && ArrayBuffer.isView(r);
|
|
2094
|
+
var Gt = class {
|
|
1995
2095
|
src;
|
|
1996
2096
|
dest;
|
|
1997
2097
|
opts;
|
|
1998
2098
|
ondrain;
|
|
1999
2099
|
constructor(t, e, s) {
|
|
2000
|
-
this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[
|
|
2100
|
+
this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[rt](), this.dest.on("drain", this.ondrain);
|
|
2001
2101
|
}
|
|
2002
2102
|
unpipe() {
|
|
2003
2103
|
this.dest.removeListener("drain", this.ondrain);
|
|
@@ -2007,7 +2107,7 @@ var Bt = class {
|
|
|
2007
2107
|
this.unpipe(), this.opts.end && this.dest.end();
|
|
2008
2108
|
}
|
|
2009
2109
|
};
|
|
2010
|
-
var
|
|
2110
|
+
var Fe = class extends Gt {
|
|
2011
2111
|
unpipe() {
|
|
2012
2112
|
this.src.removeListener("error", this.proxyErrors), super.unpipe();
|
|
2013
2113
|
}
|
|
@@ -2015,26 +2115,26 @@ var ke = class extends Bt {
|
|
|
2015
2115
|
super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
|
|
2016
2116
|
}
|
|
2017
2117
|
};
|
|
2018
|
-
var
|
|
2019
|
-
var
|
|
2020
|
-
var
|
|
2118
|
+
var Gi = (r) => !!r.objectMode;
|
|
2119
|
+
var Hi = (r) => !r.objectMode && !!r.encoding && r.encoding !== "buffer";
|
|
2120
|
+
var J = class extends EventEmitter {
|
|
2021
2121
|
[k] = !1;
|
|
2022
|
-
[
|
|
2023
|
-
[
|
|
2122
|
+
[xt] = !1;
|
|
2123
|
+
[F] = [];
|
|
2024
2124
|
[C] = [];
|
|
2025
|
-
[
|
|
2125
|
+
[R];
|
|
2026
2126
|
[z];
|
|
2027
2127
|
[$];
|
|
2028
|
-
[
|
|
2128
|
+
[nt];
|
|
2029
2129
|
[G] = !1;
|
|
2030
2130
|
[Y] = !1;
|
|
2031
|
-
[
|
|
2032
|
-
[
|
|
2033
|
-
[
|
|
2131
|
+
[Wt] = !1;
|
|
2132
|
+
[$t] = !1;
|
|
2133
|
+
[St] = null;
|
|
2034
2134
|
[A] = 0;
|
|
2035
2135
|
[E] = !1;
|
|
2036
|
-
[
|
|
2037
|
-
[
|
|
2136
|
+
[vt];
|
|
2137
|
+
[Ut] = !1;
|
|
2038
2138
|
[Q] = 0;
|
|
2039
2139
|
[_] = !1;
|
|
2040
2140
|
writable = !0;
|
|
@@ -2042,9 +2142,9 @@ var Z = class extends EventEmitter {
|
|
|
2042
2142
|
constructor(...t) {
|
|
2043
2143
|
let e = t[0] || {};
|
|
2044
2144
|
if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
|
|
2045
|
-
|
|
2145
|
+
Gi(e) ? (this[R] = !0, this[z] = null) : Hi(e) ? (this[z] = e.encoding, this[R] = !1) : (this[R] = !1, this[z] = null), this[$] = !!e.async, this[nt] = this[z] ? new StringDecoder(this[z]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[F] });
|
|
2046
2146
|
let { signal: s } = e;
|
|
2047
|
-
s && (this[
|
|
2147
|
+
s && (this[vt] = s, s.aborted ? this[Oe]() : s.addEventListener("abort", () => this[Oe]()));
|
|
2048
2148
|
}
|
|
2049
2149
|
get bufferLength() {
|
|
2050
2150
|
return this[A];
|
|
@@ -2059,7 +2159,7 @@ var Z = class extends EventEmitter {
|
|
|
2059
2159
|
throw new Error("Encoding must be set at instantiation time");
|
|
2060
2160
|
}
|
|
2061
2161
|
get objectMode() {
|
|
2062
|
-
return this[
|
|
2162
|
+
return this[R];
|
|
2063
2163
|
}
|
|
2064
2164
|
set objectMode(t) {
|
|
2065
2165
|
throw new Error("objectMode must be set at instantiation time");
|
|
@@ -2070,52 +2170,52 @@ var Z = class extends EventEmitter {
|
|
|
2070
2170
|
set async(t) {
|
|
2071
2171
|
this[$] = this[$] || !!t;
|
|
2072
2172
|
}
|
|
2073
|
-
[
|
|
2074
|
-
this[
|
|
2173
|
+
[Oe]() {
|
|
2174
|
+
this[Ut] = !0, this.emit("abort", this[vt]?.reason), this.destroy(this[vt]?.reason);
|
|
2075
2175
|
}
|
|
2076
2176
|
get aborted() {
|
|
2077
|
-
return this[
|
|
2177
|
+
return this[Ut];
|
|
2078
2178
|
}
|
|
2079
2179
|
set aborted(t) {}
|
|
2080
2180
|
write(t, e, s) {
|
|
2081
|
-
if (this[
|
|
2181
|
+
if (this[Ut]) return !1;
|
|
2082
2182
|
if (this[G]) throw new Error("write after end");
|
|
2083
2183
|
if (this[E]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
|
|
2084
2184
|
typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
|
|
2085
|
-
let i = this[$] ?
|
|
2086
|
-
if (!this[
|
|
2087
|
-
if (
|
|
2088
|
-
else if (
|
|
2185
|
+
let i = this[$] ? Et : $i;
|
|
2186
|
+
if (!this[R] && !Buffer.isBuffer(t)) {
|
|
2187
|
+
if (Ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
2188
|
+
else if (Bi(t)) t = Buffer.from(t);
|
|
2089
2189
|
else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
2090
2190
|
}
|
|
2091
|
-
return this[
|
|
2191
|
+
return this[R] ? (this[k] && this[A] !== 0 && this[It](!0), this[k] ? this.emit("data", t) : this[Ce](t), this[A] !== 0 && this.emit("readable"), s && i(s), this[k]) : t.length ? (typeof t == "string" && (e !== this[z] || this[nt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[z] && (t = this[nt].write(t)), this[k] && this[A] !== 0 && this[It](!0), this[k] ? this.emit("data", t) : this[Ce](t), this[A] !== 0 && this.emit("readable"), s && i(s), this[k]) : (this[A] !== 0 && this.emit("readable"), s && i(s), this[k]);
|
|
2092
2192
|
}
|
|
2093
2193
|
read(t) {
|
|
2094
2194
|
if (this[E]) return null;
|
|
2095
2195
|
if (this[_] = !1, this[A] === 0 || t === 0 || t && t > this[A]) return this[H](), null;
|
|
2096
|
-
this[
|
|
2097
|
-
let e = this[
|
|
2196
|
+
this[R] && (t = null), this[C].length > 1 && !this[R] && (this[C] = [this[z] ? this[C].join("") : Buffer.concat(this[C], this[A])]);
|
|
2197
|
+
let e = this[gs](t || null, this[C][0]);
|
|
2098
2198
|
return this[H](), e;
|
|
2099
2199
|
}
|
|
2100
|
-
[
|
|
2101
|
-
if (this[
|
|
2200
|
+
[gs](t, e) {
|
|
2201
|
+
if (this[R]) this[Bt]();
|
|
2102
2202
|
else {
|
|
2103
2203
|
let s = e;
|
|
2104
|
-
t === s.length || t === null ? this[
|
|
2204
|
+
t === s.length || t === null ? this[Bt]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[A] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[A] -= t);
|
|
2105
2205
|
}
|
|
2106
2206
|
return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
|
|
2107
2207
|
}
|
|
2108
2208
|
end(t, e, s) {
|
|
2109
|
-
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[k] || !this[
|
|
2209
|
+
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[k] || !this[xt]) && this[H](), this;
|
|
2110
2210
|
}
|
|
2111
|
-
[
|
|
2112
|
-
this[E] || (!this[Q] && !this[
|
|
2211
|
+
[rt]() {
|
|
2212
|
+
this[E] || (!this[Q] && !this[F].length && (this[_] = !0), this[xt] = !1, this[k] = !0, this.emit("resume"), this[C].length ? this[It]() : this[G] ? this[H]() : this.emit("drain"));
|
|
2113
2213
|
}
|
|
2114
2214
|
resume() {
|
|
2115
|
-
return this[
|
|
2215
|
+
return this[rt]();
|
|
2116
2216
|
}
|
|
2117
2217
|
pause() {
|
|
2118
|
-
this[k] = !1, this[
|
|
2218
|
+
this[k] = !1, this[xt] = !0, this[_] = !1;
|
|
2119
2219
|
}
|
|
2120
2220
|
get destroyed() {
|
|
2121
2221
|
return this[E];
|
|
@@ -2124,43 +2224,43 @@ var Z = class extends EventEmitter {
|
|
|
2124
2224
|
return this[k];
|
|
2125
2225
|
}
|
|
2126
2226
|
get paused() {
|
|
2127
|
-
return this[
|
|
2227
|
+
return this[xt];
|
|
2128
2228
|
}
|
|
2129
|
-
[
|
|
2130
|
-
this[
|
|
2229
|
+
[Ce](t) {
|
|
2230
|
+
this[R] ? this[A] += 1 : this[A] += t.length, this[C].push(t);
|
|
2131
2231
|
}
|
|
2132
|
-
[
|
|
2133
|
-
return this[
|
|
2232
|
+
[Bt]() {
|
|
2233
|
+
return this[R] ? this[A] -= 1 : this[A] -= this[C][0].length, this[C].shift();
|
|
2134
2234
|
}
|
|
2135
|
-
[
|
|
2235
|
+
[It](t = !1) {
|
|
2136
2236
|
do;
|
|
2137
|
-
while (this[
|
|
2237
|
+
while (this[ws](this[Bt]()) && this[C].length);
|
|
2138
2238
|
!t && !this[C].length && !this[G] && this.emit("drain");
|
|
2139
2239
|
}
|
|
2140
|
-
[
|
|
2240
|
+
[ws](t) {
|
|
2141
2241
|
return this.emit("data", t), this[k];
|
|
2142
2242
|
}
|
|
2143
2243
|
pipe(t, e) {
|
|
2144
2244
|
if (this[E]) return t;
|
|
2145
2245
|
this[_] = !1;
|
|
2146
2246
|
let s = this[Y];
|
|
2147
|
-
return e = e || {}, t ===
|
|
2247
|
+
return e = e || {}, t === ms.stdout || t === ms.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new Fe(this, t, e) : new Gt(this, t, e)), this[$] ? Et(() => this[rt]()) : this[rt]()), t;
|
|
2148
2248
|
}
|
|
2149
2249
|
unpipe(t) {
|
|
2150
|
-
let e = this[
|
|
2151
|
-
e && (this[
|
|
2250
|
+
let e = this[F].find((s) => s.dest === t);
|
|
2251
|
+
e && (this[F].length === 1 ? (this[k] && this[Q] === 0 && (this[k] = !1), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
|
|
2152
2252
|
}
|
|
2153
2253
|
addListener(t, e) {
|
|
2154
2254
|
return this.on(t, e);
|
|
2155
2255
|
}
|
|
2156
2256
|
on(t, e) {
|
|
2157
2257
|
let s = super.on(t, e);
|
|
2158
|
-
if (t === "data") this[_] = !1, this[Q]++, !this[
|
|
2258
|
+
if (t === "data") this[_] = !1, this[Q]++, !this[F].length && !this[k] && this[rt]();
|
|
2159
2259
|
else if (t === "readable" && this[A] !== 0) super.emit("readable");
|
|
2160
|
-
else if (
|
|
2161
|
-
else if (t === "error" && this[
|
|
2260
|
+
else if (Ii(t) && this[Y]) super.emit(t), this.removeAllListeners(t);
|
|
2261
|
+
else if (t === "error" && this[St]) {
|
|
2162
2262
|
let i = e;
|
|
2163
|
-
this[$] ?
|
|
2263
|
+
this[$] ? Et(() => i.call(this, this[St])) : i.call(this, this[St]);
|
|
2164
2264
|
}
|
|
2165
2265
|
return s;
|
|
2166
2266
|
}
|
|
@@ -2169,30 +2269,30 @@ var Z = class extends EventEmitter {
|
|
|
2169
2269
|
}
|
|
2170
2270
|
off(t, e) {
|
|
2171
2271
|
let s = super.off(t, e);
|
|
2172
|
-
return t === "data" && (this[Q] = this.listeners("data").length, this[Q] === 0 && !this[_] && !this[
|
|
2272
|
+
return t === "data" && (this[Q] = this.listeners("data").length, this[Q] === 0 && !this[_] && !this[F].length && (this[k] = !1)), s;
|
|
2173
2273
|
}
|
|
2174
2274
|
removeAllListeners(t) {
|
|
2175
2275
|
let e = super.removeAllListeners(t);
|
|
2176
|
-
return (t === "data" || t === void 0) && (this[Q] = 0, !this[_] && !this[
|
|
2276
|
+
return (t === "data" || t === void 0) && (this[Q] = 0, !this[_] && !this[F].length && (this[k] = !1)), e;
|
|
2177
2277
|
}
|
|
2178
2278
|
get emittedEnd() {
|
|
2179
2279
|
return this[Y];
|
|
2180
2280
|
}
|
|
2181
2281
|
[H]() {
|
|
2182
|
-
!this[
|
|
2282
|
+
!this[Wt] && !this[Y] && !this[E] && this[C].length === 0 && this[G] && (this[Wt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[$t] && this.emit("close"), this[Wt] = !1);
|
|
2183
2283
|
}
|
|
2184
2284
|
emit(t, ...e) {
|
|
2185
2285
|
let s = e[0];
|
|
2186
2286
|
if (t !== "error" && t !== "close" && t !== E && this[E]) return !1;
|
|
2187
|
-
if (t === "data") return !this[
|
|
2188
|
-
if (t === "end") return this[
|
|
2287
|
+
if (t === "data") return !this[R] && !s ? !1 : this[$] ? (Et(() => this[Me](s)), !0) : this[Me](s);
|
|
2288
|
+
if (t === "end") return this[bs]();
|
|
2189
2289
|
if (t === "close") {
|
|
2190
|
-
if (this[
|
|
2290
|
+
if (this[$t] = !0, !this[Y] && !this[E]) return !1;
|
|
2191
2291
|
let n = super.emit("close");
|
|
2192
2292
|
return this.removeAllListeners("close"), n;
|
|
2193
2293
|
} else if (t === "error") {
|
|
2194
|
-
this[
|
|
2195
|
-
let n = !this[
|
|
2294
|
+
this[St] = s, super.emit(Ae, s);
|
|
2295
|
+
let n = !this[vt] || this.listeners("error").length ? super.emit("error", s) : !1;
|
|
2196
2296
|
return this[H](), n;
|
|
2197
2297
|
} else if (t === "resume") {
|
|
2198
2298
|
let n = super.emit("resume");
|
|
@@ -2204,36 +2304,36 @@ var Z = class extends EventEmitter {
|
|
|
2204
2304
|
let i = super.emit(t, ...e);
|
|
2205
2305
|
return this[H](), i;
|
|
2206
2306
|
}
|
|
2207
|
-
[
|
|
2208
|
-
for (let s of this[
|
|
2307
|
+
[Me](t) {
|
|
2308
|
+
for (let s of this[F]) s.dest.write(t) === !1 && this.pause();
|
|
2209
2309
|
let e = this[_] ? !1 : super.emit("data", t);
|
|
2210
2310
|
return this[H](), e;
|
|
2211
2311
|
}
|
|
2212
|
-
[
|
|
2213
|
-
return this[Y] ? !1 : (this[Y] = !0, this.readable = !1, this[$] ? (
|
|
2312
|
+
[bs]() {
|
|
2313
|
+
return this[Y] ? !1 : (this[Y] = !0, this.readable = !1, this[$] ? (Et(() => this[Re]()), !0) : this[Re]());
|
|
2214
2314
|
}
|
|
2215
|
-
[
|
|
2216
|
-
if (this[
|
|
2217
|
-
let e = this[
|
|
2315
|
+
[Re]() {
|
|
2316
|
+
if (this[nt]) {
|
|
2317
|
+
let e = this[nt].end();
|
|
2218
2318
|
if (e) {
|
|
2219
|
-
for (let s of this[
|
|
2319
|
+
for (let s of this[F]) s.dest.write(e);
|
|
2220
2320
|
this[_] || super.emit("data", e);
|
|
2221
2321
|
}
|
|
2222
2322
|
}
|
|
2223
|
-
for (let e of this[
|
|
2323
|
+
for (let e of this[F]) e.end();
|
|
2224
2324
|
let t = super.emit("end");
|
|
2225
2325
|
return this.removeAllListeners("end"), t;
|
|
2226
2326
|
}
|
|
2227
2327
|
async collect() {
|
|
2228
2328
|
let t = Object.assign([], { dataLength: 0 });
|
|
2229
|
-
this[
|
|
2329
|
+
this[R] || (t.dataLength = 0);
|
|
2230
2330
|
let e = this.promise();
|
|
2231
2331
|
return this.on("data", (s) => {
|
|
2232
|
-
t.push(s), this[
|
|
2332
|
+
t.push(s), this[R] || (t.dataLength += s.length);
|
|
2233
2333
|
}), await e, t;
|
|
2234
2334
|
}
|
|
2235
2335
|
async concat() {
|
|
2236
|
-
if (this[
|
|
2336
|
+
if (this[R]) throw new Error("cannot concat in objectMode");
|
|
2237
2337
|
let t = await this.collect();
|
|
2238
2338
|
return this[z] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
2239
2339
|
}
|
|
@@ -2257,21 +2357,21 @@ var Z = class extends EventEmitter {
|
|
|
2257
2357
|
value: i
|
|
2258
2358
|
});
|
|
2259
2359
|
if (this[G]) return e();
|
|
2260
|
-
let n, o,
|
|
2261
|
-
this.off("data",
|
|
2262
|
-
},
|
|
2263
|
-
this.off("error",
|
|
2360
|
+
let n, o, h = (f) => {
|
|
2361
|
+
this.off("data", a), this.off("end", l), this.off(E, c), e(), o(f);
|
|
2362
|
+
}, a = (f) => {
|
|
2363
|
+
this.off("error", h), this.off("end", l), this.off(E, c), this.pause(), n({
|
|
2264
2364
|
value: f,
|
|
2265
2365
|
done: !!this[G]
|
|
2266
2366
|
});
|
|
2267
2367
|
}, l = () => {
|
|
2268
|
-
this.off("error",
|
|
2368
|
+
this.off("error", h), this.off("data", a), this.off(E, c), e(), n({
|
|
2269
2369
|
done: !0,
|
|
2270
2370
|
value: void 0
|
|
2271
2371
|
});
|
|
2272
|
-
}, c = () =>
|
|
2273
|
-
return new Promise((f,
|
|
2274
|
-
o =
|
|
2372
|
+
}, c = () => h(new Error("stream destroyed"));
|
|
2373
|
+
return new Promise((f, u) => {
|
|
2374
|
+
o = u, n = f, this.once(E, c), this.once("error", h), this.once("end", l), this.once("data", a);
|
|
2275
2375
|
});
|
|
2276
2376
|
},
|
|
2277
2377
|
throw: e,
|
|
@@ -2284,7 +2384,7 @@ var Z = class extends EventEmitter {
|
|
|
2284
2384
|
}
|
|
2285
2385
|
[Symbol.iterator]() {
|
|
2286
2386
|
this[_] = !1;
|
|
2287
|
-
let t = !1, e = () => (this.pause(), this.off(
|
|
2387
|
+
let t = !1, e = () => (this.pause(), this.off(Ae, e), this.off(E, e), this.off("end", e), t = !0, {
|
|
2288
2388
|
done: !0,
|
|
2289
2389
|
value: void 0
|
|
2290
2390
|
}), s = () => {
|
|
@@ -2295,7 +2395,7 @@ var Z = class extends EventEmitter {
|
|
|
2295
2395
|
value: i
|
|
2296
2396
|
};
|
|
2297
2397
|
};
|
|
2298
|
-
return this.once("end", e), this.once(
|
|
2398
|
+
return this.once("end", e), this.once(Ae, e), this.once(E, e), {
|
|
2299
2399
|
next: s,
|
|
2300
2400
|
throw: e,
|
|
2301
2401
|
return: e,
|
|
@@ -2309,19 +2409,19 @@ var Z = class extends EventEmitter {
|
|
|
2309
2409
|
if (this[E]) return t ? this.emit("error", t) : this.emit(E), this;
|
|
2310
2410
|
this[E] = !0, this[_] = !0, this[C].length = 0, this[A] = 0;
|
|
2311
2411
|
let e = this;
|
|
2312
|
-
return typeof e.close == "function" && !this[
|
|
2412
|
+
return typeof e.close == "function" && !this[$t] && e.close(), t ? this.emit("error", t) : this.emit(E), this;
|
|
2313
2413
|
}
|
|
2314
2414
|
static get isStream() {
|
|
2315
|
-
return
|
|
2415
|
+
return Li;
|
|
2316
2416
|
}
|
|
2317
2417
|
};
|
|
2318
|
-
var
|
|
2319
|
-
var
|
|
2418
|
+
var tn = realpathSync.native;
|
|
2419
|
+
var Ct = {
|
|
2320
2420
|
lstatSync,
|
|
2321
2421
|
readdir,
|
|
2322
2422
|
readdirSync,
|
|
2323
2423
|
readlinkSync,
|
|
2324
|
-
realpathSync:
|
|
2424
|
+
realpathSync: tn,
|
|
2325
2425
|
promises: {
|
|
2326
2426
|
lstat,
|
|
2327
2427
|
readdir: readdir$1,
|
|
@@ -2329,61 +2429,61 @@ var Et = {
|
|
|
2329
2429
|
realpath
|
|
2330
2430
|
}
|
|
2331
2431
|
};
|
|
2332
|
-
var
|
|
2333
|
-
...
|
|
2432
|
+
var Cs = (r) => !r || r === Ct || r === Qi ? Ct : {
|
|
2433
|
+
...Ct,
|
|
2334
2434
|
...r,
|
|
2335
2435
|
promises: {
|
|
2336
|
-
...
|
|
2436
|
+
...Ct.promises,
|
|
2337
2437
|
...r.promises
|
|
2338
2438
|
}
|
|
2339
2439
|
};
|
|
2340
|
-
var
|
|
2341
|
-
var
|
|
2342
|
-
var
|
|
2343
|
-
var
|
|
2344
|
-
var
|
|
2345
|
-
var
|
|
2346
|
-
var
|
|
2347
|
-
var
|
|
2440
|
+
var on = /^\\\\\?\\([a-z]:)\\?$/i;
|
|
2441
|
+
var hn = /^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i;
|
|
2442
|
+
var an = /^\\\\[^\\?]+\\[^\\]+$/;
|
|
2443
|
+
var Ss = (r) => r.replace(/\//g, "\\").replace(on, "$1\\").replace(hn, "\\\\$1\\").replace(an, "$&\\");
|
|
2444
|
+
var ln = /^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i;
|
|
2445
|
+
var cn = /^[\\/]{2}\?[\\/](?=[a-z]:)/i;
|
|
2446
|
+
var fn = /^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i;
|
|
2447
|
+
var un = /[\\/]/;
|
|
2348
2448
|
var P = 0;
|
|
2349
|
-
var
|
|
2350
|
-
var
|
|
2351
|
-
var
|
|
2352
|
-
var
|
|
2353
|
-
var
|
|
2449
|
+
var As = 1;
|
|
2450
|
+
var Ms = 2;
|
|
2451
|
+
var I = 4;
|
|
2452
|
+
var Rs = 6;
|
|
2453
|
+
var Os = 8;
|
|
2354
2454
|
var tt = 10;
|
|
2355
|
-
var
|
|
2455
|
+
var Fs = 12;
|
|
2356
2456
|
var N = 15;
|
|
2357
|
-
var
|
|
2358
|
-
var
|
|
2359
|
-
var
|
|
2360
|
-
var
|
|
2457
|
+
var kt = ~N;
|
|
2458
|
+
var _e = 16;
|
|
2459
|
+
var xs = 32;
|
|
2460
|
+
var At = 64;
|
|
2361
2461
|
var L = 128;
|
|
2362
|
-
var
|
|
2363
|
-
var
|
|
2364
|
-
var
|
|
2365
|
-
var
|
|
2366
|
-
var
|
|
2367
|
-
var
|
|
2368
|
-
var
|
|
2369
|
-
let t =
|
|
2462
|
+
var Ht = 256;
|
|
2463
|
+
var Kt = 512;
|
|
2464
|
+
var vs = At | L | Kt;
|
|
2465
|
+
var dn = 1023;
|
|
2466
|
+
var De = (r) => r.isFile() ? Os : r.isDirectory() ? I : r.isSymbolicLink() ? tt : r.isCharacterDevice() ? Ms : r.isBlockDevice() ? Rs : r.isSocket() ? Fs : r.isFIFO() ? As : P;
|
|
2467
|
+
var Es = new yt({ max: 4096 });
|
|
2468
|
+
var Mt = (r) => {
|
|
2469
|
+
let t = Es.get(r);
|
|
2370
2470
|
if (t) return t;
|
|
2371
2471
|
let e = r.normalize("NFKD");
|
|
2372
|
-
return
|
|
2472
|
+
return Es.set(r, e), e;
|
|
2373
2473
|
};
|
|
2374
|
-
var
|
|
2375
|
-
var
|
|
2376
|
-
let t =
|
|
2474
|
+
var ks = new yt({ max: 4096 });
|
|
2475
|
+
var qt = (r) => {
|
|
2476
|
+
let t = ks.get(r);
|
|
2377
2477
|
if (t) return t;
|
|
2378
|
-
let e =
|
|
2379
|
-
return
|
|
2478
|
+
let e = Mt(r.toLowerCase());
|
|
2479
|
+
return ks.set(r, e), e;
|
|
2380
2480
|
};
|
|
2381
|
-
var
|
|
2481
|
+
var Xt = class extends yt {
|
|
2382
2482
|
constructor() {
|
|
2383
2483
|
super({ max: 256 });
|
|
2384
2484
|
}
|
|
2385
2485
|
};
|
|
2386
|
-
var
|
|
2486
|
+
var Pe = class extends yt {
|
|
2387
2487
|
constructor(t = 16384) {
|
|
2388
2488
|
super({
|
|
2389
2489
|
maxSize: t,
|
|
@@ -2391,8 +2491,8 @@ var Me = class extends wt {
|
|
|
2391
2491
|
});
|
|
2392
2492
|
}
|
|
2393
2493
|
};
|
|
2394
|
-
var
|
|
2395
|
-
var
|
|
2494
|
+
var Ts = Symbol("PathScurry setAsCwd");
|
|
2495
|
+
var O = class {
|
|
2396
2496
|
name;
|
|
2397
2497
|
root;
|
|
2398
2498
|
roots;
|
|
@@ -2400,13 +2500,13 @@ var M = class {
|
|
|
2400
2500
|
nocase;
|
|
2401
2501
|
isCWD = !1;
|
|
2402
2502
|
#t;
|
|
2403
|
-
#
|
|
2503
|
+
#n;
|
|
2404
2504
|
get dev() {
|
|
2405
|
-
return this.#
|
|
2505
|
+
return this.#n;
|
|
2406
2506
|
}
|
|
2407
|
-
#
|
|
2507
|
+
#i;
|
|
2408
2508
|
get mode() {
|
|
2409
|
-
return this.#
|
|
2509
|
+
return this.#i;
|
|
2410
2510
|
}
|
|
2411
2511
|
#o;
|
|
2412
2512
|
get nlink() {
|
|
@@ -2420,13 +2520,13 @@ var M = class {
|
|
|
2420
2520
|
get gid() {
|
|
2421
2521
|
return this.#d;
|
|
2422
2522
|
}
|
|
2423
|
-
#
|
|
2523
|
+
#u;
|
|
2424
2524
|
get rdev() {
|
|
2425
|
-
return this.#
|
|
2525
|
+
return this.#u;
|
|
2426
2526
|
}
|
|
2427
|
-
#
|
|
2527
|
+
#f;
|
|
2428
2528
|
get blksize() {
|
|
2429
|
-
return this.#
|
|
2529
|
+
return this.#f;
|
|
2430
2530
|
}
|
|
2431
2531
|
#h;
|
|
2432
2532
|
get ino() {
|
|
@@ -2436,50 +2536,50 @@ var M = class {
|
|
|
2436
2536
|
get size() {
|
|
2437
2537
|
return this.#m;
|
|
2438
2538
|
}
|
|
2439
|
-
#
|
|
2539
|
+
#l;
|
|
2440
2540
|
get blocks() {
|
|
2441
|
-
return this.#
|
|
2541
|
+
return this.#l;
|
|
2442
2542
|
}
|
|
2443
|
-
#
|
|
2543
|
+
#a;
|
|
2444
2544
|
get atimeMs() {
|
|
2445
|
-
return this.#
|
|
2545
|
+
return this.#a;
|
|
2446
2546
|
}
|
|
2447
|
-
#
|
|
2547
|
+
#s;
|
|
2448
2548
|
get mtimeMs() {
|
|
2449
|
-
return this.#
|
|
2549
|
+
return this.#s;
|
|
2450
2550
|
}
|
|
2451
|
-
#
|
|
2551
|
+
#b;
|
|
2452
2552
|
get ctimeMs() {
|
|
2453
|
-
return this.#
|
|
2553
|
+
return this.#b;
|
|
2454
2554
|
}
|
|
2455
|
-
#
|
|
2555
|
+
#E;
|
|
2456
2556
|
get birthtimeMs() {
|
|
2457
|
-
return this.#
|
|
2557
|
+
return this.#E;
|
|
2458
2558
|
}
|
|
2459
|
-
#
|
|
2559
|
+
#y;
|
|
2460
2560
|
get atime() {
|
|
2461
|
-
return this.#
|
|
2561
|
+
return this.#y;
|
|
2462
2562
|
}
|
|
2463
|
-
#
|
|
2563
|
+
#g;
|
|
2464
2564
|
get mtime() {
|
|
2465
|
-
return this.#
|
|
2565
|
+
return this.#g;
|
|
2466
2566
|
}
|
|
2467
|
-
#
|
|
2567
|
+
#w;
|
|
2468
2568
|
get ctime() {
|
|
2469
|
-
return this.#
|
|
2569
|
+
return this.#w;
|
|
2470
2570
|
}
|
|
2471
|
-
#
|
|
2571
|
+
#p;
|
|
2472
2572
|
get birthtime() {
|
|
2473
|
-
return this.#
|
|
2573
|
+
return this.#p;
|
|
2474
2574
|
}
|
|
2475
|
-
#E;
|
|
2476
2575
|
#k;
|
|
2477
|
-
#g;
|
|
2478
|
-
#S;
|
|
2479
2576
|
#C;
|
|
2480
|
-
#
|
|
2481
|
-
#
|
|
2482
|
-
#
|
|
2577
|
+
#x;
|
|
2578
|
+
#v;
|
|
2579
|
+
#S;
|
|
2580
|
+
#M;
|
|
2581
|
+
#e;
|
|
2582
|
+
#T;
|
|
2483
2583
|
#_;
|
|
2484
2584
|
#R;
|
|
2485
2585
|
get parentPath() {
|
|
@@ -2488,17 +2588,17 @@ var M = class {
|
|
|
2488
2588
|
get path() {
|
|
2489
2589
|
return this.parentPath;
|
|
2490
2590
|
}
|
|
2491
|
-
constructor(t, e = P, s, i, n, o,
|
|
2492
|
-
this.name = t, this.#
|
|
2591
|
+
constructor(t, e = P, s, i, n, o, h) {
|
|
2592
|
+
this.name = t, this.#k = n ? qt(t) : Mt(t), this.#e = e & dn, this.nocase = n, this.roots = i, this.root = s || this, this.#T = o, this.#x = h.fullpath, this.#S = h.relative, this.#M = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = Cs(h.fs);
|
|
2493
2593
|
}
|
|
2494
2594
|
get fs() {
|
|
2495
2595
|
return this.#t;
|
|
2496
2596
|
}
|
|
2497
2597
|
depth() {
|
|
2498
|
-
return this.#
|
|
2598
|
+
return this.#C !== void 0 ? this.#C : this.parent ? this.#C = this.parent.depth() + 1 : this.#C = 0;
|
|
2499
2599
|
}
|
|
2500
2600
|
childrenCache() {
|
|
2501
|
-
return this.#
|
|
2601
|
+
return this.#T;
|
|
2502
2602
|
}
|
|
2503
2603
|
resolve(t) {
|
|
2504
2604
|
if (!t) return this;
|
|
@@ -2511,59 +2611,59 @@ var M = class {
|
|
|
2511
2611
|
return e;
|
|
2512
2612
|
}
|
|
2513
2613
|
children() {
|
|
2514
|
-
let t = this.#
|
|
2614
|
+
let t = this.#T.get(this);
|
|
2515
2615
|
if (t) return t;
|
|
2516
2616
|
let e = Object.assign([], { provisional: 0 });
|
|
2517
|
-
return this.#
|
|
2617
|
+
return this.#T.set(this, e), this.#e &= ~_e, e;
|
|
2518
2618
|
}
|
|
2519
2619
|
child(t, e) {
|
|
2520
2620
|
if (t === "" || t === ".") return this;
|
|
2521
2621
|
if (t === "..") return this.parent || this;
|
|
2522
|
-
let s = this.children(), i = this.nocase ?
|
|
2523
|
-
for (let
|
|
2524
|
-
let n = this.parent ? this.sep : "", o = this.#
|
|
2622
|
+
let s = this.children(), i = this.nocase ? qt(t) : Mt(t);
|
|
2623
|
+
for (let a of s) if (a.#k === i) return a;
|
|
2624
|
+
let n = this.parent ? this.sep : "", o = this.#x ? this.#x + n + t : void 0, h = this.newChild(t, P, {
|
|
2525
2625
|
...e,
|
|
2526
2626
|
parent: this,
|
|
2527
2627
|
fullpath: o
|
|
2528
2628
|
});
|
|
2529
|
-
return this.canReaddir() || (
|
|
2629
|
+
return this.canReaddir() || (h.#e |= L), s.push(h), h;
|
|
2530
2630
|
}
|
|
2531
2631
|
relative() {
|
|
2532
2632
|
if (this.isCWD) return "";
|
|
2533
|
-
if (this.#
|
|
2633
|
+
if (this.#S !== void 0) return this.#S;
|
|
2534
2634
|
let t = this.name, e = this.parent;
|
|
2535
|
-
if (!e) return this.#
|
|
2635
|
+
if (!e) return this.#S = this.name;
|
|
2536
2636
|
let s = e.relative();
|
|
2537
2637
|
return s + (!s || !e.parent ? "" : this.sep) + t;
|
|
2538
2638
|
}
|
|
2539
2639
|
relativePosix() {
|
|
2540
2640
|
if (this.sep === "/") return this.relative();
|
|
2541
2641
|
if (this.isCWD) return "";
|
|
2542
|
-
if (this.#
|
|
2642
|
+
if (this.#M !== void 0) return this.#M;
|
|
2543
2643
|
let t = this.name, e = this.parent;
|
|
2544
|
-
if (!e) return this.#
|
|
2644
|
+
if (!e) return this.#M = this.fullpathPosix();
|
|
2545
2645
|
let s = e.relativePosix();
|
|
2546
2646
|
return s + (!s || !e.parent ? "" : "/") + t;
|
|
2547
2647
|
}
|
|
2548
2648
|
fullpath() {
|
|
2549
|
-
if (this.#
|
|
2649
|
+
if (this.#x !== void 0) return this.#x;
|
|
2550
2650
|
let t = this.name, e = this.parent;
|
|
2551
|
-
if (!e) return this.#
|
|
2651
|
+
if (!e) return this.#x = this.name;
|
|
2552
2652
|
let i = e.fullpath() + (e.parent ? this.sep : "") + t;
|
|
2553
|
-
return this.#
|
|
2653
|
+
return this.#x = i;
|
|
2554
2654
|
}
|
|
2555
2655
|
fullpathPosix() {
|
|
2556
|
-
if (this.#
|
|
2557
|
-
if (this.sep === "/") return this.#
|
|
2656
|
+
if (this.#v !== void 0) return this.#v;
|
|
2657
|
+
if (this.sep === "/") return this.#v = this.fullpath();
|
|
2558
2658
|
if (!this.parent) {
|
|
2559
2659
|
let i = this.fullpath().replace(/\\/g, "/");
|
|
2560
|
-
return /^[a-z]:\//i.test(i) ? this.#
|
|
2660
|
+
return /^[a-z]:\//i.test(i) ? this.#v = `//?/${i}` : this.#v = i;
|
|
2561
2661
|
}
|
|
2562
2662
|
let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
|
|
2563
|
-
return this.#
|
|
2663
|
+
return this.#v = s;
|
|
2564
2664
|
}
|
|
2565
2665
|
isUnknown() {
|
|
2566
|
-
return (this.#
|
|
2666
|
+
return (this.#e & N) === P;
|
|
2567
2667
|
}
|
|
2568
2668
|
isType(t) {
|
|
2569
2669
|
return this[`is${t}`]();
|
|
@@ -2572,28 +2672,28 @@ var M = class {
|
|
|
2572
2672
|
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";
|
|
2573
2673
|
}
|
|
2574
2674
|
isFile() {
|
|
2575
|
-
return (this.#
|
|
2675
|
+
return (this.#e & N) === Os;
|
|
2576
2676
|
}
|
|
2577
2677
|
isDirectory() {
|
|
2578
|
-
return (this.#
|
|
2678
|
+
return (this.#e & N) === I;
|
|
2579
2679
|
}
|
|
2580
2680
|
isCharacterDevice() {
|
|
2581
|
-
return (this.#
|
|
2681
|
+
return (this.#e & N) === Ms;
|
|
2582
2682
|
}
|
|
2583
2683
|
isBlockDevice() {
|
|
2584
|
-
return (this.#
|
|
2684
|
+
return (this.#e & N) === Rs;
|
|
2585
2685
|
}
|
|
2586
2686
|
isFIFO() {
|
|
2587
|
-
return (this.#
|
|
2687
|
+
return (this.#e & N) === As;
|
|
2588
2688
|
}
|
|
2589
2689
|
isSocket() {
|
|
2590
|
-
return (this.#
|
|
2690
|
+
return (this.#e & N) === Fs;
|
|
2591
2691
|
}
|
|
2592
2692
|
isSymbolicLink() {
|
|
2593
|
-
return (this.#
|
|
2693
|
+
return (this.#e & tt) === tt;
|
|
2594
2694
|
}
|
|
2595
2695
|
lstatCached() {
|
|
2596
|
-
return this.#
|
|
2696
|
+
return this.#e & xs ? this : void 0;
|
|
2597
2697
|
}
|
|
2598
2698
|
readlinkCached() {
|
|
2599
2699
|
return this.#_;
|
|
@@ -2608,17 +2708,17 @@ var M = class {
|
|
|
2608
2708
|
canReadlink() {
|
|
2609
2709
|
if (this.#_) return !0;
|
|
2610
2710
|
if (!this.parent) return !1;
|
|
2611
|
-
let t = this.#
|
|
2612
|
-
return !(t !== P && t !== tt || this.#
|
|
2711
|
+
let t = this.#e & N;
|
|
2712
|
+
return !(t !== P && t !== tt || this.#e & Ht || this.#e & L);
|
|
2613
2713
|
}
|
|
2614
2714
|
calledReaddir() {
|
|
2615
|
-
return !!(this.#
|
|
2715
|
+
return !!(this.#e & _e);
|
|
2616
2716
|
}
|
|
2617
2717
|
isENOENT() {
|
|
2618
|
-
return !!(this.#
|
|
2718
|
+
return !!(this.#e & L);
|
|
2619
2719
|
}
|
|
2620
2720
|
isNamed(t) {
|
|
2621
|
-
return this.nocase ? this.#
|
|
2721
|
+
return this.nocase ? this.#k === qt(t) : this.#k === Mt(t);
|
|
2622
2722
|
}
|
|
2623
2723
|
async readlink() {
|
|
2624
2724
|
let t = this.#_;
|
|
@@ -2627,7 +2727,7 @@ var M = class {
|
|
|
2627
2727
|
let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
|
|
2628
2728
|
if (s) return this.#_ = s;
|
|
2629
2729
|
} catch (e) {
|
|
2630
|
-
this.#
|
|
2730
|
+
this.#F(e.code);
|
|
2631
2731
|
return;
|
|
2632
2732
|
}
|
|
2633
2733
|
}
|
|
@@ -2638,19 +2738,19 @@ var M = class {
|
|
|
2638
2738
|
let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
|
|
2639
2739
|
if (s) return this.#_ = s;
|
|
2640
2740
|
} catch (e) {
|
|
2641
|
-
this.#
|
|
2741
|
+
this.#F(e.code);
|
|
2642
2742
|
return;
|
|
2643
2743
|
}
|
|
2644
2744
|
}
|
|
2645
2745
|
#W(t) {
|
|
2646
|
-
this.#
|
|
2746
|
+
this.#e |= _e;
|
|
2647
2747
|
for (let e = t.provisional; e < t.length; e++) {
|
|
2648
2748
|
let s = t[e];
|
|
2649
2749
|
s && s.#A();
|
|
2650
2750
|
}
|
|
2651
2751
|
}
|
|
2652
2752
|
#A() {
|
|
2653
|
-
this.#
|
|
2753
|
+
this.#e & L || (this.#e = (this.#e | L) & kt, this.#G());
|
|
2654
2754
|
}
|
|
2655
2755
|
#G() {
|
|
2656
2756
|
let t = this.children();
|
|
@@ -2658,64 +2758,64 @@ var M = class {
|
|
|
2658
2758
|
for (let e of t) e.#A();
|
|
2659
2759
|
}
|
|
2660
2760
|
#P() {
|
|
2661
|
-
this.#
|
|
2761
|
+
this.#e |= Kt, this.#N();
|
|
2662
2762
|
}
|
|
2663
2763
|
#N() {
|
|
2664
|
-
if (this.#
|
|
2665
|
-
let t = this.#
|
|
2666
|
-
(t & N) ===
|
|
2764
|
+
if (this.#e & At) return;
|
|
2765
|
+
let t = this.#e;
|
|
2766
|
+
(t & N) === I && (t &= kt), this.#e = t | At, this.#G();
|
|
2667
2767
|
}
|
|
2668
2768
|
#$(t = "") {
|
|
2669
2769
|
t === "ENOTDIR" || t === "EPERM" ? this.#N() : t === "ENOENT" ? this.#A() : this.children().provisional = 0;
|
|
2670
2770
|
}
|
|
2671
|
-
#
|
|
2771
|
+
#O(t = "") {
|
|
2672
2772
|
t === "ENOTDIR" ? this.parent.#N() : t === "ENOENT" && this.#A();
|
|
2673
2773
|
}
|
|
2674
|
-
#
|
|
2675
|
-
let e = this.#
|
|
2676
|
-
e |=
|
|
2774
|
+
#F(t = "") {
|
|
2775
|
+
let e = this.#e;
|
|
2776
|
+
e |= Ht, t === "ENOENT" && (e |= L), (t === "EINVAL" || t === "UNKNOWN") && (e &= kt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#N();
|
|
2677
2777
|
}
|
|
2678
|
-
#
|
|
2778
|
+
#I(t, e) {
|
|
2679
2779
|
return this.#U(t, e) || this.#z(t, e);
|
|
2680
2780
|
}
|
|
2681
2781
|
#z(t, e) {
|
|
2682
|
-
let s =
|
|
2683
|
-
return n !==
|
|
2782
|
+
let s = De(t), i = this.newChild(t.name, s, { parent: this }), n = i.#e & N;
|
|
2783
|
+
return n !== I && n !== tt && n !== P && (i.#e |= At), e.unshift(i), e.provisional++, i;
|
|
2684
2784
|
}
|
|
2685
2785
|
#U(t, e) {
|
|
2686
2786
|
for (let s = e.provisional; s < e.length; s++) {
|
|
2687
2787
|
let i = e[s];
|
|
2688
|
-
if ((this.nocase ?
|
|
2788
|
+
if ((this.nocase ? qt(t.name) : Mt(t.name)) === i.#k) return this.#V(t, i, s, e);
|
|
2689
2789
|
}
|
|
2690
2790
|
}
|
|
2691
2791
|
#V(t, e, s, i) {
|
|
2692
2792
|
let n = e.name;
|
|
2693
|
-
return e.#
|
|
2793
|
+
return e.#e = e.#e & kt | De(t), n !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
|
|
2694
2794
|
}
|
|
2695
2795
|
async lstat() {
|
|
2696
|
-
if ((this.#
|
|
2796
|
+
if ((this.#e & L) === 0) try {
|
|
2697
2797
|
return this.#H(await this.#t.promises.lstat(this.fullpath())), this;
|
|
2698
2798
|
} catch (t) {
|
|
2699
|
-
this.#
|
|
2799
|
+
this.#O(t.code);
|
|
2700
2800
|
}
|
|
2701
2801
|
}
|
|
2702
2802
|
lstatSync() {
|
|
2703
|
-
if ((this.#
|
|
2803
|
+
if ((this.#e & L) === 0) try {
|
|
2704
2804
|
return this.#H(this.#t.lstatSync(this.fullpath())), this;
|
|
2705
2805
|
} catch (t) {
|
|
2706
|
-
this.#
|
|
2806
|
+
this.#O(t.code);
|
|
2707
2807
|
}
|
|
2708
2808
|
}
|
|
2709
2809
|
#H(t) {
|
|
2710
|
-
let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: n, blksize: o, blocks:
|
|
2711
|
-
this.#
|
|
2712
|
-
let S =
|
|
2713
|
-
this.#
|
|
2810
|
+
let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: n, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: c, gid: f, ino: u, mode: p, mtime: g, mtimeMs: d, nlink: w, rdev: m, size: b, uid: x } = t;
|
|
2811
|
+
this.#y = e, this.#a = s, this.#p = i, this.#E = n, this.#f = o, this.#l = h, this.#w = a, this.#b = l, this.#n = c, this.#d = f, this.#h = u, this.#i = p, this.#g = g, this.#s = d, this.#o = w, this.#u = m, this.#m = b, this.#r = x;
|
|
2812
|
+
let S = De(t);
|
|
2813
|
+
this.#e = this.#e & kt | S | xs, S !== P && S !== I && S !== tt && (this.#e |= At);
|
|
2714
2814
|
}
|
|
2715
2815
|
#L = [];
|
|
2716
|
-
#
|
|
2816
|
+
#c = !1;
|
|
2717
2817
|
#q(t) {
|
|
2718
|
-
this.#
|
|
2818
|
+
this.#c = !1;
|
|
2719
2819
|
let e = this.#L.slice();
|
|
2720
2820
|
this.#L.length = 0, e.forEach((s) => s(null, t));
|
|
2721
2821
|
}
|
|
@@ -2730,35 +2830,35 @@ var M = class {
|
|
|
2730
2830
|
e ? t(null, n) : queueMicrotask(() => t(null, n));
|
|
2731
2831
|
return;
|
|
2732
2832
|
}
|
|
2733
|
-
if (this.#L.push(t), this.#
|
|
2734
|
-
this.#
|
|
2833
|
+
if (this.#L.push(t), this.#c) return;
|
|
2834
|
+
this.#c = !0;
|
|
2735
2835
|
let i = this.fullpath();
|
|
2736
2836
|
this.#t.readdir(i, { withFileTypes: !0 }, (n, o) => {
|
|
2737
2837
|
if (n) this.#$(n.code), s.provisional = 0;
|
|
2738
2838
|
else {
|
|
2739
|
-
for (let
|
|
2839
|
+
for (let h of o) this.#I(h, s);
|
|
2740
2840
|
this.#W(s);
|
|
2741
2841
|
}
|
|
2742
2842
|
this.#q(s.slice(0, s.provisional));
|
|
2743
2843
|
});
|
|
2744
2844
|
}
|
|
2745
|
-
#
|
|
2845
|
+
#B;
|
|
2746
2846
|
async readdir() {
|
|
2747
2847
|
if (!this.canReaddir()) return [];
|
|
2748
2848
|
let t = this.children();
|
|
2749
2849
|
if (this.calledReaddir()) return t.slice(0, t.provisional);
|
|
2750
2850
|
let e = this.fullpath();
|
|
2751
|
-
if (this.#
|
|
2851
|
+
if (this.#B) await this.#B;
|
|
2752
2852
|
else {
|
|
2753
2853
|
let s = () => {};
|
|
2754
|
-
this.#
|
|
2854
|
+
this.#B = new Promise((i) => s = i);
|
|
2755
2855
|
try {
|
|
2756
|
-
for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#
|
|
2856
|
+
for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#I(i, t);
|
|
2757
2857
|
this.#W(t);
|
|
2758
2858
|
} catch (i) {
|
|
2759
2859
|
this.#$(i.code), t.provisional = 0;
|
|
2760
2860
|
}
|
|
2761
|
-
this.#
|
|
2861
|
+
this.#B = void 0, s();
|
|
2762
2862
|
}
|
|
2763
2863
|
return t.slice(0, t.provisional);
|
|
2764
2864
|
}
|
|
@@ -2768,7 +2868,7 @@ var M = class {
|
|
|
2768
2868
|
if (this.calledReaddir()) return t.slice(0, t.provisional);
|
|
2769
2869
|
let e = this.fullpath();
|
|
2770
2870
|
try {
|
|
2771
|
-
for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#
|
|
2871
|
+
for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#I(s, t);
|
|
2772
2872
|
this.#W(t);
|
|
2773
2873
|
} catch (s) {
|
|
2774
2874
|
this.#$(s.code), t.provisional = 0;
|
|
@@ -2776,16 +2876,16 @@ var M = class {
|
|
|
2776
2876
|
return t.slice(0, t.provisional);
|
|
2777
2877
|
}
|
|
2778
2878
|
canReaddir() {
|
|
2779
|
-
if (this.#
|
|
2780
|
-
let t = N & this.#
|
|
2781
|
-
return t === P || t ===
|
|
2879
|
+
if (this.#e & vs) return !1;
|
|
2880
|
+
let t = N & this.#e;
|
|
2881
|
+
return t === P || t === I || t === tt;
|
|
2782
2882
|
}
|
|
2783
2883
|
shouldWalk(t, e) {
|
|
2784
|
-
return (this.#
|
|
2884
|
+
return (this.#e & I) === I && !(this.#e & vs) && !t.has(this) && (!e || e(this));
|
|
2785
2885
|
}
|
|
2786
2886
|
async realpath() {
|
|
2787
2887
|
if (this.#R) return this.#R;
|
|
2788
|
-
if (!((
|
|
2888
|
+
if (!((Kt | Ht | L) & this.#e)) try {
|
|
2789
2889
|
let t = await this.#t.promises.realpath(this.fullpath());
|
|
2790
2890
|
return this.#R = this.resolve(t);
|
|
2791
2891
|
} catch {
|
|
@@ -2794,50 +2894,50 @@ var M = class {
|
|
|
2794
2894
|
}
|
|
2795
2895
|
realpathSync() {
|
|
2796
2896
|
if (this.#R) return this.#R;
|
|
2797
|
-
if (!((
|
|
2897
|
+
if (!((Kt | Ht | L) & this.#e)) try {
|
|
2798
2898
|
let t = this.#t.realpathSync(this.fullpath());
|
|
2799
2899
|
return this.#R = this.resolve(t);
|
|
2800
2900
|
} catch {
|
|
2801
2901
|
this.#P();
|
|
2802
2902
|
}
|
|
2803
2903
|
}
|
|
2804
|
-
[
|
|
2904
|
+
[Ts](t) {
|
|
2805
2905
|
if (t === this) return;
|
|
2806
2906
|
t.isCWD = !1, this.isCWD = !0;
|
|
2807
2907
|
let e = new Set([]), s = [], i = this;
|
|
2808
|
-
for (; i && i.parent;) e.add(i), i.#
|
|
2809
|
-
for (i = t; i && i.parent && !e.has(i);) i.#
|
|
2908
|
+
for (; i && i.parent;) e.add(i), i.#S = s.join(this.sep), i.#M = s.join("/"), i = i.parent, s.push("..");
|
|
2909
|
+
for (i = t; i && i.parent && !e.has(i);) i.#S = void 0, i.#M = void 0, i = i.parent;
|
|
2810
2910
|
}
|
|
2811
2911
|
};
|
|
2812
|
-
var
|
|
2912
|
+
var Vt = class r extends O {
|
|
2813
2913
|
sep = "\\";
|
|
2814
|
-
splitSep =
|
|
2815
|
-
constructor(t, e = P, s, i, n, o,
|
|
2816
|
-
super(t, e, s, i, n, o,
|
|
2914
|
+
splitSep = un;
|
|
2915
|
+
constructor(t, e = P, s, i, n, o, h) {
|
|
2916
|
+
super(t, e, s, i, n, o, h);
|
|
2817
2917
|
}
|
|
2818
2918
|
newChild(t, e = P, s = {}) {
|
|
2819
2919
|
return new r(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
2820
2920
|
}
|
|
2821
2921
|
getRootString(t) {
|
|
2822
|
-
return
|
|
2922
|
+
return ln.exec(t)?.[0] ?? win32.parse(t).root;
|
|
2823
2923
|
}
|
|
2824
2924
|
getRoot(t) {
|
|
2825
|
-
if (t =
|
|
2925
|
+
if (t = Ss(t.toUpperCase()), t === this.root.name || /^[\\/]$/.test(t)) return this.root;
|
|
2826
2926
|
for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
|
|
2827
|
-
return this.roots[t] = new
|
|
2927
|
+
return this.roots[t] = new ot(t, {
|
|
2828
2928
|
nocase: this.nocase,
|
|
2829
2929
|
fs: this.fs
|
|
2830
2930
|
}).root;
|
|
2831
2931
|
}
|
|
2832
2932
|
sameRoot(t, e = this.root.name) {
|
|
2833
|
-
return
|
|
2933
|
+
return Ss(t.toUpperCase()) === e;
|
|
2834
2934
|
}
|
|
2835
2935
|
};
|
|
2836
|
-
var
|
|
2936
|
+
var Yt = class r extends O {
|
|
2837
2937
|
splitSep = "/";
|
|
2838
2938
|
sep = "/";
|
|
2839
|
-
constructor(t, e = P, s, i, n, o,
|
|
2840
|
-
super(t, e, s, i, n, o,
|
|
2939
|
+
constructor(t, e = P, s, i, n, o, h) {
|
|
2940
|
+
super(t, e, s, i, n, o, h);
|
|
2841
2941
|
}
|
|
2842
2942
|
getRootString(t) {
|
|
2843
2943
|
return t.startsWith("/") ? "/" : "";
|
|
@@ -2849,31 +2949,31 @@ var Kt = class r extends M {
|
|
|
2849
2949
|
return new r(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
2850
2950
|
}
|
|
2851
2951
|
};
|
|
2852
|
-
var
|
|
2952
|
+
var Jt = class {
|
|
2853
2953
|
root;
|
|
2854
2954
|
rootPath;
|
|
2855
2955
|
roots;
|
|
2856
2956
|
cwd;
|
|
2857
2957
|
#t;
|
|
2958
|
+
#n;
|
|
2858
2959
|
#i;
|
|
2859
|
-
#e;
|
|
2860
2960
|
nocase;
|
|
2861
2961
|
#o;
|
|
2862
|
-
constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: n = 16384, fs: o =
|
|
2863
|
-
this.#o =
|
|
2864
|
-
let
|
|
2865
|
-
this.roots = Object.create(null), this.rootPath = this.parseRootPath(
|
|
2866
|
-
let
|
|
2867
|
-
if (
|
|
2962
|
+
constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: n = 16384, fs: o = Ct } = {}) {
|
|
2963
|
+
this.#o = Cs(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
|
|
2964
|
+
let h = e.resolve(t);
|
|
2965
|
+
this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Xt(), this.#n = new Xt(), this.#i = new Pe(n);
|
|
2966
|
+
let a = h.substring(this.rootPath.length).split(s);
|
|
2967
|
+
if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
|
|
2868
2968
|
this.nocase = i, this.root = this.newRoot(this.#o), this.roots[this.rootPath] = this.root;
|
|
2869
|
-
let l = this.root, c =
|
|
2870
|
-
for (let g of
|
|
2871
|
-
let
|
|
2969
|
+
let l = this.root, c = a.length - 1, f = e.sep, u = this.rootPath, p = !1;
|
|
2970
|
+
for (let g of a) {
|
|
2971
|
+
let d = c--;
|
|
2872
2972
|
l = l.child(g, {
|
|
2873
|
-
relative: new Array(
|
|
2874
|
-
relativePosix: new Array(
|
|
2875
|
-
fullpath:
|
|
2876
|
-
}),
|
|
2973
|
+
relative: new Array(d).fill("..").join(f),
|
|
2974
|
+
relativePosix: new Array(d).fill("..").join("/"),
|
|
2975
|
+
fullpath: u += (p ? "" : f) + g
|
|
2976
|
+
}), p = !0;
|
|
2877
2977
|
}
|
|
2878
2978
|
this.cwd = l;
|
|
2879
2979
|
}
|
|
@@ -2881,7 +2981,7 @@ var Xt = class {
|
|
|
2881
2981
|
return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
|
|
2882
2982
|
}
|
|
2883
2983
|
childrenCache() {
|
|
2884
|
-
return this.#
|
|
2984
|
+
return this.#i;
|
|
2885
2985
|
}
|
|
2886
2986
|
resolve(...t) {
|
|
2887
2987
|
let e = "";
|
|
@@ -2900,10 +3000,10 @@ var Xt = class {
|
|
|
2900
3000
|
let o = t[n];
|
|
2901
3001
|
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
|
|
2902
3002
|
}
|
|
2903
|
-
let s = this.#
|
|
3003
|
+
let s = this.#n.get(e);
|
|
2904
3004
|
if (s !== void 0) return s;
|
|
2905
3005
|
let i = this.cwd.resolve(e).fullpathPosix();
|
|
2906
|
-
return this.#
|
|
3006
|
+
return this.#n.set(e, i), i;
|
|
2907
3007
|
}
|
|
2908
3008
|
relative(t = this.cwd) {
|
|
2909
3009
|
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
|
|
@@ -2918,7 +3018,7 @@ var Xt = class {
|
|
|
2918
3018
|
return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
|
|
2919
3019
|
}
|
|
2920
3020
|
async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
2921
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3021
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
2922
3022
|
let { withFileTypes: s } = e;
|
|
2923
3023
|
if (t.canReaddir()) {
|
|
2924
3024
|
let i = await t.readdir();
|
|
@@ -2926,7 +3026,7 @@ var Xt = class {
|
|
|
2926
3026
|
} else return [];
|
|
2927
3027
|
}
|
|
2928
3028
|
readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
2929
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3029
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
2930
3030
|
let { withFileTypes: s = !0 } = e;
|
|
2931
3031
|
return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
|
|
2932
3032
|
}
|
|
@@ -2937,82 +3037,82 @@ var Xt = class {
|
|
|
2937
3037
|
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
|
|
2938
3038
|
}
|
|
2939
3039
|
async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
2940
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3040
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
|
|
2941
3041
|
let s = await t.readlink();
|
|
2942
3042
|
return e ? s : s?.fullpath();
|
|
2943
3043
|
}
|
|
2944
3044
|
readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
2945
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3045
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
|
|
2946
3046
|
let s = t.readlinkSync();
|
|
2947
3047
|
return e ? s : s?.fullpath();
|
|
2948
3048
|
}
|
|
2949
3049
|
async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
2950
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3050
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
|
|
2951
3051
|
let s = await t.realpath();
|
|
2952
3052
|
return e ? s : s?.fullpath();
|
|
2953
3053
|
}
|
|
2954
3054
|
realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
2955
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3055
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
|
|
2956
3056
|
let s = t.realpathSync();
|
|
2957
3057
|
return e ? s : s?.fullpath();
|
|
2958
3058
|
}
|
|
2959
3059
|
async walk(t = this.cwd, e = {}) {
|
|
2960
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
2961
|
-
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e,
|
|
2962
|
-
(!n || n(t)) &&
|
|
2963
|
-
let
|
|
2964
|
-
|
|
2965
|
-
if (
|
|
2966
|
-
let
|
|
2967
|
-
if (!
|
|
3060
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3061
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e, h = [];
|
|
3062
|
+
(!n || n(t)) && h.push(s ? t : t.fullpath());
|
|
3063
|
+
let a = new Set(), l = (f, u) => {
|
|
3064
|
+
a.add(f), f.readdirCB((p, g) => {
|
|
3065
|
+
if (p) return u(p);
|
|
3066
|
+
let d = g.length;
|
|
3067
|
+
if (!d) return u();
|
|
2968
3068
|
let w = () => {
|
|
2969
|
-
--
|
|
3069
|
+
--d === 0 && u();
|
|
2970
3070
|
};
|
|
2971
|
-
for (let m of g) (!n || n(m)) &&
|
|
3071
|
+
for (let m of g) (!n || n(m)) && h.push(s ? m : m.fullpath()), i && m.isSymbolicLink() ? m.realpath().then((b) => b?.isUnknown() ? b.lstat() : b).then((b) => b?.shouldWalk(a, o) ? l(b, w) : w()) : m.shouldWalk(a, o) ? l(m, w) : w();
|
|
2972
3072
|
}, !0);
|
|
2973
3073
|
}, c = t;
|
|
2974
|
-
return new Promise((f,
|
|
2975
|
-
l(c, (
|
|
2976
|
-
if (
|
|
2977
|
-
f(
|
|
3074
|
+
return new Promise((f, u) => {
|
|
3075
|
+
l(c, (p) => {
|
|
3076
|
+
if (p) return u(p);
|
|
3077
|
+
f(h);
|
|
2978
3078
|
});
|
|
2979
3079
|
});
|
|
2980
3080
|
}
|
|
2981
3081
|
walkSync(t = this.cwd, e = {}) {
|
|
2982
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
2983
|
-
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e,
|
|
2984
|
-
(!n || n(t)) &&
|
|
2985
|
-
let
|
|
2986
|
-
for (let l of
|
|
3082
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3083
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e, h = [];
|
|
3084
|
+
(!n || n(t)) && h.push(s ? t : t.fullpath());
|
|
3085
|
+
let a = new Set([t]);
|
|
3086
|
+
for (let l of a) {
|
|
2987
3087
|
let c = l.readdirSync();
|
|
2988
3088
|
for (let f of c) {
|
|
2989
|
-
(!n || n(f)) &&
|
|
2990
|
-
let
|
|
3089
|
+
(!n || n(f)) && h.push(s ? f : f.fullpath());
|
|
3090
|
+
let u = f;
|
|
2991
3091
|
if (f.isSymbolicLink()) {
|
|
2992
|
-
if (!(i && (
|
|
2993
|
-
|
|
3092
|
+
if (!(i && (u = f.realpathSync()))) continue;
|
|
3093
|
+
u.isUnknown() && u.lstatSync();
|
|
2994
3094
|
}
|
|
2995
|
-
|
|
3095
|
+
u.shouldWalk(a, o) && a.add(u);
|
|
2996
3096
|
}
|
|
2997
3097
|
}
|
|
2998
|
-
return
|
|
3098
|
+
return h;
|
|
2999
3099
|
}
|
|
3000
3100
|
[Symbol.asyncIterator]() {
|
|
3001
3101
|
return this.iterate();
|
|
3002
3102
|
}
|
|
3003
3103
|
iterate(t = this.cwd, e = {}) {
|
|
3004
|
-
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3104
|
+
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
|
|
3005
3105
|
}
|
|
3006
3106
|
[Symbol.iterator]() {
|
|
3007
3107
|
return this.iterateSync();
|
|
3008
3108
|
}
|
|
3009
3109
|
*iterateSync(t = this.cwd, e = {}) {
|
|
3010
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3110
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3011
3111
|
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e;
|
|
3012
3112
|
(!n || n(t)) && (yield s ? t : t.fullpath());
|
|
3013
|
-
let
|
|
3014
|
-
for (let
|
|
3015
|
-
let l =
|
|
3113
|
+
let h = new Set([t]);
|
|
3114
|
+
for (let a of h) {
|
|
3115
|
+
let l = a.readdirSync();
|
|
3016
3116
|
for (let c of l) {
|
|
3017
3117
|
(!n || n(c)) && (yield s ? c : c.fullpath());
|
|
3018
3118
|
let f = c;
|
|
@@ -3020,85 +3120,85 @@ var Xt = class {
|
|
|
3020
3120
|
if (!(i && (f = c.realpathSync()))) continue;
|
|
3021
3121
|
f.isUnknown() && f.lstatSync();
|
|
3022
3122
|
}
|
|
3023
|
-
f.shouldWalk(
|
|
3123
|
+
f.shouldWalk(h, o) && h.add(f);
|
|
3024
3124
|
}
|
|
3025
3125
|
}
|
|
3026
3126
|
}
|
|
3027
3127
|
stream(t = this.cwd, e = {}) {
|
|
3028
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3029
|
-
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e,
|
|
3030
|
-
(!n || n(t)) &&
|
|
3031
|
-
let
|
|
3032
|
-
let
|
|
3033
|
-
for (; !
|
|
3034
|
-
let
|
|
3035
|
-
if (!
|
|
3036
|
-
c === 0 &&
|
|
3128
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3129
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e, h = new J({ objectMode: !0 });
|
|
3130
|
+
(!n || n(t)) && h.write(s ? t : t.fullpath());
|
|
3131
|
+
let a = new Set(), l = [t], c = 0, f = () => {
|
|
3132
|
+
let u = !1;
|
|
3133
|
+
for (; !u;) {
|
|
3134
|
+
let p = l.shift();
|
|
3135
|
+
if (!p) {
|
|
3136
|
+
c === 0 && h.end();
|
|
3037
3137
|
return;
|
|
3038
3138
|
}
|
|
3039
|
-
c++,
|
|
3139
|
+
c++, a.add(p);
|
|
3040
3140
|
let g = (w, m, b = !1) => {
|
|
3041
|
-
if (w) return
|
|
3141
|
+
if (w) return h.emit("error", w);
|
|
3042
3142
|
if (i && !b) {
|
|
3043
|
-
let
|
|
3044
|
-
for (let S of m) S.isSymbolicLink() &&
|
|
3045
|
-
if (
|
|
3046
|
-
Promise.all(
|
|
3143
|
+
let x = [];
|
|
3144
|
+
for (let S of m) S.isSymbolicLink() && x.push(S.realpath().then((y) => y?.isUnknown() ? y.lstat() : y));
|
|
3145
|
+
if (x.length) {
|
|
3146
|
+
Promise.all(x).then(() => g(null, m, !0));
|
|
3047
3147
|
return;
|
|
3048
3148
|
}
|
|
3049
3149
|
}
|
|
3050
|
-
for (let
|
|
3150
|
+
for (let x of m) x && (!n || n(x)) && (h.write(s ? x : x.fullpath()) || (u = !0));
|
|
3051
3151
|
c--;
|
|
3052
|
-
for (let
|
|
3053
|
-
let S =
|
|
3054
|
-
S.shouldWalk(
|
|
3152
|
+
for (let x of m) {
|
|
3153
|
+
let S = x.realpathCached() || x;
|
|
3154
|
+
S.shouldWalk(a, o) && l.push(S);
|
|
3055
3155
|
}
|
|
3056
|
-
|
|
3057
|
-
},
|
|
3058
|
-
|
|
3156
|
+
u && !h.flowing ? h.once("drain", f) : d || f();
|
|
3157
|
+
}, d = !0;
|
|
3158
|
+
p.readdirCB(g, !0), d = !1;
|
|
3059
3159
|
}
|
|
3060
3160
|
};
|
|
3061
|
-
return f(),
|
|
3161
|
+
return f(), h;
|
|
3062
3162
|
}
|
|
3063
3163
|
streamSync(t = this.cwd, e = {}) {
|
|
3064
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof
|
|
3065
|
-
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e,
|
|
3066
|
-
(!n || n(t)) &&
|
|
3164
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3165
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: n, walkFilter: o } = e, h = new J({ objectMode: !0 }), a = new Set();
|
|
3166
|
+
(!n || n(t)) && h.write(s ? t : t.fullpath());
|
|
3067
3167
|
let l = [t], c = 0, f = () => {
|
|
3068
|
-
let
|
|
3069
|
-
for (; !
|
|
3070
|
-
let
|
|
3071
|
-
if (!
|
|
3072
|
-
c === 0 &&
|
|
3168
|
+
let u = !1;
|
|
3169
|
+
for (; !u;) {
|
|
3170
|
+
let p = l.shift();
|
|
3171
|
+
if (!p) {
|
|
3172
|
+
c === 0 && h.end();
|
|
3073
3173
|
return;
|
|
3074
3174
|
}
|
|
3075
|
-
c++,
|
|
3076
|
-
let g =
|
|
3077
|
-
for (let
|
|
3175
|
+
c++, a.add(p);
|
|
3176
|
+
let g = p.readdirSync();
|
|
3177
|
+
for (let d of g) (!n || n(d)) && (h.write(s ? d : d.fullpath()) || (u = !0));
|
|
3078
3178
|
c--;
|
|
3079
|
-
for (let
|
|
3080
|
-
let w =
|
|
3081
|
-
if (
|
|
3082
|
-
if (!(i && (w =
|
|
3179
|
+
for (let d of g) {
|
|
3180
|
+
let w = d;
|
|
3181
|
+
if (d.isSymbolicLink()) {
|
|
3182
|
+
if (!(i && (w = d.realpathSync()))) continue;
|
|
3083
3183
|
w.isUnknown() && w.lstatSync();
|
|
3084
3184
|
}
|
|
3085
|
-
w.shouldWalk(
|
|
3185
|
+
w.shouldWalk(a, o) && l.push(w);
|
|
3086
3186
|
}
|
|
3087
3187
|
}
|
|
3088
|
-
|
|
3188
|
+
u && !h.flowing && h.once("drain", f);
|
|
3089
3189
|
};
|
|
3090
|
-
return f(),
|
|
3190
|
+
return f(), h;
|
|
3091
3191
|
}
|
|
3092
3192
|
chdir(t = this.cwd) {
|
|
3093
3193
|
let e = this.cwd;
|
|
3094
|
-
this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[
|
|
3194
|
+
this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ts](e);
|
|
3095
3195
|
}
|
|
3096
3196
|
};
|
|
3097
|
-
var
|
|
3197
|
+
var ot = class extends Jt {
|
|
3098
3198
|
sep = "\\";
|
|
3099
3199
|
constructor(t = process.cwd(), e = {}) {
|
|
3100
3200
|
let { nocase: s = !0 } = e;
|
|
3101
|
-
typeof t == "string" && !t.startsWith("file://") && (t = t.replace(
|
|
3201
|
+
typeof t == "string" && !t.startsWith("file://") && (t = t.replace(cn, "").replace(fn, "\\")), super(t, win32, "\\", {
|
|
3102
3202
|
...e,
|
|
3103
3203
|
nocase: s
|
|
3104
3204
|
}), this.nocase = s;
|
|
@@ -3108,13 +3208,13 @@ var rt = class extends Xt {
|
|
|
3108
3208
|
return win32.parse(t).root.toUpperCase();
|
|
3109
3209
|
}
|
|
3110
3210
|
newRoot(t) {
|
|
3111
|
-
return new
|
|
3211
|
+
return new Vt(this.rootPath, I, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
3112
3212
|
}
|
|
3113
3213
|
isAbsolute(t) {
|
|
3114
3214
|
return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
|
|
3115
3215
|
}
|
|
3116
3216
|
};
|
|
3117
|
-
var
|
|
3217
|
+
var ht = class extends Jt {
|
|
3118
3218
|
sep = "/";
|
|
3119
3219
|
constructor(t = process.cwd(), e = {}) {
|
|
3120
3220
|
let { nocase: s = !1 } = e;
|
|
@@ -3127,13 +3227,13 @@ var ot = class extends Xt {
|
|
|
3127
3227
|
return "/";
|
|
3128
3228
|
}
|
|
3129
3229
|
newRoot(t) {
|
|
3130
|
-
return new
|
|
3230
|
+
return new Yt(this.rootPath, I, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
3131
3231
|
}
|
|
3132
3232
|
isAbsolute(t) {
|
|
3133
3233
|
return t.startsWith("/");
|
|
3134
3234
|
}
|
|
3135
3235
|
};
|
|
3136
|
-
var
|
|
3236
|
+
var Rt = class extends ht {
|
|
3137
3237
|
constructor(t = process.cwd(), e = {}) {
|
|
3138
3238
|
let { nocase: s = !0 } = e;
|
|
3139
3239
|
super(t, {
|
|
@@ -3143,76 +3243,76 @@ var At = class extends ot {
|
|
|
3143
3243
|
}
|
|
3144
3244
|
};
|
|
3145
3245
|
process.platform;
|
|
3146
|
-
var
|
|
3147
|
-
var
|
|
3148
|
-
var
|
|
3149
|
-
var
|
|
3150
|
-
var
|
|
3246
|
+
var _s = process.platform === "win32" ? ot : process.platform === "darwin" ? Rt : ht;
|
|
3247
|
+
var pn = (r) => r.length >= 1;
|
|
3248
|
+
var mn = (r) => r.length >= 1;
|
|
3249
|
+
var gn = Symbol.for("nodejs.util.inspect.custom");
|
|
3250
|
+
var at = class r {
|
|
3151
3251
|
#t;
|
|
3252
|
+
#n;
|
|
3152
3253
|
#i;
|
|
3153
|
-
#e;
|
|
3154
3254
|
length;
|
|
3155
3255
|
#o;
|
|
3156
3256
|
#r;
|
|
3157
3257
|
#d;
|
|
3158
|
-
#
|
|
3159
|
-
#
|
|
3258
|
+
#u;
|
|
3259
|
+
#f;
|
|
3160
3260
|
#h;
|
|
3161
3261
|
#m = !0;
|
|
3162
3262
|
constructor(t, e, s, i) {
|
|
3163
|
-
if (!
|
|
3164
|
-
if (!
|
|
3263
|
+
if (!pn(t)) throw new TypeError("empty pattern list");
|
|
3264
|
+
if (!mn(e)) throw new TypeError("empty glob list");
|
|
3165
3265
|
if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
|
|
3166
3266
|
if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
|
|
3167
|
-
if (this.#t = t, this.#
|
|
3267
|
+
if (this.#t = t, this.#n = e, this.#i = s, this.#o = i, this.#i === 0) {
|
|
3168
3268
|
if (this.isUNC()) {
|
|
3169
|
-
let n = this.#
|
|
3170
|
-
|
|
3171
|
-
let c = [...o, ""].join("/"), f = [...
|
|
3172
|
-
this.#t = [c, ...
|
|
3269
|
+
let n = this.#l() ? 6 : 4, o = this.#t.slice(0, n), h = this.#n.slice(0, n), a = this.#t.slice(n), l = this.#n.slice(n);
|
|
3270
|
+
a[0] === "" && (a.shift(), l.shift());
|
|
3271
|
+
let c = [...o, ""].join("/"), f = [...h, ""].join("/");
|
|
3272
|
+
this.#t = [c, ...a], this.#n = [f, ...l], this.length = this.#t.length;
|
|
3173
3273
|
} else if (this.isDrive() || this.isAbsolute()) {
|
|
3174
|
-
let [n, ...o] = this.#t, [
|
|
3175
|
-
o[0] === "" && (o.shift(),
|
|
3176
|
-
let l = `${n}/`, c = `${
|
|
3177
|
-
this.#t = [l, ...o], this.#
|
|
3274
|
+
let [n, ...o] = this.#t, [h, ...a] = this.#n;
|
|
3275
|
+
o[0] === "" && (o.shift(), a.shift());
|
|
3276
|
+
let l = `${n}/`, c = `${h}/`;
|
|
3277
|
+
this.#t = [l, ...o], this.#n = [c, ...a], this.length = this.#t.length;
|
|
3178
3278
|
}
|
|
3179
3279
|
}
|
|
3180
3280
|
}
|
|
3181
|
-
[
|
|
3182
|
-
return `Pattern <${this.#
|
|
3281
|
+
[gn]() {
|
|
3282
|
+
return `Pattern <${this.#n.slice(this.#i).join("/")}>`;
|
|
3183
3283
|
}
|
|
3184
3284
|
pattern() {
|
|
3185
|
-
return this.#t[this.#
|
|
3285
|
+
return this.#t[this.#i];
|
|
3186
3286
|
}
|
|
3187
3287
|
isString() {
|
|
3188
|
-
return typeof this.#t[this.#
|
|
3288
|
+
return typeof this.#t[this.#i] == "string";
|
|
3189
3289
|
}
|
|
3190
3290
|
isGlobstar() {
|
|
3191
|
-
return this.#t[this.#
|
|
3291
|
+
return this.#t[this.#i] === v;
|
|
3192
3292
|
}
|
|
3193
3293
|
isMatcher() {
|
|
3194
|
-
return typeof this.#t[this.#
|
|
3294
|
+
return typeof this.#t[this.#i] == "object";
|
|
3195
3295
|
}
|
|
3196
3296
|
globString() {
|
|
3197
|
-
return this.#d = this.#d || (this.#
|
|
3297
|
+
return this.#d = this.#d || (this.#i === 0 ? this.isAbsolute() ? this.#n[0] + this.#n.slice(1).join("/") : this.#n.join("/") : this.#n.slice(this.#i).join("/"));
|
|
3198
3298
|
}
|
|
3199
3299
|
hasMore() {
|
|
3200
|
-
return this.length > this.#
|
|
3300
|
+
return this.length > this.#i + 1;
|
|
3201
3301
|
}
|
|
3202
3302
|
rest() {
|
|
3203
|
-
return this.#r !== void 0 ? this.#r : this.hasMore() ? (this.#r = new r(this.#t, this.#
|
|
3303
|
+
return this.#r !== void 0 ? this.#r : this.hasMore() ? (this.#r = new r(this.#t, this.#n, this.#i + 1, this.#o), this.#r.#h = this.#h, this.#r.#f = this.#f, this.#r.#u = this.#u, this.#r) : this.#r = null;
|
|
3204
3304
|
}
|
|
3205
|
-
#
|
|
3305
|
+
#l() {
|
|
3206
3306
|
let t = this.#t;
|
|
3207
3307
|
return t[2] === "?" && typeof t[3] == "string" && /^unc$/i.test(t[3]);
|
|
3208
3308
|
}
|
|
3209
3309
|
isUNC() {
|
|
3210
|
-
let t = this.#t, e = this.#
|
|
3211
|
-
return this.#
|
|
3310
|
+
let t = this.#t, e = this.#l() ? 4 : 2;
|
|
3311
|
+
return this.#f !== void 0 ? this.#f : this.#f = this.#o === "win32" && this.#i === 0 && t[0] === "" && t[1] === "" && typeof t[e] == "string" && !!t[e] && typeof t[e + 1] == "string" && !!t[e + 1];
|
|
3212
3312
|
}
|
|
3213
3313
|
isDrive() {
|
|
3214
3314
|
let t = this.#t;
|
|
3215
|
-
return this.#
|
|
3315
|
+
return this.#u !== void 0 ? this.#u : this.#u = this.#o === "win32" && this.#i === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
|
|
3216
3316
|
}
|
|
3217
3317
|
isAbsolute() {
|
|
3218
3318
|
let t = this.#t;
|
|
@@ -3220,17 +3320,17 @@ var ht = class r {
|
|
|
3220
3320
|
}
|
|
3221
3321
|
root() {
|
|
3222
3322
|
let t = this.#t[0];
|
|
3223
|
-
return typeof t == "string" && this.isAbsolute() && this.#
|
|
3323
|
+
return typeof t == "string" && this.isAbsolute() && this.#i === 0 ? t : "";
|
|
3224
3324
|
}
|
|
3225
3325
|
checkFollowGlobstar() {
|
|
3226
|
-
return !(this.#
|
|
3326
|
+
return !(this.#i === 0 || !this.isGlobstar() || !this.#m);
|
|
3227
3327
|
}
|
|
3228
3328
|
markFollowGlobstar() {
|
|
3229
|
-
return this.#
|
|
3329
|
+
return this.#i === 0 || !this.isGlobstar() || !this.#m ? !1 : (this.#m = !1, !0);
|
|
3230
3330
|
}
|
|
3231
3331
|
};
|
|
3232
|
-
var
|
|
3233
|
-
var
|
|
3332
|
+
var wn = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
|
|
3333
|
+
var lt = class {
|
|
3234
3334
|
relative;
|
|
3235
3335
|
relativeChildren;
|
|
3236
3336
|
absolute;
|
|
@@ -3238,8 +3338,8 @@ var at = class {
|
|
|
3238
3338
|
platform;
|
|
3239
3339
|
mmopts;
|
|
3240
3340
|
slashRoot;
|
|
3241
|
-
constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: n, normalize: o, platform:
|
|
3242
|
-
this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform =
|
|
3341
|
+
constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: n, normalize: o, platform: h = wn, root: a, windowsPathsNoEscape: l, allowWindowsEscape: c }, f) {
|
|
3342
|
+
this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = h, l = !!l || c === !1, this.mmopts = {
|
|
3243
3343
|
dot: !0,
|
|
3244
3344
|
nobrace: e,
|
|
3245
3345
|
nocase: s,
|
|
@@ -3247,14 +3347,14 @@ var at = class {
|
|
|
3247
3347
|
noglobstar: n,
|
|
3248
3348
|
normalize: o,
|
|
3249
3349
|
optimizationLevel: 2,
|
|
3250
|
-
platform:
|
|
3350
|
+
platform: h,
|
|
3251
3351
|
nocomment: !0,
|
|
3252
3352
|
nonegate: !0,
|
|
3253
3353
|
windowsPathsNoEscape: l
|
|
3254
3354
|
};
|
|
3255
|
-
let
|
|
3256
|
-
this.slashRoot = K(
|
|
3257
|
-
for (let
|
|
3355
|
+
let u = f?.resolve(a ?? "/").fullpath() ?? "/";
|
|
3356
|
+
this.slashRoot = K(u.replace(/\\/g, "/").replace(/\/$/, ""), { windowsPathsNoEscape: l });
|
|
3357
|
+
for (let p of t) this.add(p);
|
|
3258
3358
|
}
|
|
3259
3359
|
add(t) {
|
|
3260
3360
|
let e = new D(t, this.mmopts);
|
|
@@ -3262,8 +3362,8 @@ var at = class {
|
|
|
3262
3362
|
let i = e.set[s], n = e.globParts[s];
|
|
3263
3363
|
if (!i || !n) throw new Error("invalid pattern object");
|
|
3264
3364
|
for (; i[0] === "." && n[0] === ".";) i.shift(), n.shift();
|
|
3265
|
-
let o = new
|
|
3266
|
-
c ? this.absolute.push(
|
|
3365
|
+
let o = new at(i, n, 0, this.platform), a = new D(o.root() === "/" ? `${this.slashRoot}/${o.rest()?.globString() ?? ""}` : o.globString(), this.mmopts), l = n[n.length - 1] === "**", c = o.isAbsolute();
|
|
3366
|
+
c ? this.absolute.push(a) : this.relative.push(a), l && (c ? this.absoluteChildren.push(a) : this.relativeChildren.push(a));
|
|
3267
3367
|
}
|
|
3268
3368
|
}
|
|
3269
3369
|
ignored(t) {
|
|
@@ -3279,7 +3379,7 @@ var at = class {
|
|
|
3279
3379
|
return !1;
|
|
3280
3380
|
}
|
|
3281
3381
|
};
|
|
3282
|
-
var
|
|
3382
|
+
var ze = class r {
|
|
3283
3383
|
parent;
|
|
3284
3384
|
store;
|
|
3285
3385
|
constructor(t) {
|
|
@@ -3300,7 +3400,7 @@ var Te = class r {
|
|
|
3300
3400
|
i ? i.add(e.globString()) : (this.store ??= new Map()).set(s, new Set([e.globString()]));
|
|
3301
3401
|
}
|
|
3302
3402
|
};
|
|
3303
|
-
var
|
|
3403
|
+
var Ot = class r {
|
|
3304
3404
|
static ABSOLUTE = 2;
|
|
3305
3405
|
static IF_DIR = 1;
|
|
3306
3406
|
store = new Map();
|
|
@@ -3309,7 +3409,7 @@ var Rt = class r {
|
|
|
3309
3409
|
this.store.set(t, n === void 0 ? i : i & n);
|
|
3310
3410
|
}
|
|
3311
3411
|
};
|
|
3312
|
-
var
|
|
3412
|
+
var Le = class {
|
|
3313
3413
|
store = new Map();
|
|
3314
3414
|
add(t, e) {
|
|
3315
3415
|
if (!t.canReaddir()) return;
|
|
@@ -3328,23 +3428,23 @@ var Fe = class {
|
|
|
3328
3428
|
return [...this.store.keys()].filter((t) => t.canReaddir());
|
|
3329
3429
|
}
|
|
3330
3430
|
};
|
|
3331
|
-
var
|
|
3431
|
+
var Ft = class r {
|
|
3332
3432
|
hasWalkedCache;
|
|
3333
|
-
matches = new
|
|
3334
|
-
subwalks = new
|
|
3433
|
+
matches = new Ot();
|
|
3434
|
+
subwalks = new Le();
|
|
3335
3435
|
patterns;
|
|
3336
3436
|
follow;
|
|
3337
3437
|
dot;
|
|
3338
3438
|
opts;
|
|
3339
3439
|
constructor(t, e) {
|
|
3340
|
-
this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new
|
|
3440
|
+
this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new ze();
|
|
3341
3441
|
}
|
|
3342
3442
|
processPatterns(t, e) {
|
|
3343
3443
|
this.patterns = e;
|
|
3344
3444
|
let s = e.map((i) => [t, i]);
|
|
3345
3445
|
for (let [i, n] of s) {
|
|
3346
3446
|
this.hasWalkedCache.storeWalked(i, n);
|
|
3347
|
-
let o = n.root(),
|
|
3447
|
+
let o = n.root(), h = n.isAbsolute() && this.opts.absolute !== !1;
|
|
3348
3448
|
if (o) {
|
|
3349
3449
|
i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
|
|
3350
3450
|
let f = n.rest();
|
|
@@ -3355,25 +3455,25 @@ var Ot = class r {
|
|
|
3355
3455
|
}
|
|
3356
3456
|
}
|
|
3357
3457
|
if (i.isENOENT()) continue;
|
|
3358
|
-
let
|
|
3359
|
-
for (; typeof (
|
|
3360
|
-
if (
|
|
3458
|
+
let a, l, c = !1;
|
|
3459
|
+
for (; typeof (a = n.pattern()) == "string" && (l = n.rest());) i = i.resolve(a), n = l, c = !0;
|
|
3460
|
+
if (a = n.pattern(), l = n.rest(), c) {
|
|
3361
3461
|
if (this.hasWalkedCache.hasWalked(i, n)) continue;
|
|
3362
3462
|
this.hasWalkedCache.storeWalked(i, n);
|
|
3363
3463
|
}
|
|
3364
|
-
if (typeof
|
|
3365
|
-
let f =
|
|
3366
|
-
this.matches.add(i.resolve(
|
|
3464
|
+
if (typeof a == "string") {
|
|
3465
|
+
let f = a === ".." || a === "" || a === ".";
|
|
3466
|
+
this.matches.add(i.resolve(a), h, f);
|
|
3367
3467
|
continue;
|
|
3368
|
-
} else if (
|
|
3468
|
+
} else if (a === v) {
|
|
3369
3469
|
(!i.isSymbolicLink() || this.follow || n.checkFollowGlobstar()) && this.subwalks.add(i, n);
|
|
3370
|
-
let f = l?.pattern(),
|
|
3371
|
-
if (!l || (f === "" || f === ".") && !
|
|
3470
|
+
let f = l?.pattern(), u = l?.rest();
|
|
3471
|
+
if (!l || (f === "" || f === ".") && !u) this.matches.add(i, h, f === "" || f === ".");
|
|
3372
3472
|
else if (f === "..") {
|
|
3373
|
-
let
|
|
3374
|
-
|
|
3473
|
+
let p = i.parent || i;
|
|
3474
|
+
u ? this.hasWalkedCache.hasWalked(p, u) || this.subwalks.add(p, u) : this.matches.add(p, h, !0);
|
|
3375
3475
|
}
|
|
3376
|
-
} else typeof
|
|
3476
|
+
} else typeof a == "object" && this.subwalks.add(i, n);
|
|
3377
3477
|
}
|
|
3378
3478
|
return this;
|
|
3379
3479
|
}
|
|
@@ -3386,8 +3486,8 @@ var Ot = class r {
|
|
|
3386
3486
|
filterEntries(t, e) {
|
|
3387
3487
|
let s = this.subwalks.get(t), i = this.child();
|
|
3388
3488
|
for (let n of e) for (let o of s) {
|
|
3389
|
-
let
|
|
3390
|
-
|
|
3489
|
+
let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
|
|
3490
|
+
a === v ? i.testGlobstar(n, o, l, h) : typeof a == "object" ? i.testMatcher(n, a, l, h) : i.testString(n, a, l, h);
|
|
3391
3491
|
}
|
|
3392
3492
|
return i;
|
|
3393
3493
|
}
|
|
@@ -3408,7 +3508,7 @@ var Ot = class r {
|
|
|
3408
3508
|
t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
|
|
3409
3509
|
}
|
|
3410
3510
|
};
|
|
3411
|
-
var { ABSOLUTE:
|
|
3511
|
+
var { ABSOLUTE: Zt, IF_DIR: Qt } = Ot, bn = (r, t, e) => typeof r == "string" ? new lt([r], t, e) : Array.isArray(r) ? new lt(r, t, e) : r, te = class {
|
|
3412
3512
|
path;
|
|
3413
3513
|
patterns;
|
|
3414
3514
|
opts;
|
|
@@ -3416,22 +3516,22 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3416
3516
|
paused = !1;
|
|
3417
3517
|
aborted = !1;
|
|
3418
3518
|
#t = [];
|
|
3519
|
+
#n;
|
|
3419
3520
|
#i;
|
|
3420
|
-
#e;
|
|
3421
3521
|
signal;
|
|
3422
3522
|
maxDepth;
|
|
3423
3523
|
includeChildMatches;
|
|
3424
3524
|
constructor(t, e, s) {
|
|
3425
|
-
if (this.patterns = t, this.path = e, this.opts = s, this.#
|
|
3525
|
+
if (this.patterns = t, this.path = e, this.opts = s, this.#i = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#n = bn(s.ignore ?? [], s, e), !this.includeChildMatches && typeof this.#n.add != "function")) throw new Error("cannot ignore child matches, ignore lacks add() method.");
|
|
3426
3526
|
this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
|
|
3427
3527
|
this.#t.length = 0;
|
|
3428
3528
|
}));
|
|
3429
3529
|
}
|
|
3430
3530
|
#o(t) {
|
|
3431
|
-
return this.seen.has(t) || !!this.#
|
|
3531
|
+
return this.seen.has(t) || !!this.#n?.ignored?.(t);
|
|
3432
3532
|
}
|
|
3433
3533
|
#r(t) {
|
|
3434
|
-
return !!this.#
|
|
3534
|
+
return !!this.#n?.childrenIgnored?.(t);
|
|
3435
3535
|
}
|
|
3436
3536
|
pause() {
|
|
3437
3537
|
this.paused = !0;
|
|
@@ -3454,8 +3554,8 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3454
3554
|
} else i = t;
|
|
3455
3555
|
let o = i.isUnknown() || this.opts.stat ? await i.lstat() : i;
|
|
3456
3556
|
if (this.opts.follow && this.opts.nodir && o?.isSymbolicLink()) {
|
|
3457
|
-
let
|
|
3458
|
-
|
|
3557
|
+
let h = await o.realpath();
|
|
3558
|
+
h && (h.isUnknown() || this.opts.stat) && await h.lstat();
|
|
3459
3559
|
}
|
|
3460
3560
|
return this.matchCheckTest(o, e);
|
|
3461
3561
|
}
|
|
@@ -3471,8 +3571,8 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3471
3571
|
} else i = t;
|
|
3472
3572
|
let o = i.isUnknown() || this.opts.stat ? i.lstatSync() : i;
|
|
3473
3573
|
if (this.opts.follow && this.opts.nodir && o?.isSymbolicLink()) {
|
|
3474
|
-
let
|
|
3475
|
-
|
|
3574
|
+
let h = o.realpathSync();
|
|
3575
|
+
h && (h?.isUnknown() || this.opts.stat) && h.lstatSync();
|
|
3476
3576
|
}
|
|
3477
3577
|
return this.matchCheckTest(o, e);
|
|
3478
3578
|
}
|
|
@@ -3480,19 +3580,19 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3480
3580
|
this.#o(t) || this.#d(t, e);
|
|
3481
3581
|
}
|
|
3482
3582
|
#d(t, e) {
|
|
3483
|
-
if (!this.includeChildMatches && this.#
|
|
3583
|
+
if (!this.includeChildMatches && this.#n?.add) {
|
|
3484
3584
|
let n = `${t.relativePosix()}/**`;
|
|
3485
|
-
this.#
|
|
3585
|
+
this.#n.add(n);
|
|
3486
3586
|
}
|
|
3487
3587
|
let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
|
|
3488
3588
|
this.seen.add(t);
|
|
3489
|
-
let i = this.opts.mark && t.isDirectory() ? this.#
|
|
3589
|
+
let i = this.opts.mark && t.isDirectory() ? this.#i : "";
|
|
3490
3590
|
if (this.opts.withFileTypes) this.matchEmit(t);
|
|
3491
3591
|
else if (s) {
|
|
3492
3592
|
let n = this.opts.posix ? t.fullpathPosix() : t.fullpath();
|
|
3493
3593
|
this.matchEmit(n + i);
|
|
3494
3594
|
} else {
|
|
3495
|
-
let n = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !n.startsWith(`..${this.#
|
|
3595
|
+
let n = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !n.startsWith(`..${this.#i}`) ? `.${this.#i}` : "";
|
|
3496
3596
|
this.matchEmit(n ? o + n + i : `.${i}`);
|
|
3497
3597
|
}
|
|
3498
3598
|
}
|
|
@@ -3506,7 +3606,7 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3506
3606
|
}
|
|
3507
3607
|
walkCB(t, e, s) {
|
|
3508
3608
|
if (this.signal?.aborted) return s();
|
|
3509
|
-
this.walkCB2(t, e, new
|
|
3609
|
+
this.walkCB2(t, e, new Ft(this.opts), s);
|
|
3510
3610
|
}
|
|
3511
3611
|
walkCB2(t, e, s, i) {
|
|
3512
3612
|
if (this.#r(t) || this.signal?.aborted) return i();
|
|
@@ -3518,26 +3618,26 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3518
3618
|
let n = 1, o = () => {
|
|
3519
3619
|
--n === 0 && i();
|
|
3520
3620
|
};
|
|
3521
|
-
for (let [
|
|
3522
|
-
for (let
|
|
3523
|
-
if (this.maxDepth !== 1 / 0 &&
|
|
3621
|
+
for (let [h, a] of s.matches.store) this.#o(h) || (n++, this.match(h, !!(a & Zt), !!(a & Qt)).then(() => o()));
|
|
3622
|
+
for (let h of s.subwalkTargets()) {
|
|
3623
|
+
if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
|
|
3524
3624
|
n++;
|
|
3525
|
-
let
|
|
3526
|
-
|
|
3625
|
+
let a = h.readdirCached();
|
|
3626
|
+
h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, c) => this.walkCB3(h, c, s, o), !0);
|
|
3527
3627
|
}
|
|
3528
3628
|
o();
|
|
3529
3629
|
}
|
|
3530
3630
|
walkCB3(t, e, s, i) {
|
|
3531
|
-
let n = s.filterEntries(t, e), o = 1,
|
|
3631
|
+
let n = s.filterEntries(t, e), o = 1, h = () => {
|
|
3532
3632
|
--o === 0 && i();
|
|
3533
3633
|
};
|
|
3534
|
-
for (let [
|
|
3535
|
-
for (let [
|
|
3536
|
-
|
|
3634
|
+
for (let [a, l] of n.matches.store) this.#o(a) || (o++, this.match(a, !!(l & Zt), !!(l & Qt)).then(() => h()));
|
|
3635
|
+
for (let [a, l] of n.subwalks.entries()) o++, this.walkCB2(a, l, n.child(), h);
|
|
3636
|
+
h();
|
|
3537
3637
|
}
|
|
3538
3638
|
walkCBSync(t, e, s) {
|
|
3539
3639
|
if (this.signal?.aborted) return s();
|
|
3540
|
-
this.walkCB2Sync(t, e, new
|
|
3640
|
+
this.walkCB2Sync(t, e, new Ft(this.opts), s);
|
|
3541
3641
|
}
|
|
3542
3642
|
walkCB2Sync(t, e, s, i) {
|
|
3543
3643
|
if (this.#r(t) || this.signal?.aborted) return i();
|
|
@@ -3549,24 +3649,24 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3549
3649
|
let n = 1, o = () => {
|
|
3550
3650
|
--n === 0 && i();
|
|
3551
3651
|
};
|
|
3552
|
-
for (let [
|
|
3553
|
-
for (let
|
|
3554
|
-
if (this.maxDepth !== 1 / 0 &&
|
|
3652
|
+
for (let [h, a] of s.matches.store) this.#o(h) || this.matchSync(h, !!(a & Zt), !!(a & Qt));
|
|
3653
|
+
for (let h of s.subwalkTargets()) {
|
|
3654
|
+
if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
|
|
3555
3655
|
n++;
|
|
3556
|
-
let
|
|
3557
|
-
this.walkCB3Sync(
|
|
3656
|
+
let a = h.readdirSync();
|
|
3657
|
+
this.walkCB3Sync(h, a, s, o);
|
|
3558
3658
|
}
|
|
3559
3659
|
o();
|
|
3560
3660
|
}
|
|
3561
3661
|
walkCB3Sync(t, e, s, i) {
|
|
3562
|
-
let n = s.filterEntries(t, e), o = 1,
|
|
3662
|
+
let n = s.filterEntries(t, e), o = 1, h = () => {
|
|
3563
3663
|
--o === 0 && i();
|
|
3564
3664
|
};
|
|
3565
|
-
for (let [
|
|
3566
|
-
for (let [
|
|
3567
|
-
|
|
3665
|
+
for (let [a, l] of n.matches.store) this.#o(a) || this.matchSync(a, !!(l & Zt), !!(l & Qt));
|
|
3666
|
+
for (let [a, l] of n.subwalks.entries()) o++, this.walkCB2Sync(a, l, n.child(), h);
|
|
3667
|
+
h();
|
|
3568
3668
|
}
|
|
3569
|
-
},
|
|
3669
|
+
}, Tt = class extends te {
|
|
3570
3670
|
matches = [];
|
|
3571
3671
|
constructor(t, e, s) {
|
|
3572
3672
|
super(t, e, s);
|
|
@@ -3588,10 +3688,10 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3588
3688
|
if (this.signal?.aborted) throw this.signal.reason;
|
|
3589
3689
|
}), this.matches;
|
|
3590
3690
|
}
|
|
3591
|
-
},
|
|
3691
|
+
}, _t = class extends te {
|
|
3592
3692
|
results;
|
|
3593
3693
|
constructor(t, e, s) {
|
|
3594
|
-
super(t, e, s), this.results = new
|
|
3694
|
+
super(t, e, s), this.results = new J({
|
|
3595
3695
|
signal: this.signal,
|
|
3596
3696
|
objectMode: !0
|
|
3597
3697
|
}), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
|
|
@@ -3609,7 +3709,7 @@ var { ABSOLUTE: Vt, IF_DIR: Yt } = Rt, rn = (r, t, e) => typeof r == "string" ?
|
|
|
3609
3709
|
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
|
|
3610
3710
|
}
|
|
3611
3711
|
};
|
|
3612
|
-
var
|
|
3712
|
+
var Sn = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
|
|
3613
3713
|
var j = class {
|
|
3614
3714
|
absolute;
|
|
3615
3715
|
cwd;
|
|
@@ -3646,13 +3746,13 @@ var j = class {
|
|
|
3646
3746
|
if (e.noglobstar) throw new TypeError("base matching requires globstar");
|
|
3647
3747
|
s = s.map((l) => l.includes("/") ? l : `./**/${l}`);
|
|
3648
3748
|
}
|
|
3649
|
-
if (this.pattern = s, this.platform = e.platform ||
|
|
3749
|
+
if (this.pattern = s, this.platform = e.platform || Sn, this.opts = {
|
|
3650
3750
|
...e,
|
|
3651
3751
|
platform: this.platform
|
|
3652
3752
|
}, e.scurry) {
|
|
3653
3753
|
if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
|
|
3654
3754
|
} else {
|
|
3655
|
-
let l = e.platform === "win32" ?
|
|
3755
|
+
let l = e.platform === "win32" ? ot : e.platform === "darwin" ? Rt : e.platform ? ht : _s;
|
|
3656
3756
|
this.scurry = new l(this.cwd, {
|
|
3657
3757
|
nocase: e.nocase,
|
|
3658
3758
|
fs: e.fs
|
|
@@ -3673,15 +3773,15 @@ var j = class {
|
|
|
3673
3773
|
optimizationLevel: 2,
|
|
3674
3774
|
platform: this.platform,
|
|
3675
3775
|
windowsPathsNoEscape: this.windowsPathsNoEscape
|
|
3676
|
-
}, [
|
|
3677
|
-
this.patterns =
|
|
3678
|
-
let f =
|
|
3776
|
+
}, [h, a] = this.pattern.map((l) => new D(l, n)).reduce((l, c) => (l[0].push(...c.set), l[1].push(...c.globParts), l), [[], []]);
|
|
3777
|
+
this.patterns = h.map((l, c) => {
|
|
3778
|
+
let f = a[c];
|
|
3679
3779
|
if (!f) throw new Error("invalid pattern object");
|
|
3680
|
-
return new
|
|
3780
|
+
return new at(l, f, 0, this.platform);
|
|
3681
3781
|
});
|
|
3682
3782
|
}
|
|
3683
3783
|
async walk() {
|
|
3684
|
-
return await new
|
|
3784
|
+
return await new Tt(this.patterns, this.scurry.cwd, {
|
|
3685
3785
|
...this.opts,
|
|
3686
3786
|
maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
|
|
3687
3787
|
platform: this.platform,
|
|
@@ -3690,7 +3790,7 @@ var j = class {
|
|
|
3690
3790
|
}).walk();
|
|
3691
3791
|
}
|
|
3692
3792
|
walkSync() {
|
|
3693
|
-
return new
|
|
3793
|
+
return new Tt(this.patterns, this.scurry.cwd, {
|
|
3694
3794
|
...this.opts,
|
|
3695
3795
|
maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
|
|
3696
3796
|
platform: this.platform,
|
|
@@ -3699,7 +3799,7 @@ var j = class {
|
|
|
3699
3799
|
}).walkSync();
|
|
3700
3800
|
}
|
|
3701
3801
|
stream() {
|
|
3702
|
-
return new
|
|
3802
|
+
return new _t(this.patterns, this.scurry.cwd, {
|
|
3703
3803
|
...this.opts,
|
|
3704
3804
|
maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
|
|
3705
3805
|
platform: this.platform,
|
|
@@ -3708,7 +3808,7 @@ var j = class {
|
|
|
3708
3808
|
}).stream();
|
|
3709
3809
|
}
|
|
3710
3810
|
streamSync() {
|
|
3711
|
-
return new
|
|
3811
|
+
return new _t(this.patterns, this.scurry.cwd, {
|
|
3712
3812
|
...this.opts,
|
|
3713
3813
|
maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
|
|
3714
3814
|
platform: this.platform,
|
|
@@ -3729,52 +3829,52 @@ var j = class {
|
|
|
3729
3829
|
return this.iterate();
|
|
3730
3830
|
}
|
|
3731
3831
|
};
|
|
3732
|
-
var
|
|
3832
|
+
var je = (r, t = {}) => {
|
|
3733
3833
|
for (let e of Array.isArray(r) ? r : [r]) if (new D(e, t).hasMagic()) return !0;
|
|
3734
3834
|
return !1;
|
|
3735
3835
|
};
|
|
3736
|
-
function
|
|
3836
|
+
function ee(r, t = {}) {
|
|
3737
3837
|
return new j(r, t).streamSync();
|
|
3738
3838
|
}
|
|
3739
|
-
function
|
|
3839
|
+
function Ps(r, t = {}) {
|
|
3740
3840
|
return new j(r, t).stream();
|
|
3741
3841
|
}
|
|
3742
|
-
function
|
|
3842
|
+
function zs(r, t = {}) {
|
|
3743
3843
|
return new j(r, t).walkSync();
|
|
3744
3844
|
}
|
|
3745
|
-
async function
|
|
3845
|
+
async function Ds(r, t = {}) {
|
|
3746
3846
|
return new j(r, t).walk();
|
|
3747
3847
|
}
|
|
3748
|
-
function
|
|
3848
|
+
function se(r, t = {}) {
|
|
3749
3849
|
return new j(r, t).iterateSync();
|
|
3750
3850
|
}
|
|
3751
|
-
function
|
|
3851
|
+
function Ls(r, t = {}) {
|
|
3752
3852
|
return new j(r, t).iterate();
|
|
3753
3853
|
}
|
|
3754
|
-
var
|
|
3755
|
-
var
|
|
3756
|
-
var
|
|
3757
|
-
var
|
|
3758
|
-
var
|
|
3759
|
-
stream:
|
|
3760
|
-
iterate:
|
|
3854
|
+
var xn = ee;
|
|
3855
|
+
var vn = Object.assign(Ps, { sync: ee });
|
|
3856
|
+
var En = se;
|
|
3857
|
+
var kn = Object.assign(Ls, { sync: se });
|
|
3858
|
+
var Cn = Object.assign(zs, {
|
|
3859
|
+
stream: ee,
|
|
3860
|
+
iterate: se
|
|
3761
3861
|
});
|
|
3762
|
-
var
|
|
3763
|
-
glob:
|
|
3764
|
-
globSync:
|
|
3765
|
-
sync:
|
|
3766
|
-
globStream:
|
|
3767
|
-
stream:
|
|
3768
|
-
globStreamSync:
|
|
3769
|
-
streamSync:
|
|
3770
|
-
globIterate:
|
|
3771
|
-
iterate:
|
|
3772
|
-
globIterateSync:
|
|
3773
|
-
iterateSync:
|
|
3862
|
+
var Ns = Object.assign(Ds, {
|
|
3863
|
+
glob: Ds,
|
|
3864
|
+
globSync: zs,
|
|
3865
|
+
sync: Cn,
|
|
3866
|
+
globStream: Ps,
|
|
3867
|
+
stream: vn,
|
|
3868
|
+
globStreamSync: ee,
|
|
3869
|
+
streamSync: xn,
|
|
3870
|
+
globIterate: Ls,
|
|
3871
|
+
iterate: kn,
|
|
3872
|
+
globIterateSync: se,
|
|
3873
|
+
iterateSync: En,
|
|
3774
3874
|
Glob: j,
|
|
3775
|
-
hasMagic:
|
|
3875
|
+
hasMagic: je,
|
|
3776
3876
|
escape: K,
|
|
3777
3877
|
unescape: st
|
|
3778
3878
|
});
|
|
3779
|
-
|
|
3780
|
-
export { j as Glob,
|
|
3879
|
+
Ns.glob = Ns;
|
|
3880
|
+
export { j as Glob, lt as Ignore, K as escape, Ns as glob, Ls as globIterate, se as globIterateSync, Ps as globStream, ee as globStreamSync, zs as globSync, je as hasMagic, kn as iterate, En as iterateSync, vn as stream, xn as streamSync, Cn as sync, st as unescape };
|