storybook 10.0.0-beta.1 → 10.0.0-beta.11

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 (124) hide show
  1. package/assets/server/openBrowser.applescript +94 -0
  2. package/dist/_browser-chunks/Color-KPLIACXP.js +1569 -0
  3. package/dist/_browser-chunks/{WithTooltip-ERFLZL6W.js → WithTooltip-SK46ZJ2J.js} +1 -1
  4. package/dist/_browser-chunks/{chunk-YY5GICNT.js → chunk-6E2SHJSL.js} +175 -32
  5. package/dist/_browser-chunks/{chunk-EOILZP2R.js → chunk-BOOOPFZF.js} +7 -2
  6. package/dist/_browser-chunks/{chunk-YWDKX534.js → chunk-FA42P6MO.js} +49 -4
  7. package/dist/_browser-chunks/chunk-G33S6YM3.js +521 -0
  8. package/dist/_browser-chunks/{chunk-MZNYTCNT.js → chunk-HMIIJ6UD.js} +6 -6
  9. package/dist/_browser-chunks/{chunk-4QPX7WIQ.js → chunk-JJZMHC3A.js} +57 -166
  10. package/dist/_browser-chunks/{chunk-MD2FTHCZ.js → chunk-JVSKG4YS.js} +3 -16
  11. package/dist/_browser-chunks/{chunk-E7VLET3C.js → chunk-KSCAWCCE.js} +3947 -4291
  12. package/dist/_browser-chunks/{chunk-PYK5ZTFK.js → chunk-PS3AOQI4.js} +48 -25
  13. package/dist/_browser-chunks/chunk-QK3L5AXO.js +372 -0
  14. package/dist/_browser-chunks/chunk-SHR3NNR3.js +5810 -0
  15. package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
  16. package/dist/_browser-chunks/chunk-VUAFL5XK.js +20 -0
  17. package/dist/_browser-chunks/{chunk-T7RCAJIX.js → chunk-Y3M7TW6K.js} +43 -47
  18. package/dist/_browser-chunks/{syntaxhighlighter-YYAA4CS4.js → syntaxhighlighter-R46XOLMC.js} +1 -1
  19. package/dist/_node-chunks/{builder-manager-EXW4ETLN.js → builder-manager-VLFDK43H.js} +45 -155
  20. package/dist/_node-chunks/camelcase-RENSEFK6.js +18 -0
  21. package/dist/_node-chunks/{chunk-5ZX5SJOP.js → chunk-4SPBIDJV.js} +162 -103
  22. package/dist/_node-chunks/{chunk-PMEEE3UE.js → chunk-4WZFG35Z.js} +30 -21
  23. package/dist/_node-chunks/{chunk-WP7DV5JT.js → chunk-5K7G6NFK.js} +583 -180
  24. package/dist/_node-chunks/{chunk-FZP2YGG3.js → chunk-5NSMDC6F.js} +7 -7
  25. package/dist/_node-chunks/{chunk-6CCUFDHU.js → chunk-5THWZTEL.js} +7 -7
  26. package/dist/_node-chunks/chunk-7MUMULSR.js +79 -0
  27. package/dist/_node-chunks/chunk-7QAAJL75.js +1540 -0
  28. package/dist/_node-chunks/{chunk-EO4S3VXL.js → chunk-DVY3VWHZ.js} +653 -775
  29. package/dist/_node-chunks/{chunk-WDKWVNL2.js → chunk-EBLOP2C5.js} +7 -7
  30. package/dist/_node-chunks/{chunk-EDBXIJN5.js → chunk-EF56ZUQY.js} +7 -7
  31. package/dist/_node-chunks/{chunk-F5J33SXQ.js → chunk-ER2UQBIA.js} +7 -7
  32. package/dist/_node-chunks/chunk-GHICGP2P.js +18 -0
  33. package/dist/_node-chunks/{chunk-4WNZYNQY.js → chunk-GYBN5GXT.js} +623 -750
  34. package/dist/_node-chunks/{chunk-2G5THETV.js → chunk-H2YBWE3T.js} +12 -12
  35. package/dist/_node-chunks/{camelcase-VZZFWA2L.js → chunk-HYMBYTGJ.js} +9 -8
  36. package/dist/_node-chunks/{chunk-SUMFFLGF.js → chunk-Q5IJJX3T.js} +6 -6
  37. package/dist/_node-chunks/{chunk-U45F2NP6.js → chunk-QLRMR54O.js} +7 -7
  38. package/dist/_node-chunks/{chunk-XTSBFCVE.js → chunk-QSNDRP62.js} +7 -7
  39. package/dist/_node-chunks/chunk-S2RQAF7K.js +4741 -0
  40. package/dist/_node-chunks/{chunk-2QZOLZDJ.js → chunk-SDZVOIZI.js} +9 -9
  41. package/dist/_node-chunks/{chunk-VNLBDN2Z.js → chunk-SGJZDMJW.js} +6 -6
  42. package/dist/_node-chunks/{chunk-PL2PKDRO.js → chunk-TJOIDMXP.js} +60 -102
  43. package/dist/_node-chunks/{chunk-ICPKUV5G.js → chunk-U2UIPLJI.js} +7 -7
  44. package/dist/_node-chunks/{chunk-3SGKBLOL.js → chunk-UAMXREF3.js} +8 -8
  45. package/dist/_node-chunks/{chunk-GVCXNIAA.js → chunk-UC6O5PNX.js} +399 -116
  46. package/dist/_node-chunks/{chunk-CM3UGTR5.js → chunk-VFUP6Z4J.js} +7 -7
  47. package/dist/_node-chunks/{chunk-3ZKQWDCG.js → chunk-XKPJCSPD.js} +223 -243
  48. package/dist/_node-chunks/{chunk-24TGL6EX.js → chunk-XWCQWB3R.js} +8 -8
  49. package/dist/_node-chunks/{chunk-QC5FE2D7.js → chunk-XYFEBEHY.js} +7 -7
  50. package/dist/_node-chunks/chunk-YAEIMHFX.js +62 -0
  51. package/dist/_node-chunks/{chunk-5V6QH7WC.js → chunk-ZHBCPKYD.js} +7 -7
  52. package/dist/_node-chunks/{dist-VZL6D6Y3.js → dist-A2RPEHEC.js} +9 -9
  53. package/dist/_node-chunks/{globby-GZXJJ4W6.js → globby-3TWPXGQS.js} +17 -13
  54. package/dist/_node-chunks/{lib-PHT5GCV2.js → lib-MUNM6ZJ6.js} +40 -16
  55. package/dist/_node-chunks/{mdx-N42X6CFJ-EPDIV4A2.js → mdx-N42X6CFJ-QQDHJZQ3.js} +8 -8
  56. package/dist/_node-chunks/{p-limit-AJIFSZTI.js → p-limit-FEN55OV6.js} +76 -10
  57. package/dist/_node-chunks/{plugin-3VI56CEF.js → plugin-ESAYNJ5V.js} +11 -11
  58. package/dist/_node-chunks/{plugin-AV4OEKYM.js → plugin-GDMP3JPR.js} +10 -10
  59. package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-E7J5FKLA.js → webpack-inject-mocker-runtime-plugin-5AKTLYIV.js} +1307 -847
  60. package/dist/_node-chunks/{webpack-mock-plugin-VTYGW7HO.js → webpack-mock-plugin-AWGZ65AQ.js} +9 -9
  61. package/dist/babel/index.d.ts +1 -1
  62. package/dist/babel/index.js +11 -11
  63. package/dist/bin/core.js +638 -187
  64. package/dist/bin/dispatcher.js +11 -11
  65. package/dist/bin/loader.js +77 -12
  66. package/dist/cli/index.d.ts +62 -75
  67. package/dist/cli/index.js +67 -55
  68. package/dist/common/index.d.ts +3 -1
  69. package/dist/common/index.js +22 -22
  70. package/dist/components/index.d.ts +228 -1
  71. package/dist/components/index.js +74 -5738
  72. package/dist/core-events/index.d.ts +18 -2
  73. package/dist/core-events/index.js +7 -1
  74. package/dist/core-server/index.d.ts +515 -14
  75. package/dist/core-server/index.js +4647 -4182
  76. package/dist/core-server/presets/common-manager.js +1570 -1272
  77. package/dist/core-server/presets/common-override-preset.js +9 -9
  78. package/dist/core-server/presets/common-preset.js +691 -38
  79. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
  80. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
  81. package/dist/csf/index.d.ts +9 -4
  82. package/dist/csf/index.js +50 -15
  83. package/dist/csf-tools/index.d.ts +47 -6
  84. package/dist/csf-tools/index.js +9 -9
  85. package/dist/docs-tools/index.js +4 -4
  86. package/dist/instrumenter/index.js +1 -1
  87. package/dist/manager/globals-runtime.js +9230 -18109
  88. package/dist/manager/globals.d.ts +0 -4
  89. package/dist/manager/globals.js +1 -6
  90. package/dist/manager/runtime.js +13194 -11367
  91. package/dist/manager-api/index.d.ts +513 -5
  92. package/dist/manager-api/index.js +364 -90
  93. package/dist/manager-errors.d.ts +501 -0
  94. package/dist/node-logger/index.d.ts +1 -1
  95. package/dist/node-logger/index.js +1136 -662
  96. package/dist/preview/globals.js +1 -1
  97. package/dist/preview/runtime.js +12103 -21579
  98. package/dist/preview-api/index.d.ts +70 -71
  99. package/dist/preview-api/index.js +10 -10
  100. package/dist/preview-errors.d.ts +501 -0
  101. package/dist/router/index.d.ts +668 -10
  102. package/dist/router/index.js +2 -2
  103. package/dist/server-errors.d.ts +501 -0
  104. package/dist/server-errors.js +10 -10
  105. package/dist/telemetry/index.d.ts +1 -1
  106. package/dist/telemetry/index.js +23 -25
  107. package/dist/test/index.js +1874 -4024
  108. package/dist/theming/index.d.ts +2 -2
  109. package/dist/theming/index.js +6 -6
  110. package/dist/types/index.d.ts +553 -16
  111. package/dist/viewport/index.d.ts +36 -4
  112. package/dist/viewport/index.js +1 -1
  113. package/package.json +9 -46
  114. package/dist/_browser-chunks/Color-SFYJJKWL.js +0 -605
  115. package/dist/_browser-chunks/chunk-DHO2SA6L.js +0 -12
  116. package/dist/_browser-chunks/chunk-WPHPDNUA.js +0 -974
  117. package/dist/_node-chunks/chunk-32JYCD74.js +0 -80
  118. package/dist/_node-chunks/chunk-GE6I3YYG.js +0 -62
  119. package/dist/_node-chunks/chunk-KXCNXWXI.js +0 -18
  120. package/dist/_node-chunks/chunk-LAUOYAOX.js +0 -87
  121. package/dist/_node-chunks/chunk-QJTT4OC2.js +0 -266
  122. package/dist/_node-chunks/chunk-V2ZF4DUD.js +0 -2377
  123. package/dist/_node-chunks/chunk-ZMV3WY6R.js +0 -9845
  124. package/dist/_node-chunks/default-browser-id-JNATP42X.js +0 -1719
