|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type { NavigationResult } from './segment-cache-impl/navigation' |
|
|
export type { PrefetchTask } from './segment-cache-impl/scheduler' |
|
|
|
|
|
const notEnabled: any = () => { |
|
|
throw new Error( |
|
|
'Segment Cache experiment is not enabled. This is a bug in Next.js.' |
|
|
) |
|
|
} |
|
|
|
|
|
export const prefetch: typeof import('./segment-cache-impl/prefetch').prefetch = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/prefetch') as typeof import('./segment-cache-impl/prefetch') |
|
|
).prefetch(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
export const navigate: typeof import('./segment-cache-impl/navigation').navigate = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/navigation') as typeof import('./segment-cache-impl/navigation') |
|
|
).navigate(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
export const revalidateEntireCache: typeof import('./segment-cache-impl/cache').revalidateEntireCache = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/cache') as typeof import('./segment-cache-impl/cache') |
|
|
).revalidateEntireCache(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
export const getCurrentCacheVersion: typeof import('./segment-cache-impl/cache').getCurrentCacheVersion = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/cache') as typeof import('./segment-cache-impl/cache') |
|
|
).getCurrentCacheVersion(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
export const schedulePrefetchTask: typeof import('./segment-cache-impl/scheduler').schedulePrefetchTask = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/scheduler') as typeof import('./segment-cache-impl/scheduler') |
|
|
).schedulePrefetchTask(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
export const cancelPrefetchTask: typeof import('./segment-cache-impl/scheduler').cancelPrefetchTask = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/scheduler') as typeof import('./segment-cache-impl/scheduler') |
|
|
).cancelPrefetchTask(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
export const reschedulePrefetchTask: typeof import('./segment-cache-impl/scheduler').reschedulePrefetchTask = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/scheduler') as typeof import('./segment-cache-impl/scheduler') |
|
|
).reschedulePrefetchTask(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
export const isPrefetchTaskDirty: typeof import('./segment-cache-impl/scheduler').isPrefetchTaskDirty = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/scheduler') as typeof import('./segment-cache-impl/scheduler') |
|
|
).isPrefetchTaskDirty(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
export const createCacheKey: typeof import('./segment-cache-impl/cache-key').createCacheKey = |
|
|
process.env.__NEXT_CLIENT_SEGMENT_CACHE |
|
|
? function (...args) { |
|
|
return ( |
|
|
require('./segment-cache-impl/cache-key') as typeof import('./segment-cache-impl/cache-key') |
|
|
).createCacheKey(...args) |
|
|
} |
|
|
: notEnabled |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const enum NavigationResultTag { |
|
|
MPA, |
|
|
Success, |
|
|
NoOp, |
|
|
Async, |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const enum PrefetchPriority { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Intent = 2, |
|
|
|
|
|
|
|
|
|
|
|
Default = 1, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Background = 0, |
|
|
} |
|
|
|
|
|
export const enum FetchStrategy { |
|
|
PPR, |
|
|
Full, |
|
|
LoadingBoundary, |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type PrefetchTaskFetchStrategy = FetchStrategy.PPR | FetchStrategy.Full |
|
|
|