Home / File/ endpoint.ts — astro Source File

endpoint.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 7 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  97c01b61_891f_8dac_ac27_a13227b30c79["endpoint.ts"]
  9e624f62_bcfa_4352_e9a0_dd454823f706["../../runtime/server/index.js"]
  97c01b61_891f_8dac_ac27_a13227b30c79 --> 9e624f62_bcfa_4352_e9a0_dd454823f706
  132e77ba_f68f_16dc_a64d_edda31b820dc["./astro/factory.js"]
  97c01b61_891f_8dac_ac27_a13227b30c79 --> 132e77ba_f68f_16dc_a64d_edda31b820dc
  624e5f97_7f83_f926_3407_b10786361e90["./slot.js"]
  97c01b61_891f_8dac_ac27_a13227b30c79 --> 624e5f97_7f83_f926_3407_b10786361e90
  e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"]
  97c01b61_891f_8dac_ac27_a13227b30c79 --> e9b74c5a_8d34_34a7_e196_5e41b87214aa
  10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"]
  97c01b61_891f_8dac_ac27_a13227b30c79 --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05
  dd2fe7bd_2244_3ff4_38ec_5e07763d1492["../core/encryption.js"]
  97c01b61_891f_8dac_ac27_a13227b30c79 --> dd2fe7bd_2244_3ff4_38ec_5e07763d1492
  a1519c71_eb4f_7c62_b5c1_9d29320228d0["../routing/manifest/pattern.js"]
  97c01b61_891f_8dac_ac27_a13227b30c79 --> a1519c71_eb4f_7c62_b5c1_9d29320228d0
  style 97c01b61_891f_8dac_ac27_a13227b30c79 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
	type AstroComponentFactory,
	type ComponentSlots,
	renderComponent,
	renderTemplate,
} from '../../runtime/server/index.js';
import { isAstroComponentFactory } from '../../runtime/server/render/astro/factory.js';
import { createSlotValueFromString } from '../../runtime/server/render/slot.js';
import type { ComponentInstance, RoutesList } from '../../types/astro.js';
import type { RouteData, SSRManifest } from '../../types/public/internal.js';
import { decryptString } from '../encryption.js';
import { getPattern } from '../routing/manifest/pattern.js';

export const SERVER_ISLAND_ROUTE = '/_server-islands/[name]';
export const SERVER_ISLAND_COMPONENT = '_server-islands.astro';
export const SERVER_ISLAND_BASE_PREFIX = '_server-islands';

type ConfigFields = Pick<SSRManifest, 'base' | 'trailingSlash'>;

function getServerIslandRouteData(config: ConfigFields) {
	const segments = [
		[{ content: '_server-islands', dynamic: false, spread: false }],
		[{ content: 'name', dynamic: true, spread: false }],
	];
	const route: RouteData = {
		type: 'page',
		component: SERVER_ISLAND_COMPONENT,
		params: ['name'],
		segments,
		pattern: getPattern(segments, config.base, config.trailingSlash),
		prerender: false,
		isIndex: false,
		fallbackRoutes: [],
		route: SERVER_ISLAND_ROUTE,
		origin: 'internal',
		distURL: [],
	};
	return route;
}

export function injectServerIslandRoute(config: ConfigFields, routeManifest: RoutesList) {
	routeManifest.routes.unshift(getServerIslandRouteData(config));
}

type RenderOptions = {
	encryptedComponentExport: string;
	encryptedProps: string;
	encryptedSlots: string;
};

function badRequest(reason: string) {
	return new Response(null, {
		status: 400,
		statusText: 'Bad request: ' + reason,
	});
}

async function getRequestData(request: Request): Promise<Response | RenderOptions> {
	switch (request.method) {
		case 'GET': {
// ... (147 more lines)

Domain

Subdomains

Dependencies

  • ../../runtime/server/index.js
  • ../core/encryption.js
  • ../routing/manifest/pattern.js
  • ../types/astro.js
  • ../types/public/internal.js
  • ./astro/factory.js
  • ./slot.js

Frequently Asked Questions

What does endpoint.ts do?
endpoint.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in endpoint.ts?
endpoint.ts defines 5 function(s): badRequest, createEndpoint, getRequestData, getServerIslandRouteData, injectServerIslandRoute.
What does endpoint.ts depend on?
endpoint.ts imports 7 module(s): ../../runtime/server/index.js, ../core/encryption.js, ../routing/manifest/pattern.js, ../types/astro.js, ../types/public/internal.js, ./astro/factory.js, ./slot.js.
Where is endpoint.ts in the architecture?
endpoint.ts is located at packages/astro/src/core/server-islands/endpoint.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/server-islands).

Analyze Your Own Codebase

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

Try Supermodel Free