import { ViteDevServer } from "vite"; //#region src/api.d.ts declare function createApi(options: ResolvedOptions): { isPage(file: string): boolean; pageForFilename(file: string): PageRoute | undefined; forceAddAllPages(): Promise; addAllPages(): Promise; addPage(file: string): Promise; removePage(file: string): Promise; updatePage(file: string): Promise<{ changed: boolean; needsReload: boolean; }>; pageRouteFromFile(file: string): Promise; generateRoutesModule(): Promise; frontmatterForPageOrFile(file: string, content?: string): Promise; frontmatterForFile(file: string, content?: string): Promise; }; //#endregion //#region src/types.d.ts declare const MODULE_ID = "@islands/routes"; type Awaitable = T | Promise; type PagesApi = ReturnType; interface PageFrontmatter extends Record {} interface RawPageMatter extends PageFrontmatter { meta: PageMeta; layout: false | string; route: { name?: string; path?: string; redirect?: string; alias?: string | string[]; }; } interface PageMeta extends Record { filename: string; href: string; } /** * The definition of a route in îles, used to render pages. * * By default most routes would be inferred from files in the pagesDir, but a * user might provide custom routes using the `extendRoutes` hook. */ interface PageRoute { /** * Name for the route, can be use as a shortcut in . */ name: string; /** * Path of the record. Should start with `/`. * * @example `/projects/:name` matches `/projects/vue` as well as `/projects/iles`. */ path: string; /** * Where to redirect if the route is directly matched. When building the site, * any routes with `redirect` will use . */ redirect?: string; /** * Additional paths for the page, that behave like a copy of the route. * When building the site, each path will be rendered separately. */ alias?: string | string[]; /** * Filename of the component associated with the route. */ componentFilename: string; /** * Frontmatter associated with the page. */ frontmatter: RawPageMatter; } type UserRoute = Partial; interface PagesOptions { /** * Specify the pages directory (relative to srcDir). * @default 'pages' */ pagesDir?: string; /** * Allowed extensions of page files. * @default ['vue', 'md', 'mdx'] */ pageExtensions?: string[]; /** * Use this hook to modify the frontmatter for pages and MDX files. * See `extendRoute` if you only want to modify route information. */ extendFrontmatter?: (frontmatter: RawPageMatter, filename: string) => Awaitable; /** * Use this hook to modify route * See `extendFrontmatter` if you want to add metadata. */ extendRoute?: (route: PageRoute) => Awaitable; /** * Use this hook to access the generated routes, and modify them (optional). */ extendRoutes?: (routes: PageRoute[]) => Awaitable; } interface ResolvedOptions extends Omit { /** * The root of the project. */ root: string; /** * URL base of the generated site. */ base: string; /** * Absolute path to the directory that contains the page files. */ pagesDir: string; /** * Allowed extensions of page files. */ pageExtensions: string[]; /** * Used to notify errors in a user-friendly way. */ server?: ViteDevServer; } //#endregion //#region src/pages.d.ts /** * An iles module that injects remark plugins to parse pages and expose it * to the MDX JS expressions as `meta` and `pages`. */ declare function IlesPages(): any; //#endregion export { Awaitable, MODULE_ID, PageFrontmatter, PageMeta, PageRoute, PagesApi, PagesOptions, RawPageMatter, ResolvedOptions, UserRoute, IlesPages as default };