@sourcegraph/amp 0.0.1748851339-g31df22 → 0.0.1748865683-g71e54e

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.
Files changed (51) hide show
  1. package/dist/amp.js +3 -2
  2. package/dist/amp.js.map +1 -1
  3. package/dist/client-BWw-YoAm.js +35 -0
  4. package/dist/client-BWw-YoAm.js.map +1 -0
  5. package/dist/{console-k3nh7b4U.js → console-CTjwGR94.js} +38818 -17252
  6. package/dist/console-CTjwGR94.js.map +1 -0
  7. package/dist/{create_file.node-Dxp9NAiW.js → create_file.node-vNn4fbhz.js} +2 -2
  8. package/dist/{create_file.node-Dxp9NAiW.js.map → create_file.node-vNn4fbhz.js.map} +1 -1
  9. package/dist/{edit_file.node-BlCpGVR-.js → edit_file.node-CT1vyl1i.js} +10 -10
  10. package/dist/{edit_file.node-BlCpGVR-.js.map → edit_file.node-CT1vyl1i.js.map} +1 -1
  11. package/dist/{executable-DTI1_xm7.js → executable-BrAdMU71.js} +2 -2
  12. package/dist/{executable-DTI1_xm7.js.map → executable-BrAdMU71.js.map} +1 -1
  13. package/dist/{files-DdjDm_B8.js → files-BOfdJygp.js} +3 -3
  14. package/dist/{files-DdjDm_B8.js.map → files-BOfdJygp.js.map} +1 -1
  15. package/dist/glob.node-4tOopzOM.js +137 -0
  16. package/dist/glob.node-4tOopzOM.js.map +1 -0
  17. package/dist/index-NLHysr2h.js +922 -0
  18. package/dist/index-NLHysr2h.js.map +1 -0
  19. package/dist/{list_directory.node-DDhJZGvT.js → list_directory.node-updCUrTG.js} +2 -2
  20. package/dist/{list_directory.node-DDhJZGvT.js.map → list_directory.node-updCUrTG.js.map} +1 -1
  21. package/dist/{load-profile-CWDhvBXX.js → load-profile-DZZRFAc9.js} +2 -2
  22. package/dist/{load-profile-CWDhvBXX.js.map → load-profile-DZZRFAc9.js.map} +1 -1
  23. package/dist/main-BJVONhWT.js +19483 -0
  24. package/dist/main-BJVONhWT.js.map +1 -0
  25. package/dist/node-BkgN80SA.js +85 -0
  26. package/dist/node-BkgN80SA.js.map +1 -0
  27. package/dist/{node-DGc3Eu0F.js → node-BtSehPh_.js} +3 -3
  28. package/dist/{node-DGc3Eu0F.js.map → node-BtSehPh_.js.map} +1 -1
  29. package/dist/{node-BZlRkYQw.js → node-DGpCXn3p.js} +2 -2
  30. package/dist/{node-BZlRkYQw.js.map → node-DGpCXn3p.js.map} +1 -1
  31. package/dist/{node-B1RLuGfG.js → node-DIQSaLGP.js} +41 -41
  32. package/dist/{node-B1RLuGfG.js.map → node-DIQSaLGP.js.map} +1 -1
  33. package/dist/{node-w5kFgl6-.js → node-S3C83o8k.js} +47 -47
  34. package/dist/{node-w5kFgl6-.js.map → node-S3C83o8k.js.map} +1 -1
  35. package/dist/{node-DuhaU87r.js → node-iqSbLvK6.js} +28 -28
  36. package/dist/{node-DuhaU87r.js.map → node-iqSbLvK6.js.map} +1 -1
  37. package/dist/{read_file.node-CsATnmUF.js → read_file.node-B7tSIDli.js} +2 -2
  38. package/dist/{read_file.node-CsATnmUF.js.map → read_file.node-B7tSIDli.js.map} +1 -1
  39. package/dist/{stdio-Egb8ZIIg.js → stdio-nUAEiLxy.js} +29 -29
  40. package/dist/{stdio-Egb8ZIIg.js.map → stdio-nUAEiLxy.js.map} +1 -1
  41. package/dist/storybook.js +1 -1
  42. package/dist/{undo_edit.node-CHrrMPkn.js → undo_edit.node-BYhKjjZF.js} +10 -10
  43. package/dist/{undo_edit.node-CHrrMPkn.js.map → undo_edit.node-BYhKjjZF.js.map} +1 -1
  44. package/package.json +1 -1
  45. package/dist/console-k3nh7b4U.js.map +0 -1
  46. package/dist/glob.node-BnKeKl9M.js +0 -1051
  47. package/dist/glob.node-BnKeKl9M.js.map +0 -1
  48. package/dist/main-DuPQOPga.js +0 -40843
  49. package/dist/main-DuPQOPga.js.map +0 -1
  50. package/dist/node-3m0J6gBv.js +0 -72
  51. package/dist/node-3m0J6gBv.js.map +0 -1
