@goodbyenjn/utils 26.1.3 → 26.1.4

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.
@@ -1,4 +1,4 @@
1
- import { Dr as t, F as isFunction, Fn as e$6, Nn as e$4, On as e, P as isPromiseLike, Pn as e$3, Sn as e$2, Tn as e$8, bn as e$7, gn as e$1, hn as e$5 } from "./chunk-267b337b.js";
1
+ import { Dr as t, F as isFunction, Fn as e$6, Nn as e$4, On as e, P as isPromiseLike, Pn as e$3, Sn as e$2, Tn as e$8, bn as e$7, gn as e$1, hn as e$5 } from "./chunk-b970a8d0.js";
2
2
 
3
3
  //#region rolldown:runtime
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- import { jn as NonEmptyTuple, ri as AsyncFn, si as SyncFn } from "./chunk-a07ed28f.js";
1
+ import { jn as NonEmptyTuple, ri as AsyncFn, si as SyncFn } from "./chunk-566a516c.js";
2
2
 
3
3
  //#region src/result/error.d.ts
4
4
  declare class ResultError extends Error {
package/dist/common.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as Result } from "./chunks/chunk-4b76d1c4.js";
2
- import { ai as Fn, ri as AsyncFn } from "./chunks/chunk-a07ed28f.js";
1
+ import { i as Result } from "./chunks/chunk-f11577d4.js";
2
+ import { ai as Fn, ri as AsyncFn } from "./chunks/chunk-566a516c.js";
3
3
 
4
4
  //#region src/common/error.d.ts
5
5
  declare const normalizeError: (error: unknown, caller?: Function) => Error;
package/dist/common.js CHANGED
@@ -1,3 +1,3 @@
1
- import { C as linear, D as safeParse, E as normalizeError, O as stringify, S as parseValueToBoolean, T as getErrorMessage, _ as createLock, a as concatTemplateStrings, b as sleep, c as joinWithSlash, d as split, f as splitByLineBreak, g as unindent, h as toForwardSlash, i as addSuffix, k as unsafeParse, l as removePrefix, m as template, n as throttle, o as indent, p as splitWithSlash, r as addPrefix, s as join, t as debounce, u as removeSuffix, v as createPromiseWithResolvers, w as scale, x as parseKeyValuePairs, y as createSingleton } from "./chunks/chunk-fda806f4.js";
1
+ import { C as linear, D as safeParse, E as normalizeError, O as stringify, S as parseValueToBoolean, T as getErrorMessage, _ as createLock, a as concatTemplateStrings, b as sleep, c as joinWithSlash, d as split, f as splitByLineBreak, g as unindent, h as toForwardSlash, i as addSuffix, k as unsafeParse, l as removePrefix, m as template, n as throttle, o as indent, p as splitWithSlash, r as addPrefix, s as join, t as debounce, u as removeSuffix, v as createPromiseWithResolvers, w as scale, x as parseKeyValuePairs, y as createSingleton } from "./chunks/chunk-af8ca15e.js";
2
2
 
3
3
  export { addPrefix, addSuffix, concatTemplateStrings, createLock, createPromiseWithResolvers, createSingleton, debounce, getErrorMessage, indent, join, joinWithSlash, linear, normalizeError, unsafeParse as parse, parseKeyValuePairs, parseValueToBoolean, removePrefix, removeSuffix, safeParse, scale, sleep, split, splitByLineBreak, splitWithSlash, stringify, template, throttle, toForwardSlash, unindent };
package/dist/fs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { i as Result } from "./chunks/chunk-4b76d1c4.js";
2
+ import { i as Result } from "./chunks/chunk-f11577d4.js";
3
3
  import * as nativeFs$1 from "fs";
4
4
 
5
5
  //#region node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.d.mts
package/dist/fs.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Result, D as safeParse, F as __commonJSMin, I as __toESM, M as ok, N as safeTry, O as stringify, j as err, l as removePrefix } from "./chunks/chunk-fda806f4.js";
2
- import { Fn as e$1, Jt as n, Sn as e$2, gn as e } from "./chunks/chunk-267b337b.js";
1
+ import { A as Result, D as safeParse, F as __commonJSMin, I as __toESM, M as ok, N as safeTry, O as stringify, j as err, l as removePrefix } from "./chunks/chunk-af8ca15e.js";
2
+ import { Fn as e$1, Jt as n, Sn as e$2, gn as e } from "./chunks/chunk-b970a8d0.js";
3
3
  import * as nativeFs$1 from "fs";
4
4
  import nativeFs from "fs";
5
5
  import path, { basename, dirname, normalize, posix, relative, resolve, sep } from "path";
@@ -359,10 +359,10 @@ var Walker = class {
359
359
  };
360
360
  };
361
361
  function promise(root, options) {
362
- return new Promise((resolve$1, reject) => {
362
+ return new Promise((resolve$1$1, reject) => {
363
363
  callback(root, options, (err$1, output) => {
364
364
  if (err$1) return reject(err$1);
365
- resolve$1(output);
365
+ resolve$1$1(output);
366
366
  });
367
367
  });
368
368
  }
package/dist/remeda.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Pr as IsAny$1 } from "./chunks/chunk-a07ed28f.js";
1
+ import { Pr as IsAny$1 } from "./chunks/chunk-566a516c.js";
2
2
 
3
3
  //#region src/remeda/types.d.ts
4
4
 
package/dist/remeda.js CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as t$84, $n as n$4, $t as e$24, A as awaitAll, An as e$9, Ar as t$4, At as t$62, B as t$89, Bn as e$3, Bt as t$53, C as toIteratorAsync, Cn as e$16, Cr as e, Ct as t$68, D as concurrency, Dn as e$12, Dr as t$6, Dt as n$13, E as buffer, En as e$13, Er as t$7, Et as t$65, F as isFunction, Fn as e$4, Fr as t$59, Ft as t$58, G as e$33, Gn as n$7, Gt as t$50, H as n$25, Hn as t$32, Ht as t$51, I as hasOwnProperty, In as t$31, It as e$28, J as n$22, Jn as t$24, Jt as n$12, K as t$87, Kn as t$26, Kt as e$25, L as t$91, Ln as n$9, Lt as t$57, M as toArrayAsync, Mn as e$7, Mr as t$2, Mt as t$60, N as compose, Nn as e$6, Nr as t$1, Nt as e$30, O as throttle, On as e$11, Or as t$5, Ot as t$64, P as isPromiseLike, Pn as e$5, Pr as t, Pt as e$29, Q as t$85, Qn as n$5, Qt as n$11, R as t$90, Rn as r$4, Rt as t$56, S as serializeAsync, Sn as e$17, Sr as t$10, St as e$31, T as chunkAsync, Tn as e$14, Tr as t$8, Tt as t$66, U as n$24, Un as t$28, Ut as e$27, V as n$26, Vn as n$8, Vt as t$52, W as t$88, Wn as t$27, Wt as e$26, X as n$21, Xn as n$6, Xt as a, Y as t$86, Yn as t$23, Yt as t$48, Z as n$20, Zn as t$22, Zt as t$47, _ as uniqueWithAsync, _n as t$34, _r as n$1, _t as n$16, a as forEachAsync, an as t$43, ar as n$2, at as t$80, b as uniqueAsync, bn as e$19, br as t$11, bt as t$70, c as everyAsync, cn as t$40, cr as t$16, ct as t$76, d as intersectionWithAsync, dn as t$37, dr as t$13, dt as t$73, en as t$46, er as n$3, et as t$83, f as intersectionByAsync, fn as t$36, fr as r$2, ft as t$72, g as differenceAsync, gn as e$21, gr as t$12, gt as n$17, h as differenceByAsync, hn as e$22, hr as e$2, ht as n$18, i as peekAsync, in as t$77, ir as r$3, it as n$19, j as executeAsync, jn as e$8, jr as t$3, jt as t$61, k as accumulateAsync, kn as e$10, kr as n, kt as t$63, l as mapAsync, ln as t$39, lr as t$15, lt as t$75, m as differenceWithAsync, mn as e$23, mr as r$1, mt as t$71, n as dropAsync, nn as t$44, nr as t$20, nt as t$81, o as reduceAsync, on as t$42, or as t$18, ot as t$79, p as intersectionAsync, pn as t$35, pr as t$29, pt as e$32, q as n$23, qn as t$25, qt as t$49, r as concatAsync, rn as n$10, rr as t$19, rt as r$5, s as findAsync, sn as t$41, sr as t$17, st as t$78, t as takeAsync, tn as t$45, tr as t$21, tt as t$82, u as flatMapAsync, un as t$38, ur as t$14, ut as t$74, v as someAsync, vn as t$33, vr as r, vt as n$15, w as flattenAsync, wn as e$15, wr as t$9, wt as t$67, x as filterAsync, xn as e$18, xr as e$1, xt as t$69, y as uniqueByAsync, yn as e$20, yr as t$55, yt as n$14, z as e$34, zn as t$30, zt as t$54 } from "./chunks/chunk-267b337b.js";
1
+ import { $ as t$84, $n as n$4, $t as e$24, A as awaitAll, An as e$9, Ar as t$4, At as t$62, B as t$89, Bn as e$3, Bt as t$53, C as toIteratorAsync, Cn as e$16, Cr as e, Ct as t$68, D as concurrency, Dn as e$12, Dr as t$6, Dt as n$13, E as buffer, En as e$13, Er as t$7, Et as t$65, F as isFunction, Fn as e$4, Fr as t$59, Ft as t$58, G as e$33, Gn as n$7, Gt as t$50, H as n$25, Hn as t$32, Ht as t$51, I as hasOwnProperty, In as t$31, It as e$28, J as n$22, Jn as t$24, Jt as n$12, K as t$87, Kn as t$26, Kt as e$25, L as t$91, Ln as n$9, Lt as t$57, M as toArrayAsync, Mn as e$7, Mr as t$2, Mt as t$60, N as compose, Nn as e$6, Nr as t$1, Nt as e$30, O as throttle, On as e$11, Or as t$5, Ot as t$64, P as isPromiseLike, Pn as e$5, Pr as t, Pt as e$29, Q as t$85, Qn as n$5, Qt as n$11, R as t$90, Rn as r$4, Rt as t$56, S as serializeAsync, Sn as e$17, Sr as t$10, St as e$31, T as chunkAsync, Tn as e$14, Tr as t$8, Tt as t$66, U as n$24, Un as t$28, Ut as e$27, V as n$26, Vn as n$8, Vt as t$52, W as t$88, Wn as t$27, Wt as e$26, X as n$21, Xn as n$6, Xt as a, Y as t$86, Yn as t$23, Yt as t$48, Z as n$20, Zn as t$22, Zt as t$47, _ as uniqueWithAsync, _n as t$34, _r as n$1, _t as n$16, a as forEachAsync, an as t$43, ar as n$2, at as t$80, b as uniqueAsync, bn as e$19, br as t$11, bt as t$70, c as everyAsync, cn as t$40, cr as t$16, ct as t$76, d as intersectionWithAsync, dn as t$37, dr as t$13, dt as t$73, en as t$46, er as n$3, et as t$83, f as intersectionByAsync, fn as t$36, fr as r$2, ft as t$72, g as differenceAsync, gn as e$21, gr as t$12, gt as n$17, h as differenceByAsync, hn as e$22, hr as e$2, ht as n$18, i as peekAsync, in as t$77, ir as r$3, it as n$19, j as executeAsync, jn as e$8, jr as t$3, jt as t$61, k as accumulateAsync, kn as e$10, kr as n, kt as t$63, l as mapAsync, ln as t$39, lr as t$15, lt as t$75, m as differenceWithAsync, mn as e$23, mr as r$1, mt as t$71, n as dropAsync, nn as t$44, nr as t$20, nt as t$81, o as reduceAsync, on as t$42, or as t$18, ot as t$79, p as intersectionAsync, pn as t$35, pr as t$29, pt as e$32, q as n$23, qn as t$25, qt as t$49, r as concatAsync, rn as n$10, rr as t$19, rt as r$5, s as findAsync, sn as t$41, sr as t$17, st as t$78, t as takeAsync, tn as t$45, tr as t$21, tt as t$82, u as flatMapAsync, un as t$38, ur as t$14, ut as t$74, v as someAsync, vn as t$33, vr as r, vt as n$15, w as flattenAsync, wn as e$15, wr as t$9, wt as t$67, x as filterAsync, xn as e$18, xr as e$1, xt as t$69, y as uniqueByAsync, yn as e$20, yr as t$55, yt as n$14, z as e$34, zn as t$30, zt as t$54 } from "./chunks/chunk-b970a8d0.js";
2
2
 
3
3
  export { accumulateAsync as accumulateP, t as add, t$1 as addProp, t$2 as allPass, t$3 as anyPass, awaitAll, buffer, t$4 as capitalize, n as ceil, t$5 as chunk, chunkAsync as chunkP, t$6 as clamp, t$7 as clone, compose, t$8 as concat, concatAsync as concatP, concurrency, t$9 as conditional, e as constant, t$10 as countBy, e$1 as debounce, t$11 as defaultTo, r as difference, differenceByAsync as differenceByP, differenceAsync as differenceP, n$1 as differenceWith, differenceWithAsync as differenceWithP, t$12 as divide, e$2 as doNothing, r$1 as drop, r$2 as dropFirstBy, t$13 as dropLast, t$14 as dropLastWhile, dropAsync as dropP, t$15 as dropWhile, t$16 as endsWith, t$17 as entries, everyAsync as everyP, t$18 as evolve, executeAsync as executeP, n$2 as filter, filterAsync as filterP, r$3 as find, t$19 as findIndex, t$20 as findLast, t$21 as findLastIndex, findAsync as findP, n$3 as first, n$4 as firstBy, n$5 as flat, t$22 as flatMap, flatMapAsync as flatMapP, flattenAsync as flattenP, n$6 as floor, t$23 as forEach, t$24 as forEachObj, forEachAsync as forEachP, t$25 as fromEntries, t$26 as fromKeys, n$7 as funnel, t$27 as groupBy, t$28 as groupByProp, t$29 as hasAtLeast, hasOwnProperty, n$8 as hasSubObject, e$3 as identity, t$30 as indexBy, r$4 as intersection, intersectionByAsync as intersectionByP, intersectionAsync as intersectionP, n$9 as intersectionWith, intersectionWithAsync as intersectionWithP, t$31 as invert, e$4 as isArray, e$5 as isBigInt, e$6 as isBoolean, e$7 as isDate, t$32 as isDeepEqual, e$8 as isDefined, e$9 as isEmpty, e$10 as isEmptyish, e$11 as isError, isFunction, e$12 as isIncludedIn, e$13 as isNonNull, e$14 as isNonNullish, e$15 as isNot, e$16 as isNullish, e$17 as isNumber, e$18 as isObjectType, e$19 as isPlainObject, e$20 as isPromise, isPromiseLike, t$33 as isShallowEqual, t$34 as isStrictEqual, e$21 as isString, e$22 as isSymbol, e$23 as isTruthy, t$35 as join, t$36 as keys, t$37 as last, t$38 as length, t$39 as map, t$40 as mapKeys, mapAsync as mapP, t$41 as mapToObj, t$42 as mapValues, t$43 as mapWithFeedback, n$10 as mean, t$44 as meanBy, t$45 as median, t$46 as merge, e$24 as mergeAll, n$11 as mergeDeep, t$47 as multiply, a as nthBy, t$48 as objOf, n$12 as omit, t$49 as omitBy, e$25 as once, t$50 as only, e$26 as partialBind, e$27 as partialLastBind, t$51 as partition, t$52 as pathOr, t$53 as pick, t$54 as pickBy, t$55 as pipe, t$56 as piped, t$57 as product, e$28 as prop, t$58 as pullObject, t$59 as purry, e$29 as randomBigInt, e$30 as randomInteger, t$60 as randomString, t$61 as range, t$62 as rankBy, t$63 as reduce, reduceAsync as reduceP, t$64 as reverse, n$13 as round, t$65 as sample, serializeAsync as serializeP, t$66 as set, t$67 as setPath, t$68 as shuffle, e$31 as sliceString, someAsync as someP, t$69 as sort, t$70 as sortBy, n$14 as sortedIndex, n$15 as sortedIndexBy, n$16 as sortedIndexWith, n$17 as sortedLastIndex, n$18 as sortedLastIndexBy, t$71 as splice, e$32 as split, t$72 as splitAt, t$73 as splitWhen, t$74 as startsWith, t$75 as stringToPath, t$76 as subtract, t$77 as sum, t$78 as sumBy, t$79 as swapIndices, t$80 as swapProps, n$19 as take, r$5 as takeFirstBy, t$81 as takeLast, t$82 as takeLastWhile, takeAsync as takeP, t$83 as takeWhile, t$84 as tap, peekAsync as tapP, throttle, t$85 as times, toArrayAsync as toArrayP, n$20 as toCamelCase, toIteratorAsync as toIteratorP, n$21 as toKebabCase, t$86 as toLowerCase, n$22 as toSnakeCase, n$23 as toTitleCase, t$87 as toUpperCase, e$33 as truncate, t$88 as uncapitalize, n$24 as unique, n$25 as uniqueBy, uniqueByAsync as uniqueByP, uniqueAsync as uniqueP, n$26 as uniqueWith, uniqueWithAsync as uniqueWithP, t$89 as values, e$34 as when, t$90 as zip, t$91 as zipWith };
package/dist/result.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as err, c as ExtractOkTypes, d as ResultAll, f as ResultError, i as Result, l as InferErrType, n as Err, o as ok, r as Ok, s as ExtractErrTypes, t as safeTry, u as InferOkType } from "./chunks/chunk-4b76d1c4.js";
1
+ import { a as err, c as ExtractOkTypes, d as ResultAll, f as ResultError, i as Result, l as InferErrType, n as Err, o as ok, r as Ok, s as ExtractErrTypes, t as safeTry, u as InferOkType } from "./chunks/chunk-f11577d4.js";
2
2
  export { Err, ExtractErrTypes, ExtractOkTypes, InferErrType, InferOkType, Ok, Result, ResultAll, ResultError, err, ok, safeTry };
