spawn-term 0.1.23 → 0.1.24
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/ChildProcess.cjs +11 -2
- package/dist/cjs/components/ChildProcess.cjs.map +1 -1
- package/dist/cjs/worker.cjs +2 -4
- package/dist/cjs/worker.cjs.map +1 -1
- package/dist/esm/components/ChildProcess.mjs +9 -2
- package/dist/esm/components/ChildProcess.mjs.map +1 -1
- package/dist/esm/worker.mjs +2 -4
- package/dist/esm/worker.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
|
12
12
|
var _zustand = require("zustand");
|
|
13
13
|
var _Store = /*#__PURE__*/ _interop_require_default(require("../contexts/Store.cjs"));
|
|
14
14
|
var _ink = require("../ink.cjs");
|
|
15
|
+
var _ansiRegex = /*#__PURE__*/ _interop_require_default(require("../lib/ansiRegex.cjs"));
|
|
15
16
|
var _figures = /*#__PURE__*/ _interop_require_default(require("../lib/figures.cjs"));
|
|
16
17
|
var _Spinner = /*#__PURE__*/ _interop_require_default(require("./Spinner.cjs"));
|
|
17
18
|
var _types = require("../types.cjs");
|
|
@@ -61,6 +62,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
61
62
|
}
|
|
62
63
|
return newObj;
|
|
63
64
|
}
|
|
65
|
+
var ansiRegex = (0, _ansiRegex.default)();
|
|
64
66
|
// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2
|
|
65
67
|
var spinner = {
|
|
66
68
|
interval: 80,
|
|
@@ -137,10 +139,17 @@ function ChildProcess(param) {
|
|
|
137
139
|
lines: lines
|
|
138
140
|
}));
|
|
139
141
|
}
|
|
140
|
-
|
|
142
|
+
// remove ansi codes when displaying single lines
|
|
143
|
+
var cleaned = lines.map(function(x) {
|
|
144
|
+
return {
|
|
145
|
+
type: x.type,
|
|
146
|
+
text: x.text.replace(ansiRegex, '')
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
var errors = cleaned.filter(function(line) {
|
|
141
150
|
return line.type === _types.LineType.stderr;
|
|
142
151
|
});
|
|
143
|
-
var output =
|
|
152
|
+
var output = cleaned.filter(function(line) {
|
|
144
153
|
return line.text.length > 0;
|
|
145
154
|
}).pop();
|
|
146
155
|
return /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
@@ -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\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}>{icon}</Box>\n {group && <Text bold>{`${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\">{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
|
|
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 _ansiRegex from '../lib/ansiRegex';\nimport figures from '../lib/figures';\nimport Spinner from './Spinner';\n\nimport type { AppState } from '../types';\nimport { LineType } from '../types';\n\nconst ansiRegex = _ansiRegex();\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 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}>{icon}</Box>\n {group && <Text bold>{`${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\">{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 // remove ansi codes when displaying single lines\n const cleaned = lines.map((x) => ({ type: x.type, text: x.text.replace(ansiRegex, '') }));\n const errors = cleaned.filter((line) => line.type === LineType.stderr);\n const output = cleaned.filter((line) => line.text.length > 0).pop();\n\n return (\n <Box flexDirection=\"column\">\n <Header item={item} />\n {state === 'running' && output && <Output output={output} />}\n {errors.length > 0 && <Lines lines={errors} />}\n </Box>\n );\n}\n"],"names":["ChildProcess","ansiRegex","_ansiRegex","spinner","interval","frames","ICONS","error","Text","color","figures","cross","success","tick","running","Spinner","Header","item","group","title","state","icon","Box","marginRight","bold","pointer","Output","output","marginLeft","text","Lines","lines","flexDirection","map","line","index","key","height","type","LineType","stderr","id","store","useContext","StoreContext","appState","useStore","processes","find","x","expanded","cleaned","replace","errors","filter","length","pop"],"mappings":";;;;+BA+DA;;;eAAwBA;;;6DA/DU;uBACT;4DACA;mBACC;gEACH;8DACH;8DACA;qBAGK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzB,IAAMC,YAAYC,IAAAA,kBAAU;AAE5B,oHAAoH;AACpH,IAAMC,UAAU;IACdC,UAAU;IACVC,QAAQ;QAAC;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;KAAI;AAC5D;AAEA,IAAMC,QAAQ;IACZC,qBAAO,6BAACC,SAAI;QAACC,OAAM;OAAOC,gBAAO,CAACC,KAAK;IACvCC,uBAAS,6BAACJ,SAAI;QAACC,OAAM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C,KAAbiC;IAEtB,IAAIA,UAAU;QACZ,qBACE,6BAAC5B,QAAG;YAACU,eAAc;yBACjB,6BAAChB;YAAOC,MAAMA;0BACd,6BAACa;YAAMC,OAAOA;;IAGpB;IACA,iDAAiD;IACjD,IAAMoB,UAAUpB,MAAME,GAAG,CAAC,SAACgB;eAAO;YAAEX,MAAMW,EAAEX,IAAI;YAAET,MAAMoB,EAAEpB,IAAI,CAACuB,OAAO,CAACnD,WAAW;QAAI;;IACtF,IAAMoD,SAASF,QAAQG,MAAM,CAAC,SAACpB;eAASA,KAAKI,IAAI,KAAKC,eAAQ,CAACC,MAAM;;IACrE,IAAMb,SAASwB,QAAQG,MAAM,CAAC,SAACpB;eAASA,KAAKL,IAAI,CAAC0B,MAAM,GAAG;OAAGC,GAAG;IAEjE,qBACE,6BAAClC,QAAG;QAACU,eAAc;qBACjB,6BAAChB;QAAOC,MAAMA;QACbG,UAAU,aAAaO,wBAAU,6BAACD;QAAOC,QAAQA;QACjD0B,OAAOE,MAAM,GAAG,mBAAK,6BAACzB;QAAMC,OAAOsB;;AAG1C"}
|
package/dist/cjs/worker.cjs
CHANGED
|
@@ -15,7 +15,6 @@ var _onone = /*#__PURE__*/ _interop_require_default(require("on-one"));
|
|
|
15
15
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
16
16
|
var _createApp = /*#__PURE__*/ _interop_require_default(require("./createApp.cjs"));
|
|
17
17
|
var _addLines = /*#__PURE__*/ _interop_require_default(require("./lib/addLines.cjs"));
|
|
18
|
-
var _ansiRegex = /*#__PURE__*/ _interop_require_default(require("./lib/ansiRegex.cjs"));
|
|
19
18
|
var _concatWritable = /*#__PURE__*/ _interop_require_default(require("./lib/concatWritable.cjs"));
|
|
20
19
|
var _formatArguments = /*#__PURE__*/ _interop_require_default(require("./lib/formatArguments.cjs"));
|
|
21
20
|
var _types = require("./types.cjs");
|
|
@@ -144,7 +143,6 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
144
143
|
}
|
|
145
144
|
return target;
|
|
146
145
|
}
|
|
147
|
-
var ansiRegex = (0, _ansiRegex.default)();
|
|
148
146
|
var terminal = (0, _createApp.default)();
|
|
149
147
|
function spawnTerminal(command, args, spawnOptions, options, callback) {
|
|
150
148
|
var encoding = spawnOptions.encoding, stdio = spawnOptions.stdio, csOptions = _object_without_properties(spawnOptions, [
|
|
@@ -176,7 +174,7 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
|
|
|
176
174
|
var lines = item.lines.concat(texts.map(function(text) {
|
|
177
175
|
return {
|
|
178
176
|
type: _types.LineType.stdout,
|
|
179
|
-
text: text
|
|
177
|
+
text: text
|
|
180
178
|
};
|
|
181
179
|
}));
|
|
182
180
|
store.getState().updateProcess(_object_spread_props(_object_spread({}, item), {
|
|
@@ -198,7 +196,7 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
|
|
|
198
196
|
var lines = item.lines.concat(texts.map(function(text) {
|
|
199
197
|
return {
|
|
200
198
|
type: _types.LineType.stderr,
|
|
201
|
-
text: text
|
|
199
|
+
text: text
|
|
202
200
|
};
|
|
203
201
|
}));
|
|
204
202
|
store.getState().updateProcess(_object_spread_props(_object_spread({}, item), {
|
package/dist/cjs/worker.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["// @ts-ignore\nimport spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport uuid from 'lil-uuid';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp';\nimport addLines from './lib/addLines';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["// @ts-ignore\nimport spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport uuid from 'lil-uuid';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp';\nimport addLines from './lib/addLines';\nimport concatWritable from './lib/concatWritable';\nimport formatArguments from './lib/formatArguments';\n\nimport type { SpawnOptions, TerminalOptions } from './types';\nimport { LineType } from './types';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback) {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = uuid();\n store.getState().addProcess({ 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((texts) => {\n const item = store.getState().processes.find((x) => x.id === id);\n const lines = item.lines.concat(texts.map((text) => ({ type: LineType.stdout, text })));\n store.getState().updateProcess({ ...item, lines });\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((texts) => {\n const item = store.getState().processes.find((x) => x.id === id);\n const lines = item.lines.concat(texts.map((text) => ({ type: LineType.stderr, text })));\n store.getState().updateProcess({ ...item, lines });\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) => {\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 const item = store.getState().processes.find((x) => x.id === id);\n store.getState().updateProcess({ ...item, state: err ? 'error' : 'success' });\n\n // let rendering complete\n setTimeout(() => {\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) => {\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","uuid","getState","addProcess","title","concat","formatArguments","join","state","lines","cp","crossSpawn","outputs","stdout","stderr","queue","Queue","addLines","texts","item","processes","find","x","map","text","type","LineType","updateProcess","defer","oo","bind","pipe","spawn","worker","await","err","res","output","setTimeout","release","concatWritable","toString"],"mappings":"AAAA,aAAa;;;;;+BAgBb;;;eAAwBA;;;oEAf4B;8DACnC;4DACF;8DACG;gEAEI;+DACD;qEACM;sEACC;qBAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzB,IAAMC,WAAWC,IAAAA,kBAAS;AAEX,SAASF,cAAcG,OAAe,EAAEC,IAAc,EAAEC,YAA0B,EAAEC,OAAwB,EAAEC,QAAQ;IACnI,IAAQC,WAAkCH,aAAlCG,UAAUC,QAAwBJ,aAAxBI,OAAUC,uCAAcL;QAAlCG;QAAUC;;IAElB,IAAIA,UAAU,WAAW;QACvBR,SAASU,M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YACbD,QAAQC,MAAM,GAAG2B,IAAAA,uBAAc,EAAC,SAACH;gBAC/BzB,QAAQC,MAAM,CAACwB,MAAM,GAAGA,OAAOI,QAAQ,CAAC9C,YAAY;YACtD;YACAoB,MAAMa,KAAK,CAACC,cAAE,CAACC,IAAI,CAAC,MAAMpB,GAAGG,MAAM,CAACkB,IAAI,CAACnB,QAAQC,MAAM,GAAG;gBAAC;gBAAS;gBAAO;gBAAS;aAAS;QAC/F;QACA,IAAIH,GAAGI,MAAM,EAAE;YACbF,QAAQE,MAAM,GAAG0B,IAAAA,uBAAc,EAAC,SAACH;gBAC/BzB,QAAQE,MAAM,CAACuB,MAAM,GAAGA,OAAOI,QAAQ,CAAC9C,YAAY;YACtD;YACAoB,MAAMa,KAAK,CAACC,cAAE,CAACC,IAAI,CAAC,MAAMpB,GAAGI,MAAM,CAACiB,IAAI,CAACnB,QAAQE,MAAM,GAAG;gBAAC;gBAAS;gBAAO;gBAAS;aAAS;QAC/F;QACAC,MAAMa,KAAK,CAACI,qBAAK,CAACC,MAAM,CAACH,IAAI,CAAC,MAAMpB,IAAI,wCAAKb;YAAWF,UAAUA,YAAY;;QAC9EoB,MAAMmB,KAAK,CAAC,SAACC;YACX,IAAMC,MAAOD,MAAMA,MAAM,CAAC;YAC1BC,IAAIvB,MAAM,GAAGD,QAAQC,MAAM,GAAGD,QAAQC,MAAM,CAACwB,MAAM,GAAG;YACtDD,IAAItB,MAAM,GAAGF,QAAQE,MAAM,GAAGF,QAAQE,MAAM,CAACuB,MAAM,GAAG;YACtDD,IAAIC,MAAM,GAAG;gBAACD,IAAIvB,MAAM;gBAAEuB,IAAItB,MAAM;gBAAE;aAAK;YAC3CqB,MAAMzC,SAASyC,OAAOzC,SAAS,MAAM0C;QACvC;IACF;AACF"}
|
|
@@ -2,9 +2,11 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import { useStore } from 'zustand';
|
|
3
3
|
import StoreContext from '../contexts/Store.mjs';
|
|
4
4
|
import { Box, Text } from '../ink.mjs';
|
|
5
|
+
import _ansiRegex from '../lib/ansiRegex.mjs';
|
|
5
6
|
import figures from '../lib/figures.mjs';
|
|
6
7
|
import Spinner from './Spinner.mjs';
|
|
7
8
|
import { LineType } from '../types.mjs';
|
|
9
|
+
const ansiRegex = _ansiRegex();
|
|
8
10
|
// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2
|
|
9
11
|
const spinner = {
|
|
10
12
|
interval: 80,
|
|
@@ -73,8 +75,13 @@ export default function ChildProcess({ id }) {
|
|
|
73
75
|
lines: lines
|
|
74
76
|
}));
|
|
75
77
|
}
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
+
// remove ansi codes when displaying single lines
|
|
79
|
+
const cleaned = lines.map((x)=>({
|
|
80
|
+
type: x.type,
|
|
81
|
+
text: x.text.replace(ansiRegex, '')
|
|
82
|
+
}));
|
|
83
|
+
const errors = cleaned.filter((line)=>line.type === LineType.stderr);
|
|
84
|
+
const output = cleaned.filter((line)=>line.text.length > 0).pop();
|
|
78
85
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
79
86
|
flexDirection: "column"
|
|
80
87
|
}, /*#__PURE__*/ React.createElement(Header, {
|
|
@@ -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\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}>{icon}</Box>\n {group && <Text bold>{`${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\">{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
|
|
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 _ansiRegex from '../lib/ansiRegex';\nimport figures from '../lib/figures';\nimport Spinner from './Spinner';\n\nimport type { AppState } from '../types';\nimport { LineType } from '../types';\n\nconst ansiRegex = _ansiRegex();\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 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}>{icon}</Box>\n {group && <Text bold>{`${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\">{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 // remove ansi codes when displaying single lines\n const cleaned = lines.map((x) => ({ type: x.type, text: x.text.replace(ansiRegex, '') }));\n const errors = cleaned.filter((line) => line.type === LineType.stderr);\n const output = cleaned.filter((line) => line.text.length > 0).pop();\n\n return (\n <Box flexDirection=\"column\">\n <Header item={item} />\n {state === 'running' && output && <Output output={output} />}\n {errors.length > 0 && <Lines lines={errors} />}\n </Box>\n );\n}\n"],"names":["React","useContext","useStore","StoreContext","Box","Text","_ansiRegex","figures","Spinner","LineType","ansiRegex","spinner","interval","frames","ICONS","error","color","cross","success","tick","running","Header","item","group","title","state","icon","marginRight","bold","pointer","Output","output","marginLeft","text","Lines","lines","flexDirection","map","line","index","key","height","type","stderr","ChildProcess","id","store","appState","processes","find","x","expanded","cleaned","replace","errors","filter","length","pop"],"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,gBAAgB,mBAAmB;AAC1C,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,aAAa,YAAY;AAGhC,SAASC,QAAQ,QAAQ,WAAW;AAEpC,MAAMC,YAAYJ;AAElB,oHAAoH;AACpH,MAAMK,UAAU;IACdC,UAAU;IACVC,QAAQ;QAAC;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;KAAI;AAC5D;AAEA,MAAMC,QAAQ;IACZC,qBAAO,oBAACV;QAAKW,OAAM;OAAOT,QAAQU,KAAK;IACvCC,uBAAS,oBAACb;QAAKW,OAAM;OAAST,QAAQY,IAAI;IAC1CC,uBAAS,oBAACZ,SAAYG;AACxB;AAMA,SAASU,OAAO,EAAEC,IAAI,EAAE;IACtB,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGH;IAChC,MAAMI,OAAOZ,KAAK,CAACW,MAAM;IAEzB,qBACE,oBAACrB,yBACC,oBAACA;QAAIuB,aAAa;OAAID,OACrBH,uBAAS,oBAAClB;QAAKuB,MAAAA;OAAM,GAAGL,QAAQhB,QAAQsB,OAAO,CAAC,CAAC,CAAC,iBACnD,oBAACxB,YAAMmB;AAGb;AAEA,SAASM,OAAO,EAAEC,MAAM,EAAE;IACxB,qBACE,oBAAC3B;QAAI4B,YAAY;qBACf,oBAAC3B;QAAKW,OAAM;OAAQe,OAAOE,IAAI;AAGrC;AAEA,SAASC,MAAM,EAAEC,KAAK,EAAE;IACtB,qBACE,oBAAC/B;QAAIgC,eAAc;QAASJ,YAAY;OACrCG,MAAME,GAAG,CAAC,CAACC,MAAMC,QAChB,8DAA8D;sBAC9D,oBAACnC;YAAIoC,KAAKD;YAAOH,eAAc;YAASK,QAAQ;yBAC9C,oBAACpC;YAAKW,OAAOsB,KAAKI,IAAI,KAAKjC,SAASkC,MAAM,GAAG,QAAQ;WAAUL,KAAKL,IAAI;AAKlF;AAEA,eAAe,SAASW,aAAa,EAAEC,EAAE,EAAqB;IAC5D,MAAMC,QAAQ7C,WAAWE;IACzB,MAAM4C,WAAW7C,SAAS4C;IAC1B,MAAMxB,OAAOyB,SAASC,SAAS,CAACC,IAAI,CAAC,CAACC,IAAMA,EAAEL,EAAE,KAAKA;IACrD,MAAM,EAAEpB,KAAK,EAAEU,KAAK,EAAEgB,QAAQ,EAAE,GAAG7B;IAEnC,IAAI6B,UAAU;QACZ,qBACE,oBAAC/C;YAAIgC,eAAc;yBACjB,oBAACf;YAAOC,MAAMA;0BACd,oBAACY;YAAMC,OAAOA;;IAGpB;IACA,iDAAiD;IACjD,MAAMiB,UAAUjB,MAAME,GAAG,CAAC,CAACa,IAAO,CAAA;YAAER,MAAMQ,EAAER,IAAI;YAAET,MAAMiB,EAAEjB,IAAI,CAACoB,OAAO,CAAC3C,WAAW;QAAI,CAAA;IACtF,MAAM4C,SAASF,QAAQG,MAAM,CAAC,CAACjB,OAASA,KAAKI,IAAI,KAAKjC,SAASkC,MAAM;IACrE,MAAMZ,SAASqB,QAAQG,MAAM,CAAC,CAACjB,OAASA,KAAKL,IAAI,CAACuB,MAAM,GAAG,GAAGC,GAAG;IAEjE,qBACE,oBAACrD;QAAIgC,eAAc;qBACjB,oBAACf;QAAOC,MAAMA;QACbG,UAAU,aAAaM,wBAAU,oBAACD;QAAOC,QAAQA;QACjDuB,OAAOE,MAAM,GAAG,mBAAK,oBAACtB;QAAMC,OAAOmB;;AAG1C"}
|
package/dist/esm/worker.mjs
CHANGED
|
@@ -84,11 +84,9 @@ import oo from 'on-one';
|
|
|
84
84
|
import Queue from 'queue-cb';
|
|
85
85
|
import createApp from './createApp.mjs';
|
|
86
86
|
import addLines from './lib/addLines.mjs';
|
|
87
|
-
import _ansiRegex from './lib/ansiRegex.mjs';
|
|
88
87
|
import concatWritable from './lib/concatWritable.mjs';
|
|
89
88
|
import formatArguments from './lib/formatArguments.mjs';
|
|
90
89
|
import { LineType } from './types.mjs';
|
|
91
|
-
const ansiRegex = _ansiRegex();
|
|
92
90
|
const terminal = createApp();
|
|
93
91
|
export default function spawnTerminal(command, args, spawnOptions, options, callback) {
|
|
94
92
|
const { encoding, stdio } = spawnOptions, csOptions = _object_without_properties(spawnOptions, [
|
|
@@ -117,7 +115,7 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
|
|
|
117
115
|
const item = store.getState().processes.find((x)=>x.id === id);
|
|
118
116
|
const lines = item.lines.concat(texts.map((text)=>({
|
|
119
117
|
type: LineType.stdout,
|
|
120
|
-
text
|
|
118
|
+
text
|
|
121
119
|
})));
|
|
122
120
|
store.getState().updateProcess(_object_spread_props(_object_spread({}, item), {
|
|
123
121
|
lines
|
|
@@ -135,7 +133,7 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
|
|
|
135
133
|
const item = store.getState().processes.find((x)=>x.id === id);
|
|
136
134
|
const lines = item.lines.concat(texts.map((text)=>({
|
|
137
135
|
type: LineType.stderr,
|
|
138
|
-
text
|
|
136
|
+
text
|
|
139
137
|
})));
|
|
140
138
|
store.getState().updateProcess(_object_spread_props(_object_spread({}, item), {
|
|
141
139
|
lines
|
package/dist/esm/worker.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["// @ts-ignore\nimport spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport uuid from 'lil-uuid';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp';\nimport addLines from './lib/addLines';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["// @ts-ignore\nimport spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport uuid from 'lil-uuid';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp';\nimport addLines from './lib/addLines';\nimport concatWritable from './lib/concatWritable';\nimport formatArguments from './lib/formatArguments';\n\nimport type { SpawnOptions, TerminalOptions } from './types';\nimport { LineType } from './types';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback) {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = uuid();\n store.getState().addProcess({ 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((texts) => {\n const item = store.getState().processes.find((x) => x.id === id);\n const lines = item.lines.concat(texts.map((text) => ({ type: LineType.stdout, text })));\n store.getState().updateProcess({ ...item, lines });\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((texts) => {\n const item = store.getState().processes.find((x) => x.id === id);\n const lines = item.lines.concat(texts.map((text) => ({ type: LineType.stderr, text })));\n store.getState().updateProcess({ ...item, lines });\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) => {\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 const item = store.getState().processes.find((x) => x.id === id);\n store.getState().updateProcess({ ...item, state: err ? 'error' : 'success' });\n\n // let rendering complete\n setTimeout(() => {\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) => {\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","uuid","oo","Queue","createApp","addLines","concatWritable","formatArguments","LineType","terminal","spawnTerminal","command","args","spawnOptions","options","callback","encoding","stdio","csOptions","retain","store","id","getState","addProcess","title","concat","join","state","lines","cp","outputs","stdout","stderr","queue","texts","item","processes","find","x","map","text","type","updateProcess","defer","bind","pipe","worker","await","err","res","output","setTimeout","release","toString"],"mappings":"AAAA,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,OAAOA,SAASC,UAAU,QAA0B,iBAAiB;AACrE,OAAOC,UAAU,WAAW;AAC5B,OAAOC,QAAQ,SAAS;AACxB,OAAOC,WAAW,WAAW;AAE7B,OAAOC,eAAe,cAAc;AACpC,OAAOC,cAAc,iBAAiB;AACtC,OAAOC,oBAAoB,uBAAuB;AAClD,OAAOC,qBAAqB,wBAAwB;AAGpD,SAASC,QAAQ,QAA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