@willbooster/shared-lib-node 8.1.7 → 8.2.1

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.
package/dist/errno.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";exports.isErrnoException=function(r){return r instanceof Error&&"code"in r};
2
+ //# sourceMappingURL=errno.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errno.cjs","sources":["../src/errno.ts"],"sourcesContent":["export function isErrnoException(error: unknown): error is NodeJS.ErrnoException {\n return error instanceof Error && 'code' in error;\n}\n"],"names":["error","Error"],"mappings":"sCAAO,SAA0BA,GAC/B,OAAOA,aAAiBC,OAAS,SAAUD,CAC7C"}
@@ -0,0 +1 @@
1
+ export declare function isErrnoException(error: unknown): error is NodeJS.ErrnoException;
package/dist/errno.js ADDED
@@ -0,0 +1,2 @@
1
+ function n(n){return n instanceof Error&&"code"in n}export{n as isErrnoException};
2
+ //# sourceMappingURL=errno.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errno.js","sources":["../src/errno.ts"],"sourcesContent":["export function isErrnoException(error: unknown): error is NodeJS.ErrnoException {\n return error instanceof Error && 'code' in error;\n}\n"],"names":["isErrnoException","error","Error"],"mappings":"AAAO,SAASA,EAAiBC,GAC/B,OAAOA,aAAiBC,OAAS,SAAUD,CAC7C"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./env.cjs"),r=require("./exists.cjs"),s=require("./hash.cjs"),n=require("./spawn.cjs");exports.readAndApplyEnvironmentVariables=e.readAndApplyEnvironmentVariables,exports.readEnvironmentVariables=e.readEnvironmentVariables,exports.removeNpmAndYarnEnvironmentVariables=e.removeNpmAndYarnEnvironmentVariables,exports.yargsOptionsBuilderForEnv=e.yargsOptionsBuilderForEnv,exports.existsAsync=r.existsAsync,exports.calculateHashFromFiles=s.calculateHashFromFiles,exports.canSkipSeed=s.canSkipSeed,exports.updateHashFromFiles=s.updateHashFromFiles,exports.spawnAsync=n.spawnAsync;
1
+ "use strict";var e=require("./env.cjs"),r=require("./exists.cjs"),s=require("./hash.cjs"),n=require("./spawn.cjs"),a=require("./treeKill.cjs");exports.readAndApplyEnvironmentVariables=e.readAndApplyEnvironmentVariables,exports.readEnvironmentVariables=e.readEnvironmentVariables,exports.removeNpmAndYarnEnvironmentVariables=e.removeNpmAndYarnEnvironmentVariables,exports.yargsOptionsBuilderForEnv=e.yargsOptionsBuilderForEnv,exports.existsAsync=r.existsAsync,exports.calculateHashFromFiles=s.calculateHashFromFiles,exports.canSkipSeed=s.canSkipSeed,exports.updateHashFromFiles=s.updateHashFromFiles,exports.spawnAsync=n.spawnAsync,exports.treeKill=a.treeKill;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export type { EnvReaderOptions } from './env.js';
3
3
  export { existsAsync } from './exists.js';
4
4
  export { calculateHashFromFiles, canSkipSeed, updateHashFromFiles } from './hash.js';
5
5
  export { spawnAsync } from './spawn.js';
