vinext 0.0.45 → 0.0.47

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 (311) hide show
  1. package/README.md +7 -5
  2. package/dist/build/prerender.d.ts +2 -1
  3. package/dist/build/prerender.js +80 -17
  4. package/dist/build/prerender.js.map +1 -1
  5. package/dist/build/report.d.ts +1 -1
  6. package/dist/build/route-classification-injector.d.ts +35 -0
  7. package/dist/build/route-classification-injector.js +61 -0
  8. package/dist/build/route-classification-injector.js.map +1 -0
  9. package/dist/build/route-classification-manifest.d.ts +1 -1
  10. package/dist/build/standalone.js +4 -3
  11. package/dist/build/standalone.js.map +1 -1
  12. package/dist/build/static-export.d.ts +1 -1
  13. package/dist/check.js +30 -18
  14. package/dist/check.js.map +1 -1
  15. package/dist/cli-args.d.ts +31 -0
  16. package/dist/cli-args.js +104 -0
  17. package/dist/cli-args.js.map +1 -0
  18. package/dist/cli.js +6 -19
  19. package/dist/cli.js.map +1 -1
  20. package/dist/cloudflare/kv-cache-handler.js +29 -9
  21. package/dist/cloudflare/kv-cache-handler.js.map +1 -1
  22. package/dist/config/config-matchers.js +1 -0
  23. package/dist/config/config-matchers.js.map +1 -1
  24. package/dist/config/next-config.d.ts +42 -4
  25. package/dist/config/next-config.js +27 -0
  26. package/dist/config/next-config.js.map +1 -1
  27. package/dist/deploy.js +18 -23
  28. package/dist/deploy.js.map +1 -1
  29. package/dist/entries/app-rsc-entry.d.ts +4 -3
  30. package/dist/entries/app-rsc-entry.js +435 -2317
  31. package/dist/entries/app-rsc-entry.js.map +1 -1
  32. package/dist/entries/app-rsc-manifest.d.ts +24 -0
  33. package/dist/entries/app-rsc-manifest.js +155 -0
  34. package/dist/entries/app-rsc-manifest.js.map +1 -0
  35. package/dist/entries/pages-server-entry.js +18 -105
  36. package/dist/entries/pages-server-entry.js.map +1 -1
  37. package/dist/index.js +82 -85
  38. package/dist/index.js.map +1 -1
  39. package/dist/plugins/fonts.js +54 -32
  40. package/dist/plugins/fonts.js.map +1 -1
  41. package/dist/plugins/rsc-client-shim-excludes.d.ts +6 -0
  42. package/dist/plugins/rsc-client-shim-excludes.js +28 -0
  43. package/dist/plugins/rsc-client-shim-excludes.js.map +1 -0
  44. package/dist/routing/app-route-graph.d.ts +109 -0
  45. package/dist/routing/app-route-graph.js +819 -0
  46. package/dist/routing/app-route-graph.js.map +1 -0
  47. package/dist/routing/app-router.d.ts +2 -79
  48. package/dist/routing/app-router.js +7 -621
  49. package/dist/routing/app-router.js.map +1 -1
  50. package/dist/routing/route-pattern.d.ts +9 -0
  51. package/dist/routing/route-pattern.js +90 -0
  52. package/dist/routing/route-pattern.js.map +1 -0
  53. package/dist/routing/route-trie.js +10 -11
  54. package/dist/routing/route-trie.js.map +1 -1
  55. package/dist/server/app-browser-entry.js +94 -232
  56. package/dist/server/app-browser-entry.js.map +1 -1
  57. package/dist/server/app-browser-error.d.ts +3 -4
  58. package/dist/server/app-browser-error.js +8 -4
  59. package/dist/server/app-browser-error.js.map +1 -1
  60. package/dist/server/app-browser-navigation-controller.d.ts +73 -0
  61. package/dist/server/app-browser-navigation-controller.js +282 -0
  62. package/dist/server/app-browser-navigation-controller.js.map +1 -0
  63. package/dist/server/app-browser-state.d.ts +1 -1
  64. package/dist/server/app-browser-state.js.map +1 -1
  65. package/dist/server/app-elements.js +1 -5
  66. package/dist/server/app-elements.js.map +1 -1
  67. package/dist/server/app-fallback-renderer.d.ts +57 -0
  68. package/dist/server/app-fallback-renderer.js +79 -0
  69. package/dist/server/app-fallback-renderer.js.map +1 -0
  70. package/dist/server/app-hook-warning-suppression.d.ts +7 -0
  71. package/dist/server/app-hook-warning-suppression.js +12 -0
  72. package/dist/server/app-hook-warning-suppression.js.map +1 -0
  73. package/dist/server/app-middleware.d.ts +32 -0
  74. package/dist/server/app-middleware.js +147 -0
  75. package/dist/server/app-middleware.js.map +1 -0
  76. package/dist/server/app-mounted-slots-header.d.ts +17 -0
  77. package/dist/server/app-mounted-slots-header.js +21 -0
  78. package/dist/server/app-mounted-slots-header.js.map +1 -0
  79. package/dist/server/app-page-boundary-render.d.ts +4 -2
  80. package/dist/server/app-page-boundary-render.js +50 -30
  81. package/dist/server/app-page-boundary-render.js.map +1 -1
  82. package/dist/server/app-page-boundary.d.ts +12 -1
  83. package/dist/server/app-page-boundary.js +27 -12
  84. package/dist/server/app-page-boundary.js.map +1 -1
  85. package/dist/server/app-page-cache.d.ts +22 -5
  86. package/dist/server/app-page-cache.js +90 -11
  87. package/dist/server/app-page-cache.js.map +1 -1
  88. package/dist/server/app-page-dispatch.d.ts +123 -0
  89. package/dist/server/app-page-dispatch.js +348 -0
  90. package/dist/server/app-page-dispatch.js.map +1 -0
  91. package/dist/server/app-page-element-builder.d.ts +61 -0
  92. package/dist/server/app-page-element-builder.js +139 -0
  93. package/dist/server/app-page-element-builder.js.map +1 -0
  94. package/dist/server/app-page-execution.d.ts +4 -3
  95. package/dist/server/app-page-execution.js +5 -8
  96. package/dist/server/app-page-execution.js.map +1 -1
  97. package/dist/server/app-page-head.d.ts +55 -0
  98. package/dist/server/app-page-head.js +196 -0
  99. package/dist/server/app-page-head.js.map +1 -0
  100. package/dist/server/app-page-method.d.ts +16 -0
  101. package/dist/server/app-page-method.js +30 -0
  102. package/dist/server/app-page-method.js.map +1 -0
  103. package/dist/server/app-page-params.d.ts +8 -0
  104. package/dist/server/app-page-params.js +28 -0
  105. package/dist/server/app-page-params.js.map +1 -0
  106. package/dist/server/app-page-render.d.ts +7 -2
  107. package/dist/server/app-page-render.js +131 -32
  108. package/dist/server/app-page-render.js.map +1 -1
  109. package/dist/server/app-page-request.d.ts +23 -8
  110. package/dist/server/app-page-request.js +51 -6
  111. package/dist/server/app-page-request.js.map +1 -1
  112. package/dist/server/app-page-response.d.ts +1 -0
  113. package/dist/server/app-page-response.js +3 -7
  114. package/dist/server/app-page-response.js.map +1 -1
  115. package/dist/server/app-page-route-wiring.d.ts +29 -5
  116. package/dist/server/app-page-route-wiring.js +30 -8
  117. package/dist/server/app-page-route-wiring.js.map +1 -1
  118. package/dist/server/app-page-stream.d.ts +10 -0
  119. package/dist/server/app-page-stream.js +5 -1
  120. package/dist/server/app-page-stream.js.map +1 -1
  121. package/dist/server/app-post-middleware-context.d.ts +16 -0
  122. package/dist/server/app-post-middleware-context.js +28 -0
  123. package/dist/server/app-post-middleware-context.js.map +1 -0
  124. package/dist/server/app-prerender-endpoints.d.ts +19 -0
  125. package/dist/server/app-prerender-endpoints.js +96 -0
  126. package/dist/server/app-prerender-endpoints.js.map +1 -0
  127. package/dist/server/app-prerender-static-params.d.ts +16 -0
  128. package/dist/server/app-prerender-static-params.js +14 -0
  129. package/dist/server/app-prerender-static-params.js.map +1 -0
  130. package/dist/server/app-request-context.d.ts +22 -0
  131. package/dist/server/app-request-context.js +30 -0
  132. package/dist/server/app-request-context.js.map +1 -0
  133. package/dist/server/app-route-handler-cache.d.ts +4 -0
  134. package/dist/server/app-route-handler-cache.js +11 -3
  135. package/dist/server/app-route-handler-cache.js.map +1 -1
  136. package/dist/server/app-route-handler-dispatch.d.ts +43 -0
  137. package/dist/server/app-route-handler-dispatch.js +149 -0
  138. package/dist/server/app-route-handler-dispatch.js.map +1 -0
  139. package/dist/server/app-route-handler-execution.d.ts +8 -3
  140. package/dist/server/app-route-handler-execution.js +25 -4
  141. package/dist/server/app-route-handler-execution.js.map +1 -1
  142. package/dist/server/app-route-handler-response.d.ts +6 -3
  143. package/dist/server/app-route-handler-response.js +52 -11
  144. package/dist/server/app-route-handler-response.js.map +1 -1
  145. package/dist/server/app-route-handler-runtime.d.ts +4 -1
  146. package/dist/server/app-route-handler-runtime.js +107 -1
  147. package/dist/server/app-route-handler-runtime.js.map +1 -1
  148. package/dist/server/app-router-entry.js.map +1 -1
  149. package/dist/server/app-rsc-error-handler.d.ts +21 -0
  150. package/dist/server/app-rsc-error-handler.js +30 -0
  151. package/dist/server/app-rsc-error-handler.js.map +1 -0
  152. package/dist/server/app-rsc-errors.d.ts +27 -0
  153. package/dist/server/app-rsc-errors.js +42 -0
  154. package/dist/server/app-rsc-errors.js.map +1 -0
  155. package/dist/server/app-rsc-handler.d.ts +117 -0
  156. package/dist/server/app-rsc-handler.js +260 -0
  157. package/dist/server/app-rsc-handler.js.map +1 -0
  158. package/dist/server/app-rsc-request-normalization.d.ts +40 -0
  159. package/dist/server/app-rsc-request-normalization.js +63 -0
  160. package/dist/server/app-rsc-request-normalization.js.map +1 -0
  161. package/dist/server/app-rsc-response-finalizer.d.ts +30 -0
  162. package/dist/server/app-rsc-response-finalizer.js +38 -0
  163. package/dist/server/app-rsc-response-finalizer.js.map +1 -0
  164. package/dist/server/app-rsc-route-matching.d.ts +40 -0
  165. package/dist/server/app-rsc-route-matching.js +66 -0
  166. package/dist/server/app-rsc-route-matching.js.map +1 -0
  167. package/dist/server/app-segment-config.d.ts +33 -0
  168. package/dist/server/app-segment-config.js +86 -0
  169. package/dist/server/app-segment-config.js.map +1 -0
  170. package/dist/server/app-server-action-execution.d.ts +88 -1
  171. package/dist/server/app-server-action-execution.js +257 -5
  172. package/dist/server/app-server-action-execution.js.map +1 -1
  173. package/dist/server/app-ssr-entry.d.ts +7 -0
  174. package/dist/server/app-ssr-entry.js +30 -9
  175. package/dist/server/app-ssr-entry.js.map +1 -1
  176. package/dist/server/app-ssr-stream.d.ts +4 -2
  177. package/dist/server/app-ssr-stream.js +29 -2
  178. package/dist/server/app-ssr-stream.js.map +1 -1
  179. package/dist/server/app-static-generation.d.ts +15 -0
  180. package/dist/server/app-static-generation.js +20 -0
  181. package/dist/server/app-static-generation.js.map +1 -0
  182. package/dist/server/cache-control.d.ts +24 -0
  183. package/dist/server/cache-control.js +33 -0
  184. package/dist/server/cache-control.js.map +1 -0
  185. package/dist/server/dev-error-overlay-store.d.ts +23 -0
  186. package/dist/server/dev-error-overlay-store.js +67 -0
  187. package/dist/server/dev-error-overlay-store.js.map +1 -0
  188. package/dist/server/dev-error-overlay.d.ts +15 -0
  189. package/dist/server/dev-error-overlay.js +548 -0
  190. package/dist/server/dev-error-overlay.js.map +1 -0
  191. package/dist/server/dev-route-files.d.ts +7 -0
  192. package/dist/server/dev-route-files.js +73 -0
  193. package/dist/server/dev-route-files.js.map +1 -0
  194. package/dist/server/dev-server.js +4 -0
  195. package/dist/server/dev-server.js.map +1 -1
  196. package/dist/server/file-based-metadata.d.ts +17 -0
  197. package/dist/server/file-based-metadata.js +356 -0
  198. package/dist/server/file-based-metadata.js.map +1 -0
  199. package/dist/server/implicit-tags.d.ts +6 -0
  200. package/dist/server/implicit-tags.js +42 -0
  201. package/dist/server/implicit-tags.js.map +1 -0
  202. package/dist/server/instrumentation-runtime.d.ts +44 -0
  203. package/dist/server/instrumentation-runtime.js +29 -0
  204. package/dist/server/instrumentation-runtime.js.map +1 -0
  205. package/dist/server/instrumentation.js.map +1 -1
  206. package/dist/server/isr-cache.d.ts +16 -3
  207. package/dist/server/isr-cache.js +56 -8
  208. package/dist/server/isr-cache.js.map +1 -1
  209. package/dist/server/metadata-route-build-data.d.ts +25 -0
  210. package/dist/server/metadata-route-build-data.js +150 -0
  211. package/dist/server/metadata-route-build-data.js.map +1 -0
  212. package/dist/server/metadata-route-response.d.ts +17 -0
  213. package/dist/server/metadata-route-response.js +187 -0
  214. package/dist/server/metadata-route-response.js.map +1 -0
  215. package/dist/server/metadata-routes.d.ts +42 -4
  216. package/dist/server/metadata-routes.js +127 -11
  217. package/dist/server/metadata-routes.js.map +1 -1
  218. package/dist/server/middleware-matcher.d.ts +15 -0
  219. package/dist/server/middleware-matcher.js +102 -0
  220. package/dist/server/middleware-matcher.js.map +1 -0
  221. package/dist/server/middleware-request-headers.js +2 -1
  222. package/dist/server/middleware-request-headers.js.map +1 -1
  223. package/dist/server/middleware-runtime.d.ts +39 -0
  224. package/dist/server/middleware-runtime.js +159 -0
  225. package/dist/server/middleware-runtime.js.map +1 -0
  226. package/dist/server/middleware.d.ts +4 -36
  227. package/dist/server/middleware.js +18 -228
  228. package/dist/server/middleware.js.map +1 -1
  229. package/dist/server/pages-page-data.d.ts +7 -2
  230. package/dist/server/pages-page-data.js +10 -5
  231. package/dist/server/pages-page-data.js.map +1 -1
  232. package/dist/server/pages-page-response.d.ts +2 -1
  233. package/dist/server/pages-page-response.js +5 -3
  234. package/dist/server/pages-page-response.js.map +1 -1
  235. package/dist/server/prerender-work-unit-setup.d.ts +7 -0
  236. package/dist/server/prerender-work-unit-setup.js +30 -0
  237. package/dist/server/prerender-work-unit-setup.js.map +1 -0
  238. package/dist/server/prod-server.js +10 -14
  239. package/dist/server/prod-server.js.map +1 -1
  240. package/dist/server/request-pipeline.d.ts +46 -5
  241. package/dist/server/request-pipeline.js +84 -5
  242. package/dist/server/request-pipeline.js.map +1 -1
  243. package/dist/server/rsc-stream-hints.d.ts +7 -0
  244. package/dist/server/rsc-stream-hints.js +38 -0
  245. package/dist/server/rsc-stream-hints.js.map +1 -0
  246. package/dist/server/seed-cache.js +19 -8
  247. package/dist/server/seed-cache.js.map +1 -1
  248. package/dist/server/server-action-not-found.d.ts +9 -0
  249. package/dist/server/server-action-not-found.js +40 -0
  250. package/dist/server/server-action-not-found.js.map +1 -0
  251. package/dist/shims/cache-runtime.js +28 -11
  252. package/dist/shims/cache-runtime.js.map +1 -1
  253. package/dist/shims/cache.d.ts +39 -4
  254. package/dist/shims/cache.js +93 -16
  255. package/dist/shims/cache.js.map +1 -1
  256. package/dist/shims/error-boundary.d.ts +66 -5
  257. package/dist/shims/error-boundary.js +106 -4
  258. package/dist/shims/error-boundary.js.map +1 -1
  259. package/dist/shims/fetch-cache.d.ts +4 -1
  260. package/dist/shims/fetch-cache.js +55 -13
  261. package/dist/shims/fetch-cache.js.map +1 -1
  262. package/dist/shims/font-google-base.d.ts +5 -4
  263. package/dist/shims/font-google-base.js +61 -13
  264. package/dist/shims/font-google-base.js.map +1 -1
  265. package/dist/shims/headers.d.ts +14 -2
  266. package/dist/shims/headers.js +127 -17
  267. package/dist/shims/headers.js.map +1 -1
  268. package/dist/shims/image.js +116 -10
  269. package/dist/shims/image.js.map +1 -1
  270. package/dist/shims/internal/make-hanging-promise.d.ts +16 -0
  271. package/dist/shims/internal/make-hanging-promise.js +46 -0
  272. package/dist/shims/internal/make-hanging-promise.js.map +1 -0
  273. package/dist/shims/internal/work-unit-async-storage.d.ts +26 -3
  274. package/dist/shims/internal/work-unit-async-storage.js +6 -3
  275. package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
  276. package/dist/shims/metadata.d.ts +38 -26
  277. package/dist/shims/metadata.js +75 -45
  278. package/dist/shims/metadata.js.map +1 -1
  279. package/dist/shims/navigation.d.ts +10 -1
  280. package/dist/shims/navigation.js +18 -1
  281. package/dist/shims/navigation.js.map +1 -1
  282. package/dist/shims/navigation.react-server.d.ts +2 -2
  283. package/dist/shims/navigation.react-server.js +2 -2
  284. package/dist/shims/navigation.react-server.js.map +1 -1
  285. package/dist/shims/offline.d.ts +5 -0
  286. package/dist/shims/offline.js +17 -0
  287. package/dist/shims/offline.js.map +1 -0
  288. package/dist/shims/request-state-types.d.ts +3 -2
  289. package/dist/shims/root-params.d.ts +11 -0
  290. package/dist/shims/root-params.js +24 -0
  291. package/dist/shims/root-params.js.map +1 -0
  292. package/dist/shims/router.js +1 -1
  293. package/dist/shims/server.d.ts +3 -1
  294. package/dist/shims/server.js +83 -5
  295. package/dist/shims/server.js.map +1 -1
  296. package/dist/shims/thenable-params.d.ts +5 -0
  297. package/dist/shims/thenable-params.js +37 -0
  298. package/dist/shims/thenable-params.js.map +1 -0
  299. package/dist/shims/unified-request-context.d.ts +3 -2
  300. package/dist/shims/unified-request-context.js +3 -0
  301. package/dist/shims/unified-request-context.js.map +1 -1
  302. package/dist/shims/use-merged-ref.d.ts +7 -0
  303. package/dist/shims/use-merged-ref.js +40 -0
  304. package/dist/shims/use-merged-ref.js.map +1 -0
  305. package/dist/utils/cache-control-metadata.d.ts +6 -0
  306. package/dist/utils/cache-control-metadata.js +16 -0
  307. package/dist/utils/cache-control-metadata.js.map +1 -0
  308. package/package.json +6 -1
  309. package/dist/server/middleware-codegen.d.ts +0 -54
  310. package/dist/server/middleware-codegen.js +0 -414
  311. package/dist/server/middleware-codegen.js.map +0 -1
