Skip to content

Commit 44f7a28

Browse files
matthewpsarah11918
andauthored
Unflag View Transition support (#8218)
* Unflag View Transition support * Add a changeset * Update .changeset/grumpy-pens-melt.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
1 parent 3bae77d commit 44f7a28

6 files changed

Lines changed: 23 additions & 47 deletions

File tree

.changeset/grumpy-pens-melt.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'astro': minor
3+
---
4+
5+
View Transitions unflagged
6+
7+
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:
8+
9+
```diff
10+
import { defineConfig } from 'astro'
11+
12+
export default defineConfig({
13+
- experimental: {
14+
- viewTransitions: true,
15+
- }
16+
})
17+
```
18+
19+
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.
20+
21+
See the [View Transitions guide](https://docs.astro.build/en/guides/view-transitions/) to learn how to use the API.

packages/astro/e2e/fixtures/view-transitions/astro.config.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ export default defineConfig({
77
output: 'server',
88
adapter: nodejs({ mode: 'standalone' }),
99
integrations: [react()],
10-
experimental: {
11-
viewTransitions: true,
12-
},
1310
vite: {
1411
build: {
1512
assetsInlineLimit: 0,

packages/astro/src/@types/astro.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,27 +1282,6 @@ export interface AstroUserConfig {
12821282
* These flags are not guaranteed to be stable.
12831283
*/
12841284
experimental?: {
1285-
/**
1286-
* @docs
1287-
* @name experimental.viewTransitions
1288-
* @type {boolean}
1289-
* @default `false`
1290-
* @version 2.9.0
1291-
* @description
1292-
* Enable experimental support for the `<ViewTransitions / >` component. With this enabled
1293-
* you can opt-in to [view transitions](https://docs.astro.build/en/guides/view-transitions/) on a per-page basis using this component
1294-
* and enable animations with the `transition:animate` directive.
1295-
*
1296-
* ```js
1297-
* {
1298-
* experimental: {
1299-
* viewTransitions: true,
1300-
* },
1301-
* }
1302-
* ```
1303-
*/
1304-
viewTransitions?: boolean;
1305-
13061285
/**
13071286
* @docs
13081287
* @name experimental.optimizeHoistedScript

packages/astro/src/core/config/schema.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const ASTRO_CONFIG_DEFAULTS = {
4444
legacy: {},
4545
redirects: {},
4646
experimental: {
47-
viewTransitions: false,
4847
optimizeHoistedScript: false,
4948
},
5049
} satisfies AstroUserConfig & { server: { open: boolean } };
@@ -264,10 +263,6 @@ export const AstroConfigSchema = z.object({
264263
.default(ASTRO_CONFIG_DEFAULTS.vite),
265264
experimental: z
266265
.object({
267-
viewTransitions: z
268-
.boolean()
269-
.optional()
270-
.default(ASTRO_CONFIG_DEFAULTS.experimental.viewTransitions),
271266
optimizeHoistedScript: z
272267
.boolean()
273268
.optional()

packages/astro/src/core/create-vite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export async function createVite(
133133
astroContentAssetPropagationPlugin({ mode, settings }),
134134
vitePluginSSRManifest(),
135135
astroAssetsPlugin({ settings, logger, mode }),
136-
astroTransitions({ config: settings.config }),
136+
astroTransitions(),
137137
],
138138
publicDir: fileURLToPath(settings.config.publicDir),
139139
root: fileURLToPath(settings.config.root),

packages/astro/src/transitions/vite-plugin-transitions.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import * as vite from 'vite';
2-
import type { AstroConfig } from '../@types/astro';
3-
import { AstroError } from '../core/errors/index.js';
42

53
const virtualModuleId = 'astro:transitions';
64
const resolvedVirtualModuleId = '\0' + virtualModuleId;
75

86
// The virtual module for the astro:transitions namespace
9-
export default function astroTransitions({ config }: { config: AstroConfig }): vite.Plugin {
7+
export default function astroTransitions(): vite.Plugin {
108
return {
119
name: 'astro:transitions',
1210
async resolveId(id) {
@@ -16,20 +14,6 @@ export default function astroTransitions({ config }: { config: AstroConfig }): v
1614
},
1715
load(id) {
1816
if (id === resolvedVirtualModuleId) {
19-
if (!config.experimental.viewTransitions) {
20-
throw new AstroError({
21-
name: 'TransitionError',
22-
title: 'Experimental View Transitions not enabled',
23-
message: `View Transitions support is experimental. To enable update your config to include:
24-
25-
export default defineConfig({
26-
experimental: {
27-
viewTransitions: true
28-
}
29-
})`,
30-
});
31-
}
32-
3317
return `
3418
export * from "astro/transitions";
3519
export { default as ViewTransitions } from "astro/components/ViewTransitions.astro";

0 commit comments

Comments
 (0)