@swiftuijs/twill-shell 0.2.0 → 0.3.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/values.js CHANGED
@@ -1,200 +1,176 @@
1
- import { isAbsolute } from 'node:path';
2
- import { constants } from 'node:buffer';
3
- const commandBrand = Symbol.for('@swiftuijs/twill-shell/command/v1');
4
- const environmentBrand = Symbol.for('@swiftuijs/twill-shell/environment/v1');
5
- const outputBrand = Symbol.for('@swiftuijs/twill-shell/output/v1');
6
- const inputBrand = Symbol.for('@swiftuijs/twill-shell/input/v1');
1
+ import { isAbsolute } from "node:path";
2
+ import { constants } from "node:buffer";
3
+ //#region src/values.twill
4
+ var commandBrand = Symbol.for("@swiftuijs/twill-shell/command/v1");
5
+ var environmentBrand = Symbol.for("@swiftuijs/twill-shell/environment/v1");
6
+ var outputBrand = Symbol.for("@swiftuijs/twill-shell/output/v1");
7
+ var inputBrand = Symbol.for("@swiftuijs/twill-shell/input/v1");
7
8
  function string(value, label, empty = false) {
8
- if (typeof value !== 'string' || (!empty && value.length === 0) || value.includes('\0'))
9
- throw new TypeError(`${label} must be a ${empty ? '' : 'nonempty '}string without NUL`);
9
+ if (typeof value !== "string" || !empty && value.length === 0 || value.includes("\0")) throw new TypeError(`${label} must be a ${empty ? "" : "nonempty "}string without NUL`);
10
10
  }
11
11
  function command(executable, args) {
12
- if (!Array.isArray(args))
13
- throw new TypeError('arguments must be an array of strings');
14
- const snapshot = Array.from(args);
15
- for (const arg of snapshot)
16
- string(arg, 'argument', true);
17
- return Object.freeze({
18
- [commandBrand]: true,
19
- executable,
20
- arguments: Object.freeze(snapshot),
21
- });
12
+ if (!Array.isArray(args)) throw new TypeError("arguments must be an array of strings");
13
+ const snapshot = Array.from(args);
14
+ for (const arg of snapshot) string(arg, "argument", true);
15
+ return Object.freeze({
16
+ [commandBrand]: true,
17
+ executable,
18
+ arguments: Object.freeze(snapshot)
19
+ });
22
20
  }
