vinext 0.0.50 → 0.0.52

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 (462) hide show
  1. package/dist/build/google-fonts/fallback-metrics-data.js +14031 -0
  2. package/dist/build/google-fonts/fallback-metrics-data.js.map +1 -0
  3. package/dist/build/google-fonts/fallback-metrics.d.ts +13 -0
  4. package/dist/build/google-fonts/fallback-metrics.js +46 -0
  5. package/dist/build/google-fonts/fallback-metrics.js.map +1 -0
  6. package/dist/build/precompress.d.ts +13 -2
  7. package/dist/build/precompress.js +23 -13
  8. package/dist/build/precompress.js.map +1 -1
  9. package/dist/build/prerender.d.ts +4 -15
  10. package/dist/build/prerender.js +83 -53
  11. package/dist/build/prerender.js.map +1 -1
  12. package/dist/build/report.d.ts +5 -4
  13. package/dist/build/report.js +196 -348
  14. package/dist/build/report.js.map +1 -1
  15. package/dist/check.js +5 -0
  16. package/dist/check.js.map +1 -1
  17. package/dist/cli-args.d.ts +1 -0
  18. package/dist/cli-args.js +5 -0
  19. package/dist/cli-args.js.map +1 -1
  20. package/dist/cli.js +99 -3
  21. package/dist/cli.js.map +1 -1
  22. package/dist/client/navigation-runtime.d.ts +47 -0
  23. package/dist/client/navigation-runtime.js +156 -0
  24. package/dist/client/navigation-runtime.js.map +1 -0
  25. package/dist/client/pages-router-link-navigation.d.ts +26 -0
  26. package/dist/client/pages-router-link-navigation.js +14 -0
  27. package/dist/client/pages-router-link-navigation.js.map +1 -0
  28. package/dist/client/vinext-next-data.d.ts +12 -2
  29. package/dist/client/vinext-next-data.js +50 -1
  30. package/dist/client/vinext-next-data.js.map +1 -0
  31. package/dist/client/window-next.d.ts +3 -1
  32. package/dist/client/window-next.js.map +1 -1
  33. package/dist/cloudflare/kv-cache-handler.js +2 -1
  34. package/dist/cloudflare/kv-cache-handler.js.map +1 -1
  35. package/dist/config/config-matchers.d.ts +63 -16
  36. package/dist/config/config-matchers.js +143 -8
  37. package/dist/config/config-matchers.js.map +1 -1
  38. package/dist/config/dotenv.d.ts +11 -1
  39. package/dist/config/dotenv.js.map +1 -1
  40. package/dist/config/next-config.d.ts +107 -5
  41. package/dist/config/next-config.js +233 -7
  42. package/dist/config/next-config.js.map +1 -1
  43. package/dist/config/tsconfig-paths.d.ts +13 -0
  44. package/dist/config/tsconfig-paths.js +117 -0
  45. package/dist/config/tsconfig-paths.js.map +1 -0
  46. package/dist/deploy.js +104 -41
  47. package/dist/deploy.js.map +1 -1
  48. package/dist/entries/app-browser-entry.d.ts +2 -2
  49. package/dist/entries/app-browser-entry.js +34 -3
  50. package/dist/entries/app-browser-entry.js.map +1 -1
  51. package/dist/entries/app-rsc-entry.d.ts +19 -1
  52. package/dist/entries/app-rsc-entry.js +89 -23
  53. package/dist/entries/app-rsc-entry.js.map +1 -1
  54. package/dist/entries/app-rsc-manifest.d.ts +10 -0
  55. package/dist/entries/app-rsc-manifest.js +57 -7
  56. package/dist/entries/app-rsc-manifest.js.map +1 -1
  57. package/dist/entries/app-ssr-entry.d.ts +3 -3
  58. package/dist/entries/app-ssr-entry.js +4 -4
  59. package/dist/entries/app-ssr-entry.js.map +1 -1
  60. package/dist/entries/pages-client-entry.js +21 -7
  61. package/dist/entries/pages-client-entry.js.map +1 -1
  62. package/dist/entries/pages-server-entry.js +77 -9
  63. package/dist/entries/pages-server-entry.js.map +1 -1
  64. package/dist/entries/runtime-entry-module.d.ts +2 -1
  65. package/dist/entries/runtime-entry-module.js +9 -3
  66. package/dist/entries/runtime-entry-module.js.map +1 -1
  67. package/dist/index.js +260 -75
  68. package/dist/index.js.map +1 -1
  69. package/dist/plugins/client-reference-dedup.d.ts +15 -2
  70. package/dist/plugins/client-reference-dedup.js +138 -16
  71. package/dist/plugins/client-reference-dedup.js.map +1 -1
  72. package/dist/plugins/css-data-url.d.ts +7 -0
  73. package/dist/plugins/css-data-url.js +81 -0
  74. package/dist/plugins/css-data-url.js.map +1 -0
  75. package/dist/plugins/fonts.d.ts +2 -2
  76. package/dist/plugins/fonts.js +20 -9
  77. package/dist/plugins/fonts.js.map +1 -1
  78. package/dist/plugins/middleware-server-only.d.ts +54 -0
  79. package/dist/plugins/middleware-server-only.js +91 -0
  80. package/dist/plugins/middleware-server-only.js.map +1 -0
  81. package/dist/plugins/optimize-imports.js +4 -4
  82. package/dist/plugins/optimize-imports.js.map +1 -1
  83. package/dist/plugins/sass.d.ts +34 -0
  84. package/dist/plugins/sass.js +22 -0
  85. package/dist/plugins/sass.js.map +1 -0
  86. package/dist/plugins/strip-server-exports.js +5 -8
  87. package/dist/plugins/strip-server-exports.js.map +1 -1
  88. package/dist/routing/app-route-graph.d.ts +50 -2
  89. package/dist/routing/app-route-graph.js +140 -16
  90. package/dist/routing/app-route-graph.js.map +1 -1
  91. package/dist/routing/app-router.d.ts +2 -2
  92. package/dist/routing/app-router.js +2 -2
  93. package/dist/routing/app-router.js.map +1 -1
  94. package/dist/routing/route-pattern.d.ts +56 -1
  95. package/dist/routing/route-pattern.js +60 -1
  96. package/dist/routing/route-pattern.js.map +1 -1
  97. package/dist/routing/utils.d.ts +2 -1
  98. package/dist/routing/utils.js +4 -1
  99. package/dist/routing/utils.js.map +1 -1
  100. package/dist/server/api-handler.js +139 -37
  101. package/dist/server/api-handler.js.map +1 -1
  102. package/dist/server/app-browser-action-result.d.ts +27 -2
  103. package/dist/server/app-browser-action-result.js +63 -2
  104. package/dist/server/app-browser-action-result.js.map +1 -1
  105. package/dist/server/app-browser-entry.js +493 -195
  106. package/dist/server/app-browser-entry.js.map +1 -1
  107. package/dist/server/app-browser-hydration.d.ts +13 -1
  108. package/dist/server/app-browser-hydration.js +9 -1
  109. package/dist/server/app-browser-hydration.js.map +1 -1
  110. package/dist/server/app-browser-interception-context.d.ts +24 -0
  111. package/dist/server/app-browser-interception-context.js +32 -0
  112. package/dist/server/app-browser-interception-context.js.map +1 -0
  113. package/dist/server/app-browser-navigation-controller.d.ts +17 -2
  114. package/dist/server/app-browser-navigation-controller.js +33 -10
  115. package/dist/server/app-browser-navigation-controller.js.map +1 -1
  116. package/dist/server/app-browser-popstate.d.ts +16 -0
  117. package/dist/server/app-browser-popstate.js +17 -0
  118. package/dist/server/app-browser-popstate.js.map +1 -0
  119. package/dist/server/app-browser-rsc-redirect.d.ts +29 -0
  120. package/dist/server/app-browser-rsc-redirect.js +37 -0
  121. package/dist/server/app-browser-rsc-redirect.js.map +1 -0
  122. package/dist/server/app-browser-state.d.ts +28 -7
  123. package/dist/server/app-browser-state.js +63 -27
  124. package/dist/server/app-browser-state.js.map +1 -1
  125. package/dist/server/app-browser-stream.d.ts +9 -17
  126. package/dist/server/app-browser-stream.js +18 -13
  127. package/dist/server/app-browser-stream.js.map +1 -1
  128. package/dist/server/app-browser-visible-commit.d.ts +7 -1
  129. package/dist/server/app-browser-visible-commit.js +39 -5
  130. package/dist/server/app-browser-visible-commit.js.map +1 -1
  131. package/dist/server/app-elements-wire.d.ts +43 -6
  132. package/dist/server/app-elements-wire.js +189 -7
  133. package/dist/server/app-elements-wire.js.map +1 -1
  134. package/dist/server/app-elements.d.ts +3 -2
  135. package/dist/server/app-elements.js +3 -2
  136. package/dist/server/app-elements.js.map +1 -1
  137. package/dist/server/app-fallback-renderer.d.ts +10 -1
  138. package/dist/server/app-fallback-renderer.js +41 -3
  139. package/dist/server/app-fallback-renderer.js.map +1 -1
  140. package/dist/server/app-history-state.d.ts +26 -0
  141. package/dist/server/app-history-state.js +53 -0
  142. package/dist/server/app-history-state.js.map +1 -0
  143. package/dist/server/app-middleware.d.ts +13 -0
  144. package/dist/server/app-middleware.js +3 -1
  145. package/dist/server/app-middleware.js.map +1 -1
  146. package/dist/server/app-optimistic-routing.d.ts +54 -0
  147. package/dist/server/app-optimistic-routing.js +200 -0
  148. package/dist/server/app-optimistic-routing.js.map +1 -0
  149. package/dist/server/app-page-boundary-render.d.ts +10 -1
  150. package/dist/server/app-page-boundary-render.js +13 -6
  151. package/dist/server/app-page-boundary-render.js.map +1 -1
  152. package/dist/server/app-page-boundary.js +3 -2
  153. package/dist/server/app-page-boundary.js.map +1 -1
  154. package/dist/server/app-page-cache.d.ts +26 -1
  155. package/dist/server/app-page-cache.js +86 -14
  156. package/dist/server/app-page-cache.js.map +1 -1
  157. package/dist/server/app-page-dispatch.d.ts +7 -0
  158. package/dist/server/app-page-dispatch.js +96 -12
  159. package/dist/server/app-page-dispatch.js.map +1 -1
  160. package/dist/server/app-page-element-builder.d.ts +7 -0
  161. package/dist/server/app-page-element-builder.js +34 -5
  162. package/dist/server/app-page-element-builder.js.map +1 -1
  163. package/dist/server/app-page-execution.d.ts +28 -1
  164. package/dist/server/app-page-execution.js +91 -7
  165. package/dist/server/app-page-execution.js.map +1 -1
  166. package/dist/server/app-page-head.d.ts +7 -0
  167. package/dist/server/app-page-head.js +23 -3
  168. package/dist/server/app-page-head.js.map +1 -1
  169. package/dist/server/app-page-probe.d.ts +23 -1
  170. package/dist/server/app-page-probe.js +29 -1
  171. package/dist/server/app-page-probe.js.map +1 -1
  172. package/dist/server/app-page-render-observation.d.ts +35 -0
  173. package/dist/server/app-page-render-observation.js +68 -0
  174. package/dist/server/app-page-render-observation.js.map +1 -0
  175. package/dist/server/app-page-render.d.ts +7 -1
  176. package/dist/server/app-page-render.js +81 -4
  177. package/dist/server/app-page-render.js.map +1 -1
  178. package/dist/server/app-page-request.d.ts +1 -0
  179. package/dist/server/app-page-request.js.map +1 -1
  180. package/dist/server/app-page-response.js +7 -5
  181. package/dist/server/app-page-response.js.map +1 -1
  182. package/dist/server/app-page-route-wiring.d.ts +3 -1
  183. package/dist/server/app-page-route-wiring.js +59 -24
  184. package/dist/server/app-page-route-wiring.js.map +1 -1
  185. package/dist/server/app-page-stream.d.ts +5 -0
  186. package/dist/server/app-page-stream.js +2 -0
  187. package/dist/server/app-page-stream.js.map +1 -1
  188. package/dist/server/app-prerender-static-params.d.ts +2 -1
  189. package/dist/server/app-prerender-static-params.js +44 -8
  190. package/dist/server/app-prerender-static-params.js.map +1 -1
  191. package/dist/server/app-route-handler-cache.d.ts +2 -2
  192. package/dist/server/app-route-handler-cache.js +3 -2
  193. package/dist/server/app-route-handler-cache.js.map +1 -1
  194. package/dist/server/app-route-handler-dispatch.d.ts +6 -1
  195. package/dist/server/app-route-handler-dispatch.js +1 -1
  196. package/dist/server/app-route-handler-dispatch.js.map +1 -1
  197. package/dist/server/app-route-handler-execution.d.ts +17 -2
  198. package/dist/server/app-route-handler-execution.js.map +1 -1
  199. package/dist/server/app-route-handler-response.js +5 -4
  200. package/dist/server/app-route-handler-response.js.map +1 -1
  201. package/dist/server/app-router-entry.js +7 -15
  202. package/dist/server/app-router-entry.js.map +1 -1
  203. package/dist/server/app-rsc-cache-busting.d.ts +19 -1
  204. package/dist/server/app-rsc-cache-busting.js +36 -1
  205. package/dist/server/app-rsc-cache-busting.js.map +1 -1
  206. package/dist/server/app-rsc-embedded-chunks.d.ts +9 -0
  207. package/dist/server/app-rsc-embedded-chunks.js +34 -0
  208. package/dist/server/app-rsc-embedded-chunks.js.map +1 -0
  209. package/dist/server/app-rsc-errors.d.ts +4 -1
  210. package/dist/server/app-rsc-errors.js +1 -1
  211. package/dist/server/app-rsc-errors.js.map +1 -1
  212. package/dist/server/app-rsc-handler.d.ts +21 -5
  213. package/dist/server/app-rsc-handler.js +38 -15
  214. package/dist/server/app-rsc-handler.js.map +1 -1
  215. package/dist/server/app-rsc-render-mode.d.ts +4 -3
  216. package/dist/server/app-rsc-render-mode.js +7 -1
  217. package/dist/server/app-rsc-render-mode.js.map +1 -1
  218. package/dist/server/app-rsc-request-normalization.d.ts +4 -1
  219. package/dist/server/app-rsc-request-normalization.js +4 -1
  220. package/dist/server/app-rsc-request-normalization.js.map +1 -1
  221. package/dist/server/app-rsc-response-finalizer.d.ts +8 -1
  222. package/dist/server/app-rsc-response-finalizer.js +10 -3
  223. package/dist/server/app-rsc-response-finalizer.js.map +1 -1
  224. package/dist/server/app-rsc-route-matching.d.ts +23 -0
  225. package/dist/server/app-rsc-route-matching.js +47 -25
  226. package/dist/server/app-rsc-route-matching.js.map +1 -1
  227. package/dist/server/app-server-action-execution.d.ts +35 -3
  228. package/dist/server/app-server-action-execution.js +87 -33
  229. package/dist/server/app-server-action-execution.js.map +1 -1
  230. package/dist/server/app-ssr-entry.d.ts +3 -0
  231. package/dist/server/app-ssr-entry.js +83 -58
  232. package/dist/server/app-ssr-entry.js.map +1 -1
  233. package/dist/server/app-ssr-error-meta.d.ts +14 -0
  234. package/dist/server/app-ssr-error-meta.js +50 -0
  235. package/dist/server/app-ssr-error-meta.js.map +1 -0
  236. package/dist/server/app-ssr-stream.d.ts +7 -2
  237. package/dist/server/app-ssr-stream.js +26 -15
  238. package/dist/server/app-ssr-stream.js.map +1 -1
  239. package/dist/server/artifact-compatibility.d.ts +13 -3
  240. package/dist/server/artifact-compatibility.js +12 -8
  241. package/dist/server/artifact-compatibility.js.map +1 -1
  242. package/dist/server/cache-headers.d.ts +7 -0
  243. package/dist/server/cache-headers.js +19 -0
  244. package/dist/server/cache-headers.js.map +1 -0
  245. package/dist/server/cache-proof.d.ts +170 -5
  246. package/dist/server/cache-proof.js +472 -18
  247. package/dist/server/cache-proof.js.map +1 -1
  248. package/dist/server/client-reuse-manifest.d.ts +99 -0
  249. package/dist/server/client-reuse-manifest.js +212 -0
  250. package/dist/server/client-reuse-manifest.js.map +1 -0
  251. package/dist/server/default-global-error-module.d.ts +20 -0
  252. package/dist/server/default-global-error-module.js +20 -0
  253. package/dist/server/default-global-error-module.js.map +1 -0
  254. package/dist/server/dev-lockfile.d.ts +110 -0
  255. package/dist/server/dev-lockfile.js +180 -0
  256. package/dist/server/dev-lockfile.js.map +1 -0
  257. package/dist/server/dev-server.d.ts +9 -1
  258. package/dist/server/dev-server.js +76 -19
  259. package/dist/server/dev-server.js.map +1 -1
  260. package/dist/server/edge-api-runtime.d.ts +5 -0
  261. package/dist/server/edge-api-runtime.js +8 -0
  262. package/dist/server/edge-api-runtime.js.map +1 -0
  263. package/dist/server/file-based-metadata.d.ts +13 -0
  264. package/dist/server/file-based-metadata.js +49 -2
  265. package/dist/server/file-based-metadata.js.map +1 -1
  266. package/dist/server/headers.d.ts +20 -1
  267. package/dist/server/headers.js +22 -2
  268. package/dist/server/headers.js.map +1 -1
  269. package/dist/server/html.js +1 -1
  270. package/dist/server/html.js.map +1 -1
  271. package/dist/server/http-error-responses.d.ts +26 -1
  272. package/dist/server/http-error-responses.js +32 -2
  273. package/dist/server/http-error-responses.js.map +1 -1
  274. package/dist/server/isr-cache.d.ts +8 -3
  275. package/dist/server/isr-cache.js +24 -6
  276. package/dist/server/isr-cache.js.map +1 -1
  277. package/dist/server/metadata-route-response.js +22 -5
  278. package/dist/server/metadata-route-response.js.map +1 -1
  279. package/dist/server/metadata-routes.js +27 -8
  280. package/dist/server/metadata-routes.js.map +1 -1
  281. package/dist/server/middleware-runtime.d.ts +15 -0
  282. package/dist/server/middleware-runtime.js +60 -7
  283. package/dist/server/middleware-runtime.js.map +1 -1
  284. package/dist/server/middleware.d.ts +13 -1
  285. package/dist/server/middleware.js +16 -2
  286. package/dist/server/middleware.js.map +1 -1
  287. package/dist/server/navigation-planner.d.ts +26 -6
  288. package/dist/server/navigation-planner.js +358 -24
  289. package/dist/server/navigation-planner.js.map +1 -1
  290. package/dist/server/navigation-trace.d.ts +9 -1
  291. package/dist/server/navigation-trace.js +8 -0
  292. package/dist/server/navigation-trace.js.map +1 -1
  293. package/dist/server/normalize-path.d.ts +2 -1
  294. package/dist/server/normalize-path.js +4 -1
  295. package/dist/server/normalize-path.js.map +1 -1
  296. package/dist/server/pages-api-route.d.ts +27 -1
  297. package/dist/server/pages-api-route.js +25 -3
  298. package/dist/server/pages-api-route.js.map +1 -1
  299. package/dist/server/pages-data-route.d.ts +77 -0
  300. package/dist/server/pages-data-route.js +97 -0
  301. package/dist/server/pages-data-route.js.map +1 -0
  302. package/dist/server/pages-i18n.d.ts +51 -1
  303. package/dist/server/pages-i18n.js +61 -1
  304. package/dist/server/pages-i18n.js.map +1 -1
  305. package/dist/server/pages-page-data.d.ts +32 -4
  306. package/dist/server/pages-page-data.js +52 -19
  307. package/dist/server/pages-page-data.js.map +1 -1
  308. package/dist/server/pages-page-response.d.ts +11 -1
  309. package/dist/server/pages-page-response.js +6 -4
  310. package/dist/server/pages-page-response.js.map +1 -1
  311. package/dist/server/prod-server.d.ts +26 -1
  312. package/dist/server/prod-server.js +150 -44
  313. package/dist/server/prod-server.js.map +1 -1
  314. package/dist/server/request-pipeline.d.ts +11 -2
  315. package/dist/server/request-pipeline.js +28 -11
  316. package/dist/server/request-pipeline.js.map +1 -1
  317. package/dist/server/seed-cache.d.ts +12 -31
  318. package/dist/server/seed-cache.js +22 -35
  319. package/dist/server/seed-cache.js.map +1 -1
  320. package/dist/server/server-action-not-found.d.ts +16 -3
  321. package/dist/server/server-action-not-found.js +27 -4
  322. package/dist/server/server-action-not-found.js.map +1 -1
  323. package/dist/server/server-globals.d.ts +5 -0
  324. package/dist/server/server-globals.js +37 -0
  325. package/dist/server/server-globals.js.map +1 -0
  326. package/dist/server/skip-cache-proof.d.ts +41 -0
  327. package/dist/server/skip-cache-proof.js +101 -0
  328. package/dist/server/skip-cache-proof.js.map +1 -0
  329. package/dist/server/static-file-cache.d.ts +1 -1
  330. package/dist/server/static-file-cache.js +7 -6
  331. package/dist/server/static-file-cache.js.map +1 -1
  332. package/dist/shims/cache-runtime.d.ts +19 -2
  333. package/dist/shims/cache-runtime.js +67 -11
  334. package/dist/shims/cache-runtime.js.map +1 -1
  335. package/dist/shims/cache.d.ts +5 -18
  336. package/dist/shims/cache.js +2 -0
  337. package/dist/shims/cache.js.map +1 -1
  338. package/dist/shims/client-locale.d.ts +15 -0
  339. package/dist/shims/client-locale.js +13 -0
  340. package/dist/shims/client-locale.js.map +1 -0
  341. package/dist/shims/default-global-error.d.ts +32 -0
  342. package/dist/shims/default-global-error.js +181 -0
  343. package/dist/shims/default-global-error.js.map +1 -0
  344. package/dist/shims/document.d.ts +59 -3
  345. package/dist/shims/document.js +36 -5
  346. package/dist/shims/document.js.map +1 -1
  347. package/dist/shims/error-boundary.d.ts +2 -2
  348. package/dist/shims/error-boundary.js +6 -8
  349. package/dist/shims/error-boundary.js.map +1 -1
  350. package/dist/shims/error.d.ts +18 -1
  351. package/dist/shims/error.js +56 -1
  352. package/dist/shims/error.js.map +1 -1
  353. package/dist/shims/fetch-cache.d.ts +4 -1
  354. package/dist/shims/fetch-cache.js +40 -5
  355. package/dist/shims/fetch-cache.js.map +1 -1
  356. package/dist/shims/font-google-base.d.ts +22 -8
  357. package/dist/shims/font-google-base.js +41 -71
  358. package/dist/shims/font-google-base.js.map +1 -1
  359. package/dist/shims/font-local.d.ts +3 -20
  360. package/dist/shims/font-local.js +23 -75
  361. package/dist/shims/font-local.js.map +1 -1
  362. package/dist/shims/font-utils.d.ts +51 -0
  363. package/dist/shims/font-utils.js +97 -0
  364. package/dist/shims/font-utils.js.map +1 -0
  365. package/dist/shims/form.js +13 -6
  366. package/dist/shims/form.js.map +1 -1
  367. package/dist/shims/hash-scroll.d.ts +7 -0
  368. package/dist/shims/hash-scroll.js +30 -0
  369. package/dist/shims/hash-scroll.js.map +1 -0
  370. package/dist/shims/headers.d.ts +8 -11
  371. package/dist/shims/headers.js +22 -2
  372. package/dist/shims/headers.js.map +1 -1
  373. package/dist/shims/image.d.ts +1 -0
  374. package/dist/shims/image.js +144 -78
  375. package/dist/shims/image.js.map +1 -1
  376. package/dist/shims/internal/app-router-context.d.ts +6 -6
  377. package/dist/shims/internal/app-router-context.js +17 -6
  378. package/dist/shims/internal/app-router-context.js.map +1 -1
  379. package/dist/shims/link-prefetch.d.ts +9 -1
  380. package/dist/shims/link-prefetch.js +11 -6
  381. package/dist/shims/link-prefetch.js.map +1 -1
  382. package/dist/shims/link.d.ts +33 -5
  383. package/dist/shims/link.js +205 -50
  384. package/dist/shims/link.js.map +1 -1
  385. package/dist/shims/metadata.d.ts +16 -30
  386. package/dist/shims/metadata.js +91 -32
  387. package/dist/shims/metadata.js.map +1 -1
  388. package/dist/shims/navigation.d.ts +164 -17
  389. package/dist/shims/navigation.js +355 -84
  390. package/dist/shims/navigation.js.map +1 -1
  391. package/dist/shims/navigation.react-server.d.ts +3 -2
  392. package/dist/shims/navigation.react-server.js +5 -2
  393. package/dist/shims/navigation.react-server.js.map +1 -1
  394. package/dist/shims/og.d.ts +18 -2
  395. package/dist/shims/og.js +49 -1
  396. package/dist/shims/og.js.map +1 -0
  397. package/dist/shims/pages-router-runtime.d.ts +7 -0
  398. package/dist/shims/pages-router-runtime.js +16 -0
  399. package/dist/shims/pages-router-runtime.js.map +1 -0
  400. package/dist/shims/request-state-types.d.ts +1 -1
  401. package/dist/shims/root-params.d.ts +3 -1
  402. package/dist/shims/root-params.js +11 -3
  403. package/dist/shims/root-params.js.map +1 -1
  404. package/dist/shims/router-state.d.ts +1 -0
  405. package/dist/shims/router-state.js.map +1 -1
  406. package/dist/shims/router.d.ts +40 -7
  407. package/dist/shims/router.js +355 -250
  408. package/dist/shims/router.js.map +1 -1
  409. package/dist/shims/script.js +110 -32
  410. package/dist/shims/script.js.map +1 -1
  411. package/dist/shims/server.d.ts +21 -4
  412. package/dist/shims/server.js +31 -10
  413. package/dist/shims/server.js.map +1 -1
  414. package/dist/shims/slot.d.ts +1 -0
  415. package/dist/shims/slot.js +45 -1
  416. package/dist/shims/slot.js.map +1 -1
  417. package/dist/shims/unified-request-context.d.ts +1 -1
  418. package/dist/shims/unified-request-context.js +2 -0
  419. package/dist/shims/unified-request-context.js.map +1 -1
  420. package/dist/shims/unrecognized-action-error.d.ts +35 -0
  421. package/dist/shims/unrecognized-action-error.js +41 -0
  422. package/dist/shims/unrecognized-action-error.js.map +1 -0
  423. package/dist/shims/url-safety.d.ts +23 -1
  424. package/dist/shims/url-safety.js +29 -2
  425. package/dist/shims/url-safety.js.map +1 -1
  426. package/dist/shims/url-utils.d.ts +21 -1
  427. package/dist/shims/url-utils.js +67 -3
  428. package/dist/shims/url-utils.js.map +1 -1
  429. package/dist/typegen.d.ts +10 -0
  430. package/dist/typegen.js +242 -0
  431. package/dist/typegen.js.map +1 -0
  432. package/dist/utils/asset-prefix.d.ts +97 -0
  433. package/dist/utils/asset-prefix.js +124 -0
  434. package/dist/utils/asset-prefix.js.map +1 -0
  435. package/dist/utils/base-path.d.ts +7 -1
  436. package/dist/utils/base-path.js +10 -1
  437. package/dist/utils/base-path.js.map +1 -1
  438. package/dist/utils/cache-control-metadata.d.ts +2 -1
  439. package/dist/utils/cache-control-metadata.js +1 -3
  440. package/dist/utils/cache-control-metadata.js.map +1 -1
  441. package/dist/utils/domain-locale.d.ts +2 -1
  442. package/dist/utils/domain-locale.js +9 -1
  443. package/dist/utils/domain-locale.js.map +1 -1
  444. package/dist/utils/lazy-chunks.d.ts +1 -1
  445. package/dist/utils/lazy-chunks.js +1 -1
  446. package/dist/utils/lazy-chunks.js.map +1 -1
  447. package/dist/utils/navigation-signal.d.ts +1 -2
  448. package/dist/utils/navigation-signal.js +1 -1
  449. package/dist/utils/navigation-signal.js.map +1 -1
  450. package/dist/utils/prerender-output-paths.d.ts +15 -0
  451. package/dist/utils/prerender-output-paths.js +24 -0
  452. package/dist/utils/prerender-output-paths.js.map +1 -0
  453. package/dist/utils/query.d.ts +17 -1
  454. package/dist/utils/query.js +36 -1
  455. package/dist/utils/query.js.map +1 -1
  456. package/dist/utils/record.d.ts +5 -0
  457. package/dist/utils/record.js +8 -0
  458. package/dist/utils/record.js.map +1 -0
  459. package/dist/utils/sorted-array.d.ts +9 -0
  460. package/dist/utils/sorted-array.js +22 -0
  461. package/dist/utils/sorted-array.js.map +1 -0
  462. package/package.json +13 -5
