@astrojs/vue
Advanced tools
Comparing version 4.0.7 to 4.0.8
@@ -7,3 +7,2 @@ import { h, createSSRApp, createApp, Suspense } from 'vue'; | ||
async (Component, props, slotted, { client }) => { | ||
delete props['class']; | ||
if (!element.hasAttribute('ssr')) return; | ||
@@ -10,0 +9,0 @@ |
import path from "node:path"; | ||
import vue from "@vitejs/plugin-vue"; | ||
import { MagicString } from "@vue/compiler-sfc"; | ||
function getRenderer() { | ||
@@ -29,2 +30,3 @@ return { | ||
let root; | ||
let appEntrypoint; | ||
return { | ||
@@ -37,2 +39,5 @@ name: "@astrojs/vue/virtual-app", | ||
root = config.root; | ||
if (options?.appEntrypoint) { | ||
appEntrypoint = options.appEntrypoint.startsWith(".") ? path.resolve(root, options.appEntrypoint) : options.appEntrypoint; | ||
} | ||
}, | ||
@@ -46,4 +51,3 @@ resolveId(id) { | ||
if (id === resolvedVirtualModuleId) { | ||
if (options?.appEntrypoint) { | ||
const appEntrypoint = options.appEntrypoint.startsWith(".") ? path.resolve(root, options.appEntrypoint) : options.appEntrypoint; | ||
if (appEntrypoint) { | ||
return `import * as mod from ${JSON.stringify(appEntrypoint)}; | ||
@@ -63,2 +67,18 @@ | ||
} | ||
}, | ||
// Ensure that Vue components reference appEntrypoint directly | ||
// This allows Astro to assosciate global styles imported in this file | ||
// with the pages they should be injected to | ||
transform(code, id) { | ||
if (!appEntrypoint) | ||
return; | ||
if (id.endsWith(".vue")) { | ||
const s = new MagicString(code); | ||
s.prepend(`import ${JSON.stringify(appEntrypoint)}; | ||
`); | ||
return { | ||
code: s.toString(), | ||
map: s.generateMap({ hires: "boundary" }) | ||
}; | ||
} | ||
} | ||
@@ -65,0 +85,0 @@ }; |
{ | ||
"name": "@astrojs/vue", | ||
"version": "4.0.7", | ||
"version": "4.0.8", | ||
"description": "Use Vue components within Astro", | ||
@@ -50,3 +50,3 @@ "type": "module", | ||
"vue": "^3.3.8", | ||
"astro": "4.0.9", | ||
"astro": "4.1.1", | ||
"astro-scripts": "0.0.14" | ||
@@ -53,0 +53,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
16458
291