@willbooster/shared-lib-node 1.0.1 → 1.2.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.
@@ -0,0 +1,2 @@
1
+ "use strict";var s=require("./spawn.cjs");exports.spawnAsync=s.spawnAsync;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -1,2 +1,2 @@
1
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.js.map
2
+ //# sourceMappingURL=spawn.cjs.map
@@ -0,0 +1 @@
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
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "@willbooster/shared-lib-node",
3
- "version": "1.0.1",
3
+ "version": "1.2.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.ts",
11
- "require": "./dist/cjs/index.js",
12
- "import": "./dist/esm/index.js"
10
+ "require": "./dist/cjs/index.cjs",
11
+ "import": "./dist/esm/index.js",
12
+ "types": "./dist/esm/index.d.ts"
13
+ },
14
+ "./src": {
15
+ "require": "./src/index.ts",
16
+ "import": "./src/index.ts",
17
+ "types": "./src/index.ts"
13
18
  }
14
19
  },
15
- "main": "dist/cjs/index.js",
20
+ "main": "dist/cjs/index.cjs",
16
21
  "module": "dist/esm/index.js",
17
- "types": "dist/cjs/index.d.ts",
22
+ "types": "dist/esm/index.d.ts",
18
23
  "files": [
19
24
  "bin/",
20
25
  "dist/"
@@ -31,14 +36,14 @@
31
36
  },
32
37
  "prettier": "@willbooster/prettier-config",
33
38
  "devDependencies": {
34
- "@types/eslint": "8.4.10",
39
+ "@types/eslint": "8.21.0",
35
40
  "@types/micromatch": "4.0.2",
36
41
  "@types/prettier": "2.7.2",
37
- "@typescript-eslint/eslint-plugin": "5.50.0",
38
- "@typescript-eslint/parser": "5.50.0",
42
+ "@typescript-eslint/eslint-plugin": "5.51.0",
43
+ "@typescript-eslint/parser": "5.51.0",
39
44
  "@willbooster/eslint-config-ts": "10.0.8",
40
45
  "@willbooster/prettier-config": "9.1.1",
41
- "build-ts": "5.3.2",
46
+ "build-ts": "5.5.0",
42
47
  "eslint": "8.33.0",
43
48
  "eslint-config-prettier": "8.6.0",
44
49
  "eslint-import-resolver-typescript": "3.5.3",
@@ -46,12 +51,12 @@
46
51
  "eslint-plugin-sort-class-members": "1.16.0",
47
52
  "eslint-plugin-sort-destructure-keys": "1.4.0",
48
53
  "eslint-plugin-unicorn": "45.0.2",
49
- "lint-staged": "13.1.0",
54
+ "lint-staged": "13.1.1",
50
55
  "micromatch": "4.0.5",
51
56
  "prettier": "2.8.3",
52
- "sort-package-json": "2.3.0",
57
+ "sort-package-json": "2.4.1",
53
58
  "typescript": "4.9.5",
54
- "vitest": "0.28.3"
59
+ "vitest": "0.28.4"
55
60
  },
56
61
  "publishConfig": {
57
62
  "access": "public"
package/dist/cjs/index.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";var s=require("./spawn.js");exports.spawnAsync=s.spawnAsync;
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
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","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"}