vinext 1.3.0 → 1.4.0

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 (529) hide show
  1. package/README.md +5 -2
  2. package/THIRD_PARTY_LICENSES.md +47 -0
  3. package/dist/_virtual/_rolldown/runtime.js +4 -3
  4. package/dist/build/action-owner-manifest.d.ts +3 -2
  5. package/dist/build/action-owner-manifest.js +18 -2
  6. package/dist/build/app-page-static-eligibility.d.ts +17 -1
  7. package/dist/build/app-page-static-eligibility.js +80 -13
  8. package/dist/build/clean-output.d.ts +2 -1
  9. package/dist/build/client-build-config.d.ts +13 -3
  10. package/dist/build/client-build-config.js +46 -9
  11. package/dist/build/client-reference-async.d.ts +48 -0
  12. package/dist/build/client-reference-async.js +123 -0
  13. package/dist/build/client-reference-chunks.d.ts +32 -0
  14. package/dist/build/client-reference-chunks.js +111 -0
  15. package/dist/build/client-reference-groups.d.ts +9 -1
  16. package/dist/build/client-reference-groups.js +40 -2
  17. package/dist/build/css-url-assets.d.ts +2 -1
  18. package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
  19. package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
  20. package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
  21. package/dist/build/google-fonts/font-metadata.d.ts +2 -1
  22. package/dist/build/google-fonts/validate.d.ts +2 -1
  23. package/dist/build/inline-css.d.ts +2 -1
  24. package/dist/build/module-dependency-cache.d.ts +2 -1
  25. package/dist/build/next-client-runtime-manifests.d.ts +2 -1
  26. package/dist/build/precompress.d.ts +2 -1
  27. package/dist/build/precompress.js +1 -1
  28. package/dist/build/prerender-paths.d.ts +2 -1
  29. package/dist/build/prerender-phase.d.ts +2 -1
  30. package/dist/build/prerender-server-pool.js +1 -1
  31. package/dist/build/prerender.d.ts +3 -2
  32. package/dist/build/prerender.js +6 -5
  33. package/dist/build/report.d.ts +2 -15
  34. package/dist/build/report.js +1 -51
  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 +5 -1
  43. package/dist/cli-args.d.ts +2 -1
  44. package/dist/cli.js +5 -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/dev-error-overlay.js +1 -1
  51. package/dist/client/index.js +1 -2
  52. package/dist/client/instrumentation-client-state.js +5 -5
  53. package/dist/client/navigation-runtime.d.ts +16 -2
  54. package/dist/client/navigation-runtime.js +2 -2
  55. package/dist/client/pages-router-link-navigation.d.ts +2 -1
  56. package/dist/client/vinext-next-data.d.ts +25 -1
  57. package/dist/client/window-next.d.ts +2 -1
  58. package/dist/config/config-matchers.d.ts +12 -1
  59. package/dist/config/config-matchers.js +111 -16
  60. package/dist/config/dotenv.d.ts +2 -1
  61. package/dist/config/next-config.d.ts +32 -1
  62. package/dist/config/next-config.js +93 -5
  63. package/dist/config/tsconfig-paths.d.ts +2 -1
  64. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
  65. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
  66. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
  67. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
  68. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
  69. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
  70. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
  71. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
  72. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
  73. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
  74. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
  75. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
  76. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
  77. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
  78. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
  79. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
  80. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
  81. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
  82. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
  83. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
  84. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
  85. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
  86. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
  87. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
  88. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
  89. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
  90. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
  91. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
  92. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
  93. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
  94. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
  95. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
  96. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
  97. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
  98. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
  99. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
  100. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
  101. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
  102. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
  103. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
  104. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
  105. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
  106. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
  107. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
  108. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
  109. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
  110. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
  111. package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
  112. package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
  113. package/dist/entries/app-browser-entry.d.ts +20 -5
  114. package/dist/entries/app-browser-entry.js +79 -6
  115. package/dist/entries/app-rsc-entry.d.ts +2 -1
  116. package/dist/entries/app-rsc-entry.js +59 -60
  117. package/dist/entries/app-rsc-manifest.d.ts +2 -1
  118. package/dist/entries/app-rsc-manifest.js +56 -4
  119. package/dist/entries/app-ssr-entry.js +1 -0
  120. package/dist/entries/pages-entry-helpers.js +1 -2
  121. package/dist/entries/pages-server-entry.d.ts +2 -1
  122. package/dist/entries/pages-server-entry.js +34 -9
  123. package/dist/entries/runtime-entry-module.d.ts +1 -0
  124. package/dist/entries/runtime-entry-module.js +4 -1
  125. package/dist/image/image-adapters-virtual.d.ts +2 -1
  126. package/dist/index.js +184 -103
  127. package/dist/init-cloudflare.d.ts +1 -3
  128. package/dist/init-cloudflare.js +10 -48
  129. package/dist/init-platform.d.ts +2 -0
  130. package/dist/init-platform.js +4 -0
  131. package/dist/plugins/client-compile-hints.d.ts +30 -0
  132. package/dist/plugins/client-compile-hints.js +88 -0
  133. package/dist/plugins/client-reference-dedup.d.ts +2 -1
  134. package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
  135. package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
  136. package/dist/plugins/dynamic-preload-metadata.js +1 -1
  137. package/dist/plugins/environment.d.ts +2 -1
  138. package/dist/plugins/extensionless-dynamic-import.js +6 -2
  139. package/dist/plugins/fonts.js +9 -12
  140. package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
  141. package/dist/plugins/import-meta-url.d.ts +2 -1
  142. package/dist/plugins/next-intl-catalog.d.ts +12 -0
  143. package/dist/plugins/next-intl-catalog.js +85 -0
  144. package/dist/plugins/og-assets.d.ts +2 -1
  145. package/dist/plugins/og-assets.js +2 -3
  146. package/dist/plugins/optimize-imports.d.ts +2 -1
  147. package/dist/plugins/pages-node-externals.d.ts +3 -1
  148. package/dist/plugins/pages-node-externals.js +1 -1
  149. package/dist/plugins/remove-console.d.ts +2 -1
  150. package/dist/plugins/require-condition-resolution.d.ts +2 -1
  151. package/dist/plugins/rsc-client-reference-loaders.d.ts +8 -0
  152. package/dist/plugins/rsc-client-reference-loaders.js +170 -68
  153. package/dist/plugins/rsc-client-shim-excludes.js +2 -0
  154. package/dist/plugins/sass.d.ts +2 -1
  155. package/dist/plugins/strip-server-exports.d.ts +2 -1
  156. package/dist/plugins/styled-jsx.d.ts +2 -1
  157. package/dist/plugins/transform-result.d.ts +2 -1
  158. package/dist/plugins/typeof-window.d.ts +2 -1
  159. package/dist/plugins/use-cache-callable.d.ts +1 -1
  160. package/dist/plugins/use-cache-callable.js +136 -94
  161. package/dist/plugins/worker-image-imports.js +1 -1
  162. package/dist/plugins/worker-use-server.d.ts +2 -1
  163. package/dist/routing/app-route-graph.d.ts +46 -0
  164. package/dist/routing/app-route-graph.js +131 -51
  165. package/dist/routing/browser-route-manifest.d.ts +2 -1
  166. package/dist/routing/optimistic-route-trie.d.ts +2 -1
  167. package/dist/routing/route-matching.d.ts +2 -1
  168. package/dist/routing/route-pattern.d.ts +2 -1
  169. package/dist/server/accept-encoding.d.ts +2 -1
  170. package/dist/server/api-handler.js +19 -4
  171. package/dist/server/app-action-forwarding.d.ts +2 -1
  172. package/dist/server/app-bfcache-identity.d.ts +2 -1
  173. package/dist/server/app-bfcache-identity.js +1 -1
  174. package/dist/server/app-browser-action-result.d.ts +2 -1
  175. package/dist/server/app-browser-entry.js +106 -66
  176. package/dist/server/app-browser-error.d.ts +2 -1
  177. package/dist/server/app-browser-history-controller.d.ts +7 -5
  178. package/dist/server/app-browser-history-controller.js +93 -15
  179. package/dist/server/app-browser-hydration.d.ts +2 -1
  180. package/dist/server/app-browser-interception-context.d.ts +2 -1
  181. package/dist/server/app-browser-navigation-controller.d.ts +2 -2
  182. package/dist/server/app-browser-navigation-controller.js +16 -12
  183. package/dist/server/app-browser-popstate.d.ts +2 -1
  184. package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
  185. package/dist/server/app-browser-rsc-redirect.js +4 -4
  186. package/dist/server/app-browser-server-action-client.d.ts +4 -1
  187. package/dist/server/app-browser-server-action-client.js +4 -3
  188. package/dist/server/app-browser-state.d.ts +2 -4
  189. package/dist/server/app-browser-state.js +9 -4
  190. package/dist/server/app-browser-stream.d.ts +2 -1
  191. package/dist/server/app-browser-supplemental-refresh.js +16 -1
  192. package/dist/server/app-browser-visible-commit.d.ts +3 -2
  193. package/dist/server/app-browser-visible-commit.js +2 -12
  194. package/dist/server/app-client-reference-manifest.d.ts +31 -0
  195. package/dist/server/app-client-reference-manifest.js +46 -0
  196. package/dist/server/app-client-reference-preloader.d.ts +25 -5
  197. package/dist/server/app-client-reference-preloader.js +22 -7
  198. package/dist/server/app-elements-wire.d.ts +8 -39
  199. package/dist/server/app-elements-wire.js +4 -41
  200. package/dist/server/app-elements.d.ts +4 -2
  201. package/dist/server/app-elements.js +4 -2
  202. package/dist/server/app-fallback-renderer.d.ts +9 -2
  203. package/dist/server/app-fallback-renderer.js +4 -1
  204. package/dist/server/app-history-state.d.ts +4 -3
  205. package/dist/server/app-history-state.js +5 -2
  206. package/dist/server/app-inline-css-client.d.ts +2 -1
  207. package/dist/server/app-metadata-tracing.d.ts +2 -1
  208. package/dist/server/app-mounted-layouts.d.ts +21 -0
  209. package/dist/server/app-mounted-layouts.js +67 -0
  210. package/dist/server/app-optimistic-routing.d.ts +37 -2
  211. package/dist/server/app-optimistic-routing.js +75 -2
  212. package/dist/server/app-page-boundary-render.d.ts +20 -2
  213. package/dist/server/app-page-boundary-render.js +224 -40
  214. package/dist/server/app-page-boundary.d.ts +34 -5
  215. package/dist/server/app-page-boundary.js +41 -8
  216. package/dist/server/app-page-cache-finalizer.d.ts +14 -2
  217. package/dist/server/app-page-cache-finalizer.js +71 -30
  218. package/dist/server/app-page-cache-render.d.ts +10 -2
  219. package/dist/server/app-page-cache-render.js +14 -2
  220. package/dist/server/app-page-cache.d.ts +13 -1
  221. package/dist/server/app-page-cache.js +33 -11
  222. package/dist/server/app-page-dispatch.d.ts +39 -11
  223. package/dist/server/app-page-dispatch.js +236 -177
  224. package/dist/server/app-page-element-builder.d.ts +19 -3
  225. package/dist/server/app-page-element-builder.js +193 -71
  226. package/dist/server/app-page-execution.d.ts +43 -51
  227. package/dist/server/app-page-execution.js +205 -92
  228. package/dist/server/app-page-head.d.ts +108 -3
  229. package/dist/server/app-page-head.js +337 -154
  230. package/dist/server/app-page-http-access-fallback-metadata.d.ts +49 -2
  231. package/dist/server/app-page-http-access-fallback-metadata.js +77 -2
  232. package/dist/server/app-page-layout-gate.d.ts +35 -0
  233. package/dist/server/app-page-layout-gate.js +50 -0
  234. package/dist/server/app-page-method.d.ts +2 -1
  235. package/dist/server/app-page-params.d.ts +0 -1
  236. package/dist/server/app-page-params.js +1 -14
  237. package/dist/server/app-page-probe.d.ts +5 -22
  238. package/dist/server/app-page-probe.js +4 -37
  239. package/dist/server/app-page-render-identity.d.ts +2 -1
  240. package/dist/server/app-page-render.d.ts +9 -13
  241. package/dist/server/app-page-render.js +108 -214
  242. package/dist/server/app-page-request.d.ts +15 -4
  243. package/dist/server/app-page-request.js +2 -2
  244. package/dist/server/app-page-response.js +3 -3
  245. package/dist/server/app-page-route-wiring.d.ts +65 -8
  246. package/dist/server/app-page-route-wiring.js +259 -103
  247. package/dist/server/app-page-rsc-render-status.d.ts +29 -2
  248. package/dist/server/app-page-rsc-render-status.js +121 -13
  249. package/dist/server/app-page-search-params-observation.d.ts +7 -2
  250. package/dist/server/app-page-search-params-observation.js +8 -1
  251. package/dist/server/app-page-segment-plan.d.ts +2 -1
  252. package/dist/server/app-page-stream.d.ts +33 -1
  253. package/dist/server/app-page-stream.js +25 -6
  254. package/dist/server/app-pages-bridge.d.ts +6 -1
  255. package/dist/server/app-pages-bridge.js +7 -3
  256. package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
  257. package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
  258. package/dist/server/app-prerender-endpoints.d.ts +2 -1
  259. package/dist/server/app-prerender-static-params.d.ts +2 -1
  260. package/dist/server/app-render-dependency.d.ts +21 -4
  261. package/dist/server/app-render-dependency.js +100 -33
  262. package/dist/server/app-request-stage-dispatch.js +1 -1
  263. package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
  264. package/dist/server/app-response-stage-entry.d.ts +2 -1
  265. package/dist/server/app-route-handler-cache.d.ts +2 -1
  266. package/dist/server/app-route-handler-cache.js +2 -2
  267. package/dist/server/app-route-handler-dispatch.d.ts +2 -1
  268. package/dist/server/app-route-handler-dispatch.js +15 -10
  269. package/dist/server/app-route-handler-execution.d.ts +2 -1
  270. package/dist/server/app-route-handler-execution.js +8 -3
  271. package/dist/server/app-route-handler-policy.d.ts +1 -1
  272. package/dist/server/app-route-handler-policy.js +3 -3
  273. package/dist/server/app-route-handler-response.d.ts +2 -1
  274. package/dist/server/app-route-handler-response.js +1 -1
  275. package/dist/server/app-route-handler-runtime.d.ts +2 -1
  276. package/dist/server/app-route-handler-runtime.js +17 -4
  277. package/dist/server/app-route-module-loader.d.ts +18 -1
  278. package/dist/server/app-route-module-loader.js +8 -0
  279. package/dist/server/app-route-tree-prefetch.d.ts +2 -1
  280. package/dist/server/app-rsc-cache-busting.d.ts +2 -2
  281. package/dist/server/app-rsc-cache-busting.js +4 -4
  282. package/dist/server/app-rsc-error-handler.d.ts +4 -2
  283. package/dist/server/app-rsc-error-handler.js +9 -1
  284. package/dist/server/app-rsc-errors.d.ts +10 -1
  285. package/dist/server/app-rsc-errors.js +8 -1
  286. package/dist/server/app-rsc-handler.d.ts +7 -6
  287. package/dist/server/app-rsc-handler.js +36 -34
  288. package/dist/server/app-rsc-request-normalization.d.ts +0 -4
  289. package/dist/server/app-rsc-request-normalization.js +1 -4
  290. package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
  291. package/dist/server/app-rsc-response-finalizer.js +2 -2
  292. package/dist/server/app-rsc-response-stage.js +5 -3
  293. package/dist/server/app-rsc-route-matching.d.ts +38 -1
  294. package/dist/server/app-rsc-route-matching.js +24 -0
  295. package/dist/server/app-segment-config.d.ts +2 -1
  296. package/dist/server/app-segment-config.js +1 -14
  297. package/dist/server/app-server-action-execution.d.ts +5 -2
  298. package/dist/server/app-server-action-execution.js +10 -7
  299. package/dist/server/app-ssr-entry.d.ts +8 -0
  300. package/dist/server/app-ssr-entry.js +98 -50
  301. package/dist/server/app-ssr-error-meta.d.ts +2 -1
  302. package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
  303. package/dist/server/app-ssr-stream.d.ts +22 -10
  304. package/dist/server/app-ssr-stream.js +300 -68
  305. package/dist/server/app-static-generation.d.ts +2 -1
  306. package/dist/server/app-streamed-client-references.d.ts +39 -0
  307. package/dist/server/app-streamed-client-references.js +156 -0
  308. package/dist/server/app-visited-response-cache.d.ts +38 -2
  309. package/dist/server/app-visited-response-cache.js +46 -5
  310. package/dist/server/app-worker-stages.d.ts +27 -4
  311. package/dist/server/app-worker-stages.js +45 -6
  312. package/dist/server/artifact-compatibility.d.ts +2 -2
  313. package/dist/server/artifact-compatibility.js +1 -10
  314. package/dist/server/bfcache-identity.d.ts +2 -1
  315. package/dist/server/cache-headers.d.ts +2 -1
  316. package/dist/server/cache-proof.d.ts +1 -115
  317. package/dist/server/cache-proof.js +1 -544
  318. package/dist/server/cacheability-request.d.ts +2 -1
  319. package/dist/server/cacheability-request.js +13 -8
  320. package/dist/server/config-headers.d.ts +2 -1
  321. package/dist/server/csp.d.ts +2 -1
  322. package/dist/server/default-global-not-found-module.d.ts +2 -1
  323. package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
  324. package/dist/server/default-http-access-fallback-modules.js +31 -0
  325. package/dist/server/defer-until-stream-consumed.d.ts +34 -0
  326. package/dist/server/defer-until-stream-consumed.js +154 -21
  327. package/dist/server/dev-lockfile.d.ts +32 -2
  328. package/dist/server/dev-lockfile.js +46 -2
  329. package/dist/server/dev-module-runner.d.ts +2 -1
  330. package/dist/server/dev-server.js +14 -6
  331. package/dist/server/fetch-handler.js +1 -2
  332. package/dist/server/file-based-metadata.d.ts +2 -1
  333. package/dist/server/framework-tracer.d.ts +2 -1
  334. package/dist/server/headers.d.ts +6 -3
  335. package/dist/server/headers.js +9 -5
  336. package/dist/server/html.d.ts +1 -0
  337. package/dist/server/html.js +19 -1
  338. package/dist/server/http-conditional.d.ts +2 -1
  339. package/dist/server/http-error-responses.d.ts +2 -1
  340. package/dist/server/implicit-tags.d.ts +2 -1
  341. package/dist/server/isr-cache.d.ts +8 -2
  342. package/dist/server/isr-cache.js +26 -1
  343. package/dist/server/metadata-route-build-data.d.ts +2 -1
  344. package/dist/server/metadata-route-build-data.js +1 -1
  345. package/dist/server/metadata-route-response.d.ts +2 -1
  346. package/dist/server/metadata-route-response.js +32 -15
  347. package/dist/server/metadata-routes.d.ts +2 -1
  348. package/dist/server/middleware-runtime.d.ts +2 -1
  349. package/dist/server/multi-stage.d.ts +52 -11
  350. package/dist/server/multi-stage.js +13 -1
  351. package/dist/server/navigation-planner.js +1 -1
  352. package/dist/server/navigation-trace.d.ts +2 -1
  353. package/dist/server/next-error-digest.d.ts +2 -1
  354. package/dist/server/nitro-public-files-plugin.d.ts +2 -1
  355. package/dist/server/nitro-public-files.d.ts +2 -1
  356. package/dist/server/opentelemetry-api.d.ts +2 -1
  357. package/dist/server/operation-token.d.ts +2 -1
  358. package/dist/server/pages-api-route.d.ts +2 -1
  359. package/dist/server/pages-api-route.js +28 -19
  360. package/dist/server/pages-asset-tags.d.ts +2 -1
  361. package/dist/server/pages-body-parser-config.d.ts +2 -1
  362. package/dist/server/pages-client-assets.d.ts +4 -0
  363. package/dist/server/pages-data-route.d.ts +2 -1
  364. package/dist/server/pages-document-asset-props.d.ts +2 -1
  365. package/dist/server/pages-document-initial-props.d.ts +2 -1
  366. package/dist/server/pages-execution-tracing.d.ts +2 -1
  367. package/dist/server/pages-execution-tracing.js +1 -1
  368. package/dist/server/pages-get-initial-props.d.ts +2 -1
  369. package/dist/server/pages-media-type.d.ts +21 -1
  370. package/dist/server/pages-media-type.js +69 -5
  371. package/dist/server/pages-node-compat.js +52 -27
  372. package/dist/server/pages-page-data.d.ts +7 -1
  373. package/dist/server/pages-page-data.js +35 -12
  374. package/dist/server/pages-page-handler.d.ts +3 -2
  375. package/dist/server/pages-page-handler.js +27 -27
  376. package/dist/server/pages-page-method.d.ts +2 -1
  377. package/dist/server/pages-page-response.d.ts +2 -1
  378. package/dist/server/pages-preview.d.ts +2 -1
  379. package/dist/server/pages-readiness.d.ts +2 -1
  380. package/dist/server/pages-request-pipeline.d.ts +10 -1
  381. package/dist/server/pages-request-pipeline.js +6 -7
  382. package/dist/server/pages-request-stage-entry.d.ts +2 -1
  383. package/dist/server/pages-request-stage-entry.js +14 -12
  384. package/dist/server/pages-response-stage-entry.d.ts +2 -1
  385. package/dist/server/pages-response-stage-entry.js +9 -3
  386. package/dist/server/pages-route-data-kind.d.ts +2 -1
  387. package/dist/server/prerender-cache-life-header.d.ts +2 -1
  388. package/dist/server/prerender-route-params.d.ts +2 -1
  389. package/dist/server/prod-server.js +14 -4
  390. package/dist/server/request-log.d.ts +2 -1
  391. package/dist/server/request-pipeline.d.ts +6 -0
  392. package/dist/server/request-pipeline.js +21 -1
  393. package/dist/server/request-tracing.d.ts +2 -1
  394. package/dist/server/request-tracing.js +1 -1
  395. package/dist/server/response-start-tracing.js +7 -29
  396. package/dist/server/rsc-render-stream.d.ts +4 -0
  397. package/dist/server/rsc-render-stream.js +25 -0
  398. package/dist/server/seed-cache.d.ts +2 -1
  399. package/dist/server/seed-cache.js +1 -1
  400. package/dist/server/shared-cache-identity.d.ts +23 -0
  401. package/dist/server/shared-cache-identity.js +36 -0
  402. package/dist/server/static-file-cache.d.ts +2 -1
  403. package/dist/server/static-file-cache.js +1 -0
  404. package/dist/server/worker-revalidation-context.d.ts +2 -1
  405. package/dist/server/worker-stages.d.ts +18 -4
  406. package/dist/server/worker-stages.js +23 -4
  407. package/dist/shims/app.d.ts +2 -1
  408. package/dist/shims/cache-callable-runtime.d.ts +2 -1
  409. package/dist/shims/cache-handler.d.ts +8 -3
  410. package/dist/shims/cache-handler.js +31 -11
  411. package/dist/shims/cache-request-state.d.ts +17 -20
  412. package/dist/shims/cache-request-state.js +16 -21
  413. package/dist/shims/cache-runtime.js +27 -11
  414. package/dist/shims/cache.d.ts +8 -7
  415. package/dist/shims/cache.js +17 -19
  416. package/dist/shims/cacheability-classification.d.ts +2 -0
  417. package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
  418. package/dist/shims/caught-not-found-boundaries.js +48 -0
  419. package/dist/shims/cdn-cache.d.ts +22 -5
  420. package/dist/shims/cdn-purge-routes.d.ts +2 -1
  421. package/dist/shims/client-locale.js +2 -1
  422. package/dist/shims/client-page-root.d.ts +2 -1
  423. package/dist/shims/client-page-root.js +2 -2
  424. package/dist/shims/config.d.ts +2 -1
  425. package/dist/shims/default-forbidden.d.ts +4 -0
  426. package/dist/shims/default-forbidden.js +18 -0
  427. package/dist/shims/default-not-found.d.ts +0 -5
  428. package/dist/shims/default-not-found.js +5 -41
  429. package/dist/shims/default-unauthorized.d.ts +4 -0
  430. package/dist/shims/default-unauthorized.js +18 -0
  431. package/dist/shims/dynamic.js +9 -6
  432. package/dist/shims/error-boundary.d.ts +39 -3
  433. package/dist/shims/error-boundary.js +33 -18
  434. package/dist/shims/fetch-cache-state.d.ts +5 -1
  435. package/dist/shims/fetch-cache-state.js +1 -3
  436. package/dist/shims/fetch-cache.d.ts +2 -1
  437. package/dist/shims/fetch-cache.js +34 -24
  438. package/dist/shims/font-google.js +1 -2
  439. package/dist/shims/font-utils.d.ts +3 -2
  440. package/dist/shims/font-utils.js +5 -3
  441. package/dist/shims/form.js +3 -3
  442. package/dist/shims/headers.d.ts +8 -23
  443. package/dist/shims/headers.js +17 -67
  444. package/dist/shims/http-access-error-fallback.d.ts +7 -0
  445. package/dist/shims/http-access-error-fallback.js +47 -0
  446. package/dist/shims/image.d.ts +1 -22
  447. package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
  448. package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
  449. package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
  450. package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
  451. package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
  452. package/dist/shims/internal/client-reference-loader.d.ts +7 -0
  453. package/dist/shims/internal/client-reference-loader.js +91 -0
  454. package/dist/shims/internal/cookie-serialize.d.ts +2 -1
  455. package/dist/shims/internal/cookies.js +1 -2
  456. package/dist/shims/internal/headers-state.d.ts +2 -0
  457. package/dist/shims/internal/headers-state.js +6 -1
  458. package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +2 -1
  459. package/dist/shims/internal/interpolate-as.d.ts +2 -1
  460. package/dist/shims/internal/navigation-untracked.js +1 -1
  461. package/dist/shims/internal/pages-data-target.d.ts +2 -1
  462. package/dist/shims/internal/pages-data-url.d.ts +2 -1
  463. package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
  464. package/dist/shims/link.js +197 -52
  465. package/dist/shims/metadata.d.ts +52 -29
  466. package/dist/shims/metadata.js +142 -42
  467. package/dist/shims/navigation-errors.d.ts +2 -1
  468. package/dist/shims/navigation-server.js +1 -1
  469. package/dist/shims/navigation.d.ts +95 -8
  470. package/dist/shims/navigation.js +255 -47
  471. package/dist/shims/navigation.react-server.js +2 -2
  472. package/dist/shims/pages-router-runtime.d.ts +2 -1
  473. package/dist/shims/ppr-fallback-shell.d.ts +2 -1
  474. package/dist/shims/request-state-types.d.ts +2 -2
  475. package/dist/shims/router.js +14 -3
  476. package/dist/shims/slot.d.ts +12 -0
  477. package/dist/shims/slot.js +37 -9
  478. package/dist/shims/unified-request-context.d.ts +1 -1
  479. package/dist/shims/unified-request-context.js +5 -6
  480. package/dist/typegen.d.ts +2 -1
  481. package/dist/utils/cache-control-metadata.d.ts +5 -0
  482. package/dist/utils/cache-control-metadata.js +9 -1
  483. package/dist/utils/client-build-manifest.d.ts +4 -1
  484. package/dist/utils/client-build-manifest.js +9 -2
  485. package/dist/utils/client-entry-manifest.d.ts +13 -0
  486. package/dist/utils/client-entry-manifest.js +20 -1
  487. package/dist/utils/client-reference-chunks.d.ts +45 -0
  488. package/dist/utils/client-reference-chunks.js +30 -0
  489. package/dist/utils/client-runtime-metadata.d.ts +9 -1
  490. package/dist/utils/client-runtime-metadata.js +40 -9
  491. package/dist/utils/compare.d.ts +9 -0
  492. package/dist/utils/compare.js +15 -1
  493. package/dist/utils/lazy-chunks.d.ts +14 -0
  494. package/dist/utils/lazy-chunks.js +27 -1
  495. package/dist/utils/middleware-request-headers.d.ts +2 -1
  496. package/dist/utils/project.d.ts +4 -3
  497. package/dist/utils/project.js +12 -17
  498. package/dist/utils/query.d.ts +2 -1
  499. package/dist/utils/regex.d.ts +5 -0
  500. package/dist/utils/regex.js +11 -1
  501. package/dist/utils/text-stream.d.ts +10 -5
  502. package/dist/utils/text-stream.js +6 -6
  503. package/dist/utils/vite-cli-invocation.d.ts +2 -1
  504. package/package.json +6 -5
  505. package/dist/build/layout-classification-types.d.ts +0 -60
  506. package/dist/build/layout-classification-types.js +0 -1
  507. package/dist/build/layout-classification.d.ts +0 -61
  508. package/dist/build/layout-classification.js +0 -98
  509. package/dist/build/route-classification-injector.d.ts +0 -32
  510. package/dist/build/route-classification-injector.js +0 -59
  511. package/dist/build/route-classification-manifest.d.ts +0 -53
  512. package/dist/build/route-classification-manifest.js +0 -143
  513. package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
  514. package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -10
  515. package/dist/server/app-browser-client-reuse-manifest.js +0 -101
  516. package/dist/server/app-layout-param-observation.d.ts +0 -41
  517. package/dist/server/app-layout-param-observation.js +0 -168
  518. package/dist/server/client-reuse-manifest.d.ts +0 -102
  519. package/dist/server/client-reuse-manifest.js +0 -209
  520. package/dist/server/default-not-found-module.d.ts +0 -19
  521. package/dist/server/default-not-found-module.js +0 -18
  522. package/dist/server/rsc-stream-hints.d.ts +0 -21
  523. package/dist/server/rsc-stream-hints.js +0 -227
  524. package/dist/server/skip-cache-proof.d.ts +0 -60
  525. package/dist/server/skip-cache-proof.js +0 -168
  526. package/dist/server/static-layout-client-reuse-proof.d.ts +0 -13
  527. package/dist/server/static-layout-client-reuse-proof.js +0 -33
  528. package/dist/utils/sorted-array.d.ts +0 -7
  529. package/dist/utils/sorted-array.js +0 -20
