@timber-js/app 0.2.0-alpha.12 → 0.2.0-alpha.120

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 (758) hide show
  1. package/dist/_chunks/actions-Cw-7NfJJ.js +1101 -0
  2. package/dist/_chunks/actions-Cw-7NfJJ.js.map +1 -0
  3. package/dist/_chunks/build-output-helper-DhxiT18k.js +61 -0
  4. package/dist/_chunks/build-output-helper-DhxiT18k.js.map +1 -0
  5. package/dist/_chunks/cli-schema-sync-XV0I47Gj.js +2 -0
  6. package/dist/_chunks/cli-schema-sync-q2wB0DyJ.js +358 -0
  7. package/dist/_chunks/cli-schema-sync-q2wB0DyJ.js.map +1 -0
  8. package/dist/_chunks/codec-registry-V7ARyeLN.js +21 -0
  9. package/dist/_chunks/codec-registry-V7ARyeLN.js.map +1 -0
  10. package/dist/_chunks/define-8zQ8Vm7x.js +195 -0
  11. package/dist/_chunks/define-8zQ8Vm7x.js.map +1 -0
  12. package/dist/_chunks/define-zQX6e1tN.js +124 -0
  13. package/dist/_chunks/define-zQX6e1tN.js.map +1 -0
  14. package/dist/_chunks/format-CR6v1pWE.js +14 -0
  15. package/dist/_chunks/format-CR6v1pWE.js.map +1 -0
  16. package/dist/_chunks/handler-store-iqnt2ghN.js +54 -0
  17. package/dist/_chunks/handler-store-iqnt2ghN.js.map +1 -0
  18. package/dist/_chunks/logger-DDmK5skc.js +291 -0
  19. package/dist/_chunks/logger-DDmK5skc.js.map +1 -0
  20. package/dist/_chunks/merge-search-params-CwxJzBLS.js +41 -0
  21. package/dist/_chunks/merge-search-params-CwxJzBLS.js.map +1 -0
  22. package/dist/_chunks/navigation-root-DKsJ5Di7.js +96 -0
  23. package/dist/_chunks/navigation-root-DKsJ5Di7.js.map +1 -0
  24. package/dist/_chunks/registry-Dp_hJL4s.js +20 -0
  25. package/dist/_chunks/registry-Dp_hJL4s.js.map +1 -0
  26. package/dist/_chunks/resolve-schema-23Mc8aLi.js +65 -0
  27. package/dist/_chunks/resolve-schema-23Mc8aLi.js.map +1 -0
  28. package/dist/_chunks/router-ref-sektkr-t.js +28 -0
  29. package/dist/_chunks/router-ref-sektkr-t.js.map +1 -0
  30. package/dist/_chunks/scanner-DmfoB7iK.js +336 -0
  31. package/dist/_chunks/scanner-DmfoB7iK.js.map +1 -0
  32. package/dist/_chunks/schema-bridge-eL5vQDSA.js +86 -0
  33. package/dist/_chunks/schema-bridge-eL5vQDSA.js.map +1 -0
  34. package/dist/_chunks/segment-classify-CnfLLvir.js +137 -0
  35. package/dist/_chunks/segment-classify-CnfLLvir.js.map +1 -0
  36. package/dist/_chunks/segment-context-Bg0pFbLT.js +34 -0
  37. package/dist/_chunks/segment-context-Bg0pFbLT.js.map +1 -0
  38. package/dist/_chunks/{ssr-data-MjmprTmO.js → ssr-data-BO5OvEvg.js} +1 -1
  39. package/dist/_chunks/ssr-data-BO5OvEvg.js.map +1 -0
  40. package/dist/_chunks/stale-reload-BCPRG0Cv.js +64 -0
  41. package/dist/_chunks/stale-reload-BCPRG0Cv.js.map +1 -0
  42. package/dist/_chunks/tracing-DvKLzCFa.js +329 -0
  43. package/dist/_chunks/tracing-DvKLzCFa.js.map +1 -0
  44. package/dist/_chunks/{use-query-states-D5KaffOK.js → use-query-states-D9SBlAfp.js} +7 -20
  45. package/dist/_chunks/use-query-states-D9SBlAfp.js.map +1 -0
  46. package/dist/_chunks/use-segment-params-CskiK-59.js +185 -0
  47. package/dist/_chunks/use-segment-params-CskiK-59.js.map +1 -0
  48. package/dist/_chunks/validation-Bm3Je-09.js +84 -0
  49. package/dist/_chunks/validation-Bm3Je-09.js.map +1 -0
  50. package/dist/_chunks/walkers-DgOXkTts.js +609 -0
  51. package/dist/_chunks/walkers-DgOXkTts.js.map +1 -0
  52. package/dist/_chunks/{format-DviM89f0.js → warnings-B30wpfaS.js} +6 -45
  53. package/dist/_chunks/warnings-B30wpfaS.js.map +1 -0
  54. package/dist/adapters/build-output-helper.d.ts +28 -0
  55. package/dist/adapters/build-output-helper.d.ts.map +1 -0
  56. package/dist/adapters/cloudflare-dev.d.ts +109 -0
  57. package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
  58. package/dist/adapters/cloudflare-dev.js +73 -0
  59. package/dist/adapters/cloudflare-dev.js.map +1 -0
  60. package/dist/adapters/cloudflare-kv-cache.d.ts +64 -0
  61. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  62. package/dist/adapters/cloudflare-kv-cache.js +95 -0
  63. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  64. package/dist/adapters/cloudflare.d.ts +148 -12
  65. package/dist/adapters/cloudflare.d.ts.map +1 -1
  66. package/dist/adapters/cloudflare.js +142 -38
  67. package/dist/adapters/cloudflare.js.map +1 -1
  68. package/dist/adapters/compress-module.d.ts.map +1 -1
  69. package/dist/adapters/nitro.d.ts +17 -1
  70. package/dist/adapters/nitro.d.ts.map +1 -1
  71. package/dist/adapters/nitro.js +143 -45
  72. package/dist/adapters/nitro.js.map +1 -1
  73. package/dist/adapters/shared.d.ts +16 -0
  74. package/dist/adapters/shared.d.ts.map +1 -0
  75. package/dist/cache/cache-api.d.ts +24 -0
  76. package/dist/cache/cache-api.d.ts.map +1 -0
  77. package/dist/cache/handler-store.d.ts +31 -0
  78. package/dist/cache/handler-store.d.ts.map +1 -0
  79. package/dist/cache/index.d.ts +23 -7
  80. package/dist/cache/index.d.ts.map +1 -1
  81. package/dist/cache/index.js +151 -81
  82. package/dist/cache/index.js.map +1 -1
  83. package/dist/cache/singleflight.d.ts +18 -1
  84. package/dist/cache/singleflight.d.ts.map +1 -1
  85. package/dist/cache/sizeof.d.ts +22 -0
  86. package/dist/cache/sizeof.d.ts.map +1 -0
  87. package/dist/cache/timber-cache.d.ts +1 -1
  88. package/dist/cache/timber-cache.d.ts.map +1 -1
  89. package/dist/cli-schema-sync.d.ts +37 -0
  90. package/dist/cli-schema-sync.d.ts.map +1 -0
  91. package/dist/cli.d.ts +14 -2
  92. package/dist/cli.d.ts.map +1 -1
  93. package/dist/cli.js +42 -6
  94. package/dist/cli.js.map +1 -1
  95. package/dist/client/browser-dev.d.ts +34 -1
  96. package/dist/client/browser-dev.d.ts.map +1 -1
  97. package/dist/client/browser-entry/action-dispatch.d.ts +17 -0
  98. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  99. package/dist/client/browser-entry/hmr.d.ts +21 -0
  100. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  101. package/dist/client/browser-entry/hydrate.d.ts +46 -0
  102. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  103. package/dist/client/browser-entry/index.d.ts +30 -0
  104. package/dist/client/browser-entry/index.d.ts.map +1 -0
  105. package/dist/client/browser-entry/post-hydration.d.ts +26 -0
  106. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  107. package/dist/client/browser-entry/router-init.d.ts +23 -0
  108. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  109. package/dist/client/browser-entry/rsc-stream.d.ts +24 -0
  110. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  111. package/dist/client/browser-entry/scroll.d.ts +19 -0
  112. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  113. package/dist/client/error-boundary.d.ts +12 -5
  114. package/dist/client/error-boundary.d.ts.map +1 -1
  115. package/dist/client/error-boundary.js +29 -6
  116. package/dist/client/error-boundary.js.map +1 -1
  117. package/dist/client/error-reconstituter.d.ts +54 -0
  118. package/dist/client/error-reconstituter.d.ts.map +1 -0
  119. package/dist/client/form.d.ts +16 -27
  120. package/dist/client/form.d.ts.map +1 -1
  121. package/dist/client/history.d.ts +19 -4
  122. package/dist/client/history.d.ts.map +1 -1
  123. package/dist/client/index.d.ts +9 -24
  124. package/dist/client/index.d.ts.map +1 -1
  125. package/dist/client/index.js +172 -1100
  126. package/dist/client/index.js.map +1 -1
  127. package/dist/client/internal.d.ts +19 -0
  128. package/dist/client/internal.d.ts.map +1 -0
  129. package/dist/client/internal.js +964 -0
  130. package/dist/client/internal.js.map +1 -0
  131. package/dist/client/link-pending-store.d.ts +63 -0
  132. package/dist/client/link-pending-store.d.ts.map +1 -0
  133. package/dist/client/link.d.ts +62 -55
  134. package/dist/client/link.d.ts.map +1 -1
  135. package/dist/client/nav-link-store.d.ts +36 -0
  136. package/dist/client/nav-link-store.d.ts.map +1 -0
  137. package/dist/client/navigation-api-types.d.ts +90 -0
  138. package/dist/client/navigation-api-types.d.ts.map +1 -0
  139. package/dist/client/navigation-api.d.ts +115 -0
  140. package/dist/client/navigation-api.d.ts.map +1 -0
  141. package/dist/client/navigation-context.d.ts +13 -2
  142. package/dist/client/navigation-context.d.ts.map +1 -1
  143. package/dist/client/{transition-root.d.ts → navigation-root.d.ts} +42 -8
  144. package/dist/client/navigation-root.d.ts.map +1 -0
  145. package/dist/client/nuqs-adapter.d.ts.map +1 -1
  146. package/dist/client/router-ref.d.ts +1 -1
  147. package/dist/client/router.d.ts +70 -4
  148. package/dist/client/router.d.ts.map +1 -1
  149. package/dist/client/rsc-fetch.d.ts +38 -3
  150. package/dist/client/rsc-fetch.d.ts.map +1 -1
  151. package/dist/client/segment-cache.d.ts +1 -1
  152. package/dist/client/segment-cache.d.ts.map +1 -1
  153. package/dist/client/segment-outlet.d.ts +63 -0
  154. package/dist/client/segment-outlet.d.ts.map +1 -0
  155. package/dist/client/ssr-data.d.ts +13 -4
  156. package/dist/client/ssr-data.d.ts.map +1 -1
  157. package/dist/client/stale-reload.d.ts +15 -0
  158. package/dist/client/stale-reload.d.ts.map +1 -1
  159. package/dist/client/state.d.ts +1 -1
  160. package/dist/client/top-loader.d.ts +5 -5
  161. package/dist/client/top-loader.d.ts.map +1 -1
  162. package/dist/client/use-cookie.d.ts +12 -0
  163. package/dist/client/use-cookie.d.ts.map +1 -1
  164. package/dist/client/use-link-status.d.ts +5 -5
  165. package/dist/client/use-link-status.d.ts.map +1 -1
  166. package/dist/client/{use-navigation-pending.d.ts → use-pending-navigation.d.ts} +4 -4
  167. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  168. package/dist/client/use-query-states.d.ts +1 -1
  169. package/dist/client/use-query-states.d.ts.map +1 -1
  170. package/dist/client/use-router.d.ts +1 -1
  171. package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +8 -6
  172. package/dist/client/use-segment-params.d.ts.map +1 -0
  173. package/dist/codec.d.ts +51 -0
  174. package/dist/codec.d.ts.map +1 -0
  175. package/dist/codec.js +46 -0
  176. package/dist/codec.js.map +1 -0
  177. package/dist/config-types.d.ts +294 -0
  178. package/dist/config-types.d.ts.map +1 -0
  179. package/dist/config-validation.d.ts +51 -0
  180. package/dist/config-validation.d.ts.map +1 -0
  181. package/dist/content/index.d.ts +1 -10
  182. package/dist/content/index.d.ts.map +1 -1
  183. package/dist/content/index.js +0 -2
  184. package/dist/cookies/define-cookie.d.ts +58 -25
  185. package/dist/cookies/define-cookie.d.ts.map +1 -1
  186. package/dist/cookies/index.d.ts +2 -1
  187. package/dist/cookies/index.d.ts.map +1 -1
  188. package/dist/cookies/index.js +251 -36
  189. package/dist/cookies/index.js.map +1 -1
  190. package/dist/cookies/json-cookie.d.ts +64 -0
  191. package/dist/cookies/json-cookie.d.ts.map +1 -0
  192. package/dist/cookies/validation.d.ts +46 -0
  193. package/dist/cookies/validation.d.ts.map +1 -0
  194. package/dist/dev-tools/404-page.d.ts +46 -0
  195. package/dist/dev-tools/404-page.d.ts.map +1 -0
  196. package/dist/dev-tools/browser-logs.d.ts +84 -0
  197. package/dist/dev-tools/browser-logs.d.ts.map +1 -0
  198. package/dist/dev-tools/error-page.d.ts +58 -0
  199. package/dist/dev-tools/error-page.d.ts.map +1 -0
  200. package/dist/dev-tools/holding-server.d.ts +54 -0
  201. package/dist/dev-tools/holding-server.d.ts.map +1 -0
  202. package/dist/dev-tools/index.d.ts +31 -0
  203. package/dist/dev-tools/index.d.ts.map +1 -0
  204. package/dist/{server/dev-span-processor.d.ts → dev-tools/instrumentation.d.ts} +26 -6
  205. package/dist/dev-tools/instrumentation.d.ts.map +1 -0
  206. package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
  207. package/dist/dev-tools/logger.d.ts.map +1 -0
  208. package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +2 -2
  209. package/dist/dev-tools/logs.d.ts.map +1 -0
  210. package/dist/dev-tools/overlay.d.ts +91 -0
  211. package/dist/dev-tools/overlay.d.ts.map +1 -0
  212. package/dist/dev-tools/stack-classifier.d.ts +34 -0
  213. package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
  214. package/dist/dev-tools/terminal.d.ts +28 -0
  215. package/dist/dev-tools/terminal.d.ts.map +1 -0
  216. package/dist/{server/dev-warnings.d.ts → dev-tools/warnings.d.ts} +2 -22
  217. package/dist/dev-tools/warnings.d.ts.map +1 -0
  218. package/dist/fonts/ast.d.ts +98 -6
  219. package/dist/fonts/ast.d.ts.map +1 -1
  220. package/dist/fonts/bundle.d.ts +48 -0
  221. package/dist/fonts/bundle.d.ts.map +1 -0
  222. package/dist/fonts/dev-middleware.d.ts +22 -0
  223. package/dist/fonts/dev-middleware.d.ts.map +1 -0
  224. package/dist/fonts/local.d.ts +1 -1
  225. package/dist/fonts/pipeline.d.ts +167 -0
  226. package/dist/fonts/pipeline.d.ts.map +1 -0
  227. package/dist/fonts/transform.d.ts +78 -0
  228. package/dist/fonts/transform.d.ts.map +1 -0
  229. package/dist/fonts/types.d.ts +45 -1
  230. package/dist/fonts/types.d.ts.map +1 -1
  231. package/dist/fonts/virtual-modules.d.ts +94 -0
  232. package/dist/fonts/virtual-modules.d.ts.map +1 -0
  233. package/dist/index.d.ts +46 -190
  234. package/dist/index.d.ts.map +1 -1
  235. package/dist/index.js +4799 -12730
  236. package/dist/index.js.map +1 -1
  237. package/dist/params/codec-registry.d.ts +26 -0
  238. package/dist/params/codec-registry.d.ts.map +1 -0
  239. package/dist/params/define-schema.d.ts +53 -0
  240. package/dist/params/define-schema.d.ts.map +1 -0
  241. package/dist/params/index.d.ts +5 -0
  242. package/dist/params/index.d.ts.map +1 -0
  243. package/dist/params/index.js +34 -0
  244. package/dist/params/index.js.map +1 -0
  245. package/dist/params/resolve-schema.d.ts +34 -0
  246. package/dist/params/resolve-schema.d.ts.map +1 -0
  247. package/dist/plugin-context.d.ts +107 -0
  248. package/dist/plugin-context.d.ts.map +1 -0
  249. package/dist/plugins/adapter-build.d.ts +1 -1
  250. package/dist/plugins/adapter-build.d.ts.map +1 -1
  251. package/dist/plugins/build-manifest.d.ts +2 -2
  252. package/dist/plugins/build-manifest.d.ts.map +1 -1
  253. package/dist/plugins/build-report.d.ts +9 -7
  254. package/dist/plugins/build-report.d.ts.map +1 -1
  255. package/dist/plugins/client-chunks.d.ts +32 -0
  256. package/dist/plugins/client-chunks.d.ts.map +1 -0
  257. package/dist/plugins/content.d.ts +1 -1
  258. package/dist/plugins/content.d.ts.map +1 -1
  259. package/dist/plugins/dev-server.d.ts +1 -1
  260. package/dist/plugins/dev-server.d.ts.map +1 -1
  261. package/dist/plugins/entries.d.ts +1 -1
  262. package/dist/plugins/entries.d.ts.map +1 -1
  263. package/dist/plugins/fonts.d.ts +17 -73
  264. package/dist/plugins/fonts.d.ts.map +1 -1
  265. package/dist/plugins/mdx.d.ts +1 -1
  266. package/dist/plugins/mdx.d.ts.map +1 -1
  267. package/dist/plugins/routing.d.ts +1 -1
  268. package/dist/plugins/routing.d.ts.map +1 -1
  269. package/dist/plugins/server-bundle.d.ts.map +1 -1
  270. package/dist/plugins/shims.d.ts +6 -5
  271. package/dist/plugins/shims.d.ts.map +1 -1
  272. package/dist/plugins/static-build.d.ts +5 -26
  273. package/dist/plugins/static-build.d.ts.map +1 -1
  274. package/dist/routing/codegen-shared.d.ts +63 -0
  275. package/dist/routing/codegen-shared.d.ts.map +1 -0
  276. package/dist/routing/codegen-types.d.ts +60 -0
  277. package/dist/routing/codegen-types.d.ts.map +1 -0
  278. package/dist/routing/codegen.d.ts +7 -2
  279. package/dist/routing/codegen.d.ts.map +1 -1
  280. package/dist/routing/convention-lint.d.ts +41 -0
  281. package/dist/routing/convention-lint.d.ts.map +1 -0
  282. package/dist/routing/index.d.ts +5 -1
  283. package/dist/routing/index.d.ts.map +1 -1
  284. package/dist/routing/index.js +4 -2
  285. package/dist/routing/link-codegen.d.ts +90 -0
  286. package/dist/routing/link-codegen.d.ts.map +1 -0
  287. package/dist/routing/scanner.d.ts +1 -10
  288. package/dist/routing/scanner.d.ts.map +1 -1
  289. package/dist/routing/segment-classify.d.ts +75 -0
  290. package/dist/routing/segment-classify.d.ts.map +1 -0
  291. package/dist/routing/segment-codegen.d.ts +38 -0
  292. package/dist/routing/segment-codegen.d.ts.map +1 -0
  293. package/dist/routing/types.d.ts +77 -25
  294. package/dist/routing/types.d.ts.map +1 -1
  295. package/dist/routing/walkers.d.ts +51 -0
  296. package/dist/routing/walkers.d.ts.map +1 -0
  297. package/dist/rsc-runtime/rsc.d.ts +1 -1
  298. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  299. package/dist/rsc-runtime/ssr.d.ts +12 -0
  300. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  301. package/dist/schema-bridge.d.ts +76 -0
  302. package/dist/schema-bridge.d.ts.map +1 -0
  303. package/dist/search-params/define.d.ts +157 -0
  304. package/dist/search-params/define.d.ts.map +1 -0
  305. package/dist/search-params/index.d.ts +4 -7
  306. package/dist/search-params/index.d.ts.map +1 -1
  307. package/dist/search-params/index.js +34 -441
  308. package/dist/search-params/index.js.map +1 -1
  309. package/dist/search-params/registry.d.ts +2 -2
  310. package/dist/search-params/registry.d.ts.map +1 -1
  311. package/dist/search-params/wrappers.d.ts +53 -0
  312. package/dist/search-params/wrappers.d.ts.map +1 -0
  313. package/dist/segment-params/define.d.ts +95 -0
  314. package/dist/segment-params/define.d.ts.map +1 -0
  315. package/dist/segment-params/index.d.ts +3 -0
  316. package/dist/segment-params/index.d.ts.map +1 -0
  317. package/dist/segment-params/index.js +2 -0
  318. package/dist/server/access-gate.d.ts +8 -3
  319. package/dist/server/access-gate.d.ts.map +1 -1
  320. package/dist/server/action-client.d.ts +41 -6
  321. package/dist/server/action-client.d.ts.map +1 -1
  322. package/dist/server/action-encryption.d.ts +76 -0
  323. package/dist/server/action-encryption.d.ts.map +1 -0
  324. package/dist/server/action-handler.d.ts +35 -1
  325. package/dist/server/action-handler.d.ts.map +1 -1
  326. package/dist/server/actions.d.ts +3 -6
  327. package/dist/server/actions.d.ts.map +1 -1
  328. package/dist/server/als-registry.d.ts +53 -5
  329. package/dist/server/als-registry.d.ts.map +1 -1
  330. package/dist/server/asset-headers.d.ts +1 -15
  331. package/dist/server/asset-headers.d.ts.map +1 -1
  332. package/dist/server/build-manifest.d.ts +2 -2
  333. package/dist/server/build-manifest.d.ts.map +1 -1
  334. package/dist/server/coalesce-tick.d.ts +40 -0
  335. package/dist/server/coalesce-tick.d.ts.map +1 -0
  336. package/dist/server/cookie-context.d.ts +170 -0
  337. package/dist/server/cookie-context.d.ts.map +1 -0
  338. package/dist/server/cookie-parsing.d.ts +51 -0
  339. package/dist/server/cookie-parsing.d.ts.map +1 -0
  340. package/dist/server/debug.d.ts +1 -1
  341. package/dist/server/default-logger.d.ts +22 -0
  342. package/dist/server/default-logger.d.ts.map +1 -0
  343. package/dist/server/deny-boundary.d.ts +90 -0
  344. package/dist/server/deny-boundary.d.ts.map +1 -0
  345. package/dist/server/deny-renderer.d.ts.map +1 -1
  346. package/dist/server/dev-source-map.d.ts +22 -0
  347. package/dist/server/dev-source-map.d.ts.map +1 -0
  348. package/dist/server/early-hints-sender.d.ts.map +1 -1
  349. package/dist/server/early-hints.d.ts +13 -5
  350. package/dist/server/early-hints.d.ts.map +1 -1
  351. package/dist/server/error-boundary-wrapper.d.ts +7 -1
  352. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  353. package/dist/server/fallback-error.d.ts +12 -7
  354. package/dist/server/fallback-error.d.ts.map +1 -1
  355. package/dist/server/flight-injection-state.d.ts +66 -0
  356. package/dist/server/flight-injection-state.d.ts.map +1 -0
  357. package/dist/server/flight-scripts.d.ts +42 -0
  358. package/dist/server/flight-scripts.d.ts.map +1 -0
  359. package/dist/server/flush.d.ts.map +1 -1
  360. package/dist/server/form-data.d.ts +29 -0
  361. package/dist/server/form-data.d.ts.map +1 -1
  362. package/dist/server/html-injector-core.d.ts +213 -0
  363. package/dist/server/html-injector-core.d.ts.map +1 -0
  364. package/dist/server/html-injectors.d.ts +81 -41
  365. package/dist/server/html-injectors.d.ts.map +1 -1
  366. package/dist/server/index.d.ts +10 -46
  367. package/dist/server/index.d.ts.map +1 -1
  368. package/dist/server/index.js +155 -2905
  369. package/dist/server/index.js.map +1 -1
  370. package/dist/server/internal.d.ts +48 -0
  371. package/dist/server/internal.d.ts.map +1 -0
  372. package/dist/server/internal.js +2947 -0
  373. package/dist/server/internal.js.map +1 -0
  374. package/dist/server/logger.d.ts +39 -7
  375. package/dist/server/logger.d.ts.map +1 -1
  376. package/dist/server/middleware-runner.d.ts +36 -4
  377. package/dist/server/middleware-runner.d.ts.map +1 -1
  378. package/dist/server/node-stream-transforms.d.ts +112 -0
  379. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  380. package/dist/server/param-coercion.d.ts +54 -0
  381. package/dist/server/param-coercion.d.ts.map +1 -0
  382. package/dist/server/pipeline-helpers.d.ts +95 -0
  383. package/dist/server/pipeline-helpers.d.ts.map +1 -0
  384. package/dist/server/pipeline-interception.d.ts +1 -1
  385. package/dist/server/pipeline-interception.d.ts.map +1 -1
  386. package/dist/server/pipeline-metadata.d.ts +6 -0
  387. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  388. package/dist/server/pipeline-outcome.d.ts +49 -0
  389. package/dist/server/pipeline-outcome.d.ts.map +1 -0
  390. package/dist/server/pipeline-phases.d.ts +52 -0
  391. package/dist/server/pipeline-phases.d.ts.map +1 -0
  392. package/dist/server/pipeline.d.ts +118 -23
  393. package/dist/server/pipeline.d.ts.map +1 -1
  394. package/dist/server/port-resolution.d.ts +117 -0
  395. package/dist/server/port-resolution.d.ts.map +1 -0
  396. package/dist/server/primitives.d.ts +69 -18
  397. package/dist/server/primitives.d.ts.map +1 -1
  398. package/dist/server/render-timeout.d.ts +51 -0
  399. package/dist/server/render-timeout.d.ts.map +1 -0
  400. package/dist/server/request-context.d.ts +62 -107
  401. package/dist/server/request-context.d.ts.map +1 -1
  402. package/dist/server/route-element-builder.d.ts +27 -1
  403. package/dist/server/route-element-builder.d.ts.map +1 -1
  404. package/dist/server/route-handler.d.ts.map +1 -1
  405. package/dist/server/route-matcher.d.ts +21 -34
  406. package/dist/server/route-matcher.d.ts.map +1 -1
  407. package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
  408. package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
  409. package/dist/server/rsc-entry/api-handler.d.ts +2 -2
  410. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  411. package/dist/server/rsc-entry/error-renderer.d.ts +26 -13
  412. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  413. package/dist/server/rsc-entry/helpers.d.ts +49 -6
  414. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  415. package/dist/server/rsc-entry/index.d.ts +19 -8
  416. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  417. package/dist/server/rsc-entry/render-route.d.ts +50 -0
  418. package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
  419. package/dist/server/rsc-entry/rsc-payload.d.ts +3 -3
  420. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  421. package/dist/server/rsc-entry/rsc-stream.d.ts +17 -1
  422. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  423. package/dist/server/rsc-entry/ssr-bridge.d.ts +1 -1
  424. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  425. package/dist/server/rsc-entry/ssr-renderer.d.ts +19 -4
  426. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  427. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +119 -0
  428. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
  429. package/dist/server/safe-load.d.ts +46 -0
  430. package/dist/server/safe-load.d.ts.map +1 -0
  431. package/dist/server/sensitive-fields.d.ts +74 -0
  432. package/dist/server/sensitive-fields.d.ts.map +1 -0
  433. package/dist/server/sitemap-generator.d.ts +129 -0
  434. package/dist/server/sitemap-generator.d.ts.map +1 -0
  435. package/dist/server/sitemap-handler.d.ts +22 -0
  436. package/dist/server/sitemap-handler.d.ts.map +1 -0
  437. package/dist/server/slot-resolver.d.ts +1 -1
  438. package/dist/server/slot-resolver.d.ts.map +1 -1
  439. package/dist/server/ssr-entry.d.ts +30 -0
  440. package/dist/server/ssr-entry.d.ts.map +1 -1
  441. package/dist/server/ssr-render.d.ts +39 -21
  442. package/dist/server/ssr-render.d.ts.map +1 -1
  443. package/dist/server/ssr-wrappers.d.ts +50 -0
  444. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  445. package/dist/server/state-tree-diff.d.ts.map +1 -1
  446. package/dist/server/status-code-resolver.d.ts +16 -11
  447. package/dist/server/status-code-resolver.d.ts.map +1 -1
  448. package/dist/server/stream-utils.d.ts +36 -0
  449. package/dist/server/stream-utils.d.ts.map +1 -0
  450. package/dist/server/tracing.d.ts +5 -5
  451. package/dist/server/tracing.d.ts.map +1 -1
  452. package/dist/server/tree-builder.d.ts +62 -30
  453. package/dist/server/tree-builder.d.ts.map +1 -1
  454. package/dist/server/tree-match.d.ts +41 -0
  455. package/dist/server/tree-match.d.ts.map +1 -0
  456. package/dist/server/types.d.ts +49 -4
  457. package/dist/server/types.d.ts.map +1 -1
  458. package/dist/server/utils/escape-html.d.ts +14 -0
  459. package/dist/server/utils/escape-html.d.ts.map +1 -0
  460. package/dist/server/version-skew.d.ts +61 -0
  461. package/dist/server/version-skew.d.ts.map +1 -0
  462. package/dist/shared/merge-search-params.d.ts +22 -0
  463. package/dist/shared/merge-search-params.d.ts.map +1 -0
  464. package/dist/shims/font-google.d.ts +1 -1
  465. package/dist/shims/font-google.d.ts.map +1 -1
  466. package/dist/shims/font-google.js +42 -0
  467. package/dist/shims/font-google.js.map +1 -0
  468. package/dist/shims/font-local.d.ts +26 -0
  469. package/dist/shims/font-local.d.ts.map +1 -0
  470. package/dist/shims/font-local.js +20 -0
  471. package/dist/shims/font-local.js.map +1 -0
  472. package/dist/shims/headers.d.ts +2 -1
  473. package/dist/shims/headers.d.ts.map +1 -1
  474. package/dist/shims/navigation-client.d.ts +3 -1
  475. package/dist/shims/navigation-client.d.ts.map +1 -1
  476. package/dist/shims/navigation.d.ts +11 -5
  477. package/dist/shims/navigation.d.ts.map +1 -1
  478. package/dist/utils/state-machine.d.ts +80 -0
  479. package/dist/utils/state-machine.d.ts.map +1 -0
  480. package/package.json +56 -16
  481. package/src/adapters/build-output-helper.ts +77 -0
  482. package/src/adapters/cloudflare-dev.ts +177 -0
  483. package/src/adapters/cloudflare-kv-cache.ts +142 -0
  484. package/src/adapters/cloudflare.ts +350 -76
  485. package/src/adapters/compress-module.ts +24 -4
  486. package/src/adapters/nitro.ts +142 -59
  487. package/src/adapters/shared.ts +40 -0
  488. package/src/adapters/wrangler.d.ts +7 -0
  489. package/src/cache/cache-api.ts +38 -0
  490. package/src/cache/handler-store.ts +68 -0
  491. package/src/cache/index.ts +81 -18
  492. package/src/cache/singleflight.ts +62 -4
  493. package/src/cache/sizeof.ts +33 -0
  494. package/src/cache/timber-cache.ts +25 -20
  495. package/src/cli-schema-sync.ts +207 -0
  496. package/src/cli.ts +65 -8
  497. package/src/client/browser-dev.ts +153 -1
  498. package/src/client/browser-entry/action-dispatch.ts +126 -0
  499. package/src/client/browser-entry/hmr.ts +81 -0
  500. package/src/client/browser-entry/hydrate.ts +145 -0
  501. package/src/client/browser-entry/index.ts +149 -0
  502. package/src/client/browser-entry/post-hydration.ts +119 -0
  503. package/src/client/browser-entry/router-init.ts +193 -0
  504. package/src/client/browser-entry/rsc-stream.ts +157 -0
  505. package/src/client/browser-entry/scroll.ts +27 -0
  506. package/src/client/error-boundary.tsx +99 -22
  507. package/src/client/error-reconstituter.tsx +65 -0
  508. package/src/client/form.tsx +31 -32
  509. package/src/client/history.ts +26 -4
  510. package/src/client/index.ts +69 -44
  511. package/src/client/internal.ts +58 -0
  512. package/src/client/link-pending-store.ts +111 -0
  513. package/src/client/link.tsx +366 -113
  514. package/src/client/nav-link-store.ts +47 -0
  515. package/src/client/navigation-api-types.ts +112 -0
  516. package/src/client/navigation-api.ts +332 -0
  517. package/src/client/navigation-context.ts +31 -6
  518. package/src/client/navigation-root.tsx +342 -0
  519. package/src/client/nuqs-adapter.tsx +16 -3
  520. package/src/client/router-ref.ts +1 -1
  521. package/src/client/router.ts +300 -73
  522. package/src/client/rsc-fetch.ts +112 -8
  523. package/src/client/segment-cache.ts +1 -1
  524. package/src/client/segment-outlet.tsx +86 -0
  525. package/src/client/ssr-data.ts +13 -5
  526. package/src/client/stale-reload.ts +72 -3
  527. package/src/client/state.ts +2 -2
  528. package/src/client/top-loader.tsx +18 -6
  529. package/src/client/use-cookie.ts +31 -2
  530. package/src/client/use-link-status.ts +7 -7
  531. package/src/client/{use-navigation-pending.ts → use-pending-navigation.ts} +6 -6
  532. package/src/client/use-query-states.ts +9 -3
  533. package/src/client/use-router.ts +1 -1
  534. package/src/client/{use-params.ts → use-segment-params.ts} +8 -6
  535. package/src/codec.ts +97 -0
  536. package/src/config-types.ts +292 -0
  537. package/src/config-validation.ts +303 -0
  538. package/src/content/index.ts +5 -13
  539. package/src/cookies/define-cookie.ts +233 -53
  540. package/src/cookies/index.ts +12 -1
  541. package/src/cookies/json-cookie.ts +105 -0
  542. package/src/cookies/validation.ts +134 -0
  543. package/src/dev-tools/404-page.ts +387 -0
  544. package/src/dev-tools/browser-logs.ts +291 -0
  545. package/src/dev-tools/error-page.ts +506 -0
  546. package/src/dev-tools/holding-server.ts +187 -0
  547. package/src/dev-tools/index.ts +90 -0
  548. package/src/dev-tools/instrumentation.ts +176 -0
  549. package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +9 -5
  550. package/src/dev-tools/overlay.ts +469 -0
  551. package/src/dev-tools/stack-classifier.ts +75 -0
  552. package/src/dev-tools/terminal.ts +183 -0
  553. package/src/{server/dev-warnings.ts → dev-tools/warnings.ts} +5 -50
  554. package/src/fonts/ast.ts +525 -16
  555. package/src/fonts/bundle.ts +142 -0
  556. package/src/fonts/dev-middleware.ts +74 -0
  557. package/src/fonts/local.ts +1 -1
  558. package/src/fonts/pipeline.ts +314 -0
  559. package/src/fonts/transform.ts +317 -0
  560. package/src/fonts/types.ts +50 -1
  561. package/src/fonts/virtual-modules.ts +233 -0
  562. package/src/index.ts +409 -357
  563. package/src/params/codec-registry.ts +34 -0
  564. package/src/params/define-schema.ts +73 -0
  565. package/src/params/index.ts +11 -0
  566. package/src/params/resolve-schema.ts +88 -0
  567. package/src/plugin-context.ts +240 -0
  568. package/src/plugins/adapter-build.ts +12 -4
  569. package/src/plugins/build-manifest.ts +13 -2
  570. package/src/plugins/build-report.ts +16 -25
  571. package/src/plugins/client-chunks.ts +65 -0
  572. package/src/plugins/content.ts +1 -1
  573. package/src/plugins/dev-server.ts +175 -35
  574. package/src/plugins/entries.ts +111 -9
  575. package/src/plugins/fonts.ts +157 -654
  576. package/src/plugins/mdx.ts +47 -10
  577. package/src/plugins/routing.ts +374 -45
  578. package/src/plugins/server-bundle.ts +32 -1
  579. package/src/plugins/shims.ts +136 -35
  580. package/src/plugins/static-build.ts +15 -89
  581. package/src/routing/codegen-shared.ts +109 -0
  582. package/src/routing/codegen-types.ts +61 -0
  583. package/src/routing/codegen.ts +269 -179
  584. package/src/routing/convention-lint.ts +357 -0
  585. package/src/routing/index.ts +5 -1
  586. package/src/routing/interception.ts +1 -1
  587. package/src/routing/link-codegen.ts +308 -0
  588. package/src/routing/scanner.ts +107 -110
  589. package/src/routing/segment-classify.ts +188 -0
  590. package/src/routing/segment-codegen.ts +98 -0
  591. package/src/routing/types.ts +78 -25
  592. package/src/routing/walkers.ts +90 -0
  593. package/src/rsc-runtime/rsc.ts +2 -0
  594. package/src/rsc-runtime/ssr.ts +50 -0
  595. package/src/rsc-runtime/vendor-types.d.ts +7 -0
  596. package/src/{search-params/codecs.ts → schema-bridge.ts} +57 -20
  597. package/src/search-params/define.ts +538 -0
  598. package/src/search-params/index.ts +14 -20
  599. package/src/search-params/registry.ts +2 -2
  600. package/src/search-params/wrappers.ts +92 -0
  601. package/src/segment-params/define.ts +336 -0
  602. package/src/segment-params/index.ts +9 -0
  603. package/src/server/access-gate.tsx +76 -34
  604. package/src/server/action-client.ts +88 -15
  605. package/src/server/action-encryption.ts +144 -0
  606. package/src/server/action-handler.ts +112 -14
  607. package/src/server/actions.ts +10 -9
  608. package/src/server/als-registry.ts +55 -7
  609. package/src/server/asset-headers.ts +8 -34
  610. package/src/server/build-manifest.ts +10 -4
  611. package/src/server/coalesce-tick.ts +75 -0
  612. package/src/server/compress.ts +25 -7
  613. package/src/server/cookie-context.ts +468 -0
  614. package/src/server/cookie-parsing.ts +135 -0
  615. package/src/server/debug.ts +1 -1
  616. package/src/server/default-logger.ts +99 -0
  617. package/src/server/deny-boundary.ts +218 -0
  618. package/src/server/deny-renderer.ts +31 -50
  619. package/src/server/dev-source-map.ts +31 -0
  620. package/src/server/early-hints-sender.ts +3 -2
  621. package/src/server/early-hints.ts +36 -15
  622. package/src/server/error-boundary-wrapper.ts +74 -22
  623. package/src/server/fallback-error.ts +74 -102
  624. package/src/server/flight-injection-state.ts +113 -0
  625. package/src/server/flight-scripts.ts +62 -0
  626. package/src/server/flush.ts +2 -1
  627. package/src/server/form-data.ts +76 -0
  628. package/src/server/html-injector-core.ts +417 -0
  629. package/src/server/html-injectors.ts +235 -223
  630. package/src/server/index.ts +29 -183
  631. package/src/server/internal.ts +176 -0
  632. package/src/server/logger.ts +67 -36
  633. package/src/server/middleware-runner.ts +75 -4
  634. package/src/server/node-stream-transforms.ts +361 -0
  635. package/src/server/param-coercion.ts +206 -0
  636. package/src/server/pipeline-helpers.ts +204 -0
  637. package/src/server/pipeline-interception.ts +17 -16
  638. package/src/server/pipeline-metadata.ts +13 -0
  639. package/src/server/pipeline-outcome.ts +176 -0
  640. package/src/server/pipeline-phases.ts +460 -0
  641. package/src/server/pipeline.ts +154 -394
  642. package/src/server/port-resolution.ts +215 -0
  643. package/src/server/primitives.ts +111 -28
  644. package/src/server/render-timeout.ts +108 -0
  645. package/src/server/request-context.ts +168 -333
  646. package/src/server/route-element-builder.ts +309 -195
  647. package/src/server/route-handler.ts +24 -4
  648. package/src/server/route-matcher.ts +50 -231
  649. package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
  650. package/src/server/rsc-entry/api-handler.ts +16 -17
  651. package/src/server/rsc-entry/error-renderer.ts +305 -89
  652. package/src/server/rsc-entry/helpers.ts +137 -12
  653. package/src/server/rsc-entry/index.ts +316 -352
  654. package/src/server/rsc-entry/render-route.ts +307 -0
  655. package/src/server/rsc-entry/rsc-payload.ts +65 -18
  656. package/src/server/rsc-entry/rsc-stream.ts +85 -13
  657. package/src/server/rsc-entry/ssr-bridge.ts +14 -5
  658. package/src/server/rsc-entry/ssr-renderer.ts +187 -38
  659. package/src/server/rsc-entry/wrap-action-dispatch.ts +449 -0
  660. package/src/server/safe-load.ts +60 -0
  661. package/src/server/sensitive-fields.ts +230 -0
  662. package/src/server/sitemap-generator.ts +338 -0
  663. package/src/server/sitemap-handler.ts +126 -0
  664. package/src/server/slot-resolver.ts +228 -246
  665. package/src/server/ssr-entry.ts +229 -32
  666. package/src/server/ssr-render.ts +289 -67
  667. package/src/server/ssr-wrappers.tsx +139 -0
  668. package/src/server/state-tree-diff.ts +4 -1
  669. package/src/server/status-code-resolver.ts +112 -128
  670. package/src/server/stream-utils.ts +213 -0
  671. package/src/server/tracing.ts +21 -10
  672. package/src/server/tree-builder.ts +202 -90
  673. package/src/server/tree-match.ts +198 -0
  674. package/src/server/types.ts +55 -6
  675. package/src/server/utils/escape-html.ts +20 -0
  676. package/src/server/version-skew.ts +104 -0
  677. package/src/shared/merge-search-params.ts +55 -0
  678. package/src/shims/font-google.ts +1 -1
  679. package/src/shims/font-local.ts +34 -0
  680. package/src/shims/headers.ts +5 -1
  681. package/src/shims/navigation-client.ts +4 -3
  682. package/src/shims/navigation.ts +14 -7
  683. package/src/utils/state-machine.ts +111 -0
  684. package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
  685. package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
  686. package/dist/_chunks/debug-gwlJkDuf.js +0 -108
  687. package/dist/_chunks/debug-gwlJkDuf.js.map +0 -1
  688. package/dist/_chunks/format-DviM89f0.js.map +0 -1
  689. package/dist/_chunks/interception-BOoWmLUA.js +0 -676
  690. package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
  691. package/dist/_chunks/request-context-DIkVh_jG.js +0 -330
  692. package/dist/_chunks/request-context-DIkVh_jG.js.map +0 -1
  693. package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
  694. package/dist/_chunks/tracing-CemImE6h.js +0 -187
  695. package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
  696. package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
  697. package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
  698. package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
  699. package/dist/cache/register-cached-function.d.ts +0 -17
  700. package/dist/cache/register-cached-function.d.ts.map +0 -1
  701. package/dist/client/browser-entry.d.ts +0 -21
  702. package/dist/client/browser-entry.d.ts.map +0 -1
  703. package/dist/client/link-status-provider.d.ts +0 -11
  704. package/dist/client/link-status-provider.d.ts.map +0 -1
  705. package/dist/client/transition-root.d.ts.map +0 -1
  706. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  707. package/dist/client/use-params.d.ts.map +0 -1
  708. package/dist/plugins/cache-transform.d.ts +0 -36
  709. package/dist/plugins/cache-transform.d.ts.map +0 -1
  710. package/dist/plugins/dev-error-overlay.d.ts +0 -60
  711. package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
  712. package/dist/plugins/dev-logs.d.ts.map +0 -1
  713. package/dist/plugins/dynamic-transform.d.ts +0 -72
  714. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  715. package/dist/plugins/server-action-exports.d.ts +0 -26
  716. package/dist/plugins/server-action-exports.d.ts.map +0 -1
  717. package/dist/routing/status-file-lint.d.ts +0 -33
  718. package/dist/routing/status-file-lint.d.ts.map +0 -1
  719. package/dist/search-params/analyze.d.ts +0 -54
  720. package/dist/search-params/analyze.d.ts.map +0 -1
  721. package/dist/search-params/builtin-codecs.d.ts +0 -105
  722. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  723. package/dist/search-params/codecs.d.ts +0 -53
  724. package/dist/search-params/codecs.d.ts.map +0 -1
  725. package/dist/search-params/create.d.ts +0 -106
  726. package/dist/search-params/create.d.ts.map +0 -1
  727. package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
  728. package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
  729. package/dist/server/dev-logger.d.ts.map +0 -1
  730. package/dist/server/dev-span-processor.d.ts.map +0 -1
  731. package/dist/server/dev-warnings.d.ts.map +0 -1
  732. package/dist/server/manifest-status-resolver.d.ts +0 -58
  733. package/dist/server/manifest-status-resolver.d.ts.map +0 -1
  734. package/dist/server/prerender.d.ts +0 -77
  735. package/dist/server/prerender.d.ts.map +0 -1
  736. package/dist/server/response-cache.d.ts +0 -54
  737. package/dist/server/response-cache.d.ts.map +0 -1
  738. package/dist/utils/directive-parser.d.ts +0 -70
  739. package/dist/utils/directive-parser.d.ts.map +0 -1
  740. package/src/cache/register-cached-function.ts +0 -103
  741. package/src/client/browser-entry.ts +0 -678
  742. package/src/client/link-status-provider.tsx +0 -30
  743. package/src/client/transition-root.tsx +0 -166
  744. package/src/plugins/cache-transform.ts +0 -199
  745. package/src/plugins/dev-error-overlay.ts +0 -230
  746. package/src/plugins/dynamic-transform.ts +0 -161
  747. package/src/plugins/server-action-exports.ts +0 -220
  748. package/src/routing/status-file-lint.ts +0 -112
  749. package/src/search-params/analyze.ts +0 -192
  750. package/src/search-params/builtin-codecs.ts +0 -228
  751. package/src/search-params/create.ts +0 -321
  752. package/src/server/dev-fetch-instrumentation.ts +0 -96
  753. package/src/server/dev-span-processor.ts +0 -78
  754. package/src/server/manifest-status-resolver.ts +0 -215
  755. package/src/server/prerender.ts +0 -139
  756. package/src/server/response-cache.ts +0 -410
  757. package/src/utils/directive-parser.ts +0 -529
  758. /package/src/{server/dev-logger.ts → dev-tools/logger.ts} +0 -0
