vinext 1.3.0 → 1.3.1

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 (391) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +1 -1
  2. package/dist/build/action-owner-manifest.d.ts +3 -2
  3. package/dist/build/action-owner-manifest.js +18 -2
  4. package/dist/build/app-page-static-eligibility.d.ts +17 -1
  5. package/dist/build/app-page-static-eligibility.js +80 -13
  6. package/dist/build/clean-output.d.ts +2 -1
  7. package/dist/build/client-build-config.d.ts +13 -3
  8. package/dist/build/client-build-config.js +46 -9
  9. package/dist/build/client-reference-async.d.ts +48 -0
  10. package/dist/build/client-reference-async.js +123 -0
  11. package/dist/build/client-reference-chunks.d.ts +32 -0
  12. package/dist/build/client-reference-chunks.js +111 -0
  13. package/dist/build/client-reference-groups.d.ts +9 -1
  14. package/dist/build/client-reference-groups.js +40 -2
  15. package/dist/build/css-url-assets.d.ts +2 -1
  16. package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
  17. package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
  18. package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
  19. package/dist/build/google-fonts/font-metadata.d.ts +2 -1
  20. package/dist/build/google-fonts/validate.d.ts +2 -1
  21. package/dist/build/inline-css.d.ts +2 -1
  22. package/dist/build/layout-classification.d.ts +2 -1
  23. package/dist/build/module-dependency-cache.d.ts +2 -1
  24. package/dist/build/next-client-runtime-manifests.d.ts +2 -1
  25. package/dist/build/precompress.d.ts +2 -1
  26. package/dist/build/precompress.js +1 -1
  27. package/dist/build/prerender-paths.d.ts +2 -1
  28. package/dist/build/prerender-phase.d.ts +2 -1
  29. package/dist/build/prerender-server-pool.js +1 -1
  30. package/dist/build/prerender.d.ts +3 -2
  31. package/dist/build/prerender.js +5 -4
  32. package/dist/build/report.d.ts +2 -1
  33. package/dist/build/route-classification-injector.d.ts +2 -1
  34. package/dist/build/route-classification-manifest.d.ts +2 -1
  35. package/dist/build/run-prerender.d.ts +2 -1
  36. package/dist/build/server-actions-encryption-key.d.ts +2 -1
  37. package/dist/build/ssr-manifest.js +25 -2
  38. package/dist/build/standalone.d.ts +2 -1
  39. package/dist/cache/cache-adapters-virtual.d.ts +2 -1
  40. package/dist/cache.js +1 -2
  41. package/dist/check.d.ts +2 -1
  42. package/dist/check.js +4 -0
  43. package/dist/cli-args.d.ts +2 -1
  44. package/dist/cli.js +2 -0
  45. package/dist/client/client-redirect-matcher.js +2 -1
  46. package/dist/client/client-redirects.d.ts +4 -3
  47. package/dist/client/client-redirects.js +2 -1
  48. package/dist/client/client-rewrites.d.ts +2 -1
  49. package/dist/client/dev-error-overlay-store.d.ts +2 -1
  50. package/dist/client/index.js +1 -2
  51. package/dist/client/instrumentation-client-state.js +5 -5
  52. package/dist/client/navigation-runtime.d.ts +3 -1
  53. package/dist/client/navigation-runtime.js +1 -1
  54. package/dist/client/pages-router-link-navigation.d.ts +2 -1
  55. package/dist/client/vinext-next-data.d.ts +25 -1
  56. package/dist/client/window-next.d.ts +2 -1
  57. package/dist/config/config-matchers.d.ts +12 -1
  58. package/dist/config/config-matchers.js +111 -16
  59. package/dist/config/dotenv.d.ts +2 -1
  60. package/dist/config/next-config.d.ts +13 -1
  61. package/dist/config/next-config.js +29 -4
  62. package/dist/config/tsconfig-paths.d.ts +2 -1
  63. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
  64. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
  65. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
  66. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
  67. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
  68. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
  69. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
  70. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
  71. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
  72. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
  73. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
  74. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
  75. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
  76. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
  77. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
  78. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
  79. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
  80. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
  81. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
  82. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
  83. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
  84. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
  85. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
  86. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
  87. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
  88. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
  89. package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
  90. package/dist/entries/app-browser-entry.d.ts +20 -5
  91. package/dist/entries/app-browser-entry.js +79 -6
  92. package/dist/entries/app-rsc-entry.d.ts +2 -1
  93. package/dist/entries/app-rsc-entry.js +42 -12
  94. package/dist/entries/app-rsc-manifest.d.ts +2 -1
  95. package/dist/entries/app-rsc-manifest.js +53 -0
  96. package/dist/entries/pages-entry-helpers.js +1 -2
  97. package/dist/entries/pages-server-entry.d.ts +2 -1
  98. package/dist/entries/pages-server-entry.js +1 -1
  99. package/dist/entries/runtime-entry-module.d.ts +1 -0
  100. package/dist/entries/runtime-entry-module.js +4 -1
  101. package/dist/image/image-adapters-virtual.d.ts +2 -1
  102. package/dist/index.js +102 -34
  103. package/dist/plugins/client-compile-hints.d.ts +30 -0
  104. package/dist/plugins/client-compile-hints.js +88 -0
  105. package/dist/plugins/client-reference-dedup.d.ts +2 -1
  106. package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
  107. package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
  108. package/dist/plugins/dynamic-preload-metadata.js +1 -1
  109. package/dist/plugins/environment.d.ts +2 -1
  110. package/dist/plugins/fonts.js +9 -12
  111. package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
  112. package/dist/plugins/import-meta-url.d.ts +2 -1
  113. package/dist/plugins/og-assets.d.ts +2 -1
  114. package/dist/plugins/og-assets.js +2 -3
  115. package/dist/plugins/optimize-imports.d.ts +2 -1
  116. package/dist/plugins/pages-node-externals.d.ts +2 -1
  117. package/dist/plugins/remove-console.d.ts +2 -1
  118. package/dist/plugins/require-condition-resolution.d.ts +2 -1
  119. package/dist/plugins/rsc-client-reference-loaders.d.ts +8 -0
  120. package/dist/plugins/rsc-client-reference-loaders.js +170 -68
  121. package/dist/plugins/rsc-client-shim-excludes.js +2 -0
  122. package/dist/plugins/sass.d.ts +2 -1
  123. package/dist/plugins/strip-server-exports.d.ts +2 -1
  124. package/dist/plugins/styled-jsx.d.ts +2 -1
  125. package/dist/plugins/transform-result.d.ts +2 -1
  126. package/dist/plugins/typeof-window.d.ts +2 -1
  127. package/dist/plugins/worker-image-imports.js +1 -1
  128. package/dist/plugins/worker-use-server.d.ts +2 -1
  129. package/dist/routing/app-route-graph.d.ts +40 -0
  130. package/dist/routing/app-route-graph.js +122 -50
  131. package/dist/routing/browser-route-manifest.d.ts +2 -1
  132. package/dist/routing/optimistic-route-trie.d.ts +2 -1
  133. package/dist/routing/route-matching.d.ts +2 -1
  134. package/dist/routing/route-pattern.d.ts +2 -1
  135. package/dist/server/accept-encoding.d.ts +2 -1
  136. package/dist/server/app-action-forwarding.d.ts +2 -1
  137. package/dist/server/app-bfcache-identity.d.ts +2 -1
  138. package/dist/server/app-browser-action-result.d.ts +2 -1
  139. package/dist/server/app-browser-client-reuse-manifest.d.ts +2 -1
  140. package/dist/server/app-browser-entry.js +30 -6
  141. package/dist/server/app-browser-error.d.ts +2 -1
  142. package/dist/server/app-browser-history-controller.d.ts +2 -1
  143. package/dist/server/app-browser-hydration.d.ts +2 -1
  144. package/dist/server/app-browser-interception-context.d.ts +2 -1
  145. package/dist/server/app-browser-navigation-controller.js +15 -10
  146. package/dist/server/app-browser-popstate.d.ts +2 -1
  147. package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
  148. package/dist/server/app-browser-server-action-client.d.ts +2 -1
  149. package/dist/server/app-browser-state.js +1 -1
  150. package/dist/server/app-browser-stream.d.ts +2 -1
  151. package/dist/server/app-browser-visible-commit.d.ts +2 -1
  152. package/dist/server/app-client-reference-manifest.d.ts +31 -0
  153. package/dist/server/app-client-reference-manifest.js +46 -0
  154. package/dist/server/app-client-reference-preloader.d.ts +25 -5
  155. package/dist/server/app-client-reference-preloader.js +22 -7
  156. package/dist/server/app-elements-wire.d.ts +2 -1
  157. package/dist/server/app-elements.d.ts +2 -0
  158. package/dist/server/app-elements.js +3 -1
  159. package/dist/server/app-fallback-renderer.d.ts +9 -2
  160. package/dist/server/app-fallback-renderer.js +4 -1
  161. package/dist/server/app-history-state.d.ts +2 -1
  162. package/dist/server/app-inline-css-client.d.ts +2 -1
  163. package/dist/server/app-layout-param-observation.d.ts +2 -1
  164. package/dist/server/app-metadata-tracing.d.ts +2 -1
  165. package/dist/server/app-optimistic-routing.d.ts +18 -1
  166. package/dist/server/app-optimistic-routing.js +34 -1
  167. package/dist/server/app-page-boundary-render.d.ts +20 -2
  168. package/dist/server/app-page-boundary-render.js +221 -38
  169. package/dist/server/app-page-boundary.d.ts +34 -5
  170. package/dist/server/app-page-boundary.js +40 -7
  171. package/dist/server/app-page-cache-finalizer.d.ts +2 -1
  172. package/dist/server/app-page-cache-finalizer.js +1 -1
  173. package/dist/server/app-page-cache-render.d.ts +10 -2
  174. package/dist/server/app-page-cache-render.js +14 -2
  175. package/dist/server/app-page-cache.js +2 -2
  176. package/dist/server/app-page-dispatch.d.ts +34 -1
  177. package/dist/server/app-page-dispatch.js +163 -34
  178. package/dist/server/app-page-element-builder.d.ts +17 -1
  179. package/dist/server/app-page-element-builder.js +187 -66
  180. package/dist/server/app-page-execution.d.ts +28 -1
  181. package/dist/server/app-page-execution.js +114 -5
  182. package/dist/server/app-page-head.d.ts +95 -3
  183. package/dist/server/app-page-head.js +307 -152
  184. package/dist/server/app-page-http-access-fallback-metadata.d.ts +48 -2
  185. package/dist/server/app-page-http-access-fallback-metadata.js +76 -1
  186. package/dist/server/app-page-method.d.ts +2 -1
  187. package/dist/server/app-page-probe.d.ts +2 -1
  188. package/dist/server/app-page-render-identity.d.ts +2 -1
  189. package/dist/server/app-page-render.d.ts +7 -1
  190. package/dist/server/app-page-render.js +35 -10
  191. package/dist/server/app-page-request.d.ts +14 -1
  192. package/dist/server/app-page-request.js +1 -1
  193. package/dist/server/app-page-route-wiring.d.ts +52 -2
  194. package/dist/server/app-page-route-wiring.js +197 -47
  195. package/dist/server/app-page-rsc-render-status.d.ts +2 -1
  196. package/dist/server/app-page-search-params-observation.d.ts +7 -2
  197. package/dist/server/app-page-search-params-observation.js +8 -1
  198. package/dist/server/app-page-segment-plan.d.ts +2 -1
  199. package/dist/server/app-page-stream.d.ts +31 -1
  200. package/dist/server/app-page-stream.js +23 -4
  201. package/dist/server/app-pages-bridge.d.ts +2 -1
  202. package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
  203. package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
  204. package/dist/server/app-prerender-endpoints.d.ts +2 -1
  205. package/dist/server/app-prerender-static-params.d.ts +2 -1
  206. package/dist/server/app-render-dependency.d.ts +11 -1
  207. package/dist/server/app-render-dependency.js +26 -7
  208. package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
  209. package/dist/server/app-response-stage-entry.d.ts +2 -1
  210. package/dist/server/app-route-handler-cache.d.ts +2 -1
  211. package/dist/server/app-route-handler-dispatch.d.ts +2 -1
  212. package/dist/server/app-route-handler-dispatch.js +1 -1
  213. package/dist/server/app-route-handler-execution.d.ts +2 -1
  214. package/dist/server/app-route-handler-response.d.ts +2 -1
  215. package/dist/server/app-route-handler-runtime.d.ts +2 -1
  216. package/dist/server/app-route-module-loader.d.ts +18 -1
  217. package/dist/server/app-route-module-loader.js +8 -0
  218. package/dist/server/app-route-tree-prefetch.d.ts +2 -1
  219. package/dist/server/app-rsc-error-handler.d.ts +2 -1
  220. package/dist/server/app-rsc-errors.d.ts +2 -1
  221. package/dist/server/app-rsc-handler.d.ts +2 -1
  222. package/dist/server/app-rsc-handler.js +6 -10
  223. package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
  224. package/dist/server/app-rsc-route-matching.d.ts +38 -1
  225. package/dist/server/app-rsc-route-matching.js +24 -0
  226. package/dist/server/app-segment-config.d.ts +2 -1
  227. package/dist/server/app-segment-config.js +1 -14
  228. package/dist/server/app-server-action-execution.d.ts +2 -1
  229. package/dist/server/app-server-action-execution.js +3 -3
  230. package/dist/server/app-ssr-entry.d.ts +6 -0
  231. package/dist/server/app-ssr-entry.js +91 -44
  232. package/dist/server/app-ssr-error-meta.d.ts +2 -1
  233. package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
  234. package/dist/server/app-ssr-stream.d.ts +22 -10
  235. package/dist/server/app-ssr-stream.js +299 -67
  236. package/dist/server/app-static-generation.d.ts +2 -1
  237. package/dist/server/app-streamed-client-references.d.ts +39 -0
  238. package/dist/server/app-streamed-client-references.js +156 -0
  239. package/dist/server/app-visited-response-cache.d.ts +2 -1
  240. package/dist/server/app-worker-stages.d.ts +2 -1
  241. package/dist/server/artifact-compatibility.d.ts +2 -1
  242. package/dist/server/bfcache-identity.d.ts +2 -1
  243. package/dist/server/cache-headers.d.ts +2 -1
  244. package/dist/server/cacheability-request.d.ts +2 -1
  245. package/dist/server/client-reuse-manifest.d.ts +2 -1
  246. package/dist/server/config-headers.d.ts +2 -1
  247. package/dist/server/csp.d.ts +2 -1
  248. package/dist/server/default-global-not-found-module.d.ts +2 -1
  249. package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
  250. package/dist/server/default-http-access-fallback-modules.js +31 -0
  251. package/dist/server/defer-until-stream-consumed.d.ts +34 -0
  252. package/dist/server/defer-until-stream-consumed.js +154 -21
  253. package/dist/server/dev-lockfile.d.ts +32 -2
  254. package/dist/server/dev-lockfile.js +46 -2
  255. package/dist/server/dev-module-runner.d.ts +2 -1
  256. package/dist/server/dev-server.js +10 -3
  257. package/dist/server/fetch-handler.js +1 -2
  258. package/dist/server/file-based-metadata.d.ts +2 -1
  259. package/dist/server/framework-tracer.d.ts +2 -1
  260. package/dist/server/html.d.ts +1 -0
  261. package/dist/server/html.js +19 -1
  262. package/dist/server/http-conditional.d.ts +2 -1
  263. package/dist/server/http-error-responses.d.ts +2 -1
  264. package/dist/server/implicit-tags.d.ts +2 -1
  265. package/dist/server/metadata-route-build-data.d.ts +2 -1
  266. package/dist/server/metadata-route-build-data.js +1 -1
  267. package/dist/server/metadata-route-response.d.ts +2 -1
  268. package/dist/server/metadata-route-response.js +1 -1
  269. package/dist/server/metadata-routes.d.ts +2 -1
  270. package/dist/server/middleware-runtime.d.ts +2 -1
  271. package/dist/server/navigation-trace.d.ts +2 -1
  272. package/dist/server/next-error-digest.d.ts +2 -1
  273. package/dist/server/nitro-public-files-plugin.d.ts +2 -1
  274. package/dist/server/nitro-public-files.d.ts +2 -1
  275. package/dist/server/opentelemetry-api.d.ts +2 -1
  276. package/dist/server/operation-token.d.ts +2 -1
  277. package/dist/server/pages-api-route.d.ts +2 -1
  278. package/dist/server/pages-asset-tags.d.ts +2 -1
  279. package/dist/server/pages-body-parser-config.d.ts +2 -1
  280. package/dist/server/pages-client-assets.d.ts +4 -0
  281. package/dist/server/pages-data-route.d.ts +2 -1
  282. package/dist/server/pages-document-asset-props.d.ts +2 -1
  283. package/dist/server/pages-document-initial-props.d.ts +2 -1
  284. package/dist/server/pages-execution-tracing.d.ts +2 -1
  285. package/dist/server/pages-execution-tracing.js +1 -1
  286. package/dist/server/pages-get-initial-props.d.ts +2 -1
  287. package/dist/server/pages-page-data.d.ts +7 -1
  288. package/dist/server/pages-page-data.js +35 -12
  289. package/dist/server/pages-page-handler.d.ts +3 -2
  290. package/dist/server/pages-page-handler.js +16 -7
  291. package/dist/server/pages-page-method.d.ts +2 -1
  292. package/dist/server/pages-page-response.d.ts +2 -1
  293. package/dist/server/pages-preview.d.ts +2 -1
  294. package/dist/server/pages-readiness.d.ts +2 -1
  295. package/dist/server/pages-request-pipeline.d.ts +2 -1
  296. package/dist/server/pages-request-pipeline.js +4 -5
  297. package/dist/server/pages-request-stage-entry.d.ts +2 -1
  298. package/dist/server/pages-response-stage-entry.d.ts +2 -1
  299. package/dist/server/pages-route-data-kind.d.ts +2 -1
  300. package/dist/server/prerender-cache-life-header.d.ts +2 -1
  301. package/dist/server/prerender-route-params.d.ts +2 -1
  302. package/dist/server/prod-server.js +9 -3
  303. package/dist/server/request-log.d.ts +2 -1
  304. package/dist/server/request-tracing.d.ts +2 -1
  305. package/dist/server/request-tracing.js +1 -1
  306. package/dist/server/response-start-tracing.js +7 -29
  307. package/dist/server/rsc-render-stream.d.ts +4 -0
  308. package/dist/server/rsc-render-stream.js +25 -0
  309. package/dist/server/seed-cache.d.ts +2 -1
  310. package/dist/server/seed-cache.js +1 -1
  311. package/dist/server/static-file-cache.d.ts +2 -1
  312. package/dist/server/static-file-cache.js +1 -0
  313. package/dist/server/static-layout-client-reuse-proof.d.ts +2 -1
  314. package/dist/server/worker-revalidation-context.d.ts +2 -1
  315. package/dist/server/worker-stages.d.ts +2 -1
  316. package/dist/shims/app.d.ts +2 -1
  317. package/dist/shims/cache-callable-runtime.d.ts +2 -1
  318. package/dist/shims/cache-handler.d.ts +8 -3
  319. package/dist/shims/cache-handler.js +29 -9
  320. package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
  321. package/dist/shims/caught-not-found-boundaries.js +48 -0
  322. package/dist/shims/cdn-purge-routes.d.ts +2 -1
  323. package/dist/shims/client-locale.js +2 -1
  324. package/dist/shims/client-page-root.d.ts +2 -1
  325. package/dist/shims/config.d.ts +2 -1
  326. package/dist/shims/default-forbidden.d.ts +4 -0
  327. package/dist/shims/default-forbidden.js +18 -0
  328. package/dist/shims/default-not-found.d.ts +0 -5
  329. package/dist/shims/default-not-found.js +5 -41
  330. package/dist/shims/default-unauthorized.d.ts +4 -0
  331. package/dist/shims/default-unauthorized.js +18 -0
  332. package/dist/shims/error-boundary.d.ts +39 -3
  333. package/dist/shims/error-boundary.js +31 -16
  334. package/dist/shims/font-google.js +1 -2
  335. package/dist/shims/font-utils.d.ts +3 -2
  336. package/dist/shims/font-utils.js +5 -3
  337. package/dist/shims/form.js +1 -1
  338. package/dist/shims/http-access-error-fallback.d.ts +7 -0
  339. package/dist/shims/http-access-error-fallback.js +47 -0
  340. package/dist/shims/image.d.ts +1 -22
  341. package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
  342. package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
  343. package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
  344. package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
  345. package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
  346. package/dist/shims/internal/client-reference-loader.d.ts +7 -0
  347. package/dist/shims/internal/client-reference-loader.js +91 -0
  348. package/dist/shims/internal/cookie-serialize.d.ts +2 -1
  349. package/dist/shims/internal/cookies.js +1 -2
  350. package/dist/shims/internal/headers-state.d.ts +2 -0
  351. package/dist/shims/internal/headers-state.js +6 -1
  352. package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +2 -1
  353. package/dist/shims/internal/interpolate-as.d.ts +2 -1
  354. package/dist/shims/internal/pages-data-target.d.ts +2 -1
  355. package/dist/shims/internal/pages-data-url.d.ts +2 -1
  356. package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
  357. package/dist/shims/link.js +195 -52
  358. package/dist/shims/metadata.d.ts +32 -11
  359. package/dist/shims/metadata.js +88 -26
  360. package/dist/shims/navigation-errors.d.ts +2 -1
  361. package/dist/shims/navigation.d.ts +22 -2
  362. package/dist/shims/navigation.js +74 -20
  363. package/dist/shims/pages-router-runtime.d.ts +2 -1
  364. package/dist/shims/ppr-fallback-shell.d.ts +2 -1
  365. package/dist/shims/router.js +14 -3
  366. package/dist/shims/unified-request-context.js +3 -3
  367. package/dist/typegen.d.ts +2 -1
  368. package/dist/utils/client-build-manifest.d.ts +4 -1
  369. package/dist/utils/client-build-manifest.js +9 -2
  370. package/dist/utils/client-entry-manifest.d.ts +13 -0
  371. package/dist/utils/client-entry-manifest.js +20 -1
  372. package/dist/utils/client-reference-chunks.d.ts +45 -0
  373. package/dist/utils/client-reference-chunks.js +30 -0
  374. package/dist/utils/client-runtime-metadata.d.ts +9 -1
  375. package/dist/utils/client-runtime-metadata.js +40 -9
  376. package/dist/utils/compare.d.ts +9 -0
  377. package/dist/utils/compare.js +15 -1
  378. package/dist/utils/lazy-chunks.d.ts +14 -0
  379. package/dist/utils/lazy-chunks.js +27 -1
  380. package/dist/utils/middleware-request-headers.d.ts +2 -1
  381. package/dist/utils/project.d.ts +2 -1
  382. package/dist/utils/project.js +9 -1
  383. package/dist/utils/query.d.ts +2 -1
  384. package/dist/utils/sorted-array.d.ts +2 -1
  385. package/dist/utils/vite-cli-invocation.d.ts +2 -1
  386. package/package.json +5 -5
  387. package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
  388. package/dist/server/default-not-found-module.d.ts +0 -19
  389. package/dist/server/default-not-found-module.js +0 -18
  390. package/dist/server/rsc-stream-hints.d.ts +0 -21
  391. package/dist/server/rsc-stream-hints.js +0 -227
