constructor() — astro Function Reference
Architecture documentation for the constructor() function in instance.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD beb8afb5_7437_f0dd_54a8_abfcfd0afdae["constructor()"] c8404018_ae72_dbaf_c01d_66b8b2cbc344["AstroComponentInstance"] beb8afb5_7437_f0dd_54a8_abfcfd0afdae -->|defined in| c8404018_ae72_dbaf_c01d_66b8b2cbc344 style beb8afb5_7437_f0dd_54a8_abfcfd0afdae fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/runtime/server/render/astro/instance.ts lines 22–46
constructor(
result: SSRResult,
props: ComponentProps,
slots: ComponentSlots,
factory: AstroComponentFactory,
) {
this.result = result;
this.props = props;
this.factory = factory;
this.slotValues = {};
for (const name in slots) {
// prerender the slots eagerly to make collection entries propagate styles and scripts
let didRender = false;
let value = slots[name](result);
this.slotValues[name] = () => {
// use prerendered value only once
if (!didRender) {
didRender = true;
return value;
}
// render afresh for the advanced use-case where the same slot is rendered multiple times
return slots[name](result);
};
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does constructor() do?
constructor() is a function in the astro codebase, defined in packages/astro/src/runtime/server/render/astro/instance.ts.
Where is constructor() defined?
constructor() is defined in packages/astro/src/runtime/server/render/astro/instance.ts at line 22.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free