vinext 0.0.30 → 0.0.31

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 (435) hide show
  1. package/README.md +12 -6
  2. package/dist/build/prerender.d.ts +188 -0
  3. package/dist/build/prerender.js +675 -0
  4. package/dist/build/prerender.js.map +1 -0
  5. package/dist/build/report.d.ts +45 -46
  6. package/dist/build/report.js +247 -276
  7. package/dist/build/report.js.map +1 -1
  8. package/dist/build/run-prerender.d.ts +62 -0
  9. package/dist/build/run-prerender.js +183 -0
  10. package/dist/build/run-prerender.js.map +1 -0
  11. package/dist/build/server-manifest.d.ts +19 -0
  12. package/dist/build/server-manifest.js +29 -0
  13. package/dist/build/server-manifest.js.map +1 -0
  14. package/dist/build/static-export.d.ts +51 -66
  15. package/dist/build/static-export.js +51 -545
  16. package/dist/build/static-export.js.map +1 -1
  17. package/dist/check.d.ts +26 -24
  18. package/dist/check.js +591 -571
  19. package/dist/check.js.map +1 -1
  20. package/dist/cli.d.ts +1 -15
  21. package/dist/cli.js +430 -491
  22. package/dist/cli.js.map +1 -1
  23. package/dist/client/entry.d.ts +1 -2
  24. package/dist/client/entry.js +49 -62
  25. package/dist/client/entry.js.map +1 -1
  26. package/dist/client/validate-module-path.d.ts +4 -1
  27. package/dist/client/validate-module-path.js +23 -28
  28. package/dist/client/validate-module-path.js.map +1 -1
  29. package/dist/client/vinext-next-data.d.ts +15 -20
  30. package/dist/client/vinext-next-data.js +0 -1
  31. package/dist/cloudflare/index.d.ts +3 -8
  32. package/dist/cloudflare/index.js +3 -8
  33. package/dist/cloudflare/kv-cache-handler.d.ts +95 -105
  34. package/dist/cloudflare/kv-cache-handler.js +354 -380
  35. package/dist/cloudflare/kv-cache-handler.js.map +1 -1
  36. package/dist/cloudflare/tpr.d.ts +36 -34
  37. package/dist/cloudflare/tpr.js +460 -603
  38. package/dist/cloudflare/tpr.js.map +1 -1
  39. package/dist/config/config-matchers.d.ts +31 -40
  40. package/dist/config/config-matchers.js +727 -936
  41. package/dist/config/config-matchers.js.map +1 -1
  42. package/dist/config/dotenv.d.ts +18 -11
  43. package/dist/config/dotenv.js +79 -84
  44. package/dist/config/dotenv.js.map +1 -1
  45. package/dist/config/next-config.d.ts +156 -146
  46. package/dist/config/next-config.js +374 -464
  47. package/dist/config/next-config.js.map +1 -1
  48. package/dist/deploy.d.ts +87 -96
  49. package/dist/deploy.js +490 -628
  50. package/dist/deploy.js.map +1 -1
  51. package/dist/entries/app-browser-entry.d.ts +4 -1
  52. package/dist/entries/app-browser-entry.js +12 -8
  53. package/dist/entries/app-browser-entry.js.map +1 -1
  54. package/dist/entries/app-rsc-entry.d.ts +33 -20
  55. package/dist/entries/app-rsc-entry.js +442 -211
  56. package/dist/entries/app-rsc-entry.js.map +1 -1
  57. package/dist/entries/app-ssr-entry.d.ts +9 -1
  58. package/dist/entries/app-ssr-entry.js +61 -28
  59. package/dist/entries/app-ssr-entry.js.map +1 -1
  60. package/dist/entries/pages-client-entry.d.ts +6 -2
  61. package/dist/entries/pages-client-entry.js +30 -33
  62. package/dist/entries/pages-client-entry.js.map +1 -1
  63. package/dist/entries/pages-entry-helpers.d.ts +5 -1
  64. package/dist/entries/pages-entry-helpers.js +17 -14
  65. package/dist/entries/pages-entry-helpers.js.map +1 -1
  66. package/dist/entries/pages-server-entry.d.ts +6 -2
  67. package/dist/entries/pages-server-entry.js +84 -113
  68. package/dist/entries/pages-server-entry.js.map +1 -1
  69. package/dist/index.d.ts +82 -62
  70. package/dist/index.js +2172 -3133
  71. package/dist/index.js.map +1 -1
  72. package/dist/init.d.ts +40 -37
  73. package/dist/init.js +201 -258
  74. package/dist/init.js.map +1 -1
  75. package/dist/plugins/async-hooks-stub.d.ts +7 -3
  76. package/dist/plugins/async-hooks-stub.js +39 -42
  77. package/dist/plugins/async-hooks-stub.js.map +1 -1
  78. package/dist/plugins/client-reference-dedup.d.ts +7 -3
  79. package/dist/plugins/client-reference-dedup.js +63 -88
  80. package/dist/plugins/client-reference-dedup.js.map +1 -1
  81. package/dist/routing/app-router.d.ts +100 -96
  82. package/dist/routing/app-router.js +560 -670
  83. package/dist/routing/app-router.js.map +1 -1
  84. package/dist/routing/file-matcher.d.ts +18 -15
  85. package/dist/routing/file-matcher.js +65 -65
  86. package/dist/routing/file-matcher.js.map +1 -1
  87. package/dist/routing/pages-router.d.ts +23 -24
  88. package/dist/routing/pages-router.js +147 -172
  89. package/dist/routing/pages-router.js.map +1 -1
  90. package/dist/routing/route-trie.d.ts +23 -20
  91. package/dist/routing/route-trie.js +131 -151
  92. package/dist/routing/route-trie.js.map +1 -1
  93. package/dist/routing/route-validation.d.ts +5 -2
  94. package/dist/routing/route-validation.js +98 -130
  95. package/dist/routing/route-validation.js.map +1 -1
  96. package/dist/routing/utils.d.ts +10 -7
  97. package/dist/routing/utils.js +75 -111
  98. package/dist/routing/utils.js.map +1 -1
  99. package/dist/server/api-handler.d.ts +8 -13
  100. package/dist/server/api-handler.js +161 -193
  101. package/dist/server/api-handler.js.map +1 -1
  102. package/dist/server/app-router-entry.d.ts +6 -16
  103. package/dist/server/app-router-entry.js +26 -54
  104. package/dist/server/app-router-entry.js.map +1 -1
  105. package/dist/server/dev-module-runner.d.ts +11 -64
  106. package/dist/server/dev-module-runner.js +89 -101
  107. package/dist/server/dev-module-runner.js.map +1 -1
  108. package/dist/server/dev-origin-check.d.ts +12 -10
  109. package/dist/server/dev-origin-check.js +98 -108
  110. package/dist/server/dev-origin-check.js.map +1 -1
  111. package/dist/server/dev-server.d.ts +17 -14
  112. package/dist/server/dev-server.js +542 -869
  113. package/dist/server/dev-server.js.map +1 -1
  114. package/dist/server/html.d.ts +4 -1
  115. package/dist/server/html.js +25 -26
  116. package/dist/server/html.js.map +1 -1
  117. package/dist/server/image-optimization.d.ts +31 -28
  118. package/dist/server/image-optimization.js +181 -210
  119. package/dist/server/image-optimization.js.map +1 -1
  120. package/dist/server/instrumentation.d.ts +25 -22
  121. package/dist/server/instrumentation.js +110 -122
  122. package/dist/server/instrumentation.js.map +1 -1
  123. package/dist/server/isr-cache.d.ts +16 -26
  124. package/dist/server/isr-cache.js +106 -128
  125. package/dist/server/isr-cache.js.map +1 -1
  126. package/dist/server/metadata-routes.d.ts +85 -88
  127. package/dist/server/metadata-routes.js +270 -317
  128. package/dist/server/metadata-routes.js.map +1 -1
  129. package/dist/server/middleware-codegen.d.ts +7 -4
  130. package/dist/server/middleware-codegen.js +61 -61
  131. package/dist/server/middleware-codegen.js.map +1 -1
  132. package/dist/server/middleware-request-headers.d.ts +8 -6
  133. package/dist/server/middleware-request-headers.js +47 -65
  134. package/dist/server/middleware-request-headers.js.map +1 -1
  135. package/dist/server/middleware.d.ts +31 -47
  136. package/dist/server/middleware.js +273 -404
  137. package/dist/server/middleware.js.map +1 -1
  138. package/dist/server/normalize-path.d.ts +4 -1
  139. package/dist/server/normalize-path.js +33 -47
  140. package/dist/server/normalize-path.js.map +1 -1
  141. package/dist/server/pages-i18n.d.ts +38 -30
  142. package/dist/server/pages-i18n.js +112 -139
  143. package/dist/server/pages-i18n.js.map +1 -1
  144. package/dist/server/prod-server.d.ts +19 -31
  145. package/dist/server/prod-server.js +714 -945
  146. package/dist/server/prod-server.js.map +1 -1
  147. package/dist/server/request-log.d.ts +18 -12
  148. package/dist/server/request-log.js +45 -52
  149. package/dist/server/request-log.js.map +1 -1
  150. package/dist/server/request-pipeline.d.ts +9 -17
  151. package/dist/server/request-pipeline.js +133 -184
  152. package/dist/server/request-pipeline.js.map +1 -1
  153. package/dist/server/worker-utils.d.ts +4 -1
  154. package/dist/server/worker-utils.js +31 -37
  155. package/dist/server/worker-utils.js.map +1 -1
  156. package/dist/shims/amp.d.ts +5 -2
  157. package/dist/shims/amp.js +19 -15
  158. package/dist/shims/amp.js.map +1 -1
  159. package/dist/shims/app.d.ts +8 -10
  160. package/dist/shims/app.js +0 -1
  161. package/dist/shims/cache-runtime.d.ts +20 -45
  162. package/dist/shims/cache-runtime.js +271 -422
  163. package/dist/shims/cache-runtime.js.map +1 -1
  164. package/dist/shims/cache.d.ts +130 -121
  165. package/dist/shims/cache.js +339 -427
  166. package/dist/shims/cache.js.map +1 -1
  167. package/dist/shims/client-only.d.ts +1 -18
  168. package/dist/shims/client-only.js +0 -17
  169. package/dist/shims/compat-router.d.ts +4 -1
  170. package/dist/shims/compat-router.js +23 -19
  171. package/dist/shims/compat-router.js.map +1 -1
  172. package/dist/shims/config.d.ts +7 -5
  173. package/dist/shims/config.js +16 -23
  174. package/dist/shims/config.js.map +1 -1
  175. package/dist/shims/constants.d.ts +119 -118
  176. package/dist/shims/constants.js +159 -164
  177. package/dist/shims/constants.js.map +1 -1
  178. package/dist/shims/document.d.ts +20 -16
  179. package/dist/shims/document.js +41 -22
  180. package/dist/shims/document.js.map +1 -1
  181. package/dist/shims/dynamic.d.ts +13 -22
  182. package/dist/shims/dynamic.js +122 -136
  183. package/dist/shims/dynamic.js.map +1 -1
  184. package/dist/shims/error-boundary.d.ts +22 -15
  185. package/dist/shims/error-boundary.js +81 -79
  186. package/dist/shims/error-boundary.js.map +1 -1
  187. package/dist/shims/error.d.ts +11 -12
  188. package/dist/shims/error.js +35 -39
  189. package/dist/shims/error.js.map +1 -1
  190. package/dist/shims/fetch-cache.d.ts +16 -14
  191. package/dist/shims/fetch-cache.js +437 -645
  192. package/dist/shims/fetch-cache.js.map +1 -1
  193. package/dist/shims/font-google-base.d.ts +28 -26
  194. package/dist/shims/font-google-base.js +238 -325
  195. package/dist/shims/font-google-base.js.map +1 -1
  196. package/dist/shims/font-google.d.ts +3 -3
  197. package/dist/shims/font-google.generated.d.ts +1928 -1924
  198. package/dist/shims/font-google.generated.js +1928 -2133
  199. package/dist/shims/font-google.generated.js.map +1 -1
  200. package/dist/shims/font-google.js +3 -3
  201. package/dist/shims/font-local.d.ts +28 -26
  202. package/dist/shims/font-local.js +204 -260
  203. package/dist/shims/font-local.js.map +1 -1
  204. package/dist/shims/form.d.ts +13 -27
  205. package/dist/shims/form.js +128 -180
  206. package/dist/shims/form.js.map +1 -1
  207. package/dist/shims/head-state.d.ts +8 -13
  208. package/dist/shims/head-state.js +25 -42
  209. package/dist/shims/head-state.js.map +1 -1
  210. package/dist/shims/head.d.ts +16 -20
  211. package/dist/shims/head.js +172 -250
  212. package/dist/shims/head.js.map +1 -1
  213. package/dist/shims/headers.d.ts +84 -78
  214. package/dist/shims/headers.js +447 -575
  215. package/dist/shims/headers.js.map +1 -1
  216. package/dist/shims/i18n-context.d.ts +16 -20
  217. package/dist/shims/i18n-context.js +35 -48
  218. package/dist/shims/i18n-context.js.map +1 -1
  219. package/dist/shims/i18n-state.d.ts +8 -14
  220. package/dist/shims/i18n-state.js +34 -42
  221. package/dist/shims/i18n-state.js.map +1 -1
  222. package/dist/shims/image-config.d.ts +11 -8
  223. package/dist/shims/image-config.js +50 -83
  224. package/dist/shims/image-config.js.map +1 -1
  225. package/dist/shims/image.d.ts +37 -46
  226. package/dist/shims/image.js +283 -308
  227. package/dist/shims/image.js.map +1 -1
  228. package/dist/shims/internal/api-utils.d.ts +7 -4
  229. package/dist/shims/internal/api-utils.js +0 -6
  230. package/dist/shims/internal/app-router-context.d.ts +22 -17
  231. package/dist/shims/internal/app-router-context.js +17 -13
  232. package/dist/shims/internal/app-router-context.js.map +1 -1
  233. package/dist/shims/internal/cookies.d.ts +2 -9
  234. package/dist/shims/internal/cookies.js +2 -9
  235. package/dist/shims/internal/parse-cookie-header.d.ts +4 -1
  236. package/dist/shims/internal/parse-cookie-header.js +29 -29
  237. package/dist/shims/internal/parse-cookie-header.js.map +1 -1
  238. package/dist/shims/internal/router-context.d.ts +6 -1
  239. package/dist/shims/internal/router-context.js +11 -7
  240. package/dist/shims/internal/router-context.js.map +1 -1
  241. package/dist/shims/internal/utils.d.ts +40 -37
  242. package/dist/shims/internal/utils.js +24 -30
  243. package/dist/shims/internal/utils.js.map +1 -1
  244. package/dist/shims/internal/work-unit-async-storage.d.ts +6 -10
  245. package/dist/shims/internal/work-unit-async-storage.js +14 -11
  246. package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
  247. package/dist/shims/layout-segment-context.d.ts +11 -14
  248. package/dist/shims/layout-segment-context.js +24 -23
  249. package/dist/shims/layout-segment-context.js.map +1 -1
  250. package/dist/shims/legacy-image.d.ts +39 -46
  251. package/dist/shims/legacy-image.js +47 -42
  252. package/dist/shims/legacy-image.js.map +1 -1
  253. package/dist/shims/link.d.ts +32 -36
  254. package/dist/shims/link.js +255 -391
  255. package/dist/shims/link.js.map +1 -1
  256. package/dist/shims/metadata.d.ts +210 -202
  257. package/dist/shims/metadata.js +545 -546
  258. package/dist/shims/metadata.js.map +1 -1
  259. package/dist/shims/navigation-state.d.ts +10 -18
  260. package/dist/shims/navigation-state.js +66 -74
  261. package/dist/shims/navigation-state.js.map +1 -1
  262. package/dist/shims/navigation.d.ts +59 -63
  263. package/dist/shims/navigation.js +505 -704
  264. package/dist/shims/navigation.js.map +1 -1
  265. package/dist/shims/og.d.ts +2 -20
  266. package/dist/shims/og.js +2 -19
  267. package/dist/shims/readonly-url-search-params.d.ts +8 -5
  268. package/dist/shims/readonly-url-search-params.js +26 -22
  269. package/dist/shims/readonly-url-search-params.js.map +1 -1
  270. package/dist/shims/request-context.d.ts +8 -5
  271. package/dist/shims/request-context.js +50 -60
  272. package/dist/shims/request-context.js.map +1 -1
  273. package/dist/shims/request-state-types.d.ts +11 -11
  274. package/dist/shims/request-state-types.js +0 -1
  275. package/dist/shims/router-state.d.ts +13 -10
  276. package/dist/shims/router-state.js +34 -43
  277. package/dist/shims/router-state.js.map +1 -1
  278. package/dist/shims/router.d.ts +81 -85
  279. package/dist/shims/router.js +506 -628
  280. package/dist/shims/router.js.map +1 -1
  281. package/dist/shims/script.d.ts +39 -48
  282. package/dist/shims/script.js +107 -160
  283. package/dist/shims/script.js.map +1 -1
  284. package/dist/shims/server-only.d.ts +1 -19
  285. package/dist/shims/server-only.js +0 -18
  286. package/dist/shims/server.d.ts +175 -164
  287. package/dist/shims/server.js +462 -478
  288. package/dist/shims/server.js.map +1 -1
  289. package/dist/shims/unified-request-context.d.ts +20 -20
  290. package/dist/shims/unified-request-context.js +81 -99
  291. package/dist/shims/unified-request-context.js.map +1 -1
  292. package/dist/shims/url-safety.d.ts +4 -1
  293. package/dist/shims/url-safety.js +15 -11
  294. package/dist/shims/url-safety.js.map +1 -1
  295. package/dist/shims/url-utils.d.ts +8 -5
  296. package/dist/shims/url-utils.js +62 -93
  297. package/dist/shims/url-utils.js.map +1 -1
  298. package/dist/shims/web-vitals.d.ts +10 -8
  299. package/dist/shims/web-vitals.js +9 -15
  300. package/dist/shims/web-vitals.js.map +1 -1
  301. package/dist/utils/base-path.d.ts +5 -2
  302. package/dist/utils/base-path.js +21 -19
  303. package/dist/utils/base-path.js.map +1 -1
  304. package/dist/utils/domain-locale.d.ts +17 -9
  305. package/dist/utils/domain-locale.js +36 -56
  306. package/dist/utils/domain-locale.js.map +1 -1
  307. package/dist/utils/hash.d.ts +4 -1
  308. package/dist/utils/hash.js +19 -17
  309. package/dist/utils/hash.js.map +1 -1
  310. package/dist/utils/manifest-paths.d.ts +6 -3
  311. package/dist/utils/manifest-paths.js +15 -16
  312. package/dist/utils/manifest-paths.js.map +1 -1
  313. package/dist/utils/project.d.ts +13 -11
  314. package/dist/utils/project.js +169 -216
  315. package/dist/utils/project.js.map +1 -1
  316. package/dist/utils/query.d.ts +8 -6
  317. package/dist/utils/query.js +57 -67
  318. package/dist/utils/query.js.map +1 -1
  319. package/package.json +10 -9
  320. package/dist/build/report.d.ts.map +0 -1
  321. package/dist/build/static-export.d.ts.map +0 -1
  322. package/dist/check.d.ts.map +0 -1
  323. package/dist/cli.d.ts.map +0 -1
  324. package/dist/client/entry.d.ts.map +0 -1
  325. package/dist/client/validate-module-path.d.ts.map +0 -1
  326. package/dist/client/vinext-next-data.d.ts.map +0 -1
  327. package/dist/client/vinext-next-data.js.map +0 -1
  328. package/dist/cloudflare/index.d.ts.map +0 -1
  329. package/dist/cloudflare/index.js.map +0 -1
  330. package/dist/cloudflare/kv-cache-handler.d.ts.map +0 -1
  331. package/dist/cloudflare/tpr.d.ts.map +0 -1
  332. package/dist/config/config-matchers.d.ts.map +0 -1
  333. package/dist/config/dotenv.d.ts.map +0 -1
  334. package/dist/config/next-config.d.ts.map +0 -1
  335. package/dist/deploy.d.ts.map +0 -1
  336. package/dist/entries/app-browser-entry.d.ts.map +0 -1
  337. package/dist/entries/app-rsc-entry.d.ts.map +0 -1
  338. package/dist/entries/app-ssr-entry.d.ts.map +0 -1
  339. package/dist/entries/pages-client-entry.d.ts.map +0 -1
  340. package/dist/entries/pages-entry-helpers.d.ts.map +0 -1
  341. package/dist/entries/pages-server-entry.d.ts.map +0 -1
  342. package/dist/index.d.ts.map +0 -1
  343. package/dist/init.d.ts.map +0 -1
  344. package/dist/plugins/async-hooks-stub.d.ts.map +0 -1
  345. package/dist/plugins/client-reference-dedup.d.ts.map +0 -1
  346. package/dist/routing/app-router.d.ts.map +0 -1
  347. package/dist/routing/file-matcher.d.ts.map +0 -1
  348. package/dist/routing/pages-router.d.ts.map +0 -1
  349. package/dist/routing/route-trie.d.ts.map +0 -1
  350. package/dist/routing/route-validation.d.ts.map +0 -1
  351. package/dist/routing/utils.d.ts.map +0 -1
  352. package/dist/server/api-handler.d.ts.map +0 -1
  353. package/dist/server/app-router-entry.d.ts.map +0 -1
  354. package/dist/server/dev-module-runner.d.ts.map +0 -1
  355. package/dist/server/dev-origin-check.d.ts.map +0 -1
  356. package/dist/server/dev-server.d.ts.map +0 -1
  357. package/dist/server/html.d.ts.map +0 -1
  358. package/dist/server/image-optimization.d.ts.map +0 -1
  359. package/dist/server/instrumentation.d.ts.map +0 -1
  360. package/dist/server/isr-cache.d.ts.map +0 -1
  361. package/dist/server/metadata-routes.d.ts.map +0 -1
  362. package/dist/server/middleware-codegen.d.ts.map +0 -1
  363. package/dist/server/middleware-request-headers.d.ts.map +0 -1
  364. package/dist/server/middleware.d.ts.map +0 -1
  365. package/dist/server/normalize-path.d.ts.map +0 -1
  366. package/dist/server/pages-i18n.d.ts.map +0 -1
  367. package/dist/server/prod-server.d.ts.map +0 -1
  368. package/dist/server/request-log.d.ts.map +0 -1
  369. package/dist/server/request-pipeline.d.ts.map +0 -1
  370. package/dist/server/worker-utils.d.ts.map +0 -1
  371. package/dist/shims/amp.d.ts.map +0 -1
  372. package/dist/shims/app.d.ts.map +0 -1
  373. package/dist/shims/app.js.map +0 -1
  374. package/dist/shims/cache-runtime.d.ts.map +0 -1
  375. package/dist/shims/cache.d.ts.map +0 -1
  376. package/dist/shims/client-only.d.ts.map +0 -1
  377. package/dist/shims/client-only.js.map +0 -1
  378. package/dist/shims/compat-router.d.ts.map +0 -1
  379. package/dist/shims/config.d.ts.map +0 -1
  380. package/dist/shims/constants.d.ts.map +0 -1
  381. package/dist/shims/document.d.ts.map +0 -1
  382. package/dist/shims/dynamic.d.ts.map +0 -1
  383. package/dist/shims/error-boundary.d.ts.map +0 -1
  384. package/dist/shims/error.d.ts.map +0 -1
  385. package/dist/shims/fetch-cache.d.ts.map +0 -1
  386. package/dist/shims/font-google-base.d.ts.map +0 -1
  387. package/dist/shims/font-google.d.ts.map +0 -1
  388. package/dist/shims/font-google.generated.d.ts.map +0 -1
  389. package/dist/shims/font-google.js.map +0 -1
  390. package/dist/shims/font-local.d.ts.map +0 -1
  391. package/dist/shims/form.d.ts.map +0 -1
  392. package/dist/shims/head-state.d.ts.map +0 -1
  393. package/dist/shims/head.d.ts.map +0 -1
  394. package/dist/shims/headers.d.ts.map +0 -1
  395. package/dist/shims/i18n-context.d.ts.map +0 -1
  396. package/dist/shims/i18n-state.d.ts.map +0 -1
  397. package/dist/shims/image-config.d.ts.map +0 -1
  398. package/dist/shims/image.d.ts.map +0 -1
  399. package/dist/shims/internal/api-utils.d.ts.map +0 -1
  400. package/dist/shims/internal/api-utils.js.map +0 -1
  401. package/dist/shims/internal/app-router-context.d.ts.map +0 -1
  402. package/dist/shims/internal/cookies.d.ts.map +0 -1
  403. package/dist/shims/internal/cookies.js.map +0 -1
  404. package/dist/shims/internal/parse-cookie-header.d.ts.map +0 -1
  405. package/dist/shims/internal/router-context.d.ts.map +0 -1
  406. package/dist/shims/internal/utils.d.ts.map +0 -1
  407. package/dist/shims/internal/work-unit-async-storage.d.ts.map +0 -1
  408. package/dist/shims/layout-segment-context.d.ts.map +0 -1
  409. package/dist/shims/legacy-image.d.ts.map +0 -1
  410. package/dist/shims/link.d.ts.map +0 -1
  411. package/dist/shims/metadata.d.ts.map +0 -1
  412. package/dist/shims/navigation-state.d.ts.map +0 -1
  413. package/dist/shims/navigation.d.ts.map +0 -1
  414. package/dist/shims/og.d.ts.map +0 -1
  415. package/dist/shims/og.js.map +0 -1
  416. package/dist/shims/readonly-url-search-params.d.ts.map +0 -1
  417. package/dist/shims/request-context.d.ts.map +0 -1
  418. package/dist/shims/request-state-types.d.ts.map +0 -1
  419. package/dist/shims/request-state-types.js.map +0 -1
  420. package/dist/shims/router-state.d.ts.map +0 -1
  421. package/dist/shims/router.d.ts.map +0 -1
  422. package/dist/shims/script.d.ts.map +0 -1
  423. package/dist/shims/server-only.d.ts.map +0 -1
  424. package/dist/shims/server-only.js.map +0 -1
  425. package/dist/shims/server.d.ts.map +0 -1
  426. package/dist/shims/unified-request-context.d.ts.map +0 -1
  427. package/dist/shims/url-safety.d.ts.map +0 -1
  428. package/dist/shims/url-utils.d.ts.map +0 -1
  429. package/dist/shims/web-vitals.d.ts.map +0 -1
  430. package/dist/utils/base-path.d.ts.map +0 -1
  431. package/dist/utils/domain-locale.d.ts.map +0 -1
  432. package/dist/utils/hash.d.ts.map +0 -1
  433. package/dist/utils/manifest-paths.d.ts.map +0 -1
  434. package/dist/utils/project.d.ts.map +0 -1
  435. package/dist/utils/query.d.ts.map +0 -1
