Skip to content

Commit

Permalink
add changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Aug 29, 2024
1 parent 53aa12f commit 0404868
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 3 deletions.
22 changes: 22 additions & 0 deletions .changeset/brave-elephants-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@astrojs/vercel': major
'astro': major
---

### [changed]: `entryPoint` type inside the hook `astro:build:ssr`
In Astro v4.x, the `entryPoint` type was `RouteData`.

Astro v5.0 the `entryPoint` type is `IntegrationRouteData`, which contains a subset of the `RouteData` type. The fields `isIndex` and `fallbackRoutes` were removed.

#### What should I do?
Update your adapter to change the type of `entryPoint` from `RouteData` to `IntegrationRouteData`.

```diff
-import type {RouteData} from 'astro';
+import type {IntegrationRouteData} from "astro"

-function useRoute(route: RouteData) {
+function useRoute(route: IntegrationRouteData) {

}
```
22 changes: 22 additions & 0 deletions .changeset/fuzzy-pugs-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@astrojs/vercel': major
'astro': major
---

### [changed]: `routes` type inside the hook `astro:build:done`
In Astro v4.x, the `routes` type was `RouteData`.

Astro v5.0 the `routes` type is `IntegrationRouteData`, which contains a subset of the `RouteData` type. The fields `isIndex` and `fallbackRoutes` were removed.

#### What should I do?
Update your adapter to change the type of `routes` from `RouteData` to `IntegrationRouteData`.

```diff
-import type {RouteData} from 'astro';
+import type {IntegrationRouteData} from "astro"

-function useRoute(route: RouteData) {
+function useRoute(route: IntegrationRouteData) {

}
```
21 changes: 20 additions & 1 deletion .changeset/ten-walls-tap.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,23 @@
'astro': major
---

ff
### [changed]: `RouteData.distURL` is now an array
In Astro v4.x, `RouteData.distURL` was `undefined` or a `URL`

Astro v5.0, `RouteData.distURL` is `undefined` or an array of `URL`. This was a bug, because a route can generate multiple files on disk, especially when using dynamic routes such as `[slug]` or `[...slug]`.

#### What should I do?
Update your code to handle `RouteData.distURL` as an array.

```diff
if (route.distURL) {
- if (route.distURL.endsWith('index.html')) {
- // do something
- }
+ for (const url of route.distURL) {
+ if (url.endsWith('index.html')) {
+ // do something
+ }
+ }
}
```
7 changes: 5 additions & 2 deletions packages/astro/src/types/public/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export interface SSRLoadedRendererValue {
*/
export interface RouteData {
/**
* The current **pattern** of the route,
* The current **pattern** of the route. For example:
* - `src/pages/index.astro` has a pattern of `/`
* - `src/pages/blog/[...slug].astro` has a pattern of `/blog/[...slug]`
* - `src/pages/site/[blog]/[...slug].astro` has a pattern of `/site/[blog]/[...slug]`
*/
route: string;
/**
Expand All @@ -62,7 +65,7 @@ export interface RouteData {
*/
pathname?: string;
/**
* The paths of the physical files emitted by this route.
* The paths of the physical files emitted by this route. When a route **isn't** prerendered, the value is either `undefined` or an empty array.
*/
distURL?: URL[];
/**
Expand Down

0 comments on commit 0404868

Please sign in to comment.