@timber-js/app 0.2.0-alpha.239 → 0.2.0-alpha.240

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 (332) hide show
  1. package/dist/_chunks/{actions-Top9GftB.js → actions-DIgnvDrG.js} +4 -4
  2. package/dist/_chunks/{actions-Top9GftB.js.map → actions-DIgnvDrG.js.map} +1 -1
  3. package/dist/_chunks/{als-registry-DpygwCp0.js → als-registry-PPYstxK0.js} +2 -1
  4. package/dist/_chunks/{als-registry-DpygwCp0.js.map → als-registry-PPYstxK0.js.map} +1 -1
  5. package/dist/_chunks/{cache-api-Bo8c7XVF.js → cache-api-uWQwuxWb.js} +5 -5
  6. package/dist/_chunks/{cache-api-Bo8c7XVF.js.map → cache-api-uWQwuxWb.js.map} +1 -1
  7. package/dist/_chunks/{chains-DMoHX4yH.js → chains-C7CExrUI.js} +2 -2
  8. package/dist/_chunks/{chains-DMoHX4yH.js.map → chains-C7CExrUI.js.map} +1 -1
  9. package/dist/_chunks/chains-CSslTUdI.js +1 -0
  10. package/dist/_chunks/{classify-BwyAd-dZ.js → classify-Cj9EeZoL.js} +2 -2
  11. package/dist/_chunks/{classify-BwyAd-dZ.js.map → classify-Cj9EeZoL.js.map} +1 -1
  12. package/dist/_chunks/{cli-check-DQAD9MLo.js → cli-check-C3QOAru7.js} +3 -3
  13. package/dist/_chunks/{cli-check-DQAD9MLo.js.map → cli-check-C3QOAru7.js.map} +1 -1
  14. package/dist/_chunks/{cli-schema-sync-C_xNLqBj.js → cli-schema-sync-BRxZz66D.js} +1 -1
  15. package/dist/_chunks/{cli-schema-sync-CmGls3dc.js → cli-schema-sync-DQUS_o3V.js} +2 -2
  16. package/dist/_chunks/{cli-schema-sync-CmGls3dc.js.map → cli-schema-sync-DQUS_o3V.js.map} +1 -1
  17. package/dist/_chunks/{client-dep-entries-C5BTQtFS.js → client-dep-entries-ZETBdLgv.js} +2 -2
  18. package/dist/_chunks/{client-dep-entries-C5BTQtFS.js.map → client-dep-entries-ZETBdLgv.js.map} +1 -1
  19. package/dist/_chunks/{convention-lint-GQA6WTRo.js → convention-lint-BoVISNS6.js} +3 -3
  20. package/dist/_chunks/{convention-lint-GQA6WTRo.js.map → convention-lint-BoVISNS6.js.map} +1 -1
  21. package/dist/_chunks/dev-server-B8roKA3Q.js +1 -0
  22. package/dist/_chunks/{dev-server-Cr3_Fu5A.js → dev-server-C5R6jx8Q.js} +2 -2
  23. package/dist/_chunks/{dev-server-Cr3_Fu5A.js.map → dev-server-C5R6jx8Q.js.map} +1 -1
  24. package/dist/_chunks/{dev-span-RsVeYYc_.js → dev-span-0aG7Q_Ph.js} +3 -7
  25. package/dist/_chunks/dev-span-0aG7Q_Ph.js.map +1 -0
  26. package/dist/_chunks/{error-boundary-Bh-egWUI.js → error-boundary-DB51f9ih.js} +98 -419
  27. package/dist/_chunks/error-boundary-DB51f9ih.js.map +1 -0
  28. package/dist/_chunks/{flight-source-node-BsrlUjMO.js → flight-source-node-D9cHBhjP.js} +7 -4
  29. package/dist/_chunks/flight-source-node-D9cHBhjP.js.map +1 -0
  30. package/dist/_chunks/{json-lossy-check-D47R9Fp5.js → json-lossy-check-Y1GxqVX_.js} +2 -2
  31. package/dist/_chunks/{json-lossy-check-D47R9Fp5.js.map → json-lossy-check-Y1GxqVX_.js.map} +1 -1
  32. package/dist/_chunks/{live-graph-HcLScfiV.js → live-graph-BDQWvnMm.js} +4 -4
  33. package/dist/_chunks/{live-graph-HcLScfiV.js.map → live-graph-BDQWvnMm.js.map} +1 -1
  34. package/dist/_chunks/{logger-DDLtp5e-.js → logger-DmRR9tmZ.js} +2 -2
  35. package/dist/_chunks/{logger-DDLtp5e-.js.map → logger-DmRR9tmZ.js.map} +1 -1
  36. package/dist/_chunks/metadata-routes-MXNjWOt5.js.map +1 -1
  37. package/dist/_chunks/{node-response-omewa8e6.js → node-response-yp8zdyRp.js} +2 -2
  38. package/dist/_chunks/{node-response-omewa8e6.js.map → node-response-yp8zdyRp.js.map} +1 -1
  39. package/dist/_chunks/plugin-context-BtaQcMuh.js.map +1 -1
  40. package/dist/_chunks/{poison-scan-DONdiCGX.js → poison-scan-WQgUydF_.js} +2 -2
  41. package/dist/_chunks/{poison-scan-DONdiCGX.js.map → poison-scan-WQgUydF_.js.map} +1 -1
  42. package/dist/_chunks/{scanner-DSAJjH0x.js → scanner-C9Lrf77z.js} +3 -2
  43. package/dist/_chunks/{scanner-DSAJjH0x.js.map → scanner-C9Lrf77z.js.map} +1 -1
  44. package/dist/_chunks/{sizeof-DVhEVN_y.js → sizeof-BISkSaU0.js} +2 -2
  45. package/dist/_chunks/{sizeof-DVhEVN_y.js.map → sizeof-BISkSaU0.js.map} +1 -1
  46. package/dist/_chunks/{walkers-96YopJds.js → walkers-Bxv4v7tX.js} +3 -3
  47. package/dist/_chunks/{walkers-96YopJds.js.map → walkers-Bxv4v7tX.js.map} +1 -1
  48. package/dist/adapters/cloudflare-kv-cache.js +1 -1
  49. package/dist/analyze/crawl-entry.js +3 -3
  50. package/dist/analyze/graph-command.js +2 -2
  51. package/dist/cache/index.js +2 -2
  52. package/dist/cache/stores/memory.js +1 -1
  53. package/dist/cdn/workers-cache-purge.js +1 -1
  54. package/dist/cli.js +3 -3
  55. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
  56. package/dist/client/browser-entry/hydrate.d.ts +1 -1
  57. package/dist/client/browser-entry/router-init.d.ts.map +1 -1
  58. package/dist/client/error-boundary.d.ts +1 -0
  59. package/dist/client/error-boundary.d.ts.map +1 -1
  60. package/dist/client/error-boundary.js +1 -1
  61. package/dist/client/history.d.ts +4 -5
  62. package/dist/client/history.d.ts.map +1 -1
  63. package/dist/client/index.js +6 -7
  64. package/dist/client/index.js.map +1 -1
  65. package/dist/client/internal.d.ts +1 -1
  66. package/dist/client/internal.d.ts.map +1 -1
  67. package/dist/client/internal.js +194 -55
  68. package/dist/client/internal.js.map +1 -1
  69. package/dist/client/navigation-commit.d.ts +6 -25
  70. package/dist/client/navigation-commit.d.ts.map +1 -1
  71. package/dist/client/outlet-content-cache.d.ts +59 -0
  72. package/dist/client/outlet-content-cache.d.ts.map +1 -0
  73. package/dist/client/outlet-scope-context.d.ts +30 -0
  74. package/dist/client/outlet-scope-context.d.ts.map +1 -0
  75. package/dist/client/params-context.d.ts +10 -11
  76. package/dist/client/params-context.d.ts.map +1 -1
  77. package/dist/client/router-pipeline.d.ts +5 -5
  78. package/dist/client/router-pipeline.d.ts.map +1 -1
  79. package/dist/client/router-types.d.ts +10 -24
  80. package/dist/client/router-types.d.ts.map +1 -1
  81. package/dist/client/router.d.ts.map +1 -1
  82. package/dist/client/rsc-fetch.d.ts +4 -17
  83. package/dist/client/rsc-fetch.d.ts.map +1 -1
  84. package/dist/client/segment-cache.d.ts +15 -103
  85. package/dist/client/segment-cache.d.ts.map +1 -1
  86. package/dist/client/segment-outlet.d.ts +28 -52
  87. package/dist/client/segment-outlet.d.ts.map +1 -1
  88. package/dist/client/stale-segment.d.ts +39 -0
  89. package/dist/client/stale-segment.d.ts.map +1 -0
  90. package/dist/client/use-segment-params.d.ts +1 -1
  91. package/dist/config-types.d.ts +7 -6
  92. package/dist/config-types.d.ts.map +1 -1
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +9 -732
  95. package/dist/index.js.map +1 -1
  96. package/dist/native/rsc/manifest.json +6 -4
  97. package/dist/native/rsc/routing/segment-keys.js +3 -11
  98. package/dist/native/rsc/routing/segment-keys.js.map +1 -1
  99. package/dist/native/rsc/server/access-gate.js +3 -7
  100. package/dist/native/rsc/server/access-gate.js.map +1 -1
  101. package/dist/native/rsc/server/als-registry.js +2 -1
  102. package/dist/native/rsc/server/als-registry.js.map +1 -1
  103. package/dist/native/rsc/server/build-manifest.js.map +1 -1
  104. package/dist/native/rsc/server/chain-url-parts.js +1 -6
  105. package/dist/native/rsc/server/chain-url-parts.js.map +1 -1
  106. package/dist/native/rsc/server/client-state-tree.js +33 -0
  107. package/dist/native/rsc/server/client-state-tree.js.map +1 -0
  108. package/dist/native/rsc/server/flight-source-node.js +5 -2
  109. package/dist/native/rsc/server/flight-source-node.js.map +1 -1
  110. package/dist/native/rsc/server/flight-source.js +46 -7
  111. package/dist/native/rsc/server/flight-source.js.map +1 -1
  112. package/dist/native/rsc/server/pipeline-interception.js +1 -1
  113. package/dist/native/rsc/server/publish-params.js.map +1 -1
  114. package/dist/native/rsc/server/route-element-builder.js +43 -61
  115. package/dist/native/rsc/server/route-element-builder.js.map +1 -1
  116. package/dist/native/rsc/server/rsc-entry/helpers.js +5 -28
  117. package/dist/native/rsc/server/rsc-entry/helpers.js.map +1 -1
  118. package/dist/native/rsc/server/rsc-entry/render-route.js +33 -7
  119. package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
  120. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +2 -1
  121. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js.map +1 -1
  122. package/dist/native/rsc/server/rsc-entry/rsc-payload.js +2 -5
  123. package/dist/native/rsc/server/rsc-entry/rsc-payload.js.map +1 -1
  124. package/dist/native/rsc/server/rsc-entry/rsc-stream.js +44 -40
  125. package/dist/native/rsc/server/rsc-entry/rsc-stream.js.map +1 -1
  126. package/dist/native/rsc/server/rsc-entry/ssr-renderer.js +1 -1
  127. package/dist/native/rsc/server/rsc-entry/ssr-renderer.js.map +1 -1
  128. package/dist/native/rsc/server/segment-hash/capture.js +107 -0
  129. package/dist/native/rsc/server/segment-hash/capture.js.map +1 -0
  130. package/dist/native/rsc/server/segment-hash/outlet.js +81 -0
  131. package/dist/native/rsc/server/segment-hash/outlet.js.map +1 -0
  132. package/dist/native/rsc/server/segment-hash/stream-tap.js +139 -0
  133. package/dist/native/rsc/server/segment-hash/stream-tap.js.map +1 -0
  134. package/dist/native/rsc/server/segment-hash/value-hash.js +171 -0
  135. package/dist/native/rsc/server/segment-hash/value-hash.js.map +1 -0
  136. package/dist/native/rsc/server/slot-resolver.js +20 -124
  137. package/dist/native/rsc/server/slot-resolver.js.map +1 -1
  138. package/dist/native/rsc/server/vite-handoff-rsc.js.map +1 -1
  139. package/dist/native/rsc/shared/outlet-decision.js +5 -0
  140. package/dist/native/rsc/shared/outlet-decision.js.map +1 -0
  141. package/dist/native/ssr/client/error-boundary.js +16 -3
  142. package/dist/native/ssr/client/error-boundary.js.map +1 -1
  143. package/dist/native/ssr/client/navigation-commit.js +1 -5
  144. package/dist/native/ssr/client/navigation-commit.js.map +1 -1
  145. package/dist/native/ssr/client/outlet-content-cache.js +53 -0
  146. package/dist/native/ssr/client/outlet-content-cache.js.map +1 -0
  147. package/dist/native/ssr/client/outlet-scope-context.js +12 -0
  148. package/dist/native/ssr/client/outlet-scope-context.js.map +1 -0
  149. package/dist/native/ssr/client/params-context.js.map +1 -1
  150. package/dist/native/ssr/client/rsc-fetch.js +1 -12
  151. package/dist/native/ssr/client/rsc-fetch.js.map +1 -1
  152. package/dist/native/ssr/client/segment-outlet.js +34 -13
  153. package/dist/native/ssr/client/segment-outlet.js.map +1 -1
  154. package/dist/native/ssr/client/stale-segment.js +29 -0
  155. package/dist/native/ssr/client/stale-segment.js.map +1 -0
  156. package/dist/native/ssr/manifest.json +5 -4
  157. package/dist/native/ssr/routing/segment-keys.js +5 -1
  158. package/dist/native/ssr/routing/segment-keys.js.map +1 -1
  159. package/dist/native/ssr/server/access-gate.js +3 -7
  160. package/dist/native/ssr/server/access-gate.js.map +1 -1
  161. package/dist/native/ssr/server/als-registry.js +1 -0
  162. package/dist/native/ssr/server/als-registry.js.map +1 -1
  163. package/dist/native/ssr/server/build-manifest.js.map +1 -1
  164. package/dist/native/ssr/server/client-state-tree.js +33 -0
  165. package/dist/native/ssr/server/client-state-tree.js.map +1 -0
  166. package/dist/native/ssr/server/flight-source-node.js +5 -2
  167. package/dist/native/ssr/server/flight-source-node.js.map +1 -1
  168. package/dist/native/ssr/server/flight-source.js +1 -0
  169. package/dist/native/ssr/server/flight-source.js.map +1 -1
  170. package/dist/native/ssr/server/pipeline-interception.js +1 -1
  171. package/dist/native/ssr/server/segment-hash/value-hash.js +162 -0
  172. package/dist/native/ssr/server/segment-hash/value-hash.js.map +1 -0
  173. package/dist/native/ssr/server/ssr-wrappers.js.map +1 -1
  174. package/dist/native/ssr/server/vite-handoff-rsc.js.map +1 -1
  175. package/dist/native/ssr/shared/payload-root.js.map +1 -1
  176. package/dist/plugin-context.d.ts +0 -16
  177. package/dist/plugin-context.d.ts.map +1 -1
  178. package/dist/plugins/build-manifest.d.ts.map +1 -1
  179. package/dist/routing/index.js +2 -2
  180. package/dist/routing/segment-keys.d.ts +8 -21
  181. package/dist/routing/segment-keys.d.ts.map +1 -1
  182. package/dist/server/access-gate.d.ts +0 -14
  183. package/dist/server/access-gate.d.ts.map +1 -1
  184. package/dist/server/als-registry.d.ts +16 -0
  185. package/dist/server/als-registry.d.ts.map +1 -1
  186. package/dist/server/build-manifest.d.ts +1 -10
  187. package/dist/server/build-manifest.d.ts.map +1 -1
  188. package/dist/server/chain-url-parts.d.ts +3 -13
  189. package/dist/server/chain-url-parts.d.ts.map +1 -1
  190. package/dist/server/client-state-tree.d.ts +31 -0
  191. package/dist/server/client-state-tree.d.ts.map +1 -0
  192. package/dist/server/flight-source-node.d.ts +6 -1
  193. package/dist/server/flight-source-node.d.ts.map +1 -1
  194. package/dist/server/flight-source.d.ts +27 -0
  195. package/dist/server/flight-source.d.ts.map +1 -1
  196. package/dist/server/index.js +2 -2
  197. package/dist/server/internal.js +48 -47
  198. package/dist/server/internal.js.map +1 -1
  199. package/dist/server/publish-params.d.ts +5 -4
  200. package/dist/server/publish-params.d.ts.map +1 -1
  201. package/dist/server/route-element-builder.d.ts +4 -19
  202. package/dist/server/route-element-builder.d.ts.map +1 -1
  203. package/dist/server/rsc-entry/helpers.d.ts +7 -13
  204. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  205. package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
  206. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
  207. package/dist/server/rsc-entry/rsc-payload.d.ts +1 -2
  208. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  209. package/dist/server/rsc-entry/rsc-stream.d.ts +11 -2
  210. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  211. package/dist/server/rsc-entry/ssr-renderer.d.ts +0 -2
  212. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  213. package/dist/server/segment-hash/capture.d.ts +77 -0
  214. package/dist/server/segment-hash/capture.d.ts.map +1 -0
  215. package/dist/server/segment-hash/outlet.d.ts +65 -0
  216. package/dist/server/segment-hash/outlet.d.ts.map +1 -0
  217. package/dist/server/segment-hash/stream-tap.d.ts +49 -0
  218. package/dist/server/segment-hash/stream-tap.d.ts.map +1 -0
  219. package/dist/server/segment-hash/value-hash.d.ts +70 -0
  220. package/dist/server/segment-hash/value-hash.d.ts.map +1 -0
  221. package/dist/server/slot-resolver.d.ts +13 -78
  222. package/dist/server/slot-resolver.d.ts.map +1 -1
  223. package/dist/server/ssr-wrappers.d.ts +7 -9
  224. package/dist/server/ssr-wrappers.d.ts.map +1 -1
  225. package/dist/server/vite-handoff-rsc.d.ts +10 -1
  226. package/dist/server/vite-handoff-rsc.d.ts.map +1 -1
  227. package/dist/shared/outlet-decision.d.ts +48 -0
  228. package/dist/shared/outlet-decision.d.ts.map +1 -0
  229. package/dist/shared/payload-root.d.ts +5 -8
  230. package/dist/shared/payload-root.d.ts.map +1 -1
  231. package/dist/shared/segment-info.d.ts +13 -28
  232. package/dist/shared/segment-info.d.ts.map +1 -1
  233. package/package.json +1 -1
  234. package/src/client/browser-entry/action-dispatch.ts +1 -15
  235. package/src/client/browser-entry/hydrate.ts +3 -3
  236. package/src/client/browser-entry/router-init.ts +28 -47
  237. package/src/client/error-boundary.tsx +49 -9
  238. package/src/client/history.ts +4 -5
  239. package/src/client/internal.ts +1 -1
  240. package/src/client/navigation-commit.ts +25 -83
  241. package/src/client/outlet-content-cache.ts +119 -0
  242. package/src/client/outlet-scope-context.ts +42 -0
  243. package/src/client/params-context.ts +11 -12
  244. package/src/client/router-pipeline.ts +10 -74
  245. package/src/client/router-types.ts +11 -26
  246. package/src/client/router.ts +7 -22
  247. package/src/client/rsc-fetch.ts +5 -30
  248. package/src/client/segment-cache.ts +19 -264
  249. package/src/client/segment-outlet.tsx +80 -72
  250. package/src/client/stale-segment.ts +60 -0
  251. package/src/client/use-segment-params.ts +1 -1
  252. package/src/config-types.ts +7 -6
  253. package/src/index.ts +0 -2
  254. package/src/plugin-context.ts +0 -16
  255. package/src/plugins/build-manifest.ts +1 -22
  256. package/src/routing/scanner.ts +12 -0
  257. package/src/routing/segment-keys.ts +9 -35
  258. package/src/rsc-runtime/vendor-types.d.ts +8 -0
  259. package/src/server/access-gate.tsx +3 -32
  260. package/src/server/als-registry.ts +23 -0
  261. package/src/server/build-manifest.ts +1 -11
  262. package/src/server/chain-url-parts.ts +3 -21
  263. package/src/server/client-state-tree.ts +75 -0
  264. package/src/server/flight-source-node.ts +7 -2
  265. package/src/server/flight-source.ts +102 -9
  266. package/src/server/pipeline-interception.ts +1 -1
  267. package/src/server/publish-params.ts +5 -4
  268. package/src/server/route-element-builder.ts +77 -206
  269. package/src/server/rsc-entry/helpers.ts +11 -65
  270. package/src/server/rsc-entry/render-route.ts +54 -28
  271. package/src/server/rsc-entry/revalidate-renderer.ts +2 -1
  272. package/src/server/rsc-entry/rsc-payload.ts +11 -39
  273. package/src/server/rsc-entry/rsc-stream.ts +123 -101
  274. package/src/server/rsc-entry/ssr-renderer.ts +1 -3
  275. package/src/server/segment-hash/capture.ts +232 -0
  276. package/src/server/segment-hash/outlet.ts +185 -0
  277. package/src/server/segment-hash/stream-tap.ts +244 -0
  278. package/src/server/segment-hash/value-hash.ts +338 -0
  279. package/src/server/slot-resolver.ts +37 -323
  280. package/src/server/ssr-wrappers.tsx +7 -9
  281. package/src/server/vite-handoff-rsc.ts +12 -1
  282. package/src/shared/outlet-decision.ts +54 -0
  283. package/src/shared/payload-root.ts +5 -8
  284. package/src/shared/segment-info.ts +13 -28
  285. package/dist/_chunks/chains-CmzbpG-6.js +0 -1
  286. package/dist/_chunks/dev-server--4_Ogy_6.js +0 -1
  287. package/dist/_chunks/dev-span-RsVeYYc_.js.map +0 -1
  288. package/dist/_chunks/error-boundary-Bh-egWUI.js.map +0 -1
  289. package/dist/_chunks/flight-source-node-BsrlUjMO.js.map +0 -1
  290. package/dist/client/segment-update-context.d.ts +0 -15
  291. package/dist/client/segment-update-context.d.ts.map +0 -1
  292. package/dist/client/slot-content-cache-context.d.ts +0 -35
  293. package/dist/client/slot-content-cache-context.d.ts.map +0 -1
  294. package/dist/native/rsc/server/request-dep.js +0 -12
  295. package/dist/native/rsc/server/request-dep.js.map +0 -1
  296. package/dist/native/rsc/server/route-element-helpers.js +0 -20
  297. package/dist/native/rsc/server/route-element-helpers.js.map +0 -1
  298. package/dist/native/rsc/server/skippable-prefix.js +0 -72
  299. package/dist/native/rsc/server/skippable-prefix.js.map +0 -1
  300. package/dist/native/rsc/server/state-tree-diff.js +0 -35
  301. package/dist/native/rsc/server/state-tree-diff.js.map +0 -1
  302. package/dist/native/ssr/client/segment-cache.js +0 -119
  303. package/dist/native/ssr/client/segment-cache.js.map +0 -1
  304. package/dist/native/ssr/client/segment-update-context.js +0 -9
  305. package/dist/native/ssr/client/segment-update-context.js.map +0 -1
  306. package/dist/native/ssr/client/slot-content-cache-context.js +0 -8
  307. package/dist/native/ssr/client/slot-content-cache-context.js.map +0 -1
  308. package/dist/native/ssr/server/state-tree-diff.js +0 -23
  309. package/dist/native/ssr/server/state-tree-diff.js.map +0 -1
  310. package/dist/plugins/request-dep/analysis.d.ts +0 -106
  311. package/dist/plugins/request-dep/analysis.d.ts.map +0 -1
  312. package/dist/plugins/request-dep/index.d.ts +0 -75
  313. package/dist/plugins/request-dep/index.d.ts.map +0 -1
  314. package/dist/plugins/request-dep/origin.d.ts +0 -61
  315. package/dist/plugins/request-dep/origin.d.ts.map +0 -1
  316. package/dist/server/request-dep.d.ts +0 -15
  317. package/dist/server/request-dep.d.ts.map +0 -1
  318. package/dist/server/route-element-helpers.d.ts +0 -12
  319. package/dist/server/route-element-helpers.d.ts.map +0 -1
  320. package/dist/server/skippable-prefix.d.ts +0 -29
  321. package/dist/server/skippable-prefix.d.ts.map +0 -1
  322. package/dist/server/state-tree-diff.d.ts +0 -78
  323. package/dist/server/state-tree-diff.d.ts.map +0 -1
  324. package/src/client/segment-update-context.ts +0 -23
  325. package/src/client/slot-content-cache-context.ts +0 -43
  326. package/src/plugins/request-dep/analysis.ts +0 -447
  327. package/src/plugins/request-dep/index.ts +0 -376
  328. package/src/plugins/request-dep/origin.ts +0 -310
  329. package/src/server/request-dep.ts +0 -37
  330. package/src/server/route-element-helpers.ts +0 -37
  331. package/src/server/skippable-prefix.ts +0 -172
  332. package/src/server/state-tree-diff.ts +0 -132
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { a as generateManifestModule, c as formatMissingPeers, i as VIRTUAL_IDS, l as reportConfigErrors, n as timberDevServer, o as generateSchemaModule, s as checkPeerDependencies, u as validateConfig } from "./_chunks/dev-server-Cr3_Fu5A.js";
1
+ import { a as generateManifestModule, c as formatMissingPeers, i as VIRTUAL_IDS, l as reportConfigErrors, n as timberDevServer, o as generateSchemaModule, s as checkPeerDependencies, u as validateConfig } from "./_chunks/dev-server-C5R6jx8Q.js";
2
2
  import { i as resolveRenderTimeoutMs } from "./_chunks/render-timeout-MrrqD1wd.js";