6
+ export { treeKill } from './treeKill.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export{readAndApplyEnvironmentVariables,readEnvironmentVariables,removeNpmAndYarnEnvironmentVariables,yargsOptionsBuilderForEnv}from"./env.js";export{existsAsync}from"./exists.js";export{calculateHashFromFiles,canSkipSeed,updateHashFromFiles}from"./hash.js";export{spawnAsync}from"./spawn.js";
1
+ export{readAndApplyEnvironmentVariables,readEnvironmentVariables,removeNpmAndYarnEnvironmentVariables,yargsOptionsBuilderForEnv}from"./env.js";export{existsAsync}from"./exists.js";export{calculateHashFromFiles,canSkipSeed,updateHashFromFiles}from"./hash.js";export{spawnAsync}from"./spawn.js";export{treeKill}from"./treeKill.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";exports.buildChildrenByParentMap=function(t){const e=new Map;for(const n of t.split("\n")){const t=/^\s*(\d+)\s+(\d+)\s*$/.exec(n);if(!t)continue;const s=Number(t[1]),o=Number(t[2]),c=e.get(o);c?c.push(s):e.set(o,[s])}return e},exports.collectDescendantPids=function(t,e){const n=[],s=[...e.get(t)??[]];let o=0;for(;o<s.length;){const t=s[o];o+=1,n.push(t),s.push(...e.get(t)??[])}return n};
2
+ //# sourceMappingURL=processTree.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processTree.cjs","sources":["../src/processTree.ts"],"sourcesContent":["export function buildChildrenByParentMap(psOutput: string): Map<number, number[]> {\n const childrenByParent = new Map<number, number[]>();\n for (const line of psOutput.split('\\n')) {\n const matched = /^\\s*(\\d+)\\s+(\\d+)\\s*$/.exec(line);\n if (!matched) {\n continue;\n }\n\n const childPid = Number(matched[1]);\n const parentPid = Number(matched[2]);\n const children = childrenByParent.get(parentPid);\n if (children) {\n children.push(childPid);\n } else {\n childrenByParent.set(parentPid, [childPid]);\n }\n }\n return childrenByParent;\n}\n\nexport function collectDescendantPids(rootPid: number, childrenByParent: Map<number, number[]>): number[] {\n const descendants: number[] = [];\n const queue = [...(childrenByParent.get(rootPid) ?? [])];\n let index = 0;\n while (index < queue.length) {\n const pid = queue[index] as number;\n index += 1;\n descendants.push(pid);\n queue.push(...(childrenByParent.get(pid) ?? []));\n }\n return descendants;\n}\n"],"names":["psOutput","childrenByParent","Map","line","split","matched","exec","childPid","Number","parentPid","children","get","push","set","rootPid","descendants","queue","index","length","pid"],"mappings":"8CAAO,SAAkCA,GACvC,MAAMC,EAAmB,IAAIC,IAC7B,IAAK,MAAMC,KAAQH,EAASI,MAAM,MAAO,CACvC,MAAMC,EAAU,wBAAwBC,KAAKH,GAC7C,IAAKE,EACH,SAGF,MAAME,EAAWC,OAAOH,EAAQ,IAC1BI,EAAYD,OAAOH,EAAQ,IAC3BK,EAAWT,EAAiBU,IAAIF,GAClCC,EACFA,EAASE,KAAKL,GAEdN,EAAiBY,IAAIJ,EAAW,CAACF,GAErC,CACA,OAAON,CACT,gCAEO,SAA+Ba,EAAiBb,GACrD,MAAMc,EAAwB,GACxBC,EAAQ,IAAKf,EAAiBU,IAAIG,IAAY,IACpD,IAAIG,EAAQ,EACZ,KAAOA,EAAQD,EAAME,QAAQ,CAC3B,MAAMC,EAAMH,EAAMC,GAClBA,GAAS,EACTF,EAAYH,KAAKO,GACjBH,EAAMJ,QAASX,EAAiBU,IAAIQ,IAAQ,GAC9C,CACA,OAAOJ,CACT"}
@@ -0,0 +1,2 @@
1
+ export declare function buildChildrenByParentMap(psOutput: string): Map<number, number[]>;
2
+ export declare function collectDescendantPids(rootPid: number, childrenByParent: Map<number, number[]>): number[];
@@ -0,0 +1,2 @@
1
+ function t(t){const n=new Map;for(const e of t.split("\n")){const t=/^\s*(\d+)\s+(\d+)\s*$/.exec(e);if(!t)continue;const s=Number(t[1]),o=Number(t[2]),c=n.get(o);c?c.push(s):n.set(o,[s])}return n}function n(t,n){const e=[],s=[...n.get(t)??[]];let o=0;for(;o<s.length;){const t=s[o];o+=1,e.push(t),s.push(...n.get(t)??[])}return e}export{t as buildChildrenByParentMap,n as collectDescendantPids};
2
+ //# sourceMappingURL=processTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processTree.js","sources":["../src/processTree.ts"],"sourcesContent":["export function buildChildrenByParentMap(psOutput: string): Map<number, number[]> {\n const childrenByParent = new Map<number, number[]>();\n for (const line of psOutput.split('\\n')) {\n const matched = /^\\s*(\\d+)\\s+(\\d+)\\s*$/.exec(line);\n if (!matched) {\n continue;\n }\n\n const childPid = Number(matched[1]);\n const parentPid = Number(matched[2]);\n const children = childrenByParent.get(parentPid);\n if (children) {\n children.push(childPid);\n } else {\n childrenByParent.set(parentPid, [childPid]);\n }\n }\n return childrenByParent;\n}\n\nexport function collectDescendantPids(rootPid: number, childrenByParent: Map<number, number[]>): number[] {\n const descendants: number[] = [];\n const queue = [...(childrenByParent.get(rootPid) ?? [])];\n let index = 0;\n while (index < queue.length) {\n const pid = queue[index] as number;\n index += 1;\n descendants.push(pid);\n queue.push(...(childrenByParent.get(pid) ?? []));\n }\n return descendants;\n}\n"],"names":["buildChildrenByParentMap","psOutput","childrenByParent","Map","line","split","matched","exec","childPid","Number","parentPid","children","get","push","set","collectDescendantPids","rootPid","descendants","queue","index","length","pid"],"mappings":"AAAO,SAASA,EAAyBC,GACvC,MAAMC,EAAmB,IAAIC,IAC7B,IAAK,MAAMC,KAAQH,EAASI,MAAM,MAAO,CACvC,MAAMC,EAAU,wBAAwBC,KAAKH,GAC7C,IAAKE,EACH,SAGF,MAAME,EAAWC,OAAOH,EAAQ,IAC1BI,EAAYD,OAAOH,EAAQ,IAC3BK,EAAWT,EAAiBU,IAAIF,GAClCC,EACFA,EAASE,KAAKL,GAEdN,EAAiBY,IAAIJ,EAAW,CAACF,GAErC,CACA,OAAON,CACT,CAEO,SAASa,EAAsBC,EAAiBd,GACrD,MAAMe,EAAwB,GACxBC,EAAQ,IAAKhB,EAAiBU,IAAII,IAAY,IACpD,IAAIG,EAAQ,EACZ,KAAOA,EAAQD,EAAME,QAAQ,CAC3B,MAAMC,EAAMH,EAAMC,GAClBA,GAAS,EACTF,EAAYJ,KAAKQ,GACjBH,EAAML,QAASX,EAAiBU,IAAIS,IAAQ,GAC9C,CACA,OAAOJ,CACT"}
package/dist/spawn.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("node:child_process"),r=require("tree-kill");exports.spawnAsync=async function(s,t,o){return new Promise((n,i)=>{try{const d=e.spawn(s,t??[],o??{});d.stdout?.setEncoding?.("utf8"),d.stderr?.setEncoding?.("utf8");let c="",p="";d.stdout?.on("data",e=>{c+=e,o?.printingStdout&&process.stdout.write(e)}),d.stderr?.on("data",e=>{o?.mergeOutAndError?c+=e:p+=e,o?.printingStderr&&process.stderr.write(e)});let u=!1;const l=()=>{!u&&d.pid&&(u=!0,o?.verbose&&console.info(`treeKill(${d.pid})`),r(d.pid))};o?.killOnExit&&(process.on("beforeExit",l),process.on("SIGINT",l)),d.on("error",e=>{process.removeListener("beforeExit",l),process.removeListener("SIGINT",l),d.removeAllListeners("close"),i(e)}),d.on("close",(e,r)=>{process.removeListener("beforeExit",l),process.removeListener("SIGINT",l),void 0===d.pid?i(new Error("Process has no pid.")):n({pid:d.pid,stdout:c,stderr:p,status:e,signal:r})}),o?.input&&(d.stdin?.write(o.input),d.stdin?.end())}catch(e){i(e)}})};
1
+ "use strict";var e=require("node:child_process"),r=require("./treeKill.cjs");exports.spawnAsync=async function(s,t,o){return new Promise((n,i)=>{try{const c=e.spawn(s,t??[],o??{});c.stdout?.setEncoding?.("utf8"),c.stderr?.setEncoding?.("utf8");let d="",p="";c.stdout?.on("data",e=>{d+=e,o?.printingStdout&&process.stdout.write(e)}),c.stderr?.on("data",e=>{o?.mergeOutAndError?d+=e:p+=e,o?.printingStderr&&process.stderr.write(e)});let l=!1;const a=()=>{if(!l&&c.pid){l=!0,o?.verbose&&console.info(`treeKill(${c.pid})`);try{r.treeKill(c.pid)}catch(e){o?.verbose&&console.warn(`Failed to treeKill(${c.pid})`,e)}}},u="win32"===process.platform?["SIGINT","SIGTERM"]:["SIGINT","SIGTERM","SIGQUIT"],f=new Map,w=()=>{process.removeListener("beforeExit",a);for(const[e,r]of f)process.removeListener(e,r);f.clear()};if(o?.killOnExit){process.on("beforeExit",a);for(const e of u){const r=()=>{a(),w(),0===process.listenerCount(e)&&process.kill(process.pid,e)};f.set(e,r),process.on(e,r)}}c.on("error",e=>{w(),c.removeAllListeners("close"),i(e)}),c.on("close",(e,r)=>{w(),void 0===c.pid?i(new Error("Process has no pid.")):n({pid:c.pid,stdout:d,stderr:p,status:e,signal:r})}),o?.input&&(c.stdin?.write(o.input),c.stdin?.end())}catch(e){i(e)}})};
2
2
  //# sourceMappingURL=spawn.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.cjs","sources":["../src/spawn.ts"],"sourcesContent":["import type {\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'node:child_process';\nimport { spawn } from 'node:child_process';\n\nimport treeKill from 'tree-kill';\n\n/**\n * Return type for spawnAsync function, based on SpawnSyncReturns but without output and error properties\n */\nexport type SpawnAsyncReturns = Omit<SpawnSyncReturns<string>, 'output' | 'error'>;\n\n/**\n * Options for spawnAsync function, extending various Node.js spawn options with additional functionality\n */\nexport type SpawnAsyncOptions = (\n | SpawnOptionsWithoutStdio\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n | SpawnOptions\n) & {\n /** Input string to write to the spawned process's stdin */\n input?: string;\n /** If true, stderr output will be merged into stdout */\n mergeOutAndError?: boolean;\n /** If true, the spawned process will be killed when the parent process exits */\n killOnExit?: boolean;\n /** If true, enables verbose logging of process operations */\n verbose?: boolean;\n /** If true, stdout data will be printed to console as it's received */\n printingStdout?: boolean;\n /** If true, stderr data will be printed to console as it's received */\n printingStderr?: boolean;\n};\n\n/**\n * Spawns a child process asynchronously and returns a promise that resolves with the process results\n *\n * This function provides a Promise-based wrapper around Node.js's spawn function with additional features:\n * - Automatic encoding of stdout/stderr as UTF-8\n * - Option to merge stderr into stdout\n * - Option to automatically kill the process on parent exit\n * - Option to provide input via stdin\n * - Verbose logging capability\n *\n * @param command - The command to run\n * @param args - List of string arguments\n * @param options - Configuration options for the spawned process\n * @returns Promise that resolves with the process results including pid, stdout, stderr, status, and signal\n * @throws Will reject the promise if the process fails to spawn or encounters an error\n *\n * @example\n * ```typescript\n * const result = await spawnAsync('ls', ['-la'], { verbose: true });\n * console.log(result.stdout);\n * ```\n */\nexport async function spawnAsync(\n command: string,\n args?: readonly string[],\n options?: SpawnAsyncOptions\n): Promise<SpawnAsyncReturns> {\n return new Promise((resolve, reject) => {\n try {\n const proc = spawn(command, args ?? [], options ?? {});\n // `setEncoding` is undefined in Bun\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n proc.stdout?.setEncoding?.('utf8');\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n proc.stderr?.setEncoding?.('utf8');\n\n let stdout = '';\n let stderr = '';\n proc.stdout?.on('data', (data: string) => {\n stdout += data;\n if (options?.printingStdout) {\n process.stdout.write(data);\n }\n });\n proc.stderr?.on('data', (data: string) => {\n if (options?.mergeOutAndError) {\n stdout += data;\n } else {\n stderr += data;\n }\n if (options?.printingStderr) {\n process.stderr.write(data);\n }\n });\n\n let stopped = false;\n const stopProcess = (): void => {\n if (stopped || !proc.pid) return;\n\n stopped = true;\n if (options?.verbose) {\n console.info(`treeKill(${proc.pid})`);\n }\n treeKill(proc.pid);\n };\n if (options?.killOnExit) {\n process.on('beforeExit', stopProcess);\n process.on('SIGINT', stopProcess);\n }\n\n proc.on('error', (error) => {\n process.removeListener('beforeExit', stopProcess);\n process.removeListener('SIGINT', stopProcess);\n proc.removeAllListeners('close');\n reject(error);\n });\n proc.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\n process.removeListener('beforeExit', stopProcess);\n process.removeListener('SIGINT', stopProcess);\n if (proc.pid === undefined) {\n reject(new Error('Process has no pid.'));\n } else {\n resolve({\n pid: proc.pid,\n stdout,\n stderr,\n status: code,\n signal,\n });\n }\n });\n\n if (options?.input) {\n proc.stdin?.write(options.input);\n proc.stdin?.end();\n }\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n }\n });\n}\n"],"names":["async","command","args","options","Promise","resolve","reject","proc","spawn","stdout","setEncoding","stderr","on","data","printingStdout","process","write","mergeOutAndError","printingStderr","stopped","stopProcess","pid","verbose","console","info","treeKill","killOnExit","error","removeListener","removeAllListeners","code","signal","undefined","Error","status","input","stdin","end"],"mappings":"2FAoEOA,eACLC,EACAC,EACAC,GAEA,OAAO,IAAIC,QAAQ,CAACC,EAASC,KAC3B,IACE,MAAMC,EAAOC,EAAAA,MAAMP,EAASC,GAAQ,GAAIC,GAAW,IAGnDI,EAAKE,QAAQC,cAAc,QAE3BH,EAAKI,QAAQD,cAAc,QAE3B,IAAID,EAAS,GACTE,EAAS,GACbJ,EAAKE,QAAQG,GAAG,OAASC,IACvBJ,GAAUI,EACNV,GAASW,gBACXC,QAAQN,OAAOO,MAAMH,KAGzBN,EAAKI,QAAQC,GAAG,OAASC,IACnBV,GAASc,iBACXR,GAAUI,EAEVF,GAAUE,EAERV,GAASe,gBACXH,QAAQJ,OAAOK,MAAMH,KAIzB,IAAIM,GAAU,EACd,MAAMC,EAAcA,MACdD,GAAYZ,EAAKc,MAErBF,GAAU,EACNhB,GAASmB,SACXC,QAAQC,KAAK,YAAYjB,EAAKc,QAEhCI,EAASlB,EAAKc,OAEZlB,GAASuB,aACXX,QAAQH,GAAG,aAAcQ,GACzBL,QAAQH,GAAG,SAAUQ,IAGvBb,EAAKK,GAAG,QAAUe,IAChBZ,QAAQa,eAAe,aAAcR,GACrCL,QAAQa,eAAe,SAAUR,GACjCb,EAAKsB,mBAAmB,SACxBvB,EAAOqB,KAETpB,EAAKK,GAAG,QAAS,CAACkB,EAAqBC,KACrChB,QAAQa,eAAe,aAAcR,GACrCL,QAAQa,eAAe,SAAUR,QAChBY,IAAbzB,EAAKc,IACPf,EAAO,IAAI2B,MAAM,wBAEjB5B,EAAQ,CACNgB,IAAKd,EAAKc,IACVZ,SACAE,SACAuB,OAAQJ,EACRC,aAKF5B,GAASgC,QACX5B,EAAK6B,OAAOpB,MAAMb,EAAQgC,OAC1B5B,EAAK6B,OAAOC,MAEhB,CAAE,MAAOV,GAEPrB,EAAOqB,EACT,GAEJ"}