@@ -4,16 +4,19 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
4
  //#region src/shims/error-boundary.d.ts
5
5
  type ErrorBoundaryProps = {
6
6
  fallback: React.ComponentType<{
7
- error: Error;
7
+ error: unknown;
8
8
  reset: () => void;
9
9
  }>;
10
10
  children: React.ReactNode;
11
11
  };
12
+ type CapturedError = {
13
+ thrownValue: unknown;
14
+ };
12
15
  type ErrorBoundaryInnerProps = {
13
16
  pathname: string;
14
17
  } & ErrorBoundaryProps;
15
18
  type ErrorBoundaryState = {
16
- error: Error | null;
19
+ error: CapturedError | null;
17
20
  previousPathname: string;
18
21
  };
19
22
  /**
@@ -24,9 +27,9 @@ type ErrorBoundaryState = {
24
27
  declare class ErrorBoundaryInner extends React.Component<ErrorBoundaryInnerProps, ErrorBoundaryState> {
25
28
  constructor(props: ErrorBoundaryInnerProps);
26
29
  static getDerivedStateFromProps(props: ErrorBoundaryInnerProps, state: ErrorBoundaryState): ErrorBoundaryState | null;
27
- static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
30
+ static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState>;
28
31
  reset: () => void;
29
- render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | _$react_jsx_runtime0.JSX.Element | null | undefined;
32
+ render(): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
30
33
  }
31
34
  declare function ErrorBoundary({
32
35
  fallback,
@@ -44,6 +47,64 @@ declare function NotFoundBoundary({
44
47
  fallback,
45
48
  children
46
49
  }: NotFoundBoundaryProps): _$react_jsx_runtime0.JSX.Element;
50
+ type ForbiddenBoundaryProps = {
51
+ fallback: React.ReactNode;
52
+ children: React.ReactNode;
53
+ };
54
+ type ForbiddenBoundaryInnerProps = {
55
+ pathname: string;
56
+ } & ForbiddenBoundaryProps;
57
+ type ForbiddenBoundaryState = {
58
+ forbidden: boolean;
59
+ previousPathname: string;
60
+ };
61
+ declare class ForbiddenBoundaryInner extends React.Component<ForbiddenBoundaryInnerProps, ForbiddenBoundaryState> {
62
+ constructor(props: ForbiddenBoundaryInnerProps);
63
+ static getDerivedStateFromProps(props: ForbiddenBoundaryInnerProps, state: ForbiddenBoundaryState): ForbiddenBoundaryState | null;
64
+ static getDerivedStateFromError(error: unknown): Partial<ForbiddenBoundaryState>;
65
+ render(): React.ReactNode;
66
+ }
67
+ declare function ForbiddenBoundary({
68
+ fallback,
69
+ children
70
+ }: ForbiddenBoundaryProps): _$react_jsx_runtime0.JSX.Element;
71
+ type UnauthorizedBoundaryProps = {
72
+ fallback: React.ReactNode;
73
+ children: React.ReactNode;
74
+ };
75
+ type UnauthorizedBoundaryInnerProps = {
76
+ pathname: string;
77
+ } & UnauthorizedBoundaryProps;
78
+ type UnauthorizedBoundaryState = {
79
+ unauthorized: boolean;
80
+ previousPathname: string;
81
+ };
82
+ declare class UnauthorizedBoundaryInner extends React.Component<UnauthorizedBoundaryInnerProps, UnauthorizedBoundaryState> {
83
+ constructor(props: UnauthorizedBoundaryInnerProps);
84
+ static getDerivedStateFromProps(props: UnauthorizedBoundaryInnerProps, state: UnauthorizedBoundaryState): UnauthorizedBoundaryState | null;
85
+ static getDerivedStateFromError(error: unknown): Partial<UnauthorizedBoundaryState>;
86
+ render(): React.ReactNode;
87
+ }
88
+ declare function UnauthorizedBoundary({
89
+ fallback,
90
+ children
91
+ }: UnauthorizedBoundaryProps): _$react_jsx_runtime0.JSX.Element;
92
+ type DevRecoveryBoundaryProps = {
93
+ resetKey: number;
94
+ onCatch?: (resetKey: number) => void;
95
+ children?: React.ReactNode;
96
+ };
97
+ type DevRecoveryBoundaryState = {
98
+ error: CapturedError | null;
99
+ previousResetKey: number;
100
+ };
101
+ declare class DevRecoveryBoundary extends React.Component<DevRecoveryBoundaryProps, DevRecoveryBoundaryState> {
102
+ constructor(props: DevRecoveryBoundaryProps);
103
+ static getDerivedStateFromProps(props: DevRecoveryBoundaryProps, state: DevRecoveryBoundaryState): DevRecoveryBoundaryState | null;
104
+ static getDerivedStateFromError(error: unknown): Partial<DevRecoveryBoundaryState>;
105
+ componentDidCatch(): void;
106
+ render(): React.ReactNode;
107
+ }
47
108
  //#endregion
48
- export { ErrorBoundary, ErrorBoundaryInner, ErrorBoundaryProps, ErrorBoundaryState, NotFoundBoundary };
109
+ export { DevRecoveryBoundary, DevRecoveryBoundaryProps, ErrorBoundary, ErrorBoundaryInner, ErrorBoundaryProps, ErrorBoundaryState, ForbiddenBoundary, ForbiddenBoundaryInner, NotFoundBoundary, UnauthorizedBoundary, UnauthorizedBoundaryInner };
49
110
  //# sourceMappingURL=error-boundary.d.ts.map
@@ -31,7 +31,7 @@ var ErrorBoundaryInner = class extends React.Component {
31
31
  const digest = String(error.digest);
32
32
  if (digest === "NEXT_NOT_FOUND" || digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;") || digest.startsWith("NEXT_REDIRECT;")) throw error;
33
33
  }
34
- return { error };
34
+ return { error: { thrownValue: error } };
35
35
  }
36
36
  reset = () => {
37
37
  this.setState({ error: null });
@@ -40,7 +40,7 @@ var ErrorBoundaryInner = class extends React.Component {
40
40
  if (this.state.error) {
41
41
  const FallbackComponent = this.props.fallback;
42
42
  return /* @__PURE__ */ jsx(FallbackComponent, {
43
- error: this.state.error,
43
+ error: this.state.error.thrownValue,
44
44
  reset: this.reset
45
45
  });
