Home / Function/ getParts() — astro Function Reference

getParts() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  47a1f327_a4c1_9abf_7757_611071f34980["getParts()"]
  2eae0c6b_820a_2609_b99a_dfcd5eb248a7["redirects.ts"]
  47a1f327_a4c1_9abf_7757_611071f34980 -->|defined in| 2eae0c6b_820a_2609_b99a_dfcd5eb248a7
  1af7fd3e_e678_b33e_6570_2ec1ee608783["escapeRegex()"]
  1af7fd3e_e678_b33e_6570_2ec1ee608783 -->|calls| 47a1f327_a4c1_9abf_7757_611071f34980
  style 47a1f327_a4c1_9abf_7757_611071f34980 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/vercel/src/lib/redirects.ts lines 13–33

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

Called By

Frequently Asked Questions

What does getParts() do?
getParts() is a function in the astro codebase, defined in packages/integrations/vercel/src/lib/redirects.ts.
Where is getParts() defined?
getParts() is defined in packages/integrations/vercel/src/lib/redirects.ts at line 13.
What calls getParts()?
getParts() is called by 1 function(s): escapeRegex.

Analyze Your Own Codebase

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

Try Supermodel Free