Home / File/ component.ts — astro Source File

component.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 19 imports 13 functions

Entity Profile

Dependency Diagram

graph LR
  8fc97f1b_c914_c155_013d_cbd729fb6b4f["component.ts"]
  ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9
  10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05
  a7eea85d_ea97_57b1_9a24_f99face6a97d["./escape.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> a7eea85d_ea97_57b1_9a24_f99face6a97d
  c82deda8_a7f2_ba3c_3d60_567e16167865["../hydration.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> c82deda8_a7f2_ba3c_3d60_567e16167865
  a2af2906_7095_2cba_27c9_a64837c9a056["../serialize.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> a2af2906_7095_2cba_27c9_a64837c9a056
  df93c329_2f79_6708_fa84_5c5c757a6c19["../runtime/server/shorthash.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> df93c329_2f79_6708_fa84_5c5c757a6c19
  a28c4b4b_41a8_d771_0fc1_f9fbc7ccded6["../util.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> a28c4b4b_41a8_d771_0fc1_f9fbc7ccded6
  132e77ba_f68f_16dc_a64d_edda31b820dc["./astro/factory.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> 132e77ba_f68f_16dc_a64d_edda31b820dc
  a7387e5d_75cc_9a5e_f39d_a88dfdd799ce["./astro/index.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> a7387e5d_75cc_9a5e_f39d_a88dfdd799ce
  8a80dd96_bd44_2cb7_b9f8_f3aaabb30dbc["./astro/instance.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> 8a80dd96_bd44_2cb7_b9f8_f3aaabb30dbc
  8e9a6490_0cf3_4720_cff3_c31ab660bf38["./astro/render.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> 8e9a6490_0cf3_4720_cff3_c31ab660bf38
  b0a43ea3_d8cf_4023_b3ca_f683a93e9dbb["./common.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> b0a43ea3_d8cf_4023_b3ca_f683a93e9dbb
  bf2a8729_4387_223a_f994_26ab9fe56a01["./dom.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> bf2a8729_4387_223a_f994_26ab9fe56a01
  f39133ce_d2ba_8a67_096e_fd278b78377e["./head.js"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f --> f39133ce_d2ba_8a67_096e_fd278b78377e
  style 8fc97f1b_c914_c155_013d_cbd729fb6b4f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { clsx } from 'clsx';
import { AstroError, AstroErrorData } from '../../../core/errors/index.js';
import type {
	AstroComponentMetadata,
	RouteData,
	SSRLoadedRenderer,
	SSRResult,
} from '../../../types/public/internal.js';
import { markHTMLString } from '../escape.js';
import { extractDirectives, generateHydrateScript } from '../hydration.js';
import { serializeProps } from '../serialize.js';
import { shorthash } from '../shorthash.js';
import { isPromise } from '../util.js';
import { type AstroComponentFactory, isAstroComponentFactory } from './astro/factory.js';
import { renderTemplate } from './astro/index.js';
import { createAstroComponentInstance } from './astro/instance.js';
import { bufferHeadContent } from './astro/render.js';
import {
	chunkToString,
	Fragment,
	type RenderDestination,
	Renderer,
	type RenderInstance,
} from './common.js';
import { componentIsHTMLElement, renderHTMLElement } from './dom.js';
import { maybeRenderHead } from './head.js';
import { createRenderInstruction } from './instruction.js';
import { containsServerDirective, ServerIslandComponent } from './server-islands.js';
import { type ComponentSlots, renderSlots, renderSlotToString } from './slot.js';
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js';

const needsHeadRenderingSymbol = Symbol.for('astro.needsHeadRendering');
const rendererAliases = new Map([['solid', 'solid-js']]);
const clientOnlyValues = new Set(['solid-js', 'react', 'preact', 'vue', 'svelte']);

function guessRenderers(componentUrl?: string): string[] {
	const extname = componentUrl?.split('.').pop();
	switch (extname) {
		case 'svelte':
			return ['@astrojs/svelte'];
		case 'vue':
			return ['@astrojs/vue'];
		case 'jsx':
		case 'tsx':
			return ['@astrojs/react', '@astrojs/preact', '@astrojs/solid-js', '@astrojs/vue (jsx)'];
		case undefined:
		default:
			return [
				'@astrojs/react',
				'@astrojs/preact',
				'@astrojs/solid-js',
				'@astrojs/vue',
				'@astrojs/svelte',
			];
	}
}

function isFragmentComponent(Component: unknown) {
	return Component === Fragment;
}
// ... (525 more lines)

Domain

Subdomains

Dependencies

  • ../core/errors/index.js
  • ../hydration.js
  • ../runtime/server/shorthash.js
  • ../serialize.js
  • ../types/public/internal.js
  • ../util.js
  • ./astro/factory.js
  • ./astro/index.js
  • ./astro/instance.js
  • ./astro/render.js
  • ./common.js
  • ./dom.js
  • ./escape.js
  • ./head.js
  • ./instruction.js
  • ./server-islands.js
  • ./slot.js
  • ./util.js
  • clsx

Frequently Asked Questions

What does component.ts do?
component.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 component.ts?
component.ts defines 13 function(s): guessRenderers, isFragmentComponent, isHTMLComponent, nonAstroPageNeedsHeadInjection, normalizeProps, removeStaticAstroSlot, renderAstroComponent, renderComponent, renderComponentToString, renderFragmentComponent, and 3 more.
What does component.ts depend on?
component.ts imports 19 module(s): ../core/errors/index.js, ../hydration.js, ../runtime/server/shorthash.js, ../serialize.js, ../types/public/internal.js, ../util.js, ./astro/factory.js, ./astro/index.js, and 11 more.
Where is component.ts in the architecture?
component.ts is located at packages/astro/src/runtime/server/render/component.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/runtime/server/render).

Analyze Your Own Codebase

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

Try Supermodel Free