Skip to content

Commit

Permalink
Merge pull request #208 from QwikDev/fixed-virtual
Browse files Browse the repository at this point in the history
Fixed virtual
  • Loading branch information
thejackshelton authored Jan 4, 2025
2 parents 407983f + 4d34b2b commit 767e3f9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-snakes-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@qwikdev/astro": patch
---

fix: support for Astro navigate function and virtual modules
2 changes: 1 addition & 1 deletion libs/qwikdev-astro/q-astro-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"manifestHash":"uvwr9a","symbols":{"s_Jkq4JnSu3vc":{"origin":"components/qwik/counter.tsx","displayName":"counter.tsx_Counter_component","canonicalFilename":"counter.tsx_Counter_component_Jkq4JnSu3vc","hash":"Jkq4JnSu3vc","ctxKind":"function","ctxName":"component$","captures":false,"loc":[121,301]},"s_o0dE1oWgGK4":{"origin":"../../../libs/qwikdev-astro/src/root.tsx","displayName":"root.tsx_root_component","canonicalFilename":"root.tsx_root_component_o0dE1oWgGK4","hash":"o0dE1oWgGK4","ctxKind":"function","ctxName":"component$","captures":false,"loc":[81,136]},"s_WTj7Z5OCKjk":{"origin":"components/qwik/counter.tsx","displayName":"counter.tsx_Counter_component_button_onClick","canonicalFilename":"counter.tsx_Counter_component_button_onClick_WTj7Z5OCKjk","hash":"WTj7Z5OCKjk","ctxKind":"eventHandler","ctxName":"onClick$","captures":true,"parent":"s_Jkq4JnSu3vc","loc":[226,247]}},"mapping":{"s_Jkq4JnSu3vc":"q-gxfui5gO.js","s_o0dE1oWgGK4":"q-BVmDhJRY.js","s_WTj7Z5OCKjk":"q-D0icCluT.js"},"bundles":{"q-BVmDhJRY.js":{"size":61649,"origins":["../../libs/qwikdev-astro/src/root.tsx_root_component_o0dE1oWgGK4.js","../../node_modules/.pnpm/@[email protected][email protected]_@[email protected][email protected][email protected]_/node_modules/@builder.io/qwik/dist/core.prod.mjs","@builder.io/qwik/build"],"symbols":["s_o0dE1oWgGK4"]},"q-C4FN6EFX.js":{"size":184,"imports":["q-BVmDhJRY.js","q-D0icCluT.js"],"dynamicImports":["q-BVmDhJRY.js"],"origins":["../../libs/qwikdev-astro/src/root.tsx"]},"q-CyizIga3.js":{"size":171,"imports":["q-BVmDhJRY.js","q-D0icCluT.js"],"dynamicImports":["q-gxfui5gO.js"],"origins":["src/components/qwik/counter.tsx"]},"q-D0icCluT.js":{"size":1610,"imports":["q-BVmDhJRY.js"],"origins":["src/components/qwik/counter.tsx_Counter_component_Jkq4JnSu3vc.js","src/components/qwik/counter.tsx_Counter_component_button_onClick_WTj7Z5OCKjk.js"],"symbols":["s_WTj7Z5OCKjk"]},"q-gxfui5gO.js":{"size":88,"imports":["q-BVmDhJRY.js","q-D0icCluT.js"],"symbols":["s_Jkq4JnSu3vc"]}},"injections":[],"version":"1","options":{"target":"client","buildMode":"production","entryStrategy":{"type":"smart"}},"platform":{"qwik":"1.12.0","vite":"","rollup":"4.29.1","env":"node","os":"linux","node":"22.12.0"}}
{"manifestHash":"dxopp8","symbols":{"s_Jkq4JnSu3vc":{"origin":"components/qwik/counter.tsx","displayName":"counter.tsx_s","canonicalFilename":"counter.tsx_s_Jkq4JnSu3vc","hash":"Jkq4JnSu3vc","ctxKind":"function","ctxName":"component$","captures":false,"loc":[929,942]},"s_o0dE1oWgGK4":{"origin":"../../../libs/qwikdev-astro/src/root.tsx","displayName":"root.tsx_root_component","canonicalFilename":"root.tsx_root_component_o0dE1oWgGK4","hash":"o0dE1oWgGK4","ctxKind":"function","ctxName":"component$","captures":false,"loc":[81,136]},"s_WTj7Z5OCKjk":{"origin":"components/qwik/counter.tsx","displayName":"counter.tsx_s","canonicalFilename":"counter.tsx_s_WTj7Z5OCKjk","hash":"WTj7Z5OCKjk","ctxKind":"function","ctxName":"_jsxQ","captures":true,"loc":[626,639]}},"mapping":{"s_Jkq4JnSu3vc":"q-CbgFd24z.js","s_o0dE1oWgGK4":"q-BVmDhJRY.js","s_WTj7Z5OCKjk":"q-BUgo_UOC.js"},"bundles":{"q-BUgo_UOC.js":{"size":93,"imports":["q-BVmDhJRY.js","q-CbgFd24z.js"],"origins":["src/components/qwik/counter.tsx_s_WTj7Z5OCKjk.js"],"symbols":["s_WTj7Z5OCKjk"]},"q-BVmDhJRY.js":{"size":61649,"origins":["../../libs/qwikdev-astro/src/root.tsx_root_component_o0dE1oWgGK4.js","../../node_modules/.pnpm/@[email protected][email protected]_@[email protected][email protected][email protected]_/node_modules/@builder.io/qwik/dist/core.prod.mjs","@builder.io/qwik/build"],"symbols":["s_o0dE1oWgGK4"]},"q-BZLo5_WJ.js":{"size":146,"imports":["q-BVmDhJRY.js","q-CbgFd24z.js"]},"q-C3ZwI676.js":{"size":184,"imports":["q-BVmDhJRY.js","q-CbgFd24z.js"],"dynamicImports":["q-BVmDhJRY.js"],"origins":["../../libs/qwikdev-astro/src/root.tsx"]},"q-CbgFd24z.js":{"size":1694,"imports":["q-BVmDhJRY.js"],"dynamicImports":["q-BUgo_UOC.js"],"origins":["src/components/qwik/counter.tsx","src/components/qwik/counter.tsx_s_Jkq4JnSu3vc.js"],"symbols":["s_Jkq4JnSu3vc"]}},"injections":[],"version":"1","options":{"target":"client","buildMode":"production","entryStrategy":{"type":"smart"}},"platform":{"qwik":"1.12.0","vite":"","rollup":"4.29.1","env":"node","os":"darwin","node":"22.12.0"}}
38 changes: 36 additions & 2 deletions libs/qwikdev-astro/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default defineIntegration({
let serverDir = "";
let outDir = "";
let finalDir = "";
let astroVite: InlineConfig;

let resolveEntrypoints: () => void;
const entrypointsReady = new Promise<void>((resolve) => {
Expand Down Expand Up @@ -233,6 +234,10 @@ export default defineIntegration({
astroConfig = config;
},

"astro:build:setup": async ({ vite }) => {
astroVite = vite as InlineConfig;
},

"astro:build:ssr": async () => {
await entrypointsReady;

Expand All @@ -259,10 +264,39 @@ export default defineIntegration({
debug: options?.debug ?? false
};

// client build -> passed into server build
// determine which plugins from core to keep
const astroPlugins = (
astroVite.plugins?.flatMap((p) => (Array.isArray(p) ? p : [p])) ?? []
)
.filter((plugin): plugin is { name: string } & NonNullable<PluginOption> => {
return plugin != null && typeof plugin === "object" && "name" in plugin;
})
.filter((plugin) => {
const isCoreBuildPlugin = plugin.name === "astro:build";
const isAstroInternalPlugin = plugin.name.includes("@astro");
const isAllowedPlugin =
plugin.name === "astro:transitions" || plugin.name.includes("virtual");
const isAstroBuildPlugin = plugin.name.startsWith("astro:build");
const isQwikPlugin =
plugin.name === "vite-plugin-qwik" ||
plugin.name === "vite-plugin-qwik-post" ||
plugin.name === "overrideEsbuild";

if (isAllowedPlugin) {
return true;
}

return !(
isCoreBuildPlugin ||
isAstroInternalPlugin ||
isAstroBuildPlugin ||
isQwikPlugin
);
});

await build({
...astroConfig?.vite,
plugins: [qwikVite(qwikClientConfig)],
plugins: [...astroPlugins, qwikVite(qwikClientConfig)],
build: {
...astroConfig?.vite?.build,
ssr: false,
Expand Down

0 comments on commit 767e3f9

Please sign in to comment.