@rangojs/router 0.5.1 → 0.6.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 (609) hide show
  1. package/README.md +5 -1
  2. package/dist/bin/rango.js +343 -125
  3. package/dist/types/browser/event-controller.d.ts +6 -0
  4. package/dist/types/browser/react/use-router.d.ts +10 -3
  5. package/dist/types/browser/react/use-search-params.d.ts +57 -10
  6. package/dist/types/browser/types.d.ts +22 -0
  7. package/dist/types/build/merge-full-manifests.d.ts +3 -0
  8. package/dist/types/build/route-trie.d.ts +4 -73
  9. package/dist/types/build/route-types/per-module-writer.d.ts +6 -4
  10. package/dist/types/build/route-types/router-processing.d.ts +2 -3
  11. package/dist/types/cache/cache-exec-scope.d.ts +31 -0
  12. package/dist/types/cache/cf/cf-cache-constants.d.ts +8 -1
  13. package/dist/types/cache/cf/cf-cache-store.d.ts +15 -1
  14. package/dist/types/cache/cf/cf-cache-types.d.ts +1 -1
  15. package/dist/types/cache/cf/cf-kv-utils.d.ts +21 -0
  16. package/dist/types/cache/taint.d.ts +12 -6
  17. package/dist/types/client-urls/client-root.d.ts +38 -0
  18. package/dist/types/client-urls/client-urls.d.ts +5 -0
  19. package/dist/types/client-urls/navigation.d.ts +38 -0
  20. package/dist/types/client-urls/revalidation-protocol.d.ts +25 -0
  21. package/dist/types/client-urls/server-projection.d.ts +62 -0
  22. package/dist/types/client-urls/types.d.ts +144 -0
  23. package/dist/types/client.d.ts +12 -4
  24. package/dist/types/client.rsc.d.ts +4 -1
  25. package/dist/types/decode-loader-results.d.ts +37 -0
  26. package/dist/types/errors.d.ts +1 -0
  27. package/dist/types/handles/is-thenable.d.ts +2 -4
  28. package/dist/types/index.d.ts +1 -1
  29. package/dist/types/loader-redirect.d.ts +27 -0
  30. package/dist/types/outlet-context.d.ts +12 -0
  31. package/dist/types/outlet-provider.d.ts +3 -1
  32. package/dist/types/redirect-origin.d.ts +4 -0
  33. package/dist/types/route-content-wrapper.d.ts +42 -1
  34. package/dist/types/route-definition/helpers-types.d.ts +13 -2
  35. package/dist/types/router/error-handling.d.ts +35 -1
  36. package/dist/types/router/intercept-resolution.d.ts +12 -0
  37. package/dist/types/router/loader-resolution.d.ts +24 -2
  38. package/dist/types/router/revalidation.d.ts +7 -0
  39. package/dist/{types.backup/build/route-trie.d.ts → types/router/route-trie-builder.d.ts} +4 -16
  40. package/dist/types/router/router-interfaces.d.ts +20 -0
  41. package/dist/types/router/segment-resolution/helpers.d.ts +1 -1
  42. package/dist/types/router/trie-matching.d.ts +1 -1
  43. package/dist/types/rsc/helpers.d.ts +3 -0
  44. package/dist/types/rsc/manifest-init.d.ts +5 -5
  45. package/dist/types/rsc/render-pipeline.d.ts +9 -0
  46. package/dist/types/rsc/routine-plan.d.ts +124 -0
  47. package/dist/types/rsc/shell-capture-constants.d.ts +17 -0
  48. package/dist/types/rsc/shell-capture.d.ts +9 -0
  49. package/dist/types/rsc/shell-serve.d.ts +11 -0
  50. package/dist/types/rsc/types.d.ts +30 -0
  51. package/dist/types/segment-system.d.ts +2 -0
  52. package/dist/types/server/context.d.ts +10 -0
  53. package/dist/types/server/handle-store.d.ts +34 -3
  54. package/dist/types/server/request-context.d.ts +14 -1
  55. package/dist/types/server.d.ts +1 -0
  56. package/dist/types/ssr/index.d.ts +22 -0
  57. package/dist/types/ssr/ssr-root.d.ts +10 -0
  58. package/dist/types/testing/dom.entry.d.ts +1 -1
  59. package/dist/types/testing/render-route.d.ts +16 -6
  60. package/dist/types/testing/run-loader.d.ts +9 -0
  61. package/dist/types/types/boundaries.d.ts +22 -0
  62. package/dist/types/types/index.d.ts +1 -1
  63. package/dist/types/types/loader-types.d.ts +57 -5
  64. package/dist/types/types/segments.d.ts +7 -0
  65. package/dist/types/urls/path-helper-types.d.ts +10 -4
  66. package/dist/types/vite/discovery/client-urls-projection.d.ts +53 -0
  67. package/dist/types/vite/discovery/discover-routers.d.ts +1 -1
  68. package/dist/types/vite/discovery/state.d.ts +8 -1
  69. package/dist/types/vite/encryption-key.d.ts +2 -0
  70. package/dist/types/vite/plugins/expose-internal-ids.d.ts +10 -0
  71. package/dist/types/vite/plugins/server-ref-hashing.d.ts +24 -0
  72. package/dist/types/vite/plugins/server-reference-pattern.d.ts +1 -0
  73. package/dist/types/vite/utils/shared-utils.d.ts +12 -0
  74. package/dist/vite/index.js +5101 -2056
  75. package/package.json +3 -3
  76. package/skills/breadcrumbs/SKILL.md +39 -9
  77. package/skills/caching/SKILL.md +1 -1
  78. package/skills/catalog.json +7 -1
  79. package/skills/client-urls/SKILL.md +338 -0
  80. package/skills/comparison/references/framework-comparison.md +23 -9
  81. package/skills/hooks/SKILL.md +2 -2
  82. package/skills/hooks/data.md +11 -2
  83. package/skills/hooks/handle-and-actions.md +7 -0
  84. package/skills/hooks/outlets.md +26 -5
  85. package/skills/hooks/urls.md +40 -3
  86. package/skills/loader/SKILL.md +132 -20
  87. package/skills/migrate-nextjs/SKILL.md +70 -10
  88. package/skills/migrate-react-router/SKILL.md +49 -13
  89. package/skills/migrate-react-router/component-migration.md +18 -13
  90. package/skills/migrate-react-router/data-and-actions.md +14 -3
  91. package/skills/migrate-react-router/route-mapping.md +15 -2
  92. package/skills/mime-routes/SKILL.md +3 -1
  93. package/skills/parallel/SKILL.md +32 -1
  94. package/skills/ppr/SKILL.md +16 -6
  95. package/skills/prerender/SKILL.md +8 -4
  96. package/skills/rango/SKILL.md +21 -17
  97. package/skills/react-compiler/SKILL.md +3 -3
  98. package/skills/response-routes/SKILL.md +4 -2
  99. package/skills/route/SKILL.md +5 -2
  100. package/skills/router-setup/SKILL.md +16 -2
  101. package/skills/scripts/SKILL.md +16 -6
  102. package/skills/shell-manifest/SKILL.md +16 -7
  103. package/skills/testing/SKILL.md +2 -2
  104. package/skills/testing/client-components.md +6 -0
  105. package/skills/testing/handles.md +30 -8
  106. package/skills/testing/loader.md +51 -49
  107. package/skills/testing/middleware.md +1 -1
  108. package/skills/theme/SKILL.md +8 -5
  109. package/skills/typesafety/generated-files-and-cli.md +16 -9
  110. package/skills/typesafety/route-types.md +5 -1
  111. package/skills/use-cache/SKILL.md +47 -0
  112. package/src/bin/rango.ts +7 -3
  113. package/src/browser/event-controller.ts +40 -15
  114. package/src/browser/navigation-bridge.ts +6 -0
  115. package/src/browser/navigation-client.ts +5 -0
  116. package/src/browser/partial-update.ts +77 -10
  117. package/src/browser/react/NavigationProvider.tsx +7 -0
  118. package/src/browser/react/use-router.ts +40 -11
  119. package/src/browser/react/use-search-params.ts +140 -17
  120. package/src/browser/rsc-router.tsx +59 -0
  121. package/src/browser/server-action-bridge.ts +26 -0
  122. package/src/browser/types.ts +22 -0
  123. package/src/build/merge-full-manifests.ts +161 -0
  124. package/src/build/route-trie.ts +9 -332
  125. package/src/build/route-types/include-resolution.ts +66 -11
  126. package/src/build/route-types/per-module-writer.ts +11 -6
  127. package/src/build/route-types/router-processing.ts +184 -153
  128. package/src/build/runtime-discovery.ts +23 -12
  129. package/src/cache/cache-exec-scope.ts +47 -0
  130. package/src/cache/cache-runtime.ts +113 -40
  131. package/src/cache/cf/cf-cache-constants.ts +8 -1
  132. package/src/cache/cf/cf-cache-store.ts +41 -64
  133. package/src/cache/cf/cf-cache-types.ts +1 -1
  134. package/src/cache/cf/cf-kv-utils.ts +38 -0
  135. package/src/cache/segment-codec.ts +21 -5
  136. package/src/cache/taint.ts +28 -9
  137. package/src/client-urls/client-root.tsx +168 -0
  138. package/src/client-urls/client-urls.ts +698 -0
  139. package/src/client-urls/navigation.ts +237 -0
  140. package/src/client-urls/revalidation-protocol.ts +56 -0
  141. package/src/client-urls/server-projection.ts +579 -0
  142. package/src/client-urls/types.ts +195 -0
  143. package/src/client.rsc.tsx +12 -0
  144. package/src/client.tsx +49 -6
  145. package/src/decode-loader-results.ts +113 -0
  146. package/src/errors.ts +14 -0
  147. package/src/handles/deferred-resolution.ts +14 -7
  148. package/src/handles/is-thenable.ts +2 -4
  149. package/src/index.ts +1 -0
  150. package/src/loader-redirect.tsx +64 -0
  151. package/src/outlet-context.ts +12 -0
  152. package/src/outlet-provider.tsx +15 -1
  153. package/src/redirect-origin.ts +29 -0
  154. package/src/route-content-wrapper.tsx +96 -3
  155. package/src/route-definition/dsl-helpers.ts +28 -3
  156. package/src/route-definition/helpers-types.ts +13 -0
  157. package/src/route-definition/redirect.ts +17 -18
  158. package/src/router/error-handling.ts +65 -11
  159. package/src/router/intercept-resolution.ts +29 -0
  160. package/src/router/loader-resolution.ts +261 -28
  161. package/src/router/match-middleware/cache-lookup.ts +24 -15
  162. package/src/router/match-result.ts +7 -0
  163. package/src/router/revalidation.ts +24 -11
  164. package/src/router/route-trie-builder.ts +334 -0
  165. package/src/router/router-interfaces.ts +38 -0
  166. package/src/router/segment-resolution/fresh.ts +47 -0
  167. package/src/router/segment-resolution/helpers.ts +9 -11
  168. package/src/router/segment-resolution/loader-cache.ts +14 -24
  169. package/src/router/segment-resolution/revalidation.ts +20 -1
  170. package/src/router/trie-matching.ts +3 -3
  171. package/src/router.ts +46 -1
  172. package/src/rsc/full-payload.ts +6 -0
  173. package/src/rsc/handler.ts +36 -12
  174. package/src/rsc/helpers.ts +13 -0
  175. package/src/rsc/loader-fetch.ts +2 -2
  176. package/src/rsc/manifest-init.ts +28 -9
  177. package/src/rsc/progressive-enhancement.ts +247 -70
  178. package/src/rsc/render-pipeline.ts +68 -24
  179. package/src/rsc/routine-plan.ts +359 -0
  180. package/src/rsc/rsc-rendering.ts +569 -302
  181. package/src/rsc/server-action.ts +180 -71
  182. package/src/rsc/shell-capture-constants.ts +18 -0
  183. package/src/rsc/shell-capture.ts +104 -21
  184. package/src/rsc/shell-serve.ts +15 -2
  185. package/src/rsc/ssr-setup.ts +10 -1
  186. package/src/rsc/types.ts +31 -2
  187. package/src/segment-system.tsx +83 -26
  188. package/src/server/context.ts +10 -0
  189. package/src/server/cookie-store.ts +19 -19
  190. package/src/server/handle-store.ts +185 -48
  191. package/src/server/request-context.ts +36 -6
  192. package/src/server.ts +7 -0
  193. package/src/ssr/index.tsx +37 -2
  194. package/src/ssr/ssr-root.tsx +30 -2
  195. package/src/testing/dom.entry.ts +1 -1
  196. package/src/testing/render-route.tsx +22 -8
  197. package/src/testing/run-loader.ts +51 -13
  198. package/src/types/boundaries.ts +19 -0
  199. package/src/types/index.ts +1 -0
  200. package/src/types/loader-types.ts +60 -5
  201. package/src/types/segments.ts +7 -0
  202. package/src/urls/include-helper.ts +22 -4
  203. package/src/urls/path-helper-types.ts +14 -1
  204. package/src/use-loader.tsx +67 -6
  205. package/src/vite/discovery/client-urls-projection.ts +322 -0
  206. package/src/vite/discovery/discover-routers.ts +43 -17
  207. package/src/vite/discovery/state.ts +11 -1
  208. package/src/vite/discovery/virtual-module-codegen.ts +20 -0
  209. package/src/vite/encryption-key.ts +29 -0
  210. package/src/vite/plugins/expose-action-id.ts +2 -2
  211. package/src/vite/plugins/expose-internal-ids.ts +46 -0
  212. package/src/vite/plugins/server-ref-hashing.ts +74 -0
  213. package/src/vite/plugins/server-reference-pattern.ts +10 -0
  214. package/src/vite/plugins/virtual-entries.ts +12 -3
  215. package/src/vite/rango.ts +9 -0
  216. package/src/vite/router-discovery.ts +184 -14
  217. package/src/vite/utils/shared-utils.ts +12 -7
  218. package/dist/types.backup/__internal.d.ts +0 -127
  219. package/dist/types.backup/bin/rango.d.ts +0 -1
  220. package/dist/types.backup/browser/action-coordinator.d.ts +0 -57
  221. package/dist/types.backup/browser/action-fence.d.ts +0 -33
  222. package/dist/types.backup/browser/app-shell.d.ts +0 -34
  223. package/dist/types.backup/browser/app-version.d.ts +0 -6
  224. package/dist/types.backup/browser/connection-warmup.d.ts +0 -31
  225. package/dist/types.backup/browser/cookie-name.d.ts +0 -66
  226. package/dist/types.backup/browser/event-controller.d.ts +0 -221
  227. package/dist/types.backup/browser/history-state.d.ts +0 -26
  228. package/dist/types.backup/browser/index.d.ts +0 -1
  229. package/dist/types.backup/browser/intercept-utils.d.ts +0 -30
  230. package/dist/types.backup/browser/invalidate-client-cache.d.ts +0 -17
  231. package/dist/types.backup/browser/link-interceptor.d.ts +0 -43
  232. package/dist/types.backup/browser/logging.d.ts +0 -33
  233. package/dist/types.backup/browser/merge-segment-loaders.d.ts +0 -38
  234. package/dist/types.backup/browser/navigation-bridge.d.ts +0 -27
  235. package/dist/types.backup/browser/navigation-client.d.ts +0 -17
  236. package/dist/types.backup/browser/navigation-store-handle.d.ts +0 -25
  237. package/dist/types.backup/browser/navigation-store.d.ts +0 -95
  238. package/dist/types.backup/browser/navigation-transaction.d.ts +0 -75
  239. package/dist/types.backup/browser/network-error-handler.d.ts +0 -35
  240. package/dist/types.backup/browser/partial-update.d.ts +0 -61
  241. package/dist/types.backup/browser/prefetch/cache.d.ts +0 -183
  242. package/dist/types.backup/browser/prefetch/fetch.d.ts +0 -52
  243. package/dist/types.backup/browser/prefetch/observer.d.ts +0 -27
  244. package/dist/types.backup/browser/prefetch/policy.d.ts +0 -13
  245. package/dist/types.backup/browser/prefetch/queue.d.ts +0 -48
  246. package/dist/types.backup/browser/prefetch/resource-ready.d.ts +0 -28
  247. package/dist/types.backup/browser/rango-state.d.ts +0 -52
  248. package/dist/types.backup/browser/react/Link.d.ts +0 -140
  249. package/dist/types.backup/browser/react/NavigationProvider.d.ts +0 -88
  250. package/dist/types.backup/browser/react/ScrollRestoration.d.ts +0 -78
  251. package/dist/types.backup/browser/react/context.d.ts +0 -54
  252. package/dist/types.backup/browser/react/filter-segment-order.d.ts +0 -35
  253. package/dist/types.backup/browser/react/index.d.ts +0 -1
  254. package/dist/types.backup/browser/react/location-state-shared.d.ts +0 -162
  255. package/dist/types.backup/browser/react/location-state.d.ts +0 -29
  256. package/dist/types.backup/browser/react/mount-context.d.ts +0 -23
  257. package/dist/types.backup/browser/react/nonce-context.d.ts +0 -14
  258. package/dist/types.backup/browser/react/shallow-equal.d.ts +0 -5
  259. package/dist/types.backup/browser/react/use-action.d.ts +0 -61
  260. package/dist/types.backup/browser/react/use-handle.d.ts +0 -21
  261. package/dist/types.backup/browser/react/use-href.d.ts +0 -32
  262. package/dist/types.backup/browser/react/use-link-status.d.ts +0 -36
  263. package/dist/types.backup/browser/react/use-mount.d.ts +0 -24
  264. package/dist/types.backup/browser/react/use-navigation.d.ts +0 -15
  265. package/dist/types.backup/browser/react/use-params.d.ts +0 -21
  266. package/dist/types.backup/browser/react/use-pathname.d.ts +0 -13
  267. package/dist/types.backup/browser/react/use-reverse.d.ts +0 -40
  268. package/dist/types.backup/browser/react/use-router.d.ts +0 -23
  269. package/dist/types.backup/browser/react/use-search-params.d.ts +0 -19
  270. package/dist/types.backup/browser/react/use-segments.d.ts +0 -29
  271. package/dist/types.backup/browser/response-adapter.d.ts +0 -58
  272. package/dist/types.backup/browser/rsc-router.d.ts +0 -141
  273. package/dist/types.backup/browser/scroll-restoration.d.ts +0 -103
  274. package/dist/types.backup/browser/segment-reconciler.d.ts +0 -74
  275. package/dist/types.backup/browser/segment-structure-assert.d.ts +0 -16
  276. package/dist/types.backup/browser/server-action-bridge.d.ts +0 -29
  277. package/dist/types.backup/browser/types.d.ts +0 -530
  278. package/dist/types.backup/browser/validate-redirect-origin.d.ts +0 -28
  279. package/dist/types.backup/build/collect-fallback-refs.d.ts +0 -5
  280. package/dist/types.backup/build/generate-manifest.d.ts +0 -100
  281. package/dist/types.backup/build/generate-route-types.d.ts +0 -8
  282. package/dist/types.backup/build/index.d.ts +0 -21
  283. package/dist/types.backup/build/prefix-tree-utils.d.ts +0 -56
  284. package/dist/types.backup/build/route-types/ast-helpers.d.ts +0 -3
  285. package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +0 -13
  286. package/dist/types.backup/build/route-types/codegen.d.ts +0 -16
  287. package/dist/types.backup/build/route-types/include-resolution.d.ts +0 -74
  288. package/dist/types.backup/build/route-types/param-extraction.d.ts +0 -13
  289. package/dist/types.backup/build/route-types/per-module-writer.d.ts +0 -18
  290. package/dist/types.backup/build/route-types/router-processing.d.ts +0 -82
  291. package/dist/types.backup/build/route-types/scan-filter.d.ts +0 -17
  292. package/dist/types.backup/build/route-types/source-scan.d.ts +0 -13
  293. package/dist/types.backup/build/runtime-discovery.d.ts +0 -24
  294. package/dist/types.backup/cache/background-task.d.ts +0 -21
  295. package/dist/types.backup/cache/cache-error.d.ts +0 -71
  296. package/dist/types.backup/cache/cache-key-utils.d.ts +0 -35
  297. package/dist/types.backup/cache/cache-policy.d.ts +0 -59
  298. package/dist/types.backup/cache/cache-runtime.d.ts +0 -51
  299. package/dist/types.backup/cache/cache-scope.d.ts +0 -134
  300. package/dist/types.backup/cache/cache-tag.d.ts +0 -79
  301. package/dist/types.backup/cache/cf/cf-base64.d.ts +0 -4
  302. package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +0 -105
  303. package/dist/types.backup/cache/cf/cf-cache-store.d.ts +0 -481
  304. package/dist/types.backup/cache/cf/cf-cache-types.d.ts +0 -300
  305. package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +0 -22
  306. package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +0 -15
  307. package/dist/types.backup/cache/cf/index.d.ts +0 -3
  308. package/dist/types.backup/cache/document-cache.d.ts +0 -69
  309. package/dist/types.backup/cache/handle-capture.d.ts +0 -23
  310. package/dist/types.backup/cache/handle-snapshot.d.ts +0 -39
  311. package/dist/types.backup/cache/index.d.ts +0 -7
  312. package/dist/types.backup/cache/memory-segment-store.d.ts +0 -163
  313. package/dist/types.backup/cache/profile-registry.d.ts +0 -40
  314. package/dist/types.backup/cache/read-through-swr.d.ts +0 -60
  315. package/dist/types.backup/cache/segment-codec.d.ts +0 -78
  316. package/dist/types.backup/cache/shell-snapshot.d.ts +0 -162
  317. package/dist/types.backup/cache/tag-invalidation.d.ts +0 -74
  318. package/dist/types.backup/cache/taint.d.ts +0 -71
  319. package/dist/types.backup/cache/types.d.ts +0 -407
  320. package/dist/types.backup/cache/vercel/index.d.ts +0 -1
  321. package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +0 -267
  322. package/dist/types.backup/client.d.ts +0 -184
  323. package/dist/types.backup/client.rsc.d.ts +0 -39
  324. package/dist/types.backup/cloudflare/index.d.ts +0 -7
  325. package/dist/types.backup/cloudflare/tracing.d.ts +0 -53
  326. package/dist/types.backup/component-utils.d.ts +0 -46
  327. package/dist/types.backup/components/DefaultDocument.d.ts +0 -13
  328. package/dist/types.backup/context-var.d.ts +0 -84
  329. package/dist/types.backup/debug.d.ts +0 -57
  330. package/dist/types.backup/decode-loader-results.d.ts +0 -5
  331. package/dist/types.backup/default-error-boundary.d.ts +0 -10
  332. package/dist/types.backup/defer.d.ts +0 -89
  333. package/dist/types.backup/deps/browser.d.ts +0 -1
  334. package/dist/types.backup/deps/html-stream-client.d.ts +0 -1
  335. package/dist/types.backup/deps/html-stream-server.d.ts +0 -1
  336. package/dist/types.backup/deps/rsc.d.ts +0 -1
  337. package/dist/types.backup/deps/ssr.d.ts +0 -1
  338. package/dist/types.backup/encode-kv.d.ts +0 -35
  339. package/dist/types.backup/errors.d.ts +0 -226
  340. package/dist/types.backup/escape-script.d.ts +0 -44
  341. package/dist/types.backup/handle.d.ts +0 -93
  342. package/dist/types.backup/handles/MetaTags.d.ts +0 -17
  343. package/dist/types.backup/handles/Scripts.d.ts +0 -38
  344. package/dist/types.backup/handles/breadcrumbs.d.ts +0 -43
  345. package/dist/types.backup/handles/deferred-resolution.d.ts +0 -53
  346. package/dist/types.backup/handles/is-thenable.d.ts +0 -12
  347. package/dist/types.backup/handles/meta.d.ts +0 -43
  348. package/dist/types.backup/handles/script.d.ts +0 -139
  349. package/dist/types.backup/host/cookie-handler.d.ts +0 -8
  350. package/dist/types.backup/host/errors.d.ts +0 -40
  351. package/dist/types.backup/host/index.d.ts +0 -33
  352. package/dist/types.backup/host/pattern-matcher.d.ts +0 -30
  353. package/dist/types.backup/host/router.d.ts +0 -12
  354. package/dist/types.backup/host/testing.d.ts +0 -41
  355. package/dist/types.backup/host/types.d.ts +0 -148
  356. package/dist/types.backup/host/utils.d.ts +0 -20
  357. package/dist/types.backup/href-client.d.ts +0 -214
  358. package/dist/types.backup/index.d.ts +0 -112
  359. package/dist/types.backup/index.rsc.d.ts +0 -51
  360. package/dist/types.backup/internal-debug.d.ts +0 -1
  361. package/dist/types.backup/loader-store.d.ts +0 -193
  362. package/dist/types.backup/loader.d.ts +0 -18
  363. package/dist/types.backup/loader.rsc.d.ts +0 -18
  364. package/dist/types.backup/missing-id-error.d.ts +0 -1
  365. package/dist/types.backup/outlet-context.d.ts +0 -12
  366. package/dist/types.backup/outlet-provider.d.ts +0 -12
  367. package/dist/types.backup/prerender/build-shell-capture.d.ts +0 -104
  368. package/dist/types.backup/prerender/param-hash.d.ts +0 -6
  369. package/dist/types.backup/prerender/shell-manifest-key.d.ts +0 -18
  370. package/dist/types.backup/prerender/store.d.ts +0 -62
  371. package/dist/types.backup/prerender.d.ts +0 -292
  372. package/dist/types.backup/redirect-origin.d.ts +0 -55
  373. package/dist/types.backup/regex-escape.d.ts +0 -6
  374. package/dist/types.backup/render-error-thrower.d.ts +0 -13
  375. package/dist/types.backup/response-utils.d.ts +0 -35
  376. package/dist/types.backup/reverse.d.ts +0 -206
  377. package/dist/types.backup/root-error-boundary.d.ts +0 -32
  378. package/dist/types.backup/route-content-wrapper.d.ts +0 -40
  379. package/dist/types.backup/route-definition/dsl-helpers.d.ts +0 -130
  380. package/dist/types.backup/route-definition/helper-factories.d.ts +0 -22
  381. package/dist/types.backup/route-definition/helpers-types.d.ts +0 -392
  382. package/dist/types.backup/route-definition/index.d.ts +0 -7
  383. package/dist/types.backup/route-definition/redirect.d.ts +0 -48
  384. package/dist/types.backup/route-definition/resolve-handler-use.d.ts +0 -19
  385. package/dist/types.backup/route-definition/use-item-types.d.ts +0 -1
  386. package/dist/types.backup/route-definition.d.ts +0 -1
  387. package/dist/types.backup/route-map-builder.d.ts +0 -127
  388. package/dist/types.backup/route-name.d.ts +0 -27
  389. package/dist/types.backup/route-types.d.ts +0 -172
  390. package/dist/types.backup/router/basename.d.ts +0 -10
  391. package/dist/types.backup/router/content-negotiation.d.ts +0 -91
  392. package/dist/types.backup/router/debug-manifest.d.ts +0 -7
  393. package/dist/types.backup/router/error-handling.d.ts +0 -76
  394. package/dist/types.backup/router/find-match.d.ts +0 -19
  395. package/dist/types.backup/router/handler-context.d.ts +0 -41
  396. package/dist/types.backup/router/instrument.d.ts +0 -161
  397. package/dist/types.backup/router/intercept-resolution.d.ts +0 -79
  398. package/dist/types.backup/router/lazy-includes.d.ts +0 -26
  399. package/dist/types.backup/router/loader-resolution.d.ts +0 -63
  400. package/dist/types.backup/router/logging.d.ts +0 -41
  401. package/dist/types.backup/router/manifest.d.ts +0 -8
  402. package/dist/types.backup/router/match-api.d.ts +0 -19
  403. package/dist/types.backup/router/match-context.d.ts +0 -184
  404. package/dist/types.backup/router/match-handlers.d.ts +0 -49
  405. package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +0 -113
  406. package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +0 -113
  407. package/dist/types.backup/router/match-middleware/cache-store.d.ts +0 -112
  408. package/dist/types.backup/router/match-middleware/index.d.ts +0 -80
  409. package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +0 -116
  410. package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +0 -94
  411. package/dist/types.backup/router/match-pipelines.d.ts +0 -103
  412. package/dist/types.backup/router/match-result.d.ts +0 -114
  413. package/dist/types.backup/router/metrics.d.ts +0 -6
  414. package/dist/types.backup/router/middleware-types.d.ts +0 -74
  415. package/dist/types.backup/router/middleware.d.ts +0 -116
  416. package/dist/types.backup/router/navigation-snapshot.d.ts +0 -22
  417. package/dist/types.backup/router/params-util.d.ts +0 -8
  418. package/dist/types.backup/router/parse-pattern.d.ts +0 -38
  419. package/dist/types.backup/router/pattern-matching.d.ts +0 -169
  420. package/dist/types.backup/router/prefetch-cache-ttl.d.ts +0 -27
  421. package/dist/types.backup/router/prefetch-limits.d.ts +0 -20
  422. package/dist/types.backup/router/prerender-match.d.ts +0 -50
  423. package/dist/types.backup/router/preview-match.d.ts +0 -22
  424. package/dist/types.backup/router/request-classification.d.ts +0 -104
  425. package/dist/types.backup/router/revalidation.d.ts +0 -57
  426. package/dist/types.backup/router/route-snapshot.d.ts +0 -112
  427. package/dist/types.backup/router/router-context.d.ts +0 -137
  428. package/dist/types.backup/router/router-interfaces.d.ts +0 -432
  429. package/dist/types.backup/router/router-options.d.ts +0 -738
  430. package/dist/types.backup/router/router-registry.d.ts +0 -15
  431. package/dist/types.backup/router/segment-resolution/fresh.d.ts +0 -55
  432. package/dist/types.backup/router/segment-resolution/helpers.d.ts +0 -93
  433. package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +0 -33
  434. package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +0 -44
  435. package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +0 -90
  436. package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +0 -53
  437. package/dist/types.backup/router/segment-resolution/revalidation.d.ts +0 -85
  438. package/dist/types.backup/router/segment-resolution/static-store.d.ts +0 -17
  439. package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +0 -16
  440. package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +0 -28
  441. package/dist/types.backup/router/segment-resolution.d.ts +0 -3
  442. package/dist/types.backup/router/segment-wrappers.d.ts +0 -53
  443. package/dist/types.backup/router/state-cookie-name.d.ts +0 -1
  444. package/dist/types.backup/router/substitute-pattern-params.d.ts +0 -23
  445. package/dist/types.backup/router/telemetry-otel.d.ts +0 -113
  446. package/dist/types.backup/router/telemetry.d.ts +0 -215
  447. package/dist/types.backup/router/timeout.d.ts +0 -68
  448. package/dist/types.backup/router/tracing.d.ts +0 -125
  449. package/dist/types.backup/router/trie-matching.d.ts +0 -32
  450. package/dist/types.backup/router/types.d.ts +0 -98
  451. package/dist/types.backup/router/url-params.d.ts +0 -26
  452. package/dist/types.backup/router.d.ts +0 -7
  453. package/dist/types.backup/rsc/capture-queue.d.ts +0 -6
  454. package/dist/types.backup/rsc/full-payload.d.ts +0 -22
  455. package/dist/types.backup/rsc/handler-context.d.ts +0 -31
  456. package/dist/types.backup/rsc/handler.d.ts +0 -9
  457. package/dist/types.backup/rsc/helpers.d.ts +0 -213
  458. package/dist/types.backup/rsc/index.d.ts +0 -17
  459. package/dist/types.backup/rsc/json-route-result.d.ts +0 -20
  460. package/dist/types.backup/rsc/loader-fetch.d.ts +0 -14
  461. package/dist/types.backup/rsc/manifest-init.d.ts +0 -18
  462. package/dist/types.backup/rsc/nonce.d.ts +0 -28
  463. package/dist/types.backup/rsc/origin-guard.d.ts +0 -50
  464. package/dist/types.backup/rsc/progressive-enhancement.d.ts +0 -19
  465. package/dist/types.backup/rsc/redirect-guard.d.ts +0 -35
  466. package/dist/types.backup/rsc/response-cache-serve.d.ts +0 -46
  467. package/dist/types.backup/rsc/response-error.d.ts +0 -19
  468. package/dist/types.backup/rsc/response-route-handler.d.ts +0 -29
  469. package/dist/types.backup/rsc/rsc-rendering.d.ts +0 -23
  470. package/dist/types.backup/rsc/runtime-warnings.d.ts +0 -22
  471. package/dist/types.backup/rsc/server-action.d.ts +0 -68
  472. package/dist/types.backup/rsc/shell-build-manifest.d.ts +0 -84
  473. package/dist/types.backup/rsc/shell-capture-constants.d.ts +0 -27
  474. package/dist/types.backup/rsc/shell-capture.d.ts +0 -374
  475. package/dist/types.backup/rsc/shell-serve.d.ts +0 -136
  476. package/dist/types.backup/rsc/ssr-setup.d.ts +0 -48
  477. package/dist/types.backup/rsc/transition-gate.d.ts +0 -27
  478. package/dist/types.backup/rsc/types.d.ts +0 -290
  479. package/dist/types.backup/runtime-env.d.ts +0 -1
  480. package/dist/types.backup/search-params.d.ts +0 -125
  481. package/dist/types.backup/segment-content-promise.d.ts +0 -13
  482. package/dist/types.backup/segment-fragments.d.ts +0 -56
  483. package/dist/types.backup/segment-loader-promise.d.ts +0 -22
  484. package/dist/types.backup/segment-system.d.ts +0 -84
  485. package/dist/types.backup/serialize.d.ts +0 -164
  486. package/dist/types.backup/server/context.d.ts +0 -494
  487. package/dist/types.backup/server/cookie-parse.d.ts +0 -10
  488. package/dist/types.backup/server/cookie-store.d.ts +0 -107
  489. package/dist/types.backup/server/fetchable-loader-store.d.ts +0 -20
  490. package/dist/types.backup/server/handle-store.d.ts +0 -100
  491. package/dist/types.backup/server/loader-registry.d.ts +0 -32
  492. package/dist/types.backup/server/request-context.d.ts +0 -596
  493. package/dist/types.backup/server/root-layout.d.ts +0 -3
  494. package/dist/types.backup/server.d.ts +0 -15
  495. package/dist/types.backup/ssr/index.d.ts +0 -233
  496. package/dist/types.backup/ssr/inject-rsc-eager.d.ts +0 -3
  497. package/dist/types.backup/ssr/preinit-client-references.d.ts +0 -71
  498. package/dist/types.backup/ssr/ssr-root.d.ts +0 -69
  499. package/dist/types.backup/static-handler.d.ts +0 -57
  500. package/dist/types.backup/testing/cache-status.d.ts +0 -63
  501. package/dist/types.backup/testing/collect-handle.d.ts +0 -20
  502. package/dist/types.backup/testing/dispatch.d.ts +0 -123
  503. package/dist/types.backup/testing/dom.entry.d.ts +0 -15
  504. package/dist/types.backup/testing/e2e/fixture.d.ts +0 -37
  505. package/dist/types.backup/testing/e2e/index.d.ts +0 -30
  506. package/dist/types.backup/testing/e2e/matchers.d.ts +0 -17
  507. package/dist/types.backup/testing/e2e/page-helpers.d.ts +0 -62
  508. package/dist/types.backup/testing/e2e/parity.d.ts +0 -111
  509. package/dist/types.backup/testing/e2e/server.d.ts +0 -35
  510. package/dist/types.backup/testing/flight-matchers.d.ts +0 -55
  511. package/dist/types.backup/testing/flight-normalize.d.ts +0 -1
  512. package/dist/types.backup/testing/flight-tree.d.ts +0 -192
  513. package/dist/types.backup/testing/flight.d.ts +0 -115
  514. package/dist/types.backup/testing/flight.entry.d.ts +0 -27
  515. package/dist/types.backup/testing/generated-routes.d.ts +0 -66
  516. package/dist/types.backup/testing/index.d.ts +0 -52
  517. package/dist/types.backup/testing/internal/context.d.ts +0 -225
  518. package/dist/types.backup/testing/internal/flight-client-globals.d.ts +0 -1
  519. package/dist/types.backup/testing/internal/seed-vars.d.ts +0 -30
  520. package/dist/types.backup/testing/render-handler.d.ts +0 -160
  521. package/dist/types.backup/testing/render-route.d.ts +0 -246
  522. package/dist/types.backup/testing/run-loader.d.ts +0 -186
  523. package/dist/types.backup/testing/run-middleware.d.ts +0 -132
  524. package/dist/types.backup/testing/run-transition-when.d.ts +0 -77
  525. package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +0 -6
  526. package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +0 -13
  527. package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +0 -7
  528. package/dist/types.backup/testing/vitest-stubs/version.d.ts +0 -1
  529. package/dist/types.backup/testing/vitest.d.ts +0 -205
  530. package/dist/types.backup/theme/ThemeProvider.d.ts +0 -13
  531. package/dist/types.backup/theme/ThemeScript.d.ts +0 -45
  532. package/dist/types.backup/theme/constants.d.ts +0 -39
  533. package/dist/types.backup/theme/index.d.ts +0 -29
  534. package/dist/types.backup/theme/theme-context.d.ts +0 -21
  535. package/dist/types.backup/theme/theme-script.d.ts +0 -26
  536. package/dist/types.backup/theme/types.d.ts +0 -162
  537. package/dist/types.backup/theme/use-theme.d.ts +0 -8
  538. package/dist/types.backup/types/boundaries.d.ts +0 -93
  539. package/dist/types.backup/types/cache-types.d.ts +0 -191
  540. package/dist/types.backup/types/error-types.d.ts +0 -114
  541. package/dist/types.backup/types/global-namespace.d.ts +0 -90
  542. package/dist/types.backup/types/handler-context.d.ts +0 -658
  543. package/dist/types.backup/types/index.d.ts +0 -11
  544. package/dist/types.backup/types/loader-types.d.ts +0 -182
  545. package/dist/types.backup/types/request-scope.d.ts +0 -93
  546. package/dist/types.backup/types/route-config.d.ts +0 -105
  547. package/dist/types.backup/types/route-entry.d.ts +0 -95
  548. package/dist/types.backup/types/segments.d.ts +0 -234
  549. package/dist/types.backup/types.d.ts +0 -1
  550. package/dist/types.backup/urls/include-helper.d.ts +0 -17
  551. package/dist/types.backup/urls/include-provider.d.ts +0 -27
  552. package/dist/types.backup/urls/index.d.ts +0 -6
  553. package/dist/types.backup/urls/path-helper-types.d.ts +0 -197
  554. package/dist/types.backup/urls/path-helper.d.ts +0 -12
  555. package/dist/types.backup/urls/pattern-types.d.ts +0 -166
  556. package/dist/types.backup/urls/response-types.d.ts +0 -67
  557. package/dist/types.backup/urls/type-extraction.d.ts +0 -157
  558. package/dist/types.backup/urls/urls-function.d.ts +0 -24
  559. package/dist/types.backup/urls.d.ts +0 -1
  560. package/dist/types.backup/use-loader.d.ts +0 -150
  561. package/dist/types.backup/vercel/index.d.ts +0 -10
  562. package/dist/types.backup/vercel/tracing.d.ts +0 -70
  563. package/dist/types.backup/vite/debug.d.ts +0 -80
  564. package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +0 -12
  565. package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +0 -65
  566. package/dist/types.backup/vite/discovery/discover-routers.d.ts +0 -17
  567. package/dist/types.backup/vite/discovery/discovery-errors.d.ts +0 -113
  568. package/dist/types.backup/vite/discovery/gate-state.d.ts +0 -79
  569. package/dist/types.backup/vite/discovery/prerender-collection.d.ts +0 -24
  570. package/dist/types.backup/vite/discovery/route-types-writer.d.ts +0 -32
  571. package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +0 -22
  572. package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +0 -40
  573. package/dist/types.backup/vite/discovery/state.d.ts +0 -162
  574. package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +0 -15
  575. package/dist/types.backup/vite/index.d.ts +0 -11
  576. package/dist/types.backup/vite/inject-client-debug.d.ts +0 -56
  577. package/dist/types.backup/vite/plugin-types.d.ts +0 -298
  578. package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +0 -6
  579. package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +0 -40
  580. package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +0 -35
  581. package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +0 -64
  582. package/dist/types.backup/vite/plugins/expose-action-id.d.ts +0 -18
  583. package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +0 -37
  584. package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +0 -19
  585. package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +0 -10
  586. package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +0 -8
  587. package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +0 -13
  588. package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +0 -29
  589. package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +0 -6
  590. package/dist/types.backup/vite/plugins/performance-tracks.d.ts +0 -25
  591. package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +0 -20
  592. package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +0 -20
  593. package/dist/types.backup/vite/plugins/vercel-output.d.ts +0 -85
  594. package/dist/types.backup/vite/plugins/version-injector.d.ts +0 -21
  595. package/dist/types.backup/vite/plugins/version-plugin.d.ts +0 -19
  596. package/dist/types.backup/vite/plugins/virtual-entries.d.ts +0 -36
  597. package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +0 -7
  598. package/dist/types.backup/vite/rango.d.ts +0 -29
  599. package/dist/types.backup/vite/router-discovery.d.ts +0 -23
  600. package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +0 -64
  601. package/dist/types.backup/vite/utils/banner.d.ts +0 -2
  602. package/dist/types.backup/vite/utils/bundle-analysis.d.ts +0 -28
  603. package/dist/types.backup/vite/utils/client-chunks.d.ts +0 -55
  604. package/dist/types.backup/vite/utils/directive-prologue.d.ts +0 -16
  605. package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +0 -37
  606. package/dist/types.backup/vite/utils/manifest-utils.d.ts +0 -7
  607. package/dist/types.backup/vite/utils/package-resolution.d.ts +0 -6
  608. package/dist/types.backup/vite/utils/prerender-utils.d.ts +0 -32
  609. package/dist/types.backup/vite/utils/shared-utils.d.ts +0 -55
