uiOutput
Which of the web UI's output tcm serve shows, a chunk at a time: what it says when it starts, stops or something
fails (with the stack that says where), and pages that took a second or more to render, not every page it renders.
A line split between chunks is judged whole.
export function uiOutput(): (chunk: string) => string[] { let rest = ""; let stack = false; return (chunk) => { const lines = (rest + chunk).split("\n"); rest = lines.pop()!; const shown: string[] = []; for (const line of lines) { if (stack && /^\s+at /.test(line)) { shown.push(` ${line.trim()}`); continue; } stack = false; if ( (/\burl\b|error|fail|warn/i.test(line) || /(?<!\d)\d{4,}ms\b/.test(line)) && !/shell none/.test(line) ) { shown.push(line.trim()); stack = /error|fail/i.test(line); } } return shown; }; }