@@ -1,10 +1,8 @@
1
1
  import { VINEXT_RSC_REDIRECT_HEADER, VINEXT_RSC_REDIRECT_TYPE_HEADER } from "./headers.js";
2
- import { isPromiseLike } from "../utils/promise.js";
3
- import { runWithConnectionProbe } from "../shims/headers.js";
4
- import { isThrownNavigationError } from "../shims/navigation-errors.js";
5
- import { VINEXT_RSC_CONTENT_TYPE, applyRscCompatibilityIdHeader, applyRscDeploymentIdHeader, createRscRedirectLocation } from "./app-rsc-cache-busting.js";
6
- import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
7
2
  import { copyLinkHeaderProvenance, getFrameworkLinkHeader, markFrameworkLinkHeaders } from "./app-response-header-provenance.js";
3
+ import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
4
+ import { VINEXT_RSC_CONTENT_TYPE, applyRscCompatibilityIdHeader, applyRscDeploymentIdHeader, createRscRedirectLocation } from "./app-rsc-cache-busting.js";
5
+ import { isHTTPAccessFallbackError, isThrownNavigationError } from "../shims/navigation-errors.js";
8
6
  import { applyEdgeRuntimeHeader } from "./app-page-response.js";
9
7
  import { parseNextHttpErrorDigest, parseNextRedirectDigest } from "./next-error-digest.js";