1
+ {"version":3,"file":"spawn.cjs","sources":["../src/spawn.ts"],"sourcesContent":["import type {\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'node:child_process';\nimport { spawn } from 'node:child_process';\n\nimport { treeKill } from './treeKill.js';\n\n/**\n * Return type for spawnAsync function, based on SpawnSyncReturns but without output and error properties\n */\nexport type SpawnAsyncReturns = Omit<SpawnSyncReturns<string>, 'output' | 'error'>;\n\n/**\n * Options for spawnAsync function, extending various Node.js spawn options with additional functionality\n */\nexport type SpawnAsyncOptions = (\n | SpawnOptionsWithoutStdio\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n | SpawnOptions\n) & {\n /** Input string to write to the spawned process's stdin */\n input?: string;\n /** If true, stderr output will be merged into stdout */\n mergeOutAndError?: boolean;\n /** If true, the spawned process will be killed when the parent process exits */\n killOnExit?: boolean;\n /** If true, enables verbose logging of process operations */\n verbose?: boolean;\n /** If true, stdout data will be printed to console as it's received */\n printingStdout?: boolean;\n /** If true, stderr data will be printed to console as it's received */\n printingStderr?: boolean;\n};\n\n/**\n * Spawns a child process asynchronously and returns a promise that resolves with the process results\n *\n * This function provides a Promise-based wrapper around Node.js's spawn function with additional features:\n * - Automatic encoding of stdout/stderr as UTF-8\n * - Option to merge stderr into stdout\n * - Option to automatically kill the process on parent exit\n * - Option to provide input via stdin\n * - Verbose logging capability\n *\n * @param command - The command to run\n * @param args - List of string arguments\n * @param options - Configuration options for the spawned process\n * @returns Promise that resolves with the process results including pid, stdout, stderr, status, and signal\n * @throws Will reject the promise if the process fails to spawn or encounters an error\n *\n * @example\n * ```typescript\n * const result = await spawnAsync('ls', ['-la'], { verbose: true });\n * console.log(result.stdout);\n * ```\n */\nexport async function spawnAsync(\n command: string,\n args?: readonly string[],\n options?: SpawnAsyncOptions\n): Promise<SpawnAsyncReturns> {\n return new Promise((resolve, reject) => {\n try {\n const proc = spawn(command, args ?? [], options ?? {});\n // `setEncoding` is undefined in Bun\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n proc.stdout?.setEncoding?.('utf8');\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n proc.stderr?.setEncoding?.('utf8');\n\n let stdout = '';\n let stderr = '';\n proc.stdout?.on('data', (data: string) => {\n stdout += data;\n if (options?.printingStdout) {\n process.stdout.write(data);\n }\n });\n proc.stderr?.on('data', (data: string) => {\n if (options?.mergeOutAndError) {\n stdout += data;\n } else {\n stderr += data;\n }\n if (options?.printingStderr) {\n process.stderr.write(data);\n }\n });\n\n let stopped = false;\n const stopProcess = (): void => {\n if (stopped || !proc.pid) return;\n\n stopped = true;\n if (options?.verbose) {\n console.info(`treeKill(${proc.pid})`);\n }\n try {\n treeKill(proc.pid);\n } catch (error) {\n if (options?.verbose) {\n console.warn(`Failed to treeKill(${proc.pid})`, error);\n }\n }\n };\n const cleanupSignals: NodeJS.Signals[] =\n process.platform === 'win32' ? ['SIGINT', 'SIGTERM'] : ['SIGINT', 'SIGTERM', 'SIGQUIT'];\n const signalHandlers = new Map<NodeJS.Signals, () => void>();\n const removeKillOnExitHandlers = (): void => {\n process.removeListener('beforeExit', stopProcess);\n for (const [signal, handler] of signalHandlers) {\n process.removeListener(signal, handler);\n }\n signalHandlers.clear();\n };\n if (options?.killOnExit) {\n process.on('beforeExit', stopProcess);\n for (const signal of cleanupSignals) {\n const handleSignal = (): void => {\n stopProcess();\n removeKillOnExitHandlers();\n if (process.listenerCount(signal) === 0) {\n process.kill(process.pid, signal);\n }\n };\n signalHandlers.set(signal, handleSignal);\n process.on(signal, handleSignal);\n }\n }\n\n proc.on('error', (error) => {\n removeKillOnExitHandlers();\n proc.removeAllListeners('close');\n reject(error);\n });\n proc.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\n removeKillOnExitHandlers();\n if (proc.pid === undefined) {\n reject(new Error('Process has no pid.'));\n } else {\n resolve({\n pid: proc.pid,\n stdout,\n stderr,\n status: code,\n signal,\n });\n }\n });\n\n if (options?.input) {\n proc.stdin?.write(options.input);\n proc.stdin?.end();\n }\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n }\n });\n}\n"],"names":["async","command","args","options","Promise","resolve","reject","proc","spawn","stdout","setEncoding","stderr","on","data","printingStdout","process","write","mergeOutAndError","printingStderr","stopped","stopProcess","pid","verbose","console","info","treeKill","error","warn","cleanupSignals","platform","signalHandlers","Map","removeKillOnExitHandlers","removeListener","signal","handler","clear","killOnExit","handleSignal","listenerCount","kill","set","removeAllListeners","code","undefined","Error","status","input","stdin","end"],"mappings":"gGAoEOA,eACLC,EACAC,EACAC,GAEA,OAAO,IAAIC,QAAQ,CAACC,EAASC,KAC3B,IACE,MAAMC,EAAOC,EAAAA,MAAMP,EAASC,GAAQ,GAAIC,GAAW,IAGnDI,EAAKE,QAAQC,cAAc,QAE3BH,EAAKI,QAAQD,cAAc,QAE3B,IAAID,EAAS,GACTE,EAAS,GACbJ,EAAKE,QAAQG,GAAG,OAASC,IACvBJ,GAAUI,EACNV,GAASW,gBACXC,QAAQN,OAAOO,MAAMH,KAGzBN,EAAKI,QAAQC,GAAG,OAASC,IACnBV,GAASc,iBACXR,GAAUI,EAEVF,GAAUE,EAERV,GAASe,gBACXH,QAAQJ,OAAOK,MAAMH,KAIzB,IAAIM,GAAU,EACd,MAAMC,EAAcA,KAClB,IAAID,GAAYZ,EAAKc,IAArB,CAEAF,GAAU,EACNhB,GAASmB,SACXC,QAAQC,KAAK,YAAYjB,EAAKc,QAEhC,IACEI,EAAAA,SAASlB,EAAKc,IAChB,CAAE,MAAOK,GACHvB,GAASmB,SACXC,QAAQI,KAAK,sBAAsBpB,EAAKc,OAAQK,EAEpD,CAZ0B,GActBE,EACiB,UAArBb,QAAQc,SAAuB,CAAC,SAAU,WAAa,CAAC,SAAU,UAAW,WACzEC,EAAiB,IAAIC,IACrBC,EAA2BA,KAC/BjB,QAAQkB,eAAe,aAAcb,GACrC,IAAK,MAAOc,EAAQC,KAAYL,EAC9Bf,QAAQkB,eAAeC,EAAQC,GAEjCL,EAAeM,SAEjB,GAAIjC,GAASkC,WAAY,CACvBtB,QAAQH,GAAG,aAAcQ,GACzB,IAAK,MAAMc,KAAUN,EAAgB,CACnC,MAAMU,EAAeA,KACnBlB,IACAY,IACsC,IAAlCjB,QAAQwB,cAAcL,IACxBnB,QAAQyB,KAAKzB,QAAQM,IAAKa,IAG9BJ,EAAeW,IAAIP,EAAQI,GAC3BvB,QAAQH,GAAGsB,EAAQI,EACrB,CACF,CAEA/B,EAAKK,GAAG,QAAUc,IAChBM,IACAzB,EAAKmC,mBAAmB,SACxBpC,EAAOoB,KAETnB,EAAKK,GAAG,QAAS,CAAC+B,EAAqBT,KACrCF,SACiBY,IAAbrC,EAAKc,IACPf,EAAO,IAAIuC,MAAM,wBAEjBxC,EAAQ,CACNgB,IAAKd,EAAKc,IACVZ,SACAE,SACAmC,OAAQH,EACRT,aAKF/B,GAAS4C,QACXxC,EAAKyC,OAAOhC,MAAMb,EAAQ4C,OAC1BxC,EAAKyC,OAAOC,MAEhB,CAAE,MAAOvB,GAEPpB,EAAOoB,EACT,GAEJ"}
package/dist/spawn.js CHANGED
@@ -1,2 +1,2 @@
1
- import{spawn as e}from"node:child_process";import r from"tree-kill";async function t(t,o,s){return new Promise((i,n)=>{try{const d=e(t,o??[],s??{});d.stdout?.setEncoding?.("utf8"),d.stderr?.setEncoding?.("utf8");let p="",c="";d.stdout?.on("data",e=>{p+=e,s?.printingStdout&&process.stdout.write(e)}),d.stderr?.on("data",e=>{s?.mergeOutAndError?p+=e:c+=e,s?.printingStderr&&process.stderr.write(e)});let l=!1;const u=()=>{!l&&d.pid&&(l=!0,s?.verbose&&console.info(`treeKill(${d.pid})`),r(d.pid))};s?.killOnExit&&(process.on("beforeExit",u),process.on("SIGINT",u)),d.on("error",e=>{process.removeListener("beforeExit",u),process.removeListener("SIGINT",u),d.removeAllListeners("close"),n(e)}),d.on("close",(e,r)=>{process.removeListener("beforeExit",u),process.removeListener("SIGINT",u),void 0===d.pid?n(new Error("Process has no pid.")):i({pid:d.pid,stdout:p,stderr:c,status:e,signal:r})}),s?.input&&(d.stdin?.write(s.input),d.stdin?.end())}catch(e){n(e)}})}export{t as spawnAsync};
1
+ import{spawn as e}from"node:child_process";import{treeKill as r}from"./treeKill.js";async function o(o,t,s){return new Promise((i,n)=>{try{const c=e(o,t??[],s??{});c.stdout?.setEncoding?.("utf8"),c.stderr?.setEncoding?.("utf8");let d="",p="";c.stdout?.on("data",e=>{d+=e,s?.printingStdout&&process.stdout.write(e)}),c.stderr?.on("data",e=>{s?.mergeOutAndError?d+=e:p+=e,s?.printingStderr&&process.stderr.write(e)});let l=!1;const a=()=>{if(!l&&c.pid){l=!0,s?.verbose&&console.info(`treeKill(${c.pid})`);try{r(c.pid)}catch(e){s?.verbose&&console.warn(`Failed to treeKill(${c.pid})`,e)}}},f="win32"===process.platform?["SIGINT","SIGTERM"]:["SIGINT","SIGTERM","SIGQUIT"],u=new Map,m=()=>{process.removeListener("beforeExit",a);for(const[e,r]of u)process.removeListener(e,r);u.clear()};if(s?.killOnExit){process.on("beforeExit",a);for(const e of f){const r=()=>{a(),m(),0===process.listenerCount(e)&&process.kill(process.pid,e)};u.set(e,r),process.on(e,r)}}c.on("error",e=>{m(),c.removeAllListeners("close"),n(e)}),c.on("close",(e,r)=>{m(),void 0===c.pid?n(new Error("Process has no pid.")):i({pid:c.pid,stdout:d,stderr:p,status:e,signal:r})}),s?.input&&(c.stdin?.write(s.input),c.stdin?.end())}catch(e){n(e)}})}export{o as spawnAsync};
2
2
  //# sourceMappingURL=spawn.js.map
