-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(next): send
IntegrationRouteData
to integrations (#11864)
Co-authored-by: Luiz Ferraz <[email protected]> Co-authored-by: Alexander Niebuhr <[email protected]> Co-authored-by: Florian Lefebvre <[email protected]>
- Loading branch information
1 parent
d813262
commit ee38b3a
Showing
9 changed files
with
203 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
'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) { | ||
|
||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
'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) { | ||
|
||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
'astro': major | ||
--- | ||
|
||
### [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 | ||
+ } | ||
+ } | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters