@willbooster/shared-lib-node 1.0.0 → 1.1.0
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/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -5
- package/dist/cjs/spawn.cjs +2 -0
- package/dist/{esm/spawn.mjs.map → cjs/spawn.cjs.map} +1 -1
- package/dist/{esm/spawn.d.mts → cjs/spawn.d.cts} +0 -0
- package/dist/esm/{index.d.mts → index.d.ts} +0 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/spawn.d.ts +5 -0
- package/dist/esm/{spawn.mjs → spawn.js} +1 -1
- package/dist/esm/spawn.js.map +1 -0
- package/package.json +12 -12
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/index.mjs.map +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=require("
|
|
1
|
+
"use strict";var s=require("./spawn.cjs");exports.spawnAsync=s.spawnAsync;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, SpawnSyncReturns, StdioNull, StdioPipe } from "node:child_process";
|
|
3
|
-
type SpawnAsyncReturns = Omit<SpawnSyncReturns<string>, "output" | "error">;
|
|
4
|
-
declare function spawnAsync(command: string, args?: ReadonlyArray<string>, options?: SpawnOptionsWithoutStdio | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe> | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull> | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe> | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe> | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull> | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull> | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe> | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull> | SpawnOptions): Promise<SpawnAsyncReturns>;
|
|
5
|
-
export { spawnAsync };
|
|
1
|
+
export { spawnAsync } from "./spawn.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=require("node:child_process");exports.spawnAsync=async function(r,t,o){return new Promise(((n,e)=>{try{const d=s.spawn(r,t??[],o??{});let a="",c="";d.stdout?.on("data",(s=>{a+=s})),d.stderr?.on("data",(s=>{c+=s})),d.on("error",(s=>{e(s)})),d.on("close",((s,r)=>{void 0===d.pid?e(new Error("Process has no pid.")):n({pid:d.pid,stdout:a,stderr:c,status:s,signal:r})}))}catch(s){e(s)}}))};
|
|
2
|
+
//# sourceMappingURL=spawn.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.
|
|
1
|
+
{"version":3,"file":"spawn.cjs","sources":["../../src/spawn.ts"],"sourcesContent":["import {\n spawn,\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'node:child_process';\n\nexport type SpawnAsyncReturns = Omit<SpawnSyncReturns<string>, 'output' | 'error'>;\n\nexport async function spawnAsync(\n command: string,\n args?: ReadonlyArray<string>,\n options?:\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): Promise<SpawnAsyncReturns> {\n return new Promise((resolve, reject) => {\n try {\n const proc = spawn(command, args ?? [], options ?? {});\n let stdout = '';\n let stderr = '';\n\n proc.stdout?.on('data', (data) => {\n stdout += data;\n });\n proc.stderr?.on('data', (data) => {\n stderr += data;\n });\n\n proc.on('error', (error) => {\n reject(error);\n });\n proc.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\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 } catch (error) {\n reject(error);\n }\n });\n}\n"],"names":["async","command","args","options","Promise","resolve","reject","proc","spawn","stdout","stderr","on","data","error","code","signal","undefined","pid","Error","status"],"mappings":"oEAYOA,eACLC,EACAC,EACAC,GAYA,OAAO,IAAIC,SAAQ,CAACC,EAASC,KAC3B,IACE,MAAMC,EAAOC,EAAAA,MAAMP,EAASC,GAAQ,GAAIC,GAAW,CAAA,GACnD,IAAIM,EAAS,GACTC,EAAS,GAEbH,EAAKE,QAAQE,GAAG,QAASC,IACvBH,GAAUG,CAAI,IAEhBL,EAAKG,QAAQC,GAAG,QAASC,IACvBF,GAAUE,CAAI,IAGhBL,EAAKI,GAAG,SAAUE,IAChBP,EAAOO,EAAM,IAEfN,EAAKI,GAAG,SAAS,CAACG,EAAqBC,UACpBC,IAAbT,EAAKU,IACPX,EAAO,IAAIY,MAAM,wBAEjBb,EAAQ,CACNY,IAAKV,EAAKU,IACVR,SACAC,SACAS,OAAQL,EACRC,UAEJ,GAIJ,CAFE,MAAOF,GACPP,EAAOO,EACT,IAEJ"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, SpawnSyncReturns, StdioNull, StdioPipe } from 'node:child_process';
|
|
3
|
+
type SpawnAsyncReturns = Omit<SpawnSyncReturns<string>, 'output' | 'error'>;
|
|
4
|
+
declare function spawnAsync(command: string, args?: ReadonlyArray<string>, options?: SpawnOptionsWithoutStdio | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe> | SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull> | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe> | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe> | SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull> | SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull> | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe> | SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull> | SpawnOptions): Promise<SpawnAsyncReturns>;
|
|
5
|
+
export { SpawnAsyncReturns, spawnAsync };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{spawn as o}from"node:child_process";async function r(r,t,s){return new Promise(((n,d)=>{try{const e=o(r,t??[],s??{});let i="",a="";e.stdout?.on("data",(o=>{i+=o})),e.stderr?.on("data",(o=>{a+=o})),e.on("error",(o=>{d(o)})),e.on("close",((o,r)=>{void 0===e.pid?d(new Error("Process has no pid.")):n({pid:e.pid,stdout:i,stderr:a,status:o,signal:r})}))}catch(o){d(o)}}))}export{r as spawnAsync};
|
|
2
|
-
//# sourceMappingURL=spawn.
|
|
2
|
+
//# sourceMappingURL=spawn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.js","sources":["../../src/spawn.ts"],"sourcesContent":["import {\n spawn,\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'node:child_process';\n\nexport type SpawnAsyncReturns = Omit<SpawnSyncReturns<string>, 'output' | 'error'>;\n\nexport async function spawnAsync(\n command: string,\n args?: ReadonlyArray<string>,\n options?:\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): Promise<SpawnAsyncReturns> {\n return new Promise((resolve, reject) => {\n try {\n const proc = spawn(command, args ?? [], options ?? {});\n let stdout = '';\n let stderr = '';\n\n proc.stdout?.on('data', (data) => {\n stdout += data;\n });\n proc.stderr?.on('data', (data) => {\n stderr += data;\n });\n\n proc.on('error', (error) => {\n reject(error);\n });\n proc.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\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 } catch (error) {\n reject(error);\n }\n });\n}\n"],"names":["async","spawnAsync","command","args","options","Promise","resolve","reject","proc","spawn","stdout","stderr","on","data","error","code","signal","undefined","pid","Error","status"],"mappings":"2CAYOA,eAAeC,EACpBC,EACAC,EACAC,GAYA,OAAO,IAAIC,SAAQ,CAACC,EAASC,KAC3B,IACE,MAAMC,EAAOC,EAAMP,EAASC,GAAQ,GAAIC,GAAW,CAAA,GACnD,IAAIM,EAAS,GACTC,EAAS,GAEbH,EAAKE,QAAQE,GAAG,QAASC,IACvBH,GAAUG,CAAI,IAEhBL,EAAKG,QAAQC,GAAG,QAASC,IACvBF,GAAUE,CAAI,IAGhBL,EAAKI,GAAG,SAAUE,IAChBP,EAAOO,EAAM,IAEfN,EAAKI,GAAG,SAAS,CAACG,EAAqBC,UACpBC,IAAbT,EAAKU,IACPX,EAAO,IAAIY,MAAM,wBAEjBb,EAAQ,CACNY,IAAKV,EAAKU,IACVR,SACAC,SACAS,OAAQL,EACRC,UAEJ,GAIJ,CAFE,MAAOF,GACPP,EAAOO,EACT,IAEJ"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/shared-lib-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "WillBooster Inc.",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/esm/index.d.mts",
|
|
11
10
|
"require": "./dist/cjs/index.cjs",
|
|
12
|
-
"import": "./dist/esm/index.
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"types": "./dist/esm/index.d.ts"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"main": "dist/cjs/index.cjs",
|
|
16
|
-
"module": "dist/esm/index.
|
|
17
|
-
"types": "dist/
|
|
16
|
+
"module": "dist/esm/index.js",
|
|
17
|
+
"types": "dist/esm/index.d.ts",
|
|
18
18
|
"files": [
|
|
19
19
|
"bin/",
|
|
20
20
|
"dist/"
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
},
|
|
32
32
|
"prettier": "@willbooster/prettier-config",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/eslint": "8.
|
|
34
|
+
"@types/eslint": "8.21.0",
|
|
35
35
|
"@types/micromatch": "4.0.2",
|
|
36
36
|
"@types/prettier": "2.7.2",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
38
|
-
"@typescript-eslint/parser": "5.
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "5.50.0",
|
|
38
|
+
"@typescript-eslint/parser": "5.50.0",
|
|
39
39
|
"@willbooster/eslint-config-ts": "10.0.8",
|
|
40
40
|
"@willbooster/prettier-config": "9.1.1",
|
|
41
|
-
"build-ts": "5.
|
|
41
|
+
"build-ts": "5.5.0",
|
|
42
42
|
"eslint": "8.33.0",
|
|
43
43
|
"eslint-config-prettier": "8.6.0",
|
|
44
44
|
"eslint-import-resolver-typescript": "3.5.3",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"lint-staged": "13.1.0",
|
|
50
50
|
"micromatch": "4.0.5",
|
|
51
51
|
"prettier": "2.8.3",
|
|
52
|
-
"sort-package-json": "2.
|
|
53
|
-
"typescript": "4.9.
|
|
54
|
-
"vitest": "0.28.
|
|
52
|
+
"sort-package-json": "2.4.1",
|
|
53
|
+
"typescript": "4.9.5",
|
|
54
|
+
"vitest": "0.28.4"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
package/dist/esm/index.mjs
DELETED
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|