import { CacheHandler } from '../cache-handler.js'; import '../next-common-DLx9ZJNi.js'; import 'next/dist/server/lib/incremental-cache'; import 'next/dist/server/lib/incremental-cache/file-system-cache'; type CacheHandlerType = typeof CacheHandler; /** * Options for the `registerInitialCache` instrumentation. * * @since 1.7.0 */ type RegisterInitialCacheOptions = { /** * Whether to populate the cache with fetch calls. * * @default true * * @since 1.7.0 */ fetch?: boolean; /** * Whether to populate the cache with pre-rendered pages. * * @default true * * @since 1.7.0 */ pages?: boolean; /** * Whether to populate the cache with routes. * * @default true * * @since 1.7.0 */ routes?: boolean; }; /** * Populates the cache with the initial data. * * By default, it includes the following: * - Pre-rendered pages * - Routes * - Fetch calls * * @param CacheHandler - The configured CacheHandler class, not an instance. * * @param [options={}] - Options for the instrumentation. See {@link RegisterInitialCacheOptions}. * * @param [options.fetch=true] - Whether to populate the cache with fetch calls. * * @param [options.pages=true] - Whether to populate the cache with pre-rendered pages. * * @param [options.routes=true] - Whether to populate the cache with routes. * * @example file: `instrumentation.ts` * * ```js * export async function register() { * if (process.env.NEXT_RUNTIME === 'nodejs') { * const { registerInitialCache } = await import('@neshca/cache-handler/instrumentation'); * // Assuming that your CacheHandler configuration is in the root of the project and the instrumentation is in the src directory. * // Please adjust the path accordingly. * // CommonJS CacheHandler configuration is also supported. * const CacheHandler = (await import('../cache-handler.mjs')).default; * await registerInitialCache(CacheHandler); * } * } * ``` * * @since 1.7.0 */ declare function registerInitialCache(CacheHandler: CacheHandlerType, options?: RegisterInitialCacheOptions): Promise; export { type RegisterInitialCacheOptions, registerInitialCache };