Home / Function/ getParts() — astro Function Reference

getParts() — astro Function Reference

Architecture documentation for the getParts() function in parts.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  793799cf_8213_0c63_ded8_06eb3210feca["getParts()"]
  a187bc83_25df_e68d_7c2d_fcb621a152c2["parts.ts"]
  793799cf_8213_0c63_ded8_06eb3210feca -->|defined in| a187bc83_25df_e68d_7c2d_fcb621a152c2
  style 793799cf_8213_0c63_ded8_06eb3210feca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/routing/manifest/parts.ts lines 8–28

export function getParts(part: string, file: string) {
	const result: RoutePart[] = [];
	part.split(ROUTE_DYNAMIC_SPLIT).map((str, i) => {
		if (!str) return;
		const dynamic = i % 2 === 1;

		const [, content] = dynamic ? /([^(]+)$/.exec(str) || [null, null] : [null, str];

		if (!content || (dynamic && !/^(?:\.\.\.)?[\w$]+$/.test(content))) {
			throw new Error(`Invalid route ${file} — parameter name must match /^[a-zA-Z0-9_$]+$/`);
		}

		result.push({
			content,
			dynamic,
			spread: dynamic && ROUTE_SPREAD.test(content),
		});
	});

	return result;
}

Domain

Subdomains

Frequently Asked Questions

What does getParts() do?
getParts() is a function in the astro codebase, defined in packages/astro/src/core/routing/manifest/parts.ts.
Where is getParts() defined?
getParts() is defined in packages/astro/src/core/routing/manifest/parts.ts at line 8.

Analyze Your Own Codebase

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

Try Supermodel Free