@@ -2,6 +2,7 @@ import type { ComponentType } from "react";
2
2
  import type { SerializedManifest } from "../debug.js";
3
3
  import type { ReverseFunction } from "../reverse.js";
4
4
  import type { UrlPatterns } from "../urls.js";
5
+ import type { ClientUrlPatterns } from "../client-urls/types.js";
5
6
  import type { UrlBuilder, EnvCompatible } from "../urls/pattern-types.js";
6
7
  import type { EntryData } from "../server/context";
7
8
  import type { ErrorInfo, MatchResult } from "../types";
@@ -27,6 +28,11 @@ export interface RouterRequestInput<TEnv, TVars = DefaultVars> {
27
28
  vars?: Partial<TVars>;
28
29
  ctx?: ExecutionContext;
29
30
  }
31
+ /** One materialized UrlPatterns registration and its live router mount index. */
32
+ export interface UrlPatternMount<TEnv = any> {
33
+ readonly patterns: UrlPatterns<TEnv, any>;
34
+ readonly mountIndex: number;
35
+ }
30
36
  /**
31
37
  * Merge route patterns with response types into a single route map.
32
38
  * Routes with response types get { path, response } objects; others stay as strings.
@@ -79,6 +85,12 @@ export interface Rango<TEnv = any, TRoutes extends Record<string, unknown> = Rec
79
85
  * ```
80
86
  */
