@rangojs/router 0.4.0 → 0.4.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 (482) hide show
  1. package/README.md +19 -1
  2. package/dist/types/browser/event-controller.d.ts +4 -0
  3. package/dist/types/browser/link-interceptor.d.ts +17 -7
  4. package/dist/types/browser/navigation-bridge.d.ts +13 -1
  5. package/dist/types/browser/notify-listeners.d.ts +2 -0
  6. package/dist/types/browser/prefetch/cache.d.ts +1 -1
  7. package/dist/types/browser/prefetch/default-strategy.d.ts +12 -3
  8. package/dist/types/browser/prefetch/invalidation.d.ts +6 -0
  9. package/dist/types/browser/prefetch/loader.d.ts +3 -1
  10. package/dist/types/browser/prefetch/observer.d.ts +3 -6
  11. package/dist/types/browser/rango-state.d.ts +4 -0
  12. package/dist/types/browser/react/Link.d.ts +4 -9
  13. package/dist/types/browser/react/context.d.ts +3 -0
  14. package/dist/types/browser/rsc-router.d.ts +7 -2
  15. package/dist/types/browser/types.d.ts +1 -0
  16. package/dist/types/cache/cache-key-utils.d.ts +11 -3
  17. package/dist/types/cache/cache-scope.d.ts +82 -3
  18. package/dist/types/cache/cf/cf-cache-store.d.ts +2 -2
  19. package/dist/types/cache/index.d.ts +3 -1
  20. package/dist/types/cache/search-params-filter.d.ts +64 -0
  21. package/dist/types/cache/shell-snapshot.d.ts +4 -4
  22. package/dist/types/cache/types.d.ts +30 -2
  23. package/dist/types/cache/vercel/vercel-cache-store.d.ts +2 -2
  24. package/dist/types/index.d.ts +1 -0
  25. package/dist/types/index.rsc.d.ts +1 -0
  26. package/dist/types/router/match-middleware/cache-lookup.d.ts +13 -0
  27. package/dist/types/router/navigation-snapshot.d.ts +29 -0
  28. package/dist/types/router/router-options.d.ts +27 -3
  29. package/dist/types/rsc/shell-build-manifest.d.ts +7 -1
  30. package/dist/types/rsc/shell-serve.d.ts +7 -1
  31. package/dist/types/rsc/types.d.ts +17 -0
  32. package/dist/types/server/request-context.d.ts +57 -4
  33. package/dist/types/testing/render-route.d.ts +10 -1
  34. package/dist/types/testing/shell-status.d.ts +6 -3
  35. package/dist/types/vite/plugin-types.d.ts +1 -1
  36. package/dist/vite/index.js +5 -5
  37. package/package.json +23 -22
  38. package/skills/caching/SKILL.md +39 -0
  39. package/skills/comparison/references/framework-comparison.md +7 -1
  40. package/skills/links/SKILL.md +24 -0
  41. package/skills/ppr/SKILL.md +53 -4
  42. package/skills/router-setup/SKILL.md +7 -2
  43. package/skills/testing/client-components.md +15 -14
  44. package/skills/vercel/SKILL.md +1 -1
  45. package/src/browser/event-controller.ts +110 -11
  46. package/src/browser/link-interceptor.ts +469 -20
  47. package/src/browser/navigation-bridge.ts +71 -2
  48. package/src/browser/navigation-store.ts +24 -1
  49. package/src/browser/notify-listeners.ts +22 -0
  50. package/src/browser/prefetch/cache.ts +4 -2
  51. package/src/browser/prefetch/default-strategy.ts +43 -3
  52. package/src/browser/prefetch/invalidation.ts +30 -0
  53. package/src/browser/prefetch/loader.ts +19 -12
  54. package/src/browser/prefetch/observer.ts +50 -22
  55. package/src/browser/rango-state.ts +21 -0
  56. package/src/browser/react/Link.tsx +97 -88
  57. package/src/browser/react/NavigationProvider.tsx +1 -0
  58. package/src/browser/react/context.ts +4 -0
  59. package/src/browser/rsc-router.tsx +22 -9
  60. package/src/browser/types.ts +1 -0
  61. package/src/cache/cache-key-utils.ts +18 -4
  62. package/src/cache/cache-runtime.ts +7 -2
  63. package/src/cache/cache-scope.ts +152 -23
  64. package/src/cache/cf/cf-cache-store.ts +51 -16
  65. package/src/cache/document-cache.ts +7 -1
  66. package/src/cache/index.ts +7 -0
  67. package/src/cache/search-params-filter.ts +118 -0
  68. package/src/cache/shell-snapshot.ts +8 -4
  69. package/src/cache/types.ts +33 -2
  70. package/src/cache/vercel/vercel-cache-store.ts +17 -3
  71. package/src/index.rsc.ts +4 -0
  72. package/src/index.ts +6 -0
  73. package/src/router/match-middleware/cache-lookup.ts +146 -33
  74. package/src/router/match-middleware/cache-store.ts +70 -0
  75. package/src/router/navigation-snapshot.ts +46 -6
  76. package/src/router/router-options.ts +31 -4
  77. package/src/rsc/handler.ts +9 -0
  78. package/src/rsc/response-cache-serve.ts +1 -1
  79. package/src/rsc/rsc-rendering.ts +252 -27
  80. package/src/rsc/shell-build-manifest.ts +8 -1
  81. package/src/rsc/shell-capture.ts +5 -0
  82. package/src/rsc/shell-serve.ts +8 -2
  83. package/src/rsc/types.ts +17 -0
  84. package/src/server/request-context.ts +62 -3
  85. package/src/testing/dispatch.ts +21 -3
  86. package/src/testing/render-route.tsx +86 -17
  87. package/src/testing/shell-status.ts +20 -3
  88. package/src/vite/plugin-types.ts +1 -1
  89. package/src/vite/plugins/vercel-output.ts +2 -2
  90. package/dist/types.backup/__internal.d.ts +0 -127
  91. package/dist/types.backup/bin/rango.d.ts +0 -1
  92. package/dist/types.backup/browser/action-coordinator.d.ts +0 -57
  93. package/dist/types.backup/browser/action-fence.d.ts +0 -33
  94. package/dist/types.backup/browser/app-shell.d.ts +0 -34
  95. package/dist/types.backup/browser/app-version.d.ts +0 -6
  96. package/dist/types.backup/browser/connection-warmup.d.ts +0 -31
  97. package/dist/types.backup/browser/cookie-name.d.ts +0 -66
  98. package/dist/types.backup/browser/event-controller.d.ts +0 -221
  99. package/dist/types.backup/browser/history-state.d.ts +0 -26
  100. package/dist/types.backup/browser/index.d.ts +0 -1
  101. package/dist/types.backup/browser/intercept-utils.d.ts +0 -30
  102. package/dist/types.backup/browser/invalidate-client-cache.d.ts +0 -17
  103. package/dist/types.backup/browser/link-interceptor.d.ts +0 -43
  104. package/dist/types.backup/browser/logging.d.ts +0 -33
  105. package/dist/types.backup/browser/merge-segment-loaders.d.ts +0 -38
  106. package/dist/types.backup/browser/navigation-bridge.d.ts +0 -27
  107. package/dist/types.backup/browser/navigation-client.d.ts +0 -17
  108. package/dist/types.backup/browser/navigation-store-handle.d.ts +0 -25
  109. package/dist/types.backup/browser/navigation-store.d.ts +0 -95
  110. package/dist/types.backup/browser/navigation-transaction.d.ts +0 -75
  111. package/dist/types.backup/browser/network-error-handler.d.ts +0 -35
  112. package/dist/types.backup/browser/partial-update.d.ts +0 -61
  113. package/dist/types.backup/browser/prefetch/cache.d.ts +0 -183
  114. package/dist/types.backup/browser/prefetch/fetch.d.ts +0 -52
  115. package/dist/types.backup/browser/prefetch/observer.d.ts +0 -27
  116. package/dist/types.backup/browser/prefetch/policy.d.ts +0 -13
  117. package/dist/types.backup/browser/prefetch/queue.d.ts +0 -48
  118. package/dist/types.backup/browser/prefetch/resource-ready.d.ts +0 -28
  119. package/dist/types.backup/browser/rango-state.d.ts +0 -52
  120. package/dist/types.backup/browser/react/Link.d.ts +0 -140
  121. package/dist/types.backup/browser/react/NavigationProvider.d.ts +0 -88
  122. package/dist/types.backup/browser/react/ScrollRestoration.d.ts +0 -78
  123. package/dist/types.backup/browser/react/context.d.ts +0 -54
  124. package/dist/types.backup/browser/react/filter-segment-order.d.ts +0 -35
  125. package/dist/types.backup/browser/react/index.d.ts +0 -1
  126. package/dist/types.backup/browser/react/location-state-shared.d.ts +0 -162
  127. package/dist/types.backup/browser/react/location-state.d.ts +0 -29
  128. package/dist/types.backup/browser/react/mount-context.d.ts +0 -23
  129. package/dist/types.backup/browser/react/nonce-context.d.ts +0 -14
  130. package/dist/types.backup/browser/react/shallow-equal.d.ts +0 -5
  131. package/dist/types.backup/browser/react/use-action.d.ts +0 -61
  132. package/dist/types.backup/browser/react/use-handle.d.ts +0 -21
  133. package/dist/types.backup/browser/react/use-href.d.ts +0 -32
  134. package/dist/types.backup/browser/react/use-link-status.d.ts +0 -36
  135. package/dist/types.backup/browser/react/use-mount.d.ts +0 -24
  136. package/dist/types.backup/browser/react/use-navigation.d.ts +0 -15
  137. package/dist/types.backup/browser/react/use-params.d.ts +0 -21
  138. package/dist/types.backup/browser/react/use-pathname.d.ts +0 -13
  139. package/dist/types.backup/browser/react/use-reverse.d.ts +0 -40
  140. package/dist/types.backup/browser/react/use-router.d.ts +0 -23
  141. package/dist/types.backup/browser/react/use-search-params.d.ts +0 -19
  142. package/dist/types.backup/browser/react/use-segments.d.ts +0 -29
  143. package/dist/types.backup/browser/response-adapter.d.ts +0 -58
  144. package/dist/types.backup/browser/rsc-router.d.ts +0 -141
  145. package/dist/types.backup/browser/scroll-restoration.d.ts +0 -103
  146. package/dist/types.backup/browser/segment-reconciler.d.ts +0 -74
  147. package/dist/types.backup/browser/segment-structure-assert.d.ts +0 -16
  148. package/dist/types.backup/browser/server-action-bridge.d.ts +0 -29
  149. package/dist/types.backup/browser/types.d.ts +0 -530
  150. package/dist/types.backup/browser/validate-redirect-origin.d.ts +0 -28
  151. package/dist/types.backup/build/collect-fallback-refs.d.ts +0 -5
  152. package/dist/types.backup/build/generate-manifest.d.ts +0 -100
  153. package/dist/types.backup/build/generate-route-types.d.ts +0 -8
  154. package/dist/types.backup/build/index.d.ts +0 -21
  155. package/dist/types.backup/build/prefix-tree-utils.d.ts +0 -56
  156. package/dist/types.backup/build/route-trie.d.ts +0 -89
  157. package/dist/types.backup/build/route-types/ast-helpers.d.ts +0 -3
  158. package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +0 -13
  159. package/dist/types.backup/build/route-types/codegen.d.ts +0 -16
  160. package/dist/types.backup/build/route-types/include-resolution.d.ts +0 -74
  161. package/dist/types.backup/build/route-types/param-extraction.d.ts +0 -13
  162. package/dist/types.backup/build/route-types/per-module-writer.d.ts +0 -18
  163. package/dist/types.backup/build/route-types/router-processing.d.ts +0 -82
  164. package/dist/types.backup/build/route-types/scan-filter.d.ts +0 -17
  165. package/dist/types.backup/build/route-types/source-scan.d.ts +0 -13
  166. package/dist/types.backup/build/runtime-discovery.d.ts +0 -24
  167. package/dist/types.backup/cache/background-task.d.ts +0 -21
  168. package/dist/types.backup/cache/cache-error.d.ts +0 -71
  169. package/dist/types.backup/cache/cache-key-utils.d.ts +0 -35
  170. package/dist/types.backup/cache/cache-policy.d.ts +0 -59
  171. package/dist/types.backup/cache/cache-runtime.d.ts +0 -51
  172. package/dist/types.backup/cache/cache-scope.d.ts +0 -134
  173. package/dist/types.backup/cache/cache-tag.d.ts +0 -79
  174. package/dist/types.backup/cache/cf/cf-base64.d.ts +0 -4
  175. package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +0 -105
  176. package/dist/types.backup/cache/cf/cf-cache-store.d.ts +0 -481
  177. package/dist/types.backup/cache/cf/cf-cache-types.d.ts +0 -300
  178. package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +0 -22
  179. package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +0 -15
  180. package/dist/types.backup/cache/cf/index.d.ts +0 -3
  181. package/dist/types.backup/cache/document-cache.d.ts +0 -69
  182. package/dist/types.backup/cache/handle-capture.d.ts +0 -23
  183. package/dist/types.backup/cache/handle-snapshot.d.ts +0 -39
  184. package/dist/types.backup/cache/index.d.ts +0 -7
  185. package/dist/types.backup/cache/memory-segment-store.d.ts +0 -163
  186. package/dist/types.backup/cache/profile-registry.d.ts +0 -40
  187. package/dist/types.backup/cache/read-through-swr.d.ts +0 -60
  188. package/dist/types.backup/cache/segment-codec.d.ts +0 -78
  189. package/dist/types.backup/cache/shell-snapshot.d.ts +0 -162
  190. package/dist/types.backup/cache/tag-invalidation.d.ts +0 -74
  191. package/dist/types.backup/cache/taint.d.ts +0 -71
  192. package/dist/types.backup/cache/types.d.ts +0 -407
  193. package/dist/types.backup/cache/vercel/index.d.ts +0 -1
  194. package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +0 -267
  195. package/dist/types.backup/client.d.ts +0 -184
  196. package/dist/types.backup/client.rsc.d.ts +0 -39
  197. package/dist/types.backup/cloudflare/index.d.ts +0 -7
  198. package/dist/types.backup/cloudflare/tracing.d.ts +0 -53
  199. package/dist/types.backup/component-utils.d.ts +0 -46
  200. package/dist/types.backup/components/DefaultDocument.d.ts +0 -13
  201. package/dist/types.backup/context-var.d.ts +0 -84
  202. package/dist/types.backup/debug.d.ts +0 -57
  203. package/dist/types.backup/decode-loader-results.d.ts +0 -5
  204. package/dist/types.backup/default-error-boundary.d.ts +0 -10
  205. package/dist/types.backup/defer.d.ts +0 -89
  206. package/dist/types.backup/deps/browser.d.ts +0 -1
  207. package/dist/types.backup/deps/html-stream-client.d.ts +0 -1
  208. package/dist/types.backup/deps/html-stream-server.d.ts +0 -1
  209. package/dist/types.backup/deps/rsc.d.ts +0 -1
  210. package/dist/types.backup/deps/ssr.d.ts +0 -1
  211. package/dist/types.backup/encode-kv.d.ts +0 -35
  212. package/dist/types.backup/errors.d.ts +0 -226
  213. package/dist/types.backup/escape-script.d.ts +0 -44
  214. package/dist/types.backup/handle.d.ts +0 -93
  215. package/dist/types.backup/handles/MetaTags.d.ts +0 -17
  216. package/dist/types.backup/handles/Scripts.d.ts +0 -38
  217. package/dist/types.backup/handles/breadcrumbs.d.ts +0 -43
  218. package/dist/types.backup/handles/deferred-resolution.d.ts +0 -53
  219. package/dist/types.backup/handles/is-thenable.d.ts +0 -12
  220. package/dist/types.backup/handles/meta.d.ts +0 -43
  221. package/dist/types.backup/handles/script.d.ts +0 -139
  222. package/dist/types.backup/host/cookie-handler.d.ts +0 -8
  223. package/dist/types.backup/host/errors.d.ts +0 -40
  224. package/dist/types.backup/host/index.d.ts +0 -33
  225. package/dist/types.backup/host/pattern-matcher.d.ts +0 -30
  226. package/dist/types.backup/host/router.d.ts +0 -12
  227. package/dist/types.backup/host/testing.d.ts +0 -41
  228. package/dist/types.backup/host/types.d.ts +0 -148
  229. package/dist/types.backup/host/utils.d.ts +0 -20
  230. package/dist/types.backup/href-client.d.ts +0 -214
  231. package/dist/types.backup/index.d.ts +0 -112
  232. package/dist/types.backup/index.rsc.d.ts +0 -51
  233. package/dist/types.backup/internal-debug.d.ts +0 -1
  234. package/dist/types.backup/loader-store.d.ts +0 -193
  235. package/dist/types.backup/loader.d.ts +0 -18
  236. package/dist/types.backup/loader.rsc.d.ts +0 -18
  237. package/dist/types.backup/missing-id-error.d.ts +0 -1
  238. package/dist/types.backup/outlet-context.d.ts +0 -12
  239. package/dist/types.backup/outlet-provider.d.ts +0 -12
  240. package/dist/types.backup/prerender/build-shell-capture.d.ts +0 -104
  241. package/dist/types.backup/prerender/param-hash.d.ts +0 -6
  242. package/dist/types.backup/prerender/shell-manifest-key.d.ts +0 -18
  243. package/dist/types.backup/prerender/store.d.ts +0 -62
  244. package/dist/types.backup/prerender.d.ts +0 -292
  245. package/dist/types.backup/redirect-origin.d.ts +0 -55
  246. package/dist/types.backup/regex-escape.d.ts +0 -6
  247. package/dist/types.backup/render-error-thrower.d.ts +0 -13
  248. package/dist/types.backup/response-utils.d.ts +0 -35
  249. package/dist/types.backup/reverse.d.ts +0 -206
  250. package/dist/types.backup/root-error-boundary.d.ts +0 -32
  251. package/dist/types.backup/route-content-wrapper.d.ts +0 -40
  252. package/dist/types.backup/route-definition/dsl-helpers.d.ts +0 -130
  253. package/dist/types.backup/route-definition/helper-factories.d.ts +0 -22
  254. package/dist/types.backup/route-definition/helpers-types.d.ts +0 -392
  255. package/dist/types.backup/route-definition/index.d.ts +0 -7
  256. package/dist/types.backup/route-definition/redirect.d.ts +0 -48
  257. package/dist/types.backup/route-definition/resolve-handler-use.d.ts +0 -19
  258. package/dist/types.backup/route-definition/use-item-types.d.ts +0 -1
  259. package/dist/types.backup/route-definition.d.ts +0 -1
  260. package/dist/types.backup/route-map-builder.d.ts +0 -127
  261. package/dist/types.backup/route-name.d.ts +0 -27
  262. package/dist/types.backup/route-types.d.ts +0 -172
  263. package/dist/types.backup/router/basename.d.ts +0 -10
  264. package/dist/types.backup/router/content-negotiation.d.ts +0 -91
  265. package/dist/types.backup/router/debug-manifest.d.ts +0 -7
  266. package/dist/types.backup/router/error-handling.d.ts +0 -76
  267. package/dist/types.backup/router/find-match.d.ts +0 -19
  268. package/dist/types.backup/router/handler-context.d.ts +0 -41
  269. package/dist/types.backup/router/instrument.d.ts +0 -161
  270. package/dist/types.backup/router/intercept-resolution.d.ts +0 -79
  271. package/dist/types.backup/router/lazy-includes.d.ts +0 -26
  272. package/dist/types.backup/router/loader-resolution.d.ts +0 -63
  273. package/dist/types.backup/router/logging.d.ts +0 -41
  274. package/dist/types.backup/router/manifest.d.ts +0 -8
  275. package/dist/types.backup/router/match-api.d.ts +0 -19
  276. package/dist/types.backup/router/match-context.d.ts +0 -184
  277. package/dist/types.backup/router/match-handlers.d.ts +0 -49
  278. package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +0 -113
  279. package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +0 -113
  280. package/dist/types.backup/router/match-middleware/cache-store.d.ts +0 -112
  281. package/dist/types.backup/router/match-middleware/index.d.ts +0 -80
  282. package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +0 -116
  283. package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +0 -94
  284. package/dist/types.backup/router/match-pipelines.d.ts +0 -103
  285. package/dist/types.backup/router/match-result.d.ts +0 -114
  286. package/dist/types.backup/router/metrics.d.ts +0 -6
  287. package/dist/types.backup/router/middleware-types.d.ts +0 -74
  288. package/dist/types.backup/router/middleware.d.ts +0 -116
  289. package/dist/types.backup/router/navigation-snapshot.d.ts +0 -22
  290. package/dist/types.backup/router/params-util.d.ts +0 -8
  291. package/dist/types.backup/router/parse-pattern.d.ts +0 -38
  292. package/dist/types.backup/router/pattern-matching.d.ts +0 -169
  293. package/dist/types.backup/router/prefetch-cache-ttl.d.ts +0 -27
  294. package/dist/types.backup/router/prefetch-limits.d.ts +0 -20
  295. package/dist/types.backup/router/prerender-match.d.ts +0 -50
  296. package/dist/types.backup/router/preview-match.d.ts +0 -22
  297. package/dist/types.backup/router/request-classification.d.ts +0 -104
  298. package/dist/types.backup/router/revalidation.d.ts +0 -57
  299. package/dist/types.backup/router/route-snapshot.d.ts +0 -112
  300. package/dist/types.backup/router/router-context.d.ts +0 -137
  301. package/dist/types.backup/router/router-interfaces.d.ts +0 -432
  302. package/dist/types.backup/router/router-options.d.ts +0 -738
  303. package/dist/types.backup/router/router-registry.d.ts +0 -15
  304. package/dist/types.backup/router/segment-resolution/fresh.d.ts +0 -55
  305. package/dist/types.backup/router/segment-resolution/helpers.d.ts +0 -93
  306. package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +0 -33
  307. package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +0 -44
  308. package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +0 -90
  309. package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +0 -53
  310. package/dist/types.backup/router/segment-resolution/revalidation.d.ts +0 -85
  311. package/dist/types.backup/router/segment-resolution/static-store.d.ts +0 -17
  312. package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +0 -16
  313. package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +0 -28
  314. package/dist/types.backup/router/segment-resolution.d.ts +0 -3
  315. package/dist/types.backup/router/segment-wrappers.d.ts +0 -53
  316. package/dist/types.backup/router/state-cookie-name.d.ts +0 -1
  317. package/dist/types.backup/router/substitute-pattern-params.d.ts +0 -23
  318. package/dist/types.backup/router/telemetry-otel.d.ts +0 -113
  319. package/dist/types.backup/router/telemetry.d.ts +0 -215
  320. package/dist/types.backup/router/timeout.d.ts +0 -68
  321. package/dist/types.backup/router/tracing.d.ts +0 -125
  322. package/dist/types.backup/router/trie-matching.d.ts +0 -32
  323. package/dist/types.backup/router/types.d.ts +0 -98
  324. package/dist/types.backup/router/url-params.d.ts +0 -26
  325. package/dist/types.backup/router.d.ts +0 -7
  326. package/dist/types.backup/rsc/capture-queue.d.ts +0 -6
  327. package/dist/types.backup/rsc/full-payload.d.ts +0 -22
  328. package/dist/types.backup/rsc/handler-context.d.ts +0 -31
  329. package/dist/types.backup/rsc/handler.d.ts +0 -9
  330. package/dist/types.backup/rsc/helpers.d.ts +0 -213
  331. package/dist/types.backup/rsc/index.d.ts +0 -17
  332. package/dist/types.backup/rsc/json-route-result.d.ts +0 -20
  333. package/dist/types.backup/rsc/loader-fetch.d.ts +0 -14
  334. package/dist/types.backup/rsc/manifest-init.d.ts +0 -18
  335. package/dist/types.backup/rsc/nonce.d.ts +0 -28
  336. package/dist/types.backup/rsc/origin-guard.d.ts +0 -50
  337. package/dist/types.backup/rsc/progressive-enhancement.d.ts +0 -19
  338. package/dist/types.backup/rsc/redirect-guard.d.ts +0 -35
  339. package/dist/types.backup/rsc/response-cache-serve.d.ts +0 -46
  340. package/dist/types.backup/rsc/response-error.d.ts +0 -19
  341. package/dist/types.backup/rsc/response-route-handler.d.ts +0 -29
  342. package/dist/types.backup/rsc/rsc-rendering.d.ts +0 -23
  343. package/dist/types.backup/rsc/runtime-warnings.d.ts +0 -22
  344. package/dist/types.backup/rsc/server-action.d.ts +0 -68
  345. package/dist/types.backup/rsc/shell-build-manifest.d.ts +0 -84
  346. package/dist/types.backup/rsc/shell-capture-constants.d.ts +0 -27
  347. package/dist/types.backup/rsc/shell-capture.d.ts +0 -374
  348. package/dist/types.backup/rsc/shell-serve.d.ts +0 -136
  349. package/dist/types.backup/rsc/ssr-setup.d.ts +0 -48
  350. package/dist/types.backup/rsc/transition-gate.d.ts +0 -27
  351. package/dist/types.backup/rsc/types.d.ts +0 -290
  352. package/dist/types.backup/runtime-env.d.ts +0 -1
  353. package/dist/types.backup/search-params.d.ts +0 -125
  354. package/dist/types.backup/segment-content-promise.d.ts +0 -13
  355. package/dist/types.backup/segment-fragments.d.ts +0 -56
  356. package/dist/types.backup/segment-loader-promise.d.ts +0 -22
  357. package/dist/types.backup/segment-system.d.ts +0 -84
  358. package/dist/types.backup/serialize.d.ts +0 -164
  359. package/dist/types.backup/server/context.d.ts +0 -494
  360. package/dist/types.backup/server/cookie-parse.d.ts +0 -10
  361. package/dist/types.backup/server/cookie-store.d.ts +0 -107
  362. package/dist/types.backup/server/fetchable-loader-store.d.ts +0 -20
  363. package/dist/types.backup/server/handle-store.d.ts +0 -100
  364. package/dist/types.backup/server/loader-registry.d.ts +0 -32
  365. package/dist/types.backup/server/request-context.d.ts +0 -596
  366. package/dist/types.backup/server/root-layout.d.ts +0 -3
  367. package/dist/types.backup/server.d.ts +0 -15
  368. package/dist/types.backup/ssr/index.d.ts +0 -233
  369. package/dist/types.backup/ssr/inject-rsc-eager.d.ts +0 -3
  370. package/dist/types.backup/ssr/preinit-client-references.d.ts +0 -71
  371. package/dist/types.backup/ssr/ssr-root.d.ts +0 -69
  372. package/dist/types.backup/static-handler.d.ts +0 -57
  373. package/dist/types.backup/testing/cache-status.d.ts +0 -63
  374. package/dist/types.backup/testing/collect-handle.d.ts +0 -20
  375. package/dist/types.backup/testing/dispatch.d.ts +0 -123
  376. package/dist/types.backup/testing/dom.entry.d.ts +0 -15
  377. package/dist/types.backup/testing/e2e/fixture.d.ts +0 -37
  378. package/dist/types.backup/testing/e2e/index.d.ts +0 -30
  379. package/dist/types.backup/testing/e2e/matchers.d.ts +0 -17
  380. package/dist/types.backup/testing/e2e/page-helpers.d.ts +0 -62
  381. package/dist/types.backup/testing/e2e/parity.d.ts +0 -111
  382. package/dist/types.backup/testing/e2e/server.d.ts +0 -35
  383. package/dist/types.backup/testing/flight-matchers.d.ts +0 -55
  384. package/dist/types.backup/testing/flight-normalize.d.ts +0 -1
  385. package/dist/types.backup/testing/flight-tree.d.ts +0 -192
  386. package/dist/types.backup/testing/flight.d.ts +0 -115
  387. package/dist/types.backup/testing/flight.entry.d.ts +0 -27
  388. package/dist/types.backup/testing/generated-routes.d.ts +0 -66
  389. package/dist/types.backup/testing/index.d.ts +0 -52
  390. package/dist/types.backup/testing/internal/context.d.ts +0 -225
  391. package/dist/types.backup/testing/internal/flight-client-globals.d.ts +0 -1
  392. package/dist/types.backup/testing/internal/seed-vars.d.ts +0 -30
  393. package/dist/types.backup/testing/render-handler.d.ts +0 -160
  394. package/dist/types.backup/testing/render-route.d.ts +0 -246
  395. package/dist/types.backup/testing/run-loader.d.ts +0 -186
  396. package/dist/types.backup/testing/run-middleware.d.ts +0 -132
  397. package/dist/types.backup/testing/run-transition-when.d.ts +0 -77
  398. package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +0 -6
  399. package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +0 -13
  400. package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +0 -7
  401. package/dist/types.backup/testing/vitest-stubs/version.d.ts +0 -1
  402. package/dist/types.backup/testing/vitest.d.ts +0 -205
  403. package/dist/types.backup/theme/ThemeProvider.d.ts +0 -13
  404. package/dist/types.backup/theme/ThemeScript.d.ts +0 -45
  405. package/dist/types.backup/theme/constants.d.ts +0 -39
  406. package/dist/types.backup/theme/index.d.ts +0 -29
  407. package/dist/types.backup/theme/theme-context.d.ts +0 -21
  408. package/dist/types.backup/theme/theme-script.d.ts +0 -26
  409. package/dist/types.backup/theme/types.d.ts +0 -162
  410. package/dist/types.backup/theme/use-theme.d.ts +0 -8
  411. package/dist/types.backup/types/boundaries.d.ts +0 -93
  412. package/dist/types.backup/types/cache-types.d.ts +0 -191
  413. package/dist/types.backup/types/error-types.d.ts +0 -114
  414. package/dist/types.backup/types/global-namespace.d.ts +0 -90
  415. package/dist/types.backup/types/handler-context.d.ts +0 -658
  416. package/dist/types.backup/types/index.d.ts +0 -11
  417. package/dist/types.backup/types/loader-types.d.ts +0 -182
  418. package/dist/types.backup/types/request-scope.d.ts +0 -93
  419. package/dist/types.backup/types/route-config.d.ts +0 -105
  420. package/dist/types.backup/types/route-entry.d.ts +0 -95
  421. package/dist/types.backup/types/segments.d.ts +0 -234
  422. package/dist/types.backup/types.d.ts +0 -1
  423. package/dist/types.backup/urls/include-helper.d.ts +0 -17
  424. package/dist/types.backup/urls/include-provider.d.ts +0 -27
  425. package/dist/types.backup/urls/index.d.ts +0 -6
  426. package/dist/types.backup/urls/path-helper-types.d.ts +0 -197
  427. package/dist/types.backup/urls/path-helper.d.ts +0 -12
  428. package/dist/types.backup/urls/pattern-types.d.ts +0 -166
  429. package/dist/types.backup/urls/response-types.d.ts +0 -67
  430. package/dist/types.backup/urls/type-extraction.d.ts +0 -157
  431. package/dist/types.backup/urls/urls-function.d.ts +0 -24
  432. package/dist/types.backup/urls.d.ts +0 -1
  433. package/dist/types.backup/use-loader.d.ts +0 -150
  434. package/dist/types.backup/vercel/index.d.ts +0 -10
  435. package/dist/types.backup/vercel/tracing.d.ts +0 -70
  436. package/dist/types.backup/vite/debug.d.ts +0 -80
  437. package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +0 -12
  438. package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +0 -65
  439. package/dist/types.backup/vite/discovery/discover-routers.d.ts +0 -17
  440. package/dist/types.backup/vite/discovery/discovery-errors.d.ts +0 -113
  441. package/dist/types.backup/vite/discovery/gate-state.d.ts +0 -79
  442. package/dist/types.backup/vite/discovery/prerender-collection.d.ts +0 -24
  443. package/dist/types.backup/vite/discovery/route-types-writer.d.ts +0 -32
  444. package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +0 -22
  445. package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +0 -40
  446. package/dist/types.backup/vite/discovery/state.d.ts +0 -162
  447. package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +0 -15
  448. package/dist/types.backup/vite/index.d.ts +0 -11
  449. package/dist/types.backup/vite/inject-client-debug.d.ts +0 -56
  450. package/dist/types.backup/vite/plugin-types.d.ts +0 -298
  451. package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +0 -6
  452. package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +0 -40
  453. package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +0 -35
  454. package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +0 -64
  455. package/dist/types.backup/vite/plugins/expose-action-id.d.ts +0 -18
  456. package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +0 -37
  457. package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +0 -19
  458. package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +0 -10
  459. package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +0 -8
  460. package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +0 -13
  461. package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +0 -29
  462. package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +0 -6
  463. package/dist/types.backup/vite/plugins/performance-tracks.d.ts +0 -25
  464. package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +0 -20
  465. package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +0 -20
  466. package/dist/types.backup/vite/plugins/vercel-output.d.ts +0 -85
  467. package/dist/types.backup/vite/plugins/version-injector.d.ts +0 -21
  468. package/dist/types.backup/vite/plugins/version-plugin.d.ts +0 -19
  469. package/dist/types.backup/vite/plugins/virtual-entries.d.ts +0 -36
  470. package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +0 -7
  471. package/dist/types.backup/vite/rango.d.ts +0 -29
  472. package/dist/types.backup/vite/router-discovery.d.ts +0 -23
  473. package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +0 -64
  474. package/dist/types.backup/vite/utils/banner.d.ts +0 -2
  475. package/dist/types.backup/vite/utils/bundle-analysis.d.ts +0 -28
  476. package/dist/types.backup/vite/utils/client-chunks.d.ts +0 -55
  477. package/dist/types.backup/vite/utils/directive-prologue.d.ts +0 -16
  478. package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +0 -37
  479. package/dist/types.backup/vite/utils/manifest-utils.d.ts +0 -7
  480. package/dist/types.backup/vite/utils/package-resolution.d.ts +0 -6
  481. package/dist/types.backup/vite/utils/prerender-utils.d.ts +0 -32
  482. package/dist/types.backup/vite/utils/shared-utils.d.ts +0 -55
