@swiftuijs/twill-shell 0.2.0 → 0.3.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/README.md +51 -16
- package/dist/cwd.d.ts.map +1 -1
- package/dist/cwd.js +7 -9
- package/dist/cwd.js.map +1 -1
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +29 -29
- package/dist/environment.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +64 -60
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +222 -166
- package/dist/index.js.map +1 -1
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +153 -177
- package/dist/values.js.map +1 -1
- package/package.json +9 -10
package/README.md
CHANGED
|
@@ -1,38 +1,73 @@
|
|
|
1
1
|
# <img src="https://twill.evecalm.com/logo.png" alt="Twill hummingbird" align="right" width="40" height="40" /> Twill shell
|
|
2
2
|
|
|
3
|
-
Swift-inspired subprocess tools for Twill and ordinary Node JS/TS scripts,
|
|
3
|
+
Swift-inspired subprocess tools for Twill and ordinary Node JS/TS scripts, Node-based in 0.3.0.
|
|
4
|
+
|
|
5
|
+
## Install in your project
|
|
6
|
+
|
|
7
|
+
Use Node 24 LTS for a new setup (supported range: `^20.19.0 || >=22.12.0`). Run from the directory containing your `package.json`; for a new project, run `npm init -y` first. Install the SDK as a production dependency:
|
|
4
8
|
|
|
5
9
|
```sh
|
|
6
|
-
npm install @swiftuijs/twill-shell
|
|
7
|
-
# For .twill source scripts:
|
|
8
|
-
npm install --save-dev @swiftuijs/twill
|
|
10
|
+
npm install @swiftuijs/twill-shell@0.3.0
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
With pnpm, use `pnpm add @swiftuijs/twill-shell@0.3.0`. This package supplies the process API; `@swiftuijs/twill` supplies the optional Twill source runner. A global compiler does not make this SDK available to project imports. Keep Twill packages on the same version.
|
|
14
|
+
|
|
15
|
+
## Run ordinary JavaScript
|
|
16
|
+
|
|
17
|
+
The SDK uses Node spawn/streams with literal argv (`shell: false`), bounded capture and owned cancellation/timeout teardown. It has zero production dependencies; native JS/TS needs no Twill compiler or Rust toolchain.
|
|
18
|
+
|
|
19
|
+
Changed in 0.3.0: the SDK no longer depends on `@swiftuijs/twill-shell-native`. Older npm 0.2.0 still requires the retired Rust addon; its versions remain downloadable for compatibility. The public command/policy/error API remains; abrupt worker/process-exit cleanup and unnamed Unix signal reporting change to Node's boundaries. See the [scripting guide](https://twill.evecalm.com/scripting#execution-and-version-boundary).
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
Save this as `command.mjs`:
|
|
14
22
|
|
|
15
|
-
```
|
|
16
|
-
#!/usr/bin/env twill
|
|
23
|
+
```js
|
|
17
24
|
import { Command, Output, Subprocess } from '@swiftuijs/twill-shell';
|
|
18
25
|
|
|
19
|
-
const result = await Subprocess.run(
|
|
20
|
-
|
|
21
|
-
timeoutMs: 5000,
|
|
22
|
-
|
|
23
|
-
console.log(result.standardOutput);
|
|
26
|
+
const result = await Subprocess.run(
|
|
27
|
+
Command.path(process.execPath, ['-e', 'console.log("Hello from a child process")']),
|
|
28
|
+
{ output: Output.text({ limit: 64 * 1024 }), timeoutMs: 5000 },
|
|
29
|
+
);
|
|
30
|
+
console.log(result.standardOutput.trim());
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Run `node command.mjs`. Expected output is `Hello from a child process`. This works without Git, a Twill compiler or a global installation. Native TypeScript uses your existing TS runner/build.
|
|
34
|
+
|
|
35
|
+
## Run Twill source
|
|
36
|
+
|
|
37
|
+
Install the compiler as well:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm install --save-dev @swiftuijs/twill@0.3.0
|
|
41
|
+
# pnpm add -D @swiftuijs/twill@0.3.0
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Copy the JavaScript example to `command.twill` and add `#!/usr/bin/env twill` as its first line. Use the local command:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
npm exec -- twill command.twill
|
|
48
|
+
# pnpm exec twill command.twill
|
|
24
49
|
```
|
|
25
50
|
|
|
26
|
-
|
|
51
|
+
On Linux/macOS, `chmod +x command.twill` enables `npm exec --call './command.twill'` or `pnpm exec ./command.twill`. To run `./command.twill` directly, install the compiler globally with `npm install --global @swiftuijs/twill@0.3.0` and keep its executable directory on PATH. Windows uses the explicit CLI. Arguments after the script path pass through unchanged. Application dependencies resolve from the script's location. Use compiler and SDK 0.3.0 or newer.
|
|
52
|
+
|
|
53
|
+
For package scripts, Node type declarations, error handling and troubleshooting, follow the [complete shell scripting guide](https://twill.evecalm.com/scripting). [Getting started](https://twill.evecalm.com/getting-started) covers application modules and build integration.
|
|
54
|
+
|
|
55
|
+
## Process contracts
|
|
27
56
|
|
|
28
57
|
Use `Command.path(absolutePath, args)` for a trusted executable; `Command.name(name, args)` uses native PATH search. Arguments are immutable snapshots and remain literal strings, including spaces, quotes, newlines and shell metacharacters. Tool-specific options still matter: use `--` before user-supplied filenames when the executable supports it.
|
|
29
58
|
|
|
30
59
|
Stdin defaults to EOF; stdout/stderr inherit without capture. `Input.inherit()` inherits stdin; a string or `Uint8Array` writes input with native backpressure. Byte input is copied at submission; cwd and environment are snapshotted then. `Output.text({limit})` and `Output.bytes({limit})` require positive byte limits; `Output.discard()` retains nothing. Output-limit failure rejects after teardown, never returns silent truncation. Capture limits bound retained stream bytes, not total process memory or the final UTF-8 string/buffer allocation.
|
|
31
60
|
|
|
32
|
-
|
|
61
|
+
From 0.3.0, statuses follow Node reports, including its unnamed-signal limitations. Released 0.2.0 preserves numeric unnamed Unix signals. A successful result contains `processIdentifier`, `terminationStatus`, `standardOutput` and `standardError`. Nonzero/signal exits reject with `ProcessExitError`; `check: false` returns that status. Launch/I/O failures, abort, timeout and output overflow always reject. Use ordinary `try/catch` and exported error classes. Errors can carry bounded output and native causes; the SDK never logs them automatically.
|
|
33
62
|
|
|
34
63
|
`cwd` and `Environment.inherit(updates)` / `.replace(values)` apply only to the child. Pass an `AbortSignal` or `timeoutMs` for cancellation. The default grace period is 250 ms before forced termination, followed by at most 1000 ms joining time. Settlement normally waits for child close and owned I/O. Failed teardown reports `unresolvedProcessIdentifier` and `cleanupErrors`, preserving the first failure. Ownership covers the direct child; descendants and arbitrary process trees are outside this contract. Windows uses its native process handle for termination, without POSIX graceful-signal guarantees.
|
|
35
64
|
|
|
36
65
|
This first stage does not implement scoped streaming, pipelines, shell templates or shell-text execution. Node ESM is required (`^20.19.0 || >=22.12.0`). Twill source execution uses its existing loader; exported/native JS only needs this SDK. See the [scripting guide](https://twill.evecalm.com/scripting), [RFC 0034](https://github.com/swiftuijs/twill/blob/main/docs/rfcs/0034-shell-scripting-toolkit.md) and [official AI skill](https://twill.evecalm.com/ai). Twill's sibling UI project is [SwiftUI.js](https://swiftuijs.evecalm.com/).
|
|
37
66
|
|
|
38
|
-
|
|
67
|
+
Cancel and await outstanding work before a worker shuts down. Set `process.exitCode` after awaited work; forced `Worker.terminate()` and `process.exit()` cannot perform an asynchronous join. Version 0.3.0 removes the old native cleanup barrier. OS creation and event-loop scheduling are not hard real-time deadlines.
|
|
68
|
+
|
|
69
|
+
Bounded capture and lifecycle checks add overhead. The reviewed Linux/Node 24 report measured about 17% median overhead for native dual 1 MiB capture and 11% for full duplex, accepted for 0.3.0. See the [recorded costs](https://twill.evecalm.com/performance#node-shell-sdk); this is not a universal native-parity guarantee.
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
This package's implementation uses Twill and emits ordinary JavaScript. Build and check a checkout with the workspace tools; see [developing tooling in Twill](https://github.com/swiftuijs/twill/blob/main/docs/contributing/dogfooding.md) for bootstrap and contribution instructions.
|
package/dist/cwd.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cwd.d.ts","
|
|
1
|
+
{"version":3,"file":"cwd.d.ts","mappings":"AACA,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,QAAQ,kBAAmB,EAC3B,MAAM,SAAgB,GACrB,MAAM","names":[],"ignoreList":[],"sources":["../src/cwd.twill"]}
|
package/dist/cwd.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { isAbsolute, win32 } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
: platform === 'win32'
|
|
6
|
-
? win32.resolve(parent, cwd)
|
|
7
|
-
: isAbsolute(cwd)
|
|
8
|
-
? cwd
|
|
9
|
-
: `${parent}/${cwd}`;
|
|
1
|
+
import { isAbsolute, win32 } from "node:path";
|
|
2
|
+
//#region src/cwd.twill
|
|
3
|
+
function cwdSnapshot(cwd, platform = process.platform, parent = process.cwd()) {
|
|
4
|
+
return cwd === void 0 ? parent : platform === "win32" ? win32.resolve(parent, cwd) : isAbsolute(cwd) ? cwd : `${parent}/${cwd}`;
|
|
10
5
|
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { cwdSnapshot };
|
|
8
|
+
|
|
11
9
|
//# sourceMappingURL=cwd.js.map
|
package/dist/cwd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cwd.js","
|
|
1
|
+
{"version":3,"file":"cwd.js","names":[],"sources":["../src/cwd.twill"],"mappings":";;AACA,SAAgB,YACd,KACA,WAAW,QAAQ,UACnB,SAAS,QAAQ,IAAG,GAAE;CAEtB,OAAO,QAAQ,KAAA,IACX,SACA,aAAa,UACX,MAAM,QAAQ,QAAQ,GAAG,IACzB,WAAW,GAAG,IACZ,MACA,GAAG,OAAM,GAAI;AACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","
|
|
1
|
+
{"version":3,"file":"environment.d.ts","mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAgB;AAiBjD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,kBAAmB,EAC3B,MAAM,oBAAc","names":[],"ignoreList":[],"sources":["../src/environment.twill"]}
|
package/dist/environment.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { childEnvironment } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'WINDIR',
|
|
1
|
+
import { childEnvironment } from "./values.js";
|
|
2
|
+
//#region src/environment.twill
|
|
3
|
+
var windowsRequired = [
|
|
4
|
+
"HOMEDRIVE",
|
|
5
|
+
"HOMEPATH",
|
|
6
|
+
"LOGONSERVER",
|
|
7
|
+
"PATH",
|
|
8
|
+
"SYSTEMDRIVE",
|
|
9
|
+
"SYSTEMROOT",
|
|
10
|
+
"TEMP",
|
|
11
|
+
"USERDOMAIN",
|
|
12
|
+
"USERNAME",
|
|
13
|
+
"USERPROFILE",
|
|
14
|
+
"WINDIR"
|
|
16
15
|
];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
return environment;
|
|
16
|
+
function environmentSnapshot(policy, platform = process.platform, parent = process.env) {
|
|
17
|
+
const environment = { ...childEnvironment(policy, platform) ?? parent };
|
|
18
|
+
if (parent.NODE_V8_COVERAGE && !Object.hasOwn(environment, "NODE_V8_COVERAGE")) environment.NODE_V8_COVERAGE = parent.NODE_V8_COVERAGE;
|
|
19
|
+
if (platform === "win32") {
|
|
20
|
+
const selected = new Set(Object.keys(environment).map((key) => key.toUpperCase()));
|
|
21
|
+
const inherited = new Map(Object.entries(parent).map(([key, value]) => [key.toUpperCase(), value]));
|
|
22
|
+
for (const key of windowsRequired) {
|
|
23
|
+
const value = inherited.get(key);
|
|
24
|
+
if (!selected.has(key) && value !== void 0) environment[key] = value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return environment;
|
|
31
28
|
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { environmentSnapshot };
|
|
31
|
+
|
|
32
32
|
//# sourceMappingURL=environment.js.map
|
package/dist/environment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","
|
|
1
|
+
{"version":3,"file":"environment.js","names":[],"sources":["../src/environment.twill"],"mappings":";;AAKA,IAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AACD,SAAgB,oBACd,QACA,WAAW,QAAQ,UACnB,SAAS,QAAQ,KAAG;CAEpB,MAAM,cAAc,EAAE,GAAI,iBAAiB,QAAQ,QAAQ,KAAK,OAAO;CACvE,IAAI,OAAO,oBAAoB,CAAC,OAAO,OAAO,aAAa,kBAAkB,GAC3E,YAAY,mBAAmB,OAAO;CACxC,IAAI,aAAa,SAAS;EACxB,MAAM,WAAW,IAAI,IAAI,OAAO,KAAK,WAAW,CAAC,CAAC,KAAK,QAAQ,IAAI,YAAW,CAAE,CAAC;EACjF,MAAM,YAAY,IAAI,IACpB,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,IAAI,YAAW,GAAI,KAAK,CAAC,CAAC;EAE1E,KAAK,MAAM,OAAO,iBAAiB;GACjC,MAAM,QAAQ,UAAU,IAAI,GAAG;GAC/B,IAAI,CAAC,SAAS,IAAI,GAAG,KAAK,UAAU,KAAA,GAAW,YAAY,OAAO;EACpE;CACF;CACA,OAAO;AACT"}
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","
|
|
1
|
+
{"version":3,"file":"errors.d.ts","mappings":"AAAA,OAAO,KAAK,EAA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oBAAqB,SAAQ,YAAY;gBACxC,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;;AAKxD,qBAAa,gBAAiB,SAAQ,YAAY;IACpC,QAAQ,CAAC,MAAM,EAAE,eAAe;gBAAvB,MAAM,EAAE,eAAe","names":[],"ignoreList":[],"sources":["../src/errors.twill"]}
|
package/dist/errors.js
CHANGED
|
@@ -1,61 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
1
|
+
//#region src/errors.twill
|
|
2
|
+
var ProcessError = class extends Error {
|
|
3
|
+
processIdentifier;
|
|
4
|
+
terminationStatus;
|
|
5
|
+
standardOutput;
|
|
6
|
+
standardError;
|
|
7
|
+
unresolvedProcessIdentifier;
|
|
8
|
+
cleanupErrors = [];
|
|
9
|
+
constructor(message, processIdentifier, options) {
|
|
10
|
+
super(message, options);
|
|
11
|
+
this.name = new.target.name;
|
|
12
|
+
this.processIdentifier = processIdentifier;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var ProcessLaunchError = class extends ProcessError {
|
|
16
|
+
constructor(cause) {
|
|
17
|
+
super("Subprocess could not start", void 0, { cause });
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var ProcessIOError = class extends ProcessError {
|
|
21
|
+
stream;
|
|
22
|
+
constructor(stream, processIdentifier, cause) {
|
|
23
|
+
super(`Subprocess ${stream} failed`, processIdentifier, { cause });
|
|
24
|
+
this.stream = stream;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var ProcessAbortError = class extends ProcessError {
|
|
28
|
+
constructor(processIdentifier, reason) {
|
|
29
|
+
super("Subprocess aborted", processIdentifier, { cause: reason });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var ProcessTimeoutError = class extends ProcessError {
|
|
33
|
+
timeoutMs;
|
|
34
|
+
constructor(timeoutMs, processIdentifier) {
|
|
35
|
+
super("Subprocess timed out", processIdentifier);
|
|
36
|
+
this.timeoutMs = timeoutMs;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var OutputLimitError = class extends ProcessError {
|
|
40
|
+
stream;
|
|
41
|
+
limit;
|
|
42
|
+
constructor(stream, limit, processIdentifier) {
|
|
43
|
+
super(`Subprocess ${stream} exceeded its byte limit`, processIdentifier);
|
|
44
|
+
this.stream = stream;
|
|
45
|
+
this.limit = limit;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var ProcessTeardownError = class extends ProcessError {
|
|
49
|
+
constructor(processIdentifier, cause) {
|
|
50
|
+
super("Owned subprocess could not be terminated", processIdentifier, { cause });
|
|
51
|
+
Object.assign(this, { unresolvedProcessIdentifier: processIdentifier });
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var ProcessExitError = class extends ProcessError {
|
|
55
|
+
result;
|
|
56
|
+
constructor(result) {
|
|
57
|
+
super("Subprocess exited unsuccessfully", result.processIdentifier);
|
|
58
|
+
this.result = result;
|
|
59
|
+
Object.assign(this, result);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { OutputLimitError, ProcessAbortError, ProcessError, ProcessExitError, ProcessIOError, ProcessLaunchError, ProcessTeardownError, ProcessTimeoutError };
|
|
64
|
+
|
|
61
65
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../src/errors.twill"],"mappings":";AAEA,IAAa,eAAb,cAAkC,MAAK;CAC5B;CACA;CACA;CACA;CACA;CACA,gBAAkC,CAAA;CAC3C,YAAY,SAAiB,mBAA4B,SAAsB;EAC7E,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO,WAAW;EACvB,KAAK,oBAAoB;CAC3B;AACF;AACA,IAAa,qBAAb,cAAwC,aAAY;CAClD,YAAY,OAAc;EACxB,MAAM,8BAA8B,KAAA,GAAW,EAAE,MAAK,CAAE;CAC1D;AACF;AACA,IAAa,iBAAb,cAAoC,aAAY;CAEnC;CADX,YACW,QACT,mBACA,OAAc;EAEd,MAAM,cAAc,OAAM,UAAW,mBAAmB,EAAE,MAAK,CAAE;EAJxD,KAAA,SAAA;CAKX;AACF;AACA,IAAa,oBAAb,cAAuC,aAAY;CACjD,YAAY,mBAAuC,QAAe;EAChE,MAAM,sBAAsB,mBAAmB,EAAE,OAAO,OAAM,CAAE;CAClE;AACF;AACA,IAAa,sBAAb,cAAyC,aAAY;CAExC;CADX,YACW,WACT,mBAAqC;EAErC,MAAM,wBAAwB,iBAAiB;EAHtC,KAAA,YAAA;CAIX;AACF;AACA,IAAa,mBAAb,cAAsC,aAAY;CAErC;CACA;CAFX,YACW,QACA,OACT,mBAAqC;EAErC,MAAM,cAAc,OAAM,2BAA4B,iBAAiB;EAJ9D,KAAA,SAAA;EACA,KAAA,QAAA;CAIX;AACF;AACA,IAAa,uBAAb,cAA0C,aAAY;CACpD,YAAY,mBAA2B,OAAe;EACpD,MAAM,4CAA4C,mBAAmB,EAAE,MAAK,CAAE;EAC9E,OAAO,OAAO,MAAM,EAAE,6BAA6B,kBAAiB,CAAE;CACxE;AACF;AACA,IAAa,mBAAb,cAAsC,aAAY;CAC3B;CAArB,YAAqB,QAAuB;EAC1C,MAAM,oCAAoC,OAAO,iBAAiB;EAD/C,KAAA,SAAA;EAEnB,OAAO,OAAO,MAAM,MAAM;CAC5B;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command, type OutputPolicy, type OutputValue, type RunOptions, type InheritedOutput } from './values.js';
|
|
2
2
|
export { Command, Environment, Input, Output } from './values.js';
|
|
3
3
|
export type { OutputPolicy, OutputValue, RunOptions, ProcessInput, InputPolicy, InheritedOutput, DiscardedOutput, TextOutput, ByteOutput, } from './values.js';
|
|
4
4
|
export { ProcessError, ProcessLaunchError, ProcessAbortError, ProcessTimeoutError, ProcessExitError, ProcessIOError, OutputLimitError, ProcessTeardownError, } from './errors.js';
|
|
@@ -17,7 +17,7 @@ export interface ExecutionResult<O extends OutputPolicy = OutputPolicy, E extend
|
|
|
17
17
|
}
|
|
18
18
|
type ExactOptions<O> = O & Record<Exclude<keyof O, keyof RunOptions>, never>;
|
|
19
19
|
type SelectedOutput<P> = Extract<P, OutputPolicy> | (undefined extends P ? InheritedOutput : never);
|
|
20
|
-
declare function run<Options extends RunOptions = RunOptions<InheritedOutput, InheritedOutput>>(
|
|
20
|
+
declare function run<Options extends RunOptions = RunOptions<InheritedOutput, InheritedOutput>>(cmd: Command, options?: ExactOptions<Options>): Promise<ExecutionResult<SelectedOutput<Options['output']>, SelectedOutput<Options['error']>>>;
|
|
21
21
|
export declare const Subprocess: Readonly<{
|
|
22
22
|
run: typeof run;
|
|
23
23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