Initial commit
This commit is contained in:
41
node_modules/@astrojs/vue/dist/server.js
generated
vendored
Normal file
41
node_modules/@astrojs/vue/dist/server.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { setup } from "virtual:@astrojs/vue/app";
|
||||
import { createSSRApp, h } from "vue";
|
||||
import { renderToString } from "vue/server-renderer";
|
||||
import { incrementId } from "./context.js";
|
||||
import StaticHtml from "./static-html.js";
|
||||
async function check(Component) {
|
||||
return !!Component["ssrRender"] || !!Component["__ssrInlineRender"];
|
||||
}
|
||||
async function renderToStaticMarkup(Component, inputProps, slotted, metadata) {
|
||||
let prefix;
|
||||
if (this && this.result) {
|
||||
prefix = incrementId(this.result);
|
||||
}
|
||||
const attrs = { prefix };
|
||||
const slots = {};
|
||||
const props = { ...inputProps };
|
||||
delete props.slot;
|
||||
for (const [key, value] of Object.entries(slotted)) {
|
||||
slots[key] = () => h(StaticHtml, {
|
||||
value,
|
||||
name: key === "default" ? void 0 : key,
|
||||
// Adjust how this is hydrated only when the version of Astro supports `astroStaticSlot`
|
||||
hydrate: metadata?.astroStaticSlot ? !!metadata.hydrate : true
|
||||
});
|
||||
}
|
||||
const app = createSSRApp({ render: () => h(Component, props, slots) });
|
||||
app.config.idPrefix = prefix;
|
||||
await setup(app);
|
||||
const html = await renderToString(app);
|
||||
return { html, attrs };
|
||||
}
|
||||
const renderer = {
|
||||
name: "@astrojs/vue",
|
||||
check,
|
||||
renderToStaticMarkup,
|
||||
supportsAstroStaticSlot: true
|
||||
};
|
||||
var server_default = renderer;
|
||||
export {
|
||||
server_default as default
|
||||
};
|
||||
Reference in New Issue
Block a user