15 lines
864 B
TypeScript
15 lines
864 B
TypeScript
|
|
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;
|