@drmhse/authos-vue 0.2.4 → 0.2.5

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.
@@ -0,0 +1,700 @@
1
+ import { __exportAll } from './chunk-VVJVQ4JO.mjs';
2
+ import { createRequire } from 'module';
3
+ import { existsSync } from 'fs';
4
+ import { readFile } from 'fs/promises';
5
+ import { PassThrough } from 'stream';
6
+ import { spawn } from 'child_process';
7
+ import { normalize, delimiter, resolve, dirname } from 'path';
8
+ import { cwd } from 'process';
9
+ import d from 'readline';
10
+
11
+ var f = /^[A-Za-z]:\//;
12
+ function p(e = ``) {
13
+ return e && e.replace(/\\/g, `/`).replace(f, (e2) => e2.toUpperCase());
14
+ }
15
+ var ee = /^[/\\]{2}/;
16
+ var te = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
17
+ var m = /^[A-Za-z]:$/;
18
+ var h = /^\/([A-Za-z]:)?$/;
19
+ var g = function(e) {
20
+ if (e.length === 0) return `.`;
21
+ e = p(e);
22
+ let t2 = e.match(ee), n2 = x(e), r2 = e[e.length - 1] === `/`;
23
+ return e = b(e, !n2), e.length === 0 ? n2 ? `/` : r2 ? `./` : `.` : (r2 && (e += `/`), m.test(e) && (e += `/`), t2 ? n2 ? `//${e}` : `//./${e}` : n2 && !x(e) ? `/${e}` : e);
24
+ };
25
+ var _ = function(...e) {
26
+ let t2 = ``;
27
+ for (let n2 of e) if (n2) if (t2.length > 0) {
28
+ let e2 = t2[t2.length - 1] === `/`, r2 = n2[0] === `/`;
29
+ e2 && r2 ? t2 += n2.slice(1) : t2 += e2 || r2 ? n2 : `/${n2}`;
30
+ } else t2 += n2;
31
+ return g(t2);
32
+ };
33
+ function v() {
34
+ return typeof process < `u` && typeof process.cwd == `function` ? process.cwd().replace(/\\/g, `/`) : `/`;
35
+ }
36
+ var y = function(...e) {
37
+ e = e.map((e2) => p(e2));
38
+ let t2 = ``, n2 = false;
39
+ for (let r2 = e.length - 1; r2 >= -1 && !n2; r2--) {
40
+ let i2 = r2 >= 0 ? e[r2] : v();
41
+ !i2 || i2.length === 0 || (t2 = `${i2}/${t2}`, n2 = x(i2));
42
+ }
43
+ return t2 = b(t2, !n2), n2 && !x(t2) ? `/${t2}` : t2.length > 0 ? t2 : `.`;
44
+ };
45
+ function b(e, t2) {
46
+ let n2 = ``, r2 = 0, i2 = -1, a2 = 0, o2 = null;
47
+ for (let s2 = 0; s2 <= e.length; ++s2) {
48
+ if (s2 < e.length) o2 = e[s2];
49
+ else if (o2 === `/`) break;
50
+ else o2 = `/`;
51
+ if (o2 === `/`) {
52
+ if (!(i2 === s2 - 1 || a2 === 1)) if (a2 === 2) {
53
+ if (n2.length < 2 || r2 !== 2 || n2[n2.length - 1] !== `.` || n2[n2.length - 2] !== `.`) {
54
+ if (n2.length > 2) {
55
+ let e2 = n2.lastIndexOf(`/`);
56
+ e2 === -1 ? (n2 = ``, r2 = 0) : (n2 = n2.slice(0, e2), r2 = n2.length - 1 - n2.lastIndexOf(`/`)), i2 = s2, a2 = 0;
57
+ continue;
58
+ } else if (n2.length > 0) {
59
+ n2 = ``, r2 = 0, i2 = s2, a2 = 0;
60
+ continue;
61
+ }
62
+ }
63
+ t2 && (n2 += n2.length > 0 ? `/..` : `..`, r2 = 2);
64
+ } else n2.length > 0 ? n2 += `/${e.slice(i2 + 1, s2)}` : n2 = e.slice(i2 + 1, s2), r2 = s2 - i2 - 1;
65
+ i2 = s2, a2 = 0;
66
+ } else o2 === `.` && a2 !== -1 ? ++a2 : a2 = -1;
67
+ }
68
+ return n2;
69
+ }
70
+ var x = function(e) {
71
+ return te.test(e);
72
+ };
73
+ var S = function(e, t2) {
74
+ let n2 = y(e).replace(h, `$1`).split(`/`), r2 = y(t2).replace(h, `$1`).split(`/`);
75
+ if (r2[0][1] === `:` && n2[0][1] === `:` && n2[0] !== r2[0]) return r2.join(`/`);
76
+ let i2 = [...n2];
77
+ for (let e2 of i2) {
78
+ if (r2[0] !== e2) break;
79
+ n2.shift(), r2.shift();
80
+ }
81
+ return [...n2.map(() => `..`), ...r2].join(`/`);
82
+ };
83
+ var C = function(e) {
84
+ let t2 = p(e).replace(/\/$/, ``).split(`/`).slice(0, -1);
85
+ return t2.length === 1 && m.test(t2[0]) && (t2[0] += `/`), t2.join(`/`) || (x(e) ? `/` : `.`);
86
+ };
87
+ var ne = function(e, t2) {
88
+ let n2 = p(e).split(`/`), r2 = ``;
89
+ for (let e2 = n2.length - 1; e2 >= 0; e2--) {
90
+ let t3 = n2[e2];
91
+ if (t3) {
92
+ r2 = t3;
93
+ break;
94
+ }
95
+ }
96
+ return t2 && r2.endsWith(t2) ? r2.slice(0, -t2.length) : r2;
97
+ };
98
+ globalThis.process?.platform;
99
+ var w = (e, t2) => () => (t2 || e((t2 = { exports: {} }).exports, t2), t2.exports);
100
+ var T = createRequire(import.meta.url);
101
+ var re = /^path$/i;
102
+ var E = {
103
+ key: `PATH`,
104
+ value: ``
105
+ };
106
+ function D(e) {
107
+ for (let t2 in e) {
108
+ if (!Object.prototype.hasOwnProperty.call(e, t2) || !re.test(t2)) continue;
109
+ let n2 = e[t2];
110
+ return n2 ? {
111
+ key: t2,
112
+ value: n2
113
+ } : E;
114
+ }
115
+ return E;
116
+ }
117
+ function O(e, t2) {
118
+ let n2 = t2.value.split(delimiter), r2 = [], i2 = e, a2;
119
+ do
120
+ r2.push(resolve(i2, `node_modules`, `.bin`)), a2 = i2, i2 = dirname(i2);
121
+ while (i2 !== a2);
122
+ let c2 = r2.concat(n2).join(delimiter);
123
+ return {
124
+ key: t2.key,
125
+ value: c2
126
+ };
127
+ }
128
+ function k(e, t2) {
129
+ let n2 = {
130
+ ...process.env,
131
+ ...t2
132
+ }, r2 = O(e, D(n2));
133
+ return n2[r2.key] = r2.value, n2;
134
+ }
135
+ var A = (e) => {
136
+ let t2 = e.length, n2 = new PassThrough(), r2 = () => {
137
+ --t2 === 0 && n2.emit(`end`);
138
+ };
139
+ for (let t3 of e) t3.pipe(n2, { end: false }), t3.on(`end`, r2);
140
+ return n2;
141
+ };
142
+ var j = w(((e, t2) => {
143
+ t2.exports = a2, a2.sync = o2;
144
+ var n2 = T(`fs`);
145
+ function r2(e2, t3) {
146
+ var n3 = t3.pathExt === void 0 ? process.env.PATHEXT : t3.pathExt;
147
+ if (!n3 || (n3 = n3.split(`;`), n3.indexOf(``) !== -1)) return true;
148
+ for (var r3 = 0; r3 < n3.length; r3++) {
149
+ var i3 = n3[r3].toLowerCase();
150
+ if (i3 && e2.substr(-i3.length).toLowerCase() === i3) return true;
151
+ }
152
+ return false;
153
+ }
154
+ function i2(e2, t3, n3) {
155
+ return !e2.isSymbolicLink() && !e2.isFile() ? false : r2(t3, n3);
156
+ }
157
+ function a2(e2, t3, r3) {
158
+ n2.stat(e2, function(n3, a3) {
159
+ r3(n3, n3 ? false : i2(a3, e2, t3));
160
+ });
161
+ }
162
+ function o2(e2, t3) {
163
+ return i2(n2.statSync(e2), e2, t3);
164
+ }
165
+ }));
166
+ var M = w(((e, t2) => {
167
+ t2.exports = r2, r2.sync = i2;
168
+ var n2 = T(`fs`);
169
+ function r2(e2, t3, r3) {
170
+ n2.stat(e2, function(e3, n3) {
171
+ r3(e3, e3 ? false : a2(n3, t3));
172
+ });
173
+ }
174
+ function i2(e2, t3) {
175
+ return a2(n2.statSync(e2), t3);
176
+ }
177
+ function a2(e2, t3) {
178
+ return e2.isFile() && o2(e2, t3);
179
+ }
180
+ function o2(e2, t3) {
181
+ var n3 = e2.mode, r3 = e2.uid, i3 = e2.gid, a3 = t3.uid === void 0 ? process.getuid && process.getuid() : t3.uid, o3 = t3.gid === void 0 ? process.getgid && process.getgid() : t3.gid, s2 = 64, c2 = 8, l2 = 1, u2 = s2 | c2;
182
+ return n3 & l2 || n3 & c2 && i3 === o3 || n3 & s2 && r3 === a3 || n3 & u2 && a3 === 0;
183
+ }
184
+ }));
185
+ var N = w(((e, t2) => {
186
+ T(`fs`);
187
+ var n2 = process.platform === `win32` || global.TESTING_WINDOWS ? j() : M();
188
+ t2.exports = r2, r2.sync = i2;
189
+ function r2(e2, t3, i3) {
190
+ if (typeof t3 == `function` && (i3 = t3, t3 = {}), !i3) {
191
+ if (typeof Promise != `function`) throw TypeError(`callback not provided`);
192
+ return new Promise(function(n3, i4) {
193
+ r2(e2, t3 || {}, function(e3, t4) {
194
+ e3 ? i4(e3) : n3(t4);
195
+ });
196
+ });
197
+ }
198
+ n2(e2, t3 || {}, function(e3, n3) {
199
+ e3 && (e3.code === `EACCES` || t3 && t3.ignoreErrors) && (e3 = null, n3 = false), i3(e3, n3);
200
+ });
201
+ }
202
+ function i2(e2, t3) {
203
+ try {
204
+ return n2.sync(e2, t3 || {});
205
+ } catch (e3) {
206
+ if (t3 && t3.ignoreErrors || e3.code === `EACCES`) return false;
207
+ throw e3;
208
+ }
209
+ }
210
+ }));
211
+ var P = w(((e, t2) => {
212
+ let n2 = process.platform === `win32` || process.env.OSTYPE === `cygwin` || process.env.OSTYPE === `msys`, r2 = T(`path`), i2 = n2 ? `;` : `:`, a2 = N(), o2 = (e2) => Object.assign(Error(`not found: ${e2}`), { code: `ENOENT` }), s2 = (e2, t3) => {
213
+ let r3 = t3.colon || i2, a3 = e2.match(/\//) || n2 && e2.match(/\\/) ? [``] : [...n2 ? [process.cwd()] : [], ...(t3.path || process.env.PATH || ``).split(r3)], o3 = n2 ? t3.pathExt || process.env.PATHEXT || `.EXE;.CMD;.BAT;.COM` : ``, s3 = n2 ? o3.split(r3) : [``];
214
+ return n2 && e2.indexOf(`.`) !== -1 && s3[0] !== `` && s3.unshift(``), {
215
+ pathEnv: a3,
216
+ pathExt: s3,
217
+ pathExtExe: o3
218
+ };
219
+ }, c2 = (e2, t3, n3) => {
220
+ typeof t3 == `function` && (n3 = t3, t3 = {}), t3 ||= {};
221
+ let { pathEnv: i3, pathExt: c3, pathExtExe: l2 } = s2(e2, t3), u2 = [], d2 = (n4) => new Promise((a3, s3) => {
222
+ if (n4 === i3.length) return t3.all && u2.length ? a3(u2) : s3(o2(e2));
223
+ let c4 = i3[n4], l3 = /^".*"$/.test(c4) ? c4.slice(1, -1) : c4, d3 = r2.join(l3, e2);
224
+ a3(f2(!l3 && /^\.[\\\/]/.test(e2) ? e2.slice(0, 2) + d3 : d3, n4, 0));
225
+ }), f2 = (e3, n4, r3) => new Promise((i4, o3) => {
226
+ if (r3 === c3.length) return i4(d2(n4 + 1));
227
+ let s3 = c3[r3];
228
+ a2(e3 + s3, { pathExt: l2 }, (a3, o4) => {
229
+ if (!a3 && o4) if (t3.all) u2.push(e3 + s3);
230
+ else return i4(e3 + s3);
231
+ return i4(f2(e3, n4, r3 + 1));
232
+ });
233
+ });
234
+ return n3 ? d2(0).then((e3) => n3(null, e3), n3) : d2(0);
235
+ };
236
+ t2.exports = c2, c2.sync = (e2, t3) => {
237
+ t3 ||= {};
238
+ let { pathEnv: n3, pathExt: i3, pathExtExe: c3 } = s2(e2, t3), l2 = [];
239
+ for (let o3 = 0; o3 < n3.length; o3++) {
240
+ let s3 = n3[o3], u2 = /^".*"$/.test(s3) ? s3.slice(1, -1) : s3, d2 = r2.join(u2, e2), f2 = !u2 && /^\.[\\\/]/.test(e2) ? e2.slice(0, 2) + d2 : d2;
241
+ for (let e3 = 0; e3 < i3.length; e3++) {
242
+ let n4 = f2 + i3[e3];
243
+ try {
244
+ if (a2.sync(n4, { pathExt: c3 })) if (t3.all) l2.push(n4);
245
+ else return n4;
246
+ } catch {
247
+ }
248
+ }
249
+ }
250
+ if (t3.all && l2.length) return l2;
251
+ if (t3.nothrow) return null;
252
+ throw o2(e2);
253
+ };
254
+ }));
255
+ var F = w(((e, t2) => {
256
+ let n2 = (e2 = {}) => {
257
+ let t3 = e2.env || process.env;
258
+ return (e2.platform || process.platform) === `win32` ? Object.keys(t3).reverse().find((e3) => e3.toUpperCase() === `PATH`) || `Path` : `PATH`;
259
+ };
260
+ t2.exports = n2, t2.exports.default = n2;
261
+ }));
262
+ var I = w(((e, t2) => {
263
+ let n2 = T(`path`), r2 = P(), i2 = F();
264
+ function a2(e2, t3) {
265
+ let a3 = e2.options.env || process.env, o3 = process.cwd(), s2 = e2.options.cwd != null, c2 = s2 && process.chdir !== void 0 && !process.chdir.disabled;
266
+ if (c2) try {
267
+ process.chdir(e2.options.cwd);
268
+ } catch {
269
+ }
270
+ let l2;
271
+ try {
272
+ l2 = r2.sync(e2.command, {
273
+ path: a3[i2({ env: a3 })],
274
+ pathExt: t3 ? n2.delimiter : void 0
275
+ });
276
+ } catch {
277
+ } finally {
278
+ c2 && process.chdir(o3);
279
+ }
280
+ return l2 &&= n2.resolve(s2 ? e2.options.cwd : ``, l2), l2;
281
+ }
282
+ function o2(e2) {
283
+ return a2(e2) || a2(e2, true);
284
+ }
285
+ t2.exports = o2;
286
+ }));
287
+ var L = w(((e, t2) => {
288
+ let n2 = /([()\][%!^"`<>&|;, *?])/g;
289
+ function r2(e2) {
290
+ return e2 = e2.replace(n2, `^$1`), e2;
291
+ }
292
+ function i2(e2, t3) {
293
+ return e2 = `${e2}`, e2 = e2.replace(/(?=(\\+?)?)\1"/g, `$1$1\\"`), e2 = e2.replace(/(?=(\\+?)?)\1$/, `$1$1`), e2 = `"${e2}"`, e2 = e2.replace(n2, `^$1`), t3 && (e2 = e2.replace(n2, `^$1`)), e2;
294
+ }
295
+ t2.exports.command = r2, t2.exports.argument = i2;
296
+ }));
297
+ var R = w(((e, t2) => {
298
+ t2.exports = /^#!(.*)/;
299
+ }));
300
+ var z = w(((e, t2) => {
301
+ let n2 = R();
302
+ t2.exports = (e2 = ``) => {
303
+ let t3 = e2.match(n2);
304
+ if (!t3) return null;
305
+ let [r2, i2] = t3[0].replace(/#! ?/, ``).split(` `), a2 = r2.split(`/`).pop();
306
+ return a2 === `env` ? i2 : i2 ? `${a2} ${i2}` : a2;
307
+ };
308
+ }));
309
+ var B = w(((e, t2) => {
310
+ let n2 = T(`fs`), r2 = z();
311
+ function i2(e2) {
312
+ let t3 = Buffer.alloc(150), i3;
313
+ try {
314
+ i3 = n2.openSync(e2, `r`), n2.readSync(i3, t3, 0, 150, 0), n2.closeSync(i3);
315
+ } catch {
316
+ }
317
+ return r2(t3.toString());
318
+ }
319
+ t2.exports = i2;
320
+ }));
321
+ var V = w(((e, t2) => {
322
+ let n2 = T(`path`), r2 = I(), i2 = L(), a2 = B(), o2 = process.platform === `win32`, s2 = /\.(?:com|exe)$/i, c2 = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
323
+ function l2(e2) {
324
+ e2.file = r2(e2);
325
+ let t3 = e2.file && a2(e2.file);
326
+ return t3 ? (e2.args.unshift(e2.file), e2.command = t3, r2(e2)) : e2.file;
327
+ }
328
+ function u2(e2) {
329
+ if (!o2) return e2;
330
+ let t3 = l2(e2), r3 = !s2.test(t3);
331
+ if (e2.options.forceShell || r3) {
332
+ let r4 = c2.test(t3);
333
+ e2.command = n2.normalize(e2.command), e2.command = i2.command(e2.command), e2.args = e2.args.map((e3) => i2.argument(e3, r4)), e2.args = [
334
+ `/d`,
335
+ `/s`,
336
+ `/c`,
337
+ `"${[e2.command].concat(e2.args).join(` `)}"`
338
+ ], e2.command = process.env.comspec || `cmd.exe`, e2.options.windowsVerbatimArguments = true;
339
+ }
340
+ return e2;
341
+ }
342
+ function d2(e2, t3, n3) {
343
+ t3 && !Array.isArray(t3) && (n3 = t3, t3 = null), t3 = t3 ? t3.slice(0) : [], n3 = Object.assign({}, n3);
344
+ let r3 = {
345
+ command: e2,
346
+ args: t3,
347
+ options: n3,
348
+ file: void 0,
349
+ original: {
350
+ command: e2,
351
+ args: t3
352
+ }
353
+ };
354
+ return n3.shell ? r3 : u2(r3);
355
+ }
356
+ t2.exports = d2;
357
+ }));
358
+ var ie = w(((e, t2) => {
359
+ let n2 = process.platform === `win32`;
360
+ function r2(e2, t3) {
361
+ return Object.assign(Error(`${t3} ${e2.command} ENOENT`), {
362
+ code: `ENOENT`,
363
+ errno: `ENOENT`,
364
+ syscall: `${t3} ${e2.command}`,
365
+ path: e2.command,
366
+ spawnargs: e2.args
367
+ });
368
+ }
369
+ function i2(e2, t3) {
370
+ if (!n2) return;
371
+ let r3 = e2.emit;
372
+ e2.emit = function(n3, i3) {
373
+ if (n3 === `exit`) {
374
+ let n4 = a2(i3, t3);
375
+ if (n4) return r3.call(e2, `error`, n4);
376
+ }
377
+ return r3.apply(e2, arguments);
378
+ };
379
+ }
380
+ function a2(e2, t3) {
381
+ return n2 && e2 === 1 && !t3.file ? r2(t3.original, `spawn`) : null;
382
+ }
383
+ function o2(e2, t3) {
384
+ return n2 && e2 === 1 && !t3.file ? r2(t3.original, `spawnSync`) : null;
385
+ }
386
+ t2.exports = {
387
+ hookChildProcess: i2,
388
+ verifyENOENT: a2,
389
+ verifyENOENTSync: o2,
390
+ notFoundError: r2
391
+ };
392
+ }));
393
+ var H = w(((e, t2) => {
394
+ let n2 = T(`child_process`), r2 = V(), i2 = ie();
395
+ function a2(e2, t3, a3) {
396
+ let o3 = r2(e2, t3, a3), s2 = n2.spawn(o3.command, o3.args, o3.options);
397
+ return i2.hookChildProcess(s2, o3), s2;
398
+ }
399
+ function o2(e2, t3, a3) {
400
+ let o3 = r2(e2, t3, a3), s2 = n2.spawnSync(o3.command, o3.args, o3.options);
401
+ return s2.error = s2.error || i2.verifyENOENTSync(s2.status, o3), s2;
402
+ }
403
+ t2.exports = a2, t2.exports.spawn = a2, t2.exports.sync = o2, t2.exports._parse = r2, t2.exports._enoent = i2;
404
+ }))();
405
+ var U = class extends Error {
406
+ result;
407
+ output;
408
+ get exitCode() {
409
+ if (this.result.exitCode !== null) return this.result.exitCode;
410
+ }
411
+ constructor(e, t2) {
412
+ super(`Process exited with non-zero status (${e.exitCode})`), this.result = e, this.output = t2;
413
+ }
414
+ };
415
+ var W = {
416
+ timeout: void 0,
417
+ persist: false
418
+ };
419
+ var G = { windowsHide: true };
420
+ function K(e, t2) {
421
+ return {
422
+ command: normalize(e),
423
+ args: t2 ?? []
424
+ };
425
+ }
426
+ function q(e) {
427
+ let t2 = new AbortController();
428
+ for (let n2 of e) {
429
+ if (n2.aborted) return t2.abort(), n2;
430
+ n2.addEventListener(`abort`, () => {
431
+ t2.abort(n2.reason);
432
+ }, { signal: t2.signal });
433
+ }
434
+ return t2.signal;
435
+ }
436
+ async function J(e) {
437
+ let t2 = ``;
438
+ for await (let n2 of e) t2 += n2.toString();
439
+ return t2;
440
+ }
441
+ var Y = class {
442
+ _process;
443
+ _aborted = false;
444
+ _options;
445
+ _command;
446
+ _args;
447
+ _resolveClose;
448
+ _processClosed;
449
+ _thrownError;
450
+ get process() {
451
+ return this._process;
452
+ }
453
+ get pid() {
454
+ return this._process?.pid;
455
+ }
456
+ get exitCode() {
457
+ if (this._process && this._process.exitCode !== null) return this._process.exitCode;
458
+ }
459
+ constructor(e, t2, n2) {
460
+ this._options = {
461
+ ...W,
462
+ ...n2
463
+ }, this._command = e, this._args = t2 ?? [], this._processClosed = new Promise((e2) => {
464
+ this._resolveClose = e2;
465
+ });
466
+ }
467
+ kill(e) {
468
+ return this._process?.kill(e) === true;
469
+ }
470
+ get aborted() {
471
+ return this._aborted;
472
+ }
473
+ get killed() {
474
+ return this._process?.killed === true;
475
+ }
476
+ pipe(e, t2, n2) {
477
+ return ae(e, t2, {
478
+ ...n2,
479
+ stdin: this
480
+ });
481
+ }
482
+ async *[Symbol.asyncIterator]() {
483
+ let e = this._process;
484
+ if (!e) return;
485
+ let t2 = [];
486
+ this._streamErr && t2.push(this._streamErr), this._streamOut && t2.push(this._streamOut);
487
+ let n2 = A(t2), r2 = d.createInterface({ input: n2 });
488
+ for await (let e2 of r2) yield e2.toString();
489
+ if (await this._processClosed, e.removeAllListeners(), this._thrownError) throw this._thrownError;
490
+ if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new U(this);
491
+ }
492
+ async _waitForOutput() {
493
+ let e = this._process;
494
+ if (!e) throw Error(`No process was started`);
495
+ let [t2, n2] = await Promise.all([this._streamOut ? J(this._streamOut) : ``, this._streamErr ? J(this._streamErr) : ``]);
496
+ if (await this._processClosed, this._options?.stdin && await this._options.stdin, e.removeAllListeners(), this._thrownError) throw this._thrownError;
497
+ let r2 = {
498
+ stderr: n2,
499
+ stdout: t2,
500
+ exitCode: this.exitCode
501
+ };
502
+ if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new U(this, r2);
503
+ return r2;
504
+ }
505
+ then(e, t2) {
506
+ return this._waitForOutput().then(e, t2);
507
+ }
508
+ _streamOut;
509
+ _streamErr;
510
+ spawn() {
511
+ let e = cwd(), t2 = this._options, n2 = {
512
+ ...G,
513
+ ...t2.nodeOptions
514
+ }, r2 = [];
515
+ this._resetState(), t2.timeout !== void 0 && r2.push(AbortSignal.timeout(t2.timeout)), t2.signal !== void 0 && r2.push(t2.signal), t2.persist === true && (n2.detached = true), r2.length > 0 && (n2.signal = q(r2)), n2.env = k(e, n2.env);
516
+ let { command: i2, args: o2 } = K(this._command, this._args), s2 = (0, H._parse)(i2, o2, n2), c2 = spawn(s2.command, s2.args, s2.options);
517
+ if (c2.stderr && (this._streamErr = c2.stderr), c2.stdout && (this._streamOut = c2.stdout), this._process = c2, c2.once(`error`, this._onError), c2.once(`close`, this._onClose), t2.stdin !== void 0 && c2.stdin && t2.stdin.process) {
518
+ let { stdout: e2 } = t2.stdin.process;
519
+ e2 && e2.pipe(c2.stdin);
520
+ }
521
+ }
522
+ _resetState() {
523
+ this._aborted = false, this._processClosed = new Promise((e) => {
524
+ this._resolveClose = e;
525
+ }), this._thrownError = void 0;
526
+ }
527
+ _onError = (e) => {
528
+ if (e.name === `AbortError` && (!(e.cause instanceof Error) || e.cause.name !== `TimeoutError`)) {
529
+ this._aborted = true;
530
+ return;
531
+ }
532
+ this._thrownError = e;
533
+ };
534
+ _onClose = () => {
535
+ this._resolveClose && this._resolveClose();
536
+ };
537
+ };
538
+ var X = (e, t2, n2) => {
539
+ let r2 = new Y(e, t2, n2);
540
+ return r2.spawn(), r2;
541
+ };
542
+ var ae = X;
543
+ var oe = __exportAll({
544
+ detectPackageManager: () => $,
545
+ installDependencies: () => fe,
546
+ packageManagers: () => Q
547
+ });
548
+ async function se(e, t2, n2 = {}) {
549
+ let r2 = g(e).split(`/`);
550
+ for (; r2.length > 0; ) {
551
+ let e2 = await t2(r2.join(`/`) || `/`);
552
+ if (e2 || !n2.includeParentDirs) return e2;
553
+ r2.pop();
554
+ }
555
+ }
556
+ function ce(e) {
557
+ let t2;
558
+ return () => (t2 === void 0 && (t2 = e().then((e2) => (t2 = e2, t2))), t2);
559
+ }
560
+ var Z = ce(async () => {
561
+ if (globalThis.process?.versions?.webcontainer) return false;
562
+ try {
563
+ let { exitCode: e } = await X(`corepack`, [`--version`]);
564
+ return e === 0;
565
+ } catch {
566
+ return false;
567
+ }
568
+ });
569
+ async function le(e, t2, n2 = {}) {
570
+ let r2 = e !== `npm` && e !== `bun` && e !== `deno` && n2.corepack !== false && await Z() ? [`corepack`, [e, ...t2]] : [e, t2], { exitCode: i2, stdout: a2, stderr: o2 } = await X(r2[0], r2[1], { nodeOptions: {
571
+ cwd: y(n2.cwd || process.cwd()),
572
+ env: n2.env,
573
+ stdio: n2.silent ? `pipe` : `inherit`
574
+ } });
575
+ if (i2 !== 0) throw Error(`\`${r2.flat().join(` `)}\` failed.${n2.silent ? [
576
+ ``,
577
+ a2,
578
+ o2
579
+ ].join(`
580
+ `) : ``}`);
581
+ }
582
+ async function ue(e = {}) {
583
+ let t2 = e.cwd || process.cwd(), n2 = {
584
+ ...process.env,
585
+ ...e.env
586
+ }, r2 = (typeof e.packageManager == `string` ? Q.find((t3) => t3.name === e.packageManager) : e.packageManager) || await $(e.cwd || process.cwd());
587
+ if (!r2) throw Error(`No package manager auto-detected.`);
588
+ return {
589
+ cwd: t2,
590
+ env: n2,
591
+ silent: e.silent ?? false,
592
+ packageManager: r2,
593
+ dev: e.dev ?? false,
594
+ workspace: e.workspace,
595
+ global: e.global ?? false,
596
+ dry: e.dry ?? false,
597
+ corepack: e.corepack ?? true
598
+ };
599
+ }
600
+ function de(e) {
601
+ let [t2, n2] = (e || ``).split(`@`), [r2, i2] = n2?.split(`+`) || [];
602
+ if (t2 && t2 !== `-` && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(t2)) return {
603
+ name: t2,
604
+ version: r2,
605
+ buildMeta: i2
606
+ };
607
+ let a2 = (t2 || ``).replace(/\W+/g, ``);
608
+ return {
609
+ name: a2,
610
+ version: r2,
611
+ buildMeta: i2,
612
+ warnings: [`Abnormal characters found in \`packageManager\` field, sanitizing from \`${t2}\` to \`${a2}\``]
613
+ };
614
+ }
615
+ var Q = [
616
+ {
617
+ name: `npm`,
618
+ command: `npm`,
619
+ lockFile: `package-lock.json`
620
+ },
621
+ {
622
+ name: `pnpm`,
623
+ command: `pnpm`,
624
+ lockFile: `pnpm-lock.yaml`,
625
+ files: [`pnpm-workspace.yaml`]
626
+ },
627
+ {
628
+ name: `bun`,
629
+ command: `bun`,
630
+ lockFile: [`bun.lockb`, `bun.lock`]
631
+ },
632
+ {
633
+ name: `yarn`,
634
+ command: `yarn`,
635
+ lockFile: `yarn.lock`,
636
+ files: [`.yarnrc.yml`]
637
+ },
638
+ {
639
+ name: `deno`,
640
+ command: `deno`,
641
+ lockFile: `deno.lock`,
642
+ files: [`deno.json`]
643
+ }
644
+ ];
645
+ async function $(e, t2 = {}) {
646
+ let i2 = await se(y(e || `.`), async (e2) => {
647
+ if (!t2.ignorePackageJSON) {
648
+ let t3 = _(e2, `package.json`);
649
+ if (existsSync(t3)) {
650
+ let e3 = JSON.parse(await readFile(t3, `utf8`));
651
+ if (e3?.packageManager) {
652
+ let { name: t4, version: n2 = `0.0.0`, buildMeta: r2, warnings: i3 } = de(e3.packageManager);
653
+ if (t4) {
654
+ let e4 = n2.split(`.`)[0], a2 = Q.find((n3) => n3.name === t4 && n3.majorVersion === e4) || Q.find((e5) => e5.name === t4);
655
+ return {
656
+ name: t4,
657
+ command: t4,
658
+ version: n2,
659
+ majorVersion: e4,
660
+ buildMeta: r2,
661
+ warnings: i3,
662
+ files: a2?.files,
663
+ lockFile: a2?.lockFile
664
+ };
665
+ }
666
+ }
667
+ }
668
+ if (existsSync(_(e2, `deno.json`))) return Q.find((e3) => e3.name === `deno`);
669
+ }
670
+ if (!t2.ignoreLockFile) {
671
+ for (let t3 of Q) if ([t3.lockFile, t3.files].flat().filter(Boolean).some((t4) => existsSync(y(e2, t4)))) return { ...t3 };
672
+ }
673
+ }, { includeParentDirs: t2.includeParentDirs ?? true });
674
+ if (!i2 && !t2.ignoreArgv) {
675
+ let e2 = process.argv[1];
676
+ if (e2) {
677
+ for (let t3 of Q) if (RegExp(`[/\\\\]\\.?${t3.command}`).test(e2)) return t3;
678
+ }
679
+ }
680
+ return i2;
681
+ }
682
+ async function fe(e = {}) {
683
+ let t2 = await ue(e), n2 = e.frozenLockFile ? {
684
+ npm: [`ci`],
685
+ yarn: [`install`, `--immutable`],
686
+ bun: [`install`, `--frozen-lockfile`],
687
+ pnpm: [`install`, `--frozen-lockfile`],
688
+ deno: [`install`, `--frozen`]
689
+ }[t2.packageManager.name] : [`install`];
690
+ return e.ignoreWorkspace && t2.packageManager.name === `pnpm` && n2.push(`--ignore-workspace`), t2.dry || await le(t2.packageManager.command, n2, {
691
+ cwd: t2.cwd,
692
+ silent: t2.silent,
693
+ corepack: t2.corepack
694
+ }), { exec: {
695
+ command: t2.packageManager.command,
696
+ args: n2
697
+ } };
698
+ }
699
+
700
+ export { C, S, ne, oe, y };