@@ -2,24 +2,21 @@ import type { ParamValue, Params } from '../../server/request/params'
22import type { AppPageModule } from '../../server/route-modules/app-page/module'
33import type { AppSegment } from '../segment-config/app/app-segments'
44import type { StaticPathsResult } from './types'
5- import type { CacheHandler } from '../../server/lib/incremental-cache'
65
76import path from 'path'
87import { AfterRunner } from '../../server/after/run-with-after'
98import { createWorkStore } from '../../server/async-storage/work-store'
109import { FallbackMode } from '../../lib/fallback'
11- import { formatDynamicImportPath } from '../../lib/format-dynamic-import-path'
1210import { getRouteMatcher } from '../../shared/lib/router/utils/route-matcher'
1311import {
1412 getRouteRegex ,
1513 type RouteRegex ,
1614} from '../../shared/lib/router/utils/route-regex'
17- import { IncrementalCache } from '../../server/lib/incremental-cache'
18- import { interopDefault } from '../../lib/interop-default'
19- import { nodeFs } from '../../server/lib/node-fs-methods'
15+ import type { IncrementalCache } from '../../server/lib/incremental-cache'
2016import { normalizePathname , encodeParam } from './utils'
21- import * as ciEnvironment from '../../server/ci-info'
2217import escapePathDelimiters from '../../shared/lib/router/utils/escape-path-delimiters'
18+ import { createIncrementalCache } from '../../export/helpers/create-incremental-cache'
19+ import type { NextConfigComplete } from '../../server/config-shared'
2320
2421/**
2522 * Compares two parameters to see if they're equal.
@@ -263,6 +260,7 @@ export async function buildAppStaticPaths({
263260 cacheHandler,
264261 cacheLifeProfiles,
265262 requestHeaders,
263+ cacheHandlers,
266264 maxMemoryCacheSize,
267265 fetchCacheKeyPrefix,
268266 nextConfigOutput,
@@ -280,6 +278,7 @@ export async function buildAppStaticPaths({
280278 isrFlushToDisk ?: boolean
281279 fetchCacheKeyPrefix ?: string
282280 cacheHandler ?: string
281+ cacheHandlers ?: NextConfigComplete [ 'experimental' ] [ 'cacheHandlers' ]
283282 cacheLifeProfiles ?: {
284283 [ profile : string ] : import ( '../../server/use-cache/cache-life' ) . CacheLife
285284 }
@@ -302,33 +301,16 @@ export async function buildAppStaticPaths({
302301
303302 ComponentMod . patchFetch ( )
304303
305- let CurCacheHandler : typeof CacheHandler | undefined
306- if ( cacheHandler ) {
307- CurCacheHandler = interopDefault (
308- await import ( formatDynamicImportPath ( dir , cacheHandler ) ) . then (
309- ( mod ) => mod . default || mod
310- )
311- )
312- }
313-
314- const incrementalCache = new IncrementalCache ( {
315- fs : nodeFs ,
316- dev : true ,
304+ const incrementalCache = await createIncrementalCache ( {
305+ dir,
306+ distDir,
317307 dynamicIO,
318- flushToDisk : isrFlushToDisk ,
319- serverDistDir : path . join ( distDir , 'server' ) ,
320- fetchCacheKeyPrefix,
321- maxMemoryCacheSize,
322- getPrerenderManifest : ( ) => ( {
323- version : - 1 as any , // letting us know this doesn't conform to spec
324- routes : { } ,
325- dynamicRoutes : { } ,
326- notFoundRoutes : [ ] ,
327- preview : null as any , // `preview` is special case read in next-dev-server
328- } ) ,
329- CurCacheHandler,
308+ cacheHandler,
309+ cacheHandlers,
330310 requestHeaders,
331- minimalMode : ciEnvironment . hasNextSupport ,
311+ fetchCacheKeyPrefix,
312+ flushToDisk : isrFlushToDisk ,
313+ cacheMaxMemorySize : maxMemoryCacheSize ,
332314 } )
333315
334316 const regex = getRouteRegex ( page )
0 commit comments