vinext 1.0.0-beta.4 → 1.0.0-beta.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 (460) hide show
  1. package/README.md +44 -3
  2. package/dist/build/client-build-config.d.ts +0 -1
  3. package/dist/build/css-url-assets.d.ts +0 -1
  4. package/dist/build/google-fonts/build-url.d.ts +5 -2
  5. package/dist/build/google-fonts/font-metadata.d.ts +7 -3
  6. package/dist/build/google-fonts/get-axes.d.ts +0 -1
  7. package/dist/build/layout-classification.d.ts +7 -4
  8. package/dist/build/next-client-runtime-manifests.d.ts +0 -1
  9. package/dist/build/next-client-runtime-manifests.js +2 -19
  10. package/dist/build/nitro-route-rules.d.ts +0 -1
  11. package/dist/build/pages-client-assets-module.d.ts +0 -1
  12. package/dist/build/precompress.d.ts +7 -2
  13. package/dist/build/precompress.js +41 -7
  14. package/dist/build/prerender-paths.d.ts +2 -2
  15. package/dist/build/prerender-paths.js +3 -4
  16. package/dist/build/prerender-phase.d.ts +15 -0
  17. package/dist/build/prerender-phase.js +37 -0
  18. package/dist/build/prerender-server-entry.d.ts +1 -1
  19. package/dist/build/prerender-server-entry.js +3 -3
  20. package/dist/build/prerender-server-pool.d.ts +4 -2
  21. package/dist/build/prerender-server-pool.js +2 -0
  22. package/dist/build/prerender.d.ts +40 -33
  23. package/dist/build/prerender.js +99 -18
  24. package/dist/build/public-dir-conflict.d.ts +14 -0
  25. package/dist/build/public-dir-conflict.js +25 -0
  26. package/dist/build/report.d.ts +2 -2
  27. package/dist/build/route-classification-injector.d.ts +0 -1
  28. package/dist/build/route-classification-manifest.d.ts +5 -3
  29. package/dist/build/run-prerender.d.ts +3 -2
  30. package/dist/build/run-prerender.js +9 -6
  31. package/dist/build/static-export.d.ts +23 -12
  32. package/dist/cache/cache-adapters-virtual.d.ts +5 -2
  33. package/dist/check.js +4 -4
  34. package/dist/cli-dev-config.d.ts +0 -1
  35. package/dist/cli.d.ts +1 -1
  36. package/dist/client/client-rewrite-matcher.d.ts +12 -0
  37. package/dist/client/client-rewrite-matcher.js +20 -0
  38. package/dist/client/client-rewrites.d.ts +31 -0
  39. package/dist/client/client-rewrites.js +41 -0
  40. package/dist/client/dev-error-overlay.d.ts +0 -1
  41. package/dist/client/empty-module.d.ts +1 -1
  42. package/dist/client/index.d.ts +2 -0
  43. package/dist/client/index.js +2 -0
  44. package/dist/client/instrumentation-client-state.d.ts +0 -1
  45. package/dist/client/navigation-runtime.d.ts +6 -1
  46. package/dist/client/navigation-runtime.js +5 -1
  47. package/dist/client/pages-router-link-navigation.d.ts +3 -21
  48. package/dist/client/react-instance-bootstrap.d.ts +1 -0
  49. package/dist/client/react-instance-bootstrap.js +7 -0
  50. package/dist/client/react-instance.d.ts +13 -0
  51. package/dist/client/react-instance.js +20 -0
  52. package/dist/client/vinext-next-data.d.ts +13 -6
  53. package/dist/client/window-next.d.ts +5 -2
  54. package/dist/config/config-matchers.d.ts +3 -5
  55. package/dist/config/config-matchers.js +7 -6
  56. package/dist/config/dotenv.d.ts +1 -5
  57. package/dist/config/next-config.d.ts +113 -54
  58. package/dist/config/next-config.js +27 -7
  59. package/dist/config/prerender.d.ts +0 -1
  60. package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +808 -0
  61. package/dist/entries/app-browser-entry.d.ts +0 -1
  62. package/dist/entries/app-browser-entry.js +8 -3
  63. package/dist/entries/app-rsc-entry.d.ts +30 -16
  64. package/dist/entries/app-rsc-entry.js +48 -10
  65. package/dist/entries/app-rsc-manifest.d.ts +0 -1
  66. package/dist/entries/app-rsc-manifest.js +1 -0
  67. package/dist/entries/pages-client-entry.d.ts +0 -1
  68. package/dist/entries/pages-client-entry.js +15 -5
  69. package/dist/entries/pages-server-entry.d.ts +1 -2
  70. package/dist/entries/pages-server-entry.js +21 -5
  71. package/dist/image/image-adapters-virtual.d.ts +4 -2
  72. package/dist/index.d.ts +0 -1
  73. package/dist/index.js +328 -227
  74. package/dist/init-cloudflare.d.ts +0 -1
  75. package/dist/init-platform.d.ts +0 -1
  76. package/dist/init.d.ts +40 -20
  77. package/dist/plugins/ast-scope.d.ts +0 -1
  78. package/dist/plugins/async-hooks-stub.d.ts +0 -1
  79. package/dist/plugins/client-reference-dedup.d.ts +0 -1
  80. package/dist/plugins/css-data-url.d.ts +0 -1
  81. package/dist/plugins/css-module-imports.d.ts +0 -1
  82. package/dist/plugins/dynamic-preload-metadata.d.ts +0 -1
  83. package/dist/plugins/extensionless-dynamic-import.d.ts +0 -1
  84. package/dist/plugins/extensionless-dynamic-import.js +352 -13
  85. package/dist/plugins/fonts.d.ts +0 -1
  86. package/dist/plugins/ignore-dynamic-requests.d.ts +0 -1
  87. package/dist/plugins/ignore-dynamic-requests.js +28 -4
  88. package/dist/plugins/import-meta-url.d.ts +0 -1
  89. package/dist/plugins/instrumentation-client.d.ts +0 -1
  90. package/dist/plugins/middleware-server-only.d.ts +0 -1
  91. package/dist/plugins/og-asset-ownership.d.ts +0 -1
  92. package/dist/plugins/og-assets.d.ts +0 -1
  93. package/dist/plugins/optimize-imports.d.ts +0 -1
  94. package/dist/plugins/pages-node-externals.d.ts +23 -0
  95. package/dist/plugins/pages-node-externals.js +206 -0
  96. package/dist/plugins/remove-console.d.ts +0 -1
  97. package/dist/plugins/require-context.d.ts +0 -1
  98. package/dist/plugins/require-context.js +143 -26
  99. package/dist/plugins/rsc-client-reference-loaders.d.ts +0 -1
  100. package/dist/plugins/rsc-reference-validation-normalizer.d.ts +0 -1
  101. package/dist/plugins/sass.d.ts +30 -2
  102. package/dist/plugins/sass.js +64 -1
  103. package/dist/plugins/server-externals-manifest.d.ts +0 -1
  104. package/dist/plugins/strip-server-exports.d.ts +0 -1
  105. package/dist/plugins/styled-jsx.d.ts +0 -1
  106. package/dist/plugins/transitive-externals.d.ts +24 -0
  107. package/dist/plugins/transitive-externals.js +121 -0
  108. package/dist/plugins/typeof-window.d.ts +11 -1
  109. package/dist/plugins/typeof-window.js +141 -13
  110. package/dist/plugins/use-cache-callable.d.ts +12 -0
  111. package/dist/plugins/use-cache-callable.js +209 -0
  112. package/dist/plugins/wasm-module-import.d.ts +0 -1
  113. package/dist/routing/app-route-graph.d.ts +115 -56
  114. package/dist/routing/app-route-graph.js +2 -1
  115. package/dist/routing/app-router.d.ts +0 -1
  116. package/dist/routing/pages-router.d.ts +9 -5
  117. package/dist/routing/route-matching.d.ts +0 -1
  118. package/dist/routing/utils.d.ts +1 -23
  119. package/dist/routing/utils.js +1 -30
  120. package/dist/server/accept-encoding.d.ts +0 -1
  121. package/dist/server/api-handler.d.ts +0 -1
  122. package/dist/server/api-handler.js +1 -1
  123. package/dist/server/app-bfcache-identity.d.ts +9 -10
  124. package/dist/server/app-bfcache-identity.js +27 -128
  125. package/dist/server/app-browser-action-result.d.ts +0 -1
  126. package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -1
  127. package/dist/server/app-browser-entry.d.ts +1 -1
  128. package/dist/server/app-browser-entry.js +46 -30
  129. package/dist/server/app-browser-history-controller.d.ts +8 -5
  130. package/dist/server/app-browser-hydration.d.ts +0 -1
  131. package/dist/server/app-browser-interception-context.d.ts +0 -1
  132. package/dist/server/app-browser-mpa-navigation.d.ts +0 -1
  133. package/dist/server/app-browser-navigation-controller.d.ts +2 -5
  134. package/dist/server/app-browser-popstate.d.ts +0 -1
  135. package/dist/server/app-browser-prefetch-response.d.ts +17 -1
  136. package/dist/server/app-browser-prefetch-response.js +23 -1
  137. package/dist/server/app-browser-server-action-client.d.ts +1 -1
  138. package/dist/server/app-browser-server-action-client.js +3 -2
  139. package/dist/server/app-browser-server-action-navigation.d.ts +0 -1
  140. package/dist/server/app-browser-state.d.ts +4 -3
  141. package/dist/server/app-browser-state.js +2 -4
  142. package/dist/server/app-browser-stream.d.ts +0 -1
  143. package/dist/server/app-browser-visible-commit.d.ts +1 -1
  144. package/dist/server/app-browser-visible-commit.js +6 -2
  145. package/dist/server/app-elements-wire.d.ts +16 -13
  146. package/dist/server/app-elements-wire.js +37 -10
  147. package/dist/server/app-elements.d.ts +2 -3
  148. package/dist/server/app-elements.js +2 -2
  149. package/dist/server/app-fallback-renderer.d.ts +8 -4
  150. package/dist/server/app-fallback-renderer.js +2 -1
  151. package/dist/server/app-history-state.d.ts +2 -2
  152. package/dist/server/app-history-state.js +1 -1
  153. package/dist/server/app-hook-warning-suppression.d.ts +0 -1
  154. package/dist/server/app-layout-param-observation.d.ts +0 -1
  155. package/dist/server/app-layout-param-observation.js +1 -1
  156. package/dist/server/app-middleware.d.ts +5 -1
  157. package/dist/server/app-middleware.js +96 -31
  158. package/dist/server/app-optimistic-routing.d.ts +1 -0
  159. package/dist/server/app-page-boundary-render.d.ts +8 -4
  160. package/dist/server/app-page-boundary-render.js +4 -7
  161. package/dist/server/app-page-cache-finalizer.d.ts +3 -3
  162. package/dist/server/app-page-cache-finalizer.js +45 -19
  163. package/dist/server/app-page-cache-render.d.ts +3 -2
  164. package/dist/server/app-page-cache-render.js +5 -2
  165. package/dist/server/app-page-cache.d.ts +3 -4
  166. package/dist/server/app-page-cache.js +33 -15
  167. package/dist/server/app-page-dispatch.d.ts +11 -5
  168. package/dist/server/app-page-dispatch.js +11 -6
  169. package/dist/server/app-page-element-builder.d.ts +61 -19
  170. package/dist/server/app-page-element-builder.js +113 -43
  171. package/dist/server/app-page-execution.d.ts +12 -5
  172. package/dist/server/app-page-execution.js +20 -7
  173. package/dist/server/app-page-head.d.ts +2 -2
  174. package/dist/server/app-page-http-access-fallback-metadata.d.ts +2 -2
  175. package/dist/server/app-page-params.d.ts +0 -1
  176. package/dist/server/app-page-ppr-runtime.d.ts +0 -1
  177. package/dist/server/app-page-probe.d.ts +4 -3
  178. package/dist/server/app-page-probe.js +1 -1
  179. package/dist/server/app-page-render-identity.d.ts +1 -0
  180. package/dist/server/app-page-render-observation.d.ts +0 -1
  181. package/dist/server/app-page-render.d.ts +6 -4
  182. package/dist/server/app-page-render.js +53 -25
  183. package/dist/server/app-page-request.d.ts +3 -1
  184. package/dist/server/app-page-request.js +3 -34
  185. package/dist/server/app-page-response.d.ts +13 -3
  186. package/dist/server/app-page-response.js +17 -11
  187. package/dist/server/app-page-route-wiring.d.ts +27 -5
  188. package/dist/server/app-page-route-wiring.js +110 -58
  189. package/dist/server/app-page-search-params-observation.d.ts +0 -1
  190. package/dist/server/app-page-segment-plan.d.ts +56 -0
  191. package/dist/server/app-page-segment-plan.js +177 -0
  192. package/dist/server/app-page-segment-state.d.ts +18 -2
  193. package/dist/server/app-page-segment-state.js +23 -4
  194. package/dist/server/app-page-stream.d.ts +31 -10
  195. package/dist/server/app-page-stream.js +10 -3
  196. package/dist/server/app-pages-bridge.d.ts +0 -1
  197. package/dist/server/app-pages-bridge.js +12 -1
  198. package/dist/server/app-post-middleware-context.d.ts +0 -1
  199. package/dist/server/app-ppr-fallback-shell-render.d.ts +0 -1
  200. package/dist/server/app-prerender-endpoints.d.ts +1 -1
  201. package/dist/server/app-prerender-endpoints.js +12 -0
  202. package/dist/server/app-prerender-static-params.d.ts +0 -1
  203. package/dist/server/app-render-dependency.d.ts +11 -4
  204. package/dist/server/app-render-dependency.js +59 -9
  205. package/dist/server/app-request-context.d.ts +1 -0
  206. package/dist/server/app-response-header-provenance.d.ts +13 -0
  207. package/dist/server/app-response-header-provenance.js +26 -0
  208. package/dist/server/app-route-handler-cache.d.ts +3 -2
  209. package/dist/server/app-route-handler-cache.js +7 -3
  210. package/dist/server/app-route-handler-dispatch.d.ts +0 -1
  211. package/dist/server/app-route-handler-dispatch.js +4 -2
  212. package/dist/server/app-route-handler-execution.d.ts +2 -2
  213. package/dist/server/app-route-handler-execution.js +15 -7
  214. package/dist/server/app-route-handler-policy.d.ts +1 -1
  215. package/dist/server/app-route-handler-response.d.ts +3 -2
  216. package/dist/server/app-route-handler-response.js +15 -5
  217. package/dist/server/app-route-handler-runtime.d.ts +1 -2
  218. package/dist/server/app-route-handler-runtime.js +218 -85
  219. package/dist/server/app-route-module-loader.d.ts +32 -6
  220. package/dist/server/app-route-module-loader.js +73 -3
  221. package/dist/server/app-route-request-built-ins.d.ts +16 -0
  222. package/dist/server/app-route-request-built-ins.js +41 -0
  223. package/dist/server/app-router-entry.d.ts +0 -1
  224. package/dist/server/app-router-entry.js +4 -4
  225. package/dist/server/app-rsc-cache-busting.d.ts +2 -1
  226. package/dist/server/app-rsc-cache-busting.js +24 -16
  227. package/dist/server/app-rsc-handler.d.ts +9 -2
  228. package/dist/server/app-rsc-handler.js +176 -47
  229. package/dist/server/app-rsc-redirect-flight.d.ts +0 -1
  230. package/dist/server/app-rsc-request-normalization.d.ts +19 -10
  231. package/dist/server/app-rsc-response-finalizer.d.ts +7 -2
  232. package/dist/server/app-rsc-response-finalizer.js +34 -18
  233. package/dist/server/app-rsc-route-matching.d.ts +6 -1
  234. package/dist/server/app-rsc-route-matching.js +47 -2
  235. package/dist/server/app-rsc-state-fingerprint.d.ts +14 -0
  236. package/dist/server/app-rsc-state-fingerprint.js +13 -0
  237. package/dist/server/app-segment-config.d.ts +0 -1
  238. package/dist/server/app-server-action-execution.d.ts +41 -8
  239. package/dist/server/app-server-action-execution.js +191 -113
  240. package/dist/server/app-ssr-entry.d.ts +11 -3
  241. package/dist/server/app-ssr-entry.js +19 -8
  242. package/dist/server/app-ssr-router-instance.d.ts +0 -1
  243. package/dist/server/app-ssr-stream.d.ts +13 -2
  244. package/dist/server/app-ssr-stream.js +30 -5
  245. package/dist/server/app-static-generation.d.ts +0 -1
  246. package/dist/server/app-visited-response-cache.d.ts +1 -1
  247. package/dist/server/before-interactive-head.d.ts +0 -1
  248. package/dist/server/before-interactive-head.js +2 -0
  249. package/dist/server/bfcache-identity.d.ts +45 -0
  250. package/dist/server/bfcache-identity.js +52 -0
  251. package/dist/server/cache-control.d.ts +11 -7
  252. package/dist/server/cache-control.js +23 -11
  253. package/dist/server/cache-proof.d.ts +0 -1
  254. package/dist/server/client-reuse-manifest.d.ts +0 -1
  255. package/dist/server/config-headers.d.ts +6 -2
  256. package/dist/server/config-headers.js +19 -3
  257. package/dist/server/csp.d.ts +0 -1
  258. package/dist/server/default-global-error-module.d.ts +0 -1
  259. package/dist/server/default-global-not-found-module.d.ts +0 -1
  260. package/dist/server/default-not-found-module.d.ts +0 -1
  261. package/dist/server/dev-lockfile.d.ts +21 -9
  262. package/dist/server/dev-module-runner.d.ts +0 -1
  263. package/dist/server/dev-route-files.d.ts +0 -1
  264. package/dist/server/dev-server.d.ts +4 -8
  265. package/dist/server/dev-server.js +54 -105
  266. package/dist/server/dev-stack-sourcemap.d.ts +0 -1
  267. package/dist/server/document-initial-head.d.ts +12 -2
  268. package/dist/server/document-initial-head.js +17 -2
  269. package/dist/server/file-based-metadata.d.ts +0 -1
  270. package/dist/server/headers.d.ts +21 -2
  271. package/dist/server/headers.js +23 -2
  272. package/dist/server/http-conditional.d.ts +22 -0
  273. package/dist/server/http-conditional.js +117 -0
  274. package/dist/server/http-date.d.ts +5 -0
  275. package/dist/server/http-date.js +73 -0
  276. package/dist/server/http-error-responses.d.ts +3 -2
  277. package/dist/server/http-error-responses.js +21 -4
  278. package/dist/server/http-range.d.ts +25 -0
  279. package/dist/server/http-range.js +67 -0
  280. package/dist/server/image-optimization.d.ts +14 -6
  281. package/dist/server/image-optimization.js +0 -1
  282. package/dist/server/instrumentation.d.ts +7 -4
  283. package/dist/server/isr-cache.d.ts +28 -6
  284. package/dist/server/isr-cache.js +19 -13
  285. package/dist/server/isr-decision.d.ts +6 -4
  286. package/dist/server/metadata-route-build-data.d.ts +0 -1
  287. package/dist/server/metadata-route-build-data.js +1 -1
  288. package/dist/server/metadata-route-cache-policy.d.ts +6 -0
  289. package/dist/server/metadata-route-cache-policy.js +6 -0
  290. package/dist/server/metadata-route-response.d.ts +26 -2
  291. package/dist/server/metadata-route-response.js +225 -11
  292. package/dist/server/metadata-routes.d.ts +34 -16
  293. package/dist/server/metadata-routes.js +1 -1
  294. package/dist/server/middleware-matcher-pattern.d.ts +0 -1
  295. package/dist/server/middleware-matcher.d.ts +8 -3
  296. package/dist/server/middleware-matcher.js +23 -18
  297. package/dist/server/middleware-response-headers.js +4 -2
  298. package/dist/server/middleware-runtime.d.ts +6 -1
  299. package/dist/server/middleware-runtime.js +91 -28
  300. package/dist/server/middleware.d.ts +0 -1
  301. package/dist/server/navigation-planner.d.ts +1 -1
  302. package/dist/server/next-error-digest.d.ts +0 -1
  303. package/dist/server/pages-api-route.d.ts +0 -1
  304. package/dist/server/pages-api-route.js +30 -5
  305. package/dist/server/pages-asset-tags.d.ts +2 -1
  306. package/dist/server/pages-data-route.d.ts +14 -6
  307. package/dist/server/pages-data-route.js +19 -10
  308. package/dist/server/pages-dev-hydration.js +14 -4
  309. package/dist/server/pages-dev-stylesheets.d.ts +10 -0
  310. package/dist/server/pages-dev-stylesheets.js +150 -0
  311. package/dist/server/pages-document-initial-props.d.ts +10 -6
  312. package/dist/server/pages-get-initial-props.d.ts +2 -2
  313. package/dist/server/pages-i18n.d.ts +1 -7
  314. package/dist/server/pages-node-compat.d.ts +11 -2
  315. package/dist/server/pages-node-compat.js +49 -2
  316. package/dist/server/pages-page-data.d.ts +21 -9
  317. package/dist/server/pages-page-data.js +109 -30
  318. package/dist/server/pages-page-handler.d.ts +72 -33
  319. package/dist/server/pages-page-handler.js +25 -20
  320. package/dist/server/pages-page-response.d.ts +7 -13
  321. package/dist/server/pages-page-response.js +16 -23
  322. package/dist/server/pages-readiness.d.ts +0 -1
  323. package/dist/server/pages-request-pipeline.d.ts +20 -6
  324. package/dist/server/pages-request-pipeline.js +40 -20
  325. package/dist/server/pages-revalidate.d.ts +0 -1
  326. package/dist/server/pages-revalidate.js +1 -1
  327. package/dist/server/pages-router-entry.js +13 -9
  328. package/dist/server/prerender-cache-life-header.d.ts +11 -0
  329. package/dist/server/prerender-cache-life-header.js +18 -0
  330. package/dist/server/prerender-manifest.d.ts +11 -2
  331. package/dist/server/prerender-manifest.js +4 -1
  332. package/dist/server/prod-server.d.ts +13 -7
  333. package/dist/server/prod-server.js +280 -92
  334. package/dist/server/proxy-trust.d.ts +0 -1
  335. package/dist/server/request-log.d.ts +7 -11
  336. package/dist/server/request-pipeline.d.ts +13 -4
  337. package/dist/server/request-pipeline.js +30 -20
  338. package/dist/server/revalidation-host.d.ts +0 -1
  339. package/dist/server/revalidation-host.js +1 -1
  340. package/dist/server/rsc-completion-metadata.d.ts +15 -0
  341. package/dist/server/rsc-completion-metadata.js +183 -0
  342. package/dist/server/seed-cache.d.ts +6 -2
  343. package/dist/server/seed-cache.js +35 -8
  344. package/dist/server/skip-cache-proof.d.ts +0 -1
  345. package/dist/server/static-file-cache.d.ts +23 -9
  346. package/dist/server/static-file-cache.js +47 -23
  347. package/dist/server/static-layout-client-reuse-proof.d.ts +0 -1
  348. package/dist/server/worker-revalidation-context.d.ts +0 -1
  349. package/dist/server/worker-utils.d.ts +3 -1
  350. package/dist/server/worker-utils.js +12 -3
  351. package/dist/shims/app-router-scroll.d.ts +2 -8
  352. package/dist/shims/app.d.ts +1 -5
  353. package/dist/shims/before-interactive-context.d.ts +5 -3
  354. package/dist/shims/cache-callable-runtime.d.ts +11 -0
  355. package/dist/shims/cache-callable-runtime.js +30 -0
  356. package/dist/shims/cache-handler.d.ts +6 -1
  357. package/dist/shims/cache-handler.js +4 -2
  358. package/dist/shims/cache-request-state.d.ts +15 -1
  359. package/dist/shims/cache-request-state.js +27 -1
  360. package/dist/shims/cache-runtime.d.ts +15 -6
  361. package/dist/shims/cache-runtime.js +129 -29
  362. package/dist/shims/cache.d.ts +2 -3
  363. package/dist/shims/cache.js +2 -2
  364. package/dist/shims/cdn-cache.d.ts +18 -7
  365. package/dist/shims/cdn-cache.js +4 -2
  366. package/dist/shims/client-locale.d.ts +1 -6
  367. package/dist/shims/client-only.d.ts +1 -1
  368. package/dist/shims/compat-router.d.ts +0 -1
  369. package/dist/shims/constants.d.ts +1 -1
  370. package/dist/shims/default-global-error.d.ts +1 -4
  371. package/dist/shims/default-not-found.d.ts +0 -1
  372. package/dist/shims/document.d.ts +0 -1
  373. package/dist/shims/document.js +2 -1
  374. package/dist/shims/dynamic-preload-chunks.d.ts +0 -1
  375. package/dist/shims/dynamic.d.ts +0 -1
  376. package/dist/shims/error-boundary-navigation.d.ts +0 -1
  377. package/dist/shims/error-boundary.d.ts +7 -32
  378. package/dist/shims/error.d.ts +1 -6
  379. package/dist/shims/fetch-cache.js +115 -65
  380. package/dist/shims/font-google-base.d.ts +0 -1
  381. package/dist/shims/font-local.d.ts +0 -1
  382. package/dist/shims/font-local.js +3 -3
  383. package/dist/shims/form.d.ts +5 -3
  384. package/dist/shims/head-state.d.ts +0 -1
  385. package/dist/shims/head.d.ts +17 -5
  386. package/dist/shims/head.js +70 -8
  387. package/dist/shims/headers.d.ts +2 -2
  388. package/dist/shims/headers.js +1 -1
  389. package/dist/shims/i18n-context.d.ts +0 -1
  390. package/dist/shims/i18n-state.d.ts +0 -1
  391. package/dist/shims/image.d.ts +0 -1
  392. package/dist/shims/image.js +1 -2
  393. package/dist/shims/internal/als-registry.d.ts +31 -2
  394. package/dist/shims/internal/als-registry.js +50 -2
  395. package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +17 -2
  396. package/dist/shims/internal/app-prefetch-fetch-queue.js +69 -7
  397. package/dist/shims/internal/app-route-detection.d.ts +0 -1
  398. package/dist/shims/internal/app-route-prefetch-policy.d.ts +33 -0
  399. package/dist/shims/internal/app-route-prefetch-policy.js +63 -0
  400. package/dist/shims/internal/app-router-context.d.ts +0 -1
  401. package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +1 -5
  402. package/dist/shims/internal/hybrid-client-route-owner.d.ts +0 -1
  403. package/dist/shims/internal/hybrid-client-route-owner.js +6 -8
  404. package/dist/shims/internal/interpolate-as.d.ts +3 -2
  405. package/dist/shims/internal/pages-data-target.d.ts +22 -11
  406. package/dist/shims/internal/pages-data-target.js +19 -6
  407. package/dist/shims/internal/pages-data-url.d.ts +3 -1
  408. package/dist/shims/internal/router-context.d.ts +0 -1
  409. package/dist/shims/internal/work-unit-async-storage.d.ts +4 -3
  410. package/dist/shims/internal/work-unit-async-storage.js +2 -0
  411. package/dist/shims/layout-segment-context.d.ts +2 -6
  412. package/dist/shims/legacy-image.d.ts +0 -1
  413. package/dist/shims/link.d.ts +29 -23
  414. package/dist/shims/link.js +59 -150
  415. package/dist/shims/metadata.d.ts +2 -10
  416. package/dist/shims/navigation-context-state.d.ts +4 -1
  417. package/dist/shims/navigation-state.d.ts +1 -0
  418. package/dist/shims/navigation.d.ts +65 -6
  419. package/dist/shims/navigation.js +360 -71
  420. package/dist/shims/navigation.react-server.d.ts +1 -0
  421. package/dist/shims/og.d.ts +0 -1
  422. package/dist/shims/request-context.d.ts +8 -4
  423. package/dist/shims/request-state-types.d.ts +1 -0
  424. package/dist/shims/root-params.d.ts +3 -1
  425. package/dist/shims/root-params.js +7 -1
  426. package/dist/shims/router.d.ts +44 -23
  427. package/dist/shims/router.js +184 -82
  428. package/dist/shims/script-nonce-context.d.ts +0 -1
  429. package/dist/shims/script.d.ts +25 -13
  430. package/dist/shims/server-only.d.ts +1 -1
  431. package/dist/shims/server.d.ts +1 -3
  432. package/dist/shims/server.js +7 -7
  433. package/dist/shims/slot.d.ts +22 -11
  434. package/dist/shims/slot.js +99 -19
  435. package/dist/shims/streamed-icons.d.ts +1 -3
  436. package/dist/shims/unified-request-context.d.ts +44 -4
  437. package/dist/shims/unified-request-context.js +56 -2
  438. package/dist/shims/use-merged-ref.d.ts +0 -1
  439. package/dist/shims/web-vitals.d.ts +0 -1
  440. package/dist/typegen.d.ts +1 -2
  441. package/dist/typegen.js +1 -1
  442. package/dist/utils/cache-control-metadata.d.ts +13 -1
  443. package/dist/utils/cache-control-metadata.js +17 -1
  444. package/dist/utils/client-build-manifest.d.ts +0 -1
  445. package/dist/utils/domain-locale.d.ts +1 -5
  446. package/dist/utils/encode-cache-tag.d.ts +1 -1
  447. package/dist/utils/encode-cache-tag.js +1 -1
  448. package/dist/utils/html-limited-bots.js +1 -1
  449. package/dist/utils/middleware-request-headers.d.ts +17 -5
  450. package/dist/utils/middleware-request-headers.js +32 -23
  451. package/dist/utils/precompressed-variant.d.ts +9 -0
  452. package/dist/utils/precompressed-variant.js +15 -0
  453. package/dist/utils/prerender-output-paths.d.ts +3 -1
  454. package/dist/utils/prerender-output-paths.js +6 -1
  455. package/dist/utils/project.d.ts +12 -7
  456. package/dist/utils/public-file-path.d.ts +5 -0
  457. package/dist/utils/public-file-path.js +12 -0
  458. package/dist/utils/public-routes.d.ts +1 -1
  459. package/dist/utils/public-routes.js +6 -5
  460. package/package.json +10 -6
