@rangojs/router 0.5.0 → 0.5.1

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 (405) hide show
  1. package/dist/types/browser/prefetch/cache.d.ts +31 -2
  2. package/dist/types/route-definition/helpers-types.d.ts +5 -4
  3. package/dist/types/static-handler.d.ts +15 -1
  4. package/dist/types/urls/path-helper-types.d.ts +6 -7
  5. package/dist/types.backup/__internal.d.ts +127 -0
  6. package/dist/types.backup/bin/rango.d.ts +1 -0
  7. package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
  8. package/dist/types.backup/browser/action-fence.d.ts +33 -0
  9. package/dist/types.backup/browser/app-shell.d.ts +34 -0
  10. package/dist/types.backup/browser/app-version.d.ts +6 -0
  11. package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
  12. package/dist/types.backup/browser/cookie-name.d.ts +66 -0
  13. package/dist/types.backup/browser/event-controller.d.ts +221 -0
  14. package/dist/types.backup/browser/history-state.d.ts +26 -0
  15. package/dist/types.backup/browser/index.d.ts +1 -0
  16. package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
  17. package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
  18. package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
  19. package/dist/types.backup/browser/logging.d.ts +33 -0
  20. package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
  21. package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
  22. package/dist/types.backup/browser/navigation-client.d.ts +17 -0
  23. package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
  24. package/dist/types.backup/browser/navigation-store.d.ts +95 -0
  25. package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
  26. package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
  27. package/dist/types.backup/browser/partial-update.d.ts +61 -0
  28. package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
  29. package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
  30. package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
  31. package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
  32. package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
  33. package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
  34. package/dist/types.backup/browser/rango-state.d.ts +52 -0
  35. package/dist/types.backup/browser/react/Link.d.ts +140 -0
  36. package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
  37. package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
  38. package/dist/types.backup/browser/react/context.d.ts +54 -0
  39. package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
  40. package/dist/types.backup/browser/react/index.d.ts +1 -0
  41. package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
  42. package/dist/types.backup/browser/react/location-state.d.ts +29 -0
  43. package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
  44. package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
  45. package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
  46. package/dist/types.backup/browser/react/use-action.d.ts +61 -0
  47. package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
  48. package/dist/types.backup/browser/react/use-href.d.ts +32 -0
  49. package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
  50. package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
  51. package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
  52. package/dist/types.backup/browser/react/use-params.d.ts +21 -0
  53. package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
  54. package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
  55. package/dist/types.backup/browser/react/use-router.d.ts +23 -0
  56. package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
  57. package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
  58. package/dist/types.backup/browser/response-adapter.d.ts +58 -0
  59. package/dist/types.backup/browser/rsc-router.d.ts +141 -0
  60. package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
  61. package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
  62. package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
  63. package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
  64. package/dist/types.backup/browser/types.d.ts +530 -0
  65. package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
  66. package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
  67. package/dist/types.backup/build/generate-manifest.d.ts +100 -0
  68. package/dist/types.backup/build/generate-route-types.d.ts +8 -0
  69. package/dist/types.backup/build/index.d.ts +21 -0
  70. package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
  71. package/dist/types.backup/build/route-trie.d.ts +89 -0
  72. package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
  73. package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
  74. package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
  75. package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
  76. package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
  77. package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
  78. package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
  79. package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
  80. package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
  81. package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
  82. package/dist/types.backup/cache/background-task.d.ts +21 -0
  83. package/dist/types.backup/cache/cache-error.d.ts +71 -0
  84. package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
  85. package/dist/types.backup/cache/cache-policy.d.ts +59 -0
  86. package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
  87. package/dist/types.backup/cache/cache-scope.d.ts +134 -0
  88. package/dist/types.backup/cache/cache-tag.d.ts +79 -0
  89. package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
  90. package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
  91. package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
  92. package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
  93. package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
  94. package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
  95. package/dist/types.backup/cache/cf/index.d.ts +3 -0
  96. package/dist/types.backup/cache/document-cache.d.ts +69 -0
  97. package/dist/types.backup/cache/handle-capture.d.ts +23 -0
  98. package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
  99. package/dist/types.backup/cache/index.d.ts +7 -0
  100. package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
  101. package/dist/types.backup/cache/profile-registry.d.ts +40 -0
  102. package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
  103. package/dist/types.backup/cache/segment-codec.d.ts +78 -0
  104. package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
  105. package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
  106. package/dist/types.backup/cache/taint.d.ts +71 -0
  107. package/dist/types.backup/cache/types.d.ts +407 -0
  108. package/dist/types.backup/cache/vercel/index.d.ts +1 -0
  109. package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
  110. package/dist/types.backup/client.d.ts +184 -0
  111. package/dist/types.backup/client.rsc.d.ts +39 -0
  112. package/dist/types.backup/cloudflare/index.d.ts +7 -0
  113. package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
  114. package/dist/types.backup/component-utils.d.ts +46 -0
  115. package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
  116. package/dist/types.backup/context-var.d.ts +84 -0
  117. package/dist/types.backup/debug.d.ts +57 -0
  118. package/dist/types.backup/decode-loader-results.d.ts +5 -0
  119. package/dist/types.backup/default-error-boundary.d.ts +10 -0
  120. package/dist/types.backup/defer.d.ts +89 -0
  121. package/dist/types.backup/deps/browser.d.ts +1 -0
  122. package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
  123. package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
  124. package/dist/types.backup/deps/rsc.d.ts +1 -0
  125. package/dist/types.backup/deps/ssr.d.ts +1 -0
  126. package/dist/types.backup/encode-kv.d.ts +35 -0
  127. package/dist/types.backup/errors.d.ts +226 -0
  128. package/dist/types.backup/escape-script.d.ts +44 -0
  129. package/dist/types.backup/handle.d.ts +93 -0
  130. package/dist/types.backup/handles/MetaTags.d.ts +17 -0
  131. package/dist/types.backup/handles/Scripts.d.ts +38 -0
  132. package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
  133. package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
  134. package/dist/types.backup/handles/is-thenable.d.ts +12 -0
  135. package/dist/types.backup/handles/meta.d.ts +43 -0
  136. package/dist/types.backup/handles/script.d.ts +139 -0
  137. package/dist/types.backup/host/cookie-handler.d.ts +8 -0
  138. package/dist/types.backup/host/errors.d.ts +40 -0
  139. package/dist/types.backup/host/index.d.ts +33 -0
  140. package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
  141. package/dist/types.backup/host/router.d.ts +12 -0
  142. package/dist/types.backup/host/testing.d.ts +41 -0
  143. package/dist/types.backup/host/types.d.ts +148 -0
  144. package/dist/types.backup/host/utils.d.ts +20 -0
  145. package/dist/types.backup/href-client.d.ts +214 -0
  146. package/dist/types.backup/index.d.ts +112 -0
  147. package/dist/types.backup/index.rsc.d.ts +51 -0
  148. package/dist/types.backup/internal-debug.d.ts +1 -0
  149. package/dist/types.backup/loader-store.d.ts +193 -0
  150. package/dist/types.backup/loader.d.ts +18 -0
  151. package/dist/types.backup/loader.rsc.d.ts +18 -0
  152. package/dist/types.backup/missing-id-error.d.ts +1 -0
  153. package/dist/types.backup/outlet-context.d.ts +12 -0
  154. package/dist/types.backup/outlet-provider.d.ts +12 -0
  155. package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
  156. package/dist/types.backup/prerender/param-hash.d.ts +6 -0
  157. package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
  158. package/dist/types.backup/prerender/store.d.ts +62 -0
  159. package/dist/types.backup/prerender.d.ts +292 -0
  160. package/dist/types.backup/redirect-origin.d.ts +55 -0
  161. package/dist/types.backup/regex-escape.d.ts +6 -0
  162. package/dist/types.backup/render-error-thrower.d.ts +13 -0
  163. package/dist/types.backup/response-utils.d.ts +35 -0
  164. package/dist/types.backup/reverse.d.ts +206 -0
  165. package/dist/types.backup/root-error-boundary.d.ts +32 -0
  166. package/dist/types.backup/route-content-wrapper.d.ts +40 -0
  167. package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
  168. package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
  169. package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
  170. package/dist/types.backup/route-definition/index.d.ts +7 -0
  171. package/dist/types.backup/route-definition/redirect.d.ts +48 -0
  172. package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
  173. package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
  174. package/dist/types.backup/route-definition.d.ts +1 -0
  175. package/dist/types.backup/route-map-builder.d.ts +127 -0
  176. package/dist/types.backup/route-name.d.ts +27 -0
  177. package/dist/types.backup/route-types.d.ts +172 -0
  178. package/dist/types.backup/router/basename.d.ts +10 -0
  179. package/dist/types.backup/router/content-negotiation.d.ts +91 -0
  180. package/dist/types.backup/router/debug-manifest.d.ts +7 -0
  181. package/dist/types.backup/router/error-handling.d.ts +76 -0
  182. package/dist/types.backup/router/find-match.d.ts +19 -0
  183. package/dist/types.backup/router/handler-context.d.ts +41 -0
  184. package/dist/types.backup/router/instrument.d.ts +161 -0
  185. package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
  186. package/dist/types.backup/router/lazy-includes.d.ts +26 -0
  187. package/dist/types.backup/router/loader-resolution.d.ts +63 -0
  188. package/dist/types.backup/router/logging.d.ts +41 -0
  189. package/dist/types.backup/router/manifest.d.ts +8 -0
  190. package/dist/types.backup/router/match-api.d.ts +19 -0
  191. package/dist/types.backup/router/match-context.d.ts +184 -0
  192. package/dist/types.backup/router/match-handlers.d.ts +49 -0
  193. package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
  194. package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
  195. package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
  196. package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
  197. package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
  198. package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
  199. package/dist/types.backup/router/match-pipelines.d.ts +103 -0
  200. package/dist/types.backup/router/match-result.d.ts +114 -0
  201. package/dist/types.backup/router/metrics.d.ts +6 -0
  202. package/dist/types.backup/router/middleware-types.d.ts +74 -0
  203. package/dist/types.backup/router/middleware.d.ts +116 -0
  204. package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
  205. package/dist/types.backup/router/params-util.d.ts +8 -0
  206. package/dist/types.backup/router/parse-pattern.d.ts +38 -0
  207. package/dist/types.backup/router/pattern-matching.d.ts +169 -0
  208. package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
  209. package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
  210. package/dist/types.backup/router/prerender-match.d.ts +50 -0
  211. package/dist/types.backup/router/preview-match.d.ts +22 -0
  212. package/dist/types.backup/router/request-classification.d.ts +104 -0
  213. package/dist/types.backup/router/revalidation.d.ts +57 -0
  214. package/dist/types.backup/router/route-snapshot.d.ts +112 -0
  215. package/dist/types.backup/router/router-context.d.ts +137 -0
  216. package/dist/types.backup/router/router-interfaces.d.ts +432 -0
  217. package/dist/types.backup/router/router-options.d.ts +738 -0
  218. package/dist/types.backup/router/router-registry.d.ts +15 -0
  219. package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
  220. package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
  221. package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
  222. package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
  223. package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
  224. package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
  225. package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
  226. package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
  227. package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
  228. package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
  229. package/dist/types.backup/router/segment-resolution.d.ts +3 -0
  230. package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
  231. package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
  232. package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
  233. package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
  234. package/dist/types.backup/router/telemetry.d.ts +215 -0
  235. package/dist/types.backup/router/timeout.d.ts +68 -0
  236. package/dist/types.backup/router/tracing.d.ts +125 -0
  237. package/dist/types.backup/router/trie-matching.d.ts +32 -0
  238. package/dist/types.backup/router/types.d.ts +98 -0
  239. package/dist/types.backup/router/url-params.d.ts +26 -0
  240. package/dist/types.backup/router.d.ts +7 -0
  241. package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
  242. package/dist/types.backup/rsc/full-payload.d.ts +22 -0
  243. package/dist/types.backup/rsc/handler-context.d.ts +31 -0
  244. package/dist/types.backup/rsc/handler.d.ts +9 -0
  245. package/dist/types.backup/rsc/helpers.d.ts +213 -0
  246. package/dist/types.backup/rsc/index.d.ts +17 -0
  247. package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
  248. package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
  249. package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
  250. package/dist/types.backup/rsc/nonce.d.ts +28 -0
  251. package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
  252. package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
  253. package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
  254. package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
  255. package/dist/types.backup/rsc/response-error.d.ts +19 -0
  256. package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
  257. package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
  258. package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
  259. package/dist/types.backup/rsc/server-action.d.ts +68 -0
  260. package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
  261. package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
  262. package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
  263. package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
  264. package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
  265. package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
  266. package/dist/types.backup/rsc/types.d.ts +290 -0
  267. package/dist/types.backup/runtime-env.d.ts +1 -0
  268. package/dist/types.backup/search-params.d.ts +125 -0
  269. package/dist/types.backup/segment-content-promise.d.ts +13 -0
  270. package/dist/types.backup/segment-fragments.d.ts +56 -0
  271. package/dist/types.backup/segment-loader-promise.d.ts +22 -0
  272. package/dist/types.backup/segment-system.d.ts +84 -0
  273. package/dist/types.backup/serialize.d.ts +164 -0
  274. package/dist/types.backup/server/context.d.ts +494 -0
  275. package/dist/types.backup/server/cookie-parse.d.ts +10 -0
  276. package/dist/types.backup/server/cookie-store.d.ts +107 -0
  277. package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
  278. package/dist/types.backup/server/handle-store.d.ts +100 -0
  279. package/dist/types.backup/server/loader-registry.d.ts +32 -0
  280. package/dist/types.backup/server/request-context.d.ts +596 -0
  281. package/dist/types.backup/server/root-layout.d.ts +3 -0
  282. package/dist/types.backup/server.d.ts +15 -0
  283. package/dist/types.backup/ssr/index.d.ts +233 -0
  284. package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
  285. package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
  286. package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
  287. package/dist/types.backup/static-handler.d.ts +57 -0
  288. package/dist/types.backup/testing/cache-status.d.ts +63 -0
  289. package/dist/types.backup/testing/collect-handle.d.ts +20 -0
  290. package/dist/types.backup/testing/dispatch.d.ts +123 -0
  291. package/dist/types.backup/testing/dom.entry.d.ts +15 -0
  292. package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
  293. package/dist/types.backup/testing/e2e/index.d.ts +30 -0
  294. package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
  295. package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
  296. package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
  297. package/dist/types.backup/testing/e2e/server.d.ts +35 -0
  298. package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
  299. package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
  300. package/dist/types.backup/testing/flight-tree.d.ts +192 -0
  301. package/dist/types.backup/testing/flight.d.ts +115 -0
  302. package/dist/types.backup/testing/flight.entry.d.ts +27 -0
  303. package/dist/types.backup/testing/generated-routes.d.ts +66 -0
  304. package/dist/types.backup/testing/index.d.ts +52 -0
  305. package/dist/types.backup/testing/internal/context.d.ts +225 -0
  306. package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
  307. package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
  308. package/dist/types.backup/testing/render-handler.d.ts +160 -0
  309. package/dist/types.backup/testing/render-route.d.ts +246 -0
  310. package/dist/types.backup/testing/run-loader.d.ts +186 -0
  311. package/dist/types.backup/testing/run-middleware.d.ts +132 -0
  312. package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
  313. package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
  314. package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
  315. package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
  316. package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
  317. package/dist/types.backup/testing/vitest.d.ts +205 -0
  318. package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
  319. package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
  320. package/dist/types.backup/theme/constants.d.ts +39 -0
  321. package/dist/types.backup/theme/index.d.ts +29 -0
  322. package/dist/types.backup/theme/theme-context.d.ts +21 -0
  323. package/dist/types.backup/theme/theme-script.d.ts +26 -0
  324. package/dist/types.backup/theme/types.d.ts +162 -0
  325. package/dist/types.backup/theme/use-theme.d.ts +8 -0
  326. package/dist/types.backup/types/boundaries.d.ts +93 -0
  327. package/dist/types.backup/types/cache-types.d.ts +191 -0
  328. package/dist/types.backup/types/error-types.d.ts +114 -0
  329. package/dist/types.backup/types/global-namespace.d.ts +90 -0
  330. package/dist/types.backup/types/handler-context.d.ts +658 -0
  331. package/dist/types.backup/types/index.d.ts +11 -0
  332. package/dist/types.backup/types/loader-types.d.ts +182 -0
  333. package/dist/types.backup/types/request-scope.d.ts +93 -0
  334. package/dist/types.backup/types/route-config.d.ts +105 -0
  335. package/dist/types.backup/types/route-entry.d.ts +95 -0
  336. package/dist/types.backup/types/segments.d.ts +234 -0
  337. package/dist/types.backup/types.d.ts +1 -0
  338. package/dist/types.backup/urls/include-helper.d.ts +17 -0
  339. package/dist/types.backup/urls/include-provider.d.ts +27 -0
  340. package/dist/types.backup/urls/index.d.ts +6 -0
  341. package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
  342. package/dist/types.backup/urls/path-helper.d.ts +12 -0
  343. package/dist/types.backup/urls/pattern-types.d.ts +166 -0
  344. package/dist/types.backup/urls/response-types.d.ts +67 -0
  345. package/dist/types.backup/urls/type-extraction.d.ts +157 -0
  346. package/dist/types.backup/urls/urls-function.d.ts +24 -0
  347. package/dist/types.backup/urls.d.ts +1 -0
  348. package/dist/types.backup/use-loader.d.ts +150 -0
  349. package/dist/types.backup/vercel/index.d.ts +10 -0
  350. package/dist/types.backup/vercel/tracing.d.ts +70 -0
  351. package/dist/types.backup/vite/debug.d.ts +80 -0
  352. package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
  353. package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
  354. package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
  355. package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
  356. package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
  357. package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
  358. package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
  359. package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
  360. package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
  361. package/dist/types.backup/vite/discovery/state.d.ts +162 -0
  362. package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
  363. package/dist/types.backup/vite/index.d.ts +11 -0
  364. package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
  365. package/dist/types.backup/vite/plugin-types.d.ts +298 -0
  366. package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
  367. package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
  368. package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
  369. package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
  370. package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
  371. package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
  372. package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
  373. package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
  374. package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
  375. package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
  376. package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
  377. package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
  378. package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
  379. package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
  380. package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
  381. package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
  382. package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
  383. package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
  384. package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
  385. package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
  386. package/dist/types.backup/vite/rango.d.ts +29 -0
  387. package/dist/types.backup/vite/router-discovery.d.ts +23 -0
  388. package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
  389. package/dist/types.backup/vite/utils/banner.d.ts +2 -0
  390. package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
  391. package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
  392. package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
  393. package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
  394. package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
  395. package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
  396. package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
  397. package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
  398. package/dist/vite/index.js +1 -1
  399. package/package.json +1 -1
  400. package/skills/parallel/SKILL.md +1 -1
  401. package/src/browser/prefetch/cache.ts +53 -9
  402. package/src/browser/prefetch/fetch.ts +83 -2
  403. package/src/route-definition/helpers-types.ts +5 -3
  404. package/src/static-handler.ts +18 -2
  405. package/src/urls/path-helper-types.ts +9 -10
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Public API for @rangojs/router/vite
3
+ *
4
+ * Exports: rango() plugin factory, poke() dev utility plugin,
5
+ * and related option types. All other utilities are internal implementation
6
+ * details consumed via direct imports within the package.
7
+ */
8
+ export { rango } from "./rango.js";
9
+ export { poke } from "./plugins/refresh-cmd.js";
10
+ export { directoryClientChunks } from "./utils/client-chunks.js";
11
+ export type { RangoNodeOptions, RangoCloudflareOptions, RangoVercelOptions, VercelPresetOptions, RangoOptions, ClientChunks, ClientChunkMeta, HeadScriptsOption, BuildEnvOption, BuildEnvFactory, BuildEnvFactoryContext, BuildEnvResult, } from "./plugin-types.js";
@@ -0,0 +1,56 @@
1
+ import type { Connect } from "vite";
2
+ /**
3
+ * Bake the resolved INTERNAL_RANGO_DEBUG value into the router's `internal-debug`
4
+ * module so the flag reaches the CLIENT debug logs by just setting the env var.
5
+ *
6
+ * internal-debug.ts normally reads the flag via `typeof __RANGO_DEBUG__`, a Vite
7
+ * define. That delivery is unreliable on the client: in dev Vite ships the define
8
+ * only as an injected global whose presence varies across consumer setups, so the
9
+ * module can fall through to `process.env` (undefined in the browser) and the FE
10
+ * debug flag silently stays false while the server logs work. A Vite `transform`
11
+ * runs on the module regardless of how (or whether) the define is delivered, in
12
+ * both dev and build and for every environment, so the discovery plugin uses this
13
+ * to replace the module with the resolved literal.
14
+ */
15
+ /**
16
+ * Scope to the router's own internal-debug module: the published package
17
+ * (`/@rangojs/router/`, incl. pnpm's nested layout) or the monorepo workspace
18
+ * (`/packages/rangojs-router/`). The package-anchored path avoids matching a
19
+ * consumer file that merely sits under a directory named `rangojs-router`.
20
+ * Accepts module ids and dev-server URLs (`/@fs/...internal-debug.ts?v=abc`).
21
+ */
22
+ export declare function isRouterInternalDebugId(id: string): boolean;
23
+ /**
24
+ * Transform: replace the module with the resolved literal.
25
+ * Returns null for any module that is not the router's internal-debug module.
26
+ */
27
+ export declare function injectClientDebugFlag(id: string): {
28
+ code: string;
29
+ map: null;
30
+ } | null;
31
+ /**
32
+ * Dev middleware companion: serve the internal-debug module `no-cache` so the
33
+ * browser revalidates it (etag) instead of trusting an immutable cache entry.
34
+ *
35
+ * Why: the transform bakes the flag into module CONTENT, but a published
36
+ * consumer resolves the module into node_modules, where dev serves it as
37
+ * `internal-debug.ts?v=<hash>` with `Cache-Control: max-age=31536000,immutable`.
38
+ * That `?v=` hash does not vary with env vars (verified on Vite 8: getConfigHash
39
+ * hashes NODE_ENV, resolve, plugin names, optimizeDeps -- not arbitrary env
40
+ * state), so toggling the flag changed the content under an unchanged immutable
41
+ * URL: a browser that ever loaded the app with the flag off kept the
42
+ * baked-`false` module across dev-server restarts, and INTERNAL_RANGO_DEBUG
43
+ * never reached the FE logs while the server logs worked. The monorepo was
44
+ * immune -- workspace source is outside node_modules and served no-cache --
45
+ * which is why this bit only npm consumers.
46
+ *
47
+ * internal-debug.ts is the ONLY flag-varying module in the graph (its importers
48
+ * are byte-identical across flag states), so forcing revalidation for this one
49
+ * tiny module is sufficient and costs one conditional request per session. The
50
+ * middleware is unconditional (not gated on the flag) so an already-poisoned
51
+ * cache heals in both directions. Alternatives that do not work: a plugin
52
+ * `resolveId` appending a flag query never fires in Vite 8 dev for
53
+ * fs-resolvable relative imports, and the pre-#621 `define` no longer rotates
54
+ * the optimizer hash (define contents are not part of getConfigHash).
55
+ */
56
+ export declare function internalDebugNoCacheMiddleware(): Connect.NextHandleFunction;
@@ -0,0 +1,298 @@
1
+ /**
2
+ * Context passed to a buildEnv factory function.
3
+ * Provides Vite config details for conditional env setup.
4
+ */
5
+ export interface BuildEnvFactoryContext {
6
+ /** Vite project root directory. */
7
+ root: string;
8
+ /** Vite mode (e.g. "development", "production"). */
9
+ mode: string;
10
+ /** Vite command ("serve" for dev, "build" for production). */
11
+ command: "serve" | "build";
12
+ /** Router deployment preset. */
13
+ preset: "node" | "cloudflare" | "vercel";
14
+ }
15
+ /**
16
+ * Factory function that creates build-time environment bindings.
17
+ * Called once at plugin startup. Return `dispose` to clean up resources.
18
+ */
19
+ export type BuildEnvFactory = (ctx: BuildEnvFactoryContext) => Promise<BuildEnvResult> | BuildEnvResult;
20
+ /**
21
+ * Result of resolving build-time environment bindings.
22
+ */
23
+ export interface BuildEnvResult {
24
+ /** Environment bindings available to Prerender/Static handlers via ctx.env. */
25
+ env: Record<string, unknown>;
26
+ /** Called after build completes to clean up resources (e.g., miniflare). */
27
+ dispose?: () => Promise<void> | void;
28
+ }
29
+ /**
30
+ * Build-time environment configuration for Prerender and Static handlers.
31
+ *
32
+ * - `false` (default): no build-time env, `ctx.env` throws.
33
+ * - `"auto"`: calls `wrangler.getPlatformProxy()` (cloudflare preset only).
34
+ * - Object: used directly as `ctx.env` during build.
35
+ * - Factory: called once at startup, must return `{ env, dispose? }`.
36
+ */
37
+ export type BuildEnvOption = false | "auto" | Record<string, unknown> | BuildEnvFactory;
38
+ /**
39
+ * Metadata for one client ("use client") module, passed to a {@link ClientChunks}
40
+ * function. Mirrors the shape `@vitejs/plugin-rsc` passes to its own
41
+ * `clientChunks` option.
42
+ */
43
+ export interface ClientChunkMeta {
44
+ /** Absolute module id of the "use client" file. */
45
+ id: string;
46
+ /** Normalized (posix) module id — convenient for path-based matching. */
47
+ normalizedId: string;
48
+ /**
49
+ * The RSC/server chunk that statically imports this client reference. This is
50
+ * the key used for the default grouping when no override is supplied: a single
51
+ * router that statically imports every route yields ONE `serverChunk`, hence
52
+ * one client chunk for all routes.
53
+ */
54
+ serverChunk: string;
55
+ }
56
+ /**
57
+ * Controls how client ("use client") components are grouped into browser
58
+ * chunks, i.e. per-route / per-feature code splitting of the client bundle.
59
+ *
60
+ * Without splitting, a single router ships ONE client chunk containing every
61
+ * route's client components (and their CSS) — navigating to one route downloads
62
+ * every other route's client code. (Host sub-apps loaded via a dynamic `import()`
63
+ * are the exception: each forms its own chunk.) This option controls how that
64
+ * monolith is split.
65
+ *
66
+ * Behavior branches:
67
+ * - `true` / omitted (**default**, pre-1.0): Rango's built-in **directory
68
+ * strategy**. It splits app `"use client"` modules by **route id** — the segment
69
+ * after a route-root directory (`routes`, `app`, `pages`, `features`, `handlers`,
70
+ * …) — so `routes/dashboard/**` becomes `app-dashboard` at any nesting depth.
71
+ * Where it finds NO route structure (a flat `src/components/`, or host sub-apps
72
+ * already split by a dynamic `import()`), it inherits the default grouping
73
+ * unchanged — so the shared `src/components` chunk stays shared and host apps do
74
+ * not leak across each other. Shared runtime (React, the router, `node_modules`)
75
+ * is never split.
76
+ * - `false`: opt out — inherit `@vitejs/plugin-rsc`'s default grouping everywhere
77
+ * (one chunk per router / per host sub-app).
78
+ * - function: full override. Return a chunk group name, or `undefined` to fall
79
+ * back to the default grouping for that one module. Forwarded directly to
80
+ * `@vitejs/plugin-rsc`'s `clientChunks`.
81
+ *
82
+ * Every module maps to exactly one group, so there is no byte duplication: a
83
+ * component used by two routes lives in one group and is fetched whenever it
84
+ * renders. Put genuinely shared client components OUTSIDE route directories so
85
+ * they land in the shared group rather than one route's chunk.
86
+ *
87
+ * @default true
88
+ */
89
+ export type ClientChunks = boolean | ((meta: ClientChunkMeta) => string | undefined);
90
+ /**
91
+ * Document script strategy. See {@link RangoBaseOptions.headScripts}.
92
+ */
93
+ export type HeadScriptsOption = "preinit" | "preload";
94
+ /**
95
+ * Base options shared by all presets
96
+ */
97
+ interface RangoBaseOptions {
98
+ /**
99
+ * Show startup banner. Set to false to disable.
100
+ * @default true
101
+ */
102
+ banner?: boolean;
103
+ /**
104
+ * Group client ("use client") components into browser chunks for per-route /
105
+ * per-feature code splitting. On by default (pre-1.0); pass `false` to opt out.
106
+ * See {@link ClientChunks}.
107
+ *
108
+ * @default true
109
+ */
110
+ clientChunks?: ClientChunks;
111
+ /**
112
+ * How the document ships its JavaScript.
113
+ *
114
+ * - `"preinit"` (**default**): client-reference chunks render as EXECUTING
115
+ * `<script type="module" async>` tags hoisted into `<head>` (upgrading
116
+ * plugin-rsc's modulepreload hints in place), and the browser entry ships
117
+ * as Fizz `bootstrapModules` — a head `modulepreload fetchpriority=low`
118
+ * hint plus the executing end-of-shell `id="_R_"` module script. Chunk
119
+ * execution overlaps body streaming instead of waiting for the hydration
120
+ * import walk; under PPR everything lands in the stored shell prelude.
121
+ * - `"preload"`: the previous behavior — `<link rel="modulepreload">` hints
122
+ * only, entry as an inline `import()` script at end of shell. Chunks
123
+ * fetch+compile early but execute only when hydration imports them.
124
+ *
125
+ * Build-only for the chunk half: plugin-rsc resolves no JS deps per client
126
+ * reference in dev, so dev documents carry no head chunk scripts in either
127
+ * mode (the bootstrap conversion does apply in dev). Trades and upstream
128
+ * limits are documented in src/ssr/preinit-client-references.ts.
129
+ *
130
+ * Wired in the generated virtual SSR entry
131
+ * (`src/ssr/preinit-client-references.ts` has the mechanism); apps with a
132
+ * custom SSR entry choose per-handler via `SSRDependencies.headScripts` and
133
+ * `installClientReferencePreinit`.
134
+ *
135
+ * @default "preinit"
136
+ */
137
+ headScripts?: HeadScriptsOption;
138
+ /**
139
+ * Filter which files route discovery scans, by glob. Paths are matched
140
+ * root-relative (e.g. `src/routes/**`). `include` restricts discovery to
141
+ * matching files; `exclude` removes matches (the defaults cover tests, dist,
142
+ * coverage, etc.). Mirrors the CLI's `--include`/`--exclude`.
143
+ *
144
+ * @example
145
+ * rango({ discovery: { include: ["src/routes/**"] } })
146
+ */
147
+ discovery?: {
148
+ include?: string[];
149
+ exclude?: string[];
150
+ };
151
+ /**
152
+ * What to do when a `Prerender` route's or `Static` handler's render throws at
153
+ * build time. Otherwise the route error boundary catches it and the rendered
154
+ * error page is baked as the artifact, then served as an HTTP 200 — a silent,
155
+ * user-visible breakage (issue #587). Independent of this setting, a render may
156
+ * `throw new Skip()` (from `@rangojs/router`) to skip a single URL/handler.
157
+ *
158
+ * - `"fail"` (**default**): fail the build, naming the URL/handler and the
159
+ * original render error.
160
+ * - `"warn"`: log a warning and skip baking the artifact — it is never served as a
161
+ * baked 200 error page. `"warn"` is a build-unblock, NOT a runtime contract for
162
+ * the skipped entry: the route falls through to normal resolution, which may
163
+ * render live (its handler is still bundled — e.g. when nothing else baked) or
164
+ * 404 (once prerender handler eviction has run for other baked entries), so the
165
+ * outcome depends on the rest of the build, and a skipped `Static()` handler's
166
+ * evicted code can surface as an error. For DEFINED runtime behavior use
167
+ * `Passthrough()` (a live fallback) or `throw new Skip()` (an intentional skip);
168
+ * otherwise prefer the default `"fail"`.
169
+ *
170
+ * @default "fail"
171
+ */
172
+ prerender?: {
173
+ onError?: "fail" | "warn";
174
+ };
175
+ }
176
+ /**
177
+ * Options for Node.js deployment (default)
178
+ */
179
+ export interface RangoNodeOptions extends RangoBaseOptions {
180
+ /**
181
+ * Deployment preset. Defaults to 'node' when not specified.
182
+ */
183
+ preset?: "node";
184
+ /**
185
+ * Path to a host-router entry (a module that calls `createHostRouter()` and
186
+ * exports the instance) to serve instead of a single `createRouter()` app.
187
+ * Root-relative (e.g. `"./src/worker.rsc.tsx"`).
188
+ *
189
+ * Set this when the app is a multi-app host router: auto-discovery otherwise
190
+ * finds the sub-apps' multiple `createRouter()` files and cannot pick an entry.
191
+ * When omitted, rango auto-detects a single `createHostRouter()` file if the
192
+ * app has several `createRouter()` files. The host module must export the
193
+ * `HostRouter` instance (default export or a named `hostRouter`/`router`
194
+ * export), not a Cloudflare-style `{ fetch }` object.
195
+ */
196
+ hostRouter?: string;
197
+ /**
198
+ * Environment bindings available to Prerender and Static handlers at build
199
+ * time via `ctx.env`. Shared across all prerender invocations for the build.
200
+ *
201
+ * `"auto"` is Cloudflare-only (it resolves the wrangler platform proxy), so it
202
+ * is not accepted on the Node preset — pass an object or a factory instead.
203
+ *
204
+ * @default false
205
+ */
206
+ buildEnv?: Exclude<BuildEnvOption, "auto">;
207
+ }
208
+ /**
209
+ * Options for Cloudflare Workers deployment
210
+ */
211
+ export interface RangoCloudflareOptions extends RangoBaseOptions {
212
+ /**
213
+ * Deployment preset for Cloudflare Workers.
214
+ * When using cloudflare preset:
215
+ * - @vitejs/plugin-rsc IS still added by rango(), but with `serverHandler: false`
216
+ * (the cloudflare plugin owns the RSC worker/server entry); only `client` and
217
+ * `ssr` virtual entries are configured, no rsc entry
218
+ * - Your worker entry (e.g., worker.rsc.tsx) imports the router directly
219
+ * - Browser and SSR use virtual entries
220
+ * - Build-time manifest generation is auto-detected from the resolved RSC environment config
221
+ */
222
+ preset: "cloudflare";
223
+ /**
224
+ * Environment bindings available to Prerender and Static handlers at build
225
+ * time via `ctx.env`. Shared across all prerender invocations for the build.
226
+ *
227
+ * `"auto"` resolves the Cloudflare platform proxy via wrangler
228
+ * `getPlatformProxy()`.
229
+ *
230
+ * @default false
231
+ */
232
+ buildEnv?: BuildEnvOption;
233
+ }
234
+ /**
235
+ * Per-function knobs for the Vercel deployment, written into the generated
236
+ * `.vc-config.json` (and `config.json` for `functionName`).
237
+ */
238
+ export interface VercelPresetOptions {
239
+ /** Node runtime for the function. @default "nodejs22.x" */
240
+ runtime?: string;
241
+ /** Max execution time in seconds. @default 30 */
242
+ maxDuration?: number;
243
+ /** Function memory in MB (platform default when omitted). */
244
+ memory?: number;
245
+ /** Regions to pin the function to (platform default when omitted). */
246
+ regions?: string[];
247
+ /**
248
+ * Function name — the `<name>.func` directory and the `config.json` route
249
+ * destination. @default "index"
250
+ */
251
+ functionName?: string;
252
+ }
253
+ /**
254
+ * Options for Vercel Functions deployment.
255
+ *
256
+ * Builds like the node preset (Vercel runs Node Functions, not Workers): rango
257
+ * owns the RSC entry, `process.env.NODE_ENV` is folded for the build, and after
258
+ * the build a `.vercel/output` directory (Build Output API v3) is assembled from
259
+ * `dist/` — a single streaming Node Function plus the static client assets. The
260
+ * app must install `@vercel/functions` (used by `VercelCacheStore` and the
261
+ * generated function launcher).
262
+ */
263
+ export interface RangoVercelOptions extends RangoBaseOptions {
264
+ /**
265
+ * Deployment preset for Vercel Functions.
266
+ */
267
+ preset: "vercel";
268
+ /**
269
+ * Path to a host-router entry (a module that calls `createHostRouter()` and
270
+ * exports the instance) to serve instead of a single `createRouter()` app.
271
+ * Root-relative (e.g. `"./src/worker.rsc.tsx"`).
272
+ *
273
+ * Set this when the app is a multi-app host router: auto-discovery otherwise
274
+ * finds the sub-apps' multiple `createRouter()` files and cannot pick an entry.
275
+ * When omitted, rango auto-detects a single `createHostRouter()` file if the
276
+ * app has several `createRouter()` files. The host module must export the
277
+ * `HostRouter` instance (default export or a named `hostRouter`/`router`
278
+ * export), not a Cloudflare-style `{ fetch }` object. The Vercel function then
279
+ * runs `hostRouter.match()` for every request (single-function deploy).
280
+ */
281
+ hostRouter?: string;
282
+ /**
283
+ * Environment bindings available to Prerender and Static handlers at build
284
+ * time via `ctx.env`. `"auto"` is Cloudflare-only; pass an object or a factory.
285
+ *
286
+ * @default false
287
+ */
288
+ buildEnv?: Exclude<BuildEnvOption, "auto">;
289
+ /**
290
+ * Vercel function configuration written into the Build Output.
291
+ */
292
+ vercel?: VercelPresetOptions;
293
+ }
294
+ /**
295
+ * Options for rango() Vite plugin
296
+ */
297
+ export type RangoOptions = RangoNodeOptions | RangoCloudflareOptions | RangoVercelOptions;
298
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * Transform CJS vendor files from @vitejs/plugin-rsc to ESM for browser compatibility.
4
+ * The react-server-dom vendor files are shipped as CJS which doesn't work in browsers.
5
+ */
6
+ export declare function createCjsToEsmPlugin(): Plugin;
@@ -0,0 +1,40 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * Extract the bare package name from an absolute node_modules path.
4
+ * Handles scoped packages (@org/name) and nested node_modules.
5
+ * Returns null if the path doesn't contain a valid package reference.
6
+ *
7
+ * NOTE: This is a lossy transformation. It maps a specific submodule path
8
+ * (e.g., pkg/internal/context.js) to the package root (pkg). The load()
9
+ * hook then re-exports via the bare specifier, which resolves to the
10
+ * package entry point. This works for packages that barrel-export their
11
+ * "use client" symbols from the root, which covers the common case
12
+ * (component libraries like @mantine/core, @chakra-ui/react, etc.).
13
+ * Packages whose client symbols are only available from deep subpaths
14
+ * (not re-exported from the root) would lose those symbols after the
15
+ * rewrite. A more precise approach would resolve through the package's
16
+ * exports map to find the correct entry point, but that adds significant
17
+ * complexity for a rare edge case.
18
+ * See: https://github.com/cloudflare/vinext/pull/413
19
+ */
20
+ export declare function extractPackageName(absolutePath: string): string | null;
21
+ /**
22
+ * Vite plugin that deduplicates client references from third-party packages
23
+ * in dev mode.
24
+ *
25
+ * When @vitejs/plugin-rsc encounters a "use client" submodule inside a
26
+ * package imported from a server component, it creates a
27
+ * client-in-server-package-proxy virtual module that re-exports from the
28
+ * absolute file path. In the client environment, this absolute path bypasses
29
+ * Vite's pre-bundling, while direct client imports of the same package go
30
+ * through .vite/deps/. Two separate module instances are created, breaking
31
+ * React contexts (createContext runs twice, provider/consumer mismatch).
32
+ *
33
+ * This plugin intercepts absolute node_modules imports from proxy modules
34
+ * in the client environment and rewrites them to bare specifier imports
35
+ * that go through pre-bundling, ensuring a single module instance.
36
+ *
37
+ * Dev-only: production builds use the SSR manifest which handles module
38
+ * identity correctly.
39
+ */
40
+ export declare function clientRefDedup(): Plugin;
@@ -0,0 +1,35 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * Compute the production SHA-256 hash for a dev-mode client reference key.
4
+ * Mirrors the hashing logic in @vitejs/plugin-rsc's build mode:
5
+ * - Local files: hashString(toRelativeId(id)) where toRelativeId = relative(root, id)
6
+ * - Package proxies: hashString(packageSource)
7
+ * - client-in-server-package proxies: hashString(relative(root, decodedAbsPath))
8
+ *
9
+ * Returns the input unchanged if it doesn't match a known dev-mode pattern
10
+ * (e.g., already a production hash).
11
+ */
12
+ /**
13
+ * The production client-reference key hash: `sha256(relativeId).slice(0,12)`,
14
+ * matching @vitejs/plugin-rsc's `hashString`. Exported so the client-chunks
15
+ * strategy can hash a `clientChunks` callback's `meta.normalizedId` (already the
16
+ * project-root-relative id) and compare it against fallback hashes collected
17
+ * during discovery.
18
+ */
19
+ export declare function hashRefKey(relativeId: string): string;
20
+ export declare function computeProductionHash(projectRoot: string, refKey: string): string;
21
+ /**
22
+ * Transform source code by replacing dev-mode client reference keys with
23
+ * production hashes. Exported for testing; used internally by hashClientRefs.
24
+ * Returns null if no replacements were made.
25
+ */
26
+ export declare function transformClientRefs(code: string, projectRoot: string): string | null;
27
+ /**
28
+ * Vite plugin that rewrites registerClientReference() calls in the RSC
29
+ * environment, replacing dev-mode reference keys with production hashes.
30
+ *
31
+ * This runs AFTER the RSC plugin's transform so the Flight serializer
32
+ * naturally emits production IDs, eliminating the need for post-build
33
+ * regex replacement of Flight payloads.
34
+ */
35
+ export declare function hashClientRefs(projectRoot: string): Plugin;
@@ -0,0 +1,64 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * `globalThis` key the `cloudflare:workers` stub reads to populate its
4
+ * `env` export. Router discovery sets this to the resolved `buildEnv`
5
+ * proxy (from `wrangler.getPlatformProxy()` when `buildEnv: "auto"` is
6
+ * configured, or a user-supplied object otherwise) before importing the
7
+ * worker entry, and clears it after discovery disposes the proxy. When
8
+ * unset, the stub's `env` falls back to `{}`.
9
+ *
10
+ * Using `globalThis` is the only cross-module bridge that works here:
11
+ * the stub's `load` hook returns source text, not a live closure, but
12
+ * the stub module is evaluated in the same Node process as the
13
+ * discovery plugin — so reading a global at module-evaluation time
14
+ * reaches whatever the plugin assigned there. A symbol key would be
15
+ * cleaner in-process but awkward to name from the stub source.
16
+ *
17
+ * @internal
18
+ */
19
+ export declare const BUILD_ENV_GLOBAL_KEY = "__rango_build_env__";
20
+ /**
21
+ * Stubs `cloudflare:*` imports for the discovery-time Node Vite server.
22
+ *
23
+ * Discovery only evaluates user module top-level code — it never invokes
24
+ * DurableObject / WorkerEntrypoint / Workflow handlers — so empty base
25
+ * classes are enough for `class X extends DurableObject {}` declarations
26
+ * to load in Node, where `cloudflare:*` is otherwise unresolvable.
27
+ *
28
+ * Interception point: a transform hook parses source with Rollup's
29
+ * plugin-context parser (`this.parse`) and rewrites only real import
30
+ * specifier spans (`import ... from "cloudflare:xxx"`,
31
+ * `import("cloudflare:xxx")`, `export ... from "cloudflare:xxx"`) to a
32
+ * plain virtual module name (`virtual:rango-cloudflare-stub-xxx`).
33
+ * This must be done in transform because Vite's module runner routes
34
+ * URL-scheme specifiers straight to Node's native ESM loader without
35
+ * consulting plugin `resolveId` hooks. Using the AST (instead of a
36
+ * text regex or a permissive lexer) guarantees that strings,
37
+ * comments, and template literals that merely contain import-like
38
+ * text are never mutated — the walker only looks at the four import
39
+ * node types.
40
+ *
41
+ * The transform runs on user source AND on compiled node_modules
42
+ * output: real-world CF packages (e.g. the Cloudflare Agents SDK)
43
+ * ship compiled JS that contains `import ... from "cloudflare:email"`
44
+ * and similar, so excluding node_modules would leave those imports
45
+ * unrewritten. Cost is small because the early exit (`code.includes`)
46
+ * skips files with no cloudflare: mention.
47
+ *
48
+ * The plugin intentionally runs at Vite's default ordering (no
49
+ * `enforce: "pre"`) so TS/JSX has already been compiled to plain JS
50
+ * by the time `this.parse` runs — acorn doesn't understand
51
+ * non-standard syntax.
52
+ *
53
+ * `cloudflare:workers`, `cloudflare:email`, `cloudflare:sockets`, and
54
+ * `cloudflare:workflows` each get curated stubs with the well-known
55
+ * symbols that appear in top-level `extends` positions. Any other
56
+ * `cloudflare:*` specifier falls back to an empty default export —
57
+ * discovery never executes the handlers, so an empty module is safe
58
+ * for anything the graph pulls in transitively.
59
+ *
60
+ * Only registered in the discovery temp server, not the user's runtime
61
+ * config.
62
+ * @internal
63
+ */
64
+ export declare function createCloudflareProtocolStubPlugin(): Plugin;
@@ -0,0 +1,18 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * Vite plugin that exposes action IDs on server reference functions.
4
+ *
5
+ * When React Server Components creates server references via createServerReference(),
6
+ * the action ID (format: "hash#actionName") is passed as the first argument but not
7
+ * exposed on the returned function. This plugin transforms the output to attach
8
+ * the $id property to each server reference function, enabling the router to
9
+ * identify which action was called during revalidation.
10
+ *
11
+ * Server bundles (RSC/SSR) get file paths in $id for filtering (e.g., "src/actions.ts#add").
12
+ * Client bundles keep hashed IDs for security (e.g., "ec387bc704d4#add").
13
+ *
14
+ * Works in:
15
+ * - Build mode: uses renderChunk to transform bundled chunks
16
+ * - Dev mode: uses transform with enforce:"post" to transform after RSC plugin
17
+ */
18
+ export declare function exposeActionId(): Plugin;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Normalize path to forward slashes.
3
+ */
4
+ export declare function normalizePath(p: string): string;
5
+ export declare function hashId(filePath: string, exportName: string): string;
6
+ export declare function makeStubId(filePath: string, exportName: string, isBuild: boolean): string;
7
+ export declare function hashInlineId(filePath: string, fnName: string, index: number): string;
8
+ export interface DetectedImports {
9
+ loader: boolean;
10
+ handle: boolean;
11
+ locationState: boolean;
12
+ prerenderHandler: boolean;
13
+ staticHandler: boolean;
14
+ router: boolean;
15
+ any: boolean;
16
+ }
17
+ export declare function buildExportMap(program: any): Map<string, string[]>;
18
+ export declare function detectImports(code: string): DetectedImports;
19
+ export declare function skipStringOrComment(code: string, pos: number): number;
20
+ export declare function findMatchingParen(code: string, startPos: number): number;
21
+ export declare function countArgs(code: string, startPos: number, endPos: number): number;
22
+ export declare function findStatementEnd(code: string, pos: number): number;
23
+ export { escapeRegExp } from "../../regex-escape.js";
24
+ /**
25
+ * Given an index pointing just past a `create*` callee identifier, return the
26
+ * index of the call's opening `(`, accounting for an optional generic type
27
+ * argument list `<...>` with arbitrarily nested `<>`. Returns -1 when the next
28
+ * non-trivia token is neither `<` nor `(` (i.e. not a call site).
29
+ *
30
+ * Replaces the single-level `<[^>]*>` regex assumption, which stopped at the
31
+ * first `>` and so never reached `(` for `createRouter<Config<Env>>(`.
32
+ *
33
+ * Whitespace, comments, and strings between the callee and `(` are skipped via
34
+ * skipStringOrComment. The `<...>` scan only balances angle brackets; it does
35
+ * not attempt to parse full TS type syntax (sufficient for locating the paren).
36
+ */
37
+ export declare function findCallParenAfterGenerics(code: string, afterCalleeIndex: number): number;
@@ -0,0 +1,19 @@
1
+ import type { CreateExportBinding } from "./types.js";
2
+ export declare function isExportOnlyFile(code: string, bindings: CreateExportBinding[]): boolean;
3
+ export declare function countCreateCallsForNames(code: string, fnNames: string[]): number;
4
+ export declare function offsetToLineColumn(code: string, index: number): {
5
+ line: number;
6
+ column: number;
7
+ };
8
+ export declare function findUnsupportedCreateCallSites(code: string, fnNames: string[], supportedBindings: CreateExportBinding[]): Array<{
9
+ line: number;
10
+ column: number;
11
+ }>;
12
+ export declare function getImportedFnNames(code: string, importedName: string): string[];
13
+ export declare function getCalledIdentifierFromCall(callExpr: any): string | null;
14
+ export declare function collectCreateExportBindingsFallback(code: string, fnNames: string[]): CreateExportBinding[];
15
+ export declare function collectCreateExportBindings(code: string, fnNames: string[], program?: any): CreateExportBinding[];
16
+ export declare function buildUnsupportedShapeWarning(filePath: string, fnName: string, sites?: Array<{
17
+ line: number;
18
+ column: number;
19
+ }>): string;
@@ -0,0 +1,10 @@
1
+ import MagicString from "magic-string";
2
+ import type { HandlerTransformConfig, CreateExportBinding } from "./types.js";
3
+ export declare function transformHandles(bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
4
+ export declare function transformLocationState(bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
5
+ export declare function generateWholeFileStubs(cfg: HandlerTransformConfig, bindings: CreateExportBinding[], code: string, filePath: string, isBuild: boolean): {
6
+ code: string;
7
+ map: null;
8
+ } | null;
9
+ export declare function stubHandlerExprs(cfg: HandlerTransformConfig, bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
10
+ export declare function transformHandlerIds(cfg: HandlerTransformConfig, bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
@@ -0,0 +1,8 @@
1
+ import type MagicString from "magic-string";
2
+ import type { CreateExportBinding } from "./types.js";
3
+ export declare function hasCreateLoaderImport(code: string): boolean;
4
+ export declare function generateClientLoaderStubs(bindings: CreateExportBinding[], code: string, filePath: string, isBuild: boolean): {
5
+ code: string;
6
+ map?: undefined;
7
+ } | null;
8
+ export declare function transformLoaders(bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
@@ -0,0 +1,13 @@
1
+ import type { Plugin } from "vite";
2
+ import MagicString from "magic-string";
3
+ export declare function transformRouter(code: string, filePath: string, routerFnNames: string[], absolutePath?: string, warn?: (message: string) => void): {
4
+ code: string;
5
+ map: ReturnType<MagicString["generateMap"]>;
6
+ } | null;
7
+ /**
8
+ * Inject stable $$id into createRouter() calls at compile time.
9
+ * This must be a separate plugin without enforce:"post" because running
10
+ * at "post" priority changes Vite's dep optimization timing and can cause
11
+ * ERR_OUTDATED_OPTIMIZED_DEP / React dual-instance issues.
12
+ */
13
+ export declare function exposeRouterId(): Plugin;
@@ -0,0 +1,29 @@
1
+ export interface HandlerTransformConfig {
2
+ fnName: string;
3
+ brand: string;
4
+ }
5
+ export interface CreateExportBinding {
6
+ localName: string;
7
+ exportNames: string[];
8
+ callExprStart: number;
9
+ callOpenParenPos: number;
10
+ callCloseParenPos: number;
11
+ argCount: number;
12
+ statementEnd: number;
13
+ }
14
+ export interface StrictCreateTransformConfig {
15
+ fnName: "createLoader" | "createHandle" | "createLocationState";
16
+ }
17
+ export declare const PRERENDER_CONFIG: HandlerTransformConfig;
18
+ export declare const STATIC_CONFIG: HandlerTransformConfig;
19
+ export declare const STRICT_CREATE_CONFIGS: StrictCreateTransformConfig[];
20
+ export interface ExposeInternalIdsApi {
21
+ /** Tracks absolute module IDs that contain prerender handler exports.
22
+ * key: absolute module ID (filesystem path)
23
+ * value: array of export names (e.g., ["ArticlesIndex", "ArticleDetail"]) */
24
+ prerenderHandlerModules: Map<string, string[]>;
25
+ /** Tracks absolute module IDs that contain static handler exports.
26
+ * key: absolute module ID (filesystem path)
27
+ * value: array of export names (e.g., ["DocsNav", "DocShell"]) */
28
+ staticHandlerModules: Map<string, string[]>;
29
+ }