46
46
  }
@@ -83,7 +83,7 @@ var NotFoundBoundaryInner = class extends React.Component {
83
83
  static getDerivedStateFromError(error) {
84
84
  if (error && typeof error === "object" && "digest" in error) {
85
85
  const digest = String(error.digest);
86
- if (digest === "NEXT_NOT_FOUND" || digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;404")) return { notFound: true };
86
+ if (digest === "NEXT_NOT_FOUND" || digest === "NEXT_HTTP_ERROR_FALLBACK;404") return { notFound: true };
87
87
  }
88
88
  throw error;
89
89
  }
@@ -103,7 +103,109 @@ function NotFoundBoundary({ fallback, children }) {
103
103
  children
104
104
  });
105
105
  }
106
+ var ForbiddenBoundaryInner = class extends React.Component {
107
+ constructor(props) {
108
+ super(props);
109
+ this.state = {
110
+ forbidden: false,
111
+ previousPathname: props.pathname
112
+ };
113
+ }
114
+ static getDerivedStateFromProps(props, state) {
115
+ if (props.pathname !== state.previousPathname && state.forbidden) return {
116
+ forbidden: false,
117
+ previousPathname: props.pathname
118
+ };
119
+ return {
120
+ forbidden: state.forbidden,
121
+ previousPathname: props.pathname
122
+ };
123
+ }
124
+ static getDerivedStateFromError(error) {
125
+ if (error && typeof error === "object" && "digest" in error) {
126
+ if (String(error.digest) === "NEXT_HTTP_ERROR_FALLBACK;403") return { forbidden: true };
127
+ }
128
+ throw error;
129
+ }
130
+ render() {
131
+ if (this.state.forbidden) return this.props.fallback;
132
+ return this.props.children;
133
+ }
134
+ };
135
+ function ForbiddenBoundary({ fallback, children }) {
136
+ return /* @__PURE__ */ jsx(ForbiddenBoundaryInner, {
137
+ pathname: usePathname(),
138
+ fallback,
139
+ children
140
+ });
141
+ }
142
+ var UnauthorizedBoundaryInner = class extends React.Component {
143
+ constructor(props) {
144
+ super(props);
145
+ this.state = {
146
+ unauthorized: false,
147
+ previousPathname: props.pathname
148
+ };
149
+ }
150
+ static getDerivedStateFromProps(props, state) {
151
+ if (props.pathname !== state.previousPathname && state.unauthorized) return {
152
+ unauthorized: false,
153
+ previousPathname: props.pathname
154
+ };
155
+ return {
156
+ unauthorized: state.unauthorized,
157
+ previousPathname: props.pathname
158
+ };
159
+ }
160
+ static getDerivedStateFromError(error) {
161
+ if (error && typeof error === "object" && "digest" in error) {
162
+ if (String(error.digest) === "NEXT_HTTP_ERROR_FALLBACK;401") return { unauthorized: true };
163
+ }
164
+ throw error;
165
+ }
166
+ render() {
167
+ if (this.state.unauthorized) return this.props.fallback;
168
+ return this.props.children;
169
+ }
170
+ };
171
+ function UnauthorizedBoundary({ fallback, children }) {
172
+ return /* @__PURE__ */ jsx(UnauthorizedBoundaryInner, {
173
+ pathname: usePathname(),
174
+ fallback,
175
+ children
176
+ });
177
+ }
178
+ var DevRecoveryBoundary = class extends React.Component {
179
+ constructor(props) {
180
+ super(props);
181
+ this.state = {
182
+ error: null,
183
+ previousResetKey: props.resetKey
184
+ };
185
+ }
186
+ static getDerivedStateFromProps(props, state) {
187
+ if (props.resetKey === state.previousResetKey) return null;
188
+ return {
189
+ error: null,
190
+ previousResetKey: props.resetKey
191
+ };
192
+ }
193
+ 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
+ }
198
+ return { error: { thrownValue: error } };
199
+ }
200
+ componentDidCatch() {
201
+ this.props.onCatch?.(this.props.resetKey);
202
+ }
203
+ render() {
204
+ if (this.state.error) return null;
205
+ return this.props.children;
206
+ }
207
+ };
106
208
  //#endregion
