2022-11-06 23:56:48 +01:00
|
|
|
import type { AsyncLocalStorage } from 'async_hooks'
|
|
|
|
|
|
|
|
export interface StaticGenerationStore {
|
|
|
|
inUse?: boolean
|
|
|
|
pathname?: string
|
|
|
|
revalidate?: number
|
|
|
|
fetchRevalidate?: number
|
|
|
|
isStaticGeneration?: boolean
|
2022-11-18 18:47:44 +01:00
|
|
|
forceStatic?: boolean
|
2022-12-03 08:32:49 +01:00
|
|
|
incrementalCache?: import('../../server/lib/incremental-cache').IncrementalCache
|
|
|
|
pendingRevalidates?: Promise<any>[]
|
|
|
|
isRevalidate?: boolean
|
2022-11-06 23:56:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export let staticGenerationAsyncStorage:
|
|
|
|
| AsyncLocalStorage<StaticGenerationStore>
|
|
|
|
| StaticGenerationStore = {}
|
|
|
|
|
2022-11-08 14:45:30 +01:00
|
|
|
// @ts-expect-error we provide this on globalThis in
|
2022-11-06 23:56:48 +01:00
|
|
|
// the edge and node runtime
|
2022-11-08 14:45:30 +01:00
|
|
|
if (globalThis.AsyncLocalStorage) {
|
|
|
|
staticGenerationAsyncStorage = new (globalThis as any).AsyncLocalStorage()
|
2022-11-06 23:56:48 +01:00
|
|
|
}
|