@@ -1,149 +1,135 @@
1
1
  "use client";
2
+ import React, { Suspense, lazy, useEffect, useState } from "react";
3
+ //#region src/shims/dynamic.ts
2
4
  /**
3
- * next/dynamic shim
4
- *
5
- * SSR-safe dynamic imports. On the server, uses React.lazy + Suspense so that
6
- * renderToReadableStream suspends until the dynamically-imported component is
7
- * available. On the client, also uses React.lazy for code splitting.
8
- *
9
- * Supports:
10
- * - dynamic(() => import('./Component'))
11
- * - dynamic(() => import('./Component'), { loading: () => <Spinner /> })
12
- * - dynamic(() => import('./Component'), { ssr: false })
13
- */
14
- import React, { lazy, Suspense, useState, useEffect } from "react";
5
+ * next/dynamic shim
6
+ *
7
+ * SSR-safe dynamic imports. On the server, uses React.lazy + Suspense so that
8
+ * renderToReadableStream suspends until the dynamically-imported component is
9
+ * available. On the client, also uses React.lazy for code splitting.
10
+ *
11
+ * Supports:
12
+ * - dynamic(() => import('./Component'))
13
+ * - dynamic(() => import('./Component'), { loading: () => <Spinner /> })
14
+ * - dynamic(() => import('./Component'), { ssr: false })
15
+ */
15
16
  /**
16
- * Lightweight error boundary that renders the loading component with the error
17
- * when a dynamic() loader rejects. Without this, loader failures would propagate
18
- * uncaught through React's rendering — this preserves the Next.js behavior where
19
- * the `loading` component can display errors.
20
- *
21
- * Lazily created because React.Component is not available in the RSC environment
22
- * (server components use a slimmed-down React that doesn't include class components).
23
- */
17
+ * Lightweight error boundary that renders the loading component with the error
18
+ * when a dynamic() loader rejects. Without this, loader failures would propagate
19
+ * uncaught through React's rendering — this preserves the Next.js behavior where
20
+ * the `loading` component can display errors.
21
+ *
22
+ * Lazily created because React.Component is not available in the RSC environment
23
+ * (server components use a slimmed-down React that doesn't include class components).
24
+ */
24
25
  let DynamicErrorBoundary;
25
26
  function getDynamicErrorBoundary() {
26
- if (DynamicErrorBoundary)
27
- return DynamicErrorBoundary;
28
- if (!React.Component)
29
- return null;
30
- DynamicErrorBoundary = class extends (React.Component) {
31
- constructor(props) {
32
- super(props);
33
- this.state = { error: null };
34
- }
35
- static getDerivedStateFromError(error) {
36
- return { error: error instanceof Error ? error : new Error(String(error)) };
37
- }
38
- render() {
39
- if (this.state.error) {
40
- return React.createElement(this.props.fallback, {
41
- isLoading: false,
42
- pastDelay: true,
43
- error: this.state.error,
44
- });
45
- }
46
- return this.props.children;
47
- }
48
- };
49
- return DynamicErrorBoundary;
27
+ if (DynamicErrorBoundary) return DynamicErrorBoundary;
28
+ if (!React.Component) return null;
29
+ DynamicErrorBoundary = class extends React.Component {
30
+ constructor(props) {
31
+ super(props);
32
+ this.state = { error: null };
33
+ }
34
+ static getDerivedStateFromError(error) {
35
+ return { error: error instanceof Error ? error : new Error(String(error)) };
36
+ }
37
+ render() {
38
+ if (this.state.error) return React.createElement(this.props.fallback, {
39
+ isLoading: false,
40
+ pastDelay: true,
41
+ error: this.state.error
42
+ });
43
+ return this.props.children;
44
+ }
45
+ };
46
+ return DynamicErrorBoundary;
50
47
  }
51
- // Detect server vs client
52
48
  const isServer = typeof window === "undefined";
53
- // Legacy preload queue — kept for backward compatibility with Pages Router
54
- // which calls flushPreloads() before rendering. The App Router uses React.lazy
55
- // + Suspense instead, so this queue is no longer populated.
56
49
  const preloadQueue = [];
57
50
  /**
58
- * Wait for all pending dynamic() preloads to resolve, then clear the queue.
59
- * Called by the Pages Router SSR handler before rendering.
60
- * No-op for the App Router path which uses React.lazy + Suspense.
61
- */
62
- export function flushPreloads() {
63
- const pending = preloadQueue.splice(0);
64
- return Promise.all(pending);
51
+ * Wait for all pending dynamic() preloads to resolve, then clear the queue.
52
+ * Called by the Pages Router SSR handler before rendering.
53
+ * No-op for the App Router path which uses React.lazy + Suspense.
54
+ */
55
+ function flushPreloads() {
56
+ const pending = preloadQueue.splice(0);
57
+ return Promise.all(pending);
65
58
  }
66
59
  function dynamic(loader, options) {
67
- const { loading: LoadingComponent, ssr = true } = options ?? {};
68
- // ssr: false — render nothing on the server, lazy-load on client
69
- if (!ssr) {
70
- if (isServer) {
71
- // On the server, just render the loading state or nothing
72
- const SSRFalse = (_props) => {
73
- return LoadingComponent
74
- ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })
75
- : null;
76
- };
77
- SSRFalse.displayName = "DynamicSSRFalse";
78
- return SSRFalse;
79
- }
80
- // Client: use lazy with Suspense
81
- const LazyComponent = lazy(async () => {
82
- const mod = await loader();
83
- if ("default" in mod)
84
- return mod;
85
- return { default: mod };
86
- });
87
- const ClientSSRFalse = (props) => {
88
- const [mounted, setMounted] = useState(false);
89
- useEffect(() => setMounted(true), []);
90
- if (!mounted) {
91
- return LoadingComponent
92
- ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })
93
- : null;
94
- }
95
- const fallback = LoadingComponent
96
- ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })
97
- : null;
98
- return React.createElement(Suspense, { fallback }, React.createElement(LazyComponent, props));
99
- };
100
- ClientSSRFalse.displayName = "DynamicClientSSRFalse";
101
- return ClientSSRFalse;
102
- }
103
- // SSR-enabled path
104
- if (isServer) {
105
- // Use React.lazy so that renderToReadableStream can suspend until the
106
- // dynamically-imported component is available. The previous eager-load
107
- // pattern relied on flushPreloads() being called before rendering, which
108
- // works for the Pages Router but not the App Router where client modules
109
- // are loaded lazily during RSC stream deserialization (issue #75).
110
- const LazyServer = lazy(async () => {
111
- const mod = await loader();
112
- if ("default" in mod)
113
- return mod;
114
- return { default: mod };
115
- });
116
- const ServerDynamic = (props) => {
117
- const fallback = LoadingComponent
118
- ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })
119
- : null;
120
- const lazyElement = React.createElement(LazyServer, props);
121
- // Wrap with error boundary so loader rejections render the loading
122
- // component with the error instead of propagating uncaught.
123
- const ErrorBoundary = LoadingComponent ? getDynamicErrorBoundary() : null;
124
- const content = ErrorBoundary
125
- ? React.createElement(ErrorBoundary, { fallback: LoadingComponent }, lazyElement)
126
- : lazyElement;
127
- return React.createElement(Suspense, { fallback }, content);
128
- };
129
- ServerDynamic.displayName = "DynamicServer";
130
- return ServerDynamic;
131
- }
132
- // Client path: standard React.lazy with Suspense
133
- const LazyComponent = lazy(async () => {
134
- const mod = await loader();
135
- if ("default" in mod)
136
- return mod;
137
- return { default: mod };
138
- });
139
- const ClientDynamic = (props) => {
140
- const fallback = LoadingComponent
141
- ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })
142
- : null;
143
- return React.createElement(Suspense, { fallback }, React.createElement(LazyComponent, props));
144
- };
145
- ClientDynamic.displayName = "DynamicClient";
146
- return ClientDynamic;
60
+ const { loading: LoadingComponent, ssr = true } = options ?? {};
61
+ if (!ssr) {
62
+ if (isServer) {
63
+ const SSRFalse = (_props) => {
64
+ return LoadingComponent ? React.createElement(LoadingComponent, {
65
+ isLoading: true,
66
+ pastDelay: true,
67
+ error: null
68
+ }) : null;
69
+ };
70
+ SSRFalse.displayName = "DynamicSSRFalse";
71
+ return SSRFalse;
72
+ }
73
+ const LazyComponent = lazy(async () => {
74
+ const mod = await loader();
75
+ if ("default" in mod) return mod;
76
+ return { default: mod };
77
+ });
78
+ const ClientSSRFalse = (props) => {
79
+ const [mounted, setMounted] = useState(false);
80
+ useEffect(() => setMounted(true), []);
81
+ if (!mounted) return LoadingComponent ? React.createElement(LoadingComponent, {
82
+ isLoading: true,
83
+ pastDelay: true,
84
+ error: null
85
+ }) : null;
86
+ const fallback = LoadingComponent ? React.createElement(LoadingComponent, {
87
+ isLoading: true,
88
+ pastDelay: true,
89
+ error: null
90
+ }) : null;
91
+ return React.createElement(Suspense, { fallback }, React.createElement(LazyComponent, props));
92
+ };
93
+ ClientSSRFalse.displayName = "DynamicClientSSRFalse";
94
+ return ClientSSRFalse;
95
+ }
96
+ if (isServer) {
97
+ const LazyServer = lazy(async () => {
98
+ const mod = await loader();
99
+ if ("default" in mod) return mod;
100
+ return { default: mod };
101
+ });
102
+ const ServerDynamic = (props) => {
103
+ const fallback = LoadingComponent ? React.createElement(LoadingComponent, {
104
+ isLoading: true,
105
+ pastDelay: true,
106
+ error: null
107
+ }) : null;
108
+ const lazyElement = React.createElement(LazyServer, props);
109
+ const ErrorBoundary = LoadingComponent ? getDynamicErrorBoundary() : null;
110
+ const content = ErrorBoundary ? React.createElement(ErrorBoundary, { fallback: LoadingComponent }, lazyElement) : lazyElement;
111
+ return React.createElement(Suspense, { fallback }, content);
112
+ };
113
+ ServerDynamic.displayName = "DynamicServer";
114
+ return ServerDynamic;
115
+ }
116
+ const LazyComponent = lazy(async () => {
117
+ const mod = await loader();
118
+ if ("default" in mod) return mod;
119
+ return { default: mod };
120
+ });
121
+ const ClientDynamic = (props) => {
122
+ const fallback = LoadingComponent ? React.createElement(LoadingComponent, {
123
+ isLoading: true,
124
+ pastDelay: true,
125
+ error: null
126
+ }) : null;
127
+ return React.createElement(Suspense, { fallback }, React.createElement(LazyComponent, props));
128
+ };
129
+ ClientDynamic.displayName = "DynamicClient";
130
+ return ClientDynamic;
147
131
  }
