@logtape/pretty 2.2.9 → 2.2.10

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.
@@ -293,7 +293,17 @@ function normalizeIconSpacing(iconMap) {
293
293
  * @since 1.0.0
294
294
  */
295
295
  function getPrettyFormatter(options = {}) {
296
- const { timestamp = "none", timeZone, timestampColor = "rgb(100,116,139)", timestampStyle = "dim", level: levelFormat = "full", levelColors = {}, levelStyle = "underline", icons = true, categorySeparator = "·", categoryColor = "rgb(100,116,139)", categoryColorMap = /* @__PURE__ */ new Map(), categoryStyle = ["dim", "italic"], categoryWidth = 20, categoryTruncate = "middle", messageColor = "rgb(148,163,184)", messageStyle = "dim", colors: useColors = true, align = true, inspectOptions = {}, properties = false, wordWrap = true } = options;
296
+ const { timestamp = "none", timeZone, timestampColor = "rgb(100,116,139)", timestampStyle = "dim", level: levelFormat = "full", levelColors = {}, levelStyle = "underline", icons = true, categorySeparator = "·", categoryColor = "rgb(100,116,139)", categoryColorMap = /* @__PURE__ */ new Map(), categoryStyle = ["dim", "italic"], categoryWidth = 20, categoryTruncate = "middle", messageColor = "rgb(148,163,184)", messageStyle = "dim", colors: useColors = true, align = true, inspectOptions = {}, properties = false, wordWrap = true, sanitize: sanitizeOptions = {} } = options;
297
+ const sanitize = sanitizeOptions === false ? null : (text) => (0, __logtape_logtape.sanitizeControlSequences)(text, sanitizeOptions);
298
+ const sanitizeCategory = sanitizeOptions === false ? null : (text) => (0, __logtape_logtape.sanitizeControlSequences)(text, {
299
+ ...sanitizeOptions,
300
+ sgr: "escape"
301
+ });
302
+ const resolvedInspectOptions = {
303
+ ...inspectOptions,
304
+ compact: inspectOptions.compact ?? true,
305
+ depth: inspectOptions.depth ?? Infinity
306
+ };
297
307
  const baseIconMap = icons === false ? {
298
308
  trace: "",
299
309
  debug: "",
@@ -386,17 +396,19 @@ function getPrettyFormatter(options = {}) {
386
396
  return (record) => {
387
397
  const icon = iconMap[record.level] || "";
388
398
  const level = formatLevel(record.level);
389
- const categoryStr = require_truncate.truncateCategory(record.category, categoryWidth, categorySeparator, categoryTruncate);
399
+ const categoryStr = require_truncate.truncateCategory(sanitizeCategory == null ? record.category : record.category.map(sanitizeCategory), categoryWidth, categorySeparator, categoryTruncate);
390
400
  let message = "";
391
401
  const messageColorCode = useColors ? colorToAnsi(messageColor) : "";
392
402
  const messageStyleCode = useColors ? styleToAnsi(messageStyle) : "";
393
403
  const messagePrefix = useColors ? `${messageStyleCode}${messageColorCode}` : "";
394
- for (let i = 0; i < record.message.length; i++) if (i % 2 === 0) message += record.message[i];
395
- else {
404
+ for (let i = 0; i < record.message.length; i++) if (i % 2 === 0) {
405
+ const part = record.message[i];
406
+ message += sanitize == null ? part : sanitize(part);
407
+ } else {
396
408
  const value = record.message[i];
397
409
  const inspected = (0, __util.inspect)(value, {
398
410
  colors: useColors,
399
- ...inspectOptions
411
+ ...resolvedInspectOptions
400
412
  });
401
413
  if (inspected.includes("\n")) {
402
414
  const lines = inspected.split("\n");
@@ -441,13 +453,13 @@ function getPrettyFormatter(options = {}) {
441
453
  let result = `${formattedTimestamp}${formattedIcon} ${paddedLevel} ${paddedCategory} ${formattedMessage}`;
442
454
  const indentWidth = require_wcwidth.getDisplayWidth(require_wcwidth.stripAnsi(`${formattedTimestamp}${formattedIcon} ${paddedLevel} ${paddedCategory} `));
443
455
  if (wordWrapEnabled || message.includes("\n")) result = require_wordwrap.wrapText(result, wordWrapEnabled ? wordWrapWidth : Infinity, indentWidth);
444
- if (properties) result += formatProperties(record, indentWidth, wordWrapEnabled ? wordWrapWidth : Infinity, useColors, inspectOptions);
456
+ if (properties) result += formatProperties(record, indentWidth, wordWrapEnabled ? wordWrapWidth : Infinity, useColors, resolvedInspectOptions);
445
457
  return result + "\n";
446
458
  } else {
447
459
  let result = `${formattedTimestamp}${formattedIcon} ${formattedLevel} ${formattedCategory} ${formattedMessage}`;
448
460
  const indentWidth = require_wcwidth.getDisplayWidth(require_wcwidth.stripAnsi(`${formattedTimestamp}${formattedIcon} ${formattedLevel} ${formattedCategory} `));
449
461
  if (wordWrapEnabled || message.includes("\n")) result = require_wordwrap.wrapText(result, wordWrapEnabled ? wordWrapWidth : Infinity, indentWidth);
450
- if (properties) result += formatProperties(record, indentWidth, wordWrapEnabled ? wordWrapWidth : Infinity, useColors, inspectOptions);
462
+ if (properties) result += formatProperties(record, indentWidth, wordWrapEnabled ? wordWrapWidth : Infinity, useColors, resolvedInspectOptions);
451
463
  return result + "\n";
452
464
  }
453
465
  };
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.d.cts","names":[],"sources":["../src/formatter.ts"],"sourcesContent":[],"mappings":";;;;;;;AAS0E;AAiChE,cAPJ,MAqBI,EAAA;EAKE,SAAK,KAAA,EAAA,WACA;EAsBL,SAAA,IAAA,EAAA,WAAgB;EAAA,SAAA,GAAA,EAAA,WAAA;EAAA,SAA0B,MAAA,EAAA,WAAA;EAAK,SAA5B,SAAA,EAAA,WAAA;EAAG,SAAA,aAAA,EAAA,WAAA;AAalC,CAAA;;;;AAA8D,cAlDxD,UAkDwD,EAAA;EAwT7C,SAAA,KAAA,EAAA,YACf;EAAA,SAAA,GAAA,EAAA,YAAA;EAAA,SAAa,KAAA,EAAA,YAAA;EAAoB,SAiBP,MAAA,EAAA,YAAA;EAAK,SAoBL,IAAA,EAAA,YAAA;EAAK,SAqBO,OAAA,EAAA,YAAA;EAAQ,SAAE,IAAA,EAAA,YAAA;EAAK,SAAtB,KAAA,EAAA,YAAA;CAAM;;;;AA6CV,KApcjB,KAAA,GAociB,MAAA,OAncZ,UAmcY,GAAA,OAAA,MAAA,IAAA,MAAA,IAAA,MAAA,GAAA,GAAA,IAAA,MAAA,EAAA,GAAA,IAAA;;;;;;;;AAvGf;AAuad;;;;AAEgB;AAqYhB;;;;KApnCY,gBAAA,GAAmB,uBAAuB;;;;KAa1C,KAAA,gBAAqB,uBAAuB;;;;;;;;;;;UAwTvC,sBAAA,SACP,KAAK;;;;;;;;;;;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;;;;;;;;;;;;;8BAmBG;;;;;;;;;;;;;;;;;;;2BAoBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA+BG;;;;;;;;;;;;;;;;;0BAkBJ;;;;;;;;;;;;;;;;;;;0BAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+KV,kBAAA,WACL,yBACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsaU,iBAAiB"}
package/dist/formatter.js CHANGED
@@ -2,7 +2,7 @@ import { getOptimalWordWrapWidth } from "./terminal.js";
2
2
  import { truncateCategory } from "./truncate.js";
3
3
  import { getDisplayWidth, stripAnsi } from "./wcwidth.js";
4
4
  import { wrapText } from "./wordwrap.js";
5
- import { getLogLevels } from "@logtape/logtape";
5
+ import { getLogLevels, sanitizeControlSequences } from "@logtape/logtape";
6
6
  import { inspect } from "#util";
7
7
 
8
8
  //#region src/formatter.ts
@@ -292,7 +292,17 @@ function normalizeIconSpacing(iconMap) {
292
292
  * @since 1.0.0
293
293
  */
294
294
  function getPrettyFormatter(options = {}) {
295
- const { timestamp = "none", timeZone, timestampColor = "rgb(100,116,139)", timestampStyle = "dim", level: levelFormat = "full", levelColors = {}, levelStyle = "underline", icons = true, categorySeparator = "·", categoryColor = "rgb(100,116,139)", categoryColorMap = /* @__PURE__ */ new Map(), categoryStyle = ["dim", "italic"], categoryWidth = 20, categoryTruncate = "middle", messageColor = "rgb(148,163,184)", messageStyle = "dim", colors: useColors = true, align = true, inspectOptions = {}, properties = false, wordWrap = true } = options;
295
+ const { timestamp = "none", timeZone, timestampColor = "rgb(100,116,139)", timestampStyle = "dim", level: levelFormat = "full", levelColors = {}, levelStyle = "underline", icons = true, categorySeparator = "·", categoryColor = "rgb(100,116,139)", categoryColorMap = /* @__PURE__ */ new Map(), categoryStyle = ["dim", "italic"], categoryWidth = 20, categoryTruncate = "middle", messageColor = "rgb(148,163,184)", messageStyle = "dim", colors: useColors = true, align = true, inspectOptions = {}, properties = false, wordWrap = true, sanitize: sanitizeOptions = {} } = options;
296
+ const sanitize = sanitizeOptions === false ? null : (text) => sanitizeControlSequences(text, sanitizeOptions);
297
+ const sanitizeCategory = sanitizeOptions === false ? null : (text) => sanitizeControlSequences(text, {
298
+ ...sanitizeOptions,
299
+ sgr: "escape"
300
+ });
301
+ const resolvedInspectOptions = {
302
+ ...inspectOptions,
303
+ compact: inspectOptions.compact ?? true,
304
+ depth: inspectOptions.depth ?? Infinity
305
+ };
296
306
  const baseIconMap = icons === false ? {
297
307
  trace: "",
298
308
  debug: "",
@@ -385,17 +395,19 @@ function getPrettyFormatter(options = {}) {
385
395
  return (record) => {
386
396
  const icon = iconMap[record.level] || "";
387
397
  const level = formatLevel(record.level);
388
- const categoryStr = truncateCategory(record.category, categoryWidth, categorySeparator, categoryTruncate);
398
+ const categoryStr = truncateCategory(sanitizeCategory == null ? record.category : record.category.map(sanitizeCategory), categoryWidth, categorySeparator, categoryTruncate);
389
399
  let message = "";
390
400
  const messageColorCode = useColors ? colorToAnsi(messageColor) : "";
391
401
  const messageStyleCode = useColors ? styleToAnsi(messageStyle) : "";
392
402
  const messagePrefix = useColors ? `${messageStyleCode}${messageColorCode}` : "";
393
- for (let i = 0; i < record.message.length; i++) if (i % 2 === 0) message += record.message[i];
394
- else {
403
+ for (let i = 0; i < record.message.length; i++) if (i % 2 === 0) {
404
+ const part = record.message[i];
405
+ message += sanitize == null ? part : sanitize(part);
406
+ } else {
395
407
  const value = record.message[i];
396
408
  const inspected = inspect(value, {
397
409
  colors: useColors,
398
- ...inspectOptions
410
+ ...resolvedInspectOptions
399
411
  });
400
412
  if (inspected.includes("\n")) {
401
413
  const lines = inspected.split("\n");
@@ -440,13 +452,13 @@ function getPrettyFormatter(options = {}) {
440
452
  let result = `${formattedTimestamp}${formattedIcon} ${paddedLevel} ${paddedCategory} ${formattedMessage}`;
441
453
  const indentWidth = getDisplayWidth(stripAnsi(`${formattedTimestamp}${formattedIcon} ${paddedLevel} ${paddedCategory} `));
442
454
  if (wordWrapEnabled || message.includes("\n")) result = wrapText(result, wordWrapEnabled ? wordWrapWidth : Infinity, indentWidth);
443
- if (properties) result += formatProperties(record, indentWidth, wordWrapEnabled ? wordWrapWidth : Infinity, useColors, inspectOptions);
455
+ if (properties) result += formatProperties(record, indentWidth, wordWrapEnabled ? wordWrapWidth : Infinity, useColors, resolvedInspectOptions);
444
456
  return result + "\n";
445
457
  } else {
446
458
  let result = `${formattedTimestamp}${formattedIcon} ${formattedLevel} ${formattedCategory} ${formattedMessage}`;
447
459
  const indentWidth = getDisplayWidth(stripAnsi(`${formattedTimestamp}${formattedIcon} ${formattedLevel} ${formattedCategory} `));
448
460
  if (wordWrapEnabled || message.includes("\n")) result = wrapText(result, wordWrapEnabled ? wordWrapWidth : Infinity, indentWidth);
449
- if (properties) result += formatProperties(record, indentWidth, wordWrapEnabled ? wordWrapWidth : Infinity, useColors, inspectOptions);
461
+ if (properties) result += formatProperties(record, indentWidth, wordWrapEnabled ? wordWrapWidth : Infinity, useColors, resolvedInspectOptions);
450
462
  return result + "\n";
451
463
  }
452
464
  };
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.js","names":["color: Color","style: Style","categoryColorMap: CategoryColorMap","patterns: CategoryPattern[]","category: readonly string[]","prefix: readonly string[]","value: number","minutes: number","full: boolean","timeZone: string | null | undefined","formatter: Intl.DateTimeFormat","ts: number","config: TimeZoneConfig","defaultIcons: Record<LogLevel, string>","iconMap: Record<LogLevel, string>","options: PrettyFormatterOptions","baseIconMap: Record<LogLevel, string>","resolvedLevelColors: Record<LogLevel, Color>","levelMappings: Record<string, Record<LogLevel, string>>","level: LogLevel","timestampFn: ((ts: number) => string | null) | null","wordWrapWidth: number","allLevels: LogLevel[]","record: LogRecord","indentWidth: number","maxWidth: number","useColors: boolean","inspectOptions: InspectOptions","prettyFormatter: TextFormatter"],"sources":["../src/formatter.ts"],"sourcesContent":["import {\n getLogLevels,\n type LogLevel,\n type LogRecord,\n type TextFormatter,\n type TextFormatterOptions,\n} from \"@logtape/logtape\";\nimport { inspect, type InspectOptions } from \"#util\";\nimport { getOptimalWordWrapWidth } from \"./terminal.ts\";\nimport { truncateCategory, type TruncationStrategy } from \"./truncate.ts\";\nimport { getDisplayWidth, stripAnsi } from \"./wcwidth.ts\";\nimport { wrapText } from \"./wordwrap.ts\";\n\n/**\n * ANSI escape codes for styling\n */\nconst RESET = \"\\x1b[0m\";\nconst DIM = \"\\x1b[2m\";\n\n// Default true color values (referenced in JSDoc)\nconst defaultColors = {\n trace: \"rgb(167,139,250)\", // Light purple\n debug: \"rgb(96,165,250)\", // Light blue\n info: \"rgb(52,211,153)\", // Emerald\n warning: \"rgb(251,191,36)\", // Amber\n error: \"rgb(248,113,113)\", // Light red\n fatal: \"rgb(220,38,38)\", // Dark red\n category: \"rgb(100,116,139)\", // Slate\n message: \"rgb(148,163,184)\", // Light slate\n timestamp: \"rgb(100,116,139)\", // Slate\n} as const;\n\n/**\n * ANSI style codes\n */\nconst styles = {\n reset: RESET,\n bold: \"\\x1b[1m\",\n dim: DIM,\n italic: \"\\x1b[3m\",\n underline: \"\\x1b[4m\",\n strikethrough: \"\\x1b[9m\",\n} as const;\n\n/**\n * Standard ANSI colors (16-color)\n */\nconst ansiColors = {\n black: \"\\x1b[30m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n white: \"\\x1b[37m\",\n} as const;\n\n/**\n * Color type definition\n */\nexport type Color =\n | keyof typeof ansiColors\n | `rgb(${number},${number},${number})`\n | `#${string}`\n | null;\n\n/**\n * Category color mapping for prefix-based coloring.\n *\n * Maps category prefixes (as arrays) to colors. The formatter will match\n * categories against these prefixes and use the corresponding color.\n * Longer/more specific prefixes take precedence over shorter ones.\n *\n * @example\n * ```typescript\n * new Map([\n * [[\"app\", \"auth\"], \"#ff6b6b\"], // app.auth.* -> red\n * [[\"app\", \"db\"], \"#4ecdc4\"], // app.db.* -> teal\n * [[\"app\"], \"#45b7d1\"], // app.* (fallback) -> blue\n * [[\"lib\"], \"#96ceb4\"], // lib.* -> green\n * ])\n * ```\n */\nexport type CategoryColorMap = Map<readonly string[], Color>;\n\n/**\n * Internal representation of category prefix patterns\n */\ntype CategoryPattern = {\n prefix: readonly string[];\n color: Color;\n};\n\n/**\n * Style type definition - supports single styles, arrays of styles, or null\n */\nexport type Style = keyof typeof styles | (keyof typeof styles)[] | null;\n\n// Pre-compiled regex patterns for color parsing\nconst RGB_PATTERN = /^rgb\\((\\d+),(\\d+),(\\d+)\\)$/;\nconst HEX_PATTERN = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;\nconst FIXED_OFFSET_PATTERN = /^([+-])(0\\d|1\\d|2[0-3]):([0-5]\\d)$/;\n\n/**\n * Helper function to convert color to ANSI escape code\n */\nfunction colorToAnsi(color: Color): string {\n if (color === null) return \"\";\n if (color in ansiColors) {\n return ansiColors[color as keyof typeof ansiColors];\n }\n\n // Handle rgb() format\n const rgbMatch = color.match(RGB_PATTERN);\n if (rgbMatch) {\n const [, r, g, b] = rgbMatch;\n return `\\x1b[38;2;${r};${g};${b}m`;\n }\n\n // Handle hex format (#rrggbb or #rgb)\n const hexMatch = color.match(HEX_PATTERN);\n if (hexMatch) {\n let hex = hexMatch[1];\n // Convert 3-digit hex to 6-digit\n if (hex.length === 3) {\n hex = hex.split(\"\").map((c) => c + c).join(\"\");\n }\n const r = parseInt(hex.substr(0, 2), 16);\n const g = parseInt(hex.substr(2, 2), 16);\n const b = parseInt(hex.substr(4, 2), 16);\n return `\\x1b[38;2;${r};${g};${b}m`;\n }\n\n return \"\";\n}\n\n/**\n * Helper function to convert style to ANSI escape code\n */\nfunction styleToAnsi(style: Style): string {\n if (style === null) return \"\";\n if (Array.isArray(style)) {\n return style.map((s) => styles[s] || \"\").join(\"\");\n }\n return styles[style] || \"\";\n}\n\n/**\n * Converts a category color map to internal patterns and sorts them by specificity.\n * More specific (longer) prefixes come first for proper matching precedence.\n */\nfunction prepareCategoryPatterns(\n categoryColorMap: CategoryColorMap,\n): CategoryPattern[] {\n const patterns: CategoryPattern[] = [];\n\n for (const [prefix, color] of categoryColorMap) {\n patterns.push({ prefix, color });\n }\n\n // Sort by prefix length (descending) for most-specific-first matching\n return patterns.sort((a, b) => b.prefix.length - a.prefix.length);\n}\n\n/**\n * Matches a category against category color patterns.\n * Returns the color of the first matching pattern, or null if no match.\n */\nfunction matchCategoryColor(\n category: readonly string[],\n patterns: CategoryPattern[],\n): Color {\n for (const pattern of patterns) {\n if (categoryMatches(category, pattern.prefix)) {\n return pattern.color;\n }\n }\n return null;\n}\n\n/**\n * Checks if a category matches a prefix pattern.\n * A category matches if it starts with all segments of the prefix.\n */\nfunction categoryMatches(\n category: readonly string[],\n prefix: readonly string[],\n): boolean {\n if (prefix.length > category.length) {\n return false;\n }\n\n for (let i = 0; i < prefix.length; i++) {\n if (category[i] !== prefix[i]) {\n return false;\n }\n }\n\n return true;\n}\n\ntype TimeZoneConfig =\n | { kind: \"utc\" }\n | { kind: \"local\" }\n | { kind: \"offset\"; minutes: number }\n | { kind: \"iana\"; formatter: Intl.DateTimeFormat };\n\ntype DateParts = {\n year: string;\n month: string;\n day: string;\n hour: string;\n minute: string;\n second: string;\n ms: string;\n offsetMinutes: number;\n};\n\nfunction pad2(value: number): string {\n return value < 10 ? `0${value}` : `${value}`;\n}\n\nfunction pad3(value: number): string {\n return value < 10 ? `00${value}` : value < 100 ? `0${value}` : `${value}`;\n}\n\nfunction formatOffset(minutes: number, full: boolean): string {\n const sign = minutes < 0 ? \"-\" : \"+\";\n const absolute = Math.abs(minutes);\n const hour = pad2(Math.floor(absolute / 60));\n const minute = pad2(absolute % 60);\n if (!full && minute === \"00\") return `${sign}${hour}`;\n return `${sign}${hour}:${minute}`;\n}\n\nfunction resolveTimeZone(timeZone: string | null | undefined): TimeZoneConfig {\n if (typeof timeZone === \"undefined\") return { kind: \"utc\" };\n if (timeZone === null) return { kind: \"local\" };\n\n const offsetMatch = FIXED_OFFSET_PATTERN.exec(timeZone);\n if (offsetMatch != null) {\n const sign = offsetMatch[1] === \"-\" ? -1 : 1;\n const hours = Number(offsetMatch[2]);\n const minutes = Number(offsetMatch[3]);\n return { kind: \"offset\", minutes: sign * (hours * 60 + minutes) };\n }\n\n if (\n typeof Intl === \"undefined\" || typeof Intl.DateTimeFormat !== \"function\"\n ) {\n throw new TypeError(\n `Invalid timeZone option: ${\n JSON.stringify(timeZone)\n }. This environment does not support IANA time zones.`,\n );\n }\n\n try {\n return {\n kind: \"iana\",\n formatter: new Intl.DateTimeFormat(\"en-CA\", {\n timeZone,\n hour12: false,\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n }),\n };\n } catch {\n throw new TypeError(\n `Invalid timeZone option: ${\n JSON.stringify(timeZone)\n }. Expected an IANA time zone name (e.g., \"Asia/Seoul\") or a fixed UTC offset string (e.g., \"+09:00\").`,\n );\n }\n}\n\nfunction readPartsFromFormatter(\n formatter: Intl.DateTimeFormat,\n ts: number,\n): Omit<DateParts, \"ms\" | \"offsetMinutes\"> {\n const parts = formatter.formatToParts(new Date(ts));\n let year = \"\";\n let month = \"\";\n let day = \"\";\n let hour = \"\";\n let minute = \"\";\n let second = \"\";\n for (const part of parts) {\n if (part.type === \"year\") year = part.value;\n else if (part.type === \"month\") month = part.value;\n else if (part.type === \"day\") day = part.value;\n else if (part.type === \"hour\") hour = part.value;\n else if (part.type === \"minute\") minute = part.value;\n else if (part.type === \"second\") second = part.value;\n }\n return { year, month, day, hour, minute, second };\n}\n\nfunction getDateParts(ts: number, config: TimeZoneConfig): DateParts {\n const d = new Date(ts);\n const ms = pad3(d.getUTCMilliseconds());\n\n if (config.kind === \"utc\") {\n return {\n year: `${d.getUTCFullYear()}`,\n month: pad2(d.getUTCMonth() + 1),\n day: pad2(d.getUTCDate()),\n hour: pad2(d.getUTCHours()),\n minute: pad2(d.getUTCMinutes()),\n second: pad2(d.getUTCSeconds()),\n ms,\n offsetMinutes: 0,\n };\n }\n\n if (config.kind === \"local\") {\n return {\n year: `${d.getFullYear()}`,\n month: pad2(d.getMonth() + 1),\n day: pad2(d.getDate()),\n hour: pad2(d.getHours()),\n minute: pad2(d.getMinutes()),\n second: pad2(d.getSeconds()),\n ms,\n offsetMinutes: -d.getTimezoneOffset(),\n };\n }\n\n if (config.kind === \"offset\") {\n const shifted = new Date(ts + config.minutes * 60_000);\n return {\n year: `${shifted.getUTCFullYear()}`,\n month: pad2(shifted.getUTCMonth() + 1),\n day: pad2(shifted.getUTCDate()),\n hour: pad2(shifted.getUTCHours()),\n minute: pad2(shifted.getUTCMinutes()),\n second: pad2(shifted.getUTCSeconds()),\n ms,\n offsetMinutes: config.minutes,\n };\n }\n\n const parts = readPartsFromFormatter(config.formatter, ts);\n const asUtc = Date.UTC(\n Number(parts.year),\n Number(parts.month) - 1,\n Number(parts.day),\n Number(parts.hour),\n Number(parts.minute),\n Number(parts.second),\n d.getUTCMilliseconds(),\n );\n const offsetMinutes = Math.round((asUtc - ts) / 60_000);\n return { ...parts, ms, offsetMinutes };\n}\n\n/**\n * Default icons for each log level\n */\nconst defaultIcons: Record<LogLevel, string> = {\n trace: \"🔍\",\n debug: \"🐛\",\n info: \"✨\",\n warning: \"⚡\",\n error: \"❌\",\n fatal: \"💀\",\n};\n\n/**\n * Normalize icon spacing to ensure consistent column alignment.\n *\n * All icons will be padded with spaces to match the width of the widest icon,\n * ensuring consistent prefix alignment across all log levels.\n *\n * @param iconMap The icon mapping to normalize\n * @returns A new icon map with consistent spacing\n */\nfunction normalizeIconSpacing(\n iconMap: Record<LogLevel, string>,\n): Record<LogLevel, string> {\n const entries = Object.entries(iconMap) as Array<[LogLevel, string]>;\n const maxWidth = Math.max(\n ...entries.map(([, icon]) => getDisplayWidth(icon)),\n );\n\n return Object.fromEntries(\n entries.map(([level, icon]) => [\n level,\n icon + \" \".repeat(maxWidth - getDisplayWidth(icon)),\n ]),\n ) as Record<LogLevel, string>;\n}\n\n/**\n * Configuration options for the pretty formatter.\n *\n * This interface extends the base text formatter options while providing\n * extensive customization options for visual styling, layout control, and\n * development-focused features. It offers granular control over colors,\n * styles, and formatting similar to the ANSI color formatter.\n *\n * @since 1.0.0\n */\nexport interface PrettyFormatterOptions\n extends Omit<TextFormatterOptions, \"category\" | \"value\" | \"format\"> {\n /**\n * Color for timestamp display when timestamps are enabled.\n *\n * Supports true color RGB values, hex colors, or ANSI color names.\n * Set to `null` to disable timestamp coloring.\n *\n * @example\n * ```typescript\n * timestampColor: \"#888888\" // Hex color\n * timestampColor: \"rgb(128,128,128)\" // RGB color\n * timestampColor: \"cyan\" // ANSI color name\n * timestampColor: null // No color\n * ```\n *\n * @default `\"rgb(100,116,139)\"` (slate gray)\n */\n readonly timestampColor?: Color;\n\n /**\n * Visual style applied to timestamp text.\n *\n * Controls text appearance like boldness, dimming, etc.\n * Supports single styles, multiple styles combined, or no styling.\n * Combines with `timestampColor` for full styling control.\n *\n * @example\n * ```typescript\n * timestampStyle: \"dim\" // Single style: dimmed text\n * timestampStyle: \"bold\" // Single style: bold text\n * timestampStyle: [\"bold\", \"underline\"] // Multiple styles: bold + underlined\n * timestampStyle: [\"dim\", \"italic\"] // Multiple styles: dimmed + italic\n * timestampStyle: null // No styling\n * ```\n *\n * @default `\"dim\"`\n */\n readonly timestampStyle?: Style;\n\n /**\n * Custom colors for each log level.\n *\n * Allows fine-grained control over level appearance. Each level can have\n * its own color scheme. Unspecified levels use built-in defaults.\n * Set individual levels to `null` to disable coloring for that level.\n *\n * @example\n * ```typescript\n * levelColors: {\n * info: \"#00ff00\", // Bright green for info\n * error: \"#ff0000\", // Bright red for errors\n * warning: \"orange\", // ANSI orange for warnings\n * debug: null, // No color for debug\n * }\n * ```\n *\n * @default Built-in color scheme (purple trace, blue debug, green info, amber warning, red error, dark red fatal)\n */\n readonly levelColors?: Partial<Record<LogLevel, Color>>;\n\n /**\n * Visual style applied to log level text.\n *\n * Controls the appearance of the level indicator (e.g., \"info\", \"error\").\n * Supports single styles, multiple styles combined, or no styling.\n * Applied in addition to level-specific colors.\n *\n * @example\n * ```typescript\n * levelStyle: \"bold\" // Single style: bold level text\n * levelStyle: \"underline\" // Single style: underlined level text\n * levelStyle: [\"bold\", \"underline\"] // Multiple styles: bold + underlined\n * levelStyle: [\"dim\", \"italic\"] // Multiple styles: dimmed + italic\n * levelStyle: null // No additional styling\n * ```\n *\n * @default `\"underline\"`\n */\n readonly levelStyle?: Style;\n\n /**\n * Icon configuration for each log level.\n *\n * Controls the emoji/symbol displayed before each log entry.\n * Provides visual quick-identification of log severity.\n *\n * - `true`: Use built-in emoji set (🔍 trace, 🐛 debug, ✨ info, ⚠️ warning, ❌ error, 💀 fatal)\n * - `false`: Disable all icons for clean text-only output\n * - Object: Custom icon mapping, falls back to defaults for unspecified levels\n *\n * @example\n * ```typescript\n * icons: true // Use default emoji set\n * icons: false // No icons\n * icons: {\n * info: \"ℹ️\", // Custom info icon\n * error: \"🔥\", // Custom error icon\n * warning: \"⚡\", // Custom warning icon\n * }\n * ```\n *\n * @default `true` (use default emoji icons)\n */\n readonly icons?: boolean | Partial<Record<LogLevel, string>>;\n\n /**\n * Character(s) used to separate category hierarchy levels.\n *\n * Categories are hierarchical (e.g., [\"app\", \"auth\", \"jwt\"]) and this\n * separator joins them for display (e.g., \"app.auth.jwt\").\n *\n * @example\n * ```typescript\n * categorySeparator: \"·\" // app·auth·jwt\n * categorySeparator: \".\" // app.auth.jwt\n * categorySeparator: \":\" // app:auth:jwt\n * categorySeparator: \" > \" // app > auth > jwt\n * categorySeparator: \"::\" // app::auth::jwt\n * ```\n *\n * @default `\"·\"` (interpunct)\n */\n readonly categorySeparator?: string;\n\n /**\n * Default color for category display.\n *\n * Used as fallback when no specific color is found in `categoryColorMap`.\n * Controls the visual appearance of the category hierarchy display.\n *\n * @example\n * ```typescript\n * categoryColor: \"#666666\" // Gray categories\n * categoryColor: \"blue\" // Blue categories\n * categoryColor: \"rgb(100,150,200)\" // Light blue categories\n * categoryColor: null // No coloring\n * ```\n *\n * @default `\"rgb(100,116,139)\"` (slate gray)\n */\n readonly categoryColor?: Color;\n\n /**\n * Category-specific color mapping based on prefixes.\n *\n * Maps category prefixes (as arrays) to colors for visual grouping.\n * More specific (longer) prefixes take precedence over shorter ones.\n * If no prefix matches, falls back to the default `categoryColor`.\n *\n * @example\n * ```typescript\n * new Map([\n * [[\"app\", \"auth\"], \"#ff6b6b\"], // app.auth.* -> red\n * [[\"app\", \"db\"], \"#4ecdc4\"], // app.db.* -> teal\n * [[\"app\"], \"#45b7d1\"], // app.* (fallback) -> blue\n * [[\"lib\"], \"#96ceb4\"], // lib.* -> green\n * ])\n * ```\n */\n readonly categoryColorMap?: CategoryColorMap;\n\n /**\n * Visual style applied to category text.\n *\n * Controls the appearance of the category hierarchy display.\n * Supports single styles, multiple styles combined, or no styling.\n * Applied in addition to category colors from `categoryColor` or `categoryColorMap`.\n *\n * @example\n * ```typescript\n * categoryStyle: \"dim\" // Single style: dimmed category text\n * categoryStyle: \"italic\" // Single style: italic category text\n * categoryStyle: [\"dim\", \"italic\"] // Multiple styles: dimmed + italic\n * categoryStyle: [\"bold\", \"underline\"] // Multiple styles: bold + underlined\n * categoryStyle: null // No additional styling\n * ```\n *\n * @default `[\"dim\", \"italic\"]` (dimmed for subtle appearance)\n */\n readonly categoryStyle?: Style;\n\n /**\n * Maximum display width for category names.\n *\n * Controls layout consistency by limiting category width.\n * Long categories are truncated according to `categoryTruncate` strategy.\n *\n * @default `20`\n */\n readonly categoryWidth?: number;\n\n /**\n * Strategy for truncating long category names.\n *\n * When categories exceed `categoryWidth`, this controls how truncation works.\n * Smart truncation preserves important context while maintaining layout.\n *\n * - `\"middle\"`: Keep first and last parts (e.g., \"app.server…auth.jwt\")\n * - `\"end\"`: Truncate at the end (e.g., \"app.server.middleware…\")\n * - `false`: No truncation (ignores `categoryWidth`)\n *\n * @example\n * ```typescript\n * categoryTruncate: \"middle\" // app.server…jwt (preserves context)\n * categoryTruncate: \"end\" // app.server.midd… (linear truncation)\n * categoryTruncate: false // app.server.middleware.auth.jwt (full)\n * ```\n *\n * @default `\"middle\"` (smart context-preserving truncation)\n */\n readonly categoryTruncate?: TruncationStrategy;\n\n /**\n * Color for log message text content.\n *\n * Controls the visual appearance of the actual log message content.\n * Does not affect structured values, which use syntax highlighting.\n *\n * @example\n * ```typescript\n * messageColor: \"#ffffff\" // White message text\n * messageColor: \"green\" // Green message text\n * messageColor: \"rgb(200,200,200)\" // Light gray message text\n * messageColor: null // No coloring\n * ```\n *\n * @default `\"rgb(148,163,184)\"` (light slate gray)\n */\n readonly messageColor?: Color;\n\n /**\n * Visual style applied to log message text.\n *\n * Controls the appearance of the log message content.\n * Supports single styles, multiple styles combined, or no styling.\n * Applied in addition to `messageColor`.\n *\n * @example\n * ```typescript\n * messageStyle: \"dim\" // Single style: dimmed message text\n * messageStyle: \"italic\" // Single style: italic message text\n * messageStyle: [\"dim\", \"italic\"] // Multiple styles: dimmed + italic\n * messageStyle: [\"bold\", \"underline\"] // Multiple styles: bold + underlined\n * messageStyle: null // No additional styling\n * ```\n *\n * @default `\"dim\"` (dimmed for subtle readability)\n */\n readonly messageStyle?: Style;\n\n /**\n * Global color control for the entire formatter.\n *\n * Master switch to enable/disable all color output.\n * When disabled, produces clean monochrome output suitable for\n * non-color terminals or when colors are not desired.\n *\n * @example\n * ```typescript\n * colors: true // Full color output (default)\n * colors: false // Monochrome output only\n * ```\n *\n * @default `true` (colors enabled)\n */\n readonly colors?: boolean;\n\n /**\n * Column alignment for consistent visual layout.\n *\n * When enabled, ensures all log components (icons, levels, categories)\n * align consistently across multiple log entries, creating a clean\n * tabular appearance.\n *\n * @example\n * ```typescript\n * align: true // Aligned columns (default)\n * align: false // Compact, non-aligned output\n * ```\n *\n * @default `true` (alignment enabled)\n */\n readonly align?: boolean;\n\n /**\n * Configuration for structured value inspection and rendering.\n *\n * Controls how objects, arrays, and other complex values are displayed\n * within log messages. Uses Node.js `util.inspect()` style options.\n *\n * @example\n * ```typescript\n * inspectOptions: {\n * depth: 3, // Show 3 levels of nesting\n * colors: false, // Disable value syntax highlighting\n * compact: true, // Use compact object display\n * }\n * ```\n *\n * @default `{}` (use built-in defaults: depth=unlimited, colors=auto, compact=true)\n */\n readonly inspectOptions?: {\n /**\n * Maximum depth to traverse when inspecting nested objects.\n * @default Infinity (no depth limit)\n */\n readonly depth?: number;\n\n /**\n * Whether to use syntax highlighting colors for inspected values.\n * @default Inherited from global `colors` setting\n */\n readonly colors?: boolean;\n\n /**\n * Whether to use compact formatting for objects and arrays.\n * @default `true` (compact formatting)\n */\n readonly compact?: boolean;\n\n /**\n * Whether to invoke getter functions during inspection.\n * (Node.js, Deno, and Bun only; browsers fall back to default behavior.)\n *\n * @default Inherited from runtime defaults\n * @since 1.2.0\n */\n readonly getters?: boolean;\n\n /**\n * Whether to show Proxy objects with their target and handler.\n * (Node.js, Deno, and Bun only; browsers fall back to default behavior.)\n *\n * @default Inherited from runtime defaults\n * @since 1.2.0\n */\n readonly showProxy?: boolean;\n };\n\n /**\n * Configuration to always render structured data.\n *\n * If set to `true`, any structured data that is logged will\n * always be rendered. This can be very verbose. Make sure\n * to configure `inspectOptions` properly for your usecase.\n *\n * @default `false`\n * @since 1.1.0\n */\n readonly properties?: boolean;\n\n /**\n * Enable word wrapping for long messages.\n *\n * When enabled, long messages will be wrapped at the specified width,\n * with continuation lines aligned to the message column position.\n *\n * - `true`: Auto-detect terminal width when attached to a terminal,\n * fallback to 80 columns when not in a terminal or detection fails\n * - `number`: Use the specified width in columns\n * - `false`: Disable word wrapping\n *\n * @example\n * ```typescript\n * // Auto-detect terminal width (recommended)\n * wordWrap: true\n *\n * // Custom wrap width\n * wordWrap: 120\n *\n * // Disable word wrapping (default)\n * wordWrap: false\n * ```\n *\n * @default `true` (auto-detect terminal width)\n * @since 1.0.0\n */\n readonly wordWrap?: boolean | number;\n}\n\n/**\n * Creates a beautiful console formatter optimized for local development.\n *\n * This formatter provides a Signale-inspired visual design with colorful icons,\n * smart category truncation, dimmed styling, and perfect column alignment.\n * It's specifically designed for development environments that support true colors\n * and Unicode characters.\n *\n * The formatter features:\n * - Emoji icons for each log level (🔍 trace, 🐛 debug, ✨ info, etc.)\n * - True color support with rich color schemes\n * - Intelligent category truncation for long hierarchical categories\n * - Optional timestamp display with multiple formats\n * - Configurable alignment and styling options\n * - Enhanced value rendering with syntax highlighting\n *\n * @param options Configuration options for customizing the formatter behavior.\n * @returns A text formatter function that can be used with LogTape sinks.\n *\n * @example\n * ```typescript\n * import { configure } from \"@logtape/logtape\";\n * import { getConsoleSink } from \"@logtape/logtape/sink\";\n * import { getPrettyFormatter } from \"@logtape/pretty\";\n *\n * await configure({\n * sinks: {\n * console: getConsoleSink({\n * formatter: getPrettyFormatter({\n * timestamp: \"time\",\n * categoryWidth: 25,\n * icons: {\n * info: \"📘\",\n * error: \"🔥\"\n * }\n * })\n * })\n * }\n * });\n * ```\n *\n * @since 1.0.0\n */\nexport function getPrettyFormatter(\n options: PrettyFormatterOptions = {},\n): TextFormatter {\n // Extract options with defaults\n const {\n timestamp = \"none\",\n timeZone,\n timestampColor = \"rgb(100,116,139)\",\n timestampStyle = \"dim\",\n level: levelFormat = \"full\",\n levelColors = {},\n levelStyle = \"underline\",\n icons = true,\n categorySeparator = \"·\",\n categoryColor = \"rgb(100,116,139)\",\n categoryColorMap = new Map(),\n categoryStyle = [\"dim\", \"italic\"],\n categoryWidth = 20,\n categoryTruncate = \"middle\",\n messageColor = \"rgb(148,163,184)\",\n messageStyle = \"dim\",\n colors: useColors = true,\n align = true,\n inspectOptions = {},\n properties = false,\n wordWrap = true,\n } = options;\n\n // Resolve icons\n const baseIconMap: Record<LogLevel, string> = icons === false\n ? { trace: \"\", debug: \"\", info: \"\", warning: \"\", error: \"\", fatal: \"\" }\n : icons === true\n ? defaultIcons\n : { ...defaultIcons, ...(icons as Partial<Record<LogLevel, string>>) };\n\n // Normalize icon spacing for consistent alignment\n const iconMap = normalizeIconSpacing(baseIconMap);\n\n // Resolve level colors with defaults\n const resolvedLevelColors: Record<LogLevel, Color> = {\n trace: defaultColors.trace,\n debug: defaultColors.debug,\n info: defaultColors.info,\n warning: defaultColors.warning,\n error: defaultColors.error,\n fatal: defaultColors.fatal,\n ...levelColors,\n };\n\n // Level formatter function with optimized mappings\n const levelMappings: Record<string, Record<LogLevel, string>> = {\n \"ABBR\": {\n trace: \"TRC\",\n debug: \"DBG\",\n info: \"INF\",\n warning: \"WRN\",\n error: \"ERR\",\n fatal: \"FTL\",\n },\n \"L\": {\n trace: \"T\",\n debug: \"D\",\n info: \"I\",\n warning: \"W\",\n error: \"E\",\n fatal: \"F\",\n },\n \"abbr\": {\n trace: \"trc\",\n debug: \"dbg\",\n info: \"inf\",\n warning: \"wrn\",\n error: \"err\",\n fatal: \"ftl\",\n },\n \"l\": {\n trace: \"t\",\n debug: \"d\",\n info: \"i\",\n warning: \"w\",\n error: \"e\",\n fatal: \"f\",\n },\n };\n\n const formatLevel = (level: LogLevel): string => {\n if (typeof levelFormat === \"function\") {\n return levelFormat(level);\n }\n\n if (levelFormat === \"FULL\") return level.toUpperCase();\n if (levelFormat === \"full\") return level;\n\n return levelMappings[levelFormat]?.[level] ?? level;\n };\n\n const resolvedTimeZone = resolveTimeZone(timeZone);\n\n // Resolve timestamp formatter\n let timestampFn: ((ts: number) => string | null) | null = null;\n if (timestamp === \"none\" || timestamp === \"disabled\") {\n timestampFn = null;\n } else if (typeof timestamp === \"function\") {\n timestampFn = timestamp;\n } else {\n timestampFn = (ts: number): string => {\n if (timestamp === \"rfc3339\" && resolvedTimeZone.kind === \"utc\") {\n return new Date(ts).toISOString();\n }\n\n const parts = getDateParts(ts, resolvedTimeZone);\n const date = `${parts.year}-${parts.month}-${parts.day}`;\n const time = `${parts.hour}:${parts.minute}:${parts.second}.${parts.ms}`;\n const tzLong = formatOffset(parts.offsetMinutes, true);\n const tzShort = formatOffset(parts.offsetMinutes, false);\n\n if (timestamp === \"date-time-timezone\") {\n return `${date} ${time} ${tzLong}`;\n }\n if (timestamp === \"date-time-tz\") return `${date} ${time} ${tzShort}`;\n if (timestamp === \"date-time\") return `${date} ${time}`;\n if (timestamp === \"time-timezone\") return `${time} ${tzLong}`;\n if (timestamp === \"time-tz\") return `${time} ${tzShort}`;\n if (timestamp === \"time\") return time;\n if (timestamp === \"date\") return date;\n return `${date}T${time}${tzLong}`;\n };\n }\n\n // Configure word wrap settings\n const wordWrapEnabled = wordWrap !== false;\n let wordWrapWidth: number;\n\n if (typeof wordWrap === \"number\") {\n wordWrapWidth = wordWrap;\n } else if (wordWrap === true) {\n // Auto-detect terminal width\n wordWrapWidth = getOptimalWordWrapWidth(80);\n } else {\n wordWrapWidth = 80; // Default fallback\n }\n\n // Prepare category color patterns for matching\n const categoryPatterns = prepareCategoryPatterns(categoryColorMap);\n\n // Calculate level width based on format\n const allLevels: LogLevel[] = [...getLogLevels()];\n const levelWidth = Math.max(...allLevels.map((l) => formatLevel(l).length));\n\n return (record: LogRecord): string => {\n // Calculate the prefix parts first to determine message column position\n const icon = iconMap[record.level] || \"\";\n const level = formatLevel(record.level);\n const categoryStr = truncateCategory(\n record.category,\n categoryWidth,\n categorySeparator,\n categoryTruncate,\n );\n\n // Format message with values - handle color reset/reapply for interpolated values\n let message = \"\";\n const messageColorCode = useColors ? colorToAnsi(messageColor) : \"\";\n const messageStyleCode = useColors ? styleToAnsi(messageStyle) : \"\";\n const messagePrefix = useColors\n ? `${messageStyleCode}${messageColorCode}`\n : \"\";\n\n for (let i = 0; i < record.message.length; i++) {\n if (i % 2 === 0) {\n message += record.message[i];\n } else {\n const value = record.message[i];\n const inspected = inspect(value, {\n colors: useColors,\n ...inspectOptions,\n });\n\n // Handle multiline interpolated values properly\n if (inspected.includes(\"\\n\")) {\n const lines = inspected.split(\"\\n\");\n\n const formattedLines = lines.map((line, index) => {\n if (index === 0) {\n // First line: reset formatting, add the line, then reapply\n if (useColors && (messageColorCode || messageStyleCode)) {\n return `${RESET}${line}${messagePrefix}`;\n } else {\n return line;\n }\n } else {\n // Continuation lines: just apply formatting, let wrapText handle indentation\n if (useColors && (messageColorCode || messageStyleCode)) {\n return `${line}${messagePrefix}`;\n } else {\n return line;\n }\n }\n });\n message += formattedLines.join(\"\\n\");\n } else {\n // Single line - handle normally\n if (useColors && (messageColorCode || messageStyleCode)) {\n message += `${RESET}${inspected}${messagePrefix}`;\n } else {\n message += inspected;\n }\n }\n }\n }\n\n // Parts are already calculated above\n\n // Determine category color (with prefix matching)\n const finalCategoryColor = useColors\n ? (matchCategoryColor(record.category, categoryPatterns) || categoryColor)\n : null;\n\n // Apply colors and styling\n const formattedIcon = icon;\n let formattedLevel = level;\n let formattedCategory = categoryStr;\n let formattedMessage = message;\n let formattedTimestamp = \"\";\n\n if (useColors) {\n // Apply level color and style\n const levelColorCode = colorToAnsi(resolvedLevelColors[record.level]);\n const levelStyleCode = styleToAnsi(levelStyle);\n formattedLevel = `${levelStyleCode}${levelColorCode}${level}${RESET}`;\n\n // Apply category color and style (with prefix matching)\n const categoryColorCode = colorToAnsi(finalCategoryColor);\n const categoryStyleCode = styleToAnsi(categoryStyle);\n formattedCategory =\n `${categoryStyleCode}${categoryColorCode}${categoryStr}${RESET}`;\n\n // Apply message color and style (already handled in message building above)\n formattedMessage = `${messagePrefix}${message}${RESET}`;\n }\n\n // Format timestamp if needed\n if (timestampFn) {\n const ts = timestampFn(record.timestamp);\n if (ts !== null) {\n if (useColors) {\n const timestampColorCode = colorToAnsi(timestampColor);\n const timestampStyleCode = styleToAnsi(timestampStyle);\n formattedTimestamp =\n `${timestampStyleCode}${timestampColorCode}${ts}${RESET} `;\n } else {\n formattedTimestamp = `${ts} `;\n }\n }\n }\n\n // Build the final output with alignment\n if (align) {\n // Calculate padding accounting for ANSI escape sequences\n const levelColorLength = useColors\n ? (colorToAnsi(resolvedLevelColors[record.level]).length +\n styleToAnsi(levelStyle).length + RESET.length)\n : 0;\n const categoryColorLength = useColors\n ? (colorToAnsi(finalCategoryColor).length +\n styleToAnsi(categoryStyle).length + RESET.length)\n : 0;\n\n const paddedLevel = formattedLevel.padEnd(levelWidth + levelColorLength);\n const paddedCategory = formattedCategory.padEnd(\n categoryWidth + categoryColorLength,\n );\n\n let result =\n `${formattedTimestamp}${formattedIcon} ${paddedLevel} ${paddedCategory} ${formattedMessage}`;\n const indentWidth = getDisplayWidth(\n stripAnsi(\n `${formattedTimestamp}${formattedIcon} ${paddedLevel} ${paddedCategory} `,\n ),\n );\n\n // Apply word wrapping if enabled, or if there are multiline interpolated values\n if (wordWrapEnabled || message.includes(\"\\n\")) {\n result = wrapText(\n result,\n wordWrapEnabled ? wordWrapWidth : Infinity,\n indentWidth,\n );\n }\n\n if (properties) {\n result += formatProperties(\n record,\n indentWidth,\n wordWrapEnabled ? wordWrapWidth : Infinity,\n useColors,\n inspectOptions,\n );\n }\n\n return result + \"\\n\";\n } else {\n let result =\n `${formattedTimestamp}${formattedIcon} ${formattedLevel} ${formattedCategory} ${formattedMessage}`;\n const indentWidth = getDisplayWidth(\n stripAnsi(\n `${formattedTimestamp}${formattedIcon} ${formattedLevel} ${formattedCategory} `,\n ),\n );\n\n // Apply word wrapping if enabled, or if there are multiline interpolated values\n if (wordWrapEnabled || message.includes(\"\\n\")) {\n result = wrapText(\n result,\n wordWrapEnabled ? wordWrapWidth : Infinity,\n indentWidth,\n );\n }\n\n if (properties) {\n result += formatProperties(\n record,\n indentWidth,\n wordWrapEnabled ? wordWrapWidth : Infinity,\n useColors,\n inspectOptions,\n );\n }\n\n return result + \"\\n\";\n }\n };\n}\n\nfunction formatProperties(\n record: LogRecord,\n indentWidth: number,\n maxWidth: number,\n useColors: boolean,\n inspectOptions: InspectOptions,\n): string {\n let result = \"\";\n for (const prop in record.properties) {\n const propValue = record.properties[prop];\n // Ensure padding is never negative\n const pad = Math.max(0, indentWidth - getDisplayWidth(prop) - 2);\n result += \"\\n\" + wrapText(\n `${\" \".repeat(pad)}${useColors ? DIM : \"\"}${prop}:${\n useColors ? RESET : \"\"\n } ${inspect(propValue, { colors: useColors, ...inspectOptions })}`,\n maxWidth,\n indentWidth,\n );\n }\n return result;\n}\n\n/**\n * A pre-configured beautiful console formatter for local development.\n *\n * This is a ready-to-use instance of the pretty formatter with sensible defaults\n * for most development scenarios. It provides immediate visual enhancement to\n * your logs without requiring any configuration.\n *\n * Features enabled by default:\n * - Emoji icons for all log levels\n * - True color support with rich color schemes\n * - Dimmed text styling for better readability\n * - Smart category truncation (20 characters max)\n * - Perfect column alignment\n * - No timestamp display (cleaner for development)\n *\n * For custom configuration, use {@link getPrettyFormatter} instead.\n *\n * @example\n * ```typescript\n * import { configure } from \"@logtape/logtape\";\n * import { getConsoleSink } from \"@logtape/logtape/sink\";\n * import { prettyFormatter } from \"@logtape/pretty\";\n *\n * await configure({\n * sinks: {\n * console: getConsoleSink({\n * formatter: prettyFormatter\n * })\n * }\n * });\n * ```\n *\n * @since 1.0.0\n */\nexport const prettyFormatter: TextFormatter = getPrettyFormatter();\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,QAAQ;AACd,MAAM,MAAM;AAGZ,MAAM,gBAAgB;CACpB,OAAO;CACP,OAAO;CACP,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,UAAU;CACV,SAAS;CACT,WAAW;AACZ;;;;AAKD,MAAM,SAAS;CACb,OAAO;CACP,MAAM;CACN,KAAK;CACL,QAAQ;CACR,WAAW;CACX,eAAe;AAChB;;;;AAKD,MAAM,aAAa;CACjB,OAAO;CACP,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAA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Ac,GAAG,YAAY,GAAG,eAAe,GACxE,CACF;AAGD,OAAI,mBAAmB,QAAQ,SAAS,KAAK,CAC3C,UAAS,SACP,QACA,kBAAkB,gBAAgB,UAClC,YACD;AAGH,OAAI,WACF,WAAU,iBACR,QACA,aACA,kBAAkB,gBAAgB,UAClC,WACA,eACD;AAGH,UAAO,SAAS;EACjB,OAAM;GACL,IAAI,UACD,EAAE,mBAAmB,EAAE,cAAc,GAAG,eAAe,GAAG,kBAAkB,GAAG,iBAAiB;GACnG,MAAM,cAAc,gBAClB,WACG,EAAE,mBAAmB,EAAE,cAAc,GAAG,eAAe,GAAG,kBAAkB,GAC9E,CACF;AAGD,OAAI,mBAAmB,QAAQ,SAAS,KAAK,CAC3C,UAAS,SACP,QACA,kBAAkB,gBAAgB,UAClC,YACD;AAGH,OAAI,WACF,WAAU,iBACR,QACA,aACA,kBAAkB,gBAAgB,UAClC,WACA,eACD;AAGH,UAAO,SAAS;EACjB;CACF;AACF;AAED,SAAS,iBACPA,QACAC,aACAC,UACAC,WACAC,gBACQ;CACR,IAAI,SAAS;AACb,MAAK,MAAM,QAAQ,OAAO,YAAY;EACpC,MAAM,YAAY,OAAO,WAAW;EAEpC,MAAM,MAAM,KAAK,IAAI,GAAG,cAAc,gBAAgB,KAAK,GAAG,EAAE;AAChE,YAAU,OAAO,UACd,EAAE,IAAI,OAAO,IAAI,CAAC,EAAE,YAAY,MAAM,GAAG,EAAE,KAAK,GAC/C,YAAY,QAAQ,GACrB,GAAG,QAAQ,WAAW;GAAE,QAAQ;GAAW,GAAG;EAAgB,EAAC,CAAC,GACjE,UACA,YACD;CACF;AACD,QAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAaC,kBAAiC,oBAAoB"}
1
+ {"version":3,"file":"formatter.js","names":["color: Color","style: Style","categoryColorMap: CategoryColorMap","patterns: CategoryPattern[]","category: readonly string[]","prefix: readonly string[]","value: number","minutes: number","full: boolean","timeZone: string | null | undefined","formatter: Intl.DateTimeFormat","ts: number","config: TimeZoneConfig","defaultIcons: Record<LogLevel, string>","iconMap: Record<LogLevel, string>","options: PrettyFormatterOptions","sanitize: ((text: string) => string) | null","text: string","sanitizeCategory: ((text: string) => string) | null","resolvedInspectOptions: InspectOptions","baseIconMap: Record<LogLevel, string>","resolvedLevelColors: Record<LogLevel, Color>","levelMappings: Record<string, Record<LogLevel, string>>","level: LogLevel","timestampFn: ((ts: number) => string | null) | null","wordWrapWidth: number","allLevels: LogLevel[]","record: LogRecord","indentWidth: number","maxWidth: number","useColors: boolean","inspectOptions: InspectOptions","prettyFormatter: TextFormatter"],"sources":["../src/formatter.ts"],"sourcesContent":["import {\n getLogLevels,\n type LogLevel,\n type LogRecord,\n sanitizeControlSequences,\n type TextFormatter,\n type TextFormatterOptions,\n} from \"@logtape/logtape\";\nimport { inspect, type InspectOptions } from \"#util\";\nimport { getOptimalWordWrapWidth } from \"./terminal.ts\";\nimport { truncateCategory, type TruncationStrategy } from \"./truncate.ts\";\nimport { getDisplayWidth, stripAnsi } from \"./wcwidth.ts\";\nimport { wrapText } from \"./wordwrap.ts\";\n\n/**\n * ANSI escape codes for styling\n */\nconst RESET = \"\\x1b[0m\";\nconst DIM = \"\\x1b[2m\";\n\n// Default true color values (referenced in JSDoc)\nconst defaultColors = {\n trace: \"rgb(167,139,250)\", // Light purple\n debug: \"rgb(96,165,250)\", // Light blue\n info: \"rgb(52,211,153)\", // Emerald\n warning: \"rgb(251,191,36)\", // Amber\n error: \"rgb(248,113,113)\", // Light red\n fatal: \"rgb(220,38,38)\", // Dark red\n category: \"rgb(100,116,139)\", // Slate\n message: \"rgb(148,163,184)\", // Light slate\n timestamp: \"rgb(100,116,139)\", // Slate\n} as const;\n\n/**\n * ANSI style codes\n */\nconst styles = {\n reset: RESET,\n bold: \"\\x1b[1m\",\n dim: DIM,\n italic: \"\\x1b[3m\",\n underline: \"\\x1b[4m\",\n strikethrough: \"\\x1b[9m\",\n} as const;\n\n/**\n * Standard ANSI colors (16-color)\n */\nconst ansiColors = {\n black: \"\\x1b[30m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n white: \"\\x1b[37m\",\n} as const;\n\n/**\n * Color type definition\n */\nexport type Color =\n | keyof typeof ansiColors\n | `rgb(${number},${number},${number})`\n | `#${string}`\n | null;\n\n/**\n * Category color mapping for prefix-based coloring.\n *\n * Maps category prefixes (as arrays) to colors. The formatter will match\n * categories against these prefixes and use the corresponding color.\n * Longer/more specific prefixes take precedence over shorter ones.\n *\n * @example\n * ```typescript\n * new Map([\n * [[\"app\", \"auth\"], \"#ff6b6b\"], // app.auth.* -> red\n * [[\"app\", \"db\"], \"#4ecdc4\"], // app.db.* -> teal\n * [[\"app\"], \"#45b7d1\"], // app.* (fallback) -> blue\n * [[\"lib\"], \"#96ceb4\"], // lib.* -> green\n * ])\n * ```\n */\nexport type CategoryColorMap = Map<readonly string[], Color>;\n\n/**\n * Internal representation of category prefix patterns\n */\ntype CategoryPattern = {\n prefix: readonly string[];\n color: Color;\n};\n\n/**\n * Style type definition - supports single styles, arrays of styles, or null\n */\nexport type Style = keyof typeof styles | (keyof typeof styles)[] | null;\n\n// Pre-compiled regex patterns for color parsing\nconst RGB_PATTERN = /^rgb\\((\\d+),(\\d+),(\\d+)\\)$/;\nconst HEX_PATTERN = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;\nconst FIXED_OFFSET_PATTERN = /^([+-])(0\\d|1\\d|2[0-3]):([0-5]\\d)$/;\n\n/**\n * Helper function to convert color to ANSI escape code\n */\nfunction colorToAnsi(color: Color): string {\n if (color === null) return \"\";\n if (color in ansiColors) {\n return ansiColors[color as keyof typeof ansiColors];\n }\n\n // Handle rgb() format\n const rgbMatch = color.match(RGB_PATTERN);\n if (rgbMatch) {\n const [, r, g, b] = rgbMatch;\n return `\\x1b[38;2;${r};${g};${b}m`;\n }\n\n // Handle hex format (#rrggbb or #rgb)\n const hexMatch = color.match(HEX_PATTERN);\n if (hexMatch) {\n let hex = hexMatch[1];\n // Convert 3-digit hex to 6-digit\n if (hex.length === 3) {\n hex = hex.split(\"\").map((c) => c + c).join(\"\");\n }\n const r = parseInt(hex.substr(0, 2), 16);\n const g = parseInt(hex.substr(2, 2), 16);\n const b = parseInt(hex.substr(4, 2), 16);\n return `\\x1b[38;2;${r};${g};${b}m`;\n }\n\n return \"\";\n}\n\n/**\n * Helper function to convert style to ANSI escape code\n */\nfunction styleToAnsi(style: Style): string {\n if (style === null) return \"\";\n if (Array.isArray(style)) {\n return style.map((s) => styles[s] || \"\").join(\"\");\n }\n return styles[style] || \"\";\n}\n\n/**\n * Converts a category color map to internal patterns and sorts them by specificity.\n * More specific (longer) prefixes come first for proper matching precedence.\n */\nfunction prepareCategoryPatterns(\n categoryColorMap: CategoryColorMap,\n): CategoryPattern[] {\n const patterns: CategoryPattern[] = [];\n\n for (const [prefix, color] of categoryColorMap) {\n patterns.push({ prefix, color });\n }\n\n // Sort by prefix length (descending) for most-specific-first matching\n return patterns.sort((a, b) => b.prefix.length - a.prefix.length);\n}\n\n/**\n * Matches a category against category color patterns.\n * Returns the color of the first matching pattern, or null if no match.\n */\nfunction matchCategoryColor(\n category: readonly string[],\n patterns: CategoryPattern[],\n): Color {\n for (const pattern of patterns) {\n if (categoryMatches(category, pattern.prefix)) {\n return pattern.color;\n }\n }\n return null;\n}\n\n/**\n * Checks if a category matches a prefix pattern.\n * A category matches if it starts with all segments of the prefix.\n */\nfunction categoryMatches(\n category: readonly string[],\n prefix: readonly string[],\n): boolean {\n if (prefix.length > category.length) {\n return false;\n }\n\n for (let i = 0; i < prefix.length; i++) {\n if (category[i] !== prefix[i]) {\n return false;\n }\n }\n\n return true;\n}\n\ntype TimeZoneConfig =\n | { kind: \"utc\" }\n | { kind: \"local\" }\n | { kind: \"offset\"; minutes: number }\n | { kind: \"iana\"; formatter: Intl.DateTimeFormat };\n\ntype DateParts = {\n year: string;\n month: string;\n day: string;\n hour: string;\n minute: string;\n second: string;\n ms: string;\n offsetMinutes: number;\n};\n\nfunction pad2(value: number): string {\n return value < 10 ? `0${value}` : `${value}`;\n}\n\nfunction pad3(value: number): string {\n return value < 10 ? `00${value}` : value < 100 ? `0${value}` : `${value}`;\n}\n\nfunction formatOffset(minutes: number, full: boolean): string {\n const sign = minutes < 0 ? \"-\" : \"+\";\n const absolute = Math.abs(minutes);\n const hour = pad2(Math.floor(absolute / 60));\n const minute = pad2(absolute % 60);\n if (!full && minute === \"00\") return `${sign}${hour}`;\n return `${sign}${hour}:${minute}`;\n}\n\nfunction resolveTimeZone(timeZone: string | null | undefined): TimeZoneConfig {\n if (typeof timeZone === \"undefined\") return { kind: \"utc\" };\n if (timeZone === null) return { kind: \"local\" };\n\n const offsetMatch = FIXED_OFFSET_PATTERN.exec(timeZone);\n if (offsetMatch != null) {\n const sign = offsetMatch[1] === \"-\" ? -1 : 1;\n const hours = Number(offsetMatch[2]);\n const minutes = Number(offsetMatch[3]);\n return { kind: \"offset\", minutes: sign * (hours * 60 + minutes) };\n }\n\n if (\n typeof Intl === \"undefined\" || typeof Intl.DateTimeFormat !== \"function\"\n ) {\n throw new TypeError(\n `Invalid timeZone option: ${\n JSON.stringify(timeZone)\n }. This environment does not support IANA time zones.`,\n );\n }\n\n try {\n return {\n kind: \"iana\",\n formatter: new Intl.DateTimeFormat(\"en-CA\", {\n timeZone,\n hour12: false,\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n }),\n };\n } catch {\n throw new TypeError(\n `Invalid timeZone option: ${\n JSON.stringify(timeZone)\n }. Expected an IANA time zone name (e.g., \"Asia/Seoul\") or a fixed UTC offset string (e.g., \"+09:00\").`,\n );\n }\n}\n\nfunction readPartsFromFormatter(\n formatter: Intl.DateTimeFormat,\n ts: number,\n): Omit<DateParts, \"ms\" | \"offsetMinutes\"> {\n const parts = formatter.formatToParts(new Date(ts));\n let year = \"\";\n let month = \"\";\n let day = \"\";\n let hour = \"\";\n let minute = \"\";\n let second = \"\";\n for (const part of parts) {\n if (part.type === \"year\") year = part.value;\n else if (part.type === \"month\") month = part.value;\n else if (part.type === \"day\") day = part.value;\n else if (part.type === \"hour\") hour = part.value;\n else if (part.type === \"minute\") minute = part.value;\n else if (part.type === \"second\") second = part.value;\n }\n return { year, month, day, hour, minute, second };\n}\n\nfunction getDateParts(ts: number, config: TimeZoneConfig): DateParts {\n const d = new Date(ts);\n const ms = pad3(d.getUTCMilliseconds());\n\n if (config.kind === \"utc\") {\n return {\n year: `${d.getUTCFullYear()}`,\n month: pad2(d.getUTCMonth() + 1),\n day: pad2(d.getUTCDate()),\n hour: pad2(d.getUTCHours()),\n minute: pad2(d.getUTCMinutes()),\n second: pad2(d.getUTCSeconds()),\n ms,\n offsetMinutes: 0,\n };\n }\n\n if (config.kind === \"local\") {\n return {\n year: `${d.getFullYear()}`,\n month: pad2(d.getMonth() + 1),\n day: pad2(d.getDate()),\n hour: pad2(d.getHours()),\n minute: pad2(d.getMinutes()),\n second: pad2(d.getSeconds()),\n ms,\n offsetMinutes: -d.getTimezoneOffset(),\n };\n }\n\n if (config.kind === \"offset\") {\n const shifted = new Date(ts + config.minutes * 60_000);\n return {\n year: `${shifted.getUTCFullYear()}`,\n month: pad2(shifted.getUTCMonth() + 1),\n day: pad2(shifted.getUTCDate()),\n hour: pad2(shifted.getUTCHours()),\n minute: pad2(shifted.getUTCMinutes()),\n second: pad2(shifted.getUTCSeconds()),\n ms,\n offsetMinutes: config.minutes,\n };\n }\n\n const parts = readPartsFromFormatter(config.formatter, ts);\n const asUtc = Date.UTC(\n Number(parts.year),\n Number(parts.month) - 1,\n Number(parts.day),\n Number(parts.hour),\n Number(parts.minute),\n Number(parts.second),\n d.getUTCMilliseconds(),\n );\n const offsetMinutes = Math.round((asUtc - ts) / 60_000);\n return { ...parts, ms, offsetMinutes };\n}\n\n/**\n * Default icons for each log level\n */\nconst defaultIcons: Record<LogLevel, string> = {\n trace: \"🔍\",\n debug: \"🐛\",\n info: \"✨\",\n warning: \"⚡\",\n error: \"❌\",\n fatal: \"💀\",\n};\n\n/**\n * Normalize icon spacing to ensure consistent column alignment.\n *\n * All icons will be padded with spaces to match the width of the widest icon,\n * ensuring consistent prefix alignment across all log levels.\n *\n * @param iconMap The icon mapping to normalize\n * @returns A new icon map with consistent spacing\n */\nfunction normalizeIconSpacing(\n iconMap: Record<LogLevel, string>,\n): Record<LogLevel, string> {\n const entries = Object.entries(iconMap) as Array<[LogLevel, string]>;\n const maxWidth = Math.max(\n ...entries.map(([, icon]) => getDisplayWidth(icon)),\n );\n\n return Object.fromEntries(\n entries.map(([level, icon]) => [\n level,\n icon + \" \".repeat(maxWidth - getDisplayWidth(icon)),\n ]),\n ) as Record<LogLevel, string>;\n}\n\n/**\n * Configuration options for the pretty formatter.\n *\n * This interface extends the base text formatter options while providing\n * extensive customization options for visual styling, layout control, and\n * development-focused features. It offers granular control over colors,\n * styles, and formatting similar to the ANSI color formatter.\n *\n * @since 1.0.0\n */\nexport interface PrettyFormatterOptions\n extends Omit<TextFormatterOptions, \"category\" | \"value\" | \"format\"> {\n /**\n * Color for timestamp display when timestamps are enabled.\n *\n * Supports true color RGB values, hex colors, or ANSI color names.\n * Set to `null` to disable timestamp coloring.\n *\n * @example\n * ```typescript\n * timestampColor: \"#888888\" // Hex color\n * timestampColor: \"rgb(128,128,128)\" // RGB color\n * timestampColor: \"cyan\" // ANSI color name\n * timestampColor: null // No color\n * ```\n *\n * @default `\"rgb(100,116,139)\"` (slate gray)\n */\n readonly timestampColor?: Color;\n\n /**\n * Visual style applied to timestamp text.\n *\n * Controls text appearance like boldness, dimming, etc.\n * Supports single styles, multiple styles combined, or no styling.\n * Combines with `timestampColor` for full styling control.\n *\n * @example\n * ```typescript\n * timestampStyle: \"dim\" // Single style: dimmed text\n * timestampStyle: \"bold\" // Single style: bold text\n * timestampStyle: [\"bold\", \"underline\"] // Multiple styles: bold + underlined\n * timestampStyle: [\"dim\", \"italic\"] // Multiple styles: dimmed + italic\n * timestampStyle: null // No styling\n * ```\n *\n * @default `\"dim\"`\n */\n readonly timestampStyle?: Style;\n\n /**\n * Custom colors for each log level.\n *\n * Allows fine-grained control over level appearance. Each level can have\n * its own color scheme. Unspecified levels use built-in defaults.\n * Set individual levels to `null` to disable coloring for that level.\n *\n * @example\n * ```typescript\n * levelColors: {\n * info: \"#00ff00\", // Bright green for info\n * error: \"#ff0000\", // Bright red for errors\n * warning: \"orange\", // ANSI orange for warnings\n * debug: null, // No color for debug\n * }\n * ```\n *\n * @default Built-in color scheme (purple trace, blue debug, green info, amber warning, red error, dark red fatal)\n */\n readonly levelColors?: Partial<Record<LogLevel, Color>>;\n\n /**\n * Visual style applied to log level text.\n *\n * Controls the appearance of the level indicator (e.g., \"info\", \"error\").\n * Supports single styles, multiple styles combined, or no styling.\n * Applied in addition to level-specific colors.\n *\n * @example\n * ```typescript\n * levelStyle: \"bold\" // Single style: bold level text\n * levelStyle: \"underline\" // Single style: underlined level text\n * levelStyle: [\"bold\", \"underline\"] // Multiple styles: bold + underlined\n * levelStyle: [\"dim\", \"italic\"] // Multiple styles: dimmed + italic\n * levelStyle: null // No additional styling\n * ```\n *\n * @default `\"underline\"`\n */\n readonly levelStyle?: Style;\n\n /**\n * Icon configuration for each log level.\n *\n * Controls the emoji/symbol displayed before each log entry.\n * Provides visual quick-identification of log severity.\n *\n * - `true`: Use built-in emoji set (🔍 trace, 🐛 debug, ✨ info, ⚠️ warning, ❌ error, 💀 fatal)\n * - `false`: Disable all icons for clean text-only output\n * - Object: Custom icon mapping, falls back to defaults for unspecified levels\n *\n * @example\n * ```typescript\n * icons: true // Use default emoji set\n * icons: false // No icons\n * icons: {\n * info: \"ℹ️\", // Custom info icon\n * error: \"🔥\", // Custom error icon\n * warning: \"⚡\", // Custom warning icon\n * }\n * ```\n *\n * @default `true` (use default emoji icons)\n */\n readonly icons?: boolean | Partial<Record<LogLevel, string>>;\n\n /**\n * Character(s) used to separate category hierarchy levels.\n *\n * Categories are hierarchical (e.g., [\"app\", \"auth\", \"jwt\"]) and this\n * separator joins them for display (e.g., \"app.auth.jwt\").\n *\n * @example\n * ```typescript\n * categorySeparator: \"·\" // app·auth·jwt\n * categorySeparator: \".\" // app.auth.jwt\n * categorySeparator: \":\" // app:auth:jwt\n * categorySeparator: \" > \" // app > auth > jwt\n * categorySeparator: \"::\" // app::auth::jwt\n * ```\n *\n * @default `\"·\"` (interpunct)\n */\n readonly categorySeparator?: string;\n\n /**\n * Default color for category display.\n *\n * Used as fallback when no specific color is found in `categoryColorMap`.\n * Controls the visual appearance of the category hierarchy display.\n *\n * @example\n * ```typescript\n * categoryColor: \"#666666\" // Gray categories\n * categoryColor: \"blue\" // Blue categories\n * categoryColor: \"rgb(100,150,200)\" // Light blue categories\n * categoryColor: null // No coloring\n * ```\n *\n * @default `\"rgb(100,116,139)\"` (slate gray)\n */\n readonly categoryColor?: Color;\n\n /**\n * Category-specific color mapping based on prefixes.\n *\n * Maps category prefixes (as arrays) to colors for visual grouping.\n * More specific (longer) prefixes take precedence over shorter ones.\n * If no prefix matches, falls back to the default `categoryColor`.\n *\n * @example\n * ```typescript\n * new Map([\n * [[\"app\", \"auth\"], \"#ff6b6b\"], // app.auth.* -> red\n * [[\"app\", \"db\"], \"#4ecdc4\"], // app.db.* -> teal\n * [[\"app\"], \"#45b7d1\"], // app.* (fallback) -> blue\n * [[\"lib\"], \"#96ceb4\"], // lib.* -> green\n * ])\n * ```\n */\n readonly categoryColorMap?: CategoryColorMap;\n\n /**\n * Visual style applied to category text.\n *\n * Controls the appearance of the category hierarchy display.\n * Supports single styles, multiple styles combined, or no styling.\n * Applied in addition to category colors from `categoryColor` or `categoryColorMap`.\n *\n * @example\n * ```typescript\n * categoryStyle: \"dim\" // Single style: dimmed category text\n * categoryStyle: \"italic\" // Single style: italic category text\n * categoryStyle: [\"dim\", \"italic\"] // Multiple styles: dimmed + italic\n * categoryStyle: [\"bold\", \"underline\"] // Multiple styles: bold + underlined\n * categoryStyle: null // No additional styling\n * ```\n *\n * @default `[\"dim\", \"italic\"]` (dimmed for subtle appearance)\n */\n readonly categoryStyle?: Style;\n\n /**\n * Maximum display width for category names.\n *\n * Controls layout consistency by limiting category width.\n * Long categories are truncated according to `categoryTruncate` strategy.\n *\n * @default `20`\n */\n readonly categoryWidth?: number;\n\n /**\n * Strategy for truncating long category names.\n *\n * When categories exceed `categoryWidth`, this controls how truncation works.\n * Smart truncation preserves important context while maintaining layout.\n *\n * - `\"middle\"`: Keep first and last parts (e.g., \"app.server…auth.jwt\")\n * - `\"end\"`: Truncate at the end (e.g., \"app.server.middleware…\")\n * - `false`: No truncation (ignores `categoryWidth`)\n *\n * @example\n * ```typescript\n * categoryTruncate: \"middle\" // app.server…jwt (preserves context)\n * categoryTruncate: \"end\" // app.server.midd… (linear truncation)\n * categoryTruncate: false // app.server.middleware.auth.jwt (full)\n * ```\n *\n * @default `\"middle\"` (smart context-preserving truncation)\n */\n readonly categoryTruncate?: TruncationStrategy;\n\n /**\n * Color for log message text content.\n *\n * Controls the visual appearance of the actual log message content.\n * Does not affect structured values, which use syntax highlighting.\n *\n * @example\n * ```typescript\n * messageColor: \"#ffffff\" // White message text\n * messageColor: \"green\" // Green message text\n * messageColor: \"rgb(200,200,200)\" // Light gray message text\n * messageColor: null // No coloring\n * ```\n *\n * @default `\"rgb(148,163,184)\"` (light slate gray)\n */\n readonly messageColor?: Color;\n\n /**\n * Visual style applied to log message text.\n *\n * Controls the appearance of the log message content.\n * Supports single styles, multiple styles combined, or no styling.\n * Applied in addition to `messageColor`.\n *\n * @example\n * ```typescript\n * messageStyle: \"dim\" // Single style: dimmed message text\n * messageStyle: \"italic\" // Single style: italic message text\n * messageStyle: [\"dim\", \"italic\"] // Multiple styles: dimmed + italic\n * messageStyle: [\"bold\", \"underline\"] // Multiple styles: bold + underlined\n * messageStyle: null // No additional styling\n * ```\n *\n * @default `\"dim\"` (dimmed for subtle readability)\n */\n readonly messageStyle?: Style;\n\n /**\n * Global color control for the entire formatter.\n *\n * Master switch to enable/disable all color output.\n * When disabled, produces clean monochrome output suitable for\n * non-color terminals or when colors are not desired.\n *\n * @example\n * ```typescript\n * colors: true // Full color output (default)\n * colors: false // Monochrome output only\n * ```\n *\n * @default `true` (colors enabled)\n */\n readonly colors?: boolean;\n\n /**\n * Column alignment for consistent visual layout.\n *\n * When enabled, ensures all log components (icons, levels, categories)\n * align consistently across multiple log entries, creating a clean\n * tabular appearance.\n *\n * @example\n * ```typescript\n * align: true // Aligned columns (default)\n * align: false // Compact, non-aligned output\n * ```\n *\n * @default `true` (alignment enabled)\n */\n readonly align?: boolean;\n\n /**\n * Configuration for structured value inspection and rendering.\n *\n * Controls how objects, arrays, and other complex values are displayed\n * within log messages. Uses Node.js `util.inspect()` style options.\n *\n * @example\n * ```typescript\n * inspectOptions: {\n * depth: 3, // Show 3 levels of nesting\n * colors: false, // Disable value syntax highlighting\n * compact: true, // Use compact object display\n * }\n * ```\n *\n * @default `{}` (use built-in defaults: depth=unlimited, colors=auto, compact=true)\n */\n readonly inspectOptions?: {\n /**\n * Maximum depth to traverse when inspecting nested objects.\n * @default Infinity (no depth limit)\n */\n readonly depth?: number;\n\n /**\n * Whether to use syntax highlighting colors for inspected values.\n * @default Inherited from global `colors` setting\n */\n readonly colors?: boolean;\n\n /**\n * Whether to use compact formatting for objects and arrays.\n * @default `true` (compact formatting)\n */\n readonly compact?: boolean;\n\n /**\n * Whether to invoke getter functions during inspection.\n * (Node.js, Deno, and Bun only; browsers fall back to default behavior.)\n *\n * @default Inherited from runtime defaults\n * @since 1.2.0\n */\n readonly getters?: boolean;\n\n /**\n * Whether to show Proxy objects with their target and handler.\n * (Node.js, Deno, and Bun only; browsers fall back to default behavior.)\n *\n * @default Inherited from runtime defaults\n * @since 1.2.0\n */\n readonly showProxy?: boolean;\n };\n\n /**\n * Configuration to always render structured data.\n *\n * If set to `true`, any structured data that is logged will\n * always be rendered. This can be very verbose. Make sure\n * to configure `inspectOptions` properly for your usecase.\n *\n * @default `false`\n * @since 1.1.0\n */\n readonly properties?: boolean;\n\n /**\n * Enable word wrapping for long messages.\n *\n * When enabled, long messages will be wrapped at the specified width,\n * with continuation lines aligned to the message column position.\n *\n * - `true`: Auto-detect terminal width when attached to a terminal,\n * fallback to 80 columns when not in a terminal or detection fails\n * - `number`: Use the specified width in columns\n * - `false`: Disable word wrapping\n *\n * @example\n * ```typescript\n * // Auto-detect terminal width (recommended)\n * wordWrap: true\n *\n * // Custom wrap width\n * wordWrap: 120\n *\n * // Disable word wrapping (default)\n * wordWrap: false\n * ```\n *\n * @default `true` (auto-detect terminal width)\n * @since 1.0.0\n */\n readonly wordWrap?: boolean | number;\n}\n\n/**\n * Creates a beautiful console formatter optimized for local development.\n *\n * This formatter provides a Signale-inspired visual design with colorful icons,\n * smart category truncation, dimmed styling, and perfect column alignment.\n * It's specifically designed for development environments that support true colors\n * and Unicode characters.\n *\n * The formatter features:\n * - Emoji icons for each log level (🔍 trace, 🐛 debug, ✨ info, etc.)\n * - True color support with rich color schemes\n * - Intelligent category truncation for long hierarchical categories\n * - Optional timestamp display with multiple formats\n * - Configurable alignment and styling options\n * - Enhanced value rendering with syntax highlighting\n *\n * @param options Configuration options for customizing the formatter behavior.\n * @returns A text formatter function that can be used with LogTape sinks.\n *\n * @example\n * ```typescript\n * import { configure } from \"@logtape/logtape\";\n * import { getConsoleSink } from \"@logtape/logtape/sink\";\n * import { getPrettyFormatter } from \"@logtape/pretty\";\n *\n * await configure({\n * sinks: {\n * console: getConsoleSink({\n * formatter: getPrettyFormatter({\n * timestamp: \"time\",\n * categoryWidth: 25,\n * icons: {\n * info: \"📘\",\n * error: \"🔥\"\n * }\n * })\n * })\n * }\n * });\n * ```\n *\n * @since 1.0.0\n */\nexport function getPrettyFormatter(\n options: PrettyFormatterOptions = {},\n): TextFormatter {\n // Extract options with defaults\n const {\n timestamp = \"none\",\n timeZone,\n timestampColor = \"rgb(100,116,139)\",\n timestampStyle = \"dim\",\n level: levelFormat = \"full\",\n levelColors = {},\n levelStyle = \"underline\",\n icons = true,\n categorySeparator = \"·\",\n categoryColor = \"rgb(100,116,139)\",\n categoryColorMap = new Map(),\n categoryStyle = [\"dim\", \"italic\"],\n categoryWidth = 20,\n categoryTruncate = \"middle\",\n messageColor = \"rgb(148,163,184)\",\n messageStyle = \"dim\",\n colors: useColors = true,\n align = true,\n inspectOptions = {},\n properties = false,\n wordWrap = true,\n sanitize: sanitizeOptions = {},\n } = options;\n\n // Neutralize control characters and non-SGR escape sequences in the parts\n // that can carry attacker-influenced text: the message template parts and\n // the category segments. Interpolated values go through `inspect()`, which\n // escapes them already.\n const sanitize: ((text: string) => string) | null = sanitizeOptions === false\n ? null\n : (text: string) => sanitizeControlSequences(text, sanitizeOptions);\n // A category is an identifier rather than display text, so SGR sequences are\n // escaped there too; otherwise truncation could split one and leave a\n // dangling introducer in the output.\n const sanitizeCategory: ((text: string) => string) | null =\n sanitizeOptions === false\n ? null\n : (text: string) =>\n sanitizeControlSequences(text, { ...sanitizeOptions, sgr: \"escape\" });\n\n // Fill in the documented defaults. Without these, the runtime's own\n // `inspect()` defaults leak through: Node.js and Bun use `compact: 3`,\n // which lays arrays of more than six elements out in columns, and cap\n // `depth` at 2, while Deno caps it at 4. The defaults are applied with\n // `??` rather than a spread so that an explicit `undefined`, which a\n // caller forwarding an optional setting easily produces, does not\n // reintroduce them.\n const resolvedInspectOptions: InspectOptions = {\n ...inspectOptions,\n compact: inspectOptions.compact ?? true,\n depth: inspectOptions.depth ?? Infinity,\n };\n\n // Resolve icons\n const baseIconMap: Record<LogLevel, string> = icons === false\n ? { trace: \"\", debug: \"\", info: \"\", warning: \"\", error: \"\", fatal: \"\" }\n : icons === true\n ? defaultIcons\n : { ...defaultIcons, ...(icons as Partial<Record<LogLevel, string>>) };\n\n // Normalize icon spacing for consistent alignment\n const iconMap = normalizeIconSpacing(baseIconMap);\n\n // Resolve level colors with defaults\n const resolvedLevelColors: Record<LogLevel, Color> = {\n trace: defaultColors.trace,\n debug: defaultColors.debug,\n info: defaultColors.info,\n warning: defaultColors.warning,\n error: defaultColors.error,\n fatal: defaultColors.fatal,\n ...levelColors,\n };\n\n // Level formatter function with optimized mappings\n const levelMappings: Record<string, Record<LogLevel, string>> = {\n \"ABBR\": {\n trace: \"TRC\",\n debug: \"DBG\",\n info: \"INF\",\n warning: \"WRN\",\n error: \"ERR\",\n fatal: \"FTL\",\n },\n \"L\": {\n trace: \"T\",\n debug: \"D\",\n info: \"I\",\n warning: \"W\",\n error: \"E\",\n fatal: \"F\",\n },\n \"abbr\": {\n trace: \"trc\",\n debug: \"dbg\",\n info: \"inf\",\n warning: \"wrn\",\n error: \"err\",\n fatal: \"ftl\",\n },\n \"l\": {\n trace: \"t\",\n debug: \"d\",\n info: \"i\",\n warning: \"w\",\n error: \"e\",\n fatal: \"f\",\n },\n };\n\n const formatLevel = (level: LogLevel): string => {\n if (typeof levelFormat === \"function\") {\n return levelFormat(level);\n }\n\n if (levelFormat === \"FULL\") return level.toUpperCase();\n if (levelFormat === \"full\") return level;\n\n return levelMappings[levelFormat]?.[level] ?? level;\n };\n\n const resolvedTimeZone = resolveTimeZone(timeZone);\n\n // Resolve timestamp formatter\n let timestampFn: ((ts: number) => string | null) | null = null;\n if (timestamp === \"none\" || timestamp === \"disabled\") {\n timestampFn = null;\n } else if (typeof timestamp === \"function\") {\n timestampFn = timestamp;\n } else {\n timestampFn = (ts: number): string => {\n if (timestamp === \"rfc3339\" && resolvedTimeZone.kind === \"utc\") {\n return new Date(ts).toISOString();\n }\n\n const parts = getDateParts(ts, resolvedTimeZone);\n const date = `${parts.year}-${parts.month}-${parts.day}`;\n const time = `${parts.hour}:${parts.minute}:${parts.second}.${parts.ms}`;\n const tzLong = formatOffset(parts.offsetMinutes, true);\n const tzShort = formatOffset(parts.offsetMinutes, false);\n\n if (timestamp === \"date-time-timezone\") {\n return `${date} ${time} ${tzLong}`;\n }\n if (timestamp === \"date-time-tz\") return `${date} ${time} ${tzShort}`;\n if (timestamp === \"date-time\") return `${date} ${time}`;\n if (timestamp === \"time-timezone\") return `${time} ${tzLong}`;\n if (timestamp === \"time-tz\") return `${time} ${tzShort}`;\n if (timestamp === \"time\") return time;\n if (timestamp === \"date\") return date;\n return `${date}T${time}${tzLong}`;\n };\n }\n\n // Configure word wrap settings\n const wordWrapEnabled = wordWrap !== false;\n let wordWrapWidth: number;\n\n if (typeof wordWrap === \"number\") {\n wordWrapWidth = wordWrap;\n } else if (wordWrap === true) {\n // Auto-detect terminal width\n wordWrapWidth = getOptimalWordWrapWidth(80);\n } else {\n wordWrapWidth = 80; // Default fallback\n }\n\n // Prepare category color patterns for matching\n const categoryPatterns = prepareCategoryPatterns(categoryColorMap);\n\n // Calculate level width based on format\n const allLevels: LogLevel[] = [...getLogLevels()];\n const levelWidth = Math.max(...allLevels.map((l) => formatLevel(l).length));\n\n return (record: LogRecord): string => {\n // Calculate the prefix parts first to determine message column position\n const icon = iconMap[record.level] || \"\";\n const level = formatLevel(record.level);\n const categoryStr = truncateCategory(\n sanitizeCategory == null\n ? record.category\n : record.category.map(sanitizeCategory),\n categoryWidth,\n categorySeparator,\n categoryTruncate,\n );\n\n // Format message with values - handle color reset/reapply for interpolated values\n let message = \"\";\n const messageColorCode = useColors ? colorToAnsi(messageColor) : \"\";\n const messageStyleCode = useColors ? styleToAnsi(messageStyle) : \"\";\n const messagePrefix = useColors\n ? `${messageStyleCode}${messageColorCode}`\n : \"\";\n\n for (let i = 0; i < record.message.length; i++) {\n if (i % 2 === 0) {\n const part = record.message[i] as string;\n message += sanitize == null ? part : sanitize(part);\n } else {\n const value = record.message[i];\n const inspected = inspect(value, {\n colors: useColors,\n ...resolvedInspectOptions,\n });\n\n // Handle multiline interpolated values properly\n if (inspected.includes(\"\\n\")) {\n const lines = inspected.split(\"\\n\");\n\n const formattedLines = lines.map((line, index) => {\n if (index === 0) {\n // First line: reset formatting, add the line, then reapply\n if (useColors && (messageColorCode || messageStyleCode)) {\n return `${RESET}${line}${messagePrefix}`;\n } else {\n return line;\n }\n } else {\n // Continuation lines: just apply formatting, let wrapText handle indentation\n if (useColors && (messageColorCode || messageStyleCode)) {\n return `${line}${messagePrefix}`;\n } else {\n return line;\n }\n }\n });\n message += formattedLines.join(\"\\n\");\n } else {\n // Single line - handle normally\n if (useColors && (messageColorCode || messageStyleCode)) {\n message += `${RESET}${inspected}${messagePrefix}`;\n } else {\n message += inspected;\n }\n }\n }\n }\n\n // Parts are already calculated above\n\n // Determine category color (with prefix matching)\n const finalCategoryColor = useColors\n ? (matchCategoryColor(record.category, categoryPatterns) || categoryColor)\n : null;\n\n // Apply colors and styling\n const formattedIcon = icon;\n let formattedLevel = level;\n let formattedCategory = categoryStr;\n let formattedMessage = message;\n let formattedTimestamp = \"\";\n\n if (useColors) {\n // Apply level color and style\n const levelColorCode = colorToAnsi(resolvedLevelColors[record.level]);\n const levelStyleCode = styleToAnsi(levelStyle);\n formattedLevel = `${levelStyleCode}${levelColorCode}${level}${RESET}`;\n\n // Apply category color and style (with prefix matching)\n const categoryColorCode = colorToAnsi(finalCategoryColor);\n const categoryStyleCode = styleToAnsi(categoryStyle);\n formattedCategory =\n `${categoryStyleCode}${categoryColorCode}${categoryStr}${RESET}`;\n\n // Apply message color and style (already handled in message building above)\n formattedMessage = `${messagePrefix}${message}${RESET}`;\n }\n\n // Format timestamp if needed\n if (timestampFn) {\n const ts = timestampFn(record.timestamp);\n if (ts !== null) {\n if (useColors) {\n const timestampColorCode = colorToAnsi(timestampColor);\n const timestampStyleCode = styleToAnsi(timestampStyle);\n formattedTimestamp =\n `${timestampStyleCode}${timestampColorCode}${ts}${RESET} `;\n } else {\n formattedTimestamp = `${ts} `;\n }\n }\n }\n\n // Build the final output with alignment\n if (align) {\n // Calculate padding accounting for ANSI escape sequences\n const levelColorLength = useColors\n ? (colorToAnsi(resolvedLevelColors[record.level]).length +\n styleToAnsi(levelStyle).length + RESET.length)\n : 0;\n const categoryColorLength = useColors\n ? (colorToAnsi(finalCategoryColor).length +\n styleToAnsi(categoryStyle).length + RESET.length)\n : 0;\n\n const paddedLevel = formattedLevel.padEnd(levelWidth + levelColorLength);\n const paddedCategory = formattedCategory.padEnd(\n categoryWidth + categoryColorLength,\n );\n\n let result =\n `${formattedTimestamp}${formattedIcon} ${paddedLevel} ${paddedCategory} ${formattedMessage}`;\n const indentWidth = getDisplayWidth(\n stripAnsi(\n `${formattedTimestamp}${formattedIcon} ${paddedLevel} ${paddedCategory} `,\n ),\n );\n\n // Apply word wrapping if enabled, or if there are multiline interpolated values\n if (wordWrapEnabled || message.includes(\"\\n\")) {\n result = wrapText(\n result,\n wordWrapEnabled ? wordWrapWidth : Infinity,\n indentWidth,\n );\n }\n\n if (properties) {\n result += formatProperties(\n record,\n indentWidth,\n wordWrapEnabled ? wordWrapWidth : Infinity,\n useColors,\n resolvedInspectOptions,\n );\n }\n\n return result + \"\\n\";\n } else {\n let result =\n `${formattedTimestamp}${formattedIcon} ${formattedLevel} ${formattedCategory} ${formattedMessage}`;\n const indentWidth = getDisplayWidth(\n stripAnsi(\n `${formattedTimestamp}${formattedIcon} ${formattedLevel} ${formattedCategory} `,\n ),\n );\n\n // Apply word wrapping if enabled, or if there are multiline interpolated values\n if (wordWrapEnabled || message.includes(\"\\n\")) {\n result = wrapText(\n result,\n wordWrapEnabled ? wordWrapWidth : Infinity,\n indentWidth,\n );\n }\n\n if (properties) {\n result += formatProperties(\n record,\n indentWidth,\n wordWrapEnabled ? wordWrapWidth : Infinity,\n useColors,\n resolvedInspectOptions,\n );\n }\n\n return result + \"\\n\";\n }\n };\n}\n\nfunction formatProperties(\n record: LogRecord,\n indentWidth: number,\n maxWidth: number,\n useColors: boolean,\n inspectOptions: InspectOptions,\n): string {\n let result = \"\";\n for (const prop in record.properties) {\n const propValue = record.properties[prop];\n // Ensure padding is never negative\n const pad = Math.max(0, indentWidth - getDisplayWidth(prop) - 2);\n result += \"\\n\" + wrapText(\n `${\" \".repeat(pad)}${useColors ? DIM : \"\"}${prop}:${\n useColors ? RESET : \"\"\n } ${inspect(propValue, { colors: useColors, ...inspectOptions })}`,\n maxWidth,\n indentWidth,\n );\n }\n return result;\n}\n\n/**\n * A pre-configured beautiful console formatter for local development.\n *\n * This is a ready-to-use instance of the pretty formatter with sensible defaults\n * for most development scenarios. It provides immediate visual enhancement to\n * your logs without requiring any configuration.\n *\n * Features enabled by default:\n * - Emoji icons for all log levels\n * - True color support with rich color schemes\n * - Dimmed text styling for better readability\n * - Smart category truncation (20 characters max)\n * - Perfect column alignment\n * - No timestamp display (cleaner for development)\n *\n * For custom configuration, use {@link getPrettyFormatter} instead.\n *\n * @example\n * ```typescript\n * import { configure } from \"@logtape/logtape\";\n * import { getConsoleSink } from \"@logtape/logtape/sink\";\n * import { prettyFormatter } from \"@logtape/pretty\";\n *\n * await configure({\n * sinks: {\n * console: getConsoleSink({\n * formatter: prettyFormatter\n * })\n * }\n * });\n * ```\n *\n * @since 1.0.0\n */\nexport const prettyFormatter: TextFormatter = getPrettyFormatter();\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,QAAQ;AACd,MAAM,MAAM;AAGZ,MAAM,gBAAgB;CACpB,OAAO;CACP,OAAO;CACP,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,UAAU;CACV,SAAS;CACT,WAAW;AACZ;;;;AAKD,MAAM,SAAS;CACb,OAAO;CACP,MAAM;CACN,KAAK;CACL,QAAQ;CACR,WAAW;CACX,eAAe;AAChB;;;;AAKD,MAAM,aAAa;CACjB,OAAO;CACP,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;AACR;AA4CD,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,MAAM,uBAAuB;;;;AAK7B,SAAS,YAAYA,OAAsB;AACzC,KAAI,UAAU,KAAM,QAAO;AAC3B,KAA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AAgB,EAAC,CAAC,GACjE,UACA,YACD;CACF;AACD,QAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCD,MAAaC,kBAAiC,oBAAoB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logtape/pretty",
3
- "version": "2.2.9",
3
+ "version": "2.2.10",
4
4
  "description": "Beautiful text formatter for LogTape—perfect for local development",
5
5
  "keywords": [
6
6
  "logging",
@@ -78,7 +78,7 @@
78
78
  "dist/"
79
79
  ],
80
80
  "peerDependencies": {
81
- "@logtape/logtape": "^2.2.9"
81
+ "@logtape/logtape": "^2.2.10"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@alinea/suite": "^0.6.3",