import { type MatchedRoute, type RadixRouter } from "radix3"; import type { AkteFiles } from "./AkteFiles"; import type { Awaitable, GlobalDataFn } from "./types"; /** Akte app configuration object. */ export type Config = { /** * Akte files this config is responsible for. * * Create them with {@link defineAkteFile} and {@link defineAkteFiles}. */ files: AkteFiles[]; /** Configuration related to Akte build process. */ build?: { /** * Output directory for Akte build command. * * @remarks * This directory is overriden by the Akte Vite plugin when running Akte * through Vite. * @defaultValue `"dist"` for Akte build command, `".akte"` for Akte Vite plugin. */ outDir?: string; }; } & (TGlobalData extends Record ? { /** * Global data retrieval function. * * The return value of this function is then shared with each Akte file. */ globalData: GlobalDataFn; } : { /** * Global data retrieval function. * * The return value of this function is then shared with each Akte file. */ globalData?: GlobalDataFn; }); /** An Akte app, ready to be interacted with. */ export declare class AkteApp { protected config: Config; constructor(config: Config); /** * Looks up the Akte file responsible for rendering the path. * * @param path - Path to lookup, e.g. "/foo" * @returns A match featuring the path, the path parameters if any, and the * Akte file. * @throws {@link NotFoundError} When no Akte file is found for handling * looked up path. * @experimental Programmatic API might still change not following SemVer. */ lookup(path: string): MatchedRoute<{ file: AkteFiles; }> & { path: string; }; /** * Renders a match from {@link lookup}. * * @param match - Match to render. * @returns Rendered file. * @throws {@link NotFoundError} When the Akte file could not render the match * (404), with an optional `cause` attached to it for uncaught errors (500) * @experimental Programmatic API might still change not following SemVer. */ render(match: MatchedRoute<{ file: AkteFiles; }> & { path: string; }): Promise; /** * Renders all Akte files. * * @returns Rendered files map. * @experimental Programmatic API might still change not following SemVer. */ renderAll(): Promise>; /** * Writes a map of rendered Akte files to the specified `outDir`, or the app * specified one (defaults to `"dist"`). * * @param args - A map of rendered Akte files, and an optional `outDir` * @experimental Programmatic API might still change not following SemVer. */ writeAll(args: { outDir?: string; files: Record; }): Promise; /** * Build (renders and write) all Akte files to the specified `outDir`, or the * app specified one (defaults to `"dist"`). * * @param args - An optional `outDir` * @returns Built files array. * @experimental Programmatic API might still change not following SemVer. */ buildAll(args?: { outDir?: string; }): Promise; /** * Akte caches all `globalData`, `data`, `bulkData` calls for performance. * This method can be used to clear the cache. * * @param alsoClearFileCache - Also clear cache on all registered Akte files. * @experimental Programmatic API might still change not following SemVer. */ clearCache(alsoClearFileCache?: boolean): void; private _globalDataPromise; protected getGlobalDataPromise(): Awaitable; private _router; protected getRouter(): RadixRouter<{ file: AkteFiles; }>; }