65 lines
3.1 KiB
TypeScript
65 lines
3.1 KiB
TypeScript
import type { CacheNodeSeedData, FlightRouterState } from '../../../shared/lib/app-router-types';
|
|
import type { CacheNode } from '../../../shared/lib/app-router-types';
|
|
import type { HeadData, ScrollRef } from '../../../shared/lib/app-router-types';
|
|
import { type RouteTree, type RefreshState, type FulfilledRouteCacheEntry } from '../segment-cache/cache';
|
|
import { type PageVaryPath } from '../segment-cache/vary-path';
|
|
export type NavigationTask = {
|
|
status: NavigationTaskStatus;
|
|
route: FlightRouterState;
|
|
node: CacheNode;
|
|
dynamicRequestTree: FlightRouterState | null;
|
|
refreshState: RefreshState | null;
|
|
children: Map<string, NavigationTask> | null;
|
|
};
|
|
export declare const enum FreshnessPolicy {
|
|
Default = 0,
|
|
Hydration = 1,
|
|
HistoryTraversal = 2,
|
|
RefreshAll = 3,
|
|
HMRRefresh = 4,
|
|
Gesture = 5
|
|
}
|
|
declare const enum NavigationTaskStatus {
|
|
Pending = 0,
|
|
Fulfilled = 1,
|
|
Rejected = 2
|
|
}
|
|
export type NavigationRequestAccumulation = {
|
|
separateRefreshUrls: Set<string> | null;
|
|
/**
|
|
* Set when a navigation creates new leaf segments that should be
|
|
* scrolled to. Stays null when no new segments are created (e.g.
|
|
* during a refresh where the route structure didn't change).
|
|
*/
|
|
scrollRef: ScrollRef | null;
|
|
};
|
|
export declare function createInitialCacheNodeForHydration(navigatedAt: number, initialTree: RouteTree, seedData: CacheNodeSeedData | null, seedHead: HeadData, seedDynamicStaleAt: number): NavigationTask;
|
|
export declare function startPPRNavigation(navigatedAt: number, oldUrl: URL, oldRenderedSearch: string, oldCacheNode: CacheNode | null, oldRouterState: FlightRouterState, newRouteTree: RouteTree, newMetadataVaryPath: PageVaryPath | null, freshness: FreshnessPolicy, seedData: CacheNodeSeedData | null, seedHead: HeadData | null, seedDynamicStaleAt: number, isSamePageNavigation: boolean, accumulation: NavigationRequestAccumulation): NavigationTask | null;
|
|
export declare function spawnDynamicRequests(task: NavigationTask, primaryUrl: URL, nextUrl: string | null, freshnessPolicy: FreshnessPolicy, accumulation: NavigationRequestAccumulation, routeCacheEntry: FulfilledRouteCacheEntry | null, navigateType: 'push' | 'replace'): void;
|
|
type PendingDeferredRsc<T> = Promise<T> & {
|
|
status: 'pending';
|
|
resolve: (value: T, debugInfo: Array<any> | null) => void;
|
|
reject: (error: any, debugInfo: Array<any> | null) => void;
|
|
tag: Symbol;
|
|
_debugInfo: Array<any>;
|
|
};
|
|
type FulfilledDeferredRsc<T> = Promise<T> & {
|
|
status: 'fulfilled';
|
|
value: T;
|
|
resolve: (value: T, debugInfo: Array<any> | null) => void;
|
|
reject: (error: any, debugInfo: Array<any> | null) => void;
|
|
tag: Symbol;
|
|
_debugInfo: Array<any>;
|
|
};
|
|
type RejectedDeferredRsc<T> = Promise<T> & {
|
|
status: 'rejected';
|
|
reason: any;
|
|
resolve: (value: T, debugInfo: Array<any> | null) => void;
|
|
reject: (error: any, debugInfo: Array<any> | null) => void;
|
|
tag: Symbol;
|
|
_debugInfo: Array<any>;
|
|
};
|
|
type DeferredRsc<T extends React.ReactNode = React.ReactNode> = PendingDeferredRsc<T> | FulfilledDeferredRsc<T> | RejectedDeferredRsc<T>;
|
|
export declare function isDeferredRsc(value: any): value is DeferredRsc;
|
|
export {};
|