Home / Function/ url() — astro Function Reference

url() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5e77fab8_ebaf_d654_083a_13806d7099b1["url()"]
  cb9f7e72_0a2c_f337_8c0f_3a16cbafeab3["experimental_AstroContainer"]
  5e77fab8_ebaf_d654_083a_13806d7099b1 -->|defined in| cb9f7e72_0a2c_f337_8c0f_3a16cbafeab3
  style 5e77fab8_ebaf_d654_083a_13806d7099b1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/container/index.ts lines 581–606

	#createRoute(url: URL, params: Record<string, string | undefined>, type: RouteType): RouteData {
		const segments = removeLeadingForwardSlash(url.pathname)
			.split(posix.sep)
			.filter(Boolean)
			.map((s: string) => {
				validateSegment(s);
				return getParts(s, url.pathname);
			});
		return {
			route: url.pathname,
			component: '',
			params: Object.keys(params),
			pattern: getPattern(
				segments,
				ASTRO_CONFIG_DEFAULTS.base,
				ASTRO_CONFIG_DEFAULTS.trailingSlash,
			),
			prerender: false,
			segments,
			type,
			fallbackRoutes: [],
			isIndex: false,
			origin: 'internal',
			distURL: [],
		};
	}

Domain

Subdomains

Frequently Asked Questions

What does url() do?
url() is a function in the astro codebase, defined in packages/astro/src/container/index.ts.
Where is url() defined?
url() is defined in packages/astro/src/container/index.ts at line 581.

Analyze Your Own Codebase

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

Try Supermodel Free