@@ -0,0 +1,538 @@
1
+ /**
2
+ * defineSearchParams — factory for SearchParamsDefinition<T>.
3
+ *
4
+ * Creates a typed, composable definition for a route's search parameters.
5
+ * Accepts both SearchParamCodec values and Standard Schema objects (Zod,
6
+ * Valibot, ArkType) with auto-detection. Supports URL key aliasing via
7
+ * withUrlKey(), default-omission serialization, and composition via
8
+ * .extend() / .pick().
9
+ *
10
+ * Design doc: design/23-search-params.md §"defineSearchParams — The Factory"
11
+ */
12
+
13
+ import { useQueryStates as clientUseQueryStates } from '../client/use-query-states.js';
14
+ import { fromSchema, isStandardSchema, isCodec } from '../schema-bridge.js';
15
+ import type { StandardSchemaV1 } from '../schema-bridge.js';
16
+ import type { Codec } from '../codec.js';
17
+
18
+ // Server-only reference for .get() — avoids pulling server ALS into client bundles.
19
+ // In client environments, .get() throws before reaching this code path.
20
+ //
21
+ // IMPORTANT: This is set eagerly via _setGetSearchParamsFn() at server startup
22
+ // (called from request-context.ts module initialization). It must NOT use
23
+ // dynamic `await import()` at call time because the async microtask from the
24
+ // dynamic import loses AsyncLocalStorage context in React's RSC Flight renderer,
25
+ // breaking getSearchParams() in parallel slot pages. See TIM-523.
26
+ let _getSearchParamsFn: (() => URLSearchParams) | undefined;
27
+
28
+ /**
29
+ * Register the getSearchParams function. Called once at module load time
30
+ * from request-context.ts to avoid dynamic import at call time.
31
+ * @internal
32
+ */
33
+ export function _setGetSearchParamsFn(fn: () => URLSearchParams): void {
34
+ _getSearchParamsFn = fn;
35
+ }
36
+
37
+ function getSearchParamsFromAls(): URLSearchParams {
38
+ if (!_getSearchParamsFn) {
39
+ throw new Error(
40
+ '[timber] searchParams.get() is only available on the server. ' +
41
+ 'Use searchParams.useQueryStates() on the client.'
42
+ );
43
+ }
44
+ return _getSearchParamsFn();
45
+ }
46
+
47
+ // ---------------------------------------------------------------------------
48
+ // Types
49
+ // ---------------------------------------------------------------------------
50
+
51
+ /**
52
+ * A codec that converts between URL string values and typed values.
53
+ *
54
+ * nuqs parsers implement this interface natively — no adapter needed.
55
+ * Standard Schema objects (Zod, Valibot, ArkType) are auto-detected
56
+ * by defineSearchParams and wrapped via fromSchema.
57
+ */
58
+ export interface SearchParamCodec<T> extends Codec<T> {
59
+ /** Optional URL key alias, set by withUrlKey(). */
60
+ urlKey?: string;
61
+ }
62
+
63
+ /** A codec with a URL key alias attached via withUrlKey(). */
64
+ export interface SearchParamCodecWithUrlKey<T> extends SearchParamCodec<T> {
65
+ urlKey: string;
66
+ }
67
+
68
+ /** Infer the output type of a codec. */
69
+ export type InferCodec<C> = C extends SearchParamCodec<infer T> ? T : never;
70
+
71
+ /** Map of property names to codecs. */
72
+ export type CodecMap<T extends Record<string, unknown>> = {
73
+ [K in keyof T]: SearchParamCodec<T[K]>;
74
+ };
75
+
76
+ /** Options for useQueryStates setter. */
77
+ export interface SetParamsOptions {
78
+ /** Update URL without server roundtrip (default: false). */
79
+ shallow?: boolean;
80
+ /** Scroll to top after update (default: true). */
81
+ scroll?: boolean;
82
+ /** 'push' (default) or 'replace' for history state. */
83
+ history?: 'push' | 'replace';
84
+ }
85
+
86
+ /** Setter function returned by useQueryStates. */
87
+ export type SetParams<T> = (values: Partial<T>, options?: SetParamsOptions) => void;
88
+
89
+ /** Options for useQueryStates hook. */
90
+ export interface QueryStatesOptions {
91
+ /** Update URL without server roundtrip (default: false). */
92
+ shallow?: boolean;
93
+ /** Scroll to top after update (default: true). */
94
+ scroll?: boolean;
95
+ /** 'push' (default) or 'replace' for history state. */
96
+ history?: 'push' | 'replace';
97
+ }
98
+
99
+ /**
100
+ * A fully typed, composable search params definition.
101
+ *
102
+ * Returned by defineSearchParams(). Carries a phantom _type property
103
+ * for build-time type extraction.
104
+ */
105
+ export interface SearchParamsDefinition<T extends Record<string, unknown>> {
106
+ /** Parse raw URL search params into typed values. */
107
+ parse(raw: URLSearchParams | Record<string, string | string[] | undefined>): T;
108
+ /** Parse a Promise of URLSearchParams (e.g., from the ALS `searchParams()` API). */
109
+ parse(raw: Promise<URLSearchParams | Record<string, string | string[] | undefined>>): Promise<T>;
110
+
111
+ /**
112
+ * Get typed search params from the current request context (ALS-backed).
113
+ *
114
+ * Server-only, sync. Reads getSearchParams() from ALS and parses through codecs.
115
+ * Throws on client.
116
+ *
117
+ * ```tsx
118
+ * // app/products/page.tsx
119
+ * import { searchParams } from './params'
120
+ * export default function Page() {
121
+ * const { page, category } = searchParams.get()
122
+ * }
123
+ * ```
124
+ */
125
+ get(): T;
126
+
127
+ /** Client hook — reads current URL params and returns typed values + setter. */
128
+ useQueryStates(options?: QueryStatesOptions): [T, SetParams<T>];
129
+
130
+ /** Extend with additional codecs or Standard Schema objects. */
131
+ extend<U extends Record<string, SearchParamCodec<unknown> | StandardSchemaV1<unknown>>>(
132
+ codecs: U
133
+ ): SearchParamsDefinition<T & { [K in keyof U]: InferField<U[K]> }>;
134
+
135
+ /** Pick a subset of keys. Preserves codecs and aliases. */
136
+ pick<K extends keyof T & string>(...keys: K[]): SearchParamsDefinition<Pick<T, K>>;
137
+
138
+ /** Serialize values to a query string (no leading '?'), omitting defaults. */
139
+ serialize(values: Partial<T>): string;
140
+
141
+ /** Build a full path with query string, omitting defaults. */
142
+ href(pathname: string, values: Partial<T>): string;
143
+
144
+ /** Build a URLSearchParams instance, omitting defaults. */
145
+ toSearchParams(values: Partial<T>): URLSearchParams;
146
+
147
+ /** Read-only codec map for spreading into .extend(). */
148
+ codecs: { [K in keyof T]: SearchParamCodec<T[K]> };
149
+
150
+ /** Read-only URL key alias map. Maps property names to URL query parameter keys. */
151
+ readonly urlKeys: Readonly<Record<string, string>>;
152
+
153
+ /**
154
+ * Phantom property for build-time type extraction.
155
+ * Never set at runtime — exists only in the type system.
156
+ */
157
+ readonly _type?: T;
158
+ }
159
+
160
+ // StandardSchemaV1 is imported from schema-bridge.ts — single source of truth.
161
+ // Re-export for consumers that import it from this module.
162
+ export type { StandardSchemaV1 } from '../schema-bridge.js';
163
+
164
+ // ---------------------------------------------------------------------------
165
+ // Type-level helpers
166
+ // ---------------------------------------------------------------------------
167
+
168
+ /** Infer the output type from either a SearchParamCodec or a StandardSchemaV1. */
169
+ export type InferField<V> =
170
+ V extends SearchParamCodec<infer T> ? T : V extends StandardSchemaV1<infer T> ? T : never;
171
+
172
+ /** Acceptable field value for defineSearchParams: a codec or a Standard Schema. */
173
+ export type SearchParamField<T = unknown> = SearchParamCodec<T> | StandardSchemaV1<T>;
174
+
175
+ // ---------------------------------------------------------------------------
176
+ // Internal helpers
177
+ // ---------------------------------------------------------------------------
178
+
179
+ /**
180
+ * Convert URLSearchParams or a plain record to a normalized record
181
+ * where repeated keys produce arrays.
182
+ */
183
+ function normalizeRaw(
184
+ raw: URLSearchParams | Record<string, string | string[] | undefined>
185
+ ): Record<string, string | string[] | undefined> {
186
+ if (raw instanceof URLSearchParams) {
187
+ const result: Record<string, string | string[] | undefined> = {};
188
+ for (const key of new Set(raw.keys())) {
189
+ const values = raw.getAll(key);
190
+ result[key] = values.length === 1 ? values[0] : values;
191
+ }
192
+ return result;
193
+ }
194
+ return raw;
195
+ }
196
+
197
+ /**
198
+ * Compute the serialized default value for a codec. Used for
199
+ * default-omission: when serialize(value) === serialize(parse(undefined)),
200
+ * the field is omitted from the URL.
201
+ */
202
+ function getDefaultSerialized<T>(codec: SearchParamCodec<T>): string | null {
203
+ return codec.serialize(codec.parse(undefined));
204
+ }
205
+
206
+ // isStandardSchema and isCodec are imported from schema-bridge.ts.
207
+
208
+ /**
209
+ * Resolve a field value to a SearchParamCodec. Auto-detects Standard Schema
210
+ * objects and wraps them with fromSchema. Reads .urlKey from codecs.
211
+ */
212
+ function resolveField(
213
+ fieldName: string,
214
+ value: SearchParamField
215
+ ): { codec: SearchParamCodec<unknown>; urlKey?: string } {
216
+ // Check for codec first (codecs may also have '~standard' if they're nuqs parsers)
217
+ if (isCodec(value)) {
218
+ return { codec: value, urlKey: value.urlKey };
219
+ }
220
+
221
+ // Auto-detect Standard Schema
222
+ if (isStandardSchema(value)) {
223
+ return { codec: fromSchema(value) };
224
+ }
225
+
226
+ throw new Error(
227
+ `[timber] defineSearchParams: field '${fieldName}' is not a valid codec or Standard Schema. ` +
228
+ `Expected an object with { parse, serialize } methods, or a Standard Schema object ` +
229
+ `(Zod, Valibot, ArkType).`
230
+ );
231
+ }
232
+
233
+ /**
234
+ * Validate that all codecs handle absent params (parse(undefined) doesn't throw).
235
+ * Catches schemas that throw on missing input. `undefined` and `null` are both
236
+ * valid defaults — `undefined` is correct for optional fields (e.g., `z.string().optional()`).
237
+ */
238
+ function validateDefaults(codecMap: Record<string, SearchParamCodec<unknown>>): void {
239
+ for (const [key, codec] of Object.entries(codecMap)) {
240
+ try {
241
+ codec.parse(undefined);
242
+ } catch {
243
+ throw new Error(
244
+ `[timber] defineSearchParams: field '${key}' throws when the param is absent.\n` +
245
+ ` Search params are optional — the URL might not contain ?${key}=anything.\n` +
246
+ ` Add .default() or .optional() to your schema, or wrap with withDefault().`
247
+ );
248
+ }
249
+ }
250
+ }
251
+
252
+ // ---------------------------------------------------------------------------
253
+ // Factory
254
+ // ---------------------------------------------------------------------------
255
+
256
+ /**
257
+ * Create a SearchParamsDefinition from a map of codecs and/or Standard Schema
258
+ * objects. Accepts both SearchParamCodec values and raw Zod/Valibot/ArkType
259
+ * schemas with auto-detection.
260
+ *
261
+ * ```ts
262
+ * import { defineSearchParams, withDefault, withUrlKey } from '@timber-js/app/search-params'
263
+ * import { parseAsString, parseAsStringEnum } from 'nuqs'
264
+ * import { z } from 'zod/v4'
265
+ *
266
+ * export const searchParams = defineSearchParams({
267
+ * page: z.coerce.number().int().min(1).default(1), // Standard Schema — auto-wrapped
268
+ * q: withUrlKey(parseAsString, 'search'), // nuqs codec with URL alias
269
+ * sort: withDefault(parseAsStringEnum(['price', 'name']), 'price'),
270
+ * })
271
+ * ```
272
+ */
273
+ /**
274
+ * Overload: accept a Standard Schema object schema (e.g., z.object({...})).
275
+ *
276
+ * The schema must have a `.shape` property whose values are themselves
277
+ * Standard Schema objects. Each shape property becomes a field codec
278
+ * via fromSchema().
279
+ *
280
+ * ```ts
281
+ * const searchParams = defineSearchParams(
282
+ * z.object({ page: z.coerce.number().default(1), q: z.string().optional() })
283
+ * )
284
+ * ```
285
+ */
286
+ export function defineSearchParams<T extends Record<string, unknown>>(
287
+ schema: StandardSchemaV1<T> & { shape: Record<string, StandardSchemaV1<unknown>> }
288
+ ): SearchParamsDefinition<T>;
289
+
290
+ /**
291
+ * Overload: accept a map of codecs and/or Standard Schema objects.
292
+ */
293
+ export function defineSearchParams<C extends Record<string, SearchParamField>>(
294
+ codecs: C
295
+ ): SearchParamsDefinition<{ [K in keyof C]: InferField<C[K]> }>;
296
+
297
+ export function defineSearchParams(
298
+ codecsOrSchema:
299
+ | Record<string, SearchParamField>
300
+ | (StandardSchemaV1<unknown> & { shape: Record<string, StandardSchemaV1<unknown>> })
301
+ ): SearchParamsDefinition<Record<string, unknown>> {
302
+ // Detect Standard Schema object with .shape (e.g., z.object(...))
303
+ if (isStandardSchema(codecsOrSchema) && hasShape(codecsOrSchema)) {
304
+ const fieldCodecs: Record<string, SearchParamField> = {};
305
+ for (const [key, fieldSchema] of Object.entries(codecsOrSchema.shape)) {
306
+ if (isStandardSchema(fieldSchema)) {
307
+ fieldCodecs[key] = fieldSchema;
308
+ } else {
309
+ throw new Error(
310
+ `[timber] defineSearchParams: field '${key}' in schema.shape is not a Standard Schema. ` +
311
+ `All shape properties must be Standard Schema objects (Zod, Valibot, ArkType).`
312
+ );
313
+ }
314
+ }
315
+ return defineSearchParamsFromMap(fieldCodecs);
316
+ }
317
+
318
+ return defineSearchParamsFromMap(codecsOrSchema as Record<string, SearchParamField>);
319
+ }
320
+
321
+ /** Check if a schema has a .shape property with object-type values. */
322
+ function hasShape(schema: unknown): schema is { shape: Record<string, unknown> } {
323
+ return (
324
+ typeof schema === 'object' &&
325
+ schema !== null &&
326
+ 'shape' in schema &&
327
+ typeof (schema as { shape: unknown }).shape === 'object' &&
328
+ (schema as { shape: unknown }).shape !== null
329
+ );
330
+ }
331
+
332
+ function defineSearchParamsFromMap(
333
+ codecs: Record<string, SearchParamField>
334
+ ): SearchParamsDefinition<Record<string, unknown>> {
335
+ const resolvedCodecs: Record<string, SearchParamCodec<unknown>> = {};
336
+ const urlKeys: Record<string, string> = {};
337
+
338
+ for (const [key, value] of Object.entries(codecs)) {
339
+ const resolved = resolveField(key, value as SearchParamField);
340
+ resolvedCodecs[key] = resolved.codec;
341
+ if (resolved.urlKey) {
342
+ urlKeys[key] = resolved.urlKey;
343
+ }
344
+ }
345
+
346
+ // Validate that all codecs handle absent params
347
+ validateDefaults(resolvedCodecs);
348
+
349
+ return buildDefinition(resolvedCodecs as unknown as CodecMap<Record<string, unknown>>, urlKeys);
350
+ }
351
+
352
+ // ---------------------------------------------------------------------------
353
+ // Internal: build the definition object
354
+ // ---------------------------------------------------------------------------
355
+
356
+ /**
357
+ * Internal: build a SearchParamsDefinition from a typed codec map and url keys.
358
+ */
359
+ function buildDefinition<T extends Record<string, unknown>>(
360
+ codecMap: CodecMap<T>,
361
+ urlKeys: Record<string, string>
362
+ ): SearchParamsDefinition<T> {
363
+ // Pre-compute default serialized values for omission check
364
+ const defaultSerialized: Record<string, string | null> = {};
365
+ for (const key of Object.keys(codecMap)) {
366
+ defaultSerialized[key] = getDefaultSerialized(codecMap[key as keyof T]);
367
+ }
368
+
369
+ function getUrlKey(prop: string): string {
370
+ return urlKeys[prop] ?? prop;
371
+ }
372
+
373
+ // ---- parse ----
374
+ function parseSync(raw: URLSearchParams | Record<string, string | string[] | undefined>): T {
375
+ const normalized = normalizeRaw(raw);
376
+ const result: Record<string, unknown> = {};
377
+
378
+ for (const prop of Object.keys(codecMap)) {
379
+ const urlKey = getUrlKey(prop);
380
+ const rawValue = normalized[urlKey];
381
+ result[prop] = (codecMap[prop as keyof T] as SearchParamCodec<unknown>).parse(rawValue);
382
+ }
383
+
384
+ return result as T;
385
+ }
386
+
387
+ // Overloaded parse: sync when given raw params, async when given a Promise.
388
+ // This enables the ergonomic pattern: await def.parse(searchParams())
389
+ function parse(raw: URLSearchParams | Record<string, string | string[] | undefined>): T;
390
+ function parse(
391
+ raw: Promise<URLSearchParams | Record<string, string | string[] | undefined>>
392
+ ): Promise<T>;
393
+ function parse(
394
+ raw:
395
+ | URLSearchParams
396
+ | Record<string, string | string[] | undefined>
397
+ | Promise<URLSearchParams | Record<string, string | string[] | undefined>>
398
+ ): T | Promise<T> {
399
+ if (raw instanceof Promise) {
400
+ return raw.then(parseSync);
401
+ }
402
+ return parseSync(raw);
403
+ }
404
+
405
+ // ---- serialize ----
406
+ function serialize(values: Partial<T>): string {
407
+ const parts: string[] = [];
408
+
409
+ for (const prop of Object.keys(codecMap)) {
410
+ if (!(prop in values)) continue;
411
+ const codec = codecMap[prop as keyof T] as SearchParamCodec<unknown>;
412
+ const serialized = codec.serialize(values[prop as keyof T] as unknown);
413
+
414
+ // Omit if serialized value matches the default
415
+ if (serialized === defaultSerialized[prop]) continue;
416
+ if (serialized === null) continue;
417
+
418
+ parts.push(`${encodeURIComponent(getUrlKey(prop))}=${encodeURIComponent(serialized)}`);
419
+ }
420
+
421
+ return parts.join('&');
422
+ }
423
+
424
+ // ---- href ----
425
+ function href(pathname: string, values: Partial<T>): string {
426
+ const qs = serialize(values);
427
+ return qs ? `${pathname}?${qs}` : pathname;
428
+ }
429
+
430
+ // ---- toSearchParams ----
431
+ function toSearchParams(values: Partial<T>): URLSearchParams {
432
+ const usp = new URLSearchParams();
433
+
434
+ for (const prop of Object.keys(codecMap)) {
435
+ if (!(prop in values)) continue;
436
+ const codec = codecMap[prop as keyof T] as SearchParamCodec<unknown>;
437
+ const serialized = codec.serialize(values[prop as keyof T] as unknown);
438
+
439
+ if (serialized === defaultSerialized[prop]) continue;
440
+ if (serialized === null) continue;
441
+
442
+ usp.set(getUrlKey(prop), serialized);
443
+ }
444
+
445
+ return usp;
446
+ }
447
+
448
+ // ---- extend ----
449
+ function extend<U extends Record<string, SearchParamCodec<unknown> | StandardSchemaV1<unknown>>>(
450
+ newCodecs: U
451
+ ): SearchParamsDefinition<T & { [K in keyof U]: InferField<U[K]> }> {
452
+ type Combined = T & { [K in keyof U]: InferField<U[K]> };
453
+
454
+ // Resolve any Standard Schema objects in the extension
455
+ const resolvedNewCodecs: Record<string, SearchParamCodec<unknown>> = {};
456
+ const newUrlKeys: Record<string, string> = {};
457
+ for (const [key, value] of Object.entries(newCodecs)) {
458
+ const resolved = resolveField(key, value as SearchParamField);
459
+ resolvedNewCodecs[key] = resolved.codec;
460
+ if (resolved.urlKey) {
461
+ newUrlKeys[key] = resolved.urlKey;
462
+ }
463
+ }
464
+
465
+ const combinedCodecs = {
466
+ ...codecMap,
467
+ ...resolvedNewCodecs,
468
+ } as unknown as CodecMap<Combined>;
469
+
470
+ // Merge URL keys: base keys + new codec urlKeys from withUrlKey
471
+ const combinedUrlKeys: Record<string, string> = { ...urlKeys, ...newUrlKeys };
472
+
473
+ return buildDefinition<Combined>(combinedCodecs, combinedUrlKeys);
474
+ }
475
+
476
+ // ---- pick ----
477
+ function pick<K extends keyof T & string>(...keys: K[]): SearchParamsDefinition<Pick<T, K>> {
478
+ const pickedCodecs: Record<string, SearchParamCodec<unknown>> = {};
479
+ const pickedUrlKeys: Record<string, string> = {};
480
+
481
+ for (const key of keys) {
482
+ pickedCodecs[key] = codecMap[key] as SearchParamCodec<unknown>;
483
+ if (key in urlKeys) {
484
+ pickedUrlKeys[key] = urlKeys[key];
485
+ }
486
+ }
487
+
488
+ return buildDefinition<Pick<T, K>>(
489
+ pickedCodecs as unknown as CodecMap<Pick<T, K>>,
490
+ pickedUrlKeys
491
+ );
492
+ }
493
+
494
+ // ---- useQueryStates ----
495
+ // Delegates to the 'use client' implementation from use-query-states.ts.
496
+ //
497
+ // In the RSC environment: use-query-states.ts is transformed by the RSC
498
+ // plugin into a client reference proxy. Calling it throws — correct,
499
+ // because hooks can't run during server component rendering.
500
+ // In SSR: use-query-states.ts is the real nuqs-backed function. Hooks
501
+ // work during SSR's renderToReadableStream, so this works correctly.
502
+ // On the client: same as SSR — the real function is available.
503
+ function useQueryStates(options?: QueryStatesOptions): [T, SetParams<T>] {
504
+ return clientUseQueryStates(codecMap, options, Object.freeze({ ...urlKeys })) as [
505
+ T,
506
+ SetParams<T>,
507
+ ];
508
+ }
509
+
510
+ // ---- get ----
511
+ // ALS-backed: reads getSearchParams() from the current request context
512
+ // and parses through codecs. Server-only, sync.
513
+ function get(): T {
514
+ if (typeof window !== 'undefined') {
515
+ throw new Error(
516
+ '[timber] searchParams.get() is server-only. ' +
517
+ 'Use searchParams.useQueryStates() on the client.'
518
+ );
519
+ }
520
+ const raw = getSearchParamsFromAls();
521
+ return parseSync(raw);
522
+ }
523
+
524
+ const definition: SearchParamsDefinition<T> = {
525
+ parse,
526
+ get,
527
+ useQueryStates,
528
+ extend,
529
+ pick,
530
+ serialize,
531
+ href,
532
+ toSearchParams,
533
+ codecs: codecMap,
534
+ urlKeys: Object.freeze({ ...urlKeys }),
535
+ };
536
+
537
+ return definition;
538
+ }
@@ -1,34 +1,28 @@
1
1
  // @timber-js/app/search-params — Typed search params