107
- export { ErrorBoundary, ErrorBoundaryInner, NotFoundBoundary };
209
+ export { DevRecoveryBoundary, ErrorBoundary, ErrorBoundaryInner, ForbiddenBoundary, ForbiddenBoundaryInner, NotFoundBoundary, UnauthorizedBoundary, UnauthorizedBoundaryInner };
108
210
 
109
211
  //# 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: Error; reset: () => void }>;\n children: React.ReactNode;\n};\n\ntype ErrorBoundaryInnerProps = {\n pathname: string;\n} & ErrorBoundaryProps;\n\nexport type ErrorBoundaryState = {\n error: Error | 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: Error): 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 };\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} 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: Error): Partial<NotFoundBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_NOT_FOUND\" || digest.startsWith(\"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}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U;AAE9D,SAAO;GAAE,UAAU,MAAM;GAAU,kBAAkB,MAAM;GAAU;;CAGvE,OAAO,yBAAyB,OAA8C;AAC5E,MAAI,SAAS,OAAO,UAAU,YAAY,YAAY,OAAO;GAC3D,MAAM,SAAS,OAAO,MAAM,OAAO;AACnC,OAAI,WAAW,oBAAoB,OAAO,WAAW,+BAA+B,CAClF,QAAO,EAAE,UAAU,MAAM;;AAI7B,QAAM;;CAGR,SAAS;AACP,MAAI,KAAK,MAAM,SACb,QAAO,KAAK,MAAM;AAEpB,SAAO,KAAK,MAAM;;;;;;;AAQtB,SAAgB,iBAAiB,EAAE,UAAU,YAAmC;AAE9E,QACE,oBAAC,uBAAD;EAAuB,UAFR,aAAa;EAEyB;EAClD;EACqB,CAAA"}
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,kBAAkB,MAAM;GAAU;AAE1D,SAAO;GAAE,OAAO,MAAM;GAAO,kBAAkB,MAAM;GAAU;;CAGjE,OAAO,yBAAyB,OAA6C;AAI3E,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,cAAc;AACZ,OAAK,SAAS,EAAE,OAAO,MAAM,CAAC;;CAGhC,SAAS;AACP,MAAI,KAAK,MAAM,OAAO;GACpB,MAAM,oBAAoB,KAAK,MAAM;AACrC,UA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,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"}
@@ -33,7 +33,9 @@ declare function _resetPendingRefetches(): void;
33
33
  type FetchCacheState = {
34
34
  currentRequestTags: string[];
35
35
  currentFetchSoftTags: string[];
36
+ currentFetchCacheMode: FetchCacheMode | null;
36
37
  };
