diff --git a/.changeset/grumpy-pens-melt.md b/.changeset/grumpy-pens-melt.md new file mode 100644 index 000000000..14faf0676 --- /dev/null +++ b/.changeset/grumpy-pens-melt.md @@ -0,0 +1,21 @@ +--- +'astro': minor +--- + +View Transitions unflagged + +View Transition support in Astro is now unflagged. For those who have used the experimental feature you can remove the flag in your Astro config: + +```diff +import { defineConfig } from 'astro' + +export default defineConfig({ +- experimental: { +- viewTransitions: true, +- } +}) +``` + +After removing this flag, please also consult the specific [upgrade to v3.0 advice](https://docs.astro.build/en/guides/view-transitions/#upgrade-to-v30-from-v2x) as some API features have changed and you may have breaking changes with your existing view transitions. + +See the [View Transitions guide](https://docs.astro.build/en/guides/view-transitions/) to learn how to use the API. diff --git a/packages/astro/e2e/fixtures/view-transitions/astro.config.mjs b/packages/astro/e2e/fixtures/view-transitions/astro.config.mjs index 78c248963..02dc2043d 100644 --- a/packages/astro/e2e/fixtures/view-transitions/astro.config.mjs +++ b/packages/astro/e2e/fixtures/view-transitions/astro.config.mjs @@ -7,9 +7,6 @@ export default defineConfig({ output: 'server', adapter: nodejs({ mode: 'standalone' }), integrations: [react()], - experimental: { - viewTransitions: true, - }, vite: { build: { assetsInlineLimit: 0, diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 302616fde..bc47e0779 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -1282,27 +1282,6 @@ export interface AstroUserConfig { * These flags are not guaranteed to be stable. */ experimental?: { - /** - * @docs - * @name experimental.viewTransitions - * @type {boolean} - * @default `false` - * @version 2.9.0 - * @description - * Enable experimental support for the `` component. With this enabled - * you can opt-in to [view transitions](https://docs.astro.build/en/guides/view-transitions/) on a per-page basis using this component - * and enable animations with the `transition:animate` directive. - * - * ```js - * { - * experimental: { - * viewTransitions: true, - * }, - * } - * ``` - */ - viewTransitions?: boolean; - /** * @docs * @name experimental.optimizeHoistedScript diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index da737ebc0..21d153143 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -44,7 +44,6 @@ const ASTRO_CONFIG_DEFAULTS = { legacy: {}, redirects: {}, experimental: { - viewTransitions: false, optimizeHoistedScript: false, }, } satisfies AstroUserConfig & { server: { open: boolean } }; @@ -264,10 +263,6 @@ export const AstroConfigSchema = z.object({ .default(ASTRO_CONFIG_DEFAULTS.vite), experimental: z .object({ - viewTransitions: z - .boolean() - .optional() - .default(ASTRO_CONFIG_DEFAULTS.experimental.viewTransitions), optimizeHoistedScript: z .boolean() .optional() diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 76a598d8f..8adf3cac8 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -133,7 +133,7 @@ export async function createVite( astroContentAssetPropagationPlugin({ mode, settings }), vitePluginSSRManifest(), astroAssetsPlugin({ settings, logger, mode }), - astroTransitions({ config: settings.config }), + astroTransitions(), ], publicDir: fileURLToPath(settings.config.publicDir), root: fileURLToPath(settings.config.root), diff --git a/packages/astro/src/transitions/vite-plugin-transitions.ts b/packages/astro/src/transitions/vite-plugin-transitions.ts index d0b885857..188ebbc61 100644 --- a/packages/astro/src/transitions/vite-plugin-transitions.ts +++ b/packages/astro/src/transitions/vite-plugin-transitions.ts @@ -1,12 +1,10 @@ import * as vite from 'vite'; -import type { AstroConfig } from '../@types/astro'; -import { AstroError } from '../core/errors/index.js'; const virtualModuleId = 'astro:transitions'; const resolvedVirtualModuleId = '\0' + virtualModuleId; // The virtual module for the astro:transitions namespace -export default function astroTransitions({ config }: { config: AstroConfig }): vite.Plugin { +export default function astroTransitions(): vite.Plugin { return { name: 'astro:transitions', async resolveId(id) { @@ -16,20 +14,6 @@ export default function astroTransitions({ config }: { config: AstroConfig }): v }, load(id) { if (id === resolvedVirtualModuleId) { - if (!config.experimental.viewTransitions) { - throw new AstroError({ - name: 'TransitionError', - title: 'Experimental View Transitions not enabled', - message: `View Transitions support is experimental. To enable update your config to include: - -export default defineConfig({ - experimental: { - viewTransitions: true - } -})`, - }); - } - return ` export * from "astro/transitions"; export { default as ViewTransitions } from "astro/components/ViewTransitions.astro";