@opendesign-plus-test/plugins 0.0.1-rc.26 → 0.0.1-rc.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1483 +0,0 @@
1
- var Kt = Object.defineProperty;
2
- var bt = (n) => {
3
- throw TypeError(n);
4
- };
5
- var Qt = (n, t, e) => t in n ? Kt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
- var O = (n, t, e) => Qt(n, typeof t != "symbol" ? t + "" : t, e), ht = (n, t, e) => t.has(n) || bt("Cannot " + e);
7
- var o = (n, t, e) => (ht(n, t, "read from private field"), e ? e.call(n) : t.get(n)), T = (n, t, e) => t.has(n) ? bt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), E = (n, t, e, s) => (ht(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), P = (n, t, e) => (ht(n, t, "access private method"), e);
8
- var ft = (n, t, e, s) => ({
9
- set _(i) {
10
- E(n, t, i, e);
11
- },
12
- get _() {
13
- return o(n, t, s);
14
- }
15
- });
16
- import { defineNuxtModule as Yt, addVitePlugin as te } from "nuxt/kit";
17
- import { writeFileSync as Wt, existsSync as Et, readFileSync as ee, createWriteStream as se, readdirSync as ne } from "node:fs";
18
- import ie, { resolve as re, join as Y, relative as oe } from "node:path";
19
- import { pipeline as ae } from "node:stream/promises";
20
- import { exec as le } from "node:child_process";
21
- import { promisify as ce } from "node:util";
22
- const Rt = (n, t, e) => {
23
- const s = n instanceof RegExp ? Mt(n, e) : n, i = t instanceof RegExp ? Mt(t, e) : t, r = s !== null && i != null && he(s, i, e);
24
- return r && {
25
- start: r[0],
26
- end: r[1],
27
- pre: e.slice(0, r[0]),
28
- body: e.slice(r[0] + s.length, r[1]),
29
- post: e.slice(r[1] + i.length)
30
- };
31
- }, Mt = (n, t) => {
32
- const e = t.match(n);
33
- return e ? e[0] : null;
34
- }, he = (n, t, e) => {
35
- let s, i, r, a, h, p = e.indexOf(n), c = e.indexOf(t, p + 1), f = p;
36
- if (p >= 0 && c > 0) {
37
- if (n === t)
38
- return [p, c];
39
- for (s = [], r = e.length; f >= 0 && !h; ) {
40
- if (f === p)
41
- s.push(f), p = e.indexOf(n, f + 1);
42
- else if (s.length === 1) {
43
- const l = s.pop();
44
- l !== void 0 && (h = [l, c]);
45
- } else
46
- i = s.pop(), i !== void 0 && i < r && (r = i, a = c), c = e.indexOf(t, f + 1);
47
- f = p < c && p >= 0 ? p : c;
48
- }
49
- s.length && a !== void 0 && (h = [r, a]);
50
- }
51
- return h;
52
- }, Ct = "\0SLASH" + Math.random() + "\0", Dt = "\0OPEN" + Math.random() + "\0", wt = "\0CLOSE" + Math.random() + "\0", kt = "\0COMMA" + Math.random() + "\0", Lt = "\0PERIOD" + Math.random() + "\0", fe = new RegExp(Ct, "g"), ue = new RegExp(Dt, "g"), pe = new RegExp(wt, "g"), ge = new RegExp(kt, "g"), de = new RegExp(Lt, "g"), me = /\\\\/g, ye = /\\{/g, we = /\\}/g, xe = /\\,/g, Se = /\\\./g, be = 1e5;
53
- function ut(n) {
54
- return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
55
- }
56
- function Ee(n) {
57
- return n.replace(me, Ct).replace(ye, Dt).replace(we, wt).replace(xe, kt).replace(Se, Lt);
58
- }
59
- function Me(n) {
60
- return n.replace(fe, "\\").replace(ue, "{").replace(pe, "}").replace(ge, ",").replace(de, ".");
61
- }
62
- function qt(n) {
63
- if (!n)
64
- return [""];
65
- const t = [], e = Rt("{", "}", n);
66
- if (!e)
67
- return n.split(",");
68
- const { pre: s, body: i, post: r } = e, a = s.split(",");
69
- a[a.length - 1] += "{" + i + "}";
70
- const h = qt(r);
71
- return r.length && (a[a.length - 1] += h.shift(), a.push.apply(a, h)), t.push.apply(t, a), t;
72
- }
73
- function $e(n, t = {}) {
74
- if (!n)
75
- return [];
76
- const { max: e = be } = t;
77
- return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), et(Ee(n), e, !0).map(Me);
78
- }
79
- function Pe(n) {
80
- return "{" + n + "}";
81
- }
82
- function Ae(n) {
83
- return /^-?0\d/.test(n);
84
- }
85
- function Ne(n, t) {
86
- return n <= t;
87
- }
88
- function Oe(n, t) {
89
- return n >= t;
90
- }
91
- function et(n, t, e) {
92
- const s = [], i = Rt("{", "}", n);
93
- if (!i)
94
- return [n];
95
- const r = i.pre, a = i.post.length ? et(i.post, t, !1) : [""];
96
- if (/\$$/.test(i.pre))
97
- for (let h = 0; h < a.length && h < t; h++) {
98
- const p = r + "{" + i.body + "}" + a[h];
99
- s.push(p);
100
- }
101
- else {
102
- const h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), p = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), c = h || p, f = i.body.indexOf(",") >= 0;
103
- if (!c && !f)
104
- return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + wt + i.post, et(n, t, !0)) : [n];
105
- let l;
106
- if (c)
107
- l = i.body.split(/\.\./);
108
- else if (l = qt(i.body), l.length === 1 && l[0] !== void 0 && (l = et(l[0], t, !1).map(Pe), l.length === 1))
109
- return a.map((m) => i.pre + l[0] + m);
110
- let u;
111
- if (c && l[0] !== void 0 && l[1] !== void 0) {
112
- const m = ut(l[0]), y = ut(l[1]), S = Math.max(l[0].length, l[1].length);
113
- let g = l.length === 3 && l[2] !== void 0 ? Math.max(Math.abs(ut(l[2])), 1) : 1, x = Ne;
114
- y < m && (g *= -1, x = Oe);
115
- const d = l.some(Ae);
116
- u = [];
117
- for (let $ = m; x($, y); $ += g) {
118
- let b;
119
- if (p)
120
- b = String.fromCharCode($), b === "\\" && (b = "");
121
- else if (b = String($), d) {
122
- const k = S - b.length;
123
- if (k > 0) {
124
- const H = new Array(k + 1).join("0");
125
- $ < 0 ? b = "-" + H + b.slice(1) : b = H + b;
126
- }
127
- }
128
- u.push(b);
129
- }
130
- } else {
131
- u = [];
132
- for (let m = 0; m < l.length; m++)
133
- u.push.apply(u, et(l[m], t, !1));
134
- }
135
- for (let m = 0; m < u.length; m++)
136
- for (let y = 0; y < a.length && s.length < t; y++) {
137
- const S = r + u[m] + a[y];
138
- (!e || c || S) && s.push(S);
139
- }
140
- }
141
- return s;
142
- }
143
- const ve = 1024 * 64, at = (n) => {
144
- if (typeof n != "string")
145
- throw new TypeError("invalid pattern");
146
- if (n.length > ve)
147
- throw new TypeError("pattern is too long");
148
- }, Te = {
149
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
150
- "[:alpha:]": ["\\p{L}\\p{Nl}", !0],
151
- "[:ascii:]": ["\\x00-\\x7f", !1],
152
- "[:blank:]": ["\\p{Zs}\\t", !0],
153
- "[:cntrl:]": ["\\p{Cc}", !0],
154
- "[:digit:]": ["\\p{Nd}", !0],
155
- "[:graph:]": ["\\p{Z}\\p{C}", !0, !0],
156
- "[:lower:]": ["\\p{Ll}", !0],
157
- "[:print:]": ["\\p{C}", !0],
158
- "[:punct:]": ["\\p{P}", !0],
159
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
160
- "[:upper:]": ["\\p{Lu}", !0],
161
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
162
- "[:xdigit:]": ["A-Fa-f0-9", !1]
163
- }, tt = (n) => n.replace(/[[\]\\-]/g, "\\$&"), je = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), $t = (n) => n.join(""), We = (n, t) => {
164
- const e = t;
165
- if (n.charAt(e) !== "[")
166
- throw new Error("not in a brace expression");
167
- const s = [], i = [];
168
- let r = e + 1, a = !1, h = !1, p = !1, c = !1, f = e, l = "";
169
- t: for (; r < n.length; ) {
170
- const S = n.charAt(r);
171
- if ((S === "!" || S === "^") && r === e + 1) {
172
- c = !0, r++;
173
- continue;
174
- }
175
- if (S === "]" && a && !p) {
176
- f = r + 1;
177
- break;
178
- }
179
- if (a = !0, S === "\\" && !p) {
180
- p = !0, r++;
181
- continue;
182
- }
183
- if (S === "[" && !p) {
184
- for (const [g, [x, M, d]] of Object.entries(Te))
185
- if (n.startsWith(g, r)) {
186
- if (l)
187
- return ["$.", !1, n.length - e, !0];
188
- r += g.length, d ? i.push(x) : s.push(x), h = h || M;
189
- continue t;
190
- }
191
- }
192
- if (p = !1, l) {
193
- S > l ? s.push(tt(l) + "-" + tt(S)) : S === l && s.push(tt(S)), l = "", r++;
194
- continue;
195
- }
196
- if (n.startsWith("-]", r + 1)) {
197
- s.push(tt(S + "-")), r += 2;
198
- continue;
199
- }
200
- if (n.startsWith("-", r + 1)) {
201
- l = S, r += 2;
202
- continue;
203
- }
204
- s.push(tt(S)), r++;
205
- }
206
- if (f < r)
207
- return ["", !1, 0, !1];
208
- if (!s.length && !i.length)
209
- return ["$.", !1, n.length - e, !0];
210
- if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !c) {
211
- const S = s[0].length === 2 ? s[0].slice(-1) : s[0];
212
- return [je(S), !1, f - e, !1];
213
- }
214
- const u = "[" + (c ? "^" : "") + $t(s) + "]", m = "[" + (c ? "" : "^") + $t(i) + "]";
215
- return [s.length && i.length ? "(" + u + "|" + m + ")" : s.length ? u : m, h, f - e, !0];
216
- }, st = (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");
217
- var C;
218
- const Re = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), pt = (n) => Re.has(n), Pt = (n) => pt(n.type), Ce = /* @__PURE__ */ new Map([
219
- ["!", ["@"]],
220
- ["?", ["?", "@"]],
221
- ["@", ["@"]],
222
- ["*", ["*", "+", "?", "@"]],
223
- ["+", ["+", "@"]]
224
- ]), De = /* @__PURE__ */ new Map([
225
- ["!", ["?"]],
226
- ["@", ["?"]],
227
- ["+", ["?", "*"]]
228
- ]), ke = /* @__PURE__ */ new Map([
229
- ["!", ["?", "@"]],
230
- ["?", ["?", "@"]],
231
- ["@", ["?", "@"]],
232
- ["*", ["*", "+", "?", "@"]],
233
- ["+", ["+", "@", "?", "*"]]
234
- ]), At = /* @__PURE__ */ new Map([
235
- ["!", /* @__PURE__ */ new Map([["!", "@"]])],
236
- [
237
- "?",
238
- /* @__PURE__ */ new Map([
239
- ["*", "*"],
240
- ["+", "*"]
241
- ])
242
- ],
243
- [
244
- "@",
245
- /* @__PURE__ */ new Map([
246
- ["!", "!"],
247
- ["?", "?"],
248
- ["@", "@"],
249
- ["*", "*"],
250
- ["+", "+"]
251
- ])
252
- ],
253
- [
254
- "+",
255
- /* @__PURE__ */ new Map([
256
- ["?", "*"],
257
- ["*", "*"]
258
- ])
259
- ]
260
- ]), Le = "(?!(?:^|/)\\.\\.?(?:$|/))", nt = "(?!\\.)", qe = /* @__PURE__ */ new Set(["[", "."]), ze = /* @__PURE__ */ new Set(["..", "."]), _e = new Set("().*{}+?[]^$\\!"), Ge = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), xt = "[^/]", Nt = xt + "*?", Ot = xt + "+?";
261
- let Fe = 0;
262
- var v, j, F, w, N, B, Z, I, z, _, Q, A, zt, J, it, _t, gt, rt, Gt, dt, Ft, Bt, It, ot, mt, Ut;
263
- class lt {
264
- constructor(t, e, s = {}) {
265
- T(this, A);
266
- O(this, "type");
267
- T(this, v);
268
- T(this, j);
269
- T(this, F, !1);
270
- T(this, w, []);
271
- T(this, N);
272
- T(this, B);
273
- T(this, Z);
274
- T(this, I, !1);
275
- T(this, z);
276
- T(this, _);
277
- // set to true if it's an extglob with no children
278
- // (which really means one child of '')
279
- T(this, Q, !1);
280
- O(this, "id", ++Fe);
281
- this.type = t, t && E(this, j, !0), E(this, N, e), E(this, v, o(this, N) ? o(o(this, N), v) : this), E(this, z, o(this, v) === this ? s : o(o(this, v), z)), E(this, Z, o(this, v) === this ? [] : o(o(this, v), Z)), t === "!" && !o(o(this, v), I) && o(this, Z).push(this), E(this, B, o(this, N) ? o(o(this, N), w).length : 0);
282
- }
283
- get depth() {
284
- var t;
285
- return (((t = o(this, N)) == null ? void 0 : t.depth) ?? -1) + 1;
286
- }
287
- [Symbol.for("nodejs.util.inspect.custom")]() {
288
- var t;
289
- return {
290
- "@@type": "AST",
291
- id: this.id,
292
- type: this.type,
293
- root: o(this, v).id,
294
- parent: (t = o(this, N)) == null ? void 0 : t.id,
295
- depth: this.depth,
296
- partsLength: o(this, w).length,
297
- parts: o(this, w)
298
- };
299
- }
300
- get hasMagic() {
301
- if (o(this, j) !== void 0)
302
- return o(this, j);
303
- for (const t of o(this, w))
304
- if (typeof t != "string" && (t.type || t.hasMagic))
305
- return E(this, j, !0);
306
- return o(this, j);
307
- }
308
- // reconstructs the pattern
309
- toString() {
310
- return o(this, _) !== void 0 ? o(this, _) : this.type ? E(this, _, this.type + "(" + o(this, w).map((t) => String(t)).join("|") + ")") : E(this, _, o(this, w).map((t) => String(t)).join(""));
311
- }
312
- push(...t) {
313
- for (const e of t)
314
- if (e !== "") {
315
- if (typeof e != "string" && !(e instanceof C && o(e, N) === this))
316
- throw new Error("invalid part: " + e);
317
- o(this, w).push(e);
318
- }
319
- }
320
- toJSON() {
321
- var e;
322
- const t = this.type === null ? o(this, w).slice().map((s) => typeof s == "string" ? s : s.toJSON()) : [this.type, ...o(this, w).map((s) => s.toJSON())];
323
- return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === o(this, v) || o(o(this, v), I) && ((e = o(this, N)) == null ? void 0 : e.type) === "!") && t.push({}), t;
324
- }
325
- isStart() {
326
- var e;
327
- if (o(this, v) === this)
328
- return !0;
329
- if (!((e = o(this, N)) != null && e.isStart()))
330
- return !1;
331
- if (o(this, B) === 0)
332
- return !0;
333
- const t = o(this, N);
334
- for (let s = 0; s < o(this, B); s++) {
335
- const i = o(t, w)[s];
336
- if (!(i instanceof C && i.type === "!"))
337
- return !1;
338
- }
339
- return !0;
340
- }
341
- isEnd() {
342
- var e, s, i;
343
- if (o(this, v) === this || ((e = o(this, N)) == null ? void 0 : e.type) === "!")
344
- return !0;
345
- if (!((s = o(this, N)) != null && s.isEnd()))
346
- return !1;
347
- if (!this.type)
348
- return (i = o(this, N)) == null ? void 0 : i.isEnd();
349
- const t = o(this, N) ? o(o(this, N), w).length : 0;
350
- return o(this, B) === t - 1;
351
- }
352
- copyIn(t) {
353
- typeof t == "string" ? this.push(t) : this.push(t.clone(this));
354
- }
355
- clone(t) {
356
- const e = new C(this.type, t);
357
- for (const s of o(this, w))
358
- e.copyIn(s);
359
- return e;
360
- }
361
- static fromGlob(t, e = {}) {
362
- var i;
363
- const s = new C(null, void 0, e);
364
- return P(i = C, J, it).call(i, t, s, 0, e, 0), s;
365
- }
366
- // returns the regular expression if there's magic, or the unescaped
367
- // string if not.
368
- toMMPattern() {
369
- if (this !== o(this, v))
370
- return o(this, v).toMMPattern();
371
- const t = this.toString(), [e, s, i, r] = this.toRegExpSource();
372
- if (!(i || o(this, j) || o(this, z).nocase && !o(this, z).nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
373
- return s;
374
- const h = (o(this, z).nocase ? "i" : "") + (r ? "u" : "");
375
- return Object.assign(new RegExp(`^${e}$`, h), {
376
- _src: e,
377
- _glob: t
378
- });
379
- }
380
- get options() {
381
- return o(this, z);
382
- }
383
- // returns the string match, the regexp source, whether there's magic
384
- // in the regexp (so a regular expression is required) and whether or
385
- // not the uflag is needed for the regular expression (for posix classes)
386
- // TODO: instead of injecting the start/end at this point, just return
387
- // the BODY of the regexp, along with the start/end portions suitable
388
- // for binding the start/end in either a joined full-path makeRe context
389
- // (where we bind to (^|/), or a standalone matchPart context (where
390
- // we bind to ^, and not /). Otherwise slashes get duped!
391
- //
392
- // In part-matching mode, the start is:
393
- // - if not isStart: nothing
394
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
395
- // - if dots allowed or not possible: ^
396
- // - if dots possible and not allowed: ^(?!\.)
397
- // end is:
398
- // - if not isEnd(): nothing
399
- // - else: $
400
- //
401
- // In full-path matching mode, we put the slash at the START of the
402
- // pattern, so start is:
403
- // - if first pattern: same as part-matching mode
404
- // - if not isStart(): nothing
405
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
406
- // - if dots allowed or not possible: /
407
- // - if dots possible and not allowed: /(?!\.)
408
- // end is:
409
- // - if last pattern, same as part-matching mode
410
- // - else nothing
411
- //
412
- // Always put the (?:$|/) on negated tails, though, because that has to be
413
- // there to bind the end of the negated pattern portion, and it's easier to
414
- // just stick it in now rather than try to inject it later in the middle of
415
- // the pattern.
416
- //
417
- // We can just always return the same end, and leave it up to the caller
418
- // to know whether it's going to be used joined or in parts.
419
- // And, if the start is adjusted slightly, can do the same there:
420
- // - if not isStart: nothing
421
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
422
- // - if dots allowed or not possible: (?:/|^)
423
- // - if dots possible and not allowed: (?:/|^)(?!\.)
424
- //
425
- // But it's better to have a simpler binding without a conditional, for
426
- // performance, so probably better to return both start options.
427
- //
428
- // Then the caller just ignores the end if it's not the first pattern,
429
- // and the start always gets applied.
430
- //
431
- // But that's always going to be $ if it's the ending pattern, or nothing,
432
- // so the caller can just attach $ at the end of the pattern when building.
433
- //
434
- // So the todo is:
435
- // - better detect what kind of start is needed
436
- // - return both flavors of starting pattern
437
- // - attach $ at the end of the pattern when creating the actual RegExp
438
- //
439
- // Ah, but wait, no, that all only applies to the root when the first pattern
440
- // is not an extglob. If the first pattern IS an extglob, then we need all
441
- // that dot prevention biz to live in the extglob portions, because eg
442
- // +(*|.x*) can match .xy but not .yx.
443
- //
444
- // So, return the two flavors if it's #root and the first child is not an
445
- // AST, otherwise leave it to the child AST to handle it, and there,
446
- // use the (?:^|/) style of start binding.
447
- //
448
- // Even simplified further:
449
- // - Since the start for a join is eg /(?!\.) and the start for a part
450
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
451
- // or start or whatever) and prepend ^ or / at the Regexp construction.
452
- toRegExpSource(t) {
453
- var p;
454
- const e = t ?? !!o(this, z).dot;
455
- if (o(this, v) === this && (P(this, A, ot).call(this), P(this, A, zt).call(this)), !Pt(this)) {
456
- const c = this.isStart() && this.isEnd() && !o(this, w).some((y) => typeof y != "string"), f = o(this, w).map((y) => {
457
- var d;
458
- const [S, g, x, M] = typeof y == "string" ? P(d = C, J, Ut).call(d, y, o(this, j), c) : y.toRegExpSource(t);
459
- return E(this, j, o(this, j) || x), E(this, F, o(this, F) || M), S;
460
- }).join("");
461
- let l = "";
462
- if (this.isStart() && typeof o(this, w)[0] == "string" && !(o(this, w).length === 1 && ze.has(o(this, w)[0]))) {
463
- const S = qe, g = (
464
- // dots are allowed, and the pattern starts with [ or .
465
- e && S.has(f.charAt(0)) || // the pattern starts with \., and then [ or .
466
- f.startsWith("\\.") && S.has(f.charAt(2)) || // the pattern starts with \.\., and then [ or .
467
- f.startsWith("\\.\\.") && S.has(f.charAt(4))
468
- ), x = !e && !t && S.has(f.charAt(0));
469
- l = g ? Le : x ? nt : "";
470
- }
471
- let u = "";
472
- return this.isEnd() && o(o(this, v), I) && ((p = o(this, N)) == null ? void 0 : p.type) === "!" && (u = "(?:$|\\/)"), [
473
- l + f + u,
474
- st(f),
475
- E(this, j, !!o(this, j)),
476
- o(this, F)
477
- ];
478
- }
479
- const s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:";
480
- let r = P(this, A, mt).call(this, e);
481
- if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
482
- const c = this.toString(), f = this;
483
- return E(f, w, [c]), f.type = null, E(f, j, void 0), [c, st(this.toString()), !1, !1];
484
- }
485
- let a = !s || t || e || !nt ? "" : P(this, A, mt).call(this, !0);
486
- a === r && (a = ""), a && (r = `(?:${r})(?:${a})*?`);
487
- let h = "";
488
- if (this.type === "!" && o(this, Q))
489
- h = (this.isStart() && !e ? nt : "") + Ot;
490
- else {
491
- const c = this.type === "!" ? (
492
- // !() must match something,but !(x) can match ''
493
- "))" + (this.isStart() && !e && !t ? nt : "") + Nt + ")"
494
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && a ? ")" : this.type === "*" && a ? ")?" : `)${this.type}`;
495
- h = i + r + c;
496
- }
497
- return [
498
- h,
499
- st(r),
500
- E(this, j, !!o(this, j)),
501
- o(this, F)
502
- ];
503
- }
504
- }
505
- v = new WeakMap(), j = new WeakMap(), F = new WeakMap(), w = new WeakMap(), N = new WeakMap(), B = new WeakMap(), Z = new WeakMap(), I = new WeakMap(), z = new WeakMap(), _ = new WeakMap(), Q = new WeakMap(), A = new WeakSet(), zt = function() {
506
- if (this !== o(this, v))
507
- throw new Error("should only call on root");
508
- if (o(this, I))
509
- return this;
510
- this.toString(), E(this, I, !0);
511
- let t;
512
- for (; t = o(this, Z).pop(); ) {
513
- if (t.type !== "!")
514
- continue;
515
- let e = t, s = o(e, N);
516
- for (; s; ) {
517
- for (let i = o(e, B) + 1; !s.type && i < o(s, w).length; i++)
518
- for (const r of o(t, w)) {
519
- if (typeof r == "string")
520
- throw new Error("string part in extglob AST??");
521
- r.copyIn(o(s, w)[i]);
522
- }
523
- e = s, s = o(e, N);
524
- }
525
- }
526
- return this;
527
- }, J = new WeakSet(), it = function(t, e, s, i, r) {
528
- var S, g, x, M;
529
- const a = i.maxExtglobRecursion ?? 2;
530
- let h = !1, p = !1, c = -1, f = !1;
531
- if (e.type === null) {
532
- let d = s, $ = "";
533
- for (; d < t.length; ) {
534
- const b = t.charAt(d++);
535
- if (h || b === "\\") {
536
- h = !h, $ += b;
537
- continue;
538
- }
539
- if (p) {
540
- d === c + 1 ? (b === "^" || b === "!") && (f = !0) : b === "]" && !(d === c + 2 && f) && (p = !1), $ += b;
541
- continue;
542
- } else if (b === "[") {
543
- p = !0, c = d, f = !1, $ += b;
544
- continue;
545
- }
546
- if (!i.noext && pt(b) && t.charAt(d) === "(" && r <= a) {
547
- e.push($), $ = "";
548
- const H = new C(b, e);
549
- d = P(S = C, J, it).call(S, t, H, d, i, r + 1), e.push(H);
550
- continue;
551
- }
552
- $ += b;
553
- }
554
- return e.push($), d;
555
- }
556
- let l = s + 1, u = new C(null, e);
557
- const m = [];
558
- let y = "";
559
- for (; l < t.length; ) {
560
- const d = t.charAt(l++);
561
- if (h || d === "\\") {
562
- h = !h, y += d;
563
- continue;
564
- }
565
- if (p) {
566
- l === c + 1 ? (d === "^" || d === "!") && (f = !0) : d === "]" && !(l === c + 2 && f) && (p = !1), y += d;
567
- continue;
568
- } else if (d === "[") {
569
- p = !0, c = l, f = !1, y += d;
570
- continue;
571
- }
572
- if (!i.noext && pt(d) && t.charAt(l) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
573
- (r <= a || e && P(g = e, A, rt).call(g, d))) {
574
- const b = e && P(x = e, A, rt).call(x, d) ? 0 : 1;
575
- u.push(y), y = "";
576
- const k = new C(d, u);
577
- u.push(k), l = P(M = C, J, it).call(M, t, k, l, i, r + b);
578
- continue;
579
- }
580
- if (d === "|") {
581
- u.push(y), y = "", m.push(u), u = new C(null, e);
582
- continue;
583
- }
584
- if (d === ")")
585
- return y === "" && o(e, w).length === 0 && E(e, Q, !0), u.push(y), y = "", e.push(...m, u), l;
586
- y += d;
587
- }
588
- return e.type = null, E(e, j, void 0), E(e, w, [t.substring(s - 1)]), l;
589
- }, _t = function(t) {
590
- return P(this, A, gt).call(this, t, De);
591
- }, gt = function(t, e = Ce) {
592
- if (!t || typeof t != "object" || t.type !== null || o(t, w).length !== 1 || this.type === null)
593
- return !1;
594
- const s = o(t, w)[0];
595
- return !s || typeof s != "object" || s.type === null ? !1 : P(this, A, rt).call(this, s.type, e);
596
- }, rt = function(t, e = ke) {
597
- var s;
598
- return !!((s = e.get(this.type)) != null && s.includes(t));
599
- }, Gt = function(t, e) {
600
- const s = o(t, w)[0], i = new C(null, s, this.options);
601
- o(i, w).push(""), s.push(i), P(this, A, dt).call(this, t, e);
602
- }, dt = function(t, e) {
603
- const s = o(t, w)[0];
604
- o(this, w).splice(e, 1, ...o(s, w));
605
- for (const i of o(s, w))
606
- typeof i == "object" && E(i, N, this);
607
- E(this, _, void 0);
608
- }, Ft = function(t) {
609
- const e = At.get(this.type);
610
- return !!(e != null && e.has(t));
611
- }, Bt = function(t) {
612
- if (!t || typeof t != "object" || t.type !== null || o(t, w).length !== 1 || this.type === null || o(this, w).length !== 1)
613
- return !1;
614
- const e = o(t, w)[0];
615
- return !e || typeof e != "object" || e.type === null ? !1 : P(this, A, Ft).call(this, e.type);
616
- }, It = function(t) {
617
- const e = At.get(this.type), s = o(t, w)[0], i = e == null ? void 0 : e.get(s.type);
618
- if (!i)
619
- return !1;
620
- E(this, w, o(s, w));
621
- for (const r of o(this, w))
622
- typeof r == "object" && E(r, N, this);
623
- this.type = i, E(this, _, void 0), E(this, Q, !1);
624
- }, ot = function() {
625
- var t, e;
626
- if (Pt(this)) {
627
- let s = 0, i = !1;
628
- do {
629
- i = !0;
630
- for (let r = 0; r < o(this, w).length; r++) {
631
- const a = o(this, w)[r];
632
- typeof a == "object" && (P(e = a, A, ot).call(e), P(this, A, gt).call(this, a) ? (i = !1, P(this, A, dt).call(this, a, r)) : P(this, A, _t).call(this, a) ? (i = !1, P(this, A, Gt).call(this, a, r)) : P(this, A, Bt).call(this, a) && (i = !1, P(this, A, It).call(this, a)));
633
- }
634
- } while (!i && ++s < 10);
635
- } else
636
- for (const s of o(this, w))
637
- typeof s == "object" && P(t = s, A, ot).call(t);
638
- E(this, _, void 0);
639
- }, mt = function(t) {
640
- return o(this, w).map((e) => {
641
- if (typeof e == "string")
642
- throw new Error("string type in extglob ast??");
643
- const [s, i, r, a] = e.toRegExpSource(t);
644
- return E(this, F, o(this, F) || a), s;
645
- }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
646
- }, Ut = function(t, e, s = !1) {
647
- let i = !1, r = "", a = !1, h = !1;
648
- for (let p = 0; p < t.length; p++) {
649
- const c = t.charAt(p);
650
- if (i) {
651
- i = !1, r += (_e.has(c) ? "\\" : "") + c;
652
- continue;
653
- }
654
- if (c === "*") {
655
- if (h)
656
- continue;
657
- h = !0, r += s && /^[*]+$/.test(t) ? Ot : Nt, e = !0;
658
- continue;
659
- } else
660
- h = !1;
661
- if (c === "\\") {
662
- p === t.length - 1 ? r += "\\\\" : i = !0;
663
- continue;
664
- }
665
- if (c === "[") {
666
- const [f, l, u, m] = We(t, p);
667
- if (u) {
668
- r += f, a = a || l, p += u - 1, e = e || m;
669
- continue;
670
- }
671
- }
672
- if (c === "?") {
673
- r += xt, e = !0;
674
- continue;
675
- }
676
- r += Ge(c);
677
- }
678
- return [r, st(t), !!e, a];
679
- }, T(lt, J);
680
- C = lt;
681
- const Be = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&"), W = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new ct(t, e).match(n)), Ie = /^\*+([^+@!?*[(]*)$/, Ue = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Je = (n) => (t) => t.endsWith(n), He = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ve = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ze = /^\*+\.\*+$/, Xe = (n) => !n.startsWith(".") && n.includes("."), Ke = (n) => n !== "." && n !== ".." && n.includes("."), Qe = /^\.\*+$/, Ye = (n) => n !== "." && n !== ".." && n.startsWith("."), ts = /^\*+$/, es = (n) => n.length !== 0 && !n.startsWith("."), ss = (n) => n.length !== 0 && n !== "." && n !== "..", ns = /^\?+([^+@!?*[(]*)?$/, is = ([n, t = ""]) => {
682
- const e = Jt([n]);
683
- return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
684
- }, rs = ([n, t = ""]) => {
685
- const e = Ht([n]);
686
- return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
687
- }, os = ([n, t = ""]) => {
688
- const e = Ht([n]);
689
- return t ? (s) => e(s) && s.endsWith(t) : e;
690
- }, as = ([n, t = ""]) => {
691
- const e = Jt([n]);
692
- return t ? (s) => e(s) && s.endsWith(t) : e;
693
- }, Jt = ([n]) => {
694
- const t = n.length;
695
- return (e) => e.length === t && !e.startsWith(".");
696
- }, Ht = ([n]) => {
697
- const t = n.length;
698
- return (e) => e.length === t && e !== "." && e !== "..";
699
- }, Vt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", vt = {
700
- win32: { sep: "\\" },
701
- posix: { sep: "/" }
702
- }, ls = Vt === "win32" ? vt.win32.sep : vt.posix.sep;
703
- W.sep = ls;
704
- const R = Symbol("globstar **");
705
- W.GLOBSTAR = R;
706
- const cs = "[^/]", hs = cs + "*?", fs = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", us = "(?:(?!(?:\\/|^)\\.).)*?", ps = (n, t = {}) => (e) => W(e, n, t);
707
- W.filter = ps;
708
- const q = (n, t = {}) => Object.assign({}, n, t), gs = (n) => {
709
- if (!n || typeof n != "object" || !Object.keys(n).length)
710
- return W;
711
- const t = W;
712
- return Object.assign((s, i, r = {}) => t(s, i, q(n, r)), {
713
- Minimatch: class extends t.Minimatch {
714
- constructor(i, r = {}) {
715
- super(i, q(n, r));
716
- }
717
- static defaults(i) {
718
- return t.defaults(q(n, i)).Minimatch;
719
- }
720
- },
721
- AST: class extends t.AST {
722
- /* c8 ignore start */
723
- constructor(i, r, a = {}) {
724
- super(i, r, q(n, a));
725
- }
726
- /* c8 ignore stop */
727
- static fromGlob(i, r = {}) {
728
- return t.AST.fromGlob(i, q(n, r));
729
- }
730
- },
731
- unescape: (s, i = {}) => t.unescape(s, q(n, i)),
732
- escape: (s, i = {}) => t.escape(s, q(n, i)),
733
- filter: (s, i = {}) => t.filter(s, q(n, i)),
734
- defaults: (s) => t.defaults(q(n, s)),
735
- makeRe: (s, i = {}) => t.makeRe(s, q(n, i)),
736
- braceExpand: (s, i = {}) => t.braceExpand(s, q(n, i)),
737
- match: (s, i, r = {}) => t.match(s, i, q(n, r)),
738
- sep: t.sep,
739
- GLOBSTAR: R
740
- });
741
- };
742
- W.defaults = gs;
743
- const Zt = (n, t = {}) => (at(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : $e(n, { max: t.braceExpandMax }));
744
- W.braceExpand = Zt;
745
- const ds = (n, t = {}) => new ct(n, t).makeRe();
746
- W.makeRe = ds;
747
- const ms = (n, t, e = {}) => {
748
- const s = new ct(t, e);
749
- return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
750
- };
751
- W.match = ms;
752
- const Tt = /[?*]|[+@!]\(.*?\)|\[|\]/, ys = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
753
- var L, Xt, yt, K;
754
- class ct {
755
- constructor(t, e = {}) {
756
- T(this, L);
757
- O(this, "options");
758
- O(this, "set");
759
- O(this, "pattern");
760
- O(this, "windowsPathsNoEscape");
761
- O(this, "nonegate");
762
- O(this, "negate");
763
- O(this, "comment");
764
- O(this, "empty");
765
- O(this, "preserveMultipleSlashes");
766
- O(this, "partial");
767
- O(this, "globSet");
768
- O(this, "globParts");
769
- O(this, "nocase");
770
- O(this, "isWindows");
771
- O(this, "platform");
772
- O(this, "windowsNoMagicRoot");
773
- O(this, "maxGlobstarRecursion");
774
- O(this, "regexp");
775
- at(t), e = e || {}, this.options = e, this.maxGlobstarRecursion = e.maxGlobstarRecursion ?? 200, this.pattern = t, this.platform = e.platform || Vt, this.isWindows = this.platform === "win32";
776
- const s = "allowWindowsEscape";
777
- 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();
778
- }
779
- hasMagic() {
780
- if (this.options.magicalBraces && this.set.length > 1)
781
- return !0;
782
- for (const t of this.set)
783
- for (const e of t)
784
- if (typeof e != "string")
785
- return !0;
786
- return !1;
787
- }
788
- debug(...t) {
789
- }
790
- make() {
791
- const t = this.pattern, e = this.options;
792
- if (!e.nocomment && t.charAt(0) === "#") {
793
- this.comment = !0;
794
- return;
795
- }
796
- if (!t) {
797
- this.empty = !0;
798
- return;
799
- }
800
- this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
801
- const s = this.globSet.map((r) => this.slashSplit(r));
802
- this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
803
- let i = this.globParts.map((r, a, h) => {
804
- if (this.isWindows && this.windowsNoMagicRoot) {
805
- const p = r[0] === "" && r[1] === "" && (r[2] === "?" || !Tt.test(r[2])) && !Tt.test(r[3]), c = /^[a-z]:/i.test(r[0]);
806
- if (p)
807
- return [
808
- ...r.slice(0, 4),
809
- ...r.slice(4).map((f) => this.parse(f))
810
- ];
811
- if (c)
812
- return [r[0], ...r.slice(1).map((f) => this.parse(f))];
813
- }
814
- return r.map((p) => this.parse(p));
815
- });
816
- if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows)
817
- for (let r = 0; r < this.set.length; r++) {
818
- const a = this.set[r];
819
- a[0] === "" && a[1] === "" && this.globParts[r][2] === "?" && typeof a[3] == "string" && /^[a-z]:$/i.test(a[3]) && (a[2] = "?");
820
- }
821
- this.debug(this.pattern, this.set);
822
- }
823
- // various transforms to equivalent pattern sets that are
824
- // faster to process in a filesystem walk. The goal is to
825
- // eliminate what we can, and push all ** patterns as far
826
- // to the right as possible, even if it increases the number
827
- // of patterns that we have to process.
828
- preprocess(t) {
829
- if (this.options.noglobstar)
830
- for (const s of t)
831
- for (let i = 0; i < s.length; i++)
832
- s[i] === "**" && (s[i] = "*");
833
- const { optimizationLevel: e = 1 } = this.options;
834
- return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
835
- }
836
- // just get rid of adjascent ** portions
837
- adjascentGlobstarOptimize(t) {
838
- return t.map((e) => {
839
- let s = -1;
840
- for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
841
- let i = s;
842
- for (; e[i + 1] === "**"; )
843
- i++;
844
- i !== s && e.splice(s, i - s);
845
- }
846
- return e;
847
- });
848
- }
849
- // get rid of adjascent ** and resolve .. portions
850
- levelOneOptimize(t) {
851
- return t.map((e) => (e = e.reduce((s, i) => {
852
- const r = s[s.length - 1];
853
- return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
854
- }, []), e.length === 0 ? [""] : e));
855
- }
856
- levelTwoFileOptimize(t) {
857
- Array.isArray(t) || (t = this.slashSplit(t));
858
- let e = !1;
859
- do {
860
- if (e = !1, !this.preserveMultipleSlashes) {
861
- for (let i = 1; i < t.length - 1; i++) {
862
- const r = t[i];
863
- i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
864
- }
865
- t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
866
- }
867
- let s = 0;
868
- for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
869
- const i = t[s - 1];
870
- i && i !== "." && i !== ".." && i !== "**" && !(this.isWindows && /^[a-z]:$/i.test(i)) && (e = !0, t.splice(s - 1, 2), s -= 2);
871
- }
872
- } while (e);
873
- return t.length === 0 ? [""] : t;
874
- }
875
- // First phase: single-pattern processing
876
- // <pre> is 1 or more portions
877
- // <rest> is 1 or more portions
878
- // <p> is any portion other than ., .., '', or **
879
- // <e> is . or ''
880
- //
881
- // **/.. is *brutal* for filesystem walking performance, because
882
- // it effectively resets the recursive walk each time it occurs,
883
- // and ** cannot be reduced out by a .. pattern part like a regexp
884
- // or most strings (other than .., ., and '') can be.
885
- //
886
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
887
- // <pre>/<e>/<rest> -> <pre>/<rest>
888
- // <pre>/<p>/../<rest> -> <pre>/<rest>
889
- // **/**/<rest> -> **/<rest>
890
- //
891
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
892
- // this WOULD be allowed if ** did follow symlinks, or * didn't
893
- firstPhasePreProcess(t) {
894
- let e = !1;
895
- do {
896
- e = !1;
897
- for (let s of t) {
898
- let i = -1;
899
- for (; (i = s.indexOf("**", i + 1)) !== -1; ) {
900
- let a = i;
901
- for (; s[a + 1] === "**"; )
902
- a++;
903
- a > i && s.splice(i + 1, a - i);
904
- let h = s[i + 1];
905
- const p = s[i + 2], c = s[i + 3];
906
- if (h !== ".." || !p || p === "." || p === ".." || !c || c === "." || c === "..")
907
- continue;
908
- e = !0, s.splice(i, 1);
909
- const f = s.slice(0);
910
- f[i] = "**", t.push(f), i--;
911
- }
912
- if (!this.preserveMultipleSlashes) {
913
- for (let a = 1; a < s.length - 1; a++) {
914
- const h = s[a];
915
- a === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = !0, s.splice(a, 1), a--);
916
- }
917
- s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = !0, s.pop());
918
- }
919
- let r = 0;
920
- for (; (r = s.indexOf("..", r + 1)) !== -1; ) {
921
- const a = s[r - 1];
922
- if (a && a !== "." && a !== ".." && a !== "**") {
923
- e = !0;
924
- const p = r === 1 && s[r + 1] === "**" ? ["."] : [];
925
- s.splice(r - 1, 2, ...p), s.length === 0 && s.push(""), r -= 2;
926
- }
927
- }
928
- }
929
- } while (e);
930
- return t;
931
- }
932
- // second phase: multi-pattern dedupes
933
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
934
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
935
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
936
- //
937
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
938
- // ^-- not valid because ** doens't follow symlinks
939
- secondPhasePreProcess(t) {
940
- for (let e = 0; e < t.length - 1; e++)
941
- for (let s = e + 1; s < t.length; s++) {
942
- const i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
943
- if (i) {
944
- t[e] = [], t[s] = i;
945
- break;
946
- }
947
- }
948
- return t.filter((e) => e.length);
949
- }
950
- partsMatch(t, e, s = !1) {
951
- let i = 0, r = 0, a = [], h = "";
952
- for (; i < t.length && r < e.length; )
953
- if (t[i] === e[r])
954
- a.push(h === "b" ? e[r] : t[i]), i++, r++;
955
- else if (s && t[i] === "**" && e[r] === t[i + 1])
956
- a.push(t[i]), i++;
957
- else if (s && e[r] === "**" && t[i] === e[r + 1])
958
- a.push(e[r]), r++;
959
- else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
960
- if (h === "b")
961
- return !1;
962
- h = "a", a.push(t[i]), i++, r++;
963
- } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
964
- if (h === "a")
965
- return !1;
966
- h = "b", a.push(e[r]), i++, r++;
967
- } else
968
- return !1;
969
- return t.length === e.length && a;
970
- }
971
- parseNegate() {
972
- if (this.nonegate)
973
- return;
974
- const t = this.pattern;
975
- let e = !1, s = 0;
976
- for (let i = 0; i < t.length && t.charAt(i) === "!"; i++)
977
- e = !e, s++;
978
- s && (this.pattern = t.slice(s)), this.negate = e;
979
- }
980
- // set partial to true to test if, for example,
981
- // "/a/b" matches the start of "/*/b/*/d"
982
- // Partial means, if you run out of file before you run
983
- // out of pattern, then that's fine, as long as all
984
- // the parts match.
985
- matchOne(t, e, s = !1) {
986
- let i = 0, r = 0;
987
- if (this.isWindows) {
988
- const h = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), p = !h && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), c = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), f = !c && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), l = p ? 3 : h ? 0 : void 0, u = f ? 3 : c ? 0 : void 0;
989
- if (typeof l == "number" && typeof u == "number") {
990
- const [m, y] = [
991
- t[l],
992
- e[u]
993
- ];
994
- m.toLowerCase() === y.toLowerCase() && (e[u] = m, r = u, i = l);
995
- }
996
- }
997
- const { optimizationLevel: a = 1 } = this.options;
998
- return a >= 2 && (t = this.levelTwoFileOptimize(t)), e.includes(R) ? P(this, L, Xt).call(this, t, e, s, i, r) : P(this, L, K).call(this, t, e, s, i, r);
999
- }
1000
- braceExpand() {
1001
- return Zt(this.pattern, this.options);
1002
- }
1003
- parse(t) {
1004
- at(t);
1005
- const e = this.options;
1006
- if (t === "**")
1007
- return R;
1008
- if (t === "")
1009
- return "";
1010
- let s, i = null;
1011
- (s = t.match(ts)) ? i = e.dot ? ss : es : (s = t.match(Ie)) ? i = (e.nocase ? e.dot ? Ve : He : e.dot ? Je : Ue)(s[1]) : (s = t.match(ns)) ? i = (e.nocase ? e.dot ? rs : is : e.dot ? os : as)(s) : (s = t.match(Ze)) ? i = e.dot ? Ke : Xe : (s = t.match(Qe)) && (i = Ye);
1012
- const r = lt.fromGlob(t, this.options).toMMPattern();
1013
- return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
1014
- }
1015
- makeRe() {
1016
- if (this.regexp || this.regexp === !1)
1017
- return this.regexp;
1018
- const t = this.set;
1019
- if (!t.length)
1020
- return this.regexp = !1, this.regexp;
1021
- const e = this.options, s = e.noglobstar ? hs : e.dot ? fs : us, i = new Set(e.nocase ? ["i"] : []);
1022
- let r = t.map((p) => {
1023
- const c = p.map((l) => {
1024
- if (l instanceof RegExp)
1025
- for (const u of l.flags.split(""))
1026
- i.add(u);
1027
- return typeof l == "string" ? ys(l) : l === R ? R : l._src;
1028
- });
1029
- c.forEach((l, u) => {
1030
- const m = c[u + 1], y = c[u - 1];
1031
- l !== R || y === R || (y === void 0 ? m !== void 0 && m !== R ? c[u + 1] = "(?:\\/|" + s + "\\/)?" + m : c[u] = s : m === void 0 ? c[u - 1] = y + "(?:\\/|\\/" + s + ")?" : m !== R && (c[u - 1] = y + "(?:\\/|\\/" + s + "\\/)" + m, c[u + 1] = R));
1032
- });
1033
- const f = c.filter((l) => l !== R);
1034
- if (this.partial && f.length >= 1) {
1035
- const l = [];
1036
- for (let u = 1; u <= f.length; u++)
1037
- l.push(f.slice(0, u).join("/"));
1038
- return "(?:" + l.join("|") + ")";
1039
- }
1040
- return f.join("/");
1041
- }).join("|");
1042
- const [a, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
1043
- r = "^" + a + r + h + "$", this.partial && (r = "^(?:\\/|" + a + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
1044
- try {
1045
- this.regexp = new RegExp(r, [...i].join(""));
1046
- } catch {
1047
- this.regexp = !1;
1048
- }
1049
- return this.regexp;
1050
- }
1051
- slashSplit(t) {
1052
- return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
1053
- }
1054
- match(t, e = this.partial) {
1055
- if (this.debug("match", t, this.pattern), this.comment)
1056
- return !1;
1057
- if (this.empty)
1058
- return t === "";
1059
- if (t === "/" && e)
1060
- return !0;
1061
- const s = this.options;
1062
- this.isWindows && (t = t.split("\\").join("/"));
1063
- const i = this.slashSplit(t);
1064
- this.debug(this.pattern, "split", i);
1065
- const r = this.set;
1066
- this.debug(this.pattern, "set", r);
1067
- let a = i[i.length - 1];
1068
- if (!a)
1069
- for (let h = i.length - 2; !a && h >= 0; h--)
1070
- a = i[h];
1071
- for (const h of r) {
1072
- let p = i;
1073
- if (s.matchBase && h.length === 1 && (p = [a]), this.matchOne(p, h, e))
1074
- return s.flipNegate ? !0 : !this.negate;
1075
- }
1076
- return s.flipNegate ? !1 : this.negate;
1077
- }
1078
- static defaults(t) {
1079
- return W.defaults(t).Minimatch;
1080
- }
1081
- }
1082
- L = new WeakSet(), Xt = function(t, e, s, i, r) {
1083
- const a = e.indexOf(R, r), h = e.lastIndexOf(R), [p, c, f] = s ? [
1084
- e.slice(r, a),
1085
- e.slice(a + 1),
1086
- []
1087
- ] : [
1088
- e.slice(r, a),
1089
- e.slice(a + 1, h),
1090
- e.slice(h + 1)
1091
- ];
1092
- if (p.length) {
1093
- const M = t.slice(i, i + p.length);
1094
- if (!P(this, L, K).call(this, M, p, s, 0, 0))
1095
- return !1;
1096
- i += p.length, r += p.length;
1097
- }
1098
- let l = 0;
1099
- if (f.length) {
1100
- if (f.length + i > t.length)
1101
- return !1;
1102
- let M = t.length - f.length;
1103
- if (P(this, L, K).call(this, t, f, s, M, 0))
1104
- l = f.length;
1105
- else {
1106
- if (t[t.length - 1] !== "" || i + f.length === t.length || (M--, !P(this, L, K).call(this, t, f, s, M, 0)))
1107
- return !1;
1108
- l = f.length + 1;
1109
- }
1110
- }
1111
- if (!c.length) {
1112
- let M = !!l;
1113
- for (let d = i; d < t.length - l; d++) {
1114
- const $ = String(t[d]);
1115
- if (M = !0, $ === "." || $ === ".." || !this.options.dot && $.startsWith("."))
1116
- return !1;
1117
- }
1118
- return s || M;
1119
- }
1120
- const u = [[[], 0]];
1121
- let m = u[0], y = 0;
1122
- const S = [0];
1123
- for (const M of c)
1124
- M === R ? (S.push(y), m = [[], 0], u.push(m)) : (m[0].push(M), y++);
1125
- let g = u.length - 1;
1126
- const x = t.length - l;
1127
- for (const M of u)
1128
- M[1] = x - (S[g--] + M[0].length);
1129
- return !!P(this, L, yt).call(this, t, u, i, 0, s, 0, !!l);
1130
- }, // return false for "nope, not matching"
1131
- // return null for "not matching, cannot keep trying"
1132
- yt = function(t, e, s, i, r, a, h) {
1133
- const p = e[i];
1134
- if (!p) {
1135
- for (let l = s; l < t.length; l++) {
1136
- h = !0;
1137
- const u = t[l];
1138
- if (u === "." || u === ".." || !this.options.dot && u.startsWith("."))
1139
- return !1;
1140
- }
1141
- return h;
1142
- }
1143
- const [c, f] = p;
1144
- for (; s <= f; ) {
1145
- if (P(this, L, K).call(this, t.slice(0, s + c.length), c, r, s, 0) && a < this.maxGlobstarRecursion) {
1146
- const m = P(this, L, yt).call(this, t, e, s + c.length, i + 1, r, a + 1, h);
1147
- if (m !== !1)
1148
- return m;
1149
- }
1150
- const u = t[s];
1151
- if (u === "." || u === ".." || !this.options.dot && u.startsWith("."))
1152
- return !1;
1153
- s++;
1154
- }
1155
- return r || null;
1156
- }, K = function(t, e, s, i, r) {
1157
- let a, h, p, c;
1158
- for (a = i, h = r, c = t.length, p = e.length; a < c && h < p; a++, h++) {
1159
- this.debug("matchOne loop");
1160
- let f = e[h], l = t[a];
1161
- if (this.debug(e, f, l), f === !1 || f === R)
1162
- return !1;
1163
- let u;
1164
- if (typeof f == "string" ? (u = l === f, this.debug("string match", f, l, u)) : (u = f.test(l), this.debug("pattern match", f, l, u)), !u)
1165
- return !1;
1166
- }
1167
- if (a === c && h === p)
1168
- return !0;
1169
- if (a === c)
1170
- return s;
1171
- if (h === p)
1172
- return a === c - 1 && t[a] === "";
1173
- throw new Error("wtf?");
1174
- };
1175
- W.AST = lt;
1176
- W.Minimatch = ct;
1177
- W.escape = Be;
1178
- W.unescape = st;
1179
- class ws {
1180
- constructor(t) {
1181
- O(this, "value");
1182
- O(this, "next");
1183
- this.value = t;
1184
- }
1185
- }
1186
- var D, U, X;
1187
- class xs {
1188
- constructor() {
1189
- T(this, D);
1190
- T(this, U);
1191
- T(this, X);
1192
- this.clear();
1193
- }
1194
- enqueue(t) {
1195
- const e = new ws(t);
1196
- o(this, D) ? (o(this, U).next = e, E(this, U, e)) : (E(this, D, e), E(this, U, e)), ft(this, X)._++;
1197
- }
1198
- dequeue() {
1199
- const t = o(this, D);
1200
- if (t)
1201
- return E(this, D, o(this, D).next), ft(this, X)._--, o(this, D) || E(this, U, void 0), t.value;
1202
- }
1203
- peek() {
1204
- if (o(this, D))
1205
- return o(this, D).value;
1206
- }
1207
- clear() {
1208
- E(this, D, void 0), E(this, U, void 0), E(this, X, 0);
1209
- }
1210
- get size() {
1211
- return o(this, X);
1212
- }
1213
- *[Symbol.iterator]() {
1214
- let t = o(this, D);
1215
- for (; t; )
1216
- yield t.value, t = t.next;
1217
- }
1218
- *drain() {
1219
- for (; o(this, D); )
1220
- yield this.dequeue();
1221
- }
1222
- }
1223
- D = new WeakMap(), U = new WeakMap(), X = new WeakMap();
1224
- function Ss(n) {
1225
- let t = !1;
1226
- if (typeof n == "object" && ({ concurrency: n, rejectOnClear: t = !1 } = n), jt(n), typeof t != "boolean")
1227
- throw new TypeError("Expected `rejectOnClear` to be a boolean");
1228
- const e = new xs();
1229
- let s = 0;
1230
- const i = () => {
1231
- s < n && e.size > 0 && (s++, e.dequeue().run());
1232
- }, r = () => {
1233
- s--, i();
1234
- }, a = async (c, f, l) => {
1235
- const u = (async () => c(...l))();
1236
- f(u);
1237
- try {
1238
- await u;
1239
- } catch {
1240
- }
1241
- r();
1242
- }, h = (c, f, l, u) => {
1243
- const m = { reject: l };
1244
- new Promise((y) => {
1245
- m.run = y, e.enqueue(m);
1246
- }).then(a.bind(void 0, c, f, u)), s < n && i();
1247
- }, p = (c, ...f) => new Promise((l, u) => {
1248
- h(c, l, u, f);
1249
- });
1250
- return Object.defineProperties(p, {
1251
- activeCount: {
1252
- get: () => s
1253
- },
1254
- pendingCount: {
1255
- get: () => e.size
1256
- },
1257
- clearQueue: {
1258
- value() {
1259
- if (!t) {
1260
- e.clear();
1261
- return;
1262
- }
1263
- const c = AbortSignal.abort().reason;
1264
- for (; e.size > 0; )
1265
- e.dequeue().reject(c);
1266
- }
1267
- },
1268
- concurrency: {
1269
- get: () => n,
1270
- set(c) {
1271
- jt(c), n = c, queueMicrotask(() => {
1272
- for (; s < n && e.size > 0; )
1273
- i();
1274
- });
1275
- }
1276
- },
1277
- map: {
1278
- async value(c, f) {
1279
- const l = Array.from(c, (u, m) => this(f, u, m));
1280
- return Promise.all(l);
1281
- }
1282
- }
1283
- }), p;
1284
- }
1285
- function jt(n) {
1286
- if (!((Number.isInteger(n) || n === Number.POSITIVE_INFINITY) && n > 0))
1287
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
1288
- }
1289
- const bs = ce(le);
1290
- function Es(n) {
1291
- if (n.length < 2) return "never";
1292
- const t = [...n].sort((i, r) => i - r);
1293
- let e = 0;
1294
- for (let i = 1; i < t.length; i++)
1295
- e += t[i] - t[i - 1];
1296
- const s = e / (t.length - 1) / 864e5;
1297
- return s <= 1 ? "daily" : s <= 7 ? "weekly" : s <= 30 ? "monthly" : s <= 365 ? "yearly" : "never";
1298
- }
1299
- function Ms(n) {
1300
- const t = n.pageEntryPattern;
1301
- let e = n.rootDir ?? "", s = n.outputFile ?? "";
1302
- const i = n.concurrency ?? 20, r = n.commitCount ?? 10, a = n.ignoreDeps ? Array.isArray(n.ignoreDeps) ? n.ignoreDeps : [n.ignoreDeps] : [], h = {};
1303
- let p;
1304
- return {
1305
- name: "vite-last-modified",
1306
- async configResolved(c) {
1307
- p = c.build.ssr, e || (e = c.root), s || (s = re(e, "last-modified.json"));
1308
- },
1309
- async buildEnd() {
1310
- if (p || process.env.NODE_ENV !== "production")
1311
- return;
1312
- const c = /* @__PURE__ */ new Map(), f = Ss(i), l = (g) => {
1313
- if (c.has(g))
1314
- return c.get(g);
1315
- const x = f(async () => {
1316
- try {
1317
- const M = g.includes("?") ? g.slice(0, g.indexOf("?")) : g, d = ie.relative(e, M).replace(/\\/g, "/"), { stdout: $ } = await bs(`git log --follow -n ${r} --format=%at -- "${d}"`, { cwd: e });
1318
- return $.trim() ? $.trim().split(`
1319
- `).map((b) => parseInt(b, 10) * 1e3) : [];
1320
- } catch {
1321
- return [];
1322
- }
1323
- });
1324
- return c.set(g, x), x;
1325
- }, u = (g, x) => {
1326
- if (x.has(g)) return;
1327
- x.add(g);
1328
- const M = this.getModuleInfo(g);
1329
- if (M)
1330
- for (const d of M.importedIds) {
1331
- if (d.includes("node_modules") || !d.startsWith(e))
1332
- continue;
1333
- const $ = d.slice(e.length).replace(/^\/?/, "").split("?")[0];
1334
- a.some((b) => W($, b, { dot: !0 })) || u(d, x);
1335
- }
1336
- }, m = [...this.getModuleIds()].filter((g) => {
1337
- if (!g.startsWith(e))
1338
- return !1;
1339
- const x = g.slice(e.length).replace(/^\//, "");
1340
- return typeof t == "string" ? W(x, t, { dot: !0 }) : t.test(x);
1341
- });
1342
- if (m.length === 0) {
1343
- console.warn("[lastModifiedPlugin] No MD files found in module graph");
1344
- return;
1345
- }
1346
- console.log("[lastModifiedPlugin] start collect entry files deps");
1347
- let y = /* @__PURE__ */ new Map();
1348
- for (const g of m) {
1349
- const x = /* @__PURE__ */ new Set();
1350
- u(g, x), y.set(g, x);
1351
- }
1352
- if (console.log(`[lastModifiedPlugin] Analyzed ${m.length} entry files`), typeof n.modifyDepMap == "function") {
1353
- const g = await n.modifyDepMap(y);
1354
- g && g instanceof Map && (y = g);
1355
- }
1356
- const S = /* @__PURE__ */ new Set();
1357
- for (const g of y.values())
1358
- for (const x of g)
1359
- S.add(x);
1360
- await Promise.all([...S].map(l));
1361
- for (const [g, x] of y) {
1362
- const M = g.slice(e.length).replace(/^\//, ""), d = (await Promise.all([...x].map(l))).flat(), $ = d.length > 0 ? Math.max(...d) : 0, b = Es(d);
1363
- h[M] = { lastmod: $, changefreq: b };
1364
- }
1365
- },
1366
- closeBundle() {
1367
- if (p || process.env.NODE_ENV !== "production")
1368
- return;
1369
- const c = Object.fromEntries(Object.entries(h).sort(([f], [l]) => f.localeCompare(l)));
1370
- Wt(s, JSON.stringify(c, null, 2), "utf8"), console.log(`[lastModifiedPlugin] Written ${s}`);
1371
- }
1372
- };
1373
- }
1374
- const Rs = Yt({
1375
- meta: {
1376
- name: "sitemap",
1377
- configKey: "sitemap"
1378
- },
1379
- setup(n, t) {
1380
- var i;
1381
- te(
1382
- Ms({
1383
- rootDir: ((i = n.nuxtAppRoot) == null ? void 0 : i.replace(/\\/g, "/")) || t.options.dir.app,
1384
- // @ts-ignore
1385
- pageEntryPattern: "**/pages/**/*.vue",
1386
- ...n.lastmodAndChangefreqOptions
1387
- })
1388
- );
1389
- const e = Array.isArray(n.ignore) ? n.ignore : typeof n.ignore == "string" ? [n.ignore] : [], s = n.hostname.endsWith("/") ? n.hostname.slice(0, -1) : n.hostname;
1390
- t.hook("close", async () => {
1391
- var f, l, u, m, y, S;
1392
- const r = Y(t.options.rootDir, ".output", "public");
1393
- if (!Et(r))
1394
- return;
1395
- const a = ((f = n.lastmodAndChangefreqOptions) == null ? void 0 : f.outputFile) || Y(n.nuxtAppRoot || t.options.dir.app, "last-modified.json");
1396
- if (!Et(a))
1397
- return;
1398
- const h = {};
1399
- if ((l = n.index) != null && l.items)
1400
- for (const g of n.index.items)
1401
- g.pathPrefix && (h[g.pathPrefix.startsWith("/") ? g.pathPrefix : `/${g.pathPrefix}`] = /* @__PURE__ */ new Set());
1402
- else
1403
- h["/"] = /* @__PURE__ */ new Set();
1404
- const p = (g) => {
1405
- const x = ne(g, {
1406
- withFileTypes: !0,
1407
- encoding: "utf-8"
1408
- });
1409
- for (const M of x) {
1410
- if (M.isDirectory()) {
1411
- p(Y(g, M.name));
1412
- continue;
1413
- }
1414
- if (M.name === "index.html") {
1415
- const d = `/${oe(r, g).replace(/\\/g, "/")}`;
1416
- for (const $ of e)
1417
- W(d, $);
1418
- for (const $ in h)
1419
- d.startsWith($) && h[$].add(d);
1420
- }
1421
- }
1422
- };
1423
- p(r), console.log("[module:generate-sitemap] collect html done");
1424
- const c = JSON.parse(ee(a, "utf-8"));
1425
- await Promise.all(
1426
- (((u = n.index) == null ? void 0 : u.items) ?? [{ pathPrefix: "/", filename: "sitemap.xml" }]).filter((g) => g.pathPrefix && g.filename).map(async (g) => {
1427
- const x = g.pathPrefix.startsWith("/") ? g.pathPrefix : `/${g.pathPrefix}`, M = g.filename.endsWith(".xml") ? g.filename : `${g.filename}.xml`, d = se(Y(r, x, M), "utf-8");
1428
- try {
1429
- await ae(function* () {
1430
- yield `<?xml version="1.0" encoding="UTF-8"?>
1431
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
1432
- `;
1433
- const $ = h[x];
1434
- for (const b of $) {
1435
- if (!b.startsWith("/"))
1436
- continue;
1437
- const k = c[`pages${b.endsWith("/") ? b.slice(0, -1) : b}/index.vue`] || c[`pages${b}.vue`];
1438
- k != null && k.lastmod && (k.lastmod = new Date(k.lastmod).toISOString());
1439
- const H = {
1440
- loc: s + b,
1441
- ...k
1442
- };
1443
- let St = [];
1444
- if (n.getAlternate && n.languages)
1445
- for (const V of n.languages) {
1446
- let G = n.getAlternate(b, V);
1447
- G && (G = G.startsWith("/") ? G : "/" + G, $.has(G) && St.push(`<xhtml:link rel="alternate" hreflang="${V}" href="${s + G}" />`));
1448
- }
1449
- yield ` <url>
1450
- ${Object.entries(H).map(([V, G]) => ` <${V}>${G}</${V}>`).join(`
1451
- `)}
1452
- ${St.map((V) => ` ${V}`).join(`
1453
- `)}
1454
- </url>
1455
- `;
1456
- }
1457
- yield "</urlset>";
1458
- }, d);
1459
- } catch ($) {
1460
- console.log("[module:generate-sitemap] error", $);
1461
- return;
1462
- }
1463
- })
1464
- ), (m = n.index) != null && m.indexFilename && ((S = (y = n.index) == null ? void 0 : y.items) != null && S.length) && Wt(
1465
- Y(r, n.index.indexFilename),
1466
- `<?xml version="1.0" encoding="UTF-8"?>
1467
- <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
1468
- ${n.index.items.filter((g) => g.loc || g.filename).map((g) => {
1469
- let x = g.pathPrefix ? g.pathPrefix.startsWith("/") ? g.pathPrefix : `/${g.pathPrefix}` : "";
1470
- return x.endsWith("/") && (x = x.slice(0, -1)), `<sitemap>
1471
- <loc>${g.filename ? `${s}${x}/${g.filename}` : g.loc}</loc>
1472
- </sitemap>`;
1473
- }).join("")}
1474
- </sitemapindex>
1475
- `,
1476
- "utf-8"
1477
- ), console.log("[module:generate-sitemap] generate done");
1478
- });
1479
- }
1480
- });
1481
- export {
1482
- Rs as default
1483
- };