148
- export default dynamic;
132
+ //#endregion
133
+ export { dynamic as default, flushPreloads };
134
+
149
135
  //# sourceMappingURL=dynamic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic.js","sourceRoot":"","sources":["../../src/shims/dynamic.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAsB,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASvF;;;;;;;;GAQG;AACH,IAAI,oBAAyB,CAAC;AAC9B,SAAS,uBAAuB;IAC9B,IAAI,oBAAoB;QAAE,OAAO,oBAAoB,CAAC;IACtD,IAAI,CAAC,KAAK,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAClC,oBAAoB,GAAG,KAAM,SAAQ,CACnC,KAAK,CAAC,SAML,CACF;QACC,YAAY,KAAU;YACpB,KAAK,CAAC,KAAK,CAAC,CAAC;YACb,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAC/B,CAAC;QACD,MAAM,CAAC,wBAAwB,CAAC,KAAc;YAC5C,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,C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IAED,iDAAiD;IACjD,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;QACpC,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE,CAAC;QAC3B,IAAI,SAAS,IAAI,GAAG;YAAE,OAAO,GAAoC,CAAC;QAClE,OAAO,EAAE,OAAO,EAAE,GAAuB,EAAE,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,CAAC,KAAQ,EAAE,EAAE;QACjC,MAAM,QAAQ,GAAG,gBAAgB;YAC/B,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YAC1F,CAAC,CAAC,IAAI,CAAC;QACT,OAAO,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;IAChG,CAAC,CAAC;IAEF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC;IAC5C,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,eAAe,OAAO,CAAC","sourcesContent":["\"use client\";\n/**\n * next/dynamic shim\n *\n * SSR-safe dynamic imports. On the server, uses React.lazy + Suspense so that\n * renderToReadableStream suspends until the dynamically-imported component is\n * available. On the client, also uses React.lazy for code splitting.\n *\n * Supports:\n * - dynamic(() => import('./Component'))\n * - dynamic(() => import('./Component'), { loading: () => <Spinner /> })\n * - dynamic(() => import('./Component'), { ssr: false })\n */\nimport React, { lazy, Suspense, type ComponentType, useState, useEffect } from \"react\";\n\ninterface DynamicOptions {\n loading?: ComponentType<{ error?: Error | null; isLoading?: boolean; pastDelay?: boolean }>;\n ssr?: boolean;\n}\n\ntype Loader<P> = () => Promise<{ default: ComponentType<P> } | ComponentType<P>>;\n\n/**\n * Lightweight error boundary that renders the loading component with the error\n * when a dynamic() loader rejects. Without this, loader failures would propagate\n * uncaught through React's rendering — this preserves the Next.js behavior where\n * the `loading` component can display errors.\n *\n * Lazily created because React.Component is not available in the RSC environment\n * (server components use a slimmed-down React that doesn't include class components).\n */\nlet DynamicErrorBoundary: any;\nfunction getDynamicErrorBoundary() {\n if (DynamicErrorBoundary) return DynamicErrorBoundary;\n if (!React.Component) return null;\n DynamicErrorBoundary = class extends (\n React.Component<\n {\n fallback: ComponentType<{ error?: Error | null; isLoading?: boolean; pastDelay?: boolean }>;\n children: React.ReactNode;\n },\n { error: Error | null }\n >\n ) {\n constructor(props: any) {\n super(props);\n this.state = { error: null };\n }\n static getDerivedStateFromError(error: unknown) {\n return { error: error instanceof Error ? error : new Error(String(error)) };\n }\n render() {\n if (this.state.error) {\n return React.createElement(this.props.fallback, {\n isLoading: false,\n pastDelay: true,\n error: this.state.error,\n });\n }\n return this.props.children;\n }\n };\n return DynamicErrorBoundary;\n}\n\n// Detect server vs client\nconst isServer = typeof window === \"undefined\";\n\n// Legacy preload queue — kept for backward compatibility with Pages Router\n// which calls flushPreloads() before rendering. The App Router uses React.lazy\n// + Suspense instead, so this queue is no longer populated.\nconst preloadQueue: Promise<void>[] = [];\n\n/**\n * Wait for all pending dynamic() preloads to resolve, then clear the queue.\n * Called by the Pages Router SSR handler before rendering.\n * No-op for the App Router path which uses React.lazy + Suspense.\n */\nexport function flushPreloads(): Promise<void[]> {\n const pending = preloadQueue.splice(0);\n return Promise.all(pending);\n}\n\nfunction dynamic<P extends object = object>(\n loader: Loader<P>,\n options?: DynamicOptions,\n): ComponentType<P> {\n const { loading: LoadingComponent, ssr = true } = options ?? {};\n\n // ssr: false — render nothing on the server, lazy-load on client\n if (!ssr) {\n if (isServer) {\n // On the server, just render the loading state or nothing\n const SSRFalse = (_props: P) => {\n return LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n };\n SSRFalse.displayName = \"DynamicSSRFalse\";\n return SSRFalse;\n }\n\n // Client: use lazy with Suspense\n const LazyComponent = lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ClientSSRFalse = (props: P) => {\n const [mounted, setMounted] = useState(false);\n useEffect(() => setMounted(true), []);\n\n if (!mounted) {\n return LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n }\n\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n return React.createElement(Suspense, { fallback }, React.createElement(LazyComponent, props));\n };\n\n ClientSSRFalse.displayName = \"DynamicClientSSRFalse\";\n return ClientSSRFalse;\n }\n\n // SSR-enabled path\n if (isServer) {\n // Use React.lazy so that renderToReadableStream can suspend until the\n // dynamically-imported component is available. The previous eager-load\n // pattern relied on flushPreloads() being called before rendering, which\n // works for the Pages Router but not the App Router where client modules\n // are loaded lazily during RSC stream deserialization (issue #75).\n const LazyServer = lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ServerDynamic = (props: P) => {\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n const lazyElement = React.createElement(LazyServer, props);\n // Wrap with error boundary so loader rejections render the loading\n // component with the error instead of propagating uncaught.\n const ErrorBoundary = LoadingComponent ? getDynamicErrorBoundary() : null;\n const content = ErrorBoundary\n ? React.createElement(ErrorBoundary, { fallback: LoadingComponent }, lazyElement)\n : lazyElement;\n return React.createElement(Suspense, { fallback }, content);\n };\n\n ServerDynamic.displayName = \"DynamicServer\";\n return ServerDynamic;\n }\n\n // Client path: standard React.lazy with Suspense\n const LazyComponent = lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ClientDynamic = (props: P) => {\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n return React.createElement(Suspense, { fallback }, React.createElement(LazyComponent, props));\n };\n\n ClientDynamic.displayName = \"DynamicClient\";\n return ClientDynamic;\n}\n\nexport default dynamic;\n"]}
