spawn-term 0.2.3 → 0.2.5
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.d.cts +1 -1
- package/dist/cjs/components/App.d.ts +1 -1
- package/dist/cjs/components/App.js +10 -50
- package/dist/cjs/components/App.js.map +1 -1
- package/dist/cjs/components/ChildProcess.js +92 -79
- package/dist/cjs/components/ChildProcess.js.map +1 -1
- package/dist/cjs/components/Spinner.d.cts +1 -1
- package/dist/cjs/components/Spinner.d.ts +1 -1
- package/dist/cjs/components/Spinner.js +5 -43
- package/dist/cjs/components/Spinner.js.map +1 -1
- package/dist/cjs/createApp.js +5 -4
- package/dist/cjs/createApp.js.map +1 -1
- package/dist/cjs/types.d.cts +1 -1
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/components/App.d.ts +1 -1
- package/dist/esm/components/App.js +8 -7
- package/dist/esm/components/App.js.map +1 -1
- package/dist/esm/components/ChildProcess.js +95 -41
- package/dist/esm/components/ChildProcess.js.map +1 -1
- package/dist/esm/components/Spinner.d.ts +1 -1
- package/dist/esm/components/Spinner.js +5 -2
- package/dist/esm/components/Spinner.js.map +1 -1
- package/dist/esm/createApp.js +5 -4
- package/dist/esm/createApp.js.map +1 -1
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function App():
|
|
1
|
+
export default function App(): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function App():
|
|
1
|
+
export default function App(): import("react").JSX.Element;
|
|
@@ -8,7 +8,8 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return App;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _react = require("react");
|
|
12
13
|
var _zustand = require("zustand");
|
|
13
14
|
var _Store = /*#__PURE__*/ _interop_require_default(require("../contexts/Store.js"));
|
|
14
15
|
var _ink = require("../ink.js");
|
|
@@ -18,57 +19,16 @@ function _interop_require_default(obj) {
|
|
|
18
19
|
default: obj
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
22
|
-
if (typeof WeakMap !== "function") return null;
|
|
23
|
-
var cacheBabelInterop = new WeakMap();
|
|
24
|
-
var cacheNodeInterop = new WeakMap();
|
|
25
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
26
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
27
|
-
})(nodeInterop);
|
|
28
|
-
}
|
|
29
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
30
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
34
|
-
return {
|
|
35
|
-
default: obj
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
39
|
-
if (cache && cache.has(obj)) {
|
|
40
|
-
return cache.get(obj);
|
|
41
|
-
}
|
|
42
|
-
var newObj = {
|
|
43
|
-
__proto__: null
|
|
44
|
-
};
|
|
45
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
46
|
-
for(var key in obj){
|
|
47
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
48
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
49
|
-
if (desc && (desc.get || desc.set)) {
|
|
50
|
-
Object.defineProperty(newObj, key, desc);
|
|
51
|
-
} else {
|
|
52
|
-
newObj[key] = obj[key];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
newObj.default = obj;
|
|
57
|
-
if (cache) {
|
|
58
|
-
cache.set(obj, newObj);
|
|
59
|
-
}
|
|
60
|
-
return newObj;
|
|
61
|
-
}
|
|
62
22
|
function App() {
|
|
63
23
|
var store = (0, _react.useContext)(_Store.default);
|
|
64
24
|
var appState = (0, _zustand.useStore)(store);
|
|
65
|
-
return /*#__PURE__*/
|
|
66
|
-
flexDirection: "column"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
72
|
-
})
|
|
25
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ink.Box, {
|
|
26
|
+
flexDirection: "column",
|
|
27
|
+
children: appState.processes.map(function(item) {
|
|
28
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChildProcess.default, {
|
|
29
|
+
item: item
|
|
30
|
+
}, item.id);
|
|
31
|
+
})
|
|
32
|
+
});
|
|
73
33
|
}
|
|
74
34
|
/* 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
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store.js';\nimport { Box } from '../ink.js';\nimport type { AppState, ChildProcess as ChildProcessT } from '../types.js';\nimport ChildProcess from './ChildProcess.js';\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} item={item} />\n ))}\n </Box>\n );\n}\n"],"names":["App","store","useContext","StoreContext","appState","useStore","Box","flexDirection","processes","map","item","ChildProcess","id"],"mappings":";;;;+BAOA;;;eAAwBA;;;;qBAPG;uBACF;4DACA;mBACL;mEAEK;;;;;;AAEV,SAASA;IACtB,IAAMC,QAAQC,IAAAA,iBAAU,EAACC,cAAY;IACrC,IAAMC,WAAWC,IAAAA,iBAAQ,EAACJ;IAE1B,qBACE,qBAACK,QAAG;QAACC,eAAc;kBAChBH,SAASI,SAAS,CAACC,GAAG,CAAC,SAACC;iCACvB,qBAACC,qBAAY;gBAAeD,MAAMA;eAAfA,KAAKE,EAAE;;;AAIlC"}
|
|
@@ -8,58 +8,46 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
11
12
|
var _ansicolors = /*#__PURE__*/ _interop_require_default(require("ansi-colors"));
|
|
12
|
-
var _react =
|
|
13
|
+
var _react = require("react");
|
|
13
14
|
var _ink = require("../ink.js");
|
|
14
15
|
var _ansiRegex = /*#__PURE__*/ _interop_require_default(require("../lib/ansiRegex.js"));
|
|
15
16
|
var _figures = /*#__PURE__*/ _interop_require_default(require("../lib/figures.js"));
|
|
16
17
|
var _Spinner = /*#__PURE__*/ _interop_require_default(require("./Spinner.js"));
|
|
17
18
|
var _types = require("../types.js");
|
|
19
|
+
function _define_property(obj, key, value) {
|
|
20
|
+
if (key in obj) {
|
|
21
|
+
Object.defineProperty(obj, key, {
|
|
22
|
+
value: value,
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
obj[key] = value;
|
|
29
|
+
}
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
18
32
|
function _interop_require_default(obj) {
|
|
19
33
|
return obj && obj.__esModule ? obj : {
|
|
20
34
|
default: obj
|
|
21
35
|
};
|
|
22
36
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
32
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
33
|
-
return obj;
|
|
34
|
-
}
|
|
35
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
36
|
-
return {
|
|
37
|
-
default: obj
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
41
|
-
if (cache && cache.has(obj)) {
|
|
42
|
-
return cache.get(obj);
|
|
43
|
-
}
|
|
44
|
-
var newObj = {
|
|
45
|
-
__proto__: null
|
|
46
|
-
};
|
|
47
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
48
|
-
for(var key in obj){
|
|
49
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
50
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
51
|
-
if (desc && (desc.get || desc.set)) {
|
|
52
|
-
Object.defineProperty(newObj, key, desc);
|
|
53
|
-
} else {
|
|
54
|
-
newObj[key] = obj[key];
|
|
55
|
-
}
|
|
37
|
+
function _object_spread(target) {
|
|
38
|
+
for(var i = 1; i < arguments.length; i++){
|
|
39
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
40
|
+
var ownKeys = Object.keys(source);
|
|
41
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
42
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
43
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
44
|
+
}));
|
|
56
45
|
}
|
|
46
|
+
ownKeys.forEach(function(key) {
|
|
47
|
+
_define_property(target, key, source[key]);
|
|
48
|
+
});
|
|
57
49
|
}
|
|
58
|
-
|
|
59
|
-
if (cache) {
|
|
60
|
-
cache.set(obj, newObj);
|
|
61
|
-
}
|
|
62
|
-
return newObj;
|
|
50
|
+
return target;
|
|
63
51
|
}
|
|
64
52
|
var REGEX_ANSI = (0, _ansiRegex.default)();
|
|
65
53
|
var BLANK_LINE = {
|
|
@@ -84,56 +72,76 @@ var SPINNER = {
|
|
|
84
72
|
};
|
|
85
73
|
var ICONS = {
|
|
86
74
|
// @ts-ignore
|
|
87
|
-
error: /*#__PURE__*/
|
|
75
|
+
error: /*#__PURE__*/ (0, _jsxruntime.jsx)("ink-text", {
|
|
76
|
+
children: _ansicolors.default.red(_figures.default.cross)
|
|
77
|
+
}),
|
|
88
78
|
// @ts-ignore
|
|
89
|
-
success: /*#__PURE__*/
|
|
90
|
-
|
|
79
|
+
success: /*#__PURE__*/ (0, _jsxruntime.jsx)("ink-text", {
|
|
80
|
+
children: _ansicolors.default.green(_figures.default.tick)
|
|
81
|
+
}),
|
|
82
|
+
running: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Spinner.default, _object_spread({}, SPINNER))
|
|
91
83
|
};
|
|
92
84
|
var Header = /*#__PURE__*/ (0, _react.memo)(function Header(param) {
|
|
93
85
|
var group = param.group, title = param.title, state = param.state;
|
|
94
86
|
var icon = ICONS[state];
|
|
95
|
-
return /*#__PURE__*/
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_ink.Box, {
|
|
88
|
+
children: [
|
|
89
|
+
icon,
|
|
90
|
+
group && /*#__PURE__*/ (0, _jsxruntime.jsx)(_ink.Text, {
|
|
91
|
+
bold: true,
|
|
92
|
+
children: "".concat(group).concat(_figures.default.pointer, " ")
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_ink.Text, {
|
|
95
|
+
children: title
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
});
|
|
98
99
|
}, function(a, b) {
|
|
99
100
|
return a.group === b.group && a.title === b.title && a.state === b.state;
|
|
100
101
|
});
|
|
101
102
|
var RunningSummary = /*#__PURE__*/ (0, _react.memo)(function RunningSummary(param) {
|
|
102
103
|
var line = param.line;
|
|
103
|
-
return /*#__PURE__*/
|
|
104
|
-
marginLeft: 2
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ink.Box, {
|
|
105
|
+
marginLeft: 2,
|
|
106
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ink.Text, {
|
|
107
|
+
color: "gray",
|
|
108
|
+
children: line.text.replace(REGEX_ANSI, '')
|
|
109
|
+
})
|
|
110
|
+
});
|
|
108
111
|
});
|
|
109
112
|
var renderLine = function(line, index) {
|
|
110
113
|
return(// @ts-ignore
|
|
111
|
-
/*#__PURE__*/
|
|
112
|
-
key: index,
|
|
114
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("ink-text", {
|
|
113
115
|
style: {
|
|
114
116
|
minHeight: 1
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
+
},
|
|
118
|
+
children: line.text
|
|
119
|
+
}, index));
|
|
117
120
|
};
|
|
118
121
|
var Lines = /*#__PURE__*/ (0, _react.memo)(function Lines(param) {
|
|
119
122
|
var lines = param.lines;
|
|
120
|
-
return /*#__PURE__*/
|
|
123
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ink.Box, {
|
|
121
124
|
flexDirection: "column",
|
|
122
|
-
marginLeft: 2
|
|
123
|
-
|
|
125
|
+
marginLeft: 2,
|
|
126
|
+
children: lines.map(renderLine)
|
|
127
|
+
});
|
|
124
128
|
});
|
|
125
129
|
var Expanded = /*#__PURE__*/ (0, _react.memo)(function Expanded(param) {
|
|
126
130
|
var item = param.item;
|
|
127
131
|
var lines = item.lines;
|
|
128
|
-
return /*#__PURE__*/
|
|
129
|
-
flexDirection: "column"
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_ink.Box, {
|
|
133
|
+
flexDirection: "column",
|
|
134
|
+
children: [
|
|
135
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(Header, {
|
|
136
|
+
group: item.group,
|
|
137
|
+
title: item.title,
|
|
138
|
+
state: item.state
|
|
139
|
+
}),
|
|
140
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(Lines, {
|
|
141
|
+
lines: lines
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
});
|
|
137
145
|
});
|
|
138
146
|
var Contracted = /*#__PURE__*/ (0, _react.memo)(function Contracted(param) {
|
|
139
147
|
var item = param.item;
|
|
@@ -154,24 +162,29 @@ var Contracted = /*#__PURE__*/ (0, _react.memo)(function Contracted(param) {
|
|
|
154
162
|
lines,
|
|
155
163
|
errors
|
|
156
164
|
]);
|
|
157
|
-
return /*#__PURE__*/
|
|
158
|
-
flexDirection: "column"
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_ink.Box, {
|
|
166
|
+
flexDirection: "column",
|
|
167
|
+
children: [
|
|
168
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(Header, {
|
|
169
|
+
group: item.group,
|
|
170
|
+
title: item.title,
|
|
171
|
+
state: item.state
|
|
172
|
+
}),
|
|
173
|
+
state === 'running' && /*#__PURE__*/ (0, _jsxruntime.jsx)(RunningSummary, {
|
|
174
|
+
line: summary || BLANK_LINE
|
|
175
|
+
}),
|
|
176
|
+
errors.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(Lines, {
|
|
177
|
+
lines: errors
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
});
|
|
168
181
|
});
|
|
169
182
|
var _default = /*#__PURE__*/ (0, _react.memo)(function ChildProcess(param) {
|
|
170
183
|
var item = param.item;
|
|
171
184
|
var expanded = item.expanded;
|
|
172
|
-
return expanded ? /*#__PURE__*/
|
|
185
|
+
return expanded ? /*#__PURE__*/ (0, _jsxruntime.jsx)(Expanded, {
|
|
173
186
|
item: item
|
|
174
|
-
}) : /*#__PURE__*/
|
|
187
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(Contracted, {
|
|
175
188
|
item: item
|
|
176
189
|
});
|
|
177
190
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import c from 'ansi-colors';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import c from 'ansi-colors';\nimport { memo, useMemo } from 'react';\nimport { Box, Text } from '../ink.js';\nimport ansiRegex from '../lib/ansiRegex.js';\nimport figures from '../lib/figures.js';\nimport Spinner from './Spinner.js';\n\nimport type { ChildProcess as ChildProcessT, Line, State } from '../types.js';\nimport { LineType } from '../types.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 // @ts-ignore\n error: <ink-text>{c.red(figures.cross)}</ink-text>,\n // @ts-ignore\n success: <ink-text>{c.green(figures.tick)}</ink-text>,\n running: <Spinner {...SPINNER} />,\n};\n\ntype ItemProps = {\n item: ChildProcessT;\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 // @ts-ignore\n <ink-text key={index} style={{ minHeight: 1 }}>\n {line.text}\n {/* @ts-ignore */}\n </ink-text>\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 }: ItemProps) {\n const { lines } = item;\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n <Lines lines={lines} />\n </Box>\n );\n});\n\nconst Contracted = memo(function Contracted({ item }: ItemProps) {\n const { state, lines } = item;\n\n // remove ansi codes when displaying single lines\n const errors = useMemo(() => lines.filter((line) => line.type === LineType.stderr), [lines]);\n const summary = useMemo(() => lines.filter((line) => line.text.length > 0 && errors.indexOf(line) < 0).pop(), [lines, errors]);\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n {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 }: ItemProps) {\n const { expanded } = item;\n return expanded ? <Expanded item={item} /> : <Contracted item={item} />;\n});\n"],"names":["REGEX_ANSI","ansiRegex","BLANK_LINE","type","LineType","stdout","text","SPINNER","interval","frames","ICONS","error","ink-text","c","red","figures","cross","success","green","tick","running","Spinner","Header","memo","group","title","state","icon","Box","Text","bold","pointer","a","b","RunningSummary","line","marginLeft","color","replace","renderLine","index","style","minHeight","Lines","lines","flexDirection","map","Expanded","item","Contracted","errors","useMemo","filter","stderr","summary","length","indexOf","pop","ChildProcess","expanded"],"mappings":"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"}
|
|
@@ -8,7 +8,8 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return Spinner;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _react = require("react");
|
|
12
13
|
var _ink = require("../ink.js");
|
|
13
14
|
function _array_like_to_array(arr, len) {
|
|
14
15
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -18,47 +19,6 @@ function _array_like_to_array(arr, len) {
|
|
|
18
19
|
function _array_with_holes(arr) {
|
|
19
20
|
if (Array.isArray(arr)) return arr;
|
|
20
21
|
}
|
|
21
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
22
|
-
if (typeof WeakMap !== "function") return null;
|
|
23
|
-
var cacheBabelInterop = new WeakMap();
|
|
24
|
-
var cacheNodeInterop = new WeakMap();
|
|
25
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
26
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
27
|
-
})(nodeInterop);
|
|
28
|
-
}
|
|
29
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
30
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
34
|
-
return {
|
|
35
|
-
default: obj
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
39
|
-
if (cache && cache.has(obj)) {
|
|
40
|
-
return cache.get(obj);
|
|
41
|
-
}
|
|
42
|
-
var newObj = {
|
|
43
|
-
__proto__: null
|
|
44
|
-
};
|
|
45
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
46
|
-
for(var key in obj){
|
|
47
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
48
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
49
|
-
if (desc && (desc.get || desc.set)) {
|
|
50
|
-
Object.defineProperty(newObj, key, desc);
|
|
51
|
-
} else {
|
|
52
|
-
newObj[key] = obj[key];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
newObj.default = obj;
|
|
57
|
-
if (cache) {
|
|
58
|
-
cache.set(obj, newObj);
|
|
59
|
-
}
|
|
60
|
-
return newObj;
|
|
61
|
-
}
|
|
62
22
|
function _iterable_to_array_limit(arr, i) {
|
|
63
23
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
64
24
|
if (_i == null) return;
|
|
@@ -113,6 +73,8 @@ function Spinner(param) {
|
|
|
113
73
|
interval,
|
|
114
74
|
frames
|
|
115
75
|
]);
|
|
116
|
-
return /*#__PURE__*/
|
|
76
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ink.Text, {
|
|
77
|
+
children: "".concat(frames[index], " ")
|
|
78
|
+
});
|
|
117
79
|
}
|
|
118
80
|
/* 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/Spinner.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/Spinner.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { Text } from '../ink.js';\n\nexport type SpinnerProps = {\n interval: number;\n frames: string[];\n};\n\nexport default function Spinner({ interval, frames }: SpinnerProps) {\n const [index, setIndex] = useState(0);\n\n useEffect(() => {\n const timer = setInterval(() => {\n setIndex((index) => (index === frames.length - 1 ? 0 : index + 1));\n }, interval);\n return () => {\n clearInterval(timer);\n };\n }, [interval, frames]);\n\n return <Text>{`${frames[index]} `}</Text>;\n}\n"],"names":["Spinner","interval","frames","useState","index","setIndex","useEffect","timer","setInterval","length","clearInterval","Text"],"mappings":";;;;+BAQA;;;eAAwBA;;;;qBARY;mBACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAON,SAASA,QAAQ,KAAkC;QAAhCC,WAAF,MAAEA,UAAUC,SAAZ,MAAYA;IAC1C,IAA0BC,6BAAAA,IAAAA,eAAQ,EAAC,QAA5BC,QAAmBD,cAAZE,WAAYF;IAE1BG,IAAAA,gBAAS,EAAC;QACR,IAAMC,QAAQC,YAAY;YACxBH,SAAS,SAACD;uBAAWA,UAAUF,OAAOO,MAAM,GAAG,IAAI,IAAIL,QAAQ;;QACjE,GAAGH;QACH,OAAO;YACLS,cAAcH;QAChB;IACF,GAAG;QAACN;QAAUC;KAAO;IAErB,qBAAO,qBAACS,SAAI;kBAAE,AAAC,GAAgB,OAAdT,MAAM,CAACE,MAAM,EAAC;;AACjC"}
|
package/dist/cjs/createApp.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return createApp;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
12
|
var _zustand = require("zustand");
|
|
13
13
|
var _App = /*#__PURE__*/ _interop_require_default(require("./components/App.js"));
|
|
14
14
|
var _Store = /*#__PURE__*/ _interop_require_default(require("./contexts/Store.js"));
|
|
@@ -75,9 +75,10 @@ function createApp() {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
|
-
inkApp = (0, _ink.render)(/*#__PURE__*/
|
|
79
|
-
value: store
|
|
80
|
-
|
|
78
|
+
inkApp = (0, _ink.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_Store.default.Provider, {
|
|
79
|
+
value: store,
|
|
80
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_App.default, {})
|
|
81
|
+
}), {
|
|
81
82
|
patchConsole: false
|
|
82
83
|
});
|
|
83
84
|
return fn(store);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createApp.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createApp.tsx"],"sourcesContent":["import { createStore } from 'zustand';\nimport App from './components/App.js';\nimport StoreContext from './contexts/Store.js';\n\n// @ts-ignore\nimport { type Instance, initialize, render } from './ink.js';\nimport type { AppState } from './types.js';\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) {\n initialize(() => {\n if (++refCount > 1) return fn(store);\n if (store) throw new Error('Not expecting store');\n store = createStore<AppState>()((set) => ({\n processes: [],\n addProcess: (process) => set((state) => ({ processes: [...state.processes, process] })),\n updateProcess: (process) => set((state) => ({ processes: state.processes.map((x) => (x.id === process.id ? process : x)) })),\n }));\n inkApp = render(\n <StoreContext.Provider value={store}>\n <App />\n </StoreContext.Provider>,\n { patchConsole: false }\n );\n return fn(store);\n });\n },\n release() {\n if (--refCount > 0) return;\n if (!store) throw new Error('Expecting store');\n store = null;\n inkApp.unmount();\n inkApp = null;\n process.stdout.write('\\x1b[?25h'); // show cursor\n },\n };\n}\n"],"names":["createApp","refCount","store","inkApp","retain","fn","initialize","Error","createStore","set","processes","addProcess","process","state","updateProcess","map","x","id","render","StoreContext","Provider","value","App","patchConsole","release","unmount","stdout","write"],"mappings":";;;;+BAQA;;;eAAwBA;;;;uBARI;0DACZ;4DACS;mBAGyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGnC,SAASA;IACtB,IAAIC,WAAW;IACf,IAAIC,QAAQ;IACZ,IAAIC,SAA0B;IAE9B,OAAO;QACLC,QAAAA,SAAAA,OAAOC,EAAE;YACPC,IAAAA,eAAU,EAAC;gBACT,IAAI,EAAEL,WAAW,GAAG,OAAOI,GAAGH;gBAC9B,IAAIA,OAAO,MAAM,IAAIK,MAAM;gBAC3BL,QAAQM,IAAAA,oBAAW,IAAa,SAACC;2BAAS;wBACxCC,WAAW,EAAE;wBACbC,YAAY,SAACC;mCAAYH,IAAI,SAACI;uCAAW;oCAAEH,WAAW,AAAC,qBAAGG,MAAMH,SAAS,SAAnB;wCAAqBE;qCAAQ;gCAAC;;;wBACpFE,eAAe,SAACF;mCAAYH,IAAI,SAACI;uCAAW;oCAAEH,WAAWG,MAAMH,SAAS,CAACK,GAAG,CAAC,SAACC;+CAAOA,EAAEC,EAAE,KAAKL,SAAQK,EAAE,GAAGL,WAAUI;;gCAAI;;;oBAC3H;;gBACAb,SAASe,IAAAA,WAAM,gBACb,qBAACC,cAAY,CAACC,QAAQ;oBAACC,OAAOnB;8BAC5B,cAAA,qBAACoB,YAAG;oBAEN;oBAAEC,cAAc;gBAAM;gBAExB,OAAOlB,GAAGH;YACZ;QACF;QACAsB,SAAAA,SAAAA;YACE,IAAI,EAAEvB,WAAW,GAAG;YACpB,IAAI,CAACC,OAAO,MAAM,IAAIK,MAAM;YAC5BL,QAAQ;YACRC,OAAOsB,OAAO;YACdtB,SAAS;YACTS,QAAQc,MAAM,CAACC,KAAK,CAAC,cAAc,cAAc;QACnD;IACF;AACF"}
|
package/dist/cjs/types.d.cts
CHANGED
package/dist/cjs/types.d.ts
CHANGED
package/dist/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["// @ts-ignore\nexport type { SpawnOptions, SpawnCallback, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?:
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["// @ts-ignore\nexport type { SpawnOptions, SpawnCallback, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: boolean;\n};\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?: string;\n};\n\nexport interface AppState {\n processes: ChildProcess[];\n addProcess: (process: ChildProcess) => void;\n updateProcess: (process: ChildProcess) => void;\n}\n"],"names":["LineType","stdout","stderr"],"mappings":"AAAA,aAAa;;;;;+BAQAA;;;eAAAA;;;AAAN,IAAMA,WAAW;IACtBC,QAAQ;IACRC,QAAQ;AACV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function App():
|
|
1
|
+
export default function App(): import("react").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
2
3
|
import { useStore } from 'zustand';
|
|
3
4
|
import StoreContext from '../contexts/Store.js';
|
|
4
5
|
import { Box } from '../ink.js';
|
|
@@ -6,10 +7,10 @@ import ChildProcess from './ChildProcess.js';
|
|
|
6
7
|
export default function App() {
|
|
7
8
|
const store = useContext(StoreContext);
|
|
8
9
|
const appState = useStore(store);
|
|
9
|
-
return /*#__PURE__*/
|
|
10
|
-
flexDirection: "column"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
return /*#__PURE__*/ _jsx(Box, {
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
children: appState.processes.map((item)=>/*#__PURE__*/ _jsx(ChildProcess, {
|
|
13
|
+
item: item
|
|
14
|
+
}, item.id))
|
|
15
|
+
});
|
|
15
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { useStore } from 'zustand';\nimport StoreContext from '../contexts/Store.js';\nimport { Box } from '../ink.js';\nimport type { AppState, ChildProcess as ChildProcessT } from '../types.js';\nimport ChildProcess from './ChildProcess.js';\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} item={item} />\n ))}\n </Box>\n );\n}\n"],"names":["useContext","useStore","StoreContext","Box","ChildProcess","App","store","appState","flexDirection","processes","map","item","id"],"mappings":";AAAA,SAASA,UAAU,QAAQ,QAAQ;AACnC,SAASC,QAAQ,QAAQ,UAAU;AACnC,OAAOC,kBAAkB,uBAAuB;AAChD,SAASC,GAAG,QAAQ,YAAY;AAEhC,OAAOC,kBAAkB,oBAAoB;AAE7C,eAAe,SAASC;IACtB,MAAMC,QAAQN,WAAWE;IACzB,MAAMK,WAAWN,SAASK;IAE1B,qBACE,KAACH;QAAIK,eAAc;kBAChBD,SAASE,SAAS,CAACC,GAAG,CAAC,CAACC,qBACvB,KAACP;gBAA2BO,MAAMA;eAAfA,KAAKC,EAAE;;AAIlC"}
|
|
@@ -1,5 +1,34 @@
|
|
|
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
|
+
}
|
|
29
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
30
|
import c from 'ansi-colors';
|
|
2
|
-
import
|
|
31
|
+
import { memo, useMemo } from 'react';
|
|
3
32
|
import { Box, Text } from '../ink.js';
|
|
4
33
|
import ansiRegex from '../lib/ansiRegex.js';
|
|
5
34
|
import figures from '../lib/figures.js';
|
|
@@ -28,50 +57,70 @@ const SPINNER = {
|
|
|
28
57
|
};
|
|
29
58
|
const ICONS = {
|
|
30
59
|
// @ts-ignore
|
|
31
|
-
error: /*#__PURE__*/
|
|
60
|
+
error: /*#__PURE__*/ _jsx("ink-text", {
|
|
61
|
+
children: c.red(figures.cross)
|
|
62
|
+
}),
|
|
32
63
|
// @ts-ignore
|
|
33
|
-
success: /*#__PURE__*/
|
|
34
|
-
|
|
64
|
+
success: /*#__PURE__*/ _jsx("ink-text", {
|
|
65
|
+
children: c.green(figures.tick)
|
|
66
|
+
}),
|
|
67
|
+
running: /*#__PURE__*/ _jsx(Spinner, _object_spread({}, SPINNER))
|
|
35
68
|
};
|
|
36
69
|
const Header = /*#__PURE__*/ memo(function Header({ group, title, state }) {
|
|
37
70
|
const icon = ICONS[state];
|
|
38
|
-
return /*#__PURE__*/
|
|
39
|
-
|
|
40
|
-
|
|
71
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
72
|
+
children: [
|
|
73
|
+
icon,
|
|
74
|
+
group && /*#__PURE__*/ _jsx(Text, {
|
|
75
|
+
bold: true,
|
|
76
|
+
children: `${group}${figures.pointer} `
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
79
|
+
children: title
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
41
83
|
}, (a, b)=>a.group === b.group && a.title === b.title && a.state === b.state);
|
|
42
84
|
const RunningSummary = /*#__PURE__*/ memo(function RunningSummary({ line }) {
|
|
43
|
-
return /*#__PURE__*/
|
|
44
|
-
marginLeft: 2
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
85
|
+
return /*#__PURE__*/ _jsx(Box, {
|
|
86
|
+
marginLeft: 2,
|
|
87
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
88
|
+
color: "gray",
|
|
89
|
+
children: line.text.replace(REGEX_ANSI, '')
|
|
90
|
+
})
|
|
91
|
+
});
|
|
48
92
|
});
|
|
49
93
|
const renderLine = (line, index)=>{
|
|
50
94
|
return(// @ts-ignore
|
|
51
|
-
/*#__PURE__*/
|
|
52
|
-
key: index,
|
|
95
|
+
/*#__PURE__*/ _jsx("ink-text", {
|
|
53
96
|
style: {
|
|
54
97
|
minHeight: 1
|
|
55
|
-
}
|
|
56
|
-
|
|
98
|
+
},
|
|
99
|
+
children: line.text
|
|
100
|
+
}, index));
|
|
57
101
|
};
|
|
58
102
|
const Lines = /*#__PURE__*/ memo(function Lines({ lines }) {
|
|
59
|
-
return /*#__PURE__*/
|
|
103
|
+
return /*#__PURE__*/ _jsx(Box, {
|
|
60
104
|
flexDirection: "column",
|
|
61
|
-
marginLeft: 2
|
|
62
|
-
|
|
105
|
+
marginLeft: 2,
|
|
106
|
+
children: lines.map(renderLine)
|
|
107
|
+
});
|
|
63
108
|
});
|
|
64
109
|
const Expanded = /*#__PURE__*/ memo(function Expanded({ item }) {
|
|
65
110
|
const { lines } = item;
|
|
66
|
-
return /*#__PURE__*/
|
|
67
|
-
flexDirection: "column"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
111
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
112
|
+
flexDirection: "column",
|
|
113
|
+
children: [
|
|
114
|
+
/*#__PURE__*/ _jsx(Header, {
|
|
115
|
+
group: item.group,
|
|
116
|
+
title: item.title,
|
|
117
|
+
state: item.state
|
|
118
|
+
}),
|
|
119
|
+
/*#__PURE__*/ _jsx(Lines, {
|
|
120
|
+
lines: lines
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
75
124
|
});
|
|
76
125
|
const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
|
|
77
126
|
const { state, lines } = item;
|
|
@@ -83,23 +132,28 @@ const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
|
|
|
83
132
|
lines,
|
|
84
133
|
errors
|
|
85
134
|
]);
|
|
86
|
-
return /*#__PURE__*/
|
|
87
|
-
flexDirection: "column"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
135
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
136
|
+
flexDirection: "column",
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ _jsx(Header, {
|
|
139
|
+
group: item.group,
|
|
140
|
+
title: item.title,
|
|
141
|
+
state: item.state
|
|
142
|
+
}),
|
|
143
|
+
state === 'running' && /*#__PURE__*/ _jsx(RunningSummary, {
|
|
144
|
+
line: summary || BLANK_LINE
|
|
145
|
+
}),
|
|
146
|
+
errors.length > 0 && /*#__PURE__*/ _jsx(Lines, {
|
|
147
|
+
lines: errors
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
});
|
|
97
151
|
});
|
|
98
152
|
export default /*#__PURE__*/ memo(function ChildProcess({ item }) {
|
|
99
153
|
const { expanded } = item;
|
|
100
|
-
return expanded ? /*#__PURE__*/
|
|
154
|
+
return expanded ? /*#__PURE__*/ _jsx(Expanded, {
|
|
101
155
|
item: item
|
|
102
|
-
}) : /*#__PURE__*/
|
|
156
|
+
}) : /*#__PURE__*/ _jsx(Contracted, {
|
|
103
157
|
item: item
|
|
104
158
|
});
|
|
105
159
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import c from 'ansi-colors';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import c from 'ansi-colors';\nimport { memo, useMemo } from 'react';\nimport { Box, Text } from '../ink.js';\nimport ansiRegex from '../lib/ansiRegex.js';\nimport figures from '../lib/figures.js';\nimport Spinner from './Spinner.js';\n\nimport type { ChildProcess as ChildProcessT, Line, State } from '../types.js';\nimport { LineType } from '../types.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 // @ts-ignore\n error: <ink-text>{c.red(figures.cross)}</ink-text>,\n // @ts-ignore\n success: <ink-text>{c.green(figures.tick)}</ink-text>,\n running: <Spinner {...SPINNER} />,\n};\n\ntype ItemProps = {\n item: ChildProcessT;\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 // @ts-ignore\n <ink-text key={index} style={{ minHeight: 1 }}>\n {line.text}\n {/* @ts-ignore */}\n </ink-text>\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 }: ItemProps) {\n const { lines } = item;\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n <Lines lines={lines} />\n </Box>\n );\n});\n\nconst Contracted = memo(function Contracted({ item }: ItemProps) {\n const { state, lines } = item;\n\n // remove ansi codes when displaying single lines\n const errors = useMemo(() => lines.filter((line) => line.type === LineType.stderr), [lines]);\n const summary = useMemo(() => lines.filter((line) => line.text.length > 0 && errors.indexOf(line) < 0).pop(), [lines, errors]);\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n {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 }: ItemProps) {\n const { expanded } = item;\n return expanded ? <Expanded item={item} /> : <Contracted item={item} />;\n});\n"],"names":["c","memo","useMemo","Box","Text","ansiRegex","figures","Spinner","LineType","REGEX_ANSI","BLANK_LINE","type","stdout","text","SPINNER","interval","frames","ICONS","error","ink-text","red","cross","success","green","tick","running","Header","group","title","state","icon","bold","pointer","a","b","RunningSummary","line","marginLeft","color","replace","renderLine","index","style","minHeight","Lines","lines","flexDirection","map","Expanded","item","Contracted","errors","filter","stderr","summary","length","indexOf","pop","ChildProcess","expanded"],"mappings":"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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
2
3
|
import { Text } from '../ink.js';
|
|
3
4
|
export default function Spinner({ interval, frames }) {
|
|
4
5
|
const [index, setIndex] = useState(0);
|
|
@@ -13,5 +14,7 @@ export default function Spinner({ interval, frames }) {
|
|
|
13
14
|
interval,
|
|
14
15
|
frames
|
|
15
16
|
]);
|
|
16
|
-
return /*#__PURE__*/
|
|
17
|
+
return /*#__PURE__*/ _jsx(Text, {
|
|
18
|
+
children: `${frames[index]} `
|
|
19
|
+
});
|
|
17
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/Spinner.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/Spinner.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { Text } from '../ink.js';\n\nexport type SpinnerProps = {\n interval: number;\n frames: string[];\n};\n\nexport default function Spinner({ interval, frames }: SpinnerProps) {\n const [index, setIndex] = useState(0);\n\n useEffect(() => {\n const timer = setInterval(() => {\n setIndex((index) => (index === frames.length - 1 ? 0 : index + 1));\n }, interval);\n return () => {\n clearInterval(timer);\n };\n }, [interval, frames]);\n\n return <Text>{`${frames[index]} `}</Text>;\n}\n"],"names":["useEffect","useState","Text","Spinner","interval","frames","index","setIndex","timer","setInterval","length","clearInterval"],"mappings":";AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,IAAI,QAAQ,YAAY;AAOjC,eAAe,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,EAAgB;IAChE,MAAM,CAACC,OAAOC,SAAS,GAAGN,SAAS;IAEnCD,UAAU;QACR,MAAMQ,QAAQC,YAAY;YACxBF,SAAS,CAACD,QAAWA,UAAUD,OAAOK,MAAM,GAAG,IAAI,IAAIJ,QAAQ;QACjE,GAAGF;QACH,OAAO;YACLO,cAAcH;QAChB;IACF,GAAG;QAACJ;QAAUC;KAAO;IAErB,qBAAO,KAACH;kBAAM,GAAGG,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC;;AACnC"}
|
package/dist/esm/createApp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createStore } from 'zustand';
|
|
3
3
|
import App from './components/App.js';
|
|
4
4
|
import StoreContext from './contexts/Store.js';
|
|
@@ -25,9 +25,10 @@ export default function createApp() {
|
|
|
25
25
|
processes: state.processes.map((x)=>x.id === process1.id ? process1 : x)
|
|
26
26
|
}))
|
|
27
27
|
}));
|
|
28
|
-
inkApp = render(/*#__PURE__*/
|
|
29
|
-
value: store
|
|
30
|
-
|
|
28
|
+
inkApp = render(/*#__PURE__*/ _jsx(StoreContext.Provider, {
|
|
29
|
+
value: store,
|
|
30
|
+
children: /*#__PURE__*/ _jsx(App, {})
|
|
31
|
+
}), {
|
|
31
32
|
patchConsole: false
|
|
32
33
|
});
|
|
33
34
|
return fn(store);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createApp.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createApp.tsx"],"sourcesContent":["import { createStore } from 'zustand';\nimport App from './components/App.js';\nimport StoreContext from './contexts/Store.js';\n\n// @ts-ignore\nimport { type Instance, initialize, render } from './ink.js';\nimport type { AppState } from './types.js';\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) {\n initialize(() => {\n if (++refCount > 1) return fn(store);\n if (store) throw new Error('Not expecting store');\n store = createStore<AppState>()((set) => ({\n processes: [],\n addProcess: (process) => set((state) => ({ processes: [...state.processes, process] })),\n updateProcess: (process) => set((state) => ({ processes: state.processes.map((x) => (x.id === process.id ? process : x)) })),\n }));\n inkApp = render(\n <StoreContext.Provider value={store}>\n <App />\n </StoreContext.Provider>,\n { patchConsole: false }\n );\n return fn(store);\n });\n },\n release() {\n if (--refCount > 0) return;\n if (!store) throw new Error('Expecting store');\n store = null;\n inkApp.unmount();\n inkApp = null;\n process.stdout.write('\\x1b[?25h'); // show cursor\n },\n };\n}\n"],"names":["createStore","App","StoreContext","initialize","render","createApp","refCount","store","inkApp","retain","fn","Error","set","processes","addProcess","process","state","updateProcess","map","x","id","Provider","value","patchConsole","release","unmount","stdout","write"],"mappings":";AAAA,SAASA,WAAW,QAAQ,UAAU;AACtC,OAAOC,SAAS,sBAAsB;AACtC,OAAOC,kBAAkB,sBAAsB;AAE/C,aAAa;AACb,SAAwBC,UAAU,EAAEC,MAAM,QAAQ,WAAW;AAG7D,eAAe,SAASC;IACtB,IAAIC,WAAW;IACf,IAAIC,QAAQ;IACZ,IAAIC,SAA0B;IAE9B,OAAO;QACLC,QAAOC,EAAE;YACPP,WAAW;gBACT,IAAI,EAAEG,WAAW,GAAG,OAAOI,GAAGH;gBAC9B,IAAIA,OAAO,MAAM,IAAII,MAAM;gBAC3BJ,QAAQP,cAAwB,CAACY,MAAS,CAAA;wBACxCC,WAAW,EAAE;wBACbC,YAAY,CAACC,WAAYH,IAAI,CAACI,QAAW,CAAA;oCAAEH,WAAW;2CAAIG,MAAMH,SAAS;wCAAEE;qCAAQ;gCAAC,CAAA;wBACpFE,eAAe,CAACF,WAAYH,IAAI,CAACI,QAAW,CAAA;oCAAEH,WAAWG,MAAMH,SAAS,CAACK,GAAG,CAAC,CAACC,IAAOA,EAAEC,EAAE,KAAKL,SAAQK,EAAE,GAAGL,WAAUI;gCAAI,CAAA;oBAC3H,CAAA;gBACAX,SAASJ,qBACP,KAACF,aAAamB,QAAQ;oBAACC,OAAOf;8BAC5B,cAAA,KAACN;oBAEH;oBAAEsB,cAAc;gBAAM;gBAExB,OAAOb,GAAGH;YACZ;QACF;QACAiB;YACE,IAAI,EAAElB,WAAW,GAAG;YACpB,IAAI,CAACC,OAAO,MAAM,IAAII,MAAM;YAC5BJ,QAAQ;YACRC,OAAOiB,OAAO;YACdjB,SAAS;YACTO,QAAQW,MAAM,CAACC,KAAK,CAAC,cAAc,cAAc;QACnD;IACF;AACF"}
|
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":["// @ts-ignore\nexport type { SpawnOptions, SpawnCallback, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?:
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["// @ts-ignore\nexport type { SpawnOptions, SpawnCallback, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: boolean;\n};\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?: string;\n};\n\nexport interface AppState {\n processes: ChildProcess[];\n addProcess: (process: ChildProcess) => void;\n updateProcess: (process: ChildProcess) => void;\n}\n"],"names":["LineType","stdout","stderr"],"mappings":"AAAA,aAAa;AAQb,OAAO,MAAMA,WAAW;IACtBC,QAAQ;IACRC,QAAQ;AACV,EAAW"}
|