@@ -0,0 +1,97 @@
1
+ //#region src/utils/asset-prefix.d.ts
2
+ /**
3
+ * Shared helpers for next.config `assetPrefix`.
4
+ *
5
+ * Mirrors Next.js semantics: `assetPrefix` is prepended to every JS/CSS/image/
6
+ * static asset URL emitted in the page. It is distinct from `basePath`, which
7
+ * affects route URLs.
8
+ *
9
+ * - A `assetPrefix` of `""` (empty) means "no prefix". URLs are emitted as
10
+ * `/_next/static/...` (Next.js's canonical convention) and assets are
11
+ * written to `dist/client/_next/static/...` so the on-disk layout matches.
12
+ * - A path prefix like `"/custom-asset-prefix"` is applied as a URL prefix
13
+ * relative to the deployment origin. The prod server must also serve assets
14
+ * under that prefix.
15
+ * - An absolute URL like `"https://cdn.example.com"` makes asset URLs fully
16
+ * qualified. Runtime serving on the deployment origin is a no-op — the CDN
17
+ * serves the assets directly.
18
+ *
19
+ * The path component of the asset URL after the prefix is always
20
+ * `/_next/static/<filename>` to match Next.js's convention. This is the
21
+ * convention upstream test suites assert against.
22
+ *
23
+ * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/assetPrefix
24
+ */
25
+ /**
26
+ * Suffix appended to the assetPrefix (or used standalone when no prefix is
27
+ * configured) to form the leading portion of every emitted asset URL.
28
+ * Matches Next.js: assets always live under `/_next/static/`.
29
+ */
30
+ declare const ASSET_PREFIX_URL_DIR = "_next/static";
31
+ /** Whether `assetPrefix` is an absolute URL (vs a path prefix). */
32
+ declare function isAbsoluteAssetPrefix(assetPrefix: string): boolean;
33
+ /**
34
+ * Compute the on-disk `build.assetsDir` for the given `assetPrefix`.
35
+ *
36
+ * - Path prefix (`/cdn`): write to `cdn/_next/static/` so the on-disk layout
37
+ * matches the URL — the Cloudflare ASSETS binding (and any static file
38
+ * server) serves them directly without a runtime rewrite.
39
+ * - Absolute URL (with or without path component): write to `_next/static/`.
40
+ * Runtime serving is best-effort — the CDN is expected to serve these.
41
+ * - Empty: write to `_next/static/` so the on-disk layout matches the URL
42
+ * Next.js itself emits (and that the Next.js client runtime + upstream
43
+ * test suites assert against). This makes `assetPrefix` consistent in
44
+ * both the configured and unconfigured cases — the URL contract is
45
+ * always `/<prefix?>/_next/static/...`, and the on-disk layout mirrors
46
+ * it 1:1 so the static-file layer can serve hits and return
47
+ * `404 + "Not Found"` on misses without any URL-shape special-casing
48
+ * upstream of it.
49
+ */
50
+ declare function resolveAssetsDir(assetPrefix: string): string;
51
+ /**
52
+ * Build the URL prefix to apply to emitted asset URLs. Returns the full URL
53
+ * prefix including the `_next/static/` directory, with a trailing slash.
54
+ *
55
+ * Examples:
56
+ * - `""` → `"/_next/static/"`
57
+ * - `"/cdn"` → `"/cdn/_next/static/"`
58
+ * - `"https://cdn.example.com"` → `"https://cdn.example.com/_next/static/"`
59
+ * - `"https://cdn.example.com/sub"` → `"https://cdn.example.com/sub/_next/static/"`
60
+ */
61
+ declare function resolveAssetUrlPrefix(assetPrefix: string): string;
62
+ /**
63
+ * Extract the path portion of `assetPrefix` for use in runtime URL matching.
64
+ *
65
+ * - For a path prefix: returns it verbatim (e.g. `/custom-asset-prefix`).
66
+ * - For an absolute URL: returns its pathname stripped of trailing slashes
67
+ * (e.g. `"https://cdn.example.com/sub"` → `/sub`, plain origin → `""`).
68
+ * - For empty input: returns `""`.
69
+ *
70
+ * Used by the prod server and Cloudflare worker entry to recognise asset
71
+ * requests that arrive at the deployment origin under the configured prefix.
72
+ */
73
+ declare function assetPrefixPathname(assetPrefix: string): string;
74
+ /**
75
+ * Whether the incoming request pathname targets the canonical `_next/static/`
76
+ * tree, after stripping any configured `basePath` and `assetPrefix` path
77
+ * component.
78
+ *
79
+ * Used by the Cloudflare worker entry to recognise asset-shaped requests
80
+ * that the ASSETS binding didn't serve, so they can short-circuit with a
81
+ * plain-text 404 instead of falling through to the RSC handler (which
82
+ * would render the full HTML 404 page). Mirrors Next.js's behaviour in
83
+ * `packages/next/src/server/lib/router-server.ts` where
84
+ * `realRequestPathname` is stripped of basePath/assetPrefix/i18n locale
85
+ * before the `startsWith('/_next/static/')` check.
86
+ *
87
+ * - `pathname`: incoming request pathname (with leading slash, no query).
88
+ * - `basePath`: configured `basePath` (e.g. `"/docs"`) or `""`.
89
+ * - `assetPathPrefix`: path component of `assetPrefix` (e.g. `"/cdn"`) or
90
+ * `""`. Use `assetPrefixPathname()` to derive this from a raw assetPrefix.
91
+ *
92
+ * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/lib/router-server.ts
93
+ */
94
+ declare function isNextStaticPath(pathname: string, basePath: string, assetPathPrefix: string): boolean;
95
+ //#endregion
96
+ export { ASSET_PREFIX_URL_DIR, assetPrefixPathname, isAbsoluteAssetPrefix, isNextStaticPath, resolveAssetUrlPrefix, resolveAssetsDir };
97
+ //# sourceMappingURL=asset-prefix.d.ts.map
@@ -0,0 +1,124 @@
1
+ //#region src/utils/asset-prefix.ts
2
+ /**
3
+ * Shared helpers for next.config `assetPrefix`.
4
+ *
5
+ * Mirrors Next.js semantics: `assetPrefix` is prepended to every JS/CSS/image/
6
+ * static asset URL emitted in the page. It is distinct from `basePath`, which
7
+ * affects route URLs.
8
+ *
9
+ * - A `assetPrefix` of `""` (empty) means "no prefix". URLs are emitted as
10
+ * `/_next/static/...` (Next.js's canonical convention) and assets are
11
+ * written to `dist/client/_next/static/...` so the on-disk layout matches.
12
+ * - A path prefix like `"/custom-asset-prefix"` is applied as a URL prefix
13
+ * relative to the deployment origin. The prod server must also serve assets
14
+ * under that prefix.
15
+ * - An absolute URL like `"https://cdn.example.com"` makes asset URLs fully
16
+ * qualified. Runtime serving on the deployment origin is a no-op — the CDN
17
+ * serves the assets directly.
18
+ *
19
+ * The path component of the asset URL after the prefix is always
20
+ * `/_next/static/<filename>` to match Next.js's convention. This is the
21
+ * convention upstream test suites assert against.
22
+ *
23
+ * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/assetPrefix
24
+ */
25
+ /**
26
+ * Suffix appended to the assetPrefix (or used standalone when no prefix is
27
+ * configured) to form the leading portion of every emitted asset URL.
28
+ * Matches Next.js: assets always live under `/_next/static/`.
29
+ */
30
+ const ASSET_PREFIX_URL_DIR = "_next/static";
31
+ /** Whether `assetPrefix` is an absolute URL (vs a path prefix). */
32
+ function isAbsoluteAssetPrefix(assetPrefix) {
33
+ return /^https?:\/\//i.test(assetPrefix);
34
+ }
35
+ /**
36
+ * Compute the on-disk `build.assetsDir` for the given `assetPrefix`.
37
+ *
38
+ * - Path prefix (`/cdn`): write to `cdn/_next/static/` so the on-disk layout
39
+ * matches the URL — the Cloudflare ASSETS binding (and any static file
40
+ * server) serves them directly without a runtime rewrite.
41
+ * - Absolute URL (with or without path component): write to `_next/static/`.
42
+ * Runtime serving is best-effort — the CDN is expected to serve these.
43
+ * - Empty: write to `_next/static/` so the on-disk layout matches the URL
44
+ * Next.js itself emits (and that the Next.js client runtime + upstream
45
+ * test suites assert against). This makes `assetPrefix` consistent in
46
+ * both the configured and unconfigured cases — the URL contract is
47
+ * always `/<prefix?>/_next/static/...`, and the on-disk layout mirrors
48
+ * it 1:1 so the static-file layer can serve hits and return
49
+ * `404 + "Not Found"` on misses without any URL-shape special-casing
50
+ * upstream of it.
51
+ */
52
+ function resolveAssetsDir(assetPrefix) {
53
+ if (!assetPrefix) return ASSET_PREFIX_URL_DIR;
54
+ if (isAbsoluteAssetPrefix(assetPrefix)) return ASSET_PREFIX_URL_DIR;
55
+ let stripped = assetPrefix;
56
+ while (stripped.startsWith("/")) stripped = stripped.slice(1);
57
+ return `${stripped}/${ASSET_PREFIX_URL_DIR}`;
58
+ }
59
+ /**
60
+ * Build the URL prefix to apply to emitted asset URLs. Returns the full URL
61
+ * prefix including the `_next/static/` directory, with a trailing slash.
62
+ *
63
+ * Examples:
64
+ * - `""` → `"/_next/static/"`
65
+ * - `"/cdn"` → `"/cdn/_next/static/"`
66
+ * - `"https://cdn.example.com"` → `"https://cdn.example.com/_next/static/"`
67
+ * - `"https://cdn.example.com/sub"` → `"https://cdn.example.com/sub/_next/static/"`
68
+ */
69
+ function resolveAssetUrlPrefix(assetPrefix) {
70
+ if (!assetPrefix) return `/${ASSET_PREFIX_URL_DIR}/`;
71
+ return `${assetPrefix}/${ASSET_PREFIX_URL_DIR}/`;
72
+ }
73
+ /**
74
+ * Extract the path portion of `assetPrefix` for use in runtime URL matching.
75
+ *
76
+ * - For a path prefix: returns it verbatim (e.g. `/custom-asset-prefix`).
77
+ * - For an absolute URL: returns its pathname stripped of trailing slashes
78
+ * (e.g. `"https://cdn.example.com/sub"` → `/sub`, plain origin → `""`).
79
+ * - For empty input: returns `""`.
80
+ *
81
+ * Used by the prod server and Cloudflare worker entry to recognise asset
82
+ * requests that arrive at the deployment origin under the configured prefix.
83
+ */
84
+ function assetPrefixPathname(assetPrefix) {
85
+ if (!assetPrefix) return "";
86
+ if (!isAbsoluteAssetPrefix(assetPrefix)) return assetPrefix;
87
+ try {
88
+ let pathname = new URL(assetPrefix).pathname;
89
+ while (pathname.endsWith("/")) pathname = pathname.slice(0, -1);
90
+ return pathname === "" ? "" : pathname;
91
+ } catch {
92
+ return "";
93
+ }
94
+ }
95
+ /**
96
+ * Whether the incoming request pathname targets the canonical `_next/static/`
97
+ * tree, after stripping any configured `basePath` and `assetPrefix` path
98
+ * component.
99
+ *
100
+ * Used by the Cloudflare worker entry to recognise asset-shaped requests
101
+ * that the ASSETS binding didn't serve, so they can short-circuit with a
102
+ * plain-text 404 instead of falling through to the RSC handler (which
103
+ * would render the full HTML 404 page). Mirrors Next.js's behaviour in
104
+ * `packages/next/src/server/lib/router-server.ts` where
105
+ * `realRequestPathname` is stripped of basePath/assetPrefix/i18n locale
106
+ * before the `startsWith('/_next/static/')` check.
107
+ *
108
+ * - `pathname`: incoming request pathname (with leading slash, no query).
109
+ * - `basePath`: configured `basePath` (e.g. `"/docs"`) or `""`.
110
+ * - `assetPathPrefix`: path component of `assetPrefix` (e.g. `"/cdn"`) or
111
+ * `""`. Use `assetPrefixPathname()` to derive this from a raw assetPrefix.
112
+ *
113
+ * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/lib/router-server.ts
114
+ */
115
+ function isNextStaticPath(pathname, basePath, assetPathPrefix) {
116
+ let p = pathname;
117
+ if (basePath && (p === basePath || p.startsWith(basePath + "/"))) p = p.slice(basePath.length) || "/";
118
+ if (assetPathPrefix && (p === assetPathPrefix || p.startsWith(assetPathPrefix + "/"))) p = p.slice(assetPathPrefix.length) || "/";
119
+ return p.startsWith(`/${ASSET_PREFIX_URL_DIR}/`);
120
+ }
121
+ //#endregion
122
+ export { ASSET_PREFIX_URL_DIR, assetPrefixPathname, isAbsoluteAssetPrefix, isNextStaticPath, resolveAssetUrlPrefix, resolveAssetsDir };
123
+
124
+ //# sourceMappingURL=asset-prefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-prefix.js","names":[],"sources":["../../src/utils/asset-prefix.ts"],"sourcesContent":["/**\n * Shared helpers for next.config `assetPrefix`.\n *\n * Mirrors Next.js semantics: `assetPrefix` is prepended to every JS/CSS/image/\n * static asset URL emitted in the page. It is distinct from `basePath`, which\n * affects route URLs.\n *\n * - A `assetPrefix` of `\"\"` (empty) means \"no prefix\". URLs are emitted as\n * `/_next/static/...` (Next.js's canonical convention) and assets are\n * written to `dist/client/_next/static/...` so the on-disk layout matches.\n * - A path prefix like `\"/custom-asset-prefix\"` is applied as a URL prefix\n * relative to the deployment origin. The prod server must also serve assets\n * under that prefix.\n * - An absolute URL like `\"https://cdn.example.com\"` makes asset URLs fully\n * qualified. Runtime serving on the deployment origin is a no-op — the CDN\n * serves the assets directly.\n *\n * The path component of the asset URL after the prefix is always\n * `/_next/static/<filename>` to match Next.js's convention. This is the\n * convention upstream test suites assert against.\n *\n * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/assetPrefix\n */\n\n/**\n * Suffix appended to the assetPrefix (or used standalone when no prefix is\n * configured) to form the leading portion of every emitted asset URL.\n * Matches Next.js: assets always live under `/_next/static/`.\n */\nexport const ASSET_PREFIX_URL_DIR = \"_next/static\";\n\n/** Whether `assetPrefix` is an absolute URL (vs a path prefix). */\nexport function isAbsoluteAssetPrefix(assetPrefix: string): boolean {\n return /^https?:\\/\\//i.test(assetPrefix);\n}\n\n/**\n * Compute the on-disk `build.assetsDir` for the given `assetPrefix`.\n *\n * - Path prefix (`/cdn`): write to `cdn/_next/static/` so the on-disk layout\n * matches the URL — the Cloudflare ASSETS binding (and any static file\n * server) serves them directly without a runtime rewrite.\n * - Absolute URL (with or without path component): write to `_next/static/`.\n * Runtime serving is best-effort — the CDN is expected to serve these.\n * - Empty: write to `_next/static/` so the on-disk layout matches the URL\n * Next.js itself emits (and that the Next.js client runtime + upstream\n * test suites assert against). This makes `assetPrefix` consistent in\n * both the configured and unconfigured cases — the URL contract is\n * always `/<prefix?>/_next/static/...`, and the on-disk layout mirrors\n * it 1:1 so the static-file layer can serve hits and return\n * `404 + \"Not Found\"` on misses without any URL-shape special-casing\n * upstream of it.\n */\nexport function resolveAssetsDir(assetPrefix: string): string {\n if (!assetPrefix) return ASSET_PREFIX_URL_DIR;\n if (isAbsoluteAssetPrefix(assetPrefix)) {\n // Files on disk land at `_next/static/...`. The absolute URL is applied\n // at URL-rendering time via renderBuiltUrl; on-disk path is irrelevant\n // to the CDN.\n return ASSET_PREFIX_URL_DIR;\n }\n // Path prefix — strip leading slash so the path joins cleanly with outDir.\n // Use an explicit loop instead of `replace(/^\\/+/, \"\")` so CodeQL doesn't\n // flag the regex as polynomial-time on uncontrolled input.\n let stripped = assetPrefix;\n while (stripped.startsWith(\"/\")) stripped = stripped.slice(1);\n return `${stripped}/${ASSET_PREFIX_URL_DIR}`;\n}\n\n/**\n * Build the URL prefix to apply to emitted asset URLs. Returns the full URL\n * prefix including the `_next/static/` directory, with a trailing slash.\n *\n * Examples:\n * - `\"\"` → `\"/_next/static/\"`\n * - `\"/cdn\"` → `\"/cdn/_next/static/\"`\n * - `\"https://cdn.example.com\"` → `\"https://cdn.example.com/_next/static/\"`\n * - `\"https://cdn.example.com/sub\"` → `\"https://cdn.example.com/sub/_next/static/\"`\n */\nexport function resolveAssetUrlPrefix(assetPrefix: string): string {\n if (!assetPrefix) return `/${ASSET_PREFIX_URL_DIR}/`;\n return `${assetPrefix}/${ASSET_PREFIX_URL_DIR}/`;\n}\n\n/**\n * Extract the path portion of `assetPrefix` for use in runtime URL matching.\n *\n * - For a path prefix: returns it verbatim (e.g. `/custom-asset-prefix`).\n * - For an absolute URL: returns its pathname stripped of trailing slashes\n * (e.g. `\"https://cdn.example.com/sub\"` → `/sub`, plain origin → `\"\"`).\n * - For empty input: returns `\"\"`.\n *\n * Used by the prod server and Cloudflare worker entry to recognise asset\n * requests that arrive at the deployment origin under the configured prefix.\n */\nexport function assetPrefixPathname(assetPrefix: string): string {\n if (!assetPrefix) return \"\";\n if (!isAbsoluteAssetPrefix(assetPrefix)) return assetPrefix;\n try {\n let pathname = new URL(assetPrefix).pathname;\n while (pathname.endsWith(\"/\")) pathname = pathname.slice(0, -1);\n return pathname === \"\" ? \"\" : pathname;\n } catch {\n return \"\";\n }\n}\n\n/**\n * Whether the incoming request pathname targets the canonical `_next/static/`\n * tree, after stripping any configured `basePath` and `assetPrefix` path\n * component.\n *\n * Used by the Cloudflare worker entry to recognise asset-shaped requests\n * that the ASSETS binding didn't serve, so they can short-circuit with a\n * plain-text 404 instead of falling through to the RSC handler (which\n * would render the full HTML 404 page). Mirrors Next.js's behaviour in\n * `packages/next/src/server/lib/router-server.ts` where\n * `realRequestPathname` is stripped of basePath/assetPrefix/i18n locale\n * before the `startsWith('/_next/static/')` check.\n *\n * - `pathname`: incoming request pathname (with leading slash, no query).\n * - `basePath`: configured `basePath` (e.g. `\"/docs\"`) or `\"\"`.\n * - `assetPathPrefix`: path component of `assetPrefix` (e.g. `\"/cdn\"`) or\n * `\"\"`. Use `assetPrefixPathname()` to derive this from a raw assetPrefix.\n *\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/lib/router-server.ts\n */\nexport function isNextStaticPath(\n pathname: string,\n basePath: string,\n assetPathPrefix: string,\n): boolean {\n let p = pathname;\n if (basePath && (p === basePath || p.startsWith(basePath + \"/\"))) {\n p = p.slice(basePath.length) || \"/\";\n }\n if (assetPathPrefix && (p === assetPathPrefix || p.startsWith(assetPathPrefix + \"/\"))) {\n p = p.slice(assetPathPrefix.length) || \"/\";\n }\n return p.startsWith(`/${ASSET_PREFIX_URL_DIR}/`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,uBAAuB;;AAGpC,SAAgB,sBAAsB,aAA8B;CAClE,OAAO,gBAAgB,KAAK,YAAY;;;;;;;;;;;;;;;;;;;AAoB1C,SAAgB,iBAAiB,aAA6B;CAC5D,IAAI,CAAC,aAAa,OAAO;CACzB,IAAI,sBAAsB,YAAY,EAIpC,OAAO;CAKT,IAAI,WAAW;CACf,OAAO,SAAS,WAAW,IAAI,EAAE,WAAW,SAAS,MAAM,EAAE;CAC7D,OAAO,GAAG,SAAS,GAAG;;;;;;;;;;;;AAaxB,SAAgB,sBAAsB,aAA6B;CACjE,IAAI,CAAC,aAAa,OAAO,IAAI,qBAAqB;CAClD,OAAO,GAAG,YAAY,GAAG,qBAAqB;;;;;;;;;;;;;AAchD,SAAgB,oBAAoB,aAA6B;CAC/D,IAAI,CAAC,aAAa,OAAO;CACzB,IAAI,CAAC,sBAAsB,YAAY,EAAE,OAAO;CAChD,IAAI;EACF,IAAI,WAAW,IAAI,IAAI,YAAY,CAAC;EACpC,OAAO,SAAS,SAAS,IAAI,EAAE,WAAW,SAAS,MAAM,GAAG,GAAG;EAC/D,OAAO,aAAa,KAAK,KAAK;SACxB;EACN,OAAO;;;;;;;;;;;;;;;;;;;;;;;AAwBX,SAAgB,iBACd,UACA,UACA,iBACS;CACT,IAAI,IAAI;CACR,IAAI,aAAa,MAAM,YAAY,EAAE,WAAW,WAAW,IAAI,GAC7D,IAAI,EAAE,MAAM,SAAS,OAAO,IAAI;CAElC,IAAI,oBAAoB,MAAM,mBAAmB,EAAE,WAAW,kBAAkB,IAAI,GAClF,IAAI,EAAE,MAAM,gBAAgB,OAAO,IAAI;CAEzC,OAAO,EAAE,WAAW,IAAI,qBAAqB,GAAG"}
@@ -15,6 +15,12 @@ declare function hasBasePath(pathname: string, basePath: string): boolean;
15
15
  * boundary. Returns the original pathname when it is outside the basePath.