1
+ {"version":3,"file":"dynamic.js","names":[],"sources":["../../src/shims/dynamic.ts"],"sourcesContent":["\"use client\";\n/**\n * next/dynamic shim\n *\n * SSR-safe dynamic imports. On the server, uses React.lazy + Suspense so that\n * renderToReadableStream suspends until the dynamically-imported component is\n * available. On the client, also uses React.lazy for code splitting.\n *\n * Supports:\n * - dynamic(() => import('./Component'))\n * - dynamic(() => import('./Component'), { loading: () => <Spinner /> })\n * - dynamic(() => import('./Component'), { ssr: false })\n */\nimport React, { lazy, Suspense, type ComponentType, useState, useEffect } from \"react\";\n\ninterface DynamicOptions {\n loading?: ComponentType<{ error?: Error | null; isLoading?: boolean; pastDelay?: boolean }>;\n ssr?: boolean;\n}\n\ntype Loader<P> = () => Promise<{ default: ComponentType<P> } | ComponentType<P>>;\n\n/**\n * Lightweight error boundary that renders the loading component with the error\n * when a dynamic() loader rejects. Without this, loader failures would propagate\n * uncaught through React's rendering — this preserves the Next.js behavior where\n * the `loading` component can display errors.\n *\n * Lazily created because React.Component is not available in the RSC environment\n * (server components use a slimmed-down React that doesn't include class components).\n */\nlet DynamicErrorBoundary: any;\nfunction getDynamicErrorBoundary() {\n if (DynamicErrorBoundary) return DynamicErrorBoundary;\n if (!React.Component) return null;\n DynamicErrorBoundary = class extends (\n React.Component<\n {\n fallback: ComponentType<{ error?: Error | null; isLoading?: boolean; pastDelay?: boolean }>;\n children: React.ReactNode;\n },\n { error: Error | null }\n >\n ) {\n constructor(props: any) {\n super(props);\n this.state = { error: null };\n }\n static getDerivedStateFromError(error: unknown) {\n return { error: error instanceof Error ? error : new Error(String(error)) };\n }\n render() {\n if (this.state.error) {\n return React.createElement(this.props.fallback, {\n isLoading: false,\n pastDelay: true,\n error: this.state.error,\n });\n }\n return this.props.children;\n }\n };\n return DynamicErrorBoundary;\n}\n\n// Detect server vs client\nconst isServer = typeof window === \"undefined\";\n\n// Legacy preload queue — kept for backward compatibility with Pages Router\n// which calls flushPreloads() before rendering. The App Router uses React.lazy\n// + Suspense instead, so this queue is no longer populated.\nconst preloadQueue: Promise<void>[] = [];\n\n/**\n * Wait for all pending dynamic() preloads to resolve, then clear the queue.\n * Called by the Pages Router SSR handler before rendering.\n * No-op for the App Router path which uses React.lazy + Suspense.\n */\nexport function flushPreloads(): Promise<void[]> {\n const pending = preloadQueue.splice(0);\n return Promise.all(pending);\n}\n\nfunction dynamic<P extends object = object>(\n loader: Loader<P>,\n options?: DynamicOptions,\n): ComponentType<P> {\n const { loading: LoadingComponent, ssr = true } = options ?? {};\n\n // ssr: false — render nothing on the server, lazy-load on client\n if (!ssr) {\n if (isServer) {\n // On the server, just render the loading state or nothing\n const SSRFalse = (_props: P) => {\n return LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n };\n SSRFalse.displayName = \"DynamicSSRFalse\";\n return SSRFalse;\n }\n\n // Client: use lazy with Suspense\n const LazyComponent = lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ClientSSRFalse = (props: P) => {\n const [mounted, setMounted] = useState(false);\n useEffect(() => setMounted(true), []);\n\n if (!mounted) {\n return LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n }\n\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n return React.createElement(Suspense, { fallback }, React.createElement(LazyComponent, props));\n };\n\n ClientSSRFalse.displayName = \"DynamicClientSSRFalse\";\n return ClientSSRFalse;\n }\n\n // SSR-enabled path\n if (isServer) {\n // Use React.lazy so that renderToReadableStream can suspend until the\n // dynamically-imported component is available. The previous eager-load\n // pattern relied on flushPreloads() being called before rendering, which\n // works for the Pages Router but not the App Router where client modules\n // are loaded lazily during RSC stream deserialization (issue #75).\n const LazyServer = lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ServerDynamic = (props: P) => {\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n const lazyElement = React.createElement(LazyServer, props);\n // Wrap with error boundary so loader rejections render the loading\n // component with the error instead of propagating uncaught.\n const ErrorBoundary = LoadingComponent ? getDynamicErrorBoundary() : null;\n const content = ErrorBoundary\n ? React.createElement(ErrorBoundary, { fallback: LoadingComponent }, lazyElement)\n : lazyElement;\n return React.createElement(Suspense, { fallback }, content);\n };\n\n ServerDynamic.displayName = \"DynamicServer\";\n return ServerDynamic;\n }\n\n // Client path: standard React.lazy with Suspense\n const LazyComponent = lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ClientDynamic = (props: P) => {\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n return React.createElement(Suspense, { fallback }, React.createElement(LazyComponent, props));\n };\n\n ClientDynamic.displayName = \"DynamicClient\";\n return ClientDynamic;\n}\n\nexport default dynamic;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAI;AACJ,SAAS,0BAA0B;AACjC,KAAI,qBAAsB,QAAO;AACjC,KAAI,CAAC,MAAM,UAAW,QAAO;AAC7B,wBAAuB,cACrB,MAAM,UAON;EACA,YAAY,OAAY;AACtB,SAAM,MAAM;AACZ,QAAK,QAAQ,EAAE,OAAO,MAAM;;EAE9B,OAAO,yBAAyB,OAAgB;AAC9C,UAAO,EAAE,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,EAAE;;EAE7E,SAAS;AACP,OAAI,KAAK,MAAM,MAC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B,OAAI,aAAa,IAAK,QAAO;AAC7B,UAAO,EAAE,SAAS,KAAyB;IAC3C;EAEF,MAAM,iBAAiB,UAAa;GAClC,MAAM,WAAW,mBACb,MAAM,cAAc,kBAAkB;IAAE,WAAW;IAAM,WAAW;IAAM,OAAO;IAAM,CAAC,GACxF;GACJ,MAAM,cAAc,MAAM,cAAc,YAAY,MAAM;GAG1D,MAAM,gBAAgB,mBAAmB,yBAAyB,GAAG;GACrE,MAAM,UAAU,gBACZ,MAAM,cAAc,eAAe,EAAE,UAAU,kBAAkB,EAAE,YAAY,GAC/E;AACJ,UAAO,MAAM,cAAc,UAAU,EAAE,UAAU,EAAE,QAAQ;;AAG7D,gBAAc,cAAc;AAC5B,SAAO;;CAIT,MAAM,gBAAgB,KAAK,YAAY;EACrC,MAAM,MAAM,MAAM,QAAQ;AAC1B,MAAI,aAAa,IAAK,QAAO;AAC7B,SAAO,EAAE,SAAS,KAAyB;GAC3C;CAEF,MAAM,iBAAiB,UAAa;EAClC,MAAM,WAAW,mBACb,MAAM,cAAc,kBAAkB;GAAE,WAAW;GAAM,WAAW;GAAM,OAAO;GAAM,CAAC,GACxF;AACJ,SAAO,MAAM,cAAc,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,eAAe,MAAM,CAAC;;AAG/F,eAAc,cAAc;AAC5B,QAAO"}
@@ -1,33 +1,40 @@
1
1
  import React from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/shims/error-boundary.d.ts
2
5
  interface ErrorBoundaryProps {
3
- fallback: React.ComponentType<{
4
- error: Error;
5
- reset: () => void;
6
- }>;
7
- children: React.ReactNode;
6
+ fallback: React.ComponentType<{
7
+ error: Error;
8
+ reset: () => void;
9
+ }>;
10
+ children: React.ReactNode;
8
11
  }
9
12
  interface ErrorBoundaryState {
10
- error: Error | null;
13
+ error: Error | null;
11
14
  }
12
15
  /**
13
16
  * Generic ErrorBoundary used to wrap route segments with error.tsx.
14
17
  * This must be a client component since error boundaries use
15
18
  * componentDidCatch / getDerivedStateFromError.
16
19
  */
17
- export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
18
- constructor(props: ErrorBoundaryProps);
19
- static getDerivedStateFromError(error: Error): ErrorBoundaryState;
20
- reset: () => void;
21
- 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> | import("react/jsx-runtime").JSX.Element | null | undefined;
20
+ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
21
+ constructor(props: ErrorBoundaryProps);
22
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
23
+ reset: () => void;
24
+ 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;
22
25
  }
