Home / File/ app.ts — astro Source File

app.ts — astro Source File

Architecture documentation for app.ts, a typescript file in the astro codebase. 13 imports, 0 dependents.

File typescript CoreAstro CoreMiddleware 13 imports 1 classes

Entity Profile

Dependency Diagram

graph LR
  1c83a48e_263e_e961_abcc_b128e34eab91["app.ts"]
  baa53824_73a3_1e03_2043_4d0c058ecca5["../types/public/index.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> baa53824_73a3_1e03_2043_4d0c058ecca5
  8df634da_0f30_1e1f_1314_2439b0c9baab["../core/errors/errors-data.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> 8df634da_0f30_1e1f_1314_2439b0c9baab
  ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9
  d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> d3861967_b647_84d2_ff48_15013353bd56
  7e14fb1f_4abe_1438_9c6e_bb382e90b0fe["../core/render-context.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> 7e14fb1f_4abe_1438_9c6e_bb382e90b0fe
  f651f759_e227_9ba0_846c_cd5525810aaa["../core/app/base.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> f651f759_e227_9ba0_846c_cd5525810aaa
  a4f2698c_5256_262a_ba7c_f72b51878d10["../core/app/types.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> a4f2698c_5256_262a_ba7c_f72b51878d10
  a5fade02_18dd_5f40_5f19_00dc2a8d375c["./pipeline.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> a5fade02_18dd_5f40_5f19_00dc2a8d375c
  b3e8a9be_d20e_da21_abaa_3cb61c3f5a15["../core/routing/helpers.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> b3e8a9be_d20e_da21_abaa_3cb61c3f5a15
  9448bae7_8c9f_817b_4d45_a0ad40f771b0["../core/routing/astro-designed-error-pages.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> 9448bae7_8c9f_817b_4d45_a0ad40f771b0
  db58f854_5fb2_b1c8_4c49_aa8dcd83e0db["../core/routing/dev.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> db58f854_5fb2_b1c8_4c49_aa8dcd83e0db
  0a7232f9_1027_cf2d_cc88_6e09a54bf913["./pipeline.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> 0a7232f9_1027_cf2d_cc88_6e09a54bf913
  e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"]
  1c83a48e_263e_e961_abcc_b128e34eab91 --> e9b74c5a_8d34_34a7_e196_5e41b87214aa
  style 1c83a48e_263e_e961_abcc_b128e34eab91 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { RouteData } from '../../../types/public/index.js';
import { MiddlewareNoDataOrNextCalled, MiddlewareNotAResponse } from '../../errors/errors-data.js';
import { type AstroError, isAstroError } from '../../errors/index.js';
import type { Logger } from '../../logger/core.js';
import type { CreateRenderContext, RenderContext } from '../../render-context.js';
import { BaseApp, type DevMatch, type RenderErrorOptions } from '../base.js';
import type { SSRManifest } from '../types.js';
import { NonRunnablePipeline } from './pipeline.js';
import { getCustom404Route, getCustom500Route } from '../../routing/helpers.js';
import { ensure404Route } from '../../routing/astro-designed-error-pages.js';
import { matchRoute } from '../../routing/dev.js';
import type { RunnablePipeline } from '../../../vite-plugin-app/pipeline.js';
import type { RoutesList } from '../../../types/astro.js';

export class DevApp extends BaseApp<NonRunnablePipeline> {
	logger: Logger;
	resolvedPathname: string | undefined = undefined;
	constructor(manifest: SSRManifest, streaming = true, logger: Logger) {
		super(manifest, streaming, logger);
		this.logger = logger;
	}

	createPipeline(streaming: boolean, manifest: SSRManifest, logger: Logger): NonRunnablePipeline {
		return NonRunnablePipeline.create({
			logger,
			manifest,
			streaming,
		});
	}

	isDev(): boolean {
		return true;
	}

	/**
	 * Updates the routes list when files change during development.
	 * Called via HMR when new pages are added/removed.
	 */
	updateRoutes(newRoutesList: RoutesList): void {
		this.manifestData = newRoutesList;
		ensure404Route(this.manifestData);
	}

	match(request: Request): RouteData | undefined {
		return super.match(request, true);
	}

	async devMatch(pathname: string): Promise<DevMatch | undefined> {
		const matchedRoute = await matchRoute(
			pathname,
			this.manifestData,
			this.pipeline as unknown as RunnablePipeline,
			this.manifest,
		);
		if (!matchedRoute) return undefined;

		this.resolvedPathname = matchedRoute.resolvedPathname;
		return {
			routeData: matchedRoute.route,
			resolvedPathname: matchedRoute.resolvedPathname,
// ... (78 more lines)

Domain

Subdomains

Classes

Dependencies

  • ../core/app/base.js
  • ../core/app/types.js
  • ../core/errors/errors-data.js
  • ../core/errors/index.js
  • ../core/logger/core.js
  • ../core/render-context.js
  • ../core/routing/astro-designed-error-pages.js
  • ../core/routing/dev.js
  • ../core/routing/helpers.js
  • ../types/astro.js
  • ../types/public/index.js
  • ./pipeline.js
  • ./pipeline.js

Frequently Asked Questions

What does app.ts do?
app.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What does app.ts depend on?
app.ts imports 13 module(s): ../core/app/base.js, ../core/app/types.js, ../core/errors/errors-data.js, ../core/errors/index.js, ../core/logger/core.js, ../core/render-context.js, ../core/routing/astro-designed-error-pages.js, ../core/routing/dev.js, and 5 more.
Where is app.ts in the architecture?
app.ts is located at packages/astro/src/core/app/dev/app.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/astro/src/core/app/dev).

Analyze Your Own Codebase

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

Try Supermodel Free