81
87
  routes<T extends UrlPatterns<any, any, any>>(patterns: T & EnvCompatible<T, TEnv>): Rango<TEnv, TRoutes & (NonNullable<T["_routes"]> extends Record<string, unknown> ? MergeRoutesWithResponses<NonNullable<T["_routes"]>, T["_responses"]> : Record<string, string>)>;
88
+ /**
89
+ * Pure-client mounting shorthand: normalizes to a root include in the
90
+ * canonical urls() tree (`include("/", definition, { name: "" })`) — same
91
+ * lazy materialization as mounting through include() yourself.
92
+ */
93
+ routes<T extends ClientUrlPatterns<any>>(patterns: T): Rango<TEnv, TRoutes & (NonNullable<T["_routes"]> extends Record<string, unknown> ? NonNullable<T["_routes"]> : Record<string, string>)>;
82
94
  routes(builder: UrlBuilder<TEnv>): Rango<TEnv, TRoutes>;
83
95
  /**
84
96
  * Add global middleware that runs on all routes
@@ -184,7 +196,15 @@ export interface RangoInternal<TEnv = any, TRoutes extends Record<string, unknow
184
196
  * `urls<{ DB }>()` cannot be mounted on a `createRouter<{}>()`.
185
197
  */
186
198
  routes<T extends UrlPatterns<any, any, any>>(patterns: T & EnvCompatible<T, TEnv>): Rango<TEnv, TRoutes & (NonNullable<T["_routes"]> extends Record<string, unknown> ? MergeRoutesWithResponses<NonNullable<T["_routes"]>, T["_responses"]> : Record<string, string>)>;
