Skip to content

Commit c80bf3e

Browse files
[next]: deprecate transitions exports (#12861)
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
1 parent e4a63de commit c80bf3e

File tree

2 files changed

+59
-15
lines changed

2 files changed

+59
-15
lines changed

src/content/docs/en/guides/upgrade-to/v6.mdx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,51 @@ import { defineCollection, z } from "astro:content"
193193
import { defineCollection } from "astro:content"
194194
import { z } from "astro/zod"
195195
```
196+
196197
<ReadMore>See more about [defining collection schemas with Zod](/en/guides/content-collections/#defining-datatypes-with-zod).</ReadMore>
198+
199+
### Deprecated: exposed `astro:transitions` internals
200+
201+
<SourcePR number="14989" title="feat!: deprecate transitions exports" />
202+
203+
In Astro 5.x, some internals were exported from `astro:transitions` and `astro:transitions/client` that were not meant to be exposed for public use.
204+
205+
Astro 6.0 removes the following functions and types as exports from the `astro:transitions` and `astro:transitions/client` virtual modules. These can no longer be imported in your project files:
206+
207+
- `createAnimationScope()`
208+
- `isTransitionBeforePreparationEvent()`
209+
- `isTransitionBeforeSwapEvent()`
210+
- `TRANSITION_BEFORE_PREPARATION`
211+
- `TRANSITION_AFTER_PREPARATION`
212+
- `TRANSITION_BEFORE_SWAP`
213+
- `TRANSITION_AFTER_SWAP`
214+
- `TRANSITION_PAGE_LOAD`
215+
216+
#### What should I do?
217+
218+
Remove any occurrences of `createAnimationScope()`:
219+
220+
```ts del={1}
221+
import { createAnimationScope } from 'astro:transitions';
222+
```
223+
224+
Update any occurrences of the other deprecated exports:
225+
226+
```ts del={1-4,6,9} ins={7,10}
227+
import {
228+
isTransitionBeforePreparationEvent,
229+
TRANSITION_AFTER_SWAP,
230+
} from 'astro:transitions/client';
231+
232+
console.log(isTransitionBeforePreparationEvent(event));
233+
console.log(event.type === 'astro:before-preparation');
234+
235+
console.log(TRANSITION_AFTER_SWAP);
236+
console.log('astro:after-swap');
237+
```
238+
239+
<ReadMore>Learn more about all utilities available in the [View Transitions Router API Reference](/en/reference/modules/astro-transitions/).</ReadMore>
240+
197241
## Removed
198242

199243
The following features have now been entirely removed from the code base and can no longer be used. Some of these features may have continued to work in your project even after deprecation. Others may have silently had no effect.

src/content/docs/en/reference/modules/astro-transitions.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ Replaces the old body with the new body. Then, goes through every element in the
306306

307307
### Deprecated imports
308308

309-
The following imports are scheduled for deprecation in v6. You can still use them in your project, but you may prefer to update your code now.
309+
The following imports are deprecated in v6 and will be removed in v7. You can still use them in your project, but you may prefer to update your code now. [See how to upgrade](/en/guides/upgrade-to/v6/#deprecated-exposed-astrotransitions-internals).
310310

311311
<h4>`isTransitionBeforePreparationEvent()`</h4>
312312

@@ -316,8 +316,8 @@ The following imports are scheduled for deprecation in v6. You can still use the
316316
<Since v="3.6.0" />
317317
</p>
318318

319-
:::caution[Scheduled for deprecation]
320-
This function is scheduled for deprecation in v6. You can still use it in your project, but you may prefer to update your code now.
319+
:::caution[Deprecated]
320+
This function is deprecated in v6 and will be removed in v7. You can still use it in your project, but you may prefer to update your code now.
321321
:::
322322

323323
Determines whether the given value matches a [`TransitionBeforePreparationEvent`](#transitionbeforepreparationevent). This can be useful when you need to narrow the type of an event in an event listener.
@@ -349,8 +349,8 @@ Determines whether the given value matches a [`TransitionBeforePreparationEvent`
349349
<Since v="3.6.0" />
350350
</p>
351351

352-
:::caution[Scheduled for deprecation]
353-
This function is scheduled for deprecation in v6. You can still use it in your project, but you may prefer to update your code now.
352+
:::caution[Deprecated]
353+
This function is deprecated in v6 and will be removed in v7. You can still use it in your project, but you may prefer to update your code now.
354354
:::
355355

356356
Determines whether the given value matches a [`TransitionBeforeSwapEvent`](#transitionbeforeswapevent). This can be useful when you need to narrow the type of an event in an event listener.
@@ -382,8 +382,8 @@ Determines whether the given value matches a [`TransitionBeforeSwapEvent`](#tran
382382
<Since v="3.6.0" />
383383
</p>
384384

385-
:::caution[Scheduled for deprecation]
386-
This constant is scheduled for deprecation in v6. You can still use it in your project, but you may prefer to update your code now.
385+
:::caution[Deprecated]
386+
This constant is deprecated in v6 and will be removed in v7. You can still use it in your project, but you may prefer to update your code now.
387387
:::
388388

389389
A constant to avoid writing the `astro:before-preparation` event name in plain text when you define an event.
@@ -409,8 +409,8 @@ A constant to avoid writing the `astro:before-preparation` event name in plain t
409409
<Since v="3.6.0" />
410410
</p>
411411

412-
:::caution[Scheduled for deprecation]
413-
This constant is scheduled for deprecation in v6. You can still use it in your project, but you may prefer to update your code now.
412+
:::caution[Deprecated]
413+
This constant is deprecated in v6 and will be removed in v7. You can still use it in your project, but you may prefer to update your code now.
414414
:::
415415

416416
A constant to avoid writing the `astro:after-preparation` event name in plain text when you define an event.
@@ -436,8 +436,8 @@ A constant to avoid writing the `astro:after-preparation` event name in plain te
436436
<Since v="3.6.0" />
437437
</p>
438438

439-
:::caution[Scheduled for deprecation]
440-
This constant is scheduled for deprecation in v6. You can still use it in your project, but you may prefer to update your code now.
439+
:::caution[Deprecated]
440+
This constant is deprecated in v6 and will be removed in v7. You can still use it in your project, but you may prefer to update your code now.
441441
:::
442442

443443
A constant to avoid writing the `astro:before-swap` event name in plain text when you define an event.
@@ -463,8 +463,8 @@ A constant to avoid writing the `astro:before-swap` event name in plain text whe
463463
<Since v="3.6.0" />
464464
</p>
465465

466-
:::caution[Scheduled for deprecation]
467-
This constant is scheduled for deprecation in v6. You can still use it in your project, but you may prefer to update your code now.
466+
:::caution[Deprecated]
467+
This constant is deprecated in v6 and will be removed in v7. You can still use it in your project, but you may prefer to update your code now.
468468
:::
469469

470470
A constant to avoid writing the `astro:after-swap` event name in plain text when you define an event.
@@ -490,8 +490,8 @@ A constant to avoid writing the `astro:after-swap` event name in plain text when
490490
<Since v="3.6.0" />
491491
</p>
492492

493-
:::caution[Scheduled for deprecation]
494-
This constant is scheduled for deprecation in v6. You can still use it in your project, but you may prefer to update your code now.
493+
:::caution[Deprecated]
494+
This constant is deprecated in v6 and will be removed in v7. You can still use it in your project, but you may prefer to update your code now.
495495
:::
496496

497497
A constant to avoid writing the `astro:page-load` event name in plain text when you define an event.

0 commit comments

Comments
 (0)