createAstro() — astro Function Reference
Architecture documentation for the createAstro() function in render-context.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 92ee7d0b_4309_452e_10ee_49559c26b54e["createAstro()"] b7425a46_8c1f_1122_7ae3_a00e52db1d90["RenderContext"] 92ee7d0b_4309_452e_10ee_49559c26b54e -->|defined in| b7425a46_8c1f_1122_7ae3_a00e52db1d90 a5aa2ebd_017c_5d62_5d0a_febacd4846ac["createResult()"] a5aa2ebd_017c_5d62_5d0a_febacd4846ac -->|calls| 92ee7d0b_4309_452e_10ee_49559c26b54e 0007f436_547e_7fd2_f341_1a05d84a40a6["createAstroPagePartial()"] 92ee7d0b_4309_452e_10ee_49559c26b54e -->|calls| 0007f436_547e_7fd2_f341_1a05d84a40a6 0260702f_4c0c_b790_6509_b160f26390e8["create()"] 92ee7d0b_4309_452e_10ee_49559c26b54e -->|calls| 0260702f_4c0c_b790_6509_b160f26390e8 style 92ee7d0b_4309_452e_10ee_49559c26b54e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/core/render-context.ts lines 624–663
createAstro(
result: SSRResult,
props: Record<string, any>,
slotValues: Record<string, any> | null,
apiContext: ActionAPIContext,
): AstroGlobal {
let astroPagePartial;
// During rewriting, we must recompute the Astro global, because we need to purge the previous params/props/etc.
if (this.isRewriting) {
astroPagePartial = this.#astroPagePartial = this.createAstroPagePartial(result, apiContext);
} else {
// Create page partial with static partial so they can be cached together.
astroPagePartial = this.#astroPagePartial ??= this.createAstroPagePartial(result, apiContext);
}
// Create component-level partials. `Astro.self` is added by the compiler.
const astroComponentPartial = { props, self: null };
// Create final object. `Astro.slots` will be lazily created.
const Astro: Omit<AstroGlobal, 'self' | 'slots'> = Object.assign(
Object.create(astroPagePartial),
astroComponentPartial,
);
// Handle `Astro.slots`
let _slots: AstroGlobal['slots'];
Object.defineProperty(Astro, 'slots', {
get: () => {
if (!_slots) {
_slots = new Slots(
result,
slotValues,
this.pipeline.logger,
) as unknown as AstroGlobal['slots'];
}
return _slots;
},
});
return Astro as AstroGlobal;
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does createAstro() do?
createAstro() is a function in the astro codebase, defined in packages/astro/src/core/render-context.ts.
Where is createAstro() defined?
createAstro() is defined in packages/astro/src/core/render-context.ts at line 624.
What does createAstro() call?
createAstro() calls 2 function(s): create, createAstroPagePartial.
What calls createAstro()?
createAstro() is called by 1 function(s): createResult.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free