@mmutils/logger 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +901 -2
  3. package/dist/cjs/index.cjs +72 -0
  4. package/dist/cjs/index.cjs.map +1 -0
  5. package/dist/cjs/levels.cjs +82 -0
  6. package/dist/cjs/levels.cjs.map +1 -0
  7. package/dist/cjs/logger.cjs +576 -0
  8. package/dist/cjs/logger.cjs.map +1 -0
  9. package/dist/cjs/outputs.cjs +24 -0
  10. package/dist/cjs/outputs.cjs.map +1 -0
  11. package/dist/cjs/plugins/columns.cjs +782 -0
  12. package/dist/cjs/plugins/columns.cjs.map +1 -0
  13. package/dist/cjs/plugins/graph.cjs +578 -0
  14. package/dist/cjs/plugins/graph.cjs.map +1 -0
  15. package/dist/cjs/plugins/json.cjs +644 -0
  16. package/dist/cjs/plugins/json.cjs.map +1 -0
  17. package/dist/cjs/plugins/message.cjs +108 -0
  18. package/dist/cjs/plugins/message.cjs.map +1 -0
  19. package/dist/cjs/plugins/shared.cjs +194 -0
  20. package/dist/cjs/plugins/shared.cjs.map +1 -0
  21. package/dist/cjs/time.cjs +234 -0
  22. package/dist/cjs/time.cjs.map +1 -0
  23. package/dist/cjs/utils/text.cjs +646 -0
  24. package/dist/cjs/utils/text.cjs.map +1 -0
  25. package/dist/esm/index.js +11 -0
  26. package/dist/esm/index.js.map +1 -0
  27. package/dist/esm/levels.js +72 -0
  28. package/dist/esm/levels.js.map +1 -0
  29. package/dist/esm/logger.js +572 -0
  30. package/dist/esm/logger.js.map +1 -0
  31. package/dist/esm/outputs.js +21 -0
  32. package/dist/esm/outputs.js.map +1 -0
  33. package/dist/esm/plugins/columns.js +778 -0
  34. package/dist/esm/plugins/columns.js.map +1 -0
  35. package/dist/esm/plugins/graph.js +572 -0
  36. package/dist/esm/plugins/graph.js.map +1 -0
  37. package/dist/esm/plugins/json.js +641 -0
  38. package/dist/esm/plugins/json.js.map +1 -0
  39. package/dist/esm/plugins/message.js +105 -0
  40. package/dist/esm/plugins/message.js.map +1 -0
  41. package/dist/esm/plugins/shared.js +187 -0
  42. package/dist/esm/plugins/shared.js.map +1 -0
  43. package/dist/esm/time.js +231 -0
  44. package/dist/esm/time.js.map +1 -0
  45. package/dist/esm/utils/text.js +621 -0
  46. package/dist/esm/utils/text.js.map +1 -0
  47. package/dist/types/index.d.ts +11 -0
  48. package/dist/types/levels.d.ts +50 -0
  49. package/dist/types/logger.d.ts +245 -0
  50. package/dist/types/outputs.d.ts +12 -0
  51. package/dist/types/plugins/columns.d.ts +151 -0
  52. package/dist/types/plugins/graph.d.ts +243 -0
  53. package/dist/types/plugins/json.d.ts +169 -0
  54. package/dist/types/plugins/message.d.ts +181 -0
  55. package/dist/types/plugins/shared.d.ts +74 -0
  56. package/dist/types/time.d.ts +48 -0
  57. package/dist/types/types.d.ts +176 -0
  58. package/dist/types/utils/text.d.ts +231 -0
  59. package/package.json +85 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.cjs","sources":["../../../src/plugins/graph.ts"],"sourcesContent":["import { formatHighResTime, type TimeUnit } from '@mmutils/time';\nimport { joinedOutput } from '../outputs.js';\nimport type {\n BakedStyles,\n LoggerPlugin,\n LogType,\n StyleSheet,\n} from '../types.js';\nimport {\n createSanitizer,\n describeThrown,\n resolveOutputLimits,\n safeStringify,\n scaleArray,\n stringifyData,\n textWidth,\n truncate,\n type Aggregate,\n type OutputLimits,\n type Sanitizer,\n} from '../utils/text.js';\nimport {\n DEFAULT_TEXT_STYLES,\n headerTemplates,\n mergeStyleSheets,\n paint,\n paintUnrenderable,\n type SanitizeOptions,\n type HeaderOptions,\n} from './shared.js';\n\nconst SAFE_SANITIZER = createSanitizer('safe');\n\n/**\n * Labels of the horizontal axis, displayed under the bars. Strings are shown\n * as given. Numbers are shown as plain numbers or, when `unit` is set, as\n * time formatted with `formatHighResTime` from `@mmutils/time`.\n *\n * ```ts\n * { start: 'Mon', end: 'Fri' } // Mon … Fri\n * { start: 5, end: 10 } // 5 … 10\n * { start: 500, end: 1_000_500, unit: 'ns' } // 500ns … 1ms 500ns\n * { start: 0, end: 2025, unit: 'ms' } // 0ms … 2s 25ms\n * ```\n */\nexport interface GraphAxis {\n /** Left label. */\n readonly start?: string | number;\n /** Right label. */\n readonly end?: string | number;\n /** Unit of numeric labels. When set, numbers are formatted as time. */\n readonly unit?: TimeUnit;\n /**\n * Time precision: a unit or a number of units below the largest unit of the\n * value. Default: `2`.\n */\n readonly capTo?: TimeUnit | number;\n}\n\n/** The unit a formatted time ends with: `ms` in `2s 25ms`. */\nconst LAST_UNIT = /(?:[hms]|[mµn]s)$/;\n\n/**\n * Formats an axis label. A zero time label takes the smallest unit of the\n * other label, so both show the same precision: `0` next to `2s 25ms`\n * reads `0ms`.\n *\n * @param label Label to format.\n * @param axis Axis settings.\n * @param other The opposite label.\n */\nexport const formatAxisLabel = (\n label: string | number | undefined,\n { unit, capTo = 2 }: GraphAxis,\n other?: string | number\n): string => {\n if (label === undefined) return '';\n if (typeof label === 'string') return label;\n if (unit === undefined) return String(label);\n if (label === 0 && typeof other === 'number' && other !== 0) {\n const otherLabel = formatHighResTime(other, capTo, unit);\n const otherUnit = LAST_UNIT.exec(otherLabel)?.[0] as TimeUnit | undefined;\n return formatHighResTime(0, otherUnit ?? unit, unit);\n }\n return formatHighResTime(label, capTo, unit);\n};\n\n/**\n * Where the bars of a graph start: a value, or the bottom (`'min'`) or the\n * top (`'max'`) of the graph.\n */\nexport type GraphBaseline = number | 'min' | 'max';\n\nexport interface GraphSettings {\n /**\n * Number of bar columns: the resolution values are scaled to, like `rows`\n * for the height. The frame adds 2 characters, so the graph is `cols + 2`\n * terminal columns wide; use `width` to set that instead. Default: `30`.\n */\n readonly cols?: number;\n /**\n * Total width in terminal columns, frame included: `width: 64` draws 62\n * bars and every row is exactly 64 characters wide, e.g. to fit a layout\n * column. Replaces `cols`: setting both on the plugin throws; per graph,\n * `width` wins. At least `3`.\n */\n readonly width?: number;\n /** Graph height in rows. Default: `3`. */\n readonly rows?: number;\n /** Title in the top row. Default: `''`. */\n readonly title?: string;\n /**\n * Top of the graph. Values above it draw full bars, or nothing when the\n * baseline is the top. Not lower than a numeric `baseline`. Default: the\n * maximum of the original values, raised to a numeric `baseline`.\n */\n readonly max?: number;\n /**\n * Bottom of the graph. Values below it draw full bars, or nothing when the\n * baseline is the bottom. Not higher than a numeric `baseline`. Default:\n * the minimum of the original values, lowered to a numeric `baseline`.\n */\n readonly min?: number;\n /**\n * Where the bars start: bars grow from it up to values above it and down\n * to values below it, in the same color. Default: `0`, moved inside `min`\n * and `max` when they leave it out (`min: 480` alone starts at 480).\n *\n * - A number: the range always holds it, so with values from 80 to 85 the\n * bars grow from 0. Inside the range it splits the graph.\n * - `'min'`: the bottom of the graph; bars only grow up. Zooms in on\n * values far from zero; the smallest value draws no bar.\n * - `'max'`: the top of the graph; bars only grow down.\n *\n * A split graph places the baseline in proportion to the range, on one\n * scale for both sides, so equal distances draw equal bars. A side gets\n * rows only if its longest bar draws at least an eighth of a row.\n */\n readonly baseline?: GraphBaseline;\n /**\n * How values sharing a column are combined when scaled to `cols`:\n * `'average'` (smooth trend), `'max'` (keeps peaks, e.g. latency spikes) or\n * `'min'` (keeps dips). Statistics always use the original values.\n * Default: `'average'`.\n */\n readonly aggregate?: Aggregate;\n /** Unit appended to displayed values, e.g. `'%'`. Default: `''`. */\n readonly unit?: string;\n /** Displayed values precision. Default: `2`. */\n readonly precision?: number;\n /** Show the average value row. Default: `true`. */\n readonly showAverage?: boolean;\n /** Show the minimum value row. Default: `true`. */\n readonly showMin?: boolean;\n /** Show the maximum value row. Default: `true`. */\n readonly showMax?: boolean;\n /** Horizontal axis labels row under the bars. Default: none. */\n readonly axis?: GraphAxis;\n}\n\n/**\n * Data accepted by the graph kind: plain values or values with settings that\n * override the plugin's settings for a single log.\n */\nexport type GraphData = readonly number[] | GraphDataWithSettings;\n\nexport interface GraphDataWithSettings extends GraphSettings {\n readonly values: readonly number[];\n}\n\n/**\n * Upper limits of the size settings. Output grows with `cols × rows`, so\n * limits keep a single graph from blocking or crashing the process. Plugin\n * options above the limits throw; per-log settings are clamped, with a dim\n * note under the graph. `items` and `stringLength` limit data rendered as\n * text instead of a graph (see `OutputLimits`).\n */\ntype SizeSetting = 'cols' | 'rows' | 'precision';\n\nexport interface GraphLimits extends OutputLimits {\n /** Maximum `cols`. Default: `500`. */\n readonly cols?: number;\n /** Maximum `rows`. Default: `50`. */\n readonly rows?: number;\n /** Maximum `precision`, at most `100`. Default: `20`. */\n readonly precision?: number;\n}\n\nexport const DEFAULT_GRAPH_LIMITS = {\n cols: 500,\n rows: 50,\n precision: 20,\n} as const satisfies Required<Pick<GraphLimits, SizeSetting>>;\n\nexport interface GraphPluginOptions\n extends HeaderOptions, SanitizeOptions, GraphSettings {\n /**\n * Upper limits of the size settings. Kept out of the per-log settings, so\n * logged data can't raise them. Default: `DEFAULT_GRAPH_LIMITS`.\n */\n readonly limits?: GraphLimits;\n /** Kind rendered by this plugin. Default: `'graph'`. */\n readonly kind?: string;\n /** Styles merged over the default text styles. */\n readonly styles?: StyleSheet;\n /** String destination. Default: `console.log`. */\n readonly write?: (text: string) => void;\n}\n\n/**\n * Logs a graph of values.\n *\n * @param values Values to plot.\n * @param settings Settings for this graph only.\n */\nexport type GraphMethod = (\n values: readonly number[],\n settings?: GraphSettings\n) => void;\n\n/**\n * Graph method per log type: `infoGraph`, `errorGraph`, etc.\n */\nexport interface GraphMethods {\n /**\n * Logs a bar graph of values with fatal level.\n *\n * @param values Numeric values to plot. Scaled to the graph's columns.\n * @param settings Settings for this graph only, e.g. `{ title: 'CPU' }`.\n */\n fatalGraph(values: readonly number[], settings?: GraphSettings): void;\n /**\n * Logs a bar graph of values with error level.\n *\n * @param values Numeric values to plot. Scaled to the graph's columns.\n * @param settings Settings for this graph only, e.g. `{ title: 'CPU' }`.\n */\n errorGraph(values: readonly number[], settings?: GraphSettings): void;\n /**\n * Logs a bar graph of values with warning level.\n *\n * @param values Numeric values to plot. Scaled to the graph's columns.\n * @param settings Settings for this graph only, e.g. `{ title: 'CPU' }`.\n */\n warningGraph(values: readonly number[], settings?: GraphSettings): void;\n /**\n * Logs a bar graph of values with info level.\n *\n * @param values Numeric values to plot. Scaled to the graph's columns.\n * @param settings Settings for this graph only, e.g. `{ title: 'CPU' }`.\n */\n infoGraph(values: readonly number[], settings?: GraphSettings): void;\n /**\n * Logs a bar graph of values with debug level.\n *\n * @param values Numeric values to plot. Scaled to the graph's columns.\n * @param settings Settings for this graph only, e.g. `{ title: 'CPU' }`.\n */\n debugGraph(values: readonly number[], settings?: GraphSettings): void;\n /**\n * Logs a bar graph of values with trace level.\n *\n * @param values Numeric values to plot. Scaled to the graph's columns.\n * @param settings Settings for this graph only, e.g. `{ title: 'CPU' }`.\n */\n traceGraph(values: readonly number[], settings?: GraphSettings): void;\n /**\n * Logs a bar graph of values with verbose level.\n *\n * @param values Numeric values to plot. Scaled to the graph's columns.\n * @param settings Settings for this graph only, e.g. `{ title: 'CPU' }`.\n */\n verboseGraph(values: readonly number[], settings?: GraphSettings): void;\n}\n\ntype ResolvedGraphSettings = Required<\n Omit<GraphSettings, 'max' | 'min' | 'axis' | 'width' | 'baseline'>\n> &\n Pick<GraphSettings, 'max' | 'min' | 'axis' | 'baseline'>;\n\n/**\n * Characters the frame adds to the bars: `│` on each side.\n */\nconst FRAME_WIDTH = 2;\n\ntype SizeLimits = Required<Pick<GraphLimits, SizeSetting>>;\n\n/**\n * Size settings with their minimum values.\n */\nconst SIZE_SETTINGS = [\n ['cols', 1],\n ['rows', 1],\n ['precision', 0],\n] as const satisfies readonly (readonly [SizeSetting, number])[];\n\n/**\n * `toFixed` accepts at most 100 digits.\n */\nconst MAX_PRECISION = 100;\n\nconst isIntegerIn = (value: unknown, min: number, max: number): boolean =>\n Number.isInteger(value) &&\n (value as number) >= min &&\n (value as number) <= max;\n\n/**\n * Validates the limits and the plugin's size settings, which are\n * configuration: invalid values throw when the plugin is created.\n */\nconst validateLimits = (limits: SizeLimits): void => {\n for (const [name, min] of SIZE_SETTINGS) {\n const limit = limits[name];\n const maxLimit = name === 'precision' ? MAX_PRECISION : Infinity;\n if (!isIntegerIn(limit, min, maxLimit))\n throw new RangeError(\n `graphPlugin: limits.${name} must be an integer ${maxLimit === Infinity ? `of at least ${String(min)}` : `from ${String(min)} to ${String(maxLimit)}`}, got ${String(limit)}.`\n );\n }\n};\n\nconst validateSizes = (\n defaults: ResolvedGraphSettings,\n limits: SizeLimits\n): void => {\n for (const [name, min] of SIZE_SETTINGS)\n if (!isIntegerIn(defaults[name], min, limits[name]))\n throw new RangeError(\n `graphPlugin: ${name} must be an integer from ${String(min)} to ${String(limits[name])}, got ${String(defaults[name])}.`\n );\n};\n\n/**\n * Bars of a plugin `width`, validated against `limits.cols` plus the frame.\n *\n * @returns `undefined` without `width`.\n * @throws RangeError if `cols` is set too, or `width` is out of range.\n */\nconst colsOfWidth = (\n { cols, width }: GraphPluginOptions,\n limits: SizeLimits\n): number | undefined => {\n if (width === undefined) return undefined;\n if (cols !== undefined)\n throw new RangeError(\n 'graphPlugin: set cols (bars) or width (terminal columns, frame included), not both.'\n );\n const max = limits.cols + FRAME_WIDTH;\n if (!isIntegerIn(width, 1 + FRAME_WIDTH, max))\n throw new RangeError(\n `graphPlugin: width must be an integer from ${String(1 + FRAME_WIDTH)} to ${String(max)}, got ${String(width)}.`\n );\n return width - FRAME_WIDTH;\n};\n\nconst describeSetting = (value: unknown): string =>\n typeof value === 'number' ? String(value) : safeStringify(value);\n\n/**\n * Applies the `width` of a single graph: clamps it to the limits (values\n * that are not finite numbers fall back to the plugin's width) and sets the\n * bars. A per-graph `width` wins over a per-graph `cols`.\n *\n * @returns A note if the width was changed, e.g. `width 100000 → 502`.\n */\nconst limitWidth = (\n settings: { cols: number },\n width: unknown,\n defaults: ResolvedGraphSettings,\n limits: SizeLimits\n): string | undefined => {\n const limited =\n typeof width === 'number' && Number.isFinite(width) ?\n Math.min(\n limits.cols + FRAME_WIDTH,\n Math.max(1 + FRAME_WIDTH, Math.trunc(width))\n )\n : defaults.cols + FRAME_WIDTH;\n settings.cols = limited - FRAME_WIDTH;\n return limited === width ? undefined : (\n `width ${describeSetting(width)} → ${String(limited)}`\n );\n};\n\n/**\n * Clamps the size settings of a single graph to the limits. Values that are\n * not finite numbers fall back to the plugin's settings.\n *\n * @returns Notes on the changed values, e.g. `cols 100000 → 500`.\n */\nconst limitSizes = (\n settings: { -readonly [K in SizeSetting]: number },\n defaults: ResolvedGraphSettings,\n limits: SizeLimits\n): string[] => {\n const notes: string[] = [];\n for (const [name, min] of SIZE_SETTINGS) {\n // logged data is not type checked\n const value: unknown = settings[name];\n if (value === defaults[name]) continue;\n if (value === undefined) {\n settings[name] = defaults[name];\n continue;\n }\n const limited =\n typeof value === 'number' && Number.isFinite(value) ?\n Math.min(limits[name], Math.max(min, Math.trunc(value)))\n : defaults[name];\n if (limited === value) continue;\n settings[name] = limited;\n notes.push(`${name} ${describeSetting(value)} → ${String(limited)}`);\n }\n return notes;\n};\n\nconst isFiniteNumber = (value: unknown): value is number =>\n Number.isFinite(value);\n\nconst isBaseline = (value: unknown): value is GraphBaseline =>\n value === 'min' || value === 'max' || Number.isFinite(value);\n\ninterface RangeSettings {\n baseline?: GraphBaseline | undefined;\n min?: number | undefined;\n max?: number | undefined;\n}\n\n/**\n * The first range setting out of order, and the bound it passed: `min`\n * above a numeric baseline or `max` below it; with `'min'`, `'max'` or the\n * default baseline, `min` above `max`.\n */\nconst outOfOrder = ({\n baseline,\n min,\n max,\n}: RangeSettings):\n | readonly [name: 'min' | 'max', bound: number, boundName: string]\n | undefined => {\n if (typeof baseline === 'number') {\n if (min !== undefined && min > baseline)\n return ['min', baseline, 'baseline'];\n if (max !== undefined && max < baseline)\n return ['max', baseline, 'baseline'];\n } else if (min !== undefined && max !== undefined && min > max)\n return ['min', max, 'max'];\n return undefined;\n};\n\n/**\n * Validates the plugin's range settings, which are configuration: `min` and\n * `max` finite numbers, `baseline` a finite number, `'min'` or `'max'`, and\n * `min ≤ baseline ≤ max` (`min ≤ max` without a numeric baseline).\n *\n * @throws RangeError for an invalid setting.\n */\nconst validateRange = (defaults: ResolvedGraphSettings): void => {\n const { baseline, min, max } = defaults;\n if (baseline !== undefined && !isBaseline(baseline))\n throw new RangeError(\n `graphPlugin: baseline must be a finite number, 'min' or 'max', got ${describeSetting(baseline)}.`\n );\n for (const [name, value] of [\n ['min', min],\n ['max', max],\n ] as const)\n if (value !== undefined && !isFiniteNumber(value))\n throw new RangeError(\n `graphPlugin: ${name} must be a finite number, got ${describeSetting(value)}.`\n );\n const wrong = outOfOrder(defaults);\n if (wrong) {\n const [name, bound, boundName] = wrong;\n throw new RangeError(\n `graphPlugin: ${name} must not be ${name === 'min' ? 'higher' : 'lower'} than ${boundName} (${String(bound)}), got ${String(defaults[name])}.`\n );\n }\n};\n\n/**\n * A range setting of a single graph, or the plugin's if it is invalid.\n *\n * @param notes Receives a note if an invalid value was replaced, e.g.\n * `baseline NaN → 0` or `max \"x\" ignored` (the plugin has none).\n */\nconst rangeSetting = <T>(\n name: string,\n value: unknown,\n isValid: (value: unknown) => value is T,\n fallback: T | undefined,\n notes: string[]\n): T | undefined => {\n if (isValid(value)) return value;\n if (value !== undefined)\n notes.push(\n `${name} ${describeSetting(value)} ${fallback === undefined ? 'ignored' : `→ ${String(fallback)}`}`\n );\n return fallback;\n};\n\n/**\n * Checks the range settings of a single graph: invalid values fall back to\n * the plugin's, then settings out of order are moved to the bound they\n * passed (`min 30 → 20` for a baseline of 20), also when the plugin set\n * them.\n *\n * @param notes Receives notes on the changed values.\n */\nconst limitRange = (\n settings: RangeSettings,\n defaults: ResolvedGraphSettings,\n notes: string[]\n): void => {\n // logged data is not type checked\n const { baseline, min, max } = settings as Record<string, unknown>;\n settings.baseline = rangeSetting(\n 'baseline',\n baseline,\n isBaseline,\n defaults.baseline,\n notes\n );\n settings.min = rangeSetting('min', min, isFiniteNumber, defaults.min, notes);\n settings.max = rangeSetting('max', max, isFiniteNumber, defaults.max, notes);\n // at most twice: `min` and `max` on the wrong side of the baseline\n for (let wrong = outOfOrder(settings); wrong; wrong = outOfOrder(settings)) {\n const [name, bound] = wrong;\n notes.push(`${name} ${String(settings[name])} → ${String(bound)}`);\n settings[name] = bound;\n }\n};\n\n/**\n * Text of a per-log label setting, which comes from logged data: strings are\n * cut to `stringLength` like message text, `null` and `undefined` are empty,\n * other values are described (`5`, `{\"a\":1}`) instead of breaking the row\n * layout.\n */\nconst textSetting = (value: unknown, limits: Required<OutputLimits>): string =>\n typeof value === 'string' ? truncate(value, limits.stringLength)\n : value === null || value === undefined ? ''\n : safeStringify(value, limits);\n\nconst axisLabel = (\n value: unknown,\n limits: Required<OutputLimits>\n): string | number | undefined =>\n value === undefined || typeof value === 'number' ?\n value\n : textSetting(value, limits);\n\n/**\n * Cuts the title, unit and axis labels of a single graph to the output\n * limits. A length check for ordinary labels.\n */\nconst limitLabels = (\n settings: { title: string; unit: string; axis?: GraphAxis },\n limits: Required<OutputLimits>\n): void => {\n settings.title = textSetting(settings.title, limits);\n settings.unit = textSetting(settings.unit, limits);\n const { axis } = settings;\n if (typeof axis !== 'object' || (axis as unknown) === null) return;\n const start = axisLabel(axis.start, limits);\n const end = axisLabel(axis.end, limits);\n settings.axis = {\n ...axis,\n ...(start !== undefined && { start }),\n ...(end !== undefined && { end }),\n };\n};\n\n/**\n * Key of graph data whose settings could not be read; the value is what was\n * thrown. A symbol: data can't set it by accident.\n */\nconst SETTINGS_ERROR = Symbol('settingsError');\n\nconst paintNote = (\n note: string,\n styles: BakedStyles,\n { label }: Sanitizer\n): string => paint(styles['textDim'] ?? '', label(note), styles['reset'] ?? '');\n\n/**\n * Eight vertical steps of a single row, from empty to full.\n */\nconst BAR_SYMBOLS = ' ▁▂▃▄▅▆▇█';\nconst STEPS = BAR_SYMBOLS.length - 1;\n\n/**\n * Eighths of a row filled by `fill` rows: `0` for empty, negative or `NaN`.\n */\nconst eighthsOf = (fill: number): number =>\n fill >= 1 ? STEPS\n : fill > 0 ? Math.round(fill * STEPS)\n : 0;\n\n/**\n * A row filled from the top by `eighths`, for bars growing down: the\n * nearest of the upper blocks every terminal draws, `▔` (an eighth) and `▀`\n * (a half). The other upper eighths (🮂 🮃 🮄 🮅 🮆, Symbols for Legacy\n * Computing) are missing from many fonts and renderers, and a lower block\n * in inverse video paints the cell background; so tips below the baseline\n * are coarser than above it.\n */\nconst upperBlock = (eighths: number): string =>\n eighths === 0 ? ' '\n : eighths <= 2 ? '▔'\n : eighths <= 6 ? '▀'\n : '█';\n\nconst isNumberArray = (value: unknown): value is readonly number[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'number');\n\nconst isGraphDataWithSettings = (\n value: unknown\n): value is GraphDataWithSettings =>\n typeof value === 'object' &&\n value !== null &&\n 'values' in value &&\n isNumberArray(value.values);\n\n/**\n * Converts values to rows of bar symbols growing up from `min`, top row\n * first.\n *\n * @param max Top of the graph: higher values draw full bars.\n * @param min Bottom of the graph. Default: `0`.\n */\nexport const valuesToBars = (\n values: readonly number[],\n rows: number,\n max: number,\n min = 0\n): string[] => {\n const lines: string[] = [];\n const rowValue = (max - min) / rows;\n for (let row = rows - 1; row >= 0; row--) {\n let line = '';\n for (const value of values)\n line += BAR_SYMBOLS.charAt(\n eighthsOf(rowValue > 0 ? (value - min) / rowValue - row : 0)\n );\n lines.push(line);\n }\n return lines;\n};\n\n/**\n * Value per row of a graph with `below` of its `rows` under the baseline:\n * the side that needs more per row sets the scale of both.\n */\nconst rowValueOf = (\n rows: number,\n top: number,\n bottom: number,\n baseline: number,\n below: number\n): number =>\n Math.max(\n below < rows ? (top - baseline) / (rows - below) : 0,\n below > 0 ? (baseline - bottom) / below : 0\n );\n\n/**\n * Converts values to rows of bars growing from `baseline`: up to values\n * above it and down to values below it, top row first.\n *\n * The baseline is placed in proportion to `bottom`…`top`, at the row\n * boundary next to that position that gives the bars more room. Both sides\n * share the scale of the side that needs more per row, so nothing is cut\n * and equal distances draw equal bars. A side gets at least one row (if\n * `rows` allows) when a bar to its end draws at least an eighth of that\n * row, and none otherwise: a value of -0.001 next to 100 sits on the\n * baseline instead of taking a row. Bars growing down end in upper blocks\n * (`upperBlock`).\n */\nconst barsFromBaseline = (\n values: readonly number[],\n rows: number,\n top: number,\n bottom: number,\n baseline: number\n): string[] => {\n const span = top - bottom;\n // nothing to draw: no range, or one that can't be scaled\n if (!(span > 0 && Number.isFinite(span)))\n return Array.from({ length: rows }, () => ' '.repeat(values.length));\n const proportional = ((baseline - bottom) / span) * rows;\n const least =\n (\n bottom < baseline &&\n eighthsOf(\n (baseline - bottom) / rowValueOf(rows, top, bottom, baseline, 1)\n ) > 0\n ) ?\n 1\n : 0;\n const most =\n (\n top > baseline &&\n eighthsOf(\n (top - baseline) / rowValueOf(rows, top, bottom, baseline, rows - 1)\n ) > 0\n ) ?\n rows - 1\n : rows;\n let rowsBelow: number;\n if (least > most)\n // one row for two sides: the larger side gets it\n rowsBelow = Math.min(rows, Math.max(0, Math.round(proportional)));\n else {\n // the row boundary below or above the exact position, whichever gives\n // the bars more room (a smaller value per row)\n const lower = Math.min(most, Math.max(least, Math.floor(proportional)));\n const upper = Math.min(most, Math.max(least, Math.ceil(proportional)));\n rowsBelow =\n (\n rowValueOf(rows, top, bottom, baseline, upper) <\n rowValueOf(rows, top, bottom, baseline, lower)\n ) ?\n upper\n : lower;\n }\n const rowsAbove = rows - rowsBelow;\n const rowValue = rowValueOf(rows, top, bottom, baseline, rowsBelow);\n const lines: string[] = [];\n for (let row = rowsAbove - 1; row >= 0; row--) {\n let line = '';\n for (const value of values)\n line += BAR_SYMBOLS.charAt(\n eighthsOf((value - baseline) / rowValue - row)\n );\n lines.push(line);\n }\n for (let row = 0; row < rowsBelow; row++) {\n let line = '';\n for (const value of values)\n line += upperBlock(eighthsOf((baseline - value) / rowValue - row));\n lines.push(line);\n }\n return lines;\n};\n\n/**\n * `toFixed` without a sign on zero: `-0.004` with precision 2 is `0.00`,\n * not `-0.00`.\n */\nconst fixed = (number: number, precision: number): string => {\n const text = number.toFixed(precision);\n return text.startsWith('-') && Number(text) === 0 ? text.slice(1) : text;\n};\n\n/**\n * Text and the style it is painted with.\n */\ntype Segment = readonly [text: string, style: string];\n\nconst segmentsLength = (segments: readonly Segment[]): number => {\n let length = 0;\n for (const [text] of segments) length += textWidth(text);\n return length;\n};\n\nconst renderSegments = (segments: readonly Segment[], reset: string) => {\n let text = '';\n for (const [segment, style] of segments) text += paint(style, segment, reset);\n return text;\n};\n\n/**\n * Renders a framed graph with an optional axis row and value statistics:\n * title, bars, frame and values in `textHighlight`, legend labels in\n * `textNormal`, axis labels and units in `textDim`. When the baseline splits\n * the graph, a `baseline` row follows the average.\n *\n * Average, min, max and the default top and bottom are computed from the\n * original values, so peaks blunted by scaling are still reported. Bars are\n * scaled to `cols` with `settings.aggregate`. The top value is shown on the\n * title row, the bottom value on the average row.\n *\n * Title, unit and axis labels are sanitized as single line `label`s and\n * measured in terminal columns with `textWidth` (wide characters take two,\n * as in columns). Default: `'safe'` (see `Sanitize`).\n */\nexport const renderGraph = (\n values: readonly number[],\n settings: ResolvedGraphSettings,\n {\n textNormal = '',\n textDim = '',\n textHighlight = '',\n reset = '',\n }: BakedStyles = {},\n { label }: Sanitizer = SAFE_SANITIZER\n): string => {\n const { cols, rows, precision, min: fixedMin, max: fixedMax } = settings;\n const title = label(settings.title);\n const unit = label(settings.unit);\n // statistics, top and bottom describe the data, not the scaled bars\n let min = Infinity;\n let max = -Infinity;\n let sum = 0;\n for (const value of values) {\n if (value < min) min = value;\n if (value > max) max = value;\n sum += value;\n }\n if (!values.length) min = max = 0;\n const average = values.length ? sum / values.length : 0;\n // the default baseline, 0, moves inside a fixed range: `min: 480` alone\n // starts the bars at 480\n const setting =\n settings.baseline ??\n Math.min(Math.max(0, fixedMin ?? -Infinity), fixedMax ?? Infinity);\n let top: number;\n let bottom: number;\n let baseline: number;\n if (typeof setting === 'number') {\n // the range holds a numeric baseline, also when `min` or `max` leave it\n // out (the plugin rejects or moves those); without values it is only\n // the baseline, so the zeros of the scaled bars draw nothing\n baseline = setting;\n top = Math.max(fixedMax ?? (values.length ? max : setting), setting);\n bottom = Math.min(fixedMin ?? (values.length ? min : setting), setting);\n } else {\n bottom = fixedMin ?? (values.length ? min : (fixedMax ?? 0));\n top = Math.max(fixedMax ?? (values.length ? max : bottom), bottom);\n baseline = setting === 'min' ? bottom : top;\n }\n const scaled = scaleArray(values, cols, settings.aggregate);\n const width = cols + FRAME_WIDTH;\n const value = (number: number): Segment[] => [\n [fixed(number, precision), textHighlight],\n [unit ? ` ${unit}` : '', textDim],\n ];\n const legend = (label: string, number: number): Segment[] => [\n [`${label}: `, textNormal],\n ...value(number),\n ];\n // left and right justified, in terminal columns (wide characters 2); too long rows\n // break before the right side, unless there is no right side\n const row = (left: Segment[], right: Segment[] = []) => {\n const rightLength = segmentsLength(right);\n const gap = width - segmentsLength(left) - rightLength;\n const separator =\n gap >= 0 ? ' '.repeat(gap)\n : rightLength ? '\\n'\n : '';\n return `${renderSegments(left, reset)}${separator}${renderSegments(right, reset)}`;\n };\n const lines = [row([[title, textHighlight]], value(top))];\n // bars growing up from the bottom: the plain path, as before baselines\n const bars =\n baseline > bottom ?\n barsFromBaseline(scaled, rows, top, bottom, baseline)\n : valuesToBars(scaled, rows, top, bottom);\n for (const line of bars) lines.push(paint(textHighlight, `│${line}│`, reset));\n const { axis } = settings;\n if (axis && (axis.start !== undefined || axis.end !== undefined))\n lines.push(\n row(\n [[label(formatAxisLabel(axis.start, axis, axis.end)), textDim]],\n [[label(formatAxisLabel(axis.end, axis, axis.start)), textDim]]\n )\n );\n lines.push(\n row(settings.showAverage ? legend('average', average) : [], value(bottom))\n );\n // a baseline at the top or the bottom is already the value shown there\n if (bottom < baseline && baseline < top)\n lines.push(row(legend('baseline', baseline)));\n if (settings.showMin) lines.push(row(legend('min', min)));\n if (settings.showMax) lines.push(row(legend('max', max)));\n return lines.join('\\n');\n};\n\n/**\n * Renders logs of a given kind as bar graphs. Adds a graph method per log\n * type to the logger: `infoGraph`, `errorGraph`, etc.\n *\n * ```\n * 2026/03/16 15:35:00 [i] info\n * CPU 82.00 %\n * │▁▁▁▂▃▃▃▄▄▄▆▆▆▇██▇▆▆▆▄▄▄▃▃▃▂▁▁▁│\n * average: 41.33 % 0.00 %\n * ```\n */\nexport const graphPlugin = (\n options: GraphPluginOptions = {}\n): LoggerPlugin<GraphMethods> => {\n const kind = options.kind ?? 'graph';\n const sanitizer = createSanitizer(options.sanitize);\n const limits: SizeLimits = {\n cols: options.limits?.cols ?? DEFAULT_GRAPH_LIMITS.cols,\n rows: options.limits?.rows ?? DEFAULT_GRAPH_LIMITS.rows,\n precision: options.limits?.precision ?? DEFAULT_GRAPH_LIMITS.precision,\n };\n validateLimits(limits);\n const defaults: ResolvedGraphSettings = {\n cols: colsOfWidth(options, limits) ?? options.cols ?? 30,\n rows: options.rows ?? 3,\n title: options.title ?? '',\n unit: options.unit ?? '',\n precision: options.precision ?? 2,\n showAverage: options.showAverage ?? true,\n showMin: options.showMin ?? true,\n showMax: options.showMax ?? true,\n aggregate: options.aggregate ?? 'average',\n // no baseline: 0, moved inside `min` and `max` (see `renderGraph`)\n ...(options.baseline !== undefined && { baseline: options.baseline }),\n ...(options.max !== undefined && { max: options.max }),\n ...(options.min !== undefined && { min: options.min }),\n ...(options.axis !== undefined && { axis: options.axis }),\n };\n const outputLimits = resolveOutputLimits(options.limits, 'graphPlugin');\n validateSizes(defaults, limits);\n validateRange(defaults);\n\n return {\n name: `graph:${kind}`,\n styles: mergeStyleSheets(DEFAULT_TEXT_STYLES, options.styles),\n templateMaps: {\n [kind]: {\n ...headerTemplates(options),\n // never throws: unreadable data or invalid settings give a placeholder\n data: (value, { styles }) => {\n try {\n if (isNumberArray(value))\n return `\\n${renderGraph(value, defaults, styles, sanitizer)}`;\n if (isGraphDataWithSettings(value)) {\n const { values, width, ...overrides } = value;\n const settings = { ...defaults, ...overrides };\n const widthNote =\n width === undefined ? undefined : (\n limitWidth(settings, width, defaults, limits)\n );\n const notes = limitSizes(settings, defaults, limits);\n if (widthNote !== undefined) notes.unshift(widthNote);\n limitRange(settings, defaults, notes);\n limitLabels(settings, outputLimits);\n const graph = renderGraph(values, settings, styles, sanitizer);\n const unreadable = (value as { [SETTINGS_ERROR]?: unknown })[\n SETTINGS_ERROR\n ];\n if (!notes.length && unreadable === undefined)\n return `\\n${graph}`;\n let text = `\\n${graph}`;\n if (notes.length)\n text += `\\n${paintNote(`(limited: ${notes.join(', ')})`, styles, sanitizer)}`;\n if (unreadable !== undefined)\n text += `\\n${paintNote(`(settings unreadable: ${describeThrown(unreadable)})`, styles, sanitizer)}`;\n return text;\n }\n return paint(\n styles['textNormal'] ?? '',\n stringifyData(value, sanitizer, outputLimits),\n styles['reset'] ?? ''\n );\n } catch (thrown) {\n return paintUnrenderable(thrown, styles, sanitizer);\n }\n },\n },\n },\n outputs: { [kind]: joinedOutput(options.write) },\n methods: (logger) => {\n const graph =\n (type: LogType): GraphMethod =>\n (values, settings) => {\n let data: unknown = values;\n // settings are data too: unreadable ones (throwing getters,\n // revoked proxies) give a note, never an exception\n if (settings)\n try {\n data = { ...settings, values };\n } catch (thrown) {\n data = { values, [SETTINGS_ERROR]: thrown };\n }\n logger.log(type, data, kind);\n };\n return {\n fatalGraph: graph('fatal'),\n errorGraph: graph('error'),\n warningGraph: graph('warning'),\n infoGraph: graph('info'),\n debugGraph: graph('debug'),\n traceGraph: graph('trace'),\n verboseGraph: graph('verbose'),\n };\n },\n };\n};\n"],"names":["createSanitizer","formatHighResTime","safeStringify","truncate","paint","text","textWidth","scaleArray","resolveOutputLimits","mergeStyleSheets","DEFAULT_TEXT_STYLES","headerTemplates","describeThrown","stringifyData","paintUnrenderable","joinedOutput"],"mappings":";;;;;;;AA+BA,MAAM,cAAc,GAAGA,oBAAe,CAAC,MAAM,CAAC;AA4B9C;AACA,MAAM,SAAS,GAAG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