0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
astro/packages/integrations/svelte/server.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
467 B
JavaScript
Raw Normal View History

function check(Component) {
return Component['render'] && Component['$$render'];
}
async function renderToStaticMarkup(Component, props, slotted) {
const slots = {};
for (const [key, value] of Object.entries(slotted)) {
2022-06-23 10:12:46 -05:00
slots[key] = () =>
`<astro-slot${key === 'default' ? '' : ` name="${key}"`}>${value}</astro-slot>`;
}
const { html } = Component.render(props, { $$slots: slots });
return { html };
}
export default {
check,
renderToStaticMarkup,
};