Home / Function/ getRuntime() — astro Function Reference

getRuntime() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a467a0cd_4b15_3606_2e3f_c1e45c9350d7["getRuntime()"]
  9b72c5c7_3349_4acd_8ca1_afe541842abe["index.ts"]
  a467a0cd_4b15_3606_2e3f_c1e45c9350d7 -->|defined in| 9b72c5c7_3349_4acd_8ca1_afe541842abe
  a67662ae_0ef1_3f96_3043_23c8c4f1cd11["constructor()"]
  a67662ae_0ef1_3f96_3043_23c8c4f1cd11 -->|calls| a467a0cd_4b15_3606_2e3f_c1e45c9350d7
  style a467a0cd_4b15_3606_2e3f_c1e45c9350d7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/vercel/src/index.ts lines 729–769

function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Runtime {
	const version = process.version.slice(1); // 'v18.19.0' --> '18.19.0'
	const major = version.split('.')[0]; // '18.19.0' --> '18'
	const support = SUPPORTED_NODE_VERSIONS[major];
	if (support === undefined) {
		logger.warn(
			`\n` +
				`\tThe local Node.js version (${major}) is not supported by Vercel Serverless Functions.\n` +
				`\tYour project will use Node.js 24 as the runtime instead.\n` +
				`\tConsider switching your local version to 24.\n`,
		);
		return 'nodejs24.x';
	}
	if (support.status === 'default' || support.status === 'available') {
		return `nodejs${major}.x`;
	}
	if (support.status === 'retiring') {
		if (support.warnDate && new Date() >= support.warnDate) {
			logger.warn(
				`Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.`,
			);
		}
		return `nodejs${major}.x`;
	}
	if (support.status === 'beta') {
		logger.warn(
			`Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.`,
		);
		return `nodejs${major}.x`;
	}
	if (support.status === 'deprecated') {
		logger.warn(
			`\n` +
				`\tYour project is being built for Node.js ${major} as the runtime.\n` +
				`\tThis version is deprecated by Vercel Serverless Functions.\n` +
				`\tConsider upgrading your local version to 24.\n`,
		);
		return `nodejs${major}.x`;
	}
	return 'nodejs24.x';
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getRuntime() do?
getRuntime() is a function in the astro codebase, defined in packages/integrations/vercel/src/index.ts.
Where is getRuntime() defined?
getRuntime() is defined in packages/integrations/vercel/src/index.ts at line 729.
What calls getRuntime()?
getRuntime() is called by 1 function(s): constructor.

Analyze Your Own Codebase

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

Try Supermodel Free