@opendesign-plus-test/plugins 0.0.1-rc.12 → 0.0.1-rc.13
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/index.js +1469 -99
- package/package.json +1 -1
- package/dist/generate-lastmod-changefreq-Wk3kOITw.js +0 -1375
- package/dist/nuxt/sitemap/index.js +0 -70
- package/dist/nuxt/sitemap.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var Yt = Object.defineProperty;
|
|
2
|
+
var Et = (n) => {
|
|
3
|
+
throw TypeError(n);
|
|
4
|
+
};
|
|
5
|
+
var Xt = (n, t, e) => t in n ? Yt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
6
|
+
var k = (n, t, e) => Xt(n, typeof t != "symbol" ? t + "" : t, e), at = (n, t, e) => t.has(n) || Et("Cannot " + e);
|
|
7
|
+
var c = (n, t, e) => (at(n, t, "read from private field"), e ? e.call(n) : t.get(n)), R = (n, t, e) => t.has(n) ? Et("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), b = (n, t, e, s) => (at(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), v = (n, t, e) => (at(n, t, "access private method"), e);
|
|
8
|
+
var ht = (n, t, e, s) => ({
|
|
9
|
+
set _(i) {
|
|
10
|
+
b(n, t, i, e);
|
|
11
|
+
},
|
|
12
|
+
get _() {
|
|
13
|
+
return c(n, t, s);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
import { i as js, o as Ds, v as Ps } from "./plugin-lvjNLBe-.js";
|
|
17
|
+
import Qt, { resolve as te } from "node:path";
|
|
18
|
+
import { exec as ee } from "node:child_process";
|
|
19
|
+
import { writeFileSync as se } from "node:fs";
|
|
20
|
+
import { promisify as ne } from "node:util";
|
|
21
|
+
const Z = {}, ie = `
|
|
4
22
|
(function () {
|
|
5
23
|
function getCookie(key) {
|
|
6
24
|
const name = encodeURIComponent(key) + '=';
|
|
@@ -26,93 +44,93 @@ const f = {}, $ = `
|
|
|
26
44
|
}
|
|
27
45
|
})();
|
|
28
46
|
`.trim();
|
|
29
|
-
function
|
|
47
|
+
function ks(n) {
|
|
30
48
|
const {
|
|
31
|
-
cookieKey:
|
|
32
|
-
lightValue:
|
|
33
|
-
darkValue:
|
|
34
|
-
attribute:
|
|
35
|
-
attributeLightValue:
|
|
36
|
-
attributeDarkValue:
|
|
37
|
-
classLightValue:
|
|
38
|
-
classDarkValue: p =
|
|
39
|
-
filename:
|
|
40
|
-
} =
|
|
41
|
-
let
|
|
49
|
+
cookieKey: t,
|
|
50
|
+
lightValue: e = "light",
|
|
51
|
+
darkValue: s = "dark",
|
|
52
|
+
attribute: i = "data-o-theme",
|
|
53
|
+
attributeLightValue: r = e,
|
|
54
|
+
attributeDarkValue: o = s,
|
|
55
|
+
classLightValue: u = e,
|
|
56
|
+
classDarkValue: p = s,
|
|
57
|
+
filename: a = "check-theme.js"
|
|
58
|
+
} = n, h = ie.replace(/\$COOKIE_KEY/g, t).replace(/\$LIGHT_VALUE/g, e).replace(/\$DARK_VALUE/g, s).replace(/\$CLASS_LIGHT_VALUE/g, u).replace(/\$CLASS_DARK_VALUE/g, p).replace(/\$ATTRIBUTE_NAME/g, i).replace(/\$ATTRIBUTE_LIGHT_VALUE/g, r).replace(/\$ATTRIBUTE_DARK_VALUE/g, o);
|
|
59
|
+
let l = "", f = !1, d = "", g = !1;
|
|
42
60
|
return {
|
|
43
61
|
name: "vite-check-theme-plugin",
|
|
44
62
|
enforce: "pre",
|
|
45
|
-
configResolved(
|
|
46
|
-
if (
|
|
63
|
+
configResolved(y) {
|
|
64
|
+
if (l = y.base, f = y.command === "serve", d = y.build.outDir, g = !!y.vitepress, !g || !Array.isArray(y.vitepress.site.head))
|
|
47
65
|
return;
|
|
48
|
-
const
|
|
49
|
-
var
|
|
50
|
-
return
|
|
66
|
+
const x = y.vitepress.site.head.find((E) => {
|
|
67
|
+
var S, m;
|
|
68
|
+
return E[0] === "script" && ((m = (S = E[1]) == null ? void 0 : S.src) == null ? void 0 : m.startsWith(`${l}${a}`));
|
|
51
69
|
});
|
|
52
|
-
|
|
70
|
+
x ? x[1].src = `${l}${a}?t=${(/* @__PURE__ */ new Date()).getTime()}` : y.vitepress.site.head.push([
|
|
53
71
|
"script",
|
|
54
72
|
{
|
|
55
|
-
src: `${
|
|
73
|
+
src: `${l}${a}?t=${(/* @__PURE__ */ new Date()).getTime()}`
|
|
56
74
|
}
|
|
57
75
|
]);
|
|
58
76
|
},
|
|
59
77
|
generateBundle() {
|
|
60
|
-
|
|
78
|
+
f || Z.existsSync(Z.join(d, a)) || (Z.existsSync(d) || Z.mkdirSync(d, { recursive: !0 }), Z.writeFileSync(Z.join(d, a), h, "utf-8"));
|
|
61
79
|
},
|
|
62
|
-
configureServer(
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
configureServer(y) {
|
|
81
|
+
y.middlewares.use(`${l}${a}`, (x, E) => {
|
|
82
|
+
E.setHeader("Content-Type", "application/javascript"), E.end(h);
|
|
65
83
|
});
|
|
66
84
|
},
|
|
67
|
-
transformIndexHtml(
|
|
68
|
-
return
|
|
85
|
+
transformIndexHtml(y) {
|
|
86
|
+
return g ? y : y.replace("</head>", `<script src="${l}${a}?t=${(/* @__PURE__ */ new Date()).getTime()}"><\/script></head>`);
|
|
69
87
|
}
|
|
70
88
|
};
|
|
71
89
|
}
|
|
72
|
-
function
|
|
90
|
+
function Rt(n) {
|
|
73
91
|
if (typeof window > "u")
|
|
74
92
|
return !1;
|
|
75
|
-
let
|
|
93
|
+
let t;
|
|
76
94
|
try {
|
|
77
|
-
|
|
95
|
+
t = new URL(n, window.location.href);
|
|
78
96
|
} catch {
|
|
79
97
|
return !1;
|
|
80
98
|
}
|
|
81
|
-
return /^https?:$/.test(
|
|
99
|
+
return /^https?:$/.test(t.protocol) ? t.hostname !== window.location.hostname : !1;
|
|
82
100
|
}
|
|
83
|
-
function
|
|
84
|
-
return
|
|
85
|
-
if (
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
88
|
-
return
|
|
89
|
-
}
|
|
90
|
-
return
|
|
101
|
+
function Nt(n, t = []) {
|
|
102
|
+
return t.some((e) => {
|
|
103
|
+
if (e === "*") return !0;
|
|
104
|
+
if (e.startsWith("*.")) {
|
|
105
|
+
const s = e.slice(2);
|
|
106
|
+
return n === s || n.endsWith(`.${s}`);
|
|
107
|
+
}
|
|
108
|
+
return n === e || n.endsWith(`.${e}`);
|
|
91
109
|
});
|
|
92
110
|
}
|
|
93
|
-
const
|
|
111
|
+
const re = {
|
|
94
112
|
zh: {
|
|
95
113
|
title: "即将跳转到外部网站",
|
|
96
|
-
message: (
|
|
114
|
+
message: (n) => `您将要访问的链接不属于${n},请关注您的账号安全。`,
|
|
97
115
|
cancel: "取消",
|
|
98
116
|
confirm: "继续前往"
|
|
99
117
|
},
|
|
100
118
|
en: {
|
|
101
119
|
title: "You will be redirected to an external website",
|
|
102
|
-
message: (
|
|
120
|
+
message: (n) => `The link you are about to visit does not belong to ${n}. Please ensure the security of your account.`,
|
|
103
121
|
cancel: "Cancel",
|
|
104
122
|
confirm: "Continue"
|
|
105
123
|
}
|
|
106
124
|
};
|
|
107
|
-
let
|
|
108
|
-
function
|
|
109
|
-
const
|
|
110
|
-
return new Promise((
|
|
111
|
-
if (
|
|
112
|
-
|
|
125
|
+
let L = null, ut = !1;
|
|
126
|
+
function oe(n, t, e) {
|
|
127
|
+
const s = re[n];
|
|
128
|
+
return new Promise((i) => {
|
|
129
|
+
if (ut) {
|
|
130
|
+
i(!1);
|
|
113
131
|
return;
|
|
114
132
|
}
|
|
115
|
-
|
|
133
|
+
ut = !0, ce(), L || (L = document.createElement("div"), L.className = "elg-mask", L.innerHTML = `
|
|
116
134
|
<div class="elg-modal">
|
|
117
135
|
<div class="elg-title"></div>
|
|
118
136
|
<div class="elg-content">
|
|
@@ -121,26 +139,26 @@ function C(e, n, t) {
|
|
|
121
139
|
</div>
|
|
122
140
|
|
|
123
141
|
<div class="elg-actions">
|
|
124
|
-
<button class="elg-btn elg-confirm">${
|
|
125
|
-
<button class="elg-btn elg-cancel">${
|
|
142
|
+
<button class="elg-btn elg-confirm">${s.confirm}</button>
|
|
143
|
+
<button class="elg-btn elg-cancel">${s.cancel}</button>
|
|
126
144
|
</div>
|
|
127
145
|
</div>
|
|
128
|
-
`, document.body.appendChild(
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
|
|
146
|
+
`, document.body.appendChild(L));
|
|
147
|
+
const r = L.querySelector(".elg-title"), o = L.querySelector(".elg-message"), u = L.querySelector(".elg-url"), p = L.querySelector(".elg-cancel"), a = L.querySelector(".elg-confirm");
|
|
148
|
+
r.textContent = s.title, o.textContent = s.message(e), u.textContent = t, L.style.display = "flex";
|
|
149
|
+
const h = (g) => {
|
|
150
|
+
L && (L.style.display = "none", L.removeEventListener("click", d), p.removeEventListener("click", l), a.removeEventListener("click", f), ut = !1, i(g));
|
|
151
|
+
}, l = () => h(!1), f = () => h(!0), d = (g) => {
|
|
152
|
+
g.target === L && h(!1);
|
|
135
153
|
};
|
|
136
|
-
|
|
154
|
+
L.addEventListener("click", d), p.addEventListener("click", l), a.addEventListener("click", f);
|
|
137
155
|
});
|
|
138
156
|
}
|
|
139
|
-
function
|
|
157
|
+
function ce() {
|
|
140
158
|
if (document.getElementById("elg-confirm-style"))
|
|
141
159
|
return;
|
|
142
|
-
const
|
|
143
|
-
|
|
160
|
+
const n = document.createElement("style");
|
|
161
|
+
n.id = "elg-confirm-style", n.textContent = `
|
|
144
162
|
:root {
|
|
145
163
|
--elg-primary: var(--o-color-primary1);
|
|
146
164
|
--elg-text: var(--o-color-info1);
|
|
@@ -252,64 +270,1416 @@ function _() {
|
|
|
252
270
|
background: rgba(81, 119, 202)
|
|
253
271
|
}
|
|
254
272
|
}
|
|
255
|
-
`, document.head.appendChild(
|
|
273
|
+
`, document.head.appendChild(n);
|
|
256
274
|
}
|
|
257
|
-
async function
|
|
258
|
-
if (
|
|
259
|
-
return
|
|
260
|
-
const
|
|
275
|
+
async function Ot(n, t) {
|
|
276
|
+
if (t.showCustomConfirm)
|
|
277
|
+
return oe(t.lang || "zh", n, t.community || "");
|
|
278
|
+
const e = t.message ?? `即将离开本站,前往第三方网站:
|
|
261
279
|
|
|
262
|
-
${
|
|
263
|
-
return Promise.resolve(window.confirm(
|
|
280
|
+
${n}`;
|
|
281
|
+
return Promise.resolve(window.confirm(e));
|
|
264
282
|
}
|
|
265
|
-
function
|
|
266
|
-
const
|
|
283
|
+
function le(n) {
|
|
284
|
+
const t = window.open;
|
|
267
285
|
document.addEventListener(
|
|
268
286
|
"click",
|
|
269
|
-
async (
|
|
270
|
-
const
|
|
271
|
-
if (!
|
|
287
|
+
async (e) => {
|
|
288
|
+
const s = e.target;
|
|
289
|
+
if (!s)
|
|
272
290
|
return;
|
|
273
|
-
const
|
|
274
|
-
if (!
|
|
291
|
+
const i = s.closest("a[href]");
|
|
292
|
+
if (!i)
|
|
275
293
|
return;
|
|
276
|
-
const
|
|
277
|
-
if (!
|
|
294
|
+
const r = i.getAttribute("href");
|
|
295
|
+
if (!r || r.startsWith("#") || !Rt(r))
|
|
278
296
|
return;
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
297
|
+
const o = new URL(r, window.location.href);
|
|
298
|
+
if (Nt(o.hostname, n.whitelist))
|
|
281
299
|
return;
|
|
282
|
-
|
|
300
|
+
e.preventDefault(), await Ot(o.href, n) && ((i.getAttribute("target") || "_self") === "_blank" ? t.call(window, o.href, "_blank", "noopener,noreferrer") : window.location.href = o.href);
|
|
283
301
|
},
|
|
284
302
|
!0
|
|
285
303
|
);
|
|
286
304
|
}
|
|
287
|
-
function
|
|
288
|
-
const
|
|
289
|
-
window.open = async function(
|
|
290
|
-
if (
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
294
|
-
if (!
|
|
305
|
+
function ae(n) {
|
|
306
|
+
const t = window.open;
|
|
307
|
+
window.open = async function(e, ...s) {
|
|
308
|
+
if (e) {
|
|
309
|
+
const i = e.toString();
|
|
310
|
+
if (Rt(i)) {
|
|
311
|
+
const r = new URL(i, window.location.href);
|
|
312
|
+
if (!Nt(r.hostname, n.whitelist) && !await Ot(r.href, n))
|
|
295
313
|
return null;
|
|
296
314
|
}
|
|
297
315
|
}
|
|
298
|
-
return
|
|
316
|
+
return t.call(window, e, ...s);
|
|
299
317
|
};
|
|
300
318
|
}
|
|
301
|
-
function
|
|
319
|
+
function Cs(n = {}) {
|
|
302
320
|
return {
|
|
303
321
|
install() {
|
|
304
|
-
typeof window > "u" || (
|
|
322
|
+
typeof window > "u" || (le(n), ae(n));
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
const Lt = (n, t, e) => {
|
|
327
|
+
const s = n instanceof RegExp ? bt(n, e) : n, i = t instanceof RegExp ? bt(t, e) : t, r = s !== null && i != null && he(s, i, e);
|
|
328
|
+
return r && {
|
|
329
|
+
start: r[0],
|
|
330
|
+
end: r[1],
|
|
331
|
+
pre: e.slice(0, r[0]),
|
|
332
|
+
body: e.slice(r[0] + s.length, r[1]),
|
|
333
|
+
post: e.slice(r[1] + i.length)
|
|
334
|
+
};
|
|
335
|
+
}, bt = (n, t) => {
|
|
336
|
+
const e = t.match(n);
|
|
337
|
+
return e ? e[0] : null;
|
|
338
|
+
}, he = (n, t, e) => {
|
|
339
|
+
let s, i, r, o, u, p = e.indexOf(n), a = e.indexOf(t, p + 1), h = p;
|
|
340
|
+
if (p >= 0 && a > 0) {
|
|
341
|
+
if (n === t)
|
|
342
|
+
return [p, a];
|
|
343
|
+
for (s = [], r = e.length; h >= 0 && !u; ) {
|
|
344
|
+
if (h === p)
|
|
345
|
+
s.push(h), p = e.indexOf(n, h + 1);
|
|
346
|
+
else if (s.length === 1) {
|
|
347
|
+
const l = s.pop();
|
|
348
|
+
l !== void 0 && (u = [l, a]);
|
|
349
|
+
} else
|
|
350
|
+
i = s.pop(), i !== void 0 && i < r && (r = i, o = a), a = e.indexOf(t, h + 1);
|
|
351
|
+
h = p < a && p >= 0 ? p : a;
|
|
352
|
+
}
|
|
353
|
+
s.length && o !== void 0 && (u = [r, o]);
|
|
354
|
+
}
|
|
355
|
+
return u;
|
|
356
|
+
}, _t = "\0SLASH" + Math.random() + "\0", jt = "\0OPEN" + Math.random() + "\0", wt = "\0CLOSE" + Math.random() + "\0", Dt = "\0COMMA" + Math.random() + "\0", Pt = "\0PERIOD" + Math.random() + "\0", ue = new RegExp(_t, "g"), fe = new RegExp(jt, "g"), pe = new RegExp(wt, "g"), de = new RegExp(Dt, "g"), ge = new RegExp(Pt, "g"), me = /\\\\/g, ye = /\\{/g, we = /\\}/g, xe = /\\,/g, Ee = /\\\./g, be = 1e5;
|
|
357
|
+
function ft(n) {
|
|
358
|
+
return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
|
|
359
|
+
}
|
|
360
|
+
function Se(n) {
|
|
361
|
+
return n.replace(me, _t).replace(ye, jt).replace(we, wt).replace(xe, Dt).replace(Ee, Pt);
|
|
362
|
+
}
|
|
363
|
+
function ve(n) {
|
|
364
|
+
return n.replace(ue, "\\").replace(fe, "{").replace(pe, "}").replace(de, ",").replace(ge, ".");
|
|
365
|
+
}
|
|
366
|
+
function Wt(n) {
|
|
367
|
+
if (!n)
|
|
368
|
+
return [""];
|
|
369
|
+
const t = [], e = Lt("{", "}", n);
|
|
370
|
+
if (!e)
|
|
371
|
+
return n.split(",");
|
|
372
|
+
const { pre: s, body: i, post: r } = e, o = s.split(",");
|
|
373
|
+
o[o.length - 1] += "{" + i + "}";
|
|
374
|
+
const u = Wt(r);
|
|
375
|
+
return r.length && (o[o.length - 1] += u.shift(), o.push.apply(o, u)), t.push.apply(t, o), t;
|
|
376
|
+
}
|
|
377
|
+
function Ae(n, t = {}) {
|
|
378
|
+
if (!n)
|
|
379
|
+
return [];
|
|
380
|
+
const { max: e = be } = t;
|
|
381
|
+
return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), tt(Se(n), e, !0).map(ve);
|
|
382
|
+
}
|
|
383
|
+
function $e(n) {
|
|
384
|
+
return "{" + n + "}";
|
|
385
|
+
}
|
|
386
|
+
function Te(n) {
|
|
387
|
+
return /^-?0\d/.test(n);
|
|
388
|
+
}
|
|
389
|
+
function Me(n, t) {
|
|
390
|
+
return n <= t;
|
|
391
|
+
}
|
|
392
|
+
function ke(n, t) {
|
|
393
|
+
return n >= t;
|
|
394
|
+
}
|
|
395
|
+
function tt(n, t, e) {
|
|
396
|
+
const s = [], i = Lt("{", "}", n);
|
|
397
|
+
if (!i)
|
|
398
|
+
return [n];
|
|
399
|
+
const r = i.pre, o = i.post.length ? tt(i.post, t, !1) : [""];
|
|
400
|
+
if (/\$$/.test(i.pre))
|
|
401
|
+
for (let u = 0; u < o.length && u < t; u++) {
|
|
402
|
+
const p = r + "{" + i.body + "}" + o[u];
|
|
403
|
+
s.push(p);
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
const u = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), p = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), a = u || p, h = i.body.indexOf(",") >= 0;
|
|
407
|
+
if (!a && !h)
|
|
408
|
+
return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + wt + i.post, tt(n, t, !0)) : [n];
|
|
409
|
+
let l;
|
|
410
|
+
if (a)
|
|
411
|
+
l = i.body.split(/\.\./);
|
|
412
|
+
else if (l = Wt(i.body), l.length === 1 && l[0] !== void 0 && (l = tt(l[0], t, !1).map($e), l.length === 1))
|
|
413
|
+
return o.map((d) => i.pre + l[0] + d);
|
|
414
|
+
let f;
|
|
415
|
+
if (a && l[0] !== void 0 && l[1] !== void 0) {
|
|
416
|
+
const d = ft(l[0]), g = ft(l[1]), y = Math.max(l[0].length, l[1].length);
|
|
417
|
+
let x = l.length === 3 && l[2] !== void 0 ? Math.max(Math.abs(ft(l[2])), 1) : 1, E = Me;
|
|
418
|
+
g < d && (x *= -1, E = ke);
|
|
419
|
+
const m = l.some(Te);
|
|
420
|
+
f = [];
|
|
421
|
+
for (let T = d; E(T, g); T += x) {
|
|
422
|
+
let $;
|
|
423
|
+
if (p)
|
|
424
|
+
$ = String.fromCharCode(T), $ === "\\" && ($ = "");
|
|
425
|
+
else if ($ = String(T), m) {
|
|
426
|
+
const K = y - $.length;
|
|
427
|
+
if (K > 0) {
|
|
428
|
+
const X = new Array(K + 1).join("0");
|
|
429
|
+
T < 0 ? $ = "-" + X + $.slice(1) : $ = X + $;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
f.push($);
|
|
433
|
+
}
|
|
434
|
+
} else {
|
|
435
|
+
f = [];
|
|
436
|
+
for (let d = 0; d < l.length; d++)
|
|
437
|
+
f.push.apply(f, tt(l[d], t, !1));
|
|
438
|
+
}
|
|
439
|
+
for (let d = 0; d < f.length; d++)
|
|
440
|
+
for (let g = 0; g < o.length && s.length < t; g++) {
|
|
441
|
+
const y = r + f[d] + o[g];
|
|
442
|
+
(!e || a || y) && s.push(y);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return s;
|
|
446
|
+
}
|
|
447
|
+
const Ce = 1024 * 64, ot = (n) => {
|
|
448
|
+
if (typeof n != "string")
|
|
449
|
+
throw new TypeError("invalid pattern");
|
|
450
|
+
if (n.length > Ce)
|
|
451
|
+
throw new TypeError("pattern is too long");
|
|
452
|
+
}, Re = {
|
|
453
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
454
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
455
|
+
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
456
|
+
"[:blank:]": ["\\p{Zs}\\t", !0],
|
|
457
|
+
"[:cntrl:]": ["\\p{Cc}", !0],
|
|
458
|
+
"[:digit:]": ["\\p{Nd}", !0],
|
|
459
|
+
"[:graph:]": ["\\p{Z}\\p{C}", !0, !0],
|
|
460
|
+
"[:lower:]": ["\\p{Ll}", !0],
|
|
461
|
+
"[:print:]": ["\\p{C}", !0],
|
|
462
|
+
"[:punct:]": ["\\p{P}", !0],
|
|
463
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
|
|
464
|
+
"[:upper:]": ["\\p{Lu}", !0],
|
|
465
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
466
|
+
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
467
|
+
}, Q = (n) => n.replace(/[[\]\\-]/g, "\\$&"), Ne = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), St = (n) => n.join(""), Oe = (n, t) => {
|
|
468
|
+
const e = t;
|
|
469
|
+
if (n.charAt(e) !== "[")
|
|
470
|
+
throw new Error("not in a brace expression");
|
|
471
|
+
const s = [], i = [];
|
|
472
|
+
let r = e + 1, o = !1, u = !1, p = !1, a = !1, h = e, l = "";
|
|
473
|
+
t: for (; r < n.length; ) {
|
|
474
|
+
const y = n.charAt(r);
|
|
475
|
+
if ((y === "!" || y === "^") && r === e + 1) {
|
|
476
|
+
a = !0, r++;
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
if (y === "]" && o && !p) {
|
|
480
|
+
h = r + 1;
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
if (o = !0, y === "\\" && !p) {
|
|
484
|
+
p = !0, r++;
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
if (y === "[" && !p) {
|
|
488
|
+
for (const [x, [E, S, m]] of Object.entries(Re))
|
|
489
|
+
if (n.startsWith(x, r)) {
|
|
490
|
+
if (l)
|
|
491
|
+
return ["$.", !1, n.length - e, !0];
|
|
492
|
+
r += x.length, m ? i.push(E) : s.push(E), u = u || S;
|
|
493
|
+
continue t;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (p = !1, l) {
|
|
497
|
+
y > l ? s.push(Q(l) + "-" + Q(y)) : y === l && s.push(Q(y)), l = "", r++;
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
if (n.startsWith("-]", r + 1)) {
|
|
501
|
+
s.push(Q(y + "-")), r += 2;
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
if (n.startsWith("-", r + 1)) {
|
|
505
|
+
l = y, r += 2;
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
s.push(Q(y)), r++;
|
|
509
|
+
}
|
|
510
|
+
if (h < r)
|
|
511
|
+
return ["", !1, 0, !1];
|
|
512
|
+
if (!s.length && !i.length)
|
|
513
|
+
return ["$.", !1, n.length - e, !0];
|
|
514
|
+
if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !a) {
|
|
515
|
+
const y = s[0].length === 2 ? s[0].slice(-1) : s[0];
|
|
516
|
+
return [Ne(y), !1, h - e, !1];
|
|
517
|
+
}
|
|
518
|
+
const f = "[" + (a ? "^" : "") + St(s) + "]", d = "[" + (a ? "" : "^") + St(i) + "]";
|
|
519
|
+
return [s.length && i.length ? "(" + f + "|" + d + ")" : s.length ? f : d, u, h - e, !0];
|
|
520
|
+
}, et = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? n.replace(/\[([^/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1") : t ? n.replace(/\[([^/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
|
|
521
|
+
var j;
|
|
522
|
+
const Le = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), pt = (n) => Le.has(n), vt = (n) => pt(n.type), _e = /* @__PURE__ */ new Map([
|
|
523
|
+
["!", ["@"]],
|
|
524
|
+
["?", ["?", "@"]],
|
|
525
|
+
["@", ["@"]],
|
|
526
|
+
["*", ["*", "+", "?", "@"]],
|
|
527
|
+
["+", ["+", "@"]]
|
|
528
|
+
]), je = /* @__PURE__ */ new Map([
|
|
529
|
+
["!", ["?"]],
|
|
530
|
+
["@", ["?"]],
|
|
531
|
+
["+", ["?", "*"]]
|
|
532
|
+
]), De = /* @__PURE__ */ new Map([
|
|
533
|
+
["!", ["?", "@"]],
|
|
534
|
+
["?", ["?", "@"]],
|
|
535
|
+
["@", ["?", "@"]],
|
|
536
|
+
["*", ["*", "+", "?", "@"]],
|
|
537
|
+
["+", ["+", "@", "?", "*"]]
|
|
538
|
+
]), At = /* @__PURE__ */ new Map([
|
|
539
|
+
["!", /* @__PURE__ */ new Map([["!", "@"]])],
|
|
540
|
+
[
|
|
541
|
+
"?",
|
|
542
|
+
/* @__PURE__ */ new Map([
|
|
543
|
+
["*", "*"],
|
|
544
|
+
["+", "*"]
|
|
545
|
+
])
|
|
546
|
+
],
|
|
547
|
+
[
|
|
548
|
+
"@",
|
|
549
|
+
/* @__PURE__ */ new Map([
|
|
550
|
+
["!", "!"],
|
|
551
|
+
["?", "?"],
|
|
552
|
+
["@", "@"],
|
|
553
|
+
["*", "*"],
|
|
554
|
+
["+", "+"]
|
|
555
|
+
])
|
|
556
|
+
],
|
|
557
|
+
[
|
|
558
|
+
"+",
|
|
559
|
+
/* @__PURE__ */ new Map([
|
|
560
|
+
["?", "*"],
|
|
561
|
+
["*", "*"]
|
|
562
|
+
])
|
|
563
|
+
]
|
|
564
|
+
]), Pe = "(?!(?:^|/)\\.\\.?(?:$|/))", st = "(?!\\.)", We = /* @__PURE__ */ new Set(["[", "."]), ze = /* @__PURE__ */ new Set(["..", "."]), Ue = new Set("().*{}+?[]^$\\!"), qe = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), xt = "[^/]", $t = xt + "*?", Tt = xt + "+?";
|
|
565
|
+
let Ie = 0;
|
|
566
|
+
var C, N, q, w, M, I, F, G, z, U, Y, A, zt, V, nt, Ut, dt, it, qt, gt, It, Gt, Bt, rt, mt, Vt;
|
|
567
|
+
class ct {
|
|
568
|
+
constructor(t, e, s = {}) {
|
|
569
|
+
R(this, A);
|
|
570
|
+
k(this, "type");
|
|
571
|
+
R(this, C);
|
|
572
|
+
R(this, N);
|
|
573
|
+
R(this, q, !1);
|
|
574
|
+
R(this, w, []);
|
|
575
|
+
R(this, M);
|
|
576
|
+
R(this, I);
|
|
577
|
+
R(this, F);
|
|
578
|
+
R(this, G, !1);
|
|
579
|
+
R(this, z);
|
|
580
|
+
R(this, U);
|
|
581
|
+
// set to true if it's an extglob with no children
|
|
582
|
+
// (which really means one child of '')
|
|
583
|
+
R(this, Y, !1);
|
|
584
|
+
k(this, "id", ++Ie);
|
|
585
|
+
this.type = t, t && b(this, N, !0), b(this, M, e), b(this, C, c(this, M) ? c(c(this, M), C) : this), b(this, z, c(this, C) === this ? s : c(c(this, C), z)), b(this, F, c(this, C) === this ? [] : c(c(this, C), F)), t === "!" && !c(c(this, C), G) && c(this, F).push(this), b(this, I, c(this, M) ? c(c(this, M), w).length : 0);
|
|
586
|
+
}
|
|
587
|
+
get depth() {
|
|
588
|
+
var t;
|
|
589
|
+
return (((t = c(this, M)) == null ? void 0 : t.depth) ?? -1) + 1;
|
|
590
|
+
}
|
|
591
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
592
|
+
var t;
|
|
593
|
+
return {
|
|
594
|
+
"@@type": "AST",
|
|
595
|
+
id: this.id,
|
|
596
|
+
type: this.type,
|
|
597
|
+
root: c(this, C).id,
|
|
598
|
+
parent: (t = c(this, M)) == null ? void 0 : t.id,
|
|
599
|
+
depth: this.depth,
|
|
600
|
+
partsLength: c(this, w).length,
|
|
601
|
+
parts: c(this, w)
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
get hasMagic() {
|
|
605
|
+
if (c(this, N) !== void 0)
|
|
606
|
+
return c(this, N);
|
|
607
|
+
for (const t of c(this, w))
|
|
608
|
+
if (typeof t != "string" && (t.type || t.hasMagic))
|
|
609
|
+
return b(this, N, !0);
|
|
610
|
+
return c(this, N);
|
|
611
|
+
}
|
|
612
|
+
// reconstructs the pattern
|
|
613
|
+
toString() {
|
|
614
|
+
return c(this, U) !== void 0 ? c(this, U) : this.type ? b(this, U, this.type + "(" + c(this, w).map((t) => String(t)).join("|") + ")") : b(this, U, c(this, w).map((t) => String(t)).join(""));
|
|
615
|
+
}
|
|
616
|
+
push(...t) {
|
|
617
|
+
for (const e of t)
|
|
618
|
+
if (e !== "") {
|
|
619
|
+
if (typeof e != "string" && !(e instanceof j && c(e, M) === this))
|
|
620
|
+
throw new Error("invalid part: " + e);
|
|
621
|
+
c(this, w).push(e);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
toJSON() {
|
|
625
|
+
var e;
|
|
626
|
+
const t = this.type === null ? c(this, w).slice().map((s) => typeof s == "string" ? s : s.toJSON()) : [this.type, ...c(this, w).map((s) => s.toJSON())];
|
|
627
|
+
return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === c(this, C) || c(c(this, C), G) && ((e = c(this, M)) == null ? void 0 : e.type) === "!") && t.push({}), t;
|
|
628
|
+
}
|
|
629
|
+
isStart() {
|
|
630
|
+
var e;
|
|
631
|
+
if (c(this, C) === this)
|
|
632
|
+
return !0;
|
|
633
|
+
if (!((e = c(this, M)) != null && e.isStart()))
|
|
634
|
+
return !1;
|
|
635
|
+
if (c(this, I) === 0)
|
|
636
|
+
return !0;
|
|
637
|
+
const t = c(this, M);
|
|
638
|
+
for (let s = 0; s < c(this, I); s++) {
|
|
639
|
+
const i = c(t, w)[s];
|
|
640
|
+
if (!(i instanceof j && i.type === "!"))
|
|
641
|
+
return !1;
|
|
642
|
+
}
|
|
643
|
+
return !0;
|
|
644
|
+
}
|
|
645
|
+
isEnd() {
|
|
646
|
+
var e, s, i;
|
|
647
|
+
if (c(this, C) === this || ((e = c(this, M)) == null ? void 0 : e.type) === "!")
|
|
648
|
+
return !0;
|
|
649
|
+
if (!((s = c(this, M)) != null && s.isEnd()))
|
|
650
|
+
return !1;
|
|
651
|
+
if (!this.type)
|
|
652
|
+
return (i = c(this, M)) == null ? void 0 : i.isEnd();
|
|
653
|
+
const t = c(this, M) ? c(c(this, M), w).length : 0;
|
|
654
|
+
return c(this, I) === t - 1;
|
|
655
|
+
}
|
|
656
|
+
copyIn(t) {
|
|
657
|
+
typeof t == "string" ? this.push(t) : this.push(t.clone(this));
|
|
658
|
+
}
|
|
659
|
+
clone(t) {
|
|
660
|
+
const e = new j(this.type, t);
|
|
661
|
+
for (const s of c(this, w))
|
|
662
|
+
e.copyIn(s);
|
|
663
|
+
return e;
|
|
664
|
+
}
|
|
665
|
+
static fromGlob(t, e = {}) {
|
|
666
|
+
var i;
|
|
667
|
+
const s = new j(null, void 0, e);
|
|
668
|
+
return v(i = j, V, nt).call(i, t, s, 0, e, 0), s;
|
|
669
|
+
}
|
|
670
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
671
|
+
// string if not.
|
|
672
|
+
toMMPattern() {
|
|
673
|
+
if (this !== c(this, C))
|
|
674
|
+
return c(this, C).toMMPattern();
|
|
675
|
+
const t = this.toString(), [e, s, i, r] = this.toRegExpSource();
|
|
676
|
+
if (!(i || c(this, N) || c(this, z).nocase && !c(this, z).nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
|
|
677
|
+
return s;
|
|
678
|
+
const u = (c(this, z).nocase ? "i" : "") + (r ? "u" : "");
|
|
679
|
+
return Object.assign(new RegExp(`^${e}$`, u), {
|
|
680
|
+
_src: e,
|
|
681
|
+
_glob: t
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
get options() {
|
|
685
|
+
return c(this, z);
|
|
686
|
+
}
|
|
687
|
+
// returns the string match, the regexp source, whether there's magic
|
|
688
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
689
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
690
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
691
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
692
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
693
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
694
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
695
|
+
//
|
|
696
|
+
// In part-matching mode, the start is:
|
|
697
|
+
// - if not isStart: nothing
|
|
698
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
699
|
+
// - if dots allowed or not possible: ^
|
|
700
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
701
|
+
// end is:
|
|
702
|
+
// - if not isEnd(): nothing
|
|
703
|
+
// - else: $
|
|
704
|
+
//
|
|
705
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
706
|
+
// pattern, so start is:
|
|
707
|
+
// - if first pattern: same as part-matching mode
|
|
708
|
+
// - if not isStart(): nothing
|
|
709
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
710
|
+
// - if dots allowed or not possible: /
|
|
711
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
712
|
+
// end is:
|
|
713
|
+
// - if last pattern, same as part-matching mode
|
|
714
|
+
// - else nothing
|
|
715
|
+
//
|
|
716
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
717
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
718
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
719
|
+
// the pattern.
|
|
720
|
+
//
|
|
721
|
+
// We can just always return the same end, and leave it up to the caller
|
|
722
|
+
// to know whether it's going to be used joined or in parts.
|
|
723
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
724
|
+
// - if not isStart: nothing
|
|
725
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
726
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
727
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
728
|
+
//
|
|
729
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
730
|
+
// performance, so probably better to return both start options.
|
|
731
|
+
//
|
|
732
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
733
|
+
// and the start always gets applied.
|
|
734
|
+
//
|
|
735
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
736
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
737
|
+
//
|
|
738
|
+
// So the todo is:
|
|
739
|
+
// - better detect what kind of start is needed
|
|
740
|
+
// - return both flavors of starting pattern
|
|
741
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
742
|
+
//
|
|
743
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
744
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
745
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
746
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
747
|
+
//
|
|
748
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
749
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
750
|
+
// use the (?:^|/) style of start binding.
|
|
751
|
+
//
|
|
752
|
+
// Even simplified further:
|
|
753
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
754
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
755
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
756
|
+
toRegExpSource(t) {
|
|
757
|
+
var p;
|
|
758
|
+
const e = t ?? !!c(this, z).dot;
|
|
759
|
+
if (c(this, C) === this && (v(this, A, rt).call(this), v(this, A, zt).call(this)), !vt(this)) {
|
|
760
|
+
const a = this.isStart() && this.isEnd() && !c(this, w).some((g) => typeof g != "string"), h = c(this, w).map((g) => {
|
|
761
|
+
var m;
|
|
762
|
+
const [y, x, E, S] = typeof g == "string" ? v(m = j, V, Vt).call(m, g, c(this, N), a) : g.toRegExpSource(t);
|
|
763
|
+
return b(this, N, c(this, N) || E), b(this, q, c(this, q) || S), y;
|
|
764
|
+
}).join("");
|
|
765
|
+
let l = "";
|
|
766
|
+
if (this.isStart() && typeof c(this, w)[0] == "string" && !(c(this, w).length === 1 && ze.has(c(this, w)[0]))) {
|
|
767
|
+
const y = We, x = (
|
|
768
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
769
|
+
e && y.has(h.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
770
|
+
h.startsWith("\\.") && y.has(h.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
771
|
+
h.startsWith("\\.\\.") && y.has(h.charAt(4))
|
|
772
|
+
), E = !e && !t && y.has(h.charAt(0));
|
|
773
|
+
l = x ? Pe : E ? st : "";
|
|
774
|
+
}
|
|
775
|
+
let f = "";
|
|
776
|
+
return this.isEnd() && c(c(this, C), G) && ((p = c(this, M)) == null ? void 0 : p.type) === "!" && (f = "(?:$|\\/)"), [
|
|
777
|
+
l + h + f,
|
|
778
|
+
et(h),
|
|
779
|
+
b(this, N, !!c(this, N)),
|
|
780
|
+
c(this, q)
|
|
781
|
+
];
|
|
782
|
+
}
|
|
783
|
+
const s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
784
|
+
let r = v(this, A, mt).call(this, e);
|
|
785
|
+
if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
|
|
786
|
+
const a = this.toString(), h = this;
|
|
787
|
+
return b(h, w, [a]), h.type = null, b(h, N, void 0), [a, et(this.toString()), !1, !1];
|
|
788
|
+
}
|
|
789
|
+
let o = !s || t || e || !st ? "" : v(this, A, mt).call(this, !0);
|
|
790
|
+
o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
|
|
791
|
+
let u = "";
|
|
792
|
+
if (this.type === "!" && c(this, Y))
|
|
793
|
+
u = (this.isStart() && !e ? st : "") + Tt;
|
|
794
|
+
else {
|
|
795
|
+
const a = this.type === "!" ? (
|
|
796
|
+
// !() must match something,but !(x) can match ''
|
|
797
|
+
"))" + (this.isStart() && !e && !t ? st : "") + $t + ")"
|
|
798
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
799
|
+
u = i + r + a;
|
|
800
|
+
}
|
|
801
|
+
return [
|
|
802
|
+
u,
|
|
803
|
+
et(r),
|
|
804
|
+
b(this, N, !!c(this, N)),
|
|
805
|
+
c(this, q)
|
|
806
|
+
];
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
C = new WeakMap(), N = new WeakMap(), q = new WeakMap(), w = new WeakMap(), M = new WeakMap(), I = new WeakMap(), F = new WeakMap(), G = new WeakMap(), z = new WeakMap(), U = new WeakMap(), Y = new WeakMap(), A = new WeakSet(), zt = function() {
|
|
810
|
+
if (this !== c(this, C))
|
|
811
|
+
throw new Error("should only call on root");
|
|
812
|
+
if (c(this, G))
|
|
813
|
+
return this;
|
|
814
|
+
this.toString(), b(this, G, !0);
|
|
815
|
+
let t;
|
|
816
|
+
for (; t = c(this, F).pop(); ) {
|
|
817
|
+
if (t.type !== "!")
|
|
818
|
+
continue;
|
|
819
|
+
let e = t, s = c(e, M);
|
|
820
|
+
for (; s; ) {
|
|
821
|
+
for (let i = c(e, I) + 1; !s.type && i < c(s, w).length; i++)
|
|
822
|
+
for (const r of c(t, w)) {
|
|
823
|
+
if (typeof r == "string")
|
|
824
|
+
throw new Error("string part in extglob AST??");
|
|
825
|
+
r.copyIn(c(s, w)[i]);
|
|
826
|
+
}
|
|
827
|
+
e = s, s = c(e, M);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
return this;
|
|
831
|
+
}, V = new WeakSet(), nt = function(t, e, s, i, r) {
|
|
832
|
+
var y, x, E, S;
|
|
833
|
+
const o = i.maxExtglobRecursion ?? 2;
|
|
834
|
+
let u = !1, p = !1, a = -1, h = !1;
|
|
835
|
+
if (e.type === null) {
|
|
836
|
+
let m = s, T = "";
|
|
837
|
+
for (; m < t.length; ) {
|
|
838
|
+
const $ = t.charAt(m++);
|
|
839
|
+
if (u || $ === "\\") {
|
|
840
|
+
u = !u, T += $;
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
if (p) {
|
|
844
|
+
m === a + 1 ? ($ === "^" || $ === "!") && (h = !0) : $ === "]" && !(m === a + 2 && h) && (p = !1), T += $;
|
|
845
|
+
continue;
|
|
846
|
+
} else if ($ === "[") {
|
|
847
|
+
p = !0, a = m, h = !1, T += $;
|
|
848
|
+
continue;
|
|
849
|
+
}
|
|
850
|
+
if (!i.noext && pt($) && t.charAt(m) === "(" && r <= o) {
|
|
851
|
+
e.push(T), T = "";
|
|
852
|
+
const X = new j($, e);
|
|
853
|
+
m = v(y = j, V, nt).call(y, t, X, m, i, r + 1), e.push(X);
|
|
854
|
+
continue;
|
|
855
|
+
}
|
|
856
|
+
T += $;
|
|
857
|
+
}
|
|
858
|
+
return e.push(T), m;
|
|
859
|
+
}
|
|
860
|
+
let l = s + 1, f = new j(null, e);
|
|
861
|
+
const d = [];
|
|
862
|
+
let g = "";
|
|
863
|
+
for (; l < t.length; ) {
|
|
864
|
+
const m = t.charAt(l++);
|
|
865
|
+
if (u || m === "\\") {
|
|
866
|
+
u = !u, g += m;
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
if (p) {
|
|
870
|
+
l === a + 1 ? (m === "^" || m === "!") && (h = !0) : m === "]" && !(l === a + 2 && h) && (p = !1), g += m;
|
|
871
|
+
continue;
|
|
872
|
+
} else if (m === "[") {
|
|
873
|
+
p = !0, a = l, h = !1, g += m;
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
876
|
+
if (!i.noext && pt(m) && t.charAt(l) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
|
|
877
|
+
(r <= o || e && v(x = e, A, it).call(x, m))) {
|
|
878
|
+
const $ = e && v(E = e, A, it).call(E, m) ? 0 : 1;
|
|
879
|
+
f.push(g), g = "";
|
|
880
|
+
const K = new j(m, f);
|
|
881
|
+
f.push(K), l = v(S = j, V, nt).call(S, t, K, l, i, r + $);
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
if (m === "|") {
|
|
885
|
+
f.push(g), g = "", d.push(f), f = new j(null, e);
|
|
886
|
+
continue;
|
|
887
|
+
}
|
|
888
|
+
if (m === ")")
|
|
889
|
+
return g === "" && c(e, w).length === 0 && b(e, Y, !0), f.push(g), g = "", e.push(...d, f), l;
|
|
890
|
+
g += m;
|
|
891
|
+
}
|
|
892
|
+
return e.type = null, b(e, N, void 0), b(e, w, [t.substring(s - 1)]), l;
|
|
893
|
+
}, Ut = function(t) {
|
|
894
|
+
return v(this, A, dt).call(this, t, je);
|
|
895
|
+
}, dt = function(t, e = _e) {
|
|
896
|
+
if (!t || typeof t != "object" || t.type !== null || c(t, w).length !== 1 || this.type === null)
|
|
897
|
+
return !1;
|
|
898
|
+
const s = c(t, w)[0];
|
|
899
|
+
return !s || typeof s != "object" || s.type === null ? !1 : v(this, A, it).call(this, s.type, e);
|
|
900
|
+
}, it = function(t, e = De) {
|
|
901
|
+
var s;
|
|
902
|
+
return !!((s = e.get(this.type)) != null && s.includes(t));
|
|
903
|
+
}, qt = function(t, e) {
|
|
904
|
+
const s = c(t, w)[0], i = new j(null, s, this.options);
|
|
905
|
+
c(i, w).push(""), s.push(i), v(this, A, gt).call(this, t, e);
|
|
906
|
+
}, gt = function(t, e) {
|
|
907
|
+
const s = c(t, w)[0];
|
|
908
|
+
c(this, w).splice(e, 1, ...c(s, w));
|
|
909
|
+
for (const i of c(s, w))
|
|
910
|
+
typeof i == "object" && b(i, M, this);
|
|
911
|
+
b(this, U, void 0);
|
|
912
|
+
}, It = function(t) {
|
|
913
|
+
const e = At.get(this.type);
|
|
914
|
+
return !!(e != null && e.has(t));
|
|
915
|
+
}, Gt = function(t) {
|
|
916
|
+
if (!t || typeof t != "object" || t.type !== null || c(t, w).length !== 1 || this.type === null || c(this, w).length !== 1)
|
|
917
|
+
return !1;
|
|
918
|
+
const e = c(t, w)[0];
|
|
919
|
+
return !e || typeof e != "object" || e.type === null ? !1 : v(this, A, It).call(this, e.type);
|
|
920
|
+
}, Bt = function(t) {
|
|
921
|
+
const e = At.get(this.type), s = c(t, w)[0], i = e == null ? void 0 : e.get(s.type);
|
|
922
|
+
if (!i)
|
|
923
|
+
return !1;
|
|
924
|
+
b(this, w, c(s, w));
|
|
925
|
+
for (const r of c(this, w))
|
|
926
|
+
typeof r == "object" && b(r, M, this);
|
|
927
|
+
this.type = i, b(this, U, void 0), b(this, Y, !1);
|
|
928
|
+
}, rt = function() {
|
|
929
|
+
var t, e;
|
|
930
|
+
if (vt(this)) {
|
|
931
|
+
let s = 0, i = !1;
|
|
932
|
+
do {
|
|
933
|
+
i = !0;
|
|
934
|
+
for (let r = 0; r < c(this, w).length; r++) {
|
|
935
|
+
const o = c(this, w)[r];
|
|
936
|
+
typeof o == "object" && (v(e = o, A, rt).call(e), v(this, A, dt).call(this, o) ? (i = !1, v(this, A, gt).call(this, o, r)) : v(this, A, Ut).call(this, o) ? (i = !1, v(this, A, qt).call(this, o, r)) : v(this, A, Gt).call(this, o) && (i = !1, v(this, A, Bt).call(this, o)));
|
|
937
|
+
}
|
|
938
|
+
} while (!i && ++s < 10);
|
|
939
|
+
} else
|
|
940
|
+
for (const s of c(this, w))
|
|
941
|
+
typeof s == "object" && v(t = s, A, rt).call(t);
|
|
942
|
+
b(this, U, void 0);
|
|
943
|
+
}, mt = function(t) {
|
|
944
|
+
return c(this, w).map((e) => {
|
|
945
|
+
if (typeof e == "string")
|
|
946
|
+
throw new Error("string type in extglob ast??");
|
|
947
|
+
const [s, i, r, o] = e.toRegExpSource(t);
|
|
948
|
+
return b(this, q, c(this, q) || o), s;
|
|
949
|
+
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
950
|
+
}, Vt = function(t, e, s = !1) {
|
|
951
|
+
let i = !1, r = "", o = !1, u = !1;
|
|
952
|
+
for (let p = 0; p < t.length; p++) {
|
|
953
|
+
const a = t.charAt(p);
|
|
954
|
+
if (i) {
|
|
955
|
+
i = !1, r += (Ue.has(a) ? "\\" : "") + a;
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
if (a === "*") {
|
|
959
|
+
if (u)
|
|
960
|
+
continue;
|
|
961
|
+
u = !0, r += s && /^[*]+$/.test(t) ? Tt : $t, e = !0;
|
|
962
|
+
continue;
|
|
963
|
+
} else
|
|
964
|
+
u = !1;
|
|
965
|
+
if (a === "\\") {
|
|
966
|
+
p === t.length - 1 ? r += "\\\\" : i = !0;
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
if (a === "[") {
|
|
970
|
+
const [h, l, f, d] = Oe(t, p);
|
|
971
|
+
if (f) {
|
|
972
|
+
r += h, o = o || l, p += f - 1, e = e || d;
|
|
973
|
+
continue;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
if (a === "?") {
|
|
977
|
+
r += xt, e = !0;
|
|
978
|
+
continue;
|
|
979
|
+
}
|
|
980
|
+
r += qe(a);
|
|
981
|
+
}
|
|
982
|
+
return [r, et(t), !!e, o];
|
|
983
|
+
}, R(ct, V);
|
|
984
|
+
j = ct;
|
|
985
|
+
const Ge = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&"), O = (n, t, e = {}) => (ot(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new lt(t, e).match(n)), Be = /^\*+([^+@!?*[(]*)$/, Ve = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Fe = (n) => (t) => t.endsWith(n), He = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ke = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ze = /^\*+\.\*+$/, Je = (n) => !n.startsWith(".") && n.includes("."), Ye = (n) => n !== "." && n !== ".." && n.includes("."), Xe = /^\.\*+$/, Qe = (n) => n !== "." && n !== ".." && n.startsWith("."), ts = /^\*+$/, es = (n) => n.length !== 0 && !n.startsWith("."), ss = (n) => n.length !== 0 && n !== "." && n !== "..", ns = /^\?+([^+@!?*[(]*)?$/, is = ([n, t = ""]) => {
|
|
986
|
+
const e = Ft([n]);
|
|
987
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
988
|
+
}, rs = ([n, t = ""]) => {
|
|
989
|
+
const e = Ht([n]);
|
|
990
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
991
|
+
}, os = ([n, t = ""]) => {
|
|
992
|
+
const e = Ht([n]);
|
|
993
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
994
|
+
}, cs = ([n, t = ""]) => {
|
|
995
|
+
const e = Ft([n]);
|
|
996
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
997
|
+
}, Ft = ([n]) => {
|
|
998
|
+
const t = n.length;
|
|
999
|
+
return (e) => e.length === t && !e.startsWith(".");
|
|
1000
|
+
}, Ht = ([n]) => {
|
|
1001
|
+
const t = n.length;
|
|
1002
|
+
return (e) => e.length === t && e !== "." && e !== "..";
|
|
1003
|
+
}, Kt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", Mt = {
|
|
1004
|
+
win32: { sep: "\\" },
|
|
1005
|
+
posix: { sep: "/" }
|
|
1006
|
+
}, ls = Kt === "win32" ? Mt.win32.sep : Mt.posix.sep;
|
|
1007
|
+
O.sep = ls;
|
|
1008
|
+
const _ = Symbol("globstar **");
|
|
1009
|
+
O.GLOBSTAR = _;
|
|
1010
|
+
const as = "[^/]", hs = as + "*?", us = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", fs = "(?:(?!(?:\\/|^)\\.).)*?", ps = (n, t = {}) => (e) => O(e, n, t);
|
|
1011
|
+
O.filter = ps;
|
|
1012
|
+
const W = (n, t = {}) => Object.assign({}, n, t), ds = (n) => {
|
|
1013
|
+
if (!n || typeof n != "object" || !Object.keys(n).length)
|
|
1014
|
+
return O;
|
|
1015
|
+
const t = O;
|
|
1016
|
+
return Object.assign((s, i, r = {}) => t(s, i, W(n, r)), {
|
|
1017
|
+
Minimatch: class extends t.Minimatch {
|
|
1018
|
+
constructor(i, r = {}) {
|
|
1019
|
+
super(i, W(n, r));
|
|
1020
|
+
}
|
|
1021
|
+
static defaults(i) {
|
|
1022
|
+
return t.defaults(W(n, i)).Minimatch;
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
AST: class extends t.AST {
|
|
1026
|
+
/* c8 ignore start */
|
|
1027
|
+
constructor(i, r, o = {}) {
|
|
1028
|
+
super(i, r, W(n, o));
|
|
1029
|
+
}
|
|
1030
|
+
/* c8 ignore stop */
|
|
1031
|
+
static fromGlob(i, r = {}) {
|
|
1032
|
+
return t.AST.fromGlob(i, W(n, r));
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
unescape: (s, i = {}) => t.unescape(s, W(n, i)),
|
|
1036
|
+
escape: (s, i = {}) => t.escape(s, W(n, i)),
|
|
1037
|
+
filter: (s, i = {}) => t.filter(s, W(n, i)),
|
|
1038
|
+
defaults: (s) => t.defaults(W(n, s)),
|
|
1039
|
+
makeRe: (s, i = {}) => t.makeRe(s, W(n, i)),
|
|
1040
|
+
braceExpand: (s, i = {}) => t.braceExpand(s, W(n, i)),
|
|
1041
|
+
match: (s, i, r = {}) => t.match(s, i, W(n, r)),
|
|
1042
|
+
sep: t.sep,
|
|
1043
|
+
GLOBSTAR: _
|
|
1044
|
+
});
|
|
1045
|
+
};
|
|
1046
|
+
O.defaults = ds;
|
|
1047
|
+
const Zt = (n, t = {}) => (ot(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : Ae(n, { max: t.braceExpandMax }));
|
|
1048
|
+
O.braceExpand = Zt;
|
|
1049
|
+
const gs = (n, t = {}) => new lt(n, t).makeRe();
|
|
1050
|
+
O.makeRe = gs;
|
|
1051
|
+
const ms = (n, t, e = {}) => {
|
|
1052
|
+
const s = new lt(t, e);
|
|
1053
|
+
return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
|
|
1054
|
+
};
|
|
1055
|
+
O.match = ms;
|
|
1056
|
+
const kt = /[?*]|[+@!]\(.*?\)|\[|\]/, ys = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1057
|
+
var P, Jt, yt, J;
|
|
1058
|
+
class lt {
|
|
1059
|
+
constructor(t, e = {}) {
|
|
1060
|
+
R(this, P);
|
|
1061
|
+
k(this, "options");
|
|
1062
|
+
k(this, "set");
|
|
1063
|
+
k(this, "pattern");
|
|
1064
|
+
k(this, "windowsPathsNoEscape");
|
|
1065
|
+
k(this, "nonegate");
|
|
1066
|
+
k(this, "negate");
|
|
1067
|
+
k(this, "comment");
|
|
1068
|
+
k(this, "empty");
|
|
1069
|
+
k(this, "preserveMultipleSlashes");
|
|
1070
|
+
k(this, "partial");
|
|
1071
|
+
k(this, "globSet");
|
|
1072
|
+
k(this, "globParts");
|
|
1073
|
+
k(this, "nocase");
|
|
1074
|
+
k(this, "isWindows");
|
|
1075
|
+
k(this, "platform");
|
|
1076
|
+
k(this, "windowsNoMagicRoot");
|
|
1077
|
+
k(this, "maxGlobstarRecursion");
|
|
1078
|
+
k(this, "regexp");
|
|
1079
|
+
ot(t), e = e || {}, this.options = e, this.maxGlobstarRecursion = e.maxGlobstarRecursion ?? 200, this.pattern = t, this.platform = e.platform || Kt, this.isWindows = this.platform === "win32";
|
|
1080
|
+
const s = "allowWindowsEscape";
|
|
1081
|
+
this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
|
|
1082
|
+
}
|
|
1083
|
+
hasMagic() {
|
|
1084
|
+
if (this.options.magicalBraces && this.set.length > 1)
|
|
1085
|
+
return !0;
|
|
1086
|
+
for (const t of this.set)
|
|
1087
|
+
for (const e of t)
|
|
1088
|
+
if (typeof e != "string")
|
|
1089
|
+
return !0;
|
|
1090
|
+
return !1;
|
|
1091
|
+
}
|
|
1092
|
+
debug(...t) {
|
|
1093
|
+
}
|
|
1094
|
+
make() {
|
|
1095
|
+
const t = this.pattern, e = this.options;
|
|
1096
|
+
if (!e.nocomment && t.charAt(0) === "#") {
|
|
1097
|
+
this.comment = !0;
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
if (!t) {
|
|
1101
|
+
this.empty = !0;
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
|
|
1105
|
+
const s = this.globSet.map((r) => this.slashSplit(r));
|
|
1106
|
+
this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
|
|
1107
|
+
let i = this.globParts.map((r, o, u) => {
|
|
1108
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
1109
|
+
const p = r[0] === "" && r[1] === "" && (r[2] === "?" || !kt.test(r[2])) && !kt.test(r[3]), a = /^[a-z]:/i.test(r[0]);
|
|
1110
|
+
if (p)
|
|
1111
|
+
return [
|
|
1112
|
+
...r.slice(0, 4),
|
|
1113
|
+
...r.slice(4).map((h) => this.parse(h))
|
|
1114
|
+
];
|
|
1115
|
+
if (a)
|
|
1116
|
+
return [r[0], ...r.slice(1).map((h) => this.parse(h))];
|
|
1117
|
+
}
|
|
1118
|
+
return r.map((p) => this.parse(p));
|
|
1119
|
+
});
|
|
1120
|
+
if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows)
|
|
1121
|
+
for (let r = 0; r < this.set.length; r++) {
|
|
1122
|
+
const o = this.set[r];
|
|
1123
|
+
o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
|
|
1124
|
+
}
|
|
1125
|
+
this.debug(this.pattern, this.set);
|
|
1126
|
+
}
|
|
1127
|
+
// various transforms to equivalent pattern sets that are
|
|
1128
|
+
// faster to process in a filesystem walk. The goal is to
|
|
1129
|
+
// eliminate what we can, and push all ** patterns as far
|
|
1130
|
+
// to the right as possible, even if it increases the number
|
|
1131
|
+
// of patterns that we have to process.
|
|
1132
|
+
preprocess(t) {
|
|
1133
|
+
if (this.options.noglobstar)
|
|
1134
|
+
for (const s of t)
|
|
1135
|
+
for (let i = 0; i < s.length; i++)
|
|
1136
|
+
s[i] === "**" && (s[i] = "*");
|
|
1137
|
+
const { optimizationLevel: e = 1 } = this.options;
|
|
1138
|
+
return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
|
|
1139
|
+
}
|
|
1140
|
+
// just get rid of adjascent ** portions
|
|
1141
|
+
adjascentGlobstarOptimize(t) {
|
|
1142
|
+
return t.map((e) => {
|
|
1143
|
+
let s = -1;
|
|
1144
|
+
for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
|
|
1145
|
+
let i = s;
|
|
1146
|
+
for (; e[i + 1] === "**"; )
|
|
1147
|
+
i++;
|
|
1148
|
+
i !== s && e.splice(s, i - s);
|
|
1149
|
+
}
|
|
1150
|
+
return e;
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
// get rid of adjascent ** and resolve .. portions
|
|
1154
|
+
levelOneOptimize(t) {
|
|
1155
|
+
return t.map((e) => (e = e.reduce((s, i) => {
|
|
1156
|
+
const r = s[s.length - 1];
|
|
1157
|
+
return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
|
|
1158
|
+
}, []), e.length === 0 ? [""] : e));
|
|
1159
|
+
}
|
|
1160
|
+
levelTwoFileOptimize(t) {
|
|
1161
|
+
Array.isArray(t) || (t = this.slashSplit(t));
|
|
1162
|
+
let e = !1;
|
|
1163
|
+
do {
|
|
1164
|
+
if (e = !1, !this.preserveMultipleSlashes) {
|
|
1165
|
+
for (let i = 1; i < t.length - 1; i++) {
|
|
1166
|
+
const r = t[i];
|
|
1167
|
+
i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
|
|
1168
|
+
}
|
|
1169
|
+
t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
|
|
1170
|
+
}
|
|
1171
|
+
let s = 0;
|
|
1172
|
+
for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
|
|
1173
|
+
const i = t[s - 1];
|
|
1174
|
+
i && i !== "." && i !== ".." && i !== "**" && !(this.isWindows && /^[a-z]:$/i.test(i)) && (e = !0, t.splice(s - 1, 2), s -= 2);
|
|
1175
|
+
}
|
|
1176
|
+
} while (e);
|
|
1177
|
+
return t.length === 0 ? [""] : t;
|
|
1178
|
+
}
|
|
1179
|
+
// First phase: single-pattern processing
|
|
1180
|
+
// <pre> is 1 or more portions
|
|
1181
|
+
// <rest> is 1 or more portions
|
|
1182
|
+
// <p> is any portion other than ., .., '', or **
|
|
1183
|
+
// <e> is . or ''
|
|
1184
|
+
//
|
|
1185
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
1186
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
1187
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
1188
|
+
// or most strings (other than .., ., and '') can be.
|
|
1189
|
+
//
|
|
1190
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
1191
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
1192
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
1193
|
+
// **/**/<rest> -> **/<rest>
|
|
1194
|
+
//
|
|
1195
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
1196
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
1197
|
+
firstPhasePreProcess(t) {
|
|
1198
|
+
let e = !1;
|
|
1199
|
+
do {
|
|
1200
|
+
e = !1;
|
|
1201
|
+
for (let s of t) {
|
|
1202
|
+
let i = -1;
|
|
1203
|
+
for (; (i = s.indexOf("**", i + 1)) !== -1; ) {
|
|
1204
|
+
let o = i;
|
|
1205
|
+
for (; s[o + 1] === "**"; )
|
|
1206
|
+
o++;
|
|
1207
|
+
o > i && s.splice(i + 1, o - i);
|
|
1208
|
+
let u = s[i + 1];
|
|
1209
|
+
const p = s[i + 2], a = s[i + 3];
|
|
1210
|
+
if (u !== ".." || !p || p === "." || p === ".." || !a || a === "." || a === "..")
|
|
1211
|
+
continue;
|
|
1212
|
+
e = !0, s.splice(i, 1);
|
|
1213
|
+
const h = s.slice(0);
|
|
1214
|
+
h[i] = "**", t.push(h), i--;
|
|
1215
|
+
}
|
|
1216
|
+
if (!this.preserveMultipleSlashes) {
|
|
1217
|
+
for (let o = 1; o < s.length - 1; o++) {
|
|
1218
|
+
const u = s[o];
|
|
1219
|
+
o === 1 && u === "" && s[0] === "" || (u === "." || u === "") && (e = !0, s.splice(o, 1), o--);
|
|
1220
|
+
}
|
|
1221
|
+
s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = !0, s.pop());
|
|
1222
|
+
}
|
|
1223
|
+
let r = 0;
|
|
1224
|
+
for (; (r = s.indexOf("..", r + 1)) !== -1; ) {
|
|
1225
|
+
const o = s[r - 1];
|
|
1226
|
+
if (o && o !== "." && o !== ".." && o !== "**") {
|
|
1227
|
+
e = !0;
|
|
1228
|
+
const p = r === 1 && s[r + 1] === "**" ? ["."] : [];
|
|
1229
|
+
s.splice(r - 1, 2, ...p), s.length === 0 && s.push(""), r -= 2;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
} while (e);
|
|
1234
|
+
return t;
|
|
1235
|
+
}
|
|
1236
|
+
// second phase: multi-pattern dedupes
|
|
1237
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
1238
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
1239
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
1240
|
+
//
|
|
1241
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
1242
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
1243
|
+
secondPhasePreProcess(t) {
|
|
1244
|
+
for (let e = 0; e < t.length - 1; e++)
|
|
1245
|
+
for (let s = e + 1; s < t.length; s++) {
|
|
1246
|
+
const i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
|
|
1247
|
+
if (i) {
|
|
1248
|
+
t[e] = [], t[s] = i;
|
|
1249
|
+
break;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
return t.filter((e) => e.length);
|
|
1253
|
+
}
|
|
1254
|
+
partsMatch(t, e, s = !1) {
|
|
1255
|
+
let i = 0, r = 0, o = [], u = "";
|
|
1256
|
+
for (; i < t.length && r < e.length; )
|
|
1257
|
+
if (t[i] === e[r])
|
|
1258
|
+
o.push(u === "b" ? e[r] : t[i]), i++, r++;
|
|
1259
|
+
else if (s && t[i] === "**" && e[r] === t[i + 1])
|
|
1260
|
+
o.push(t[i]), i++;
|
|
1261
|
+
else if (s && e[r] === "**" && t[i] === e[r + 1])
|
|
1262
|
+
o.push(e[r]), r++;
|
|
1263
|
+
else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
|
|
1264
|
+
if (u === "b")
|
|
1265
|
+
return !1;
|
|
1266
|
+
u = "a", o.push(t[i]), i++, r++;
|
|
1267
|
+
} else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
|
|
1268
|
+
if (u === "a")
|
|
1269
|
+
return !1;
|
|
1270
|
+
u = "b", o.push(e[r]), i++, r++;
|
|
1271
|
+
} else
|
|
1272
|
+
return !1;
|
|
1273
|
+
return t.length === e.length && o;
|
|
1274
|
+
}
|
|
1275
|
+
parseNegate() {
|
|
1276
|
+
if (this.nonegate)
|
|
1277
|
+
return;
|
|
1278
|
+
const t = this.pattern;
|
|
1279
|
+
let e = !1, s = 0;
|
|
1280
|
+
for (let i = 0; i < t.length && t.charAt(i) === "!"; i++)
|
|
1281
|
+
e = !e, s++;
|
|
1282
|
+
s && (this.pattern = t.slice(s)), this.negate = e;
|
|
1283
|
+
}
|
|
1284
|
+
// set partial to true to test if, for example,
|
|
1285
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
1286
|
+
// Partial means, if you run out of file before you run
|
|
1287
|
+
// out of pattern, then that's fine, as long as all
|
|
1288
|
+
// the parts match.
|
|
1289
|
+
matchOne(t, e, s = !1) {
|
|
1290
|
+
let i = 0, r = 0;
|
|
1291
|
+
if (this.isWindows) {
|
|
1292
|
+
const u = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), p = !u && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), a = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), h = !a && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), l = p ? 3 : u ? 0 : void 0, f = h ? 3 : a ? 0 : void 0;
|
|
1293
|
+
if (typeof l == "number" && typeof f == "number") {
|
|
1294
|
+
const [d, g] = [
|
|
1295
|
+
t[l],
|
|
1296
|
+
e[f]
|
|
1297
|
+
];
|
|
1298
|
+
d.toLowerCase() === g.toLowerCase() && (e[f] = d, r = f, i = l);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
const { optimizationLevel: o = 1 } = this.options;
|
|
1302
|
+
return o >= 2 && (t = this.levelTwoFileOptimize(t)), e.includes(_) ? v(this, P, Jt).call(this, t, e, s, i, r) : v(this, P, J).call(this, t, e, s, i, r);
|
|
1303
|
+
}
|
|
1304
|
+
braceExpand() {
|
|
1305
|
+
return Zt(this.pattern, this.options);
|
|
1306
|
+
}
|
|
1307
|
+
parse(t) {
|
|
1308
|
+
ot(t);
|
|
1309
|
+
const e = this.options;
|
|
1310
|
+
if (t === "**")
|
|
1311
|
+
return _;
|
|
1312
|
+
if (t === "")
|
|
1313
|
+
return "";
|
|
1314
|
+
let s, i = null;
|
|
1315
|
+
(s = t.match(ts)) ? i = e.dot ? ss : es : (s = t.match(Be)) ? i = (e.nocase ? e.dot ? Ke : He : e.dot ? Fe : Ve)(s[1]) : (s = t.match(ns)) ? i = (e.nocase ? e.dot ? rs : is : e.dot ? os : cs)(s) : (s = t.match(Ze)) ? i = e.dot ? Ye : Je : (s = t.match(Xe)) && (i = Qe);
|
|
1316
|
+
const r = ct.fromGlob(t, this.options).toMMPattern();
|
|
1317
|
+
return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
|
|
1318
|
+
}
|
|
1319
|
+
makeRe() {
|
|
1320
|
+
if (this.regexp || this.regexp === !1)
|
|
1321
|
+
return this.regexp;
|
|
1322
|
+
const t = this.set;
|
|
1323
|
+
if (!t.length)
|
|
1324
|
+
return this.regexp = !1, this.regexp;
|
|
1325
|
+
const e = this.options, s = e.noglobstar ? hs : e.dot ? us : fs, i = new Set(e.nocase ? ["i"] : []);
|
|
1326
|
+
let r = t.map((p) => {
|
|
1327
|
+
const a = p.map((l) => {
|
|
1328
|
+
if (l instanceof RegExp)
|
|
1329
|
+
for (const f of l.flags.split(""))
|
|
1330
|
+
i.add(f);
|
|
1331
|
+
return typeof l == "string" ? ys(l) : l === _ ? _ : l._src;
|
|
1332
|
+
});
|
|
1333
|
+
a.forEach((l, f) => {
|
|
1334
|
+
const d = a[f + 1], g = a[f - 1];
|
|
1335
|
+
l !== _ || g === _ || (g === void 0 ? d !== void 0 && d !== _ ? a[f + 1] = "(?:\\/|" + s + "\\/)?" + d : a[f] = s : d === void 0 ? a[f - 1] = g + "(?:\\/|\\/" + s + ")?" : d !== _ && (a[f - 1] = g + "(?:\\/|\\/" + s + "\\/)" + d, a[f + 1] = _));
|
|
1336
|
+
});
|
|
1337
|
+
const h = a.filter((l) => l !== _);
|
|
1338
|
+
if (this.partial && h.length >= 1) {
|
|
1339
|
+
const l = [];
|
|
1340
|
+
for (let f = 1; f <= h.length; f++)
|
|
1341
|
+
l.push(h.slice(0, f).join("/"));
|
|
1342
|
+
return "(?:" + l.join("|") + ")";
|
|
1343
|
+
}
|
|
1344
|
+
return h.join("/");
|
|
1345
|
+
}).join("|");
|
|
1346
|
+
const [o, u] = t.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1347
|
+
r = "^" + o + r + u + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + u + ")$"), this.negate && (r = "^(?!" + r + ").+$");
|
|
1348
|
+
try {
|
|
1349
|
+
this.regexp = new RegExp(r, [...i].join(""));
|
|
1350
|
+
} catch {
|
|
1351
|
+
this.regexp = !1;
|
|
1352
|
+
}
|
|
1353
|
+
return this.regexp;
|
|
1354
|
+
}
|
|
1355
|
+
slashSplit(t) {
|
|
1356
|
+
return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
|
|
1357
|
+
}
|
|
1358
|
+
match(t, e = this.partial) {
|
|
1359
|
+
if (this.debug("match", t, this.pattern), this.comment)
|
|
1360
|
+
return !1;
|
|
1361
|
+
if (this.empty)
|
|
1362
|
+
return t === "";
|
|
1363
|
+
if (t === "/" && e)
|
|
1364
|
+
return !0;
|
|
1365
|
+
const s = this.options;
|
|
1366
|
+
this.isWindows && (t = t.split("\\").join("/"));
|
|
1367
|
+
const i = this.slashSplit(t);
|
|
1368
|
+
this.debug(this.pattern, "split", i);
|
|
1369
|
+
const r = this.set;
|
|
1370
|
+
this.debug(this.pattern, "set", r);
|
|
1371
|
+
let o = i[i.length - 1];
|
|
1372
|
+
if (!o)
|
|
1373
|
+
for (let u = i.length - 2; !o && u >= 0; u--)
|
|
1374
|
+
o = i[u];
|
|
1375
|
+
for (const u of r) {
|
|
1376
|
+
let p = i;
|
|
1377
|
+
if (s.matchBase && u.length === 1 && (p = [o]), this.matchOne(p, u, e))
|
|
1378
|
+
return s.flipNegate ? !0 : !this.negate;
|
|
1379
|
+
}
|
|
1380
|
+
return s.flipNegate ? !1 : this.negate;
|
|
1381
|
+
}
|
|
1382
|
+
static defaults(t) {
|
|
1383
|
+
return O.defaults(t).Minimatch;
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
P = new WeakSet(), Jt = function(t, e, s, i, r) {
|
|
1387
|
+
const o = e.indexOf(_, r), u = e.lastIndexOf(_), [p, a, h] = s ? [
|
|
1388
|
+
e.slice(r, o),
|
|
1389
|
+
e.slice(o + 1),
|
|
1390
|
+
[]
|
|
1391
|
+
] : [
|
|
1392
|
+
e.slice(r, o),
|
|
1393
|
+
e.slice(o + 1, u),
|
|
1394
|
+
e.slice(u + 1)
|
|
1395
|
+
];
|
|
1396
|
+
if (p.length) {
|
|
1397
|
+
const S = t.slice(i, i + p.length);
|
|
1398
|
+
if (!v(this, P, J).call(this, S, p, s, 0, 0))
|
|
1399
|
+
return !1;
|
|
1400
|
+
i += p.length, r += p.length;
|
|
1401
|
+
}
|
|
1402
|
+
let l = 0;
|
|
1403
|
+
if (h.length) {
|
|
1404
|
+
if (h.length + i > t.length)
|
|
1405
|
+
return !1;
|
|
1406
|
+
let S = t.length - h.length;
|
|
1407
|
+
if (v(this, P, J).call(this, t, h, s, S, 0))
|
|
1408
|
+
l = h.length;
|
|
1409
|
+
else {
|
|
1410
|
+
if (t[t.length - 1] !== "" || i + h.length === t.length || (S--, !v(this, P, J).call(this, t, h, s, S, 0)))
|
|
1411
|
+
return !1;
|
|
1412
|
+
l = h.length + 1;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
if (!a.length) {
|
|
1416
|
+
let S = !!l;
|
|
1417
|
+
for (let m = i; m < t.length - l; m++) {
|
|
1418
|
+
const T = String(t[m]);
|
|
1419
|
+
if (S = !0, T === "." || T === ".." || !this.options.dot && T.startsWith("."))
|
|
1420
|
+
return !1;
|
|
1421
|
+
}
|
|
1422
|
+
return s || S;
|
|
1423
|
+
}
|
|
1424
|
+
const f = [[[], 0]];
|
|
1425
|
+
let d = f[0], g = 0;
|
|
1426
|
+
const y = [0];
|
|
1427
|
+
for (const S of a)
|
|
1428
|
+
S === _ ? (y.push(g), d = [[], 0], f.push(d)) : (d[0].push(S), g++);
|
|
1429
|
+
let x = f.length - 1;
|
|
1430
|
+
const E = t.length - l;
|
|
1431
|
+
for (const S of f)
|
|
1432
|
+
S[1] = E - (y[x--] + S[0].length);
|
|
1433
|
+
return !!v(this, P, yt).call(this, t, f, i, 0, s, 0, !!l);
|
|
1434
|
+
}, // return false for "nope, not matching"
|
|
1435
|
+
// return null for "not matching, cannot keep trying"
|
|
1436
|
+
yt = function(t, e, s, i, r, o, u) {
|
|
1437
|
+
const p = e[i];
|
|
1438
|
+
if (!p) {
|
|
1439
|
+
for (let l = s; l < t.length; l++) {
|
|
1440
|
+
u = !0;
|
|
1441
|
+
const f = t[l];
|
|
1442
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith("."))
|
|
1443
|
+
return !1;
|
|
1444
|
+
}
|
|
1445
|
+
return u;
|
|
1446
|
+
}
|
|
1447
|
+
const [a, h] = p;
|
|
1448
|
+
for (; s <= h; ) {
|
|
1449
|
+
if (v(this, P, J).call(this, t.slice(0, s + a.length), a, r, s, 0) && o < this.maxGlobstarRecursion) {
|
|
1450
|
+
const d = v(this, P, yt).call(this, t, e, s + a.length, i + 1, r, o + 1, u);
|
|
1451
|
+
if (d !== !1)
|
|
1452
|
+
return d;
|
|
1453
|
+
}
|
|
1454
|
+
const f = t[s];
|
|
1455
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith("."))
|
|
1456
|
+
return !1;
|
|
1457
|
+
s++;
|
|
1458
|
+
}
|
|
1459
|
+
return r || null;
|
|
1460
|
+
}, J = function(t, e, s, i, r) {
|
|
1461
|
+
let o, u, p, a;
|
|
1462
|
+
for (o = i, u = r, a = t.length, p = e.length; o < a && u < p; o++, u++) {
|
|
1463
|
+
this.debug("matchOne loop");
|
|
1464
|
+
let h = e[u], l = t[o];
|
|
1465
|
+
if (this.debug(e, h, l), h === !1 || h === _)
|
|
1466
|
+
return !1;
|
|
1467
|
+
let f;
|
|
1468
|
+
if (typeof h == "string" ? (f = l === h, this.debug("string match", h, l, f)) : (f = h.test(l), this.debug("pattern match", h, l, f)), !f)
|
|
1469
|
+
return !1;
|
|
1470
|
+
}
|
|
1471
|
+
if (o === a && u === p)
|
|
1472
|
+
return !0;
|
|
1473
|
+
if (o === a)
|
|
1474
|
+
return s;
|
|
1475
|
+
if (u === p)
|
|
1476
|
+
return o === a - 1 && t[o] === "";
|
|
1477
|
+
throw new Error("wtf?");
|
|
1478
|
+
};
|
|
1479
|
+
O.AST = ct;
|
|
1480
|
+
O.Minimatch = lt;
|
|
1481
|
+
O.escape = Ge;
|
|
1482
|
+
O.unescape = et;
|
|
1483
|
+
class ws {
|
|
1484
|
+
constructor(t) {
|
|
1485
|
+
k(this, "value");
|
|
1486
|
+
k(this, "next");
|
|
1487
|
+
this.value = t;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
var D, B, H;
|
|
1491
|
+
class xs {
|
|
1492
|
+
constructor() {
|
|
1493
|
+
R(this, D);
|
|
1494
|
+
R(this, B);
|
|
1495
|
+
R(this, H);
|
|
1496
|
+
this.clear();
|
|
1497
|
+
}
|
|
1498
|
+
enqueue(t) {
|
|
1499
|
+
const e = new ws(t);
|
|
1500
|
+
c(this, D) ? (c(this, B).next = e, b(this, B, e)) : (b(this, D, e), b(this, B, e)), ht(this, H)._++;
|
|
1501
|
+
}
|
|
1502
|
+
dequeue() {
|
|
1503
|
+
const t = c(this, D);
|
|
1504
|
+
if (t)
|
|
1505
|
+
return b(this, D, c(this, D).next), ht(this, H)._--, c(this, D) || b(this, B, void 0), t.value;
|
|
1506
|
+
}
|
|
1507
|
+
peek() {
|
|
1508
|
+
if (c(this, D))
|
|
1509
|
+
return c(this, D).value;
|
|
1510
|
+
}
|
|
1511
|
+
clear() {
|
|
1512
|
+
b(this, D, void 0), b(this, B, void 0), b(this, H, 0);
|
|
1513
|
+
}
|
|
1514
|
+
get size() {
|
|
1515
|
+
return c(this, H);
|
|
1516
|
+
}
|
|
1517
|
+
*[Symbol.iterator]() {
|
|
1518
|
+
let t = c(this, D);
|
|
1519
|
+
for (; t; )
|
|
1520
|
+
yield t.value, t = t.next;
|
|
1521
|
+
}
|
|
1522
|
+
*drain() {
|
|
1523
|
+
for (; c(this, D); )
|
|
1524
|
+
yield this.dequeue();
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
D = new WeakMap(), B = new WeakMap(), H = new WeakMap();
|
|
1528
|
+
function Es(n) {
|
|
1529
|
+
let t = !1;
|
|
1530
|
+
if (typeof n == "object" && ({ concurrency: n, rejectOnClear: t = !1 } = n), Ct(n), typeof t != "boolean")
|
|
1531
|
+
throw new TypeError("Expected `rejectOnClear` to be a boolean");
|
|
1532
|
+
const e = new xs();
|
|
1533
|
+
let s = 0;
|
|
1534
|
+
const i = () => {
|
|
1535
|
+
s < n && e.size > 0 && (s++, e.dequeue().run());
|
|
1536
|
+
}, r = () => {
|
|
1537
|
+
s--, i();
|
|
1538
|
+
}, o = async (a, h, l) => {
|
|
1539
|
+
const f = (async () => a(...l))();
|
|
1540
|
+
h(f);
|
|
1541
|
+
try {
|
|
1542
|
+
await f;
|
|
1543
|
+
} catch {
|
|
1544
|
+
}
|
|
1545
|
+
r();
|
|
1546
|
+
}, u = (a, h, l, f) => {
|
|
1547
|
+
const d = { reject: l };
|
|
1548
|
+
new Promise((g) => {
|
|
1549
|
+
d.run = g, e.enqueue(d);
|
|
1550
|
+
}).then(o.bind(void 0, a, h, f)), s < n && i();
|
|
1551
|
+
}, p = (a, ...h) => new Promise((l, f) => {
|
|
1552
|
+
u(a, l, f, h);
|
|
1553
|
+
});
|
|
1554
|
+
return Object.defineProperties(p, {
|
|
1555
|
+
activeCount: {
|
|
1556
|
+
get: () => s
|
|
1557
|
+
},
|
|
1558
|
+
pendingCount: {
|
|
1559
|
+
get: () => e.size
|
|
1560
|
+
},
|
|
1561
|
+
clearQueue: {
|
|
1562
|
+
value() {
|
|
1563
|
+
if (!t) {
|
|
1564
|
+
e.clear();
|
|
1565
|
+
return;
|
|
1566
|
+
}
|
|
1567
|
+
const a = AbortSignal.abort().reason;
|
|
1568
|
+
for (; e.size > 0; )
|
|
1569
|
+
e.dequeue().reject(a);
|
|
1570
|
+
}
|
|
1571
|
+
},
|
|
1572
|
+
concurrency: {
|
|
1573
|
+
get: () => n,
|
|
1574
|
+
set(a) {
|
|
1575
|
+
Ct(a), n = a, queueMicrotask(() => {
|
|
1576
|
+
for (; s < n && e.size > 0; )
|
|
1577
|
+
i();
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
},
|
|
1581
|
+
map: {
|
|
1582
|
+
async value(a, h) {
|
|
1583
|
+
const l = Array.from(a, (f, d) => this(h, f, d));
|
|
1584
|
+
return Promise.all(l);
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
}), p;
|
|
1588
|
+
}
|
|
1589
|
+
function Ct(n) {
|
|
1590
|
+
if (!((Number.isInteger(n) || n === Number.POSITIVE_INFINITY) && n > 0))
|
|
1591
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
1592
|
+
}
|
|
1593
|
+
const bs = ne(ee);
|
|
1594
|
+
function Ss(n) {
|
|
1595
|
+
if (n.length < 2) return "never";
|
|
1596
|
+
const t = [...n].sort((i, r) => i - r);
|
|
1597
|
+
let e = 0;
|
|
1598
|
+
for (let i = 1; i < t.length; i++)
|
|
1599
|
+
e += t[i] - t[i - 1];
|
|
1600
|
+
const s = e / (t.length - 1) / 864e5;
|
|
1601
|
+
return s <= 1 ? "daily" : s <= 7 ? "weekly" : s <= 30 ? "monthly" : s <= 365 ? "yearly" : "never";
|
|
1602
|
+
}
|
|
1603
|
+
function Os(n) {
|
|
1604
|
+
const t = n.pageEntryPattern;
|
|
1605
|
+
let e = n.rootDir ?? "", s = n.outputFile ?? "";
|
|
1606
|
+
const i = n.concurrency ?? 20, r = n.commitCount ?? 10, o = n.ignoreDeps ? Array.isArray(n.ignoreDeps) ? n.ignoreDeps : [n.ignoreDeps] : [], u = {};
|
|
1607
|
+
let p;
|
|
1608
|
+
return {
|
|
1609
|
+
name: "vite-last-modified",
|
|
1610
|
+
async configResolved(a) {
|
|
1611
|
+
p = a.build.ssr, e || (e = a.root), s || (s = te(e, "last-modified.json"));
|
|
1612
|
+
},
|
|
1613
|
+
async buildEnd() {
|
|
1614
|
+
if (p || process.env.NODE_ENV !== "production")
|
|
1615
|
+
return;
|
|
1616
|
+
const a = /* @__PURE__ */ new Map(), h = Es(i), l = (x) => {
|
|
1617
|
+
if (a.has(x))
|
|
1618
|
+
return a.get(x);
|
|
1619
|
+
const E = h(async () => {
|
|
1620
|
+
try {
|
|
1621
|
+
const S = x.includes("?") ? x.slice(0, x.indexOf("?")) : x, m = Qt.relative(e, S).replace(/\\/g, "/"), { stdout: T } = await bs(`git log --follow -n ${r} --format=%at -- "${m}"`, { cwd: e });
|
|
1622
|
+
return T.trim() ? T.trim().split(`
|
|
1623
|
+
`).map(($) => parseInt($, 10) * 1e3) : [];
|
|
1624
|
+
} catch {
|
|
1625
|
+
return [];
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
return a.set(x, E), E;
|
|
1629
|
+
}, f = (x, E) => {
|
|
1630
|
+
if (E.has(x)) return;
|
|
1631
|
+
E.add(x);
|
|
1632
|
+
const S = this.getModuleInfo(x);
|
|
1633
|
+
if (S)
|
|
1634
|
+
for (const m of S.importedIds) {
|
|
1635
|
+
if (m.includes("node_modules") || !m.startsWith(e))
|
|
1636
|
+
continue;
|
|
1637
|
+
const T = m.slice(e.length).replace(/^\/?/, "").split("?")[0];
|
|
1638
|
+
o.some(($) => O(T, $, { dot: !0 })) || f(m, E);
|
|
1639
|
+
}
|
|
1640
|
+
}, d = [...this.getModuleIds()].filter((x) => {
|
|
1641
|
+
if (!x.startsWith(e))
|
|
1642
|
+
return !1;
|
|
1643
|
+
const E = x.slice(e.length).replace(/^\//, "");
|
|
1644
|
+
return typeof t == "string" ? O(E, t, { dot: !0 }) : t.test(E);
|
|
1645
|
+
});
|
|
1646
|
+
if (d.length === 0) {
|
|
1647
|
+
console.warn("[lastModifiedPlugin] No MD files found in module graph");
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
console.log("[lastModifiedPlugin] start collect entry files deps");
|
|
1651
|
+
let g = /* @__PURE__ */ new Map();
|
|
1652
|
+
for (const x of d) {
|
|
1653
|
+
const E = /* @__PURE__ */ new Set();
|
|
1654
|
+
f(x, E), g.set(x, E);
|
|
1655
|
+
}
|
|
1656
|
+
if (console.log(`[lastModifiedPlugin] Analyzed ${d.length} entry files`), typeof n.modifyDepMap == "function") {
|
|
1657
|
+
const x = await n.modifyDepMap(g);
|
|
1658
|
+
x && x instanceof Map && (g = x);
|
|
1659
|
+
}
|
|
1660
|
+
const y = /* @__PURE__ */ new Set();
|
|
1661
|
+
for (const x of g.values())
|
|
1662
|
+
for (const E of x)
|
|
1663
|
+
y.add(E);
|
|
1664
|
+
await Promise.all([...y].map(l));
|
|
1665
|
+
for (const [x, E] of g) {
|
|
1666
|
+
const S = x.slice(e.length).replace(/^\//, ""), m = (await Promise.all([...E].map(l))).flat(), T = m.length > 0 ? Math.max(...m) : 0, $ = Ss(m);
|
|
1667
|
+
u[S] = { lastmod: T, changefreq: $ };
|
|
1668
|
+
}
|
|
1669
|
+
},
|
|
1670
|
+
closeBundle() {
|
|
1671
|
+
if (p || process.env.NODE_ENV !== "production")
|
|
1672
|
+
return;
|
|
1673
|
+
const a = Object.fromEntries(Object.entries(u).sort(([h], [l]) => h.localeCompare(l)));
|
|
1674
|
+
se(s, JSON.stringify(a, null, 2), "utf8"), console.log(`[lastModifiedPlugin] Written ${s}`);
|
|
305
1675
|
}
|
|
306
1676
|
};
|
|
307
1677
|
}
|
|
308
1678
|
export {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
1679
|
+
ks as CheckThemePlugin,
|
|
1680
|
+
Cs as createExternalLinkGuard,
|
|
1681
|
+
Os as generateLastmodAndChangefreq,
|
|
1682
|
+
js as initOpenDesignAnalytics,
|
|
1683
|
+
Ds as oaReport,
|
|
1684
|
+
Ps as vAnalytics
|
|
315
1685
|
};
|