devframe 0.1.19 → 0.1.21

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 (78) hide show
  1. package/README.md +2 -2
  2. package/dist/{_shared-BcPXmcjq.mjs → _shared-iZy45oG3.mjs} +2 -2
  3. package/dist/adapters/build.d.mts +3 -3
  4. package/dist/adapters/build.mjs +12 -9
  5. package/dist/adapters/cli.d.mts +1 -1
  6. package/dist/adapters/cli.mjs +2 -2
  7. package/dist/adapters/dev.d.mts +2 -2
  8. package/dist/adapters/dev.mjs +1 -1
  9. package/dist/adapters/embedded.d.mts +2 -2
  10. package/dist/adapters/embedded.mjs +1 -1
  11. package/dist/adapters/mcp.d.mts +1 -1
  12. package/dist/adapters/mcp.mjs +6 -2
  13. package/dist/adapters/vite.d.mts +5 -4
  14. package/dist/adapters/vite.mjs +4 -3
  15. package/dist/client/index.d.mts +51 -145
  16. package/dist/client/index.mjs +1664 -2
  17. package/dist/constants.d.mts +12 -15
  18. package/dist/constants.mjs +12 -29
  19. package/dist/context-BJ4r2SmR.mjs +1051 -0
  20. package/dist/context-internal-Dx_NoSv1.mjs +199 -0
  21. package/dist/context-internal-saIAfNVw.d.mts +51 -0
  22. package/dist/{dev-Djy5hbgs.mjs → dev-CdAy400a.mjs} +7 -6
  23. package/dist/{devtool-CIqONpYU.d.mts → devtool-CNvLs2_Y.d.mts} +367 -530
  24. package/dist/diagnostics-DxPnRoXO.mjs +51 -0
  25. package/dist/host-h3-9jeHcltx.mjs +24 -0
  26. package/dist/{human-id-CHS0s28X.mjs → human-id-BLoGo_e5.mjs} +0 -1
  27. package/dist/{index-BwrLhNmz.d.mts → index-CuLRIMto.d.mts} +1 -1
  28. package/dist/index.d.mts +4 -5
  29. package/dist/index.mjs +1 -4
  30. package/dist/internal/index.d.mts +16 -0
  31. package/dist/internal/index.mjs +3 -0
  32. package/dist/node/index.d.mts +45 -140
  33. package/dist/node/index.mjs +7 -6
  34. package/dist/recipes/open-helpers.d.mts +1 -1
  35. package/dist/recipes/open-helpers.mjs +3 -1
  36. package/dist/rpc/index.d.mts +2 -2
  37. package/dist/rpc/index.mjs +2 -2
  38. package/dist/rpc/transports/ws-client.d.mts +1 -1
  39. package/dist/rpc/transports/ws-client.mjs +1 -1
  40. package/dist/rpc/transports/ws-server.d.mts +1 -1
  41. package/dist/rpc/transports/ws-server.mjs +1 -1
  42. package/dist/{rpc-D7LxIh8t.mjs → rpc-INbWfHoX.mjs} +1 -1
  43. package/dist/{serialization-BN2ZQEE9.mjs → serialization-DwKi05Pn.mjs} +1 -1
  44. package/dist/{server-CaUeMcAh.d.mts → server-BAqOajx_.d.mts} +1 -1
  45. package/dist/{server-DrBxa6ZV.mjs → server-CBsxXIH5.mjs} +27 -2
  46. package/dist/{static-dump-cyGfMmRf.mjs → static-dump-D5VH8Iqk.mjs} +1 -1
  47. package/dist/types/index.d.mts +4 -4
  48. package/dist/utils/events.d.mts +1 -1
  49. package/dist/utils/human-id.mjs +1 -1
  50. package/dist/utils/shared-state.d.mts +2 -2
  51. package/dist/utils/shared-state.mjs +1 -1
  52. package/dist/utils/state.d.mts +2 -1
  53. package/dist/utils/state.mjs +1 -1
  54. package/dist/utils/streaming-channel.d.mts +2 -0
  55. package/dist/utils/streaming-channel.mjs +255 -0
  56. package/dist/utils/when.d.mts +401 -2
  57. package/dist/{ws-client-DOYwYluO.d.mts → ws-client-CjPuPFbA.d.mts} +1 -1
  58. package/dist/{ws-server-DHMeNOY_.d.mts → ws-server-C7LnhOHi.d.mts} +13 -1
  59. package/package.json +10 -21
  60. package/skills/devframe/README.md +13 -0
  61. package/skills/devframe/SKILL.md +406 -0
  62. package/skills/devframe/templates/counter-devtool.ts +24 -0
  63. package/skills/devframe/templates/spa-devtool.ts +28 -0
  64. package/skills/devframe/templates/vite-client.ts +11 -0
  65. package/dist/adapters/kit.d.mts +0 -23
  66. package/dist/adapters/kit.mjs +0 -16
  67. package/dist/client-C6w_NshP.mjs +0 -1569
  68. package/dist/context-BsNZMCnr.mjs +0 -6827
  69. package/dist/helpers/nuxt/index.d.mts +0 -46
  70. package/dist/helpers/nuxt/index.mjs +0 -58
  71. package/dist/helpers/nuxt/runtime/plugin.client.d.mts +0 -8
  72. package/dist/helpers/nuxt/runtime/plugin.client.mjs +0 -12
  73. package/dist/host-h3-w3c0t8ZO.mjs +0 -18
  74. package/dist/immer-HjMAm3b6.mjs +0 -894
  75. package/dist/main-CuGOfqoX.mjs +0 -601
  76. package/dist/when-BAE663Hv.d.mts +0 -401
  77. package/dist/{open-JfacLHs0.mjs → open-Dede_w9r.mjs} +4 -4
  78. /package/dist/{types-gWbe-b2R.d.mts → types-C5OVe4AC.d.mts} +0 -0
