Home / Class/ NonRunnablePipeline Class — astro Architecture

NonRunnablePipeline Class — astro Architecture

Architecture documentation for the NonRunnablePipeline class in pipeline.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  1856d10d_49b6_d49e_0f37_cbee2beb3083["NonRunnablePipeline"]
  51b278d5_a895_65bb_f125_920d5fb11dbb["pipeline.ts"]
  1856d10d_49b6_d49e_0f37_cbee2beb3083 -->|defined in| 51b278d5_a895_65bb_f125_920d5fb11dbb
  be549b0b_e65a_6ba7_a056_81aca94646d2["getName()"]
  1856d10d_49b6_d49e_0f37_cbee2beb3083 -->|method| be549b0b_e65a_6ba7_a056_81aca94646d2
  ceb10880_ddf7_23bd_aeb0_045f941a4e13["create()"]
  1856d10d_49b6_d49e_0f37_cbee2beb3083 -->|method| ceb10880_ddf7_23bd_aeb0_045f941a4e13
  d438c0b2_133e_5c3c_c6e2_2c000fbb64d8["headElements()"]
  1856d10d_49b6_d49e_0f37_cbee2beb3083 -->|method| d438c0b2_133e_5c3c_c6e2_2c000fbb64d8
  5d622259_58cc_a5f7_7f68_d7edb8d1e616["componentMetadata()"]
  1856d10d_49b6_d49e_0f37_cbee2beb3083 -->|method| 5d622259_58cc_a5f7_7f68_d7edb8d1e616
  e63fd70c_59a1_5108_dff0_9a497e524393["getComponentByRoute()"]
  1856d10d_49b6_d49e_0f37_cbee2beb3083 -->|method| e63fd70c_59a1_5108_dff0_9a497e524393
  3a71f207_88eb_a31f_8d09_b750c013e060["tryRewrite()"]
  1856d10d_49b6_d49e_0f37_cbee2beb3083 -->|method| 3a71f207_88eb_a31f_8d09_b750c013e060

Relationship Graph

Source Code

packages/astro/src/core/app/dev/pipeline.ts lines 18–154

export class NonRunnablePipeline extends Pipeline {
	getName(): string {
		return 'NonRunnablePipeline';
	}

	static create({ logger, manifest, streaming }: DevPipelineCreate) {
		async function resolve(specifier: string): Promise<string> {
			if (specifier.startsWith('/')) {
				return specifier;
			} else {
				return '/@id/' + specifier;
			}
		}

		const pipeline = new NonRunnablePipeline(
			logger,
			manifest,
			'development',
			manifest.renderers,
			resolve,
			streaming,
			undefined,
			undefined,
			undefined,
			undefined,
			undefined,
			undefined,
			undefined,
			undefined,
		);
		return pipeline;
	}

	async headElements(routeData: RouteData): Promise<HeadElements> {
		const { assetsPrefix, base } = this.manifest;
		const routeInfo = this.manifest.routes.find((route) => route.routeData === routeData);
		// may be used in the future for handling rel=modulepreload, rel=icon, rel=manifest etc.
		const links = new Set<never>();
		const scripts = new Set<SSRElement>();
		const styles = createStylesheetElementSet(routeInfo?.styles ?? [], base, assetsPrefix);

		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));
			}
		}

		scripts.add({
			props: { type: 'module', src: '/@vite/client' },
			children: '',
		});

		if (this.manifest.devToolbar.enabled) {
			scripts.add({
				props: {
					type: 'module',
					src: '/@id/astro/runtime/client/dev-toolbar/entrypoint.js',
				},
				children: '',
			});

			const additionalMetadata: DevToolbarMetadata['__astro_dev_toolbar__'] = {
				root: this.manifest.rootDir.toString(),
				version: ASTRO_VERSION,
				latestAstroVersion: this.manifest.devToolbar.latestAstroVersion,
				debugInfo: this.manifest.devToolbar.debugInfoOutput ?? '',
				placement: this.manifest.devToolbar.placement,
			};

			// Additional data for the dev overlay
			const children = `window.__astro_dev_toolbar__ = ${JSON.stringify(additionalMetadata)}`;
			scripts.add({ props: {}, children });
		}

Domain

Frequently Asked Questions

What is the NonRunnablePipeline class?
NonRunnablePipeline is a class in the astro codebase, defined in packages/astro/src/core/app/dev/pipeline.ts.
Where is NonRunnablePipeline defined?
NonRunnablePipeline is defined in packages/astro/src/core/app/dev/pipeline.ts at line 18.

Analyze Your Own Codebase

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

Try Supermodel Free