16
16
  */
17
17
  declare function stripBasePath(pathname: string, basePath: string): string;
18
+ /**
19
+ * Add the configured basePath to a pathname unless it is already inside that
20
+ * basePath. Query strings and hashes must be handled by callers before calling
21
+ * this pathname-only helper.
22
+ */
23
+ declare function addBasePathToPathname(pathname: string, basePath: string | undefined): string;
18
24
  /**
19
25
  * Remove trailing slashes from a pathname while preserving the root "/".
20
26
  * Collapses any number of trailing slashes ("/a//" → "/a"). Used by the
@@ -22,5 +28,5 @@ declare function stripBasePath(pathname: string, basePath: string): string;
22
28
  */
23
29
  declare function removeTrailingSlash(pathname: string): string;
24
30
  //#endregion
25
- export { hasBasePath, removeTrailingSlash, stripBasePath };
31
+ export { addBasePathToPathname, hasBasePath, removeTrailingSlash, stripBasePath };
26
32
  //# sourceMappingURL=base-path.d.ts.map
@@ -22,6 +22,15 @@ function stripBasePath(pathname, basePath) {
22
22
  return pathname.slice(basePath.length) || "/";
23
23
  }
24
24
  /**
25
+ * Add the configured basePath to a pathname unless it is already inside that
26
+ * basePath. Query strings and hashes must be handled by callers before calling
27
+ * this pathname-only helper.
28
+ */
29
+ function addBasePathToPathname(pathname, basePath) {
30
+ if (!basePath || hasBasePath(pathname, basePath)) return pathname;
31
+ return pathname === "/" ? basePath : `${basePath}${pathname}`;
32
+ }
33
+ /**
25
34
  * Remove trailing slashes from a pathname while preserving the root "/".
26
35
  * Collapses any number of trailing slashes ("/a//" → "/a"). Used by the
27
36
  * trailing-slash redirect path and route pattern normalization.
@@ -33,6 +42,6 @@ function removeTrailingSlash(pathname) {
33
42
  return end === 0 ? "/" : pathname.slice(0, end);
34
43
  }
35
44
  //#endregion
36
- export { hasBasePath, removeTrailingSlash, stripBasePath };
45
+ export { addBasePathToPathname, hasBasePath, removeTrailingSlash, stripBasePath };
37
46
 
38
47
  //# sourceMappingURL=base-path.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-path.js","names":[],"sources":["../../src/utils/base-path.ts"],"sourcesContent":["/**\n * Shared basePath helpers.\n *\n * Next.js only treats a pathname as being under basePath when it is an exact\n * match (\"/app\") or starts with the basePath followed by a path separator\n * (\"/app/...\"). Prefix-only matches like \"/application\" must be left intact.\n */\n\n/**\n * Check whether a pathname is inside the configured basePath.\n */\nexport function hasBasePath(pathname: string, basePath: string): boolean {\n if (!basePath) return false;\n return pathname === basePath || pathname.startsWith(basePath + \"/\");\n}\n\n/**\n * Strip the basePath prefix from a pathname when it matches on a segment\n * boundary. Returns the original pathname when it is outside the basePath.\n */\nexport function stripBasePath(pathname: string, basePath: string): string {\n if (!hasBasePath(pathname, basePath)) return pathname;\n return pathname.slice(basePath.length) || \"/\";\n}\n\n/**\n * Remove trailing slashes from a pathname while preserving the root \"/\".\n * Collapses any number of trailing slashes (\"/a//\" → \"/a\"). Used by the\n * trailing-slash redirect path and route pattern normalization.\n */\nexport function removeTrailingSlash(pathname: string): string {\n if (pathname === \"/\") return \"/\";\n let end = pathname.length;\n while (end > 0 && pathname.charCodeAt(end - 1) === 47 /* \"/\" */) end--;\n return end === 0 ? \"/\" : pathname.slice(0, end);\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,YAAY,UAAkB,UAA2B;CACvE,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,aAAa,YAAY,SAAS,WAAW,WAAW,IAAI;;;;;;AAOrE,SAAgB,cAAc,UAAkB,UAA0B;CACxE,IAAI,CAAC,YAAY,UAAU,SAAS,EAAE,OAAO;CAC7C,OAAO,SAAS,MAAM,SAAS,OAAO,IAAI;;;;;;;AAQ5C,SAAgB,oBAAoB,UAA0B;CAC5D,IAAI,aAAa,KAAK,OAAO;CAC7B,IAAI,MAAM,SAAS;CACnB,OAAO,MAAM,KAAK,SAAS,WAAW,MAAM,EAAE,KAAK,IAAc;CACjE,OAAO,QAAQ,IAAI,MAAM,SAAS,MAAM,GAAG,IAAI"}
1
+ {"version":3,"file":"base-path.js","names":[],"sources":["../../src/utils/base-path.ts"],"sourcesContent":["/**\n * Shared basePath helpers.\n *\n * Next.js only treats a pathname as being under basePath when it is an exact\n * match (\"/app\") or starts with the basePath followed by a path separator\n * (\"/app/...\"). Prefix-only matches like \"/application\" must be left intact.\n */\n\n/**\n * Check whether a pathname is inside the configured basePath.\n */\nexport function hasBasePath(pathname: string, basePath: string): boolean {\n if (!basePath) return false;\n return pathname === basePath || pathname.startsWith(basePath + \"/\");\n}\n\n/**\n * Strip the basePath prefix from a pathname when it matches on a segment\n * boundary. Returns the original pathname when it is outside the basePath.\n */\nexport function stripBasePath(pathname: string, basePath: string): string {\n if (!hasBasePath(pathname, basePath)) return pathname;\n return pathname.slice(basePath.length) || \"/\";\n}\n\n/**\n * Add the configured basePath to a pathname unless it is already inside that\n * basePath. Query strings and hashes must be handled by callers before calling\n * this pathname-only helper.\n */\nexport function addBasePathToPathname(pathname: string, basePath: string | undefined): string {\n if (!basePath || hasBasePath(pathname, basePath)) return pathname;\n return pathname === \"/\" ? basePath : `${basePath}${pathname}`;\n}\n\n/**\n * Remove trailing slashes from a pathname while preserving the root \"/\".\n * Collapses any number of trailing slashes (\"/a//\" → \"/a\"). Used by the\n * trailing-slash redirect path and route pattern normalization.\n */\nexport function removeTrailingSlash(pathname: string): string {\n if (pathname === \"/\") return \"/\";\n let end = pathname.length;\n while (end > 0 && pathname.charCodeAt(end - 1) === 47 /* \"/\" */) end--;\n return end === 0 ? \"/\" : pathname.slice(0, end);\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,YAAY,UAAkB,UAA2B;CACvE,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,aAAa,YAAY,SAAS,WAAW,WAAW,IAAI;;;;;;AAOrE,SAAgB,cAAc,UAAkB,UAA0B;CACxE,IAAI,CAAC,YAAY,UAAU,SAAS,EAAE,OAAO;CAC7C,OAAO,SAAS,MAAM,SAAS,OAAO,IAAI;;;;;;;AAQ5C,SAAgB,sBAAsB,UAAkB,UAAsC;CAC5F,IAAI,CAAC,YAAY,YAAY,UAAU,SAAS,EAAE,OAAO;CACzD,OAAO,aAAa,MAAM,WAAW,GAAG,WAAW;;;;;;;AAQrD,SAAgB,oBAAoB,UAA0B;CAC5D,IAAI,aAAa,KAAK,OAAO;CAC7B,IAAI,MAAM,SAAS;CACnB,OAAO,MAAM,KAAK,SAAS,WAAW,MAAM,EAAE,KAAK,IAAc;CACjE,OAAO,QAAQ,IAAI,MAAM,SAAS,MAAM,GAAG,IAAI"}
@@ -1,5 +1,6 @@
1
+ import { isUnknownRecord } from "./record.js";
2
+
1
3
  //#region src/utils/cache-control-metadata.d.ts
2
- declare function isUnknownRecord(value: unknown): value is Record<string, unknown>;
3
4
  declare function readCacheControlNumberField(ctx: Record<string, unknown> | undefined, field: string): number | undefined;
4
5
  //#endregion
5
6
  export { isUnknownRecord, readCacheControlNumberField };
@@ -1,7 +1,5 @@
1
+ import { isUnknownRecord } from "./record.js";
1
2
  //#region src/utils/cache-control-metadata.ts
2
- function isUnknownRecord(value) {
3
- return value !== null && typeof value === "object" && !Array.isArray(value);
4
- }
5
3
  function readRecordField(ctx, field) {
6
4
  const value = ctx?.[field];
7
5
  return isUnknownRecord(value) ? value : void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"cache-control-metadata.js","names":[],"sources":["../../src/utils/cache-control-metadata.ts"],"sourcesContent":["export function isUnknownRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction readRecordField(\n ctx: Record<string, unknown> | undefined,\n field: string,\n): Record<string, unknown> | undefined {\n const value = ctx?.[field];\n return isUnknownRecord(value) ? value : undefined;\n}\n\nexport function readCacheControlNumberField(\n ctx: Record<string, unknown> | undefined,\n field: string,\n): number | undefined {\n const cacheControl = readRecordField(ctx, \"cacheControl\");\n const value = cacheControl?.[field] ?? ctx?.[field];\n return typeof value === \"number\" ? value : undefined;\n}\n"],"mappings":";AAAA,SAAgB,gBAAgB,OAAkD;CAChF,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAS,gBACP,KACA,OACqC;CACrC,MAAM,QAAQ,MAAM;CACpB,OAAO,gBAAgB,MAAM,GAAG,QAAQ,KAAA;;AAG1C,SAAgB,4BACd,KACA,OACoB;CAEpB,MAAM,QADe,gBAAgB,KAAK,eAChB,GAAG,UAAU,MAAM;CAC7C,OAAO,OAAO,UAAU,WAAW,QAAQ,KAAA"}
1
+ {"version":3,"file":"cache-control-metadata.js","names":[],"sources":["../../src/utils/cache-control-metadata.ts"],"sourcesContent":["import { isUnknownRecord } from \"./record.js\";\nexport { isUnknownRecord } from \"./record.js\";\n\nfunction readRecordField(\n ctx: Record<string, unknown> | undefined,\n field: string,\n): Record<string, unknown> | undefined {\n const value = ctx?.[field];\n return isUnknownRecord(value) ? value : undefined;\n}\n\nexport function readCacheControlNumberField(\n ctx: Record<string, unknown> | undefined,\n field: string,\n): number | undefined {\n const cacheControl = readRecordField(ctx, \"cacheControl\");\n const value = cacheControl?.[field] ?? ctx?.[field];\n return typeof value === \"number\" ? value : undefined;\n}\n"],"mappings":";;AAGA,SAAS,gBACP,KACA,OACqC;CACrC,MAAM,QAAQ,MAAM;CACpB,OAAO,gBAAgB,MAAM,GAAG,QAAQ,KAAA;;AAG1C,SAAgB,4BACd,KACA,OACoB;CAEpB,MAAM,QADe,gBAAgB,KAAK,eAChB,GAAG,UAAU,MAAM;CAC7C,OAAO,OAAO,UAAU,WAAW,QAAQ,KAAA"}
@@ -12,6 +12,7 @@ declare function normalizeDomainHostname(hostname: string | null | undefined): s
12
12
  */
13
13
  declare function detectDomainLocale(domainItems?: readonly DomainLocale[], hostname?: string, detectedLocale?: string): DomainLocale | undefined;
14
14
  declare function addLocalePrefix(path: string, locale: string, localeDefault: string): string;
15
+ declare function getLocalePathPrefix(path: string, locales: readonly string[] | undefined): string | undefined;
15
16
  declare function getDomainLocaleUrl(url: string, locale: string, {
16
17
  basePath,
17
18
  currentHostname,
@@ -22,5 +23,5 @@ declare function getDomainLocaleUrl(url: string, locale: string, {
22
23
  domainItems?: readonly DomainLocale[];
23
24
  }): string | undefined;
24
25
  //#endregion
25
- export { DomainLocale, addLocalePrefix, detectDomainLocale, getDomainLocaleUrl, normalizeDomainHostname };
26
+ export { DomainLocale, addLocalePrefix, detectDomainLocale, getDomainLocaleUrl, getLocalePathPrefix, normalizeDomainHostname };
26
27
  //# sourceMappingURL=domain-locale.d.ts.map
@@ -25,6 +25,14 @@ function addLocalePrefix(path, locale, localeDefault) {
25
25
  if (normalizedPathname === localePrefix || normalizedPathname.startsWith(`${localePrefix}/`)) return path.startsWith("/") ? path : pathWithLeadingSlash;
26
26
  return `/${locale}${pathWithLeadingSlash}`;
27
27
  }
28
+ function getLocalePathPrefix(path, locales) {
29
+ if (!locales?.length) return void 0;
30
+ const pathWithLeadingSlash = path.startsWith("/") ? path : `/${path}`;
31
+ const firstSegment = (pathWithLeadingSlash.split(/[?#]/, 1)[0] ?? pathWithLeadingSlash).split("/").find(Boolean);
32
+ if (!firstSegment) return void 0;
33
+ const normalizedSegment = firstSegment.toLowerCase();
34
+ return locales.find((locale) => locale.toLowerCase() === normalizedSegment);
35
+ }
28
36
  function withBasePath(path, basePath = "") {
29
37
  if (!basePath) return path;
30
38
  return basePath + path;
@@ -39,6 +47,6 @@ function getDomainLocaleUrl(url, locale, { basePath, currentHostname, domainItem
39
47
  return `${`http${targetDomain.http ? "" : "s"}://`}${targetDomain.domain}${withBasePath(localizedPath, basePath)}`;
40
48
  }
41
49
  //#endregion
42
- export { addLocalePrefix, detectDomainLocale, getDomainLocaleUrl, normalizeDomainHostname };
50
+ export { addLocalePrefix, detectDomainLocale, getDomainLocaleUrl, getLocalePathPrefix, normalizeDomainHostname };
43
51
 
44
52
  //# sourceMappingURL=domain-locale.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"domain-locale.js","names":[],"sources":["../../src/utils/domain-locale.ts"],"sourcesContent":["import type { NextI18nConfig } from \"../config/next-config.js\";\n\nexport type DomainLocale = NonNullable<NextI18nConfig[\"domains\"]>[number];\n\nexport function normalizeDomainHostname(hostname: string | null | undefined): string | undefined {\n if (!hostname) return undefined;\n return hostname.split(\",\", 1)[0]?.trim().split(\":\", 1)[0]?.toLowerCase() || undefined;\n}\n\n/**\n * Match a configured domain either by hostname or locale.\n * When both are provided, the checks intentionally use OR semantics so the\n * same helper can cover Next.js's hostname lookup and preferred-locale lookup.\n * If both are passed, the first domain matching either input wins, so callers\n * should pass hostname or detectedLocale, not both.\n */\nexport function detectDomainLocale(\n domainItems?: readonly DomainLocale[],\n hostname?: string,\n detectedLocale?: string,\n): DomainLocale | undefined {\n if (!domainItems?.length) return undefined;\n\n const normalizedHostname = normalizeDomainHostname(hostname);\n const normalizedLocale = detectedLocale?.toLowerCase();\n\n for (const item of domainItems) {\n const domainHostname = normalizeDomainHostname(item.domain);\n if (\n normalizedHostname === domainHostname ||\n normalizedLocale === item.defaultLocale.toLowerCase() ||\n item.locales?.some((locale) => locale.toLowerCase() === normalizedLocale)\n ) {\n return item;\n }\n }\n\n return undefined;\n}\n\nexport function addLocalePrefix(path: string, locale: string, localeDefault: string): string {\n const normalizedLocale = locale.toLowerCase();\n if (normalizedLocale === localeDefault.toLowerCase()) return path;\n\n const pathWithLeadingSlash = path.startsWith(\"/\") ? path : `/${path}`;\n const pathname = pathWithLeadingSlash.split(/[?#]/, 1)[0] ?? pathWithLeadingSlash;\n const normalizedPathname = pathname.toLowerCase();\n const localePrefix = `/${normalizedLocale}`;\n\n if (normalizedPathname === localePrefix || normalizedPathname.startsWith(`${localePrefix}/`)) {\n return path.startsWith(\"/\") ? path : pathWithLeadingSlash;\n }\n\n return `/${locale}${pathWithLeadingSlash}`;\n}\n\nfunction withBasePath(path: string, basePath = \"\"): string {\n if (!basePath) return path;\n return basePath + path;\n}\n\nexport function getDomainLocaleUrl(\n url: string,\n locale: string,\n {\n basePath,\n currentHostname,\n domainItems,\n }: {\n basePath?: string;\n currentHostname?: string | null;\n domainItems?: readonly DomainLocale[];\n },\n): string | undefined {\n if (!domainItems?.length) return undefined;\n\n const targetDomain = detectDomainLocale(domainItems, undefined, locale);\n if (!targetDomain) return undefined;\n\n const currentDomain = detectDomainLocale(domainItems, currentHostname ?? undefined);\n const localizedPath = addLocalePrefix(url, locale, targetDomain.defaultLocale);\n\n if (\n currentDomain &&\n normalizeDomainHostname(currentDomain.domain) === normalizeDomainHostname(targetDomain.domain)\n ) {\n // Same-domain switches fall back to the caller's standard locale-prefix\n // logic. This relies on __VINEXT_DEFAULT_LOCALE__ matching the current\n // domain's defaultLocale, which the server entry keeps in sync.\n return undefined;\n }\n\n const scheme = `http${targetDomain.http ? \"\" : \"s\"}://`;\n return `${scheme}${targetDomain.domain}${withBasePath(localizedPath, basePath)}`;\n}\n"],"mappings":";AAIA,SAAgB,wBAAwB,UAAyD;CAC/F,IAAI,CAAC,UAAU,OAAO,KAAA;CACtB,OAAO,SAAS,MAAM,KAAK,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC,IAAI,aAAa,IAAI,KAAA;;;;;;;;;AAU9E,SAAgB,mBACd,aACA,UACA,gBAC0B;CAC1B,IAAI,CAAC,aAAa,QAAQ,OAAO,KAAA;CAEjC,MAAM,qBAAqB,wBAAwB,SAAS;CAC5D,MAAM,mBAAmB,gBAAgB,aAAa;CAEtD,KAAK,MAAM,QAAQ,aAEjB,IACE,uBAFqB,wBAAwB,KAAK,OAEb,IACrC,qBAAqB,KAAK,cAAc,aAAa,IACrD,KAAK,SAAS,MAAM,WAAW,OAAO,aAAa,KAAK,iBAAiB,EAEzE,OAAO;;AAOb,SAAgB,gBAAgB,MAAc,QAAgB,eAA+B;CAC3F,MAAM,mBAAmB,OAAO,aAAa;CAC7C,IAAI,qBAAqB,cAAc,aAAa,EAAE,OAAO;CAE7D,MAAM,uBAAuB,KAAK,WAAW,IAAI,GAAG,OAAO,IAAI;CAE/D,MAAM,sBADW,qBAAqB,MAAM,QAAQ,EAAE,CAAC,MAAM,sBACzB,aAAa;CACjD,MAAM,eAAe,IAAI;CAEzB,IAAI,uBAAuB,gBAAgB,mBAAmB,WAAW,GAAG,aAAa,GAAG,EAC1F,OAAO,KAAK,WAAW,IAAI,GAAG,OAAO;CAGvC,OAAO,IAAI,SAAS;;AAGtB,SAAS,aAAa,MAAc,WAAW,IAAY;CACzD,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,WAAW;;AAGpB,SAAgB,mBACd,KACA,QACA,EACE,UACA,iBACA,eAMkB;CACpB,IAAI,CAAC,aAAa,QAAQ,OAAO,KAAA;CAEjC,MAAM,eAAe,mBAAmB,aAAa,KAAA,GAAW,OAAO;CACvE,IAAI,CAAC,cAAc,OAAO,KAAA;CAE1B,MAAM,gBAAgB,mBAAmB,aAAa,mBAAmB,KAAA,EAAU;CACnF,MAAM,gBAAgB,gBAAgB,KAAK,QAAQ,aAAa,cAAc;CAE9E,IACE,iBACA,wBAAwB,cAAc,OAAO,KAAK,wBAAwB,aAAa,OAAO,EAK9F;CAIF,OAAO,GAAG,OADY,aAAa,OAAO,KAAK,IAAI,OAChC,aAAa,SAAS,aAAa,eAAe,SAAS"}
1
+ {"version":3,"file":"domain-locale.js","names":[],"sources":["../../src/utils/domain-locale.ts"],"sourcesContent":["import type { NextI18nConfig } from \"../config/next-config.js\";\n\nexport type DomainLocale = NonNullable<NextI18nConfig[\"domains\"]>[number];\n\nexport function normalizeDomainHostname(hostname: string | null | undefined): string | undefined {\n if (!hostname) return undefined;\n return hostname.split(\",\", 1)[0]?.trim().split(\":\", 1)[0]?.toLowerCase() || undefined;\n}\n\n/**\n * Match a configured domain either by hostname or locale.\n * When both are provided, the checks intentionally use OR semantics so the\n * same helper can cover Next.js's hostname lookup and preferred-locale lookup.\n * If both are passed, the first domain matching either input wins, so callers\n * should pass hostname or detectedLocale, not both.\n */\nexport function detectDomainLocale(\n domainItems?: readonly DomainLocale[],\n hostname?: string,\n detectedLocale?: string,\n): DomainLocale | undefined {\n if (!domainItems?.length) return undefined;\n\n const normalizedHostname = normalizeDomainHostname(hostname);\n const normalizedLocale = detectedLocale?.toLowerCase();\n\n for (const item of domainItems) {\n const domainHostname = normalizeDomainHostname(item.domain);\n if (\n normalizedHostname === domainHostname ||\n normalizedLocale === item.defaultLocale.toLowerCase() ||\n item.locales?.some((locale) => locale.toLowerCase() === normalizedLocale)\n ) {\n return item;\n }\n }\n\n return undefined;\n}\n\nexport function addLocalePrefix(path: string, locale: string, localeDefault: string): string {\n const normalizedLocale = locale.toLowerCase();\n if (normalizedLocale === localeDefault.toLowerCase()) return path;\n\n const pathWithLeadingSlash = path.startsWith(\"/\") ? path : `/${path}`;\n const pathname = pathWithLeadingSlash.split(/[?#]/, 1)[0] ?? pathWithLeadingSlash;\n const normalizedPathname = pathname.toLowerCase();\n const localePrefix = `/${normalizedLocale}`;\n\n if (normalizedPathname === localePrefix || normalizedPathname.startsWith(`${localePrefix}/`)) {\n return path.startsWith(\"/\") ? path : pathWithLeadingSlash;\n }\n\n return `/${locale}${pathWithLeadingSlash}`;\n}\n\nexport function getLocalePathPrefix(\n path: string,\n locales: readonly string[] | undefined,\n): string | undefined {\n if (!locales?.length) return undefined;\n\n const pathWithLeadingSlash = path.startsWith(\"/\") ? path : `/${path}`;\n const pathname = pathWithLeadingSlash.split(/[?#]/, 1)[0] ?? pathWithLeadingSlash;\n const firstSegment = pathname.split(\"/\").find(Boolean);\n if (!firstSegment) return undefined;\n\n const normalizedSegment = firstSegment.toLowerCase();\n return locales.find((locale) => locale.toLowerCase() === normalizedSegment);\n}\n\nfunction withBasePath(path: string, basePath = \"\"): string {\n if (!basePath) return path;\n return basePath + path;\n}\n\nexport function getDomainLocaleUrl(\n url: string,\n locale: string,\n {\n basePath,\n currentHostname,\n domainItems,\n }: {\n basePath?: string;\n currentHostname?: string | null;\n domainItems?: readonly DomainLocale[];\n },\n): string | undefined {\n if (!domainItems?.length) return undefined;\n\n const targetDomain = detectDomainLocale(domainItems, undefined, locale);\n if (!targetDomain) return undefined;\n\n const currentDomain = detectDomainLocale(domainItems, currentHostname ?? undefined);\n const localizedPath = addLocalePrefix(url, locale, targetDomain.defaultLocale);\n\n if (\n currentDomain &&\n normalizeDomainHostname(currentDomain.domain) === normalizeDomainHostname(targetDomain.domain)\n ) {\n // Same-domain switches fall back to the caller's standard locale-prefix\n // logic. This relies on __VINEXT_DEFAULT_LOCALE__ matching the current\n // domain's defaultLocale, which the server entry keeps in sync.\n return undefined;\n }\n\n const scheme = `http${targetDomain.http ? \"\" : \"s\"}://`;\n return `${scheme}${targetDomain.domain}${withBasePath(localizedPath, basePath)}`;\n}\n"],"mappings":";AAIA,SAAgB,wBAAwB,UAAyD;CAC/F,IAAI,CAAC,UAAU,OAAO,KAAA;CACtB,OAAO,SAAS,MAAM,KAAK,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC,IAAI,aAAa,IAAI,KAAA;;;;;;;;;AAU9E,SAAgB,mBACd,aACA,UACA,gBAC0B;CAC1B,IAAI,CAAC,aAAa,QAAQ,OAAO,KAAA;CAEjC,MAAM,qBAAqB,wBAAwB,SAAS;CAC5D,MAAM,mBAAmB,gBAAgB,aAAa;CAEtD,KAAK,MAAM,QAAQ,aAEjB,IACE,uBAFqB,wBAAwB,KAAK,OAEb,IACrC,qBAAqB,KAAK,cAAc,aAAa,IACrD,KAAK,SAAS,MAAM,WAAW,OAAO,aAAa,KAAK,iBAAiB,EAEzE,OAAO;;AAOb,SAAgB,gBAAgB,MAAc,QAAgB,eAA+B;CAC3F,MAAM,mBAAmB,OAAO,aAAa;CAC7C,IAAI,qBAAqB,cAAc,aAAa,EAAE,OAAO;CAE7D,MAAM,uBAAuB,KAAK,WAAW,IAAI,GAAG,OAAO,IAAI;CAE/D,MAAM,sBADW,qBAAqB,MAAM,QAAQ,EAAE,CAAC,MAAM,sBACzB,aAAa;CACjD,MAAM,eAAe,IAAI;CAEzB,IAAI,uBAAuB,gBAAgB,mBAAmB,WAAW,GAAG,aAAa,GAAG,EAC1F,OAAO,KAAK,WAAW,IAAI,GAAG,OAAO;CAGvC,OAAO,IAAI,SAAS;;AAGtB,SAAgB,oBACd,MACA,SACoB;CACpB,IAAI,CAAC,SAAS,QAAQ,OAAO,KAAA;CAE7B,MAAM,uBAAuB,KAAK,WAAW,IAAI,GAAG,OAAO,IAAI;CAE/D,MAAM,gBADW,qBAAqB,MAAM,QAAQ,EAAE,CAAC,MAAM,sBAC/B,MAAM,IAAI,CAAC,KAAK,QAAQ;CACtD,IAAI,CAAC,cAAc,OAAO,KAAA;CAE1B,MAAM,oBAAoB,aAAa,aAAa;CACpD,OAAO,QAAQ,MAAM,WAAW,OAAO,aAAa,KAAK,kBAAkB;;AAG7E,SAAS,aAAa,MAAc,WAAW,IAAY;CACzD,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,WAAW;;AAGpB,SAAgB,mBACd,KACA,QACA,EACE,UACA,iBACA,eAMkB;CACpB,IAAI,CAAC,aAAa,QAAQ,OAAO,KAAA;CAEjC,MAAM,eAAe,mBAAmB,aAAa,KAAA,GAAW,OAAO;CACvE,IAAI,CAAC,cAAc,OAAO,KAAA;CAE1B,MAAM,gBAAgB,mBAAmB,aAAa,mBAAmB,KAAA,EAAU;CACnF,MAAM,gBAAgB,gBAAgB,KAAK,QAAQ,aAAa,cAAc;CAE9E,IACE,iBACA,wBAAwB,cAAc,OAAO,KAAK,wBAAwB,aAAa,OAAO,EAK9F;CAIF,OAAO,GAAG,OADY,aAAa,OAAO,KAAK,IAAI,OAChC,aAAa,SAAS,aAAa,eAAe,SAAS"}
@@ -25,7 +25,7 @@ type BuildManifestChunk = {
25
25
  * @param buildManifest - Vite's build manifest (manifest.json), which is a
26
26
  * Record<string, ManifestChunk> where each chunk has `file`, `imports`,
27
27
  * `dynamicImports`, `isEntry`, and `isDynamicEntry` fields.
28
- * @returns Array of chunk filenames (e.g. "assets/mermaid-NOHMQCX5.js") that
28
+ * @returns Array of chunk filenames (e.g. "_next/static/mermaid-NOHMQCX5.js") that
29
29
  * should be excluded from modulepreload hints.
30
30
  */
31
31
  declare function computeLazyChunks(buildManifest: Record<string, BuildManifestChunk>): string[];
@@ -13,7 +13,7 @@
13
13
  * @param buildManifest - Vite's build manifest (manifest.json), which is a
14
14
  * Record<string, ManifestChunk> where each chunk has `file`, `imports`,
15
15
  * `dynamicImports`, `isEntry`, and `isDynamicEntry` fields.
16
- * @returns Array of chunk filenames (e.g. "assets/mermaid-NOHMQCX5.js") that
16
+ * @returns Array of chunk filenames (e.g. "_next/static/mermaid-NOHMQCX5.js") that
17
17
  * should be excluded from modulepreload hints.
18
18
  */
19
19
  function computeLazyChunks(buildManifest) {
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-chunks.js","names":[],"sources":["../../src/utils/lazy-chunks.ts"],"sourcesContent":["/**\n * Build-manifest chunk metadata used to compute lazy chunks.\n */\ntype BuildManifestChunk = {\n file: string;\n isEntry?: boolean;\n isDynamicEntry?: boolean;\n imports?: string[];\n dynamicImports?: string[];\n css?: string[];\n assets?: string[];\n};\n\n/**\n * Compute the set of chunk filenames that are ONLY reachable through dynamic\n * imports (i.e. behind React.lazy(), next/dynamic, or manual import()).\n *\n * These chunks should NOT be modulepreloaded in the HTML — they will be\n * fetched on demand when the dynamic import executes.\n *\n * Algorithm: Starting from all entry chunks in the build manifest, walk the\n * static `imports` tree (breadth-first). Any chunk file NOT reached by this\n * walk is only reachable through `dynamicImports` and is therefore \"lazy\".\n *\n * @param buildManifest - Vite's build manifest (manifest.json), which is a\n * Record<string, ManifestChunk> where each chunk has `file`, `imports`,\n * `dynamicImports`, `isEntry`, and `isDynamicEntry` fields.\n * @returns Array of chunk filenames (e.g. \"assets/mermaid-NOHMQCX5.js\") that\n * should be excluded from modulepreload hints.\n */\nexport function computeLazyChunks(buildManifest: Record<string, BuildManifestChunk>): string[] {\n // Collect all chunk files that are statically reachable from entries\n const eagerFiles = new Set<string>();\n const visited = new Set<string>();\n const queue: string[] = [];\n\n // Start BFS from all entry chunks\n for (const key of Object.keys(buildManifest)) {\n const chunk = buildManifest[key];\n if (chunk.isEntry) {\n queue.push(key);\n }\n }\n\n while (queue.length > 0) {\n const key = queue.shift();\n if (!key || visited.has(key)) continue;\n visited.add(key);\n\n const chunk = buildManifest[key];\n if (!chunk) continue;\n\n // Mark this chunk's file as eager\n eagerFiles.add(chunk.file);\n\n // Also mark its CSS as eager (CSS should always be preloaded to avoid FOUC)\n if (chunk.css) {\n for (const cssFile of chunk.css) {\n eagerFiles.add(cssFile);\n }\n }\n\n // Follow only static imports — NOT dynamicImports\n if (chunk.imports) {\n for (const imp of chunk.imports) {\n if (!visited.has(imp)) {\n queue.push(imp);\n }\n }\n }\n }\n\n // Any JS file in the manifest that's NOT in eagerFiles is a lazy chunk\n const lazyChunks: string[] = [];\n const allFiles = new Set<string>();\n for (const key of Object.keys(buildManifest)) {\n const chunk = buildManifest[key];\n if (chunk.file && !allFiles.has(chunk.file)) {\n allFiles.add(chunk.file);\n if (!eagerFiles.has(chunk.file) && chunk.file.endsWith(\".js\")) {\n lazyChunks.push(chunk.file);\n }\n }\n }\n\n return lazyChunks;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,SAAgB,kBAAkB,eAA6D;CAE7F,MAAM,6BAAa,IAAI,KAAa;CACpC,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,QAAkB,EAAE;CAG1B,KAAK,MAAM,OAAO,OAAO,KAAK,cAAc,EAE1C,IADc,cAAc,KAClB,SACR,MAAM,KAAK,IAAI;CAInB,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,MAAM,MAAM,OAAO;EACzB,IAAI,CAAC,OAAO,QAAQ,IAAI,IAAI,EAAE;EAC9B,QAAQ,IAAI,IAAI;EAEhB,MAAM,QAAQ,cAAc;EAC5B,IAAI,CAAC,OAAO;EAGZ,WAAW,IAAI,MAAM,KAAK;EAG1B,IAAI,MAAM,KACR,KAAK,MAAM,WAAW,MAAM,KAC1B,WAAW,IAAI,QAAQ;EAK3B,IAAI,MAAM;QACH,MAAM,OAAO,MAAM,SACtB,IAAI,CAAC,QAAQ,IAAI,IAAI,EACnB,MAAM,KAAK,IAAI;;;CAOvB,MAAM,aAAuB,EAAE;CAC/B,MAAM,2BAAW,IAAI,KAAa;CAClC,KAAK,MAAM,OAAO,OAAO,KAAK,cAAc,EAAE;EAC5C,MAAM,QAAQ,cAAc;EAC5B,IAAI,MAAM,QAAQ,CAAC,SAAS,IAAI,MAAM,KAAK,EAAE;GAC3C,SAAS,IAAI,MAAM,KAAK;GACxB,IAAI,CAAC,WAAW,IAAI,MAAM,KAAK,IAAI,MAAM,KAAK,SAAS,MAAM,EAC3D,WAAW,KAAK,MAAM,KAAK;;;CAKjC,OAAO"}
1
+ {"version":3,"file":"lazy-chunks.js","names":[],"sources":["../../src/utils/lazy-chunks.ts"],"sourcesContent":["/**\n * Build-manifest chunk metadata used to compute lazy chunks.\n */\ntype BuildManifestChunk = {\n file: string;\n isEntry?: boolean;\n isDynamicEntry?: boolean;\n imports?: string[];\n dynamicImports?: string[];\n css?: string[];\n assets?: string[];\n};\n\n/**\n * Compute the set of chunk filenames that are ONLY reachable through dynamic\n * imports (i.e. behind React.lazy(), next/dynamic, or manual import()).\n *\n * These chunks should NOT be modulepreloaded in the HTML — they will be\n * fetched on demand when the dynamic import executes.\n *\n * Algorithm: Starting from all entry chunks in the build manifest, walk the\n * static `imports` tree (breadth-first). Any chunk file NOT reached by this\n * walk is only reachable through `dynamicImports` and is therefore \"lazy\".\n *\n * @param buildManifest - Vite's build manifest (manifest.json), which is a\n * Record<string, ManifestChunk> where each chunk has `file`, `imports`,\n * `dynamicImports`, `isEntry`, and `isDynamicEntry` fields.\n * @returns Array of chunk filenames (e.g. \"_next/static/mermaid-NOHMQCX5.js\") that\n * should be excluded from modulepreload hints.\n */\nexport function computeLazyChunks(buildManifest: Record<string, BuildManifestChunk>): string[] {\n // Collect all chunk files that are statically reachable from entries\n const eagerFiles = new Set<string>();\n const visited = new Set<string>();\n const queue: string[] = [];\n\n // Start BFS from all entry chunks\n for (const key of Object.keys(buildManifest)) {\n const chunk = buildManifest[key];\n if (chunk.isEntry) {\n queue.push(key);\n }\n }\n\n while (queue.length > 0) {\n const key = queue.shift();\n if (!key || visited.has(key)) continue;\n visited.add(key);\n\n const chunk = buildManifest[key];\n if (!chunk) continue;\n\n // Mark this chunk's file as eager\n eagerFiles.add(chunk.file);\n\n // Also mark its CSS as eager (CSS should always be preloaded to avoid FOUC)\n if (chunk.css) {\n for (const cssFile of chunk.css) {\n eagerFiles.add(cssFile);\n }\n }\n\n // Follow only static imports — NOT dynamicImports\n if (chunk.imports) {\n for (const imp of chunk.imports) {\n if (!visited.has(imp)) {\n queue.push(imp);\n }\n }\n }\n }\n\n // Any JS file in the manifest that's NOT in eagerFiles is a lazy chunk\n const lazyChunks: string[] = [];\n const allFiles = new Set<string>();\n for (const key of Object.keys(buildManifest)) {\n const chunk = buildManifest[key];\n if (chunk.file && !allFiles.has(chunk.file)) {\n allFiles.add(chunk.file);\n if (!eagerFiles.has(chunk.file) && chunk.file.endsWith(\".js\")) {\n lazyChunks.push(chunk.file);\n }\n }\n }\n\n return lazyChunks;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,SAAgB,kBAAkB,eAA6D;CAE7F,MAAM,6BAAa,IAAI,KAAa;CACpC,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,QAAkB,EAAE;CAG1B,KAAK,MAAM,OAAO,OAAO,KAAK,cAAc,EAE1C,IADc,cAAc,KAClB,SACR,MAAM,KAAK,IAAI;CAInB,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,MAAM,MAAM,OAAO;EACzB,IAAI,CAAC,OAAO,QAAQ,IAAI,IAAI,EAAE;EAC9B,QAAQ,IAAI,IAAI;EAEhB,MAAM,QAAQ,cAAc;EAC5B,IAAI,CAAC,OAAO;EAGZ,WAAW,IAAI,MAAM,KAAK;EAG1B,IAAI,MAAM,KACR,KAAK,MAAM,WAAW,MAAM,KAC1B,WAAW,IAAI,QAAQ;EAK3B,IAAI,MAAM;QACH,MAAM,OAAO,MAAM,SACtB,IAAI,CAAC,QAAQ,IAAI,IAAI,EACnB,MAAM,KAAK,IAAI;;;CAOvB,MAAM,aAAuB,EAAE;CAC/B,MAAM,2BAAW,IAAI,KAAa;CAClC,KAAK,MAAM,OAAO,OAAO,KAAK,cAAc,EAAE;EAC5C,MAAM,QAAQ,cAAc;EAC5B,IAAI,MAAM,QAAQ,CAAC,SAAS,IAAI,MAAM,KAAK,EAAE;GAC3C,SAAS,IAAI,MAAM,KAAK;GACxB,IAAI,CAAC,WAAW,IAAI,MAAM,KAAK,IAAI,MAAM,KAAK,SAAS,MAAM,EAC3D,WAAW,KAAK,MAAM,KAAK;;;CAKjC,OAAO"}
@@ -1,6 +1,5 @@
1
1
  //#region src/utils/navigation-signal.d.ts
2
- declare function getErrorDigest(error: unknown): string | null;
3
2
  declare function isNavigationSignalError(error: unknown): boolean;
4
3
  //#endregion
5
- export { getErrorDigest, isNavigationSignalError };
4
+ export { isNavigationSignalError };
6
5
  //# sourceMappingURL=navigation-signal.d.ts.map
@@ -9,6 +9,6 @@ function isNavigationSignalError(error) {
9
9
  return digest === "NEXT_NOT_FOUND" || digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;") || digest.startsWith("NEXT_REDIRECT;");
10
10
  }
11
11
  //#endregion
12
- export { getErrorDigest, isNavigationSignalError };
12
+ export { isNavigationSignalError };
13
13
 
14
14
  //# sourceMappingURL=navigation-signal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-signal.js","names":[],"sources":["../../src/utils/navigation-signal.ts"],"sourcesContent":["// Shared digest-classification helpers for App Router \"navigation signal\"\n// errors — the ones thrown via redirect(), notFound(), forbidden(), and\n// unauthorized(). These have framework-recognized digests of the form\n// `NEXT_REDIRECT;...`, `NEXT_NOT_FOUND`, or `NEXT_HTTP_ERROR_FALLBACK;<status>`\n// and must be re-thrown by user-facing error boundaries (so they reach the\n// dedicated framework boundary that handles them) and filtered out of the\n// dev error overlay (so a caught redirect doesn't show up as a runtime\n// error).\n//\n// Previously duplicated between shims/error-boundary.tsx and\n// server/dev-error-overlay.tsx; consolidated here so they cannot drift.\n\nexport function getErrorDigest(error: unknown): string | null {\n if (!error || typeof error !== \"object\" || !(\"digest\" in error)) {\n return null;\n }\n return String((error as { digest: unknown }).digest);\n}\n\nexport function isNavigationSignalError(error: unknown): boolean {\n const digest = getErrorDigest(error);\n if (digest === null) return false;\n return (\n digest === \"NEXT_NOT_FOUND\" ||\n digest.startsWith(\"NEXT_HTTP_ERROR_FALLBACK;\") ||\n digest.startsWith(\"NEXT_REDIRECT;\")\n );\n}\n"],"mappings":";AAYA,SAAgB,eAAe,OAA+B;CAC5D,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,EAAE,YAAY,QACvD,OAAO;CAET,OAAO,OAAQ,MAA8B,OAAO;;AAGtD,SAAgB,wBAAwB,OAAyB;CAC/D,MAAM,SAAS,eAAe,MAAM;CACpC,IAAI,WAAW,MAAM,OAAO;CAC5B,OACE,WAAW,oBACX,OAAO,WAAW,4BAA4B,IAC9C,OAAO,WAAW,iBAAiB"}
1
+ {"version":3,"file":"navigation-signal.js","names":[],"sources":["../../src/utils/navigation-signal.ts"],"sourcesContent":["// Shared digest-classification helpers for App Router \"navigation signal\"\n// errors — the ones thrown via redirect(), notFound(), forbidden(), and\n// unauthorized(). These have framework-recognized digests of the form\n// `NEXT_REDIRECT;...`, `NEXT_NOT_FOUND`, or `NEXT_HTTP_ERROR_FALLBACK;<status>`\n// and must be re-thrown by user-facing error boundaries (so they reach the\n// dedicated framework boundary that handles them) and filtered out of the\n// dev error overlay (so a caught redirect doesn't show up as a runtime\n// error).\n//\n// Previously duplicated between shims/error-boundary.tsx and\n// server/dev-error-overlay.tsx; consolidated here so they cannot drift.\n\nfunction getErrorDigest(error: unknown): string | null {\n if (!error || typeof error !== \"object\" || !(\"digest\" in error)) {\n return null;\n }\n return String((error as { digest: unknown }).digest);\n}\n\nexport function isNavigationSignalError(error: unknown): boolean {\n const digest = getErrorDigest(error);\n if (digest === null) return false;\n return (\n digest === \"NEXT_NOT_FOUND\" ||\n digest.startsWith(\"NEXT_HTTP_ERROR_FALLBACK;\") ||\n digest.startsWith(\"NEXT_REDIRECT;\")\n );\n}\n"],"mappings":";AAYA,SAAS,eAAe,OAA+B;CACrD,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,EAAE,YAAY,QACvD,OAAO;CAET,OAAO,OAAQ,MAA8B,OAAO;;AAGtD,SAAgB,wBAAwB,OAAyB;CAC/D,MAAM,SAAS,eAAe,MAAM;CACpC,IAAI,WAAW,MAAM,OAAO;CAC5B,OACE,WAAW,oBACX,OAAO,WAAW,4BAA4B,IAC9C,OAAO,WAAW,iBAAiB"}
@@ -0,0 +1,15 @@
1
+ //#region src/utils/prerender-output-paths.d.ts
2
+ /**
3
+ * Determine the HTML output file path for a prerendered URL.
4
+ * Respects trailingSlash config.
5
+ */
6
+ declare function getOutputPath(urlPath: string, trailingSlash: boolean): string;
7
+ /**
8
+ * Determine the RSC output file path for a prerendered URL.
9
+ * "/blog/hello-world" -> "blog/hello-world.rsc"
10
+ * "/" -> "index.rsc"
11
+ */
12
+ declare function getRscOutputPath(urlPath: string): string;
13
+ //#endregion
14
+ export { getOutputPath, getRscOutputPath };
15
+ //# sourceMappingURL=prerender-output-paths.d.ts.map
@@ -0,0 +1,24 @@
1
+ //#region src/utils/prerender-output-paths.ts
2
+ /**
3
+ * Determine the HTML output file path for a prerendered URL.
4
+ * Respects trailingSlash config.
5
+ */
6
+ function getOutputPath(urlPath, trailingSlash) {
7
+ if (urlPath === "/") return "index.html";
8
+ const clean = urlPath.replace(/^\//, "");
9
+ if (trailingSlash) return `${clean}/index.html`;
10
+ return `${clean}.html`;
11
+ }
12
+ /**
13
+ * Determine the RSC output file path for a prerendered URL.
14
+ * "/blog/hello-world" -> "blog/hello-world.rsc"
15
+ * "/" -> "index.rsc"
16
+ */
17
+ function getRscOutputPath(urlPath) {
18
+ if (urlPath === "/") return "index.rsc";
19
+ return urlPath.replace(/^\//, "") + ".rsc";
20
+ }
21
+ //#endregion
22
+ export { getOutputPath, getRscOutputPath };
23
+
24
+ //# sourceMappingURL=prerender-output-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prerender-output-paths.js","names":[],"sources":["../../src/utils/prerender-output-paths.ts"],"sourcesContent":["/**\n * Determine the HTML output file path for a prerendered URL.\n * Respects trailingSlash config.\n */\nexport function getOutputPath(urlPath: string, trailingSlash: boolean): string {\n if (urlPath === \"/\") return \"index.html\";\n const clean = urlPath.replace(/^\\//, \"\");\n if (trailingSlash) return `${clean}/index.html`;\n return `${clean}.html`;\n}\n\n/**\n * Determine the RSC output file path for a prerendered URL.\n * \"/blog/hello-world\" -> \"blog/hello-world.rsc\"\n * \"/\" -> \"index.rsc\"\n */\nexport function getRscOutputPath(urlPath: string): string {\n if (urlPath === \"/\") return \"index.rsc\";\n return urlPath.replace(/^\\//, \"\") + \".rsc\";\n}\n"],"mappings":";;;;;AAIA,SAAgB,cAAc,SAAiB,eAAgC;CAC7E,IAAI,YAAY,KAAK,OAAO;CAC5B,MAAM,QAAQ,QAAQ,QAAQ,OAAO,GAAG;CACxC,IAAI,eAAe,OAAO,GAAG,MAAM;CACnC,OAAO,GAAG,MAAM;;;;;;;AAQlB,SAAgB,iBAAiB,SAAyB;CACxD,IAAI,YAAY,KAAK,OAAO;CAC5B,OAAO,QAAQ,QAAQ,OAAO,GAAG,GAAG"}
@@ -18,11 +18,27 @@ declare function mergeRouteParamsIntoQuery(query: Record<string, string | string
18
18
  */
19
19
  declare function parseQueryString(url: string): Record<string, string | string[]>;
20
20
  declare function urlQueryToSearchParams(query: UrlQuery): URLSearchParams;
21
+ /**
22
+ * Merge the original request URL's query parameters into a rewrite-target URL.
23
+ *
24
+ * Matches Next.js behavior: original query params are preserved on rewrites,
25
+ * but the rewrite-target URL wins on key conflicts. Ported from Next.js
26
+ * `Object.assign(parsedUrl.query, rewrittenParsedUrl.query)` in
27
+ * route-modules/route-module.ts.
28
+ *
29
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/server/route-modules/route-module.ts
30
+ *
31
+ * The fragment from `rewriteUrl` is preserved (origin/pathname always come
32
+ * from the rewrite target). Absolute rewrite URLs are returned unchanged when
33
+ * the origin differs from the original — external rewrites are proxied
34
+ * elsewhere and shouldn't have local query params smuggled in.
35
+ */
36
+ declare function mergeRewriteQuery(originalUrl: string, rewriteUrl: string): string;
21
37
  /**
22
38
  * Append query parameters to a URL while preserving any existing query string
23
39
  * and fragment identifier.
24
40
  */
25
41
  declare function appendSearchParamsToUrl(url: string, params: Iterable<[string, string]>): string;
26
42
  //#endregion
27
- export { UrlQuery, addQueryParam, appendSearchParamsToUrl, mergeRouteParamsIntoQuery, parseQueryString, urlQueryToSearchParams };
43
+ export { UrlQuery, addQueryParam, appendSearchParamsToUrl, mergeRewriteQuery, mergeRouteParamsIntoQuery, parseQueryString, urlQueryToSearchParams };
28
44
  //# sourceMappingURL=query.d.ts.map
@@ -59,6 +59,41 @@ function urlQueryToSearchParams(query) {
59
59
  return params;
60
60
  }
61
61
  /**
62
+ * Merge the original request URL's query parameters into a rewrite-target URL.
63
+ *
64
+ * Matches Next.js behavior: original query params are preserved on rewrites,
65
+ * but the rewrite-target URL wins on key conflicts. Ported from Next.js
66
+ * `Object.assign(parsedUrl.query, rewrittenParsedUrl.query)` in
67
+ * route-modules/route-module.ts.
68
+ *
69
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/server/route-modules/route-module.ts
70
+ *
71
+ * The fragment from `rewriteUrl` is preserved (origin/pathname always come
72
+ * from the rewrite target). Absolute rewrite URLs are returned unchanged when
73
+ * the origin differs from the original — external rewrites are proxied
74
+ * elsewhere and shouldn't have local query params smuggled in.
75
+ */
76
+ function mergeRewriteQuery(originalUrl, rewriteUrl) {
77
+ const originalSearchIndex = originalUrl.indexOf("?");
78
+ if (originalSearchIndex === -1) return rewriteUrl;
79
+ const originalQuery = originalUrl.slice(originalSearchIndex + 1).split("#")[0];
80
+ if (!originalQuery) return rewriteUrl;
81
+ const hashIndex = rewriteUrl.indexOf("#");
82
+ const beforeHash = hashIndex === -1 ? rewriteUrl : rewriteUrl.slice(0, hashIndex);
83
+ const hash = hashIndex === -1 ? "" : rewriteUrl.slice(hashIndex);
84
+ const queryIndex = beforeHash.indexOf("?");
85
+ const base = queryIndex === -1 ? beforeHash : beforeHash.slice(0, queryIndex);
86
+ const rewriteQuery = queryIndex === -1 ? "" : beforeHash.slice(queryIndex + 1);
87
+ const merged = new URLSearchParams(originalQuery);
88
+ const rewriteParams = new URLSearchParams(rewriteQuery);
89
+ const rewriteKeys = /* @__PURE__ */ new Set();
90
+ for (const key of rewriteParams.keys()) rewriteKeys.add(key);
91
+ for (const key of rewriteKeys) merged.delete(key);
92
+ for (const [key, value] of rewriteParams) merged.append(key, value);
93
+ const search = merged.toString();
94
+ return `${base}${search ? `?${search}` : ""}${hash}`;
95
+ }
96
+ /**
62
97
  * Append query parameters to a URL while preserving any existing query string
63
98
  * and fragment identifier.
64
99
  */
@@ -75,6 +110,6 @@ function appendSearchParamsToUrl(url, params) {
75
110
  return `${base}${search ? `?${search}` : ""}${hash}`;
76
111
  }
77
112
  //#endregion
78
- export { addQueryParam, appendSearchParamsToUrl, mergeRouteParamsIntoQuery, parseQueryString, urlQueryToSearchParams };
113
+ export { addQueryParam, appendSearchParamsToUrl, mergeRewriteQuery, mergeRouteParamsIntoQuery, parseQueryString, urlQueryToSearchParams };
79
114
 
80
115
  //# sourceMappingURL=query.js.map