mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
18 lines
467 B
JavaScript
18 lines
467 B
JavaScript
function check(Component) {
|
|
return Component['render'] && Component['$$render'];
|
|
}
|
|
|
|
async function renderToStaticMarkup(Component, props, slotted) {
|
|
const slots = {};
|
|
for (const [key, value] of Object.entries(slotted)) {
|
|
slots[key] = () =>
|
|
`<astro-slot${key === 'default' ? '' : ` name="${key}"`}>${value}</astro-slot>`;
|
|
}
|
|
const { html } = Component.render(props, { $$slots: slots });
|
|
return { html };
|
|
}
|
|
|
|
export default {
|
|
check,
|
|
renderToStaticMarkup,
|
|
};
|