@evoscientist/webui 0.2.4 → 0.2.6

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 (934) hide show
  1. package/dist/.next/BUILD_ID +1 -1
  2. package/dist/.next/build-manifest.json +13 -10
  3. package/dist/.next/prerender-manifest.json +18 -3
  4. package/dist/.next/required-server-files.json +31 -12
  5. package/dist/.next/server/app/_global-error/page/build-manifest.json +10 -7
  6. package/dist/.next/server/app/_global-error/page.js +6 -6
  7. package/dist/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/dist/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/dist/.next/server/app/_global-error.html +1 -1
  10. package/dist/.next/server/app/_global-error.meta +11 -4
  11. package/dist/.next/server/app/_global-error.rsc +9 -9
  12. package/dist/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +16 -2
  13. package/dist/.next/server/app/_global-error.segments/_full.segment.rsc +9 -9
  14. package/dist/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/dist/.next/server/app/_not-found/page/build-manifest.json +10 -7
  16. package/dist/.next/server/app/_not-found/page/next-font-manifest.json +1 -1
  17. package/dist/.next/server/app/_not-found/page.js +9 -10
  18. package/dist/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/dist/.next/server/app/_not-found.html +1 -1
  21. package/dist/.next/server/app/_not-found.meta +16 -5
  22. package/dist/.next/server/app/_not-found.rsc +15 -15
  23. package/dist/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
  24. package/dist/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +22 -2
  25. package/dist/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  26. package/dist/.next/server/app/api/evosci-config/route/build-manifest.json +4 -1
  27. package/dist/.next/server/app/api/evosci-config/route.js +3 -3
  28. package/dist/.next/server/app/api/evosci-config/route.js.nft.json +1 -1
  29. package/dist/.next/server/app/api/evosci-config/route_client-reference-manifest.js +1 -1
  30. package/dist/.next/server/app/api/memory/executions/route/build-manifest.json +4 -1
  31. package/dist/.next/server/app/api/memory/executions/route.js +4 -3
  32. package/dist/.next/server/app/api/memory/executions/route.js.nft.json +1 -1
  33. package/dist/.next/server/app/api/memory/executions/route_client-reference-manifest.js +1 -1
  34. package/dist/.next/server/app/api/memory/observations/route/build-manifest.json +4 -1
  35. package/dist/.next/server/app/api/memory/observations/route.js +4 -3
  36. package/dist/.next/server/app/api/memory/observations/route.js.nft.json +1 -1
  37. package/dist/.next/server/app/api/memory/observations/route_client-reference-manifest.js +1 -1
  38. package/dist/.next/server/app/api/memory/route/build-manifest.json +4 -1
  39. package/dist/.next/server/app/api/memory/route.js +4 -3
  40. package/dist/.next/server/app/api/memory/route.js.nft.json +1 -1
  41. package/dist/.next/server/app/api/memory/route_client-reference-manifest.js +1 -1
  42. package/dist/.next/server/app/api/skills/catalog/route/build-manifest.json +4 -1
  43. package/dist/.next/server/app/api/skills/catalog/route.js +3 -3
  44. package/dist/.next/server/app/api/skills/catalog/route.js.nft.json +1 -1
  45. package/dist/.next/server/app/api/skills/catalog/route_client-reference-manifest.js +1 -1
  46. package/dist/.next/server/app/api/skills/detail/route/build-manifest.json +4 -1
  47. package/dist/.next/server/app/api/skills/detail/route.js +3 -3
  48. package/dist/.next/server/app/api/skills/detail/route.js.nft.json +1 -1
  49. package/dist/.next/server/app/api/skills/detail/route_client-reference-manifest.js +1 -1
  50. package/dist/.next/server/app/api/skills/install/route/build-manifest.json +4 -1
  51. package/dist/.next/server/app/api/skills/install/route.js +3 -3
  52. package/dist/.next/server/app/api/skills/install/route.js.nft.json +1 -1
  53. package/dist/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -1
  54. package/dist/.next/server/app/api/skills/route/build-manifest.json +4 -1
  55. package/dist/.next/server/app/api/skills/route.js +4 -3
  56. package/dist/.next/server/app/api/skills/route.js.nft.json +1 -1
  57. package/dist/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  58. package/dist/.next/server/app/api/workspace/download/route/build-manifest.json +4 -1
  59. package/dist/.next/server/app/api/workspace/download/route.js +4 -3
  60. package/dist/.next/server/app/api/workspace/download/route.js.nft.json +1 -1
  61. package/dist/.next/server/app/api/workspace/download/route_client-reference-manifest.js +1 -1
  62. package/dist/.next/server/app/api/workspace/file/route/build-manifest.json +4 -1
  63. package/dist/.next/server/app/api/workspace/file/route.js +4 -4
  64. package/dist/.next/server/app/api/workspace/file/route.js.nft.json +1 -1
  65. package/dist/.next/server/app/api/workspace/file/route_client-reference-manifest.js +1 -1
  66. package/dist/.next/server/app/api/workspace/route/build-manifest.json +4 -1
  67. package/dist/.next/server/app/api/workspace/route.js +4 -3
  68. package/dist/.next/server/app/api/workspace/route.js.nft.json +1 -1
  69. package/dist/.next/server/app/api/workspace/route_client-reference-manifest.js +1 -1
  70. package/dist/.next/server/app/api/workspace/upload/route/build-manifest.json +4 -1
  71. package/dist/.next/server/app/api/workspace/upload/route.js +4 -3
  72. package/dist/.next/server/app/api/workspace/upload/route.js.nft.json +1 -1
  73. package/dist/.next/server/app/api/workspace/upload/route_client-reference-manifest.js +1 -1
  74. package/dist/.next/server/app/icon.png/route/build-manifest.json +4 -1
  75. package/dist/.next/server/app/icon.png/route.js +4 -4
  76. package/dist/.next/server/app/icon.png/route.js.nft.json +1 -1
  77. package/dist/.next/server/app/index.html +1 -1
  78. package/dist/.next/server/app/index.meta +11 -4
  79. package/dist/.next/server/app/index.rsc +16 -16
  80. package/dist/.next/server/app/index.segments/__PAGE__.segment.rsc +22 -5
  81. package/dist/.next/server/app/index.segments/_full.segment.rsc +16 -16
  82. package/dist/.next/server/app/index.segments/_tree.segment.rsc +3 -3
  83. package/dist/.next/server/app/page/build-manifest.json +10 -7
  84. package/dist/.next/server/app/page/next-font-manifest.json +1 -1
  85. package/dist/.next/server/app/page.js +10 -11
  86. package/dist/.next/server/app/page.js.nft.json +1 -1
  87. package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
  88. package/dist/.next/server/chunks/[externals]__0l8ei7u._.js +3 -0
  89. package/dist/.next/server/chunks/[root-of-the-server]__0239a1s._.js +3 -0
  90. package/dist/.next/server/chunks/[root-of-the-server]__0d2jr7j._.js +3 -0
  91. package/dist/.next/server/chunks/[root-of-the-server]__0jsq76h._.js +6 -0
  92. package/dist/.next/server/chunks/[root-of-the-server]__0k-rs5f._.js +6 -0
  93. package/dist/.next/server/chunks/[root-of-the-server]__0key-2n._.js +3 -0
  94. package/dist/.next/server/chunks/[root-of-the-server]__0l3yhx4._.js +160 -0
  95. package/dist/.next/server/chunks/[root-of-the-server]__0nn8czk._.js +6 -0
  96. package/dist/.next/server/chunks/[root-of-the-server]__0t923su._.js +3 -0
  97. package/dist/.next/server/chunks/[root-of-the-server]__0zqsdzd._.js +3 -0
  98. package/dist/.next/server/chunks/[root-of-the-server]__1alqt3_._.js +6 -0
  99. package/dist/.next/server/chunks/[turbopack]_runtime.js +97 -193
  100. package/dist/.next/server/chunks/_00r_7g_._.js +3 -0
  101. package/dist/.next/server/chunks/_042sj8j._.js +3 -0
  102. package/dist/.next/server/chunks/_0lp3ten._.js +3 -0
  103. package/dist/.next/server/chunks/_0m7b81h._.js +3 -0
  104. package/dist/.next/server/chunks/_13lro7d._.js +3 -0
  105. package/dist/.next/server/chunks/_154zcbx._.js +3 -0
  106. package/dist/.next/server/chunks/_1_oz68h._.js +3 -0
  107. package/dist/.next/server/chunks/_1lqtgjk._.js +3 -0
  108. package/dist/.next/server/chunks/{_next-internal_server_app_api_evosci-config_route_actions_0nka7fr.js → _next-internal_server_app_api_evosci-config_route_actions_13cf33i.js} +1 -1
  109. package/dist/.next/server/chunks/{_next-internal_server_app_api_memory_executions_route_actions_02b~_kt.js → _next-internal_server_app_api_memory_executions_route_actions_041n8x6.js} +1 -1
  110. package/dist/.next/server/chunks/{_next-internal_server_app_api_memory_observations_route_actions_0qhyoqo.js → _next-internal_server_app_api_memory_observations_route_actions_18ivi6u.js} +1 -1
  111. package/dist/.next/server/chunks/{_next-internal_server_app_api_memory_route_actions_0jf5z0q.js → _next-internal_server_app_api_memory_route_actions_0y2o7lg.js} +1 -1
  112. package/dist/.next/server/chunks/{_next-internal_server_app_api_skills_catalog_route_actions_0pp.pug.js → _next-internal_server_app_api_skills_catalog_route_actions_173mjj2.js} +1 -1
  113. package/dist/.next/server/chunks/{_next-internal_server_app_api_skills_detail_route_actions_02~v0so.js → _next-internal_server_app_api_skills_detail_route_actions_058ebza.js} +1 -1
  114. package/dist/.next/server/chunks/{_next-internal_server_app_api_skills_install_route_actions_03-v3ve.js → _next-internal_server_app_api_skills_install_route_actions_06zjol4.js} +1 -1
  115. package/dist/.next/server/chunks/{_next-internal_server_app_api_skills_route_actions_0kp0j6w.js → _next-internal_server_app_api_skills_route_actions_0_9y-ex.js} +1 -1
  116. package/dist/.next/server/chunks/{_next-internal_server_app_api_workspace_download_route_actions_0y83v2y.js → _next-internal_server_app_api_workspace_download_route_actions_1m4_t05.js} +1 -1
  117. package/dist/.next/server/chunks/{_next-internal_server_app_api_workspace_file_route_actions_06tfudj.js → _next-internal_server_app_api_workspace_file_route_actions_0bvzn6g.js} +1 -1
  118. package/dist/.next/server/chunks/{_next-internal_server_app_api_workspace_route_actions_0rc11bi.js → _next-internal_server_app_api_workspace_route_actions_19-xkal.js} +1 -1
  119. package/dist/.next/server/chunks/{_next-internal_server_app_api_workspace_upload_route_actions_070kzk5.js → _next-internal_server_app_api_workspace_upload_route_actions_0ccjxm_.js} +1 -1
  120. package/dist/.next/server/chunks/{_next-internal_server_app_icon_png_route_actions_12.gv.r.js → _next-internal_server_app_icon_png_route_actions_1-lsc8h.js} +1 -1
  121. package/dist/.next/server/chunks/ssr/{0t6k_@mermaid-js_parser_dist_chunks_mermaid-parser_core_chunk-NNHCCRGN_mjs_01.5gnv._.js → 1daa_@mermaid-js_parser_dist_chunks_mermaid-parser_core_chunk-NNHCCRGN_mjs_03i6i8q._.js} +3 -3
  122. package/dist/.next/server/chunks/ssr/{0t6k_mermaid_dist_chunks_mermaid_core_mindmap-definition-RKZ34NQL_mjs_0ya3nf7._.js → 1daa_mermaid_dist_chunks_mermaid_core_mindmap-definition-RKZ34NQL_mjs_1m8bey3._.js} +1 -1
  123. package/dist/.next/server/chunks/ssr/{0t6k_mermaid_dist_chunks_mermaid_core_requirementDiagram-4Y6WPE33_mjs_07c4~j8._.js → 1daa_mermaid_dist_chunks_mermaid_core_requirementDiagram-4Y6WPE33_mjs_0cvy8c2._.js} +1 -1
  124. package/dist/.next/server/chunks/ssr/{0t6k_mermaid_dist_chunks_mermaid_core_timeline-definition-PNZ67QCA_mjs_0i6u~cs._.js → 1daa_mermaid_dist_chunks_mermaid_core_timeline-definition-PNZ67QCA_mjs_0vzw4gu._.js} +1 -1
  125. package/dist/.next/server/chunks/ssr/{0_lp_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-PVQCEYII_mjs_0xc8cuq._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-PVQCEYII_mjs_1kl1645._.js} +1 -1
  126. package/dist/.next/server/chunks/ssr/{0_lp_modules_mermaid_dist_chunks_mermaid_core_ishikawaDiagram-YF4QCWOH_mjs_12xi8w0._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_ishikawaDiagram-YF4QCWOH_mjs_1-btteu._.js} +1 -1
  127. package/dist/.next/server/chunks/ssr/{0_lp_modules_mermaid_dist_chunks_mermaid_core_journeyDiagram-JHISSGLW_mjs_0d.k2tv._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_journeyDiagram-JHISSGLW_mjs_0omhwqk._.js} +1 -1
  128. package/dist/.next/server/chunks/ssr/{0_lp_modules_mermaid_dist_chunks_mermaid_core_kanban-definition-UN3LZRKU_mjs_02zfksy._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_kanban-definition-UN3LZRKU_mjs_052rc5y._.js} +1 -1
  129. package/dist/.next/server/chunks/ssr/{0_lp_modules_mermaid_dist_chunks_mermaid_core_quadrantDiagram-W4KKPZXB_mjs_0c30c1e._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_quadrantDiagram-W4KKPZXB_mjs_0l8r0bx._.js} +1 -1
  130. package/dist/.next/server/chunks/ssr/{0_lp_modules_mermaid_dist_chunks_mermaid_core_sequenceDiagram-3UESZ5HK_mjs_07fd9jw._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_sequenceDiagram-3UESZ5HK_mjs_0c-9sj0._.js} +1 -1
  131. package/dist/.next/server/chunks/ssr/{0_lp_modules_mermaid_dist_chunks_mermaid_core_wardleyDiagram-YWT4CUSO_mjs_0a2sjhb._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_wardleyDiagram-YWT4CUSO_mjs_0hqmyh5._.js} +1 -1
  132. package/dist/.next/server/chunks/ssr/{0_lp_modules_mermaid_dist_chunks_mermaid_core_xychartDiagram-2RQKCTM6_mjs_0xpvx~c._.js → 1q96_modules_mermaid_dist_chunks_mermaid_core_xychartDiagram-2RQKCTM6_mjs_1l5rlhy._.js} +1 -1
  133. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0471z20._.js +3 -0
  134. package/dist/.next/server/chunks/ssr/{[root-of-the-server]__031lpnq._.js → [root-of-the-server]__05c-vrc._.js} +7 -7
  135. package/dist/.next/server/chunks/ssr/[root-of-the-server]__09pnxvp._.js +33 -0
  136. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0c75weq._.js +3 -0
  137. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0imtqxe._.js +3 -0
  138. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0nzxyl0._.js +3 -0
  139. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0o0ct70._.js +3 -0
  140. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0owaq8w._.js +12 -0
  141. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0xpcv9w._.js +14 -0
  142. package/dist/.next/server/chunks/ssr/[root-of-the-server]__1f4zvj-._.js +3 -0
  143. package/dist/.next/server/chunks/ssr/[root-of-the-server]__1io3bae._.js +33 -0
  144. package/dist/.next/server/chunks/ssr/[turbopack]_runtime.js +97 -193
  145. package/dist/.next/server/chunks/ssr/_05yvop-._.js +4 -0
  146. package/dist/.next/server/chunks/ssr/{_next-internal_server_app__global-error_page_actions_0k77kol.js → _next-internal_server_app__global-error_page_actions_0zi5s8-.js} +1 -1
  147. package/dist/.next/server/chunks/ssr/{_next-internal_server_app__not-found_page_actions_0eq97pa.js → _next-internal_server_app__not-found_page_actions_0pt47yr.js} +1 -1
  148. package/dist/.next/server/chunks/ssr/_next-internal_server_app_page_actions_0hhsz1j.js +3 -0
  149. package/dist/.next/server/chunks/ssr/{node_modules_0v29g77._.js → node_modules_0-n78w2._.js} +3 -3
  150. package/dist/.next/server/chunks/ssr/node_modules_00cex-8._.js +3 -0
  151. package/dist/.next/server/chunks/ssr/node_modules_0456qqx._.js +17 -0
  152. package/dist/.next/server/chunks/ssr/{node_modules_0po23em._.js → node_modules_07zdzg3._.js} +3 -3
  153. package/dist/.next/server/chunks/ssr/node_modules_082g_84._.js +31 -0
  154. package/dist/.next/server/chunks/ssr/node_modules_0_w_s0o._.js +3 -0
  155. package/dist/.next/server/chunks/ssr/node_modules_0chqc93._.js +11 -0
  156. package/dist/.next/server/chunks/ssr/{node_modules_09w7yel._.js → node_modules_0h91jdk._.js} +2 -2
  157. package/dist/.next/server/chunks/ssr/{node_modules_0x8-epl._.js → node_modules_0i3cah4._.js} +3 -3
  158. package/dist/.next/server/chunks/ssr/node_modules_0jx8vby._.js +3 -0
  159. package/dist/.next/server/chunks/ssr/node_modules_0kh3gaq._.js +45 -0
  160. package/dist/.next/server/chunks/ssr/node_modules_0oiuulr._.js +3 -0
  161. package/dist/.next/server/chunks/ssr/node_modules_0sud39z._.js +3 -0
  162. package/dist/.next/server/chunks/ssr/node_modules_0ty2qhi._.js +3 -0
  163. package/dist/.next/server/chunks/ssr/node_modules_0u1te_7._.js +3 -0
  164. package/dist/.next/server/chunks/ssr/node_modules_0uvms5m._.js +3 -0
  165. package/dist/.next/server/chunks/ssr/{node_modules_0hsalo_._.js → node_modules_0v4zc0t._.js} +2 -2
  166. package/dist/.next/server/chunks/ssr/{node_modules_0j48jbs._.js → node_modules_0xme7lg._.js} +2 -2
  167. package/dist/.next/server/chunks/ssr/node_modules_0z2foqi._.js +3 -0
  168. package/dist/.next/server/chunks/ssr/node_modules_0z4gniu._.js +17 -0
  169. package/dist/.next/server/chunks/ssr/{node_modules_0makin.._.js → node_modules_1-wfv6i._.js} +1 -1
  170. package/dist/.next/server/chunks/ssr/node_modules_111pp7w._.js +3 -0
  171. package/dist/.next/server/chunks/ssr/node_modules_15pczok._.js +3 -0
  172. package/dist/.next/server/chunks/ssr/node_modules_16l6ua_._.js +3 -0
  173. package/dist/.next/server/chunks/ssr/node_modules_16q2m8u._.js +3 -0
  174. package/dist/.next/server/chunks/ssr/node_modules_17rj81n._.js +3 -0
  175. package/dist/.next/server/chunks/ssr/node_modules_1831lye._.js +3 -0
  176. package/dist/.next/server/chunks/ssr/node_modules_19b6jde._.js +3 -0
  177. package/dist/.next/server/chunks/ssr/node_modules_1_jf-yx._.js +17 -0
  178. package/dist/.next/server/chunks/ssr/node_modules_1_v-pb8._.js +3 -0
  179. package/dist/.next/server/chunks/ssr/node_modules_1bmqmso._.js +3 -0
  180. package/dist/.next/server/chunks/ssr/node_modules_1jpcwgl._.js +151 -0
  181. package/dist/.next/server/chunks/ssr/node_modules_1lio4hi._.js +3 -0
  182. package/dist/.next/server/chunks/ssr/{node_modules_0~gyl9u._.js → node_modules_1nck62h._.js} +1 -1
  183. package/dist/.next/server/chunks/ssr/{node_modules_0z~-p3m._.js → node_modules_1p9b60w._.js} +2 -2
  184. package/dist/.next/server/chunks/ssr/node_modules_1tj6b0h._.js +3 -0
  185. package/dist/.next/server/chunks/ssr/{node_modules_0xheqa8._.js → node_modules_1z_uie6._.js} +2 -2
  186. package/dist/.next/server/chunks/ssr/node_modules_1zskgct._.js +26 -0
  187. package/dist/.next/server/chunks/ssr/{node_modules_13oabuj._.js → node_modules_20p8pl7._.js} +2 -2
  188. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_01lis5y._.js +3 -0
  189. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_07fm7s3._.js +3 -0
  190. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0kitx9n._.js +3 -0
  191. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0x5ivvr._.js +3 -0
  192. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_145f4t2._.js +3 -0
  193. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1_o7dux._.js +3 -0
  194. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1alyi8-._.js +3 -0
  195. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1bxlr8e._.js +3 -0
  196. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1grmhd9._.js +3 -0
  197. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_00~7fbh._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_01pthdh._.js} +1 -1
  198. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_01-g753._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_03fanqm._.js} +1 -1
  199. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_02.ao_s._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0597f-k._.js} +1 -1
  200. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0l0_~d-._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0__ix0y._.js} +1 -1
  201. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0c.1f2e._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0muxjzn._.js} +1 -1
  202. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0pjzhbh._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_16vf13h._.js} +1 -1
  203. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0uq.qxy._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1fzbfn5._.js} +1 -1
  204. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0_yd3ib._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1quf15b._.js} +1 -1
  205. package/dist/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0.ksprp._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1vi37xl._.js} +1 -1
  206. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_20vrei_._.js +3 -0
  207. package/dist/.next/server/chunks/ssr/{node_modules_cytoscape_dist_cytoscape_esm_mjs_0642y5z._.js → node_modules_cytoscape_dist_cytoscape_esm_mjs_0arohj6._.js} +2 -2
  208. package/dist/.next/server/chunks/ssr/node_modules_dagre-d3-es_src_dagre_index_0g66msq.js +3 -0
  209. package/dist/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0oc7z2j._.js → node_modules_katex_dist_katex_mjs_04eh6b6._.js} +1 -1
  210. package/dist/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0zuygmo._.js → node_modules_katex_dist_katex_mjs_1oxucd3._.js} +1 -1
  211. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_blockDiagram-GPEHLZMM_mjs_0bclh9~._.js → node_modules_mermaid_dist_chunks_mermaid_core_blockDiagram-GPEHLZMM_mjs_0jxv2ay._.js} +2 -2
  212. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_c4Diagram-AAUBKEIU_mjs_11i~hhk._.js → node_modules_mermaid_dist_chunks_mermaid_core_c4Diagram-AAUBKEIU_mjs_1yyt6ej._.js} +1 -1
  213. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_chunk-3OPIFGDE_mjs_0p4md.t._.js → node_modules_mermaid_dist_chunks_mermaid_core_chunk-3OPIFGDE_mjs_165ua5_._.js} +1 -1
  214. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_chunk-5ZQYHXKU_mjs_0p7as5d._.js → node_modules_mermaid_dist_chunks_mermaid_core_chunk-5ZQYHXKU_mjs_16ac76u._.js} +2 -2
  215. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_chunk-727SXJPM_mjs_05x94.y._.js → node_modules_mermaid_dist_chunks_mermaid_core_chunk-727SXJPM_mjs_0a9kagr._.js} +1 -1
  216. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_chunk-AQP2D5EJ_mjs_0_foecb._.js → node_modules_mermaid_dist_chunks_mermaid_core_chunk-AQP2D5EJ_mjs_1p-51mn._.js} +1 -1
  217. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_chunk-CSCIHK7Q_mjs_0g3lwf.._.js → node_modules_mermaid_dist_chunks_mermaid_core_chunk-CSCIHK7Q_mjs_0savw5-._.js} +1 -1
  218. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_chunk-KSCS5N6A_mjs_0.lzb4g._.js → node_modules_mermaid_dist_chunks_mermaid_core_chunk-KSCS5N6A_mjs_1vk17qr._.js} +1 -1
  219. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_chunk-O5CBEL6O_mjs_041viuq._.js → node_modules_mermaid_dist_chunks_mermaid_core_chunk-O5CBEL6O_mjs_074844c._.js} +1 -1
  220. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_chunk-XPW4576I_mjs_0h8ib.t._.js → node_modules_mermaid_dist_chunks_mermaid_core_chunk-XPW4576I_mjs_0u9wa-b._.js} +2 -2
  221. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_dagre-BM42HDAG_mjs_0itw5kh._.js → node_modules_mermaid_dist_chunks_mermaid_core_dagre-BM42HDAG_mjs_0w_brpy._.js} +1 -1
  222. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_diagram-OG6HWLK6_mjs_0et-fze._.js → node_modules_mermaid_dist_chunks_mermaid_core_diagram-OG6HWLK6_mjs_0pzbdul._.js} +1 -1
  223. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_erDiagram-TEJ5UH35_mjs_12bfcsi._.js → node_modules_mermaid_dist_chunks_mermaid_core_erDiagram-TEJ5UH35_mjs_1_cyy1q._.js} +1 -1
  224. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_flowDiagram-I6XJVG4X_mjs_0136c8y._.js → node_modules_mermaid_dist_chunks_mermaid_core_flowDiagram-I6XJVG4X_mjs_01y3363._.js} +1 -1
  225. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_sankeyDiagram-5OEKKPKP_mjs_0z55106._.js → node_modules_mermaid_dist_chunks_mermaid_core_sankeyDiagram-5OEKKPKP_mjs_1nsv0tt._.js} +1 -1
  226. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-AJRCARHV_mjs_0azazz~._.js → node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-AJRCARHV_mjs_0j4-fk2._.js} +1 -1
  227. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_chunks_mermaid_core_vennDiagram-CIIHVFJN_mjs_0wzofym._.js → node_modules_mermaid_dist_chunks_mermaid_core_vennDiagram-CIIHVFJN_mjs_1jvbrvq._.js} +1 -1
  228. package/dist/.next/server/chunks/ssr/{node_modules_mermaid_dist_mermaid_core_mjs_0rr2bb.._.js → node_modules_mermaid_dist_mermaid_core_mjs_1ao-jv5._.js} +1 -1
  229. package/dist/.next/server/chunks/ssr/node_modules_next_dist_1n3w9lb._.js +6 -0
  230. package/dist/.next/server/chunks/ssr/node_modules_next_dist_1vz8kh1._.js +3 -0
  231. package/dist/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j3._.js +3 -0
  232. package/dist/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js → node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js} +2 -2
  233. package/dist/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0q-w892.js +3 -0
  234. package/dist/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js → node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js} +2 -2
  235. package/dist/.next/server/chunks/ssr/{node_modules_roughjs_bundled_rough_esm_0opq-c5.js → node_modules_roughjs_bundled_rough_esm_15c9pcx.js} +1 -1
  236. package/dist/.next/server/middleware-build-manifest.js +13 -10
  237. package/dist/.next/server/next-font-manifest.js +1 -1
  238. package/dist/.next/server/next-font-manifest.json +2 -2
  239. package/dist/.next/server/pages/404.html +1 -1
  240. package/dist/.next/server/pages/500.html +1 -1
  241. package/dist/.next/server/prefetch-hints.json +34 -1
  242. package/dist/.next/server/server-reference-manifest.js +1 -1
  243. package/dist/.next/server/server-reference-manifest.json +1 -1
  244. package/dist/.next/static/chunks/{0wbhqz.-ey98b.js → 01nhrh-3r57wh.js} +1 -1
  245. package/dist/.next/static/chunks/02g89o135esk3.js +22 -0
  246. package/dist/.next/static/chunks/03regxjjibliy.js +29 -0
  247. package/dist/.next/static/chunks/{0n46g0ilh8wj..js → 05cl5ojgc4_ku.js} +6 -6
  248. package/dist/.next/static/chunks/0c4y7_xzemq6-.js +1 -0
  249. package/dist/.next/static/chunks/{0p9rfgg_duajn.js → 0dm2etancr7wp.js} +1 -1
  250. package/dist/.next/static/chunks/{0hq~c-~dp2g~1.js → 0l2v1ybx0rm07.js} +1 -1
  251. package/dist/.next/static/chunks/{104yvyc1ce3q5.js → 0o19535rrdg5j.js} +1 -1
  252. package/dist/.next/static/chunks/0piaur2yhvb4v.js +1 -0
  253. package/dist/.next/static/chunks/{0rhvismtjivza.js → 0s3geiy0as3cz.js} +5 -5
  254. package/dist/.next/static/chunks/12b5tf_04ca4i.js +10 -0
  255. package/dist/.next/static/chunks/{0qm2930z0c.8m.js → 15746zaz9af2k.js} +16 -16
  256. package/dist/.next/static/chunks/15m2ikcj71414.js +1 -0
  257. package/dist/.next/static/chunks/{07znaqalfuldz.js → 17y1ca1c2d1k0.js} +1 -1
  258. package/dist/.next/static/chunks/{187v8dzyf1l-f.js → 18dnd1yq8sjcm.js} +1 -1
  259. package/dist/.next/static/chunks/1h978hs06gqwr.js +1 -0
  260. package/dist/.next/static/chunks/1s8wltynx2kei.js +24 -0
  261. package/dist/.next/static/chunks/1vqrf8u3eyf8l.js +1 -0
  262. package/dist/.next/static/chunks/{11h85j-8~tny3.js → 1wsp3h55ims3-.js} +1 -1
  263. package/dist/.next/static/chunks/1x1nff_ltcu7m.js +1 -0
  264. package/dist/.next/static/chunks/1ztlt8o8gnas8.js +1 -0
  265. package/dist/.next/static/chunks/{0mo3-obfy2_6v.js → 2-tnv5f86ywqz.js} +2 -2
  266. package/dist/.next/static/chunks/20uqpnur2j1hn.js +1 -0
  267. package/dist/.next/static/chunks/{175hd_pl41_vh.js → 26t_0sbrej8uf.js} +2 -2
  268. package/dist/.next/static/chunks/28flaeabfo316.js +31 -0
  269. package/dist/.next/static/chunks/2ba37l0xctlco.js +1 -0
  270. package/dist/.next/static/chunks/2ia3pig2diart.js +43 -0
  271. package/dist/.next/static/chunks/{0ez8v7k1e7v4o.js → 2qe97b2xjvm_s.js} +1 -1
  272. package/dist/.next/static/chunks/2rob7uh46oj_f.js +10 -0
  273. package/dist/.next/static/chunks/2v_t22-0u_seu.js +1 -0
  274. package/dist/.next/static/chunks/2zf625u-tcwdn.js +1 -0
  275. package/dist/.next/static/chunks/{0cs_h74-ljzlt.js → 3-q38f64d_smq.js} +3 -3
  276. package/dist/.next/static/chunks/31ttnjt6g35a0.js +1 -0
  277. package/dist/.next/static/chunks/33t46atd3n2zd.js +1 -0
  278. package/dist/.next/static/chunks/{0dsde0n1co0l..js → 357a_3k2qrz6b.js} +1 -1
  279. package/dist/.next/static/chunks/383s4_f7pq0oz.js +1 -0
  280. package/dist/.next/static/chunks/3cnkwh7z04e3e.js +24 -0
  281. package/dist/.next/static/chunks/{0e~yxiezknbzn.css → 3cyn-rs5rpay6.css} +2 -2
  282. package/dist/.next/static/chunks/3s7at3o7ube_p.js +9 -0
  283. package/dist/.next/static/chunks/{16m14x8k2fnon.js → 3wb9uvu5ii1sy.js} +1 -1
  284. package/dist/.next/static/chunks/41ii5ld31fjk5.js +148 -0
  285. package/dist/.next/static/chunks/turbopack-3cm-eevva8ksw.js +1 -0
  286. package/dist/node_modules/@img/sharp-darwin-arm64/index.cjs +2 -0
  287. package/dist/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64-0.35.3.node +0 -0
  288. package/dist/node_modules/@img/sharp-darwin-arm64/package.json +5 -4
  289. package/dist/node_modules/@img/sharp-libvips-darwin-arm64/README.md +15 -15
  290. package/dist/node_modules/@img/sharp-libvips-darwin-arm64/lib/glib-2.0/include/glibconfig.h +1 -3
  291. package/dist/node_modules/@img/sharp-libvips-darwin-arm64/lib/{libvips-cpp.8.17.3.dylib → libvips-cpp.8.18.3.dylib} +0 -0
  292. package/dist/node_modules/@img/sharp-libvips-darwin-arm64/package.json +3 -2
  293. package/dist/node_modules/@img/sharp-libvips-darwin-arm64/versions.json +21 -21
  294. package/dist/node_modules/@next/env/dist/index.js +1 -1
  295. package/dist/node_modules/@next/env/package.json +8 -8
  296. package/dist/node_modules/@swc/helpers/esm/_interop_require_default.js +4 -0
  297. package/dist/node_modules/@swc/helpers/esm/_interop_require_wildcard.js +36 -0
  298. package/dist/node_modules/@swc/helpers/package.json +703 -469
  299. package/dist/node_modules/next/dist/build/define-env.js +10 -2
  300. package/dist/node_modules/next/dist/build/duration-to-string.js +2 -3
  301. package/dist/node_modules/next/dist/build/next-config-ts/transpile-config.js +3 -114
  302. package/dist/node_modules/next/dist/build/segment-config/app/app-segment-config.js +35 -19
  303. package/dist/node_modules/next/dist/build/segment-config/app/app-segments.js +11 -1
  304. package/dist/node_modules/next/dist/build/static-paths/app.js +66 -19
  305. package/dist/node_modules/next/dist/build/swc/index.js +84 -23
  306. package/dist/node_modules/next/dist/build/swc/jest-transformer.js +1 -0
  307. package/dist/node_modules/next/dist/build/swc/options.js +13 -5
  308. package/dist/node_modules/next/dist/build/utils.js +112 -70
  309. package/dist/node_modules/next/dist/cli/next-test.js +2 -1
  310. package/dist/node_modules/next/dist/client/components/app-router-headers.js +0 -10
  311. package/dist/node_modules/next/dist/client/components/app-router-instance.js +50 -40
  312. package/dist/node_modules/next/dist/client/components/app-router.js +9 -1
  313. package/dist/node_modules/next/dist/client/components/error-boundary.js +13 -9
  314. package/dist/node_modules/next/dist/client/components/handle-isr-error.js +3 -3
  315. package/dist/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js +2 -2
  316. package/dist/node_modules/next/dist/{server/app-render/instant-validation/instant-samples-client.js → client/components/instant-samples.js} +13 -7
  317. package/dist/node_modules/next/dist/client/components/links.js +25 -8
  318. package/dist/node_modules/next/dist/client/components/nav-failure-handler.js +1 -1
  319. package/dist/node_modules/next/dist/client/components/navigation-dynamic-rendering.js +38 -0
  320. package/dist/node_modules/next/dist/client/components/navigation-untracked.js +5 -3
  321. package/dist/node_modules/next/dist/client/components/navigation.js +30 -9
  322. package/dist/node_modules/next/dist/client/components/offline.js +172 -0
  323. package/dist/node_modules/next/dist/client/components/readonly-url-search-params.js +5 -0
  324. package/dist/node_modules/next/dist/client/components/redirect.js +2 -2
  325. package/dist/node_modules/next/dist/client/components/router-reducer/compute-changed-path.js +5 -1
  326. package/dist/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +25 -17
  327. package/dist/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +196 -50
  328. package/dist/node_modules/next/dist/client/components/router-reducer/is-navigating-to-new-root-layout.js +30 -19
  329. package/dist/node_modules/next/dist/client/components/router-reducer/ppr-navigations.js +235 -102
  330. package/dist/node_modules/next/dist/client/components/router-reducer/reducers/hmr-refresh-reducer.js +8 -2
  331. package/dist/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +12 -5
  332. package/dist/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +15 -2
  333. package/dist/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +38 -9
  334. package/dist/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +11 -2
  335. package/dist/node_modules/next/dist/client/components/router-reducer/router-reducer.js +10 -2
  336. package/dist/node_modules/next/dist/client/components/router-transition.js +135 -0
  337. package/dist/node_modules/next/dist/client/components/segment-cache/bfcache.js +9 -7
  338. package/dist/node_modules/next/dist/client/components/segment-cache/cache-key.js +31 -3
  339. package/dist/node_modules/next/dist/client/components/segment-cache/cache-map.js +33 -12
  340. package/dist/node_modules/next/dist/client/components/segment-cache/cache.js +1089 -338
  341. package/dist/node_modules/next/dist/client/components/segment-cache/fetch.js +37 -0
  342. package/dist/node_modules/next/dist/client/components/segment-cache/navigation-testing-lock.js +324 -103
  343. package/dist/node_modules/next/dist/client/components/segment-cache/navigation.js +218 -42
  344. package/dist/node_modules/next/dist/client/components/segment-cache/optimistic-routes.js +222 -117
  345. package/dist/node_modules/next/dist/client/components/segment-cache/prefetch.js +2 -1
  346. package/dist/node_modules/next/dist/client/components/segment-cache/scheduler.js +756 -235
  347. package/dist/node_modules/next/dist/client/components/segment-cache/types.js +19 -4
  348. package/dist/node_modules/next/dist/client/components/segment-cache/vary-path.js +50 -2
  349. package/dist/node_modules/next/dist/client/components/server-async-storage.js +43 -0
  350. package/dist/node_modules/next/dist/client/components/unstable-rethrow.js +15 -8
  351. package/dist/node_modules/next/dist/client/components/use-offline.js +68 -0
  352. package/dist/node_modules/next/dist/client/dev/debug-channel.js +367 -11
  353. package/dist/node_modules/next/dist/client/flight-data-helpers.js +4 -1
  354. package/dist/node_modules/next/dist/client/normalize-trailing-slash.js +2 -1
  355. package/dist/node_modules/next/dist/client/route-params.js +12 -10
  356. package/dist/node_modules/next/dist/compiled/@hapi/accept/index.js +1 -1
  357. package/dist/node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/index.js +1 -1
  358. package/dist/node_modules/next/dist/compiled/@napi-rs/triples/index.js +1 -1
  359. package/dist/node_modules/next/dist/compiled/@opentelemetry/api/index.js +1 -1
  360. package/dist/node_modules/next/dist/compiled/@vercel/detect-agent/index.js +1 -0
  361. package/dist/node_modules/next/dist/compiled/@vercel/detect-agent/package.json +1 -0
  362. package/dist/node_modules/next/dist/compiled/async-retry/index.js +1 -1
  363. package/dist/node_modules/next/dist/compiled/async-sema/index.js +1 -1
  364. package/dist/node_modules/next/dist/compiled/busboy/index.js +1 -1
  365. package/dist/node_modules/next/dist/compiled/bytes/index.js +2 -2
  366. package/dist/node_modules/next/dist/compiled/ci-info/index.js +1 -1
  367. package/dist/node_modules/next/dist/compiled/commander/index.js +1 -1
  368. package/dist/node_modules/next/dist/compiled/comment-json/index.js +2 -2
  369. package/dist/node_modules/next/dist/compiled/compression/index.js +10 -10
  370. package/dist/node_modules/next/dist/compiled/conf/index.js +2 -14
  371. package/dist/node_modules/next/dist/compiled/content-disposition/index.js +2 -2
  372. package/dist/node_modules/next/dist/compiled/cross-spawn/index.js +1 -1
  373. package/dist/node_modules/next/dist/compiled/debug/index.js +1 -1
  374. package/dist/node_modules/next/dist/compiled/edge-runtime/index.js +1 -1
  375. package/dist/node_modules/next/dist/compiled/find-up/index.js +1 -1
  376. package/dist/node_modules/next/dist/compiled/fresh/index.js +2 -2
  377. package/dist/node_modules/next/dist/compiled/httpxy/index.js +1 -0
  378. package/dist/node_modules/next/dist/compiled/httpxy/package.json +1 -0
  379. package/dist/node_modules/next/dist/compiled/image-detector/detector.js +1 -1
  380. package/dist/node_modules/next/dist/compiled/image-size/index.js +1 -1
  381. package/dist/node_modules/next/dist/compiled/ipaddr.js/ipaddr.js +1 -1
  382. package/dist/node_modules/next/dist/compiled/is-animated/index.js +1 -1
  383. package/dist/node_modules/next/dist/compiled/is-docker/index.js +1 -1
  384. package/dist/node_modules/next/dist/compiled/is-wsl/index.js +1 -1
  385. package/dist/node_modules/next/dist/compiled/jsonwebtoken/index.js +3 -3
  386. package/dist/node_modules/next/dist/compiled/nanoid/index.cjs +1 -1
  387. package/dist/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +144 -15
  388. package/dist/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +144 -15
  389. package/dist/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +3 -3
  390. package/dist/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +12 -12
  391. package/dist/node_modules/next/dist/compiled/p-limit/index.js +1 -1
  392. package/dist/node_modules/next/dist/compiled/p-queue/index.js +1 -1
  393. package/dist/node_modules/next/dist/compiled/path-browserify/index.js +1 -1
  394. package/dist/node_modules/next/dist/compiled/picomatch/index.js +1 -1
  395. package/dist/node_modules/next/dist/compiled/react-is/package.json +3 -3
  396. package/dist/node_modules/next/dist/compiled/semver/index.js +1 -1
  397. package/dist/node_modules/next/dist/compiled/send/index.js +13 -13
  398. package/dist/node_modules/next/dist/compiled/source-map/source-map.js +1 -1
  399. package/dist/node_modules/next/dist/compiled/string-hash/index.js +1 -1
  400. package/dist/node_modules/next/dist/compiled/strip-ansi/index.js +1 -1
  401. package/dist/node_modules/next/dist/compiled/superstruct/index.cjs +1 -1
  402. package/dist/node_modules/next/dist/compiled/tar/index.min.js +1 -1
  403. package/dist/node_modules/next/dist/compiled/text-table/index.js +1 -1
  404. package/dist/node_modules/next/dist/compiled/watchpack/watchpack.js +1 -1
  405. package/dist/node_modules/next/dist/compiled/write-file-atomic/index.js +1 -0
  406. package/dist/node_modules/next/dist/compiled/write-file-atomic/package.json +1 -0
  407. package/dist/node_modules/next/dist/compiled/ws/index.js +1 -1
  408. package/dist/node_modules/next/dist/compiled/zod/index.cjs +1 -1
  409. package/dist/node_modules/next/dist/compiled/zod-validation-error/index.js +1 -1
  410. package/dist/node_modules/next/dist/experimental/testmode/fetch.js +8 -0
  411. package/dist/node_modules/next/dist/experimental/testmode/httpget.js +9 -2
  412. package/dist/node_modules/next/dist/experimental/testmode/server.js +11 -0
  413. package/dist/node_modules/next/dist/lib/bundler.js +72 -1
  414. package/dist/node_modules/next/dist/lib/create-client-router-filter.js +16 -0
  415. package/dist/node_modules/next/dist/lib/find-root.js +187 -33
  416. package/dist/node_modules/next/dist/lib/format-dynamic-import-path.js +23 -4
  417. package/dist/node_modules/next/dist/lib/git-worktree.js +74 -0
  418. package/dist/node_modules/next/dist/lib/helpers/get-pkg-manager.js +10 -8
  419. package/dist/node_modules/next/dist/lib/helpers/git.js +59 -0
  420. package/dist/node_modules/next/dist/lib/install-dependencies.js +1 -1
  421. package/dist/node_modules/next/dist/lib/is-serializable-props.js +5 -0
  422. package/dist/node_modules/next/dist/lib/metadata/get-metadata-route.js +54 -15
  423. package/dist/node_modules/next/dist/lib/metadata/metadata.js +20 -46
  424. package/dist/node_modules/next/dist/lib/metadata/resolve-metadata.js +14 -14
  425. package/dist/node_modules/next/dist/lib/needs-experimental-react.js +2 -2
  426. package/dist/node_modules/next/dist/lib/patch-incorrect-lockfile.js +5 -5
  427. package/dist/node_modules/next/dist/lib/profiles-dir.js +45 -0
  428. package/dist/node_modules/next/dist/lib/require-instrumentation-client.js +10 -4
  429. package/dist/node_modules/next/dist/lib/resolve-build-paths.js +38 -10
  430. package/dist/node_modules/next/dist/lib/turbopack-cache-seed.js +171 -0
  431. package/dist/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +4 -84
  432. package/dist/node_modules/next/dist/lib/typescript/loadTsConfig.js +181 -0
  433. package/dist/node_modules/next/dist/lib/typescript/missingDependencyError.js +2 -3
  434. package/dist/node_modules/next/dist/lib/typescript/runTypeCheckCli.js +53 -0
  435. package/dist/node_modules/next/dist/lib/typescript/runTypeScriptCli.js +256 -0
  436. package/dist/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js +2 -0
  437. package/dist/node_modules/next/dist/lib/verify-partytown-setup.js +15 -26
  438. package/dist/node_modules/next/dist/lib/verify-typescript-setup.js +97 -56
  439. package/dist/node_modules/next/dist/server/after/after-context.js +55 -17
  440. package/dist/node_modules/next/dist/server/after/after.js +4 -2
  441. package/dist/node_modules/next/dist/server/api-utils/index.js +20 -4
  442. package/dist/node_modules/next/dist/server/api-utils/node/try-get-preview-data.js +5 -2
  443. package/dist/node_modules/next/dist/server/app-render/action-handler.js +162 -54
  444. package/dist/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +176 -11
  445. package/dist/node_modules/next/dist/server/app-render/app-render.js +3249 -1275
  446. package/dist/node_modules/next/dist/server/app-render/blocking-route-messages.js +181 -0
  447. package/dist/node_modules/next/dist/server/app-render/collect-segment-data.js +531 -210
  448. package/dist/node_modules/next/dist/server/app-render/create-component-styles-and-scripts.js +9 -4
  449. package/dist/node_modules/next/dist/server/app-render/create-component-tree.js +13 -77
  450. package/dist/node_modules/next/dist/server/app-render/create-error-handler.js +19 -18
  451. package/dist/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js +78 -26
  452. package/dist/node_modules/next/dist/server/app-render/debug-channel-server.js +26 -9
  453. package/dist/node_modules/next/dist/server/app-render/debug-channel-server.node.js +60 -0
  454. package/dist/node_modules/next/dist/server/app-render/debug-channel-server.web.js +8 -19
  455. package/dist/node_modules/next/dist/server/app-render/dev-validation-error-delivery.js +37 -0
  456. package/dist/node_modules/next/dist/server/app-render/dev-validation-events.js +26 -0
  457. package/dist/node_modules/next/dist/server/app-render/dev-validation-scheduler.js +87 -0
  458. package/dist/node_modules/next/dist/server/app-render/dev-validation-worker-globals.js +41 -0
  459. package/dist/node_modules/next/dist/server/app-render/dev-validation-worker-snapshot.js +79 -0
  460. package/dist/node_modules/next/dist/server/app-render/dynamic-rendering.js +261 -204
  461. package/dist/node_modules/next/dist/server/app-render/encryption.js +11 -9
  462. package/dist/node_modules/next/dist/server/app-render/entry-base.js +25 -16
  463. package/dist/node_modules/next/dist/server/app-render/get-css-inlined-link-tags.js +2 -6
  464. package/dist/node_modules/next/dist/server/app-render/get-layer-assets.js +11 -7
  465. package/dist/node_modules/next/dist/server/app-render/instant-test-bootstrap.js +20 -0
  466. package/dist/node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js +21 -3
  467. package/dist/node_modules/next/dist/server/app-render/instant-validation/boundary-impl.js +25 -1
  468. package/dist/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js +24 -4
  469. package/dist/node_modules/next/dist/server/app-render/instant-validation/instant-config.js +119 -59
  470. package/dist/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js +10 -10
  471. package/dist/node_modules/next/dist/server/app-render/instant-validation/instant-validation.js +394 -173
  472. package/dist/node_modules/next/dist/server/app-render/make-get-server-inserted-html.js +3 -4
  473. package/dist/node_modules/next/dist/server/app-render/manifests-singleton.js +78 -15
  474. package/dist/node_modules/next/dist/server/app-render/module-loading/instrument-module-getter.js +32 -0
  475. package/dist/node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js +2 -6
  476. package/dist/node_modules/next/dist/server/app-render/postponed-state.js +78 -5
  477. package/dist/node_modules/next/dist/server/app-render/render-css-resource.js +20 -15
  478. package/dist/node_modules/next/dist/server/app-render/staged-rendering.js +182 -201
  479. package/dist/node_modules/next/dist/server/app-render/stale-time.js +0 -10
  480. package/dist/node_modules/next/dist/server/app-render/stream-ops.js +85 -36
  481. package/dist/node_modules/next/dist/server/app-render/stream-ops.node.js +842 -0
  482. package/dist/node_modules/next/dist/server/app-render/stream-ops.web.js +116 -30
  483. package/dist/node_modules/next/dist/server/app-render/sync-io-messages.js +67 -0
  484. package/dist/node_modules/next/dist/server/app-render/use-flight-response.js +11 -8
  485. package/dist/node_modules/next/dist/server/app-render/vary-params.js +113 -188
  486. package/dist/node_modules/next/dist/server/app-render/wait-for-response.js +36 -0
  487. package/dist/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +11 -6
  488. package/dist/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js +33 -63
  489. package/dist/node_modules/next/dist/server/async-storage/draft-mode-provider.js +2 -2
  490. package/dist/node_modules/next/dist/server/async-storage/request-store.js +84 -27
  491. package/dist/node_modules/next/dist/server/async-storage/work-store.js +7 -1
  492. package/dist/node_modules/next/dist/server/base-server.js +147 -72
  493. package/dist/node_modules/next/dist/server/body-streams.js +9 -1
  494. package/dist/node_modules/next/dist/server/client-component-renderer-logger.js +2 -2
  495. package/dist/node_modules/next/dist/server/config-schema.js +84 -10
  496. package/dist/node_modules/next/dist/server/config-shared.js +46 -20
  497. package/dist/node_modules/next/dist/server/config.js +343 -52
  498. package/dist/node_modules/next/dist/server/dev/browser-logs/file-logger.js +4 -4
  499. package/dist/node_modules/next/dist/server/dev/browser-logs/receive-logs.js +152 -100
  500. package/dist/node_modules/next/dist/server/dev/debug-channel.js +48 -23
  501. package/dist/node_modules/next/dist/server/dev/dev-validation-worker-pool.js +232 -0
  502. package/dist/node_modules/next/dist/server/dev/dev-validation-worker.js +308 -0
  503. package/dist/node_modules/next/dist/server/dev/hot-middleware.js +3 -1
  504. package/dist/node_modules/next/dist/server/dev/hot-reloader-rspack.js +1 -1
  505. package/dist/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +420 -144
  506. package/dist/node_modules/next/dist/server/dev/hot-reloader-types.js +2 -0
  507. package/dist/node_modules/next/dist/server/dev/hot-reloader-webpack.js +17 -23
  508. package/dist/node_modules/next/dist/server/dev/log-requests.js +3 -0
  509. package/dist/node_modules/next/dist/server/dev/middleware-turbopack.js +26 -7
  510. package/dist/node_modules/next/dist/server/dev/middleware-webpack.js +20 -8
  511. package/dist/node_modules/next/dist/server/dev/node-stack-frames.js +9 -0
  512. package/dist/node_modules/next/dist/server/dev/require-cache.js +33 -3
  513. package/dist/node_modules/next/dist/server/dev/serialized-errors.js +1 -1
  514. package/dist/node_modules/next/dist/server/dev/static-paths-worker.js +4 -3
  515. package/dist/node_modules/next/dist/server/dev/turbopack-utils.js +52 -12
  516. package/dist/node_modules/next/dist/server/dev/use-cache-probe-pool.js +177 -0
  517. package/dist/node_modules/next/dist/server/dev/use-cache-probe-worker.js +180 -0
  518. package/dist/node_modules/next/dist/server/dynamic-rendering-utils.js +200 -23
  519. package/dist/node_modules/next/dist/server/get-page-files.js +20 -3
  520. package/dist/node_modules/next/dist/server/image-optimizer.js +47 -39
  521. package/dist/node_modules/next/dist/server/lib/app-info-log.js +19 -16
  522. package/dist/node_modules/next/dist/server/lib/cache-handlers/default.js +41 -5
  523. package/dist/node_modules/next/dist/server/lib/cpu-profile.js +2 -5
  524. package/dist/node_modules/next/dist/server/lib/dev-bundler-service.js +17 -2
  525. package/dist/node_modules/next/dist/server/lib/encode-header-safe.js +44 -0
  526. package/dist/node_modules/next/dist/server/lib/generate-agent-files.js +180 -0
  527. package/dist/node_modules/next/dist/server/lib/implicit-tags.js +16 -6
  528. package/dist/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +17 -4
  529. package/dist/node_modules/next/dist/server/lib/incremental-cache/index.js +120 -74
  530. package/dist/node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js +13 -11
  531. package/dist/node_modules/next/dist/server/lib/incremental-cache/tags-manifest.external.js +1 -1
  532. package/dist/node_modules/next/dist/server/lib/is-non-html-sec-fetch-dest.js +38 -0
  533. package/dist/node_modules/next/dist/server/lib/lazy-module.js +80 -0
  534. package/dist/node_modules/next/dist/server/lib/lru-cache.js +1 -1
  535. package/dist/node_modules/next/dist/server/lib/mock-request.js +1 -1
  536. package/dist/node_modules/next/dist/server/lib/params-utils.js +70 -0
  537. package/dist/node_modules/next/dist/server/lib/patch-fetch.js +66 -17
  538. package/dist/node_modules/next/dist/server/lib/release-compression-stream.js +24 -0
  539. package/dist/node_modules/next/dist/server/lib/render-server.js +3 -1
  540. package/dist/node_modules/next/dist/server/lib/router-server.js +70 -13
  541. package/dist/node_modules/next/dist/server/lib/router-utils/block-cross-site-dev.js +2 -2
  542. package/dist/node_modules/next/dist/server/lib/router-utils/cache-life-type-utils.js +1 -0
  543. package/dist/node_modules/next/dist/server/lib/router-utils/filesystem.js +31 -10
  544. package/dist/node_modules/next/dist/server/lib/router-utils/instrumentation-node-extensions.js +54 -36
  545. package/dist/node_modules/next/dist/server/lib/router-utils/proxy-request.js +19 -9
  546. package/dist/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +5 -2
  547. package/dist/node_modules/next/dist/server/lib/router-utils/root-params-type-utils.js +61 -0
  548. package/dist/node_modules/next/dist/server/lib/router-utils/route-types-utils.js +40 -0
  549. package/dist/node_modules/next/dist/server/lib/router-utils/typegen.js +55 -21
  550. package/dist/node_modules/next/dist/server/lib/source-maps.js +54 -9
  551. package/dist/node_modules/next/dist/server/lib/start-server.js +69 -23
  552. package/dist/node_modules/next/dist/server/lib/streaming-metadata.js +11 -22
  553. package/dist/node_modules/next/dist/server/lib/trace/constants.js +5 -0
  554. package/dist/node_modules/next/dist/server/lib/trace/local-span-recorder.js +385 -0
  555. package/dist/node_modules/next/dist/server/lib/trace/request-insights-identity.js +39 -0
  556. package/dist/node_modules/next/dist/server/lib/trace/request-insights.js +308 -0
  557. package/dist/node_modules/next/dist/server/lib/trace/span-store.js +69 -0
  558. package/dist/node_modules/next/dist/server/lib/trace/tracer.js +123 -11
  559. package/dist/node_modules/next/dist/server/lib/utils.js +14 -0
  560. package/dist/node_modules/next/dist/server/load-components.js +8 -2
  561. package/dist/node_modules/next/dist/server/mcp/get-or-create-mcp-server.js +10 -0
  562. package/dist/node_modules/next/dist/server/mcp/tools/compile-route.js +86 -0
  563. package/dist/node_modules/next/dist/server/mcp/tools/get-compilation-issues.js +68 -0
  564. package/dist/node_modules/next/dist/server/mcp/tools/get-request-insights.js +57 -0
  565. package/dist/node_modules/next/dist/server/mcp/tools/utils/format-compilation-issues.js +72 -0
  566. package/dist/node_modules/next/dist/server/mcp/tools/utils/resolve-path-to-route.js +49 -0
  567. package/dist/node_modules/next/dist/server/next-server.js +30 -16
  568. package/dist/node_modules/next/dist/server/next.js +42 -12
  569. package/dist/node_modules/next/dist/server/node-environment-extensions/io-utils.js +31 -124
  570. package/dist/node_modules/next/dist/server/node-environment-extensions/process-error-handlers.js +156 -77
  571. package/dist/node_modules/next/dist/server/node-environment-extensions/unhandled-rejection.external.js +12 -2
  572. package/dist/node_modules/next/dist/server/og/cache-image-response.js +341 -0
  573. package/dist/node_modules/next/dist/server/og/image-response.js +22 -3
  574. package/dist/node_modules/next/dist/server/patch-error-inspect.js +70 -16
  575. package/dist/node_modules/next/dist/server/pipe-readable.js +73 -1
  576. package/dist/node_modules/next/dist/server/render-result.js +42 -0
  577. package/dist/node_modules/next/dist/server/render.js +3 -1
  578. package/dist/node_modules/next/dist/server/request/connection.js +6 -4
  579. package/dist/node_modules/next/dist/server/request/cookies.js +18 -14
  580. package/dist/node_modules/next/dist/server/request/draft-mode.js +11 -3
  581. package/dist/node_modules/next/dist/server/request/fallback-params.js +1 -1
  582. package/dist/node_modules/next/dist/server/request/headers.js +16 -10
  583. package/dist/node_modules/next/dist/server/request/io.js +96 -0
  584. package/dist/node_modules/next/dist/server/request/params.js +191 -84
  585. package/dist/node_modules/next/dist/server/request/pathname.js +24 -2
  586. package/dist/node_modules/next/dist/server/request/root-params.js +9 -1
  587. package/dist/node_modules/next/dist/server/request/search-params.js +126 -70
  588. package/dist/node_modules/next/dist/server/request/utils.js +39 -6
  589. package/dist/node_modules/next/dist/server/response-cache/index.js +36 -24
  590. package/dist/node_modules/next/dist/server/resume-data-cache/cache-store.js +7 -2
  591. package/dist/node_modules/next/dist/server/resume-data-cache/resume-data-cache.js +25 -7
  592. package/dist/node_modules/next/dist/server/revalidation-utils.js +1 -2
  593. package/dist/node_modules/next/dist/server/route-modules/app-page/module.js +15 -1
  594. package/dist/node_modules/next/dist/server/route-modules/app-page/normalize-request-url.js +40 -3
  595. package/dist/node_modules/next/dist/server/route-modules/app-route/module.js +79 -46
  596. package/dist/node_modules/next/dist/server/route-modules/pages/pages-handler.js +270 -248
  597. package/dist/node_modules/next/dist/server/route-modules/route-module.js +45 -8
  598. package/dist/node_modules/next/dist/server/stream-utils/node-buffered-transform-stream.js +51 -0
  599. package/dist/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +90 -69
  600. package/dist/node_modules/next/dist/server/typescript/index.js +3 -3
  601. package/dist/node_modules/next/dist/server/typescript/rules/client-boundary.js +7 -4
  602. package/dist/node_modules/next/dist/server/typescript/rules/config.js +50 -28
  603. package/dist/node_modules/next/dist/server/use-cache/cache-life-profile.js +84 -0
  604. package/dist/node_modules/next/dist/server/use-cache/cache-life.js +4 -65
  605. package/dist/node_modules/next/dist/server/use-cache/clone-cache-entry.js +28 -0
  606. package/dist/node_modules/next/dist/server/use-cache/constants.js +24 -8
  607. package/dist/node_modules/next/dist/server/use-cache/handlers.js +166 -13
  608. package/dist/node_modules/next/dist/server/use-cache/tiered-cache-handler.js +145 -0
  609. package/dist/node_modules/next/dist/server/use-cache/use-cache-errors.js +34 -11
  610. package/dist/node_modules/next/dist/server/use-cache/use-cache-probe-globals.js +39 -0
  611. package/dist/node_modules/next/dist/server/use-cache/use-cache-probe-scheduler.js +117 -0
  612. package/dist/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +1475 -458
  613. package/dist/node_modules/next/dist/server/web/adapter.js +37 -4
  614. package/dist/node_modules/next/dist/server/web/edge-route-module-wrapper.js +14 -2
  615. package/dist/node_modules/next/dist/server/web/error.js +15 -0
  616. package/dist/node_modules/next/dist/server/web/sandbox/context.js +8 -2
  617. package/dist/node_modules/next/dist/server/web/sandbox/resource-managers.js +45 -10
  618. package/dist/node_modules/next/dist/server/web/spec-extension/adapters/headers.js +103 -2
  619. package/dist/node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js +15 -0
  620. package/dist/node_modules/next/dist/server/web/spec-extension/revalidate.js +18 -6
  621. package/dist/node_modules/next/dist/server/web/spec-extension/unstable-cache.js +35 -17
  622. package/dist/node_modules/next/dist/server/web/spec-extension/url-pattern.js +1 -2
  623. package/dist/node_modules/next/dist/shared/lib/app-router-types.js +125 -12
  624. package/dist/node_modules/next/dist/shared/lib/constants.js +5 -0
  625. package/dist/node_modules/next/dist/shared/lib/deployment-id.js +1 -1
  626. package/dist/node_modules/next/dist/shared/lib/errors/empty-generate-static-params-error.js +14 -7
  627. package/dist/node_modules/next/dist/shared/lib/errors/hard-deprecated-config-error.js +5 -0
  628. package/dist/node_modules/next/dist/shared/lib/head.js +5 -4
  629. package/dist/node_modules/next/dist/shared/lib/instant-messages.js +43 -0
  630. package/dist/node_modules/next/dist/shared/lib/invariant-error.js +5 -0
  631. package/dist/node_modules/next/dist/shared/lib/request-insights.js +30 -0
  632. package/dist/node_modules/next/dist/shared/lib/router/adapters.js +4 -1
  633. package/dist/node_modules/next/dist/shared/lib/router/routes/app.js +36 -12
  634. package/dist/node_modules/next/dist/shared/lib/router/utils/escape-path-delimiters.js +1 -1
  635. package/dist/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +1 -1
  636. package/dist/node_modules/next/dist/shared/lib/router/utils/prepare-destination.js +2 -1
  637. package/dist/node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js +5 -4
  638. package/dist/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js +1 -1
  639. package/dist/node_modules/next/dist/shared/lib/segment-cache/vary-params-decoding.js +46 -12
  640. package/dist/node_modules/next/dist/shared/lib/server-reference-info.js +12 -0
  641. package/dist/node_modules/next/dist/shared/lib/utils.js +10 -1
  642. package/dist/node_modules/next/dist/telemetry/agent-name.js +20 -0
  643. package/dist/node_modules/next/dist/telemetry/anonymous-meta.js +4 -2
  644. package/dist/node_modules/next/dist/telemetry/events/build.js +13 -0
  645. package/dist/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  646. package/dist/node_modules/next/dist/telemetry/events/version.js +6 -4
  647. package/dist/node_modules/next/dist/telemetry/storage.js +6 -2
  648. package/dist/node_modules/next/dist/trace/report/to-json.js +7 -1
  649. package/dist/node_modules/next/package.json +16 -255
  650. package/dist/node_modules/semver/package.json +38 -0
  651. package/dist/node_modules/sharp/{lib/channel.js → dist/channel.cjs} +1 -1
  652. package/dist/node_modules/sharp/dist/channel.mjs +177 -0
  653. package/dist/node_modules/sharp/{lib/colour.js → dist/colour.cjs} +11 -7
  654. package/dist/node_modules/sharp/dist/colour.mjs +199 -0
  655. package/dist/node_modules/sharp/{lib/composite.js → dist/composite.cjs} +2 -1
  656. package/dist/node_modules/sharp/dist/composite.mjs +213 -0
  657. package/dist/node_modules/sharp/{lib/constructor.js → dist/constructor.cjs} +41 -29
  658. package/dist/node_modules/sharp/dist/constructor.mjs +511 -0
  659. package/dist/node_modules/sharp/dist/index.cjs +25 -0
  660. package/dist/node_modules/sharp/dist/index.d.cts +1999 -0
  661. package/dist/node_modules/sharp/dist/index.d.mts +2046 -0
  662. package/dist/node_modules/sharp/dist/index.mjs +25 -0
  663. package/dist/node_modules/sharp/{lib/input.js → dist/input.cjs} +27 -22
  664. package/dist/node_modules/sharp/dist/input.mjs +814 -0
  665. package/dist/node_modules/sharp/{lib/is.js → dist/is.cjs} +1 -1
  666. package/dist/node_modules/sharp/dist/is.mjs +143 -0
  667. package/dist/node_modules/sharp/{lib/libvips.js → dist/libvips.cjs} +35 -30
  668. package/dist/node_modules/sharp/dist/libvips.mjs +212 -0
  669. package/dist/node_modules/sharp/{lib/operation.js → dist/operation.cjs} +33 -51
  670. package/dist/node_modules/sharp/dist/operation.mjs +998 -0
  671. package/dist/node_modules/sharp/{lib/output.js → dist/output.cjs} +162 -40
  672. package/dist/node_modules/sharp/dist/output.mjs +1788 -0
  673. package/dist/node_modules/sharp/{lib/resize.js → dist/resize.cjs} +46 -24
  674. package/dist/node_modules/sharp/dist/resize.mjs +617 -0
  675. package/dist/node_modules/sharp/dist/sharp.cjs +174 -0
  676. package/dist/node_modules/sharp/dist/sharp.mjs +174 -0
  677. package/dist/node_modules/sharp/{lib/utility.js → dist/utility.cjs} +18 -8
  678. package/dist/node_modules/sharp/dist/utility.mjs +301 -0
  679. package/dist/node_modules/sharp/node_modules/semver/classes/range.js +17 -4
  680. package/dist/node_modules/sharp/node_modules/semver/classes/semver.js +19 -2
  681. package/dist/node_modules/sharp/node_modules/semver/functions/clean.js +8 -0
  682. package/dist/node_modules/sharp/node_modules/semver/functions/compare-build.js +9 -0
  683. package/dist/node_modules/sharp/node_modules/semver/functions/compare-loose.js +5 -0
  684. package/dist/node_modules/sharp/node_modules/semver/functions/diff.js +60 -0
  685. package/dist/node_modules/sharp/node_modules/semver/functions/inc.js +21 -0
  686. package/dist/node_modules/sharp/node_modules/semver/functions/major.js +5 -0
  687. package/dist/node_modules/sharp/node_modules/semver/functions/minor.js +5 -0
  688. package/dist/node_modules/sharp/node_modules/semver/functions/patch.js +5 -0
  689. package/dist/node_modules/sharp/node_modules/semver/functions/prerelease.js +8 -0
  690. package/dist/node_modules/sharp/node_modules/semver/functions/rcompare.js +5 -0
  691. package/dist/node_modules/sharp/node_modules/semver/functions/rsort.js +5 -0
  692. package/dist/node_modules/sharp/node_modules/semver/functions/sort.js +5 -0
  693. package/dist/node_modules/sharp/node_modules/semver/functions/truncate.js +48 -0
  694. package/dist/node_modules/sharp/node_modules/semver/functions/valid.js +8 -0
  695. package/dist/node_modules/sharp/node_modules/semver/index.js +93 -0
  696. package/dist/node_modules/sharp/node_modules/semver/package.json +2 -2
  697. package/dist/node_modules/sharp/node_modules/semver/ranges/gtr.js +6 -0
  698. package/dist/node_modules/sharp/node_modules/semver/ranges/intersects.js +9 -0
  699. package/dist/node_modules/sharp/node_modules/semver/ranges/ltr.js +6 -0
  700. package/dist/node_modules/sharp/node_modules/semver/ranges/max-satisfying.js +27 -0
  701. package/dist/node_modules/sharp/node_modules/semver/ranges/min-satisfying.js +26 -0
  702. package/dist/node_modules/sharp/node_modules/semver/ranges/min-version.js +63 -0
  703. package/dist/node_modules/sharp/node_modules/semver/ranges/outside.js +82 -0
  704. package/dist/node_modules/sharp/node_modules/semver/ranges/simplify.js +49 -0
  705. package/dist/node_modules/sharp/node_modules/semver/ranges/subset.js +249 -0
  706. package/dist/node_modules/sharp/node_modules/semver/ranges/to-comparators.js +10 -0
  707. package/dist/node_modules/sharp/node_modules/semver/ranges/valid.js +13 -0
  708. package/dist/node_modules/sharp/package.json +77 -52
  709. package/dist/package.json +2 -2
  710. package/dist/server.js +1 -1
  711. package/package.json +2 -2
  712. package/dist/.next/server/app/_global-error.segments/_head.segment.rsc +0 -5
  713. package/dist/.next/server/app/_global-error.segments/_index.segment.rsc +0 -5
  714. package/dist/.next/server/app/_not-found.segments/_head.segment.rsc +0 -6
  715. package/dist/.next/server/app/_not-found.segments/_index.segment.rsc +0 -8
  716. package/dist/.next/server/app/_not-found.segments/_not-found.segment.rsc +0 -5
  717. package/dist/.next/server/app/index.segments/_head.segment.rsc +0 -6
  718. package/dist/.next/server/app/index.segments/_index.segment.rsc +0 -8
  719. package/dist/.next/server/chunks/[externals]_next_dist_0arv.vj._.js +0 -3
  720. package/dist/.next/server/chunks/[root-of-the-server]__04y5ms7._.js +0 -6
  721. package/dist/.next/server/chunks/[root-of-the-server]__05vp2x.._.js +0 -3
  722. package/dist/.next/server/chunks/[root-of-the-server]__08kko28._.js +0 -3
  723. package/dist/.next/server/chunks/[root-of-the-server]__0bpxd~j._.js +0 -3
  724. package/dist/.next/server/chunks/[root-of-the-server]__0cnmh23._.js +0 -3
  725. package/dist/.next/server/chunks/[root-of-the-server]__0j8-xkl._.js +0 -13
  726. package/dist/.next/server/chunks/[root-of-the-server]__0nngqla._.js +0 -6
  727. package/dist/.next/server/chunks/[root-of-the-server]__0o.c5k_._.js +0 -3
  728. package/dist/.next/server/chunks/[root-of-the-server]__0pz~0wz._.js +0 -6
  729. package/dist/.next/server/chunks/[root-of-the-server]__0s6.s21._.js +0 -6
  730. package/dist/.next/server/chunks/[root-of-the-server]__0vunt~c._.js +0 -3
  731. package/dist/.next/server/chunks/[root-of-the-server]__0xoct7b._.js +0 -3
  732. package/dist/.next/server/chunks/[root-of-the-server]__0yvyeh4._.js +0 -3
  733. package/dist/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0dh.2jf.js +0 -3
  734. package/dist/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0qs61ly.js +0 -3
  735. package/dist/.next/server/chunks/ssr/[root-of-the-server]__01cqrhy._.js +0 -33
  736. package/dist/.next/server/chunks/ssr/[root-of-the-server]__098zro9._.js +0 -19
  737. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0cylknl._.js +0 -12
  738. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0e_kl3j._.js +0 -3
  739. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0e~coys._.js +0 -3
  740. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0lb9jwe._.js +0 -3
  741. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0tcyn68._.js +0 -33
  742. package/dist/.next/server/chunks/ssr/[root-of-the-server]__0zi~h76._.js +0 -3
  743. package/dist/.next/server/chunks/ssr/[root-of-the-server]__1130a6w._.js +0 -3
  744. package/dist/.next/server/chunks/ssr/[root-of-the-server]__12~42ln._.js +0 -3
  745. package/dist/.next/server/chunks/ssr/_03eop86._.js +0 -4
  746. package/dist/.next/server/chunks/ssr/_next-internal_server_app_page_actions_09-gtaw.js +0 -3
  747. package/dist/.next/server/chunks/ssr/node_modules_0-9jf7s._.js +0 -3
  748. package/dist/.next/server/chunks/ssr/node_modules_0.l_o9k._.js +0 -26
  749. package/dist/.next/server/chunks/ssr/node_modules_00-o__w._.js +0 -45
  750. package/dist/.next/server/chunks/ssr/node_modules_00yk8df._.js +0 -3
  751. package/dist/.next/server/chunks/ssr/node_modules_01rqq7y._.js +0 -3
  752. package/dist/.next/server/chunks/ssr/node_modules_050o3~0._.js +0 -3
  753. package/dist/.next/server/chunks/ssr/node_modules_09x0yif._.js +0 -3
  754. package/dist/.next/server/chunks/ssr/node_modules_0_ce7g1._.js +0 -3
  755. package/dist/.next/server/chunks/ssr/node_modules_0a61e8g._.js +0 -3
  756. package/dist/.next/server/chunks/ssr/node_modules_0a9st_6._.js +0 -3
  757. package/dist/.next/server/chunks/ssr/node_modules_0cdeu-p._.js +0 -6
  758. package/dist/.next/server/chunks/ssr/node_modules_0d91z34._.js +0 -11
  759. package/dist/.next/server/chunks/ssr/node_modules_0exnvlg._.js +0 -17
  760. package/dist/.next/server/chunks/ssr/node_modules_0h3oz6o._.js +0 -3
  761. package/dist/.next/server/chunks/ssr/node_modules_0kf5axs._.js +0 -3
  762. package/dist/.next/server/chunks/ssr/node_modules_0k~wgzn._.js +0 -3
  763. package/dist/.next/server/chunks/ssr/node_modules_0l-2che._.js +0 -3
  764. package/dist/.next/server/chunks/ssr/node_modules_0m8d9.a._.js +0 -3
  765. package/dist/.next/server/chunks/ssr/node_modules_0p1ro75._.js +0 -3
  766. package/dist/.next/server/chunks/ssr/node_modules_0q8gl61._.js +0 -3
  767. package/dist/.next/server/chunks/ssr/node_modules_0s8hn7e._.js +0 -3
  768. package/dist/.next/server/chunks/ssr/node_modules_0skn4ke._.js +0 -3
  769. package/dist/.next/server/chunks/ssr/node_modules_0u1jua0._.js +0 -17
  770. package/dist/.next/server/chunks/ssr/node_modules_0ujy5r7._.js +0 -3
  771. package/dist/.next/server/chunks/ssr/node_modules_0xl3swb._.js +0 -17
  772. package/dist/.next/server/chunks/ssr/node_modules_0yx-7n5._.js +0 -31
  773. package/dist/.next/server/chunks/ssr/node_modules_11r29oo._.js +0 -3
  774. package/dist/.next/server/chunks/ssr/node_modules_12uy2-t._.js +0 -3
  775. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_00zox90._.js +0 -3
  776. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_048nvza._.js +0 -3
  777. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0bqbkzr._.js +0 -3
  778. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0iy4ann._.js +0 -3
  779. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0n~wpy6._.js +0 -3
  780. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0rp8krb._.js +0 -3
  781. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0se--ys._.js +0 -3
  782. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0v554rd._.js +0 -3
  783. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_12i5eeu._.js +0 -3
  784. package/dist/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_13s5vbm._.js +0 -3
  785. package/dist/.next/server/chunks/ssr/node_modules_dagre-d3-es_src_dagre_index_097t5l0.js +0 -3
  786. package/dist/.next/server/chunks/ssr/node_modules_next_dist_0xdsm99._.js +0 -6
  787. package/dist/.next/server/chunks/ssr/node_modules_next_dist_client_components_0inhx6q._.js +0 -3
  788. package/dist/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js +0 -3
  789. package/dist/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_00t_ate.js +0 -4
  790. package/dist/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_031v14j.js +0 -4
  791. package/dist/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0rc3ul_.js +0 -4
  792. package/dist/.next/static/chunks/0-.wbb-l7eg0y.js +0 -1
  793. package/dist/.next/static/chunks/0-6znc4v4kg4~.js +0 -1
  794. package/dist/.next/static/chunks/038jxymv2x4u-.js +0 -148
  795. package/dist/.next/static/chunks/08nzg~fbi7p-7.js +0 -1
  796. package/dist/.next/static/chunks/0aqpm5mabssqz.js +0 -1
  797. package/dist/.next/static/chunks/0dcu67gngfgpb.js +0 -4
  798. package/dist/.next/static/chunks/0do2sl_ugmstg.js +0 -10
  799. package/dist/.next/static/chunks/0ge0mq0ea60lx.js +0 -1
  800. package/dist/.next/static/chunks/0h-pxsp01miga.js +0 -1
  801. package/dist/.next/static/chunks/0i8pgzf~hu-3m.js +0 -24
  802. package/dist/.next/static/chunks/0icpvuwlmnlty.js +0 -43
  803. package/dist/.next/static/chunks/0ipk1er3w80bj.js +0 -24
  804. package/dist/.next/static/chunks/0lfej4svc~ist.js +0 -1
  805. package/dist/.next/static/chunks/0lmzx880lnpb..js +0 -1
  806. package/dist/.next/static/chunks/0luwdx.2p-x9e.js +0 -31
  807. package/dist/.next/static/chunks/0npm9l63~4j0v.js +0 -1
  808. package/dist/.next/static/chunks/0r~zu0c3j_b7p.js +0 -1
  809. package/dist/.next/static/chunks/0~b.d.ay4u9zg.js +0 -2
  810. package/dist/.next/static/chunks/112qdnf547wz8.js +0 -1
  811. package/dist/.next/static/chunks/11uh-ttx4zin-.js +0 -9
  812. package/dist/.next/static/chunks/12udp03cbusxh.js +0 -10
  813. package/dist/.next/static/chunks/14i46k409qlt0.js +0 -1
  814. package/dist/.next/static/chunks/14j238ax8coge.js +0 -29
  815. package/dist/.next/static/chunks/14u7twut.vmn5.js +0 -1
  816. package/dist/.next/static/chunks/16k05wezoz4u0.js +0 -1
  817. package/dist/.next/static/chunks/turbopack-12mx7z-ex6m1h.js +0 -1
  818. package/dist/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64.node +0 -0
  819. package/dist/node_modules/next/dist/client/components/unstable-rethrow.browser.js +0 -28
  820. package/dist/node_modules/next/dist/client/components/unstable-rethrow.server.js +0 -32
  821. package/dist/node_modules/next/dist/compiled/http-proxy/index.js +0 -34
  822. package/dist/node_modules/next/dist/compiled/http-proxy/package.json +0 -1
  823. package/dist/node_modules/next/dist/lib/fatal-error.js +0 -14
  824. package/dist/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +0 -39
  825. package/dist/node_modules/sharp/lib/index.js +0 -16
  826. package/dist/node_modules/sharp/lib/sharp.js +0 -121
  827. /package/dist/.next/static/{7aCwaA3-bL6RnqwYt0PmW → OdIi-OEl7eDEMfmeeT85N}/_buildManifest.js +0 -0
  828. /package/dist/.next/static/{7aCwaA3-bL6RnqwYt0PmW → OdIi-OEl7eDEMfmeeT85N}/_clientMiddlewareManifest.js +0 -0
  829. /package/dist/.next/static/{7aCwaA3-bL6RnqwYt0PmW → OdIi-OEl7eDEMfmeeT85N}/_ssgManifest.js +0 -0
  830. /package/dist/.next/static/chunks/{01ontipw7_pn-.js → 059oqdb-4djh4.js} +0 -0
  831. /package/dist/.next/static/chunks/{03lth2le32c6r.js → 0bk3aw3m9c72a.js} +0 -0
  832. /package/dist/.next/static/chunks/{03l_lqxocp3uj.js → 0bko6sy3fi25l.js} +0 -0
  833. /package/dist/.next/static/chunks/{03v0v690_bw8u.js → 0catqiaei7kwh.js} +0 -0
  834. /package/dist/.next/static/chunks/{03yru4-m-450t.js → 0cm59yzmvnr6a.js} +0 -0
  835. /package/dist/.next/static/chunks/{03~yq9q893hmn.js → 0cz1d0mv5g_q7.js} +0 -0
  836. /package/dist/.next/static/chunks/{06o.rsm2b~dht.js → 0ll25xvc8tvc7.js} +0 -0
  837. /package/dist/.next/static/chunks/{08o5wsrurx9ux.js → 0r-qze3me8owo.js} +0 -0
  838. /package/dist/.next/static/chunks/{09~n7y-jkmjlj.js → 0wf_g68m1dyuq.js} +0 -0
  839. /package/dist/.next/static/chunks/{0awsj.h.eiuen.js → 0z7hf76h0cz39.js} +0 -0
  840. /package/dist/.next/static/chunks/{0axtn1ln1j35_.js → 0zao0i_njogzy.js} +0 -0
  841. /package/dist/.next/static/chunks/{0c5xj4q0jmdu0.js → 11jp13p4e7ycl.js} +0 -0
  842. /package/dist/.next/static/chunks/{0cu8k_dz43e4y.js → 13j02-7zvh70e.js} +0 -0
  843. /package/dist/.next/static/chunks/{0e4xdug~7dxzk.js → 17zvg7jc-nx5v.js} +0 -0
  844. /package/dist/.next/static/chunks/{0f8bbcvfh6x_j.js → 1bi4m489puezc.js} +0 -0
  845. /package/dist/.next/static/chunks/{0gq18q-ip0uh2.js → 1g6nbgmclpjgd.js} +0 -0
  846. /package/dist/.next/static/chunks/{0k9_1v72yx36d.js → 1rxbddx-dyypf.js} +0 -0
  847. /package/dist/.next/static/chunks/{0l3uvjh3oslhq.js → 1un-c368y76x-.js} +0 -0
  848. /package/dist/.next/static/chunks/{0lypu-.xpph9..js → 1x5foe7mtvd8m.js} +0 -0
  849. /package/dist/.next/static/chunks/{0ortphe030oky.js → 24c-6p_4lbozm.js} +0 -0
  850. /package/dist/.next/static/chunks/{0oufb2b491l23.js → 24l5e3uup8rxf.js} +0 -0
  851. /package/dist/.next/static/chunks/{0ps77yd96walr.js → 27n_wru0tprv5.js} +0 -0
  852. /package/dist/.next/static/chunks/{0qfu4h5g.k-yt.js → 29x7ecuc6vybp.js} +0 -0
  853. /package/dist/.next/static/chunks/{0rmt10l3458p_.js → 2dqeid-8xhwun.js} +0 -0
  854. /package/dist/.next/static/chunks/{0s0v8xobo-2ok.js → 2f6739bq5ewxz.js} +0 -0
  855. /package/dist/.next/static/chunks/{0s8nwq43gep9_.js → 2fuc_smcevit1.js} +0 -0
  856. /package/dist/.next/static/chunks/{0spswjguxbqfn.js → 2h7acwi-mfsrx.js} +0 -0
  857. /package/dist/.next/static/chunks/{0xxouzzjw_a6q.js → 2y3wq_x8yyu_b.js} +0 -0
  858. /package/dist/.next/static/chunks/{0ydl92ezt_ppz.js → 2zrfdnujo3u51.js} +0 -0
  859. /package/dist/.next/static/chunks/{16pzrphqjtyli.js → 3-t8rqn47mim5.js} +0 -0
  860. /package/dist/.next/static/chunks/{0~.e-m04zn5l_.js → 3cvv663zekq_n.js} +0 -0
  861. /package/dist/.next/static/chunks/{11luuvvu~stmv.js → 3l6bwn061vy22.js} +0 -0
  862. /package/dist/.next/static/chunks/{11_7qxlc92f5s.js → 3mcxvhb8ujk39.js} +0 -0
  863. /package/dist/.next/static/chunks/{13mjf5q.pema_.js → 3rru41488bc4e.js} +0 -0
  864. /package/dist/.next/static/chunks/{159151ghv9-cc.js → 3x5hww03ialmf.js} +0 -0
  865. /package/dist/.next/static/chunks/{15r_pfbdb2jhp.js → 3ypwau9uw-qzz.js} +0 -0
  866. /package/dist/.next/static/chunks/{182b_f_n0-cdr.js → 44dlrjamdw9zn.js} +0 -0
  867. /package/dist/.next/static/media/{1bffadaabf893a1e-s.16ipb6fqu393i.woff2 → 1bffadaabf893a1e-s.3-6t-g6q0vh0a.woff2} +0 -0
  868. /package/dist/.next/static/media/{2bbe8d2671613f1f-s.067x_6k0k23tk.woff2 → 2bbe8d2671613f1f-s.0k62hbripvv8p.woff2} +0 -0
  869. /package/dist/.next/static/media/{2c55a0e60120577a-s.0bjc5tiuqdqro.woff2 → 2c55a0e60120577a-s.0-dom-5bn10r2.woff2} +0 -0
  870. /package/dist/.next/static/media/{5476f68d60460930-s.0wxq9webf.ew4.woff2 → 5476f68d60460930-s.2uwcyprjm3xu3.woff2} +0 -0
  871. /package/dist/.next/static/media/{83afe278b6a6bb3c-s.p.0q-301v4kxxnr.woff2 → 83afe278b6a6bb3c-s.p.2bn3s6zvc0dyp.woff2} +0 -0
  872. /package/dist/.next/static/media/{9c72aa0f40e4eef8-s.0m6w47a4e5dy9.woff2 → 9c72aa0f40e4eef8-s.1y4-pdgsjb-pw.woff2} +0 -0
  873. /package/dist/.next/static/media/{KaTeX_AMS-Regular.0b~8ki5y928w2.woff → KaTeX_AMS-Regular.10y3kupq4t663.woff} +0 -0
  874. /package/dist/.next/static/media/{KaTeX_AMS-Regular.0p1vbqd84i2~o.woff2 → KaTeX_AMS-Regular.25ieegmnh38ts.woff2} +0 -0
  875. /package/dist/.next/static/media/{KaTeX_AMS-Regular.173t6ktr7uf-w.ttf → KaTeX_AMS-Regular.418dr7cz3fo2x.ttf} +0 -0
  876. /package/dist/.next/static/media/{KaTeX_Caligraphic-Bold.01-pzluls4zgb.woff2 → KaTeX_Caligraphic-Bold.06b-ya9t43ioz.woff2} +0 -0
  877. /package/dist/.next/static/media/{KaTeX_Caligraphic-Bold.0x2v1lwn~880f.woff → KaTeX_Caligraphic-Bold.2vmk2hva4ctha.woff} +0 -0
  878. /package/dist/.next/static/media/{KaTeX_Caligraphic-Bold.16zv5fax0h0ka.ttf → KaTeX_Caligraphic-Bold.40ltxhe834pns.ttf} +0 -0
  879. /package/dist/.next/static/media/{KaTeX_Caligraphic-Regular.02i3z7wig438t.ttf → KaTeX_Caligraphic-Regular.07-7u27-nhn_r.ttf} +0 -0
  880. /package/dist/.next/static/media/{KaTeX_Caligraphic-Regular.0rysu1t-ncjq8.woff2 → KaTeX_Caligraphic-Regular.2eph4dlhid_m9.woff2} +0 -0
  881. /package/dist/.next/static/media/{KaTeX_Caligraphic-Regular.10927swgekwun.woff → KaTeX_Caligraphic-Regular.3gxeetazf831f.woff} +0 -0
  882. /package/dist/.next/static/media/{KaTeX_Fraktur-Bold.0et27v~3~4uhe.ttf → KaTeX_Fraktur-Bold.19yqa_tc9d_gx.ttf} +0 -0
  883. /package/dist/.next/static/media/{KaTeX_Fraktur-Bold.0e-16u10iuyyf.woff → KaTeX_Fraktur-Bold.1alcy76__wdj2.woff} +0 -0
  884. /package/dist/.next/static/media/{KaTeX_Fraktur-Bold.0w23i72~hprpq.woff2 → KaTeX_Fraktur-Bold.2sasz-d-jtw8y.woff2} +0 -0
  885. /package/dist/.next/static/media/{KaTeX_Fraktur-Regular.0b.riegzdfue2.woff → KaTeX_Fraktur-Regular.110oo81prr9n5.woff} +0 -0
  886. /package/dist/.next/static/media/{KaTeX_Fraktur-Regular.0rekyoa-52fj_.woff2 → KaTeX_Fraktur-Regular.2d10y4xmjvzlf.woff2} +0 -0
  887. /package/dist/.next/static/media/{KaTeX_Fraktur-Regular.0vjwa15znhk~4.ttf → KaTeX_Fraktur-Regular.2qhy34r6a05dn.ttf} +0 -0
  888. /package/dist/.next/static/media/{KaTeX_Main-Bold.09i7~607shf-h.ttf → KaTeX_Main-Bold.0us_n0tnxlxu7.ttf} +0 -0
  889. /package/dist/.next/static/media/{KaTeX_Main-Bold.09lmynrorhcbw.woff → KaTeX_Main-Bold.0v1esh257kqpe.woff} +0 -0
  890. /package/dist/.next/static/media/{KaTeX_Main-Bold.16pfc63_du6mx.woff2 → KaTeX_Main-Bold.3-rowy8o6_4ky.woff2} +0 -0
  891. /package/dist/.next/static/media/{KaTeX_Main-BoldItalic.0cp37g7x1q8h6.woff → KaTeX_Main-BoldItalic.13355ck5zr48q.woff} +0 -0
  892. /package/dist/.next/static/media/{KaTeX_Main-BoldItalic.0d54rk08rx11s.woff2 → KaTeX_Main-BoldItalic.14r2naom8mrec.woff2} +0 -0
  893. /package/dist/.next/static/media/{KaTeX_Main-BoldItalic.15j6k~hix2t_0.ttf → KaTeX_Main-BoldItalic.3x_u9cepaced0.ttf} +0 -0
  894. /package/dist/.next/static/media/{KaTeX_Main-Italic.0382gqciexmbu.woff → KaTeX_Main-Italic.0afv392dj4w59.woff} +0 -0
  895. /package/dist/.next/static/media/{KaTeX_Main-Italic.06o5nq0_91v60.woff2 → KaTeX_Main-Italic.0lig0v9j0700p.woff2} +0 -0
  896. /package/dist/.next/static/media/{KaTeX_Main-Italic.0su4i6mm18-wo.ttf → KaTeX_Main-Italic.2hkw3230mfwcv.ttf} +0 -0
  897. /package/dist/.next/static/media/{KaTeX_Main-Regular.08zh8z.7shijf.ttf → KaTeX_Main-Regular.0symfa7dqj6jd.ttf} +0 -0
  898. /package/dist/.next/static/media/{KaTeX_Main-Regular.0diheg01zyoph.woff → KaTeX_Main-Regular.15u8r3b2y7fv4.woff} +0 -0
  899. /package/dist/.next/static/media/{KaTeX_Main-Regular.0kaf-ag2_wkm-.woff2 → KaTeX_Main-Regular.1ryvsdzh2w1_e.woff2} +0 -0
  900. /package/dist/.next/static/media/{KaTeX_Math-BoldItalic.0ajzxypnbx1h1.ttf → KaTeX_Math-BoldItalic.0y5w36a5aq__2.ttf} +0 -0
  901. /package/dist/.next/static/media/{KaTeX_Math-BoldItalic.0ck1myuerwyqw.woff → KaTeX_Math-BoldItalic.12pl58orkw9rg.woff} +0 -0
  902. /package/dist/.next/static/media/{KaTeX_Math-BoldItalic.0ja97dn.cpc87.woff2 → KaTeX_Math-BoldItalic.1oopuu636h4il.woff2} +0 -0
  903. /package/dist/.next/static/media/{KaTeX_Math-Italic.09xkhecjcn5r9.woff → KaTeX_Math-Italic.0w0b1ugh62cfr.woff} +0 -0
  904. /package/dist/.next/static/media/{KaTeX_Math-Italic.0x23a-bmp-5tg.ttf → KaTeX_Math-Italic.2vkekfblmz5nb.ttf} +0 -0
  905. /package/dist/.next/static/media/{KaTeX_Math-Italic.0zrha2c4sl2je.woff2 → KaTeX_Math-Italic.32405s1aq8vas.woff2} +0 -0
  906. /package/dist/.next/static/media/{KaTeX_SansSerif-Bold.05a9.pc1j_zx9.woff2 → KaTeX_SansSerif-Bold.0h3wi2z_eouyg.woff2} +0 -0
  907. /package/dist/.next/static/media/{KaTeX_SansSerif-Bold.0jcl-ayi1uun0.woff → KaTeX_SansSerif-Bold.1ovw5p-yjp56g.woff} +0 -0
  908. /package/dist/.next/static/media/{KaTeX_SansSerif-Bold.0re8y.dm7.mt5.ttf → KaTeX_SansSerif-Bold.2d03q85pwxpti.ttf} +0 -0
  909. /package/dist/.next/static/media/{KaTeX_SansSerif-Italic.0a0234dc3s62j.woff2 → KaTeX_SansSerif-Italic.0wkjc4dm2kcit.woff2} +0 -0
  910. /package/dist/.next/static/media/{KaTeX_SansSerif-Italic.0judofdln9731.woff → KaTeX_SansSerif-Italic.1qavw__2zz8gk.woff} +0 -0
  911. /package/dist/.next/static/media/{KaTeX_SansSerif-Italic.10z1iap9pfus8.ttf → KaTeX_SansSerif-Italic.3i-q087b23-m8.ttf} +0 -0
  912. /package/dist/.next/static/media/{KaTeX_SansSerif-Regular.0h9yjlugq4q_e.woff → KaTeX_SansSerif-Regular.1i4afx8nk8n4r.woff} +0 -0
  913. /package/dist/.next/static/media/{KaTeX_SansSerif-Regular.0v6gcj32-czft.woff2 → KaTeX_SansSerif-Regular.2peiewu59z3d-.woff2} +0 -0
  914. /package/dist/.next/static/media/{KaTeX_SansSerif-Regular.0zm18kga42ebc.ttf → KaTeX_SansSerif-Regular.31pbu25feko_c.ttf} +0 -0
  915. /package/dist/.next/static/media/{KaTeX_Script-Regular.0c4.h-mer83d_.woff2 → KaTeX_Script-Regular.11h14300o9pd0.woff2} +0 -0
  916. /package/dist/.next/static/media/{KaTeX_Script-Regular.0q14y6zkzlpob.ttf → KaTeX_Script-Regular.28p_x7iz71ofe.ttf} +0 -0
  917. /package/dist/.next/static/media/{KaTeX_Script-Regular.0ze6v4r_-99oy.woff → KaTeX_Script-Regular.3110jb9c-bxna.woff} +0 -0
  918. /package/dist/.next/static/media/{KaTeX_Size1-Regular.013x6a4ierotp.woff2 → KaTeX_Size1-Regular.03lhvx36ekcou.woff2} +0 -0
  919. /package/dist/.next/static/media/{KaTeX_Size1-Regular.0kidw0oi.m68o.woff → KaTeX_Size1-Regular.1slf4bh0hc6vm.woff} +0 -0
  920. /package/dist/.next/static/media/{KaTeX_Size1-Regular.0m6y-i6wfokni.ttf → KaTeX_Size1-Regular.1y57-ck23ey8c.ttf} +0 -0
  921. /package/dist/.next/static/media/{KaTeX_Size2-Regular.0blpmluwilgbg.woff → KaTeX_Size2-Regular.0-kwyvx03omo8.woff} +0 -0
  922. /package/dist/.next/static/media/{KaTeX_Size2-Regular.0d5inmyp-tyv3.woff2 → KaTeX_Size2-Regular.14s5gg-puz6h-.woff2} +0 -0
  923. /package/dist/.next/static/media/{KaTeX_Size2-Regular.0wnhnvj-.k9d5.ttf → KaTeX_Size2-Regular.2u0s-b07k2o9m.ttf} +0 -0
  924. /package/dist/.next/static/media/{KaTeX_Size3-Regular.01h0xm_sfctj3.woff → KaTeX_Size3-Regular.04o9a_02gu_e8.woff} +0 -0
  925. /package/dist/.next/static/media/{KaTeX_Size3-Regular.0iukctyhw5j56.woff2 → KaTeX_Size3-Regular.1n1rgzz84z8r9.woff2} +0 -0
  926. /package/dist/.next/static/media/{KaTeX_Size3-Regular.0jl8mqyf4gzpn.ttf → KaTeX_Size3-Regular.1pkn-dge4q0fv.ttf} +0 -0
  927. /package/dist/.next/static/media/{KaTeX_Size4-Regular.0w3.rb_c4stzk.woff2 → KaTeX_Size4-Regular.2sgotkdv3dcyv.woff2} +0 -0
  928. /package/dist/.next/static/media/{KaTeX_Size4-Regular.0wr_9l81-mu06.ttf → KaTeX_Size4-Regular.2uelkfk2yna5e.ttf} +0 -0
  929. /package/dist/.next/static/media/{KaTeX_Size4-Regular.12tvaesf3.zl3.woff → KaTeX_Size4-Regular.3p2r1l7xmebxv.woff} +0 -0
  930. /package/dist/.next/static/media/{KaTeX_Typewriter-Regular.0c4zdxz~8frhm.woff2 → KaTeX_Typewriter-Regular.11gr2d2wuwz77.woff2} +0 -0
  931. /package/dist/.next/static/media/{KaTeX_Typewriter-Regular.0cgrzn5l3kao5.woff → KaTeX_Typewriter-Regular.12f8myjij3617.woff} +0 -0
  932. /package/dist/.next/static/media/{KaTeX_Typewriter-Regular.128~qc3858otl.ttf → KaTeX_Typewriter-Regular.3nee9kjfy6nm8.ttf} +0 -0
  933. /package/dist/.next/static/media/{ad66f9afd8947f86-s.11u06r12fd6v_.woff2 → ad66f9afd8947f86-s.3lvt2whj97whp.woff2} +0 -0
  934. /package/dist/.next/static/media/{icon.0j1xc6-m~vsbh.png → icon.1n_rla2f79pbj.png} +0 -0
