mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Update Vite to 6.0.0 (#12524)
This commit is contained in:
parent
a2f90ced77
commit
9f440196dc
31 changed files with 697 additions and 1199 deletions
5
.changeset/breezy-brooms-count.md
Normal file
5
.changeset/breezy-brooms-count.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': major
|
||||
---
|
||||
|
||||
Bumps Vite to ^6.0.1 and handles its breaking changes
|
5
.changeset/eighty-crabs-cross.md
Normal file
5
.changeset/eighty-crabs-cross.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/solid-js': patch
|
||||
---
|
||||
|
||||
Updates vite-plugin-solid to handle Vite 6
|
5
.changeset/lemon-frogs-wait.md
Normal file
5
.changeset/lemon-frogs-wait.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/svelte': major
|
||||
---
|
||||
|
||||
Updates `@sveltejs/vite-plugin-svelte` to v5 to handle Vite 6
|
9
.changeset/slimy-jeans-train.md
Normal file
9
.changeset/slimy-jeans-train.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
'@astrojs/preact': major
|
||||
'@astrojs/svelte': major
|
||||
'@astrojs/react': major
|
||||
'@astrojs/solid-js': major
|
||||
'@astrojs/vue': major
|
||||
---
|
||||
|
||||
Updates Vite dependency to v6 to match Astro v5
|
|
@ -11,11 +11,11 @@
|
|||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^5.0.0-beta.11",
|
||||
"@astrojs/react": "^3.7.0-beta.1",
|
||||
"astro": "^5.0.0-beta.11",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"vitest": "^2.1.4"
|
||||
"vitest": "^2.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.12",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"astro": "^5.0.0-beta.11",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"canvas-confetti": "^1.9.3",
|
||||
"postcss": "^8.4.47",
|
||||
"postcss": "^8.4.49",
|
||||
"tailwindcss": "^3.4.14"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"astro": "^5.0.0-beta.11",
|
||||
"vitest": "^2.1.4"
|
||||
"vitest": "^2.1.6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,10 +72,6 @@
|
|||
"typescript-eslint": "^8.13.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"vitest>vite": "6.0.0-beta.6",
|
||||
"vite-node>vite": "6.0.0-beta.6"
|
||||
},
|
||||
"peerDependencyRules": {
|
||||
"allowAny": [
|
||||
"astro",
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"@astrojs/tailwind": "workspace:*",
|
||||
"astro": "workspace:*",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.47",
|
||||
"postcss": "^8.4.49",
|
||||
"tailwindcss": "^3.4.14"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,8 +167,8 @@
|
|||
"ultrahtml": "^1.5.3",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"vfile": "^6.0.3",
|
||||
"vite": "6.0.0-beta.6",
|
||||
"vitefu": "^1.0.3",
|
||||
"vite": "^6.0.1",
|
||||
"vitefu": "^1.0.4",
|
||||
"which-pm": "^3.0.0",
|
||||
"xxhash-wasm": "^1.0.2",
|
||||
"yargs-parser": "^21.1.1",
|
||||
|
@ -215,7 +215,7 @@
|
|||
"sass": "^1.80.6",
|
||||
"undici": "^6.20.1",
|
||||
"unified": "^11.0.5",
|
||||
"vitest": "^2.1.1"
|
||||
"vitest": "^2.1.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.1 || ^20.3.0 || >=21.0.0",
|
||||
|
|
|
@ -216,7 +216,6 @@ export async function createVite(
|
|||
replacement: 'astro/components',
|
||||
},
|
||||
],
|
||||
conditions: ['astro'],
|
||||
// Astro imports in third-party packages should use the same version as root
|
||||
dedupe: ['astro'],
|
||||
},
|
||||
|
|
|
@ -8,7 +8,7 @@ import type {
|
|||
CompileMetadata,
|
||||
} from './types.js';
|
||||
|
||||
import { normalizePath } from 'vite';
|
||||
import { defaultClientConditions, defaultServerConditions, normalizePath } from 'vite';
|
||||
import type { AstroConfig } from '../types/public/config.js';
|
||||
import { hasSpecialQueries, normalizeFilename } from '../vite-plugin-utils/index.js';
|
||||
import { type CompileAstroResult, compileAstro } from './compile.js';
|
||||
|
@ -43,6 +43,18 @@ export default function astro({ settings, logger }: AstroPluginOptions): vite.Pl
|
|||
const prePlugin: vite.Plugin = {
|
||||
name: 'astro:build',
|
||||
enforce: 'pre', // run transforms before other plugins can
|
||||
async configEnvironment(name, viteConfig, opts) {
|
||||
viteConfig.resolve ??= {};
|
||||
// Emulate Vite default fallback for `resolve.conditions` if not set
|
||||
if (viteConfig.resolve.conditions == null) {
|
||||
if (viteConfig.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {
|
||||
viteConfig.resolve.conditions = [...defaultClientConditions];
|
||||
} else {
|
||||
viteConfig.resolve.conditions = [...defaultServerConditions];
|
||||
}
|
||||
}
|
||||
viteConfig.resolve.conditions.push('astro');
|
||||
},
|
||||
configResolved(viteConfig) {
|
||||
// Initialize `compile` function to simplify usage later
|
||||
compile = (code, filename) => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import { before, describe, it } from 'node:test';
|
||||
import * as cheerio from 'cheerio';
|
||||
import { resolveConfig } from 'vite';
|
||||
import { defaultClientConditions, resolveConfig } from 'vite';
|
||||
import { getViteConfig } from '../dist/config/index.js';
|
||||
import { loadFixture } from './test-utils.js';
|
||||
|
||||
|
@ -28,9 +28,12 @@ describe('getViteConfig', () => {
|
|||
it('Does not change the default config.', async () => {
|
||||
const command = 'serve';
|
||||
const mode = 'test';
|
||||
const configFn = getViteConfig({});
|
||||
const configFn = getViteConfig({}, { logLevel: 'silent' });
|
||||
const config = await configFn({ command, mode });
|
||||
const resolvedConfig = await resolveConfig(config, command, mode);
|
||||
assert.deepStrictEqual(resolvedConfig.resolve.conditions, ['astro']);
|
||||
assert.deepStrictEqual(resolvedConfig.resolve.conditions, [
|
||||
...defaultClientConditions,
|
||||
'astro',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"@astrojs/vue": "workspace:*",
|
||||
"astro": "workspace:*",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.47",
|
||||
"postcss": "^8.4.49",
|
||||
"solid-js": "^1.9.3",
|
||||
"svelte": "^5.1.16",
|
||||
"vue": "^3.5.12"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"dependencies": {
|
||||
"@astrojs/tailwind": "workspace:*",
|
||||
"astro": "workspace:*",
|
||||
"postcss": "^8.4.47",
|
||||
"postcss": "^8.4.49",
|
||||
"tailwindcss": "^3.4.14"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"@astrojs/tailwind": "workspace:*",
|
||||
"astro": "workspace:*",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.47",
|
||||
"postcss": "^8.4.49",
|
||||
"tailwindcss": "^3.4.14"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"astro": "workspace:*",
|
||||
"vitest": "^2.1.1"
|
||||
"vitest": "^2.1.6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,6 @@
|
|||
"astro-scripts": "workspace:*",
|
||||
"cheerio": "1.0.0",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"@astrojs/check": "^0.9.4",
|
||||
"@astrojs/db": "workspace:*",
|
||||
"@astrojs/node": "^8.3.4",
|
||||
"@astrojs/react": "^3.6.2",
|
||||
"@astrojs/react": "workspace:*",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"astro": "workspace:*",
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
"@playwright/test": "1.48.2",
|
||||
"astro": "workspace:*",
|
||||
"astro-scripts": "workspace:*",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"provenance": true
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
"astro-scripts": "workspace:*",
|
||||
"devalue": "^5.1.1",
|
||||
"linkedom": "^0.18.5",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.1 || ^20.3.0 || >=21.0.0"
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
"remark-toc": "^9.0.0",
|
||||
"shiki": "^1.22.2",
|
||||
"unified": "^11.0.5",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.1 || ^20.3.0 || >=21.0.0"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
"@preact/signals": "^1.3.0",
|
||||
"babel-plugin-transform-hook-names": "^1.0.2",
|
||||
"preact-render-to-string": "^6.5.11",
|
||||
"vite": "^5.4.10"
|
||||
"vite": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "workspace:*",
|
||||
|
|
|
@ -49,9 +49,9 @@
|
|||
"test": "astro-scripts test \"test/**/*.test.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-react": "^4.3.3",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"ultrahtml": "^1.5.3",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.12",
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
"dev": "astro-scripts dev \"src/**/*.ts\""
|
||||
},
|
||||
"dependencies": {
|
||||
"vite-plugin-solid": "^2.10.2",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite-plugin-solid": "^2.11.0",
|
||||
"vite": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "workspace:*",
|
||||
|
|
|
@ -45,43 +45,15 @@ async function getDevtoolsPlugin(logger: AstroIntegrationLogger, retrieve: boole
|
|||
}
|
||||
}
|
||||
|
||||
async function getViteConfiguration(
|
||||
isDev: boolean,
|
||||
function getViteConfiguration(
|
||||
{ include, exclude }: Options,
|
||||
devtoolsPlugin: DevtoolsPlugin | null,
|
||||
) {
|
||||
// https://github.com/solidjs/vite-plugin-solid
|
||||
// We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode
|
||||
const nestedDeps = ['solid-js', 'solid-js/web', 'solid-js/store', 'solid-js/html', 'solid-js/h'];
|
||||
const config: UserConfig = {
|
||||
resolve: {
|
||||
conditions: ['solid', ...(isDev ? ['development'] : [])],
|
||||
dedupe: nestedDeps,
|
||||
alias: [{ find: /^solid-refresh$/, replacement: '/@solid-refresh' }],
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: [...nestedDeps],
|
||||
exclude: ['@astrojs/solid-js/server.js'],
|
||||
},
|
||||
plugins: [
|
||||
solid({ include, exclude, dev: isDev, ssr: true }),
|
||||
{
|
||||
name: '@astrojs/solid:config-overrides',
|
||||
enforce: 'post',
|
||||
config() {
|
||||
return {
|
||||
esbuild: {
|
||||
// To support using alongside other JSX frameworks, still let
|
||||
// esbuild compile stuff. Solid goes first anyways.
|
||||
include: /\.(m?ts|[jt]sx)$/,
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
ssr: {
|
||||
external: ['babel-preset-solid'],
|
||||
},
|
||||
plugins: [solid({ include, exclude, ssr: true })],
|
||||
};
|
||||
|
||||
if (devtoolsPlugin) {
|
||||
|
@ -128,7 +100,7 @@ export default function (options: Options = {}): AstroIntegration {
|
|||
|
||||
addRenderer(getRenderer());
|
||||
updateConfig({
|
||||
vite: await getViteConfiguration(command === 'dev', options, devtoolsPlugin),
|
||||
vite: getViteConfiguration(options, devtoolsPlugin),
|
||||
});
|
||||
|
||||
if (devtoolsPlugin) {
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
"dev": "astro-scripts dev \"src/**/*.ts\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.1",
|
||||
"svelte2tsx": "^0.7.22",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "workspace:*",
|
||||
|
|
|
@ -36,14 +36,14 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.47",
|
||||
"postcss": "^8.4.49",
|
||||
"postcss-load-config": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "workspace:*",
|
||||
"astro-scripts": "workspace:*",
|
||||
"tailwindcss": "^3.4.14",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"astro": "^3.0.0 || ^4.0.0 || ^5.0.0-beta.0",
|
||||
|
|
|
@ -42,11 +42,11 @@
|
|||
"test": "astro-scripts test \"test/**/*.test.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-vue": "^5.1.4",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
||||
"@vue/compiler-sfc": "^3.5.12",
|
||||
"vite-plugin-vue-devtools": "^7.6.3",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1",
|
||||
"vite-plugin-vue-devtools": "^7.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "workspace:*",
|
||||
|
|
|
@ -42,6 +42,6 @@
|
|||
"astro": "workspace:*",
|
||||
"astro-scripts": "workspace:*",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "6.0.0-beta.6"
|
||||
"vite": "^6.0.1"
|
||||
}
|
||||
}
|
||||
|
|
1750
pnpm-lock.yaml
1750
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue