spawn-term 0.1.9 → 0.1.11
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.cjs +3 -29
- package/dist/cjs/components/App.cjs.map +1 -1
- package/dist/cjs/components/ChildProcess.cjs +31 -66
- package/dist/cjs/components/ChildProcess.cjs.map +1 -1
- package/dist/esm/components/App.mjs +3 -23
- package/dist/esm/components/App.mjs.map +1 -1
- package/dist/esm/components/ChildProcess.mjs +24 -59
- package/dist/esm/components/ChildProcess.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -62,39 +62,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
62
62
|
function App() {
|
|
63
63
|
var store = (0, _react.useContext)(_Store.default);
|
|
64
64
|
var appState = (0, _zustand.useStore)(store);
|
|
65
|
-
|
|
66
|
-
return [
|
|
67
|
-
'running'
|
|
68
|
-
].indexOf(x.state) >= 0;
|
|
69
|
-
});
|
|
70
|
-
var done = appState.processes.filter(function(x) {
|
|
71
|
-
return [
|
|
72
|
-
'error',
|
|
73
|
-
'success'
|
|
74
|
-
].indexOf(x.state) >= 0;
|
|
75
|
-
});
|
|
76
|
-
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
65
|
+
return /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
77
66
|
flexDirection: "column"
|
|
78
|
-
},
|
|
67
|
+
}, appState.processes.map(function(item) {
|
|
79
68
|
return /*#__PURE__*/ _react.default.createElement(_ChildProcess.default, {
|
|
80
69
|
key: item.id,
|
|
81
70
|
id: item.id
|
|
82
71
|
});
|
|
83
|
-
}))
|
|
84
|
-
flexDirection: "column",
|
|
85
|
-
borderStyle: "single",
|
|
86
|
-
borderColor: "black",
|
|
87
|
-
borderBottom: true,
|
|
88
|
-
borderTop: false,
|
|
89
|
-
borderLeft: false,
|
|
90
|
-
borderRight: false
|
|
91
|
-
}), /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
92
|
-
flexDirection: "column"
|
|
93
|
-
}, done.map(function(item) {
|
|
94
|
-
return /*#__PURE__*/ _react.default.createElement(_ChildProcess.default, {
|
|
95
|
-
key: item.id,
|
|
96
|
-
id: item.id
|
|
97
|
-
});
|
|
98
|
-
})));
|
|
72
|
+
}));
|
|
99
73
|
}
|
|
100
74
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store';\nimport { Box } from '../ink.mjs';\nimport type { AppState, ChildProcess as ChildProcessT } from '../types';\nimport ChildProcess from './ChildProcess';\n\nexport default function App() {\n const store = useContext(StoreContext);\n const appState = useStore(store) as AppState;\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store';\nimport { Box } from '../ink.mjs';\nimport type { AppState, ChildProcess as ChildProcessT } from '../types';\nimport ChildProcess from './ChildProcess';\n\nexport default function App() {\n const store = useContext(StoreContext);\n const appState = useStore(store) as AppState;\n\n return (\n <Box flexDirection=\"column\">\n {appState.processes.map((item: ChildProcessT) => (\n <ChildProcess key={item.id} id={item.id} />\n ))}\n </Box>\n );\n}\n"],"names":["App","store","useContext","StoreContext","appState","useStore","Box","flexDirection","processes","map","item","ChildProcess","key","id"],"mappings":";;;;+BAOA;;;eAAwBA;;;6DAPU;uBACT;4DACA;mBACL;mEAEK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEV,SAASA;IACtB,IAAMC,QAAQC,IAAAA,iBAAU,EAACC,cAAY;IACrC,IAAMC,WAAWC,IAAAA,iBAAQ,EAACJ;IAE1B,qBACE,6BAACK,QAAG;QAACC,eAAc;OAChBH,SAASI,SAAS,CAACC,GAAG,CAAC,SAACC;6BACvB,6BAACC,qBAAY;YAACC,KAAKF,KAAKG,EAAE;YAAEA,IAAIH,KAAKG,EAAE;;;AAI/C"}
|
|
@@ -77,6 +77,10 @@ var spinner = {
|
|
|
77
77
|
'⠏'
|
|
78
78
|
]
|
|
79
79
|
};
|
|
80
|
+
var RUNS = [
|
|
81
|
+
_figures.default.cross,
|
|
82
|
+
_figures.default.tick
|
|
83
|
+
].concat(spinner.frames);
|
|
80
84
|
var ICONS = {
|
|
81
85
|
error: /*#__PURE__*/ _react.default.createElement(_ink.Text, {
|
|
82
86
|
color: "red"
|
|
@@ -86,19 +90,13 @@ var ICONS = {
|
|
|
86
90
|
}, _figures.default.tick),
|
|
87
91
|
running: /*#__PURE__*/ _react.default.createElement(_Spinner.default, spinner)
|
|
88
92
|
};
|
|
89
|
-
var POINTERS = {
|
|
90
|
-
error: /*#__PURE__*/ _react.default.createElement(_ink.Text, {
|
|
91
|
-
color: "red"
|
|
92
|
-
}, _figures.default.pointer),
|
|
93
|
-
default: /*#__PURE__*/ _react.default.createElement(_ink.Text, {
|
|
94
|
-
color: "yellow"
|
|
95
|
-
}, _figures.default.pointer)
|
|
96
|
-
};
|
|
97
93
|
function Header(param) {
|
|
98
|
-
var
|
|
94
|
+
var item = param.item;
|
|
95
|
+
var group = item.group, title = item.title, state = item.state;
|
|
96
|
+
var icon = ICONS[state];
|
|
99
97
|
return /*#__PURE__*/ _react.default.createElement(_ink.Box, null, /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
100
98
|
marginRight: 1
|
|
101
|
-
}, /*#__PURE__*/ _react.default.createElement(_ink.Text, null, icon)), /*#__PURE__*/ _react.default.createElement(_ink.Text, null, title));
|
|
99
|
+
}, /*#__PURE__*/ _react.default.createElement(_ink.Text, null, icon)), group && /*#__PURE__*/ _react.default.createElement(_ink.Text, null, "".concat(group).concat(_figures.default.pointer, " ")), /*#__PURE__*/ _react.default.createElement(_ink.Text, null, title));
|
|
102
100
|
}
|
|
103
101
|
function Output(param) {
|
|
104
102
|
var output = param.output;
|
|
@@ -124,75 +122,42 @@ function Lines(param) {
|
|
|
124
122
|
}, line.text)));
|
|
125
123
|
}));
|
|
126
124
|
}
|
|
127
|
-
function
|
|
128
|
-
var
|
|
129
|
-
var
|
|
130
|
-
var
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
return line.type === _types.LineType.stderr;
|
|
125
|
+
function ChildProcess(param) {
|
|
126
|
+
var id = param.id;
|
|
127
|
+
var store = (0, _react.useContext)(_Store.default);
|
|
128
|
+
var appState = (0, _zustand.useStore)(store);
|
|
129
|
+
var item = appState.processes.find(function(x) {
|
|
130
|
+
return x.id === id;
|
|
134
131
|
});
|
|
132
|
+
var state = item.state, lines = item.lines, expanded = item.expanded;
|
|
135
133
|
if (expanded) {
|
|
136
|
-
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(Header, {
|
|
137
|
-
icon: icon,
|
|
138
|
-
title: title
|
|
139
|
-
}), /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
140
|
-
lines: lines
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(Header, {
|
|
144
|
-
icon: icon,
|
|
145
|
-
title: title
|
|
146
|
-
}), state === 'running' && output && /*#__PURE__*/ _react.default.createElement(Output, {
|
|
147
|
-
output: output
|
|
148
|
-
}), errors.length > 0 && /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
149
|
-
lines: errors
|
|
150
|
-
}));
|
|
151
|
-
}
|
|
152
|
-
function Group(param) {
|
|
153
|
-
var item = param.item;
|
|
154
|
-
var title = item.title, state = item.state, lines = item.lines, group = item.group, expanded = item.expanded;
|
|
155
|
-
var icon = ICONS[state];
|
|
156
|
-
var pointer = POINTERS[state] || POINTERS.default;
|
|
157
|
-
var errors = lines.filter(function(line) {
|
|
158
|
-
return line.type === _types.LineType.stderr;
|
|
159
|
-
});
|
|
160
|
-
if (state === 'running') {
|
|
161
134
|
return /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
162
135
|
flexDirection: "column"
|
|
163
136
|
}, /*#__PURE__*/ _react.default.createElement(Header, {
|
|
164
|
-
icon: pointer,
|
|
165
|
-
title: group
|
|
166
|
-
}), /*#__PURE__*/ _react.default.createElement(Content, {
|
|
167
137
|
item: item
|
|
138
|
+
}), /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
139
|
+
lines: lines
|
|
168
140
|
}));
|
|
169
141
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
title: "".concat(group, ": ").concat(title)
|
|
175
|
-
}), expanded && /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
176
|
-
lines: lines
|
|
177
|
-
}), !expanded && errors.length > 0 && /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
178
|
-
lines: errors
|
|
179
|
-
}));
|
|
180
|
-
}
|
|
181
|
-
function ChildProcess(param) {
|
|
182
|
-
var id = param.id;
|
|
183
|
-
var store = (0, _react.useContext)(_Store.default);
|
|
184
|
-
var appState = (0, _zustand.useStore)(store);
|
|
185
|
-
var item = appState.processes.find(function(x) {
|
|
186
|
-
return x.id === id;
|
|
142
|
+
var runs = lines.filter(function(line) {
|
|
143
|
+
return RUNS.some(function(run) {
|
|
144
|
+
return line.text.indexOf(run) >= 0;
|
|
145
|
+
});
|
|
187
146
|
});
|
|
188
|
-
var
|
|
189
|
-
|
|
190
|
-
item: item
|
|
147
|
+
var errors = lines.filter(function(line) {
|
|
148
|
+
return line.type === _types.LineType.stderr && runs.indexOf(line) < 0;
|
|
191
149
|
});
|
|
150
|
+
var output = lines.length ? lines[lines.length - 1] : undefined;
|
|
192
151
|
return /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
193
152
|
flexDirection: "column"
|
|
194
|
-
}, /*#__PURE__*/ _react.default.createElement(
|
|
153
|
+
}, /*#__PURE__*/ _react.default.createElement(Header, {
|
|
195
154
|
item: item
|
|
155
|
+
}), runs.length > 0 && /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
156
|
+
lines: runs
|
|
157
|
+
}), state === 'running' && output && runs.indexOf(output) < 0 && /*#__PURE__*/ _react.default.createElement(Output, {
|
|
158
|
+
output: output
|
|
159
|
+
}), errors.length > 0 && /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
160
|
+
lines: errors
|
|
196
161
|
}));
|
|
197
162
|
}
|
|
198
163
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store';\nimport { Box, Text } from '../ink.mjs';\nimport figures from '../lib/figures';\nimport Spinner from './Spinner';\n\nimport type { AppState } from '../types';\nimport { LineType } from '../types';\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\
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store';\nimport { Box, Text } from '../ink.mjs';\nimport figures from '../lib/figures';\nimport Spinner from './Spinner';\n\nimport type { AppState } from '../types';\nimport { LineType } from '../types';\n\n// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2\nconst spinner = {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n};\n\nconst RUNS = [figures.cross, figures.tick].concat(spinner.frames);\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 ChildProcessProps = {\n id: string;\n};\n\nfunction Header({ item }) {\n const { group, title, state } = item;\n const icon = ICONS[state];\n\n return (\n <Box>\n <Box marginRight={1}>\n <Text>{icon}</Text>\n </Box>\n {group && <Text>{`${group}${figures.pointer} `}</Text>}\n <Text>{title}</Text>\n </Box>\n );\n}\n\nfunction Output({ output }) {\n return (\n <Box marginLeft={2}>\n <Text color=\"gray\">{`${figures.arrowRight} ${output.text}`}</Text>\n </Box>\n );\n}\n\nfunction Lines({ lines }) {\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n {lines.map((line, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>\n <Box key={index} flexDirection=\"column\" height={1}>\n <Text color={line.type === LineType.stderr ? 'red' : 'black'}>{line.text}</Text>\n </Box>\n ))}\n </Box>\n );\n}\n\nexport default function ChildProcess({ id }: ChildProcessProps) {\n const store = useContext(StoreContext);\n const appState = useStore(store) as AppState;\n const item = appState.processes.find((x) => x.id === id);\n const { state, lines, expanded } = item;\n\n if (expanded) {\n return (\n <Box flexDirection=\"column\">\n <Header item={item} />\n <Lines lines={lines} />\n </Box>\n );\n }\n const runs = lines.filter((line) => RUNS.some((run) => line.text.indexOf(run) >= 0));\n const errors = lines.filter((line) => line.type === LineType.stderr && runs.indexOf(line) < 0);\n const output = lines.length ? lines[lines.length - 1] : undefined;\n\n return (\n <Box flexDirection=\"column\">\n <Header item={item} />\n {runs.length > 0 && <Lines lines={runs} />}\n {state === 'running' && output && runs.indexOf(output) < 0 && <Output output={output} />}\n {errors.length > 0 && <Lines lines={errors} />}\n </Box>\n );\n}\n"],"names":["ChildProcess","spinner","interval","frames","RUNS","figures","cross","tick","concat","ICONS","error","Text","color","success","running","Spinner","Header","item","group","title","state","icon","Box","marginRight","pointer","Output","output","marginLeft","arrowRight","text","Lines","lines","flexDirection","map","line","index","key","height","type","LineType","stderr","id","store","useContext","StoreContext","appState","useStore","processes","find","x","expanded","runs","filter","some","run","indexOf","errors","length","undefined"],"mappings":";;;;+BAgEA;;;eAAwBA;;;6DAhEU;uBACT;4DACA;mBACC;8DACN;8DACA;qBAGK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzB,oHAAoH;AACpH,IAAMC,UAAU;IACdC,UAAU;IACVC,QAAQ;QAAC;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;KAAI;AAC5D;AAEA,IAAMC,OAAO;IAACC,gBAAO,CAACC,KAAK;IAAED,gBAAO,CAACE,IAAI;CAAC,CAACC,MAAM,CAACP,QAAQE,MAAM;AAEhE,IAAMM,QAAQ;IACZC,qBAAO,6BAACC,SAAI;QAACC,OAAM;OAAOP,gBAAO,CAACC,KAAK;IACvCO,uBAAS,6BAACF,SAAI;QAACC,OAAM;OAASP,gBAAO,CAACE,IAAI;IAC1CO,uBAAS,6BAACC,gBAAO,EAAKd;AACxB;AAMA,SAASe,OAAO,KAAQ;QAAR,AAAEC,OAAF,MAAEA;IAChB,IAAQC,QAAwBD,KAAxBC,OAAOC,QAAiBF,KAAjBE,OAAOC,QAAUH,KAAVG;IACtB,IAAMC,OAAOZ,KAAK,CAACW,MAAM;IAEzB,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AAC,SAAClB;eAAS9B,KAAKiD,IAAI,CAAC,SAACC;mBAAQpB,KAAKL,IAAI,CAAC0B,OAAO,CAACD,QAAQ;;;IACjF,IAAME,SAASzB,MAAMqB,MAAM,CAAC,SAAClB;eAASA,KAAKI,IAAI,KAAKC,eAAQ,CAACC,MAAM,IAAIW,KAAKI,OAAO,CAACrB,QAAQ;;IAC5F,IAAMR,SAASK,MAAM0B,MAAM,GAAG1B,KAAK,CAACA,MAAM0B,MAAM,GAAG,EAAE,GAAGC;IAExD,qBACE,6BAACpC,QAAG;QAACU,eAAc;qBACjB,6BAAChB;QAAOC,MAAMA;QACbkC,KAAKM,MAAM,GAAG,mBAAK,6BAAC3B;QAAMC,OAAOoB;QACjC/B,UAAU,aAAaM,UAAUyB,KAAKI,OAAO,CAAC7B,UAAU,mBAAK,6BAACD;QAAOC,QAAQA;QAC7E8B,OAAOC,MAAM,GAAG,mBAAK,6BAAC3B;QAAMC,OAAOyB;;AAG1C"}
|
|
@@ -6,30 +6,10 @@ import ChildProcess from './ChildProcess.mjs';
|
|
|
6
6
|
export default function App() {
|
|
7
7
|
const store = useContext(StoreContext);
|
|
8
8
|
const appState = useStore(store);
|
|
9
|
-
|
|
10
|
-
'running'
|
|
11
|
-
].indexOf(x.state) >= 0);
|
|
12
|
-
const done = appState.processes.filter((x)=>[
|
|
13
|
-
'error',
|
|
14
|
-
'success'
|
|
15
|
-
].indexOf(x.state) >= 0);
|
|
16
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Box, {
|
|
9
|
+
return /*#__PURE__*/ React.createElement(Box, {
|
|
17
10
|
flexDirection: "column"
|
|
18
|
-
},
|
|
11
|
+
}, appState.processes.map((item)=>/*#__PURE__*/ React.createElement(ChildProcess, {
|
|
19
12
|
key: item.id,
|
|
20
13
|
id: item.id
|
|
21
|
-
})))
|
|
22
|
-
flexDirection: "column",
|
|
23
|
-
borderStyle: "single",
|
|
24
|
-
borderColor: "black",
|
|
25
|
-
borderBottom: true,
|
|
26
|
-
borderTop: false,
|
|
27
|
-
borderLeft: false,
|
|
28
|
-
borderRight: false
|
|
29
|
-
}), /*#__PURE__*/ React.createElement(Box, {
|
|
30
|
-
flexDirection: "column"
|
|
31
|
-
}, done.map((item)=>/*#__PURE__*/ React.createElement(ChildProcess, {
|
|
32
|
-
key: item.id,
|
|
33
|
-
id: item.id
|
|
34
|
-
}))));
|
|
14
|
+
})));
|
|
35
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store';\nimport { Box } from '../ink.mjs';\nimport type { AppState, ChildProcess as ChildProcessT } from '../types';\nimport ChildProcess from './ChildProcess';\n\nexport default function App() {\n const store = useContext(StoreContext);\n const appState = useStore(store) as AppState;\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store';\nimport { Box } from '../ink.mjs';\nimport type { AppState, ChildProcess as ChildProcessT } from '../types';\nimport ChildProcess from './ChildProcess';\n\nexport default function App() {\n const store = useContext(StoreContext);\n const appState = useStore(store) as AppState;\n\n return (\n <Box flexDirection=\"column\">\n {appState.processes.map((item: ChildProcessT) => (\n <ChildProcess key={item.id} id={item.id} />\n ))}\n </Box>\n );\n}\n"],"names":["React","useContext","useStore","StoreContext","Box","ChildProcess","App","store","appState","flexDirection","processes","map","item","key","id"],"mappings":"AAAA,OAAOA,SAASC,UAAU,QAAQ,QAAQ;AAC1C,SAASC,QAAQ,QAAQ,UAAU;AACnC,OAAOC,kBAAkB,oBAAoB;AAC7C,SAASC,GAAG,QAAQ,aAAa;AAEjC,OAAOC,kBAAkB,iBAAiB;AAE1C,eAAe,SAASC;IACtB,MAAMC,QAAQN,WAAWE;IACzB,MAAMK,WAAWN,SAASK;IAE1B,qBACE,oBAACH;QAAIK,eAAc;OAChBD,SAASE,SAAS,CAACC,GAAG,CAAC,CAACC,qBACvB,oBAACP;YAAaQ,KAAKD,KAAKE,EAAE;YAAEA,IAAIF,KAAKE,EAAE;;AAI/C"}
|
|
@@ -21,6 +21,10 @@ const spinner = {
|
|
|
21
21
|
'⠏'
|
|
22
22
|
]
|
|
23
23
|
};
|
|
24
|
+
const RUNS = [
|
|
25
|
+
figures.cross,
|
|
26
|
+
figures.tick
|
|
27
|
+
].concat(spinner.frames);
|
|
24
28
|
const ICONS = {
|
|
25
29
|
error: /*#__PURE__*/ React.createElement(Text, {
|
|
26
30
|
color: "red"
|
|
@@ -30,18 +34,12 @@ const ICONS = {
|
|
|
30
34
|
}, figures.tick),
|
|
31
35
|
running: /*#__PURE__*/ React.createElement(Spinner, spinner)
|
|
32
36
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, figures.pointer),
|
|
37
|
-
default: /*#__PURE__*/ React.createElement(Text, {
|
|
38
|
-
color: "yellow"
|
|
39
|
-
}, figures.pointer)
|
|
40
|
-
};
|
|
41
|
-
function Header({ icon, title }) {
|
|
37
|
+
function Header({ item }) {
|
|
38
|
+
const { group, title, state } = item;
|
|
39
|
+
const icon = ICONS[state];
|
|
42
40
|
return /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Box, {
|
|
43
41
|
marginRight: 1
|
|
44
|
-
}, /*#__PURE__*/ React.createElement(Text, null, icon)), /*#__PURE__*/ React.createElement(Text, null, title));
|
|
42
|
+
}, /*#__PURE__*/ React.createElement(Text, null, icon)), group && /*#__PURE__*/ React.createElement(Text, null, `${group}${figures.pointer} `), /*#__PURE__*/ React.createElement(Text, null, title));
|
|
45
43
|
}
|
|
46
44
|
function Output({ output }) {
|
|
47
45
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
@@ -63,65 +61,32 @@ function Lines({ lines }) {
|
|
|
63
61
|
color: line.type === LineType.stderr ? 'red' : 'black'
|
|
64
62
|
}, line.text))));
|
|
65
63
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
64
|
+
export default function ChildProcess({ id }) {
|
|
65
|
+
const store = useContext(StoreContext);
|
|
66
|
+
const appState = useStore(store);
|
|
67
|
+
const item = appState.processes.find((x)=>x.id === id);
|
|
68
|
+
const { state, lines, expanded } = item;
|
|
71
69
|
if (expanded) {
|
|
72
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Header, {
|
|
73
|
-
icon: icon,
|
|
74
|
-
title: title
|
|
75
|
-
}), /*#__PURE__*/ React.createElement(Lines, {
|
|
76
|
-
lines: lines
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Header, {
|
|
80
|
-
icon: icon,
|
|
81
|
-
title: title
|
|
82
|
-
}), state === 'running' && output && /*#__PURE__*/ React.createElement(Output, {
|
|
83
|
-
output: output
|
|
84
|
-
}), errors.length > 0 && /*#__PURE__*/ React.createElement(Lines, {
|
|
85
|
-
lines: errors
|
|
86
|
-
}));
|
|
87
|
-
}
|
|
88
|
-
function Group({ item }) {
|
|
89
|
-
const { title, state, lines, group, expanded } = item;
|
|
90
|
-
const icon = ICONS[state];
|
|
91
|
-
const pointer = POINTERS[state] || POINTERS.default;
|
|
92
|
-
const errors = lines.filter((line)=>line.type === LineType.stderr);
|
|
93
|
-
if (state === 'running') {
|
|
94
70
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
95
71
|
flexDirection: "column"
|
|
96
72
|
}, /*#__PURE__*/ React.createElement(Header, {
|
|
97
|
-
icon: pointer,
|
|
98
|
-
title: group
|
|
99
|
-
}), /*#__PURE__*/ React.createElement(Content, {
|
|
100
73
|
item: item
|
|
74
|
+
}), /*#__PURE__*/ React.createElement(Lines, {
|
|
75
|
+
lines: lines
|
|
101
76
|
}));
|
|
102
77
|
}
|
|
78
|
+
const runs = lines.filter((line)=>RUNS.some((run)=>line.text.indexOf(run) >= 0));
|
|
79
|
+
const errors = lines.filter((line)=>line.type === LineType.stderr && runs.indexOf(line) < 0);
|
|
80
|
+
const output = lines.length ? lines[lines.length - 1] : undefined;
|
|
103
81
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
104
82
|
flexDirection: "column"
|
|
105
83
|
}, /*#__PURE__*/ React.createElement(Header, {
|
|
106
|
-
icon: icon,
|
|
107
|
-
title: `${group}: ${title}`
|
|
108
|
-
}), expanded && /*#__PURE__*/ React.createElement(Lines, {
|
|
109
|
-
lines: lines
|
|
110
|
-
}), !expanded && errors.length > 0 && /*#__PURE__*/ React.createElement(Lines, {
|
|
111
|
-
lines: errors
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
export default function ChildProcess({ id }) {
|
|
115
|
-
const store = useContext(StoreContext);
|
|
116
|
-
const appState = useStore(store);
|
|
117
|
-
const item = appState.processes.find((x)=>x.id === id);
|
|
118
|
-
const { group } = item;
|
|
119
|
-
if (group) return /*#__PURE__*/ React.createElement(Group, {
|
|
120
|
-
item: item
|
|
121
|
-
});
|
|
122
|
-
return /*#__PURE__*/ React.createElement(Box, {
|
|
123
|
-
flexDirection: "column"
|
|
124
|
-
}, /*#__PURE__*/ React.createElement(Content, {
|
|
125
84
|
item: item
|
|
85
|
+
}), runs.length > 0 && /*#__PURE__*/ React.createElement(Lines, {
|
|
86
|
+
lines: runs
|
|
87
|
+
}), state === 'running' && output && runs.indexOf(output) < 0 && /*#__PURE__*/ React.createElement(Output, {
|
|
88
|
+
output: output
|
|
89
|
+
}), errors.length > 0 && /*#__PURE__*/ React.createElement(Lines, {
|
|
90
|
+
lines: errors
|
|
126
91
|
}));
|
|
127
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store';\nimport { Box, Text } from '../ink.mjs';\nimport figures from '../lib/figures';\nimport Spinner from './Spinner';\n\nimport type { AppState } from '../types';\nimport { LineType } from '../types';\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\
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store';\nimport { Box, Text } from '../ink.mjs';\nimport figures from '../lib/figures';\nimport Spinner from './Spinner';\n\nimport type { AppState } from '../types';\nimport { LineType } from '../types';\n\n// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2\nconst spinner = {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n};\n\nconst RUNS = [figures.cross, figures.tick].concat(spinner.frames);\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 ChildProcessProps = {\n id: string;\n};\n\nfunction Header({ item }) {\n const { group, title, state } = item;\n const icon = ICONS[state];\n\n return (\n <Box>\n <Box marginRight={1}>\n <Text>{icon}</Text>\n </Box>\n {group && <Text>{`${group}${figures.pointer} `}</Text>}\n <Text>{title}</Text>\n </Box>\n );\n}\n\nfunction Output({ output }) {\n return (\n <Box marginLeft={2}>\n <Text color=\"gray\">{`${figures.arrowRight} ${output.text}`}</Text>\n </Box>\n );\n}\n\nfunction Lines({ lines }) {\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n {lines.map((line, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>\n <Box key={index} flexDirection=\"column\" height={1}>\n <Text color={line.type === LineType.stderr ? 'red' : 'black'}>{line.text}</Text>\n </Box>\n ))}\n </Box>\n );\n}\n\nexport default function ChildProcess({ id }: ChildProcessProps) {\n const store = useContext(StoreContext);\n const appState = useStore(store) as AppState;\n const item = appState.processes.find((x) => x.id === id);\n const { state, lines, expanded } = item;\n\n if (expanded) {\n return (\n <Box flexDirection=\"column\">\n <Header item={item} />\n <Lines lines={lines} />\n </Box>\n );\n }\n const runs = lines.filter((line) => RUNS.some((run) => line.text.indexOf(run) >= 0));\n const errors = lines.filter((line) => line.type === LineType.stderr && runs.indexOf(line) < 0);\n const output = lines.length ? lines[lines.length - 1] : undefined;\n\n return (\n <Box flexDirection=\"column\">\n <Header item={item} />\n {runs.length > 0 && <Lines lines={runs} />}\n {state === 'running' && output && runs.indexOf(output) < 0 && <Output output={output} />}\n {errors.length > 0 && <Lines lines={errors} />}\n </Box>\n );\n}\n"],"names":["React","useContext","useStore","StoreContext","Box","Text","figures","Spinner","LineType","spinner","interval","frames","RUNS","cross","tick","concat","ICONS","error","color","success","running","Header","item","group","title","state","icon","marginRight","pointer","Output","output","marginLeft","arrowRight","text","Lines","lines","flexDirection","map","line","index","key","height","type","stderr","ChildProcess","id","store","appState","processes","find","x","expanded","runs","filter","some","run","indexOf","errors","length","undefined"],"mappings":"AAAA,OAAOA,SAASC,UAAU,QAAQ,QAAQ;AAC1C,SAASC,QAAQ,QAAQ,UAAU;AACnC,OAAOC,kBAAkB,oBAAoB;AAC7C,SAASC,GAAG,EAAEC,IAAI,QAAQ,aAAa;AACvC,OAAOC,aAAa,iBAAiB;AAC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