Home / Function/ validateSetAdapter() — astro Function Reference

validateSetAdapter() — astro Function Reference

Architecture documentation for the validateSetAdapter() function in adapter-validation.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  48a2467f_d725_4b36_b77e_f64457f5f044["validateSetAdapter()"]
  3505fa2b_e453_959a_1c3e_5d3e5935e4cf["adapter-validation.ts"]
  48a2467f_d725_4b36_b77e_f64457f5f044 -->|defined in| 3505fa2b_e453_959a_1c3e_5d3e5935e4cf
  style 48a2467f_d725_4b36_b77e_f64457f5f044 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/dev/adapter-validation.ts lines 20–50

export function validateSetAdapter(
	logger: Logger,
	settings: AstroSettings,
	adapter: AstroAdapter,
	maybeConflictingIntegration: string,
	command?: 'dev' | 'build' | string,
) {
	if (settings.adapter && settings.adapter.name !== adapter.name) {
		throw new Error(
			`Integration "${maybeConflictingIntegration}" conflicts with "${settings.adapter.name}". You can only configure one deployment integration.`,
		);
	}

	if (settings.buildOutput === 'server' && adapter.adapterFeatures?.buildOutput === 'static') {
		// If the adapter is not compatible with the build output, throw an error
		if (command === 'build') {
			const adapterRecommendation = getAdapterStaticRecommendation(adapter.name);

			throw new AstroError({
				...AstroErrorData.AdapterSupportOutputMismatch,
				message: AstroErrorData.AdapterSupportOutputMismatch.message(adapter.name),
				hint: adapterRecommendation ? adapterRecommendation : undefined,
			});
		} else if (command === 'dev') {
			logger.warn(
				null,
				`The adapter ${adapter.name} does not support emitting a server output, but the project contain server-rendered pages. Your project will not build correctly.`,
			);
		}
	}
}

Domain

Subdomains

Frequently Asked Questions

What does validateSetAdapter() do?
validateSetAdapter() is a function in the astro codebase, defined in packages/astro/src/core/dev/adapter-validation.ts.
Where is validateSetAdapter() defined?
validateSetAdapter() is defined in packages/astro/src/core/dev/adapter-validation.ts at line 20.

Analyze Your Own Codebase

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

Try Supermodel Free