vinext 0.0.49 → 0.0.51

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 (506) hide show
  1. package/dist/build/client-build-config.js.map +1 -1
  2. package/dist/build/google-fonts/build-url.js.map +1 -1
  3. package/dist/build/google-fonts/fallback-metrics-data.js +14031 -0
  4. package/dist/build/google-fonts/fallback-metrics-data.js.map +1 -0
  5. package/dist/build/google-fonts/fallback-metrics.d.ts +13 -0
  6. package/dist/build/google-fonts/fallback-metrics.js +46 -0
  7. package/dist/build/google-fonts/fallback-metrics.js.map +1 -0
  8. package/dist/build/google-fonts/get-axes.js.map +1 -1
  9. package/dist/build/google-fonts/sort-variants.js.map +1 -1
  10. package/dist/build/google-fonts/validate.js.map +1 -1
  11. package/dist/build/layout-classification.js.map +1 -1
  12. package/dist/build/nitro-route-rules.js.map +1 -1
  13. package/dist/build/precompress.d.ts +13 -2
  14. package/dist/build/precompress.js +12 -3
  15. package/dist/build/precompress.js.map +1 -1
  16. package/dist/build/prerender.d.ts +17 -1
  17. package/dist/build/prerender.js +114 -23
  18. package/dist/build/prerender.js.map +1 -1
  19. package/dist/build/report.d.ts +5 -4
  20. package/dist/build/report.js +196 -348
  21. package/dist/build/report.js.map +1 -1
  22. package/dist/build/route-classification-injector.js.map +1 -1
  23. package/dist/build/route-classification-manifest.js.map +1 -1
  24. package/dist/build/run-prerender.js.map +1 -1
  25. package/dist/build/server-manifest.js.map +1 -1
  26. package/dist/build/ssr-manifest.js.map +1 -1
  27. package/dist/build/standalone.js.map +1 -1
  28. package/dist/build/static-export.js.map +1 -1
  29. package/dist/check.js +2 -1
  30. package/dist/check.js.map +1 -1
  31. package/dist/cli-args.js.map +1 -1
  32. package/dist/cli.js +68 -7
  33. package/dist/cli.js.map +1 -1
  34. package/dist/client/instrumentation-client-state.js.map +1 -1
  35. package/dist/client/validate-module-path.js.map +1 -1
  36. package/dist/client/vinext-next-data.d.ts +5 -1
  37. package/dist/client/window-next.d.ts +151 -0
  38. package/dist/client/window-next.js +48 -0
  39. package/dist/client/window-next.js.map +1 -0
  40. package/dist/cloudflare/kv-cache-handler.js.map +1 -1
  41. package/dist/cloudflare/tpr.js +2 -1
  42. package/dist/cloudflare/tpr.js.map +1 -1
  43. package/dist/config/config-matchers.d.ts +3 -1
  44. package/dist/config/config-matchers.js +5 -4
  45. package/dist/config/config-matchers.js.map +1 -1
  46. package/dist/config/dotenv.d.ts +11 -1
  47. package/dist/config/dotenv.js.map +1 -1
  48. package/dist/config/next-config.d.ts +93 -6
  49. package/dist/config/next-config.js +233 -6
  50. package/dist/config/next-config.js.map +1 -1
  51. package/dist/config/tsconfig-paths.d.ts +13 -0
  52. package/dist/config/tsconfig-paths.js +117 -0
  53. package/dist/config/tsconfig-paths.js.map +1 -0
  54. package/dist/deploy.js +16 -7
  55. package/dist/deploy.js.map +1 -1
  56. package/dist/entries/app-browser-entry.d.ts +3 -1
  57. package/dist/entries/app-browser-entry.js +36 -2
  58. package/dist/entries/app-browser-entry.js.map +1 -1
  59. package/dist/entries/app-rsc-entry.d.ts +19 -1
  60. package/dist/entries/app-rsc-entry.js +49 -12
  61. package/dist/entries/app-rsc-entry.js.map +1 -1
  62. package/dist/entries/app-rsc-manifest.d.ts +9 -0
  63. package/dist/entries/app-rsc-manifest.js +8 -1
  64. package/dist/entries/app-rsc-manifest.js.map +1 -1
  65. package/dist/entries/app-ssr-entry.js.map +1 -1
  66. package/dist/entries/pages-client-entry.js +3 -5
  67. package/dist/entries/pages-client-entry.js.map +1 -1
  68. package/dist/entries/pages-entry-helpers.js.map +1 -1
  69. package/dist/entries/pages-server-entry.js +34 -1
  70. package/dist/entries/pages-server-entry.js.map +1 -1
  71. package/dist/entries/runtime-entry-module.js.map +1 -1
  72. package/dist/index.js +204 -53
  73. package/dist/index.js.map +1 -1
  74. package/dist/init.js.map +1 -1
  75. package/dist/plugins/async-hooks-stub.js.map +1 -1
  76. package/dist/plugins/client-reference-dedup.d.ts +15 -2
  77. package/dist/plugins/client-reference-dedup.js +138 -16
  78. package/dist/plugins/client-reference-dedup.js.map +1 -1
  79. package/dist/plugins/fonts.d.ts +2 -2
  80. package/dist/plugins/fonts.js +15 -6
  81. package/dist/plugins/fonts.js.map +1 -1
  82. package/dist/plugins/instrumentation-client.js.map +1 -1
  83. package/dist/plugins/og-assets.js.map +1 -1
  84. package/dist/plugins/optimize-imports.js.map +1 -1
  85. package/dist/plugins/postcss.js.map +1 -1
  86. package/dist/plugins/rsc-client-reference-loaders.d.ts +7 -0
  87. package/dist/plugins/rsc-client-reference-loaders.js +48 -0
  88. package/dist/plugins/rsc-client-reference-loaders.js.map +1 -0
  89. package/dist/plugins/rsc-client-shim-excludes.js.map +1 -1
  90. package/dist/plugins/sass.d.ts +34 -0
  91. package/dist/plugins/sass.js +22 -0
  92. package/dist/plugins/sass.js.map +1 -0
  93. package/dist/plugins/server-externals-manifest.js.map +1 -1
  94. package/dist/plugins/strip-server-exports.js.map +1 -1
  95. package/dist/routing/app-route-graph.d.ts +78 -6
  96. package/dist/routing/app-route-graph.js +241 -25
  97. package/dist/routing/app-route-graph.js.map +1 -1
  98. package/dist/routing/app-router.js.map +1 -1
  99. package/dist/routing/file-matcher.js.map +1 -1
  100. package/dist/routing/pages-router.js.map +1 -1
  101. package/dist/routing/route-matching.js.map +1 -1
  102. package/dist/routing/route-pattern.d.ts +56 -1
  103. package/dist/routing/route-pattern.js +60 -1
  104. package/dist/routing/route-pattern.js.map +1 -1
  105. package/dist/routing/route-trie.js.map +1 -1
  106. package/dist/routing/route-validation.js.map +1 -1
  107. package/dist/routing/utils.js.map +1 -1
  108. package/dist/server/api-handler.js.map +1 -1
  109. package/dist/server/app-browser-action-result.d.ts +44 -0
  110. package/dist/server/app-browser-action-result.js +79 -0
  111. package/dist/server/app-browser-action-result.js.map +1 -0
  112. package/dist/server/app-browser-entry.js +330 -133
  113. package/dist/server/app-browser-entry.js.map +1 -1
  114. package/dist/server/app-browser-error.js.map +1 -1
  115. package/dist/server/app-browser-hydration.d.ts +31 -0
  116. package/dist/server/app-browser-hydration.js +30 -0
  117. package/dist/server/app-browser-hydration.js.map +1 -0
  118. package/dist/server/app-browser-navigation-controller.d.ts +20 -4
  119. package/dist/server/app-browser-navigation-controller.js +90 -23
  120. package/dist/server/app-browser-navigation-controller.js.map +1 -1
  121. package/dist/server/app-browser-popstate.d.ts +16 -0
  122. package/dist/server/app-browser-popstate.js +17 -0
  123. package/dist/server/app-browser-popstate.js.map +1 -0
  124. package/dist/server/app-browser-rsc-redirect.d.ts +28 -0
  125. package/dist/server/app-browser-rsc-redirect.js +37 -0
  126. package/dist/server/app-browser-rsc-redirect.js.map +1 -0
  127. package/dist/server/app-browser-state.d.ts +27 -23
  128. package/dist/server/app-browser-state.js +158 -54
  129. package/dist/server/app-browser-state.js.map +1 -1
  130. package/dist/server/app-browser-stream.d.ts +9 -4
  131. package/dist/server/app-browser-stream.js +29 -8
  132. package/dist/server/app-browser-stream.js.map +1 -1
  133. package/dist/server/app-browser-visible-commit.d.ts +11 -1
  134. package/dist/server/app-browser-visible-commit.js +69 -21
  135. package/dist/server/app-browser-visible-commit.js.map +1 -1
  136. package/dist/server/app-client-reference-preloader.js.map +1 -1
  137. package/dist/server/app-elements-wire.d.ts +43 -6
  138. package/dist/server/app-elements-wire.js +121 -5
  139. package/dist/server/app-elements-wire.js.map +1 -1
  140. package/dist/server/app-elements.d.ts +2 -2
  141. package/dist/server/app-elements.js +2 -2
  142. package/dist/server/app-elements.js.map +1 -1
  143. package/dist/server/app-fallback-renderer.d.ts +10 -1
  144. package/dist/server/app-fallback-renderer.js +37 -1
  145. package/dist/server/app-fallback-renderer.js.map +1 -1
  146. package/dist/server/app-history-state.d.ts +26 -0
  147. package/dist/server/app-history-state.js +53 -0
  148. package/dist/server/app-history-state.js.map +1 -0
  149. package/dist/server/app-hook-warning-suppression.js.map +1 -1
  150. package/dist/server/app-middleware.d.ts +1 -1
  151. package/dist/server/app-middleware.js +4 -9
  152. package/dist/server/app-middleware.js.map +1 -1
  153. package/dist/server/app-mounted-slots-header.js.map +1 -1
  154. package/dist/server/app-page-boundary-render.d.ts +11 -1
  155. package/dist/server/app-page-boundary-render.js +27 -19
  156. package/dist/server/app-page-boundary-render.js.map +1 -1
  157. package/dist/server/app-page-boundary.d.ts +1 -0
  158. package/dist/server/app-page-boundary.js +10 -7
  159. package/dist/server/app-page-boundary.js.map +1 -1
  160. package/dist/server/app-page-cache.d.ts +23 -3
  161. package/dist/server/app-page-cache.js +63 -27
  162. package/dist/server/app-page-cache.js.map +1 -1
  163. package/dist/server/app-page-dispatch.d.ts +11 -1
  164. package/dist/server/app-page-dispatch.js +85 -14
  165. package/dist/server/app-page-dispatch.js.map +1 -1
  166. package/dist/server/app-page-element-builder.d.ts +10 -1
  167. package/dist/server/app-page-element-builder.js +38 -6
  168. package/dist/server/app-page-element-builder.js.map +1 -1
  169. package/dist/server/app-page-execution.js +2 -3
  170. package/dist/server/app-page-execution.js.map +1 -1
  171. package/dist/server/app-page-head.d.ts +7 -0
  172. package/dist/server/app-page-head.js +6 -1
  173. package/dist/server/app-page-head.js.map +1 -1
  174. package/dist/server/app-page-method.js.map +1 -1
  175. package/dist/server/app-page-params.js.map +1 -1
  176. package/dist/server/app-page-probe.d.ts +23 -1
  177. package/dist/server/app-page-probe.js +29 -1
  178. package/dist/server/app-page-probe.js.map +1 -1
  179. package/dist/server/app-page-render-observation.d.ts +35 -0
  180. package/dist/server/app-page-render-observation.js +68 -0
  181. package/dist/server/app-page-render-observation.js.map +1 -0
  182. package/dist/server/app-page-render.d.ts +12 -2
  183. package/dist/server/app-page-render.js +90 -7
  184. package/dist/server/app-page-render.js.map +1 -1
  185. package/dist/server/app-page-request.d.ts +1 -0
  186. package/dist/server/app-page-request.js +2 -1
  187. package/dist/server/app-page-request.js.map +1 -1
  188. package/dist/server/app-page-response.d.ts +2 -0
  189. package/dist/server/app-page-response.js +18 -7
  190. package/dist/server/app-page-response.js.map +1 -1
  191. package/dist/server/app-page-route-wiring.d.ts +9 -3
  192. package/dist/server/app-page-route-wiring.js +91 -62
  193. package/dist/server/app-page-route-wiring.js.map +1 -1
  194. package/dist/server/app-page-segment-state.d.ts +10 -0
  195. package/dist/server/app-page-segment-state.js +87 -0
  196. package/dist/server/app-page-segment-state.js.map +1 -0
  197. package/dist/server/app-page-stream.d.ts +9 -2
  198. package/dist/server/app-page-stream.js +4 -1
  199. package/dist/server/app-page-stream.js.map +1 -1
  200. package/dist/server/app-post-middleware-context.js.map +1 -1
  201. package/dist/server/app-prerender-endpoints.js.map +1 -1
  202. package/dist/server/app-prerender-static-params.js.map +1 -1
  203. package/dist/server/app-render-dependency.js.map +1 -1
  204. package/dist/server/app-request-context.js.map +1 -1
  205. package/dist/server/app-route-handler-cache.js.map +1 -1
  206. package/dist/server/app-route-handler-dispatch.js +3 -1
  207. package/dist/server/app-route-handler-dispatch.js.map +1 -1
  208. package/dist/server/app-route-handler-execution.js.map +1 -1
  209. package/dist/server/app-route-handler-policy.js +1 -0
  210. package/dist/server/app-route-handler-policy.js.map +1 -1
  211. package/dist/server/app-route-handler-response.js +4 -3
  212. package/dist/server/app-route-handler-response.js.map +1 -1
  213. package/dist/server/app-route-handler-runtime.js.map +1 -1
  214. package/dist/server/app-router-entry.js +7 -15
  215. package/dist/server/app-router-entry.js.map +1 -1
  216. package/dist/server/app-rsc-cache-busting.d.ts +23 -2
  217. package/dist/server/app-rsc-cache-busting.js +75 -19
  218. package/dist/server/app-rsc-cache-busting.js.map +1 -1
  219. package/dist/server/app-rsc-embedded-chunks.d.ts +9 -0
  220. package/dist/server/app-rsc-embedded-chunks.js +34 -0
  221. package/dist/server/app-rsc-embedded-chunks.js.map +1 -0
  222. package/dist/server/app-rsc-error-handler.js.map +1 -1
  223. package/dist/server/app-rsc-errors.d.ts +4 -1
  224. package/dist/server/app-rsc-errors.js +1 -1
  225. package/dist/server/app-rsc-errors.js.map +1 -1
  226. package/dist/server/app-rsc-handler.d.ts +18 -1
  227. package/dist/server/app-rsc-handler.js +55 -16
  228. package/dist/server/app-rsc-handler.js.map +1 -1
  229. package/dist/server/app-rsc-render-mode.d.ts +11 -0
  230. package/dist/server/app-rsc-render-mode.js +21 -0
  231. package/dist/server/app-rsc-render-mode.js.map +1 -0
  232. package/dist/server/app-rsc-request-normalization.d.ts +4 -1
  233. package/dist/server/app-rsc-request-normalization.js +7 -2
  234. package/dist/server/app-rsc-request-normalization.js.map +1 -1
  235. package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
  236. package/dist/server/app-rsc-response-finalizer.js +6 -1
  237. package/dist/server/app-rsc-response-finalizer.js.map +1 -1
  238. package/dist/server/app-rsc-route-matching.d.ts +23 -0
  239. package/dist/server/app-rsc-route-matching.js +45 -23
  240. package/dist/server/app-rsc-route-matching.js.map +1 -1
  241. package/dist/server/app-segment-config.js.map +1 -1
  242. package/dist/server/app-server-action-execution.d.ts +51 -5
  243. package/dist/server/app-server-action-execution.js +161 -51
  244. package/dist/server/app-server-action-execution.js.map +1 -1
  245. package/dist/server/app-ssr-entry.d.ts +7 -0
  246. package/dist/server/app-ssr-entry.js +44 -14
  247. package/dist/server/app-ssr-entry.js.map +1 -1
  248. package/dist/server/app-ssr-error-meta.d.ts +14 -0
  249. package/dist/server/app-ssr-error-meta.js +50 -0
  250. package/dist/server/app-ssr-error-meta.js.map +1 -0
  251. package/dist/server/app-ssr-stream.d.ts +1 -1
  252. package/dist/server/app-ssr-stream.js +9 -12
  253. package/dist/server/app-ssr-stream.js.map +1 -1
  254. package/dist/server/app-static-generation.js.map +1 -1
  255. package/dist/server/artifact-compatibility.d.ts +12 -2
  256. package/dist/server/artifact-compatibility.js +12 -8
  257. package/dist/server/artifact-compatibility.js.map +1 -1
  258. package/dist/server/cache-control.js +1 -0
  259. package/dist/server/cache-control.js.map +1 -1
  260. package/dist/server/cache-proof.d.ts +124 -5
  261. package/dist/server/cache-proof.js +416 -18
  262. package/dist/server/cache-proof.js.map +1 -1
  263. package/dist/server/csp.js.map +1 -1
  264. package/dist/server/dev-error-overlay-store.js.map +1 -1
  265. package/dist/server/dev-error-overlay.js +5 -0
  266. package/dist/server/dev-error-overlay.js.map +1 -1
  267. package/dist/server/dev-lockfile.d.ts +110 -0
  268. package/dist/server/dev-lockfile.js +180 -0
  269. package/dist/server/dev-lockfile.js.map +1 -0
  270. package/dist/server/dev-module-runner.js.map +1 -1
  271. package/dist/server/dev-origin-check.js.map +1 -1
  272. package/dist/server/dev-route-files.js.map +1 -1
  273. package/dist/server/dev-server.js +23 -10
  274. package/dist/server/dev-server.js.map +1 -1
  275. package/dist/server/file-based-metadata.d.ts +13 -0
  276. package/dist/server/file-based-metadata.js +49 -2
  277. package/dist/server/file-based-metadata.js.map +1 -1
  278. package/dist/server/headers.d.ts +81 -0
  279. package/dist/server/headers.js +104 -0
  280. package/dist/server/headers.js.map +1 -0
  281. package/dist/server/html.js +1 -1
  282. package/dist/server/html.js.map +1 -1
  283. package/dist/server/http-error-responses.d.ts +10 -0
  284. package/dist/server/http-error-responses.js +11 -1
  285. package/dist/server/http-error-responses.js.map +1 -1
  286. package/dist/server/image-optimization.d.ts +11 -1
  287. package/dist/server/image-optimization.js.map +1 -1
  288. package/dist/server/implicit-tags.js +2 -1
  289. package/dist/server/implicit-tags.js.map +1 -1
  290. package/dist/server/instrumentation-runtime.js.map +1 -1
  291. package/dist/server/instrumentation.js.map +1 -1
  292. package/dist/server/isr-cache.d.ts +12 -2
  293. package/dist/server/isr-cache.js +16 -5
  294. package/dist/server/isr-cache.js.map +1 -1
  295. package/dist/server/metadata-route-build-data.js.map +1 -1
  296. package/dist/server/metadata-route-response.js +22 -5
  297. package/dist/server/metadata-route-response.js.map +1 -1
  298. package/dist/server/metadata-routes.js +27 -8
  299. package/dist/server/metadata-routes.js.map +1 -1
  300. package/dist/server/middleware-matcher.js.map +1 -1
  301. package/dist/server/middleware-request-headers.d.ts +4 -1
  302. package/dist/server/middleware-request-headers.js +15 -8
  303. package/dist/server/middleware-request-headers.js.map +1 -1
  304. package/dist/server/middleware-response-headers.d.ts +2 -1
  305. package/dist/server/middleware-response-headers.js +1 -1
  306. package/dist/server/middleware-response-headers.js.map +1 -1
  307. package/dist/server/middleware-runtime.d.ts +1 -0
  308. package/dist/server/middleware-runtime.js +7 -3
  309. package/dist/server/middleware-runtime.js.map +1 -1
  310. package/dist/server/middleware.d.ts +12 -0
  311. package/dist/server/middleware.js +12 -0
  312. package/dist/server/middleware.js.map +1 -1
  313. package/dist/server/navigation-planner.d.ts +133 -0
  314. package/dist/server/navigation-planner.js +432 -0
  315. package/dist/server/navigation-planner.js.map +1 -0
  316. package/dist/server/navigation-trace.d.ts +19 -2
  317. package/dist/server/navigation-trace.js +20 -1
  318. package/dist/server/navigation-trace.js.map +1 -1
  319. package/dist/server/next-error-digest.d.ts +3 -2
  320. package/dist/server/next-error-digest.js +4 -2
  321. package/dist/server/next-error-digest.js.map +1 -1
  322. package/dist/server/normalize-path.d.ts +2 -1
  323. package/dist/server/normalize-path.js +4 -1
  324. package/dist/server/normalize-path.js.map +1 -1
  325. package/dist/server/pages-api-route.js +1 -0
  326. package/dist/server/pages-api-route.js.map +1 -1
  327. package/dist/server/pages-i18n.js.map +1 -1
  328. package/dist/server/pages-media-type.js.map +1 -1
  329. package/dist/server/pages-node-compat.js.map +1 -1
  330. package/dist/server/pages-page-data.d.ts +3 -2
  331. package/dist/server/pages-page-data.js +27 -5
  332. package/dist/server/pages-page-data.js.map +1 -1
  333. package/dist/server/pages-page-response.js +2 -1
  334. package/dist/server/pages-page-response.js.map +1 -1
  335. package/dist/server/prerender-work-unit-setup.js +1 -1
  336. package/dist/server/prerender-work-unit-setup.js.map +1 -1
  337. package/dist/server/prod-server.d.ts +28 -1
  338. package/dist/server/prod-server.js +97 -22
  339. package/dist/server/prod-server.js.map +1 -1
  340. package/dist/server/request-log.js.map +1 -1
  341. package/dist/server/request-pipeline.d.ts +1 -13
  342. package/dist/server/request-pipeline.js +3 -25
  343. package/dist/server/request-pipeline.js.map +1 -1
  344. package/dist/server/rsc-stream-hints.js.map +1 -1
  345. package/dist/server/seed-cache.js.map +1 -1
  346. package/dist/server/server-action-not-found.d.ts +16 -3
  347. package/dist/server/server-action-not-found.js +22 -4
  348. package/dist/server/server-action-not-found.js.map +1 -1
  349. package/dist/server/server-globals.d.ts +5 -0
  350. package/dist/server/server-globals.js +37 -0
  351. package/dist/server/server-globals.js.map +1 -0
  352. package/dist/server/socket-error-backstop.js.map +1 -1
  353. package/dist/server/static-file-cache.js +1 -1
  354. package/dist/server/static-file-cache.js.map +1 -1
  355. package/dist/server/worker-utils.d.ts +0 -7
  356. package/dist/server/worker-utils.js +3 -2
  357. package/dist/server/worker-utils.js.map +1 -1
  358. package/dist/shims/amp.js.map +1 -1
  359. package/dist/shims/app.d.ts +37 -4
  360. package/dist/shims/app.js +50 -1
  361. package/dist/shims/app.js.map +1 -0
  362. package/dist/shims/cache-for-request.js.map +1 -1
  363. package/dist/shims/cache-runtime.d.ts +19 -2
  364. package/dist/shims/cache-runtime.js +87 -19
  365. package/dist/shims/cache-runtime.js.map +1 -1
  366. package/dist/shims/cache.d.ts +20 -21
  367. package/dist/shims/cache.js +101 -15
  368. package/dist/shims/cache.js.map +1 -1
  369. package/dist/shims/client-hook-error.js.map +1 -1
  370. package/dist/shims/compat-router.js.map +1 -1
  371. package/dist/shims/config.js.map +1 -1
  372. package/dist/shims/constants.js.map +1 -1
  373. package/dist/shims/document.js.map +1 -1
  374. package/dist/shims/dynamic.d.ts +18 -10
  375. package/dist/shims/dynamic.js +107 -51
  376. package/dist/shims/dynamic.js.map +1 -1
  377. package/dist/shims/error-boundary.d.ts +35 -6
  378. package/dist/shims/error-boundary.js +116 -33
  379. package/dist/shims/error-boundary.js.map +1 -1
  380. package/dist/shims/error.d.ts +18 -1
  381. package/dist/shims/error.js +56 -1
  382. package/dist/shims/error.js.map +1 -1
  383. package/dist/shims/fetch-cache.d.ts +25 -1
  384. package/dist/shims/fetch-cache.js +159 -13
  385. package/dist/shims/fetch-cache.js.map +1 -1
  386. package/dist/shims/font-google-base.d.ts +22 -8
  387. package/dist/shims/font-google-base.js +41 -71
  388. package/dist/shims/font-google-base.js.map +1 -1
  389. package/dist/shims/font-local.d.ts +3 -20
  390. package/dist/shims/font-local.js +23 -75
  391. package/dist/shims/font-local.js.map +1 -1
  392. package/dist/shims/font-utils.d.ts +51 -0
  393. package/dist/shims/font-utils.js +97 -0
  394. package/dist/shims/font-utils.js.map +1 -0
  395. package/dist/shims/form.js +3 -1
  396. package/dist/shims/form.js.map +1 -1
  397. package/dist/shims/hash-scroll.d.ts +7 -0
  398. package/dist/shims/hash-scroll.js +30 -0
  399. package/dist/shims/hash-scroll.js.map +1 -0
  400. package/dist/shims/head-state.js.map +1 -1
  401. package/dist/shims/head.d.ts +3 -1
  402. package/dist/shims/head.js +28 -16
  403. package/dist/shims/head.js.map +1 -1
  404. package/dist/shims/headers.d.ts +11 -12
  405. package/dist/shims/headers.js +45 -8
  406. package/dist/shims/headers.js.map +1 -1
  407. package/dist/shims/i18n-context.js.map +1 -1
  408. package/dist/shims/i18n-state.js.map +1 -1
  409. package/dist/shims/image-config.d.ts +14 -1
  410. package/dist/shims/image-config.js +24 -1
  411. package/dist/shims/image-config.js.map +1 -1
  412. package/dist/shims/image.d.ts +1 -0
  413. package/dist/shims/image.js +159 -80
  414. package/dist/shims/image.js.map +1 -1
  415. package/dist/shims/internal/als-registry.js.map +1 -1
  416. package/dist/shims/internal/app-router-context.d.ts +7 -6
  417. package/dist/shims/internal/app-router-context.js +17 -6
  418. package/dist/shims/internal/app-router-context.js.map +1 -1
  419. package/dist/shims/internal/cookie-serialize.js.map +1 -1
  420. package/dist/shims/internal/make-hanging-promise.d.ts +1 -1
  421. package/dist/shims/internal/make-hanging-promise.js +1 -1
  422. package/dist/shims/internal/make-hanging-promise.js.map +1 -1
  423. package/dist/shims/internal/parse-cookie-header.js.map +1 -1
  424. package/dist/shims/internal/utils.js.map +1 -1
  425. package/dist/shims/internal/work-unit-async-storage.js +2 -2
  426. package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
  427. package/dist/shims/layout-segment-context.js.map +1 -1
  428. package/dist/shims/legacy-image.js.map +1 -1
  429. package/dist/shims/link-prefetch.d.ts +42 -0
  430. package/dist/shims/link-prefetch.js +45 -0
  431. package/dist/shims/link-prefetch.js.map +1 -0
  432. package/dist/shims/link.d.ts +37 -4
  433. package/dist/shims/link.js +156 -46
  434. package/dist/shims/link.js.map +1 -1
  435. package/dist/shims/metadata.d.ts +16 -30
  436. package/dist/shims/metadata.js +87 -28
  437. package/dist/shims/metadata.js.map +1 -1
  438. package/dist/shims/navigation-state.js.map +1 -1
  439. package/dist/shims/navigation.d.ts +172 -10
  440. package/dist/shims/navigation.js +335 -70
  441. package/dist/shims/navigation.js.map +1 -1
  442. package/dist/shims/navigation.react-server.d.ts +3 -2
  443. package/dist/shims/navigation.react-server.js +5 -2
  444. package/dist/shims/navigation.react-server.js.map +1 -1
  445. package/dist/shims/offline.js.map +1 -1
  446. package/dist/shims/pages-router-runtime.d.ts +7 -0
  447. package/dist/shims/pages-router-runtime.js +16 -0
  448. package/dist/shims/pages-router-runtime.js.map +1 -0
  449. package/dist/shims/readonly-url-search-params.js.map +1 -1
  450. package/dist/shims/request-context.js.map +1 -1
  451. package/dist/shims/root-params.js.map +1 -1
  452. package/dist/shims/router-state.js.map +1 -1
  453. package/dist/shims/router.d.ts +69 -7
  454. package/dist/shims/router.js +232 -249
  455. package/dist/shims/router.js.map +1 -1
  456. package/dist/shims/script-nonce-context.js.map +1 -1
  457. package/dist/shims/script.js +110 -32
  458. package/dist/shims/script.js.map +1 -1
  459. package/dist/shims/server.js +12 -15
  460. package/dist/shims/server.js.map +1 -1
  461. package/dist/shims/slot.d.ts +7 -1
  462. package/dist/shims/slot.js +60 -7
  463. package/dist/shims/slot.js.map +1 -1
  464. package/dist/shims/thenable-params.js.map +1 -1
  465. package/dist/shims/unified-request-context.js +5 -0
  466. package/dist/shims/unified-request-context.js.map +1 -1
  467. package/dist/shims/unrecognized-action-error.d.ts +35 -0
  468. package/dist/shims/unrecognized-action-error.js +41 -0
  469. package/dist/shims/unrecognized-action-error.js.map +1 -0
  470. package/dist/shims/url-safety.js.map +1 -1
  471. package/dist/shims/url-utils.d.ts +22 -1
  472. package/dist/shims/url-utils.js +76 -3
  473. package/dist/shims/url-utils.js.map +1 -1
  474. package/dist/shims/use-merged-ref.js.map +1 -1
  475. package/dist/shims/web-vitals.d.ts +4 -21
  476. package/dist/shims/web-vitals.js +19 -6
  477. package/dist/shims/web-vitals.js.map +1 -1
  478. package/dist/utils/asset-prefix.d.ts +69 -0
  479. package/dist/utils/asset-prefix.js +91 -0
  480. package/dist/utils/asset-prefix.js.map +1 -0
  481. package/dist/utils/base-path.d.ts +7 -1
  482. package/dist/utils/base-path.js +10 -1
  483. package/dist/utils/base-path.js.map +1 -1
  484. package/dist/utils/cache-control-metadata.js.map +1 -1
  485. package/dist/utils/domain-locale.js.map +1 -1
  486. package/dist/utils/encode-cache-tag.d.ts +31 -0
  487. package/dist/utils/encode-cache-tag.js +38 -0
  488. package/dist/utils/encode-cache-tag.js.map +1 -0
  489. package/dist/utils/error-cause.js.map +1 -1
  490. package/dist/utils/hash.js.map +1 -1
  491. package/dist/utils/lazy-chunks.js.map +1 -1
  492. package/dist/utils/manifest-paths.js.map +1 -1
  493. package/dist/utils/mdx-scan.js.map +1 -1
  494. package/dist/utils/navigation-signal.d.ts +5 -0
  495. package/dist/utils/navigation-signal.js +14 -0
  496. package/dist/utils/navigation-signal.js.map +1 -0
  497. package/dist/utils/project.js.map +1 -1
  498. package/dist/utils/public-routes.js.map +1 -1
  499. package/dist/utils/query.js.map +1 -1
  500. package/dist/utils/safe-json-file.js.map +1 -1
  501. package/dist/utils/sorted-array.d.ts +9 -0
  502. package/dist/utils/sorted-array.js +22 -0
  503. package/dist/utils/sorted-array.js.map +1 -0
  504. package/dist/utils/text-stream.js.map +1 -1
  505. package/dist/utils/vinext-root.js.map +1 -1
  506. package/package.json +8 -6
