UNPKG

vite-plugin-vue-layouts-next

Version:
77 lines (76 loc) 2.06 kB
import { Plugin } from "vite"; //#region src/types.d.ts /** * Plugin options. */ interface Options { /** * Relative path to the directory to search for page components. * @default 'src/layouts' */ layoutsDirs: string | string[]; /** * Relative path to the pages directory. * @default 'src/pages' */ pagesDirs: string | string[] | null; /** * Valid file extensions for page components. * @default ['vue'] */ extensions: string[]; /** * List of path globs to exclude when resolving pages. */ exclude: string[]; /** * Filename of default layout (".vue" is not needed) * @default 'default' */ defaultLayout: string; /** * Mode for importing layouts */ importMode: (name: string) => 'sync' | 'async'; /** * Whether nested routes should inherit the default layout from parent routes. * When false, if a child route has its own layout, the parent route won't use the default layout. * @default true */ inheritDefaultLayout: boolean; } interface FileContainer { path: string; files: string[]; } type UserOptions = Partial<Options>; interface ResolvedOptions extends Options {} interface clientSideOptions { /** * layouts dir * @default "src/layouts" */ layoutDir?: string; /** * default layout * @default "default" */ defaultLayout?: string; /** * default auto resolve */ importMode?: 'sync' | 'async'; /** * Whether nested routes should inherit the default layout from parent routes. * When false, if a child route has its own layout, the parent route won't use the default layout. * @default true */ inheritDefaultLayout?: boolean; } //#endregion //#region src/index.d.ts declare function defaultImportMode(name: string): "sync" | "async"; declare function Layout(userOptions?: UserOptions): Plugin; declare function ClientSideLayout(options?: clientSideOptions): Plugin; //#endregion export { ClientSideLayout, FileContainer, ResolvedOptions, UserOptions, clientSideOptions, Layout as default, defaultImportMode };