UNPKG

1.35 kBTypeScriptView Raw
1import { NextConfig } from '../next-server/server/config';
2export declare type RouteHas = {
3 type: 'header' | 'query' | 'cookie';
4 key: string;
5 value?: string;
6} | {
7 type: 'host';
8 key?: undefined;
9 value: string;
10};
11export declare type Rewrite = {
12 source: string;
13 destination: string;
14 basePath?: false;
15 locale?: false;
16 has?: RouteHas[];
17};
18export declare type Header = {
19 source: string;
20 basePath?: false;
21 locale?: false;
22 headers: Array<{
23 key: string;
24 value: string;
25 }>;
26 has?: RouteHas[];
27};
28export declare type Redirect = {
29 source: string;
30 destination: string;
31 basePath?: false;
32 locale?: false;
33 has?: RouteHas[];
34 statusCode?: number;
35 permanent?: boolean;
36};
37export declare const allowedStatusCodes: Set<number>;
38export declare function getRedirectStatus(route: {
39 statusCode?: number;
40 permanent?: boolean;
41}): number;
42export declare function normalizeRouteRegex(regex: string): string;
43export declare type RouteType = 'rewrite' | 'redirect' | 'header';
44export interface CustomRoutes {
45 headers: Header[];
46 rewrites: {
47 fallback: Rewrite[];
48 afterFiles: Rewrite[];
49 beforeFiles: Rewrite[];
50 };
51 redirects: Redirect[];
52}
53export default function loadCustomRoutes(config: NextConfig): Promise<CustomRoutes>;