package/dist/result.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as Result, M as ok, N as safeTry, P as ResultError, j as err } from "./chunks/chunk-fda806f4.js";
1
+ import { A as Result, M as ok, N as safeTry, P as ResultError, j as err } from "./chunks/chunk-af8ca15e.js";
2
2
 
3
3
  export { Result, ResultError, err, ok, safeTry };
@@ -0,0 +1,111 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { ChildProcess, SpawnOptions } from "node:child_process";
3
+ import { Readable } from "node:stream";
4
+
5
+ //#region node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.d.ts
6
+
7
+ //#region src/non-zero-exit-error.d.ts
8
+ declare class NonZeroExitError extends Error {
9
+ readonly result: Result;
10
+ readonly output?: Output;
11
+ get exitCode(): number | undefined;
12
+ constructor(result: Result, output?: Output);
13
+ }
14
+
15
+ //#endregion
16
+ //#region src/main.d.ts
17
+ interface Output {
18
+ stderr: string;
19
+ stdout: string;
20
+ exitCode: number | undefined;
21
+ }
22
+ interface PipeOptions extends Options {}
23
+ type KillSignal = Parameters<ChildProcess['kill']>[0];
24
+ interface OutputApi extends AsyncIterable<string> {
25
+ pipe(command: string, args?: string[], options?: Partial<PipeOptions>): Result;
26
+ process: ChildProcess | undefined;
27
+ kill(signal?: KillSignal): boolean;
28
+ get pid(): number | undefined;
29
+ get aborted(): boolean;
30
+ get killed(): boolean;
31
+ get exitCode(): number | undefined;
32
+ }
33
+ type Result = PromiseLike<Output> & OutputApi;
34
+ interface Options {
35
+ signal: AbortSignal;
36
+ nodeOptions: SpawnOptions;
37
+ timeout: number;
38
+ persist: boolean;
39
+ stdin: ExecProcess;
40
+ throwOnError: boolean;
41
+ }
42
+ declare class ExecProcess implements Result {
43
+ protected _process?: ChildProcess;
44
+ protected _aborted: boolean;
45
+ protected _options: Partial<Options>;
46
+ protected _command: string;
47
+ protected _args: string[];
48
+ protected _resolveClose?: () => void;
49
+ protected _processClosed: Promise<void>;
50
+ protected _thrownError?: Error;
51
+ get process(): ChildProcess | undefined;
52
+ get pid(): number | undefined;
53
+ get exitCode(): number | undefined;
54
+ constructor(command: string, args?: string[], options?: Partial<Options>);
55
+ kill(signal?: KillSignal): boolean;
56
+ get aborted(): boolean;
57
+ get killed(): boolean;
58
+ pipe(command: string, args?: string[], options?: Partial<PipeOptions>): Result;
59
+ [Symbol.asyncIterator](): AsyncIterator<string>;
60
+ protected _waitForOutput(): Promise<Output>;
61
+ then<TResult1 = Output, TResult2 = never>(onfulfilled?: ((value: Output) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
62
+ protected _streamOut?: Readable;
63
+ protected _streamErr?: Readable;
64
+ spawn(): void;
65
+ protected _resetState(): void;
66
+ protected _onError: (err: Error) => void;
67
+ protected _onClose: () => void;
68
+ }
69
+ //#endregion
70
+ //#region src/shell/types.d.ts
71
+ interface StringOrTemplateFunction {
72
+ (command: string): ShellResult;
73
+ (template: TemplateStringsArray, ...values: any[]): ShellResult;
74
+ }
75
+ interface ShellExec {
76
+ (command: string, args?: string[], options?: Partial<PipeOptions>): ShellResult;
77
+ (template: TemplateStringsArray, ...values: any[]): ShellResult;
78
+ (options: Partial<Options>): StringOrTemplateFunction;
79
+ }
80
+ interface ShellOutputApi extends OutputApi {
81
+ pipe: ShellExec;
82
+ }
83
+ type ShellResult = PromiseLike<Output> & ShellOutputApi;
84
+ //#endregion
85
+ //#region src/shell/exec.d.ts
86
+ declare class ShellExecProcess extends ExecProcess implements ShellResult {
87
+ constructor(command: string, args?: string[], options?: Partial<Options>);
88
+ pipe(command: string, args?: string[], options?: Partial<PipeOptions>): ShellResult;
89
+ pipe(template: TemplateStringsArray, ...values: any[]): ShellResult;
90
+ pipe(options: Partial<Options>): StringOrTemplateFunction;
91
+ [Symbol.asyncIterator](): AsyncIterator<string>;
92
+ protected _waitForOutput(): Promise<Output>;
93
+ }
94
+ declare const exec: ShellExec;
95
+ //#endregion
96
+ //#region src/shell/error.d.ts
97
+ declare class ShellNonZeroExitError extends NonZeroExitError {
98
+ readonly result: ShellResult;
99
+ constructor(result: ShellResult, output?: Output);
100
+ }
101
+ //#endregion
102
+ //#region node_modules/.pnpm/args-tokenizer@0.3.0/node_modules/args-tokenizer/dist/args-tokenizer.d.ts
103
+ type Options$1 = {
104
+ loose?: boolean;
105
+ };
106
+ /**
107
+ * Tokenize a shell string into argv array
108
+ */
109
+ declare const tokenizeArgs: (argsString: string, options?: Options$1) => string[];
110
+ //#endregion
111
+ export { exec as $, exec, exec as x, type ShellExec, ShellExecProcess, type KillSignal as ShellKillSignal, ShellNonZeroExitError, type Options as ShellOptions, type Output as ShellOutput, type ShellOutputApi, type PipeOptions as ShellPipeOptions, type ShellResult, tokenizeArgs as splitShellCommand };
package/dist/shell.js ADDED
@@ -0,0 +1,781 @@
1
+ import { T as getErrorMessage, a as concatTemplateStrings } from "./chunks/chunk-af8ca15e.js";
2
+ import { Fn as e$1, bn as e$2, gn as e } from "./chunks/chunk-b970a8d0.js";
3
+ import { createRequire } from "module";
4
+ import { delimiter, dirname, normalize, resolve } from "node:path";
5
+ import { spawn } from "node:child_process";
6
+ import { cwd } from "node:process";
7
+ import { PassThrough } from "node:stream";
8
+ import c from "node:readline";
9
+
10
+ //#region node_modules/.pnpm/args-tokenizer@0.3.0/node_modules/args-tokenizer/dist/args-tokenizer.js
11
+ var spaceRegex = /\s/;
12
+ var tokenizeArgs = (argsString, options) => {
13
+ const tokens = [];
14
+ let currentToken = "";
15
+ let openningQuote;
16
+ let escaped = false;
17
+ for (let index = 0; index < argsString.length; index += 1) {
18
+ const char = argsString[index];
19
+ if (escaped) {
20
+ escaped = false;
21
+ if (openningQuote || char !== "\n") currentToken += char;
22
+ continue;
23
+ }
24
+ if (char === "\\") {
25
+ escaped = true;
26
+ continue;
27
+ }
28
+ if (openningQuote === void 0 && spaceRegex.test(char)) {
29
+ if (currentToken.length > 0) {
30
+ tokens.push(currentToken);
31
+ currentToken = "";
32
+ }
33
+ continue;
34
+ }
35
+ if (char === "'" || char === "\"") {
36
+ if (openningQuote === void 0) {
37
+ openningQuote = char;
38
+ continue;
39
+ }
40
+ if (openningQuote === char) {
41
+ openningQuote = void 0;
42
+ continue;
43
+ }
44
+ }
45
+ currentToken += char;
46
+ }
47
+ if (currentToken.length > 0) tokens.push(currentToken);
48
+ if (options?.loose) return tokens;
49
+ if (openningQuote) throw Error("Unexpected end of string. Closing quote is missing.");
50
+ return tokens;
51
+ };
52
+
53
+ //#endregion
54
+ //#region node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.js
55
+ var l = Object.create;
56
+ var u = Object.defineProperty;
57
+ var d = Object.getOwnPropertyDescriptor;
58
+ var f = Object.getOwnPropertyNames;
59
+ var p = Object.getPrototypeOf;
60
+ var m = Object.prototype.hasOwnProperty;
61
+ var h = (e$3, t) => () => (t || e$3((t = { exports: {} }).exports, t), t.exports);
62
+ var g = (e$3, t, n, r) => {
63
+ if (t && typeof t === "object" || typeof t === "function") for (var i = f(t), a = 0, o = i.length, s; a < o; a++) {
64
+ s = i[a];
65
+ if (!m.call(e$3, s) && s !== n) u(e$3, s, {
66
+ get: ((e$4) => t[e$4]).bind(null, s),
67
+ enumerable: !(r = d(t, s)) || r.enumerable
68
+ });
69
+ }
70
+ return e$3;
71
+ };
72
+ var _ = (e$3, t, n) => (n = e$3 != null ? l(p(e$3)) : {}, g(t || !e$3 || !e$3.__esModule ? u(n, "default", {
73
+ value: e$3,
74
+ enumerable: true
75
+ }) : n, e$3));
76
+ var v = /* @__PURE__ */ createRequire(import.meta.url);
77
+ const y = /^path$/i;
78
+ const b = {
79
+ key: "PATH",
80
+ value: ""
81
+ };
82
+ function x(e$3) {
83
+ for (const t in e$3) {
84
+ if (!Object.prototype.hasOwnProperty.call(e$3, t) || !y.test(t)) continue;
85
+ const n = e$3[t];
86
+ if (!n) return b;
87
+ return {
88
+ key: t,
89
+ value: n
90
+ };
91
+ }
92
+ return b;
93
+ }
94
+ function S(e$3, t) {
95
+ const i = t.value.split(delimiter);
96
+ let o = e$3;
97
+ let s;
98
+ do {
99
+ i.push(resolve(o, "node_modules", ".bin"));
100
+ s = o;
101
+ o = dirname(o);
102
+ } while (o !== s);
103
+ return {
104
+ key: t.key,
105
+ value: i.join(delimiter)
106
+ };
107
+ }
108
+ function C(e$3, t) {
109
+ const n = {
110
+ ...process.env,
111
+ ...t
112
+ };
113
+ const r = S(e$3, x(n));
114
+ n[r.key] = r.value;
115
+ return n;
116
+ }
117
+ const w = (e$3) => {
118
+ let t = e$3.length;
119
+ const n = new PassThrough();
120
+ const r = () => {
121
+ if (--t === 0) n.emit("end");
122
+ };
123
+ for (const t$1 of e$3) {
124
+ t$1.pipe(n, { end: false });
125
+ t$1.on("end", r);
126
+ }
127
+ return n;
128
+ };
129
+ var T = h((exports, t) => {
130
+ t.exports = a;
131
+ a.sync = o;
132
+ var n = v("fs");
133
+ function r(e$3, t$1) {
134
+ var n$1 = t$1.pathExt !== void 0 ? t$1.pathExt : process.env.PATHEXT;
135
+ if (!n$1) return true;
136
+ n$1 = n$1.split(";");
137
+ if (n$1.indexOf("") !== -1) return true;
138
+ for (var r$1 = 0; r$1 < n$1.length; r$1++) {
139
+ var i$1 = n$1[r$1].toLowerCase();
140
+ if (i$1 && e$3.substr(-i$1.length).toLowerCase() === i$1) return true;
141
+ }
142
+ return false;
143
+ }
144
+ function i(e$3, t$1, n$1) {
145
+ if (!e$3.isSymbolicLink() && !e$3.isFile()) return false;
146
+ return r(t$1, n$1);
147
+ }
148
+ function a(e$3, t$1, r$1) {
149
+ n.stat(e$3, function(n$1, a$1) {
150
+ r$1(n$1, n$1 ? false : i(a$1, e$3, t$1));
151
+ });
152
+ }
153
+ function o(e$3, t$1) {
154
+ return i(n.statSync(e$3), e$3, t$1);
155
+ }
156
+ });
157
+ var E = h((exports, t) => {
158
+ t.exports = r;
159
+ r.sync = i;
160
+ var n = v("fs");
161
+ function r(e$3, t$1, r$1) {
162
+ n.stat(e$3, function(e$4, n$1) {
163
+ r$1(e$4, e$4 ? false : a(n$1, t$1));
164
+ });
165
+ }
166
+ function i(e$3, t$1) {
167
+ return a(n.statSync(e$3), t$1);
168
+ }
169
+ function a(e$3, t$1) {
170
+ return e$3.isFile() && o(e$3, t$1);
171
+ }
172
+ function o(e$3, t$1) {
173
+ var n$1 = e$3.mode;
174
+ var r$1 = e$3.uid;
175
+ var i$1 = e$3.gid;
176
+ var a$1 = t$1.uid !== void 0 ? t$1.uid : process.getuid && process.getuid();
177
+ var o$1 = t$1.gid !== void 0 ? t$1.gid : process.getgid && process.getgid();
178
+ var s = parseInt("100", 8);
179
+ var c$1 = parseInt("010", 8);
180
+ var l$1 = parseInt("001", 8);
181
+ var u$1 = s | c$1;
182
+ 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;
183
+ }
184
+ });
185
+ var D = h((exports, t) => {
186
+ v("fs");
187
+ var r;
188
+ if (process.platform === "win32" || global.TESTING_WINDOWS) r = T();
189
+ else r = E();
190
+ t.exports = i;
191
+ i.sync = a;
192
+ function i(e$3, t$1, n) {
193
+ if (typeof t$1 === "function") {
194
+ n = t$1;
195
+ t$1 = {};
196
+ }
197
+ if (!n) {
198
+ if (typeof Promise !== "function") throw new TypeError("callback not provided");
199
+ return new Promise(function(n$1, r$1) {
200
+ i(e$3, t$1 || {}, function(e$4, t$2) {
201
+ if (e$4) r$1(e$4);
202
+ else n$1(t$2);
203
+ });
204
+ });
205
+ }
206
+ r(e$3, t$1 || {}, function(e$4, r$1) {
207
+ if (e$4) {
208
+ if (e$4.code === "EACCES" || t$1 && t$1.ignoreErrors) {
209
+ e$4 = null;
210
+ r$1 = false;
211
+ }
212
+ }
213
+ n(e$4, r$1);
214
+ });
215
+ }
216
+ function a(e$3, t$1) {
217
+ try {
218
+ return r.sync(e$3, t$1 || {});
219
+ } catch (e$4) {
220
+ if (t$1 && t$1.ignoreErrors || e$4.code === "EACCES") return false;
221
+ else throw e$4;
222
+ }
223
+ }
224
+ });
225
+ var O = h((exports, t) => {
226
+ const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
227
+ const r = v("path");
228
+ const i = n ? ";" : ":";
229
+ const a = D();
230
+ const o = (e$3) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e$3}`), { code: "ENOENT" });
231
+ const s = (e$3, t$1) => {
232
+ const r$1 = t$1.colon || i;
233
+ const a$1 = e$3.match(/\//) || n && e$3.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t$1.path || process.env.PATH || "").split(r$1)];
234
+ const o$1 = n ? t$1.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
235
+ const s$1 = n ? o$1.split(r$1) : [""];
236
+ if (n) {
237
+ if (e$3.indexOf(".") !== -1 && s$1[0] !== "") s$1.unshift("");
238
+ }
239
+ return {
240
+ pathEnv: a$1,
241
+ pathExt: s$1,
242
+ pathExtExe: o$1
243
+ };
244
+ };
245
+ const c$1 = (e$3, t$1, n$1) => {
246
+ if (typeof t$1 === "function") {
247
+ n$1 = t$1;
248
+ t$1 = {};
249
+ }
250
+ if (!t$1) t$1 = {};
251
+ const { pathEnv: i$1, pathExt: c$2, pathExtExe: l$2 } = s(e$3, t$1);
252
+ const u$1 = [];
253
+ const d$1 = (n$2) => new Promise((a$1, s$1) => {
254
+ if (n$2 === i$1.length) return t$1.all && u$1.length ? a$1(u$1) : s$1(o(e$3));
255
+ const c$3 = i$1[n$2];
256
+ const l$3 = /^".*"$/.test(c$3) ? c$3.slice(1, -1) : c$3;
257
+ const d$2 = r.join(l$3, e$3);
258
+ a$1(f$1(!l$3 && /^\.[\\\/]/.test(e$3) ? e$3.slice(0, 2) + d$2 : d$2, n$2, 0));
259
+ });
260
+ const f$1 = (e$4, n$2, r$1) => new Promise((i$2, o$1) => {
261
+ if (r$1 === c$2.length) return i$2(d$1(n$2 + 1));
262
+ const s$1 = c$2[r$1];
263
+ a(e$4 + s$1, { pathExt: l$2 }, (a$1, o$2) => {
264
+ if (!a$1 && o$2) if (t$1.all) u$1.push(e$4 + s$1);
265
+ else return i$2(e$4 + s$1);
266
+ return i$2(f$1(e$4, n$2, r$1 + 1));
267
+ });
268
+ });
269
+ return n$1 ? d$1(0).then((e$4) => n$1(null, e$4), n$1) : d$1(0);
270
+ };
271
+ const l$1 = (e$3, t$1) => {
272
+ t$1 = t$1 || {};
273
+ const { pathEnv: n$1, pathExt: i$1, pathExtExe: c$2 } = s(e$3, t$1);
274
+ const l$2 = [];
275
+ for (let o$1 = 0; o$1 < n$1.length; o$1++) {
276
+ const s$1 = n$1[o$1];
277
+ const u$1 = /^".*"$/.test(s$1) ? s$1.slice(1, -1) : s$1;
278
+ const d$1 = r.join(u$1, e$3);
279
+ const f$1 = !u$1 && /^\.[\\\/]/.test(e$3) ? e$3.slice(0, 2) + d$1 : d$1;
280
+ for (let e$4 = 0; e$4 < i$1.length; e$4++) {
281
+ const n$2 = f$1 + i$1[e$4];
282
+ try {
283
+ if (a.sync(n$2, { pathExt: c$2 })) if (t$1.all) l$2.push(n$2);
284
+ else return n$2;
285
+ } catch (e$5) {}
286
+ }
287
+ }
288
+ if (t$1.all && l$2.length) return l$2;
289
+ if (t$1.nothrow) return null;
290
+ throw o(e$3);
291
+ };
292
+ t.exports = c$1;
293
+ c$1.sync = l$1;
294
+ });
295
+ var k = h((exports, t) => {
296
+ const n = (e$3 = {}) => {
297
+ const t$1 = e$3.env || process.env;
298
+ if ((e$3.platform || process.platform) !== "win32") return "PATH";
299
+ return Object.keys(t$1).reverse().find((e$4) => e$4.toUpperCase() === "PATH") || "Path";
300
+ };
301
+ t.exports = n;
302
+ t.exports.default = n;
303
+ });
304
+ var A = h((exports, t) => {
305
+ const n = v("path");
306
+ const r = O();
307
+ const i = k();
308
+ function a(e$3, t$1) {
309
+ const a$1 = e$3.options.env || process.env;
310
+ const o$1 = process.cwd();
311
+ const s = e$3.options.cwd != null;
312
+ const c$1 = s && process.chdir !== void 0 && !process.chdir.disabled;
313
+ if (c$1) try {
314
+ process.chdir(e$3.options.cwd);
315
+ } catch (e$4) {}
316
+ let l$1;
317
+ try {
318
+ l$1 = r.sync(e$3.command, {
319
+ path: a$1[i({ env: a$1 })],
320
+ pathExt: t$1 ? n.delimiter : void 0
321
+ });
322
+ } catch (e$4) {} finally {
323
+ if (c$1) process.chdir(o$1);
324
+ }
325
+ if (l$1) l$1 = n.resolve(s ? e$3.options.cwd : "", l$1);
326
+ return l$1;
327
+ }
328
+ function o(e$3) {
329
+ return a(e$3) || a(e$3, true);
330
+ }
331
+ t.exports = o;
332
+ });
333
+ var j = h((exports, t) => {
334
+ const n = /([()\][%!^"`<>&|;, *?])/g;
335
+ function r(e$3) {
336
+ e$3 = e$3.replace(n, "^$1");
337
+ return e$3;
338
+ }
339
+ function i(e$3, t$1) {
340
+ e$3 = `${e$3}`;
341
+ e$3 = e$3.replace(/(\\*)"/g, "$1$1\\\"");
342
+ e$3 = e$3.replace(/(\\*)$/, "$1$1");
343
+ e$3 = `"${e$3}"`;
344
+ e$3 = e$3.replace(n, "^$1");
345
+ if (t$1) e$3 = e$3.replace(n, "^$1");
346
+ return e$3;
347
+ }
348
+ t.exports.command = r;
349
+ t.exports.argument = i;
350
+ });
351
+ var M = h((exports, t) => {
352
+ t.exports = /^#!(.*)/;
353
+ });
354
+ var N = h((exports, t) => {
355
+ const n = M();
356
+ t.exports = (e$3 = "") => {
357
+ const t$1 = e$3.match(n);
358
+ if (!t$1) return null;
359
+ const [r, i] = t$1[0].replace(/#! ?/, "").split(" ");
360
+ const a = r.split("/").pop();
361
+ if (a === "env") return i;
362
+ return i ? `${a} ${i}` : a;
363
+ };
364
+ });
365
+ var P = h((exports, t) => {
366
+ const n = v("fs");
367
+ const r = N();
368
+ function i(e$3) {
369
+ const t$1 = 150;
370
+ const i$1 = Buffer.alloc(t$1);
371
+ let a;
372
+ try {
373
+ a = n.openSync(e$3, "r");
374
+ n.readSync(a, i$1, 0, t$1, 0);
375
+ n.closeSync(a);
376
+ } catch (e$4) {}
377
+ return r(i$1.toString());
378
+ }
379
+ t.exports = i;
380
+ });
381
+ var F = h((exports, t) => {
382
+ const n = v("path");
383
+ const r = A();
384
+ const i = j();
385
+ const a = P();
386
+ const o = process.platform === "win32";
387
+ const s = /\.(?:com|exe)$/i;
388
+ const c$1 = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
389
+ function l$1(e$3) {
390
+ e$3.file = r(e$3);
391
+ const t$1 = e$3.file && a(e$3.file);
392
+ if (t$1) {
393
+ e$3.args.unshift(e$3.file);
394
+ e$3.command = t$1;
395
+ return r(e$3);
396
+ }
397
+ return e$3.file;
398
+ }
399
+ function u$1(e$3) {
400
+ if (!o) return e$3;
401
+ const t$1 = l$1(e$3);
402
+ const r$1 = !s.test(t$1);
403
+ if (e$3.options.forceShell || r$1) {
404
+ const r$2 = c$1.test(t$1);
405
+ e$3.command = n.normalize(e$3.command);
406
+ e$3.command = i.command(e$3.command);
407
+ e$3.args = e$3.args.map((e$4) => i.argument(e$4, r$2));
408
+ e$3.args = [
409
+ "/d",
410
+ "/s",
411
+ "/c",
412
+ `"${[e$3.command].concat(e$3.args).join(" ")}"`
413
+ ];
414
+ e$3.command = process.env.comspec || "cmd.exe";
415
+ e$3.options.windowsVerbatimArguments = true;
416
+ }
417
+ return e$3;
418
+ }
419
+ function d$1(e$3, t$1, n$1) {
420
+ if (t$1 && !Array.isArray(t$1)) {
421
+ n$1 = t$1;
422
+ t$1 = null;
423
+ }
424
+ t$1 = t$1 ? t$1.slice(0) : [];
425
+ n$1 = Object.assign({}, n$1);
426
+ const r$1 = {
427
+ command: e$3,
428
+ args: t$1,
429
+ options: n$1,
430
+ file: void 0,
431
+ original: {
432
+ command: e$3,
433
+ args: t$1
434
+ }
435
+ };
436
+ return n$1.shell ? r$1 : u$1(r$1);
437
+ }
438
+ t.exports = d$1;
439
+ });
440
+ var I = h((exports, t) => {
441
+ const n = process.platform === "win32";
442
+ function r(e$3, t$1) {
443
+ return Object.assign(/* @__PURE__ */ new Error(`${t$1} ${e$3.command} ENOENT`), {
444
+ code: "ENOENT",
445
+ errno: "ENOENT",
446
+ syscall: `${t$1} ${e$3.command}`,
447
+ path: e$3.command,
448
+ spawnargs: e$3.args
449
+ });
450
+ }
451
+ function i(e$3, t$1) {
452
+ if (!n) return;
453
+ const r$1 = e$3.emit;
454
+ e$3.emit = function(n$1, i$1) {
455
+ if (n$1 === "exit") {
456
+ const n$2 = a(i$1, t$1, "spawn");
457
+ if (n$2) return r$1.call(e$3, "error", n$2);
458
+ }
459
+ return r$1.apply(e$3, arguments);
460
+ };
461
+ }
462
+ function a(e$3, t$1) {
463
+ if (n && e$3 === 1 && !t$1.file) return r(t$1.original, "spawn");
464
+ return null;
465
+ }
466
+ function o(e$3, t$1) {
467
+ if (n && e$3 === 1 && !t$1.file) return r(t$1.original, "spawnSync");
468
+ return null;
469
+ }
470
+ t.exports = {
471
+ hookChildProcess: i,
472
+ verifyENOENT: a,
473
+ verifyENOENTSync: o,
474
+ notFoundError: r
475
+ };
476
+ });
477
+ var R = _(h((exports, t) => {
478
+ const n = v("child_process");
479
+ const r = F();
480
+ const i = I();
481
+ function a(e$3, t$1, a$1) {
482
+ const o$1 = r(e$3, t$1, a$1);
483
+ const s = n.spawn(o$1.command, o$1.args, o$1.options);
484
+ i.hookChildProcess(s, o$1);
485
+ return s;
486
+ }
487
+ function o(e$3, t$1, a$1) {
488
+ const o$1 = r(e$3, t$1, a$1);
489
+ const s = n.spawnSync(o$1.command, o$1.args, o$1.options);
490
+ s.error = s.error || i.verifyENOENTSync(s.status, o$1);
491
+ return s;
492
+ }
493
+ t.exports = a;
494
+ t.exports.spawn = a;
495
+ t.exports.sync = o;
496
+ t.exports._parse = r;
497
+ t.exports._enoent = i;
498
+ })(), 1);
499
+ var z = class extends Error {
500
+ result;
501
+ output;
502
+ get exitCode() {
503
+ if (this.result.exitCode !== null) return this.result.exitCode;
504
+ }
505
+ constructor(e$3, t) {
506
+ super(`Process exited with non-zero status (${e$3.exitCode})`);
507
+ this.result = e$3;
508
+ this.output = t;
509
+ }
510
+ };
511
+ const B = {
512
+ timeout: void 0,
513
+ persist: false
514
+ };
515
+ const V = { windowsHide: true };
516
+ function H(e$3, t) {
517
+ return {
518
+ command: normalize(e$3),
519
+ args: t ?? []
520
+ };
521
+ }
522
+ function U(e$3) {
523
+ const t = new AbortController();
524
+ for (const n of e$3) {
525
+ if (n.aborted) {
526
+ t.abort();
527
+ return n;
528
+ }
529
+ const e$4 = () => {
530
+ t.abort(n.reason);
531
+ };
532
+ n.addEventListener("abort", e$4, { signal: t.signal });
533
+ }
534
+ return t.signal;
535
+ }
536
+ async function W(e$3) {
537
+ let t = "";
538
+ for await (const n of e$3) t += n.toString();
539
+ return t;
540
+ }
541
+ var G = class {
542
+ _process;
543
+ _aborted = false;
544
+ _options;
545
+ _command;
546
+ _args;
547
+ _resolveClose;
548
+ _processClosed;
549
+ _thrownError;
550
+ get process() {
551
+ return this._process;
552
+ }
553
+ get pid() {
554
+ return this._process?.pid;
555
+ }
556
+ get exitCode() {
557
+ if (this._process && this._process.exitCode !== null) return this._process.exitCode;
558
+ }
559
+ constructor(e$3, t, n) {
560
+ this._options = {
561
+ ...B,
562
+ ...n
563
+ };
564
+ this._command = e$3;
565
+ this._args = t ?? [];
566
+ this._processClosed = new Promise((e$4) => {
567
+ this._resolveClose = e$4;
568
+ });
569
+ }
570
+ kill(e$3) {
571
+ return this._process?.kill(e$3) === true;
572
+ }
573
+ get aborted() {
574
+ return this._aborted;
575
+ }
576
+ get killed() {
577
+ return this._process?.killed === true;
578
+ }
579
+ pipe(e$3, t, n) {
580
+ return q(e$3, t, {
581
+ ...n,
582
+ stdin: this
583
+ });
584
+ }
585
+ async *[Symbol.asyncIterator]() {
586
+ const e$3 = this._process;
587
+ if (!e$3) return;
588
+ const t = [];
589
+ if (this._streamErr) t.push(this._streamErr);
590
+ if (this._streamOut) t.push(this._streamOut);
591
+ const n = w(t);
592
+ const r = c.createInterface({ input: n });
593
+ for await (const e$4 of r) yield e$4.toString();
594
+ await this._processClosed;
595
+ e$3.removeAllListeners();
596
+ if (this._thrownError) throw this._thrownError;
597
+ if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this);
598
+ }
599
+ async _waitForOutput() {
600
+ const e$3 = this._process;
601
+ if (!e$3) throw new Error("No process was started");
602
+ const [t, n] = await Promise.all([this._streamOut ? W(this._streamOut) : "", this._streamErr ? W(this._streamErr) : ""]);
603
+ await this._processClosed;
604
+ if (this._options?.stdin) await this._options.stdin;
605
+ e$3.removeAllListeners();
606
+ if (this._thrownError) throw this._thrownError;
607
+ const r = {
608
+ stderr: n,
609
+ stdout: t,
610
+ exitCode: this.exitCode
611
+ };
612
+ if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this, r);
613
+ return r;
614
+ }
615
+ then(e$3, t) {
616
+ return this._waitForOutput().then(e$3, t);
617
+ }
618
+ _streamOut;
619
+ _streamErr;
620
+ spawn() {
621
+ const e$3 = cwd();
622
+ const n = this._options;
623
+ const r = {
624
+ ...V,
625
+ ...n.nodeOptions
626
+ };
627
+ const i = [];
628
+ this._resetState();
629
+ if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
630
+ if (n.signal !== void 0) i.push(n.signal);
631
+ if (n.persist === true) r.detached = true;
632
+ if (i.length > 0) r.signal = U(i);
633
+ r.env = C(e$3, r.env);
634
+ const { command: a, args: s } = H(this._command, this._args);
635
+ const c$1 = (0, R._parse)(a, s, r);
636
+ const l$1 = spawn(c$1.command, c$1.args, c$1.options);
637
+ if (l$1.stderr) this._streamErr = l$1.stderr;
638
+ if (l$1.stdout) this._streamOut = l$1.stdout;
639
+ this._process = l$1;
640
+ l$1.once("error", this._onError);
641
+ l$1.once("close", this._onClose);
642
+ if (n.stdin !== void 0 && l$1.stdin && n.stdin.process) {
643
+ const { stdout: e$4 } = n.stdin.process;
644
+ if (e$4) e$4.pipe(l$1.stdin);
645
+ }
646
+ }
647
+ _resetState() {
648
+ this._aborted = false;
649
+ this._processClosed = new Promise((e$3) => {
650
+ this._resolveClose = e$3;
651
+ });
652
+ this._thrownError = void 0;
653
+ }
654
+ _onError = (e$3) => {
655
+ if (e$3.name === "AbortError" && (!(e$3.cause instanceof Error) || e$3.cause.name !== "TimeoutError")) {
656
+ this._aborted = true;
657
+ return;
658
+ }
659
+ this._thrownError = e$3;
660
+ };
661
+ _onClose = () => {
662
+ if (this._resolveClose) this._resolveClose();
663
+ };
664
+ };
665
+ const K = (e$3, t, n) => {
666
+ const r = new G(e$3, t, n);
667
+ r.spawn();
668
+ return r;
669
+ };
670
+ const q = K;
671
+
672
+ //#endregion
673
+ //#region src/shell/error.ts
674
+ var ShellNonZeroExitError = class extends z {
675
+ result;
676
+ constructor(result, output) {
677
+ super(result, output);
678
+ this.result = result;
679
+ }
680
+ };
681
+
682
+ //#endregion
683
+ //#region src/shell/exec.ts
684
+ const normalizeParams = (...params) => {
685
+ const [commandOrTemplateOrOptions, argsOrTemplateValue, optionsOrTemplateValue, ...rest] = params;
686
+ let command;
687
+ let args;
688
+ let options;
689
+ let factory = false;
690
+ if (e(commandOrTemplateOrOptions)) {
691
+ command = commandOrTemplateOrOptions;
692
+ if (argsOrTemplateValue) args = argsOrTemplateValue;
693
+ else {
694
+ let tokens;
695
+ try {
696
+ tokens = tokenizeArgs(commandOrTemplateOrOptions);
697
+ } catch (error) {
698
+ throw new Error(`Failed to parse command string: "${commandOrTemplateOrOptions}". ${getErrorMessage(error)}`);
699
+ }
700
+ if (!tokens[0]) throw new Error(`Failed to extract command from string: "${commandOrTemplateOrOptions}"`);
701
+ command = tokens[0];
702
+ args = tokens.slice(1);
703
+ }
704
+ if (optionsOrTemplateValue) options = optionsOrTemplateValue;
705
+ } else if (e$1(commandOrTemplateOrOptions)) {
706
+ const input = concatTemplateStrings(commandOrTemplateOrOptions, [
707
+ argsOrTemplateValue,
708
+ optionsOrTemplateValue,
709
+ ...rest
710
+ ]);
711
+ let tokens;
712
+ try {
713
+ tokens = tokenizeArgs(input);
714
+ } catch (error) {
715
+ throw new Error(`Failed to parse input template string: "${input}". ${getErrorMessage(error)}`);
716
+ }
717
+ if (!tokens[0]) throw new Error(`Failed to extract command from template string: "${input}"`);
718
+ command = tokens[0];
719
+ args = tokens.slice(1);
720
+ } else if (e$2(commandOrTemplateOrOptions)) {
721
+ command = "";
722
+ options = commandOrTemplateOrOptions;
723
+ factory = true;
724
+ } else throw new TypeError(`First parameter has an invalid type: "${typeof commandOrTemplateOrOptions}"`);
725
+ return {
726
+ command,
727
+ args,
728
+ options,
729
+ factory
730
+ };
731
+ };
732
+ var ShellExecProcess = class extends G {
733
+ constructor(command, args, options) {
734
+ const normalized = normalizeParams(command, args, options);
735
+ super(normalized.command, normalized.args, normalized.options);
736
+ }
737
+ pipe(...params) {
738
+ const { command, args, options, factory } = normalizeParams(...params);
739
+ const pipeOptions = {
740
+ ...options,
741
+ stdin: this
742
+ };
743
+ if (!factory) return execImpl(command, args, pipeOptions);
744
+ return (...params$1) => {
745
+ const normalized = normalizeParams(...params$1, void 0);
746
+ return execImpl(normalized.command, normalized.args, pipeOptions);
747
+ };
748
+ }
749
+ async *[Symbol.asyncIterator]() {
750
+ try {
751
+ yield* super[Symbol.asyncIterator]();
752
+ } catch (error) {
753
+ if (error instanceof z) throw new ShellNonZeroExitError(this);
754
+ throw error;
755
+ }
756
+ }
757
+ async _waitForOutput() {
758
+ try {
759
+ return await super._waitForOutput();
760
+ } catch (error) {
761
+ if (error instanceof z) throw new ShellNonZeroExitError(this);
762
+ throw error;
763
+ }
764
+ }
765
+ };
766
+ const exec = (...params) => {
767
+ const { command, args, options, factory } = normalizeParams(...params);
768
+ if (!factory) return execImpl(command, args, options);
769
+ return (...params$1) => {
770
+ const normalized = normalizeParams(...params$1, void 0);
771
+ return execImpl(normalized.command, normalized.args, options);
772
+ };
773
+ };
774
+ const execImpl = (...params) => {
775
+ const p$1 = new ShellExecProcess(...params);
776
+ p$1.spawn();
777
+ return p$1;
778
+ };
779
+
780
+ //#endregion
781
+ export { exec as $, exec, exec as x, ShellExecProcess, ShellNonZeroExitError, tokenizeArgs as splitShellCommand };
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as IntRange, $n as Simplify, $r as Constructor, $t as SetNonNullable, A as RemovePrefix, An as ArrayTail, Ar as HasRequiredKeys, At as Entries, B as Xor, Bn as NonEmptyObject, Br as KeysOfUnion, Bt as Join, C as PascalCase, Cn as RequireOneOrNone, Cr as NonNegativeInteger, Ct as FindGlobalInstanceType, D as DelimiterCasedProperties, Dn as MergeDeep, Dr as UnknownArray, Dt as Asyncify, E as KebabCasedProperties, En as MergeExclusive, Er as IsFloat, Et as Jsonify, F as ExclusifyUnion, Fn as TaggedUnion, Fr as IfEmptyObject, Ft as FixedLengthArray, G as SharedUnionFields, Gn as GreaterThan, Gr as UppercaseLetter, Gt as ConditionalExcept, H as IfNull, Hn as Except, Hr as Alphanumeric, Ht as ConditionalPickDeep, I as IsNullable, In as UnknownMap, Ir as EmptyObject, It as StringSlice, J as ArrayIndices, Jn as Or, Jr as JsonPrimitive, Jt as IsTuple, K as SetFieldType, Kn as And, Kr as JsonArray, Kt as ConditionalKeys, L as IsOptional, Ln as UnknownSet, Lr as IsEmptyObject, Lt as ArraySlice, M as CamelCasedProperties, Mn as ConditionalSimplifyDeep, Mr as OptionalKeysOf, Mt as IterableElement, N as CamelCase, Nn as WritableDeep, Nr as IsOptionalKeyOf, Nt as MultidimensionalReadonlyArray, O as KebabCase, On as MergeDeepOptions, Or as If, Ot as SetParameterType, P as Words, Pn as Writable, Pr as IsAny, Pt as MultidimensionalArray, Q as IntClosedRange, Qn as IsEqual, Qr as Class, Qt as SetNonNullableDeep, R as IsUppercase, Rn as UnknownRecord, Rr as DistributedPick, Rt as LessThanOrEqual, S as PascalCasedProperties, Sn as IsUnion, Sr as NonNegative, St as StructuredCloneable, T as DelimiterCasedPropertiesDeep, Tn as RequireExactlyOne, Tr as IsInteger, Tt as Jsonifiable, U as SharedUnionFieldsDeep, Un as LessThan, Ur as DigitCharacter, Ut as ConditionalPickDeepOptions, V as IsUndefined, Vn as RequireAtLeastOne, Vr as UnionToIntersection, Vt as Stringified, W as AllUnionFields, Wn as GreaterThanOrEqual, Wr as LowercaseLetter, Wt as ConditionalPick, X as IfNever, Xn as PickIndexSignature, Xr as AbstractClass, Xt as AsyncReturnType, Y as IfUnknown, Yn as Merge, Yr as JsonValue, Yt as ExtendsStrict, Z as IfAny, Zn as OmitIndexSignature, Zr as AbstractConstructor, Zt as ValueOf, _ as ScreamingSnakeCase, _n as Subtract, _r as IsNegative, _t as KeyAsString, a as ExcludeStrict, ai as Fn, an as Arrayable, ar as IsLiteral, at as HasWritableKeys, b as SnakeCase, bn as PartialDeepOptions, br as NegativeInfinity, bt as Schema, c as PackageJson, ci as SyncFnWithThis, cn as UndefinedOnPartialDeep, cr as IsSymbolLiteral, ct as HasReadonlyKeys, d as LastArrayElement, dn as OmitDeep, dr as Tagged, dt as IsRequiredKeyOf, ei as TypedArray, en as SetRequiredDeep, er as Trim, et as TupleToUnion, f as Get, fn as UnionToTuple, fr as UnwrapOpaque, ft as HasOptionalKeys, g as Split, gn as Paths, gr as Integer, gt as ArrayElement, h as Replace, hn as PickDeep, hr as Float, ht as Exact, i as OmitByKey, ii as AsyncFnWithThis, in as InvariantOf, ir as IsBooleanLiteral, it as Spread, j as CamelCasedPropertiesDeep, jn as NonEmptyTuple, jr as RequiredKeysOf, jt as Entry, k as DelimiterCase, kn as SimplifyDeep, kr as IsNever, kt as SetReturnType, l as GlobalThis, ln as PartialOnUndefinedDeep, lr as GetTagMetadata, lt as ReadonlyKeysOf, m as StringRepeat, mn as ArraySplice, mr as Finite, mt as ReadonlyTuple, n as SetNullable, ni as Nullable, nn as SetReadonly, nr as IsUnknown, nt as ExtractRestElement, o as ExtractStrict, oi as FnWithThis, on as Promisable, or as IsNumericLiteral, ot as IsWritableKeyOf, p as Includes, pn as LiteralUnion, pr as UnwrapTagged, pt as OverrideProperties, q as ArrayValues, qn as AllExtend, qr as JsonObject, qt as TupleToObject, r as Optional, ri as AsyncFn, rn as SetOptional, rr as IsNull, rt as SplitOnRestElement, s as TsConfigJson, si as SyncFn, sn as ReadonlyDeep, sr as IsStringLiteral, st as WritableKeysOf, t as YieldType, ti as Primitive, tn as SetRequired, tr as TupleOf, tt as ExcludeRestElement, u as ConditionalSimplify, un as PartialOnUndefinedDeepOptions, ur as Opaque, ut as IsReadonlyKeyOf, v as SnakeCasedPropertiesDeep, vn as RequiredDeep, vr as Negative, vt as LiteralToPrimitiveDeep, w as KebabCasedPropertiesDeep, wn as RequireAllOrNone, wr as PositiveInfinity, wt as FindGlobalType, x as PascalCasedPropertiesDeep, xn as SingleKeyObject, xr as NegativeInteger, xt as SchemaOptions, y as SnakeCasedProperties, yn as PartialDeep, yr as NegativeFloat, yt as LiteralToPrimitive, z as IsLowercase, zn as NonEmptyString, zr as DistributedOmit, zt as Sum } from "./chunks/chunk-a07ed28f.js";
1
+ import { $ as IntRange, $n as Simplify, $r as Constructor, $t as SetNonNullable, A as RemovePrefix, An as ArrayTail, Ar as HasRequiredKeys, At as Entries, B as Xor, Bn as NonEmptyObject, Br as KeysOfUnion, Bt as Join, C as PascalCase, Cn as RequireOneOrNone, Cr as NonNegativeInteger, Ct as FindGlobalInstanceType, D as DelimiterCasedProperties, Dn as MergeDeep, Dr as UnknownArray, Dt as Asyncify, E as KebabCasedProperties, En as MergeExclusive, Er as IsFloat, Et as Jsonify, F as ExclusifyUnion, Fn as TaggedUnion, Fr as IfEmptyObject, Ft as FixedLengthArray, G as SharedUnionFields, Gn as GreaterThan, Gr as UppercaseLetter, Gt as ConditionalExcept, H as IfNull, Hn as Except, Hr as Alphanumeric, Ht as ConditionalPickDeep, I as IsNullable, In as UnknownMap, Ir as EmptyObject, It as StringSlice, J as ArrayIndices, Jn as Or, Jr as JsonPrimitive, Jt as IsTuple, K as SetFieldType, Kn as And, Kr as JsonArray, Kt as ConditionalKeys, L as IsOptional, Ln as UnknownSet, Lr as IsEmptyObject, Lt as ArraySlice, M as CamelCasedProperties, Mn as ConditionalSimplifyDeep, Mr as OptionalKeysOf, Mt as IterableElement, N as CamelCase, Nn as WritableDeep, Nr as IsOptionalKeyOf, Nt as MultidimensionalReadonlyArray, O as KebabCase, On as MergeDeepOptions, Or as If, Ot as SetParameterType, P as Words, Pn as Writable, Pr as IsAny, Pt as MultidimensionalArray, Q as IntClosedRange, Qn as IsEqual, Qr as Class, Qt as SetNonNullableDeep, R as IsUppercase, Rn as UnknownRecord, Rr as DistributedPick, Rt as LessThanOrEqual, S as PascalCasedProperties, Sn as IsUnion, Sr as NonNegative, St as StructuredCloneable, T as DelimiterCasedPropertiesDeep, Tn as RequireExactlyOne, Tr as IsInteger, Tt as Jsonifiable, U as SharedUnionFieldsDeep, Un as LessThan, Ur as DigitCharacter, Ut as ConditionalPickDeepOptions, V as IsUndefined, Vn as RequireAtLeastOne, Vr as UnionToIntersection, Vt as Stringified, W as AllUnionFields, Wn as GreaterThanOrEqual, Wr as LowercaseLetter, Wt as ConditionalPick, X as IfNever, Xn as PickIndexSignature, Xr as AbstractClass, Xt as AsyncReturnType, Y as IfUnknown, Yn as Merge, Yr as JsonValue, Yt as ExtendsStrict, Z as IfAny, Zn as OmitIndexSignature, Zr as AbstractConstructor, Zt as ValueOf, _ as ScreamingSnakeCase, _n as Subtract, _r as IsNegative, _t as KeyAsString, a as ExcludeStrict, ai as Fn, an as Arrayable, ar as IsLiteral, at as HasWritableKeys, b as SnakeCase, bn as PartialDeepOptions, br as NegativeInfinity, bt as Schema, c as PackageJson, ci as SyncFnWithThis, cn as UndefinedOnPartialDeep, cr as IsSymbolLiteral, ct as HasReadonlyKeys, d as LastArrayElement, dn as OmitDeep, dr as Tagged, dt as IsRequiredKeyOf, ei as TypedArray, en as SetRequiredDeep, er as Trim, et as TupleToUnion, f as Get, fn as UnionToTuple, fr as UnwrapOpaque, ft as HasOptionalKeys, g as Split, gn as Paths, gr as Integer, gt as ArrayElement, h as Replace, hn as PickDeep, hr as Float, ht as Exact, i as OmitByKey, ii as AsyncFnWithThis, in as InvariantOf, ir as IsBooleanLiteral, it as Spread, j as CamelCasedPropertiesDeep, jn as NonEmptyTuple, jr as RequiredKeysOf, jt as Entry, k as DelimiterCase, kn as SimplifyDeep, kr as IsNever, kt as SetReturnType, l as GlobalThis, ln as PartialOnUndefinedDeep, lr as GetTagMetadata, lt as ReadonlyKeysOf, m as StringRepeat, mn as ArraySplice, mr as Finite, mt as ReadonlyTuple, n as SetNullable, ni as Nullable, nn as SetReadonly, nr as IsUnknown, nt as ExtractRestElement, o as ExtractStrict, oi as FnWithThis, on as Promisable, or as IsNumericLiteral, ot as IsWritableKeyOf, p as Includes, pn as LiteralUnion, pr as UnwrapTagged, pt as OverrideProperties, q as ArrayValues, qn as AllExtend, qr as JsonObject, qt as TupleToObject, r as Optional, ri as AsyncFn, rn as SetOptional, rr as IsNull, rt as SplitOnRestElement, s as TsConfigJson, si as SyncFn, sn as ReadonlyDeep, sr as IsStringLiteral, st as WritableKeysOf, t as YieldType, ti as Primitive, tn as SetRequired, tr as TupleOf, tt as ExcludeRestElement, u as ConditionalSimplify, un as PartialOnUndefinedDeepOptions, ur as Opaque, ut as IsReadonlyKeyOf, v as SnakeCasedPropertiesDeep, vn as RequiredDeep, vr as Negative, vt as LiteralToPrimitiveDeep, w as KebabCasedPropertiesDeep, wn as RequireAllOrNone, wr as PositiveInfinity, wt as FindGlobalType, x as PascalCasedPropertiesDeep, xn as SingleKeyObject, xr as NegativeInteger, xt as SchemaOptions, y as SnakeCasedProperties, yn as PartialDeep, yr as NegativeFloat, yt as LiteralToPrimitive, z as IsLowercase, zn as NonEmptyString, zr as DistributedOmit, zt as Sum } from "./chunks/chunk-566a516c.js";
2
2
  export { AbstractClass, AbstractConstructor, AllExtend, AllUnionFields, Alphanumeric, And, ArrayElement, ArrayIndices, ArraySlice, ArraySplice, ArrayTail, ArrayValues, Arrayable, AsyncFn, AsyncFnWithThis, AsyncReturnType, Asyncify, CamelCase, CamelCasedProperties, CamelCasedPropertiesDeep, Class, ConditionalExcept, ConditionalKeys, ConditionalPick, ConditionalPickDeep, ConditionalPickDeepOptions, ConditionalSimplify, ConditionalSimplifyDeep, Constructor, DelimiterCase, DelimiterCasedProperties, DelimiterCasedPropertiesDeep, DigitCharacter, DistributedOmit, DistributedPick, EmptyObject, Entries, Entry, Exact, Except, ExcludeRestElement, ExcludeStrict, ExclusifyUnion, ExtendsStrict, ExtractRestElement, ExtractStrict, FindGlobalInstanceType, FindGlobalType, Finite, FixedLengthArray, Float, Fn, FnWithThis, Get, GetTagMetadata, GlobalThis, GreaterThan, GreaterThanOrEqual, HasOptionalKeys, HasReadonlyKeys, HasRequiredKeys, HasWritableKeys, If, IfAny, IfEmptyObject, IfNever, IfNull, IfUnknown, Includes, IntClosedRange, IntRange, Integer, InvariantOf, IsAny, IsBooleanLiteral, IsEmptyObject, IsEqual, IsFloat, IsInteger, IsLiteral, IsLowercase, IsNegative, IsNever, IsNull, IsNullable, IsNumericLiteral, IsOptional, IsOptionalKeyOf, IsReadonlyKeyOf, IsRequiredKeyOf, IsStringLiteral, IsSymbolLiteral, IsTuple, IsUndefined, IsUnion, IsUnknown, IsUppercase, IsWritableKeyOf, IterableElement, Join, JsonArray, JsonObject, JsonPrimitive, JsonValue, Jsonifiable, Jsonify, KebabCase, KebabCasedProperties, KebabCasedPropertiesDeep, KeyAsString, KeysOfUnion, LastArrayElement, LessThan, LessThanOrEqual, LiteralToPrimitive, LiteralToPrimitiveDeep, LiteralUnion, LowercaseLetter, Merge, MergeDeep, MergeDeepOptions, MergeExclusive, MultidimensionalArray, MultidimensionalReadonlyArray, Negative, NegativeFloat, NegativeInfinity, NegativeInteger, NonEmptyObject, NonEmptyString, NonEmptyTuple, NonNegative, NonNegativeInteger, Nullable, OmitByKey, OmitDeep, OmitIndexSignature, Opaque, Optional, OptionalKeysOf, Or, OverrideProperties, PackageJson, PartialDeep, PartialDeepOptions, PartialOnUndefinedDeep, PartialOnUndefinedDeepOptions, PascalCase, PascalCasedProperties, PascalCasedPropertiesDeep, Paths, PickDeep, PickIndexSignature, PositiveInfinity, Primitive, Promisable, ReadonlyDeep, ReadonlyKeysOf, ReadonlyTuple, RemovePrefix, Replace, RequireAllOrNone, RequireAtLeastOne, RequireExactlyOne, RequireOneOrNone, RequiredDeep, RequiredKeysOf, Schema, SchemaOptions, ScreamingSnakeCase, SetFieldType, SetNonNullable, SetNonNullableDeep, SetNullable, SetOptional, SetParameterType, SetReadonly, SetRequired, SetRequiredDeep, SetReturnType, SharedUnionFields, SharedUnionFieldsDeep, Simplify, SimplifyDeep, SingleKeyObject, SnakeCase, SnakeCasedProperties, SnakeCasedPropertiesDeep, Split, SplitOnRestElement, Spread, StringRepeat, StringSlice, Stringified, StructuredCloneable, Subtract, Sum, SyncFn, SyncFnWithThis, Tagged, TaggedUnion, Trim, TsConfigJson, TupleOf, TupleToObject, TupleToUnion, TypedArray, UndefinedOnPartialDeep, UnionToIntersection, UnionToTuple, UnknownArray, UnknownMap, UnknownRecord, UnknownSet, UnwrapOpaque, UnwrapTagged, UppercaseLetter, ValueOf, Words, Writable, WritableDeep, WritableKeysOf, Xor, YieldType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodbyenjn/utils",
3
- "version": "26.1.3",
3
+ "version": "26.1.4",
4
4
  "description": "GoodbyeNJN's utils for typescript and javascript",
5
5
  "keywords": [
6
6
  "utils",
@@ -35,6 +35,10 @@
35
35
  "types": "./dist/result.d.ts",
36
36
  "import": "./dist/result.js"
37
37
  },
38
+ "./shell": {
39
+ "types": "./dist/shell.d.ts",
40
+ "import": "./dist/shell.js"
41
+ },
38
42
  "./types": {
39
43
  "types": "./dist/types.d.ts"
40
44
  },