@@ -1,601 +0,0 @@
1
- import { createRequire } from "node:module";
2
- import { cwd } from "node:process";
3
- import { delimiter, dirname, resolve } from "node:path";
4
- import { spawn } from "node:child_process";
5
- import { pipeline } from "node:stream/promises";
6
- import { PassThrough } from "node:stream";
7
- import l from "node:readline";
8
- //#region ../../../node_modules/.pnpm/tinyexec@1.1.2/node_modules/tinyexec/dist/main.mjs
9
- var u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports);
10
- var d = /* @__PURE__ */ createRequire(import.meta.url);
11
- const f = /^path$/i;
12
- const p = {
13
- key: "PATH",
14
- value: ""
15
- };
16
- function m(e) {
17
- for (const t in e) {
18
- if (!Object.prototype.hasOwnProperty.call(e, t) || !f.test(t)) continue;
19
- const n = e[t];
20
- if (!n) return p;
21
- return {
22
- key: t,
23
- value: n
24
- };
25
- }
26
- return p;
27
- }
28
- function h(e, t) {
29
- const n = t.value.split(delimiter);
30
- const r = [];
31
- let s = e;
32
- let c;
33
- do {
34
- r.push(resolve(s, "node_modules", ".bin"));
35
- c = s;
36
- s = dirname(s);
37
- } while (s !== c);
38
- r.push(dirname(process.execPath));
39
- const l = r.concat(n).join(delimiter);
40
- return {
41
- key: t.key,
42
- value: l
43
- };
44
- }
45
- function g(e, t) {
46
- const n = {
47
- ...process.env,
48
- ...t
49
- };
50
- const r = h(e, m(n));
51
- n[r.key] = r.value;
52
- return n;
53
- }
54
- const _ = (e) => {
55
- let t = e.length;
56
- const n = new PassThrough();
57
- const r = () => {
58
- if (--t === 0) n.end();
59
- };
60
- for (const t of e) pipeline(t, n, { end: false }).then(r).catch(r);
61
- return n;
62
- };
63
- var v = /* @__PURE__ */ u(((e, t) => {
64
- t.exports = a;
65
- a.sync = o;
66
- var n = d("fs");
67
- function r(e, t) {
68
- var n = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
69
- if (!n) return true;
70
- n = n.split(";");
71
- if (n.indexOf("") !== -1) return true;
72
- for (var r = 0; r < n.length; r++) {
73
- var i = n[r].toLowerCase();
74
- if (i && e.substr(-i.length).toLowerCase() === i) return true;
75
- }
76
- return false;
77
- }
78
- function i(e, t, n) {
79
- if (!e.isSymbolicLink() && !e.isFile()) return false;
80
- return r(t, n);
81
- }
82
- function a(e, t, r) {
83
- n.stat(e, function(n, a) {
84
- r(n, n ? false : i(a, e, t));
85
- });
86
- }
87
- function o(e, t) {
88
- return i(n.statSync(e), e, t);
89
- }
90
- }));
91
- var y = /* @__PURE__ */ u(((e, t) => {
92
- t.exports = r;
93
- r.sync = i;
94
- var n = d("fs");
95
- function r(e, t, r) {
96
- n.stat(e, function(e, n) {
97
- r(e, e ? false : a(n, t));
98
- });
99
- }
100
- function i(e, t) {
101
- return a(n.statSync(e), t);
102
- }
103
- function a(e, t) {
104
- return e.isFile() && o(e, t);
105
- }
106
- function o(e, t) {
107
- var n = e.mode;
108
- var r = e.uid;
109
- var i = e.gid;
110
- var a = t.uid !== void 0 ? t.uid : process.getuid && process.getuid();
111
- var o = t.gid !== void 0 ? t.gid : process.getgid && process.getgid();
112
- var s = parseInt("100", 8);
113
- var c = parseInt("010", 8);
114
- var l = parseInt("001", 8);
115
- var u = s | c;
116
- return n & l || n & c && i === o || n & s && r === a || n & u && a === 0;
117
- }
118
- }));
119
- var b = /* @__PURE__ */ u(((e, t) => {
120
- d("fs");
121
- var n;
122
- if (process.platform === "win32" || global.TESTING_WINDOWS) n = v();
123
- else n = y();
124
- t.exports = r;
125
- r.sync = i;
126
- function r(e, t, i) {
127
- if (typeof t === "function") {
128
- i = t;
129
- t = {};
130
- }
131
- if (!i) {
132
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
133
- return new Promise(function(n, i) {
134
- r(e, t || {}, function(e, t) {
135
- if (e) i(e);
136
- else n(t);
137
- });
138
- });
139
- }
140
- n(e, t || {}, function(e, n) {
141
- if (e) {
142
- if (e.code === "EACCES" || t && t.ignoreErrors) {
143
- e = null;
144
- n = false;
145
- }
146
- }
147
- i(e, n);
148
- });
149
- }
150
- function i(e, t) {
151
- try {
152
- return n.sync(e, t || {});
153
- } catch (e) {
154
- if (t && t.ignoreErrors || e.code === "EACCES") return false;
155
- else throw e;
156
- }
157
- }
158
- }));
159
- var x = /* @__PURE__ */ u(((e, t) => {
160
- const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
161
- const r = d("path");
162
- const i = n ? ";" : ":";
163
- const a = b();
164
- const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
165
- const s = (e, t) => {
166
- const r = t.colon || i;
167
- const a = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t.path || process.env.PATH || "").split(r)];
168
- const o = n ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
169
- const s = n ? o.split(r) : [""];
170
- if (n) {
171
- if (e.indexOf(".") !== -1 && s[0] !== "") s.unshift("");
172
- }
173
- return {
174
- pathEnv: a,
175
- pathExt: s,
176
- pathExtExe: o
177
- };
178
- };
179
- const c = (e, t, n) => {
180
- if (typeof t === "function") {
181
- n = t;
182
- t = {};
183
- }
184
- if (!t) t = {};
185
- const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t);
186
- const u = [];
187
- const d = (n) => new Promise((a, s) => {
188
- if (n === i.length) return t.all && u.length ? a(u) : s(o(e));
189
- const c = i[n];
190
- const l = /^".*"$/.test(c) ? c.slice(1, -1) : c;
191
- const d = r.join(l, e);
192
- a(f(!l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d, n, 0));
193
- });
194
- const f = (e, n, r) => new Promise((i, o) => {
195
- if (r === c.length) return i(d(n + 1));
196
- const s = c[r];
197
- a(e + s, { pathExt: l }, (a, o) => {
198
- if (!a && o) if (t.all) u.push(e + s);
199
- else return i(e + s);
200
- return i(f(e, n, r + 1));
201
- });
202
- });
203
- return n ? d(0).then((e) => n(null, e), n) : d(0);
204
- };
205
- const l = (e, t) => {
206
- t = t || {};
207
- const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t);
208
- const l = [];
209
- for (let o = 0; o < n.length; o++) {
210
- const s = n[o];
211
- const u = /^".*"$/.test(s) ? s.slice(1, -1) : s;
212
- const d = r.join(u, e);
213
- const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
214
- for (let e = 0; e < i.length; e++) {
215
- const n = f + i[e];
216
- try {
217
- if (a.sync(n, { pathExt: c })) if (t.all) l.push(n);
218
- else return n;
219
- } catch (e) {}
220
- }
221
- }
222
- if (t.all && l.length) return l;
223
- if (t.nothrow) return null;
224
- throw o(e);
225
- };
226
- t.exports = c;
227
- c.sync = l;
228
- }));
229
- var S = /* @__PURE__ */ u(((e, t) => {
230
- const n = (e = {}) => {
231
- const t = e.env || process.env;
232
- if ((e.platform || process.platform) !== "win32") return "PATH";
233
- return Object.keys(t).reverse().find((e) => e.toUpperCase() === "PATH") || "Path";
234
- };
235
- t.exports = n;
236
- t.exports.default = n;
237
- }));
238
- var C = /* @__PURE__ */ u(((e, t) => {
239
- const n = d("path");
240
- const r = x();
241
- const i = S();
242
- function a(e, t) {
243
- const a = e.options.env || process.env;
244
- const o = process.cwd();
245
- const s = e.options.cwd != null;
246
- const c = s && process.chdir !== void 0 && !process.chdir.disabled;
247
- if (c) try {
248
- process.chdir(e.options.cwd);
249
- } catch (e) {}
250
- let l;
251
- try {
252
- l = r.sync(e.command, {
253
- path: a[i({ env: a })],
254
- pathExt: t ? n.delimiter : void 0
255
- });
256
- } catch (e) {} finally {
257
- if (c) process.chdir(o);
258
- }
259
- if (l) l = n.resolve(s ? e.options.cwd : "", l);
260
- return l;
261
- }
262
- function o(e) {
263
- return a(e) || a(e, true);
264
- }
265
- t.exports = o;
266
- }));
267
- var w = /* @__PURE__ */ u(((e, t) => {
268
- const n = /([()\][%!^"`<>&|;, *?])/g;
269
- function r(e) {
270
- e = e.replace(n, "^$1");
271
- return e;
272
- }
273
- function i(e, t) {
274
- e = `${e}`;
275
- e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
276
- e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
277
- e = `"${e}"`;
278
- e = e.replace(n, "^$1");
279
- if (t) e = e.replace(n, "^$1");
280
- return e;
281
- }
282
- t.exports.command = r;
283
- t.exports.argument = i;
284
- }));
285
- var T = /* @__PURE__ */ u(((e, t) => {
286
- t.exports = /^#!(.*)/;
287
- }));
288
- var E = /* @__PURE__ */ u(((e, t) => {
289
- const n = T();
290
- t.exports = (e = "") => {
291
- const t = e.match(n);
292
- if (!t) return null;
293
- const [r, i] = t[0].replace(/#! ?/, "").split(" ");
294
- const a = r.split("/").pop();
295
- if (a === "env") return i;
296
- return i ? `${a} ${i}` : a;
297
- };
298
- }));
299
- var D = /* @__PURE__ */ u(((e, t) => {
300
- const n = d("fs");
301
- const r = E();
302
- function i(e) {
303
- const t = 150;
304
- const i = Buffer.alloc(t);
305
- let a;
306
- try {
307
- a = n.openSync(e, "r");
308
- n.readSync(a, i, 0, t, 0);
309
- n.closeSync(a);
310
- } catch (e) {}
311
- return r(i.toString());
312
- }
313
- t.exports = i;
314
- }));
315
- var O = /* @__PURE__ */ u(((e, t) => {
316
- const n = d("path");
317
- const r = C();
318
- const i = w();
319
- const a = D();
320
- const o = process.platform === "win32";
321
- const s = /\.(?:com|exe)$/i;
322
- const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
323
- function l(e) {
324
- e.file = r(e);
325
- const t = e.file && a(e.file);
326
- if (t) {
327
- e.args.unshift(e.file);
328
- e.command = t;
329
- return r(e);
330
- }
331
- return e.file;
332
- }
333
- function u(e) {
334
- if (!o) return e;
335
- const t = l(e);
336
- const r = !s.test(t);
337
- if (e.options.forceShell || r) {
338
- const r = c.test(t);
339
- e.command = n.normalize(e.command);
340
- e.command = i.command(e.command);
341
- e.args = e.args.map((e) => i.argument(e, r));
342
- e.args = [
343
- "/d",
344
- "/s",
345
- "/c",
346
- `"${[e.command].concat(e.args).join(" ")}"`
347
- ];
348
- e.command = process.env.comspec || "cmd.exe";
349
- e.options.windowsVerbatimArguments = true;
350
- }
351
- return e;
352
- }
353
- function f(e, t, n) {
354
- if (t && !Array.isArray(t)) {
355
- n = t;
356
- t = null;
357
- }
358
- t = t ? t.slice(0) : [];
359
- n = Object.assign({}, n);
360
- const r = {
361
- command: e,
362
- args: t,
363
- options: n,
364
- file: void 0,
365
- original: {
366
- command: e,
367
- args: t
368
- }
369
- };
370
- return n.shell ? r : u(r);
371
- }
372
- t.exports = f;
373
- }));
374
- var k = /* @__PURE__ */ u(((e, t) => {
375
- const n = process.platform === "win32";
376
- function r(e, t) {
377
- return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
378
- code: "ENOENT",
379
- errno: "ENOENT",
380
- syscall: `${t} ${e.command}`,
381
- path: e.command,
382
- spawnargs: e.args
383
- });
384
- }
385
- function i(e, t) {
386
- if (!n) return;
387
- const r = e.emit;
388
- e.emit = function(n, i) {
389
- if (n === "exit") {
390
- const n = a(i, t);
391
- if (n) return r.call(e, "error", n);
392
- }
393
- return r.apply(e, arguments);
394
- };
395
- }
396
- function a(e, t) {
397
- if (n && e === 1 && !t.file) return r(t.original, "spawn");
398
- return null;
399
- }
400
- function o(e, t) {
401
- if (n && e === 1 && !t.file) return r(t.original, "spawnSync");
402
- return null;
403
- }
404
- t.exports = {
405
- hookChildProcess: i,
406
- verifyENOENT: a,
407
- verifyENOENTSync: o,
408
- notFoundError: r
409
- };
410
- }));
411
- var j = (/* @__PURE__ */ u(((e, t) => {
412
- const n = d("child_process");
413
- const r = O();
414
- const i = k();
415
- function a(e, t, a) {
416
- const o = r(e, t, a);
417
- const s = n.spawn(o.command, o.args, o.options);
418
- i.hookChildProcess(s, o);
419
- return s;
420
- }
421
- function o(e, t, a) {
422
- const o = r(e, t, a);
423
- const s = n.spawnSync(o.command, o.args, o.options);
424
- s.error = s.error || i.verifyENOENTSync(s.status, o);
425
- return s;
426
- }
427
- t.exports = a;
428
- t.exports.spawn = a;
429
- t.exports.sync = o;
430
- t.exports._parse = r;
431
- t.exports._enoent = i;
432
- })))();
433
- var M = class extends Error {
434
- get exitCode() {
435
- if (this.result.exitCode !== null) return this.result.exitCode;
436
- }
437
- constructor(e, t) {
438
- super(`Process exited with non-zero status (${e.exitCode})`);
439
- this.result = e;
440
- this.output = t;
441
- }
442
- };
443
- const P = {
444
- timeout: void 0,
445
- persist: false
446
- };
447
- const I = { windowsHide: true };
448
- function L(e) {
449
- const t = new AbortController();
450
- for (const n of e) {
451
- if (n.aborted) {
452
- t.abort();
453
- return n;
454
- }
455
- const e = () => {
456
- t.abort(n.reason);
457
- };
458
- n.addEventListener("abort", e, { signal: t.signal });
459
- }
460
- return t.signal;
461
- }
462
- async function R(e) {
463
- let t = "";
464
- try {
465
- for await (const n of e) t += n.toString();
466
- } catch {}
467
- return t;
468
- }
469
- var z = class {
470
- _process;
471
- _aborted = false;
472
- _options;
473
- _command;
474
- _args;
475
- _resolveClose;
476
- _processClosed;
477
- _thrownError;
478
- get process() {
479
- return this._process;
480
- }
481
- get pid() {
482
- return this._process?.pid;
483
- }
484
- get exitCode() {
485
- if (this._process && this._process.exitCode !== null) return this._process.exitCode;
486
- }
487
- constructor(e, t, n) {
488
- this._options = {
489
- ...P,
490
- ...n
491
- };
492
- this._command = e;
493
- this._args = t ?? [];
494
- this._processClosed = new Promise((e) => {
495
- this._resolveClose = e;
496
- });
497
- }
498
- kill(e) {
499
- return this._process?.kill(e) === true;
500
- }
501
- get aborted() {
502
- return this._aborted;
503
- }
504
- get killed() {
505
- return this._process?.killed === true;
506
- }
507
- pipe(e, t, n) {
508
- return H(e, t, {
509
- ...n,
510
- stdin: this
511
- });
512
- }
513
- async *[Symbol.asyncIterator]() {
514
- const e = this._process;
515
- if (!e) return;
516
- const t = [];
517
- if (this._streamErr) t.push(this._streamErr);
518
- if (this._streamOut) t.push(this._streamOut);
519
- const n = _(t);
520
- const r = l.createInterface({ input: n });
521
- for await (const e of r) yield e.toString();
522
- await this._processClosed;
523
- e.removeAllListeners();
524
- if (this._thrownError) throw this._thrownError;
525
- if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new M(this);
526
- }
527
- async _waitForOutput() {
528
- const e = this._process;
529
- if (!e) throw new Error("No process was started");
530
- const [t, n] = await Promise.all([this._streamOut ? R(this._streamOut) : "", this._streamErr ? R(this._streamErr) : ""]);
531
- await this._processClosed;
532
- const { stdin: r } = this._options;
533
- if (r && typeof r !== "string") await r;
534
- e.removeAllListeners();
535
- if (this._thrownError) throw this._thrownError;
536
- const i = {
537
- stderr: n,
538
- stdout: t,
539
- exitCode: this.exitCode
540
- };
541
- if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new M(this, i);
542
- return i;
543
- }
544
- then(e, t) {
545
- return this._waitForOutput().then(e, t);
546
- }
547
- _streamOut;
548
- _streamErr;
549
- spawn() {
550
- const e = cwd();
551
- const n = this._options;
552
- const i = {
553
- ...I,
554
- ...n.nodeOptions
555
- };
556
- const a = [];
557
- this._resetState();
558
- if (n.timeout !== void 0) a.push(AbortSignal.timeout(n.timeout));
559
- if (n.signal !== void 0) a.push(n.signal);
560
- if (n.persist === true) i.detached = true;
561
- if (a.length > 0) i.signal = L(a);
562
- i.env = g(e, i.env);
563
- const o = (0, j._parse)(this._command, this._args, i);
564
- const s = spawn(o.command, o.args, o.options);
565
- if (s.stderr) this._streamErr = s.stderr;
566
- if (s.stdout) this._streamOut = s.stdout;
567
- this._process = s;
568
- s.once("error", this._onError);
569
- s.once("close", this._onClose);
570
- if (s.stdin) {
571
- const { stdin: e } = n;
572
- if (typeof e === "string") s.stdin.end(e);
573
- else e?.process?.stdout?.pipe(s.stdin);
574
- }
575
- }
576
- _resetState() {
577
- this._aborted = false;
578
- this._processClosed = new Promise((e) => {
579
- this._resolveClose = e;
580
- });
581
- this._thrownError = void 0;
582
- }
583
- _onError = (e) => {
584
- if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
585
- this._aborted = true;
586
- return;
587
- }
588
- this._thrownError = e;
589
- };
590
- _onClose = () => {
591
- if (this._resolveClose) this._resolveClose();
592
- };
593
- };
594
- const V = (e, t, n) => {
595
- const r = new z(e, t, n);
596
- r.spawn();
597
- return r;
598
- };
599
- const H = V;
600
- //#endregion
601
- export { H as exec };