199
+ /**
200
+ * Pure-client mounting shorthand: normalizes to a root include in the
201
+ * canonical urls() tree (`include("/", definition, { name: "" })`) — same
202
+ * lazy materialization as mounting through include() yourself.
203
+ */
204
+ routes<T extends ClientUrlPatterns<any>>(patterns: T): Rango<TEnv, TRoutes & (NonNullable<T["_routes"]> extends Record<string, unknown> ? NonNullable<T["_routes"]> : Record<string, string>)>;
187
205
  routes(builder: UrlBuilder<TEnv>): Rango<TEnv, TRoutes>;
206
+ /** Materialized UrlPatterns registrations in registration order. */
207
+ readonly __urlpatternMounts: readonly UrlPatternMount<TEnv>[];
188
208
  /**
189
209
  * Add global middleware that runs on all routes
190
210
  */
@@ -7,7 +7,7 @@
7
7
  * - Layout handler resolution with static fallback
8
8
  * - Error boundary segment creation
9
9
  */
10
- import { type ReactNode } from "react";
10
+ import type { ReactNode } from "react";
11
11
  import type { EntryData } from "../../server/context";
12
12
  import type { ResolvedSegment, HandlerContext } from "../../types";
13
13
  import type { SegmentResolutionDeps } from "../types.js";
