summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Florian Lefebvre <contact@florian-lefebvre.dev> 2024-09-13 16:41:40 +0200
committerGravatar GitHub <noreply@github.com> 2024-09-13 16:41:40 +0200
commit3e70853b767b124bf867072b1c67474dd0b51c3f (patch)
tree4ea507570a31f5bb1adb598974d8ac9fc2574167
parentd84e444fd3496c1f787b3fcee2929c92bc74e0cd (diff)
downloadastro-3e70853b767b124bf867072b1c67474dd0b51c3f.tar.gz
astro-3e70853b767b124bf867072b1c67474dd0b51c3f.tar.zst
astro-3e70853b767b124bf867072b1c67474dd0b51c3f.zip
feat(next): underscore redirects (#11989)
-rw-r--r--.changeset/polite-roses-fail.md5
-rw-r--r--packages/underscore-redirects/src/astro.ts8
2 files changed, 9 insertions, 4 deletions
diff --git a/.changeset/polite-roses-fail.md b/.changeset/polite-roses-fail.md
new file mode 100644
index 000000000..a7b3b3f70
--- /dev/null
+++ b/.changeset/polite-roses-fail.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/underscore-redirects': minor
+---
+
+Updates the type from `RouteData` to `IntegrationRouteData`
diff --git a/packages/underscore-redirects/src/astro.ts b/packages/underscore-redirects/src/astro.ts
index 74c3034fb..251de499b 100644
--- a/packages/underscore-redirects/src/astro.ts
+++ b/packages/underscore-redirects/src/astro.ts
@@ -1,10 +1,10 @@
import { posix } from 'node:path';
-import type { AstroConfig, RouteData, ValidRedirectStatus } from 'astro';
+import type { AstroConfig, IntegrationRouteData, ValidRedirectStatus } from 'astro';
import { Redirects } from './redirects.js';
const pathJoin = posix.join;
-function getRedirectStatus(route: RouteData): ValidRedirectStatus {
+function getRedirectStatus(route: IntegrationRouteData): ValidRedirectStatus {
if (typeof route.redirect === 'object') {
return route.redirect.status;
}
@@ -16,7 +16,7 @@ interface CreateRedirectsFromAstroRoutesParams {
/**
* Maps a `RouteData` to a dynamic target
*/
- routeToDynamicTargetMap: Map<RouteData, string>;
+ routeToDynamicTargetMap: Map<IntegrationRouteData, string>;
dir: URL;
}
@@ -125,7 +125,7 @@ export function createRedirectsFromAstroRoutes({
* /team/articles/*
* With stars replacing spread and :id syntax replacing [id]
*/
-function generateDynamicPattern(route: RouteData) {
+function generateDynamicPattern(route: IntegrationRouteData) {
const pattern =
'/' +
route.segments