@@ -18,9 +18,15 @@ const _manifestssingleton = require("../app-render/manifests-singleton");
18
18
  const _encryption = require("../app-render/encryption");
19
19
  const _invarianterror = require("../../shared/lib/invariant-error");
20
20
  const _createerrorhandler = require("../app-render/create-error-handler");
21
+ const _errortelemetryutils = require("../../lib/error-telemetry-utils");
22
+ const _stringhash = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/string-hash"));
21
23
  const _constants = require("./constants");
22
24
  const _constants1 = require("../../lib/constants");
23
25
  const _handlers = require("./handlers");
26
+ const _clonecacheentry = require("./clone-cache-entry");
27
+ const _approuterheaders = require("../../client/components/app-router-headers");
28
+ const _requestcookies = require("../web/spec-extension/adapters/request-cookies");
29
+ const _headers = require("../web/spec-extension/adapters/headers");
24
30
  const _usecacheerrors = require("./use-cache-errors");
25
31
  const _dynamicrendering = require("../app-render/dynamic-rendering");
26
32
  const _searchparams = require("../request/search-params");
@@ -28,6 +34,13 @@ const _lazyresult = require("../lib/lazy-result");
28
34
  const _dynamicaccessasyncstorageexternal = require("../app-render/dynamic-access-async-storage.external");