package/dist/spawn.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.js","sources":["../src/spawn.ts"],"sourcesContent":["import type {\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'node:child_process';\nimport { spawn } from 'node:child_process';\n\nimport treeKill from 'tree-kill';\n\n/**\n * Return type for spawnAsync function, based on SpawnSyncReturns but without output and error properties\n */\nexport type SpawnAsyncReturns = Omit<SpawnSyncReturns<string>, 'output' | 'error'>;\n\n/**\n * Options for spawnAsync function, extending various Node.js spawn options with additional functionality\n */\nexport type SpawnAsyncOptions = (\n | SpawnOptionsWithoutStdio\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n | SpawnOptions\n) & {\n /** Input string to write to the spawned process's stdin */\n input?: string;\n /** If true, stderr output will be merged into stdout */\n mergeOutAndError?: boolean;\n /** If true, the spawned process will be killed when the parent process exits */\n killOnExit?: boolean;\n /** If true, enables verbose logging of process operations */\n verbose?: boolean;\n /** If true, stdout data will be printed to console as it's received */\n printingStdout?: boolean;\n /** If true, stderr data will be printed to console as it's received */\n printingStderr?: boolean;\n};\n\n/**\n * Spawns a child process asynchronously and returns a promise that resolves with the process results\n *\n * This function provides a Promise-based wrapper around Node.js's spawn function with additional features:\n * - Automatic encoding of stdout/stderr as UTF-8\n * - Option to merge stderr into stdout\n * - Option to automatically kill the process on parent exit\n * - Option to provide input via stdin\n * - Verbose logging capability\n *\n * @param command - The command to run\n * @param args - List of string arguments\n * @param options - Configuration options for the spawned process\n * @returns Promise that resolves with the process results including pid, stdout, stderr, status, and signal\n * @throws Will reject the promise if the process fails to spawn or encounters an error\n *\n * @example\n * ```typescript\n * const result = await spawnAsync('ls', ['-la'], { verbose: true });\n * console.log(result.stdout);\n * ```\n */\nexport async function spawnAsync(\n command: string,\n args?: readonly string[],\n options?: SpawnAsyncOptions\n): Promise<SpawnAsyncReturns> {\n return new Promise((resolve, reject) => {\n try {\n const proc = spawn(command, args ?? [], options ?? {});\n // `setEncoding` is undefined in Bun\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n proc.stdout?.setEncoding?.('utf8');\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n proc.stderr?.setEncoding?.('utf8');\n\n let stdout = '';\n let stderr = '';\n proc.stdout?.on('data', (data: string) => {\n stdout += data;\n if (options?.printingStdout) {\n process.stdout.write(data);\n }\n });\n proc.stderr?.on('data', (data: string) => {\n if (options?.mergeOutAndError) {\n stdout += data;\n } else {\n stderr += data;\n }\n if (options?.printingStderr) {\n process.stderr.write(data);\n }\n });\n\n let stopped = false;\n const stopProcess = (): void => {\n if (stopped || !proc.pid) return;\n\n stopped = true;\n if (options?.verbose) {\n console.info(`treeKill(${proc.pid})`);\n }\n treeKill(proc.pid);\n };\n if (options?.killOnExit) {\n process.on('beforeExit', stopProcess);\n process.on('SIGINT', stopProcess);\n }\n\n proc.on('error', (error) => {\n process.removeListener('beforeExit', stopProcess);\n process.removeListener('SIGINT', stopProcess);\n proc.removeAllListeners('close');\n reject(error);\n });\n proc.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\n process.removeListener('beforeExit', stopProcess);\n process.removeListener('SIGINT', stopProcess);\n if (proc.pid === undefined) {\n reject(new Error('Process has no pid.'));\n } else {\n resolve({\n pid: proc.pid,\n stdout,\n stderr,\n status: code,\n signal,\n });\n }\n });\n\n if (options?.input) {\n proc.stdin?.write(options.input);\n proc.stdin?.end();\n }\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n }\n });\n}\n"],"names":["async","spawnAsync","command","args","options","Promise","resolve","reject","proc","spawn","stdout","setEncoding","stderr","on","data","printingStdout","process","write","mergeOutAndError","printingStderr","stopped","stopProcess","pid","verbose","console","info","treeKill","killOnExit","error","removeListener","removeAllListeners","code","signal","undefined","Error","status","input","stdin","end"],"mappings":"oEAoEOA,eAAeC,EACpBC,EACAC,EACAC,GAEA,OAAO,IAAIC,QAAQ,CAACC,EAASC,KAC3B,IACE,MAAMC,EAAOC,EAAMP,EAASC,GAAQ,GAAIC,GAAW,IAGnDI,EAAKE,QAAQC,cAAc,QAE3BH,EAAKI,QAAQD,cAAc,QAE3B,IAAID,EAAS,GACTE,EAAS,GACbJ,EAAKE,QAAQG,GAAG,OAASC,IACvBJ,GAAUI,EACNV,GAASW,gBACXC,QAAQN,OAAOO,MAAMH,KAGzBN,EAAKI,QAAQC,GAAG,OAASC,IACnBV,GAASc,iBACXR,GAAUI,EAEVF,GAAUE,EAERV,GAASe,gBACXH,QAAQJ,OAAOK,MAAMH,KAIzB,IAAIM,GAAU,EACd,MAAMC,EAAcA,MACdD,GAAYZ,EAAKc,MAErBF,GAAU,EACNhB,GAASmB,SACXC,QAAQC,KAAK,YAAYjB,EAAKc,QAEhCI,EAASlB,EAAKc,OAEZlB,GAASuB,aACXX,QAAQH,GAAG,aAAcQ,GACzBL,QAAQH,GAAG,SAAUQ,IAGvBb,EAAKK,GAAG,QAAUe,IAChBZ,QAAQa,eAAe,aAAcR,GACrCL,QAAQa,eAAe,SAAUR,GACjCb,EAAKsB,mBAAmB,SACxBvB,EAAOqB,KAETpB,EAAKK,GAAG,QAAS,CAACkB,EAAqBC,KACrChB,QAAQa,eAAe,aAAcR,GACrCL,QAAQa,eAAe,SAAUR,QAChBY,IAAbzB,EAAKc,IACPf,EAAO,IAAI2B,MAAM,wBAEjB5B,EAAQ,CACNgB,IAAKd,EAAKc,IACVZ,SACAE,SACAuB,OAAQJ,EACRC,aAKF5B,GAASgC,QACX5B,EAAK6B,OAAOpB,MAAMb,EAAQgC,OAC1B5B,EAAK6B,OAAOC,MAEhB,CAAE,MAAOV,GAEPrB,EAAOqB,EACT,GAEJ"}
1
+ {"version":3,"file":"spawn.js","sources":["../src/spawn.ts"],"sourcesContent":["import type {\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'node:child_process';\nimport { spawn } from 'node:child_process';\n\nimport { treeKill } from './treeKill.js';\n\n/**\n * Return type for spawnAsync function, based on SpawnSyncReturns but without output and error properties\n */\nexport type SpawnAsyncReturns = Omit<SpawnSyncReturns<string>, 'output' | 'error'>;\n\n/**\n * Options for spawnAsync function, extending various Node.js spawn options with additional functionality\n */\nexport type SpawnAsyncOptions = (\n | SpawnOptionsWithoutStdio\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n | SpawnOptions\n) & {\n /** Input string to write to the spawned process's stdin */\n input?: string;\n /** If true, stderr output will be merged into stdout */\n mergeOutAndError?: boolean;\n /** If true, the spawned process will be killed when the parent process exits */\n killOnExit?: boolean;\n /** If true, enables verbose logging of process operations */\n verbose?: boolean;\n /** If true, stdout data will be printed to console as it's received */\n printingStdout?: boolean;\n /** If true, stderr data will be printed to console as it's received */\n printingStderr?: boolean;\n};\n\n/**\n * Spawns a child process asynchronously and returns a promise that resolves with the process results\n *\n * This function provides a Promise-based wrapper around Node.js's spawn function with additional features:\n * - Automatic encoding of stdout/stderr as UTF-8\n * - Option to merge stderr into stdout\n * - Option to automatically kill the process on parent exit\n * - Option to provide input via stdin\n * - Verbose logging capability\n *\n * @param command - The command to run\n * @param args - List of string arguments\n * @param options - Configuration options for the spawned process\n * @returns Promise that resolves with the process results including pid, stdout, stderr, status, and signal\n * @throws Will reject the promise if the process fails to spawn or encounters an error\n *\n * @example\n * ```typescript\n * const result = await spawnAsync('ls', ['-la'], { verbose: true });\n * console.log(result.stdout);\n * ```\n */\nexport async function spawnAsync(\n command: string,\n args?: readonly string[],\n options?: SpawnAsyncOptions\n): Promise<SpawnAsyncReturns> {\n return new Promise((resolve, reject) => {\n try {\n const proc = spawn(command, args ?? [], options ?? {});\n // `setEncoding` is undefined in Bun\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n proc.stdout?.setEncoding?.('utf8');\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n proc.stderr?.setEncoding?.('utf8');\n\n let stdout = '';\n let stderr = '';\n proc.stdout?.on('data', (data: string) => {\n stdout += data;\n if (options?.printingStdout) {\n process.stdout.write(data);\n }\n });\n proc.stderr?.on('data', (data: string) => {\n if (options?.mergeOutAndError) {\n stdout += data;\n } else {\n stderr += data;\n }\n if (options?.printingStderr) {\n process.stderr.write(data);\n }\n });\n\n let stopped = false;\n const stopProcess = (): void => {\n if (stopped || !proc.pid) return;\n\n stopped = true;\n if (options?.verbose) {\n console.info(`treeKill(${proc.pid})`);\n }\n try {\n treeKill(proc.pid);\n } catch (error) {\n if (options?.verbose) {\n console.warn(`Failed to treeKill(${proc.pid})`, error);\n }\n }\n };\n const cleanupSignals: NodeJS.Signals[] =\n process.platform === 'win32' ? ['SIGINT', 'SIGTERM'] : ['SIGINT', 'SIGTERM', 'SIGQUIT'];\n const signalHandlers = new Map<NodeJS.Signals, () => void>();\n const removeKillOnExitHandlers = (): void => {\n process.removeListener('beforeExit', stopProcess);\n for (const [signal, handler] of signalHandlers) {\n process.removeListener(signal, handler);\n }\n signalHandlers.clear();\n };\n if (options?.killOnExit) {\n process.on('beforeExit', stopProcess);\n for (const signal of cleanupSignals) {\n const handleSignal = (): void => {\n stopProcess();\n removeKillOnExitHandlers();\n if (process.listenerCount(signal) === 0) {\n process.kill(process.pid, signal);\n }\n };\n signalHandlers.set(signal, handleSignal);\n process.on(signal, handleSignal);\n }\n }\n\n proc.on('error', (error) => {\n removeKillOnExitHandlers();\n proc.removeAllListeners('close');\n reject(error);\n });\n proc.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\n removeKillOnExitHandlers();\n if (proc.pid === undefined) {\n reject(new Error('Process has no pid.'));\n } else {\n resolve({\n pid: proc.pid,\n stdout,\n stderr,\n status: code,\n signal,\n });\n }\n });\n\n if (options?.input) {\n proc.stdin?.write(options.input);\n proc.stdin?.end();\n }\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n }\n });\n}\n"],"names":["async","spawnAsync","command","args","options","Promise","resolve","reject","proc","spawn","stdout","setEncoding","stderr","on","data","printingStdout","process","write","mergeOutAndError","printingStderr","stopped","stopProcess","pid","verbose","console","info","treeKill","error","warn","cleanupSignals","platform","signalHandlers","Map","removeKillOnExitHandlers","removeListener","signal","handler","clear","killOnExit","handleSignal","listenerCount","kill","set","removeAllListeners","code","undefined","Error","status","input","stdin","end"],"mappings":"oFAoEOA,eAAeC,EACpBC,EACAC,EACAC,GAEA,OAAO,IAAIC,QAAQ,CAACC,EAASC,KAC3B,IACE,MAAMC,EAAOC,EAAMP,EAASC,GAAQ,GAAIC,GAAW,IAGnDI,EAAKE,QAAQC,cAAc,QAE3BH,EAAKI,QAAQD,cAAc,QAE3B,IAAID,EAAS,GACTE,EAAS,GACbJ,EAAKE,QAAQG,GAAG,OAASC,IACvBJ,GAAUI,EACNV,GAASW,gBACXC,QAAQN,OAAOO,MAAMH,KAGzBN,EAAKI,QAAQC,GAAG,OAASC,IACnBV,GAASc,iBACXR,GAAUI,EAEVF,GAAUE,EAERV,GAASe,gBACXH,QAAQJ,OAAOK,MAAMH,KAIzB,IAAIM,GAAU,EACd,MAAMC,EAAcA,KAClB,IAAID,GAAYZ,EAAKc,IAArB,CAEAF,GAAU,EACNhB,GAASmB,SACXC,QAAQC,KAAK,YAAYjB,EAAKc,QAEhC,IACEI,EAASlB,EAAKc,IAChB,CAAE,MAAOK,GACHvB,GAASmB,SACXC,QAAQI,KAAK,sBAAsBpB,EAAKc,OAAQK,EAEpD,CAZ0B,GActBE,EACiB,UAArBb,QAAQc,SAAuB,CAAC,SAAU,WAAa,CAAC,SAAU,UAAW,WACzEC,EAAiB,IAAIC,IACrBC,EAA2BA,KAC/BjB,QAAQkB,eAAe,aAAcb,GACrC,IAAK,MAAOc,EAAQC,KAAYL,EAC9Bf,QAAQkB,eAAeC,EAAQC,GAEjCL,EAAeM,SAEjB,GAAIjC,GAASkC,WAAY,CACvBtB,QAAQH,GAAG,aAAcQ,GACzB,IAAK,MAAMc,KAAUN,EAAgB,CACnC,MAAMU,EAAeA,KACnBlB,IACAY,IACsC,IAAlCjB,QAAQwB,cAAcL,IACxBnB,QAAQyB,KAAKzB,QAAQM,IAAKa,IAG9BJ,EAAeW,IAAIP,EAAQI,GAC3BvB,QAAQH,GAAGsB,EAAQI,EACrB,CACF,CAEA/B,EAAKK,GAAG,QAAUc,IAChBM,IACAzB,EAAKmC,mBAAmB,SACxBpC,EAAOoB,KAETnB,EAAKK,GAAG,QAAS,CAAC+B,EAAqBT,KACrCF,SACiBY,IAAbrC,EAAKc,IACPf,EAAO,IAAIuC,MAAM,wBAEjBxC,EAAQ,CACNgB,IAAKd,EAAKc,IACVZ,SACAE,SACAmC,OAAQH,EACRT,aAKF/B,GAAS4C,QACXxC,EAAKyC,OAAOhC,MAAMb,EAAQ4C,OAC1BxC,EAAKyC,OAAOC,MAEhB,CAAE,MAAOvB,GAEPpB,EAAOoB,EACT,GAEJ"}
@@ -0,0 +1,2 @@
1
+ "use strict";var t=require("node:child_process"),r=require("./errno.cjs"),e=require("./processTree.cjs");function n(t,r){try{process.kill(t,r)}catch(t){if(i(t))return;throw t}}function o(e,n,o){try{return{stdout:t.execFileSync(e,[...n],{encoding:"utf8",maxBuffer:o?.maxBuffer,timeout:o?.timeout,stdio:["ignore","pipe","pipe"]}),stderr:""}}catch(t){const o=function(t){if("object"!=typeof t||null===t||!("stderr"in t))return"";const r=t.stderr;if("string"==typeof r)return r;if(Buffer.isBuffer(r))return r.toString("utf8");return""}(t);throw new s(e,n,o,function(t){if(r.isErrnoException(t))return t.code;if("object"==typeof t&&null!==t&&"status"in t){const r=t.status;if("number"==typeof r)return r}return}(t))}}function i(t){return!(!r.isErrnoException(t)||"ESRCH"!==t.code)||t instanceof s&&/no such process|not found|not recognized|there is no running instance/i.test(t.stderr)}class s extends Error{constructor(t,r,e,n){super(`Command failed: ${t} ${r.join(" ")}`),this.name="CommandExecutionError",this.stderr=e,this.code=n}}exports.treeKill=function(t,r="SIGTERM"){if(!Number.isInteger(t)||t<=0)throw new Error(`Invalid pid: ${t}`);if("win32"===process.platform)return void function(t){try{o("taskkill",["/PID",String(t),"/T","/F"],{maxBuffer:1048576,timeout:2e3})}catch(t){if(i(t))return;throw t}}(t);const s=function(t,r){const e=r.toReversed();return e.push(t),e}(t,function(t){const{stdout:r}=o("ps",["-Ao","pid=,ppid="],{maxBuffer:1048576,timeout:2e3}),n=e.buildChildrenByParentMap(r);return e.collectDescendantPids(t,n)}(t));for(const t of s)n(t,r)};
2
+ //# sourceMappingURL=treeKill.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeKill.cjs","sources":["../src/treeKill.ts"],"sourcesContent":["import { execFileSync } from 'node:child_process';\n\nimport { isErrnoException } from './errno.js';\nimport { buildChildrenByParentMap, collectDescendantPids as collectDescendantPidsFromMap } from './processTree.js';\n\nexport function treeKill(pid: number, signal: NodeJS.Signals = 'SIGTERM'): void {\n if (!Number.isInteger(pid) || pid <= 0) {\n throw new Error(`Invalid pid: ${pid}`);\n }\n\n if (process.platform === 'win32') {\n killTreeOnWindows(pid);\n return;\n }\n\n const descendants = collectDescendantPids(pid);\n const targetPids = toChildrenFirstPids(pid, descendants);\n for (const targetPid of targetPids) {\n killIfNeeded(targetPid, signal);\n }\n}\n\nfunction killIfNeeded(pid: number, signal: NodeJS.Signals): void {\n try {\n process.kill(pid, signal);\n } catch (error) {\n if (isNoSuchProcessError(error)) {\n return;\n }\n throw error;\n }\n}\n\nfunction killTreeOnWindows(pid: number): void {\n try {\n runCommand('taskkill', ['/PID', String(pid), '/T', '/F'], {\n maxBuffer: 1024 * 1024,\n timeout: 2000,\n });\n } catch (error) {\n if (isNoSuchProcessError(error)) {\n return;\n }\n throw error;\n }\n}\n\nfunction collectDescendantPids(rootPid: number): number[] {\n const { stdout } = runCommand(\n 'ps',\n ['-Ao', 'pid=,ppid='],\n // Keep command bounded so watch-mode kill loops cannot hang this path.\n { maxBuffer: 1024 * 1024, timeout: 2000 }\n );\n const childrenByParent = buildChildrenByParentMap(stdout);\n return collectDescendantPidsFromMap(rootPid, childrenByParent);\n}\n\nfunction toChildrenFirstPids(pid: number, descendants: readonly number[]): number[] {\n const targetPids = descendants.toReversed();\n targetPids.push(pid);\n return targetPids;\n}\n\nfunction runCommand(\n command: string,\n args: readonly string[],\n options?: { timeout: number; maxBuffer: number }\n): { stdout: string; stderr: string } {\n try {\n const stdout = execFileSync(command, [...args], {\n encoding: 'utf8',\n maxBuffer: options?.maxBuffer,\n timeout: options?.timeout,\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n return { stdout, stderr: '' };\n } catch (error) {\n const stderr = extractStderr(error);\n throw new CommandExecutionError(command, args, stderr, toExitCode(error));\n }\n}\n\nfunction isNoSuchProcessError(error: unknown): boolean {\n if (isErrnoException(error) && error.code === 'ESRCH') {\n return true;\n }\n\n if (error instanceof CommandExecutionError) {\n return /no such process|not found|not recognized|there is no running instance/i.test(error.stderr);\n }\n return false;\n}\n\nfunction toExitCode(error: unknown): number | string | undefined {\n if (isErrnoException(error)) {\n return error.code;\n }\n if (typeof error === 'object' && error !== null && 'status' in error) {\n const status = (error as { status: unknown }).status;\n if (typeof status === 'number') {\n return status;\n }\n }\n return undefined;\n}\n\nfunction extractStderr(error: unknown): string {\n if (typeof error !== 'object' || error === null || !('stderr' in error)) {\n return '';\n }\n\n const stderr = (error as Record<'stderr', unknown>).stderr;\n if (typeof stderr === 'string') {\n return stderr;\n }\n if (Buffer.isBuffer(stderr)) {\n return stderr.toString('utf8');\n }\n return '';\n}\n\nclass CommandExecutionError extends Error {\n readonly stderr: string;\n readonly code: number | string | undefined;\n\n constructor(command: string, args: readonly string[], stderr: string, code: number | string | undefined) {\n super(`Command failed: ${command} ${args.join(' ')}`);\n this.name = 'CommandExecutionError';\n this.stderr = stderr;\n this.code = code;\n }\n}\n"],"names":["killIfNeeded","pid","signal","process","kill","error","isNoSuchProcessError","runCommand","command","args","options","stdout","execFileSync","encoding","maxBuffer","timeout","stdio","stderr","Buffer","isBuffer","toString","extractStderr","CommandExecutionError","isErrnoException","code","status","toExitCode","test","Error","constructor","super","join","this","name","Number","isInteger","platform","String","killTreeOnWindows","targetPids","descendants","toReversed","push","toChildrenFirstPids","rootPid","childrenByParent","buildChildrenByParentMap","collectDescendantPidsFromMap","collectDescendantPids","targetPid"],"mappings":"yGAsBA,SAASA,EAAaC,EAAaC,GACjC,IACEC,QAAQC,KAAKH,EAAKC,EACpB,CAAE,MAAOG,GACP,GAAIC,EAAqBD,GACvB,OAEF,MAAMA,CACR,CACF,CAiCA,SAASE,EACPC,EACAC,EACAC,GAEA,IAOE,MAAO,CAAEC,OANMC,EAAAA,aAAaJ,EAAS,IAAIC,GAAO,CAC9CI,SAAU,OACVC,UAAWJ,GAASI,UACpBC,QAASL,GAASK,QAClBC,MAAO,CAAC,SAAU,OAAQ,UAEXC,OAAQ,GAC3B,CAAE,MAAOZ,GACP,MAAMY,EA6BV,SAAuBZ,GACrB,GAAqB,iBAAVA,GAAgC,OAAVA,KAAoB,WAAYA,GAC/D,MAAO,GAGT,MAAMY,EAAUZ,EAAoCY,OACpD,GAAsB,iBAAXA,EACT,OAAOA,EAET,GAAIC,OAAOC,SAASF,GAClB,OAAOA,EAAOG,SAAS,QAEzB,MAAO,EACT,CA1CmBC,CAAchB,GAC7B,MAAM,IAAIiB,EAAsBd,EAASC,EAAMQ,EAenD,SAAoBZ,GAClB,GAAIkB,EAAAA,iBAAiBlB,GACnB,OAAOA,EAAMmB,KAEf,GAAqB,iBAAVnB,GAAgC,OAAVA,GAAkB,WAAYA,EAAO,CACpE,MAAMoB,EAAUpB,EAA8BoB,OAC9C,GAAsB,iBAAXA,EACT,OAAOA,CAEX,CACA,MACF,CA1B2DC,CAAWrB,GACpE,CACF,CAEA,SAASC,EAAqBD,GAC5B,SAAIkB,EAAAA,iBAAiBlB,IAAyB,UAAfA,EAAMmB,OAIjCnB,aAAiBiB,GACZ,yEAAyEK,KAAKtB,EAAMY,OAG/F,CA8BA,MAAMK,UAA8BM,MAIlCC,WAAAA,CAAYrB,EAAiBC,EAAyBQ,EAAgBO,GACpEM,MAAM,mBAAmBtB,KAAWC,EAAKsB,KAAK,QAC9CC,KAAKC,KAAO,wBACZD,KAAKf,OAASA,EACde,KAAKR,KAAOA,CACd,mBA9HK,SAAkBvB,EAAaC,EAAyB,WAC7D,IAAKgC,OAAOC,UAAUlC,IAAQA,GAAO,EACnC,MAAM,IAAI2B,MAAM,gBAAgB3B,KAGlC,GAAyB,UAArBE,QAAQiC,SAEV,YAqBJ,SAA2BnC,GACzB,IACEM,EAAW,WAAY,CAAC,OAAQ8B,OAAOpC,GAAM,KAAM,MAAO,CACxDa,UAAW,QACXC,QAAS,KAEb,CAAE,MAAOV,GACP,GAAIC,EAAqBD,GACvB,OAEF,MAAMA,CACR,CACF,CAlCIiC,CAAkBrC,GAIpB,MACMsC,EA0CR,SAA6BtC,EAAauC,GACxC,MAAMD,EAAaC,EAAYC,aAE/B,OADAF,EAAWG,KAAKzC,GACTsC,CACT,CA9CqBI,CAAoB1C,EA+BzC,SAA+B2C,GAC7B,MAAMjC,OAAEA,GAAWJ,EACjB,KACA,CAAC,MAAO,cAER,CAAEO,UAAW,QAAaC,QAAS,MAE/B8B,EAAmBC,EAAAA,yBAAyBnC,GAClD,OAAOoC,EAAAA,sBAA6BH,EAASC,EAC/C,CAzCsBG,CAAsB/C,IAE1C,IAAK,MAAMgD,KAAaV,EACtBvC,EAAaiD,EAAW/C,EAE5B"}
@@ -0,0 +1 @@
1
+ export declare function treeKill(pid: number, signal?: NodeJS.Signals): void;
@@ -0,0 +1,2 @@
1
+ import{execFileSync as t}from"node:child_process";import{isErrnoException as r}from"./errno.js";import{buildChildrenByParentMap as e,collectDescendantPids as n}from"./processTree.js";function o(t,r="SIGTERM"){if(!Number.isInteger(t)||t<=0)throw new Error(`Invalid pid: ${t}`);if("win32"===process.platform)return void function(t){try{s("taskkill",["/PID",String(t),"/T","/F"],{maxBuffer:1048576,timeout:2e3})}catch(t){if(u(t))return;throw t}}(t);const o=function(t,r){const e=r.toReversed();return e.push(t),e}(t,function(t){const{stdout:r}=s("ps",["-Ao","pid=,ppid="],{maxBuffer:1048576,timeout:2e3}),o=e(r);return n(t,o)}(t));for(const t of o)i(t,r)}function i(t,r){try{process.kill(t,r)}catch(t){if(u(t))return;throw t}}function s(e,n,o){try{return{stdout:t(e,[...n],{encoding:"utf8",maxBuffer:o?.maxBuffer,timeout:o?.timeout,stdio:["ignore","pipe","pipe"]}),stderr:""}}catch(t){const o=function(t){if("object"!=typeof t||null===t||!("stderr"in t))return"";const r=t.stderr;if("string"==typeof r)return r;if(Buffer.isBuffer(r))return r.toString("utf8");return""}(t);throw new f(e,n,o,function(t){if(r(t))return t.code;if("object"==typeof t&&null!==t&&"status"in t){const r=t.status;if("number"==typeof r)return r}return}(t))}}function u(t){return!(!r(t)||"ESRCH"!==t.code)||t instanceof f&&/no such process|not found|not recognized|there is no running instance/i.test(t.stderr)}class f extends Error{constructor(t,r,e,n){super(`Command failed: ${t} ${r.join(" ")}`),this.name="CommandExecutionError",this.stderr=e,this.code=n}}export{o as treeKill};
2
+ //# sourceMappingURL=treeKill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeKill.js","sources":["../src/treeKill.ts"],"sourcesContent":["import { execFileSync } from 'node:child_process';\n\nimport { isErrnoException } from './errno.js';\nimport { buildChildrenByParentMap, collectDescendantPids as collectDescendantPidsFromMap } from './processTree.js';\n\nexport function treeKill(pid: number, signal: NodeJS.Signals = 'SIGTERM'): void {\n if (!Number.isInteger(pid) || pid <= 0) {\n throw new Error(`Invalid pid: ${pid}`);\n }\n\n if (process.platform === 'win32') {\n killTreeOnWindows(pid);\n return;\n }\n\n const descendants = collectDescendantPids(pid);\n const targetPids = toChildrenFirstPids(pid, descendants);\n for (const targetPid of targetPids) {\n killIfNeeded(targetPid, signal);\n }\n}\n\nfunction killIfNeeded(pid: number, signal: NodeJS.Signals): void {\n try {\n process.kill(pid, signal);\n } catch (error) {\n if (isNoSuchProcessError(error)) {\n return;\n }\n throw error;\n }\n}\n\nfunction killTreeOnWindows(pid: number): void {\n try {\n runCommand('taskkill', ['/PID', String(pid), '/T', '/F'], {\n maxBuffer: 1024 * 1024,\n timeout: 2000,\n });\n } catch (error) {\n if (isNoSuchProcessError(error)) {\n return;\n }\n throw error;\n }\n}\n\nfunction collectDescendantPids(rootPid: number): number[] {\n const { stdout } = runCommand(\n 'ps',\n ['-Ao', 'pid=,ppid='],\n // Keep command bounded so watch-mode kill loops cannot hang this path.\n { maxBuffer: 1024 * 1024, timeout: 2000 }\n );\n const childrenByParent = buildChildrenByParentMap(stdout);\n return collectDescendantPidsFromMap(rootPid, childrenByParent);\n}\n\nfunction toChildrenFirstPids(pid: number, descendants: readonly number[]): number[] {\n const targetPids = descendants.toReversed();\n targetPids.push(pid);\n return targetPids;\n}\n\nfunction runCommand(\n command: string,\n args: readonly string[],\n options?: { timeout: number; maxBuffer: number }\n): { stdout: string; stderr: string } {\n try {\n const stdout = execFileSync(command, [...args], {\n encoding: 'utf8',\n maxBuffer: options?.maxBuffer,\n timeout: options?.timeout,\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n return { stdout, stderr: '' };\n } catch (error) {\n const stderr = extractStderr(error);\n throw new CommandExecutionError(command, args, stderr, toExitCode(error));\n }\n}\n\nfunction isNoSuchProcessError(error: unknown): boolean {\n if (isErrnoException(error) && error.code === 'ESRCH') {\n return true;\n }\n\n if (error instanceof CommandExecutionError) {\n return /no such process|not found|not recognized|there is no running instance/i.test(error.stderr);\n }\n return false;\n}\n\nfunction toExitCode(error: unknown): number | string | undefined {\n if (isErrnoException(error)) {\n return error.code;\n }\n if (typeof error === 'object' && error !== null && 'status' in error) {\n const status = (error as { status: unknown }).status;\n if (typeof status === 'number') {\n return status;\n }\n }\n return undefined;\n}\n\nfunction extractStderr(error: unknown): string {\n if (typeof error !== 'object' || error === null || !('stderr' in error)) {\n return '';\n }\n\n const stderr = (error as Record<'stderr', unknown>).stderr;\n if (typeof stderr === 'string') {\n return stderr;\n }\n if (Buffer.isBuffer(stderr)) {\n return stderr.toString('utf8');\n }\n return '';\n}\n\nclass CommandExecutionError extends Error {\n readonly stderr: string;\n readonly code: number | string | undefined;\n\n constructor(command: string, args: readonly string[], stderr: string, code: number | string | undefined) {\n super(`Command failed: ${command} ${args.join(' ')}`);\n this.name = 'CommandExecutionError';\n this.stderr = stderr;\n this.code = code;\n }\n}\n"],"names":["treeKill","pid","signal","Number","isInteger","Error","process","platform","runCommand","String","maxBuffer","timeout","error","isNoSuchProcessError","killTreeOnWindows","targetPids","descendants","toReversed","push","toChildrenFirstPids","rootPid","stdout","childrenByParent","buildChildrenByParentMap","collectDescendantPidsFromMap","collectDescendantPids","targetPid","killIfNeeded","kill","command","args","options","execFileSync","encoding","stdio","stderr","Buffer","isBuffer","toString","extractStderr","CommandExecutionError","isErrnoException","code","status","toExitCode","test","constructor","super","join","this","name"],"mappings":"uLAKO,SAASA,EAASC,EAAaC,EAAyB,WAC7D,IAAKC,OAAOC,UAAUH,IAAQA,GAAO,EACnC,MAAM,IAAII,MAAM,gBAAgBJ,KAGlC,GAAyB,UAArBK,QAAQC,SAEV,YAqBJ,SAA2BN,GACzB,IACEO,EAAW,WAAY,CAAC,OAAQC,OAAOR,GAAM,KAAM,MAAO,CACxDS,UAAW,QACXC,QAAS,KAEb,CAAE,MAAOC,GACP,GAAIC,EAAqBD,GACvB,OAEF,MAAMA,CACR,CACF,CAlCIE,CAAkBb,GAIpB,MACMc,EA0CR,SAA6Bd,EAAae,GACxC,MAAMD,EAAaC,EAAYC,aAE/B,OADAF,EAAWG,KAAKjB,GACTc,CACT,CA9CqBI,CAAoBlB,EA+BzC,SAA+BmB,GAC7B,MAAMC,OAAEA,GAAWb,EACjB,KACA,CAAC,MAAO,cAER,CAAEE,UAAW,QAAaC,QAAS,MAE/BW,EAAmBC,EAAyBF,GAClD,OAAOG,EAA6BJ,EAASE,EAC/C,CAzCsBG,CAAsBxB,IAE1C,IAAK,MAAMyB,KAAaX,EACtBY,EAAaD,EAAWxB,EAE5B,CAEA,SAASyB,EAAa1B,EAAaC,GACjC,IACEI,QAAQsB,KAAK3B,EAAKC,EACpB,CAAE,MAAOU,GACP,GAAIC,EAAqBD,GACvB,OAEF,MAAMA,CACR,CACF,CAiCA,SAASJ,EACPqB,EACAC,EACAC,GAEA,IAOE,MAAO,CAAEV,OANMW,EAAaH,EAAS,IAAIC,GAAO,CAC9CG,SAAU,OACVvB,UAAWqB,GAASrB,UACpBC,QAASoB,GAASpB,QAClBuB,MAAO,CAAC,SAAU,OAAQ,UAEXC,OAAQ,GAC3B,CAAE,MAAOvB,GACP,MAAMuB,EA6BV,SAAuBvB,GACrB,GAAqB,iBAAVA,GAAgC,OAAVA,KAAoB,WAAYA,GAC/D,MAAO,GAGT,MAAMuB,EAAUvB,EAAoCuB,OACpD,GAAsB,iBAAXA,EACT,OAAOA,EAET,GAAIC,OAAOC,SAASF,GAClB,OAAOA,EAAOG,SAAS,QAEzB,MAAO,EACT,CA1CmBC,CAAc3B,GAC7B,MAAM,IAAI4B,EAAsBX,EAASC,EAAMK,EAenD,SAAoBvB,GAClB,GAAI6B,EAAiB7B,GACnB,OAAOA,EAAM8B,KAEf,GAAqB,iBAAV9B,GAAgC,OAAVA,GAAkB,WAAYA,EAAO,CACpE,MAAM+B,EAAU/B,EAA8B+B,OAC9C,GAAsB,iBAAXA,EACT,OAAOA,CAEX,CACA,MACF,CA1B2DC,CAAWhC,GACpE,CACF,CAEA,SAASC,EAAqBD,GAC5B,SAAI6B,EAAiB7B,IAAyB,UAAfA,EAAM8B,OAIjC9B,aAAiB4B,GACZ,yEAAyEK,KAAKjC,EAAMuB,OAG/F,CA8BA,MAAMK,UAA8BnC,MAIlCyC,WAAAA,CAAYjB,EAAiBC,EAAyBK,EAAgBO,GACpEK,MAAM,mBAAmBlB,KAAWC,EAAKkB,KAAK,QAC9CC,KAAKC,KAAO,wBACZD,KAAKd,OAASA,EACdc,KAAKP,KAAOA,CACd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/shared-lib-node",
3
- "version": "8.1.7",
3
+ "version": "8.2.1",
4
4
  "description": "Shared library for WillBooster Node.js projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,8 +45,7 @@
45
45
  "prettier": "@willbooster/prettier-config",
46
46
  "dependencies": {
47
47
  "dotenv": "17.3.1",
48
- "dotenv-expand": "12.0.3",
49
- "tree-kill": "1.2.2"
48
+ "dotenv-expand": "12.0.3"
50
49
  },
51
50
  "devDependencies": {
52
51
  "@types/bun": "1.3.9",
@@ -62,8 +61,8 @@
62
61
  "eslint-import-resolver-typescript": "4.4.4",
63
62
  "eslint-plugin-import-x": "4.16.1",
64
63
  "eslint-plugin-sort-class-members": "1.21.0",
65
- "eslint-plugin-sort-destructure-keys": "2.0.0",
66
- "eslint-plugin-unicorn": "62.0.0",
64
+ "eslint-plugin-sort-destructure-keys": "3.0.0",
65
+ "eslint-plugin-unicorn": "63.0.0",
67
66
  "eslint-plugin-unused-imports": "4.4.1",
68
67
  "globals": "17.3.0",
69
68
  "lint-staged": "16.2.7",
@@ -72,7 +71,7 @@
72
71
  "prettier-plugin-java": "2.8.1",
73
72
  "sort-package-json": "3.6.1",
74
73
  "typescript": "5.9.3",
75
- "typescript-eslint": "8.56.0",
74
+ "typescript-eslint": "8.56.1",
76
75
  "vitest": "4.0.18"
77
76
  },
78
77
  "publishConfig": {