38
+ type FetchCacheMode = "auto" | "default-cache" | "default-no-store" | "force-cache" | "force-no-store" | "only-cache" | "only-no-store";
37
39
  /**
38
40
  * Get tags collected during the current render pass.
39
41
  * Useful for associating page-level cache entries with all the
@@ -48,6 +50,7 @@ declare function getCollectedFetchTags(): string[];
48
50
  * affected route, without permanently coupling a shared fetch entry to one path.
49
51
  */
50
52
  declare function setCurrentFetchSoftTags(tags: string[]): void;
53
+ declare function setCurrentFetchCacheMode(mode: FetchCacheMode | null): void;
51
54
  /**
52
55
  * Install the patched fetch and reset per-request tag state.
53
56
  * Returns a cleanup function that clears tags.
@@ -81,5 +84,5 @@ declare function ensureFetchPatch(): void;
81
84
  */
82
85
  declare function getOriginalFetch(): typeof globalThis.fetch;
83
86
  //#endregion
84
- export { FetchCacheState, _resetPendingRefetches, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, runWithFetchCache, setCurrentFetchSoftTags, withFetchCache };
87
+ export { FetchCacheMode, FetchCacheState, _resetPendingRefetches, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, runWithFetchCache, setCurrentFetchCacheMode, setCurrentFetchSoftTags, withFetchCache };
85
88
  //# sourceMappingURL=fetch-cache.d.ts.map
