@rangojs/router 0.26.6 → 0.28.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/dist/bin/rango.js +1 -1
- package/dist/types/__internal.d.ts +7 -1
- package/dist/types/browser/action-coordinator.d.ts +0 -4
- package/dist/types/browser/action-fence.d.ts +11 -3
- package/dist/types/browser/event-controller.d.ts +20 -1
- package/dist/types/browser/history-state.d.ts +7 -9
- package/dist/types/browser/intercept-utils.d.ts +23 -0
- package/dist/types/browser/navigation-store.d.ts +8 -6
- package/dist/types/browser/react/filter-segment-order.d.ts +2 -2
- package/dist/types/browser/rsc-router.d.ts +1 -1
- package/dist/types/browser/segment-reconciler.d.ts +6 -4
- package/dist/types/browser/types.d.ts +2 -1
- package/dist/types/browser/wire-protocol.d.ts +25 -0
- package/dist/types/cache/cache-key-utils.d.ts +11 -5
- package/dist/types/cache/cache-scope.d.ts +34 -22
- package/dist/types/cache/cf/cf-cache-constants.d.ts +2 -2
- package/dist/types/cache/cf/cf-cache-store.d.ts +47 -65
- package/dist/types/cache/cf/cf-kv-utils.d.ts +1 -1
- package/dist/types/cache/handle-snapshot.d.ts +9 -4
- package/dist/types/cache/segment-codec.d.ts +14 -0
- package/dist/types/cache/shell-snapshot.d.ts +1 -1
- package/dist/types/cache/tag-invalidation.d.ts +10 -0
- package/dist/types/cache/taint.d.ts +5 -3
- package/dist/types/cache/types.d.ts +7 -3
- package/dist/types/cache/vercel/vercel-cache-store.d.ts +8 -6
- package/dist/types/prefetch-markers.d.ts +4 -6
- package/dist/types/prerender/store.d.ts +31 -0
- package/dist/types/prerender/warm-request.d.ts +3 -3
- package/dist/types/prerender.d.ts +2 -2
- package/dist/types/route-name.d.ts +5 -0
- package/dist/types/router/error-handling.d.ts +4 -4
- package/dist/types/router/instrument.d.ts +4 -3
- package/dist/types/router/intercept-resolution.d.ts +25 -9
- package/dist/types/router/match-context.d.ts +12 -11
- package/dist/types/router/match-handlers.d.ts +2 -6
- package/dist/types/router/match-middleware/background-revalidation.d.ts +10 -20
- package/dist/types/router/match-middleware/cache-lookup.d.ts +35 -87
- package/dist/types/router/match-middleware/cache-store.d.ts +2 -2
- package/dist/types/router/match-middleware/segment-resolution.d.ts +8 -6
- package/dist/types/router/prerender-match.d.ts +21 -6
- package/dist/types/router/preview-match.d.ts +2 -7
- package/dist/types/router/request-classification.d.ts +5 -0
- package/dist/types/router/revalidation.d.ts +6 -1
- package/dist/types/router/router-context.d.ts +9 -63
- package/dist/types/router/router-interfaces.d.ts +8 -14
- package/dist/types/router/segment-resolution/loader-cache.d.ts +3 -3
- package/dist/types/router/segment-resolution/loader-mask.d.ts +4 -4
- package/dist/types/router/segment-resolution/prefetch-deferral.d.ts +20 -18
- package/dist/types/router/segment-resolution/resolution-pass.d.ts +93 -0
- package/dist/types/router/segment-resolution/revalidation.d.ts +82 -31
- package/dist/types/router/segment-resolution.d.ts +1 -2
- package/dist/types/router/segment-wrappers.d.ts +11 -48
- package/dist/types/router/telemetry.d.ts +2 -0
- package/dist/types/router/types.d.ts +10 -0
- package/dist/types/rsc/full-payload.d.ts +2 -2
- package/dist/types/rsc/handler-context.d.ts +6 -6
- package/dist/types/rsc/json-route-result.d.ts +5 -9
- package/dist/types/rsc/request-stages.d.ts +203 -0
- package/dist/types/rsc/response-cache-serve.d.ts +7 -12
- package/dist/types/rsc/response-route-handler.d.ts +2 -2
- package/dist/types/rsc/routine-plan.d.ts +1 -1
- package/dist/types/rsc/server-action.d.ts +2 -2
- package/dist/types/rsc/shell-capture-constants.d.ts +2 -2
- package/dist/types/rsc/shell-capture.d.ts +132 -15
- package/dist/types/rsc/shell-serve.d.ts +37 -12
- package/dist/types/server/context.d.ts +9 -8
- package/dist/types/server/handle-store.d.ts +16 -0
- package/dist/types/server/render-pass.d.ts +72 -0
- package/dist/types/server/request-context.d.ts +24 -104
- package/dist/types/server/rewrite-trail.d.ts +2 -2
- package/dist/types/testing/dispatch.d.ts +35 -18
- package/dist/types/testing/serve-shell-request.d.ts +7 -0
- package/dist/types/types/cache-types.d.ts +6 -3
- package/dist/types/types/error-types.d.ts +9 -1
- package/dist/types/types/handler-context.d.ts +18 -7
- package/dist/types/types/segments.d.ts +1 -1
- package/dist/types/vite/discovery/build-discovery-phase.d.ts +40 -0
- package/dist/types/vite/discovery/build-env.d.ts +22 -0
- package/dist/types/vite/discovery/bundle-scan-phase.d.ts +12 -0
- package/dist/types/vite/discovery/dev-prerender-cache.d.ts +3 -2
- package/dist/types/vite/discovery/dev-server-phase.d.ts +26 -0
- package/dist/types/vite/discovery/discovery-errors.d.ts +1 -1
- package/dist/types/vite/discovery/state.d.ts +12 -0
- package/dist/types/vite/plugins/version-plugin.d.ts +1 -1
- package/dist/types/vite/plugins/virtual-entries.d.ts +1 -1
- package/dist/types/vite/router-discovery.d.ts +8 -47
- package/dist/types/vite/temp-rsc-server.d.ts +39 -0
- package/dist/types/vite/utils/prerender-utils.d.ts +9 -0
- package/dist/types/wire-params.d.ts +34 -0
- package/dist/vite/index.js +3809 -3710
- package/package.json +1 -1
- package/skills/cache-guide/SKILL.md +8 -5
- package/skills/caching/SKILL.md +37 -18
- package/skills/client-urls/SKILL.md +2 -1
- package/skills/document-cache/SKILL.md +18 -1
- package/skills/handler-use/SKILL.md +1 -1
- package/skills/intercept/SKILL.md +53 -13
- package/skills/layout/SKILL.md +11 -7
- package/skills/loader/SKILL.md +30 -13
- package/skills/middleware/SKILL.md +19 -1
- package/skills/migrate-nextjs/SKILL.md +5 -4
- package/skills/parallel/SKILL.md +5 -4
- package/skills/ppr/SKILL.md +19 -3
- package/skills/prerender/SKILL.md +39 -15
- package/skills/rango/SKILL.md +23 -11
- package/skills/server-actions/SKILL.md +51 -6
- package/skills/testing/predicates.md +1 -1
- package/skills/testing/response-routes.md +6 -4
- package/skills/testing/serve-shell-request.md +7 -7
- package/skills/use-cache/SKILL.md +46 -8
- package/skills/ux-architecture/SKILL.md +3 -2
- package/src/__internal.ts +7 -1
- package/src/browser/action-coordinator.ts +2 -13
- package/src/browser/action-fence.ts +11 -3
- package/src/browser/connection-warmup.ts +3 -1
- package/src/browser/event-controller.ts +42 -3
- package/src/browser/history-state.ts +15 -13
- package/src/browser/intercept-utils.ts +51 -0
- package/src/browser/navigation-bridge.ts +34 -30
- package/src/browser/navigation-client.ts +21 -33
- package/src/browser/navigation-store.ts +25 -27
- package/src/browser/navigation-transaction.ts +7 -11
- package/src/browser/partial-update.ts +8 -0
- package/src/browser/prefetch/cache.ts +2 -1
- package/src/browser/prefetch/fetch.ts +8 -16
- package/src/browser/prefetch/queue.ts +4 -4
- package/src/browser/react/NavigationProvider.tsx +2 -1
- package/src/browser/react/filter-segment-order.ts +2 -2
- package/src/browser/rsc-router.tsx +17 -2
- package/src/browser/segment-reconciler.ts +66 -53
- package/src/browser/server-action-bridge.ts +265 -127
- package/src/browser/types.ts +2 -1
- package/src/browser/wire-protocol.ts +41 -0
- package/src/cache/cache-key-utils.ts +11 -5
- package/src/cache/cache-runtime.ts +110 -50
- package/src/cache/cache-scope.ts +110 -64
- package/src/cache/cf/cf-cache-constants.ts +2 -2
- package/src/cache/cf/cf-cache-store.ts +486 -874
- package/src/cache/cf/cf-kv-utils.ts +1 -1
- package/src/cache/document-cache.ts +42 -15
- package/src/cache/handle-snapshot.ts +19 -7
- package/src/cache/segment-codec.ts +55 -0
- package/src/cache/shell-snapshot.ts +2 -2
- package/src/cache/tag-invalidation.ts +21 -2
- package/src/cache/taint.ts +5 -3
- package/src/cache/types.ts +7 -3
- package/src/cache/vercel/vercel-cache-store.ts +243 -310
- package/src/handles/pushed-by.ts +1 -1
- package/src/prefetch-markers.ts +4 -7
- package/src/prerender/store.ts +76 -0
- package/src/prerender/warm-request.ts +8 -4
- package/src/prerender.ts +2 -2
- package/src/route-name.ts +8 -0
- package/src/router/error-handling.ts +4 -4
- package/src/router/instrument.ts +4 -3
- package/src/router/intercept-resolution.ts +77 -75
- package/src/router/loader-resolution.ts +5 -4
- package/src/router/match-api.ts +4 -5
- package/src/router/match-context.ts +33 -12
- package/src/router/match-handlers.ts +8 -20
- package/src/router/match-middleware/background-revalidation.ts +41 -53
- package/src/router/match-middleware/cache-lookup.ts +680 -720
- package/src/router/match-middleware/cache-store.ts +14 -12
- package/src/router/match-middleware/intercept-resolution.ts +3 -23
- package/src/router/match-middleware/segment-resolution.ts +34 -61
- package/src/router/match-result.ts +1 -20
- package/src/router/middleware.ts +69 -11
- package/src/router/navigation-snapshot.ts +4 -3
- package/src/router/prerender-match.ts +100 -44
- package/src/router/preview-match.ts +6 -41
- package/src/router/request-classification.ts +13 -7
- package/src/router/revalidation.ts +33 -7
- package/src/router/route-snapshot.ts +2 -5
- package/src/router/router-context.ts +14 -117
- package/src/router/router-interfaces.ts +8 -14
- package/src/router/segment-resolution/loader-cache.ts +14 -9
- package/src/router/segment-resolution/loader-mask.ts +5 -5
- package/src/router/segment-resolution/prefetch-deferral.ts +30 -27
- package/src/router/segment-resolution/resolution-pass.ts +137 -0
- package/src/router/segment-resolution/revalidation.ts +897 -776
- package/src/router/segment-resolution.ts +4 -13
- package/src/router/segment-wrappers.ts +51 -269
- package/src/router/telemetry.ts +5 -0
- package/src/router/types.ts +10 -0
- package/src/router.ts +12 -13
- package/src/rsc/full-payload.ts +6 -5
- package/src/rsc/handler-context.ts +8 -14
- package/src/rsc/handler.ts +126 -507
- package/src/rsc/json-route-result.ts +5 -9
- package/src/rsc/loader-fetch.ts +6 -5
- package/src/rsc/progressive-enhancement.ts +5 -0
- package/src/rsc/request-stages.ts +757 -0
- package/src/rsc/response-cache-serve.ts +10 -14
- package/src/rsc/response-route-handler.ts +13 -5
- package/src/rsc/rewrite-passes.ts +2 -1
- package/src/rsc/routine-plan.ts +1 -1
- package/src/rsc/rsc-rendering.ts +172 -349
- package/src/rsc/server-action.ts +87 -113
- package/src/rsc/shell-capture-constants.ts +3 -1
- package/src/rsc/shell-capture.ts +212 -169
- package/src/rsc/shell-serve.ts +121 -18
- package/src/rsc/ssr-setup.ts +5 -4
- package/src/segment-system.tsx +3 -3
- package/src/server/context.ts +22 -25
- package/src/server/handle-store.ts +55 -0
- package/src/server/render-pass.ts +291 -0
- package/src/server/request-context.ts +26 -115
- package/src/server/rewrite-trail.ts +6 -4
- package/src/ssr/index.tsx +1 -1
- package/src/ssr/ssr-root.tsx +1 -0
- package/src/testing/dispatch.ts +223 -710
- package/src/testing/e2e/page-helpers.ts +2 -2
- package/src/testing/serve-shell-request.ts +37 -32
- package/src/types/cache-types.ts +6 -3
- package/src/types/error-types.ts +9 -1
- package/src/types/handler-context.ts +21 -7
- package/src/types/segments.ts +1 -1
- package/src/vite/discovery/build-discovery-phase.ts +204 -0
- package/src/vite/discovery/build-env.ts +148 -0
- package/src/vite/discovery/bundle-scan-phase.ts +128 -0
- package/src/vite/discovery/dev-prerender-cache.ts +8 -3
- package/src/vite/discovery/dev-server-phase.ts +1776 -0
- package/src/vite/discovery/discover-routers.ts +1 -1
- package/src/vite/discovery/discovery-errors.ts +1 -1
- package/src/vite/discovery/prerender-collection.ts +24 -39
- package/src/vite/discovery/state.ts +15 -0
- package/src/vite/plugins/version-plugin.ts +1 -1
- package/src/vite/plugins/virtual-entries.ts +1 -1
- package/src/vite/router-discovery.ts +29 -2428
- package/src/vite/temp-rsc-server.ts +223 -0
- package/src/vite/utils/prerender-utils.ts +47 -0
- package/src/wire-params.ts +35 -0
- package/dist/types/router/segment-resolution/fresh.d.ts +0 -72
- package/src/router/segment-resolution/fresh.ts +0 -945
|
@@ -1,99 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cache Lookup Middleware
|
|
3
3
|
*
|
|
4
|
-
* First middleware in the pipeline.
|
|
4
|
+
* First middleware in the pipeline. Before segment resolution runs, it serves
|
|
5
|
+
* a stored match from the first source that answers:
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* +---------------------+
|
|
13
|
-
* | Is action request? |──yes──> yield* source (pass through)
|
|
14
|
-
* +---------------------+
|
|
15
|
-
* | no
|
|
16
|
-
* v
|
|
17
|
-
* +---------------------+
|
|
18
|
-
* | Cache enabled? |──no───> yield* source (pass through)
|
|
19
|
-
* +---------------------+
|
|
20
|
-
* | yes
|
|
21
|
-
* v
|
|
22
|
-
* +---------------------+
|
|
23
|
-
* | Lookup cache |
|
|
24
|
-
* | (pathname, params) |
|
|
25
|
-
* +---------------------+
|
|
26
|
-
* |
|
|
27
|
-
* +-----+-----+
|
|
28
|
-
* | |
|
|
29
|
-
* miss hit
|
|
30
|
-
* | |
|
|
31
|
-
* v v
|
|
32
|
-
* yield* Set state.cacheHit = true
|
|
33
|
-
* source Set state.shouldRevalidate
|
|
34
|
-
* | |
|
|
35
|
-
* | v
|
|
36
|
-
* | +---------------------------+
|
|
37
|
-
* | | For each cached segment: |
|
|
38
|
-
* | | - Apply revalidation |
|
|
39
|
-
* | | - Set component = null |
|
|
40
|
-
* | | if client has it |
|
|
41
|
-
* | +---------------------------+
|
|
42
|
-
* | |
|
|
43
|
-
* | v
|
|
44
|
-
* | +---------------------------+
|
|
45
|
-
* | | Resolve fresh loaders | <-- Loaders are NEVER cached
|
|
46
|
-
* | | (always fresh data) |
|
|
47
|
-
* | +---------------------------+
|
|
48
|
-
* | |
|
|
49
|
-
* | v
|
|
50
|
-
* | yield cached segments
|
|
51
|
-
* | yield fresh loader segments
|
|
52
|
-
* | |
|
|
53
|
-
* +-----------+
|
|
54
|
-
* |
|
|
55
|
-
* v
|
|
56
|
-
* next middleware
|
|
7
|
+
* 1. Prerender: the writable on-demand overlay, then the bundled build
|
|
8
|
+
* manifest. A live render (an action or a stale partial) reads them too
|
|
9
|
+
* when the route has no live handler (not a Passthrough).
|
|
10
|
+
* 2. The dev Static store (`__PRERENDER_DEV_URL`, isStaticPrerender entries).
|
|
11
|
+
* 3. The route's cache() record (the segment cache). An action or a stale
|
|
12
|
+
* partial renders live (rendersLive) and reads no record.
|
|
57
13
|
*
|
|
14
|
+
* Every source serves through serveStoredSegments: pre-rendering is caching
|
|
15
|
+
* at build time, so a prerender entry is a cache hit through the same segment
|
|
16
|
+
* path. When no source answers, the request passes through to
|
|
17
|
+
* segment-resolution.
|
|
58
18
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
19
|
+
* A STORED HIT
|
|
20
|
+
* ============
|
|
61
21
|
*
|
|
62
|
-
* Cache HIT:
|
|
63
22
|
* - state.cacheHit = true signals downstream middleware to skip
|
|
64
|
-
* -
|
|
65
|
-
* - Loaders are always re-resolved
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* Cache MISS:
|
|
69
|
-
* - Passes through to segment-resolution middleware
|
|
70
|
-
* - No segments yielded from this middleware
|
|
71
|
-
*
|
|
72
|
-
* Loaders:
|
|
73
|
-
* - NEVER cached in the segment cache
|
|
74
|
-
* - Always resolved fresh on every request
|
|
75
|
-
* - Ensures data freshness even with cached UI components
|
|
76
|
-
* - Segment cache staleness does NOT propagate to loader revalidation;
|
|
23
|
+
* - A segment the client already holds and keeps has its component nullified
|
|
24
|
+
* - Loaders are always re-resolved fresh: never cached or pre-rendered.
|
|
25
|
+
* Segment cache staleness does NOT propagate to loader revalidation;
|
|
77
26
|
* loaders use their own revalidation rules (actionId, user-defined)
|
|
27
|
+
* - A cache() record sets state.shouldRevalidate, which triggers background
|
|
28
|
+
* SWR when the record was stale
|
|
78
29
|
*
|
|
30
|
+
* REVALIDATION RULES (cache() record)
|
|
31
|
+
* ===================================
|
|
79
32
|
*
|
|
80
|
-
*
|
|
81
|
-
* ==================
|
|
82
|
-
*
|
|
83
|
-
* Each cached segment is evaluated against its revalidation rules:
|
|
33
|
+
* Each record segment the client holds is evaluated against its rules:
|
|
84
34
|
*
|
|
85
|
-
* 1. No rules defined ->
|
|
35
|
+
* 1. No rules defined -> re-render the route's own segments when the search
|
|
36
|
+
* or the route params changed; otherwise skip (nullify component)
|
|
86
37
|
* 2. Rules return false -> skip re-render (nullify component)
|
|
87
38
|
* 3. Rules return true -> re-render (keep component)
|
|
88
39
|
*
|
|
89
|
-
* Revalidation context includes
|
|
90
|
-
*
|
|
91
|
-
* - Request object
|
|
92
|
-
* - Action context (if POST)
|
|
40
|
+
* Revalidation context includes the previous/next URL and params, the request
|
|
41
|
+
* and the action context (if POST).
|
|
93
42
|
*/
|
|
94
43
|
import type { ResolvedSegment } from "../../types.js";
|
|
95
44
|
import { type EntryData } from "../../server/context.js";
|
|
96
|
-
import type
|
|
45
|
+
import { type MatchContext, type MatchPipelineState } from "../match-context.js";
|
|
97
46
|
import type { PrerenderStore } from "../../prerender/store.js";
|
|
98
47
|
import type { PrerenderTargetObject, ResolvedPrerender } from "../../prerender/on-demand.js";
|
|
99
48
|
import { type RequestContext } from "../../server/request-context.js";
|
|
@@ -112,7 +61,7 @@ export declare function setPrerenderStoreForTests(store: PrerenderStore | null |
|
|
|
112
61
|
* misses the store and renders live, and replay — including its heal
|
|
113
62
|
* capture — must stay available for it (withCacheStore records the doc
|
|
114
63
|
* record on that path; state.cacheSource is not "prerender"). The store
|
|
115
|
-
* memoizes per routeKey/paramHash, so this probe and
|
|
64
|
+
* memoizes per routeKey/paramHash, so this probe and readPrerenderSource's
|
|
116
65
|
* subsequent get() share one underlying load.
|
|
117
66
|
*/
|
|
118
67
|
export declare function prerenderEntryExists(routeKey: string | undefined, params: Record<string, string>, pathname: string, entries: EntryData[]): Promise<boolean>;
|
|
@@ -127,14 +76,13 @@ export type GeneratorMiddleware<T> = (source: AsyncGenerator<T>) => AsyncGenerat
|
|
|
127
76
|
/**
|
|
128
77
|
* Creates cache lookup middleware
|
|
129
78
|
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* -
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
79
|
+
* The middleware is serveStoredSegments. It serves a stored match when one
|
|
80
|
+
* answers, in this order: the prerender overlay and build store (Prerender
|
|
81
|
+
* and on-demand routes), the dev Static store, then the route's cache()
|
|
82
|
+
* record. It yields the stored segments and the loaders resolved fresh and
|
|
83
|
+
* sets state.cacheHit (and state.shouldRevalidate for a cache() record, for
|
|
84
|
+
* background SWR).
|
|
136
85
|
*
|
|
137
|
-
* If
|
|
138
|
-
* - Passes through to next middleware
|
|
86
|
+
* If nothing answers, passes through to the next middleware.
|
|
139
87
|
*/
|
|
140
88
|
export declare function withCacheLookup<TEnv>(ctx: MatchContext<TEnv>, state: MatchPipelineState): GeneratorMiddleware<ResolvedSegment>;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* +---------------------+
|
|
20
20
|
* | Should skip cache? |
|
|
21
21
|
* | - !cacheScope |──yes──> return
|
|
22
|
-
* | -
|
|
22
|
+
* | - rendersLive |
|
|
23
23
|
* | - cacheHit |
|
|
24
24
|
* | - method !== GET |
|
|
25
25
|
* +---------------------+
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
* - Non-GET request (only GET requests are cacheable)
|
|
102
102
|
*/
|
|
103
103
|
import type { ResolvedSegment } from "../../types.js";
|
|
104
|
-
import type
|
|
104
|
+
import { type MatchContext, type MatchPipelineState } from "../match-context.js";
|
|
105
105
|
import type { GeneratorMiddleware } from "./cache-lookup.js";
|
|
106
106
|
/**
|
|
107
107
|
* Creates cache store middleware
|
|
@@ -29,15 +29,16 @@
|
|
|
29
29
|
* yes no
|
|
30
30
|
* | |
|
|
31
31
|
* v v
|
|
32
|
-
*
|
|
33
|
-
* Segments Segments
|
|
34
|
-
* | |
|
|
32
|
+
* FRESH pass partial pass
|
|
35
33
|
* | | (compares with prev state)
|
|
36
34
|
* | | (handles null components)
|
|
37
35
|
* | |
|
|
38
36
|
* +-----------+
|
|
39
37
|
* |
|
|
40
38
|
* v
|
|
39
|
+
* resolveAllSegments()
|
|
40
|
+
* |
|
|
41
|
+
* v
|
|
41
42
|
* +---------------------------+
|
|
42
43
|
* | Update state: |
|
|
43
44
|
* | - state.segments |
|
|
@@ -54,13 +55,14 @@
|
|
|
54
55
|
* RESOLUTION MODES
|
|
55
56
|
* ================
|
|
56
57
|
*
|
|
58
|
+
* Both use resolveAllSegments().
|
|
59
|
+
*
|
|
57
60
|
* Full Match (document request):
|
|
58
|
-
* -
|
|
59
|
-
*
|
|
61
|
+
* - A FRESH pass (freshPassInput): no revalidation logic (nothing to
|
|
62
|
+
* compare against)
|
|
60
63
|
* - Simple resolution of all route entries
|
|
61
64
|
*
|
|
62
65
|
* Partial Match (navigation):
|
|
63
|
-
* - Uses resolveAllSegmentsWithRevalidation()
|
|
64
66
|
* - Compares current vs previous params/URL
|
|
65
67
|
* - Sets component = null for segments client already has
|
|
66
68
|
* - Respects custom revalidation rules
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import type { RouterContext } from "./router-context.js";
|
|
2
|
-
import type { ResolveSegmentOptions } from "./segment-resolution.js";
|
|
3
|
-
import type { EntryData } from "../server/context";
|
|
4
2
|
import type { PartialPrerenderProps } from "../urls/pattern-types.js";
|
|
5
|
-
import type { HandlerContext, ResolvedSegment } from "../types";
|
|
6
3
|
import type { SerializedSegmentData } from "../cache/types.js";
|
|
7
4
|
import type { RouteMatchResult } from "./pattern-matching.js";
|
|
8
5
|
import type { RouterVersions } from "../router-versions.js";
|
|
9
6
|
import type { OnDemandRouteConfig } from "../prerender/on-demand.js";
|
|
7
|
+
/**
|
|
8
|
+
* An intercept a navigation can select over the route that the build does
|
|
9
|
+
* not bake: its HIT misses (selectInterceptVariant) and it renders live,
|
|
10
|
+
* with the request instead of BuildContext.
|
|
11
|
+
* - `same-slot`: another intercept on its layout fills the same slot.
|
|
12
|
+
* - `handler-response` / `layout-response`: its handler or layout returned a
|
|
13
|
+
* Response for this URL.
|
|
14
|
+
* - `local-name`: it targets the route's localRouteName, which the build
|
|
15
|
+
* never bakes.
|
|
16
|
+
*/
|
|
17
|
+
export interface LiveIntercept {
|
|
18
|
+
slot: string;
|
|
19
|
+
reason: "same-slot" | "handler-response" | "layout-response" | "local-name";
|
|
20
|
+
}
|
|
10
21
|
export interface PrerenderMatchDeps<TEnv = any> {
|
|
11
22
|
/** Owning router id; scopes bake-time root-scope/search-schema lookups the
|
|
12
23
|
* same way reqCtx._routerId does at runtime (issue #762). */
|
|
@@ -21,7 +32,7 @@ export interface PrerenderMatchDeps<TEnv = any> {
|
|
|
21
32
|
findMatch: (pathname: string) => RouteMatchResult<TEnv> | null | Promise<RouteMatchResult<TEnv> | null>;
|
|
22
33
|
buildRouterContext: () => RouterContext<TEnv>;
|
|
23
34
|
mergedRouteMap: Record<string, string>;
|
|
24
|
-
resolveAllSegments:
|
|
35
|
+
resolveAllSegments: RouterContext<TEnv>["resolveAllSegments"];
|
|
25
36
|
}
|
|
26
37
|
/**
|
|
27
38
|
* Build-time pre-render match. Resolves segments with a BuildContext
|
|
@@ -46,9 +57,13 @@ onDemand?: boolean): Promise<{
|
|
|
46
57
|
routeName: string;
|
|
47
58
|
params: Record<string, string>;
|
|
48
59
|
interceptSegments?: SerializedSegmentData[];
|
|
49
|
-
/** RSC-encoded
|
|
50
|
-
*
|
|
60
|
+
/** RSC-encoded handle map for the intercept artifact: the intercept's
|
|
61
|
+
* pushes and those of the main segments the intercepted route does not
|
|
62
|
+
* own; the sinks store it as-is. */
|
|
51
63
|
interceptHandles?: string;
|
|
64
|
+
/** The intercepts the intercept variant does not hold, for the build's
|
|
65
|
+
* warning (warnLiveIntercepts). */
|
|
66
|
+
liveIntercepts?: LiveIntercept[];
|
|
52
67
|
passthrough?: true;
|
|
53
68
|
/** On-demand only: the render hit `notFound()` and nothing else failed. */
|
|
54
69
|
notFound?: true;
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import type { EntryData } from "../server/context";
|
|
2
1
|
import type { RouteMatchResult } from "./pattern-matching.js";
|
|
3
2
|
import type { MiddlewareFn } from "./middleware.js";
|
|
4
3
|
export interface PreviewMatchDeps<TEnv = any> {
|
|
5
4
|
findMatch: (pathname: string) => RouteMatchResult<TEnv> | null | Promise<RouteMatchResult<TEnv> | null>;
|
|
6
5
|
}
|
|
7
6
|
/**
|
|
8
|
-
* Preview match - returns route middleware without
|
|
9
|
-
*
|
|
7
|
+
* Preview match - returns the route, its params and route middleware without
|
|
8
|
+
* segment resolution (a content-negotiated variant's, when one wins).
|
|
10
9
|
*/
|
|
11
10
|
export declare function previewMatch<TEnv = any>(request: Request, _context: TEnv, deps: PreviewMatchDeps<TEnv>): Promise<{
|
|
12
11
|
routeMiddleware?: Array<{
|
|
13
12
|
handler: MiddlewareFn;
|
|
14
13
|
params: Record<string, string>;
|
|
15
14
|
}>;
|
|
16
|
-
responseType?: string;
|
|
17
|
-
handler?: Function;
|
|
18
15
|
params?: Record<string, string>;
|
|
19
|
-
negotiated?: boolean;
|
|
20
|
-
manifestEntry?: EntryData;
|
|
21
16
|
routeKey?: string;
|
|
22
17
|
} | null>;
|
|
@@ -61,6 +61,11 @@ interface FullRenderPlan<TEnv = any> {
|
|
|
61
61
|
mode: "full-render";
|
|
62
62
|
route: RouteSnapshot<TEnv>;
|
|
63
63
|
negotiated: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* No route matched: the render path renders the 404 (match() re-throws
|
|
66
|
+
* RouteNotFoundError). Set by rsc/request-stages.ts classify.
|
|
67
|
+
*/
|
|
68
|
+
unmatched?: true;
|
|
64
69
|
}
|
|
65
70
|
interface PartialRenderPlan<TEnv = any> {
|
|
66
71
|
mode: "partial-render";
|
|
@@ -40,8 +40,13 @@ export interface EvaluateRevalidationOptions<TEnv> {
|
|
|
40
40
|
context: HandlerContext<any, TEnv>;
|
|
41
41
|
/** Action context if triggered by action */
|
|
42
42
|
actionContext?: ActionContext;
|
|
43
|
-
/**
|
|
43
|
+
/** The browser's `_rsc_stale` signal: seeds the action defaults. */
|
|
44
44
|
stale?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The route-cache entry is past its TTL (SWR). Predicates see it as `stale`;
|
|
47
|
+
* it never seeds the action defaults.
|
|
48
|
+
*/
|
|
49
|
+
cacheStale?: boolean;
|
|
45
50
|
/** Trace source hint for the revalidation trace */
|
|
46
51
|
traceSource?: RevalidationTraceEntry["source"];
|
|
47
52
|
/**
|
|
@@ -3,25 +3,9 @@ import type { EntryData, InterceptEntry, InterceptSelectorContext, MetricsStore
|
|
|
3
3
|
import type { HandlerContext, ResolvedSegment, ShouldRevalidateFn } from "../types.js";
|
|
4
4
|
import type { RouteMatchResult } from "./pattern-matching.js";
|
|
5
5
|
import type { TelemetrySink } from "./telemetry.js";
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
export interface RevalidationContext {
|
|
11
|
-
clientSegmentIds: ReadonlySet<string>;
|
|
12
|
-
prevParams: Record<string, string>;
|
|
13
|
-
request: Request;
|
|
14
|
-
prevUrl: URL;
|
|
15
|
-
nextUrl: URL;
|
|
16
|
-
routeKey: string;
|
|
17
|
-
actionContext?: {
|
|
18
|
-
actionId?: string;
|
|
19
|
-
actionUrl?: URL;
|
|
20
|
-
actionResult?: any;
|
|
21
|
-
formData?: FormData;
|
|
22
|
-
};
|
|
23
|
-
stale?: boolean;
|
|
24
|
-
}
|
|
6
|
+
import type { EvaluateRevalidationOptions } from "./revalidation.js";
|
|
7
|
+
import type { ResolutionPassInput } from "./segment-resolution/resolution-pass.js";
|
|
8
|
+
import type { RevalidatingWalkOptions } from "./segment-resolution/revalidation.js";
|
|
25
9
|
/**
|
|
26
10
|
* Result from intercept lookup
|
|
27
11
|
*/
|
|
@@ -50,59 +34,21 @@ export interface RouterContext<TEnv = any> {
|
|
|
50
34
|
getMetricsStore: () => MetricsStore | undefined;
|
|
51
35
|
createCacheScope: (cacheConfig: any, parent: CacheScope | null) => CacheScope | null;
|
|
52
36
|
findInterceptForRoute: (routeKey: string, parentEntry: EntryData | null, selectorContext: InterceptSelectorContext, isAction: boolean) => InterceptResult | null;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
chain?: readonly EntryData[]) => Promise<{
|
|
37
|
+
/** The segment walker; a full match passes freshPassInput (FRESH). */
|
|
38
|
+
resolveAllSegments: (pass: ResolutionPassInput<TEnv>, entries: EntryData[], walk: RevalidatingWalkOptions) => Promise<{
|
|
56
39
|
segments: ResolvedSegment[];
|
|
57
40
|
matchedIds: string[];
|
|
58
41
|
}>;
|
|
59
|
-
|
|
60
|
-
__type: "id";
|
|
61
|
-
id: string;
|
|
62
|
-
}>;
|
|
63
|
-
resolveInterceptEntry: (intercept: InterceptEntry, entry: EntryData, params: Record<string, string>, handlerContext: HandlerContext<any, TEnv>, belongsToRoute: boolean, revalidationContext?: RevalidationContext, options?: {
|
|
42
|
+
resolveInterceptEntry: (pass: ResolutionPassInput<TEnv>, intercept: InterceptEntry, entry: EntryData, belongsToRoute: boolean, options?: {
|
|
64
43
|
background?: boolean;
|
|
65
44
|
}) => Promise<ResolvedSegment[]>;
|
|
66
|
-
|
|
67
|
-
__type: "id";
|
|
68
|
-
id: string;
|
|
69
|
-
}>) => Promise<{
|
|
70
|
-
items: T[];
|
|
71
|
-
matchedIds: string[];
|
|
72
|
-
}>;
|
|
73
|
-
evaluateRevalidation: (params: {
|
|
74
|
-
segment: ResolvedSegment;
|
|
75
|
-
prevParams: Record<string, string>;
|
|
76
|
-
getPrevSegment: (() => Promise<ResolvedSegment | undefined>) | null;
|
|
77
|
-
request: Request;
|
|
78
|
-
prevUrl: URL;
|
|
79
|
-
nextUrl: URL;
|
|
80
|
-
revalidations: Array<{
|
|
81
|
-
name: string;
|
|
82
|
-
fn: any;
|
|
83
|
-
}>;
|
|
84
|
-
routeKey: string;
|
|
85
|
-
context: HandlerContext<any, TEnv>;
|
|
86
|
-
actionContext?: any;
|
|
87
|
-
stale?: boolean;
|
|
88
|
-
traceSource?: "segment-resolution" | "cache-hit" | "loader" | "parallel" | "orphan-layout" | "route-handler" | "layout-handler" | "intercept-loader";
|
|
89
|
-
}) => Promise<boolean>;
|
|
45
|
+
evaluateRevalidation: (params: EvaluateRevalidationOptions<TEnv>) => Promise<boolean>;
|
|
90
46
|
getRequestContext: () => {
|
|
91
47
|
waitUntil: (fn: () => Promise<void>) => void;
|
|
92
48
|
_handleStore?: any;
|
|
93
49
|
} | undefined;
|
|
94
|
-
resolveAllSegments: (entries: EntryData[], routeKey: string, params: Record<string, string>, handlerContext: HandlerContext<any, TEnv>, loaderPromises: Map<string, Promise<any>>, options?: ResolveSegmentOptions) => Promise<ResolvedSegment[]>;
|
|
95
|
-
resolveAllSegmentsGenerator?: (entries: EntryData[], routeKey: string, params: Record<string, string>, handlerContext: HandlerContext<any, TEnv>, loaderPromises: Map<string, Promise<any>>) => AsyncGenerator<ResolvedSegment | {
|
|
96
|
-
__type: "id";
|
|
97
|
-
id: string;
|
|
98
|
-
}>;
|
|
99
|
-
collectSegmentsFromGenerator?: <T>(gen: AsyncGenerator<T | {
|
|
100
|
-
__type: "id";
|
|
101
|
-
id: string;
|
|
102
|
-
}>) => Promise<T[]>;
|
|
103
50
|
createHandleStore: () => any;
|
|
104
|
-
resolveLoadersOnly?: (entries: EntryData[],
|
|
105
|
-
resolveLoadersOnlyWithRevalidation?: (entries: EntryData[], handlerContext: HandlerContext<any, TEnv>, clientSegmentSet: Set<string>, prevParams: Record<string, string>, request: Request, prevUrl: URL, nextUrl: URL, routeKey: string, actionContext?: any, stale?: boolean) => Promise<{
|
|
51
|
+
resolveLoadersOnly?: (pass: ResolutionPassInput<TEnv>, entries: EntryData[], walk?: Pick<RevalidatingWalkOptions, "interceptResult">) => Promise<{
|
|
106
52
|
segments: ResolvedSegment[];
|
|
107
53
|
matchedIds: string[];
|
|
108
54
|
}>;
|
|
@@ -111,7 +57,7 @@ export interface RouterContext<TEnv = any> {
|
|
|
111
57
|
}>;
|
|
112
58
|
telemetry?: TelemetrySink;
|
|
113
59
|
requestId?: string;
|
|
114
|
-
resolveInterceptLoadersOnly?: (intercept: InterceptEntry, entry: EntryData,
|
|
60
|
+
resolveInterceptLoadersOnly?: (pass: ResolutionPassInput<TEnv>, intercept: InterceptEntry, entry: EntryData, belongsToRoute: boolean) => Promise<ResolvedSegment[]>;
|
|
115
61
|
}
|
|
116
62
|
/**
|
|
117
63
|
* Get router dependencies from AsyncLocalStorage context
|
|
@@ -4,7 +4,6 @@ import type { ReverseFunction } from "../reverse.js";
|
|
|
4
4
|
import type { UrlPatterns } from "../urls.js";
|
|
5
5
|
import type { ClientUrlPatterns } from "../client-urls/types.js";
|
|
6
6
|
import type { UrlBuilder, EnvCompatible } from "../urls/pattern-types.js";
|
|
7
|
-
import type { EntryData } from "../server/context";
|
|
8
7
|
import type { ErrorInfo, MatchResult } from "../types";
|
|
9
8
|
import type { NonceProvider } from "../rsc/types.js";
|
|
10
9
|
import type { ShellCaptureDebug } from "../rsc/shell-capture.js";
|
|
@@ -12,6 +11,7 @@ import type { ExecutionContext } from "../server/request-context.js";
|
|
|
12
11
|
import type { SerializedSegmentData } from "../cache/types.js";
|
|
13
12
|
import type { MiddlewareEntry, MiddlewareFn } from "./middleware.js";
|
|
14
13
|
import type { RouteMatchResult } from "./pattern-matching.js";
|
|
14
|
+
import type { LiveIntercept } from "./prerender-match.js";
|
|
15
15
|
import type { ExtractParams } from "../types/route-config.js";
|
|
16
16
|
import { RSC_ROUTER_BRAND } from "./router-registry.js";
|
|
17
17
|
import type { RangoOptions, RootLayoutProps } from "./router-options.js";
|
|
@@ -19,6 +19,7 @@ import type { DefaultVars } from "../types/global-namespace.js";
|
|
|
19
19
|
import type { ResolvedTimeouts, OnTimeoutCallback } from "./timeout.js";
|
|
20
20
|
import type { ResolvedTracing } from "./tracing.js";
|
|
21
21
|
import type { TelemetrySink } from "./telemetry.js";
|
|
22
|
+
import type { ActionContext } from "./types.js";
|
|
22
23
|
/**
|
|
23
24
|
* Options passed to router.fetch(), router.match(), and other request entrypoints.
|
|
24
25
|
* All entrypoints use this same shape for consistency.
|
|
@@ -425,8 +426,10 @@ export interface RangoInternal<TEnv = any, TRoutes extends Record<string, unknow
|
|
|
425
426
|
routeName: string;
|
|
426
427
|
params: Record<string, string>;
|
|
427
428
|
interceptSegments?: SerializedSegmentData[];
|
|
428
|
-
/** RSC-encoded
|
|
429
|
+
/** RSC-encoded handle map for the intercept artifact (see matchForPrerender). */
|
|
429
430
|
interceptHandles?: string;
|
|
431
|
+
/** The intercepts the intercept artifact does not hold (see matchForPrerender). */
|
|
432
|
+
liveIntercepts?: LiveIntercept[];
|
|
430
433
|
passthrough?: true;
|
|
431
434
|
} | null>;
|
|
432
435
|
/**
|
|
@@ -438,27 +441,18 @@ export interface RangoInternal<TEnv = any, TRoutes extends Record<string, unknow
|
|
|
438
441
|
handles: string;
|
|
439
442
|
} | null>;
|
|
440
443
|
/**
|
|
441
|
-
* Preview match - returns route
|
|
442
|
-
*
|
|
444
|
+
* Preview match - returns the route, its params and route middleware
|
|
445
|
+
* without segment resolution.
|
|
443
446
|
*/
|
|
444
447
|
previewMatch(request: Request, input?: RouterRequestInput<TEnv>): Promise<{
|
|
445
448
|
routeMiddleware?: Array<{
|
|
446
449
|
handler: import("./middleware.js").MiddlewareFn;
|
|
447
450
|
params: Record<string, string>;
|
|
448
451
|
}>;
|
|
449
|
-
responseType?: string;
|
|
450
|
-
handler?: Function;
|
|
451
452
|
params?: Record<string, string>;
|
|
452
|
-
negotiated?: boolean;
|
|
453
|
-
manifestEntry?: EntryData;
|
|
454
453
|
routeKey?: string;
|
|
455
454
|
} | null>;
|
|
456
|
-
matchPartial(request: Request, input?: RouterRequestInput<TEnv>, actionContext?:
|
|
457
|
-
actionId?: string;
|
|
458
|
-
actionUrl?: URL;
|
|
459
|
-
actionResult?: any;
|
|
460
|
-
formData?: FormData;
|
|
461
|
-
}): Promise<MatchResult | null>;
|
|
455
|
+
matchPartial(request: Request, input?: RouterRequestInput<TEnv>, actionContext?: ActionContext): Promise<MatchResult | null>;
|
|
462
456
|
/**
|
|
463
457
|
* Match an error to the nearest error boundary and return error segments
|
|
464
458
|
*
|
|
@@ -94,8 +94,8 @@ export declare function loaderPins(entries: readonly EntryData[], reqCtx: Reques
|
|
|
94
94
|
* PPR loader lane rule — the canonical source statement; other sites point
|
|
95
95
|
* here (consumer docs: skills/ppr/SKILL.md "The loader lane rule";
|
|
96
96
|
* docs/design/loader-container-bake.md). This is the single funnel every
|
|
97
|
-
* loader segment path routes through (
|
|
98
|
-
*
|
|
97
|
+
* loader segment path routes through (resolveOwnerLoaders: the full match's
|
|
98
|
+
* FRESH pass, cache-hit and revalidation resolveLoadersOnly, and
|
|
99
99
|
* intercept loaders in intercept-resolution.ts, which pass no bake key and
|
|
100
100
|
* never run under a shell capture), so the lane is decided here, per LOADER,
|
|
101
101
|
* never by the entry's loading():
|
|
@@ -109,7 +109,7 @@ export declare function loaderPins(entries: readonly EntryData[], reqCtx: Reques
|
|
|
109
109
|
* plain objects, arrays and JSX props are masked (mask-nested.ts) and stay
|
|
110
110
|
* live holes at the consumer's own Suspense — per-request material must be
|
|
111
111
|
* promise-shaped (the #692 cross-session scar). The masked container
|
|
112
|
-
* registers on `
|
|
112
|
+
* registers on `_shellCaptureState.loaderRecords`: it holds the capture gate
|
|
113
113
|
* (bounded by `ppr.captureTimeout`) and pins into the snapshot's loader
|
|
114
114
|
* family, and on a HIT the recorded container is overlaid onto the fresh
|
|
115
115
|
* run (below) so the payload matches the frozen prelude outside the holes.
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
* consuming Suspense subtree postpones as a hole, and the serve pass runs them
|
|
8
8
|
* fresh into it.
|
|
9
9
|
*
|
|
10
|
-
* Capture mode is signalled by `requestCtx.
|
|
10
|
+
* Capture mode is signalled by `requestCtx._shellCaptureState.run`, set ONLY on
|
|
11
11
|
* the derived request context of the background capture task (shell-capture.ts);
|
|
12
|
-
* the foreground render never
|
|
12
|
+
* the foreground render never has it. This module is the single home for the
|
|
13
13
|
* mask so every loader execution site gates the same way (loader-cache.ts
|
|
14
|
-
* `resolveLoaderData`,
|
|
14
|
+
* `resolveLoaderData`, revalidation.ts `resolveOwnerLoaders`).
|
|
15
15
|
*/
|
|
16
16
|
import { type RequestContext } from "../../server/request-context.js";
|
|
17
17
|
/**
|
|
18
18
|
* True when the current render is the active PPR shell capture and route loaders
|
|
19
|
-
* must be masked rather than executed. Reads `
|
|
19
|
+
* must be masked rather than executed. Reads `_shellCaptureState` off the ALS
|
|
20
20
|
* request context (the capture task re-establishes its derived context via
|
|
21
21
|
* runWithRequestContext), so it is accurate at the loader resolution sites, which
|
|
22
22
|
* run synchronously inside the pipeline's context frame.
|
|
@@ -93,14 +93,6 @@ export interface PrefetchDeferral {
|
|
|
93
93
|
* a navigation to the page lists.
|
|
94
94
|
*/
|
|
95
95
|
below?: true;
|
|
96
|
-
/**
|
|
97
|
-
* The loaders this prefetch deferred, by `$$id` (registerDeferredLoader).
|
|
98
|
-
* A deferred loader runs only if something reads it: a handler's or another
|
|
99
|
-
* loader's ctx.use() starts it through its registration
|
|
100
|
-
* (startDeferredLoader), and revalidation.ts deliverStartedLoaders delivers
|
|
101
|
-
* what was started by the end of resolution.
|
|
102
|
-
*/
|
|
103
|
-
deferredLoaders?: Map<string, DeferredLoader>;
|
|
104
96
|
}
|
|
105
97
|
/**
|
|
106
98
|
* How a request may use the route's cache() record, decided once per match
|
|
@@ -126,7 +118,14 @@ export interface RecordUse {
|
|
|
126
118
|
*/
|
|
127
119
|
readonly refresh: boolean;
|
|
128
120
|
}
|
|
129
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* A DSL loader registered and not started (InternalHandlerContext
|
|
123
|
+
* ._deferredLoaders): a prefetch deferred it, or a pass that skips loaders
|
|
124
|
+
* (`skipLoaders`) did not run it. It runs only if something reads it: a
|
|
125
|
+
* handler's or another loader's ctx.use() starts it through its registration
|
|
126
|
+
* (startDeferredLoader), and revalidation.ts deliverStartedLoaders delivers
|
|
127
|
+
* what a prefetch started by the end of resolution.
|
|
128
|
+
*/
|
|
130
129
|
export interface DeferredLoader {
|
|
131
130
|
/**
|
|
132
131
|
* The segment that registers it. Its run files its handle pushes there,
|
|
@@ -212,17 +211,20 @@ export declare function interceptFillSkips(match: {
|
|
|
212
211
|
/** PrefetchDeferral.record, or all of it open when the match has no plan. */
|
|
213
212
|
export declare function recordUse(ctx: HandlerContext<any, any> | undefined): RecordUse;
|
|
214
213
|
/**
|
|
215
|
-
* Register a loader
|
|
216
|
-
* it and how to start it there (
|
|
214
|
+
* Register a loader resolution does not start, with the segment that
|
|
215
|
+
* registers it and how to start it there (DeferredLoader). The first
|
|
217
216
|
* registration wins, as the loader's one run per request does.
|
|
218
217
|
*/
|
|
219
218
|
export declare function registerDeferredLoader(ctx: HandlerContext<any, any>, loaderId: string, owner: string, start: () => Promise<unknown>): void;
|
|
220
219
|
/**
|
|
221
|
-
* A reader asks for a loader
|
|
222
|
-
* start it through its registration and return the run, or
|
|
223
|
-
* the read takes the ordinary path. Without this the reader
|
|
224
|
-
* bare,
|
|
225
|
-
*
|
|
220
|
+
* A reader asks for a registered loader (registerDeferredLoader) and nothing
|
|
221
|
+
* has started it: start it through its registration and return the run, or
|
|
222
|
+
* undefined when the read takes the ordinary path. Without this the reader
|
|
223
|
+
* ran the loader bare, as a handler-invoked loader: in a prefetch without its
|
|
224
|
+
* cache() binding, so the segment delivered afterwards read the binding (two
|
|
225
|
+
* values on one page, an extra run on a HIT); in a route record's background
|
|
226
|
+
* re-render outside its DSL scope, so the record kept its handle pushes and
|
|
227
|
+
* every HIT showed them twice.
|
|
226
228
|
*
|
|
227
229
|
* A started cache() binding of the loader (`_loaderCacheOverrides`) is never
|
|
228
230
|
* redirected here: the read is that binding's own MISS execution, and
|
|
@@ -231,8 +233,8 @@ export declare function registerDeferredLoader(ctx: HandlerContext<any, any>, lo
|
|
|
231
233
|
export declare function startDeferredLoader(ctx: HandlerContext<any, any>, loaderId: string): Promise<unknown> | undefined;
|
|
232
234
|
/**
|
|
233
235
|
* The segment a run of `loaderId` files its handle pushes under: the one
|
|
234
|
-
* that registers it when
|
|
235
|
-
* resolved.
|
|
236
|
+
* that registers it when it is registered (registerDeferredLoader), else the
|
|
237
|
+
* segment being resolved.
|
|
236
238
|
*/
|
|
237
239
|
export declare function loaderOwner(ctx: HandlerContext<any, any>, loaderId: string): string | undefined;
|
|
238
240
|
/**
|