@idlebox/node 1.4.5 → 1.4.7
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/config/autoindex.json +4 -0
- package/config/rig.json +5 -0
- package/lib/{esm/asyncLoad.d.ts → asyncLoad.d.ts} +1 -5
- package/lib/asyncLoad.d.ts.map +1 -0
- package/lib/{esm/asyncLoad.js → asyncLoad.js} +4 -11
- package/lib/asyncLoad.js.map +1 -0
- package/lib/{esm/__create_index.generated.d.ts → autoindex.d.ts} +19 -16
- package/lib/autoindex.d.ts.map +1 -0
- package/lib/autoindex.generated.d.ts +80 -0
- package/lib/autoindex.generated.d.ts.map +1 -0
- package/lib/autoindex.generated.js +132 -0
- package/lib/autoindex.generated.js.map +1 -0
- package/lib/{esm/__create_index.generated.js → autoindex.js} +13 -7
- package/lib/autoindex.js.map +1 -0
- package/lib/child_process/error.d.ts.map +1 -0
- package/lib/{esm/child_process → child_process}/error.js +1 -1
- package/lib/child_process/error.js.map +1 -0
- package/lib/{esm/child_process → child_process}/execa.d.ts +6 -2
- package/lib/child_process/execa.d.ts.map +1 -0
- package/lib/{esm/child_process → child_process}/execa.js +8 -6
- package/lib/child_process/execa.js.map +1 -0
- package/lib/child_process/lateError.d.ts.map +1 -0
- package/lib/{esm/child_process → child_process}/lateError.js +1 -1
- package/lib/child_process/lateError.js.map +1 -0
- package/lib/{esm/child_process → child_process}/respawn.d.ts +2 -2
- package/lib/child_process/respawn.d.ts.map +1 -0
- package/lib/{esm/child_process → child_process}/respawn.js +7 -11
- package/lib/child_process/respawn.js.map +1 -0
- package/lib/cli-io/output.d.ts.map +1 -0
- package/lib/{esm/cli-io → cli-io}/output.js +1 -1
- package/lib/cli-io/output.js.map +1 -0
- package/lib/crypto/md5.d.ts.map +1 -0
- package/lib/{esm/crypto → crypto}/md5.js +1 -1
- package/lib/crypto/md5.js.map +1 -0
- package/lib/crypto/sha256.d.ts.map +1 -0
- package/lib/{esm/crypto → crypto}/sha256.js +1 -1
- package/lib/crypto/sha256.js.map +1 -0
- package/lib/environment/findBinary.d.ts +3 -0
- package/lib/environment/findBinary.d.ts.map +1 -0
- package/lib/{esm/environment → environment}/findBinary.js +1 -1
- package/lib/environment/findBinary.js.map +1 -0
- package/lib/environment/getEnvironment.d.ts.map +1 -0
- package/lib/{esm/environment → environment}/getEnvironment.js +3 -3
- package/lib/environment/getEnvironment.js.map +1 -0
- package/lib/environment/npmConfig.d.ts.map +1 -0
- package/lib/{esm/environment → environment}/npmConfig.js +1 -1
- package/lib/environment/npmConfig.js.map +1 -0
- package/lib/{esm/environment → environment}/pathEnvironment.d.ts +4 -0
- package/lib/environment/pathEnvironment.d.ts.map +1 -0
- package/lib/{esm/environment → environment}/pathEnvironment.js +8 -5
- package/lib/environment/pathEnvironment.js.map +1 -0
- package/lib/error/linux.d.ts.map +1 -0
- package/lib/{esm/error → error}/linux.js +1 -1
- package/lib/error/linux.js.map +1 -0
- package/lib/{esm/error → error}/types.d.ts +2 -2
- package/lib/error/types.d.ts.map +1 -0
- package/lib/{esm/error → error}/types.js +3 -2
- package/lib/error/types.js.map +1 -0
- package/lib/events/dumpEventEmitter.d.ts.map +1 -0
- package/lib/{esm/events → events}/dumpEventEmitter.js +1 -1
- package/lib/events/dumpEventEmitter.js.map +1 -0
- package/lib/fs/commandExists.d.ts.map +1 -0
- package/lib/{esm/fs → fs}/commandExists.js +3 -3
- package/lib/fs/commandExists.js.map +1 -0
- package/lib/fs/emptyDir.d.ts +10 -0
- package/lib/fs/emptyDir.d.ts.map +1 -0
- package/lib/{esm/fs → fs}/emptyDir.js +6 -3
- package/lib/fs/emptyDir.js.map +1 -0
- package/lib/fs/ensureDir.d.ts +3 -0
- package/lib/fs/ensureDir.d.ts.map +1 -0
- package/lib/fs/ensureDir.js +20 -0
- package/lib/fs/ensureDir.js.map +1 -0
- package/lib/fs/exists.d.ts.map +1 -0
- package/lib/{esm/fs → fs}/exists.js +1 -1
- package/lib/fs/exists.js.map +1 -0
- package/lib/fs/tempFolder.d.ts.map +1 -0
- package/lib/{esm/fs → fs}/tempFolder.js +1 -1
- package/lib/fs/tempFolder.js.map +1 -0
- package/lib/fs/weiteChanged.d.ts.map +1 -0
- package/lib/{esm/fs → fs}/weiteChanged.js +1 -1
- package/lib/fs/weiteChanged.js.map +1 -0
- package/lib/lifecycle/register.d.ts +10 -0
- package/lib/lifecycle/register.d.ts.map +1 -0
- package/lib/lifecycle/register.js +81 -0
- package/lib/lifecycle/register.js.map +1 -0
- package/lib/log/terminal.d.ts.map +1 -0
- package/lib/{esm/log → log}/terminal.js +1 -1
- package/lib/{cjs/log/terminal.cjs.map → log/terminal.js.map} +1 -10
- package/lib/path-resolve/findPackageRoot.d.ts +2 -0
- package/lib/path-resolve/findPackageRoot.d.ts.map +1 -0
- package/lib/{esm/path-resolve → path-resolve}/findPackageRoot.js +2 -2
- package/lib/path-resolve/findPackageRoot.js.map +1 -0
- package/lib/{esm/path-resolve → path-resolve}/findUp.d.ts +4 -4
- package/lib/path-resolve/findUp.d.ts.map +1 -0
- package/lib/path-resolve/findUp.js +118 -0
- package/lib/path-resolve/findUp.js.map +1 -0
- package/lib/path-resolve/getAllUp.d.ts.map +1 -0
- package/lib/{esm/path-resolve → path-resolve}/getAllUp.js +1 -1
- package/lib/path-resolve/getAllUp.js.map +1 -0
- package/lib/path-resolve/lrelative.d.ts.map +1 -0
- package/lib/{esm/path-resolve → path-resolve}/lrelative.js +1 -1
- package/lib/path-resolve/lrelative.js.map +1 -0
- package/lib/path-resolve/nodeResolvePathArray.d.ts.map +1 -0
- package/lib/{esm/path-resolve → path-resolve}/nodeResolvePathArray.js +1 -1
- package/lib/path-resolve/nodeResolvePathArray.js.map +1 -0
- package/lib/path-resolve/resolvePath.d.ts.map +1 -0
- package/lib/{esm/path-resolve → path-resolve}/resolvePath.js +1 -1
- package/lib/path-resolve/resolvePath.js.map +1 -0
- package/lib/preload.d.ts.map +1 -0
- package/lib/preload.js +2 -0
- package/lib/preload.js.map +1 -0
- package/lib/stream/blackHoleStream.d.ts.map +1 -0
- package/lib/{esm/stream → stream}/blackHoleStream.js +1 -1
- package/lib/stream/blackHoleStream.js.map +1 -0
- package/lib/stream/collectingStream.d.ts.map +1 -0
- package/lib/{esm/stream → stream}/collectingStream.js +1 -1
- package/lib/stream/collectingStream.js.map +1 -0
- package/lib/stream/disposableStream.d.ts.map +1 -0
- package/lib/{esm/stream → stream}/disposableStream.js +1 -1
- package/lib/stream/disposableStream.js.map +1 -0
- package/lib/stream/drainStream.d.ts.map +1 -0
- package/lib/{esm/stream → stream}/drainStream.js +1 -1
- package/lib/stream/drainStream.js.map +1 -0
- package/lib/stream/loggerStream.d.ts.map +1 -0
- package/lib/{esm/stream → stream}/loggerStream.js +1 -1
- package/lib/stream/loggerStream.js.map +1 -0
- package/lib/stream/streamPromise.d.ts.map +1 -0
- package/lib/{esm/stream → stream}/streamPromise.js +1 -1
- package/lib/stream/streamPromise.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +17 -31
- package/src/asyncLoad.ts +3 -12
- package/src/autoindex.generated.ts +159 -0
- package/src/autoindex.ts +153 -0
- package/src/child_process/execa.ts +14 -7
- package/src/child_process/respawn.ts +7 -12
- package/src/environment/findBinary.ts +2 -5
- package/src/environment/getEnvironment.ts +2 -2
- package/src/environment/pathEnvironment.ts +7 -4
- package/src/error/types.ts +3 -2
- package/src/fs/commandExists.ts +2 -2
- package/src/fs/emptyDir.ts +6 -3
- package/src/fs/ensureDir.ts +19 -0
- package/src/lifecycle/register.ts +97 -0
- package/src/path-resolve/findPackageRoot.ts +1 -1
- package/src/path-resolve/findUp.ts +105 -55
- package/src/tsconfig.json +4 -4
- package/tests/01-load/load.test.js +37 -0
- package/tests/01-load/module.js +8 -0
- package/tests/01-load/package.json +4 -0
- package/tests/01-load/require.cjs +7 -0
- package/tests/include/paths.js +3 -0
- package/tests/package.json +4 -0
- package/tests/respawn.js +12 -0
- package/lib/cjs/__create_index.generated.cjs +0 -186
- package/lib/cjs/__create_index.generated.cjs.map +0 -10
- package/lib/cjs/asyncLoad.cjs +0 -55
- package/lib/cjs/asyncLoad.cjs.map +0 -10
- package/lib/cjs/child_process/error.cjs +0 -45
- package/lib/cjs/child_process/error.cjs.map +0 -10
- package/lib/cjs/child_process/execa.cjs +0 -96
- package/lib/cjs/child_process/execa.cjs.map +0 -10
- package/lib/cjs/child_process/lateError.cjs +0 -76
- package/lib/cjs/child_process/lateError.cjs.map +0 -10
- package/lib/cjs/child_process/respawn.cjs +0 -123
- package/lib/cjs/child_process/respawn.cjs.map +0 -10
- package/lib/cjs/cli-io/output.cjs +0 -7
- package/lib/cjs/cli-io/output.cjs.map +0 -10
- package/lib/cjs/crypto/md5.cjs +0 -8
- package/lib/cjs/crypto/md5.cjs.map +0 -10
- package/lib/cjs/crypto/sha256.cjs +0 -8
- package/lib/cjs/crypto/sha256.cjs.map +0 -10
- package/lib/cjs/environment/findBinary.cjs +0 -15
- package/lib/cjs/environment/findBinary.cjs.map +0 -10
- package/lib/cjs/environment/getEnvironment.cjs +0 -55
- package/lib/cjs/environment/getEnvironment.cjs.map +0 -10
- package/lib/cjs/environment/npmConfig.cjs +0 -24
- package/lib/cjs/environment/npmConfig.cjs.map +0 -10
- package/lib/cjs/environment/pathEnvironment.cjs +0 -46
- package/lib/cjs/environment/pathEnvironment.cjs.map +0 -10
- package/lib/cjs/error/linux.cjs +0 -129
- package/lib/cjs/error/linux.cjs.map +0 -10
- package/lib/cjs/error/nodejs-error-code.generated.cjs +0 -2498
- package/lib/cjs/error/nodejs-error-code.generated.cjs.map +0 -10
- package/lib/cjs/error/types.cjs +0 -32
- package/lib/cjs/error/types.cjs.map +0 -10
- package/lib/cjs/events/dumpEventEmitter.cjs +0 -11
- package/lib/cjs/events/dumpEventEmitter.cjs.map +0 -10
- package/lib/cjs/fs/commandExists.cjs +0 -53
- package/lib/cjs/fs/commandExists.cjs.map +0 -10
- package/lib/cjs/fs/emptyDir.cjs +0 -30
- package/lib/cjs/fs/emptyDir.cjs.map +0 -10
- package/lib/cjs/fs/exists.cjs +0 -35
- package/lib/cjs/fs/exists.cjs.map +0 -10
- package/lib/cjs/fs/tempFolder.cjs +0 -54
- package/lib/cjs/fs/tempFolder.cjs.map +0 -10
- package/lib/cjs/fs/weiteChanged.cjs +0 -52
- package/lib/cjs/fs/weiteChanged.cjs.map +0 -10
- package/lib/cjs/log/terminal.cjs +0 -41
- package/lib/cjs/path-resolve/findPackageRoot.cjs +0 -23
- package/lib/cjs/path-resolve/findPackageRoot.cjs.map +0 -10
- package/lib/cjs/path-resolve/findUp.cjs +0 -72
- package/lib/cjs/path-resolve/findUp.cjs.map +0 -10
- package/lib/cjs/path-resolve/getAllUp.cjs +0 -17
- package/lib/cjs/path-resolve/getAllUp.cjs.map +0 -10
- package/lib/cjs/path-resolve/lrelative.cjs +0 -23
- package/lib/cjs/path-resolve/lrelative.cjs.map +0 -10
- package/lib/cjs/path-resolve/nodeResolvePathArray.cjs +0 -13
- package/lib/cjs/path-resolve/nodeResolvePathArray.cjs.map +0 -10
- package/lib/cjs/path-resolve/resolvePath.cjs +0 -27
- package/lib/cjs/path-resolve/resolvePath.cjs.map +0 -10
- package/lib/cjs/preload.cjs +0 -3
- package/lib/cjs/preload.cjs.map +0 -10
- package/lib/cjs/stream/blackHoleStream.cjs +0 -11
- package/lib/cjs/stream/blackHoleStream.cjs.map +0 -10
- package/lib/cjs/stream/collectingStream.cjs +0 -79
- package/lib/cjs/stream/collectingStream.cjs.map +0 -10
- package/lib/cjs/stream/disposableStream.cjs +0 -22
- package/lib/cjs/stream/disposableStream.cjs.map +0 -10
- package/lib/cjs/stream/drainStream.cjs +0 -18
- package/lib/cjs/stream/drainStream.cjs.map +0 -10
- package/lib/cjs/stream/loggerStream.cjs +0 -59
- package/lib/cjs/stream/loggerStream.cjs.map +0 -10
- package/lib/cjs/stream/streamPromise.cjs +0 -25
- package/lib/cjs/stream/streamPromise.cjs.map +0 -10
- package/lib/esm/__create_index.generated.d.ts.map +0 -10
- package/lib/esm/__create_index.generated.js.map +0 -10
- package/lib/esm/__virtual_tsconfig.tsbuildinfo +0 -1
- package/lib/esm/asyncLoad.d.ts.map +0 -10
- package/lib/esm/asyncLoad.js.map +0 -10
- package/lib/esm/child_process/error.d.ts.map +0 -10
- package/lib/esm/child_process/error.js.map +0 -10
- package/lib/esm/child_process/execa.d.ts.map +0 -10
- package/lib/esm/child_process/execa.js.map +0 -10
- package/lib/esm/child_process/lateError.d.ts.map +0 -10
- package/lib/esm/child_process/lateError.js.map +0 -10
- package/lib/esm/child_process/respawn.d.ts.map +0 -10
- package/lib/esm/child_process/respawn.js.map +0 -10
- package/lib/esm/cli-io/output.d.ts.map +0 -10
- package/lib/esm/cli-io/output.js.map +0 -10
- package/lib/esm/crypto/md5.d.ts.map +0 -10
- package/lib/esm/crypto/md5.js.map +0 -10
- package/lib/esm/crypto/sha256.d.ts.map +0 -10
- package/lib/esm/crypto/sha256.js.map +0 -10
- package/lib/esm/environment/findBinary.d.ts +0 -2
- package/lib/esm/environment/findBinary.d.ts.map +0 -10
- package/lib/esm/environment/findBinary.js.map +0 -10
- package/lib/esm/environment/getEnvironment.d.ts.map +0 -10
- package/lib/esm/environment/getEnvironment.js.map +0 -10
- package/lib/esm/environment/npmConfig.d.ts.map +0 -10
- package/lib/esm/environment/npmConfig.js.map +0 -10
- package/lib/esm/environment/pathEnvironment.d.ts.map +0 -10
- package/lib/esm/environment/pathEnvironment.js.map +0 -10
- package/lib/esm/error/linux.d.ts.map +0 -10
- package/lib/esm/error/linux.js.map +0 -10
- package/lib/esm/error/nodejs-error-code.generated.d.ts +0 -2485
- package/lib/esm/error/nodejs-error-code.generated.d.ts.map +0 -10
- package/lib/esm/error/nodejs-error-code.generated.js +0 -2495
- package/lib/esm/error/nodejs-error-code.generated.js.map +0 -10
- package/lib/esm/error/types.d.ts.map +0 -10
- package/lib/esm/error/types.js.map +0 -10
- package/lib/esm/events/dumpEventEmitter.d.ts.map +0 -10
- package/lib/esm/events/dumpEventEmitter.js.map +0 -10
- package/lib/esm/fs/commandExists.d.ts.map +0 -10
- package/lib/esm/fs/commandExists.js.map +0 -10
- package/lib/esm/fs/emptyDir.d.ts +0 -7
- package/lib/esm/fs/emptyDir.d.ts.map +0 -10
- package/lib/esm/fs/emptyDir.js.map +0 -10
- package/lib/esm/fs/exists.d.ts.map +0 -10
- package/lib/esm/fs/exists.js.map +0 -10
- package/lib/esm/fs/tempFolder.d.ts.map +0 -10
- package/lib/esm/fs/tempFolder.js.map +0 -10
- package/lib/esm/fs/weiteChanged.d.ts.map +0 -10
- package/lib/esm/fs/weiteChanged.js.map +0 -10
- package/lib/esm/log/terminal.d.ts.map +0 -10
- package/lib/esm/log/terminal.js.map +0 -10
- package/lib/esm/path-resolve/findPackageRoot.d.ts +0 -2
- package/lib/esm/path-resolve/findPackageRoot.d.ts.map +0 -10
- package/lib/esm/path-resolve/findPackageRoot.js.map +0 -10
- package/lib/esm/path-resolve/findUp.d.ts.map +0 -10
- package/lib/esm/path-resolve/findUp.js +0 -68
- package/lib/esm/path-resolve/findUp.js.map +0 -10
- package/lib/esm/path-resolve/getAllUp.d.ts.map +0 -10
- package/lib/esm/path-resolve/getAllUp.js.map +0 -10
- package/lib/esm/path-resolve/lrelative.d.ts.map +0 -10
- package/lib/esm/path-resolve/lrelative.js.map +0 -10
- package/lib/esm/path-resolve/nodeResolvePathArray.d.ts.map +0 -10
- package/lib/esm/path-resolve/nodeResolvePathArray.js.map +0 -10
- package/lib/esm/path-resolve/resolvePath.d.ts.map +0 -10
- package/lib/esm/path-resolve/resolvePath.js.map +0 -10
- package/lib/esm/preload.d.ts.map +0 -10
- package/lib/esm/preload.js +0 -2
- package/lib/esm/preload.js.map +0 -10
- package/lib/esm/stream/blackHoleStream.d.ts.map +0 -10
- package/lib/esm/stream/blackHoleStream.js.map +0 -10
- package/lib/esm/stream/collectingStream.d.ts.map +0 -10
- package/lib/esm/stream/collectingStream.js.map +0 -10
- package/lib/esm/stream/disposableStream.d.ts.map +0 -10
- package/lib/esm/stream/disposableStream.js.map +0 -10
- package/lib/esm/stream/drainStream.d.ts.map +0 -10
- package/lib/esm/stream/drainStream.js.map +0 -10
- package/lib/esm/stream/loggerStream.d.ts.map +0 -10
- package/lib/esm/stream/loggerStream.js.map +0 -10
- package/lib/esm/stream/streamPromise.d.ts.map +0 -10
- package/lib/esm/stream/streamPromise.js.map +0 -10
- package/src/error/cache.generated.json +0 -3971
- package/src/error/nodejs-error-code.generated.ts +0 -2495
- package/src/error/nodejs-error-code.generator.ts +0 -67
- /package/lib/{esm/child_process → child_process}/error.d.ts +0 -0
- /package/lib/{esm/child_process → child_process}/lateError.d.ts +0 -0
- /package/lib/{esm/cli-io → cli-io}/output.d.ts +0 -0
- /package/lib/{esm/crypto → crypto}/md5.d.ts +0 -0
- /package/lib/{esm/crypto → crypto}/sha256.d.ts +0 -0
- /package/lib/{esm/environment → environment}/getEnvironment.d.ts +0 -0
- /package/lib/{esm/environment → environment}/npmConfig.d.ts +0 -0
- /package/lib/{esm/error → error}/linux.d.ts +0 -0
- /package/lib/{esm/events → events}/dumpEventEmitter.d.ts +0 -0
- /package/lib/{esm/fs → fs}/commandExists.d.ts +0 -0
- /package/lib/{esm/fs → fs}/exists.d.ts +0 -0
- /package/lib/{esm/fs → fs}/tempFolder.d.ts +0 -0
- /package/lib/{esm/fs → fs}/weiteChanged.d.ts +0 -0
- /package/lib/{esm/log → log}/terminal.d.ts +0 -0
- /package/lib/{esm/path-resolve → path-resolve}/getAllUp.d.ts +0 -0
- /package/lib/{esm/path-resolve → path-resolve}/lrelative.d.ts +0 -0
- /package/lib/{esm/path-resolve → path-resolve}/nodeResolvePathArray.d.ts +0 -0
- /package/lib/{esm/path-resolve → path-resolve}/resolvePath.d.ts +0 -0
- /package/lib/{esm/preload.d.ts → preload.d.ts} +0 -0
- /package/lib/{esm/stream → stream}/blackHoleStream.d.ts +0 -0
- /package/lib/{esm/stream → stream}/collectingStream.d.ts +0 -0
- /package/lib/{esm/stream → stream}/disposableStream.d.ts +0 -0
- /package/lib/{esm/stream → stream}/drainStream.d.ts +0 -0
- /package/lib/{esm/stream → stream}/loggerStream.d.ts +0 -0
- /package/lib/{esm/stream → stream}/streamPromise.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,49 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idlebox/node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"main": "./lib/cjs/__create_index.generated.cjs",
|
|
7
|
-
"module": "./lib/esm/__create_index.generated.js",
|
|
8
|
-
"types": "./lib/esm/__create_index.generated.d.ts",
|
|
4
|
+
"version": "1.4.7",
|
|
9
5
|
"exports": {
|
|
10
6
|
".": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
7
|
+
"source": "./src/autoindex.generated.ts",
|
|
8
|
+
"types": "./src/autoindex.generated.ts",
|
|
9
|
+
"default": "./lib/autoindex.generated.js"
|
|
14
10
|
},
|
|
15
11
|
"./package.json": "./package.json"
|
|
16
12
|
},
|
|
17
13
|
"sideEffects": false,
|
|
18
|
-
"repository": "https://github.com/GongT/baobao",
|
|
19
14
|
"dependencies": {
|
|
20
|
-
"execa": "^9.
|
|
15
|
+
"execa": "^9.6.0",
|
|
21
16
|
"source-map-support": "^0.5.21",
|
|
22
|
-
"@
|
|
23
|
-
"@idlebox/common": "^1.4.
|
|
17
|
+
"@idlebox/node-error-codes": "",
|
|
18
|
+
"@idlebox/common": "^1.4.14"
|
|
24
19
|
},
|
|
25
20
|
"devDependencies": {
|
|
26
|
-
"@rushstack/heft": "^0.
|
|
27
|
-
"@types/node": "^
|
|
28
|
-
"@build-script/single-dog-asset": "^1.0.
|
|
21
|
+
"@rushstack/heft": "^0.74.0",
|
|
22
|
+
"@types/node": "^24.0.14",
|
|
23
|
+
"@build-script/single-dog-asset": "^1.0.35",
|
|
24
|
+
"@mpis/run": "^0.0.2",
|
|
29
25
|
"@internal/local-rig": "^1.0.1"
|
|
30
26
|
},
|
|
31
|
-
"
|
|
32
|
-
"fix-esm": "^1.0.1"
|
|
33
|
-
},
|
|
34
|
-
"peerDependenciesMeta": {
|
|
35
|
-
"fix-esm": {
|
|
36
|
-
"optional": true
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"optionalDependencies": {
|
|
40
|
-
"kexec": "npm:@gongt/kexec@latest"
|
|
41
|
-
},
|
|
27
|
+
"decoupledDependents": "*",
|
|
42
28
|
"scripts": {
|
|
43
|
-
"
|
|
44
|
-
"build": "
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
29
|
+
"prepublishHook": "internal-prepublish-hook",
|
|
30
|
+
"build": "mpis-run build",
|
|
31
|
+
"watch": "mpis-run watch",
|
|
32
|
+
"clean": "mpis-run clean",
|
|
33
|
+
"lint": "internal-lint"
|
|
48
34
|
}
|
|
49
35
|
}
|
package/src/asyncLoad.ts
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import { prettyPrintError } from '@idlebox/common';
|
|
1
|
+
import { AppExit, prettyPrintError } from '@idlebox/common';
|
|
2
2
|
|
|
3
3
|
export type AsyncMainFunction = () => Promise<undefined | number> | Promise<void>;
|
|
4
4
|
|
|
5
|
-
export class ExitError extends Error {
|
|
6
|
-
constructor(
|
|
7
|
-
message: string,
|
|
8
|
-
public readonly code: number = 1
|
|
9
|
-
) {
|
|
10
|
-
super(message);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
5
|
type OnExit = (error?: Error) => Promise<any>;
|
|
15
6
|
|
|
16
7
|
/**
|
|
@@ -19,7 +10,7 @@ type OnExit = (error?: Error) => Promise<any>;
|
|
|
19
10
|
* setErrorLogRoot(require('path').dirname(__dirname));
|
|
20
11
|
* ```
|
|
21
12
|
**/
|
|
22
|
-
export function
|
|
13
|
+
export function executeMainFunction(main: AsyncMainFunction, onExit?: OnExit) {
|
|
23
14
|
Promise.resolve()
|
|
24
15
|
.then(async () => {
|
|
25
16
|
try {
|
|
@@ -34,7 +25,7 @@ export function runMain(main: AsyncMainFunction, onExit?: OnExit) {
|
|
|
34
25
|
}
|
|
35
26
|
})
|
|
36
27
|
.catch((e) => {
|
|
37
|
-
if (e instanceof
|
|
28
|
+
if (e instanceof AppExit) {
|
|
38
29
|
if (e.code) {
|
|
39
30
|
console.error('[exit] %s', e.message);
|
|
40
31
|
process.exitCode = e.code;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// DO NOT EDIT THIS FILE
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
/* asyncLoad.ts */
|
|
6
|
+
// Identifiers
|
|
7
|
+
export type { AsyncMainFunction } from "./asyncLoad.js";
|
|
8
|
+
export { executeMainFunction } from "./asyncLoad.js";
|
|
9
|
+
/* child_process/error.ts */
|
|
10
|
+
// Identifiers
|
|
11
|
+
export { checkChildProcessResult } from "./child_process/error.js";
|
|
12
|
+
/* child_process/execa.ts */
|
|
13
|
+
// Identifiers
|
|
14
|
+
export type { ICommand } from "./child_process/execa.js";
|
|
15
|
+
export { spawnWithoutOutputSync } from "./child_process/execa.js";
|
|
16
|
+
export { spawnWithoutOutput } from "./child_process/execa.js";
|
|
17
|
+
export { spawnGetOutputSync } from "./child_process/execa.js";
|
|
18
|
+
export { spawnGetOutput } from "./child_process/execa.js";
|
|
19
|
+
export { spawnGetEverything } from "./child_process/execa.js";
|
|
20
|
+
/* cli-io/output.ts */
|
|
21
|
+
// Identifiers
|
|
22
|
+
export { printLine } from "./cli-io/output.js";
|
|
23
|
+
/* child_process/lateError.ts */
|
|
24
|
+
// Identifiers
|
|
25
|
+
export type { ISpawnOptions } from "./child_process/lateError.js";
|
|
26
|
+
export type { ExecaReturnValue } from "./child_process/lateError.js";
|
|
27
|
+
export { execLazyError } from "./child_process/lateError.js";
|
|
28
|
+
/* error/linux.ts */
|
|
29
|
+
// Identifiers
|
|
30
|
+
export { LinuxError } from "./error/linux.js";
|
|
31
|
+
/* error/types.ts */
|
|
32
|
+
// Identifiers
|
|
33
|
+
export type { OpenSSLException } from "./error/types.js";
|
|
34
|
+
export { isModuleResolutionError } from "./error/types.js";
|
|
35
|
+
export { isNotExistsError } from "./error/types.js";
|
|
36
|
+
export { isExistsError } from "./error/types.js";
|
|
37
|
+
export { isTypeError } from "./error/types.js";
|
|
38
|
+
export { isFileTypeError } from "./error/types.js";
|
|
39
|
+
export { isNodeError } from "./error/types.js";
|
|
40
|
+
// References
|
|
41
|
+
export * from "@idlebox/node-error-codes";
|
|
42
|
+
/* fs/exists.ts */
|
|
43
|
+
// Identifiers
|
|
44
|
+
export { existsSync } from "./fs/exists.js";
|
|
45
|
+
export { exists } from "./fs/exists.js";
|
|
46
|
+
export { readFileIfExists } from "./fs/exists.js";
|
|
47
|
+
/* environment/getEnvironment.ts */
|
|
48
|
+
// Identifiers
|
|
49
|
+
export type { IEnvironmentResult } from "./environment/getEnvironment.js";
|
|
50
|
+
export { getEnvironment } from "./environment/getEnvironment.js";
|
|
51
|
+
export { deleteEnvironment } from "./environment/getEnvironment.js";
|
|
52
|
+
export { cleanupEnvironment } from "./environment/getEnvironment.js";
|
|
53
|
+
/* environment/pathEnvironment.ts */
|
|
54
|
+
// Identifiers
|
|
55
|
+
export { PATH_SEPARATOR } from "./environment/pathEnvironment.js";
|
|
56
|
+
export { PathEnvironment } from "./environment/pathEnvironment.js";
|
|
57
|
+
/* environment/findBinary.ts */
|
|
58
|
+
// Identifiers
|
|
59
|
+
export { findBinary } from "./environment/findBinary.js";
|
|
60
|
+
/* child_process/respawn.ts */
|
|
61
|
+
// Identifiers
|
|
62
|
+
export { spawnRecreateEventHandlers } from "./child_process/respawn.js";
|
|
63
|
+
export { trySpawnInScope } from "./child_process/respawn.js";
|
|
64
|
+
export { respawnInScope } from "./child_process/respawn.js";
|
|
65
|
+
/* crypto/md5.ts */
|
|
66
|
+
// Identifiers
|
|
67
|
+
export { md5 } from "./crypto/md5.js";
|
|
68
|
+
/* crypto/sha256.ts */
|
|
69
|
+
// Identifiers
|
|
70
|
+
export { sha256 } from "./crypto/sha256.js";
|
|
71
|
+
/* environment/npmConfig.ts */
|
|
72
|
+
// Identifiers
|
|
73
|
+
export { getNpmConfigValue } from "./environment/npmConfig.js";
|
|
74
|
+
/* events/dumpEventEmitter.ts */
|
|
75
|
+
// Identifiers
|
|
76
|
+
export { dumpEventEmitterEmit } from "./events/dumpEventEmitter.js";
|
|
77
|
+
/* fs/commandExists.ts */
|
|
78
|
+
// Identifiers
|
|
79
|
+
export { commandInPath } from "./fs/commandExists.js";
|
|
80
|
+
export { commandInPathSync } from "./fs/commandExists.js";
|
|
81
|
+
/* fs/emptyDir.ts */
|
|
82
|
+
// Identifiers
|
|
83
|
+
export { emptyDir } from "./fs/emptyDir.js";
|
|
84
|
+
/* fs/ensureDir.ts */
|
|
85
|
+
// Identifiers
|
|
86
|
+
export { ensureDirExists } from "./fs/ensureDir.js";
|
|
87
|
+
export { ensureParentExists } from "./fs/ensureDir.js";
|
|
88
|
+
/* fs/tempFolder.ts */
|
|
89
|
+
// Identifiers
|
|
90
|
+
export { createTempFolder } from "./fs/tempFolder.js";
|
|
91
|
+
/* fs/weiteChanged.ts */
|
|
92
|
+
// Identifiers
|
|
93
|
+
export { writeFileIfChangeSync } from "./fs/weiteChanged.js";
|
|
94
|
+
export { writeFileIfChange } from "./fs/weiteChanged.js";
|
|
95
|
+
/* lifecycle/register.ts */
|
|
96
|
+
// Identifiers
|
|
97
|
+
export { shutdown } from "./lifecycle/register.js";
|
|
98
|
+
export { registerNodejsExitHandler } from "./lifecycle/register.js";
|
|
99
|
+
export { die } from "./lifecycle/register.js";
|
|
100
|
+
/* log/terminal.ts */
|
|
101
|
+
// Identifiers
|
|
102
|
+
export { WrappedTerminalConsole } from "./log/terminal.js";
|
|
103
|
+
/* path-resolve/findUp.ts */
|
|
104
|
+
// Identifiers
|
|
105
|
+
export type { IFindOptions } from "./path-resolve/findUp.js";
|
|
106
|
+
export { findUpUntil } from "./path-resolve/findUp.js";
|
|
107
|
+
export { findUp } from "./path-resolve/findUp.js";
|
|
108
|
+
export { findUpUntilSync } from "./path-resolve/findUp.js";
|
|
109
|
+
export { findUpSync } from "./path-resolve/findUp.js";
|
|
110
|
+
/* path-resolve/findPackageRoot.ts */
|
|
111
|
+
// Identifiers
|
|
112
|
+
export { findPackageRoot } from "./path-resolve/findPackageRoot.js";
|
|
113
|
+
/* path-resolve/getAllUp.ts */
|
|
114
|
+
// Identifiers
|
|
115
|
+
export { getAllPathUpToRoot } from "./path-resolve/getAllUp.js";
|
|
116
|
+
/* path-resolve/lrelative.ts */
|
|
117
|
+
// Identifiers
|
|
118
|
+
export { lrelative } from "./path-resolve/lrelative.js";
|
|
119
|
+
/* path-resolve/nodeResolvePathArray.ts */
|
|
120
|
+
// Identifiers
|
|
121
|
+
export { nodeResolvePathArray } from "./path-resolve/nodeResolvePathArray.js";
|
|
122
|
+
/* path-resolve/resolvePath.ts */
|
|
123
|
+
// Identifiers
|
|
124
|
+
export type { ResolvePathFunction } from "./path-resolve/resolvePath.js";
|
|
125
|
+
export type { JoinPathFunction } from "./path-resolve/resolvePath.js";
|
|
126
|
+
export { resolvePath } from "./path-resolve/resolvePath.js";
|
|
127
|
+
export type { NormalizePathFunction } from "./path-resolve/resolvePath.js";
|
|
128
|
+
export { normalizePath } from "./path-resolve/resolvePath.js";
|
|
129
|
+
export { osTempDir } from "./path-resolve/resolvePath.js";
|
|
130
|
+
export { relativePath } from "./path-resolve/resolvePath.js";
|
|
131
|
+
/* stream/blackHoleStream.ts */
|
|
132
|
+
// Identifiers
|
|
133
|
+
export { BlackHoleStream } from "./stream/blackHoleStream.js";
|
|
134
|
+
/* stream/streamPromise.ts */
|
|
135
|
+
// Identifiers
|
|
136
|
+
export { streamPromise } from "./stream/streamPromise.js";
|
|
137
|
+
export { streamHasEnd } from "./stream/streamPromise.js";
|
|
138
|
+
/* stream/collectingStream.ts */
|
|
139
|
+
// Identifiers
|
|
140
|
+
export { streamToBuffer } from "./stream/collectingStream.js";
|
|
141
|
+
export { RawCollectingStream } from "./stream/collectingStream.js";
|
|
142
|
+
export { CollectingStream } from "./stream/collectingStream.js";
|
|
143
|
+
/* stream/disposableStream.ts */
|
|
144
|
+
// Identifiers
|
|
145
|
+
export { disposableStream } from "./stream/disposableStream.js";
|
|
146
|
+
/* stream/drainStream.ts */
|
|
147
|
+
// Identifiers
|
|
148
|
+
export { drainStream } from "./stream/drainStream.js";
|
|
149
|
+
/* stream/loggerStream.ts */
|
|
150
|
+
// Identifiers
|
|
151
|
+
export type { LogFunction } from "./stream/loggerStream.js";
|
|
152
|
+
export { LoggerStream } from "./stream/loggerStream.js";
|
|
153
|
+
export { HexDumpLoggerStream } from "./stream/loggerStream.js";
|
|
154
|
+
/* autoindex.ts */
|
|
155
|
+
// Identifiers
|
|
156
|
+
// References
|
|
157
|
+
export * from "@idlebox/node-error-codes";
|
|
158
|
+
/* preload.ts */
|
|
159
|
+
// Identifiers
|
package/src/autoindex.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// DO NOT EDIT THIS FILE
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
/* asyncLoad.ts */
|
|
6
|
+
// Identifiers
|
|
7
|
+
export type { AsyncMainFunction } from "./asyncLoad.js";
|
|
8
|
+
export { executeMainFunction } from "./asyncLoad.js";
|
|
9
|
+
/* preload.ts */
|
|
10
|
+
// Identifiers
|
|
11
|
+
/* child_process/error.ts */
|
|
12
|
+
// Identifiers
|
|
13
|
+
export { checkChildProcessResult } from "./child_process/error.js";
|
|
14
|
+
/* child_process/execa.ts */
|
|
15
|
+
// Identifiers
|
|
16
|
+
export type { ICommand } from "./child_process/execa.js";
|
|
17
|
+
export { spawnWithoutOutputSync } from "./child_process/execa.js";
|
|
18
|
+
export { spawnWithoutOutput } from "./child_process/execa.js";
|
|
19
|
+
export { spawnGetOutputSync } from "./child_process/execa.js";
|
|
20
|
+
export { spawnGetOutput } from "./child_process/execa.js";
|
|
21
|
+
export { spawnGetEverything } from "./child_process/execa.js";
|
|
22
|
+
/* cli-io/output.ts */
|
|
23
|
+
// Identifiers
|
|
24
|
+
export { printLine } from "./cli-io/output.js";
|
|
25
|
+
/* child_process/lateError.ts */
|
|
26
|
+
// Identifiers
|
|
27
|
+
export type { ISpawnOptions } from "./child_process/lateError.js";
|
|
28
|
+
export type { ExecaReturnValue } from "./child_process/lateError.js";
|
|
29
|
+
export { execLazyError } from "./child_process/lateError.js";
|
|
30
|
+
/* error/linux.ts */
|
|
31
|
+
// Identifiers
|
|
32
|
+
export { LinuxError } from "./error/linux.js";
|
|
33
|
+
/* error/types.ts */
|
|
34
|
+
// Identifiers
|
|
35
|
+
export type { OpenSSLException } from "./error/types.js";
|
|
36
|
+
export { isModuleResolutionError } from "./error/types.js";
|
|
37
|
+
export { isNotExistsError } from "./error/types.js";
|
|
38
|
+
export { isExistsError } from "./error/types.js";
|
|
39
|
+
export { isTypeError } from "./error/types.js";
|
|
40
|
+
export { isFileTypeError } from "./error/types.js";
|
|
41
|
+
export { isNodeError } from "./error/types.js";
|
|
42
|
+
// References
|
|
43
|
+
export * from "@idlebox/node-error-codes";
|
|
44
|
+
/* fs/exists.ts */
|
|
45
|
+
// Identifiers
|
|
46
|
+
export { existsSync } from "./fs/exists.js";
|
|
47
|
+
export { exists } from "./fs/exists.js";
|
|
48
|
+
export { readFileIfExists } from "./fs/exists.js";
|
|
49
|
+
/* environment/getEnvironment.ts */
|
|
50
|
+
// Identifiers
|
|
51
|
+
export type { IEnvironmentResult } from "./environment/getEnvironment.js";
|
|
52
|
+
export { getEnvironment } from "./environment/getEnvironment.js";
|
|
53
|
+
export { deleteEnvironment } from "./environment/getEnvironment.js";
|
|
54
|
+
export { cleanupEnvironment } from "./environment/getEnvironment.js";
|
|
55
|
+
/* environment/pathEnvironment.ts */
|
|
56
|
+
// Identifiers
|
|
57
|
+
export { PATH_SEPARATOR } from "./environment/pathEnvironment.js";
|
|
58
|
+
export { PathEnvironment } from "./environment/pathEnvironment.js";
|
|
59
|
+
/* environment/findBinary.ts */
|
|
60
|
+
// Identifiers
|
|
61
|
+
export { findBinary } from "./environment/findBinary.js";
|
|
62
|
+
/* child_process/respawn.ts */
|
|
63
|
+
// Identifiers
|
|
64
|
+
export { spawnRecreateEventHandlers } from "./child_process/respawn.js";
|
|
65
|
+
export { trySpawnInScope } from "./child_process/respawn.js";
|
|
66
|
+
export { respawnInScope } from "./child_process/respawn.js";
|
|
67
|
+
/* crypto/md5.ts */
|
|
68
|
+
// Identifiers
|
|
69
|
+
export { md5 } from "./crypto/md5.js";
|
|
70
|
+
/* crypto/sha256.ts */
|
|
71
|
+
// Identifiers
|
|
72
|
+
export { sha256 } from "./crypto/sha256.js";
|
|
73
|
+
/* environment/npmConfig.ts */
|
|
74
|
+
// Identifiers
|
|
75
|
+
export { getNpmConfigValue } from "./environment/npmConfig.js";
|
|
76
|
+
/* events/dumpEventEmitter.ts */
|
|
77
|
+
// Identifiers
|
|
78
|
+
export { dumpEventEmitterEmit } from "./events/dumpEventEmitter.js";
|
|
79
|
+
/* fs/commandExists.ts */
|
|
80
|
+
// Identifiers
|
|
81
|
+
export { commandInPath } from "./fs/commandExists.js";
|
|
82
|
+
export { commandInPathSync } from "./fs/commandExists.js";
|
|
83
|
+
/* fs/emptyDir.ts */
|
|
84
|
+
// Identifiers
|
|
85
|
+
export { emptyDir } from "./fs/emptyDir.js";
|
|
86
|
+
/* fs/ensureDir.ts */
|
|
87
|
+
// Identifiers
|
|
88
|
+
export { ensureDirExists } from "./fs/ensureDir.js";
|
|
89
|
+
export { ensureParentExists } from "./fs/ensureDir.js";
|
|
90
|
+
/* fs/tempFolder.ts */
|
|
91
|
+
// Identifiers
|
|
92
|
+
export { createTempFolder } from "./fs/tempFolder.js";
|
|
93
|
+
/* fs/weiteChanged.ts */
|
|
94
|
+
// Identifiers
|
|
95
|
+
export { writeFileIfChangeSync } from "./fs/weiteChanged.js";
|
|
96
|
+
export { writeFileIfChange } from "./fs/weiteChanged.js";
|
|
97
|
+
/* lifecycle/register.ts */
|
|
98
|
+
// Identifiers
|
|
99
|
+
export { shutdown } from "./lifecycle/register.js";
|
|
100
|
+
export { registerNodejsExitHandler } from "./lifecycle/register.js";
|
|
101
|
+
export { die } from "./lifecycle/register.js";
|
|
102
|
+
/* log/terminal.ts */
|
|
103
|
+
// Identifiers
|
|
104
|
+
export { WrappedTerminalConsole } from "./log/terminal.js";
|
|
105
|
+
/* path-resolve/findUp.ts */
|
|
106
|
+
// Identifiers
|
|
107
|
+
export type { IFindOptions } from "./path-resolve/findUp.js";
|
|
108
|
+
export { findUpUntil } from "./path-resolve/findUp.js";
|
|
109
|
+
export { findUpUntilSync } from "./path-resolve/findUp.js";
|
|
110
|
+
/* path-resolve/findPackageRoot.ts */
|
|
111
|
+
// Identifiers
|
|
112
|
+
export { findPackageRoot } from "./path-resolve/findPackageRoot.js";
|
|
113
|
+
/* path-resolve/getAllUp.ts */
|
|
114
|
+
// Identifiers
|
|
115
|
+
export { getAllPathUpToRoot } from "./path-resolve/getAllUp.js";
|
|
116
|
+
/* path-resolve/lrelative.ts */
|
|
117
|
+
// Identifiers
|
|
118
|
+
export { lrelative } from "./path-resolve/lrelative.js";
|
|
119
|
+
/* path-resolve/nodeResolvePathArray.ts */
|
|
120
|
+
// Identifiers
|
|
121
|
+
export { nodeResolvePathArray } from "./path-resolve/nodeResolvePathArray.js";
|
|
122
|
+
/* path-resolve/resolvePath.ts */
|
|
123
|
+
// Identifiers
|
|
124
|
+
export type { ResolvePathFunction } from "./path-resolve/resolvePath.js";
|
|
125
|
+
export type { JoinPathFunction } from "./path-resolve/resolvePath.js";
|
|
126
|
+
export { resolvePath } from "./path-resolve/resolvePath.js";
|
|
127
|
+
export type { NormalizePathFunction } from "./path-resolve/resolvePath.js";
|
|
128
|
+
export { normalizePath } from "./path-resolve/resolvePath.js";
|
|
129
|
+
export { osTempDir } from "./path-resolve/resolvePath.js";
|
|
130
|
+
export { relativePath } from "./path-resolve/resolvePath.js";
|
|
131
|
+
/* stream/blackHoleStream.ts */
|
|
132
|
+
// Identifiers
|
|
133
|
+
export { BlackHoleStream } from "./stream/blackHoleStream.js";
|
|
134
|
+
/* stream/streamPromise.ts */
|
|
135
|
+
// Identifiers
|
|
136
|
+
export { streamPromise } from "./stream/streamPromise.js";
|
|
137
|
+
export { streamHasEnd } from "./stream/streamPromise.js";
|
|
138
|
+
/* stream/collectingStream.ts */
|
|
139
|
+
// Identifiers
|
|
140
|
+
export { streamToBuffer } from "./stream/collectingStream.js";
|
|
141
|
+
export { RawCollectingStream } from "./stream/collectingStream.js";
|
|
142
|
+
export { CollectingStream } from "./stream/collectingStream.js";
|
|
143
|
+
/* stream/disposableStream.ts */
|
|
144
|
+
// Identifiers
|
|
145
|
+
export { disposableStream } from "./stream/disposableStream.js";
|
|
146
|
+
/* stream/drainStream.ts */
|
|
147
|
+
// Identifiers
|
|
148
|
+
export { drainStream } from "./stream/drainStream.js";
|
|
149
|
+
/* stream/loggerStream.ts */
|
|
150
|
+
// Identifiers
|
|
151
|
+
export type { LogFunction } from "./stream/loggerStream.js";
|
|
152
|
+
export { LoggerStream } from "./stream/loggerStream.js";
|
|
153
|
+
export { HexDumpLoggerStream } from "./stream/loggerStream.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@gongt/fix-esm';
|
|
2
1
|
import { isWindows, sepList } from '@idlebox/common';
|
|
3
2
|
import type { Options as AsyncOptions, Result as AsyncResult, SyncOptions, SyncResult } from 'execa';
|
|
4
3
|
import { execa, execaSync } from 'execa';
|
|
@@ -94,9 +93,15 @@ export async function spawnGetOutput({ exec, cwd, env, addonPath }: ICommand) {
|
|
|
94
93
|
return result.stdout as string;
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
type EveryOut = {
|
|
97
|
+
stdout: string;
|
|
98
|
+
stderr: string;
|
|
99
|
+
all: string;
|
|
100
|
+
};
|
|
101
|
+
export async function spawnGetEverything({ exec, cwd, env, addonPath }: ICommand): Promise<EveryOut> {
|
|
98
102
|
const [cmd, ...args] = exec;
|
|
99
|
-
|
|
103
|
+
|
|
104
|
+
const result = await execa(cmd, args, {
|
|
100
105
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
101
106
|
cwd,
|
|
102
107
|
reject: false,
|
|
@@ -104,9 +109,11 @@ export async function spawnGetEverything({ exec, cwd, env, addonPath }: ICommand
|
|
|
104
109
|
encoding: 'utf8',
|
|
105
110
|
all: true,
|
|
106
111
|
env: sanitizeEnv(env, addonPath),
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const result = await execa(cmd, args, opts);
|
|
112
|
+
});
|
|
110
113
|
handleError(result);
|
|
111
|
-
return
|
|
114
|
+
return {
|
|
115
|
+
all: result.all,
|
|
116
|
+
stdout: result.stdout,
|
|
117
|
+
stderr: result.stderr,
|
|
118
|
+
};
|
|
112
119
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
2
|
import { platform } from 'node:os';
|
|
4
3
|
import { findBinary } from '../environment/findBinary.js';
|
|
5
4
|
import { spawnGetOutputSync } from './execa.js';
|
|
@@ -29,7 +28,7 @@ function shutdown_quit(signal: string, code: number) {
|
|
|
29
28
|
* If can't do that (eg. on Windows), spawn as normal, but quit self after it quit.
|
|
30
29
|
*/
|
|
31
30
|
export function trySpawnInScope(cmds: string[]): never {
|
|
32
|
-
if (process.env.NEVER_UNSHARE || insideScope() || !supportScope()) {
|
|
31
|
+
if (process.env.NEVER_UNSHARE || !process.execve || insideScope() || !supportScope()) {
|
|
33
32
|
spawnSimulate(cmds[0], cmds.slice(1));
|
|
34
33
|
} else {
|
|
35
34
|
execLinux(cmds);
|
|
@@ -37,7 +36,7 @@ export function trySpawnInScope(cmds: string[]): never {
|
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
|
-
* Self restart in a pid
|
|
39
|
+
* Self restart in a pid+cgroup+mount namespace on linux.
|
|
41
40
|
* Your application must inside mainFunc, not before or after it.
|
|
42
41
|
*
|
|
43
42
|
* ```typescript
|
|
@@ -47,7 +46,7 @@ export function trySpawnInScope(cmds: string[]): never {
|
|
|
47
46
|
* });
|
|
48
47
|
* ```
|
|
49
48
|
*/
|
|
50
|
-
export function respawnInScope(mainFunc:
|
|
49
|
+
export function respawnInScope(mainFunc: CallableFunction): unknown | never {
|
|
51
50
|
if (process.env.NEVER_UNSHARE || insideScope() || !supportScope()) {
|
|
52
51
|
spawnRecreateEventHandlers();
|
|
53
52
|
mainFunc();
|
|
@@ -107,16 +106,12 @@ function execLinux(cmds: string[]): never {
|
|
|
107
106
|
|
|
108
107
|
try {
|
|
109
108
|
process.env.NEVER_UNSHARE = 'true';
|
|
110
|
-
const require = createRequire(
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
import.meta.url
|
|
113
|
-
);
|
|
114
|
-
const kexec = require('kexec');
|
|
115
109
|
|
|
116
110
|
process.removeAllListeners('SIGINT');
|
|
117
111
|
process.removeAllListeners('SIGTERM');
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
// biome-ignore lint/style/noNonNullAssertion: 上面判断过了
|
|
113
|
+
process.execve!(unshare, args);
|
|
114
|
+
console.error('[Linux] execve failed.');
|
|
120
115
|
} catch (err: any) {
|
|
121
116
|
if (
|
|
122
117
|
err.code === 'MODULE_NOT_FOUND' ||
|
|
@@ -125,7 +120,7 @@ function execLinux(cmds: string[]): never {
|
|
|
125
120
|
) {
|
|
126
121
|
spawnSimulate(unshare, args);
|
|
127
122
|
} else {
|
|
128
|
-
console.error('[Linux] <%s>
|
|
123
|
+
console.error('[Linux] <%s> execve failed:', err.code, err);
|
|
129
124
|
}
|
|
130
125
|
}
|
|
131
126
|
process.exit(1);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import type { PathArray } from '@idlebox/common';
|
|
1
2
|
import { resolve } from 'node:path';
|
|
2
3
|
import { existsSync } from '../fs/exists.js';
|
|
3
4
|
import { PathEnvironment } from './pathEnvironment.js';
|
|
4
5
|
|
|
5
|
-
export function findBinary(
|
|
6
|
-
what: string,
|
|
7
|
-
pathvar: import('@idlebox/common').PathArray = new PathEnvironment(),
|
|
8
|
-
cwd = process.cwd()
|
|
9
|
-
) {
|
|
6
|
+
export function findBinary(what: string, pathvar: PathArray = new PathEnvironment(), cwd = process.cwd()) {
|
|
10
7
|
for (const path of pathvar.values()) {
|
|
11
8
|
if (existsSync(`${path}/${what}`)) {
|
|
12
9
|
return resolve(cwd, path, what);
|
|
@@ -4,7 +4,7 @@ export interface IEnvironmentResult {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
export function getEnvironment(name: string, env = process.env): IEnvironmentResult {
|
|
7
|
-
if (
|
|
7
|
+
if (Object.hasOwn(env, name)) {
|
|
8
8
|
return {
|
|
9
9
|
value: env[name],
|
|
10
10
|
name: name,
|
|
@@ -35,7 +35,7 @@ export function deleteEnvironment(name: string, env = process.env) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export function cleanupEnvironment(name: string, env = process.env) {
|
|
38
|
-
if (
|
|
38
|
+
if (Object.hasOwn(env, name)) {
|
|
39
39
|
for (const item of Object.keys(env)) {
|
|
40
40
|
if (item.toLowerCase() === name && name !== item) {
|
|
41
41
|
delete env[item];
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PathArray } from '@idlebox/common';
|
|
1
|
+
import { isWindows, PathArray } from '@idlebox/common';
|
|
3
2
|
import { cleanupEnvironment, getEnvironment } from './getEnvironment.js';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* PATH_SEPARATOR is the separator used in the PATH environment variable.
|
|
6
|
+
* It is ';' on Windows and ':' on other platforms.
|
|
7
|
+
*/
|
|
8
|
+
export const PATH_SEPARATOR = isWindows ? ';' : ':';
|
|
6
9
|
export class PathEnvironment extends PathArray {
|
|
7
10
|
private readonly name: string;
|
|
8
11
|
private readonly env: NodeJS.ProcessEnv;
|
|
9
12
|
|
|
10
|
-
constructor(varName =
|
|
13
|
+
constructor(varName = isWindows ? 'Path' : 'PATH', env: NodeJS.ProcessEnv = process.env) {
|
|
11
14
|
const { name, value } = getEnvironment(varName, env);
|
|
12
15
|
super('', PATH_SEPARATOR);
|
|
13
16
|
|
package/src/error/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { NodeError } from '@idlebox/node-error-codes';
|
|
1
2
|
import { LinuxError } from './linux.js';
|
|
2
|
-
|
|
3
|
+
export * from '@idlebox/node-error-codes';
|
|
3
4
|
|
|
4
5
|
type NodeException<T extends string = any> = NodeJS.ErrnoException & { code: T };
|
|
5
6
|
|
|
@@ -15,7 +16,7 @@ export interface OpenSSLException extends Error {
|
|
|
15
16
|
* ERR_MODULE_NOT_FOUND: import() not found
|
|
16
17
|
*/
|
|
17
18
|
export function isModuleResolutionError(
|
|
18
|
-
ex: unknown
|
|
19
|
+
ex: unknown,
|
|
19
20
|
): ex is NodeException<NodeError.MODULE_NOT_FOUND | NodeError.ERR_MODULE_NOT_FOUND> {
|
|
20
21
|
return isNodeError(ex) && (ex.code === NodeError.MODULE_NOT_FOUND || ex.code === NodeError.ERR_MODULE_NOT_FOUND);
|
|
21
22
|
}
|
package/src/fs/commandExists.ts
CHANGED
|
@@ -20,7 +20,7 @@ function exts(alterExt?: string[]) {
|
|
|
20
20
|
|
|
21
21
|
export async function commandInPath(cmd: string, alterExt?: string[]): Promise<string | undefined> {
|
|
22
22
|
const pathVar = new PathEnvironment();
|
|
23
|
-
for (const item of pathVar.
|
|
23
|
+
for (const item of pathVar.joinpath(cmd)) {
|
|
24
24
|
for (const ext of exts(alterExt)) {
|
|
25
25
|
const found = await new Promise((resolve) => {
|
|
26
26
|
access(item + ext, constants.X_OK, (e) => {
|
|
@@ -35,7 +35,7 @@ export async function commandInPath(cmd: string, alterExt?: string[]): Promise<s
|
|
|
35
35
|
}
|
|
36
36
|
export function commandInPathSync(cmd: string, alterExt?: string[]): string | undefined {
|
|
37
37
|
const pathVar = new PathEnvironment();
|
|
38
|
-
for (const item of pathVar.
|
|
38
|
+
for (const item of pathVar.joinpath(cmd)) {
|
|
39
39
|
for (const ext of exts(alterExt)) {
|
|
40
40
|
try {
|
|
41
41
|
accessSync(item + ext, constants.X_OK);
|
package/src/fs/emptyDir.ts
CHANGED
|
@@ -5,14 +5,17 @@ import { resolve } from 'node:path';
|
|
|
5
5
|
* delete all content in a dir,
|
|
6
6
|
* and create it if not exists
|
|
7
7
|
* @public
|
|
8
|
+
*
|
|
9
|
+
* @param path - the path to the directory
|
|
10
|
+
* @param create_not_exists - create the directory if it does not exist, defaults to true
|
|
8
11
|
*/
|
|
9
|
-
export async function emptyDir(path: string,
|
|
10
|
-
let files;
|
|
12
|
+
export async function emptyDir(path: string, create_not_exists = true) {
|
|
13
|
+
let files: string[];
|
|
11
14
|
try {
|
|
12
15
|
files = await readdir(path);
|
|
13
16
|
} catch (e: any) {
|
|
14
17
|
if (e.code === 'ENOENT') {
|
|
15
|
-
if (
|
|
18
|
+
if (create_not_exists) await mkdir(path, { recursive: true });
|
|
16
19
|
return;
|
|
17
20
|
}
|
|
18
21
|
throw e;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { mkdir } from 'node:fs/promises';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
|
|
4
|
+
export async function ensureDirExists(dir: string) {
|
|
5
|
+
try {
|
|
6
|
+
await mkdir(dir, { recursive: true });
|
|
7
|
+
} catch (error) {
|
|
8
|
+
console.error(`Error creating directory ${dir}:`, error);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function ensureParentExists(file: string) {
|
|
13
|
+
const dir = dirname(file);
|
|
14
|
+
try {
|
|
15
|
+
await mkdir(dir, { recursive: true });
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error(`Error creating directory ${dir}:`, error);
|
|
18
|
+
}
|
|
19
|
+
}
|