@@ -283,7 +283,8 @@ const _g = globalThis;
283
283
  const _als = _g[_ALS_KEY] ??= new AsyncLocalStorage();
284
284
  const _fallbackState = _g[_FALLBACK_KEY] ??= {
285
285
  currentRequestTags: [],
286
- currentFetchSoftTags: []
286
+ currentFetchSoftTags: [],
287
+ currentFetchCacheMode: null
287
288
  };
288
289
  function _getState() {
289
290
  if (isInsideUnifiedScope()) return getRequestContext();
@@ -296,6 +297,7 @@ function _getState() {
296
297
  function _resetFallbackState() {
297
298
  _fallbackState.currentRequestTags = [];
298
299
  _fallbackState.currentFetchSoftTags = [];
300
+ _fallbackState.currentFetchCacheMode = null;
299
301
  }
300
302
  /**
301
303
  * Get tags collected during the current render pass.
@@ -315,6 +317,39 @@ function getCollectedFetchTags() {
315
317
  function setCurrentFetchSoftTags(tags) {
316
318
  _getState().currentFetchSoftTags = [...tags];
317
319
  }
320
+ function setCurrentFetchCacheMode(mode) {
321
+ _getState().currentFetchCacheMode = mode;
322
+ }
323
+ function isNoStoreFetch(cacheDirective, nextOpts) {
324
+ return cacheDirective === "no-store" || cacheDirective === "no-cache" || nextOpts?.revalidate === false || nextOpts?.revalidate === 0;
325
+ }
326
+ function isCacheableFetch(cacheDirective, nextOpts) {
327
+ return cacheDirective === "force-cache" || typeof nextOpts?.revalidate === "number" && nextOpts.revalidate > 0;
328
+ }
329
+ function hasExplicitRevalidateValue(nextOpts) {
330
+ return nextOpts?.revalidate !== void 0;
331
+ }
332
+ function resolveSegmentCacheDirective(cacheDirective, nextOpts, mode) {
333
+ if (!mode || mode === "auto") return cacheDirective;
334
+ switch (mode) {
335
+ case "force-cache": return "force-cache";
336
+ case "force-no-store": return "no-store";
337
+ case "only-cache":
338
+ if (isNoStoreFetch(cacheDirective, nextOpts)) throw new Error("Route segment config `fetchCache = \"only-cache\"` conflicts with no-store fetch.");
339
+ return cacheDirective ?? "force-cache";
340
+ case "only-no-store":
341
+ if (isCacheableFetch(cacheDirective, nextOpts)) throw new Error("Route segment config `fetchCache = \"only-no-store\"` conflicts with cacheable fetch.");
342
+ return cacheDirective ?? "no-store";
343
+ case "default-cache": return cacheDirective ?? (hasExplicitRevalidateValue(nextOpts) ? void 0 : "force-cache");
344
+ case "default-no-store": return cacheDirective ?? (hasExplicitRevalidateValue(nextOpts) ? void 0 : "no-store");
345
+ }
346
+ return cacheDirective;
347
+ }
348
+ function getFetchCacheDirective(input, init) {
349
+ if (init?.cache !== void 0) return init.cache;
350
+ if (!(input instanceof Request) || input.cache === "default") return;
351
+ return input.cache;
352
+ }
318
353
  /**
319
354
  * Create a patched fetch function with Next.js caching semantics.
320
355
  *
@@ -328,22 +363,27 @@ function setCurrentFetchSoftTags(tags) {
328
363
  function createPatchedFetch() {
329
364
  return async function patchedFetch(input, init) {
330
365
  const nextOpts = init?.next;
331
- const cacheDirective = init?.cache;
366
+ const cacheDirective = resolveSegmentCacheDirective(getFetchCacheDirective(input, init), nextOpts, _getState().currentFetchCacheMode);
332
367
  if (!nextOpts && !cacheDirective) return originalFetch(input, init);
333
- if (cacheDirective === "no-store" || cacheDirective === "no-cache" || nextOpts?.revalidate === false || nextOpts?.revalidate === 0) return originalFetch(input, stripNextFromInit(init));
334
- if (!(cacheDirective === "force-cache" || typeof nextOpts?.revalidate === "number" && nextOpts.revalidate > 0) && hasAuthHeaders(input, init)) return originalFetch(input, stripNextFromInit(init));
368
+ if (cacheDirective === "no-store" || cacheDirective === "no-cache" || nextOpts?.revalidate === false || nextOpts?.revalidate === 0) return originalFetch(input, stripNextFromInit(init, cacheDirective));
369
+ if (!(cacheDirective === "force-cache" || typeof nextOpts?.revalidate === "number" && nextOpts.revalidate > 0) && hasAuthHeaders(input, init)) return originalFetch(input, stripNextFromInit(init, cacheDirective));
335
370
  let revalidateSeconds;
336
371
  if (cacheDirective === "force-cache") revalidateSeconds = nextOpts?.revalidate && typeof nextOpts.revalidate === "number" ? nextOpts.revalidate : 31536e3;
337
372
  else if (typeof nextOpts?.revalidate === "number" && nextOpts.revalidate > 0) revalidateSeconds = nextOpts.revalidate;
338
373
  else if (nextOpts?.tags && nextOpts.tags.length > 0) revalidateSeconds = 31536e3;
339
- else return originalFetch(input, stripNextFromInit(init));
374
+ else return originalFetch(input, stripNextFromInit(init, cacheDirective));
340
375
  const tags = nextOpts?.tags ?? [];
341
376
  const softTags = _getState().currentFetchSoftTags;
377
+ let fetchInit = stripNextFromInit(init, cacheDirective);
342
378
  let cacheKey;
343
379
  try {
344
- cacheKey = await buildFetchCacheKey(input, init);
380
+ cacheKey = await buildFetchCacheKey(input, fetchInit);
381
+ fetchInit = stripNextFromInit(fetchInit, cacheDirective);
345
382
  } catch (err) {
346
- if (err instanceof BodyTooLargeForCacheKeyError || err instanceof SkipCacheKeyGenerationError) return originalFetch(input, stripNextFromInit(init));
383
+ if (err instanceof BodyTooLargeForCacheKeyError || err instanceof SkipCacheKeyGenerationError) {
384
+ fetchInit = stripNextFromInit(fetchInit, cacheDirective);
385
+ return originalFetch(input, fetchInit);
386
+ }
347
387
  throw err;
348
388
  }
349
389
  const handler = getCacheHandler();
@@ -367,7 +407,7 @@ function createPatchedFetch() {
367
407
  if (cached?.value && cached.value.kind === "FETCH" && cached.cacheState === "stale") {
368
408
  const staleData = cached.value.data;
369
409
  if (!pendingRefetches.has(cacheKey)) {
370
- const refetchPromise = originalFetch(input, stripNextFromInit(init)).then(async (freshResp) => {
410
+ const refetchPromise = originalFetch(input, fetchInit).then(async (freshResp) => {
371
411
  if (freshResp.status !== 200) return;
372
412
  const freshBody = await freshResp.text();
373
413
  const freshHeaders = {};
@@ -412,7 +452,7 @@ function createPatchedFetch() {
412
452
  } catch (cacheErr) {
413
453
  console.error("[vinext] fetch cache read error:", cacheErr);
414
454
  }
415
- const response = await originalFetch(input, stripNextFromInit(init));
455
+ const response = await originalFetch(input, fetchInit);
416
456
  if (response.status === 200) {
417
457
  const cloned = response.clone();
418
458
  const body = await cloned.text();
@@ -448,9 +488,10 @@ function createPatchedFetch() {
448
488
  * The `next` property is not a standard fetch option and would cause warnings
449
489
  * in some environments.
450
490
  */
451
- function stripNextFromInit(init) {
452
- if (!init) return init;
491
+ function stripNextFromInit(init, cacheOverride) {
492
+ if (!init) return cacheOverride === void 0 ? void 0 : { cache: cacheOverride };
453
493
  const { next: _next, _ogBody, ...rest } = init;
494
+ if (cacheOverride !== void 0) rest.cache = cacheOverride;
454
495
  if (_ogBody !== void 0) rest.body = _ogBody;
455
496
  return Object.keys(rest).length > 0 ? rest : void 0;
456
497
  }
@@ -491,7 +532,8 @@ async function runWithFetchCache(fn) {
491
532
  }, fn);
492
533
  return _als.run({
493
534
  currentRequestTags: [],
494
- currentFetchSoftTags: []
535
+ currentFetchSoftTags: [],
536
+ currentFetchCacheMode: null
495
537
  }, fn);
496
538
  }
497
539
  /**
@@ -513,6 +555,6 @@ function getOriginalFetch() {
513
555
  return originalFetch;
514
556
  }
515
557
  //#endregion
516
- export { _resetPendingRefetches, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, runWithFetchCache, setCurrentFetchSoftTags, withFetchCache };
558
+ export { _resetPendingRefetches, ensureFetchPatch, getCollectedFetchTags, getOriginalFetch, runWithFetchCache, setCurrentFetchCacheMode, setCurrentFetchSoftTags, withFetchCache };
517
559
 
518
560
  //# sourceMappingURL=fetch-cache.js.map