spawn-term 1.0.3 → 1.0.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.
Files changed (52) hide show
  1. package/dist/cjs/components/App.d.cts +1 -3
  2. package/dist/cjs/components/App.d.ts +1 -3
  3. package/dist/cjs/components/App.js +33 -6
  4. package/dist/cjs/components/App.js.map +1 -1
  5. package/dist/cjs/components/ChildProcess.d.cts +1 -4
  6. package/dist/cjs/components/ChildProcess.d.ts +1 -4
  7. package/dist/cjs/components/ChildProcess.js +10 -20
  8. package/dist/cjs/components/ChildProcess.js.map +1 -1
  9. package/dist/cjs/createApp.d.cts +1 -1
  10. package/dist/cjs/createApp.d.ts +1 -1
  11. package/dist/cjs/createApp.js +6 -17
  12. package/dist/cjs/createApp.js.map +1 -1
  13. package/dist/cjs/state/ProcessContext.d.cts +6 -0
  14. package/dist/cjs/state/ProcessContext.d.ts +6 -0
  15. package/dist/cjs/state/ProcessContext.js +139 -0
  16. package/dist/cjs/state/ProcessContext.js.map +1 -0
  17. package/dist/cjs/state/ProcessStore.d.cts +8 -0
  18. package/dist/cjs/state/ProcessStore.d.ts +8 -0
  19. package/dist/cjs/state/ProcessStore.js +100 -0
  20. package/dist/cjs/state/ProcessStore.js.map +1 -0
  21. package/dist/cjs/types.d.cts +7 -0
  22. package/dist/cjs/types.d.ts +7 -0
  23. package/dist/cjs/types.js.map +1 -1
  24. package/dist/cjs/worker.js +7 -10
  25. package/dist/cjs/worker.js.map +1 -1
  26. package/dist/esm/components/App.d.ts +1 -3
  27. package/dist/esm/components/App.js +32 -4
  28. package/dist/esm/components/App.js.map +1 -1
  29. package/dist/esm/components/ChildProcess.d.ts +1 -4
  30. package/dist/esm/components/ChildProcess.js +10 -17
  31. package/dist/esm/components/ChildProcess.js.map +1 -1
  32. package/dist/esm/createApp.d.ts +1 -1
  33. package/dist/esm/createApp.js +6 -17
  34. package/dist/esm/createApp.js.map +1 -1
  35. package/dist/esm/state/ProcessContext.d.ts +6 -0
  36. package/dist/esm/state/ProcessContext.js +51 -0
  37. package/dist/esm/state/ProcessContext.js.map +1 -0
  38. package/dist/esm/state/ProcessStore.d.ts +8 -0
  39. package/dist/esm/state/ProcessStore.js +22 -0
  40. package/dist/esm/state/ProcessStore.js.map +1 -0
  41. package/dist/esm/types.d.ts +7 -0
  42. package/dist/esm/types.js.map +1 -1
  43. package/dist/esm/worker.js +7 -8
  44. package/dist/esm/worker.js.map +1 -1
  45. package/package.json +1 -2
  46. package/dist/cjs/Store.d.cts +0 -11
  47. package/dist/cjs/Store.d.ts +0 -11
  48. package/dist/cjs/Store.js +0 -40
  49. package/dist/cjs/Store.js.map +0 -1
  50. package/dist/esm/Store.d.ts +0 -11
  51. package/dist/esm/Store.js +0 -19
  52. package/dist/esm/Store.js.map +0 -1