2
2
 
3
+ // Codec is the canonical home for the Codec type — import from
4
+ // @timber-js/app/codec. Re-export removed per TIM-721.
5
+
3
6
  // Core types and factory
4
7
  export type {
5
8
  SearchParamCodec,
9
+ SearchParamCodecWithUrlKey,
6
10
  InferCodec,
11
+ InferField,
12
+ CodecMap,
7
13
  SearchParamsDefinition,
8
14
  SetParams,
9
15
  SetParamsOptions,
10
16
  QueryStatesOptions,
11
- SearchParamsOptions,
12
- } from './create.js';
13
- export { createSearchParams } from './create.js';
17
+ StandardSchemaV1,
18
+ } from './define.js';
19
+ export { defineSearchParams } from './define.js';
14
20
 
15
- // Codec bridges
16
- export { fromSchema, fromArraySchema } from './codecs.js';
21
+ // Codec bridges moved to @timber-js/app/codec
22
+ // Import fromSchema / fromArraySchema from '@timber-js/app/codec' instead.
17
23
 
18
- // Built-in codecs
19
- export {
20
- parseAsString,
21
- parseAsInteger,
22
- parseAsFloat,
23
- parseAsBoolean,
24
- parseAsStringEnum,
25
- parseAsStringLiteral,
26
- withDefault,
27
- } from './builtin-codecs.js';
24
+ // Codec wrappers
25
+ export { withDefault, withUrlKey } from './wrappers.js';
28
26
 
