abd5a8436f
Fixes: https://github.com/vercel/next.js/issues/42932 x-ref: [slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1668639343426429?thread_ts=1668631260.554489&cid=C03S8ED1DKM) ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md`
20 lines
555 B
TypeScript
20 lines
555 B
TypeScript
import type { AsyncLocalStorage } from 'async_hooks'
|
|
|
|
export interface StaticGenerationStore {
|
|
inUse?: boolean
|
|
pathname?: string
|
|
revalidate?: number
|
|
fetchRevalidate?: number
|
|
isStaticGeneration?: boolean
|
|
forceStatic?: boolean
|
|
}
|
|
|
|
export let staticGenerationAsyncStorage:
|
|
| AsyncLocalStorage<StaticGenerationStore>
|
|
| StaticGenerationStore = {}
|
|
|
|
// @ts-expect-error we provide this on globalThis in
|
|
// the edge and node runtime
|
|
if (globalThis.AsyncLocalStorage) {
|
|
staticGenerationAsyncStorage = new (globalThis as any).AsyncLocalStorage()
|
|
}
|