@rangojs/router 0.24.4 → 0.25.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.
Files changed (267) hide show
  1. package/README.md +1 -0
  2. package/dist/bin/rango.js +363 -39
  3. package/dist/testing/vitest.js +37 -4
  4. package/dist/types/browser/event-controller.d.ts +24 -5
  5. package/dist/types/browser/intercept-utils.d.ts +5 -2
  6. package/dist/types/browser/merge-segment-loaders.d.ts +0 -23
  7. package/dist/types/browser/navigation-transaction.d.ts +5 -5
  8. package/dist/types/browser/partial-update.d.ts +21 -13
  9. package/dist/types/browser/prefetch/cache.d.ts +8 -0
  10. package/dist/types/browser/rango-marker.d.ts +7 -0
  11. package/dist/types/browser/react/filter-segment-order.d.ts +10 -0
  12. package/dist/types/browser/react/use-handle.d.ts +20 -0
  13. package/dist/types/browser/react/use-href.d.ts +6 -0
  14. package/dist/types/browser/react/use-router.d.ts +6 -1
  15. package/dist/types/browser/response-adapter.d.ts +5 -3
  16. package/dist/types/browser/scroll-restoration.d.ts +9 -3
  17. package/dist/types/browser/segment-reconciler.d.ts +10 -13
  18. package/dist/types/browser/types.d.ts +38 -8
  19. package/dist/types/build/route-types/per-module-writer.d.ts +12 -0
  20. package/dist/types/cache/cf/cf-shell-frame.d.ts +2 -0
  21. package/dist/types/cache/types.d.ts +8 -0
  22. package/dist/types/client-urls/client-urls.d.ts +6 -2
  23. package/dist/types/client-urls/revalidate-registry.d.ts +1 -1
  24. package/dist/types/client-urls/server-projection.d.ts +9 -5
  25. package/dist/types/client-urls/types.d.ts +29 -16
  26. package/dist/types/client.d.ts +2 -2
  27. package/dist/types/client.rsc.d.ts +2 -2
  28. package/dist/types/decode-loader-results.d.ts +28 -7
  29. package/dist/types/href-client.d.ts +3 -1
  30. package/dist/types/index.rsc.d.ts +1 -1
  31. package/dist/types/loader-redirect.d.ts +2 -3
  32. package/dist/types/outlet-context.d.ts +7 -6
  33. package/dist/types/prefetch-markers.d.ts +14 -5
  34. package/dist/types/route-content-wrapper.d.ts +17 -14
  35. package/dist/types/route-definition/helpers-types.d.ts +7 -2
  36. package/dist/types/route-definition/resolve-handler-use.d.ts +6 -1
  37. package/dist/types/route-definition/rewrite.d.ts +48 -5
  38. package/dist/types/route-types.d.ts +2 -2
  39. package/dist/types/router/handler-context.d.ts +14 -2
  40. package/dist/types/router/intercept-resolution.d.ts +19 -46
  41. package/dist/types/router/lazy-includes.d.ts +7 -0
  42. package/dist/types/router/match-middleware/intercept-resolution.d.ts +2 -2
  43. package/dist/types/router/middleware.d.ts +0 -16
  44. package/dist/types/router/navigation-snapshot.d.ts +2 -0
  45. package/dist/types/router/prefetch-cache-ttl.d.ts +8 -11
  46. package/dist/types/router/revalidation.d.ts +8 -1
  47. package/dist/types/router/router-context.d.ts +4 -16
  48. package/dist/types/router/router-interfaces.d.ts +0 -6
  49. package/dist/types/router/router-options.d.ts +4 -7
  50. package/dist/types/router/segment-resolution/prefetch-deferral.d.ts +31 -8
  51. package/dist/types/router/segment-resolution/revalidation.d.ts +38 -4
  52. package/dist/types/router/segment-resolution.d.ts +1 -1
  53. package/dist/types/router/segment-wrappers.d.ts +3 -5
  54. package/dist/types/router/substitute-pattern-params.d.ts +3 -2
  55. package/dist/types/router/tracing.d.ts +2 -2
  56. package/dist/types/rsc/full-payload.d.ts +14 -2
  57. package/dist/types/rsc/helpers.d.ts +8 -0
  58. package/dist/types/rsc/manifest-init.d.ts +20 -0
  59. package/dist/types/rsc/prefetch-render-error.d.ts +22 -0
  60. package/dist/types/rsc/progressive-enhancement.d.ts +20 -0
  61. package/dist/types/rsc/rewrite-passes.d.ts +12 -2
  62. package/dist/types/rsc/server-action.d.ts +6 -0
  63. package/dist/types/rsc/shell-capture-constants.d.ts +10 -1
  64. package/dist/types/rsc/shell-capture.d.ts +7 -0
  65. package/dist/types/rsc/types.d.ts +5 -0
  66. package/dist/types/segment-system.d.ts +15 -0
  67. package/dist/types/server/context.d.ts +64 -4
  68. package/dist/types/server/request-context.d.ts +41 -4
  69. package/dist/types/server/request-headers.d.ts +12 -0
  70. package/dist/types/server/rewrite-trail.d.ts +8 -1
  71. package/dist/types/testing/e2e/index.d.ts +1 -1
  72. package/dist/types/testing/flight.entry.d.ts +1 -1
  73. package/dist/types/testing/index.d.ts +1 -1
  74. package/dist/types/testing/internal/client-urls-projection.d.ts +4 -3
  75. package/dist/types/testing/render-route.d.ts +21 -11
  76. package/dist/types/testing/run-loader.d.ts +7 -0
  77. package/dist/types/testing/run-middleware.d.ts +7 -0
  78. package/dist/types/testing/run-revalidate.d.ts +5 -4
  79. package/dist/types/testing/serve-shell-request.d.ts +41 -4
  80. package/dist/types/testing/shell-status.d.ts +17 -0
  81. package/dist/types/testing/vitest-stubs/version.d.ts +1 -0
  82. package/dist/types/testing/vitest.d.ts +10 -1
  83. package/dist/types/thenable-status.d.ts +0 -6
  84. package/dist/types/types/handler-context.d.ts +12 -1
  85. package/dist/types/types/loader-types.d.ts +4 -3
  86. package/dist/types/types/route-entry.d.ts +2 -1
  87. package/dist/types/urls/path-helper-types.d.ts +4 -2
  88. package/dist/types/vite/discovery/client-urls-projection.d.ts +55 -5
  89. package/dist/types/vite/discovery/state.d.ts +20 -0
  90. package/dist/types/vite/plugins/client-urls-revalidate-hoist.d.ts +28 -16
  91. package/dist/types/vite/plugins/hoist/source.d.ts +8 -7
  92. package/dist/types/vite/plugins/virtual-entries.d.ts +6 -0
  93. package/dist/types/vite/utils/prerender-utils.d.ts +7 -0
  94. package/dist/vite/index.js +6816 -6547
  95. package/package.json +1 -1
  96. package/skills/app-structure/SKILL.md +255 -0
  97. package/skills/app-structure/content-site.md +333 -0
  98. package/skills/app-structure/e-commerce.md +435 -0
  99. package/skills/app-structure/large-app.md +885 -0
  100. package/skills/app-structure/multi-app.md +280 -0
  101. package/skills/breadcrumbs/SKILL.md +6 -1
  102. package/skills/caching/SKILL.md +3 -1
  103. package/skills/catalog.json +12 -0
  104. package/skills/client-urls/SKILL.md +185 -32
  105. package/skills/composability/SKILL.md +10 -8
  106. package/skills/handler-use/SKILL.md +48 -9
  107. package/skills/hooks/handle-and-actions.md +104 -0
  108. package/skills/hooks/navigation.md +24 -10
  109. package/skills/hooks/urls.md +1 -1
  110. package/skills/i18n/SKILL.md +2 -1
  111. package/skills/intercept/SKILL.md +60 -29
  112. package/skills/layout/SKILL.md +6 -3
  113. package/skills/links/SKILL.md +151 -17
  114. package/skills/loader/SKILL.md +32 -10
  115. package/skills/middleware/SKILL.md +111 -15
  116. package/skills/observability/SKILL.md +11 -0
  117. package/skills/parallel/SKILL.md +5 -5
  118. package/skills/ppr/SKILL.md +43 -8
  119. package/skills/prerender/SKILL.md +1 -2
  120. package/skills/rango/SKILL.md +3 -0
  121. package/skills/response-routes/SKILL.md +4 -1
  122. package/skills/scripts/SKILL.md +12 -1
  123. package/skills/server-actions/SKILL.md +60 -20
  124. package/skills/testing/SKILL.md +1 -0
  125. package/skills/testing/client-components.md +13 -10
  126. package/skills/testing/loader.md +25 -24
  127. package/skills/testing/middleware.md +11 -11
  128. package/skills/testing/response-routes.md +4 -1
  129. package/skills/testing/serve-shell-request.md +85 -21
  130. package/skills/ux-architecture/SKILL.md +980 -0
  131. package/skills/view-transitions/SKILL.md +43 -10
  132. package/src/__augment-tests__/augmented.check.ts +28 -0
  133. package/src/browser/event-controller.ts +44 -18
  134. package/src/browser/intercept-utils.ts +3 -2
  135. package/src/browser/merge-segment-loaders.ts +0 -85
  136. package/src/browser/navigation-bridge.ts +112 -84
  137. package/src/browser/navigation-client.ts +20 -15
  138. package/src/browser/navigation-store.ts +4 -2
  139. package/src/browser/navigation-transaction.ts +9 -8
  140. package/src/browser/partial-update.ts +90 -32
  141. package/src/browser/prefetch/cache.ts +8 -0
  142. package/src/browser/prefetch/fetch.ts +13 -3
  143. package/src/browser/rango-marker.ts +13 -0
  144. package/src/browser/react/NavigationProvider.tsx +25 -7
  145. package/src/browser/react/filter-segment-order.ts +13 -0
  146. package/src/browser/react/use-action.ts +9 -15
  147. package/src/browser/react/use-handle.ts +63 -71
  148. package/src/browser/react/use-href.tsx +24 -5
  149. package/src/browser/react/use-link-status.ts +1 -1
  150. package/src/browser/react/use-navigation.ts +30 -40
  151. package/src/browser/react/use-router.ts +37 -6
  152. package/src/browser/react/use-segments.ts +8 -12
  153. package/src/browser/response-adapter.ts +11 -5
  154. package/src/browser/rsc-router.tsx +3 -1
  155. package/src/browser/scroll-restoration.ts +34 -20
  156. package/src/browser/segment-reconciler.ts +11 -29
  157. package/src/browser/server-action-bridge.ts +52 -16
  158. package/src/browser/types.ts +40 -8
  159. package/src/build/generate-manifest.ts +12 -1
  160. package/src/build/route-types/codegen.ts +6 -2
  161. package/src/build/route-types/per-module-writer.ts +94 -61
  162. package/src/cache/cache-runtime.ts +9 -0
  163. package/src/cache/cache-scope.ts +2 -1
  164. package/src/cache/cf/cf-cache-store.ts +2 -0
  165. package/src/cache/cf/cf-shell-frame.ts +3 -0
  166. package/src/cache/types.ts +8 -0
  167. package/src/cache/vercel/vercel-cache-store.ts +6 -1
  168. package/src/client-urls/client-urls.ts +202 -153
  169. package/src/client-urls/revalidate-registry.ts +12 -3
  170. package/src/client-urls/server-projection.ts +137 -66
  171. package/src/client-urls/types.ts +30 -15
  172. package/src/client.rsc.tsx +11 -1
  173. package/src/client.tsx +9 -1
  174. package/src/decode-loader-results.ts +64 -31
  175. package/src/href-client.ts +3 -1
  176. package/src/index.rsc.ts +1 -0
  177. package/src/index.ts +12 -4
  178. package/src/loader-redirect.tsx +2 -3
  179. package/src/outlet-context.ts +7 -6
  180. package/src/prefetch-markers.ts +15 -5
  181. package/src/reverse.ts +3 -3
  182. package/src/route-content-wrapper.tsx +19 -17
  183. package/src/route-definition/dsl-helpers.ts +27 -7
  184. package/src/route-definition/helpers-types.ts +7 -2
  185. package/src/route-definition/resolve-handler-use.ts +23 -10
  186. package/src/route-definition/rewrite.ts +86 -19
  187. package/src/route-types.ts +1 -2
  188. package/src/router/find-match.ts +37 -1
  189. package/src/router/handler-context.ts +85 -40
  190. package/src/router/intercept-resolution.ts +161 -307
  191. package/src/router/lazy-includes.ts +43 -27
  192. package/src/router/loader-resolution.ts +21 -1
  193. package/src/router/manifest.ts +6 -8
  194. package/src/router/match-api.ts +11 -1
  195. package/src/router/match-middleware/background-revalidation.ts +2 -4
  196. package/src/router/match-middleware/cache-lookup.ts +16 -20
  197. package/src/router/match-middleware/intercept-resolution.ts +41 -60
  198. package/src/router/match-result.ts +31 -2
  199. package/src/router/middleware.ts +6 -147
  200. package/src/router/navigation-snapshot.ts +38 -2
  201. package/src/router/prefetch-cache-ttl.ts +10 -18
  202. package/src/router/prerender-match.ts +2 -1
  203. package/src/router/revalidation.ts +24 -3
  204. package/src/router/router-context.ts +5 -18
  205. package/src/router/router-interfaces.ts +0 -7
  206. package/src/router/router-options.ts +4 -7
  207. package/src/router/segment-resolution/fresh.ts +6 -2
  208. package/src/router/segment-resolution/helpers.ts +7 -1
  209. package/src/router/segment-resolution/prefetch-deferral.ts +62 -12
  210. package/src/router/segment-resolution/revalidation.ts +75 -35
  211. package/src/router/segment-resolution.ts +0 -1
  212. package/src/router/segment-wrappers.ts +8 -13
  213. package/src/router/substitute-pattern-params.ts +3 -2
  214. package/src/router/tracing.ts +2 -2
  215. package/src/router.ts +2 -9
  216. package/src/rsc/full-payload.ts +26 -4
  217. package/src/rsc/handler.ts +83 -41
  218. package/src/rsc/helpers.ts +13 -0
  219. package/src/rsc/manifest-init.ts +56 -3
  220. package/src/rsc/prefetch-render-error.ts +38 -0
  221. package/src/rsc/progressive-enhancement.ts +161 -211
  222. package/src/rsc/rewrite-passes.ts +56 -9
  223. package/src/rsc/rsc-rendering.ts +79 -23
  224. package/src/rsc/server-action.ts +25 -2
  225. package/src/rsc/shell-capture-constants.ts +22 -0
  226. package/src/rsc/shell-capture.ts +11 -0
  227. package/src/rsc/types.ts +5 -0
  228. package/src/segment-system.tsx +125 -119
  229. package/src/server/context.ts +96 -5
  230. package/src/server/handle-store.ts +3 -2
  231. package/src/server/request-context.ts +42 -3
  232. package/src/server/request-headers.ts +32 -0
  233. package/src/server/rewrite-trail.ts +55 -9
  234. package/src/ssr/ssr-root.tsx +6 -10
  235. package/src/testing/dispatch.ts +4 -5
  236. package/src/testing/e2e/index.ts +1 -0
  237. package/src/testing/flight.entry.ts +1 -0
  238. package/src/testing/index.ts +1 -0
  239. package/src/testing/internal/client-urls-projection.ts +31 -11
  240. package/src/testing/render-route.tsx +83 -40
  241. package/src/testing/run-loader.ts +26 -2
  242. package/src/testing/run-middleware.ts +10 -0
  243. package/src/testing/run-revalidate.ts +13 -6
  244. package/src/testing/serve-shell-request.ts +77 -4
  245. package/src/testing/shell-status.ts +40 -0
  246. package/src/testing/vitest-stubs/version.ts +1 -0
  247. package/src/testing/vitest.ts +74 -7
  248. package/src/thenable-status.ts +0 -11
  249. package/src/types/handler-context.ts +12 -1
  250. package/src/types/loader-types.ts +4 -3
  251. package/src/types/route-entry.ts +2 -1
  252. package/src/urls/include-helper.ts +38 -11
  253. package/src/urls/path-helper-types.ts +4 -2
  254. package/src/vite/discovery/client-urls-projection.ts +205 -16
  255. package/src/vite/discovery/discover-routers.ts +2 -2
  256. package/src/vite/discovery/prerender-collection.ts +2 -6
  257. package/src/vite/discovery/state.ts +26 -0
  258. package/src/vite/plugins/client-urls-revalidate-hoist.ts +190 -77
  259. package/src/vite/plugins/expose-internal-ids.ts +46 -40
  260. package/src/vite/plugins/hoist/source.ts +8 -7
  261. package/src/vite/plugins/transition-when-hoist.ts +1 -0
  262. package/src/vite/plugins/version-plugin.ts +7 -0
  263. package/src/vite/plugins/version.d.ts +7 -0
  264. package/src/vite/plugins/virtual-entries.ts +20 -0
  265. package/src/vite/rango.ts +4 -1
  266. package/src/vite/router-discovery.ts +39 -7
  267. package/src/vite/utils/prerender-utils.ts +17 -0
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import { type ErrorInfo, type ResolvedSegment } from "./types.js";
2
3
  /**
3
4
  * Markers for loader-thrown AUTHORITY SIGNALS (notFound()/redirect()) on the
4
5
  * reconstructed read-site error. Siblings of LOADER_ERROR_FALLBACK, routed
@@ -11,16 +12,36 @@ import type { ReactNode } from "react";
11
12
  * Only decodeLoaderEntry (the read-site path — client components, so the
12
13
  * throw lands in the router-owned boundary; during document SSR, Fizz emits
13
14
  * the Suspense fallback and replays the throw at hydration) throws these.
14
- * decodeLoaderResults runs during the SERVER tree build on forceAwait/action
15
- * lanes, where a throw would collapse the whole payload — it routes signals
16
- * through the errorFallback slot instead (same visual: the slot replaces the
17
- * children under OutletProvider). The document lane's `{ ssr: false }`
18
- * results take the same non-throwing route (segment-system
19
- * buildLoaderStreams): they are settled before the tree is built, and the
20
- * read-site throw would land in the Fizz shell with no boundary to absorb it.
15
+ * decodeLoaderResults runs during the tree build on settled results, where a
16
+ * throw would collapse the whole payload — it routes signals through the
17
+ * errorFallback slot instead (same visual: the slot replaces the children
18
+ * under OutletProvider). The document lane's `{ ssr: false }` results take
19
+ * this route (segment-system buildLoaderStreams): they are settled before the
20
+ * tree is built, and the read-site throw would land in the Fizz shell with no
21
+ * boundary to absorb it.
21
22
  */
