@timber-js/app 0.2.0-alpha.13 → 0.2.0-alpha.131

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 (785) hide show
  1. package/LICENSE +8 -0
  2. package/dist/_chunks/actions-BNhpxrnV.js +1104 -0
  3. package/dist/_chunks/actions-BNhpxrnV.js.map +1 -0
  4. package/dist/_chunks/build-output-helper-K7oUCRqU.js +102 -0
  5. package/dist/_chunks/build-output-helper-K7oUCRqU.js.map +1 -0
  6. package/dist/_chunks/cli-schema-sync-CObqjGWF.js +2 -0
  7. package/dist/_chunks/cli-schema-sync-q-Ce6-iG.js +785 -0
  8. package/dist/_chunks/cli-schema-sync-q-Ce6-iG.js.map +1 -0
  9. package/dist/_chunks/codec-registry-DqkeAydt.js +21 -0
  10. package/dist/_chunks/codec-registry-DqkeAydt.js.map +1 -0
  11. package/dist/_chunks/define-DMq-Yjp7.js +112 -0
  12. package/dist/_chunks/define-DMq-Yjp7.js.map +1 -0
  13. package/dist/_chunks/define-jeHDXZGq.js +195 -0
  14. package/dist/_chunks/define-jeHDXZGq.js.map +1 -0
  15. package/dist/_chunks/format-BjN9HLu9.js +14 -0
  16. package/dist/_chunks/format-BjN9HLu9.js.map +1 -0
  17. package/dist/_chunks/handler-store-bIAstrxQ.js +54 -0
  18. package/dist/_chunks/handler-store-bIAstrxQ.js.map +1 -0
  19. package/dist/_chunks/logger-CMd9P1xQ.js +291 -0
  20. package/dist/_chunks/logger-CMd9P1xQ.js.map +1 -0
  21. package/dist/_chunks/merge-search-params-Cm1j99HC.js +41 -0
  22. package/dist/_chunks/merge-search-params-Cm1j99HC.js.map +1 -0
  23. package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → metadata-routes-DESG8uk5.js} +32 -19
  24. package/dist/_chunks/metadata-routes-DESG8uk5.js.map +1 -0
  25. package/dist/_chunks/navigation-root-B5-RmsPi.js +103 -0
  26. package/dist/_chunks/navigation-root-B5-RmsPi.js.map +1 -0
  27. package/dist/_chunks/registry-BI9cgCt7.js +20 -0
  28. package/dist/_chunks/registry-BI9cgCt7.js.map +1 -0
  29. package/dist/_chunks/resolve-schema-DU2nbVOi.js +77 -0
  30. package/dist/_chunks/resolve-schema-DU2nbVOi.js.map +1 -0
  31. package/dist/_chunks/router-ref-B2-2kIIC.js +28 -0
  32. package/dist/_chunks/router-ref-B2-2kIIC.js.map +1 -0
  33. package/dist/_chunks/schema-bridge-o0SwFtXW.js +86 -0
  34. package/dist/_chunks/schema-bridge-o0SwFtXW.js.map +1 -0
  35. package/dist/_chunks/segment-classify-BjfuctV2.js +137 -0
  36. package/dist/_chunks/segment-classify-BjfuctV2.js.map +1 -0
  37. package/dist/_chunks/segment-context-Bg0pFbLT.js +34 -0
  38. package/dist/_chunks/segment-context-Bg0pFbLT.js.map +1 -0
  39. package/dist/_chunks/{ssr-data-MjmprTmO.js → ssr-data-DVX8S7vj.js} +1 -1
  40. package/dist/_chunks/ssr-data-DVX8S7vj.js.map +1 -0
  41. package/dist/_chunks/stale-reload-CCqb62Z3.js +84 -0
  42. package/dist/_chunks/stale-reload-CCqb62Z3.js.map +1 -0
  43. package/dist/_chunks/tracing-DP5djRq5.js +358 -0
  44. package/dist/_chunks/tracing-DP5djRq5.js.map +1 -0
  45. package/dist/_chunks/{use-query-states-D5KaffOK.js → use-query-states-C9G6LP0F.js} +7 -20
  46. package/dist/_chunks/use-query-states-C9G6LP0F.js.map +1 -0
  47. package/dist/_chunks/use-segment-params-CIeinIx2.js +151 -0
  48. package/dist/_chunks/use-segment-params-CIeinIx2.js.map +1 -0
  49. package/dist/_chunks/validation-AfEFM5ze.js +84 -0
  50. package/dist/_chunks/validation-AfEFM5ze.js.map +1 -0
  51. package/dist/_chunks/walkers-BbEu2_Pp.js +724 -0
  52. package/dist/_chunks/walkers-BbEu2_Pp.js.map +1 -0
  53. package/dist/_chunks/{format-DviM89f0.js → warnings-CAzunaGo.js} +6 -45
  54. package/dist/_chunks/warnings-CAzunaGo.js.map +1 -0
  55. package/dist/adapters/build-output-helper.d.ts +28 -0
  56. package/dist/adapters/build-output-helper.d.ts.map +1 -0
  57. package/dist/adapters/cloudflare-dev.d.ts +109 -0
  58. package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
  59. package/dist/adapters/cloudflare-dev.js +73 -0
  60. package/dist/adapters/cloudflare-dev.js.map +1 -0
  61. package/dist/adapters/cloudflare-kv-cache.d.ts +64 -0
  62. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  63. package/dist/adapters/cloudflare-kv-cache.js +95 -0
  64. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  65. package/dist/adapters/cloudflare.d.ts +148 -12
  66. package/dist/adapters/cloudflare.d.ts.map +1 -1
  67. package/dist/adapters/cloudflare.js +142 -38
  68. package/dist/adapters/cloudflare.js.map +1 -1
  69. package/dist/adapters/compress-module.d.ts.map +1 -1
  70. package/dist/adapters/nitro.d.ts +17 -1
  71. package/dist/adapters/nitro.d.ts.map +1 -1
  72. package/dist/adapters/nitro.js +143 -45
  73. package/dist/adapters/nitro.js.map +1 -1
  74. package/dist/adapters/shared.d.ts +16 -0
  75. package/dist/adapters/shared.d.ts.map +1 -0
  76. package/dist/cache/cache-api.d.ts +24 -0
  77. package/dist/cache/cache-api.d.ts.map +1 -0
  78. package/dist/cache/handler-store.d.ts +31 -0
  79. package/dist/cache/handler-store.d.ts.map +1 -0
  80. package/dist/cache/index.d.ts +23 -7
  81. package/dist/cache/index.d.ts.map +1 -1
  82. package/dist/cache/index.js +151 -81
  83. package/dist/cache/index.js.map +1 -1
  84. package/dist/cache/singleflight.d.ts +18 -1
  85. package/dist/cache/singleflight.d.ts.map +1 -1
  86. package/dist/cache/sizeof.d.ts +22 -0
  87. package/dist/cache/sizeof.d.ts.map +1 -0
  88. package/dist/cache/timber-cache.d.ts +1 -1
  89. package/dist/cache/timber-cache.d.ts.map +1 -1
  90. package/dist/cli-schema-sync.d.ts +39 -0
  91. package/dist/cli-schema-sync.d.ts.map +1 -0
  92. package/dist/cli.d.ts +14 -2
  93. package/dist/cli.d.ts.map +1 -1
  94. package/dist/cli.js +48 -6
  95. package/dist/cli.js.map +1 -1
  96. package/dist/client/browser-dev.d.ts +34 -1
  97. package/dist/client/browser-dev.d.ts.map +1 -1
  98. package/dist/client/browser-entry/action-dispatch.d.ts +17 -0
  99. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  100. package/dist/client/browser-entry/hmr.d.ts +21 -0
  101. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  102. package/dist/client/browser-entry/hydrate.d.ts +46 -0
  103. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  104. package/dist/client/browser-entry/index.d.ts +30 -0
  105. package/dist/client/browser-entry/index.d.ts.map +1 -0
  106. package/dist/client/browser-entry/post-hydration.d.ts +26 -0
  107. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  108. package/dist/client/browser-entry/router-init.d.ts +26 -0
  109. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  110. package/dist/client/browser-entry/rsc-stream.d.ts +24 -0
  111. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  112. package/dist/client/browser-entry/scroll.d.ts +19 -0
  113. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  114. package/dist/client/error-boundary.d.ts +12 -5
  115. package/dist/client/error-boundary.d.ts.map +1 -1
  116. package/dist/client/error-boundary.js +29 -6
  117. package/dist/client/error-boundary.js.map +1 -1
  118. package/dist/client/error-reconstituter.d.ts +54 -0
  119. package/dist/client/error-reconstituter.d.ts.map +1 -0
  120. package/dist/client/form.d.ts +16 -27
  121. package/dist/client/form.d.ts.map +1 -1
  122. package/dist/client/history.d.ts +19 -4
  123. package/dist/client/history.d.ts.map +1 -1
  124. package/dist/client/index.d.ts +10 -24
  125. package/dist/client/index.d.ts.map +1 -1
  126. package/dist/client/index.js +180 -1119
  127. package/dist/client/index.js.map +1 -1
  128. package/dist/client/internal.d.ts +19 -0
  129. package/dist/client/internal.d.ts.map +1 -0
  130. package/dist/client/internal.js +845 -0
  131. package/dist/client/internal.js.map +1 -0
  132. package/dist/client/link-pending-store.d.ts +65 -0
  133. package/dist/client/link-pending-store.d.ts.map +1 -0
  134. package/dist/client/link.d.ts +67 -56
  135. package/dist/client/link.d.ts.map +1 -1
  136. package/dist/client/nav-link-store.d.ts +27 -0
  137. package/dist/client/nav-link-store.d.ts.map +1 -0
  138. package/dist/client/navigation-api-types.d.ts +90 -0
  139. package/dist/client/navigation-api-types.d.ts.map +1 -0
  140. package/dist/client/navigation-api.d.ts +115 -0
  141. package/dist/client/navigation-api.d.ts.map +1 -0
  142. package/dist/client/navigation-context.d.ts +14 -2
  143. package/dist/client/navigation-context.d.ts.map +1 -1
  144. package/dist/client/{transition-root.d.ts → navigation-root.d.ts} +46 -9
  145. package/dist/client/navigation-root.d.ts.map +1 -0
  146. package/dist/client/nuqs-adapter.d.ts.map +1 -1
  147. package/dist/client/router-ref.d.ts +1 -1
  148. package/dist/client/router.d.ts +79 -10
  149. package/dist/client/router.d.ts.map +1 -1
  150. package/dist/client/rsc-fetch.d.ts +46 -3
  151. package/dist/client/rsc-fetch.d.ts.map +1 -1
  152. package/dist/client/segment-cache.d.ts +3 -1
  153. package/dist/client/segment-cache.d.ts.map +1 -1
  154. package/dist/client/segment-outlet.d.ts +49 -0
  155. package/dist/client/segment-outlet.d.ts.map +1 -0
  156. package/dist/client/segment-update-context.d.ts +21 -0
  157. package/dist/client/segment-update-context.d.ts.map +1 -0
  158. package/dist/client/shallow-url.d.ts +10 -0
  159. package/dist/client/shallow-url.d.ts.map +1 -0
  160. package/dist/client/ssr-data.d.ts +13 -4
  161. package/dist/client/ssr-data.d.ts.map +1 -1
  162. package/dist/client/stale-reload.d.ts +15 -0
  163. package/dist/client/stale-reload.d.ts.map +1 -1
  164. package/dist/client/state.d.ts +1 -1
  165. package/dist/client/top-loader.d.ts +5 -5
  166. package/dist/client/top-loader.d.ts.map +1 -1
  167. package/dist/client/use-cookie.d.ts +12 -0
  168. package/dist/client/use-cookie.d.ts.map +1 -1
  169. package/dist/client/use-link-status.d.ts +5 -5
  170. package/dist/client/use-link-status.d.ts.map +1 -1
  171. package/dist/client/use-pending-navigation.d.ts +23 -0
  172. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  173. package/dist/client/use-query-states.d.ts +1 -1
  174. package/dist/client/use-query-states.d.ts.map +1 -1
  175. package/dist/client/use-router.d.ts +1 -1
  176. package/dist/client/use-search-params.d.ts +7 -5
  177. package/dist/client/use-search-params.d.ts.map +1 -1
  178. package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +8 -6
  179. package/dist/client/use-segment-params.d.ts.map +1 -0
  180. package/dist/codec.d.ts +69 -0
  181. package/dist/codec.d.ts.map +1 -0
  182. package/dist/codec.js +75 -0
  183. package/dist/codec.js.map +1 -0
  184. package/dist/config-types.d.ts +294 -0
  185. package/dist/config-types.d.ts.map +1 -0
  186. package/dist/config-validation.d.ts +51 -0
  187. package/dist/config-validation.d.ts.map +1 -0
  188. package/dist/content/index.d.ts +1 -10
  189. package/dist/content/index.d.ts.map +1 -1
  190. package/dist/content/index.js +0 -2
  191. package/dist/cookies/define-cookie.d.ts +58 -25
  192. package/dist/cookies/define-cookie.d.ts.map +1 -1
  193. package/dist/cookies/index.d.ts +2 -1
  194. package/dist/cookies/index.d.ts.map +1 -1
  195. package/dist/cookies/index.js +251 -36
  196. package/dist/cookies/index.js.map +1 -1
  197. package/dist/cookies/json-cookie.d.ts +64 -0
  198. package/dist/cookies/json-cookie.d.ts.map +1 -0
  199. package/dist/cookies/validation.d.ts +46 -0
  200. package/dist/cookies/validation.d.ts.map +1 -0
  201. package/dist/dev-tools/404-page.d.ts +46 -0
  202. package/dist/dev-tools/404-page.d.ts.map +1 -0
  203. package/dist/dev-tools/browser-logs.d.ts +84 -0
  204. package/dist/dev-tools/browser-logs.d.ts.map +1 -0
  205. package/dist/dev-tools/error-page.d.ts +58 -0
  206. package/dist/dev-tools/error-page.d.ts.map +1 -0
  207. package/dist/dev-tools/holding-server.d.ts +54 -0
  208. package/dist/dev-tools/holding-server.d.ts.map +1 -0
  209. package/dist/dev-tools/index.d.ts +31 -0
  210. package/dist/dev-tools/index.d.ts.map +1 -0
  211. package/dist/{server/dev-span-processor.d.ts → dev-tools/instrumentation.d.ts} +26 -6
  212. package/dist/dev-tools/instrumentation.d.ts.map +1 -0
  213. package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
  214. package/dist/dev-tools/logger.d.ts.map +1 -0
  215. package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +2 -2
  216. package/dist/dev-tools/logs.d.ts.map +1 -0
  217. package/dist/dev-tools/overlay.d.ts +91 -0
  218. package/dist/dev-tools/overlay.d.ts.map +1 -0
  219. package/dist/dev-tools/stack-classifier.d.ts +34 -0
  220. package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
  221. package/dist/dev-tools/terminal.d.ts +28 -0
  222. package/dist/dev-tools/terminal.d.ts.map +1 -0
  223. package/dist/{server/dev-warnings.d.ts → dev-tools/warnings.d.ts} +2 -22
  224. package/dist/dev-tools/warnings.d.ts.map +1 -0
  225. package/dist/fonts/ast.d.ts +98 -6
  226. package/dist/fonts/ast.d.ts.map +1 -1
  227. package/dist/fonts/bundle.d.ts +48 -0
  228. package/dist/fonts/bundle.d.ts.map +1 -0
  229. package/dist/fonts/dev-middleware.d.ts +22 -0
  230. package/dist/fonts/dev-middleware.d.ts.map +1 -0
  231. package/dist/fonts/local.d.ts +1 -1
  232. package/dist/fonts/pipeline.d.ts +167 -0
  233. package/dist/fonts/pipeline.d.ts.map +1 -0
  234. package/dist/fonts/transform.d.ts +78 -0
  235. package/dist/fonts/transform.d.ts.map +1 -0
  236. package/dist/fonts/types.d.ts +45 -1
  237. package/dist/fonts/types.d.ts.map +1 -1
  238. package/dist/fonts/virtual-modules.d.ts +94 -0
  239. package/dist/fonts/virtual-modules.d.ts.map +1 -0
  240. package/dist/index.d.ts +46 -164
  241. package/dist/index.d.ts.map +1 -1
  242. package/dist/index.js +5584 -13386
  243. package/dist/index.js.map +1 -1
  244. package/dist/params/codec-registry.d.ts +26 -0
  245. package/dist/params/codec-registry.d.ts.map +1 -0
  246. package/dist/params/define-schema.d.ts +81 -0
  247. package/dist/params/define-schema.d.ts.map +1 -0
  248. package/dist/params/index.d.ts +5 -0
  249. package/dist/params/index.d.ts.map +1 -0
  250. package/dist/params/index.js +34 -0
  251. package/dist/params/index.js.map +1 -0
  252. package/dist/params/resolve-schema.d.ts +34 -0
  253. package/dist/params/resolve-schema.d.ts.map +1 -0
  254. package/dist/plugin-context.d.ts +107 -0
  255. package/dist/plugin-context.d.ts.map +1 -0
  256. package/dist/plugins/adapter-build.d.ts +1 -1
  257. package/dist/plugins/adapter-build.d.ts.map +1 -1
  258. package/dist/plugins/build-manifest.d.ts +2 -2
  259. package/dist/plugins/build-manifest.d.ts.map +1 -1
  260. package/dist/plugins/build-report.d.ts +9 -7
  261. package/dist/plugins/build-report.d.ts.map +1 -1
  262. package/dist/plugins/client-chunks.d.ts +32 -0
  263. package/dist/plugins/client-chunks.d.ts.map +1 -0
  264. package/dist/plugins/cloudflare-wasm.d.ts +18 -0
  265. package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
  266. package/dist/plugins/content.d.ts +1 -1
  267. package/dist/plugins/content.d.ts.map +1 -1
  268. package/dist/plugins/dev-server.d.ts +1 -1
  269. package/dist/plugins/dev-server.d.ts.map +1 -1
  270. package/dist/plugins/entries.d.ts +1 -1
  271. package/dist/plugins/entries.d.ts.map +1 -1
  272. package/dist/plugins/fonts.d.ts +17 -73
  273. package/dist/plugins/fonts.d.ts.map +1 -1
  274. package/dist/plugins/mdx.d.ts +1 -1
  275. package/dist/plugins/mdx.d.ts.map +1 -1
  276. package/dist/plugins/routing.d.ts +1 -1
  277. package/dist/plugins/routing.d.ts.map +1 -1
  278. package/dist/plugins/server-bundle.d.ts.map +1 -1
  279. package/dist/plugins/shims.d.ts +6 -5
  280. package/dist/plugins/shims.d.ts.map +1 -1
  281. package/dist/plugins/static-build.d.ts +5 -26
  282. package/dist/plugins/static-build.d.ts.map +1 -1
  283. package/dist/routing/codegen-shared.d.ts +67 -0
  284. package/dist/routing/codegen-shared.d.ts.map +1 -0
  285. package/dist/routing/codegen-types.d.ts +60 -0
  286. package/dist/routing/codegen-types.d.ts.map +1 -0
  287. package/dist/routing/codegen.d.ts +7 -2
  288. package/dist/routing/codegen.d.ts.map +1 -1
  289. package/dist/routing/convention-lint.d.ts +41 -0
  290. package/dist/routing/convention-lint.d.ts.map +1 -0
  291. package/dist/routing/index.d.ts +7 -1
  292. package/dist/routing/index.d.ts.map +1 -1
  293. package/dist/routing/index.js +4 -2
  294. package/dist/routing/link-codegen.d.ts +90 -0
  295. package/dist/routing/link-codegen.d.ts.map +1 -0
  296. package/dist/routing/scanner.d.ts +1 -10
  297. package/dist/routing/scanner.d.ts.map +1 -1
  298. package/dist/routing/schema-validation.d.ts +35 -0
  299. package/dist/routing/schema-validation.d.ts.map +1 -0
  300. package/dist/routing/segment-classify.d.ts +75 -0
  301. package/dist/routing/segment-classify.d.ts.map +1 -0
  302. package/dist/routing/segment-codegen.d.ts +38 -0
  303. package/dist/routing/segment-codegen.d.ts.map +1 -0
  304. package/dist/routing/types.d.ts +77 -25
  305. package/dist/routing/types.d.ts.map +1 -1
  306. package/dist/routing/walkers.d.ts +51 -0
  307. package/dist/routing/walkers.d.ts.map +1 -0
  308. package/dist/rsc-runtime/rsc.d.ts +1 -1
  309. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  310. package/dist/rsc-runtime/ssr.d.ts +12 -0
  311. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  312. package/dist/schema-bridge.d.ts +76 -0
  313. package/dist/schema-bridge.d.ts.map +1 -0
  314. package/dist/search-params/define.d.ts +157 -0
  315. package/dist/search-params/define.d.ts.map +1 -0
  316. package/dist/search-params/index.d.ts +4 -7
  317. package/dist/search-params/index.d.ts.map +1 -1
  318. package/dist/search-params/index.js +34 -441
  319. package/dist/search-params/index.js.map +1 -1
  320. package/dist/search-params/registry.d.ts +2 -2
  321. package/dist/search-params/registry.d.ts.map +1 -1
  322. package/dist/search-params/wrappers.d.ts +53 -0
  323. package/dist/search-params/wrappers.d.ts.map +1 -0
  324. package/dist/segment-params/define.d.ts +89 -0
  325. package/dist/segment-params/define.d.ts.map +1 -0
  326. package/dist/segment-params/index.d.ts +3 -0
  327. package/dist/segment-params/index.d.ts.map +1 -0
  328. package/dist/segment-params/index.js +2 -0
  329. package/dist/server/access-gate.d.ts +8 -3
  330. package/dist/server/access-gate.d.ts.map +1 -1
  331. package/dist/server/action-client.d.ts +41 -6
  332. package/dist/server/action-client.d.ts.map +1 -1
  333. package/dist/server/action-encryption.d.ts +76 -0
  334. package/dist/server/action-encryption.d.ts.map +1 -0
  335. package/dist/server/action-handler.d.ts +35 -1
  336. package/dist/server/action-handler.d.ts.map +1 -1
  337. package/dist/server/actions.d.ts +6 -14
  338. package/dist/server/actions.d.ts.map +1 -1
  339. package/dist/server/als-registry.d.ts +70 -11
  340. package/dist/server/als-registry.d.ts.map +1 -1
  341. package/dist/server/asset-headers.d.ts +1 -15
  342. package/dist/server/asset-headers.d.ts.map +1 -1
  343. package/dist/server/build-manifest.d.ts +8 -2
  344. package/dist/server/build-manifest.d.ts.map +1 -1
  345. package/dist/server/coalesce-tick.d.ts +40 -0
  346. package/dist/server/coalesce-tick.d.ts.map +1 -0
  347. package/dist/server/cookie-context.d.ts +170 -0
  348. package/dist/server/cookie-context.d.ts.map +1 -0
  349. package/dist/server/cookie-parsing.d.ts +51 -0
  350. package/dist/server/cookie-parsing.d.ts.map +1 -0
  351. package/dist/server/debug.d.ts +1 -1
  352. package/dist/server/default-logger.d.ts +22 -0
  353. package/dist/server/default-logger.d.ts.map +1 -0
  354. package/dist/server/deny-boundary.d.ts +90 -0
  355. package/dist/server/deny-boundary.d.ts.map +1 -0
  356. package/dist/server/deny-renderer.d.ts +1 -1
  357. package/dist/server/deny-renderer.d.ts.map +1 -1
  358. package/dist/server/dev-source-map.d.ts +22 -0
  359. package/dist/server/dev-source-map.d.ts.map +1 -0
  360. package/dist/server/early-hints-sender.d.ts.map +1 -1
  361. package/dist/server/early-hints.d.ts +13 -5
  362. package/dist/server/early-hints.d.ts.map +1 -1
  363. package/dist/server/error-boundary-wrapper.d.ts +7 -1
  364. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  365. package/dist/server/fallback-error.d.ts +12 -7
  366. package/dist/server/fallback-error.d.ts.map +1 -1
  367. package/dist/server/flight-injection-state.d.ts +66 -0
  368. package/dist/server/flight-injection-state.d.ts.map +1 -0
  369. package/dist/server/flight-scripts.d.ts +42 -0
  370. package/dist/server/flight-scripts.d.ts.map +1 -0
  371. package/dist/server/flush.d.ts.map +1 -1
  372. package/dist/server/form-data.d.ts +29 -0
  373. package/dist/server/form-data.d.ts.map +1 -1
  374. package/dist/server/html-injector-core.d.ts +213 -0
  375. package/dist/server/html-injector-core.d.ts.map +1 -0
  376. package/dist/server/html-injectors.d.ts +81 -41
  377. package/dist/server/html-injectors.d.ts.map +1 -1
  378. package/dist/server/index.d.ts +10 -46
  379. package/dist/server/index.d.ts.map +1 -1
  380. package/dist/server/index.js +155 -2905
  381. package/dist/server/index.js.map +1 -1
  382. package/dist/server/internal.d.ts +48 -0
  383. package/dist/server/internal.d.ts.map +1 -0
  384. package/dist/server/internal.js +3027 -0
  385. package/dist/server/internal.js.map +1 -0
  386. package/dist/server/logger.d.ts +39 -7
  387. package/dist/server/logger.d.ts.map +1 -1
  388. package/dist/server/metadata-routes.d.ts +23 -7
  389. package/dist/server/metadata-routes.d.ts.map +1 -1
  390. package/dist/server/middleware-runner.d.ts +36 -4
  391. package/dist/server/middleware-runner.d.ts.map +1 -1
  392. package/dist/server/node-stream-transforms.d.ts +112 -0
  393. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  394. package/dist/server/param-coercion.d.ts +54 -0
  395. package/dist/server/param-coercion.d.ts.map +1 -0
  396. package/dist/server/pipeline-helpers.d.ts +95 -0
  397. package/dist/server/pipeline-helpers.d.ts.map +1 -0
  398. package/dist/server/pipeline-interception.d.ts +1 -1
  399. package/dist/server/pipeline-interception.d.ts.map +1 -1
  400. package/dist/server/pipeline-metadata.d.ts +6 -0
  401. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  402. package/dist/server/pipeline-outcome.d.ts +49 -0
  403. package/dist/server/pipeline-outcome.d.ts.map +1 -0
  404. package/dist/server/pipeline-phases.d.ts +52 -0
  405. package/dist/server/pipeline-phases.d.ts.map +1 -0
  406. package/dist/server/pipeline.d.ts +118 -23
  407. package/dist/server/pipeline.d.ts.map +1 -1
  408. package/dist/server/port-resolution.d.ts +117 -0
  409. package/dist/server/port-resolution.d.ts.map +1 -0
  410. package/dist/server/primitives.d.ts +69 -18
  411. package/dist/server/primitives.d.ts.map +1 -1
  412. package/dist/server/render-timeout.d.ts +51 -0
  413. package/dist/server/render-timeout.d.ts.map +1 -0
  414. package/dist/server/request-context.d.ts +62 -107
  415. package/dist/server/request-context.d.ts.map +1 -1
  416. package/dist/server/route-element-builder.d.ts +28 -2
  417. package/dist/server/route-element-builder.d.ts.map +1 -1
  418. package/dist/server/route-handler.d.ts.map +1 -1
  419. package/dist/server/route-matcher.d.ts +25 -36
  420. package/dist/server/route-matcher.d.ts.map +1 -1
  421. package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
  422. package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
  423. package/dist/server/rsc-entry/api-handler.d.ts +2 -2
  424. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  425. package/dist/server/rsc-entry/error-renderer.d.ts +26 -13
  426. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  427. package/dist/server/rsc-entry/helpers.d.ts +50 -6
  428. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  429. package/dist/server/rsc-entry/index.d.ts +19 -8
  430. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  431. package/dist/server/rsc-entry/render-route.d.ts +50 -0
  432. package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
  433. package/dist/server/rsc-entry/rsc-payload.d.ts +3 -3
  434. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  435. package/dist/server/rsc-entry/rsc-stream.d.ts +17 -1
  436. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  437. package/dist/server/rsc-entry/ssr-bridge.d.ts +5 -1
  438. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  439. package/dist/server/rsc-entry/ssr-renderer.d.ts +19 -4
  440. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  441. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +119 -0
  442. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
  443. package/dist/server/safe-load.d.ts +46 -0
  444. package/dist/server/safe-load.d.ts.map +1 -0
  445. package/dist/server/sensitive-fields.d.ts +74 -0
  446. package/dist/server/sensitive-fields.d.ts.map +1 -0
  447. package/dist/server/sitemap-generator.d.ts +129 -0
  448. package/dist/server/sitemap-generator.d.ts.map +1 -0
  449. package/dist/server/sitemap-handler.d.ts +22 -0
  450. package/dist/server/sitemap-handler.d.ts.map +1 -0
  451. package/dist/server/slot-resolver.d.ts +1 -1
  452. package/dist/server/slot-resolver.d.ts.map +1 -1
  453. package/dist/server/ssr-bridge-types.d.ts +121 -0
  454. package/dist/server/ssr-bridge-types.d.ts.map +1 -0
  455. package/dist/server/ssr-entry.d.ts +2 -43
  456. package/dist/server/ssr-entry.d.ts.map +1 -1
  457. package/dist/server/ssr-render.d.ts +64 -21
  458. package/dist/server/ssr-render.d.ts.map +1 -1
  459. package/dist/server/ssr-wrappers.d.ts +50 -0
  460. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  461. package/dist/server/state-tree-diff.d.ts +12 -5
  462. package/dist/server/state-tree-diff.d.ts.map +1 -1
  463. package/dist/server/status-code-resolver.d.ts +16 -11
  464. package/dist/server/status-code-resolver.d.ts.map +1 -1
  465. package/dist/server/stream-utils.d.ts +36 -0
  466. package/dist/server/stream-utils.d.ts.map +1 -0
  467. package/dist/server/tracing.d.ts +5 -5
  468. package/dist/server/tracing.d.ts.map +1 -1
  469. package/dist/server/tree-builder.d.ts +62 -30
  470. package/dist/server/tree-builder.d.ts.map +1 -1
  471. package/dist/server/tree-match.d.ts +49 -0
  472. package/dist/server/tree-match.d.ts.map +1 -0
  473. package/dist/server/types.d.ts +49 -4
  474. package/dist/server/types.d.ts.map +1 -1
  475. package/dist/server/utils/escape-html.d.ts +14 -0
  476. package/dist/server/utils/escape-html.d.ts.map +1 -0
  477. package/dist/server/version-skew.d.ts +61 -0
  478. package/dist/server/version-skew.d.ts.map +1 -0
  479. package/dist/shared/merge-search-params.d.ts +22 -0
  480. package/dist/shared/merge-search-params.d.ts.map +1 -0
  481. package/dist/shims/font-google.d.ts +1 -1
  482. package/dist/shims/font-google.d.ts.map +1 -1
  483. package/dist/shims/font-google.js +42 -0
  484. package/dist/shims/font-google.js.map +1 -0
  485. package/dist/shims/font-local.d.ts +26 -0
  486. package/dist/shims/font-local.d.ts.map +1 -0
  487. package/dist/shims/font-local.js +20 -0
  488. package/dist/shims/font-local.js.map +1 -0
  489. package/dist/shims/headers.d.ts +2 -1
  490. package/dist/shims/headers.d.ts.map +1 -1
  491. package/dist/shims/navigation-client.d.ts +3 -1
  492. package/dist/shims/navigation-client.d.ts.map +1 -1
  493. package/dist/shims/navigation.d.ts +11 -5
  494. package/dist/shims/navigation.d.ts.map +1 -1
  495. package/dist/utils/state-machine.d.ts +80 -0
  496. package/dist/utils/state-machine.d.ts.map +1 -0
  497. package/package.json +61 -22
  498. package/src/adapters/build-output-helper.ts +139 -0
  499. package/src/adapters/cloudflare-dev.ts +177 -0
  500. package/src/adapters/cloudflare-kv-cache.ts +142 -0
  501. package/src/adapters/cloudflare.ts +350 -76
  502. package/src/adapters/compress-module.ts +24 -4
  503. package/src/adapters/nitro.ts +142 -59
  504. package/src/adapters/shared.ts +40 -0
  505. package/src/adapters/wrangler.d.ts +7 -0
  506. package/src/cache/cache-api.ts +38 -0
  507. package/src/cache/handler-store.ts +68 -0
  508. package/src/cache/index.ts +81 -18
  509. package/src/cache/singleflight.ts +62 -4
  510. package/src/cache/sizeof.ts +33 -0
  511. package/src/cache/timber-cache.ts +25 -20
  512. package/src/cli-schema-sync.ts +295 -0
  513. package/src/cli.ts +76 -8
  514. package/src/client/browser-dev.ts +153 -1
  515. package/src/client/browser-entry/action-dispatch.ts +125 -0
  516. package/src/client/browser-entry/hmr.ts +81 -0
  517. package/src/client/browser-entry/hydrate.ts +153 -0
  518. package/src/client/browser-entry/index.ts +151 -0
  519. package/src/client/browser-entry/post-hydration.ts +113 -0
  520. package/src/client/browser-entry/router-init.ts +219 -0
  521. package/src/client/browser-entry/rsc-stream.ts +157 -0
  522. package/src/client/browser-entry/scroll.ts +27 -0
  523. package/src/client/error-boundary.tsx +99 -22
  524. package/src/client/error-reconstituter.tsx +65 -0
  525. package/src/client/form.tsx +31 -32
  526. package/src/client/history.ts +26 -4
  527. package/src/client/index.ts +66 -45
  528. package/src/client/internal.ts +58 -0
  529. package/src/client/link-pending-store.ts +116 -0
  530. package/src/client/link.tsx +336 -119
  531. package/src/client/nav-link-store.ts +37 -0
  532. package/src/client/navigation-api-types.ts +112 -0
  533. package/src/client/navigation-api.ts +332 -0
  534. package/src/client/navigation-context.ts +33 -7
  535. package/src/client/navigation-root.tsx +347 -0
  536. package/src/client/nuqs-adapter.tsx +16 -3
  537. package/src/client/router-ref.ts +1 -1
  538. package/src/client/router.ts +418 -128
  539. package/src/client/rsc-fetch.ts +208 -10
  540. package/src/client/segment-cache.ts +6 -3
  541. package/src/client/segment-outlet.tsx +77 -0
  542. package/src/client/segment-update-context.ts +42 -0
  543. package/src/client/shallow-url.ts +22 -0
  544. package/src/client/ssr-data.ts +13 -5
  545. package/src/client/stale-reload.ts +72 -3
  546. package/src/client/state.ts +2 -2
  547. package/src/client/top-loader.tsx +11 -9
  548. package/src/client/use-cookie.ts +31 -2
  549. package/src/client/use-link-status.ts +7 -7
  550. package/src/client/use-pending-navigation.ts +40 -0
  551. package/src/client/use-query-states.ts +9 -3
  552. package/src/client/use-router.ts +1 -1
  553. package/src/client/use-search-params.ts +25 -44
  554. package/src/client/{use-params.ts → use-segment-params.ts} +8 -6
  555. package/src/codec.ts +147 -0
  556. package/src/config-types.ts +292 -0
  557. package/src/config-validation.ts +303 -0
  558. package/src/content/index.ts +5 -13
  559. package/src/cookies/define-cookie.ts +233 -53
  560. package/src/cookies/index.ts +12 -1
  561. package/src/cookies/json-cookie.ts +105 -0
  562. package/src/cookies/validation.ts +134 -0
  563. package/src/dev-tools/404-page.ts +387 -0
  564. package/src/dev-tools/browser-logs.ts +291 -0
  565. package/src/dev-tools/error-page.ts +506 -0
  566. package/src/dev-tools/holding-server.ts +187 -0
  567. package/src/dev-tools/index.ts +90 -0
  568. package/src/dev-tools/instrumentation.ts +176 -0
  569. package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +9 -5
  570. package/src/dev-tools/overlay.ts +469 -0
  571. package/src/dev-tools/stack-classifier.ts +75 -0
  572. package/src/dev-tools/terminal.ts +183 -0
  573. package/src/{server/dev-warnings.ts → dev-tools/warnings.ts} +5 -50
  574. package/src/fonts/ast.ts +525 -16
  575. package/src/fonts/bundle.ts +142 -0
  576. package/src/fonts/dev-middleware.ts +74 -0
  577. package/src/fonts/local.ts +1 -1
  578. package/src/fonts/pipeline.ts +314 -0
  579. package/src/fonts/transform.ts +317 -0
  580. package/src/fonts/types.ts +50 -1
  581. package/src/fonts/virtual-modules.ts +233 -0
  582. package/src/index.ts +411 -329
  583. package/src/params/codec-registry.ts +34 -0
  584. package/src/params/define-schema.ts +114 -0
  585. package/src/params/index.ts +17 -0
  586. package/src/params/resolve-schema.ts +116 -0
  587. package/src/plugin-context.ts +240 -0
  588. package/src/plugins/adapter-build.ts +12 -4
  589. package/src/plugins/build-manifest.ts +69 -6
  590. package/src/plugins/build-report.ts +16 -25
  591. package/src/plugins/client-chunks.ts +65 -0
  592. package/src/plugins/cloudflare-wasm.ts +103 -0
  593. package/src/plugins/content.ts +1 -1
  594. package/src/plugins/dev-server.ts +179 -37
  595. package/src/plugins/entries.ts +111 -8
  596. package/src/plugins/fonts.ts +165 -654
  597. package/src/plugins/mdx.ts +47 -10
  598. package/src/plugins/routing.ts +386 -47
  599. package/src/plugins/server-bundle.ts +59 -3
  600. package/src/plugins/shims.ts +136 -35
  601. package/src/plugins/static-build.ts +15 -89
  602. package/src/routing/codegen-shared.ts +115 -0
  603. package/src/routing/codegen-types.ts +61 -0
  604. package/src/routing/codegen.ts +321 -177
  605. package/src/routing/convention-lint.ts +357 -0
  606. package/src/routing/index.ts +10 -1
  607. package/src/routing/interception.ts +1 -1
  608. package/src/routing/link-codegen.ts +308 -0
  609. package/src/routing/scanner.ts +165 -110
  610. package/src/routing/schema-validation.ts +149 -0
  611. package/src/routing/segment-classify.ts +188 -0
  612. package/src/routing/segment-codegen.ts +98 -0
  613. package/src/routing/types.ts +78 -25
  614. package/src/routing/walkers.ts +90 -0
  615. package/src/rsc-runtime/rsc.ts +2 -0
  616. package/src/rsc-runtime/ssr.ts +50 -0
  617. package/src/rsc-runtime/vendor-types.d.ts +7 -0
  618. package/src/{search-params/codecs.ts → schema-bridge.ts} +57 -20
  619. package/src/search-params/define.ts +538 -0
  620. package/src/search-params/index.ts +14 -20
  621. package/src/search-params/registry.ts +2 -2
  622. package/src/search-params/wrappers.ts +92 -0
  623. package/src/segment-params/define.ts +309 -0
  624. package/src/segment-params/index.ts +9 -0
  625. package/src/server/access-gate.tsx +76 -34
  626. package/src/server/action-client.ts +88 -15
  627. package/src/server/action-encryption.ts +144 -0
  628. package/src/server/action-handler.ts +112 -14
  629. package/src/server/actions.ts +14 -23
  630. package/src/server/als-registry.ts +108 -20
  631. package/src/server/asset-headers.ts +8 -34
  632. package/src/server/build-manifest.ts +17 -4
  633. package/src/server/coalesce-tick.ts +75 -0
  634. package/src/server/compress.ts +25 -7
  635. package/src/server/cookie-context.ts +468 -0
  636. package/src/server/cookie-parsing.ts +135 -0
  637. package/src/server/debug.ts +1 -1
  638. package/src/server/default-logger.ts +99 -0
  639. package/src/server/deny-boundary.ts +218 -0
  640. package/src/server/deny-renderer.ts +32 -51
  641. package/src/server/dev-source-map.ts +31 -0
  642. package/src/server/early-hints-sender.ts +3 -2
  643. package/src/server/early-hints.ts +36 -15
  644. package/src/server/error-boundary-wrapper.ts +74 -22
  645. package/src/server/fallback-error.ts +74 -102
  646. package/src/server/flight-injection-state.ts +113 -0
  647. package/src/server/flight-scripts.ts +62 -0
  648. package/src/server/flush.ts +2 -1
  649. package/src/server/form-data.ts +101 -5
  650. package/src/server/html-injector-core.ts +417 -0
  651. package/src/server/html-injectors.ts +235 -223
  652. package/src/server/index.ts +29 -183
  653. package/src/server/internal.ts +182 -0
  654. package/src/server/logger.ts +67 -36
  655. package/src/server/metadata-routes.ts +44 -19
  656. package/src/server/middleware-runner.ts +75 -4
  657. package/src/server/node-stream-transforms.ts +361 -0
  658. package/src/server/param-coercion.ts +206 -0
  659. package/src/server/pipeline-helpers.ts +204 -0
  660. package/src/server/pipeline-interception.ts +17 -16
  661. package/src/server/pipeline-metadata.ts +13 -0
  662. package/src/server/pipeline-outcome.ts +197 -0
  663. package/src/server/pipeline-phases.ts +468 -0
  664. package/src/server/pipeline.ts +154 -394
  665. package/src/server/port-resolution.ts +215 -0
  666. package/src/server/primitives.ts +111 -28
  667. package/src/server/render-timeout.ts +108 -0
  668. package/src/server/request-context.ts +168 -337
  669. package/src/server/route-element-builder.ts +435 -208
  670. package/src/server/route-handler.ts +24 -4
  671. package/src/server/route-matcher.ts +128 -277
  672. package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
  673. package/src/server/rsc-entry/api-handler.ts +16 -17
  674. package/src/server/rsc-entry/error-renderer.ts +315 -89
  675. package/src/server/rsc-entry/helpers.ts +155 -26
  676. package/src/server/rsc-entry/index.ts +316 -327
  677. package/src/server/rsc-entry/render-route.ts +313 -0
  678. package/src/server/rsc-entry/rsc-payload.ts +65 -18
  679. package/src/server/rsc-entry/rsc-stream.ts +85 -13
  680. package/src/server/rsc-entry/ssr-bridge.ts +18 -5
  681. package/src/server/rsc-entry/ssr-renderer.ts +193 -40
  682. package/src/server/rsc-entry/wrap-action-dispatch.ts +449 -0
  683. package/src/server/safe-load.ts +60 -0
  684. package/src/server/sensitive-fields.ts +230 -0
  685. package/src/server/sitemap-generator.ts +338 -0
  686. package/src/server/sitemap-handler.ts +126 -0
  687. package/src/server/slot-resolver.ts +228 -246
  688. package/src/server/ssr-bridge-types.ts +124 -0
  689. package/src/server/ssr-entry.ts +217 -78
  690. package/src/server/ssr-render.ts +344 -71
  691. package/src/server/ssr-wrappers.tsx +139 -0
  692. package/src/server/state-tree-diff.ts +30 -23
  693. package/src/server/status-code-resolver.ts +112 -128
  694. package/src/server/stream-utils.ts +213 -0
  695. package/src/server/tracing.ts +21 -10
  696. package/src/server/tree-builder.ts +202 -90
  697. package/src/server/tree-match.ts +210 -0
  698. package/src/server/types.ts +55 -6
  699. package/src/server/utils/escape-html.ts +20 -0
  700. package/src/server/version-skew.ts +104 -0
  701. package/src/shared/merge-search-params.ts +55 -0
  702. package/src/shims/font-google.ts +1 -1
  703. package/src/shims/font-local.ts +34 -0
  704. package/src/shims/headers.ts +5 -1
  705. package/src/shims/navigation-client.ts +4 -3
  706. package/src/shims/navigation.ts +14 -7
  707. package/src/utils/state-machine.ts +111 -0
  708. package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
  709. package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
  710. package/dist/_chunks/debug-gwlJkDuf.js +0 -108
  711. package/dist/_chunks/debug-gwlJkDuf.js.map +0 -1
  712. package/dist/_chunks/format-DviM89f0.js.map +0 -1
  713. package/dist/_chunks/interception-BOoWmLUA.js +0 -676
  714. package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
  715. package/dist/_chunks/metadata-routes-Cjmvi3rQ.js.map +0 -1
  716. package/dist/_chunks/request-context-DIkVh_jG.js +0 -330
  717. package/dist/_chunks/request-context-DIkVh_jG.js.map +0 -1
  718. package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
  719. package/dist/_chunks/tracing-CemImE6h.js +0 -187
  720. package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
  721. package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
  722. package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
  723. package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
  724. package/dist/cache/register-cached-function.d.ts +0 -17
  725. package/dist/cache/register-cached-function.d.ts.map +0 -1
  726. package/dist/client/browser-entry.d.ts +0 -21
  727. package/dist/client/browser-entry.d.ts.map +0 -1
  728. package/dist/client/link-status-provider.d.ts +0 -11
  729. package/dist/client/link-status-provider.d.ts.map +0 -1
  730. package/dist/client/segment-merger.d.ts +0 -119
  731. package/dist/client/segment-merger.d.ts.map +0 -1
  732. package/dist/client/transition-root.d.ts.map +0 -1
  733. package/dist/client/use-navigation-pending.d.ts +0 -26
  734. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  735. package/dist/client/use-params.d.ts.map +0 -1
  736. package/dist/plugins/cache-transform.d.ts +0 -36
  737. package/dist/plugins/cache-transform.d.ts.map +0 -1
  738. package/dist/plugins/dev-error-overlay.d.ts +0 -60
  739. package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
  740. package/dist/plugins/dev-logs.d.ts.map +0 -1
  741. package/dist/plugins/dynamic-transform.d.ts +0 -72
  742. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  743. package/dist/plugins/server-action-exports.d.ts +0 -26
  744. package/dist/plugins/server-action-exports.d.ts.map +0 -1
  745. package/dist/routing/status-file-lint.d.ts +0 -33
  746. package/dist/routing/status-file-lint.d.ts.map +0 -1
  747. package/dist/search-params/analyze.d.ts +0 -54
  748. package/dist/search-params/analyze.d.ts.map +0 -1
  749. package/dist/search-params/builtin-codecs.d.ts +0 -105
  750. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  751. package/dist/search-params/codecs.d.ts +0 -53
  752. package/dist/search-params/codecs.d.ts.map +0 -1
  753. package/dist/search-params/create.d.ts +0 -106
  754. package/dist/search-params/create.d.ts.map +0 -1
  755. package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
  756. package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
  757. package/dist/server/dev-logger.d.ts.map +0 -1
  758. package/dist/server/dev-span-processor.d.ts.map +0 -1
  759. package/dist/server/dev-warnings.d.ts.map +0 -1
  760. package/dist/server/manifest-status-resolver.d.ts +0 -58
  761. package/dist/server/manifest-status-resolver.d.ts.map +0 -1
  762. package/dist/server/prerender.d.ts +0 -77
  763. package/dist/server/prerender.d.ts.map +0 -1
  764. package/dist/utils/directive-parser.d.ts +0 -70
  765. package/dist/utils/directive-parser.d.ts.map +0 -1
  766. package/src/cache/register-cached-function.ts +0 -103
  767. package/src/client/browser-entry.ts +0 -678
  768. package/src/client/link-status-provider.tsx +0 -30
  769. package/src/client/segment-merger.ts +0 -339
  770. package/src/client/transition-root.tsx +0 -166
  771. package/src/client/use-navigation-pending.ts +0 -38
  772. package/src/plugins/cache-transform.ts +0 -199
  773. package/src/plugins/dev-error-overlay.ts +0 -230
  774. package/src/plugins/dynamic-transform.ts +0 -161
  775. package/src/plugins/server-action-exports.ts +0 -220
  776. package/src/routing/status-file-lint.ts +0 -112
  777. package/src/search-params/analyze.ts +0 -192
  778. package/src/search-params/builtin-codecs.ts +0 -228
  779. package/src/search-params/create.ts +0 -321
  780. package/src/server/dev-fetch-instrumentation.ts +0 -96
  781. package/src/server/dev-span-processor.ts +0 -78
  782. package/src/server/manifest-status-resolver.ts +0 -215
  783. package/src/server/prerender.ts +0 -139
  784. package/src/utils/directive-parser.ts +0 -529
  785. /package/src/{server/dev-logger.ts → dev-tools/logger.ts} +0 -0