29
35
  const _stagedrendering = require("../app-render/staged-rendering");
30
36
  const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../build/output/log"));
37
+ const _runtimereactsexternal = require("../runtime-reacts.external");
38
+ const _promisewithresolvers = require("../../shared/lib/promise-with-resolvers");
39
+ function _interop_require_default(obj) {
40
+ return obj && obj.__esModule ? obj : {
41
+ default: obj
42
+ };
43
+ }
31
44
  function _getRequireWildcardCache(nodeInterop) {
32
45
  if (typeof WeakMap !== "function") return null;
33
46
  var cacheBabelInterop = new WeakMap();
@@ -69,12 +82,99 @@ function _interop_require_wildcard(obj, nodeInterop) {
69
82
  }
70
83
  return newObj;
71
84
  }
85
+ /**
86
+ * Encapsulates a pending cache invocation for deduping. Manages lazy stream
87
+ * tee-ing (via fork()) and metadata access for both intra-request and
88
+ * cross-request joiners.
89
+ */ class SharedCacheEntry {
90
+ constructor(stream, pendingMetadata){
91
+ this.stream = stream;
92
+ this.pendingMetadata = pendingMetadata;
93
+ }
94
+ /**
95
+ * Tee the stream: returns a copy for the caller, replaces the internal stream
96
+ * with the remaining branch for future callers. Both the leader and joiners
97
+ * call this — everyone gets a fork.
98
+ */ fork() {
99
+ const [forked, remaining] = this.stream.tee();
100
+ this.stream = remaining;
101
+ return forked;
102
+ }
103
+ }
104
+ function ignoreReject() {}
105
+ /**
106
+ * Manages the deferred promise for a shared cache result, tracks which maps
107
+ * it's registered in, and drives cleanup from resolve/reject.
108
+ *
109
+ * For 'cached' results, cleanup is lazy: entries stay in the maps until
110
+ * metadata/collection resolves, giving late-arriving invocations a chance to
111
+ * join while the leader streams. For 'prerender-dynamic' and errors, cleanup
112
+ * is immediate.
113
+ */ class ResolvableSharedCacheResult {
114
+ registerIn(map, key, retentionMap) {
115
+ map.set(key, this.deferred.promise);
116
+ this.registrations.push({
117
+ map,
118
+ key,
119
+ retentionMap
120
+ });
121
+ }
122
+ resolve(result) {
123
+ this.deferred.resolve(result);
124
+ if (result.type === 'cached') {
125
+ // Retain only an entry that collected successfully. A failed collection
126
+ // leaves metadata a later invocation cannot read, so it is dropped like
127
+ // any other failure and the next invocation regenerates.
128
+ result.entry.pendingMetadata.then(()=>this.cleanupAndRetain(), ()=>this.cleanup());
129
+ } else {
130
+ this.cleanup();
131
+ }
132
+ }
133
+ reject(error) {
134
+ // The promise stored in the dedup maps has no consumer unless a concurrent
135
+ // invocation joined it, so we attach a noop catch handler to prevent the
136
+ // rejection from being reported as unhandled. The leader rethrows the
137
+ // error into the render, which is where it's surfaced.
138
+ this.deferred.promise.catch(ignoreReject);
139
+ this.deferred.reject(error);
140
+ this.cleanup();
141
+ }
142
+ /**
143
+ * Drops the pending registrations, leaving nothing for a later invocation to
144
+ * join. Used when the invocation produced no entry that a later one could
145
+ * serve: an error has no value, and a 'prerender-dynamic' result is a hanging
146
+ * promise bound to the leader's render signal.
147
+ */ cleanup() {
148
+ for (const { map, key } of this.registrations){
149
+ map.delete(key);
150
+ }
151
+ }
152
+ /**
153
+ * Drops the pending registrations and moves the entry into the retention map
154
+ * where one was given, so a later invocation in the same request can reuse it
155
+ * instead of repeating the lookup and, on a miss, the work.
156
+ */ cleanupAndRetain() {
157
+ for (const { map, key, retentionMap } of this.registrations){
158
+ map.delete(key);
159
+ retentionMap == null ? void 0 : retentionMap.set(key, this.deferred.promise);
160
+ }
161
+ }
162
+ constructor(){
163
+ this.deferred = (0, _promisewithresolvers.createPromiseWithResolvers)();
164
+ this.registrations = [];
165
+ }
166
+ }
167
+ /**
168
+ * Module-scope map for cross-request deduplication. Keyed by `cacheHandlerKey`
169
+ * (specific key on warm path, coarse key on cold path). Entries live only for
170
+ * the duration of the leader's invocation.
171
+ */ const crossRequestPendingCacheInvocations = new Map();
72
172
  const isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge';
