@mmutils/logger 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1038 -2
- package/dist/cjs/index.cjs +72 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/levels.cjs +82 -0
- package/dist/cjs/levels.cjs.map +1 -0
- package/dist/cjs/logger.cjs +576 -0
- package/dist/cjs/logger.cjs.map +1 -0
- package/dist/cjs/outputs.cjs +24 -0
- package/dist/cjs/outputs.cjs.map +1 -0
- package/dist/cjs/plugins/columns.cjs +782 -0
- package/dist/cjs/plugins/columns.cjs.map +1 -0
- package/dist/cjs/plugins/graph.cjs +578 -0
- package/dist/cjs/plugins/graph.cjs.map +1 -0
- package/dist/cjs/plugins/json.cjs +644 -0
- package/dist/cjs/plugins/json.cjs.map +1 -0
- package/dist/cjs/plugins/message.cjs +108 -0
- package/dist/cjs/plugins/message.cjs.map +1 -0
- package/dist/cjs/plugins/shared.cjs +194 -0
- package/dist/cjs/plugins/shared.cjs.map +1 -0
- package/dist/cjs/time.cjs +234 -0
- package/dist/cjs/time.cjs.map +1 -0
- package/dist/cjs/utils/text.cjs +646 -0
- package/dist/cjs/utils/text.cjs.map +1 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/levels.js +72 -0
- package/dist/esm/levels.js.map +1 -0
- package/dist/esm/logger.js +572 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/outputs.js +21 -0
- package/dist/esm/outputs.js.map +1 -0
- package/dist/esm/plugins/columns.js +778 -0
- package/dist/esm/plugins/columns.js.map +1 -0
- package/dist/esm/plugins/graph.js +572 -0
- package/dist/esm/plugins/graph.js.map +1 -0
- package/dist/esm/plugins/json.js +641 -0
- package/dist/esm/plugins/json.js.map +1 -0
- package/dist/esm/plugins/message.js +105 -0
- package/dist/esm/plugins/message.js.map +1 -0
- package/dist/esm/plugins/shared.js +187 -0
- package/dist/esm/plugins/shared.js.map +1 -0
- package/dist/esm/time.js +231 -0
- package/dist/esm/time.js.map +1 -0
- package/dist/esm/utils/text.js +621 -0
- package/dist/esm/utils/text.js.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/levels.d.ts +50 -0
- package/dist/types/logger.d.ts +245 -0
- package/dist/types/outputs.d.ts +12 -0
- package/dist/types/plugins/columns.d.ts +151 -0
- package/dist/types/plugins/graph.d.ts +243 -0
- package/dist/types/plugins/json.d.ts +169 -0
- package/dist/types/plugins/message.d.ts +181 -0
- package/dist/types/plugins/shared.d.ts +74 -0
- package/dist/types/time.d.ts +48 -0
- package/dist/types/types.d.ts +176 -0
- package/dist/types/utils/text.d.ts +231 -0
- package/package.json +85 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columns.js","sources":["../../../src/plugins/columns.ts"],"sourcesContent":["import type { BaseLogger } from '../logger.js';\nimport type {\n BakedStyles,\n LoggerPlugin,\n Output,\n Transformer,\n} from '../types.js';\nimport { charWidth, SLOW_CHARS, textWidth } from '../utils/text.js';\nimport { paint } from './shared.js';\n\nexport interface ColumnsPluginOptions {\n /** Number of columns, from 1 to 100. Default: `2`. */\n readonly columns?: number;\n /**\n * Width of each column in terminal columns, frame excluded, from 2 to\n * 10,000. Default: the terminal width (`process.stdout.columns`, 80 when it\n * is unknown) minus the frames, split evenly; read once, when the plugin is\n * created.\n */\n readonly width?: number;\n /** Text between columns, without control characters. Default: `' | '`. */\n readonly frame?: string;\n /** Style name of the frame. Default: `'textDim'`. */\n readonly frameStyle?: string;\n /**\n * Kinds laid out in columns. Kinds without a template map (no plugin\n * renders them) are skipped; never list JSON kinds. Default:\n * `['message', 'graph']`.\n */\n readonly kinds?: readonly string[];\n /**\n * How lines longer than the width are fitted, per kind (see `WrapMode`).\n * A mode sets the default for all kinds; an object sets kinds by name,\n * `'*'` for the others, merged over `DEFAULT_COLUMNS_WRAP`\n * (`{ '*': 'hard', graph: 'truncate' }`): a graph wider than its column is\n * cut with a dim `…`, never wrapped into a mess. Kinds of other plugins\n * are set by their kind name, e.g. `{ cpu: 'truncate' }` for\n * `graphPlugin({ kind: 'cpu' })`.\n */\n readonly wrap?: ColumnsWrap;\n /**\n * Spaces at the start of lines created by wrapping, so a continuation\n * doesn't look like a new log, from 0 to `width - 1`. The cell's own\n * lines (object keys, stack frames, graph rows) are not indented. Default:\n * `0`.\n */\n readonly indent?: number;\n /**\n * Redraw the rows that can still change on every log, so the grid fills\n * on screen as the calls come in. Needs a terminal: with the default\n * `write`, output that is not a TTY (piped or redirected) is written row\n * by row instead, and so is a grid wider than the terminal. A custom\n * `write` must go to the terminal. Default: `false`.\n */\n readonly live?: boolean;\n /** Line destination. Default: `console.log`. */\n readonly write?: (text: string) => void;\n}\n\n/**\n * Wrap mode of all kinds, or modes by kind name with `'*'` for the others.\n */\nexport type ColumnsWrap = WrapMode | Readonly<Record<string, WrapMode>>;\n\n/**\n * Wrap modes used unless `wrap` overrides them: graphs are cut (a wrapped\n * graph is unreadable, a cut one shows the width is off), everything else\n * wraps hard.\n */\nexport const DEFAULT_COLUMNS_WRAP: Readonly<Record<string, WrapMode>> = {\n '*': 'hard',\n graph: 'truncate',\n};\n\n/**\n * Methods added by `columnsPlugin`. Logs of the plugin's kinds become cells\n * of a grid: `column` and `row` move the cell the next log goes to. A row is\n * a row of cells, as tall as its tallest cell, not a terminal line.\n */\nexport interface ColumnsMethods {\n /**\n * Makes a column active: the next log goes to that column's next row.\n * Without an index, moves to the next column; from the last column it\n * writes the grid and starts a new one in column 0. The first call starts\n * the grid.\n *\n * @throws RangeError if the index is not an integer below `columns`.\n */\n column(index?: number): void;\n /**\n * Moves the active column's cursor: the next log goes to row `index`,\n * replacing what is there, and later logs continue below it. Without an\n * index, moves one row down: the cell at the cursor is left as it is\n * (empty if nothing was logged there). A row that was\n * already written (scrolled off in live mode) can't change: logs for it\n * go to the column's next free row. Starts the grid in column 0 if\n * needed.\n *\n * @throws RangeError if the index is not an integer from 0 to the number\n * of rows (an existing row or the next new one).\n */\n row(index?: number): void;\n /**\n * Writes the rest of the grid, empty cells blank, and returns to normal\n * output. Does nothing without a grid.\n */\n endColumns(): void;\n}\n\ninterface ColumnsSettings {\n readonly columns: number;\n readonly width: number;\n readonly frame: string;\n /** Frame before an empty last column: no trailing whitespace. */\n readonly frameEnd: string;\n readonly frameStyle: string;\n readonly kinds: readonly string[];\n /** Wrap modes by kind, `'*'` for the others; no prototype. */\n readonly wrap: Readonly<Record<string, WrapMode>>;\n readonly indent: number;\n readonly live: boolean;\n readonly customWrite: boolean;\n readonly write: (text: string) => void;\n}\n\ninterface Cell {\n /**\n * Rendered lines, wrapped to the column width, not padded: padding is\n * added when rows are written, so buffered cells hold only their text.\n */\n readonly lines: readonly string[];\n /** Terminal columns of each line. */\n readonly widths: readonly number[];\n readonly styles: BakedStyles;\n}\n\nconst RESET = '\\x1b[0m';\nconst MAX_COLUMNS = 100;\nconst MAX_WIDTH = 10_000;\nconst MIN_WIDTH = 2;\n/**\n * Width of a whole grid, frames included, at most. Output grows with the\n * grid's width times the lines of a row.\n */\nconst MAX_TOTAL_WIDTH = 10_000;\n/** Lines of one cell at most; the last one becomes `CELL_CUT_NOTE`. */\nconst MAX_CELL_LINES = 1000;\n/**\n * Rows a streaming grid holds at most while waiting for a column: older\n * rows are written as they are.\n */\nconst MAX_BUFFERED_ROWS = 1000;\nconst CELL_CUT_NOTE = `… cut at ${String(MAX_CELL_LINES)} lines`;\nconst TAB_SIZE = 8;\n/** Terminal height assumed when it is unknown. */\nconst DEFAULT_ROWS = 24;\n\n/* eslint-disable no-control-regex -- matching control characters is the point */\nconst CONTROL = /[\\x00-\\x1f\\x7f-\\x9f]/;\nconst SGR_AT = /\\x1B\\[[0-9;:]*m/y;\n/* eslint-enable no-control-regex */\n\n/**\n * SGR sequences in effect after `sgr`, replayed at the start of a wrapped\n * line. A reset clears them.\n */\nconst applySgr = (active: string, sgr: string): string => {\n const params = sgr.slice(2, -1);\n if (params === '' || params === '0') return '';\n return params.startsWith('0;') ? sgr : active + sgr;\n};\n\n/**\n * Ends a wrapped line with a reset if styles are in effect, so they never\n * reach the padding, the frame or the next column.\n */\nconst closeLine = (text: string, active: string): string =>\n active === '' ? text : `${text}${RESET}`;\n\n/**\n * How lines longer than the column width are fitted:\n * - `'hard'`: wrapped at exactly the width, even mid-word;\n * - `'word'`: wrapped at the last space that fits (the space is dropped);\n * words longer than the width are wrapped hard;\n * - `'truncate'`: cut at the width, with a dim `…` in the last column. The\n * cell's own lines are kept.\n */\nexport type WrapMode = 'hard' | 'word' | 'truncate';\n\nconst SGR_GLOBAL = new RegExp(SGR_AT.source, 'g');\n\n/**\n * Builds the wrapped lines of one cell. A single module-level instance:\n * wrapping is synchronous and never re-entered, so nothing is allocated per\n * log but the strings.\n */\nclass LineBuilder {\n out: string[] = [];\n /** Terminal columns of each line in `out`. */\n widths: number[] = [];\n width = 0;\n word = false;\n /** Spaces at the start of lines created by wrapping. */\n indent = '';\n /** Lines to produce at most; the rest of the line is skipped. */\n limit = Infinity;\n /** SGR sequences in effect, carried from line to line of a cell. */\n active = '';\n /** A line was left out because of `limit`. */\n dropped = false;\n private text = '';\n private used = 0;\n /** Columns taken before any text: the indent on wrapped lines. */\n private lineStart = 0;\n /** Last space a word wrap can break at: index in `text`, or -1. */\n private breakAt = -1;\n private breakUsed = 0;\n private breakActive = '';\n /**\n * A word wrap broke the line and nothing visible followed yet: spaces\n * are dropped with the break, also in the next runs.\n */\n private atBreak = false;\n\n resetDropped(): void {\n this.dropped = false;\n }\n\n get full(): boolean {\n return this.out.length >= this.limit;\n }\n\n start(\n out: string[],\n widths: number[],\n width: number,\n word: boolean,\n indent: number,\n limit: number\n ): void {\n this.out = out;\n this.widths = widths;\n this.width = width;\n this.word = word;\n this.indent = ' '.repeat(indent);\n this.limit = limit;\n this.startLine(false);\n }\n\n /**\n * @param wrapped A line created by wrapping: starts with the indent,\n * before the styles in effect, so a background never fills it.\n */\n startLine(wrapped: boolean): void {\n const indent = wrapped ? this.indent : '';\n this.text = indent + this.active;\n this.used = indent.length;\n this.lineStart = indent.length;\n this.breakAt = -1;\n this.atBreak = false;\n }\n\n /**\n * Ends the line; `wrapped` when the same text continues. A line holding\n * only what followed a word wrap break (spaces, styles) is left out.\n */\n endLine(wrapped = false): void {\n if (this.atBreak) {\n // nothing visible: the previous line closed its styles\n } else if (this.full) this.dropped = true;\n else {\n this.out.push(closeLine(this.text, this.active));\n this.widths.push(this.used);\n }\n this.startLine(wrapped);\n }\n\n /** Plain text: every code unit is one column wide. */\n addRun(run: string): void {\n let start = 0;\n while (!this.full) {\n if (this.atBreak) {\n while (run.charCodeAt(start) === 0x20) start++;\n if (start === run.length) return;\n this.atBreak = false;\n }\n const rest = run.length - start;\n const room = this.width - this.used;\n if (rest <= room) {\n if (this.word) this.markBreak(run, start);\n this.text += start === 0 ? run : run.slice(start);\n this.used += rest;\n return;\n }\n if (this.word) {\n const space = run.lastIndexOf(' ', start + room);\n // a break that leaves an empty line is no break\n if (space >= start && (space > start || this.used > this.lineStart)) {\n this.text += run.slice(start, space);\n this.used += space - start;\n this.endLine(true);\n this.atBreak = true;\n start = space + 1;\n continue;\n }\n if (this.breakAt >= 0) {\n this.splitAtBreak();\n continue;\n }\n }\n this.text += run.slice(start, start + room);\n this.used += room;\n start += room;\n this.endLine(true);\n }\n }\n\n /**\n * One code point that is not one column wide, or a control. A wide\n * character that doesn't fit even on a fresh line is placed anyway.\n */\n addChar(char: string, columns: number): void {\n while (\n this.used + columns > this.width &&\n this.used > this.lineStart &&\n !this.full\n )\n if (this.word && this.breakAt >= 0) this.splitAtBreak();\n else this.endLine(true);\n // no room next to the indent: this line goes without it\n if (this.used === this.lineStart && this.used + columns > this.width) {\n this.text = this.active;\n this.used = 0;\n this.lineStart = 0;\n }\n this.atBreak = false;\n this.text += char;\n this.used += columns;\n }\n\n addTab(): void {\n this.atBreak = false;\n if (this.used === this.width) this.endLine(true);\n const spaces = Math.min(\n TAB_SIZE - (this.used % TAB_SIZE),\n this.width - this.used\n );\n this.text += ' '.repeat(spaces);\n this.used += spaces;\n }\n\n addSgr(sgr: string): void {\n this.active = applySgr(this.active, sgr);\n this.text += sgr;\n }\n\n /** Remembers the last space of a run appended whole. */\n private markBreak(run: string, start: number): void {\n const space = run.lastIndexOf(' ');\n if (space < start) return;\n const used = this.used + space - start;\n if (used === this.lineStart) return;\n this.breakAt = this.text.length + space - start;\n this.breakUsed = used;\n this.breakActive = this.active;\n }\n\n /** Ends the line at the last space; the text after it starts a new line. */\n private splitAtBreak(): void {\n const { text, breakAt, breakActive, indent } = this;\n if (this.full) this.dropped = true;\n else {\n this.out.push(closeLine(text.slice(0, breakAt), breakActive));\n this.widths.push(this.breakUsed);\n }\n this.used = indent.length + this.used - this.breakUsed - 1;\n this.lineStart = indent.length;\n this.text = indent + breakActive + text.slice(breakAt + 1);\n this.breakAt = -1;\n this.atBreak = this.used === this.lineStart;\n }\n}\n\nconst builder = new LineBuilder();\n\nconst SPECIAL = new RegExp(SLOW_CHARS.source, 'g');\n\n/**\n * A control character as `\\xHH`, like the `'safe'` sanitizer.\n */\nconst hexEscape = (code: number): string =>\n `\\\\x${code.toString(16).toUpperCase().padStart(2, '0')}`;\n\n/**\n * Feeds one line to the builder: runs of plain text are sliced, only escape\n * codes, tabs and characters that are not one column wide are handled one\n * by one. Stops when the builder is full.\n *\n * Control characters other than SGR sequences and tabs are shown as `\\xHH`,\n * even in text logged with `sanitize: 'none'`: their effect on the terminal\n * (carriage returns, cursor moves, screen clears) can't be laid out, and in\n * live mode they would break the redraw.\n */\nconst feedLine = (line: string): void => {\n // one scan: a line without special characters is a single run\n let start = 0;\n SPECIAL.lastIndex = 0;\n for (\n let match = SPECIAL.exec(line);\n match !== null && !builder.full;\n match = SPECIAL.exec(line)\n ) {\n const { index } = match;\n if (index > start) builder.addRun(line.slice(start, index));\n const code = line.charCodeAt(index);\n start = index + 1;\n if (code === 0x1b) {\n SGR_AT.lastIndex = index;\n const sgr = SGR_AT.exec(line);\n if (sgr === null) builder.addRun('\\\\x1B');\n else {\n builder.addSgr(sgr[0]);\n start = index + sgr[0].length;\n }\n } else if (code === 0x09) builder.addTab();\n else if (code < 0x20 || (code >= 0x7f && code <= 0x9f))\n builder.addRun(hexEscape(code));\n else {\n const codePoint = line.codePointAt(index) ?? 0;\n if (codePoint > 0xffff) start = index + 2;\n builder.addChar(line.slice(index, start), charWidth(codePoint));\n }\n SPECIAL.lastIndex = start;\n }\n if (start < line.length && !builder.full) builder.addRun(line.slice(start));\n};\n\n/**\n * Cuts one line at `width` columns with `marker` (one column) in the last\n * one. Lines that fit are added as they are.\n */\nconst truncateLine = (\n line: string,\n width: number,\n out: string[],\n widths: number[],\n marker: string\n): void => {\n const { active } = builder;\n const fitted: string[] = [];\n const fittedWidths: number[] = [];\n builder.start(fitted, fittedWidths, width, false, 0, 2);\n feedLine(line);\n builder.endLine();\n if (fitted.length === 1) {\n out.push(fitted[0] ?? '');\n widths.push(fittedWidths[0] ?? 0);\n return;\n }\n // too long: again, one column narrower, and the marker\n builder.active = active;\n const cut: string[] = [];\n const cutWidths: number[] = [];\n builder.start(cut, cutWidths, width - 1, false, 0, 1);\n feedLine(line);\n builder.endLine();\n const used = cutWidths[0] ?? 0;\n // the marker in the last column\n out.push(\n `${cut[0] ?? ''}${' '.repeat(Math.max(0, width - 1 - used))}${marker}`\n );\n widths.push(width);\n // styles in effect after the whole line, for the cell's next line\n let after = active;\n if (line.includes('\\x1b'))\n for (const [sgr] of line.matchAll(SGR_GLOBAL)) after = applySgr(after, sgr);\n builder.active = after;\n};\n\nexport interface WrapTextOptions {\n /** How lines longer than the width are fitted. Default: `'hard'`. */\n readonly mode?: WrapMode;\n /** Text ending a cut line, one column wide. Default: `'…'`. */\n readonly marker?: string;\n /**\n * Spaces at the start of lines created by wrapping (`'hard'` and\n * `'word'`), below the width. The text's own lines are not indented.\n * Default: `0`.\n */\n readonly indent?: number;\n}\n\n/**\n * Wraps text into lines of at most `width` terminal columns, not padded,\n * with the columns of each line in `widths`.\n *\n * @param maxLines Lines to produce at most.\n * @returns `true` if lines were left out because of `maxLines`.\n */\nconst wrapLines = (\n text: string,\n width: number,\n { mode = 'hard', marker = '…', indent = 0 }: WrapTextOptions,\n out: string[],\n widths: number[],\n maxLines: number\n): boolean => {\n builder.active = '';\n builder.resetDropped();\n const truncate = mode === 'truncate';\n for (const line of text.split('\\n')) {\n if (out.length >= maxLines) return true;\n builder.start(out, widths, width, mode === 'word', indent, maxLines);\n if (truncate) truncateLine(line, width, out, widths, marker);\n else {\n feedLine(line);\n builder.endLine();\n if (builder.dropped) return true;\n }\n }\n return false;\n};\n\n/**\n * Splits rendered text into lines of exactly `width` terminal columns, each\n * padded with spaces. Lines longer than the width are wrapped or cut, see\n * `WrapMode`. Never splits an SGR sequence, a surrogate pair or a wide\n * character; styles in effect are closed at the end of each line and\n * reopened on the next one. Tabs become spaces up to the next multiple of 8.\n */\nexport const wrapText = (\n text: string,\n width: number,\n options: WrapTextOptions = {}\n): string[] => {\n const out: string[] = [];\n const widths: number[] = [];\n wrapLines(text, width, options, out, widths, Infinity);\n return out.map(\n (line, index) =>\n `${line}${' '.repeat(Math.max(0, width - (widths[index] ?? 0)))}`\n );\n};\n\n/**\n * Text without trailing spaces. A backwards scan: `/ +$/` is quadratic on\n * lines with many spaces (graph rows), it took 40% of a graph in a column.\n */\nconst trimSpaces = (text: string): string => {\n let end = text.length;\n while (end > 0 && text.charCodeAt(end - 1) === 0x20) end--;\n return end === text.length ? text : text.slice(0, end);\n};\n\nconst rowHeight = (row: readonly (Cell | undefined)[]): number => {\n let height = 1;\n for (const cell of row)\n if (cell !== undefined) height = Math.max(height, cell.lines.length);\n return height;\n};\n\n/**\n * Joins rows of cells into terminal lines: each row as tall as its tallest\n * cell (at least one line), empty cells blank, the frame painted with the\n * styles of the row's first cell. The last column is not padded.\n */\nconst renderRows = (\n rows: readonly (readonly (Cell | undefined)[])[],\n settings: ColumnsSettings\n): string[] => {\n const { columns, width, frame, frameEnd, frameStyle } = settings;\n const blank = ' '.repeat(width);\n const lines: string[] = [];\n for (const row of rows) {\n const { styles } = row.find((cell) => cell !== undefined) ?? {};\n const style = styles?.[frameStyle] ?? '';\n const reset = styles?.reset ?? '';\n const painted = paint(style, frame, reset);\n const paintedEnd = paint(style, frameEnd, reset);\n const height = rowHeight(row);\n for (let index = 0; index < height; index++) {\n let line = '';\n for (let column = 0; column < columns; column++) {\n const cell = row[column];\n let text = cell?.lines[index];\n if (column === columns - 1)\n text = text === undefined ? '' : trimSpaces(text);\n else if (text === undefined) text = blank;\n else {\n const used = cell?.widths[index] ?? width;\n if (used < width) text += blank.slice(0, width - used);\n }\n if (column > 0) line += text === '' ? paintedEnd : painted;\n line += text;\n }\n // a frame of spaces before an empty last column\n lines.push(trimSpaces(line));\n }\n }\n return lines;\n};\n\n/**\n * Cells of one grid. Rows that can no longer change are written and\n * dropped: `rows[0]` is row `written`.\n */\nclass Grid {\n /** Active column. */\n active = 0;\n /** Number of rows written, which can't change any more. */\n written = 0;\n /** Rows that can still change. */\n readonly rows: (Cell | undefined)[][] = [];\n /** Per column, the row the next log goes to. */\n readonly cursors: number[];\n /** Live mode: lines drawn for `rows`, redrawn on the next change. */\n private drawn = 0;\n /** Live mode: `write` is drawing the rows. */\n private drawing = false;\n\n constructor(\n private readonly settings: ColumnsSettings,\n /** Redraw on every log instead of writing finished rows. */\n readonly live: boolean\n ) {\n this.cursors = Array.from({ length: settings.columns }, () => 0);\n }\n\n /** Number of rows, written or not. */\n get rowCount(): number {\n return this.written + this.rows.length;\n }\n\n /** Puts rendered text in the active column's cell at its cursor. */\n put(text: string, styles: BakedStyles, kind: string): void {\n this.assertNotDrawing();\n const { active, settings } = this;\n let row = this.cursors[active] ?? 0;\n if (row < this.written) row = this.firstFree(active);\n while (this.rowCount <= row) this.rows.push([]);\n const cells = this.rows[row - this.written] ?? [];\n const mode = settings.wrap[kind] ?? settings.wrap['*'] ?? 'hard';\n const marker =\n mode === 'truncate' ?\n paint(styles.textDim ?? '', '…', styles.reset ?? '')\n : '…';\n const lines: string[] = [];\n const widths: number[] = [];\n const cut = wrapLines(\n text,\n settings.width,\n { mode, marker, indent: settings.indent },\n lines,\n widths,\n MAX_CELL_LINES\n );\n if (cut) {\n const note = CELL_CUT_NOTE.slice(0, settings.width);\n lines[MAX_CELL_LINES - 1] = paint(\n styles.textDim ?? '',\n note,\n styles.reset ?? ''\n );\n widths[MAX_CELL_LINES - 1] = note.length;\n }\n cells[active] = { lines, widths, styles };\n this.cursors[active] = row + 1;\n if (this.live) this.redraw();\n else this.writeReady();\n }\n\n /** Writes everything left. Live mode has it on screen already. */\n end(): void {\n if (!this.live && this.rows.length > 0)\n this.settings.write(renderRows(this.rows, this.settings).join('\\n'));\n this.freeze(this.rows.length);\n }\n\n /** Live mode: leaves what is drawn on screen, before other output. */\n freezeAll(): void {\n if (!this.live) return;\n this.assertNotDrawing();\n this.freeze(this.rows.length);\n }\n\n /**\n * A live redraw can't be interleaved: a `write` that logs to the same\n * logger would draw over the lines being drawn.\n */\n private assertNotDrawing(): void {\n if (this.drawing)\n throw new Error(\n 'columnsPlugin: write logged to the same logger during a live redraw. Write to another logger or destination.'\n );\n }\n\n private firstFree(column: number): number {\n let index = 0;\n while (index < this.rows.length && this.rows[index]?.[column] !== undefined)\n index++;\n return this.written + index;\n }\n\n private freeze(count: number): void {\n this.rows.splice(0, count);\n this.written += count;\n this.drawn = 0;\n }\n\n /** Streaming: writes the rows every column's cursor has passed. */\n private writeReady(): void {\n // rows beyond the buffer limit are written with their empty cells blank:\n // a column that stopped logging can't hold back the others forever\n const ready = Math.max(\n Math.min(...this.cursors) - this.written,\n this.rows.length - MAX_BUFFERED_ROWS\n );\n if (ready <= 0) return;\n const rows = this.rows.splice(0, ready);\n this.written += rows.length;\n if (rows.length > 0)\n this.settings.write(renderRows(rows, this.settings).join('\\n'));\n }\n\n /**\n * Live: moves up over the lines drawn last time, clears to the end of the\n * screen and draws the rows again. Rows that would not fit on the screen\n * stay written: the cursor can't reach lines that scrolled off.\n */\n private redraw(): void {\n const lines = renderRows(this.rows, this.settings);\n const up = this.drawn > 0 ? `\\x1b[${String(this.drawn)}F\\x1b[J` : '';\n this.drawing = true;\n try {\n this.settings.write(up + lines.join('\\n'));\n } finally {\n this.drawing = false;\n }\n const { rows = DEFAULT_ROWS } = process.stdout as { rows?: number };\n const room = Math.max(1, rows - 1);\n let drawn = lines.length;\n let frozen = 0;\n while (drawn > room && frozen < this.rows.length)\n drawn -= rowHeight(this.rows[frozen++] ?? []);\n this.freeze(frozen);\n this.drawn = drawn;\n }\n}\n\n/**\n * Column mode of one logger: swaps the outputs of the laid out kinds for\n * one that fills the grid, and puts them back on `endColumns`. Outside\n * column mode the logger's pipeline is untouched.\n */\nclass Columns {\n private grid: Grid | undefined;\n private saved: [kind: string, output: Output][] = [];\n /** Live mode: freezes the grid before logs of other kinds. */\n private freezer: Transformer | undefined;\n\n constructor(\n private readonly logger: BaseLogger,\n private readonly settings: ColumnsSettings\n ) {}\n\n column(index?: number): void {\n const { columns } = this.settings;\n if (\n index !== undefined &&\n !(Number.isInteger(index) && index >= 0 && index < columns)\n )\n throw new RangeError(\n `column: index must be an integer from 0 to ${String(columns - 1)}, got ${String(index)}.`\n );\n const { grid } = this;\n if (grid === undefined) this.start().active = index ?? 0;\n else if (index !== undefined) grid.active = index;\n else if (grid.active + 1 < columns) grid.active++;\n else {\n grid.end();\n this.grid = new Grid(this.settings, grid.live);\n }\n }\n\n row(index?: number): void {\n const grid = this.grid ?? this.start();\n const { active } = grid;\n if (index === undefined) {\n grid.cursors[active] = (grid.cursors[active] ?? 0) + 1;\n return;\n }\n if (!(Number.isInteger(index) && index >= 0 && index <= grid.rowCount))\n throw new RangeError(\n `row: index must be an integer from 0 to ${String(grid.rowCount)} (the next new row), got ${String(index)}.`\n );\n grid.cursors[active] = index;\n }\n\n endColumns(): void {\n const { grid } = this;\n if (grid === undefined) return;\n try {\n grid.end();\n } finally {\n this.grid = undefined;\n for (const [kind, output] of this.saved)\n this.logger.setOutput(kind, output);\n this.saved = [];\n if (this.freezer !== undefined) {\n this.logger.removeTransformer(this.freezer);\n this.freezer = undefined;\n }\n }\n }\n\n private start(): Grid {\n const { logger, settings } = this;\n const { templateMaps } = logger;\n const kinds = settings.kinds.filter(\n (kind) => templateMaps[kind] !== undefined\n );\n if (kinds.length === 0)\n throw new Error(\n `columnsPlugin: no plugin renders the kinds ${settings.kinds.map((kind) => `\"${kind}\"`).join(', ')}. Use messagePlugin or graphPlugin before columnsPlugin, or set kinds.`\n );\n const grid = new Grid(settings, this.isLive());\n this.grid = grid;\n const cellOutput: Output = (entry, { styles, kind }) => {\n let text = '';\n for (const key in entry) text += String(entry[key]);\n this.grid?.put(text, styles, kind);\n };\n for (const kind of kinds) {\n this.saved.push([kind, logger.getOutput(kind)]);\n logger.setOutput(kind, cellOutput);\n }\n // logs of other kinds, whatever their output, would move the lines a\n // live redraw moves over: the grid leaves its rows on screen first\n if (grid.live) {\n const laidOut = new Set(kinds);\n this.freezer = (entry, { kind }) => {\n if (!laidOut.has(kind)) this.grid?.freezeAll();\n return entry;\n };\n logger.addTransformer(this.freezer, 0);\n }\n return grid;\n }\n\n /**\n * Live mode needs a terminal at least as wide as the grid; checked when\n * column mode starts.\n */\n private isLive(): boolean {\n const { live, customWrite, columns, width, frame } = this.settings;\n if (!live) return false;\n const stdout = process.stdout as { isTTY?: boolean; columns?: number };\n if (!customWrite && stdout.isTTY !== true) return false;\n const total = columns * width + (columns - 1) * textWidth(frame);\n return total <= (stdout.columns ?? Infinity);\n }\n}\n\nconst assertInteger = (\n value: unknown,\n name: string,\n min: number,\n max: number\n): void => {\n if (!(\n typeof value === 'number' &&\n Number.isInteger(value) &&\n value >= min &&\n value <= max\n ))\n throw new RangeError(\n `columnsPlugin: ${name} must be an integer from ${String(min)} to ${String(max)}, got ${typeof value === 'number' ? String(value) : typeof value}.`\n );\n};\n\nconst WRAP_MODES: readonly unknown[] = ['hard', 'word', 'truncate'];\n\nconst assertWrapMode = (mode: unknown, name: string): void => {\n if (!WRAP_MODES.includes(mode))\n throw new RangeError(\n `columnsPlugin: ${name} must be 'hard', 'word' or 'truncate', got ${typeof mode === 'string' ? `'${mode}'` : typeof mode}.`\n );\n};\n\n/**\n * Wrap modes by kind: the defaults, then the option. Own keys only, into an\n * object without prototype, so kinds like `toString` or `__proto__` are\n * plain names.\n */\nconst resolveWrap = (wrap: unknown): Readonly<Record<string, WrapMode>> => {\n const modes = Object.assign(\n Object.create(null) as Record<string, WrapMode>,\n DEFAULT_COLUMNS_WRAP\n );\n if (wrap === undefined) return modes;\n if (typeof wrap === 'string') {\n assertWrapMode(wrap, 'wrap');\n modes['*'] = wrap as WrapMode;\n return modes;\n }\n if (typeof wrap !== 'object' || wrap === null || Array.isArray(wrap))\n throw new TypeError(\n `columnsPlugin: wrap must be a mode or an object of modes by kind, got ${\n wrap === null ? 'null'\n : Array.isArray(wrap) ? 'array'\n : typeof wrap\n }.`\n );\n for (const kind of Object.keys(wrap)) {\n const mode = (wrap as Record<string, unknown>)[kind];\n assertWrapMode(mode, `wrap[\"${kind}\"]`);\n modes[kind] = mode as WrapMode;\n }\n return modes;\n};\n\nconst resolveSettings = (options: ColumnsPluginOptions): ColumnsSettings => {\n const {\n columns = 2,\n frame = ' | ',\n frameStyle = 'textDim',\n kinds = ['message', 'graph'],\n live = false,\n write,\n } = options;\n assertInteger(columns, 'columns', 1, MAX_COLUMNS);\n if (typeof frame !== 'string')\n throw new TypeError(\n `columnsPlugin: frame must be a string, got ${typeof frame}.`\n );\n if (CONTROL.test(frame))\n throw new RangeError(\n 'columnsPlugin: frame must not contain control characters.'\n );\n if (typeof frameStyle !== 'string')\n throw new TypeError(\n `columnsPlugin: frameStyle must be a style name, got ${typeof frameStyle}.`\n );\n if (\n !Array.isArray(kinds) ||\n kinds.length === 0 ||\n !kinds.every((kind) => typeof kind === 'string')\n )\n throw new TypeError(\n 'columnsPlugin: kinds must be a non-empty array of kind names.'\n );\n if (typeof live !== 'boolean')\n throw new TypeError(\n `columnsPlugin: live must be a boolean, got ${typeof live}.`\n );\n if (write !== undefined && typeof write !== 'function')\n throw new TypeError(\n `columnsPlugin: write must be a function, got ${typeof write}.`\n );\n let { width } = options;\n if (width === undefined) {\n const { columns: terminal = 80 } = process.stdout as { columns?: number };\n const frames = (columns - 1) * textWidth(frame);\n const room = Math.min(terminal, MAX_TOTAL_WIDTH) - frames;\n width = Math.min(\n MAX_WIDTH,\n Math.max(MIN_WIDTH, Math.floor(room / columns))\n );\n }\n assertInteger(width, 'width', MIN_WIDTH, MAX_WIDTH);\n const total = columns * width + (columns - 1) * textWidth(frame);\n if (total > MAX_TOTAL_WIDTH)\n throw new RangeError(\n `columnsPlugin: the grid must be at most ${String(MAX_TOTAL_WIDTH)} terminal columns wide (columns × width + frames), got ${String(total)}.`\n );\n const { indent = 0 } = options;\n assertInteger(indent, 'indent', 0, width - 1);\n return {\n columns,\n width,\n frame,\n frameEnd: frame.trimEnd(),\n frameStyle,\n kinds: [...kinds],\n wrap: resolveWrap(options.wrap),\n indent,\n live,\n customWrite: write !== undefined,\n write: write ?? console.log,\n };\n};\n\n/**\n * Lays out logs in columns, side by side. Each log of the laid out kinds\n * (by default messages and graphs) is a cell, and `column()` / `row()` pick\n * the cell. Calls go call for call: the n-th log of each column shares a\n * row, and a row is as tall as its tallest cell. Lines are wrapped at\n * exactly `width` terminal columns (wide characters take two) and padded,\n * except in the last column.\n *\n * ```ts\n * const logger = new Logger()\n * .use(messagePlugin())\n * .use(graphPlugin({ width: 64 }))\n * .use(columnsPlugin({ columns: 2, width: 64 }));\n * for (const column of [0, 1]) {\n * logger.column(column);\n * logger.info('styled by default');\n * logger.infoGraph(values);\n * }\n * logger.endColumns();\n * ```\n *\n * Rows are written as soon as every column has moved past them or, with\n * `live`, redrawn on every log. Outside `column()` … `endColumns()` the\n * logger is not slowed down: the outputs are only swapped while a grid is\n * open. Use after the plugins that render the kinds.\n *\n * @throws RangeError or TypeError for invalid options.\n */\nexport const columnsPlugin = (\n options: ColumnsPluginOptions = {}\n): LoggerPlugin<ColumnsMethods> => {\n const settings = resolveSettings(options);\n return {\n name: 'columns',\n methods: (logger) => {\n const columns = new Columns(logger, settings);\n return {\n column: (index) => {\n columns.column(index);\n },\n row: (index) => {\n columns.row(index);\n },\n endColumns: () => {\n columns.endColumns();\n },\n };\n },\n };\n};\n"],"names":[],"mappings":";;;AAgEA;;;;AAIG;AACI,MAAM,oBAAoB,GAAuC;AACtE,IAAA,GAAG,EAAE,MAAM;AACX,IAAA,KAAK,EAAE,UAAU;;AAiEnB,MAAM,KAAK,GAAG,SAAS;AACvB,MAAM,WAAW,GAAG,GAAG;AACvB,MAAM,SAAS,GAAG,MAAM;AACxB,MAAM,SAAS,GAAG,CAAC;AACnB;;;AAGG;AACH,MAAM,eAAe,GAAG,MAAM;AAC9B;AACA,MAAM,cAAc,GAAG,IAAI;AAC3B;;;AAGG;AACH,MAAM,iBAAiB,GAAG,IAAI;AAC9B,MAAM,aAAa,GAAG,CAAA,SAAA,EAAY,MAAM,CAAC,cAAc,CAAC,QAAQ;AAChE,MAAM,QAAQ,GAAG,CAAC;AAClB;AACA,MAAM,YAAY,GAAG,EAAE;AAEvB;AACA,MAAM,OAAO,GAAG,sBAAsB;AACtC,MAAM,MAAM,GAAG,kBAAkB;AACjC;AAEA;;;AAGG;AACH,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,GAAW,KAAY;IACvD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;AAC/B,IAAA,IAAI,MAAM,KAAK,EAAE,IAAI,MAAM,KAAK,GAAG;AAAE,QAAA,OAAO,EAAE;AAC9C,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG;AACrD,CAAC;AAED;;;AAGG;AACH,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,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