Home / Function/ headElements() — astro Function Reference

headElements() — astro Function Reference

Architecture documentation for the headElements() function in pipeline.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b6e71592_ae2d_e816_9222_62e56a8e10bb["headElements()"]
  7feea19b_1eb1_3680_d050_0ea7bb95b6d3["ContainerPipeline"]
  b6e71592_ae2d_e816_9222_62e56a8e10bb -->|defined in| 7feea19b_1eb1_3680_d050_0ea7bb95b6d3
  style b6e71592_ae2d_e816_9222_62e56a8e10bb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/container/pipeline.ts lines 38–57

	headElements(routeData: RouteData): Promise<HeadElements> | HeadElements {
		const routeInfo = this.manifest.routes.find((route) => route.routeData === routeData);
		const links = new Set<never>();
		const scripts = new Set<SSRElement>();
		const styles = createStylesheetElementSet(routeInfo?.styles ?? []);

		for (const script of routeInfo?.scripts ?? []) {
			if ('stage' in script) {
				if (script.stage === 'head-inline') {
					scripts.add({
						props: {},
						children: script.children,
					});
				}
			} else {
				scripts.add(createModuleScriptElement(script));
			}
		}
		return { links, styles, scripts };
	}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free