mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
feat(next): underscore redirects (#11989)
This commit is contained in:
parent
d84e444fd3
commit
3e70853b76
2 changed files with 9 additions and 4 deletions
5
.changeset/polite-roses-fail.md
Normal file
5
.changeset/polite-roses-fail.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/underscore-redirects': minor
|
||||
---
|
||||
|
||||
Updates the type from `RouteData` to `IntegrationRouteData`
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue