UNPKG

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