UNPKG

@itznotabug/routex

Version:

A client side redirection plugin for Vitepress.

32 lines (31 loc) 780 B
import type { Plugin } from 'vite'; import { type RedirectConfig } from './engine/index.js'; /** * VitePress plugin for handling client-side static redirects * * @param config - Redirect configuration mapping old paths to new ones * @returns Vite plugin for VitePress * * @example * ```ts * // Basic usage * routex({ * '/old-page': '/new-page', * '/legacy/docs': '/docs' * }) * * // With options * routex({ * rules: { * '/old-api': '/api/v2' * }, * options: { * redirectDelay: 3, * addCanonical: true, * template: './custom-redirect.html' * } * }) * ``` */ export declare function routex(config: RedirectConfig): Plugin; export type { RedirectConfig, RedirectMap, RedirectOptions, VitePressConfig, } from './engine/index.js';