10
8
  import { renderSsrErrorMetaTags } from "./app-ssr-error-meta.js";
@@ -40,6 +38,83 @@ function tagAppPageMetadataError(error) {
40
38
  } catch {}
41
39
  return error;
42
40
  }
41
+ /**
42
+ * Marker we tag onto an error a parallel slot's page or default component
43
+ * threw, holding the index of the layout that renders the slot. Next.js
44
+ * attaches HTTP access fallback boundaries only to each segment's `children`,
45
+ * so a slot's `notFound()` is caught by the boundary above that layout, not
46
+ * by the route's deepest boundary as the page's is.
47
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/create-component-tree.tsx
48
+ */
49
+ const APP_PAGE_SLOT_ERROR_LAYOUT_INDEX = Symbol.for("vinext.appPage.slotErrorLayoutIndex");
50
+ /**
51
+ * Marker holding the id of the slot's own not-found boundary that catches the
52
+ * slot's `notFound()` on the client, when one does. The document then renders
53
+ * that boundary caught (see `resolveAppPageCaughtNotFoundBoundaries`).
54
+ */
55
+ const APP_PAGE_SLOT_ERROR_NOT_FOUND_BOUNDARY = Symbol.for("vinext.appPage.slotErrorNotFoundBoundary");
56
+ /**
57
+ * Marker we tag onto an error the route's page component threw, so that the
58
+ * document's fallback can tell it from one a layout or a template threw,
59
+ * which no slot tag marks either.
60
+ */
61
+ const APP_PAGE_PAGE_ERROR = Symbol.for("vinext.appPage.pageError");
62
+ /**
63
+ * Marker we tag onto an error a route layout's own component threw, holding
64
+ * that layout's index. Its boundaries wrap only its `children`, so the
65
+ * boundary above the layout catches it, as for a slot the layout renders.
66
+ */
67
+ const APP_PAGE_LAYOUT_ERROR_LAYOUT_INDEX = Symbol.for("vinext.appPage.layoutErrorLayoutIndex");
68
+ function tagAppPageHttpAccessFallbackError(error, tags) {
69
+ if (!isHTTPAccessFallbackError(error)) return error;
70
+ const source = error;
71
+ const tagged = Object.setPrototypeOf(new Error(String(Reflect.get(source, "message"))), Object.getPrototypeOf(source));
72
+ Object.defineProperties(tagged, {
73
+ ...Object.getOwnPropertyDescriptors(source),
74
+ stack: {
75
+ value: Reflect.get(source, "stack"),
76
+ configurable: true,
77
+ writable: true
78
+ },
79
+ ...tags
80
+ });
81
+ return tagged;
82
+ }
83
+ function tagAppPageSlotError(error, layoutIndex, notFoundBoundary) {
84
+ return tagAppPageHttpAccessFallbackError(error, {
85
+ [APP_PAGE_SLOT_ERROR_LAYOUT_INDEX]: { value: layoutIndex },
86
+ [APP_PAGE_SLOT_ERROR_NOT_FOUND_BOUNDARY]: { value: notFoundBoundary }
87
+ });
88
+ }
89
+ function tagAppPagePageError(error) {
90
+ return tagAppPageHttpAccessFallbackError(error, { [APP_PAGE_PAGE_ERROR]: { value: true } });
91
+ }
92
+ function tagAppPageLayoutError(error, layoutIndex) {
93
+ return tagAppPageHttpAccessFallbackError(error, { [APP_PAGE_LAYOUT_ERROR_LAYOUT_INDEX]: { value: layoutIndex } });
94
+ }
95
+ function isAppPagePageError(error) {
96
+ return !!error && typeof error === "object" && Reflect.get(error, APP_PAGE_PAGE_ERROR) === true;
97
+ }
98
+ function getAppPageLayoutErrorLayoutIndex(error) {
99
+ if (!error || typeof error !== "object") return null;
100
+ const layoutIndex = Reflect.get(error, APP_PAGE_LAYOUT_ERROR_LAYOUT_INDEX);
101
+ return typeof layoutIndex === "number" ? layoutIndex : null;
102
+ }
103
+ function getAppPageSlotErrorLayoutIndex(error) {
104
+ if (!error || typeof error !== "object") return null;
105
+ const layoutIndex = Reflect.get(error, APP_PAGE_SLOT_ERROR_LAYOUT_INDEX);
106
+ return typeof layoutIndex === "number" ? layoutIndex : null;
107
+ }
108
+ /**
109
+ * The id of the not-found boundary that catches the route page's notFound():
110
+ * the page-level boundary, or the segment one it passes the signal up to.
111
+ */
112
+ const APP_PAGE_NOT_FOUND_BOUNDARY_ID = "page";
113
+ function getAppPageSlotErrorNotFoundBoundary(error) {
114
+ if (!error || typeof error !== "object") return null;
115
+ const boundary = Reflect.get(error, APP_PAGE_SLOT_ERROR_NOT_FOUND_BOUNDARY);
116
+ return typeof boundary === "string" ? boundary : null;
117
+ }
43
118
  function getAppPageStatusText(statusCode) {
44
119
  return statusCode === 403 ? "Forbidden" : statusCode === 401 ? "Unauthorized" : "Not Found";
45
120
  }
