spawn-term 1.0.2 → 1.0.4
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/components/App.js +32 -7
- package/dist/cjs/components/App.js.map +1 -1
- package/dist/cjs/components/ChildProcess.d.cts +1 -4
- package/dist/cjs/components/ChildProcess.d.ts +1 -4
- package/dist/cjs/components/ChildProcess.js +22 -34
- package/dist/cjs/components/ChildProcess.js.map +1 -1
- package/dist/cjs/createApp.d.cts +1 -1
- package/dist/cjs/createApp.d.ts +1 -1
- package/dist/cjs/createApp.js +6 -18
- package/dist/cjs/createApp.js.map +1 -1
- package/dist/cjs/state/ProcessContext.d.cts +6 -0
- package/dist/cjs/state/ProcessContext.d.ts +6 -0
- package/dist/cjs/state/ProcessContext.js +139 -0
- package/dist/cjs/state/ProcessContext.js.map +1 -0
- package/dist/cjs/state/ProcessStore.d.cts +7 -0
- package/dist/cjs/state/ProcessStore.d.ts +7 -0
- package/dist/cjs/state/ProcessStore.js +99 -0
- package/dist/cjs/state/ProcessStore.js.map +1 -0
- package/dist/cjs/types.d.cts +7 -0
- package/dist/cjs/types.d.ts +7 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/worker.js +7 -10
- package/dist/cjs/worker.js.map +1 -1
- package/dist/esm/components/App.js +31 -6
- package/dist/esm/components/App.js.map +1 -1
- package/dist/esm/components/ChildProcess.d.ts +1 -4
- package/dist/esm/components/ChildProcess.js +22 -31
- package/dist/esm/components/ChildProcess.js.map +1 -1
- package/dist/esm/createApp.d.ts +1 -1
- package/dist/esm/createApp.js +6 -18
- package/dist/esm/createApp.js.map +1 -1
- package/dist/esm/state/ProcessContext.d.ts +6 -0
- package/dist/esm/state/ProcessContext.js +51 -0
- package/dist/esm/state/ProcessContext.js.map +1 -0
- package/dist/esm/state/ProcessStore.d.ts +7 -0
- package/dist/esm/state/ProcessStore.js +21 -0
- package/dist/esm/state/ProcessStore.js.map +1 -0
- package/dist/esm/types.d.ts +7 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/worker.js +7 -8
- package/dist/esm/worker.js.map +1 -1
- package/package.json +1 -3
- package/dist/cjs/store/Context.d.cts +0 -3
- package/dist/cjs/store/Context.d.ts +0 -3
- package/dist/cjs/store/Context.js +0 -13
- package/dist/cjs/store/Context.js.map +0 -1
- package/dist/cjs/store/Store.d.cts +0 -9
- package/dist/cjs/store/Store.d.ts +0 -9
- package/dist/cjs/store/Store.js +0 -37
- package/dist/cjs/store/Store.js.map +0 -1
- package/dist/cjs/store/index.d.cts +0 -2
- package/dist/cjs/store/index.d.ts +0 -2
- package/dist/cjs/store/index.js +0 -26
- package/dist/cjs/store/index.js.map +0 -1
- package/dist/esm/store/Context.d.ts +0 -3
- package/dist/esm/store/Context.js +0 -2
- package/dist/esm/store/Context.js.map +0 -1
- package/dist/esm/store/Store.d.ts +0 -9
- package/dist/esm/store/Store.js +0 -16
- package/dist/esm/store/Store.js.map +0 -1
- package/dist/esm/store/index.d.ts +0 -2
- package/dist/esm/store/index.js +0 -2
- package/dist/esm/store/index.js.map +0 -1
package/dist/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["export type { SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from 'cross-spawn-cb';\n\nimport type { SpawnError, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: boolean;\n};\n\nexport type TerminalCallback = (error?: SpawnError, result?: SpawnResult) => undefined;\n\nexport const LineType = {\n stdout: 1,\n stderr: 2,\n} as const;\n\nexport type Line = {\n type: (typeof LineType)[keyof typeof LineType];\n text: string;\n};\n\nexport type State = 'running' | 'error' | 'success';\nexport type ChildProcess = {\n id: string;\n group?: string;\n title: string;\n state: State;\n lines: Line[];\n expanded?: boolean;\n};\n"],"names":["LineType","stdout","stderr"],"mappings":";;;;+BAWaA;;;eAAAA;;;AAAN,IAAMA,WAAW;IACtBC,QAAQ;IACRC,QAAQ;AACV"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["export type { SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from 'cross-spawn-cb';\n\nimport type { SpawnError, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: boolean;\n};\n\nexport type TerminalCallback = (error?: SpawnError, result?: SpawnResult) => undefined;\n\nexport const LineType = {\n stdout: 1,\n stderr: 2,\n} as const;\n\nexport type Line = {\n type: (typeof LineType)[keyof typeof LineType];\n text: string;\n};\n\nexport type State = 'running' | 'error' | 'success';\nexport type ChildProcess = {\n id: string;\n group?: string;\n title: string;\n state: State;\n lines: Line[];\n expanded?: boolean;\n};\nexport type ChildProcessUpdate = {\n group?: string;\n title?: string;\n state?: State;\n lines?: Line[];\n expanded?: boolean;\n};\n"],"names":["LineType","stdout","stderr"],"mappings":";;;;+BAWaA;;;eAAAA;;;AAAN,IAAMA,WAAW;IACtBC,QAAQ;IACRC,QAAQ;AACV"}
|
package/dist/cjs/worker.js
CHANGED
|
@@ -151,7 +151,7 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
|
|
|
151
151
|
if (stdio === 'inherit') {
|
|
152
152
|
terminal.retain(function(store) {
|
|
153
153
|
var id = _crypto.default.randomUUID();
|
|
154
|
-
store.
|
|
154
|
+
store.add(_object_spread({
|
|
155
155
|
id: id,
|
|
156
156
|
title: [
|
|
157
157
|
command
|
|
@@ -170,14 +170,14 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
|
|
|
170
170
|
var item = store.processes.find(function(x) {
|
|
171
171
|
return x.id === id;
|
|
172
172
|
});
|
|
173
|
-
store.
|
|
173
|
+
store.update(id, {
|
|
174
174
|
lines: item.lines.concat(lines.map(function(text) {
|
|
175
175
|
return {
|
|
176
176
|
type: _types.LineType.stdout,
|
|
177
177
|
text: text
|
|
178
178
|
};
|
|
179
179
|
}))
|
|
180
|
-
})
|
|
180
|
+
});
|
|
181
181
|
});
|
|
182
182
|
queue.defer(_onone.default.bind(null, cp.stdout.pipe(outputs.stdout), [
|
|
183
183
|
'error',
|
|
@@ -191,14 +191,14 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
|
|
|
191
191
|
var item = store.processes.find(function(x) {
|
|
192
192
|
return x.id === id;
|
|
193
193
|
});
|
|
194
|
-
store.
|
|
194
|
+
store.update(id, {
|
|
195
195
|
lines: item.lines.concat(lines.map(function(text) {
|
|
196
196
|
return {
|
|
197
197
|
type: _types.LineType.stderr,
|
|
198
198
|
text: text
|
|
199
199
|
};
|
|
200
200
|
}))
|
|
201
|
-
})
|
|
201
|
+
});
|
|
202
202
|
});
|
|
203
203
|
queue.defer(_onone.default.bind(null, cp.stderr.pipe(outputs.stderr), [
|
|
204
204
|
'error',
|
|
@@ -219,12 +219,9 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
|
|
|
219
219
|
res.stderr,
|
|
220
220
|
null
|
|
221
221
|
];
|
|
222
|
-
|
|
223
|
-
return x.id === id;
|
|
224
|
-
});
|
|
225
|
-
store.updateProcess(_object_spread_props(_object_spread({}, item), {
|
|
222
|
+
store.update(id, {
|
|
226
223
|
state: err ? 'error' : 'success'
|
|
227
|
-
})
|
|
224
|
+
});
|
|
228
225
|
// ensure rendering completes
|
|
229
226
|
terminal.release(function() {
|
|
230
227
|
err ? callback(err) : callback(null, res);
|
package/dist/cjs/worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["import spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport crypto from 'crypto';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp.js';\nimport addLines from './lib/addLines.js';\nimport concatWritable from './lib/concatWritable.js';\nimport formatArguments from './lib/formatArguments.js';\n\nimport type { SpawnError, SpawnOptions, TerminalCallback, TerminalOptions } from './types.js';\nimport { LineType } from './types.js';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback: TerminalCallback): undefined {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = crypto.randomUUID();\n store.
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["import spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport crypto from 'crypto';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp.js';\nimport addLines from './lib/addLines.js';\nimport concatWritable from './lib/concatWritable.js';\nimport formatArguments from './lib/formatArguments.js';\n\nimport type { SpawnError, SpawnOptions, TerminalCallback, TerminalOptions } from './types.js';\nimport { LineType } from './types.js';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback: TerminalCallback): undefined {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = crypto.randomUUID();\n store.add({ id, title: [command].concat(formatArguments(args)).join(' '), state: 'running', lines: [], ...options });\n\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.update(id, { lines: item.lines.concat(lines.map((text) => ({ type: LineType.stdout, text }))) });\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.update(id, { lines: item.lines.concat(lines.map((text) => ({ type: LineType.stderr, text }))) });\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n store.update(id, { state: err ? 'error' : 'success' });\n\n // ensure rendering completes\n terminal.release(() => {\n err ? callback(err) : callback(null, res);\n });\n });\n });\n } else {\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = concatWritable((output) => {\n outputs.stdout.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = concatWritable((output) => {\n outputs.stderr.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: encoding || 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n err ? callback(err) : callback(null, res);\n });\n }\n}\n"],"names":["spawnTerminal","terminal","createApp","command","args","spawnOptions","options","callback","encoding","stdio","csOptions","retain","store","id","crypto","randomUUID","add","title","concat","formatArguments","join","state","lines","cp","crossSpawn","outputs","stdout","stderr","queue","Queue","addLines","item","processes","find","x","update","map","text","type","LineType","defer","oo","bind","pipe","spawn","worker","await","err","res","output","release","concatWritable","toString"],"mappings":";;;;+BAeA;;;eAAwBA;;;oEAf4B;6DACjC;4DACJ;8DACG;gEAEI;+DACD;qEAC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AASwC,OAAOxC,SAAS,MAAMyC;QACvC;IACF;AACF"}
|
|
@@ -1,14 +1,39 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
1
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
30
|
import { Box } from 'ink';
|
|
3
|
-
import {
|
|
4
|
-
import { Context } from '../store/index.js';
|
|
31
|
+
import { useProcesses } from '../state/ProcessContext.js';
|
|
5
32
|
import ChildProcess from './ChildProcess.js';
|
|
6
33
|
export default function App() {
|
|
7
|
-
const
|
|
34
|
+
const processes = useProcesses();
|
|
8
35
|
return /*#__PURE__*/ _jsx(Box, {
|
|
9
36
|
flexDirection: "column",
|
|
10
|
-
children:
|
|
11
|
-
item: item
|
|
12
|
-
}, item.id))
|
|
37
|
+
children: processes.map((item)=>/*#__PURE__*/ _jsx(ChildProcess, _object_spread({}, item), item.id))
|
|
13
38
|
});
|
|
14
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import { Box } from 'ink';\nimport {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import { Box } from 'ink';\nimport { useProcesses } from '../state/ProcessContext.js';\nimport type { ChildProcess as ChildProcessT } from '../types.js';\nimport ChildProcess from './ChildProcess.js';\n\nexport default function App() {\n const processes = useProcesses();\n\n return (\n <Box flexDirection=\"column\">\n {processes.map((item: ChildProcessT) => (\n <ChildProcess key={item.id} {...item} />\n ))}\n </Box>\n );\n}\n"],"names":["Box","useProcesses","ChildProcess","App","processes","flexDirection","map","item","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,MAAM;AAC1B,SAASC,YAAY,QAAQ,6BAA6B;AAE1D,OAAOC,kBAAkB,oBAAoB;AAE7C,eAAe,SAASC;IACtB,MAAMC,YAAYH;IAElB,qBACE,KAACD;QAAIK,eAAc;kBAChBD,UAAUE,GAAG,CAAC,CAACC,qBACd,KAACL,iCAA+BK,OAAbA,KAAKC,EAAE;;AAIlC"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { ChildProcess as ChildProcessT } from '../types.js';
|
|
2
|
-
|
|
3
|
-
item: ChildProcessT;
|
|
4
|
-
};
|
|
5
|
-
declare const _default: import("react").NamedExoticComponent<ItemProps>;
|
|
2
|
+
declare const _default: import("react").NamedExoticComponent<ChildProcessT>;
|
|
6
3
|
export default _default;
|
|
@@ -27,7 +27,6 @@ function _object_spread(target) {
|
|
|
27
27
|
return target;
|
|
28
28
|
}
|
|
29
29
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
|
-
import c from 'ansi-colors';
|
|
31
30
|
import { Box, Text } from 'ink';
|
|
32
31
|
import { memo, useMemo } from 'react';
|
|
33
32
|
import ansiRegex from '../lib/ansiRegex.js';
|
|
@@ -56,13 +55,13 @@ const SPINNER = {
|
|
|
56
55
|
]
|
|
57
56
|
};
|
|
58
57
|
const ICONS = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
children:
|
|
58
|
+
error: /*#__PURE__*/ _jsx(Text, {
|
|
59
|
+
color: "red",
|
|
60
|
+
children: figures.cross
|
|
62
61
|
}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
children:
|
|
62
|
+
success: /*#__PURE__*/ _jsx(Text, {
|
|
63
|
+
color: "green",
|
|
64
|
+
children: figures.tick
|
|
66
65
|
}),
|
|
67
66
|
running: /*#__PURE__*/ _jsx(Spinner, _object_spread({}, SPINNER))
|
|
68
67
|
};
|
|
@@ -91,13 +90,12 @@ const RunningSummary = /*#__PURE__*/ memo(function RunningSummary({ line }) {
|
|
|
91
90
|
});
|
|
92
91
|
});
|
|
93
92
|
const renderLine = (line, index)=>{
|
|
94
|
-
return(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
}, index));
|
|
93
|
+
return /*#__PURE__*/ _jsx(Box, {
|
|
94
|
+
minHeight: 1,
|
|
95
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
96
|
+
children: line.text
|
|
97
|
+
})
|
|
98
|
+
}, index);
|
|
101
99
|
};
|
|
102
100
|
const Lines = /*#__PURE__*/ memo(function Lines({ lines }) {
|
|
103
101
|
return /*#__PURE__*/ _jsx(Box, {
|
|
@@ -106,8 +104,7 @@ const Lines = /*#__PURE__*/ memo(function Lines({ lines }) {
|
|
|
106
104
|
children: lines.map(renderLine)
|
|
107
105
|
});
|
|
108
106
|
});
|
|
109
|
-
const Expanded = /*#__PURE__*/ memo(function Expanded(
|
|
110
|
-
const { lines } = item;
|
|
107
|
+
const Expanded = /*#__PURE__*/ memo(function Expanded(item) {
|
|
111
108
|
return /*#__PURE__*/ _jsxs(Box, {
|
|
112
109
|
flexDirection: "column",
|
|
113
110
|
children: [
|
|
@@ -117,19 +114,18 @@ const Expanded = /*#__PURE__*/ memo(function Expanded({ item }) {
|
|
|
117
114
|
state: item.state
|
|
118
115
|
}),
|
|
119
116
|
/*#__PURE__*/ _jsx(Lines, {
|
|
120
|
-
lines: lines
|
|
117
|
+
lines: item.lines
|
|
121
118
|
})
|
|
122
119
|
]
|
|
123
120
|
});
|
|
124
121
|
});
|
|
125
|
-
const Contracted = /*#__PURE__*/ memo(function Contracted(
|
|
126
|
-
const { state, lines } = item;
|
|
122
|
+
const Contracted = /*#__PURE__*/ memo(function Contracted(item) {
|
|
127
123
|
// remove ansi codes when displaying single lines
|
|
128
|
-
const errors = useMemo(()=>lines.filter((line)=>line.type === LineType.stderr), [
|
|
129
|
-
lines
|
|
124
|
+
const errors = useMemo(()=>item.lines.filter((line)=>line.type === LineType.stderr), [
|
|
125
|
+
item.lines
|
|
130
126
|
]);
|
|
131
|
-
const summary = useMemo(()=>lines.filter((line)=>line.text.length > 0 && errors.indexOf(line) < 0).pop(), [
|
|
132
|
-
lines,
|
|
127
|
+
const summary = useMemo(()=>item.lines.filter((line)=>line.text.length > 0 && errors.indexOf(line) < 0).pop(), [
|
|
128
|
+
item.lines,
|
|
133
129
|
errors
|
|
134
130
|
]);
|
|
135
131
|
return /*#__PURE__*/ _jsxs(Box, {
|
|
@@ -140,7 +136,7 @@ const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
|
|
|
140
136
|
title: item.title,
|
|
141
137
|
state: item.state
|
|
142
138
|
}),
|
|
143
|
-
state === 'running' && /*#__PURE__*/ _jsx(RunningSummary, {
|
|
139
|
+
item.state === 'running' && /*#__PURE__*/ _jsx(RunningSummary, {
|
|
144
140
|
line: summary || BLANK_LINE
|
|
145
141
|
}),
|
|
146
142
|
errors.length > 0 && /*#__PURE__*/ _jsx(Lines, {
|
|
@@ -149,11 +145,6 @@ const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
|
|
|
149
145
|
]
|
|
150
146
|
});
|
|
151
147
|
});
|
|
152
|
-
export default /*#__PURE__*/ memo(function ChildProcess(
|
|
153
|
-
|
|
154
|
-
return expanded ? /*#__PURE__*/ _jsx(Expanded, {
|
|
155
|
-
item: item
|
|
156
|
-
}) : /*#__PURE__*/ _jsx(Contracted, {
|
|
157
|
-
item: item
|
|
158
|
-
});
|
|
148
|
+
export default /*#__PURE__*/ memo(function ChildProcess(item) {
|
|
149
|
+
return item.expanded ? /*#__PURE__*/ _jsx(Expanded, _object_spread({}, item)) : /*#__PURE__*/ _jsx(Contracted, _object_spread({}, item));
|
|
159
150
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import { Box, Text } from 'ink';\nimport { memo, useMemo } from 'react';\nimport ansiRegex from '../lib/ansiRegex.js';\nimport figures from '../lib/figures.js';\nimport type { ChildProcess as ChildProcessT, Line, State } from '../types.js';\nimport { LineType } from '../types.js';\nimport Spinner from './Spinner.js';\n\nconst REGEX_ANSI = ansiRegex();\nconst BLANK_LINE = { type: LineType.stdout, text: '' };\n\n// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2\nconst SPINNER = {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n};\n\nconst ICONS = {\n error: <Text color=\"red\">{figures.cross}</Text>,\n success: <Text color=\"green\">{figures.tick}</Text>,\n running: <Spinner {...SPINNER} />,\n};\n\ntype HeaderProps = {\n group?: string;\n title: string;\n state: State;\n};\n\nconst Header = memo(\n function Header({ group, title, state }: HeaderProps) {\n const icon = ICONS[state];\n\n return (\n <Box>\n {icon}\n {group && <Text bold>{`${group}${figures.pointer} `}</Text>}\n <Text>{title}</Text>\n </Box>\n );\n },\n (a, b) => a.group === b.group && a.title === b.title && a.state === b.state\n);\n\ntype RunningSummaryProps = {\n line: Line;\n};\n\nconst RunningSummary = memo(function RunningSummary({ line }: RunningSummaryProps) {\n return (\n <Box marginLeft={2}>\n <Text color=\"gray\">{line.text.replace(REGEX_ANSI, '')}</Text>\n </Box>\n );\n});\n\ntype LinesProps = {\n lines: Line[];\n};\n\nconst renderLine = (line, index) => {\n return (\n <Box key={index} minHeight={1}>\n <Text>{line.text}</Text>\n </Box>\n );\n};\n\nconst Lines = memo(function Lines({ lines }: LinesProps) {\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n {lines.map(renderLine)}\n </Box>\n );\n});\n\nconst Expanded = memo(function Expanded(item: ChildProcessT) {\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n <Lines lines={item.lines} />\n </Box>\n );\n});\n\nconst Contracted = memo(function Contracted(item: ChildProcessT) {\n // remove ansi codes when displaying single lines\n const errors = useMemo(() => item.lines.filter((line) => line.type === LineType.stderr), [item.lines]);\n const summary = useMemo(() => item.lines.filter((line) => line.text.length > 0 && errors.indexOf(line) < 0).pop(), [item.lines, errors]);\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n {item.state === 'running' && <RunningSummary line={summary || BLANK_LINE} />}\n {errors.length > 0 && <Lines lines={errors} />}\n </Box>\n );\n});\n\nexport default memo(function ChildProcess(item: ChildProcessT) {\n return item.expanded ? <Expanded {...item} /> : <Contracted {...item} />;\n});\n"],"names":["Box","Text","memo","useMemo","ansiRegex","figures","LineType","Spinner","REGEX_ANSI","BLANK_LINE","type","stdout","text","SPINNER","interval","frames","ICONS","error","color","cross","success","tick","running","Header","group","title","state","icon","bold","pointer","a","b","RunningSummary","line","marginLeft","replace","renderLine","index","minHeight","Lines","lines","flexDirection","map","Expanded","item","Contracted","errors","filter","stderr","summary","length","indexOf","pop","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BAAK,KAACX;gBAAMC,OAAOM;;;;AAG1C;AAEA,6BAAe5C,KAAK,SAASmD,aAAaT,IAAmB;IAC3D,OAAOA,KAAKU,QAAQ,iBAAG,KAACX,6BAAaC,uBAAW,KAACC,+BAAeD;AAClE,GAAG"}
|
package/dist/esm/createApp.d.ts
CHANGED
package/dist/esm/createApp.js
CHANGED
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render } from 'ink';
|
|
3
|
-
import throttle from 'lodash.throttle';
|
|
4
3
|
import App from './components/App.js';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const THROTTLE = 50;
|
|
4
|
+
import { ProcessProvider } from './state/ProcessContext.js';
|
|
5
|
+
import Store from './state/ProcessStore.js';
|
|
8
6
|
export default function createApp() {
|
|
9
7
|
let refCount = 0;
|
|
10
8
|
let store = null;
|
|
11
9
|
let inkApp = null;
|
|
12
|
-
const rerender = ()=>{
|
|
13
|
-
inkApp === null || inkApp === void 0 ? void 0 : inkApp.rerender(/*#__PURE__*/ _jsx(StoreContext.Provider, {
|
|
14
|
-
value: store,
|
|
15
|
-
children: /*#__PURE__*/ _jsx(App, {})
|
|
16
|
-
}));
|
|
17
|
-
};
|
|
18
|
-
const rerenderThrottled = throttle(rerender, THROTTLE);
|
|
19
10
|
return {
|
|
20
11
|
retain (fn) {
|
|
21
12
|
if (++refCount > 1) return fn(store);
|
|
22
13
|
if (store) throw new Error('Not expecting store');
|
|
23
|
-
store = new Store(
|
|
24
|
-
inkApp = render(/*#__PURE__*/ _jsx(
|
|
25
|
-
|
|
14
|
+
store = new Store();
|
|
15
|
+
inkApp = render(/*#__PURE__*/ _jsx(ProcessProvider, {
|
|
16
|
+
store: store,
|
|
26
17
|
children: /*#__PURE__*/ _jsx(App, {})
|
|
27
|
-
})
|
|
28
|
-
patchConsole: false
|
|
29
|
-
});
|
|
18
|
+
}));
|
|
30
19
|
fn(store);
|
|
31
20
|
},
|
|
32
21
|
release (cb) {
|
|
33
22
|
if (--refCount > 0) return cb();
|
|
34
23
|
if (!store) throw new Error('Expecting store');
|
|
35
|
-
rerender();
|
|
36
24
|
inkApp.waitUntilExit().then(()=>cb()).catch(cb);
|
|
37
25
|
inkApp.unmount();
|
|
38
26
|
inkApp = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createApp.tsx"],"sourcesContent":["import { type Instance, render } from 'ink';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createApp.tsx"],"sourcesContent":["import { type Instance, render } from 'ink';\nimport App from './components/App.js';\nimport { ProcessProvider } from './state/ProcessContext.js';\nimport Store from './state/ProcessStore.js';\n\nexport type RetainCallback = (app: Store) => undefined;\nexport type ReleaseCallback = () => undefined;\n\nexport default function createApp() {\n let refCount = 0;\n let store = null;\n let inkApp: Instance | null = null;\n\n return {\n retain(fn: RetainCallback): undefined {\n if (++refCount > 1) return fn(store);\n if (store) throw new Error('Not expecting store');\n\n store = new Store();\n inkApp = render(\n <ProcessProvider store={store}>\n <App />\n </ProcessProvider>\n );\n fn(store);\n },\n release(cb: ReleaseCallback): undefined {\n if (--refCount > 0) return cb();\n if (!store) throw new Error('Expecting store');\n\n inkApp\n .waitUntilExit()\n .then(() => cb())\n .catch(cb);\n inkApp.unmount();\n inkApp = null;\n store = null;\n process.stdout.write('\\x1b[?25h'); // show cursor\n },\n };\n}\n"],"names":["render","App","ProcessProvider","Store","createApp","refCount","store","inkApp","retain","fn","Error","release","cb","waitUntilExit","then","catch","unmount","process","stdout","write"],"mappings":";AAAA,SAAwBA,MAAM,QAAQ,MAAM;AAC5C,OAAOC,SAAS,sBAAsB;AACtC,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,OAAOC,WAAW,0BAA0B;AAK5C,eAAe,SAASC;IACtB,IAAIC,WAAW;IACf,IAAIC,QAAQ;IACZ,IAAIC,SAA0B;IAE9B,OAAO;QACLC,QAAOC,EAAkB;YACvB,IAAI,EAAEJ,WAAW,GAAG,OAAOI,GAAGH;YAC9B,IAAIA,OAAO,MAAM,IAAII,MAAM;YAE3BJ,QAAQ,IAAIH;YACZI,SAASP,qBACP,KAACE;gBAAgBI,OAAOA;0BACtB,cAAA,KAACL;;YAGLQ,GAAGH;QACL;QACAK,SAAQC,EAAmB;YACzB,IAAI,EAAEP,WAAW,GAAG,OAAOO;YAC3B,IAAI,CAACN,OAAO,MAAM,IAAII,MAAM;YAE5BH,OACGM,aAAa,GACbC,IAAI,CAAC,IAAMF,MACXG,KAAK,CAACH;YACTL,OAAOS,OAAO;YACdT,SAAS;YACTD,QAAQ;YACRW,QAAQC,MAAM,CAACC,KAAK,CAAC,cAAc,cAAc;QACnD;IACF;AACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useReducer } from 'react';
|
|
3
|
+
const ProcessContext = /*#__PURE__*/ createContext(null);
|
|
4
|
+
const ProcessDispatchContext = /*#__PURE__*/ createContext(null);
|
|
5
|
+
export function ProcessProvider({ children, store }) {
|
|
6
|
+
const [Process, dispatch] = useReducer(ProcessReducer, []);
|
|
7
|
+
store.on('added', (process)=>dispatch({
|
|
8
|
+
type: 'added',
|
|
9
|
+
process
|
|
10
|
+
}));
|
|
11
|
+
store.on('changed', (process)=>dispatch({
|
|
12
|
+
type: 'changed',
|
|
13
|
+
process
|
|
14
|
+
}));
|
|
15
|
+
return /*#__PURE__*/ _jsx(ProcessContext, {
|
|
16
|
+
value: Process,
|
|
17
|
+
children: /*#__PURE__*/ _jsx(ProcessDispatchContext, {
|
|
18
|
+
value: dispatch,
|
|
19
|
+
children: children
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function useProcesses() {
|
|
24
|
+
return useContext(ProcessContext);
|
|
25
|
+
}
|
|
26
|
+
export function useProcessDispatch() {
|
|
27
|
+
return useContext(ProcessDispatchContext);
|
|
28
|
+
}
|
|
29
|
+
function ProcessReducer(processes, action) {
|
|
30
|
+
switch(action.type){
|
|
31
|
+
case 'added':
|
|
32
|
+
{
|
|
33
|
+
if (processes.find((x)=>x.id === action.process.id)) {
|
|
34
|
+
console.log(`${action.process.id} process added a second time`);
|
|
35
|
+
return processes;
|
|
36
|
+
}
|
|
37
|
+
return [
|
|
38
|
+
...processes,
|
|
39
|
+
action.process
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
case 'changed':
|
|
43
|
+
{
|
|
44
|
+
return processes.map((x)=>x.id === action.process.id ? action.process : x);
|
|
45
|
+
}
|
|
46
|
+
default:
|
|
47
|
+
{
|
|
48
|
+
throw Error(`Unknown action: ${action.type}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/state/ProcessContext.tsx"],"sourcesContent":["import { createContext, useContext, useReducer } from 'react';\n\nconst ProcessContext = createContext(null);\nconst ProcessDispatchContext = createContext(null);\n\nexport function ProcessProvider({ children, store }) {\n const [Process, dispatch] = useReducer(ProcessReducer, []);\n\n store.on('added', (process) => dispatch({ type: 'added', process }));\n store.on('changed', (process) => dispatch({ type: 'changed', process }));\n\n return (\n <ProcessContext value={Process}>\n <ProcessDispatchContext value={dispatch}>{children}</ProcessDispatchContext>\n </ProcessContext>\n );\n}\n\nexport function useProcesses() {\n return useContext(ProcessContext);\n}\n\nexport function useProcessDispatch() {\n return useContext(ProcessDispatchContext);\n}\n\nfunction ProcessReducer(processes, action) {\n switch (action.type) {\n case 'added': {\n if (processes.find((x) => x.id === action.process.id)) {\n console.log(`${action.process.id} process added a second time`);\n return processes;\n }\n return [...processes, action.process];\n }\n case 'changed': {\n return processes.map((x) => (x.id === action.process.id ? action.process : x));\n }\n default: {\n throw Error(`Unknown action: ${action.type}`);\n }\n }\n}\n"],"names":["createContext","useContext","useReducer","ProcessContext","ProcessDispatchContext","ProcessProvider","children","store","Process","dispatch","ProcessReducer","on","process","type","value","useProcesses","useProcessDispatch","processes","action","find","x","id","console","log","map","Error"],"mappings":";AAAA,SAASA,aAAa,EAAEC,UAAU,EAAEC,UAAU,QAAQ,QAAQ;AAE9D,MAAMC,+BAAiBH,cAAc;AACrC,MAAMI,uCAAyBJ,cAAc;AAE7C,OAAO,SAASK,gBAAgB,EAAEC,QAAQ,EAAEC,KAAK,EAAE;IACjD,MAAM,CAACC,SAASC,SAAS,GAAGP,WAAWQ,gBAAgB,EAAE;IAEzDH,MAAMI,EAAE,CAAC,SAAS,CAACC,UAAYH,SAAS;YAAEI,MAAM;YAASD;QAAQ;IACjEL,MAAMI,EAAE,CAAC,WAAW,CAACC,UAAYH,SAAS;YAAEI,MAAM;YAAWD;QAAQ;IAErE,qBACE,KAACT;QAAeW,OAAON;kBACrB,cAAA,KAACJ;YAAuBU,OAAOL;sBAAWH;;;AAGhD;AAEA,OAAO,SAASS;IACd,OAAOd,WAAWE;AACpB;AAEA,OAAO,SAASa;IACd,OAAOf,WAAWG;AACpB;AAEA,SAASM,eAAeO,SAAS,EAAEC,MAAM;IACvC,OAAQA,OAAOL,IAAI;QACjB,KAAK;YAAS;gBACZ,IAAII,UAAUE,IAAI,CAAC,CAACC,IAAMA,EAAEC,EAAE,KAAKH,OAAON,OAAO,CAACS,EAAE,GAAG;oBACrDC,QAAQC,GAAG,CAAC,GAAGL,OAAON,OAAO,CAACS,EAAE,CAAC,4BAA4B,CAAC;oBAC9D,OAAOJ;gBACT;gBACA,OAAO;uBAAIA;oBAAWC,OAAON,OAAO;iBAAC;YACvC;QACA,KAAK;YAAW;gBACd,OAAOK,UAAUO,GAAG,CAAC,CAACJ,IAAOA,EAAEC,EAAE,KAAKH,OAAON,OAAO,CAACS,EAAE,GAAGH,OAAON,OAAO,GAAGQ;YAC7E;QACA;YAAS;gBACP,MAAMK,MAAM,CAAC,gBAAgB,EAAEP,OAAOL,IAAI,EAAE;YAC9C;IACF;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import type { ChildProcess, ChildProcessUpdate } from '../types.js';
|
|
3
|
+
export default class ProcessStore extends EventEmitter {
|
|
4
|
+
processes: ChildProcess[];
|
|
5
|
+
add(process: ChildProcess): ChildProcess;
|
|
6
|
+
update(id: string, update: ChildProcessUpdate): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
class ProcessStore extends EventEmitter {
|
|
3
|
+
add(process) {
|
|
4
|
+
this.processes.push(process);
|
|
5
|
+
this.emit('added', process);
|
|
6
|
+
return process;
|
|
7
|
+
}
|
|
8
|
+
update(id, update) {
|
|
9
|
+
const found = this.processes.find((x)=>x.id === id);
|
|
10
|
+
if (!found) {
|
|
11
|
+
console.log(`Process ${id} not found`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
Object.assign(found, update);
|
|
15
|
+
this.emit('changed', found);
|
|
16
|
+
}
|
|
17
|
+
constructor(...args){
|
|
18
|
+
super(...args), this.processes = [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export { ProcessStore as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/state/ProcessStore.ts"],"sourcesContent":["import { EventEmitter } from 'events';\nimport type { ChildProcess, ChildProcessUpdate } from '../types.js';\n\nexport default class ProcessStore extends EventEmitter {\n processes: ChildProcess[] = [];\n\n add(process: ChildProcess): ChildProcess {\n this.processes.push(process);\n this.emit('added', process);\n return process;\n }\n\n update(id: string, update: ChildProcessUpdate): void {\n const found = this.processes.find((x) => x.id === id);\n if (!found) {\n console.log(`Process ${id} not found`);\n return;\n }\n Object.assign(found, update);\n this.emit('changed', found);\n }\n}\n"],"names":["EventEmitter","ProcessStore","add","process","processes","push","emit","update","id","found","find","x","console","log","Object","assign"],"mappings":"AAAA,SAASA,YAAY,QAAQ,SAAS;AAGvB,MAAMC,qBAAqBD;IAGxCE,IAAIC,OAAqB,EAAgB;QACvC,IAAI,CAACC,SAAS,CAACC,IAAI,CAACF;QACpB,IAAI,CAACG,IAAI,CAAC,SAASH;QACnB,OAAOA;IACT;IAEAI,OAAOC,EAAU,EAAED,MAA0B,EAAQ;QACnD,MAAME,QAAQ,IAAI,CAACL,SAAS,CAACM,IAAI,CAAC,CAACC,IAAMA,EAAEH,EAAE,KAAKA;QAClD,IAAI,CAACC,OAAO;YACVG,QAAQC,GAAG,CAAC,CAAC,QAAQ,EAAEL,GAAG,UAAU,CAAC;YACrC;QACF;QACAM,OAAOC,MAAM,CAACN,OAAOF;QACrB,IAAI,CAACD,IAAI,CAAC,WAAWG;IACvB;;QAjBa,qBACbL,YAA4B,EAAE;;AAiBhC;AAlBA,SAAqBH,0BAkBpB"}
|
package/dist/esm/types.d.ts
CHANGED
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["export type { SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from 'cross-spawn-cb';\n\nimport type { SpawnError, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: boolean;\n};\n\nexport type TerminalCallback = (error?: SpawnError, result?: SpawnResult) => undefined;\n\nexport const LineType = {\n stdout: 1,\n stderr: 2,\n} as const;\n\nexport type Line = {\n type: (typeof LineType)[keyof typeof LineType];\n text: string;\n};\n\nexport type State = 'running' | 'error' | 'success';\nexport type ChildProcess = {\n id: string;\n group?: string;\n title: string;\n state: State;\n lines: Line[];\n expanded?: boolean;\n};\n"],"names":["LineType","stdout","stderr"],"mappings":"AAWA,OAAO,MAAMA,WAAW;IACtBC,QAAQ;IACRC,QAAQ;AACV,EAAW"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["export type { SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from 'cross-spawn-cb';\n\nimport type { SpawnError, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: boolean;\n};\n\nexport type TerminalCallback = (error?: SpawnError, result?: SpawnResult) => undefined;\n\nexport const LineType = {\n stdout: 1,\n stderr: 2,\n} as const;\n\nexport type Line = {\n type: (typeof LineType)[keyof typeof LineType];\n text: string;\n};\n\nexport type State = 'running' | 'error' | 'success';\nexport type ChildProcess = {\n id: string;\n group?: string;\n title: string;\n state: State;\n lines: Line[];\n expanded?: boolean;\n};\nexport type ChildProcessUpdate = {\n group?: string;\n title?: string;\n state?: State;\n lines?: Line[];\n expanded?: boolean;\n};\n"],"names":["LineType","stdout","stderr"],"mappings":"AAWA,OAAO,MAAMA,WAAW;IACtBC,QAAQ;IACRC,QAAQ;AACV,EAAW"}
|
package/dist/esm/worker.js
CHANGED
|
@@ -95,7 +95,7 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
|
|
|
95
95
|
if (stdio === 'inherit') {
|
|
96
96
|
terminal.retain((store)=>{
|
|
97
97
|
const id = crypto.randomUUID();
|
|
98
|
-
store.
|
|
98
|
+
store.add(_object_spread({
|
|
99
99
|
id,
|
|
100
100
|
title: [
|
|
101
101
|
command
|
|
@@ -112,12 +112,12 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
|
|
|
112
112
|
if (cp.stdout) {
|
|
113
113
|
outputs.stdout = addLines((lines)=>{
|
|
114
114
|
const item = store.processes.find((x)=>x.id === id);
|
|
115
|
-
store.
|
|
115
|
+
store.update(id, {
|
|
116
116
|
lines: item.lines.concat(lines.map((text)=>({
|
|
117
117
|
type: LineType.stdout,
|
|
118
118
|
text
|
|
119
119
|
})))
|
|
120
|
-
})
|
|
120
|
+
});
|
|
121
121
|
});
|
|
122
122
|
queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), [
|
|
123
123
|
'error',
|
|
@@ -129,12 +129,12 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
|
|
|
129
129
|
if (cp.stderr) {
|
|
130
130
|
outputs.stderr = addLines((lines)=>{
|
|
131
131
|
const item = store.processes.find((x)=>x.id === id);
|
|
132
|
-
store.
|
|
132
|
+
store.update(id, {
|
|
133
133
|
lines: item.lines.concat(lines.map((text)=>({
|
|
134
134
|
type: LineType.stderr,
|
|
135
135
|
text
|
|
136
136
|
})))
|
|
137
|
-
})
|
|
137
|
+
});
|
|
138
138
|
});
|
|
139
139
|
queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), [
|
|
140
140
|
'error',
|
|
@@ -155,10 +155,9 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
|
|
|
155
155
|
res.stderr,
|
|
156
156
|
null
|
|
157
157
|
];
|
|
158
|
-
|
|
159
|
-
store.updateProcess(_object_spread_props(_object_spread({}, item), {
|
|
158
|
+
store.update(id, {
|
|
160
159
|
state: err ? 'error' : 'success'
|
|
161
|
-
})
|
|
160
|
+
});
|
|
162
161
|
// ensure rendering completes
|
|
163
162
|
terminal.release(()=>{
|
|
164
163
|
err ? callback(err) : callback(null, res);
|
package/dist/esm/worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["import spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport crypto from 'crypto';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp.js';\nimport addLines from './lib/addLines.js';\nimport concatWritable from './lib/concatWritable.js';\nimport formatArguments from './lib/formatArguments.js';\n\nimport type { SpawnError, SpawnOptions, TerminalCallback, TerminalOptions } from './types.js';\nimport { LineType } from './types.js';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback: TerminalCallback): undefined {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = crypto.randomUUID();\n store.
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["import spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport crypto from 'crypto';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp.js';\nimport addLines from './lib/addLines.js';\nimport concatWritable from './lib/concatWritable.js';\nimport formatArguments from './lib/formatArguments.js';\n\nimport type { SpawnError, SpawnOptions, TerminalCallback, TerminalOptions } from './types.js';\nimport { LineType } from './types.js';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback: TerminalCallback): undefined {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = crypto.randomUUID();\n store.add({ id, title: [command].concat(formatArguments(args)).join(' '), state: 'running', lines: [], ...options });\n\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.update(id, { lines: item.lines.concat(lines.map((text) => ({ type: LineType.stdout, text }))) });\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.update(id, { lines: item.lines.concat(lines.map((text) => ({ type: LineType.stderr, text }))) });\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n store.update(id, { state: err ? 'error' : 'success' });\n\n // ensure rendering completes\n terminal.release(() => {\n err ? callback(err) : callback(null, res);\n });\n });\n });\n } else {\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = concatWritable((output) => {\n outputs.stdout.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = concatWritable((output) => {\n outputs.stderr.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: encoding || 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n err ? callback(err) : callback(null, res);\n });\n }\n}\n"],"names":["spawn","crossSpawn","crypto","oo","Queue","createApp","addLines","concatWritable","formatArguments","LineType","terminal","spawnTerminal","command","args","spawnOptions","options","callback","encoding","stdio","csOptions","retain","store","id","randomUUID","add","title","concat","join","state","lines","cp","outputs","stdout","stderr","queue","item","processes","find","x","update","map","text","type","defer","bind","pipe","worker","await","err","res","output","release","toString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAASC,UAAU,QAA0B,iBAAiB;AACrE,OAAOC,YAAY,SAAS;AAC5B,OAAOC,QAAQ,SAAS;AACxB,OAAOC,WAAW,WAA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