@rangojs/router 0.24.4 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/bin/rango.js +363 -39
- package/dist/testing/vitest.js +37 -4
- package/dist/types/browser/event-controller.d.ts +24 -5
- package/dist/types/browser/intercept-utils.d.ts +5 -2
- package/dist/types/browser/merge-segment-loaders.d.ts +0 -23
- package/dist/types/browser/navigation-transaction.d.ts +5 -5
- package/dist/types/browser/partial-update.d.ts +21 -13
- package/dist/types/browser/prefetch/cache.d.ts +8 -0
- package/dist/types/browser/rango-marker.d.ts +7 -0
- package/dist/types/browser/react/filter-segment-order.d.ts +10 -0
- package/dist/types/browser/react/use-handle.d.ts +20 -0
- package/dist/types/browser/react/use-href.d.ts +6 -0
- package/dist/types/browser/react/use-router.d.ts +6 -1
- package/dist/types/browser/response-adapter.d.ts +5 -3
- package/dist/types/browser/scroll-restoration.d.ts +9 -3
- package/dist/types/browser/segment-reconciler.d.ts +10 -13
- package/dist/types/browser/types.d.ts +38 -8
- package/dist/types/build/route-types/per-module-writer.d.ts +12 -0
- package/dist/types/cache/cf/cf-cache-store.d.ts +0 -2
- package/dist/types/cache/cf/cf-cache-types.d.ts +0 -16
- package/dist/types/cache/cf/cf-shell-frame.d.ts +2 -0
- package/dist/types/cache/handle-snapshot.d.ts +2 -2
- package/dist/types/cache/types.d.ts +16 -6
- package/dist/types/cache/vercel/vercel-cache-store.d.ts +1 -15
- package/dist/types/client-urls/client-urls.d.ts +6 -2
- package/dist/types/client-urls/revalidate-registry.d.ts +1 -1
- package/dist/types/client-urls/server-projection.d.ts +9 -5
- package/dist/types/client-urls/types.d.ts +29 -16
- package/dist/types/client.d.ts +2 -2
- package/dist/types/client.rsc.d.ts +2 -2
- package/dist/types/decode-loader-results.d.ts +28 -7
- package/dist/types/handles/deferred-resolution.d.ts +3 -2
- package/dist/types/handles/meta.d.ts +5 -0
- package/dist/types/href-client.d.ts +3 -1
- package/dist/types/index.rsc.d.ts +1 -1
- package/dist/types/loader-redirect.d.ts +2 -3
- package/dist/types/outlet-context.d.ts +7 -6
- package/dist/types/prefetch-markers.d.ts +14 -5
- package/dist/types/prerender/build-shell-capture.d.ts +1 -2
- package/dist/types/prerender/writable-store.d.ts +2 -3
- package/dist/types/route-content-wrapper.d.ts +17 -14
- package/dist/types/route-definition/helpers-types.d.ts +7 -2
- package/dist/types/route-definition/resolve-handler-use.d.ts +6 -1
- package/dist/types/route-definition/rewrite.d.ts +48 -5
- package/dist/types/route-types.d.ts +2 -2
- package/dist/types/router/handler-context.d.ts +14 -2
- package/dist/types/router/intercept-resolution.d.ts +19 -46
- package/dist/types/router/lazy-includes.d.ts +7 -0
- package/dist/types/router/match-middleware/intercept-resolution.d.ts +2 -2
- package/dist/types/router/middleware.d.ts +0 -16
- package/dist/types/router/navigation-snapshot.d.ts +2 -0
- package/dist/types/router/prefetch-cache-ttl.d.ts +8 -11
- package/dist/types/router/revalidation.d.ts +8 -1
- package/dist/types/router/router-context.d.ts +4 -16
- package/dist/types/router/router-interfaces.d.ts +0 -11
- package/dist/types/router/router-options.d.ts +4 -27
- package/dist/types/router/segment-resolution/mask-nested.d.ts +5 -3
- package/dist/types/router/segment-resolution/prefetch-deferral.d.ts +31 -8
- package/dist/types/router/segment-resolution/revalidation.d.ts +38 -4
- package/dist/types/router/segment-resolution.d.ts +1 -1
- package/dist/types/router/segment-wrappers.d.ts +3 -5
- package/dist/types/router/substitute-pattern-params.d.ts +3 -2
- package/dist/types/router/tracing.d.ts +2 -2
- package/dist/types/router-versions.d.ts +8 -6
- package/dist/types/rsc/full-payload.d.ts +14 -2
- package/dist/types/rsc/helpers.d.ts +8 -0
- package/dist/types/rsc/manifest-init.d.ts +20 -0
- package/dist/types/rsc/prefetch-render-error.d.ts +22 -0
- package/dist/types/rsc/progressive-enhancement.d.ts +20 -0
- package/dist/types/rsc/rewrite-passes.d.ts +12 -2
- package/dist/types/rsc/server-action.d.ts +6 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +14 -4
- package/dist/types/rsc/shell-capture.d.ts +23 -2
- package/dist/types/rsc/types.d.ts +5 -8
- package/dist/types/segment-system.d.ts +15 -0
- package/dist/types/server/build-version-table.d.ts +10 -13
- package/dist/types/server/context.d.ts +90 -6
- package/dist/types/server/handle-store.d.ts +17 -6
- package/dist/types/server/request-context.d.ts +45 -7
- package/dist/types/server/request-headers.d.ts +12 -0
- package/dist/types/server/rewrite-trail.d.ts +8 -1
- package/dist/types/testing/build-versions.d.ts +0 -3
- package/dist/types/testing/e2e/index.d.ts +1 -1
- package/dist/types/testing/flight.entry.d.ts +1 -1
- package/dist/types/testing/index.d.ts +1 -1
- package/dist/types/testing/internal/client-urls-projection.d.ts +4 -3
- package/dist/types/testing/internal/seed-vars.d.ts +4 -4
- package/dist/types/testing/render-route.d.ts +21 -11
- package/dist/types/testing/run-loader.d.ts +7 -0
- package/dist/types/testing/run-middleware.d.ts +7 -0
- package/dist/types/testing/run-revalidate.d.ts +5 -4
- package/dist/types/testing/serve-shell-request.d.ts +42 -5
- package/dist/types/testing/shell-status.d.ts +17 -0
- package/dist/types/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types/testing/vitest.d.ts +10 -1
- package/dist/types/thenable-status.d.ts +0 -6
- package/dist/types/types/handler-context.d.ts +12 -1
- package/dist/types/types/loader-types.d.ts +10 -4
- package/dist/types/types/route-entry.d.ts +2 -1
- package/dist/types/urls/path-helper-types.d.ts +4 -2
- package/dist/types/vite/discovery/client-urls-projection.d.ts +55 -5
- package/dist/types/vite/discovery/state.d.ts +20 -0
- package/dist/types/vite/plugins/client-urls-revalidate-hoist.d.ts +28 -16
- package/dist/types/vite/plugins/hoist/source.d.ts +8 -7
- package/dist/types/vite/plugins/virtual-entries.d.ts +6 -0
- package/dist/types/vite/utils/prerender-utils.d.ts +7 -0
- package/dist/vite/index.js +6819 -6555
- package/package.json +1 -1
- package/skills/app-structure/SKILL.md +255 -0
- package/skills/app-structure/content-site.md +333 -0
- package/skills/app-structure/e-commerce.md +435 -0
- package/skills/app-structure/large-app.md +885 -0
- package/skills/app-structure/multi-app.md +280 -0
- package/skills/breadcrumbs/SKILL.md +6 -1
- package/skills/cache-guide/SKILL.md +4 -8
- package/skills/caching/SKILL.md +6 -6
- package/skills/catalog.json +12 -0
- package/skills/client-urls/SKILL.md +185 -32
- package/skills/comparison/references/framework-comparison.md +1 -1
- package/skills/composability/SKILL.md +10 -8
- package/skills/handler-use/SKILL.md +48 -9
- package/skills/hooks/handle-and-actions.md +104 -0
- package/skills/hooks/navigation.md +24 -10
- package/skills/hooks/urls.md +1 -1
- package/skills/host-router/SKILL.md +1 -1
- package/skills/i18n/SKILL.md +2 -1
- package/skills/intercept/SKILL.md +60 -29
- package/skills/layout/SKILL.md +6 -3
- package/skills/links/SKILL.md +151 -17
- package/skills/loader/SKILL.md +42 -19
- package/skills/middleware/SKILL.md +111 -15
- package/skills/observability/SKILL.md +11 -0
- package/skills/parallel/SKILL.md +5 -5
- package/skills/ppr/SKILL.md +103 -52
- package/skills/prerender/SKILL.md +4 -5
- package/skills/rango/SKILL.md +3 -0
- package/skills/response-routes/SKILL.md +4 -1
- package/skills/router-setup/SKILL.md +0 -2
- package/skills/scripts/SKILL.md +12 -1
- package/skills/server-actions/SKILL.md +60 -20
- package/skills/testing/SKILL.md +1 -0
- package/skills/testing/client-components.md +13 -10
- package/skills/testing/loader.md +25 -24
- package/skills/testing/middleware.md +11 -11
- package/skills/testing/render-handler.md +17 -17
- package/skills/testing/response-routes.md +4 -1
- package/skills/testing/serve-shell-request.md +86 -22
- package/skills/testing/server-actions.md +16 -16
- package/skills/ux-architecture/SKILL.md +980 -0
- package/skills/vercel/SKILL.md +1 -1
- package/skills/view-transitions/SKILL.md +43 -10
- package/src/__augment-tests__/augmented.check.ts +28 -0
- package/src/browser/event-controller.ts +44 -18
- package/src/browser/intercept-utils.ts +3 -2
- package/src/browser/merge-segment-loaders.ts +0 -85
- package/src/browser/navigation-bridge.ts +112 -84
- package/src/browser/navigation-client.ts +20 -15
- package/src/browser/navigation-store.ts +4 -2
- package/src/browser/navigation-transaction.ts +9 -8
- package/src/browser/partial-update.ts +90 -32
- package/src/browser/prefetch/cache.ts +8 -0
- package/src/browser/prefetch/fetch.ts +13 -3
- package/src/browser/rango-marker.ts +13 -0
- package/src/browser/react/NavigationProvider.tsx +25 -7
- package/src/browser/react/filter-segment-order.ts +13 -0
- package/src/browser/react/use-action.ts +9 -15
- package/src/browser/react/use-handle.ts +63 -71
- package/src/browser/react/use-href.tsx +24 -5
- package/src/browser/react/use-link-status.ts +1 -1
- package/src/browser/react/use-navigation.ts +30 -40
- package/src/browser/react/use-router.ts +37 -6
- package/src/browser/react/use-segments.ts +8 -12
- package/src/browser/response-adapter.ts +11 -5
- package/src/browser/rsc-router.tsx +3 -1
- package/src/browser/scroll-restoration.ts +34 -20
- package/src/browser/segment-reconciler.ts +11 -29
- package/src/browser/server-action-bridge.ts +52 -16
- package/src/browser/types.ts +40 -8
- package/src/build/generate-manifest.ts +12 -1
- package/src/build/route-types/codegen.ts +6 -2
- package/src/build/route-types/per-module-writer.ts +94 -61
- package/src/cache/cache-runtime.ts +9 -0
- package/src/cache/cache-scope.ts +2 -1
- package/src/cache/cf/cf-cache-store.ts +6 -7
- package/src/cache/cf/cf-cache-types.ts +0 -17
- package/src/cache/cf/cf-shell-frame.ts +3 -0
- package/src/cache/handle-snapshot.ts +2 -2
- package/src/cache/types.ts +16 -6
- package/src/cache/vercel/vercel-cache-store.ts +8 -19
- package/src/client-urls/client-urls.ts +202 -153
- package/src/client-urls/revalidate-registry.ts +12 -3
- package/src/client-urls/server-projection.ts +137 -66
- package/src/client-urls/types.ts +30 -15
- package/src/client.rsc.tsx +11 -1
- package/src/client.tsx +9 -1
- package/src/decode-loader-results.ts +64 -31
- package/src/handles/deferred-resolution.ts +3 -2
- package/src/handles/meta.ts +5 -0
- package/src/href-client.ts +3 -1
- package/src/index.rsc.ts +1 -0
- package/src/index.ts +12 -4
- package/src/loader-redirect.tsx +2 -3
- package/src/outlet-context.ts +7 -6
- package/src/prefetch-markers.ts +15 -5
- package/src/prerender/build-shell-capture.ts +1 -2
- package/src/prerender/writable-store.ts +2 -3
- package/src/reverse.ts +3 -3
- package/src/route-content-wrapper.tsx +19 -17
- package/src/route-definition/dsl-helpers.ts +41 -21
- package/src/route-definition/helpers-types.ts +7 -2
- package/src/route-definition/resolve-handler-use.ts +23 -10
- package/src/route-definition/rewrite.ts +86 -19
- package/src/route-types.ts +1 -2
- package/src/router/find-match.ts +37 -1
- package/src/router/handler-context.ts +85 -40
- package/src/router/intercept-resolution.ts +161 -307
- package/src/router/lazy-includes.ts +43 -27
- package/src/router/loader-resolution.ts +21 -1
- package/src/router/manifest.ts +15 -10
- package/src/router/match-api.ts +11 -1
- package/src/router/match-middleware/background-revalidation.ts +2 -4
- package/src/router/match-middleware/cache-lookup.ts +16 -20
- package/src/router/match-middleware/intercept-resolution.ts +41 -60
- package/src/router/match-result.ts +31 -2
- package/src/router/middleware.ts +6 -147
- package/src/router/navigation-snapshot.ts +38 -2
- package/src/router/prefetch-cache-ttl.ts +10 -18
- package/src/router/prerender-match.ts +2 -1
- package/src/router/revalidation.ts +24 -3
- package/src/router/router-context.ts +5 -18
- package/src/router/router-interfaces.ts +0 -13
- package/src/router/router-options.ts +4 -28
- package/src/router/segment-resolution/fresh.ts +6 -2
- package/src/router/segment-resolution/helpers.ts +7 -1
- package/src/router/segment-resolution/loader-cache.ts +4 -3
- package/src/router/segment-resolution/mask-nested.ts +5 -3
- package/src/router/segment-resolution/prefetch-deferral.ts +62 -12
- package/src/router/segment-resolution/revalidation.ts +75 -35
- package/src/router/segment-resolution.ts +0 -1
- package/src/router/segment-wrappers.ts +8 -13
- package/src/router/substitute-pattern-params.ts +3 -2
- package/src/router/tracing.ts +2 -2
- package/src/router-versions.ts +7 -7
- package/src/router.ts +5 -17
- package/src/rsc/full-payload.ts +26 -4
- package/src/rsc/handler.ts +86 -48
- package/src/rsc/helpers.ts +13 -0
- package/src/rsc/manifest-init.ts +56 -3
- package/src/rsc/prefetch-render-error.ts +38 -0
- package/src/rsc/progressive-enhancement.ts +161 -211
- package/src/rsc/rewrite-passes.ts +56 -9
- package/src/rsc/rsc-rendering.ts +79 -23
- package/src/rsc/server-action.ts +25 -2
- package/src/rsc/shell-capture-constants.ts +26 -3
- package/src/rsc/shell-capture.ts +137 -51
- package/src/rsc/types.ts +5 -9
- package/src/segment-system.tsx +125 -119
- package/src/server/build-version-table.ts +12 -24
- package/src/server/context.ts +160 -7
- package/src/server/handle-store.ts +80 -12
- package/src/server/request-context.ts +46 -6
- package/src/server/request-headers.ts +32 -0
- package/src/server/rewrite-trail.ts +55 -9
- package/src/ssr/ssr-root.tsx +6 -10
- package/src/testing/build-versions.ts +0 -3
- package/src/testing/dispatch.ts +5 -8
- package/src/testing/e2e/index.ts +1 -0
- package/src/testing/flight.entry.ts +1 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/internal/client-urls-projection.ts +31 -11
- package/src/testing/internal/seed-vars.ts +4 -4
- package/src/testing/render-route.tsx +83 -40
- package/src/testing/run-loader.ts +26 -2
- package/src/testing/run-middleware.ts +10 -0
- package/src/testing/run-revalidate.ts +13 -6
- package/src/testing/serve-shell-request.ts +79 -9
- package/src/testing/shell-status.ts +40 -0
- package/src/testing/vitest-stubs/version.ts +1 -0
- package/src/testing/vitest.ts +74 -7
- package/src/thenable-status.ts +0 -11
- package/src/types/handler-context.ts +12 -1
- package/src/types/loader-types.ts +10 -4
- package/src/types/route-entry.ts +2 -1
- package/src/urls/include-helper.ts +38 -11
- package/src/urls/path-helper-types.ts +4 -2
- package/src/vite/discovery/client-urls-projection.ts +205 -16
- package/src/vite/discovery/discover-routers.ts +2 -2
- package/src/vite/discovery/prerender-collection.ts +2 -6
- package/src/vite/discovery/shell-prerender-phase.ts +1 -5
- package/src/vite/discovery/state.ts +26 -0
- package/src/vite/plugins/client-urls-revalidate-hoist.ts +190 -77
- package/src/vite/plugins/expose-internal-ids.ts +46 -40
- package/src/vite/plugins/hoist/source.ts +8 -7
- package/src/vite/plugins/transition-when-hoist.ts +1 -0
- package/src/vite/plugins/version-plugin.ts +7 -0
- package/src/vite/plugins/version.d.ts +7 -0
- package/src/vite/plugins/virtual-entries.ts +20 -0
- package/src/vite/rango.ts +4 -1
- package/src/vite/router-discovery.ts +39 -7
- package/src/vite/utils/prerender-utils.ts +17 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { NavigationStore, NavigationClient, UpdateSubscriber, ResolvedSegment } from "./types.js";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
+
export declare const addTransitionType: ((type: string) => void) | undefined;
|
|
3
4
|
import type { RenderSegmentsOptions } from "../segment-system.js";
|
|
4
5
|
import type { BoundTransaction } from "./navigation-transaction.js";
|
|
5
|
-
import type { HandleData, NavigationUpdate, RscMetadata } from "./types.js";
|
|
6
|
+
import type { HandleData, NavigationUpdate, RscMetadata, ShownEntry } from "./types.js";
|
|
6
7
|
import type { LoaderStore } from "../loader-store.js";
|
|
7
8
|
import { type TransitionWhenActionInput } from "./transition-when.js";
|
|
9
|
+
import { type TransitionWhenKind } from "../types/segments.js";
|
|
8
10
|
/**
|
|
9
11
|
* Hold/animate decision for a commit: a non-intercept segment carries a
|
|
10
12
|
* transition, no intercept is presented, and this navigation's
|
|
@@ -18,8 +20,10 @@ export declare function shouldStartViewTransition(segments: readonly ResolvedSeg
|
|
|
18
20
|
* settled/cached segments make it a no-op. Urgent commits call onUpdate
|
|
19
21
|
* directly: nothing is held there, a reader of a pending stream suspends to
|
|
20
22
|
* its fallback. Also used by renderRoute's navigate() (testing/render-route.tsx).
|
|
23
|
+
* Every commit is tagged with its transition({ when }) `kind` (#1165), then
|
|
24
|
+
* `transitionTypes`.
|
|
21
25
|
*/
|
|
22
|
-
export declare function commitInTransition(loaders: LoaderStore, onUpdate: UpdateSubscriber, segments: readonly ResolvedSegment[], update: NavigationUpdate, transitionTypes: readonly string[]): void;
|
|
26
|
+
export declare function commitInTransition(loaders: LoaderStore, onUpdate: UpdateSubscriber, segments: readonly ResolvedSegment[], update: NavigationUpdate, kind: TransitionWhenKind, transitionTypes: readonly string[]): void;
|
|
23
27
|
/**
|
|
24
28
|
* Configuration for creating a partial updater
|
|
25
29
|
*/
|
|
@@ -45,13 +49,15 @@ export interface PartialUpdateConfig {
|
|
|
45
49
|
/** What the response's handlers pushed, to the handle store. */
|
|
46
50
|
handles(metadata: RscMetadata): void;
|
|
47
51
|
/**
|
|
48
|
-
* Deliver the navigation state to its readers now. A page
|
|
49
|
-
* holes commits in the task of its click, before the
|
|
50
|
-
* click has gone out (event-controller.ts
|
|
51
|
-
* React holds that commit where a hole is
|
|
52
|
-
* this useNavigation() reads idle, on the
|
|
53
|
-
* wait.
|
|
54
|
-
* handed over, and stays while React holds it,
|
|
52
|
+
* Deliver the navigation state to its readers now, and commit it. A page
|
|
53
|
+
* built with holes commits in the task of its click, before the
|
|
54
|
+
* notification of the click has gone out (event-controller.ts
|
|
55
|
+
* makeDebouncedNotifier), and React holds that commit where a hole is
|
|
56
|
+
* read with no boundary: without this useNavigation() reads idle, on the
|
|
57
|
+
* page being left, for the whole wait. Committed first, `loading` is on
|
|
58
|
+
* screen when the commit is handed over, and stays while React holds it,
|
|
59
|
+
* as for a plain click. Delivered at default priority it joins the
|
|
60
|
+
* commit's urgent batch, which brings idle with the URL, and never shows.
|
|
55
61
|
*/
|
|
56
62
|
flush(): void;
|
|
57
63
|
};
|
|
@@ -70,8 +76,8 @@ export interface CommitOverrides {
|
|
|
70
76
|
interceptSourceUrl?: string;
|
|
71
77
|
/** Server-set location state to merge into history.pushState */
|
|
72
78
|
serverState?: Record<string, unknown>;
|
|
73
|
-
/** The
|
|
74
|
-
|
|
79
|
+
/** The payload's metadata: its route name and rewrite target, remembered per history entry. */
|
|
80
|
+
metadata?: ShownEntry;
|
|
75
81
|
}
|
|
76
82
|
/**
|
|
77
83
|
* Discriminated update mode for partial updates.
|
|
@@ -120,8 +126,10 @@ export type UpdateMode = {
|
|
|
120
126
|
action?: TransitionWhenActionInput;
|
|
121
127
|
};
|
|
122
128
|
/**
|
|
123
|
-
* Type for the fetchPartialUpdate function
|
|
129
|
+
* Type for the fetchPartialUpdate function. In `action` mode it resolves with
|
|
130
|
+
* the error of a loader that threw while it re-ran (revalidationErrorOf);
|
|
131
|
+
* the loader throws at its read.
|
|
124
132
|
*/
|
|
125
|
-
export type PartialUpdater = (targetUrl: string, segmentIds: string[] | undefined, isRetry: boolean, signal: AbortSignal | undefined, tx: BoundTransaction, mode?: UpdateMode) => Promise<
|
|
133
|
+
export type PartialUpdater = (targetUrl: string, segmentIds: string[] | undefined, isRetry: boolean, signal: AbortSignal | undefined, tx: BoundTransaction, mode?: UpdateMode) => Promise<Error | undefined>;
|
|
126
134
|
export declare function createPartialUpdater(config: PartialUpdateConfig): PartialUpdater;
|
|
127
135
|
export { createPartialUpdater as default };
|
|
@@ -86,6 +86,14 @@ export interface DecodedPrefetch {
|
|
|
86
86
|
* one prefetch serves unlimited adoptions within TTL/state validity.
|
|
87
87
|
*/
|
|
88
88
|
respawn?: () => DecodedPrefetch;
|
|
89
|
+
/**
|
|
90
|
+
* The prefetch's stall timer (executePrefetchFetch). Navigation clears it on
|
|
91
|
+
* the entry it serves: from then on the click owns the stream, which runs to
|
|
92
|
+
* its end (a Flight response that arrived is never aborted mid-stream). A
|
|
93
|
+
* prefetch nobody adopted keeps it, so a stalled one is still aborted.
|
|
94
|
+
* Absent on a respawned entry, which has no timer.
|
|
95
|
+
*/
|
|
96
|
+
stallTimer?: ReturnType<typeof setTimeout>;
|
|
89
97
|
/**
|
|
90
98
|
* Release the buffered reserve bytes. Called when the entry is evicted
|
|
91
99
|
* without being consumed (expiry, FIFO, sweep, cache clear) so the tee
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publishes `window.__rango = { version }` so outside tools can tell a page is
|
|
3
|
+
* a Rango app and which router release serves it. Write-only and informational:
|
|
4
|
+
* nothing in the router reads it (rango-marker.test.ts greps src/ for reads),
|
|
5
|
+
* and only the npm semver is exposed, no build hash, router id or config.
|
|
6
|
+
*/
|
|
7
|
+
export declare function publishRangoMarker(): void;
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
export declare const LOADER_SEGMENT_ID: RegExp;
|
|
6
6
|
/** True for a loader sub-id ("M0L0D1.user"), false for a layout/route/slot id. */
|
|
7
7
|
export declare function isLoaderSegmentId(id: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The parent of a loader sub-id (`${parentId}D${index}.${loaderId}`); any
|
|
10
|
+
* other id unchanged. parentId is a shortCode (never "D"), or
|
|
11
|
+
* `${shortCode}.${slotName}` for an intercept slot's loaders, where the
|
|
12
|
+
* user-chosen name may hold an uppercase "D" ("@Detail"). Strip from the first
|
|
13
|
+
* `D<index>.`: splitting on a bare "D" mis-cut "@Detail" to "@" and silently
|
|
14
|
+
* dropped the loader's data. Correct only because slot names cannot contain
|
|
15
|
+
* "." (assertValidSlotName, route-definition/dsl-helpers.ts).
|
|
16
|
+
*/
|
|
17
|
+
export declare function loaderParentId(id: string): string;
|
|
8
18
|
/**
|
|
9
19
|
* Build the handle-collection segment order from a raw `matched` list.
|
|
10
20
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Handle } from "../../handle.js";
|
|
2
|
+
import type { RouteStateSignal } from "../event-controller.js";
|
|
2
3
|
/**
|
|
3
4
|
* Hook to access collected handle data.
|
|
4
5
|
*
|
|
@@ -19,3 +20,22 @@ import type { Handle } from "../../handle.js";
|
|
|
19
20
|
*/
|
|
20
21
|
export declare function useHandle<T, A>(handle: Handle<T, A>): Rango.FlightSerialize<A>;
|
|
21
22
|
export declare function useHandle<T, A, S>(handle: Handle<T, A>, selector: (data: Rango.FlightSerialize<A>) => S): S;
|
|
23
|
+
/**
|
|
24
|
+
* Route state the controller's handle notifications drive (useHandle,
|
|
25
|
+
* useSegments) commits with the page it belongs to. NavigationProvider
|
|
26
|
+
* flushes the controller inside every payload update, so a value known then
|
|
27
|
+
* is set in the page's lane. A page handed over urgently (signal "release")
|
|
28
|
+
* takes a value that arrives before it commits the same way: set at default
|
|
29
|
+
* priority, it renders in the page's lane, and the page's effects read it.
|
|
30
|
+
* A page in a transition (signal "anchor") does not: until it commits
|
|
31
|
+
* (releaseRouteState() from the provider's layout effect, signal "release"),
|
|
32
|
+
* a new value waits, and is applied in the commit's task, right after the
|
|
33
|
+
* page's own commit. In the page's lane, a value that suspends in a revealed
|
|
34
|
+
* <Suspense> (a crumb's content) would hold the page; in a lane of its own,
|
|
35
|
+
* it commits over the page being left and takes the page's transition types
|
|
36
|
+
* (#1165); and a transition entangled with the page misses its commit when it
|
|
37
|
+
* is set after React rendered the page, before its view transition's
|
|
38
|
+
* mutation, and starts a view transition of its own. A value shallow-equal to
|
|
39
|
+
* the last one sets nothing, so a reader renders only when its value moves.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useCommitAnchoredState<T>(init: () => T): [T, (value: T, signal?: RouteStateSignal) => void];
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
* include() mount prefix. Inside an include("/shop", ...) scope,
|
|
6
6
|
* the returned function resolves local paths relative to /shop.
|
|
7
7
|
*
|
|
8
|
+
* Under a parameterized mount (`include("/:accountId", ...)`) the mount's
|
|
9
|
+
* params are filled from the current route params, as `useReverse` does:
|
|
10
|
+
* `href("/issues")` at `/acme/board` returns `/acme/issues`. A mount param
|
|
11
|
+
* missing from the current match throws `Missing param` when the returned
|
|
12
|
+
* function is called.
|
|
13
|
+
*
|
|
8
14
|
* For absolute paths (outside the current mount), use the bare
|
|
9
15
|
* href() function directly instead.
|
|
10
16
|
*
|
|
@@ -13,7 +13,12 @@ import type { RouterInstance } from "../types.js";
|
|
|
13
13
|
*
|
|
14
14
|
* RELATIVE paths (no leading `/`, no scheme/query/hash) resolve against the
|
|
15
15
|
* current include() mount: `router.push("cart")` inside `include("/shop")`
|
|
16
|
-
* navigates to `/shop/cart`.
|
|
16
|
+
* navigates to `/shop/cart`. Under a parameterized mount
|
|
17
|
+
* (`include("/:accountId", ...)`) the mount's params are filled from the
|
|
18
|
+
* current route params: `router.push("issues")` at `/acme/board` navigates
|
|
19
|
+
* to `/acme/issues`, and a missing mount param rejects the push/replace
|
|
20
|
+
* promise with `Missing param` (a prefetch skips the target).
|
|
21
|
+
* Absolute paths stay APP-absolute — unlike
|
|
17
22
|
* basename, the mount is scoped, and absolute pushes legitimately target
|
|
18
23
|
* outside it, so they are never auto-prefixed.
|
|
19
24
|
*
|
|
@@ -48,9 +48,11 @@ export declare function handleReloadHeader(response: Response, opts: {
|
|
|
48
48
|
* end-of-stream, calling onComplete when done.
|
|
49
49
|
*
|
|
50
50
|
* `onComplete` receives `endedCleanly`: true only on a normal EOF drain, false
|
|
51
|
-
* on a read error
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* on a read error, an abort (the signal cancelled the reader), or a body that
|
|
52
|
+
* ends with PREFETCH_FAILED_ROW (a prefetch whose render reported an error,
|
|
53
|
+
* rsc/prefetch-render-error.ts). Callers that gate a "fully complete" fast
|
|
54
|
+
* path (e.g. prefetch's `entry.complete`) must treat a non-clean end as
|
|
55
|
+
* incomplete — a broken stream is not complete data.
|
|
54
56
|
*
|
|
55
57
|
* If the response has no body, onComplete fires synchronously with `true`
|
|
56
58
|
* (an empty body is a clean, complete stream).
|
|
@@ -63,10 +63,12 @@ export declare function cancelScrollRestorationPolling(): void;
|
|
|
63
63
|
*
|
|
64
64
|
* @param options.retryIfStreaming - If true, poll while streaming until we can scroll to target
|
|
65
65
|
* @param options.isStreaming - Function to check if streaming is in progress
|
|
66
|
+
* @param options.committed - React has committed the restored tree (a layout effect)
|
|
66
67
|
*/
|
|
67
68
|
export declare function restoreScrollPosition(options?: {
|
|
68
69
|
retryIfStreaming?: boolean;
|
|
69
70
|
isStreaming?: () => boolean;
|
|
71
|
+
committed?: boolean;
|
|
70
72
|
}): boolean;
|
|
71
73
|
/**
|
|
72
74
|
* Handle hash link scrolling.
|
|
@@ -86,9 +88,11 @@ export declare function scrollToTop(): void;
|
|
|
86
88
|
export declare function handleNavigationStart(): void;
|
|
87
89
|
/**
|
|
88
90
|
* Handle scroll for a back/forward traversal, at popstate before anything
|
|
89
|
-
* renders: save the page
|
|
90
|
-
* so saveCurrentScrollPosition would use the destination's key)
|
|
91
|
-
*
|
|
91
|
+
* renders: save the page on screen under ITS key (history has already moved,
|
|
92
|
+
* so saveCurrentScrollPosition would use the destination's key). A second
|
|
93
|
+
* traversal before the first one's restore commits (a rapid double Back, a
|
|
94
|
+
* deferred animated restore) saves the page still on screen, never an entry
|
|
95
|
+
* it did not show.
|
|
92
96
|
*/
|
|
93
97
|
export declare function handleTraversalStart(): void;
|
|
94
98
|
/**
|
|
@@ -96,11 +100,13 @@ export declare function handleTraversalStart(): void;
|
|
|
96
100
|
* @param options.restore - If true, restore saved position (for popstate)
|
|
97
101
|
* @param options.scroll - If false, don't scroll at all
|
|
98
102
|
* @param options.isStreaming - Function to check if streaming is in progress (for retry logic)
|
|
103
|
+
* @param options.committed - Called after React committed the new tree
|
|
99
104
|
*/
|
|
100
105
|
export declare function handleNavigationEnd(options: {
|
|
101
106
|
restore?: boolean;
|
|
102
107
|
scroll?: boolean;
|
|
103
108
|
isStreaming?: () => boolean;
|
|
109
|
+
committed?: boolean;
|
|
104
110
|
}): void;
|
|
105
111
|
/**
|
|
106
112
|
* Update the history state key after pushState/replaceState.
|
|
@@ -2,15 +2,17 @@ import type { ResolvedSegment } from "./types.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Determines the merging behavior for segment reconciliation.
|
|
4
4
|
*
|
|
5
|
-
* - 'action': From server-action-bridge's own merge. Always
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* on cached segments not in server diff.
|
|
5
|
+
* - 'action': From server-action-bridge's own merge. Always preserves cached
|
|
6
|
+
* loading (even undefined), never clears cached segment loading.
|
|
7
|
+
* - 'navigation': From partial-update during normal navigation. Preserves
|
|
8
|
+
* cached loading only when defined, clears truthy loading on cached
|
|
9
|
+
* segments not in server diff.
|
|
11
10
|
* - 'stale-revalidation': From partial-update during stale revalidation or
|
|
12
|
-
* action-triggered refetch.
|
|
13
|
-
*
|
|
11
|
+
* action-triggered refetch. Always preserves cached loading (same as
|
|
12
|
+
* action), clears truthy loading on cached segments not in server diff.
|
|
13
|
+
*
|
|
14
|
+
* No actor merges loader data: a loader the server skipped, an intercept's
|
|
15
|
+
* included, is its own cached segment in `matched`.
|
|
14
16
|
*/
|
|
15
17
|
export type ReconcileActor = "navigation" | "action" | "stale-revalidation";
|
|
16
18
|
export interface ReconcileInput {
|
|
@@ -52,11 +54,6 @@ export interface ReconcileResult {
|
|
|
52
54
|
* (not undefined). When cached is undefined, lets server value through
|
|
53
55
|
* because we're building a new tree.
|
|
54
56
|
*
|
|
55
|
-
* Loader merging:
|
|
56
|
-
* - action/stale-revalidation: Merges partial loader data when server returns
|
|
57
|
-
* fewer loaders than cached (revalidation only updated some loaders).
|
|
58
|
-
* - navigation: Does not merge (full navigation fetches complete data).
|
|
59
|
-
*
|
|
60
57
|
* Cached segment handling (segments in matched but not in server response):
|
|
61
58
|
* - action: Returns cached segment as-is (preserve tree structure).
|
|
62
59
|
* - navigation/stale-revalidation: Clears truthy loading to undefined
|
|
@@ -29,6 +29,11 @@ export type HandleData = Record<string, Record<string, unknown[]>>;
|
|
|
29
29
|
*/
|
|
30
30
|
export interface RscMetadata {
|
|
31
31
|
pathname: string;
|
|
32
|
+
/**
|
|
33
|
+
* Path and search of the URL the route rendered, when middleware rewrote
|
|
34
|
+
* the request there. Kept per history entry and sent back as `_rsc_rt`.
|
|
35
|
+
*/
|
|
36
|
+
rewriteTarget?: string;
|
|
32
37
|
segments: ResolvedSegment[];
|
|
33
38
|
/** Router instance ID — the current app's identity. A mismatch with the
|
|
34
39
|
* client's id (sent as _rsc_rid) is detected server-side and answered with
|
|
@@ -223,6 +228,12 @@ export interface TrackedActionState {
|
|
|
223
228
|
error: unknown | null;
|
|
224
229
|
/** Result data from the action (preserved after completion) */
|
|
225
230
|
result: unknown | null;
|
|
231
|
+
/**
|
|
232
|
+
* The error of a loader that threw while it re-ran after this successful
|
|
233
|
+
* action (the first, when several did). The loader also throws at its
|
|
234
|
+
* useLoader read, where the nearest error boundary catches it.
|
|
235
|
+
*/
|
|
236
|
+
revalidationError: unknown | null;
|
|
226
237
|
}
|
|
227
238
|
/**
|
|
228
239
|
* The value returned by {@link useAction} when called without a selector.
|
|
@@ -262,13 +273,23 @@ export interface SegmentState {
|
|
|
262
273
|
currentUrl: string;
|
|
263
274
|
currentSegmentIds: string[];
|
|
264
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* What a committed payload says about the page it shows, remembered per
|
|
278
|
+
* history entry (NavigationStore.rememberDisplayedEntry).
|
|
279
|
+
*
|
|
280
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
281
|
+
*/
|
|
282
|
+
export interface ShownEntry {
|
|
283
|
+
readonly routeName?: string;
|
|
284
|
+
readonly rewriteTarget?: string;
|
|
285
|
+
}
|
|
265
286
|
/**
|
|
266
287
|
* What the router remembers about one history entry for transition({ when })
|
|
267
|
-
* (NavigationStore.rememberDisplayedEntry).
|
|
288
|
+
* and the requests made from it (NavigationStore.rememberDisplayedEntry).
|
|
268
289
|
*
|
|
269
290
|
* @internal This type is an implementation detail and may change without notice.
|
|
270
291
|
*/
|
|
271
|
-
export interface HistoryEntryMemory {
|
|
292
|
+
export interface HistoryEntryMemory extends ShownEntry {
|
|
272
293
|
readonly routeName: string | undefined;
|
|
273
294
|
/** The entry's `history.state` as last recorded. */
|
|
274
295
|
readonly state: unknown;
|
|
@@ -295,6 +316,12 @@ export interface NavigationUpdate {
|
|
|
295
316
|
/** Function to check if streaming is in progress */
|
|
296
317
|
isStreaming?: () => boolean;
|
|
297
318
|
};
|
|
319
|
+
/**
|
|
320
|
+
* Handed to React inside startTransition (commitInTransition, an action's
|
|
321
|
+
* commit, a cached back/forward's): NavigationProvider joins the route
|
|
322
|
+
* state that arrives while React holds it to its commit.
|
|
323
|
+
*/
|
|
324
|
+
inTransition?: true;
|
|
298
325
|
}
|
|
299
326
|
/**
|
|
300
327
|
* Plain object accepted as {@link PlainHistoryState}. The `any` string index
|
|
@@ -504,12 +531,12 @@ export interface NavigationStore {
|
|
|
504
531
|
/**
|
|
505
532
|
* Per-history-entry memory for transition({ when }) sources: record the
|
|
506
533
|
* entry on screen (keyed by its `history.state.key`) with its current
|
|
507
|
-
* `history.state` and, when given, its route name
|
|
508
|
-
* record otherwise; every push/replace
|
|
509
|
-
* never carries to another entry).
|
|
510
|
-
* state merge.
|
|
534
|
+
* `history.state` and, when `shown` is given, its route name and rewrite
|
|
535
|
+
* target (both kept from the last record otherwise; every push/replace
|
|
536
|
+
* creates a new key, so a stale record never carries to another entry).
|
|
537
|
+
* Called after every commit, restore and state merge.
|
|
511
538
|
*/
|
|
512
|
-
rememberDisplayedEntry(
|
|
539
|
+
rememberDisplayedEntry(shown?: ShownEntry): void;
|
|
513
540
|
/**
|
|
514
541
|
* The memory of the entry on screen, or of `entryKey`. At popstate
|
|
515
542
|
* history.state already belongs to the destination, so back/forward reads
|
|
@@ -570,6 +597,8 @@ export interface FetchPartialOptions {
|
|
|
570
597
|
targetUrl: string;
|
|
571
598
|
segmentIds: string[];
|
|
572
599
|
previousUrl: string;
|
|
600
|
+
/** The page's RscMetadata.rewriteTarget, sent as `_rsc_rt`. */
|
|
601
|
+
rewriteTarget?: string;
|
|
573
602
|
signal?: AbortSignal;
|
|
574
603
|
/** If true, this is a stale cache revalidation request - server should force revalidators */
|
|
575
604
|
staleRevalidation?: boolean;
|
|
@@ -638,7 +667,8 @@ export interface ServerActionBridgeConfig {
|
|
|
638
667
|
export interface NavigationBridge {
|
|
639
668
|
navigate(url: string, options?: NavigateOptionsInternal): Promise<void>;
|
|
640
669
|
refresh(): Promise<void>;
|
|
641
|
-
|
|
670
|
+
/** `event`: the popstate event; a traversal the browser animated itself (hasUAVisualTransition) is not animated again. */
|
|
671
|
+
handlePopstate(event?: PopStateEvent): Promise<void>;
|
|
642
672
|
registerLinkInterception(): () => void;
|
|
643
673
|
registerDelegatedPrefetch(): () => void;
|
|
644
674
|
/** Current RSC version (live, reflects the latest updateVersion). */
|
|
@@ -11,6 +11,18 @@ export declare function writePerModuleRouteTypes(root: string, filter?: ScanFilt
|
|
|
11
11
|
* e.g. `export const patterns = urls(...)` -> ["patterns"]
|
|
12
12
|
*/
|
|
13
13
|
export declare function findUrlsVariableNames(code: string): string[];
|
|
14
|
+
export interface PerModuleRouteTypesPlan {
|
|
15
|
+
genPath: string;
|
|
16
|
+
/** A urls()/clientUrls() variable resolved to zero routes; content is empty. */
|
|
17
|
+
isPlaceholder: boolean;
|
|
18
|
+
content: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Pure half of the per-module writer: reads sources, never writes. Returns
|
|
22
|
+
* null when the file has no `urls(`/`clientUrls(` or no named routes and no
|
|
23
|
+
* urls() variable. Throws on failure.
|
|
24
|
+
*/
|
|
25
|
+
export declare function planPerModuleRouteTypesForFile(filePath: string): PerModuleRouteTypesPlan | null;
|
|
14
26
|
/**
|
|
15
27
|
* Generate per-module route types for a single url module file.
|
|
16
28
|
* Follows include() calls recursively to produce the full route tree.
|
|
@@ -21,8 +21,6 @@ export declare class CFCacheStore<TEnv = unknown> implements SegmentCacheStore<T
|
|
|
21
21
|
private readonly namespace?;
|
|
22
22
|
private readonly explicitBaseUrl?;
|
|
23
23
|
private readonly waitUntil?;
|
|
24
|
-
/** The `version` option: used for every versioned family when set. */
|
|
25
|
-
private readonly explicitVersion?;
|
|
26
24
|
private readonly edgeLookupTimeoutMs;
|
|
27
25
|
private readonly edgeReadTimeoutMs;
|
|
28
26
|
private readonly kvReadTimeoutMs;
|
|
@@ -278,22 +278,6 @@ export interface CFCacheStoreOptions<TEnv = unknown> {
|
|
|
278
278
|
* (safe to set large) rather than the invalidation-latency ceiling.
|
|
279
279
|
*/
|
|
280
280
|
tagCacheTtl?: number;
|
|
281
|
-
/**
|
|
282
|
-
* Cache version string override. When set, this exact value prefixes every
|
|
283
|
-
* versioned key the store writes (`v/{version}/...`), for cached data and
|
|
284
|
-
* stored HTML alike; changing it makes every earlier entry unreachable.
|
|
285
|
-
*
|
|
286
|
-
* Leave it unset for the default: the store keys with the versions of the
|
|
287
|
-
* router serving the request. Segment entries and `"use cache"` items use
|
|
288
|
-
* the router's data version; document responses and PPR shells use its
|
|
289
|
-
* document version (see `createRouter({ version })`). Those are computed
|
|
290
|
-
* from the router's built code, so a deploy that does not change the router
|
|
291
|
-
* keeps its entries.
|
|
292
|
-
*
|
|
293
|
-
* Tag invalidation markers are never versioned: an invalidation applies to
|
|
294
|
-
* the entries of every version, including one that comes back in a rollback.
|
|
295
|
-
*/
|
|
296
|
-
version?: string;
|
|
297
281
|
/**
|
|
298
282
|
* Latency budget (ms) for an L1 edge cache (CF Cache API) read. A `match`
|
|
299
283
|
* slower than this is abandoned and treated as a miss, so a degraded colo
|
|
@@ -37,6 +37,8 @@ export interface ShellFrameHead {
|
|
|
37
37
|
ta?: number;
|
|
38
38
|
/** ShellCacheEntry.initialTheme */
|
|
39
39
|
i?: string;
|
|
40
|
+
/** ShellCacheEntry.pathname (a visitor-keyed shell's rendered location). */
|
|
41
|
+
lp?: string;
|
|
40
42
|
/** ShellCacheEntry.docKey; navigation replay needs it after any round trip. */
|
|
41
43
|
dk?: string;
|
|
42
44
|
/** ShellCacheEntry.prunedRecords (diagnostic). */
|
|
@@ -73,8 +73,8 @@ export type OwnedPushDelivery = (loaderId: string) => RecordAuthority;
|
|
|
73
73
|
* says the record supplies that loader's value too ("pin", "copies"), and is
|
|
74
74
|
* a placeholder (pushPlaceholder) everywhere else: without `owned`, every
|
|
75
75
|
* owner. Neither claims its loader, so the loader's own cache() HIT still
|
|
76
|
-
* delivers (the
|
|
77
|
-
* pushes in a placeholder's place).
|
|
76
|
+
* delivers (the pushes holding a promise a restored copy lets through, or its
|
|
77
|
+
* entry's pushes in a placeholder's place).
|
|
78
78
|
*/
|
|
79
79
|
export declare function restoreHandles(handles: Record<string, SegmentHandleData>, handleStore: HandleStore, owners?: HandleOwners, owned?: OwnedPushDelivery): void;
|
|
80
80
|
/**
|
|
@@ -389,7 +389,7 @@ export interface ShellCacheEntry {
|
|
|
389
389
|
/** React.version captured at prerender time; the read-time invalidation gate. */
|
|
390
390
|
reactVersion: string;
|
|
391
391
|
/**
|
|
392
|
-
* Build version captured at prerender time: the RSC handler's
|
|
392
|
+
* Build version captured at prerender time: the RSC handler's version,
|
|
393
393
|
* which is the router's DOCUMENT version (router-versions.ts) — a hash of
|
|
394
394
|
* its server code and the client asset names by default, a stamp bumped on
|
|
395
395
|
* dev RSC-module edits. The second read-time gate: a persistent shared
|
|
@@ -412,6 +412,14 @@ export interface ShellCacheEntry {
|
|
|
412
412
|
* ThemeProvider.
|
|
413
413
|
*/
|
|
414
414
|
initialTheme?: string;
|
|
415
|
+
/**
|
|
416
|
+
* The payload pathname of a shell keyed by the visitor's URL
|
|
417
|
+
* (`rewrite(...).shell("visitor")`, visitorShellKey); absent when the
|
|
418
|
+
* capture rendered its key's own URL. The serve tail replays it as it does
|
|
419
|
+
* `initialTheme`, and the serve gate serves the entry only to a request
|
|
420
|
+
* that renders this location.
|
|
421
|
+
*/
|
|
422
|
+
pathname?: string;
|
|
415
423
|
/**
|
|
416
424
|
* The CAPTURE DATA SNAPSHOT, in stored/serialized form: the doc segment
|
|
417
425
|
* record every HIT replays the handler layer from (`docKey`) and the
|
|
@@ -617,11 +625,13 @@ export interface ShellSnapshotLoaderValue {
|
|
|
617
625
|
*/
|
|
618
626
|
holes: 0 | 1;
|
|
619
627
|
/**
|
|
620
|
-
* 1 when the capture saw a loader push it could not record (
|
|
621
|
-
*
|
|
622
|
-
* body): a HIT then still runs the loader
|
|
623
|
-
* (pin-first) so those pushes reach the page.
|
|
624
|
-
*
|
|
628
|
+
* 1 when the capture saw a loader push it could not record (one whose
|
|
629
|
+
* settled value holds masked nested promises, one a live-lane loader made,
|
|
630
|
+
* or one made outside any loader body): a HIT then still runs the loader
|
|
631
|
+
* body in the background (pin-first) so those pushes reach the page. A
|
|
632
|
+
* pushed promise that settles thenable-free is recorded (#1182).
|
|
633
|
+
* 0: a hole-free record is served from the pin alone and its body does not
|
|
634
|
+
* run on a HIT.
|
|
625
635
|
*
|
|
626
636
|
* Both bits are always written. A record stored before they existed (v0.17)
|
|
627
637
|
* reads each missing bit as 1 (buildShellLoaderSeed): its snapshot lacks
|
|
@@ -102,7 +102,7 @@ export interface VercelCacheStoreOptions<TEnv = unknown> {
|
|
|
102
102
|
*
|
|
103
103
|
* Vercel does not reconcile entries between deployments; the store does it
|
|
104
104
|
* through its keys, which carry the serving router's cache versions (see
|
|
105
|
-
* `
|
|
105
|
+
* `getCacheVersions`). So a deploy that changes a router's code stops reading that
|
|
106
106
|
* router's old entries, and a deploy that does not keeps them. A namespace
|
|
107
107
|
* that changes per deployment (`getCache({ namespace: VERCEL_DEPLOYMENT_ID })`)
|
|
108
108
|
* still works and clears the cache on every deploy, which is what you want
|
|
@@ -128,18 +128,6 @@ export interface VercelCacheStoreOptions<TEnv = unknown> {
|
|
|
128
128
|
* segmentation). Receives the request context and the default key.
|
|
129
129
|
*/
|
|
130
130
|
keyGenerator?: (ctx: RequestContext<TEnv>, defaultKey: string) => string | Promise<string>;
|
|
131
|
-
/**
|
|
132
|
-
* Version override, folded into every versioned key as `v/{version}/...`.
|
|
133
|
-
* When set, this exact value is used for cached data and stored HTML alike;
|
|
134
|
-
* changing it makes everything this store wrote before unreachable.
|
|
135
|
-
*
|
|
136
|
-
* Leave it unset for the default: the store keys with the versions of the
|
|
137
|
-
* router serving the request, as CFCacheStore does. Segments and `"use
|
|
138
|
-
* cache"` items use the router's data version; responses and PPR shells use
|
|
139
|
-
* its document version (see `createRouter({ version })`). Tag markers are
|
|
140
|
-
* never versioned, so an invalidation applies to every version.
|
|
141
|
-
*/
|
|
142
|
-
version?: string;
|
|
143
131
|
/**
|
|
144
132
|
* Max serialized entry size in bytes before a write is skipped. Defaults to
|
|
145
133
|
* VERCEL_MAX_ITEM_BYTES (2 MB - the platform's hard cap).
|
|
@@ -238,8 +226,6 @@ export declare class VercelCacheStore<TEnv = unknown> implements SegmentCacheSto
|
|
|
238
226
|
readonly keyGenerator?: (ctx: RequestContext<TEnv>, defaultKey: string) => string | Promise<string>;
|
|
239
227
|
private readonly cache;
|
|
240
228
|
private readonly waitUntil?;
|
|
241
|
-
/** The `version` option: used for every versioned family when set. */
|
|
242
|
-
private readonly explicitVersion?;
|
|
243
229
|
private readonly maxItemBytes;
|
|
244
230
|
private readonly memo;
|
|
245
231
|
private readonly handleMemos;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type TrieNode } from "../router/route-trie-builder.js";
|
|
2
|
-
import type { ClientUrlBuilder, ClientUrlPatterns } from "./types.js";
|
|
2
|
+
import type { ClientUrlBuilder, ClientUrlHelpers, ClientUrlPatterns } from "./types.js";
|
|
3
3
|
import type { ExtractRoutes } from "../urls/type-extraction.js";
|
|
4
4
|
import type { ClientUrlItems } from "./types.js";
|
|
5
|
+
export declare const loader: ClientUrlHelpers["loader"];
|
|
6
|
+
export declare const revalidate: ClientUrlHelpers["revalidate"];
|
|
7
|
+
export declare const loading: ClientUrlHelpers["loading"];
|
|
8
|
+
export declare const transition: ClientUrlHelpers["transition"];
|
|
5
9
|
export declare function clientUrls<const TItems extends ClientUrlItems>(builder: ClientUrlBuilder<TItems>): ClientUrlPatterns<ExtractRoutes<TItems>>;
|
|
6
10
|
/**
|
|
7
11
|
* The router's trie over a group's routes, each pattern joined to the
|
|
@@ -24,4 +28,4 @@ export declare function buildClientUrlsTrie(routes: readonly {
|
|
|
24
28
|
readonly trailingSlash?: string;
|
|
25
29
|
};
|
|
26
30
|
}[], mount: string, foreign?: readonly string[]): TrieNode;
|
|
27
|
-
export type { ClientTransitionConfig, ClientUrlBuilder, ClientUrlHelpers, ClientUrlInterceptRecord, ClientUrlItem, ClientUrlItemInput, ClientUrlItems, ClientLayoutFn, ClientPathOptions, ClientUrlLoaderRecord, ClientPathFn, ClientUrlPatterns, ClientUrlRouteRecord, ClientUrlUse, } from "./types.js";
|
|
31
|
+
export type { ClientTransitionConfig, ClientUrlBuilder, ClientUrlComponent, ClientUrlHelpers, ClientUrlInterceptRecord, ClientUrlItem, ClientUrlItemInput, ClientUrlItems, ClientLayoutFn, ClientPathOptions, ClientUrlLoaderRecord, ClientPathFn, ClientUrlPatterns, ClientUrlRouteRecord, ClientUrlUse, } from "./types.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ShouldRevalidateFn } from "../types.js";
|
|
2
|
-
export declare function registerClientUrlRevalidators(fns: Readonly<Record<string, ShouldRevalidateFn<any, any
|
|
2
|
+
export declare function registerClientUrlRevalidators(fns: Readonly<Record<string, ShouldRevalidateFn<any, any> | boolean>>): void;
|
|
3
3
|
export declare function getClientUrlRevalidator(key: string): ShouldRevalidateFn<any, any> | undefined;
|
|
4
4
|
export declare function clearClientUrlRevalidators(): void;
|
|
@@ -38,11 +38,11 @@ export interface ClientUrlProjectionRoute {
|
|
|
38
38
|
* loader(), so a prefetch of the route defers them. Absent (= none) in
|
|
39
39
|
* projections serialized before the option existed. */
|
|
40
40
|
readonly deferrableLoaderIndices?: readonly number[];
|
|
41
|
-
/** Per loader (aligned with loaderIds),
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* loader declares one. */
|
|
45
|
-
readonly loaderRevalidate?: readonly (readonly string[])[];
|
|
41
|
+
/** Per loader (aligned with loaderIds), its revalidate() arguments in
|
|
42
|
+
* declaration order: a hoisted predicate's key, whose registration
|
|
43
|
+
* materialization attaches (revalidate-registry.ts), or a boolean
|
|
44
|
+
* literal. Absent when no loader declares one. */
|
|
45
|
+
readonly loaderRevalidate?: readonly (readonly (string | boolean)[])[];
|
|
46
46
|
/** One per leading loader its layout()s declare
|
|
47
47
|
* (ClientUrlRouteRecord.layoutLoaders): the record's ordinal in the
|
|
48
48
|
* definition. Two routes whose loader at an index carries the same ordinal
|
|
@@ -62,6 +62,10 @@ export interface ClientUrlProjectionIntercept {
|
|
|
62
62
|
readonly targetName: string;
|
|
63
63
|
readonly loaderIds: readonly string[];
|
|
64
64
|
readonly hasLoading: boolean;
|
|
65
|
+
/** As on a route (ClientUrlProjectionRoute.deferrableLoaderIndices). */
|
|
66
|
+
readonly deferrableLoaderIndices?: readonly number[];
|
|
67
|
+
/** As on a route (ClientUrlProjectionRoute.loaderRevalidate). */
|
|
68
|
+
readonly loaderRevalidate?: readonly (readonly (string | boolean)[])[];
|
|
65
69
|
}
|
|
66
70
|
export interface ClientUrlProjection {
|
|
67
71
|
readonly version: 1;
|