site-panzai/node_modules/nitropack/dist/runtime/internal/route-rules-utils.d.ts

15 lines
864 B
TypeScript
Raw Permalink Normal View History

2026-11-13 13:57:04 +01:00
export declare function canonicalizePath(pathname: string): string | undefined;
export declare function isPathInScope(pathname: string, base: string): boolean;
export declare function isTargetInScope(target: string, targetBase: string): boolean;
export declare function normalizeRedirectPath(path: string): string;
/**
* Resolve the `Location` for a `redirect` route rule.
*
* @param path - Request path, including the query string (h3 v1 `event.path`).
* @param to - Configured redirect target (may end with `/**`).
* @param stripBase - Base stripped from `path` (`/old` for `/old/**`). Only used for `/**` targets.
* @returns The redirect target, or `undefined` if `path` escapes `stripBase`
* or the remainder escapes the target base.
*/
export declare function resolveRedirectTarget(path: string, to: string, stripBase?: string): string | undefined;