AppPipeline Class — astro Architecture
Architecture documentation for the AppPipeline class in pipeline.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 40ba2769_779c_63d9_4084_f451c2f62cd9["AppPipeline"] e50c199a_9839_92f2_0355_245e4866ca1d["pipeline.ts"] 40ba2769_779c_63d9_4084_f451c2f62cd9 -->|defined in| e50c199a_9839_92f2_0355_245e4866ca1d 1b309df2_61a2_ef17_76a4_61aa1b5feb86["getName()"] 40ba2769_779c_63d9_4084_f451c2f62cd9 -->|method| 1b309df2_61a2_ef17_76a4_61aa1b5feb86 e02623a2_d234_d3cd_6ac2_6344be8cae47["create()"] 40ba2769_779c_63d9_4084_f451c2f62cd9 -->|method| e02623a2_d234_d3cd_6ac2_6344be8cae47 6eb03e73_de3f_4c2e_a49f_c9099faf6ac9["headElements()"] 40ba2769_779c_63d9_4084_f451c2f62cd9 -->|method| 6eb03e73_de3f_4c2e_a49f_c9099faf6ac9 64dd1479_5dde_0181_1a99_703a5f559a1b["componentMetadata()"] 40ba2769_779c_63d9_4084_f451c2f62cd9 -->|method| 64dd1479_5dde_0181_1a99_703a5f559a1b d52ff83d_4730_519f_5ab3_9c2089ed4d5d["getComponentByRoute()"] 40ba2769_779c_63d9_4084_f451c2f62cd9 -->|method| d52ff83d_4730_519f_5ab3_9c2089ed4d5d d47724cb_d240_2604_40ed_cb44bb423eb6["getModuleForRoute()"] 40ba2769_779c_63d9_4084_f451c2f62cd9 -->|method| d47724cb_d240_2604_40ed_cb44bb423eb6 d3c66bd3_1cd3_b12a_a18d_4f93dff5df0c["tryRewrite()"] 40ba2769_779c_63d9_4084_f451c2f62cd9 -->|method| d3c66bd3_1cd3_b12a_a18d_4f93dff5df0c
Relationship Graph
Source Code
packages/astro/src/core/app/pipeline.ts lines 16–137
export class AppPipeline extends Pipeline {
getName(): string {
return 'AppPipeline';
}
static create({ manifest, streaming }: Pick<AppPipeline, 'manifest' | 'streaming'>) {
const resolve = async function resolve(specifier: string) {
if (!(specifier in manifest.entryModules)) {
throw new Error(`Unable to resolve [${specifier}]`);
}
const bundlePath = manifest.entryModules[specifier];
if (bundlePath.startsWith('data:') || bundlePath.length === 0) {
return bundlePath;
} else {
return createAssetLink(bundlePath, manifest.base, manifest.assetsPrefix);
}
};
const logger = createConsoleLogger(manifest.logLevel);
const pipeline = new AppPipeline(
logger,
manifest,
'production',
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.route === routeData.route,
);
// 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, base, assetsPrefix));
}
}
return { links, styles, scripts };
}
componentMetadata() {}
async getComponentByRoute(routeData: RouteData): Promise<ComponentInstance> {
const module = await this.getModuleForRoute(routeData);
return module.page();
}
async getModuleForRoute(route: RouteData): Promise<SinglePageBuiltModule> {
for (const defaultRoute of this.defaultRoutes) {
if (route.component === defaultRoute.component) {
return {
page: () => Promise.resolve(defaultRoute.instance),
};
}
}
let routeToProcess = route;
if (routeIsRedirect(route)) {
if (route.redirectRoute) {
// This is a static redirect
Domain
Defined In
Source
Frequently Asked Questions
What is the AppPipeline class?
AppPipeline is a class in the astro codebase, defined in packages/astro/src/core/app/pipeline.ts.
Where is AppPipeline defined?
AppPipeline is defined in packages/astro/src/core/app/pipeline.ts at line 16.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free