@@ -1,8 +1,89 @@
1
1
  "use client";
2
- import { usePathname } from "./navigation.js";
2
+ import { isRedirectError, usePathname, useRouter } from "./navigation.js";
3
+ import { isNavigationSignalError } from "../utils/navigation-signal.js";
3
4
  import React from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  //#region src/shims/error-boundary.tsx
7
+ function normalizeBoundaryResetKey(resetKey) {
8
+ return resetKey === void 0 || resetKey === null || resetKey === "" ? null : resetKey;
9
+ }
10
+ function readBoundaryResetState(props) {
11
+ return {
12
+ previousPathname: props.pathname,
13
+ previousResetKey: normalizeBoundaryResetKey(props.resetKey)
14
+ };
15
+ }
16
+ function shouldResetBoundary(nextResetState, previousResetState) {
17
+ const nextResetKey = normalizeBoundaryResetKey(nextResetState.previousResetKey);
18
+ const previousResetKey = normalizeBoundaryResetKey(previousResetState.previousResetKey);
19
+ if (nextResetKey !== null || previousResetKey !== null) return nextResetKey !== previousResetKey;
20
+ return nextResetState.previousPathname !== previousResetState.previousPathname;
21
+ }
22
+ function decodeRedirectTarget(target) {
23
+ try {
24
+ return decodeURIComponent(target);
25
+ } catch {
26
+ return target;
27
+ }
28
+ }
29
+ function getURLFromRedirectError(error) {
30
+ const parts = error.digest.split(";");
31
+ const encodedTarget = parts.length >= 5 ? parts.slice(2, -2).join(";") : parts[2];
32
+ return encodedTarget ? decodeRedirectTarget(encodedTarget) : null;
33
+ }
34
+ function getRedirectTypeFromError(error) {
35
+ return error.digest.split(";", 2)[1] === "push" ? "push" : "replace";
36
+ }
37
+ function HandleRedirect({ redirect, redirectType }) {
38
+ const router = useRouter();
39
+ React.useEffect(() => {
40
+ React.startTransition(() => {
41
+ if (redirectType === "push") router.push(redirect);
42
+ else router.replace(redirect);
43
+ });
44
+ }, [
45
+ redirect,
46
+ redirectType,
47
+ router
48
+ ]);
49
+ return null;
50
+ }
51
+ var RedirectErrorBoundary = class extends React.Component {
52
+ constructor(props) {
53
+ super(props);
54
+ this.state = {
55
+ redirect: null,
56
+ redirectType: null
57
+ };
58
+ }
59
+ static getDerivedStateFromError(error) {
60
+ if (isRedirectError(error)) {
61
+ const redirectError = error;
62
+ if (redirectError.handled) return {
63
+ redirect: null,
64
+ redirectType: null
65
+ };
66
+ const url = getURLFromRedirectError(redirectError);
67
+ if (url === null) throw error;
68
+ return {
69
+ redirect: url,
70
+ redirectType: getRedirectTypeFromError(redirectError)
71
+ };
72
+ }
73
+ throw error;
74
+ }
75
+ render() {
76
+ const { redirect, redirectType } = this.state;
77
+ if (redirect !== null && redirectType !== null) return /* @__PURE__ */ jsx(HandleRedirect, {
78
+ redirect,
79
+ redirectType
80
+ });
81
+ return this.props.children;
82
+ }
83
+ };
84
+ function RedirectBoundary({ children }) {
85
+ return /* @__PURE__ */ jsx(RedirectErrorBoundary, { children });
86
+ }
6
87
  /**
7
88
  * Generic ErrorBoundary used to wrap route segments with error.tsx.
8
89
  * This must be a client component since error boundaries use
@@ -13,24 +94,22 @@ var ErrorBoundaryInner = class extends React.Component {
13
94
  super(props);
14
95
  this.state = {
15
96
  error: null,
16
- previousPathname: props.pathname
97
+ ...readBoundaryResetState(props)
17
98
  };
18
99
  }
19
100
  static getDerivedStateFromProps(props, state) {
20
- if (props.pathname !== state.previousPathname && state.error) return {
101
+ const nextResetState = readBoundaryResetState(props);
102
+ if (state.error && shouldResetBoundary(nextResetState, state)) return {
21
103
  error: null,
22
- previousPathname: props.pathname
104
+ ...nextResetState
23
105
  };
24
106
  return {
25
107
  error: state.error,
26
- previousPathname: props.pathname
108
+ ...nextResetState
27
109
  };
28
110
  }
29
111
  static getDerivedStateFromError(error) {
30
- if (error && typeof error === "object" && "digest" in error) {
31
- const digest = String(error.digest);
32
- if (digest === "NEXT_NOT_FOUND" || digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;") || digest.startsWith("NEXT_REDIRECT;")) throw error;
33
- }
112
+ if (isNavigationSignalError(error)) throw error;
34
113
  return { error: { thrownValue: error } };
35
114
  }
36
115
  reset = () => {
@@ -47,17 +126,18 @@ var ErrorBoundaryInner = class extends React.Component {
47
126
  return this.props.children;
48
127
  }
49
128
  };
50
- function ErrorBoundary({ fallback, children }) {
129
+ function ErrorBoundary({ fallback, children, resetKey }) {
51
130
  return /* @__PURE__ */ jsx(ErrorBoundaryInner, {
52
131
  pathname: usePathname(),
132
+ resetKey,
53
133
  fallback,
54
134
  children
55
135
  });