@@ -4,7 +4,7 @@
4
4
  * Walks the pre-built trie by path segments in O(path_length) time.
5
5
  * Falls back to null when no match is found (caller uses regex fallback).
6
6
  */
7
- import type { TrieNode, NegotiateVariant } from "../build/route-trie.js";
7
+ import type { TrieNode, NegotiateVariant } from "./route-trie-builder.js";
8
8
  export interface TrieMatchResult {
9
9
  /** Route name */
10
10
  routeKey: string;
@@ -6,6 +6,7 @@
6
6
  import type { RequestContext } from "../server/request-context.js";
7
7
  import type { MiddlewareEntry, MiddlewareFn } from "../router/middleware.js";
8
8
  import type { RscPayload } from "./types.js";
9
+ import type { HandlerContext } from "./handler-context.js";
9
10
  /**
10
11
  * Drain ctx._onResponseCallbacks onto a response. Swapping the array before
11
12
  * iteration prevents re-entrant registrations from double-firing and matches
@@ -122,3 +123,5 @@ export declare function mergeStubHeadersAndFinalize(response: Response): Respons
122
123
  * but still need ctx.onResponse() callbacks to fire.
123
124
  */
124
125
  export declare function finalizeResponse(response: Response): Response;
126
+ /** Match and stamp params/routeName on the request context as one operation. */
127
+ export declare function matchAndRecordParams<TEnv>(ctx: HandlerContext<TEnv>, request: Request, env: TEnv): Promise<Awaited<ReturnType<HandlerContext<TEnv>["router"]["match"]>>>;
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Router Manifest Initialization
3
3
  *
4
- * Builds a fresh route trie from router.urlpatterns for dev/HMR scenarios
5
- * where the manifest exists but the trie needs rebuilding.
4
+ * Builds a fresh route trie from every registered URL-pattern mount for
5
+ * dev/HMR scenarios where the manifest exists but the trie needs rebuilding.
6
6
  */
7
7
  /**
8
- * Build a fresh route trie from router.urlpatterns and store it in the
9
- * per-router cache. Also sets the per-router manifest and merges into
10
- * the global manifest for reverse()/href().
8
+ * Build a fresh route trie from the router's URL-pattern mounts and store it in
9
+ * the per-router cache. Also sets the per-router manifest and merges into the
10
+ * global manifest for reverse()/href().
11
11
  *
12
12
  * Called when manifest data may exist but the per-router trie is missing,
13
13
  * which happens in dev mode after HMR: the virtual module sets the manifest
@@ -2,6 +2,7 @@ import type { TraceSpan } from "../router/tracing.js";
2
2
  import type { RenderMode, RenderPhase } from "../router/timeout.js";
3
3
  import type { HandlerContext } from "./handler-context.js";
4
4
  import type { RscPayload } from "./types.js";
5
+ import type { RoutineTrace } from "./routine-plan.js";
5
6
  export type RscRenderMode = RenderMode;
6
7
  export type RscRenderPhase = RenderPhase;
7
8
  export interface RscRenderStageProgress {
@@ -135,5 +136,13 @@ export declare function renderRscResponse<TEnv>(input: RscRenderInput<TEnv>, opt
135
136
  * Standard responses use renderRscResponse so the driver owns every phase.
136
137
  */
137
138
  export declare function renderRscFlightStage<TEnv>(input: RscFlightStageInput<TEnv>, init?: ResponseInit): RscFlightStage;
139
+ /**
140
+ * Feed this driver's stage events (flight/html/response) into a routine flow
141
+ * trace as child entries of the currently running plan step. Stages are
142
+ * strictly sequential, so one `current` slot suffices. Depth is captured at
143
+ * creation: the bridge is built while the caller's render step executes, so
144
+ * children sit one level under it.
145
+ */
146
+ export declare function createRenderStageTraceBridge(trace: RoutineTrace): (event: RscRenderStageEvent) => void;
138
147
  export declare function createRscStageDebugSink(log?: (message: string, details?: Record<string, unknown>) => void): (event: RscRenderStageEvent) => void;
139
148
  export {};
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Routine plans — the request-level extension of the render stage driver
3
+ * (docs/design/routine-plans.md; protocol lineage in render-stage-driver.md).
4
+ * A plan is a synchronous generator that EMITS instructions before their work
5
+ * runs; the runner is the only code that executes them. Two effect shapes:
6
+ *
7
+ * step(name, fn) — sequential work; the plan suspends until its result.
8
+ * handoff(name, fn) — background registration (waitUntil-shaped); completes
9
+ * at scheduling and returns nothing.
10
+ *
11
+ * Plans compose by level: `yield* scope(name, plan)` flattens a nested plan
12
+ * into the same instruction stream while the trace records the scope. Tracking
13
+ * is derived, not declared — "what is running" is the instruction in hand.
14
+ *
15
+ * Deliberate boundaries (see the design doc's "Not built yet, on purpose"):
16
+ * the runner opens no observability spans — effects own their own
17
+ * instrumentation, and the render driver keeps PHASES.ssr — and there is no
18
+ * plan.return abort/cleanup path; the render driver's cleanup rules are the
19
+ * template if a caller ever needs one.
20
+ */
21
+ export type RoutineEffectKind = "step" | "handoff";
22
+ export type RoutineCommand = {
23
+ kind: "step";
24
+ name: string;
25
+ execute: () => unknown;
26
+ } | {
27
+ kind: "handoff";
28
+ name: string;
29
+ execute: () => unknown;
30
+ } | {
31
+ kind: "enter";
32
+ name: string;
33
+ } | {
34
+ kind: "exit";
35
+ outcome: "done" | "failed";
36
+ error?: unknown;
37
+ };
38
+ export type RoutineCommandResult = {
39
+ kind: "step";
40
+ value: unknown;
41
+ } | {
42
+ kind: "handoff";
43
+ } | {
44
+ kind: "enter";
45
+ } | {
46
+ kind: "exit";
47
+ };
48
+ /** One imperative step: yields a command, returns its typed result. */
49
+ export type RoutineStep<T> = Generator<RoutineCommand, T, RoutineCommandResult>;
50
+ /** A full plan is shaped like a step; the alias marks intent at call sites. */
51
+ export type RoutinePlan<TReturn> = RoutineStep<TReturn>;
52
+ /**
53
+ * Sequential work. The `as Awaited<T>` narrow is the trust boundary with the
54
+ * runner, which resumes with the exact value `execute` produced.
55
+ */
56
+ export declare function step<T>(name: string, execute: () => T | Promise<T>): RoutineStep<Awaited<T>>;
57
+ /**
58
+ * Background handoff: successful registration completes the foreground step.
59
+ * A synchronous registration failure is thrown back into the plan, matching a
60
+ * direct waitUntil/scheduler call. A returned promise settles in the background;
61
+ * its rejection marks the trace but never fails the foreground response.
62
+ *
63
+ * Settlement tracking follows the RETURNED value: a returned promise is
64
+ * observed until it settles; a scheduler that fires-and-forgets internally
65
+ * (e.g. scheduleShellCapture via runBackground) returns void, so its trace
66
+ * entry settles at the scheduling call, not at background completion. That is
67
+ * deliberate — the plan's contract ends at the handoff.
68
+ */
69
+ export declare function handoff(name: string, execute: () => unknown): RoutineStep<void>;
70
+ /**
71
+ * Run a nested plan as a named scope. `yield*` flattens its instructions into
72
+ * the parent stream; enter/exit only inform the trace. The scope reports its
73
+ * terminal outcome after internal recovery has either succeeded or escaped.
74
+ */
75
+ export declare function scope<TReturn>(name: string, plan: RoutinePlan<TReturn>): RoutineStep<TReturn>;
76
+ export interface RoutineTraceEntry {
77
+ name: string;
78
+ kind: RoutineEffectKind | "scope";
79
+ depth: number;
80
+ /** step/scope: running -> done|failed. handoff: pending -> settled|failed. */
81
+ state: "running" | "pending" | "done" | "settled" | "failed";
82
+ startedAt: number;
83
+ endedAt?: number;
84
+ settledAt?: number;
85
+ error?: unknown;
86
+ }
87
+ export interface RoutineTrace {
88
+ readonly name: string;
89
+ readonly entries: readonly RoutineTraceEntry[];
90
+ enterScope(name: string): void;
91
+ exitScope(outcome: "done" | "failed", error?: unknown): void;
92
+ /** Scope depth entries currently record at. Bridges (e.g. render stage
93
+ * events feeding child entries under a running step) capture this once and
94
+ * pass `depth + 1` explicitly. */
95
+ currentDepth(): number;
96
+ begin(name: string, kind: RoutineEffectKind, depth?: number): RoutineTraceEntry;
97
+ end(entry: RoutineTraceEntry): void;
98
+ fail(entry: RoutineTraceEntry, error: unknown): void;
99
+ settle(entry: RoutineTraceEntry, outcome: {
100
+ status: "fulfilled";
101
+ } | {
102
+ status: "rejected";
103
+ error: unknown;
104
+ }): void;
105
+ /** Running scopes plus the foreground instruction currently in hand. */
106
+ active(): RoutineTraceEntry[];
107
+ format(): string;
108
+ formatActive(entries?: readonly RoutineTraceEntry[], activeAt?: number): string;
109
+ }
110
+ export declare function createRoutineTrace(name: string, now?: () => number): RoutineTrace;
111
+ export interface RoutineTraceOwner {
112
+ _activeRoutine?: RoutineTrace;
113
+ }
114
+ export interface RoutineRunnerOptions {
115
+ trace?: RoutineTrace;
116
+ owner?: RoutineTraceOwner;
117
+ }
118
+ /**
119
+ * Interpret a plan. Invariants shared with driveRscRenderPlan: a command is
120
+ * observable before its work runs, `execute` runs exactly once, results and
121
+ * errors resume the plan with exact identity, and a plan-level try/catch
122
+ * around a step is the recovery mechanism.
123
+ */
124
+ export declare function runRoutine<TReturn>(plan: RoutinePlan<TReturn>, options?: RoutineRunnerOptions): Promise<TReturn>;
@@ -25,3 +25,20 @@
25
25
  * docs/design/ppr-shell-resume.md (Cost model).
26
26
  */
27
27
  export declare const SHELL_CAPTURE_MAX_WAIT_MS = 15000;
28
+ /**
29
+ * Hard cap on one capture TASK — runShellCapture end to end (both attempts +
30
+ * the in-place retry delay). SHELL_CAPTURE_MAX_WAIT_MS arms only inside
31
+ * captureShellHTML, AFTER the capture's router.match(); a handler wedged on a
32
+ * never-settling upstream await (autobarn pilot: a 30s+ tarpitting fetch)
33
+ * wedges the task with no deadline in force. The task's settle path releases
34
+ * the per-key stampede guard and the serialized capture-queue slot, so an
35
+ * unbounded task strands BOTH for the isolate's lifetime.
36
+ *
37
+ * 25s: above one full-budget attempt plus overhead (cutting a second attempt
38
+ * short is an acceptable loss — every terminal path backs the key off anyway),
39
+ * and below workerd's ~30s waitUntil grace so the cap timer still fires in a
40
+ * live context. When workerd kills the context BEFORE the cap fires, the timer
41
+ * dies with it — that stranding is healed by scheduleShellCapture's staleness
42
+ * check on the stampede guard, keyed off the same constant.
43
+ */
44
+ export declare const SHELL_CAPTURE_TASK_HARD_CAP_MS = 25000;
@@ -273,6 +273,15 @@ export declare function gateFlightForCapture(source: ReadableStream<Uint8Array>,
273
273
  */
274
274
  export interface ShellCaptureDescriptor {
275
275
  key: string;
276
+ /**
277
+ * The key's search portion (shellSearchSeed: `?`-prefixed sorted search,
278
+ * cache.searchParams filter applied, or ""). Seeds the capture render's SSR
279
+ * store so static-part `useSearchParams` reads bake markup consistent with
280
+ * the shell's own key; the resume pass derives the identical string from
281
+ * the HIT request. Computed next to the key so the two cannot drift.
282
+ * Omitted (build-time bare-pathname captures) = search-less, same as "".
283
+ */
284
+ searchSeed?: string;
276
285
  /**
277
286
  * The RSC handler's build version (HandlerContext.version), stamped into the
278
287
  * stored entry as ShellCacheEntry.buildVersion — the serve-side
@@ -94,6 +94,17 @@ export declare function resolvePprConfig(entry: EntryData | undefined | null): R
94
94
  * and lookup makes every shell request a permanent miss.
95
95
  */
96
96
  export declare function buildShellKey(url: URL, filter?: SearchParamsFilter): string;
97
+ /**
98
+ * The shell key's search portion (`?`-prefixed sorted search with the
99
+ * cache.searchParams filter applied, or "") — ALSO the string the capture and
100
+ * resume SSR renders seed their store location with (SSRRenderOptions.search
101
+ * / ShellCaptureOptions.search / ShellResumeOptions.search). Search is part
102
+ * of shell identity, so static-part `useSearchParams` reads render exactly
103
+ * what the key names; deriving seed and key from this one helper is what
104
+ * keeps capture, resume, and lookup byte-agreed (drift = replay mismatch or
105
+ * permanent MISS).
106
+ */
107
+ export declare function shellSearchSeed(url: URL, filter?: SearchParamsFilter): string;
97
108
  /**
98
109
  * Version gates for a stored shell: reactVersion AND buildVersion must both
99
110
  * match the running server. The postponed blob encodes hole positions against
@@ -33,12 +33,29 @@ export interface RscPayload {
33
33
  /** Merged route params from the matched route */
34
34
  params?: Record<string, string>;
35
35
  slots?: Record<string, SlotState>;
36
+ /**
37
+ * Intercept TARGET route names reachable from this location as a
38
+ * navigation origin (see MatchResult.interceptTargets). The browser-local
39
+ * clientUrls matcher declines optimistic presentation for these.
40
+ */
41
+ interceptTargets?: string[];
36
42
  /** Root layout component for browser-side re-renders (client component reference) */
37
43
  rootLayout?: React.ComponentType<{
38
44
  children: React.ReactNode;
39
45
  }>;
40
46
  /** Handle data accumulated across route segments (async generator that yields on each push) */
41
47
  handles?: AsyncGenerator<HandleData, void, unknown>;
48
+ /**
49
+ * Document-lane late handle channel: full-state updates for pushes landing
50
+ * AFTER the handler barrier (streaming loader bodies writing handles
51
+ * mid-body). `handles` above is drained to completion in blocking
52
+ * positions (SSR seed, pre-hydration), so late pushes need this separate
53
+ * generator, consumed non-blocking post-hydration (rsc-router.tsx).
54
+ * Empty/instantly-complete when no auxiliary-lane work is pending at the
55
+ * handler barrier. Full payloads only — partial payloads' `handles`
56
+ * generator streams to full settle already.
57
+ */
58
+ handlesLate?: AsyncGenerator<HandleData, void, unknown>;
42
59
  /** RSC version string for cache invalidation */
43
60
  version?: string;
44
61
  /** Cloudflare dev worker generation used for stale-document convergence. */
@@ -147,6 +164,17 @@ export interface SSRRenderOptions {
147
164
  * - `"allReady"` — await `stream.allReady` before returning.
148
165
  */
149
166
  streamMode?: import("../router/router-options.js").SSRStreamMode;
167
+ /**
168
+ * The live request's query string (`url.search`, `?`-prefixed or empty).
169
+ * Seeds the SSR navigation store so `useSearchParams` (and
170
+ * `useNavigation().location`) carry real values during document renders.
171
+ * Out-of-band by design — never payload metadata, which cached/prerendered
172
+ * payloads replay; search is not route identity. The build-time prerender
173
+ * pass passes none — build shells capture bare pathnames and serve
174
+ * search-less requests only (runtime ppr captures seed the shell key's
175
+ * search; see ShellCaptureOptions.search in the SSR entry).
176
+ */
177
+ search?: string;
150
178
  }
151
179
  /**
152
180
  * SSR module interface for HTML rendering
@@ -164,6 +192,7 @@ export interface SSRModule {
164
192
  captureShellHTML?: (rscStream: ReadableStream<Uint8Array>, options: {
165
193
  quiesce: Promise<void>;
166
194
  maxWaitMs?: number;
195
+ search?: string;
167
196
  }) => Promise<{
168
197
  prelude: Uint8Array;
169
198
  postponed: string | null;
@@ -179,6 +208,7 @@ export interface SSRModule {
179
208
  resumeShellHTML?: (rscStream: ReadableStream<Uint8Array>, options: {
180
209
  postponed: string | null;
181
210
  nonce?: string;
211
+ search?: string;
182
212
  }) => Promise<ReadableStream<Uint8Array>>;
183
213
  }
184
214
  /**
@@ -17,6 +17,8 @@ export interface RenderSegmentsOptions {
17
17
  * from cache without showing loading skeletons.
18
18
  */
19
19
  forceAwait?: boolean;
20
+ /** Seeded descendant client-route pending state for testing. */
21
+ outletPending?: boolean;
20
22
  /**
21
23
  * Intercept segments to inject into the tree.
22
24
  * These are parallel segments from intercept routes that need to be
@@ -82,6 +82,16 @@ export type LoaderEntry = {
82
82
  revalidate: ShouldRevalidateFn<any, any>[];
83
83
  /** Cache config for this specific loader (loaders are NOT cached by default) */
84
84
  cache?: EntryCacheConfig;
85
+ /**
86
+ * Document renders await this loader before segment resolution returns
87
+ * (loader(Def, { stream: "navigation" })), so its data, handle pushes, and
88
+ * thrown notFound()/redirect() deterministically precede first flush.
89
+ * Resolved at DSL-evaluation time from ctx.isSSR — entries are cached
90
+ * per-isSSR (router/manifest.ts cache key), so the flag is already
91
+ * request-mode-correct when resolveLoaders (fresh.ts) reads it and never
92
+ * appears on navigation-lane entries.
93
+ */
94
+ awaitBeforeFlush?: true;
85
95
  };
86
96
  /**
87
97
  * Segments state for intercept context
@@ -49,6 +49,24 @@ export interface HandleStore {
49
49
  * to onError and telemetry.
50
50
  */
51
51
  onError?: (error: Error) => void;
52
+ /**
53
+ * Track a promise on the AUXILIARY (loader) settlement lane. Aux tracking
54
+ * keeps the store OPEN for pushes (a mid-body `ctx.handle(H)(...)` from a
55
+ * streaming loader is legal until this lane drains) WITHOUT joining
56
+ * `settled` — the handler barrier that rendered()-readers, the document
57
+ * handle snapshot, and prerender/cache collection wait on. Two lanes exist
58
+ * because loader bodies stream: joining them to `settled` would block SSR
59
+ * markup and hydration on the slowest loader (ssr-root.tsx and
60
+ * rsc-router.tsx both drain the document handle stream in blocking
61
+ * positions), and would self-deadlock any loader awaiting ctx.rendered().
62
+ */
63
+ trackAuxiliary<T>(promise: Promise<T>): Promise<T>;
64
+ /**
65
+ * Promise that resolves when the store is sealed AND BOTH lanes (handler +
66
+ * auxiliary) have drained. Late-push legality and default stream completion
67
+ * key on this, not on `settled`.
68
+ */
69
+ readonly fullySettled: Promise<void>;
52
70
  /**
53
71
  * Push handle data for a specific handle and segment.
54
72
  * Multiple pushes to the same handle/segment accumulate in an array.
@@ -57,15 +75,28 @@ export interface HandleStore {
57
75
  push(handleName: string, segmentId: string, data: unknown): void;
58
76
  /**
59
77
  * Get all collected handle data after all handlers have settled.
60
- * Waits for `settled`, then returns the finalized data.
78
+ * Waits for `settled` (handler lane), then returns the data at that point.
61
79
  */
62
80
  getData(): Promise<HandleData>;
63
81
  /**
64
82
  * Get an async iterator that yields handle data on each push.
65
- * The iterator completes when all handlers have settled.
83
+ * Completes at the chosen settlement barrier: "fullySettled" (default —
84
+ * nav/action payloads, whose consumer applies each yield progressively) or
85
+ * "settled" (the document lane, whose consumers drain to completion in
86
+ * blocking positions and must not wait on loader bodies).
66
87
  * Each yield contains the full accumulated state (not just the delta).
88
+ * Safe for concurrent consumers (per-consumer version cursor).
89
+ */
90
+ stream(until?: "settled" | "fullySettled"): AsyncGenerator<HandleData, void, unknown>;
91
+ /**
92
+ * Document-lane late channel: yields full-state updates for pushes that
93
+ * land AFTER the handler barrier (streaming loader bodies), completing at
94
+ * fullySettled. Returns without yielding when the auxiliary lane is empty
95
+ * by the time `settled` resolves. The client consumes this post-hydration
96
+ * (rsc-router.tsx) and merges via the same application path as nav-lane
97
+ * progressive handle updates.
67
98
  */
68
- stream(): AsyncGenerator<HandleData, void, unknown>;
99
+ streamLate(): AsyncGenerator<HandleData, void, unknown>;
69
100
  /**
70
101
  * Get handle data for a specific segment (for caching).
71
102
  * Returns data in format: { handleName: [values...] }
@@ -26,6 +26,7 @@ import type { TransitionWhenFn } from "../types/segments.js";
26
26
  import type { ResolvedTracing } from "../router/tracing.js";
27
27
  import type { RenderMode, RenderPhase } from "../router/timeout.js";
28
28
  import type { LocationStateEntry } from "../browser/react/location-state-shared.js";
29
+ import type { RoutineTrace } from "../rsc/routine-plan.js";
29
30
  export interface RenderForegroundCursor {
30
31
  mode: RenderMode;
31
32
  phase: RenderPhase;
@@ -506,6 +507,16 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
506
507
  * rendered() and a handler already awaits it, we can detect the deadlock.
507
508
  */
508
509
  _handlerLoaderDeps?: Set<string>;
510
+ /**
511
+ * @internal Loader IDs ($$id) whose entries carry `awaitBeforeFlush`
512
+ * (loader(Def, { stream: "navigation" })): segment resolution awaits these
513
+ * before returning, so the render barrier cannot resolve until they settle.
514
+ * rendered() checks this set to fail fast — a flagged loader awaiting the
515
+ * barrier is a guaranteed cycle, not a race. Registered by resolveLoaders
516
+ * (fresh.ts) before loader kickoff; only ever populated on document renders
517
+ * (the flag is stamped per-isSSR at DSL evaluation).
518
+ */
519
+ _awaitBeforeFlushLoaderIds?: Set<string>;
509
520
  /**
510
521
  * @internal Cached HandleData snapshot built at barrier resolution time.
511
522
  * Avoids rebuilding the snapshot on every loader ctx.use(handle) call.
@@ -542,6 +553,8 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
542
553
  * loaders and post-commit stream work have separate lifetimes.
543
554
  */
544
555
  _renderForeground?: RenderForegroundCursor;
556
+ /** @internal Request routine currently executing, used by timeout diagnostics. */
557
+ _activeRoutine?: RoutineTrace;
545
558
  /** @internal Keep the render cursor active for timeout support. */
546
559
  _renderDiagnosticsEnabled?: boolean;
547
560
  /**
@@ -585,7 +598,7 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
585
598
  * This is the type exported to library consumers. Internal code should
586
599
  * use the full RequestContext interface directly.
587
600
  */
588
- export type PublicRequestContext<TEnv = DefaultEnv, TParams = Record<string, string>> = Omit<RequestContext<TEnv, TParams>, "cookie" | "cookies" | "setCookie" | "deleteCookie" | "_handleStore" | "_transitionWhen" | "_pprTransitionDecisions" | "_pprReplayPostMatchReason" | "_cacheStore" | "_searchParamsFilter" | "_shellCaptureRun" | "_shellImplicitCache" | "_shellLoaderSeed" | "_shellCaptureLoaderRecords" | "_shellCaptureHandleLiveness" | "_shellCaptureLoaderHandleValues" | "_shellFragmentPayload" | "_shellCaptureGuardTripped" | "_shellCaptureGuardTrippedLoaderId" | "_explicitTaggedStores" | "_requestTags" | "_cacheProfiles" | "_onResponseCallbacks" | "_pendingBackgroundTasks" | "_themeConfig" | "_locationState" | "_routeName" | "_prevRouteKey" | "_gateCurrentUrl" | "_gateCurrentParams" | "_gateActionId" | "_gateActionUrl" | "_gateActionResult" | "_gateFormData" | "_inActionRevalidation" | "_reportedErrors" | "_renderBarrier" | "_resolveRenderBarrier" | "_renderBarrierSegmentOrder" | "_treeHasStreaming" | "_renderBarrierWaiters" | "_handlerLoaderDeps" | "_renderBarrierHandleSnapshot" | "_renderBarrierGuardClosed" | "_reportBackgroundError" | "_debugPerformance" | "_metricsStore" | "_renderForeground" | "_renderDiagnosticsEnabled" | "_handlerStart" | "_tracing" | "_basename" | "_routerId" | "_setStatus" | "_rotateStateCookie" | "_setKeepCacheDirective" | "_variables" | "_classifiedRoute" | "_requestMode" | "_cacheSignal" | "_dynamic" | "res">;
601
+ export type PublicRequestContext<TEnv = DefaultEnv, TParams = Record<string, string>> = Omit<RequestContext<TEnv, TParams>, "cookie" | "cookies" | "setCookie" | "deleteCookie" | "_handleStore" | "_transitionWhen" | "_pprTransitionDecisions" | "_pprReplayPostMatchReason" | "_cacheStore" | "_searchParamsFilter" | "_shellCaptureRun" | "_shellImplicitCache" | "_shellLoaderSeed" | "_shellCaptureLoaderRecords" | "_shellCaptureHandleLiveness" | "_shellCaptureLoaderHandleValues" | "_shellFragmentPayload" | "_shellCaptureGuardTripped" | "_shellCaptureGuardTrippedLoaderId" | "_explicitTaggedStores" | "_requestTags" | "_cacheProfiles" | "_onResponseCallbacks" | "_pendingBackgroundTasks" | "_themeConfig" | "_locationState" | "_routeName" | "_prevRouteKey" | "_gateCurrentUrl" | "_gateCurrentParams" | "_gateActionId" | "_gateActionUrl" | "_gateActionResult" | "_gateFormData" | "_inActionRevalidation" | "_reportedErrors" | "_renderBarrier" | "_resolveRenderBarrier" | "_renderBarrierSegmentOrder" | "_treeHasStreaming" | "_renderBarrierWaiters" | "_handlerLoaderDeps" | "_awaitBeforeFlushLoaderIds" | "_renderBarrierHandleSnapshot" | "_renderBarrierGuardClosed" | "_reportBackgroundError" | "_debugPerformance" | "_metricsStore" | "_renderForeground" | "_activeRoutine" | "_renderDiagnosticsEnabled" | "_handlerStart" | "_tracing" | "_basename" | "_routerId" | "_setStatus" | "_rotateStateCookie" | "_setKeepCacheDirective" | "_variables" | "_classifiedRoute" | "_requestMode" | "_cacheSignal" | "_dynamic" | "res">;
589
602
  /**
590
603
  * Marker for a waitUntil-scheduled fn whose task promise must NOT enter
591
604
  * _pendingBackgroundTasks. Used by the PPR shell capture for its own task:
@@ -13,3 +13,4 @@ export { registerRouteMap, setCachedManifest, clearCachedManifest, clearAllRoute
13
13
  export { registerLoaderById, setLoaderImports, } from "./server/loader-registry.js";
14
14
  export { createRequestContext, type CreateRequestContextOptions, } from "./server/request-context.js";
15
15
  export { isClientComponent, assertClientComponent } from "./component-utils.js";
16
+ export { clearClientUrlProjections, setClientUrlProjection, type ClientUrlProjection, } from "./client-urls/server-projection.js";
@@ -82,6 +82,14 @@ export interface SSRRenderOptions {
82
82
  * - `"allReady"` — await `stream.allReady` before returning.
83
83
  */
84
84
  streamMode?: import("../router/router-options.js").SSRStreamMode;
85
+ /**
86
+ * The live request's query string (`?`-prefixed or empty). Seeds the SSR
87
+ * navigation store location so `useSearchParams` carries real values
88
+ * during document renders. Absent on the build-time prerender pass —
89
+ * build shells capture bare pathnames and serve search-less requests
90
+ * only (runtime captures own the search variants, seeded per key).
91
+ */
92
+ search?: string;
85
93
  }
86
94
  /**
87
95
  * SSR dependencies from external packages
@@ -169,6 +177,13 @@ interface ShellCaptureOptions {
169
177
  quiesce: Promise<void>;
170
178
  /** Upper bound on how long to wait for `quiesce`. Default SHELL_CAPTURE_MAX_WAIT_MS. */
171
179
  maxWaitMs?: number;
180
+ /**
181
+ * The SHELL KEY's search string (`?`-prefixed, sorted, cache.searchParams
182
+ * filter applied — shellSearchSeed in rsc/shell-serve.ts), seeding the SSR
183
+ * store so static-part `useSearchParams` reads bake markup consistent with
184
+ * the shell's own key. MUST equal the resume pass's seed for the same key.
185
+ */
186
+ search?: string;
172
187
  }
173
188
  /**
174
189
  * Result of a successful shell capture. `prelude` is the raw prelude bytes;
@@ -188,6 +203,13 @@ interface ShellResumeOptions {
188
203
  postponed: string | null;
189
204
  /** Nonce for CSP. */
190
205
  nonce?: string;
206
+ /**
207
+ * The SHELL KEY's search string — same derivation as the capture pass
208
+ * (shellSearchSeed). A HIT shares the capture's key, so seeding the same
209
+ * string keeps the resume tree identical to the captured tree above the
210
+ * postponed holes.
211
+ */
212
+ search?: string;
191
213
  }
