refactor: optimise dependencies (#14951)

Co-authored-by: matthewp <361671+matthewp@users.noreply.github.com>
This commit is contained in:
Emanuele Stoppa
2025-12-04 09:42:16 +00:00
committed by GitHub
parent 71d2382296
commit 98144fbd96
16 changed files with 455 additions and 139 deletions

View File

@@ -104,3 +104,14 @@ export const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
// The folder name where to find the middleware
export const MIDDLEWARE_PATH_SEGMENT_NAME = 'middleware';
// The environments used inside Astro
export const ASTRO_VITE_ENVIRONMENT_NAMES = {
server: 'ssr',
client: 'client',
astro: 'astro',
prerender: 'prerender',
} as const;
export type AstroEnvironmentNames =
(typeof ASTRO_VITE_ENVIRONMENT_NAMES)[keyof typeof ASTRO_VITE_ENVIRONMENT_NAMES];

View File

@@ -1,6 +1,5 @@
import nodeFs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { convertPathToPattern } from 'tinyglobby';
import * as vite from 'vite';
import { crawlFrameworkPkgs } from 'vitefu';
import { vitePluginActions } from '../actions/vite-plugin-actions.js';
@@ -50,6 +49,7 @@ import { joinPaths } from './path.js';
import { vitePluginServerIslands } from './server-islands/vite-plugin-server-islands.js';
import { vitePluginSessionDriver } from './session/vite-plugin.js';
import { isObject } from './util.js';
import { vitePluginEnvironment } from '../vite-plugin-environment/index.js';
type CreateViteOptions = {
settings: AstroSettings;
@@ -67,30 +67,6 @@ type CreateViteOptions = {
}
);
const ALWAYS_NOEXTERNAL = [
// This is only because Vite's native ESM doesn't resolve "exports" correctly.
'astro',
// Vite fails on nested `.astro` imports without bundling
'astro/components',
// Handle recommended nanostores. Only @nanostores/preact is required from our testing!
// Full explanation and related bug report: https://github.com/withastro/astro/pull/3667
'@nanostores/preact',
// fontsource packages are CSS that need to be processed
'@fontsource/*',
];
// These specifiers are usually dependencies written in CJS, but loaded through Vite's transform
// pipeline, which Vite doesn't support in development time. This hardcoded list temporarily
// fixes things until Vite can properly handle them, or when they support ESM.
const ONLY_DEV_EXTERNAL = [
// Imported by `@astrojs/prism` which exposes `<Prism/>` that is processed by Vite
'prismjs/components/index.js',
// Imported by `astro/assets` -> `packages/astro/src/core/logger/core.ts`
'string-width',
// Imported by `astro:transitions` -> packages/astro/src/runtime/server/transition.ts
'cssesc',
];
/** Return a base vite config as a common starting point for all Vite commands. */
export async function createVite(
commandConfig: vite.InlineConfig,
@@ -128,7 +104,6 @@ export async function createVite(
},
});
const srcDirPattern = convertPathToPattern(fileURLToPath(settings.config.srcDir));
const envLoader = createEnvLoader({
mode,
config: settings.config,
@@ -143,16 +118,12 @@ export async function createVite(
clearScreen: false, // we want to control the output, not Vite
customLogger: createViteLogger(logger, settings.config.vite.logLevel),
appType: 'custom',
optimizeDeps: {
// Scan for component code within `srcDir`
entries: [`${srcDirPattern}**/*.{jsx,tsx,vue,svelte,html,astro}`],
exclude: ['astro', 'node-fetch'],
},
plugins: [
serializedManifestPlugin({ settings, command, sync }),
vitePluginRenderers({ settings }),
await astroPluginRoutes({ routesList, settings, logger, fsMod: fs }),
astroVirtualManifestPlugin(),
vitePluginEnvironment({ settings, astroPkgsConfig, command }),
pluginPage({ routesList }),
pluginPages({ routesList }),
configAliasVitePlugin({ settings }),
@@ -233,12 +204,6 @@ export async function createVite(
replacement: 'astro/components',
},
],
// Astro imports in third-party packages should use the same version as root
dedupe: ['astro'],
},
ssr: {
noExternal: [...ALWAYS_NOEXTERNAL, ...astroPkgsConfig.ssr.noExternal],
external: [...(command === 'dev' ? ONLY_DEV_EXTERNAL : []), ...astroPkgsConfig.ssr.external],
},
build: { assetsDir: settings.config.build.assets },
environments: {

View File

@@ -35,6 +35,7 @@ export type {
export type { AstroIntegrationLogger } from '../../core/logger/core.js';
export { AstroSession } from '../../core/session.js';
export type { ToolbarServerHelpers } from '../../runtime/client/dev-toolbar/helpers.js';
export type { AstroEnvironmentNames } from '../../core/constants.js';
export type * from './common.js';
export type * from './config.js';
export type * from './content.js';

View File

@@ -0,0 +1,94 @@
import type * as vite from 'vite';
import type { AstroSettings } from '../types/astro.js';
import type { CrawlFrameworkPkgsResult } from 'vitefu';
import type { EnvironmentOptions } from 'vite';
import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../core/constants.js';
import { convertPathToPattern } from 'tinyglobby';
import { fileURLToPath } from 'node:url';
// These specifiers are usually dependencies written in CJS, but loaded through Vite's transform
// pipeline, which Vite doesn't support in development time. This hardcoded list temporarily
// fixes things until Vite can properly handle them, or when they support ESM.
const ONLY_DEV_EXTERNAL = [
// Imported by `@astrojs/prism` which exposes `<Prism/>` that is processed by Vite
'prismjs/components/index.js',
// Imported by `astro/assets` -> `packages/astro/src/core/logger/core.ts`
'string-width',
// Imported by `astro:transitions` -> packages/astro/src/runtime/server/transition.ts
'cssesc',
];
const ALWAYS_NOEXTERNAL = [
// This is only because Vite's native ESM doesn't resolve "exports" correctly.
'astro',
// Vite fails on nested `.astro` imports without bundling
'astro/components',
// Handle recommended nanostores. Only @nanostores/preact is required from our testing!
// Full explanation and related bug report: https://github.com/withastro/astro/pull/3667
'@nanostores/preact',
// fontsource packages are CSS that need to be processed
'@fontsource/*',
];
interface Payload {
command: 'dev' | 'build';
settings: AstroSettings;
astroPkgsConfig: CrawlFrameworkPkgsResult;
}
/**
* This plugin is responsible of setting up the environments of the vite server, such as
* dependencies, SSR, etc.
*
*/
export function vitePluginEnvironment({
command,
settings,
astroPkgsConfig,
}: Payload): vite.Plugin {
const srcDirPattern = convertPathToPattern(fileURLToPath(settings.config.srcDir));
return {
name: 'astro:environment',
configEnvironment(environmentName, _options): EnvironmentOptions {
const finalEnvironmentOptions: EnvironmentOptions = {
resolve: {
// Astro imports in third-party packages should use the same version as root
dedupe: ['astro'],
},
};
if (
environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.server ||
environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.astro ||
environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.prerender ||
environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.client
) {
if (_options.resolve?.noExternal !== true) {
finalEnvironmentOptions.resolve!.noExternal = [
...ALWAYS_NOEXTERNAL,
...astroPkgsConfig.ssr.noExternal,
];
finalEnvironmentOptions.resolve!.external = [
...(command === 'dev' ? ONLY_DEV_EXTERNAL : []),
...astroPkgsConfig.ssr.external,
];
}
if (_options.optimizeDeps?.noDiscovery === false) {
finalEnvironmentOptions.optimizeDeps = {
entries: [`${srcDirPattern}**/*.{jsx,tsx,vue,svelte,html,astro}`],
exclude: ['astro', 'node-fetch'],
};
}
}
if (environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.client) {
finalEnvironmentOptions.optimizeDeps = {
// Astro files can't be rendered on the client
entries: [`${srcDirPattern}**/*.{jsx,tsx,vue,svelte,html}`],
};
}
return finalEnvironmentOptions;
},
};
}

View File

@@ -17,7 +17,6 @@ import type {
IntegrationResolvedRoute,
} from 'astro';
import type { PluginOption } from 'vite';
import { defaultClientConditions } from 'vite';
import { cloudflareModuleLoader } from './utils/cloudflare-module-loader.js';
import { createRoutesFile, getParts } from './utils/generate-routes-json.js';
import { type ImageService, setImageConfig } from './utils/image-config.js';
@@ -211,20 +210,13 @@ export default function createIntegration(args?: Options): AstroIntegration {
},
session,
vite: {
ssr: {
optimizeDeps: {
// Disabled to prevent "prebundle" errors on first dev
// This can be removed when the issue is resolved with Cloudflare
noDiscovery: true,
},
},
plugins: [
cfVitePlugin(cfPluginConfig),
// https://developers.cloudflare.com/pages/functions/module-support/
// Allows imports of '.wasm', '.bin', and '.txt' file types
cloudflareModulePlugin,
{
name: 'vite:cf-imports',
name: '@astrojs/cloudflare:cf-imports',
enforce: 'pre',
resolveId(source) {
if (source.startsWith('cloudflare:')) {
@@ -233,9 +225,21 @@ export default function createIntegration(args?: Options): AstroIntegration {
return null;
},
},
{
name: '@astrojs/cloudflare:environment',
configEnvironment(environmentName, _options) {
if (environmentName === 'ssr' && _options.optimizeDeps?.noDiscovery === false) {
return {
optimizeDeps: {
exclude: ['unstorage/drivers/cloudflare-kv-binding'],
},
};
}
},
},
{
enforce: 'post',
name: 'vite:cf-externals',
name: '@astrojs/cloudflare:cf-externals',
applyToEnvironment: (environment) => environment.name === 'ssr',
config(conf) {
if (conf.ssr) {
@@ -256,7 +260,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
addWatchFile(new URL('./wrangler.toml', config.root));
addWatchFile(new URL('./wrangler.json', config.root));
addWatchFile(new URL('./wrangler.jsonc', config.root));
},
'astro:routes:resolved': ({ routes }) => {
_routes = routes;
@@ -314,7 +317,9 @@ export default function createIntegration(args?: Options): AstroIntegration {
const parsed = parse(data);
Object.assign(process.env, parsed);
} catch {
logger.error(`Unable to parse .dev.vars, variables will not be available to your application.`);
logger.error(
`Unable to parse .dev.vars, variables will not be available to your application.`,
);
}
}
},
@@ -322,41 +327,18 @@ export default function createIntegration(args?: Options): AstroIntegration {
if (target === 'server') {
vite.resolve ||= {};
vite.resolve.alias ||= {};
const aliases = [
{
find: 'react-dom/server',
replacement: 'react-dom/server.browser',
},
];
if (Array.isArray(vite.resolve.alias)) {
vite.resolve.alias = [...vite.resolve.alias, ...aliases];
} else {
for (const alias of aliases) {
(vite.resolve.alias as Record<string, string>)[alias.find] = alias.replacement;
}
}
// Support `workerd` and `worker` conditions for the ssr environment
// (previously supported in esbuild instead: https://github.com/withastro/astro/pull/7092)
vite.ssr ||= {};
vite.ssr.resolve ||= {};
vite.ssr.resolve.conditions ||= [...defaultClientConditions];
vite.ssr.resolve.conditions.push('workerd', 'worker');
vite.ssr.target = 'webworker';
vite.ssr.noExternal = true;
vite.build ||= {};
vite.build.rollupOptions ||= {};
vite.build.rollupOptions.output ||= {};
vite.build.rollupOptions.external = ['sharp'];
// @ts-expect-error
vite.build.rollupOptions.output.banner ||=
'globalThis.process ??= {}; globalThis.process.env ??= {};';
vite.build.rollupOptions.external = ['sharp'];
// Cloudflare env is only available per request. This isn't feasible for code that access env vars
// in a global way, so we shim their access as `process.env.*`. This is not the recommended way for users to access environment variables. But we'll add this for compatibility for chosen variables. Mainly to support `@astrojs/db`
vite.define = {

View File

@@ -16,13 +16,13 @@ describe('ExternalImageService', () => {
});
await fixture.build();
});
after(async () => {
// await fixture.clean();
})
});
it('has correct image service', async () => {
const files = await glob('**/index.mjs', {
const files = await glob('**/image-service*', {
cwd: fileURLToPath(new URL('dist/_worker.js', root)),
filesOnly: true,
absolute: true,

View File

@@ -1,10 +1,10 @@
// @ts-check
import cloudflare from '@astrojs/cloudflare';
import { defineConfig, envField, fontProviders } from 'astro/config';
import mdx from '@astrojs/mdx';
import { fileURLToPath } from 'node:url';
import react from '@astrojs/react';
import vue from "@astrojs/vue"
export default defineConfig({
adapter: cloudflare({
@@ -32,7 +32,7 @@ export default defineConfig({
"fr": "en"
}
},
integrations: [mdx(), react()],
integrations: [mdx(), react(), vue()],
env: {
schema: {
FOO: envField.string({ context: 'server', access: 'public' }),

View File

@@ -10,6 +10,9 @@
"@astrojs/cloudflare": "workspace:*",
"@astrojs/mdx": "^4.3.5",
"@astrojs/react": "workspace:*",
"@astrojs/vue": "workspace:*",
"vue": "^3.5.25",
"@vitejs/plugin-vue": "^6.0.2",
"@types/react": "^18.3.24",
"@types/react-dom": "^18.3.7",
"astro": "workspace:*",

View File

@@ -0,0 +1,3 @@
<template>
<p>Hello from vue component</p>
</template>

View File

@@ -3,6 +3,7 @@ export const prerender = false;
import { getCollection, getEntry, render } from 'astro:content';
import Hello from '../components/Hello.tsx';
import HelloVue from '../components/Hello.vue';
import Island from '../components/Island.astro';
import IslandProps from '../components/IslandProps.astro';
import { Font } from 'astro:assets';
@@ -45,6 +46,7 @@ const surnamne = Astro.url.searchParams.get('surname');
<p>Running on: {workerRuntime ?? 'unknown runtime'}</p>
<div id="framework">
<Hello client:load />
<HelloVue client:load />
</div>
<Island server:defer/>
<IslandProps server:defer name="Aria" surname={surnamne}/>

View File

@@ -1,6 +1,7 @@
import { fileURLToPath } from 'node:url';
import { preact, type PreactPluginOptions as VitePreactPluginOptions } from '@preact/preset-vite';
import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro';
import type { EnvironmentOptions, Plugin } from 'vite';
const babelCwd = new URL('../', import.meta.url);
@@ -33,29 +34,9 @@ export default function ({ include, exclude, compat, devtools }: Options = {}):
},
});
const viteConfig: ViteUserConfig = {
optimizeDeps: {
include: ['@astrojs/preact/client.js', 'preact', 'preact/jsx-runtime'],
exclude: ['@astrojs/preact/server.js'],
},
};
const viteConfig: ViteUserConfig = {};
if (compat) {
viteConfig.optimizeDeps!.include!.push(
'preact/compat',
'preact/test-utils',
'preact/compat/jsx-runtime',
);
viteConfig.resolve = {
dedupe: ['preact/compat', 'preact'],
};
// noExternal React entrypoints to be bundled, resolved, and aliased by Vite
viteConfig.ssr = {
noExternal: ['react', 'react-dom', 'react-dom/test-utils', 'react/jsx-runtime'],
};
}
viteConfig.plugins = [preactPlugin];
viteConfig.plugins = [preactPlugin, configEnvironmentPlugin(compat)];
addRenderer(getRenderer(command === 'dev'));
updateConfig({
@@ -81,3 +62,53 @@ export default function ({ include, exclude, compat, devtools }: Options = {}):
},
};
}
function configEnvironmentPlugin(compat: boolean | undefined): Plugin {
return {
name: '@astrojs/preact:environment',
configEnvironment(environmentName, options) {
const environmentOptions: EnvironmentOptions = {
optimizeDeps: {
exclude: ['@astrojs/preact/server.js'],
},
resolve: {},
};
if (environmentName === 'client') {
environmentOptions.optimizeDeps!.include = [
'@astrojs/preact/client.js',
'preact',
'preact/jsx-runtime',
];
}
if (compat) {
environmentOptions.resolve = {
dedupe: ['preact/compat', 'preact'],
};
if (environmentName === 'client') {
environmentOptions.optimizeDeps!.include!.push(
'preact/compat',
'preact/test-utils',
'preact/compat/jsx-runtime',
);
}
if (
!options.resolve?.noExternal &&
(environmentName === 'ssr' || environmentName === 'prerender')
) {
// noExternal React entrypoints to be bundled, resolved, and aliased by Vite
environmentOptions.resolve!.noExternal = [
'react',
'react-dom',
'react-dom/test-utils',
'react/jsx-runtime',
];
}
}
return environmentOptions;
},
};
}

View File

@@ -7,6 +7,7 @@ import {
type ReactVersionConfig,
versionsConfig,
} from './version.js';
import type { EnvironmentOptions } from 'vite';
export type ReactIntegrationOptions = Pick<
ViteReactPluginOptions,
@@ -69,16 +70,13 @@ function getViteConfiguration(
reactConfig: ReactVersionConfig,
) {
return {
optimizeDeps: {
include: [reactConfig.client],
exclude: [reactConfig.server],
},
plugins: [
react({ include, exclude, babel }),
optionsPlugin({
experimentalReactChildren: !!experimentalReactChildren,
experimentalDisableStreaming: !!experimentalDisableStreaming,
}),
configEnvironmentPlugin(reactConfig),
],
ssr: {
noExternal: [
@@ -93,6 +91,54 @@ function getViteConfiguration(
};
}
function configEnvironmentPlugin(reactConfig: ReactVersionConfig): vite.Plugin {
return {
name: '@astrojs/react:environment',
configEnvironment(environmentName, options): EnvironmentOptions {
const finalOptions: EnvironmentOptions = {
resolve: {
dedupe: ['react', 'react-dom'],
},
optimizeDeps: {},
};
if (
environmentName === 'client' ||
((environmentName === 'ssr' || environmentName === 'prerender') &&
options.optimizeDeps?.noDiscovery === false)
) {
// SAFETY: we initialized it before
finalOptions.optimizeDeps!.include = [
'react',
'react/jsx-runtime',
'react/jsx-dev-runtime',
'react-dom',
];
finalOptions.optimizeDeps!.exclude = [reactConfig.server];
if (environmentName === 'ssr' || environmentName === 'prerender') {
finalOptions.optimizeDeps!.include.push('react-dom/server');
if (!options.resolve?.noExternal) {
finalOptions.resolve!.noExternal = [
// These are all needed to get mui to work.
'@mui/material',
'@mui/base',
'@babel/runtime',
'use-immer',
'@material-tailwind/react',
];
}
}
if (environmentName === 'client') {
finalOptions.optimizeDeps!.include.push('react-dom/client');
finalOptions.optimizeDeps!.include.push(reactConfig.client);
}
}
return finalOptions;
},
};
}
export default function ({
include,
exclude,

View File

@@ -1,5 +1,5 @@
import type { AstroIntegration, AstroIntegrationLogger, AstroRenderer } from 'astro';
import type { PluginOption, UserConfig } from 'vite';
import type { PluginOption, UserConfig, Plugin } from 'vite';
import solid, { type Options as ViteSolidPluginOptions } from 'vite-plugin-solid';
// TODO: keep in sync with https://github.com/thetarnav/solid-devtools/blob/main/packages/main/src/vite/index.ts#L7
@@ -45,11 +45,7 @@ function getViteConfiguration(
devtoolsPlugin: DevtoolsPlugin | null,
) {
const config: UserConfig = {
optimizeDeps: {
include: ['@astrojs/solid-js/client.js'],
exclude: ['@astrojs/solid-js/server.js'],
},
plugins: [solid({ include, exclude, ssr: true })],
plugins: [solid({ include, exclude, ssr: true }), configEnvironmentPlugin()],
};
if (devtoolsPlugin) {
@@ -113,3 +109,17 @@ export default function (options: Options = {}): AstroIntegration {
},
};
}
function configEnvironmentPlugin(): Plugin {
return {
name: '@astrojs/solid:config-environment',
configEnvironment(environmentName) {
return {
optimizeDeps: {
include: environmentName === 'client' ? ['@astrojs/solid-js/client.js'] : [],
exclude: ['@astrojs/solid-js/server.js'],
},
};
},
};
}

View File

@@ -1,6 +1,7 @@
import type { Options } from '@sveltejs/vite-plugin-svelte';
import { svelte, vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import type { AstroIntegration, AstroRenderer } from 'astro';
import type { Plugin } from 'vite';
function getRenderer(): AstroRenderer {
return {
@@ -20,11 +21,7 @@ export default function svelteIntegration(options?: Options): AstroIntegration {
addRenderer(getRenderer());
updateConfig({
vite: {
optimizeDeps: {
include: ['@astrojs/svelte/client.js'],
exclude: ['@astrojs/svelte/server.js'],
},
plugins: [svelte(options)],
plugins: [svelte(options), configEnvironmentPlugin()],
},
});
},
@@ -32,4 +29,18 @@ export default function svelteIntegration(options?: Options): AstroIntegration {
};
}
function configEnvironmentPlugin(): Plugin {
return {
name: '@astrojs/svelte:config-environment',
configEnvironment(environmentName) {
return {
optimizeDeps: {
exclude: ['@astrojs/svelte/server.js'],
includes: environmentName === 'client' ? ['@astrojs/svelte/client.js'] : [],
},
};
},
};
}
export { vitePreprocess };

View File

@@ -4,7 +4,7 @@ import vue from '@vitejs/plugin-vue';
import type { Options as VueJsxOptions } from '@vitejs/plugin-vue-jsx';
import { MagicString } from '@vue/compiler-sfc';
import type { AstroIntegration, AstroRenderer, HookParameters } from 'astro';
import type { Plugin, UserConfig } from 'vite';
import type { EnvironmentOptions, Plugin, UserConfig } from 'vite';
import type { VitePluginVueDevToolsOptions } from 'vite-plugin-vue-devtools';
const VIRTUAL_MODULE_ID = 'virtual:@astrojs/vue/app';
@@ -113,16 +113,7 @@ async function getViteConfiguration(
vueOptions.compiler ??= await import('vue/compiler-sfc');
const config: UserConfig = {
optimizeDeps: {
// We add `vue` here as `@vitejs/plugin-vue` doesn't add it and we want to prevent
// re-optimization if the `vue` import is only encountered later.
include: ['@astrojs/vue/client.js', 'vue'],
exclude: ['@astrojs/vue/server.js', VIRTUAL_MODULE_ID],
},
plugins: [vue(vueOptions), virtualAppEntrypoint(vueOptions)],
ssr: {
noExternal: ['vuetify', 'vueperslides', 'primevue'],
},
plugins: [vue(vueOptions), virtualAppEntrypoint(vueOptions), configEnvironmentPlugin()],
};
if (options?.jsx) {
@@ -135,6 +126,7 @@ async function getViteConfiguration(
const vueDevTools = (await import('vite-plugin-vue-devtools')).default;
const devToolsOptions = typeof options.devtools === 'object' ? options.devtools : {};
config.plugins?.push(
configEnvironmentPlugin(),
vueDevTools({
...devToolsOptions,
appendTo: VIRTUAL_MODULE_ID,
@@ -145,6 +137,43 @@ async function getViteConfiguration(
return config;
}
function configEnvironmentPlugin(): Plugin {
return {
name: '@astrojs/vue:config-environment',
configEnvironment(environmentName, _options) {
const environmentOptions: EnvironmentOptions = {
optimizeDeps: {},
};
if (
environmentName === 'client' ||
((environmentName === 'ssr' || environmentName === 'prerender') &&
_options.optimizeDeps?.noDiscovery === false)
) {
environmentOptions.optimizeDeps!.exclude = [
'@astrojs/vue/server.js',
'vue/server-renderer',
VIRTUAL_MODULE_ID,
];
}
if (environmentName === 'client') {
environmentOptions.optimizeDeps!.include = ['@astrojs/vue/client.js', 'vue'];
}
if (
(environmentName === 'ssr' || environmentName === 'prerender') &&
_options.resolve?.noExternal !== true
) {
environmentOptions.resolve = {
external: ['vuetify', 'vueperslides', 'primevue'],
};
}
return environmentOptions;
},
};
}
export default function (options?: Options): AstroIntegration {
return {
name: '@astrojs/vue',

152
pnpm-lock.yaml generated
View File

@@ -4911,12 +4911,18 @@ importers:
'@astrojs/react':
specifier: workspace:*
version: link:../../../../react
'@astrojs/vue':
specifier: workspace:*
version: link:../../../../vue
'@types/react':
specifier: ^18.3.24
version: 18.3.26
'@types/react-dom':
specifier: ^18.3.7
version: 18.3.7(@types/react@18.3.26)
'@vitejs/plugin-vue':
specifier: ^6.0.2
version: 6.0.2(vite@7.1.12(@types/node@22.18.0)(jiti@2.6.1)(lightningcss@1.30.2)(sass@1.94.0)(tsx@4.20.6)(yaml@2.8.1))(vue@3.5.25(typescript@5.9.3))
astro:
specifier: workspace:*
version: link:../../../../../astro
@@ -4929,6 +4935,9 @@ importers:
sharp:
specifier: ^0.34.3
version: 0.34.3
vue:
specifier: ^3.5.25
version: 3.5.25(typescript@5.9.3)
packages/integrations/cloudflare/test/fixtures/with-base:
dependencies:
@@ -6004,7 +6013,7 @@ importers:
version: link:../../internal-helpers
'@vercel/analytics':
specifier: ^1.5.0
version: 1.5.0(react@19.2.0)(svelte@5.43.14)(vue@3.5.24(typescript@5.9.3))
version: 1.5.0(react@19.2.0)(svelte@5.43.14)(vue@3.5.25(typescript@5.9.3))
'@vercel/functions':
specifier: ^2.2.13
version: 2.2.13
@@ -9470,6 +9479,9 @@ packages:
'@rolldown/pluginutils@1.0.0-beta.34':
resolution: {integrity: sha512-LyAREkZHP5pMom7c24meKmJCdhf2hEyvam2q0unr3or9ydwDL+DJ8chTF6Av/RFPb3rH8UFBdMzO5MxTZW97oA==}
'@rolldown/pluginutils@1.0.0-beta.50':
resolution: {integrity: sha512-5e76wQiQVeL1ICOZVUg4LSOVYg9jyhGCin+icYozhsUzM+fHE7kddi1bdiE0jwVqTfkjba3jUFbEkoC9WkdvyA==}
'@rollup/pluginutils@4.2.1':
resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==}
engines: {node: '>= 8.0.0'}
@@ -10225,6 +10237,13 @@ packages:
vite: ^5.0.0 || ^6.0.0
vue: ^3.2.25
'@vitejs/plugin-vue@6.0.2':
resolution: {integrity: sha512-iHmwV3QcVGGvSC1BG5bZ4z6iwa1SOpAPWmnjOErd4Ske+lZua5K9TtAVdx0gMBClJ28DViCbSmZitjWZsWO3LA==}
engines: {node: ^20.19.0 || >=22.12.0}
peerDependencies:
vite: ^5.0.0 || ^6.0.0 || ^7.0.0
vue: ^3.2.25
'@vitest/expect@3.2.4':
resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==}
@@ -10375,24 +10394,36 @@ packages:
'@vue/compiler-core@3.5.24':
resolution: {integrity: sha512-eDl5H57AOpNakGNAkFDH+y7kTqrQpJkZFXhWZQGyx/5Wh7B1uQYvcWkvZi11BDhscPgj8N7XV3oRwiPnx1Vrig==}
'@vue/compiler-core@3.5.25':
resolution: {integrity: sha512-vay5/oQJdsNHmliWoZfHPoVZZRmnSWhug0BYT34njkYTPqClh3DNWLkZNJBVSjsNMrg0CCrBfoKkjZQPM/QVUw==}
'@vue/compiler-dom@3.5.22':
resolution: {integrity: sha512-W8RknzUM1BLkypvdz10OVsGxnMAuSIZs9Wdx1vzA3mL5fNMN15rhrSCLiTm6blWeACwUwizzPVqGJgOGBEN/hA==}
'@vue/compiler-dom@3.5.24':
resolution: {integrity: sha512-1QHGAvs53gXkWdd3ZMGYuvQFXHW4ksKWPG8HP8/2BscrbZ0brw183q2oNWjMrSWImYLHxHrx1ItBQr50I/q2zw==}
'@vue/compiler-dom@3.5.25':
resolution: {integrity: sha512-4We0OAcMZsKgYoGlMjzYvaoErltdFI2/25wqanuTu+S4gismOTRTBPi4IASOjxWdzIwrYSjnqONfKvuqkXzE2Q==}
'@vue/compiler-sfc@3.5.22':
resolution: {integrity: sha512-tbTR1zKGce4Lj+JLzFXDq36K4vcSZbJ1RBu8FxcDv1IGRz//Dh2EBqksyGVypz3kXpshIfWKGOCcqpSbyGWRJQ==}
'@vue/compiler-sfc@3.5.24':
resolution: {integrity: sha512-8EG5YPRgmTB+YxYBM3VXy8zHD9SWHUJLIGPhDovo3Z8VOgvP+O7UP5vl0J4BBPWYD9vxtBabzW1EuEZ+Cqs14g==}
'@vue/compiler-sfc@3.5.25':
resolution: {integrity: sha512-PUgKp2rn8fFsI++lF2sO7gwO2d9Yj57Utr5yEsDf3GNaQcowCLKL7sf+LvVFvtJDXUp/03+dC6f2+LCv5aK1ag==}
'@vue/compiler-ssr@3.5.22':
resolution: {integrity: sha512-GdgyLvg4R+7T8Nk2Mlighx7XGxq/fJf9jaVofc3IL0EPesTE86cP/8DD1lT3h1JeZr2ySBvyqKQJgbS54IX1Ww==}
'@vue/compiler-ssr@3.5.24':
resolution: {integrity: sha512-trOvMWNBMQ/odMRHW7Ae1CdfYx+7MuiQu62Jtu36gMLXcaoqKvAyh+P73sYG9ll+6jLB6QPovqoKGGZROzkFFg==}
'@vue/compiler-ssr@3.5.25':
resolution: {integrity: sha512-ritPSKLBcParnsKYi+GNtbdbrIE1mtuFEJ4U1sWeuOMlIziK5GtOL85t5RhsNy4uWIXPgk+OUdpnXiTdzn8o3A==}
'@vue/devtools-core@7.7.7':
resolution: {integrity: sha512-9z9TLbfC+AjAi1PQyWX+OErjIaJmdFlbDHcD+cAMYKY6Bh5VlsAtCeGyRMrXwIlMEQPukvnWt3gZBLwTAIMKzQ==}
peerDependencies:
@@ -10413,18 +10444,27 @@ packages:
'@vue/reactivity@3.5.24':
resolution: {integrity: sha512-BM8kBhtlkkbnyl4q+HiF5R5BL0ycDPfihowulm02q3WYp2vxgPcJuZO866qa/0u3idbMntKEtVNuAUp5bw4teg==}
'@vue/reactivity@3.5.25':
resolution: {integrity: sha512-5xfAypCQepv4Jog1U4zn8cZIcbKKFka3AgWHEFQeK65OW+Ys4XybP6z2kKgws4YB43KGpqp5D/K3go2UPPunLA==}
'@vue/runtime-core@3.5.22':
resolution: {integrity: sha512-EHo4W/eiYeAzRTN5PCextDUZ0dMs9I8mQ2Fy+OkzvRPUYQEyK9yAjbasrMCXbLNhF7P0OUyivLjIy0yc6VrLJQ==}
'@vue/runtime-core@3.5.24':
resolution: {integrity: sha512-RYP/byyKDgNIqfX/gNb2PB55dJmM97jc9wyF3jK7QUInYKypK2exmZMNwnjueWwGceEkP6NChd3D2ZVEp9undQ==}
'@vue/runtime-core@3.5.25':
resolution: {integrity: sha512-Z751v203YWwYzy460bzsYQISDfPjHTl+6Zzwo/a3CsAf+0ccEjQ8c+0CdX1WsumRTHeywvyUFtW6KvNukT/smA==}
'@vue/runtime-dom@3.5.22':
resolution: {integrity: sha512-Av60jsryAkI023PlN7LsqrfPvwfxOd2yAwtReCjeuugTJTkgrksYJJstg1e12qle0NarkfhfFu1ox2D+cQotww==}
'@vue/runtime-dom@3.5.24':
resolution: {integrity: sha512-Z8ANhr/i0XIluonHVjbUkjvn+CyrxbXRIxR7wn7+X7xlcb7dJsfITZbkVOeJZdP8VZwfrWRsWdShH6pngMxRjw==}
'@vue/runtime-dom@3.5.25':
resolution: {integrity: sha512-a4WrkYFbb19i9pjkz38zJBg8wa/rboNERq3+hRRb0dHiJh13c+6kAbgqCPfMaJ2gg4weWD3APZswASOfmKwamA==}
'@vue/server-renderer@3.5.22':
resolution: {integrity: sha512-gXjo+ao0oHYTSswF+a3KRHZ1WszxIqO7u6XwNHqcqb9JfyIL/pbWrrh/xLv7jeDqla9u+LK7yfZKHih1e1RKAQ==}
peerDependencies:
@@ -10435,6 +10475,11 @@ packages:
peerDependencies:
vue: 3.5.24
'@vue/server-renderer@3.5.25':
resolution: {integrity: sha512-UJaXR54vMG61i8XNIzTSf2Q7MOqZHpp8+x3XLGtE3+fL+nQd+k7O5+X3D/uWrnQXOdMw5VPih+Uremcw+u1woQ==}
peerDependencies:
vue: 3.5.25
'@vue/shared@3.1.5':
resolution: {integrity: sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==}
@@ -10444,6 +10489,9 @@ packages:
'@vue/shared@3.5.24':
resolution: {integrity: sha512-9cwHL2EsJBdi8NY22pngYYWzkTDhld6fAD6jlaeloNGciNSJL6bLpbxVgXl96X00Jtc6YWQv96YA/0sxex/k1A==}
'@vue/shared@3.5.25':
resolution: {integrity: sha512-AbOPdQQnAnzs58H2FrrDxYj/TJfmeS2jdfEEhgiKINy+bnOANmVizIEgq1r+C5zsbs6l1CCQxtcj71rwNQ4jWg==}
'@webcomponents/template-shadowroot@0.2.1':
resolution: {integrity: sha512-fXL/vIUakyZL62hyvUh+EMwbVoTc0hksublmRz6ai6et8znHkJa6gtqMUZo1oc7dIz46exHSIImml9QTdknMHg==}
@@ -15845,6 +15893,14 @@ packages:
typescript:
optional: true
vue@3.5.25:
resolution: {integrity: sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g==}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
walk-up-path@4.0.0:
resolution: {integrity: sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==}
engines: {node: 20 || >=22}
@@ -16517,7 +16573,7 @@ snapshots:
'@babel/generator@7.28.3':
dependencies:
'@babel/parser': 7.28.4
'@babel/parser': 7.28.5
'@babel/types': 7.28.4
'@jridgewell/gen-mapping': 0.3.13
'@jridgewell/trace-mapping': 0.3.30
@@ -16698,7 +16754,7 @@ snapshots:
'@babel/template@7.27.2':
dependencies:
'@babel/code-frame': 7.27.1
'@babel/parser': 7.28.4
'@babel/parser': 7.28.5
'@babel/types': 7.28.4
'@babel/traverse@7.28.3':
@@ -16706,7 +16762,7 @@ snapshots:
'@babel/code-frame': 7.27.1
'@babel/generator': 7.28.3
'@babel/helper-globals': 7.28.0
'@babel/parser': 7.28.4
'@babel/parser': 7.28.5
'@babel/template': 7.27.2
'@babel/types': 7.28.4
debug: 4.4.3(supports-color@8.1.1)
@@ -18482,7 +18538,7 @@ snapshots:
'@netlify/zip-it-and-ship-it@14.1.13(rollup@4.53.2)':
dependencies:
'@babel/parser': 7.28.4
'@babel/parser': 7.28.5
'@babel/types': 7.28.5
'@netlify/binary-info': 1.0.0
'@netlify/serverless-functions-api': 2.7.1
@@ -18858,6 +18914,8 @@ snapshots:
'@rolldown/pluginutils@1.0.0-beta.34': {}
'@rolldown/pluginutils@1.0.0-beta.50': {}
'@rollup/pluginutils@4.2.1':
dependencies:
estree-walker: 2.0.2
@@ -19263,7 +19321,7 @@ snapshots:
'@types/babel__template@7.4.4':
dependencies:
'@babel/parser': 7.28.4
'@babel/parser': 7.28.5
'@babel/types': 7.28.4
'@types/babel__traverse@7.28.0':
@@ -19618,11 +19676,11 @@ snapshots:
'@ungap/structured-clone@1.3.0': {}
'@vercel/analytics@1.5.0(react@19.2.0)(svelte@5.43.14)(vue@3.5.24(typescript@5.9.3))':
'@vercel/analytics@1.5.0(react@19.2.0)(svelte@5.43.14)(vue@3.5.25(typescript@5.9.3))':
optionalDependencies:
react: 19.2.0
svelte: 5.43.14
vue: 3.5.24(typescript@5.9.3)
vue: 3.5.25(typescript@5.9.3)
'@vercel/functions@2.2.13':
dependencies:
@@ -19734,6 +19792,12 @@ snapshots:
vite: 7.1.12(@types/node@22.18.0)(jiti@2.6.1)(lightningcss@1.30.2)(sass@1.94.0)(tsx@4.20.6)(yaml@2.8.1)
vue: 3.5.24(typescript@5.9.3)
'@vitejs/plugin-vue@6.0.2(vite@7.1.12(@types/node@22.18.0)(jiti@2.6.1)(lightningcss@1.30.2)(sass@1.94.0)(tsx@4.20.6)(yaml@2.8.1))(vue@3.5.25(typescript@5.9.3))':
dependencies:
'@rolldown/pluginutils': 1.0.0-beta.50
vite: 7.1.12(@types/node@22.18.0)(jiti@2.6.1)(lightningcss@1.30.2)(sass@1.94.0)(tsx@4.20.6)(yaml@2.8.1)
vue: 3.5.25(typescript@5.9.3)
'@vitest/expect@3.2.4':
dependencies:
'@types/chai': 5.2.2
@@ -19993,8 +20057,8 @@ snapshots:
'@babel/core': 7.28.3
'@babel/helper-module-imports': 7.27.1
'@babel/helper-plugin-utils': 7.27.1
'@babel/parser': 7.28.4
'@vue/compiler-sfc': 3.5.22
'@babel/parser': 7.28.5
'@vue/compiler-sfc': 3.5.24
transitivePeerDependencies:
- supports-color
@@ -20014,6 +20078,14 @@ snapshots:
estree-walker: 2.0.2
source-map-js: 1.2.1
'@vue/compiler-core@3.5.25':
dependencies:
'@babel/parser': 7.28.5
'@vue/shared': 3.5.25
entities: 4.5.0
estree-walker: 2.0.2
source-map-js: 1.2.1
'@vue/compiler-dom@3.5.22':
dependencies:
'@vue/compiler-core': 3.5.22
@@ -20024,6 +20096,11 @@ snapshots:
'@vue/compiler-core': 3.5.24
'@vue/shared': 3.5.24
'@vue/compiler-dom@3.5.25':
dependencies:
'@vue/compiler-core': 3.5.25
'@vue/shared': 3.5.25
'@vue/compiler-sfc@3.5.22':
dependencies:
'@babel/parser': 7.28.4
@@ -20048,6 +20125,18 @@ snapshots:
postcss: 8.5.6
source-map-js: 1.2.1
'@vue/compiler-sfc@3.5.25':
dependencies:
'@babel/parser': 7.28.5
'@vue/compiler-core': 3.5.25
'@vue/compiler-dom': 3.5.25
'@vue/compiler-ssr': 3.5.25
'@vue/shared': 3.5.25
estree-walker: 2.0.2
magic-string: 0.30.21
postcss: 8.5.6
source-map-js: 1.2.1
'@vue/compiler-ssr@3.5.22':
dependencies:
'@vue/compiler-dom': 3.5.22
@@ -20058,6 +20147,11 @@ snapshots:
'@vue/compiler-dom': 3.5.24
'@vue/shared': 3.5.24
'@vue/compiler-ssr@3.5.25':
dependencies:
'@vue/compiler-dom': 3.5.25
'@vue/shared': 3.5.25
'@vue/devtools-core@7.7.7(vite@6.4.1(@types/node@22.18.0)(jiti@2.6.1)(lightningcss@1.30.2)(sass@1.94.0)(tsx@4.20.6)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))':
dependencies:
'@vue/devtools-kit': 7.7.7
@@ -20108,6 +20202,10 @@ snapshots:
dependencies:
'@vue/shared': 3.5.24
'@vue/reactivity@3.5.25':
dependencies:
'@vue/shared': 3.5.25
'@vue/runtime-core@3.5.22':
dependencies:
'@vue/reactivity': 3.5.22
@@ -20118,6 +20216,11 @@ snapshots:
'@vue/reactivity': 3.5.24
'@vue/shared': 3.5.24
'@vue/runtime-core@3.5.25':
dependencies:
'@vue/reactivity': 3.5.25
'@vue/shared': 3.5.25
'@vue/runtime-dom@3.5.22':
dependencies:
'@vue/reactivity': 3.5.22
@@ -20132,6 +20235,13 @@ snapshots:
'@vue/shared': 3.5.24
csstype: 3.1.3
'@vue/runtime-dom@3.5.25':
dependencies:
'@vue/reactivity': 3.5.25
'@vue/runtime-core': 3.5.25
'@vue/shared': 3.5.25
csstype: 3.1.3
'@vue/server-renderer@3.5.22(vue@3.5.22(typescript@5.9.3))':
dependencies:
'@vue/compiler-ssr': 3.5.22
@@ -20144,12 +20254,20 @@ snapshots:
'@vue/shared': 3.5.24
vue: 3.5.24(typescript@5.9.3)
'@vue/server-renderer@3.5.25(vue@3.5.25(typescript@5.9.3))':
dependencies:
'@vue/compiler-ssr': 3.5.25
'@vue/shared': 3.5.25
vue: 3.5.25(typescript@5.9.3)
'@vue/shared@3.1.5': {}
'@vue/shared@3.5.22': {}
'@vue/shared@3.5.24': {}
'@vue/shared@3.5.25': {}
'@webcomponents/template-shadowroot@0.2.1': {}
'@whatwg-node/disposablestack@0.0.6':
@@ -21091,7 +21209,7 @@ snapshots:
detective-vue2@2.2.0(typescript@5.9.3):
dependencies:
'@dependents/detective-less': 5.0.1
'@vue/compiler-sfc': 3.5.22
'@vue/compiler-sfc': 3.5.24
detective-es6: 5.0.1
detective-sass: 6.0.1
detective-scss: 5.0.1
@@ -23686,7 +23804,7 @@ snapshots:
node-source-walk@7.0.1:
dependencies:
'@babel/parser': 7.28.4
'@babel/parser': 7.28.5
node-stream-zip@1.15.0: {}
@@ -26442,6 +26560,16 @@ snapshots:
optionalDependencies:
typescript: 5.9.3
vue@3.5.25(typescript@5.9.3):
dependencies:
'@vue/compiler-dom': 3.5.25
'@vue/compiler-sfc': 3.5.25
'@vue/runtime-dom': 3.5.25
'@vue/server-renderer': 3.5.25(vue@3.5.25(typescript@5.9.3))
'@vue/shared': 3.5.25
optionalDependencies:
typescript: 5.9.3
walk-up-path@4.0.0: {}
web-namespaces@2.0.1: {}