Home / Class/ StyledDebugInfoFormatter Class — astro Architecture

StyledDebugInfoFormatter Class — astro Architecture

Architecture documentation for the StyledDebugInfoFormatter class in styled-debug-info-formatter.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  e935bb26_e37d_7e42_caaa_3d4d360a9050["StyledDebugInfoFormatter"]
  b39e0d10_b615_fcd4_38c5_bbdfbe16dcf4["styled-debug-info-formatter.ts"]
  e935bb26_e37d_7e42_caaa_3d4d360a9050 -->|defined in| b39e0d10_b615_fcd4_38c5_bbdfbe16dcf4
  837aa7e8_2a06_a17c_95e3_90a5f2a2db4d["constructor()"]
  e935bb26_e37d_7e42_caaa_3d4d360a9050 -->|method| 837aa7e8_2a06_a17c_95e3_90a5f2a2db4d
  e96a9692_9e35_2800_a2d4_28674727a633["format()"]
  e935bb26_e37d_7e42_caaa_3d4d360a9050 -->|method| e96a9692_9e35_2800_a2d4_28674727a633

Relationship Graph

Source Code

packages/astro/src/cli/info/infra/styled-debug-info-formatter.ts lines 5–33

export class StyledDebugInfoFormatter implements DebugInfoFormatter {
	readonly #textStyler: TextStyler;
	readonly #maxPadding: number = 25;

	constructor({
		textStyler,
	}: {
		textStyler: TextStyler;
	}) {
		this.#textStyler = textStyler;
	}

	format(info: DebugInfo): string {
		let output = '';
		for (const [label, value] of info) {
			const padding = this.#maxPadding - label.length;
			const [first, ...rest] = Array.isArray(value) ? value : [value];
			let richtext = `\n${this.#textStyler.bold(label)}${' '.repeat(padding)}${this.#textStyler.green(first)}`;
			if (rest.length > 0) {
				for (const entry of rest) {
					richtext += `\n${' '.repeat(this.#maxPadding)}${this.#textStyler.green(entry)}`;
				}
			}
			output += richtext;
		}

		return output.trim();
	}
}

Domain

Frequently Asked Questions

What is the StyledDebugInfoFormatter class?
StyledDebugInfoFormatter is a class in the astro codebase, defined in packages/astro/src/cli/info/infra/styled-debug-info-formatter.ts.
Where is StyledDebugInfoFormatter defined?
StyledDebugInfoFormatter is defined in packages/astro/src/cli/info/infra/styled-debug-info-formatter.ts at line 5.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free