spawn-term 0.1.46 → 0.1.48

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.
@@ -8,25 +8,14 @@ Object.defineProperty(exports, "default", {
8
8
  return addLines;
9
9
  }
10
10
  });
11
- var _newlineiterator = /*#__PURE__*/ _interop_require_default(require("newline-iterator"));
12
11
  var _readablestream = require("readable-stream");
13
- function _interop_require_default(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
16
- };
17
- }
12
+ var REGEX_NEW_LINE = /\r?\n|\r/g;
18
13
  function addLines(fn) {
19
14
  var last = '';
20
15
  var stream = new _readablestream.Writable({
21
16
  write: function write(chunk, _enc, callback) {
22
- var string = last + chunk.toString('utf8');
23
- var lines = [];
24
- var iterator = (0, _newlineiterator.default)(string);
25
- var next = iterator.next();
26
- while(!next.done){
27
- lines.push(next.value);
28
- next = iterator.next();
29
- }
17
+ var more = last + chunk.toString('utf8');
18
+ var lines = more.split(REGEX_NEW_LINE);
30
19
  last = lines.pop();
31
20
  if (lines.length > 0) fn(lines);
32
21
  callback();
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/addLines.ts"],"sourcesContent":["import newlineIterator from 'newline-iterator';\nimport { Writable } from 'readable-stream';\n\nexport default function addLines(fn) {\n let last = '';\n\n const stream = new Writable({\n write(chunk, _enc, callback) {\n const string = last + chunk.toString('utf8');\n\n const lines = [];\n const iterator = newlineIterator(string);\n let next = iterator.next();\n while (!next.done) {\n lines.push(next.value);\n next = iterator.next();\n }\n\n last = lines.pop();\n if (lines.length > 0) fn(lines);\n callback();\n },\n });\n stream.on('finish', () => {\n if (last.length) fn([last]);\n last = '';\n });\n return stream;\n}\n"],"names":["addLines","fn","last","stream","Writable","write","chunk","_enc","callback","string","toString","lines","iterator","newlineIterator","next","done","push","value","pop","length","on"],"mappings":";;;;+BAGA;;;eAAwBA;;;sEAHI;8BACH;;;;;;AAEV,SAASA,SAASC,EAAE;IACjC,IAAIC,OAAO;IAEX,IAAMC,SAAS,IAAIC,wBAAQ,CAAC;QAC1BC,OAAAA,SAAAA,MAAMC,KAAK,EAAEC,IAAI,EAAEC,QAAQ;YACzB,IAAMC,SAASP,OAAOI,MAAMI,QAAQ,CAAC;YAErC,IAAMC,QAAQ,EAAE;YAChB,IAAMC,WAAWC,IAAAA,wBAAe,EAACJ;YACjC,IAAIK,OAAOF,SAASE,IAAI;YACxB,MAAO,CAACA,KAAKC,IAAI,CAAE;gBACjBJ,MAAMK,IAAI,CAACF,KAAKG,KAAK;gBACrBH,OAAOF,SAASE,IAAI;YACtB;YAEAZ,OAAOS,MAAMO,GAAG;YAChB,IAAIP,MAAMQ,MAAM,GAAG,GAAGlB,GAAGU;YACzBH;QACF;IACF;IACAL,OAAOiB,EAAE,CAAC,UAAU;QAClB,IAAIlB,KAAKiB,MAAM,EAAElB,GAAG;YAACC;SAAK;QAC1BA,OAAO;IACT;IACA,OAAOC;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/addLines.ts"],"sourcesContent":["import { Writable } from 'readable-stream';\n\nconst REGEX_NEW_LINE = /\\r?\\n|\\r/g;\n\nexport default function addLines(fn) {\n let last = '';\n\n const stream = new Writable({\n write(chunk, _enc, callback) {\n const more = last + chunk.toString('utf8');\n const lines = more.split(REGEX_NEW_LINE);\n last = lines.pop();\n if (lines.length > 0) fn(lines);\n callback();\n },\n });\n stream.on('finish', () => {\n if (last.length) fn([last]);\n last = '';\n });\n return stream;\n}\n"],"names":["addLines","REGEX_NEW_LINE","fn","last","stream","Writable","write","chunk","_enc","callback","more","toString","lines","split","pop","length","on"],"mappings":";;;;+BAIA;;;eAAwBA;;;8BAJC;AAEzB,IAAMC,iBAAiB;AAER,SAASD,SAASE,EAAE;IACjC,IAAIC,OAAO;IAEX,IAAMC,SAAS,IAAIC,wBAAQ,CAAC;QAC1BC,OAAAA,SAAAA,MAAMC,KAAK,EAAEC,IAAI,EAAEC,QAAQ;YACzB,IAAMC,OAAOP,OAAOI,MAAMI,QAAQ,CAAC;YACnC,IAAMC,QAAQF,KAAKG,KAAK,CAACZ;YACzBE,OAAOS,MAAME,GAAG;YAChB,IAAIF,MAAMG,MAAM,GAAG,GAAGb,GAAGU;YACzBH;QACF;IACF;IACAL,OAAOY,EAAE,CAAC,UAAU;QAClB,IAAIb,KAAKY,MAAM,EAAEb,GAAG;YAACC;SAAK;QAC1BA,OAAO;IACT;IACA,OAAOC;AACT"}
@@ -9,9 +9,8 @@ Object.defineProperty(exports, "LineType", {
9
9
  return LineType;
10
10
  }
11
11
  });
12
- var LineType = /*#__PURE__*/ function(LineType) {
13
- LineType[LineType["stdout"] = 1] = "stdout";
14
- LineType[LineType["stderr"] = 2] = "stderr";
15
- return LineType;
16
- }({});
12
+ var LineType = {
13
+ stdout: 1,
14
+ stderr: 2
15
+ };
17
16
  /* 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/types.ts"],"sourcesContent":["// @ts-ignore\nexport type { SpawnOptions, SpawnCallback, SpawnResult } from 'cross-spawn-cb';\n\nexport type TerminalOptions = {\n group?: string;\n expanded?: string;\n};\n\nexport enum LineType {\n stdout = 1,\n stderr = 2,\n}\nexport type Line = {\n type: 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"],"mappings":"AAAA,aAAa;;;;;+BAQDA;;;eAAAA;;;AAAL,IAAA,AAAKA,kCAAAA;;;WAAAA"}
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?: string;\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,17 +1,11 @@
1
- import newlineIterator from 'newline-iterator';
2
1
  import { Writable } from 'readable-stream';
2
+ const REGEX_NEW_LINE = /\r?\n|\r/g;
3
3
  export default function addLines(fn) {
4
4
  let last = '';
5
5
  const stream = new Writable({
6
6
  write (chunk, _enc, callback) {
7
- const string = last + chunk.toString('utf8');
8
- const lines = [];
9
- const iterator = newlineIterator(string);
10
- let next = iterator.next();
11
- while(!next.done){
12
- lines.push(next.value);
13
- next = iterator.next();
14
- }
7
+ const more = last + chunk.toString('utf8');
8
+ const lines = more.split(REGEX_NEW_LINE);
15
9
  last = lines.pop();
16
10
  if (lines.length > 0) fn(lines);
17
11
  callback();
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/addLines.ts"],"sourcesContent":["import newlineIterator from 'newline-iterator';\nimport { Writable } from 'readable-stream';\n\nexport default function addLines(fn) {\n let last = '';\n\n const stream = new Writable({\n write(chunk, _enc, callback) {\n const string = last + chunk.toString('utf8');\n\n const lines = [];\n const iterator = newlineIterator(string);\n let next = iterator.next();\n while (!next.done) {\n lines.push(next.value);\n next = iterator.next();\n }\n\n last = lines.pop();\n if (lines.length > 0) fn(lines);\n callback();\n },\n });\n stream.on('finish', () => {\n if (last.length) fn([last]);\n last = '';\n });\n return stream;\n}\n"],"names":["newlineIterator","Writable","addLines","fn","last","stream","write","chunk","_enc","callback","string","toString","lines","iterator","next","done","push","value","pop","length","on"],"mappings":"AAAA,OAAOA,qBAAqB,mBAAmB;AAC/C,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,eAAe,SAASC,SAASC,EAAE;IACjC,IAAIC,OAAO;IAEX,MAAMC,SAAS,IAAIJ,SAAS;QAC1BK,OAAMC,KAAK,EAAEC,IAAI,EAAEC,QAAQ;YACzB,MAAMC,SAASN,OAAOG,MAAMI,QAAQ,CAAC;YAErC,MAAMC,QAAQ,EAAE;YAChB,MAAMC,WAAWb,gBAAgBU;YACjC,IAAII,OAAOD,SAASC,IAAI;YACxB,MAAO,CAACA,KAAKC,IAAI,CAAE;gBACjBH,MAAMI,IAAI,CAACF,KAAKG,KAAK;gBACrBH,OAAOD,SAASC,IAAI;YACtB;YAEAV,OAAOQ,MAAMM,GAAG;YAChB,IAAIN,MAAMO,MAAM,GAAG,GAAGhB,GAAGS;YACzBH;QACF;IACF;IACAJ,OAAOe,EAAE,CAAC,UAAU;QAClB,IAAIhB,KAAKe,MAAM,EAAEhB,GAAG;YAACC;SAAK;QAC1BA,OAAO;IACT;IACA,OAAOC;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/addLines.ts"],"sourcesContent":["import { Writable } from 'readable-stream';\n\nconst REGEX_NEW_LINE = /\\r?\\n|\\r/g;\n\nexport default function addLines(fn) {\n let last = '';\n\n const stream = new Writable({\n write(chunk, _enc, callback) {\n const more = last + chunk.toString('utf8');\n const lines = more.split(REGEX_NEW_LINE);\n last = lines.pop();\n if (lines.length > 0) fn(lines);\n callback();\n },\n });\n stream.on('finish', () => {\n if (last.length) fn([last]);\n last = '';\n });\n return stream;\n}\n"],"names":["Writable","REGEX_NEW_LINE","addLines","fn","last","stream","write","chunk","_enc","callback","more","toString","lines","split","pop","length","on"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,kBAAkB;AAE3C,MAAMC,iBAAiB;AAEvB,eAAe,SAASC,SAASC,EAAE;IACjC,IAAIC,OAAO;IAEX,MAAMC,SAAS,IAAIL,SAAS;QAC1BM,OAAMC,KAAK,EAAEC,IAAI,EAAEC,QAAQ;YACzB,MAAMC,OAAON,OAAOG,MAAMI,QAAQ,CAAC;YACnC,MAAMC,QAAQF,KAAKG,KAAK,CAACZ;YACzBG,OAAOQ,MAAME,GAAG;YAChB,IAAIF,MAAMG,MAAM,GAAG,GAAGZ,GAAGS;YACzBH;QACF;IACF;IACAJ,OAAOW,EAAE,CAAC,UAAU;QAClB,IAAIZ,KAAKW,MAAM,EAAEZ,GAAG;YAACC;SAAK;QAC1BA,OAAO;IACT;IACA,OAAOC;AACT"}
@@ -1,6 +1,5 @@
1
1
  // @ts-ignore
2
- export var LineType = /*#__PURE__*/ function(LineType) {
3
- LineType[LineType["stdout"] = 1] = "stdout";
4
- LineType[LineType["stderr"] = 2] = "stderr";
5
- return LineType;
6
- }({});
2
+ export const LineType = {
3
+ stdout: 1,
4
+ stderr: 2
5
+ };
@@ -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?: string;\n};\n\nexport enum LineType {\n stdout = 1,\n stderr = 2,\n}\nexport type Line = {\n type: 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"],"mappings":"AAAA,aAAa;AAQb,OAAO,IAAA,AAAKA,kCAAAA;;;WAAAA;MAGX"}
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?: string;\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"}
@@ -3,12 +3,12 @@ export type TerminalOptions = {
3
3
  group?: string;
4
4
  expanded?: string;
5
5
  };
6
- export declare enum LineType {
7
- stdout = 1,
8
- stderr = 2
9
- }
6
+ export declare const LineType: {
7
+ readonly stdout: 1;
8
+ readonly stderr: 2;
9
+ };
10
10
  export type Line = {
11
- type: LineType;
11
+ type: (typeof LineType)[keyof typeof LineType];
12
12
  text: string;
13
13
  };
14
14
  export type State = 'running' | 'error' | 'success';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawn-term",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "description": "Formats spawn with for terminal grouping",
5
5
  "keywords": [
6
6
  "spawn",
@@ -43,7 +43,6 @@
43
43
  "core-js": "^3.40.0",
44
44
  "cross-spawn-cb": "^2.1.22",
45
45
  "lil-uuid": "^0.1.1",
46
- "newline-iterator": "^0.3.29",
47
46
  "on-one": "^0.1.4",
48
47
  "queue-cb": "^1.4.16",
49
48
  "react": "^18.3.1",