Home / Function/ serverStart() — astro Function Reference

serverStart() — astro Function Reference

Architecture documentation for the serverStart() function in messages.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  610fc112_c1c3_f5b8_a676_7b1c5faf2b7d["serverStart()"]
  a89de736_d85a_fc8a_68a9_5d9ea54128d5["messages.ts"]
  610fc112_c1c3_f5b8_a676_7b1c5faf2b7d -->|defined in| a89de736_d85a_fc8a_68a9_5d9ea54128d5
  23f4c0bf_3ed5_1a85_1779_9fdc151e6f21["getNetworkLogging()"]
  610fc112_c1c3_f5b8_a676_7b1c5faf2b7d -->|calls| 23f4c0bf_3ed5_1a85_1779_9fdc151e6f21
  style 610fc112_c1c3_f5b8_a676_7b1c5faf2b7d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/messages.ts lines 35–79

export function serverStart({
	startupTime,
	resolvedUrls,
	host,
	base,
}: {
	startupTime: number;
	resolvedUrls: ResolvedServerUrls;
	host: string | boolean;
	base: string;
}): string {
	// PACKAGE_VERSION is injected at build-time
	const version = process.env.PACKAGE_VERSION ?? '0.0.0';
	const localPrefix = `${dim('┃')} Local    `;
	const networkPrefix = `${dim('┃')} Network  `;
	const emptyPrefix = ' '.repeat(11);

	const localUrlMessages = resolvedUrls.local.map((url, i) => {
		return `${i === 0 ? localPrefix : emptyPrefix}${cyan(new URL(url).origin + base)}`;
	});
	const networkUrlMessages = resolvedUrls.network.map((url, i) => {
		return `${i === 0 ? networkPrefix : emptyPrefix}${cyan(new URL(url).origin + base)}`;
	});

	if (networkUrlMessages.length === 0) {
		const networkLogging = getNetworkLogging(host);
		if (networkLogging === 'host-to-expose') {
			networkUrlMessages.push(`${networkPrefix}${dim('use --host to expose')}`);
		} else if (networkLogging === 'visible') {
			networkUrlMessages.push(`${networkPrefix}${dim('unable to find network to expose')}`);
		}
	}

	const messages = [
		'',
		`${bgGreen(bold(` astro `))} ${green(`v${version}`)} ${dim(`ready in`)} ${Math.round(
			startupTime,
		)} ${dim('ms')}`,
		'',
		...localUrlMessages,
		...networkUrlMessages,
		'',
	];
	return messages.filter((msg) => typeof msg === 'string').join('\n');
}

Domain

Subdomains

Frequently Asked Questions

What does serverStart() do?
serverStart() is a function in the astro codebase, defined in packages/astro/src/core/messages.ts.
Where is serverStart() defined?
serverStart() is defined in packages/astro/src/core/messages.ts at line 35.
What does serverStart() call?
serverStart() calls 1 function(s): getNetworkLogging.

Analyze Your Own Codebase

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

Try Supermodel Free