73
173
  const debug = process.env.NEXT_PRIVATE_DEBUG_CACHE ? console.debug.bind(console, 'use-cache:') : undefined;
74
174
  const filterStackFrame = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').filterStackFrameDEV : undefined;
75
175
  const findSourceMapURL = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').findSourceMapURLDEV : undefined;
76
- const nestedCacheZeroRevalidateErrorMessage = `A "use cache" with zero \`revalidate\` is nested inside another "use cache" ` + `that has no explicit \`cacheLife\`, which is not allowed during ` + `prerendering. Add \`cacheLife()\` to the outer \`"use cache"\` to choose ` + `whether it should be prerendered (with non-zero \`revalidate\`) or remain ` + `dynamic (with zero \`revalidate\`). Read more: ` + `https://nextjs.org/docs/messages/nested-use-cache-no-explicit-cachelife`;
77
- const nestedCacheShortExpireErrorMessage = `A "use cache" with short \`expire\` (under 5 minutes) is nested inside ` + `another "use cache" that has no explicit \`cacheLife\`, which is not ` + `allowed during prerendering. Add \`cacheLife()\` to the outer \`"use cache"\` ` + `to choose whether it should be prerendered (with longer \`expire\`) or remain ` + `dynamic (with short \`expire\`). Read more: ` + `https://nextjs.org/docs/messages/nested-use-cache-no-explicit-cachelife`;
176
+ const nestedCacheZeroRevalidateErrorMessage = `A "use cache" with zero \`revalidate\` is nested inside another "use cache" ` + `that has no explicit \`cacheLife\`, which is not allowed during ` + `prerendering. Add \`cacheLife()\` to the outer "use cache" to choose ` + `whether it should be prerendered (with non-zero \`revalidate\`) or remain ` + `dynamic (with zero \`revalidate\`). Read more: ` + `https://nextjs.org/docs/messages/nested-use-cache-no-explicit-cachelife`;
177
+ const nestedCacheShortExpireErrorMessage = `A "use cache" with short \`expire\` (under 5 minutes) is nested inside ` + `another "use cache" that has no explicit \`cacheLife\`, which is not ` + `allowed during prerendering. Add \`cacheLife()\` to the outer "use cache" ` + `to choose whether it should be prerendered (with longer \`expire\`) or remain ` + `dynamic (with short \`expire\`). Read more: ` + `https://nextjs.org/docs/messages/nested-use-cache-no-explicit-cachelife`;
78
178
  // Tracks which root params each cache function has historically read. Used to
79
179
  // compute the specific cache key upfront on subsequent invocations. In-memory
80
180
  // only — after server restart, the coarse-key redirect entry in the cache
@@ -103,8 +203,80 @@ function computeRootParamsCacheKeySuffix(rootParams, paramNames) {
103
203
  rootParams[paramName]
104
204
  ]));
105
205
  }
