@rangojs/router 0.0.0-experimental.f2337aef → 0.0.0-experimental.f2d1a2f1

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 (972) hide show
  1. package/README.md +126 -38
  2. package/dist/bin/rango.js +138 -50
  3. package/dist/vite/index.js +1183 -461
  4. package/dist/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
  5. package/package.json +7 -5
  6. package/skills/breadcrumbs/SKILL.md +3 -1
  7. package/skills/cache-guide/SKILL.md +32 -0
  8. package/skills/caching/SKILL.md +45 -4
  9. package/skills/handler-use/SKILL.md +362 -0
  10. package/skills/hooks/SKILL.md +28 -20
  11. package/skills/intercept/SKILL.md +20 -0
  12. package/skills/layout/SKILL.md +22 -0
  13. package/skills/links/SKILL.md +91 -17
  14. package/skills/loader/SKILL.md +88 -45
  15. package/skills/middleware/SKILL.md +34 -3
  16. package/skills/migrate-nextjs/SKILL.md +560 -0
  17. package/skills/migrate-react-router/SKILL.md +765 -0
  18. package/skills/parallel/SKILL.md +185 -0
  19. package/skills/prerender/SKILL.md +110 -68
  20. package/skills/rango/SKILL.md +24 -22
  21. package/skills/response-routes/SKILL.md +8 -0
  22. package/skills/route/SKILL.md +55 -0
  23. package/skills/router-setup/SKILL.md +87 -2
  24. package/skills/streams-and-websockets/SKILL.md +283 -0
  25. package/skills/typesafety/SKILL.md +13 -1
  26. package/src/__internal.ts +1 -1
  27. package/src/browser/app-shell.ts +52 -0
  28. package/src/browser/app-version.ts +14 -0
  29. package/src/browser/event-controller.ts +5 -0
  30. package/src/browser/navigation-bridge.ts +88 -9
  31. package/src/browser/navigation-client.ts +167 -59
  32. package/src/browser/navigation-store.ts +68 -9
  33. package/src/browser/navigation-transaction.ts +11 -9
  34. package/src/browser/partial-update.ts +109 -15
  35. package/src/browser/prefetch/cache.ts +175 -15
  36. package/src/browser/prefetch/fetch.ts +180 -33
  37. package/src/browser/prefetch/queue.ts +123 -20
  38. package/src/browser/prefetch/resource-ready.ts +77 -0
  39. package/src/browser/rango-state.ts +53 -13
  40. package/src/browser/react/Link.tsx +81 -9
  41. package/src/browser/react/NavigationProvider.tsx +89 -14
  42. package/src/browser/react/context.ts +7 -2
  43. package/src/browser/react/use-handle.ts +9 -58
  44. package/src/browser/react/use-navigation.ts +22 -2
  45. package/src/browser/react/use-params.ts +11 -1
  46. package/src/browser/react/use-router.ts +29 -9
  47. package/src/browser/rsc-router.tsx +168 -65
  48. package/src/browser/scroll-restoration.ts +30 -15
  49. package/src/browser/segment-reconciler.ts +36 -9
  50. package/src/browser/server-action-bridge.ts +8 -6
  51. package/src/browser/types.ts +49 -5
  52. package/src/build/generate-manifest.ts +6 -6
  53. package/src/build/generate-route-types.ts +3 -0
  54. package/src/build/route-trie.ts +50 -24
  55. package/src/build/route-types/include-resolution.ts +8 -1
  56. package/src/build/route-types/router-processing.ts +223 -74
  57. package/src/build/route-types/scan-filter.ts +8 -1
  58. package/src/cache/cache-runtime.ts +15 -11
  59. package/src/cache/cache-scope.ts +48 -7
  60. package/src/cache/cf/cf-cache-store.ts +455 -15
  61. package/src/cache/cf/index.ts +5 -1
  62. package/src/cache/document-cache.ts +17 -7
  63. package/src/cache/index.ts +1 -0
  64. package/src/cache/taint.ts +55 -0
  65. package/src/client.tsx +84 -230
  66. package/src/context-var.ts +72 -2
  67. package/src/debug.ts +2 -2
  68. package/src/handle.ts +40 -0
  69. package/src/index.rsc.ts +6 -1
  70. package/src/index.ts +49 -6
  71. package/src/outlet-context.ts +1 -1
  72. package/src/prerender/store.ts +5 -4
  73. package/src/prerender.ts +138 -77
  74. package/src/response-utils.ts +28 -0
  75. package/src/reverse.ts +27 -2
  76. package/src/route-definition/dsl-helpers.ts +240 -40
  77. package/src/route-definition/helpers-types.ts +67 -19
  78. package/src/route-definition/index.ts +3 -0
  79. package/src/route-definition/redirect.ts +11 -3
  80. package/src/route-definition/resolve-handler-use.ts +155 -0
  81. package/src/route-types.ts +18 -0
  82. package/src/router/content-negotiation.ts +100 -1
  83. package/src/router/handler-context.ts +101 -25
  84. package/src/router/intercept-resolution.ts +9 -4
  85. package/src/router/lazy-includes.ts +10 -7
  86. package/src/router/loader-resolution.ts +159 -21
  87. package/src/router/logging.ts +1 -1
  88. package/src/router/manifest.ts +31 -16
  89. package/src/router/match-api.ts +127 -192
  90. package/src/router/match-middleware/background-revalidation.ts +30 -2
  91. package/src/router/match-middleware/cache-lookup.ts +94 -17
  92. package/src/router/match-middleware/cache-store.ts +53 -10
  93. package/src/router/match-middleware/intercept-resolution.ts +9 -7
  94. package/src/router/match-middleware/segment-resolution.ts +60 -5
  95. package/src/router/match-result.ts +104 -10
  96. package/src/router/metrics.ts +6 -1
  97. package/src/router/middleware-types.ts +8 -30
  98. package/src/router/middleware.ts +36 -10
  99. package/src/router/navigation-snapshot.ts +182 -0
  100. package/src/router/pattern-matching.ts +60 -9
  101. package/src/router/prerender-match.ts +110 -10
  102. package/src/router/preview-match.ts +30 -102
  103. package/src/router/request-classification.ts +310 -0
  104. package/src/router/route-snapshot.ts +245 -0
  105. package/src/router/router-context.ts +1 -0
  106. package/src/router/router-interfaces.ts +36 -4
  107. package/src/router/router-options.ts +37 -11
  108. package/src/router/segment-resolution/fresh.ts +198 -20
  109. package/src/router/segment-resolution/helpers.ts +29 -24
  110. package/src/router/segment-resolution/loader-cache.ts +1 -0
  111. package/src/router/segment-resolution/revalidation.ts +433 -296
  112. package/src/router/trie-matching.ts +10 -4
  113. package/src/router/types.ts +1 -0
  114. package/src/router/url-params.ts +49 -0
  115. package/src/router.ts +60 -8
  116. package/src/rsc/handler.ts +478 -374
  117. package/src/rsc/helpers.ts +69 -41
  118. package/src/rsc/loader-fetch.ts +23 -3
  119. package/src/rsc/manifest-init.ts +5 -1
  120. package/src/rsc/progressive-enhancement.ts +16 -2
  121. package/src/rsc/response-route-handler.ts +14 -1
  122. package/src/rsc/rsc-rendering.ts +17 -1
  123. package/src/rsc/server-action.ts +10 -0
  124. package/src/rsc/ssr-setup.ts +2 -2
  125. package/src/rsc/types.ts +9 -1
  126. package/src/segment-content-promise.ts +67 -0
  127. package/src/segment-loader-promise.ts +122 -0
  128. package/src/segment-system.tsx +109 -23
  129. package/src/server/context.ts +166 -17
  130. package/src/server/handle-store.ts +19 -0
  131. package/src/server/loader-registry.ts +9 -8
  132. package/src/server/request-context.ts +194 -60
  133. package/src/ssr/index.tsx +4 -0
  134. package/src/static-handler.ts +18 -6
  135. package/src/types/cache-types.ts +4 -4
  136. package/src/types/handler-context.ts +137 -65
  137. package/src/types/loader-types.ts +41 -15
  138. package/src/types/request-scope.ts +126 -0
  139. package/src/types/route-entry.ts +19 -1
  140. package/src/types/segments.ts +2 -0
  141. package/src/urls/include-helper.ts +24 -14
  142. package/src/urls/path-helper-types.ts +39 -6
  143. package/src/urls/path-helper.ts +48 -13
  144. package/src/urls/pattern-types.ts +12 -0
  145. package/src/urls/response-types.ts +18 -16
  146. package/src/use-loader.tsx +77 -5
  147. package/src/vite/debug.ts +86 -0
  148. package/src/vite/discovery/bundle-postprocess.ts +30 -33
  149. package/src/vite/discovery/discover-routers.ts +5 -1
  150. package/src/vite/discovery/prerender-collection.ts +128 -74
  151. package/src/vite/discovery/state.ts +13 -6
  152. package/src/vite/index.ts +4 -0
  153. package/src/vite/plugin-types.ts +51 -79
  154. package/src/vite/plugins/cloudflare-protocol-loader-hook.d.mts +23 -0
  155. package/src/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
  156. package/src/vite/plugins/cloudflare-protocol-stub.ts +214 -0
  157. package/src/vite/plugins/expose-action-id.ts +1 -3
  158. package/src/vite/plugins/expose-id-utils.ts +12 -0
  159. package/src/vite/plugins/expose-ids/handler-transform.ts +30 -0
  160. package/src/vite/plugins/expose-internal-ids.ts +257 -40
  161. package/src/vite/plugins/performance-tracks.ts +86 -0
  162. package/src/vite/plugins/refresh-cmd.ts +88 -26
  163. package/src/vite/plugins/version-plugin.ts +13 -1
  164. package/src/vite/rango.ts +204 -217
  165. package/src/vite/router-discovery.ts +335 -64
  166. package/src/vite/utils/banner.ts +4 -4
  167. package/src/vite/utils/package-resolution.ts +41 -1
  168. package/src/vite/utils/prerender-utils.ts +37 -5
  169. package/src/vite/utils/shared-utils.ts +3 -2
  170. package/dist/__internal.d.ts +0 -83
  171. package/dist/__internal.d.ts.map +0 -1
  172. package/dist/__internal.js +0 -19
  173. package/dist/__internal.js.map +0 -1
  174. package/dist/__mocks__/version.d.ts +0 -7
  175. package/dist/__mocks__/version.d.ts.map +0 -1
  176. package/dist/__mocks__/version.js +0 -7
  177. package/dist/__mocks__/version.js.map +0 -1
  178. package/dist/__tests__/client-href.test.d.ts +0 -2
  179. package/dist/__tests__/client-href.test.d.ts.map +0 -1
  180. package/dist/__tests__/client-href.test.js +0 -74
  181. package/dist/__tests__/client-href.test.js.map +0 -1
  182. package/dist/__tests__/component-utils.test.d.ts +0 -2
  183. package/dist/__tests__/component-utils.test.d.ts.map +0 -1
  184. package/dist/__tests__/component-utils.test.js +0 -51
  185. package/dist/__tests__/component-utils.test.js.map +0 -1
  186. package/dist/__tests__/event-controller.test.d.ts +0 -2
  187. package/dist/__tests__/event-controller.test.d.ts.map +0 -1
  188. package/dist/__tests__/event-controller.test.js +0 -538
  189. package/dist/__tests__/event-controller.test.js.map +0 -1
  190. package/dist/__tests__/helpers/route-tree.d.ts +0 -118
  191. package/dist/__tests__/helpers/route-tree.d.ts.map +0 -1
  192. package/dist/__tests__/helpers/route-tree.js +0 -374
  193. package/dist/__tests__/helpers/route-tree.js.map +0 -1
  194. package/dist/__tests__/match-result.test.d.ts +0 -2
  195. package/dist/__tests__/match-result.test.d.ts.map +0 -1
  196. package/dist/__tests__/match-result.test.js +0 -154
  197. package/dist/__tests__/match-result.test.js.map +0 -1
  198. package/dist/__tests__/navigation-store.test.d.ts +0 -2
  199. package/dist/__tests__/navigation-store.test.d.ts.map +0 -1
  200. package/dist/__tests__/navigation-store.test.js +0 -440
  201. package/dist/__tests__/navigation-store.test.js.map +0 -1
  202. package/dist/__tests__/partial-update.test.d.ts +0 -2
  203. package/dist/__tests__/partial-update.test.d.ts.map +0 -1
  204. package/dist/__tests__/partial-update.test.js +0 -1009
  205. package/dist/__tests__/partial-update.test.js.map +0 -1
  206. package/dist/__tests__/reverse-types.test.d.ts +0 -8
  207. package/dist/__tests__/reverse-types.test.d.ts.map +0 -1
  208. package/dist/__tests__/reverse-types.test.js +0 -656
  209. package/dist/__tests__/reverse-types.test.js.map +0 -1
  210. package/dist/__tests__/route-definition.test.d.ts +0 -2
  211. package/dist/__tests__/route-definition.test.d.ts.map +0 -1
  212. package/dist/__tests__/route-definition.test.js +0 -55
  213. package/dist/__tests__/route-definition.test.js.map +0 -1
  214. package/dist/__tests__/router-helpers.test.d.ts +0 -2
  215. package/dist/__tests__/router-helpers.test.d.ts.map +0 -1
  216. package/dist/__tests__/router-helpers.test.js +0 -377
  217. package/dist/__tests__/router-helpers.test.js.map +0 -1
  218. package/dist/__tests__/router-integration-2.test.d.ts +0 -2
  219. package/dist/__tests__/router-integration-2.test.d.ts.map +0 -1
  220. package/dist/__tests__/router-integration-2.test.js +0 -426
  221. package/dist/__tests__/router-integration-2.test.js.map +0 -1
  222. package/dist/__tests__/router-integration.test.d.ts +0 -2
  223. package/dist/__tests__/router-integration.test.d.ts.map +0 -1
  224. package/dist/__tests__/router-integration.test.js +0 -1051
  225. package/dist/__tests__/router-integration.test.js.map +0 -1
  226. package/dist/__tests__/search-params.test.d.ts +0 -5
  227. package/dist/__tests__/search-params.test.d.ts.map +0 -1
  228. package/dist/__tests__/search-params.test.js +0 -306
  229. package/dist/__tests__/search-params.test.js.map +0 -1
  230. package/dist/__tests__/segment-system.test.d.ts +0 -2
  231. package/dist/__tests__/segment-system.test.d.ts.map +0 -1
  232. package/dist/__tests__/segment-system.test.js +0 -627
  233. package/dist/__tests__/segment-system.test.js.map +0 -1
  234. package/dist/__tests__/static-handler-types.test.d.ts +0 -8
  235. package/dist/__tests__/static-handler-types.test.d.ts.map +0 -1
  236. package/dist/__tests__/static-handler-types.test.js +0 -63
  237. package/dist/__tests__/static-handler-types.test.js.map +0 -1
  238. package/dist/__tests__/urls.test.d.ts +0 -2
  239. package/dist/__tests__/urls.test.d.ts.map +0 -1
  240. package/dist/__tests__/urls.test.js +0 -421
  241. package/dist/__tests__/urls.test.js.map +0 -1
  242. package/dist/__tests__/use-mount.test.d.ts +0 -2
  243. package/dist/__tests__/use-mount.test.d.ts.map +0 -1
  244. package/dist/__tests__/use-mount.test.js +0 -35
  245. package/dist/__tests__/use-mount.test.js.map +0 -1
  246. package/dist/bin/rango.d.ts +0 -2
  247. package/dist/bin/rango.d.ts.map +0 -1
  248. package/dist/bin/rango.js.map +0 -1
  249. package/dist/browser/event-controller.d.ts +0 -191
  250. package/dist/browser/event-controller.d.ts.map +0 -1
  251. package/dist/browser/event-controller.js +0 -559
  252. package/dist/browser/event-controller.js.map +0 -1
  253. package/dist/browser/index.d.ts +0 -2
  254. package/dist/browser/index.d.ts.map +0 -1
  255. package/dist/browser/index.js +0 -14
  256. package/dist/browser/index.js.map +0 -1
  257. package/dist/browser/link-interceptor.d.ts +0 -38
  258. package/dist/browser/link-interceptor.d.ts.map +0 -1
  259. package/dist/browser/link-interceptor.js +0 -99
  260. package/dist/browser/link-interceptor.js.map +0 -1
  261. package/dist/browser/logging.d.ts +0 -10
  262. package/dist/browser/logging.d.ts.map +0 -1
  263. package/dist/browser/logging.js +0 -29
  264. package/dist/browser/logging.js.map +0 -1
  265. package/dist/browser/lru-cache.d.ts +0 -17
  266. package/dist/browser/lru-cache.d.ts.map +0 -1
  267. package/dist/browser/lru-cache.js +0 -50
  268. package/dist/browser/lru-cache.js.map +0 -1
  269. package/dist/browser/merge-segment-loaders.d.ts +0 -39
  270. package/dist/browser/merge-segment-loaders.d.ts.map +0 -1
  271. package/dist/browser/merge-segment-loaders.js +0 -102
  272. package/dist/browser/merge-segment-loaders.js.map +0 -1
  273. package/dist/browser/navigation-bridge.d.ts +0 -102
  274. package/dist/browser/navigation-bridge.d.ts.map +0 -1
  275. package/dist/browser/navigation-bridge.js +0 -708
  276. package/dist/browser/navigation-bridge.js.map +0 -1
  277. package/dist/browser/navigation-client.d.ts +0 -25
  278. package/dist/browser/navigation-client.d.ts.map +0 -1
  279. package/dist/browser/navigation-client.js +0 -157
  280. package/dist/browser/navigation-client.js.map +0 -1
  281. package/dist/browser/navigation-store.d.ts +0 -101
  282. package/dist/browser/navigation-store.d.ts.map +0 -1
  283. package/dist/browser/navigation-store.js +0 -625
  284. package/dist/browser/navigation-store.js.map +0 -1
  285. package/dist/browser/partial-update.d.ts +0 -75
  286. package/dist/browser/partial-update.d.ts.map +0 -1
  287. package/dist/browser/partial-update.js +0 -426
  288. package/dist/browser/partial-update.js.map +0 -1
  289. package/dist/browser/react/Link.d.ts +0 -86
  290. package/dist/browser/react/Link.d.ts.map +0 -1
  291. package/dist/browser/react/Link.js +0 -128
  292. package/dist/browser/react/Link.js.map +0 -1
  293. package/dist/browser/react/NavigationProvider.d.ts +0 -63
  294. package/dist/browser/react/NavigationProvider.d.ts.map +0 -1
  295. package/dist/browser/react/NavigationProvider.js +0 -216
  296. package/dist/browser/react/NavigationProvider.js.map +0 -1
  297. package/dist/browser/react/ScrollRestoration.d.ts +0 -75
  298. package/dist/browser/react/ScrollRestoration.d.ts.map +0 -1
  299. package/dist/browser/react/ScrollRestoration.js +0 -57
  300. package/dist/browser/react/ScrollRestoration.js.map +0 -1
  301. package/dist/browser/react/context.d.ts +0 -46
  302. package/dist/browser/react/context.d.ts.map +0 -1
  303. package/dist/browser/react/context.js +0 -10
  304. package/dist/browser/react/context.js.map +0 -1
  305. package/dist/browser/react/index.d.ts +0 -11
  306. package/dist/browser/react/index.d.ts.map +0 -1
  307. package/dist/browser/react/index.js +0 -22
  308. package/dist/browser/react/index.js.map +0 -1
  309. package/dist/browser/react/location-state-shared.d.ts +0 -63
  310. package/dist/browser/react/location-state-shared.d.ts.map +0 -1
  311. package/dist/browser/react/location-state-shared.js +0 -81
  312. package/dist/browser/react/location-state-shared.js.map +0 -1
  313. package/dist/browser/react/location-state.d.ts +0 -23
  314. package/dist/browser/react/location-state.d.ts.map +0 -1
  315. package/dist/browser/react/location-state.js +0 -29
  316. package/dist/browser/react/location-state.js.map +0 -1
  317. package/dist/browser/react/mount-context.d.ts +0 -24
  318. package/dist/browser/react/mount-context.d.ts.map +0 -1
  319. package/dist/browser/react/mount-context.js +0 -24
  320. package/dist/browser/react/mount-context.js.map +0 -1
  321. package/dist/browser/react/use-action.d.ts +0 -64
  322. package/dist/browser/react/use-action.d.ts.map +0 -1
  323. package/dist/browser/react/use-action.js +0 -134
  324. package/dist/browser/react/use-action.js.map +0 -1
  325. package/dist/browser/react/use-client-cache.d.ts +0 -41
  326. package/dist/browser/react/use-client-cache.d.ts.map +0 -1
  327. package/dist/browser/react/use-client-cache.js +0 -39
  328. package/dist/browser/react/use-client-cache.js.map +0 -1
  329. package/dist/browser/react/use-handle.d.ts +0 -31
  330. package/dist/browser/react/use-handle.d.ts.map +0 -1
  331. package/dist/browser/react/use-handle.js +0 -144
  332. package/dist/browser/react/use-handle.js.map +0 -1
  333. package/dist/browser/react/use-href.d.ts +0 -33
  334. package/dist/browser/react/use-href.d.ts.map +0 -1
  335. package/dist/browser/react/use-href.js +0 -39
  336. package/dist/browser/react/use-href.js.map +0 -1
  337. package/dist/browser/react/use-link-status.d.ts +0 -37
  338. package/dist/browser/react/use-link-status.d.ts.map +0 -1
  339. package/dist/browser/react/use-link-status.js +0 -99
  340. package/dist/browser/react/use-link-status.js.map +0 -1
  341. package/dist/browser/react/use-mount.d.ts +0 -25
  342. package/dist/browser/react/use-mount.d.ts.map +0 -1
  343. package/dist/browser/react/use-mount.js +0 -30
  344. package/dist/browser/react/use-mount.js.map +0 -1
  345. package/dist/browser/react/use-navigation.d.ts +0 -27
  346. package/dist/browser/react/use-navigation.d.ts.map +0 -1
  347. package/dist/browser/react/use-navigation.js +0 -87
  348. package/dist/browser/react/use-navigation.js.map +0 -1
  349. package/dist/browser/react/use-segments.d.ts +0 -38
  350. package/dist/browser/react/use-segments.d.ts.map +0 -1
  351. package/dist/browser/react/use-segments.js +0 -130
  352. package/dist/browser/react/use-segments.js.map +0 -1
  353. package/dist/browser/request-controller.d.ts +0 -26
  354. package/dist/browser/request-controller.d.ts.map +0 -1
  355. package/dist/browser/request-controller.js +0 -147
  356. package/dist/browser/request-controller.js.map +0 -1
  357. package/dist/browser/rsc-router.d.ts +0 -129
  358. package/dist/browser/rsc-router.d.ts.map +0 -1
  359. package/dist/browser/rsc-router.js +0 -195
  360. package/dist/browser/rsc-router.js.map +0 -1
  361. package/dist/browser/scroll-restoration.d.ts +0 -93
  362. package/dist/browser/scroll-restoration.d.ts.map +0 -1
  363. package/dist/browser/scroll-restoration.js +0 -321
  364. package/dist/browser/scroll-restoration.js.map +0 -1
  365. package/dist/browser/segment-structure-assert.d.ts +0 -17
  366. package/dist/browser/segment-structure-assert.d.ts.map +0 -1
  367. package/dist/browser/segment-structure-assert.js +0 -59
  368. package/dist/browser/segment-structure-assert.js.map +0 -1
  369. package/dist/browser/server-action-bridge.d.ts +0 -26
  370. package/dist/browser/server-action-bridge.d.ts.map +0 -1
  371. package/dist/browser/server-action-bridge.js +0 -668
  372. package/dist/browser/server-action-bridge.js.map +0 -1
  373. package/dist/browser/shallow.d.ts +0 -12
  374. package/dist/browser/shallow.d.ts.map +0 -1
  375. package/dist/browser/shallow.js +0 -34
  376. package/dist/browser/shallow.js.map +0 -1
  377. package/dist/browser/types.d.ts +0 -369
  378. package/dist/browser/types.d.ts.map +0 -1
  379. package/dist/browser/types.js +0 -2
  380. package/dist/browser/types.js.map +0 -1
  381. package/dist/build/__tests__/generate-cli.test.d.ts +0 -2
  382. package/dist/build/__tests__/generate-cli.test.d.ts.map +0 -1
  383. package/dist/build/__tests__/generate-cli.test.js +0 -237
  384. package/dist/build/__tests__/generate-cli.test.js.map +0 -1
  385. package/dist/build/__tests__/generate-manifest.test.d.ts +0 -2
  386. package/dist/build/__tests__/generate-manifest.test.d.ts.map +0 -1
  387. package/dist/build/__tests__/generate-manifest.test.js +0 -119
  388. package/dist/build/__tests__/generate-manifest.test.js.map +0 -1
  389. package/dist/build/__tests__/generate-route-types.test.d.ts +0 -2
  390. package/dist/build/__tests__/generate-route-types.test.d.ts.map +0 -1
  391. package/dist/build/__tests__/generate-route-types.test.js +0 -620
  392. package/dist/build/__tests__/generate-route-types.test.js.map +0 -1
  393. package/dist/build/__tests__/per-router-manifest.test.d.ts +0 -2
  394. package/dist/build/__tests__/per-router-manifest.test.d.ts.map +0 -1
  395. package/dist/build/__tests__/per-router-manifest.test.js +0 -308
  396. package/dist/build/__tests__/per-router-manifest.test.js.map +0 -1
  397. package/dist/build/generate-manifest.d.ts +0 -81
  398. package/dist/build/generate-manifest.d.ts.map +0 -1
  399. package/dist/build/generate-manifest.js +0 -276
  400. package/dist/build/generate-manifest.js.map +0 -1
  401. package/dist/build/generate-route-types.d.ts +0 -115
  402. package/dist/build/generate-route-types.d.ts.map +0 -1
  403. package/dist/build/generate-route-types.js +0 -740
  404. package/dist/build/generate-route-types.js.map +0 -1
  405. package/dist/build/index.d.ts +0 -21
  406. package/dist/build/index.d.ts.map +0 -1
  407. package/dist/build/index.js +0 -21
  408. package/dist/build/index.js.map +0 -1
  409. package/dist/build/route-trie.d.ts +0 -71
  410. package/dist/build/route-trie.d.ts.map +0 -1
  411. package/dist/build/route-trie.js +0 -175
  412. package/dist/build/route-trie.js.map +0 -1
  413. package/dist/cache/__tests__/cache-scope.test.d.ts +0 -2
  414. package/dist/cache/__tests__/cache-scope.test.d.ts.map +0 -1
  415. package/dist/cache/__tests__/cache-scope.test.js +0 -208
  416. package/dist/cache/__tests__/cache-scope.test.js.map +0 -1
  417. package/dist/cache/__tests__/document-cache.test.d.ts +0 -2
  418. package/dist/cache/__tests__/document-cache.test.d.ts.map +0 -1
  419. package/dist/cache/__tests__/document-cache.test.js +0 -345
  420. package/dist/cache/__tests__/document-cache.test.js.map +0 -1
  421. package/dist/cache/__tests__/memory-segment-store.test.d.ts +0 -2
  422. package/dist/cache/__tests__/memory-segment-store.test.d.ts.map +0 -1
  423. package/dist/cache/__tests__/memory-segment-store.test.js +0 -425
  424. package/dist/cache/__tests__/memory-segment-store.test.js.map +0 -1
  425. package/dist/cache/__tests__/memory-store.test.d.ts +0 -2
  426. package/dist/cache/__tests__/memory-store.test.d.ts.map +0 -1
  427. package/dist/cache/__tests__/memory-store.test.js +0 -367
  428. package/dist/cache/__tests__/memory-store.test.js.map +0 -1
  429. package/dist/cache/cache-scope.d.ts +0 -102
  430. package/dist/cache/cache-scope.d.ts.map +0 -1
  431. package/dist/cache/cache-scope.js +0 -440
  432. package/dist/cache/cache-scope.js.map +0 -1
  433. package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts +0 -2
  434. package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts.map +0 -1
  435. package/dist/cache/cf/__tests__/cf-cache-store.test.js +0 -330
  436. package/dist/cache/cf/__tests__/cf-cache-store.test.js.map +0 -1
  437. package/dist/cache/cf/cf-cache-store.d.ts +0 -165
  438. package/dist/cache/cf/cf-cache-store.d.ts.map +0 -1
  439. package/dist/cache/cf/cf-cache-store.js +0 -242
  440. package/dist/cache/cf/cf-cache-store.js.map +0 -1
  441. package/dist/cache/cf/index.d.ts +0 -14
  442. package/dist/cache/cf/index.d.ts.map +0 -1
  443. package/dist/cache/cf/index.js +0 -17
  444. package/dist/cache/cf/index.js.map +0 -1
  445. package/dist/cache/document-cache.d.ts +0 -64
  446. package/dist/cache/document-cache.d.ts.map +0 -1
  447. package/dist/cache/document-cache.js +0 -228
  448. package/dist/cache/document-cache.js.map +0 -1
  449. package/dist/cache/index.d.ts +0 -19
  450. package/dist/cache/index.d.ts.map +0 -1
  451. package/dist/cache/index.js +0 -21
  452. package/dist/cache/index.js.map +0 -1
  453. package/dist/cache/memory-segment-store.d.ts +0 -110
  454. package/dist/cache/memory-segment-store.d.ts.map +0 -1
  455. package/dist/cache/memory-segment-store.js +0 -117
  456. package/dist/cache/memory-segment-store.js.map +0 -1
  457. package/dist/cache/memory-store.d.ts +0 -41
  458. package/dist/cache/memory-store.d.ts.map +0 -1
  459. package/dist/cache/memory-store.js +0 -191
  460. package/dist/cache/memory-store.js.map +0 -1
  461. package/dist/cache/types.d.ts +0 -317
  462. package/dist/cache/types.d.ts.map +0 -1
  463. package/dist/cache/types.js +0 -12
  464. package/dist/cache/types.js.map +0 -1
  465. package/dist/client.d.ts +0 -248
  466. package/dist/client.d.ts.map +0 -1
  467. package/dist/client.js +0 -367
  468. package/dist/client.js.map +0 -1
  469. package/dist/client.rsc.d.ts +0 -26
  470. package/dist/client.rsc.d.ts.map +0 -1
  471. package/dist/client.rsc.js +0 -46
  472. package/dist/client.rsc.js.map +0 -1
  473. package/dist/component-utils.d.ts +0 -36
  474. package/dist/component-utils.d.ts.map +0 -1
  475. package/dist/component-utils.js +0 -61
  476. package/dist/component-utils.js.map +0 -1
  477. package/dist/components/DefaultDocument.d.ts +0 -13
  478. package/dist/components/DefaultDocument.d.ts.map +0 -1
  479. package/dist/components/DefaultDocument.js +0 -15
  480. package/dist/components/DefaultDocument.js.map +0 -1
  481. package/dist/debug.d.ts +0 -58
  482. package/dist/debug.d.ts.map +0 -1
  483. package/dist/debug.js +0 -157
  484. package/dist/debug.js.map +0 -1
  485. package/dist/default-error-boundary.d.ts +0 -11
  486. package/dist/default-error-boundary.d.ts.map +0 -1
  487. package/dist/default-error-boundary.js +0 -45
  488. package/dist/default-error-boundary.js.map +0 -1
  489. package/dist/deps/browser.d.ts +0 -2
  490. package/dist/deps/browser.d.ts.map +0 -1
  491. package/dist/deps/browser.js +0 -3
  492. package/dist/deps/browser.js.map +0 -1
  493. package/dist/deps/html-stream-client.d.ts +0 -2
  494. package/dist/deps/html-stream-client.d.ts.map +0 -1
  495. package/dist/deps/html-stream-client.js +0 -3
  496. package/dist/deps/html-stream-client.js.map +0 -1
  497. package/dist/deps/html-stream-server.d.ts +0 -2
  498. package/dist/deps/html-stream-server.d.ts.map +0 -1
  499. package/dist/deps/html-stream-server.js +0 -3
  500. package/dist/deps/html-stream-server.js.map +0 -1
  501. package/dist/deps/rsc.d.ts +0 -2
  502. package/dist/deps/rsc.d.ts.map +0 -1
  503. package/dist/deps/rsc.js +0 -4
  504. package/dist/deps/rsc.js.map +0 -1
  505. package/dist/deps/ssr.d.ts +0 -2
  506. package/dist/deps/ssr.d.ts.map +0 -1
  507. package/dist/deps/ssr.js +0 -3
  508. package/dist/deps/ssr.js.map +0 -1
  509. package/dist/errors.d.ts +0 -174
  510. package/dist/errors.d.ts.map +0 -1
  511. package/dist/errors.js +0 -241
  512. package/dist/errors.js.map +0 -1
  513. package/dist/handle.d.ts +0 -78
  514. package/dist/handle.d.ts.map +0 -1
  515. package/dist/handle.js +0 -82
  516. package/dist/handle.js.map +0 -1
  517. package/dist/handles/MetaTags.d.ts +0 -14
  518. package/dist/handles/MetaTags.d.ts.map +0 -1
  519. package/dist/handles/MetaTags.js +0 -136
  520. package/dist/handles/MetaTags.js.map +0 -1
  521. package/dist/handles/index.d.ts +0 -6
  522. package/dist/handles/index.d.ts.map +0 -1
  523. package/dist/handles/index.js +0 -6
  524. package/dist/handles/index.js.map +0 -1
  525. package/dist/handles/meta.d.ts +0 -39
  526. package/dist/handles/meta.d.ts.map +0 -1
  527. package/dist/handles/meta.js +0 -202
  528. package/dist/handles/meta.js.map +0 -1
  529. package/dist/host/__tests__/errors.test.d.ts +0 -2
  530. package/dist/host/__tests__/errors.test.d.ts.map +0 -1
  531. package/dist/host/__tests__/errors.test.js +0 -76
  532. package/dist/host/__tests__/errors.test.js.map +0 -1
  533. package/dist/host/__tests__/pattern-comprehensive.test.d.ts +0 -2
  534. package/dist/host/__tests__/pattern-comprehensive.test.d.ts.map +0 -1
  535. package/dist/host/__tests__/pattern-comprehensive.test.js +0 -732
  536. package/dist/host/__tests__/pattern-comprehensive.test.js.map +0 -1
  537. package/dist/host/__tests__/pattern-matcher.test.d.ts +0 -2
  538. package/dist/host/__tests__/pattern-matcher.test.d.ts.map +0 -1
  539. package/dist/host/__tests__/pattern-matcher.test.js +0 -251
  540. package/dist/host/__tests__/pattern-matcher.test.js.map +0 -1
  541. package/dist/host/__tests__/router.test.d.ts +0 -2
  542. package/dist/host/__tests__/router.test.d.ts.map +0 -1
  543. package/dist/host/__tests__/router.test.js +0 -241
  544. package/dist/host/__tests__/router.test.js.map +0 -1
  545. package/dist/host/__tests__/testing.test.d.ts +0 -2
  546. package/dist/host/__tests__/testing.test.d.ts.map +0 -1
  547. package/dist/host/__tests__/testing.test.js +0 -64
  548. package/dist/host/__tests__/testing.test.js.map +0 -1
  549. package/dist/host/__tests__/utils.test.d.ts +0 -2
  550. package/dist/host/__tests__/utils.test.d.ts.map +0 -1
  551. package/dist/host/__tests__/utils.test.js +0 -29
  552. package/dist/host/__tests__/utils.test.js.map +0 -1
  553. package/dist/host/cookie-handler.d.ts +0 -34
  554. package/dist/host/cookie-handler.d.ts.map +0 -1
  555. package/dist/host/cookie-handler.js +0 -124
  556. package/dist/host/cookie-handler.js.map +0 -1
  557. package/dist/host/errors.d.ts +0 -56
  558. package/dist/host/errors.d.ts.map +0 -1
  559. package/dist/host/errors.js +0 -79
  560. package/dist/host/errors.js.map +0 -1
  561. package/dist/host/index.d.ts +0 -29
  562. package/dist/host/index.d.ts.map +0 -1
  563. package/dist/host/index.js +0 -32
  564. package/dist/host/index.js.map +0 -1
  565. package/dist/host/pattern-matcher.d.ts +0 -36
  566. package/dist/host/pattern-matcher.d.ts.map +0 -1
  567. package/dist/host/pattern-matcher.js +0 -172
  568. package/dist/host/pattern-matcher.js.map +0 -1
  569. package/dist/host/router.d.ts +0 -26
  570. package/dist/host/router.d.ts.map +0 -1
  571. package/dist/host/router.js +0 -218
  572. package/dist/host/router.js.map +0 -1
  573. package/dist/host/testing.d.ts +0 -36
  574. package/dist/host/testing.d.ts.map +0 -1
  575. package/dist/host/testing.js +0 -55
  576. package/dist/host/testing.js.map +0 -1
  577. package/dist/host/types.d.ts +0 -115
  578. package/dist/host/types.d.ts.map +0 -1
  579. package/dist/host/types.js +0 -7
  580. package/dist/host/types.js.map +0 -1
  581. package/dist/host/utils.d.ts +0 -21
  582. package/dist/host/utils.d.ts.map +0 -1
  583. package/dist/host/utils.js +0 -23
  584. package/dist/host/utils.js.map +0 -1
  585. package/dist/href-client.d.ts +0 -131
  586. package/dist/href-client.d.ts.map +0 -1
  587. package/dist/href-client.js +0 -64
  588. package/dist/href-client.js.map +0 -1
  589. package/dist/href-context.d.ts +0 -29
  590. package/dist/href-context.d.ts.map +0 -1
  591. package/dist/href-context.js +0 -21
  592. package/dist/href-context.js.map +0 -1
  593. package/dist/index.d.ts +0 -73
  594. package/dist/index.d.ts.map +0 -1
  595. package/dist/index.js +0 -91
  596. package/dist/index.js.map +0 -1
  597. package/dist/index.rsc.d.ts +0 -32
  598. package/dist/index.rsc.d.ts.map +0 -1
  599. package/dist/index.rsc.js +0 -40
  600. package/dist/index.rsc.js.map +0 -1
  601. package/dist/internal-debug.d.ts +0 -2
  602. package/dist/internal-debug.d.ts.map +0 -1
  603. package/dist/internal-debug.js +0 -5
  604. package/dist/internal-debug.js.map +0 -1
  605. package/dist/loader.d.ts +0 -14
  606. package/dist/loader.d.ts.map +0 -1
  607. package/dist/loader.js +0 -20
  608. package/dist/loader.js.map +0 -1
  609. package/dist/loader.rsc.d.ts +0 -19
  610. package/dist/loader.rsc.d.ts.map +0 -1
  611. package/dist/loader.rsc.js +0 -99
  612. package/dist/loader.rsc.js.map +0 -1
  613. package/dist/network-error-thrower.d.ts +0 -17
  614. package/dist/network-error-thrower.d.ts.map +0 -1
  615. package/dist/network-error-thrower.js +0 -14
  616. package/dist/network-error-thrower.js.map +0 -1
  617. package/dist/outlet-context.d.ts +0 -13
  618. package/dist/outlet-context.d.ts.map +0 -1
  619. package/dist/outlet-context.js +0 -3
  620. package/dist/outlet-context.js.map +0 -1
  621. package/dist/prerender/__tests__/param-hash.test.d.ts +0 -2
  622. package/dist/prerender/__tests__/param-hash.test.d.ts.map +0 -1
  623. package/dist/prerender/__tests__/param-hash.test.js +0 -148
  624. package/dist/prerender/__tests__/param-hash.test.js.map +0 -1
  625. package/dist/prerender/param-hash.d.ts +0 -16
  626. package/dist/prerender/param-hash.d.ts.map +0 -1
  627. package/dist/prerender/param-hash.js +0 -36
  628. package/dist/prerender/param-hash.js.map +0 -1
  629. package/dist/prerender/store.d.ts +0 -38
  630. package/dist/prerender/store.d.ts.map +0 -1
  631. package/dist/prerender/store.js +0 -61
  632. package/dist/prerender/store.js.map +0 -1
  633. package/dist/prerender.d.ts +0 -66
  634. package/dist/prerender.d.ts.map +0 -1
  635. package/dist/prerender.js +0 -57
  636. package/dist/prerender.js.map +0 -1
  637. package/dist/reverse.d.ts +0 -196
  638. package/dist/reverse.d.ts.map +0 -1
  639. package/dist/reverse.js +0 -78
  640. package/dist/reverse.js.map +0 -1
  641. package/dist/root-error-boundary.d.ts +0 -33
  642. package/dist/root-error-boundary.d.ts.map +0 -1
  643. package/dist/root-error-boundary.js +0 -165
  644. package/dist/root-error-boundary.js.map +0 -1
  645. package/dist/route-content-wrapper.d.ts +0 -46
  646. package/dist/route-content-wrapper.d.ts.map +0 -1
  647. package/dist/route-content-wrapper.js +0 -77
  648. package/dist/route-content-wrapper.js.map +0 -1
  649. package/dist/route-definition.d.ts +0 -421
  650. package/dist/route-definition.d.ts.map +0 -1
  651. package/dist/route-definition.js +0 -868
  652. package/dist/route-definition.js.map +0 -1
  653. package/dist/route-map-builder.d.ts +0 -155
  654. package/dist/route-map-builder.d.ts.map +0 -1
  655. package/dist/route-map-builder.js +0 -237
  656. package/dist/route-map-builder.js.map +0 -1
  657. package/dist/route-types.d.ts +0 -165
  658. package/dist/route-types.d.ts.map +0 -1
  659. package/dist/route-types.js +0 -7
  660. package/dist/route-types.js.map +0 -1
  661. package/dist/router/__tests__/handler-context.test.d.ts +0 -2
  662. package/dist/router/__tests__/handler-context.test.d.ts.map +0 -1
  663. package/dist/router/__tests__/handler-context.test.js +0 -65
  664. package/dist/router/__tests__/handler-context.test.js.map +0 -1
  665. package/dist/router/__tests__/loader-cycle-detection.test.d.ts +0 -2
  666. package/dist/router/__tests__/loader-cycle-detection.test.d.ts.map +0 -1
  667. package/dist/router/__tests__/loader-cycle-detection.test.js +0 -221
  668. package/dist/router/__tests__/loader-cycle-detection.test.js.map +0 -1
  669. package/dist/router/__tests__/match-context.test.d.ts +0 -2
  670. package/dist/router/__tests__/match-context.test.d.ts.map +0 -1
  671. package/dist/router/__tests__/match-context.test.js +0 -92
  672. package/dist/router/__tests__/match-context.test.js.map +0 -1
  673. package/dist/router/__tests__/match-pipelines.test.d.ts +0 -2
  674. package/dist/router/__tests__/match-pipelines.test.d.ts.map +0 -1
  675. package/dist/router/__tests__/match-pipelines.test.js +0 -417
  676. package/dist/router/__tests__/match-pipelines.test.js.map +0 -1
  677. package/dist/router/__tests__/match-result.test.d.ts +0 -2
  678. package/dist/router/__tests__/match-result.test.d.ts.map +0 -1
  679. package/dist/router/__tests__/match-result.test.js +0 -457
  680. package/dist/router/__tests__/match-result.test.js.map +0 -1
  681. package/dist/router/__tests__/on-error.test.d.ts +0 -2
  682. package/dist/router/__tests__/on-error.test.d.ts.map +0 -1
  683. package/dist/router/__tests__/on-error.test.js +0 -678
  684. package/dist/router/__tests__/on-error.test.js.map +0 -1
  685. package/dist/router/__tests__/pattern-matching.test.d.ts +0 -2
  686. package/dist/router/__tests__/pattern-matching.test.d.ts.map +0 -1
  687. package/dist/router/__tests__/pattern-matching.test.js +0 -629
  688. package/dist/router/__tests__/pattern-matching.test.js.map +0 -1
  689. package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts +0 -2
  690. package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts.map +0 -1
  691. package/dist/router/__tests__/segment-resolution-parallel-loading.test.js +0 -155
  692. package/dist/router/__tests__/segment-resolution-parallel-loading.test.js.map +0 -1
  693. package/dist/router/error-handling.d.ts +0 -77
  694. package/dist/router/error-handling.d.ts.map +0 -1
  695. package/dist/router/error-handling.js +0 -202
  696. package/dist/router/error-handling.js.map +0 -1
  697. package/dist/router/handler-context.d.ts +0 -20
  698. package/dist/router/handler-context.d.ts.map +0 -1
  699. package/dist/router/handler-context.js +0 -198
  700. package/dist/router/handler-context.js.map +0 -1
  701. package/dist/router/intercept-resolution.d.ts +0 -66
  702. package/dist/router/intercept-resolution.d.ts.map +0 -1
  703. package/dist/router/intercept-resolution.js +0 -246
  704. package/dist/router/intercept-resolution.js.map +0 -1
  705. package/dist/router/loader-resolution.d.ts +0 -64
  706. package/dist/router/loader-resolution.d.ts.map +0 -1
  707. package/dist/router/loader-resolution.js +0 -284
  708. package/dist/router/loader-resolution.js.map +0 -1
  709. package/dist/router/logging.d.ts +0 -15
  710. package/dist/router/logging.d.ts.map +0 -1
  711. package/dist/router/logging.js +0 -99
  712. package/dist/router/logging.js.map +0 -1
  713. package/dist/router/manifest.d.ts +0 -22
  714. package/dist/router/manifest.d.ts.map +0 -1
  715. package/dist/router/manifest.js +0 -181
  716. package/dist/router/manifest.js.map +0 -1
  717. package/dist/router/match-api.d.ts +0 -35
  718. package/dist/router/match-api.d.ts.map +0 -1
  719. package/dist/router/match-api.js +0 -406
  720. package/dist/router/match-api.js.map +0 -1
  721. package/dist/router/match-context.d.ts +0 -206
  722. package/dist/router/match-context.d.ts.map +0 -1
  723. package/dist/router/match-context.js +0 -17
  724. package/dist/router/match-context.js.map +0 -1
  725. package/dist/router/match-middleware/background-revalidation.d.ts +0 -127
  726. package/dist/router/match-middleware/background-revalidation.d.ts.map +0 -1
  727. package/dist/router/match-middleware/background-revalidation.js +0 -75
  728. package/dist/router/match-middleware/background-revalidation.js.map +0 -1
  729. package/dist/router/match-middleware/cache-lookup.d.ts +0 -112
  730. package/dist/router/match-middleware/cache-lookup.d.ts.map +0 -1
  731. package/dist/router/match-middleware/cache-lookup.js +0 -257
  732. package/dist/router/match-middleware/cache-lookup.js.map +0 -1
  733. package/dist/router/match-middleware/cache-store.d.ts +0 -113
  734. package/dist/router/match-middleware/cache-store.d.ts.map +0 -1
  735. package/dist/router/match-middleware/cache-store.js +0 -108
  736. package/dist/router/match-middleware/cache-store.js.map +0 -1
  737. package/dist/router/match-middleware/index.d.ts +0 -81
  738. package/dist/router/match-middleware/index.d.ts.map +0 -1
  739. package/dist/router/match-middleware/index.js +0 -80
  740. package/dist/router/match-middleware/index.js.map +0 -1
  741. package/dist/router/match-middleware/intercept-resolution.d.ts +0 -117
  742. package/dist/router/match-middleware/intercept-resolution.d.ts.map +0 -1
  743. package/dist/router/match-middleware/intercept-resolution.js +0 -134
  744. package/dist/router/match-middleware/intercept-resolution.js.map +0 -1
  745. package/dist/router/match-middleware/segment-resolution.d.ts +0 -99
  746. package/dist/router/match-middleware/segment-resolution.d.ts.map +0 -1
  747. package/dist/router/match-middleware/segment-resolution.js +0 -53
  748. package/dist/router/match-middleware/segment-resolution.js.map +0 -1
  749. package/dist/router/match-pipelines.d.ts +0 -147
  750. package/dist/router/match-pipelines.d.ts.map +0 -1
  751. package/dist/router/match-pipelines.js +0 -82
  752. package/dist/router/match-pipelines.js.map +0 -1
  753. package/dist/router/match-result.d.ts +0 -126
  754. package/dist/router/match-result.d.ts.map +0 -1
  755. package/dist/router/match-result.js +0 -93
  756. package/dist/router/match-result.js.map +0 -1
  757. package/dist/router/metrics.d.ts +0 -20
  758. package/dist/router/metrics.d.ts.map +0 -1
  759. package/dist/router/metrics.js +0 -47
  760. package/dist/router/metrics.js.map +0 -1
  761. package/dist/router/middleware.d.ts +0 -249
  762. package/dist/router/middleware.d.ts.map +0 -1
  763. package/dist/router/middleware.js +0 -434
  764. package/dist/router/middleware.js.map +0 -1
  765. package/dist/router/middleware.test.d.ts +0 -2
  766. package/dist/router/middleware.test.d.ts.map +0 -1
  767. package/dist/router/middleware.test.js +0 -816
  768. package/dist/router/middleware.test.js.map +0 -1
  769. package/dist/router/pattern-matching.d.ts +0 -149
  770. package/dist/router/pattern-matching.d.ts.map +0 -1
  771. package/dist/router/pattern-matching.js +0 -349
  772. package/dist/router/pattern-matching.js.map +0 -1
  773. package/dist/router/revalidation.d.ts +0 -44
  774. package/dist/router/revalidation.d.ts.map +0 -1
  775. package/dist/router/revalidation.js +0 -147
  776. package/dist/router/revalidation.js.map +0 -1
  777. package/dist/router/router-context.d.ts +0 -135
  778. package/dist/router/router-context.d.ts.map +0 -1
  779. package/dist/router/router-context.js +0 -36
  780. package/dist/router/router-context.js.map +0 -1
  781. package/dist/router/segment-resolution.d.ts +0 -127
  782. package/dist/router/segment-resolution.d.ts.map +0 -1
  783. package/dist/router/segment-resolution.js +0 -919
  784. package/dist/router/segment-resolution.js.map +0 -1
  785. package/dist/router/trie-matching.d.ts +0 -40
  786. package/dist/router/trie-matching.d.ts.map +0 -1
  787. package/dist/router/trie-matching.js +0 -127
  788. package/dist/router/trie-matching.js.map +0 -1
  789. package/dist/router/types.d.ts +0 -136
  790. package/dist/router/types.d.ts.map +0 -1
  791. package/dist/router/types.js +0 -7
  792. package/dist/router/types.js.map +0 -1
  793. package/dist/router.d.ts +0 -753
  794. package/dist/router.d.ts.map +0 -1
  795. package/dist/router.gen.d.ts +0 -6
  796. package/dist/router.gen.d.ts.map +0 -1
  797. package/dist/router.gen.js +0 -6
  798. package/dist/router.gen.js.map +0 -1
  799. package/dist/router.js +0 -1304
  800. package/dist/router.js.map +0 -1
  801. package/dist/rsc/__tests__/helpers.test.d.ts +0 -2
  802. package/dist/rsc/__tests__/helpers.test.d.ts.map +0 -1
  803. package/dist/rsc/__tests__/helpers.test.js +0 -140
  804. package/dist/rsc/__tests__/helpers.test.js.map +0 -1
  805. package/dist/rsc/handler.d.ts +0 -45
  806. package/dist/rsc/handler.d.ts.map +0 -1
  807. package/dist/rsc/handler.js +0 -1172
  808. package/dist/rsc/handler.js.map +0 -1
  809. package/dist/rsc/helpers.d.ts +0 -16
  810. package/dist/rsc/helpers.d.ts.map +0 -1
  811. package/dist/rsc/helpers.js +0 -55
  812. package/dist/rsc/helpers.js.map +0 -1
  813. package/dist/rsc/index.d.ts +0 -22
  814. package/dist/rsc/index.d.ts.map +0 -1
  815. package/dist/rsc/index.js +0 -23
  816. package/dist/rsc/index.js.map +0 -1
  817. package/dist/rsc/nonce.d.ts +0 -9
  818. package/dist/rsc/nonce.d.ts.map +0 -1
  819. package/dist/rsc/nonce.js +0 -18
  820. package/dist/rsc/nonce.js.map +0 -1
  821. package/dist/rsc/types.d.ts +0 -206
  822. package/dist/rsc/types.d.ts.map +0 -1
  823. package/dist/rsc/types.js +0 -8
  824. package/dist/rsc/types.js.map +0 -1
  825. package/dist/search-params.d.ts +0 -103
  826. package/dist/search-params.d.ts.map +0 -1
  827. package/dist/search-params.js +0 -74
  828. package/dist/search-params.js.map +0 -1
  829. package/dist/segment-system.d.ts +0 -75
  830. package/dist/segment-system.d.ts.map +0 -1
  831. package/dist/segment-system.js +0 -336
  832. package/dist/segment-system.js.map +0 -1
  833. package/dist/server/context.d.ts +0 -245
  834. package/dist/server/context.d.ts.map +0 -1
  835. package/dist/server/context.js +0 -197
  836. package/dist/server/context.js.map +0 -1
  837. package/dist/server/fetchable-loader-store.d.ts +0 -18
  838. package/dist/server/fetchable-loader-store.d.ts.map +0 -1
  839. package/dist/server/fetchable-loader-store.js +0 -18
  840. package/dist/server/fetchable-loader-store.js.map +0 -1
  841. package/dist/server/handle-store.d.ts +0 -85
  842. package/dist/server/handle-store.d.ts.map +0 -1
  843. package/dist/server/handle-store.js +0 -142
  844. package/dist/server/handle-store.js.map +0 -1
  845. package/dist/server/loader-registry.d.ts +0 -55
  846. package/dist/server/loader-registry.d.ts.map +0 -1
  847. package/dist/server/loader-registry.js +0 -132
  848. package/dist/server/loader-registry.js.map +0 -1
  849. package/dist/server/request-context.d.ts +0 -226
  850. package/dist/server/request-context.d.ts.map +0 -1
  851. package/dist/server/request-context.js +0 -290
  852. package/dist/server/request-context.js.map +0 -1
  853. package/dist/server/root-layout.d.ts +0 -4
  854. package/dist/server/root-layout.d.ts.map +0 -1
  855. package/dist/server/root-layout.js +0 -5
  856. package/dist/server/root-layout.js.map +0 -1
  857. package/dist/server.d.ts +0 -15
  858. package/dist/server.d.ts.map +0 -1
  859. package/dist/server.js +0 -20
  860. package/dist/server.js.map +0 -1
  861. package/dist/ssr/__tests__/ssr-handler.test.d.ts +0 -2
  862. package/dist/ssr/__tests__/ssr-handler.test.d.ts.map +0 -1
  863. package/dist/ssr/__tests__/ssr-handler.test.js +0 -132
  864. package/dist/ssr/__tests__/ssr-handler.test.js.map +0 -1
  865. package/dist/ssr/index.d.ts +0 -98
  866. package/dist/ssr/index.d.ts.map +0 -1
  867. package/dist/ssr/index.js +0 -158
  868. package/dist/ssr/index.js.map +0 -1
  869. package/dist/static-handler.d.ts +0 -50
  870. package/dist/static-handler.d.ts.map +0 -1
  871. package/dist/static-handler.gen.d.ts +0 -5
  872. package/dist/static-handler.gen.d.ts.map +0 -1
  873. package/dist/static-handler.gen.js +0 -5
  874. package/dist/static-handler.gen.js.map +0 -1
  875. package/dist/static-handler.js +0 -29
  876. package/dist/static-handler.js.map +0 -1
  877. package/dist/theme/ThemeProvider.d.ts +0 -20
  878. package/dist/theme/ThemeProvider.d.ts.map +0 -1
  879. package/dist/theme/ThemeProvider.js +0 -240
  880. package/dist/theme/ThemeProvider.js.map +0 -1
  881. package/dist/theme/ThemeScript.d.ts +0 -48
  882. package/dist/theme/ThemeScript.d.ts.map +0 -1
  883. package/dist/theme/ThemeScript.js +0 -13
  884. package/dist/theme/ThemeScript.js.map +0 -1
  885. package/dist/theme/__tests__/theme.test.d.ts +0 -2
  886. package/dist/theme/__tests__/theme.test.d.ts.map +0 -1
  887. package/dist/theme/__tests__/theme.test.js +0 -103
  888. package/dist/theme/__tests__/theme.test.js.map +0 -1
  889. package/dist/theme/constants.d.ts +0 -29
  890. package/dist/theme/constants.d.ts.map +0 -1
  891. package/dist/theme/constants.js +0 -48
  892. package/dist/theme/constants.js.map +0 -1
  893. package/dist/theme/index.d.ts +0 -31
  894. package/dist/theme/index.d.ts.map +0 -1
  895. package/dist/theme/index.js +0 -36
  896. package/dist/theme/index.js.map +0 -1
  897. package/dist/theme/theme-context.d.ts +0 -40
  898. package/dist/theme/theme-context.d.ts.map +0 -1
  899. package/dist/theme/theme-context.js +0 -60
  900. package/dist/theme/theme-context.js.map +0 -1
  901. package/dist/theme/theme-script.d.ts +0 -27
  902. package/dist/theme/theme-script.d.ts.map +0 -1
  903. package/dist/theme/theme-script.js +0 -147
  904. package/dist/theme/theme-script.js.map +0 -1
  905. package/dist/theme/types.d.ts +0 -163
  906. package/dist/theme/types.d.ts.map +0 -1
  907. package/dist/theme/types.js +0 -11
  908. package/dist/theme/types.js.map +0 -1
  909. package/dist/theme/use-theme.d.ts +0 -12
  910. package/dist/theme/use-theme.d.ts.map +0 -1
  911. package/dist/theme/use-theme.js +0 -40
  912. package/dist/theme/use-theme.js.map +0 -1
  913. package/dist/types.d.ts +0 -1479
  914. package/dist/types.d.ts.map +0 -1
  915. package/dist/types.js +0 -10
  916. package/dist/types.js.map +0 -1
  917. package/dist/urls.d.ts +0 -441
  918. package/dist/urls.d.ts.map +0 -1
  919. package/dist/urls.gen.d.ts +0 -8
  920. package/dist/urls.gen.d.ts.map +0 -1
  921. package/dist/urls.gen.js +0 -8
  922. package/dist/urls.gen.js.map +0 -1
  923. package/dist/urls.js +0 -443
  924. package/dist/urls.js.map +0 -1
  925. package/dist/use-loader.d.ts +0 -127
  926. package/dist/use-loader.d.ts.map +0 -1
  927. package/dist/use-loader.js +0 -237
  928. package/dist/use-loader.js.map +0 -1
  929. package/dist/vite/__tests__/ast-handler-extract.test.d.ts +0 -2
  930. package/dist/vite/__tests__/ast-handler-extract.test.d.ts.map +0 -1
  931. package/dist/vite/__tests__/ast-handler-extract.test.js +0 -294
  932. package/dist/vite/__tests__/ast-handler-extract.test.js.map +0 -1
  933. package/dist/vite/__tests__/expose-id-utils.test.d.ts +0 -2
  934. package/dist/vite/__tests__/expose-id-utils.test.d.ts.map +0 -1
  935. package/dist/vite/__tests__/expose-id-utils.test.js +0 -224
  936. package/dist/vite/__tests__/expose-id-utils.test.js.map +0 -1
  937. package/dist/vite/__tests__/expose-internal-ids.test.d.ts +0 -2
  938. package/dist/vite/__tests__/expose-internal-ids.test.d.ts.map +0 -1
  939. package/dist/vite/__tests__/expose-internal-ids.test.js +0 -647
  940. package/dist/vite/__tests__/expose-internal-ids.test.js.map +0 -1
  941. package/dist/vite/__tests__/expose-router-id.test.d.ts +0 -2
  942. package/dist/vite/__tests__/expose-router-id.test.d.ts.map +0 -1
  943. package/dist/vite/__tests__/expose-router-id.test.js +0 -39
  944. package/dist/vite/__tests__/expose-router-id.test.js.map +0 -1
  945. package/dist/vite/ast-handler-extract.d.ts +0 -49
  946. package/dist/vite/ast-handler-extract.d.ts.map +0 -1
  947. package/dist/vite/ast-handler-extract.js +0 -249
  948. package/dist/vite/ast-handler-extract.js.map +0 -1
  949. package/dist/vite/expose-action-id.d.ts +0 -19
  950. package/dist/vite/expose-action-id.d.ts.map +0 -1
  951. package/dist/vite/expose-action-id.js +0 -250
  952. package/dist/vite/expose-action-id.js.map +0 -1
  953. package/dist/vite/expose-id-utils.d.ts +0 -69
  954. package/dist/vite/expose-id-utils.d.ts.map +0 -1
  955. package/dist/vite/expose-id-utils.js +0 -289
  956. package/dist/vite/expose-id-utils.js.map +0 -1
  957. package/dist/vite/expose-internal-ids.d.ts +0 -22
  958. package/dist/vite/expose-internal-ids.d.ts.map +0 -1
  959. package/dist/vite/expose-internal-ids.js +0 -886
  960. package/dist/vite/expose-internal-ids.js.map +0 -1
  961. package/dist/vite/index.d.ts +0 -149
  962. package/dist/vite/index.d.ts.map +0 -1
  963. package/dist/vite/index.js.map +0 -1
  964. package/dist/vite/index.named-routes.gen.ts +0 -103
  965. package/dist/vite/package-resolution.d.ts +0 -43
  966. package/dist/vite/package-resolution.d.ts.map +0 -1
  967. package/dist/vite/package-resolution.js +0 -112
  968. package/dist/vite/package-resolution.js.map +0 -1
  969. package/dist/vite/virtual-entries.d.ts +0 -25
  970. package/dist/vite/virtual-entries.d.ts.map +0 -1
  971. package/dist/vite/virtual-entries.js +0 -110
  972. package/dist/vite/virtual-entries.js.map +0 -1
