next-csrf
Version:
CSRF mitigation library for Next.js
41 lines (40 loc) • 2.02 kB
TypeScript
import '../next-server/server/node-polyfill-fetch';
import { CustomRoutes } from '../lib/load-custom-routes';
import { GetStaticPaths } from 'next/types';
import { BuildManifest } from '../next-server/server/get-page-files';
import type { UnwrapPromise } from '../lib/coalesced-function';
export declare function collectPages(directory: string, pageExtensions: string[]): Promise<string[]>;
export interface PageInfo {
isHybridAmp?: boolean;
size: number;
totalSize: number;
static: boolean;
isSsg: boolean;
ssgPageRoutes: string[] | null;
initialRevalidateSeconds: number | false;
}
export declare function printTreeView(list: readonly string[], pageInfos: Map<string, PageInfo>, serverless: boolean, { distPath, buildId, pagesDir, pageExtensions, buildManifest, isModern, useStatic404, }: {
distPath: string;
buildId: string;
pagesDir: string;
pageExtensions: string[];
buildManifest: BuildManifest;
isModern: boolean;
useStatic404: boolean;
}): Promise<void>;
export declare function printCustomRoutes({ redirects, rewrites, headers, }: CustomRoutes): void;
export declare function getJsPageSizeInKb(page: string, distPath: string, buildManifest: BuildManifest, isModern: boolean): Promise<[number, number]>;
export declare function buildStaticPaths(page: string, getStaticPaths: GetStaticPaths): Promise<Omit<UnwrapPromise<ReturnType<GetStaticPaths>>, 'paths'> & {
paths: string[];
}>;
export declare function isPageStatic(page: string, serverBundle: string, runtimeEnvConfig: any): Promise<{
isStatic?: boolean;
isAmpOnly?: boolean;
isHybridAmp?: boolean;
hasServerProps?: boolean;
hasStaticProps?: boolean;
prerenderRoutes?: string[] | undefined;
prerenderFallback?: boolean | 'unstable_blocking' | undefined;
}>;
export declare function hasCustomGetInitialProps(bundle: string, runtimeEnvConfig: any, checkingApp: boolean): boolean;
export declare function getNamedExports(bundle: string, runtimeEnvConfig: any): Array<string>;