Home / Class/ CliAstroConfigResolver Class — astro Architecture

CliAstroConfigResolver Class — astro Architecture

Architecture documentation for the CliAstroConfigResolver class in cli-astro-config-resolver.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  9e39aa2c_4500_e5c8_b4fa_f99a707fe853["CliAstroConfigResolver"]
  1aaedba5_1fb6_804c_dc52_1d6ee0080168["cli-astro-config-resolver.ts"]
  9e39aa2c_4500_e5c8_b4fa_f99a707fe853 -->|defined in| 1aaedba5_1fb6_804c_dc52_1d6ee0080168
  236ffa85_e645_7372_0f64_858187a0c65b["constructor()"]
  9e39aa2c_4500_e5c8_b4fa_f99a707fe853 -->|method| 236ffa85_e645_7372_0f64_858187a0c65b
  12fe272b_32c6_d54d_ffe8_ef9dc2577678["resolve()"]
  9e39aa2c_4500_e5c8_b4fa_f99a707fe853 -->|method| 12fe272b_32c6_d54d_ffe8_ef9dc2577678

Relationship Graph

Source Code

packages/astro/src/cli/info/infra/cli-astro-config-resolver.ts lines 5–51

export class CliAstroConfigResolver implements AstroConfigResolver {
	// TODO: find something better
	readonly #flags: Flags;

	constructor({ flags }: { flags: Flags }) {
		this.#flags = flags;
	}

	async resolve(): Promise<AstroConfig> {
		const { astroConfig } = await resolveConfig(
			// TODO: consider testing flags => astro inline config
			{
				// Inline-only configs
				configFile: typeof this.#flags.config === 'string' ? this.#flags.config : undefined,
				mode: typeof this.#flags.mode === 'string' ? this.#flags.mode : undefined,
				logLevel: this.#flags.verbose ? 'debug' : this.#flags.silent ? 'silent' : undefined,
				force: this.#flags.force ? true : undefined,

				// Astro user configs
				root: typeof this.#flags.root === 'string' ? this.#flags.root : undefined,
				site: typeof this.#flags.site === 'string' ? this.#flags.site : undefined,
				base: typeof this.#flags.base === 'string' ? this.#flags.base : undefined,
				outDir: typeof this.#flags.outDir === 'string' ? this.#flags.outDir : undefined,
				server: {
					port: typeof this.#flags.port === 'number' ? this.#flags.port : undefined,
					host:
						typeof this.#flags.host === 'string' || typeof this.#flags.host === 'boolean'
							? this.#flags.host
							: undefined,
					open:
						typeof this.#flags.open === 'string' || typeof this.#flags.open === 'boolean'
							? this.#flags.open
							: undefined,
					allowedHosts:
						typeof this.#flags.allowedHosts === 'string'
							? this.#flags.allowedHosts.split(',')
							: typeof this.#flags.allowedHosts === 'boolean' && this.#flags.allowedHosts === true
								? this.#flags.allowedHosts
								: [],
				},
			},
			'info',
		);

		return astroConfig;
	}
}

Domain

Frequently Asked Questions

What is the CliAstroConfigResolver class?
CliAstroConfigResolver is a class in the astro codebase, defined in packages/astro/src/cli/info/infra/cli-astro-config-resolver.ts.
Where is CliAstroConfigResolver defined?
CliAstroConfigResolver is defined in packages/astro/src/cli/info/infra/cli-astro-config-resolver.ts at line 5.

Analyze Your Own Codebase

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

Try Supermodel Free