@@ -1,37 +0,0 @@
1
- import type { TestType } from "@playwright/test";
2
- import { type RunCliHandle, type SpawnOptions } from "./server.js";
3
- export interface FixtureOptions {
4
- /** Absolute or cwd-relative path to the consumer app under test. */
5
- root: string;
6
- /**
7
- * Server mode. Required: omitting it would spawn no server in beforeAll and
8
- * surface only as a bare "Invalid URL" from `url()` at first use, so we fail
9
- * eagerly at useFixture time instead.
10
- */
11
- mode: "dev" | "build";
12
- /** Override the server command (default: `pnpm dev` for dev, `pnpm preview` for build). */
13
- command?: string;
14
- /** Override the build command (default: `pnpm build`). */
15
- buildCommand?: string;
16
- cliOptions?: SpawnOptions;
17
- /** Spawn a per-suite server with an isolated Vite cache dir (dev only warmup). */
18
- isolatedServer?: boolean;
19
- /** Path to poll for readiness (default: "/"). Use when a basename moves routes off "/". */
20
- readyPath?: string;
21
- /** Skip the production build step (assumes an existing build). */
22
- skipBuild?: boolean;
23
- }
24
- export interface Fixture {
25
- mode: "dev" | "build";
26
- root: string;
27
- /** Resolve a path against the running server's base URL. */
28
- url: (url?: string) => string;
29
- /** The underlying spawned process handle (undefined before beforeAll). */
30
- proc: () => RunCliHandle | undefined;
31
- }
32
- /**
33
- * Build a `useFixture` bound to a consumer-provided Playwright `test` object.
34
- * The returned function registers `beforeAll`/`afterAll` hooks that spawn and
35
- * tear down a dev or preview server for the app at `options.root`.
36
- */
37
- export declare function createUseFixture(test: TestType<any, any>): (options: FixtureOptions) => Fixture;
@@ -1,30 +0,0 @@
1
- import type { Expect, TestType } from "@playwright/test";
2
- import { createUseFixture, type Fixture, type FixtureOptions } from "./fixture.js";
3
- import { createPageHelpers, createStopwatch, getHistoryState, getNumericContent, goBack, goForward, isVisibleInViewport, measureTime, type PageHelpers, parseNumber, type Stopwatch, testId, waitForElement, waitForHydration, waitForNavigation } from "./page-helpers.js";
4
- import { createParity, type ExpectParityOptions, type Parity, type ParityDescribeOptions, type ParityIntent } from "./parity.js";
5
- import { createRangoMatchers, type RangoMatchers } from "./matchers.js";
6
- export { assertCacheStatus, assertCacheDecision, parseCacheHeader, createCacheSink, filterCacheDecisions, type CacheSink, type ExpectedCacheStatus, type CacheStatusTarget, } from "../cache-status.js";
7
- export { testId, waitForHydration, waitForNavigation, goBack, goForward, getHistoryState, waitForElement, isVisibleInViewport, parseNumber, getNumericContent, createStopwatch, measureTime, createPageHelpers, createUseFixture, createParity, createRangoMatchers, };
8
- export type { Fixture, FixtureOptions, PageHelpers, Stopwatch, Parity, ParityIntent, ParityDescribeOptions, ExpectParityOptions, RangoMatchers, };
9
- export interface RangoE2E extends PageHelpers, Parity {
10
- useFixture: (options: FixtureOptions) => Fixture;
11
- testNoJs: TestType<any, any>;
12
- rangoMatchers: RangoMatchers;
13
- testId: typeof testId;
14
- waitForHydration: typeof waitForHydration;
15
- waitForNavigation: typeof waitForNavigation;
16
- goBack: typeof goBack;
17
- goForward: typeof goForward;
18
- getHistoryState: typeof getHistoryState;
19
- waitForElement: typeof waitForElement;
20
- isVisibleInViewport: typeof isVisibleInViewport;
21
- parseNumber: typeof parseNumber;
22
- getNumericContent: typeof getNumericContent;
23
- createStopwatch: typeof createStopwatch;
24
- measureTime: typeof measureTime;
25
- }
26
- export declare function createRangoE2E({ test, expect, defaultRoot, }: {
27
- test: TestType<any, any>;
28
- expect: Expect;
29
- defaultRoot?: string;
30
- }): RangoE2E;
@@ -1,17 +0,0 @@
1
- import type { Expect, Page } from "@playwright/test";
2
- interface MatcherResult {
3
- pass: boolean;
4
- message: () => string;
5
- }
6
- export interface RangoMatchers {
7
- toHaveRangoPathname: (page: Page, expected: string) => MatcherResult;
8
- }
9
- export declare function createRangoMatchers(_expect: Expect): RangoMatchers;
10
- declare global {
11
- namespace PlaywrightTest {
12
- interface Matchers<R, T> {
13
- toHaveRangoPathname(expected: string): R;
14
- }
15
- }
16
- }
17
- export {};
@@ -1,62 +0,0 @@
1
- import type { Expect, Locator, Page } from "@playwright/test";
2
- /** Get a locator by data-testid attribute. */
3
- export declare function testId(page: Page, id: string): Locator;
4
- /**
5
- * Wait for React hydration to complete and verify no hydration errors.
6
- * Rango sets `data-hydrated` on `<html>` after hydration via useEffect; this
7
- * is a stable readiness signal that does not rely on React internals.
8
- */
9
- export declare function waitForHydration(page: Page): Promise<void>;
10
- /** Wait for navigation to complete (URL change + network idle). */
11
- export declare function waitForNavigation(page: Page, expectedUrl: string | RegExp): Promise<void>;
12
- /** Navigate back and wait for navigation to complete. */
13
- export declare function goBack(page: Page): Promise<void>;
14
- /** Navigate forward and wait for navigation to complete. */
15
- export declare function goForward(page: Page): Promise<void>;
16
- /** Get the current history state. */
17
- export declare function getHistoryState(page: Page): Promise<unknown>;
18
- /** Wait for an element to appear and be visible. */
19
- export declare function waitForElement(page: Page, selector: string, timeout?: number): Promise<void>;
20
- /** Check if an element is visible. */
21
- export declare function isVisibleInViewport(page: Page, selector: string): Promise<boolean>;
22
- /**
23
- * Parse a number from text content (finds first number in string).
24
- *
25
- * @example
26
- * parseNumber("Load count: 42") // 42
27
- * parseNumber(null) // 0
28
- */
29
- export declare function parseNumber(text: string | null | undefined): number;
30
- /** Get the numeric value from an element's text content. */
31
- export declare function getNumericContent(locator: Locator): Promise<number>;
32
- export interface Stopwatch {
33
- elapsed: () => number;
34
- checkpoint: () => number;
35
- }
36
- /** Create a stopwatch for timing multiple checkpoints. */
37
- export declare function createStopwatch(): Stopwatch;
38
- /**
39
- * Measure elapsed time for an async operation. Returns `{ elapsed, result }`
40
- * where `elapsed` is in milliseconds.
41
- */
42
- export declare function measureTime<T>(fn: () => Promise<T>): Promise<{
43
- elapsed: number;
44
- result: T;
45
- }>;
46
- export interface PageHelpers {
47
- /** Assert that no full page reload occurred between scope entry and exit. */
48
- expectNoReload: (page: Page) => AsyncDisposable;
49
- /** Collect page errors and assert none occurred on scope exit. */
50
- expectNoPageError: (page: Page) => Disposable;
51
- /** Wait for an element's text to change from its initial value. */
52
- waitForTextChange: (locator: Locator, initialText: string, timeout?: number) => Promise<void>;
53
- /** Wait for a numeric value in an element to change. */
54
- waitForNumericChange: (locator: Locator, initialValue: number, timeout?: number) => Promise<void>;
55
- /** Assert timing is within `expected +/- tolerance`. */
56
- expectTiming: (elapsed: number, expected: number, tolerance: number) => void;
57
- /** Assert timing is at least `minimum`. */
58
- expectMinTiming: (elapsed: number, minimum: number) => void;
59
- /** Assert timing is less than `maximum`. */
60
- expectMaxTiming: (elapsed: number, maximum: number) => void;
61
- }
62
- export declare function createPageHelpers(expect: Expect): PageHelpers;
@@ -1,111 +0,0 @@
1
- import type { Expect, Page, TestType } from "@playwright/test";
2
- import type { Fixture, FixtureOptions } from "./fixture.js";
3
- export interface ParityDescribeOptions extends Partial<Omit<FixtureOptions, "mode">> {
4
- }
5
- export type ParityIntent = {
6
- navigate: string;
7
- } | {
8
- submit: {
9
- testId: string;
10
- data?: Record<string, string>;
11
- };
12
- };
13
- export interface ExpectParityOptions {
14
- /** data-testid values whose text content must match across JS and no-JS. */
15
- observe: string[];
16
- /** Base URL to resolve a relative `navigate` intent against. */
17
- baseURL?: string;
18
- /**
19
- * Escape hatch invoked after the intent is applied and before the snapshot is
20
- * taken, on BOTH the JS and the no-JS transports. When provided for a `submit`
21
- * intent it REPLACES the generic settle (the navigation/observed-change wait):
22
- * you take responsibility for awaiting the post-submit effect — for example,
23
- * awaiting a specific testid to reach a known value, or a network response the
24
- * page does not reflect in the observed testids. Receives the page for the
25
- * transport being snapshotted.
26
- */
27
- waitFor?: (page: Page) => Promise<void>;
28
- /**
29
- * Cookie NAMES to exclude from the JS-vs-no-JS jar comparison, matched exactly
30
- * (string) or by pattern (RegExp). The rango state cookie (default prefix
31
- * `rango-state`) is ALWAYS excluded — it is written/rotated only by the client
32
- * runtime, so it is JS-only by design and never appears in the no-JS jar. Use
33
- * this for a custom `stateCookiePrefix` (e.g. `[/^myapp-state_/]`) or any other
34
- * volatile/JS-only cookie (analytics, CSRF) that should not break parity.
35
- */
36
- ignoreCookies?: ReadonlyArray<string | RegExp>;
37
- }
38
- export interface Parity {
39
- /**
40
- * Register a dev describe (title `name`) and a production describe (title
41
- * `` `${name} (production)` ``) from one body. The `(production)` suffix is
42
- * generated here, so the production suite always lands in the production
43
- * bucket regardless of how the consumer names things.
44
- *
45
- * `options.root` is required, either here or as `defaultRoot` passed to the
46
- * factory.
47
- */
48
- parityDescribe: (name: string, body: (f: Fixture) => void, options?: ParityDescribeOptions) => void;
49
- /**
50
- * Run a single `intent` over both the JS path (the given `page`) and a
51
- * fresh no-JS context, then assert the observed snapshots are equal.
52
- *
53
- * PE parity only holds if the consumer's submit target is a real `<form>`
54
- * that progressively enhances: with JS disabled the browser performs a native
55
- * form POST, and the server must produce the same observable result the
56
- * enhanced client path produces. Navigation intents must be plain links/URLs
57
- * that resolve server-side without JS.
58
- *
59
- * For a `submit` intent the helper waits for the action's observable effect
60
- * before snapshotting: either a navigation away from the form, or a change to
61
- * one of the `observe` testids from its pre-submit value (then a brief
62
- * stability confirm). A submit that produces neither within ~5s throws —
63
- * include the testid that changes in `observe`, or pass `waitFor` to express
64
- * the precise wait. This prevents snapshotting the pre-submit DOM when the
65
- * action is slow.
66
- *
67
- * The snapshot is intentionally strict: it compares the text of every
68
- * observed `data-testid`, the resulting `page.url()`, and the cookies visible
69
- * via `document.cookie`. No ephemeral-value normalization is applied in v1;
70
- * if a consumer's page renders nondeterministic values, exclude that testid
71
- * from `observe`.
72
- *
73
- * LIMITATION: cookie parity is read from `document.cookie`, which by design
74
- * EXCLUDES HttpOnly cookies. Session/auth cookies (the typical HttpOnly case)
75
- * are therefore NOT compared — a PE/JS divergence in an HttpOnly cookie will
76
- * not be caught here. Assert on those via `read_network_requests` / response
77
- * Set-Cookie headers in a dedicated test, not expectParity.
78
- *
79
- * Submit-intent requirements (the `submit` path runs the intent TWICE against
80
- * the same server, and compares whole cookie jars from two contexts):
81
- * - DOUBLE EXECUTION: the JS path submits, then the no-JS pass reloads the
82
- * same `originUrl` in a fresh context and submits AGAIN. Both hit the one
83
- * running server, so a non-idempotent action runs twice. The no-JS snapshot
84
- * then observes BOTH mutations unless the mutated state is per-session /
85
- * per-context — e.g. an add-to-cart count only reaches the same value on
86
- * both transports if the cart is session-scoped (the JS context and the
87
- * fresh no-JS context are distinct sessions). A globally-shared counter
88
- * would read N after the JS submit and N+1 after the no-JS submit and
89
- * false-mismatch. Make the action's observable state session/context-scoped,
90
- * or assert the submit path some other way.
91
- * - COOKIE JAR vs DELTA: the cookie check compares the WHOLE `document.cookie`
92
- * of two different contexts. The JS context carries every cookie accumulated
93
- * before the intent (consent, analytics, prior navigations); the fresh no-JS
94
- * context starts empty. Unrelated pre-existing cookies therefore false-
95
- * mismatch — expectParity compares jars, not the per-submit cookie delta.
96
- * Keep the JS context's pre-intent cookie state minimal, or assert the
97
- * specific Set-Cookie elsewhere.
98
- * - RANGO STATE COOKIE: the rango state cookie (default prefix `rango-state`)
99
- * is written/rotated only by the client runtime, so it is JS-only by design
100
- * and would always diverge — it is excluded from the comparison
101
- * automatically. A custom `stateCookiePrefix` (or any other volatile/JS-only
102
- * cookie) is excluded via `opts.ignoreCookies`.
103
- */
104
- expectParity: (page: Page, intent: ParityIntent, opts: ExpectParityOptions) => Promise<void>;
105
- }
106
- export declare function createParity({ test: _test, expect, useFixture, defaultRoot, }: {
107
- test: TestType<any, any>;
108
- expect: Expect;
109
- useFixture: (options: FixtureOptions) => Fixture;
110
- defaultRoot?: string;
111
- }): Parity;
@@ -1,35 +0,0 @@
1
- import { type SpawnOptions } from "node:child_process";
2
- import { x } from "tinyexec";
3
- export type { SpawnOptions };
4
- export interface RunCliHandle {
5
- proc: ReturnType<typeof x>["process"];
6
- done: Promise<void>;
7
- /**
8
- * Resolves with the process's exit code (null if killed by signal) when it
9
- * exits. Unlike `done`, callers can branch on a nonzero code. Used to fail
10
- * the build step loudly; the long-running serve processes never inspect it.
11
- */
12
- exitCode: Promise<number | null>;
13
- findPort: (timeoutMs?: number) => Promise<number>;
14
- kill: () => void;
15
- stdout: () => string;
16
- stderr: () => string;
17
- }
18
- export declare function runCli(options: {
19
- command: string;
20
- label?: string;
21
- } & SpawnOptions): RunCliHandle;
22
- export declare function tailOutput(text: string, maxChars?: number): string;
23
- export declare function createIsolatedViteCacheDir(cwd: string, projectName: string, mode: "dev" | "build" | undefined): string;
24
- export declare function waitForReady(url: string, getOutput?: () => {
25
- stdout: string;
26
- stderr: string;
27
- }, timeoutMs?: number): Promise<void>;
28
- /**
29
- * Warm up an isolated dev server by making real SSR requests.
30
- * The first SSR request triggers Vite's dep optimizer to discover SSR deps.
31
- * After optimization, modules are re-evaluated and in-memory caches reset.
32
- * We retry until the server returns a stable 200, absorbing the dep
33
- * optimization cycle so subsequent test requests hit a settled server.
34
- */
35
- export declare function warmupDevServer(url: string): Promise<void>;
@@ -1,55 +0,0 @@
1
- /**
2
- * Vitest custom matchers for asserting on REAL Flight wire strings produced by
3
- * {@link renderToFlightString}. Register with:
4
- *
5
- * import { expect } from "vitest";
6
- * import { flightMatchers } from "@rangojs/router/testing/flight-matchers"; // or local path
7
- * expect.extend(flightMatchers);
8
- *
9
- * Ergonomic shape (vitest `expect` is single-arg, so the matcher receives the
10
- * ALREADY-RENDERED Flight string as `received`):
11
- *
12
- * const flight = await renderToFlightString(<Greeting name="Ada" />);
13
- * expect(flight).toMatchFlight("Ada"); // substring containment
14
- * expect(flight).toMatchFlightSnapshot(); // normalized snapshot
15
- *
16
- * `toMatchFlight(expected)` asserts the NORMALIZED Flight string CONTAINS
17
- * `expected`. Containment (not equality) is the v1 contract because the Flight
18
- * row prefixes/quoting are an internal serializer detail — tests should pin the
19
- * rendered text/shape, not the exact framing. For an exact, drift-detecting
20
- * assertion of the whole payload, use `toMatchFlightSnapshot()`.
21
- *
22
- * Both operate on normalized output (see normalizeFlight): the dev-only
23
- * `:N<timestamp>` reference row and absolute `file://` paths are scrubbed so
24
- * assertions are stable across runs/machines. Run snapshots under
25
- * NODE_ENV=production for the cleanest, most stable payloads.
26
- *
27
- * Scope: server-only / leaf trees (a client component emits an unresolved
28
- * `I[...]` import row against the empty client manifest — see flight.ts).
29
- */
30
- interface MatcherResult {
31
- pass: boolean;
32
- message: () => string;
33
- }
34
- export declare const flightMatchers: {
35
- toMatchFlight(received: string, expected: string): MatcherResult;
36
- toMatchFlightSnapshot(received: string): MatcherResult;
37
- };
38
- /**
39
- * Vitest Assertion augmentation so `toMatchFlight` / `toMatchFlightSnapshot`
40
- * are typed on `expect(...)`. Imported for its side-effecting type
41
- * augmentation; importing flight-matchers (which imports this) is enough.
42
- */
43
- declare module "vitest" {
44
- interface Assertion<T = any> {
45
- /** Assert the normalized Flight string contains `expected`. */
46
- toMatchFlight(expected: string): T;
47
- /** Snapshot the normalized Flight string. */
48
- toMatchFlightSnapshot(): T;
49
- }
50
- interface AsymmetricMatchersContaining {
51
- toMatchFlight(expected: string): void;
52
- toMatchFlightSnapshot(): void;
53
- }
54
- }
55
- export {};
@@ -1 +0,0 @@
1
- export declare function normalizeFlight(flight: string): string;
@@ -1,192 +0,0 @@
1
- /**
2
- * renderServerTree — REAL Flight serialize -> deserialize round-trip for unit
3
- * tests, returning an INSPECTABLE React element tree (not just the wire string).
4
- *
5
- * Where it sits:
6
- * - `renderRoute` (testing/dom): a synthetic CLIENT tree, no Flight at all.
7
- * - `renderToFlightString` (testing/flight): the real Flight WIRE STRING, for
8
- * `toMatchFlight` substring/snapshot assertions.
9
- * - `renderServerTree` (here): serializes the real Flight, then deserializes it
10
- * back to a React element tree you can traverse — so you can assert TYPED prop
11
- * fidelity across the server/client boundary (a `Date` comes back a `Date`,
12
- * not the opaque `$D...` wire encoding) and detect whether a `"use client"`
13
- * component actually crossed the boundary (an `I` row) or was inlined.
14
- *
15
- * Scope (deliberate): serialize + deserialize ONLY. There is NO hydration and
16
- * NO interaction — the deserialized client boundaries are inert placeholders
17
- * carrying their props. Real interaction/hydration-mismatch testing stays at the
18
- * e2e tier; in-process happy-dom hydration re-tests React more than your app and
19
- * misses the only hydration bug worth a dedicated test (server/client divergence
20
- * needs a real browser).
21
- *
22
- * Runs under the `react-server` export condition, in the SAME worker as the
23
- * serializer (the client deserializer's react/react-dom imports are inert here
24
- * because deserialize-only never renders). Use it from the rsc Vitest project
25
- * (vitest.rsc.config.ts); name files `*.rsc-test.{ts,tsx}`.
26
- */
27
- import "./internal/flight-client-globals.js";
28
- import type { ReactNode } from "react";
29
- import type { RenderToFlightStringOptions } from "./flight.js";
30
- /** Options for {@link renderServerTree}. */
31
- export interface RenderServerTreeOptions extends RenderToFlightStringOptions {
32
- /**
33
- * The `"use client"` components reachable from the server tree, keyed by the
34
- * name you want each boundary to have — usually the components you already
35
- * import to render them: `{ clientComponents: { Counter, PriceTag } }`.
36
- *
37
- * The rsc Vitest project does NOT apply the `"use client"` transform, so a
38
- * plainly-imported island is just a function the serializer would render
39
- * server-side (and likely throw on a hook). Listing them here registers each as
40
- * a client reference (in place) so it serializes as a real boundary (`I` row).
41
- * This depends on NO filename convention — `"use client"` is marked by the
42
- * directive, not the name, and you already import these to render them.
43
- *
44
- * Omit it for pure server-only trees. Components already registered as client
45
- * references (e.g. by a transform) are left untouched. Registration is in place
46
- * and per-worker first-wins: a component keeps the first name it is registered
47
- * under for the rest of the test file.
48
- */
49
- clientComponents?: Record<string, unknown>;
50
- }
51
- /** Result of {@link renderServerTree}. */
52
- export interface RenderServerTreeResult {
53
- /** The raw Flight wire string (so `toMatchFlight` assertions still apply). */
54
- flight: string;
55
- /**
56
- * The deserialized React element tree. Server elements are plain React
57
- * elements; each client boundary is an inert placeholder element whose `props`
58
- * are the real, deserialized JS values that crossed the boundary. Use
59
- * {@link findClientBoundaries} to locate them.
60
- */
61
- tree: unknown;
62
- }
63
- /** A client boundary located in a deserialized tree. */
64
- export interface ClientBoundary {
65
- /** The id the boundary was registered under (the `clientComponents` key). */
66
- id: string;
67
- /** The boundary name (the `clientComponents` key). */
68
- name: string;
69
- /**
70
- * The props that crossed the boundary, as real deserialized JS values
71
- * (EXCLUDES `children` — read it off {@link ClientBoundary.children}, mirroring
72
- * {@link FoundElement}).
73
- */
74
- props: Record<string, unknown>;
75
- /** The boundary's `props.children` (what was nested inside the island). */
76
- children: unknown;
77
- /** The raw deserialized element (for advanced assertions). */
78
- element: unknown;
79
- }
80
- /**
81
- * A selector for {@link findClientBoundaries}. Pass a string to match by export
82
- * name (the back-compatible form), or this object to also filter by props /
83
- * test id / an arbitrary predicate. All provided criteria are AND-ed.
84
- *
85
- * Only CLIENT boundaries are matched — a `data-testid` on a `"use client"`
86
- * island is a prop that crossed the boundary (so `testId` finds it), but a
87
- * `data-testid` on a plain server host element is NOT a boundary and is not
88
- * matched here.
89
- */
90
- export interface BoundarySelector {
91
- /** Match the boundary's export name (same as passing a bare string). */
92
- name?: string;
93
- /** Match `props["data-testid"]` exactly (sugar over `props: { "data-testid": ... }`). */
94
- testId?: string;
95
- /**
96
- * Subset match: every listed prop must DEEP-EQUAL the boundary's prop of the
97
- * same key (Date/Map/Set/array/nested-object aware). Props not listed are
98
- * ignored, so `{ amount: 12.5 }` matches a boundary that also has other props.
99
- */
100
- props?: Record<string, unknown>;
101
- /** Arbitrary predicate, AND-ed with the criteria above. */
102
- where?: (boundary: ClientBoundary) => boolean;
103
- }
104
- /** Register `{ name: Component }` entries, keyed by name (id === name). */
105
- export declare function registerClientComponents(components: Record<string, unknown>): void;
106
- /**
107
- * A client manifest that resolves ANY registered client reference without
108
- * needing to enumerate them. `$$id` is `${id}#${exportName}`; the serializer
109
- * looks it up here. We omit `async`, so each `I` row is a 3-element row and the
110
- * deserialized boundary's payload is a clean `resolved_module` whose value is
111
- * `[id, [], name]` — synchronously readable by {@link findClientBoundaries}.
112
- */
113
- export declare function makeClientManifest(): unknown;
114
- /**
115
- * Serialize a server component to real Flight, then deserialize it back to an
116
- * inspectable React element tree. See the module header for scope.
117
- *
118
- * Must run under the `react-server` export condition.
119
- */
120
- export declare function renderServerTree(element: ReactNode, opts?: RenderServerTreeOptions): Promise<RenderServerTreeResult>;
121
- /**
122
- * Deserialize a Flight wire string back to an inspectable React element tree:
123
- * `createFromReadableStream` (vendored client), then unwrap Rango's payload
124
- * wrapper and resolve the top server chunk so the consumer gets their element,
125
- * not a lazy. Reused by renderServerTree AND renderHandler. Client references
126
- * stay as inert boundary markers ({@link findClientBoundaries} reads them).
127
- */
128
- export declare function deserializeFlight(flight: string): Promise<unknown>;
129
- export declare function findClientBoundaries(tree: unknown, selector?: string | BoundarySelector): ClientBoundary[];
130
- /** A server/host element located in a deserialized tree by {@link findElements}. */
131
- export interface FoundElement {
132
- /** The host tag name (`"article"`, `"h2"`). Always a host element. */
133
- tag: string;
134
- /** The element's props, as real deserialized JS values (excludes `children`). */
135
- props: Record<string, unknown>;
136
- /** The element's `props.children` (the rendered child tree), for convenience. */
137
- children: unknown;
138
- /** Concatenated text content of this element's subtree. */
139
- text: string;
140
- /** The raw deserialized element (for advanced assertions). */
141
- element: unknown;
142
- }
143
- /**
144
- * A selector for {@link findElements}. Pass a string to match a host tag name
145
- * (`"h2"`), or this object for finer matches. All provided criteria are AND-ed.
146
- *
147
- * Mirrors {@link BoundarySelector} but keys on `tag` (the host tag) rather than
148
- * `name` (a client component's export identity) — by design, since a host element
149
- * has no component name. It also adds `text`, which a boundary selector lacks: a
150
- * host element has rendered text, whereas a client boundary is an inert
151
- * placeholder with no rendered children to match against.
152
- */
153
- export interface ElementSelector {
154
- /** Match the host tag name (`"article"`, `"h2"`). */
155
- tag?: string;
156
- /** Match `props["data-testid"]` exactly. */
157
- testId?: string;
158
- /** Subset deep-equal match on props (Date/Map/Set/array/nested aware). */
159
- props?: Record<string, unknown>;
160
- /** Match the element's text content (substring for a string, `.test()` for a RegExp). */
161
- text?: string | RegExp;
162
- /** Arbitrary predicate, AND-ed with the criteria above. */
163
- where?: (element: FoundElement) => boolean;
164
- }
165
- /**
166
- * Concatenate the text content of a deserialized node's subtree — every string
167
- * and number leaf, in document order, space-free (`<h2>Wine {2}</h2>` ->
168
- * `"Wine 2"` only if the source had the space). Use it to assert rendered text
169
- * without reaching for `JSON.stringify(tree).toContain(...)`.
170
- */
171
- export declare function textContent(node: unknown): string;
172
- /**
173
- * Walk a deserialized tree and return every SERVER/HOST element (the output a
174
- * server component rendered), in document order. The optional second arg filters:
175
- * - a STRING matches a host tag name (`findElements(tree, "h2")`);
176
- * - an {@link ElementSelector} filters by `tag` / `testId` / `props` (subset
177
- * deep-equal) / `text` (substring or RegExp) / `where`, AND-ed.
178
- *
179
- * Caveat: server COMPONENTS do not survive Flight as identities — they are
180
- * executed during serialization, so only the host elements they produced remain.
181
- * Match those host elements (by tag/props/text), not the component function. For
182
- * CLIENT islands (which DO keep identity) use {@link findClientBoundaries}.
183
- *
184
- * Always returns an array (destructure the first for a single expected match).
185
- */
186
- export declare function findElements(tree: unknown, selector?: string | ElementSelector): FoundElement[];
187
- /**
188
- * Smoke check that the vendored client deserializer subpaths still resolve. The
189
- * paths are private to plugin-rsc; a minor bump could relocate them. Call this in
190
- * a test to fail loudly with a clear message instead of an opaque import error.
191
- */
192
- export declare function assertFlightTreeRuntimeAvailable(): void;
@@ -1,115 +0,0 @@
1
- /**
2
- * renderToFlightString — REAL React Server Component (Flight) rendering for
3
- * unit tests of @rangojs/router consumer apps.
4
- *
5
- * This module renders a server component tree to its Flight wire string using
6
- * the same react-server-dom serializer the router uses at runtime. It runs in
7
- * plain node (no Vite, no browser), but ONLY under the `react-server` export
8
- * condition. The serializer is the VENDORED build shipped with
9
- * @vitejs/plugin-rsc — the public `@vitejs/plugin-rsc/rsc` entry top-level
10
- * imports Vite virtual modules and is not usable outside a Vite build.
11
- *
12
- * Run the example/tests for this module via the dedicated rsc vitest project
13
- * (vitest.rsc.config.ts), which forces `--conditions=react-server` on the
14
- * worker. The main vitest project must NOT use that condition (it would flip
15
- * React to the no-hooks server build and break the ~50 tests that mock
16
- * @vitejs/plugin-rsc/rsc).
17
- *
18
- * Scope / limitations (v1):
19
- * - Server-only / leaf trees. A tree containing a CLIENT component emits an
20
- * `I[...]` import row whose module id will not resolve against the empty `{}`
21
- * client manifest used here — fine for snapshotting the SHAPE of the payload.
22
- * To inspect a client boundary's deserialized props instead, use
23
- * `renderServerTree` (flight-tree.ts). Interactive hydration stays at the e2e tier.
24
- * - The vendored subpath is a private plugin-rsc path; a minor bump could move
25
- * it. `assertFlightRuntimeAvailable()` provides a smoke check.
26
- * - For stable snapshots, run under NODE_ENV=production: the production
27
- * serializer drops the dev-only debug-info rows (the `N<timestamp>` reference
28
- * row, the per-component `stack`/`env` rows, and `D{...}` timing rows),
29
- * leaving just the rendered tree row(s).
30
- */
31
- import type { ReactNode } from "react";
32
- import { type VarsInit } from "./internal/seed-vars.js";
33
- import { normalizeFlight } from "./flight-normalize.js";
34
- import type { ThemeConfig } from "../theme/types.js";
35
- import type { SegmentCacheStore } from "../cache/types.js";
36
- import type { CacheProfile } from "../cache/profile-registry.js";
37
- export { normalizeFlight };
38
- /**
39
- * Options for {@link renderToFlightString}.
40
- */
41
- export interface RenderToFlightStringOptions {
42
- /**
43
- * The request the render runs under: a `Request`, or a URL string (absolute or
44
- * path). Defaults to `http://localhost/`. A server component reading
45
- * `getRequestContext()` sees this request's url/cookies. When a `Request` is
46
- * passed, its headers are used and `headers` below is ignored.
47
- */
48
- request?: Request | string;
49
- /** Request headers (e.g. Cookie) visible to the server tree (when `request` is a string). */
50
- headers?: HeadersInit;
51
- /** Env / bindings exposed as `ctx.env`. Defaults to `{}`. */
52
- env?: unknown;
53
- /** Route params exposed via `ctx.params` and loader contexts. */
54
- params?: Record<string, string>;
55
- /** Matched route name (drives `ctx.routeName` and scoped reverse). */
56
- routeName?: string;
57
- /**
58
- * Route name -> pattern map enabling a SCOPED `ctx.reverse()` (like
59
- * `renderHandler`). Without it, a server component that reverses resolves
60
- * against the GLOBAL route map and is order-dependent on whatever router
61
- * registered last. Pass the router-under-test's map to make reversing
62
- * deterministic.
63
- */
64
- routeMap?: Record<string, string>;
65
- /**
66
- * Context variables visible to the rendered tree via `ctx.get(...)` — as a
67
- * prior middleware would have set them. Seeds the SAME way the handler-test
68
- * primitives (`runInRequestContext`/`runLoader`) do, so a server component
69
- * that reads `getRequestContext().get(MyVar)` during render is testable.
70
- * Object form (`{ user }`) or `[key, value]` tuples (`[[userVar, u]]`).
71
- */
72
- vars?: VarsInit;
73
- /**
74
- * Theme config in the same shape `createRouter({ theme })` takes (e.g. `true`
75
- * or `{ themes: [...] }`). Without it `getRequestContext().theme` is `undefined`
76
- * and `ctx.setTheme` is inert — pass one to render a server component that
77
- * reads `ctx.theme`. Threaded into the SAME createRequestContext renderHandler
78
- * uses, so the two Flight primitives expose theme identically.
79
- */
80
- theme?: ThemeConfig | true;
81
- /**
82
- * Cache store backing a `"use cache"` function the rendered server tree
83
- * invokes. Without it, `registerCachedFunction` takes the uncached bypass and
84
- * the cached path is NOT exercised. Pair with `cacheProfiles` so a
85
- * `"use cache: profileName"` directive resolves its profile.
86
- */
87
- cacheStore?: SegmentCacheStore;
88
- /** Cache profiles in the `createRouter({ cacheProfiles })` shape. */
89
- cacheProfiles?: Record<string, CacheProfile>;
90
- }
91
- /**
92
- * True when `error` is the out-of-react-server stub thrown by index.ts's
93
- * server-only exports (getRequestContext/cookies/headers/...) — i.e. the bare
94
- * `@rangojs/router` specifier resolved to index.ts, not index.rsc.ts, because
95
- * the rsc Vitest project is missing the `rangoTestAliases` alias. Matches both
96
- * substrings of `serverOnlyStubError` (index.ts) so a normal app error cannot
97
- * over-match. Shared with render-handler.ts so the two Flight primitives report
98
- * the same misconfiguration identically.
99
- */
100
- export declare function isServerOnlyStubError(error: unknown): boolean;
101
- export declare function assertNoLegacyUrlOption(opts: object, fnName: string): void;
102
- /**
103
- * Render a server component (or any ReactNode) to its Flight wire string.
104
- *
105
- * The element is wrapped in a minimal Rango segment + payload, then serialized
106
- * with the vendored react-server-dom server. A request context is active for
107
- * the duration of the render (drained INSIDE runWithRequestContext) so async
108
- * server components can call getRequestContext(), read params, cookies, etc.
109
- *
110
- * Must run under the `react-server` export condition (see module header).
111
- */
112
- export declare function renderToFlightString(element: ReactNode, opts?: RenderToFlightStringOptions): Promise<string>;
113
- export declare function serializeToFlightString(element: ReactNode, opts: RenderToFlightStringOptions, clientManifest: unknown): Promise<string>;
114
- export declare function serializeNodeToFlight(node: ReactNode, clientManifest: unknown, pathname: string): Promise<string>;
115
- export declare function assertFlightRuntimeAvailable(): void;