vinext 0.0.49 → 0.0.50

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 (390) hide show
  1. package/dist/build/client-build-config.js.map +1 -1
  2. package/dist/build/google-fonts/build-url.js.map +1 -1
  3. package/dist/build/google-fonts/get-axes.js.map +1 -1
  4. package/dist/build/google-fonts/sort-variants.js.map +1 -1
  5. package/dist/build/google-fonts/validate.js.map +1 -1
  6. package/dist/build/layout-classification.js.map +1 -1
  7. package/dist/build/nitro-route-rules.js.map +1 -1
  8. package/dist/build/precompress.js.map +1 -1
  9. package/dist/build/prerender.d.ts +17 -1
  10. package/dist/build/prerender.js +77 -16
  11. package/dist/build/prerender.js.map +1 -1
  12. package/dist/build/report.js.map +1 -1
  13. package/dist/build/route-classification-injector.js.map +1 -1
  14. package/dist/build/route-classification-manifest.js.map +1 -1
  15. package/dist/build/run-prerender.js.map +1 -1
  16. package/dist/build/server-manifest.js.map +1 -1
  17. package/dist/build/ssr-manifest.js.map +1 -1
  18. package/dist/build/standalone.js.map +1 -1
  19. package/dist/build/static-export.js.map +1 -1
  20. package/dist/check.js +1 -1
  21. package/dist/check.js.map +1 -1
  22. package/dist/cli-args.js.map +1 -1
  23. package/dist/cli.js +8 -4
  24. package/dist/cli.js.map +1 -1
  25. package/dist/client/instrumentation-client-state.js.map +1 -1
  26. package/dist/client/validate-module-path.js.map +1 -1
  27. package/dist/client/vinext-next-data.d.ts +5 -1
  28. package/dist/client/window-next.d.ts +149 -0
  29. package/dist/client/window-next.js +48 -0
  30. package/dist/client/window-next.js.map +1 -0
  31. package/dist/cloudflare/kv-cache-handler.js.map +1 -1
  32. package/dist/cloudflare/tpr.js +2 -1
  33. package/dist/cloudflare/tpr.js.map +1 -1
  34. package/dist/config/config-matchers.d.ts +3 -1
  35. package/dist/config/config-matchers.js +5 -4
  36. package/dist/config/config-matchers.js.map +1 -1
  37. package/dist/config/dotenv.js.map +1 -1
  38. package/dist/config/next-config.d.ts +6 -3
  39. package/dist/config/next-config.js +13 -2
  40. package/dist/config/next-config.js.map +1 -1
  41. package/dist/deploy.js +13 -5
  42. package/dist/deploy.js.map +1 -1
  43. package/dist/entries/app-browser-entry.d.ts +3 -1
  44. package/dist/entries/app-browser-entry.js +11 -2
  45. package/dist/entries/app-browser-entry.js.map +1 -1
  46. package/dist/entries/app-rsc-entry.js +11 -0
  47. package/dist/entries/app-rsc-entry.js.map +1 -1
  48. package/dist/entries/app-rsc-manifest.js +4 -0
  49. package/dist/entries/app-rsc-manifest.js.map +1 -1
  50. package/dist/entries/app-ssr-entry.js.map +1 -1
  51. package/dist/entries/pages-client-entry.js.map +1 -1
  52. package/dist/entries/pages-entry-helpers.js.map +1 -1
  53. package/dist/entries/pages-server-entry.js +15 -0
  54. package/dist/entries/pages-server-entry.js.map +1 -1
  55. package/dist/entries/runtime-entry-module.js.map +1 -1
  56. package/dist/index.js +76 -18
  57. package/dist/index.js.map +1 -1
  58. package/dist/init.js.map +1 -1
  59. package/dist/plugins/async-hooks-stub.js.map +1 -1
  60. package/dist/plugins/client-reference-dedup.js.map +1 -1
  61. package/dist/plugins/fonts.js.map +1 -1
  62. package/dist/plugins/instrumentation-client.js.map +1 -1
  63. package/dist/plugins/og-assets.js.map +1 -1
  64. package/dist/plugins/optimize-imports.js.map +1 -1
  65. package/dist/plugins/postcss.js.map +1 -1
  66. package/dist/plugins/rsc-client-reference-loaders.d.ts +7 -0
  67. package/dist/plugins/rsc-client-reference-loaders.js +48 -0
  68. package/dist/plugins/rsc-client-reference-loaders.js.map +1 -0
  69. package/dist/plugins/rsc-client-shim-excludes.js.map +1 -1
  70. package/dist/plugins/server-externals-manifest.js.map +1 -1
  71. package/dist/plugins/strip-server-exports.js.map +1 -1
  72. package/dist/routing/app-route-graph.d.ts +48 -5
  73. package/dist/routing/app-route-graph.js +159 -15
  74. package/dist/routing/app-route-graph.js.map +1 -1
  75. package/dist/routing/app-router.js.map +1 -1
  76. package/dist/routing/file-matcher.js.map +1 -1
  77. package/dist/routing/pages-router.js.map +1 -1
  78. package/dist/routing/route-matching.js.map +1 -1
  79. package/dist/routing/route-pattern.js.map +1 -1
  80. package/dist/routing/route-trie.js.map +1 -1
  81. package/dist/routing/route-validation.js.map +1 -1
  82. package/dist/routing/utils.js.map +1 -1
  83. package/dist/server/api-handler.js.map +1 -1
  84. package/dist/server/app-browser-action-result.d.ts +19 -0
  85. package/dist/server/app-browser-action-result.js +18 -0
  86. package/dist/server/app-browser-action-result.js.map +1 -0
  87. package/dist/server/app-browser-entry.js +91 -48
  88. package/dist/server/app-browser-entry.js.map +1 -1
  89. package/dist/server/app-browser-error.js.map +1 -1
  90. package/dist/server/app-browser-hydration.d.ts +19 -0
  91. package/dist/server/app-browser-hydration.js +22 -0
  92. package/dist/server/app-browser-hydration.js.map +1 -0
  93. package/dist/server/app-browser-navigation-controller.d.ts +6 -3
  94. package/dist/server/app-browser-navigation-controller.js +67 -19
  95. package/dist/server/app-browser-navigation-controller.js.map +1 -1
  96. package/dist/server/app-browser-state.d.ts +17 -17
  97. package/dist/server/app-browser-state.js +122 -36
  98. package/dist/server/app-browser-state.js.map +1 -1
  99. package/dist/server/app-browser-stream.d.ts +4 -0
  100. package/dist/server/app-browser-stream.js +24 -2
  101. package/dist/server/app-browser-stream.js.map +1 -1
  102. package/dist/server/app-browser-visible-commit.d.ts +6 -1
  103. package/dist/server/app-browser-visible-commit.js +34 -19
  104. package/dist/server/app-browser-visible-commit.js.map +1 -1
  105. package/dist/server/app-client-reference-preloader.js.map +1 -1
  106. package/dist/server/app-elements-wire.d.ts +6 -1
  107. package/dist/server/app-elements-wire.js +17 -1
  108. package/dist/server/app-elements-wire.js.map +1 -1
  109. package/dist/server/app-elements.d.ts +2 -2
  110. package/dist/server/app-elements.js +2 -2
  111. package/dist/server/app-elements.js.map +1 -1
  112. package/dist/server/app-fallback-renderer.js.map +1 -1
  113. package/dist/server/app-hook-warning-suppression.js.map +1 -1
  114. package/dist/server/app-middleware.d.ts +1 -1
  115. package/dist/server/app-middleware.js +4 -9
  116. package/dist/server/app-middleware.js.map +1 -1
  117. package/dist/server/app-mounted-slots-header.js.map +1 -1
  118. package/dist/server/app-page-boundary-render.d.ts +1 -0
  119. package/dist/server/app-page-boundary-render.js +14 -13
  120. package/dist/server/app-page-boundary-render.js.map +1 -1
  121. package/dist/server/app-page-boundary.d.ts +1 -0
  122. package/dist/server/app-page-boundary.js +7 -5
  123. package/dist/server/app-page-boundary.js.map +1 -1
  124. package/dist/server/app-page-cache.d.ts +10 -3
  125. package/dist/server/app-page-cache.js +42 -23
  126. package/dist/server/app-page-cache.js.map +1 -1
  127. package/dist/server/app-page-dispatch.d.ts +6 -1
  128. package/dist/server/app-page-dispatch.js +21 -7
  129. package/dist/server/app-page-dispatch.js.map +1 -1
  130. package/dist/server/app-page-element-builder.d.ts +3 -1
  131. package/dist/server/app-page-element-builder.js +6 -2
  132. package/dist/server/app-page-element-builder.js.map +1 -1
  133. package/dist/server/app-page-execution.js.map +1 -1
  134. package/dist/server/app-page-head.js +4 -0
  135. package/dist/server/app-page-head.js.map +1 -1
  136. package/dist/server/app-page-method.js.map +1 -1
  137. package/dist/server/app-page-params.js.map +1 -1
  138. package/dist/server/app-page-probe.js.map +1 -1
  139. package/dist/server/app-page-render.d.ts +7 -1
  140. package/dist/server/app-page-render.js +11 -4
  141. package/dist/server/app-page-render.js.map +1 -1
  142. package/dist/server/app-page-request.js +2 -1
  143. package/dist/server/app-page-request.js.map +1 -1
  144. package/dist/server/app-page-response.d.ts +2 -0
  145. package/dist/server/app-page-response.js +15 -5
  146. package/dist/server/app-page-response.js.map +1 -1
  147. package/dist/server/app-page-route-wiring.d.ts +6 -2
  148. package/dist/server/app-page-route-wiring.js +50 -49
  149. package/dist/server/app-page-route-wiring.js.map +1 -1
  150. package/dist/server/app-page-segment-state.d.ts +10 -0
  151. package/dist/server/app-page-segment-state.js +87 -0
  152. package/dist/server/app-page-segment-state.js.map +1 -0
  153. package/dist/server/app-page-stream.d.ts +7 -2
  154. package/dist/server/app-page-stream.js +3 -1
  155. package/dist/server/app-page-stream.js.map +1 -1
  156. package/dist/server/app-post-middleware-context.js.map +1 -1
  157. package/dist/server/app-prerender-endpoints.js.map +1 -1
  158. package/dist/server/app-prerender-static-params.js.map +1 -1
  159. package/dist/server/app-render-dependency.js.map +1 -1
  160. package/dist/server/app-request-context.js.map +1 -1
  161. package/dist/server/app-route-handler-cache.js.map +1 -1
  162. package/dist/server/app-route-handler-dispatch.js +3 -1
  163. package/dist/server/app-route-handler-dispatch.js.map +1 -1
  164. package/dist/server/app-route-handler-execution.js.map +1 -1
  165. package/dist/server/app-route-handler-policy.js +1 -0
  166. package/dist/server/app-route-handler-policy.js.map +1 -1
  167. package/dist/server/app-route-handler-response.js +4 -3
  168. package/dist/server/app-route-handler-response.js.map +1 -1
  169. package/dist/server/app-route-handler-runtime.js.map +1 -1
  170. package/dist/server/app-router-entry.js +6 -2
  171. package/dist/server/app-router-entry.js.map +1 -1
  172. package/dist/server/app-rsc-cache-busting.d.ts +5 -2
  173. package/dist/server/app-rsc-cache-busting.js +40 -19
  174. package/dist/server/app-rsc-cache-busting.js.map +1 -1
  175. package/dist/server/app-rsc-error-handler.js.map +1 -1
  176. package/dist/server/app-rsc-errors.js.map +1 -1
  177. package/dist/server/app-rsc-handler.d.ts +10 -1
  178. package/dist/server/app-rsc-handler.js +51 -17
  179. package/dist/server/app-rsc-handler.js.map +1 -1
  180. package/dist/server/app-rsc-render-mode.d.ts +11 -0
  181. package/dist/server/app-rsc-render-mode.js +21 -0
  182. package/dist/server/app-rsc-render-mode.js.map +1 -0
  183. package/dist/server/app-rsc-request-normalization.d.ts +4 -1
  184. package/dist/server/app-rsc-request-normalization.js +7 -2
  185. package/dist/server/app-rsc-request-normalization.js.map +1 -1
  186. package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
  187. package/dist/server/app-rsc-response-finalizer.js +6 -1
  188. package/dist/server/app-rsc-response-finalizer.js.map +1 -1
  189. package/dist/server/app-rsc-route-matching.js.map +1 -1
  190. package/dist/server/app-segment-config.js.map +1 -1
  191. package/dist/server/app-server-action-execution.d.ts +16 -2
  192. package/dist/server/app-server-action-execution.js +79 -23
  193. package/dist/server/app-server-action-execution.js.map +1 -1
  194. package/dist/server/app-ssr-entry.d.ts +6 -0
  195. package/dist/server/app-ssr-entry.js +10 -4
  196. package/dist/server/app-ssr-entry.js.map +1 -1
  197. package/dist/server/app-ssr-stream.js.map +1 -1
  198. package/dist/server/app-static-generation.js.map +1 -1
  199. package/dist/server/artifact-compatibility.js.map +1 -1
  200. package/dist/server/cache-control.js +1 -0
  201. package/dist/server/cache-control.js.map +1 -1
  202. package/dist/server/cache-proof.js.map +1 -1
  203. package/dist/server/csp.js.map +1 -1
  204. package/dist/server/dev-error-overlay-store.js.map +1 -1
  205. package/dist/server/dev-error-overlay.js +5 -0
  206. package/dist/server/dev-error-overlay.js.map +1 -1
  207. package/dist/server/dev-module-runner.js.map +1 -1
  208. package/dist/server/dev-origin-check.js.map +1 -1
  209. package/dist/server/dev-route-files.js.map +1 -1
  210. package/dist/server/dev-server.js +8 -5
  211. package/dist/server/dev-server.js.map +1 -1
  212. package/dist/server/file-based-metadata.js.map +1 -1
  213. package/dist/server/headers.d.ts +79 -0
  214. package/dist/server/headers.js +101 -0
  215. package/dist/server/headers.js.map +1 -0
  216. package/dist/server/html.js.map +1 -1
  217. package/dist/server/http-error-responses.js.map +1 -1
  218. package/dist/server/image-optimization.d.ts +11 -1
  219. package/dist/server/image-optimization.js.map +1 -1
  220. package/dist/server/implicit-tags.js +2 -1
  221. package/dist/server/implicit-tags.js.map +1 -1
  222. package/dist/server/instrumentation-runtime.js.map +1 -1
  223. package/dist/server/instrumentation.js.map +1 -1
  224. package/dist/server/isr-cache.d.ts +10 -1
  225. package/dist/server/isr-cache.js +12 -3
  226. package/dist/server/isr-cache.js.map +1 -1
  227. package/dist/server/metadata-route-build-data.js.map +1 -1
  228. package/dist/server/metadata-route-response.js.map +1 -1
  229. package/dist/server/metadata-routes.js.map +1 -1
  230. package/dist/server/middleware-matcher.js.map +1 -1
  231. package/dist/server/middleware-request-headers.d.ts +4 -1
  232. package/dist/server/middleware-request-headers.js +15 -8
  233. package/dist/server/middleware-request-headers.js.map +1 -1
  234. package/dist/server/middleware-response-headers.d.ts +2 -1
  235. package/dist/server/middleware-response-headers.js +1 -1
  236. package/dist/server/middleware-response-headers.js.map +1 -1
  237. package/dist/server/middleware-runtime.d.ts +1 -0
  238. package/dist/server/middleware-runtime.js +6 -3
  239. package/dist/server/middleware-runtime.js.map +1 -1
  240. package/dist/server/middleware.js.map +1 -1
  241. package/dist/server/navigation-planner.d.ts +119 -0
  242. package/dist/server/navigation-planner.js +171 -0
  243. package/dist/server/navigation-planner.js.map +1 -0
  244. package/dist/server/navigation-trace.d.ts +12 -2
  245. package/dist/server/navigation-trace.js +13 -1
  246. package/dist/server/navigation-trace.js.map +1 -1
  247. package/dist/server/next-error-digest.d.ts +3 -2
  248. package/dist/server/next-error-digest.js +4 -2
  249. package/dist/server/next-error-digest.js.map +1 -1
  250. package/dist/server/normalize-path.js.map +1 -1
  251. package/dist/server/pages-api-route.js.map +1 -1
  252. package/dist/server/pages-i18n.js.map +1 -1
  253. package/dist/server/pages-media-type.js.map +1 -1
  254. package/dist/server/pages-node-compat.js.map +1 -1
  255. package/dist/server/pages-page-data.js +5 -2
  256. package/dist/server/pages-page-data.js.map +1 -1
  257. package/dist/server/pages-page-response.js +3 -2
  258. package/dist/server/pages-page-response.js.map +1 -1
  259. package/dist/server/prerender-work-unit-setup.js +1 -1
  260. package/dist/server/prerender-work-unit-setup.js.map +1 -1
  261. package/dist/server/prod-server.js +35 -13
  262. package/dist/server/prod-server.js.map +1 -1
  263. package/dist/server/request-log.js.map +1 -1
  264. package/dist/server/request-pipeline.d.ts +1 -13
  265. package/dist/server/request-pipeline.js +3 -25
  266. package/dist/server/request-pipeline.js.map +1 -1
  267. package/dist/server/rsc-stream-hints.js.map +1 -1
  268. package/dist/server/seed-cache.js.map +1 -1
  269. package/dist/server/server-action-not-found.js +3 -3
  270. package/dist/server/server-action-not-found.js.map +1 -1
  271. package/dist/server/socket-error-backstop.js.map +1 -1
  272. package/dist/server/static-file-cache.js.map +1 -1
  273. package/dist/server/worker-utils.d.ts +0 -7
  274. package/dist/server/worker-utils.js +3 -2
  275. package/dist/server/worker-utils.js.map +1 -1
  276. package/dist/shims/amp.js.map +1 -1
  277. package/dist/shims/app.d.ts +37 -4
  278. package/dist/shims/app.js +50 -1
  279. package/dist/shims/app.js.map +1 -0
  280. package/dist/shims/cache-for-request.js.map +1 -1
  281. package/dist/shims/cache-runtime.js +20 -8
  282. package/dist/shims/cache-runtime.js.map +1 -1
  283. package/dist/shims/cache.d.ts +15 -3
  284. package/dist/shims/cache.js +99 -15
  285. package/dist/shims/cache.js.map +1 -1
  286. package/dist/shims/client-hook-error.js.map +1 -1
  287. package/dist/shims/compat-router.js.map +1 -1
  288. package/dist/shims/config.js.map +1 -1
  289. package/dist/shims/constants.js.map +1 -1
  290. package/dist/shims/document.js.map +1 -1
  291. package/dist/shims/dynamic.d.ts +18 -10
  292. package/dist/shims/dynamic.js +107 -51
  293. package/dist/shims/dynamic.js.map +1 -1
  294. package/dist/shims/error-boundary.d.ts +35 -6
  295. package/dist/shims/error-boundary.js +118 -33
  296. package/dist/shims/error-boundary.js.map +1 -1
  297. package/dist/shims/error.js.map +1 -1
  298. package/dist/shims/fetch-cache.d.ts +22 -1
  299. package/dist/shims/fetch-cache.js +124 -13
  300. package/dist/shims/fetch-cache.js.map +1 -1
  301. package/dist/shims/font-google-base.js.map +1 -1
  302. package/dist/shims/font-local.js.map +1 -1
  303. package/dist/shims/form.js +3 -1
  304. package/dist/shims/form.js.map +1 -1
  305. package/dist/shims/head-state.js.map +1 -1
  306. package/dist/shims/head.d.ts +3 -1
  307. package/dist/shims/head.js +28 -16
  308. package/dist/shims/head.js.map +1 -1
  309. package/dist/shims/headers.d.ts +4 -2
  310. package/dist/shims/headers.js +24 -7
  311. package/dist/shims/headers.js.map +1 -1
  312. package/dist/shims/i18n-context.js.map +1 -1
  313. package/dist/shims/i18n-state.js.map +1 -1
  314. package/dist/shims/image-config.d.ts +14 -1
  315. package/dist/shims/image-config.js +24 -1
  316. package/dist/shims/image-config.js.map +1 -1
  317. package/dist/shims/image.js +15 -2
  318. package/dist/shims/image.js.map +1 -1
  319. package/dist/shims/internal/als-registry.js.map +1 -1
  320. package/dist/shims/internal/app-router-context.d.ts +1 -0
  321. package/dist/shims/internal/app-router-context.js.map +1 -1
  322. package/dist/shims/internal/cookie-serialize.js.map +1 -1
  323. package/dist/shims/internal/make-hanging-promise.d.ts +1 -1
  324. package/dist/shims/internal/make-hanging-promise.js +1 -1
  325. package/dist/shims/internal/make-hanging-promise.js.map +1 -1
  326. package/dist/shims/internal/parse-cookie-header.js.map +1 -1
  327. package/dist/shims/internal/utils.js.map +1 -1
  328. package/dist/shims/internal/work-unit-async-storage.js +2 -2
  329. package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
  330. package/dist/shims/layout-segment-context.js.map +1 -1
  331. package/dist/shims/legacy-image.js.map +1 -1
  332. package/dist/shims/link-prefetch.d.ts +34 -0
  333. package/dist/shims/link-prefetch.js +40 -0
  334. package/dist/shims/link-prefetch.js.map +1 -0
  335. package/dist/shims/link.d.ts +27 -4
  336. package/dist/shims/link.js +91 -27
  337. package/dist/shims/link.js.map +1 -1
  338. package/dist/shims/metadata.js.map +1 -1
  339. package/dist/shims/navigation-state.js.map +1 -1
  340. package/dist/shims/navigation.d.ts +22 -1
  341. package/dist/shims/navigation.js +30 -15
  342. package/dist/shims/navigation.js.map +1 -1
  343. package/dist/shims/navigation.react-server.js.map +1 -1
  344. package/dist/shims/offline.js.map +1 -1
  345. package/dist/shims/readonly-url-search-params.js.map +1 -1
  346. package/dist/shims/request-context.js.map +1 -1
  347. package/dist/shims/root-params.js.map +1 -1
  348. package/dist/shims/router-state.js.map +1 -1
  349. package/dist/shims/router.d.ts +38 -2
  350. package/dist/shims/router.js +45 -17
  351. package/dist/shims/router.js.map +1 -1
  352. package/dist/shims/script-nonce-context.js.map +1 -1
  353. package/dist/shims/script.js.map +1 -1
  354. package/dist/shims/server.js +10 -14
  355. package/dist/shims/server.js.map +1 -1
  356. package/dist/shims/slot.d.ts +6 -1
  357. package/dist/shims/slot.js +20 -7
  358. package/dist/shims/slot.js.map +1 -1
  359. package/dist/shims/thenable-params.js.map +1 -1
  360. package/dist/shims/unified-request-context.js +3 -0
  361. package/dist/shims/unified-request-context.js.map +1 -1
  362. package/dist/shims/url-safety.js.map +1 -1
  363. package/dist/shims/url-utils.d.ts +2 -1
  364. package/dist/shims/url-utils.js +10 -1
  365. package/dist/shims/url-utils.js.map +1 -1
  366. package/dist/shims/use-merged-ref.js.map +1 -1
  367. package/dist/shims/web-vitals.d.ts +4 -21
  368. package/dist/shims/web-vitals.js +19 -6
  369. package/dist/shims/web-vitals.js.map +1 -1
  370. package/dist/utils/base-path.js.map +1 -1
  371. package/dist/utils/cache-control-metadata.js.map +1 -1
  372. package/dist/utils/domain-locale.js.map +1 -1
  373. package/dist/utils/encode-cache-tag.d.ts +31 -0
  374. package/dist/utils/encode-cache-tag.js +38 -0
  375. package/dist/utils/encode-cache-tag.js.map +1 -0
  376. package/dist/utils/error-cause.js.map +1 -1
  377. package/dist/utils/hash.js.map +1 -1
  378. package/dist/utils/lazy-chunks.js.map +1 -1
  379. package/dist/utils/manifest-paths.js.map +1 -1
  380. package/dist/utils/mdx-scan.js.map +1 -1
  381. package/dist/utils/navigation-signal.d.ts +6 -0
  382. package/dist/utils/navigation-signal.js +14 -0
  383. package/dist/utils/navigation-signal.js.map +1 -0
  384. package/dist/utils/project.js.map +1 -1
  385. package/dist/utils/public-routes.js.map +1 -1
  386. package/dist/utils/query.js.map +1 -1
  387. package/dist/utils/safe-json-file.js.map +1 -1
  388. package/dist/utils/text-stream.js.map +1 -1
  389. package/dist/utils/vinext-root.js.map +1 -1
  390. package/package.json +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"app-rsc-entry.js","names":[],"sources":["../../src/entries/app-rsc-entry.ts"],"sourcesContent":["/**\n * App Router RSC entry generator.\n *\n * Generates the virtual RSC entry module for the App Router.\n * The RSC entry does route matching and renders the component tree,\n * then delegates to the SSR entry for HTML generation.\n *\n * Previously housed in server/app-dev-server.ts.\n */\nimport { buildAppRscManifestCode } from \"./app-rsc-manifest.js\";\nimport { resolveEntryPath, normalizePathSeparators } from \"./runtime-entry-module.js\";\nimport type {\n NextHeader,\n NextI18nConfig,\n NextRedirect,\n NextRewrite,\n} from \"../config/next-config.js\";\nimport type { AppRoute } from \"../routing/app-router.js\";\nimport { generateDevOriginCheckCode } from \"../server/dev-origin-check.js\";\nimport type { MetadataFileRoute } from \"../server/metadata-routes.js\";\nimport { isProxyFile } from \"../server/middleware.js\";\n\nconst DEFAULT_EXPIRE_TIME = 31_536_000;\n\n// Pre-computed absolute paths for generated-code imports. The virtual RSC\n// entry can't use relative imports (it has no real file location), so we\n// resolve these at code-generation time and embed them as absolute paths.\nconst middlewareRequestHeadersPath = resolveEntryPath(\n \"../server/middleware-request-headers.js\",\n import.meta.url,\n);\nconst normalizePathModulePath = resolveEntryPath(\"../server/normalize-path.js\", import.meta.url);\nconst appRscHandlerPath = resolveEntryPath(\"../server/app-rsc-handler.js\", import.meta.url);\nconst appRouteHandlerDispatchPath = resolveEntryPath(\n \"../server/app-route-handler-dispatch.js\",\n import.meta.url,\n);\nconst appServerActionExecutionPath = resolveEntryPath(\n \"../server/app-server-action-execution.js\",\n import.meta.url,\n);\nconst appRscErrorsPath = resolveEntryPath(\"../server/app-rsc-errors.js\", import.meta.url);\nconst appPageExecutionPath = resolveEntryPath(\"../server/app-page-execution.js\", import.meta.url);\nconst appFallbackRendererPath = resolveEntryPath(\n \"../server/app-fallback-renderer.js\",\n import.meta.url,\n);\nconst appElementsPath = resolveEntryPath(\"../server/app-elements.js\", import.meta.url);\nconst appPageRouteWiringPath = resolveEntryPath(\n \"../server/app-page-route-wiring.js\",\n import.meta.url,\n);\nconst appPageHeadPath = resolveEntryPath(\"../server/app-page-head.js\", import.meta.url);\nconst appPageParamsPath = resolveEntryPath(\"../server/app-page-params.js\", import.meta.url);\nconst appPageDispatchPath = resolveEntryPath(\"../server/app-page-dispatch.js\", import.meta.url);\nconst appPageRequestPath = resolveEntryPath(\"../server/app-page-request.js\", import.meta.url);\nconst appSegmentConfigPath = resolveEntryPath(\"../server/app-segment-config.js\", import.meta.url);\nconst appRscRouteMatchingPath = resolveEntryPath(\n \"../server/app-rsc-route-matching.js\",\n import.meta.url,\n);\nconst rscStreamHintsPath = resolveEntryPath(\"../server/rsc-stream-hints.js\", import.meta.url);\nconst isrCachePath = resolveEntryPath(\"../server/isr-cache.js\", import.meta.url);\nconst thenableParamsShimPath = resolveEntryPath(\"../shims/thenable-params.js\", import.meta.url);\nconst appPageElementBuilderPath = resolveEntryPath(\n \"../server/app-page-element-builder.js\",\n import.meta.url,\n);\nconst instrumentationRuntimePath = resolveEntryPath(\n \"../server/instrumentation-runtime.js\",\n import.meta.url,\n);\nconst appRscErrorHandlerPath = resolveEntryPath(\n \"../server/app-rsc-error-handler.js\",\n import.meta.url,\n);\nconst appRequestContextPath = resolveEntryPath(\"../server/app-request-context.js\", import.meta.url);\nconst appHookWarningSuppressionPath = resolveEntryPath(\n \"../server/app-hook-warning-suppression.js\",\n import.meta.url,\n);\n\n/**\n * Resolved config options relevant to App Router request handling.\n * Passed from the Vite plugin where the full next.config.js is loaded.\n */\ntype AppRouterConfig = {\n redirects?: NextRedirect[];\n rewrites?: {\n beforeFiles: NextRewrite[];\n afterFiles: NextRewrite[];\n fallback: NextRewrite[];\n };\n headers?: NextHeader[];\n /** Extra origins allowed for server action CSRF checks (from experimental.serverActions.allowedOrigins). */\n allowedOrigins?: string[];\n /** Extra origins allowed for dev server access (from allowedDevOrigins). */\n allowedDevOrigins?: string[];\n /** Body size limit for server actions in bytes (from experimental.serverActions.bodySizeLimit). */\n bodySizeLimit?: number;\n /** Route-level expire fallback in seconds for ISR entries with numeric revalidate. */\n expireTime?: number;\n /** Internationalization routing config for middleware matcher locale handling. */\n i18n?: NextI18nConfig | null;\n /**\n * When true, the project has a `pages/` directory alongside the App Router.\n * The generated RSC entry exposes `/__vinext/prerender/pages-static-paths`\n * so `prerenderPages` can call `getStaticPaths` via `wrangler unstable_startWorker`\n * in CF Workers builds. `pageRoutes` is loaded from the SSR environment via\n * `import(\"./ssr/index.js\")`, which re-exports it from\n * `virtual:vinext-server-entry` when this flag is set.\n */\n hasPagesDir?: boolean;\n /** Exact public/ file routes, using normalized leading-slash pathnames. */\n publicFiles?: string[];\n};\n\n/**\n * Generate the virtual RSC entry module.\n *\n * This runs in the `rsc` Vite environment (react-server condition).\n * It matches the incoming request URL to an app route, builds the\n * nested layout + page tree, and renders it to an RSC stream.\n */\nexport function generateRscEntry(\n appDir: string,\n routes: AppRoute[],\n middlewarePath?: string | null,\n metadataRoutes?: MetadataFileRoute[],\n globalErrorPath?: string | null,\n basePath?: string,\n trailingSlash?: boolean,\n config?: AppRouterConfig,\n instrumentationPath?: string | null,\n): string {\n const bp = basePath ?? \"\";\n const ts = trailingSlash ?? false;\n const redirects = config?.redirects ?? [];\n const rewrites = config?.rewrites ?? { beforeFiles: [], afterFiles: [], fallback: [] };\n const headers = config?.headers ?? [];\n const allowedOrigins = config?.allowedOrigins ?? [];\n const bodySizeLimit = config?.bodySizeLimit ?? 1 * 1024 * 1024;\n const expireTime = config?.expireTime ?? DEFAULT_EXPIRE_TIME;\n const i18nConfig = config?.i18n ?? null;\n const hasPagesDir = config?.hasPagesDir ?? false;\n const publicFiles = config?.publicFiles ?? [];\n const manifestCode = buildAppRscManifestCode({ routes, metadataRoutes, globalErrorPath });\n const {\n imports,\n routeEntries,\n metaRouteEntries,\n generateStaticParamsEntries,\n rootNotFoundVar,\n rootForbiddenVar,\n rootUnauthorizedVar,\n rootLayoutVars,\n globalErrorVar,\n } = manifestCode;\n const loadPrerenderPagesRoutesCode = hasPagesDir\n ? `\nasync function __loadPrerenderPagesRoutes() {\n const __gspSsrEntry = await import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n return __gspSsrEntry.pageRoutes;\n}\n`\n : \"\";\n\n return `\nimport {\n renderToReadableStream as _renderToReadableStream,\n decodeAction,\n decodeReply,\n loadServerAction,\n createTemporaryReferenceSet,\n} from \"@vitejs/plugin-rsc/rsc\";\nimport { createRscRenderer } from ${JSON.stringify(rscStreamHintsPath)};\n\nconst renderToReadableStream = createRscRenderer(_renderToReadableStream);\nimport { createElement } from \"react\";\nimport { getNavigationContext as _getNavigationContext } from \"next/navigation\";\nimport { headersContextFromRequest, getDraftModeCookieHeader, getAndClearPendingCookies, consumeDynamicUsage, consumeInvalidDynamicUsageError, setHeadersAccessPhase } from \"next/headers\";\nimport { mergeMetadata, resolveModuleMetadata, mergeViewport, resolveModuleViewport } from \"vinext/metadata\";\n${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};` : \"\"}\n${\n instrumentationPath\n ? `import * as _instrumentation from ${JSON.stringify(normalizePathSeparators(instrumentationPath))};\nimport { ensureInstrumentationRegistered as __ensureInstrumentationRegistered } from ${JSON.stringify(instrumentationRuntimePath)};`\n : \"\"\n}\nimport { createAppRscHandler as __createAppRscHandler } from ${JSON.stringify(appRscHandlerPath)};\nimport { decodePathParams as __decodePathParams } from ${JSON.stringify(normalizePathModulePath)};\nimport { buildRequestHeadersFromMiddlewareResponse as __buildRequestHeadersFromMiddlewareResponse } from ${JSON.stringify(middlewareRequestHeadersPath)};\nimport {\n dispatchAppRouteHandler as __dispatchAppRouteHandler,\n} from ${JSON.stringify(appRouteHandlerDispatchPath)};\nimport {\n handleProgressiveServerActionRequest as __handleProgressiveServerActionRequest,\n handleServerActionRscRequest as __handleServerActionRscRequest,\n readActionBodyWithLimit as __readBodyWithLimit,\n readActionFormDataWithLimit as __readFormDataWithLimit,\n} from ${JSON.stringify(appServerActionExecutionPath)};\nimport {\n sanitizeErrorForClient as __sanitizeErrorForClient,\n} from ${JSON.stringify(appRscErrorsPath)};\nimport { createAppRscOnErrorHandler } from ${JSON.stringify(appRscErrorHandlerPath)};\nimport {\n buildAppPageFontLinkHeader as __buildAppPageFontLinkHeader,\n resolveAppPageSpecialError as __resolveAppPageSpecialError,\n} from ${JSON.stringify(appPageExecutionPath)};\nimport {\n createAppFallbackRenderer as __createAppFallbackRenderer,\n} from ${JSON.stringify(appFallbackRendererPath)};\nimport {\n AppElementsWire as __AppElementsWire,\n} from ${JSON.stringify(appElementsPath)};\nimport {\n resolveAppPageChildSegments as __resolveAppPageChildSegments,\n} from ${JSON.stringify(appPageRouteWiringPath)};\nimport { buildPageElements as __buildPageElements } from ${JSON.stringify(appPageElementBuilderPath)};\nimport {\n resolveAppPageSegmentParams as __resolveAppPageSegmentParams,\n} from ${JSON.stringify(appPageParamsPath)};\nimport {\n collectAppPageSearchParams as __collectAppPageSearchParams,\n} from ${JSON.stringify(appPageHeadPath)};\nimport {\n dispatchAppPage as __dispatchAppPage,\n} from ${JSON.stringify(appPageDispatchPath)};\nimport {\n resolveAppPageGenerateStaticParamsSources as __resolveAppPageGenerateStaticParamsSources,\n} from ${JSON.stringify(appPageRequestPath)};\nimport {\n resolveAppPageFetchCacheMode as __resolveAppPageFetchCacheMode,\n resolveAppPageSegmentConfig as __resolveAppPageSegmentConfig,\n} from ${JSON.stringify(appSegmentConfigPath)};\nimport { makeThenableParams } from ${JSON.stringify(thenableParamsShimPath)};\nimport {\n createAppRscRouteMatcher as __createAppRscRouteMatcher,\n} from ${JSON.stringify(appRscRouteMatchingPath)};\nimport {\n appIsrHtmlKey as __isrHtmlKey,\n appIsrRscKey as __isrRscKey,\n appIsrRouteKey as __isrRouteKey,\n isrGet as __isrGet,\n isrSet as __isrSet,\n triggerBackgroundRegeneration as __triggerBackgroundRegeneration,\n} from ${JSON.stringify(isrCachePath)};\n// Import server-only state module to register ALS-backed accessors.\nimport \"vinext/navigation-state\";\nimport { reportRequestError as _reportRequestError } from \"vinext/instrumentation\";\nimport { getSSRFontLinks as _getSSRFontLinks, getSSRFontStyles as _getSSRFontStylesGoogle, getSSRFontPreloads as _getSSRFontPreloadsGoogle } from \"next/font/google\";\nimport { getSSRFontStyles as _getSSRFontStylesLocal, getSSRFontPreloads as _getSSRFontPreloadsLocal } from \"next/font/local\";\nfunction _getSSRFontStyles() { return [..._getSSRFontStylesGoogle(), ..._getSSRFontStylesLocal()]; }\nfunction _getSSRFontPreloads() { return [..._getSSRFontPreloadsGoogle(), ..._getSSRFontPreloadsLocal()]; }\n${hasPagesDir ? `// Pages Router routes are loaded lazily from the SSR environment for internal prerender requests.` : \"\"}\n\n// Suppress expected \"Invalid hook call\" dev warning when layout/page\n// components are probed outside React's render cycle. The import patches\n// console.error once at module load (side-effect) and exposes the ALS\n// so per-route dispatch can opt into suppression via .run(true, ...).\nimport { suppressHookWarningAls } from ${JSON.stringify(appHookWarningSuppressionPath)};\nimport { clearAppRequestContext as __clearRequestContext, setAppNavigationContext as setNavigationContext } from ${JSON.stringify(appRequestContextPath)};\n\n// Note: cache entries are written with \\`headers: undefined\\`. Next.js stores\n// response headers (e.g. set-cookie from cookies().set() during render) in the\n// cache entry so they can be replayed on HIT. We don't do this because:\n// 1. Pages that call cookies().set() during render trigger dynamicUsedDuringRender,\n// which opts them out of ISR caching before we reach the write path.\n// 2. Custom response headers set via next/headers are not yet captured separately\n// from the live Response object in vinext's server pipeline.\n// In practice this means ISR-cached responses won't replay render-time set-cookie\n// headers — but that case is already prevented by the dynamic-usage opt-out.\n// TODO: capture render-time response headers for full Next.js parity.\n// Verbose cache logging — opt in with NEXT_PRIVATE_DEBUG_CACHE=1.\n// Matches the env var Next.js uses for its own cache debug output so operators\n// have a single knob for all cache tracing.\nconst __isrDebug = process.env.NEXT_PRIVATE_DEBUG_CACHE\n ? console.debug.bind(console, \"[vinext] ISR:\")\n : undefined;\n\n// Classification debug — opt in with VINEXT_DEBUG_CLASSIFICATION=1. Gated on\n// the env var so the hot path pays no overhead unless an operator is actively\n// tracing why a layout was flagged static or dynamic. The reason payload is\n// carried by __VINEXT_CLASS_REASONS and consumed inside probeAppPageLayouts.\nconst __classDebug = process.env.VINEXT_DEBUG_CLASSIFICATION\n ? function(layoutId, reason) {\n console.debug(\"[vinext] CLS:\", layoutId, reason);\n }\n : undefined;\n\nfunction __resolveRouteFetchCacheMode(route) {\n return __resolveAppPageFetchCacheMode({\n layouts: route.layouts,\n page: route.page,\n });\n}\n\n${imports.join(\"\\n\")}\n\n${\n instrumentationPath\n ? `// Lazy instrumentation initialisation is handled by ensureInstrumentationRegistered\n// (imported from vinext/instrumentation-runtime). The generated entry only passes\n// the user module in; all bookkeeping (initialized flag, shared promise, prerender\n// skip) lives in the typed helper so it can be unit-tested independently.`\n : \"\"\n}\n\n// Build-time layout classification dispatch. Replaced in generateBundle\n// with a switch statement that returns a pre-computed per-layout\n// Map<layoutIndex, \"static\" | \"dynamic\"> for each route. Until the\n// plugin patches this stub, every route falls back to the Layer 3\n// runtime probe, which is the current (slow) behaviour.\nfunction __VINEXT_CLASS(routeIdx) {\n return null;\n}\n\n// Build-time layout classification reasons dispatch. Sibling of\n// __VINEXT_CLASS, returning a per-route Map<layoutIndex, ClassificationReason>\n// that feeds the debug channel when VINEXT_DEBUG_CLASSIFICATION is active.\n// Replaced in generateBundle with a real dispatch table; the stub returns\n// null so the hot path never allocates reason maps when debug is off.\nfunction __VINEXT_CLASS_REASONS(routeIdx) {\n return null;\n}\n\nconst routes = [\n${routeEntries.join(\",\\n\")}\n];\nconst __routeMatcher = __createAppRscRouteMatcher(routes);\n\nconst metadataRoutes = [\n${metaRouteEntries.join(\",\\n\")}\n];\n\nconst rootNotFoundModule = ${rootNotFoundVar ? rootNotFoundVar : \"null\"};\nconst rootForbiddenModule = ${rootForbiddenVar ? rootForbiddenVar : \"null\"};\nconst rootUnauthorizedModule = ${rootUnauthorizedVar ? rootUnauthorizedVar : \"null\"};\nconst rootLayouts = [${rootLayoutVars.join(\", \")}];\n\nconst createRscOnErrorHandler = (request, pathname, routePath) =>\n createAppRscOnErrorHandler(_reportRequestError, request, pathname, routePath);\n\nconst __fallbackRenderer = __createAppFallbackRenderer({\n rootBoundaries: {\n rootForbiddenModule,\n rootLayouts,\n rootNotFoundModule,\n rootUnauthorizedModule,\n },\n globalErrorModule: ${globalErrorVar ? globalErrorVar : \"null\"},\n metadataRoutes,\n ssrLoader() {\n return import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n },\n fontProviders: {\n buildFontLinkHeader: __buildAppPageFontLinkHeader,\n getFontLinks: _getSSRFontLinks,\n getFontPreloads: _getSSRFontPreloads,\n getFontStyles: _getSSRFontStyles,\n },\n makeThenableParams,\n sanitizer: __sanitizeErrorForClient,\n rscRenderer: renderToReadableStream,\n getNavigationContext: _getNavigationContext,\n resolveChildSegments: __resolveAppPageChildSegments,\n clearRequestContext() {\n __clearRequestContext();\n },\n createRscOnErrorHandler(request, pathname, routePath) {\n return createRscOnErrorHandler(request, pathname, routePath);\n },\n});\n\nfunction matchRoute(url) {\n return __routeMatcher.matchRoute(url);\n}\n\n/**\n * Check if a pathname matches any intercepting route.\n * Returns the match info or null.\n */\nfunction findIntercept(pathname, sourcePathname = null) {\n return __routeMatcher.findIntercept(pathname, sourcePathname);\n}\n\nasync function buildPageElements(route, params, routePath, pageRequest) {\n return __buildPageElements({\n route,\n params,\n routePath,\n pageRequest,\n globalErrorModule: ${globalErrorVar ? globalErrorVar : \"null\"},\n rootNotFoundModule: ${rootNotFoundVar ? rootNotFoundVar : \"null\"},\n rootForbiddenModule: ${rootForbiddenVar ? rootForbiddenVar : \"null\"},\n rootUnauthorizedModule: ${rootUnauthorizedVar ? rootUnauthorizedVar : \"null\"},\n metadataRoutes,\n });\n}\n\nconst __basePath = ${JSON.stringify(bp)};\nconst __trailingSlash = ${JSON.stringify(ts)};\nconst __i18nConfig = ${JSON.stringify(i18nConfig)};\nconst __configRedirects = ${JSON.stringify(redirects)};\nconst __configRewrites = ${JSON.stringify(rewrites)};\nconst __configHeaders = ${JSON.stringify(headers)};\nconst __publicFiles = new Set(${JSON.stringify(publicFiles)});\nconst __allowedOrigins = ${JSON.stringify(allowedOrigins)};\nconst __expireTime = ${JSON.stringify(expireTime)};\n\n${generateDevOriginCheckCode(config?.allowedDevOrigins)}\n\n/**\n * Maximum server-action request body size.\n * Configurable via experimental.serverActions.bodySizeLimit in next.config.\n * Defaults to 1MB, matching the Next.js default.\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/serverActions#bodysizelimit\n * Prevents unbounded request body buffering.\n */\nvar __MAX_ACTION_BODY_SIZE = ${JSON.stringify(bodySizeLimit)};\n\n// Map from route pattern to generateStaticParams function.\n// Used by the prerender phase to enumerate dynamic route URLs without\n// loading route modules via the dev server.\nexport const generateStaticParamsMap = {\n// TODO: layout-level generateStaticParams — this map only includes routes that\n// have a pagePath (leaf pages). Layout segments can also export generateStaticParams\n// to provide parent params for nested dynamic routes, but they don't have a pagePath\n// so they are excluded here. Supporting layout-level generateStaticParams requires\n// scanning layout.tsx files separately and including them in this map.\n${generateStaticParamsEntries.join(\"\\n\")}\n};${loadPrerenderPagesRoutesCode}\nconst rootParamNamesMap = {\n${routes\n .filter((r) => r.isDynamic && r.pagePath && r.rootParamNames && r.rootParamNames.length > 0)\n .map((r) => ` ${JSON.stringify(r.pattern)}: ${JSON.stringify(r.rootParamNames)},`)\n .join(\"\\n\")}\n};\n\nexport default __createAppRscHandler({\n basePath: __basePath,\n clearRequestContext() {\n __clearRequestContext();\n },\n configHeaders: __configHeaders,\n configRedirects: __configRedirects,\n configRewrites: __configRewrites,\n dispatchMatchedPage({\n cleanPathname,\n handlerStart,\n interceptionContext,\n isRscRequest,\n middlewareContext,\n mountedSlotsHeader,\n params,\n request,\n route,\n scriptNonce,\n searchParams,\n }) {\n const PageComponent = route.page?.default;\n const __segmentConfig = __resolveAppPageSegmentConfig({\n layouts: route.layouts,\n page: route.page,\n });\n const __generateStaticParams = __resolveAppPageGenerateStaticParamsSources({\n layouts: route.layouts,\n layoutTreePositions: route.layoutTreePositions,\n page: route.page,\n routeSegments: route.routeSegments,\n });\n const _asyncRouteParams = makeThenableParams(params);\n return __dispatchAppPage({\n basePath: __basePath,\n buildPageElement(targetRoute, targetParams, targetOpts, targetSearchParams) {\n return buildPageElements(targetRoute, targetParams, cleanPathname, {\n opts: targetOpts,\n searchParams: targetSearchParams,\n isRscRequest,\n request,\n mountedSlotsHeader,\n });\n },\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n createRscOnErrorHandler(pathname, routePath) {\n return createRscOnErrorHandler(request, pathname, routePath);\n },\n debugClassification: __classDebug,\n dynamicConfig: __segmentConfig.dynamicConfig,\n dynamicParamsConfig: __segmentConfig.dynamicParamsConfig,\n fetchCache: __segmentConfig.fetchCache ?? null,\n findIntercept(pathname) {\n return findIntercept(pathname, interceptionContext);\n },\n generateStaticParams: __generateStaticParams,\n getFontLinks: _getSSRFontLinks,\n getFontPreloads: _getSSRFontPreloads,\n getFontStyles: _getSSRFontStyles,\n getNavigationContext: _getNavigationContext,\n getSourceRoute(sourceRouteIndex) {\n return routes[sourceRouteIndex];\n },\n hasGenerateStaticParams: __generateStaticParams.length > 0,\n hasPageDefaultExport: !!PageComponent,\n hasPageModule: !!route.page,\n handlerStart,\n interceptionContext,\n expireSeconds: __expireTime,\n isProduction: process.env.NODE_ENV === \"production\",\n isRscRequest,\n isrDebug: __isrDebug,\n isrGet: __isrGet,\n isrHtmlKey: __isrHtmlKey,\n isrRscKey: __isrRscKey,\n isrSet: __isrSet,\n loadSsrHandler() {\n return import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n },\n middlewareContext,\n mountedSlotsHeader,\n params,\n probeLayoutAt(li) {\n const LayoutComp = route.layouts[li]?.default;\n if (!LayoutComp) return null;\n return LayoutComp({\n params: makeThenableParams(__resolveAppPageSegmentParams(\n route.routeSegments,\n route.layoutTreePositions?.[li] ?? 0,\n params,\n )),\n children: null,\n });\n },\n probePage() {\n if (!PageComponent) return null;\n const _asyncSearchParams = makeThenableParams(\n __collectAppPageSearchParams(searchParams).searchParamsObject,\n );\n return PageComponent({ params: _asyncRouteParams, searchParams: _asyncSearchParams });\n },\n renderErrorBoundaryPage(renderErr) {\n return __fallbackRenderer.renderErrorBoundary(route, renderErr, isRscRequest, request, params, scriptNonce, middlewareContext);\n },\n renderHttpAccessFallbackPage(statusCode, opts, currentMiddlewareContext) {\n return __fallbackRenderer.renderHttpAccessFallback(route, statusCode, isRscRequest, request, opts, scriptNonce, currentMiddlewareContext);\n },\n renderToReadableStream,\n request,\n revalidateSeconds: __segmentConfig.revalidateSeconds,\n resolveRouteFetchCacheMode(targetRoute) {\n return __resolveRouteFetchCacheMode(targetRoute);\n },\n rootForbiddenModule,\n rootNotFoundModule,\n rootUnauthorizedModule,\n route,\n runWithSuppressedHookWarning(probe) {\n return suppressHookWarningAls.run(true, probe);\n },\n scheduleBackgroundRegeneration(key, renderFn, errorContext) {\n __triggerBackgroundRegeneration(key, renderFn, errorContext);\n },\n scriptNonce,\n searchParams,\n setNavigationContext,\n });\n },\n dispatchMatchedRouteHandler({\n cleanPathname,\n middlewareContext,\n params,\n request,\n route,\n searchParams,\n }) {\n return __dispatchAppRouteHandler({\n basePath: __basePath,\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n i18n: __i18nConfig,\n isrDebug: __isrDebug,\n isrGet: __isrGet,\n isrRouteKey: __isrRouteKey,\n isrSet: __isrSet,\n middlewareContext,\n middlewareRequestHeaders: middlewareContext.requestHeaders,\n params,\n request,\n route: {\n pattern: route.pattern,\n routeHandler: route.routeHandler,\n routeSegments: route.routeSegments,\n },\n scheduleBackgroundRegeneration: __triggerBackgroundRegeneration,\n searchParams,\n });\n },\n ${\n instrumentationPath\n ? `ensureInstrumentation() {\n return __ensureInstrumentationRegistered(_instrumentation);\n },`\n : \"\"\n }\n handleProgressiveActionRequest({\n actionId,\n cleanPathname,\n contentType,\n middlewareContext,\n request,\n }) {\n return __handleProgressiveServerActionRequest({\n actionId,\n allowedOrigins: __allowedOrigins,\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n contentType,\n decodeAction,\n getAndClearPendingCookies,\n getDraftModeCookieHeader,\n maxActionBodySize: __MAX_ACTION_BODY_SIZE,\n middlewareHeaders: middlewareContext.headers,\n readFormDataWithLimit: __readFormDataWithLimit,\n reportRequestError: _reportRequestError,\n request,\n setHeadersAccessPhase,\n });\n },\n handleServerActionRequest({\n actionId,\n cleanPathname,\n contentType,\n interceptionContext,\n isRscRequest,\n middlewareContext,\n mountedSlotsHeader,\n request,\n searchParams,\n }) {\n return __handleServerActionRscRequest({\n actionId,\n allowedOrigins: __allowedOrigins,\n buildPageElement({\n route: actionRoute,\n params: actionParams,\n cleanPathname: actionCleanPathname,\n interceptOpts,\n searchParams: actionSearchParams,\n isRscRequest: actionIsRscRequest,\n request: actionRequest,\n mountedSlotsHeader: actionMountedSlotsHeader,\n }) {\n return buildPageElements(actionRoute, actionParams, actionCleanPathname, {\n opts: interceptOpts,\n searchParams: actionSearchParams,\n isRscRequest: actionIsRscRequest,\n request: actionRequest,\n mountedSlotsHeader: actionMountedSlotsHeader,\n });\n },\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n contentType,\n createNotFoundElement(actionRouteId) {\n return {\n ...__AppElementsWire.createMetadataEntries({\n interceptionContext: null,\n rootLayoutTreePath: null,\n routeId: actionRouteId,\n }),\n [actionRouteId]: createElement(\"div\", null, \"Page not found\"),\n };\n },\n createPayloadRouteId(pathnameToRender, currentInterceptionContext) {\n return __AppElementsWire.encodeRouteId(pathnameToRender, currentInterceptionContext);\n },\n createRscOnErrorHandler(actionRequest, actionPathname, routePattern) {\n return createRscOnErrorHandler(actionRequest, actionPathname, routePattern);\n },\n createTemporaryReferenceSet,\n decodeReply,\n findIntercept(pathnameToMatch) {\n return findIntercept(pathnameToMatch, interceptionContext);\n },\n getAndClearPendingCookies,\n getDraftModeCookieHeader,\n getRouteParamNames(sourceRoute) {\n return sourceRoute.params;\n },\n getSourceRoute(sourceRouteIndex) {\n return routes[sourceRouteIndex];\n },\n isRscRequest,\n loadServerAction,\n matchRoute(pathnameToMatch) {\n return matchRoute(pathnameToMatch);\n },\n maxActionBodySize: __MAX_ACTION_BODY_SIZE,\n middlewareHeaders: middlewareContext.headers,\n middlewareStatus: middlewareContext.status,\n mountedSlotsHeader,\n readBodyWithLimit: __readBodyWithLimit,\n readFormDataWithLimit: __readFormDataWithLimit,\n renderToReadableStream,\n reportRequestError: _reportRequestError,\n request,\n sanitizeErrorForClient(error) {\n return __sanitizeErrorForClient(error);\n },\n searchParams,\n setHeadersAccessPhase,\n setNavigationContext,\n toInterceptOpts(intercept) {\n return {\n interceptionContext,\n interceptLayouts: intercept.interceptLayouts,\n interceptSlotKey: intercept.slotKey,\n interceptPage: intercept.page,\n interceptParams: intercept.matchedParams,\n };\n },\n });\n },\n i18nConfig: __i18nConfig,\n isMiddlewareProxy: ${JSON.stringify(middlewarePath ? isProxyFile(middlewarePath) : false)},\n ${hasPagesDir ? `loadPrerenderPagesRoutes: __loadPrerenderPagesRoutes,` : \"\"}\n makeThenableParams,\n matchRoute,\n metadataRoutes,\n middlewareModule: ${middlewarePath ? \"middlewareModule\" : \"null\"},\n publicFiles: __publicFiles,\n renderNotFound({ isRscRequest, matchedParams, middlewareContext, request, route, scriptNonce }) {\n return __fallbackRenderer.renderNotFound(route, isRscRequest, request, matchedParams, scriptNonce, middlewareContext);\n },\n ${\n hasPagesDir\n ? `async renderPagesFallback({ isRscRequest, middlewareContext, request, url }) {\n if (isRscRequest) return null;\n\n const __pagesEntry = await import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n if (typeof __pagesEntry.renderPage !== \"function\") return null;\n\n const __pagesRequestHeaders = middlewareContext.requestHeaders\n ? __buildRequestHeadersFromMiddlewareResponse(request.headers, middlewareContext.requestHeaders)\n : null;\n const __pagesRequest = __pagesRequestHeaders\n ? new Request(request.url, { method: request.method, headers: __pagesRequestHeaders })\n : request;\n const __pagesRes = await __pagesEntry.renderPage(\n __pagesRequest,\n __decodePathParams(url.pathname) + (url.search || \"\"),\n {},\n undefined,\n middlewareContext.requestHeaders,\n );\n return __pagesRes.status !== 404 ? __pagesRes : null;\n },`\n : \"\"\n }\n rootParamNamesByPattern: rootParamNamesMap,\n setNavigationContext,\n staticParamsMap: generateStaticParamsMap,\n trailingSlash: __trailingSlash,\n validateDevRequestOrigin: __validateDevRequestOrigin,\n});\n\nif (import.meta.hot) {\n import.meta.hot.accept();\n}\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAM,sBAAsB;AAK5B,MAAM,+BAA+B,iBACnC,2CACA,OAAO,KAAK,IACb;AACD,MAAM,0BAA0B,iBAAiB,+BAA+B,OAAO,KAAK,IAAI;AAChG,MAAM,oBAAoB,iBAAiB,gCAAgC,OAAO,KAAK,IAAI;AAC3F,MAAM,8BAA8B,iBAClC,2CACA,OAAO,KAAK,IACb;AACD,MAAM,+BAA+B,iBACnC,4CACA,OAAO,KAAK,IACb;AACD,MAAM,mBAAmB,iBAAiB,+BAA+B,OAAO,KAAK,IAAI;AACzF,MAAM,uBAAuB,iBAAiB,mCAAmC,OAAO,KAAK,IAAI;AACjG,MAAM,0BAA0B,iBAC9B,sCACA,OAAO,KAAK,IACb;AACD,MAAM,kBAAkB,iBAAiB,6BAA6B,OAAO,KAAK,IAAI;AACtF,MAAM,yBAAyB,iBAC7B,sCACA,OAAO,KAAK,IACb;AACD,MAAM,kBAAkB,iBAAiB,8BAA8B,OAAO,KAAK,IAAI;AACvF,MAAM,oBAAoB,iBAAiB,gCAAgC,OAAO,KAAK,IAAI;AAC3F,MAAM,sBAAsB,iBAAiB,kCAAkC,OAAO,KAAK,IAAI;AAC/F,MAAM,qBAAqB,iBAAiB,iCAAiC,OAAO,KAAK,IAAI;AAC7F,MAAM,uBAAuB,iBAAiB,mCAAmC,OAAO,KAAK,IAAI;AACjG,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA6HoB,KAAK,UAAU,iBAAiB,YAAY,eAAe,GAAG,MAAM,CAAC;IACxF,cAAc,0DAA0D,GAAG;;;;sBAIzD,iBAAiB,qBAAqB,OAAO;;;;;IAM/D,cACI;;;;;;;;;;;;;;;;;;;;QAqBA,GACL"}