@@ -83,16 +158,83 @@ function resolveAppPageSpecialError(error) {
83
158
  * generateMetadata() threw it comes from the errors the RSC render threw with
84
159
  * that digest. When the page threw one too, the page's decides. An error a
85
160
  * client component threw during SSR is the page's, since generateMetadata()
86
- * runs only in the RSC render.
161
+ * runs only in the RSC render. A notFound() / forbidden() / unauthorized()
162
+ * a parallel slot's page threw is caught above the layout rendering it,
163
+ * unless the slot's own not-found catches its notFound() and every other copy
164
+ * is the page's or another slot's. One a route layout threw is caught above
165
+ * that layout, and the outermost such layout wins. A copy nothing tagged,
166
+ * such as a template's or one from a component a layout or the page renders,
167
+ * marks the error unattributed.
87
168
  */
88
169
  function resolveAppPageShellSpecialError(error, renderedSpecialErrors) {
89
170
  const specialError = resolveAppPageSpecialError(error);
90
171
  if (!specialError || specialError.fromMetadata === true) return specialError;
91
172
  if (isThrownNavigationError(error)) return specialError;
92
- return renderedSpecialErrors.length > 0 && renderedSpecialErrors.every((rendered) => resolveAppPageSpecialError(rendered)?.fromMetadata === true) ? {
173
+ if (renderedSpecialErrors.length > 0 && renderedSpecialErrors.every((rendered) => resolveAppPageSpecialError(rendered)?.fromMetadata === true)) return {
93
174
  ...specialError,
94
175
  fromMetadata: true
95
- } : specialError;
176
+ };
177
+ if (specialError.kind !== "http-access-fallback") return specialError;
178
+ const skipsSlotCaughtNotFound = specialError.statusCode === 404 && renderedSpecialErrors.every((rendered) => isAppPagePageError(rendered) || getAppPageSlotErrorLayoutIndex(rendered) !== null);
179
+ let slotLayoutIndex = null;
180
+ let layoutIndex = null;
181
+ let unattributed = false;
182
+ for (const rendered of renderedSpecialErrors) {
183
+ const throwingLayoutIndex = getAppPageLayoutErrorLayoutIndex(rendered);
184
+ if (throwingLayoutIndex !== null) {
185
+ if (layoutIndex === null || throwingLayoutIndex < layoutIndex) layoutIndex = throwingLayoutIndex;
186
+ continue;
187
+ }
188
+ if (skipsSlotCaughtNotFound && getAppPageSlotErrorNotFoundBoundary(rendered) !== null) continue;
189
+ const slotOwnerIndex = getAppPageSlotErrorLayoutIndex(rendered);
190
+ if (slotOwnerIndex !== null) {
191
+ if (slotLayoutIndex === null || slotOwnerIndex < slotLayoutIndex) slotLayoutIndex = slotOwnerIndex;
192
+ continue;
193
+ }
194
+ if (!isAppPagePageError(rendered) && resolveAppPageSpecialError(rendered)?.fromMetadata !== true) unattributed = true;
195
+ }
196
+ if (layoutIndex !== null && slotLayoutIndex !== null) {
197
+ if (layoutIndex <= slotLayoutIndex) slotLayoutIndex = null;
198
+ else layoutIndex = null;
199
+ }
200
+ if (slotLayoutIndex === null && layoutIndex === null && !unattributed) return specialError;
201
+ return {
202
+ ...specialError,
203
+ ...slotLayoutIndex !== null ? { slotLayoutIndex } : {},
204
+ ...layoutIndex !== null ? { layoutIndex } : {},
205
+ ...unattributed ? { unattributed: true } : {}
206
+ };
207
+ }
208
+ /**
209
+ * The parallel slot not-found boundaries that catch the `notFound()` that
210
+ * rejected an SSR shell, or null when any copy the RSC render threw isn't
211
+ * caught inside its slot. On the client, each slot's own not-found boundary
212
+ * catches its signal while the rest of the route renders, as in Next.js,
213
+ * which sends an empty error shell and renders them in the browser. A copy
214
+ * no slot threw is caught by the page's boundary beside them when the page
215
+ * threw it, including from a component the page renders, which nothing tags.
216
+ * One a layout or a template threw renders outside the caught boundaries, so
217
+ * the document's render from the same payload throws it again and takes the
218
+ * fallback, which keeps it above the slot's layout (see
219
+ * `resolveAppPageShellSpecialError`). Without a slot's, that fallback renders.
220
+ */
221
+ function resolveAppPageCaughtNotFoundBoundaries(error, renderedSpecialErrors) {
222
+ const specialError = resolveAppPageSpecialError(error);
223
+ if (specialError?.kind !== "http-access-fallback" || specialError.statusCode !== 404) return null;
224
+ if (isThrownNavigationError(error) || renderedSpecialErrors.length === 0) return null;
225
+ const boundaries = /* @__PURE__ */ new Set();
226
+ let caughtInSlot = false;
227
+ for (const rendered of renderedSpecialErrors) {
228
+ if (resolveAppPageSpecialError(rendered)?.fromMetadata === true) return null;
229
+ if (getAppPageLayoutErrorLayoutIndex(rendered) !== null) return null;
230
+ const boundary = getAppPageSlotErrorNotFoundBoundary(rendered);
231
+ if (boundary !== null) {
232
+ caughtInSlot = true;
233
+ boundaries.add(boundary);
234
+ } else if (getAppPageSlotErrorLayoutIndex(rendered) === null) boundaries.add(APP_PAGE_NOT_FOUND_BOUNDARY_ID);
235
+ else return null;
236
+ }
237
+ return caughtInSlot ? Array.from(boundaries) : null;
96
238
  }
97
239
  /**
98
240
  * Resolves a redirect() target against the request URL and prepends the
@@ -121,21 +263,62 @@ function resolveAppPageSpecialErrorStoredHeaders(specialError, basePath) {
121
263
  if (specialError.kind !== "redirect") return void 0;
122
264
  return { location: applyAppPageRedirectBasePath(specialError.location, basePath) };
123
265
  }
266
+ const REDIRECT_BASES = [{
267
+ host: "a.redirect-base.vinext.invalid",
268
+ protocol: "https:"
269
+ }, {
270
+ host: "b.redirect-base.vinext.invalid",
271
+ protocol: "http:"
272
+ }];
273
+ function resolveAgainstPlaceholder(location, requestUrl, placeholder) {
274
+ const base = new URL(requestUrl);
275
+ base.protocol = placeholder.protocol;
276
+ base.host = placeholder.host;
277
+ base.port = "";
278
+ const resolved = new URL(location, base);
279
+ return {
280
+ relative: resolved.origin === base.origin,
281
+ resolved
282
+ };
283
+ }
284
+ /**
285
+ * A URL reference as the URL parser reads it, with every byte a header value
286
+ * cannot carry percent-encoded. The parser trims C0 controls and spaces and
287
+ * drops tabs and newlines; percent-decoding reverses the rest, including in a
288
+ * host, so the client resolves it as it would the raw target.
289
+ */
290
+ function toHeaderSafeUrlReference(location) {
291
+ return location.replace(/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g, "").replace(/[\t\n\r]/g, "").replace(/[^\u0021-\u007e]+/g, (chars) => Array.from(new TextEncoder().encode(chars), (byte) => `%${byte.toString(16).toUpperCase().padStart(2, "0")}`).join(""));
292
+ }
124
293
  /**
125
- * Returns a path-relative form (`/foo?bar`) of an absolute URL when it shares
126
- * the request's origin; otherwise returns the URL verbatim. Used so the digest
127
- * we embed in the flight payload matches Next.js's convention — the digest
128
- * stores the path the developer passed to `redirect("/about")`, not a
129
- * fully-qualified URL like `https://example.com/about`.
294
+ * The redirect target embedded in the flight digest and its streamed
295
+ * side-channel header. An absolute target stays in the digest as `redirect()`
296
+ * received it, as in Next.js's digest, so every host that shares the cache
297
+ * entry is sent to the same place; the header carries the same reference made
298
+ * header-safe, so a protocol-relative or scheme-relative target still resolves
299
+ * against the page each client fetched. A relative target resolves against the
300
+ * request's path to a path-only form, which the client resolves against its
301
+ * own origin. Resolving against two placeholder origins tells these apart the
302
+ * way the URL parser does, never depends on the request's origin, and cannot
303
+ * mistake an absolute target naming one placeholder for a relative one.
130
304
  */
131
- function sameOriginPathOrAbsolute(location, requestUrl) {
305
+ function resolveRedirectTargets(location, requestUrl) {
132
306
  try {
133
- const resolved = new URL(location, requestUrl);
134
- const requestOrigin = new URL(requestUrl).origin;
135
- if (resolved.origin !== requestOrigin) return resolved.toString();
136
- return `${resolved.pathname}${resolved.search}${resolved.hash}`;
307
+ const [first, second] = REDIRECT_BASES.map((placeholder) => resolveAgainstPlaceholder(location, requestUrl, placeholder));
308
+ if (!first.relative || !second.relative) return {
309
+ digestUrl: location,
310
+ headerUrl: toHeaderSafeUrlReference(location)
311
+ };
312
+ const { pathname, search, hash } = first.resolved;
313
+ return {
314
+ digestUrl: `${pathname}${search}${hash}`,
315
+ headerUrl: `${pathname}${search}${hash}`
316
+ };
137
317
  } catch {
138
- return location;
318
+ return {
319
+ digestUrl: location,
320
+ headerUrl: toHeaderSafeUrlReference(location)
321
+ };
139
322
  }
140
323
  }
141
324
  function buildMetadataRedirectHtmlResponse(options) {
@@ -154,7 +337,7 @@ async function buildAppPageSpecialErrorResponse(options) {
154
337
  if (options.specialError.kind === "redirect") {
155
338
  options.clearRequestContext();
156
339
  const prefixedLocation = applyAppPageRedirectBasePath(options.specialError.location, options.basePath);
157
- const digestUrl = sameOriginPathOrAbsolute(prefixedLocation, options.request.url);
340
+ const { digestUrl, headerUrl } = resolveRedirectTargets(prefixedLocation, options.request.url);
158
341
  const digest = formatNextRedirectDigest({
159
342
  type: options.specialError.type ?? "replace",
160
343
  url: digestUrl,
@@ -173,7 +356,7 @@ async function buildAppPageSpecialErrorResponse(options) {
173
356
  mergeMiddlewareResponseHeaders(headers, options.middlewareContext?.headers ?? null);
174
357
  applyRscCompatibilityIdHeader(headers);
175
358
  applyRscDeploymentIdHeader(headers);
176
- headers.set(VINEXT_RSC_REDIRECT_HEADER, digestUrl);
359
+ headers.set(VINEXT_RSC_REDIRECT_HEADER, headerUrl);
177
360
  headers.set(VINEXT_RSC_REDIRECT_TYPE_HEADER, options.specialError.type ?? "replace");
178
361
  const pendingCookies = options.getAndClearPendingCookies?.() ?? [];
179
362
  for (const cookie of pendingCookies) headers.append("Set-Cookie", cookie);
@@ -211,76 +394,6 @@ async function buildAppPageSpecialErrorResponse(options) {
211
394
  const responseStatus = options.specialError.fromMetadata === true && options.serveStreamingMetadata !== false ? 200 : options.specialError.statusCode;
212
395
  return mergeAppPageSpecialErrorHeaders(new Response(getAppPageStatusText(options.specialError.statusCode), { status: responseStatus }), options.middlewareContext);
213
396
  }
214
- /** See `LayoutFlags` type docblock in app-elements.ts for lifecycle. */
215
- async function probeAppPageLayouts(options) {
216
- const layoutFlags = {};
217
- const cls = options.classification ?? null;
218
- return {
219
- response: await options.runWithSuppressedHookWarning(async () => {
220
- for (let layoutIndex = options.layoutCount - 1; layoutIndex >= 0; layoutIndex--) {
221
- const buildTimeResult = cls?.buildTimeClassifications?.get(layoutIndex);
222
- if (cls && buildTimeResult) {
223
- const layoutId = cls.getLayoutId(layoutIndex);
224
- layoutFlags[layoutId] = buildTimeResult === "static" ? "s" : "d";
225
- const errorResponse = await probeLayoutForErrors(options, layoutIndex);
226
- if (errorResponse) return errorResponse;
227
- const observationDynamic = cls.isLayoutObservationDynamic?.(layoutId) === true;
228
- layoutFlags[layoutId] = buildTimeResult === "dynamic" || observationDynamic ? "d" : "s";
229
- if (cls.debugClassification) {
230
- if (observationDynamic && buildTimeResult === "static") cls.debugClassification(layoutId, {
231
- layer: "runtime-probe",
232
- outcome: "dynamic"
233
- });
234
- else cls.debugClassification(layoutId, cls.buildTimeReasons?.get(layoutIndex) ?? { layer: "no-classifier" });
235
- }
236
- continue;
237
- }
238
- if (cls) {
239
- const layoutId = cls.getLayoutId(layoutIndex);
240
- try {
241
- const { dynamicDetected } = await cls.runWithIsolatedDynamicScope(async () => {
242
- const outcome = await runWithConnectionProbe(() => options.probeLayoutAt(layoutIndex));
243
- return outcome.completed ? outcome.result : null;
244
- });
245
- const observationDynamic = cls.isLayoutObservationDynamic?.(layoutId) === true;
246
- const layoutDynamic = dynamicDetected || observationDynamic;
247
- layoutFlags[layoutId] = layoutDynamic ? "d" : "s";
248
- if (cls.debugClassification) cls.debugClassification(layoutId, {
249
- layer: "runtime-probe",
250
- outcome: layoutDynamic ? "dynamic" : "static"
251
- });
252
- } catch (error) {
253
- layoutFlags[layoutId] = "d";
254
- if (cls.debugClassification) cls.debugClassification(layoutId, {
255
- layer: "runtime-probe",
256
- outcome: "dynamic",
257
- error: error instanceof Error ? error.message : String(error)
258
- });
259
- const errorResponse = await options.onLayoutError(error, layoutIndex);
260
- if (errorResponse) return errorResponse;
261
- }
262
- continue;
263
- }
264
- const errorResponse = await probeLayoutForErrors(options, layoutIndex);
265
- if (errorResponse) return errorResponse;
266
- }
267
- return null;
268
- }),
269
- layoutFlags
270
- };
271
- }
272
- async function probeLayoutForErrors(options, layoutIndex) {
273
- const outcome = await runWithConnectionProbe(async () => {
274
- try {
275
- const layoutResult = options.probeLayoutAt(layoutIndex);
276
- if (isPromiseLike(layoutResult)) await layoutResult;
277
- } catch (error) {
278
- return options.onLayoutError(error, layoutIndex);
279
- }
280
- return null;
281
- });
282
- return outcome.completed ? outcome.result : null;
283
- }
284
397
  async function readAppPageBinaryStream(stream) {
285
398
  const reader = stream.getReader();
286
399
  const chunks = [];
@@ -325,4 +438,4 @@ function buildAppPageFontLinkHeader(preloads) {
325
438
  return preloads.map((preload) => `<${preload.href}>; rel=preload; as=font; type=${preload.type}; crossorigin`).join(", ");
326
439
  }
327
440
  //#endregion
328
- export { bufferAppPageBinaryStream, buildAppPageFontLinkHeader, buildAppPageSpecialErrorResponse, probeAppPageLayouts, readAppPageBinaryStream, resolveAppPageShellSpecialError, resolveAppPageSpecialError, resolveAppPageSpecialErrorStoredHeaders, tagAppPageMetadataError, teeAppPageRscStreamForCapture };
441
+ export { APP_PAGE_NOT_FOUND_BOUNDARY_ID, bufferAppPageBinaryStream, buildAppPageFontLinkHeader, buildAppPageSpecialErrorResponse, readAppPageBinaryStream, resolveAppPageCaughtNotFoundBoundaries, resolveAppPageShellSpecialError, resolveAppPageSpecialError, resolveAppPageSpecialErrorStoredHeaders, tagAppPageLayoutError, tagAppPageMetadataError, tagAppPagePageError, tagAppPageSlotError, teeAppPageRscStreamForCapture };
@@ -1,7 +1,7 @@
1
1
  import { MetadataFileRoute } from "./metadata-routes.js";
2
2
  import { AppPageParams } from "./app-page-boundary.js";
3
3
  import { ThenableParamsObserver } from "../shims/thenable-params.js";
4
- import { Metadata, ResolvedViewport } from "../shims/metadata.js";
4
+ import { Metadata, ResolvedViewport, Viewport } from "../shims/metadata.js";
5
5
  import { applyFileBasedMetadata } from "./file-based-metadata.js";
6
6
  //#region src/server/app-page-head.d.ts
7
7
  export type AppPageSearchParams = Record<string, string | string[]>;
@@ -21,6 +21,12 @@ export type AppPageHeadParallelRoute<TModule extends AppPageHeadModule = AppPage
21
21
  layoutParams?: readonly AppPageParams[] | null;
22
22
  layoutModule?: TModule | null;
23
23
  layoutModules?: readonly (TModule | null | undefined)[] | null;
24
+ /**
25
+ * Whether each layout is in its page's own loader-tree segment, from the
26
+ * filesystem: route groups are segments, and an intercept's
27
+ * `layoutTreePositions` don't count its page's. Unmarked layouts are above it.
28
+ */
29
+ layoutsBesidePage?: readonly boolean[] | null;
24
30
  layoutTreePositions?: readonly number[] | null;
25
31
  moduleRoutePrefixSegments?: readonly string[] | null;
26
32
  moduleRouteSegments?: readonly string[] | null;
@@ -34,15 +40,36 @@ export type ActiveParallelRouteHeadInput<TModule extends AppPageHeadModule = App
34
40
  notFoundModuleRouteSegments?: readonly string[] | null;
35
41
  notFoundParams?: AppPageParams | null;
36
42
  ownerTreePosition: number;
43
+ /** The `slots` key of the slot this branch renders in. */
44
+ slotKey?: string;
45
+ };
46
+ /**
47
+ * A branch whose head Next.js resolves but never shows: a slot intercept's
48
+ * layouts and page beside the source page. It renders in the slot at
49
+ * `parallelRouteIndex` of `parallelRoutes` and shares that slot's first
50
+ * `sharedLayoutCount` layouts, which resolve once for both.
51
+ */
52
+ export type AppPageHiddenParallelRoute<TModule extends AppPageHeadModule = AppPageHeadModule> = {
53
+ parallelRouteIndex: number;
54
+ route: AppPageHeadParallelRoute<TModule>;
55
+ sharedLayoutCount: number;
37
56
  };
38
57
  type AppPageHeadSlot<TModule extends AppPageHeadModule = AppPageHeadModule> = {
39
58
  configLayouts?: readonly (TModule | null | undefined)[] | null;
40
59
  configLayoutTreePositions?: readonly number[] | null;
41
60
  layout?: TModule | null;
42
61
  layoutIndex?: number;
62
+ name?: string | null;
43
63
  notFound?: TModule | null;
44
64
  notFoundTreePosition?: number | null;
65
+ /** Directory depth of the folder holding the `@slot` directory. */
66
+ ownerTreePosition?: number | null;
45
67
  page?: TModule | null;
68
+ /**
69
+ * The active page's tree position below the slot root, route groups
70
+ * included, in the coordinates of `configLayoutTreePositions`.
71
+ */
72
+ pageTreePosition?: number | null;
46
73
  routeSegments?: readonly string[] | null;
47
74
  };
48
75
  type ResolveActiveParallelRouteHeadInputsOptions<TModule extends AppPageHeadModule = AppPageHeadModule> = {
@@ -72,9 +99,22 @@ type ResolveAppPageHeadOptions<TModule extends AppPageHeadModule = AppPageHeadMo
72
99
  */
73
100
  basePath?: string;
74
101
  fallbackOnFileMetadataError?: boolean;
102
+ /**
103
+ * Branches whose head Next.js resolves but never shows, such as a slot
104
+ * intercept beside the source page. Their own generateMetadata() and
105
+ * generateViewport() run once, after every branch before them in the loader
106
+ * tree, and their errors reach `hiddenErrors` rather than the head.
107
+ */
108
+ hiddenParallelRoutes?: readonly AppPageHiddenParallelRoute<TModule>[] | null;
75
109
  layoutModules: readonly (TModule | null | undefined)[];
76
110
  layoutTreePositions?: readonly number[] | null;
77
111
  metadataRoutes: readonly MetadataFileRoute[];
112
+ /**
113
+ * The index in `parallelRoutes` of a shown branch whose own errors reach
114
+ * `hiddenErrors` rather than `routeErrors`, such as a slot intercept that
115
+ * heads the route: Next.js throws them in that page's own segment.
116
+ */
117
+ outletParallelRouteIndex?: number | null;
78
118
  pageModule?: TModule | null;
79
119
  parallelRoutes?: readonly AppPageHeadParallelRoute<TModule>[] | null;
80
120
  params: AppPageParams;
@@ -103,14 +143,78 @@ export type ResolveAppPageHeadResult = {
103
143
  viewport: ResolvedViewport;
104
144
  };
105
145
  export type PreparedAppPageHead = Omit<ResolveAppPageHeadResult, "metadata" | "viewport"> & {
146
+ /**
147
+ * Rejects with the first own error, in loader-tree order, of an item of
148
+ * `hiddenParallelRoutes` or of `outletParallelRouteIndex`, or with the
149
+ * head's own failure when that outlet branch heads the route.
150
+ */
151
+ hiddenErrors: Promise<null>;
106
152
  metadata: Promise<Metadata | null>;
153
+ /**
154
+ * Rejects with the first own error, in loader-tree order, of every other
155
+ * item, or with the head's own failure. Those errors never wait on the
156
+ * outlet branch; what only the outlet branch settling makes known, a later
157
+ * item's failed merge or its error after reading `parent`, counts after them.
158
+ */
159
+ routeErrors: Promise<null>;
107
160
  viewport: Promise<ResolvedViewport>;
108
161
  };
162
+ /**
163
+ * A route's head as one render prepared it, for a later render to reuse. Each
164
+ * branch already settled its own signals, so neither rejects.
165
+ */
166
+ export type AppPagePreparedRouteHead = {
167
+ /** The `dynamic = "error"` access error either branch dropped, which still fails the render. */
168
+ accessError: Promise<Error | null>;
169
+ metadata: Promise<Metadata | null>;
170
+ /** Where that render places generateMetadata()'s tags: "body" streams them. */
171
+ metadataPlacement: "body" | "head";
172
+ /** `null` when its resolution failed, so the head has no viewport tags. */
173
+ viewport: Promise<Viewport | null>;
174
+ };
175
+ /**
176
+ * A special-error fallback for a signal the matched route's render threw keeps
177
+ * the route's own head: the head that render prepared, or, when it never
178
+ * started one, a fresh resolution with that render's query and placement.
179
+ */
180
+ export type AppPageFallbackRouteHead = {
181
+ /** Whether metadata's `searchParams` reads count as dynamic usage, as in the render. */
182
+ observeSearchParams: boolean;
183
+ prepared: AppPagePreparedRouteHead | null;
184
+ /** The query the render read: a rewrite's, or none for a static render. */
185
+ searchParams: URLSearchParams;
186
+ /** Whether the render streams generated metadata into the body. */
187
+ streamMetadata: boolean;
188
+ };
109
189
  type AppPageSearchParamsCollection = {
110
190
  hasSearchParams: boolean;
111
191
  pageSearchParams: AppPageSearchParams;
112
192
  };
193
+ /** Whether each intercepting layout is in its intercepting page's own directory. */
194
+ export declare function resolveInterceptLayoutsBesidePage(layoutSegments: readonly (readonly string[])[] | null | undefined, branchSegments: readonly string[] | null | undefined): boolean[];
113
195
  export declare function resolveActiveParallelRouteHeadInputs<TModule extends AppPageHeadModule>(options: ResolveActiveParallelRouteHeadInputsOptions<TModule>): ActiveParallelRouteHeadInput<TModule>[];
196
+ /**
197
+ * Whether a slot intercept keeps the source route's head. Next.js's client
198
+ * renders the head of the first leaf on a children-first walk of its router
199
+ * tree that skips `default` segments, and a slot intercept keeps the leaves
200
+ * before its slot from the source route. When one of them is a page, such as
201
+ * the source page in `children`, the source head stays; otherwise the walk
202
+ * reaches the intercept's leaf, headed by the intercepting render.
203
+ * `sourceParallelRoutes` are the source route's own slot branches, in the
204
+ * walk's order (resolveActiveParallelRouteHeadInputs).
205
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/router-reducer/reducers/find-head-in-cache.ts
206
+ */
207
+ export declare function slotInterceptKeepsSourceHead(options: {
208
+ interceptSlotKey: string;
209
+ /** The source route; its `children` is a page unless it renders a default. */
210
+ route: {
211
+ childrenSlot?: {
212
+ state: string;
213
+ } | null;
214
+ page?: unknown;
215
+ };
216
+ sourceParallelRoutes: readonly ActiveParallelRouteHeadInput[];
217
+ }): boolean;
114
218
  export declare function collectAppPageSearchParams(searchParams: URLSearchParams | null | undefined): AppPageSearchParamsCollection;
115
219
  /**
116
220
  * Resolve an explicit metadata-source sequence.
@@ -125,7 +229,7 @@ export declare function resolveAppPageHead<TModule extends AppPageHeadModule>(op
125
229
  * Whether any segment of the page's head exports `generateMetadata()`. Known
126
230
  * from the modules alone, so callers can place the head before resolving it.
127
231
  */
128
- export declare function hasAppPageDynamicMetadata<TModule extends AppPageHeadModule>(options: Pick<ResolveAppPageHeadOptions<TModule>, "layoutModules" | "pageModule" | "parallelRoutes">): boolean;
232
+ export declare function hasAppPageDynamicMetadata<TModule extends AppPageHeadModule>(options: Pick<ResolveAppPageHeadOptions<TModule>, "hiddenParallelRoutes" | "layoutModules" | "pageModule" | "parallelRoutes">): boolean;
129
233
  /**
130
234
  * Start metadata and viewport resolution without coupling their completion.
131
235
  *
@@ -134,4 +238,5 @@ export declare function hasAppPageDynamicMetadata<TModule extends AppPageHeadMod
134
238
  * callers use {@link resolveAppPageHead} and observe the same result as before.
135
239
  */
136
240
  export declare function prepareAppPageHead<TModule extends AppPageHeadModule>(options: ResolveAppPageHeadOptions<TModule>): PreparedAppPageHead;
137
- //#endregion
241
+ //#endregion
242
+ export {};