@netronk/mdx-remote
Version:
The remote MDX files adapter for Netronk Gen
46 lines (42 loc) • 1.05 kB
TypeScript
import { WebSocket } from 'ws';
declare function createGithubWebhookAPI({ ref, secret, paths, }: {
/**
* Git branch to listen/revalidate.
*
* When not specified, find one from environment variables. Otherwise, listen to all refs.
*/
ref?: string;
/**
* Secret of GitHub webhook
*/
secret: string;
/**
* paths to revalidate docs
*
* @defaultValue '/docs/[[...slug]]' and '/docs'
*/
paths?: {
path: string;
type: 'page' | 'layout';
}[];
}): {
POST: (next: Request) => Promise<Response>;
};
interface HotReloadOptions {
/**
* @defaultValue 3001
*/
port?: number;
/**
* API endpoint for revoking cache
*
* @defaultValue '/api/revoke'
*/
revokeUrl?: string;
}
interface HotReloadInfo {
ws?: WebSocket;
component: React.ReactElement | null;
}
declare function initHotReload({ port, revokeUrl, }?: HotReloadOptions): HotReloadInfo;
export { type HotReloadInfo, createGithubWebhookAPI, initHotReload };