nitro-nightly 3.0.1-20260106-182834-5019d347 → 3.0.1-20260106-205209-b085a480

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 (85) hide show
  1. package/dist/_build/common.mjs +24899 -0
  2. package/dist/_build/rolldown.mjs +5 -18
  3. package/dist/_build/rollup.mjs +5 -52
  4. package/dist/_build/vite.build.mjs +2 -21
  5. package/dist/{_dev.mjs → _chunks/dev.mjs} +4 -7
  6. package/dist/{_nitro.mjs → _chunks/nitro.mjs} +16 -195
  7. package/dist/_chunks/nitro2.mjs +101 -0
  8. package/dist/_chunks/utils.mjs +278 -0
  9. package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +32 -4
  10. package/dist/_libs/@jridgewell/gen-mapping.mjs +304 -2
  11. package/dist/_libs/@jridgewell/remapping.mjs +1 -2
  12. package/dist/_libs/@rollup/plugin-commonjs.mjs +75 -31
  13. package/dist/_libs/@rollup/plugin-inject.mjs +1 -3
  14. package/dist/_libs/@rollup/plugin-json.mjs +1 -1
  15. package/dist/_libs/@rollup/plugin-node-resolve.mjs +1111 -7
  16. package/dist/_libs/c12.mjs +597 -41
  17. package/dist/_libs/chokidar.mjs +235 -2
  18. package/dist/_libs/confbox.mjs +454 -1476
  19. package/dist/_libs/estree-walker.mjs +1 -144
  20. package/dist/_libs/giget.mjs +2235 -1377
  21. package/dist/_libs/httpxy.mjs +1 -1
  22. package/dist/_libs/unimport.mjs +1547 -1772
  23. package/dist/_presets.mjs +3 -9
  24. package/dist/builder.mjs +7 -12
  25. package/dist/cli/_chunks/build.mjs +1 -1
  26. package/dist/cli/_chunks/dev.mjs +3 -5
  27. package/dist/cli/_chunks/list.mjs +1 -1
  28. package/dist/cli/_chunks/prepare.mjs +1 -1
  29. package/dist/cli/_chunks/run.mjs +1 -1
  30. package/dist/types/index.d.mts +4 -4
  31. package/dist/vite.mjs +14 -1128
  32. package/package.json +2 -2
  33. package/dist/_build/shared.mjs +0 -60
  34. package/dist/_build/shared2.mjs +0 -40
  35. package/dist/_build/shared3.mjs +0 -68
  36. package/dist/_libs/@jridgewell/resolve-uri.mjs +0 -166
  37. package/dist/_libs/@jridgewell/sourcemap-codec.mjs +0 -167
  38. package/dist/_libs/@jridgewell/trace-mapping.mjs +0 -141
  39. package/dist/_libs/@rolldown/pluginutils.mjs +0 -31
  40. package/dist/_libs/@rollup/plugin-replace.mjs +0 -104
  41. package/dist/_libs/@rollup/pluginutils.mjs +0 -241
  42. package/dist/_libs/acorn.mjs +0 -5034
  43. package/dist/_libs/commondir.mjs +0 -22
  44. package/dist/_libs/deepmerge.mjs +0 -86
  45. package/dist/_libs/dot-prop.mjs +0 -138
  46. package/dist/_libs/dotenv.mjs +0 -345
  47. package/dist/_libs/duplexer.mjs +0 -71
  48. package/dist/_libs/etag.mjs +0 -80
  49. package/dist/_libs/exsolve.mjs +0 -1007
  50. package/dist/_libs/fdir.mjs +0 -514
  51. package/dist/_libs/function-bind.mjs +0 -63
  52. package/dist/_libs/gzip-size.mjs +0 -21
  53. package/dist/_libs/hasown.mjs +0 -14
  54. package/dist/_libs/is-core-module.mjs +0 -220
  55. package/dist/_libs/is-module.mjs +0 -13
  56. package/dist/_libs/is-reference.mjs +0 -33
  57. package/dist/_libs/js-tokens.mjs +0 -382
  58. package/dist/_libs/knitwork.mjs +0 -124
  59. package/dist/_libs/local-pkg.mjs +0 -125
  60. package/dist/_libs/magic-string.mjs +0 -939
  61. package/dist/_libs/mime.mjs +0 -1391
  62. package/dist/_libs/mlly.mjs +0 -1415
  63. package/dist/_libs/node-fetch-native.mjs +0 -7
  64. package/dist/_libs/nypm.mjs +0 -239
  65. package/dist/_libs/path-parse.mjs +0 -47
  66. package/dist/_libs/pathe.mjs +0 -202
  67. package/dist/_libs/perfect-debounce.mjs +0 -89
  68. package/dist/_libs/picomatch.mjs +0 -1673
  69. package/dist/_libs/pkg-types.mjs +0 -197
  70. package/dist/_libs/pretty-bytes.mjs +0 -116
  71. package/dist/_libs/quansync.mjs +0 -90
  72. package/dist/_libs/rc9.mjs +0 -136
  73. package/dist/_libs/readdirp.mjs +0 -237
  74. package/dist/_libs/resolve.mjs +0 -689
  75. package/dist/_libs/std-env.mjs +0 -158
  76. package/dist/_libs/strip-literal.mjs +0 -51
  77. package/dist/_libs/tinyexec.mjs +0 -627
  78. package/dist/_libs/tinyglobby.mjs +0 -292
  79. package/dist/_libs/unplugin-utils.mjs +0 -61
  80. package/dist/_libs/unplugin.mjs +0 -1225
  81. package/dist/_libs/untyped.mjs +0 -271
  82. package/dist/_libs/unwasm.mjs +0 -5895
  83. package/dist/_libs/webpack-virtual-modules.mjs +0 -272
  84. package/dist/_nitro2.mjs +0 -303
  85. /package/dist/{_rolldown.mjs → _common.mjs} +0 -0
