Home / File/ astro-designed-error-pages.ts — astro Source File

astro-designed-error-pages.ts — astro Source File

Architecture documentation for astro-designed-error-pages.ts, a typescript file in the astro codebase. 4 imports, 0 dependents.

File typescript CoreAstro RoutingSystem 4 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  9c6554bc_d2d0_71e8_a67a_6169c77b52f5["astro-designed-error-pages.ts"]
  6b38722c_7b48_0d95_7927_ae62c3991719["../template/4xx.js"]
  9c6554bc_d2d0_71e8_a67a_6169c77b52f5 --> 6b38722c_7b48_0d95_7927_ae62c3991719
  e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"]
  9c6554bc_d2d0_71e8_a67a_6169c77b52f5 --> e9b74c5a_8d34_34a7_e196_5e41b87214aa
  10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"]
  9c6554bc_d2d0_71e8_a67a_6169c77b52f5 --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05
  7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"]
  9c6554bc_d2d0_71e8_a67a_6169c77b52f5 --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b
  style 9c6554bc_d2d0_71e8_a67a_6169c77b52f5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import notFoundTemplate from '../../template/4xx.js';
import type { ComponentInstance, RoutesList } from '../../types/astro.js';
import type { RouteData } from '../../types/public/internal.js';
import { DEFAULT_404_COMPONENT } from '../constants.js';

export const DEFAULT_404_ROUTE: RouteData = {
	component: DEFAULT_404_COMPONENT,
	params: [],
	pattern: /^\/404\/?$/,
	prerender: false,
	pathname: '/404',
	segments: [[{ content: '404', dynamic: false, spread: false }]],
	type: 'page',
	route: '/404',
	fallbackRoutes: [],
	isIndex: false,
	origin: 'internal',
	distURL: [],
};

export function ensure404Route(manifest: RoutesList) {
	if (!manifest.routes.some((route) => route.route === '/404')) {
		manifest.routes.push(DEFAULT_404_ROUTE);
	}
	return manifest;
}

async function default404Page({ pathname }: { pathname: string }) {
	return new Response(
		notFoundTemplate({
			statusCode: 404,
			title: 'Not found',
			tabTitle: '404: Not Found',
			pathname,
		}),
		{ status: 404, headers: { 'Content-Type': 'text/html' } },
	);
}
// mark the function as an AstroComponentFactory for the rendering internals
default404Page.isAstroComponentFactory = true;

export const default404Instance: ComponentInstance = {
	default: default404Page,
};

Domain

Subdomains

Dependencies

  • ../core/constants.js
  • ../template/4xx.js
  • ../types/astro.js
  • ../types/public/internal.js

Frequently Asked Questions

What does astro-designed-error-pages.ts do?
astro-designed-error-pages.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in astro-designed-error-pages.ts?
astro-designed-error-pages.ts defines 2 function(s): default404Page, ensure404Route.
What does astro-designed-error-pages.ts depend on?
astro-designed-error-pages.ts imports 4 module(s): ../core/constants.js, ../template/4xx.js, ../types/astro.js, ../types/public/internal.js.
Where is astro-designed-error-pages.ts in the architecture?
astro-designed-error-pages.ts is located at packages/astro/src/core/routing/astro-designed-error-pages.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/astro/src/core/routing).

Analyze Your Own Codebase

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

Try Supermodel Free