Home / File/ styled-debug-info-formatter.ts — astro Source File

styled-debug-info-formatter.ts — astro Source File

Architecture documentation for styled-debug-info-formatter.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  c3fdb829_4771_f998_c45f_c79ec8df34fa["styled-debug-info-formatter.ts"]
  6cbd3778_88f7_1129_b02f_ecccc3255c91["../definitions.js"]
  c3fdb829_4771_f998_c45f_c79ec8df34fa --> 6cbd3778_88f7_1129_b02f_ecccc3255c91
  828137f0_810b_f3ff_b4a3_8557af46e5d3["../definitions.js"]
  c3fdb829_4771_f998_c45f_c79ec8df34fa --> 828137f0_810b_f3ff_b4a3_8557af46e5d3
  2013de04_ccc8_8ec9_4fb7_21c70acef91b["../domain/debug-info.js"]
  c3fdb829_4771_f998_c45f_c79ec8df34fa --> 2013de04_ccc8_8ec9_4fb7_21c70acef91b
  style c3fdb829_4771_f998_c45f_c79ec8df34fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { TextStyler } from '../../definitions.js';
import type { DebugInfoFormatter } from '../definitions.js';
import type { DebugInfo } from '../domain/debug-info.js';

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

Subdomains

Dependencies

  • ../definitions.js
  • ../definitions.js
  • ../domain/debug-info.js

Frequently Asked Questions

What does styled-debug-info-formatter.ts do?
styled-debug-info-formatter.ts is a source file in the astro codebase, written in typescript. It belongs to the FrameworkCore domain, IntegrationHooks subdomain.
What does styled-debug-info-formatter.ts depend on?
styled-debug-info-formatter.ts imports 3 module(s): ../definitions.js, ../definitions.js, ../domain/debug-info.js.
Where is styled-debug-info-formatter.ts in the architecture?
styled-debug-info-formatter.ts is located at packages/astro/src/cli/info/infra/styled-debug-info-formatter.ts (domain: FrameworkCore, subdomain: IntegrationHooks, directory: packages/astro/src/cli/info/infra).

Analyze Your Own Codebase

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

Try Supermodel Free