@@ -1,627 +0,0 @@
1
- import { delimiter, dirname, normalize, resolve } from "node:path";
2
- import { cwd } from "node:process";
3
- import { createRequire } from "module";
4
- import { PassThrough } from "node:stream";
5
- import { spawn } from "node:child_process";
6
- import c from "node:readline";
7
-
8
- //#region node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.js
9
- var l = Object.create;
10
- var u = Object.defineProperty;
11
- var d = Object.getOwnPropertyDescriptor;
12
- var f = Object.getOwnPropertyNames;
13
- var p = Object.getPrototypeOf;
14
- var m = Object.prototype.hasOwnProperty;
15
- var h = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
16
- var g = (e, t, n, r) => {
17
- if (t && typeof t === "object" || typeof t === "function") for (var i = f(t), a = 0, o = i.length, s; a < o; a++) {
18
- s = i[a];
19
- if (!m.call(e, s) && s !== n) u(e, s, {
20
- get: ((e$1) => t[e$1]).bind(null, s),
21
- enumerable: !(r = d(t, s)) || r.enumerable
22
- });
23
- }
24
- return e;
25
- };
26
- var _ = (e, t, n) => (n = e != null ? l(p(e)) : {}, g(t || !e || !e.__esModule ? u(n, "default", {
27
- value: e,
28
- enumerable: true
29
- }) : n, e));
30
- var v = /* @__PURE__ */ createRequire(import.meta.url);
31
- const y = /^path$/i;
32
- const b = {
33
- key: "PATH",
34
- value: ""
35
- };
36
- function x(e) {
37
- for (const t in e) {
38
- if (!Object.prototype.hasOwnProperty.call(e, t) || !y.test(t)) continue;
39
- const n = e[t];
40
- if (!n) return b;
41
- return {
42
- key: t,
43
- value: n
44
- };
45
- }
46
- return b;
47
- }
48
- function S(e, t) {
49
- const i = t.value.split(delimiter);
50
- let o = e;
51
- let s;
52
- do {
53
- i.push(resolve(o, "node_modules", ".bin"));
54
- s = o;
55
- o = dirname(o);
56
- } while (o !== s);
57
- return {
58
- key: t.key,
59
- value: i.join(delimiter)
60
- };
61
- }
62
- function C(e, t) {
63
- const n = {
64
- ...process.env,
65
- ...t
66
- };
67
- const r = S(e, x(n));
68
- n[r.key] = r.value;
69
- return n;
70
- }
71
- const w = (e) => {
72
- let t = e.length;
73
- const n = new PassThrough();
74
- const r = () => {
75
- if (--t === 0) n.emit("end");
76
- };
77
- for (const t$1 of e) {
78
- t$1.pipe(n, { end: false });
79
- t$1.on("end", r);
80
- }
81
- return n;
82
- };
83
- var T = h((exports, t) => {
84
- t.exports = a;
85
- a.sync = o;
86
- var n = v("fs");
87
- function r(e, t$1) {
88
- var n$1 = t$1.pathExt !== void 0 ? t$1.pathExt : process.env.PATHEXT;
89
- if (!n$1) return true;
90
- n$1 = n$1.split(";");
91
- if (n$1.indexOf("") !== -1) return true;
92
- for (var r$1 = 0; r$1 < n$1.length; r$1++) {
93
- var i$1 = n$1[r$1].toLowerCase();
94
- if (i$1 && e.substr(-i$1.length).toLowerCase() === i$1) return true;
95
- }
96
- return false;
97
- }
98
- function i(e, t$1, n$1) {
99
- if (!e.isSymbolicLink() && !e.isFile()) return false;
100
- return r(t$1, n$1);
101
- }
102
- function a(e, t$1, r$1) {
103
- n.stat(e, function(n$1, a$1) {
104
- r$1(n$1, n$1 ? false : i(a$1, e, t$1));
105
- });
106
- }
107
- function o(e, t$1) {
108
- return i(n.statSync(e), e, t$1);
109
- }
110
- });
111
- var E = h((exports, t) => {
112
- t.exports = r;
113
- r.sync = i;
114
- var n = v("fs");
115
- function r(e, t$1, r$1) {
116
- n.stat(e, function(e$1, n$1) {
117
- r$1(e$1, e$1 ? false : a(n$1, t$1));
118
- });
119
- }
120
- function i(e, t$1) {
121
- return a(n.statSync(e), t$1);
122
- }
123
- function a(e, t$1) {
124
- return e.isFile() && o(e, t$1);
125
- }
126
- function o(e, t$1) {
127
- var n$1 = e.mode;
128
- var r$1 = e.uid;
129
- var i$1 = e.gid;
130
- var a$1 = t$1.uid !== void 0 ? t$1.uid : process.getuid && process.getuid();
131
- var o$1 = t$1.gid !== void 0 ? t$1.gid : process.getgid && process.getgid();
132
- var s = parseInt("100", 8);
133
- var c$1 = parseInt("010", 8);
134
- var l$1 = parseInt("001", 8);
135
- var u$1 = s | c$1;
136
- return n$1 & l$1 || n$1 & c$1 && i$1 === o$1 || n$1 & s && r$1 === a$1 || n$1 & u$1 && a$1 === 0;
137
- }
138
- });
139
- var D = h((exports, t) => {
140
- v("fs");
141
- var r;
142
- if (process.platform === "win32" || global.TESTING_WINDOWS) r = T();
143
- else r = E();
144
- t.exports = i;
145
- i.sync = a;
146
- function i(e, t$1, n) {
147
- if (typeof t$1 === "function") {
148
- n = t$1;
149
- t$1 = {};
150
- }
151
- if (!n) {
152
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
153
- return new Promise(function(n$1, r$1) {
154
- i(e, t$1 || {}, function(e$1, t$2) {
155
- if (e$1) r$1(e$1);
156
- else n$1(t$2);
157
- });
158
- });
159
- }
160
- r(e, t$1 || {}, function(e$1, r$1) {
161
- if (e$1) {
162
- if (e$1.code === "EACCES" || t$1 && t$1.ignoreErrors) {
163
- e$1 = null;
164
- r$1 = false;
165
- }
166
- }
167
- n(e$1, r$1);
168
- });
169
- }
170
- function a(e, t$1) {
171
- try {
172
- return r.sync(e, t$1 || {});
173
- } catch (e$1) {
174
- if (t$1 && t$1.ignoreErrors || e$1.code === "EACCES") return false;
175
- else throw e$1;
176
- }
177
- }
178
- });
179
- var O = h((exports, t) => {
180
- const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
181
- const r = v("path");
182
- const i = n ? ";" : ":";
183
- const a = D();
184
- const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
185
- const s = (e, t$1) => {
186
- const r$1 = t$1.colon || i;
187
- const a$1 = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t$1.path || process.env.PATH || "").split(r$1)];
188
- const o$1 = n ? t$1.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
189
- const s$1 = n ? o$1.split(r$1) : [""];
190
- if (n) {
191
- if (e.indexOf(".") !== -1 && s$1[0] !== "") s$1.unshift("");
192
- }
193
- return {
194
- pathEnv: a$1,
195
- pathExt: s$1,
196
- pathExtExe: o$1
197
- };
198
- };
199
- const c$1 = (e, t$1, n$1) => {
200
- if (typeof t$1 === "function") {
201
- n$1 = t$1;
202
- t$1 = {};
203
- }
204
- if (!t$1) t$1 = {};
205
- const { pathEnv: i$1, pathExt: c$2, pathExtExe: l$2 } = s(e, t$1);
206
- const u$1 = [];
207
- const d$1 = (n$2) => new Promise((a$1, s$1) => {
208
- if (n$2 === i$1.length) return t$1.all && u$1.length ? a$1(u$1) : s$1(o(e));
209
- const c$3 = i$1[n$2];
210
- const l$3 = /^".*"$/.test(c$3) ? c$3.slice(1, -1) : c$3;
211
- const d$2 = r.join(l$3, e);
212
- a$1(f$1(!l$3 && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d$2 : d$2, n$2, 0));
213
- });
214
- const f$1 = (e$1, n$2, r$1) => new Promise((i$2, o$1) => {
215
- if (r$1 === c$2.length) return i$2(d$1(n$2 + 1));
216
- const s$1 = c$2[r$1];
217
- a(e$1 + s$1, { pathExt: l$2 }, (a$1, o$2) => {
218
- if (!a$1 && o$2) if (t$1.all) u$1.push(e$1 + s$1);
219
- else return i$2(e$1 + s$1);
220
- return i$2(f$1(e$1, n$2, r$1 + 1));
221
- });
222
- });
223
- return n$1 ? d$1(0).then((e$1) => n$1(null, e$1), n$1) : d$1(0);
224
- };
225
- const l$1 = (e, t$1) => {
226
- t$1 = t$1 || {};
227
- const { pathEnv: n$1, pathExt: i$1, pathExtExe: c$2 } = s(e, t$1);
228
- const l$2 = [];
229
- for (let o$1 = 0; o$1 < n$1.length; o$1++) {
230
- const s$1 = n$1[o$1];
231
- const u$1 = /^".*"$/.test(s$1) ? s$1.slice(1, -1) : s$1;
232
- const d$1 = r.join(u$1, e);
233
- const f$1 = !u$1 && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d$1 : d$1;
234
- for (let e$1 = 0; e$1 < i$1.length; e$1++) {
235
- const n$2 = f$1 + i$1[e$1];
236
- try {
237
- if (a.sync(n$2, { pathExt: c$2 })) if (t$1.all) l$2.push(n$2);
238
- else return n$2;
239
- } catch (e$2) {}
240
- }
241
- }
242
- if (t$1.all && l$2.length) return l$2;
243
- if (t$1.nothrow) return null;
244
- throw o(e);
245
- };
246
- t.exports = c$1;
247
- c$1.sync = l$1;
248
- });
249
- var k = h((exports, t) => {
250
- const n = (e = {}) => {
251
- const t$1 = e.env || process.env;
252
- if ((e.platform || process.platform) !== "win32") return "PATH";
253
- return Object.keys(t$1).reverse().find((e$1) => e$1.toUpperCase() === "PATH") || "Path";
254
- };
255
- t.exports = n;
256
- t.exports.default = n;
257
- });
258
- var A = h((exports, t) => {
259
- const n = v("path");
260
- const r = O();
261
- const i = k();
262
- function a(e, t$1) {
263
- const a$1 = e.options.env || process.env;
264
- const o$1 = process.cwd();
265
- const s = e.options.cwd != null;
266
- const c$1 = s && process.chdir !== void 0 && !process.chdir.disabled;
267
- if (c$1) try {
268
- process.chdir(e.options.cwd);
269
- } catch (e$1) {}
270
- let l$1;
271
- try {
272
- l$1 = r.sync(e.command, {
273
- path: a$1[i({ env: a$1 })],
274
- pathExt: t$1 ? n.delimiter : void 0
275
- });
276
- } catch (e$1) {} finally {
277
- if (c$1) process.chdir(o$1);
278
- }
279
- if (l$1) l$1 = n.resolve(s ? e.options.cwd : "", l$1);
280
- return l$1;
281
- }
282
- function o(e) {
283
- return a(e) || a(e, true);
284
- }
285
- t.exports = o;
286
- });
287
- var j = h((exports, t) => {
288
- const n = /([()\][%!^"`<>&|;, *?])/g;
289
- function r(e) {
290
- e = e.replace(n, "^$1");
291
- return e;
292
- }
293
- function i(e, t$1) {
294
- e = `${e}`;
295
- e = e.replace(/(\\*)"/g, "$1$1\\\"");
296
- e = e.replace(/(\\*)$/, "$1$1");
297
- e = `"${e}"`;
298
- e = e.replace(n, "^$1");
299
- if (t$1) e = e.replace(n, "^$1");
300
- return e;
301
- }
302
- t.exports.command = r;
303
- t.exports.argument = i;
304
- });
305
- var M = h((exports, t) => {
306
- t.exports = /^#!(.*)/;
307
- });
308
- var N = h((exports, t) => {
309
- const n = M();
310
- t.exports = (e = "") => {
311
- const t$1 = e.match(n);
312
- if (!t$1) return null;
313
- const [r, i] = t$1[0].replace(/#! ?/, "").split(" ");
314
- const a = r.split("/").pop();
315
- if (a === "env") return i;
316
- return i ? `${a} ${i}` : a;
317
- };
318
- });
319
- var P = h((exports, t) => {
320
- const n = v("fs");
321
- const r = N();
322
- function i(e) {
323
- const t$1 = 150;
324
- const i$1 = Buffer.alloc(t$1);
325
- let a;
326
- try {
327
- a = n.openSync(e, "r");
328
- n.readSync(a, i$1, 0, t$1, 0);
329
- n.closeSync(a);
330
- } catch (e$1) {}
331
- return r(i$1.toString());
332
- }
333
- t.exports = i;
334
- });
335
- var F = h((exports, t) => {
336
- const n = v("path");
337
- const r = A();
338
- const i = j();
339
- const a = P();
340
- const o = process.platform === "win32";
341
- const s = /\.(?:com|exe)$/i;
342
- const c$1 = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
343
- function l$1(e) {
344
- e.file = r(e);
345
- const t$1 = e.file && a(e.file);
346
- if (t$1) {
347
- e.args.unshift(e.file);
348
- e.command = t$1;
349
- return r(e);
350
- }
351
- return e.file;
352
- }
353
- function u$1(e) {
354
- if (!o) return e;
355
- const t$1 = l$1(e);
356
- const r$1 = !s.test(t$1);
357
- if (e.options.forceShell || r$1) {
358
- const r$2 = c$1.test(t$1);
359
- e.command = n.normalize(e.command);
360
- e.command = i.command(e.command);
361
- e.args = e.args.map((e$1) => i.argument(e$1, r$2));
362
- e.args = [
363
- "/d",
364
- "/s",
365
- "/c",
366
- `"${[e.command].concat(e.args).join(" ")}"`
367
- ];
368
- e.command = process.env.comspec || "cmd.exe";
369
- e.options.windowsVerbatimArguments = true;
370
- }
371
- return e;
372
- }
373
- function d$1(e, t$1, n$1) {
374
- if (t$1 && !Array.isArray(t$1)) {
375
- n$1 = t$1;
376
- t$1 = null;
377
- }
378
- t$1 = t$1 ? t$1.slice(0) : [];
379
- n$1 = Object.assign({}, n$1);
380
- const r$1 = {
381
- command: e,
382
- args: t$1,
383
- options: n$1,
384
- file: void 0,
385
- original: {
386
- command: e,
387
- args: t$1
388
- }
389
- };
390
- return n$1.shell ? r$1 : u$1(r$1);
391
- }
392
- t.exports = d$1;
393
- });
394
- var I = h((exports, t) => {
395
- const n = process.platform === "win32";
396
- function r(e, t$1) {
397
- return Object.assign(/* @__PURE__ */ new Error(`${t$1} ${e.command} ENOENT`), {
398
- code: "ENOENT",
399
- errno: "ENOENT",
400
- syscall: `${t$1} ${e.command}`,
401
- path: e.command,
402
- spawnargs: e.args
403
- });
404
- }
405
- function i(e, t$1) {
406
- if (!n) return;
407
- const r$1 = e.emit;
408
- e.emit = function(n$1, i$1) {
409
- if (n$1 === "exit") {
410
- const n$2 = a(i$1, t$1, "spawn");
411
- if (n$2) return r$1.call(e, "error", n$2);
412
- }
413
- return r$1.apply(e, arguments);
414
- };
415
- }
416
- function a(e, t$1) {
417
- if (n && e === 1 && !t$1.file) return r(t$1.original, "spawn");
418
- return null;
419
- }
420
- function o(e, t$1) {
421
- if (n && e === 1 && !t$1.file) return r(t$1.original, "spawnSync");
422
- return null;
423
- }
424
- t.exports = {
425
- hookChildProcess: i,
426
- verifyENOENT: a,
427
- verifyENOENTSync: o,
428
- notFoundError: r
429
- };
430
- });
431
- var R = _(h((exports, t) => {
432
- const n = v("child_process");
433
- const r = F();
434
- const i = I();
435
- function a(e, t$1, a$1) {
436
- const o$1 = r(e, t$1, a$1);
437
- const s = n.spawn(o$1.command, o$1.args, o$1.options);
438
- i.hookChildProcess(s, o$1);
439
- return s;
440
- }
441
- function o(e, t$1, a$1) {
442
- const o$1 = r(e, t$1, a$1);
443
- const s = n.spawnSync(o$1.command, o$1.args, o$1.options);
444
- s.error = s.error || i.verifyENOENTSync(s.status, o$1);
445
- return s;
446
- }
447
- t.exports = a;
448
- t.exports.spawn = a;
449
- t.exports.sync = o;
450
- t.exports._parse = r;
451
- t.exports._enoent = i;
452
- })(), 1);
453
- var z = class extends Error {
454
- result;
455
- output;
456
- get exitCode() {
457
- if (this.result.exitCode !== null) return this.result.exitCode;
458
- }
459
- constructor(e, t) {
460
- super(`Process exited with non-zero status (${e.exitCode})`);
461
- this.result = e;
462
- this.output = t;
463
- }
464
- };
465
- const B = {
466
- timeout: void 0,
467
- persist: false
468
- };
469
- const V = { windowsHide: true };
470
- function H(e, t) {
471
- return {
472
- command: normalize(e),
473
- args: t ?? []
474
- };
475
- }
476
- function U(e) {
477
- const t = new AbortController();
478
- for (const n of e) {
479
- if (n.aborted) {
480
- t.abort();
481
- return n;
482
- }
483
- const e$1 = () => {
484
- t.abort(n.reason);
485
- };
486
- n.addEventListener("abort", e$1, { signal: t.signal });
487
- }
488
- return t.signal;
489
- }
490
- async function W(e) {
491
- let t = "";
492
- for await (const n of e) t += n.toString();
493
- return t;
494
- }
495
- var G = class {
496
- _process;
497
- _aborted = false;
498
- _options;
499
- _command;
500
- _args;
501
- _resolveClose;
502
- _processClosed;
503
- _thrownError;
504
- get process() {
505
- return this._process;
506
- }
507
- get pid() {
508
- return this._process?.pid;
509
- }
510
- get exitCode() {
511
- if (this._process && this._process.exitCode !== null) return this._process.exitCode;
512
- }
513
- constructor(e, t, n) {
514
- this._options = {
515
- ...B,
516
- ...n
517
- };
518
- this._command = e;
519
- this._args = t ?? [];
520
- this._processClosed = new Promise((e$1) => {
521
- this._resolveClose = e$1;
522
- });
523
- }
524
- kill(e) {
525
- return this._process?.kill(e) === true;
526
- }
527
- get aborted() {
528
- return this._aborted;
529
- }
530
- get killed() {
531
- return this._process?.killed === true;
532
- }
533
- pipe(e, t, n) {
534
- return q(e, t, {
535
- ...n,
536
- stdin: this
537
- });
538
- }
539
- async *[Symbol.asyncIterator]() {
540
- const e = this._process;
541
- if (!e) return;
542
- const t = [];
543
- if (this._streamErr) t.push(this._streamErr);
544
- if (this._streamOut) t.push(this._streamOut);
545
- const n = w(t);
546
- const r = c.createInterface({ input: n });
547
- for await (const e$1 of r) yield e$1.toString();
548
- await this._processClosed;
549
- e.removeAllListeners();
550
- if (this._thrownError) throw this._thrownError;
551
- if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this);
552
- }
553
- async _waitForOutput() {
554
- const e = this._process;
555
- if (!e) throw new Error("No process was started");
556
- const [t, n] = await Promise.all([this._streamOut ? W(this._streamOut) : "", this._streamErr ? W(this._streamErr) : ""]);
557
- await this._processClosed;
558
- if (this._options?.stdin) await this._options.stdin;
559
- e.removeAllListeners();
560
- if (this._thrownError) throw this._thrownError;
561
- const r = {
562
- stderr: n,
563
- stdout: t,
564
- exitCode: this.exitCode
565
- };
566
- if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this, r);
567
- return r;
568
- }
569
- then(e, t) {
570
- return this._waitForOutput().then(e, t);
571
- }
572
- _streamOut;
573
- _streamErr;
574
- spawn() {
575
- const e = cwd();
576
- const n = this._options;
577
- const r = {
578
- ...V,
579
- ...n.nodeOptions
580
- };
581
- const i = [];
582
- this._resetState();
583
- if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
584
- if (n.signal !== void 0) i.push(n.signal);
585
- if (n.persist === true) r.detached = true;
586
- if (i.length > 0) r.signal = U(i);
587
- r.env = C(e, r.env);
588
- const { command: a, args: s } = H(this._command, this._args);
589
- const c$1 = (0, R._parse)(a, s, r);
590
- const l$1 = spawn(c$1.command, c$1.args, c$1.options);
591
- if (l$1.stderr) this._streamErr = l$1.stderr;
592
- if (l$1.stdout) this._streamOut = l$1.stdout;
593
- this._process = l$1;
594
- l$1.once("error", this._onError);
595
- l$1.once("close", this._onClose);
596
- if (n.stdin !== void 0 && l$1.stdin && n.stdin.process) {
597
- const { stdout: e$1 } = n.stdin.process;
598
- if (e$1) e$1.pipe(l$1.stdin);
599
- }
600
- }
601
- _resetState() {
602
- this._aborted = false;
603
- this._processClosed = new Promise((e) => {
604
- this._resolveClose = e;
605
- });
606
- this._thrownError = void 0;
607
- }
608
- _onError = (e) => {
609
- if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
610
- this._aborted = true;
611
- return;
612
- }
613
- this._thrownError = e;
614
- };
615
- _onClose = () => {
616
- if (this._resolveClose) this._resolveClose();
617
- };
618
- };
619
- const K = (e, t, n) => {
620
- const r = new G(e, t, n);
621
- r.spawn();
622
- return r;
623
- };
624
- const q = K;
625
-
626
- //#endregion
627
- export { K as t };