Home / Function/ runHookServerSetup() — astro Function Reference

runHookServerSetup() — astro Function Reference

Architecture documentation for the runHookServerSetup() function in hooks.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  2142ce6a_584b_4a1e_0cf7_3de445c9b816["runHookServerSetup()"]
  19f4084c_157f_a15d_f001_5d8088b75dee["hooks.ts"]
  2142ce6a_584b_4a1e_0cf7_3de445c9b816 -->|defined in| 19f4084c_157f_a15d_f001_5d8088b75dee
  1e1ca282_3771_2cb3_ede6_ff5ab0d382fa["runHookInternal()"]
  2142ce6a_584b_4a1e_0cf7_3de445c9b816 -->|calls| 1e1ca282_3771_2cb3_ede6_ff5ab0d382fa
  50c56fe8_d5b1_e583_7d3a_bd54264081e1["getToolbarServerCommunicationHelpers()"]
  2142ce6a_584b_4a1e_0cf7_3de445c9b816 -->|calls| 50c56fe8_d5b1_e583_7d3a_bd54264081e1
  style 2142ce6a_584b_4a1e_0cf7_3de445c9b816 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/integrations/hooks.ts lines 422–459

export async function runHookServerSetup({
	config,
	server,
	logger,
}: {
	config: AstroConfig;
	server: ViteDevServer;
	logger: Logger;
}) {
	let refreshContent: undefined | ((options: RefreshContentOptions) => Promise<void>);
	refreshContent = async (options: RefreshContentOptions) => {
		const contentConfig = globalContentConfigObserver.get();
		if (
			contentConfig.status !== 'loaded' ||
			!Object.values(contentConfig.config.collections).some(
				(collection) => collection.type === CONTENT_LAYER_TYPE,
			)
		) {
			return;
		}

		const contentLayer = await globalContentLayer.get();
		await contentLayer?.sync(options);
	};

	for (const integration of config.integrations) {
		await runHookInternal({
			integration,
			hookName: 'astro:server:setup',
			logger,
			params: () => ({
				server,
				toolbar: getToolbarServerCommunicationHelpers(server),
				refreshContent,
			}),
		});
	}
}

Domain

Subdomains

Frequently Asked Questions

What does runHookServerSetup() do?
runHookServerSetup() is a function in the astro codebase, defined in packages/astro/src/integrations/hooks.ts.
Where is runHookServerSetup() defined?
runHookServerSetup() is defined in packages/astro/src/integrations/hooks.ts at line 422.
What does runHookServerSetup() call?
runHookServerSetup() calls 2 function(s): getToolbarServerCommunicationHelpers, runHookInternal.

Analyze Your Own Codebase

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

Try Supermodel Free