@@ -0,0 +1,4741 @@
1
+ import CJS_COMPAT_NODE_URL_91hxho9jtpf from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_91hxho9jtpf from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_91hxho9jtpf from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_91hxho9jtpf.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_91hxho9jtpf.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_91hxho9jtpf.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ any,
14
+ up,
15
+ up2
16
+ } from "./chunk-7MUMULSR.js";
17
+ import {
18
+ __commonJS,
19
+ __name,
20
+ __require,
21
+ __toESM
22
+ } from "./chunk-Q5IJJX3T.js";
23
+
24
+ // ../node_modules/tinyglobby/node_modules/picomatch/lib/constants.js
25
+ var require_constants = __commonJS({
26
+ "../node_modules/tinyglobby/node_modules/picomatch/lib/constants.js"(exports, module) {
27
+ "use strict";
28
+ var WIN_SLASH = "\\\\/";
29
+ var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
30
+ var DOT_LITERAL = "\\.";
31
+ var PLUS_LITERAL = "\\+";
32
+ var QMARK_LITERAL = "\\?";
33
+ var SLASH_LITERAL = "\\/";
34
+ var ONE_CHAR = "(?=.)";
35
+ var QMARK = "[^/]";
36
+ var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
37
+ var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
38
+ var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
39
+ var NO_DOT = `(?!${DOT_LITERAL})`;
40
+ var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
41
+ var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
42
+ var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
43
+ var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
44
+ var STAR = `${QMARK}*?`;
45
+ var SEP = "/";
46
+ var POSIX_CHARS = {
47
+ DOT_LITERAL,
48
+ PLUS_LITERAL,
49
+ QMARK_LITERAL,
50
+ SLASH_LITERAL,
51
+ ONE_CHAR,
52
+ QMARK,
53
+ END_ANCHOR,
54
+ DOTS_SLASH,
55
+ NO_DOT,
56
+ NO_DOTS,
57
+ NO_DOT_SLASH,
58
+ NO_DOTS_SLASH,
59
+ QMARK_NO_DOT,
60
+ STAR,
61
+ START_ANCHOR,
62
+ SEP
63
+ };
64
+ var WINDOWS_CHARS = {
65
+ ...POSIX_CHARS,
66
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
67
+ QMARK: WIN_NO_SLASH,
68
+ STAR: `${WIN_NO_SLASH}*?`,
69
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
70
+ NO_DOT: `(?!${DOT_LITERAL})`,
71
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
72
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
73
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
74
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
75
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
76
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
77
+ SEP: "\\"
78
+ };
79
+ var POSIX_REGEX_SOURCE = {
80
+ alnum: "a-zA-Z0-9",
81
+ alpha: "a-zA-Z",
82
+ ascii: "\\x00-\\x7F",
83
+ blank: " \\t",
84
+ cntrl: "\\x00-\\x1F\\x7F",
85
+ digit: "0-9",
86
+ graph: "\\x21-\\x7E",
87
+ lower: "a-z",
88
+ print: "\\x20-\\x7E ",
89
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
90
+ space: " \\t\\r\\n\\v\\f",
91
+ upper: "A-Z",
92
+ word: "A-Za-z0-9_",
93
+ xdigit: "A-Fa-f0-9"
94
+ };
95
+ module.exports = {
96
+ MAX_LENGTH: 1024 * 64,
97
+ POSIX_REGEX_SOURCE,
98
+ // regular expressions
99
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
100
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
101
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
102
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
103
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
104
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
105
+ // Replace globs with equivalent patterns to reduce parsing time.
106
+ REPLACEMENTS: {
107
+ __proto__: null,
108
+ "***": "*",
109
+ "**/**": "**",
110
+ "**/**/**": "**"
111
+ },
112
+ // Digits
113
+ CHAR_0: 48,
114
+ /* 0 */
115
+ CHAR_9: 57,
116
+ /* 9 */
117
+ // Alphabet chars.
118
+ CHAR_UPPERCASE_A: 65,
119
+ /* A */
120
+ CHAR_LOWERCASE_A: 97,
121
+ /* a */
122
+ CHAR_UPPERCASE_Z: 90,
123
+ /* Z */
124
+ CHAR_LOWERCASE_Z: 122,
125
+ /* z */
126
+ CHAR_LEFT_PARENTHESES: 40,
127
+ /* ( */
128
+ CHAR_RIGHT_PARENTHESES: 41,
129
+ /* ) */
130
+ CHAR_ASTERISK: 42,
131
+ /* * */
132
+ // Non-alphabetic chars.
133
+ CHAR_AMPERSAND: 38,
134
+ /* & */
135
+ CHAR_AT: 64,
136
+ /* @ */
137
+ CHAR_BACKWARD_SLASH: 92,
138
+ /* \ */
139
+ CHAR_CARRIAGE_RETURN: 13,
140
+ /* \r */
141
+ CHAR_CIRCUMFLEX_ACCENT: 94,
142
+ /* ^ */
143
+ CHAR_COLON: 58,
144
+ /* : */
145
+ CHAR_COMMA: 44,
146
+ /* , */
147
+ CHAR_DOT: 46,
148
+ /* . */
149
+ CHAR_DOUBLE_QUOTE: 34,
150
+ /* " */
151
+ CHAR_EQUAL: 61,
152
+ /* = */
153
+ CHAR_EXCLAMATION_MARK: 33,
154
+ /* ! */
155
+ CHAR_FORM_FEED: 12,
156
+ /* \f */
157
+ CHAR_FORWARD_SLASH: 47,
158
+ /* / */
159
+ CHAR_GRAVE_ACCENT: 96,
160
+ /* ` */
161
+ CHAR_HASH: 35,
162
+ /* # */
163
+ CHAR_HYPHEN_MINUS: 45,
164
+ /* - */
165
+ CHAR_LEFT_ANGLE_BRACKET: 60,
166
+ /* < */
167
+ CHAR_LEFT_CURLY_BRACE: 123,
168
+ /* { */
169
+ CHAR_LEFT_SQUARE_BRACKET: 91,
170
+ /* [ */
171
+ CHAR_LINE_FEED: 10,
172
+ /* \n */
173
+ CHAR_NO_BREAK_SPACE: 160,
174
+ /* \u00A0 */
175
+ CHAR_PERCENT: 37,
176
+ /* % */
177
+ CHAR_PLUS: 43,
178
+ /* + */
179
+ CHAR_QUESTION_MARK: 63,
180
+ /* ? */
181
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
182
+ /* > */
183
+ CHAR_RIGHT_CURLY_BRACE: 125,
184
+ /* } */
185
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
186
+ /* ] */
187
+ CHAR_SEMICOLON: 59,
188
+ /* ; */
189
+ CHAR_SINGLE_QUOTE: 39,
190
+ /* ' */
191
+ CHAR_SPACE: 32,
192
+ /* */
193
+ CHAR_TAB: 9,
194
+ /* \t */
195
+ CHAR_UNDERSCORE: 95,
196
+ /* _ */
197
+ CHAR_VERTICAL_LINE: 124,
198
+ /* | */
199
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
200
+ /* \uFEFF */
201
+ /**
202
+ * Create EXTGLOB_CHARS
203
+ */
204
+ extglobChars(chars) {
205
+ return {
206
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
207
+ "?": { type: "qmark", open: "(?:", close: ")?" },
208
+ "+": { type: "plus", open: "(?:", close: ")+" },
209
+ "*": { type: "star", open: "(?:", close: ")*" },
210
+ "@": { type: "at", open: "(?:", close: ")" }
211
+ };
212
+ },
213
+ /**
214
+ * Create GLOB_CHARS
215
+ */
216
+ globChars(win32) {
217
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
218
+ }
219
+ };
220
+ }
221
+ });
222
+
223
+ // ../node_modules/tinyglobby/node_modules/picomatch/lib/utils.js
224
+ var require_utils = __commonJS({
225
+ "../node_modules/tinyglobby/node_modules/picomatch/lib/utils.js"(exports) {
226
+ "use strict";
227
+ var {
228
+ REGEX_BACKSLASH,
229
+ REGEX_REMOVE_BACKSLASH,
230
+ REGEX_SPECIAL_CHARS,
231
+ REGEX_SPECIAL_CHARS_GLOBAL
232
+ } = require_constants();
233
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
234
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
235
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
236
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
237
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
238
+ exports.isWindows = () => {
239
+ if (typeof navigator !== "undefined" && navigator.platform) {
240
+ const platform = navigator.platform.toLowerCase();
241
+ return platform === "win32" || platform === "windows";
242
+ }
243
+ if (typeof process !== "undefined" && process.platform) {
244
+ return process.platform === "win32";
245
+ }
246
+ return false;
247
+ };
248
+ exports.removeBackslashes = (str) => {
249
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
250
+ return match === "\\" ? "" : match;
251
+ });
252
+ };
253
+ exports.escapeLast = (input, char, lastIdx) => {
254
+ const idx = input.lastIndexOf(char, lastIdx);
255
+ if (idx === -1) return input;
256
+ if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
257
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
258
+ };
259
+ exports.removePrefix = (input, state = {}) => {
260
+ let output = input;
261
+ if (output.startsWith("./")) {
262
+ output = output.slice(2);
263
+ state.prefix = "./";
264
+ }
265
+ return output;
266
+ };
267
+ exports.wrapOutput = (input, state = {}, options = {}) => {
268
+ const prepend = options.contains ? "" : "^";
269
+ const append = options.contains ? "" : "$";
270
+ let output = `${prepend}(?:${input})${append}`;
271
+ if (state.negated === true) {
272
+ output = `(?:^(?!${output}).*$)`;
273
+ }
274
+ return output;
275
+ };
276
+ exports.basename = (path4, { windows } = {}) => {
277
+ const segs = path4.split(windows ? /[\\/]/ : "/");
278
+ const last = segs[segs.length - 1];
279
+ if (last === "") {
280
+ return segs[segs.length - 2];
281
+ }
282
+ return last;
283
+ };
284
+ }
285
+ });
286
+
287
+ // ../node_modules/tinyglobby/node_modules/picomatch/lib/scan.js
288
+ var require_scan = __commonJS({
289
+ "../node_modules/tinyglobby/node_modules/picomatch/lib/scan.js"(exports, module) {
290
+ "use strict";
291
+ var utils = require_utils();
292
+ var {
293
+ CHAR_ASTERISK,
294
+ /* * */
295
+ CHAR_AT,
296
+ /* @ */
297
+ CHAR_BACKWARD_SLASH,
298
+ /* \ */
299
+ CHAR_COMMA,
300
+ /* , */
301
+ CHAR_DOT,
302
+ /* . */
303
+ CHAR_EXCLAMATION_MARK,
304
+ /* ! */
305
+ CHAR_FORWARD_SLASH,
306
+ /* / */
307
+ CHAR_LEFT_CURLY_BRACE,
308
+ /* { */
309
+ CHAR_LEFT_PARENTHESES,
310
+ /* ( */
311
+ CHAR_LEFT_SQUARE_BRACKET,
312
+ /* [ */
313
+ CHAR_PLUS,
314
+ /* + */
315
+ CHAR_QUESTION_MARK,
316
+ /* ? */
317
+ CHAR_RIGHT_CURLY_BRACE,
318
+ /* } */
319
+ CHAR_RIGHT_PARENTHESES,
320
+ /* ) */
321
+ CHAR_RIGHT_SQUARE_BRACKET
322
+ /* ] */
323
+ } = require_constants();
324
+ var isPathSeparator = /* @__PURE__ */ __name((code) => {
325
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
326
+ }, "isPathSeparator");
327
+ var depth = /* @__PURE__ */ __name((token) => {
328
+ if (token.isPrefix !== true) {
329
+ token.depth = token.isGlobstar ? Infinity : 1;
330
+ }
331
+ }, "depth");
332
+ var scan = /* @__PURE__ */ __name((input, options) => {
333
+ const opts = options || {};
334
+ const length = input.length - 1;
335
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
336
+ const slashes = [];
337
+ const tokens = [];
338
+ const parts = [];
339
+ let str = input;
340
+ let index = -1;
341
+ let start = 0;
342
+ let lastIndex = 0;
343
+ let isBrace = false;
344
+ let isBracket = false;
345
+ let isGlob = false;
346
+ let isExtglob = false;
347
+ let isGlobstar = false;
348
+ let braceEscaped = false;
349
+ let backslashes = false;
350
+ let negated = false;
351
+ let negatedExtglob = false;
352
+ let finished = false;
353
+ let braces = 0;
354
+ let prev;
355
+ let code;
356
+ let token = { value: "", depth: 0, isGlob: false };
357
+ const eos = /* @__PURE__ */ __name(() => index >= length, "eos");
358
+ const peek = /* @__PURE__ */ __name(() => str.charCodeAt(index + 1), "peek");
359
+ const advance = /* @__PURE__ */ __name(() => {
360
+ prev = code;
361
+ return str.charCodeAt(++index);
362
+ }, "advance");
363
+ while (index < length) {
364
+ code = advance();
365
+ let next;
366
+ if (code === CHAR_BACKWARD_SLASH) {
367
+ backslashes = token.backslashes = true;
368
+ code = advance();
369
+ if (code === CHAR_LEFT_CURLY_BRACE) {
370
+ braceEscaped = true;
371
+ }
372
+ continue;
373
+ }
374
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
375
+ braces++;
376
+ while (eos() !== true && (code = advance())) {
377
+ if (code === CHAR_BACKWARD_SLASH) {
378
+ backslashes = token.backslashes = true;
379
+ advance();
380
+ continue;
381
+ }
382
+ if (code === CHAR_LEFT_CURLY_BRACE) {
383
+ braces++;
384
+ continue;
385
+ }
386
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
387
+ isBrace = token.isBrace = true;
388
+ isGlob = token.isGlob = true;
389
+ finished = true;
390
+ if (scanToEnd === true) {
391
+ continue;
392
+ }
393
+ break;
394
+ }
395
+ if (braceEscaped !== true && code === CHAR_COMMA) {
396
+ isBrace = token.isBrace = true;
397
+ isGlob = token.isGlob = true;
398
+ finished = true;
399
+ if (scanToEnd === true) {
400
+ continue;
401
+ }
402
+ break;
403
+ }
404
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
405
+ braces--;
406
+ if (braces === 0) {
407
+ braceEscaped = false;
408
+ isBrace = token.isBrace = true;
409
+ finished = true;
410
+ break;
411
+ }
412
+ }
413
+ }
414
+ if (scanToEnd === true) {
415
+ continue;
416
+ }
417
+ break;
418
+ }
419
+ if (code === CHAR_FORWARD_SLASH) {
420
+ slashes.push(index);
421
+ tokens.push(token);
422
+ token = { value: "", depth: 0, isGlob: false };
423
+ if (finished === true) continue;
424
+ if (prev === CHAR_DOT && index === start + 1) {
425
+ start += 2;
426
+ continue;
427
+ }
428
+ lastIndex = index + 1;
429
+ continue;
430
+ }
431
+ if (opts.noext !== true) {
432
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
433
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
434
+ isGlob = token.isGlob = true;
435
+ isExtglob = token.isExtglob = true;
436
+ finished = true;
437
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
438
+ negatedExtglob = true;
439
+ }
440
+ if (scanToEnd === true) {
441
+ while (eos() !== true && (code = advance())) {
442
+ if (code === CHAR_BACKWARD_SLASH) {
443
+ backslashes = token.backslashes = true;
444
+ code = advance();
445
+ continue;
446
+ }
447
+ if (code === CHAR_RIGHT_PARENTHESES) {
448
+ isGlob = token.isGlob = true;
449
+ finished = true;
450
+ break;
451
+ }
452
+ }
453
+ continue;
454
+ }
455
+ break;
456
+ }
457
+ }
458
+ if (code === CHAR_ASTERISK) {
459
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
460
+ isGlob = token.isGlob = true;
461
+ finished = true;
462
+ if (scanToEnd === true) {
463
+ continue;
464
+ }
465
+ break;
466
+ }
467
+ if (code === CHAR_QUESTION_MARK) {
468
+ isGlob = token.isGlob = true;
469
+ finished = true;
470
+ if (scanToEnd === true) {
471
+ continue;
472
+ }
473
+ break;
474
+ }
475
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
476
+ while (eos() !== true && (next = advance())) {
477
+ if (next === CHAR_BACKWARD_SLASH) {
478
+ backslashes = token.backslashes = true;
479
+ advance();
480
+ continue;
481
+ }
482
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
483
+ isBracket = token.isBracket = true;
484
+ isGlob = token.isGlob = true;
485
+ finished = true;
486
+ break;
487
+ }
488
+ }
489
+ if (scanToEnd === true) {
490
+ continue;
491
+ }
492
+ break;
493
+ }
494
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
495
+ negated = token.negated = true;
496
+ start++;
497
+ continue;
498
+ }
499
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
500
+ isGlob = token.isGlob = true;
501
+ if (scanToEnd === true) {
502
+ while (eos() !== true && (code = advance())) {
503
+ if (code === CHAR_LEFT_PARENTHESES) {
504
+ backslashes = token.backslashes = true;
505
+ code = advance();
506
+ continue;
507
+ }
508
+ if (code === CHAR_RIGHT_PARENTHESES) {
509
+ finished = true;
510
+ break;
511
+ }
512
+ }
513
+ continue;
514
+ }
515
+ break;
516
+ }
517
+ if (isGlob === true) {
518
+ finished = true;
519
+ if (scanToEnd === true) {
520
+ continue;
521
+ }
522
+ break;
523
+ }
524
+ }
525
+ if (opts.noext === true) {
526
+ isExtglob = false;
527
+ isGlob = false;
528
+ }
529
+ let base = str;
530
+ let prefix = "";
531
+ let glob = "";
532
+ if (start > 0) {
533
+ prefix = str.slice(0, start);
534
+ str = str.slice(start);
535
+ lastIndex -= start;
536
+ }
537
+ if (base && isGlob === true && lastIndex > 0) {
538
+ base = str.slice(0, lastIndex);
539
+ glob = str.slice(lastIndex);
540
+ } else if (isGlob === true) {
541
+ base = "";
542
+ glob = str;
543
+ } else {
544
+ base = str;
545
+ }
546
+ if (base && base !== "" && base !== "/" && base !== str) {
547
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
548
+ base = base.slice(0, -1);
549
+ }
550
+ }
551
+ if (opts.unescape === true) {
552
+ if (glob) glob = utils.removeBackslashes(glob);
553
+ if (base && backslashes === true) {
554
+ base = utils.removeBackslashes(base);
555
+ }
556
+ }
557
+ const state = {
558
+ prefix,
559
+ input,
560
+ start,
561
+ base,
562
+ glob,
563
+ isBrace,
564
+ isBracket,
565
+ isGlob,
566
+ isExtglob,
567
+ isGlobstar,
568
+ negated,
569
+ negatedExtglob
570
+ };
571
+ if (opts.tokens === true) {
572
+ state.maxDepth = 0;
573
+ if (!isPathSeparator(code)) {
574
+ tokens.push(token);
575
+ }
576
+ state.tokens = tokens;
577
+ }
578
+ if (opts.parts === true || opts.tokens === true) {
579
+ let prevIndex;
580
+ for (let idx = 0; idx < slashes.length; idx++) {
581
+ const n = prevIndex ? prevIndex + 1 : start;
582
+ const i = slashes[idx];
583
+ const value = input.slice(n, i);
584
+ if (opts.tokens) {
585
+ if (idx === 0 && start !== 0) {
586
+ tokens[idx].isPrefix = true;
587
+ tokens[idx].value = prefix;
588
+ } else {
589
+ tokens[idx].value = value;
590
+ }
591
+ depth(tokens[idx]);
592
+ state.maxDepth += tokens[idx].depth;
593
+ }
594
+ if (idx !== 0 || value !== "") {
595
+ parts.push(value);
596
+ }
597
+ prevIndex = i;
598
+ }
599
+ if (prevIndex && prevIndex + 1 < input.length) {
600
+ const value = input.slice(prevIndex + 1);
601
+ parts.push(value);
602
+ if (opts.tokens) {
603
+ tokens[tokens.length - 1].value = value;
604
+ depth(tokens[tokens.length - 1]);
605
+ state.maxDepth += tokens[tokens.length - 1].depth;
606
+ }
607
+ }
608
+ state.slashes = slashes;
609
+ state.parts = parts;
610
+ }
611
+ return state;
612
+ }, "scan");
613
+ module.exports = scan;
614
+ }
615
+ });
616
+
617
+ // ../node_modules/tinyglobby/node_modules/picomatch/lib/parse.js
618
+ var require_parse = __commonJS({
619
+ "../node_modules/tinyglobby/node_modules/picomatch/lib/parse.js"(exports, module) {
620
+ "use strict";
621
+ var constants3 = require_constants();
622
+ var utils = require_utils();
623
+ var {
624
+ MAX_LENGTH,
625
+ POSIX_REGEX_SOURCE,
626
+ REGEX_NON_SPECIAL_CHARS,
627
+ REGEX_SPECIAL_CHARS_BACKREF,
628
+ REPLACEMENTS
629
+ } = constants3;
630
+ var expandRange = /* @__PURE__ */ __name((args, options) => {
631
+ if (typeof options.expandRange === "function") {
632
+ return options.expandRange(...args, options);
633
+ }
634
+ args.sort();
635
+ const value = `[${args.join("-")}]`;
636
+ try {
637
+ new RegExp(value);
638
+ } catch (ex) {
639
+ return args.map((v) => utils.escapeRegex(v)).join("..");
640
+ }
641
+ return value;
642
+ }, "expandRange");
643
+ var syntaxError = /* @__PURE__ */ __name((type, char) => {
644
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
645
+ }, "syntaxError");
646
+ var parse = /* @__PURE__ */ __name((input, options) => {
647
+ if (typeof input !== "string") {
648
+ throw new TypeError("Expected a string");
649
+ }
650
+ input = REPLACEMENTS[input] || input;
651
+ const opts = { ...options };
652
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
653
+ let len = input.length;
654
+ if (len > max) {
655
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
656
+ }
657
+ const bos = { type: "bos", value: "", output: opts.prepend || "" };
658
+ const tokens = [bos];
659
+ const capture = opts.capture ? "" : "?:";
660
+ const PLATFORM_CHARS = constants3.globChars(opts.windows);
661
+ const EXTGLOB_CHARS = constants3.extglobChars(PLATFORM_CHARS);
662
+ const {
663
+ DOT_LITERAL,
664
+ PLUS_LITERAL,
665
+ SLASH_LITERAL,
666
+ ONE_CHAR,
667
+ DOTS_SLASH,
668
+ NO_DOT,
669
+ NO_DOT_SLASH,
670
+ NO_DOTS_SLASH,
671
+ QMARK,
672
+ QMARK_NO_DOT,
673
+ STAR,
674
+ START_ANCHOR
675
+ } = PLATFORM_CHARS;
676
+ const globstar = /* @__PURE__ */ __name((opts2) => {
677
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
678
+ }, "globstar");
679
+ const nodot = opts.dot ? "" : NO_DOT;
680
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
681
+ let star = opts.bash === true ? globstar(opts) : STAR;
682
+ if (opts.capture) {
683
+ star = `(${star})`;
684
+ }
685
+ if (typeof opts.noext === "boolean") {
686
+ opts.noextglob = opts.noext;
687
+ }
688
+ const state = {
689
+ input,
690
+ index: -1,
691
+ start: 0,
692
+ dot: opts.dot === true,
693
+ consumed: "",
694
+ output: "",
695
+ prefix: "",
696
+ backtrack: false,
697
+ negated: false,
698
+ brackets: 0,
699
+ braces: 0,
700
+ parens: 0,
701
+ quotes: 0,
702
+ globstar: false,
703
+ tokens
704
+ };
705
+ input = utils.removePrefix(input, state);
706
+ len = input.length;
707
+ const extglobs = [];
708
+ const braces = [];
709
+ const stack = [];
710
+ let prev = bos;
711
+ let value;
712
+ const eos = /* @__PURE__ */ __name(() => state.index === len - 1, "eos");
713
+ const peek = state.peek = (n = 1) => input[state.index + n];
714
+ const advance = state.advance = () => input[++state.index] || "";
715
+ const remaining = /* @__PURE__ */ __name(() => input.slice(state.index + 1), "remaining");
716
+ const consume = /* @__PURE__ */ __name((value2 = "", num = 0) => {
717
+ state.consumed += value2;
718
+ state.index += num;
719
+ }, "consume");
720
+ const append = /* @__PURE__ */ __name((token) => {
721
+ state.output += token.output != null ? token.output : token.value;
722
+ consume(token.value);
723
+ }, "append");
724
+ const negate = /* @__PURE__ */ __name(() => {
725
+ let count = 1;
726
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
727
+ advance();
728
+ state.start++;
729
+ count++;
730
+ }
731
+ if (count % 2 === 0) {
732
+ return false;
733
+ }
734
+ state.negated = true;
735
+ state.start++;
736
+ return true;
737
+ }, "negate");
738
+ const increment = /* @__PURE__ */ __name((type) => {
739
+ state[type]++;
740
+ stack.push(type);
741
+ }, "increment");
742
+ const decrement = /* @__PURE__ */ __name((type) => {
743
+ state[type]--;
744
+ stack.pop();
745
+ }, "decrement");
746
+ const push = /* @__PURE__ */ __name((tok) => {
747
+ if (prev.type === "globstar") {
748
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
749
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
750
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
751
+ state.output = state.output.slice(0, -prev.output.length);
752
+ prev.type = "star";
753
+ prev.value = "*";
754
+ prev.output = star;
755
+ state.output += prev.output;
756
+ }
757
+ }
758
+ if (extglobs.length && tok.type !== "paren") {
759
+ extglobs[extglobs.length - 1].inner += tok.value;
760
+ }
761
+ if (tok.value || tok.output) append(tok);
762
+ if (prev && prev.type === "text" && tok.type === "text") {
763
+ prev.output = (prev.output || prev.value) + tok.value;
764
+ prev.value += tok.value;
765
+ return;
766
+ }
767
+ tok.prev = prev;
768
+ tokens.push(tok);
769
+ prev = tok;
770
+ }, "push");
771
+ const extglobOpen = /* @__PURE__ */ __name((type, value2) => {
772
+ const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
773
+ token.prev = prev;
774
+ token.parens = state.parens;
775
+ token.output = state.output;
776
+ const output = (opts.capture ? "(" : "") + token.open;
777
+ increment("parens");
778
+ push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
779
+ push({ type: "paren", extglob: true, value: advance(), output });
780
+ extglobs.push(token);
781
+ }, "extglobOpen");
782
+ const extglobClose = /* @__PURE__ */ __name((token) => {
783
+ let output = token.close + (opts.capture ? ")" : "");
784
+ let rest;
785
+ if (token.type === "negate") {
786
+ let extglobStar = star;
787
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
788
+ extglobStar = globstar(opts);
789
+ }
790
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
791
+ output = token.close = `)$))${extglobStar}`;
792
+ }
793
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
794
+ const expression = parse(rest, { ...options, fastpaths: false }).output;
795
+ output = token.close = `)${expression})${extglobStar})`;
796
+ }
797
+ if (token.prev.type === "bos") {
798
+ state.negatedExtglob = true;
799
+ }
800
+ }
801
+ push({ type: "paren", extglob: true, value, output });
802
+ decrement("parens");
803
+ }, "extglobClose");
804
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
805
+ let backslashes = false;
806
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
807
+ if (first === "\\") {
808
+ backslashes = true;
809
+ return m;
810
+ }
811
+ if (first === "?") {
812
+ if (esc) {
813
+ return esc + first + (rest ? QMARK.repeat(rest.length) : "");
814
+ }
815
+ if (index === 0) {
816
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
817
+ }
818
+ return QMARK.repeat(chars.length);
819
+ }
820
+ if (first === ".") {
821
+ return DOT_LITERAL.repeat(chars.length);
822
+ }
823
+ if (first === "*") {
824
+ if (esc) {
825
+ return esc + first + (rest ? star : "");
826
+ }
827
+ return star;
828
+ }
829
+ return esc ? m : `\\${m}`;
830
+ });
831
+ if (backslashes === true) {
832
+ if (opts.unescape === true) {
833
+ output = output.replace(/\\/g, "");
834
+ } else {
835
+ output = output.replace(/\\+/g, (m) => {
836
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
837
+ });
838
+ }
839
+ }
840
+ if (output === input && opts.contains === true) {
841
+ state.output = input;
842
+ return state;
843
+ }
844
+ state.output = utils.wrapOutput(output, state, options);
845
+ return state;
846
+ }
847
+ while (!eos()) {
848
+ value = advance();
849
+ if (value === "\0") {
850
+ continue;
851
+ }
852
+ if (value === "\\") {
853
+ const next = peek();
854
+ if (next === "/" && opts.bash !== true) {
855
+ continue;
856
+ }
857
+ if (next === "." || next === ";") {
858
+ continue;
859
+ }
860
+ if (!next) {
861
+ value += "\\";
862
+ push({ type: "text", value });
863
+ continue;
864
+ }
865
+ const match = /^\\+/.exec(remaining());
866
+ let slashes = 0;
867
+ if (match && match[0].length > 2) {
868
+ slashes = match[0].length;
869
+ state.index += slashes;
870
+ if (slashes % 2 !== 0) {
871
+ value += "\\";
872
+ }
873
+ }
874
+ if (opts.unescape === true) {
875
+ value = advance();
876
+ } else {
877
+ value += advance();
878
+ }
879
+ if (state.brackets === 0) {
880
+ push({ type: "text", value });
881
+ continue;
882
+ }
883
+ }
884
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
885
+ if (opts.posix !== false && value === ":") {
886
+ const inner = prev.value.slice(1);
887
+ if (inner.includes("[")) {
888
+ prev.posix = true;
889
+ if (inner.includes(":")) {
890
+ const idx = prev.value.lastIndexOf("[");
891
+ const pre = prev.value.slice(0, idx);
892
+ const rest2 = prev.value.slice(idx + 2);
893
+ const posix2 = POSIX_REGEX_SOURCE[rest2];
894
+ if (posix2) {
895
+ prev.value = pre + posix2;
896
+ state.backtrack = true;
897
+ advance();
898
+ if (!bos.output && tokens.indexOf(prev) === 1) {
899
+ bos.output = ONE_CHAR;
900
+ }
901
+ continue;
902
+ }
903
+ }
904
+ }
905
+ }
906
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
907
+ value = `\\${value}`;
908
+ }
909
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
910
+ value = `\\${value}`;
911
+ }
912
+ if (opts.posix === true && value === "!" && prev.value === "[") {
913
+ value = "^";
914
+ }
915
+ prev.value += value;
916
+ append({ value });
917
+ continue;
918
+ }
919
+ if (state.quotes === 1 && value !== '"') {
920
+ value = utils.escapeRegex(value);
921
+ prev.value += value;
922
+ append({ value });
923
+ continue;
924
+ }
925
+ if (value === '"') {
926
+ state.quotes = state.quotes === 1 ? 0 : 1;
927
+ if (opts.keepQuotes === true) {
928
+ push({ type: "text", value });
929
+ }
930
+ continue;
931
+ }
932
+ if (value === "(") {
933
+ increment("parens");
934
+ push({ type: "paren", value });
935
+ continue;
936
+ }
937
+ if (value === ")") {
938
+ if (state.parens === 0 && opts.strictBrackets === true) {
939
+ throw new SyntaxError(syntaxError("opening", "("));
940
+ }
941
+ const extglob = extglobs[extglobs.length - 1];
942
+ if (extglob && state.parens === extglob.parens + 1) {
943
+ extglobClose(extglobs.pop());
944
+ continue;
945
+ }
946
+ push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
947
+ decrement("parens");
948
+ continue;
949
+ }
950
+ if (value === "[") {
951
+ if (opts.nobracket === true || !remaining().includes("]")) {
952
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
953
+ throw new SyntaxError(syntaxError("closing", "]"));
954
+ }
955
+ value = `\\${value}`;
956
+ } else {
957
+ increment("brackets");
958
+ }
959
+ push({ type: "bracket", value });
960
+ continue;
961
+ }
962
+ if (value === "]") {
963
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
964
+ push({ type: "text", value, output: `\\${value}` });
965
+ continue;
966
+ }
967
+ if (state.brackets === 0) {
968
+ if (opts.strictBrackets === true) {
969
+ throw new SyntaxError(syntaxError("opening", "["));
970
+ }
971
+ push({ type: "text", value, output: `\\${value}` });
972
+ continue;
973
+ }
974
+ decrement("brackets");
975
+ const prevValue = prev.value.slice(1);
976
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
977
+ value = `/${value}`;
978
+ }
979
+ prev.value += value;
980
+ append({ value });
981
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
982
+ continue;
983
+ }
984
+ const escaped = utils.escapeRegex(prev.value);
985
+ state.output = state.output.slice(0, -prev.value.length);
986
+ if (opts.literalBrackets === true) {
987
+ state.output += escaped;
988
+ prev.value = escaped;
989
+ continue;
990
+ }
991
+ prev.value = `(${capture}${escaped}|${prev.value})`;
992
+ state.output += prev.value;
993
+ continue;
994
+ }
995
+ if (value === "{" && opts.nobrace !== true) {
996
+ increment("braces");
997
+ const open = {
998
+ type: "brace",
999
+ value,
1000
+ output: "(",
1001
+ outputIndex: state.output.length,
1002
+ tokensIndex: state.tokens.length
1003
+ };
1004
+ braces.push(open);
1005
+ push(open);
1006
+ continue;
1007
+ }
1008
+ if (value === "}") {
1009
+ const brace = braces[braces.length - 1];
1010
+ if (opts.nobrace === true || !brace) {
1011
+ push({ type: "text", value, output: value });
1012
+ continue;
1013
+ }
1014
+ let output = ")";
1015
+ if (brace.dots === true) {
1016
+ const arr = tokens.slice();
1017
+ const range = [];
1018
+ for (let i = arr.length - 1; i >= 0; i--) {
1019
+ tokens.pop();
1020
+ if (arr[i].type === "brace") {
1021
+ break;
1022
+ }
1023
+ if (arr[i].type !== "dots") {
1024
+ range.unshift(arr[i].value);
1025
+ }
1026
+ }
1027
+ output = expandRange(range, opts);
1028
+ state.backtrack = true;
1029
+ }
1030
+ if (brace.comma !== true && brace.dots !== true) {
1031
+ const out = state.output.slice(0, brace.outputIndex);
1032
+ const toks = state.tokens.slice(brace.tokensIndex);
1033
+ brace.value = brace.output = "\\{";
1034
+ value = output = "\\}";
1035
+ state.output = out;
1036
+ for (const t of toks) {
1037
+ state.output += t.output || t.value;
1038
+ }
1039
+ }
1040
+ push({ type: "brace", value, output });
1041
+ decrement("braces");
1042
+ braces.pop();
1043
+ continue;
1044
+ }
1045
+ if (value === "|") {
1046
+ if (extglobs.length > 0) {
1047
+ extglobs[extglobs.length - 1].conditions++;
1048
+ }
1049
+ push({ type: "text", value });
1050
+ continue;
1051
+ }
1052
+ if (value === ",") {
1053
+ let output = value;
1054
+ const brace = braces[braces.length - 1];
1055
+ if (brace && stack[stack.length - 1] === "braces") {
1056
+ brace.comma = true;
1057
+ output = "|";
1058
+ }
1059
+ push({ type: "comma", value, output });
1060
+ continue;
1061
+ }
1062
+ if (value === "/") {
1063
+ if (prev.type === "dot" && state.index === state.start + 1) {
1064
+ state.start = state.index + 1;
1065
+ state.consumed = "";
1066
+ state.output = "";
1067
+ tokens.pop();
1068
+ prev = bos;
1069
+ continue;
1070
+ }
1071
+ push({ type: "slash", value, output: SLASH_LITERAL });
1072
+ continue;
1073
+ }
1074
+ if (value === ".") {
1075
+ if (state.braces > 0 && prev.type === "dot") {
1076
+ if (prev.value === ".") prev.output = DOT_LITERAL;
1077
+ const brace = braces[braces.length - 1];
1078
+ prev.type = "dots";
1079
+ prev.output += value;
1080
+ prev.value += value;
1081
+ brace.dots = true;
1082
+ continue;
1083
+ }
1084
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1085
+ push({ type: "text", value, output: DOT_LITERAL });
1086
+ continue;
1087
+ }
1088
+ push({ type: "dot", value, output: DOT_LITERAL });
1089
+ continue;
1090
+ }
1091
+ if (value === "?") {
1092
+ const isGroup = prev && prev.value === "(";
1093
+ if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1094
+ extglobOpen("qmark", value);
1095
+ continue;
1096
+ }
1097
+ if (prev && prev.type === "paren") {
1098
+ const next = peek();
1099
+ let output = value;
1100
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
1101
+ output = `\\${value}`;
1102
+ }
1103
+ push({ type: "text", value, output });
1104
+ continue;
1105
+ }
1106
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1107
+ push({ type: "qmark", value, output: QMARK_NO_DOT });
1108
+ continue;
1109
+ }
1110
+ push({ type: "qmark", value, output: QMARK });
1111
+ continue;
1112
+ }
1113
+ if (value === "!") {
1114
+ if (opts.noextglob !== true && peek() === "(") {
1115
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1116
+ extglobOpen("negate", value);
1117
+ continue;
1118
+ }
1119
+ }
1120
+ if (opts.nonegate !== true && state.index === 0) {
1121
+ negate();
1122
+ continue;
1123
+ }
1124
+ }
1125
+ if (value === "+") {
1126
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1127
+ extglobOpen("plus", value);
1128
+ continue;
1129
+ }
1130
+ if (prev && prev.value === "(" || opts.regex === false) {
1131
+ push({ type: "plus", value, output: PLUS_LITERAL });
1132
+ continue;
1133
+ }
1134
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1135
+ push({ type: "plus", value });
1136
+ continue;
1137
+ }
1138
+ push({ type: "plus", value: PLUS_LITERAL });
1139
+ continue;
1140
+ }
1141
+ if (value === "@") {
1142
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1143
+ push({ type: "at", extglob: true, value, output: "" });
1144
+ continue;
1145
+ }
1146
+ push({ type: "text", value });
1147
+ continue;
1148
+ }
1149
+ if (value !== "*") {
1150
+ if (value === "$" || value === "^") {
1151
+ value = `\\${value}`;
1152
+ }
1153
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1154
+ if (match) {
1155
+ value += match[0];
1156
+ state.index += match[0].length;
1157
+ }
1158
+ push({ type: "text", value });
1159
+ continue;
1160
+ }
1161
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
1162
+ prev.type = "star";
1163
+ prev.star = true;
1164
+ prev.value += value;
1165
+ prev.output = star;
1166
+ state.backtrack = true;
1167
+ state.globstar = true;
1168
+ consume(value);
1169
+ continue;
1170
+ }
1171
+ let rest = remaining();
1172
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1173
+ extglobOpen("star", value);
1174
+ continue;
1175
+ }
1176
+ if (prev.type === "star") {
1177
+ if (opts.noglobstar === true) {
1178
+ consume(value);
1179
+ continue;
1180
+ }
1181
+ const prior = prev.prev;
1182
+ const before = prior.prev;
1183
+ const isStart = prior.type === "slash" || prior.type === "bos";
1184
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
1185
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1186
+ push({ type: "star", value, output: "" });
1187
+ continue;
1188
+ }
1189
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1190
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1191
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1192
+ push({ type: "star", value, output: "" });
1193
+ continue;
1194
+ }
1195
+ while (rest.slice(0, 3) === "/**") {
1196
+ const after = input[state.index + 4];
1197
+ if (after && after !== "/") {
1198
+ break;
1199
+ }
1200
+ rest = rest.slice(3);
1201
+ consume("/**", 3);
1202
+ }
1203
+ if (prior.type === "bos" && eos()) {
1204
+ prev.type = "globstar";
1205
+ prev.value += value;
1206
+ prev.output = globstar(opts);
1207
+ state.output = prev.output;
1208
+ state.globstar = true;
1209
+ consume(value);
1210
+ continue;
1211
+ }
1212
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
1213
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1214
+ prior.output = `(?:${prior.output}`;
1215
+ prev.type = "globstar";
1216
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1217
+ prev.value += value;
1218
+ state.globstar = true;
1219
+ state.output += prior.output + prev.output;
1220
+ consume(value);
1221
+ continue;
1222
+ }
1223
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1224
+ const end = rest[1] !== void 0 ? "|$" : "";
1225
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1226
+ prior.output = `(?:${prior.output}`;
1227
+ prev.type = "globstar";
1228
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1229
+ prev.value += value;
1230
+ state.output += prior.output + prev.output;
1231
+ state.globstar = true;
1232
+ consume(value + advance());
1233
+ push({ type: "slash", value: "/", output: "" });
1234
+ continue;
1235
+ }
1236
+ if (prior.type === "bos" && rest[0] === "/") {
1237
+ prev.type = "globstar";
1238
+ prev.value += value;
1239
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1240
+ state.output = prev.output;
1241
+ state.globstar = true;
1242
+ consume(value + advance());
1243
+ push({ type: "slash", value: "/", output: "" });
1244
+ continue;
1245
+ }
1246
+ state.output = state.output.slice(0, -prev.output.length);
1247
+ prev.type = "globstar";
1248
+ prev.output = globstar(opts);
1249
+ prev.value += value;
1250
+ state.output += prev.output;
1251
+ state.globstar = true;
1252
+ consume(value);
1253
+ continue;
1254
+ }
1255
+ const token = { type: "star", value, output: star };
1256
+ if (opts.bash === true) {
1257
+ token.output = ".*?";
1258
+ if (prev.type === "bos" || prev.type === "slash") {
1259
+ token.output = nodot + token.output;
1260
+ }
1261
+ push(token);
1262
+ continue;
1263
+ }
1264
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1265
+ token.output = value;
1266
+ push(token);
1267
+ continue;
1268
+ }
1269
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1270
+ if (prev.type === "dot") {
1271
+ state.output += NO_DOT_SLASH;
1272
+ prev.output += NO_DOT_SLASH;
1273
+ } else if (opts.dot === true) {
1274
+ state.output += NO_DOTS_SLASH;
1275
+ prev.output += NO_DOTS_SLASH;
1276
+ } else {
1277
+ state.output += nodot;
1278
+ prev.output += nodot;
1279
+ }
1280
+ if (peek() !== "*") {
1281
+ state.output += ONE_CHAR;
1282
+ prev.output += ONE_CHAR;
1283
+ }
1284
+ }
1285
+ push(token);
1286
+ }
1287
+ while (state.brackets > 0) {
1288
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1289
+ state.output = utils.escapeLast(state.output, "[");
1290
+ decrement("brackets");
1291
+ }
1292
+ while (state.parens > 0) {
1293
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
1294
+ state.output = utils.escapeLast(state.output, "(");
1295
+ decrement("parens");
1296
+ }
1297
+ while (state.braces > 0) {
1298
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
1299
+ state.output = utils.escapeLast(state.output, "{");
1300
+ decrement("braces");
1301
+ }
1302
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
1303
+ push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
1304
+ }
1305
+ if (state.backtrack === true) {
1306
+ state.output = "";
1307
+ for (const token of state.tokens) {
1308
+ state.output += token.output != null ? token.output : token.value;
1309
+ if (token.suffix) {
1310
+ state.output += token.suffix;
1311
+ }
1312
+ }
1313
+ }
1314
+ return state;
1315
+ }, "parse");
1316
+ parse.fastpaths = (input, options) => {
1317
+ const opts = { ...options };
1318
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1319
+ const len = input.length;
1320
+ if (len > max) {
1321
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1322
+ }
1323
+ input = REPLACEMENTS[input] || input;
1324
+ const {
1325
+ DOT_LITERAL,
1326
+ SLASH_LITERAL,
1327
+ ONE_CHAR,
1328
+ DOTS_SLASH,
1329
+ NO_DOT,
1330
+ NO_DOTS,
1331
+ NO_DOTS_SLASH,
1332
+ STAR,
1333
+ START_ANCHOR
1334
+ } = constants3.globChars(opts.windows);
1335
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
1336
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1337
+ const capture = opts.capture ? "" : "?:";
1338
+ const state = { negated: false, prefix: "" };
1339
+ let star = opts.bash === true ? ".*?" : STAR;
1340
+ if (opts.capture) {
1341
+ star = `(${star})`;
1342
+ }
1343
+ const globstar = /* @__PURE__ */ __name((opts2) => {
1344
+ if (opts2.noglobstar === true) return star;
1345
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1346
+ }, "globstar");
1347
+ const create = /* @__PURE__ */ __name((str) => {
1348
+ switch (str) {
1349
+ case "*":
1350
+ return `${nodot}${ONE_CHAR}${star}`;
1351
+ case ".*":
1352
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1353
+ case "*.*":
1354
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1355
+ case "*/*":
1356
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1357
+ case "**":
1358
+ return nodot + globstar(opts);
1359
+ case "**/*":
1360
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1361
+ case "**/*.*":
1362
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1363
+ case "**/.*":
1364
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1365
+ default: {
1366
+ const match = /^(.*?)\.(\w+)$/.exec(str);
1367
+ if (!match) return;
1368
+ const source2 = create(match[1]);
1369
+ if (!source2) return;
1370
+ return source2 + DOT_LITERAL + match[2];
1371
+ }
1372
+ }
1373
+ }, "create");
1374
+ const output = utils.removePrefix(input, state);
1375
+ let source = create(output);
1376
+ if (source && opts.strictSlashes !== true) {
1377
+ source += `${SLASH_LITERAL}?`;
1378
+ }
1379
+ return source;
1380
+ };
1381
+ module.exports = parse;
1382
+ }
1383
+ });
1384
+
1385
+ // ../node_modules/tinyglobby/node_modules/picomatch/lib/picomatch.js
1386
+ var require_picomatch = __commonJS({
1387
+ "../node_modules/tinyglobby/node_modules/picomatch/lib/picomatch.js"(exports, module) {
1388
+ "use strict";
1389
+ var scan = require_scan();
1390
+ var parse = require_parse();
1391
+ var utils = require_utils();
1392
+ var constants3 = require_constants();
1393
+ var isObject = /* @__PURE__ */ __name((val) => val && typeof val === "object" && !Array.isArray(val), "isObject");
1394
+ var picomatch2 = /* @__PURE__ */ __name((glob, options, returnState = false) => {
1395
+ if (Array.isArray(glob)) {
1396
+ const fns = glob.map((input) => picomatch2(input, options, returnState));
1397
+ const arrayMatcher = /* @__PURE__ */ __name((str) => {
1398
+ for (const isMatch of fns) {
1399
+ const state2 = isMatch(str);
1400
+ if (state2) return state2;
1401
+ }
1402
+ return false;
1403
+ }, "arrayMatcher");
1404
+ return arrayMatcher;
1405
+ }
1406
+ const isState = isObject(glob) && glob.tokens && glob.input;
1407
+ if (glob === "" || typeof glob !== "string" && !isState) {
1408
+ throw new TypeError("Expected pattern to be a non-empty string");
1409
+ }
1410
+ const opts = options || {};
1411
+ const posix2 = opts.windows;
1412
+ const regex = isState ? picomatch2.compileRe(glob, options) : picomatch2.makeRe(glob, options, false, true);
1413
+ const state = regex.state;
1414
+ delete regex.state;
1415
+ let isIgnored = /* @__PURE__ */ __name(() => false, "isIgnored");
1416
+ if (opts.ignore) {
1417
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
1418
+ isIgnored = picomatch2(opts.ignore, ignoreOpts, returnState);
1419
+ }
1420
+ const matcher = /* @__PURE__ */ __name((input, returnObject = false) => {
1421
+ const { isMatch, match, output } = picomatch2.test(input, regex, options, { glob, posix: posix2 });
1422
+ const result = { glob, state, regex, posix: posix2, input, output, match, isMatch };
1423
+ if (typeof opts.onResult === "function") {
1424
+ opts.onResult(result);
1425
+ }
1426
+ if (isMatch === false) {
1427
+ result.isMatch = false;
1428
+ return returnObject ? result : false;
1429
+ }
1430
+ if (isIgnored(input)) {
1431
+ if (typeof opts.onIgnore === "function") {
1432
+ opts.onIgnore(result);
1433
+ }
1434
+ result.isMatch = false;
1435
+ return returnObject ? result : false;
1436
+ }
1437
+ if (typeof opts.onMatch === "function") {
1438
+ opts.onMatch(result);
1439
+ }
1440
+ return returnObject ? result : true;
1441
+ }, "matcher");
1442
+ if (returnState) {
1443
+ matcher.state = state;
1444
+ }
1445
+ return matcher;
1446
+ }, "picomatch");
1447
+ picomatch2.test = (input, regex, options, { glob, posix: posix2 } = {}) => {
1448
+ if (typeof input !== "string") {
1449
+ throw new TypeError("Expected input to be a string");
1450
+ }
1451
+ if (input === "") {
1452
+ return { isMatch: false, output: "" };
1453
+ }
1454
+ const opts = options || {};
1455
+ const format = opts.format || (posix2 ? utils.toPosixSlashes : null);
1456
+ let match = input === glob;
1457
+ let output = match && format ? format(input) : input;
1458
+ if (match === false) {
1459
+ output = format ? format(input) : input;
1460
+ match = output === glob;
1461
+ }
1462
+ if (match === false || opts.capture === true) {
1463
+ if (opts.matchBase === true || opts.basename === true) {
1464
+ match = picomatch2.matchBase(input, regex, options, posix2);
1465
+ } else {
1466
+ match = regex.exec(output);
1467
+ }
1468
+ }
1469
+ return { isMatch: Boolean(match), match, output };
1470
+ };
1471
+ picomatch2.matchBase = (input, glob, options) => {
1472
+ const regex = glob instanceof RegExp ? glob : picomatch2.makeRe(glob, options);
1473
+ return regex.test(utils.basename(input));
1474
+ };
1475
+ picomatch2.isMatch = (str, patterns, options) => picomatch2(patterns, options)(str);
1476
+ picomatch2.parse = (pattern, options) => {
1477
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch2.parse(p, options));
1478
+ return parse(pattern, { ...options, fastpaths: false });
1479
+ };
1480
+ picomatch2.scan = (input, options) => scan(input, options);
1481
+ picomatch2.compileRe = (state, options, returnOutput = false, returnState = false) => {
1482
+ if (returnOutput === true) {
1483
+ return state.output;
1484
+ }
1485
+ const opts = options || {};
1486
+ const prepend = opts.contains ? "" : "^";
1487
+ const append = opts.contains ? "" : "$";
1488
+ let source = `${prepend}(?:${state.output})${append}`;
1489
+ if (state && state.negated === true) {
1490
+ source = `^(?!${source}).*$`;
1491
+ }
1492
+ const regex = picomatch2.toRegex(source, options);
1493
+ if (returnState === true) {
1494
+ regex.state = state;
1495
+ }
1496
+ return regex;
1497
+ };
1498
+ picomatch2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1499
+ if (!input || typeof input !== "string") {
1500
+ throw new TypeError("Expected a non-empty string");
1501
+ }
1502
+ let parsed = { negated: false, fastpaths: true };
1503
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
1504
+ parsed.output = parse.fastpaths(input, options);
1505
+ }
1506
+ if (!parsed.output) {
1507
+ parsed = parse(input, options);
1508
+ }
1509
+ return picomatch2.compileRe(parsed, options, returnOutput, returnState);
1510
+ };
1511
+ picomatch2.toRegex = (source, options) => {
1512
+ try {
1513
+ const opts = options || {};
1514
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1515
+ } catch (err) {
1516
+ if (options && options.debug === true) throw err;
1517
+ return /$^/;
1518
+ }
1519
+ };
1520
+ picomatch2.constants = constants3;
1521
+ module.exports = picomatch2;
1522
+ }
1523
+ });
1524
+
1525
+ // ../node_modules/tinyglobby/node_modules/picomatch/index.js
1526
+ var require_picomatch2 = __commonJS({
1527
+ "../node_modules/tinyglobby/node_modules/picomatch/index.js"(exports, module) {
1528
+ "use strict";
1529
+ var pico = require_picomatch();
1530
+ var utils = require_utils();
1531
+ function picomatch2(glob, options, returnState = false) {
1532
+ if (options && (options.windows === null || options.windows === void 0)) {
1533
+ options = { ...options, windows: utils.isWindows() };
1534
+ }
1535
+ return pico(glob, options, returnState);
1536
+ }
1537
+ __name(picomatch2, "picomatch");
1538
+ Object.assign(picomatch2, pico);
1539
+ module.exports = picomatch2;
1540
+ }
1541
+ });
1542
+
1543
+ // ../node_modules/isexe/windows.js
1544
+ var require_windows = __commonJS({
1545
+ "../node_modules/isexe/windows.js"(exports, module) {
1546
+ module.exports = isexe;
1547
+ isexe.sync = sync2;
1548
+ var fs = __require("fs");
1549
+ function checkPathExt(path4, options) {
1550
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
1551
+ if (!pathext) {
1552
+ return true;
1553
+ }
1554
+ pathext = pathext.split(";");
1555
+ if (pathext.indexOf("") !== -1) {
1556
+ return true;
1557
+ }
1558
+ for (var i = 0; i < pathext.length; i++) {
1559
+ var p = pathext[i].toLowerCase();
1560
+ if (p && path4.substr(-p.length).toLowerCase() === p) {
1561
+ return true;
1562
+ }
1563
+ }
1564
+ return false;
1565
+ }
1566
+ __name(checkPathExt, "checkPathExt");
1567
+ function checkStat(stat, path4, options) {
1568
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
1569
+ return false;
1570
+ }
1571
+ return checkPathExt(path4, options);
1572
+ }
1573
+ __name(checkStat, "checkStat");
1574
+ function isexe(path4, options, cb) {
1575
+ fs.stat(path4, function(er, stat) {
1576
+ cb(er, er ? false : checkStat(stat, path4, options));
1577
+ });
1578
+ }
1579
+ __name(isexe, "isexe");
1580
+ function sync2(path4, options) {
1581
+ return checkStat(fs.statSync(path4), path4, options);
1582
+ }
1583
+ __name(sync2, "sync");
1584
+ }
1585
+ });
1586
+
1587
+ // ../node_modules/isexe/mode.js
1588
+ var require_mode = __commonJS({
1589
+ "../node_modules/isexe/mode.js"(exports, module) {
1590
+ module.exports = isexe;
1591
+ isexe.sync = sync2;
1592
+ var fs = __require("fs");
1593
+ function isexe(path4, options, cb) {
1594
+ fs.stat(path4, function(er, stat) {
1595
+ cb(er, er ? false : checkStat(stat, options));
1596
+ });
1597
+ }
1598
+ __name(isexe, "isexe");
1599
+ function sync2(path4, options) {
1600
+ return checkStat(fs.statSync(path4), options);
1601
+ }
1602
+ __name(sync2, "sync");
1603
+ function checkStat(stat, options) {
1604
+ return stat.isFile() && checkMode(stat, options);
1605
+ }
1606
+ __name(checkStat, "checkStat");
1607
+ function checkMode(stat, options) {
1608
+ var mod = stat.mode;
1609
+ var uid = stat.uid;
1610
+ var gid = stat.gid;
1611
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
1612
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
1613
+ var u = parseInt("100", 8);
1614
+ var g = parseInt("010", 8);
1615
+ var o = parseInt("001", 8);
1616
+ var ug = u | g;
1617
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
1618
+ return ret;
1619
+ }
1620
+ __name(checkMode, "checkMode");
1621
+ }
1622
+ });
1623
+
1624
+ // ../node_modules/isexe/index.js
1625
+ var require_isexe = __commonJS({
1626
+ "../node_modules/isexe/index.js"(exports, module) {
1627
+ var fs = __require("fs");
1628
+ var core;
1629
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
1630
+ core = require_windows();
1631
+ } else {
1632
+ core = require_mode();
1633
+ }
1634
+ module.exports = isexe;
1635
+ isexe.sync = sync2;
1636
+ function isexe(path4, options, cb) {
1637
+ if (typeof options === "function") {
1638
+ cb = options;
1639
+ options = {};
1640
+ }
1641
+ if (!cb) {
1642
+ if (typeof Promise !== "function") {
1643
+ throw new TypeError("callback not provided");
1644
+ }
1645
+ return new Promise(function(resolve3, reject) {
1646
+ isexe(path4, options || {}, function(er, is) {
1647
+ if (er) {
1648
+ reject(er);
1649
+ } else {
1650
+ resolve3(is);
1651
+ }
1652
+ });
1653
+ });
1654
+ }
1655
+ core(path4, options || {}, function(er, is) {
1656
+ if (er) {
1657
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
1658
+ er = null;
1659
+ is = false;
1660
+ }
1661
+ }
1662
+ cb(er, is);
1663
+ });
1664
+ }
1665
+ __name(isexe, "isexe");
1666
+ function sync2(path4, options) {
1667
+ try {
1668
+ return core.sync(path4, options || {});
1669
+ } catch (er) {
1670
+ if (options && options.ignoreErrors || er.code === "EACCES") {
1671
+ return false;
1672
+ } else {
1673
+ throw er;
1674
+ }
1675
+ }
1676
+ }
1677
+ __name(sync2, "sync");
1678
+ }
1679
+ });
1680
+
1681
+ // ../node_modules/which/which.js
1682
+ var require_which = __commonJS({
1683
+ "../node_modules/which/which.js"(exports, module) {
1684
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
1685
+ var path4 = __require("path");
1686
+ var COLON = isWindows ? ";" : ":";
1687
+ var isexe = require_isexe();
1688
+ var getNotFoundError = /* @__PURE__ */ __name((cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }), "getNotFoundError");
1689
+ var getPathInfo = /* @__PURE__ */ __name((cmd, opt) => {
1690
+ const colon = opt.colon || COLON;
1691
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
1692
+ // windows always checks the cwd first
1693
+ ...isWindows ? [process.cwd()] : [],
1694
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
1695
+ "").split(colon)
1696
+ ];
1697
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
1698
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
1699
+ if (isWindows) {
1700
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
1701
+ pathExt.unshift("");
1702
+ }
1703
+ return {
1704
+ pathEnv,
1705
+ pathExt,
1706
+ pathExtExe
1707
+ };
1708
+ }, "getPathInfo");
1709
+ var which = /* @__PURE__ */ __name((cmd, opt, cb) => {
1710
+ if (typeof opt === "function") {
1711
+ cb = opt;
1712
+ opt = {};
1713
+ }
1714
+ if (!opt)
1715
+ opt = {};
1716
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
1717
+ const found = [];
1718
+ const step = /* @__PURE__ */ __name((i) => new Promise((resolve3, reject) => {
1719
+ if (i === pathEnv.length)
1720
+ return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
1721
+ const ppRaw = pathEnv[i];
1722
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
1723
+ const pCmd = path4.join(pathPart, cmd);
1724
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
1725
+ resolve3(subStep(p, i, 0));
1726
+ }), "step");
1727
+ const subStep = /* @__PURE__ */ __name((p, i, ii) => new Promise((resolve3, reject) => {
1728
+ if (ii === pathExt.length)
1729
+ return resolve3(step(i + 1));
1730
+ const ext = pathExt[ii];
1731
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
1732
+ if (!er && is) {
1733
+ if (opt.all)
1734
+ found.push(p + ext);
1735
+ else
1736
+ return resolve3(p + ext);
1737
+ }
1738
+ return resolve3(subStep(p, i, ii + 1));
1739
+ });
1740
+ }), "subStep");
1741
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
1742
+ }, "which");
1743
+ var whichSync = /* @__PURE__ */ __name((cmd, opt) => {
1744
+ opt = opt || {};
1745
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
1746
+ const found = [];
1747
+ for (let i = 0; i < pathEnv.length; i++) {
1748
+ const ppRaw = pathEnv[i];
1749
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
1750
+ const pCmd = path4.join(pathPart, cmd);
1751
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
1752
+ for (let j = 0; j < pathExt.length; j++) {
1753
+ const cur = p + pathExt[j];
1754
+ try {
1755
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
1756
+ if (is) {
1757
+ if (opt.all)
1758
+ found.push(cur);
1759
+ else
1760
+ return cur;
1761
+ }
1762
+ } catch (ex) {
1763
+ }
1764
+ }
1765
+ }
1766
+ if (opt.all && found.length)
1767
+ return found;
1768
+ if (opt.nothrow)
1769
+ return null;
1770
+ throw getNotFoundError(cmd);
1771
+ }, "whichSync");
1772
+ module.exports = which;
1773
+ which.sync = whichSync;
1774
+ }
1775
+ });
1776
+
1777
+ // ../node_modules/path-key/index.js
1778
+ var require_path_key = __commonJS({
1779
+ "../node_modules/path-key/index.js"(exports, module) {
1780
+ "use strict";
1781
+ var pathKey2 = /* @__PURE__ */ __name((options = {}) => {
1782
+ const environment = options.env || process.env;
1783
+ const platform = options.platform || process.platform;
1784
+ if (platform !== "win32") {
1785
+ return "PATH";
1786
+ }
1787
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
1788
+ }, "pathKey");
1789
+ module.exports = pathKey2;
1790
+ module.exports.default = pathKey2;
1791
+ }
1792
+ });
1793
+
1794
+ // ../node_modules/cross-spawn/lib/util/resolveCommand.js
1795
+ var require_resolveCommand = __commonJS({
1796
+ "../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
1797
+ "use strict";
1798
+ var path4 = __require("path");
1799
+ var which = require_which();
1800
+ var getPathKey = require_path_key();
1801
+ function resolveCommandAttempt(parsed, withoutPathExt) {
1802
+ const env = parsed.options.env || process.env;
1803
+ const cwd = process.cwd();
1804
+ const hasCustomCwd = parsed.options.cwd != null;
1805
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
1806
+ if (shouldSwitchCwd) {
1807
+ try {
1808
+ process.chdir(parsed.options.cwd);
1809
+ } catch (err) {
1810
+ }
1811
+ }
1812
+ let resolved;
1813
+ try {
1814
+ resolved = which.sync(parsed.command, {
1815
+ path: env[getPathKey({ env })],
1816
+ pathExt: withoutPathExt ? path4.delimiter : void 0
1817
+ });
1818
+ } catch (e) {
1819
+ } finally {
1820
+ if (shouldSwitchCwd) {
1821
+ process.chdir(cwd);
1822
+ }
1823
+ }
1824
+ if (resolved) {
1825
+ resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
1826
+ }
1827
+ return resolved;
1828
+ }
1829
+ __name(resolveCommandAttempt, "resolveCommandAttempt");
1830
+ function resolveCommand(parsed) {
1831
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
1832
+ }
1833
+ __name(resolveCommand, "resolveCommand");
1834
+ module.exports = resolveCommand;
1835
+ }
1836
+ });
1837
+
1838
+ // ../node_modules/cross-spawn/lib/util/escape.js
1839
+ var require_escape = __commonJS({
1840
+ "../node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
1841
+ "use strict";
1842
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
1843
+ function escapeCommand(arg) {
1844
+ arg = arg.replace(metaCharsRegExp, "^$1");
1845
+ return arg;
1846
+ }
1847
+ __name(escapeCommand, "escapeCommand");
1848
+ function escapeArgument(arg, doubleEscapeMetaChars) {
1849
+ arg = `${arg}`;
1850
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
1851
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
1852
+ arg = `"${arg}"`;
1853
+ arg = arg.replace(metaCharsRegExp, "^$1");
1854
+ if (doubleEscapeMetaChars) {
1855
+ arg = arg.replace(metaCharsRegExp, "^$1");
1856
+ }
1857
+ return arg;
1858
+ }
1859
+ __name(escapeArgument, "escapeArgument");
1860
+ module.exports.command = escapeCommand;
1861
+ module.exports.argument = escapeArgument;
1862
+ }
1863
+ });
1864
+
1865
+ // ../node_modules/shebang-regex/index.js
1866
+ var require_shebang_regex = __commonJS({
1867
+ "../node_modules/shebang-regex/index.js"(exports, module) {
1868
+ "use strict";
1869
+ module.exports = /^#!(.*)/;
1870
+ }
1871
+ });
1872
+
1873
+ // ../node_modules/shebang-command/index.js
1874
+ var require_shebang_command = __commonJS({
1875
+ "../node_modules/shebang-command/index.js"(exports, module) {
1876
+ "use strict";
1877
+ var shebangRegex = require_shebang_regex();
1878
+ module.exports = (string = "") => {
1879
+ const match = string.match(shebangRegex);
1880
+ if (!match) {
1881
+ return null;
1882
+ }
1883
+ const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
1884
+ const binary = path4.split("/").pop();
1885
+ if (binary === "env") {
1886
+ return argument;
1887
+ }
1888
+ return argument ? `${binary} ${argument}` : binary;
1889
+ };
1890
+ }
1891
+ });
1892
+
1893
+ // ../node_modules/cross-spawn/lib/util/readShebang.js
1894
+ var require_readShebang = __commonJS({
1895
+ "../node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
1896
+ "use strict";
1897
+ var fs = __require("fs");
1898
+ var shebangCommand = require_shebang_command();
1899
+ function readShebang(command) {
1900
+ const size = 150;
1901
+ const buffer = Buffer.alloc(size);
1902
+ let fd;
1903
+ try {
1904
+ fd = fs.openSync(command, "r");
1905
+ fs.readSync(fd, buffer, 0, size, 0);
1906
+ fs.closeSync(fd);
1907
+ } catch (e) {
1908
+ }
1909
+ return shebangCommand(buffer.toString());
1910
+ }
1911
+ __name(readShebang, "readShebang");
1912
+ module.exports = readShebang;
1913
+ }
1914
+ });
1915
+
1916
+ // ../node_modules/cross-spawn/lib/parse.js
1917
+ var require_parse2 = __commonJS({
1918
+ "../node_modules/cross-spawn/lib/parse.js"(exports, module) {
1919
+ "use strict";
1920
+ var path4 = __require("path");
1921
+ var resolveCommand = require_resolveCommand();
1922
+ var escape = require_escape();
1923
+ var readShebang = require_readShebang();
1924
+ var isWin2 = process.platform === "win32";
1925
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
1926
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
1927
+ function detectShebang(parsed) {
1928
+ parsed.file = resolveCommand(parsed);
1929
+ const shebang = parsed.file && readShebang(parsed.file);
1930
+ if (shebang) {
1931
+ parsed.args.unshift(parsed.file);
1932
+ parsed.command = shebang;
1933
+ return resolveCommand(parsed);
1934
+ }
1935
+ return parsed.file;
1936
+ }
1937
+ __name(detectShebang, "detectShebang");
1938
+ function parseNonShell(parsed) {
1939
+ if (!isWin2) {
1940
+ return parsed;
1941
+ }
1942
+ const commandFile = detectShebang(parsed);
1943
+ const needsShell = !isExecutableRegExp.test(commandFile);
1944
+ if (parsed.options.forceShell || needsShell) {
1945
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
1946
+ parsed.command = path4.normalize(parsed.command);
1947
+ parsed.command = escape.command(parsed.command);
1948
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
1949
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
1950
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
1951
+ parsed.command = process.env.comspec || "cmd.exe";
1952
+ parsed.options.windowsVerbatimArguments = true;
1953
+ }
1954
+ return parsed;
1955
+ }
1956
+ __name(parseNonShell, "parseNonShell");
1957
+ function parse(command, args, options) {
1958
+ if (args && !Array.isArray(args)) {
1959
+ options = args;
1960
+ args = null;
1961
+ }
1962
+ args = args ? args.slice(0) : [];
1963
+ options = Object.assign({}, options);
1964
+ const parsed = {
1965
+ command,
1966
+ args,
1967
+ options,
1968
+ file: void 0,
1969
+ original: {
1970
+ command,
1971
+ args
1972
+ }
1973
+ };
1974
+ return options.shell ? parsed : parseNonShell(parsed);
1975
+ }
1976
+ __name(parse, "parse");
1977
+ module.exports = parse;
1978
+ }
1979
+ });
1980
+
1981
+ // ../node_modules/cross-spawn/lib/enoent.js
1982
+ var require_enoent = __commonJS({
1983
+ "../node_modules/cross-spawn/lib/enoent.js"(exports, module) {
1984
+ "use strict";
1985
+ var isWin2 = process.platform === "win32";
1986
+ function notFoundError(original, syscall) {
1987
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
1988
+ code: "ENOENT",
1989
+ errno: "ENOENT",
1990
+ syscall: `${syscall} ${original.command}`,
1991
+ path: original.command,
1992
+ spawnargs: original.args
1993
+ });
1994
+ }
1995
+ __name(notFoundError, "notFoundError");
1996
+ function hookChildProcess(cp, parsed) {
1997
+ if (!isWin2) {
1998
+ return;
1999
+ }
2000
+ const originalEmit = cp.emit;
2001
+ cp.emit = function(name, arg1) {
2002
+ if (name === "exit") {
2003
+ const err = verifyENOENT(arg1, parsed);
2004
+ if (err) {
2005
+ return originalEmit.call(cp, "error", err);
2006
+ }
2007
+ }
2008
+ return originalEmit.apply(cp, arguments);
2009
+ };
2010
+ }
2011
+ __name(hookChildProcess, "hookChildProcess");
2012
+ function verifyENOENT(status, parsed) {
2013
+ if (isWin2 && status === 1 && !parsed.file) {
2014
+ return notFoundError(parsed.original, "spawn");
2015
+ }
2016
+ return null;
2017
+ }
2018
+ __name(verifyENOENT, "verifyENOENT");
2019
+ function verifyENOENTSync(status, parsed) {
2020
+ if (isWin2 && status === 1 && !parsed.file) {
2021
+ return notFoundError(parsed.original, "spawnSync");
2022
+ }
2023
+ return null;
2024
+ }
2025
+ __name(verifyENOENTSync, "verifyENOENTSync");
2026
+ module.exports = {
2027
+ hookChildProcess,
2028
+ verifyENOENT,
2029
+ verifyENOENTSync,
2030
+ notFoundError
2031
+ };
2032
+ }
2033
+ });
2034
+
2035
+ // ../node_modules/cross-spawn/index.js
2036
+ var require_cross_spawn = __commonJS({
2037
+ "../node_modules/cross-spawn/index.js"(exports, module) {
2038
+ "use strict";
2039
+ var cp = __require("child_process");
2040
+ var parse = require_parse2();
2041
+ var enoent = require_enoent();
2042
+ function spawn(command, args, options) {
2043
+ const parsed = parse(command, args, options);
2044
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
2045
+ enoent.hookChildProcess(spawned, parsed);
2046
+ return spawned;
2047
+ }
2048
+ __name(spawn, "spawn");
2049
+ function spawnSync(command, args, options) {
2050
+ const parsed = parse(command, args, options);
2051
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
2052
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
2053
+ return result;
2054
+ }
2055
+ __name(spawnSync, "spawnSync");
2056
+ module.exports = spawn;
2057
+ module.exports.spawn = spawn;
2058
+ module.exports.sync = spawnSync;
2059
+ module.exports._parse = parse;
2060
+ module.exports._enoent = enoent;
2061
+ }
2062
+ });
2063
+
2064
+ // ../node_modules/merge-stream/index.js
2065
+ var require_merge_stream = __commonJS({
2066
+ "../node_modules/merge-stream/index.js"(exports, module) {
2067
+ "use strict";
2068
+ var { PassThrough } = __require("stream");
2069
+ module.exports = function() {
2070
+ var sources = [];
2071
+ var output = new PassThrough({ objectMode: true });
2072
+ output.setMaxListeners(0);
2073
+ output.add = add;
2074
+ output.isEmpty = isEmpty;
2075
+ output.on("unpipe", remove);
2076
+ Array.prototype.slice.call(arguments).forEach(add);
2077
+ return output;
2078
+ function add(source) {
2079
+ if (Array.isArray(source)) {
2080
+ source.forEach(add);
2081
+ return this;
2082
+ }
2083
+ sources.push(source);
2084
+ source.once("end", remove.bind(null, source));
2085
+ source.once("error", output.emit.bind(output, "error"));
2086
+ source.pipe(output, { end: false });
2087
+ return this;
2088
+ }
2089
+ __name(add, "add");
2090
+ function isEmpty() {
2091
+ return sources.length == 0;
2092
+ }
2093
+ __name(isEmpty, "isEmpty");
2094
+ function remove(source) {
2095
+ sources = sources.filter(function(it) {
2096
+ return it !== source;
2097
+ });
2098
+ if (!sources.length && output.readable) {
2099
+ output.end();
2100
+ }
2101
+ }
2102
+ __name(remove, "remove");
2103
+ };
2104
+ }
2105
+ });
2106
+
2107
+ // src/common/utils/paths.ts
2108
+ import { join, relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
2109
+
2110
+ // ../node_modules/tinyglobby/dist/index.mjs
2111
+ import nativeFs2 from "fs";
2112
+ import path, { posix } from "path";
2113
+ import { fileURLToPath } from "url";
2114
+
2115
+ // ../node_modules/tinyglobby/node_modules/fdir/dist/index.mjs
2116
+ import { createRequire } from "module";
2117
+ import { basename, dirname, normalize, relative, resolve, sep } from "path";
2118
+ import * as nativeFs from "fs";
2119
+ var __require2 = createRequire(import.meta.url);
2120
+ function cleanPath(path4) {
2121
+ let normalized = normalize(path4);
2122
+ if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
2123
+ return normalized;
2124
+ }
2125
+ __name(cleanPath, "cleanPath");
2126
+ var SLASHES_REGEX = /[\\/]/g;
2127
+ function convertSlashes(path4, separator) {
2128
+ return path4.replace(SLASHES_REGEX, separator);
2129
+ }
2130
+ __name(convertSlashes, "convertSlashes");
2131
+ var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
2132
+ function isRootDirectory(path4) {
2133
+ return path4 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path4);
2134
+ }
2135
+ __name(isRootDirectory, "isRootDirectory");
2136
+ function normalizePath(path4, options) {
2137
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
2138
+ const pathNeedsCleaning = process.platform === "win32" && path4.includes("/") || path4.startsWith(".");
2139
+ if (resolvePaths) path4 = resolve(path4);
2140
+ if (normalizePath$1 || pathNeedsCleaning) path4 = cleanPath(path4);
2141
+ if (path4 === ".") return "";
2142
+ const needsSeperator = path4[path4.length - 1] !== pathSeparator;
2143
+ return convertSlashes(needsSeperator ? path4 + pathSeparator : path4, pathSeparator);
2144
+ }
2145
+ __name(normalizePath, "normalizePath");
2146
+ function joinPathWithBasePath(filename, directoryPath) {
2147
+ return directoryPath + filename;
2148
+ }
2149
+ __name(joinPathWithBasePath, "joinPathWithBasePath");
2150
+ function joinPathWithRelativePath(root, options) {
2151
+ return function(filename, directoryPath) {
2152
+ const sameRoot = directoryPath.startsWith(root);
2153
+ if (sameRoot) return directoryPath.slice(root.length) + filename;
2154
+ else return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
2155
+ };
2156
+ }
2157
+ __name(joinPathWithRelativePath, "joinPathWithRelativePath");
2158
+ function joinPath(filename) {
2159
+ return filename;
2160
+ }
2161
+ __name(joinPath, "joinPath");
2162
+ function joinDirectoryPath(filename, directoryPath, separator) {
2163
+ return directoryPath + filename + separator;
2164
+ }
2165
+ __name(joinDirectoryPath, "joinDirectoryPath");
2166
+ function build$7(root, options) {
2167
+ const { relativePaths, includeBasePath } = options;
2168
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
2169
+ }
2170
+ __name(build$7, "build$7");
2171
+ function pushDirectoryWithRelativePath(root) {
2172
+ return function(directoryPath, paths) {
2173
+ paths.push(directoryPath.substring(root.length) || ".");
2174
+ };
2175
+ }
2176
+ __name(pushDirectoryWithRelativePath, "pushDirectoryWithRelativePath");
2177
+ function pushDirectoryFilterWithRelativePath(root) {
2178
+ return function(directoryPath, paths, filters) {
2179
+ const relativePath = directoryPath.substring(root.length) || ".";
2180
+ if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
2181
+ };
2182
+ }
2183
+ __name(pushDirectoryFilterWithRelativePath, "pushDirectoryFilterWithRelativePath");
2184
+ var pushDirectory = /* @__PURE__ */ __name((directoryPath, paths) => {
2185
+ paths.push(directoryPath || ".");
2186
+ }, "pushDirectory");
2187
+ var pushDirectoryFilter = /* @__PURE__ */ __name((directoryPath, paths, filters) => {
2188
+ const path4 = directoryPath || ".";
2189
+ if (filters.every((filter) => filter(path4, true))) paths.push(path4);
2190
+ }, "pushDirectoryFilter");
2191
+ var empty$2 = /* @__PURE__ */ __name(() => {
2192
+ }, "empty$2");
2193
+ function build$6(root, options) {
2194
+ const { includeDirs, filters, relativePaths } = options;
2195
+ if (!includeDirs) return empty$2;
2196
+ if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
2197
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory;
2198
+ }
2199
+ __name(build$6, "build$6");
2200
+ var pushFileFilterAndCount = /* @__PURE__ */ __name((filename, _paths, counts, filters) => {
2201
+ if (filters.every((filter) => filter(filename, false))) counts.files++;
2202
+ }, "pushFileFilterAndCount");
2203
+ var pushFileFilter = /* @__PURE__ */ __name((filename, paths, _counts, filters) => {
2204
+ if (filters.every((filter) => filter(filename, false))) paths.push(filename);
2205
+ }, "pushFileFilter");
2206
+ var pushFileCount = /* @__PURE__ */ __name((_filename, _paths, counts, _filters) => {
2207
+ counts.files++;
2208
+ }, "pushFileCount");
2209
+ var pushFile = /* @__PURE__ */ __name((filename, paths) => {
2210
+ paths.push(filename);
2211
+ }, "pushFile");
2212
+ var empty$1 = /* @__PURE__ */ __name(() => {
2213
+ }, "empty$1");
2214
+ function build$5(options) {
2215
+ const { excludeFiles, filters, onlyCounts } = options;
2216
+ if (excludeFiles) return empty$1;
2217
+ if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
2218
+ else if (onlyCounts) return pushFileCount;
2219
+ else return pushFile;
2220
+ }
2221
+ __name(build$5, "build$5");
2222
+ var getArray = /* @__PURE__ */ __name((paths) => {
2223
+ return paths;
2224
+ }, "getArray");
2225
+ var getArrayGroup = /* @__PURE__ */ __name(() => {
2226
+ return [""].slice(0, 0);
2227
+ }, "getArrayGroup");
2228
+ function build$4(options) {
2229
+ return options.group ? getArrayGroup : getArray;
2230
+ }
2231
+ __name(build$4, "build$4");
2232
+ var groupFiles = /* @__PURE__ */ __name((groups, directory, files) => {
2233
+ groups.push({
2234
+ directory,
2235
+ files,
2236
+ dir: directory
2237
+ });
2238
+ }, "groupFiles");
2239
+ var empty = /* @__PURE__ */ __name(() => {
2240
+ }, "empty");
2241
+ function build$3(options) {
2242
+ return options.group ? groupFiles : empty;
2243
+ }
2244
+ __name(build$3, "build$3");
2245
+ var resolveSymlinksAsync = /* @__PURE__ */ __name(function(path4, state, callback$1) {
2246
+ const { queue, fs, options: { suppressErrors } } = state;
2247
+ queue.enqueue();
2248
+ fs.realpath(path4, (error, resolvedPath) => {
2249
+ if (error) return queue.dequeue(suppressErrors ? null : error, state);
2250
+ fs.stat(resolvedPath, (error$1, stat) => {
2251
+ if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
2252
+ if (stat.isDirectory() && isRecursive(path4, resolvedPath, state)) return queue.dequeue(null, state);
2253
+ callback$1(stat, resolvedPath);
2254
+ queue.dequeue(null, state);
2255
+ });
2256
+ });
2257
+ }, "resolveSymlinksAsync");
2258
+ var resolveSymlinks = /* @__PURE__ */ __name(function(path4, state, callback$1) {
2259
+ const { queue, fs, options: { suppressErrors } } = state;
2260
+ queue.enqueue();
2261
+ try {
2262
+ const resolvedPath = fs.realpathSync(path4);
2263
+ const stat = fs.statSync(resolvedPath);
2264
+ if (stat.isDirectory() && isRecursive(path4, resolvedPath, state)) return;
2265
+ callback$1(stat, resolvedPath);
2266
+ } catch (e) {
2267
+ if (!suppressErrors) throw e;
2268
+ }
2269
+ }, "resolveSymlinks");
2270
+ function build$2(options, isSynchronous) {
2271
+ if (!options.resolveSymlinks || options.excludeSymlinks) return null;
2272
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
2273
+ }
2274
+ __name(build$2, "build$2");
2275
+ function isRecursive(path4, resolved, state) {
2276
+ if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
2277
+ let parent = dirname(path4);
2278
+ let depth = 1;
2279
+ while (parent !== state.root && depth < 2) {
2280
+ const resolvedPath = state.symlinks.get(parent);
2281
+ const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
2282
+ if (isSameRoot) depth++;
2283
+ else parent = dirname(parent);
2284
+ }
2285
+ state.symlinks.set(path4, resolved);
2286
+ return depth > 1;
2287
+ }
2288
+ __name(isRecursive, "isRecursive");
2289
+ function isRecursiveUsingRealPaths(resolved, state) {
2290
+ return state.visited.includes(resolved + state.options.pathSeparator);
2291
+ }
2292
+ __name(isRecursiveUsingRealPaths, "isRecursiveUsingRealPaths");
2293
+ var onlyCountsSync = /* @__PURE__ */ __name((state) => {
2294
+ return state.counts;
2295
+ }, "onlyCountsSync");
2296
+ var groupsSync = /* @__PURE__ */ __name((state) => {
2297
+ return state.groups;
2298
+ }, "groupsSync");
2299
+ var defaultSync = /* @__PURE__ */ __name((state) => {
2300
+ return state.paths;
2301
+ }, "defaultSync");
2302
+ var limitFilesSync = /* @__PURE__ */ __name((state) => {
2303
+ return state.paths.slice(0, state.options.maxFiles);
2304
+ }, "limitFilesSync");
2305
+ var onlyCountsAsync = /* @__PURE__ */ __name((state, error, callback$1) => {
2306
+ report(error, callback$1, state.counts, state.options.suppressErrors);
2307
+ return null;
2308
+ }, "onlyCountsAsync");
2309
+ var defaultAsync = /* @__PURE__ */ __name((state, error, callback$1) => {
2310
+ report(error, callback$1, state.paths, state.options.suppressErrors);
2311
+ return null;
2312
+ }, "defaultAsync");
2313
+ var limitFilesAsync = /* @__PURE__ */ __name((state, error, callback$1) => {
2314
+ report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
2315
+ return null;
2316
+ }, "limitFilesAsync");
2317
+ var groupsAsync = /* @__PURE__ */ __name((state, error, callback$1) => {
2318
+ report(error, callback$1, state.groups, state.options.suppressErrors);
2319
+ return null;
2320
+ }, "groupsAsync");
2321
+ function report(error, callback$1, output, suppressErrors) {
2322
+ if (error && !suppressErrors) callback$1(error, output);
2323
+ else callback$1(null, output);
2324
+ }
2325
+ __name(report, "report");
2326
+ function build$1(options, isSynchronous) {
2327
+ const { onlyCounts, group, maxFiles } = options;
2328
+ if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
2329
+ else if (group) return isSynchronous ? groupsSync : groupsAsync;
2330
+ else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
2331
+ else return isSynchronous ? defaultSync : defaultAsync;
2332
+ }
2333
+ __name(build$1, "build$1");
2334
+ var readdirOpts = { withFileTypes: true };
2335
+ var walkAsync = /* @__PURE__ */ __name((state, crawlPath, directoryPath, currentDepth, callback$1) => {
2336
+ state.queue.enqueue();
2337
+ if (currentDepth < 0) return state.queue.dequeue(null, state);
2338
+ const { fs } = state;
2339
+ state.visited.push(crawlPath);
2340
+ state.counts.directories++;
2341
+ fs.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
2342
+ callback$1(entries, directoryPath, currentDepth);
2343
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
2344
+ });
2345
+ }, "walkAsync");
2346
+ var walkSync = /* @__PURE__ */ __name((state, crawlPath, directoryPath, currentDepth, callback$1) => {
2347
+ const { fs } = state;
2348
+ if (currentDepth < 0) return;
2349
+ state.visited.push(crawlPath);
2350
+ state.counts.directories++;
2351
+ let entries = [];
2352
+ try {
2353
+ entries = fs.readdirSync(crawlPath || ".", readdirOpts);
2354
+ } catch (e) {
2355
+ if (!state.options.suppressErrors) throw e;
2356
+ }
2357
+ callback$1(entries, directoryPath, currentDepth);
2358
+ }, "walkSync");
2359
+ function build(isSynchronous) {
2360
+ return isSynchronous ? walkSync : walkAsync;
2361
+ }
2362
+ __name(build, "build");
2363
+ var Queue = class {
2364
+ static {
2365
+ __name(this, "Queue");
2366
+ }
2367
+ count = 0;
2368
+ constructor(onQueueEmpty) {
2369
+ this.onQueueEmpty = onQueueEmpty;
2370
+ }
2371
+ enqueue() {
2372
+ this.count++;
2373
+ return this.count;
2374
+ }
2375
+ dequeue(error, output) {
2376
+ if (this.onQueueEmpty && (--this.count <= 0 || error)) {
2377
+ this.onQueueEmpty(error, output);
2378
+ if (error) {
2379
+ output.controller.abort();
2380
+ this.onQueueEmpty = void 0;
2381
+ }
2382
+ }
2383
+ }
2384
+ };
2385
+ var Counter = class {
2386
+ static {
2387
+ __name(this, "Counter");
2388
+ }
2389
+ _files = 0;
2390
+ _directories = 0;
2391
+ set files(num) {
2392
+ this._files = num;
2393
+ }
2394
+ get files() {
2395
+ return this._files;
2396
+ }
2397
+ set directories(num) {
2398
+ this._directories = num;
2399
+ }
2400
+ get directories() {
2401
+ return this._directories;
2402
+ }
2403
+ /**
2404
+ * @deprecated use `directories` instead
2405
+ */
2406
+ /* c8 ignore next 3 */
2407
+ get dirs() {
2408
+ return this._directories;
2409
+ }
2410
+ };
2411
+ var Aborter = class {
2412
+ static {
2413
+ __name(this, "Aborter");
2414
+ }
2415
+ aborted = false;
2416
+ abort() {
2417
+ this.aborted = true;
2418
+ }
2419
+ };
2420
+ var Walker = class {
2421
+ static {
2422
+ __name(this, "Walker");
2423
+ }
2424
+ root;
2425
+ isSynchronous;
2426
+ state;
2427
+ joinPath;
2428
+ pushDirectory;
2429
+ pushFile;
2430
+ getArray;
2431
+ groupFiles;
2432
+ resolveSymlink;
2433
+ walkDirectory;
2434
+ callbackInvoker;
2435
+ constructor(root, options, callback$1) {
2436
+ this.isSynchronous = !callback$1;
2437
+ this.callbackInvoker = build$1(options, this.isSynchronous);
2438
+ this.root = normalizePath(root, options);
2439
+ this.state = {
2440
+ root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
2441
+ paths: [""].slice(0, 0),
2442
+ groups: [],
2443
+ counts: new Counter(),
2444
+ options,
2445
+ queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
2446
+ symlinks: /* @__PURE__ */ new Map(),
2447
+ visited: [""].slice(0, 0),
2448
+ controller: new Aborter(),
2449
+ fs: options.fs || nativeFs
2450
+ };
2451
+ this.joinPath = build$7(this.root, options);
2452
+ this.pushDirectory = build$6(this.root, options);
2453
+ this.pushFile = build$5(options);
2454
+ this.getArray = build$4(options);
2455
+ this.groupFiles = build$3(options);
2456
+ this.resolveSymlink = build$2(options, this.isSynchronous);
2457
+ this.walkDirectory = build(this.isSynchronous);
2458
+ }
2459
+ start() {
2460
+ this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
2461
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
2462
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
2463
+ }
2464
+ walk = /* @__PURE__ */ __name((entries, directoryPath, depth) => {
2465
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
2466
+ if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
2467
+ const files = this.getArray(this.state.paths);
2468
+ for (let i = 0; i < entries.length; ++i) {
2469
+ const entry = entries[i];
2470
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
2471
+ const filename = this.joinPath(entry.name, directoryPath);
2472
+ this.pushFile(filename, files, this.state.counts, filters);
2473
+ } else if (entry.isDirectory()) {
2474
+ let path4 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
2475
+ if (exclude && exclude(entry.name, path4)) continue;
2476
+ this.pushDirectory(path4, paths, filters);
2477
+ this.walkDirectory(this.state, path4, path4, depth - 1, this.walk);
2478
+ } else if (this.resolveSymlink && entry.isSymbolicLink()) {
2479
+ let path4 = joinPathWithBasePath(entry.name, directoryPath);
2480
+ this.resolveSymlink(path4, this.state, (stat, resolvedPath) => {
2481
+ if (stat.isDirectory()) {
2482
+ resolvedPath = normalizePath(resolvedPath, this.state.options);
2483
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path4 + pathSeparator)) return;
2484
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path4 + pathSeparator, depth - 1, this.walk);
2485
+ } else {
2486
+ resolvedPath = useRealPaths ? resolvedPath : path4;
2487
+ const filename = basename(resolvedPath);
2488
+ const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
2489
+ resolvedPath = this.joinPath(filename, directoryPath$1);
2490
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
2491
+ }
2492
+ });
2493
+ }
2494
+ }
2495
+ this.groupFiles(this.state.groups, directoryPath, files);
2496
+ }, "walk");
2497
+ };
2498
+ function promise(root, options) {
2499
+ return new Promise((resolve$1, reject) => {
2500
+ callback(root, options, (err, output) => {
2501
+ if (err) return reject(err);
2502
+ resolve$1(output);
2503
+ });
2504
+ });
2505
+ }
2506
+ __name(promise, "promise");
2507
+ function callback(root, options, callback$1) {
2508
+ let walker = new Walker(root, options, callback$1);
2509
+ walker.start();
2510
+ }
2511
+ __name(callback, "callback");
2512
+ function sync(root, options) {
2513
+ const walker = new Walker(root, options);
2514
+ return walker.start();
2515
+ }
2516
+ __name(sync, "sync");
2517
+ var APIBuilder = class {
2518
+ static {
2519
+ __name(this, "APIBuilder");
2520
+ }
2521
+ constructor(root, options) {
2522
+ this.root = root;
2523
+ this.options = options;
2524
+ }
2525
+ withPromise() {
2526
+ return promise(this.root, this.options);
2527
+ }
2528
+ withCallback(cb) {
2529
+ callback(this.root, this.options, cb);
2530
+ }
2531
+ sync() {
2532
+ return sync(this.root, this.options);
2533
+ }
2534
+ };
2535
+ var pm = null;
2536
+ try {
2537
+ __require2.resolve("picomatch");
2538
+ pm = __require2("picomatch");
2539
+ } catch {
2540
+ }
2541
+ var Builder = class {
2542
+ static {
2543
+ __name(this, "Builder");
2544
+ }
2545
+ globCache = {};
2546
+ options = {
2547
+ maxDepth: Infinity,
2548
+ suppressErrors: true,
2549
+ pathSeparator: sep,
2550
+ filters: []
2551
+ };
2552
+ globFunction;
2553
+ constructor(options) {
2554
+ this.options = {
2555
+ ...this.options,
2556
+ ...options
2557
+ };
2558
+ this.globFunction = this.options.globFunction;
2559
+ }
2560
+ group() {
2561
+ this.options.group = true;
2562
+ return this;
2563
+ }
2564
+ withPathSeparator(separator) {
2565
+ this.options.pathSeparator = separator;
2566
+ return this;
2567
+ }
2568
+ withBasePath() {
2569
+ this.options.includeBasePath = true;
2570
+ return this;
2571
+ }
2572
+ withRelativePaths() {
2573
+ this.options.relativePaths = true;
2574
+ return this;
2575
+ }
2576
+ withDirs() {
2577
+ this.options.includeDirs = true;
2578
+ return this;
2579
+ }
2580
+ withMaxDepth(depth) {
2581
+ this.options.maxDepth = depth;
2582
+ return this;
2583
+ }
2584
+ withMaxFiles(limit) {
2585
+ this.options.maxFiles = limit;
2586
+ return this;
2587
+ }
2588
+ withFullPaths() {
2589
+ this.options.resolvePaths = true;
2590
+ this.options.includeBasePath = true;
2591
+ return this;
2592
+ }
2593
+ withErrors() {
2594
+ this.options.suppressErrors = false;
2595
+ return this;
2596
+ }
2597
+ withSymlinks({ resolvePaths = true } = {}) {
2598
+ this.options.resolveSymlinks = true;
2599
+ this.options.useRealPaths = resolvePaths;
2600
+ return this.withFullPaths();
2601
+ }
2602
+ withAbortSignal(signal) {
2603
+ this.options.signal = signal;
2604
+ return this;
2605
+ }
2606
+ normalize() {
2607
+ this.options.normalizePath = true;
2608
+ return this;
2609
+ }
2610
+ filter(predicate) {
2611
+ this.options.filters.push(predicate);
2612
+ return this;
2613
+ }
2614
+ onlyDirs() {
2615
+ this.options.excludeFiles = true;
2616
+ this.options.includeDirs = true;
2617
+ return this;
2618
+ }
2619
+ exclude(predicate) {
2620
+ this.options.exclude = predicate;
2621
+ return this;
2622
+ }
2623
+ onlyCounts() {
2624
+ this.options.onlyCounts = true;
2625
+ return this;
2626
+ }
2627
+ crawl(root) {
2628
+ return new APIBuilder(root || ".", this.options);
2629
+ }
2630
+ withGlobFunction(fn) {
2631
+ this.globFunction = fn;
2632
+ return this;
2633
+ }
2634
+ /**
2635
+ * @deprecated Pass options using the constructor instead:
2636
+ * ```ts
2637
+ * new fdir(options).crawl("/path/to/root");
2638
+ * ```
2639
+ * This method will be removed in v7.0
2640
+ */
2641
+ /* c8 ignore next 4 */
2642
+ crawlWithOptions(root, options) {
2643
+ this.options = {
2644
+ ...this.options,
2645
+ ...options
2646
+ };
2647
+ return new APIBuilder(root || ".", this.options);
2648
+ }
2649
+ glob(...patterns) {
2650
+ if (this.globFunction) return this.globWithOptions(patterns);
2651
+ return this.globWithOptions(patterns, ...[{ dot: true }]);
2652
+ }
2653
+ globWithOptions(patterns, ...options) {
2654
+ const globFn = this.globFunction || pm;
2655
+ if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
2656
+ var isMatch = this.globCache[patterns.join("\0")];
2657
+ if (!isMatch) {
2658
+ isMatch = globFn(patterns, ...options);
2659
+ this.globCache[patterns.join("\0")] = isMatch;
2660
+ }
2661
+ this.options.filters.push((path4) => isMatch(path4));
2662
+ return this;
2663
+ }
2664
+ };
2665
+
2666
+ // ../node_modules/tinyglobby/dist/index.mjs
2667
+ var import_picomatch = __toESM(require_picomatch2(), 1);
2668
+ var isReadonlyArray = Array.isArray;
2669
+ var isWin = process.platform === "win32";
2670
+ var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2671
+ function getPartialMatcher(patterns, options = {}) {
2672
+ const patternsCount = patterns.length;
2673
+ const patternsParts = Array(patternsCount);
2674
+ const matchers = Array(patternsCount);
2675
+ const globstarEnabled = !options.noglobstar;
2676
+ for (let i = 0; i < patternsCount; i++) {
2677
+ const parts = splitPattern(patterns[i]);
2678
+ patternsParts[i] = parts;
2679
+ const partsCount = parts.length;
2680
+ const partMatchers = Array(partsCount);
2681
+ for (let j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
2682
+ matchers[i] = partMatchers;
2683
+ }
2684
+ return (input) => {
2685
+ const inputParts = input.split("/");
2686
+ if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
2687
+ for (let i = 0; i < patterns.length; i++) {
2688
+ const patternParts = patternsParts[i];
2689
+ const matcher = matchers[i];
2690
+ const inputPatternCount = inputParts.length;
2691
+ const minParts = Math.min(inputPatternCount, patternParts.length);
2692
+ let j = 0;
2693
+ while (j < minParts) {
2694
+ const part = patternParts[j];
2695
+ if (part.includes("/")) return true;
2696
+ const match = matcher[j](inputParts[j]);
2697
+ if (!match) break;
2698
+ if (globstarEnabled && part === "**") return true;
2699
+ j++;
2700
+ }
2701
+ if (j === inputPatternCount) return true;
2702
+ }
2703
+ return false;
2704
+ };
2705
+ }
2706
+ __name(getPartialMatcher, "getPartialMatcher");
2707
+ var WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
2708
+ var isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
2709
+ function buildFormat(cwd, root, absolute) {
2710
+ if (cwd === root || root.startsWith(`${cwd}/`)) {
2711
+ if (absolute) {
2712
+ const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
2713
+ return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
2714
+ }
2715
+ const prefix = root.slice(cwd.length + 1);
2716
+ if (prefix) return (p, isDir) => {
2717
+ if (p === ".") return prefix;
2718
+ const result = `${prefix}/${p}`;
2719
+ return isDir ? result.slice(0, -1) : result;
2720
+ };
2721
+ return (p, isDir) => isDir && p !== "." ? p.slice(0, -1) : p;
2722
+ }
2723
+ if (absolute) return (p) => posix.relative(cwd, p) || ".";
2724
+ return (p) => posix.relative(cwd, `${root}/${p}`) || ".";
2725
+ }
2726
+ __name(buildFormat, "buildFormat");
2727
+ function buildRelative(cwd, root) {
2728
+ if (root.startsWith(`${cwd}/`)) {
2729
+ const prefix = root.slice(cwd.length + 1);
2730
+ return (p) => `${prefix}/${p}`;
2731
+ }
2732
+ return (p) => {
2733
+ const result = posix.relative(cwd, `${root}/${p}`);
2734
+ if (p.endsWith("/") && result !== "") return `${result}/`;
2735
+ return result || ".";
2736
+ };
2737
+ }
2738
+ __name(buildRelative, "buildRelative");
2739
+ var splitPatternOptions = { parts: true };
2740
+ function splitPattern(path$1) {
2741
+ var _result$parts;
2742
+ const result = import_picomatch.default.scan(path$1, splitPatternOptions);
2743
+ return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
2744
+ }
2745
+ __name(splitPattern, "splitPattern");
2746
+ var POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
2747
+ var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
2748
+ var escapePosixPath = /* @__PURE__ */ __name((path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&"), "escapePosixPath");
2749
+ var escapeWin32Path = /* @__PURE__ */ __name((path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&"), "escapeWin32Path");
2750
+ var escapePath = isWin ? escapeWin32Path : escapePosixPath;
2751
+ function isDynamicPattern(pattern, options) {
2752
+ if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
2753
+ const scan = import_picomatch.default.scan(pattern);
2754
+ return scan.isGlob || scan.negated;
2755
+ }
2756
+ __name(isDynamicPattern, "isDynamicPattern");
2757
+ function log(...tasks) {
2758
+ console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
2759
+ }
2760
+ __name(log, "log");
2761
+ var PARENT_DIRECTORY = /^(\/?\.\.)+/;
2762
+ var ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
2763
+ var BACKSLASHES = /\\/g;
2764
+ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2765
+ let result = pattern;
2766
+ if (pattern.endsWith("/")) result = pattern.slice(0, -1);
2767
+ if (!result.endsWith("*") && expandDirectories) result += "/**";
2768
+ const escapedCwd = escapePath(cwd);
2769
+ if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
2770
+ else result = posix.normalize(result);
2771
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2772
+ const parts = splitPattern(result);
2773
+ if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
2774
+ const n = (parentDirectoryMatch[0].length + 1) / 3;
2775
+ let i = 0;
2776
+ const cwdParts = escapedCwd.split("/");
2777
+ while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
2778
+ result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2779
+ i++;
2780
+ }
2781
+ const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));
2782
+ if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
2783
+ props.root = potentialRoot;
2784
+ props.depthOffset = -n + i;
2785
+ }
2786
+ }
2787
+ if (!isIgnore && props.depthOffset >= 0) {
2788
+ var _props$commonPath;
2789
+ (_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
2790
+ const newCommonPath = [];
2791
+ const length = Math.min(props.commonPath.length, parts.length);
2792
+ for (let i = 0; i < length; i++) {
2793
+ const part = parts[i];
2794
+ if (part === "**" && !parts[i + 1]) {
2795
+ newCommonPath.pop();
2796
+ break;
2797
+ }
2798
+ if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
2799
+ newCommonPath.push(part);
2800
+ }
2801
+ props.depthOffset = newCommonPath.length;
2802
+ props.commonPath = newCommonPath;
2803
+ props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
2804
+ }
2805
+ return result;
2806
+ }
2807
+ __name(normalizePattern, "normalizePattern");
2808
+ function processPatterns({ patterns = ["**/*"], ignore = [], expandDirectories = true }, cwd, props) {
2809
+ if (typeof patterns === "string") patterns = [patterns];
2810
+ if (typeof ignore === "string") ignore = [ignore];
2811
+ const matchPatterns = [];
2812
+ const ignorePatterns = [];
2813
+ for (const pattern of ignore) {
2814
+ if (!pattern) continue;
2815
+ if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
2816
+ }
2817
+ for (const pattern of patterns) {
2818
+ if (!pattern) continue;
2819
+ if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
2820
+ else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
2821
+ }
2822
+ return {
2823
+ match: matchPatterns,
2824
+ ignore: ignorePatterns
2825
+ };
2826
+ }
2827
+ __name(processPatterns, "processPatterns");
2828
+ function formatPaths(paths, relative3) {
2829
+ for (let i = paths.length - 1; i >= 0; i--) {
2830
+ const path$1 = paths[i];
2831
+ paths[i] = relative3(path$1);
2832
+ }
2833
+ return paths;
2834
+ }
2835
+ __name(formatPaths, "formatPaths");
2836
+ function normalizeCwd(cwd) {
2837
+ if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
2838
+ if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
2839
+ return path.resolve(cwd).replace(BACKSLASHES, "/");
2840
+ }
2841
+ __name(normalizeCwd, "normalizeCwd");
2842
+ function getCrawler(patterns, inputOptions = {}) {
2843
+ const options = process.env.TINYGLOBBY_DEBUG ? {
2844
+ ...inputOptions,
2845
+ debug: true
2846
+ } : inputOptions;
2847
+ const cwd = normalizeCwd(options.cwd);
2848
+ if (options.debug) log("globbing with:", {
2849
+ patterns,
2850
+ options,
2851
+ cwd
2852
+ });
2853
+ if (Array.isArray(patterns) && patterns.length === 0) return [{
2854
+ sync: /* @__PURE__ */ __name(() => [], "sync"),
2855
+ withPromise: /* @__PURE__ */ __name(async () => [], "withPromise")
2856
+ }, false];
2857
+ const props = {
2858
+ root: cwd,
2859
+ commonPath: null,
2860
+ depthOffset: 0
2861
+ };
2862
+ const processed = processPatterns({
2863
+ ...options,
2864
+ patterns
2865
+ }, cwd, props);
2866
+ if (options.debug) log("internal processing patterns:", processed);
2867
+ const matchOptions = {
2868
+ dot: options.dot,
2869
+ nobrace: options.braceExpansion === false,
2870
+ nocase: options.caseSensitiveMatch === false,
2871
+ noextglob: options.extglob === false,
2872
+ noglobstar: options.globstar === false,
2873
+ posix: true
2874
+ };
2875
+ const matcher = (0, import_picomatch.default)(processed.match, {
2876
+ ...matchOptions,
2877
+ ignore: processed.ignore
2878
+ });
2879
+ const ignore = (0, import_picomatch.default)(processed.ignore, matchOptions);
2880
+ const partialMatcher = getPartialMatcher(processed.match, matchOptions);
2881
+ const format = buildFormat(cwd, props.root, options.absolute);
2882
+ const formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);
2883
+ const fdirOptions = {
2884
+ filters: [options.debug ? (p, isDirectory) => {
2885
+ const path$1 = format(p, isDirectory);
2886
+ const matches = matcher(path$1);
2887
+ if (matches) log(`matched ${path$1}`);
2888
+ return matches;
2889
+ } : (p, isDirectory) => matcher(format(p, isDirectory))],
2890
+ exclude: options.debug ? (_, p) => {
2891
+ const relativePath = formatExclude(p, true);
2892
+ const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2893
+ if (skipped) log(`skipped ${p}`);
2894
+ else log(`crawling ${p}`);
2895
+ return skipped;
2896
+ } : (_, p) => {
2897
+ const relativePath = formatExclude(p, true);
2898
+ return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2899
+ },
2900
+ fs: options.fs ? {
2901
+ readdir: options.fs.readdir || nativeFs2.readdir,
2902
+ readdirSync: options.fs.readdirSync || nativeFs2.readdirSync,
2903
+ realpath: options.fs.realpath || nativeFs2.realpath,
2904
+ realpathSync: options.fs.realpathSync || nativeFs2.realpathSync,
2905
+ stat: options.fs.stat || nativeFs2.stat,
2906
+ statSync: options.fs.statSync || nativeFs2.statSync
2907
+ } : void 0,
2908
+ pathSeparator: "/",
2909
+ relativePaths: true,
2910
+ resolveSymlinks: true,
2911
+ signal: options.signal
2912
+ };
2913
+ if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
2914
+ if (options.absolute) {
2915
+ fdirOptions.relativePaths = false;
2916
+ fdirOptions.resolvePaths = true;
2917
+ fdirOptions.includeBasePath = true;
2918
+ }
2919
+ if (options.followSymbolicLinks === false) {
2920
+ fdirOptions.resolveSymlinks = false;
2921
+ fdirOptions.excludeSymlinks = true;
2922
+ }
2923
+ if (options.onlyDirectories) {
2924
+ fdirOptions.excludeFiles = true;
2925
+ fdirOptions.includeDirs = true;
2926
+ } else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
2927
+ props.root = props.root.replace(BACKSLASHES, "");
2928
+ const root = props.root;
2929
+ if (options.debug) log("internal properties:", props);
2930
+ const relative3 = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
2931
+ return [new Builder(fdirOptions).crawl(root), relative3];
2932
+ }
2933
+ __name(getCrawler, "getCrawler");
2934
+ function globSync(patternsOrOptions, options) {
2935
+ if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
2936
+ const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
2937
+ const opts = isModern ? options : patternsOrOptions;
2938
+ const patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;
2939
+ const [crawler, relative3] = getCrawler(patterns, opts);
2940
+ if (!relative3) return crawler.sync();
2941
+ return formatPaths(crawler.sync(), relative3);
2942
+ }
2943
+ __name(globSync, "globSync");
2944
+
2945
+ // src/common/js-package-manager/constants.ts
2946
+ var NPM_LOCKFILE = "package-lock.json";
2947
+ var PNPM_LOCKFILE = "pnpm-lock.yaml";
2948
+ var YARN_LOCKFILE = "yarn.lock";
2949
+ var BUN_LOCKFILE = "bun.lock";
2950
+ var BUN_LOCKFILE_BINARY = "bun.lockb";
2951
+ var LOCK_FILES = [
2952
+ NPM_LOCKFILE,
2953
+ PNPM_LOCKFILE,
2954
+ YARN_LOCKFILE,
2955
+ BUN_LOCKFILE,
2956
+ BUN_LOCKFILE_BINARY
2957
+ ];
2958
+
2959
+ // src/common/utils/paths.ts
2960
+ var projectRoot;
2961
+ var getProjectRoot = /* @__PURE__ */ __name(() => {
2962
+ if (projectRoot) {
2963
+ return projectRoot;
2964
+ }
2965
+ if (process.env.STORYBOOK_PROJECT_ROOT) {
2966
+ return process.env.STORYBOOK_PROJECT_ROOT;
2967
+ }
2968
+ try {
2969
+ const found = up2(".git") || up2(".svn") || up2(".hg");
2970
+ if (found) {
2971
+ projectRoot = join(found, "..");
2972
+ return projectRoot;
2973
+ }
2974
+ } catch (e) {
2975
+ process.stdout.write(`
2976
+ error searching for repository root: ${e}
2977
+ `);
2978
+ }
2979
+ try {
2980
+ const found = any(LOCK_FILES);
2981
+ if (found) {
2982
+ projectRoot = join(found, "..");
2983
+ return projectRoot;
2984
+ }
2985
+ } catch (e) {
2986
+ process.stdout.write(`
2987
+ error searching for lock file: ${e}
2988
+ `);
2989
+ }
2990
+ try {
2991
+ const [basePath, rest] = __dirname.split(`${sep2}node_modules${sep2}`, 2);
2992
+ if (rest && !basePath.includes(`${sep2}npm-cache${sep2}`) && !relative2(basePath, process.cwd()).startsWith("..")) {
2993
+ projectRoot = basePath;
2994
+ return projectRoot;
2995
+ }
2996
+ } catch (e) {
2997
+ process.stdout.write(`
2998
+ error searching for splitDirname: ${e}
2999
+ `);
3000
+ }
3001
+ projectRoot = process.cwd();
3002
+ return projectRoot;
3003
+ }, "getProjectRoot");
3004
+ var invalidateProjectRootCache = /* @__PURE__ */ __name(() => {
3005
+ projectRoot = void 0;
3006
+ }, "invalidateProjectRootCache");
3007
+ var findFilesUp = /* @__PURE__ */ __name((matchers, baseDir = process.cwd()) => {
3008
+ const matchingFiles = [];
3009
+ for (const directory of up(baseDir, { last: getProjectRoot() })) {
3010
+ matchingFiles.push(...globSync(matchers, { cwd: directory, absolute: true }));
3011
+ }
3012
+ return matchingFiles;
3013
+ }, "findFilesUp");
3014
+ var nodePathsToArray = /* @__PURE__ */ __name((nodePath) => nodePath.split(process.platform === "win32" ? ";" : ":").filter(Boolean).map((p) => resolve2("./", p)), "nodePathsToArray");
3015
+ var relativePattern = /^\.{1,2}([/\\]|$)/;
3016
+ function normalizeStoryPath(filename) {
3017
+ if (relativePattern.test(filename)) {
3018
+ return filename;
3019
+ }
3020
+ return `.${sep2}${filename}`;
3021
+ }
3022
+ __name(normalizeStoryPath, "normalizeStoryPath");
3023
+
3024
+ // src/common/utils/envs.ts
3025
+ async function loadEnvs(options = {}) {
3026
+ const { getEnvironment } = await import("./lib-MUNM6ZJ6.js");
3027
+ const defaultNodeEnv = options.production ? "production" : "development";
3028
+ const env = {
3029
+ // eslint-disable-next-line @typescript-eslint/dot-notation
3030
+ NODE_ENV: process.env.NODE_ENV || defaultNodeEnv,
3031
+ NODE_PATH: process.env["NODE_PATH"] || "",
3032
+ STORYBOOK: process.env["STORYBOOK"] || "true",
3033
+ // This is to support CRA's public folder feature.
3034
+ // In production we set this to dot(.) to allow the browser to access these assets
3035
+ // even when deployed inside a subpath. (like in GitHub pages)
3036
+ // In development this is just empty as we always serves from the root.
3037
+ PUBLIC_URL: options.production ? "." : ""
3038
+ };
3039
+ Object.keys(process.env).filter((name) => /^STORYBOOK_/.test(name)).forEach((name) => {
3040
+ env[name] = process.env[name];
3041
+ });
3042
+ const base = Object.entries(env).reduce(
3043
+ (acc, [k, v]) => Object.assign(acc, { [k]: JSON.stringify(v) }),
3044
+ {}
3045
+ );
3046
+ const { stringified, raw } = getEnvironment({ nodeEnv: env["NODE_ENV"] });
3047
+ const fullRaw = { ...env, ...raw };
3048
+ fullRaw.NODE_PATH = nodePathsToArray(fullRaw.NODE_PATH || "");
3049
+ return {
3050
+ stringified: { ...base, ...stringified },
3051
+ raw: fullRaw
3052
+ };
3053
+ }
3054
+ __name(loadEnvs, "loadEnvs");
3055
+ var stringifyEnvs = /* @__PURE__ */ __name((raw) => Object.entries(raw).reduce((acc, [key, value]) => {
3056
+ acc[key] = JSON.stringify(value);
3057
+ return acc;
3058
+ }, {}), "stringifyEnvs");
3059
+ var stringifyProcessEnvs = /* @__PURE__ */ __name((raw) => {
3060
+ const envs = Object.entries(raw).reduce((acc, [key, value]) => {
3061
+ acc[`process.env.${key}`] = JSON.stringify(value);
3062
+ return acc;
3063
+ }, {});
3064
+ return envs;
3065
+ }, "stringifyProcessEnvs");
3066
+ var optionalEnvToBoolean = /* @__PURE__ */ __name((input) => {
3067
+ if (input === void 0) {
3068
+ return void 0;
3069
+ }
3070
+ if (input.toUpperCase() === "FALSE" || input === "0") {
3071
+ return false;
3072
+ }
3073
+ if (input.toUpperCase() === "TRUE" || input === "1") {
3074
+ return true;
3075
+ }
3076
+ return Boolean(input);
3077
+ }, "optionalEnvToBoolean");
3078
+ function isCI() {
3079
+ return optionalEnvToBoolean(process.env.CI);
3080
+ }
3081
+ __name(isCI, "isCI");
3082
+
3083
+ // node_modules/execa/index.js
3084
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
3085
+ import { Buffer as Buffer3 } from "node:buffer";
3086
+ import path3 from "node:path";
3087
+ import childProcess from "node:child_process";
3088
+ import process6 from "node:process";
3089
+
3090
+ // ../node_modules/strip-final-newline/index.js
3091
+ function stripFinalNewline(input) {
3092
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
3093
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
3094
+ if (input[input.length - 1] === LF) {
3095
+ input = input.slice(0, -1);
3096
+ }
3097
+ if (input[input.length - 1] === CR) {
3098
+ input = input.slice(0, -1);
3099
+ }
3100
+ return input;
3101
+ }
3102
+ __name(stripFinalNewline, "stripFinalNewline");
3103
+
3104
+ // node_modules/npm-run-path/index.js
3105
+ import process2 from "node:process";
3106
+ import path2 from "node:path";
3107
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
3108
+
3109
+ // node_modules/path-key/index.js
3110
+ function pathKey(options = {}) {
3111
+ const {
3112
+ env = process.env,
3113
+ platform = process.platform
3114
+ } = options;
3115
+ if (platform !== "win32") {
3116
+ return "PATH";
3117
+ }
3118
+ return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
3119
+ }
3120
+ __name(pathKey, "pathKey");
3121
+
3122
+ // node_modules/npm-run-path/index.js
3123
+ var npmRunPath = /* @__PURE__ */ __name(({
3124
+ cwd = process2.cwd(),
3125
+ path: pathOption = process2.env[pathKey()],
3126
+ preferLocal = true,
3127
+ execPath = process2.execPath,
3128
+ addExecPath = true
3129
+ } = {}) => {
3130
+ const cwdString = cwd instanceof URL ? fileURLToPath2(cwd) : cwd;
3131
+ const cwdPath = path2.resolve(cwdString);
3132
+ const result = [];
3133
+ if (preferLocal) {
3134
+ applyPreferLocal(result, cwdPath);
3135
+ }
3136
+ if (addExecPath) {
3137
+ applyExecPath(result, execPath, cwdPath);
3138
+ }
3139
+ return [...result, pathOption].join(path2.delimiter);
3140
+ }, "npmRunPath");
3141
+ var applyPreferLocal = /* @__PURE__ */ __name((result, cwdPath) => {
3142
+ let previous;
3143
+ while (previous !== cwdPath) {
3144
+ result.push(path2.join(cwdPath, "node_modules/.bin"));
3145
+ previous = cwdPath;
3146
+ cwdPath = path2.resolve(cwdPath, "..");
3147
+ }
3148
+ }, "applyPreferLocal");
3149
+ var applyExecPath = /* @__PURE__ */ __name((result, execPath, cwdPath) => {
3150
+ const execPathString = execPath instanceof URL ? fileURLToPath2(execPath) : execPath;
3151
+ result.push(path2.resolve(cwdPath, execPathString, ".."));
3152
+ }, "applyExecPath");
3153
+ var npmRunPathEnv = /* @__PURE__ */ __name(({ env = process2.env, ...options } = {}) => {
3154
+ env = { ...env };
3155
+ const pathName = pathKey({ env });
3156
+ options.path = env[pathName];
3157
+ env[pathName] = npmRunPath(options);
3158
+ return env;
3159
+ }, "npmRunPathEnv");
3160
+
3161
+ // node_modules/mimic-fn/index.js
3162
+ var copyProperty = /* @__PURE__ */ __name((to, from, property, ignoreNonConfigurable) => {
3163
+ if (property === "length" || property === "prototype") {
3164
+ return;
3165
+ }
3166
+ if (property === "arguments" || property === "caller") {
3167
+ return;
3168
+ }
3169
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
3170
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
3171
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
3172
+ return;
3173
+ }
3174
+ Object.defineProperty(to, property, fromDescriptor);
3175
+ }, "copyProperty");
3176
+ var canCopyProperty = /* @__PURE__ */ __name(function(toDescriptor, fromDescriptor) {
3177
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
3178
+ }, "canCopyProperty");
3179
+ var changePrototype = /* @__PURE__ */ __name((to, from) => {
3180
+ const fromPrototype = Object.getPrototypeOf(from);
3181
+ if (fromPrototype === Object.getPrototypeOf(to)) {
3182
+ return;
3183
+ }
3184
+ Object.setPrototypeOf(to, fromPrototype);
3185
+ }, "changePrototype");
3186
+ var wrappedToString = /* @__PURE__ */ __name((withName, fromBody) => `/* Wrapped ${withName}*/
3187
+ ${fromBody}`, "wrappedToString");
3188
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
3189
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
3190
+ var changeToString = /* @__PURE__ */ __name((to, from, name) => {
3191
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
3192
+ const newToString = wrappedToString.bind(null, withName, from.toString());
3193
+ Object.defineProperty(newToString, "name", toStringName);
3194
+ Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
3195
+ }, "changeToString");
3196
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
3197
+ const { name } = to;
3198
+ for (const property of Reflect.ownKeys(from)) {
3199
+ copyProperty(to, from, property, ignoreNonConfigurable);
3200
+ }
3201
+ changePrototype(to, from);
3202
+ changeToString(to, from, name);
3203
+ return to;
3204
+ }
3205
+ __name(mimicFunction, "mimicFunction");
3206
+
3207
+ // node_modules/onetime/index.js
3208
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
3209
+ var onetime = /* @__PURE__ */ __name((function_, options = {}) => {
3210
+ if (typeof function_ !== "function") {
3211
+ throw new TypeError("Expected a function");
3212
+ }
3213
+ let returnValue;
3214
+ let callCount = 0;
3215
+ const functionName = function_.displayName || function_.name || "<anonymous>";
3216
+ const onetime2 = /* @__PURE__ */ __name(function(...arguments_) {
3217
+ calledFunctions.set(onetime2, ++callCount);
3218
+ if (callCount === 1) {
3219
+ returnValue = function_.apply(this, arguments_);
3220
+ function_ = null;
3221
+ } else if (options.throw === true) {
3222
+ throw new Error(`Function \`${functionName}\` can only be called once`);
3223
+ }
3224
+ return returnValue;
3225
+ }, "onetime");
3226
+ mimicFunction(onetime2, function_);
3227
+ calledFunctions.set(onetime2, callCount);
3228
+ return onetime2;
3229
+ }, "onetime");
3230
+ onetime.callCount = (function_) => {
3231
+ if (!calledFunctions.has(function_)) {
3232
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
3233
+ }
3234
+ return calledFunctions.get(function_);
3235
+ };
3236
+ var onetime_default = onetime;
3237
+
3238
+ // node_modules/execa/lib/error.js
3239
+ import process3 from "node:process";
3240
+
3241
+ // node_modules/human-signals/build/src/main.js
3242
+ import { constants as constants2 } from "node:os";
3243
+
3244
+ // node_modules/human-signals/build/src/realtime.js
3245
+ var getRealtimeSignals = /* @__PURE__ */ __name(() => {
3246
+ const length = SIGRTMAX - SIGRTMIN + 1;
3247
+ return Array.from({ length }, getRealtimeSignal);
3248
+ }, "getRealtimeSignals");
3249
+ var getRealtimeSignal = /* @__PURE__ */ __name((value, index) => ({
3250
+ name: `SIGRT${index + 1}`,
3251
+ number: SIGRTMIN + index,
3252
+ action: "terminate",
3253
+ description: "Application-specific signal (realtime)",
3254
+ standard: "posix"
3255
+ }), "getRealtimeSignal");
3256
+ var SIGRTMIN = 34;
3257
+ var SIGRTMAX = 64;
3258
+
3259
+ // node_modules/human-signals/build/src/signals.js
3260
+ import { constants } from "node:os";
3261
+
3262
+ // node_modules/human-signals/build/src/core.js
3263
+ var SIGNALS = [
3264
+ {
3265
+ name: "SIGHUP",
3266
+ number: 1,
3267
+ action: "terminate",
3268
+ description: "Terminal closed",
3269
+ standard: "posix"
3270
+ },
3271
+ {
3272
+ name: "SIGINT",
3273
+ number: 2,
3274
+ action: "terminate",
3275
+ description: "User interruption with CTRL-C",
3276
+ standard: "ansi"
3277
+ },
3278
+ {
3279
+ name: "SIGQUIT",
3280
+ number: 3,
3281
+ action: "core",
3282
+ description: "User interruption with CTRL-\\",
3283
+ standard: "posix"
3284
+ },
3285
+ {
3286
+ name: "SIGILL",
3287
+ number: 4,
3288
+ action: "core",
3289
+ description: "Invalid machine instruction",
3290
+ standard: "ansi"
3291
+ },
3292
+ {
3293
+ name: "SIGTRAP",
3294
+ number: 5,
3295
+ action: "core",
3296
+ description: "Debugger breakpoint",
3297
+ standard: "posix"
3298
+ },
3299
+ {
3300
+ name: "SIGABRT",
3301
+ number: 6,
3302
+ action: "core",
3303
+ description: "Aborted",
3304
+ standard: "ansi"
3305
+ },
3306
+ {
3307
+ name: "SIGIOT",
3308
+ number: 6,
3309
+ action: "core",
3310
+ description: "Aborted",
3311
+ standard: "bsd"
3312
+ },
3313
+ {
3314
+ name: "SIGBUS",
3315
+ number: 7,
3316
+ action: "core",
3317
+ description: "Bus error due to misaligned, non-existing address or paging error",
3318
+ standard: "bsd"
3319
+ },
3320
+ {
3321
+ name: "SIGEMT",
3322
+ number: 7,
3323
+ action: "terminate",
3324
+ description: "Command should be emulated but is not implemented",
3325
+ standard: "other"
3326
+ },
3327
+ {
3328
+ name: "SIGFPE",
3329
+ number: 8,
3330
+ action: "core",
3331
+ description: "Floating point arithmetic error",
3332
+ standard: "ansi"
3333
+ },
3334
+ {
3335
+ name: "SIGKILL",
3336
+ number: 9,
3337
+ action: "terminate",
3338
+ description: "Forced termination",
3339
+ standard: "posix",
3340
+ forced: true
3341
+ },
3342
+ {
3343
+ name: "SIGUSR1",
3344
+ number: 10,
3345
+ action: "terminate",
3346
+ description: "Application-specific signal",
3347
+ standard: "posix"
3348
+ },
3349
+ {
3350
+ name: "SIGSEGV",
3351
+ number: 11,
3352
+ action: "core",
3353
+ description: "Segmentation fault",
3354
+ standard: "ansi"
3355
+ },
3356
+ {
3357
+ name: "SIGUSR2",
3358
+ number: 12,
3359
+ action: "terminate",
3360
+ description: "Application-specific signal",
3361
+ standard: "posix"
3362
+ },
3363
+ {
3364
+ name: "SIGPIPE",
3365
+ number: 13,
3366
+ action: "terminate",
3367
+ description: "Broken pipe or socket",
3368
+ standard: "posix"
3369
+ },
3370
+ {
3371
+ name: "SIGALRM",
3372
+ number: 14,
3373
+ action: "terminate",
3374
+ description: "Timeout or timer",
3375
+ standard: "posix"
3376
+ },
3377
+ {
3378
+ name: "SIGTERM",
3379
+ number: 15,
3380
+ action: "terminate",
3381
+ description: "Termination",
3382
+ standard: "ansi"
3383
+ },
3384
+ {
3385
+ name: "SIGSTKFLT",
3386
+ number: 16,
3387
+ action: "terminate",
3388
+ description: "Stack is empty or overflowed",
3389
+ standard: "other"
3390
+ },
3391
+ {
3392
+ name: "SIGCHLD",
3393
+ number: 17,
3394
+ action: "ignore",
3395
+ description: "Child process terminated, paused or unpaused",
3396
+ standard: "posix"
3397
+ },
3398
+ {
3399
+ name: "SIGCLD",
3400
+ number: 17,
3401
+ action: "ignore",
3402
+ description: "Child process terminated, paused or unpaused",
3403
+ standard: "other"
3404
+ },
3405
+ {
3406
+ name: "SIGCONT",
3407
+ number: 18,
3408
+ action: "unpause",
3409
+ description: "Unpaused",
3410
+ standard: "posix",
3411
+ forced: true
3412
+ },
3413
+ {
3414
+ name: "SIGSTOP",
3415
+ number: 19,
3416
+ action: "pause",
3417
+ description: "Paused",
3418
+ standard: "posix",
3419
+ forced: true
3420
+ },
3421
+ {
3422
+ name: "SIGTSTP",
3423
+ number: 20,
3424
+ action: "pause",
3425
+ description: 'Paused using CTRL-Z or "suspend"',
3426
+ standard: "posix"
3427
+ },
3428
+ {
3429
+ name: "SIGTTIN",
3430
+ number: 21,
3431
+ action: "pause",
3432
+ description: "Background process cannot read terminal input",
3433
+ standard: "posix"
3434
+ },
3435
+ {
3436
+ name: "SIGBREAK",
3437
+ number: 21,
3438
+ action: "terminate",
3439
+ description: "User interruption with CTRL-BREAK",
3440
+ standard: "other"
3441
+ },
3442
+ {
3443
+ name: "SIGTTOU",
3444
+ number: 22,
3445
+ action: "pause",
3446
+ description: "Background process cannot write to terminal output",
3447
+ standard: "posix"
3448
+ },
3449
+ {
3450
+ name: "SIGURG",
3451
+ number: 23,
3452
+ action: "ignore",
3453
+ description: "Socket received out-of-band data",
3454
+ standard: "bsd"
3455
+ },
3456
+ {
3457
+ name: "SIGXCPU",
3458
+ number: 24,
3459
+ action: "core",
3460
+ description: "Process timed out",
3461
+ standard: "bsd"
3462
+ },
3463
+ {
3464
+ name: "SIGXFSZ",
3465
+ number: 25,
3466
+ action: "core",
3467
+ description: "File too big",
3468
+ standard: "bsd"
3469
+ },
3470
+ {
3471
+ name: "SIGVTALRM",
3472
+ number: 26,
3473
+ action: "terminate",
3474
+ description: "Timeout or timer",
3475
+ standard: "bsd"
3476
+ },
3477
+ {
3478
+ name: "SIGPROF",
3479
+ number: 27,
3480
+ action: "terminate",
3481
+ description: "Timeout or timer",
3482
+ standard: "bsd"
3483
+ },
3484
+ {
3485
+ name: "SIGWINCH",
3486
+ number: 28,
3487
+ action: "ignore",
3488
+ description: "Terminal window size changed",
3489
+ standard: "bsd"
3490
+ },
3491
+ {
3492
+ name: "SIGIO",
3493
+ number: 29,
3494
+ action: "terminate",
3495
+ description: "I/O is available",
3496
+ standard: "other"
3497
+ },
3498
+ {
3499
+ name: "SIGPOLL",
3500
+ number: 29,
3501
+ action: "terminate",
3502
+ description: "Watched event",
3503
+ standard: "other"
3504
+ },
3505
+ {
3506
+ name: "SIGINFO",
3507
+ number: 29,
3508
+ action: "ignore",
3509
+ description: "Request for process information",
3510
+ standard: "other"
3511
+ },
3512
+ {
3513
+ name: "SIGPWR",
3514
+ number: 30,
3515
+ action: "terminate",
3516
+ description: "Device running out of power",
3517
+ standard: "systemv"
3518
+ },
3519
+ {
3520
+ name: "SIGSYS",
3521
+ number: 31,
3522
+ action: "core",
3523
+ description: "Invalid system call",
3524
+ standard: "other"
3525
+ },
3526
+ {
3527
+ name: "SIGUNUSED",
3528
+ number: 31,
3529
+ action: "terminate",
3530
+ description: "Invalid system call",
3531
+ standard: "other"
3532
+ }
3533
+ ];
3534
+
3535
+ // node_modules/human-signals/build/src/signals.js
3536
+ var getSignals = /* @__PURE__ */ __name(() => {
3537
+ const realtimeSignals = getRealtimeSignals();
3538
+ const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
3539
+ return signals2;
3540
+ }, "getSignals");
3541
+ var normalizeSignal = /* @__PURE__ */ __name(({
3542
+ name,
3543
+ number: defaultNumber,
3544
+ description,
3545
+ action,
3546
+ forced = false,
3547
+ standard
3548
+ }) => {
3549
+ const {
3550
+ signals: { [name]: constantSignal }
3551
+ } = constants;
3552
+ const supported = constantSignal !== void 0;
3553
+ const number = supported ? constantSignal : defaultNumber;
3554
+ return { name, number, description, supported, action, forced, standard };
3555
+ }, "normalizeSignal");
3556
+
3557
+ // node_modules/human-signals/build/src/main.js
3558
+ var getSignalsByName = /* @__PURE__ */ __name(() => {
3559
+ const signals2 = getSignals();
3560
+ return Object.fromEntries(signals2.map(getSignalByName));
3561
+ }, "getSignalsByName");
3562
+ var getSignalByName = /* @__PURE__ */ __name(({
3563
+ name,
3564
+ number,
3565
+ description,
3566
+ supported,
3567
+ action,
3568
+ forced,
3569
+ standard
3570
+ }) => [name, { name, number, description, supported, action, forced, standard }], "getSignalByName");
3571
+ var signalsByName = getSignalsByName();
3572
+ var getSignalsByNumber = /* @__PURE__ */ __name(() => {
3573
+ const signals2 = getSignals();
3574
+ const length = SIGRTMAX + 1;
3575
+ const signalsA = Array.from(
3576
+ { length },
3577
+ (value, number) => getSignalByNumber(number, signals2)
3578
+ );
3579
+ return Object.assign({}, ...signalsA);
3580
+ }, "getSignalsByNumber");
3581
+ var getSignalByNumber = /* @__PURE__ */ __name((number, signals2) => {
3582
+ const signal = findSignalByNumber(number, signals2);
3583
+ if (signal === void 0) {
3584
+ return {};
3585
+ }
3586
+ const { name, description, supported, action, forced, standard } = signal;
3587
+ return {
3588
+ [number]: {
3589
+ name,
3590
+ number,
3591
+ description,
3592
+ supported,
3593
+ action,
3594
+ forced,
3595
+ standard
3596
+ }
3597
+ };
3598
+ }, "getSignalByNumber");
3599
+ var findSignalByNumber = /* @__PURE__ */ __name((number, signals2) => {
3600
+ const signal = signals2.find(({ name }) => constants2.signals[name] === number);
3601
+ if (signal !== void 0) {
3602
+ return signal;
3603
+ }
3604
+ return signals2.find((signalA) => signalA.number === number);
3605
+ }, "findSignalByNumber");
3606
+ var signalsByNumber = getSignalsByNumber();
3607
+
3608
+ // node_modules/execa/lib/error.js
3609
+ var getErrorPrefix = /* @__PURE__ */ __name(({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
3610
+ if (timedOut) {
3611
+ return `timed out after ${timeout} milliseconds`;
3612
+ }
3613
+ if (isCanceled) {
3614
+ return "was canceled";
3615
+ }
3616
+ if (errorCode !== void 0) {
3617
+ return `failed with ${errorCode}`;
3618
+ }
3619
+ if (signal !== void 0) {
3620
+ return `was killed with ${signal} (${signalDescription})`;
3621
+ }
3622
+ if (exitCode !== void 0) {
3623
+ return `failed with exit code ${exitCode}`;
3624
+ }
3625
+ return "failed";
3626
+ }, "getErrorPrefix");
3627
+ var makeError = /* @__PURE__ */ __name(({
3628
+ stdout,
3629
+ stderr,
3630
+ all,
3631
+ error,
3632
+ signal,
3633
+ exitCode,
3634
+ command,
3635
+ escapedCommand,
3636
+ timedOut,
3637
+ isCanceled,
3638
+ killed,
3639
+ parsed: { options: { timeout, cwd = process3.cwd() } }
3640
+ }) => {
3641
+ exitCode = exitCode === null ? void 0 : exitCode;
3642
+ signal = signal === null ? void 0 : signal;
3643
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
3644
+ const errorCode = error && error.code;
3645
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
3646
+ const execaMessage = `Command ${prefix}: ${command}`;
3647
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
3648
+ const shortMessage = isError ? `${execaMessage}
3649
+ ${error.message}` : execaMessage;
3650
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
3651
+ if (isError) {
3652
+ error.originalMessage = error.message;
3653
+ error.message = message;
3654
+ } else {
3655
+ error = new Error(message);
3656
+ }
3657
+ error.shortMessage = shortMessage;
3658
+ error.command = command;
3659
+ error.escapedCommand = escapedCommand;
3660
+ error.exitCode = exitCode;
3661
+ error.signal = signal;
3662
+ error.signalDescription = signalDescription;
3663
+ error.stdout = stdout;
3664
+ error.stderr = stderr;
3665
+ error.cwd = cwd;
3666
+ if (all !== void 0) {
3667
+ error.all = all;
3668
+ }
3669
+ if ("bufferedData" in error) {
3670
+ delete error.bufferedData;
3671
+ }
3672
+ error.failed = true;
3673
+ error.timedOut = Boolean(timedOut);
3674
+ error.isCanceled = isCanceled;
3675
+ error.killed = killed && !timedOut;
3676
+ return error;
3677
+ }, "makeError");
3678
+
3679
+ // node_modules/execa/lib/stdio.js
3680
+ var aliases = ["stdin", "stdout", "stderr"];
3681
+ var hasAlias = /* @__PURE__ */ __name((options) => aliases.some((alias) => options[alias] !== void 0), "hasAlias");
3682
+ var normalizeStdio = /* @__PURE__ */ __name((options) => {
3683
+ if (!options) {
3684
+ return;
3685
+ }
3686
+ const { stdio } = options;
3687
+ if (stdio === void 0) {
3688
+ return aliases.map((alias) => options[alias]);
3689
+ }
3690
+ if (hasAlias(options)) {
3691
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
3692
+ }
3693
+ if (typeof stdio === "string") {
3694
+ return stdio;
3695
+ }
3696
+ if (!Array.isArray(stdio)) {
3697
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
3698
+ }
3699
+ const length = Math.max(stdio.length, aliases.length);
3700
+ return Array.from({ length }, (value, index) => stdio[index]);
3701
+ }, "normalizeStdio");
3702
+
3703
+ // node_modules/execa/lib/kill.js
3704
+ import os from "node:os";
3705
+
3706
+ // node_modules/signal-exit/dist/mjs/signals.js
3707
+ var signals = [];
3708
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
3709
+ if (process.platform !== "win32") {
3710
+ signals.push(
3711
+ "SIGALRM",
3712
+ "SIGABRT",
3713
+ "SIGVTALRM",
3714
+ "SIGXCPU",
3715
+ "SIGXFSZ",
3716
+ "SIGUSR2",
3717
+ "SIGTRAP",
3718
+ "SIGSYS",
3719
+ "SIGQUIT",
3720
+ "SIGIOT"
3721
+ // should detect profiler and enable/disable accordingly.
3722
+ // see #21
3723
+ // 'SIGPROF'
3724
+ );
3725
+ }
3726
+ if (process.platform === "linux") {
3727
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
3728
+ }
3729
+
3730
+ // node_modules/signal-exit/dist/mjs/index.js
3731
+ var processOk = /* @__PURE__ */ __name((process7) => !!process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function", "processOk");
3732
+ var kExitEmitter = Symbol.for("signal-exit emitter");
3733
+ var global2 = globalThis;
3734
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
3735
+ var Emitter = class {
3736
+ static {
3737
+ __name(this, "Emitter");
3738
+ }
3739
+ emitted = {
3740
+ afterExit: false,
3741
+ exit: false
3742
+ };
3743
+ listeners = {
3744
+ afterExit: [],
3745
+ exit: []
3746
+ };
3747
+ count = 0;
3748
+ id = Math.random();
3749
+ constructor() {
3750
+ if (global2[kExitEmitter]) {
3751
+ return global2[kExitEmitter];
3752
+ }
3753
+ ObjectDefineProperty(global2, kExitEmitter, {
3754
+ value: this,
3755
+ writable: false,
3756
+ enumerable: false,
3757
+ configurable: false
3758
+ });
3759
+ }
3760
+ on(ev, fn) {
3761
+ this.listeners[ev].push(fn);
3762
+ }
3763
+ removeListener(ev, fn) {
3764
+ const list = this.listeners[ev];
3765
+ const i = list.indexOf(fn);
3766
+ if (i === -1) {
3767
+ return;
3768
+ }
3769
+ if (i === 0 && list.length === 1) {
3770
+ list.length = 0;
3771
+ } else {
3772
+ list.splice(i, 1);
3773
+ }
3774
+ }
3775
+ emit(ev, code, signal) {
3776
+ if (this.emitted[ev]) {
3777
+ return false;
3778
+ }
3779
+ this.emitted[ev] = true;
3780
+ let ret = false;
3781
+ for (const fn of this.listeners[ev]) {
3782
+ ret = fn(code, signal) === true || ret;
3783
+ }
3784
+ if (ev === "exit") {
3785
+ ret = this.emit("afterExit", code, signal) || ret;
3786
+ }
3787
+ return ret;
3788
+ }
3789
+ };
3790
+ var SignalExitBase = class {
3791
+ static {
3792
+ __name(this, "SignalExitBase");
3793
+ }
3794
+ };
3795
+ var signalExitWrap = /* @__PURE__ */ __name((handler) => {
3796
+ return {
3797
+ onExit(cb, opts) {
3798
+ return handler.onExit(cb, opts);
3799
+ },
3800
+ load() {
3801
+ return handler.load();
3802
+ },
3803
+ unload() {
3804
+ return handler.unload();
3805
+ }
3806
+ };
3807
+ }, "signalExitWrap");
3808
+ var SignalExitFallback = class extends SignalExitBase {
3809
+ static {
3810
+ __name(this, "SignalExitFallback");
3811
+ }
3812
+ onExit() {
3813
+ return () => {
3814
+ };
3815
+ }
3816
+ load() {
3817
+ }
3818
+ unload() {
3819
+ }
3820
+ };
3821
+ var SignalExit = class extends SignalExitBase {
3822
+ static {
3823
+ __name(this, "SignalExit");
3824
+ }
3825
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
3826
+ // so use a supported signal instead
3827
+ /* c8 ignore start */
3828
+ #hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
3829
+ /* c8 ignore stop */
3830
+ #emitter = new Emitter();
3831
+ #process;
3832
+ #originalProcessEmit;
3833
+ #originalProcessReallyExit;
3834
+ #sigListeners = {};
3835
+ #loaded = false;
3836
+ constructor(process7) {
3837
+ super();
3838
+ this.#process = process7;
3839
+ this.#sigListeners = {};
3840
+ for (const sig of signals) {
3841
+ this.#sigListeners[sig] = () => {
3842
+ const listeners = this.#process.listeners(sig);
3843
+ let { count } = this.#emitter;
3844
+ const p = process7;
3845
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
3846
+ count += p.__signal_exit_emitter__.count;
3847
+ }
3848
+ if (listeners.length === count) {
3849
+ this.unload();
3850
+ const ret = this.#emitter.emit("exit", null, sig);
3851
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
3852
+ if (!ret)
3853
+ process7.kill(process7.pid, s);
3854
+ }
3855
+ };
3856
+ }
3857
+ this.#originalProcessReallyExit = process7.reallyExit;
3858
+ this.#originalProcessEmit = process7.emit;
3859
+ }
3860
+ onExit(cb, opts) {
3861
+ if (!processOk(this.#process)) {
3862
+ return () => {
3863
+ };
3864
+ }
3865
+ if (this.#loaded === false) {
3866
+ this.load();
3867
+ }
3868
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
3869
+ this.#emitter.on(ev, cb);
3870
+ return () => {
3871
+ this.#emitter.removeListener(ev, cb);
3872
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
3873
+ this.unload();
3874
+ }
3875
+ };
3876
+ }
3877
+ load() {
3878
+ if (this.#loaded) {
3879
+ return;
3880
+ }
3881
+ this.#loaded = true;
3882
+ this.#emitter.count += 1;
3883
+ for (const sig of signals) {
3884
+ try {
3885
+ const fn = this.#sigListeners[sig];
3886
+ if (fn)
3887
+ this.#process.on(sig, fn);
3888
+ } catch (_) {
3889
+ }
3890
+ }
3891
+ this.#process.emit = (ev, ...a) => {
3892
+ return this.#processEmit(ev, ...a);
3893
+ };
3894
+ this.#process.reallyExit = (code) => {
3895
+ return this.#processReallyExit(code);
3896
+ };
3897
+ }
3898
+ unload() {
3899
+ if (!this.#loaded) {
3900
+ return;
3901
+ }
3902
+ this.#loaded = false;
3903
+ signals.forEach((sig) => {
3904
+ const listener = this.#sigListeners[sig];
3905
+ if (!listener) {
3906
+ throw new Error("Listener not defined for signal: " + sig);
3907
+ }
3908
+ try {
3909
+ this.#process.removeListener(sig, listener);
3910
+ } catch (_) {
3911
+ }
3912
+ });
3913
+ this.#process.emit = this.#originalProcessEmit;
3914
+ this.#process.reallyExit = this.#originalProcessReallyExit;
3915
+ this.#emitter.count -= 1;
3916
+ }
3917
+ #processReallyExit(code) {
3918
+ if (!processOk(this.#process)) {
3919
+ return 0;
3920
+ }
3921
+ this.#process.exitCode = code || 0;
3922
+ this.#emitter.emit("exit", this.#process.exitCode, null);
3923
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
3924
+ }
3925
+ #processEmit(ev, ...args) {
3926
+ const og = this.#originalProcessEmit;
3927
+ if (ev === "exit" && processOk(this.#process)) {
3928
+ if (typeof args[0] === "number") {
3929
+ this.#process.exitCode = args[0];
3930
+ }
3931
+ const ret = og.call(this.#process, ev, ...args);
3932
+ this.#emitter.emit("exit", this.#process.exitCode, null);
3933
+ return ret;
3934
+ } else {
3935
+ return og.call(this.#process, ev, ...args);
3936
+ }
3937
+ }
3938
+ };
3939
+ var process4 = globalThis.process;
3940
+ var {
3941
+ /**
3942
+ * Called when the process is exiting, whether via signal, explicit
3943
+ * exit, or running out of stuff to do.
3944
+ *
3945
+ * If the global process object is not suitable for instrumentation,
3946
+ * then this will be a no-op.
3947
+ *
3948
+ * Returns a function that may be used to unload signal-exit.
3949
+ */
3950
+ onExit,
3951
+ /**
3952
+ * Load the listeners. Likely you never need to call this, unless
3953
+ * doing a rather deep integration with signal-exit functionality.
3954
+ * Mostly exposed for the benefit of testing.
3955
+ *
3956
+ * @internal
3957
+ */
3958
+ load,
3959
+ /**
3960
+ * Unload the listeners. Likely you never need to call this, unless
3961
+ * doing a rather deep integration with signal-exit functionality.
3962
+ * Mostly exposed for the benefit of testing.
3963
+ *
3964
+ * @internal
3965
+ */
3966
+ unload
3967
+ } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
3968
+
3969
+ // node_modules/execa/lib/kill.js
3970
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
3971
+ var spawnedKill = /* @__PURE__ */ __name((kill, signal = "SIGTERM", options = {}) => {
3972
+ const killResult = kill(signal);
3973
+ setKillTimeout(kill, signal, options, killResult);
3974
+ return killResult;
3975
+ }, "spawnedKill");
3976
+ var setKillTimeout = /* @__PURE__ */ __name((kill, signal, options, killResult) => {
3977
+ if (!shouldForceKill(signal, options, killResult)) {
3978
+ return;
3979
+ }
3980
+ const timeout = getForceKillAfterTimeout(options);
3981
+ const t = setTimeout(() => {
3982
+ kill("SIGKILL");
3983
+ }, timeout);
3984
+ if (t.unref) {
3985
+ t.unref();
3986
+ }
3987
+ }, "setKillTimeout");
3988
+ var shouldForceKill = /* @__PURE__ */ __name((signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult, "shouldForceKill");
3989
+ var isSigterm = /* @__PURE__ */ __name((signal) => signal === os.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM", "isSigterm");
3990
+ var getForceKillAfterTimeout = /* @__PURE__ */ __name(({ forceKillAfterTimeout = true }) => {
3991
+ if (forceKillAfterTimeout === true) {
3992
+ return DEFAULT_FORCE_KILL_TIMEOUT;
3993
+ }
3994
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
3995
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
3996
+ }
3997
+ return forceKillAfterTimeout;
3998
+ }, "getForceKillAfterTimeout");
3999
+ var spawnedCancel = /* @__PURE__ */ __name((spawned, context) => {
4000
+ const killResult = spawned.kill();
4001
+ if (killResult) {
4002
+ context.isCanceled = true;
4003
+ }
4004
+ }, "spawnedCancel");
4005
+ var timeoutKill = /* @__PURE__ */ __name((spawned, signal, reject) => {
4006
+ spawned.kill(signal);
4007
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
4008
+ }, "timeoutKill");
4009
+ var setupTimeout = /* @__PURE__ */ __name((spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
4010
+ if (timeout === 0 || timeout === void 0) {
4011
+ return spawnedPromise;
4012
+ }
4013
+ let timeoutId;
4014
+ const timeoutPromise = new Promise((resolve3, reject) => {
4015
+ timeoutId = setTimeout(() => {
4016
+ timeoutKill(spawned, killSignal, reject);
4017
+ }, timeout);
4018
+ });
4019
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
4020
+ clearTimeout(timeoutId);
4021
+ });
4022
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
4023
+ }, "setupTimeout");
4024
+ var validateTimeout = /* @__PURE__ */ __name(({ timeout }) => {
4025
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
4026
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
4027
+ }
4028
+ }, "validateTimeout");
4029
+ var setExitHandler = /* @__PURE__ */ __name(async (spawned, { cleanup, detached }, timedPromise) => {
4030
+ if (!cleanup || detached) {
4031
+ return timedPromise;
4032
+ }
4033
+ const removeExitHandler = onExit(() => {
4034
+ spawned.kill();
4035
+ });
4036
+ return timedPromise.finally(() => {
4037
+ removeExitHandler();
4038
+ });
4039
+ }, "setExitHandler");
4040
+
4041
+ // node_modules/execa/lib/pipe.js
4042
+ import { createWriteStream } from "node:fs";
4043
+ import { ChildProcess } from "node:child_process";
4044
+
4045
+ // node_modules/is-stream/index.js
4046
+ function isStream(stream) {
4047
+ return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
4048
+ }
4049
+ __name(isStream, "isStream");
4050
+ function isWritableStream(stream) {
4051
+ return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
4052
+ }
4053
+ __name(isWritableStream, "isWritableStream");
4054
+
4055
+ // node_modules/execa/lib/pipe.js
4056
+ var isExecaChildProcess = /* @__PURE__ */ __name((target) => target instanceof ChildProcess && typeof target.then === "function", "isExecaChildProcess");
4057
+ var pipeToTarget = /* @__PURE__ */ __name((spawned, streamName, target) => {
4058
+ if (typeof target === "string") {
4059
+ spawned[streamName].pipe(createWriteStream(target));
4060
+ return spawned;
4061
+ }
4062
+ if (isWritableStream(target)) {
4063
+ spawned[streamName].pipe(target);
4064
+ return spawned;
4065
+ }
4066
+ if (!isExecaChildProcess(target)) {
4067
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
4068
+ }
4069
+ if (!isWritableStream(target.stdin)) {
4070
+ throw new TypeError("The target child process's stdin must be available.");
4071
+ }
4072
+ spawned[streamName].pipe(target.stdin);
4073
+ return target;
4074
+ }, "pipeToTarget");
4075
+ var addPipeMethods = /* @__PURE__ */ __name((spawned) => {
4076
+ if (spawned.stdout !== null) {
4077
+ spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
4078
+ }
4079
+ if (spawned.stderr !== null) {
4080
+ spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
4081
+ }
4082
+ if (spawned.all !== void 0) {
4083
+ spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
4084
+ }
4085
+ }, "addPipeMethods");
4086
+
4087
+ // node_modules/execa/lib/stream.js
4088
+ import { createReadStream, readFileSync } from "node:fs";
4089
+ import { setTimeout as setTimeout2 } from "node:timers/promises";
4090
+
4091
+ // node_modules/get-stream/source/contents.js
4092
+ var getStreamContents = /* @__PURE__ */ __name(async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
4093
+ if (!isAsyncIterable(stream)) {
4094
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
4095
+ }
4096
+ const state = init();
4097
+ state.length = 0;
4098
+ try {
4099
+ for await (const chunk of stream) {
4100
+ const chunkType = getChunkType(chunk);
4101
+ const convertedChunk = convertChunk[chunkType](chunk, state);
4102
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
4103
+ }
4104
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
4105
+ return finalize(state);
4106
+ } catch (error) {
4107
+ error.bufferedData = finalize(state);
4108
+ throw error;
4109
+ }
4110
+ }, "getStreamContents");
4111
+ var appendFinalChunk = /* @__PURE__ */ __name(({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
4112
+ const convertedChunk = getFinalChunk(state);
4113
+ if (convertedChunk !== void 0) {
4114
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
4115
+ }
4116
+ }, "appendFinalChunk");
4117
+ var appendChunk = /* @__PURE__ */ __name(({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
4118
+ const chunkSize = getSize(convertedChunk);
4119
+ const newLength = state.length + chunkSize;
4120
+ if (newLength <= maxBuffer) {
4121
+ addNewChunk(convertedChunk, state, addChunk, newLength);
4122
+ return;
4123
+ }
4124
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
4125
+ if (truncatedChunk !== void 0) {
4126
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
4127
+ }
4128
+ throw new MaxBufferError();
4129
+ }, "appendChunk");
4130
+ var addNewChunk = /* @__PURE__ */ __name((convertedChunk, state, addChunk, newLength) => {
4131
+ state.contents = addChunk(convertedChunk, state, newLength);
4132
+ state.length = newLength;
4133
+ }, "addNewChunk");
4134
+ var isAsyncIterable = /* @__PURE__ */ __name((stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function", "isAsyncIterable");
4135
+ var getChunkType = /* @__PURE__ */ __name((chunk) => {
4136
+ const typeOfChunk = typeof chunk;
4137
+ if (typeOfChunk === "string") {
4138
+ return "string";
4139
+ }
4140
+ if (typeOfChunk !== "object" || chunk === null) {
4141
+ return "others";
4142
+ }
4143
+ if (globalThis.Buffer?.isBuffer(chunk)) {
4144
+ return "buffer";
4145
+ }
4146
+ const prototypeName = objectToString.call(chunk);
4147
+ if (prototypeName === "[object ArrayBuffer]") {
4148
+ return "arrayBuffer";
4149
+ }
4150
+ if (prototypeName === "[object DataView]") {
4151
+ return "dataView";
4152
+ }
4153
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
4154
+ return "typedArray";
4155
+ }
4156
+ return "others";
4157
+ }, "getChunkType");
4158
+ var { toString: objectToString } = Object.prototype;
4159
+ var MaxBufferError = class extends Error {
4160
+ static {
4161
+ __name(this, "MaxBufferError");
4162
+ }
4163
+ name = "MaxBufferError";
4164
+ constructor() {
4165
+ super("maxBuffer exceeded");
4166
+ }
4167
+ };
4168
+
4169
+ // node_modules/get-stream/source/utils.js
4170
+ var identity = /* @__PURE__ */ __name((value) => value, "identity");
4171
+ var noop = /* @__PURE__ */ __name(() => void 0, "noop");
4172
+ var getContentsProp = /* @__PURE__ */ __name(({ contents }) => contents, "getContentsProp");
4173
+ var throwObjectStream = /* @__PURE__ */ __name((chunk) => {
4174
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
4175
+ }, "throwObjectStream");
4176
+ var getLengthProp = /* @__PURE__ */ __name((convertedChunk) => convertedChunk.length, "getLengthProp");
4177
+
4178
+ // node_modules/get-stream/source/array-buffer.js
4179
+ async function getStreamAsArrayBuffer(stream, options) {
4180
+ return getStreamContents(stream, arrayBufferMethods, options);
4181
+ }
4182
+ __name(getStreamAsArrayBuffer, "getStreamAsArrayBuffer");
4183
+ var initArrayBuffer = /* @__PURE__ */ __name(() => ({ contents: new ArrayBuffer(0) }), "initArrayBuffer");
4184
+ var useTextEncoder = /* @__PURE__ */ __name((chunk) => textEncoder.encode(chunk), "useTextEncoder");
4185
+ var textEncoder = new TextEncoder();
4186
+ var useUint8Array = /* @__PURE__ */ __name((chunk) => new Uint8Array(chunk), "useUint8Array");
4187
+ var useUint8ArrayWithOffset = /* @__PURE__ */ __name((chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength), "useUint8ArrayWithOffset");
4188
+ var truncateArrayBufferChunk = /* @__PURE__ */ __name((convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize), "truncateArrayBufferChunk");
4189
+ var addArrayBufferChunk = /* @__PURE__ */ __name((convertedChunk, { contents, length: previousLength }, length) => {
4190
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
4191
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
4192
+ return newContents;
4193
+ }, "addArrayBufferChunk");
4194
+ var resizeArrayBufferSlow = /* @__PURE__ */ __name((contents, length) => {
4195
+ if (length <= contents.byteLength) {
4196
+ return contents;
4197
+ }
4198
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
4199
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
4200
+ return arrayBuffer;
4201
+ }, "resizeArrayBufferSlow");
4202
+ var resizeArrayBuffer = /* @__PURE__ */ __name((contents, length) => {
4203
+ if (length <= contents.maxByteLength) {
4204
+ contents.resize(length);
4205
+ return contents;
4206
+ }
4207
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
4208
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
4209
+ return arrayBuffer;
4210
+ }, "resizeArrayBuffer");
4211
+ var getNewContentsLength = /* @__PURE__ */ __name((length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR)), "getNewContentsLength");
4212
+ var SCALE_FACTOR = 2;
4213
+ var finalizeArrayBuffer = /* @__PURE__ */ __name(({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length), "finalizeArrayBuffer");
4214
+ var hasArrayBufferResize = /* @__PURE__ */ __name(() => "resize" in ArrayBuffer.prototype, "hasArrayBufferResize");
4215
+ var arrayBufferMethods = {
4216
+ init: initArrayBuffer,
4217
+ convertChunk: {
4218
+ string: useTextEncoder,
4219
+ buffer: useUint8Array,
4220
+ arrayBuffer: useUint8Array,
4221
+ dataView: useUint8ArrayWithOffset,
4222
+ typedArray: useUint8ArrayWithOffset,
4223
+ others: throwObjectStream
4224
+ },
4225
+ getSize: getLengthProp,
4226
+ truncateChunk: truncateArrayBufferChunk,
4227
+ addChunk: addArrayBufferChunk,
4228
+ getFinalChunk: noop,
4229
+ finalize: finalizeArrayBuffer
4230
+ };
4231
+
4232
+ // node_modules/get-stream/source/buffer.js
4233
+ async function getStreamAsBuffer(stream, options) {
4234
+ if (!("Buffer" in globalThis)) {
4235
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
4236
+ }
4237
+ try {
4238
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
4239
+ } catch (error) {
4240
+ if (error.bufferedData !== void 0) {
4241
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
4242
+ }
4243
+ throw error;
4244
+ }
4245
+ }
4246
+ __name(getStreamAsBuffer, "getStreamAsBuffer");
4247
+ var arrayBufferToNodeBuffer = /* @__PURE__ */ __name((arrayBuffer) => globalThis.Buffer.from(arrayBuffer), "arrayBufferToNodeBuffer");
4248
+
4249
+ // node_modules/get-stream/source/string.js
4250
+ async function getStreamAsString(stream, options) {
4251
+ return getStreamContents(stream, stringMethods, options);
4252
+ }
4253
+ __name(getStreamAsString, "getStreamAsString");
4254
+ var initString = /* @__PURE__ */ __name(() => ({ contents: "", textDecoder: new TextDecoder() }), "initString");
4255
+ var useTextDecoder = /* @__PURE__ */ __name((chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true }), "useTextDecoder");
4256
+ var addStringChunk = /* @__PURE__ */ __name((convertedChunk, { contents }) => contents + convertedChunk, "addStringChunk");
4257
+ var truncateStringChunk = /* @__PURE__ */ __name((convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize), "truncateStringChunk");
4258
+ var getFinalStringChunk = /* @__PURE__ */ __name(({ textDecoder }) => {
4259
+ const finalChunk = textDecoder.decode();
4260
+ return finalChunk === "" ? void 0 : finalChunk;
4261
+ }, "getFinalStringChunk");
4262
+ var stringMethods = {
4263
+ init: initString,
4264
+ convertChunk: {
4265
+ string: identity,
4266
+ buffer: useTextDecoder,
4267
+ arrayBuffer: useTextDecoder,
4268
+ dataView: useTextDecoder,
4269
+ typedArray: useTextDecoder,
4270
+ others: throwObjectStream
4271
+ },
4272
+ getSize: getLengthProp,
4273
+ truncateChunk: truncateStringChunk,
4274
+ addChunk: addStringChunk,
4275
+ getFinalChunk: getFinalStringChunk,
4276
+ finalize: getContentsProp
4277
+ };
4278
+
4279
+ // node_modules/execa/lib/stream.js
4280
+ var import_merge_stream = __toESM(require_merge_stream(), 1);
4281
+ var validateInputOptions = /* @__PURE__ */ __name((input) => {
4282
+ if (input !== void 0) {
4283
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
4284
+ }
4285
+ }, "validateInputOptions");
4286
+ var getInputSync = /* @__PURE__ */ __name(({ input, inputFile }) => {
4287
+ if (typeof inputFile !== "string") {
4288
+ return input;
4289
+ }
4290
+ validateInputOptions(input);
4291
+ return readFileSync(inputFile);
4292
+ }, "getInputSync");
4293
+ var handleInputSync = /* @__PURE__ */ __name((options) => {
4294
+ const input = getInputSync(options);
4295
+ if (isStream(input)) {
4296
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
4297
+ }
4298
+ return input;
4299
+ }, "handleInputSync");
4300
+ var getInput = /* @__PURE__ */ __name(({ input, inputFile }) => {
4301
+ if (typeof inputFile !== "string") {
4302
+ return input;
4303
+ }
4304
+ validateInputOptions(input);
4305
+ return createReadStream(inputFile);
4306
+ }, "getInput");
4307
+ var handleInput = /* @__PURE__ */ __name((spawned, options) => {
4308
+ const input = getInput(options);
4309
+ if (input === void 0) {
4310
+ return;
4311
+ }
4312
+ if (isStream(input)) {
4313
+ input.pipe(spawned.stdin);
4314
+ } else {
4315
+ spawned.stdin.end(input);
4316
+ }
4317
+ }, "handleInput");
4318
+ var makeAllStream = /* @__PURE__ */ __name((spawned, { all }) => {
4319
+ if (!all || !spawned.stdout && !spawned.stderr) {
4320
+ return;
4321
+ }
4322
+ const mixed = (0, import_merge_stream.default)();
4323
+ if (spawned.stdout) {
4324
+ mixed.add(spawned.stdout);
4325
+ }
4326
+ if (spawned.stderr) {
4327
+ mixed.add(spawned.stderr);
4328
+ }
4329
+ return mixed;
4330
+ }, "makeAllStream");
4331
+ var getBufferedData = /* @__PURE__ */ __name(async (stream, streamPromise) => {
4332
+ if (!stream || streamPromise === void 0) {
4333
+ return;
4334
+ }
4335
+ await setTimeout2(0);
4336
+ stream.destroy();
4337
+ try {
4338
+ return await streamPromise;
4339
+ } catch (error) {
4340
+ return error.bufferedData;
4341
+ }
4342
+ }, "getBufferedData");
4343
+ var getStreamPromise = /* @__PURE__ */ __name((stream, { encoding, buffer, maxBuffer }) => {
4344
+ if (!stream || !buffer) {
4345
+ return;
4346
+ }
4347
+ if (encoding === "utf8" || encoding === "utf-8") {
4348
+ return getStreamAsString(stream, { maxBuffer });
4349
+ }
4350
+ if (encoding === null || encoding === "buffer") {
4351
+ return getStreamAsBuffer(stream, { maxBuffer });
4352
+ }
4353
+ return applyEncoding(stream, maxBuffer, encoding);
4354
+ }, "getStreamPromise");
4355
+ var applyEncoding = /* @__PURE__ */ __name(async (stream, maxBuffer, encoding) => {
4356
+ const buffer = await getStreamAsBuffer(stream, { maxBuffer });
4357
+ return buffer.toString(encoding);
4358
+ }, "applyEncoding");
4359
+ var getSpawnedResult = /* @__PURE__ */ __name(async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
4360
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
4361
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
4362
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
4363
+ try {
4364
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
4365
+ } catch (error) {
4366
+ return Promise.all([
4367
+ { error, signal: error.signal, timedOut: error.timedOut },
4368
+ getBufferedData(stdout, stdoutPromise),
4369
+ getBufferedData(stderr, stderrPromise),
4370
+ getBufferedData(all, allPromise)
4371
+ ]);
4372
+ }
4373
+ }, "getSpawnedResult");
4374
+
4375
+ // node_modules/execa/lib/promise.js
4376
+ var nativePromisePrototype = (async () => {
4377
+ })().constructor.prototype;
4378
+ var descriptors = ["then", "catch", "finally"].map((property) => [
4379
+ property,
4380
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
4381
+ ]);
4382
+ var mergePromise = /* @__PURE__ */ __name((spawned, promise2) => {
4383
+ for (const [property, descriptor] of descriptors) {
4384
+ const value = typeof promise2 === "function" ? (...args) => Reflect.apply(descriptor.value, promise2(), args) : descriptor.value.bind(promise2);
4385
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
4386
+ }
4387
+ }, "mergePromise");
4388
+ var getSpawnedPromise = /* @__PURE__ */ __name((spawned) => new Promise((resolve3, reject) => {
4389
+ spawned.on("exit", (exitCode, signal) => {
4390
+ resolve3({ exitCode, signal });
4391
+ });
4392
+ spawned.on("error", (error) => {
4393
+ reject(error);
4394
+ });
4395
+ if (spawned.stdin) {
4396
+ spawned.stdin.on("error", (error) => {
4397
+ reject(error);
4398
+ });
4399
+ }
4400
+ }), "getSpawnedPromise");
4401
+
4402
+ // node_modules/execa/lib/command.js
4403
+ import { Buffer as Buffer2 } from "node:buffer";
4404
+ import { ChildProcess as ChildProcess2 } from "node:child_process";
4405
+ var normalizeArgs = /* @__PURE__ */ __name((file, args = []) => {
4406
+ if (!Array.isArray(args)) {
4407
+ return [file];
4408
+ }
4409
+ return [file, ...args];
4410
+ }, "normalizeArgs");
4411
+ var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
4412
+ var escapeArg = /* @__PURE__ */ __name((arg) => {
4413
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
4414
+ return arg;
4415
+ }
4416
+ return `"${arg.replaceAll('"', '\\"')}"`;
4417
+ }, "escapeArg");
4418
+ var joinCommand = /* @__PURE__ */ __name((file, args) => normalizeArgs(file, args).join(" "), "joinCommand");
4419
+ var getEscapedCommand = /* @__PURE__ */ __name((file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" "), "getEscapedCommand");
4420
+ var SPACES_REGEXP = / +/g;
4421
+ var parseCommand = /* @__PURE__ */ __name((command) => {
4422
+ const tokens = [];
4423
+ for (const token of command.trim().split(SPACES_REGEXP)) {
4424
+ const previousToken = tokens.at(-1);
4425
+ if (previousToken && previousToken.endsWith("\\")) {
4426
+ tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
4427
+ } else {
4428
+ tokens.push(token);
4429
+ }
4430
+ }
4431
+ return tokens;
4432
+ }, "parseCommand");
4433
+ var parseExpression = /* @__PURE__ */ __name((expression) => {
4434
+ const typeOfExpression = typeof expression;
4435
+ if (typeOfExpression === "string") {
4436
+ return expression;
4437
+ }
4438
+ if (typeOfExpression === "number") {
4439
+ return String(expression);
4440
+ }
4441
+ if (typeOfExpression === "object" && expression !== null && !(expression instanceof ChildProcess2) && "stdout" in expression) {
4442
+ const typeOfStdout = typeof expression.stdout;
4443
+ if (typeOfStdout === "string") {
4444
+ return expression.stdout;
4445
+ }
4446
+ if (Buffer2.isBuffer(expression.stdout)) {
4447
+ return expression.stdout.toString();
4448
+ }
4449
+ throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
4450
+ }
4451
+ throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
4452
+ }, "parseExpression");
4453
+ var concatTokens = /* @__PURE__ */ __name((tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
4454
+ ...tokens.slice(0, -1),
4455
+ `${tokens.at(-1)}${nextTokens[0]}`,
4456
+ ...nextTokens.slice(1)
4457
+ ], "concatTokens");
4458
+ var parseTemplate = /* @__PURE__ */ __name(({ templates, expressions, tokens, index, template }) => {
4459
+ const templateString = template ?? templates.raw[index];
4460
+ const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
4461
+ const newTokens = concatTokens(
4462
+ tokens,
4463
+ templateTokens,
4464
+ templateString.startsWith(" ")
4465
+ );
4466
+ if (index === expressions.length) {
4467
+ return newTokens;
4468
+ }
4469
+ const expression = expressions[index];
4470
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
4471
+ return concatTokens(
4472
+ newTokens,
4473
+ expressionTokens,
4474
+ templateString.endsWith(" ")
4475
+ );
4476
+ }, "parseTemplate");
4477
+ var parseTemplates = /* @__PURE__ */ __name((templates, expressions) => {
4478
+ let tokens = [];
4479
+ for (const [index, template] of templates.entries()) {
4480
+ tokens = parseTemplate({ templates, expressions, tokens, index, template });
4481
+ }
4482
+ return tokens;
4483
+ }, "parseTemplates");
4484
+
4485
+ // node_modules/execa/lib/verbose.js
4486
+ import { debuglog } from "node:util";
4487
+ import process5 from "node:process";
4488
+ var verboseDefault = debuglog("execa").enabled;
4489
+ var padField = /* @__PURE__ */ __name((field, padding) => String(field).padStart(padding, "0"), "padField");
4490
+ var getTimestamp = /* @__PURE__ */ __name(() => {
4491
+ const date = /* @__PURE__ */ new Date();
4492
+ return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
4493
+ }, "getTimestamp");
4494
+ var logCommand = /* @__PURE__ */ __name((escapedCommand, { verbose }) => {
4495
+ if (!verbose) {
4496
+ return;
4497
+ }
4498
+ process5.stderr.write(`[${getTimestamp()}] ${escapedCommand}
4499
+ `);
4500
+ }, "logCommand");
4501
+
4502
+ // node_modules/execa/index.js
4503
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
4504
+ var getEnv = /* @__PURE__ */ __name(({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
4505
+ const env = extendEnv ? { ...process6.env, ...envOption } : envOption;
4506
+ if (preferLocal) {
4507
+ return npmRunPathEnv({ env, cwd: localDir, execPath });
4508
+ }
4509
+ return env;
4510
+ }, "getEnv");
4511
+ var handleArguments = /* @__PURE__ */ __name((file, args, options = {}) => {
4512
+ const parsed = import_cross_spawn.default._parse(file, args, options);
4513
+ file = parsed.command;
4514
+ args = parsed.args;
4515
+ options = parsed.options;
4516
+ options = {
4517
+ maxBuffer: DEFAULT_MAX_BUFFER,
4518
+ buffer: true,
4519
+ stripFinalNewline: true,
4520
+ extendEnv: true,
4521
+ preferLocal: false,
4522
+ localDir: options.cwd || process6.cwd(),
4523
+ execPath: process6.execPath,
4524
+ encoding: "utf8",
4525
+ reject: true,
4526
+ cleanup: true,
4527
+ all: false,
4528
+ windowsHide: true,
4529
+ verbose: verboseDefault,
4530
+ ...options
4531
+ };
4532
+ options.env = getEnv(options);
4533
+ options.stdio = normalizeStdio(options);
4534
+ if (process6.platform === "win32" && path3.basename(file, ".exe") === "cmd") {
4535
+ args.unshift("/q");
4536
+ }
4537
+ return { file, args, options, parsed };
4538
+ }, "handleArguments");
4539
+ var handleOutput = /* @__PURE__ */ __name((options, value, error) => {
4540
+ if (typeof value !== "string" && !Buffer3.isBuffer(value)) {
4541
+ return error === void 0 ? void 0 : "";
4542
+ }
4543
+ if (options.stripFinalNewline) {
4544
+ return stripFinalNewline(value);
4545
+ }
4546
+ return value;
4547
+ }, "handleOutput");
4548
+ function execa(file, args, options) {
4549
+ const parsed = handleArguments(file, args, options);
4550
+ const command = joinCommand(file, args);
4551
+ const escapedCommand = getEscapedCommand(file, args);
4552
+ logCommand(escapedCommand, parsed.options);
4553
+ validateTimeout(parsed.options);
4554
+ let spawned;
4555
+ try {
4556
+ spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
4557
+ } catch (error) {
4558
+ const dummySpawned = new childProcess.ChildProcess();
4559
+ const errorPromise = Promise.reject(makeError({
4560
+ error,
4561
+ stdout: "",
4562
+ stderr: "",
4563
+ all: "",
4564
+ command,
4565
+ escapedCommand,
4566
+ parsed,
4567
+ timedOut: false,
4568
+ isCanceled: false,
4569
+ killed: false
4570
+ }));
4571
+ mergePromise(dummySpawned, errorPromise);
4572
+ return dummySpawned;
4573
+ }
4574
+ const spawnedPromise = getSpawnedPromise(spawned);
4575
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
4576
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
4577
+ const context = { isCanceled: false };
4578
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
4579
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
4580
+ const handlePromise = /* @__PURE__ */ __name(async () => {
4581
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
4582
+ const stdout = handleOutput(parsed.options, stdoutResult);
4583
+ const stderr = handleOutput(parsed.options, stderrResult);
4584
+ const all = handleOutput(parsed.options, allResult);
4585
+ if (error || exitCode !== 0 || signal !== null) {
4586
+ const returnedError = makeError({
4587
+ error,
4588
+ exitCode,
4589
+ signal,
4590
+ stdout,
4591
+ stderr,
4592
+ all,
4593
+ command,
4594
+ escapedCommand,
4595
+ parsed,
4596
+ timedOut,
4597
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
4598
+ killed: spawned.killed
4599
+ });
4600
+ if (!parsed.options.reject) {
4601
+ return returnedError;
4602
+ }
4603
+ throw returnedError;
4604
+ }
4605
+ return {
4606
+ command,
4607
+ escapedCommand,
4608
+ exitCode: 0,
4609
+ stdout,
4610
+ stderr,
4611
+ all,
4612
+ failed: false,
4613
+ timedOut: false,
4614
+ isCanceled: false,
4615
+ killed: false
4616
+ };
4617
+ }, "handlePromise");
4618
+ const handlePromiseOnce = onetime_default(handlePromise);
4619
+ handleInput(spawned, parsed.options);
4620
+ spawned.all = makeAllStream(spawned, parsed.options);
4621
+ addPipeMethods(spawned);
4622
+ mergePromise(spawned, handlePromiseOnce);
4623
+ return spawned;
4624
+ }
4625
+ __name(execa, "execa");
4626
+ function execaSync(file, args, options) {
4627
+ const parsed = handleArguments(file, args, options);
4628
+ const command = joinCommand(file, args);
4629
+ const escapedCommand = getEscapedCommand(file, args);
4630
+ logCommand(escapedCommand, parsed.options);
4631
+ const input = handleInputSync(parsed.options);
4632
+ let result;
4633
+ try {
4634
+ result = childProcess.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
4635
+ } catch (error) {
4636
+ throw makeError({
4637
+ error,
4638
+ stdout: "",
4639
+ stderr: "",
4640
+ all: "",
4641
+ command,
4642
+ escapedCommand,
4643
+ parsed,
4644
+ timedOut: false,
4645
+ isCanceled: false,
4646
+ killed: false
4647
+ });
4648
+ }
4649
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
4650
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
4651
+ if (result.error || result.status !== 0 || result.signal !== null) {
4652
+ const error = makeError({
4653
+ stdout,
4654
+ stderr,
4655
+ error: result.error,
4656
+ signal: result.signal,
4657
+ exitCode: result.status,
4658
+ command,
4659
+ escapedCommand,
4660
+ parsed,
4661
+ timedOut: result.error && result.error.code === "ETIMEDOUT",
4662
+ isCanceled: false,
4663
+ killed: result.signal !== null
4664
+ });
4665
+ if (!parsed.options.reject) {
4666
+ return error;
4667
+ }
4668
+ throw error;
4669
+ }
4670
+ return {
4671
+ command,
4672
+ escapedCommand,
4673
+ exitCode: 0,
4674
+ stdout,
4675
+ stderr,
4676
+ failed: false,
4677
+ timedOut: false,
4678
+ isCanceled: false,
4679
+ killed: false
4680
+ };
4681
+ }
4682
+ __name(execaSync, "execaSync");
4683
+ var normalizeScriptStdin = /* @__PURE__ */ __name(({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {}, "normalizeScriptStdin");
4684
+ var normalizeScriptOptions = /* @__PURE__ */ __name((options = {}) => ({
4685
+ preferLocal: true,
4686
+ ...normalizeScriptStdin(options),
4687
+ ...options
4688
+ }), "normalizeScriptOptions");
4689
+ function create$(options) {
4690
+ function $2(templatesOrOptions, ...expressions) {
4691
+ if (!Array.isArray(templatesOrOptions)) {
4692
+ return create$({ ...options, ...templatesOrOptions });
4693
+ }
4694
+ const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
4695
+ return execa(file, args, normalizeScriptOptions(options));
4696
+ }
4697
+ __name($2, "$");
4698
+ $2.sync = (templates, ...expressions) => {
4699
+ if (!Array.isArray(templates)) {
4700
+ throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
4701
+ }
4702
+ const [file, ...args] = parseTemplates(templates, expressions);
4703
+ return execaSync(file, args, normalizeScriptOptions(options));
4704
+ };
4705
+ return $2;
4706
+ }
4707
+ __name(create$, "create$");
4708
+ var $ = create$();
4709
+ function execaCommand(command, options) {
4710
+ const [file, ...args] = parseCommand(command);
4711
+ return execa(file, args, options);
4712
+ }
4713
+ __name(execaCommand, "execaCommand");
4714
+ function execaCommandSync(command, options) {
4715
+ const [file, ...args] = parseCommand(command);
4716
+ return execaSync(file, args, options);
4717
+ }
4718
+ __name(execaCommandSync, "execaCommandSync");
4719
+
4720
+ export {
4721
+ NPM_LOCKFILE,
4722
+ PNPM_LOCKFILE,
4723
+ YARN_LOCKFILE,
4724
+ BUN_LOCKFILE,
4725
+ BUN_LOCKFILE_BINARY,
4726
+ getProjectRoot,
4727
+ invalidateProjectRootCache,
4728
+ findFilesUp,
4729
+ nodePathsToArray,
4730
+ normalizeStoryPath,
4731
+ loadEnvs,
4732
+ stringifyEnvs,
4733
+ stringifyProcessEnvs,
4734
+ optionalEnvToBoolean,
4735
+ isCI,
4736
+ require_cross_spawn,
4737
+ execa,
4738
+ execaSync,
4739
+ execaCommand,
4740
+ execaCommandSync
4741
+ };