@astrojs/vue
Advanced tools
Comparing version 2.1.1 to 2.2.0
{ | ||
"name": "@astrojs/vue", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Use Vue components within Astro", | ||
@@ -30,2 +30,8 @@ "type": "module", | ||
}, | ||
"files": [ | ||
"dist", | ||
"client.js", | ||
"server.js", | ||
"static-html.js" | ||
], | ||
"dependencies": { | ||
@@ -39,12 +45,12 @@ "@vitejs/plugin-vue": "^4.0.0", | ||
"@types/chai": "^4.3.3", | ||
"astro": "2.2.0", | ||
"astro-scripts": "0.0.14", | ||
"chai": "^4.3.6", | ||
"linkedom": "^0.14.17", | ||
"mocha": "^9.2.2", | ||
"vite": "^4.2.1", | ||
"vue": "^3.2.37" | ||
"vite": "^4.3.1", | ||
"vue": "^3.2.37", | ||
"astro": "2.5.0", | ||
"astro-scripts": "0.0.14" | ||
}, | ||
"peerDependencies": { | ||
"astro": "^2.2.0", | ||
"astro": "^2.5.0", | ||
"vue": "^3.2.30" | ||
@@ -51,0 +57,0 @@ }, |
@@ -10,6 +10,12 @@ import { h, createSSRApp } from 'vue'; | ||
async function renderToStaticMarkup(Component, props, slotted) { | ||
async function renderToStaticMarkup(Component, props, slotted, metadata) { | ||
const slots = {}; | ||
for (const [key, value] of Object.entries(slotted)) { | ||
slots[key] = () => h(StaticHtml, { value, name: key === 'default' ? undefined : key }); | ||
slots[key] = () => | ||
h(StaticHtml, { | ||
value, | ||
name: key === 'default' ? undefined : key, | ||
// Adjust how this is hydrated only when the version of Astro supports `astroStaticSlot` | ||
hydrate: metadata.astroStaticSlot ? !!metadata.hydrate : true, | ||
}); | ||
} | ||
@@ -25,2 +31,3 @@ const app = createSSRApp({ render: () => h(Component, props, slots) }); | ||
renderToStaticMarkup, | ||
supportsAstroStaticSlot: true, | ||
}; |
@@ -13,6 +13,8 @@ import { h, defineComponent } from 'vue'; | ||
name: String, | ||
hydrate: Boolean, | ||
}, | ||
setup({ name, value }) { | ||
setup({ name, value, hydrate }) { | ||
if (!value) return () => null; | ||
return () => h('astro-slot', { name, innerHTML: value }); | ||
let tagName = hydrate ? 'astro-slot' : 'astro-static-slot'; | ||
return () => h(tagName, { name, innerHTML: value }); | ||
}, | ||
@@ -19,0 +21,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18099
10
241