hatch-surf/node_modules/next/dist/server/app-render/stale-time.d.ts
Riley Zhang df378d33ef
Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Merge GitHub main into Gitea repo (allow unrelated histories)
Resolved conflicts by taking GitHub versions for:
- .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml

Kept deploy.sh updated to:
- Pull from GitHub (primary source)
- Push to Gitea (push-mirror)
- Build from site/ directory (GitHub structure)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-25 05:20:46 +02:00

45 lines
2.0 KiB
TypeScript

import type { ExperimentalConfig } from '../config-shared';
/**
* An AsyncIterable<number> that yields staleTime values. Each call to
* `update()` yields the new value. When `close()` is called, the iteration
* ends.
*
* This is included in the RSC payload so Flight serializes each yielded value
* into the stream immediately. If the prerender is aborted by sync IO, the last
* yielded value is already in the stream, allowing the prerender to be aborted
* synchronously.
*/
export declare class StaleTimeIterable {
private _resolve;
private _done;
private _buffer;
/** The last value passed to `update()`. */
currentValue: number;
update(value: number): void;
close(): void;
[Symbol.asyncIterator](): AsyncIterator<number>;
}
export declare function createSelectStaleTime(experimental: ExperimentalConfig): (stale: number) => number;
/**
* Intercepts writes to the `stale` field on the prerender store and yields
* each update (after applying selectStaleTime) through the iterable. This
* ensures the latest stale time is always serialized in the Flight stream,
* even if the prerender is aborted by sync IO.
*/
export declare function trackStaleTime(store: {
stale: number;
}, iterable: StaleTimeIterable, selectStaleTime: (stale: number) => number): void;
/**
* Closes the stale time iterable and waits for React to flush the closing
* chunk into the Flight stream. This also allows the prerender to complete if
* no other work is pending.
*
* Flight's internal work gets scheduled as a microtask when we close the
* iterable. We need to ensure Flight's pending queues are emptied before this
* function returns, because the caller will abort the prerender immediately
* after. We can't use a macrotask (that would allow dynamic IO to sneak into
* the response), so we use microtasks instead. The exact number of awaits
* isn't important as long as we wait enough ticks for Flight to finish writing.
*/
export declare function finishStaleTimeTracking(iterable: StaleTimeIterable): Promise<void>;