192
214
  /**
193
215
  * Create an SSR handler that converts RSC streams to HTML.
@@ -48,6 +48,16 @@ export interface SsrRootOptions {
48
48
  * they postpone below the root.
49
49
  */
50
50
  onPayloadSettled?: () => void;
51
+ /**
52
+ * The query string seeding the SSR store location (`?`-prefixed or
53
+ * empty), so `useSearchParams`/`useNavigation` carry real values during
54
+ * document renders. Live fizz passes the request's raw search. The shell
55
+ * capture and resume passes pass the SHELL KEY's search (sorted,
56
+ * cache.searchParams filter applied — search is part of shell identity):
57
+ * a HIT shares the capture's key, so both passes seed the SAME string and
58
+ * the resume tree matches the captured tree above the postponed holes.
59
+ */
60
+ search?: string;
51
61
  }
52
62
  /**
53
63
  * Build the closure component that deserializes the Flight payload, consumes
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Component-render testing: `renderRoute`, the React-Testing-Library-style stub
5
5
  * for client components that read router context (useParams / useReverse /
6
- * Outlet / useNavigation / useLoader).
6
+ * Outlet / useOutlet / useNavigation / useLoader).
7
7
  *
8
8
  * Separate from the main `@rangojs/router/testing` barrel so unit suites that
9
9
  * only test loaders, middleware, or `dispatch` never reference React, the
@@ -19,18 +19,19 @@
19
19
  * props crossing the RSC boundary), loader execution on the server,
20
20
  * middleware, or handler ordering. Those are renderServerTree / renderHandler
21
21
  * / e2e territory.
22
- * - Loader data, location state, and handle output are SEEDED directly into
23
- * client context (see the `loaders` / `locationState` / `handles` options) —
24
- * nothing is executed on the server. This exercises the read path
25
- * (useLoader / useLocationState / useHandle from context), not the run path.
22
+ * - Loader data, location state, handle output, and outlet pending state are
23
+ * SEEDED directly into client context (see the `loaders` / `locationState` /
24
+ * `handles` / `outletPending` options) — nothing is executed on the server.
25
+ * This exercises the context read path, not the run path.
26
26
  * - navigate() commits synchronously, so it does NOT drive the navigation
27
27
  * lifecycle: useNavigation().state, useLinkStatus().pending, and
28
28
  * useAction().state stay "idle". Assert pending/loading/submitting transition
29
29
  * states with renderServerTree / e2e instead (navigate() warns once if used).
30
30
  * What it DOES cover: client hooks that read NavigationProvider /
31
31
  * OutletContext — useParams, useReverse, useHref, useMount, useNavigation,
32
- * useRouter, usePathname, useSearchParams, Outlet nesting, useLoader /
33
- * useFetchLoader (seeded data), useLocationState (seeded), and useHandle (seeded).
32
+ * useRouter, usePathname, useSearchParams, Outlet/useOutlet nesting and seeded
33
+ * descendant pending state, useLoader/useFetchLoader (seeded data),
34
+ * useLocationState (seeded), and useHandle (seeded).
34
35
  * Basename-mounted apps: pass the `basename` option so useRouter().basename,
35
36
  * <Link> prefixing, and useMount/useHref resolve against the mount prefix
36
37
  * (without it they resolve at the root "/"). For an include("/shop", ...)
@@ -96,6 +97,15 @@ export interface RenderRouteOptions {
96
97
  * the read path is exercised without executing any loader.
97
98
  */
98
99
  loaderData?: Record<string, unknown>;
100
+ /**
101
+ * Descendant client-route pending state to seed into each synthetic segment's
102
+ * production OutletProvider, so `useOutlet().pending` can be tested alongside
103
+ * `useOutlet().content`. Defaults to false.
104
+ *
105
+ * This is a seeded outlet-context value only. It does not model arbitrary
106
+ * Suspense, navigation, or action pending state.
107
+ */
108
+ outletPending?: boolean;
99
109
  /**
100
110
  * Loaders to seed by REFERENCE — the robust way to test a component that calls
101
111
  * `useLoader(loader)`. A real `createLoader()` handle has an empty `$$id` in a