22
23
  export declare const LOADER_NOT_FOUND_FALLBACK: unique symbol;
23
24
  export declare const LOADER_REDIRECT: unique symbol;
25
+ /**
26
+ * A failed loader entry's error, rebuilt with the ErrorInfo identity
27
+ * (name/stack/code/cause) instead of a stripped generic Error.
28
+ */
29
+ export declare function loaderResultError(result: {
30
+ error: ErrorInfo;
31
+ }): Error;
32
+ /** A loader that threw: not ok, and not a notFound()/redirect() signal. */
33
+ export declare function isLoaderError(result: unknown): result is {
34
+ error: ErrorInfo;
35
+ fallback: ReactNode | null;
36
+ };
37
+ /**
38
+ * The error of the first loader that threw while it re-ran in an action's
39
+ * revalidation, for useAction()'s `revalidationError`. The loader itself
40
+ * throws at its read (segment-system buildLoaderStreams), and the action
41
+ * resolves. A stale revalidation rejects with it instead and commits nothing
42
+ * (partial-update.ts). A notFound()/redirect() is a signal, not an error.
43
+ */
44
+ export declare function revalidationErrorOf(segments?: ResolvedSegment[]): Promise<Error | undefined>;
24
45
  export declare function decodeLoaderResults(resolvedData: any[], loaderIds: string[]): {
25
46
  loaderData: Record<string, any>;
26
47
  errorFallback: ReactNode;
@@ -169,7 +169,9 @@ declare global {
169
169
  * Type-safe href function for client-side use
170
170
  *
171
171
  * Without mount: identity function, validates absolute paths at compile time.
172
- * With mount: prepends mount path, for use with useMount() inside include() scopes.
172
+ * With mount: prepends the mount as given. `useMount()` under a parameterized
173
+ * include returns its pattern (`/:accountId`), which this does not fill: use
174
+ * `useHref()` there, which substitutes the mount params.
173
175
  *
174
176
  * @param path - A valid path matching one of the registered route patterns
175
177
  * @param mount - Optional mount prefix from useMount() for include-scoped paths
@@ -14,7 +14,7 @@ export type { RangoOptions, SSRStreamMode, SSROptions, ResolveStreamingContext,
14
14
  export type { OriginCheckConfig, OriginCheckContext, OriginCheckPhase, } from "./rsc/origin-guard.js";
15
15
  export type { ShellCaptureDebug, ShellCaptureDebugEvent, } from "./rsc/shell-capture.js";
16
16
  export { createLoader, redirect, type RouteHelpers, type RouteHandlers, layout, cache, middleware, revalidate, loader, loading, parallel, intercept, errorBoundary, notFoundBoundary, transition, } from "./route-definition.js";
17
- export { rewrite, type Rewrite, type RewriteFunction, } from "./route-definition/rewrite.js";
17
+ export { rewrite, type Rewrite, type RewriteFunction, type RewriteShell, } from "./route-definition/rewrite.js";
18
18
  export { RewriteLoopError } from "./errors.js";
19
19
  export type { RouteUseItem, LayoutUseItem, AllUseItems, UseItems, HandlerUseItem, } from "./route-types.js";
20
20
  export { createHandle, isHandle, type Handle } from "./handle.js";
@@ -9,9 +9,8 @@ import type { ReactNode } from "react";
9
9
  *
10
10
  * Own module (not route-content-wrapper.tsx) because BOTH consumers need it
11
11
  * without a cycle: the StreamedLoaderErrorBoundary redirect branch (read-site
12
- * throw path) and decodeLoaderResults (aggregate forceAwait/action path, which
13
- * runs during the server tree build and cannot throw — it plants this element
14
- * in the errorFallback slot instead).
12
+ * throw path) and decodeLoaderResults (the tree build's settled results, which
13
+ * cannot throw — it plants this element in the errorFallback slot instead).
15
14
  */
16
15
  export declare function LoaderRedirect({ to, state, }: {
17
16
  to: string;
@@ -12,18 +12,19 @@ export interface OutletContextValue {
12
12
  * $$id. A value may be a pending Promise (loader still streaming) or an
13
13
  * already-settled result entry. useLoader `use()`es a pending value at the
14
14
  * read site — implicit suspension to the nearest consumer Suspense boundary —
15
- * and decodes via decodeLoaderEntry. Populated instead of `loaderData` on
16
- * streaming lanes (plain navs, document SSR); forceAwait/action lanes keep
17
- * the resolved `loaderData` record.
15
+ * and decodes via decodeLoaderEntry. Populated instead of `loaderData` for
16
+ * a route's or layout's loaders on every lane; forceAwait/action lanes hand
17
+ * settled entries. `loaderData` is a slot's decoded aggregate.
18
18
  */
19
19
  loaderStreams?: Record<string, unknown>;
20
20
  /**
21
21
  * Loader $$ids on this segment that the render awaited before first flush
22
22
  * (loader(Def, { ssr: false })). Dev-diagnostic input only: useLoader uses
23
23
  * it to warn when a read still suspends during SSR on a render that awaited
24
- * flagged loaders (ssr-suspension-warning.ts). Present only on streaming
25
- * lanes with flagged loaders (document and shell-capture renders); absent
26
- * on forceAwait/action lanes.
24
+ * flagged loaders (ssr-suspension-warning.ts). Present only where a
25
+ * segment carries flagged loaders (document and shell-capture renders, and
26
+ * a client lane that re-renders their segments); a settled read never
27
+ * suspends, so it never warns.
27
28
  */
28
29
  awaitedLoaderIds?: readonly string[];
29
30
  parent?: OutletContextValue | null;
@@ -1,11 +1,20 @@
1
1
  /**
2
- * The wire markers of `prefetch: false` (docs/design/prefetch-false.md):
3
- * shared by the browser that sends them and the server that reads them
4
- * (router/segment-resolution/prefetch-deferral.ts requestKind). Dependency
5
- * free, like segment-fragments.ts: the browser must not import the server
6
- * module that reads them.
2
+ * The wire markers of prefetches and of `prefetch: false`
3
+ * (docs/design/prefetch-false.md): shared by the browser and the server
4
+ * (router/segment-resolution/prefetch-deferral.ts requestKind,
5
+ * rsc/prefetch-render-error.ts). Dependency free, like segment-fragments.ts:
6
+ * the browser must not import the server modules that use them.
7
7
  */
8
8
  /** Request header of a `<Link>` prefetch (browser/prefetch/fetch.ts). */
9
9
  export declare const PREFETCH_HEADER = "X-Rango-Prefetch";
10
10
  /** Query param of a fill request (browser/navigation-client.ts). */
11
11
  export declare const FILL_PARAM = "_rsc_fill";
12
+ /**
13
+ * The last row of a prefetch whose render reported an error
14
+ * (rsc/prefetch-render-error.ts): a Flight hint with a code React does not
15
+ * dispatch, so the decoder skips it (pinned by
16
+ * src/__tests__/flight-unknown-hint.test.ts), and browser/response-adapter.ts
17
+ * reads the stream as not ended cleanly. Five bytes: teeWithCompletion keeps
18
+ * the last five.
19
+ */
20
+ export declare const PREFETCH_FAILED_ROW = ":H_0\n";
@@ -23,34 +23,37 @@ import type { ResolvedSegment } from "./types.js";
23
23
  */
24
24
  export declare class StreamedLoaderErrorBoundary extends Component<{
25
25
  children: ReactNode;
26
- resetKey?: string;
26
+ reset: unknown[];
27
27
  }, {
28
28
  error: unknown;
29
- resetKey?: string;
29
+ reset: unknown[];
30
30
  }> {
31
31
  state: {
32
32
  error: unknown;
33
- resetKey?: string;
33
+ reset: unknown[];
34
34
  };
35
35
  static getDerivedStateFromError(error: unknown): {
36
36
  error: unknown;
37
37
  };
38
38
  /**
39
39
  * A caught marker (redirect, notFound, error fallback) belongs to ONE route
40
- * + params. Group-keyed segments (ResolvedSegment.clientGroup) keep this
41
- * instance alive across in-group navigations, so the error must clear when
42
- * the route or params change — otherwise a redirect caught for /legacy
43
- * keeps rendering LoaderRedirect for /state. `resetKey` is the segment's
44
- * id-params identity, the cadence the per-route remount used to provide.
40
+ * + params and ONE delivery of the segment's loader data. `reset` is the
41
+ * segment's id-params identity followed by each of its loaders' data; the
42
+ * error clears when any of them changes. Group-keyed segments
43
+ * (ResolvedSegment.clientGroup) keep this instance alive across in-group
44
+ * navigations, so a redirect caught for /legacy must not keep rendering
45
+ * LoaderRedirect for /state. A rerun hands a loader new data, a held loader
46
+ * keeps its own: a later action or navigation that re-ran the loader clears
47
+ * an error fallback left by an earlier failure, and a tree that re-ran
48
+ * nothing here keeps it.
45
49
  */
46
- static getDerivedStateFromProps(props: {
47
- resetKey?: string;
50
+ static getDerivedStateFromProps({ reset }: {
51
+ reset: unknown[];
48
52
  }, state: {
49
- error: unknown;
50
- resetKey?: string;
53
+ reset: unknown[];
51
54
  }): {
52
- error: unknown;
53
- resetKey?: string;
55
+ error: null;
56
+ reset: unknown[];
54
57
  } | null;
55
58
  render(): ReactNode;
56
59
  }
@@ -105,7 +105,7 @@ export type RouteHelpers<T extends RouteDefinition, TEnv> = {
105
105
  * // With loaders and revalidation (revalidate() goes on the loader;
106
106
  * // an intercept-level revalidate() throws)
107
107
  * intercept("@modal", "card", () => <CardModal />, () => [
108
- * loader(CardModalLoader, () => [revalidate(() => false)]),
108
+ * loader(CardModalLoader, () => [revalidate(false)]),
109
109
  * ])
110
110
  *
111
111
  * // Conditional activation via the config object's `when` selector
@@ -186,6 +186,9 @@ export type RouteHelpers<T extends RouteDefinition, TEnv> = {
186
186
  * revalidate(({ defaultShouldRevalidate }) =>
187
187
  * ({ defaultShouldRevalidate: true })
188
188
  * )
189
+ *
190
+ * // Shorthand for a constant hard decision: revalidate(() => false)
191
+ * revalidate(false)
189
192
  * ```
190
193
  * Not valid directly inside intercept() use() (throws at definition time):
191
194
  * intercepts only revalidate their loaders, so attach it there with
@@ -196,8 +199,10 @@ export type RouteHelpers<T extends RouteDefinition, TEnv> = {
196
199
  * for downstream revalidators),
197
200
  * - or nothing / `null` / `undefined` (defer — leaves the suggestion
198
201
  * unchanged and continues to the next revalidator).
202
+ * Or `true` / `false`: shorthand for `() => true` / `() => false`. A
203
+ * defer has no shorthand; write the function.
199
204
  */
200
- revalidate: (fn: ShouldRevalidateFn<any, TEnv>) => RevalidateItem;
205
+ revalidate: (fn: ShouldRevalidateFn<any, TEnv> | boolean) => RevalidateItem;
201
206
  /**
202
207
  * Attach a data loader to the current route/layout
203
208
  * ```typescript
@@ -8,7 +8,7 @@ import type { AllUseItems } from "../route-types.js";
8
8
  export declare function resolveHandlerUse(handler: unknown): (() => any[]) | undefined;
9
9
  /**
10
10
  * Validate every item an intercept's merged use() returned (explicit use()
11
- * and handler.use) against MOUNT_SITE_ALLOWED_TYPES.intercept, plus two
11
+ * and handler.use) against MOUNT_SITE_ALLOWED_TYPES.intercept, plus three
12
12
  * structural rules:
13
13
  * - a nested layout() is only the modal chrome (intercept() keeps its
14
14
  * handler), so it may not carry use() items of its own;
@@ -16,10 +16,15 @@ export declare function resolveHandlerUse(handler: unknown): (() => any[]) | und
16
16
  * it was not returned; its orphan form re-parents the following siblings
17
17
  * onto that entry, so it is rejected the same way. Inside a path, cache()
18
18
  * writes `sinks.cache` instead (dsl-helpers.ts cache()).
19
+ * - middleware on a `capturedLayouts` entry is rejected like `sinks.middleware`:
20
+ * it is an unreturned middleware(fn, () => [...]) or one called inside the
21
+ * chrome layout's use(), and nothing would run it.
19
22
  */
20
23
  export declare function validateInterceptUseItems(items: AllUseItems[], capturedLayouts: readonly {
21
24
  type: string;
25
+ middleware?: readonly unknown[];
22
26
  }[], slotName: string, routeName: string, sinks: {
27
+ readonly middleware: readonly unknown[];
23
28
  readonly revalidate: readonly unknown[];
24
29
  readonly errorBoundary: readonly unknown[];
25
30
  readonly notFoundBoundary: readonly unknown[];
@@ -16,6 +16,16 @@ export type RewriteTarget = {
16
16
  readonly search?: Record<string, unknown>;
17
17
  };
18
18
  export declare function describeRewriteTarget(target: RewriteTarget): string;
19
+ /**
20
+ * Which PPR shell a rewritten request reads and captures
21
+ * (`rewrite(...).shell()`); without a call, none.
22
+ * - `"visitor"`: its own, keyed by the visitor's URL and the target, captured
23
+ * with the visitor's location and `ctx.rewrittenFrom`.
24
+ * - `"target"`: the target's shared shell. `usePathname()` reads the target's
25
+ * path on a HIT, and values set before the throw are baked in: for a page
26
+ * that renders neither (a lock or promo page).
27
+ */
28
+ export type RewriteShell = "visitor" | "target";
19
29
  /**
20
30
  * The value `rewrite()` returns, thrown by middleware. An Error, so a throw
21
31
  * where a rewrite is not supported fails loudly with the rule in its message.
@@ -23,7 +33,34 @@ export declare function describeRewriteTarget(target: RewriteTarget): string;
23
33
  export declare class Rewrite extends Error {
24
34
  name: "Rewrite";
25
35
  readonly target: RewriteTarget;
26
- constructor(target: RewriteTarget);
36
+ /** The `shell()` choice; undefined: no shell. */
37
+ readonly shellAudience: RewriteShell | undefined;
38
+ /** `disallowMutations()`: a mutation is refused, not moved, before its action runs. */
39
+ readonly mutationsDisallowed: boolean;
40
+ constructor(target: RewriteTarget, shellAudience?: RewriteShell, mutationsDisallowed?: boolean);
41
+ /**
42
+ * A copy that picks the PPR shell of a `ppr` target ({@link RewriteShell}),
43
+ * so a rewrite kept in a module constant keeps its own choice:
44
+ *
45
+ * ```ts
46
+ * throw rewrite("item", { id }).shell("visitor");
47
+ * ```
48
+ */
49
+ shell(audience: RewriteShell): Rewrite;
50
+ /**
51
+ * A copy for a lock: global middleware's rewrite of a mutation (a server
52
+ * action, a form post, any non-GET request) is an error before the action
53
+ * runs, instead of moving the mutation to the target. GET and HEAD rewrite
54
+ * as usual.
55
+ *
56
+ * ```ts
57
+ * throw rewrite("maintenance").disallowMutations();
58
+ * ```
59
+ *
60
+ * Route middleware runs after the action, so there it cannot refuse it: the
61
+ * render moves to the target, dev warns, and production logs one error.
62
+ */
63
+ disallowMutations(): Rewrite;
27
64
  }
28
65
  /** Whether `value` is a Rewrite thrown by `rewrite()` (ctx.isRewrite). */
29
66
  export declare function isRewrite(value: unknown): value is Rewrite;
@@ -40,17 +77,23 @@ export type RewriteFunction<TRoutes = DefaultReverseRouteMap> = ((path: `/${stri
40
77
  * ```ts
41
78
  * router.use(async (ctx, next) => {
42
79
  * if (!locked || ctx.pathname === "/maintenance") return next();
43
- * throw rewrite("maintenance");
80
+ * throw rewrite("maintenance").disallowMutations();
44
81
  * });
45
82
  * ```
46
83
  *
47
84
  * The request runs again as the target (global middleware, route
48
85
  * middleware, render) with the same request context: values set before the
49
86
  * throw stay readable. `ctx.url` is the target; `ctx.rewrittenFrom` is the
50
- * visitor's URL. See the `/middleware` skill.
87
+ * visitor's URL. A mutation that global middleware rewrites moves to the
88
+ * target before its action runs, so the page's forms keep working; a lock
89
+ * refuses it with `.disallowMutations()`. A `ppr` target gets no shell unless
90
+ * `.shell()` picks one ({@link RewriteShell}). See the `/middleware` skill.
51
91
  */
52
92
  export declare const rewrite: RewriteFunction;
53
- /** A dispatch site that cannot honor a rewrite. */
54
- export type RewriteSite = "mutation" | "loader-fetch" | "intercept";
93
+ /**
94
+ * A dispatch site that cannot honor a rewrite. "mutation" is the refusal
95
+ * `.disallowMutations()` asked for, not a misuse.
96
+ */
97
+ export type RewriteSite = "mutation" | "body-read" | "loader-fetch";
55
98
  /** The error a rewrite becomes at a site that cannot honor it. */
56
99
  export declare function rewriteNotSupported(rewrite: Rewrite, site: RewriteSite): Error;
@@ -134,7 +134,7 @@ export type IncludeItem = {
134
134
  * include cannot collide with siblings declared outside it.
135
135
  */
136
136
  includeScope?: string;
137
- };
137
+ } & import("./server/context.js").IncludeScopePosition;
138
138
  };
139
139
  /**
140
140
  * Typed include item that carries nested routes as phantom type
@@ -156,7 +156,7 @@ export type RouteUseItem = LayoutItem | ParallelItem | InterceptItem | Middlewar
156
156
  /** Items that can be used inside a response route (path.json(), etc.) */
157
157
  export type ResponseRouteUseItem = MiddlewareItem | CacheItem;
158
158
  export type ParallelUseItem = RevalidateItem | LoaderItem | LoadingItem | ErrorBoundaryItem | NotFoundBoundaryItem | TransitionItem;
159
- export type InterceptUseItem = MiddlewareItem | LoaderItem | LoadingItem | LayoutItem | RouteItem | TransitionItem;
159
+ export type InterceptUseItem = LoaderItem | LoadingItem | LayoutItem | RouteItem | TransitionItem;
160
160
  export type LoaderUseItem = RevalidateItem | CacheItem;
161
161
  /**
162
162
  * Allow composition factories in use() callbacks.
@@ -4,6 +4,7 @@
4
4
  * Creates the handler context object passed to route handlers, middleware, and loaders.
5
5
  */
6
6
  import type { InternalHandlerContext } from "../types";
7
+ import { type ReverseScope, type ScopableReverse } from "../server/context.js";
7
8
  /**
8
9
  * `headers` whose mutating methods run `assertWrite(method)` first. Shared by
9
10
  * the handler ctx (createHandlerContext) and the middleware ctx
@@ -11,6 +12,16 @@ import type { InternalHandlerContext } from "../types";
11
12
  */
12
13
  export declare function guardHeaderWrites(headers: Headers, assertWrite: (method: string | symbol) => void): Headers;
13
14
  export { stripInternalParams } from "./internal-params.js";
15
+ /**
16
+ * The ctx a layout's or parallel slot's handler gets: a prototype child of
17
+ * the request's one handler ctx with its own `reverse` in the segment's
18
+ * ReverseScope, so `.name` resolves in the module that declared the segment.
19
+ * The scope rides the object, not the call frame: it holds after an `await`
20
+ * and in a component the ctx is handed to. Every other field reads through
21
+ * live (`_currentSegmentId` as resolution moves it, ctx.set values).
22
+ * `_reverseScope` keys a "use cache" call that takes this ctx (cache-runtime.ts).
23
+ */
24
+ export declare function withReverseScope<C>(ctx: C, scope: ReverseScope | undefined): C;
14
25
  /**
15
26
  * Create a reverse function for URL generation from route names.
16
27
  * Used by both HandlerContext and MiddlewareContext.
@@ -19,9 +30,10 @@ export { stripInternalParams } from "./internal-params.js";
19
30
  * generation. This enables auto-filling mount params from include() prefixes:
20
31
  * inner handlers can call ctx.reverse(".sibling") without explicitly passing
21
32
  * params that are already known from the current URL match.
22
- * Explicitly passed hrefParams take priority over currentParams.
33
+ * Explicitly passed hrefParams take priority over currentParams. A required
34
+ * param that neither supplies throws `Missing param`.
23
35
  */
24
- export declare function createReverseFunction(routeMap: Record<string, string>, currentRoutePrefix?: string, currentParams?: Record<string, string>, rootScoped?: boolean): (name: string, hrefParams?: Record<string, string>, search?: Record<string, unknown>) => string;
36
+ export declare function createReverseFunction(routeMap: Record<string, string>, currentRoutePrefix?: string, currentParams?: Record<string, string>, rootScoped?: boolean): ScopableReverse;
25
37
  /**
26
38
  * Create HandlerContext with typed env/var/get/set
27
39
  */
@@ -7,6 +7,7 @@
7
7
  import type { EntryData, InterceptEntry, InterceptSelectorContext } from "../server/context";
8
8
  import type { HandlerContext, ResolvedSegment } from "../types";
9
9
  import type { SegmentResolutionDeps } from "./types.js";
10
+ import type { RevalidationContext } from "./router-context.js";
10
11
  /**
11
12
  * Check if an intercept's when conditions are satisfied.
12
13
  * All when() functions must return true for the intercept to activate.
@@ -37,57 +38,29 @@ export declare function findInterceptForRoute(targetRouteKey: string, fromEntry:
37
38
  intercept: InterceptEntry;
38
39
  entry: EntryData;
39
40
  } | null;
41
+ /** The segment id of `intercept`'s slot on `parentEntry`. */
42
+ export declare function interceptSlotId(parentEntry: EntryData, intercept: InterceptEntry): string;
40
43
  /**
41
- * Resolve an intercept entry and emit segment with the slot name.
44
+ * Every segment id an intercept's slot owns, in order: the slot, then one
45
+ * loader segment per loader in declaration order, run or not. A request that
46
+ * resolves the intercept lists them in `matched` (match-result.ts).
42
47
  */
43
- export declare function resolveInterceptEntry<TEnv>(interceptEntry: InterceptEntry, parentEntry: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>, revalidationContext?: {
44
- clientSegmentIds: Set<string>;
45
- prevParams: Record<string, string>;
46
- request: Request;
47
- prevUrl: URL;
48
- nextUrl: URL;
49
- routeKey: string;
50
- actionContext?: {
51
- actionId?: string;
52
- actionUrl?: URL;
53
- actionResult?: any;
54
- formData?: FormData;
55
- };
56
- stale?: boolean;
57
- }, options?: {
48
+ export declare function interceptSegmentIds(parentEntry: EntryData, intercept: InterceptEntry): string[];
49
+ /**
50
+ * Resolve an intercept entry: its slot segment, then its loader segments.
51
+ */
52
+ export declare function resolveInterceptEntry<TEnv>(interceptEntry: InterceptEntry, parentEntry: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>, revalidationContext?: RevalidationContext, options?: {
58
53
  /**
59
- * Skip the intercept's middleware execution. Set ONLY by the post-response
60
- * background re-render paths (proactive caching, stale background
54
+ * Set ONLY by the post-response background re-render (stale background
61
55
  * revalidation), whose sole purpose is to re-render the segment tree to
62
- * populate the cache. The foreground request already ran the intercept
63
- * middleware before the response was sent — it validated auth, set cookies,
64
- * and wrote context vars into the request context's shared `_variables`,
65
- * which the background render reuses. Re-running middleware here would fire
66
- * its side effects a SECOND time, and a middleware that short-circuits with
67
- * a Response would `throw` and silently abort the cache write. Never set on
68
- * the foreground path.
56
+ * populate the cache: a handler error rejects instead of rendering the
57
+ * error boundary, so a failure is never cached. Never set on the
58
+ * foreground path.
69
59
  */
70
- skipMiddleware?: boolean;
60
+ background?: boolean;
71
61
  }): Promise<ResolvedSegment[]>;
72
62
  /**
73
- * Resolve only the loaders for a cached intercept segment.
74
- * Used on intercept cache hit to get fresh loader data while keeping cached component/layout.
63
+ * The loader segments of a cached intercept slot, on a cache hit: the slot
64
+ * keeps its cached component and layout, its loaders are never cached.
75
65
  */
76
- export declare function resolveInterceptLoadersOnly<TEnv>(interceptEntry: InterceptEntry, parentEntry: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>, revalidationContext: {
77
- clientSegmentIds: Set<string>;
78
- prevParams: Record<string, string>;
79
- request: Request;
80
- prevUrl: URL;
81
- nextUrl: URL;
82
- routeKey: string;
83
- actionContext?: {
84
- actionId?: string;
85
- actionUrl?: URL;
86
- actionResult?: any;
87
- formData?: FormData;
88
- };
89
- stale?: boolean;
90
- }): Promise<{
91
- loaderDataPromise: Promise<any[]> | any[];
92
- loaderIds: string[];
93
- } | null>;
66
+ export declare function resolveInterceptLoadersOnly<TEnv>(interceptEntry: InterceptEntry, parentEntry: EntryData, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>, revalidationContext: RevalidationContext): Promise<ResolvedSegment[]>;
@@ -24,3 +24,10 @@ export declare function findLazyIncludes<TEnv = any>(items: AllUseItems[]): Arra
24
24
  * Also detects nested lazy includes and registers them as new entries
25
25
  */
26
26
  export declare function evaluateLazyEntry<TEnv = any>(entry: RouteEntry<TEnv>, deps: LazyEvalDeps<TEnv>): void | Promise<void>;
27
+ /**
28
+ * Resolve an async include entry's provider once and cache the patterns on
29
+ * `entry.lazyPatterns`. Concurrent callers (match-time expansion and
30
+ * render-time loadManifest) share one in-flight import; it clears when it
31
+ * settles, so a rejected import is retried by the next request.
32
+ */
33
+ export declare function resolveEntryPatterns<TEnv = any>(entry: RouteEntry<TEnv>): Promise<UrlPatterns<TEnv>>;
@@ -29,7 +29,7 @@
29
29
  * v
30
30
  * +----------------------+ +----------------------------+
31
31
  * | Fresh intercept? |yes>| resolveInterceptEntry() |
32
- * | (!cacheHit or | | - middleware, loaders, UI |
32
+ * | (!cacheHit or | | - loaders, UI |
33
33
  * | no intercept segs) | +----------------------------+
34
34
  * +----------------------+ |
35
35
  * | no v
@@ -59,7 +59,7 @@
59
59
  *
60
60
  * 1. Fresh intercept (no cache):
61
61
  * - Full resolution of intercept entry
62
- * - Resolves middleware, loaders, and component
62
+ * - Resolves loaders and component
63
63
  * - Yields all intercept segments
64
64
  *
65
65
  * 2. Cache hit with intercept:
@@ -80,22 +80,6 @@ export declare function executeMiddleware<TEnv>(middlewares: Array<{
80
80
  entry: MiddlewareEntry<TEnv>;
81
81
  params: Record<string, string>;
82
82
  }>, request: Request, env: TEnv, variables: Record<string, any>, finalHandler: () => Promise<Response>, reverse?: (name: string, params?: Record<string, string>, search?: Record<string, unknown>) => string): Promise<Response>;
83
- /**
84
- * Execute middleware for intercepts (simplified execution)
85
- *
86
- * Intercepts use a shared stubResponse from the request context. This function:
87
- * - Runs middleware in sequence with a simple next() chain
88
- * - Returns Response if any middleware short-circuits (returns OR throws a Response, or redirects, BEFORE next())
89
- * - Returns null if all middleware calls next() - headers set after next() remain on stubResponse
90
- *
91
- * @param middlewares - Array of middleware functions
92
- * @param request - Original request
93
- * @param env - Environment bindings
94
- * @param params - Route params
95
- * @param variables - Shared variables object
96
- * @param stubResponse - Response from request context for collecting headers/cookies
97
- */
98
- export declare function executeInterceptMiddleware<TEnv>(middlewares: MiddlewareFn<TEnv>[], request: Request, env: TEnv, params: Record<string, string>, variables: Record<string, any>, stubResponse: Response, reverse?: (name: string, params?: Record<string, string>, search?: Record<string, unknown>) => string): Promise<Response | null>;
99
83
  /**
100
84
  * Execute middleware chain for loaders (simpler signature)
101
85
  *
@@ -1,6 +1,8 @@
1
1
  import type { RouteMatchResult } from "./pattern-matching.js";
2
2
  export interface NavigationSnapshot {
3
3
  prevUrl: URL;
4
+ /** The visitor's URL of the page left, when `prevUrl` is its rewrite target. */
5
+ prevVisitorUrl: URL | null;
4
6
  prevParams: Record<string, string>;
5
7
  prevMatch: RouteMatchResult | null;
6
8
  interceptContextUrl: URL;
@@ -1,15 +1,14 @@
1
1
  /**
2
- * Resolve the prefetch cache TTL once, at router init, into the three derived
3
- * values the rest of the router consumes: seconds (for the Cache-Control
4
- * max-age), milliseconds (for the client-side in-memory cache), and the
5
- * Cache-Control header string (or false when caching is disabled).
2
+ * Resolve the prefetch cache TTL once, at router init, into the values the
3
+ * rest of the router consumes: seconds, and milliseconds for the client-side
4
+ * in-memory prefetch cache (shipped in payload metadata). Prefetch responses
5
+ * carry no Cache-Control: the browser HTTP cache would keep a prefetch whose
6
+ * render failed after its 200 went out (#1170).
6
7
  *
7
8
  * `false` disables prefetch caching (seconds 0). A non-finite input
8
9
  * (NaN/Infinity, e.g. from an env-derived number that failed to parse) is
9
- * treated as the default rather than producing a malformed
10
- * `Cache-Control: max-age=NaN` header; CDNs/browsers ignore such a directive,
11
- * which would silently disable caching on EVERY prefetch response. Negative
12
- * finite values clamp to 0 (disabled).
10
+ * treated as the default rather than disabling the cache. Negative finite
11
+ * values clamp to 0 (disabled).
13
12
  *
14
13
  * Policy note: this is the prefetch-TTL policy specifically. Other finite-number
15
14
  * guards in the codebase deliberately differ — defer.ts treats Infinity as an
@@ -17,11 +16,9 @@
17
16
  * at config time. They are NOT the same guard, so don't unify them.
18
17
  */
19
18
  export interface ResolvedPrefetchCacheTTL {
20
- /** TTL in seconds for the Cache-Control max-age directive. */
19
+ /** TTL in seconds. */
21
20
  seconds: number;
22
21
  /** TTL in milliseconds for the client-side in-memory prefetch cache. */
23
22
  ms: number;
24
- /** Cache-Control header value, or false when caching is disabled. */
25
- cacheControl: string | false;
26
23
  }
27
24
  export declare function resolvePrefetchCacheTTL(rawTTL: number | false | undefined): ResolvedPrefetchCacheTTL;
@@ -3,9 +3,16 @@
3
3
  *
4
4
  * Evaluates whether segments should revalidate based on params, actions, and custom functions.
5
5
  */
6
- import type { ResolvedSegment, HandlerContext } from "../types";
6
+ import type { ResolvedSegment, HandlerContext, ShouldRevalidateFn } from "../types";
7
7
  import type { ActionContext } from "./types";
8
8
  import type { RevalidationTraceEntry } from "./logging.js";
9
+ /**
10
+ * The predicate `revalidate(true)` / `revalidate(false)` stands for: the
11
+ * constant hard decision of `revalidate(() => true)` / `() => false`.
12
+ * Booleans are converted where they enter (the urls() helper, clientUrls()
13
+ * materialization, runRevalidate), so evaluation only ever sees functions.
14
+ */
15
+ export declare function toShouldRevalidateFn(fn: ShouldRevalidateFn<any, any> | boolean): ShouldRevalidateFn<any, any>;
9
16
  /**
10
17
  * Options for revalidation evaluation
11
18
  */