@@ -131,7 +131,7 @@ function createStaticSegmentGraph(routes) {
131
131
  treePath
132
132
  });
133
133
  }
134
- addRouteManifestSegmentErrorBoundaryFacts({
134
+ addRouteManifestSegmentBoundaryFacts({
135
135
  boundaries,
136
136
  route
137
137
  });
@@ -303,19 +303,42 @@ function addRouteManifestBoundaryFacts(input) {
303
303
  addRouteManifestBoundaryFact(input, "forbidden", input.route.forbiddenPaths[input.layoutIndex]);
304
304
  addRouteManifestBoundaryFact(input, "unauthorized", input.route.unauthorizedPaths[input.layoutIndex]);
305
305
  }
306
- function addRouteManifestSegmentErrorBoundaryFacts(input) {
307
- for (const [index, boundaryPath] of (input.route.errorPaths ?? []).entries()) {
308
- const treePosition = input.route.errorTreePositions?.[index];
309
- assertRouteManifestBoundaryTreePosition(input.route, boundaryPath, treePosition);
310
- const ownerLayoutId = findRouteManifestOwnerLayoutId(input.route, treePosition);
306
+ function addRouteManifestSegmentBoundaryFacts(input) {
307
+ const { route } = input;
308
+ const segmentBoundaries = [
309
+ [
310
+ "error",
311
+ route.errorPaths,
312
+ route.errorTreePositions
313
+ ],
314
+ [
315
+ "notFound",
316
+ route.segmentNotFoundPaths,
317
+ route.segmentNotFoundTreePositions
318
+ ],
319
+ [
320
+ "forbidden",
321
+ route.segmentForbiddenPaths,
322
+ route.segmentForbiddenTreePositions
323
+ ],
324
+ [
325
+ "unauthorized",
326
+ route.segmentUnauthorizedPaths,
327
+ route.segmentUnauthorizedTreePositions
328
+ ]
329
+ ];
330
+ for (const [outcome, boundaryPaths, treePositions] of segmentBoundaries) for (const [index, boundaryPath] of (boundaryPaths ?? []).entries()) {
331
+ const treePosition = treePositions?.[index];
332
+ assertRouteManifestBoundaryTreePosition(route, boundaryPath, treePosition);
333
+ const ownerLayoutId = findRouteManifestOwnerLayoutId(route, treePosition);
311
334
  if (ownerLayoutId !== null) continue;
312
- const treePath = createAppRouteGraphTreePath(input.route.routeSegments, treePosition);
335
+ const treePath = createAppRouteGraphTreePath(route.routeSegments, treePosition);
313
336
  addRouteManifestBoundaryFact({
314
337
  boundaries: input.boundaries,
315
- route: input.route,
338
+ route,
316
339
  layoutId: ownerLayoutId,
317
340
  treePath
318
- }, "error", boundaryPath);
341
+ }, outcome, boundaryPath);
319
342
  }
320
343
  }
321
344
  function addRouteManifestBoundaryFact(input, outcome, boundaryPath) {
@@ -458,14 +481,11 @@ function discoverSlotSubRoutes(routes, matcher, ghostParents = []) {
458
481
  const subPage = slotPages.get(slot.key);
459
482
  if (subPage !== void 0) {
460
483
  const configLayoutPaths = findSlotConfigLayoutPaths(slot.ownerDir, subPage, matcher);
461
- const notFoundBoundary = findSlotNotFoundBoundary(slot.ownerDir, subPage, matcher);
462
484
  return withSlotLoadingEntries({
463
485
  ...slot,
464
486
  pagePath: subPage,
465
487
  configLayoutPaths,
466
488
  configLayoutTreePositions: findSlotConfigLayoutTreePositions(slot.ownerDir, configLayoutPaths),
467
- notFoundPath: notFoundBoundary.path,
468
- notFoundTreePosition: notFoundBoundary.treePosition,
469
489
  routeSegments: rawSegments
470
490
  }, subPage, matcher);
471
491
  }
@@ -547,14 +567,11 @@ function discoverSlotSubRoutes(routes, matcher, ghostParents = []) {
547
567
  const subSlots = parentRoute.parallelSlots.map((slot) => {
548
568
  const subPage = slotPages.get(slot.key);
549
569
  const configLayoutPaths = findSlotConfigLayoutPaths(slot.ownerDir, subPage ?? null, matcher);
550
- const notFoundBoundary = findSlotNotFoundBoundary(slot.ownerDir, subPage ?? null, matcher);
551
570
  return withSlotLoadingEntries({
552
571
  ...slot,
553
572
  pagePath: subPage || null,
554
573
  configLayoutPaths,
555
574
  configLayoutTreePositions: findSlotConfigLayoutTreePositions(slot.ownerDir, configLayoutPaths),
556
- notFoundPath: notFoundBoundary.path,
557
- notFoundTreePosition: notFoundBoundary.treePosition,
558
575
  routeSegments: subPage ? rawSegments : null
559
576
  }, subPage ?? null, matcher);
560
577
  });
@@ -593,6 +610,12 @@ function discoverSlotSubRoutes(routes, matcher, ghostParents = []) {
593
610
  unauthorizedPath: parentRoute.unauthorizedPath,
594
611
  unauthorizedTreePosition: parentRoute.unauthorizedTreePosition,
595
612
  unauthorizedPaths: parentRoute.unauthorizedPaths,
613
+ segmentNotFoundPaths: parentRoute.segmentNotFoundPaths,
614
+ segmentNotFoundTreePositions: parentRoute.segmentNotFoundTreePositions,
615
+ segmentForbiddenPaths: parentRoute.segmentForbiddenPaths,
616
+ segmentForbiddenTreePositions: parentRoute.segmentForbiddenTreePositions,
617
+ segmentUnauthorizedPaths: parentRoute.segmentUnauthorizedPaths,
618
+ segmentUnauthorizedTreePositions: parentRoute.segmentUnauthorizedTreePositions,
596
619
  routeSegments: [...parentRoute.routeSegments, ...rawSegments],
597
620
  childrenRouteSegments: childrenDefault ? parentRoute.routeSegments : void 0,
598
621
  templateTreePositions: parentRoute.templateTreePositions,
@@ -680,52 +703,52 @@ function findSlotConfigLayoutTreePositions(slotDir, layoutPaths) {
680
703
  });
681
704
  }
682
705
  function findSlotLoadingEntries(slotDir, pagePath, matcher) {
706
+ return findSlotSegmentFileEntries(slotDir, pagePath, "loading", matcher);
707
+ }
708
+ /** Find a convention file in each directory from the slot root to the page, outermost first. */
709
+ function findSlotSegmentFileEntries(slotDir, pagePath, fileName, matcher) {
683
710
  const pageDir = pagePath ? path.dirname(pagePath) : slotDir;
684
711
  if (pageDir !== slotDir && !pageDir.startsWith(`${slotDir}${path.sep}`)) return [];
685
712
  const relativeDir = path.relative(slotDir, pageDir);
686
713
  const segments = relativeDir ? relativeDir.split(path.sep).filter(Boolean) : [];
687
- const loadings = [];
714
+ const entries = [];
688
715
  let currentDir = slotDir;
689
- const rootLoading = findFile(currentDir, "loading", matcher);
690
- if (rootLoading) loadings.push({
691
- path: rootLoading,
716
+ const rootEntry = findFile(currentDir, fileName, matcher);
717
+ if (rootEntry) entries.push({
718
+ path: rootEntry,
692
719
  treePosition: 0
693
720
  });
694
721
  for (let index = 0; index < segments.length; index++) {
695
722
  currentDir = path.join(currentDir, segments[index]);
696
- const loading = findFile(currentDir, "loading", matcher);
697
- if (loading) loadings.push({
698
- path: loading,
723
+ const entry = findFile(currentDir, fileName, matcher);
724
+ if (entry) entries.push({
725
+ path: entry,
699
726
  treePosition: index + 1
700
727
  });
701
728
  }
702
- return loadings;
729
+ return entries;
703
730
  }
704
731
  function withSlotLoadingEntries(slot, pagePath, matcher) {
705
732
  const loadingEntries = findSlotLoadingEntries(slot.ownerDir, pagePath, matcher);
706
733
  return {
707
734
  ...slot,
708
735
  loadingPaths: loadingEntries.map((entry) => entry.path),
709
- loadingTreePositions: loadingEntries.map((entry) => entry.treePosition)
736
+ loadingTreePositions: loadingEntries.map((entry) => entry.treePosition),
737
+ ...findSlotNotFoundFields(slot.ownerDir, pagePath, matcher)
710
738
  };
711
739
  }
712
- function findSlotNotFoundBoundary(slotDir, pagePath, matcher) {
713
- let dir = pagePath ? path.dirname(pagePath) : slotDir;
714
- while (dir === slotDir || dir.startsWith(`${slotDir}${path.sep}`)) {
715
- const boundaryPath = findFile(dir, "not-found", matcher);
716
- if (boundaryPath) {
717
- const relativeDir = path.relative(slotDir, dir);
718
- return {
719
- path: boundaryPath,
720
- treePosition: relativeDir ? relativeDir.split(path.sep).filter(Boolean).length : 0
721
- };
722
- }
723
- if (dir === slotDir) break;
724
- dir = path.dirname(dir);
725
- }
740
+ /**
741
+ * Every not-found convention on the slot's active branch, plus the nearest one,
742
+ * which supplies the slot's not-found metadata.
743
+ */
744
+ function findSlotNotFoundFields(slotDir, pagePath, matcher) {
745
+ const entries = findSlotSegmentFileEntries(slotDir, pagePath, "not-found", matcher);
746
+ const nearest = entries.at(-1);
726
747
  return {
727
- path: null,
728
- treePosition: null
748
+ notFoundPath: nearest?.path ?? null,
749
+ notFoundTreePosition: nearest?.treePosition ?? null,
750
+ notFoundPaths: entries.map((entry) => entry.path),
751
+ notFoundTreePositions: entries.map((entry) => entry.treePosition)
729
752
  };
730
753
  }
731
754
  /**
@@ -801,6 +824,10 @@ function directoryToAppRoute(dir, appDir, matcher, pagePath, routePath, includeN
801
824
  const notFoundPaths = discoverBoundaryFilePerLayout(layouts, "not-found", matcher);
802
825
  const forbiddenPaths = discoverBoundaryFilePerLayout(layouts, "forbidden", matcher);
803
826
  const unauthorizedPaths = discoverBoundaryFilePerLayout(layouts, "unauthorized", matcher);
827
+ const discoverPageSegmentBoundaryFiles = (fileName) => pagePath === null && routePath !== null ? [] : discoverSegmentBoundaryFiles(segments, appDir, fileName, matcher);
828
+ const segmentNotFounds = discoverPageSegmentBoundaryFiles("not-found");
829
+ const segmentForbiddens = discoverPageSegmentBoundaryFiles("forbidden");
830
+ const segmentUnauthorizeds = discoverPageSegmentBoundaryFiles("unauthorized");
804
831
  const parallelSlots = discoverInheritedParallelSlots(segments, appDir, routeDir, matcher, includeNestedOnlySlots);
805
832
  return {
806
833
  ids: createAppRouteSemanticIds({
@@ -833,6 +860,12 @@ function directoryToAppRoute(dir, appDir, matcher, pagePath, routePath, includeN
833
860
  forbiddenTreePosition: forbiddenEntry?.treePosition ?? null,
834
861
  unauthorizedPath,
835
862
  unauthorizedTreePosition: unauthorizedEntry?.treePosition ?? null,
863
+ segmentNotFoundPaths: segmentNotFounds.map((entry) => entry.path),
864
+ segmentNotFoundTreePositions: segmentNotFounds.map((entry) => entry.treePosition),
865
+ segmentForbiddenPaths: segmentForbiddens.map((entry) => entry.path),
866
+ segmentForbiddenTreePositions: segmentForbiddens.map((entry) => entry.treePosition),
867
+ segmentUnauthorizedPaths: segmentUnauthorizeds.map((entry) => entry.path),
868
+ segmentUnauthorizedTreePositions: segmentUnauthorizeds.map((entry) => entry.treePosition),
836
869
  unauthorizedPaths,
837
870
  routeSegments: segments,
838
871
  templateTreePositions,
@@ -1034,6 +1067,24 @@ function discoverBoundaryFileEntry(segments, appDir, fileName, matcher) {
1034
1067
  return null;
1035
1068
  }
1036
1069
  /**
1070
+ * Discover boundary files (not-found, forbidden, unauthorized) by segment tree
1071
+ * position. As with error.tsx, Next.js wraps each segment's children in its
1072
+ * boundary whether or not the segment has a layout.
1073
+ */
1074
+ function discoverSegmentBoundaryFiles(segments, appDir, fileName, matcher) {
1075
+ const boundaries = [];
1076
+ let currentDir = appDir;
1077
+ for (let index = 0; index <= segments.length; index++) {
1078
+ if (index > 0) currentDir = path.join(currentDir, segments[index - 1]);
1079
+ const boundary = findFile(currentDir, fileName, matcher);
1080
+ if (boundary) boundaries.push({
1081
+ path: boundary,
1082
+ treePosition: index
1083
+ });
1084
+ }
1085
+ return boundaries;
1086
+ }
1087
+ /**
1037
1088
  * Discover boundary files (not-found, forbidden, unauthorized) at each layout directory.
1038
1089
  * Returns an array aligned with the layouts array, where each entry is the boundary
1039
1090
  * file at that layout's directory, or null if none exists there.
@@ -1271,7 +1322,6 @@ function discoverParallelSlots(dir, appDir, matcher, includeNestedOnlySlots = fa
1271
1322
  const ownerTreePath = createAppRouteGraphTreePath(ownerSegments, ownerSegments.length);
1272
1323
  const configLayoutPaths = findSlotConfigLayoutPaths(slotDir, pagePath, matcher);
1273
1324
  const loadingEntries = findSlotLoadingEntries(slotDir, pagePath, matcher);
1274
- const notFoundBoundary = findSlotNotFoundBoundary(slotDir, pagePath, matcher);
1275
1325
  slots.push({
1276
1326
  id: createAppRouteGraphSlotId(slotName, ownerTreePath),
1277
1327
  key: `${slotName}@${path.relative(appDir, slotDir)}`,
@@ -1289,8 +1339,7 @@ function discoverParallelSlots(dir, appDir, matcher, includeNestedOnlySlots = fa
1289
1339
  loadingPaths: loadingEntries.map((loading) => loading.path),
1290
1340
  loadingTreePositions: loadingEntries.map((loading) => loading.treePosition),
1291
1341
  errorPath: findFile(slotDir, "error", matcher),
1292
- notFoundPath: notFoundBoundary.path,
1293
- notFoundTreePosition: notFoundBoundary.treePosition,
1342
+ ...findSlotNotFoundFields(slotDir, pagePath, matcher),
1294
1343
  interceptingRoutes,
1295
1344
  layoutIndex: -1,
1296
1345
  routeSegments: pagePath ? [] : null
@@ -1440,7 +1489,7 @@ function findOwnerRouteForDir(dir, appDir, routes, routesByDir) {
1440
1489
  * Recursively scan a directory tree for page.tsx files that are inside
1441
1490
  * intercepting route directories.
1442
1491
  */
1443
- function scanForInterceptingPages(currentDir, slotRootDir, routeDir, appDir, results, matcher, parentLoadingEntries = []) {
1492
+ function scanForInterceptingPages(currentDir, slotRootDir, routeDir, appDir, results, matcher, parentLoadingEntries = [], parentLayoutPaths = []) {
1444
1493
  if (!fs.existsSync(currentDir)) return;
1445
1494
  const entries = fs.readdirSync(currentDir, { withFileTypes: true });
1446
1495
  for (const entry of entries) {
@@ -1450,13 +1499,14 @@ function scanForInterceptingPages(currentDir, slotRootDir, routeDir, appDir, res
1450
1499
  const interceptDir = path.join(currentDir, entry.name);
1451
1500
  if (interceptMatch) {
1452
1501
  const restOfName = entry.name.slice(interceptMatch.prefix.length);
1453
- collectInterceptingPages(interceptDir, interceptDir, interceptMatch.convention, restOfName, routeDir, appDir, currentDir, slotRootDir, results, matcher, [], parentLoadingEntries, path.relative(slotRootDir, currentDir).split(path.sep).filter(Boolean).length);
1502
+ collectInterceptingPages(interceptDir, interceptDir, interceptMatch.convention, restOfName, routeDir, appDir, currentDir, slotRootDir, results, matcher, parentLayoutPaths, parentLoadingEntries, path.relative(slotRootDir, currentDir).split(path.sep).filter(Boolean).length);
1454
1503
  } else {
1504
+ const layout = findFile(interceptDir, "layout", matcher);
1455
1505
  const loading = findFile(interceptDir, "loading", matcher);
1456
1506
  scanForInterceptingPages(interceptDir, slotRootDir, routeDir, appDir, results, matcher, loading ? [...parentLoadingEntries, {
1457
1507
  path: loading,
1458
1508
  treePosition: path.relative(slotRootDir, interceptDir).split(path.sep).filter(Boolean).length
1459
- }] : parentLoadingEntries);
1509
+ }] : parentLoadingEntries, layout ? [...parentLayoutPaths, layout] : parentLayoutPaths);
1460
1510
  }
1461
1511
  }
1462
1512
  }
@@ -1486,7 +1536,15 @@ function collectInterceptingPages(currentDir, interceptRoot, convention, interce
1486
1536
  const targetPattern = computeInterceptTarget(convention, interceptSegment, currentDir, interceptRoot, routeDir, appDir);
1487
1537
  if (targetPattern) {
1488
1538
  const sourceMatchPattern = computeInterceptSourceMatchPattern(interceptParentDir, appDir);
1489
- const notFoundBoundary = findSlotNotFoundBoundary(slotRootDir ?? interceptRoot, page, matcher);
1539
+ const notFoundTreePositionOffset = slotRootDir ? 0 : 1;
1540
+ const notFoundFields = findSlotNotFoundFields(slotRootDir ?? interceptRoot, page, matcher);
1541
+ const findInterceptBoundaries = (fileName) => findSlotSegmentFileEntries(slotRootDir ?? interceptRoot, page, fileName, matcher).map((entry) => ({
1542
+ path: entry.path,
1543
+ treePosition: entry.treePosition + notFoundTreePositionOffset
1544
+ }));
1545
+ const forbiddenBoundaries = findInterceptBoundaries("forbidden");
1546
+ const unauthorizedBoundaries = findInterceptBoundaries("unauthorized");
1547
+ const errorBoundaries = findInterceptBoundaries("error");
1490
1548
  const slotParentSegments = slotRootDir ? path.relative(slotRootDir, interceptParentDir).split(path.sep).filter(Boolean) : [];
1491
1549
  const branchSegments = [
1492
1550
  ...slotParentSegments,
@@ -1498,7 +1556,9 @@ function collectInterceptingPages(currentDir, interceptRoot, convention, interce
1498
1556
  convention,
1499
1557
  layoutPaths: [...layoutPaths],
1500
1558
  layoutSegments: layoutPaths.map((layoutPath) => {
1501
- const relativeDir = path.relative(interceptRoot, path.dirname(layoutPath));
1559
+ const layoutDir = path.dirname(layoutPath);
1560
+ if (slotRootDir && layoutDir !== interceptRoot && !layoutDir.startsWith(`${interceptRoot}${path.sep}`)) return path.relative(slotRootDir, layoutDir).split(path.sep).filter(Boolean);
1561
+ const relativeDir = path.relative(interceptRoot, layoutDir);
1502
1562
  return [
1503
1563
  ...slotParentSegments,
1504
1564
  interceptSegment,
@@ -1508,8 +1568,20 @@ function collectInterceptingPages(currentDir, interceptRoot, convention, interce
1508
1568
  loadingPaths: loadingEntries.map((loading) => loading.path),
1509
1569
  loadingTreePositions: loadingEntries.map((loading) => loading.treePosition),
1510
1570
  notFoundBranchSegments: branchSegments,
1511
- notFoundPath: notFoundBoundary.path,
1512
- notFoundTreePosition: notFoundBoundary.treePosition === null ? null : slotRootDir ? notFoundBoundary.treePosition : notFoundBoundary.treePosition + 1,
1571
+ notFoundPath: notFoundFields.notFoundPath,
1572
+ notFoundTreePosition: notFoundFields.notFoundTreePosition == null ? null : notFoundFields.notFoundTreePosition + notFoundTreePositionOffset,
1573
+ notFoundPaths: notFoundFields.notFoundPaths,
1574
+ notFoundTreePositions: notFoundFields.notFoundTreePositions?.map((treePosition) => treePosition + notFoundTreePositionOffset),
1575
+ forbiddenPath: forbiddenBoundaries.at(-1)?.path ?? null,
1576
+ forbiddenTreePosition: forbiddenBoundaries.at(-1)?.treePosition ?? null,
1577
+ forbiddenPaths: forbiddenBoundaries.map((boundary) => boundary.path),
1578
+ forbiddenTreePositions: forbiddenBoundaries.map((boundary) => boundary.treePosition),
1579
+ unauthorizedPath: unauthorizedBoundaries.at(-1)?.path ?? null,
1580
+ unauthorizedTreePosition: unauthorizedBoundaries.at(-1)?.treePosition ?? null,
1581
+ unauthorizedPaths: unauthorizedBoundaries.map((boundary) => boundary.path),
1582
+ unauthorizedTreePositions: unauthorizedBoundaries.map((boundary) => boundary.treePosition),
1583
+ errorPaths: errorBoundaries.map((boundary) => boundary.path),
1584
+ errorTreePositions: errorBoundaries.map((boundary) => boundary.treePosition),
1513
1585
  targetPattern: targetPattern.pattern,
1514
1586
  sourceMatchPattern,
1515
1587
  pagePath: page,
@@ -40,4 +40,5 @@ export type BrowserRouteManifestWire = {
40
40
  };
41
41
  export declare function toBrowserRouteManifestWire(routeManifest: RouteManifest): BrowserRouteManifestWire;
42
42
  export declare function decodeBrowserRouteManifest(wire: BrowserRouteManifestWire): BrowserRouteManifest;
43
- //#endregion
43
+ //#endregion
44
+ export {};
@@ -24,4 +24,5 @@ export type OptimisticRouteTrieMatch<Route extends OptimisticTrieRoute> = {
24
24
  };
25
25
  export declare function buildOptimisticRouteTrie<Route extends OptimisticTrieRoute>(routes: Iterable<Route>, onDynamicSegmentConflict?: (existingParamName: string, part: string) => void): OptimisticRouteTrieNode<Route>;
26
26
  export declare function matchOptimisticRouteTrie<Route extends OptimisticTrieRoute>(trie: OptimisticRouteTrieNode<Route>, urlParts: readonly string[]): OptimisticRouteTrieMatch<Route> | null;
27
- //#endregion
27
+ //#endregion
28
+ export {};
@@ -35,4 +35,5 @@ export declare function matchRouteWithTrieRawPathname<R extends {
35
35
  route: R;
36
36
  params: Record<string, string | string[]>;
37
37
  } | null;
38
- //#endregion
38
+ //#endregion
39
+ export {};
@@ -68,4 +68,5 @@ export declare function normalizeStaticPathname(pathname: string): string;
68
68
  * locale handling should be added here, not duplicated at call sites.
69
69
  */
70
70
  export declare function normalizeStaticPathsEntry(entry: StaticPathsEntry, routePattern: string): NormalizedStaticPathsEntry;
71
- //#endregion
71
+ //#endregion
72
+ export {};
@@ -23,4 +23,5 @@ export declare function selectContentEncoding<T extends ContentEncoding>(parsed:
23
23
  export declare const HAS_ZSTD: boolean;
24
24
  /** Select by client q-value first, then zstd > br > gzip > deflate > identity. */
25
25
  export declare function negotiateEncoding(req: IncomingMessage): NegotiatedEncoding;
26
- //#endregion
26
+ //#endregion
27
+ export {};
@@ -22,4 +22,5 @@ export declare function createForwardedActionContext(executionContext: Execution
22
22
  actionForwarded: true;
23
23
  } & Partial<ExecutionContextLike>;
24
24
  export declare function forwardServerActionIfNeeded(options: ForwardServerActionOptions): Promise<Response | null>;
25
- //#endregion
25
+ //#endregion
26
+ export {};
@@ -31,4 +31,5 @@ export declare function preserveBfcacheIdsForMergedElements(options: {
31
31
  preservedElementIds?: readonly string[];
32
32
  preservePreviousIds?: readonly string[];
33
33
  }): BfcacheIdMap;
34
- //#endregion
34
+ //#endregion
35
+ export {};
@@ -62,4 +62,5 @@ type DiscardedServerActionRefreshSchedulerOptions = {
62
62
  runRefresh: () => void;
63
63
  };
64
64
  export declare function createDiscardedServerActionRefreshScheduler(options: DiscardedServerActionRefreshSchedulerOptions): DiscardedServerActionRefreshScheduler;
65
- //#endregion
65
+ //#endregion
66
+ export {};
@@ -7,4 +7,5 @@ type CreateClientReuseManifestHeaderOptions = Readonly<{
7
7
  limits?: ClientReuseManifestLimits;
8
8
  }>;
9
9
  export declare function createClientReuseManifestHeaderFromVisibleAppState(state: VisibleAppState, options?: CreateClientReuseManifestHeaderOptions): string | null;
10
- //#endregion
10
+ //#endregion
11
+ export {};
@@ -15,7 +15,7 @@ import { DevRecoveryBoundary, GlobalErrorBoundary, RedirectBoundary } from "../s
15
15
  import { beginAppRouterScrollIntent, consumeAppRouterScrollIntent } from "../shims/app-router-scroll-state.js";
16
16
  import { AppRouterScrollCommitProvider } from "../shims/app-router-scroll.js";
17
17
  import { BfcacheIdentityMapContext, bindAppElementsRenderedSearch, setAppElementsRenderedSearch } from "../shims/slot.js";
18
- import { VINEXT_RSC_COMPATIBILITY_ID_HEADER, VINEXT_RSC_CONTENT_TYPE, createRscRequestHeaders, createRscRequestUrl, formatRscRequestPath } from "./app-rsc-cache-busting.js";
18
+ import { VINEXT_RSC_COMPATIBILITY_ID_HEADER, VINEXT_RSC_CONTENT_TYPE, createRscRequestHeaders, createRscRequestUrl, formatRscRequestPath, isRscCompatibilityIdCompatible } from "./app-rsc-cache-busting.js";
19
19
  import { notifyAppRouterTransitionStart } from "../client/instrumentation-client-state.js";
20
20
  import "../client/instrumentation-client.js";
21
21
  import { createNavigationRuntimeRouteManifestLoader, getNavigationRuntime, loadNavigationRuntimeRouteManifest, registerNavigationRuntimeBootstrap, registerNavigationRuntimeFunctions } from "../client/navigation-runtime.js";
@@ -43,7 +43,7 @@ import { createPopstateRestoreHandler, restoreSynchronousPopstateScrollPosition,
43
43
  import { createDevOnCaughtError, createOnUncaughtError, createProdOnCaughtError, createProdOnRecoverableError } from "./app-browser-error.js";
44
44
  import { createHydrationCachePublication } from "./app-hydration-cache-publication.js";
45
45
  import { peekSettledPrefetchResponseForNavigation, prepareConsumedPrefetchResponseForPublication, preserveCommittedPrefetchExpiry, resolvePrefetchNavigationResponseUrl } from "./app-browser-prefetch-response.js";
46
- import { canCommitOptimisticRouteTemplate, createOptimisticRouteTemplate, getOptimisticPrefetchSourceKey, getOptimisticRouteTemplateKey, resolveOptimisticNavigationParamsForHref, resolveOptimisticNavigationPayload } from "./app-optimistic-routing.js";
46
+ import { canCommitOptimisticRouteTemplate, createOptimisticRouteTemplate, getOptimisticPrefetchSourceKey, getOptimisticRouteTemplateKey, keepOptimisticStreamingMetadata, resolveOptimisticNavigationParamsForHref, resolveOptimisticNavigationPayload } from "./app-optimistic-routing.js";
47
47
  import { removeStylesheetLinksCoveredByInlineCss } from "./app-inline-css-client.js";
48
48
  import { createElement, startTransition, use, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
49
49
  import { flushSync } from "react-dom";
@@ -67,6 +67,15 @@ const MAX_VISITED_RESPONSE_CACHE_SIZE = 50;
67
67
  const IS_STATIC_EXPORT = process.env.NODE_ENV === "production" && process.env.__NEXT_CONFIG_OUTPUT === "export";
68
68
  let clientDeploymentVersion = null;
69
69
  let clientRscCompatibilityId = IS_STATIC_EXPORT ? null : "vinext:missing";
70
+ /**
71
+ * Decoding a payload loads the chunks its client references name, so a
72
+ * payload this page can't navigate to is only decoded by the navigation that
73
+ * hard-navigates. Otherwise a prefetch after a deploy would load the new
74
+ * deployment's code and stylesheets into this page.
75
+ */
76
+ function isRscResponseCompatible(compatibilityIdHeader) {
77
+ return isRscCompatibilityIdCompatible(compatibilityIdHeader, clientRscCompatibilityId);
78
+ }
70
79
  function setClientRscCompatibilityId(compatibilityId) {
71
80
  if (IS_STATIC_EXPORT || !compatibilityId) return;
72
81
  clientRscCompatibilityId = compatibilityId;
@@ -309,6 +318,10 @@ async function fetchPersistedSourcePageRefresh(options) {
309
318
  * read the query the server rendered it with, not the navigation's.
310
319
  */
311
320
  async function decodeSupplementalRefresh(response, targetPathname) {
321
+ if (!isRscResponseCompatible(response.headers.get("X-Vinext-RSC-Compatibility-Id"))) {
322
+ response.body?.cancel().catch(() => {});
323
+ throw new Error("[vinext] Refreshed another deployment's payload");
324
+ }
312
325
  const elements = await decodeAppElementsPromise(createFromFetch(Promise.resolve(response)));
313
326
  const renderedPathAndSearch = parseRenderedPathAndSearchHeader(response.headers.get(VINEXT_RENDERED_PATH_AND_SEARCH_HEADER));
314
327
  setAppElementsRenderedSearch(elements, new URL(renderedPathAndSearch ?? targetPathname, window.location.origin).search);
@@ -333,6 +346,7 @@ async function learnOptimisticRouteTemplateFromPrefetch(options) {
333
346
  if (source.interceptionContext !== options.interceptionContext) return false;
334
347
  if (resolvePrefetchCacheEntryMountedSlotsHeader(options.entry) !== options.mountedSlotsHeader) return false;
335
348
  if (options.interceptionContext !== null) return false;
349
+ if (!isRscResponseCompatible(options.entry.snapshot.compatibilityIdHeader)) return false;
336
350
  const elements = await decodeAppElementsPromise(createFromFetch(Promise.resolve(restoreRscResponse(options.entry.snapshot))));
337
351
  const template = createOptimisticRouteTemplate({
338
352
  allowLoadingShell: options.entry.optimisticRouteShell === true,
@@ -1118,6 +1132,12 @@ function bootstrapHydration(rscStream, devErrorOverlay, initialRscBootstrap) {
1118
1132
  let currentPrevNextUrl = previousNextUrlOverride;
1119
1133
  let redirectCount = redirectDepth;
1120
1134
  let detachedNavigationCommits = false;
1135
+ let optimisticShellElements = null;
1136
+ const keepOptimisticShellMetadata = (payload) => {
1137
+ const shellElements = optimisticShellElements;
1138
+ if (shellElements === null) return payload;
1139
+ return payload instanceof Promise ? payload.then((elements) => keepOptimisticStreamingMetadata(elements, shellElements, String(navId))) : keepOptimisticStreamingMetadata(payload, shellElements, String(navId));
1140
+ };
1121
1141
  const activeTraversalIntent = navigationKind === "traverse" ? traversalIntent ?? historyController.resolveTraversalIntent(window.history.state) : null;
1122
1142
  let startedHardNavigation = false;
1123
1143
  const performHardNavigationForScrollIntent = (targetHref, mode) => {
@@ -1284,7 +1304,7 @@ function bootstrapHydration(rscStream, devErrorOverlay, initialRscBootstrap) {
1284
1304
  navId,
1285
1305
  operationLane: toOperationLane(navigationKind),
1286
1306
  params: cachedParams,
1287
- payload: cachedPayload,
1307
+ payload: keepOptimisticShellMetadata(cachedPayload),
1288
1308
  payloadOrigin: cachedRoute.elements ? COMMITTED_CACHE_APP_NAVIGATION_PAYLOAD_ORIGIN : VISITED_CACHE_APP_NAVIGATION_PAYLOAD_ORIGIN,
1289
1309
  pendingRouterState: detachedNavigationCommits ? null : pendingRouterState,
1290
1310
  previousNextUrl: requestPreviousNextUrl,
@@ -1372,6 +1392,7 @@ function bootstrapHydration(rscStream, devErrorOverlay, initialRscBootstrap) {
1372
1392
  template: optimisticPayload.template
1373
1393
  })) {
1374
1394
  detachedNavigationCommits = true;
1395
+ optimisticShellElements = optimisticPayload.elements;
1375
1396
  const optimisticNavigationSnapshot = createClientNavigationRenderSnapshot(currentHref, optimisticPayload.params);
1376
1397
  renderNavigationPayload({
1377
1398
  actionType: toActionType(navigationKind),
@@ -1518,7 +1539,7 @@ function bootstrapHydration(rscStream, devErrorOverlay, initialRscBootstrap) {
1518
1539
  },
1519
1540
  operationLane: toOperationLane(navigationKind),
1520
1541
  params: navParams,
1521
- payload: rscPayload,
1542
+ payload: keepOptimisticShellMetadata(rscPayload),
1522
1543
  payloadOrigin: FRESH_APP_NAVIGATION_PAYLOAD_ORIGIN,
1523
1544
  pendingRouterState: detachedNavigationCommits ? null : pendingRouterState,
1524
1545
  previousNextUrl: requestPreviousNextUrl,
@@ -1527,7 +1548,7 @@ function bootstrapHydration(rscStream, devErrorOverlay, initialRscBootstrap) {
1527
1548
  scrollIntent,
1528
1549
  targetHref: currentHref,
1529
1550
  traversalIntent: activeTraversalIntent,
1530
- visibleCommitMode: prefetchedElements ? "synchronous" : visibleCommitMode
1551
+ visibleCommitMode
1531
1552
  });
1532
1553
  if (renderOutcome === "hard-navigate") {
1533
1554
  startedHardNavigation = true;
@@ -1585,7 +1606,10 @@ function bootstrapHydration(rscStream, devErrorOverlay, initialRscBootstrap) {
1585
1606
  if (startedHardNavigation) await waitForMpaNavigationRestore();
1586
1607
  }
1587
1608
  },
1588
- preparePrefetchResponse: (response) => decodeAppElementsPromise(createFromFetch(Promise.resolve(response))),
1609
+ preparePrefetchResponse: (response) => {
1610
+ if (!isRscResponseCompatible(response.headers.get("X-Vinext-RSC-Compatibility-Id"))) return Promise.reject(/* @__PURE__ */ new Error("[vinext] Prefetched another deployment's payload"));
1611
+ return decodeAppElementsPromise(createFromFetch(Promise.resolve(response)));
1612
+ },
1589
1613
  claimCurrentHistoryTreeSnapshot: (historyUpdateMode, previousHistoryState) => historyController.claimCurrentHistoryTreeSnapshot(historyUpdateMode, previousHistoryState),
1590
1614
  commitAppOwnedHistoryStateWrite: (historyUpdateMode, previousHistoryState) => historyController.commitAppOwnedHistoryStateWrite(historyUpdateMode, previousHistoryState),
1591
1615
  discardPendingNavigation: () => {
@@ -10,4 +10,5 @@ export declare function createOnUncaughtError(options?: {
10
10
  export declare function createProdOnCaughtError(onImplicitRootError: HydrateRootErrorHandler): HydrateRootErrorHandler;
11
11
  export declare function createDevOnCaughtError(onCaughtError: HydrateRootErrorHandler, onImplicitRootError: HydrateRootErrorHandler): HydrateRootErrorHandler;
12
12
  export declare function createProdOnRecoverableError(onReportedError: () => void): (error: unknown) => void;
13
- //#endregion
13
+ //#endregion
14
+ export {};
@@ -121,4 +121,5 @@ export declare class AppBrowserHistoryController {
121
121
  */
122
122
  restoreHistorySnapshot(options: RestoreHistorySnapshotOptions): boolean;
123
123
  }
124
- //#endregion
124
+ //#endregion
125
+ export {};
@@ -38,4 +38,5 @@ export declare function resolveFetchedHydrationLocation(renderedPathAndSearch: s
38
38
  pathname: string;
39
39
  search: string;
40
40
  };
41
- //#endregion
41
+ //#endregion
42
+ export {};
@@ -20,4 +20,5 @@ type ResolveManifestNavigationInterceptionContextOptions = {
20
20
  */
21
21
  export declare function resolveManifestNavigationInterceptionContext(options: ResolveManifestNavigationInterceptionContextOptions): string | null;
22
22
  export declare function resolveMiddlewareRewriteNavigationInterceptionContext(options: ResolveManifestNavigationInterceptionContextOptions): string | null;
23
- //#endregion
23
+ //#endregion
24
+ export {};
@@ -333,8 +333,12 @@ function createAppBrowserNavigationController(deps = {}) {
333
333
  routeManifest: deps.getRouteManifest?.() ?? null,
334
334
  targetHref: createSnapshotPathAndSearch(navigationSnapshot)
335
335
  });
336
- if (approval.approvedCommit) dispatchSynchronousVisibleCommit(approval.approvedCommit);
337
- else if (approval.decision.disposition === "hard-navigate") performHardNavigation(createSnapshotPathAndSearch(navigationSnapshot));
336
+ if (approval.approvedCommit) {
337
+ const approvedHmrCommit = approval.approvedCommit;
338
+ startTransition(() => {
339
+ dispatchVisibleCommit(approvedHmrCommit);
340
+ });
341
+ } else if (approval.decision.disposition === "hard-navigate") performHardNavigation(createSnapshotPathAndSearch(navigationSnapshot));
338
342
  }
339
343
  /**
340
344
  * Rendered before the route tree (see createAppRouteTree). Insertion effects
@@ -357,7 +361,7 @@ function createAppBrowserNavigationController(deps = {}) {
357
361
  }, [renderId]);
358
362
  return children;
359
363
  }
360
- function dispatchApprovedVisibleCommit(renderId, commit, pendingRouterState, visibleCommitMode) {
364
+ function dispatchApprovedVisibleCommit(renderId, commit, pendingRouterState, visibleCommitMode, republishPendingRouterState) {
361
365
  const setter = getBrowserRouterStateSetter();
362
366
  const pendingCommit = pendingNavigationCommits.get(renderId);
363
367
  const captureCandidateState = (state) => {
@@ -370,7 +374,7 @@ function createAppBrowserNavigationController(deps = {}) {
370
374
  pendingRouterState.settled = true;
371
375
  pendingRouterState.resolve(committedState);
372
376
  if (activePendingBrowserRouterState === pendingRouterState) activePendingBrowserRouterState = null;
373
- if (visibleCommitMode === "synchronous") flushSync(() => {
377
+ if (republishPendingRouterState) startTransition(() => {
374
378
  setter(committedState);
375
379
  });
376
380
  return;
@@ -387,7 +391,8 @@ function createAppBrowserNavigationController(deps = {}) {
387
391
  setter(committedState);
388
392
  });
389
393
  }
390
- function dispatchSynchronousVisibleCommit(commit) {
394
+ /** Calls the setter directly; the caller chooses the update's priority. */
395
+ function dispatchVisibleCommit(commit) {
391
396
  getBrowserRouterStateSetter()(applyApprovedVisibleCommit(getBrowserRouterState(), commit));
392
397
  }
393
398
  function createRestoredHistorySnapshotCommit(options) {
@@ -444,7 +449,7 @@ function createAppBrowserNavigationController(deps = {}) {
444
449
  });
445
450
  if (approval.approvedCommit === null) return false;
446
451
  options.beforeCommit?.();
447
- dispatchSynchronousVisibleCommit(approval.approvedCommit);
452
+ dispatchVisibleCommit(approval.approvedCommit);
448
453
  return true;
449
454
  }
450
455
  function notifyDiscardedServerActionRevalidation(lifecycleOptions) {
@@ -462,7 +467,7 @@ function createAppBrowserNavigationController(deps = {}) {
462
467
  return false;
463
468
  }
464
469
  }
465
- function shouldForceSynchronousCommit(options) {
470
+ function shouldRepublishPendingRouterState(options) {
466
471
  if (options.actionType === "traverse") return false;
467
472
  if (options.historyUpdateMode === void 0) return false;
468
473
  if (options.scrollIntent?.hash == null) return false;
@@ -566,12 +571,12 @@ function createAppBrowserNavigationController(deps = {}) {
566
571
  activateNavigationSnapshot();
567
572
  snapshotRenderIds.add(renderId);
568
573
  }
569
- dispatchApprovedVisibleCommit(renderId, approvedCommit, options.pendingRouterState, shouldForceSynchronousCommit(options) ? "synchronous" : options.visibleCommitMode ?? "transition");
574
+ dispatchApprovedVisibleCommit(renderId, approvedCommit, options.pendingRouterState, options.visibleCommitMode ?? "transition", shouldRepublishPendingRouterState(options));
570
575
  if (options.navigationResponseCompletion) options.navigationResponseCompletion.then(() => {
571
576
  if (!isCurrentNavigation(options.navId) || !hasBrowserRouterState()) return;
572
577
  const committedState = pendingNavigationCommits.get(renderId)?.committedState;
573
578
  if (!committedState) return;
574
- flushSync(() => {
579
+ startTransition(() => {
575
580
  getBrowserRouterStateSetter()(committedState);
576
581
  });
577
582
  }, () => {});
@@ -634,7 +639,7 @@ function createAppBrowserNavigationController(deps = {}) {
634
639
  if (latestApproval.approvedCommit) {
635
640
  const approvedRevalidationCommit = latestApproval.approvedCommit;
636
641
  startTransition(() => {
637
- dispatchSynchronousVisibleCommit(approvedRevalidationCommit);
642
+ dispatchVisibleCommit(approvedRevalidationCommit);
638
643
  });
639
644
  syncHistoryStatePreviousNextUrl(approvedRevalidationCommit.previousNextUrl, approvedRevalidationCommit.action.bfcacheIds);
640
645
  } else notifyDiscardedServerActionRevalidation(lifecycleOptions);
@@ -26,4 +26,5 @@ export declare function shouldCommitPopstateUrlWithoutNavigation(options: {
26
26
  isSameAppRouteTarget: boolean;
27
27
  }): boolean;
28
28
  export declare function createPopstateRestoreHandler(deps: BrowserPopstateRestoreDeps): (event: PopStateEvent) => void;
29
- //#endregion
29
+ //#endregion
30
+ export {};
@@ -34,4 +34,5 @@ export declare function resolveStreamedRscRedirectLifecycleHop(options: {
34
34
  requestPreviousNextUrl: string | null;
35
35
  streamedRedirectTarget: string;
36
36
  }): RscRedirectLifecycleDecision;
37
- //#endregion
37
+ //#endregion
38
+ export {};
@@ -30,4 +30,5 @@ export type ClientServerActionDeps = {
30
30
  syncServerActionHttpFallbackHead(status: number | null): void;
31
31
  };
32
32
  export declare function invokeClientServerAction(id: string, args: unknown[], actionInitiation: ClientServerActionInitiation, deps: ClientServerActionDeps): Promise<unknown>;
33
- //#endregion
33
+ //#endregion
34
+ export {};