( shortPath: string, appPathRoutesManifest: Record<string, string> )
| 3928 | } |
| 3929 | |
| 3930 | export function normalizeEdgeFunctionPath( |
| 3931 | shortPath: string, |
| 3932 | appPathRoutesManifest: Record<string, string> |
| 3933 | ) { |
| 3934 | if ( |
| 3935 | shortPath.startsWith('app/') && |
| 3936 | (shortPath.endsWith('/page') || |
| 3937 | shortPath.endsWith('/route') || |
| 3938 | shortPath === 'app/_not-found') |
| 3939 | ) { |
| 3940 | const ogRoute = shortPath.replace(/^app\//, '/'); |
| 3941 | shortPath = ( |
| 3942 | appPathRoutesManifest[ogRoute] || |
| 3943 | shortPath.replace(/(^|\/)(page|route)$/, '') |
| 3944 | ).replace(/^\//, ''); |
| 3945 | |
| 3946 | if (!shortPath || shortPath === '/') { |
| 3947 | shortPath = 'index'; |
| 3948 | } |
| 3949 | } |
| 3950 | |
| 3951 | if (shortPath.startsWith('pages/')) { |
| 3952 | shortPath = shortPath.replace(/^pages\//, ''); |
| 3953 | } |
| 3954 | |
| 3955 | return shortPath; |
| 3956 | } |
| 3957 | |
| 3958 | export async function getNodeMiddleware({ |
| 3959 | config, |
no test coverage detected