1
+ {"version":3,"file":"app-rsc-entry.js","names":[],"sources":["../../src/entries/app-rsc-entry.ts"],"sourcesContent":["/**\n * App Router RSC entry generator.\n *\n * Generates the virtual RSC entry module for the App Router.\n * The RSC entry does route matching and renders the component tree,\n * then delegates to the SSR entry for HTML generation.\n *\n * Previously housed in server/app-dev-server.ts.\n */\nimport { buildAppRscManifestCode } from \"./app-rsc-manifest.js\";\nimport { resolveEntryPath, normalizePathSeparators } from \"./runtime-entry-module.js\";\nimport type {\n NextHeader,\n NextI18nConfig,\n NextRedirect,\n NextRewrite,\n} from \"../config/next-config.js\";\nimport type { AppRoute } from \"../routing/app-router.js\";\nimport { generateDevOriginCheckCode } from \"../server/dev-origin-check.js\";\nimport type { MetadataFileRoute } from \"../server/metadata-routes.js\";\nimport { isProxyFile } from \"../server/middleware.js\";\n\nconst DEFAULT_EXPIRE_TIME = 31_536_000;\n\n// Pre-computed absolute paths for generated-code imports. The virtual RSC\n// entry can't use relative imports (it has no real file location), so we\n// resolve these at code-generation time and embed them as absolute paths.\nconst middlewareRequestHeadersPath = resolveEntryPath(\n \"../server/middleware-request-headers.js\",\n import.meta.url,\n);\nconst normalizePathModulePath = resolveEntryPath(\"../server/normalize-path.js\", import.meta.url);\nconst appRscHandlerPath = resolveEntryPath(\"../server/app-rsc-handler.js\", import.meta.url);\nconst appRouteHandlerDispatchPath = resolveEntryPath(\n \"../server/app-route-handler-dispatch.js\",\n import.meta.url,\n);\nconst appServerActionExecutionPath = resolveEntryPath(\n \"../server/app-server-action-execution.js\",\n import.meta.url,\n);\nconst appRscErrorsPath = resolveEntryPath(\"../server/app-rsc-errors.js\", import.meta.url);\nconst appPageExecutionPath = resolveEntryPath(\"../server/app-page-execution.js\", import.meta.url);\nconst appFallbackRendererPath = resolveEntryPath(\n \"../server/app-fallback-renderer.js\",\n import.meta.url,\n);\nconst appElementsPath = resolveEntryPath(\"../server/app-elements.js\", import.meta.url);\nconst appPageRouteWiringPath = resolveEntryPath(\n \"../server/app-page-route-wiring.js\",\n import.meta.url,\n);\nconst appPageHeadPath = resolveEntryPath(\"../server/app-page-head.js\", import.meta.url);\nconst appPageParamsPath = resolveEntryPath(\"../server/app-page-params.js\", import.meta.url);\nconst appPageDispatchPath = resolveEntryPath(\"../server/app-page-dispatch.js\", import.meta.url);\nconst appPageRequestPath = resolveEntryPath(\"../server/app-page-request.js\", import.meta.url);\nconst appSegmentConfigPath = resolveEntryPath(\"../server/app-segment-config.js\", import.meta.url);\nconst appRscRouteMatchingPath = resolveEntryPath(\n \"../server/app-rsc-route-matching.js\",\n import.meta.url,\n);\nconst rscStreamHintsPath = resolveEntryPath(\"../server/rsc-stream-hints.js\", import.meta.url);\nconst isrCachePath = resolveEntryPath(\"../server/isr-cache.js\", import.meta.url);\nconst thenableParamsShimPath = resolveEntryPath(\"../shims/thenable-params.js\", import.meta.url);\nconst appPageElementBuilderPath = resolveEntryPath(\n \"../server/app-page-element-builder.js\",\n import.meta.url,\n);\nconst instrumentationRuntimePath = resolveEntryPath(\n \"../server/instrumentation-runtime.js\",\n import.meta.url,\n);\nconst appRscErrorHandlerPath = resolveEntryPath(\n \"../server/app-rsc-error-handler.js\",\n import.meta.url,\n);\nconst appRequestContextPath = resolveEntryPath(\"../server/app-request-context.js\", import.meta.url);\nconst appHookWarningSuppressionPath = resolveEntryPath(\n \"../server/app-hook-warning-suppression.js\",\n import.meta.url,\n);\n\n/**\n * Resolved config options relevant to App Router request handling.\n * Passed from the Vite plugin where the full next.config.js is loaded.\n */\ntype AppRouterConfig = {\n redirects?: NextRedirect[];\n rewrites?: {\n beforeFiles: NextRewrite[];\n afterFiles: NextRewrite[];\n fallback: NextRewrite[];\n };\n headers?: NextHeader[];\n /** Extra origins allowed for server action CSRF checks (from experimental.serverActions.allowedOrigins). */\n allowedOrigins?: string[];\n /** Extra origins allowed for dev server access (from allowedDevOrigins). */\n allowedDevOrigins?: string[];\n /** Body size limit for server actions in bytes (from experimental.serverActions.bodySizeLimit). */\n bodySizeLimit?: number;\n /** Route-level expire fallback in seconds for ISR entries with numeric revalidate. */\n expireTime?: number;\n /** Internationalization routing config for middleware matcher locale handling. */\n i18n?: NextI18nConfig | null;\n /**\n * When true, the project has a `pages/` directory alongside the App Router.\n * The generated RSC entry exposes `/__vinext/prerender/pages-static-paths`\n * so `prerenderPages` can call `getStaticPaths` via `wrangler unstable_startWorker`\n * in CF Workers builds. `pageRoutes` is loaded from the SSR environment via\n * `import(\"./ssr/index.js\")`, which re-exports it from\n * `virtual:vinext-server-entry` when this flag is set.\n */\n hasPagesDir?: boolean;\n /** Exact public/ file routes, using normalized leading-slash pathnames. */\n publicFiles?: string[];\n};\n\n/**\n * Generate the virtual RSC entry module.\n *\n * This runs in the `rsc` Vite environment (react-server condition).\n * It matches the incoming request URL to an app route, builds the\n * nested layout + page tree, and renders it to an RSC stream.\n */\nexport function generateRscEntry(\n appDir: string,\n routes: AppRoute[],\n middlewarePath?: string | null,\n metadataRoutes?: MetadataFileRoute[],\n globalErrorPath?: string | null,\n basePath?: string,\n trailingSlash?: boolean,\n config?: AppRouterConfig,\n instrumentationPath?: string | null,\n): string {\n const bp = basePath ?? \"\";\n const ts = trailingSlash ?? false;\n const redirects = config?.redirects ?? [];\n const rewrites = config?.rewrites ?? { beforeFiles: [], afterFiles: [], fallback: [] };\n const headers = config?.headers ?? [];\n const allowedOrigins = config?.allowedOrigins ?? [];\n const bodySizeLimit = config?.bodySizeLimit ?? 1 * 1024 * 1024;\n const expireTime = config?.expireTime ?? DEFAULT_EXPIRE_TIME;\n const i18nConfig = config?.i18n ?? null;\n const hasPagesDir = config?.hasPagesDir ?? false;\n const publicFiles = config?.publicFiles ?? [];\n const manifestCode = buildAppRscManifestCode({ routes, metadataRoutes, globalErrorPath });\n const {\n imports,\n routeEntries,\n metaRouteEntries,\n generateStaticParamsEntries,\n rootNotFoundVar,\n rootForbiddenVar,\n rootUnauthorizedVar,\n rootLayoutVars,\n globalErrorVar,\n } = manifestCode;\n const loadPrerenderPagesRoutesCode = hasPagesDir\n ? `\nasync function __loadPrerenderPagesRoutes() {\n const __gspSsrEntry = await import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n return __gspSsrEntry.pageRoutes;\n}\n`\n : \"\";\n\n return `\nimport {\n renderToReadableStream as _renderToReadableStream,\n decodeAction,\n decodeFormState,\n decodeReply,\n loadServerAction,\n createTemporaryReferenceSet,\n} from \"@vitejs/plugin-rsc/rsc\";\nimport { createRscRenderer } from ${JSON.stringify(rscStreamHintsPath)};\n\nconst renderToReadableStream = createRscRenderer(_renderToReadableStream);\nimport { createElement } from \"react\";\nimport { getNavigationContext as _getNavigationContext } from \"next/navigation\";\nimport { headersContextFromRequest, getDraftModeCookieHeader, getAndClearPendingCookies, consumeDynamicUsage, consumeInvalidDynamicUsageError, setHeadersAccessPhase } from \"next/headers\";\nimport { mergeMetadata, resolveModuleMetadata, mergeViewport, resolveModuleViewport } from \"vinext/metadata\";\n${middlewarePath ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};` : \"\"}\n${\n instrumentationPath\n ? `import * as _instrumentation from ${JSON.stringify(normalizePathSeparators(instrumentationPath))};\nimport { ensureInstrumentationRegistered as __ensureInstrumentationRegistered } from ${JSON.stringify(instrumentationRuntimePath)};`\n : \"\"\n}\nimport { createAppRscHandler as __createAppRscHandler } from ${JSON.stringify(appRscHandlerPath)};\nimport { decodePathParams as __decodePathParams } from ${JSON.stringify(normalizePathModulePath)};\nimport { buildRequestHeadersFromMiddlewareResponse as __buildRequestHeadersFromMiddlewareResponse } from ${JSON.stringify(middlewareRequestHeadersPath)};\nimport {\n dispatchAppRouteHandler as __dispatchAppRouteHandler,\n} from ${JSON.stringify(appRouteHandlerDispatchPath)};\nimport {\n handleProgressiveServerActionRequest as __handleProgressiveServerActionRequest,\n handleServerActionRscRequest as __handleServerActionRscRequest,\n readActionBodyWithLimit as __readBodyWithLimit,\n readActionFormDataWithLimit as __readFormDataWithLimit,\n} from ${JSON.stringify(appServerActionExecutionPath)};\nimport {\n sanitizeErrorForClient as __sanitizeErrorForClient,\n} from ${JSON.stringify(appRscErrorsPath)};\nimport { createAppRscOnErrorHandler } from ${JSON.stringify(appRscErrorHandlerPath)};\nimport {\n buildAppPageFontLinkHeader as __buildAppPageFontLinkHeader,\n resolveAppPageSpecialError as __resolveAppPageSpecialError,\n} from ${JSON.stringify(appPageExecutionPath)};\nimport {\n createAppFallbackRenderer as __createAppFallbackRenderer,\n} from ${JSON.stringify(appFallbackRendererPath)};\nimport {\n AppElementsWire as __AppElementsWire,\n} from ${JSON.stringify(appElementsPath)};\nimport {\n resolveAppPageChildSegments as __resolveAppPageChildSegments,\n} from ${JSON.stringify(appPageRouteWiringPath)};\nimport { buildPageElements as __buildPageElements } from ${JSON.stringify(appPageElementBuilderPath)};\nimport {\n resolveAppPageSegmentParams as __resolveAppPageSegmentParams,\n} from ${JSON.stringify(appPageParamsPath)};\nimport {\n collectAppPageSearchParams as __collectAppPageSearchParams,\n} from ${JSON.stringify(appPageHeadPath)};\nimport {\n dispatchAppPage as __dispatchAppPage,\n} from ${JSON.stringify(appPageDispatchPath)};\nimport {\n resolveAppPageGenerateStaticParamsSources as __resolveAppPageGenerateStaticParamsSources,\n} from ${JSON.stringify(appPageRequestPath)};\nimport {\n resolveAppPageFetchCacheMode as __resolveAppPageFetchCacheMode,\n resolveAppPageSegmentConfig as __resolveAppPageSegmentConfig,\n} from ${JSON.stringify(appSegmentConfigPath)};\nimport { makeThenableParams } from ${JSON.stringify(thenableParamsShimPath)};\nimport {\n createAppRscRouteMatcher as __createAppRscRouteMatcher,\n} from ${JSON.stringify(appRscRouteMatchingPath)};\nimport {\n appIsrHtmlKey as __isrHtmlKey,\n appIsrRscKey as __isrRscKey,\n appIsrRouteKey as __isrRouteKey,\n isrGet as __isrGet,\n isrSet as __isrSet,\n triggerBackgroundRegeneration as __triggerBackgroundRegeneration,\n} from ${JSON.stringify(isrCachePath)};\n// Import server-only state module to register ALS-backed accessors.\nimport \"vinext/navigation-state\";\nimport { reportRequestError as _reportRequestError } from \"vinext/instrumentation\";\nimport { getSSRFontLinks as _getSSRFontLinks, getSSRFontStyles as _getSSRFontStylesGoogle, getSSRFontPreloads as _getSSRFontPreloadsGoogle } from \"next/font/google\";\nimport { getSSRFontStyles as _getSSRFontStylesLocal, getSSRFontPreloads as _getSSRFontPreloadsLocal } from \"next/font/local\";\nfunction _getSSRFontStyles() { return [..._getSSRFontStylesGoogle(), ..._getSSRFontStylesLocal()]; }\nfunction _getSSRFontPreloads() { return [..._getSSRFontPreloadsGoogle(), ..._getSSRFontPreloadsLocal()]; }\n${hasPagesDir ? `// Pages Router routes are loaded lazily from the SSR environment for internal prerender requests.` : \"\"}\n\n// Suppress expected \"Invalid hook call\" dev warning when layout/page\n// components are probed outside React's render cycle. The import patches\n// console.error once at module load (side-effect) and exposes the ALS\n// so per-route dispatch can opt into suppression via .run(true, ...).\nimport { suppressHookWarningAls } from ${JSON.stringify(appHookWarningSuppressionPath)};\nimport { clearAppRequestContext as __clearRequestContext, setAppNavigationContext as setNavigationContext } from ${JSON.stringify(appRequestContextPath)};\n\n// Note: cache entries are written with \\`headers: undefined\\`. Next.js stores\n// response headers (e.g. set-cookie from cookies().set() during render) in the\n// cache entry so they can be replayed on HIT. We don't do this because:\n// 1. Pages that call cookies().set() during render trigger dynamicUsedDuringRender,\n// which opts them out of ISR caching before we reach the write path.\n// 2. Custom response headers set via next/headers are not yet captured separately\n// from the live Response object in vinext's server pipeline.\n// In practice this means ISR-cached responses won't replay render-time set-cookie\n// headers — but that case is already prevented by the dynamic-usage opt-out.\n// TODO: capture render-time response headers for full Next.js parity.\n// Verbose cache logging — opt in with NEXT_PRIVATE_DEBUG_CACHE=1.\n// Matches the env var Next.js uses for its own cache debug output so operators\n// have a single knob for all cache tracing.\nconst __isrDebug = process.env.NEXT_PRIVATE_DEBUG_CACHE\n ? console.debug.bind(console, \"[vinext] ISR:\")\n : undefined;\n\n// Classification debug — opt in with VINEXT_DEBUG_CLASSIFICATION=1. Gated on\n// the env var so the hot path pays no overhead unless an operator is actively\n// tracing why a layout was flagged static or dynamic. The reason payload is\n// carried by __VINEXT_CLASS_REASONS and consumed inside probeAppPageLayouts.\nconst __classDebug = process.env.VINEXT_DEBUG_CLASSIFICATION\n ? function(layoutId, reason) {\n console.debug(\"[vinext] CLS:\", layoutId, reason);\n }\n : undefined;\n\nfunction __resolveRouteFetchCacheMode(route) {\n return __resolveAppPageFetchCacheMode({\n layouts: route.layouts,\n page: route.page,\n });\n}\n\n${imports.join(\"\\n\")}\n\n${\n instrumentationPath\n ? `// Lazy instrumentation initialisation is handled by ensureInstrumentationRegistered\n// (imported from vinext/instrumentation-runtime). The generated entry only passes\n// the user module in; all bookkeeping (initialized flag, shared promise, prerender\n// skip) lives in the typed helper so it can be unit-tested independently.`\n : \"\"\n}\n\n// Build-time layout classification dispatch. Replaced in generateBundle\n// with a switch statement that returns a pre-computed per-layout\n// Map<layoutIndex, \"static\" | \"dynamic\"> for each route. Until the\n// plugin patches this stub, every route falls back to the Layer 3\n// runtime probe, which is the current (slow) behaviour.\nfunction __VINEXT_CLASS(routeIdx) {\n return null;\n}\n\n// Build-time layout classification reasons dispatch. Sibling of\n// __VINEXT_CLASS, returning a per-route Map<layoutIndex, ClassificationReason>\n// that feeds the debug channel when VINEXT_DEBUG_CLASSIFICATION is active.\n// Replaced in generateBundle with a real dispatch table; the stub returns\n// null so the hot path never allocates reason maps when debug is off.\nfunction __VINEXT_CLASS_REASONS(routeIdx) {\n return null;\n}\n\nconst routes = [\n${routeEntries.join(\",\\n\")}\n];\nconst __routeMatcher = __createAppRscRouteMatcher(routes);\n\nconst metadataRoutes = [\n${metaRouteEntries.join(\",\\n\")}\n];\n\nconst rootNotFoundModule = ${rootNotFoundVar ? rootNotFoundVar : \"null\"};\nconst rootForbiddenModule = ${rootForbiddenVar ? rootForbiddenVar : \"null\"};\nconst rootUnauthorizedModule = ${rootUnauthorizedVar ? rootUnauthorizedVar : \"null\"};\nconst rootLayouts = [${rootLayoutVars.join(\", \")}];\n\nconst createRscOnErrorHandler = (request, pathname, routePath) =>\n createAppRscOnErrorHandler(_reportRequestError, request, pathname, routePath);\n\nconst __fallbackRenderer = __createAppFallbackRenderer({\n rootBoundaries: {\n rootForbiddenModule,\n rootLayouts,\n rootNotFoundModule,\n rootUnauthorizedModule,\n },\n globalErrorModule: ${globalErrorVar ? globalErrorVar : \"null\"},\n metadataRoutes,\n ssrLoader() {\n return import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n },\n fontProviders: {\n buildFontLinkHeader: __buildAppPageFontLinkHeader,\n getFontLinks: _getSSRFontLinks,\n getFontPreloads: _getSSRFontPreloads,\n getFontStyles: _getSSRFontStyles,\n },\n makeThenableParams,\n sanitizer: __sanitizeErrorForClient,\n rscRenderer: renderToReadableStream,\n getNavigationContext: _getNavigationContext,\n resolveChildSegments: __resolveAppPageChildSegments,\n clearRequestContext() {\n __clearRequestContext();\n },\n createRscOnErrorHandler(request, pathname, routePath) {\n return createRscOnErrorHandler(request, pathname, routePath);\n },\n});\n\nfunction matchRoute(url) {\n return __routeMatcher.matchRoute(url);\n}\n\n/**\n * Check if a pathname matches any intercepting route.\n * Returns the match info or null.\n */\nfunction findIntercept(pathname, sourcePathname = null) {\n return __routeMatcher.findIntercept(pathname, sourcePathname);\n}\n\nasync function buildPageElements(route, params, routePath, pageRequest) {\n return __buildPageElements({\n route,\n params,\n routePath,\n pageRequest,\n globalErrorModule: ${globalErrorVar ? globalErrorVar : \"null\"},\n rootNotFoundModule: ${rootNotFoundVar ? rootNotFoundVar : \"null\"},\n rootForbiddenModule: ${rootForbiddenVar ? rootForbiddenVar : \"null\"},\n rootUnauthorizedModule: ${rootUnauthorizedVar ? rootUnauthorizedVar : \"null\"},\n metadataRoutes,\n });\n}\n\nconst __basePath = ${JSON.stringify(bp)};\nconst __trailingSlash = ${JSON.stringify(ts)};\nconst __i18nConfig = ${JSON.stringify(i18nConfig)};\nconst __configRedirects = ${JSON.stringify(redirects)};\nconst __configRewrites = ${JSON.stringify(rewrites)};\nconst __configHeaders = ${JSON.stringify(headers)};\nconst __publicFiles = new Set(${JSON.stringify(publicFiles)});\nconst __allowedOrigins = ${JSON.stringify(allowedOrigins)};\nconst __expireTime = ${JSON.stringify(expireTime)};\n\n${generateDevOriginCheckCode(config?.allowedDevOrigins)}\n\n/**\n * Maximum server-action request body size.\n * Configurable via experimental.serverActions.bodySizeLimit in next.config.\n * Defaults to 1MB, matching the Next.js default.\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/serverActions#bodysizelimit\n * Prevents unbounded request body buffering.\n */\nvar __MAX_ACTION_BODY_SIZE = ${JSON.stringify(bodySizeLimit)};\n\n// Map from route pattern to generateStaticParams function.\n// Used by the prerender phase to enumerate dynamic route URLs without\n// loading route modules via the dev server.\nexport const generateStaticParamsMap = {\n// TODO: layout-level generateStaticParams — this map only includes routes that\n// have a pagePath (leaf pages). Layout segments can also export generateStaticParams\n// to provide parent params for nested dynamic routes, but they don't have a pagePath\n// so they are excluded here. Supporting layout-level generateStaticParams requires\n// scanning layout.tsx files separately and including them in this map.\n${generateStaticParamsEntries.join(\"\\n\")}\n};${loadPrerenderPagesRoutesCode}\nconst rootParamNamesMap = {\n${routes\n .filter((r) => r.isDynamic && r.pagePath && r.rootParamNames && r.rootParamNames.length > 0)\n .map((r) => ` ${JSON.stringify(r.pattern)}: ${JSON.stringify(r.rootParamNames)},`)\n .join(\"\\n\")}\n};\n\nexport default __createAppRscHandler({\n basePath: __basePath,\n clearRequestContext() {\n __clearRequestContext();\n },\n configHeaders: __configHeaders,\n configRedirects: __configRedirects,\n configRewrites: __configRewrites,\n dispatchMatchedPage({\n cleanPathname,\n formState,\n handlerStart,\n interceptionContext,\n isProgressiveActionRender,\n isRscRequest,\n middlewareContext,\n mountedSlotsHeader,\n params,\n request,\n route,\n scriptNonce,\n searchParams,\n renderMode,\n }) {\n const PageComponent = route.page?.default;\n const __segmentConfig = __resolveAppPageSegmentConfig({\n layouts: route.layouts,\n page: route.page,\n });\n const __generateStaticParams = __resolveAppPageGenerateStaticParamsSources({\n layouts: route.layouts,\n layoutTreePositions: route.layoutTreePositions,\n page: route.page,\n routeSegments: route.routeSegments,\n });\n const _asyncRouteParams = makeThenableParams(params);\n return __dispatchAppPage({\n basePath: __basePath,\n buildPageElement(targetRoute, targetParams, targetOpts, targetSearchParams) {\n return buildPageElements(targetRoute, targetParams, cleanPathname, {\n opts: targetOpts,\n searchParams: targetSearchParams,\n isRscRequest,\n request,\n mountedSlotsHeader,\n renderMode,\n });\n },\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n createRscOnErrorHandler(pathname, routePath) {\n return createRscOnErrorHandler(request, pathname, routePath);\n },\n debugClassification: __classDebug,\n dynamicConfig: __segmentConfig.dynamicConfig,\n dynamicParamsConfig: __segmentConfig.dynamicParamsConfig,\n fetchCache: __segmentConfig.fetchCache ?? null,\n findIntercept(pathname) {\n return findIntercept(pathname, interceptionContext);\n },\n generateStaticParams: __generateStaticParams,\n getFontLinks: _getSSRFontLinks,\n getFontPreloads: _getSSRFontPreloads,\n getFontStyles: _getSSRFontStyles,\n getNavigationContext: _getNavigationContext,\n getSourceRoute(sourceRouteIndex) {\n return routes[sourceRouteIndex];\n },\n hasGenerateStaticParams: __generateStaticParams.length > 0,\n hasPageDefaultExport: !!PageComponent,\n hasPageModule: !!route.page,\n handlerStart,\n interceptionContext,\n expireSeconds: __expireTime,\n formState,\n isProgressiveActionRender,\n isProduction: process.env.NODE_ENV === \"production\",\n isRscRequest,\n isrDebug: __isrDebug,\n isrGet: __isrGet,\n isrHtmlKey: __isrHtmlKey,\n isrRscKey: __isrRscKey,\n isrSet: __isrSet,\n loadSsrHandler() {\n return import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n },\n middlewareContext,\n mountedSlotsHeader,\n params,\n probeLayoutAt(li) {\n const LayoutComp = route.layouts[li]?.default;\n if (!LayoutComp) return null;\n return LayoutComp({\n params: makeThenableParams(__resolveAppPageSegmentParams(\n route.routeSegments,\n route.layoutTreePositions?.[li] ?? 0,\n params,\n )),\n children: null,\n });\n },\n probePage() {\n if (!PageComponent) return null;\n const _asyncSearchParams = makeThenableParams(\n __collectAppPageSearchParams(searchParams).searchParamsObject,\n );\n return PageComponent({ params: _asyncRouteParams, searchParams: _asyncSearchParams });\n },\n renderErrorBoundaryPage(renderErr) {\n return __fallbackRenderer.renderErrorBoundary(route, renderErr, isRscRequest, request, params, scriptNonce, middlewareContext);\n },\n renderHttpAccessFallbackPage(statusCode, opts, currentMiddlewareContext) {\n return __fallbackRenderer.renderHttpAccessFallback(route, statusCode, isRscRequest, request, opts, scriptNonce, currentMiddlewareContext);\n },\n renderToReadableStream,\n request,\n revalidateSeconds: __segmentConfig.revalidateSeconds,\n resolveRouteFetchCacheMode(targetRoute) {\n return __resolveRouteFetchCacheMode(targetRoute);\n },\n rootForbiddenModule,\n rootNotFoundModule,\n rootUnauthorizedModule,\n route,\n runWithSuppressedHookWarning(probe) {\n return suppressHookWarningAls.run(true, probe);\n },\n scheduleBackgroundRegeneration(key, renderFn, errorContext) {\n __triggerBackgroundRegeneration(key, renderFn, errorContext);\n },\n scriptNonce,\n searchParams,\n setNavigationContext,\n renderMode,\n });\n },\n dispatchMatchedRouteHandler({\n cleanPathname,\n middlewareContext,\n params,\n request,\n route,\n searchParams,\n }) {\n return __dispatchAppRouteHandler({\n basePath: __basePath,\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n i18n: __i18nConfig,\n isrDebug: __isrDebug,\n isrGet: __isrGet,\n isrRouteKey: __isrRouteKey,\n isrSet: __isrSet,\n middlewareContext,\n middlewareRequestHeaders: middlewareContext.requestHeaders,\n params,\n request,\n route: {\n pattern: route.pattern,\n routeHandler: route.routeHandler,\n routeSegments: route.routeSegments,\n },\n scheduleBackgroundRegeneration: __triggerBackgroundRegeneration,\n searchParams,\n });\n },\n ${\n instrumentationPath\n ? `ensureInstrumentation() {\n return __ensureInstrumentationRegistered(_instrumentation);\n },`\n : \"\"\n }\n handleProgressiveActionRequest({\n actionId,\n cleanPathname,\n contentType,\n middlewareContext,\n request,\n }) {\n return __handleProgressiveServerActionRequest({\n actionId,\n allowedOrigins: __allowedOrigins,\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n contentType,\n decodeAction,\n decodeFormState,\n getAndClearPendingCookies,\n getDraftModeCookieHeader,\n maxActionBodySize: __MAX_ACTION_BODY_SIZE,\n middlewareHeaders: middlewareContext.headers,\n readFormDataWithLimit: __readFormDataWithLimit,\n reportRequestError: _reportRequestError,\n request,\n setHeadersAccessPhase,\n });\n },\n handleServerActionRequest({\n actionId,\n cleanPathname,\n contentType,\n interceptionContext,\n isRscRequest,\n middlewareContext,\n mountedSlotsHeader,\n request,\n searchParams,\n }) {\n return __handleServerActionRscRequest({\n actionId,\n allowedOrigins: __allowedOrigins,\n buildPageElement({\n route: actionRoute,\n params: actionParams,\n cleanPathname: actionCleanPathname,\n interceptOpts,\n searchParams: actionSearchParams,\n isRscRequest: actionIsRscRequest,\n request: actionRequest,\n mountedSlotsHeader: actionMountedSlotsHeader,\n renderMode: actionRenderMode,\n }) {\n return buildPageElements(actionRoute, actionParams, actionCleanPathname, {\n opts: interceptOpts,\n searchParams: actionSearchParams,\n isRscRequest: actionIsRscRequest,\n request: actionRequest,\n mountedSlotsHeader: actionMountedSlotsHeader,\n renderMode: actionRenderMode,\n });\n },\n cleanPathname,\n clearRequestContext() {\n __clearRequestContext();\n },\n contentType,\n createNotFoundElement(actionRouteId) {\n return {\n ...__AppElementsWire.createMetadataEntries({\n interceptionContext: null,\n rootLayoutTreePath: null,\n routeId: actionRouteId,\n }),\n [actionRouteId]: createElement(\"div\", null, \"Page not found\"),\n };\n },\n createPayloadRouteId(pathnameToRender, currentInterceptionContext) {\n return __AppElementsWire.encodeRouteId(pathnameToRender, currentInterceptionContext);\n },\n createRscOnErrorHandler(actionRequest, actionPathname, routePattern) {\n return createRscOnErrorHandler(actionRequest, actionPathname, routePattern);\n },\n createTemporaryReferenceSet,\n decodeReply,\n findIntercept(pathnameToMatch) {\n return findIntercept(pathnameToMatch, interceptionContext);\n },\n getAndClearPendingCookies,\n getDraftModeCookieHeader,\n getRouteParamNames(sourceRoute) {\n return sourceRoute.params;\n },\n getSourceRoute(sourceRouteIndex) {\n return routes[sourceRouteIndex];\n },\n isRscRequest,\n loadServerAction,\n matchRoute(pathnameToMatch) {\n return matchRoute(pathnameToMatch);\n },\n maxActionBodySize: __MAX_ACTION_BODY_SIZE,\n middlewareHeaders: middlewareContext.headers,\n middlewareStatus: middlewareContext.status,\n mountedSlotsHeader,\n readBodyWithLimit: __readBodyWithLimit,\n readFormDataWithLimit: __readFormDataWithLimit,\n renderToReadableStream,\n reportRequestError: _reportRequestError,\n request,\n sanitizeErrorForClient(error) {\n return __sanitizeErrorForClient(error);\n },\n searchParams,\n setHeadersAccessPhase,\n setNavigationContext,\n toInterceptOpts(intercept) {\n return {\n interceptionContext,\n interceptLayouts: intercept.interceptLayouts,\n interceptSlotKey: intercept.slotKey,\n interceptPage: intercept.page,\n interceptParams: intercept.matchedParams,\n };\n },\n });\n },\n i18nConfig: __i18nConfig,\n isMiddlewareProxy: ${JSON.stringify(middlewarePath ? isProxyFile(middlewarePath) : false)},\n ${hasPagesDir ? `loadPrerenderPagesRoutes: __loadPrerenderPagesRoutes,` : \"\"}\n makeThenableParams,\n matchRoute,\n metadataRoutes,\n middlewareModule: ${middlewarePath ? \"middlewareModule\" : \"null\"},\n publicFiles: __publicFiles,\n renderNotFound({ isRscRequest, matchedParams, middlewareContext, request, route, scriptNonce }) {\n return __fallbackRenderer.renderNotFound(route, isRscRequest, request, matchedParams, scriptNonce, middlewareContext);\n },\n ${\n hasPagesDir\n ? `async renderPagesFallback({ isRscRequest, middlewareContext, request, url }) {\n if (isRscRequest) return null;\n\n const __pagesEntry = await import.meta.viteRsc.loadModule(\"ssr\", \"index\");\n if (typeof __pagesEntry.renderPage !== \"function\") return null;\n\n const __pagesRequestHeaders = middlewareContext.requestHeaders\n ? __buildRequestHeadersFromMiddlewareResponse(request.headers, middlewareContext.requestHeaders)\n : null;\n const __pagesRequest = __pagesRequestHeaders\n ? new Request(request.url, { method: request.method, headers: __pagesRequestHeaders })\n : request;\n const __pagesRes = await __pagesEntry.renderPage(\n __pagesRequest,\n __decodePathParams(url.pathname) + (url.search || \"\"),\n {},\n undefined,\n middlewareContext.requestHeaders,\n );\n return __pagesRes.status !== 404 ? __pagesRes : null;\n },`\n : \"\"\n }\n rootParamNamesByPattern: rootParamNamesMap,\n setNavigationContext,\n staticParamsMap: generateStaticParamsMap,\n trailingSlash: __trailingSlash,\n validateDevRequestOrigin: __validateDevRequestOrigin,\n});\n\nif (import.meta.hot) {\n import.meta.hot.accept();\n}\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAM,sBAAsB;AAK5B,MAAM,+BAA+B,iBACnC,2CACA,OAAO,KAAK,IACb;AACD,MAAM,0BAA0B,iBAAiB,+BAA+B,OAAO,KAAK,IAAI;AAChG,MAAM,oBAAoB,iBAAiB,gCAAgC,OAAO,KAAK,IAAI;AAC3F,MAAM,8BAA8B,iBAClC,2CACA,OAAO,KAAK,IACb;AACD,MAAM,+BAA+B,iBACnC,4CACA,OAAO,KAAK,IACb;AACD,MAAM,mBAAmB,iBAAiB,+BAA+B,OAAO,KAAK,IAAI;AACzF,MAAM,uBAAuB,iBAAiB,mCAAmC,OAAO,KAAK,IAAI;AACjG,MAAM,0BAA0B,iBAC9B,sCACA,OAAO,KAAK,IACb;AACD,MAAM,kBAAkB,iBAAiB,6BAA6B,OA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,UAAU,EAAE,eAAe,CAAC,GAAG,CAClF,KAAK,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8KV,sBACI;;QAGA,GACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAgIoB,KAAK,UAAU,iBAAiB,YAAY,eAAe,GAAG,MAAM,CAAC;IACxF,cAAc,0DAA0D,GAAG;;;;sBAIzD,iBAAiB,qBAAqB,OAAO;;;;;IAM/D,cACI;;;;;;;;;;;;;;;;;;;;QAqBA,GACL"}
@@ -30,6 +30,7 @@ function registerRouteModules(routes, imports) {
30
30
  if (route.layoutErrorPaths) {
31
31
  for (const ep of route.layoutErrorPaths) if (ep) imports.getImportVar(ep);
32
32
  }
33
+ if (route.errorPaths) for (const ep of route.errorPaths) imports.getImportVar(ep);
33
34
  if (route.notFoundPath) imports.getImportVar(route.notFoundPath);
34
35
  if (route.notFoundPaths) {
35
36
  for (const nfp of route.notFoundPaths) if (nfp) imports.getImportVar(nfp);
@@ -88,6 +89,7 @@ ${interceptEntries.join(",\n")}
88
89
  }`;
89
90
  });
90
91
  const layoutErrorVars = (route.layoutErrorPaths || []).map((ep) => ep ? imports.getImportVar(ep) : "null");
92
+ const errorVars = (route.errorPaths ?? []).map((ep) => imports.getImportVar(ep));
91
93
  return ` {
92
94
  __buildTimeClassifications: __VINEXT_CLASS(${routeIdx}), // evaluated once at module load
93
95
  __buildTimeReasons: __classDebug ? __VINEXT_CLASS_REASONS(${routeIdx}) : null,
@@ -105,6 +107,8 @@ ${interceptEntries.join(",\n")}
105
107
  layoutTreePositions: ${JSON.stringify(route.layoutTreePositions)},
106
108
  templates: [${templateVars.join(", ")}],
107
109
  errors: [${layoutErrorVars.join(", ")}],
110
+ errorPaths: [${errorVars.join(", ")}],
111
+ errorTreePositions: ${JSON.stringify(route.errorTreePositions ?? null)},
108
112
  slots: {
109
113
  ${slotEntries.join(",\n")}
110
114
  },
@@ -1 +1 @@
1
- {"version":3,"file":"app-rsc-manifest.js","names":[],"sources":["../../src/entries/app-rsc-manifest.ts"],"sourcesContent":["import type { AppRoute } from \"../routing/app-router.js\";\nimport { createMetadataRouteEntriesSource } from \"../server/metadata-route-build-data.js\";\nimport type { MetadataFileRoute } from \"../server/metadata-routes.js\";\nimport { normalizePathSeparators } from \"./runtime-entry-module.js\";\n\ntype AppRscManifestCode = {\n imports: string[];\n routeEntries: string[];\n metaRouteEntries: string[];\n generateStaticParamsEntries: string[];\n rootNotFoundVar: string | null;\n rootForbiddenVar: string | null;\n rootUnauthorizedVar: string | null;\n rootLayoutVars: string[];\n globalErrorVar: string | null;\n};\n\ntype BuildAppRscManifestCodeOptions = {\n routes: AppRoute[];\n metadataRoutes?: MetadataFileRoute[];\n globalErrorPath?: string | null;\n};\n\ntype ImportAllocator = {\n getImportVar(filePath: string): string;\n importMap: ReadonlyMap<string, string>;\n imports: string[];\n};\n\nfunction createImportAllocator(): ImportAllocator {\n const imports: string[] = [];\n const importMap = new Map<string, string>();\n let importIdx = 0;\n\n return {\n importMap,\n imports,\n getImportVar(filePath) {\n const existing = importMap.get(filePath);\n if (existing) return existing;\n\n const varName = `mod_${importIdx++}`;\n const absPath = normalizePathSeparators(filePath);\n imports.push(`import * as ${varName} from ${JSON.stringify(absPath)};`);\n importMap.set(filePath, varName);\n return varName;\n },\n };\n}\n\nfunction registerRouteModules(routes: AppRoute[], imports: ImportAllocator): void {\n for (const route of routes) {\n if (route.pagePath) imports.getImportVar(route.pagePath);\n if (route.routePath) imports.getImportVar(route.routePath);\n for (const layout of route.layouts) imports.getImportVar(layout);\n for (const tmpl of route.templates) imports.getImportVar(tmpl);\n if (route.loadingPath) imports.getImportVar(route.loadingPath);\n if (route.errorPath) imports.getImportVar(route.errorPath);\n if (route.layoutErrorPaths) {\n for (const ep of route.layoutErrorPaths) {\n if (ep) imports.getImportVar(ep);\n }\n }\n if (route.notFoundPath) imports.getImportVar(route.notFoundPath);\n if (route.notFoundPaths) {\n for (const nfp of route.notFoundPaths) {\n if (nfp) imports.getImportVar(nfp);\n }\n }\n if (route.forbiddenPath) imports.getImportVar(route.forbiddenPath);\n if (route.forbiddenPaths) {\n for (const fp of route.forbiddenPaths) {\n if (fp) imports.getImportVar(fp);\n }\n }\n if (route.unauthorizedPath) imports.getImportVar(route.unauthorizedPath);\n if (route.unauthorizedPaths) {\n for (const up of route.unauthorizedPaths) {\n if (up) imports.getImportVar(up);\n }\n }\n for (const slot of route.parallelSlots) {\n if (slot.pagePath) imports.getImportVar(slot.pagePath);\n if (slot.defaultPath) imports.getImportVar(slot.defaultPath);\n if (slot.layoutPath) imports.getImportVar(slot.layoutPath);\n if (slot.loadingPath) imports.getImportVar(slot.loadingPath);\n if (slot.errorPath) imports.getImportVar(slot.errorPath);\n for (const ir of slot.interceptingRoutes) {\n imports.getImportVar(ir.pagePath);\n for (const layoutPath of ir.layoutPaths) {\n imports.getImportVar(layoutPath);\n }\n }\n }\n }\n}\n\nfunction buildRouteEntries(routes: AppRoute[], imports: ImportAllocator): string[] {\n return routes.map((route, routeIdx) => {\n const layoutVars = route.layouts.map((l) => imports.getImportVar(l));\n const templateVars = route.templates.map((t) => imports.getImportVar(t));\n const notFoundVars = (route.notFoundPaths ?? []).map((nf) =>\n nf ? imports.getImportVar(nf) : \"null\",\n );\n const forbiddenVars = (route.forbiddenPaths ?? []).map((fp) =>\n fp ? imports.getImportVar(fp) : \"null\",\n );\n const unauthorizedVars = (route.unauthorizedPaths ?? []).map((up) =>\n up ? imports.getImportVar(up) : \"null\",\n );\n const slotEntries = route.parallelSlots.map((slot) => {\n const interceptEntries = slot.interceptingRoutes.map(\n (ir) => ` {\n convention: ${JSON.stringify(ir.convention)},\n targetPattern: ${JSON.stringify(ir.targetPattern)},\n interceptLayouts: [${ir.layoutPaths.map((layoutPath) => imports.getImportVar(layoutPath)).join(\", \")}],\n page: ${imports.getImportVar(ir.pagePath)},\n params: ${JSON.stringify(ir.params)},\n }`,\n );\n return ` ${JSON.stringify(slot.key)}: {\n id: ${JSON.stringify(slot.id ?? null)},\n name: ${JSON.stringify(slot.name)},\n page: ${slot.pagePath ? imports.getImportVar(slot.pagePath) : \"null\"},\n default: ${slot.defaultPath ? imports.getImportVar(slot.defaultPath) : \"null\"},\n layout: ${slot.layoutPath ? imports.getImportVar(slot.layoutPath) : \"null\"},\n loading: ${slot.loadingPath ? imports.getImportVar(slot.loadingPath) : \"null\"},\n error: ${slot.errorPath ? imports.getImportVar(slot.errorPath) : \"null\"},\n layoutIndex: ${slot.layoutIndex},\n routeSegments: ${JSON.stringify(slot.routeSegments)},\n slotPatternParts: ${slot.slotPatternParts ? JSON.stringify(slot.slotPatternParts) : \"null\"},\n slotParamNames: ${slot.slotParamNames ? JSON.stringify(slot.slotParamNames) : \"null\"},\n intercepts: [\n${interceptEntries.join(\",\\n\")}\n ],\n }`;\n });\n const layoutErrorVars = (route.layoutErrorPaths || []).map((ep) =>\n ep ? imports.getImportVar(ep) : \"null\",\n );\n return ` {\n __buildTimeClassifications: __VINEXT_CLASS(${routeIdx}), // evaluated once at module load\n __buildTimeReasons: __classDebug ? __VINEXT_CLASS_REASONS(${routeIdx}) : null,\n ids: ${JSON.stringify(route.ids ?? null)},\n pattern: ${JSON.stringify(route.pattern)},\n patternParts: ${JSON.stringify(route.patternParts)},\n isDynamic: ${route.isDynamic},\n params: ${JSON.stringify(route.params)},\n rootParamNames: ${JSON.stringify(route.rootParamNames ?? [])},\n page: ${route.pagePath ? imports.getImportVar(route.pagePath) : \"null\"},\n routeHandler: ${route.routePath ? imports.getImportVar(route.routePath) : \"null\"},\n layouts: [${layoutVars.join(\", \")}],\n routeSegments: ${JSON.stringify(route.routeSegments)},\n templateTreePositions: ${JSON.stringify(route.templateTreePositions)},\n layoutTreePositions: ${JSON.stringify(route.layoutTreePositions)},\n templates: [${templateVars.join(\", \")}],\n errors: [${layoutErrorVars.join(\", \")}],\n slots: {\n${slotEntries.join(\",\\n\")}\n },\n loading: ${route.loadingPath ? imports.getImportVar(route.loadingPath) : \"null\"},\n error: ${route.errorPath ? imports.getImportVar(route.errorPath) : \"null\"},\n notFound: ${route.notFoundPath ? imports.getImportVar(route.notFoundPath) : \"null\"},\n notFounds: [${notFoundVars.join(\", \")}],\n forbidden: ${route.forbiddenPath ? imports.getImportVar(route.forbiddenPath) : \"null\"},\n forbiddens: [${forbiddenVars.join(\", \")}],\n unauthorized: ${route.unauthorizedPath ? imports.getImportVar(route.unauthorizedPath) : \"null\"},\n unauthorizeds: [${unauthorizedVars.join(\", \")}],\n }`;\n });\n}\n\nfunction buildGenerateStaticParamsEntries(routes: AppRoute[], imports: ImportAllocator): string[] {\n const entries: string[] = [];\n for (const route of routes) {\n if (!route.isDynamic || !route.pagePath) continue;\n entries.push(\n ` ${JSON.stringify(route.pattern)}: ${imports.getImportVar(route.pagePath)}?.generateStaticParams ?? null,`,\n );\n }\n return entries;\n}\n\nexport function buildAppRscManifestCode(\n options: BuildAppRscManifestCodeOptions,\n): AppRscManifestCode {\n const imports = createImportAllocator();\n const metadataRoutes = options.metadataRoutes ?? [];\n\n registerRouteModules(options.routes, imports);\n const routeEntries = buildRouteEntries(options.routes, imports);\n\n const rootRoute = options.routes.find((r) => r.pattern === \"/\");\n const rootNotFoundVar = rootRoute?.notFoundPath\n ? imports.getImportVar(rootRoute.notFoundPath)\n : null;\n const rootForbiddenVar = rootRoute?.forbiddenPath\n ? imports.getImportVar(rootRoute.forbiddenPath)\n : null;\n const rootUnauthorizedVar = rootRoute?.unauthorizedPath\n ? imports.getImportVar(rootRoute.unauthorizedPath)\n : null;\n const rootLayoutVars = rootRoute ? rootRoute.layouts.map((l) => imports.getImportVar(l)) : [];\n const globalErrorVar = options.globalErrorPath\n ? imports.getImportVar(options.globalErrorPath)\n : null;\n\n const dynamicMetadataRoutes = metadataRoutes.filter((r) => r.isDynamic);\n for (const route of dynamicMetadataRoutes) {\n imports.getImportVar(route.filePath);\n }\n\n return {\n imports: imports.imports,\n routeEntries,\n metaRouteEntries: createMetadataRouteEntriesSource(metadataRoutes, imports.importMap),\n generateStaticParamsEntries: buildGenerateStaticParamsEntries(options.routes, imports),\n rootNotFoundVar,\n rootForbiddenVar,\n rootUnauthorizedVar,\n rootLayoutVars,\n globalErrorVar,\n };\n}\n"],"mappings":";;;AA6BA,SAAS,wBAAyC;CAChD,MAAM,UAAoB,EAAE;CAC5B,MAAM,4BAAY,IAAI,KAAqB;CAC3C,IAAI,YAAY;AAEhB,QAAO;EACL;EACA;EACA,aAAa,UAAU;GACrB,MAAM,WAAW,UAAU,IAAI,SAAS;AACxC,OAAI,SAAU,QAAO;GAErB,MAAM,UAAU,OAAO;GACvB,MAAM,UAAU,wBAAwB,SAAS;AACjD,WAAQ,KAAK,eAAe,QAAQ,QAAQ,KAAK,UAAU,QAAQ,CAAC,GAAG;AACvE,aAAU,IAAI,UAAU,QAAQ;AAChC,UAAO;;EAEV;;AAGH,SAAS,qBAAqB,QAAoB,SAAgC;AAChF,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,MAAM,SAAU,SAAQ,aAAa,MAAM,SAAS;AACxD,MAAI,MAAM,UAAW,SAAQ,aAAa,MAAM,UAAU;AAC1D,OAAK,MAAM,UAAU,MAAM,QAAS,SAAQ,aAAa,OAAO;AAChE,OAAK,MAAM,QAAQ,MAAM,UAAW,SAAQ,aAAa,KAAK;AAC9D,MAAI,MAAM,YAAa,SAAQ,aAAa,MAAM,YAAY;AAC9D,MAAI,MAAM,UAAW,SAAQ,aAAa,MAAM,UAAU;AAC1D,MAAI,MAAM;QACH,MAAM,MAAM,MAAM,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B,wBACd,SACoB;CACpB,MAAM,UAAU,uBAAuB;CACvC,MAAM,iBAAiB,QAAQ,kBAAkB,EAAE;AAEnD,sBAAqB,QAAQ,QAAQ,QAAQ;CAC7C,MAAM,eAAe,kBAAkB,QAAQ,QAAQ,QAAQ;CAE/D,MAAM,YAAY,QAAQ,OAAO,MAAM,MAAM,EAAE,YAAY,IAAI;CAC/D,MAAM,kBAAkB,WAAW,eAC/B,QAAQ,aAAa,UAAU,aAAa,GAC5C;CACJ,MAAM,mBAAmB,WAAW,gBAChC,QAAQ,aAAa,UAAU,cAAc,GAC7C;CACJ,MAAM,sBAAsB,WAAW,mBACnC,QAAQ,aAAa,UAAU,iBAAiB,GAChD;CACJ,MAAM,iBAAiB,YAAY,UAAU,QAAQ,KAAK,MAAM,QAAQ,aAAa,EAAE,CAAC,GAAG,EAAE;CAC7F,MAAM,iBAAiB,QAAQ,kBAC3B,QAAQ,aAAa,QAAQ,gBAAgB,GAC7C;CAEJ,MAAM,wBAAwB,eAAe,QAAQ,MAAM,EAAE,UAAU;AACvE,MAAK,MAAM,SAAS,sBAClB,SAAQ,aAAa,MAAM,SAAS;AAGtC,QAAO;EACL,SAAS,QAAQ;EACjB;EACA,kBAAkB,iCAAiC,gBAAgB,QAAQ,UAAU;EACrF,6BAA6B,iCAAiC,QAAQ,QAAQ,QAAQ;EACtF;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"app-rsc-manifest.js","names":[],"sources":["../../src/entries/app-rsc-manifest.ts"],"sourcesContent":["import type { AppRoute } from \"../routing/app-router.js\";\nimport { createMetadataRouteEntriesSource } from \"../server/metadata-route-build-data.js\";\nimport type { MetadataFileRoute } from \"../server/metadata-routes.js\";\nimport { normalizePathSeparators } from \"./runtime-entry-module.js\";\n\ntype AppRscManifestCode = {\n imports: string[];\n routeEntries: string[];\n metaRouteEntries: string[];\n generateStaticParamsEntries: string[];\n rootNotFoundVar: string | null;\n rootForbiddenVar: string | null;\n rootUnauthorizedVar: string | null;\n rootLayoutVars: string[];\n globalErrorVar: string | null;\n};\n\ntype BuildAppRscManifestCodeOptions = {\n routes: AppRoute[];\n metadataRoutes?: MetadataFileRoute[];\n globalErrorPath?: string | null;\n};\n\ntype ImportAllocator = {\n getImportVar(filePath: string): string;\n importMap: ReadonlyMap<string, string>;\n imports: string[];\n};\n\nfunction createImportAllocator(): ImportAllocator {\n const imports: string[] = [];\n const importMap = new Map<string, string>();\n let importIdx = 0;\n\n return {\n importMap,\n imports,\n getImportVar(filePath) {\n const existing = importMap.get(filePath);\n if (existing) return existing;\n\n const varName = `mod_${importIdx++}`;\n const absPath = normalizePathSeparators(filePath);\n imports.push(`import * as ${varName} from ${JSON.stringify(absPath)};`);\n importMap.set(filePath, varName);\n return varName;\n },\n };\n}\n\nfunction registerRouteModules(routes: AppRoute[], imports: ImportAllocator): void {\n for (const route of routes) {\n if (route.pagePath) imports.getImportVar(route.pagePath);\n if (route.routePath) imports.getImportVar(route.routePath);\n for (const layout of route.layouts) imports.getImportVar(layout);\n for (const tmpl of route.templates) imports.getImportVar(tmpl);\n if (route.loadingPath) imports.getImportVar(route.loadingPath);\n if (route.errorPath) imports.getImportVar(route.errorPath);\n if (route.layoutErrorPaths) {\n for (const ep of route.layoutErrorPaths) {\n if (ep) imports.getImportVar(ep);\n }\n }\n if (route.errorPaths) {\n for (const ep of route.errorPaths) {\n imports.getImportVar(ep);\n }\n }\n if (route.notFoundPath) imports.getImportVar(route.notFoundPath);\n if (route.notFoundPaths) {\n for (const nfp of route.notFoundPaths) {\n if (nfp) imports.getImportVar(nfp);\n }\n }\n if (route.forbiddenPath) imports.getImportVar(route.forbiddenPath);\n if (route.forbiddenPaths) {\n for (const fp of route.forbiddenPaths) {\n if (fp) imports.getImportVar(fp);\n }\n }\n if (route.unauthorizedPath) imports.getImportVar(route.unauthorizedPath);\n if (route.unauthorizedPaths) {\n for (const up of route.unauthorizedPaths) {\n if (up) imports.getImportVar(up);\n }\n }\n for (const slot of route.parallelSlots) {\n if (slot.pagePath) imports.getImportVar(slot.pagePath);\n if (slot.defaultPath) imports.getImportVar(slot.defaultPath);\n if (slot.layoutPath) imports.getImportVar(slot.layoutPath);\n if (slot.loadingPath) imports.getImportVar(slot.loadingPath);\n if (slot.errorPath) imports.getImportVar(slot.errorPath);\n for (const ir of slot.interceptingRoutes) {\n imports.getImportVar(ir.pagePath);\n for (const layoutPath of ir.layoutPaths) {\n imports.getImportVar(layoutPath);\n }\n }\n }\n }\n}\n\nfunction buildRouteEntries(routes: AppRoute[], imports: ImportAllocator): string[] {\n return routes.map((route, routeIdx) => {\n const layoutVars = route.layouts.map((l) => imports.getImportVar(l));\n const templateVars = route.templates.map((t) => imports.getImportVar(t));\n const notFoundVars = (route.notFoundPaths ?? []).map((nf) =>\n nf ? imports.getImportVar(nf) : \"null\",\n );\n const forbiddenVars = (route.forbiddenPaths ?? []).map((fp) =>\n fp ? imports.getImportVar(fp) : \"null\",\n );\n const unauthorizedVars = (route.unauthorizedPaths ?? []).map((up) =>\n up ? imports.getImportVar(up) : \"null\",\n );\n const slotEntries = route.parallelSlots.map((slot) => {\n const interceptEntries = slot.interceptingRoutes.map(\n (ir) => ` {\n convention: ${JSON.stringify(ir.convention)},\n targetPattern: ${JSON.stringify(ir.targetPattern)},\n interceptLayouts: [${ir.layoutPaths.map((layoutPath) => imports.getImportVar(layoutPath)).join(\", \")}],\n page: ${imports.getImportVar(ir.pagePath)},\n params: ${JSON.stringify(ir.params)},\n }`,\n );\n return ` ${JSON.stringify(slot.key)}: {\n id: ${JSON.stringify(slot.id ?? null)},\n name: ${JSON.stringify(slot.name)},\n page: ${slot.pagePath ? imports.getImportVar(slot.pagePath) : \"null\"},\n default: ${slot.defaultPath ? imports.getImportVar(slot.defaultPath) : \"null\"},\n layout: ${slot.layoutPath ? imports.getImportVar(slot.layoutPath) : \"null\"},\n loading: ${slot.loadingPath ? imports.getImportVar(slot.loadingPath) : \"null\"},\n error: ${slot.errorPath ? imports.getImportVar(slot.errorPath) : \"null\"},\n layoutIndex: ${slot.layoutIndex},\n routeSegments: ${JSON.stringify(slot.routeSegments)},\n slotPatternParts: ${slot.slotPatternParts ? JSON.stringify(slot.slotPatternParts) : \"null\"},\n slotParamNames: ${slot.slotParamNames ? JSON.stringify(slot.slotParamNames) : \"null\"},\n intercepts: [\n${interceptEntries.join(\",\\n\")}\n ],\n }`;\n });\n const layoutErrorVars = (route.layoutErrorPaths || []).map((ep) =>\n ep ? imports.getImportVar(ep) : \"null\",\n );\n const errorVars = (route.errorPaths ?? []).map((ep) => imports.getImportVar(ep));\n return ` {\n __buildTimeClassifications: __VINEXT_CLASS(${routeIdx}), // evaluated once at module load\n __buildTimeReasons: __classDebug ? __VINEXT_CLASS_REASONS(${routeIdx}) : null,\n ids: ${JSON.stringify(route.ids ?? null)},\n pattern: ${JSON.stringify(route.pattern)},\n patternParts: ${JSON.stringify(route.patternParts)},\n isDynamic: ${route.isDynamic},\n params: ${JSON.stringify(route.params)},\n rootParamNames: ${JSON.stringify(route.rootParamNames ?? [])},\n page: ${route.pagePath ? imports.getImportVar(route.pagePath) : \"null\"},\n routeHandler: ${route.routePath ? imports.getImportVar(route.routePath) : \"null\"},\n layouts: [${layoutVars.join(\", \")}],\n routeSegments: ${JSON.stringify(route.routeSegments)},\n templateTreePositions: ${JSON.stringify(route.templateTreePositions)},\n layoutTreePositions: ${JSON.stringify(route.layoutTreePositions)},\n templates: [${templateVars.join(\", \")}],\n errors: [${layoutErrorVars.join(\", \")}],\n errorPaths: [${errorVars.join(\", \")}],\n errorTreePositions: ${JSON.stringify(route.errorTreePositions ?? null)},\n slots: {\n${slotEntries.join(\",\\n\")}\n },\n loading: ${route.loadingPath ? imports.getImportVar(route.loadingPath) : \"null\"},\n error: ${route.errorPath ? imports.getImportVar(route.errorPath) : \"null\"},\n notFound: ${route.notFoundPath ? imports.getImportVar(route.notFoundPath) : \"null\"},\n notFounds: [${notFoundVars.join(\", \")}],\n forbidden: ${route.forbiddenPath ? imports.getImportVar(route.forbiddenPath) : \"null\"},\n forbiddens: [${forbiddenVars.join(\", \")}],\n unauthorized: ${route.unauthorizedPath ? imports.getImportVar(route.unauthorizedPath) : \"null\"},\n unauthorizeds: [${unauthorizedVars.join(\", \")}],\n }`;\n });\n}\n\nfunction buildGenerateStaticParamsEntries(routes: AppRoute[], imports: ImportAllocator): string[] {\n const entries: string[] = [];\n for (const route of routes) {\n if (!route.isDynamic || !route.pagePath) continue;\n entries.push(\n ` ${JSON.stringify(route.pattern)}: ${imports.getImportVar(route.pagePath)}?.generateStaticParams ?? null,`,\n );\n }\n return entries;\n}\n\nexport function buildAppRscManifestCode(\n options: BuildAppRscManifestCodeOptions,\n): AppRscManifestCode {\n const imports = createImportAllocator();\n const metadataRoutes = options.metadataRoutes ?? [];\n\n registerRouteModules(options.routes, imports);\n const routeEntries = buildRouteEntries(options.routes, imports);\n\n const rootRoute = options.routes.find((r) => r.pattern === \"/\");\n const rootNotFoundVar = rootRoute?.notFoundPath\n ? imports.getImportVar(rootRoute.notFoundPath)\n : null;\n const rootForbiddenVar = rootRoute?.forbiddenPath\n ? imports.getImportVar(rootRoute.forbiddenPath)\n : null;\n const rootUnauthorizedVar = rootRoute?.unauthorizedPath\n ? imports.getImportVar(rootRoute.unauthorizedPath)\n : null;\n const rootLayoutVars = rootRoute ? rootRoute.layouts.map((l) => imports.getImportVar(l)) : [];\n const globalErrorVar = options.globalErrorPath\n ? imports.getImportVar(options.globalErrorPath)\n : null;\n\n const dynamicMetadataRoutes = metadataRoutes.filter((r) => r.isDynamic);\n for (const route of dynamicMetadataRoutes) {\n imports.getImportVar(route.filePath);\n }\n\n return {\n imports: imports.imports,\n routeEntries,\n metaRouteEntries: createMetadataRouteEntriesSource(metadataRoutes, imports.importMap),\n generateStaticParamsEntries: buildGenerateStaticParamsEntries(options.routes, imports),\n rootNotFoundVar,\n rootForbiddenVar,\n rootUnauthorizedVar,\n rootLayoutVars,\n globalErrorVar,\n };\n}\n"],"mappings":";;;AA6BA,SAAS,wBAAy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,YAAY,IAAI;CAC/D,MAAM,kBAAkB,WAAW,eAC/B,QAAQ,aAAa,UAAU,aAAa,GAC5C;CACJ,MAAM,mBAAmB,WAAW,gBAChC,QAAQ,aAAa,UAAU,cAAc,GAC7C;CACJ,MAAM,sBAAsB,WAAW,mBACnC,QAAQ,aAAa,UAAU,iBAAiB,GAChD;CACJ,MAAM,iBAAiB,YAAY,UAAU,QAAQ,KAAK,MAAM,QAAQ,aAAa,EAAE,CAAC,GAAG,EAAE;CAC7F,MAAM,iBAAiB,QAAQ,kBAC3B,QAAQ,aAAa,QAAQ,gBAAgB,GAC7C;CAEJ,MAAM,wBAAwB,eAAe,QAAQ,MAAM,EAAE,UAAU;CACvE,KAAK,MAAM,SAAS,uBAClB,QAAQ,aAAa,MAAM,SAAS;CAGtC,OAAO;EACL,SAAS,QAAQ;EACjB;EACA,kBAAkB,iCAAiC,gBAAgB,QAAQ,UAAU;EACrF,6BAA6B,iCAAiC,QAAQ,QAAQ,QAAQ;EACtF;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"app-ssr-entry.js","names":[],"sources":["../../src/entries/app-ssr-entry.ts"],"sourcesContent":["import { resolveRuntimeEntryModule } from \"./runtime-entry-module.js\";\n\n/**\n * Generate the virtual SSR entry module.\n *\n * This runs in the `ssr` Vite environment. It receives an RSC stream,\n * deserializes it to a React tree, and renders to HTML.\n *\n * When `hasPagesDir` is true (hybrid App + Pages Router project), the SSR\n * entry also re-exports `pageRoutes` from `virtual:vinext-server-entry` so\n * that the Cloudflare Workers RSC bundle can access Pages Router route\n * metadata (including `getStaticPaths`) via `import(\"./ssr/index.js\")`.\n */\nexport function generateSsrEntry(hasPagesDir = false): string {\n const entryPath = resolveRuntimeEntryModule(\"app-ssr-entry\");\n\n return `\nexport * from ${JSON.stringify(entryPath)};\nexport { default } from ${JSON.stringify(entryPath)};\n${\n hasPagesDir\n ? `\nexport { pageRoutes, renderPage } from \"virtual:vinext-server-entry\";\n`\n : \"\"\n}`;\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,iBAAiB,cAAc,OAAe;CAC5D,MAAM,YAAY,0BAA0B,gBAAgB;AAE5D,QAAO;gBACO,KAAK,UAAU,UAAU,CAAC;0BAChB,KAAK,UAAU,UAAU,CAAC;EAElD,cACI;;IAGA"}
1
+ {"version":3,"file":"app-ssr-entry.js","names":[],"sources":["../../src/entries/app-ssr-entry.ts"],"sourcesContent":["import { resolveRuntimeEntryModule } from \"./runtime-entry-module.js\";\n\n/**\n * Generate the virtual SSR entry module.\n *\n * This runs in the `ssr` Vite environment. It receives an RSC stream,\n * deserializes it to a React tree, and renders to HTML.\n *\n * When `hasPagesDir` is true (hybrid App + Pages Router project), the SSR\n * entry also re-exports `pageRoutes` from `virtual:vinext-server-entry` so\n * that the Cloudflare Workers RSC bundle can access Pages Router route\n * metadata (including `getStaticPaths`) via `import(\"./ssr/index.js\")`.\n */\nexport function generateSsrEntry(hasPagesDir = false): string {\n const entryPath = resolveRuntimeEntryModule(\"app-ssr-entry\");\n\n return `\nexport * from ${JSON.stringify(entryPath)};\nexport { default } from ${JSON.stringify(entryPath)};\n${\n hasPagesDir\n ? `\nexport { pageRoutes, renderPage } from \"virtual:vinext-server-entry\";\n`\n : \"\"\n}`;\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,iBAAiB,cAAc,OAAe;CAC5D,MAAM,YAAY,0BAA0B,gBAAgB;CAE5D,OAAO;gBACO,KAAK,UAAU,UAAU,CAAC;0BAChB,KAAK,UAAU,UAAU,CAAC;EAElD,cACI;;IAGA"}
@@ -1 +1 @@
1
- {"version":3,"file":"pages-client-entry.js","names":["pagesPatternToNextFormat"],"sources":["../../src/entries/pages-client-entry.ts"],"sourcesContent":["/**\n * Pages Router client hydration entry generator.\n *\n * Generates the virtual client entry module (`virtual:vinext-client-entry`).\n * This is the entry point for `vite build` (client bundle). It maps route\n * patterns to dynamic imports of page modules so Vite code-splits each page\n * into its own chunk. At runtime it reads __NEXT_DATA__ to determine which\n * page to hydrate.\n *\n * Extracted from index.ts.\n */\nimport {\n pagesRouter,\n patternToNextFormat as pagesPatternToNextFormat,\n type Route,\n} from \"../routing/pages-router.js\";\nimport { createValidFileMatcher } from \"../routing/file-matcher.js\";\nimport { type ResolvedNextConfig } from \"../config/next-config.js\";\nimport { findFileWithExts } from \"./pages-entry-helpers.js\";\nimport { normalizePathSeparators } from \"./runtime-entry-module.js\";\n\nexport async function generateClientEntry(\n pagesDir: string,\n nextConfig: ResolvedNextConfig,\n fileMatcher: ReturnType<typeof createValidFileMatcher>,\n): Promise<string> {\n const pageRoutes = await pagesRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);\n\n const appFilePath = findFileWithExts(pagesDir, \"_app\", fileMatcher);\n const hasApp = appFilePath !== null;\n\n // Build a map of route pattern -> dynamic import.\n // Keys must use Next.js bracket format (e.g. \"/user/[id]\") to match\n // __NEXT_DATA__.page which is set via patternToNextFormat() during SSR.\n const loaderEntries = pageRoutes.map((r: Route) => {\n const absPath = normalizePathSeparators(r.filePath);\n const nextFormatPattern = pagesPatternToNextFormat(r.pattern);\n // JSON.stringify safely escapes quotes, backslashes, and special chars in\n // both the route pattern and the absolute file path.\n // lgtm[js/bad-code-sanitization]\n return ` ${JSON.stringify(nextFormatPattern)}: () => import(${JSON.stringify(absPath)})`;\n });\n\n const appFileBase = appFilePath ? normalizePathSeparators(appFilePath) : undefined;\n\n return `\nimport \"vinext/instrumentation-client\";\nimport React from \"react\";\nimport { hydrateRoot } from \"react-dom/client\";\n// Eagerly import the router shim so its module-level popstate listener is\n// registered. Without this, browser back/forward buttons do nothing because\n// navigateClient() is never invoked on history changes.\nimport \"next/router\";\n\nconst pageLoaders = {\n${loaderEntries.join(\",\\n\")}\n};\n\nasync function hydrate() {\n const nextData = window.__NEXT_DATA__;\n if (!nextData) {\n console.error(\"[vinext] No __NEXT_DATA__ found\");\n return;\n }\n\n const { pageProps } = nextData.props;\n const loader = pageLoaders[nextData.page];\n if (!loader) {\n console.error(\"[vinext] No page loader for route:\", nextData.page);\n return;\n }\n\n const pageModule = await loader();\n const PageComponent = pageModule.default;\n if (!PageComponent) {\n console.error(\"[vinext] Page module has no default export\");\n return;\n }\n\n let element;\n ${\n hasApp\n ? `\n try {\n const appModule = await import(${JSON.stringify(appFileBase!)});\n const AppComponent = appModule.default;\n window.__VINEXT_APP__ = AppComponent;\n element = React.createElement(AppComponent, { Component: PageComponent, pageProps });\n } catch {\n element = React.createElement(PageComponent, pageProps);\n }\n `\n : `\n element = React.createElement(PageComponent, pageProps);\n `\n }\n\n // Wrap with RouterContext.Provider so next/compat/router works during hydration\n const { wrapWithRouterContext } = await import(\"next/router\");\n element = wrapWithRouterContext(element);\n\n const container = document.getElementById(\"__next\");\n if (!container) {\n console.error(\"[vinext] No #__next element found\");\n return;\n }\n\n const root = hydrateRoot(container, element);\n window.__VINEXT_ROOT__ = root;\n window.__VINEXT_HYDRATED_AT = performance.now();\n}\n\nhydrate();\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqBA,eAAsB,oBACpB,UACA,YACA,aACiB;CACjB,MAAM,aAAa,MAAM,YAAY,UAAU,YAAY,gBAAgB,YAAY;CAEvF,MAAM,cAAc,iBAAiB,UAAU,QAAQ,YAAY;CACnE,MAAM,SAAS,gBAAgB;CAK/B,MAAM,gBAAgB,WAAW,KAAK,MAAa;EACjD,MAAM,UAAU,wBAAwB,EAAE,SAAS;EACnD,MAAM,oBAAoBA,oBAAyB,EAAE,QAAQ;AAI7D,SAAO,KAAK,KAAK,UAAU,kBAAkB,CAAC,iBAAiB,KAAK,UAAU,QAAQ,CAAC;GACvF;CAEF,MAAM,cAAc,cAAc,wBAAwB,YAAY,GAAG,KAAA;AAEzE,QAAO;;;;;;;;;;EAUP,cAAc,KAAK,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;IA0BxB,SACI;;qCAE6B,KAAK,UAAU,YAAa,CAAC;;;;;;;MAQ1D;;IAGL"}
1
+ {"version":3,"file":"pages-client-entry.js","names":["pagesPatternToNextFormat"],"sources":["../../src/entries/pages-client-entry.ts"],"sourcesContent":["/**\n * Pages Router client hydration entry generator.\n *\n * Generates the virtual client entry module (`virtual:vinext-client-entry`).\n * This is the entry point for `vite build` (client bundle). It maps route\n * patterns to dynamic imports of page modules so Vite code-splits each page\n * into its own chunk. At runtime it reads __NEXT_DATA__ to determine which\n * page to hydrate.\n *\n * Extracted from index.ts.\n */\nimport {\n pagesRouter,\n patternToNextFormat as pagesPatternToNextFormat,\n type Route,\n} from \"../routing/pages-router.js\";\nimport { createValidFileMatcher } from \"../routing/file-matcher.js\";\nimport { type ResolvedNextConfig } from \"../config/next-config.js\";\nimport { findFileWithExts } from \"./pages-entry-helpers.js\";\nimport { normalizePathSeparators } from \"./runtime-entry-module.js\";\n\nexport async function generateClientEntry(\n pagesDir: string,\n nextConfig: ResolvedNextConfig,\n fileMatcher: ReturnType<typeof createValidFileMatcher>,\n): Promise<string> {\n const pageRoutes = await pagesRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);\n\n const appFilePath = findFileWithExts(pagesDir, \"_app\", fileMatcher);\n const hasApp = appFilePath !== null;\n\n // Build a map of route pattern -> dynamic import.\n // Keys must use Next.js bracket format (e.g. \"/user/[id]\") to match\n // __NEXT_DATA__.page which is set via patternToNextFormat() during SSR.\n const loaderEntries = pageRoutes.map((r: Route) => {\n const absPath = normalizePathSeparators(r.filePath);\n const nextFormatPattern = pagesPatternToNextFormat(r.pattern);\n // JSON.stringify safely escapes quotes, backslashes, and special chars in\n // both the route pattern and the absolute file path.\n // lgtm[js/bad-code-sanitization]\n return ` ${JSON.stringify(nextFormatPattern)}: () => import(${JSON.stringify(absPath)})`;\n });\n\n const appFileBase = appFilePath ? normalizePathSeparators(appFilePath) : undefined;\n\n return `\nimport \"vinext/instrumentation-client\";\nimport React from \"react\";\nimport { hydrateRoot } from \"react-dom/client\";\n// Eagerly import the router shim so its module-level popstate listener is\n// registered. Without this, browser back/forward buttons do nothing because\n// navigateClient() is never invoked on history changes.\nimport \"next/router\";\n\nconst pageLoaders = {\n${loaderEntries.join(\",\\n\")}\n};\n\nasync function hydrate() {\n const nextData = window.__NEXT_DATA__;\n if (!nextData) {\n console.error(\"[vinext] No __NEXT_DATA__ found\");\n return;\n }\n\n const { pageProps } = nextData.props;\n const loader = pageLoaders[nextData.page];\n if (!loader) {\n console.error(\"[vinext] No page loader for route:\", nextData.page);\n return;\n }\n\n const pageModule = await loader();\n const PageComponent = pageModule.default;\n if (!PageComponent) {\n console.error(\"[vinext] Page module has no default export\");\n return;\n }\n\n let element;\n ${\n hasApp\n ? `\n try {\n const appModule = await import(${JSON.stringify(appFileBase!)});\n const AppComponent = appModule.default;\n window.__VINEXT_APP__ = AppComponent;\n element = React.createElement(AppComponent, { Component: PageComponent, pageProps });\n } catch {\n element = React.createElement(PageComponent, pageProps);\n }\n `\n : `\n element = React.createElement(PageComponent, pageProps);\n `\n }\n\n // Wrap with RouterContext.Provider so next/compat/router works during hydration\n const { wrapWithRouterContext } = await import(\"next/router\");\n element = wrapWithRouterContext(element);\n\n const container = document.getElementById(\"__next\");\n if (!container) {\n console.error(\"[vinext] No #__next element found\");\n return;\n }\n\n const root = hydrateRoot(container, element);\n window.__VINEXT_ROOT__ = root;\n window.__VINEXT_HYDRATED_AT = performance.now();\n}\n\nhydrate();\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqBA,eAAsB,oBACpB,UACA,YACA,aACiB;CACjB,MAAM,aAAa,MAAM,YAAY,UAAU,YAAY,gBAAgB,YAAY;CAEvF,MAAM,cAAc,iBAAiB,UAAU,QAAQ,YAAY;CACnE,MAAM,SAAS,gBAAgB;CAK/B,MAAM,gBAAgB,WAAW,KAAK,MAAa;EACjD,MAAM,UAAU,wBAAwB,EAAE,SAAS;EACnD,MAAM,oBAAoBA,oBAAyB,EAAE,QAAQ;EAI7D,OAAO,KAAK,KAAK,UAAU,kBAAkB,CAAC,iBAAiB,KAAK,UAAU,QAAQ,CAAC;GACvF;CAEF,MAAM,cAAc,cAAc,wBAAwB,YAAY,GAAG,KAAA;CAEzE,OAAO;;;;;;;;;;EAUP,cAAc,KAAK,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;IA0BxB,SACI;;qCAE6B,KAAK,UAAU,YAAa,CAAC;;;;;;;MAQ1D;;IAGL"}
@@ -1 +1 @@
1
- {"version":3,"file":"pages-entry-helpers.js","names":[],"sources":["../../src/entries/pages-entry-helpers.ts"],"sourcesContent":["/**\n * Shared helpers used by the Pages Router entry generators.\n */\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport { createValidFileMatcher } from \"../routing/file-matcher.js\";\n\n/**\n * Find a file with any of the valid extensions in the given directory.\n * Returns the first matching absolute path, or null if not found.\n */\nexport function findFileWithExts(\n dir: string,\n name: string,\n matcher: ReturnType<typeof createValidFileMatcher>,\n): string | null {\n for (const ext of matcher.dottedExtensions) {\n const filePath = path.join(dir, name + ext);\n if (fs.existsSync(filePath)) return filePath;\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,iBACd,KACA,MACA,SACe;AACf,MAAK,MAAM,OAAO,QAAQ,kBAAkB;EAC1C,MAAM,WAAW,KAAK,KAAK,KAAK,OAAO,IAAI;AAC3C,MAAI,GAAG,WAAW,SAAS,CAAE,QAAO;;AAEtC,QAAO"}
1
+ {"version":3,"file":"pages-entry-helpers.js","names":[],"sources":["../../src/entries/pages-entry-helpers.ts"],"sourcesContent":["/**\n * Shared helpers used by the Pages Router entry generators.\n */\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport { createValidFileMatcher } from \"../routing/file-matcher.js\";\n\n/**\n * Find a file with any of the valid extensions in the given directory.\n * Returns the first matching absolute path, or null if not found.\n */\nexport function findFileWithExts(\n dir: string,\n name: string,\n matcher: ReturnType<typeof createValidFileMatcher>,\n): string | null {\n for (const ext of matcher.dottedExtensions) {\n const filePath = path.join(dir, name + ext);\n if (fs.existsSync(filePath)) return filePath;\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,iBACd,KACA,MACA,SACe;CACf,KAAK,MAAM,OAAO,QAAQ,kBAAkB;EAC1C,MAAM,WAAW,KAAK,KAAK,KAAK,OAAO,IAAI;EAC3C,IAAI,GAAG,WAAW,SAAS,EAAE,OAAO;;CAEtC,OAAO"}
@@ -69,6 +69,7 @@ async function generateServerEntry(pagesDir, nextConfig, fileMatcher, middleware
69
69
  deviceSizes: nextConfig?.images?.deviceSizes,
70
70
  imageSizes: nextConfig?.images?.imageSizes,
71
71
  dangerouslyAllowSVG: nextConfig?.images?.dangerouslyAllowSVG,
72
+ dangerouslyAllowLocalIP: nextConfig?.images?.dangerouslyAllowLocalIP,
72
73
  contentDispositionType: nextConfig?.images?.contentDispositionType,
73
74
  contentSecurityPolicy: nextConfig?.images?.contentSecurityPolicy
74
75
  }
@@ -209,6 +210,20 @@ function matchRoute(url, routes) {
209
210
  return _trieMatch(trie, urlParts);
210
211
  }
211
212
 
213
+ export function matchPageRoute(url, request) {
214
+ const routeUrl = i18nConfig && request
215
+ ? resolvePagesI18nRequest(
216
+ url,
217
+ i18nConfig,
218
+ request.headers,
219
+ new URL(request.url).hostname,
220
+ vinextConfig.basePath,
221
+ vinextConfig.trailingSlash,
222
+ ).url
223
+ : url;
224
+ return matchRoute(routeUrl, pageRoutes);
225
+ }
226
+
212
227
  function parseQuery(url) {
213
228
  const qs = url.split("?")[1];
214
229
  if (!qs) return {};
@@ -1 +1 @@
1
- {"version":3,"file":"pages-server-entry.js","names":[],"sources":["../../src/entries/pages-server-entry.ts"],"sourcesContent":["/**\n * Pages Router server entry generator.\n *\n * Generates the virtual SSR server entry module (`virtual:vinext-server-entry`).\n * This is the entry point for `vite build --ssr`. It handles SSR, API routes,\n * middleware, ISR, and i18n for the Pages Router.\n *\n * Extracted from index.ts.\n */\nimport { resolveEntryPath, normalizePathSeparators } from \"./runtime-entry-module.js\";\nimport { pagesRouter, apiRouter, type Route } from \"../routing/pages-router.js\";\nimport { createValidFileMatcher } from \"../routing/file-matcher.js\";\nimport { type ResolvedNextConfig } from \"../config/next-config.js\";\nimport { isProxyFile } from \"../server/middleware.js\";\nimport { findFileWithExts } from \"./pages-entry-helpers.js\";\n\nconst _requestContextShimPath = resolveEntryPath(\"../shims/request-context.js\", import.meta.url);\nconst _middlewareRuntimePath = resolveEntryPath(\"../server/middleware-runtime.js\", import.meta.url);\nconst _routeTriePath = resolveEntryPath(\"../routing/route-trie.js\", import.meta.url);\nconst _pagesI18nPath = resolveEntryPath(\"../server/pages-i18n.js\", import.meta.url);\nconst _pagesPageResponsePath = resolveEntryPath(\n \"../server/pages-page-response.js\",\n import.meta.url,\n);\nconst _pagesPageDataPath = resolveEntryPath(\"../server/pages-page-data.js\", import.meta.url);\nconst _pagesNodeCompatPath = resolveEntryPath(\"../server/pages-node-compat.js\", import.meta.url);\nconst _pagesApiRoutePath = resolveEntryPath(\"../server/pages-api-route.js\", import.meta.url);\nconst _isrCachePath = resolveEntryPath(\"../server/isr-cache.js\", import.meta.url);\nconst _cspPath = resolveEntryPath(\"../server/csp.js\", import.meta.url);\n\n/**\n * Generate the virtual SSR server entry module.\n * This is the entry point for `vite build --ssr`.\n */\nexport async function generateServerEntry(\n pagesDir: string,\n nextConfig: ResolvedNextConfig,\n fileMatcher: ReturnType<typeof createValidFileMatcher>,\n middlewarePath: string | null,\n instrumentationPath: string | null,\n): Promise<string> {\n const pageRoutes = await pagesRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);\n const apiRoutes = await apiRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);\n\n // Generate import statements using absolute paths since virtual\n // modules don't have a real file location for relative resolution.\n const pageImports = pageRoutes.map((r: Route, i: number) => {\n const absPath = normalizePathSeparators(r.filePath);\n return `import * as page_${i} from ${JSON.stringify(absPath)};`;\n });\n\n const apiImports = apiRoutes.map((r: Route, i: number) => {\n const absPath = normalizePathSeparators(r.filePath);\n return `import * as api_${i} from ${JSON.stringify(absPath)};`;\n });\n\n // Build the route table — include filePath for SSR manifest lookup\n const pageRouteEntries = pageRoutes.map((r: Route, i: number) => {\n const absPath = normalizePathSeparators(r.filePath);\n return ` { pattern: ${JSON.stringify(r.pattern)}, patternParts: ${JSON.stringify(r.patternParts)}, isDynamic: ${r.isDynamic}, params: ${JSON.stringify(r.params)}, module: page_${i}, filePath: ${JSON.stringify(absPath)} }`;\n });\n\n const apiRouteEntries = apiRoutes.map(\n (r: Route, i: number) =>\n ` { pattern: ${JSON.stringify(r.pattern)}, patternParts: ${JSON.stringify(r.patternParts)}, isDynamic: ${r.isDynamic}, params: ${JSON.stringify(r.params)}, module: api_${i} }`,\n );\n\n // Check for _app and _document\n const appFilePath = findFileWithExts(pagesDir, \"_app\", fileMatcher);\n const docFilePath = findFileWithExts(pagesDir, \"_document\", fileMatcher);\n const appImportCode =\n appFilePath !== null\n ? `import { default as AppComponent } from ${JSON.stringify(normalizePathSeparators(appFilePath))};`\n : `const AppComponent = null;`;\n\n const docImportCode =\n docFilePath !== null\n ? `import { default as DocumentComponent } from ${JSON.stringify(normalizePathSeparators(docFilePath))};`\n : `const DocumentComponent = null;`;\n\n // Serialize i18n config for embedding in the server entry\n const i18nConfigJson = nextConfig?.i18n\n ? JSON.stringify({\n locales: nextConfig.i18n.locales,\n defaultLocale: nextConfig.i18n.defaultLocale,\n localeDetection: nextConfig.i18n.localeDetection,\n domains: nextConfig.i18n.domains,\n })\n : \"null\";\n\n // Embed the resolved build ID at build time\n const buildIdJson = JSON.stringify(nextConfig?.buildId ?? null);\n\n // Serialize the full resolved config for the production server.\n // This embeds redirects, rewrites, headers, basePath, trailingSlash\n // so prod-server.ts can apply them without loading next.config.js at runtime.\n const vinextConfigJson = JSON.stringify({\n basePath: nextConfig?.basePath ?? \"\",\n trailingSlash: nextConfig?.trailingSlash ?? false,\n redirects: nextConfig?.redirects ?? [],\n rewrites: nextConfig?.rewrites ?? { beforeFiles: [], afterFiles: [], fallback: [] },\n headers: nextConfig?.headers ?? [],\n expireTime: nextConfig?.expireTime,\n i18n: nextConfig?.i18n ?? null,\n images: {\n deviceSizes: nextConfig?.images?.deviceSizes,\n imageSizes: nextConfig?.images?.imageSizes,\n dangerouslyAllowSVG: nextConfig?.images?.dangerouslyAllowSVG,\n contentDispositionType: nextConfig?.images?.contentDispositionType,\n contentSecurityPolicy: nextConfig?.images?.contentSecurityPolicy,\n },\n });\n\n // Generate instrumentation code if instrumentation.ts exists.\n // For production (Cloudflare Workers), instrumentation.ts is bundled into the\n // Worker and register() is called as a top-level await at module evaluation time —\n // before any request is handled. This mirrors App Router behavior (generateRscEntry)\n // and matches Next.js semantics: register() runs once on startup in the process\n // that handles requests.\n //\n // The onRequestError handler is stored on globalThis so it is visible across\n // all code within the Worker (same global scope).\n const instrumentationImportCode = instrumentationPath\n ? `import * as _instrumentation from ${JSON.stringify(normalizePathSeparators(instrumentationPath))};`\n : \"\";\n\n const instrumentationInitCode = instrumentationPath\n ? `// Run instrumentation register() once at module evaluation time — before any\n// requests are handled. Matches Next.js semantics: register() is called once\n// on startup in the process that handles requests.\nif (typeof _instrumentation.register === \"function\") {\n await _instrumentation.register();\n}\n// Store the onRequestError handler on globalThis so it is visible to all\n// code within the Worker (same global scope).\nif (typeof _instrumentation.onRequestError === \"function\") {\n globalThis.__VINEXT_onRequestErrorHandler__ = _instrumentation.onRequestError;\n}`\n : \"\";\n\n // Generate middleware code if middleware.ts exists\n const middlewareImportCode = middlewarePath\n ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};`\n : \"\";\n\n // The matcher config is read from the middleware module at request time.\n // The generated entry only wires the user module into the shared runtime\n // helper; matcher, execution, waitUntil, and result shaping live in normal\n // TypeScript modules so dev/prod paths cannot drift.\n const middlewareExportCode = middlewarePath\n ? `\nexport async function runMiddleware(request, ctx) {\n return __runGeneratedMiddleware({\n basePath: vinextConfig.basePath,\n ctx,\n i18nConfig,\n isProxy: ${JSON.stringify(isProxyFile(middlewarePath))},\n module: middlewareModule,\n request,\n });\n}\n`\n : `\nexport async function runMiddleware() { return { continue: true }; }\n`;\n\n // The server entry is a self-contained module that uses Web-standard APIs\n // (Request/Response, renderToReadableStream) so it runs on Cloudflare Workers.\n return `\nimport React from \"react\";\nimport { renderToReadableStream } from \"react-dom/server.edge\";\nimport { resetSSRHead, getSSRHeadHTML } from \"next/head\";\nimport { flushPreloads } from \"next/dynamic\";\nimport { setSSRContext, wrapWithRouterContext } from \"next/router\";\nimport { _runWithCacheState } from \"next/cache\";\nimport { runWithPrivateCache } from \"vinext/cache-runtime\";\nimport { ensureFetchPatch, runWithFetchCache } from \"vinext/fetch-cache\";\nimport { runWithRequestContext as _runWithUnifiedCtx, createRequestContext as _createUnifiedCtx } from \"vinext/unified-request-context\";\nimport \"vinext/router-state\";\nimport { runWithServerInsertedHTMLState } from \"vinext/navigation-state\";\nimport { runWithHeadState } from \"vinext/head-state\";\nimport \"vinext/i18n-state\";\nimport { setI18nContext } from \"vinext/i18n-context\";\nimport { createNonceAttribute as __createNonceAttribute, safeJsonStringify } from \"vinext/html\";\nimport { getSSRFontLinks as _getSSRFontLinks, getSSRFontStyles as _getSSRFontStylesGoogle, getSSRFontPreloads as _getSSRFontPreloadsGoogle } from \"next/font/google\";\nimport { getSSRFontStyles as _getSSRFontStylesLocal, getSSRFontPreloads as _getSSRFontPreloadsLocal } from \"next/font/local\";\nimport { sanitizeDestination as sanitizeDestinationLocal } from ${JSON.stringify(resolveEntryPath(\"../config/config-matchers.js\", import.meta.url))};\nimport { runWithExecutionContext as _runWithExecutionContext, getRequestExecutionContext as _getRequestExecutionContext } from ${JSON.stringify(_requestContextShimPath)};\nimport { runGeneratedMiddleware as __runGeneratedMiddleware } from ${JSON.stringify(_middlewareRuntimePath)};\nimport { buildRouteTrie as _buildRouteTrie, trieMatch as _trieMatch } from ${JSON.stringify(_routeTriePath)};\nimport { reportRequestError as _reportRequestError } from \"vinext/instrumentation\";\nimport { resolvePagesI18nRequest } from ${JSON.stringify(_pagesI18nPath)};\nimport { createPagesReqRes as __createPagesReqRes } from ${JSON.stringify(_pagesNodeCompatPath)};\nimport { handlePagesApiRoute as __handlePagesApiRoute } from ${JSON.stringify(_pagesApiRoutePath)};\nimport {\n isrGet as __sharedIsrGet,\n isrSet as __sharedIsrSet,\n isrCacheKey as __sharedIsrCacheKey,\n triggerBackgroundRegeneration as __sharedTriggerBackgroundRegeneration,\n} from ${JSON.stringify(_isrCachePath)};\nimport { getScriptNonceFromHeaderSources as __getScriptNonceFromHeaderSources } from ${JSON.stringify(_cspPath)};\nimport { resolvePagesPageData as __resolvePagesPageData } from ${JSON.stringify(_pagesPageDataPath)};\nimport { renderPagesPageResponse as __renderPagesPageResponse } from ${JSON.stringify(_pagesPageResponsePath)};\n${instrumentationImportCode}\n${middlewareImportCode}\n\n${instrumentationInitCode}\n\n// i18n config (embedded at build time)\nconst i18nConfig = ${i18nConfigJson};\n\n// Build ID (embedded at build time)\nconst buildId = ${buildIdJson};\n\n// Full resolved config for production server (embedded at build time)\nexport const vinextConfig = ${vinextConfigJson};\n\nfunction isrGet(key) {\n return __sharedIsrGet(key);\n}\nfunction isrSet(key, data, revalidateSeconds, tags, expireSeconds) {\n return __sharedIsrSet(key, data, revalidateSeconds, tags, expireSeconds);\n}\nfunction triggerBackgroundRegeneration(key, renderFn, errorContext) {\n return __sharedTriggerBackgroundRegeneration(key, renderFn, errorContext);\n}\nfunction isrCacheKey(router, pathname) {\n return __sharedIsrCacheKey(router, pathname, buildId || undefined);\n}\n\nasync function renderToStringAsync(element) {\n const stream = await renderToReadableStream(element);\n await stream.allReady;\n return new Response(stream).text();\n}\n\nasync function renderIsrPassToStringAsync(element) {\n // The cache-fill render is a second render pass for the same request.\n // Reset render-scoped state so it cannot leak from the streamed response\n // render or affect async work that is still draining from that stream.\n // Keep request identity state (pathname/query/locale/executionContext)\n // intact: this second pass still belongs to the same request.\n return await runWithServerInsertedHTMLState(() =>\n runWithHeadState(() =>\n _runWithCacheState(() =>\n runWithPrivateCache(() => runWithFetchCache(async () => renderToStringAsync(element))),\n ),\n ),\n );\n}\n\n${pageImports.join(\"\\n\")}\n${apiImports.join(\"\\n\")}\n\n${appImportCode}\n${docImportCode}\n\nexport const pageRoutes = [\n${pageRouteEntries.join(\",\\n\")}\n];\nconst _pageRouteTrie = _buildRouteTrie(pageRoutes);\n\nconst apiRoutes = [\n${apiRouteEntries.join(\",\\n\")}\n];\nconst _apiRouteTrie = _buildRouteTrie(apiRoutes);\n\nfunction matchRoute(url, routes) {\n const pathname = url.split(\"?\")[0];\n let normalizedUrl = pathname === \"/\" ? \"/\" : pathname.replace(/\\\\/$/, \"\");\n // NOTE: Do NOT decodeURIComponent here. The pathname is already decoded at\n // the entry point. Decoding again would create a double-decode vector.\n const urlParts = normalizedUrl.split(\"/\").filter(Boolean);\n const trie = routes === pageRoutes ? _pageRouteTrie : _apiRouteTrie;\n return _trieMatch(trie, urlParts);\n}\n\nfunction parseQuery(url) {\n const qs = url.split(\"?\")[1];\n if (!qs) return {};\n const p = new URLSearchParams(qs);\n const q = {};\n for (const [k, v] of p) {\n if (k in q) {\n q[k] = Array.isArray(q[k]) ? q[k].concat(v) : [q[k], v];\n } else {\n q[k] = v;\n }\n }\n return q;\n}\n\nfunction mergeRouteParamsIntoQuery(query, params) {\n return Object.assign(query, params);\n}\n\nfunction patternToNextFormat(pattern) {\n // Match any non-/ param name. Non-greedy with lookahead prevents\n // the +/* suffix being consumed into the param name when the name\n // itself contains + or * internally (e.g. :c++lang → [c++lang]).\n return pattern\n .replace(/:([^\\\\/]+?)\\\\+(?=\\\\/|$)/g, \"[...$1]\")\n .replace(/:([^\\\\/]+?)\\\\*(?=\\\\/|$)/g, \"[[...$1]]\")\n .replace(/:([^\\\\/]+?)(?=\\\\/|$)/g, \"[$1]\");\n}\n\nfunction collectAssetTags(manifest, moduleIds, scriptNonce) {\n // Fall back to embedded manifest (set by vinext:cloudflare-build for Workers)\n const m = (manifest && Object.keys(manifest).length > 0)\n ? manifest\n : (typeof globalThis !== \"undefined\" && globalThis.__VINEXT_SSR_MANIFEST__) || null;\n const tags = [];\n const seen = new Set();\n const nonceAttr = __createNonceAttribute(scriptNonce);\n\n // Load the set of lazy chunk filenames (only reachable via dynamic imports).\n // These should NOT get <link rel=\"modulepreload\"> or <script type=\"module\">\n // tags — they are fetched on demand when the dynamic import() executes (e.g.\n // chunks behind React.lazy() or next/dynamic boundaries).\n var lazyChunks = (typeof globalThis !== \"undefined\" && globalThis.__VINEXT_LAZY_CHUNKS__) || null;\n var lazySet = lazyChunks && lazyChunks.length > 0 ? new Set(lazyChunks) : null;\n\n // Inject the client entry script if embedded by vinext:cloudflare-build\n if (typeof globalThis !== \"undefined\" && globalThis.__VINEXT_CLIENT_ENTRY__) {\n const entry = globalThis.__VINEXT_CLIENT_ENTRY__;\n seen.add(entry);\n tags.push('<link rel=\"modulepreload\"' + nonceAttr + ' href=\"/' + entry + '\" />');\n tags.push('<script type=\"module\"' + nonceAttr + ' src=\"/' + entry + '\" crossorigin></script>');\n }\n if (m) {\n // Always inject shared chunks (framework, vinext runtime, entry) and\n // page-specific chunks. The manifest maps module file paths to their\n // associated JS/CSS assets.\n //\n // For page-specific injection, the module IDs may be absolute paths\n // while the manifest uses relative paths. Try both the original ID\n // and a suffix match to find the correct manifest entry.\n var allFiles = [];\n\n if (moduleIds && moduleIds.length > 0) {\n // Collect assets for the requested page modules\n for (var mi = 0; mi < moduleIds.length; mi++) {\n var id = moduleIds[mi];\n var files = m[id];\n if (!files) {\n // Absolute path didn't match — try matching by suffix.\n // Manifest keys are relative (e.g. \"pages/about.tsx\") while\n // moduleIds may be absolute (e.g. \"/home/.../pages/about.tsx\").\n for (var mk in m) {\n if (id.endsWith(\"/\" + mk) || id === mk) {\n files = m[mk];\n break;\n }\n }\n }\n if (files) {\n for (var fi = 0; fi < files.length; fi++) allFiles.push(files[fi]);\n }\n }\n\n // Also inject shared chunks that every page needs: framework,\n // vinext runtime, and the entry bootstrap. These are identified\n // by scanning all manifest values for chunk filenames containing\n // known prefixes.\n for (var key in m) {\n var vals = m[key];\n if (!vals) continue;\n for (var vi = 0; vi < vals.length; vi++) {\n var file = vals[vi];\n var basename = file.split(\"/\").pop() || \"\";\n if (\n basename.startsWith(\"framework-\") ||\n basename.startsWith(\"vinext-\") ||\n basename.includes(\"vinext-client-entry\") ||\n basename.includes(\"vinext-app-browser-entry\")\n ) {\n allFiles.push(file);\n }\n }\n }\n } else {\n // No specific modules — include all assets from manifest\n for (var akey in m) {\n var avals = m[akey];\n if (avals) {\n for (var ai = 0; ai < avals.length; ai++) allFiles.push(avals[ai]);\n }\n }\n }\n\n for (var ti = 0; ti < allFiles.length; ti++) {\n var tf = allFiles[ti];\n // Normalize: Vite's SSR manifest values include a leading '/'\n // (from base path), but we prepend '/' ourselves when building\n // href/src attributes. Strip any existing leading slash to avoid\n // producing protocol-relative URLs like \"//assets/chunk.js\".\n // This also ensures consistent keys for the seen-set dedup and\n // lazySet.has() checks (which use values without leading slash).\n if (tf.charAt(0) === '/') tf = tf.slice(1);\n if (seen.has(tf)) continue;\n seen.add(tf);\n if (tf.endsWith(\".css\")) {\n tags.push('<link rel=\"stylesheet\"' + nonceAttr + ' href=\"/' + tf + '\" />');\n } else if (tf.endsWith(\".js\")) {\n // Skip lazy chunks — they are behind dynamic import() boundaries\n // (React.lazy, next/dynamic) and should only be fetched on demand.\n if (lazySet && lazySet.has(tf)) continue;\n tags.push('<link rel=\"modulepreload\"' + nonceAttr + ' href=\"/' + tf + '\" />');\n tags.push('<script type=\"module\"' + nonceAttr + ' src=\"/' + tf + '\" crossorigin></script>');\n }\n }\n }\n return tags.join(\"\\\\n \");\n}\n\nexport async function renderPage(request, url, manifest, ctx, middlewareHeaders) {\n if (ctx) return _runWithExecutionContext(ctx, () => _renderPage(request, url, manifest, middlewareHeaders));\n return _renderPage(request, url, manifest, middlewareHeaders);\n}\n\nasync function _renderPage(request, url, manifest, middlewareHeaders) {\n const localeInfo = i18nConfig\n ? resolvePagesI18nRequest(\n url,\n i18nConfig,\n request.headers,\n new URL(request.url).hostname,\n vinextConfig.basePath,\n vinextConfig.trailingSlash,\n )\n : { locale: undefined, url, hadPrefix: false, domainLocale: undefined, redirectUrl: undefined };\n const locale = localeInfo.locale;\n const routeUrl = localeInfo.url;\n const currentDefaultLocale = i18nConfig\n ? (localeInfo.domainLocale ? localeInfo.domainLocale.defaultLocale : i18nConfig.defaultLocale)\n : undefined;\n const domainLocales = i18nConfig ? i18nConfig.domains : undefined;\n\n if (localeInfo.redirectUrl) {\n return new Response(null, { status: 307, headers: { Location: localeInfo.redirectUrl } });\n }\n\n const match = matchRoute(routeUrl, pageRoutes);\n if (!match) {\n return new Response(\"<!DOCTYPE html><html><body><h1>404 - Page not found</h1></body></html>\",\n { status: 404, headers: { \"Content-Type\": \"text/html\" } });\n }\n\n const { route, params } = match;\n const __uCtx = _createUnifiedCtx({\n executionContext: _getRequestExecutionContext(),\n });\n return _runWithUnifiedCtx(__uCtx, async () => {\n ensureFetchPatch();\n try {\n const routePattern = patternToNextFormat(route.pattern);\n const query = mergeRouteParamsIntoQuery(parseQuery(routeUrl), params);\n if (typeof setSSRContext === \"function\") {\n setSSRContext({\n pathname: routePattern,\n query,\n asPath: routeUrl,\n locale: locale,\n locales: i18nConfig ? i18nConfig.locales : undefined,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n });\n }\n\n if (i18nConfig) {\n setI18nContext({\n locale: locale,\n locales: i18nConfig.locales,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n hostname: new URL(request.url).hostname,\n });\n }\n\n const pageModule = route.module;\n const PageComponent = pageModule.default;\n if (!PageComponent) {\n return new Response(\"Page has no default export\", { status: 500 });\n }\n const scriptNonce = __getScriptNonceFromHeaderSources(request.headers, middlewareHeaders);\n // Build font Link header early so it's available for ISR cached responses too.\n // Font preloads are module-level state populated at import time and persist across requests.\n var _fontLinkHeader = \"\";\n var _allFp = [];\n try {\n var _fpGoogle = typeof _getSSRFontPreloadsGoogle === \"function\" ? _getSSRFontPreloadsGoogle() : [];\n var _fpLocal = typeof _getSSRFontPreloadsLocal === \"function\" ? _getSSRFontPreloadsLocal() : [];\n _allFp = _fpGoogle.concat(_fpLocal);\n if (_allFp.length > 0) {\n _fontLinkHeader = _allFp.map(function(p) { return \"<\" + p.href + \">; rel=preload; as=font; type=\" + p.type + \"; crossorigin\"; }).join(\", \");\n }\n } catch (e) { /* font preloads not available */ }\n const pageDataResult = await __resolvePagesPageData({\n applyRequestContexts() {\n if (typeof setSSRContext === \"function\") {\n setSSRContext({\n pathname: routePattern,\n query,\n asPath: routeUrl,\n locale: locale,\n locales: i18nConfig ? i18nConfig.locales : undefined,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n });\n }\n if (i18nConfig) {\n setI18nContext({\n locale: locale,\n locales: i18nConfig.locales,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n hostname: new URL(request.url).hostname,\n });\n }\n },\n buildId,\n createGsspReqRes() {\n return __createPagesReqRes({ body: undefined, query, request, url: routeUrl });\n },\n createPageElement(currentPageProps) {\n var currentElement = AppComponent\n ? React.createElement(AppComponent, { Component: PageComponent, pageProps: currentPageProps })\n : React.createElement(PageComponent, currentPageProps);\n return wrapWithRouterContext(currentElement);\n },\n fontLinkHeader: _fontLinkHeader,\n i18n: {\n locale: locale,\n locales: i18nConfig ? i18nConfig.locales : undefined,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n },\n isrCacheKey,\n isrGet,\n isrSet,\n expireSeconds: vinextConfig.expireTime,\n pageModule,\n params,\n query,\n renderIsrPassToStringAsync,\n route: {\n isDynamic: route.isDynamic,\n },\n routePattern,\n routeUrl,\n runInFreshUnifiedContext(callback) {\n var revalCtx = _createUnifiedCtx({\n executionContext: _getRequestExecutionContext(),\n });\n return _runWithUnifiedCtx(revalCtx, async () => {\n ensureFetchPatch();\n return callback();\n });\n },\n safeJsonStringify,\n sanitizeDestination: sanitizeDestinationLocal,\n scriptNonce,\n triggerBackgroundRegeneration,\n });\n if (pageDataResult.kind === \"response\") {\n return pageDataResult.response;\n }\n let pageProps = pageDataResult.pageProps;\n var gsspRes = pageDataResult.gsspRes;\n let isrRevalidateSeconds = pageDataResult.isrRevalidateSeconds;\n\n const pageModuleIds = route.filePath ? [route.filePath] : [];\n const assetTags = collectAssetTags(manifest, pageModuleIds, scriptNonce);\n\n return __renderPagesPageResponse({\n assetTags,\n buildId,\n clearSsrContext() {\n if (typeof setSSRContext === \"function\") setSSRContext(null);\n },\n createPageElement(currentPageProps) {\n var currentElement;\n if (AppComponent) {\n currentElement = React.createElement(AppComponent, { Component: PageComponent, pageProps: currentPageProps });\n } else {\n currentElement = React.createElement(PageComponent, currentPageProps);\n }\n return wrapWithRouterContext(currentElement);\n },\n DocumentComponent,\n flushPreloads: typeof flushPreloads === \"function\" ? flushPreloads : undefined,\n fontLinkHeader: _fontLinkHeader,\n fontPreloads: _allFp,\n getFontLinks() {\n try {\n return typeof _getSSRFontLinks === \"function\" ? _getSSRFontLinks() : [];\n } catch (e) {\n return [];\n }\n },\n getFontStyles() {\n try {\n var allFontStyles = [];\n if (typeof _getSSRFontStylesGoogle === \"function\") allFontStyles.push(..._getSSRFontStylesGoogle());\n if (typeof _getSSRFontStylesLocal === \"function\") allFontStyles.push(..._getSSRFontStylesLocal());\n return allFontStyles;\n } catch (e) {\n return [];\n }\n },\n getSSRHeadHTML: typeof getSSRHeadHTML === \"function\" ? getSSRHeadHTML : undefined,\n gsspRes,\n isrCacheKey,\n expireSeconds: vinextConfig.expireTime,\n isrRevalidateSeconds,\n isrSet,\n i18n: {\n locale: locale,\n locales: i18nConfig ? i18nConfig.locales : undefined,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n },\n pageProps,\n params,\n renderDocumentToString(element) {\n return renderToStringAsync(element);\n },\n renderToReadableStream(element) {\n return renderToReadableStream(element);\n },\n resetSSRHead: typeof resetSSRHead === \"function\" ? resetSSRHead : undefined,\n routePattern,\n routeUrl,\n safeJsonStringify,\n scriptNonce,\n });\n } catch (e) {\n console.error(\"[vinext] SSR error:\", e);\n _reportRequestError(\n e instanceof Error ? e : new Error(String(e)),\n { path: url, method: request.method, headers: Object.fromEntries(request.headers.entries()) },\n { routerKind: \"Pages Router\", routePath: route.pattern, routeType: \"render\" },\n ).catch(() => { /* ignore reporting errors */ });\n return new Response(\"Internal Server Error\", { status: 500 });\n }\n });\n}\n\nexport async function handleApiRoute(request, url) {\n const match = matchRoute(url, apiRoutes);\n return __handlePagesApiRoute({\n match,\n request,\n url,\n reportRequestError(error, routePattern) {\n console.error(\"[vinext] API error:\", error);\n void _reportRequestError(\n error,\n { path: url, method: request.method, headers: Object.fromEntries(request.headers.entries()) },\n { routerKind: \"Pages Router\", routePath: routePattern, routeType: \"route\" },\n );\n },\n });\n}\n\n${middlewareExportCode}\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,0BAA0B,iBAAiB,+BAA+B,OAAO,KAAK,IAAI;AAChG,MAAM,yBAAyB,iBAAiB,mCAAmC,OAAO,KAAK,IAAI;AACnG,MAAM,iBAAiB,iBAAiB,4BAA4B,OAAO,KAAK,IAAI;AACpF,MAAM,iBAAiB,iBAAiB,2BAA2B,OAAO,KAAK,IAAI;AACnF,MAAM,yBAAyB,iBAC7B,oCACA,OAAO,KAAK,IACb;AACD,MAAM,qBAAqB,iBAAiB,gCAAgC,OAAO,KAAK,IAAI;AAC5F,MAAM,uBAAuB,iBAAiB,kCAAkC,OAAO,KAAK,IAAI;AAChG,MAAM,qBAAqB,iBAAiB,gCAAgC,OAAO,KAAK,IAAI;AAC5F,MAAM,gBAAgB,iBAAiB,0BAA0B,OAAO,KAAK,IAAI;AACjF,MAAM,WAAW,iBAAiB,oBAAoB,OAAO,KAAK,IAAI;;;;;AAMtE,eAAsB,oBACpB,UACA,YACA,aACA,gBACA,qBACiB;CACjB,MAAM,aAAa,MAAM,YAAY,UAAU,YAAY,gBAAgB,YAAY;C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AK,UAAU,uBAAuB,CAAC;EAC5G,0BAA0B;EAC1B,qBAAqB;;EAErB,wBAAwB;;;qBAGL,eAAe;;;kBAGlB,YAAY;;;8BAGA,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoC7C,YAAY,KAAK,KAAK,CAAC;EACvB,WAAW,KAAK,KAAK,CAAC;;EAEtB,cAAc;EACd,cAAc;;;EAGd,iBAAiB,KAAK,MAAM,CAAC;;;;;EAK7B,gBAAgB,KAAK,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkZ5B,qBAAqB"}
1
+ {"version":3,"file":"pages-server-entry.js","names":[],"sources":["../../src/entries/pages-server-entry.ts"],"sourcesContent":["/**\n * Pages Router server entry generator.\n *\n * Generates the virtual SSR server entry module (`virtual:vinext-server-entry`).\n * This is the entry point for `vite build --ssr`. It handles SSR, API routes,\n * middleware, ISR, and i18n for the Pages Router.\n *\n * Extracted from index.ts.\n */\nimport { resolveEntryPath, normalizePathSeparators } from \"./runtime-entry-module.js\";\nimport { pagesRouter, apiRouter, type Route } from \"../routing/pages-router.js\";\nimport { createValidFileMatcher } from \"../routing/file-matcher.js\";\nimport { type ResolvedNextConfig } from \"../config/next-config.js\";\nimport { isProxyFile } from \"../server/middleware.js\";\nimport { findFileWithExts } from \"./pages-entry-helpers.js\";\n\nconst _requestContextShimPath = resolveEntryPath(\"../shims/request-context.js\", import.meta.url);\nconst _middlewareRuntimePath = resolveEntryPath(\"../server/middleware-runtime.js\", import.meta.url);\nconst _routeTriePath = resolveEntryPath(\"../routing/route-trie.js\", import.meta.url);\nconst _pagesI18nPath = resolveEntryPath(\"../server/pages-i18n.js\", import.meta.url);\nconst _pagesPageResponsePath = resolveEntryPath(\n \"../server/pages-page-response.js\",\n import.meta.url,\n);\nconst _pagesPageDataPath = resolveEntryPath(\"../server/pages-page-data.js\", import.meta.url);\nconst _pagesNodeCompatPath = resolveEntryPath(\"../server/pages-node-compat.js\", import.meta.url);\nconst _pagesApiRoutePath = resolveEntryPath(\"../server/pages-api-route.js\", import.meta.url);\nconst _isrCachePath = resolveEntryPath(\"../server/isr-cache.js\", import.meta.url);\nconst _cspPath = resolveEntryPath(\"../server/csp.js\", import.meta.url);\n\n/**\n * Generate the virtual SSR server entry module.\n * This is the entry point for `vite build --ssr`.\n */\nexport async function generateServerEntry(\n pagesDir: string,\n nextConfig: ResolvedNextConfig,\n fileMatcher: ReturnType<typeof createValidFileMatcher>,\n middlewarePath: string | null,\n instrumentationPath: string | null,\n): Promise<string> {\n const pageRoutes = await pagesRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);\n const apiRoutes = await apiRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);\n\n // Generate import statements using absolute paths since virtual\n // modules don't have a real file location for relative resolution.\n const pageImports = pageRoutes.map((r: Route, i: number) => {\n const absPath = normalizePathSeparators(r.filePath);\n return `import * as page_${i} from ${JSON.stringify(absPath)};`;\n });\n\n const apiImports = apiRoutes.map((r: Route, i: number) => {\n const absPath = normalizePathSeparators(r.filePath);\n return `import * as api_${i} from ${JSON.stringify(absPath)};`;\n });\n\n // Build the route table — include filePath for SSR manifest lookup\n const pageRouteEntries = pageRoutes.map((r: Route, i: number) => {\n const absPath = normalizePathSeparators(r.filePath);\n return ` { pattern: ${JSON.stringify(r.pattern)}, patternParts: ${JSON.stringify(r.patternParts)}, isDynamic: ${r.isDynamic}, params: ${JSON.stringify(r.params)}, module: page_${i}, filePath: ${JSON.stringify(absPath)} }`;\n });\n\n const apiRouteEntries = apiRoutes.map(\n (r: Route, i: number) =>\n ` { pattern: ${JSON.stringify(r.pattern)}, patternParts: ${JSON.stringify(r.patternParts)}, isDynamic: ${r.isDynamic}, params: ${JSON.stringify(r.params)}, module: api_${i} }`,\n );\n\n // Check for _app and _document\n const appFilePath = findFileWithExts(pagesDir, \"_app\", fileMatcher);\n const docFilePath = findFileWithExts(pagesDir, \"_document\", fileMatcher);\n const appImportCode =\n appFilePath !== null\n ? `import { default as AppComponent } from ${JSON.stringify(normalizePathSeparators(appFilePath))};`\n : `const AppComponent = null;`;\n\n const docImportCode =\n docFilePath !== null\n ? `import { default as DocumentComponent } from ${JSON.stringify(normalizePathSeparators(docFilePath))};`\n : `const DocumentComponent = null;`;\n\n // Serialize i18n config for embedding in the server entry\n const i18nConfigJson = nextConfig?.i18n\n ? JSON.stringify({\n locales: nextConfig.i18n.locales,\n defaultLocale: nextConfig.i18n.defaultLocale,\n localeDetection: nextConfig.i18n.localeDetection,\n domains: nextConfig.i18n.domains,\n })\n : \"null\";\n\n // Embed the resolved build ID at build time\n const buildIdJson = JSON.stringify(nextConfig?.buildId ?? null);\n\n // Serialize the full resolved config for the production server.\n // This embeds redirects, rewrites, headers, basePath, trailingSlash\n // so prod-server.ts can apply them without loading next.config.js at runtime.\n const vinextConfigJson = JSON.stringify({\n basePath: nextConfig?.basePath ?? \"\",\n trailingSlash: nextConfig?.trailingSlash ?? false,\n redirects: nextConfig?.redirects ?? [],\n rewrites: nextConfig?.rewrites ?? { beforeFiles: [], afterFiles: [], fallback: [] },\n headers: nextConfig?.headers ?? [],\n expireTime: nextConfig?.expireTime,\n i18n: nextConfig?.i18n ?? null,\n images: {\n deviceSizes: nextConfig?.images?.deviceSizes,\n imageSizes: nextConfig?.images?.imageSizes,\n dangerouslyAllowSVG: nextConfig?.images?.dangerouslyAllowSVG,\n dangerouslyAllowLocalIP: nextConfig?.images?.dangerouslyAllowLocalIP,\n contentDispositionType: nextConfig?.images?.contentDispositionType,\n contentSecurityPolicy: nextConfig?.images?.contentSecurityPolicy,\n },\n });\n\n // Generate instrumentation code if instrumentation.ts exists.\n // For production (Cloudflare Workers), instrumentation.ts is bundled into the\n // Worker and register() is called as a top-level await at module evaluation time —\n // before any request is handled. This mirrors App Router behavior (generateRscEntry)\n // and matches Next.js semantics: register() runs once on startup in the process\n // that handles requests.\n //\n // The onRequestError handler is stored on globalThis so it is visible across\n // all code within the Worker (same global scope).\n const instrumentationImportCode = instrumentationPath\n ? `import * as _instrumentation from ${JSON.stringify(normalizePathSeparators(instrumentationPath))};`\n : \"\";\n\n const instrumentationInitCode = instrumentationPath\n ? `// Run instrumentation register() once at module evaluation time — before any\n// requests are handled. Matches Next.js semantics: register() is called once\n// on startup in the process that handles requests.\nif (typeof _instrumentation.register === \"function\") {\n await _instrumentation.register();\n}\n// Store the onRequestError handler on globalThis so it is visible to all\n// code within the Worker (same global scope).\nif (typeof _instrumentation.onRequestError === \"function\") {\n globalThis.__VINEXT_onRequestErrorHandler__ = _instrumentation.onRequestError;\n}`\n : \"\";\n\n // Generate middleware code if middleware.ts exists\n const middlewareImportCode = middlewarePath\n ? `import * as middlewareModule from ${JSON.stringify(normalizePathSeparators(middlewarePath))};`\n : \"\";\n\n // The matcher config is read from the middleware module at request time.\n // The generated entry only wires the user module into the shared runtime\n // helper; matcher, execution, waitUntil, and result shaping live in normal\n // TypeScript modules so dev/prod paths cannot drift.\n const middlewareExportCode = middlewarePath\n ? `\nexport async function runMiddleware(request, ctx) {\n return __runGeneratedMiddleware({\n basePath: vinextConfig.basePath,\n ctx,\n i18nConfig,\n isProxy: ${JSON.stringify(isProxyFile(middlewarePath))},\n module: middlewareModule,\n request,\n });\n}\n`\n : `\nexport async function runMiddleware() { return { continue: true }; }\n`;\n\n // The server entry is a self-contained module that uses Web-standard APIs\n // (Request/Response, renderToReadableStream) so it runs on Cloudflare Workers.\n return `\nimport React from \"react\";\nimport { renderToReadableStream } from \"react-dom/server.edge\";\nimport { resetSSRHead, getSSRHeadHTML } from \"next/head\";\nimport { flushPreloads } from \"next/dynamic\";\nimport { setSSRContext, wrapWithRouterContext } from \"next/router\";\nimport { _runWithCacheState } from \"next/cache\";\nimport { runWithPrivateCache } from \"vinext/cache-runtime\";\nimport { ensureFetchPatch, runWithFetchCache } from \"vinext/fetch-cache\";\nimport { runWithRequestContext as _runWithUnifiedCtx, createRequestContext as _createUnifiedCtx } from \"vinext/unified-request-context\";\nimport \"vinext/router-state\";\nimport { runWithServerInsertedHTMLState } from \"vinext/navigation-state\";\nimport { runWithHeadState } from \"vinext/head-state\";\nimport \"vinext/i18n-state\";\nimport { setI18nContext } from \"vinext/i18n-context\";\nimport { createNonceAttribute as __createNonceAttribute, safeJsonStringify } from \"vinext/html\";\nimport { getSSRFontLinks as _getSSRFontLinks, getSSRFontStyles as _getSSRFontStylesGoogle, getSSRFontPreloads as _getSSRFontPreloadsGoogle } from \"next/font/google\";\nimport { getSSRFontStyles as _getSSRFontStylesLocal, getSSRFontPreloads as _getSSRFontPreloadsLocal } from \"next/font/local\";\nimport { sanitizeDestination as sanitizeDestinationLocal } from ${JSON.stringify(resolveEntryPath(\"../config/config-matchers.js\", import.meta.url))};\nimport { runWithExecutionContext as _runWithExecutionContext, getRequestExecutionContext as _getRequestExecutionContext } from ${JSON.stringify(_requestContextShimPath)};\nimport { runGeneratedMiddleware as __runGeneratedMiddleware } from ${JSON.stringify(_middlewareRuntimePath)};\nimport { buildRouteTrie as _buildRouteTrie, trieMatch as _trieMatch } from ${JSON.stringify(_routeTriePath)};\nimport { reportRequestError as _reportRequestError } from \"vinext/instrumentation\";\nimport { resolvePagesI18nRequest } from ${JSON.stringify(_pagesI18nPath)};\nimport { createPagesReqRes as __createPagesReqRes } from ${JSON.stringify(_pagesNodeCompatPath)};\nimport { handlePagesApiRoute as __handlePagesApiRoute } from ${JSON.stringify(_pagesApiRoutePath)};\nimport {\n isrGet as __sharedIsrGet,\n isrSet as __sharedIsrSet,\n isrCacheKey as __sharedIsrCacheKey,\n triggerBackgroundRegeneration as __sharedTriggerBackgroundRegeneration,\n} from ${JSON.stringify(_isrCachePath)};\nimport { getScriptNonceFromHeaderSources as __getScriptNonceFromHeaderSources } from ${JSON.stringify(_cspPath)};\nimport { resolvePagesPageData as __resolvePagesPageData } from ${JSON.stringify(_pagesPageDataPath)};\nimport { renderPagesPageResponse as __renderPagesPageResponse } from ${JSON.stringify(_pagesPageResponsePath)};\n${instrumentationImportCode}\n${middlewareImportCode}\n\n${instrumentationInitCode}\n\n// i18n config (embedded at build time)\nconst i18nConfig = ${i18nConfigJson};\n\n// Build ID (embedded at build time)\nconst buildId = ${buildIdJson};\n\n// Full resolved config for production server (embedded at build time)\nexport const vinextConfig = ${vinextConfigJson};\n\nfunction isrGet(key) {\n return __sharedIsrGet(key);\n}\nfunction isrSet(key, data, revalidateSeconds, tags, expireSeconds) {\n return __sharedIsrSet(key, data, revalidateSeconds, tags, expireSeconds);\n}\nfunction triggerBackgroundRegeneration(key, renderFn, errorContext) {\n return __sharedTriggerBackgroundRegeneration(key, renderFn, errorContext);\n}\nfunction isrCacheKey(router, pathname) {\n return __sharedIsrCacheKey(router, pathname, buildId || undefined);\n}\n\nasync function renderToStringAsync(element) {\n const stream = await renderToReadableStream(element);\n await stream.allReady;\n return new Response(stream).text();\n}\n\nasync function renderIsrPassToStringAsync(element) {\n // The cache-fill render is a second render pass for the same request.\n // Reset render-scoped state so it cannot leak from the streamed response\n // render or affect async work that is still draining from that stream.\n // Keep request identity state (pathname/query/locale/executionContext)\n // intact: this second pass still belongs to the same request.\n return await runWithServerInsertedHTMLState(() =>\n runWithHeadState(() =>\n _runWithCacheState(() =>\n runWithPrivateCache(() => runWithFetchCache(async () => renderToStringAsync(element))),\n ),\n ),\n );\n}\n\n${pageImports.join(\"\\n\")}\n${apiImports.join(\"\\n\")}\n\n${appImportCode}\n${docImportCode}\n\nexport const pageRoutes = [\n${pageRouteEntries.join(\",\\n\")}\n];\nconst _pageRouteTrie = _buildRouteTrie(pageRoutes);\n\nconst apiRoutes = [\n${apiRouteEntries.join(\",\\n\")}\n];\nconst _apiRouteTrie = _buildRouteTrie(apiRoutes);\n\nfunction matchRoute(url, routes) {\n const pathname = url.split(\"?\")[0];\n let normalizedUrl = pathname === \"/\" ? \"/\" : pathname.replace(/\\\\/$/, \"\");\n // NOTE: Do NOT decodeURIComponent here. The pathname is already decoded at\n // the entry point. Decoding again would create a double-decode vector.\n const urlParts = normalizedUrl.split(\"/\").filter(Boolean);\n const trie = routes === pageRoutes ? _pageRouteTrie : _apiRouteTrie;\n return _trieMatch(trie, urlParts);\n}\n\nexport function matchPageRoute(url, request) {\n const routeUrl = i18nConfig && request\n ? resolvePagesI18nRequest(\n url,\n i18nConfig,\n request.headers,\n new URL(request.url).hostname,\n vinextConfig.basePath,\n vinextConfig.trailingSlash,\n ).url\n : url;\n return matchRoute(routeUrl, pageRoutes);\n}\n\nfunction parseQuery(url) {\n const qs = url.split(\"?\")[1];\n if (!qs) return {};\n const p = new URLSearchParams(qs);\n const q = {};\n for (const [k, v] of p) {\n if (k in q) {\n q[k] = Array.isArray(q[k]) ? q[k].concat(v) : [q[k], v];\n } else {\n q[k] = v;\n }\n }\n return q;\n}\n\nfunction mergeRouteParamsIntoQuery(query, params) {\n return Object.assign(query, params);\n}\n\nfunction patternToNextFormat(pattern) {\n // Match any non-/ param name. Non-greedy with lookahead prevents\n // the +/* suffix being consumed into the param name when the name\n // itself contains + or * internally (e.g. :c++lang → [c++lang]).\n return pattern\n .replace(/:([^\\\\/]+?)\\\\+(?=\\\\/|$)/g, \"[...$1]\")\n .replace(/:([^\\\\/]+?)\\\\*(?=\\\\/|$)/g, \"[[...$1]]\")\n .replace(/:([^\\\\/]+?)(?=\\\\/|$)/g, \"[$1]\");\n}\n\nfunction collectAssetTags(manifest, moduleIds, scriptNonce) {\n // Fall back to embedded manifest (set by vinext:cloudflare-build for Workers)\n const m = (manifest && Object.keys(manifest).length > 0)\n ? manifest\n : (typeof globalThis !== \"undefined\" && globalThis.__VINEXT_SSR_MANIFEST__) || null;\n const tags = [];\n const seen = new Set();\n const nonceAttr = __createNonceAttribute(scriptNonce);\n\n // Load the set of lazy chunk filenames (only reachable via dynamic imports).\n // These should NOT get <link rel=\"modulepreload\"> or <script type=\"module\">\n // tags — they are fetched on demand when the dynamic import() executes (e.g.\n // chunks behind React.lazy() or next/dynamic boundaries).\n var lazyChunks = (typeof globalThis !== \"undefined\" && globalThis.__VINEXT_LAZY_CHUNKS__) || null;\n var lazySet = lazyChunks && lazyChunks.length > 0 ? new Set(lazyChunks) : null;\n\n // Inject the client entry script if embedded by vinext:cloudflare-build\n if (typeof globalThis !== \"undefined\" && globalThis.__VINEXT_CLIENT_ENTRY__) {\n const entry = globalThis.__VINEXT_CLIENT_ENTRY__;\n seen.add(entry);\n tags.push('<link rel=\"modulepreload\"' + nonceAttr + ' href=\"/' + entry + '\" />');\n tags.push('<script type=\"module\"' + nonceAttr + ' src=\"/' + entry + '\" crossorigin></script>');\n }\n if (m) {\n // Always inject shared chunks (framework, vinext runtime, entry) and\n // page-specific chunks. The manifest maps module file paths to their\n // associated JS/CSS assets.\n //\n // For page-specific injection, the module IDs may be absolute paths\n // while the manifest uses relative paths. Try both the original ID\n // and a suffix match to find the correct manifest entry.\n var allFiles = [];\n\n if (moduleIds && moduleIds.length > 0) {\n // Collect assets for the requested page modules\n for (var mi = 0; mi < moduleIds.length; mi++) {\n var id = moduleIds[mi];\n var files = m[id];\n if (!files) {\n // Absolute path didn't match — try matching by suffix.\n // Manifest keys are relative (e.g. \"pages/about.tsx\") while\n // moduleIds may be absolute (e.g. \"/home/.../pages/about.tsx\").\n for (var mk in m) {\n if (id.endsWith(\"/\" + mk) || id === mk) {\n files = m[mk];\n break;\n }\n }\n }\n if (files) {\n for (var fi = 0; fi < files.length; fi++) allFiles.push(files[fi]);\n }\n }\n\n // Also inject shared chunks that every page needs: framework,\n // vinext runtime, and the entry bootstrap. These are identified\n // by scanning all manifest values for chunk filenames containing\n // known prefixes.\n for (var key in m) {\n var vals = m[key];\n if (!vals) continue;\n for (var vi = 0; vi < vals.length; vi++) {\n var file = vals[vi];\n var basename = file.split(\"/\").pop() || \"\";\n if (\n basename.startsWith(\"framework-\") ||\n basename.startsWith(\"vinext-\") ||\n basename.includes(\"vinext-client-entry\") ||\n basename.includes(\"vinext-app-browser-entry\")\n ) {\n allFiles.push(file);\n }\n }\n }\n } else {\n // No specific modules — include all assets from manifest\n for (var akey in m) {\n var avals = m[akey];\n if (avals) {\n for (var ai = 0; ai < avals.length; ai++) allFiles.push(avals[ai]);\n }\n }\n }\n\n for (var ti = 0; ti < allFiles.length; ti++) {\n var tf = allFiles[ti];\n // Normalize: Vite's SSR manifest values include a leading '/'\n // (from base path), but we prepend '/' ourselves when building\n // href/src attributes. Strip any existing leading slash to avoid\n // producing protocol-relative URLs like \"//assets/chunk.js\".\n // This also ensures consistent keys for the seen-set dedup and\n // lazySet.has() checks (which use values without leading slash).\n if (tf.charAt(0) === '/') tf = tf.slice(1);\n if (seen.has(tf)) continue;\n seen.add(tf);\n if (tf.endsWith(\".css\")) {\n tags.push('<link rel=\"stylesheet\"' + nonceAttr + ' href=\"/' + tf + '\" />');\n } else if (tf.endsWith(\".js\")) {\n // Skip lazy chunks — they are behind dynamic import() boundaries\n // (React.lazy, next/dynamic) and should only be fetched on demand.\n if (lazySet && lazySet.has(tf)) continue;\n tags.push('<link rel=\"modulepreload\"' + nonceAttr + ' href=\"/' + tf + '\" />');\n tags.push('<script type=\"module\"' + nonceAttr + ' src=\"/' + tf + '\" crossorigin></script>');\n }\n }\n }\n return tags.join(\"\\\\n \");\n}\n\nexport async function renderPage(request, url, manifest, ctx, middlewareHeaders) {\n if (ctx) return _runWithExecutionContext(ctx, () => _renderPage(request, url, manifest, middlewareHeaders));\n return _renderPage(request, url, manifest, middlewareHeaders);\n}\n\nasync function _renderPage(request, url, manifest, middlewareHeaders) {\n const localeInfo = i18nConfig\n ? resolvePagesI18nRequest(\n url,\n i18nConfig,\n request.headers,\n new URL(request.url).hostname,\n vinextConfig.basePath,\n vinextConfig.trailingSlash,\n )\n : { locale: undefined, url, hadPrefix: false, domainLocale: undefined, redirectUrl: undefined };\n const locale = localeInfo.locale;\n const routeUrl = localeInfo.url;\n const currentDefaultLocale = i18nConfig\n ? (localeInfo.domainLocale ? localeInfo.domainLocale.defaultLocale : i18nConfig.defaultLocale)\n : undefined;\n const domainLocales = i18nConfig ? i18nConfig.domains : undefined;\n\n if (localeInfo.redirectUrl) {\n return new Response(null, { status: 307, headers: { Location: localeInfo.redirectUrl } });\n }\n\n const match = matchRoute(routeUrl, pageRoutes);\n if (!match) {\n return new Response(\"<!DOCTYPE html><html><body><h1>404 - Page not found</h1></body></html>\",\n { status: 404, headers: { \"Content-Type\": \"text/html\" } });\n }\n\n const { route, params } = match;\n const __uCtx = _createUnifiedCtx({\n executionContext: _getRequestExecutionContext(),\n });\n return _runWithUnifiedCtx(__uCtx, async () => {\n ensureFetchPatch();\n try {\n const routePattern = patternToNextFormat(route.pattern);\n const query = mergeRouteParamsIntoQuery(parseQuery(routeUrl), params);\n if (typeof setSSRContext === \"function\") {\n setSSRContext({\n pathname: routePattern,\n query,\n asPath: routeUrl,\n locale: locale,\n locales: i18nConfig ? i18nConfig.locales : undefined,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n });\n }\n\n if (i18nConfig) {\n setI18nContext({\n locale: locale,\n locales: i18nConfig.locales,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n hostname: new URL(request.url).hostname,\n });\n }\n\n const pageModule = route.module;\n const PageComponent = pageModule.default;\n if (!PageComponent) {\n return new Response(\"Page has no default export\", { status: 500 });\n }\n const scriptNonce = __getScriptNonceFromHeaderSources(request.headers, middlewareHeaders);\n // Build font Link header early so it's available for ISR cached responses too.\n // Font preloads are module-level state populated at import time and persist across requests.\n var _fontLinkHeader = \"\";\n var _allFp = [];\n try {\n var _fpGoogle = typeof _getSSRFontPreloadsGoogle === \"function\" ? _getSSRFontPreloadsGoogle() : [];\n var _fpLocal = typeof _getSSRFontPreloadsLocal === \"function\" ? _getSSRFontPreloadsLocal() : [];\n _allFp = _fpGoogle.concat(_fpLocal);\n if (_allFp.length > 0) {\n _fontLinkHeader = _allFp.map(function(p) { return \"<\" + p.href + \">; rel=preload; as=font; type=\" + p.type + \"; crossorigin\"; }).join(\", \");\n }\n } catch (e) { /* font preloads not available */ }\n const pageDataResult = await __resolvePagesPageData({\n applyRequestContexts() {\n if (typeof setSSRContext === \"function\") {\n setSSRContext({\n pathname: routePattern,\n query,\n asPath: routeUrl,\n locale: locale,\n locales: i18nConfig ? i18nConfig.locales : undefined,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n });\n }\n if (i18nConfig) {\n setI18nContext({\n locale: locale,\n locales: i18nConfig.locales,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n hostname: new URL(request.url).hostname,\n });\n }\n },\n buildId,\n createGsspReqRes() {\n return __createPagesReqRes({ body: undefined, query, request, url: routeUrl });\n },\n createPageElement(currentPageProps) {\n var currentElement = AppComponent\n ? React.createElement(AppComponent, { Component: PageComponent, pageProps: currentPageProps })\n : React.createElement(PageComponent, currentPageProps);\n return wrapWithRouterContext(currentElement);\n },\n fontLinkHeader: _fontLinkHeader,\n i18n: {\n locale: locale,\n locales: i18nConfig ? i18nConfig.locales : undefined,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n },\n isrCacheKey,\n isrGet,\n isrSet,\n expireSeconds: vinextConfig.expireTime,\n pageModule,\n params,\n query,\n renderIsrPassToStringAsync,\n route: {\n isDynamic: route.isDynamic,\n },\n routePattern,\n routeUrl,\n runInFreshUnifiedContext(callback) {\n var revalCtx = _createUnifiedCtx({\n executionContext: _getRequestExecutionContext(),\n });\n return _runWithUnifiedCtx(revalCtx, async () => {\n ensureFetchPatch();\n return callback();\n });\n },\n safeJsonStringify,\n sanitizeDestination: sanitizeDestinationLocal,\n scriptNonce,\n triggerBackgroundRegeneration,\n });\n if (pageDataResult.kind === \"response\") {\n return pageDataResult.response;\n }\n let pageProps = pageDataResult.pageProps;\n var gsspRes = pageDataResult.gsspRes;\n let isrRevalidateSeconds = pageDataResult.isrRevalidateSeconds;\n\n const pageModuleIds = route.filePath ? [route.filePath] : [];\n const assetTags = collectAssetTags(manifest, pageModuleIds, scriptNonce);\n\n return __renderPagesPageResponse({\n assetTags,\n buildId,\n clearSsrContext() {\n if (typeof setSSRContext === \"function\") setSSRContext(null);\n },\n createPageElement(currentPageProps) {\n var currentElement;\n if (AppComponent) {\n currentElement = React.createElement(AppComponent, { Component: PageComponent, pageProps: currentPageProps });\n } else {\n currentElement = React.createElement(PageComponent, currentPageProps);\n }\n return wrapWithRouterContext(currentElement);\n },\n DocumentComponent,\n flushPreloads: typeof flushPreloads === \"function\" ? flushPreloads : undefined,\n fontLinkHeader: _fontLinkHeader,\n fontPreloads: _allFp,\n getFontLinks() {\n try {\n return typeof _getSSRFontLinks === \"function\" ? _getSSRFontLinks() : [];\n } catch (e) {\n return [];\n }\n },\n getFontStyles() {\n try {\n var allFontStyles = [];\n if (typeof _getSSRFontStylesGoogle === \"function\") allFontStyles.push(..._getSSRFontStylesGoogle());\n if (typeof _getSSRFontStylesLocal === \"function\") allFontStyles.push(..._getSSRFontStylesLocal());\n return allFontStyles;\n } catch (e) {\n return [];\n }\n },\n getSSRHeadHTML: typeof getSSRHeadHTML === \"function\" ? getSSRHeadHTML : undefined,\n gsspRes,\n isrCacheKey,\n expireSeconds: vinextConfig.expireTime,\n isrRevalidateSeconds,\n isrSet,\n i18n: {\n locale: locale,\n locales: i18nConfig ? i18nConfig.locales : undefined,\n defaultLocale: currentDefaultLocale,\n domainLocales: domainLocales,\n },\n pageProps,\n params,\n renderDocumentToString(element) {\n return renderToStringAsync(element);\n },\n renderToReadableStream(element) {\n return renderToReadableStream(element);\n },\n resetSSRHead: typeof resetSSRHead === \"function\" ? resetSSRHead : undefined,\n routePattern,\n routeUrl,\n safeJsonStringify,\n scriptNonce,\n });\n } catch (e) {\n console.error(\"[vinext] SSR error:\", e);\n _reportRequestError(\n e instanceof Error ? e : new Error(String(e)),\n { path: url, method: request.method, headers: Object.fromEntries(request.headers.entries()) },\n { routerKind: \"Pages Router\", routePath: route.pattern, routeType: \"render\" },\n ).catch(() => { /* ignore reporting errors */ });\n return new Response(\"Internal Server Error\", { status: 500 });\n }\n });\n}\n\nexport async function handleApiRoute(request, url) {\n const match = matchRoute(url, apiRoutes);\n return __handlePagesApiRoute({\n match,\n request,\n url,\n reportRequestError(error, routePattern) {\n console.error(\"[vinext] API error:\", error);\n void _reportRequestError(\n error,\n { path: url, method: request.method, headers: Object.fromEntries(request.headers.entries()) },\n { routerKind: \"Pages Router\", routePath: routePattern, routeType: \"route\" },\n );\n },\n });\n}\n\n${middlewareExportCode}\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,0BAA0B,iBAAiB,+BAA+B,OAAO,KAAK,IAAI;AAChG,MAAM,yBAAyB,iBAAiB,mCAAmC,OAAO,KAAK,IAAI;AACnG,MAAM,iBAAiB,iBAAiB,4BAA4B,OAAO,KAAK,IAAI;AACpF,MAAM,iBAAiB,iBAAiB,2BAA2B,OAAO,KAAK,IAAI;AACnF,MAAM,yBAAyB,iBAC7B,oCACA,OAAO,KAAK,IACb;AACD,MAAM,qBAAqB,iBAAiB,gCAAgC,OAAO,KAAK,IAAI;AAC5F,MAAM,uBAAuB,iBAAiB,kCAAkC,OAAO,KAAK,IAAI;AAChG,MAAM,qBAAqB,iBAAiB,gCAAgC,OAAO,KAAK,IAAI;AAC5F,MAAM,gBAAgB,iBAAiB,0BAA0B,OAAO,KAAK,IAAI;AACjF,MAAM,WAAW,iBAAiB,oBAAoB,OA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B,CAAC;+DACjC,KAAK,UAAU,mBAAmB,CAAC;;;;;;SAMzF,KAAK,UAAU,cAAc,CAAC;uFACgD,KAAK,UAAU,SAAS,CAAC;iEAC/C,KAAK,UAAU,mBAAmB,CAAC;uEAC7B,KAAK,UAAU,uBAAuB,CAAC;EAC5G,0BAA0B;EAC1B,qBAAqB;;EAErB,wBAAwB;;;qBAGL,eAAe;;;kBAGlB,YAAY;;;8BAGA,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoC7C,YAAY,KAAK,KAAK,CAAC;EACvB,WAAW,KAAK,KAAK,CAAC;;EAEtB,cAAc;EACd,cAAc;;;EAGd,iBAAiB,KAAK,MAAM,CAAC;;;;;EAK7B,gBAAgB,KAAK,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAga5B,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-entry-module.js","names":[],"sources":["../../src/entries/runtime-entry-module.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Convert Windows-style backslash path separators to forward slashes.\n *\n * Generated entry modules embed absolute filesystem paths inside `import`\n * statements. On Windows the OS-native paths use `\\` which is invalid in JS\n * module specifiers, so every entry generator normalizes paths through this\n * helper before stringifying them into the emitted code.\n */\nexport function normalizePathSeparators(p: string): string {\n return p.replace(/\\\\/g, \"/\");\n}\n\n/**\n * Resolve a sibling module path relative to a caller's `import.meta.url`,\n * returning a forward-slash path safe for embedding in generated code.\n *\n * This is the single place that owns the\n * `fileURLToPath(new URL(rel, base))` + path-separator normalization idiom so\n * callers don't duplicate it.\n *\n * @param rel - Relative path to the target module (e.g. `\"../server/foo.js\"`)\n * @param base - The caller's `import.meta.url`\n */\nexport function resolveEntryPath(rel: string, base: string): string {\n return normalizePathSeparators(fileURLToPath(new URL(rel, base)));\n}\n\n/**\n * Resolve a real runtime module for a virtual entry generator.\n *\n * During local development we want to point at source files (for example `.ts`),\n * while packed builds only contain emitted `.js` files in `dist/`. Probe the\n * common source/build extensions and fall back to the `.js` path that exists in\n * published packages.\n */\nexport function resolveRuntimeEntryModule(name: string): string {\n for (const ext of [\".ts\", \".js\", \".mts\", \".mjs\"]) {\n const filePath = resolveEntryPath(`../server/${name}${ext}`, import.meta.url);\n if (fs.existsSync(filePath)) {\n return filePath;\n }\n }\n\n return resolveEntryPath(`../server/${name}.js`, import.meta.url);\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,wBAAwB,GAAmB;AACzD,QAAO,EAAE,QAAQ,OAAO,IAAI;;;;;;;;;;;;;AAc9B,SAAgB,iBAAiB,KAAa,MAAsB;AAClE,QAAO,wBAAwB,cAAc,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC;;;;;;;;;;AAWnE,SAAgB,0BAA0B,MAAsB;AAC9D,MAAK,MAAM,OAAO;EAAC;EAAO;EAAO;EAAQ;EAAO,EAAE;EAChD,MAAM,WAAW,iBAAiB,aAAa,OAAO,OAAO,OAAO,KAAK,IAAI;AAC7E,MAAI,GAAG,WAAW,SAAS,CACzB,QAAO;;AAIX,QAAO,iBAAiB,aAAa,KAAK,MAAM,OAAO,KAAK,IAAI"}
1
+ {"version":3,"file":"runtime-entry-module.js","names":[],"sources":["../../src/entries/runtime-entry-module.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Convert Windows-style backslash path separators to forward slashes.\n *\n * Generated entry modules embed absolute filesystem paths inside `import`\n * statements. On Windows the OS-native paths use `\\` which is invalid in JS\n * module specifiers, so every entry generator normalizes paths through this\n * helper before stringifying them into the emitted code.\n */\nexport function normalizePathSeparators(p: string): string {\n return p.replace(/\\\\/g, \"/\");\n}\n\n/**\n * Resolve a sibling module path relative to a caller's `import.meta.url`,\n * returning a forward-slash path safe for embedding in generated code.\n *\n * This is the single place that owns the\n * `fileURLToPath(new URL(rel, base))` + path-separator normalization idiom so\n * callers don't duplicate it.\n *\n * @param rel - Relative path to the target module (e.g. `\"../server/foo.js\"`)\n * @param base - The caller's `import.meta.url`\n */\nexport function resolveEntryPath(rel: string, base: string): string {\n return normalizePathSeparators(fileURLToPath(new URL(rel, base)));\n}\n\n/**\n * Resolve a real runtime module for a virtual entry generator.\n *\n * During local development we want to point at source files (for example `.ts`),\n * while packed builds only contain emitted `.js` files in `dist/`. Probe the\n * common source/build extensions and fall back to the `.js` path that exists in\n * published packages.\n */\nexport function resolveRuntimeEntryModule(name: string): string {\n for (const ext of [\".ts\", \".js\", \".mts\", \".mjs\"]) {\n const filePath = resolveEntryPath(`../server/${name}${ext}`, import.meta.url);\n if (fs.existsSync(filePath)) {\n return filePath;\n }\n }\n\n return resolveEntryPath(`../server/${name}.js`, import.meta.url);\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,wBAAwB,GAAmB;CACzD,OAAO,EAAE,QAAQ,OAAO,IAAI;;;;;;;;;;;;;AAc9B,SAAgB,iBAAiB,KAAa,MAAsB;CAClE,OAAO,wBAAwB,cAAc,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC;;;;;;;;;;AAWnE,SAAgB,0BAA0B,MAAsB;CAC9D,KAAK,MAAM,OAAO;EAAC;EAAO;EAAO;EAAQ;EAAO,EAAE;EAChD,MAAM,WAAW,iBAAiB,aAAa,OAAO,OAAO,OAAO,KAAK,IAAI;EAC7E,IAAI,GAAG,WAAW,SAAS,EACzB,OAAO;;CAIX,OAAO,iBAAiB,aAAa,KAAK,MAAM,OAAO,KAAK,IAAI"}