@@ -7,7 +7,6 @@ import type {
7
7
  import { generateHistoryKey } from "./navigation-store.js";
8
8
  import {
9
9
  handleNavigationStart,
10
- handleNavigationEnd,
11
10
  ensureHistoryKey,
12
11
  } from "./scroll-restoration.js";
13
12
  import type { EventController, NavigationHandle } from "./event-controller.js";
@@ -81,11 +80,12 @@ export interface BoundTransaction {
81
80
  readonly currentUrl: string;
82
81
  /** Start streaming and get a token to end it when the stream completes */
83
82
  startStreaming(): StreamingToken;
83
+ /** Commit the navigation. Returns the effective scroll option for the caller to handle. */
84
84
  commit(
85
85
  segmentIds: string[],
86
86
  segments: ResolvedSegment[],
87
87
  overrides?: BoundCommitOverrides,
88
- ): void;
88
+ ): { scroll?: boolean };
89
89
  }
90
90
 
91
91
  /**
@@ -93,7 +93,7 @@ export interface BoundTransaction {
93
93
  * Uses the event controller handle for lifecycle management
94
94
  */
95
95
  interface NavigationTransaction extends Disposable {
96
- commit(options: CommitOptions): void;
96
+ commit(options: CommitOptions): { scroll?: boolean };
97
97
  with(
98
98
  options: Omit<CommitOptions, "segmentIds" | "segments">,
99
99
  ): BoundTransaction;
@@ -120,7 +120,7 @@ export function createNavigationTransaction(
120
120
  /**
121
121
  * Commit the navigation - updates store and URL atomically
122
122
  */
123
- function commit(opts: CommitOptions): void {
123
+ function commit(opts: CommitOptions): { scroll?: boolean } {
124
124
  committed = true;
125
125
 
126
126
  const {
@@ -150,7 +150,7 @@ export function createNavigationTransaction(
150
150
  // Without this, the entry lingers and weakens state-machine invariants.
151
151
  handle.complete(parsedUrl);
152
152
  debugLog("[Browser] Cache-only commit, historyKey:", historyKey);
153
- return;
153
+ return { scroll: false };
154
154
  }
155
155
 
156
156
  // Save current scroll position before navigating
@@ -172,7 +172,7 @@ export function createNavigationTransaction(
172
172
  debugLog("[Browser] Store updated (action)");
173
173
  // Complete navigation to clear loading state
174
174
  handle.complete(parsedUrl);
175
- return;
175
+ return { scroll: false };
176
176
  }
177
177
 
178
178
  // Build history state - include user state, intercept info, and server-set state
@@ -205,14 +205,16 @@ export function createNavigationTransaction(
205
205
  // Complete the navigation in event controller (sets idle state, updates location)
206
206
  handle.complete(parsedUrl);
207
207
 
208
- // Handle scroll after navigation
209
- handleNavigationEnd({ scroll });
208
+ // NOTE: Scroll is NOT handled here. The caller (partial-update.ts) handles
209
+ // scroll AFTER onUpdate() so React has the new content before we scroll.
210
210
 
211
211
  debugLog(
212
212
  "[Browser] Navigation committed, historyKey:",
213
213
  historyKey,
214
214
  intercept ? "(intercept)" : "",
215
215
  );
216
+
217
+ return { scroll };
216
218
  }
217
219
 
218
220
  return {
@@ -263,7 +265,7 @@ export function createNavigationTransaction(
263
265
  overrides?.state !== undefined ? overrides.state : opts.state;
264
266
  // Server-set location state: only from overrides (set by partial-update)
265
267
  const serverState = overrides?.serverState;
266
- commit({
268
+ return commit({
267
269
  ...opts,
268
270
  segmentIds,
269
271
  segments,
@@ -19,6 +19,14 @@ import type { BoundTransaction } from "./navigation-transaction.js";
19
19
  import { ServerRedirect } from "../errors.js";
20
20
  import { debugLog } from "./logging.js";
21
21
  import { validateRedirectOrigin } from "./validate-redirect-origin.js";
22
+ import type { NavigationUpdate } from "./types.js";
23
+
24
+ /** Build a scroll payload from the commit's scroll option */
25
+ function toScrollPayload(
26
+ scroll: boolean | undefined,
27
+ ): NonNullable<NavigationUpdate["scroll"]> {
28
+ return { enabled: scroll !== false ? scroll : false };
29
+ }
22
30
 
23
31
  /**
24
32
  * Configuration for creating a partial updater
@@ -31,8 +39,15 @@ export interface PartialUpdateConfig {
31
39
  segments: ResolvedSegment[],
32
40
  options?: RenderSegmentsOptions,
33
41
  ) => Promise<ReactNode> | ReactNode;
34
- /** RSC version received from server (from initial payload metadata) */
35
- version?: string;
42
+ /** RSC version getter returns the current version (may change after HMR) */
43
+ getVersion?: () => string | undefined;
44
+ /**
45
+ * Replace the active app-shell when a cross-app navigation is detected.
46
+ * Called before the full-update tree replacement renders, so the new
47
+ * payload's rootLayout, basename, and version are picked up. Theme,
48
+ * warmup, and prefetch TTL are not part of the shell — see AppShell.
49
+ */
50
+ applyAppShell?: (next: import("./app-shell.js").AppShell) => void;
36
51
  }
37
52
 
38
53
  /**
@@ -96,7 +111,14 @@ export type PartialUpdater = (
96
111
  export function createPartialUpdater(
97
112
  config: PartialUpdateConfig,
98
113
  ): PartialUpdater {
99
- const { store, client, onUpdate, renderSegments, version } = config;
114
+ const {
115
+ store,
116
+ client,
117
+ onUpdate,
118
+ renderSegments,
119
+ getVersion = () => undefined,
120
+ applyAppShell,
121
+ } = config;
100
122
 
101
123
  /**
102
124
  * Get current page's cached segments as an array
@@ -153,9 +175,16 @@ export function createPartialUpdater(
153
175
  segments = segmentIds ?? segmentState.currentSegmentIds;
154
176
  }
155
177
 
156
- // For intercept revalidation, use the intercept source URL as previousUrl
178
+ // For intercept revalidation, use the intercept source URL as previousUrl.
179
+ // For leave-intercept, tx.currentUrl captures window.location.href at tx
180
+ // creation, which on popstate is already the destination URL and would
181
+ // tell the server "from == to". segmentState.currentUrl still points at
182
+ // the URL the cached segments render (the intercept URL), which is the
183
+ // correct "from" for the server's diff computation.
157
184
  const previousUrl =
158
- interceptSourceUrl || tx.currentUrl || segmentState.currentUrl;
185
+ mode.type === "leave-intercept"
186
+ ? segmentState.currentUrl || tx.currentUrl
187
+ : interceptSourceUrl || tx.currentUrl || segmentState.currentUrl;
159
188
 
160
189
  debugLog(`\n[Browser] >>> NAVIGATION`);
161
190
  debugLog(`[Browser] From: ${previousUrl}`);
@@ -174,6 +203,11 @@ export function createPartialUpdater(
174
203
  targetCache && targetCache.length > 0
175
204
  ? targetCache
176
205
  : getCurrentCachedSegments();
206
+ const cachedSegsSource =
207
+ targetCache && targetCache.length > 0 ? "history-cache" : "current-page";
208
+ debugLog(
209
+ `[Browser] cachedSegs source: ${cachedSegsSource} (${cachedSegs.length} segments: ${cachedSegs.map((s) => s.id).join(", ")})`,
210
+ );
177
211
 
178
212
  // Fetch partial payload (no abort signal - RSC doesn't support it well)
179
213
  let fetchResult: Awaited<ReturnType<NavigationClient["fetchPartial"]>>;
@@ -185,7 +219,8 @@ export function createPartialUpdater(
185
219
  // (action redirect sends empty segments for a fresh render).
186
220
  staleRevalidation:
187
221
  mode.type === "stale-revalidation" || segments.length === 0,
188
- version,
222
+ version: getVersion(),
223
+ routerId: store.getRouterId?.(),
189
224
  });
190
225
  // Mark navigation as streaming (response received, now parsing RSC).
191
226
  // Called after fetchPartial so pendingUrl stays set during the network wait,
@@ -198,6 +233,32 @@ export function createPartialUpdater(
198
233
  streamingToken.end();
199
234
  });
200
235
 
236
+ // Detect app switch: if routerId changed, the navigation crossed into
237
+ // a different router (e.g., via host router path mount). Downgrade
238
+ // partial to full so the entire tree is replaced without reconciliation
239
+ // against stale segments from the previous app, and replace the app
240
+ // shell (rootLayout, basename, version) so the target app's document
241
+ // and router config take effect instead of remaining captured from the
242
+ // initial load. Theme, warmup, and prefetch TTL are intentionally
243
+ // document-lifetime (see AppShell doc); a new document navigation
244
+ // applies them.
245
+ if (payload.metadata?.routerId) {
246
+ const prevRouterId = store.getRouterId?.();
247
+ if (prevRouterId && prevRouterId !== payload.metadata.routerId) {
248
+ debugLog(
249
+ `[Browser] App switch detected (${prevRouterId} → ${payload.metadata.routerId}), forcing full update`,
250
+ );
251
+ payload.metadata.isPartial = false;
252
+ applyAppShell?.({
253
+ routerId: payload.metadata.routerId,
254
+ rootLayout: payload.metadata.rootLayout,
255
+ basename: payload.metadata.basename,
256
+ version: payload.metadata.version,
257
+ });
258
+ }
259
+ store.setRouterId?.(payload.metadata.routerId);
260
+ }
261
+
201
262
  // Handle server-side redirect with state
202
263
  if (payload.metadata?.redirect) {
203
264
  if (signal?.aborted) {
@@ -246,7 +307,21 @@ export function createPartialUpdater(
246
307
  forceAwait: true,
247
308
  });
248
309
 
249
- tx.commit(matchedIds, existingSegments);
310
+ const { scroll: commitScroll } = tx.commit(
311
+ matchedIds,
312
+ existingSegments,
313
+ );
314
+
315
+ // tx.commit() cached the source page's handleData because
316
+ // eventController hasn't been updated yet. Overwrite with the
317
+ // correct cached handleData to prevent cache corruption on
318
+ // subsequent navigations to this same URL.
319
+ if (mode.targetCacheHandleData) {
320
+ store.updateCacheHandleData(
321
+ store.getHistoryKey(),
322
+ mode.targetCacheHandleData,
323
+ );
324
+ }
250
325
 
251
326
  // Include cachedHandleData in metadata so NavigationProvider can restore
252
327
  // breadcrumbs and other handle data from cache.
@@ -260,6 +335,7 @@ export function createPartialUpdater(
260
335
  ...metadataWithoutHandles,
261
336
  cachedHandleData: mode.targetCacheHandleData,
262
337
  },
338
+ scroll: toScrollPayload(commitScroll),
263
339
  };
264
340
 
265
341
  const cachedHasTransition = existingSegments.some(
@@ -290,11 +366,15 @@ export function createPartialUpdater(
290
366
  forceAwait: true,
291
367
  });
292
368
 
293
- tx.commit(matchedIds, existingSegments);
369
+ const { scroll: leaveScroll } = tx.commit(
370
+ matchedIds,
371
+ existingSegments,
372
+ );
294
373
 
295
374
  onUpdate({
296
375
  root: newTree,
297
376
  metadata: payload.metadata,
377
+ scroll: toScrollPayload(leaveScroll),
298
378
  });
299
379
 
300
380
  debugLog("[Browser] Navigation complete (left intercept)");
@@ -426,7 +506,11 @@ export function createPartialUpdater(
426
506
  : serverLocationState
427
507
  ? { serverState: serverLocationState }
428
508
  : undefined;
429
- tx.commit(allSegmentIds, reconciled.segments, overrides);
509
+ const { scroll: navScroll } = tx.commit(
510
+ allSegmentIds,
511
+ reconciled.segments,
512
+ overrides,
513
+ );
430
514
 
431
515
  // For stale revalidation: verify history key hasn't changed before updating UI
432
516
  if (mode.type === "stale-revalidation") {
@@ -441,8 +525,10 @@ export function createPartialUpdater(
441
525
 
442
526
  debugLog("[partial-update] updating document");
443
527
 
444
- // Emit update to trigger React render
528
+ // Emit update to trigger React render.
529
+ // Scroll info is included so NavigationProvider applies it after React commits.
445
530
  const hasTransition = reconciled.mainSegments.some((s) => s.transition);
531
+ const scrollPayload = toScrollPayload(navScroll);
446
532
 
447
533
  if (mode.type === "action" || mode.type === "stale-revalidation") {
448
534
  startTransition(() => {
@@ -452,6 +538,7 @@ export function createPartialUpdater(
452
538
  onUpdate({
453
539
  root: newTree,
454
540
  metadata: payload.metadata!,
541
+ scroll: scrollPayload,
455
542
  });
456
543
  });
457
544
  } else if (hasTransition) {
@@ -462,12 +549,14 @@ export function createPartialUpdater(
462
549
  onUpdate({
463
550
  root: newTree,
464
551
  metadata: payload.metadata!,
552
+ scroll: scrollPayload,
465
553
  });
466
554
  });
467
555
  } else {
468
556
  onUpdate({
469
557
  root: newTree,
470
558
  metadata: payload.metadata!,
559
+ scroll: scrollPayload,
471
560
  });
472
561
  }
473
562
 
@@ -494,15 +583,16 @@ export function createPartialUpdater(
494
583
  }
495
584
 
496
585
  const fullUpdateServerState = payload.metadata?.locationState;
497
- if (fullUpdateServerState) {
498
- tx.commit(segmentIds, segments, { serverState: fullUpdateServerState });
499
- } else {
500
- tx.commit(segmentIds, segments);
501
- }
586
+ const { scroll: fullScroll } = fullUpdateServerState
587
+ ? tx.commit(segmentIds, segments, {
588
+ serverState: fullUpdateServerState,
589
+ })
590
+ : tx.commit(segmentIds, segments);
502
591
 
503
592
  const fullHasTransition = segments.some(
504
593
  (s: ResolvedSegment) => s.transition,
505
594
  );
595
+ const fullScrollPayload = toScrollPayload(fullScroll);
506
596
 
507
597
  if (mode.type === "stale-revalidation") {
508
598
  await rawStreamComplete;
@@ -513,6 +603,7 @@ export function createPartialUpdater(
513
603
  onUpdate({
514
604
  root: newTree,
515
605
  metadata: payload.metadata!,
606
+ scroll: fullScrollPayload,
516
607
  });
517
608
  });
518
609
  } else if (mode.type === "action") {
@@ -523,6 +614,7 @@ export function createPartialUpdater(
523
614
  onUpdate({
524
615
  root: newTree,
525
616
  metadata: payload.metadata!,
617
+ scroll: fullScrollPayload,
526
618
  });
527
619
  });
528
620
  } else if (fullHasTransition) {
@@ -533,12 +625,14 @@ export function createPartialUpdater(
533
625
  onUpdate({
534
626
  root: newTree,
535
627
  metadata: payload.metadata!,
628
+ scroll: fullScrollPayload,
536
629
  });
537
630
  });
538
631
  } else {
539
632
  onUpdate({
540
633
  root: newTree,
541
634
  metadata: payload.metadata!,
635
+ scroll: fullScrollPayload,
542
636
  });
543
637
  }
544
638
 
@@ -1,16 +1,34 @@
1
1
  /**
2
2
  * Prefetch Cache
3
3
  *
4
- * In-memory cache storing prefetch Response objects for instant cache hits
5
- * on subsequent navigation. Cache key is source-dependent (includes the
6
- * current page URL) because the server's diff-based response depends on
7
- * where the user navigates from.
4
+ * In-memory cache storing prefetched Response objects for instant cache hits
5
+ * on subsequent navigation. Two key scopes are in play:
6
+ * - Wildcard (default): built by `buildPrefetchKey(rangoState, target)`
7
+ * shape `rangoState\0/target?...`. Shared across all source pages and
8
+ * invalidated automatically when Rango state bumps (deploy or
9
+ * server-action invalidation).
10
+ * - Source-scoped: built by `buildSourceKey(rangoState, sourceHref, target)`
11
+ * — shape `rangoState\0sourceHref\0/target?...`. Embeds the Rango state
12
+ * (so rotation invalidates source-scoped entries too) plus the source
13
+ * href (so each originating page gets its own slot). Populated when the
14
+ * server tags a response with `X-RSC-Prefetch-Scope: source` (intercept
15
+ * modals etc.), OR when a Link opts in with `prefetchKey=":source"` — in
16
+ * both cases so source-sensitive responses cannot bleed into navigations
17
+ * from other pages.
18
+ *
19
+ * Also tracks in-flight prefetch promises. Each promise resolves to the
20
+ * navigation branch of a tee'd Response, allowing navigation to adopt a
21
+ * still-downloading prefetch without reparsing or buffering the body. A
22
+ * single promise can be registered under multiple alias keys (see
23
+ * `setInflightPromiseWithAliases`) so same-source navigations adopt via
24
+ * their source key while cross-source ones fall through to the wildcard
25
+ * alias — with consume/clear atomically removing every alias.
8
26
  *
9
27
  * Replaces the previous browser HTTP cache approach which was unreliable
10
28
  * due to response draining race conditions and browser inconsistencies.
11
29
  */
12
30
 
13
- import { cancelAllPrefetches } from "./queue.js";
31
+ import { abortAllPrefetches } from "./queue.js";
14
32
  import { invalidateRangoState } from "../rango-state.js";
15
33
 
16
34
  // Default TTL: 5 minutes. Overridden by initPrefetchCache() with
@@ -44,19 +62,78 @@ interface PrefetchCacheEntry {
44
62
  const cache = new Map<string, PrefetchCacheEntry>();
45
63
  const inflight = new Set<string>();
46
64
 
65
+ /**
66
+ * In-flight promise map. When a prefetch fetch is in progress, its
67
+ * Promise<Response | null> is stored here so navigation can await
68
+ * it instead of starting a duplicate request.
69
+ */
70
+ const inflightPromises = new Map<string, Promise<Response | null>>();
71
+
72
+ /**
73
+ * Alias map for in-flight promises registered under multiple keys (see
74
+ * dual inflight in prefetch/fetch.ts). Records each key's sibling set so
75
+ * that consuming or clearing any one key atomically removes every alias —
76
+ * guaranteeing a single consumer for the shared Response stream.
77
+ */
78
+ const inflightAliases = new Map<string, string[]>();
79
+
47
80
  // Generation counter incremented on each clearPrefetchCache(). Fetches that
48
81
  // started before a clear carry a stale generation and must not store their
49
82
  // response (the data may be stale due to a server action invalidation).
50
83
  let generation = 0;
51
84
 
52
85
  /**
53
- * Build a source-dependent cache key.
54
- * Includes the source page href so the same target prefetched from
55
- * different pages gets separate entries the server response varies
56
- * based on the source page context (diff-based rendering).
86
+ * Build a cache key by combining a scope prefix with the target URL.
87
+ *
88
+ * Low-level primitive callers that want a specific scope should use
89
+ * one of:
90
+ * - Wildcard (source-agnostic): prefix is the Rango state value from
91
+ * `getRangoState()`. Shared across all source pages. Invalidated
92
+ * automatically when Rango state bumps (deploy or server-action).
93
+ * Key shape: `rangoState\0/target?...`.
94
+ * - Source-scoped: use `buildSourceKey()`. Key shape:
95
+ * `rangoState\0sourceHref\0/target?...` — embeds the Rango state so
96
+ * rotation invalidates source-scoped entries alongside wildcard ones,
97
+ * plus the source page href so the key is unique per originating page.
98
+ * Populated either when the server tags a response with
99
+ * `X-RSC-Prefetch-Scope: source` (intercept modals, etc.) or when a
100
+ * Link opts in via `prefetchKey=":source"`.
101
+ *
102
+ * The `_rsc_segments` query param that travels in the target URL means
103
+ * clients with different mounted segment trees naturally get different
104
+ * keys — so segment-level diffs remain consistent across both scopes.
105
+ */
106
+ export function buildPrefetchKey(prefix: string, targetUrl: URL): string {
107
+ return prefix + "\0" + targetUrl.pathname + targetUrl.search;
108
+ }
109
+
110
+ /**
111
+ * Build a source-scoped cache key. Key shape:
112
+ * `rangoState\0sourceHref\0/target?...`.
113
+ *
114
+ * - `rangoState` is included so state rotation invalidates source-scoped
115
+ * entries alongside wildcard ones.
116
+ * - `sourceHref` makes the key unique per originating page.
117
+ */
118
+ export function buildSourceKey(
119
+ rangoState: string,
120
+ sourceHref: string,
121
+ targetUrl: URL,
122
+ ): string {
123
+ return buildPrefetchKey(rangoState + "\0" + sourceHref, targetUrl);
124
+ }
125
+
126
+ /**
127
+ * Walk an inflight key plus any sibling aliases registered via
128
+ * `setInflightPromiseWithAliases`, invoking `fn` for each.
57
129
  */
58
- export function buildPrefetchKey(sourceHref: string, targetUrl: URL): string {
59
- return sourceHref + "\0" + targetUrl.pathname + targetUrl.search;
130
+ function forEachAlias(key: string, fn: (k: string) => void): void {
131
+ const aliases = inflightAliases.get(key);
132
+ if (aliases) {
133
+ for (const k of aliases) fn(k);
134
+ } else {
135
+ fn(key);
136
+ }
60
137
  }
61
138
 
62
139
  /**
@@ -78,6 +155,9 @@ export function hasPrefetch(key: string): boolean {
78
155
  * Consume a cached prefetch response. Returns null if not found or expired.
79
156
  * One-time consumption: the entry is deleted after retrieval.
80
157
  * Returns null when caching is disabled (TTL <= 0).
158
+ *
159
+ * Does NOT check in-flight prefetches — use consumeInflightPrefetch()
160
+ * for that (returns a Promise instead of a Response).
81
161
  */
82
162
  export function consumePrefetch(key: string): Response | null {
83
163
  if (cacheTTL <= 0) return null;
@@ -91,10 +171,39 @@ export function consumePrefetch(key: string): Response | null {
91
171
  return entry.response;
92
172
  }
93
173
 
174
+ /**
175
+ * Consume an in-flight prefetch promise. Returns null if no prefetch is
176
+ * in-flight for this key. The returned Promise resolves to the buffered
177
+ * Response (or null if the fetch failed/was aborted).
178
+ *
179
+ * One-time consumption: the promise entry is removed (along with any
180
+ * sibling aliases registered via `setInflightPromiseWithAliases`) so a
181
+ * second call on any alias returns null — only one caller can adopt the
182
+ * shared Response stream. The `inflight` set entry is intentionally
183
+ * kept so that `hasPrefetch()` continues to return true while the
184
+ * underlying fetch is still downloading — this prevents
185
+ * `prefetchDirect()` or other callers from starting a duplicate request
186
+ * during the handoff window. The inflight flag is cleaned up naturally
187
+ * by `clearPrefetchInflight()` in the fetch's `.finally()`.
188
+ */
189
+ export function consumeInflightPrefetch(
190
+ key: string,
191
+ ): Promise<Response | null> | null {
192
+ const promise = inflightPromises.get(key);
193
+ if (!promise) return null;
194
+ // Remove the promise under every alias so a second consumer cannot
195
+ // adopt the same stream and race on the body. `inflightAliases` is
196
+ // intentionally preserved — `clearPrefetchInflight()` in the fetch's
197
+ // `.finally()` still needs it to clear every inflight flag; deleting
198
+ // here would strand the sibling's flag forever.
199
+ forEachAlias(key, (k) => inflightPromises.delete(k));
200
+ return promise;
201
+ }
202
+
94
203
  /**
95
204
  * Store a prefetch response in the in-memory cache.
96
- * The response body must be fully buffered (e.g. via arrayBuffer()) before
97
- * storing, so the cached Response is self-contained and network-independent.
205
+ * The response should be a clone() of the original so the caller can
206
+ * still consume the body. The clone's body streams independently.
98
207
  *
99
208
  * Skips storage if the generation has changed since the fetch started
100
209
  * (a server action invalidated the cache mid-flight).
@@ -136,19 +245,70 @@ export function markPrefetchInflight(key: string): void {
136
245
  inflight.add(key);
137
246
  }
138
247
 
248
+ /**
249
+ * Store the in-flight Promise for a prefetch so navigation can reuse it.
250
+ */
251
+ export function setInflightPromise(
252
+ key: string,
253
+ promise: Promise<Response | null>,
254
+ ): void {
255
+ inflightPromises.set(key, promise);
256
+ }
257
+
258
+ /**
259
+ * Store the same in-flight Promise under multiple keys, recording them
260
+ * as sibling aliases. Consuming or clearing any one alias atomically
261
+ * removes every entry, guaranteeing the shared Response stream has a
262
+ * single consumer even when navigation looks up either key.
263
+ */
264
+ export function setInflightPromiseWithAliases(
265
+ keys: string[],
266
+ promise: Promise<Response | null>,
267
+ ): void {
268
+ for (const k of keys) {
269
+ inflightPromises.set(k, promise);
270
+ inflightAliases.set(k, keys);
271
+ }
272
+ }
273
+
139
274
  export function clearPrefetchInflight(key: string): void {
140
- inflight.delete(key);
275
+ forEachAlias(key, (k) => {
276
+ inflight.delete(k);
277
+ inflightPromises.delete(k);
278
+ inflightAliases.delete(k);
279
+ });
141
280
  }
142
281
 
143
282
  /**
144
283
  * Invalidate all prefetch state. Called when server actions mutate data.
145
284
  * Clears the in-memory cache, cancels in-flight prefetches, and rotates
146
285
  * the Rango state key so CDN-cached responses are also invalidated.
286
+ *
287
+ * Uses abortAllPrefetches (hard cancel) because in-flight responses
288
+ * may contain stale data after a mutation.
147
289
  */
148
290
  export function clearPrefetchCache(): void {
149
291
  generation++;
150
292
  inflight.clear();
293
+ inflightPromises.clear();
294
+ inflightAliases.clear();
151
295
  cache.clear();
152
- cancelAllPrefetches();
296
+ abortAllPrefetches();
153
297
  invalidateRangoState();
154
298
  }
299
+
300
+ /**
301
+ * Drop all in-memory prefetch state for this tab without rotating rango-state.
302
+ *
303
+ * Use for local-only invalidations (e.g. app switch in this tab) where
304
+ * other tabs should NOT observe a state rotation. Unlike clearPrefetchCache,
305
+ * does not call invalidateRangoState, so the shared X-Rango-State token
306
+ * stays intact and siblings in the old app keep their prefetches.
307
+ */
308
+ export function clearPrefetchCacheLocal(): void {
309
+ generation++;
310
+ inflight.clear();
311
+ inflightPromises.clear();
312
+ cache.clear();
313
+ abortAllPrefetches();
314
+ }