Skip to content

Commit

Permalink
grab plugins from core
Browse files Browse the repository at this point in the history
  • Loading branch information
thejackshelton committed Jan 4, 2025
1 parent 0ef74a5 commit ee297fc
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions libs/qwikdev-astro/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,23 +246,26 @@ export default defineIntegration({
debug: options?.debug ?? false
};

// determine which plugins from core to keep
const astroPlugins = (
astroVite.plugins?.flatMap((p) => (Array.isArray(p) ? p : [p])) ?? []
)
.filter(
(p): p is { name: string } & NonNullable<PluginOption> =>
p != null && typeof p === "object" && "name" in p
)
.filter(
(p) =>
// Remove the core build plugin but keep other astro plugins
p.name !== "astro:build" &&
!p.name.includes("@astro") &&
// Keep transitions and other astro plugins
(p.name === "astro:transitions" ||
p.name.includes("virtual") ||
!p.name.startsWith("astro:build"))
);
.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");

if (isAllowedPlugin) {
return true;
}

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

// client build -> passed into server build
await build({
Expand Down

0 comments on commit ee297fc

Please sign in to comment.