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',
|
output: 'server',
|
||||||
adapter: nodejs({ mode: 'standalone' }),
|
adapter: nodejs({ mode: 'standalone' }),
|
||||||
integrations: [react()],
|
integrations: [react()],
|
||||||
experimental: {
|
|
||||||
viewTransitions: true,
|
|
||||||
},
|
|
||||||
vite: {
|
vite: {
|
||||||
build: {
|
build: {
|
||||||
assetsInlineLimit: 0,
|
assetsInlineLimit: 0,
|
||||||
|
|
|
@ -1282,27 +1282,6 @@ export interface AstroUserConfig {
|
||||||
* These flags are not guaranteed to be stable.
|
* These flags are not guaranteed to be stable.
|
||||||
*/
|
*/
|
||||||
experimental?: {
|
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
|
* @docs
|
||||||
* @name experimental.optimizeHoistedScript
|
* @name experimental.optimizeHoistedScript
|
||||||
|
|
|
@ -44,7 +44,6 @@ const ASTRO_CONFIG_DEFAULTS = {
|
||||||
legacy: {},
|
legacy: {},
|
||||||
redirects: {},
|
redirects: {},
|
||||||
experimental: {
|
experimental: {
|
||||||
viewTransitions: false,
|
|
||||||
optimizeHoistedScript: false,
|
optimizeHoistedScript: false,
|
||||||
},
|
},
|
||||||
} satisfies AstroUserConfig & { server: { open: boolean } };
|
} satisfies AstroUserConfig & { server: { open: boolean } };
|
||||||
|
@ -264,10 +263,6 @@ export const AstroConfigSchema = z.object({
|
||||||
.default(ASTRO_CONFIG_DEFAULTS.vite),
|
.default(ASTRO_CONFIG_DEFAULTS.vite),
|
||||||
experimental: z
|
experimental: z
|
||||||
.object({
|
.object({
|
||||||
viewTransitions: z
|
|
||||||
.boolean()
|
|
||||||
.optional()
|
|
||||||
.default(ASTRO_CONFIG_DEFAULTS.experimental.viewTransitions),
|
|
||||||
optimizeHoistedScript: z
|
optimizeHoistedScript: z
|
||||||
.boolean()
|
.boolean()
|
||||||
.optional()
|
.optional()
|
||||||
|
|
|
@ -133,7 +133,7 @@ export async function createVite(
|
||||||
astroContentAssetPropagationPlugin({ mode, settings }),
|
astroContentAssetPropagationPlugin({ mode, settings }),
|
||||||
vitePluginSSRManifest(),
|
vitePluginSSRManifest(),
|
||||||
astroAssetsPlugin({ settings, logger, mode }),
|
astroAssetsPlugin({ settings, logger, mode }),
|
||||||
astroTransitions({ config: settings.config }),
|
astroTransitions(),
|
||||||
],
|
],
|
||||||
publicDir: fileURLToPath(settings.config.publicDir),
|
publicDir: fileURLToPath(settings.config.publicDir),
|
||||||
root: fileURLToPath(settings.config.root),
|
root: fileURLToPath(settings.config.root),
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import type { AstroConfig } from '../@types/astro';
|
|
||||||
import { AstroError } from '../core/errors/index.js';
|
|
||||||
|
|
||||||
const virtualModuleId = 'astro:transitions';
|
const virtualModuleId = 'astro:transitions';
|
||||||
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
||||||
|
|
||||||
// The virtual module for the astro:transitions namespace
|
// The virtual module for the astro:transitions namespace
|
||||||
export default function astroTransitions({ config }: { config: AstroConfig }): vite.Plugin {
|
export default function astroTransitions(): vite.Plugin {
|
||||||
return {
|
return {
|
||||||
name: 'astro:transitions',
|
name: 'astro:transitions',
|
||||||
async resolveId(id) {
|
async resolveId(id) {
|
||||||
|
@ -16,20 +14,6 @@ export default function astroTransitions({ config }: { config: AstroConfig }): v
|
||||||
},
|
},
|
||||||
load(id) {
|
load(id) {
|
||||||
if (id === resolvedVirtualModuleId) {
|
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 `
|
return `
|
||||||
export * from "astro/transitions";
|
export * from "astro/transitions";
|
||||||
export { default as ViewTransitions } from "astro/components/ViewTransitions.astro";
|
export { default as ViewTransitions } from "astro/components/ViewTransitions.astro";
|
||||||
|
|
Loading…
Add table
Reference in a new issue