Buckets:
| // Copyright (c) 2026 the Zuke contributors | |
| // SPDX-License-Identifier: MIT | |
| /** | |
| * A {@link Renderer} implementation a build injects via | |
| * `run(Build, { renderer: consoleRenderer })`, so the executor's per-target | |
| * banners and end-of-build summary are drawn by `@zuke/console` — Zuke | |
| * dogfooding its own output package. | |
| * | |
| * The target header is themed (its colour comes from the {@link Theme}); the | |
| * footers, summary table, and job-summary Markdown reuse Zuke's canonical | |
| * `defaultRenderer`, so the output stays identical to a plain build unless a | |
| * custom theme changes it. {@link createConsoleRenderer} builds one for a given | |
| * palette. | |
| * | |
| * @module | |
| */ | |
| import { defaultRenderer, type Renderer } from "@zuke/core"; | |
| import { escapeData, line, type Style, stylize } from "@zuke/core/render"; | |
| import { defaultTheme, type Theme } from "./theme.ts"; | |
| /** The ruled, theme-coloured banner that opens a target's section. */ | |
| function themedHeader(theme: Theme, style: Style, name: string): string[] { | |
| // A command body, like core's own group header — so it takes `escapeData`, | |
| // not `escapeLine`. The name is a target's, which for a fan-out carries an | |
| // item key, and this header is emitted BEFORE the body: a suspend directive | |
| // here would disarm everything the target goes on to print. | |
| if (style.github) return [`::group::${escapeData(name)}`]; | |
| const rule = line(style); | |
| const label = stylize(style.color, ["bold", ...theme.info], name); | |
| return [rule, label, rule]; | |
| } | |
| /** Build a {@link Renderer} that draws target headers with `theme`'s palette. */ | |
| export function createConsoleRenderer(theme: Theme = defaultTheme): Renderer { | |
| return { | |
| targetHeader: (style, name) => themedHeader(theme, style, name), | |
| targetPassFooter: (style, name, ms) => | |
| defaultRenderer.targetPassFooter(style, name, ms), | |
| targetFailFooter: (style, name, ms, error) => | |
| defaultRenderer.targetFailFooter(style, name, ms, error), | |
| targetDryRunFooter: (style, name) => | |
| defaultRenderer.targetDryRunFooter(style, name), | |
| summaryBlock: (style, reports, totalMs, ok) => | |
| defaultRenderer.summaryBlock(style, reports, totalMs, ok), | |
| jobSummaryMarkdown: (reports, totalMs, ok) => | |
| defaultRenderer.jobSummaryMarkdown(reports, totalMs, ok), | |
| }; | |
| } | |
| /** The default console renderer, using {@link defaultTheme}. */ | |
| export const consoleRenderer: Renderer = createConsoleRenderer(); | |
Xet Storage Details
- Size:
- 2.42 kB
- Xet hash:
- dedceccbf156022025597a0f1dd38897b1b936d587a4c561a51714b8189d1696
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.