23
- export const Command = Object.freeze({
24
- name(executable, args = []) {
25
- string(executable, 'executable');
26
- if (/[\\/:]/.test(executable))
27
- throw new TypeError('Command.name requires a name without path separators');
28
- return command(executable, args);
29
- },
30
- path(executable, args = []) {
31
- string(executable, 'executable');
32
- if (!isAbsolute(executable))
33
- throw new TypeError('Command.path requires an absolute path');
34
- return command(executable, args);
35
- },
21
+ var Command = Object.freeze({
22
+ name(executable, args = []) {
23
+ string(executable, "executable");
24
+ if (/[\\/:]/.test(executable)) throw new TypeError("Command.name requires a name without path separators");
25
+ return command(executable, args);
26
+ },
27
+ path(executable, args = []) {
28
+ string(executable, "executable");
29
+ if (!isAbsolute(executable)) throw new TypeError("Command.path requires an absolute path");
30
+ return command(executable, args);
31
+ }
36
32
  });
37
33
  function environment(kind, values) {
38
- if (!values || typeof values !== 'object' || Array.isArray(values))
39
- throw new TypeError('environment values must be an object');
40
- const snapshot = Object.create(null);
41
- for (const [key, value] of Object.entries(values)) {
42
- string(key, 'environment key');
43
- if (key.includes('='))
44
- throw new TypeError('environment key cannot contain =');
45
- if (value !== undefined)
46
- string(value, 'environment value', true);
47
- snapshot[key] = value;
48
- }
49
- return Object.freeze({
50
- [environmentBrand]: true,
51
- kind,
52
- values: Object.freeze(snapshot),
53
- });
34
+ if (!values || typeof values !== "object" || Array.isArray(values)) throw new TypeError("environment values must be an object");
35
+ const snapshot = Object.create(null);
36
+ for (const [key, value] of Object.entries(values)) {
37
+ string(key, "environment key");
38
+ if (key.includes("=")) throw new TypeError("environment key cannot contain =");
39
+ if (value !== void 0) string(value, "environment value", true);
40
+ snapshot[key] = value;
41
+ }
42
+ return Object.freeze({
43
+ [environmentBrand]: true,
44
+ kind,
45
+ values: Object.freeze(snapshot)
46
+ });
54
47
  }
55
- export const Environment = Object.freeze({
56
- inherit(updates = {}) {
57
- return environment('inherit', updates);
58
- },
59
- replace(values) {
60
- return environment('replace', values);
61
- },
48
+ var Environment = Object.freeze({
49
+ inherit(updates = {}) {
50
+ return environment("inherit", updates);
51
+ },
52
+ replace(values) {
53
+ return environment("replace", values);
54
+ }
62
55
  });
63
- const inheritedOutput = Object.freeze({
64
- [outputBrand]: true,
65
- kind: 'inherit',
56
+ var inheritedOutput = Object.freeze({
57
+ [outputBrand]: true,
58
+ kind: "inherit"
66
59
  });
67
- const discardedOutput = Object.freeze({
68
- [outputBrand]: true,
69
- kind: 'discard',
60
+ var discardedOutput = Object.freeze({
61
+ [outputBrand]: true,
62
+ kind: "discard"
70
63
  });
71
64
  function captureLimit(limit) {
72
- if (!Number.isSafeInteger(limit) || limit <= 0 || limit > constants.MAX_LENGTH)
73
- throw new TypeError('output limit must be a positive safe byte count within Buffer.MAX_LENGTH');
65
+ if (!Number.isSafeInteger(limit) || limit <= 0 || limit > constants.MAX_LENGTH) throw new TypeError("output limit must be a positive safe byte count within Buffer.MAX_LENGTH");
74
66
  }
75
67
  function capture(kind, options) {
76
- const limit = options?.limit;
77
- captureLimit(limit);
78
- return Object.freeze({ [outputBrand]: true, kind, limit });
68
+ const limit = options?.limit;
69
+ captureLimit(limit);
70
+ return Object.freeze({
71
+ [outputBrand]: true,
72
+ kind,
73
+ limit
74
+ });
79
75
  }
80
- export const Output = Object.freeze({
81
- inherit() {
82
- return inheritedOutput;
83
- },
84
- discard() {
85
- return discardedOutput;
86
- },
87
- text(options) {
88
- return capture('text', options);
89
- },
90
- bytes(options) {
91
- return capture('bytes', options);
92
- },
76
+ var Output = Object.freeze({
77
+ inherit() {
78
+ return inheritedOutput;
79
+ },
80
+ discard() {
81
+ return discardedOutput;
82
+ },
83
+ text(options) {
84
+ return capture("text", options);
85
+ },
86
+ bytes(options) {
87
+ return capture("bytes", options);
88
+ }
93
89
  });
94
- const noInput = Object.freeze({ [inputBrand]: true, kind: 'none' });
95
- const inheritedInput = Object.freeze({ [inputBrand]: true, kind: 'inherit' });
96
- export const Input = Object.freeze({
97
- none() {
98
- return noInput;
99
- },
100
- inherit() {
101
- return inheritedInput;
102
- },
90
+ var noInput = Object.freeze({
91
+ [inputBrand]: true,
92
+ kind: "none"
103
93
  });
104
- const optionKeys = new Set([
105
- 'cwd',
106
- 'environment',
107
- 'input',
108
- 'output',
109
- 'error',
110
- 'check',
111
- 'signal',
112
- 'timeoutMs',
113
- 'gracePeriodMs',
114
- 'killTimeoutMs',
94
+ var inheritedInput = Object.freeze({
95
+ [inputBrand]: true,
96
+ kind: "inherit"
97
+ });
98
+ var Input = Object.freeze({
99
+ none() {
100
+ return noInput;
101
+ },
102
+ inherit() {
103
+ return inheritedInput;
104
+ }
105
+ });
106
+ var optionKeys = /* @__PURE__ */ new Set([
107
+ "cwd",
108
+ "environment",
109
+ "input",
110
+ "output",
111
+ "error",
112
+ "check",
113
+ "signal",
114
+ "timeoutMs",
115
+ "gracePeriodMs",
116
+ "killTimeoutMs"
115
117
  ]);
116
118
  function duration(value, label, minimum) {
117
- if (!Number.isInteger(value) || value < minimum || value > 2147483647)
118
- throw new TypeError(`${label} must be an integer between ${minimum} and 2147483647`);
119
+ if (!Number.isInteger(value) || value < minimum || value > 2147483647) throw new TypeError(`${label} must be an integer between ${minimum} and 2147483647`);
119
120
  }
120
- export function settings(cmd, options) {
121
- if (!cmd || cmd[commandBrand] !== true)
122
- throw new TypeError('Use Command.name or Command.path');
123
- if (!options || typeof options !== 'object' || Array.isArray(options))
124
- throw new TypeError('run options must be an object');
125
- for (const key of Object.keys(options))
126
- if (!optionKeys.has(key))
127
- throw new TypeError(`Unknown run option: ${key}`);
128
- const { cwd, environment: env, input = noInput, output = inheritedOutput, error = inheritedOutput, check = true, signal, timeoutMs, gracePeriodMs = 250, killTimeoutMs = 1000, } = options;
129
- if (cwd !== undefined)
130
- string(cwd, 'cwd');
131
- if (env !== undefined && (!env || env[environmentBrand] !== true))
132
- throw new TypeError('Use Environment.inherit or Environment.replace');
133
- if (!output || output[outputBrand] !== true || !error || error[outputBrand] !== true)
134
- throw new TypeError('Use Output policies');
135
- for (const policy of [output, error]) {
136
- if (policy.kind === 'text' || policy.kind === 'bytes')
137
- captureLimit(policy.limit);
138
- else if (policy.kind !== 'inherit' && policy.kind !== 'discard')
139
- throw new TypeError('Unknown output policy');
140
- }
141
- if (typeof input !== 'string' &&
142
- !(input instanceof Uint8Array) &&
143
- (!input || input[inputBrand] !== true))
144
- throw new TypeError('input must be a string, Uint8Array or Input policy');
145
- if (typeof check !== 'boolean')
146
- throw new TypeError('check must be a boolean');
147
- if (signal !== undefined && !(signal instanceof AbortSignal))
148
- throw new TypeError('signal must be an AbortSignal');
149
- if (timeoutMs !== undefined)
150
- duration(timeoutMs, 'timeoutMs', 1);
151
- duration(gracePeriodMs, 'gracePeriodMs', 0);
152
- duration(killTimeoutMs, 'killTimeoutMs', 1);
153
- return {
154
- cwd,
155
- environment: env,
156
- input,
157
- output,
158
- error,
159
- check,
160
- signal,
161
- timeoutMs,
162
- gracePeriodMs,
163
- killTimeoutMs,
164
- };
121
+ function settings(cmd, options) {
122
+ if (!cmd || cmd[commandBrand] !== true) throw new TypeError("Use Command.name or Command.path");
123
+ if (!options || typeof options !== "object" || Array.isArray(options)) throw new TypeError("run options must be an object");
124
+ for (const key of Object.keys(options)) if (!optionKeys.has(key)) throw new TypeError(`Unknown run option: ${key}`);
125
+ const { cwd, environment: env, input = noInput, output = inheritedOutput, error = inheritedOutput, check = true, signal, timeoutMs, gracePeriodMs = 250, killTimeoutMs = 1e3 } = options;
126
+ if (cwd !== void 0) string(cwd, "cwd");
127
+ if (env !== void 0 && (!env || env[environmentBrand] !== true)) throw new TypeError("Use Environment.inherit or Environment.replace");
128
+ if (!output || output[outputBrand] !== true || !error || error[outputBrand] !== true) throw new TypeError("Use Output policies");
129
+ for (const policy of [output, error]) if (policy.kind === "text" || policy.kind === "bytes") captureLimit(policy.limit);
130
+ else if (policy.kind !== "inherit" && policy.kind !== "discard") throw new TypeError("Unknown output policy");
131
+ if (typeof input !== "string" && !(input instanceof Uint8Array) && (!input || input[inputBrand] !== true)) throw new TypeError("input must be a string, Uint8Array or Input policy");
132
+ if (typeof check !== "boolean") throw new TypeError("check must be a boolean");
133
+ if (signal !== void 0 && !(signal instanceof AbortSignal)) throw new TypeError("signal must be an AbortSignal");
134
+ if (timeoutMs !== void 0) duration(timeoutMs, "timeoutMs", 1);
135
+ duration(gracePeriodMs, "gracePeriodMs", 0);
136
+ duration(killTimeoutMs, "killTimeoutMs", 1);
137
+ return {
138
+ cwd,
139
+ environment: env,
140
+ input,
141
+ output,
142
+ error,
143
+ check,
144
+ signal,
145
+ timeoutMs,
146
+ gracePeriodMs,
147
+ killTimeoutMs
148
+ };
165
149
  }
166
150
  /** Internal helper; parameter permits testing Windows key behavior on other hosts. */
167
- export function childEnvironment(policy, platform = process.platform) {
168
- if (policy === undefined)
169
- return undefined;
170
- const env = Object.assign(Object.create(null), policy.kind === 'inherit' ? process.env : undefined);
171
- if (platform === 'win32') {
172
- const keys = new Map();
173
- for (const key of Object.keys(env)) {
174
- const normalized = key.toUpperCase();
175
- const previous = keys.get(normalized);
176
- if (previous !== undefined)
177
- delete env[previous];
178
- keys.set(normalized, key);
179
- }
180
- for (const [key, value] of Object.entries(policy.values)) {
181
- const normalized = key.toUpperCase();
182
- const previous = keys.get(normalized);
183
- if (previous !== undefined)
184
- delete env[previous];
185
- keys.set(normalized, key);
186
- if (value !== undefined)
187
- env[key] = value;
188
- }
189
- }
190
- else {
191
- for (const [key, value] of Object.entries(policy.values)) {
192
- if (value === undefined)
193
- delete env[key];
194
- else
195
- env[key] = value;
196
- }
197
- }
198
- return env;
151
+ function childEnvironment(policy, platform = process.platform) {
152
+ if (policy === void 0) return void 0;
153
+ const env = Object.assign(Object.create(null), policy.kind === "inherit" ? process.env : void 0);
154
+ if (platform === "win32") {
155
+ const keys = /* @__PURE__ */ new Map();
156
+ for (const key of Object.keys(env)) {
157
+ const normalized = key.toUpperCase();
158
+ const previous = keys.get(normalized);
159
+ if (previous !== void 0) delete env[previous];
160
+ keys.set(normalized, key);
161
+ }
162
+ for (const [key, value] of Object.entries(policy.values)) {
163
+ const normalized = key.toUpperCase();
164
+ const previous = keys.get(normalized);
165
+ if (previous !== void 0) delete env[previous];
166
+ keys.set(normalized, key);
167
+ if (value !== void 0) env[key] = value;
168
+ }
169
+ } else for (const [key, value] of Object.entries(policy.values)) if (value === void 0) delete env[key];
170
+ else env[key] = value;
171
+ return env;
199
172
  }
173
+ //#endregion
174
+ export { Command, Environment, Input, Output, childEnvironment, settings };
175
+
200
176
  //# sourceMappingURL=values.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"values.js","sourceRoot":"","sources":["../src/values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;AACrE,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;AAC7E,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AACnE,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAOjE,SAAS,MAAM,CAAC,KAAc,EAAE,KAAa,EAAE,KAAK,GAAG,KAAK;IAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACrF,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,cAAc,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,oBAAoB,CAAC,CAAC;AAC5F,CAAC;AACD,SAAS,OAAO,CAAC,UAAkB,EAAE,IAAuB;IAC1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;IACvF,MAAM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KAAK,IAAI,YAAY,GAAG;EAC1B;EACA,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,MAAM,GAAG;GACxD,MAAM,aAAa,IAAI,YAAW;GAClC,MAAM,WAAW,KAAK,IAAI,UAAU;GACpC,IAAI,aAAa,KAAA,GAAW,OAAO,IAAI;GACvC,KAAK,IAAI,YAAY,GAAG;GACxB,IAAI,UAAU,KAAA,GAAW,IAAI,OAAO;EACtC;CACF,OACE,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,MAAM,GACrD,IAAI,UAAU,KAAA,GAAW,OAAO,IAAI;MAC/B,IAAI,OAAO;CAGpB,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftuijs/twill-shell",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Swift-inspired subprocess toolkit for Twill and native Node scripts: explicit arguments, bounded output and owned teardown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,9 +37,10 @@
37
37
  "vitest": "^5.0.3",
38
38
  "@vitest/coverage-v8": "^5.0.3",
39
39
  "prettier": "^3.9.9",
40
- "@swiftuijs/twill": "0.2.0",
41
- "@swiftuijs/twill-formatter": "0.2.0",
42
- "@swiftuijs/twill-export": "0.2.0"
40
+ "vite": "^8.3.2",
41
+ "@swiftuijs/twill-formatter": "0.3.1",
42
+ "@swiftuijs/twill": "0.3.1",
43
+ "@swiftuijs/twill-export": "0.3.1"
43
44
  },
44
45
  "author": {
45
46
  "name": "forth.ink",
@@ -62,15 +63,13 @@
62
63
  "optional": true
63
64
  }
64
65
  },
65
- "dependencies": {
66
- "@swiftuijs/twill-shell-native": "0.2.0"
67
- },
68
66
  "scripts": {
69
- "build": "node -e \"require('node:fs').rmSync('dist', {recursive: true, force: true})\" && tsc -p tsconfig.build.json",
70
- "typecheck": "tsc --noEmit -p tsconfig.json",
67
+ "build": "vite build && twill declarations -p tsconfig.build.json -o dist && node scripts/compact-maps.mjs",
68
+ "typecheck": "twill check -p tsconfig.json",
71
69
  "test:unit": "vitest run",
72
70
  "test:coverage": "vitest run --coverage",
73
71
  "test:package": "node tests/consumer.mjs",
74
- "benchmark": "node benchmarks/run.mjs"
72
+ "benchmark": "node benchmarks/run.mjs",
73
+ "benchmark:complete": "node benchmarks/complete.mjs"
75
74
  }
76
75
  }