56
136
  }
57
137
  /**
58
138
  * Inner class component that catches notFound() errors and renders the
59
- * not-found.tsx fallback. Resets when the pathname changes (client navigation)
60
- * so a previous notFound() doesn't permanently stick.
139
+ * not-found.tsx fallback. Resets on the caller's segment reset key when one is
140
+ * provided, otherwise falls back to pathname changes for legacy callers.
61
141
  *
62
142
  * The ErrorBoundary above re-throws notFound errors so they propagate up to this
63
143
  * boundary. This must be placed above the ErrorBoundary in the component tree.
@@ -67,17 +147,18 @@ var NotFoundBoundaryInner = class extends React.Component {
67
147
  super(props);
68
148
  this.state = {
69
149
  notFound: false,
70
- previousPathname: props.pathname
150
+ ...readBoundaryResetState(props)
71
151
  };
72
152
  }
73
153
  static getDerivedStateFromProps(props, state) {
74
- if (props.pathname !== state.previousPathname && state.notFound) return {
154
+ const nextResetState = readBoundaryResetState(props);
155
+ if (state.notFound && shouldResetBoundary(nextResetState, state)) return {
75
156
  notFound: false,
76
- previousPathname: props.pathname
157
+ ...nextResetState
77
158
  };
78
159
  return {
79
160
  notFound: state.notFound,
80
- previousPathname: props.pathname
161
+ ...nextResetState
81
162
  };
82
163
  }
83
164
  static getDerivedStateFromError(error) {
@@ -94,11 +175,12 @@ var NotFoundBoundaryInner = class extends React.Component {
94
175
  };
95
176
  /**
96
177
  * Wrapper that reads the current pathname and passes it to the inner class
97
- * component. This enables automatic reset on client-side navigation.
178
+ * component. Segment reset keys own App Router remount semantics when present.
98
179
  */
