Home / File/ any.ts — astro Source File

any.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 6 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  0e818d99_0299_a58a_f7c7_b3fe5a5b3548["any.ts"]
  a7eea85d_ea97_57b1_9a24_f99face6a97d["./escape.js"]
  0e818d99_0299_a58a_f7c7_b3fe5a5b3548 --> a7eea85d_ea97_57b1_9a24_f99face6a97d
  a28c4b4b_41a8_d771_0fc1_f9fbc7ccded6["../util.js"]
  0e818d99_0299_a58a_f7c7_b3fe5a5b3548 --> a28c4b4b_41a8_d771_0fc1_f9fbc7ccded6
  a7387e5d_75cc_9a5e_f39d_a88dfdd799ce["./astro/index.js"]
  0e818d99_0299_a58a_f7c7_b3fe5a5b3548 --> a7387e5d_75cc_9a5e_f39d_a88dfdd799ce
  b0a43ea3_d8cf_4023_b3ca_f683a93e9dbb["./common.js"]
  0e818d99_0299_a58a_f7c7_b3fe5a5b3548 --> b0a43ea3_d8cf_4023_b3ca_f683a93e9dbb
  624e5f97_7f83_f926_3407_b10786361e90["./slot.js"]
  0e818d99_0299_a58a_f7c7_b3fe5a5b3548 --> 624e5f97_7f83_f926_3407_b10786361e90
  f6f0048c_504d_27bf_f669_9d6d4a931037["./util.js"]
  0e818d99_0299_a58a_f7c7_b3fe5a5b3548 --> f6f0048c_504d_27bf_f669_9d6d4a931037
  style 0e818d99_0299_a58a_f7c7_b3fe5a5b3548 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { escapeHTML, isHTMLString, markHTMLString } from '../escape.js';
import { isPromise } from '../util.js';
import { isAstroComponentInstance, isRenderTemplateResult } from './astro/index.js';
import { isRenderInstance, type RenderDestination } from './common.js';
import { SlotString } from './slot.js';
import { createBufferedRenderer } from './util.js';

export function renderChild(destination: RenderDestination, child: any): void | Promise<void> {
	if (isPromise(child)) {
		return child.then((x) => renderChild(destination, x));
	}

	if (child instanceof SlotString) {
		destination.write(child);
		return;
	}

	if (isHTMLString(child)) {
		destination.write(child);
		return;
	}

	if (Array.isArray(child)) {
		return renderArray(destination, child);
	}

	if (typeof child === 'function') {
		// Special: If a child is a function, call it automatically.
		// This lets you do {() => ...} without the extra boilerplate
		// of wrapping it in a function and calling it.
		return renderChild(destination, child());
	}

	if (!child && child !== 0) {
		// do nothing, safe to ignore falsey values.
		return;
	}

	if (typeof child === 'string') {
		destination.write(markHTMLString(escapeHTML(child)));
		return;
	}

	if (isRenderInstance(child)) {
		return child.render(destination);
	}

	if (isRenderTemplateResult(child)) {
		return child.render(destination);
	}

	if (isAstroComponentInstance(child)) {
		return child.render(destination);
	}

	if (ArrayBuffer.isView(child)) {
		destination.write(child);
		return;
	}

// ... (77 more lines)

Domain

Subdomains

Dependencies

  • ../util.js
  • ./astro/index.js
  • ./common.js
  • ./escape.js
  • ./slot.js
  • ./util.js

Frequently Asked Questions

What does any.ts do?
any.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 any.ts?
any.ts defines 4 function(s): renderArray, renderAsyncIterable, renderChild, renderIterable.
What does any.ts depend on?
any.ts imports 6 module(s): ../util.js, ./astro/index.js, ./common.js, ./escape.js, ./slot.js, ./util.js.
Where is any.ts in the architecture?
any.ts is located at packages/astro/src/runtime/server/render/any.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