@@ -151,7 +151,7 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
151
151
  if (stdio === 'inherit') {
152
152
  terminal.retain(function(store) {
153
153
  var id = _crypto.default.randomUUID();
154
- store.addProcess(_object_spread({
154
+ store.add(_object_spread({
155
155
  id: id,
156
156
  title: [
157
157
  command
@@ -170,14 +170,14 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
170
170
  var item = store.processes.find(function(x) {
171
171
  return x.id === id;
172
172
  });
173
- store.updateProcess(_object_spread_props(_object_spread({}, item), {
173
+ store.update(id, {
174
174
  lines: item.lines.concat(lines.map(function(text) {
175
175
  return {
176
176
  type: _types.LineType.stdout,
177
177
  text: text
178
178
  };
179
179
  }))
180
- }));
180
+ });
181
181
  });
182
182
  queue.defer(_onone.default.bind(null, cp.stdout.pipe(outputs.stdout), [
183
183
  'error',
@@ -191,14 +191,14 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
191
191
  var item = store.processes.find(function(x) {
192
192
  return x.id === id;
193
193
  });
194
- store.updateProcess(_object_spread_props(_object_spread({}, item), {
194
+ store.update(id, {
195
195
  lines: item.lines.concat(lines.map(function(text) {
196
196
  return {
197
197
  type: _types.LineType.stderr,
198
198
  text: text
199
199
  };
200
200
  }))
201
- }));
201
+ });
202
202
  });
203
203
  queue.defer(_onone.default.bind(null, cp.stderr.pipe(outputs.stderr), [
204
204
  'error',
@@ -219,12 +219,9 @@ function spawnTerminal(command, args, spawnOptions, options, callback) {
219
219
  res.stderr,
220
220
  null
221
221
  ];
222
- var item = store.processes.find(function(x) {
223
- return x.id === id;
224
- });
225
- store.updateProcess(_object_spread_props(_object_spread({}, item), {
222
+ store.update(id, {
226
223
  state: err ? 'error' : 'success'
227
- }));
224
+ });
228
225
  // ensure rendering completes
229
226
  terminal.release(function() {
230
227
  err ? callback(err) : callback(null, res);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["import spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport crypto from 'crypto';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp.js';\nimport addLines from './lib/addLines.js';\nimport concatWritable from './lib/concatWritable.js';\nimport formatArguments from './lib/formatArguments.js';\n\nimport type { SpawnError, SpawnOptions, TerminalCallback, TerminalOptions } from './types.js';\nimport { LineType } from './types.js';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback: TerminalCallback): undefined {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = crypto.randomUUID();\n store.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((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.updateProcess({ ...item, lines: item.lines.concat(lines.map((text) => ({ type: LineType.stdout, text }))) });\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.updateProcess({ ...item, lines: item.lines.concat(lines.map((text) => ({ type: LineType.stderr, text }))) });\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n const item = store.processes.find((x) => x.id === id);\n store.updateProcess({ ...item, state: err ? 'error' : 'success' });\n\n // ensure rendering completes\n terminal.release(() => {\n err ? callback(err) : callback(null, res);\n });\n });\n });\n } else {\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = concatWritable((output) => {\n outputs.stdout.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = concatWritable((output) => {\n outputs.stderr.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: encoding || 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n err ? callback(err) : callback(null, res);\n });\n }\n}\n"],"names":["spawnTerminal","terminal","createApp","command","args","spawnOptions","options","callback","encoding","stdio","csOptions","retain","store","id","crypto","randomUUID","addProcess","title","concat","formatArguments","join","state","lines","cp","crossSpawn","outputs","stdout","stderr","queue","Queue","addLines","item","processes","find","x","updateProcess","map","text","type","LineType","defer","oo","bind","pipe","spawn","worker","await","err","res","output","release","concatWritable","toString"],"mappings":";;;;+BAeA;;;eAAwBA;;;oEAf4B;6DACjC;4DACJ;8DACG;gEAEI;+DACD;qEACM;sEACC;qBAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzB,IAAMC,WAAWC,IAAAA,kBAAS;AAEX,SAASF,cAAcG,OAAe,EAAEC,IAAc,EAAEC,YAA0B,EAAEC,OAAwB,EAAEC,QAA0B;IACrJ,IAAQC,WAAkCH,aAAlCG,UAAUC,QAAwBJ,aAAxBI,OAAUC,uCAAcL;QAAlCG;QAAUC;;IAElB,IAAIA,UAAU,WAAW;QACvBR,SAASU,MAAM,CAAC,SAACC;YACf,IAAMC,KAAKC,eAAM,CAACC,UAAU;YAC5BH,MAAMI,UAAU,CAAC;gBAAEH,IAAAA;gBAAII,OAAO;oBAACd;iBAAQ,CAACe,MAAM,CAACC,IAAAA,wBAAe,EAACf,OAAOgB,IAAI,CAAC;gBAAMC,OAAO;gBAAWC,OAAO,EAAE;eAAKhB;YAEjH,IAAMiB,KAAKC,IAAAA,wBAAU,EAACrB,SAASC,MAAMM;YACrC,IAAMe,UAAU;gBAAEC,QAAQ;gBAAMC,QAAQ;YAAK;YAE7C,IAAMC,QAAQ,IAAIC,gBAAK;YACvB,IAAIN,GAAGG,MAAM,EAAE;gBACbD,QAAQC,MAAM,GAAGI,IAAAA,iBAAQ,EAAC,SAACR;oBACzB,IAAMS,OAAOnB,MAAMoB,SAAS,CAACC,IAAI,CAAC,SAACC;+BAAMA,EAAErB,EAAE,KAAKA;;oBAClDD,MAAMuB,aAAa,CAAC,wCAAKJ;wBAAMT,OAAOS,KAAK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AAMA,MAAM,CAAC;YAC1BC,IAAItB,MAAM,GAAGD,QAAQC,MAAM,GAAGD,QAAQC,MAAM,CAACuB,MAAM,GAAG;YACtDD,IAAIrB,MAAM,GAAGF,QAAQE,MAAM,GAAGF,QAAQE,MAAM,CAACsB,MAAM,GAAG;YACtDD,IAAIC,MAAM,GAAG;gBAACD,IAAItB,MAAM;gBAAEsB,IAAIrB,MAAM;gBAAE;aAAK;YAC3CoB,MAAMxC,SAASwC,OAAOxC,SAAS,MAAMyC;QACvC;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["import spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport crypto from 'crypto';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp.js';\nimport addLines from './lib/addLines.js';\nimport concatWritable from './lib/concatWritable.js';\nimport formatArguments from './lib/formatArguments.js';\n\nimport type { SpawnError, SpawnOptions, TerminalCallback, TerminalOptions } from './types.js';\nimport { LineType } from './types.js';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback: TerminalCallback): undefined {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = crypto.randomUUID();\n store.add({ id, title: [command].concat(formatArguments(args)).join(' '), state: 'running', lines: [], ...options });\n\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.update(id, { lines: item.lines.concat(lines.map((text) => ({ type: LineType.stdout, text }))) });\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.update(id, { lines: item.lines.concat(lines.map((text) => ({ type: LineType.stderr, text }))) });\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n store.update(id, { state: err ? 'error' : 'success' });\n\n // ensure rendering completes\n terminal.release(() => {\n err ? callback(err) : callback(null, res);\n });\n });\n });\n } else {\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = concatWritable((output) => {\n outputs.stdout.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = concatWritable((output) => {\n outputs.stderr.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: encoding || 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n err ? callback(err) : callback(null, res);\n });\n }\n}\n"],"names":["spawnTerminal","terminal","createApp","command","args","spawnOptions","options","callback","encoding","stdio","csOptions","retain","store","id","crypto","randomUUID","add","title","concat","formatArguments","join","state","lines","cp","crossSpawn","outputs","stdout","stderr","queue","Queue","addLines","item","processes","find","x","update","map","text","type","LineType","defer","oo","bind","pipe","spawn","worker","await","err","res","output","release","concatWritable","toString"],"mappings":";;;;+BAeA;;;eAA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AEsB,IAAIrB,MAAM;gBAAE;aAAK;YAC3CoB,MAAMxC,SAASwC,OAAOxC,SAAS,MAAMyC;QACvC;IACF;AACF"}
@@ -1,3 +1 @@
1
- export default function App({ store }: {
2
- store: any;
3
- }): import("react").JSX.Element;
1
+ export default function App(): import("react").JSX.Element;
@@ -1,11 +1,39 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _define_property(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
1
29
  import { jsx as _jsx } from "react/jsx-runtime";
2
30
  import { Box } from 'ink';
31
+ import { useProcesses } from '../state/ProcessContext.js';
3
32
  import ChildProcess from './ChildProcess.js';
4
- export default function App({ store }) {
33
+ export default function App() {
34
+ const processes = useProcesses();
5
35
  return /*#__PURE__*/ _jsx(Box, {
6
36
  flexDirection: "column",
7
- children: store.processes.map((item)=>/*#__PURE__*/ _jsx(ChildProcess, {
8
- item: item
9
- }, item.id))
37
+ children: processes.map((item)=>/*#__PURE__*/ _jsx(ChildProcess, _object_spread({}, item), item.id))
10
38
  });
11
39
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import { Box } from 'ink';\nimport type { ChildProcess as ChildProcessT } from '../types.js';\nimport ChildProcess from './ChildProcess.js';\n\nexport default function App({ store }) {\n return (\n <Box flexDirection=\"column\">\n {store.processes.map((item: ChildProcessT) => (\n <ChildProcess key={item.id} item={item} />\n ))}\n </Box>\n );\n}\n"],"names":["Box","ChildProcess","App","store","flexDirection","processes","map","item","id"],"mappings":";AAAA,SAASA,GAAG,QAAQ,MAAM;AAE1B,OAAOC,kBAAkB,oBAAoB;AAE7C,eAAe,SAASC,IAAI,EAAEC,KAAK,EAAE;IACnC,qBACE,KAACH;QAAII,eAAc;kBAChBD,MAAME,SAAS,CAACC,GAAG,CAAC,CAACC,qBACpB,KAACN;gBAA2BM,MAAMA;eAAfA,KAAKC,EAAE;;AAIlC"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/App.tsx"],"sourcesContent":["import { Box } from 'ink';\nimport { useProcesses } from '../state/ProcessContext.js';\nimport type { ChildProcess as ChildProcessT } from '../types.js';\nimport ChildProcess from './ChildProcess.js';\n\nexport default function App() {\n const processes = useProcesses();\n\n return (\n <Box flexDirection=\"column\">\n {processes.map((item: ChildProcessT) => (\n <ChildProcess key={item.id} {...item} />\n ))}\n </Box>\n );\n}\n"],"names":["Box","useProcesses","ChildProcess","App","processes","flexDirection","map","item","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,MAAM;AAC1B,SAASC,YAAY,QAAQ,6BAA6B;AAE1D,OAAOC,kBAAkB,oBAAoB;AAE7C,eAAe,SAASC;IACtB,MAAMC,YAAYH;IAElB,qBACE,KAACD;QAAIK,eAAc;kBAChBD,UAAUE,GAAG,CAAC,CAACC,qBACd,KAACL,iCAA+BK,OAAbA,KAAKC,EAAE;;AAIlC"}
@@ -1,6 +1,3 @@
1
1
  import type { ChildProcess as ChildProcessT } from '../types.js';
2
- type ItemProps = {
3
- item: ChildProcessT;
4
- };
5
- declare const _default: import("react").NamedExoticComponent<ItemProps>;
2
+ declare const _default: import("react").NamedExoticComponent<ChildProcessT>;
6
3
  export default _default;
@@ -104,8 +104,7 @@ const Lines = /*#__PURE__*/ memo(function Lines({ lines }) {
104
104
  children: lines.map(renderLine)
105
105
  });
106
106
  });
107
- const Expanded = /*#__PURE__*/ memo(function Expanded({ item }) {
108
- const { lines } = item;
107
+ const Expanded = /*#__PURE__*/ memo(function Expanded(item) {
109
108
  return /*#__PURE__*/ _jsxs(Box, {
110
109
  flexDirection: "column",
111
110
  children: [
@@ -115,19 +114,18 @@ const Expanded = /*#__PURE__*/ memo(function Expanded({ item }) {
115
114
  state: item.state
116
115
  }),
117
116
  /*#__PURE__*/ _jsx(Lines, {
118
- lines: lines
117
+ lines: item.lines
119
118
  })
120
119
  ]
121
120
  });
122
121
  });
123
- const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
124
- const { state, lines } = item;
122
+ const Contracted = /*#__PURE__*/ memo(function Contracted(item) {
125
123
  // remove ansi codes when displaying single lines
126
- const errors = useMemo(()=>lines.filter((line)=>line.type === LineType.stderr), [
127
- lines
124
+ const errors = useMemo(()=>item.lines.filter((line)=>line.type === LineType.stderr), [
125
+ item.lines
128
126
  ]);
129
- const summary = useMemo(()=>lines.filter((line)=>line.text.length > 0 && errors.indexOf(line) < 0).pop(), [
130
- lines,
127
+ const summary = useMemo(()=>item.lines.filter((line)=>line.text.length > 0 && errors.indexOf(line) < 0).pop(), [
128
+ item.lines,
131
129
  errors
132
130
  ]);
133
131
  return /*#__PURE__*/ _jsxs(Box, {
@@ -138,7 +136,7 @@ const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
138
136
  title: item.title,
139
137
  state: item.state
140
138
  }),
141
- state === 'running' && /*#__PURE__*/ _jsx(RunningSummary, {
139
+ item.state === 'running' && /*#__PURE__*/ _jsx(RunningSummary, {
142
140
  line: summary || BLANK_LINE
143
141
  }),
144
142
  errors.length > 0 && /*#__PURE__*/ _jsx(Lines, {
@@ -147,11 +145,6 @@ const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
147
145
  ]
148
146
  });
149
147
  });
150
- export default /*#__PURE__*/ memo(function ChildProcess({ item }) {
151
- const { expanded } = item;
152
- return expanded ? /*#__PURE__*/ _jsx(Expanded, {
153
- item: item
154
- }) : /*#__PURE__*/ _jsx(Contracted, {
155
- item: item
156
- });
148
+ export default /*#__PURE__*/ memo(function ChildProcess(item) {
149
+ return item.expanded ? /*#__PURE__*/ _jsx(Expanded, _object_spread({}, item)) : /*#__PURE__*/ _jsx(Contracted, _object_spread({}, item));
157
150
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import { Box, Text } from 'ink';\nimport { memo, useMemo } from 'react';\nimport ansiRegex from '../lib/ansiRegex.js';\nimport figures from '../lib/figures.js';\nimport type { ChildProcess as ChildProcessT, Line, State } from '../types.js';\nimport { LineType } from '../types.js';\nimport Spinner from './Spinner.js';\n\nconst REGEX_ANSI = ansiRegex();\nconst BLANK_LINE = { type: LineType.stdout, text: '' };\n\n// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2\nconst SPINNER = {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n};\n\nconst ICONS = {\n error: <Text color=\"red\">{figures.cross}</Text>,\n success: <Text color=\"green\">{figures.tick}</Text>,\n running: <Spinner {...SPINNER} />,\n};\n\ntype 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 <Box key={index} minHeight={1}>\n <Text>{line.text}</Text>\n </Box>\n );\n};\n\nconst Lines = memo(function Lines({ lines }: LinesProps) {\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n {lines.map(renderLine)}\n </Box>\n );\n});\n\nconst Expanded = memo(function Expanded({ item }: 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":["Box","Text","memo","useMemo","ansiRegex","figures","LineType","Spinner","REGEX_ANSI","BLANK_LINE","type","stdout","text","SPINNER","interval","frames","ICONS","error","color","cross","success","tick","running","Header","group","title","state","icon","bold","pointer","a","b","RunningSummary","line","marginLeft","replace","renderLine","index","minHeight","Lines","lines","flexDirection","map","Expanded","item","Contracted","errors","filter","stderr","summary","length","indexOf","pop","ChildProcess","expanded"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,MAAM;AAChC,SAASC,IAAI,EAAEC,OAAO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AM,EAAEU,QAAQ,EAAE,GAAGV;IACrB,OAAOU,yBAAW,KAACX;QAASC,MAAMA;uBAAW,KAACC;QAAWD,MAAMA;;AACjE,GAAG"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import { Box, Text } from 'ink';\nimport { memo, useMemo } from 'react';\nimport ansiRegex from '../lib/ansiRegex.js';\nimport figures from '../lib/figures.js';\nimport type { ChildProcess as ChildProcessT, Line, State } from '../types.js';\nimport { LineType } from '../types.js';\nimport Spinner from './Spinner.js';\n\nconst REGEX_ANSI = ansiRegex();\nconst BLANK_LINE = { type: LineType.stdout, text: '' };\n\n// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2\nconst SPINNER = {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n};\n\nconst ICONS = {\n error: <Text color=\"red\">{figures.cross}</Text>,\n success: <Text color=\"green\">{figures.tick}</Text>,\n running: <Spinner {...SPINNER} />,\n};\n\ntype HeaderProps = {\n group?: string;\n title: string;\n state: State;\n};\n\nconst Header = memo(\n function Header({ group, title, state }: HeaderProps) {\n const icon = ICONS[state];\n\n return (\n <Box>\n {icon}\n {group && <Text bold>{`${group}${figures.pointer} `}</Text>}\n <Text>{title}</Text>\n </Box>\n );\n },\n (a, b) => a.group === b.group && a.title === b.title && a.state === b.state\n);\n\ntype RunningSummaryProps = {\n line: Line;\n};\n\nconst RunningSummary = memo(function RunningSummary({ line }: RunningSummaryProps) {\n return (\n <Box marginLeft={2}>\n <Text color=\"gray\">{line.text.replace(REGEX_ANSI, '')}</Text>\n </Box>\n );\n});\n\ntype LinesProps = {\n lines: Line[];\n};\n\nconst renderLine = (line, index) => {\n return (\n <Box key={index} minHeight={1}>\n <Text>{line.text}</Text>\n </Box>\n );\n};\n\nconst Lines = memo(function Lines({ lines }: LinesProps) {\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n {lines.map(renderLine)}\n </Box>\n );\n});\n\nconst Expanded = memo(function Expanded(item: ChildProcessT) {\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n <Lines lines={item.lines} />\n </Box>\n );\n});\n\nconst Contracted = memo(function Contracted(item: ChildProcessT) {\n // remove ansi codes when displaying single lines\n const errors = useMemo(() => item.lines.filter((line) => line.type === LineType.stderr), [item.lines]);\n const summary = useMemo(() => item.lines.filter((line) => line.text.length > 0 && errors.indexOf(line) < 0).pop(), [item.lines, errors]);\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n {item.state === 'running' && <RunningSummary line={summary || BLANK_LINE} />}\n {errors.length > 0 && <Lines lines={errors} />}\n </Box>\n );\n});\n\nexport default memo(function ChildProcess(item: ChildProcessT) {\n return item.expanded ? <Expanded {...item} /> : <Contracted {...item} />;\n});\n"],"names":["Box","Text","memo","useMemo","ansiRegex","figures","LineType","Spinner","REGEX_ANSI","BLANK_LINE","type","stdout","text","SPINNER","interval","frames","ICONS","error","color","cross","success","tick","running","Header","group","title","state","icon","bold","pointer","a","b","RunningSummary","line","marginLeft","replace","renderLine","index","minHeight","Lines","lines","flexDirection","map","Expanded","item","Contracted","errors","filter","stderr","summary","length","indexOf","pop","ChildProcess","expanded"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,MAAM;AAChC,SAASC,IAAI,EAAEC,OAAO,QAAQ,QAAQ;AACtC,OAAOC,eAAe,sBAAsB;AAC5C,OAAOC,aAAa,oBAAoB;AAExC,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,aAAa,eAAe;AAEnC,MAAMC,aAAaJ;AACnB,MAAMK,aAAa;IAAEC,MAAMJ,SAASK,MAAM;IAAEC,MAAM;AAAG;AAErD,oHAAoH;AACpH,MAAMC,UAAU;IACdC,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eAAc;;0BACjB,KAAClB;gBAAOC,OAAOoB,KAAKpB,KAAK;gBAAEC,OAAOmB,KAAKnB,KAAK;gBAAEC,OAAOkB,KAAKlB,KAAK;;0BAC/D,KAACa;gBAAMC,OAAOI,KAAKJ,KAAK;;;;AAG9B;AAEA,MAAMK,2BAAa3C,KAAK,SAAS2C,WAAWD,IAAmB;IAC7D,iDAAiD;IACjD,MAAME,SAAS3C,QAAQ,IAAMyC,KAAKJ,KAAK,CAACO,MAAM,CAAC,CAACd,OAASA,KAAKvB,IAAI,KAAKJ,SAAS0C,MAAM,GAAG;QAACJ,KAAKJ,KAAK;KAAC;IACrG,MAAMS,UAAU9C,QAAQ,IAAMyC,KAAKJ,KAAK,CAACO,MAAM,CAAC,CAACd,OAASA,KAAKrB,IAAI,CAACsC,MAAM,GAAG,KAAKJ,OAAOK,OAAO,CAAClB,QAAQ,GAAGmB,GAAG,IAAI;QAACR,KAAKJ,KAAK;QAAEM;KAAO;IAEvI,qBACE,MAAC9C;QAAIyC,eAAc;;0BACjB,KAAClB;gBAAOC,OAAOoB,KAAKpB,KAAK;gBAAEC,OAAOmB,KAAKnB,KAAK;gBAAEC,OAAOkB,KAAKlB,KAAK;;YAC9DkB,KAAKlB,KAAK,KAAK,2BAAa,KAACM;gBAAeC,MAAMgB,WAAWxC;;YAC7DqC,OAAOI,MAAM,GAAG,mBAAK,KAACX;gBAAMC,OAAOM;;;;AAG1C;AAEA,6BAAe5C,KAAK,SAASmD,aAAaT,IAAmB;IAC3D,OAAOA,KAAKU,QAAQ,iBAAG,KAACX,6BAAaC,uBAAW,KAACC,+BAAeD;AAClE,GAAG"}
@@ -1,4 +1,4 @@
1
- import { default as Store } from './Store.js';
1
+ import Store from './state/ProcessStore.js';
2
2
  export type RetainCallback = (app: Store) => undefined;
3
3
  export type ReleaseCallback = () => undefined;
4
4
  export default function createApp(): {
@@ -1,37 +1,26 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render } from 'ink';
3
- import throttle from 'lodash.throttle';
4
3
  import App from './components/App.js';
5
- import { default as Store } from './Store.js';
6
- const THROTTLE = 100;
4
+ import { ProcessProvider } from './state/ProcessContext.js';
5
+ import Store from './state/ProcessStore.js';
7
6
  export default function createApp() {
8
7
  let refCount = 0;
9
8
  let store = null;
10
9
  let inkApp = null;
11
- let previousData = null;
12
- const rerender = ()=>{
13
- if (!inkApp || !store) return;
14
- if (store.data() === previousData) return;
15
- previousData = store.data();
16
- inkApp.rerender(/*#__PURE__*/ _jsx(App, {
17
- store: store
18
- }));
19
- };
20
- const rerenderThrottled = throttle(rerender, THROTTLE);
21
10
  return {
22
11
  retain (fn) {
23
12
  if (++refCount > 1) return fn(store);
24
13
  if (store) throw new Error('Not expecting store');
25
- store = new Store(rerenderThrottled);
26
- inkApp = render(/*#__PURE__*/ _jsx(App, {
27
- store: store
14
+ store = new Store();
15
+ inkApp = render(/*#__PURE__*/ _jsx(ProcessProvider, {
16
+ store: store,
17
+ children: /*#__PURE__*/ _jsx(App, {})
28
18
  }));
29
19
  fn(store);
30
20
  },
31
21
  release (cb) {
32
22
  if (--refCount > 0) return cb();
33
23
  if (!store) throw new Error('Expecting store');
34
- rerender();
35
24
  inkApp.waitUntilExit().then(()=>cb()).catch(cb);
36
25
  inkApp.unmount();
37
26
  inkApp = null;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createApp.tsx"],"sourcesContent":["import { type Instance, render } from 'ink';\nimport throttle from 'lodash.throttle';\nimport App from './components/App.js';\nimport { default as Store, type StoreData } from './Store.js';\n\nexport type RetainCallback = (app: Store) => undefined;\nexport type ReleaseCallback = () => undefined;\n\nconst THROTTLE = 100;\n\nexport default function createApp() {\n let refCount = 0;\n let store = null;\n let inkApp: Instance | null = null;\n\n let previousData: StoreData[] = null;\n const rerender = () => {\n if (!inkApp || !store) return;\n if (store.data() === previousData) return;\n previousData = store.data();\n inkApp.rerender(<App store={store} />);\n };\n const rerenderThrottled = throttle(rerender, THROTTLE);\n\n return {\n retain(fn: RetainCallback): undefined {\n if (++refCount > 1) return fn(store);\n if (store) throw new Error('Not expecting store');\n\n store = new Store(rerenderThrottled);\n inkApp = render(<App store={store} />);\n fn(store);\n },\n release(cb: ReleaseCallback): undefined {\n if (--refCount > 0) return cb();\n if (!store) throw new Error('Expecting store');\n\n rerender();\n inkApp\n .waitUntilExit()\n .then(() => cb())\n .catch(cb);\n inkApp.unmount();\n inkApp = null;\n store = null;\n process.stdout.write('\\x1b[?25h'); // show cursor\n },\n };\n}\n"],"names":["render","throttle","App","default","Store","THROTTLE","createApp","refCount","store","inkApp","previousData","rerender","data","rerenderThrottled","retain","fn","Error","release","cb","waitUntilExit","then","catch","unmount","process","stdout","write"],"mappings":";AAAA,SAAwBA,MAAM,QAAQ,MAAM;AAC5C,OAAOC,cAAc,kBAAkB;AACvC,OAAOC,SAAS,sBAAsB;AACtC,SAASC,WAAWC,KAAK,QAAwB,aAAa;AAK9D,MAAMC,WAAW;AAEjB,eAAe,SAASC;IACtB,IAAIC,WAAW;IACf,IAAIC,QAAQ;IACZ,IAAIC,SAA0B;IAE9B,IAAIC,eAA4B;IAChC,MAAMC,WAAW;QACf,IAAI,CAACF,UAAU,CAACD,OAAO;QACvB,IAAIA,MAAMI,IAAI,OAAOF,cAAc;QACnCA,eAAeF,MAAMI,IAAI;QACzBH,OAAOE,QAAQ,eAAC,KAACT;YAAIM,OAAOA;;IAC9B;IACA,MAAMK,oBAAoBZ,SAASU,UAAUN;IAE7C,OAAO;QACLS,QAAOC,EAAkB;YACvB,IAAI,EAAER,WAAW,GAAG,OAAOQ,GAAGP;YAC9B,IAAIA,OAAO,MAAM,IAAIQ,MAAM;YAE3BR,QAAQ,IAAIJ,MAAMS;YAClBJ,SAAST,qBAAO,KAACE;gBAAIM,OAAOA;;YAC5BO,GAAGP;QACL;QACAS,SAAQC,EAAmB;YACzB,IAAI,EAAEX,WAAW,GAAG,OAAOW;YAC3B,IAAI,CAACV,OAAO,MAAM,IAAIQ,MAAM;YAE5BL;YACAF,OACGU,aAAa,GACbC,IAAI,CAAC,IAAMF,MACXG,KAAK,CAACH;YACTT,OAAOa,OAAO;YACdb,SAAS;YACTD,QAAQ;YACRe,QAAQC,MAAM,CAACC,KAAK,CAAC,cAAc,cAAc;QACnD;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createApp.tsx"],"sourcesContent":["import { type Instance, render } from 'ink';\nimport App from './components/App.js';\nimport { ProcessProvider } from './state/ProcessContext.js';\nimport Store from './state/ProcessStore.js';\n\nexport type RetainCallback = (app: Store) => undefined;\nexport type ReleaseCallback = () => undefined;\n\nexport default function createApp() {\n let refCount = 0;\n let store = null;\n let inkApp: Instance | null = null;\n\n return {\n retain(fn: RetainCallback): undefined {\n if (++refCount > 1) return fn(store);\n if (store) throw new Error('Not expecting store');\n\n store = new Store();\n inkApp = render(\n <ProcessProvider store={store}>\n <App />\n </ProcessProvider>\n );\n fn(store);\n },\n release(cb: ReleaseCallback): undefined {\n if (--refCount > 0) return cb();\n if (!store) throw new Error('Expecting store');\n\n inkApp\n .waitUntilExit()\n .then(() => cb())\n .catch(cb);\n inkApp.unmount();\n inkApp = null;\n store = null;\n process.stdout.write('\\x1b[?25h'); // show cursor\n },\n };\n}\n"],"names":["render","App","ProcessProvider","Store","createApp","refCount","store","inkApp","retain","fn","Error","release","cb","waitUntilExit","then","catch","unmount","process","stdout","write"],"mappings":";AAAA,SAAwBA,MAAM,QAAQ,MAAM;AAC5C,OAAOC,SAAS,sBAAsB;AACtC,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,OAAOC,WAAW,0BAA0B;AAK5C,eAAe,SAASC;IACtB,IAAIC,WAAW;IACf,IAAIC,QAAQ;IACZ,IAAIC,SAA0B;IAE9B,OAAO;QACLC,QAAOC,EAAkB;YACvB,IAAI,EAAEJ,WAAW,GAAG,OAAOI,GAAGH;YAC9B,IAAIA,OAAO,MAAM,IAAII,MAAM;YAE3BJ,QAAQ,IAAIH;YACZI,SAASP,qBACP,KAACE;gBAAgBI,OAAOA;0BACtB,cAAA,KAACL;;YAGLQ,GAAGH;QACL;QACAK,SAAQC,EAAmB;YACzB,IAAI,EAAEP,WAAW,GAAG,OAAOO;YAC3B,IAAI,CAACN,OAAO,MAAM,IAAII,MAAM;YAE5BH,OACGM,aAAa,GACbC,IAAI,CAAC,IAAMF,MACXG,KAAK,CAACH;YACTL,OAAOS,OAAO;YACdT,SAAS;YACTD,QAAQ;YACRW,QAAQC,MAAM,CAACC,KAAK,CAAC,cAAc,cAAc;QACnD;IACF;AACF"}
@@ -0,0 +1,6 @@
1
+ export declare function ProcessProvider({ children, store }: {
2
+ children: any;
3
+ store: any;
4
+ }): import("react").JSX.Element;
5
+ export declare function useProcesses(): any;
6
+ export declare function useProcessDispatch(): any;
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useReducer } from 'react';
3
+ const ProcessContext = /*#__PURE__*/ createContext(null);
4
+ const ProcessDispatchContext = /*#__PURE__*/ createContext(null);
5
+ export function ProcessProvider({ children, store }) {
6
+ const [Process, dispatch] = useReducer(ProcessReducer, []);
7
+ store.on('added', (process)=>dispatch({
8
+ type: 'added',
9
+ process
10
+ }));
11
+ store.on('changed', (process)=>dispatch({
12
+ type: 'changed',
13
+ process
14
+ }));
15
+ return /*#__PURE__*/ _jsx(ProcessContext, {
16
+ value: Process,
17
+ children: /*#__PURE__*/ _jsx(ProcessDispatchContext, {
18
+ value: dispatch,
19
+ children: children
20
+ })
21
+ });
22
+ }
23
+ export function useProcesses() {
24
+ return useContext(ProcessContext);
25
+ }
26
+ export function useProcessDispatch() {
27
+ return useContext(ProcessDispatchContext);
28
+ }
29
+ function ProcessReducer(processes, action) {
30
+ switch(action.type){
31
+ case 'added':
32
+ {
33
+ if (processes.find((x)=>x.id === action.process.id)) {
34
+ console.log(`${action.process.id} process added a second time`);
35
+ return processes;
36
+ }
37
+ return [
38
+ ...processes,
39
+ action.process
40
+ ];
41
+ }
42
+ case 'changed':
43
+ {
44
+ return processes.map((x)=>x.id === action.process.id ? action.process : x);
45
+ }
46
+ default:
47
+ {
48
+ throw Error(`Unknown action: ${action.type}`);
49
+ }
50
+ }
51
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/state/ProcessContext.tsx"],"sourcesContent":["import { createContext, useContext, useReducer } from 'react';\n\nconst ProcessContext = createContext(null);\nconst ProcessDispatchContext = createContext(null);\n\nexport function ProcessProvider({ children, store }) {\n const [Process, dispatch] = useReducer(ProcessReducer, []);\n\n store.on('added', (process) => dispatch({ type: 'added', process }));\n store.on('changed', (process) => dispatch({ type: 'changed', process }));\n\n return (\n <ProcessContext value={Process}>\n <ProcessDispatchContext value={dispatch}>{children}</ProcessDispatchContext>\n </ProcessContext>\n );\n}\n\nexport function useProcesses() {\n return useContext(ProcessContext);\n}\n\nexport function useProcessDispatch() {\n return useContext(ProcessDispatchContext);\n}\n\nfunction ProcessReducer(processes, action) {\n switch (action.type) {\n case 'added': {\n if (processes.find((x) => x.id === action.process.id)) {\n console.log(`${action.process.id} process added a second time`);\n return processes;\n }\n return [...processes, action.process];\n }\n case 'changed': {\n return processes.map((x) => (x.id === action.process.id ? action.process : x));\n }\n default: {\n throw Error(`Unknown action: ${action.type}`);\n }\n }\n}\n"],"names":["createContext","useContext","useReducer","ProcessContext","ProcessDispatchContext","ProcessProvider","children","store","Process","dispatch","ProcessReducer","on","process","type","value","useProcesses","useProcessDispatch","processes","action","find","x","id","console","log","map","Error"],"mappings":";AAAA,SAASA,aAAa,EAAEC,UAAU,EAAEC,UAAU,QAAQ,QAAQ;AAE9D,MAAMC,+BAAiBH,cAAc;AACrC,MAAMI,uCAAyBJ,cAAc;AAE7C,OAAO,SAASK,gBAAgB,EAAEC,QAAQ,EAAEC,KAAK,EAAE;IACjD,MAAM,CAACC,SAASC,SAAS,GAAGP,WAAWQ,gBAAgB,EAAE;IAEzDH,MAAMI,EAAE,CAAC,SAAS,CAACC,UAAYH,SAAS;YAAEI,MAAM;YAASD;QAAQ;IACjEL,MAAMI,EAAE,CAAC,WAAW,CAACC,UAAYH,SAAS;YAAEI,MAAM;YAAWD;QAAQ;IAErE,qBACE,KAACT;QAAeW,OAAON;kBACrB,cAAA,KAACJ;YAAuBU,OAAOL;sBAAWH;;;AAGhD;AAEA,OAAO,SAASS;IACd,OAAOd,WAAWE;AACpB;AAEA,OAAO,SAASa;IACd,OAAOf,WAAWG;AACpB;AAEA,SAASM,eAAeO,SAAS,EAAEC,MAAM;IACvC,OAAQA,OAAOL,IAAI;QACjB,KAAK;YAAS;gBACZ,IAAII,UAAUE,IAAI,CAAC,CAACC,IAAMA,EAAEC,EAAE,KAAKH,OAAON,OAAO,CAACS,EAAE,GAAG;oBACrDC,QAAQC,GAAG,CAAC,GAAGL,OAAON,OAAO,CAACS,EAAE,CAAC,4BAA4B,CAAC;oBAC9D,OAAOJ;gBACT;gBACA,OAAO;uBAAIA;oBAAWC,OAAON,OAAO;iBAAC;YACvC;QACA,KAAK;YAAW;gBACd,OAAOK,UAAUO,GAAG,CAAC,CAACJ,IAAOA,EAAEC,EAAE,KAAKH,OAAON,OAAO,CAACS,EAAE,GAAGH,OAAON,OAAO,GAAGQ;YAC7E;QACA;YAAS;gBACP,MAAMK,MAAM,CAAC,gBAAgB,EAAEP,OAAOL,IAAI,EAAE;YAC9C;IACF;AACF"}
@@ -0,0 +1,8 @@
1
+ import { EventEmitter } from 'events';
2
+ import type { ChildProcess, ChildProcessUpdate } from '../types.js';
3
+ export default class ProcessStore extends EventEmitter {
4
+ processes: ChildProcess[];
5
+ constructor();
6
+ add(process: ChildProcess): ChildProcess;
7
+ update(id: string, update: ChildProcessUpdate): void;
8
+ }
@@ -0,0 +1,22 @@
1
+ import { EventEmitter } from 'events';
2
+ class ProcessStore extends EventEmitter {
3
+ add(process) {
4
+ this.processes.push(process);
5
+ this.emit('added', process);
6
+ return process;
7
+ }
8
+ update(id, update) {
9
+ const found = this.processes.find((x)=>x.id === id);
10
+ if (!found) {
11
+ console.log(`Process ${id} not found`);
12
+ return;
13
+ }
14
+ Object.assign(found, update);
15
+ this.emit('changed', found);
16
+ }
17
+ constructor(){
18
+ super(), this.processes = [];
19
+ if (this.setMaxListeners) this.setMaxListeners(Infinity);
20
+ }
21
+ }
22
+ export { ProcessStore as default };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/state/ProcessStore.ts"],"sourcesContent":["import { EventEmitter } from 'events';\nimport type { ChildProcess, ChildProcessUpdate } from '../types.js';\n\nexport default class ProcessStore extends EventEmitter {\n processes: ChildProcess[] = [];\n\n constructor() {\n super();\n if (this.setMaxListeners) this.setMaxListeners(Infinity);\n }\n\n add(process: ChildProcess): ChildProcess {\n this.processes.push(process);\n this.emit('added', process);\n return process;\n }\n\n update(id: string, update: ChildProcessUpdate): void {\n const found = this.processes.find((x) => x.id === id);\n if (!found) {\n console.log(`Process ${id} not found`);\n return;\n }\n Object.assign(found, update);\n this.emit('changed', found);\n }\n}\n"],"names":["EventEmitter","ProcessStore","add","process","processes","push","emit","update","id","found","find","x","console","log","Object","assign","setMaxListeners","Infinity"],"mappings":"AAAA,SAASA,YAAY,QAAQ,SAAS;AAGvB,MAAMC,qBAAqBD;IAQxCE,IAAIC,OAAqB,EAAgB;QACvC,IAAI,CAACC,SAAS,CAACC,IAAI,CAACF;QACpB,IAAI,CAACG,IAAI,CAAC,SAASH;QACnB,OAAOA;IACT;IAEAI,OAAOC,EAAU,EAAED,MAA0B,EAAQ;QACnD,MAAME,QAAQ,IAAI,CAACL,SAAS,CAACM,IAAI,CAAC,CAACC,IAAMA,EAAEH,EAAE,KAAKA;QAClD,IAAI,CAACC,OAAO;YACVG,QAAQC,GAAG,CAAC,CAAC,QAAQ,EAAEL,GAAG,UAAU,CAAC;YACrC;QACF;QACAM,OAAOC,MAAM,CAACN,OAAOF;QACrB,IAAI,CAACD,IAAI,CAAC,WAAWG;IACvB;IAnBA,aAAc;QACZ,KAAK,SAHPL,YAA4B,EAAE;QAI5B,IAAI,IAAI,CAACY,eAAe,EAAE,IAAI,CAACA,eAAe,CAACC;IACjD;AAiBF;AAvBA,SAAqBhB,0BAuBpB"}
@@ -22,3 +22,10 @@ export type ChildProcess = {
22
22
  lines: Line[];
23
23
  expanded?: boolean;
24
24
  };
25
+ export type ChildProcessUpdate = {
26
+ group?: string;
27
+ title?: string;
28
+ state?: State;
29
+ lines?: Line[];
30
+ expanded?: boolean;
31
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["export type { SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from 'cross-spawn-cb';\n\nimport type { SpawnError, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: boolean;\n};\n\nexport type TerminalCallback = (error?: SpawnError, result?: SpawnResult) => undefined;\n\nexport const LineType = {\n stdout: 1,\n stderr: 2,\n} as const;\n\nexport type Line = {\n type: (typeof LineType)[keyof typeof LineType];\n text: string;\n};\n\nexport type State = 'running' | 'error' | 'success';\nexport type ChildProcess = {\n id: string;\n group?: string;\n title: string;\n state: State;\n lines: Line[];\n expanded?: boolean;\n};\n"],"names":["LineType","stdout","stderr"],"mappings":"AAWA,OAAO,MAAMA,WAAW;IACtBC,QAAQ;IACRC,QAAQ;AACV,EAAW"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/types.ts"],"sourcesContent":["export type { SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from 'cross-spawn-cb';\n\nimport type { SpawnError, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: boolean;\n};\n\nexport type TerminalCallback = (error?: SpawnError, result?: SpawnResult) => undefined;\n\nexport const LineType = {\n stdout: 1,\n stderr: 2,\n} as const;\n\nexport type Line = {\n type: (typeof LineType)[keyof typeof LineType];\n text: string;\n};\n\nexport type State = 'running' | 'error' | 'success';\nexport type ChildProcess = {\n id: string;\n group?: string;\n title: string;\n state: State;\n lines: Line[];\n expanded?: boolean;\n};\nexport type ChildProcessUpdate = {\n group?: string;\n title?: string;\n state?: State;\n lines?: Line[];\n expanded?: boolean;\n};\n"],"names":["LineType","stdout","stderr"],"mappings":"AAWA,OAAO,MAAMA,WAAW;IACtBC,QAAQ;IACRC,QAAQ;AACV,EAAW"}
@@ -95,7 +95,7 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
95
95
  if (stdio === 'inherit') {
96
96
  terminal.retain((store)=>{
97
97
  const id = crypto.randomUUID();
98
- store.addProcess(_object_spread({
98
+ store.add(_object_spread({
99
99
  id,
100
100
  title: [
101
101
  command
@@ -112,12 +112,12 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
112
112
  if (cp.stdout) {
113
113
  outputs.stdout = addLines((lines)=>{
114
114
  const item = store.processes.find((x)=>x.id === id);
115
- store.updateProcess(_object_spread_props(_object_spread({}, item), {
115
+ store.update(id, {
116
116
  lines: item.lines.concat(lines.map((text)=>({
117
117
  type: LineType.stdout,
118
118
  text
119
119
  })))
120
- }));
120
+ });
121
121
  });
122
122
  queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), [
123
123
  'error',
@@ -129,12 +129,12 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
129
129
  if (cp.stderr) {
130
130
  outputs.stderr = addLines((lines)=>{
131
131
  const item = store.processes.find((x)=>x.id === id);
132
- store.updateProcess(_object_spread_props(_object_spread({}, item), {
132
+ store.update(id, {
133
133
  lines: item.lines.concat(lines.map((text)=>({
134
134
  type: LineType.stderr,
135
135
  text
136
136
  })))
137
- }));
137
+ });
138
138
  });
139
139
  queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), [
140
140
  'error',
@@ -155,10 +155,9 @@ export default function spawnTerminal(command, args, spawnOptions, options, call
155
155
  res.stderr,
156
156
  null
157
157
  ];
158
- const item = store.processes.find((x)=>x.id === id);
159
- store.updateProcess(_object_spread_props(_object_spread({}, item), {
158
+ store.update(id, {
160
159
  state: err ? 'error' : 'success'
161
- }));
160
+ });
162
161
  // ensure rendering completes
163
162
  terminal.release(()=>{
164
163
  err ? callback(err) : callback(null, res);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["import spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport crypto from 'crypto';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp.js';\nimport addLines from './lib/addLines.js';\nimport concatWritable from './lib/concatWritable.js';\nimport formatArguments from './lib/formatArguments.js';\n\nimport type { SpawnError, SpawnOptions, TerminalCallback, TerminalOptions } from './types.js';\nimport { LineType } from './types.js';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback: TerminalCallback): undefined {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = crypto.randomUUID();\n store.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((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.updateProcess({ ...item, lines: item.lines.concat(lines.map((text) => ({ type: LineType.stdout, text }))) });\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.updateProcess({ ...item, lines: item.lines.concat(lines.map((text) => ({ type: LineType.stderr, text }))) });\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n const item = store.processes.find((x) => x.id === id);\n store.updateProcess({ ...item, state: err ? 'error' : 'success' });\n\n // ensure rendering completes\n terminal.release(() => {\n err ? callback(err) : callback(null, res);\n });\n });\n });\n } else {\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = concatWritable((output) => {\n outputs.stdout.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = concatWritable((output) => {\n outputs.stderr.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: encoding || 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n err ? callback(err) : callback(null, res);\n });\n }\n}\n"],"names":["spawn","crossSpawn","crypto","oo","Queue","createApp","addLines","concatWritable","formatArguments","LineType","terminal","spawnTerminal","command","args","spawnOptions","options","callback","encoding","stdio","csOptions","retain","store","id","randomUUID","addProcess","title","concat","join","state","lines","cp","outputs","stdout","stderr","queue","item","processes","find","x","updateProcess","map","text","type","defer","bind","pipe","worker","await","err","res","output","release","toString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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gBAAEiB,IAAIhB,MAAM;gBAAE;aAAK;YAC3Ce,MAAMhC,SAASgC,OAAOhC,SAAS,MAAMiC;QACvC;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/worker.ts"],"sourcesContent":["import spawn, { crossSpawn, type SpawnResult } from 'cross-spawn-cb';\nimport crypto from 'crypto';\nimport oo from 'on-one';\nimport Queue from 'queue-cb';\n\nimport createApp from './createApp.js';\nimport addLines from './lib/addLines.js';\nimport concatWritable from './lib/concatWritable.js';\nimport formatArguments from './lib/formatArguments.js';\n\nimport type { SpawnError, SpawnOptions, TerminalCallback, TerminalOptions } from './types.js';\nimport { LineType } from './types.js';\n\nconst terminal = createApp();\n\nexport default function spawnTerminal(command: string, args: string[], spawnOptions: SpawnOptions, options: TerminalOptions, callback: TerminalCallback): undefined {\n const { encoding, stdio, ...csOptions } = spawnOptions;\n\n if (stdio === 'inherit') {\n terminal.retain((store) => {\n const id = crypto.randomUUID();\n store.add({ id, title: [command].concat(formatArguments(args)).join(' '), state: 'running', lines: [], ...options });\n\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.update(id, { lines: item.lines.concat(lines.map((text) => ({ type: LineType.stdout, text }))) });\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = addLines((lines) => {\n const item = store.processes.find((x) => x.id === id);\n store.update(id, { lines: item.lines.concat(lines.map((text) => ({ type: LineType.stderr, text }))) });\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n store.update(id, { state: err ? 'error' : 'success' });\n\n // ensure rendering completes\n terminal.release(() => {\n err ? callback(err) : callback(null, res);\n });\n });\n });\n } else {\n const cp = crossSpawn(command, args, csOptions);\n const outputs = { stdout: null, stderr: null };\n\n const queue = new Queue();\n if (cp.stdout) {\n outputs.stdout = concatWritable((output) => {\n outputs.stdout.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stdout.pipe(outputs.stdout), ['error', 'end', 'close', 'finish']));\n }\n if (cp.stderr) {\n outputs.stderr = concatWritable((output) => {\n outputs.stderr.output = output.toString(encoding || 'utf8');\n });\n queue.defer(oo.bind(null, cp.stderr.pipe(outputs.stderr), ['error', 'end', 'close', 'finish']));\n }\n queue.defer(spawn.worker.bind(null, cp, { ...csOptions, encoding: encoding || 'utf8' }));\n queue.await((err?: SpawnError) => {\n const res = (err ? err : {}) as SpawnResult;\n res.stdout = outputs.stdout ? outputs.stdout.output : null;\n res.stderr = outputs.stderr ? outputs.stderr.output : null;\n res.output = [res.stdout, res.stderr, null];\n err ? callback(err) : callback(null, res);\n });\n }\n}\n"],"names":["spawn","crossSpawn","crypto","oo","Queue","createApp","addLines","concatWritable","formatArguments","LineType","terminal","spawnTerminal","command","args","spawnOptions","options","callback","encoding","stdio","csOptions","retain","store","id","randomUUID","add","title","concat","join","state","lines","cp","outputs","stdout","stderr","queue","item","processes","find","x","update","map","text","type","defer","bind","pipe","worker","await","err","res","output","release","toString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAASC,UAAU,QAA0B,iBAAiB;AACrE,OAAOC,YAAY,SAAS;AAC5B,OAAOC,QAAQ,SAAS;AACxB,OAAOC,WAAW,WAAW;AAE7B,OAAOC,eAAe,iBAAiB;AACv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M,EAAE;YACbD,QAAQC,MAAM,GAAGzB,eAAe,CAAC2C;gBAC/BnB,QAAQC,MAAM,CAACkB,MAAM,GAAGA,OAAOE,QAAQ,CAACnC,YAAY;YACtD;YACAiB,MAAMS,KAAK,CAACxC,GAAGyC,IAAI,CAAC,MAAMd,GAAGE,MAAM,CAACa,IAAI,CAACd,QAAQC,MAAM,GAAG;gBAAC;gBAAS;gBAAO;gBAAS;aAAS;QAC/F;QACA,IAAIF,GAAGG,MAAM,EAAE;YACbF,QAAQE,MAAM,GAAG1B,eAAe,CAAC2C;gBAC/BnB,QAAQE,MAAM,CAACiB,MAAM,GAAGA,OAAOE,QAAQ,CAACnC,YAAY;YACtD;YACAiB,MAAMS,KAAK,CAACxC,GAAGyC,IAAI,CAAC,MAAMd,GAAGG,MAAM,CAACY,IAAI,CAACd,QAAQE,MAAM,GAAG;gBAAC;gBAAS;gBAAO;gBAAS;aAAS;QAC/F;QACAC,MAAMS,KAAK,CAAC3C,MAAM8C,MAAM,CAACF,IAAI,CAAC,MAAMd,IAAI,wCAAKX;YAAWF,UAAUA,YAAY;;QAC9EiB,MAAMa,KAAK,CAAC,CAACC;YACX,MAAMC,MAAOD,MAAMA,MAAM,CAAC;YAC1BC,IAAIjB,MAAM,GAAGD,QAAQC,MAAM,GAAGD,QAAQC,MAAM,CAACkB,MAAM,GAAG;YACtDD,IAAIhB,MAAM,GAAGF,QAAQE,MAAM,GAAGF,QAAQE,MAAM,CAACiB,MAAM,GAAG;YACtDD,IAAIC,MAAM,GAAG;gBAACD,IAAIjB,MAAM;gBAAEiB,IAAIhB,MAAM;gBAAE;aAAK;YAC3Ce,MAAMhC,SAASgC,OAAOhC,SAAS,MAAMiC;QACvC;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawn-term",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Formats spawn with for terminal grouping",
5
5
  "keywords": [
6
6
  "spawn",
@@ -42,7 +42,6 @@
42
42
  "dependencies": {
43
43
  "cross-spawn-cb": "^2.2.9",
44
44
  "ink": "^6.0.0",
45
- "lodash.throttle": "^4.1.1",
46
45
  "on-one": "^0.1.8",
47
46
  "queue-cb": "^1.5.3",
48
47
  "react": "^19.1.0"
@@ -1,11 +0,0 @@
1
- import type { ChildProcess } from './types.ts';
2
- export type RenderFunction = () => void;
3
- export type StoreData = ChildProcess[];
4
- export default class Store {
5
- processes: ChildProcess[];
6
- onRender: RenderFunction;
7
- constructor(onRender: RenderFunction);
8
- data(): StoreData;
9
- addProcess(process: ChildProcess): void;
10
- updateProcess(process: ChildProcess): void;
11
- }
@@ -1,11 +0,0 @@
1
- import type { ChildProcess } from './types.ts';
2
- export type RenderFunction = () => void;
3
- export type StoreData = ChildProcess[];
4
- export default class Store {
5
- processes: ChildProcess[];
6
- onRender: RenderFunction;
7
- constructor(onRender: RenderFunction);
8
- data(): StoreData;
9
- addProcess(process: ChildProcess): void;
10
- updateProcess(process: ChildProcess): void;
11
- }