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>
This commit is contained in:
parent
3bae77dde1
commit
44f7a28728
6 changed files with 23 additions and 47 deletions
21
.changeset/grumpy-pens-melt.md
Normal file
21
.changeset/grumpy-pens-melt.md
Normal file
|
@ -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.
|
|
@ -7,9 +7,6 @@ export default defineConfig({
|
|||
output: 'server',
|
||||
adapter: nodejs({ mode: 'standalone' }),
|
||||
integrations: [react()],
|
||||
experimental: {
|
||||
viewTransitions: true,
|
||||
},
|
||||
vite: {
|
||||
build: {
|
||||
assetsInlineLimit: 0,
|
||||
|
|
|
@ -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 `<ViewTransitions / >` 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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue