@rangojs/router 0.0.0-experimental.d7eeaa75 → 0.0.0-experimental.d98a8e9d

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 (278) hide show
  1. package/README.md +120 -25
  2. package/dist/bin/rango.js +147 -57
  3. package/dist/testing/vitest.js +82 -0
  4. package/dist/vite/index.js +2154 -861
  5. package/dist/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
  6. package/package.json +57 -11
  7. package/skills/api-client/SKILL.md +211 -0
  8. package/skills/breadcrumbs/SKILL.md +3 -1
  9. package/skills/bundle-analysis/SKILL.md +159 -0
  10. package/skills/cache-guide/SKILL.md +220 -30
  11. package/skills/caching/SKILL.md +116 -8
  12. package/skills/composability/SKILL.md +27 -2
  13. package/skills/document-cache/SKILL.md +78 -55
  14. package/skills/handler-use/SKILL.md +364 -0
  15. package/skills/hooks/SKILL.md +229 -20
  16. package/skills/host-router/SKILL.md +45 -20
  17. package/skills/i18n/SKILL.md +276 -0
  18. package/skills/intercept/SKILL.md +46 -4
  19. package/skills/layout/SKILL.md +28 -7
  20. package/skills/links/SKILL.md +247 -17
  21. package/skills/loader/SKILL.md +219 -9
  22. package/skills/middleware/SKILL.md +47 -12
  23. package/skills/migrate-nextjs/SKILL.md +562 -0
  24. package/skills/migrate-react-router/SKILL.md +769 -0
  25. package/skills/mime-routes/SKILL.md +27 -0
  26. package/skills/observability/SKILL.md +137 -0
  27. package/skills/parallel/SKILL.md +71 -6
  28. package/skills/prerender/SKILL.md +14 -33
  29. package/skills/rango/SKILL.md +243 -22
  30. package/skills/react-compiler/SKILL.md +168 -0
  31. package/skills/response-routes/SKILL.md +122 -47
  32. package/skills/route/SKILL.md +57 -4
  33. package/skills/router-setup/SKILL.md +3 -3
  34. package/skills/server-actions/SKILL.md +751 -0
  35. package/skills/streams-and-websockets/SKILL.md +283 -0
  36. package/skills/testing/SKILL.md +128 -0
  37. package/skills/testing/bindings.md +89 -0
  38. package/skills/testing/cache-prerender.md +98 -0
  39. package/skills/testing/client-components.md +121 -0
  40. package/skills/testing/e2e-parity.md +124 -0
  41. package/skills/testing/flight.md +89 -0
  42. package/skills/testing/handles.md +127 -0
  43. package/skills/testing/loader.md +108 -0
  44. package/skills/testing/middleware.md +97 -0
  45. package/skills/testing/render-handler.md +102 -0
  46. package/skills/testing/response-routes.md +94 -0
  47. package/skills/testing/reverse-and-types.md +83 -0
  48. package/skills/testing/server-actions.md +89 -0
  49. package/skills/testing/server-tree.md +128 -0
  50. package/skills/testing/setup.md +120 -0
  51. package/skills/typesafety/SKILL.md +319 -27
  52. package/skills/use-cache/SKILL.md +34 -5
  53. package/skills/view-transitions/SKILL.md +294 -0
  54. package/src/__augment-tests__/augment.ts +81 -0
  55. package/src/__augment-tests__/augmented.check.ts +116 -0
  56. package/src/browser/action-coordinator.ts +53 -36
  57. package/src/browser/app-shell.ts +52 -0
  58. package/src/browser/event-controller.ts +86 -70
  59. package/src/browser/history-state.ts +21 -0
  60. package/src/browser/index.ts +3 -3
  61. package/src/browser/navigation-bridge.ts +84 -11
  62. package/src/browser/navigation-client.ts +104 -68
  63. package/src/browser/navigation-store.ts +32 -9
  64. package/src/browser/navigation-transaction.ts +10 -28
  65. package/src/browser/partial-update.ts +64 -26
  66. package/src/browser/prefetch/cache.ts +183 -44
  67. package/src/browser/prefetch/fetch.ts +228 -37
  68. package/src/browser/prefetch/queue.ts +36 -5
  69. package/src/browser/rango-state.ts +53 -13
  70. package/src/browser/react/Link.tsx +30 -2
  71. package/src/browser/react/NavigationProvider.tsx +72 -31
  72. package/src/browser/react/filter-segment-order.ts +51 -7
  73. package/src/browser/react/index.ts +3 -0
  74. package/src/browser/react/location-state-shared.ts +175 -4
  75. package/src/browser/react/location-state.ts +39 -13
  76. package/src/browser/react/use-handle.ts +17 -9
  77. package/src/browser/react/use-navigation.ts +22 -2
  78. package/src/browser/react/use-params.ts +20 -8
  79. package/src/browser/react/use-reverse.ts +106 -0
  80. package/src/browser/react/use-router.ts +22 -2
  81. package/src/browser/react/use-segments.ts +11 -8
  82. package/src/browser/response-adapter.ts +32 -1
  83. package/src/browser/rsc-router.tsx +69 -22
  84. package/src/browser/scroll-restoration.ts +22 -14
  85. package/src/browser/segment-reconciler.ts +36 -14
  86. package/src/browser/segment-structure-assert.ts +2 -2
  87. package/src/browser/server-action-bridge.ts +23 -30
  88. package/src/browser/types.ts +21 -0
  89. package/src/build/collect-fallback-refs.ts +107 -0
  90. package/src/build/generate-manifest.ts +60 -35
  91. package/src/build/generate-route-types.ts +2 -0
  92. package/src/build/index.ts +8 -1
  93. package/src/build/prefix-tree-utils.ts +123 -0
  94. package/src/build/route-trie.ts +95 -25
  95. package/src/build/route-types/codegen.ts +4 -4
  96. package/src/build/route-types/include-resolution.ts +1 -1
  97. package/src/build/route-types/per-module-writer.ts +7 -4
  98. package/src/build/route-types/router-processing.ts +55 -14
  99. package/src/build/route-types/scan-filter.ts +1 -1
  100. package/src/build/route-types/source-scan.ts +118 -0
  101. package/src/build/runtime-discovery.ts +9 -20
  102. package/src/cache/cache-scope.ts +28 -42
  103. package/src/cache/cf/cf-cache-store.ts +54 -13
  104. package/src/client.rsc.tsx +3 -0
  105. package/src/client.tsx +96 -205
  106. package/src/context-var.ts +5 -5
  107. package/src/decode-loader-results.ts +36 -0
  108. package/src/errors.ts +30 -4
  109. package/src/handle.ts +32 -14
  110. package/src/host/index.ts +2 -2
  111. package/src/host/router.ts +129 -57
  112. package/src/host/types.ts +31 -2
  113. package/src/host/utils.ts +1 -1
  114. package/src/href-client.ts +140 -21
  115. package/src/index.rsc.ts +10 -6
  116. package/src/index.ts +54 -17
  117. package/src/loader-store.ts +500 -0
  118. package/src/loader.rsc.ts +25 -7
  119. package/src/loader.ts +16 -9
  120. package/src/missing-id-error.ts +68 -0
  121. package/src/outlet-context.ts +1 -1
  122. package/src/prerender.ts +27 -6
  123. package/src/response-utils.ts +37 -0
  124. package/src/reverse.ts +65 -36
  125. package/src/route-content-wrapper.tsx +6 -28
  126. package/src/route-definition/dsl-helpers.ts +384 -257
  127. package/src/route-definition/helper-factories.ts +29 -139
  128. package/src/route-definition/helpers-types.ts +100 -28
  129. package/src/route-definition/resolve-handler-use.ts +6 -0
  130. package/src/route-definition/use-item-types.ts +32 -0
  131. package/src/route-types.ts +26 -41
  132. package/src/router/basename.ts +14 -0
  133. package/src/router/content-negotiation.ts +15 -2
  134. package/src/router/error-handling.ts +1 -1
  135. package/src/router/find-match.ts +54 -6
  136. package/src/router/handler-context.ts +21 -38
  137. package/src/router/intercept-resolution.ts +4 -18
  138. package/src/router/lazy-includes.ts +41 -22
  139. package/src/router/loader-resolution.ts +82 -36
  140. package/src/router/manifest.ts +41 -19
  141. package/src/router/match-api.ts +4 -3
  142. package/src/router/match-handlers.ts +63 -20
  143. package/src/router/match-middleware/cache-lookup.ts +44 -91
  144. package/src/router/match-middleware/cache-store.ts +3 -2
  145. package/src/router/match-result.ts +53 -32
  146. package/src/router/metrics.ts +1 -1
  147. package/src/router/middleware-types.ts +15 -26
  148. package/src/router/middleware.ts +99 -84
  149. package/src/router/pattern-matching.ts +116 -19
  150. package/src/router/prerender-match.ts +1 -1
  151. package/src/router/preview-match.ts +3 -1
  152. package/src/router/request-classification.ts +4 -28
  153. package/src/router/revalidation.ts +58 -2
  154. package/src/router/router-interfaces.ts +45 -28
  155. package/src/router/router-options.ts +40 -1
  156. package/src/router/router-registry.ts +2 -5
  157. package/src/router/segment-resolution/fresh.ts +27 -6
  158. package/src/router/segment-resolution/revalidation.ts +147 -106
  159. package/src/router/segment-resolution/view-transition-default.ts +36 -0
  160. package/src/router/substitute-pattern-params.ts +56 -0
  161. package/src/router/telemetry.ts +99 -0
  162. package/src/router/trie-matching.ts +40 -16
  163. package/src/router/types.ts +8 -0
  164. package/src/router/url-params.ts +49 -0
  165. package/src/router.ts +52 -30
  166. package/src/rsc/handler-context.ts +2 -2
  167. package/src/rsc/handler.ts +28 -69
  168. package/src/rsc/helpers.ts +91 -43
  169. package/src/rsc/index.ts +1 -1
  170. package/src/rsc/manifest-init.ts +28 -41
  171. package/src/rsc/origin-guard.ts +28 -10
  172. package/src/rsc/progressive-enhancement.ts +4 -0
  173. package/src/rsc/response-error.ts +79 -12
  174. package/src/rsc/response-route-handler.ts +57 -61
  175. package/src/rsc/rsc-rendering.ts +35 -51
  176. package/src/rsc/runtime-warnings.ts +9 -10
  177. package/src/rsc/server-action.ts +17 -37
  178. package/src/rsc/ssr-setup.ts +16 -0
  179. package/src/rsc/types.ts +8 -2
  180. package/src/runtime-env.ts +18 -0
  181. package/src/search-params.ts +4 -4
  182. package/src/segment-content-promise.ts +67 -0
  183. package/src/segment-loader-promise.ts +122 -0
  184. package/src/segment-system.tsx +132 -116
  185. package/src/serialize.ts +243 -0
  186. package/src/server/context.ts +175 -53
  187. package/src/server/cookie-store.ts +28 -4
  188. package/src/server/request-context.ts +67 -51
  189. package/src/ssr/index.tsx +5 -1
  190. package/src/static-handler.ts +25 -3
  191. package/src/testing/cache-status.ts +166 -0
  192. package/src/testing/collect-handle.ts +63 -0
  193. package/src/testing/dispatch.ts +581 -0
  194. package/src/testing/dom.entry.ts +22 -0
  195. package/src/testing/e2e/fixture.ts +188 -0
  196. package/src/testing/e2e/index.ts +149 -0
  197. package/src/testing/e2e/matchers.ts +51 -0
  198. package/src/testing/e2e/page-helpers.ts +272 -0
  199. package/src/testing/e2e/parity.ts +326 -0
  200. package/src/testing/e2e/server.ts +195 -0
  201. package/src/testing/flight-matchers.ts +110 -0
  202. package/src/testing/flight-normalize.ts +38 -0
  203. package/src/testing/flight-runtime.d.ts +57 -0
  204. package/src/testing/flight-tree.ts +682 -0
  205. package/src/testing/flight.entry.ts +51 -0
  206. package/src/testing/flight.ts +234 -0
  207. package/src/testing/generated-routes.ts +223 -0
  208. package/src/testing/index.ts +106 -0
  209. package/src/testing/internal/context.ts +304 -0
  210. package/src/testing/internal/flight-client-globals.ts +30 -0
  211. package/src/testing/internal/seed-vars.ts +42 -0
  212. package/src/testing/render-handler.ts +323 -0
  213. package/src/testing/render-route.tsx +590 -0
  214. package/src/testing/run-loader.ts +363 -0
  215. package/src/testing/run-middleware.ts +205 -0
  216. package/src/testing/vitest-stubs/cloudflare-email.ts +9 -0
  217. package/src/testing/vitest-stubs/cloudflare-workers.ts +21 -0
  218. package/src/testing/vitest-stubs/plugin-rsc.ts +16 -0
  219. package/src/testing/vitest-stubs/version.ts +5 -0
  220. package/src/testing/vitest.ts +285 -0
  221. package/src/types/global-namespace.ts +39 -26
  222. package/src/types/handler-context.ts +68 -50
  223. package/src/types/index.ts +1 -0
  224. package/src/types/loader-types.ts +11 -9
  225. package/src/types/request-scope.ts +126 -0
  226. package/src/types/route-entry.ts +11 -0
  227. package/src/types/segments.ts +35 -2
  228. package/src/urls/include-helper.ts +34 -67
  229. package/src/urls/index.ts +1 -5
  230. package/src/urls/path-helper-types.ts +41 -7
  231. package/src/urls/path-helper.ts +17 -52
  232. package/src/urls/pattern-types.ts +36 -19
  233. package/src/urls/response-types.ts +22 -29
  234. package/src/urls/type-extraction.ts +58 -139
  235. package/src/urls/urls-function.ts +1 -5
  236. package/src/use-loader.tsx +413 -42
  237. package/src/vite/debug.ts +185 -0
  238. package/src/vite/discovery/bundle-postprocess.ts +6 -6
  239. package/src/vite/discovery/discover-routers.ts +106 -75
  240. package/src/vite/discovery/discovery-errors.ts +194 -0
  241. package/src/vite/discovery/gate-state.ts +171 -0
  242. package/src/vite/discovery/prerender-collection.ts +67 -26
  243. package/src/vite/discovery/route-types-writer.ts +40 -84
  244. package/src/vite/discovery/self-gen-tracking.ts +27 -1
  245. package/src/vite/discovery/state.ts +33 -0
  246. package/src/vite/discovery/virtual-module-codegen.ts +13 -23
  247. package/src/vite/index.ts +2 -0
  248. package/src/vite/plugin-types.ts +67 -0
  249. package/src/vite/plugins/cjs-to-esm.ts +8 -7
  250. package/src/vite/plugins/client-ref-dedup.ts +16 -0
  251. package/src/vite/plugins/client-ref-hashing.ts +28 -5
  252. package/src/vite/plugins/cloudflare-protocol-loader-hook.d.mts +23 -0
  253. package/src/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
  254. package/src/vite/plugins/cloudflare-protocol-stub.ts +214 -0
  255. package/src/vite/plugins/expose-action-id.ts +54 -30
  256. package/src/vite/plugins/expose-id-utils.ts +12 -8
  257. package/src/vite/plugins/expose-ids/export-analysis.ts +100 -20
  258. package/src/vite/plugins/expose-ids/handler-transform.ts +8 -61
  259. package/src/vite/plugins/expose-ids/loader-transform.ts +3 -5
  260. package/src/vite/plugins/expose-ids/router-transform.ts +20 -3
  261. package/src/vite/plugins/expose-internal-ids.ts +496 -486
  262. package/src/vite/plugins/performance-tracks.ts +29 -25
  263. package/src/vite/plugins/use-cache-transform.ts +65 -50
  264. package/src/vite/plugins/version-injector.ts +39 -23
  265. package/src/vite/plugins/version-plugin.ts +59 -2
  266. package/src/vite/plugins/virtual-entries.ts +2 -2
  267. package/src/vite/rango.ts +116 -29
  268. package/src/vite/router-discovery.ts +750 -100
  269. package/src/vite/utils/ast-handler-extract.ts +15 -15
  270. package/src/vite/utils/banner.ts +1 -1
  271. package/src/vite/utils/bundle-analysis.ts +4 -2
  272. package/src/vite/utils/client-chunks.ts +190 -0
  273. package/src/vite/utils/forward-user-plugins.ts +193 -0
  274. package/src/vite/utils/manifest-utils.ts +8 -59
  275. package/src/vite/utils/package-resolution.ts +41 -1
  276. package/src/vite/utils/prerender-utils.ts +21 -6
  277. package/src/vite/utils/shared-utils.ts +107 -26
  278. package/src/browser/action-response-classifier.ts +0 -99
@@ -108,6 +108,33 @@ path.text("/api/data", () => "plain text version", { name: "dataText" }),
108
108
  Without an RSC primary, there is no `text/html` candidate — the Accept header
109
109
  picks among the response-type candidates directly.
110
110
 
111
+ ## Type Safety For Negotiated Paths
112
+
113
+ `router.named-routes.gen.ts` validates route names, params, search, `href()`, and
114
+ the `Rango.Path` type, but it does not carry response payload metadata. For MIME or
115
+ response payload types, use one of these surfaces:
116
+
117
+ - `RouteResponse<typeof patterns, "routeName">` for a specific response variant
118
+ by route name. This is the clearest option when several MIME variants share
119
+ one URL pattern.
120
+ - `Rango.PathResponse<"/products/:id">` (ambient, no import) for global lookup by URL pattern or concrete path after the app
121
+ registers `typeof router.routeMap`:
122
+
123
+ ```typescript
124
+ // router.tsx
125
+ export const router = createRouter({ document: Document }).routes(urlpatterns);
126
+
127
+ declare global {
128
+ namespace Rango {
129
+ interface RegisteredRoutes extends typeof router.routeMap {}
130
+ }
131
+ }
132
+ ```
133
+
134
+ `RegisteredRoutes` is what exposes the richer routeMap entries containing
135
+ response payload metadata. Without it, URL-pattern response lookup has paths but
136
+ no payloads, so response types resolve to `never`.
137
+
111
138
  ## How It Works
