Home / File/ server.ts — astro Source File

server.ts — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  f962dc34_e372_47ee_1cd5_191f3430c796["server.ts"]
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  f962dc34_e372_47ee_1cd5_191f3430c796 --> f16d8c76_2866_6150_bd14_0347b59abfe9
  style f962dc34_e372_47ee_1cd5_191f3430c796 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { NamedSSRLoadedRendererValue, SSRResult } from 'astro';

type RendererContext = {
	result: SSRResult;
};

async function check(
	this: RendererContext,
	Component: any,
	//props: Record<string, any>,
	//children: any,
) {

	if (typeof Component !== 'function') return false;

	// in a real-world scenario, this would be a more complex function 
	// that checks if the component should be rendered
	return true;
}

async function renderToStaticMarkup(
	this: RendererContext,
	Component: any,
	props: Record<string, any>,
	//{ default: children, ...slotted }: Record<string, any>,
	//metadata: AstroComponentMetadata | undefined,
) {		
	// in a real-world scenario, this would be a more complex function
	// actually rendering the components return value (which might be an AST/VDOM)
	// and render it as an HTML string
	const vdom = Component(props);
	return { attrs: {}, html: `<${vdom.tag}>${vdom.text} (rendered by server.ts)</${vdom.tag}>` };
}

const renderer: NamedSSRLoadedRendererValue = {
	name: 'custom-renderer',
	check,
	renderToStaticMarkup,
	supportsAstroStaticSlot: false,
};

export default renderer;

Subdomains

Dependencies

  • astro

Frequently Asked Questions

What does server.ts do?
server.ts is a source file in the astro codebase, written in typescript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in server.ts?
server.ts defines 2 function(s): check, renderToStaticMarkup.
What does server.ts depend on?
server.ts imports 1 module(s): astro.
Where is server.ts in the architecture?
server.ts is located at packages/astro/test/fixtures/custom-renderer/src/custom-renderer/server.ts (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test/fixtures/custom-renderer/src/custom-renderer).

Analyze Your Own Codebase

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

Try Supermodel Free