UNPKG

2.17 kBTypeScriptView Raw
1export declare const CACHE_DIR = ".microsite/cache";
2export declare const STAGING_DIR = ".microsite/staging";
3export declare const SSR_DIR = ".microsite/ssr";
4export declare const OUT_DIR = "./dist";
5export interface ManifestEntry {
6 name: string;
7 hydrateStyleBindings: string[] | null;
8 hydrateBindings: Record<string, string[]> | null;
9}
10export interface RouteDataEntry {
11 name: string;
12 route: string;
13 props: Record<string, object>;
14}
15export declare const getFileNameFromPath: (path: string) => string;
16export declare const proxyImportTransformer: {
17 filter: (source: string) => boolean;
18 transform: (source: string) => string;
19};
20export declare const preactImportTransformer: {
21 filter: (source: string) => boolean;
22 transform: (source: string) => string;
23};
24export declare const preactToCDN: (code: string) => string;
25export declare const withHydrateTransformer: {
26 filter: (source: string) => boolean;
27 transform: (source: string) => string;
28};
29/**
30 * For the final browser code, we need to strip out withHydrate
31 * by replacing it with an identity function which can be
32 * completely stripped by a minifier
33 */
34export declare const stripWithHydrate: (source: string) => string;
35export declare const hashContentSync: (content: string, len?: number) => string;
36export declare const emitFile: (filename: string, content: string | Uint8Array) => Promise<void>;
37export declare const emitFinalAsset: (filename: string, content: string | Uint8Array) => Promise<void>;
38export declare const copyAssetToFinal: (path: string, transform?: (source: string) => Promise<string>) => Promise<void>;
39export declare const renderPage: (data: RouteDataEntry | null, manifest: ManifestEntry, { debug, hasGlobalScript }?: {
40 debug?: boolean;
41 hasGlobalScript?: boolean;
42}) => Promise<{
43 name: string;
44 contents: string;
45}>;
46export declare const importDataMethods: (path: string) => Promise<DataHandlers>;
47interface DataHandlers {
48 getStaticPaths?: (ctx?: any) => any;
49 getStaticProps?: (ctx?: any) => any;
50}
51export declare function applyDataMethods(fileName: string, handlers: DataHandlers): Promise<RouteDataEntry[]>;
52export {};