instance.ts — astro Source File
Architecture documentation for instance.ts, a typescript file in the astro codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1be70ad0_d3b6_9a94_47c0_3985acb68eaf["instance.ts"] 10d4e39f_edb6_3e34_aa93_ae1211e7da05["../types/public/internal.js"] 1be70ad0_d3b6_9a94_47c0_3985acb68eaf --> 10d4e39f_edb6_3e34_aa93_ae1211e7da05 a28c4b4b_41a8_d771_0fc1_f9fbc7ccded6["../util.js"] 1be70ad0_d3b6_9a94_47c0_3985acb68eaf --> a28c4b4b_41a8_d771_0fc1_f9fbc7ccded6 6c868e3a_5b34_f101_8dd5_f09c50957ba0["./any.js"] 1be70ad0_d3b6_9a94_47c0_3985acb68eaf --> 6c868e3a_5b34_f101_8dd5_f09c50957ba0 b0a43ea3_d8cf_4023_b3ca_f683a93e9dbb["./common.js"] 1be70ad0_d3b6_9a94_47c0_3985acb68eaf --> b0a43ea3_d8cf_4023_b3ca_f683a93e9dbb 624e5f97_7f83_f926_3407_b10786361e90["./slot.js"] 1be70ad0_d3b6_9a94_47c0_3985acb68eaf --> 624e5f97_7f83_f926_3407_b10786361e90 132e77ba_f68f_16dc_a64d_edda31b820dc["./astro/factory.js"] 1be70ad0_d3b6_9a94_47c0_3985acb68eaf --> 132e77ba_f68f_16dc_a64d_edda31b820dc fafd37f7_4f96_f4d7_ed97_94234c7e57aa["./astro/head-and-content.js"] 1be70ad0_d3b6_9a94_47c0_3985acb68eaf --> fafd37f7_4f96_f4d7_ed97_94234c7e57aa style 1be70ad0_d3b6_9a94_47c0_3985acb68eaf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { SSRResult } from '../../../../types/public/internal.js';
import { isPromise } from '../../util.js';
import { renderChild } from '../any.js';
import type { RenderDestination } from '../common.js';
import type { ComponentSlots } from '../slot.js';
import type { AstroComponentFactory, AstroFactoryReturnValue } from './factory.js';
import { isAPropagatingComponent } from './factory.js';
import { isHeadAndContent } from './head-and-content.js';
type ComponentProps = Record<string | number, any>;
const astroComponentInstanceSym = Symbol.for('astro.componentInstance');
export class AstroComponentInstance {
[astroComponentInstanceSym] = true;
private readonly result: SSRResult;
private readonly props: ComponentProps;
private readonly slotValues: ComponentSlots;
private readonly factory: AstroComponentFactory;
private returnValue: ReturnType<AstroComponentFactory> | undefined;
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);
};
}
}
init(result: SSRResult): AstroFactoryReturnValue | Promise<AstroFactoryReturnValue> {
if (this.returnValue !== undefined) {
return this.returnValue;
}
this.returnValue = this.factory(result, this.props, this.slotValues);
// Save the resolved value after promise is resolved for optimization
if (isPromise(this.returnValue)) {
this.returnValue
.then((resolved) => {
this.returnValue = resolved;
})
// ... (63 more lines)
Domain
Subdomains
Classes
Types
Dependencies
- ../types/public/internal.js
- ../util.js
- ./any.js
- ./astro/factory.js
- ./astro/head-and-content.js
- ./common.js
- ./slot.js
Source
Frequently Asked Questions
What does instance.ts do?
instance.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 instance.ts?
instance.ts defines 3 function(s): createAstroComponentInstance, isAstroComponentInstance, validateComponentProps.
What does instance.ts depend on?
instance.ts imports 7 module(s): ../types/public/internal.js, ../util.js, ./any.js, ./astro/factory.js, ./astro/head-and-content.js, ./common.js, ./slot.js.
Where is instance.ts in the architecture?
instance.ts is located at packages/astro/src/runtime/server/render/astro/instance.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/runtime/server/render/astro).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free