renderTreeNodeToFactoryResult() — astro Function Reference
Architecture documentation for the renderTreeNodeToFactoryResult() function in TreeNode.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 78a0b39d_7d92_6d49_d5cc_4d29c5f5b48b["renderTreeNodeToFactoryResult()"] a73f1f20_3c4c_06b9_4480_f1f15d6d68ab["TreeNode.ts"] 78a0b39d_7d92_6d49_d5cc_4d29c5f5b48b -->|defined in| a73f1f20_3c4c_06b9_4480_f1f15d6d68ab aa1f0bbf_df7d_1731_cad6_733b3a6a3bda["ComponentNode.factory()"] aa1f0bbf_df7d_1731_cad6_733b3a6a3bda -->|calls| 78a0b39d_7d92_6d49_d5cc_4d29c5f5b48b style 78a0b39d_7d92_6d49_d5cc_4d29c5f5b48b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/integrations/markdoc/components/TreeNode.ts lines 41–112
function renderTreeNodeToFactoryResult(result: SSRResult, treeNode: TreeNode) {
if (Array.isArray(treeNode)) {
return Promise.all(
treeNode.map((node) =>
renderComponent(result, 'ComponentNode', ComponentNode, { treeNode: node }),
),
);
}
if (treeNode.type === 'text') return render`${treeNode.content}`;
const slots = {
default: () =>
render`${treeNode.children.map((child) =>
renderComponent(result, 'ComponentNode', ComponentNode, { treeNode: child }),
)}`,
};
if (treeNode.type === 'component') {
let styles = '',
links = '',
scripts = '';
if (Array.isArray(treeNode.collectedStyles)) {
styles = treeNode.collectedStyles
.map((style: any) =>
renderUniqueStylesheet(result, {
type: 'inline',
content: style,
}),
)
.join('');
}
if (Array.isArray(treeNode.collectedLinks)) {
links = treeNode.collectedLinks
.map((link: any) => {
return renderUniqueStylesheet(result, {
type: 'external',
src: link[0] === '/' ? link : '/' + link,
});
})
.join('');
}
if (Array.isArray(treeNode.collectedScripts)) {
scripts = treeNode.collectedScripts
.map((script: any) => renderScriptElement(script))
.join('');
}
const head = unescapeHTML(styles + links + scripts);
let headAndContent = createHeadAndContent(
head,
renderTemplate`${renderComponent(
result,
treeNode.component.name,
treeNode.component,
treeNode.props,
slots,
)}`,
);
// Let the runtime know that this component is being used.
// @ts-expect-error Astro only uses `init()` so specify it only (plus `_metadata` is internal)
result._metadata.propagators.add({
init() {
return headAndContent;
},
});
return headAndContent;
}
return renderComponent(result, treeNode.tag, treeNode.tag, treeNode.attributes, slots);
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does renderTreeNodeToFactoryResult() do?
renderTreeNodeToFactoryResult() is a function in the astro codebase, defined in packages/integrations/markdoc/components/TreeNode.ts.
Where is renderTreeNodeToFactoryResult() defined?
renderTreeNodeToFactoryResult() is defined in packages/integrations/markdoc/components/TreeNode.ts at line 41.
What calls renderTreeNodeToFactoryResult()?
renderTreeNodeToFactoryResult() is called by 1 function(s): ComponentNode.factory.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free