@@ -1,5 +1,6 @@
1
1
  import path, { toSlash } from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
2
  import { ASSET_PREFIX_URL_DIR } from "../utils/asset-prefix.js";
3
+ import { isPrecompressedVariantBeneficial } from "../utils/precompressed-variant.js";
3
4
  import fsp from "node:fs/promises";
4
5
  //#region src/server/static-file-cache.ts
5
6
  /**
@@ -17,27 +18,43 @@ import fsp from "node:fs/promises";
17
18
  */
18
19
  /** Content-type lookup for static assets. Shared with prod-server.ts. */
19
20
  const CONTENT_TYPES = {
20
- ".js": "application/javascript",
21
- ".mjs": "application/javascript",
22
- ".css": "text/css",
21
+ ".avif": "image/avif",
22
+ ".bmp": "image/bmp",
23
+ ".csv": "text/csv; charset=utf-8",
24
+ ".eot": "application/vnd.ms-fontobject",
25
+ ".gif": "image/gif",
26
+ ".heic": "image/heic",
27
+ ".js": "application/javascript; charset=utf-8",
28
+ ".mjs": "application/javascript; charset=utf-8",
29
+ ".css": "text/css; charset=utf-8",
23
30
  ".html": "text/html; charset=utf-8",
24
- ".json": "application/json",
25
- ".txt": "text/plain; charset=utf-8",
26
- ".png": "image/png",
27
- ".jpg": "image/jpeg",
31
+ ".ico": "image/x-icon",
28
32
  ".jpeg": "image/jpeg",
29
- ".gif": "image/gif",
33
+ ".jpg": "image/jpeg",
34
+ ".json": "application/json; charset=utf-8",
35
+ ".map": "application/json; charset=utf-8",
36
+ ".mp3": "audio/mpeg",
37
+ ".mp4": "video/mp4",
38
+ ".ogg": "audio/ogg",
39
+ ".ogv": "video/ogg",
40
+ ".pdf": "application/pdf",
41
+ ".png": "image/png",
42
+ ".rsc": "text/x-component",
30
43
  ".svg": "image/svg+xml",
31
- ".ico": "image/x-icon",
32
- ".woff": "font/woff",
33
- ".woff2": "font/woff2",
34
44
  ".ttf": "font/ttf",
35
- ".eot": "application/vnd.ms-fontobject",
45
+ ".txt": "text/plain; charset=utf-8",
46
+ ".wasm": "application/wasm",
47
+ ".webm": "video/webm",
48
+ ".webmanifest": "application/manifest+json",
36
49
  ".webp": "image/webp",
37
- ".avif": "image/avif",
38
- ".map": "application/json",
39
- ".rsc": "text/x-component"
50
+ ".woff": "font/woff",
51
+ ".woff2": "font/woff2",
52
+ ".xml": "application/xml"
40
53
  };
