spawn-term
Advanced tools
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| Object.defineProperty(exports, /** | ||
| * Component that renders text with ANSI escape codes as styled Ink Text components. | ||
| * Parses ANSI color and style codes and applies them as Ink props. | ||
| */ "default", { | ||
| enumerable: true, | ||
| get: function() { | ||
| return _default; | ||
| } | ||
| }); | ||
| var _jsxruntime = require("react/jsx-runtime"); | ||
| var _ink = require("ink"); | ||
| var _react = require("react"); | ||
| function _array_like_to_array(arr, len) { | ||
| if (len == null || len > arr.length) len = arr.length; | ||
| for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; | ||
| return arr2; | ||
| } | ||
| function _array_with_holes(arr) { | ||
| if (Array.isArray(arr)) return arr; | ||
| } | ||
| function _define_property(obj, key, value) { | ||
| if (key in obj) { | ||
| Object.defineProperty(obj, key, { | ||
| value: value, | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true | ||
| }); | ||
| } else { | ||
| obj[key] = value; | ||
| } | ||
| return obj; | ||
| } | ||
| function _iterable_to_array_limit(arr, i) { | ||
| var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
| if (_i == null) return; | ||
| var _arr = []; | ||
| var _n = true; | ||
| var _d = false; | ||
| var _s, _e; | ||
| try { | ||
| for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){ | ||
| _arr.push(_s.value); | ||
| if (i && _arr.length === i) break; | ||
| } | ||
| } catch (err) { | ||
| _d = true; | ||
| _e = err; | ||
| } finally{ | ||
| try { | ||
| if (!_n && _i["return"] != null) _i["return"](); | ||
| } finally{ | ||
| if (_d) throw _e; | ||
| } | ||
| } | ||
| return _arr; | ||
| } | ||
| function _non_iterable_rest() { | ||
| throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
| } | ||
| function _object_spread(target) { | ||
| for(var i = 1; i < arguments.length; i++){ | ||
| var source = arguments[i] != null ? arguments[i] : {}; | ||
| var ownKeys = Object.keys(source); | ||
| if (typeof Object.getOwnPropertySymbols === "function") { | ||
| ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
| return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
| })); | ||
| } | ||
| ownKeys.forEach(function(key) { | ||
| _define_property(target, key, source[key]); | ||
| }); | ||
| } | ||
| return target; | ||
| } | ||
| function _sliced_to_array(arr, i) { | ||
| return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest(); | ||
| } | ||
| function _unsupported_iterable_to_array(o, minLen) { | ||
| if (!o) return; | ||
| if (typeof o === "string") return _array_like_to_array(o, minLen); | ||
| var n = Object.prototype.toString.call(o).slice(8, -1); | ||
| if (n === "Object" && o.constructor) n = o.constructor.name; | ||
| if (n === "Map" || n === "Set") return Array.from(n); | ||
| if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); | ||
| } | ||
| // ANSI color codes to Ink color mapping | ||
| // Based on standard ANSI SGR (Select Graphic Rendition) parameters | ||
| var ANSI_COLORS = { | ||
| '\x1b[30m': 'black', | ||
| '\x1b[31m': 'red', | ||
| '\x1b[32m': 'green', | ||
| '\x1b[33m': 'yellow', | ||
| '\x1b[34m': 'blue', | ||
| '\x1b[35m': 'magenta', | ||
| '\x1b[36m': 'cyan', | ||
| '\x1b[37m': 'white', | ||
| // Bright colors | ||
| '\x1b[90m': 'gray', | ||
| '\x1b[91m': 'redBright', | ||
| '\x1b[92m': 'greenBright', | ||
| '\x1b[93m': 'yellowBright', | ||
| '\x1b[94m': 'blueBright', | ||
| '\x1b[95m': 'magentaBright', | ||
| '\x1b[96m': 'cyanBright', | ||
| '\x1b[97m': 'whiteBright' | ||
| }; | ||
| // ANSI style codes | ||
| var ANSI_STYLES = { | ||
| '\x1b[1m': 'bold', | ||
| '\x1b[2m': 'dim', | ||
| '\x1b[3m': 'italic', | ||
| '\x1b[4m': 'underline', | ||
| '\x1b[9m': 'strikethrough', | ||
| '\x1b[7m': 'inverse' | ||
| }; | ||
| // Reset codes | ||
| var RESET_CODES = [ | ||
| '\x1b[0m', | ||
| '\x1b[39m', | ||
| '\x1b[49m' | ||
| ]; | ||
| /** | ||
| * Parse a string with ANSI codes into segments with styling information. | ||
| */ function parseAnsiString(input) { | ||
| var segments = []; | ||
| var currentSegment = { | ||
| text: '' | ||
| }; | ||
| var i = 0; | ||
| while(i < input.length){ | ||
| // Check for ANSI escape sequence | ||
| if (input[i] === '\x1b' && input[i + 1] === '[') { | ||
| // Find the end of the escape sequence (ends with a letter) | ||
| var j = i + 2; | ||
| while(j < input.length && !/[a-zA-Z]/.test(input[j])){ | ||
| j++; | ||
| } | ||
| j++; // Include the letter | ||
| var code = input.slice(i, j); | ||
| // If we have accumulated text, save it | ||
| if (currentSegment.text.length > 0) { | ||
| segments.push(currentSegment); | ||
| currentSegment = _object_spread({ | ||
| text: '' | ||
| }, Object.fromEntries(Object.entries(currentSegment).filter(function(param) { | ||
| var _param = _sliced_to_array(param, 1), key = _param[0]; | ||
| return key !== 'text'; | ||
| }).filter(function(param) { | ||
| var _param = _sliced_to_array(param, 2), _ = _param[0], value = _param[1]; | ||
| return value !== undefined; | ||
| }))); | ||
| } | ||
| // Apply the style | ||
| if (RESET_CODES.includes(code)) { | ||
| // Reset all styles | ||
| currentSegment = { | ||
| text: '' | ||
| }; | ||
| } else if (ANSI_COLORS[code]) { | ||
| currentSegment.color = ANSI_COLORS[code]; | ||
| } else if (ANSI_STYLES[code]) { | ||
| var style = ANSI_STYLES[code]; | ||
| currentSegment[style] = true; | ||
| } | ||
| i = j; | ||
| } else { | ||
| // Regular character | ||
| currentSegment.text += input[i]; | ||
| i++; | ||
| } | ||
| } | ||
| // Add the last segment if it has text | ||
| if (currentSegment.text.length > 0) { | ||
| segments.push(currentSegment); | ||
| } | ||
| return segments; | ||
| } | ||
| var _default = /*#__PURE__*/ (0, _react.memo)(function AnsiText(param) { | ||
| var children = param.children; | ||
| // If the input is empty or has no ANSI codes, just render it directly | ||
| if (!children || !children.includes('\x1b')) { | ||
| return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, { | ||
| children: children | ||
| }); | ||
| } | ||
| var segments = parseAnsiString(children); | ||
| // If parsing resulted in a single unstyled segment, render it directly | ||
| if (segments.length === 1 && !segments[0].color && !segments[0].bold && !segments[0].dim && !segments[0].italic && !segments[0].underline && !segments[0].strikethrough && !segments[0].inverse) { | ||
| return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, { | ||
| children: segments[0].text | ||
| }); | ||
| } | ||
| return /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.Fragment, { | ||
| children: segments.map(function(segment, index) { | ||
| return(// biome-ignore lint/suspicious/noArrayIndexKey: Segments have no unique ID, index is stable for parsed content | ||
| /*#__PURE__*/ (0, _jsxruntime.jsx)(_ink.Text, { | ||
| color: segment.color, | ||
| bold: segment.bold, | ||
| dimColor: segment.dim, | ||
| italic: segment.italic, | ||
| underline: segment.underline, | ||
| strikethrough: segment.strikethrough, | ||
| inverse: segment.inverse, | ||
| children: segment.text | ||
| }, index)); | ||
| }) | ||
| }); | ||
| }); | ||
| /* 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; } |
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/AnsiText.tsx"],"sourcesContent":["import { Text } from 'ink';\nimport { Fragment, memo } from 'react';\n\n// ANSI color codes to Ink color mapping\n// Based on standard ANSI SGR (Select Graphic Rendition) parameters\nconst ANSI_COLORS: Record<string, string> = {\n '\\x1b[30m': 'black',\n '\\x1b[31m': 'red',\n '\\x1b[32m': 'green',\n '\\x1b[33m': 'yellow',\n '\\x1b[34m': 'blue',\n '\\x1b[35m': 'magenta',\n '\\x1b[36m': 'cyan',\n '\\x1b[37m': 'white',\n // Bright colors\n '\\x1b[90m': 'gray',\n '\\x1b[91m': 'redBright',\n '\\x1b[92m': 'greenBright',\n '\\x1b[93m': 'yellowBright',\n '\\x1b[94m': 'blueBright',\n '\\x1b[95m': 'magentaBright',\n '\\x1b[96m': 'cyanBright',\n '\\x1b[97m': 'whiteBright',\n};\n\n// ANSI style codes\nconst ANSI_STYLES: Record<string, string> = {\n '\\x1b[1m': 'bold',\n '\\x1b[2m': 'dim',\n '\\x1b[3m': 'italic',\n '\\x1b[4m': 'underline',\n '\\x1b[9m': 'strikethrough',\n '\\x1b[7m': 'inverse',\n};\n\n// Reset codes\nconst RESET_CODES = ['\\x1b[0m', '\\x1b[39m', '\\x1b[49m'];\n\ntype TextSegment = {\n text: string;\n color?: string;\n bold?: boolean;\n dim?: boolean;\n italic?: boolean;\n underline?: boolean;\n strikethrough?: boolean;\n inverse?: boolean;\n};\n\n/**\n * Parse a string with ANSI codes into segments with styling information.\n */\nfunction parseAnsiString(input: string): TextSegment[] {\n const segments: TextSegment[] = [];\n let currentSegment: TextSegment = { text: '' };\n let i = 0;\n\n while (i < input.length) {\n // Check for ANSI escape sequence\n if (input[i] === '\\x1b' && input[i + 1] === '[') {\n // Find the end of the escape sequence (ends with a letter)\n let j = i + 2;\n while (j < input.length && !/[a-zA-Z]/.test(input[j])) {\n j++;\n }\n j++; // Include the letter\n\n const code = input.slice(i, j);\n\n // If we have accumulated text, save it\n if (currentSegment.text.length > 0) {\n segments.push(currentSegment);\n currentSegment = {\n text: '',\n ...Object.fromEntries(\n Object.entries(currentSegment)\n .filter(([key]) => key !== 'text')\n .filter(([_, value]) => value !== undefined)\n ),\n } as TextSegment;\n }\n\n // Apply the style\n if (RESET_CODES.includes(code)) {\n // Reset all styles\n currentSegment = { text: '' };\n } else if (ANSI_COLORS[code]) {\n currentSegment.color = ANSI_COLORS[code];\n } else if (ANSI_STYLES[code]) {\n const style = ANSI_STYLES[code] as keyof Omit<TextSegment, 'text' | 'color'>;\n currentSegment[style] = true;\n }\n\n i = j;\n } else {\n // Regular character\n currentSegment.text += input[i];\n i++;\n }\n }\n\n // Add the last segment if it has text\n if (currentSegment.text.length > 0) {\n segments.push(currentSegment);\n }\n\n return segments;\n}\n\ntype Props = {\n children: string;\n};\n\n/**\n * Component that renders text with ANSI escape codes as styled Ink Text components.\n * Parses ANSI color and style codes and applies them as Ink props.\n */\nexport default memo(function AnsiText({ children }: Props) {\n // If the input is empty or has no ANSI codes, just render it directly\n if (!children || !children.includes('\\x1b')) {\n return <Fragment>{children}</Fragment>;\n }\n\n const segments = parseAnsiString(children);\n\n // If parsing resulted in a single unstyled segment, render it directly\n if (segments.length === 1 && !segments[0].color && !segments[0].bold && !segments[0].dim && !segments[0].italic && !segments[0].underline && !segments[0].strikethrough && !segments[0].inverse) {\n return <Fragment>{segments[0].text}</Fragment>;\n }\n\n return (\n <Fragment>\n {segments.map((segment, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Segments have no unique ID, index is stable for parsed content\n <Text key={index} color={segment.color} bold={segment.bold} dimColor={segment.dim} italic={segment.italic} underline={segment.underline} strikethrough={segment.strikethrough} inverse={segment.inverse}>\n {segment.text}\n </Text>\n ))}\n </Fragment>\n );\n});\n"],"names":["ANSI_COLORS","ANSI_STYLES","RESET_CODES","parseAnsiString","input","segments","currentSegment","text","i","length","j","test","code","slice","push","Object","fromEntries","entries","filter","key","_","value","undefined","includes","color","style","memo","AnsiText","children","Fragment","bold","dim","italic","underline","strikethrough","inverse","map","segment","index","Text","dimColor"],"mappings":";;;;+BAiHA;;;CAGC,GACD;;;eAAA;;;;mBArHqB;qBACU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/B,wCAAwC;AACxC,mEAAmE;AACnE,IAAMA,cAAsC;IAC1C,YAAY;IACZ,Y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AOa,QAAQb,KAAK;gBAAEM,MAAMO,QAAQP,IAAI;gBAAEU,UAAUH,QAAQN,GAAG;gBAAEC,QAAQK,QAAQL,MAAM;gBAAEC,WAAWI,QAAQJ,SAAS;gBAAEC,eAAeG,QAAQH,aAAa;gBAAEC,SAASE,QAAQF,OAAO;0BACpME,QAAQ9B,IAAI;eADJ+B;;;AAMnB"} |
| type Props = { | ||
| children: string; | ||
| }; | ||
| /** | ||
| * Component that renders text with ANSI escape codes as styled Ink Text components. | ||
| * Parses ANSI color and style codes and applies them as Ink props. | ||
| */ | ||
| declare const _default: import("react").NamedExoticComponent<Props>; | ||
| export default _default; |
| import { jsx as _jsx } from "react/jsx-runtime"; | ||
| import { Text } from 'ink'; | ||
| import { Fragment, memo } from 'react'; | ||
| // ANSI color codes to Ink color mapping | ||
| // Based on standard ANSI SGR (Select Graphic Rendition) parameters | ||
| const ANSI_COLORS = { | ||
| '\x1b[30m': 'black', | ||
| '\x1b[31m': 'red', | ||
| '\x1b[32m': 'green', | ||
| '\x1b[33m': 'yellow', | ||
| '\x1b[34m': 'blue', | ||
| '\x1b[35m': 'magenta', | ||
| '\x1b[36m': 'cyan', | ||
| '\x1b[37m': 'white', | ||
| // Bright colors | ||
| '\x1b[90m': 'gray', | ||
| '\x1b[91m': 'redBright', | ||
| '\x1b[92m': 'greenBright', | ||
| '\x1b[93m': 'yellowBright', | ||
| '\x1b[94m': 'blueBright', | ||
| '\x1b[95m': 'magentaBright', | ||
| '\x1b[96m': 'cyanBright', | ||
| '\x1b[97m': 'whiteBright' | ||
| }; | ||
| // ANSI style codes | ||
| const ANSI_STYLES = { | ||
| '\x1b[1m': 'bold', | ||
| '\x1b[2m': 'dim', | ||
| '\x1b[3m': 'italic', | ||
| '\x1b[4m': 'underline', | ||
| '\x1b[9m': 'strikethrough', | ||
| '\x1b[7m': 'inverse' | ||
| }; | ||
| // Reset codes | ||
| const RESET_CODES = [ | ||
| '\x1b[0m', | ||
| '\x1b[39m', | ||
| '\x1b[49m' | ||
| ]; | ||
| /** | ||
| * Parse a string with ANSI codes into segments with styling information. | ||
| */ function parseAnsiString(input) { | ||
| const segments = []; | ||
| let currentSegment = { | ||
| text: '' | ||
| }; | ||
| let i = 0; | ||
| while(i < input.length){ | ||
| // Check for ANSI escape sequence | ||
| if (input[i] === '\x1b' && input[i + 1] === '[') { | ||
| // Find the end of the escape sequence (ends with a letter) | ||
| let j = i + 2; | ||
| while(j < input.length && !/[a-zA-Z]/.test(input[j])){ | ||
| j++; | ||
| } | ||
| j++; // Include the letter | ||
| const code = input.slice(i, j); | ||
| // If we have accumulated text, save it | ||
| if (currentSegment.text.length > 0) { | ||
| segments.push(currentSegment); | ||
| currentSegment = { | ||
| text: '', | ||
| ...Object.fromEntries(Object.entries(currentSegment).filter(([key])=>key !== 'text').filter(([_, value])=>value !== undefined)) | ||
| }; | ||
| } | ||
| // Apply the style | ||
| if (RESET_CODES.includes(code)) { | ||
| // Reset all styles | ||
| currentSegment = { | ||
| text: '' | ||
| }; | ||
| } else if (ANSI_COLORS[code]) { | ||
| currentSegment.color = ANSI_COLORS[code]; | ||
| } else if (ANSI_STYLES[code]) { | ||
| const style = ANSI_STYLES[code]; | ||
| currentSegment[style] = true; | ||
| } | ||
| i = j; | ||
| } else { | ||
| // Regular character | ||
| currentSegment.text += input[i]; | ||
| i++; | ||
| } | ||
| } | ||
| // Add the last segment if it has text | ||
| if (currentSegment.text.length > 0) { | ||
| segments.push(currentSegment); | ||
| } | ||
| return segments; | ||
| } | ||
| /** | ||
| * Component that renders text with ANSI escape codes as styled Ink Text components. | ||
| * Parses ANSI color and style codes and applies them as Ink props. | ||
| */ export default /*#__PURE__*/ memo(function AnsiText({ children }) { | ||
| // If the input is empty or has no ANSI codes, just render it directly | ||
| if (!children || !children.includes('\x1b')) { | ||
| return /*#__PURE__*/ _jsx(Fragment, { | ||
| children: children | ||
| }); | ||
| } | ||
| const segments = parseAnsiString(children); | ||
| // If parsing resulted in a single unstyled segment, render it directly | ||
| if (segments.length === 1 && !segments[0].color && !segments[0].bold && !segments[0].dim && !segments[0].italic && !segments[0].underline && !segments[0].strikethrough && !segments[0].inverse) { | ||
| return /*#__PURE__*/ _jsx(Fragment, { | ||
| children: segments[0].text | ||
| }); | ||
| } | ||
| return /*#__PURE__*/ _jsx(Fragment, { | ||
| children: segments.map((segment, index)=>// biome-ignore lint/suspicious/noArrayIndexKey: Segments have no unique ID, index is stable for parsed content | ||
| /*#__PURE__*/ _jsx(Text, { | ||
| color: segment.color, | ||
| bold: segment.bold, | ||
| dimColor: segment.dim, | ||
| italic: segment.italic, | ||
| underline: segment.underline, | ||
| strikethrough: segment.strikethrough, | ||
| inverse: segment.inverse, | ||
| children: segment.text | ||
| }, index)) | ||
| }); | ||
| }); |
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/AnsiText.tsx"],"sourcesContent":["import { Text } from 'ink';\nimport { Fragment, memo } from 'react';\n\n// ANSI color codes to Ink color mapping\n// Based on standard ANSI SGR (Select Graphic Rendition) parameters\nconst ANSI_COLORS: Record<string, string> = {\n '\\x1b[30m': 'black',\n '\\x1b[31m': 'red',\n '\\x1b[32m': 'green',\n '\\x1b[33m': 'yellow',\n '\\x1b[34m': 'blue',\n '\\x1b[35m': 'magenta',\n '\\x1b[36m': 'cyan',\n '\\x1b[37m': 'white',\n // Bright colors\n '\\x1b[90m': 'gray',\n '\\x1b[91m': 'redBright',\n '\\x1b[92m': 'greenBright',\n '\\x1b[93m': 'yellowBright',\n '\\x1b[94m': 'blueBright',\n '\\x1b[95m': 'magentaBright',\n '\\x1b[96m': 'cyanBright',\n '\\x1b[97m': 'whiteBright',\n};\n\n// ANSI style codes\nconst ANSI_STYLES: Record<string, string> = {\n '\\x1b[1m': 'bold',\n '\\x1b[2m': 'dim',\n '\\x1b[3m': 'italic',\n '\\x1b[4m': 'underline',\n '\\x1b[9m': 'strikethrough',\n '\\x1b[7m': 'inverse',\n};\n\n// Reset codes\nconst RESET_CODES = ['\\x1b[0m', '\\x1b[39m', '\\x1b[49m'];\n\ntype TextSegment = {\n text: string;\n color?: string;\n bold?: boolean;\n dim?: boolean;\n italic?: boolean;\n underline?: boolean;\n strikethrough?: boolean;\n inverse?: boolean;\n};\n\n/**\n * Parse a string with ANSI codes into segments with styling information.\n */\nfunction parseAnsiString(input: string): TextSegment[] {\n const segments: TextSegment[] = [];\n let currentSegment: TextSegment = { text: '' };\n let i = 0;\n\n while (i < input.length) {\n // Check for ANSI escape sequence\n if (input[i] === '\\x1b' && input[i + 1] === '[') {\n // Find the end of the escape sequence (ends with a letter)\n let j = i + 2;\n while (j < input.length && !/[a-zA-Z]/.test(input[j])) {\n j++;\n }\n j++; // Include the letter\n\n const code = input.slice(i, j);\n\n // If we have accumulated text, save it\n if (currentSegment.text.length > 0) {\n segments.push(currentSegment);\n currentSegment = {\n text: '',\n ...Object.fromEntries(\n Object.entries(currentSegment)\n .filter(([key]) => key !== 'text')\n .filter(([_, value]) => value !== undefined)\n ),\n } as TextSegment;\n }\n\n // Apply the style\n if (RESET_CODES.includes(code)) {\n // Reset all styles\n currentSegment = { text: '' };\n } else if (ANSI_COLORS[code]) {\n currentSegment.color = ANSI_COLORS[code];\n } else if (ANSI_STYLES[code]) {\n const style = ANSI_STYLES[code] as keyof Omit<TextSegment, 'text' | 'color'>;\n currentSegment[style] = true;\n }\n\n i = j;\n } else {\n // Regular character\n currentSegment.text += input[i];\n i++;\n }\n }\n\n // Add the last segment if it has text\n if (currentSegment.text.length > 0) {\n segments.push(currentSegment);\n }\n\n return segments;\n}\n\ntype Props = {\n children: string;\n};\n\n/**\n * Component that renders text with ANSI escape codes as styled Ink Text components.\n * Parses ANSI color and style codes and applies them as Ink props.\n */\nexport default memo(function AnsiText({ children }: Props) {\n // If the input is empty or has no ANSI codes, just render it directly\n if (!children || !children.includes('\\x1b')) {\n return <Fragment>{children}</Fragment>;\n }\n\n const segments = parseAnsiString(children);\n\n // If parsing resulted in a single unstyled segment, render it directly\n if (segments.length === 1 && !segments[0].color && !segments[0].bold && !segments[0].dim && !segments[0].italic && !segments[0].underline && !segments[0].strikethrough && !segments[0].inverse) {\n return <Fragment>{segments[0].text}</Fragment>;\n }\n\n return (\n <Fragment>\n {segments.map((segment, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Segments have no unique ID, index is stable for parsed content\n <Text key={index} color={segment.color} bold={segment.bold} dimColor={segment.dim} italic={segment.italic} underline={segment.underline} strikethrough={segment.strikethrough} inverse={segment.inverse}>\n {segment.text}\n </Text>\n ))}\n </Fragment>\n );\n});\n"],"names":["Text","Fragment","memo","ANSI_COLORS","ANSI_STYLES","RESET_CODES","parseAnsiString","input","segments","currentSegment","text","i","length","j","test","code","slice","push","Object","fromEntries","entries","filter","key","_","value","undefined","includes","color","style","AnsiText","children","bold","dim","italic","underline","strikethrough","inverse","map","segment","index","dimColor"],"mappings":";AAAA,SAASA,IAAI,QAAQ,MAAM;AAC3B,SAASC,QAAQ,EAAEC,IAAI,QAAQ,QAAQ;AAEvC,wCAAwC;AACxC,mEAAmE;AACnE,MAAMC,cAAsC;IAC1C,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;AACd;AAEA,mBAAmB;AACnB,MAAMC,cAAsC;IAC1C,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;AACb;AAEA,cAAc;AACd,MAAMC,cAAc;IAAC;IAAW;IAAY;CAAW;AAavD;;CAEC,GACD,SAASC,gBAAgBC,KAAa;IACpC,MAAMC,WAA0B,EAAE;IAClC,IAAIC,iBAA8B;QAAEC,MAAM;IAAG;IAC7C,IAAIC,IAAI;IAER,MAAOA,IAAIJ,MAAMK,MAAM,CAAE;QACvB,iCAAiC;QACjC,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;IACtE,IAAI,CAACA,YAAY,CAACA,SAASJ,QAAQ,CAAC,SAAS;QAC3C,qBAAO,KAACzB;sBAAU6B;;IACpB;IAEA,MAAMtB,WAAWF,gBAAgBwB;IAEjC,uEAAuE;IACvE,IAAItB,SAASI,MAAM,KAAK,KAAK,CAACJ,QAAQ,CAAC,EAAE,CAACmB,KAAK,IAAI,CAACnB,QAAQ,CAAC,EAAE,CAACuB,IAAI,IAAI,CAACvB,QAAQ,CAAC,EAAE,CAACwB,GAAG,IAAI,CAACxB,QAAQ,CAAC,EAAE,CAACyB,MAAM,IAAI,CAACzB,QAAQ,CAAC,EAAE,CAAC0B,SAAS,IAAI,CAAC1B,QAAQ,CAAC,EAAE,CAAC2B,aAAa,IAAI,CAAC3B,QAAQ,CAAC,EAAE,CAAC4B,OAAO,EAAE;QAC/L,qBAAO,KAACnC;sBAAUO,QAAQ,CAAC,EAAE,CAACE,IAAI;;IACpC;IAEA,qBACE,KAACT;kBACEO,SAAS6B,GAAG,CAAC,CAACC,SAASC,QACtB,+GAA+G;0BAC/G,KAACvC;gBAAiB2B,OAAOW,QAAQX,KAAK;gBAAEI,MAAMO,QAAQP,IAAI;gBAAES,UAAUF,QAAQN,GAAG;gBAAEC,QAAQK,QAAQL,MAAM;gBAAEC,WAAWI,QAAQJ,SAAS;gBAAEC,eAAeG,QAAQH,aAAa;gBAAEC,SAASE,QAAQF,OAAO;0BACpME,QAAQ5B,IAAI;eADJ6B;;AAMnB,GAAG"} |
| type Props = { | ||
| children: string; | ||
| }; | ||
| /** | ||
| * Component that renders text with ANSI escape codes as styled Ink Text components. | ||
| * Parses ANSI color and style codes and applies them as Ink props. | ||
| */ | ||
| declare const _default: import("react").NamedExoticComponent<Props>; | ||
| export default _default; |
@@ -15,2 +15,8 @@ "use strict"; | ||
| var _constantsts = require("../constants.js"); | ||
| var _AnsiTextts = /*#__PURE__*/ _interop_require_default(require("../lib/AnsiText.js")); | ||
| function _interop_require_default(obj) { | ||
| return obj && obj.__esModule ? obj : { | ||
| default: obj | ||
| }; | ||
| } | ||
| var isMac = process.platform === 'darwin'; | ||
@@ -40,3 +46,5 @@ var _default = /*#__PURE__*/ (0, _react.memo)(function ExpandedOutput(param) { | ||
| "│ ", | ||
| line.text || ' ' | ||
| /*#__PURE__*/ (0, _jsxruntime.jsx)(_AnsiTextts.default, { | ||
| children: line.text || ' ' | ||
| }) | ||
| ] | ||
@@ -43,0 +51,0 @@ }, scrollOffset + i)); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ExpandedOutput.tsx"],"sourcesContent":["import { Box, Text } from 'ink';\nimport { memo } from 'react';\nimport { EXPANDED_MAX_VISIBLE_LINES } from '../constants.ts';\nimport type { Line } from '../types.ts';\n\nconst isMac = process.platform === 'darwin';\n\ntype Props = {\n lines: Line[];\n scrollOffset: number;\n maxVisible?: number;\n};\n\nexport default memo(function ExpandedOutput({ lines, scrollOffset, maxVisible = EXPANDED_MAX_VISIBLE_LINES }: Props) {\n const visibleLines = lines.slice(scrollOffset, scrollOffset + maxVisible);\n const hasMore = lines.length > scrollOffset + maxVisible;\n const remaining = lines.length - scrollOffset - maxVisible;\n\n if (lines.length === 0) {\n return (\n <Box paddingLeft={2}>\n <Text dimColor>│ (no output)</Text>\n </Box>\n );\n }\n\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n {visibleLines.map((line, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Lines have no unique ID, index is stable for this scrolling view\n <Text key={scrollOffset + i}>│ {line.text || ' '}</Text>\n ))}\n {hasMore ? (\n <Text dimColor>\n │ [+{remaining} more, Tab/⇧Tab page, {isMac ? '⌥↑/↓' : 'g/G'} top/bottom, ↵ close]\n </Text>\n ) : (\n <Text dimColor>│ [↵ close]</Text>\n )}\n </Box>\n );\n});\n"],"names":["isMac","process","platform","memo","ExpandedOutput","lines","scrollOffset","maxVisible","EXPANDED_MAX_VISIBLE_LINES","visibleLines","slice","hasMore","length","remaining","Box","paddingLeft","Text","dimColor","flexDirection","map","line","i","text"],"mappings":";;;;+BAaA;;;eAAA;;;;mBAb0B;qBACL;2BACsB;AAG3C,IAAMA,QAAQC,QAAQC,QAAQ,KAAK;IAQnC,yBAAeC,IAAAA,WAAI,EAAC,SAASC,eAAe,KAAuE;QAArEC,QAAF,MAAEA,OAAOC,eAAT,MAASA,kCAAT,MAAuBC,YAAAA,4CAAaC,uCAA0B;IACxG,IAAMC,eAAeJ,MAAMK,KAAK,CAACJ,cAAcA,eAAeC;IAC9D,IAAMI,UAAUN,MAAMO,MAAM,GAAGN,eAAeC;IAC9C,IAAMM,YAAYR,MAAMO,MAAM,GAAGN,eAAeC;IAEhD,IAAIF,MAAMO,MAAM,KAAK,GAAG;QACtB,qBACE,qBAACE,QAAG;YAACC,aAAa;sBAChB,cAAA,qBAACC,SAAI;gBAACC,QAAQ;0BAAC;;;IAGrB;IAEA,qBACE,sBAACH,QAAG;QAACI,eAAc;QAASH,aAAa;;YACtCN,aAAaU,GAAG,CAAC,SAACC,MAAMC;uBACvB,iHAAiH;8BACjH,sBAACL,SAAI;;wBAAwB;wBAAGI,KAAKE,IAAI,IAAI;;mBAAlChB,eAAee;;YAE3BV,wBACC,sBAACK,SAAI;gBAACC,QAAQ;;oBAAC;oBACRJ;oBAAU;oBAAuBb,QAAQ,SAAS;oBAAM;;+BAG/D,qBAACgB,SAAI;gBAACC,QAAQ;0BAAC;;;;AAIvB"} | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ExpandedOutput.tsx"],"sourcesContent":["import { Box, Text } from 'ink';\nimport { memo } from 'react';\nimport { EXPANDED_MAX_VISIBLE_LINES } from '../constants.ts';\nimport AnsiText from '../lib/AnsiText.ts';\nimport type { Line } from '../types.ts';\n\nconst isMac = process.platform === 'darwin';\n\ntype Props = {\n lines: Line[];\n scrollOffset: number;\n maxVisible?: number;\n};\n\nexport default memo(function ExpandedOutput({ lines, scrollOffset, maxVisible = EXPANDED_MAX_VISIBLE_LINES }: Props) {\n const visibleLines = lines.slice(scrollOffset, scrollOffset + maxVisible);\n const hasMore = lines.length > scrollOffset + maxVisible;\n const remaining = lines.length - scrollOffset - maxVisible;\n\n if (lines.length === 0) {\n return (\n <Box paddingLeft={2}>\n <Text dimColor>│ (no output)</Text>\n </Box>\n );\n }\n\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n {visibleLines.map((line, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Lines have no unique ID, index is stable for this scrolling view\n <Text key={scrollOffset + i}>\n │ <AnsiText>{line.text || ' '}</AnsiText>\n </Text>\n ))}\n {hasMore ? (\n <Text dimColor>\n │ [+{remaining} more, Tab/⇧Tab page, {isMac ? '⌥↑/↓' : 'g/G'} top/bottom, ↵ close]\n </Text>\n ) : (\n <Text dimColor>│ [↵ close]</Text>\n )}\n </Box>\n );\n});\n"],"names":["isMac","process","platform","memo","ExpandedOutput","lines","scrollOffset","maxVisible","EXPANDED_MAX_VISIBLE_LINES","visibleLines","slice","hasMore","length","remaining","Box","paddingLeft","Text","dimColor","flexDirection","map","line","i","AnsiText","text"],"mappings":";;;;+BAcA;;;eAAA;;;;mBAd0B;qBACL;2BACsB;iEACtB;;;;;;AAGrB,IAAMA,QAAQC,QAAQC,QAAQ,KAAK;IAQnC,yBAAeC,IAAAA,WAAI,EAAC,SAASC,eAAe,KAAuE;QAArEC,QAAF,MAAEA,OAAOC,eAAT,MAASA,kCAAT,MAAuBC,YAAAA,4CAAaC,uCAA0B;IACxG,IAAMC,eAAeJ,MAAMK,KAAK,CAACJ,cAAcA,eAAeC;IAC9D,IAAMI,UAAUN,MAAMO,MAAM,GAAGN,eAAeC;IAC9C,IAAMM,YAAYR,MAAMO,MAAM,GAAGN,eAAeC;IAEhD,IAAIF,MAAMO,MAAM,KAAK,GAAG;QACtB,qBACE,qBAACE,QAAG;YAACC,aAAa;sBAChB,cAAA,qBAACC,SAAI;gBAACC,QAAQ;0BAAC;;;IAGrB;IAEA,qBACE,sBAACH,QAAG;QAACI,eAAc;QAASH,aAAa;;YACtCN,aAAaU,GAAG,CAAC,SAACC,MAAMC;uBACvB,iHAAiH;8BACjH,sBAACL,SAAI;;wBAAwB;sCACzB,qBAACM,mBAAQ;sCAAEF,KAAKG,IAAI,IAAI;;;mBADjBjB,eAAee;;YAI3BV,wBACC,sBAACK,SAAI;gBAACC,QAAQ;;oBAAC;oBACRJ;oBAAU;oBAAuBb,QAAQ,SAAS;oBAAM;;+BAG/D,qBAACgB,SAAI;gBAACC,QAAQ;0BAAC;;;;AAIvB"} |
@@ -5,2 +5,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
| import { EXPANDED_MAX_VISIBLE_LINES } from '../constants.js'; | ||
| import AnsiText from '../lib/AnsiText.js'; | ||
| const isMac = process.platform === 'darwin'; | ||
@@ -28,3 +29,5 @@ export default /*#__PURE__*/ memo(function ExpandedOutput({ lines, scrollOffset, maxVisible = EXPANDED_MAX_VISIBLE_LINES }) { | ||
| "│ ", | ||
| line.text || ' ' | ||
| /*#__PURE__*/ _jsx(AnsiText, { | ||
| children: line.text || ' ' | ||
| }) | ||
| ] | ||
@@ -31,0 +34,0 @@ }, scrollOffset + i)), |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ExpandedOutput.tsx"],"sourcesContent":["import { Box, Text } from 'ink';\nimport { memo } from 'react';\nimport { EXPANDED_MAX_VISIBLE_LINES } from '../constants.ts';\nimport type { Line } from '../types.ts';\n\nconst isMac = process.platform === 'darwin';\n\ntype Props = {\n lines: Line[];\n scrollOffset: number;\n maxVisible?: number;\n};\n\nexport default memo(function ExpandedOutput({ lines, scrollOffset, maxVisible = EXPANDED_MAX_VISIBLE_LINES }: Props) {\n const visibleLines = lines.slice(scrollOffset, scrollOffset + maxVisible);\n const hasMore = lines.length > scrollOffset + maxVisible;\n const remaining = lines.length - scrollOffset - maxVisible;\n\n if (lines.length === 0) {\n return (\n <Box paddingLeft={2}>\n <Text dimColor>│ (no output)</Text>\n </Box>\n );\n }\n\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n {visibleLines.map((line, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Lines have no unique ID, index is stable for this scrolling view\n <Text key={scrollOffset + i}>│ {line.text || ' '}</Text>\n ))}\n {hasMore ? (\n <Text dimColor>\n │ [+{remaining} more, Tab/⇧Tab page, {isMac ? '⌥↑/↓' : 'g/G'} top/bottom, ↵ close]\n </Text>\n ) : (\n <Text dimColor>│ [↵ close]</Text>\n )}\n </Box>\n );\n});\n"],"names":["Box","Text","memo","EXPANDED_MAX_VISIBLE_LINES","isMac","process","platform","ExpandedOutput","lines","scrollOffset","maxVisible","visibleLines","slice","hasMore","length","remaining","paddingLeft","dimColor","flexDirection","map","line","i","text"],"mappings":";AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,MAAM;AAChC,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,0BAA0B,QAAQ,kBAAkB;AAG7D,MAAMC,QAAQC,QAAQC,QAAQ,KAAK;AAQnC,6BAAeJ,KAAK,SAASK,eAAe,EAAEC,KAAK,EAAEC,YAAY,EAAEC,aAAaP,0BAA0B,EAAS;IACjH,MAAMQ,eAAeH,MAAMI,KAAK,CAACH,cAAcA,eAAeC;IAC9D,MAAMG,UAAUL,MAAMM,MAAM,GAAGL,eAAeC;IAC9C,MAAMK,YAAYP,MAAMM,MAAM,GAAGL,eAAeC;IAEhD,IAAIF,MAAMM,MAAM,KAAK,GAAG;QACtB,qBACE,KAACd;YAAIgB,aAAa;sBAChB,cAAA,KAACf;gBAAKgB,QAAQ;0BAAC;;;IAGrB;IAEA,qBACE,MAACjB;QAAIkB,eAAc;QAASF,aAAa;;YACtCL,aAAaQ,GAAG,CAAC,CAACC,MAAMC,IACvB,iHAAiH;8BACjH,MAACpB;;wBAA4B;wBAAGmB,KAAKE,IAAI,IAAI;;mBAAlCb,eAAeY;YAE3BR,wBACC,MAACZ;gBAAKgB,QAAQ;;oBAAC;oBACRF;oBAAU;oBAAuBX,QAAQ,SAAS;oBAAM;;+BAG/D,KAACH;gBAAKgB,QAAQ;0BAAC;;;;AAIvB,GAAG"} | ||
| {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ExpandedOutput.tsx"],"sourcesContent":["import { Box, Text } from 'ink';\nimport { memo } from 'react';\nimport { EXPANDED_MAX_VISIBLE_LINES } from '../constants.ts';\nimport AnsiText from '../lib/AnsiText.ts';\nimport type { Line } from '../types.ts';\n\nconst isMac = process.platform === 'darwin';\n\ntype Props = {\n lines: Line[];\n scrollOffset: number;\n maxVisible?: number;\n};\n\nexport default memo(function ExpandedOutput({ lines, scrollOffset, maxVisible = EXPANDED_MAX_VISIBLE_LINES }: Props) {\n const visibleLines = lines.slice(scrollOffset, scrollOffset + maxVisible);\n const hasMore = lines.length > scrollOffset + maxVisible;\n const remaining = lines.length - scrollOffset - maxVisible;\n\n if (lines.length === 0) {\n return (\n <Box paddingLeft={2}>\n <Text dimColor>│ (no output)</Text>\n </Box>\n );\n }\n\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n {visibleLines.map((line, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Lines have no unique ID, index is stable for this scrolling view\n <Text key={scrollOffset + i}>\n │ <AnsiText>{line.text || ' '}</AnsiText>\n </Text>\n ))}\n {hasMore ? (\n <Text dimColor>\n │ [+{remaining} more, Tab/⇧Tab page, {isMac ? '⌥↑/↓' : 'g/G'} top/bottom, ↵ close]\n </Text>\n ) : (\n <Text dimColor>│ [↵ close]</Text>\n )}\n </Box>\n );\n});\n"],"names":["Box","Text","memo","EXPANDED_MAX_VISIBLE_LINES","AnsiText","isMac","process","platform","ExpandedOutput","lines","scrollOffset","maxVisible","visibleLines","slice","hasMore","length","remaining","paddingLeft","dimColor","flexDirection","map","line","i","text"],"mappings":";AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,MAAM;AAChC,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,0BAA0B,QAAQ,kBAAkB;AAC7D,OAAOC,cAAc,qBAAqB;AAG1C,MAAMC,QAAQC,QAAQC,QAAQ,KAAK;AAQnC,6BAAeL,KAAK,SAASM,eAAe,EAAEC,KAAK,EAAEC,YAAY,EAAEC,aAAaR,0BAA0B,EAAS;IACjH,MAAMS,eAAeH,MAAMI,KAAK,CAACH,cAAcA,eAAeC;IAC9D,MAAMG,UAAUL,MAAMM,MAAM,GAAGL,eAAeC;IAC9C,MAAMK,YAAYP,MAAMM,MAAM,GAAGL,eAAeC;IAEhD,IAAIF,MAAMM,MAAM,KAAK,GAAG;QACtB,qBACE,KAACf;YAAIiB,aAAa;sBAChB,cAAA,KAAChB;gBAAKiB,QAAQ;0BAAC;;;IAGrB;IAEA,qBACE,MAAClB;QAAImB,eAAc;QAASF,aAAa;;YACtCL,aAAaQ,GAAG,CAAC,CAACC,MAAMC,IACvB,iHAAiH;8BACjH,MAACrB;;wBAA4B;sCACzB,KAACG;sCAAUiB,KAAKE,IAAI,IAAI;;;mBADjBb,eAAeY;YAI3BR,wBACC,MAACb;gBAAKiB,QAAQ;;oBAAC;oBACRF;oBAAU;oBAAuBX,QAAQ,SAAS;oBAAM;;+BAG/D,KAACJ;gBAAKiB,QAAQ;0BAAC;;;;AAIvB,GAAG"} |
+1
-1
| { | ||
| "name": "spawn-term", | ||
| "version": "3.5.5", | ||
| "version": "3.5.6", | ||
| "description": "Formats spawn with for terminal grouping", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
542518
5.4%179
3.47%6364
6.05%