Home / Function/ vitePluginAdapterConfig() — astro Function Reference

vitePluginAdapterConfig() — astro Function Reference

Architecture documentation for the vitePluginAdapterConfig() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  03a067fb_e258_6088_3be8_5df4b4bb0e31["vitePluginAdapterConfig()"]
  2893338f_80b8_6eb0_6b0f_293104b9f955["index.ts"]
  03a067fb_e258_6088_3be8_5df4b4bb0e31 -->|defined in| 2893338f_80b8_6eb0_6b0f_293104b9f955
  style 03a067fb_e258_6088_3be8_5df4b4bb0e31 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/vite-plugin-adapter-config/index.ts lines 9–49

export function vitePluginAdapterConfig(settings: AstroSettings): VitePlugin {
	return {
		name: 'astro:adapter-config',
		resolveId: {
			filter: {
				id: new RegExp(`^${VIRTUAL_CLIENT_ID}$`),
			},
			handler() {
				return RESOLVED_VIRTUAL_CLIENT_ID;
			},
		},
		load: {
			filter: {
				id: new RegExp(`^${RESOLVED_VIRTUAL_CLIENT_ID}$`),
			},
			handler() {
				// During SSR, return empty headers to avoid any runtime issues
				if (isAstroServerEnvironment(this.environment)) {
					return {
						code: `export const internalFetchHeaders = {};`,
					};
				}

				const adapter = settings.adapter;
				const clientConfig = adapter?.client || {};

				let internalFetchHeaders = {};
				if (clientConfig.internalFetchHeaders) {
					internalFetchHeaders =
						typeof clientConfig.internalFetchHeaders === 'function'
							? clientConfig.internalFetchHeaders()
							: clientConfig.internalFetchHeaders;
				}

				return {
					code: `export const internalFetchHeaders = ${JSON.stringify(internalFetchHeaders)};`,
				};
			},
		},
	};
}

Domain

Subdomains

Frequently Asked Questions

What does vitePluginAdapterConfig() do?
vitePluginAdapterConfig() is a function in the astro codebase, defined in packages/astro/src/vite-plugin-adapter-config/index.ts.
Where is vitePluginAdapterConfig() defined?
vitePluginAdapterConfig() is defined in packages/astro/src/vite-plugin-adapter-config/index.ts at line 9.

Analyze Your Own Codebase

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

Try Supermodel Free