54
+ /** Resolve a path's MIME type with case-insensitive extension matching. */
55
+ function contentTypeForPath(filePath) {
56
+ return CONTENT_TYPES[path.extname(filePath).toLowerCase()] ?? "application/octet-stream";
57
+ }
41
58
  /**
42
59
  * Files below this size are buffered in memory at startup for zero-syscall
43
60
  * serving via res.end(buffer). Above this, files stream via createReadStream.
@@ -45,6 +62,8 @@ const CONTENT_TYPES = {
45
62
  * to ~50KB with brotli q5).
46
63
  */
47
64
  const BUFFER_THRESHOLD = 64 * 1024;
65
+ /** Temp files left by an interrupted atomic precompression write. */
66
+ const PRECOMPRESSION_TEMP_FILE_RE = /\.(?:br|gz|zst)\.\d+\.[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.tmp$/i;
48
67
  /**
49
68
  * In-memory cache of static file metadata, populated once at server startup.
50
69
  *
@@ -74,15 +93,18 @@ var StaticFileCache = class StaticFileCache {
74
93
  for (const [relativePath, fileInfo] of allFiles) {
75
94
  if (relativePath.endsWith(".br") || relativePath.endsWith(".gz") || relativePath.endsWith(".zst")) continue;
76
95
  if (relativePath.startsWith(".vite/") || relativePath === ".vite") continue;
77
- const ext = path.extname(relativePath);
78
- const contentType = CONTENT_TYPES[ext] ?? "application/octet-stream";
79
96
  const isHashed = relativePath.startsWith(`_next/static/`) || relativePath.includes(`/_next/static/`);
97
+ if (isHashed && PRECOMPRESSION_TEMP_FILE_RE.test(relativePath)) continue;
98
+ const ext = path.extname(relativePath);
99
+ const contentType = contentTypeForPath(relativePath);
80
100
  const cacheControl = isHashed ? "public, max-age=31536000, immutable" : "public, max-age=3600";
81
101
  const etag = isHashed && etagFromFilenameHash(relativePath, ext) || `W/"${fileInfo.size}-${Math.floor(fileInfo.mtimeMs / 1e3)}"`;
102
+ const lastModified = new Date(fileInfo.mtimeMs).toUTCString();
82
103
  const baseHeaders = {
83
104
  "Content-Type": contentType,
84
105
  "Cache-Control": cacheControl,
85
- ETag: etag
106
+ ETag: etag,
107
+ "Last-Modified": lastModified
86
108
  };
87
109
  const original = {
88
110
  path: fileInfo.fullPath,
@@ -94,18 +116,20 @@ var StaticFileCache = class StaticFileCache {
94
116
  };
95
117
  const entry = {
96
118
  etag,
119
+ mtimeMs: fileInfo.mtimeMs,
97
120
  notModifiedHeaders: {
98
121
  ETag: etag,
99
- "Cache-Control": cacheControl
122
+ "Cache-Control": cacheControl,
123
+ "Last-Modified": lastModified
100
124
  },
101
125
  original
102
126
  };
103
127
  const brInfo = allFiles.get(relativePath + ".br");
104
- if (brInfo) entry.br = buildVariant(brInfo, baseHeaders, "br");
128
+ if (brInfo && isPrecompressedVariantBeneficial(brInfo.size, fileInfo.size, "br")) entry.br = buildVariant(brInfo, baseHeaders, "br");
105
129
  const gzInfo = allFiles.get(relativePath + ".gz");
106
- if (gzInfo) entry.gz = buildVariant(gzInfo, baseHeaders, "gzip");
130
+ if (gzInfo && isPrecompressedVariantBeneficial(gzInfo.size, fileInfo.size, "gzip")) entry.gz = buildVariant(gzInfo, baseHeaders, "gzip");
107
131
  const zstInfo = allFiles.get(relativePath + ".zst");
108
- if (zstInfo) entry.zst = buildVariant(zstInfo, baseHeaders, "zstd");
132
+ if (zstInfo && isPrecompressedVariantBeneficial(zstInfo.size, fileInfo.size, "zstd")) entry.zst = buildVariant(zstInfo, baseHeaders, "zstd");
109
133
  if (entry.br || entry.gz || entry.zst) {
110
134
  original.headers["Vary"] = "Accept-Encoding";
111
135
  entry.notModifiedHeaders["Vary"] = "Accept-Encoding";
@@ -227,4 +251,4 @@ async function* walkFilesWithStats(dir, base = dir) {
227
251
  }
228
252
  }
229
253
  //#endregion
230
- export { CONTENT_TYPES, StaticFileCache, etagFromFilenameHash };
254
+ export { CONTENT_TYPES, StaticFileCache, contentTypeForPath, etagFromFilenameHash };
@@ -1,5 +1,4 @@
1
1
  import { ArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
2
-
3
2
  //#region src/server/static-layout-client-reuse-proof.d.ts
4
3
  type StaticLayoutClientReuseProofInput = Readonly<{
5
4
  artifactCompatibility: ArtifactCompatibilityEnvelope;
@@ -1,5 +1,4 @@
1
1
  import { ExecutionContextLike } from "../shims/request-context.js";
2
-
3
2
  //#region src/server/worker-revalidation-context.d.ts
4
3
  type PlatformExecutionContext = Partial<ExecutionContextLike>;
5
4
  /**
@@ -4,5 +4,7 @@ declare function mergeHeaders(response: Response, extraHeaders: Record<string, s
4
4
  declare function resolveStaticAssetSignal(signalResponse: Response, options: {
5
5
  fetchAsset(path: string): Promise<Response>;
6
6
  }): Promise<Response | null>;
7
+ /** Retarget a Worker asset request without dropping its conditional/range fields. */
8
+ declare function createStaticAssetRequest(assetPath: string, sourceRequest: Request): Request;
7
9
  //#endregion
8
- export { finalizeMissingStaticAssetResponse, mergeHeaders, resolveStaticAssetSignal };
10
+ export { createStaticAssetRequest, finalizeMissingStaticAssetResponse, mergeHeaders, resolveStaticAssetSignal };
@@ -33,7 +33,7 @@ function cancelResponseBody(response) {
33
33
  function finalizeMissingStaticAssetResponse(response, missingBuildAsset) {
34
34
  if (!missingBuildAsset || response.status !== 404) return response;
35
35
  cancelResponseBody(response);
36
- return notFoundStaticAssetResponse();
36
+ return notFoundStaticAssetResponse(response.headers);
37
37
  }
38
38
  function buildHeaderRecord(response, omitNames = []) {
39
39
  const omitted = new Set(omitNames.map((name) => name.toLowerCase()));
@@ -99,7 +99,16 @@ async function resolveStaticAssetSignal(signalResponse, options) {
99
99
  ]);
100
100
  cancelResponseBody(signalResponse);
101
101
  const assetResponse = await options.fetchAsset(assetPath);
102
- return mergeHeaders(assetResponse, extraHeaders, assetResponse.ok && signalResponse.status !== 200 ? signalResponse.status : void 0);
102
+ return mergeHeaders(assetResponse, extraHeaders, assetResponse.ok && assetResponse.status !== 206 && signalResponse.status !== 200 ? signalResponse.status : void 0);
103
+ }
104
+ /** Retarget a Worker asset request without dropping its conditional/range fields. */
105
+ function createStaticAssetRequest(assetPath, sourceRequest) {
106
+ const assetUrl = new URL(assetPath, sourceRequest.url);
107
+ if (sourceRequest.method === "GET" || sourceRequest.method === "HEAD") return new Request(assetUrl, sourceRequest);
108
+ return new Request(assetUrl, {
109
+ method: sourceRequest.method,
110
+ headers: sourceRequest.headers
111
+ });
103
112
  }
104
113
  //#endregion
105
- export { finalizeMissingStaticAssetResponse, mergeHeaders, resolveStaticAssetSignal };
114
+ export { createStaticAssetRequest, finalizeMissingStaticAssetResponse, mergeHeaders, resolveStaticAssetSignal };
@@ -1,5 +1,4 @@
1
1
  import * as React$1 from "react";
2
-
3
2
  //#region src/shims/app-router-scroll.d.ts
4
3
  declare class AppRouterScrollTargetInner extends React$1.Component<{
5
4
  children: React$1.ReactNode;
@@ -13,16 +12,11 @@ declare class AppRouterScrollTargetInner extends React$1.Component<{
13
12
  componentWillUnmount(): void;
14
13
  render(): React$1.ReactNode;
15
14
  }
16
- declare function AppRouterScrollCommitProvider({
17
- children,
18
- commitId
19
- }: {
15
+ declare function AppRouterScrollCommitProvider({ children, commitId }: {
20
16
  children?: React$1.ReactNode;
21
17
  commitId: number | null;
22
18
  }): React$1.JSX.Element;
23
- declare function AppRouterScrollTarget({
24
- children
25
- }: {
19
+ declare function AppRouterScrollTarget({ children }: {
26
20
  children: React$1.ReactNode;
27
21
  }): React$1.JSX.Element;
28
22
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import React, { ComponentType } from "react";
2
-
3
2
  //#region src/shims/app.d.ts
4
3
  type AppProps<P = any> = {
5
4
  Component: ComponentType<P> & {
@@ -29,10 +28,7 @@ type AppContext = {
29
28
  type AppInitialProps<PageProps = any> = {
30
29
  pageProps: PageProps;
31
30
  };
32
- declare function appGetInitialProps({
33
- Component,
34
- ctx
35
- }: AppContext): Promise<AppInitialProps>;
31
+ declare function appGetInitialProps({ Component, ctx }: AppContext): Promise<AppInitialProps>;
36
32
  declare class App<P = any, CP = any, S = any> extends React.Component<P & AppProps<CP>, S> {
37
33
  static origGetInitialProps: typeof appGetInitialProps;
38
34
  static getInitialProps: typeof appGetInitialProps;
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
-
3
2
  //#region src/shims/before-interactive-context.d.ts
4
3
  /**
5
4
  * A `<Script strategy="beforeInteractive">` captured during SSR.
@@ -17,13 +16,16 @@ import React from "react";
17
16
  * scripts and `innerHTML` set for inline scripts (never both).
18
17
  */
19
18
  type BeforeInteractiveInlineScript = {
20
- /** Optional id attribute. */id?: string; /** External script URL. Set for src beforeInteractive scripts. */
19
+ /** Optional id attribute. */
20
+ id?: string;
21
+ /** External script URL. Set for src beforeInteractive scripts. */
21
22
  src?: string;
22
23
  /**
23
24
  * Pre-escaped inline content (already passed through `escapeInlineContent`).
24
25
  * Set for inline beforeInteractive scripts; omitted for src scripts.
25
26
  */
26
- innerHTML?: string; /** Nonce to emit on the `<script>` tag, when CSP is enabled. */
27
+ innerHTML?: string;
28
+ /** Nonce to emit on the `<script>` tag, when CSP is enabled. */
27
29
  nonce?: string;
28
30
  /**
29
31
  * Additional HTML attributes to emit on the tag. Booleans render as the
@@ -0,0 +1,11 @@
1
+ import { RegisterCachedFunctionOptions } from "./cache-runtime.js";
2
+ //#region src/shims/cache-callable-runtime.d.ts
3
+ declare const CACHE_CAPTURE_TYPE = "use-cache-captures";
4
+ type CacheCaptureEnvelope = {
5
+ type: typeof CACHE_CAPTURE_TYPE;
6
+ encrypted: string | PromiseLike<string>;
7
+ };
8
+ declare function encryptCacheCaptures(captures: unknown[]): CacheCaptureEnvelope;
9
+ declare function registerCachedFunction<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>, id: string, variant: string, options: RegisterCachedFunctionOptions): (...args: TArgs) => Promise<TResult>;
10
+ //#endregion
11
+ export { encryptCacheCaptures, registerCachedFunction };
@@ -0,0 +1,30 @@
1
+ import { registerCachedFunction as registerCachedFunction$1 } from "./cache-runtime.js";
2
+ import { decryptActionBoundArgs, encryptActionBoundArgs } from "@vitejs/plugin-rsc/utils/encryption-runtime";
3
+ //#region src/shims/cache-callable-runtime.ts
4
+ const CACHE_CAPTURE_TYPE = "use-cache-captures";
5
+ function encryptCacheCaptures(captures) {
6
+ return {
7
+ type: CACHE_CAPTURE_TYPE,
8
+ encrypted: encryptActionBoundArgs(captures)
9
+ };
10
+ }
11
+ async function decryptCacheCaptures(value) {
12
+ if (!isCacheCaptureEnvelope(value)) return;
13
+ const captures = await decryptActionBoundArgs(Promise.resolve(value.encrypted));
14
+ if (!Array.isArray(captures)) throw new Error("Invalid cache capture payload");
15
+ return captures;
16
+ }
17
+ function isCacheCaptureEnvelope(value) {
18
+ if (typeof value !== "object" || value === null) return false;
19
+ if (!("type" in value) || value.type !== CACHE_CAPTURE_TYPE || !("encrypted" in value)) return false;
20
+ const encrypted = value.encrypted;
21
+ return typeof encrypted === "string" || typeof encrypted === "object" && encrypted !== null && "then" in encrypted && typeof encrypted.then === "function";
22
+ }
23
+ function registerCachedFunction(fn, id, variant, options) {
24
+ return registerCachedFunction$1(fn, id, variant, {
25
+ ...options,
26
+ decryptCaptures: decryptCacheCaptures
27
+ });
28
+ }
29
+ //#endregion
30
+ export { encryptCacheCaptures, registerCachedFunction };
@@ -1,5 +1,4 @@
1
1
  import { RenderObservation } from "../server/cache-proof.js";
2
-
3
2
  //#region src/shims/cache-handler.d.ts
4
3
  type CacheHandlerValue = {
5
4
  lastModified: number;
@@ -11,6 +10,12 @@ type CacheHandlerValue = {
11
10
  type CacheControlMetadata = {
12
11
  revalidate: number | false;
13
12
  expire?: number;
13
+ /**
14
+ * Client-router reuse bound from the render's resolved `cacheLife`,
15
+ * persisted so warm hits replay the producing render's claim. Independent
16
+ * of `revalidate`/`expire`; absent means no claim was made.
17
+ */
18
+ stale?: number;
14
19
  };
15
20
  type IncrementalCacheValue = CachedFetchValue | CachedAppPageValue | CachedPagesValue | CachedRouteValue | CachedRedirectValue | CachedImageValue;
16
21
  type CachedFetchValue = {
@@ -117,15 +117,17 @@ var MemoryCacheHandler = class {
117
117
  const tags = [...tagSet];
118
118
  let effectiveRevalidate = readCacheControlRevalidateField(ctx);
119
119
  const effectiveExpire = readCacheControlNumberField(ctx, "expire");
120
+ const effectiveStale = readCacheControlNumberField(ctx, "stale");
120
121
  if (data && "revalidate" in data && typeof data.revalidate === "number") effectiveRevalidate = data.revalidate;
121
122
  else if (data && "revalidate" in data && data.revalidate === false) effectiveRevalidate ??= false;
122
123
  if (effectiveRevalidate === 0) return;
123
124
  const now = Date.now();
124
125
  const revalidateAt = typeof effectiveRevalidate === "number" && effectiveRevalidate > 0 ? now + effectiveRevalidate * 1e3 : null;
125
126
  const expireAt = typeof effectiveExpire === "number" && effectiveExpire > 0 ? now + effectiveExpire * 1e3 : null;
126
- const cacheControl = typeof effectiveRevalidate === "number" || effectiveRevalidate === false ? effectiveExpire === void 0 ? { revalidate: effectiveRevalidate } : {
127
+ const cacheControl = typeof effectiveRevalidate === "number" || effectiveRevalidate === false ? {
127
128
  revalidate: effectiveRevalidate,
128
- expire: effectiveExpire
129
+ ...effectiveExpire === void 0 ? {} : { expire: effectiveExpire },
130
+ ...effectiveStale === void 0 ? {} : { stale: effectiveStale }
129
131
  } : void 0;
130
132
  if (this.maxMemoryCacheSize === 0) return;
131
133
  const entry = {
@@ -9,12 +9,15 @@ type CacheContextLike = {
9
9
  tags: string[];
10
10
  lifeConfigs: CacheLifeConfig[];
11
11
  variant: string;
12
+ readRootParamNames?: Set<string>;
12
13
  hasExplicitRevalidate: boolean;
13
14
  hasExplicitExpire: boolean;
14
15
  dynamicNestedCacheError: Error | undefined;
15
16
  };
16
17
  declare function _registerCacheContextAccessor(fn: () => CacheContextLike | null): void;
17
18
  declare function getRegisteredCacheContext(): CacheContextLike | null;
19
+ /** Record a root-param dependency on the active public `"use cache"` scope. */
20
+ declare function _recordUseCacheRootParamRead(name: string): void;
18
21
  type UnstableCacheRevalidationMode = "foreground" | "background";
19
22
  type ActionRevalidationKind = 0 | 1 | 2;
20
23
  type UnstableCacheObservation = Readonly<{
@@ -66,8 +69,19 @@ declare function _drainPendingRevalidations(): Promise<void>;
66
69
  declare function _setRequestScopedCacheLife(config: CacheLifeConfig): void;
67
70
  declare function _peekRequestScopedCacheLife(): CacheLifeConfig | null;
68
71
  declare function _consumeRequestScopedCacheLife(): CacheLifeConfig | null;
72
+ /**
73
+ * Capture access to the current request's cache-life slot for work that may
74
+ * finish after the AsyncLocalStorage request scope has returned. RSC response
75
+ * bodies are consumed by the server runtime later, so resolving the active
76
+ * store from a stream-finalization callback can otherwise read a detached
77
+ * context and lose cacheLife claims made while rendering the body.
78
+ */
79
+ declare function _captureRequestScopedCacheLifeAccessors(): {
80
+ consume: () => CacheLifeConfig | null;
81
+ peek: () => CacheLifeConfig | null;
82
+ };
69
83
  declare function recordUnstableCacheObservation(observation: UnstableCacheObservation): void;
70
84
  declare function _peekUnstableCacheObservations(): UnstableCacheObservation[];
71
85
  declare function shouldServeStaleUnstableCacheEntry(): boolean;
72
86
  //#endregion
73
- export { ACTION_DID_REVALIDATE_DYNAMIC_ONLY, ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC, ActionRevalidationKind, CacheLifeConfig, CacheState, UnstableCacheObservation, UnstableCacheRevalidationMode, _consumeRequestScopedCacheLife, _drainPendingRevalidations, _hasPendingRevalidatedTag, _initRequestScopedCacheState, _markPendingRevalidatedTag, _peekRequestScopedCacheLife, _peekUnstableCacheObservations, _queuePendingRevalidation, _registerCacheContextAccessor, _runWithCacheState, _setRequestScopedCacheLife, cacheLifeProfiles, getAndClearActionRevalidationKind, getRegisteredCacheContext, markActionRevalidation, recordUnstableCacheObservation, shouldServeStaleUnstableCacheEntry };
87
+ export { ACTION_DID_REVALIDATE_DYNAMIC_ONLY, ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC, ActionRevalidationKind, CacheLifeConfig, CacheState, UnstableCacheObservation, UnstableCacheRevalidationMode, _captureRequestScopedCacheLifeAccessors, _consumeRequestScopedCacheLife, _drainPendingRevalidations, _hasPendingRevalidatedTag, _initRequestScopedCacheState, _markPendingRevalidatedTag, _peekRequestScopedCacheLife, _peekUnstableCacheObservations, _queuePendingRevalidation, _recordUseCacheRootParamRead, _registerCacheContextAccessor, _runWithCacheState, _setRequestScopedCacheLife, cacheLifeProfiles, getAndClearActionRevalidationKind, getRegisteredCacheContext, markActionRevalidation, recordUnstableCacheObservation, shouldServeStaleUnstableCacheEntry };
@@ -45,6 +45,11 @@ function _registerCacheContextAccessor(fn) {
45
45
  function getRegisteredCacheContext() {
46
46
  return getCacheContext?.() ?? null;
47
47
  }
48
+ /** Record a root-param dependency on the active public `"use cache"` scope. */
49
+ function _recordUseCacheRootParamRead(name) {
50
+ const context = getRegisteredCacheContext();
51
+ if (context && context.variant !== "private") context.readRootParamNames?.add(name);
52
+ }
48
53
  const FALLBACK_KEY = Symbol.for("vinext.cache.fallback");
49
54
  const globalState = globalThis;
50
55
  const cacheAls = getOrCreateAls("vinext.cache.als");
@@ -172,6 +177,27 @@ function _consumeRequestScopedCacheLife() {
172
177
  state.requestScopedCacheLife = null;
173
178
  return config;
174
179
  }
180
+ /**
181
+ * Capture access to the current request's cache-life slot for work that may
182
+ * finish after the AsyncLocalStorage request scope has returned. RSC response
183
+ * bodies are consumed by the server runtime later, so resolving the active
184
+ * store from a stream-finalization callback can otherwise read a detached
185
+ * context and lose cacheLife claims made while rendering the body.
186
+ */
187
+ function _captureRequestScopedCacheLifeAccessors() {
188
+ const state = getCacheState();
189
+ return {
190
+ consume() {
191
+ const config = state.requestScopedCacheLife;
192
+ state.requestScopedCacheLife = null;
193
+ return config;
194
+ },
195
+ peek() {
196
+ const config = state.requestScopedCacheLife;
197
+ return config === null ? null : { ...config };
198
+ }
199
+ };
200
+ }
175
201
  function recordUnstableCacheObservation(observation) {
176
202
  getCacheState().unstableCacheObservations.set(observation.keyHash, observation);
177
203
  }
@@ -182,4 +208,4 @@ function shouldServeStaleUnstableCacheEntry() {
182
208
  return getCacheState().unstableCacheRevalidation === "background";
183
209
  }
184
210
  //#endregion
185
- export { ACTION_DID_REVALIDATE_DYNAMIC_ONLY, ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC, _consumeRequestScopedCacheLife, _drainPendingRevalidations, _hasPendingRevalidatedTag, _initRequestScopedCacheState, _markPendingRevalidatedTag, _peekRequestScopedCacheLife, _peekUnstableCacheObservations, _queuePendingRevalidation, _registerCacheContextAccessor, _runWithCacheState, _setRequestScopedCacheLife, cacheLifeProfiles, getAndClearActionRevalidationKind, getRegisteredCacheContext, markActionRevalidation, recordUnstableCacheObservation, shouldServeStaleUnstableCacheEntry };
211
+ export { ACTION_DID_REVALIDATE_DYNAMIC_ONLY, ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC, _captureRequestScopedCacheLifeAccessors, _consumeRequestScopedCacheLife, _drainPendingRevalidations, _hasPendingRevalidatedTag, _initRequestScopedCacheState, _markPendingRevalidatedTag, _peekRequestScopedCacheLife, _peekUnstableCacheObservations, _queuePendingRevalidation, _recordUseCacheRootParamRead, _registerCacheContextAccessor, _runWithCacheState, _setRequestScopedCacheLife, cacheLifeProfiles, getAndClearActionRevalidationKind, getRegisteredCacheContext, markActionRevalidation, recordUnstableCacheObservation, shouldServeStaleUnstableCacheEntry };
@@ -1,6 +1,5 @@
1
1
  import { CacheLifeConfig } from "./cache-request-state.js";
2
2
  import { markAppPagePropsForUseCache } from "./internal/app-page-props-cache-key.js";
3
-
4
3
  //#region src/shims/cache-runtime.d.ts
5
4
  /**
6
5
  * Used purely as `cause` for the nested-dynamic cache error: its captured stack
@@ -12,10 +11,17 @@ declare class NestedDynamicUseCacheError extends Error {
12
11
  constructor();
13
12
  }
14
13
  type CacheContext = {
15
- /** Tags collected via cacheTag() during execution */tags: string[]; /** Cache life configs collected via cacheLife() — minimum-wins rule applies */
16
- lifeConfigs: CacheLifeConfig[]; /** Cache variant: "default" | "remote" | "private" */
17
- variant: string; /** Whether cacheLife() was called with an explicit revalidate value */
18
- hasExplicitRevalidate: boolean; /** Whether cacheLife() was called with an explicit expire value */
14
+ /** Tags collected via cacheTag() during execution */
15
+ tags: string[];
16
+ /** Cache life configs collected via cacheLife() — minimum-wins rule applies */
17
+ lifeConfigs: CacheLifeConfig[];
18
+ /** Cache variant: "default" | "remote" | "private" */
19
+ variant: string;
20
+ /** Root params observed while producing this public cache entry. */
21
+ readRootParamNames?: Set<string>;
22
+ /** Whether cacheLife() was called with an explicit revalidate value */
23
+ hasExplicitRevalidate: boolean;
24
+ /** Whether cacheLife() was called with an explicit expire value */
19
25
  hasExplicitExpire: boolean;
20
26
  /**
21
27
  * The first nested public "use cache" invocation with a dynamic cache life
@@ -85,6 +91,9 @@ type RegisterCachedFunctionOptions = {
85
91
  * rather than on the intermediate createElement config object.
86
92
  */
87
93
  appPageDefaultExport?: boolean;
94
+ /** Number of declared arguments supplied by the directive transform. */
95
+ argumentCount?: number;
96
+ decryptCaptures?: (value: unknown) => Promise<unknown[] | undefined>;
88
97
  };
89
98
  /**
90
99
  * Register a function as a cached function. This is called by the Vite
@@ -97,4 +106,4 @@ type RegisterCachedFunctionOptions = {
97
106
  */
98
107
  declare function registerCachedFunction<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>, id: string, variant?: string, options?: RegisterCachedFunctionOptions): (...args: TArgs) => Promise<TResult>;
99
108
  //#endregion
100
- export { CacheContext, NestedDynamicUseCacheError, PrivateCacheState, buildUseCacheKey, cacheContextStorage, clearPrivateCache, getCacheContext, markAppPagePropsForUseCache, registerCachedFunction, replyToCacheKey, runWithPrivateCache };
109
+ export { CacheContext, NestedDynamicUseCacheError, PrivateCacheState, RegisterCachedFunctionOptions, buildUseCacheKey, cacheContextStorage, clearPrivateCache, getCacheContext, markAppPagePropsForUseCache, registerCachedFunction, replyToCacheKey, runWithPrivateCache };