@@ -0,0 +1,1104 @@
1
+ import { _ as waitUntilAls, d as withSpan, h as revalidationAls, m as requestContextAls, v as isDebug } from "./tracing-DP5djRq5.js";
2
+ import { t as _setGetSearchParamsFn } from "./define-jeHDXZGq.js";
3
+ import { t as _setGetSegmentParamsFn } from "./define-DMq-Yjp7.js";
4
+ import { n as assertValidCookieValue, t as assertValidCookieName } from "./validation-AfEFM5ze.js";
5
+ import { t as mergePreservedSearchParams } from "./merge-search-params-Cm1j99HC.js";
6
+ import { t as getCacheHandler } from "./handler-store-bIAstrxQ.js";
7
+ //#region src/server/cookie-parsing.ts
8
+ /**
9
+ * Parse a Cookie header string into a Map of name → value pairs.
10
+ * Follows RFC 6265 §4.2.1: cookies are semicolon-separated key=value pairs.
11
+ *
12
+ * Values are auto-decoded with `decodeURIComponent` so they round-trip
13
+ * losslessly with `getCookies().set()` (which auto-encodes). Malformed
14
+ * `%`-escapes from third-party cookies fall back to the raw byte sequence
15
+ * — the parser must be total over arbitrary inbound headers, including
16
+ * non-conforming values from other servers, browser extensions, etc.
17
+ */
18
+ function parseCookieHeader(header) {
19
+ const map = /* @__PURE__ */ new Map();
20
+ if (!header) return map;
21
+ for (const pair of header.split(";")) {
22
+ const eqIndex = pair.indexOf("=");
23
+ if (eqIndex === -1) continue;
24
+ const name = pair.slice(0, eqIndex).trim();
25
+ const value = pair.slice(eqIndex + 1).trim();
26
+ if (name) map.set(name, safeDecodeCookieValue(value));
27
+ }
28
+ return map;
29
+ }
30
+ /**
31
+ * Decode a single cookie value with `decodeURIComponent`, falling back to
32
+ * the raw byte sequence if the input contains a malformed `%`-escape.
33
+ *
34
+ * Used by both `parseCookieHeader` (incoming Cookie: header) and the
35
+ * `setRaw` forwarding path (outgoing Set-Cookie from upstream services).
36
+ * Total — never throws.
37
+ */
38
+ function safeDecodeCookieValue(raw) {
39
+ try {
40
+ return decodeURIComponent(raw);
41
+ } catch {
42
+ return raw;
43
+ }
44
+ }
45
+ /** Serialize a CookieEntry into a Set-Cookie header value. */
46
+ function serializeCookieEntry(entry) {
47
+ const parts = [`${entry.name}=${entry.value}`];
48
+ const opts = entry.options;
49
+ if (opts.domain) parts.push(`Domain=${opts.domain}`);
50
+ if (opts.path) parts.push(`Path=${opts.path}`);
51
+ if (opts.expires) parts.push(`Expires=${opts.expires.toUTCString()}`);
52
+ if (opts.maxAge !== void 0) parts.push(`Max-Age=${opts.maxAge}`);
53
+ if (opts.httpOnly) parts.push("HttpOnly");
54
+ if (opts.secure) parts.push("Secure");
55
+ if (opts.sameSite) parts.push(`SameSite=${opts.sameSite.charAt(0).toUpperCase()}${opts.sameSite.slice(1)}`);
56
+ if (opts.partitioned) parts.push("Partitioned");
57
+ return parts.join("; ");
58
+ }
59
+ /**
60
+ * Parse a raw `Set-Cookie` header string into name, value, and options.
61
+ * Handles all standard attributes: Path, Domain, Max-Age, Expires,
62
+ * SameSite, Secure, HttpOnly, Partitioned.
63
+ *
64
+ * Does NOT apply DEFAULT_COOKIE_OPTIONS — the caller decides whether
65
+ * to merge defaults (e.g. `set()` does, but `setRaw()` should preserve
66
+ * the original header's intent).
67
+ */
68
+ function parseSetCookie(header) {
69
+ const segments = header.split(";");
70
+ const nameValue = segments[0];
71
+ const eqIdx = nameValue.indexOf("=");
72
+ if (eqIdx <= 0) return null;
73
+ const name = nameValue.slice(0, eqIdx).trim();
74
+ const value = nameValue.slice(eqIdx + 1).trim();
75
+ const options = {};
76
+ for (let i = 1; i < segments.length; i++) {
77
+ const seg = segments[i].trim();
78
+ if (!seg) continue;
79
+ const [attrName, ...rest] = seg.split("=");
80
+ const key = attrName.trim().toLowerCase();
81
+ const val = rest.join("=").trim();
82
+ switch (key) {
83
+ case "path":
84
+ options.path = val || "/";
85
+ break;
86
+ case "domain":
87
+ options.domain = val;
88
+ break;
89
+ case "max-age":
90
+ options.maxAge = Number(val);
91
+ break;
92
+ case "expires":
93
+ options.expires = new Date(val);
94
+ break;
95
+ case "samesite":
96
+ options.sameSite = val.toLowerCase();
97
+ break;
98
+ case "secure":
99
+ options.secure = true;
100
+ break;
101
+ case "httponly":
102
+ options.httpOnly = true;
103
+ break;
104
+ case "partitioned":
105
+ options.partitioned = true;
106
+ break;
107
+ }
108
+ }
109
+ return {
110
+ name,
111
+ value,
112
+ options
113
+ };
114
+ }
115
+ //#endregion
116
+ //#region src/server/cookie-context.ts
117
+ /**
118
+ * Cookie Context — per-request cookie API and on-the-wire helpers.
119
+ *
120
+ * Split out of `request-context.ts` (TIM-853) so the cookie subsystem
121
+ * — encoding contract, options grammar, parser, serializer, RYW map,
122
+ * and rerender seed — lives in one file. The headers/scope/params APIs
123
+ * stay in `request-context.ts` and call into this module via the
124
+ * exported helpers.
125
+ *
126
+ * See design/29-cookies.md for the encoding contract and read-your-own-
127
+ * writes semantics. See ONGOING_SECURITY.md H-3 (TIM-868) for the
128
+ * smuggling primitive that the encoding contract closes.
129
+ */
130
+ /**
131
+ * Returns a cookie accessor for the current request.
132
+ *
133
+ * Available in middleware, access checks, server components, and server actions.
134
+ * Throws if called outside a request context (security principle #2: no global fallback).
135
+ *
136
+ * Read methods (.get, .has, .getAll) are always available and reflect
137
+ * read-your-own-writes from .set() calls in the same request.
138
+ *
139
+ * Mutation methods (.set, .delete, .clear) are only available in mutable
140
+ * contexts (middleware.ts, server actions, route.ts handlers). Calling them
141
+ * in read-only contexts (access.ts, server components) throws.
142
+ *
143
+ * This is the escape hatch for direct cookie jar operations. For typed
144
+ * cookie access, use `defineCookie()` instead.
145
+ *
146
+ * See design/29-cookies.md
147
+ */
148
+ function getCookieJar() {
149
+ const store = requestContextAls.getStore();
150
+ if (!store) throw new Error("[timber] getCookieJar() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
151
+ if (!store.parsedCookies) store.parsedCookies = parseCookieHeader(store.cookieHeader);
152
+ const map = store.parsedCookies;
153
+ return {
154
+ get(name) {
155
+ return map.get(name);
156
+ },
157
+ has(name) {
158
+ return map.has(name);
159
+ },
160
+ getAll() {
161
+ return Array.from(map.entries()).map(([name, value]) => ({
162
+ name,
163
+ value
164
+ }));
165
+ },
166
+ get size() {
167
+ return map.size;
168
+ },
169
+ set(name, value, options) {
170
+ assertMutable(store, "set");
171
+ assertValidCookieName(name);
172
+ if (typeof value !== "string") throw new Error(`[timber] getCookieJar().set(${JSON.stringify(name)}, …): value must be a string, got ${typeof value}.\n To store a JSON-serializable value, use defineCookie + jsonCookieCodec:\n\n import { defineCookie, jsonCookieCodec } from '@timber-js/app/cookies';\n\n export const ${name}Cookie = defineCookie(${JSON.stringify(name)}, {\n codec: jsonCookieCodec(),\n });\n\n ${name}Cookie.set(value);\n\n See design/29-cookies.md §"Typed Cookies with Schema Validation".`);
173
+ const raw = options?.raw === true;
174
+ const wireValue = raw ? value : encodeURIComponent(value);
175
+ if (raw) assertValidCookieValue(name, wireValue);
176
+ if (store.flushed) {
177
+ if (isDebug()) console.warn(`[timber] warn: getCookieJar().set('${name}') called after response headers were committed.\n The cookie will NOT be sent. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.`);
178
+ return;
179
+ }
180
+ const { raw: _raw, ...attributeOptions } = options ?? {};
181
+ const opts = {
182
+ ...DEFAULT_COOKIE_OPTIONS,
183
+ ...attributeOptions
184
+ };
185
+ store.cookieJar.set(name, {
186
+ name,
187
+ value: wireValue,
188
+ options: opts
189
+ });
190
+ map.set(name, raw ? wireValue : value);
191
+ },
192
+ setFromHeaders(headers) {
193
+ assertMutable(store, "setFromHeaders");
194
+ if (store.flushed) {
195
+ console.warn("[timber] warn: getCookieJar().setFromHeaders() called after response headers were committed.\n The cookies will NOT be sent. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.");
196
+ return;
197
+ }
198
+ for (const raw of headers.getSetCookie()) {
199
+ const parsed = parseSetCookie(raw);
200
+ if (parsed) setRaw(store, map, parsed.name, parsed.value, parsed.options);
201
+ }
202
+ },
203
+ delete(name, options) {
204
+ assertMutable(store, "delete");
205
+ assertValidCookieName(name);
206
+ if (store.flushed) {
207
+ if (isDebug()) console.warn(`[timber] warn: getCookieJar().delete('${name}') called after response headers were committed.\n The cookie will NOT be deleted. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.`);
208
+ return;
209
+ }
210
+ const opts = {
211
+ ...DEFAULT_COOKIE_OPTIONS,
212
+ ...options,
213
+ maxAge: 0,
214
+ expires: /* @__PURE__ */ new Date(0)
215
+ };
216
+ store.cookieJar.set(name, {
217
+ name,
218
+ value: "",
219
+ options: opts
220
+ });
221
+ map.delete(name);
222
+ },
223
+ clear() {
224
+ assertMutable(store, "clear");
225
+ if (store.flushed) return;
226
+ for (const name of Array.from(map.keys())) store.cookieJar.set(name, {
227
+ name,
228
+ value: "",
229
+ options: {
230
+ ...DEFAULT_COOKIE_OPTIONS,
231
+ maxAge: 0,
232
+ expires: /* @__PURE__ */ new Date(0)
233
+ }
234
+ });
235
+ map.clear();
236
+ },
237
+ toString() {
238
+ return Array.from(map.entries()).map(([name, value]) => `${name}=${encodeURIComponent(value)}`).join("; ");
239
+ }
240
+ };
241
+ }
242
+ /**
243
+ * Returns the value of a single cookie, or undefined if absent.
244
+ *
245
+ * @internal — not part of the public API. Use `defineCookie().get()` or `getCookieJar().get()` instead.
246
+ */
247
+ function getCookie(name) {
248
+ return getCookieJar().get(name);
249
+ }
250
+ var DEFAULT_COOKIE_OPTIONS = {
251
+ path: "/",
252
+ httpOnly: true,
253
+ secure: true,
254
+ sameSite: "lax"
255
+ };
256
+ /**
257
+ * Per-request seed map of cookie name → value, registered out-of-band so the
258
+ * pipeline's `runWithRequestContext` call can pick it up without changing
259
+ * the function's calling convention. Stored in a WeakMap keyed by the
260
+ * synthetic Request object built for the rerender path, so the seed lives
261
+ * exactly as long as the request and is collected with it.
262
+ *
263
+ * The seed exists to eliminate the parse/serialize round-trip on the no-JS
264
+ * form-rerender path — see ONGOING_SECURITY.md H-3 (TIM-868). The action's
265
+ * post-mutation RYW snapshot is threaded directly into the rerender scope's
266
+ * `parsedCookies` map, bypassing `parseCookieHeader` entirely.
267
+ */
268
+ var seededRequestCookies = /* @__PURE__ */ new WeakMap();
269
+ /**
270
+ * Pop the seed (if any) for `req` and return it. Called from
271
+ * `runWithRequestContext` exactly once per request — the seed is consumed
272
+ * eagerly so it cannot leak into a hypothetical future re-use of the same
273
+ * Request reference.
274
+ *
275
+ * @internal — framework use only.
276
+ */
277
+ function consumeSeededCookies(req) {
278
+ const seed = seededRequestCookies.get(req);
279
+ if (seed) seededRequestCookies.delete(req);
280
+ return seed;
281
+ }
282
+ /**
283
+ * Collect all Set-Cookie headers from the cookie jar.
284
+ * Called by the framework at flush time to apply cookies to the response.
285
+ *
286
+ * Returns an array of serialized Set-Cookie header values.
287
+ */
288
+ function getSetCookieHeaders() {
289
+ const store = requestContextAls.getStore();
290
+ if (!store) return [];
291
+ return Array.from(store.cookieJar.values()).map(serializeCookieEntry);
292
+ }
293
+ /** Throw if cookie mutation is attempted in a read-only context. */
294
+ function assertMutable(store, method) {
295
+ if (!store.mutableContext) throw new Error(`[timber] getCookieJar().${method}() cannot be called in this context.\n Set cookies in middleware.ts, server actions, or route.ts handlers.`);
296
+ }
297
+ /**
298
+ * Write a cookie to the jar WITHOUT merging DEFAULT_COOKIE_OPTIONS.
299
+ * Used by setFromHeaders to preserve the original header's attributes exactly.
300
+ *
301
+ * For deletion cookies (maxAge=0), the jar entry is still created so the
302
+ * Set-Cookie header is emitted, but the cookie is NOT added to the read map
303
+ * (it would be misleading — the cookie is being deleted).
304
+ */
305
+ function setRaw(store, readMap, name, value, options) {
306
+ assertValidCookieName(name);
307
+ assertValidCookieValue(name, value);
308
+ store.cookieJar.set(name, {
309
+ name,
310
+ value,
311
+ options
312
+ });
313
+ if (options.maxAge === 0) readMap.delete(name);
314
+ else readMap.set(name, safeDecodeCookieValue(value));
315
+ }
316
+ //#endregion
317
+ //#region src/server/request-context.ts
318
+ /**
319
+ * Request Context — per-request ALS store for headers, search params,
320
+ * segment params, and request scope lifecycle.
321
+ *
322
+ * Follows the same pattern as tracing.ts: a module-level AsyncLocalStorage
323
+ * instance, public accessor functions that throw outside request scope,
324
+ * and a framework-internal `runWithRequestContext()` to establish scope.
325
+ *
326
+ * Cookie state lives in `cookie-context.ts` (split out in TIM-853). The
327
+ * scope set up here owns the cookie jar / parsedCookies fields on the
328
+ * store, but the cookie API and helpers are in the cookie module.
329
+ *
330
+ * See design/04-authorization.md §"AccessContext does not include cookies or headers"
331
+ * and design/11-platform.md §"AsyncLocalStorage".
332
+ */
333
+ /**
334
+ * Returns a read-only view of the current request's headers.
335
+ *
336
+ * Available in middleware, access checks, server components, and server actions.
337
+ * Throws if called outside a request context (security principle #2: no global fallback).
338
+ */
339
+ function getHeaders() {
340
+ const store = requestContextAls.getStore();
341
+ if (!store) throw new Error("[timber] getHeaders() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
342
+ return store.headers;
343
+ }
344
+ /**
345
+ * Returns the value of a single request header, or undefined if absent.
346
+ *
347
+ * Thin wrapper over `getHeaders().get(name)` for the common case where
348
+ * you need exactly one header.
349
+ *
350
+ * @internal — not part of the public API. Use `getHeaders().get(name)` instead.
351
+ */
352
+ function getHeader(name) {
353
+ return getHeaders().get(name) ?? void 0;
354
+ }
355
+ /**
356
+ * Returns the current request's raw URLSearchParams.
357
+ *
358
+ * @internal — not part of the public API. Use `defineSearchParams().get()` instead.
359
+ */
360
+ function getSearchParams() {
361
+ const store = requestContextAls.getStore();
362
+ if (!store) throw new Error("[timber] getSearchParams() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
363
+ return store.searchParams;
364
+ }
365
+ _setGetSearchParamsFn(getSearchParams);
366
+ _setGetSegmentParamsFn(getSegmentParams);
367
+ /**
368
+ * Returns the current request's coerced segment params.
369
+ *
370
+ * The optional `segmentPath` argument exists only for TypeScript narrowing —
371
+ * it does not affect the runtime return value. Pass a segment path
372
+ * (e.g. `'/(browse)/[artistSlug]/[year]'`) to narrow the return type to the
373
+ * exact params shape for that segment.
374
+ *
375
+ * Without an argument, returns all coerced params with optional types.
376
+ *
377
+ * See design/41-global-params.md §Function Signatures
378
+ */
379
+ function getSegmentParams(segmentPath) {
380
+ const store = requestContextAls.getStore();
381
+ if (!store) throw new Error("[timber] getSegmentParams() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
382
+ if (!store.segmentParams) throw new Error("[timber] getSegmentParams() called before route matching completed. Segment params are not available until after the route is matched.");
383
+ if (segmentPath && store.slotParamsMap?.has(segmentPath)) {
384
+ const slotParams = store.slotParamsMap.get(segmentPath);
385
+ return {
386
+ ...store.segmentParams,
387
+ ...slotParams
388
+ };
389
+ }
390
+ if (segmentPath && isDebug() && store.matchedSegmentPath) {
391
+ const expected = extractDynamicSegments(segmentPath);
392
+ const actual = extractDynamicSegments(store.matchedSegmentPath);
393
+ const missing = expected.filter((s) => !actual.includes(s));
394
+ if (missing.length > 0) console.warn(`[timber] getSegmentParams('${segmentPath}') called but current segment is '${store.matchedSegmentPath}'\n Missing params: ${missing.join(", ")}\n These will be undefined at runtime despite the type annotation.`);
395
+ }
396
+ return store.segmentParams;
397
+ }
398
+ /**
399
+ * Set the segment params on the current request context.
400
+ * Called by the pipeline after route matching and param coercion.
401
+ *
402
+ * @internal — framework use only
403
+ */
404
+ function setSegmentParams(params) {
405
+ const store = requestContextAls.getStore();
406
+ if (!store) throw new Error("[timber] setSegmentParams() called outside of a request context.");
407
+ store.segmentParams = params;
408
+ }
409
+ /**
410
+ * Store the matched segment path (e.g. '/(browse)/[artistSlug]/[year]') for
411
+ * dev-mode validation in getSegmentParams().
412
+ *
413
+ * @internal — framework use only
414
+ */
415
+ function setMatchedSegmentPath(segmentPath) {
416
+ const store = requestContextAls.getStore();
417
+ if (!store) return;
418
+ store.matchedSegmentPath = segmentPath;
419
+ }
420
+ /**
421
+ * Extract dynamic segment names from a route pattern.
422
+ * '/[artistSlug]/[year]' → ['artistSlug', 'year']
423
+ * '/docs/[...slug]' → ['slug']
424
+ */
425
+ function extractDynamicSegments(route) {
426
+ const segments = [];
427
+ const re = /\[{1,2}\.{0,3}(\w+)\]{1,2}/g;
428
+ let m;
429
+ while ((m = re.exec(route)) !== null) segments.push(m[1]);
430
+ return segments;
431
+ }
432
+ /**
433
+ * Returns the raw search string from the current request URL (e.g. "?foo=bar").
434
+ * Synchronous — safe for use in `redirect()` which throws synchronously.
435
+ *
436
+ * Returns empty string if called outside a request context (non-throwing for
437
+ * use in redirect's optional preserveSearchParams path).
438
+ *
439
+ * @internal — used by redirect() for preserveSearchParams support.
440
+ */
441
+ function getRequestSearchString() {
442
+ return requestContextAls.getStore()?.searchString ?? "";
443
+ }
444
+ /**
445
+ * Run a callback within a request context. Used by the pipeline to establish
446
+ * per-request ALS scope so that `getHeaders()` and `getCookies()` work.
447
+ *
448
+ * If the request was previously registered via `seedRequestCookies`, the
449
+ * resulting context's `parsedCookies` map is initialized from the seed and
450
+ * the raw `cookieHeader` is left empty — `parseCookieHeader` is never called
451
+ * for that request. This is the no-JS form-rerender path. See TIM-868.
452
+ *
453
+ * @param req - The incoming Request object.
454
+ * @param fn - The function to run within the request context.
455
+ */
456
+ function runWithRequestContext(req, fn) {
457
+ const originalCopy = new Headers(req.headers);
458
+ const parsedUrl = new URL(req.url);
459
+ const seed = consumeSeededCookies(req);
460
+ const store = {
461
+ headers: freezeHeaders(req.headers),
462
+ originalHeaders: originalCopy,
463
+ cookieHeader: seed ? "" : req.headers.get("cookie") ?? "",
464
+ parsedCookies: seed,
465
+ searchParams: parsedUrl.searchParams,
466
+ searchString: parsedUrl.search,
467
+ cookieJar: /* @__PURE__ */ new Map(),
468
+ flushed: false,
469
+ mutableContext: false
470
+ };
471
+ return requestContextAls.run(store, fn);
472
+ }
473
+ /**
474
+ * Enable cookie mutation for the current context. Called by the framework
475
+ * when entering middleware.ts, server actions, or route.ts handlers.
476
+ *
477
+ * See design/29-cookies.md §"Context Tracking"
478
+ */
479
+ function setMutableCookieContext(mutable) {
480
+ const store = requestContextAls.getStore();
481
+ if (store) store.mutableContext = mutable;
482
+ }
483
+ /**
484
+ * Mark the response as flushed (headers committed). After this point,
485
+ * cookie mutations log a warning instead of throwing.
486
+ *
487
+ * See design/29-cookies.md §"Streaming Constraint: Post-Flush Cookie Warning"
488
+ */
489
+ function markResponseFlushed() {
490
+ const store = requestContextAls.getStore();
491
+ if (store) store.flushed = true;
492
+ }
493
+ /**
494
+ * Apply middleware-injected request headers to the current request context.
495
+ *
496
+ * Called by the pipeline after middleware.ts runs. Merges overlay headers
497
+ * on top of the original request headers so downstream code (access.ts,
498
+ * server components, server actions) sees them via `getHeaders()`.
499
+ *
500
+ * The original request headers are never mutated — a new frozen Headers
501
+ * object is created with the overlay applied on top.
502
+ *
503
+ * See design/07-routing.md §"Request Header Injection"
504
+ */
505
+ function applyRequestHeaderOverlay(overlay) {
506
+ const store = requestContextAls.getStore();
507
+ if (!store) throw new Error("[timber] applyRequestHeaderOverlay() called outside of a request context.");
508
+ let hasOverlay = false;
509
+ overlay.forEach(() => {
510
+ hasOverlay = true;
511
+ });
512
+ if (!hasOverlay) return;
513
+ const merged = new Headers(store.originalHeaders);
514
+ overlay.forEach((value, key) => {
515
+ merged.set(key, value);
516
+ });
517
+ store.headers = freezeHeaders(merged);
518
+ }
519
+ var MUTATING_METHODS = new Set([
520
+ "set",
521
+ "append",
522
+ "delete"
523
+ ]);
524
+ /**
525
+ * Wrap a Headers object in a Proxy that throws on mutating methods.
526
+ * Object.freeze doesn't work on Headers (native internal slots), so we
527
+ * intercept property access and reject set/append/delete at runtime.
528
+ *
529
+ * Read methods (get, has, entries, etc.) must be bound to the underlying
530
+ * Headers instance because they access private #headersList slots.
531
+ */
532
+ function freezeHeaders(source) {
533
+ const copy = new Headers(source);
534
+ return new Proxy(copy, { get(target, prop) {
535
+ if (typeof prop === "string" && MUTATING_METHODS.has(prop)) return () => {
536
+ throw new Error(`[timber] getHeaders() returns a read-only Headers object. Calling .${prop}() is not allowed. Use ctx.requestHeaders in middleware to inject headers for downstream components.`);
537
+ };
538
+ const value = Reflect.get(target, prop);
539
+ if (typeof value === "function") return value.bind(target);
540
+ return value;
541
+ } });
542
+ }
543
+ //#endregion
544
+ //#region src/server/waituntil-bridge.ts
545
+ /**
546
+ * Per-request waitUntil bridge — ALS bridge for platform adapters.
547
+ *
548
+ * The generated entry point (Nitro, Cloudflare) wraps the handler with
549
+ * `runWithWaitUntil`, binding the platform's lifecycle extension function
550
+ * (e.g., h3's `event.waitUntil()` or CF's `ctx.waitUntil()`) for the
551
+ * request duration. The `waitUntil()` primitive reads from this ALS to
552
+ * dispatch background work to the correct platform API.
553
+ *
554
+ * Design doc: design/11-platform.md §"waitUntil()"
555
+ */
556
+ /**
557
+ * Get the current request's waitUntil function, if available.
558
+ *
559
+ * Returns undefined when no platform adapter has installed a waitUntil
560
+ * handler for the current request (e.g., on platforms that don't support
561
+ * lifecycle extension, or outside a request context).
562
+ */
563
+ function getWaitUntil() {
564
+ return waitUntilAls.getStore();
565
+ }
566
+ //#endregion
567
+ //#region src/server/primitives.ts
568
+ /**
569
+ * Check if a value is JSON-serializable without data loss.
570
+ * Returns a description of the first non-serializable value found, or null if OK.
571
+ *
572
+ * @internal Exported for testing only.
573
+ */
574
+ function findNonSerializable(value, path = "data") {
575
+ if (value === null || value === void 0) return null;
576
+ switch (typeof value) {
577
+ case "string":
578
+ case "number":
579
+ case "boolean": return null;
580
+ case "bigint": return `${path} contains a BigInt — BigInt throws in JSON.stringify`;
581
+ case "function": return `${path} is a function — functions are not JSON-serializable`;
582
+ case "symbol": return `${path} is a symbol — symbols are not JSON-serializable`;
583
+ case "object": break;
584
+ default: return `${path} has unsupported type "${typeof value}"`;
585
+ }
586
+ if (value instanceof Date) return `${path} is a Date — Dates silently coerce to strings in JSON.stringify`;
587
+ if (value instanceof Map) return `${path} is a Map — Maps serialize as {} in JSON.stringify (data loss)`;
588
+ if (value instanceof Set) return `${path} is a Set — Sets serialize as {} in JSON.stringify (data loss)`;
589
+ if (value instanceof RegExp) return `${path} is a RegExp — RegExps serialize as {} in JSON.stringify`;
590
+ if (value instanceof Error) return `${path} is an Error — Errors serialize as {} in JSON.stringify`;
591
+ if (Array.isArray(value)) {
592
+ for (let i = 0; i < value.length; i++) {
593
+ const result = findNonSerializable(value[i], `${path}[${i}]`);
594
+ if (result) return result;
595
+ }
596
+ return null;
597
+ }
598
+ const proto = Object.getPrototypeOf(value);
599
+ if (proto === null) return `${path} is a null-prototype object — React Flight rejects null prototypes`;
600
+ if (proto !== Object.prototype) return `${path} is a ${value.constructor?.name ?? "unknown"} instance — class instances may lose data in JSON.stringify`;
601
+ for (const key of Object.keys(value)) {
602
+ const result = findNonSerializable(value[key], `${path}.${key}`);
603
+ if (result) return result;
604
+ }
605
+ return null;
606
+ }
607
+ /**
608
+ * Emit a dev-mode warning if data is not JSON-serializable.
609
+ * No-op in production.
610
+ */
611
+ function warnIfNotSerializable(data, callerName) {
612
+ if (!isDebug()) return;
613
+ if (data === void 0) return;
614
+ const issue = findNonSerializable(data);
615
+ if (issue) console.warn(`[timber] ${callerName}: ${issue}. Data passed to deny() or RenderError must be JSON-serializable because the post-flush path uses JSON.stringify, not React Flight.`);
616
+ }
617
+ /**
618
+ * Render-phase signal thrown by `deny()`. Caught by the framework to produce
619
+ * the correct HTTP status code (segment context) or graceful degradation (slot context).
620
+ */
621
+ var DenySignal = class extends Error {
622
+ status;
623
+ data;
624
+ constructor(status, data) {
625
+ super(`Access denied with status ${status}`);
626
+ this.name = "DenySignal";
627
+ this.status = status;
628
+ this.data = data;
629
+ }
630
+ /**
631
+ * Extract the file that called deny() from the stack trace.
632
+ * Returns a short path (e.g. "app/auth/access.ts") or undefined if
633
+ * the stack can't be parsed. Dev-only — used for dev log output.
634
+ */
635
+ get sourceFile() {
636
+ if (!this.stack) return void 0;
637
+ const frames = this.stack.split("\n");
638
+ for (let i = 2; i < frames.length; i++) {
639
+ const frame = frames[i];
640
+ if (!frame) continue;
641
+ if (frame.includes("primitives.ts") || frame.includes("node_modules")) continue;
642
+ const match = frame.match(/\(([^)]+?)(?::\d+:\d+)\)/) ?? frame.match(/at\s+([^\s]+?)(?::\d+:\d+)/);
643
+ if (match?.[1]) {
644
+ const full = match[1];
645
+ const appIdx = full.indexOf("/app/");
646
+ return appIdx >= 0 ? full.slice(appIdx + 1) : full;
647
+ }
648
+ }
649
+ }
650
+ };
651
+ /**
652
+ * Universal denial/error primitive. Throws a `DenySignal` that the framework catches.
653
+ *
654
+ * - In segment context (outside Suspense): produces HTTP status code
655
+ * - In slot context: graceful degradation → denied.tsx → default.tsx → null
656
+ * - Inside Suspense (hold window): promoted to pre-flush behavior
657
+ * - Inside Suspense (after flush): error boundary + noindex meta
658
+ *
659
+ * Supports both positional and object signatures:
660
+ * ```ts
661
+ * deny() // 403 (default)
662
+ * deny(404) // 404
663
+ * deny(503, { retry: true }) // 503 with data
664
+ * deny({ status: 503, message: 'Maintenance' }) // object form
665
+ * ```
666
+ *
667
+ * Accepts any 4xx or 5xx status code. This replaces the need for
668
+ * `throw new RenderError(...)` in user code — RenderError is now an
669
+ * internal pipeline detail.
670
+ *
671
+ * @param statusOrOptions - Status code (number) or options object. Default: 403.
672
+ * @param data - Optional JSON-serializable data (positional form only).
673
+ */
674
+ function deny(statusOrOptions, data) {
675
+ let status;
676
+ let resolvedData;
677
+ if (typeof statusOrOptions === "object" && statusOrOptions !== null) {
678
+ status = statusOrOptions.status ?? 403;
679
+ resolvedData = statusOrOptions.data;
680
+ } else {
681
+ status = statusOrOptions ?? 403;
682
+ resolvedData = data;
683
+ }
684
+ if (status < 400 || status > 599) throw new Error(`deny() requires a 4xx or 5xx status code, got ${status}.`);
685
+ warnIfNotSerializable(resolvedData, "deny()");
686
+ throw new DenySignal(status, resolvedData);
687
+ }
688
+ /**
689
+ * Next.js redirect type discriminator.
690
+ *
691
+ * Provided for API compatibility with libraries that import `RedirectType`
692
+ * from `next/navigation`. In timber, `redirect()` always uses `replace`
693
+ * semantics (no history entry for the redirect itself).
694
+ */
695
+ var RedirectType = {
696
+ push: "push",
697
+ replace: "replace"
698
+ };
699
+ /**
700
+ * Render-phase signal thrown by `redirect()` and `redirectExternal()`.
701
+ * Caught by the framework to produce a 3xx response or client-side navigation.
702
+ */
703
+ var RedirectSignal = class extends Error {
704
+ location;
705
+ status;
706
+ constructor(location, status) {
707
+ super(`Redirect to ${location}`);
708
+ this.name = "RedirectSignal";
709
+ this.location = location;
710
+ this.status = status;
711
+ }
712
+ };
713
+ /** Pattern matching absolute URLs: http(s):// or protocol-relative // */
714
+ var ABSOLUTE_URL_RE = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/)/;
715
+ /**
716
+ * Redirect to a relative path. Rejects absolute and protocol-relative URLs.
717
+ * Use `redirectExternal()` for external redirects with an allow-list.
718
+ *
719
+ * @param path - Relative path (e.g. '/login', 'settings', '/login?returnTo=/dash')
720
+ * @param statusOrOptions - HTTP status code (3xx, default 302) or options object.
721
+ *
722
+ * @example
723
+ * // Simple redirect
724
+ * redirect('/login');
725
+ *
726
+ * // With status code
727
+ * redirect('/login', 301);
728
+ *
729
+ * // With preserved search params
730
+ * redirect(`/docs/${version}/${slug}`, { preserveSearchParams: ['foo'] });
731
+ */
732
+ function redirect(path, statusOrOptions) {
733
+ let status;
734
+ let preserveSearchParams;
735
+ if (typeof statusOrOptions === "number") status = statusOrOptions;
736
+ else if (statusOrOptions) {
737
+ status = statusOrOptions.status ?? (statusOrOptions.permanent ? 308 : 302);
738
+ preserveSearchParams = statusOrOptions.preserveSearchParams;
739
+ } else status = 302;
740
+ if (status < 300 || status > 399) throw new Error(`redirect() requires a 3xx status code, got ${status}.`);
741
+ if (ABSOLUTE_URL_RE.test(path)) throw new Error(`redirect() only accepts relative URLs. Got absolute URL: "${path}". Use redirectExternal(url, allowList) for external redirects.`);
742
+ let resolvedPath = path;
743
+ if (preserveSearchParams) resolvedPath = mergePreservedSearchParams(path, getRequestSearchString(), preserveSearchParams);
744
+ throw new RedirectSignal(resolvedPath, status);
745
+ }
746
+ /**
747
+ * Redirect to an external URL. The hostname must be in the provided allow-list.
748
+ *
749
+ * @param url - Absolute URL to redirect to.
750
+ * @param allowList - Array of allowed hostnames (e.g. ['example.com', 'auth.example.com']).
751
+ * @param status - HTTP redirect status code (3xx). Defaults to 302.
752
+ */
753
+ function redirectExternal(url, allowList, status = 302) {
754
+ if (status < 300 || status > 399) throw new Error(`redirectExternal() requires a 3xx status code, got ${status}.`);
755
+ let hostname;
756
+ try {
757
+ hostname = new URL(url).hostname;
758
+ } catch {
759
+ throw new Error(`redirectExternal() received an invalid URL: "${url}"`);
760
+ }
761
+ if (!allowList.includes(hostname)) throw new Error(`redirectExternal() target "${hostname}" is not in the allow-list. Allowed: [${allowList.join(", ")}]`);
762
+ throw new RedirectSignal(url, status);
763
+ }
764
+ /**
765
+ * Typed throw for render-phase errors that carry structured context to error boundaries.
766
+ *
767
+ * The `digest` (code + data) is serialized into the RSC stream separately from the
768
+ * Error instance — only the digest crosses the RSC → client boundary.
769
+ *
770
+ * @example
771
+ * ```ts
772
+ * throw new RenderError('PRODUCT_NOT_FOUND', {
773
+ * title: 'Product not found',
774
+ * resourceId: params.id,
775
+ * })
776
+ * ```
777
+ */
778
+ var RenderError = class extends Error {
779
+ code;
780
+ digest;
781
+ status;
782
+ constructor(code, data, options) {
783
+ super(`RenderError: ${code}`);
784
+ this.name = "RenderError";
785
+ this.code = code;
786
+ this.digest = {
787
+ code,
788
+ data
789
+ };
790
+ warnIfNotSerializable(data, "RenderError");
791
+ const status = options?.status ?? 500;
792
+ if (status < 400 || status > 599) throw new Error(`RenderError status must be 4xx or 5xx, got ${status}.`);
793
+ this.status = status;
794
+ }
795
+ };
796
+ var _waitUntilWarned = false;
797
+ /**
798
+ * Register a promise to be kept alive after the response is sent.
799
+ * Maps to `ctx.waitUntil()` on Cloudflare Workers and similar platforms.
800
+ *
801
+ * In production, the platform adapter installs a per-request waitUntil
802
+ * function via ALS (see waituntil-bridge.ts). This function checks the
803
+ * ALS bridge first, then falls back to the legacy adapter argument.
804
+ *
805
+ * If neither is available, a warning is logged once and the promise is
806
+ * left to resolve (or reject) without being tracked.
807
+ *
808
+ * @param promise - The background work to keep alive.
809
+ * @param adapter - Optional legacy adapter (prefer ALS bridge in production).
810
+ */
811
+ function waitUntil(promise, adapter) {
812
+ const alsFn = getWaitUntil();
813
+ if (alsFn) {
814
+ alsFn(promise);
815
+ return;
816
+ }
817
+ if (adapter && typeof adapter.waitUntil === "function") {
818
+ adapter.waitUntil(promise);
819
+ return;
820
+ }
821
+ if (!_waitUntilWarned) {
822
+ _waitUntilWarned = true;
823
+ console.warn("[timber] waitUntil() is not supported by the current adapter. Background work will not be tracked. This warning is shown once.");
824
+ }
825
+ }
826
+ //#endregion
827
+ //#region src/server/form-data.ts
828
+ /**
829
+ * FormData preprocessing — schema-agnostic conversion of FormData to typed objects.
830
+ *
831
+ * FormData is all strings. Schema validation expects typed values. This module
832
+ * bridges the gap with intelligent coercion that runs *before* schema validation.
833
+ *
834
+ * Inspired by zod-form-data, but schema-agnostic — works with any Standard Schema
835
+ * library (Zod, Valibot, ArkType).
836
+ *
837
+ * See design/08-forms-and-actions.md §"parseFormData() and coerce helpers"
838
+ */
839
+ /**
840
+ * Convert FormData into a plain object with intelligent coercion.
841
+ *
842
+ * Handles:
843
+ * - **Duplicate keys → arrays**: `tags=js&tags=ts` → `{ tags: ["js", "ts"] }`
844
+ * - **Nested dot-paths**: `user.name=Alice` → `{ user: { name: "Alice" } }`
845
+ * - **Empty strings → undefined**: Enables `.optional()` semantics in schemas
846
+ * - **Empty Files → undefined**: File inputs with no selection become `undefined`
847
+ * - **Strips `$ACTION_*` fields**: React's internal hidden fields are excluded
848
+ */
849
+ function parseFormData(formData) {
850
+ const flat = {};
851
+ for (const key of new Set(formData.keys())) {
852
+ if (key.startsWith("$ACTION_")) continue;
853
+ if (DANGEROUS_KEYS.has(key)) continue;
854
+ const processed = formData.getAll(key).map(normalizeValue);
855
+ if (processed.length === 1) flat[key] = processed[0];
856
+ else flat[key] = processed.filter((v) => v !== void 0);
857
+ }
858
+ return expandDotPaths(flat);
859
+ }
860
+ /**
861
+ * Normalize a single FormData entry value.
862
+ * - Empty strings → undefined (enables .optional() semantics)
863
+ * - Empty File objects (no selection) → undefined
864
+ * - Everything else passes through as-is
865
+ */
866
+ function normalizeValue(value) {
867
+ if (typeof value === "string") return value === "" ? void 0 : value;
868
+ if (value instanceof File && value.size === 0 && value.name === "") return;
869
+ return value;
870
+ }
871
+ /**
872
+ * Expand dot-notation keys into nested objects.
873
+ * `{ "user.name": "Alice", "user.age": "30" }` → `{ user: { name: "Alice", age: "30" } }`
874
+ *
875
+ * Keys without dots are left as-is. Bracket notation (e.g. `items[0]`) is NOT
876
+ * supported — use dot notation (`items.0`) instead.
877
+ */
878
+ function expandDotPaths(flat) {
879
+ const result = {};
880
+ let hasDotPaths = false;
881
+ for (const key of Object.keys(flat)) if (key.includes(".")) {
882
+ hasDotPaths = true;
883
+ break;
884
+ }
885
+ if (!hasDotPaths) return flat;
886
+ for (const [key, value] of Object.entries(flat)) {
887
+ const parts = key.split(".");
888
+ if (parts.some((p) => DANGEROUS_KEYS.has(p))) continue;
889
+ if (parts.length === 1) {
890
+ result[parts[0]] = value;
891
+ continue;
892
+ }
893
+ let current = result;
894
+ for (let i = 0; i < parts.length - 1; i++) {
895
+ const part = parts[i];
896
+ if (current[part] === void 0 || current[part] === null) current[part] = {};
897
+ if (typeof current[part] !== "object" || current[part] instanceof File) current[part] = {};
898
+ current = current[part];
899
+ }
900
+ current[parts[parts.length - 1]] = value;
901
+ }
902
+ return result;
903
+ }
904
+ var DANGEROUS_KEYS = new Set(["__proto__"]);
905
+ /**
906
+ * Schema-agnostic coercion primitives for common FormData patterns.
907
+ *
908
+ * These are plain transform functions — they compose with any schema library's
909
+ * `transform`/`preprocess` pipeline:
910
+ *
911
+ * ```ts
912
+ * // Zod
913
+ * z.preprocess(coerce.number, z.number())
914
+ * // Valibot
915
+ * v.pipe(v.unknown(), v.transform(coerce.number), v.number())
916
+ * ```
917
+ */
918
+ var coerce = {
919
+ number(value) {
920
+ if (value === void 0 || value === null || value === "") return void 0;
921
+ if (typeof value === "number") return value;
922
+ if (typeof value !== "string") return void 0;
923
+ const num = Number(value);
924
+ if (Number.isNaN(num)) return void 0;
925
+ return num;
926
+ },
927
+ checkbox(value) {
928
+ if (value === void 0 || value === null || value === "") return false;
929
+ if (typeof value === "boolean") return value;
930
+ return typeof value === "string" && value.length > 0;
931
+ },
932
+ json(value) {
933
+ if (value === void 0 || value === null || value === "") return void 0;
934
+ if (typeof value !== "string") return value;
935
+ try {
936
+ return JSON.parse(value);
937
+ } catch {
938
+ return;
939
+ }
940
+ },
941
+ date(value) {
942
+ if (value === void 0 || value === null || value === "") return void 0;
943
+ if (value instanceof Date) return value;
944
+ if (typeof value !== "string") return void 0;
945
+ const date = new Date(value);
946
+ if (Number.isNaN(date.getTime())) return void 0;
947
+ const ymdMatch = value.match(/^(\d{4})-(\d{2})-(\d{2})/);
948
+ if (ymdMatch) {
949
+ const inputYear = Number(ymdMatch[1]);
950
+ const inputMonth = Number(ymdMatch[2]);
951
+ const inputDay = Number(ymdMatch[3]);
952
+ const isUTC = value.length === 10 || value.endsWith("Z");
953
+ const parsedYear = isUTC ? date.getUTCFullYear() : date.getFullYear();
954
+ const parsedMonth = isUTC ? date.getUTCMonth() + 1 : date.getMonth() + 1;
955
+ const parsedDay = isUTC ? date.getUTCDate() : date.getDate();
956
+ if (inputYear !== parsedYear || inputMonth !== parsedMonth || inputDay !== parsedDay) return;
957
+ }
958
+ return date;
959
+ },
960
+ file(options) {
961
+ return (value) => {
962
+ if (value === void 0 || value === null || value === "") return void 0;
963
+ if (!(value instanceof File)) return void 0;
964
+ if (value.size === 0 && value.name === "") return void 0;
965
+ if (options?.maxSize !== void 0 && value.size > options.maxSize) return;
966
+ if (options?.accept !== void 0 && !options.accept.includes(value.type)) return;
967
+ return value;
968
+ };
969
+ }
970
+ };
971
+ //#endregion
972
+ //#region src/server/actions.ts
973
+ /**
974
+ * Server action primitives: revalidatePath, revalidateTag, and the action handler.
975
+ *
976
+ * - revalidatePath(path) re-renders the route at that path and returns the RSC
977
+ * flight payload for inline reconciliation.
978
+ * - revalidateTag(tag) invalidates timber.cache entries by tag.
979
+ *
980
+ * Both are callable from anywhere on the server — actions, API routes, handlers.
981
+ *
982
+ * The action handler processes incoming action requests, validates CSRF,
983
+ * enforces body limits, executes the action, and returns the response
984
+ * (with piggybacked RSC payload if revalidatePath was called).
985
+ *
986
+ * See design/08-forms-and-actions.md
987
+ */
988
+ /**
989
+ * Get the current revalidation state. Throws if called outside an action context.
990
+ * @internal
991
+ */
992
+ function getRevalidationState() {
993
+ const state = revalidationAls.getStore();
994
+ if (!state) throw new Error("revalidatePath/revalidateTag called outside of a server action context. These functions can only be called during action execution.");
995
+ return state;
996
+ }
997
+ /**
998
+ * Re-render the route at `path` and include the RSC flight payload in the
999
+ * action response. The client reconciles inline — no separate fetch needed.
1000
+ *
1001
+ * Can be called from server actions, API routes, or any server-side context.
1002
+ *
1003
+ * @param path - The path to re-render (e.g. '/dashboard', '/todos').
1004
+ */
1005
+ function revalidatePath(path) {
1006
+ const state = getRevalidationState();
1007
+ if (!state.paths.includes(path)) state.paths.push(path);
1008
+ }
1009
+ /**
1010
+ * Invalidate all timber.cache entries tagged with `tag`.
1011
+ * Does not return a payload — the next request for an invalidated entry re-executes.
1012
+ *
1013
+ * @param tag - The cache tag to invalidate (e.g. 'products', 'user:123').
1014
+ */
1015
+ function revalidateTag(tag) {
1016
+ const state = getRevalidationState();
1017
+ if (!state.tags.includes(tag)) state.tags.push(tag);
1018
+ }
1019
+ /**
1020
+ * Execute a server action and process revalidation.
1021
+ *
1022
+ * 1. Sets up revalidation state
1023
+ * 2. Calls the action function
1024
+ * 3. Processes revalidateTag calls (invalidates cache entries)
1025
+ * 4. Processes revalidatePath calls (re-renders and captures RSC payload)
1026
+ * 5. Returns the action result + optional RSC payload
1027
+ *
1028
+ * @param actionFn - The server action function to execute.
1029
+ * @param args - Arguments to pass to the action.
1030
+ * @param config - Handler configuration (cache handler, renderer).
1031
+ */
1032
+ async function executeAction(actionFn, args, config = {}, spanMeta) {
1033
+ const state = {
1034
+ paths: [],
1035
+ tags: []
1036
+ };
1037
+ let actionResult;
1038
+ let redirectTo;
1039
+ let redirectStatus;
1040
+ await revalidationAls.run(state, async () => {
1041
+ try {
1042
+ actionResult = await withSpan("timber.action", {
1043
+ ...spanMeta?.actionFile ? { "timber.action_file": spanMeta.actionFile } : {},
1044
+ ...spanMeta?.actionName ? { "timber.action_name": spanMeta.actionName } : {}
1045
+ }, () => actionFn(...args));
1046
+ } catch (error) {
1047
+ if (error instanceof RedirectSignal) {
1048
+ redirectTo = error.location;
1049
+ redirectStatus = error.status;
1050
+ } else throw error;
1051
+ }
1052
+ });
1053
+ if (state.tags.length > 0) {
1054
+ const handler = getCacheHandler();
1055
+ await Promise.all(state.tags.map((tag) => handler.invalidate({ tag })));
1056
+ }
1057
+ let revalidation;
1058
+ if (state.paths.length > 0 && config.renderer) {
1059
+ const path = state.paths[0];
1060
+ try {
1061
+ revalidation = await config.renderer(path);
1062
+ } catch (renderError) {
1063
+ if (renderError instanceof RedirectSignal) {
1064
+ redirectTo = renderError.location;
1065
+ redirectStatus = renderError.status;
1066
+ } else console.error("[timber] revalidatePath render failed:", renderError);
1067
+ }
1068
+ }
1069
+ return {
1070
+ actionResult,
1071
+ revalidation,
1072
+ ...redirectTo ? {
1073
+ redirectTo,
1074
+ redirectStatus
1075
+ } : {}
1076
+ };
1077
+ }
1078
+ /**
1079
+ * Build an HTTP Response for a no-JS form submission.
1080
+ * Standard POST → 302 redirect pattern.
1081
+ *
1082
+ * @param redirectPath - Where to redirect after the action executes.
1083
+ */
1084
+ function buildNoJsResponse(redirectPath, status = 302) {
1085
+ return new Response(null, {
1086
+ status,
1087
+ headers: { Location: redirectPath }
1088
+ });
1089
+ }
1090
+ /**
1091
+ * Detect whether the incoming request is an RSC action request (with JS)
1092
+ * or a plain HTML form POST (no JS).
1093
+ *
1094
+ * RSC action requests use Accept: text/x-component or Content-Type: text/x-component.
1095
+ */
1096
+ function isRscActionRequest(req) {
1097
+ const accept = req.headers.get("Accept") ?? "";
1098
+ const contentType = req.headers.get("Content-Type") ?? "";
1099
+ return accept.includes("text/x-component") || contentType.includes("text/x-component");
1100
+ }
1101
+ //#endregion
1102
+ export { setMatchedSegmentPath as C, getCookieJar as D, getCookie as E, getSetCookieHeaders as O, runWithRequestContext as S, setSegmentParams as T, getHeader as _, revalidateTag as a, getSegmentParams as b, DenySignal as c, RenderError as d, deny as f, applyRequestHeaderOverlay as g, waitUntil as h, revalidatePath as i, RedirectSignal as l, redirectExternal as m, executeAction as n, coerce as o, redirect as p, isRscActionRequest as r, parseFormData as s, buildNoJsResponse as t, RedirectType as u, getHeaders as v, setMutableCookieContext as w, markResponseFlushed as x, getSearchParams as y };
1103
+
1104
+ //# sourceMappingURL=actions-BNhpxrnV.js.map