@rangojs/router 0.2.0 → 0.4.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 (435) hide show
  1. package/dist/types/browser/prefetch/default-strategy.d.ts +22 -0
  2. package/dist/types/browser/prefetch/runtime.d.ts +0 -1
  3. package/dist/types/browser/react/Link.d.ts +8 -11
  4. package/dist/types/browser/types.d.ts +5 -0
  5. package/dist/types/cache/types.d.ts +6 -0
  6. package/dist/types/router/prefetch-default.d.ts +28 -0
  7. package/dist/types/router/router-interfaces.d.ts +7 -0
  8. package/dist/types/router/router-options.d.ts +30 -0
  9. package/dist/types/rsc/capture-queue.d.ts +6 -0
  10. package/dist/types/rsc/shell-capture.d.ts +15 -7
  11. package/dist/types/rsc/shell-serve.d.ts +4 -3
  12. package/dist/types/rsc/types.d.ts +2 -0
  13. package/dist/types/testing/e2e/index.d.ts +2 -2
  14. package/dist/types/testing/e2e/page-helpers.d.ts +24 -0
  15. package/dist/types.backup/__internal.d.ts +127 -0
  16. package/dist/types.backup/bin/rango.d.ts +1 -0
  17. package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
  18. package/dist/types.backup/browser/action-fence.d.ts +33 -0
  19. package/dist/types.backup/browser/app-shell.d.ts +34 -0
  20. package/dist/types.backup/browser/app-version.d.ts +6 -0
  21. package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
  22. package/dist/types.backup/browser/cookie-name.d.ts +66 -0
  23. package/dist/types.backup/browser/event-controller.d.ts +221 -0
  24. package/dist/types.backup/browser/history-state.d.ts +26 -0
  25. package/dist/types.backup/browser/index.d.ts +1 -0
  26. package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
  27. package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
  28. package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
  29. package/dist/types.backup/browser/logging.d.ts +33 -0
  30. package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
  31. package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
  32. package/dist/types.backup/browser/navigation-client.d.ts +17 -0
  33. package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
  34. package/dist/types.backup/browser/navigation-store.d.ts +95 -0
  35. package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
  36. package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
  37. package/dist/types.backup/browser/partial-update.d.ts +61 -0
  38. package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
  39. package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
  40. package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
  41. package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
  42. package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
  43. package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
  44. package/dist/types.backup/browser/rango-state.d.ts +52 -0
  45. package/dist/types.backup/browser/react/Link.d.ts +140 -0
  46. package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
  47. package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
  48. package/dist/types.backup/browser/react/context.d.ts +54 -0
  49. package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
  50. package/dist/types.backup/browser/react/index.d.ts +1 -0
  51. package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
  52. package/dist/types.backup/browser/react/location-state.d.ts +29 -0
  53. package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
  54. package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
  55. package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
  56. package/dist/types.backup/browser/react/use-action.d.ts +61 -0
  57. package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
  58. package/dist/types.backup/browser/react/use-href.d.ts +32 -0
  59. package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
  60. package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
  61. package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
  62. package/dist/types.backup/browser/react/use-params.d.ts +21 -0
  63. package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
  64. package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
  65. package/dist/types.backup/browser/react/use-router.d.ts +23 -0
  66. package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
  67. package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
  68. package/dist/types.backup/browser/response-adapter.d.ts +58 -0
  69. package/dist/types.backup/browser/rsc-router.d.ts +141 -0
  70. package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
  71. package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
  72. package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
  73. package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
  74. package/dist/types.backup/browser/types.d.ts +530 -0
  75. package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
  76. package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
  77. package/dist/types.backup/build/generate-manifest.d.ts +100 -0
  78. package/dist/types.backup/build/generate-route-types.d.ts +8 -0
  79. package/dist/types.backup/build/index.d.ts +21 -0
  80. package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
  81. package/dist/types.backup/build/route-trie.d.ts +89 -0
  82. package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
  83. package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
  84. package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
  85. package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
  86. package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
  87. package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
  88. package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
  89. package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
  90. package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
  91. package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
  92. package/dist/types.backup/cache/background-task.d.ts +21 -0
  93. package/dist/types.backup/cache/cache-error.d.ts +71 -0
  94. package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
  95. package/dist/types.backup/cache/cache-policy.d.ts +59 -0
  96. package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
  97. package/dist/types.backup/cache/cache-scope.d.ts +134 -0
  98. package/dist/types.backup/cache/cache-tag.d.ts +79 -0
  99. package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
  100. package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
  101. package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
  102. package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
  103. package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
  104. package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
  105. package/dist/types.backup/cache/cf/index.d.ts +3 -0
  106. package/dist/types.backup/cache/document-cache.d.ts +69 -0
  107. package/dist/types.backup/cache/handle-capture.d.ts +23 -0
  108. package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
  109. package/dist/types.backup/cache/index.d.ts +7 -0
  110. package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
  111. package/dist/types.backup/cache/profile-registry.d.ts +40 -0
  112. package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
  113. package/dist/types.backup/cache/segment-codec.d.ts +78 -0
  114. package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
  115. package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
  116. package/dist/types.backup/cache/taint.d.ts +71 -0
  117. package/dist/types.backup/cache/types.d.ts +407 -0
  118. package/dist/types.backup/cache/vercel/index.d.ts +1 -0
  119. package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
  120. package/dist/types.backup/client.d.ts +184 -0
  121. package/dist/types.backup/client.rsc.d.ts +39 -0
  122. package/dist/types.backup/cloudflare/index.d.ts +7 -0
  123. package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
  124. package/dist/types.backup/component-utils.d.ts +46 -0
  125. package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
  126. package/dist/types.backup/context-var.d.ts +84 -0
  127. package/dist/types.backup/debug.d.ts +57 -0
  128. package/dist/types.backup/decode-loader-results.d.ts +5 -0
  129. package/dist/types.backup/default-error-boundary.d.ts +10 -0
  130. package/dist/types.backup/defer.d.ts +89 -0
  131. package/dist/types.backup/deps/browser.d.ts +1 -0
  132. package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
  133. package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
  134. package/dist/types.backup/deps/rsc.d.ts +1 -0
  135. package/dist/types.backup/deps/ssr.d.ts +1 -0
  136. package/dist/types.backup/encode-kv.d.ts +35 -0
  137. package/dist/types.backup/errors.d.ts +226 -0
  138. package/dist/types.backup/escape-script.d.ts +44 -0
  139. package/dist/types.backup/handle.d.ts +93 -0
  140. package/dist/types.backup/handles/MetaTags.d.ts +17 -0
  141. package/dist/types.backup/handles/Scripts.d.ts +38 -0
  142. package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
  143. package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
  144. package/dist/types.backup/handles/is-thenable.d.ts +12 -0
  145. package/dist/types.backup/handles/meta.d.ts +43 -0
  146. package/dist/types.backup/handles/script.d.ts +139 -0
  147. package/dist/types.backup/host/cookie-handler.d.ts +8 -0
  148. package/dist/types.backup/host/errors.d.ts +40 -0
  149. package/dist/types.backup/host/index.d.ts +33 -0
  150. package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
  151. package/dist/types.backup/host/router.d.ts +12 -0
  152. package/dist/types.backup/host/testing.d.ts +41 -0
  153. package/dist/types.backup/host/types.d.ts +148 -0
  154. package/dist/types.backup/host/utils.d.ts +20 -0
  155. package/dist/types.backup/href-client.d.ts +214 -0
  156. package/dist/types.backup/index.d.ts +112 -0
  157. package/dist/types.backup/index.rsc.d.ts +51 -0
  158. package/dist/types.backup/internal-debug.d.ts +1 -0
  159. package/dist/types.backup/loader-store.d.ts +193 -0
  160. package/dist/types.backup/loader.d.ts +18 -0
  161. package/dist/types.backup/loader.rsc.d.ts +18 -0
  162. package/dist/types.backup/missing-id-error.d.ts +1 -0
  163. package/dist/types.backup/outlet-context.d.ts +12 -0
  164. package/dist/types.backup/outlet-provider.d.ts +12 -0
  165. package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
  166. package/dist/types.backup/prerender/param-hash.d.ts +6 -0
  167. package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
  168. package/dist/types.backup/prerender/store.d.ts +62 -0
  169. package/dist/types.backup/prerender.d.ts +292 -0
  170. package/dist/types.backup/redirect-origin.d.ts +55 -0
  171. package/dist/types.backup/regex-escape.d.ts +6 -0
  172. package/dist/types.backup/render-error-thrower.d.ts +13 -0
  173. package/dist/types.backup/response-utils.d.ts +35 -0
  174. package/dist/types.backup/reverse.d.ts +206 -0
  175. package/dist/types.backup/root-error-boundary.d.ts +32 -0
  176. package/dist/types.backup/route-content-wrapper.d.ts +40 -0
  177. package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
  178. package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
  179. package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
  180. package/dist/types.backup/route-definition/index.d.ts +7 -0
  181. package/dist/types.backup/route-definition/redirect.d.ts +48 -0
  182. package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
  183. package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
  184. package/dist/types.backup/route-definition.d.ts +1 -0
  185. package/dist/types.backup/route-map-builder.d.ts +127 -0
  186. package/dist/types.backup/route-name.d.ts +27 -0
  187. package/dist/types.backup/route-types.d.ts +172 -0
  188. package/dist/types.backup/router/basename.d.ts +10 -0
  189. package/dist/types.backup/router/content-negotiation.d.ts +91 -0
  190. package/dist/types.backup/router/debug-manifest.d.ts +7 -0
  191. package/dist/types.backup/router/error-handling.d.ts +76 -0
  192. package/dist/types.backup/router/find-match.d.ts +19 -0
  193. package/dist/types.backup/router/handler-context.d.ts +41 -0
  194. package/dist/types.backup/router/instrument.d.ts +161 -0
  195. package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
  196. package/dist/types.backup/router/lazy-includes.d.ts +26 -0
  197. package/dist/types.backup/router/loader-resolution.d.ts +63 -0
  198. package/dist/types.backup/router/logging.d.ts +41 -0
  199. package/dist/types.backup/router/manifest.d.ts +8 -0
  200. package/dist/types.backup/router/match-api.d.ts +19 -0
  201. package/dist/types.backup/router/match-context.d.ts +184 -0
  202. package/dist/types.backup/router/match-handlers.d.ts +49 -0
  203. package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
  204. package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
  205. package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
  206. package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
  207. package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
  208. package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
  209. package/dist/types.backup/router/match-pipelines.d.ts +103 -0
  210. package/dist/types.backup/router/match-result.d.ts +114 -0
  211. package/dist/types.backup/router/metrics.d.ts +6 -0
  212. package/dist/types.backup/router/middleware-types.d.ts +74 -0
  213. package/dist/types.backup/router/middleware.d.ts +116 -0
  214. package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
  215. package/dist/types.backup/router/params-util.d.ts +8 -0
  216. package/dist/types.backup/router/parse-pattern.d.ts +38 -0
  217. package/dist/types.backup/router/pattern-matching.d.ts +169 -0
  218. package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
  219. package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
  220. package/dist/types.backup/router/prerender-match.d.ts +50 -0
  221. package/dist/types.backup/router/preview-match.d.ts +22 -0
  222. package/dist/types.backup/router/request-classification.d.ts +104 -0
  223. package/dist/types.backup/router/revalidation.d.ts +57 -0
  224. package/dist/types.backup/router/route-snapshot.d.ts +112 -0
  225. package/dist/types.backup/router/router-context.d.ts +137 -0
  226. package/dist/types.backup/router/router-interfaces.d.ts +432 -0
  227. package/dist/types.backup/router/router-options.d.ts +738 -0
  228. package/dist/types.backup/router/router-registry.d.ts +15 -0
  229. package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
  230. package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
  231. package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
  232. package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
  233. package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
  234. package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
  235. package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
  236. package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
  237. package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
  238. package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
  239. package/dist/types.backup/router/segment-resolution.d.ts +3 -0
  240. package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
  241. package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
  242. package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
  243. package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
  244. package/dist/types.backup/router/telemetry.d.ts +215 -0
  245. package/dist/types.backup/router/timeout.d.ts +68 -0
  246. package/dist/types.backup/router/tracing.d.ts +125 -0
  247. package/dist/types.backup/router/trie-matching.d.ts +32 -0
  248. package/dist/types.backup/router/types.d.ts +98 -0
  249. package/dist/types.backup/router/url-params.d.ts +26 -0
  250. package/dist/types.backup/router.d.ts +7 -0
  251. package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
  252. package/dist/types.backup/rsc/full-payload.d.ts +22 -0
  253. package/dist/types.backup/rsc/handler-context.d.ts +31 -0
  254. package/dist/types.backup/rsc/handler.d.ts +9 -0
  255. package/dist/types.backup/rsc/helpers.d.ts +213 -0
  256. package/dist/types.backup/rsc/index.d.ts +17 -0
  257. package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
  258. package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
  259. package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
  260. package/dist/types.backup/rsc/nonce.d.ts +28 -0
  261. package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
  262. package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
  263. package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
  264. package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
  265. package/dist/types.backup/rsc/response-error.d.ts +19 -0
  266. package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
  267. package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
  268. package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
  269. package/dist/types.backup/rsc/server-action.d.ts +68 -0
  270. package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
  271. package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
  272. package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
  273. package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
  274. package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
  275. package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
  276. package/dist/types.backup/rsc/types.d.ts +290 -0
  277. package/dist/types.backup/runtime-env.d.ts +1 -0
  278. package/dist/types.backup/search-params.d.ts +125 -0
  279. package/dist/types.backup/segment-content-promise.d.ts +13 -0
  280. package/dist/types.backup/segment-fragments.d.ts +56 -0
  281. package/dist/types.backup/segment-loader-promise.d.ts +22 -0
  282. package/dist/types.backup/segment-system.d.ts +84 -0
  283. package/dist/types.backup/serialize.d.ts +164 -0
  284. package/dist/types.backup/server/context.d.ts +494 -0
  285. package/dist/types.backup/server/cookie-parse.d.ts +10 -0
  286. package/dist/types.backup/server/cookie-store.d.ts +107 -0
  287. package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
  288. package/dist/types.backup/server/handle-store.d.ts +100 -0
  289. package/dist/types.backup/server/loader-registry.d.ts +32 -0
  290. package/dist/types.backup/server/request-context.d.ts +596 -0
  291. package/dist/types.backup/server/root-layout.d.ts +3 -0
  292. package/dist/types.backup/server.d.ts +15 -0
  293. package/dist/types.backup/ssr/index.d.ts +233 -0
  294. package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
  295. package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
  296. package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
  297. package/dist/types.backup/static-handler.d.ts +57 -0
  298. package/dist/types.backup/testing/cache-status.d.ts +63 -0
  299. package/dist/types.backup/testing/collect-handle.d.ts +20 -0
  300. package/dist/types.backup/testing/dispatch.d.ts +123 -0
  301. package/dist/types.backup/testing/dom.entry.d.ts +15 -0
  302. package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
  303. package/dist/types.backup/testing/e2e/index.d.ts +30 -0
  304. package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
  305. package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
  306. package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
  307. package/dist/types.backup/testing/e2e/server.d.ts +35 -0
  308. package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
  309. package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
  310. package/dist/types.backup/testing/flight-tree.d.ts +192 -0
  311. package/dist/types.backup/testing/flight.d.ts +115 -0
  312. package/dist/types.backup/testing/flight.entry.d.ts +27 -0
  313. package/dist/types.backup/testing/generated-routes.d.ts +66 -0
  314. package/dist/types.backup/testing/index.d.ts +52 -0
  315. package/dist/types.backup/testing/internal/context.d.ts +225 -0
  316. package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
  317. package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
  318. package/dist/types.backup/testing/render-handler.d.ts +160 -0
  319. package/dist/types.backup/testing/render-route.d.ts +246 -0
  320. package/dist/types.backup/testing/run-loader.d.ts +186 -0
  321. package/dist/types.backup/testing/run-middleware.d.ts +132 -0
  322. package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
  323. package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
  324. package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
  325. package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
  326. package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
  327. package/dist/types.backup/testing/vitest.d.ts +205 -0
  328. package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
  329. package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
  330. package/dist/types.backup/theme/constants.d.ts +39 -0
  331. package/dist/types.backup/theme/index.d.ts +29 -0
  332. package/dist/types.backup/theme/theme-context.d.ts +21 -0
  333. package/dist/types.backup/theme/theme-script.d.ts +26 -0
  334. package/dist/types.backup/theme/types.d.ts +162 -0
  335. package/dist/types.backup/theme/use-theme.d.ts +8 -0
  336. package/dist/types.backup/types/boundaries.d.ts +93 -0
  337. package/dist/types.backup/types/cache-types.d.ts +191 -0
  338. package/dist/types.backup/types/error-types.d.ts +114 -0
  339. package/dist/types.backup/types/global-namespace.d.ts +90 -0
  340. package/dist/types.backup/types/handler-context.d.ts +658 -0
  341. package/dist/types.backup/types/index.d.ts +11 -0
  342. package/dist/types.backup/types/loader-types.d.ts +182 -0
  343. package/dist/types.backup/types/request-scope.d.ts +93 -0
  344. package/dist/types.backup/types/route-config.d.ts +105 -0
  345. package/dist/types.backup/types/route-entry.d.ts +95 -0
  346. package/dist/types.backup/types/segments.d.ts +234 -0
  347. package/dist/types.backup/types.d.ts +1 -0
  348. package/dist/types.backup/urls/include-helper.d.ts +17 -0
  349. package/dist/types.backup/urls/include-provider.d.ts +27 -0
  350. package/dist/types.backup/urls/index.d.ts +6 -0
  351. package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
  352. package/dist/types.backup/urls/path-helper.d.ts +12 -0
  353. package/dist/types.backup/urls/pattern-types.d.ts +166 -0
  354. package/dist/types.backup/urls/response-types.d.ts +67 -0
  355. package/dist/types.backup/urls/type-extraction.d.ts +157 -0
  356. package/dist/types.backup/urls/urls-function.d.ts +24 -0
  357. package/dist/types.backup/urls.d.ts +1 -0
  358. package/dist/types.backup/use-loader.d.ts +150 -0
  359. package/dist/types.backup/vercel/index.d.ts +10 -0
  360. package/dist/types.backup/vercel/tracing.d.ts +70 -0
  361. package/dist/types.backup/vite/debug.d.ts +80 -0
  362. package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
  363. package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
  364. package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
  365. package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
  366. package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
  367. package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
  368. package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
  369. package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
  370. package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
  371. package/dist/types.backup/vite/discovery/state.d.ts +162 -0
  372. package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
  373. package/dist/types.backup/vite/index.d.ts +11 -0
  374. package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
  375. package/dist/types.backup/vite/plugin-types.d.ts +298 -0
  376. package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
  377. package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
  378. package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
  379. package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
  380. package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
  381. package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
  382. package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
  383. package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
  384. package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
  385. package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
  386. package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
  387. package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
  388. package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
  389. package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
  390. package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
  391. package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
  392. package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
  393. package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
  394. package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
  395. package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
  396. package/dist/types.backup/vite/rango.d.ts +29 -0
  397. package/dist/types.backup/vite/router-discovery.d.ts +23 -0
  398. package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
  399. package/dist/types.backup/vite/utils/banner.d.ts +2 -0
  400. package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
  401. package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
  402. package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
  403. package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
  404. package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
  405. package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
  406. package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
  407. package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
  408. package/dist/vite/index.js +5 -2
  409. package/package.json +1 -1
  410. package/skills/comparison/references/framework-comparison.md +2 -1
  411. package/skills/ppr/SKILL.md +28 -13
  412. package/skills/router-setup/SKILL.md +4 -0
  413. package/src/browser/prefetch/default-strategy.ts +34 -0
  414. package/src/browser/prefetch/loader.ts +6 -12
  415. package/src/browser/prefetch/runtime.ts +0 -1
  416. package/src/browser/react/Link.tsx +22 -21
  417. package/src/browser/rsc-router.tsx +8 -0
  418. package/src/browser/types.ts +5 -0
  419. package/src/cache/cf/cf-cache-store.ts +4 -0
  420. package/src/cache/types.ts +6 -0
  421. package/src/cache/vercel/vercel-cache-store.ts +6 -1
  422. package/src/router/prefetch-default.ts +59 -0
  423. package/src/router/router-interfaces.ts +8 -0
  424. package/src/router/router-options.ts +31 -0
  425. package/src/router.ts +7 -0
  426. package/src/rsc/capture-queue.ts +24 -1
  427. package/src/rsc/full-payload.ts +1 -0
  428. package/src/rsc/handler.ts +1 -0
  429. package/src/rsc/rsc-rendering.ts +120 -18
  430. package/src/rsc/shell-capture.ts +94 -50
  431. package/src/rsc/shell-serve.ts +6 -4
  432. package/src/rsc/types.ts +2 -0
  433. package/src/testing/e2e/index.ts +6 -0
  434. package/src/testing/e2e/page-helpers.ts +47 -0
  435. package/src/testing/e2e/parity.ts +13 -0
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from "vite";
2
+ export { exposeRouterId } from "./expose-ids/router-transform.js";
3
+ export type { ExposeInternalIdsApi } from "./expose-ids/types.js";
4
+ export declare function exposeInternalIds(options?: {
5
+ forceBuild?: boolean;
6
+ }): Plugin;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * React Performance Tracks — RSDW client patch
3
+ *
4
+ * Patches the RSDW client so _debugInfo recovery works for plain-object
5
+ * payloads (our RscPayload shape). Without this, the Server Components
6
+ * track in Chrome DevTools stays empty.
7
+ *
8
+ * React's flushComponentPerformance uses splice(0) to empty _debugInfo
9
+ * after resolution, then recovers it from the resolved value — but only
10
+ * for arrays, async iterables, React elements, and lazy types. Since our
11
+ * RscPayload is a plain object, _debugInfo is lost. This patch relaxes
12
+ * the check so _debugInfo is recovered from any object.
13
+ */
14
+ import type { Plugin } from "vite";
15
+ export declare function patchRsdwClientDebugInfoRecovery(code: string): {
16
+ code: string;
17
+ debugInfoVar: string | null;
18
+ };
19
+ export declare function performanceTracksOptimizeDepsPlugin(): {
20
+ name: string;
21
+ load(id: string): Promise<{
22
+ code: string;
23
+ } | null>;
24
+ };
25
+ export declare function performanceTracksPlugin(): Plugin;
@@ -0,0 +1,20 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * Vite plugin that triggers a full browser reload from terminal input.
4
+ *
5
+ * This plugin is intentionally passive:
6
+ * - it never enables raw mode on stdin
7
+ * - it never restores terminal state
8
+ * - it reacts to Ctrl+R when that raw byte reaches the process
9
+ * - it also supports safe line-based fallbacks like "e" + Enter
10
+ *
11
+ * Usage:
12
+ * ```ts
13
+ * import { poke } from "@rangojs/router/vite";
14
+ *
15
+ * export default defineConfig({
16
+ * plugins: [rango(), poke()],
17
+ * });
18
+ * ```
19
+ */
20
+ export declare function poke(): Plugin;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * "use cache" Vite Transform Plugin
3
+ *
4
+ * Detects "use cache" directives at file-level and function-level,
5
+ * then wraps exports with registerCachedFunction() from the cache runtime.
6
+ *
7
+ * File-level: "use cache" at top of file wraps all exports (except
8
+ * layout/template default exports which receive children).
9
+ *
10
+ * Function-level: "use cache: profileName" inside a function body
11
+ * hoists the function and wraps it.
12
+ *
13
+ * Uses transform helpers from @vitejs/plugin-rsc/transforms:
14
+ * - hasDirective() for file-level detection
15
+ * - transformWrapExport() for file-level wrapping
16
+ * - transformHoistInlineDirective() for function-level hoisting
17
+ */
18
+ import type { Plugin } from "vite";
19
+ export declare const USE_CACHE_DIRECTIVE_RE: RegExp;
20
+ export declare function useCacheTransform(): Plugin;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Vercel Build Output (Build Output API v3) emitter for `preset: "vercel"`.
3
+ *
4
+ * After the full app build, restructures dist/ into .vercel/output:
5
+ *
6
+ * .vercel/output/
7
+ * config.json routing: static first, else the function
8
+ * static/ dist/client (browser assets, served at /)
9
+ * functions/<name>.func/
10
+ * .vc-config.json Node serverless, response streaming
11
+ * index.mjs bundled launcher (srvx + @vercel/functions)
12
+ * rsc/ dist/rsc (self-contained RSC server bundle)
13
+ * ssr/ dist/ssr (rsc imports ../ssr/index.js)
14
+ *
15
+ * A prebuilt .vercel/output gets no `npm install`, so everything the function
16
+ * imports must physically live inside the .func directory. This relies on two
17
+ * things the vercel preset arranges (each is a failure only a real deploy — or
18
+ * the isolated smoke test — catches, since a local in-place run is masked by the
19
+ * app's own package.json + node_modules up the tree):
20
+ *
21
+ * 1. The rsc/ssr builds are fully bundled (`resolve.noExternal`, set in
22
+ * rango.ts for this preset). The node default externalizes node_modules
23
+ * deps, which works under `vite preview` but leaves bare imports
24
+ * (@vercel/functions, react-dom/server.edge, ...) that have no node_modules
25
+ * to resolve against on Vercel.
26
+ * 2. A `package.json` with `"type": "module"` is written into the .func dir.
27
+ * The rsc/ssr bundles are ESM but use a `.js` extension; without a
28
+ * type:module in scope the deployed (isolated) function loads them as
29
+ * CommonJS and fails on the first `import`.
30
+ *
31
+ * The launcher is bundled with srvx (the Web->Node streaming bridge, a
32
+ * @rangojs/router dependency) and @vercel/functions (resolved from the app)
33
+ * inlined, keeping the RSC bundle a runtime-relative external.
34
+ *
35
+ * Timing: this runs in the `buildApp` hook (order "post"), which fires once
36
+ * after every environment has built, so dist/{client,rsc,ssr} all exist.
37
+ * closeBundle is unusable here — it fires per environment, and twice for ssr
38
+ * (the server-reference scan and the real build), so it would run before
39
+ * dist/client exists. rango's own prerender/static emitters hardcode dist/rsc,
40
+ * so we build to dist/ and restructure here rather than retargeting outDir.
41
+ */
42
+ import type { Plugin } from "vite";
43
+ import type { RangoVercelOptions, VercelPresetOptions } from "../plugin-types.js";
44
+ /**
45
+ * Reject a non-Node runtime for the vercel preset. The preset only emits a Node
46
+ * serverless function (launcherType "Nodejs", bundled Node APIs, response
47
+ * streaming). Vercel's Edge runtime needs a different Build Output primitive
48
+ * (EdgeFunction, a Web-handler entry, no node_modules) that this assembler does
49
+ * not produce, so a non-nodejs runtime would emit a config the platform rejects
50
+ * or mis-runs. Fail fast at build time instead of shipping a broken function.
51
+ */
52
+ export declare function assertVercelNodeRuntime(runtime: string | undefined): void;
53
+ /**
54
+ * The function name becomes a `.func` directory segment and the config.json
55
+ * route `dest` (`/${functionName}`). An empty or space/slash-containing value
56
+ * would land raw in both, producing a broken function path, so restrict it to a
57
+ * safe single path segment and fail loudly rather than emit unroutable output.
58
+ */
59
+ export declare function assertValidVercelFunctionName(functionName: string): void;
60
+ /** The `.vc-config.json` body: a Node serverless function with streaming. */
61
+ export declare function buildVercelVcConfig(vercel: VercelPresetOptions): Record<string, unknown>;
62
+ /**
63
+ * The Build Output API v3 `config.json` body. Routes, in order: long-cache the
64
+ * content-hashed assets under `${assetsDir}/` (safe to serve `immutable`;
65
+ * without this Vercel serves them `max-age=0, must-revalidate` and browsers
66
+ * re-request every asset on each visit), then the filesystem handler, then
67
+ * everything to the function. The header route uses `continue: true` so it falls
68
+ * through to the filesystem handler that actually serves the file.
69
+ *
70
+ * Route `src` values are REGEXES on Vercel, so the prefix is regex-escaped
71
+ * (an unescaped `assetsDir: "static.v2"` would immutable-stamp any
72
+ * `/static?v2/...` path, including function-rendered pages). An empty
73
+ * assetsDir (assets at the outDir root) gets no header route at all: there is
74
+ * no prefix separating hashed from non-hashed files, so fall back to Vercel's
75
+ * safe default headers. Two accepted edges, matching what other framework
76
+ * adapters (Astro, SvelteKit) emit: files a user places in
77
+ * `public/${assetsDir}/` land under the same prefix and are also stamped
78
+ * immutable (assemble() warns about the collision), and a request for a
79
+ * MISSING asset falls through to the function whose 404 carries the header.
80
+ */
81
+ export declare function buildVercelOutputConfig(functionName: string, assetsDir: string): {
82
+ version: number;
83
+ routes: unknown[];
84
+ };
85
+ export declare function createVercelOutputPlugin(options: RangoVercelOptions): Plugin;
@@ -0,0 +1,21 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * Plugin that auto-injects VERSION, routes-manifest, and loader-manifest into
4
+ * custom entry.rsc files. If a custom entry.rsc file uses createRSCHandler but
5
+ * doesn't pass version, this transform adds the import and property
6
+ * automatically. It also ensures the routes-manifest and loader-manifest
7
+ * virtual modules are always imported.
8
+ *
9
+ * The loader-manifest import is what makes fetchable loaders resolvable on a
10
+ * custom worker entry. The virtual RSC entry (getVirtualEntryRSC) imports the
11
+ * loader manifest itself, but a hand-written entry (e.g. a Cloudflare
12
+ * worker.rsc.tsx) does not — so without this injection, setLoaderImports() is
13
+ * never bundled, lazyLoaderImports stays null at runtime, and a fetchable
14
+ * loader that is never imported by the server graph (not registered via
15
+ * loader(), reachable only through a client component) cannot be found by the
16
+ * _rsc_loader endpoint in production. Dev still works because it resolves
17
+ * loaders by parsing their id into a file path; only production relied on the
18
+ * manifest, hence the production-only failure this fixes.
19
+ * @internal
20
+ */
21
+ export declare function createVersionInjectorPlugin(rscEntryPath: string | undefined): Plugin;
@@ -0,0 +1,19 @@
1
+ import { type Plugin } from "vite";
2
+ /**
3
+ * Plugin providing rsc-router:version virtual module.
4
+ * Exports VERSION that changes when RSC modules change (dev) or at build time (production).
5
+ *
6
+ * The version is used for:
7
+ * 1. Cache invalidation - CFCacheStore uses VERSION to invalidate stale cache
8
+ * 2. Version mismatch detection - client sends version, server reloads on mismatch
9
+ *
10
+ * In dev mode, the version updates when:
11
+ * - Server starts (initial version)
12
+ * - RSC modules change via HMR (triggers version module invalidation)
13
+ *
14
+ * Client-only HMR changes don't update the version since they don't affect
15
+ * server-rendered content or cached RSC payloads.
16
+ * @internal
17
+ */
18
+ export declare function createVersionPlugin(): Plugin;
19
+ export declare function isViteDepCachePath(filePath: string | undefined, cacheDir?: string): boolean;
@@ -0,0 +1,36 @@
1
+ import type { HeadScriptsOption } from "../plugin-types.js";
2
+ export declare const VIRTUAL_ENTRY_BROWSER: string;
3
+ /**
4
+ * Generate the virtual SSR entry. `headScripts` mirrors the rango() plugin
5
+ * option: "preinit" (default) installs the client-reference preinit hook and
6
+ * lets the SSR handlers convert the bootstrap to `bootstrapModules`;
7
+ * "preload" omits the hook and pins the handlers to the hint-only strategy.
8
+ */
9
+ export declare function getVirtualEntrySSR(headScripts?: HeadScriptsOption): string;
10
+ /**
11
+ * Virtual modules an RSC entry must import at startup to register the data the
12
+ * request handler needs before the first request arrives:
13
+ *
14
+ * - routes-manifest: the pre-generated route map so href()/matching work on a
15
+ * cold start (full map in build, in-memory no-op in dev).
16
+ * - loader-manifest: setLoaderImports() for fetchable loaders. Critical for
17
+ * serverless/multi-process deployments and for fetchable loaders reachable
18
+ * only through a client component — without it those loaders are never
19
+ * registered for the _rsc_loader endpoint and fail in production.
20
+ *
21
+ * Single source of truth: both the generated virtual RSC entry below and the
22
+ * custom-entry injector (version-injector) consume this list, so a new
23
+ * bootstrap manifest cannot be added to one path and forgotten on the other.
24
+ * That exact drift (loader-manifest present here but missing from the injector)
25
+ * is what left fetchable loaders unresolved on custom worker entries.
26
+ */
27
+ export declare const RSC_ENTRY_BOOTSTRAP_IMPORTS: readonly string[];
28
+ export declare function getVirtualEntryRSC(routerPath: string): string;
29
+ export declare function getVirtualEntryRSCHost(hostEntryPath: string): string;
30
+ export declare const VIRTUAL_IDS: {
31
+ readonly browser: "virtual:rsc-router/entry.browser.js";
32
+ readonly ssr: "virtual:rsc-router/entry.ssr.js";
33
+ readonly rsc: "virtual:rsc-router/entry.rsc.js";
34
+ readonly version: "@rangojs/router:version";
35
+ };
36
+ export declare function getVirtualVersionContent(version: string): string;
@@ -0,0 +1,7 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * Stub plugin that resolves and provides empty exports for virtual modules
4
+ * that the RSC entry may import but aren't needed for route discovery.
5
+ * @internal
6
+ */
7
+ export declare function createVirtualStubPlugin(): Plugin;
@@ -0,0 +1,29 @@
1
+ import { type PluginOption } from "vite";
2
+ import type { RangoOptions } from "./plugin-types.js";
3
+ import { hasUseClientDirective } from "./utils/directive-prologue.js";
4
+ export { hasUseClientDirective };
5
+ /**
6
+ * Vite plugin for @rangojs/router.
7
+ *
8
+ * Includes @vitejs/plugin-rsc and all necessary transforms for the router
9
+ * to function correctly with React Server Components.
10
+ *
11
+ * @example Node.js (default)
12
+ * ```ts
13
+ * export default defineConfig({
14
+ * plugins: [react(), rango()],
15
+ * });
16
+ * ```
17
+ *
18
+ * @example Cloudflare Workers
19
+ * ```ts
20
+ * export default defineConfig({
21
+ * plugins: [
22
+ * react(),
23
+ * rango({ preset: 'cloudflare' }),
24
+ * cloudflare({ viteEnvironment: { name: 'rsc' } }),
25
+ * ],
26
+ * });
27
+ * ```
28
+ */
29
+ export declare function rango(options?: RangoOptions): Promise<PluginOption[]>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Router Discovery Plugin
3
+ *
4
+ * Vite plugin that discovers router instances at dev/build time via the RSC
5
+ * environment. Delegates to extracted modules for discovery, route types
6
+ * generation, virtual module codegen, and bundle post-processing.
7
+ */
8
+ import type { Plugin } from "vite";
9
+ import { VIRTUAL_ROUTES_MANIFEST_ID, type PluginOptions } from "./discovery/state.js";
10
+ export { VIRTUAL_ROUTES_MANIFEST_ID };
11
+ /**
12
+ * Plugin that discovers router instances at dev/build time via the RSC environment.
13
+ *
14
+ * Uses `server.environments.rsc.runner.import()` to load the user's router file
15
+ * with full TS/TSX compilation. This triggers `createRouter()` which populates
16
+ * the `RouterRegistry`. The plugin then generates manifests for each router.
17
+ *
18
+ * In dev mode, this runs in `configureServer` (post-middleware setup).
19
+ * In build mode, this will run in `buildStart` (future).
20
+ *
21
+ * @internal
22
+ */
23
+ export declare function createRouterDiscoveryPlugin(entryPath: string | undefined, opts?: PluginOptions): Plugin;
@@ -0,0 +1,64 @@
1
+ import type MagicString from "magic-string";
2
+ /** Minimal ESTree Program node — avoids importing from `rollup` (not a direct dep). */
3
+ interface ProgramNode {
4
+ type: "Program";
5
+ body: any[];
6
+ }
7
+ export interface HandlerCallSite {
8
+ callStart: number;
9
+ callEnd: number;
10
+ argCount: number;
11
+ lineNumber: number;
12
+ calleeName: string;
13
+ exportInfo: {
14
+ exportName: string;
15
+ statementEnd: number;
16
+ } | null;
17
+ }
18
+ export interface VirtualHandlerEntry {
19
+ originalModuleId: string;
20
+ imports: string[];
21
+ declarations: string[];
22
+ handlerCode: string;
23
+ exportName: string;
24
+ }
25
+ /**
26
+ * Parse the file with Vite's parseAst and find all calls to `fnName`.
27
+ * Distinguishes between `export const X = fnName(...)` (exportInfo set)
28
+ * and inline calls like `layout(fnName(...))` (exportInfo null).
29
+ */
30
+ export declare function findHandlerCalls(code: string, fnName: string, parseAst: (code: string, options?: any) => ProgramNode): HandlerCallSite[];
31
+ export declare function getImportedLocalNames(code: string, importedName: string, parseAst: (code: string, options?: any) => ProgramNode): Set<string>;
32
+ /**
33
+ * Extract all import declarations from the source as raw text slices.
34
+ * Copies ALL imports -- Rollup tree-shakes unused ones from virtual modules.
35
+ */
36
+ export declare function extractImportDeclarations(code: string, parseAst: (code: string, options?: any) => ProgramNode): string[];
37
+ /**
38
+ * Extract module-level declarations that are safe for inclusion in virtual
39
+ * modules. "Safe" means the declaration can be eagerly evaluated without
40
+ * referencing import bindings, preventing TDZ errors in separate chunks.
41
+ *
42
+ * Included: function declarations, arrow/function expression inits, and
43
+ * variable inits that are inert (pure literals, arrays, objects).
44
+ * Excluded: declarations that reference identifiers at init time (may
45
+ * reference imports causing TDZ), handler call declarations (circular),
46
+ * class declarations (field initializers can reference imports).
47
+ *
48
+ * Strips export keywords so declarations work as plain locals.
49
+ * Rollup tree-shakes unused declarations from virtual modules.
50
+ */
51
+ export declare function extractModuleLevelDeclarations(code: string, parseAst: (code: string, options?: any) => ProgramNode, handlerNames: Set<string>): string[];
52
+ /**
53
+ * Transform inline handler calls by extracting them into virtual modules.
54
+ * Only processes inline calls (exportInfo === null); export const calls are
55
+ * handled by the existing regex fast path.
56
+ *
57
+ * Always extracts (dev and build) to keep server-only imports out of non-RSC
58
+ * environments. The virtual module goes through the standard transform pipeline
59
+ * automatically -- the existing export const regex path handles it.
60
+ *
61
+ * Returns true if any inline calls were transformed.
62
+ */
63
+ export declare function transformInlineHandlers(fnName: string, virtualPrefix: string, s: MagicString, code: string, filePath: string, virtualRegistry: Map<string, VirtualHandlerEntry>, moduleId: string, parseAst: (code: string, options?: any) => ProgramNode): boolean;
64
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const rangoVersion: string;
2
+ export declare function printBanner(mode: "dev" | "build" | "preview", preset: string, version: string): void;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Find matching close paren in bundled code using depth counting.
3
+ * Uses skipStringOrComment to correctly handle template literals, comments, and nested strings.
4
+ * @internal Exported for testing only.
5
+ */
6
+ export declare function findMatchingParenInBundle(code: string, openParenPos: number): number;
7
+ /**
8
+ * Scan a bundled chunk for handler exports and extract their names + $$id values.
9
+ * Optionally detects passthrough flag. @internal Exported for testing only.
10
+ */
11
+ export declare function extractHandlerExportsFromChunk(chunkCode: string, handlerModules: Map<string, string[]>, fnName: string, detectPassthrough: boolean): Array<{
12
+ name: string;
13
+ handlerId: string;
14
+ passthrough: boolean;
15
+ }>;
16
+ /**
17
+ * Evict handler code from a bundled chunk, replacing full call expressions with stubs.
18
+ * Returns the modified code and bytes saved, or null if no changes were made.
19
+ * @internal Exported for testing only.
20
+ */
21
+ export declare function evictHandlerCode(code: string, exports: Array<{
22
+ name: string;
23
+ handlerId: string;
24
+ passthrough?: boolean;
25
+ }>, fnName: string, brand: string): {
26
+ code: string;
27
+ savedBytes: number;
28
+ } | null;
@@ -0,0 +1,55 @@
1
+ import type { ClientChunkMeta, ClientChunks } from "../plugin-types.js";
2
+ /** The callback shape @vitejs/plugin-rsc's `clientChunks` option accepts. */
3
+ export type RscClientChunksFn = (meta: ClientChunkMeta) => string | undefined;
4
+ /**
5
+ * Build-time context the discovery pass populates and the built-in strategy
6
+ * reads. It refines how the catch-all (no route-root marker) modules are grouped
7
+ * without touching marker splits or the shared runtime:
8
+ *
9
+ * - `fallbackRefs`: production hashes of the `"use client"` modules a consumer
10
+ * registered as `errorBoundary`/`notFoundBoundary` fallbacks. Pulled into a
11
+ * dedicated `app-fallback` chunk so the error UI is not co-bundled with the
12
+ * very route code it exists to catch failures for (resilience), and so the
13
+ * chunk it would otherwise sit in gets named after a real module rather than
14
+ * the boundary. Populated by reading each fallback element's client-reference
15
+ * `$$id` during discovery (see discover-routers).
16
+ */
17
+ export interface ClientChunkContext {
18
+ fallbackRefs: Set<string>;
19
+ }
20
+ /**
21
+ * Built-in strategy used when `clientChunks: true` (also the default). Splits app
22
+ * client components by route/feature identity ONLY where it can recognize a route
23
+ * structure; everywhere else it inherits the default grouping (returns undefined).
24
+ * This conservatism is what makes it safe as a default:
25
+ *
26
+ * - A recognized route structure (`routes/<id>/…`, `app/<id>/…`, `handlers/<id>/…`
27
+ * etc.) splits into a per-route chunk `app-<id>`, at any nesting depth.
28
+ * - A flat `src/components/Button.tsx`, or host sub-apps already split by a dynamic
29
+ * `import()` boundary (each app's `serverChunk` differs), get `undefined` and so
30
+ * keep `@vitejs/plugin-rsc`'s default `serverChunk` grouping — i.e. NO change
31
+ * versus not enabling the option. Returning a parent-dir name here would instead
32
+ * merge unrelated modules (e.g. every host app's `components/Layout.tsx` into one
33
+ * `app-components`), re-introducing cross-app leakage.
34
+ *
35
+ * Resolution order:
36
+ * 1. Shared runtime (React / router / node_modules) -> `undefined` (never split).
37
+ * 2. A registered error/notFound fallback (`ctx.fallbackRefs`) -> `app-fallback`,
38
+ * regardless of location, so the error UI is decoupled from the happy path.
39
+ * 3. A {@link ROUTE_ROOT_DIRS} marker with a directory after it -> key on that
40
+ * next segment (the route id), robust to any nesting depth.
41
+ * 4. Otherwise `undefined` (inherit the default `serverChunk` grouping).
42
+ */
43
+ export declare function directoryClientChunks(meta: ClientChunkMeta, ctx?: ClientChunkContext): string | undefined;
44
+ /**
45
+ * Resolve a Rango `clientChunks` option into a @vitejs/plugin-rsc `clientChunks`
46
+ * callback, or `undefined` to leave plugin-rsc on its default (serverChunk)
47
+ * grouping.
48
+ *
49
+ * - `false` / `undefined` -> `undefined` (no override).
50
+ * - `true` -> the built-in {@link directoryClientChunks} strategy,
51
+ * bound to the discovery-populated {@link ClientChunkContext} (fallback chunk).
52
+ * - function -> the user's function, used verbatim (full control; the
53
+ * fallback refinement does not apply — the consumer owns the grouping).
54
+ */
55
+ export declare function resolveClientChunks(option: ClientChunks | undefined, ctx?: ClientChunkContext): RscClientChunksFn | undefined;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Detect a leading `"use client"` (or `'use client'`) directive in a module's
3
+ * directive prologue, tolerating leading comments/whitespace before it.
4
+ *
5
+ * A bare `source.trimStart().startsWith` check only strips whitespace, so a
6
+ * license banner / `// @ts-nocheck` before the directive would be missed. This
7
+ * walks the leading ExpressionStatement string-literal directives via the AST
8
+ * (a leading comment is not a `program.body` node), the single source of truth
9
+ * shared by both the rango plugin's HMR client-module sniff and the version
10
+ * plugin's getClientModuleSignature — so the two can never drift on what counts
11
+ * as a client module.
12
+ *
13
+ * Returns false when the source cannot be parsed (a syntactically broken file is
14
+ * not treated as a client module).
15
+ */
16
+ export declare function hasUseClientDirective(source: string): boolean;
@@ -0,0 +1,37 @@
1
+ import type { Plugin, ResolvedConfig, UserConfig } from "vite";
2
+ /**
3
+ * Pick the user's resolution plugins from the resolved plugin list, denylist
4
+ * framework-owned plugins, keep only those with resolution hooks, and strip
5
+ * each to its resolution surface. Returns plugin objects safe to drop into the
6
+ * discovery temp server's `plugins` array.
7
+ */
8
+ export declare function selectForwardableResolvePlugins(plugins: readonly Plugin[] | undefined): Plugin[];
9
+ /**
10
+ * The resolution-relevant slice of the user's resolved config that is plain
11
+ * data (no plugin re-execution): everything under `resolve` that influences
12
+ * how specifiers map to files, plus `define` and `oxc` so transforms and
13
+ * compile-time constants match request time.
14
+ */
15
+ export interface ForwardedRunnerConfig {
16
+ resolve: UserConfig["resolve"];
17
+ define: UserConfig["define"];
18
+ oxc: UserConfig["oxc"];
19
+ }
20
+ /**
21
+ * Extract the data-only config slice to mirror into the discovery temp server.
22
+ * `alias` is included here so callers no longer need to thread it separately.
23
+ *
24
+ * `tsconfigPaths` is forwarded so Vite 8's native tsconfig `paths` resolution
25
+ * (a top-level `resolve` flag, off by default) reaches the temp server. The
26
+ * server is created with `configFile: false` and an explicit, allowlisted
27
+ * resolve slice, so a flag that is not copied here is simply absent during
28
+ * discovery — which would make path-aliased imports fail at prerender/static
29
+ * time the same way unforwarded resolveId plugins did (issue #500).
30
+ *
31
+ * `oxc` keeps the user's options but always pins the RSC-required JSX runtime
32
+ * (automatic, react), since the temp server compiles the handler graph as
33
+ * React server components regardless of the user's app-level JSX config. Vite 8
34
+ * replaced the deprecated `esbuild` transform option with `oxc`, so we read and
35
+ * forward `oxc` exclusively — no `esbuild` field is touched.
36
+ */
37
+ export declare function pickForwardedRunnerConfig(config: ResolvedConfig): ForwardedRunnerConfig;
@@ -0,0 +1,7 @@
1
+ export { flattenLeafEntries, buildRouteToStaticPrefix, } from "../../build/prefix-tree-utils.js";
2
+ /**
3
+ * Wrap a value as `JSON.parse('...')` instead of a JS object literal.
4
+ * V8's JSON parser is significantly faster than its full JS parser for large
5
+ * objects, so this improves startup time for big route manifests.
6
+ */
7
+ export declare function jsonParseExpression(value: unknown): string;
@@ -0,0 +1,6 @@
1
+ export declare function getPublishedPackageName(): string;
2
+ export declare function isInstalledFromNpm(): boolean;
3
+ export declare function isWorkspaceDevelopment(): boolean;
4
+ export declare function getExcludeDeps(): string[];
5
+ export declare function getPackageAliases(): Record<string, string>;
6
+ export declare function getVendorAliases(): Record<string, string>;
@@ -0,0 +1,32 @@
1
+ export declare function encodePathParam(value: unknown): string;
2
+ export declare function substituteRouteParams(pattern: string, params: Record<string, string>, encode?: (value: string) => string): string;
3
+ export declare function runWithConcurrency<T>(items: T[], concurrency: number, fn: (item: T) => Promise<void>): Promise<void>;
4
+ export declare function groupByConcurrency<T extends {
5
+ concurrency: number;
6
+ }>(entries: T[]): {
7
+ concurrency: number;
8
+ entries: T[];
9
+ }[];
10
+ export declare function notifyOnError(registry: Map<string, any>, error: unknown, phase: "prerender" | "static", routeKey?: string, pathname?: string, skipped?: boolean): void;
11
+ /**
12
+ * Resolve a thrown build-time render error into the prerender build's policy and
13
+ * log a per-entry line. A `Skip` (or any render error under `prerender.onError:
14
+ * "warn"`) logs and returns so the caller skips the entry; a render error under
15
+ * the default "fail" logs FAIL, notifies `onError`, and re-throws to fail the
16
+ * build. Shared by `expandPrerenderRoutes` (prerender) and `renderStaticHandlers`
17
+ * (static) so the Skip/warn/fail policy lives in one place. `label` is the padded
18
+ * URL / handler name for the log line; `elapsed` is the per-entry duration string.
19
+ */
20
+ export declare function resolvePrerenderError(registry: Map<string, any>, error: any, onError: "fail" | "warn", label: string, elapsed: string, phase: "prerender" | "static", routeKey?: string, pathname?: string): void;
21
+ export declare function resetStagedBuildAssets(projectRoot: string): void;
22
+ /**
23
+ * Write one content-hashed `export default <value>;` asset module into `dir`
24
+ * (created if needed) and return its file name. Identical payloads dedupe to
25
+ * one file (the hash is the content). Shared by the staged prerender/static
26
+ * flow (stageBuildAssetModule below) and the shell prerender phase, which
27
+ * writes directly into the final RSC assets dir — it runs after buildApp,
28
+ * past the staging/copy window.
29
+ */
30
+ export declare function writeBuildAssetModule(dir: string, prefix: "__pr" | "__st" | "__ps", exportValue: string): string;
31
+ export declare function stageBuildAssetModule(projectRoot: string, prefix: "__pr" | "__st", exportValue: string): string;
32
+ export declare function copyStagedBuildAssets(projectRoot: string, fileNames: Iterable<string>): number;
@@ -0,0 +1,55 @@
1
+ import type { Plugin, ResolvedConfig } from "vite";
2
+ import * as Vite from "vite";
3
+ import type { HeadScriptsOption } from "../plugin-types.js";
4
+ export declare function resolveRscEntryFromConfig(config: ResolvedConfig): string | undefined;
5
+ /**
6
+ * Shared Rolldown options for dependency optimization (Vite 8).
7
+ * Includes the version stub plugin and the performance-tracks RSDW patch.
8
+ */
9
+ export declare const sharedRolldownOptions: {
10
+ plugins: any[];
11
+ };
12
+ /**
13
+ * Normalize an explicit `hostRouter` option into the specifier emitted as the
14
+ * host entry's `import ... from "<path>"`, and — for the forms that resolve
15
+ * unambiguously against the project root — verify the file exists (failing with
16
+ * a rango message instead of a downstream bundler "failed to resolve").
17
+ *
18
+ * Only a BARE specifier ("src/worker.rsc.tsx") that exists under the root is
19
+ * rewritten (to "./src/...") so it is not read as a package. A bare specifier
20
+ * that does NOT exist under the root is passed through VERBATIM: it may be a
21
+ * Vite alias ("@/worker.rsc.tsx"), an imports-map entry ("#app/worker"), or a
22
+ * workspace package the bundler resolves — rewriting or rejecting those was a
23
+ * regression (aliases worked before normalization existed). "./"/"../", a
24
+ * leading-slash (Vite root-relative), and a filesystem-absolute path are
25
+ * emitted unchanged — Vite resolves each. A leading-slash path and a
26
+ * filesystem-absolute path are indistinguishable on POSIX, so both are treated
27
+ * as "rooted": passed through WITHOUT an existence check (guessing between the
28
+ * two would wrongly reject a valid file — this was a regression the first time
29
+ * the check was added). Only the explicitly-relative forms, which resolve
30
+ * unambiguously against the root, fail fast with a rango message.
31
+ *
32
+ * `exists` is injected so the logic is unit-testable without a real filesystem.
33
+ */
34
+ export declare function normalizeHostRouterEntry(rawInput: string, root: string, exists: (absPath: string) => boolean): string;
35
+ /**
36
+ * Create a virtual modules plugin for default entry files.
37
+ * Provides virtual module content when entries use VIRTUAL_IDS (no custom entry configured).
38
+ */
39
+ export declare function createVirtualEntriesPlugin(entries: {
40
+ client: string;
41
+ ssr: string;
42
+ rsc?: string;
43
+ }, routerPathRef?: {
44
+ path?: string;
45
+ kind?: "router" | "host";
46
+ }, options?: {
47
+ headScripts?: HeadScriptsOption;
48
+ }): Plugin;
49
+ /**
50
+ * Suppress known harmless warnings: "use client" directives, sourcemap errors,
51
+ * mixed imports (expected for router internals), empty bundles, and content-hashed
52
+ * asset collisions from @vitejs/plugin-rsc copying RSC-env assets to the client bundle.
53
+ */
54
+ export declare function onwarn(warning: Vite.Rollup.RollupLog, defaultHandler: (warning: Vite.Rollup.RollupLog) => void): void;
55
+ export declare function getManualChunks(id: string): string | undefined;
@@ -2530,7 +2530,7 @@ import { resolve } from "node:path";
2530
2530
  // package.json
2531
2531
  var package_default = {
2532
2532
  name: "@rangojs/router",
2533
- version: "0.2.0",
2533
+ version: "0.4.0",
2534
2534
  description: "Django-inspired RSC router with composable URL patterns",
2535
2535
  keywords: [
2536
2536
  "react",
@@ -4715,10 +4715,13 @@ var PUSH_CALLBACK_SCOPE_KEY = /* @__PURE__ */ Symbol.for(
4715
4715
  );
4716
4716
  var pushCallbackScopeALS = globalThis[PUSH_CALLBACK_SCOPE_KEY] ??= new AsyncLocalStorage();
4717
4717
 
4718
+ // src/rsc/shell-capture-constants.ts
4719
+ var SHELL_CAPTURE_MAX_WAIT_MS = 15e3;
4720
+
4718
4721
  // src/rsc/shell-serve.ts
4719
4722
  var DEV_SHELL_PROBE_TIMEOUT_MS = 1e4;
4720
4723
  function normalizeCaptureTimeout(value) {
4721
- return typeof value === "number" && Number.isFinite(value) && value >= 1 ? value : void 0;
4724
+ return typeof value === "number" && Number.isFinite(value) && value >= 1 ? Math.min(value, SHELL_CAPTURE_MAX_WAIT_MS) : void 0;
4722
4725
  }
4723
4726
 
4724
4727
  // src/vite/inject-client-debug.ts