@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
@@ -249,16 +249,21 @@ export function onwarn(
249
249
  defaultHandler(warning);
250
250
  }
251
251
 
252
+ /**
253
+ * All of `browser/prefetch/` belongs to the eager "router" chunk — including
254
+ * the modules reachable only via loader.ts's dynamic import. #766 split those
255
+ * into a separate lazy chunk to trim the eager runtime (~2.3 KB gzip), but
256
+ * production's `defaultPrefetch: "viewport"` loads them on almost every page,
257
+ * so the split became a document -> router -> runtime request waterfall
258
+ * (measured 502 ms critical-path latency in a deployed worker). Same-chunk
259
+ * placement resolves the dynamic import without a network fetch
260
+ * (`Promise.resolve().then(...)` in the emitted chunk), and the merged chunk
261
+ * gzips smaller than the two chunks did apart. Do not re-split without new
262
+ * information (AGENTS.md, Bundle hygiene, rejected optimizations).
263
+ */
252
264
  export function getManualChunks(id: string): string | undefined {
253
265
  const normalized = Vite.normalizePath(id);
254
266
 
255
- if (
256
- /\/browser\/prefetch\/(?:runtime|fetch|queue|observer|policy|resource-ready)\.[cm]?[jt]sx?(?:[?#].*)?$/.test(
257
- normalized,
258
- )
259
- ) {
260
- return undefined;
261
- }
262
267
  if (
263
268
  normalized.includes("node_modules/react/") ||
264
269
  normalized.includes("node_modules/react-dom/") ||
@@ -1,127 +0,0 @@
1
- /**
2
- * Internal Types - Implementation Details
3
- *
4
- * @internal
5
- * These types are for internal use only and should not be relied upon by consumers.
6
- * They may change without notice between versions.
7
- *
8
- * If you find yourself needing these types, please open an issue to discuss
9
- * adding them to the public API.
10
- */
11
- /**
12
- * @internal
13
- * Internal representation of a resolved route segment.
14
- * Used during route matching and rendering pipeline.
15
- */
16
- export type { ResolvedSegment, SegmentMetadata } from "./types.js";
17
- /**
18
- * @internal
19
- * Internal match result from route resolution.
20
- */
21
- export type { MatchResult, SlotState } from "./types.js";
22
- /**
23
- * @internal
24
- * Context for intercept route selection.
25
- */
26
- export type { InterceptSelectorContext, InterceptSegmentsState, InterceptWhenFn, } from "./server/context.js";
27
- /**
28
- * @internal
29
- * RSC protocol payload structure.
30
- */
31
- export type { RscPayload, ReactFormState } from "./rsc/types.js";
32
- /**
33
- * @internal
34
- * Internal navigation store interface.
35
- */
36
- export type { NavigationStore, NavigationBridge, RscMetadata, ActionResult, InflightAction, NavigationState, TrackedActionState, ActionStateListener, SegmentCache, SegmentState, NavigationUpdate, } from "./browser/types.js";
37
- /**
38
- * @internal
39
- * Internal handle storage mechanism.
40
- */
41
- export type { HandleStore, HandleData } from "./server/handle-store.js";
42
- /**
43
- * @internal
44
- * Segment handle data in cache.
45
- */
46
- export type { SegmentHandleData } from "./cache/types.js";
47
- /**
48
- * @internal
49
- * Internal cache entry data structure.
50
- */
51
- export type { CachedEntryData, CacheGetResult, SerializedSegmentData, CacheDefaults, } from "./cache/types.js";
52
- /**
53
- * @internal
54
- * Router context for AsyncLocalStorage.
55
- */
56
- export type { RouterContext, RevalidationContext, InterceptResult, } from "./router/router-context.js";
57
- /**
58
- * @internal
59
- * Route match context during pipeline processing.
60
- */
61
- export type { MatchContext, MatchPipelineState, } from "./router/match-context.js";
62
- /**
63
- * @internal
64
- * Pattern matching result.
65
- */
66
- export type { RouteMatchResult } from "./router/pattern-matching.js";
67
- /**
68
- * @internal
69
- * Entry data during route traversal.
70
- */
71
- export type { EntryData, InterceptEntry, MetricsStore, PerformanceMetric, EntryCacheConfig, EntryPropCommon, EntryPropDatas, LoaderEntry, EntryPropSegments, } from "./server/context.js";
72
- /**
73
- * @internal
74
- * Internal handler context with additional props for router internals.
75
- * Includes `_currentSegmentId` and `_responseType`.
76
- */
77
- export type { InternalHandlerContext } from "./types.js";
78
- /**
79
- * @internal
80
- * Builds React element trees from route segments.
81
- */
82
- export { renderSegments } from "./segment-system.js";
83
- /**
84
- * @internal
85
- * Error sanitization and network error utilities.
86
- */
87
- export { sanitizeError, NetworkError, isNetworkError } from "./errors.js";
88
- /**
89
- * @internal
90
- * Scoped view of GeneratedRouteMap for Handler<"localName", ScopedRouteMap<"prefix">>.
91
- */
92
- export type { ScopedRouteMap } from "./types.js";
93
- /**
94
- * @internal
95
- * Type-level utilities for reverse URL generation.
96
- */
97
- export type { MergeRoutes, SanitizePrefix } from "./reverse.js";
98
- /**
99
- * @internal
100
- * Individual telemetry event types.
101
- */
102
- export type { RequestStartEvent, RequestEndEvent, RequestErrorEvent, RequestTimeoutEvent, LoaderStartEvent, LoaderEndEvent, LoaderErrorEvent, HandlerErrorEvent, CacheDecisionEvent, RevalidationDecisionEvent, } from "./router/telemetry.js";
103
- /**
104
- * @internal
105
- * Type guard for prerender handler definitions.
106
- */
107
- export { isPrerenderHandler, isPassthroughHandler } from "./prerender.js";
108
- /**
109
- * @internal
110
- * Type guard for static handler definitions.
111
- */
112
- export { isStaticHandler } from "./static-handler.js";
113
- /**
114
- * @internal
115
- * Sentinel used to tag response-type route entries.
116
- */
117
- export { RESPONSE_TYPE } from "./urls.js";
118
- /**
119
- * @internal
120
- * Debug utilities for route matching performance analysis.
121
- */
122
- export { enableMatchDebug, getMatchDebugStats, } from "./router/pattern-matching.js";
123
- /**
124
- * @internal
125
- * Debug utilities for manifest inspection and comparison.
126
- */
127
- export { serializeManifest, compareManifests, formatManifestDiff, type SerializedEntry, type SerializedManifest, } from "./debug.js";
@@ -1 +0,0 @@
1
- export {};
@@ -1,57 +0,0 @@
1
- import type { ActionEntry } from "./event-controller.js";
2
- /**
3
- * Post-reconciliation action outcome (discriminated union). Error and
4
- * full-update-unsupported cases are handled inline in the bridge before
5
- * reconciliation; this only covers successfully-reconciled partial responses.
6
- */
7
- type ActionScenario = {
8
- type: "navigated-away";
9
- historyKeyChanged: boolean;
10
- onInterceptRoute: boolean;
11
- } | {
12
- type: "hmr-missing";
13
- } | {
14
- type: "consolidation-needed";
15
- segmentIds: string[];
16
- } | {
17
- type: "concurrent-skip";
18
- otherFetchingCount: number;
19
- } | {
20
- type: "normal";
21
- };
22
- /**
23
- * Plain data inputs for classifying a post-reconciliation action outcome.
24
- * No browser objects or controller references — all values are snapshots.
25
- */
26
- export interface ActionOutcomeInput {
27
- /** This action's unique instance ID */
28
- handleId: string;
29
- /** All in-flight action entries (snapshot from event controller) */
30
- inflightActions: Map<string, ActionEntry>;
31
- /** Whether any concurrent actions occurred (controller-level shared flag) */
32
- hadAnyConcurrentActions: boolean;
33
- /** Segments revalidated by concurrent actions (from tracking set) */
34
- revalidatedSegments: Set<string>;
35
- /** window.location.pathname captured at action start */
36
- actionStartPathname: string;
37
- /** window.location.pathname at classification time */
38
- currentPathname: string;
39
- /** window.history.state?.key captured at action start */
40
- actionStartLocationKey: string | undefined;
41
- /** window.history.state?.key at classification time */
42
- currentLocationKey: string | undefined;
43
- /** Number of segments after reconciliation */
44
- reconciledSegmentCount: number;
45
- /** Number of matched segment IDs from server */
46
- matchedCount: number;
47
- /** Current intercept source URL (null when not on intercept route) */
48
- currentInterceptSource: string | null;
49
- }
50
- /**
51
- * Classify a post-reconciliation action outcome. Ordered priority chain: each
52
- * case assumes the earlier ones are false (e.g. concurrent-skip only applies on
53
- * the still-current route, consolidation only once no action is still fetching).
54
- * The bridge calls this to decide whether to render, skip, consolidate, or refetch.
55
- */
56
- export declare function classifyActionOutcome(input: ActionOutcomeInput): ActionScenario;
57
- export {};
@@ -1,33 +0,0 @@
1
- /**
2
- * Action fence: a refcounted flag that is raised while a server action is in
3
- * flight and lowered when it resolves.
4
- *
5
- * It replaces the eager cache clear the action bridge used to do at action
6
- * start. While the fence is up, the decision of whether the action invalidated
7
- * anything is deferred to the response:
8
- *
9
- * - prefetch consumption is suspended (a queued prefetch result is not served),
10
- * - a genuine navigation during the flight fetches with `cache: "no-store"` so
11
- * it cannot be served stale bytes from the browser's Vary-keyed HTTP cache,
12
- * - popstate reads are treated as stale-while-revalidate.
13
- *
14
- * Nothing is wiped, rotated, or broadcast while the fence is up — that is what
15
- * keeps a sibling tab from seeing a pre-commit signal. Refcounted so concurrent
16
- * actions compose: each action raises and lowers its own reference, and the
17
- * fence is down only when the count reaches zero.
18
- *
19
- * The refcount is a single module-level counter, not keyed by routerId.
20
- * Consumers (navigation-client.ts, prefetch/fetch.ts, navigation-bridge.ts)
21
- * read it unscoped, so an action in one router would suppress another router's
22
- * navigation/prefetch caches. This is correct only because two routers cannot
23
- * coexist in one live document: an SPA navigation crossing a host-router
24
- * boundary forces a full document reload (src/router/request-classification.ts
25
- * app-switch terminal), so there is always exactly one live router per
26
- * document. A future multi-router-in-one-document feature must not silently
27
- * inherit this global, cross-router cache suppression.
28
- */
29
- export declare function enterActionFence(): void;
30
- export declare function exitActionFence(): void;
31
- export declare function isActionFenceActive(): boolean;
32
- /** Test-only: reset the refcount between cases. */
33
- export declare function __resetActionFence(): void;
@@ -1,34 +0,0 @@
1
- import type { ComponentType, ReactNode } from "react";
2
- /**
3
- * App-shell metadata: the per-router fields describing the "envelope" around
4
- * the current app's segment tree — the rootLayout (Document), basename,
5
- * version, and router identity. Set once from the initial RSC payload and read
6
- * through the AppShellRef when rendering segments.
7
- *
8
- * This is a per-document value. A navigation that crosses a host-router app
9
- * boundary is a full document load (the server returns X-RSC-Reload for it;
10
- * see request-classification.ts, mode "app-switch"), so the target app's shell
11
- * — along with everything else document-level (theme, warmup, prefetch-TTL) —
12
- * is established fresh by the target app's own load. The shell is never swapped
13
- * in place within a session.
14
- */
15
- export interface AppShell {
16
- /** Router identity. Used to namespace per-app client state (e.g. the
17
- * rango-state localStorage key) so sibling apps on the same origin
18
- * cannot observe each other's cache invalidations. */
19
- routerId?: string;
20
- rootLayout?: ComponentType<{
21
- children: ReactNode;
22
- }>;
23
- basename?: string;
24
- version?: string;
25
- }
26
- /**
27
- * Container for the active app shell. Read-through via `get()` so closures
28
- * (e.g. the segment renderer) capture the ref and read the shell at call time
29
- * rather than closing over a stale snapshot.
30
- */
31
- export interface AppShellRef {
32
- get(): AppShell;
33
- }
34
- export declare function createAppShellRef(initial: AppShell): AppShellRef;
@@ -1,6 +0,0 @@
1
- /**
2
- * Mutable app version — updated after HMR revalidation.
3
- * Read by prefetch, navigation, and context code.
4
- */
5
- export declare function getAppVersion(): string | undefined;
6
- export declare function setAppVersion(version: string | undefined): void;
@@ -1,31 +0,0 @@
1
- /**
2
- * Connection warmup: keep TLS alive after idle periods.
3
- *
4
- * After IDLE_TIMEOUT of no user interaction the connection is marked "cold".
5
- * On the next pointer/touch interaction or a visibility change, a HEAD request
6
- * warms the TLS connection before the user actually clicks a link.
7
- *
8
- * Extracted from NavigationProvider so the idle/cold/warmup state machine is
9
- * unit-testable with an injected environment (document, fetch, timers).
10
- *
11
- * Ordering bug this guards against: the warmup listeners (mousemove/touchstart)
12
- * share events with the idle-reset listeners, and the idle-reset listener is
13
- * registered first, so it clears the live "cold" flag before the warmup
14
- * listener reads it on the same event. A separate coldLatch — set when the
15
- * connection goes cold and cleared only when warmup fires or listeners detach,
16
- * never by the idle reset — lets the warmup decision see the pre-reset cold
17
- * state regardless of listener ordering.
18
- */
19
- type TimerHandle = ReturnType<typeof setTimeout>;
20
- export interface WarmupEnv {
21
- doc: Pick<Document, "addEventListener" | "removeEventListener" | "visibilityState">;
22
- fetch: typeof fetch;
23
- setTimeout: (fn: () => void, ms: number) => TimerHandle;
24
- clearTimeout: (handle: TimerHandle | undefined) => void;
25
- }
26
- /**
27
- * Start the connection-warmup state machine. Returns a cleanup function that
28
- * cancels timers and removes all listeners.
29
- */
30
- export declare function startConnectionWarmup(env?: WarmupEnv): () => void;
31
- export {};
@@ -1,66 +0,0 @@
1
- /**
2
- * Rango state cookie: value codec and attribute serialization.
3
- *
4
- * Shared by the client (the document.cookie writer in rango-state.ts) and the
5
- * server (the Set-Cookie writer in invalidateClientCache). Environment-agnostic:
6
- * no window/document access and no name composition.
7
- *
8
- * Name RESOLUTION deliberately lives elsewhere (router init, see
9
- * router/state-cookie-name.ts). Keeping composition out of this shared module
10
- * is what lets the client read the server-resolved name verbatim and compose
11
- * nothing.
12
- */
13
- /** Default prefix when `stateCookiePrefix` is unset or empty after sanitization. */
14
- export declare const DEFAULT_STATE_COOKIE_PREFIX = "rango-state";
15
- /** Internal response header carrying the keepClientCache() directive. */
16
- export declare const KEEP_CACHE_HEADER = "x-rango-keep-cache";
17
- /** True for a per-client signal header. */
18
- export declare function isPerClientSignalHeader(name: string): boolean;
19
- /** True if `headers` carries any per-client signal. */
20
- export declare function hasPerClientSignal(headers: Headers): boolean;
21
- /** Remove every per-client signal header from `headers` in place. */
22
- export declare function stripPerClientSignals(headers: Headers): void;
23
- /**
24
- * Read the raw, UNDECODED value of a single cookie from a cookie string (a
25
- * `document.cookie` jar or a request `Cookie` header). Shared by both seats so
26
- * the client mirror and the server monotonic-guard read the SAME jar entry —
27
- * their agreement is the guard's contract. First match wins (the entry the
28
- * client's mirror holds); exact name boundary via the `=`; an empty value
29
- * (`name=`) returns null (treated as absent, not a usable prior value).
30
- */
31
- export declare function getRawCookieValue(cookieString: string | null, name: string): string | null;
32
- /**
33
- * Encode a state value for the wire: `encodeURIComponent(version):timestamp`.
34
- * Only the build-derived version is encoded (it is arbitrary); the `:`
35
- * separator and numeric timestamp stay raw, so the `{version}:{timestamp}`
36
- * shape survives and `:` is a legal cookie-value octet.
37
- */
38
- export declare function encodeStateValue(version: string, timestamp: number): string;
39
- /** Parsed state value. `version` is decoded; `timestamp` is the raw integer. */
40
- export interface StateValue {
41
- version: string;
42
- timestamp: number;
43
- }
44
- /**
45
- * Decode a wire value back into `{version, timestamp}`. Returns null for a
46
- * malformed value (no `:`, empty version, or non-numeric timestamp) so callers
47
- * mint fresh instead of trusting garbage.
48
- */
49
- export declare function decodeStateValue(raw: string): StateValue | null;
50
- /**
51
- * Mint a fresh state value whose timestamp is strictly greater than the previous
52
- * one, so a re-mint inside the same millisecond (or a backward clock step) still
53
- * differs from the current value. `prevRaw` is the current wire value (the
54
- * client's in-memory mirror, or the server's inbound header/cookie) or null; its
55
- * timestamp is the floor. Shared by both seats so the monotonic guard lives once.
56
- */
57
- export declare function mintStateValue(version: string, prevRaw: string | null): string;
58
- /**
59
- * Attribute string for the state cookie. Session cookie (no Max-Age/Expires),
60
- * Path=/ (whole app), SameSite=Lax (sent on top-level navigations), and Secure
61
- * only on https so the document.cookie write does not silently fail on plain
62
- * http dev. Never HttpOnly (the client reads and writes it).
63
- */
64
- export declare function stateCookieAttributes(secure: boolean): string;
65
- /** Serialize a full `name=value` cookie string with the state attributes. */
66
- export declare function serializeStateCookie(name: string, value: string, secure: boolean): string;
@@ -1,221 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { NavigationLocation, NavigateOptions, TrackedActionState, InflightAction, RscMetadata, HandleData, StreamingToken } from "./types.js";
3
- /**
4
- * Phase of a navigation operation
5
- */
6
- export type NavigationPhase = "fetching" | "streaming";
7
- /**
8
- * Phase of an action operation
9
- */
10
- export type ActionPhase = "fetching" | "streaming" | "settling";
11
- /**
12
- * Entry tracking an in-flight navigation
13
- */
14
- export interface NavigationEntry {
15
- url: string;
16
- abort: AbortController;
17
- phase: NavigationPhase;
18
- startedAt: number;
19
- options?: NavigateOptions & {
20
- skipLoadingState?: boolean;
21
- };
22
- }
23
- /**
24
- * Entry tracking an in-flight action
25
- */
26
- export interface ActionEntry {
27
- /** Unique instance ID for this action invocation */
28
- id: string;
29
- /** Server action function ID (normalized name like "addToCart") */
30
- actionId: string;
31
- /** Abort controller for this action */
32
- abort: AbortController;
33
- /** Current phase of the action */
34
- phase: ActionPhase;
35
- /** Action arguments */
36
- payload: unknown[];
37
- /** Result from action (set on completion) */
38
- result?: unknown;
39
- /** Error from action (set on failure) */
40
- error?: unknown;
41
- /** Segment IDs that were revalidated by this action */
42
- revalidatedSegments: string[];
43
- /** Timestamp when action started */
44
- startedAt: number;
45
- /** Whether action processing is complete (may still be streaming) */
46
- completed?: boolean;
47
- }
48
- /**
49
- * Derived navigation state (computed from source of truth)
50
- */
51
- export interface DerivedNavigationState {
52
- /** Navigation lifecycle state */
53
- state: "idle" | "loading";
54
- /** Whether any operation is streaming */
55
- isStreaming: boolean;
56
- /** Whether a navigation is active (fetching or streaming, before commit) */
57
- isNavigating: boolean;
58
- /** Current committed location */
59
- location: NavigationLocation;
60
- /** URL being navigated to (null if idle) */
61
- pendingUrl: string | null;
62
- /** List of inflight actions (for compatibility) */
63
- inflightActions: InflightAction[];
64
- }
65
- /**
66
- * Callback for UI updates when root should re-render
67
- */
68
- export type UpdateCallback = (update: {
69
- root: ReactNode | Promise<ReactNode>;
70
- metadata: RscMetadata;
71
- }) => void;
72
- /**
73
- * State change listener
74
- */
75
- export type StateListener = () => void;
76
- /**
77
- * Action state listener
78
- */
79
- export type ActionStateListener = (state: TrackedActionState) => void;
80
- /**
81
- * Handle state listener
82
- */
83
- export type HandleListener = () => void;
84
- /**
85
- * Internal handle state stored in controller.
86
- *
87
- * Two segment lists are exposed because they serve different consumers:
88
- *
89
- * - `segmentOrder` drives handle collection (collectHandleData). Includes
90
- * parallel slot ids and reorders them after their parent so later-wins
91
- * collect functions (e.g. Meta) get the right precedence.
92
- * - `routeSegmentIds` is the layouts-and-routes-only list documented by
93
- * `useSegments().segmentIds`. Parallels and loader sub-ids are stripped;
94
- * raw matched order is preserved.
95
- *
96
- * Both are derived from the same `matched` input on each setHandleData call
97
- * so they stay in sync.
98
- */
99
- export interface HandleState {
100
- data: HandleData;
101
- segmentOrder: string[];
102
- routeSegmentIds: string[];
103
- }
104
- /**
105
- * Result from starting a navigation
106
- * Implements Disposable for use with `using` keyword
107
- */
108
- export interface NavigationHandle extends Disposable {
109
- /** Abort controller for this navigation */
110
- abort: AbortController;
111
- /** Signal for this navigation */
112
- signal: AbortSignal;
113
- /** Start streaming and get a token to end it later */
114
- startStreaming(): StreamingToken;
115
- /** Complete the navigation successfully */
116
- complete(location: NavigationLocation): void;
117
- /** Whether navigation was completed successfully */
118
- readonly completed: boolean;
119
- }
120
- /**
121
- * Result from starting an action
122
- * Implements Disposable for use with `using` keyword
123
- */
124
- export interface ActionHandle extends Disposable {
125
- /** Unique instance ID */
126
- id: string;
127
- /** Abort controller for this action */
128
- abort: AbortController;
129
- /** Signal for this action */
130
- signal: AbortSignal;
131
- /** Start streaming and get a token to end it later */
132
- startStreaming(): StreamingToken;
133
- /** Record segments that were revalidated */
134
- recordRevalidatedSegments(segmentIds: string[]): void;
135
- /**
136
- * Claim the subset of a location-state payload this action may write. A key
137
- * is claimed only if no later-initiated action in the SAME cohort has already
138
- * claimed it, so same-key concurrent writes resolve to the last-initiated
139
- * action while distinct keys from every action survive. Recording the claim
140
- * stops a later-settling earlier action from overwriting it. Arbitration is
141
- * scoped to the action's cohort (its originating history entry, captured at
142
- * startAction), so an action on one entry cannot suppress an action on
143
- * another that happens to write the same slot.
144
- *
145
- * Contract: this guarantees the FINAL value is the last-initiated action's,
146
- * not that the loser is never momentarily visible. When an earlier-initiated
147
- * action settles first, its value is merged and observable until the
148
- * later-initiated winner's response lands and overwrites it.
149
- */
150
- claimLocationState(state: Record<string, unknown>): Record<string, unknown>;
151
- /** Complete the action with result */
152
- complete(result?: unknown): void;
153
- /** Fail the action with error */
154
- fail(error: unknown): void;
155
- /** Whether action was completed (success or failure) */
156
- readonly settled: boolean;
157
- /** Check if any concurrent actions were started */
158
- hadConcurrentActions: boolean;
159
- /** Get raw set of segments revalidated by concurrent actions */
160
- getRevalidatedSegments(): Set<string>;
161
- /** Clear consolidation tracking */
162
- clearConsolidation(): void;
163
- }
164
- /**
165
- * Event controller interface
166
- */
167
- export interface EventController {
168
- startNavigation(url: string, options?: NavigateOptions & {
169
- skipLoadingState?: boolean;
170
- }): NavigationHandle;
171
- abortNavigation(): void;
172
- startAction(actionId: string, args: unknown[],
173
- /** Originating history entry key; scopes location-state arbitration. */
174
- cohort?: string): ActionHandle;
175
- abortAllActions(): void;
176
- getState(): DerivedNavigationState;
177
- getActionState(actionId: string): TrackedActionState;
178
- getLocation(): NavigationLocation;
179
- setLocation(location: NavigationLocation): void;
180
- subscribe(listener: StateListener): () => void;
181
- subscribeToAction(actionId: string, listener: ActionStateListener): () => void;
182
- subscribeToHandles(listener: HandleListener): () => void;
183
- setHandleData(data: HandleData, matched?: string[], isPartial?: boolean,
184
- /**
185
- * Segment ids that were re-resolved on the server this request (the
186
- * partial response's `diff`). On a partial update, any existing bucket
187
- * keyed under one of these ids that has no incoming entry is treated as
188
- * stale and cleared. Without this, a parallel slot that revalidates but
189
- * pushes nothing leaves its previous bucket in place forever.
190
- */
191
- resolvedIds?: string[]): void;
192
- getHandleState(): HandleState;
193
- /**
194
- * Update ONLY `routeSegmentIds` (what `useSegments` reads) from `matched`,
195
- * leaving `data` and `segmentOrder` (what `useHandle` collects over) untouched.
196
- * Used while a deferred handle is resolving: the route has changed (so
197
- * `useSegments` must reflect the new segment ids) but `useHandle` still holds
198
- * its previous value until the deferred snapshot is applied.
199
- */
200
- setRouteSegmentIds(matched: string[]): void;
201
- setParams(params: Record<string, string>): void;
202
- getParams(): Record<string, string>;
203
- getCurrentNavigation(): NavigationEntry | null;
204
- getInflightActions(): Map<string, ActionEntry>;
205
- /** Whether any concurrent actions have occurred (shared across all handles) */
206
- hadAnyConcurrentActions(): boolean;
207
- }
208
- export interface EventControllerConfig {
209
- initialLocation?: NavigationLocation;
210
- }
211
- /**
212
- * Create an event controller for managing navigation and action state
213
- *
214
- * The controller uses a reactive model where:
215
- * - Source of truth: currentNavigation, inflightActions, location
216
- * - Derived state: navState, isStreaming computed from source
217
- *
218
- * Navigation uses switchMap semantics (new nav cancels previous).
219
- * Actions use mergeMap semantics (all run concurrently, consolidate at end).
220
- */
221
- export declare function createEventController(config?: EventControllerConfig): EventController;
@@ -1,26 +0,0 @@
1
- /**
2
- * Resolve navigation state - handles both LocationStateEntry[] and plain formats
3
- */
4
- export declare function resolveNavigationState(state: unknown): unknown;
5
- /**
6
- * Build history state object from user state
7
- * - Typed state: spread directly into history.state
8
- * - Plain state: store in history.state.state
9
- */
10
- export declare function buildHistoryState(userState: unknown, routerState?: {
11
- intercept?: boolean;
12
- sourceUrl?: string;
13
- }, serverState?: Record<string, unknown>): Record<string, unknown> | null;
14
- /**
15
- * Stamp an `idx` on the next history entry's state and call push/replaceState.
16
- * Push increments the current idx; replace keeps it. Initial entry idx is 0.
17
- * Used by useRouter().back() to detect "first entry in this session" without
18
- * relying on the Navigation API.
19
- */
20
- export declare function pushHistoryWithIdx(state: Record<string, unknown> | null, url: string, replace: boolean): void;
21
- /**
22
- * Merge server-set location state into the current history entry.
23
- * Replaces the current history state and dispatches notification event
24
- * so useLocationState hooks re-read from history.state.
25
- */
26
- export declare function mergeLocationState(locationState: Record<string, unknown>): void;
@@ -1 +0,0 @@
1
- export { initBrowserApp, Rango, type InitBrowserAppOptions, } from "./rsc-router.js";
@@ -1,30 +0,0 @@
1
- import type { ResolvedSegment } from "./types.js";
2
- import type { SlotState } from "../types.js";
3
- /**
4
- * Check if a segment is an intercept segment.
5
- * Intercept segments have namespace starting with "intercept:" — both the
6
- * parallel container (@modal) and its content children receive this namespace
7
- * from intercept-resolution.ts. Regular parallel segments like @sidebar do not.
8
- */
9
- export declare function isInterceptSegment(s: ResolvedSegment): boolean;
10
- /**
11
- * Split an array of segments into main and intercept groups.
12
- * Intercept segments are separated for explicit injection into the render tree
13
- * via the interceptSegments render option.
14
- */
15
- export declare function splitInterceptSegments(segments: ResolvedSegment[]): {
16
- main: ResolvedSegment[];
17
- intercept: ResolvedSegment[];
18
- };
19
- /**
20
- * Check if any slot is currently active (has content to render).
21
- * Active slots indicate an intercept response where a parallel segment
22
- * (e.g., @modal) has matched and should be rendered.
23
- */
24
- export declare function hasActiveIntercept(slots?: Record<string, SlotState>): boolean;
25
- /**
26
- * Check if cached segments contain any intercept segments.
27
- * Intercept caches shouldn't be used for cached SWR rendering since
28
- * whether interception happens depends on the current page context.
29
- */
30
- export declare function isInterceptOnlyCache(segments: ResolvedSegment[]): boolean;