Home / Function/ format() — astro Function Reference

format() — astro Function Reference

Architecture documentation for the format() function in styled-debug-info-formatter.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  e96a9692_9e35_2800_a2d4_28674727a633["format()"]
  e935bb26_e37d_7e42_caaa_3d4d360a9050["StyledDebugInfoFormatter"]
  e96a9692_9e35_2800_a2d4_28674727a633 -->|defined in| e935bb26_e37d_7e42_caaa_3d4d360a9050
  style e96a9692_9e35_2800_a2d4_28674727a633 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/cli/info/infra/styled-debug-info-formatter.ts lines 17–32

	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

Subdomains

Frequently Asked Questions

What does format() do?
format() is a function in the astro codebase, defined in packages/astro/src/cli/info/infra/styled-debug-info-formatter.ts.
Where is format() defined?
format() is defined in packages/astro/src/cli/info/infra/styled-debug-info-formatter.ts at line 17.

Analyze Your Own Codebase

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

Try Supermodel Free