Files
IOT_WEB/node_modules/nostics/dist/formatters/ansi.mjs.map
T
2026-08-21 15:27:51 +08:00

1 line
1.7 KiB
Plaintext

{"version":3,"file":"ansi.mjs","names":[],"sources":["../../src/formatters/ansi.ts"],"sourcesContent":["import type { Diagnostic } from '../diagnostic'\n\nexport interface Colors {\n red: (s: string) => string\n yellow: (s: string) => string\n cyan: (s: string) => string\n gray: (s: string) => string\n bold: (s: string) => string\n dim: (s: string) => string\n}\n\n/* @__NO_SIDE_EFFECTS__ */\nexport function ansiFormatter(colors: Colors): (d: Diagnostic) => string {\n return (d) => {\n const tag = colors.bold(colors.red(`[${d.name}]`))\n const header = `${tag} ${d.message}`\n\n const details: string[] = []\n if (d.fix)\n details.push(`${colors.dim('fix:')} ${d.fix}`)\n if (d.sources?.length)\n details.push(`${colors.dim('sources:')} ${d.sources.join(', ')}`)\n if (d.docs)\n details.push(`${colors.dim('see:')} ${colors.cyan(d.docs)}`)\n\n if (details.length === 0)\n return header\n\n const lines = details.map((detail, i) => {\n const connector = colors.dim(i < details.length - 1 ? '├▶' : '╰▶')\n return `${connector} ${detail}`\n })\n return [header, ...lines].join('\\n')\n }\n}\n"],"mappings":";;AAYA,SAAgB,cAAc,QAA2C;CACvE,QAAQ,MAAM;EAEZ,MAAM,SAAS,GADH,OAAO,KAAK,OAAO,IAAI,IAAI,EAAE,KAAK,EAAE,CAC5B,EAAE,GAAG,EAAE;EAE3B,MAAM,UAAoB,CAAC;EAC3B,IAAI,EAAE,KACJ,QAAQ,KAAK,GAAG,OAAO,IAAI,MAAM,EAAE,GAAG,EAAE,KAAK;EAC/C,IAAI,EAAE,SAAS,QACb,QAAQ,KAAK,GAAG,OAAO,IAAI,UAAU,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,GAAG;EAClE,IAAI,EAAE,MACJ,QAAQ,KAAK,GAAG,OAAO,IAAI,MAAM,EAAE,GAAG,OAAO,KAAK,EAAE,IAAI,GAAG;EAE7D,IAAI,QAAQ,WAAW,GACrB,OAAO;EAMT,OAAO,CAAC,QAAQ,GAJF,QAAQ,KAAK,QAAQ,MAAM;GAEvC,OAAO,GADW,OAAO,IAAI,IAAI,QAAQ,SAAS,IAAI,OAAO,IAC3C,EAAE,GAAG;EACzB,CACuB,CAAC,CAAC,CAAC,KAAK,IAAI;CACrC;AACF"}