RunnablePipeline Class — astro Architecture
Architecture documentation for the RunnablePipeline class in pipeline.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 91572b20_ae8c_d5b0_82aa_5914d1622215["RunnablePipeline"] 59918ded_22d2_46a8_b3ae_67789eee6ce1["pipeline.ts"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|defined in| 59918ded_22d2_46a8_b3ae_67789eee6ce1 ffe42dfb_0f49_c256_47ba_726983830b1e["getName()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| ffe42dfb_0f49_c256_47ba_726983830b1e 3dd8931b_ca09_097e_6847_273c79f776dd["constructor()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| 3dd8931b_ca09_097e_6847_273c79f776dd 7cbc97d6_cded_9a93_6553_a6b2cdac7a1a["create()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| 7cbc97d6_cded_9a93_6553_a6b2cdac7a1a 0cb31d37_ecaf_5e9a_9eff_ef899a02af17["headElements()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| 0cb31d37_ecaf_5e9a_9eff_ef899a02af17 73592954_3d32_b311_3b4b_f8f132c110b0["componentMetadata()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| 73592954_3d32_b311_3b4b_f8f132c110b0 0f5bfc9a_beba_920f_ec4e_e897a3448a53["preload()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| 0f5bfc9a_beba_920f_ec4e_e897a3448a53 e35daa95_4363_83d7_3165_daa886edb654["clearRouteCache()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| e35daa95_4363_83d7_3165_daa886edb654 ddcb40c7_1fe7_8127_0dcf_33d7e687f835["getComponentByRoute()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| ddcb40c7_1fe7_8127_0dcf_33d7e687f835 93232022_cf8d_03d9_d054_c2e6cc9ca329["tryRewrite()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| 93232022_cf8d_03d9_d054_c2e6cc9ca329 a1ca026c_c50a_b004_14fe_b730791ff4ca["setManifestData()"] 91572b20_ae8c_d5b0_82aa_5914d1622215 -->|method| a1ca026c_c50a_b004_14fe_b730791ff4ca
Relationship Graph
Source Code
packages/astro/src/vite-plugin-app/pipeline.ts lines 35–228
export class RunnablePipeline extends Pipeline {
getName(): string {
return 'RunnablePipeline';
}
// renderers are loaded on every request,
// so it needs to be mutable here unlike in other environments
override renderers = new Array<SSRLoadedRenderer>();
routesList: RoutesList | undefined;
private constructor(
readonly loader: ModuleLoader,
readonly logger: Logger,
readonly manifest: SSRManifest,
readonly settings: AstroSettings,
readonly getDebugInfo: () => Promise<string>,
readonly defaultRoutes = createDefaultRoutes(manifest),
) {
const resolve = createResolve(loader, manifest.rootDir);
const streaming = true;
super(logger, manifest, 'development', [], resolve, streaming);
}
static create(
manifestData: RoutesList,
{
loader,
logger,
manifest,
settings,
getDebugInfo,
}: Pick<RunnablePipeline, 'loader' | 'logger' | 'manifest' | 'settings' | 'getDebugInfo'>,
) {
const pipeline = new RunnablePipeline(loader, logger, manifest, settings, getDebugInfo);
pipeline.routesList = manifestData;
return pipeline;
}
async headElements(routeData: RouteData): Promise<HeadElements> {
const { manifest, runtimeMode, settings } = this;
const filePath = new URL(`${routeData.component}`, manifest.rootDir);
const scripts = new Set<SSRElement>();
// Inject HMR scripts
if (settings) {
if (isPage(filePath, settings) && runtimeMode === 'development') {
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: fileURLToPath(settings.config.root),
version: ASTRO_VERSION,
latestAstroVersion: settings.latestAstroVersion,
// TODO: Currently the debug info is always fetched, which slows things down.
// We should look into not loading it if the dev toolbar is disabled. And when
// enabled, it would nice to request the debug info through import.meta.hot
// when the button is click to defer execution as much as possible
debugInfo: await this.getDebugInfo(),
placement: settings.config.devToolbar.placement,
};
// Additional data for the dev overlay
const children = `window.__astro_dev_toolbar__ = ${JSON.stringify(additionalMetadata)}`;
scripts.add({ props: {}, children });
}
}
// TODO: We should allow adding generic HTML elements to the head, not just scripts
for (const script of settings.scripts) {
Domain
Source
Frequently Asked Questions
What is the RunnablePipeline class?
RunnablePipeline is a class in the astro codebase, defined in packages/astro/src/vite-plugin-app/pipeline.ts.
Where is RunnablePipeline defined?
RunnablePipeline is defined in packages/astro/src/vite-plugin-app/pipeline.ts at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free