112
139
 
113
140
  1. **Build time**: `buildRouteTrie()` calls `mergeLeaves()` when multiple routes share a pattern.
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: observability
3
+ description: Debug Rango request performance with debugPerformance, Server-Timing, structured telemetry, and tracing
4
+ argument-hint:
5
+ ---
6
+
7
+ # Observability
8
+
9
+ Use this when you need to understand request latency, cache decisions,
10
+ revalidation behavior, loader overlap, or production traces.
11
+
12
+ Rango exposes two complementary observability surfaces:
13
+
14
+ 1. **Performance timeline** (`debugPerformance`) — per-request waterfall for
15
+ local or targeted debugging. It prints to the console and emits
16
+ `Server-Timing`.
17
+ 2. **Structured telemetry** (`telemetry`) — lifecycle events sent to a pluggable
18
+ sink for production monitoring, OpenTelemetry, or custom metrics.
19
+
20
+ The essentials are below. The exported `TelemetryEvent` union type
21
+ (`import type { TelemetryEvent } from "@rangojs/router"`) is the full event
22
+ contract — every event kind and its fields are typed there.
23
+
24
+ ## Performance timeline
25
+
26
+ Enable globally while debugging:
27
+
28
+ ```typescript
29
+ import { createRouter } from "@rangojs/router";
30
+
31
+ const router = createRouter({
32
+ document: Document,
33
+ urls: urlpatterns,
34
+ debugPerformance: true,
35
+ });
36
+ ```
37
+
38
+ Or enable for selected requests from middleware:
39
+
40
+ ```typescript
41
+ middleware(async (ctx, next) => {
42
+ if (ctx.url.searchParams.has("debug")) {
43
+ ctx.debugPerformance();
44
+ }
45
+ await next();
46
+ });
47
+ ```
48
+
49
+ Call `ctx.debugPerformance()` before `await next()`. The request then prints a
50
+ shared-axis waterfall and adds a `Server-Timing` header.
51
+
52
+ Read the timeline as intervals:
53
+
54
+ - `handler:total` is the whole router request.
55
+ - `render:total` / `ssr-render-html` show the render pass.
56
+ - `loader:*` rows should overlap render work. If a loader starts only after the
57
+ render bar, it is serialized latency.
58
+ - Cache, route matching, middleware pre/post, RSC serialization, and SSR phases
59
+ appear as separate spans, so the slow phase is visible without guessing.
60
+
61
+ ## Structured telemetry
62
+
63
+ Use telemetry when you want durable production events rather than a one-request
64
+ debug waterfall.
65
+
66
+ ```typescript
67
+ import { createRouter, createConsoleSink } from "@rangojs/router";
68
+
69
+ const router = createRouter({
70
+ document: Document,
71
+ urls: urlpatterns,
72
+ telemetry: createConsoleSink(),
73
+ });
74
+ ```
75
+
76
+ For OpenTelemetry:
77
+
78
+ ```typescript
79
+ import { createRouter, createOTelSink } from "@rangojs/router";
80
+ import { trace } from "@opentelemetry/api";
81
+
82
+ const router = createRouter({
83
+ document: Document,
84
+ urls: urlpatterns,
85
+ telemetry: createOTelSink(trace.getTracer("my-app")),
86
+ });
87
+ ```
88
+
89
+ Custom sinks implement `emit(event)`:
90
+
91
+ ```typescript
92
+ import { createRouter } from "@rangojs/router";
93
+
94
+ const router = createRouter({
95
+ document: Document,
96
+ urls: urlpatterns,
97
+ telemetry: {
98
+ emit(event) {
99
+ myMetrics.record(event);
100
+ },
101
+ },
102
+ });
103
+ ```
104
+
105
+ Events include `request.start/end/error`, `loader.start/end/error`,
106
+ `handler.error`, `cache.decision`, and `revalidation.decision`.
107
+
108
+ ## Debugging revalidation and stale data
109
+
110
+ When stale UI or unexpected partial renders are the question, use all three
111
+ layers together:
112
+
113
+ ```typescript
114
+ import { createConsoleSink, createRouter } from "@rangojs/router";
115
+
116
+ const router = createRouter({
117
+ document: Document,
118
+ urls: urlpatterns,
119
+ debugPerformance: true,
120
+ telemetry: createConsoleSink(),
121
+ });
122
+ ```
123
+
124
+ Then inspect:
125
+
126
+ - `revalidation.decision` telemetry to see which segment re-ran or skipped.
127
+ - cache spans / `cache.decision` events to see hit, miss, stale, and background
128
+ revalidation behavior.
129
+ - loader spans to confirm live loaders overlap the render rather than blocking
130
+ first paint.
131
+ - the `Server-Timing` header to compare local logs with browser-network timing.
132
+
133
+ ## Zero-overhead defaults
134
+
135
+ `debugPerformance` is off by default, and `telemetry` emits nothing unless a sink
136
+ is configured. Per-request `ctx.debugPerformance()` lets you turn on the
137
+ waterfall only for the route, user, or query param you are investigating.
@@ -8,9 +8,6 @@ argument-hint: [@slot-name]
8
8
 
