@vaadin/hilla-file-router
Version:
Hilla file-based router
46 lines (45 loc) • 1.17 kB
TypeScript
import type { Plugin } from "vite";
/**
* The options for the Vite file-based router plugin.
*/
export type PluginOptions = Readonly<{
/**
* The base directory for the router. The folders and files in this directory
* will be used as route paths.
*
* @defaultValue `frontend/views`
*/
viewsDir?: URL | string
/**
* The directory where the generated view file will be stored.
*
* @defaultValue `frontend/generated`
*/
generatedDir?: URL | string
/**
* The list of extensions that will be collected as routes of the file-based
* router.
*
* @defaultValue `['.tsx', '.jsx']`
*/
extensions?: readonly string[]
/**
* The flag to indicate whether the plugin is running in development mode.
*
* @defaultValue `false`
*/
isDevMode?: boolean
/**
* The flag to indicate whether to output debug information
*
* @defaultValue `false`
*/
debug?: boolean
}>;
/**
* A Vite plugin that generates a router from the files in the specific directory.
*
* @param options - The plugin options.
* @returns A Vite plugin.
*/
export default function vitePluginFileSystemRouter({ viewsDir, generatedDir, extensions, isDevMode, debug }?: PluginOptions): Plugin;