106
- function saveToResumeDataCache(prerenderResumeDataCache, serializedCacheKey, pendingCacheResult) {
107
- if (!prerenderResumeDataCache) {
206
+ // Next-internal cookies that must not vary the private cache key, since they're
207
+ // not part of the application's own cookie state. The instant-navigation cookie
208
+ // toggles while a navigation lock is held, so including it would force spurious
209
+ // misses.
210
+ const COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY = new Set([
211
+ _approuterheaders.NEXT_INSTANT_TEST_COOKIE
212
+ ]);
213
+ // Request and transport headers that must not vary the private cache key. They
214
+ // either differ between otherwise-equivalent requests, which would cause
215
+ // spurious misses (a browser reload adds `cache-control`/`pragma` that an
216
+ // initial navigation doesn't, and `accept`/`sec-fetch-*` differ between an HTML
217
+ // navigation and an RSC or prefetch request for the same page), or are
218
+ // connection- and proxy-level rather than application data. The `cookie` header
219
+ // is excluded because cookies are keyed separately below (via the dedicated
220
+ // cookie path, which applies `COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY`);
221
+ // including the raw header would duplicate them and reintroduce the cookies
222
+ // that path excludes. Header names are lowercased by `HeadersAdapter`, so every
223
+ // entry here is lowercase.
224
+ const HEADERS_EXCLUDED_FROM_PRIVATE_CACHE_KEY = new Set([
225
+ 'accept',
226
+ 'accept-encoding',
227
+ 'cache-control',
228
+ 'connection',
229
+ 'cookie',
230
+ 'if-match',
231
+ 'if-modified-since',
232
+ 'if-none-match',
233
+ 'if-range',
234
+ 'if-unmodified-since',
235
+ 'keep-alive',
236
+ 'pragma',
237
+ 'priority',
238
+ 'purpose',
239
+ 'range',
240
+ 'sec-fetch-dest',
241
+ 'sec-fetch-mode',
242
+ 'sec-fetch-site',
243
+ 'sec-fetch-user',
244
+ 'sec-purpose',
245
+ 'te',
246
+ 'upgrade',
247
+ 'upgrade-insecure-requests',
248
+ 'x-forwarded-for',
249
+ 'x-forwarded-host',
250
+ 'x-forwarded-port',
251
+ 'x-forwarded-proto'
252
+ ]);
253
+ // TODO: This varies the dev private cache key by the request's cookies and
254
+ // headers (minus the transport and content-negotiation headers excluded above).
255
+ // It's a heuristic: it still over-keys (a cache that reads only one cookie or
256
+ // header varies by all of them) and the header denylist is necessarily
257
+ // incomplete. Follow up by tracking which cookies and headers a cache function
258
+ // actually reads (the same mechanism root params use via `readRootParamNames`)
259
+ // and keying by only those. Note that Next-internal flight headers such as
260
+ // `rsc` and `next-router-state-tree` are already stripped upstream in
261
+ // `getHeaders`, so they never appear here.
262
+ function computePrivateCacheKeyRequestSuffix(cookies, headers) {
263
+ const relevantCookies = cookies.getAll().filter((cookie)=>!COOKIES_EXCLUDED_FROM_PRIVATE_CACHE_KEY.has(cookie.name)).map((cookie)=>[
264
+ cookie.name,
265
+ cookie.value
266
+ ]).sort(([nameA], [nameB])=>nameA < nameB ? -1 : nameA > nameB ? 1 : 0);
267
+ const relevantHeaders = [
268
+ ...headers.entries()
269
+ ].filter(([name])=>!HEADERS_EXCLUDED_FROM_PRIVATE_CACHE_KEY.has(name)).sort(([nameA], [nameB])=>nameA < nameB ? -1 : nameA > nameB ? 1 : 0);
270
+ if (relevantCookies.length === 0 && relevantHeaders.length === 0) {
271
+ return '';
272
+ }
273
+ return JSON.stringify({
274
+ cookies: relevantCookies,
275
+ headers: relevantHeaders
276
+ });
277
+ }
278
+ function saveToResumeDataCache(resumeDataCache, serializedCacheKey, pendingCacheResult) {
279
+ if (!(resumeDataCache == null ? void 0 : resumeDataCache.mutable)) {
108
280
  return pendingCacheResult;
109
281
  }
110
282
  const split = clonePendingCacheResult(pendingCacheResult);
@@ -113,11 +285,77 @@ function saveToResumeDataCache(prerenderResumeDataCache, serializedCacheKey, pen
113
285
  // The RDC is per-page and root params are fixed within a page, so we always
114
286
  // use the coarse key (without root param suffix). Unlike the cache handler,
115
287
  // the RDC doesn't need root-param-specific keys for isolation.
116
- prerenderResumeDataCache.cache.set(serializedCacheKey, rdcResult);
288
+ resumeDataCache.cache.set(serializedCacheKey, rdcResult);
289
+ debug == null ? void 0 : debug('Resume Data Cache entry saved', serializedCacheKey);
117
290
  return savedCacheResult;
118
291
  }
119
- function saveToCacheHandler(cacheHandler, workStore, id, serializedCacheKey, savedCacheResult, rootParams) {
120
- const pendingCoarseEntry = savedCacheResult.then((collectedResult)=>{
292
+ /**
293
+ * A joiner's RDC context may differ from the leader's:
294
+ *
295
+ * - Intra-request: the leader was nested inside another cache (no accessible
296
+ * RDC) while this joiner is top-level and has one.
297
+ * - Cross-request: the leader belongs to a different request entirely — this
298
+ * request's RDC has never seen the entry.
299
+ *
300
+ * In both cases the joiner must save to its own RDC so its final prerender can
301
+ * resume from the entry. Constructs a `CollectedCacheResult` from a forked
302
+ * stream branch of the shared entry and the awaited metadata.
303
+ *
304
+ * The `cache.has()` guard avoids redundant saves when the intra-request leader
305
+ * already saved to the same RDC. Without it, this would needlessly tee the
306
+ * stream and overwrite an equivalent RDC entry.
307
+ */ function saveSharedCacheEntryToResumeDataCache(serializedCacheKey, sharedCacheEntry, resumeDataCache) {
308
+ if (!(resumeDataCache == null ? void 0 : resumeDataCache.mutable) || resumeDataCache.cache.has(serializedCacheKey)) {
309
+ return;
310
+ }
311
+ const rdcResult = sharedCacheEntry.pendingMetadata.then((metadata)=>({
312
+ entry: {
313
+ value: sharedCacheEntry.fork(),
314
+ tags: metadata.tags,
315
+ revalidate: metadata.revalidate,
316
+ expire: metadata.expire,
317
+ stale: metadata.stale,
318
+ timestamp: metadata.timestamp
319
+ },
320
+ readRootParamNames: metadata.readRootParamNames,
321
+ hasExplicitRevalidate: metadata.hasExplicitRevalidate,
322
+ hasExplicitExpire: metadata.hasExplicitExpire,
323
+ dynamicNestedCacheError: metadata.dynamicNestedCacheError
324
+ }));
325
+ resumeDataCache.cache.set(serializedCacheKey, rdcResult);
326
+ debug == null ? void 0 : debug('Resume Data Cache entry saved by joiner', serializedCacheKey);
327
+ }
328
+ /**
329
+ * Completes a join onto another invocation's entry, whether that invocation is
330
+ * still filling or has already finished: forks the stream, saves to this
331
+ * invocation's RDC if the leader had none, and balances the cache signal read
332
+ * once the entry is fully collected.
333
+ */ function serveJoinedCacheEntry(sharedCacheEntry, serializedCacheKey, resumeDataCache, cacheContext, cacheSignal) {
334
+ const stream = sharedCacheEntry.fork();
335
+ // If the leader was nested inside another cache (no accessible RDC), it
336
+ // couldn't save to the RDC. This joiner may be top-level with an RDC, in
337
+ // which case it must save here; otherwise the RDC lookup during the final
338
+ // prerender will miss.
339
+ saveSharedCacheEntryToResumeDataCache(serializedCacheKey, sharedCacheEntry, resumeDataCache);
340
+ // End the cache signal read when the result is fully collected, not when the
341
+ // stream is available. A failed collection has no metadata to propagate but
342
+ // must still balance the read, so both settlements end it; leaving it open
343
+ // would stall a prerender waiting for its cache reads. The trailing .catch()
344
+ // covers propagation itself throwing after the rendering stream resolved.
345
+ sharedCacheEntry.pendingMetadata.then((metadata)=>{
346
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
347
+ maybePropagateCacheEntryMetadata(cacheContext, metadata);
348
+ }, ()=>{
349
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
350
+ }).catch(()=>{});
351
+ return stream;
352
+ }
353
+ function saveToCacheHandler(cacheHandler, workStore, id, cacheHandlerKeyBase, savedCacheResult, rootParams) {
354
+ // Write the entry to the cache handler. With root params, this is a redirect
355
+ // entry at the coarse key plus the actual entry at the specific key;
356
+ // otherwise just the entry at the coarse key. Both set calls are fired
357
+ // together and awaited in parallel.
358
+ const combinedSetPromise = savedCacheResult.then(async (collectedResult)=>{
121
359
  const { entry: fullEntry, readRootParamNames } = collectedResult;
122
360
  // Use the combined set (union of all historically observed reads) for both
123
361
  // the specific key and the redirect entry's tags. The read path computes
@@ -128,18 +366,18 @@ function saveToCacheHandler(cacheHandler, workStore, id, serializedCacheKey, sav
128
366
  // scatter entries across different specific keys, making previous entries
129
367
  // unreachable from the read path's union-based lookup.
130
368
  const rootParamNames = readRootParamNames ? addKnownRootParamNames(id, readRootParamNames) : knownRootParamsByFunctionId.get(id);
369
+ const setPromises = [];
370
+ let coarseEntry = fullEntry;
131
371
  if (rootParamNames && rootParamNames.size > 0 && rootParams) {
132
- const specificKey = serializedCacheKey + computeRootParamsCacheKeySuffix(rootParams, rootParamNames);
133
- const specificSetPromise = cacheHandler.set(specificKey, Promise.resolve(fullEntry));
134
- workStore.pendingRevalidateWrites ??= [];
135
- workStore.pendingRevalidateWrites.push(specificSetPromise);
136
- // Return a redirect entry for the coarse key. On a cold server (empty
137
- // knownRootParamsByFunctionId), this entry's tags tell us which root
138
- // params to include in the specific key for the follow-up lookup.
372
+ const specificKey = cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, rootParamNames);
373
+ setPromises.push(cacheHandler.set(specificKey, Promise.resolve(fullEntry)));
374
+ // The coarse key gets a redirect entry instead. On a cold server (empty
375
+ // knownRootParamsByFunctionId), its tags tell a reader which root params
376
+ // to include in the specific-key lookup.
139
377
  const rootParamTags = [
140
378
  ...rootParamNames
141
379
  ].map((paramName)=>_constants1.NEXT_CACHE_ROOT_PARAM_TAG_ID + paramName);
142
- return {
380
+ coarseEntry = {
143
381
  value: new ReadableStream({
144
382
  start (controller) {
145
383
  // Single byte so the entry has non-zero size in LRU caches.
@@ -159,21 +397,28 @@ function saveToCacheHandler(cacheHandler, workStore, id, serializedCacheKey, sav
159
397
  revalidate: fullEntry.revalidate
160
398
  };
161
399
  }
162
- return fullEntry;
400
+ setPromises.push(cacheHandler.set(cacheHandlerKeyBase, Promise.resolve(coarseEntry)));
401
+ await Promise.all(setPromises);
163
402
  });
164
- const promise = cacheHandler.set(serializedCacheKey, pendingCoarseEntry);
165
403
  workStore.pendingRevalidateWrites ??= [];
166
- workStore.pendingRevalidateWrites.push(promise);
404
+ workStore.pendingRevalidateWrites.push(combinedSetPromise);
405
+ // A cross-request joiner reads its recomputed specific key only after it has
406
+ // awaited this entry's metadata, so gate the metadata on the writes landing:
407
+ // that guarantees the entry is present when the joiner re-reads. A failed
408
+ // write shouldn't reject the metadata (the joiner just misses and
409
+ // regenerates), so settle either way; a collection failure still propagates
410
+ // through `savedCacheResult`.
411
+ return combinedSetPromise.then(()=>savedCacheResult, ()=>savedCacheResult);
167
412
  }
168
- function generateCacheEntry(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError) {
413
+ function generateCacheEntry(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError) {
169
414
  // We need to run this inside a clean AsyncLocalStorage snapshot so that the cache
170
415
  // generation cannot read anything from the context we're currently executing which
171
416
  // might include request specific things like cookies() inside a React.cache().
172
417
  // Note: It is important that we await at least once before this because it lets us
173
418
  // pop out of any stack specific contexts as well - aka "Sync" Local Storage.
174
- return workStore.runInCleanSnapshot(generateCacheEntryWithRestoredWorkStore, workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError);
419
+ return workStore.runInCleanSnapshot(generateCacheEntryWithRestoredWorkStore, workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError);
175
420
  }
176
- function generateCacheEntryWithRestoredWorkStore(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError) {
421
+ function generateCacheEntryWithRestoredWorkStore(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError) {
177
422
  // Since we cleared the AsyncLocalStorage we need to restore the workStore.
178
423
  // Note: We explicitly don't restore the RequestStore nor the PrerenderStore.
179
424
  // We don't want any request specific information leaking an we don't want to create a
@@ -181,7 +426,7 @@ function generateCacheEntryWithRestoredWorkStore(workStore, cacheContext, client
181
426
  // in RequestStore but should be available to Caches need to move to WorkStore.
182
427
  // PrerenderStore is not needed inside the cache scope because the outer most one will
183
428
  // be the one to report its result to the outer Prerender.
184
- return _workasyncstorageexternal.workAsyncStorage.run(workStore, generateCacheEntryWithCacheContext, workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError);
429
+ return _workasyncstorageexternal.workAsyncStorage.run(workStore, generateCacheEntryWithCacheContext, workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError);
185
430
  }
186
431
  function createUseCacheStore(workStore, cacheContext, defaultCacheLife) {
187
432
  if (cacheContext.kind === 'private') {
@@ -203,8 +448,13 @@ function createUseCacheStore(workStore, cacheContext, defaultCacheLife) {
203
448
  forceRevalidate: shouldForceRevalidate(workStore, outerWorkUnitStore),
204
449
  draftMode: (0, _workunitasyncstorageexternal.getDraftModeProviderForCacheScope)(workStore, outerWorkUnitStore),
205
450
  rootParams: outerWorkUnitStore.rootParams,
206
- headers: outerWorkUnitStore.headers,
207
- cookies: outerWorkUnitStore.cookies
451
+ readRootParamNames: process.env.__NEXT_DEV_SERVER ? new Set() : undefined,
452
+ // Every private cache scope is its own work unit. Any cache keyed on
453
+ // headers() or cookies() needs to be invalidated. Otherwise some
454
+ // Next.js API semantics leak across render passes.
455
+ headers: _headers.HeadersAdapter.fresh(outerWorkUnitStore.headers),
456
+ cookies: _requestcookies.RequestCookiesAdapter.fresh(outerWorkUnitStore.cookies),
457
+ outerOwnerStack: cacheContext.outerOwnerStack
208
458
  };
209
459
  } else {
210
460
  let useCacheOrRequestStore;
@@ -242,66 +492,93 @@ function createUseCacheStore(workStore, cacheContext, defaultCacheLife) {
242
492
  forceRevalidate: shouldForceRevalidate(workStore, outerWorkUnitStore),
243
493
  draftMode: (0, _workunitasyncstorageexternal.getDraftModeProviderForCacheScope)(workStore, outerWorkUnitStore),
244
494
  rootParams: outerWorkUnitStore.rootParams,
245
- readRootParamNames: new Set()
495
+ readRootParamNames: new Set(),
496
+ outerOwnerStack: cacheContext.outerOwnerStack,
497
+ dynamicNestedCacheError: undefined
246
498
  };
247
499
  }
248
500
  }
249
- function assertDefaultCacheLife(defaultCacheLife) {
250
- if (!defaultCacheLife || defaultCacheLife.revalidate == null || defaultCacheLife.expire == null || defaultCacheLife.stale == null) {
251
- throw Object.defineProperty(new _invarianterror.InvariantError('A default cacheLife profile must always be provided.'), "__NEXT_ERROR_CODE", {
252
- value: "E750",
253
- enumerable: false,
254
- configurable: true
255
- });
501
+ /**
502
+ * Captures the owner stack from the outer component tree before entering a
503
+ * cache boundary. When nested inside another cache scope, the parent's
504
+ * outerOwnerStack is concatenated so that the full component tree is preserved
505
+ * across multiple cache boundaries.
506
+ */ function captureOuterOwnerStack(workUnitStore) {
507
+ var _getClientReact_captureOwnerStack, _getClientReact, _getServerReact_captureOwnerStack, _getServerReact;
508
+ const capturedOwnerStack = (((_getClientReact = (0, _runtimereactsexternal.getClientReact)()) == null ? void 0 : (_getClientReact_captureOwnerStack = _getClientReact.captureOwnerStack) == null ? void 0 : _getClientReact_captureOwnerStack.call(_getClientReact)) ?? ((_getServerReact = (0, _runtimereactsexternal.getServerReact)()) == null ? void 0 : (_getServerReact_captureOwnerStack = _getServerReact.captureOwnerStack) == null ? void 0 : _getServerReact_captureOwnerStack.call(_getServerReact))) || '';
509
+ let parentOuterOwnerStack;
510
+ switch(workUnitStore.type){
511
+ case 'cache':
512
+ case 'private-cache':
513
+ parentOuterOwnerStack = workUnitStore.outerOwnerStack;
514
+ break;
515
+ case 'unstable-cache':
516
+ case 'request':
517
+ case 'prerender':
518
+ case 'prerender-ppr':
519
+ case 'prerender-legacy':
520
+ case 'prerender-runtime':
521
+ case 'prerender-client':
522
+ case 'validation-client':
523
+ case 'generate-static-params':
524
+ break;
525
+ default:
526
+ workUnitStore;
256
527
  }
528
+ return capturedOwnerStack + (parentOuterOwnerStack || '') || undefined;
257
529
  }
258
- function generateCacheEntryWithCacheContext(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError) {
259
- if (!workStore.cacheLifeProfiles) {
260
- throw Object.defineProperty(new _invarianterror.InvariantError('cacheLifeProfiles should always be provided.'), "__NEXT_ERROR_CODE", {
261
- value: "E748",
262
- enumerable: false,
263
- configurable: true
264
- });
265
- }
266
- const defaultCacheLife = workStore.cacheLifeProfiles['default'];
267
- assertDefaultCacheLife(defaultCacheLife);
530
+ // The maximum time we allow a `'use cache'` entry to fill. After this, we
531
+ // assume the fill is stalled — either on hanging input to the cached function,
532
+ // or on hanging I/O inside of it — and de-opt with an error.
533
+ //
534
+ // For prerender, the effective value is clamped to 90% of the configured
535
+ // `staticPageGenerationTimeout` so the cache-fill error surfaces before the
536
+ // build worker kills the page. In dev (`request`), the configured
537
+ // `experimental.useCacheTimeout` is used straight.
538
+ function getUseCacheFillTimeoutMs(workStore, workUnitStoreType) {
539
+ const { useCacheTimeout, staticPageGenerationTimeout } = workStore;
540
+ const effectiveTimeout = workUnitStoreType === 'request' ? useCacheTimeout : Math.min(useCacheTimeout, staticPageGenerationTimeout * 0.9);
541
+ return effectiveTimeout * 1000;
542
+ }
543
+ function generateCacheEntryWithCacheContext(workStore, cacheContext, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError) {
544
+ const defaultCacheLife = workStore.cacheLifeProfiles.default;
268
545
  // Initialize the Store for this Cache entry.
269
546
  const cacheStore = createUseCacheStore(workStore, cacheContext, defaultCacheLife);
270
547
  return _workunitasyncstorageexternal.workUnitAsyncStorage.run(cacheStore, ()=>_dynamicaccessasyncstorageexternal.dynamicAccessAsyncStorage.run({
271
548
  abortController: new AbortController()
272
- }, generateCacheEntryImpl, workStore, cacheContext, cacheStore, clientReferenceManifest, encodedArguments, fn, timeoutError));
549
+ }, generateCacheEntryImpl, workStore, cacheContext, cacheStore, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError));
273
550
  }
274
- function propagateCacheLifeAndTagsToRevalidateStore(revalidateStore, entry) {
551
+ function propagateCacheLifeAndTagsToRevalidateStore(revalidateStore, metadata) {
275
552
  const outerTags = revalidateStore.tags ??= [];
276
- for (const tag of entry.tags){
553
+ for (const tag of metadata.tags){
277
554
  if (!outerTags.includes(tag)) {
278
555
  outerTags.push(tag);
279
556
  }
280
557
  }
281
- if (revalidateStore.stale > entry.stale) {
282
- revalidateStore.stale = entry.stale;
558
+ if (revalidateStore.stale > metadata.stale) {
559
+ revalidateStore.stale = metadata.stale;
283
560
  }
284
- if (revalidateStore.revalidate > entry.revalidate) {
285
- revalidateStore.revalidate = entry.revalidate;
561
+ if (revalidateStore.revalidate > metadata.revalidate) {
562
+ revalidateStore.revalidate = metadata.revalidate;
286
563
  }
287
- if (revalidateStore.expire > entry.expire) {
288
- revalidateStore.expire = entry.expire;
564
+ if (revalidateStore.expire > metadata.expire) {
565
+ revalidateStore.expire = metadata.expire;
289
566
  }
290
567
  }
291
- function propagateCacheStaleTimeToRequestStore(requestStore, entry) {
292
- if (requestStore.stale !== undefined && requestStore.stale > entry.stale) {
293
- requestStore.stale = entry.stale;
568
+ function propagateCacheStaleTimeToRequestStore(requestStore, metadata) {
569
+ if (requestStore.stale !== undefined && requestStore.stale > metadata.stale) {
570
+ requestStore.stale = metadata.stale;
294
571
  }
295
572
  }
296
- function propagateCacheEntryMetadata(cacheContext, entry, readRootParamNames) {
573
+ function propagateCacheEntryMetadata(cacheContext, metadata) {
297
574
  if (cacheContext.kind === 'private') {
298
575
  switch(cacheContext.outerWorkUnitStore.type){
299
576
  case 'prerender-runtime':
300
577
  case 'private-cache':
301
- propagateCacheLifeAndTagsToRevalidateStore(cacheContext.outerWorkUnitStore, entry);
578
+ propagateCacheLifeAndTagsToRevalidateStore(cacheContext.outerWorkUnitStore, metadata);
302
579
  break;
303
580
  case 'request':
304
- propagateCacheStaleTimeToRequestStore(cacheContext.outerWorkUnitStore, entry);
581
+ propagateCacheStaleTimeToRequestStore(cacheContext.outerWorkUnitStore, metadata);
305
582
  break;
306
583
  case undefined:
307
584
  break;
@@ -311,21 +588,28 @@ function propagateCacheEntryMetadata(cacheContext, entry, readRootParamNames) {
311
588
  } else {
312
589
  switch(cacheContext.outerWorkUnitStore.type){
313
590
  case 'cache':
314
- if (readRootParamNames) {
315
- for (const paramName of readRootParamNames){
591
+ if (metadata.readRootParamNames) {
592
+ for (const paramName of metadata.readRootParamNames){
316
593
  cacheContext.outerWorkUnitStore.readRootParamNames.add(paramName);
317
594
  }
318
595
  }
596
+ // If this entry's cache life is dynamic, record this invocation as the
597
+ // origin to use as `cause` when the outer cache surfaces the
598
+ // nested-dynamic cache error. `??=` keeps the first occurrence so the
599
+ // cause points at the immediate dynamic child.
600
+ if (cacheContext.dynamicNestedCacheError !== undefined && (metadata.revalidate === 0 || metadata.expire < _constants.MIN_PRERENDERABLE_EXPIRE)) {
601
+ cacheContext.outerWorkUnitStore.dynamicNestedCacheError ??= cacheContext.dynamicNestedCacheError;
602
+ }
319
603
  // fallthrough
320
604
  case 'private-cache':
321
605
  case 'prerender':
322
606
  case 'prerender-runtime':
323
607
  case 'prerender-ppr':
324
608
  case 'prerender-legacy':
325
- propagateCacheLifeAndTagsToRevalidateStore(cacheContext.outerWorkUnitStore, entry);
609
+ propagateCacheLifeAndTagsToRevalidateStore(cacheContext.outerWorkUnitStore, metadata);
326
610
  break;
327
611
  case 'request':
328
- propagateCacheStaleTimeToRequestStore(cacheContext.outerWorkUnitStore, entry);
612
+ propagateCacheStaleTimeToRequestStore(cacheContext.outerWorkUnitStore, metadata);
329
613
  break;
330
614
  case 'unstable-cache':
331
615
  case 'generate-static-params':
@@ -349,7 +633,7 @@ function propagateCacheEntryMetadata(cacheContext, entry, readRootParamNames) {
349
633
  * `cache` store (i.e. an enclosing `"use cache"` function), which is never
350
634
  * deferred. For prerender contexts, root param names are tracked separately
351
635
  * via `addKnownRootParamNames` in the resume data cache read path.
352
- */ function maybePropagateCacheEntryMetadata(cacheContext, entry, readRootParamNames) {
636
+ */ function maybePropagateCacheEntryMetadata(cacheContext, metadata) {
353
637
  const outerWorkUnitStore = cacheContext.outerWorkUnitStore;
354
638
  switch(outerWorkUnitStore.type){
355
639
  case 'prerender':
@@ -370,7 +654,7 @@ function propagateCacheEntryMetadata(cacheContext, entry, readRootParamNames) {
370
654
  case 'prerender-legacy':
371
655
  case 'prerender-ppr':
372
656
  {
373
- propagateCacheEntryMetadata(cacheContext, entry, readRootParamNames);
657
+ propagateCacheEntryMetadata(cacheContext, metadata);
374
658
  break;
375
659
  }
376
660
  case 'generate-static-params':
@@ -419,11 +703,31 @@ async function collectResult(savedStream, workStore, cacheContext, innerCacheSto
419
703
  }
420
704
  });
421
705
  const collectedTags = innerCacheStore.tags;
422
- // If cacheLife() was used to set an explicit revalidate time we use that.
423
- // Otherwise, we use the lowest of all inner fetch()/unstable_cache() or nested "use cache".
424
- // If they're lower than our default.
425
- const collectedRevalidate = innerCacheStore.explicitRevalidate !== undefined ? innerCacheStore.explicitRevalidate : innerCacheStore.revalidate;
426
- const collectedExpire = innerCacheStore.explicitExpire !== undefined ? innerCacheStore.explicitExpire : innerCacheStore.expire;
706
+ const isPrivateCacheInDev = Boolean(process.env.__NEXT_DEV_SERVER && cacheContext.kind === 'private');
707
+ // In development, force a dynamic cache life (`revalidate: 0`, `expire:
708
+ // MIN_PRERENDERABLE_EXPIRE`) for private caches, which have no real backing
709
+ // handler. The zero revalidate makes every read serve stale-while-revalidate
710
+ // (regenerating a fresh entry in the background), and
711
+ // `MIN_PRERENDERABLE_EXPIRE` (5 minutes) caps how long an entry lingers in
712
+ // the dedicated in-memory private handler. It is the shortest `expire` that
713
+ // isn't treated as dynamic; a smaller `expire` would exclude the entry from
714
+ // prerenders. Two other cases deliberately do NOT force this and keep their
715
+ // resolved cache life, relying instead on the dev handler's minimum retention
716
+ // and a dev revalidation (see the cache-hit path below) to keep reloads fast
717
+ // and fresh. The size-0 case (`cacheMaxMemorySize: 0`) keeps its life so the
718
+ // entry can be considered prerenderable instead of being misread as a dynamic
719
+ // hole. An explicit short-`expire` public cache (e.g. `cacheLife({ expire: 0
720
+ // })`) keeps its life so it stays correctly excluded from static prerenders
721
+ // via its real `expire` while a reload still hits the cache; forcing
722
+ // `revalidate: 0` here would instead corrupt the cache life propagated to an
723
+ // enclosing cache and trigger the nested-dynamic error. A cache backed by a
724
+ // custom handler keeps its real cache life too, since that handler owns it.
725
+ const forceDynamicCacheLifeInDev = isPrivateCacheInDev;
726
+ // If cacheLife() was used to set an explicit revalidate/expire/stale time we
727
+ // use that. Otherwise, we use the lowest of all inner fetch(),
728
+ // unstable_cache() or nested "use cache", if they're lower than our default.
729
+ const collectedRevalidate = forceDynamicCacheLifeInDev ? 0 : innerCacheStore.explicitRevalidate !== undefined ? innerCacheStore.explicitRevalidate : innerCacheStore.revalidate;
730
+ const collectedExpire = forceDynamicCacheLifeInDev ? _constants.MIN_PRERENDERABLE_EXPIRE : innerCacheStore.explicitExpire !== undefined ? innerCacheStore.explicitExpire : innerCacheStore.expire;
427
731
  const collectedStale = innerCacheStore.explicitStale !== undefined ? innerCacheStore.explicitStale : innerCacheStore.stale;
428
732
  const entry = {
429
733
  value: bufferStream,
@@ -433,21 +737,35 @@ async function collectResult(savedStream, workStore, cacheContext, innerCacheSto
433
737
  stale: collectedStale,
434
738
  tags: collectedTags === null ? [] : collectedTags
435
739
  };
740
+ const collected = {
741
+ entry,
742
+ hasExplicitRevalidate: innerCacheStore.explicitRevalidate !== undefined,
743
+ hasExplicitExpire: innerCacheStore.explicitExpire !== undefined,
744
+ readRootParamNames: innerCacheStore.type === 'cache' || isPrivateCacheInDev ? innerCacheStore.readRootParamNames : undefined,
745
+ // The store accumulates this from nested public caches that propagated a
746
+ // dynamic life into us.
747
+ dynamicNestedCacheError: innerCacheStore.type === 'cache' ? innerCacheStore.dynamicNestedCacheError : undefined
748
+ };
436
749
  if (!cacheContext.skipPropagation) {
437
- maybePropagateCacheEntryMetadata(cacheContext, entry, innerCacheStore.type === 'cache' ? innerCacheStore.readRootParamNames : undefined);
750
+ maybePropagateCacheEntryMetadata(cacheContext, {
751
+ tags: collected.entry.tags,
752
+ revalidate: collected.entry.revalidate,
753
+ expire: collected.entry.expire,
754
+ stale: collected.entry.stale,
755
+ timestamp: collected.entry.timestamp,
756
+ hasExplicitRevalidate: collected.hasExplicitRevalidate,
757
+ hasExplicitExpire: collected.hasExplicitExpire,
758
+ readRootParamNames: collected.readRootParamNames,
759
+ dynamicNestedCacheError: collected.dynamicNestedCacheError
760
+ });
438
761
  const cacheSignal = (0, _workunitasyncstorageexternal.getCacheSignal)(cacheContext.outerWorkUnitStore);
439
762
  if (cacheSignal) {
440
763
  cacheSignal.endRead();
441
764
  }
442
765
  }
443
- return {
444
- entry,
445
- hasExplicitRevalidate: innerCacheStore.explicitRevalidate !== undefined,
446
- hasExplicitExpire: innerCacheStore.explicitExpire !== undefined,
447
- readRootParamNames: innerCacheStore.type === 'cache' ? innerCacheStore.readRootParamNames : undefined
448
- };
766
+ return collected;
449
767
  }
450
- async function generateCacheEntryImpl(workStore, cacheContext, innerCacheStore, clientReferenceManifest, encodedArguments, fn, timeoutError) {
768
+ async function generateCacheEntryImpl(workStore, cacheContext, innerCacheStore, clientReferenceManifest, encodedArguments, fn, timeoutError, deadlockError) {
451
769
  const temporaryReferences = (0, _server.createTemporaryReferenceSet)();
452
770
  const outerWorkUnitStore = cacheContext.outerWorkUnitStore;
453
771
  const [, , args] = typeof encodedArguments === 'string' ? await (0, _server.decodeReply)(encodedArguments, (0, _manifestssingleton.getServerModuleMap)(), {
@@ -496,7 +814,7 @@ async function generateCacheEntryImpl(workStore, cacheContext, innerCacheStore,
496
814
  // is available when the function is invoked. This allows us, for example, to
497
815
  // capture logs so that we can later replay them.
498
816
  const resultPromise = (0, _lazyresult.createLazyResult)(fn.bind(null, ...args));
499
- let errors = [];
817
+ const errors = [];
500
818
  // In the "Cache" environment, we only need to make sure that the error
501
819
  // digests are handled correctly. Error formatting and reporting is not
502
820
  // necessary here; the errors are encoded in the stream, and will be reported
@@ -513,75 +831,163 @@ async function generateCacheEntryImpl(workStore, cacheContext, innerCacheStore,
513
831
  errors.push(error);
514
832
  });
515
833
  let stream;
834
+ let devTimeoutAbortController;
516
835
  switch(outerWorkUnitStore.type){
517
836
  case 'prerender-runtime':
518
837
  case 'prerender':
519
- var _dynamicAccessAsyncStorage_getStore;
520
- const timeoutAbortController = new AbortController();
521
- // If we're prerendering, we give you 50 seconds to fill a cache entry.
522
- // Otherwise we assume you stalled on hanging input and de-opt. This needs
523
- // to be lower than just the general timeout of 60 seconds.
524
- const timer = setTimeout(()=>{
525
- workStore.invalidDynamicUsageError = timeoutError;
526
- timeoutAbortController.abort(timeoutError);
527
- }, 50000);
528
- const dynamicAccessAbortSignal = (_dynamicAccessAsyncStorage_getStore = _dynamicaccessasyncstorageexternal.dynamicAccessAsyncStorage.getStore()) == null ? void 0 : _dynamicAccessAsyncStorage_getStore.abortController.signal;
529
- const abortSignal = dynamicAccessAbortSignal ? AbortSignal.any([
530
- dynamicAccessAbortSignal,
531
- outerWorkUnitStore.renderSignal,
532
- timeoutAbortController.signal
533
- ]) : timeoutAbortController.signal;
534
- const { prelude } = await (0, _static.prerender)(resultPromise, clientReferenceManifest.clientModules, {
535
- environmentName: 'Cache',
536
- filterStackFrame,
537
- signal: abortSignal,
538
- temporaryReferences,
539
- onError (error) {
540
- if (abortSignal.aborted && abortSignal.reason === error) {
541
- return undefined;
542
- }
543
- return handleError(error);
544
- }
545
- });
546
- clearTimeout(timer);
547
- if (timeoutAbortController.signal.aborted) {
548
- // When the timeout is reached we always error the stream. Even for
549
- // fallback shell prerenders we don't want to return a hanging promise,
550
- // which would allow the function to become a dynamic hole. Because that
551
- // would mean that a non-empty shell could be generated which would be
552
- // subject to revalidation, and we don't want to create long
553
- // revalidation times.
554
- stream = new ReadableStream({
555
- start (controller) {
556
- controller.error(timeoutAbortController.signal.reason);
838
+ {
839
+ var _dynamicAccessAsyncStorage_getStore;
840
+ const timeoutAbortController = new AbortController();
841
+ const timer = setTimeout(()=>{
842
+ workStore.invalidDynamicUsageError = timeoutError;
843
+ timeoutAbortController.abort(timeoutError);
844
+ }, getUseCacheFillTimeoutMs(workStore, outerWorkUnitStore.type));
845
+ const dynamicAccessAbortSignal = (_dynamicAccessAsyncStorage_getStore = _dynamicaccessasyncstorageexternal.dynamicAccessAsyncStorage.getStore()) == null ? void 0 : _dynamicAccessAsyncStorage_getStore.abortController.signal;
846
+ const abortSignal = dynamicAccessAbortSignal ? AbortSignal.any([
847
+ dynamicAccessAbortSignal,
848
+ timeoutAbortController.signal
849
+ ]) : timeoutAbortController.signal;
850
+ const { prelude } = await (0, _static.prerender)(resultPromise, clientReferenceManifest.clientModules, {
851
+ environmentName: 'Cache',
852
+ filterStackFrame,
853
+ signal: abortSignal,
854
+ temporaryReferences,
855
+ onError (error) {
856
+ if (abortSignal.aborted && abortSignal.reason === error) {
857
+ return undefined;
858
+ }
859
+ return handleError(error);
557
860
  }
558
861
  });
559
- } else if (dynamicAccessAbortSignal == null ? void 0 : dynamicAccessAbortSignal.aborted) {
560
- // If the prerender is aborted because of dynamic access (e.g. reading
561
- // fallback params), we return a hanging promise. This essentially makes
562
- // the "use cache" function dynamic.
563
- const hangingPromise = (0, _dynamicrenderingutils.makeHangingPromise)(outerWorkUnitStore.renderSignal, workStore.route, 'dynamic "use cache"');
564
- if (outerWorkUnitStore.cacheSignal) {
565
- outerWorkUnitStore.cacheSignal.endRead();
862
+ clearTimeout(timer);
863
+ if (timeoutAbortController.signal.aborted) {
864
+ // When the timeout is reached we always error the stream. Even for
865
+ // fallback shell prerenders we don't want to return a hanging promise,
866
+ // which would allow the function to become a dynamic hole. Because that
867
+ // would mean that a non-empty shell could be generated which would be
868
+ // subject to revalidation, and we don't want to create long
869
+ // revalidation times.
870
+ stream = new ReadableStream({
871
+ start (controller) {
872
+ controller.error(timeoutAbortController.signal.reason);
873
+ }
874
+ });
875
+ } else if (dynamicAccessAbortSignal == null ? void 0 : dynamicAccessAbortSignal.aborted) {
876
+ // If the prerender is aborted because of dynamic access (e.g. reading
877
+ // fallback params), we return a hanging promise. This essentially makes
878
+ // the "use cache" function dynamic.
879
+ // The dynamic access is a fallback params read, which is runtime data.
880
+ const hangingPromise = (0, _dynamicrenderingutils.makeRuntimeHangingPromise)(outerWorkUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', outerWorkUnitStore);
881
+ if (outerWorkUnitStore.cacheSignal) {
882
+ outerWorkUnitStore.cacheSignal.endRead();
883
+ }
884
+ return {
885
+ type: 'prerender-dynamic',
886
+ hangingPromise
887
+ };
888
+ } else {
889
+ stream = prelude;
566
890
  }
567
- return {
568
- type: 'prerender-dynamic',
569
- hangingPromise
570
- };
571
- } else {
572
- stream = prelude;
891
+ break;
573
892
  }
574
- break;
575
893
  case 'request':
576
- // If we're filling caches for a staged render, make sure that
577
- // it takes at least a task, so we'll always notice a cache miss between stages.
578
- //
579
- // TODO(restart-on-cache-miss): This is suboptimal.
580
- // Ideally we wouldn't need to restart for microtasky caches,
581
- // but the current logic for omitting short-lived caches only works correctly
582
- // if we do a second render, so that's the best we can do until we refactor that.
583
- if (process.env.NODE_ENV === 'development' && outerWorkUnitStore.cacheSignal) {
894
+ // TODO: We should just check if the render is abandonable. This is
895
+ // relevant in restart-on-cache-miss in general, so when we implement that
896
+ // for cached navs, it'll also be needed in prod
897
+ if (process.env.__NEXT_DEV_SERVER && outerWorkUnitStore.cacheSignal) {
898
+ const stagedRendering = outerWorkUnitStore.stagedRendering;
899
+ // Capture the render stage at the start of this cache read, before the
900
+ // yield below. A streamed staged render advances its controller on its
901
+ // own schedule, independently of this read, so by the time the yield
902
+ // resolves the controller may have raced ahead to the Dynamic stage even
903
+ // though the read began in an earlier (prerender) stage.
904
+ const stageAtReadStart = stagedRendering == null ? void 0 : stagedRendering.currentStage;
905
+ // If we're filling caches for a staged render, make sure that it takes
906
+ // at least a task, so we'll always notice a cache miss between stages.
907
+ //
908
+ // TODO(restart-on-cache-miss): This is suboptimal. Ideally microtasky
909
+ // caches wouldn't register as a miss, but short-lived caches are only
910
+ // omitted correctly when read back in a separate render (now the
911
+ // background validation render, not a restart of the streamed
912
+ // response), so forcing the miss is the best we can do until that's
913
+ // refactored.
584
914
  await new Promise((resolve)=>setTimeout(resolve));
915
+ // Start a cache-fill timeout so a hanging `'use cache'` entry surfaces
916
+ // the same error in dev as during prerender. Cleared when
917
+ // pendingCacheResult settles.
918
+ //
919
+ // Skip the timeout only when the read began in the Dynamic stage, which
920
+ // mirrors prerender: a cache guarded by e.g. `await connection()` is a
921
+ // legitimate dynamic hole and isn't executed there. We use the stage
922
+ // captured at read start, not the current one, because the staged render
923
+ // may have advanced past it during the yield above.
924
+ if (stageAtReadStart !== _stagedrendering.RenderStage.Dynamic) {
925
+ const devRenderAbortController = new AbortController();
926
+ const fillTimeoutMs = getUseCacheFillTimeoutMs(workStore, outerWorkUnitStore.type);
927
+ const fillDeadlineAt = performance.now() + fillTimeoutMs;
928
+ const devRenderTimeoutTimer = setTimeout(()=>{
929
+ workStore.invalidDynamicUsageError = timeoutError;
930
+ devRenderAbortController.abort(timeoutError);
931
+ }, fillTimeoutMs);
932
+ devTimeoutAbortController = new AbortController();
933
+ devTimeoutAbortController.signal.addEventListener('abort', ()=>{
934
+ clearTimeout(devRenderTimeoutTimer);
935
+ }, {
936
+ once: true
937
+ });
938
+ stream = (0, _server.renderToReadableStream)(resultPromise, clientReferenceManifest.clientModules, {
939
+ environmentName: 'Cache',
940
+ filterStackFrame,
941
+ signal: devRenderAbortController.signal,
942
+ temporaryReferences,
943
+ onError (error) {
944
+ if (devRenderAbortController.signal.aborted && devRenderAbortController.signal.reason === error && error instanceof Error) {
945
+ // The abort reason is the same error stored as
946
+ // `workStore.invalidDynamicUsageError` (a fill timeout or
947
+ // deadlock). Register it under a digest and return that
948
+ // digest, so the error that surfaces on the consumer side of
949
+ // this Flight boundary carries it and the outer render's
950
+ // handler can recover *this* object via
951
+ // `reactServerErrorsByDigest`.
952
+ //
953
+ // We deliberately do not set `error.digest` here: whether the
954
+ // error actually surfaces (vs. being caught in userland) is
955
+ // the consumer's decision, so the "surfaced" mark is left to
956
+ // the outer handler.
957
+ const digest = (0, _errortelemetryutils.createDigestWithErrorCode)(error, (0, _stringhash.default)(error.message + (error.stack || '')).toString());
958
+ workStore.reactServerErrorsByDigest.set(digest, error);
959
+ return digest;
960
+ }
961
+ return handleError(error);
962
+ }
963
+ });
964
+ // `require` (rather than a top-level import) so the bundler can
965
+ // tree-shake the probe scheduler out of the production runtime, where
966
+ // this whole dev-server-gated branch is dead code.
967
+ const { setupProbeScheduler } = require('./use-cache-probe-scheduler');
968
+ stream = setupProbeScheduler({
969
+ workStore,
970
+ outerRequestStore: outerWorkUnitStore,
971
+ cacheContext,
972
+ encodedArguments,
973
+ fillDeadlineAt,
974
+ stream,
975
+ abortSignal: AbortSignal.any([
976
+ devRenderAbortController.signal,
977
+ devTimeoutAbortController.signal
978
+ ]),
979
+ onProbeCompleted () {
980
+ const error = deadlockError ?? Object.defineProperty(new _invarianterror.InvariantError('`deadlockError` should be constructed inside `cache()` before reaching the probe scheduler.'), "__NEXT_ERROR_CODE", {
981
+ value: "E1182",
982
+ enumerable: false,
983
+ configurable: true
984
+ });
985
+ workStore.invalidDynamicUsageError = error;
986
+ devRenderAbortController.abort(error);
987
+ }
988
+ });
989
+ break;
990
+ }
585
991
  }
586
992
  // fallthrough
587
993
  case 'prerender-ppr':
@@ -601,7 +1007,9 @@ async function generateCacheEntryImpl(workStore, cacheContext, innerCacheStore,
601
1007
  return outerWorkUnitStore;
602
1008
  }
603
1009
  const [returnStream, savedStream] = stream.tee();
604
- const pendingCacheResult = collectResult(savedStream, workStore, cacheContext, innerCacheStore, startTime, errors);
1010
+ const pendingCacheResult = collectResult(savedStream, workStore, cacheContext, innerCacheStore, startTime, errors).finally(()=>{
1011
+ devTimeoutAbortController == null ? void 0 : devTimeoutAbortController.abort();
1012
+ });
605
1013
  if (process.env.NODE_ENV === 'development') {
606
1014
  // Name the stream for React DevTools.
607
1015
  // @ts-expect-error
@@ -616,36 +1024,22 @@ async function generateCacheEntryImpl(workStore, cacheContext, innerCacheStore,
616
1024
  pendingCacheResult
617
1025
  };
618
1026
  }
619
- function cloneCacheEntry(entry) {
620
- const [streamA, streamB] = entry.value.tee();
621
- entry.value = streamA;
622
- const clonedEntry = {
623
- value: streamB,
624
- timestamp: entry.timestamp,
625
- revalidate: entry.revalidate,
626
- expire: entry.expire,
627
- stale: entry.stale,
628
- tags: entry.tags
629
- };
630
- return [
631
- entry,
632
- clonedEntry
633
- ];
634
- }
635
1027
  function cloneCacheResult(result) {
636
- const [entryA, entryB] = cloneCacheEntry(result.entry);
1028
+ const [entryA, entryB] = (0, _clonecacheentry.cloneCacheEntry)(result.entry);
637
1029
  return [
638
1030
  {
639
1031
  entry: entryA,
640
1032
  hasExplicitRevalidate: result.hasExplicitRevalidate,
641
1033
  hasExplicitExpire: result.hasExplicitExpire,
642
- readRootParamNames: result.readRootParamNames
1034
+ readRootParamNames: result.readRootParamNames,
1035
+ dynamicNestedCacheError: result.dynamicNestedCacheError
643
1036
  },
644
1037
  {
645
1038
  entry: entryB,
646
1039
  hasExplicitRevalidate: result.hasExplicitRevalidate,
647
1040
  hasExplicitExpire: result.hasExplicitExpire,
648
- readRootParamNames: result.readRootParamNames
1041
+ readRootParamNames: result.readRootParamNames,
1042
+ dynamicNestedCacheError: result.dynamicNestedCacheError
649
1043
  }
650
1044
  ];
651
1045
  }
@@ -700,23 +1094,6 @@ function createTrackedReadableStream(stream, cacheSignal) {
700
1094
  async function cache(kind, id, boundArgsLength, originalFn, args) {
701
1095
  var _workUnitStore_implicitTags;
702
1096
  const isPrivate = kind === 'private';
703
- // Private caches are currently only stored in the Resume Data Cache (RDC),
704
- // and not in cache handlers.
705
- const cacheHandler = isPrivate ? undefined : (0, _handlers.getCacheHandler)(kind);
706
- if (!isPrivate && !cacheHandler) {
707
- throw Object.defineProperty(new Error('Unknown cache handler: ' + kind), "__NEXT_ERROR_CODE", {
708
- value: "E248",
709
- enumerable: false,
710
- configurable: true
711
- });
712
- }
713
- const timeoutError = new _usecacheerrors.UseCacheTimeoutError();
714
- Error.captureStackTrace(timeoutError, cache);
715
- const wrapAsInvalidDynamicUsageError = (error, workStore)=>{
716
- Error.captureStackTrace(error, cache);
717
- workStore.invalidDynamicUsageError ??= error;
718
- return error;
719
- };
720
1097
  const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
721
1098
  if (workStore === undefined) {
722
1099
  throw Object.defineProperty(new Error('"use cache" cannot be used outside of App Router. Expected a WorkStore.'), "__NEXT_ERROR_CODE", {
@@ -733,6 +1110,104 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
733
1110
  configurable: true
734
1111
  });
735
1112
  }
1113
+ // In a prerender, tasky IO may result in cache reads that start
1114
+ // after the prerender has already been aborted:
1115
+ //
1116
+ // await setTimeout(100) // we can't abort this uncached IO...
1117
+ // await cachedData() // ...so we'll still get here even though the prerender aborted
1118
+ //
1119
+ // The prerender is over, so we should just return an erroring promise.
1120
+ // (NOTE: we also shouldn't fill this cache, because it's behind uncached IO,
1121
+ // so semantically it is not part of the prerender)
1122
+ switch(workUnitStore.type){
1123
+ case 'prerender':
1124
+ case 'prerender-runtime':
1125
+ {
1126
+ if (workUnitStore.renderSignal.aborted) {
1127
+ // We don't know if the cache itself is dynamic or runtime data,
1128
+ // but the prerender is over, so it doesn't need to participate
1129
+ // in runtime data tracking at all.
1130
+ return (0, _dynamicrenderingutils.makeUntrackedHangingPromise)(workUnitStore.renderSignal, workStore.route, '"use cache" called after prerender ended');
1131
+ }
1132
+ break;
1133
+ }
1134
+ case 'prerender-ppr':
1135
+ case 'prerender-legacy':
1136
+ case 'prerender-client':
1137
+ case 'validation-client':
1138
+ case 'request':
1139
+ case 'cache':
1140
+ case 'private-cache':
1141
+ case 'unstable-cache':
1142
+ case 'generate-static-params':
1143
+ break;
1144
+ default:
1145
+ workUnitStore;
1146
+ }
1147
+ // Probe re-executions (the dev-server's hang-detection worker) short-circuit
1148
+ // further down before any handler is consulted, so we skip handler selection
1149
+ // entirely and the worker can boot without registering handlers at all.
1150
+ let cacheHandler;
1151
+ if (workStore.useCacheProbeMode === undefined) {
1152
+ if (isPrivate) {
1153
+ // Private caches normally go to the Resume Data Cache (RDC), not a cache
1154
+ // handler. In development we additionally persist them in a dedicated
1155
+ // built-in in-memory handler so that reloads are fast.
1156
+ if (process.env.__NEXT_DEV_SERVER) {
1157
+ cacheHandler = (0, _handlers.getPrivateCacheHandler)();
1158
+ }
1159
+ } else {
1160
+ const handler = (0, _handlers.getCacheHandler)(kind);
1161
+ if (!handler) {
1162
+ throw Object.defineProperty(new Error('Unknown cache handler: ' + kind), "__NEXT_ERROR_CODE", {
1163
+ value: "E248",
1164
+ enumerable: false,
1165
+ configurable: true
1166
+ });
1167
+ }
1168
+ // In development, a user-configured (custom) handler may be slow or
1169
+ // remote, so we read through a tiered handler that puts a built-in
1170
+ // in-memory front in front of it to keep cache hits microtask-fast.
1171
+ // Built-in handlers (the default handler, and its size-0 replacement) are
1172
+ // already in-memory and used directly.
1173
+ if (process.env.__NEXT_DEV_SERVER && (0, _handlers.isCustomCacheHandler)(kind)) {
1174
+ // A custom kind always has a dev tiered handler: it is created in the
1175
+ // same `setCacheHandler` call that makes `isCustomCacheHandler` true.
1176
+ const tieredCacheHandler = (0, _handlers.getDevTieredCacheHandler)(kind);
1177
+ if (!tieredCacheHandler) {
1178
+ throw Object.defineProperty(new _invarianterror.InvariantError(`Expected a dev tiered cache handler for kind "${kind}".`), "__NEXT_ERROR_CODE", {
1179
+ value: "E1365",
1180
+ enumerable: false,
1181
+ configurable: true
1182
+ });
1183
+ }
1184
+ cacheHandler = tieredCacheHandler;
1185
+ } else {
1186
+ cacheHandler = handler;
1187
+ }
1188
+ }
1189
+ }
1190
+ const timeoutError = new _usecacheerrors.UseCacheTimeoutError();
1191
+ Error.captureStackTrace(timeoutError, cache);
1192
+ (0, _dynamicrenderingutils.applyOwnerStack)(timeoutError);
1193
+ // Only ever thrown by the dev-server's hang-detection probe.
1194
+ // `Error.captureStackTrace` has to run while `cache()` is still on the
1195
+ // synchronous stack, otherwise the user's `'use cache'` invocation frames
1196
+ // would already be gone — that's why the construction sits up here rather
1197
+ // than next to the trigger that actually consumes it. The `__NEXT_DEV_SERVER`
1198
+ // gate lets the error class drop out of the production runtime bundle.
1199
+ let deadlockError;
1200
+ if (process.env.__NEXT_DEV_SERVER) {
1201
+ deadlockError = new _usecacheerrors.UseCacheDeadlockError();
1202
+ Error.captureStackTrace(deadlockError, cache);
1203
+ (0, _dynamicrenderingutils.applyOwnerStack)(deadlockError);
1204
+ }
1205
+ const wrapAsInvalidDynamicUsageError = (error)=>{
1206
+ Error.captureStackTrace(error, cache);
1207
+ workStore.invalidDynamicUsageError ??= error;
1208
+ return error;
1209
+ };
1210
+ const outerOwnerStack = process.env.NODE_ENV !== 'production' ? captureOuterOwnerStack(workUnitStore) : undefined;
736
1211
  const name = originalFn.name;
737
1212
  let fn = originalFn;
738
1213
  let cacheContext;
@@ -741,7 +1216,8 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
741
1216
  switch(workUnitStore.type){
742
1217
  // "use cache: private" is dynamic in prerendering contexts.
743
1218
  case 'prerender':
744
- return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, expression);
1219
+ // Private caches can read request data, which is runtime data.
1220
+ return (0, _dynamicrenderingutils.makeRuntimeHangingPromise)(workUnitStore.renderSignal, workStore.route, expression, workUnitStore);
745
1221
  case 'prerender-ppr':
746
1222
  return (0, _dynamicrendering.postponeWithTracking)(workStore.route, expression, workUnitStore.dynamicTracking);
747
1223
  case 'prerender-legacy':
@@ -760,7 +1236,7 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
760
1236
  value: "E1016",
761
1237
  enumerable: false,
762
1238
  configurable: true
763
- }), workStore);
1239
+ }));
764
1240
  }
765
1241
  case 'cache':
766
1242
  {
@@ -769,7 +1245,7 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
769
1245
  value: "E1001",
770
1246
  enumerable: false,
771
1247
  configurable: true
772
- }), workStore);
1248
+ }));
773
1249
  }
774
1250
  case 'request':
775
1251
  case 'prerender-runtime':
@@ -777,7 +1253,10 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
777
1253
  cacheContext = {
778
1254
  kind: 'private',
779
1255
  outerWorkUnitStore: workUnitStore,
780
- skipPropagation: false
1256
+ skipPropagation: false,
1257
+ outerOwnerStack,
1258
+ functionId: id,
1259
+ handlerKind: kind
781
1260
  };
782
1261
  break;
783
1262
  case 'generate-static-params':
@@ -786,7 +1265,7 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
786
1265
  value: "E1008",
787
1266
  enumerable: false,
788
1267
  configurable: true
789
- }), workStore);
1268
+ }));
790
1269
  default:
791
1270
  workUnitStore;
792
1271
  // This is dead code, but without throwing an error here, TypeScript
@@ -807,12 +1286,37 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
807
1286
  enumerable: false,
808
1287
  configurable: true
809
1288
  });
1289
+ case 'cache':
1290
+ {
1291
+ // Eagerly capture this invocation's call site while still synchronous
1292
+ // in `cache()`. Used as `cause` of the nested-dynamic cache error
1293
+ // when the outer cache (whose body never re-runs during the final
1294
+ // prerender) throws. Only constructed when the parent is itself a
1295
+ // public `'use cache'` — otherwise this entry can never propagate
1296
+ // dynamism into that error and the allocation would be wasted. Private
1297
+ // parents are intentionally excluded: `'use cache: private'` is
1298
+ // dynamic-by-definition in prerendering and deferred to the runtime
1299
+ // stage in dev requests, so a public cache nested inside one never
1300
+ // triggers the throw upstream.
1301
+ const dynamicNestedCacheError = new _usecacheerrors.NestedDynamicUseCacheError();
1302
+ Error.captureStackTrace(dynamicNestedCacheError, cache);
1303
+ (0, _dynamicrenderingutils.applyOwnerStack)(dynamicNestedCacheError);
1304
+ cacheContext = {
1305
+ kind: 'public',
1306
+ outerWorkUnitStore: workUnitStore,
1307
+ skipPropagation: false,
1308
+ outerOwnerStack,
1309
+ functionId: id,
1310
+ handlerKind: kind,
1311
+ dynamicNestedCacheError
1312
+ };
1313
+ break;
1314
+ }
810
1315
  case 'prerender':
811
1316
  case 'prerender-runtime':
812
1317
  case 'prerender-ppr':
813
1318
  case 'prerender-legacy':
814
1319
  case 'request':
815
- case 'cache':
816
1320
  case 'private-cache':
817
1321
  // TODO: We should probably forbid nesting "use cache" inside
818
1322
  // unstable_cache. (fallthrough)
@@ -821,7 +1325,11 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
821
1325
  cacheContext = {
822
1326
  kind: 'public',
823
1327
  outerWorkUnitStore: workUnitStore,
824
- skipPropagation: false
1328
+ skipPropagation: false,
1329
+ outerOwnerStack,
1330
+ functionId: id,
1331
+ handlerKind: kind,
1332
+ dynamicNestedCacheError: undefined
825
1333
  };
826
1334
  break;
827
1335
  default:
@@ -856,12 +1364,10 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
856
1364
  case 'prerender-runtime':
857
1365
  {
858
1366
  // In a runtime prerender, we have to make sure that APIs that would hang during a static prerender
859
- // are resolved with a delay, in the appropriate runtime stage. Private caches read from
860
- // Segments not using runtime prefetch resolve at EarlyRuntime,
861
- // while runtime-prefetchable segments resolve at Runtime.
1367
+ // are resolved with a delay, in the appropriate runtime stage. Private caches resolve in EarlyRuntime,
862
1368
  const stagedRendering = outerWorkUnitStore.stagedRendering;
863
1369
  if (stagedRendering) {
864
- await stagedRendering.waitForStage((0, _dynamicrenderingutils.getRuntimeStage)(stagedRendering));
1370
+ await stagedRendering.waitForStage(_dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.sessionData);
865
1371
  }
866
1372
  break;
867
1373
  }
@@ -869,11 +1375,8 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
869
1375
  {
870
1376
  if (process.env.NODE_ENV === 'development') {
871
1377
  // Similar to runtime prerenders, private caches should not resolve in the static stage
872
- // of a dev request, so we delay them. We pick the appropriate runtime stage based on
873
- // whether we're in the early or late stages.
874
- const stagedRendering = outerWorkUnitStore.stagedRendering;
875
- const stage = stagedRendering ? (0, _dynamicrenderingutils.getRuntimeStage)(stagedRendering) : _stagedrendering.RenderStage.Runtime;
876
- await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, outerWorkUnitStore, stage);
1378
+ // of a dev request, so we delay them.
1379
+ await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, outerWorkUnitStore, _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.sessionData);
877
1380
  }
878
1381
  break;
879
1382
  }
@@ -979,14 +1482,15 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
979
1482
  args.unshift(boundArgs);
980
1483
  }
981
1484
  const temporaryReferences = (0, _client.createTemporaryReferenceSet)();
982
- // For private caches, which are allowed to read cookies, we still don't
983
- // need to include the cookies in the cache key. This is because we don't
984
- // store the cache entries in a cache handler, but only in the Resume Data
985
- // Cache (RDC). Private caches are only used during dynamic requests and
986
- // runtime prefetches. For dynamic requests, the RDC is immutable, so it
987
- // does not include any private caches. For runtime prefetches, the RDC is
988
- // mutable, but only lives as long as the request, so the key does not
989
- // need to include cookies.
1485
+ // The base serialized cache key doesn't include the cookies or headers that
1486
+ // private caches are allowed to read. In production this is because private
1487
+ // cache entries aren't stored in a cache handler, only in the Resume Data
1488
+ // Cache (RDC): private caches are only used during dynamic requests and
1489
+ // runtime prefetches; for dynamic requests the RDC is immutable and excludes
1490
+ // private caches, and for runtime prefetches it's mutable but lives only as
1491
+ // long as the request. In development private caches are persisted across
1492
+ // requests, so `cacheHandlerKeyBase` (below) additionally scopes the handler
1493
+ // key by the request's cookies and headers.
990
1494
  const cacheKeyParts = hmrRefreshHash ? [
991
1495
  buildId,
992
1496
  id,
@@ -1026,7 +1530,9 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
1026
1530
  abortController: dynamicAccessAbortController
1027
1531
  }, encodeCacheKeyParts);
1028
1532
  if (dynamicAccessAbortController.signal.aborted) {
1029
- return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"');
1533
+ // The dynamic access is a fallback params read, which is runtime
1534
+ // data.
1535
+ return (0, _dynamicrenderingutils.makeRuntimeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore);
1030
1536
  }
1031
1537
  break;
1032
1538
  }
@@ -1048,38 +1554,137 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
1048
1554
  default:
1049
1555
  return workUnitStore;
1050
1556
  }
1557
+ // Probe path: we're running inside a pooled worker spawned by the dev
1558
+ // server to check whether a stalled cache fill would complete in an
1559
+ // isolated module scope. Skip the RDC / cache-handler / leader-election
1560
+ // machinery, call `generateCacheEntry` (same as a real cold fill), drain
1561
+ // the returned stream via `pendingCacheResult`, and apply the probe's own
1562
+ // timeout. The caller only cares whether the fill resolves; the result
1563
+ // value is discarded.
1564
+ //
1565
+ // Gated on `__NEXT_DEV_SERVER` so the entire branch — including its
1566
+ // `generateCacheEntry` call site and the threading of
1567
+ // `deadlockError` — drops out of the production runtime
1568
+ // bundle.
1569
+ if (process.env.__NEXT_DEV_SERVER && workStore.useCacheProbeMode) {
1570
+ // Both public and private caches probe via the same path. The worker
1571
+ // reconstructs real `headers` / `cookies` / `draftMode` from the
1572
+ // forwarded request snapshot, so private caches that legitimately read
1573
+ // those work in the probe just like in the real fill.
1574
+ const probeTimeoutMs = workStore.useCacheProbeMode.timeoutMs;
1575
+ // The deadlock error never gets thrown from inside the worker: the
1576
+ // worker's outer store has `cacheSignal: undefined`, so
1577
+ // `generateCacheEntryImpl` skips the dev-request branch and the idle
1578
+ // probe is never set up.
1579
+ const result = await generateCacheEntry(workStore, cacheContext, clientReferenceManifest, encodedCacheKeyParts, fn, timeoutError, undefined);
1580
+ if (result.type === 'prerender-dynamic') {
1581
+ // Unreachable in the probe: outer store is `'request'`-typed, which
1582
+ // never produces this variant.
1583
+ throw Object.defineProperty(new _invarianterror.InvariantError('Unexpected `prerender-dynamic` result in `use cache` probe mode.'), "__NEXT_ERROR_CODE", {
1584
+ value: "E1183",
1585
+ enumerable: false,
1586
+ configurable: true
1587
+ });
1588
+ }
1589
+ // We don't consume the returned stream — `pendingCacheResult` is what
1590
+ // completes when `collectResult` has drained `savedStream`. Cancel the
1591
+ // unused copy so it doesn't buffer forever.
1592
+ result.stream.cancel().catch(()=>{});
1593
+ let probeTimeoutTimer;
1594
+ try {
1595
+ await Promise.race([
1596
+ result.pendingCacheResult,
1597
+ new Promise((_, reject)=>{
1598
+ probeTimeoutTimer = setTimeout(()=>reject(timeoutError), probeTimeoutMs);
1599
+ })
1600
+ ]);
1601
+ } finally{
1602
+ if (probeTimeoutTimer !== undefined) {
1603
+ clearTimeout(probeTimeoutTimer);
1604
+ }
1605
+ }
1606
+ return;
1607
+ }
1051
1608
  const serializedCacheKey = typeof encodedCacheKeyParts === 'string' ? // Convert it to an ArrayBuffer if it wants to.
1052
1609
  encodedCacheKeyParts : await encodeFormData(encodedCacheKeyParts);
1610
+ const rootParams = workUnitStore.rootParams;
1611
+ const knownRootParamNames = knownRootParamsByFunctionId.get(id);
1612
+ // The coarse cache-handler key. With no root params read, it locates the
1613
+ // entry directly; otherwise it locates a redirect entry from which the
1614
+ // specific key (this key + root params, computed below) is derived. For
1615
+ // private caches in development (persisted in the built-in in-memory handler)
1616
+ // it's additionally scoped by the request's cookies and headers, so entries
1617
+ // for requests with different request data don't collide; keys derived from
1618
+ // it inherit that scoping.
1619
+ const cacheHandlerKeyBase = process.env.__NEXT_DEV_SERVER && cacheContext.kind === 'private' ? serializedCacheKey + computePrivateCacheKeyRequestSuffix(cacheContext.outerWorkUnitStore.cookies, cacheContext.outerWorkUnitStore.headers) : serializedCacheKey;
1053
1620
  // If we already know which root params this function reads, include them in
1054
1621
  // the cache handler key for a direct hit (skipping the redirect entry).
1055
1622
  // rootParams is undefined when nested inside unstable_cache.
1056
- const rootParams = workUnitStore.rootParams;
1057
- const knownRootParamNames = knownRootParamsByFunctionId.get(id);
1058
- let cacheHandlerKey = knownRootParamNames && rootParams ? serializedCacheKey + computeRootParamsCacheKeySuffix(rootParams, knownRootParamNames) : serializedCacheKey;
1623
+ let cacheHandlerKey = knownRootParamNames && rootParams ? cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, knownRootParamNames) : cacheHandlerKeyBase;
1059
1624
  let stream = undefined;
1060
- // Get an immutable and mutable versions of the resume data cache.
1061
- const prerenderResumeDataCache = (0, _workunitasyncstorageexternal.getPrerenderResumeDataCache)(workUnitStore);
1062
- const renderResumeDataCache = (0, _workunitasyncstorageexternal.getRenderResumeDataCache)(workUnitStore);
1625
+ // Set when a short-lived cache hit ends its cache read up front (dev only) so
1626
+ // the static-shell boundary doesn't count it as a phantom miss. Once set, the
1627
+ // cache signal read is balanced, so serving must use a plain stream and skip
1628
+ // any trailing cacheSignal.endRead() call.
1629
+ let cacheSignalReadEnded = false;
1630
+ const resumeDataCache = (0, _workunitasyncstorageexternal.getResumeDataCache)(workUnitStore);
1063
1631
  const implicitTags = ((_workUnitStore_implicitTags = workUnitStore.implicitTags) == null ? void 0 : _workUnitStore_implicitTags.tags) ?? [];
1064
- if (renderResumeDataCache) {
1632
+ if (resumeDataCache) {
1633
+ var _resumeDataCache_dynamicCacheKeys;
1634
+ // If this cache key was already determined to be dynamic during the
1635
+ // prospective prerender (e.g. because it accessed fallback params), we
1636
+ // return a hanging promise early to avoid trying to regenerate the entry,
1637
+ // which would be aborted anyway.
1638
+ if ((_resumeDataCache_dynamicCacheKeys = resumeDataCache.dynamicCacheKeys) == null ? void 0 : _resumeDataCache_dynamicCacheKeys.has(serializedCacheKey)) {
1639
+ switch(workUnitStore.type){
1640
+ case 'prerender':
1641
+ case 'prerender-runtime':
1642
+ // The cache key was marked dynamic because it depends on fallback
1643
+ // params, which are runtime data.
1644
+ return (0, _dynamicrenderingutils.makeRuntimeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore);
1645
+ case 'prerender-ppr':
1646
+ case 'prerender-legacy':
1647
+ case 'request':
1648
+ case 'cache':
1649
+ case 'private-cache':
1650
+ case 'unstable-cache':
1651
+ case 'generate-static-params':
1652
+ break;
1653
+ default:
1654
+ workUnitStore;
1655
+ }
1656
+ }
1065
1657
  const cacheSignal = (0, _workunitasyncstorageexternal.getCacheSignal)(workUnitStore);
1066
1658
  if (cacheSignal) {
1067
1659
  cacheSignal.beginRead();
1068
1660
  }
1069
- const rdcEntry = renderResumeDataCache.cache.get(serializedCacheKey);
1661
+ const rdcEntry = resumeDataCache.cache.get(serializedCacheKey);
1070
1662
  if (rdcEntry !== undefined) {
1071
1663
  let rdcResult = await rdcEntry;
1072
1664
  // Check if the RDC entry should be discarded due to recently revalidated
1073
1665
  // tags. When a server action calls updateTag(), the re-render should see
1074
1666
  // fresh data instead of stale RDC data.
1075
1667
  if (rdcResult !== undefined) {
1076
- if (rdcResult.entry.tags.some((tag)=>isRecentlyRevalidatedTag(tag, workStore)) || implicitTags.some((tag)=>isRecentlyRevalidatedTag(tag, workStore))) {
1668
+ const { timestamp } = rdcResult.entry;
1669
+ if (rdcResult.entry.tags.some((tag)=>isRevalidatedAfter(tag, timestamp, workStore)) || implicitTags.some((tag)=>isRevalidatedAfter(tag, timestamp, workStore))) {
1077
1670
  debug == null ? void 0 : debug('discarding RDC entry due to recently revalidated tags', serializedCacheKey);
1078
1671
  rdcResult = undefined;
1079
1672
  }
1080
1673
  }
1081
1674
  if (rdcResult !== undefined) {
1082
- if (rdcResult.entry.revalidate === 0 || rdcResult.entry.expire < _constants.DYNAMIC_EXPIRE) {
1675
+ if (rdcResult.entry.revalidate === 0 || rdcResult.entry.expire < _constants.MIN_PRERENDERABLE_EXPIRE) {
1676
+ // The nested-cache error only makes sense when a dynamic nested cache
1677
+ // actually shortened an outer cache that has no explicit `cacheLife`
1678
+ // (`dynamicNestedCacheError` is set), and only when the app's default
1679
+ // profile is itself prerenderable. If the default profile is already
1680
+ // dynamic (`revalidate: 0` or an `expire` under the prerenderable
1681
+ // minimum), every cache is omitted from prerenders by default, so
1682
+ // there is no silent degradation to warn about. A short life from the
1683
+ // default profile, or from a dev private cache's self-imposed
1684
+ // `revalidate: 0` (which never carries a nested error), therefore
1685
+ // stays a dynamic hole rather than erroring.
1686
+ const defaultCacheLife = workStore.cacheLifeProfiles.default;
1687
+ const shouldReportNestedCacheError = rdcResult.dynamicNestedCacheError !== undefined && defaultCacheLife.revalidate !== 0 && defaultCacheLife.expire >= _constants.MIN_PRERENDERABLE_EXPIRE;
1083
1688
  switch(workUnitStore.type){
1084
1689
  case 'prerender':
1085
1690
  // In a Dynamic I/O prerender, if the cache entry has
@@ -1089,28 +1694,35 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
1089
1694
  // a dynamic hole that can be filled in during the resume with
1090
1695
  // a potentially cached entry.
1091
1696
  if (rdcResult.entry.revalidate === 0) {
1092
- if (rdcResult.hasExplicitRevalidate === false) {
1093
- throw wrapAsInvalidDynamicUsageError(Object.defineProperty(new Error(nestedCacheZeroRevalidateErrorMessage), "__NEXT_ERROR_CODE", {
1094
- value: "E1000",
1697
+ if (rdcResult.hasExplicitRevalidate === false && shouldReportNestedCacheError) {
1698
+ throw wrapAsInvalidDynamicUsageError(Object.defineProperty(new Error(nestedCacheZeroRevalidateErrorMessage, {
1699
+ cause: rdcResult.dynamicNestedCacheError
1700
+ }), "__NEXT_ERROR_CODE", {
1701
+ value: "E1245",
1095
1702
  enumerable: false,
1096
1703
  configurable: true
1097
- }), workStore);
1704
+ }));
1098
1705
  }
1099
1706
  debug == null ? void 0 : debug('omitting entry', serializedCacheKey, 'from static shell due to revalidate: 0');
1100
1707
  } else {
1101
- if (rdcResult.hasExplicitExpire === false) {
1102
- throw wrapAsInvalidDynamicUsageError(Object.defineProperty(new Error(nestedCacheShortExpireErrorMessage), "__NEXT_ERROR_CODE", {
1103
- value: "E1009",
1708
+ if (rdcResult.hasExplicitExpire === false && shouldReportNestedCacheError) {
1709
+ throw wrapAsInvalidDynamicUsageError(Object.defineProperty(new Error(nestedCacheShortExpireErrorMessage, {
1710
+ cause: rdcResult.dynamicNestedCacheError
1711
+ }), "__NEXT_ERROR_CODE", {
1712
+ value: "E1244",
1104
1713
  enumerable: false,
1105
1714
  configurable: true
1106
- }), workStore);
1715
+ }));
1107
1716
  }
1108
1717
  debug == null ? void 0 : debug('omitting entry', serializedCacheKey, 'from static shell due to short expire value:', rdcResult.entry.expire);
1109
1718
  }
1110
1719
  if (cacheSignal) {
1111
1720
  cacheSignal.endRead();
1112
1721
  }
1113
- return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"');
1722
+ // The entry is only excluded from *static* prerenders — the
1723
+ // 'prerender-runtime' case below serves it — so a runtime
1724
+ // prefetch would include this content.
1725
+ return (0, _dynamicrenderingutils.makeRuntimeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore);
1114
1726
  case 'prerender-runtime':
1115
1727
  {
1116
1728
  // In the final phase of a runtime prerender, we have to make
@@ -1118,36 +1730,46 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
1118
1730
  // are resolved with a delay, in the appropriate runtime stage.
1119
1731
  const stagedRendering = workUnitStore.stagedRendering;
1120
1732
  if (stagedRendering) {
1121
- await stagedRendering.waitForStage((0, _dynamicrenderingutils.getRuntimeStage)(stagedRendering));
1733
+ await stagedRendering.waitForStage(_dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.sessionData);
1122
1734
  }
1123
1735
  break;
1124
1736
  }
1125
1737
  case 'request':
1126
1738
  {
1127
1739
  if (process.env.NODE_ENV === 'development') {
1128
- if (rdcResult.entry.revalidate === 0 && rdcResult.hasExplicitRevalidate === false) {
1129
- throw wrapAsInvalidDynamicUsageError(Object.defineProperty(new Error(nestedCacheZeroRevalidateErrorMessage), "__NEXT_ERROR_CODE", {
1130
- value: "E1000",
1740
+ // These throws force an explicit cache life decision on an
1741
+ // outer cache that a nested cache would otherwise silently
1742
+ // shorten (see `shouldReportNestedCacheError` above). Otherwise
1743
+ // the short-lived entry is deferred as a dynamic hole below.
1744
+ if (rdcResult.entry.revalidate === 0 && rdcResult.hasExplicitRevalidate === false && shouldReportNestedCacheError) {
1745
+ throw wrapAsInvalidDynamicUsageError(Object.defineProperty(new Error(nestedCacheZeroRevalidateErrorMessage, {
1746
+ cause: rdcResult.dynamicNestedCacheError
1747
+ }), "__NEXT_ERROR_CODE", {
1748
+ value: "E1245",
1131
1749
  enumerable: false,
1132
1750
  configurable: true
1133
- }), workStore);
1751
+ }));
1134
1752
  }
1135
- if (rdcResult.entry.expire < _constants.DYNAMIC_EXPIRE && rdcResult.hasExplicitExpire === false) {
1136
- throw wrapAsInvalidDynamicUsageError(Object.defineProperty(new Error(nestedCacheShortExpireErrorMessage), "__NEXT_ERROR_CODE", {
1137
- value: "E1009",
1753
+ if (rdcResult.entry.expire < _constants.MIN_PRERENDERABLE_EXPIRE && rdcResult.hasExplicitExpire === false && shouldReportNestedCacheError) {
1754
+ throw wrapAsInvalidDynamicUsageError(Object.defineProperty(new Error(nestedCacheShortExpireErrorMessage, {
1755
+ cause: rdcResult.dynamicNestedCacheError
1756
+ }), "__NEXT_ERROR_CODE", {
1757
+ value: "E1244",
1138
1758
  enumerable: false,
1139
1759
  configurable: true
1140
- }), workStore);
1760
+ }));
1141
1761
  }
1142
- // We delay the cache here so that it doesn't resolve in the static task --
1143
- // in a regular static prerender, it'd be a hanging promise, and we need to reflect that,
1144
- // so it has to resolve later.
1145
- // TODO(restart-on-cache-miss): Optimize this to avoid unnecessary restarts.
1146
- // We don't end the cache read here, so this will always appear as a cache miss in the static stage,
1147
- // and thus will cause a restart even if all caches are filled.
1148
- const stagedRendering = workUnitStore.stagedRendering;
1149
- const stage = stagedRendering ? (0, _dynamicrenderingutils.getRuntimeStage)(stagedRendering) : _stagedrendering.RenderStage.Runtime;
1150
- await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, workUnitStore, stage);
1762
+ // A short-lived entry is a dynamic hole, excluded from the
1763
+ // static shell, so we end the cache signal read here (the
1764
+ // prerender case does the same) to avoid this cache hit being
1765
+ // considered a cache miss when checking for pending cache reads
1766
+ // at staged rendering task boundaries. The value is deferred to
1767
+ // the runtime stage.
1768
+ if (cacheSignal && !cacheSignalReadEnded) {
1769
+ cacheSignal.endRead();
1770
+ cacheSignalReadEnded = true;
1771
+ }
1772
+ await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, workUnitStore, _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.sessionData);
1151
1773
  }
1152
1774
  break;
1153
1775
  }
@@ -1162,32 +1784,88 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
1162
1784
  workUnitStore;
1163
1785
  }
1164
1786
  }
1165
- if (rdcResult.entry.stale < _constants.RUNTIME_PREFETCH_DYNAMIC_STALE) {
1787
+ if (rdcResult.entry.stale < _constants.MIN_SHELL_STALE) {
1788
+ // The entry's stale time is short enough that it's excluded from
1789
+ // shells. If it's below `MIN_PREFETCHABLE_STALE`, it's not worth
1790
+ // prefetching at all and is excluded from prerenders entirely,
1791
+ // leaving a dynamic hole that can be filled during the navigation.
1792
+ // Otherwise, it's still included in prerenders and cached
1793
+ // navigations, but it must not be part of an App Shell, which may
1794
+ // be reused on the client for longer than the entry's stale time.
1795
+ // We delay the entry to resolve in the post-shell (link data)
1796
+ // stage, which excludes both its content and its stale time from
1797
+ // the shell.
1798
+ const isPrefetchable = rdcResult.entry.stale >= _constants.MIN_PREFETCHABLE_STALE;
1166
1799
  switch(workUnitStore.type){
1800
+ case 'prerender':
1167
1801
  case 'prerender-runtime':
1168
- // In a runtime prerender, if the cache entry will become
1169
- // stale in less then 30 seconds, we consider this cache entry
1170
- // dynamic as it's not worth prefetching. It's better to leave
1171
- // a dynamic hole that can be filled during the navigation.
1172
- debug == null ? void 0 : debug('omitting entry', serializedCacheKey, 'from runtime shell due to short stale value:', rdcResult.entry.stale);
1173
- if (cacheSignal) {
1174
- cacheSignal.endRead();
1802
+ {
1803
+ const prerenderStore = workUnitStore;
1804
+ // The post-shell stage that the entry must be delayed to.
1805
+ let postShellStage;
1806
+ if (prerenderStore.type === 'prerender') {
1807
+ postShellStage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.staticLinkData;
1808
+ } else {
1809
+ postShellStage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.runtimeLinkData;
1810
+ }
1811
+ const stagedRendering = prerenderStore.stagedRendering;
1812
+ if (!isPrefetchable || // If the render ends before the post-shell stage (e.g. a
1813
+ // render that only produces an App Shell), the entry can't
1814
+ // be delayed and is omitted entirely.
1815
+ stagedRendering !== null && stagedRendering.finalStage !== null && stagedRendering.finalStage < postShellStage) {
1816
+ debug == null ? void 0 : debug('omitting entry', serializedCacheKey, 'from shell due to short stale value:', rdcResult.entry.stale);
1817
+ if (cacheSignal) {
1818
+ cacheSignal.endRead();
1819
+ }
1820
+ if (isPrefetchable) {
1821
+ // The entry was omitted only because this render ends
1822
+ // before the post-shell stage; a render that reaches its
1823
+ // post-shell stage would serve it.
1824
+ return (0, _dynamicrenderingutils.makeStageHangingPromise)(prerenderStore.renderSignal, workStore.route, 'dynamic "use cache"', prerenderStore);
1825
+ }
1826
+ // An unprefetchable entry (stale < MIN_PREFETCHABLE_STALE) is
1827
+ // excluded from runtime prerenders too.
1828
+ return (0, _dynamicrenderingutils.makeDynamicHangingPromise)(prerenderStore.renderSignal, workStore.route, 'dynamic "use cache"');
1829
+ }
1830
+ if (stagedRendering !== null) {
1831
+ debug == null ? void 0 : debug('delaying entry', serializedCacheKey, 'until after the shell stage due to short stale value:', rdcResult.entry.stale);
1832
+ await stagedRendering.waitForStage(postShellStage);
1833
+ }
1834
+ break;
1175
1835
  }
1176
- return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"');
1177
1836
  case 'request':
1178
1837
  {
1838
+ // A request store in `next start` never delays caches — shells
1839
+ // are produced by separate (runtime) prerenders, which apply
1840
+ // the exclusions above. In dev, the request render is also used
1841
+ // to recover shells, so we delay the entry here to match.
1179
1842
  if (process.env.NODE_ENV === 'development') {
1180
- // We delay the cache here so that it doesn't resolve in the runtime phase --
1181
- // in a regular runtime prerender, it'd be a hanging promise, and we need to reflect that,
1182
- // so it has to resolve later.
1183
- // TODO(restart-on-cache-miss): Optimize this to avoid unnecessary restarts.
1184
- // We don't end the cache read here, so this will always appear as a cache miss in the runtime stage,
1185
- // and thus will cause a restart even if all caches are filled.
1186
- await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, workUnitStore, _stagedrendering.RenderStage.Dynamic);
1843
+ // End the cache signal read (once, in case an earlier block
1844
+ // already did) so the delayed value isn't counted as a pending
1845
+ // read at a staged rendering boundary.
1846
+ if (cacheSignal && !cacheSignalReadEnded) {
1847
+ cacheSignal.endRead();
1848
+ cacheSignalReadEnded = true;
1849
+ }
1850
+ // An unprefetchable entry is excluded from prerenders, so it
1851
+ // resolves in the dynamic stage. Otherwise, a dynamic request
1852
+ // generally recovers a static shell, so the entry can resolve
1853
+ // in the static link data stage. If we need to recover a
1854
+ // session shell instead, as indicated by `needsSessionShell`,
1855
+ // the entry must resolve after the session data stage that
1856
+ // the shell includes.
1857
+ let stage;
1858
+ if (!isPrefetchable) {
1859
+ stage = _stagedrendering.RenderStage.Dynamic;
1860
+ } else if (workUnitStore.needsSessionShell) {
1861
+ stage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.runtimeLinkData;
1862
+ } else {
1863
+ stage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.staticLinkData;
1864
+ }
1865
+ await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, workUnitStore, stage);
1187
1866
  }
1188
1867
  break;
1189
1868
  }
1190
- case 'prerender':
1191
1869
  case 'prerender-ppr':
1192
1870
  case 'prerender-legacy':
1193
1871
  case 'cache':
@@ -1202,23 +1880,32 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
1202
1880
  }
1203
1881
  if (rdcResult !== undefined) {
1204
1882
  debug == null ? void 0 : debug('Resume Data Cache entry found', serializedCacheKey);
1205
- if (prerenderResumeDataCache) {
1206
- prerenderResumeDataCache.cache.set(serializedCacheKey, rdcEntry);
1207
- }
1208
1883
  if (rdcResult.readRootParamNames && rdcResult.readRootParamNames.size > 0) {
1209
1884
  addKnownRootParamNames(id, rdcResult.readRootParamNames);
1210
1885
  }
1211
1886
  // We want to make sure we only propagate cache life & tags if the
1212
1887
  // entry was *not* omitted from the prerender. So we only do this
1213
1888
  // after the above early returns.
1214
- propagateCacheEntryMetadata(cacheContext, rdcResult.entry, rdcResult.readRootParamNames);
1889
+ propagateCacheEntryMetadata(cacheContext, {
1890
+ tags: rdcResult.entry.tags,
1891
+ revalidate: rdcResult.entry.revalidate,
1892
+ expire: rdcResult.entry.expire,
1893
+ stale: rdcResult.entry.stale,
1894
+ timestamp: rdcResult.entry.timestamp,
1895
+ hasExplicitRevalidate: rdcResult.hasExplicitRevalidate,
1896
+ hasExplicitExpire: rdcResult.hasExplicitExpire,
1897
+ readRootParamNames: rdcResult.readRootParamNames,
1898
+ dynamicNestedCacheError: rdcResult.dynamicNestedCacheError
1899
+ });
1215
1900
  const [streamA, streamB] = rdcResult.entry.value.tee();
1216
1901
  rdcResult.entry.value = streamB;
1217
- if (cacheSignal) {
1902
+ if (cacheSignal && !cacheSignalReadEnded) {
1218
1903
  // When we have a cacheSignal we need to block on reading the cache
1219
1904
  // entry before ending the read.
1220
1905
  stream = createTrackedReadableStream(streamA, cacheSignal);
1221
1906
  } else {
1907
+ // The cache signal read was already ended for a short-lived deferral
1908
+ // (or there is no cacheSignal), so serve a plain stream.
1222
1909
  stream = streamA;
1223
1910
  }
1224
1911
  } else {
@@ -1235,25 +1922,45 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
1235
1922
  }
1236
1923
  switch(workUnitStore.type){
1237
1924
  case 'prerender':
1238
- // If `allowEmptyStaticShell` is true, and thus a prefilled resume
1239
- // data cache was provided, then a cache miss means that params were
1240
- // part of the cache key. In this case, we can make this cache
1241
- // function a dynamic hole in the shell (or produce an empty shell if
1242
- // there's no parent suspense boundary). Currently, this also includes
1243
- // layouts and pages that don't read params, which will be improved
1244
- // when we implement NAR-136. Otherwise, we assume that if params are
1245
- // passed explicitly into a "use cache" function, that the params are
1246
- // also accessed. This allows us to abort early, and treat the
1247
- // function as dynamic, instead of waiting for the timeout to be
1248
- // reached. Compared to the instrumentation-based params bailout we do
1249
- // here, this also covers the case where params are transformed with
1250
- // an async function, before being passed into the "use cache"
1251
- // function, which escapes the instrumentation.
1252
- if (workUnitStore.allowEmptyStaticShell) {
1253
- return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"');
1925
+ if ((resumeDataCache == null ? void 0 : resumeDataCache.mutable) === false) {
1926
+ // We're prerendering a fallback shell whose Resume Data Cache is
1927
+ // the prefilled, read-only seed from a phase-1 prerender of a more-
1928
+ // specific sibling route. A miss here means the cache key depends
1929
+ // on a fallback param. We short-circuit to a dynamic hole (which
1930
+ // may produce an empty shell if there's no parent Suspense
1931
+ // boundary). Currently this also catches layouts and pages that
1932
+ // don't read params, which will be improved when we implement
1933
+ // NAR-136. Compared to the instrumentation-based params bailout we
1934
+ // also do here, this covers the case where params are transformed
1935
+ // with an async function before being passed into the "use cache"
1936
+ // function, which escapes the instrumentation.
1937
+ // The cache key depends on fallback params, which are runtime
1938
+ // data.
1939
+ return (0, _dynamicrenderingutils.makeRuntimeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore);
1254
1940
  }
1255
- break;
1941
+ // fallthrough
1256
1942
  case 'prerender-runtime':
1943
+ if (!cacheSignal) {
1944
+ // This is the final prerender (cacheSignal is null), which means
1945
+ // all caches should have been warmed during the prospective
1946
+ // prerender. A cache miss here indicates that the cache key is
1947
+ // non-deterministic (e.g. due to unstable array order in the
1948
+ // arguments). Known dynamic keys (e.g. from fallback params) are
1949
+ // already handled by the early return above. We return a hanging
1950
+ // promise so this becomes a dynamic hole rather than generating a
1951
+ // broken cache entry that gets aborted.
1952
+ console.warn(Object.defineProperty(new Error(`Unexpected cache miss after cache warming phase during prerendering. This is likely caused by non-deterministic arguments that differ between the cache warming phase and the final prerender phase (e.g. unstable array order). Ensure that arguments passed to cached functions are deterministic.`), "__NEXT_ERROR_CODE", {
1953
+ value: "E1163",
1954
+ enumerable: false,
1955
+ configurable: true
1956
+ }));
1957
+ // This is an anomaly (non-deterministic cache key), so we can't
1958
+ // know whether a runtime prerender would resolve it. Treat it as
1959
+ // runtime data, conservatively: the cost is at most a redundant
1960
+ // runtime prefetch request.
1961
+ return (0, _dynamicrenderingutils.makeRuntimeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore);
1962
+ }
1963
+ break;
1257
1964
  case 'prerender-ppr':
1258
1965
  case 'prerender-legacy':
1259
1966
  case 'request':
@@ -1267,199 +1974,503 @@ async function cache(kind, id, boundArgsLength, originalFn, args) {
1267
1974
  }
1268
1975
  }
1269
1976
  }
1977
+ // Intra-request deduplication: Within a single request, root params are
1978
+ // fixed, so the coarse key (serializedCacheKey) is sufficient. If another
1979
+ // invocation in this request is already handling the same cache entry
1980
+ // (including the cache handler lookup and generation), we join it instead of
1981
+ // doing redundant work. This also saves cache handler `get` calls which may
1982
+ // be HTTP round-trips for remote handlers.
1270
1983
  if (stream === undefined) {
1271
- const cacheSignal = (0, _workunitasyncstorageexternal.getCacheSignal)(workUnitStore);
1272
- if (cacheSignal) {
1273
- // Either the cache handler or the generation can be using I/O at this point.
1274
- // We need to track when they start and when they complete.
1275
- cacheSignal.beginRead();
1276
- }
1277
- const lazyRefreshTags = workStore.refreshTagsByCacheKind.get(kind);
1278
- if (lazyRefreshTags && !(0, _lazyresult.isResolvedLazyResult)(lazyRefreshTags)) {
1279
- await lazyRefreshTags;
1280
- }
1281
- let entry;
1282
- // We ignore existing cache entries when force revalidating.
1283
- if (cacheHandler && !shouldForceRevalidate(workStore, workUnitStore)) {
1284
- entry = await cacheHandler.get(cacheHandlerKey, implicitTags);
1285
- // Check if this is a redirect entry (coarse key → specific key). Redirect
1286
- // entries have private tags encoding the root param names (one tag per
1287
- // param name, prefixed with _N_RP_).
1288
- if (entry && rootParams) {
1289
- const paramNames = new Set();
1290
- for (const tag of entry.tags){
1291
- if (tag.startsWith(_constants1.NEXT_CACHE_ROOT_PARAM_TAG_ID)) {
1292
- paramNames.add(tag.slice(_constants1.NEXT_CACHE_ROOT_PARAM_TAG_ID.length));
1293
- }
1294
- }
1295
- if (paramNames.size > 0) {
1296
- addKnownRootParamNames(id, paramNames);
1297
- cacheHandlerKey = serializedCacheKey + computeRootParamsCacheKeySuffix(rootParams, paramNames);
1298
- entry = await cacheHandler.get(cacheHandlerKey, implicitTags);
1299
- }
1300
- }
1301
- }
1302
- if (entry) {
1303
- let implicitTagsExpiration = 0;
1304
- if (workUnitStore.implicitTags) {
1305
- const lazyExpiration = workUnitStore.implicitTags.expirationsByCacheKind.get(kind);
1306
- if (lazyExpiration) {
1307
- const expiration = (0, _lazyresult.isResolvedLazyResult)(lazyExpiration) ? lazyExpiration.value : await lazyExpiration;
1308
- // If a cache handler returns an expiration time of Infinity, it
1309
- // signals to Next.js that it handles checking cache entries for
1310
- // staleness based on the expiration of the implicit tags passed
1311
- // into the `get` method. In this case, we keep the default of 0,
1312
- // which means that the implicit tags are not considered expired.
1313
- if (expiration < Infinity) {
1314
- implicitTagsExpiration = expiration;
1315
- }
1316
- }
1984
+ var _workStore_pendingCacheInvocations, _workStore_completedCacheInvocations;
1985
+ const pendingInvocation = (_workStore_pendingCacheInvocations = workStore.pendingCacheInvocations) == null ? void 0 : _workStore_pendingCacheInvocations.get(serializedCacheKey);
1986
+ // A pending invocation is joined unconditionally: its fill is shared, so
1987
+ // every joiner receives whatever that fill produces. A completed one is a
1988
+ // stored entry instead, so it is only reused when the caller hasn't asked
1989
+ // to bypass caches, and only if nothing has invalidated it since.
1990
+ const completedInvocation = pendingInvocation === undefined && !shouldForceRevalidate(workStore, workUnitStore) ? (_workStore_completedCacheInvocations = workStore.completedCacheInvocations) == null ? void 0 : _workStore_completedCacheInvocations.get(serializedCacheKey) : undefined;
1991
+ const joinedInvocation = pendingInvocation ?? completedInvocation;
1992
+ if (joinedInvocation) {
1993
+ const cacheSignal = (0, _workunitasyncstorageexternal.getCacheSignal)(workUnitStore);
1994
+ cacheSignal == null ? void 0 : cacheSignal.beginRead();
1995
+ debug == null ? void 0 : debug('joining intra-request invocation', serializedCacheKey);
1996
+ const sharedCacheResult = await joinedInvocation;
1997
+ if (sharedCacheResult.type === 'prerender-dynamic') {
1998
+ debug == null ? void 0 : debug('joined invocation is prerender-dynamic', serializedCacheKey);
1999
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
2000
+ return sharedCacheResult.hangingPromise;
1317
2001
  }
1318
- if (shouldDiscardCacheEntry(entry, workStore, workUnitStore, implicitTags, implicitTagsExpiration)) {
1319
- debug == null ? void 0 : debug('discarding expired entry', cacheHandlerKey);
1320
- entry = undefined;
2002
+ // A completed entry may have been invalidated since it was produced, by
2003
+ // an `updateTag()` in a server action earlier in this request. The
2004
+ // implicit tags expiration is passed as 0 because it cannot apply to a
2005
+ // retained entry: it is memoized for the request, so re-checking it
2006
+ // against an unchanged entry timestamp only repeats the answer the leader
2007
+ // already got.
2008
+ const metadata = completedInvocation === undefined ? undefined : await sharedCacheResult.entry.pendingMetadata;
2009
+ if (metadata !== undefined && shouldDiscardCacheEntry(metadata, workStore, workUnitStore, implicitTags, 0)) {
2010
+ var _workStore_completedCacheInvocations1;
2011
+ debug == null ? void 0 : debug('discarding completed invocation', serializedCacheKey);
2012
+ (_workStore_completedCacheInvocations1 = workStore.completedCacheInvocations) == null ? void 0 : _workStore_completedCacheInvocations1.delete(serializedCacheKey);
2013
+ // This can take the signal's count to zero. The leader path below opens
2014
+ // a read again synchronously, before it awaits anything, which is what
2015
+ // stops a prerender from concluding that every cache read has settled
2016
+ // while a fill is still about to start.
2017
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
2018
+ } else {
2019
+ debug == null ? void 0 : debug('joined invocation resolved with cached entry', serializedCacheKey);
2020
+ stream = serveJoinedCacheEntry(sharedCacheResult.entry, serializedCacheKey, resumeDataCache, cacheContext, cacheSignal);
1321
2021
  }
1322
2022
  }
1323
- const currentTime = performance.timeOrigin + performance.now();
1324
- if (entry !== undefined && (entry.revalidate === 0 || entry.expire < _constants.DYNAMIC_EXPIRE)) {
1325
- switch(workUnitStore.type){
1326
- case 'prerender':
1327
- // In a Dynamic I/O prerender, if the cache entry has revalidate:
1328
- // 0 or if the expire time is under 5 minutes, then we consider
1329
- // this cache entry dynamic as it's not worth generating static
1330
- // pages for such data. It's better to leave a dynamic hole that
1331
- // can be filled in during the resume with a potentially cached
1332
- // entry.
1333
- if (entry.revalidate === 0) {
1334
- debug == null ? void 0 : debug('omitting entry', cacheHandlerKey, 'from static shell due to revalidate: 0');
2023
+ }
2024
+ // Leader path: no pending intra-request invocation found. Check for a
2025
+ // cross-request pending invocation, or become the leader for both.
2026
+ if (stream === undefined) {
2027
+ const resolvableSharedCacheResult = new ResolvableSharedCacheResult();
2028
+ debug == null ? void 0 : debug('registering as intra-request invocation leader', serializedCacheKey);
2029
+ const intraRequestPendingCacheInvocations = workStore.pendingCacheInvocations ??= new Map();
2030
+ // Retain the completed entry for the rest of the request where a later
2031
+ // invocation would otherwise repeat real work: private caches have no cache
2032
+ // handler to fall back on in production, and a platform- or config-supplied
2033
+ // handler may be remote, so a second `get` can be a round trip. A built-in
2034
+ // handler read is a map lookup, so retaining its entries would hold a
2035
+ // forked stream buffer for nothing.
2036
+ const completedCacheInvocations = isPrivate || !(0, _handlers.isBuiltInCacheHandler)(kind) ? workStore.completedCacheInvocations ??= new Map() : undefined;
2037
+ resolvableSharedCacheResult.registerIn(intraRequestPendingCacheInvocations, serializedCacheKey, completedCacheInvocations);
2038
+ // Cross-request deduplication lets concurrent requests for the same key
2039
+ // share a single fill. Private caches are skipped in production, where they
2040
+ // hold request-specific data that must not be shared across requests. In
2041
+ // development they're persisted and keyed by the request's cookies and
2042
+ // headers, so concurrent requests with identical request data should share
2043
+ // a fill too; that request-scoped `cacheHandlerKey` keeps requests with
2044
+ // different cookies or headers in separate entries.
2045
+ const skipCrossRequestDedupe = isPrivate && !process.env.__NEXT_DEV_SERVER;
2046
+ try {
2047
+ // The loop handles cross-request root param mismatches: when a
2048
+ // cross-request joiner discovers that the leader's root params differ
2049
+ // from its own, it retries with a recomputed cacheHandlerKey. The loop
2050
+ // exits when stream is assigned (cross-request joiner match or leader
2051
+ // path) or via early return (prerender-dynamic).
2052
+ while(stream === undefined){
2053
+ const crossRequestPendingCacheInvocation = skipCrossRequestDedupe ? undefined : crossRequestPendingCacheInvocations.get(cacheHandlerKey);
2054
+ if (crossRequestPendingCacheInvocation) {
2055
+ const cacheSignal = (0, _workunitasyncstorageexternal.getCacheSignal)(workUnitStore);
2056
+ cacheSignal == null ? void 0 : cacheSignal.beginRead();
2057
+ debug == null ? void 0 : debug('joining pending cross-request invocation', cacheHandlerKey);
2058
+ const sharedCacheResult = await crossRequestPendingCacheInvocation;
2059
+ if (sharedCacheResult.type === 'cached') {
2060
+ // Root param verification: wait for metadata, then check key. MUST
2061
+ // happen before fork() — if key mismatches, we retry without having
2062
+ // used the stream.
2063
+ const metadata = await sharedCacheResult.entry.pendingMetadata;
2064
+ // Ensure known root param names are up-to-date before verifying the
2065
+ // key, since the leader's save path may not have updated them yet
2066
+ // at this point.
2067
+ if (metadata.readRootParamNames) {
2068
+ addKnownRootParamNames(id, metadata.readRootParamNames);
2069
+ }
2070
+ const updatedRootParamNames = knownRootParamsByFunctionId.get(id);
2071
+ if (updatedRootParamNames && rootParams) {
2072
+ const newCacheHandlerKey = cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, updatedRootParamNames);
2073
+ if (newCacheHandlerKey !== cacheHandlerKey) {
2074
+ debug == null ? void 0 : debug('cross-request root param mismatch, retrying', cacheHandlerKey, '→', newCacheHandlerKey);
2075
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
2076
+ cacheHandlerKey = newCacheHandlerKey;
2077
+ continue; // stream is not used → retry with new key
2078
+ }
2079
+ }
2080
+ // Key matches — safe to fork.
2081
+ debug == null ? void 0 : debug('cross-request invocation matched, forking result', cacheHandlerKey);
2082
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
2083
+ stream = sharedCacheResult.entry.fork();
2084
+ maybePropagateCacheEntryMetadata(cacheContext, metadata);
2085
+ // The cross-request leader belongs to a different request with its
2086
+ // own RDC. Save to this request's RDC so its final prerender can
2087
+ // resume from the entry.
2088
+ saveSharedCacheEntryToResumeDataCache(serializedCacheKey, sharedCacheResult.entry, resumeDataCache);
2089
+ // Resolve for intra-request joiners in this request. They get
2090
+ // a fork from the same SharedCacheEntry.
2091
+ resolvableSharedCacheResult.resolve(sharedCacheResult);
2092
+ break;
1335
2093
  } else {
1336
- debug == null ? void 0 : debug('omitting entry', cacheHandlerKey, 'from static shell due to short expire value:', entry.expire);
2094
+ // prerender-dynamic — same root param check before hanging
2095
+ const updatedRootParamNames = knownRootParamsByFunctionId.get(id);
2096
+ if (updatedRootParamNames && rootParams) {
2097
+ const newCacheHandlerKey = cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, updatedRootParamNames);
2098
+ if (newCacheHandlerKey !== cacheHandlerKey) {
2099
+ debug == null ? void 0 : debug('cross-request root param mismatch, retrying', cacheHandlerKey, '→', newCacheHandlerKey);
2100
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
2101
+ cacheHandlerKey = newCacheHandlerKey;
2102
+ continue;
2103
+ }
2104
+ }
2105
+ debug == null ? void 0 : debug('cross-request invocation is prerender-dynamic', cacheHandlerKey);
2106
+ if (resumeDataCache == null ? void 0 : resumeDataCache.mutable) {
2107
+ resumeDataCache.dynamicCacheKeys.add(serializedCacheKey);
2108
+ }
2109
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
2110
+ resolvableSharedCacheResult.resolve(sharedCacheResult);
2111
+ return sharedCacheResult.hangingPromise;
1337
2112
  }
1338
- if (cacheSignal) {
1339
- cacheSignal.endRead();
2113
+ }
2114
+ // No pending cross-request invocation — become the leader.
2115
+ if (!skipCrossRequestDedupe) {
2116
+ debug == null ? void 0 : debug('registering as cross-request invocation leader', cacheHandlerKey);
2117
+ resolvableSharedCacheResult.registerIn(crossRequestPendingCacheInvocations, cacheHandlerKey);
2118
+ }
2119
+ const cacheSignal = (0, _workunitasyncstorageexternal.getCacheSignal)(workUnitStore);
2120
+ if (cacheSignal) {
2121
+ // Either the cache handler or the generation can be using I/O at this
2122
+ // point. We need to track when they start and when they complete.
2123
+ cacheSignal.beginRead();
2124
+ }
2125
+ const lazyRefreshTags = workStore.refreshTagsByCacheKind.get(kind);
2126
+ if (lazyRefreshTags && !(0, _lazyresult.isResolvedLazyResult)(lazyRefreshTags)) {
2127
+ await lazyRefreshTags;
2128
+ }
2129
+ let entry;
2130
+ // We ignore existing cache entries when force revalidating.
2131
+ if (cacheHandler && !shouldForceRevalidate(workStore, workUnitStore)) {
2132
+ entry = await cacheHandler.get(cacheHandlerKey, implicitTags);
2133
+ // Check if this is a redirect entry (coarse key → specific key).
2134
+ // Redirect entries have private tags encoding the root param names
2135
+ // (one tag per param name, prefixed with _N_RP_).
2136
+ if (entry && rootParams) {
2137
+ const paramNames = new Set();
2138
+ for (const tag of entry.tags){
2139
+ if (tag.startsWith(_constants1.NEXT_CACHE_ROOT_PARAM_TAG_ID)) {
2140
+ paramNames.add(tag.slice(_constants1.NEXT_CACHE_ROOT_PARAM_TAG_ID.length));
2141
+ }
2142
+ }
2143
+ if (paramNames.size > 0) {
2144
+ addKnownRootParamNames(id, paramNames);
2145
+ cacheHandlerKey = cacheHandlerKeyBase + computeRootParamsCacheKeySuffix(rootParams, paramNames);
2146
+ entry = await cacheHandler.get(cacheHandlerKey, implicitTags);
2147
+ }
1340
2148
  }
1341
- return (0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"');
1342
- case 'request':
1343
- {
1344
- if (process.env.NODE_ENV === 'development') {
1345
- // We delay the cache here so that it doesn't resolve in the static task --
1346
- // in a regular static prerender, it'd be a hanging promise, and we need to reflect that,
1347
- // so it has to resolve later.
1348
- // TODO(restart-on-cache-miss): Optimize this to avoid unnecessary restarts.
1349
- // We don't end the cache read here, so this will always appear as a cache miss in the static stage,
1350
- // and thus will cause a restart even if all caches are filled.
1351
- const stagedRendering = workUnitStore.stagedRendering;
1352
- const stage = stagedRendering ? (0, _dynamicrenderingutils.getRuntimeStage)(stagedRendering) : _stagedrendering.RenderStage.Runtime;
1353
- await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, workUnitStore, stage);
2149
+ }
2150
+ if (entry) {
2151
+ let implicitTagsExpiration = 0;
2152
+ if (workUnitStore.implicitTags) {
2153
+ const lazyExpiration = workUnitStore.implicitTags.expirationsByCacheKind.get(kind);
2154
+ if (lazyExpiration) {
2155
+ const expiration = (0, _lazyresult.isResolvedLazyResult)(lazyExpiration) ? lazyExpiration.value : await lazyExpiration;
2156
+ // If a cache handler returns an expiration time of Infinity, it
2157
+ // signals to Next.js that it handles checking cache entries for
2158
+ // staleness based on the expiration of the implicit tags passed
2159
+ // into the `get` method. In this case, we keep the default of 0,
2160
+ // which means that the implicit tags are not considered expired.
2161
+ if (expiration < Infinity) {
2162
+ implicitTagsExpiration = expiration;
2163
+ }
1354
2164
  }
1355
- break;
1356
2165
  }
1357
- case 'prerender-runtime':
1358
- case 'prerender-ppr':
1359
- case 'prerender-legacy':
1360
- case 'cache':
1361
- case 'private-cache':
1362
- case 'unstable-cache':
1363
- case 'generate-static-params':
1364
- break;
1365
- default:
1366
- workUnitStore;
1367
- }
1368
- }
1369
- if (entry === undefined || currentTime > entry.timestamp + entry.expire * 1000 || workStore.isStaticGeneration && currentTime > entry.timestamp + entry.revalidate * 1000) {
1370
- // Miss. Generate a new result.
1371
- // If the cache entry is stale and we're prerendering, we don't want to use the
1372
- // stale entry since it would unnecessarily need to shorten the lifetime of the
1373
- // prerender. We're not time constrained here so we can re-generated it now.
1374
- // We need to run this inside a clean AsyncLocalStorage snapshot so that the cache
1375
- // generation cannot read anything from the context we're currently executing which
1376
- // might include request specific things like cookies() inside a React.cache().
1377
- // Note: It is important that we await at least once before this because it lets us
1378
- // pop out of any stack specific contexts as well - aka "Sync" Local Storage.
1379
- if (entry) {
1380
- if (currentTime > entry.timestamp + entry.expire * 1000) {
1381
- debug == null ? void 0 : debug('entry is expired', cacheHandlerKey);
2166
+ if (shouldDiscardCacheEntry(entry, workStore, workUnitStore, implicitTags, implicitTagsExpiration)) {
2167
+ debug == null ? void 0 : debug('discarding expired entry', cacheHandlerKey);
2168
+ entry = undefined;
2169
+ }
1382
2170
  }
1383
- if (workStore.isStaticGeneration && currentTime > entry.timestamp + entry.revalidate * 1000) {
1384
- debug == null ? void 0 : debug('static generation, entry is stale', cacheHandlerKey);
2171
+ const currentTime = performance.timeOrigin + performance.now();
2172
+ if (entry !== undefined && (entry.revalidate === 0 || entry.expire < _constants.MIN_PRERENDERABLE_EXPIRE)) {
2173
+ switch(workUnitStore.type){
2174
+ case 'prerender':
2175
+ // In a Dynamic I/O prerender, if the cache entry has revalidate:
2176
+ // 0 or if the expire time is under 5 minutes, then we consider
2177
+ // this cache entry dynamic as it's not worth generating static
2178
+ // pages for such data. It's better to leave a dynamic hole that
2179
+ // can be filled in during the resume with a potentially cached
2180
+ // entry.
2181
+ if (entry.revalidate === 0) {
2182
+ debug == null ? void 0 : debug('omitting entry', cacheHandlerKey, 'from static shell due to revalidate: 0');
2183
+ } else {
2184
+ debug == null ? void 0 : debug('omitting entry', cacheHandlerKey, 'from static shell due to short expire value:', entry.expire);
2185
+ }
2186
+ if (cacheSignal) {
2187
+ cacheSignal.endRead();
2188
+ }
2189
+ // The entry is only excluded from *static* prerenders — the
2190
+ // 'prerender-runtime' case below serves it — so a runtime
2191
+ // prefetch would include this content.
2192
+ const hangingPromise = (0, _dynamicrenderingutils.makeRuntimeHangingPromise)(workUnitStore.renderSignal, workStore.route, 'dynamic "use cache"', workUnitStore);
2193
+ debug == null ? void 0 : debug('leader resolved as prerender-dynamic', cacheHandlerKey);
2194
+ resolvableSharedCacheResult.resolve({
2195
+ type: 'prerender-dynamic',
2196
+ hangingPromise
2197
+ });
2198
+ return hangingPromise;
2199
+ case 'request':
2200
+ {
2201
+ if (process.env.NODE_ENV === 'development') {
2202
+ // A short-lived entry is a dynamic hole, excluded from the
2203
+ // static shell, so we end the cache signal read here (the
2204
+ // prerender case does the same) to avoid this cache hit being
2205
+ // considered a cache miss when checking for pending cache reads
2206
+ // at staged rendering task boundaries. The value is deferred to
2207
+ // the runtime stage.
2208
+ if (cacheSignal && !cacheSignalReadEnded) {
2209
+ cacheSignal.endRead();
2210
+ cacheSignalReadEnded = true;
2211
+ }
2212
+ await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, workUnitStore, _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.sessionData);
2213
+ }
2214
+ break;
2215
+ }
2216
+ case 'prerender-runtime':
2217
+ case 'prerender-ppr':
2218
+ case 'prerender-legacy':
2219
+ case 'cache':
2220
+ case 'private-cache':
2221
+ case 'unstable-cache':
2222
+ case 'generate-static-params':
2223
+ break;
2224
+ default:
2225
+ workUnitStore;
2226
+ }
1385
2227
  }
1386
- }
1387
- const result = await generateCacheEntry(workStore, cacheContext, clientReferenceManifest, encodedCacheKeyParts, fn, timeoutError);
1388
- if (result.type === 'prerender-dynamic') {
1389
- return result.hangingPromise;
1390
- }
1391
- const { stream: newStream, pendingCacheResult } = result;
1392
- // When draft mode is enabled, we must not save the cache entry.
1393
- if (!workStore.isDraftMode) {
1394
- const savedCacheResult = saveToResumeDataCache(prerenderResumeDataCache, serializedCacheKey, pendingCacheResult);
1395
- if (cacheHandler) {
1396
- saveToCacheHandler(cacheHandler, workStore, id, serializedCacheKey, savedCacheResult, rootParams);
2228
+ if (entry !== undefined && entry.stale < _constants.MIN_SHELL_STALE) {
2229
+ switch(workUnitStore.type){
2230
+ case 'request':
2231
+ {
2232
+ // Same as the resume data cache read path: the entry's stale
2233
+ // time is short enough that it's excluded from shells, or, if
2234
+ // it's below `MIN_PREFETCHABLE_STALE`, from prerenders
2235
+ // entirely. A request store in `next start` never delays
2236
+ // caches — shells are produced by separate (runtime)
2237
+ // prerenders. In dev, the request render is also used to
2238
+ // recover shells, so we delay the entry here to match.
2239
+ if (process.env.NODE_ENV === 'development') {
2240
+ // End the cache signal read (once, in case the expire block
2241
+ // above already did) so the delayed value isn't counted as a
2242
+ // pending read at a staged rendering boundary.
2243
+ if (cacheSignal && !cacheSignalReadEnded) {
2244
+ cacheSignal.endRead();
2245
+ cacheSignalReadEnded = true;
2246
+ }
2247
+ // An unprefetchable entry is excluded from prerenders, so it
2248
+ // resolves in the dynamic stage. Otherwise, a dynamic request
2249
+ // generally recovers a static shell, so the entry can resolve
2250
+ // in the static link data stage. If we need to recover a
2251
+ // session shell instead, as indicated by `needsSessionShell`,
2252
+ // the entry must resolve after the session data stage that
2253
+ // the shell includes.
2254
+ let stage;
2255
+ if (entry.stale < _constants.MIN_PREFETCHABLE_STALE) {
2256
+ stage = _stagedrendering.RenderStage.Dynamic;
2257
+ } else if (workUnitStore.needsSessionShell) {
2258
+ stage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.runtimeLinkData;
2259
+ } else {
2260
+ stage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.staticLinkData;
2261
+ }
2262
+ await (0, _dynamicrenderingutils.makeDevtoolsIOAwarePromise)(undefined, workUnitStore, stage);
2263
+ }
2264
+ break;
2265
+ }
2266
+ case 'prerender':
2267
+ case 'prerender-runtime':
2268
+ case 'prerender-ppr':
2269
+ case 'prerender-legacy':
2270
+ case 'cache':
2271
+ case 'private-cache':
2272
+ case 'unstable-cache':
2273
+ case 'generate-static-params':
2274
+ break;
2275
+ default:
2276
+ workUnitStore;
2277
+ }
1397
2278
  }
1398
- }
1399
- stream = newStream;
1400
- } else {
1401
- // If we have an entry at this point, this can't be a private cache
1402
- // entry.
1403
- if (cacheContext.kind === 'private') {
1404
- throw Object.defineProperty(new _invarianterror.InvariantError(`A private cache entry must not be retrieved from the cache handler.`), "__NEXT_ERROR_CODE", {
1405
- value: "E749",
1406
- enumerable: false,
1407
- configurable: true
1408
- });
1409
- }
1410
- maybePropagateCacheEntryMetadata(cacheContext, entry, knownRootParamsByFunctionId.get(id));
1411
- // We want to return this stream, even if it's stale.
1412
- stream = entry.value;
1413
- // If we have a resume data cache, we need to clone the entry and add it
1414
- // to the resume data cache.
1415
- if (prerenderResumeDataCache) {
1416
- const [entryLeft, entryRight] = cloneCacheEntry(entry);
1417
- if (cacheSignal) {
1418
- stream = createTrackedReadableStream(entryLeft.value, cacheSignal);
2279
+ if (entry === undefined || // In dev, the built-in default handler retains a short-`expire` entry
2280
+ // for at least `MIN_PRERENDERABLE_EXPIRE`, both when used directly
2281
+ // and when fronting a custom cache handler. Apply that same minimum
2282
+ // here so the retained entry is served and re-warmed in the
2283
+ // background (below), rather than blocking to regenerate it on every
2284
+ // read. The entry's real `expire` is untouched, so staging still
2285
+ // treats it as dynamic.
2286
+ currentTime > entry.timestamp + (process.env.__NEXT_DEV_SERVER ? Math.max(entry.expire, _constants.MIN_PRERENDERABLE_EXPIRE) : entry.expire) * 1000 || workStore.isStaticGeneration && currentTime > entry.timestamp + entry.revalidate * 1000) {
2287
+ // Miss. Generate a new result.
2288
+ // If the cache entry is stale and we're prerendering, we don't want
2289
+ // to use the stale entry since it would unnecessarily need to shorten
2290
+ // the lifetime of the prerender. We're not time constrained here so
2291
+ // we can re-generated it now.
2292
+ // We need to run this inside a clean AsyncLocalStorage snapshot so
2293
+ // that the cache generation cannot read anything from the context
2294
+ // we're currently executing which might include request specific
2295
+ // things like cookies() inside a React.cache().
2296
+ // Note: It is important that we await at least once before this
2297
+ // because it lets us pop out of any stack specific contexts as well -
2298
+ // aka "Sync" Local Storage.
2299
+ if (entry) {
2300
+ if (currentTime > entry.timestamp + entry.expire * 1000) {
2301
+ debug == null ? void 0 : debug('entry is expired', cacheHandlerKey);
2302
+ }
2303
+ if (workStore.isStaticGeneration && currentTime > entry.timestamp + entry.revalidate * 1000) {
2304
+ debug == null ? void 0 : debug('static generation, entry is stale', cacheHandlerKey);
2305
+ }
2306
+ }
2307
+ if (cacheSignal && cacheSignalReadEnded) {
2308
+ // A short-lived deferral above (a `revalidate` of zero or a short
2309
+ // expire, or a short stale time) already ended this read. We're now
2310
+ // regenerating the entry rather than serving it, and the generation
2311
+ // ends the read again once its entry is collected. Re-begin the
2312
+ // read here so the trailing `endRead` stays balanced instead of
2313
+ // over-decrementing the cache signal.
2314
+ cacheSignal.beginRead();
2315
+ cacheSignalReadEnded = false;
2316
+ }
2317
+ const result = await generateCacheEntry(workStore, cacheContext, clientReferenceManifest, encodedCacheKeyParts, fn, timeoutError, deadlockError);
2318
+ if (result.type === 'prerender-dynamic') {
2319
+ debug == null ? void 0 : debug('leader resolved as prerender-dynamic (generation)', cacheHandlerKey);
2320
+ if (resumeDataCache == null ? void 0 : resumeDataCache.mutable) {
2321
+ resumeDataCache.dynamicCacheKeys.add(serializedCacheKey);
2322
+ }
2323
+ resolvableSharedCacheResult.resolve(result);
2324
+ return result.hangingPromise;
2325
+ }
2326
+ const { stream: newStream, pendingCacheResult } = result;
2327
+ // Cross-request joiners derive their metadata from this promise. By
2328
+ // default it's the collected result, but when we write to a cache
2329
+ // handler we swap in a promise that resolves only after the write has
2330
+ // landed, so a joiner that re-reads its recomputed key finds the
2331
+ // entry.
2332
+ let metadataSource = pendingCacheResult;
2333
+ // When draft mode is enabled, we must not save the cache entry.
2334
+ if (!workStore.isDraftMode) {
2335
+ const savedCacheResult = saveToResumeDataCache(resumeDataCache, serializedCacheKey, pendingCacheResult);
2336
+ if (cacheHandler) {
2337
+ metadataSource = saveToCacheHandler(cacheHandler, workStore, id, cacheHandlerKeyBase, savedCacheResult, rootParams);
2338
+ }
2339
+ }
2340
+ debug == null ? void 0 : debug('leader resolved with generated entry', cacheHandlerKey);
2341
+ const pendingMetadata = metadataSource.then((collected)=>({
2342
+ tags: collected.entry.tags,
2343
+ revalidate: collected.entry.revalidate,
2344
+ expire: collected.entry.expire,
2345
+ stale: collected.entry.stale,
2346
+ timestamp: collected.entry.timestamp,
2347
+ hasExplicitRevalidate: collected.hasExplicitRevalidate,
2348
+ hasExplicitExpire: collected.hasExplicitExpire,
2349
+ readRootParamNames: collected.readRootParamNames,
2350
+ dynamicNestedCacheError: collected.dynamicNestedCacheError
2351
+ }));
2352
+ const sharedCacheEntry = new SharedCacheEntry(newStream, pendingMetadata);
2353
+ stream = sharedCacheEntry.fork();
2354
+ resolvableSharedCacheResult.resolve({
2355
+ type: 'cached',
2356
+ entry: sharedCacheEntry
2357
+ });
1419
2358
  } else {
1420
- stream = entryLeft.value;
1421
- }
1422
- // The RDC is per-page and root params are fixed within a page, so we
1423
- // always use the coarse key (without root param suffix).
1424
- prerenderResumeDataCache.cache.set(serializedCacheKey, Promise.resolve({
1425
- entry: entryRight,
1426
- // For pre-existing entries from cache handlers we don't know
1427
- // whether they had explicit cache life values or not. But we only
1428
- // need this information during prerendering when we produce new
1429
- // entries, where the cache life of an inner cache may be propagated
1430
- // to the outer one. In that case we use the RDC. So it's safe to
1431
- // set this to undefined here.
1432
- hasExplicitRevalidate: undefined,
1433
- hasExplicitExpire: undefined,
1434
- readRootParamNames: knownRootParamNames
1435
- }));
1436
- } else {
1437
- // If we're not regenerating we need to signal that we've finished
1438
- // putting the entry into the cache scope at this point. Otherwise we do
1439
- // that inside generateCacheEntry.
1440
- cacheSignal == null ? void 0 : cacheSignal.endRead();
1441
- }
1442
- if (currentTime > entry.timestamp + entry.revalidate * 1000) {
1443
- // If this is stale, and we're not in a prerender (i.e. this is
1444
- // dynamic render), then we should warm up the cache with a fresh
1445
- // revalidated entry.
1446
- const result = await generateCacheEntry(workStore, // The background revalidation preserves the outer store for reading
1447
- // (e.g. implicitTags) but skips propagation of cache life and tags
1448
- // back to the outer scope.
1449
- {
1450
- kind: cacheContext.kind,
1451
- outerWorkUnitStore: cacheContext.outerWorkUnitStore,
1452
- skipPropagation: true
1453
- }, clientReferenceManifest, encodedCacheKeyParts, fn, timeoutError);
1454
- if (result.type === 'cached') {
1455
- const { stream: ignoredStream, pendingCacheResult } = result;
1456
- const savedCacheResult = saveToResumeDataCache(prerenderResumeDataCache, serializedCacheKey, pendingCacheResult);
1457
- if (cacheHandler) {
1458
- saveToCacheHandler(cacheHandler, workStore, id, serializedCacheKey, savedCacheResult, rootParams);
2359
+ const entryMetadata = {
2360
+ tags: entry.tags,
2361
+ revalidate: entry.revalidate,
2362
+ expire: entry.expire,
2363
+ stale: entry.stale,
2364
+ timestamp: entry.timestamp,
2365
+ readRootParamNames: knownRootParamsByFunctionId.get(id),
2366
+ // For pre-existing entries from cache handlers we don't know
2367
+ // whether they had explicit cache life values or not. But we only
2368
+ // need this information during prerendering when we produce new
2369
+ // entries, where the cache life of an inner cache may be propagated
2370
+ // to the outer one. In that case we use the RDC. So it's safe to
2371
+ // set this to undefined here.
2372
+ hasExplicitRevalidate: undefined,
2373
+ hasExplicitExpire: undefined,
2374
+ // The same applies to the dynamic nested cache error.
2375
+ dynamicNestedCacheError: undefined
2376
+ };
2377
+ maybePropagateCacheEntryMetadata(cacheContext, entryMetadata);
2378
+ // We want to return this stream, even if it's stale.
2379
+ stream = entry.value;
2380
+ // If we have a mutable resume data cache, we need to clone the entry
2381
+ // and add it to the resume data cache.
2382
+ if (resumeDataCache == null ? void 0 : resumeDataCache.mutable) {
2383
+ const [entryLeft, entryRight] = (0, _clonecacheentry.cloneCacheEntry)(entry);
2384
+ if (cacheSignal && !cacheSignalReadEnded) {
2385
+ stream = createTrackedReadableStream(entryLeft.value, cacheSignal);
2386
+ } else {
2387
+ // The read was already ended for a short-lived deferral (or there
2388
+ // is no cacheSignal), so serve a plain stream.
2389
+ stream = entryLeft.value;
2390
+ }
2391
+ // The RDC is per-page and root params are fixed within a page, so
2392
+ // we always use the coarse key (without root param suffix).
2393
+ resumeDataCache.cache.set(serializedCacheKey, Promise.resolve({
2394
+ entry: entryRight,
2395
+ hasExplicitRevalidate: entryMetadata.hasExplicitRevalidate,
2396
+ hasExplicitExpire: entryMetadata.hasExplicitExpire,
2397
+ readRootParamNames: entryMetadata.readRootParamNames,
2398
+ dynamicNestedCacheError: entryMetadata.dynamicNestedCacheError
2399
+ }));
2400
+ } else if (!cacheSignalReadEnded) {
2401
+ // If we're not regenerating we need to signal that we've finished
2402
+ // putting the entry into the cache scope at this point. Otherwise
2403
+ // we do that inside generateCacheEntry. (Skipped when the read was
2404
+ // already ended for a short-lived deferral.)
2405
+ cacheSignal == null ? void 0 : cacheSignal.endRead();
2406
+ }
2407
+ debug == null ? void 0 : debug('leader resolved with cache handler hit', cacheHandlerKey);
2408
+ const sharedCacheEntry = new SharedCacheEntry(stream, Promise.resolve(entryMetadata));
2409
+ stream = sharedCacheEntry.fork();
2410
+ resolvableSharedCacheResult.resolve({
2411
+ type: 'cached',
2412
+ entry: sharedCacheEntry
2413
+ });
2414
+ // Trigger a background revalidation when the entry is stale (past its
2415
+ // `revalidate`), so the next read gets a fresh value without blocking
2416
+ // this one. Development additionally re-warms on every dynamic
2417
+ // request render in two cases where the dev in-memory entry would
2418
+ // otherwise read back as fresh, so a subsequent reload still shows a
2419
+ // fresh value. The first is with the in-memory cache disabled
2420
+ // (`cacheMaxMemorySize: 0`), where built-in entries keep their
2421
+ // resolved (potentially non-dynamic) cache life. The second is a
2422
+ // short-`expire` entry (an explicit dynamic or client-only cache,
2423
+ // e.g. `cacheLife({ expire: 0 })`), which is retained for at least
2424
+ // `MIN_PRERENDERABLE_EXPIRE` so it is served from the cache; this
2425
+ // also covers custom handlers, re-executing and writing through to
2426
+ // the backing.
2427
+ let shouldTriggerBackgroundRevalidation = currentTime > entry.timestamp + entry.revalidate * 1000;
2428
+ if (!shouldTriggerBackgroundRevalidation && process.env.__NEXT_DEV_SERVER && (entry.expire < _constants.MIN_PRERENDERABLE_EXPIRE || (0, _handlers.isMemoryCacheDisabled)() && !(0, _handlers.isCustomCacheHandler)(kind))) {
2429
+ switch(workUnitStore.type){
2430
+ case 'request':
2431
+ shouldTriggerBackgroundRevalidation = true;
2432
+ break;
2433
+ case 'cache':
2434
+ case 'private-cache':
2435
+ case 'prerender':
2436
+ case 'prerender-runtime':
2437
+ case 'prerender-ppr':
2438
+ case 'prerender-legacy':
2439
+ case 'unstable-cache':
2440
+ case 'generate-static-params':
2441
+ break;
2442
+ default:
2443
+ workUnitStore;
2444
+ }
2445
+ }
2446
+ if (shouldTriggerBackgroundRevalidation) {
2447
+ const revalidateCacheHandlerKey = cacheHandlerKey;
2448
+ const revalidatePromise = generateCacheEntry(workStore, // The background revalidation preserves the outer store for
2449
+ // reading (e.g. implicitTags) but skips propagation of cache life
2450
+ // and tags back to the outer scope.
2451
+ {
2452
+ ...cacheContext,
2453
+ skipPropagation: true
2454
+ }, clientReferenceManifest, encodedCacheKeyParts, fn, timeoutError, deadlockError).then(async (result)=>{
2455
+ if (result.type === 'cached') {
2456
+ const { stream: ignoredStream, pendingCacheResult } = result;
2457
+ const savedCacheResult = saveToResumeDataCache(resumeDataCache, serializedCacheKey, pendingCacheResult);
2458
+ if (cacheHandler) {
2459
+ saveToCacheHandler(cacheHandler, workStore, id, cacheHandlerKeyBase, savedCacheResult, rootParams);
2460
+ }
2461
+ await ignoredStream.cancel();
2462
+ }
2463
+ }).catch((error)=>{
2464
+ debug == null ? void 0 : debug('background cache revalidation failed for', revalidateCacheHandlerKey, error);
2465
+ });
2466
+ workStore.pendingRevalidateWrites ??= [];
2467
+ workStore.pendingRevalidateWrites.push(revalidatePromise);
1459
2468
  }
1460
- await ignoredStream.cancel();
1461
2469
  }
1462
2470
  }
2471
+ } catch (error) {
2472
+ resolvableSharedCacheResult.reject(error);
2473
+ throw error;
1463
2474
  }
1464
2475
  }
1465
2476
  // Logs are replayed even if it's a hit - to ensure we see them on the client eventually.
@@ -1557,20 +2568,26 @@ function shouldDiscardCacheEntry(entry, workStore, workUnitStore, implicitTags,
1557
2568
  }
1558
2569
  // If the cache entry contains revalidated tags that the cache handler might
1559
2570
  // not know about yet, we need to discard it.
1560
- if (entry.tags.some((tag)=>isRecentlyRevalidatedTag(tag, workStore))) {
2571
+ if (entry.tags.some((tag)=>isRevalidatedAfter(tag, entry.timestamp, workStore))) {
1561
2572
  return true;
1562
2573
  }
1563
2574
  // Finally, if any of the implicit tags have been revalidated recently, we
1564
2575
  // also need to discard the cache entry.
1565
- if (implicitTags.some((tag)=>isRecentlyRevalidatedTag(tag, workStore))) {
2576
+ if (implicitTags.some((tag)=>isRevalidatedAfter(tag, entry.timestamp, workStore))) {
1566
2577
  return true;
1567
2578
  }
1568
2579
  return false;
1569
2580
  }
1570
- function isRecentlyRevalidatedTag(tag, workStore) {
1571
- const { previouslyRevalidatedTags, pendingRevalidatedTags } = workStore;
2581
+ /**
2582
+ * Whether `tag` was revalidated after an entry created at `entryTimestamp`,
2583
+ * which makes that entry stale. An entry produced after the revalidation
2584
+ * already reflects it and is still usable.
2585
+ */ function isRevalidatedAfter(tag, entryTimestamp, workStore) {
2586
+ const { previouslyRevalidatedTags, pendingRevalidatedTags, requestStartTime } = workStore;
1572
2587
  // Was the tag previously revalidated (e.g. by a redirecting server action)?
1573
- if (previouslyRevalidatedTags.includes(tag)) {
2588
+ // That happened in an earlier request and carries no timestamp of its own, so
2589
+ // it counts as having happened when this request started.
2590
+ if (entryTimestamp <= requestStartTime && previouslyRevalidatedTags.includes(tag)) {
1574
2591
  debug == null ? void 0 : debug('tag', tag, 'was previously revalidated');
1575
2592
  return true;
1576
2593
  }
@@ -1578,7 +2595,7 @@ function isRecentlyRevalidatedTag(tag, workStore) {
1578
2595
  // In this case the revalidation might not have been fully propagated by a
1579
2596
  // remote cache handler yet, so we read it from the pending tags in the work
1580
2597
  // store.
1581
- if (pendingRevalidatedTags == null ? void 0 : pendingRevalidatedTags.some((item)=>item.tag === tag)) {
2598
+ if (pendingRevalidatedTags == null ? void 0 : pendingRevalidatedTags.some((item)=>item.tag === tag && item.revalidatedAt > entryTimestamp)) {
1582
2599
  debug == null ? void 0 : debug('tag', tag, 'was just revalidated');
1583
2600
  return true;
1584
2601
  }