9
9
  Parallel routes render multiple components simultaneously in named slots.
10
10
 
11
- Canonical semantics reference:
12
- [docs/execution-model.md](../../docs/internal/execution-model.md)
13
-
14
11
  ## Basic Parallel Routes
15
12
 
16
13
  ```typescript
@@ -206,6 +203,67 @@ parallel(
206
203
  )
207
204
  ```
208
205
 
206
+ ## Composable Slots via `handler.use`
207
+
208
+ Slot handlers can carry their own loader, loading, error/notFound boundaries, revalidation, and transition defaults via `.use`. The mount site then declares **just the slot names** — no per-call data wiring.
209
+
210
+ ```typescript
211
+ const CartSummary: Handler = async (ctx) => {
212
+ const cart = await ctx.use(CartLoader);
213
+ return <CartSummaryView cart={cart} />;
214
+ };
215
+ CartSummary.use = () => [
216
+ loader(CartLoader),
217
+ loading(<CartSkeleton />),
218
+ revalidate(revalidateCartData),
219
+ ];
220
+
221
+ // Same slot, no copy-pasted plumbing across layouts.
222
+ layout(<DashboardLayout />, () => [
223
+ parallel({ "@cart": CartSummary }),
224
+ path("/dashboard", DashboardIndex, { name: "dashboard.index" }),
225
+ ]);
226
+
227
+ layout(<AccountLayout />, () => [
228
+ parallel({ "@cart": CartSummary }),
229
+ path("/account", AccountIndex, { name: "account.index" }),
230
+ ]);
231
+ ```
232
+
233
+ A slot's `loading()` (whether from `handler.use` or explicit) makes that slot an independent streaming unit, exactly as in the **Streaming Behavior** section above.
234
+
235
+ The `parallel` mount site has the narrowest allow-list for `handler.use` items — slots cannot bring their own middleware or layout, only `revalidate`, `loader`, `loading`, `errorBoundary`, `notFoundBoundary`, and `transition`. See [skills/handler-use](../handler-use/SKILL.md) for the full table and merge rules.
236
+
237
+ `transition` is allowed in the slot allow-list, but slot-level rendering does **not** currently apply a `<ViewTransition>` wrapper — only the layout/route wraps take effect at render time. For a modal-only morph today, use an element-level React `<ViewTransition>` inside the slot's component. The reverse direction is the useful guarantee: a layout-level `transition()` fires when the layout's default outlet content changes but **not** when a `<ParallelOutlet />` mounts new content (modal opens are not subtree updates of the layout VT). See [skills/view-transitions](../view-transitions/SKILL.md) for the wrap rules and the intercept caveat.
238
+
239
+ ### Two scopes for explicit `use`: shared (broadcast) and slot-local
240
+
241
+ `parallel({...slots}, () => [...use])` runs the shared `use()` callback **once per slot** ([dsl-helpers.ts](../../src/route-definition/dsl-helpers.ts)) — items in that callback land on every slot's entry. That's the right behavior for the items the parallel allow-list permits and that accumulate (`loader`, `revalidate`, `errorBoundary`, `notFoundBoundary`, `transition`). (Slots cannot bring `middleware` or `layout` — see the allowed-types note above.)
242
+
243
+ For single-assignment items like `loading()`, broadcasting overwrites every slot's `handler.use` default. Pass a **slot descriptor** `{ handler, use }` instead — items in the descriptor's `use` apply only to that slot:
244
+
245
+ ```typescript
246
+ // @cart gets a custom skeleton; @notifs keeps its handler.use default.
247
+ parallel({
248
+ "@cart": {
249
+ handler: Cart,
250
+ use: () => [loading(<CustomCartSkeleton />)],
251
+ },
252
+ "@notifs": Notifs,
253
+ });
254
+
255
+ // Opt one slot out of streaming while siblings still stream the broadcast.
256
+ parallel(
257
+ {
258
+ "@cart": { handler: Cart, use: () => [loading(false)] },
259
+ "@notifs": Notifs,
260
+ },
261
+ () => [loading(<BroadcastSkeleton />)],
262
+ );
263
+ ```
264
+
265
+ Per-slot merge order is **handler.use → shared use → slot-local use**. Slot-local is the narrowest scope, so it wins for last-write-wins items. See [skills/handler-use § `loading()` is a single-assignment item — scope it correctly](../handler-use/SKILL.md#loading-is-a-single-assignment-item--scope-it-correctly) for the full reasoning.
266
+
209
267
  ## Slot Override Semantics
210
268
 
211
269
  When multiple `parallel()` calls define the same slot name, **the last
@@ -279,7 +337,7 @@ parallel(
279
337
  () => [
280
338
  loader(CartLoader),
281
339
  // Revalidate when cart actions occur
282
- revalidate(({ actionId }) => actionId?.includes("Cart") ?? false),
340
+ revalidate(({ actionId }) => actionId?.includes("Cart") || undefined),
283
341
  ]
284
342
  )
285
343
  ```
@@ -288,6 +346,13 @@ Revalidating only the parallel does not re-run outer handlers/layouts.
288
346
  If the slot reads `ctx.get()` data established above it, opt the outer
289
347
  segment into revalidation as well.
290
348
 
349
+ A `revalidate()` callback may return a hard `boolean`, a soft
350
+ `{ defaultShouldRevalidate }` object, or nothing (`void` / `null` /
351
+ `undefined`) to defer to the next revalidator. See
352
+ [loader/SKILL.md#revalidate-return-shapes](../loader/SKILL.md#revalidate-return-shapes)
353
+ for the full contract — it's the same across `loader()`, `path()`,
354
+ `layout()`, `parallel()`, and `intercept()`.
355
+
291
356
  ### Revalidation Contracts for Parallel Dependencies
292
357
 
293
358
  Prefer named revalidation contracts shared by both the upstream producer and
@@ -296,7 +361,7 @@ the parallel consumer:
296
361
  ```typescript
297
362
  // revalidation-contracts.ts
298
363
  export const revalidateCartData = ({ actionId }) =>
299
- actionId?.includes("src/actions/cart.ts#") ?? false;
364
+ actionId?.includes("src/actions/cart.ts#") || undefined;
300
365
 
301
366
  layout(CartLayout, () => [
302
367
  revalidate(revalidateCartData), // producer reruns
@@ -414,7 +479,7 @@ export const shopPatterns = urls(({
414
479
  () => [
415
480
  loader(CartLoader),
416
481
  loading(<CartSkeleton />),
417
- revalidate(({ actionId }) => actionId?.includes("Cart") ?? false),
482
+ revalidate(({ actionId }) => actionId?.includes("Cart") || undefined),
418
483
  ]
419
484
  ),
420
485
 
@@ -11,9 +11,6 @@ deserialization path, same segment system. The worker handles every request --
11
11
  there are NO static .html or .rsc files served from assets. The worker reads
12
12
  pre-computed Flight payloads instead of executing handler code.
13
13
 
14
- Canonical semantics reference:
15
- [docs/execution-model.md](../../docs/internal/execution-model.md)
16
-
17
14
  ## API: Prerender
18
15
 
19
16
  ### Static Route (no params)
@@ -361,16 +358,16 @@ Both error types propagate to the router's `onError` callback with phase
361
358
  The build produces per-URL timing logs:
362
359
 
363
360
  ```
364
- [rsc-router] Pre-rendering 12 URL(s) (concurrency: 4)...
365
- [rsc-router] OK /articles/hello (42ms)
366
- [rsc-router] PASS /articles/remote-only (5ms) - live fallback
367
- [rsc-router] SKIP /articles/draft-post (3ms) - Article is a draft
368
- [rsc-router] Pre-render complete: 11 done, 1 skipped (1204ms total)
369
-
370
- [rsc-router] Rendering 3 static handler(s)...
371
- [rsc-router] OK DocsLayout (28ms)
372
- [rsc-router] SKIP TocSidebar (1ms) - Not ready
373
- [rsc-router] Static render complete: 2 done, 1 skipped (120ms total)
361
+ [rango] Pre-rendering 12 URL(s) (concurrency: 4)...
362
+ [rango] OK /articles/hello (42ms)
363
+ [rango] PASS /articles/remote-only (5ms) - live fallback
364
+ [rango] SKIP /articles/draft-post (3ms) - Article is a draft
365
+ [rango] Pre-render complete: 11 done, 1 skipped (1204ms total)
366
+
367
+ [rango] Rendering 3 static handler(s)...
368
+ [rango] OK DocsLayout (28ms)
369
+ [rango] SKIP TocSidebar (1ms) - Not ready
370
+ [rango] Static render complete: 2 done, 1 skipped (120ms total)
374
371
  ```
375
372
 
376
373
  A `FAIL` line is logged per-URL when a handler throws a non-Skip error. The
@@ -466,9 +463,9 @@ export const Product = Passthrough(ProductDef, async (ctx) => {
466
463
  Passthrough entries are logged distinctly:
467
464
 
468
465
  ```
469
- [rsc-router] OK /blog/a (42ms)
470
- [rsc-router] PASS /blog/b (3ms) - live fallback
471
- [rsc-router] OK /blog/c (38ms)
466
+ [rango] OK /blog/a (42ms)
467
+ [rango] PASS /blog/b (3ms) - live fallback
468
+ [rango] OK /blog/c (38ms)
472
469
  ```
473
470
 
474
471
  ## Edge Cases and Constraints
@@ -640,16 +637,7 @@ At runtime, the cache-lookup middleware uses these flags:
640
637
 
641
638
  ## Contributor Checklist
642
639
 
643
- Before changing prerender behavior, read these docs and run these tests.
644
-
645
- ### Docs to re-read
646
-
647
- - [Prerender API design](../../docs/prerender-api-design.md) -- canonical
648
- architecture: build-time flow, runtime flow, storage, Passthrough, intercept
649
- - [Execution model](../../docs/internal/execution-model.md) -- handler-first
650
- ordering, middleware scope, context visibility rules
651
- - [Semantic change checklist](../../docs/internal/semantic-change-checklist.md)
652
- -- gate for any change to execution semantics
640
+ Before changing prerender behavior, run these tests.
653
641
 
654
642
  ### Tests to run
655
643
 
@@ -676,10 +664,3 @@ pnpm --filter @rangojs/router exec playwright test handler-first
676
664
  dev/build-only and do not need a production counterpart.
677
665
  - Behavioral assertions (rendered content, loader freshness, Passthrough
678
666
  fallback, intercept variant selection) must work in the production build.
679
-
680
- ## Maintenance References
681
-
682
- - [Stability next steps plan](../../docs/internal/stability-next-steps-plan.md)
683
- -- completed parity and cleanup pass (reference for decisions made)
684
- - [Test quality baseline](../../docs/internal/test-quality-baseline.md) --
685
- measured test inventory, sleep debt, production coverage gaps
@@ -8,30 +8,242 @@ argument-hint:
8
8
 
9
9
  Django-inspired RSC router with composable URL patterns, type-safe href, and server components.
10
10
 
11
+ This page is the mental model to read **before** the catalog. A flat list of
12
+ skills gives nothing to slot details into, so a reader free-associates from local
13
+ vocabulary — which is exactly how `revalidate()` gets misread as caching. Start
14
+ with the shape, then pick a primitive.
15
+
16
+ ## The shape of rango (read first)
17
+
18
+ - **Routes are expressed, not configured.** The `urls()` tree shows where every
19
+ route, layout, loader, and cache lives. No file-system convention, no hunting.
20
+ - **Two freshness axes, orthogonal:**
21
+ - _stored-value freshness_ — `"use cache"`, `cache()`, loader `cache()`
22
+ (SWR is first-class where the store supports it; `"use cache"` ships a
23
+ default SWR window; see `/cache-guide`)
24
+ - _client-update selection_ — `revalidate()`
25
+ - **Loaders are the live data layer** — fresh every request by default, even
26
+ inside a cached render. They run **in parallel** right after middleware and
27
+ **stream**, so data latency overlaps first paint instead of blocking it (a
28
+ cache hit streams UI instantly while loaders resolve fresh alongside). Opt into
29
+ caching explicitly. See `/loader` → "Parallel and streaming".
30
+ - **One identity, one store** — loaders, handles, cached fns, and actions are all
31
+ `path#export`; all caches share one store. Entries expire by TTL/SWR; cache
32
+ entries accept an optional `tags` field, but built-in stores do not yet index
33
+ or invalidate by tag, so tag-based invalidation (`revalidateTag`) is a
34
+ forward-looking API requiring a custom store.
35
+ - **Type-safe end to end** — route names, params, search schemas, loader return
36
+ types, context vars, and `href` / `reverse` are checked at compile time
37
+ (`/typesafety`).
38
+ - **See where time goes** — turn on `debugPerformance` early (router option, or
39
+ `ctx.debugPerformance()` in middleware for per-request opt-in). It prints a
40
+ per-request waterfall + `Server-Timing` header; loaders should overlap the
41
+ render bar, not serialize after it. For production, wire `telemetry` to a
42
+ console, OpenTelemetry, or custom sink. See `/observability`.
43
+
44
+ Most features are **just-in-time**: the core is `urls()`, `path()`, `layout()`,
45
+ `include()`, and `reverse()`. Caching, parallel routes, intercepts, prerender,
46
+ i18n, themes, and the rest are opt-in — reach for them when a requirement
47
+ appears, not up front.
48
+
49
+ ## Composability: structure vs config
50
+
51
+ - `path()` / `include()` are **structure** — they define URLs and must stay
52
+ visible in `urls()`. They cannot be hidden in a factory. `include()` composes
53
+ whole modules (separation of real concerns); `path()` places a leaf.
54
+ - Everything else — `cache`, `loader`, `loading`, `middleware`, `revalidate`,
55
+ `parallel`, `intercept`, `errorBoundary`, … — is **config**. It attaches to a
56
+ node via its `use` callback, is importable, and extracts into factories that
57
+ return arrays (`withAuth()`, `withCaching()`), flattened automatically.
58
+
59
+ To decide where something can live: **does it define a URL? structure, stays in
60
+ `urls()`. Does it modify a node? config, compose freely.**
61
+
62
+ ## Pick a primitive
63
+
64
+ | I need to… | Use | Skill |
65
+ | ------------------------------------- | -------------------------------- | ----------------------- |
66
+ | render data fresh every request | `loader()` + `useLoader()` | /loader |
67
+ | cache a rendered subtree | `cache()` on a segment | /caching |
68
+ | cache one function/component's result | `"use cache"` | /use-cache |
69
+ | cache a loader's data | `loader(L, () => [cache()])` | /loader, /caching |
70
+ | re-render a segment after an action | `revalidate()` | /loader |
71
+ | mutate | `"use server"` action | /server-actions |
72
+ | debug a slow request | `debugPerformance` / telemetry | /observability |
73
+ | share config across routes | factory returning a helper array | /composability |
74
+ | compose a sub-app / module | `include()` | /route |
75
+ | modal / soft navigation | `intercept()` | /intercept |
76
+ | pre-render a route at build time | `Prerender(...)` wrapper | /prerender |
77
+ | stream SSE / upgrade a WebSocket | `path.stream()` / `path.any()` | /streams-and-websockets |
78
+
79
+ ## Invariants
80
+
81
+ - `path()`/`include()` are always visible in `urls()`; config helpers are extractable.
82
+ - **Cache decides freshness; `revalidate()` decides client-update.** Orthogonal; compose.
83
+ - Loaders resolve fresh every request (even inside `cache()`) and never run twice/request.
84
+ - Inside `"use cache"`: `cookies()`/`headers()` and `ctx` side-effects
85
+ (`set`/`header`/`setTheme`/`onResponse`/`setLocationState`) throw; `ctx.use(Handle)`
86
+ is captured on miss and replayed on hit. (The non-cacheable read guard is a
87
+ separate `cache()`-boundary check — see the correctness bullet below.)
88
+ - One identity `path#export` (`functionId`/`$$id`/`actionId`); one store. The
89
+ cross-cutting freshness mechanism today is TTL/SWR expiry; cache entries accept
90
+ an optional `tags` field, but built-in stores do not yet index or invalidate by
91
+ tag, so `revalidateTag` is forward-looking (requires a custom store).
92
+ - `useLoader` / `useHandle` / `useFetchLoader` are client-only.
93
+ - Caches are correctness-first: persistent store keys are version-segmented (no
94
+ cross-deploy drift), the forward/back cache is mutation-aware, and
95
+ `createVar({ cache: false })` throws on a **direct** read inside a `cache()`
96
+ boundary (a deliberately non-propagating guard). See `/cache-guide` →
97
+ "Correctness & invalidation".
98
+ - Nested caches: the outer cache window bounds the inner — an inner shorter TTL
99
+ only applies when the enclosing cache recomputes; put a value in a loader if it
100
+ must be fresher. See `/cache-guide` → "Combining Both".
101
+
102
+ ## Don't confuse
103
+
104
+ - `revalidate()` ≠ cache invalidation — partial-render selection vs value freshness.
105
+ - host router `.lazy()` (lazy import of a handler/sub-app) vs `.map()` (inline Response).
106
+ - `cache()` (segment, in the DSL) vs `"use cache"` (function/component directive).
107
+ - `loader()` registration (server) vs `useLoader()` consumption (client).
108
+
109
+ ### Coming from another framework (false friends)
110
+
111
+ Same words, different jobs — this is the most common source of the
112
+ `revalidate()`-is-caching misread.
113
+
114
+ | You may know | Maps to Rango axis | Watch out |
115
+ | ------------------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
116
+ | Next.js `export const revalidate = N` | **Axis 1** (cache) | Same word, opposite meaning. Next's `revalidate` is time-based cache expiry; Rango's `revalidate()` is **axis 2**. Use `cache({ ttl })` for the Next behavior. |
117
+ | Next.js `revalidatePath` / `revalidateTag` | **Axis 1** (cache) | Cache busting. No shipped equivalent: entries accept `tags`, but built-in stores don't yet index/invalidate by tag, so `revalidateTag` is forward-looking (custom store); today entries expire by TTL/SWR. No `revalidatePath`. |
118
+ | React Router / Remix `shouldRevalidate` | **Axis 2** | This is the correct mental model for Rango's `revalidate()`. |
119
+ | HTTP `Cache-Control` / ISR | **Axis 1** | Edge/document layer — see `/document-cache`. Separate from both `cache()` and `revalidate()`. |
120
+ | Remix/RR `loader` | live data | Like Rango loaders, fresh per request — but Rango loaders run in parallel and stream (latency overlaps first paint), and can opt into caching on demand. |
121
+
122
+ See `/cache-guide` for the axis-1 decision guide, `/loader` and `/route` for
123
+ `revalidate()` (axis 2), and `/document-cache` for the edge layer.
124
+
125
+ ## Canonical shape
126
+
127
+ ```ts
128
+ export const urlpatterns = urls(({ path, layout, loader, loading, cache, revalidate }) => [
129
+ layout(<ShopLayout />, () => [ // structure: wraps children
130
+ loader(CartLoader, () => [ // config: live data
131
+ // partial-render axis: re-run on cart actions, defer otherwise.
132
+ // ctx.isAction() matches by reference (rename-safe), not by string.
133
+ revalidate((ctx) => ctx.isAction(CartActions) || undefined),
134
+ ]),
135
+ path("/shop/:slug", ProductPage, { name: "product" }, () => [ // structure: leaf
136
+ loader(ProductLoader, () => [cache({ ttl: 60 })]), // config: cache loader DATA
137
+ loading(<ProductSkeleton />), // config
138
+ withRecs(), // composed factory (config array)
139
+ ]),
140
+ ]),
141
+ ]);
142
+ ```
143
+
144
+ One tree, both axes visible: structure (`layout`/`path`) vs config (everything
145
+ else), freshness (`cache`) vs client-update (`revalidate`). Actions are matched
146
+ by reference with `ctx.isAction(Action)` (rename-safe, where `CartActions` is an
147
+ `import * as CartActions from "./actions/cart"`); see `/typesafety` → "Stable
148
+ identity".
149
+
150
+ The predicate arg carries the action's full context, not just its identity. Match
151
+ _which_ action with `ctx.isAction(addToCart)` (rename-safe); branch on _what it
152
+ returned_ with `ctx.actionResult` — the value your `"use server"` function
153
+ returned, for outcome-conditional revalidation. The arg also exposes `actionId`
154
+ (raw `path#export`), `actionUrl`, `formData`, `method`, and `stale` (cross-tab
155
+ `_rsc_stale` signal). All are `undefined` on plain navigation (no action).
156
+
157
+ ```ts
158
+ // re-render only when checkout actually succeeded; defer otherwise
159
+ revalidate((ctx) => (ctx.isAction(checkout) && ctx.actionResult?.ok) || undefined),
160
+ ```
161
+
162
+ **The source is the source of truth.** Structure, types, and update policy are
163
+ visible and local in the tree — read top-down, no hidden global model to hold in
164
+ your head. A snippet earns its place only if, from the code alone, you can answer:
165
+ _what URLs exist and who owns them?_ (composition), _can I trust this reference
166
+ without leaving the call site?_ (type-safety), _what re-renders after this
167
+ action?_ (partial rendering). If any answer needs another file, it isn't legible
168
+ yet.
169
+
170
+ **Reading Rango's own source.** Rango is consumed as raw TypeScript — the
171
+ `exports` map resolves `@rangojs/router` and its subpaths to `./src/*.ts` for
172
+ both types and runtime, so a consuming app bundles Rango straight from source.
173
+ Only the `./vite` plugin entry and the CLI `bin` load from `dist/`. To confirm
174
+ any runtime or type detail against an installed copy, read the resolved source
175
+ under `node_modules/@rangojs/router/src/`, not `dist/` — the runtime does not
176
+ resolve `dist/` outside `./vite`, and it may lag `src/`.
177
+
11
178
  ## Skills
12
179
 
13
- | Skill | Description |
14
- | ------------------ | -------------------------------------------------------------------------- |
15
- | `/router-setup` | Create and configure the RSC router |
16
- | `/route` | Define routes with `urls()` and `path()` |
17
- | `/layout` | Layouts that wrap child routes |
18
- | `/loader` | Data loaders with `createLoader()` |
19
- | `/middleware` | Request processing and authentication |
20
- | `/intercept` | Modal/slide-over patterns for soft navigation |
21
- | `/parallel` | Multi-column layouts and sidebars |
22
- | `/caching` | Segment caching with memory or KV stores |
23
- | `/use-cache` | Function-level caching with `"use cache"` directive |
24
- | `/cache-guide` | When to use `cache()` vs `"use cache"` — differences and decision guide |
25
- | `/document-cache` | Edge caching with Cache-Control headers |
26
- | `/theme` | Light/dark mode with FOUC prevention |
27
- | `/links` | URL generation: ctx.reverse, href, useHref, useMount, scopedReverse |
28
- | `/hooks` | Client-side React hooks |
29
- | `/typesafety` | Type-safe routes, params, href, and environment |
30
- | `/host-router` | Multi-app host routing with domain/subdomain patterns |
31
- | `/tailwind` | Set up Tailwind CSS v4 with `?url` imports |
32
- | `/response-routes` | JSON/text/HTML/XML/stream endpoints with `path.json()`, `path.text()` |
33
- | `/mime-routes` | Content negotiation — same URL, different response types via Accept header |
34
- | `/fonts` | Load web fonts with preload hints |
180
+ Grouped by concern — read when you need to…
181
+
182
+ **Structure & routing** shape URLs, layouts, navigation, and request processing:
183
+
184
+ | Skill | Description |
185
+ | ------------------------- | -------------------------------------------------------------------------- |
186
+ | `/router-setup` | Create and configure the RSC router |
187
+ | `/route` | Define routes with `urls()`, `path()`, and `include()` |
188
+ | `/layout` | Layouts that wrap child routes |
189
+ | `/parallel` | Multi-column layouts and sidebars |
190
+ | `/intercept` | Modal/slide-over patterns for soft navigation |
191
+ | `/middleware` | Request processing and authentication |
192
+ | `/host-router` | Multi-app host routing with domain/subdomain patterns |
193
+ | `/links` | URL generation: ctx.reverse, href, useHref, useMount, scopedReverse |
194
+ | `/response-routes` | JSON/text/HTML/XML/stream endpoints with `path.json()`, `path.text()` |
195
+ | `/api-client` | Typed client for consuming your own response-route JSON APIs (recipe) |
196
+ | `/mime-routes` | Content negotiation same URL, different response types via Accept header |
197
+ | `/streams-and-websockets` | SSE via `path.stream` and WebSocket upgrades via `path.any` |
198
+ | `/handler-use` | Attach default loaders/middleware to a handler via `handler.use` |
199
+ | `/composability` | Reusable route-helper factories (structure vs config) |
200
+
201
+ **Data & caching** fetch, mutate, and cache:
202
+
203
+ | Skill | Description |
204
+ | ----------------- | ----------------------------------------------------------------------- |
205
+ | `/loader` | Data loaders with `createLoader()` and `revalidate()` |
206
+ | `/server-actions` | Mutations with `"use server"`, useActionState, validation, revalidation |
207
+ | `/caching` | Segment caching with memory or KV stores |
208
+ | `/use-cache` | Function-level caching with `"use cache"` directive |
209
+ | `/cache-guide` | When to use `cache()` vs `"use cache"` — differences and decision guide |
210
+ | `/document-cache` | Edge caching with Cache-Control headers |
211
+ | `/prerender` | Pre-render route segments at build time (Passthrough live fallback) |
212
+
213
+ **Client & presentation** — build the client-side UX:
214
+
215
+ | Skill | Description |
216
+ | ------------------- | ------------------------------------------------------------------------- |
217
+ | `/hooks` | Client-side React hooks |
218
+ | `/theme` | Light/dark mode with FOUC prevention |
219
+ | `/i18n` | Locale routing with `:locale?`, resolution chains, react-intl integration |
220
+ | `/fonts` | Load web fonts with preload hints |
221
+ | `/tailwind` | Set up Tailwind CSS v4 with `?url` imports |
222
+ | `/view-transitions` | React View Transitions on layouts, routes, and parallel slots |
223
+ | `/breadcrumbs` | Built-in Breadcrumbs handle for breadcrumb navigation |
224
+ | `/react-compiler` | Enable React Compiler (opt-in) the vite-rsc way; client-only scope |
225
+
226
+ **Observability & production health**:
227
+
228
+ | Skill | Description |
229
+ | ------------------ | ------------------------------------------------------------------------ |
230
+ | `/observability` | `debugPerformance`, `Server-Timing`, structured telemetry, tracing |
231
+ | `/bundle-analysis` | Audit your app's production bundle for server leaks and oversized chunks |
232
+ | `/debug-manifest` | Inspect route manifest structure |
233
+
234
+ **Testing**:
235
+
236
+ | Skill | Description |
237
+ | ---------- | ------------------------------------------------------------------------------------------------------------------------------- |
238
+ | `/testing` | Unit (loaders/middleware/reverse/components), integration (dispatch/Flight), and e2e (dev+prod parity, progressive enhancement) |
239
+
240
+ **Setup, types & migration**:
241
+
242
+ | Skill | Description |
243
+ | ----------------------- | ----------------------------------------------- |
244
+ | `/typesafety` | Type-safe routes, params, href, and environment |
245
+ | `/migrate-nextjs` | Migrate a Next.js App Router project to Rango |
246
+ | `/migrate-react-router` | Migrate a React Router / Remix project to Rango |
35
247
 
36
248
  ## Quick Start
37
249
 
@@ -87,6 +299,15 @@ Each file is classified by its contents:
87
299
  Directories are scanned recursively for `.ts`/`.tsx` files, skipping `node_modules`,
88
300
  dotfiles, and existing `.gen.` files.
89
301
 
302
+ > The two generated files are **not interchangeable surfaces**.
303
+ > `router.named-routes.gen.ts` augments the global `GeneratedRouteMap` for
304
+ > named-route typing (`Handler<"name">`, `ctx.reverse("name")`, prerender).
305
+ > Per-module `*.gen.ts` exports a local `routes` map for `useReverse(routes)`
306
+ > and explicit local handler typing (`Handler<".name", routes>`). Neither
307
+ > carries response payloads — response/MIME payload inference comes from
308
+ > `typeof router.routeMap` via `RegisteredRoutes`, not `*.named-routes.gen.ts`.
309
+ > See `/typesafety` for the full surface breakdown.
310
+
90
311
  ### Recursive includes
91
312
 
92
313
  The generator follows `include()` calls across files, resolving imports to build