Home / Function/ baseCreateComponent() — astro Function Reference

baseCreateComponent() — astro Function Reference

Architecture documentation for the baseCreateComponent() function in astro-component.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  f68031e7_7604_0f11_a1b1_5548d3137d57["baseCreateComponent()"]
  210ae47f_0b36_a098_f009_b4233604e5ef["astro-component.ts"]
  f68031e7_7604_0f11_a1b1_5548d3137d57 -->|defined in| 210ae47f_0b36_a098_f009_b4233604e5ef
  1a85e680_9a75_a4a9_46ee_2d80fa739b71["createComponentWithOptions()"]
  1a85e680_9a75_a4a9_46ee_2d80fa739b71 -->|calls| f68031e7_7604_0f11_a1b1_5548d3137d57
  517c2959_8e1b_8d84_bb92_d35cd47e42be["createComponent()"]
  517c2959_8e1b_8d84_bb92_d35cd47e42be -->|calls| f68031e7_7604_0f11_a1b1_5548d3137d57
  dd445000_969e_7b81_8728_cb698f69f9c2["validateArgs()"]
  f68031e7_7604_0f11_a1b1_5548d3137d57 -->|calls| dd445000_969e_7b81_8728_cb698f69f9c2
  style f68031e7_7604_0f11_a1b1_5548d3137d57 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/astro-component.ts lines 10–31

function baseCreateComponent(
	cb: AstroComponentFactory,
	moduleId?: string,
	propagation?: PropagationHint,
): AstroComponentFactory {
	const name = moduleId?.split('/').pop()?.replace('.astro', '') ?? '';
	const fn = (...args: Parameters<AstroComponentFactory>) => {
		if (!validateArgs(args)) {
			throw new AstroError({
				...AstroErrorData.InvalidComponentArgs,
				message: AstroErrorData.InvalidComponentArgs.message(name),
			});
		}
		return cb(...args);
	};
	Object.defineProperty(fn, 'name', { value: name, writable: false });
	// Add a flag to this callback to mark it as an Astro component
	fn.isAstroComponentFactory = true;
	fn.moduleId = moduleId;
	fn.propagation = propagation;
	return fn;
}

Domain

Subdomains

Frequently Asked Questions

What does baseCreateComponent() do?
baseCreateComponent() is a function in the astro codebase, defined in packages/astro/src/runtime/server/astro-component.ts.
Where is baseCreateComponent() defined?
baseCreateComponent() is defined in packages/astro/src/runtime/server/astro-component.ts at line 10.
What does baseCreateComponent() call?
baseCreateComponent() calls 1 function(s): validateArgs.
What calls baseCreateComponent()?
baseCreateComponent() is called by 2 function(s): createComponent, createComponentWithOptions.

Analyze Your Own Codebase

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

Try Supermodel Free