@@ -1,1051 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawn as yt } from "node:child_process";
3
- import { k as Ht, O as $t, g as mt, m as Lt, aQ as Tt, n as vt } from "./console-k3nh7b4U.js";
4
- import { r as Ot } from "./executable-DTI1_xm7.js";
5
- var pt = {}, ft, Et;
6
- function it() {
7
- if (Et) return ft;
8
- Et = 1;
9
- const p = "\\\\/", A = `[^${p}]`, R = "\\.", d = "\\+", g = "\\?", o = "\\/", u = "(?=.)", a = "[^/]", f = `(?:${o}|$)`, x = `(?:^|${o})`, c = `${R}{1,2}${f}`, E = `(?!${R})`, r = `(?!${x}${c})`, $ = `(?!${R}{0,1}${f})`, m = `(?!${c})`, y = `[^.${o}]`, S = `${a}*?`, F = {
10
- DOT_LITERAL: R,
11
- PLUS_LITERAL: d,
12
- QMARK_LITERAL: g,
13
- SLASH_LITERAL: o,
14
- ONE_CHAR: u,
15
- QMARK: a,
16
- END_ANCHOR: f,
17
- DOTS_SLASH: c,
18
- NO_DOT: E,
19
- NO_DOTS: r,
20
- NO_DOT_SLASH: $,
21
- NO_DOTS_SLASH: m,
22
- QMARK_NO_DOT: y,
23
- STAR: S,
24
- START_ANCHOR: x,
25
- SEP: "/"
26
- }, T = {
27
- ...F,
28
- SLASH_LITERAL: `[${p}]`,
29
- QMARK: A,
30
- STAR: `${A}*?`,
31
- DOTS_SLASH: `${R}{1,2}(?:[${p}]|$)`,
32
- NO_DOT: `(?!${R})`,
33
- NO_DOTS: `(?!(?:^|[${p}])${R}{1,2}(?:[${p}]|$))`,
34
- NO_DOT_SLASH: `(?!${R}{0,1}(?:[${p}]|$))`,
35
- NO_DOTS_SLASH: `(?!${R}{1,2}(?:[${p}]|$))`,
36
- QMARK_NO_DOT: `[^.${p}]`,
37
- START_ANCHOR: `(?:^|[${p}])`,
38
- END_ANCHOR: `(?:[${p}]|$)`,
39
- SEP: "\\"
40
- }, G = {
41
- alnum: "a-zA-Z0-9",
42
- alpha: "a-zA-Z",
43
- ascii: "\\x00-\\x7F",
44
- blank: " \\t",
45
- cntrl: "\\x00-\\x1F\\x7F",
46
- digit: "0-9",
47
- graph: "\\x21-\\x7E",
48
- lower: "a-z",
49
- print: "\\x20-\\x7E ",
50
- punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
51
- space: " \\t\\r\\n\\v\\f",
52
- upper: "A-Z",
53
- word: "A-Za-z0-9_",
54
- xdigit: "A-Fa-f0-9"
55
- };
56
- return ft = {
57
- MAX_LENGTH: 1024 * 64,
58
- POSIX_REGEX_SOURCE: G,
59
- // regular expressions
60
- REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
61
- REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
62
- REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
63
- REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
64
- REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
65
- REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
66
- // Replace globs with equivalent patterns to reduce parsing time.
67
- REPLACEMENTS: {
68
- "***": "*",
69
- "**/**": "**",
70
- "**/**/**": "**"
71
- },
72
- // Digits
73
- CHAR_0: 48,
74
- /* 0 */
75
- CHAR_9: 57,
76
- /* 9 */
77
- // Alphabet chars.
78
- CHAR_UPPERCASE_A: 65,
79
- /* A */
80
- CHAR_LOWERCASE_A: 97,
81
- /* a */
82
- CHAR_UPPERCASE_Z: 90,
83
- /* Z */
84
- CHAR_LOWERCASE_Z: 122,
85
- /* z */
86
- CHAR_LEFT_PARENTHESES: 40,
87
- /* ( */
88
- CHAR_RIGHT_PARENTHESES: 41,
89
- /* ) */
90
- CHAR_ASTERISK: 42,
91
- /* * */
92
- // Non-alphabetic chars.
93
- CHAR_AMPERSAND: 38,
94
- /* & */
95
- CHAR_AT: 64,
96
- /* @ */
97
- CHAR_BACKWARD_SLASH: 92,
98
- /* \ */
99
- CHAR_CARRIAGE_RETURN: 13,
100
- /* \r */
101
- CHAR_CIRCUMFLEX_ACCENT: 94,
102
- /* ^ */
103
- CHAR_COLON: 58,
104
- /* : */
105
- CHAR_COMMA: 44,
106
- /* , */
107
- CHAR_DOT: 46,
108
- /* . */
109
- CHAR_DOUBLE_QUOTE: 34,
110
- /* " */
111
- CHAR_EQUAL: 61,
112
- /* = */
113
- CHAR_EXCLAMATION_MARK: 33,
114
- /* ! */
115
- CHAR_FORM_FEED: 12,
116
- /* \f */
117
- CHAR_FORWARD_SLASH: 47,
118
- /* / */
119
- CHAR_GRAVE_ACCENT: 96,
120
- /* ` */
121
- CHAR_HASH: 35,
122
- /* # */
123
- CHAR_HYPHEN_MINUS: 45,
124
- /* - */
125
- CHAR_LEFT_ANGLE_BRACKET: 60,
126
- /* < */
127
- CHAR_LEFT_CURLY_BRACE: 123,
128
- /* { */
129
- CHAR_LEFT_SQUARE_BRACKET: 91,
130
- /* [ */
131
- CHAR_LINE_FEED: 10,
132
- /* \n */
133
- CHAR_NO_BREAK_SPACE: 160,
134
- /* \u00A0 */
135
- CHAR_PERCENT: 37,
136
- /* % */
137
- CHAR_PLUS: 43,
138
- /* + */
139
- CHAR_QUESTION_MARK: 63,
140
- /* ? */
141
- CHAR_RIGHT_ANGLE_BRACKET: 62,
142
- /* > */
143
- CHAR_RIGHT_CURLY_BRACE: 125,
144
- /* } */
145
- CHAR_RIGHT_SQUARE_BRACKET: 93,
146
- /* ] */
147
- CHAR_SEMICOLON: 59,
148
- /* ; */
149
- CHAR_SINGLE_QUOTE: 39,
150
- /* ' */
151
- CHAR_SPACE: 32,
152
- /* */
153
- CHAR_TAB: 9,
154
- /* \t */
155
- CHAR_UNDERSCORE: 95,
156
- /* _ */
157
- CHAR_VERTICAL_LINE: 124,
158
- /* | */
159
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
160
- /* \uFEFF */
161
- /**
162
- * Create EXTGLOB_CHARS
163
- */
164
- extglobChars(b) {
165
- return {
166
- "!": { type: "negate", open: "(?:(?!(?:", close: `))${b.STAR})` },
167
- "?": { type: "qmark", open: "(?:", close: ")?" },
168
- "+": { type: "plus", open: "(?:", close: ")+" },
169
- "*": { type: "star", open: "(?:", close: ")*" },
170
- "@": { type: "at", open: "(?:", close: ")" }
171
- };
172
- },
173
- /**
174
- * Create GLOB_CHARS
175
- */
176
- globChars(b) {
177
- return b === !0 ? T : F;
178
- }
179
- }, ft;
180
- }
181
- var dt;
182
- function ct() {
183
- return dt || (dt = 1, function(p) {
184
- const {
185
- REGEX_BACKSLASH: A,
186
- REGEX_REMOVE_BACKSLASH: R,
187
- REGEX_SPECIAL_CHARS: d,
188
- REGEX_SPECIAL_CHARS_GLOBAL: g
189
- } = /* @__PURE__ */ it();
190
- p.isObject = (o) => o !== null && typeof o == "object" && !Array.isArray(o), p.hasRegexChars = (o) => d.test(o), p.isRegexChar = (o) => o.length === 1 && p.hasRegexChars(o), p.escapeRegex = (o) => o.replace(g, "\\$1"), p.toPosixSlashes = (o) => o.replace(A, "/"), p.isWindows = () => {
191
- if (typeof navigator < "u" && navigator.platform) {
192
- const o = navigator.platform.toLowerCase();
193
- return o === "win32" || o === "windows";
194
- }
195
- return typeof process < "u" && process.platform ? process.platform === "win32" : !1;
196
- }, p.removeBackslashes = (o) => o.replace(R, (u) => u === "\\" ? "" : u), p.escapeLast = (o, u, a) => {
197
- const f = o.lastIndexOf(u, a);
198
- return f === -1 ? o : o[f - 1] === "\\" ? p.escapeLast(o, u, f - 1) : `${o.slice(0, f)}\\${o.slice(f)}`;
199
- }, p.removePrefix = (o, u = {}) => {
200
- let a = o;
201
- return a.startsWith("./") && (a = a.slice(2), u.prefix = "./"), a;
202
- }, p.wrapOutput = (o, u = {}, a = {}) => {
203
- const f = a.contains ? "" : "^", x = a.contains ? "" : "$";
204
- let c = `${f}(?:${o})${x}`;
205
- return u.negated === !0 && (c = `(?:^(?!${c}).*$)`), c;
206
- }, p.basename = (o, { windows: u } = {}) => {
207
- const a = o.split(u ? /[\\/]/ : "/"), f = a[a.length - 1];
208
- return f === "" ? a[a.length - 2] : f;
209
- };
210
- }(pt)), pt;
211
- }
212
- var ht, St;
213
- function wt() {
214
- if (St) return ht;
215
- St = 1;
216
- const p = /* @__PURE__ */ ct(), {
217
- CHAR_ASTERISK: A,
218
- /* * */
219
- CHAR_AT: R,
220
- /* @ */
221
- CHAR_BACKWARD_SLASH: d,
222
- /* \ */
223
- CHAR_COMMA: g,
224
- /* , */
225
- CHAR_DOT: o,
226
- /* . */
227
- CHAR_EXCLAMATION_MARK: u,
228
- /* ! */
229
- CHAR_FORWARD_SLASH: a,
230
- /* / */
231
- CHAR_LEFT_CURLY_BRACE: f,
232
- /* { */
233
- CHAR_LEFT_PARENTHESES: x,
234
- /* ( */
235
- CHAR_LEFT_SQUARE_BRACKET: c,
236
- /* [ */
237
- CHAR_PLUS: E,
238
- /* + */
239
- CHAR_QUESTION_MARK: r,
240
- /* ? */
241
- CHAR_RIGHT_CURLY_BRACE: $,
242
- /* } */
243
- CHAR_RIGHT_PARENTHESES: m,
244
- /* ) */
245
- CHAR_RIGHT_SQUARE_BRACKET: y
246
- /* ] */
247
- } = /* @__PURE__ */ it(), S = (T) => T === a || T === d, I = (T) => {
248
- T.isPrefix !== !0 && (T.depth = T.isGlobstar ? 1 / 0 : 1);
249
- };
250
- return ht = (T, G) => {
251
- const b = G || {}, Y = T.length - 1, B = b.parts === !0 || b.scanToEnd === !0, W = [], w = [], st = [];
252
- let M = T, H = -1, N = 0, tt = 0, rt = !1, j = !1, v = !1, et = !1, X = !1, s = !1, k = !1, z = !1, ut = !1, t = !1, e = 0, nt, l, C = { value: "", depth: 0, isGlob: !1 };
253
- const V = () => H >= Y, J = () => M.charCodeAt(H + 1), U = () => (nt = l, M.charCodeAt(++H));
254
- for (; H < Y; ) {
255
- l = U();
256
- let q;
257
- if (l === d) {
258
- k = C.backslashes = !0, l = U(), l === f && (s = !0);
259
- continue;
260
- }
261
- if (s === !0 || l === f) {
262
- for (e++; V() !== !0 && (l = U()); ) {
263
- if (l === d) {
264
- k = C.backslashes = !0, U();
265
- continue;
266
- }
267
- if (l === f) {
268
- e++;
269
- continue;
270
- }
271
- if (s !== !0 && l === o && (l = U()) === o) {
272
- if (rt = C.isBrace = !0, v = C.isGlob = !0, t = !0, B === !0)
273
- continue;
274
- break;
275
- }
276
- if (s !== !0 && l === g) {
277
- if (rt = C.isBrace = !0, v = C.isGlob = !0, t = !0, B === !0)
278
- continue;
279
- break;
280
- }
281
- if (l === $ && (e--, e === 0)) {
282
- s = !1, rt = C.isBrace = !0, t = !0;
283
- break;
284
- }
285
- }
286
- if (B === !0)
287
- continue;
288
- break;
289
- }
290
- if (l === a) {
291
- if (W.push(H), w.push(C), C = { value: "", depth: 0, isGlob: !1 }, t === !0) continue;
292
- if (nt === o && H === N + 1) {
293
- N += 2;
294
- continue;
295
- }
296
- tt = H + 1;
297
- continue;
298
- }
299
- if (b.noext !== !0 && (l === E || l === R || l === A || l === r || l === u) === !0 && J() === x) {
300
- if (v = C.isGlob = !0, et = C.isExtglob = !0, t = !0, l === u && H === N && (ut = !0), B === !0) {
301
- for (; V() !== !0 && (l = U()); ) {
302
- if (l === d) {
303
- k = C.backslashes = !0, l = U();
304
- continue;
305
- }
306
- if (l === m) {
307
- v = C.isGlob = !0, t = !0;
308
- break;
309
- }
310
- }
311
- continue;
312
- }
313
- break;
314
- }
315
- if (l === A) {
316
- if (nt === A && (X = C.isGlobstar = !0), v = C.isGlob = !0, t = !0, B === !0)
317
- continue;
318
- break;
319
- }
320
- if (l === r) {
321
- if (v = C.isGlob = !0, t = !0, B === !0)
322
- continue;
323
- break;
324
- }
325
- if (l === c) {
326
- for (; V() !== !0 && (q = U()); ) {
327
- if (q === d) {
328
- k = C.backslashes = !0, U();
329
- continue;
330
- }
331
- if (q === y) {
332
- j = C.isBracket = !0, v = C.isGlob = !0, t = !0;
333
- break;
334
- }
335
- }
336
- if (B === !0)
337
- continue;
338
- break;
339
- }
340
- if (b.nonegate !== !0 && l === u && H === N) {
341
- z = C.negated = !0, N++;
342
- continue;
343
- }
344
- if (b.noparen !== !0 && l === x) {
345
- if (v = C.isGlob = !0, B === !0) {
346
- for (; V() !== !0 && (l = U()); ) {
347
- if (l === x) {
348
- k = C.backslashes = !0, l = U();
349
- continue;
350
- }
351
- if (l === m) {
352
- t = !0;
353
- break;
354
- }
355
- }
356
- continue;
357
- }
358
- break;
359
- }
360
- if (v === !0) {
361
- if (t = !0, B === !0)
362
- continue;
363
- break;
364
- }
365
- }
366
- b.noext === !0 && (et = !1, v = !1);
367
- let D = M, ot = "", Z = "";
368
- N > 0 && (ot = M.slice(0, N), M = M.slice(N), tt -= N), D && v === !0 && tt > 0 ? (D = M.slice(0, tt), Z = M.slice(tt)) : v === !0 ? (D = "", Z = M) : D = M, D && D !== "" && D !== "/" && D !== M && S(D.charCodeAt(D.length - 1)) && (D = D.slice(0, -1)), b.unescape === !0 && (Z && (Z = p.removeBackslashes(Z)), D && k === !0 && (D = p.removeBackslashes(D)));
369
- const h = {
370
- prefix: ot,
371
- input: T,
372
- start: N,
373
- base: D,
374
- glob: Z,
375
- isBrace: rt,
376
- isBracket: j,
377
- isGlob: v,
378
- isExtglob: et,
379
- isGlobstar: X,
380
- negated: z,
381
- negatedExtglob: ut
382
- };
383
- if (b.tokens === !0 && (h.maxDepth = 0, S(l) || w.push(C), h.tokens = w), b.parts === !0 || b.tokens === !0) {
384
- let q;
385
- for (let K = 0; K < W.length; K++) {
386
- const i = q ? q + 1 : N, L = W[K], n = T.slice(i, L);
387
- b.tokens && (K === 0 && N !== 0 ? (w[K].isPrefix = !0, w[K].value = ot) : w[K].value = n, I(w[K]), h.maxDepth += w[K].depth), (K !== 0 || n !== "") && st.push(n), q = L;
388
- }
389
- if (q && q + 1 < T.length) {
390
- const K = T.slice(q + 1);
391
- st.push(K), b.tokens && (w[w.length - 1].value = K, I(w[w.length - 1]), h.maxDepth += w[w.length - 1].depth);
392
- }
393
- h.slashes = W, h.parts = st;
394
- }
395
- return h;
396
- }, ht;
397
- }
398
- var At, Ct;
399
- function Nt() {
400
- if (Ct) return At;
401
- Ct = 1;
402
- const p = /* @__PURE__ */ it(), A = /* @__PURE__ */ ct(), {
403
- MAX_LENGTH: R,
404
- POSIX_REGEX_SOURCE: d,
405
- REGEX_NON_SPECIAL_CHARS: g,
406
- REGEX_SPECIAL_CHARS_BACKREF: o,
407
- REPLACEMENTS: u
408
- } = p, a = (c, E) => {
409
- if (typeof E.expandRange == "function")
410
- return E.expandRange(...c, E);
411
- c.sort();
412
- const r = `[${c.join("-")}]`;
413
- try {
414
- new RegExp(r);
415
- } catch {
416
- return c.map((m) => A.escapeRegex(m)).join("..");
417
- }
418
- return r;
419
- }, f = (c, E) => `Missing ${c}: "${E}" - use "\\\\${E}" to match literal characters`, x = (c, E) => {
420
- if (typeof c != "string")
421
- throw new TypeError("Expected a string");
422
- c = u[c] || c;
423
- const r = { ...E }, $ = typeof r.maxLength == "number" ? Math.min(R, r.maxLength) : R;
424
- let m = c.length;
425
- if (m > $)
426
- throw new SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${$}`);
427
- const y = { type: "bos", value: "", output: r.prepend || "" }, S = [y], I = r.capture ? "" : "?:", F = p.globChars(r.windows), T = p.extglobChars(F), {
428
- DOT_LITERAL: G,
429
- PLUS_LITERAL: b,
430
- SLASH_LITERAL: Y,
431
- ONE_CHAR: B,
432
- DOTS_SLASH: W,
433
- NO_DOT: w,
434
- NO_DOT_SLASH: st,
435
- NO_DOTS_SLASH: M,
436
- QMARK: H,
437
- QMARK_NO_DOT: N,
438
- STAR: tt,
439
- START_ANCHOR: rt
440
- } = F, j = (i) => `(${I}(?:(?!${rt}${i.dot ? W : G}).)*?)`, v = r.dot ? "" : w, et = r.dot ? H : N;
441
- let X = r.bash === !0 ? j(r) : tt;
442
- r.capture && (X = `(${X})`), typeof r.noext == "boolean" && (r.noextglob = r.noext);
443
- const s = {
444
- input: c,
445
- index: -1,
446
- start: 0,
447
- dot: r.dot === !0,
448
- consumed: "",
449
- output: "",
450
- prefix: "",
451
- backtrack: !1,
452
- negated: !1,
453
- brackets: 0,
454
- braces: 0,
455
- parens: 0,
456
- quotes: 0,
457
- globstar: !1,
458
- tokens: S
459
- };
460
- c = A.removePrefix(c, s), m = c.length;
461
- const k = [], z = [], ut = [];
462
- let t = y, e;
463
- const nt = () => s.index === m - 1, l = s.peek = (i = 1) => c[s.index + i], C = s.advance = () => c[++s.index] || "", V = () => c.slice(s.index + 1), J = (i = "", L = 0) => {
464
- s.consumed += i, s.index += L;
465
- }, U = (i) => {
466
- s.output += i.output != null ? i.output : i.value, J(i.value);
467
- }, D = () => {
468
- let i = 1;
469
- for (; l() === "!" && (l(2) !== "(" || l(3) === "?"); )
470
- C(), s.start++, i++;
471
- return i % 2 === 0 ? !1 : (s.negated = !0, s.start++, !0);
472
- }, ot = (i) => {
473
- s[i]++, ut.push(i);
474
- }, Z = (i) => {
475
- s[i]--, ut.pop();
476
- }, h = (i) => {
477
- if (t.type === "globstar") {
478
- const L = s.braces > 0 && (i.type === "comma" || i.type === "brace"), n = i.extglob === !0 || k.length && (i.type === "pipe" || i.type === "paren");
479
- i.type !== "slash" && i.type !== "paren" && !L && !n && (s.output = s.output.slice(0, -t.output.length), t.type = "star", t.value = "*", t.output = X, s.output += t.output);
480
- }
481
- if (k.length && i.type !== "paren" && (k[k.length - 1].inner += i.value), (i.value || i.output) && U(i), t && t.type === "text" && i.type === "text") {
482
- t.output = (t.output || t.value) + i.value, t.value += i.value;
483
- return;
484
- }
485
- i.prev = t, S.push(i), t = i;
486
- }, q = (i, L) => {
487
- const n = { ...T[L], conditions: 1, inner: "" };
488
- n.prev = t, n.parens = s.parens, n.output = s.output;
489
- const _ = (r.capture ? "(" : "") + n.open;
490
- ot("parens"), h({ type: i, value: L, output: s.output ? "" : B }), h({ type: "paren", extglob: !0, value: C(), output: _ }), k.push(n);
491
- }, K = (i) => {
492
- let L = i.close + (r.capture ? ")" : ""), n;
493
- if (i.type === "negate") {
494
- let _ = X;
495
- if (i.inner && i.inner.length > 1 && i.inner.includes("/") && (_ = j(r)), (_ !== X || nt() || /^\)+$/.test(V())) && (L = i.close = `)$))${_}`), i.inner.includes("*") && (n = V()) && /^\.[^\\/.]+$/.test(n)) {
496
- const O = x(n, { ...E, fastpaths: !1 }).output;
497
- L = i.close = `)${O})${_})`;
498
- }
499
- i.prev.type === "bos" && (s.negatedExtglob = !0);
500
- }
501
- h({ type: "paren", extglob: !0, value: e, output: L }), Z("parens");
502
- };
503
- if (r.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(c)) {
504
- let i = !1, L = c.replace(o, (n, _, O, Q, P, lt) => Q === "\\" ? (i = !0, n) : Q === "?" ? _ ? _ + Q + (P ? H.repeat(P.length) : "") : lt === 0 ? et + (P ? H.repeat(P.length) : "") : H.repeat(O.length) : Q === "." ? G.repeat(O.length) : Q === "*" ? _ ? _ + Q + (P ? X : "") : X : _ ? n : `\\${n}`);
505
- return i === !0 && (r.unescape === !0 ? L = L.replace(/\\/g, "") : L = L.replace(/\\+/g, (n) => n.length % 2 === 0 ? "\\\\" : n ? "\\" : "")), L === c && r.contains === !0 ? (s.output = c, s) : (s.output = A.wrapOutput(L, s, E), s);
506
- }
507
- for (; !nt(); ) {
508
- if (e = C(), e === "\0")
509
- continue;
510
- if (e === "\\") {
511
- const n = l();
512
- if (n === "/" && r.bash !== !0 || n === "." || n === ";")
513
- continue;
514
- if (!n) {
515
- e += "\\", h({ type: "text", value: e });
516
- continue;
517
- }
518
- const _ = /^\\+/.exec(V());
519
- let O = 0;
520
- if (_ && _[0].length > 2 && (O = _[0].length, s.index += O, O % 2 !== 0 && (e += "\\")), r.unescape === !0 ? e = C() : e += C(), s.brackets === 0) {
521
- h({ type: "text", value: e });
522
- continue;
523
- }
524
- }
525
- if (s.brackets > 0 && (e !== "]" || t.value === "[" || t.value === "[^")) {
526
- if (r.posix !== !1 && e === ":") {
527
- const n = t.value.slice(1);
528
- if (n.includes("[") && (t.posix = !0, n.includes(":"))) {
529
- const _ = t.value.lastIndexOf("["), O = t.value.slice(0, _), Q = t.value.slice(_ + 2), P = d[Q];
530
- if (P) {
531
- t.value = O + P, s.backtrack = !0, C(), !y.output && S.indexOf(t) === 1 && (y.output = B);
532
- continue;
533
- }
534
- }
535
- }
536
- (e === "[" && l() !== ":" || e === "-" && l() === "]") && (e = `\\${e}`), e === "]" && (t.value === "[" || t.value === "[^") && (e = `\\${e}`), r.posix === !0 && e === "!" && t.value === "[" && (e = "^"), t.value += e, U({ value: e });
537
- continue;
538
- }
539
- if (s.quotes === 1 && e !== '"') {
540
- e = A.escapeRegex(e), t.value += e, U({ value: e });
541
- continue;
542
- }
543
- if (e === '"') {
544
- s.quotes = s.quotes === 1 ? 0 : 1, r.keepQuotes === !0 && h({ type: "text", value: e });
545
- continue;
546
- }
547
- if (e === "(") {
548
- ot("parens"), h({ type: "paren", value: e });
549
- continue;
550
- }
551
- if (e === ")") {
552
- if (s.parens === 0 && r.strictBrackets === !0)
553
- throw new SyntaxError(f("opening", "("));
554
- const n = k[k.length - 1];
555
- if (n && s.parens === n.parens + 1) {
556
- K(k.pop());
557
- continue;
558
- }
559
- h({ type: "paren", value: e, output: s.parens ? ")" : "\\)" }), Z("parens");
560
- continue;
561
- }
562
- if (e === "[") {
563
- if (r.nobracket === !0 || !V().includes("]")) {
564
- if (r.nobracket !== !0 && r.strictBrackets === !0)
565
- throw new SyntaxError(f("closing", "]"));
566
- e = `\\${e}`;
567
- } else
568
- ot("brackets");
569
- h({ type: "bracket", value: e });
570
- continue;
571
- }
572
- if (e === "]") {
573
- if (r.nobracket === !0 || t && t.type === "bracket" && t.value.length === 1) {
574
- h({ type: "text", value: e, output: `\\${e}` });
575
- continue;
576
- }
577
- if (s.brackets === 0) {
578
- if (r.strictBrackets === !0)
579
- throw new SyntaxError(f("opening", "["));
580
- h({ type: "text", value: e, output: `\\${e}` });
581
- continue;
582
- }
583
- Z("brackets");
584
- const n = t.value.slice(1);
585
- if (t.posix !== !0 && n[0] === "^" && !n.includes("/") && (e = `/${e}`), t.value += e, U({ value: e }), r.literalBrackets === !1 || A.hasRegexChars(n))
586
- continue;
587
- const _ = A.escapeRegex(t.value);
588
- if (s.output = s.output.slice(0, -t.value.length), r.literalBrackets === !0) {
589
- s.output += _, t.value = _;
590
- continue;
591
- }
592
- t.value = `(${I}${_}|${t.value})`, s.output += t.value;
593
- continue;
594
- }
595
- if (e === "{" && r.nobrace !== !0) {
596
- ot("braces");
597
- const n = {
598
- type: "brace",
599
- value: e,
600
- output: "(",
601
- outputIndex: s.output.length,
602
- tokensIndex: s.tokens.length
603
- };
604
- z.push(n), h(n);
605
- continue;
606
- }
607
- if (e === "}") {
608
- const n = z[z.length - 1];
609
- if (r.nobrace === !0 || !n) {
610
- h({ type: "text", value: e, output: e });
611
- continue;
612
- }
613
- let _ = ")";
614
- if (n.dots === !0) {
615
- const O = S.slice(), Q = [];
616
- for (let P = O.length - 1; P >= 0 && (S.pop(), O[P].type !== "brace"); P--)
617
- O[P].type !== "dots" && Q.unshift(O[P].value);
618
- _ = a(Q, r), s.backtrack = !0;
619
- }
620
- if (n.comma !== !0 && n.dots !== !0) {
621
- const O = s.output.slice(0, n.outputIndex), Q = s.tokens.slice(n.tokensIndex);
622
- n.value = n.output = "\\{", e = _ = "\\}", s.output = O;
623
- for (const P of Q)
624
- s.output += P.output || P.value;
625
- }
626
- h({ type: "brace", value: e, output: _ }), Z("braces"), z.pop();
627
- continue;
628
- }
629
- if (e === "|") {
630
- k.length > 0 && k[k.length - 1].conditions++, h({ type: "text", value: e });
631
- continue;
632
- }
633
- if (e === ",") {
634
- let n = e;
635
- const _ = z[z.length - 1];
636
- _ && ut[ut.length - 1] === "braces" && (_.comma = !0, n = "|"), h({ type: "comma", value: e, output: n });
637
- continue;
638
- }
639
- if (e === "/") {
640
- if (t.type === "dot" && s.index === s.start + 1) {
641
- s.start = s.index + 1, s.consumed = "", s.output = "", S.pop(), t = y;
642
- continue;
643
- }
644
- h({ type: "slash", value: e, output: Y });
645
- continue;
646
- }
647
- if (e === ".") {
648
- if (s.braces > 0 && t.type === "dot") {
649
- t.value === "." && (t.output = G);
650
- const n = z[z.length - 1];
651
- t.type = "dots", t.output += e, t.value += e, n.dots = !0;
652
- continue;
653
- }
654
- if (s.braces + s.parens === 0 && t.type !== "bos" && t.type !== "slash") {
655
- h({ type: "text", value: e, output: G });
656
- continue;
657
- }
658
- h({ type: "dot", value: e, output: G });
659
- continue;
660
- }
661
- if (e === "?") {
662
- if (!(t && t.value === "(") && r.noextglob !== !0 && l() === "(" && l(2) !== "?") {
663
- q("qmark", e);
664
- continue;
665
- }
666
- if (t && t.type === "paren") {
667
- const _ = l();
668
- let O = e;
669
- (t.value === "(" && !/[!=<:]/.test(_) || _ === "<" && !/<([!=]|\w+>)/.test(V())) && (O = `\\${e}`), h({ type: "text", value: e, output: O });
670
- continue;
671
- }
672
- if (r.dot !== !0 && (t.type === "slash" || t.type === "bos")) {
673
- h({ type: "qmark", value: e, output: N });
674
- continue;
675
- }
676
- h({ type: "qmark", value: e, output: H });
677
- continue;
678
- }
679
- if (e === "!") {
680
- if (r.noextglob !== !0 && l() === "(" && (l(2) !== "?" || !/[!=<:]/.test(l(3)))) {
681
- q("negate", e);
682
- continue;
683
- }
684
- if (r.nonegate !== !0 && s.index === 0) {
685
- D();
686
- continue;
687
- }
688
- }
689
- if (e === "+") {
690
- if (r.noextglob !== !0 && l() === "(" && l(2) !== "?") {
691
- q("plus", e);
692
- continue;
693
- }
694
- if (t && t.value === "(" || r.regex === !1) {
695
- h({ type: "plus", value: e, output: b });
696
- continue;
697
- }
698
- if (t && (t.type === "bracket" || t.type === "paren" || t.type === "brace") || s.parens > 0) {
699
- h({ type: "plus", value: e });
700
- continue;
701
- }
702
- h({ type: "plus", value: b });
703
- continue;
704
- }
705
- if (e === "@") {
706
- if (r.noextglob !== !0 && l() === "(" && l(2) !== "?") {
707
- h({ type: "at", extglob: !0, value: e, output: "" });
708
- continue;
709
- }
710
- h({ type: "text", value: e });
711
- continue;
712
- }
713
- if (e !== "*") {
714
- (e === "$" || e === "^") && (e = `\\${e}`);
715
- const n = g.exec(V());
716
- n && (e += n[0], s.index += n[0].length), h({ type: "text", value: e });
717
- continue;
718
- }
719
- if (t && (t.type === "globstar" || t.star === !0)) {
720
- t.type = "star", t.star = !0, t.value += e, t.output = X, s.backtrack = !0, s.globstar = !0, J(e);
721
- continue;
722
- }
723
- let i = V();
724
- if (r.noextglob !== !0 && /^\([^?]/.test(i)) {
725
- q("star", e);
726
- continue;
727
- }
728
- if (t.type === "star") {
729
- if (r.noglobstar === !0) {
730
- J(e);
731
- continue;
732
- }
733
- const n = t.prev, _ = n.prev, O = n.type === "slash" || n.type === "bos", Q = _ && (_.type === "star" || _.type === "globstar");
734
- if (r.bash === !0 && (!O || i[0] && i[0] !== "/")) {
735
- h({ type: "star", value: e, output: "" });
736
- continue;
737
- }
738
- const P = s.braces > 0 && (n.type === "comma" || n.type === "brace"), lt = k.length && (n.type === "pipe" || n.type === "paren");
739
- if (!O && n.type !== "paren" && !P && !lt) {
740
- h({ type: "star", value: e, output: "" });
741
- continue;
742
- }
743
- for (; i.slice(0, 3) === "/**"; ) {
744
- const at = c[s.index + 4];
745
- if (at && at !== "/")
746
- break;
747
- i = i.slice(3), J("/**", 3);
748
- }
749
- if (n.type === "bos" && nt()) {
750
- t.type = "globstar", t.value += e, t.output = j(r), s.output = t.output, s.globstar = !0, J(e);
751
- continue;
752
- }
753
- if (n.type === "slash" && n.prev.type !== "bos" && !Q && nt()) {
754
- s.output = s.output.slice(0, -(n.output + t.output).length), n.output = `(?:${n.output}`, t.type = "globstar", t.output = j(r) + (r.strictSlashes ? ")" : "|$)"), t.value += e, s.globstar = !0, s.output += n.output + t.output, J(e);
755
- continue;
756
- }
757
- if (n.type === "slash" && n.prev.type !== "bos" && i[0] === "/") {
758
- const at = i[1] !== void 0 ? "|$" : "";
759
- s.output = s.output.slice(0, -(n.output + t.output).length), n.output = `(?:${n.output}`, t.type = "globstar", t.output = `${j(r)}${Y}|${Y}${at})`, t.value += e, s.output += n.output + t.output, s.globstar = !0, J(e + C()), h({ type: "slash", value: "/", output: "" });
760
- continue;
761
- }
762
- if (n.type === "bos" && i[0] === "/") {
763
- t.type = "globstar", t.value += e, t.output = `(?:^|${Y}|${j(r)}${Y})`, s.output = t.output, s.globstar = !0, J(e + C()), h({ type: "slash", value: "/", output: "" });
764
- continue;
765
- }
766
- s.output = s.output.slice(0, -t.output.length), t.type = "globstar", t.output = j(r), t.value += e, s.output += t.output, s.globstar = !0, J(e);
767
- continue;
768
- }
769
- const L = { type: "star", value: e, output: X };
770
- if (r.bash === !0) {
771
- L.output = ".*?", (t.type === "bos" || t.type === "slash") && (L.output = v + L.output), h(L);
772
- continue;
773
- }
774
- if (t && (t.type === "bracket" || t.type === "paren") && r.regex === !0) {
775
- L.output = e, h(L);
776
- continue;
777
- }
778
- (s.index === s.start || t.type === "slash" || t.type === "dot") && (t.type === "dot" ? (s.output += st, t.output += st) : r.dot === !0 ? (s.output += M, t.output += M) : (s.output += v, t.output += v), l() !== "*" && (s.output += B, t.output += B)), h(L);
779
- }
780
- for (; s.brackets > 0; ) {
781
- if (r.strictBrackets === !0) throw new SyntaxError(f("closing", "]"));
782
- s.output = A.escapeLast(s.output, "["), Z("brackets");
783
- }
784
- for (; s.parens > 0; ) {
785
- if (r.strictBrackets === !0) throw new SyntaxError(f("closing", ")"));
786
- s.output = A.escapeLast(s.output, "("), Z("parens");
787
- }
788
- for (; s.braces > 0; ) {
789
- if (r.strictBrackets === !0) throw new SyntaxError(f("closing", "}"));
790
- s.output = A.escapeLast(s.output, "{"), Z("braces");
791
- }
792
- if (r.strictSlashes !== !0 && (t.type === "star" || t.type === "bracket") && h({ type: "maybe_slash", value: "", output: `${Y}?` }), s.backtrack === !0) {
793
- s.output = "";
794
- for (const i of s.tokens)
795
- s.output += i.output != null ? i.output : i.value, i.suffix && (s.output += i.suffix);
796
- }
797
- return s;
798
- };
799
- return x.fastpaths = (c, E) => {
800
- const r = { ...E }, $ = typeof r.maxLength == "number" ? Math.min(R, r.maxLength) : R, m = c.length;
801
- if (m > $)
802
- throw new SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${$}`);
803
- c = u[c] || c;
804
- const {
805
- DOT_LITERAL: y,
806
- SLASH_LITERAL: S,
807
- ONE_CHAR: I,
808
- DOTS_SLASH: F,
809
- NO_DOT: T,
810
- NO_DOTS: G,
811
- NO_DOTS_SLASH: b,
812
- STAR: Y,
813
- START_ANCHOR: B
814
- } = p.globChars(r.windows), W = r.dot ? G : T, w = r.dot ? b : T, st = r.capture ? "" : "?:", M = { negated: !1, prefix: "" };
815
- let H = r.bash === !0 ? ".*?" : Y;
816
- r.capture && (H = `(${H})`);
817
- const N = (v) => v.noglobstar === !0 ? H : `(${st}(?:(?!${B}${v.dot ? F : y}).)*?)`, tt = (v) => {
818
- switch (v) {
819
- case "*":
820
- return `${W}${I}${H}`;
821
- case ".*":
822
- return `${y}${I}${H}`;
823
- case "*.*":
824
- return `${W}${H}${y}${I}${H}`;
825
- case "*/*":
826
- return `${W}${H}${S}${I}${w}${H}`;
827
- case "**":
828
- return W + N(r);
829
- case "**/*":
830
- return `(?:${W}${N(r)}${S})?${w}${I}${H}`;
831
- case "**/*.*":
832
- return `(?:${W}${N(r)}${S})?${w}${H}${y}${I}${H}`;
833
- case "**/.*":
834
- return `(?:${W}${N(r)}${S})?${y}${I}${H}`;
835
- default: {
836
- const et = /^(.*?)\.(\w+)$/.exec(v);
837
- if (!et) return;
838
- const X = tt(et[1]);
839
- return X ? X + y + et[2] : void 0;
840
- }
841
- }
842
- }, rt = A.removePrefix(c, M);
843
- let j = tt(rt);
844
- return j && r.strictSlashes !== !0 && (j += `${S}?`), j;
845
- }, At = x, At;
846
- }
847
- var Rt, bt;
848
- function It() {
849
- if (bt) return Rt;
850
- bt = 1;
851
- const p = /* @__PURE__ */ wt(), A = /* @__PURE__ */ Nt(), R = /* @__PURE__ */ ct(), d = /* @__PURE__ */ it(), g = (u) => u && typeof u == "object" && !Array.isArray(u), o = (u, a, f = !1) => {
852
- if (Array.isArray(u)) {
853
- const S = u.map((F) => o(F, a, f));
854
- return (F) => {
855
- for (const T of S) {
856
- const G = T(F);
857
- if (G) return G;
858
- }
859
- return !1;
860
- };
861
- }
862
- const x = g(u) && u.tokens && u.input;
863
- if (u === "" || typeof u != "string" && !x)
864
- throw new TypeError("Expected pattern to be a non-empty string");
865
- const c = a || {}, E = c.windows, r = x ? o.compileRe(u, a) : o.makeRe(u, a, !1, !0), $ = r.state;
866
- delete r.state;
867
- let m = () => !1;
868
- if (c.ignore) {
869
- const S = { ...a, ignore: null, onMatch: null, onResult: null };
870
- m = o(c.ignore, S, f);
871
- }
872
- const y = (S, I = !1) => {
873
- const { isMatch: F, match: T, output: G } = o.test(S, r, a, { glob: u, posix: E }), b = { glob: u, state: $, regex: r, posix: E, input: S, output: G, match: T, isMatch: F };
874
- return typeof c.onResult == "function" && c.onResult(b), F === !1 ? (b.isMatch = !1, I ? b : !1) : m(S) ? (typeof c.onIgnore == "function" && c.onIgnore(b), b.isMatch = !1, I ? b : !1) : (typeof c.onMatch == "function" && c.onMatch(b), I ? b : !0);
875
- };
876
- return f && (y.state = $), y;
877
- };
878
- return o.test = (u, a, f, { glob: x, posix: c } = {}) => {
879
- if (typeof u != "string")
880
- throw new TypeError("Expected input to be a string");
881
- if (u === "")
882
- return { isMatch: !1, output: "" };
883
- const E = f || {}, r = E.format || (c ? R.toPosixSlashes : null);
884
- let $ = u === x, m = $ && r ? r(u) : u;
885
- return $ === !1 && (m = r ? r(u) : u, $ = m === x), ($ === !1 || E.capture === !0) && (E.matchBase === !0 || E.basename === !0 ? $ = o.matchBase(u, a, f, c) : $ = a.exec(m)), { isMatch: !!$, match: $, output: m };
886
- }, o.matchBase = (u, a, f) => (a instanceof RegExp ? a : o.makeRe(a, f)).test(R.basename(u)), o.isMatch = (u, a, f) => o(a, f)(u), o.parse = (u, a) => Array.isArray(u) ? u.map((f) => o.parse(f, a)) : A(u, { ...a, fastpaths: !1 }), o.scan = (u, a) => p(u, a), o.compileRe = (u, a, f = !1, x = !1) => {
887
- if (f === !0)
888
- return u.output;
889
- const c = a || {}, E = c.contains ? "" : "^", r = c.contains ? "" : "$";
890
- let $ = `${E}(?:${u.output})${r}`;
891
- u && u.negated === !0 && ($ = `^(?!${$}).*$`);
892
- const m = o.toRegex($, a);
893
- return x === !0 && (m.state = u), m;
894
- }, o.makeRe = (u, a = {}, f = !1, x = !1) => {
895
- if (!u || typeof u != "string")
896
- throw new TypeError("Expected a non-empty string");
897
- let c = { negated: !1, fastpaths: !0 };
898
- return a.fastpaths !== !1 && (u[0] === "." || u[0] === "*") && (c.output = A.fastpaths(u, a)), c.output || (c = A(u, a)), o.compileRe(c, a, f, x);
899
- }, o.toRegex = (u, a) => {
900
- try {
901
- const f = a || {};
902
- return new RegExp(u, f.flags || (f.nocase ? "i" : ""));
903
- } catch (f) {
904
- if (a && a.debug === !0) throw f;
905
- return /$^/;
906
- }
907
- }, o.constants = d, Rt = o, Rt;
908
- }
909
- var _t, xt;
910
- function kt() {
911
- if (xt) return _t;
912
- xt = 1;
913
- const p = /* @__PURE__ */ It(), A = /* @__PURE__ */ ct();
914
- function R(d, g, o = !1) {
915
- return g && (g.windows === null || g.windows === void 0) && (g = { ...g, windows: A.isWindows() }), p(d, g, o);
916
- }
917
- return Object.assign(R, p), _t = R, _t;
918
- }
919
- var Pt = /* @__PURE__ */ kt();
920
- const Dt = /* @__PURE__ */ Ht(Pt), Xt = ({ args: p }, { dirs: A }) => {
921
- if (A.length === 0)
922
- return new $t((d) => {
923
- d.next({
924
- status: "error",
925
- error: { message: "No directory provided" }
926
- }), d.complete();
927
- });
928
- const R = {};
929
- return p.limit !== void 0 && (R.limit = p.limit), p.offset !== void 0 && (R.offset = p.offset), Gt(A, p.filePattern, R);
930
- };
931
- function Gt(p, A, R) {
932
- return mt(
933
- ...p.map((d) => Bt(d, A, R))
934
- ).pipe(
935
- Lt((d) => {
936
- const g = [];
937
- for (const a of d)
938
- a.status === "in-progress" ? g.push(...a?.progress ?? []) : a.status === "done" ? g.push(...a.result) : a.status === "error" ? g.push(...a.progress ?? []) : a.status === "cancelled" && g.push(...a.progress ?? []);
939
- const o = d.filter((a) => a.status === "error");
940
- return o.length > 0 ? {
941
- status: "error",
942
- progress: g,
943
- error: {
944
- message: o.map((a) => a?.error?.message ?? "").join(`
945
- `)
946
- }
947
- } : {
948
- status: d.every((a) => a.status === "done") ? "done" : d.some((a) => a.status === "cancelled") ? "cancelled" : "in-progress",
949
- progress: g,
950
- result: g
951
- };
952
- })
953
- );
954
- }
955
- function Bt(p, A, R) {
956
- return Tt(p), new $t((d) => {
957
- d.next({
958
- status: "in-progress",
959
- progress: []
960
- }), Mt(p.fsPath, A ? { pattern: A, caseInsensitive: !0 } : null, R ?? {}).then(({ files: g, remaining: o }) => {
961
- o > 0 && g.push(`--- ${o} more files not shown ---`), d.next({
962
- status: "done",
963
- progress: g,
964
- result: g
965
- });
966
- }).catch((g) => {
967
- const o = g instanceof Error ? g.message : String(g);
968
- d.next({
969
- status: "error",
970
- progress: [],
971
- error: { message: o }
972
- });
973
- }).finally(() => d.complete());
974
- });
975
- }
976
- const gt = 5e5;
977
- function Mt(p, A, R) {
978
- const d = R.limit ?? gt;
979
- A?.pattern && A.pattern === "*" && (A.pattern = "**");
980
- const g = A?.pattern ? Dt(A.pattern, { nocase: A.caseInsensitive, dot: !0 }) : void 0, o = [
981
- "--files",
982
- "--color",
983
- "never",
984
- "--no-require-git",
985
- // We want to include hidden files because dot-files in a repository are often important.
986
- "--hidden",
987
- // Ripgrep will include the .git/ directory when using --hidden unless
988
- // the user explicitly gitignores the .git/ directory, or rgignores it,
989
- // which most people don't.
990
- "--glob",
991
- "!\\.git/"
992
- ];
993
- R.maxDepth !== void 0 && o.push("--max-depth", R.maxDepth.toString()), R.basePath !== void 0 && o.push(R.basePath);
994
- const u = yt(Ot(), o, {
995
- cwd: p,
996
- stdio: ["ignore", "pipe", "pipe"],
997
- detached: process.platform !== "win32",
998
- env: {
999
- ...process.env,
1000
- NONINTERACTIVE: "1",
1001
- DEBIAN_FRONTEND: "noninteractive"
1002
- }
1003
- });
1004
- return new Promise((a, f) => {
1005
- const x = [];
1006
- let c = "", E = "", r = R.offset ?? 0, $ = !1;
1007
- const m = () => {
1008
- if ($ || !E || g && !g(E))
1009
- return;
1010
- const y = E;
1011
- if (E = "", r > 0) {
1012
- r--;
1013
- return;
1014
- }
1015
- x.push(y), x.length >= gt && (vt.warn("Glob limit reached. Returning partial results.", {
1016
- glob: A?.pattern,
1017
- limit: gt,
1018
- dir: p
1019
- }), u.kill(), $ = !0, a({
1020
- files: x,
1021
- remaining: 0,
1022
- aborted: !0
1023
- }));
1024
- };
1025
- u.stdout?.on("data", (y) => {
1026
- for (const S of String(y))
1027
- S !== "\r" && (S === `
1028
- ` ? (m(), E = "") : E += S);
1029
- }), u?.stderr?.on("data", (y) => {
1030
- c += String(y);
1031
- }), u.on("exit", (y) => {
1032
- if (y && y >= 2) {
1033
- f(new Error(`ripgrep exited with code ${y}:
1034
- ${c}`));
1035
- return;
1036
- }
1037
- m();
1038
- const S = x.slice(0, d);
1039
- a({
1040
- files: S,
1041
- remaining: x.length - S.length
1042
- });
1043
- });
1044
- });
1045
- }
1046
- export {
1047
- Gt as globFilesWithRipgrep,
1048
- Xt as nodeGlobTool,
1049
- Mt as ripgrepFiles
1050
- };
1051
- //# sourceMappingURL=glob.node-BnKeKl9M.js.map