99
- function NotFoundBoundary({ fallback, children }) {
180
+ function NotFoundBoundary({ fallback, children, resetKey }) {
100
181
  return /* @__PURE__ */ jsx(NotFoundBoundaryInner, {
101
182
  pathname: usePathname(),
183
+ resetKey,
102
184
  fallback,
103
185
  children
104
186
  });
@@ -108,17 +190,18 @@ var ForbiddenBoundaryInner = class extends React.Component {
108
190
  super(props);
109
191
  this.state = {
110
192
  forbidden: false,
111
- previousPathname: props.pathname
193
+ ...readBoundaryResetState(props)
112
194
  };
113
195
  }
114
196
  static getDerivedStateFromProps(props, state) {
115
- if (props.pathname !== state.previousPathname && state.forbidden) return {
197
+ const nextResetState = readBoundaryResetState(props);
198
+ if (state.forbidden && shouldResetBoundary(nextResetState, state)) return {
116
199
  forbidden: false,
117
- previousPathname: props.pathname
200
+ ...nextResetState
118
201
  };
119
202
  return {
120
203
  forbidden: state.forbidden,
121
- previousPathname: props.pathname
204
+ ...nextResetState
122
205
  };
123
206
  }
124
207
  static getDerivedStateFromError(error) {
@@ -132,9 +215,10 @@ var ForbiddenBoundaryInner = class extends React.Component {
132
215
  return this.props.children;
133
216
  }
134
217
  };
135
- function ForbiddenBoundary({ fallback, children }) {
218
+ function ForbiddenBoundary({ fallback, children, resetKey }) {
136
219
  return /* @__PURE__ */ jsx(ForbiddenBoundaryInner, {
137
220
  pathname: usePathname(),
221
+ resetKey,
138
222
  fallback,
139
223
  children
140
224
  });
@@ -144,17 +228,18 @@ var UnauthorizedBoundaryInner = class extends React.Component {
144
228
  super(props);
145
229
  this.state = {
146
230
  unauthorized: false,
147
- previousPathname: props.pathname
231
+ ...readBoundaryResetState(props)
148
232
  };
149
233
  }
150
234
  static getDerivedStateFromProps(props, state) {
151
- if (props.pathname !== state.previousPathname && state.unauthorized) return {
235
+ const nextResetState = readBoundaryResetState(props);
236
+ if (state.unauthorized && shouldResetBoundary(nextResetState, state)) return {
152
237
  unauthorized: false,
153
- previousPathname: props.pathname
238
+ ...nextResetState
154
239
  };
155
240
  return {
156
241
  unauthorized: state.unauthorized,
157
- previousPathname: props.pathname
242
+ ...nextResetState
158
243
  };
159
244
  }
160
245
  static getDerivedStateFromError(error) {
@@ -168,9 +253,10 @@ var UnauthorizedBoundaryInner = class extends React.Component {
168
253
  return this.props.children;
169
254
  }
170
255
  };
171
- function UnauthorizedBoundary({ fallback, children }) {
256
+ function UnauthorizedBoundary({ fallback, children, resetKey }) {
172
257
  return /* @__PURE__ */ jsx(UnauthorizedBoundaryInner, {
173
258
  pathname: usePathname(),
259
+ resetKey,
174
260
  fallback,
175
261
  children
176
262
  });
@@ -191,10 +277,7 @@ var DevRecoveryBoundary = class extends React.Component {
191
277
  };
192
278
  }
193
279
  static getDerivedStateFromError(error) {
194
- if (error && typeof error === "object" && "digest" in error) {
195
- const digest = String(error.digest);
196
- if (digest === "NEXT_NOT_FOUND" || digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;") || digest.startsWith("NEXT_REDIRECT;")) throw error;
197
- }
280
+ if (isNavigationSignalError(error)) throw error;
198
281
  return { error: { thrownValue: error } };
199
282
  }
200
283
  componentDidCatch() {
@@ -206,6 +289,6 @@ var DevRecoveryBoundary = class extends React.Component {
206
289
  }
207
290
  };
208
291
  //#endregion
209
- export { DevRecoveryBoundary, ErrorBoundary, ErrorBoundaryInner, ForbiddenBoundary, ForbiddenBoundaryInner, NotFoundBoundary, UnauthorizedBoundary, UnauthorizedBoundaryInner };
292
+ export { DevRecoveryBoundary, ErrorBoundary, ErrorBoundaryInner, ForbiddenBoundary, ForbiddenBoundaryInner, NotFoundBoundary, RedirectBoundary, RedirectErrorBoundary, UnauthorizedBoundary, UnauthorizedBoundaryInner };
210
293
 
211
294
  //# sourceMappingURL=error-boundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-boundary.js","names":[],"sources":["../../src/shims/error-boundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n// Import the local shim, not the public next/navigation alias. The built\n// package may execute this file before the plugin's resolveId hook is active.\nimport { usePathname } from \"./navigation.js\";\n\nexport type ErrorBoundaryProps = {\n fallback: React.ComponentType<{ error: unknown; reset: () => void }>;\n children: React.ReactNode;\n};\n\ntype CapturedError = {\n thrownValue: unknown;\n};\n\ntype ErrorBoundaryInnerProps = {\n pathname: string;\n} & ErrorBoundaryProps;\n\nexport type ErrorBoundaryState = {\n error: CapturedError | null;\n previousPathname: string;\n};\n\n/**\n * Generic ErrorBoundary used to wrap route segments with error.tsx.\n * This must be a client component since error boundaries use\n * componentDidCatch / getDerivedStateFromError.\n */\nexport class ErrorBoundaryInner extends React.Component<\n ErrorBoundaryInnerProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryInnerProps) {\n super(props);\n this.state = { error: null, previousPathname: props.pathname };\n }\n\n static getDerivedStateFromProps(\n props: ErrorBoundaryInnerProps,\n state: ErrorBoundaryState,\n ): ErrorBoundaryState | null {\n if (props.pathname !== state.previousPathname && state.error) {\n return { error: null, previousPathname: props.pathname };\n }\n return { error: state.error, previousPathname: props.pathname };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {\n // notFound(), forbidden(), unauthorized(), and redirect() must propagate\n // past error boundaries. Re-throw them so they bubble up to the\n // framework's HTTP access fallback / redirect handler.\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (\n digest === \"NEXT_NOT_FOUND\" || // legacy compat\n digest.startsWith(\"NEXT_HTTP_ERROR_FALLBACK;\") ||\n digest.startsWith(\"NEXT_REDIRECT;\")\n ) {\n throw error;\n }\n }\n return { error: { thrownValue: error } };\n }\n\n reset = () => {\n this.setState({ error: null });\n };\n\n render() {\n if (this.state.error) {\n const FallbackComponent = this.props.fallback;\n return <FallbackComponent error={this.state.error.thrownValue} reset={this.reset} />;\n }\n return this.props.children;\n }\n}\n\nexport function ErrorBoundary({ fallback, children }: ErrorBoundaryProps) {\n const pathname = usePathname();\n return (\n <ErrorBoundaryInner pathname={pathname} fallback={fallback}>\n {children}\n </ErrorBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// NotFoundBoundary — catches notFound() on the client and renders not-found.tsx\n// ---------------------------------------------------------------------------\n\ntype NotFoundBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n};\n\ntype NotFoundBoundaryInnerProps = {\n pathname: string;\n} & NotFoundBoundaryProps;\n\ntype NotFoundBoundaryState = {\n notFound: boolean;\n previousPathname: string;\n};\n\n/**\n * Inner class component that catches notFound() errors and renders the\n * not-found.tsx fallback. Resets when the pathname changes (client navigation)\n * so a previous notFound() doesn't permanently stick.\n *\n * The ErrorBoundary above re-throws notFound errors so they propagate up to this\n * boundary. This must be placed above the ErrorBoundary in the component tree.\n */\nclass NotFoundBoundaryInner extends React.Component<\n NotFoundBoundaryInnerProps,\n NotFoundBoundaryState\n> {\n constructor(props: NotFoundBoundaryInnerProps) {\n super(props);\n this.state = { notFound: false, previousPathname: props.pathname };\n }\n\n static getDerivedStateFromProps(\n props: NotFoundBoundaryInnerProps,\n state: NotFoundBoundaryState,\n ): NotFoundBoundaryState | null {\n // Reset the boundary when the route changes so a previous notFound()\n // doesn't permanently stick after client-side navigation.\n if (props.pathname !== state.previousPathname && state.notFound) {\n return { notFound: false, previousPathname: props.pathname };\n }\n return { notFound: state.notFound, previousPathname: props.pathname };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<NotFoundBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_NOT_FOUND\" || digest === \"NEXT_HTTP_ERROR_FALLBACK;404\") {\n return { notFound: true };\n }\n }\n // Not a notFound error — re-throw so it reaches an ErrorBoundary or propagates\n throw error;\n }\n\n render() {\n if (this.state.notFound) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrapper that reads the current pathname and passes it to the inner class\n * component. This enables automatic reset on client-side navigation.\n */\nexport function NotFoundBoundary({ fallback, children }: NotFoundBoundaryProps) {\n const pathname = usePathname();\n return (\n <NotFoundBoundaryInner pathname={pathname} fallback={fallback}>\n {children}\n </NotFoundBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// ForbiddenBoundary — catches forbidden() on the client and renders forbidden.tsx\n// ---------------------------------------------------------------------------\n\ntype ForbiddenBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n};\n\ntype ForbiddenBoundaryInnerProps = {\n pathname: string;\n} & ForbiddenBoundaryProps;\n\ntype ForbiddenBoundaryState = {\n forbidden: boolean;\n previousPathname: string;\n};\n\nexport class ForbiddenBoundaryInner extends React.Component<\n ForbiddenBoundaryInnerProps,\n ForbiddenBoundaryState\n> {\n constructor(props: ForbiddenBoundaryInnerProps) {\n super(props);\n this.state = { forbidden: false, previousPathname: props.pathname };\n }\n\n static getDerivedStateFromProps(\n props: ForbiddenBoundaryInnerProps,\n state: ForbiddenBoundaryState,\n ): ForbiddenBoundaryState | null {\n if (props.pathname !== state.previousPathname && state.forbidden) {\n return { forbidden: false, previousPathname: props.pathname };\n }\n return { forbidden: state.forbidden, previousPathname: props.pathname };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ForbiddenBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;403\") {\n return { forbidden: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.forbidden) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function ForbiddenBoundary({ fallback, children }: ForbiddenBoundaryProps) {\n const pathname = usePathname();\n return (\n <ForbiddenBoundaryInner pathname={pathname} fallback={fallback}>\n {children}\n </ForbiddenBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// UnauthorizedBoundary — catches unauthorized() on the client and renders unauthorized.tsx\n// ---------------------------------------------------------------------------\n\ntype UnauthorizedBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n};\n\ntype UnauthorizedBoundaryInnerProps = {\n pathname: string;\n} & UnauthorizedBoundaryProps;\n\ntype UnauthorizedBoundaryState = {\n unauthorized: boolean;\n previousPathname: string;\n};\n\nexport class UnauthorizedBoundaryInner extends React.Component<\n UnauthorizedBoundaryInnerProps,\n UnauthorizedBoundaryState\n> {\n constructor(props: UnauthorizedBoundaryInnerProps) {\n super(props);\n this.state = { unauthorized: false, previousPathname: props.pathname };\n }\n\n static getDerivedStateFromProps(\n props: UnauthorizedBoundaryInnerProps,\n state: UnauthorizedBoundaryState,\n ): UnauthorizedBoundaryState | null {\n if (props.pathname !== state.previousPathname && state.unauthorized) {\n return { unauthorized: false, previousPathname: props.pathname };\n }\n return { unauthorized: state.unauthorized, previousPathname: props.pathname };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<UnauthorizedBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;401\") {\n return { unauthorized: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.unauthorized) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function UnauthorizedBoundary({ fallback, children }: UnauthorizedBoundaryProps) {\n const pathname = usePathname();\n return (\n <UnauthorizedBoundaryInner pathname={pathname} fallback={fallback}>\n {children}\n </UnauthorizedBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// DevRecoveryBoundary — dev-only top-level boundary inside BrowserRoot.\n// Catches any render error that isn't already handled by a user-defined\n// error.tsx (or the access-fallback boundaries above), renders nothing, and\n// keeps BrowserRoot mounted so HMR can dispatch a new RSC payload without a\n// full page reload. Resets on resetKey change — the caller bumps that key\n// (e.g. via treeState.renderId) when a fresh tree is dispatched.\n//\n// Routing sentinels are re-thrown so notFound()/redirect()/forbidden()/\n// unauthorized() still reach their dedicated boundaries above.\n// ---------------------------------------------------------------------------\n\nexport type DevRecoveryBoundaryProps = {\n resetKey: number;\n // Called from componentDidCatch with the current resetKey so the host can\n // run any pending side effects that NavigationCommitSignal would normally\n // drive on commit — most importantly the URL update for the in-flight\n // soft-nav. Without this, a navigation that fails mid-render leaves the\n // browser on the previous URL even though the boundary recovered.\n //\n // The error itself is intentionally not passed: React's onCaughtError option\n // already routes the error to the dev overlay, so this callback is only for\n // commit-side effects keyed by resetKey.\n onCatch?: (resetKey: number) => void;\n // Children come through React.Component's PropsWithChildren default; declared\n // optional so callers can pass them positionally to createElement without\n // tripping the eslint no-children-prop rule.\n children?: React.ReactNode;\n};\n\ntype DevRecoveryBoundaryState = {\n error: CapturedError | null;\n previousResetKey: number;\n};\n\nexport class DevRecoveryBoundary extends React.Component<\n DevRecoveryBoundaryProps,\n DevRecoveryBoundaryState\n> {\n constructor(props: DevRecoveryBoundaryProps) {\n super(props);\n this.state = { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromProps(\n props: DevRecoveryBoundaryProps,\n state: DevRecoveryBoundaryState,\n ): DevRecoveryBoundaryState | null {\n if (props.resetKey === state.previousResetKey) {\n return null;\n }\n return { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<DevRecoveryBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (\n digest === \"NEXT_NOT_FOUND\" ||\n digest.startsWith(\"NEXT_HTTP_ERROR_FALLBACK;\") ||\n digest.startsWith(\"NEXT_REDIRECT;\")\n ) {\n throw error;\n }\n }\n return { error: { thrownValue: error } };\n }\n\n componentDidCatch(): void {\n this.props.onCatch?.(this.props.resetKey);\n }\n\n render() {\n if (this.state.error) {\n // Render nothing — the dev overlay (mounted in a separate React root)\n // shows the actual error to the developer. HMR pushing a new payload\n // bumps resetKey above, clearing this state and letting the children\n // re-render with the fixed code.\n return null;\n }\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;;;;;AA8BA,IAAa,qBAAb,cAAwC,MAAM,UAG5C;CACA,YAAY,OAAgC;AAC1C,QAAM,MAAM;AACZ,OAAK,QAAQ;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAGhE,OAAO,yBACL,OACA,OAC2B;AAC3B,MAAI,MAAM,aAAa,MAAM,oBAAoB,MAAM,MACrD,QAAO;GAAE,OAAO;GAAM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AAO,UAAU,YAAY,YAAY;OACrC,OAAO,MAAM,OAAO,KACpB,+BACb,QAAO,EAAE,cAAc,MAAM;;AAGjC,QAAM;;CAGR,SAAS;AACP,MAAI,KAAK,MAAM,aACb,QAAO,KAAK,MAAM;AAEpB,SAAO,KAAK,MAAM;;;AAItB,SAAgB,qBAAqB,EAAE,UAAU,YAAuC;AAEtF,QACE,oBAAC,2BAAD;EAA2B,UAFZ,aAAa;EAE6B;EACtD;EACyB,CAAA;;AAuChC,IAAa,sBAAb,cAAyC,MAAM,UAG7C;CACA,YAAY,OAAiC;AAC3C,QAAM,MAAM;AACZ,OAAK,QAAQ;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAGhE,OAAO,yBACL,OACA,OACiC;AACjC,MAAI,MAAM,aAAa,MAAM,iBAC3B,QAAO;AAET,SAAO;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAG1D,OAAO,yBAAyB,OAAmD;AACjF,MAAI,SAAS,OAAO,UAAU,YAAY,YAAY,OAAO;GAC3D,MAAM,SAAS,OAAO,MAAM,OAAO;AACnC,OACE,WAAW,oBACX,OAAO,WAAW,4BAA4B,IAC9C,OAAO,WAAW,iBAAiB,CAEnC,OAAM;;AAGV,SAAO,EAAE,OAAO,EAAE,aAAa,OAAO,EAAE;;CAG1C,oBAA0B;AACxB,OAAK,MAAM,UAAU,KAAK,MAAM,SAAS;;CAG3C,SAAS;AACP,MAAI,KAAK,MAAM,MAKb,QAAO;AAET,SAAO,KAAK,MAAM"}
1
+ {"version":3,"file":"error-boundary.js","names":[],"sources":["../../src/shims/error-boundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n// Import the local shim, not the public next/navigation alias. The built\n// package may execute this file before the plugin's resolveId hook is active.\nimport { isRedirectError, usePathname, useRouter } from \"./navigation.js\";\nimport { isNavigationSignalError } from \"../utils/navigation-signal.js\";\n\nexport type ErrorBoundaryProps = {\n fallback: React.ComponentType<{ error: unknown; reset: () => void }>;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype CapturedError = {\n thrownValue: unknown;\n};\n\ntype RedirectBoundaryState = {\n redirect: string | null;\n redirectType: \"push\" | \"replace\" | null;\n};\n\ntype RedirectError = Error & {\n digest: string;\n handled?: boolean;\n};\n\ntype ErrorBoundaryInnerProps = {\n pathname: string;\n} & ErrorBoundaryProps;\n\nexport type ErrorBoundaryState = {\n error: CapturedError | null;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\ntype BoundaryResetProps = {\n pathname: string;\n resetKey?: string | null;\n};\n\ntype BoundaryResetState = {\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nfunction normalizeBoundaryResetKey(resetKey: string | null | undefined): string | null {\n return resetKey === undefined || resetKey === null || resetKey === \"\" ? null : resetKey;\n}\n\nfunction readBoundaryResetState(props: BoundaryResetProps): BoundaryResetState {\n return {\n previousPathname: props.pathname,\n previousResetKey: normalizeBoundaryResetKey(props.resetKey),\n };\n}\n\nfunction shouldResetBoundary(\n nextResetState: BoundaryResetState,\n previousResetState: BoundaryResetState,\n): boolean {\n const nextResetKey = normalizeBoundaryResetKey(nextResetState.previousResetKey);\n const previousResetKey = normalizeBoundaryResetKey(previousResetState.previousResetKey);\n\n if (nextResetKey !== null || previousResetKey !== null) {\n return nextResetKey !== previousResetKey;\n }\n\n return nextResetState.previousPathname !== previousResetState.previousPathname;\n}\n\nfunction decodeRedirectTarget(target: string): string {\n try {\n return decodeURIComponent(target);\n } catch {\n return target;\n }\n}\n\nfunction getURLFromRedirectError(error: RedirectError): string | null {\n const parts = error.digest.split(\";\");\n // vinext emits 3-part (redirect: `NEXT_REDIRECT;;<encoded>`) or 4-part\n // (permanentRedirect: `NEXT_REDIRECT;<type>;<encoded>;308`) digests;\n // Next.js emits 5-part digests (`NEXT_REDIRECT;<type>;<url>;<status>;<isClient>`).\n // vinext's `isRedirectError` is more permissive (just `startsWith(\"NEXT_REDIRECT;\")`)\n // so we branch on length rather than always using `slice(2, -2)`.\n const encodedTarget = parts.length >= 5 ? parts.slice(2, -2).join(\";\") : parts[2];\n return encodedTarget ? decodeRedirectTarget(encodedTarget) : null;\n}\n\nfunction getRedirectTypeFromError(error: RedirectError): \"push\" | \"replace\" {\n const type = error.digest.split(\";\", 2)[1];\n return type === \"push\" ? \"push\" : \"replace\";\n}\n\nfunction HandleRedirect({\n redirect,\n redirectType,\n}: {\n redirect: string;\n redirectType: \"push\" | \"replace\";\n}) {\n const router = useRouter();\n\n React.useEffect(() => {\n React.startTransition(() => {\n if (redirectType === \"push\") {\n router.push(redirect);\n } else {\n router.replace(redirect);\n }\n // Intentionally no reset() here. The boundary stays in its \"redirect\n // caught\" state (rendering this component, which returns null) until\n // router.push()/replace() triggers a new render at the destination\n // route. That naturally unmounts this boundary and mounts a fresh one.\n // Calling reset() would clear the boundary state, causing React to\n // re-render children — which re-mounts the page component that threw\n // redirect() in the first place. For deterministic redirects (e.g.\n // auth guards), that creates an infinite redirect loop.\n // Matches Next.js's HandleRedirect in redirect-boundary.tsx.\n });\n }, [redirect, redirectType, router]);\n\n return null;\n}\n\nexport class RedirectErrorBoundary extends React.Component<\n { children?: React.ReactNode },\n RedirectBoundaryState\n> {\n constructor(props: { children?: React.ReactNode }) {\n super(props);\n this.state = {\n redirect: null,\n redirectType: null,\n };\n }\n\n static getDerivedStateFromError(error: unknown): RedirectBoundaryState {\n if (isRedirectError(error)) {\n // The public `isRedirectError` narrows to `Error & { digest: string }`.\n // Cast to the local `RedirectError` (which also carries the optional\n // `handled` field) so the parity logic below compiles. The cast is\n // safe because every error that matches the prefix predicate is — by\n // construction — produced by vinext's `redirect()` /\n // `permanentRedirect()` helpers, which yield `Error` instances.\n const redirectError = error as RedirectError;\n // Next.js parity: an outer RedirectBoundary that has already started\n // handling a redirect marks the error as `handled` so that, if React\n // re-throws the same error during a retry render, an inner boundary\n // doesn't re-dispatch the same `router.replace()`. Vinext doesn't\n // currently emit `handled` itself (we never assign it on the error\n // object), but we keep the branch so behavior matches Next.js if a\n // host or future change ever does.\n if (redirectError.handled) {\n return {\n redirect: null,\n redirectType: null,\n };\n }\n\n const url = getURLFromRedirectError(redirectError);\n if (url === null) {\n // Malformed digest (e.g. `NEXT_REDIRECT;push;` with an empty URL\n // segment). The server-side parser at next-error-digest.ts:51 also\n // rejects this. Re-throw so the error reaches a regular error\n // boundary instead of being silently swallowed.\n throw error;\n }\n\n return {\n redirect: url,\n redirectType: getRedirectTypeFromError(redirectError),\n };\n }\n\n throw error;\n }\n\n render() {\n const { redirect, redirectType } = this.state;\n if (redirect !== null && redirectType !== null) {\n return <HandleRedirect redirect={redirect} redirectType={redirectType} />;\n }\n\n return this.props.children;\n }\n}\n\nexport function RedirectBoundary({ children }: { children?: React.ReactNode }) {\n return <RedirectErrorBoundary>{children}</RedirectErrorBoundary>;\n}\n\n/**\n * Generic ErrorBoundary used to wrap route segments with error.tsx.\n * This must be a client component since error boundaries use\n * componentDidCatch / getDerivedStateFromError.\n */\nexport class ErrorBoundaryInner extends React.Component<\n ErrorBoundaryInnerProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryInnerProps) {\n super(props);\n this.state = { error: null, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ErrorBoundaryInnerProps,\n state: ErrorBoundaryState,\n ): ErrorBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.error && shouldResetBoundary(nextResetState, state)) {\n return { error: null, ...nextResetState };\n }\n return { error: state.error, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {\n // notFound(), forbidden(), unauthorized(), and redirect() must propagate\n // past error boundaries. Re-throw them so they bubble up to the\n // framework's HTTP access fallback / redirect handler.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n reset = () => {\n this.setState({ error: null });\n };\n\n render() {\n if (this.state.error) {\n const FallbackComponent = this.props.fallback;\n return <FallbackComponent error={this.state.error.thrownValue} reset={this.reset} />;\n }\n return this.props.children;\n }\n}\n\nexport function ErrorBoundary({ fallback, children, resetKey }: ErrorBoundaryProps) {\n const pathname = usePathname();\n return (\n <ErrorBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ErrorBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// NotFoundBoundary — catches notFound() on the client and renders not-found.tsx\n// ---------------------------------------------------------------------------\n\ntype NotFoundBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype NotFoundBoundaryInnerProps = {\n pathname: string;\n} & NotFoundBoundaryProps;\n\ntype NotFoundBoundaryState = {\n notFound: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\n/**\n * Inner class component that catches notFound() errors and renders the\n * not-found.tsx fallback. Resets on the caller's segment reset key when one is\n * provided, otherwise falls back to pathname changes for legacy callers.\n *\n * The ErrorBoundary above re-throws notFound errors so they propagate up to this\n * boundary. This must be placed above the ErrorBoundary in the component tree.\n */\nclass NotFoundBoundaryInner extends React.Component<\n NotFoundBoundaryInnerProps,\n NotFoundBoundaryState\n> {\n constructor(props: NotFoundBoundaryInnerProps) {\n super(props);\n this.state = { notFound: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: NotFoundBoundaryInnerProps,\n state: NotFoundBoundaryState,\n ): NotFoundBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.notFound && shouldResetBoundary(nextResetState, state)) {\n return { notFound: false, ...nextResetState };\n }\n return { notFound: state.notFound, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<NotFoundBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_NOT_FOUND\" || digest === \"NEXT_HTTP_ERROR_FALLBACK;404\") {\n return { notFound: true };\n }\n }\n // Not a notFound error — re-throw so it reaches an ErrorBoundary or propagates\n throw error;\n }\n\n render() {\n if (this.state.notFound) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrapper that reads the current pathname and passes it to the inner class\n * component. Segment reset keys own App Router remount semantics when present.\n */\nexport function NotFoundBoundary({ fallback, children, resetKey }: NotFoundBoundaryProps) {\n const pathname = usePathname();\n return (\n <NotFoundBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </NotFoundBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// ForbiddenBoundary — catches forbidden() on the client and renders forbidden.tsx\n// ---------------------------------------------------------------------------\n\ntype ForbiddenBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype ForbiddenBoundaryInnerProps = {\n pathname: string;\n} & ForbiddenBoundaryProps;\n\ntype ForbiddenBoundaryState = {\n forbidden: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class ForbiddenBoundaryInner extends React.Component<\n ForbiddenBoundaryInnerProps,\n ForbiddenBoundaryState\n> {\n constructor(props: ForbiddenBoundaryInnerProps) {\n super(props);\n this.state = { forbidden: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ForbiddenBoundaryInnerProps,\n state: ForbiddenBoundaryState,\n ): ForbiddenBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.forbidden && shouldResetBoundary(nextResetState, state)) {\n return { forbidden: false, ...nextResetState };\n }\n return { forbidden: state.forbidden, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ForbiddenBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;403\") {\n return { forbidden: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.forbidden) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function ForbiddenBoundary({ fallback, children, resetKey }: ForbiddenBoundaryProps) {\n const pathname = usePathname();\n return (\n <ForbiddenBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ForbiddenBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// UnauthorizedBoundary — catches unauthorized() on the client and renders unauthorized.tsx\n// ---------------------------------------------------------------------------\n\ntype UnauthorizedBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype UnauthorizedBoundaryInnerProps = {\n pathname: string;\n} & UnauthorizedBoundaryProps;\n\ntype UnauthorizedBoundaryState = {\n unauthorized: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class UnauthorizedBoundaryInner extends React.Component<\n UnauthorizedBoundaryInnerProps,\n UnauthorizedBoundaryState\n> {\n constructor(props: UnauthorizedBoundaryInnerProps) {\n super(props);\n this.state = { unauthorized: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: UnauthorizedBoundaryInnerProps,\n state: UnauthorizedBoundaryState,\n ): UnauthorizedBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.unauthorized && shouldResetBoundary(nextResetState, state)) {\n return { unauthorized: false, ...nextResetState };\n }\n return { unauthorized: state.unauthorized, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<UnauthorizedBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;401\") {\n return { unauthorized: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.unauthorized) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function UnauthorizedBoundary({ fallback, children, resetKey }: UnauthorizedBoundaryProps) {\n const pathname = usePathname();\n return (\n <UnauthorizedBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </UnauthorizedBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// DevRecoveryBoundary — dev-only top-level boundary inside BrowserRoot.\n// Catches any render error that isn't already handled by a user-defined\n// error.tsx (or the access-fallback boundaries above), renders nothing, and\n// keeps BrowserRoot mounted so HMR can dispatch a new RSC payload without a\n// full page reload. Resets on resetKey change — the caller bumps that key\n// (e.g. via treeState.renderId) when a fresh tree is dispatched.\n//\n// Routing sentinels are re-thrown so notFound()/redirect()/forbidden()/\n// unauthorized() still reach their dedicated boundaries above.\n// ---------------------------------------------------------------------------\n\nexport type DevRecoveryBoundaryProps = {\n resetKey: number;\n // Called from componentDidCatch with the current resetKey so the host can\n // run any pending side effects that NavigationCommitSignal would normally\n // drive on commit — most importantly the URL update for the in-flight\n // soft-nav. Without this, a navigation that fails mid-render leaves the\n // browser on the previous URL even though the boundary recovered.\n //\n // The error itself is intentionally not passed: React's onCaughtError option\n // already routes the error to the dev overlay, so this callback is only for\n // commit-side effects keyed by resetKey.\n onCatch?: (resetKey: number) => void;\n // Children come through React.Component's PropsWithChildren default; declared\n // optional so callers can pass them positionally to createElement without\n // tripping the eslint no-children-prop rule.\n children?: React.ReactNode;\n};\n\ntype DevRecoveryBoundaryState = {\n error: CapturedError | null;\n previousResetKey: number;\n};\n\nexport class DevRecoveryBoundary extends React.Component<\n DevRecoveryBoundaryProps,\n DevRecoveryBoundaryState\n> {\n constructor(props: DevRecoveryBoundaryProps) {\n super(props);\n this.state = { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromProps(\n props: DevRecoveryBoundaryProps,\n state: DevRecoveryBoundaryState,\n ): DevRecoveryBoundaryState | null {\n if (props.resetKey === state.previousResetKey) {\n return null;\n }\n return { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<DevRecoveryBoundaryState> {\n // Re-throw routing sentinels so they still reach NotFoundBoundary /\n // RedirectBoundary / Forbidden / Unauthorized above.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n componentDidCatch(): void {\n this.props.onCatch?.(this.props.resetKey);\n }\n\n render() {\n if (this.state.error) {\n // Render nothing — the dev overlay (mounted in a separate React root)\n // shows the actual error to the developer. HMR pushing a new payload\n // bumps resetKey above, clearing this state and letting the children\n // re-render with the fixed code.\n return null;\n }\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;AAgDA,SAAS,0BAA0B,UAAoD;CACrF,OAAO,aAAa,KAAA,KAAa,aAAa,QAAQ,aAAa,KAAK,OAAO;;AAGjF,SAAS,uBAAuB,OAA+C;CAC7E,OAAO;EACL,kBAAkB,MAAM;EACxB,kBAAkB,0BAA0B,MAAM,SAAS;EAC5D;;AAGH,SAAS,oBACP,gBACA,oBACS;CACT,MAAM,eAAe,0BAA0B,eAAe,iBAAiB;CAC/E,MAAM,mBAAmB,0BAA0B,mBAAmB,iBAAiB;CAEvF,IAAI,iBAAiB,QAAQ,qBAAqB,MAChD,OAAO,iBAAiB;CAG1B,OAAO,eAAe,qBAAqB,mBAAmB;;AAGhE,SAAS,qBAAqB,QAAwB;CACpD,IAAI;EACF,OAAO,mBAAmB,OAAO;SAC3B;EACN,OAAO;;;AAIX,SAAS,wBAAwB,OAAqC;CACpE,MAAM,QAAQ,MAAM,OAAO,MAAM,IAAI;CAMrC,MAAM,gBAAgB,MAAM,UAAU,IAAI,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM;CAC/E,OAAO,gBAAgB,qBAAqB,cAAc,GAAG;;AAG/D,SAAS,yBAAyB,OAA0C;CAE1E,OADa,MAAM,OAAO,MAAM,KAAK,EAAE,CAAC,OACxB,SAAS,SAAS;;AAGpC,SAAS,eAAe,EACtB,UACA,gBAIC;CACD,MAAM,SAAS,WAAW;CAE1B,MAAM,gBAAgB;EACpB,MAAM,sBAAsB;GAC1B,IAAI,iBAAiB,QACnB,OAAO,KAAK,SAAS;QAErB,OAAO,QAAQ,SAAS;IAW1B;IACD;EAAC;EAAU;EAAc;EAAO,CAAC;CAEpC,OAAO;;AAGT,IAAa,wBAAb,cAA2C,MAAM,UAG/C;CACA,YAAY,OAAuC;EACjD,MAAM,MAAM;EACZ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ACZ,KAAK,QAAQ;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAGhE,OAAO,yBACL,OACA,OACiC;EACjC,IAAI,MAAM,aAAa,MAAM,kBAC3B,OAAO;EAET,OAAO;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAG1D,OAAO,yBAAyB,OAAmD;EAGjF,IAAI,wBAAwB,MAAM,EAChC,MAAM;EAER,OAAO,EAAE,OAAO,EAAE,aAAa,OAAO,EAAE;;CAG1C,oBAA0B;EACxB,KAAK,MAAM,UAAU,KAAK,MAAM,SAAS;;CAG3C,SAAS;EACP,IAAI,KAAK,MAAM,OAKb,OAAO;EAET,OAAO,KAAK,MAAM"}
@@ -10,6 +10,23 @@ declare function ErrorComponent({
10
10
  statusCode,
11
11
  title
12
12
  }: ErrorProps): React.ReactElement;
13
+ type ErrorInfo = {
14
+ error: unknown;
15
+ reset: () => void;
16
+ unstable_retry: () => void;
17
+ };
18
+ type _UserProps = Record<string, unknown>;
19
+ /**
20
+ * Wrap a fallback render function in a Component-level error boundary.
21
+ * Returns a Component that renders `children` and, on error, renders the
22
+ * supplied fallback with an `ErrorInfo` value.
23
+ *
24
+ * Ported from Next.js:
25
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx
26
+ */
27
+ declare function unstable_catchError<P extends _UserProps>(fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode): React.ComponentType<P & {
28
+ children?: React.ReactNode;
29
+ }>;
13
30
  //#endregion
14
- export { ErrorComponent as default };
31
+ export { ErrorInfo, ErrorComponent as default, unstable_catchError };
15
32
  //# sourceMappingURL=error.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { appRouterInstance, isNextRouterError } from "./navigation.js";
1
2
  import React from "react";
2
3
  //#region src/shims/error.tsx
3
4
  /**
@@ -6,6 +7,10 @@ import React from "react";
6
7
  * Provides the default Next.js error page component.
7
8
  * Used by apps that import `import Error from 'next/error'` for
8
9
  * custom error handling in getServerSideProps or API routes.
10
+ *
11
+ * Also re-exports the unstable App Router error-boundary HOC
12
+ * (`unstable_catchError`) and its `ErrorInfo` type, mirroring
13
+ * `next/error`'s public surface.
9
14
  */
10
15
  function ErrorComponent({ statusCode, title }) {
11
16
  const displayTitle = title ?? (statusCode === 404 ? "This page could not be found" : "Internal Server Error");
@@ -33,7 +38,57 @@ function ErrorComponent({ statusCode, title }) {
33
38
  margin: 0
34
39
  } }, displayTitle + "."))));
35
40
  }
41
+ var _CatchError = class extends React.Component {
42
+ static displayName = "unstable_catchError(Next.CatchError)";
43
+ state = { error: null };
44
+ static getDerivedStateFromError(thrownValue) {
45
+ if (isNextRouterError(thrownValue)) throw thrownValue;
46
+ return { error: { thrownValue } };
47
+ }
48
+ reset = () => {
49
+ this.setState({ error: null });
50
+ };
51
+ unstable_retry = () => {
52
+ if (typeof window === "undefined") throw new Error("`unstable_retry()` can only be used on the client. Call it from a user interaction handler inside the error fallback.");
53
+ React.startTransition(() => {
54
+ appRouterInstance.refresh();
55
+ this.reset();
56
+ });
57
+ };
58
+ render() {
59
+ if (this.state.error) {
60
+ const errorInfo = {
61
+ error: this.state.error.thrownValue,
62
+ reset: this.reset,
63
+ unstable_retry: this.unstable_retry
64
+ };
65
+ return this.props.fallback(this.props.forwardedProps, errorInfo);
66
+ }
67
+ return this.props.children;
68
+ }
69
+ };
70
+ /**
71
+ * Wrap a fallback render function in a Component-level error boundary.
72
+ * Returns a Component that renders `children` and, on error, renders the
73
+ * supplied fallback with an `ErrorInfo` value.
74
+ *
75
+ * Ported from Next.js:
76
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx
77
+ */
78
+ function unstable_catchError(fallback) {
79
+ const TypedCatchError = _CatchError;
80
+ function CatchErrorBoundary(allProps) {
81
+ const { children, ...rest } = allProps;
82
+ const forwardedProps = rest;
83
+ return React.createElement(TypedCatchError, {
84
+ fallback,
85
+ forwardedProps
86
+ }, children);
87
+ }
88
+ CatchErrorBoundary.displayName = `unstable_catchError(${fallback.name || "CatchErrorFallback"})`;
89
+ return CatchErrorBoundary;
90
+ }
36
91
  //#endregion
37
- export { ErrorComponent as default };
92
+ export { ErrorComponent as default, unstable_catchError };
38
93
 
39
94
  //# sourceMappingURL=error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","names":[],"sources":["../../src/shims/error.tsx"],"sourcesContent":["/**\n * next/error shim\n *\n * Provides the default Next.js error page component.\n * Used by apps that import `import Error from 'next/error'` for\n * custom error handling in getServerSideProps or API routes.\n */\nimport React from \"react\";\n\ntype ErrorProps = {\n statusCode: number;\n title?: string;\n withDarkMode?: boolean;\n};\n\nfunction ErrorComponent({ statusCode, title }: ErrorProps): React.ReactElement {\n const defaultTitle =\n statusCode === 404 ? \"This page could not be found\" : \"Internal Server Error\";\n\n const displayTitle = title ?? defaultTitle;\n\n return React.createElement(\n \"div\",\n {\n style: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n height: \"100vh\",\n textAlign: \"center\" as const,\n display: \"flex\",\n flexDirection: \"column\" as const,\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n },\n React.createElement(\n \"div\",\n null,\n React.createElement(\n \"h1\",\n {\n style: {\n display: \"inline-block\",\n margin: \"0 20px 0 0\",\n padding: \"0 23px 0 0\",\n fontSize: 24,\n fontWeight: 500,\n verticalAlign: \"top\",\n lineHeight: \"49px\",\n borderRight: \"1px solid rgba(0, 0, 0, .3)\",\n },\n },\n statusCode,\n ),\n React.createElement(\n \"div\",\n { style: { display: \"inline-block\" } },\n React.createElement(\n \"h2\",\n {\n style: {\n fontSize: 14,\n fontWeight: 400,\n lineHeight: \"49px\",\n margin: 0,\n },\n },\n displayTitle + \".\",\n ),\n ),\n ),\n );\n}\n\nexport default ErrorComponent;\n"],"mappings":";;;;;;;;;AAeA,SAAS,eAAe,EAAE,YAAY,SAAyC;CAI7E,MAAM,eAAe,UAFnB,eAAe,MAAM,iCAAiC;AAIxD,QAAO,MAAM,cACX,OACA,EACE,OAAO;EACL,YACE;EACF,QAAQ;EACR,WAAW;EACX,SAAS;EACT,eAAe;EACf,YAAY;EACZ,gBAAgB;EACjB,EACF,EACD,MAAM,cACJ,OACA,MACA,MAAM,cACJ,MACA,EACE,OAAO;EACL,SAAS;EACT,QAAQ;EACR,SAAS;EACT,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,aAAa;EACd,EACF,EACD,WACD,EACD,MAAM,cACJ,OACA,EAAE,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACtC,MAAM,cACJ,MACA,EACE,OAAO;EACL,UAAU;EACV,YAAY;EACZ,YAAY;EACZ,QAAQ;EACT,EACF,EACD,eAAe,IAChB,CACF,CACF,CACF"}
1
+ {"version":3,"file":"error.js","names":[],"sources":["../../src/shims/error.tsx"],"sourcesContent":["/**\n * next/error shim\n *\n * Provides the default Next.js error page component.\n * Used by apps that import `import Error from 'next/error'` for\n * custom error handling in getServerSideProps or API routes.\n *\n * Also re-exports the unstable App Router error-boundary HOC\n * (`unstable_catchError`) and its `ErrorInfo` type, mirroring\n * `next/error`'s public surface.\n */\nimport React from \"react\";\nimport { appRouterInstance, isNextRouterError } from \"./navigation.js\";\n\ntype ErrorProps = {\n statusCode: number;\n title?: string;\n withDarkMode?: boolean;\n};\n\nfunction ErrorComponent({ statusCode, title }: ErrorProps): React.ReactElement {\n const defaultTitle =\n statusCode === 404 ? \"This page could not be found\" : \"Internal Server Error\";\n\n const displayTitle = title ?? defaultTitle;\n\n return React.createElement(\n \"div\",\n {\n style: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n height: \"100vh\",\n textAlign: \"center\" as const,\n display: \"flex\",\n flexDirection: \"column\" as const,\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n },\n React.createElement(\n \"div\",\n null,\n React.createElement(\n \"h1\",\n {\n style: {\n display: \"inline-block\",\n margin: \"0 20px 0 0\",\n padding: \"0 23px 0 0\",\n fontSize: 24,\n fontWeight: 500,\n verticalAlign: \"top\",\n lineHeight: \"49px\",\n borderRight: \"1px solid rgba(0, 0, 0, .3)\",\n },\n },\n statusCode,\n ),\n React.createElement(\n \"div\",\n { style: { display: \"inline-block\" } },\n React.createElement(\n \"h2\",\n {\n style: {\n fontSize: 14,\n fontWeight: 400,\n lineHeight: \"49px\",\n margin: 0,\n },\n },\n displayTitle + \".\",\n ),\n ),\n ),\n );\n}\n\nexport default ErrorComponent;\n\n// ---------------------------------------------------------------------------\n// unstable_catchError — App Router error-boundary HOC\n//\n// `unstable_catchError(fallback)` returns a Component that renders `children`\n// and, if the children throw, renders the user-supplied fallback with an\n// `ErrorInfo` object. Internal Next.js navigation signals (redirect /\n// notFound / forbidden / unauthorized) are rethrown so they reach the outer\n// framework boundaries.\n//\n// Ported from Next.js:\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/api/error.ts\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/api/error.react-server.ts\n//\n// Differences from Next.js:\n// - `unstable_retry()` matches Next.js's App Router behavior on the\n// client — it calls `appRouterInstance.refresh()` inside a\n// React.startTransition and then resets the boundary. On the server it\n// throws (consistent with React class components only running on the\n// server during SSR setup, where retry isn't meaningful). The\n// Pages-Router-only error message Next.js throws\n// (`unstable_retry()` can only be used in the App Router. Use\n// `reset()` in the Pages Router.) is not currently dispatched because\n// vinext's boundary doesn't read `PagesRouterContext`. Calling retry\n// under Pages Router will trigger an App Router refresh, which is a\n// no-op in that environment — the error remains visible until\n// `reset()` is called. Tracked as a parity follow-up.\n// - Bot-user-agent graceful-degradation, `handleHardNavError`, and\n// `handleISRError` are not yet supported. Errors always render the\n// fallback in non-bot contexts.\n// - The single implementation runs in both react-server and client\n// conditions. In Next.js, the react-server build exports a throwing stub\n// because the API is documented as client-only. Here we let module\n// evaluation succeed everywhere so `import { unstable_catchError } from\n// 'next/error'` does not break SSR-only bundles; misuse in a Server\n// Component still fails at render time because React class components\n// are unavailable in the react-server condition for this code path.\n// ---------------------------------------------------------------------------\n\nexport type ErrorInfo = {\n error: unknown;\n reset: () => void;\n unstable_retry: () => void;\n};\n\ntype _UserProps = Record<string, unknown>;\n\ntype _CatchErrorState = { thrownValue: unknown } | null;\n\nclass _CatchError<P extends _UserProps> extends React.Component<\n {\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode;\n forwardedProps: P;\n children?: React.ReactNode;\n },\n { error: _CatchErrorState }\n> {\n // Match Next.js's DevTools label so userland tooling/snapshots align.\n // https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n static displayName = \"unstable_catchError(Next.CatchError)\";\n\n state = { error: null as _CatchErrorState };\n\n static getDerivedStateFromError(thrownValue: unknown): { error: _CatchErrorState } {\n if (isNextRouterError(thrownValue)) {\n // Re-throw redirect/notFound/etc. so an outer framework boundary handles\n // them. Matches Next.js's CatchError.getDerivedStateFromError().\n throw thrownValue;\n }\n return { error: { thrownValue } };\n }\n\n reset = (): void => {\n this.setState({ error: null });\n };\n\n unstable_retry = (): void => {\n // Matches Next.js's App Router branch in\n // packages/next/src/client/components/catch-error.tsx — refresh the\n // current route, then clear the error so children re-render. Wrapped in\n // startTransition so the in-flight refresh and the reset commit\n // together (no flash of the children rendering with stale data).\n //\n // On the server, refresh is meaningless and `appRouterInstance.refresh`\n // is a no-op; throw a clear error so callers don't silently swallow a\n // retry attempt during SSR setup. Matches the spirit of Next.js's\n // server-side throw (which lives in error-boundary.tsx, not here).\n if (typeof window === \"undefined\") {\n throw new Error(\n \"`unstable_retry()` can only be used on the client. Call it from a user \" +\n \"interaction handler inside the error fallback.\",\n );\n }\n React.startTransition(() => {\n appRouterInstance.refresh();\n this.reset();\n });\n };\n\n render(): React.ReactNode {\n if (this.state.error) {\n const errorInfo: ErrorInfo = {\n error: this.state.error.thrownValue,\n reset: this.reset,\n unstable_retry: this.unstable_retry,\n };\n return this.props.fallback(this.props.forwardedProps, errorInfo);\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrap a fallback render function in a Component-level error boundary.\n * Returns a Component that renders `children` and, on error, renders the\n * supplied fallback with an `ErrorInfo` value.\n *\n * Ported from Next.js:\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx\n */\nexport function unstable_catchError<P extends _UserProps>(\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode,\n): React.ComponentType<P & { children?: React.ReactNode }> {\n // The inner class is generic in P, but createElement loses that generic at\n // the call site. Cast it to a non-generic constructor for the specific P\n // we close over here so TypeScript can pick the JSX-style createElement\n // overload without complaining about missing generic instantiation.\n const TypedCatchError = _CatchError as unknown as React.ComponentType<{\n fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode;\n forwardedProps: P;\n children?: React.ReactNode;\n }>;\n\n function CatchErrorBoundary(allProps: P & { children?: React.ReactNode }): React.ReactElement {\n const { children, ...rest } = allProps;\n const forwardedProps = rest as unknown as P;\n return React.createElement(\n TypedCatchError,\n { fallback, forwardedProps },\n children as React.ReactNode,\n );\n }\n CatchErrorBoundary.displayName = `unstable_catchError(${fallback.name || \"CatchErrorFallback\"})`;\n return CatchErrorBoundary;\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,SAAS,eAAe,EAAE,YAAY,SAAyC;CAI7E,MAAM,eAAe,UAFnB,eAAe,MAAM,iCAAiC;CAIxD,OAAO,MAAM,cACX,OACA,EACE,OAAO;EACL,YACE;EACF,QAAQ;EACR,WAAW;EACX,SAAS;EACT,eAAe;EACf,YAAY;EACZ,gBAAgB;EACjB,EACF,EACD,MAAM,cACJ,OACA,MACA,MAAM,cACJ,MACA,EACE,OAAO;EACL,SAAS;EACT,QAAQ;EACR,SAAS;EACT,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,aAAa;EACd,EACF,EACD,WACD,EACD,MAAM,cACJ,OACA,EAAE,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACtC,MAAM,cACJ,MACA,EACE,OAAO;EACL,UAAU;EACV,YAAY;EACZ,YAAY;EACZ,QAAQ;EACT,EACF,EACD,eAAe,IAChB,CACF,CACF,CACF;;AAsDH,IAAM,cAAN,cAAgD,MAAM,UAOpD;CAGA,OAAO,cAAc;CAErB,QAAQ,EAAE,OAAO,MAA0B;CAE3C,OAAO,yBAAyB,aAAmD;EACjF,IAAI,kBAAkB,YAAY,EAGhC,MAAM;EAER,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE;;CAGnC,cAAoB;EAClB,KAAK,SAAS,EAAE,OAAO,MAAM,CAAC;;CAGhC,uBAA6B;EAW3B,IAAI,OAAO,WAAW,aACpB,MAAM,IAAI,MACR,wHAED;EAEH,MAAM,sBAAsB;GAC1B,kBAAkB,SAAS;GAC3B,KAAK,OAAO;IACZ;;CAGJ,SAA0B;EACxB,IAAI,KAAK,MAAM,OAAO;GACpB,MAAM,YAAuB;IAC3B,OAAO,KAAK,MAAM,MAAM;IACxB,OAAO,KAAK;IACZ,gBAAgB,KAAK;IACtB;GACD,OAAO,KAAK,MAAM,SAAS,KAAK,MAAM,gBAAgB,UAAU;;EAElE,OAAO,KAAK,MAAM;;;;;;;;;;;AAYtB,SAAgB,oBACd,UACyD;CAKzD,MAAM,kBAAkB;CAMxB,SAAS,mBAAmB,UAAkE;EAC5F,MAAM,EAAE,UAAU,GAAG,SAAS;EAC9B,MAAM,iBAAiB;EACvB,OAAO,MAAM,cACX,iBACA;GAAE;GAAU;GAAgB,EAC5B,SACD;;CAEH,mBAAmB,cAAc,uBAAuB,SAAS,QAAQ,qBAAqB;CAC9F,OAAO"}
@@ -23,6 +23,11 @@ type NextFetchOptions = {
23
23
  revalidate?: number | false;
24
24
  tags?: string[];
25
25
  };
26
+ type FetchDedupeEntry = {
27
+ key: string;
28
+ promise: Promise<Response>;
29
+ response: Response | null;
30
+ };
26
31
  declare global {
27
32
  interface RequestInit {
28
33
  next?: NextFetchOptions;
@@ -34,8 +39,13 @@ type FetchCacheState = {
34
39
  currentRequestTags: string[];
35
40
  currentFetchSoftTags: string[];
36
41
  currentFetchCacheMode: FetchCacheMode | null;
42
+ dynamicFetchUrls: Set<string>;
43
+ isFetchDedupeActive: boolean;
44
+ currentFetchDedupeEntries: Map<string, FetchDedupeEntry[]>;
37
45
  };
38
46
  type FetchCacheMode = "auto" | "default-cache" | "default-no-store" | "force-cache" | "force-no-store" | "only-cache" | "only-no-store";
47
+ declare function peekDynamicFetchObservations(): string[];
48
+ declare function consumeDynamicFetchObservations(): string[];
39
49
  /**
40
50
  * Get tags collected during the current render pass.
41
51
  * Useful for associating page-level cache entries with all the
@@ -69,6 +79,20 @@ declare function withFetchCache(): () => void;
69
79
  * of collected fetch tags in concurrent server environments.
70
80
  */
71
81
  declare function runWithFetchCache<T>(fn: () => Promise<T>): Promise<T>;
82
+ /**
83
+ * Activate per-render fetch memoization without resetting request fetch tags.
84
+ * Next.js request memoization is scoped to React render work, not the whole
85
+ * request pipeline, so route handlers and middleware stay observable.
86
+ *
87
+ * ALS scope lifetime: when `fn` returns synchronously (e.g. wrapping a
88
+ * `renderToReadableStream` call), the ALS scope established here only covers
89
+ * the synchronous portion. Any fetch work that happens later during async
90
+ * stream consumption falls back to the parent ALS store, which is fine when
91
+ * the parent already activated dedupe (the common dispatch case) but means
92
+ * standalone callers must keep the dedupe scope alive across consumption.
93
+ */
94
+ declare function runWithFetchDedupe<T>(fn: () => T): T;
95
+ declare function runWithFetchDedupe<T>(fn: () => Promise<T>): Promise<T>;
72
96
  /**
73
97
  * Install the patched fetch without creating a standalone ALS scope.
74
98
  *
@@ -84,5 +108,5 @@ declare function ensureFetchPatch(): void;
84
108
  */
85
109
  declare function getOriginalFetch(): typeof globalThis.fetch;
86
110
  //#endregion
87
- export { FetchCacheMode, FetchCacheState, _resetPendingRefetches, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, runWithFetchCache, setCurrentFetchCacheMode, setCurrentFetchSoftTags, withFetchCache };
111
+ export { FetchCacheMode, FetchCacheState, _resetPendingRefetches, consumeDynamicFetchObservations, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, peekDynamicFetchObservations, runWithFetchCache, runWithFetchDedupe, setCurrentFetchCacheMode, setCurrentFetchSoftTags, withFetchCache };
88
112
  //# sourceMappingURL=fetch-cache.d.ts.map