23
26
  interface NotFoundBoundaryProps {
24
- fallback: React.ReactNode;
25
- children: React.ReactNode;
27
+ fallback: React.ReactNode;
28
+ children: React.ReactNode;
26
29
  }
27
30
  /**
28
31
  * Wrapper that reads the current pathname and passes it to the inner class
29
32
  * component. This enables automatic reset on client-side navigation.
30
33
  */
31
- export declare function NotFoundBoundary({ fallback, children }: NotFoundBoundaryProps): import("react/jsx-runtime").JSX.Element;
32
- export {};
34
+ declare function NotFoundBoundary({
35
+ fallback,
36
+ children
37
+ }: NotFoundBoundaryProps): react_jsx_runtime0.JSX.Element;
38
+ //#endregion
39
+ export { ErrorBoundary, NotFoundBoundary };
33
40
  //# sourceMappingURL=error-boundary.d.ts.map
@@ -1,87 +1,89 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import React from "react";
4
- // eslint-disable-next-line @typescript-eslint/no-require-imports -- next/navigation is shimmed
3
+ import { jsx } from "react/jsx-runtime";
5
4
  import { usePathname } from "next/navigation";
5
+ //#region src/shims/error-boundary.tsx
6
6
  /**
7
- * Generic ErrorBoundary used to wrap route segments with error.tsx.
8
- * This must be a client component since error boundaries use
9
- * componentDidCatch / getDerivedStateFromError.
10
- */
11
- export class ErrorBoundary extends React.Component {
12
- constructor(props) {
13
- super(props);
14
- this.state = { error: null };
15
- }
16
- static getDerivedStateFromError(error) {
17
- // notFound(), forbidden(), unauthorized(), and redirect() must propagate
18
- // past error boundaries. Re-throw them so they bubble up to the
19
- // framework's HTTP access fallback / redirect handler.
20
- if (error && typeof error === "object" && "digest" in error) {
21
- const digest = String(error.digest);
22
- if (digest === "NEXT_NOT_FOUND" || // legacy compat
23
- digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;") ||
24
- digest.startsWith("NEXT_REDIRECT;")) {
25
- throw error;
26
- }
27
- }
28
- return { error };
29
- }
30
- reset = () => {
31
- this.setState({ error: null });
32
- };
33
- render() {
34
- if (this.state.error) {
35
- const FallbackComponent = this.props.fallback;
36
- return _jsx(FallbackComponent, { error: this.state.error, reset: this.reset });
37
- }
38
- return this.props.children;
39
- }
40
- }
7
+ * Generic ErrorBoundary used to wrap route segments with error.tsx.
8
+ * This must be a client component since error boundaries use
9
+ * componentDidCatch / getDerivedStateFromError.
10
+ */
11
+ var ErrorBoundary = class extends React.Component {
12
+ constructor(props) {
13
+ super(props);
14
+ this.state = { error: null };
15
+ }
16
+ static getDerivedStateFromError(error) {
17
+ if (error && typeof error === "object" && "digest" in error) {
18
+ const digest = String(error.digest);
19
+ if (digest === "NEXT_NOT_FOUND" || digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;") || digest.startsWith("NEXT_REDIRECT;")) throw error;
20
+ }
21
+ return { error };
22
+ }
23
+ reset = () => {
24
+ this.setState({ error: null });
25
+ };
26
+ render() {
27
+ if (this.state.error) {
28
+ const FallbackComponent = this.props.fallback;
29
+ return /* @__PURE__ */ jsx(FallbackComponent, {
30
+ error: this.state.error,
31
+ reset: this.reset
32
+ });
33
+ }
34
+ return this.props.children;
35
+ }
36
+ };
41
37
  /**
42
- * Inner class component that catches notFound() errors and renders the
43
- * not-found.tsx fallback. Resets when the pathname changes (client navigation)
44
- * so a previous notFound() doesn't permanently stick.
45
- *
46
- * The ErrorBoundary above re-throws notFound errors so they propagate up to this
47
- * boundary. This must be placed above the ErrorBoundary in the component tree.
48
- */
49
- class NotFoundBoundaryInner extends React.Component {
50
- constructor(props) {
51
- super(props);
52
- this.state = { notFound: false, previousPathname: props.pathname };
53
- }
54
- static getDerivedStateFromProps(props, state) {
55
- // Reset the boundary when the route changes so a previous notFound()
56
- // doesn't permanently stick after client-side navigation.
57
- if (props.pathname !== state.previousPathname && state.notFound) {
58
- return { notFound: false, previousPathname: props.pathname };
59
- }
60
- return { notFound: state.notFound, previousPathname: props.pathname };
61
- }
62
- static getDerivedStateFromError(error) {
63
- if (error && typeof error === "object" && "digest" in error) {
64
- const digest = String(error.digest);
65
- if (digest === "NEXT_NOT_FOUND" || digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;404")) {
66
- return { notFound: true };
67
- }
68
- }
69
- // Not a notFound error — re-throw so it reaches an ErrorBoundary or propagates
70
- throw error;
71
- }
72
- render() {
73
- if (this.state.notFound) {
74
- return this.props.fallback;
75
- }
76
- return this.props.children;
77
- }
78
- }
38
+ * Inner class component that catches notFound() errors and renders the
39
+ * not-found.tsx fallback. Resets when the pathname changes (client navigation)
40
+ * so a previous notFound() doesn't permanently stick.
41
+ *
42
+ * The ErrorBoundary above re-throws notFound errors so they propagate up to this
43
+ * boundary. This must be placed above the ErrorBoundary in the component tree.
44
+ */
45
+ var NotFoundBoundaryInner = class extends React.Component {
46
+ constructor(props) {
47
+ super(props);
48
+ this.state = {
49
+ notFound: false,
50
+ previousPathname: props.pathname
51
+ };
52
+ }
53
+ static getDerivedStateFromProps(props, state) {
54
+ if (props.pathname !== state.previousPathname && state.notFound) return {
55
+ notFound: false,
56
+ previousPathname: props.pathname
57
+ };
58
+ return {
59
+ notFound: state.notFound,
60
+ previousPathname: props.pathname
61
+ };
62
+ }
63
+ static getDerivedStateFromError(error) {
64
+ if (error && typeof error === "object" && "digest" in error) {
65
+ const digest = String(error.digest);
66
+ if (digest === "NEXT_NOT_FOUND" || digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;404")) return { notFound: true };
67
+ }
68
+ throw error;
69
+ }
70
+ render() {
71
+ if (this.state.notFound) return this.props.fallback;
72
+ return this.props.children;
73
+ }
74
+ };
79
75
  /**
80
- * Wrapper that reads the current pathname and passes it to the inner class
81
- * component. This enables automatic reset on client-side navigation.
82
- */
83
- export function NotFoundBoundary({ fallback, children }) {
84
- const pathname = usePathname();
85
- return (_jsx(NotFoundBoundaryInner, { pathname: pathname, fallback: fallback, children: children }));
76
+ * Wrapper that reads the current pathname and passes it to the inner class
77
+ * component. This enables automatic reset on client-side navigation.
78
+ */
79
+ function NotFoundBoundary({ fallback, children }) {
80
+ return /* @__PURE__ */ jsx(NotFoundBoundaryInner, {
81
+ pathname: usePathname(),
82
+ fallback,
83
+ children
84
+ });
86
85
  }
86
+ //#endregion
87
+ export { ErrorBoundary, NotFoundBoundary };
88
+
87
89
  //# sourceMappingURL=error-boundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-boundary.js","sourceRoot":"","sources":["../../src/shims/error-boundary.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,+FAA+F;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAW9C;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAiD;IACxF,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,yEAAyE;Q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,KAAK,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/D,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YAC5D,MAAM,MAAM,GAAG,MAAM,CAAE,KAAa,CAAC,MAAM,CAAC,CAAC;YAC7C,IAAI,MAAM,KAAK,gBAAgB,IAAI,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,EAAE,CAAC;gBACrF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC5B,CAAC;QACH,CAAC;QACD,+EAA+E;QAC/E,MAAM,KAAK,CAAC;IACd,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAyB;IAC5E,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,OAAO,CACL,KAAC,qBAAqB,IAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,YAC1D,QAAQ,GACa,CACzB,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport React from \"react\";\n// eslint-disable-next-line @typescript-eslint/no-require-imports -- next/navigation is shimmed\nimport { usePathname } from \"next/navigation\";\n\ninterface ErrorBoundaryProps {\n fallback: React.ComponentType<{ error: Error; reset: () => void }>;\n children: React.ReactNode;\n}\n\ninterface ErrorBoundaryState {\n error: Error | null;\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 ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { error: null };\n }\n\n static getDerivedStateFromError(error: Error): 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 as any).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\n// ---------------------------------------------------------------------------\n// NotFoundBoundary — catches notFound() on the client and renders not-found.tsx\n// ---------------------------------------------------------------------------\n\ninterface NotFoundBoundaryProps {\n fallback: React.ReactNode;\n children: React.ReactNode;\n}\n\ninterface NotFoundBoundaryInnerProps extends NotFoundBoundaryProps {\n pathname: string;\n}\n\ninterface 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 as any).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}>\n {children}\n </NotFoundBoundaryInner>\n );\n}\n"]}
1
+ {"version":3,"file":"error-boundary.js","names":[],"sources":["../../src/shims/error-boundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n// eslint-disable-next-line @typescript-eslint/no-require-imports -- next/navigation is shimmed\nimport { usePathname } from \"next/navigation\";\n\ninterface ErrorBoundaryProps {\n fallback: React.ComponentType<{ error: Error; reset: () => void }>;\n children: React.ReactNode;\n}\n\ninterface ErrorBoundaryState {\n error: Error | null;\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 ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { error: null };\n }\n\n static getDerivedStateFromError(error: Error): 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 as any).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\n// ---------------------------------------------------------------------------\n// NotFoundBoundary — catches notFound() on the client and renders not-found.tsx\n// ---------------------------------------------------------------------------\n\ninterface NotFoundBoundaryProps {\n fallback: React.ReactNode;\n children: React.ReactNode;\n}\n\ninterface NotFoundBoundaryInnerProps extends NotFoundBoundaryProps {\n pathname: string;\n}\n\ninterface 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 as any).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}>\n {children}\n </NotFoundBoundaryInner>\n );\n}\n"],"mappings":";;;;;;;;;;AAoBA,IAAa,gBAAb,cAAmC,MAAM,UAAkD;CACzF,YAAY,OAA2B;AACrC,QAAM,MAAM;AACZ,OAAK,QAAQ,EAAE,OAAO,MAAM;;CAG9B,OAAO,yBAAyB,OAAkC;AAIhE,MAAI,SAAS,OAAO,UAAU,YAAY,YAAY,OAAO;GAC3D,MAAM,SAAS,OAAQ,MAAc,OAAO;AAC5C,OACE,WAAW,oBACX,OAAO,WAAW,4BAA4B,IAC9C,OAAO,WAAW,iBAAiB,CAEnC,OAAM;;AAGV,SAAO,EAAE,OAAO;;CAGlB,cAAc;AACZ,OAAK,SAAS,EAAE,OAAO,MAAM,CAAC;;CAGhC,SAAS;AACP,MAAI,KAAK,MAAM,OAAO;GACpB,MAAM,oBAAoB,KAAK,MAAM;AACrC,UAAO,oBAAC,mBAAD;IAAmB,OAAO,KAAK,MAAM;IAAO,OAAO,KAAK;IAAS,CAAA;;AAE1E,SAAO,KAAK,MAAM;;;;;;;;;;;AA8BtB,IAAM,wBAAN,cAAoC,MAAM,UAGxC;CACA,YAAY,OAAmC;AAC7C,QAAM,MAAM;AACZ,OAAK,QAAQ;GAAE,UAAU;GAAO,kBAAkB,MAAM;GAAU;;CAGpE,OAAO,yBACL,OACA,OAC8B;AAG9B,MAAI,MAAM,aAAa,MAAM,oBAAoB,MAAM,SACrD,QAAO;GAAE,UAAU;GAAO,kBAAkB,MAAM;GAAU;AAE9D,SAAO;GAAE,UAAU,MAAM;GAAU,kBAAkB,MAAM;GAAU;;CAGvE,OAAO,yBAAyB,OAA8C;AAC5E,MAAI,SAAS,OAAO,UAAU,YAAY,YAAY,OAAO;GAC3D,MAAM,SAAS,OAAQ,MAAc,OAAO;AAC5C,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,16 +1,15 @@
1
- /**
2
- * next/error shim
3
- *
4
- * Provides the default Next.js error page component.
5
- * Used by apps that import `import Error from 'next/error'` for
6
- * custom error handling in getServerSideProps or API routes.
7
- */
8
1
  import React from "react";
2
+
3
+ //#region src/shims/error.d.ts
9
4
  interface ErrorProps {
10
- statusCode: number;
11
- title?: string;
12
- withDarkMode?: boolean;
5
+ statusCode: number;
6
+ title?: string;
7
+ withDarkMode?: boolean;
13
8
  }
14
- declare function ErrorComponent({ statusCode, title }: ErrorProps): React.ReactElement;
15
- export default ErrorComponent;
9
+ declare function ErrorComponent({
10
+ statusCode,
11
+ title
12
+ }: ErrorProps): React.ReactElement;
13
+ //#endregion
14
+ export { ErrorComponent as default };
16
15
  //# sourceMappingURL=error.d.ts.map