3
- import { l as getPrerenderExport, n as scanRoutes } from "./_chunks/scanner-DSAJjH0x.js";
4
- import { c as buildDirToRouteMap, n as formatConventionWarnings, o as flushCodegenWrites, r as lintConventions, s as writeRouteCodegen, t as checkAppDirExists } from "./_chunks/convention-lint-GQA6WTRo.js";
5
- import { r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-96YopJds.js";
3
+ import { l as getPrerenderExport, n as scanRoutes } from "./_chunks/scanner-C9Lrf77z.js";
4
+ import { c as buildDirToRouteMap, n as formatConventionWarnings, o as flushCodegenWrites, r as lintConventions, s as writeRouteCodegen, t as checkAppDirExists } from "./_chunks/convention-lint-BoVISNS6.js";
5
+ import { r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-Bxv4v7tX.js";
6
6
  import { i as poisonPillSource, r as markerFor, t as EXPLICIT_MARKERS } from "./_chunks/poison-rules-Bmz-lCPi.js";
7
7
  import { t as writeFileAtomic } from "./_chunks/write-file-atomic-DW8m_Atv.js";
8
8
  import { i as withBasePath, n as normalizeBasePath, t as isRelativeBase } from "./_chunks/base-path-DDIx0FXe.js";
9
9
  import { n as rscPayloadPath, t as RSC_PAYLOAD_DIR } from "./_chunks/rsc-payload-path-EphpDB-J.js";
10
10
  import { a as REDIRECTS_FILE, n as detectFsIdentity, o as RESERVED_OUTPUT_PATHS, r as fsKey, t as EXACT_FS_IDENTITY } from "./_chunks/fs-identity-BmQ_Agg-.js";
11
- import { a as EMPTY_BUILD_MANIFEST, n as DEV_SPAN_REPLAY_EVENT, r as DEV_SPAN_SINK_KEY, t as DEV_SPAN_EVENT } from "./_chunks/dev-span-RsVeYYc_.js";
11
+ import { a as EMPTY_BUILD_MANIFEST, n as DEV_SPAN_REPLAY_EVENT, r as DEV_SPAN_SINK_KEY, t as DEV_SPAN_EVENT } from "./_chunks/dev-span-0aG7Q_Ph.js";
12
12
  import { t as fnv1aHash } from "./_chunks/fast-hash-DddxkU5Y.js";
13
- import { i as detectDirective } from "./_chunks/classify-BwyAd-dZ.js";
13
+ import { i as detectDirective } from "./_chunks/classify-Cj9EeZoL.js";
14
14
  import { a as contextAdapter, c as loadTimberConfigFile, d as resolveBuildDir, f as resolveClientJavascript, l as mergeFileConfig, m as createNoopTimer, o as createPluginContext, r as adapterConfig, u as resolveAppDir } from "./_chunks/plugin-context-BtaQcMuh.js";
15
- import { b as swallow } from "./_chunks/logger-DDLtp5e-.js";
15
+ import { b as swallow } from "./_chunks/logger-DmRR9tmZ.js";
16
16
  import { t as formatSize } from "./_chunks/format-DuPOoXUP.js";
17
17
  import { createLogger, esmExternalRequirePlugin, isRunnableDevEnvironment, parseAst } from "vite";
18
18
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep, win32 } from "node:path";
@@ -5422,7 +5422,7 @@ function timberBuildManifest(ctx) {
5422
5422
  "// Auto-generated build manifest — do not edit.",
5423
5423
  "// Production: reads manifest from globalThis (set by _timber-manifest-init.js).",
5424
5424
  "// The object below is only the fallback for when that global is unset —",
5425
- "// the real manifest, including the requestDep map, is in that init module.",
5425
+ "// the real manifest is in that init module.",
5426
5426
  "",
5427
5427
  `const manifest = globalThis.__TIMBER_BUILD_MANIFEST__ ?? ${empty};`,
5428
5428
  "",
@@ -5449,8 +5449,6 @@ function timberBuildManifest(ctx) {
5449
5449
  if (envName === "client") {
5450
5450
  ctx.buildManifest = buildManifestFromBundle(bundle, ctx.base, ctx.root);
5451
5451
  if (ctx.routeTree) ctx.buildManifest.metadataRouteHashes = computeMetadataRouteHashes(ctx.routeTree.root);
5452
- if (ctx.requestDepMap === void 0) throw new Error("[timber] Build manifest: the request-dependency map was never computed. The RSC environment's buildEnd hook did not run before the client build, so no segment or slot could be skipped on client navigation. This is a plugin pipeline bug — timber-request-dep must run in the rsc environment.");
5453
- ctx.buildManifest.requestDep = ctx.requestDepMap;
5454
5452
  if (ctx.clientJavascript.disabled) {
5455
5453
  for (const [fileName, item] of Object.entries(bundle)) if (item.type === "chunk") delete bundle[fileName];
5456
5454
  }
@@ -6775,726 +6773,6 @@ function timberCacheTransform(ctx) {
6775
6773
  }
6776
6774
  };
6777
6775
  }
6778
- // src/plugins/request-dep/analysis.ts
6779
- /** `export default` has no local name of its own; this stands in for one. */
6780
- var DEFAULT_EXPORT = "default";
6781
- function createModuleFacts() {
6782
- return {
6783
- importedBindings: /* @__PURE__ */ new Map(),
6784
- reExports: /* @__PURE__ */ new Map(),
6785
- starReExports: [],
6786
- localExports: /* @__PURE__ */ new Map(),
6787
- factoryCalls: /* @__PURE__ */ new Map(),
6788
- calledLocals: /* @__PURE__ */ new Set(),
6789
- calledMembers: /* @__PURE__ */ new Map(),
6790
- getterLocals: /* @__PURE__ */ new Set(),
6791
- getterMembers: /* @__PURE__ */ new Map(),
6792
- referencedLocals: /* @__PURE__ */ new Set(),
6793
- resolvedSources: /* @__PURE__ */ new Map(),
6794
- unresolvedSources: /* @__PURE__ */ new Set()
6795
- };
6796
- }
6797
- /**
6798
- * Specifiers the origin walk can actually reach, so the plugin resolves those
6799
- * and not every import in the file.
6800
- *
6801
- * A re-export edge is always reachable — a downstream module can ask for any
6802
- * name it forwards. An `import` edge is reachable through any local name the
6803
- * module body mentions, or that it re-exports.
6804
- *
6805
- * The name set must be **the same one the taint rules consult**. Deriving it
6806
- * from the call shapes instead (called, `.get()`d, member-called, minted from)
6807
- * left `read(filters)` — a definition passed as an argument — with its
6808
- * specifier unresolved, so the origin walk reported it inert and the page read
6809
- * as request-independent. Two hand-maintained lists of "names that matter" is
6810
- * one list too many; this is the one, and `referencedLocals` is a superset of
6811
- * every call shape by construction, since each of them is an identifier the
6812
- * walk visits. (Codex review round 1 on PR #991.)
6813
- */
6814
- function usedSources(facts) {
6815
- const sources = new Set(facts.starReExports);
6816
- for (const edge of facts.reExports.values()) sources.add(edge.source);
6817
- for (const local of facts.referencedLocals) {
6818
- const edge = facts.importedBindings.get(local);
6819
- if (edge) sources.add(edge.source);
6820
- }
6821
- for (const local of facts.localExports.values()) {
6822
- const edge = facts.importedBindings.get(local);
6823
- if (edge) sources.add(edge.source);
6824
- }
6825
- return sources;
6826
- }
6827
- /**
6828
- * True when the module cannot affect any answer, so its facts need not be kept.
6829
- *
6830
- * Every judgement bottoms out at a module edge: a call site resolves through
6831
- * `importedBindings`, a chain link through `reExports` / `starReExports`. A
6832
- * module with none of those can only ever resolve to `none` — its exports lead
6833
- * to locals that lead nowhere — which is exactly what a *missing* entry
6834
- * produces. Dropping it is behaviour-preserving and keeps the dev-time map from
6835
- * holding an entry for every leaf module in the graph.
6836
- */
6837
- function contributesNothing(facts) {
6838
- return facts.importedBindings.size === 0 && facts.reExports.size === 0 && facts.starReExports.length === 0;
6839
- }
6840
- function addToMapSet(map, key, value) {
6841
- const existing = map.get(key);
6842
- if (existing) existing.add(value);
6843
- else map.set(key, /* @__PURE__ */ new Set([value]));
6844
- }
6845
- function nameOf$1(node) {
6846
- if (!node) return null;
6847
- if (node.type === "Identifier") return node.name;
6848
- if (node.type === "Literal" && typeof node.value === "string") return node.value;
6849
- return null;
6850
- }
6851
- /**
6852
- * `import type { … }` needs no handling here. Vite's TypeScript transform is a
6853
- * core plugin and runs before this one, so types are already erased by the time
6854
- * the analysis parses — and the parser it runs on is JavaScript-only, so
6855
- * unerased TypeScript would throw rather than be silently misread.
6856
- * `tests/request-dep-plugin.test.ts` pins the resulting property through the
6857
- * real pipeline: a type-only accessor import is not request-dependent.
6858
- */
6859
- function collectImportDeclaration(stmt, facts) {
6860
- const source = stmt.source?.value;
6861
- if (typeof source !== "string") return;
6862
- for (const spec of stmt.specifiers ?? []) {
6863
- const local = nameOf$1(spec.local);
6864
- if (!local) continue;
6865
- if (spec.type === "ImportNamespaceSpecifier") facts.importedBindings.set(local, {
6866
- source,
6867
- imported: "*"
6868
- });
6869
- else if (spec.type === "ImportDefaultSpecifier") facts.importedBindings.set(local, {
6870
- source,
6871
- imported: DEFAULT_EXPORT
6872
- });
6873
- else if (spec.type === "ImportSpecifier") facts.importedBindings.set(local, {
6874
- source,
6875
- imported: nameOf$1(spec.imported) ?? local
6876
- });
6877
- }
6878
- }
6879
- function collectDeclaredNames(decl, out) {
6880
- if (decl.type === "VariableDeclaration") for (const d of decl.declarations ?? []) {
6881
- const id = d.id;
6882
- if (id?.type === "Identifier") out.add(id.name);
6883
- }
6884
- else if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration") {
6885
- const id = decl.id;
6886
- if (id?.type === "Identifier") out.add(id.name);
6887
- }
6888
- }
6889
- function collectExportNamed(stmt, facts) {
6890
- const source = stmt.source?.value;
6891
- const specifiers = stmt.specifiers ?? [];
6892
- if (typeof source === "string") {
6893
- for (const spec of specifiers) {
6894
- const imported = nameOf$1(spec.imported) ?? nameOf$1(spec.local);
6895
- const exported = nameOf$1(spec.exported);
6896
- if (imported && exported) facts.reExports.set(exported, {
6897
- source,
6898
- imported
6899
- });
6900
- }
6901
- return;
6902
- }
6903
- for (const spec of specifiers) {
6904
- const local = nameOf$1(spec.local);
6905
- const exported = nameOf$1(spec.exported);
6906
- if (local && exported) facts.localExports.set(exported, local);
6907
- }
6908
- const declaration = stmt.declaration;
6909
- if (declaration) {
6910
- const names = /* @__PURE__ */ new Set();
6911
- collectDeclaredNames(declaration, names);
6912
- for (const name of names) facts.localExports.set(name, name);
6913
- }
6914
- }
6915
- function collectExportAll(stmt, facts) {
6916
- const source = stmt.source?.value;
6917
- if (typeof source !== "string") return;
6918
- const exported = nameOf$1(stmt.exported);
6919
- if (exported) facts.reExports.set(exported, {
6920
- source,
6921
- imported: "*"
6922
- });
6923
- else facts.starReExports.push(source);
6924
- }
6925
- function collectExportDefault(stmt, facts) {
6926
- const declaration = stmt.declaration;
6927
- if (!declaration) return;
6928
- facts.localExports.set(DEFAULT_EXPORT, DEFAULT_EXPORT);
6929
- if (declaration.type === "Identifier") facts.localExports.set(DEFAULT_EXPORT, declaration.name);
6930
- else if (declaration.type === "CallExpression") {
6931
- const ref = calleeRef(declaration);
6932
- if (ref) facts.factoryCalls.set(DEFAULT_EXPORT, ref);
6933
- }
6934
- }
6935
- function calleeRef(call) {
6936
- const callee = call.callee;
6937
- if (callee.type === "Identifier") return {
6938
- kind: "local",
6939
- name: callee.name
6940
- };
6941
- if (callee.type === "MemberExpression") {
6942
- const member = callee;
6943
- if (!member.computed && member.object.type === "Identifier" && member.property.type === "Identifier") return {
6944
- kind: "member",
6945
- object: member.object.name,
6946
- property: member.property.name
6947
- };
6948
- }
6949
- return null;
6950
- }
6951
- /**
6952
- * Walk down a `.get()` receiver to the identifier it is ultimately rooted in,
6953
- * along with the first property accessed on that identifier.
6954
- *
6955
- * `x.get()` → `x`, no property. `x(a).get()` → `x`. `ns.defs.get()` → `ns`
6956
- * plus `defs`, which is both the namespace-member shape and the
6957
- * `cookies.theme.get()` shape — the resolver tries the base binding and the
6958
- * member, so one walk covers both.
6959
- */
6960
- function chainRoot(node) {
6961
- let current = node;
6962
- let property = null;
6963
- for (;;) {
6964
- if (current.type === "Identifier") return {
6965
- base: current.name,
6966
- property
6967
- };
6968
- if (current.type === "MemberExpression") {
6969
- const member = current;
6970
- if (!member.computed && member.property.type === "Identifier") property = member.property.name;
6971
- else property = null;
6972
- current = member.object;
6973
- continue;
6974
- }
6975
- if (current.type === "CallExpression") {
6976
- property = null;
6977
- current = current.callee;
6978
- continue;
6979
- }
6980
- return null;
6981
- }
6982
- }
6983
- function collectExpression(node, facts) {
6984
- if (node.type === "VariableDeclarator") {
6985
- const id = node.id;
6986
- const init = node.init;
6987
- if (id?.type === "Identifier" && init?.type === "CallExpression") {
6988
- const ref = calleeRef(init);
6989
- if (ref) facts.factoryCalls.set(id.name, ref);
6990
- }
6991
- return;
6992
- }
6993
- if (node.type !== "CallExpression") return;
6994
- const callee = node.callee;
6995
- if (callee.type === "Identifier") {
6996
- facts.calledLocals.add(callee.name);
6997
- return;
6998
- }
6999
- if (callee.type !== "MemberExpression") return;
7000
- const member = callee;
7001
- if (member.computed || member.property.type !== "Identifier") return;
7002
- const propertyName = member.property.name;
7003
- if (propertyName === "get") {
7004
- const root = chainRoot(member.object);
7005
- if (root) {
7006
- facts.getterLocals.add(root.base);
7007
- if (root.property) addToMapSet(facts.getterMembers, root.base, root.property);
7008
- }
7009
- return;
7010
- }
7011
- if (member.object.type === "Identifier") addToMapSet(facts.calledMembers, member.object.name, propertyName);
7012
- }
7013
- /**
7014
- * Statements whose whole subtree is an import/export *clause* rather than code.
7015
- *
7016
- * The walk skips them so `referencedLocals` means "the module body mentions
7017
- * this name". Without the skip every imported name would count as referenced,
7018
- * and a pure barrel — which mentions its names only in the clauses — would be
7019
- * indistinguishable from a module that uses them.
7020
- */
7021
- function isClauseOnly(node) {
7022
- if (node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration") return true;
7023
- if (node.type === "ExportNamedDeclaration") return !node.declaration;
7024
- if (node.type === "ExportDefaultDeclaration") return node.declaration?.type === "Identifier";
7025
- return false;
7026
- }
7027
- /**
7028
- * Keys holding *binding* positions rather than references: the name being
7029
- * declared, not a mention of one.
7030
- *
7031
- * `referencedLocals` must exclude these or `export const filters =
7032
- * defineSearchParams({})` would count as referencing `filters`, and possession
7033
- * would then taint every definition module — and through it every page that
7034
- * imports one, whether or not it reads the request. Skipping only these keys
7035
- * keeps a shadowing parameter's *body* uses as references, which over-reports
7036
- * in the safe direction.
7037
- */
7038
- var BINDING_KEYS = {
7039
- VariableDeclarator: ["id"],
7040
- FunctionDeclaration: ["id", "params"],
7041
- FunctionExpression: ["id", "params"],
7042
- ArrowFunctionExpression: ["params"],
7043
- ClassDeclaration: ["id"],
7044
- ClassExpression: ["id"],
7045
- CatchClause: ["param"]
7046
- };
7047
- function walk(node, facts) {
7048
- if (isClauseOnly(node)) return;
7049
- if (node.type === "Identifier") facts.referencedLocals.add(node.name);
7050
- collectExpression(node, facts);
7051
- const bindingKeys = BINDING_KEYS[node.type];
7052
- for (const key of Object.keys(node)) {
7053
- if (key === "type" || key === "start" || key === "end") continue;
7054
- if (bindingKeys?.includes(key)) continue;
7055
- const value = node[key];
7056
- if (!value || typeof value !== "object") continue;
7057
- if (Array.isArray(value)) {
7058
- for (const item of value) if (item && typeof item === "object" && typeof item.type === "string") walk(item, facts);
7059
- } else if (typeof value.type === "string") walk(value, facts);
7060
- }
7061
- }
7062
- /**
7063
- * Record every binding, module edge, and call shape in one module.
7064
- *
7065
- * Names are recorded without scope analysis, so a parameter that shadows an
7066
- * imported name is credited to the import. That direction is deliberate: a
7067
- * needlessly request-dependent segment costs a re-render, a wrongly static one
7068
- * serves stale content.
7069
- */
7070
- function analyzeModule(program) {
7071
- const facts = createModuleFacts();
7072
- for (const stmt of program.body) switch (stmt.type) {
7073
- case "ImportDeclaration":
7074
- collectImportDeclaration(stmt, facts);
7075
- break;
7076
- case "ExportNamedDeclaration":
7077
- collectExportNamed(stmt, facts);
7078
- break;
7079
- case "ExportAllDeclaration":
7080
- collectExportAll(stmt, facts);
7081
- break;
7082
- case "ExportDefaultDeclaration": collectExportDefault(stmt, facts);
7083
- }
7084
- walk(program, facts);
7085
- return facts;
7086
- }
7087
- // src/plugins/request-dep/origin.ts
7088
- var ACCESSOR_SOURCES = /* @__PURE__ */ new Set([
7089
- "@timber-js/app/server",
7090
- "next/headers",
7091
- "next/headers.js"
7092
- ]);
7093
- var ACCESSOR_NAMES = /* @__PURE__ */ new Set([
7094
- "getHeaders",
7095
- "getHeader",
7096
- "getSearchParams",
7097
- "getCookieJar",
7098
- "getCookie",
7099
- "headers",
7100
- "cookies"
7101
- ]);
7102
- var DEFINITION_FACTORY_SOURCES = /* @__PURE__ */ new Set(["@timber-js/app/search-params", "@timber-js/app/cookies"]);
7103
- var DEFINITION_FACTORY_NAMES = /* @__PURE__ */ new Set(["defineSearchParams", "defineCookie"]);
7104
- /** Every specifier the classifier recognises without resolving it. */
7105
- var FRAMEWORK_SOURCES = /* @__PURE__ */ new Set([...ACCESSOR_SOURCES, ...DEFINITION_FACTORY_SOURCES]);
7106
- var NONE = { kind: "none" };
7107
- var UNKNOWN = { kind: "unknown" };
7108
- /**
7109
- * Classify an edge that points at a framework module, without resolving it.
7110
- *
7111
- * Returns `null` when the specifier is not a framework source, which is the
7112
- * signal to keep walking. Both name sets are consulted for either source so a
7113
- * specifier that grows a second role does not silently stop matching.
7114
- */
7115
- function classifySpecifier(source, imported) {
7116
- const isAccessorSource = ACCESSOR_SOURCES.has(source);
7117
- const isFactorySource = DEFINITION_FACTORY_SOURCES.has(source);
7118
- if (!isAccessorSource && !isFactorySource) return null;
7119
- if (imported === "*") return {
7120
- kind: "framework-namespace",
7121
- source
7122
- };
7123
- if (isAccessorSource && ACCESSOR_NAMES.has(imported)) return { kind: "accessor" };
7124
- if (isFactorySource && DEFINITION_FACTORY_NAMES.has(imported)) return { kind: "factory" };
7125
- return NONE;
7126
- }
7127
- /** An origin whose *call* reads the request. */
7128
- function callReadsRequest(origin) {
7129
- return origin.kind === "accessor" || origin.kind === "unknown";
7130
- }
7131
- /** An origin whose `.get()` reads the request. */
7132
- function getterReadsRequest(origin) {
7133
- return origin.kind === "definition" || origin.kind === "unknown";
7134
- }
7135
- function createOriginResolver(factsMap) {
7136
- /**
7137
- * Cycle guard. A `(module, export)` pair already being resolved contributes
7138
- * `none`: anything it could reach is reachable on the path still unwinding.
7139
- */
7140
- const resolving = /* @__PURE__ */ new Map();
7141
- function enter(moduleId, name) {
7142
- const names = resolving.get(moduleId);
7143
- if (!names) {
7144
- resolving.set(moduleId, /* @__PURE__ */ new Set([name]));
7145
- return true;
7146
- }
7147
- if (names.has(name)) return false;
7148
- names.add(name);
7149
- return true;
7150
- }
7151
- function leave(moduleId, name) {
7152
- resolving.get(moduleId)?.delete(name);
7153
- }
7154
- /** Follow one `import`/`export … from` edge out of `moduleId`. */
7155
- function resolveEdge(moduleId, edge) {
7156
- const classified = classifySpecifier(edge.source, edge.imported);
7157
- if (classified) return classified;
7158
- const facts = factsMap.get(moduleId);
7159
- const targetId = facts?.resolvedSources.get(edge.source);
7160
- if (!targetId) return facts?.unresolvedSources.has(edge.source) ? UNKNOWN : NONE;
7161
- if (edge.imported === "*") return {
7162
- kind: "namespace",
7163
- moduleId: targetId
7164
- };
7165
- return resolveExport(targetId, edge.imported);
7166
- }
7167
- /** What does `moduleId` export under `name`? */
7168
- function resolveExport(moduleId, name) {
7169
- const facts = factsMap.get(moduleId);
7170
- if (!facts) return NONE;
7171
- if (!enter(moduleId, `export:${name}`)) return NONE;
7172
- try {
7173
- const reExport = facts.reExports.get(name);
7174
- if (reExport) return resolveEdge(moduleId, reExport);
7175
- const local = facts.localExports.get(name);
7176
- if (local !== void 0) return resolveLocal(moduleId, local);
7177
- for (const source of facts.starReExports) {
7178
- const viaStar = resolveEdge(moduleId, {
7179
- source,
7180
- imported: name
7181
- });
7182
- if (viaStar.kind !== "none") return viaStar;
7183
- }
7184
- return NONE;
7185
- } finally {
7186
- leave(moduleId, `export:${name}`);
7187
- }
7188
- }
7189
- /** What is the local binding `name` in `moduleId`? */
7190
- function resolveLocal(moduleId, name) {
7191
- const facts = factsMap.get(moduleId);
7192
- if (!facts) return NONE;
7193
- if (!enter(moduleId, `local:${name}`)) return NONE;
7194
- try {
7195
- const imported = facts.importedBindings.get(name);
7196
- if (imported) return resolveEdge(moduleId, imported);
7197
- const factoryCall = facts.factoryCalls.get(name);
7198
- if (factoryCall) {
7199
- const callee = resolveCallee(moduleId, factoryCall);
7200
- if (callee.kind === "factory") return { kind: "definition" };
7201
- if (callee.kind === "unknown") return UNKNOWN;
7202
- }
7203
- return NONE;
7204
- } finally {
7205
- leave(moduleId, `local:${name}`);
7206
- }
7207
- }
7208
- function resolveCallee(moduleId, ref) {
7209
- if (ref.kind === "local") return resolveLocal(moduleId, ref.name);
7210
- return resolveMember(moduleId, ref.object, ref.property);
7211
- }
7212
- /** `ns.name` where `ns` is a local binding in `moduleId`. */
7213
- function resolveMember(moduleId, object, name) {
7214
- const base = resolveLocal(moduleId, object);
7215
- if (base.kind === "framework-namespace") return classifySpecifier(base.source, name) ?? NONE;
7216
- if (base.kind === "namespace") return resolveExport(base.moduleId, name);
7217
- if (base.kind === "unknown") return UNKNOWN;
7218
- return NONE;
7219
- }
7220
- const taintCache = /* @__PURE__ */ new Map();
7221
- function computeTainted(moduleId, facts) {
7222
- for (const local of facts.calledLocals) if (callReadsRequest(resolveLocal(moduleId, local))) return true;
7223
- for (const [object, members] of facts.calledMembers) for (const member of members) if (callReadsRequest(resolveMember(moduleId, object, member))) return true;
7224
- for (const local of facts.getterLocals) if (getterReadsRequest(resolveLocal(moduleId, local))) return true;
7225
- for (const [object, members] of facts.getterMembers) for (const member of members) if (getterReadsRequest(resolveMember(moduleId, object, member))) return true;
7226
- return holdsRequestBinding(moduleId, facts);
7227
- }
7228
- /**
7229
- * Possession, not use: a module that binds a request accessor or a definition
7230
- * value under a local name is request-dependent whether or not the call is
7231
- * one this analysis can see.
7232
- *
7233
- * The call-shape rules above only find a read that happens through the
7234
- * binding itself. A value can leave the binding first — `const read = flag ?
7235
- * getSearchParams : noop`, `const { get } = filters`, a prop handed to a
7236
- * helper — and every one of those is a fresh way to be missed, which is the
7237
- * shape of bug this ticket exists to stop enumerating. Nothing distinguishes
7238
- * those from an honest unused import except intent, so importing the accessor
7239
- * at all is treated as reading it.
7240
- *
7241
- * The rule is scoped by *reference*, not by export shape, and that scoping is
7242
- * what keeps it from being useless: `import { getSearchParams } from
7243
- * '@timber-js/app/server'; export { getSearchParams }` is a barrel whose body
7244
- * never mentions the name, and tainting it would taint every page that
7245
- * imports anything from that barrel. The forwarded name stays resolvable
7246
- * through `resolveExport`, so the page that actually calls it is still caught
7247
- * one hop later, in the module that uses it.
7248
- *
7249
- * Scoping on "the module only forwards it" would have been the natural
7250
- * phrasing and is wrong: a barrel can forward a name *and* use it
7251
- * (`export { getSearchParams }` beside `const read = flag ? getSearchParams
7252
- * : noop`), and that module is exactly the one this rule exists to catch.
7253
- * `referencedLocals` excludes import/export clauses and nothing else, so
7254
- * forwarding is exempt only when it is all the module does with the name.
7255
- *
7256
- * `unknown` is deliberately not included: an unresolvable specifier taints
7257
- * only when something is actually called or read on it, or every module with
7258
- * one broken import would go request-dependent.
7259
- */
7260
- function holdsRequestBinding(moduleId, facts) {
7261
- for (const local of facts.referencedLocals) {
7262
- const origin = resolveLocal(moduleId, local);
7263
- if (origin.kind === "accessor" || origin.kind === "definition") return true;
7264
- }
7265
- return false;
7266
- }
7267
- return {
7268
- isTainted(moduleId) {
7269
- const cached = taintCache.get(moduleId);
7270
- if (cached !== void 0) return cached;
7271
- const facts = factsMap.get(moduleId);
7272
- const result = facts ? computeTainted(moduleId, facts) : false;
7273
- taintCache.set(moduleId, result);
7274
- return result;
7275
- },
7276
- isDefinitionModule(moduleId) {
7277
- const facts = factsMap.get(moduleId);
7278
- if (!facts) return false;
7279
- for (const edge of facts.importedBindings.values()) {
7280
- const origin = resolveEdge(moduleId, edge);
7281
- if (origin.kind === "factory") return true;
7282
- if (origin.kind === "framework-namespace" && DEFINITION_FACTORY_SOURCES.has(origin.source)) return true;
7283
- }
7284
- return false;
7285
- },
7286
- callsGetterOnImport(moduleId) {
7287
- const facts = factsMap.get(moduleId);
7288
- if (!facts) return false;
7289
- for (const local of facts.getterLocals) if (facts.importedBindings.has(local)) return true;
7290
- return false;
7291
- }
7292
- };
7293
- }
7294
- // src/plugins/request-dep/index.ts
7295
- function isFrameworkModule(id) {
7296
- return /[\\/]node_modules[\\/]@timber-js[\\/]app[\\/]/.test(id) || /[\\/]packages[\\/]timber-app[\\/]src[\\/]/.test(id);
7297
- }
7298
- /**
7299
- * Cheap gate before parsing.
7300
- *
7301
- * This used to be a substring match on the accessor and factory names, which
7302
- * was sound only for the analysis it served: when a call site had to name the
7303
- * framework binding in its own import declaration, a module with no such name
7304
- * could not be a call site. Resolving bindings across the graph removes that
7305
- * guarantee — with
7306
- *
7307
- * // _lib/index.ts
7308
- * export { getSearchParams as query } from '@timber-js/app/server';
7309
- * // page.tsx
7310
- * import { query } from './_lib';
7311
- * export default function Page() { return query(); }
7312
- *
7313
- * the page contains no accessor name, no `.get(`, and no re-export syntax, and
7314
- * skipping it would have put the rename right back where the barrel was. So the
7315
- * gate is now structural: a module matters if it has any module-level binding
7316
- * to follow. What it skips is source with no `import` and no `export` at all —
7317
- * data blobs, generated constants, side-effect scripts — none of which can name
7318
- * a framework binding or forward one.
7319
- */
7320
- function hasModuleBindings(code) {
7321
- return code.includes("import") || code.includes("export");
7322
- }
7323
- /**
7324
- * Walk the module graph from an entry, returning true if any module reachable
7325
- * from it reads the request.
7326
- *
7327
- * Two passes, and the second is a deliberately blunt backstop:
7328
- *
7329
- * 1. **Binding origins.** For each reachable module, resolve every call site's
7330
- * binding to its origin. This is precise and indifferent to indirection.
7331
- * 2. **Definition reachability.** A module that calls `.get()` on *something*
7332
- * it imported, with a module holding a definition factory reachable behind
7333
- * that import, counts too. The origin walk cannot see through a value that
7334
- * is computed rather than bound — `getFilterCookie(key).get()`, where the
7335
- * helper returns a definition — and this pass can.
7336
- *
7337
- * The second pass over-reports by construction, which is the safe direction: a
7338
- * needlessly request-dependent segment costs a re-render, a wrongly static one
7339
- * serves stale content.
7340
- *
7341
- * An entry the graph does not contain is an edge we failed to walk, not the
7342
- * absence of one — the same rule an unresolvable specifier gets. Without the
7343
- * check it reads as an entry with no imports and no facts, and both passes fall
7344
- * through to `false`: confidently request-INdependent, for a module nothing
7345
- * ever looked at. In the build that answer is worse than no answer, because it
7346
- * is written into `requestDep` as a definite `false` and the runtime's own
7347
- * "absent key → conservative" fallback never fires.
7348
- */
7349
- function isReachableTaintSource(entryId, input) {
7350
- const { factsMap, getImports, isKnownModule } = input;
7351
- if (!isKnownModule(entryId)) return true;
7352
- const resolver = createOriginResolver(factsMap);
7353
- const visited = /* @__PURE__ */ new Set();
7354
- const stack = [entryId];
7355
- while (stack.length > 0) {
7356
- const id = stack.pop();
7357
- if (visited.has(id)) continue;
7358
- visited.add(id);
7359
- if (resolver.isTainted(id)) return true;
7360
- for (const imp of getImports(id)) if (!imp.startsWith("\0") && !visited.has(imp)) stack.push(imp);
7361
- }
7362
- const reachesDefinition = makeDefinitionReachability(resolver.isDefinitionModule, getImports);
7363
- for (const id of visited) {
7364
- if (!resolver.callsGetterOnImport(id)) continue;
7365
- if (reachesDefinition(id)) return true;
7366
- }
7367
- return false;
7368
- }
7369
- /**
7370
- * "Can a definition module be reached from this module's imports?", memoized
7371
- * across the queries one entry makes.
7372
- *
7373
- * Walks the graph rather than testing direct imports, because `export … from`
7374
- * is an ordinary module edge and a barrel is the common way an app shares one
7375
- * `defineSearchParams` across routes.
7376
- *
7377
- * Cycles terminate on the memo seeded with `false`; a module already being
7378
- * resolved contributes nothing, which is correct — anything it could reach is
7379
- * reachable on the path that is still unwinding.
7380
- */
7381
- function makeDefinitionReachability(isDefinitionModule, getImports) {
7382
- const cache = /* @__PURE__ */ new Map();
7383
- return function reaches(id) {
7384
- const cached = cache.get(id);
7385
- if (cached !== void 0) return cached;
7386
- cache.set(id, false);
7387
- let result = false;
7388
- for (const imp of getImports(id)) {
7389
- if (imp.startsWith("\0")) continue;
7390
- if (isDefinitionModule(imp) || reaches(imp)) {
7391
- result = true;
7392
- break;
7393
- }
7394
- }
7395
- cache.set(id, result);
7396
- return result;
7397
- };
7398
- }
7399
- var BRIDGE_KEY = Symbol.for("timber:request-dep");
7400
- /**
7401
- * Resolve every specifier the module has an edge to, so the origin walk can
7402
- * follow them later without a module graph.
7403
- *
7404
- * Framework specifiers are classified by name and never resolved — that is what
7405
- * keeps the terminal check independent of how `@timber-js/app` happens to be
7406
- * installed. A specifier that fails to resolve is recorded as unresolved rather
7407
- * than dropped, so the walk can take the conservative branch on it.
7408
- */
7409
- async function resolveEdgeSources(pluginCtx, facts, importer) {
7410
- for (const source of usedSources(facts)) {
7411
- if (FRAMEWORK_SOURCES.has(source)) continue;
7412
- try {
7413
- const resolved = await pluginCtx.resolve(source, importer);
7414
- if (resolved?.id) facts.resolvedSources.set(source, resolved.id);
7415
- else facts.unresolvedSources.add(source);
7416
- } catch {
7417
- facts.unresolvedSources.add(source);
7418
- }
7419
- }
7420
- }
7421
- function timberRequestDep(ctx) {
7422
- const factsMap = /* @__PURE__ */ new Map();
7423
- const cache = /* @__PURE__ */ new Map();
7424
- return {
7425
- name: "timber-request-dep",
7426
- applyToEnvironment(env) {
7427
- return env.name === "rsc";
7428
- },
7429
- async transform(code, id) {
7430
- if (!/\.[mc]?[jt]sx?$/.test(id) && !/\.mdx?$/.test(id)) return;
7431
- if (id.startsWith("\0") || id.startsWith("virtual:")) return;
7432
- if (isFrameworkModule(id)) return;
7433
- if (!hasModuleBindings(code)) return;
7434
- const pluginCtx = this;
7435
- const facts = analyzeModule(pluginCtx.parse(code));
7436
- if (contributesNothing(facts)) {
7437
- factsMap.delete(id);
7438
- return;
7439
- }
7440
- await resolveEdgeSources(pluginCtx, facts, id);
7441
- factsMap.set(id, facts);
7442
- },
7443
- configureServer(server) {
7444
- const resolver = (filePath) => {
7445
- if (cache.has(filePath)) return cache.get(filePath);
7446
- const rscEnv = server.environments?.rsc;
7447
- if (!rscEnv?.moduleGraph) return true;
7448
- const getImports = (moduleId) => {
7449
- const mod = rscEnv.moduleGraph.getModuleById(moduleId);
7450
- if (!mod) return [];
7451
- const result = [];
7452
- for (const imp of mod.importedModules) if (imp.id) result.push(imp.id);
7453
- return result;
7454
- };
7455
- const isKnownModule = (moduleId) => rscEnv.moduleGraph.getModuleById(moduleId) !== void 0;
7456
- const result = isReachableTaintSource(filePath, {
7457
- factsMap,
7458
- getImports,
7459
- isKnownModule
7460
- });
7461
- if (isKnownModule(filePath)) cache.set(filePath, result);
7462
- return result;
7463
- };
7464
- globalThis[BRIDGE_KEY] = resolver;
7465
- const clearCache = () => cache.clear();
7466
- server.watcher.on("change", clearCache);
7467
- server.watcher.on("add", clearCache);
7468
- server.watcher.on("unlink", clearCache);
7469
- },
7470
- buildEnd() {
7471
- if (ctx.dev) return;
7472
- const getModuleInfo = this.getModuleInfo;
7473
- const getImports = (moduleId) => {
7474
- const info = getModuleInfo(moduleId);
7475
- if (!info) return [];
7476
- return [...info.importedIds ?? [], ...info.dynamicallyImportedIds ?? []];
7477
- };
7478
- const isKnownModule = (moduleId) => getModuleInfo(moduleId) != null;
7479
- const requestDepMap = {};
7480
- if (ctx.routeTree) walkSegmentTree(ctx.routeTree.root, (filePath) => {
7481
- requestDepMap[filePath] = isReachableTaintSource(filePath, {
7482
- factsMap,
7483
- getImports,
7484
- isKnownModule
7485
- });
7486
- });
7487
- ctx.requestDepMap = requestDepMap;
7488
- }
7489
- };
7490
- }
7491
- function walkSegmentTree(node, fn) {
7492
- if (node.layout) fn(node.layout.filePath);
7493
- if (node.page) fn(node.page.filePath);
7494
- if (node.default) fn(node.default.filePath);
7495
- if (node.children) for (const child of node.children) walkSegmentTree(child, fn);
7496
- if (node.slots) for (const slot of Object.values(node.slots)) walkSegmentTree(slot, fn);
7497
- }
7498
6776
  // src/plugins/optimize-package-imports-defaults.ts
7499
6777
  /**
7500
6778
  * Import specifiers whose barrel imports timber rewrites by default.
@@ -11003,7 +10281,7 @@ function timber(config) {
11003
10281
  console: originalConsole
11004
10282
  });
11005
10283
  ctx.timer.start("client-deps-scan");
11006
- const { clientOptimizeDepsEntries, skipUseServerScanPlugin } = await import("./_chunks/client-dep-entries-C5BTQtFS.js");
10284
+ const { clientOptimizeDepsEntries, skipUseServerScanPlugin } = await import("./_chunks/client-dep-entries-ZETBdLgv.js");
11007
10285
  const entries = await clientOptimizeDepsEntries(resolvedRoot, BROWSER_ENTRY_FILE, buildDir);
11008
10286
  ctx.timer.end("client-deps-scan");
11009
10287
  return {
@@ -11060,7 +10338,6 @@ function timber(config) {
11060
10338
  timberMdx(ctx),
11061
10339
  timberOptimizePackageImports(ctx),
11062
10340
  timberClientInServerPackageDeps(),
11063
- timberRequestDep(ctx),
11064
10341
  timberCacheTransform(ctx),
11065
10342
  timberPrerenderSugar(ctx),
11066
10343
  prebuilt,