Home / Function/ check() — astro Function Reference

check() — astro Function Reference

Architecture documentation for the check() function in server.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  f6706ec4_ae69_2edc_db5c_eb6b6f3ed9e0["check()"]
  d27cc44a_e2ff_86d0_e654_f90b112f1bba["server.ts"]
  f6706ec4_ae69_2edc_db5c_eb6b6f3ed9e0 -->|defined in| d27cc44a_e2ff_86d0_e654_f90b112f1bba
  04a470b1_3a76_9893_9079_3e7d9b593682["useConsoleFilter()"]
  f6706ec4_ae69_2edc_db5c_eb6b6f3ed9e0 -->|calls| 04a470b1_3a76_9893_9079_3e7d9b593682
  30c8eb73_5e4d_cd38_ab53_c82cf83d6e63["finishUsingConsoleFilter()"]
  f6706ec4_ae69_2edc_db5c_eb6b6f3ed9e0 -->|calls| 30c8eb73_5e4d_cd38_ab53_c82cf83d6e63
  style f6706ec4_ae69_2edc_db5c_eb6b6f3ed9e0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/preact/src/server.ts lines 14–44

async function check(
	this: RendererContext,
	Component: any,
	props: Record<string, any>,
	children: any,
) {
	if (typeof Component !== 'function') return false;
	if (Component.name === 'QwikComponent') return false;

	if (Component.prototype != null && typeof Component.prototype.render === 'function') {
		return BaseComponent.isPrototypeOf(Component);
	}

	useConsoleFilter();

	try {
		const { html } = await renderToStaticMarkup.call(this, Component, props, children, undefined);
		if (typeof html !== 'string') {
			return false;
		}

		// There are edge cases (SolidJS) where Preact *might* render a string,
		// but components would be <undefined></undefined>
		// It also might render an empty string.
		return html == '' ? false : !html.includes('<undefined>');
	} catch {
		return false;
	} finally {
		finishUsingConsoleFilter();
	}
}

Domain

Subdomains

Frequently Asked Questions

What does check() do?
check() is a function in the astro codebase, defined in packages/integrations/preact/src/server.ts.
Where is check() defined?
check() is defined in packages/integrations/preact/src/server.ts at line 14.
What does check() call?
check() calls 2 function(s): finishUsingConsoleFilter, useConsoleFilter.

Analyze Your Own Codebase

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

Try Supermodel Free