@wroud/vite-plugin-ssg
Version:
A Vite plugin for static site generation (SSG) with React. Renders React applications to static HTML for faster load times and improved SEO.
24 lines • 1.04 kB
TypeScript
import type { IndexComponent, IndexComponentContext } from "../ssgPlugin.js";
import type { IAppContext } from "./IAppContext.js";
interface IAppInitializer<T extends IAppContext> {
(context: IndexComponentContext): T | Promise<T>;
}
export interface IAppConfigOptions<T extends IAppContext> {
onAppStart?: IAppInitializer<T>;
onRoutesPrerender?: IRoutesPrerender<NoInfer<T>>;
}
export interface IRoutesPrerender<T extends IAppContext> {
(app: T): string[] | Promise<string[]>;
}
export declare class AppInstance<T extends IAppContext> {
index: IndexComponent;
private onAppStart?;
private onRoutesPrerender?;
constructor(index: IndexComponent, config?: IAppConfigOptions<T>);
start(context: IndexComponentContext): Promise<T>;
getRoutesPrerender(startData: T): Promise<string[]>;
stop(): Promise<void>;
}
export declare function createAppConfig<T extends IAppContext>(index: IndexComponent, config?: IAppConfigOptions<T>): AppInstance<T>;
export {};
//# sourceMappingURL=AppInstance.d.ts.map