spawn-term 3.5.1 → 3.5.2

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.
@@ -9,14 +9,6 @@ Object.defineProperty(exports, "TerminalBuffer", {
9
9
  }
10
10
  });
11
11
  var _terminalmodel = require("terminal-model");
12
- function _array_like_to_array(arr, len) {
13
- if (len == null || len > arr.length) len = arr.length;
14
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
15
- return arr2;
16
- }
17
- function _array_without_holes(arr) {
18
- if (Array.isArray(arr)) return _array_like_to_array(arr);
19
- }
20
12
  function _class_call_check(instance, Constructor) {
21
13
  if (!(instance instanceof Constructor)) {
22
14
  throw new TypeError("Cannot call a class as a function");
@@ -36,23 +28,6 @@ function _create_class(Constructor, protoProps, staticProps) {
36
28
  if (staticProps) _defineProperties(Constructor, staticProps);
37
29
  return Constructor;
38
30
  }
39
- function _iterable_to_array(iter) {
40
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
41
- }
42
- function _non_iterable_spread() {
43
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
- }
45
- function _to_consumable_array(arr) {
46
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
47
- }
48
- function _unsupported_iterable_to_array(o, minLen) {
49
- if (!o) return;
50
- if (typeof o === "string") return _array_like_to_array(o, minLen);
51
- var n = Object.prototype.toString.call(o).slice(8, -1);
52
- if (n === "Object" && o.constructor) n = o.constructor.name;
53
- if (n === "Map" || n === "Set") return Array.from(n);
54
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
55
- }
56
31
  var TerminalBuffer = /*#__PURE__*/ function() {
57
32
  "use strict";
58
33
  function TerminalBuffer(_cols) {
@@ -99,7 +74,7 @@ var TerminalBuffer = /*#__PURE__*/ function() {
99
74
  }
100
75
  // Return copy of all lines WITHOUT trimStart() or trimming blank lines
101
76
  // Preserves all whitespace, indentation, and blank lines
102
- return _to_consumable_array(this.allLines);
77
+ return this.allLines.slice();
103
78
  };
104
79
  /**
105
80
  * Clean up terminal resources.
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/TerminalBuffer.ts"],"sourcesContent":["import { StreamingTerminal } from 'terminal-model';\n\n/**\n * Wrapper around terminal-model's StreamingTerminal that provides a virtual terminal buffer.\n * Interprets ANSI escape sequences (cursor movement, line clearing, etc.) to produce\n * the actual rendered output rather than raw intermediate states.\n *\n * This implementation preserves whitespace and blank lines by NOT calling trimStart(),\n * which was the bug in the previous xterm-based implementation.\n */\nexport class TerminalBuffer {\n private terminal: StreamingTerminal;\n private allLines: string[] = [];\n\n constructor(_cols: number, _scrollback = 10000) {\n // terminal-model doesn't enforce column width during parsing\n // It preserves all content as-is\n this.terminal = new StreamingTerminal();\n\n // Listen for completed lines (when \\n is encountered)\n this.terminal.setLineReadyCallback(() => {\n const line = this.terminal.renderLine();\n this.terminal.reset();\n this.allLines.push(line);\n });\n }\n\n /**\n * Write raw data to the terminal buffer.\n * The terminal interprets all ANSI sequences automatically.\n */\n write(data: string | Buffer): void {\n this.terminal.write(data);\n }\n\n /**\n * Resize the terminal width.\n * terminal-model doesn't use column constraints, so this is a no-op for compatibility.\n */\n resize(_cols: number): void {\n // No-op - terminal-model doesn't enforce column width\n }\n\n /**\n * Extract the rendered lines from the terminal buffer.\n * This returns the actual visible content after all ANSI sequences\n * have been processed, with color codes preserved.\n *\n * CRITICAL: Unlike the xterm implementation, we do NOT call trimStart(),\n * which preserves legitimate indentation and blank lines.\n */\n getLines(): string[] {\n // Flush any pending content (incomplete line without \\n)\n if (this.terminal.hasContent()) {\n const line = this.terminal.renderLine();\n this.terminal.reset();\n this.allLines.push(line);\n }\n\n // Return copy of all lines WITHOUT trimStart() or trimming blank lines\n // Preserves all whitespace, indentation, and blank lines\n return [...this.allLines];\n }\n\n /**\n * Get the number of rendered lines.\n */\n get lineCount(): number {\n return this.getLines().length;\n }\n\n /**\n * Clean up terminal resources.\n */\n dispose(): void {\n this.terminal.dispose();\n this.allLines = [];\n }\n}\n"],"names":["TerminalBuffer","_cols","_scrollback","allLines","terminal","StreamingTerminal","setLineReadyCallback","line","renderLine","reset","push","write","data","resize","getLines","hasContent","dispose","lineCount","length"],"mappings":";;;;+BAUaA;;;eAAAA;;;6BAVqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAU3B,IAAA,AAAMA,+BAAN;;aAAMA,eAICC,KAAa;;YAAEC,cAAAA,iEAAc;gCAJ9BF;aAEHG,WAAqB,EAAE;QAG7B,6DAA6D;QAC7D,iCAAiC;QACjC,IAAI,CAACC,QAAQ,GAAG,IAAIC,gCAAiB;QAErC,sDAAsD;QACtD,IAAI,CAACD,QAAQ,CAACE,oBAAoB,CAAC;YACjC,IAAMC,OAAO,MAAKH,QAAQ,CAACI,UAAU;YACrC,MAAKJ,QAAQ,CAACK,KAAK;YACnB,MAAKN,QAAQ,CAACO,IAAI,CAACH;QACrB;;iBAdSP;IAiBX;;;GAGC,GACDW,OAAAA,KAEC,GAFDA,SAAAA,MAAMC,IAAqB;QACzB,IAAI,CAACR,QAAQ,CAACO,KAAK,CAACC;IACtB;IAEA;;;GAGC,GACDC,OAAAA,MAEC,GAFDA,SAAAA,OAAOZ,KAAa;IAClB,sDAAsD;IACxD;IAEA;;;;;;;GAOC,GACDa,OAAAA,QAWC,GAXDA,SAAAA;QACE,yDAAyD;QACzD,IAAI,IAAI,CAACV,QAAQ,CAACW,UAAU,IAAI;YAC9B,IAAMR,OAAO,IAAI,CAACH,QAAQ,CAACI,UAAU;YACrC,IAAI,CAACJ,QAAQ,CAACK,KAAK;YACnB,IAAI,CAACN,QAAQ,CAACO,IAAI,CAACH;QACrB;QAEA,uEAAuE;QACvE,yDAAyD;QACzD,OAAQ,qBAAG,IAAI,CAACJ,QAAQ;IAC1B;IASA;;GAEC,GACDa,OAAAA,OAGC,GAHDA,SAAAA;QACE,IAAI,CAACZ,QAAQ,CAACY,OAAO;QACrB,IAAI,CAACb,QAAQ,GAAG,EAAE;IACpB;kBAnEWH;;YAyDPiB,KAAAA;iBAAJ,AAHA;;GAEC,GACD;gBACE,OAAO,IAAI,CAACH,QAAQ,GAAGI,MAAM;YAC/B;;;WA3DWlB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/TerminalBuffer.ts"],"sourcesContent":["import { StreamingTerminal } from 'terminal-model';\n\n/**\n * Wrapper around terminal-model's StreamingTerminal that provides a virtual terminal buffer.\n * Interprets ANSI escape sequences (cursor movement, line clearing, etc.) to produce\n * the actual rendered output rather than raw intermediate states.\n *\n * This implementation preserves whitespace and blank lines by NOT calling trimStart(),\n * which was the bug in the previous xterm-based implementation.\n */\nexport class TerminalBuffer {\n private terminal: StreamingTerminal;\n private allLines: string[] = [];\n\n constructor(_cols: number, _scrollback = 10000) {\n // terminal-model doesn't enforce column width during parsing\n // It preserves all content as-is\n this.terminal = new StreamingTerminal();\n\n // Listen for completed lines (when \\n is encountered)\n this.terminal.setLineReadyCallback(() => {\n const line = this.terminal.renderLine();\n this.terminal.reset();\n this.allLines.push(line);\n });\n }\n\n /**\n * Write raw data to the terminal buffer.\n * The terminal interprets all ANSI sequences automatically.\n */\n write(data: string | Buffer): void {\n this.terminal.write(data);\n }\n\n /**\n * Resize the terminal width.\n * terminal-model doesn't use column constraints, so this is a no-op for compatibility.\n */\n resize(_cols: number): void {\n // No-op - terminal-model doesn't enforce column width\n }\n\n /**\n * Extract the rendered lines from the terminal buffer.\n * This returns the actual visible content after all ANSI sequences\n * have been processed, with color codes preserved.\n *\n * CRITICAL: Unlike the xterm implementation, we do NOT call trimStart(),\n * which preserves legitimate indentation and blank lines.\n */\n getLines(): string[] {\n // Flush any pending content (incomplete line without \\n)\n if (this.terminal.hasContent()) {\n const line = this.terminal.renderLine();\n this.terminal.reset();\n this.allLines.push(line);\n }\n\n // Return copy of all lines WITHOUT trimStart() or trimming blank lines\n // Preserves all whitespace, indentation, and blank lines\n return this.allLines.slice();\n }\n\n /**\n * Get the number of rendered lines.\n */\n get lineCount(): number {\n return this.getLines().length;\n }\n\n /**\n * Clean up terminal resources.\n */\n dispose(): void {\n this.terminal.dispose();\n this.allLines = [];\n }\n}\n"],"names":["TerminalBuffer","_cols","_scrollback","allLines","terminal","StreamingTerminal","setLineReadyCallback","line","renderLine","reset","push","write","data","resize","getLines","hasContent","slice","dispose","lineCount","length"],"mappings":";;;;+BAUaA;;;eAAAA;;;6BAVqB;;;;;;;;;;;;;;;;;;;;AAU3B,IAAA,AAAMA,+BAAN;;aAAMA,eAICC,KAAa;;YAAEC,cAAAA,iEAAc;gCAJ9BF;aAEHG,WAAqB,EAAE;QAG7B,6DAA6D;QAC7D,iCAAiC;QACjC,IAAI,CAACC,QAAQ,GAAG,IAAIC,gCAAiB;QAErC,sDAAsD;QACtD,IAAI,CAACD,QAAQ,CAACE,oBAAoB,CAAC;YACjC,IAAMC,OAAO,MAAKH,QAAQ,CAACI,UAAU;YACrC,MAAKJ,QAAQ,CAACK,KAAK;YACnB,MAAKN,QAAQ,CAACO,IAAI,CAACH;QACrB;;iBAdSP;IAiBX;;;GAGC,GACDW,OAAAA,KAEC,GAFDA,SAAAA,MAAMC,IAAqB;QACzB,IAAI,CAACR,QAAQ,CAACO,KAAK,CAACC;IACtB;IAEA;;;GAGC,GACDC,OAAAA,MAEC,GAFDA,SAAAA,OAAOZ,KAAa;IAClB,sDAAsD;IACxD;IAEA;;;;;;;GAOC,GACDa,OAAAA,QAWC,GAXDA,SAAAA;QACE,yDAAyD;QACzD,IAAI,IAAI,CAACV,QAAQ,CAACW,UAAU,IAAI;YAC9B,IAAMR,OAAO,IAAI,CAACH,QAAQ,CAACI,UAAU;YACrC,IAAI,CAACJ,QAAQ,CAACK,KAAK;YACnB,IAAI,CAACN,QAAQ,CAACO,IAAI,CAACH;QACrB;QAEA,uEAAuE;QACvE,yDAAyD;QACzD,OAAO,IAAI,CAACJ,QAAQ,CAACa,KAAK;IAC5B;IASA;;GAEC,GACDC,OAAAA,OAGC,GAHDA,SAAAA;QACE,IAAI,CAACb,QAAQ,CAACa,OAAO;QACrB,IAAI,CAACd,QAAQ,GAAG,EAAE;IACpB;kBAnEWH;;YAyDPkB,KAAAA;iBAAJ,AAHA;;GAEC,GACD;gBACE,OAAO,IAAI,CAACJ,QAAQ,GAAGK,MAAM;YAC/B;;;WA3DWnB"}
@@ -35,9 +35,7 @@ import { StreamingTerminal } from 'terminal-model';
35
35
  }
36
36
  // Return copy of all lines WITHOUT trimStart() or trimming blank lines
37
37
  // Preserves all whitespace, indentation, and blank lines
38
- return [
39
- ...this.allLines
40
- ];
38
+ return this.allLines.slice();
41
39
  }
42
40
  /**
43
41
  * Get the number of rendered lines.
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/TerminalBuffer.ts"],"sourcesContent":["import { StreamingTerminal } from 'terminal-model';\n\n/**\n * Wrapper around terminal-model's StreamingTerminal that provides a virtual terminal buffer.\n * Interprets ANSI escape sequences (cursor movement, line clearing, etc.) to produce\n * the actual rendered output rather than raw intermediate states.\n *\n * This implementation preserves whitespace and blank lines by NOT calling trimStart(),\n * which was the bug in the previous xterm-based implementation.\n */\nexport class TerminalBuffer {\n private terminal: StreamingTerminal;\n private allLines: string[] = [];\n\n constructor(_cols: number, _scrollback = 10000) {\n // terminal-model doesn't enforce column width during parsing\n // It preserves all content as-is\n this.terminal = new StreamingTerminal();\n\n // Listen for completed lines (when \\n is encountered)\n this.terminal.setLineReadyCallback(() => {\n const line = this.terminal.renderLine();\n this.terminal.reset();\n this.allLines.push(line);\n });\n }\n\n /**\n * Write raw data to the terminal buffer.\n * The terminal interprets all ANSI sequences automatically.\n */\n write(data: string | Buffer): void {\n this.terminal.write(data);\n }\n\n /**\n * Resize the terminal width.\n * terminal-model doesn't use column constraints, so this is a no-op for compatibility.\n */\n resize(_cols: number): void {\n // No-op - terminal-model doesn't enforce column width\n }\n\n /**\n * Extract the rendered lines from the terminal buffer.\n * This returns the actual visible content after all ANSI sequences\n * have been processed, with color codes preserved.\n *\n * CRITICAL: Unlike the xterm implementation, we do NOT call trimStart(),\n * which preserves legitimate indentation and blank lines.\n */\n getLines(): string[] {\n // Flush any pending content (incomplete line without \\n)\n if (this.terminal.hasContent()) {\n const line = this.terminal.renderLine();\n this.terminal.reset();\n this.allLines.push(line);\n }\n\n // Return copy of all lines WITHOUT trimStart() or trimming blank lines\n // Preserves all whitespace, indentation, and blank lines\n return [...this.allLines];\n }\n\n /**\n * Get the number of rendered lines.\n */\n get lineCount(): number {\n return this.getLines().length;\n }\n\n /**\n * Clean up terminal resources.\n */\n dispose(): void {\n this.terminal.dispose();\n this.allLines = [];\n }\n}\n"],"names":["StreamingTerminal","TerminalBuffer","write","data","terminal","resize","_cols","getLines","hasContent","line","renderLine","reset","allLines","push","lineCount","length","dispose","_scrollback","setLineReadyCallback"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,iBAAiB;AAEnD;;;;;;;CAOC,GACD,OAAO,MAAMC;IAiBX;;;GAGC,GACDC,MAAMC,IAAqB,EAAQ;QACjC,IAAI,CAACC,QAAQ,CAACF,KAAK,CAACC;IACtB;IAEA;;;GAGC,GACDE,OAAOC,KAAa,EAAQ;IAC1B,sDAAsD;IACxD;IAEA;;;;;;;GAOC,GACDC,WAAqB;QACnB,yDAAyD;QACzD,IAAI,IAAI,CAACH,QAAQ,CAACI,UAAU,IAAI;YAC9B,MAAMC,OAAO,IAAI,CAACL,QAAQ,CAACM,UAAU;YACrC,IAAI,CAACN,QAAQ,CAACO,KAAK;YACnB,IAAI,CAACC,QAAQ,CAACC,IAAI,CAACJ;QACrB;QAEA,uEAAuE;QACvE,yDAAyD;QACzD,OAAO;eAAI,IAAI,CAACG,QAAQ;SAAC;IAC3B;IAEA;;GAEC,GACD,IAAIE,YAAoB;QACtB,OAAO,IAAI,CAACP,QAAQ,GAAGQ,MAAM;IAC/B;IAEA;;GAEC,GACDC,UAAgB;QACd,IAAI,CAACZ,QAAQ,CAACY,OAAO;QACrB,IAAI,CAACJ,QAAQ,GAAG,EAAE;IACpB;IA/DA,YAAYN,KAAa,EAAEW,cAAc,KAAK,CAAE;aAFxCL,WAAqB,EAAE;QAG7B,6DAA6D;QAC7D,iCAAiC;QACjC,IAAI,CAACR,QAAQ,GAAG,IAAIJ;QAEpB,sDAAsD;QACtD,IAAI,CAACI,QAAQ,CAACc,oBAAoB,CAAC;YACjC,MAAMT,OAAO,IAAI,CAACL,QAAQ,CAACM,UAAU;YACrC,IAAI,CAACN,QAAQ,CAACO,KAAK;YACnB,IAAI,CAACC,QAAQ,CAACC,IAAI,CAACJ;QACrB;IACF;AAqDF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/TerminalBuffer.ts"],"sourcesContent":["import { StreamingTerminal } from 'terminal-model';\n\n/**\n * Wrapper around terminal-model's StreamingTerminal that provides a virtual terminal buffer.\n * Interprets ANSI escape sequences (cursor movement, line clearing, etc.) to produce\n * the actual rendered output rather than raw intermediate states.\n *\n * This implementation preserves whitespace and blank lines by NOT calling trimStart(),\n * which was the bug in the previous xterm-based implementation.\n */\nexport class TerminalBuffer {\n private terminal: StreamingTerminal;\n private allLines: string[] = [];\n\n constructor(_cols: number, _scrollback = 10000) {\n // terminal-model doesn't enforce column width during parsing\n // It preserves all content as-is\n this.terminal = new StreamingTerminal();\n\n // Listen for completed lines (when \\n is encountered)\n this.terminal.setLineReadyCallback(() => {\n const line = this.terminal.renderLine();\n this.terminal.reset();\n this.allLines.push(line);\n });\n }\n\n /**\n * Write raw data to the terminal buffer.\n * The terminal interprets all ANSI sequences automatically.\n */\n write(data: string | Buffer): void {\n this.terminal.write(data);\n }\n\n /**\n * Resize the terminal width.\n * terminal-model doesn't use column constraints, so this is a no-op for compatibility.\n */\n resize(_cols: number): void {\n // No-op - terminal-model doesn't enforce column width\n }\n\n /**\n * Extract the rendered lines from the terminal buffer.\n * This returns the actual visible content after all ANSI sequences\n * have been processed, with color codes preserved.\n *\n * CRITICAL: Unlike the xterm implementation, we do NOT call trimStart(),\n * which preserves legitimate indentation and blank lines.\n */\n getLines(): string[] {\n // Flush any pending content (incomplete line without \\n)\n if (this.terminal.hasContent()) {\n const line = this.terminal.renderLine();\n this.terminal.reset();\n this.allLines.push(line);\n }\n\n // Return copy of all lines WITHOUT trimStart() or trimming blank lines\n // Preserves all whitespace, indentation, and blank lines\n return this.allLines.slice();\n }\n\n /**\n * Get the number of rendered lines.\n */\n get lineCount(): number {\n return this.getLines().length;\n }\n\n /**\n * Clean up terminal resources.\n */\n dispose(): void {\n this.terminal.dispose();\n this.allLines = [];\n }\n}\n"],"names":["StreamingTerminal","TerminalBuffer","write","data","terminal","resize","_cols","getLines","hasContent","line","renderLine","reset","allLines","push","slice","lineCount","length","dispose","_scrollback","setLineReadyCallback"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,iBAAiB;AAEnD;;;;;;;CAOC,GACD,OAAO,MAAMC;IAiBX;;;GAGC,GACDC,MAAMC,IAAqB,EAAQ;QACjC,IAAI,CAACC,QAAQ,CAACF,KAAK,CAACC;IACtB;IAEA;;;GAGC,GACDE,OAAOC,KAAa,EAAQ;IAC1B,sDAAsD;IACxD;IAEA;;;;;;;GAOC,GACDC,WAAqB;QACnB,yDAAyD;QACzD,IAAI,IAAI,CAACH,QAAQ,CAACI,UAAU,IAAI;YAC9B,MAAMC,OAAO,IAAI,CAACL,QAAQ,CAACM,UAAU;YACrC,IAAI,CAACN,QAAQ,CAACO,KAAK;YACnB,IAAI,CAACC,QAAQ,CAACC,IAAI,CAACJ;QACrB;QAEA,uEAAuE;QACvE,yDAAyD;QACzD,OAAO,IAAI,CAACG,QAAQ,CAACE,KAAK;IAC5B;IAEA;;GAEC,GACD,IAAIC,YAAoB;QACtB,OAAO,IAAI,CAACR,QAAQ,GAAGS,MAAM;IAC/B;IAEA;;GAEC,GACDC,UAAgB;QACd,IAAI,CAACb,QAAQ,CAACa,OAAO;QACrB,IAAI,CAACL,QAAQ,GAAG,EAAE;IACpB;IA/DA,YAAYN,KAAa,EAAEY,cAAc,KAAK,CAAE;aAFxCN,WAAqB,EAAE;QAG7B,6DAA6D;QAC7D,iCAAiC;QACjC,IAAI,CAACR,QAAQ,GAAG,IAAIJ;QAEpB,sDAAsD;QACtD,IAAI,CAACI,QAAQ,CAACe,oBAAoB,CAAC;YACjC,MAAMV,OAAO,IAAI,CAACL,QAAQ,CAACM,UAAU;YACrC,IAAI,CAACN,QAAQ,CAACO,KAAK;YACnB,IAAI,CAACC,QAAQ,CAACC,IAAI,CAACJ;QACrB;IACF;AAqDF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawn-term",
3
- "version": "3.5.1",
3
+ "version": "3.5.2",
4
4
  "description": "Formats spawn with for terminal grouping",
5
5
  "keywords": [
6
6
  "spawn",