29
27
  // Runtime registry (route-scoped useQueryStates)
30
- export { registerSearchParams, getSearchParams } from './registry.js';
31
-
32
- // Static analysis (build-time only)
33
- export type { AnalyzeResult, AnalyzeError } from './analyze.js';
34
- export { analyzeSearchParams, formatAnalyzeError } from './analyze.js';
28
+ export { registerSearchParams, getSearchParamsDefinition } from './registry.js';
@@ -7,7 +7,7 @@
7
7
  * Design doc: design/23-search-params.md §"Runtime: Registration at Route Load"
8
8
  */
9
9
 
10
- import type { SearchParamsDefinition } from './create.js';
10
+ import type { SearchParamsDefinition } from './define.js';
11
11
 
12
12
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
13
  const registry = new Map<string, SearchParamsDefinition<any>>();
@@ -26,6 +26,6 @@ export function registerSearchParams(route: string, definition: SearchParamsDefi
26
26
  * Returns undefined if the route hasn't been loaded yet.
27
27
  */
28
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- export function getSearchParams(route: string): SearchParamsDefinition<any> | undefined {
29
+ export function getSearchParamsDefinition(route: string): SearchParamsDefinition<any> | undefined {
30
30
  return registry.get(route);
31
31
  }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Codec wrappers — withDefault and withUrlKey.
3
+ *
4
+ * These are timber-specific utilities that work with any SearchParamCodec.
5
+ * For actual codecs (string, integer, boolean, etc.), use nuqs parsers
6
+ * or Standard Schema objects (Zod, Valibot, ArkType) with auto-detection.
7
+ *
8
+ * Design doc: design/23-search-params.md
9
+ */
10
+
11
+ import type { SearchParamCodec, SearchParamCodecWithUrlKey, SearchParamField } from './define.js';
12
+ import { isCodec, isStandardSchema, fromSchema } from '../schema-bridge.js';
13
+
14
+ // ---------------------------------------------------------------------------
15
+ // withDefault
16
+ // ---------------------------------------------------------------------------
17
+
18
+ /**
19
+ * Wrap a nullable codec with a default value. When the inner codec returns
20
+ * null, the default is used instead. The output type becomes non-nullable.
21
+ *
22
+ * Works with any codec — nuqs parsers, custom codecs, fromSchema results.
23
+ *
24
+ * ```ts
25
+ * import { parseAsInteger } from 'nuqs'
26
+ * import { withDefault } from '@timber-js/app/search-params'
27
+ *
28
+ * const page = withDefault(parseAsInteger, 1)
29
+ * // page.parse(undefined) → 1 (not null)
30
+ * // page.parse('5') → 5
31
+ * ```
32
+ */
33
+ export function withDefault<T>(
34
+ codec: SearchParamCodec<T | null>,
35
+ defaultValue: T
36
+ ): SearchParamCodec<T> {
37
+ return {
38
+ parse(value: string | string[] | undefined): T {
39
+ const result = codec.parse(value);
40
+ return result === null ? defaultValue : result;
41
+ },
42
+ serialize(value: T): string | null {
43
+ return codec.serialize(value);
44
+ },
45
+ };
46
+ }
47
+
48
+ // ---------------------------------------------------------------------------
49
+ // withUrlKey
50
+ // ---------------------------------------------------------------------------
51
+
52
+ /**
53
+ * Attach a URL key alias to a codec. The alias determines what query
54
+ * parameter key is used in the URL, while the TypeScript property name
55
+ * stays descriptive.
56
+ *
57
+ * Aliases travel with codecs through object spread composition — when
58
+ * you spread a bundle containing aliased codecs into defineSearchParams,
59
+ * the aliases come along automatically.
60
+ *
61
+ * ```ts
62
+ * import { parseAsString } from 'nuqs'
63
+ * import { withUrlKey } from '@timber-js/app/search-params'
64
+ *
65
+ * export const searchable = {
66
+ * q: withUrlKey(parseAsString, 'search'),
67
+ * // ?search=shoes → { q: 'shoes' }
68
+ * }
69
+ * ```
70
+ *
71
+ * Composes with withDefault:
72
+ * ```ts
73
+ * import { parseAsInteger } from 'nuqs'
74
+ * withUrlKey(withDefault(parseAsInteger, 1), 'p')
75
+ * ```
76
+ */
77
+ export function withUrlKey<T>(
78
+ codecOrSchema: SearchParamField<T>,
79
+ urlKey: string
80
+ ): SearchParamCodecWithUrlKey<T> {
81
+ // Auto-detect Standard Schema (Zod, Valibot, ArkType) and wrap
82
+ const codec: SearchParamCodec<T> = isCodec(codecOrSchema)
83
+ ? codecOrSchema
84
+ : isStandardSchema(codecOrSchema)
85
+ ? fromSchema(codecOrSchema)
86
+ : (codecOrSchema as SearchParamCodec<T>);
87
+ return {
88
+ parse: codec.parse.bind(codec),
89
+ serialize: codec.serialize.bind(codec),
90
+ urlKey,
91
+ };
92
+ }