vinext 0.0.49 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (506) hide show
  1. package/dist/build/client-build-config.js.map +1 -1
  2. package/dist/build/google-fonts/build-url.js.map +1 -1
  3. package/dist/build/google-fonts/fallback-metrics-data.js +14031 -0
  4. package/dist/build/google-fonts/fallback-metrics-data.js.map +1 -0
  5. package/dist/build/google-fonts/fallback-metrics.d.ts +13 -0
  6. package/dist/build/google-fonts/fallback-metrics.js +46 -0
  7. package/dist/build/google-fonts/fallback-metrics.js.map +1 -0
  8. package/dist/build/google-fonts/get-axes.js.map +1 -1
  9. package/dist/build/google-fonts/sort-variants.js.map +1 -1
  10. package/dist/build/google-fonts/validate.js.map +1 -1
  11. package/dist/build/layout-classification.js.map +1 -1
  12. package/dist/build/nitro-route-rules.js.map +1 -1
  13. package/dist/build/precompress.d.ts +13 -2
  14. package/dist/build/precompress.js +12 -3
  15. package/dist/build/precompress.js.map +1 -1
  16. package/dist/build/prerender.d.ts +17 -1
  17. package/dist/build/prerender.js +114 -23
  18. package/dist/build/prerender.js.map +1 -1
  19. package/dist/build/report.d.ts +5 -4
  20. package/dist/build/report.js +196 -348
  21. package/dist/build/report.js.map +1 -1
  22. package/dist/build/route-classification-injector.js.map +1 -1
  23. package/dist/build/route-classification-manifest.js.map +1 -1
  24. package/dist/build/run-prerender.js.map +1 -1
  25. package/dist/build/server-manifest.js.map +1 -1
  26. package/dist/build/ssr-manifest.js.map +1 -1
  27. package/dist/build/standalone.js.map +1 -1
  28. package/dist/build/static-export.js.map +1 -1
  29. package/dist/check.js +2 -1
  30. package/dist/check.js.map +1 -1
  31. package/dist/cli-args.js.map +1 -1
  32. package/dist/cli.js +68 -7
  33. package/dist/cli.js.map +1 -1
  34. package/dist/client/instrumentation-client-state.js.map +1 -1
  35. package/dist/client/validate-module-path.js.map +1 -1
  36. package/dist/client/vinext-next-data.d.ts +5 -1
  37. package/dist/client/window-next.d.ts +151 -0
  38. package/dist/client/window-next.js +48 -0
  39. package/dist/client/window-next.js.map +1 -0
  40. package/dist/cloudflare/kv-cache-handler.js.map +1 -1
  41. package/dist/cloudflare/tpr.js +2 -1
  42. package/dist/cloudflare/tpr.js.map +1 -1
  43. package/dist/config/config-matchers.d.ts +3 -1
  44. package/dist/config/config-matchers.js +5 -4
  45. package/dist/config/config-matchers.js.map +1 -1
  46. package/dist/config/dotenv.d.ts +11 -1
  47. package/dist/config/dotenv.js.map +1 -1
  48. package/dist/config/next-config.d.ts +93 -6
  49. package/dist/config/next-config.js +233 -6
  50. package/dist/config/next-config.js.map +1 -1
  51. package/dist/config/tsconfig-paths.d.ts +13 -0
  52. package/dist/config/tsconfig-paths.js +117 -0
  53. package/dist/config/tsconfig-paths.js.map +1 -0
  54. package/dist/deploy.js +16 -7
  55. package/dist/deploy.js.map +1 -1
  56. package/dist/entries/app-browser-entry.d.ts +3 -1
  57. package/dist/entries/app-browser-entry.js +36 -2
  58. package/dist/entries/app-browser-entry.js.map +1 -1
  59. package/dist/entries/app-rsc-entry.d.ts +19 -1
  60. package/dist/entries/app-rsc-entry.js +49 -12
  61. package/dist/entries/app-rsc-entry.js.map +1 -1
  62. package/dist/entries/app-rsc-manifest.d.ts +9 -0
  63. package/dist/entries/app-rsc-manifest.js +8 -1
  64. package/dist/entries/app-rsc-manifest.js.map +1 -1
  65. package/dist/entries/app-ssr-entry.js.map +1 -1
  66. package/dist/entries/pages-client-entry.js +3 -5
  67. package/dist/entries/pages-client-entry.js.map +1 -1
  68. package/dist/entries/pages-entry-helpers.js.map +1 -1
  69. package/dist/entries/pages-server-entry.js +34 -1
  70. package/dist/entries/pages-server-entry.js.map +1 -1
  71. package/dist/entries/runtime-entry-module.js.map +1 -1
  72. package/dist/index.js +204 -53
  73. package/dist/index.js.map +1 -1
  74. package/dist/init.js.map +1 -1
  75. package/dist/plugins/async-hooks-stub.js.map +1 -1
  76. package/dist/plugins/client-reference-dedup.d.ts +15 -2
  77. package/dist/plugins/client-reference-dedup.js +138 -16
  78. package/dist/plugins/client-reference-dedup.js.map +1 -1
  79. package/dist/plugins/fonts.d.ts +2 -2
  80. package/dist/plugins/fonts.js +15 -6
  81. package/dist/plugins/fonts.js.map +1 -1
  82. package/dist/plugins/instrumentation-client.js.map +1 -1
  83. package/dist/plugins/og-assets.js.map +1 -1
  84. package/dist/plugins/optimize-imports.js.map +1 -1
  85. package/dist/plugins/postcss.js.map +1 -1
  86. package/dist/plugins/rsc-client-reference-loaders.d.ts +7 -0
  87. package/dist/plugins/rsc-client-reference-loaders.js +48 -0
  88. package/dist/plugins/rsc-client-reference-loaders.js.map +1 -0
  89. package/dist/plugins/rsc-client-shim-excludes.js.map +1 -1
  90. package/dist/plugins/sass.d.ts +34 -0
  91. package/dist/plugins/sass.js +22 -0
  92. package/dist/plugins/sass.js.map +1 -0
  93. package/dist/plugins/server-externals-manifest.js.map +1 -1
  94. package/dist/plugins/strip-server-exports.js.map +1 -1
  95. package/dist/routing/app-route-graph.d.ts +78 -6
  96. package/dist/routing/app-route-graph.js +241 -25
  97. package/dist/routing/app-route-graph.js.map +1 -1
  98. package/dist/routing/app-router.js.map +1 -1
  99. package/dist/routing/file-matcher.js.map +1 -1
  100. package/dist/routing/pages-router.js.map +1 -1
  101. package/dist/routing/route-matching.js.map +1 -1
  102. package/dist/routing/route-pattern.d.ts +56 -1
  103. package/dist/routing/route-pattern.js +60 -1
  104. package/dist/routing/route-pattern.js.map +1 -1
  105. package/dist/routing/route-trie.js.map +1 -1
  106. package/dist/routing/route-validation.js.map +1 -1
  107. package/dist/routing/utils.js.map +1 -1
  108. package/dist/server/api-handler.js.map +1 -1
  109. package/dist/server/app-browser-action-result.d.ts +44 -0
  110. package/dist/server/app-browser-action-result.js +79 -0
  111. package/dist/server/app-browser-action-result.js.map +1 -0
  112. package/dist/server/app-browser-entry.js +330 -133
  113. package/dist/server/app-browser-entry.js.map +1 -1
  114. package/dist/server/app-browser-error.js.map +1 -1
  115. package/dist/server/app-browser-hydration.d.ts +31 -0
  116. package/dist/server/app-browser-hydration.js +30 -0
  117. package/dist/server/app-browser-hydration.js.map +1 -0
  118. package/dist/server/app-browser-navigation-controller.d.ts +20 -4
  119. package/dist/server/app-browser-navigation-controller.js +90 -23
  120. package/dist/server/app-browser-navigation-controller.js.map +1 -1
  121. package/dist/server/app-browser-popstate.d.ts +16 -0
  122. package/dist/server/app-browser-popstate.js +17 -0
  123. package/dist/server/app-browser-popstate.js.map +1 -0
  124. package/dist/server/app-browser-rsc-redirect.d.ts +28 -0
  125. package/dist/server/app-browser-rsc-redirect.js +37 -0
  126. package/dist/server/app-browser-rsc-redirect.js.map +1 -0
  127. package/dist/server/app-browser-state.d.ts +27 -23
  128. package/dist/server/app-browser-state.js +158 -54
  129. package/dist/server/app-browser-state.js.map +1 -1
  130. package/dist/server/app-browser-stream.d.ts +9 -4
  131. package/dist/server/app-browser-stream.js +29 -8
  132. package/dist/server/app-browser-stream.js.map +1 -1
  133. package/dist/server/app-browser-visible-commit.d.ts +11 -1
  134. package/dist/server/app-browser-visible-commit.js +69 -21
  135. package/dist/server/app-browser-visible-commit.js.map +1 -1
  136. package/dist/server/app-client-reference-preloader.js.map +1 -1
  137. package/dist/server/app-elements-wire.d.ts +43 -6
  138. package/dist/server/app-elements-wire.js +121 -5
  139. package/dist/server/app-elements-wire.js.map +1 -1
  140. package/dist/server/app-elements.d.ts +2 -2
  141. package/dist/server/app-elements.js +2 -2
  142. package/dist/server/app-elements.js.map +1 -1
  143. package/dist/server/app-fallback-renderer.d.ts +10 -1
  144. package/dist/server/app-fallback-renderer.js +37 -1
  145. package/dist/server/app-fallback-renderer.js.map +1 -1
  146. package/dist/server/app-history-state.d.ts +26 -0
  147. package/dist/server/app-history-state.js +53 -0
  148. package/dist/server/app-history-state.js.map +1 -0
  149. package/dist/server/app-hook-warning-suppression.js.map +1 -1
  150. package/dist/server/app-middleware.d.ts +1 -1
  151. package/dist/server/app-middleware.js +4 -9
  152. package/dist/server/app-middleware.js.map +1 -1
  153. package/dist/server/app-mounted-slots-header.js.map +1 -1
  154. package/dist/server/app-page-boundary-render.d.ts +11 -1
  155. package/dist/server/app-page-boundary-render.js +27 -19
  156. package/dist/server/app-page-boundary-render.js.map +1 -1
  157. package/dist/server/app-page-boundary.d.ts +1 -0
  158. package/dist/server/app-page-boundary.js +10 -7
  159. package/dist/server/app-page-boundary.js.map +1 -1
  160. package/dist/server/app-page-cache.d.ts +23 -3
  161. package/dist/server/app-page-cache.js +63 -27
  162. package/dist/server/app-page-cache.js.map +1 -1
  163. package/dist/server/app-page-dispatch.d.ts +11 -1
  164. package/dist/server/app-page-dispatch.js +85 -14
  165. package/dist/server/app-page-dispatch.js.map +1 -1
  166. package/dist/server/app-page-element-builder.d.ts +10 -1
  167. package/dist/server/app-page-element-builder.js +38 -6
  168. package/dist/server/app-page-element-builder.js.map +1 -1
  169. package/dist/server/app-page-execution.js +2 -3
  170. package/dist/server/app-page-execution.js.map +1 -1
  171. package/dist/server/app-page-head.d.ts +7 -0
  172. package/dist/server/app-page-head.js +6 -1
  173. package/dist/server/app-page-head.js.map +1 -1
  174. package/dist/server/app-page-method.js.map +1 -1
  175. package/dist/server/app-page-params.js.map +1 -1
  176. package/dist/server/app-page-probe.d.ts +23 -1
  177. package/dist/server/app-page-probe.js +29 -1
  178. package/dist/server/app-page-probe.js.map +1 -1
  179. package/dist/server/app-page-render-observation.d.ts +35 -0
  180. package/dist/server/app-page-render-observation.js +68 -0
  181. package/dist/server/app-page-render-observation.js.map +1 -0
  182. package/dist/server/app-page-render.d.ts +12 -2
  183. package/dist/server/app-page-render.js +90 -7
  184. package/dist/server/app-page-render.js.map +1 -1
  185. package/dist/server/app-page-request.d.ts +1 -0
  186. package/dist/server/app-page-request.js +2 -1
  187. package/dist/server/app-page-request.js.map +1 -1
  188. package/dist/server/app-page-response.d.ts +2 -0
  189. package/dist/server/app-page-response.js +18 -7
  190. package/dist/server/app-page-response.js.map +1 -1
  191. package/dist/server/app-page-route-wiring.d.ts +9 -3
  192. package/dist/server/app-page-route-wiring.js +91 -62
  193. package/dist/server/app-page-route-wiring.js.map +1 -1
  194. package/dist/server/app-page-segment-state.d.ts +10 -0
  195. package/dist/server/app-page-segment-state.js +87 -0
  196. package/dist/server/app-page-segment-state.js.map +1 -0
  197. package/dist/server/app-page-stream.d.ts +9 -2
  198. package/dist/server/app-page-stream.js +4 -1
  199. package/dist/server/app-page-stream.js.map +1 -1
  200. package/dist/server/app-post-middleware-context.js.map +1 -1
  201. package/dist/server/app-prerender-endpoints.js.map +1 -1
  202. package/dist/server/app-prerender-static-params.js.map +1 -1
  203. package/dist/server/app-render-dependency.js.map +1 -1
  204. package/dist/server/app-request-context.js.map +1 -1
  205. package/dist/server/app-route-handler-cache.js.map +1 -1
  206. package/dist/server/app-route-handler-dispatch.js +3 -1
  207. package/dist/server/app-route-handler-dispatch.js.map +1 -1
  208. package/dist/server/app-route-handler-execution.js.map +1 -1
  209. package/dist/server/app-route-handler-policy.js +1 -0
  210. package/dist/server/app-route-handler-policy.js.map +1 -1
  211. package/dist/server/app-route-handler-response.js +4 -3
  212. package/dist/server/app-route-handler-response.js.map +1 -1
  213. package/dist/server/app-route-handler-runtime.js.map +1 -1
  214. package/dist/server/app-router-entry.js +7 -15
  215. package/dist/server/app-router-entry.js.map +1 -1
  216. package/dist/server/app-rsc-cache-busting.d.ts +23 -2
  217. package/dist/server/app-rsc-cache-busting.js +75 -19
  218. package/dist/server/app-rsc-cache-busting.js.map +1 -1
  219. package/dist/server/app-rsc-embedded-chunks.d.ts +9 -0
  220. package/dist/server/app-rsc-embedded-chunks.js +34 -0
  221. package/dist/server/app-rsc-embedded-chunks.js.map +1 -0
  222. package/dist/server/app-rsc-error-handler.js.map +1 -1
  223. package/dist/server/app-rsc-errors.d.ts +4 -1
  224. package/dist/server/app-rsc-errors.js +1 -1
  225. package/dist/server/app-rsc-errors.js.map +1 -1
  226. package/dist/server/app-rsc-handler.d.ts +18 -1
  227. package/dist/server/app-rsc-handler.js +55 -16
  228. package/dist/server/app-rsc-handler.js.map +1 -1
  229. package/dist/server/app-rsc-render-mode.d.ts +11 -0
  230. package/dist/server/app-rsc-render-mode.js +21 -0
  231. package/dist/server/app-rsc-render-mode.js.map +1 -0
  232. package/dist/server/app-rsc-request-normalization.d.ts +4 -1
  233. package/dist/server/app-rsc-request-normalization.js +7 -2
  234. package/dist/server/app-rsc-request-normalization.js.map +1 -1
  235. package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
  236. package/dist/server/app-rsc-response-finalizer.js +6 -1
  237. package/dist/server/app-rsc-response-finalizer.js.map +1 -1
  238. package/dist/server/app-rsc-route-matching.d.ts +23 -0
  239. package/dist/server/app-rsc-route-matching.js +45 -23
  240. package/dist/server/app-rsc-route-matching.js.map +1 -1
  241. package/dist/server/app-segment-config.js.map +1 -1
  242. package/dist/server/app-server-action-execution.d.ts +51 -5
  243. package/dist/server/app-server-action-execution.js +161 -51
  244. package/dist/server/app-server-action-execution.js.map +1 -1
  245. package/dist/server/app-ssr-entry.d.ts +7 -0
  246. package/dist/server/app-ssr-entry.js +44 -14
  247. package/dist/server/app-ssr-entry.js.map +1 -1
  248. package/dist/server/app-ssr-error-meta.d.ts +14 -0
  249. package/dist/server/app-ssr-error-meta.js +50 -0
  250. package/dist/server/app-ssr-error-meta.js.map +1 -0
  251. package/dist/server/app-ssr-stream.d.ts +1 -1
  252. package/dist/server/app-ssr-stream.js +9 -12
  253. package/dist/server/app-ssr-stream.js.map +1 -1
  254. package/dist/server/app-static-generation.js.map +1 -1
  255. package/dist/server/artifact-compatibility.d.ts +12 -2
  256. package/dist/server/artifact-compatibility.js +12 -8
  257. package/dist/server/artifact-compatibility.js.map +1 -1
  258. package/dist/server/cache-control.js +1 -0
  259. package/dist/server/cache-control.js.map +1 -1
  260. package/dist/server/cache-proof.d.ts +124 -5
  261. package/dist/server/cache-proof.js +416 -18
  262. package/dist/server/cache-proof.js.map +1 -1
  263. package/dist/server/csp.js.map +1 -1
  264. package/dist/server/dev-error-overlay-store.js.map +1 -1
  265. package/dist/server/dev-error-overlay.js +5 -0
  266. package/dist/server/dev-error-overlay.js.map +1 -1
  267. package/dist/server/dev-lockfile.d.ts +110 -0
  268. package/dist/server/dev-lockfile.js +180 -0
  269. package/dist/server/dev-lockfile.js.map +1 -0
  270. package/dist/server/dev-module-runner.js.map +1 -1
  271. package/dist/server/dev-origin-check.js.map +1 -1
  272. package/dist/server/dev-route-files.js.map +1 -1
  273. package/dist/server/dev-server.js +23 -10
  274. package/dist/server/dev-server.js.map +1 -1
  275. package/dist/server/file-based-metadata.d.ts +13 -0
  276. package/dist/server/file-based-metadata.js +49 -2
  277. package/dist/server/file-based-metadata.js.map +1 -1
  278. package/dist/server/headers.d.ts +81 -0
  279. package/dist/server/headers.js +104 -0
  280. package/dist/server/headers.js.map +1 -0
  281. package/dist/server/html.js +1 -1
  282. package/dist/server/html.js.map +1 -1
  283. package/dist/server/http-error-responses.d.ts +10 -0
  284. package/dist/server/http-error-responses.js +11 -1
  285. package/dist/server/http-error-responses.js.map +1 -1
  286. package/dist/server/image-optimization.d.ts +11 -1
  287. package/dist/server/image-optimization.js.map +1 -1
  288. package/dist/server/implicit-tags.js +2 -1
  289. package/dist/server/implicit-tags.js.map +1 -1
  290. package/dist/server/instrumentation-runtime.js.map +1 -1
  291. package/dist/server/instrumentation.js.map +1 -1
  292. package/dist/server/isr-cache.d.ts +12 -2
  293. package/dist/server/isr-cache.js +16 -5
  294. package/dist/server/isr-cache.js.map +1 -1
  295. package/dist/server/metadata-route-build-data.js.map +1 -1
  296. package/dist/server/metadata-route-response.js +22 -5
  297. package/dist/server/metadata-route-response.js.map +1 -1
  298. package/dist/server/metadata-routes.js +27 -8
  299. package/dist/server/metadata-routes.js.map +1 -1
  300. package/dist/server/middleware-matcher.js.map +1 -1
  301. package/dist/server/middleware-request-headers.d.ts +4 -1
  302. package/dist/server/middleware-request-headers.js +15 -8
  303. package/dist/server/middleware-request-headers.js.map +1 -1
  304. package/dist/server/middleware-response-headers.d.ts +2 -1
  305. package/dist/server/middleware-response-headers.js +1 -1
  306. package/dist/server/middleware-response-headers.js.map +1 -1
  307. package/dist/server/middleware-runtime.d.ts +1 -0
  308. package/dist/server/middleware-runtime.js +7 -3
  309. package/dist/server/middleware-runtime.js.map +1 -1
  310. package/dist/server/middleware.d.ts +12 -0
  311. package/dist/server/middleware.js +12 -0
  312. package/dist/server/middleware.js.map +1 -1
  313. package/dist/server/navigation-planner.d.ts +133 -0
  314. package/dist/server/navigation-planner.js +432 -0
  315. package/dist/server/navigation-planner.js.map +1 -0
  316. package/dist/server/navigation-trace.d.ts +19 -2
  317. package/dist/server/navigation-trace.js +20 -1
  318. package/dist/server/navigation-trace.js.map +1 -1
  319. package/dist/server/next-error-digest.d.ts +3 -2
  320. package/dist/server/next-error-digest.js +4 -2
  321. package/dist/server/next-error-digest.js.map +1 -1
  322. package/dist/server/normalize-path.d.ts +2 -1
  323. package/dist/server/normalize-path.js +4 -1
  324. package/dist/server/normalize-path.js.map +1 -1
  325. package/dist/server/pages-api-route.js +1 -0
  326. package/dist/server/pages-api-route.js.map +1 -1
  327. package/dist/server/pages-i18n.js.map +1 -1
  328. package/dist/server/pages-media-type.js.map +1 -1
  329. package/dist/server/pages-node-compat.js.map +1 -1
  330. package/dist/server/pages-page-data.d.ts +3 -2
  331. package/dist/server/pages-page-data.js +27 -5
  332. package/dist/server/pages-page-data.js.map +1 -1
  333. package/dist/server/pages-page-response.js +2 -1
  334. package/dist/server/pages-page-response.js.map +1 -1
  335. package/dist/server/prerender-work-unit-setup.js +1 -1
  336. package/dist/server/prerender-work-unit-setup.js.map +1 -1
  337. package/dist/server/prod-server.d.ts +28 -1
  338. package/dist/server/prod-server.js +97 -22
  339. package/dist/server/prod-server.js.map +1 -1
  340. package/dist/server/request-log.js.map +1 -1
  341. package/dist/server/request-pipeline.d.ts +1 -13
  342. package/dist/server/request-pipeline.js +3 -25
  343. package/dist/server/request-pipeline.js.map +1 -1
  344. package/dist/server/rsc-stream-hints.js.map +1 -1
  345. package/dist/server/seed-cache.js.map +1 -1
  346. package/dist/server/server-action-not-found.d.ts +16 -3
  347. package/dist/server/server-action-not-found.js +22 -4
  348. package/dist/server/server-action-not-found.js.map +1 -1
  349. package/dist/server/server-globals.d.ts +5 -0
  350. package/dist/server/server-globals.js +37 -0
  351. package/dist/server/server-globals.js.map +1 -0
  352. package/dist/server/socket-error-backstop.js.map +1 -1
  353. package/dist/server/static-file-cache.js +1 -1
  354. package/dist/server/static-file-cache.js.map +1 -1
  355. package/dist/server/worker-utils.d.ts +0 -7
  356. package/dist/server/worker-utils.js +3 -2
  357. package/dist/server/worker-utils.js.map +1 -1
  358. package/dist/shims/amp.js.map +1 -1
  359. package/dist/shims/app.d.ts +37 -4
  360. package/dist/shims/app.js +50 -1
  361. package/dist/shims/app.js.map +1 -0
  362. package/dist/shims/cache-for-request.js.map +1 -1
  363. package/dist/shims/cache-runtime.d.ts +19 -2
  364. package/dist/shims/cache-runtime.js +87 -19
  365. package/dist/shims/cache-runtime.js.map +1 -1
  366. package/dist/shims/cache.d.ts +20 -21
  367. package/dist/shims/cache.js +101 -15
  368. package/dist/shims/cache.js.map +1 -1
  369. package/dist/shims/client-hook-error.js.map +1 -1
  370. package/dist/shims/compat-router.js.map +1 -1
  371. package/dist/shims/config.js.map +1 -1
  372. package/dist/shims/constants.js.map +1 -1
  373. package/dist/shims/document.js.map +1 -1
  374. package/dist/shims/dynamic.d.ts +18 -10
  375. package/dist/shims/dynamic.js +107 -51
  376. package/dist/shims/dynamic.js.map +1 -1
  377. package/dist/shims/error-boundary.d.ts +35 -6
  378. package/dist/shims/error-boundary.js +116 -33
  379. package/dist/shims/error-boundary.js.map +1 -1
  380. package/dist/shims/error.d.ts +18 -1
  381. package/dist/shims/error.js +56 -1
  382. package/dist/shims/error.js.map +1 -1
  383. package/dist/shims/fetch-cache.d.ts +25 -1
  384. package/dist/shims/fetch-cache.js +159 -13
  385. package/dist/shims/fetch-cache.js.map +1 -1
  386. package/dist/shims/font-google-base.d.ts +22 -8
  387. package/dist/shims/font-google-base.js +41 -71
  388. package/dist/shims/font-google-base.js.map +1 -1
  389. package/dist/shims/font-local.d.ts +3 -20
  390. package/dist/shims/font-local.js +23 -75
  391. package/dist/shims/font-local.js.map +1 -1
  392. package/dist/shims/font-utils.d.ts +51 -0
  393. package/dist/shims/font-utils.js +97 -0
  394. package/dist/shims/font-utils.js.map +1 -0
  395. package/dist/shims/form.js +3 -1
  396. package/dist/shims/form.js.map +1 -1
  397. package/dist/shims/hash-scroll.d.ts +7 -0
  398. package/dist/shims/hash-scroll.js +30 -0
  399. package/dist/shims/hash-scroll.js.map +1 -0
  400. package/dist/shims/head-state.js.map +1 -1
  401. package/dist/shims/head.d.ts +3 -1
  402. package/dist/shims/head.js +28 -16
  403. package/dist/shims/head.js.map +1 -1
  404. package/dist/shims/headers.d.ts +11 -12
  405. package/dist/shims/headers.js +45 -8
  406. package/dist/shims/headers.js.map +1 -1
  407. package/dist/shims/i18n-context.js.map +1 -1
  408. package/dist/shims/i18n-state.js.map +1 -1
  409. package/dist/shims/image-config.d.ts +14 -1
  410. package/dist/shims/image-config.js +24 -1
  411. package/dist/shims/image-config.js.map +1 -1
  412. package/dist/shims/image.d.ts +1 -0
  413. package/dist/shims/image.js +159 -80
  414. package/dist/shims/image.js.map +1 -1
  415. package/dist/shims/internal/als-registry.js.map +1 -1
  416. package/dist/shims/internal/app-router-context.d.ts +7 -6
  417. package/dist/shims/internal/app-router-context.js +17 -6
  418. package/dist/shims/internal/app-router-context.js.map +1 -1
  419. package/dist/shims/internal/cookie-serialize.js.map +1 -1
  420. package/dist/shims/internal/make-hanging-promise.d.ts +1 -1
  421. package/dist/shims/internal/make-hanging-promise.js +1 -1
  422. package/dist/shims/internal/make-hanging-promise.js.map +1 -1
  423. package/dist/shims/internal/parse-cookie-header.js.map +1 -1
  424. package/dist/shims/internal/utils.js.map +1 -1
  425. package/dist/shims/internal/work-unit-async-storage.js +2 -2
  426. package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
  427. package/dist/shims/layout-segment-context.js.map +1 -1
  428. package/dist/shims/legacy-image.js.map +1 -1
  429. package/dist/shims/link-prefetch.d.ts +42 -0
  430. package/dist/shims/link-prefetch.js +45 -0
  431. package/dist/shims/link-prefetch.js.map +1 -0
  432. package/dist/shims/link.d.ts +37 -4
  433. package/dist/shims/link.js +156 -46
  434. package/dist/shims/link.js.map +1 -1
  435. package/dist/shims/metadata.d.ts +16 -30
  436. package/dist/shims/metadata.js +87 -28
  437. package/dist/shims/metadata.js.map +1 -1
  438. package/dist/shims/navigation-state.js.map +1 -1
  439. package/dist/shims/navigation.d.ts +172 -10
  440. package/dist/shims/navigation.js +335 -70
  441. package/dist/shims/navigation.js.map +1 -1
  442. package/dist/shims/navigation.react-server.d.ts +3 -2
  443. package/dist/shims/navigation.react-server.js +5 -2
  444. package/dist/shims/navigation.react-server.js.map +1 -1
  445. package/dist/shims/offline.js.map +1 -1
  446. package/dist/shims/pages-router-runtime.d.ts +7 -0
  447. package/dist/shims/pages-router-runtime.js +16 -0
  448. package/dist/shims/pages-router-runtime.js.map +1 -0
  449. package/dist/shims/readonly-url-search-params.js.map +1 -1
  450. package/dist/shims/request-context.js.map +1 -1
  451. package/dist/shims/root-params.js.map +1 -1
  452. package/dist/shims/router-state.js.map +1 -1
  453. package/dist/shims/router.d.ts +69 -7
  454. package/dist/shims/router.js +232 -249
  455. package/dist/shims/router.js.map +1 -1
  456. package/dist/shims/script-nonce-context.js.map +1 -1
  457. package/dist/shims/script.js +110 -32
  458. package/dist/shims/script.js.map +1 -1
  459. package/dist/shims/server.js +12 -15
  460. package/dist/shims/server.js.map +1 -1
  461. package/dist/shims/slot.d.ts +7 -1
  462. package/dist/shims/slot.js +60 -7
  463. package/dist/shims/slot.js.map +1 -1
  464. package/dist/shims/thenable-params.js.map +1 -1
  465. package/dist/shims/unified-request-context.js +5 -0
  466. package/dist/shims/unified-request-context.js.map +1 -1
  467. package/dist/shims/unrecognized-action-error.d.ts +35 -0
  468. package/dist/shims/unrecognized-action-error.js +41 -0
  469. package/dist/shims/unrecognized-action-error.js.map +1 -0
  470. package/dist/shims/url-safety.js.map +1 -1
  471. package/dist/shims/url-utils.d.ts +22 -1
  472. package/dist/shims/url-utils.js +76 -3
  473. package/dist/shims/url-utils.js.map +1 -1
  474. package/dist/shims/use-merged-ref.js.map +1 -1
  475. package/dist/shims/web-vitals.d.ts +4 -21
  476. package/dist/shims/web-vitals.js +19 -6
  477. package/dist/shims/web-vitals.js.map +1 -1
  478. package/dist/utils/asset-prefix.d.ts +69 -0
  479. package/dist/utils/asset-prefix.js +91 -0
  480. package/dist/utils/asset-prefix.js.map +1 -0
  481. package/dist/utils/base-path.d.ts +7 -1
  482. package/dist/utils/base-path.js +10 -1
  483. package/dist/utils/base-path.js.map +1 -1
  484. package/dist/utils/cache-control-metadata.js.map +1 -1
  485. package/dist/utils/domain-locale.js.map +1 -1
  486. package/dist/utils/encode-cache-tag.d.ts +31 -0
  487. package/dist/utils/encode-cache-tag.js +38 -0
  488. package/dist/utils/encode-cache-tag.js.map +1 -0
  489. package/dist/utils/error-cause.js.map +1 -1
  490. package/dist/utils/hash.js.map +1 -1
  491. package/dist/utils/lazy-chunks.js.map +1 -1
  492. package/dist/utils/manifest-paths.js.map +1 -1
  493. package/dist/utils/mdx-scan.js.map +1 -1
  494. package/dist/utils/navigation-signal.d.ts +5 -0
  495. package/dist/utils/navigation-signal.js +14 -0
  496. package/dist/utils/navigation-signal.js.map +1 -0
  497. package/dist/utils/project.js.map +1 -1
  498. package/dist/utils/public-routes.js.map +1 -1
  499. package/dist/utils/query.js.map +1 -1
  500. package/dist/utils/safe-json-file.js.map +1 -1
  501. package/dist/utils/sorted-array.d.ts +9 -0
  502. package/dist/utils/sorted-array.js +22 -0
  503. package/dist/utils/sorted-array.js.map +1 -0
  504. package/dist/utils/text-stream.js.map +1 -1
  505. package/dist/utils/vinext-root.js.map +1 -1
  506. package/package.json +8 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback-metrics-data.js","names":[],"sources":["../../../src/build/google-fonts/fallback-metrics-data.json"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,13 @@
1
+ //#region src/build/google-fonts/fallback-metrics.d.ts
2
+ type AdjustFontFallback = {
3
+ fallbackFont: string;
4
+ ascentOverride: string;
5
+ descentOverride: string;
6
+ lineGapOverride: string;
7
+ sizeAdjust: string;
8
+ };
9
+ declare function getFallbackFontOverrideMetrics(fontFamily: string): AdjustFontFallback | undefined;
10
+ declare function buildFallbackFontFace(family: string, metrics: AdjustFontFallback): string;
11
+ //#endregion
12
+ export { buildFallbackFontFace, getFallbackFontOverrideMetrics };
13
+ //# sourceMappingURL=fallback-metrics.d.ts.map
@@ -0,0 +1,46 @@
1
+ import { escapeCSSString } from "../../shims/font-utils.js";
2
+ import fallback_metrics_data_default from "./fallback-metrics-data.js";
3
+ //#region src/build/google-fonts/fallback-metrics.ts
4
+ const EXPECTED_METRIC_LENGTH = 6;
5
+ const fallbackMetrics = fallback_metrics_data_default;
6
+ function formatName(value) {
7
+ return value.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) => index === 0 ? word.toLowerCase() : word.toUpperCase()).replace(/\s+/g, "");
8
+ }
9
+ function formatOverrideValue(value) {
10
+ return Math.abs(value * 100).toFixed(2);
11
+ }
12
+ function getFallbackFontOverrideMetrics(fontFamily) {
13
+ const metric = fallbackMetrics[formatName(fontFamily)];
14
+ if (!metric || metric.length !== EXPECTED_METRIC_LENGTH) return void 0;
15
+ const [serifFlag, ascent, descent, lineGap, unitsPerEm, xWidthAvg] = metric;
16
+ if (unitsPerEm === 0) return void 0;
17
+ const fallbackFont = serifFlag === 1 ? "Times New Roman" : "Arial";
18
+ const fallbackMetric = fallbackMetrics[formatName(fallbackFont)];
19
+ if (!fallbackMetric || fallbackMetric.length !== EXPECTED_METRIC_LENGTH) return void 0;
20
+ const [, , , , fallbackUnitsPerEm, fallbackXWidthAvg] = fallbackMetric;
21
+ if (fallbackUnitsPerEm === 0) return void 0;
22
+ const mainFontAvgWidth = xWidthAvg / unitsPerEm;
23
+ const fallbackFontAvgWidth = fallbackXWidthAvg / fallbackUnitsPerEm;
24
+ const sizeAdjust = xWidthAvg && fallbackFontAvgWidth ? mainFontAvgWidth / fallbackFontAvgWidth : 1;
25
+ return {
26
+ fallbackFont,
27
+ ascentOverride: `${formatOverrideValue(ascent / (unitsPerEm * sizeAdjust))}%`,
28
+ descentOverride: `${formatOverrideValue(descent / (unitsPerEm * sizeAdjust))}%`,
29
+ lineGapOverride: `${formatOverrideValue(lineGap / (unitsPerEm * sizeAdjust))}%`,
30
+ sizeAdjust: `${formatOverrideValue(sizeAdjust)}%`
31
+ };
32
+ }
33
+ function buildFallbackFontFace(family, metrics) {
34
+ return `@font-face {
35
+ font-family: ${`'${escapeCSSString(family)} Fallback'`};
36
+ src: local("${escapeCSSString(metrics.fallbackFont)}");
37
+ ascent-override: ${metrics.ascentOverride};
38
+ descent-override: ${metrics.descentOverride};
39
+ line-gap-override: ${metrics.lineGapOverride};
40
+ size-adjust: ${metrics.sizeAdjust};
41
+ }\n`;
42
+ }
43
+ //#endregion
44
+ export { buildFallbackFontFace, getFallbackFontOverrideMetrics };
45
+
46
+ //# sourceMappingURL=fallback-metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback-metrics.js","names":["rawFallbackMetrics"],"sources":["../../../src/build/google-fonts/fallback-metrics.ts"],"sourcesContent":["// Compact fallback metrics derived from Next.js\n// `next/dist/server/capsize-font-metrics.json`.\n//\n// The tuple shape is:\n// [serifFlag, ascent, descent, lineGap, unitsPerEm, xWidthAvg]\n\nimport { escapeCSSString } from \"vinext/shims/font-utils\";\nimport rawFallbackMetrics from \"./fallback-metrics-data.json\" with { type: \"json\" };\n\ntype AdjustFontFallback = {\n fallbackFont: string;\n ascentOverride: string;\n descentOverride: string;\n lineGapOverride: string;\n sizeAdjust: string;\n};\n\nconst EXPECTED_METRIC_LENGTH = 6;\nconst fallbackMetrics: Record<string, number[]> = rawFallbackMetrics;\n\nfunction formatName(value: string): string {\n return value\n .replace(/(?:^\\w|[A-Z]|\\b\\w)/g, (word, index) =>\n index === 0 ? word.toLowerCase() : word.toUpperCase(),\n )\n .replace(/\\s+/g, \"\");\n}\n\nfunction formatOverrideValue(value: number): string {\n return Math.abs(value * 100).toFixed(2);\n}\n\nexport function getFallbackFontOverrideMetrics(fontFamily: string): AdjustFontFallback | undefined {\n const metric = fallbackMetrics[formatName(fontFamily)];\n if (!metric || metric.length !== EXPECTED_METRIC_LENGTH) return undefined;\n\n const [serifFlag, ascent, descent, lineGap, unitsPerEm, xWidthAvg] = metric;\n if (unitsPerEm === 0) return undefined;\n\n const fallbackFont = serifFlag === 1 ? \"Times New Roman\" : \"Arial\";\n const fallbackMetric = fallbackMetrics[formatName(fallbackFont)];\n if (!fallbackMetric || fallbackMetric.length !== EXPECTED_METRIC_LENGTH) return undefined;\n\n const [, , , , fallbackUnitsPerEm, fallbackXWidthAvg] = fallbackMetric;\n if (fallbackUnitsPerEm === 0) return undefined;\n\n const mainFontAvgWidth = xWidthAvg / unitsPerEm;\n const fallbackFontAvgWidth = fallbackXWidthAvg / fallbackUnitsPerEm;\n const sizeAdjust =\n xWidthAvg && fallbackFontAvgWidth ? mainFontAvgWidth / fallbackFontAvgWidth : 1;\n\n return {\n fallbackFont,\n ascentOverride: `${formatOverrideValue(ascent / (unitsPerEm * sizeAdjust))}%`,\n descentOverride: `${formatOverrideValue(descent / (unitsPerEm * sizeAdjust))}%`,\n lineGapOverride: `${formatOverrideValue(lineGap / (unitsPerEm * sizeAdjust))}%`,\n sizeAdjust: `${formatOverrideValue(sizeAdjust)}%`,\n };\n}\n\n// The fallback family name pattern '{family} Fallback' must match the name\n// constructed in createFontLoader() in shims/font-google-base.ts. Keep both\n// sites in sync to prevent silent fallback mismatches.\nexport function buildFallbackFontFace(family: string, metrics: AdjustFontFallback): string {\n const fallbackFamily = `'${escapeCSSString(family)} Fallback'`;\n return `@font-face {\n font-family: ${fallbackFamily};\n src: local(\"${escapeCSSString(metrics.fallbackFont)}\");\n ascent-override: ${metrics.ascentOverride};\n descent-override: ${metrics.descentOverride};\n line-gap-override: ${metrics.lineGapOverride};\n size-adjust: ${metrics.sizeAdjust};\n}\\n`;\n}\n"],"mappings":";;;AAiBA,MAAM,yBAAyB;AAC/B,MAAM,kBAA4CA;AAElD,SAAS,WAAW,OAAuB;CACzC,OAAO,MACJ,QAAQ,wBAAwB,MAAM,UACrC,UAAU,IAAI,KAAK,aAAa,GAAG,KAAK,aAAa,CACtD,CACA,QAAQ,QAAQ,GAAG;;AAGxB,SAAS,oBAAoB,OAAuB;CAClD,OAAO,KAAK,IAAI,QAAQ,IAAI,CAAC,QAAQ,EAAE;;AAGzC,SAAgB,+BAA+B,YAAoD;CACjG,MAAM,SAAS,gBAAgB,WAAW,WAAW;CACrD,IAAI,CAAC,UAAU,OAAO,WAAW,wBAAwB,OAAO,KAAA;CAEhE,MAAM,CAAC,WAAW,QAAQ,SAAS,SAAS,YAAY,aAAa;CACrE,IAAI,eAAe,GAAG,OAAO,KAAA;CAE7B,MAAM,eAAe,cAAc,IAAI,oBAAoB;CAC3D,MAAM,iBAAiB,gBAAgB,WAAW,aAAa;CAC/D,IAAI,CAAC,kBAAkB,eAAe,WAAW,wBAAwB,OAAO,KAAA;CAEhF,MAAM,SAAS,oBAAoB,qBAAqB;CACxD,IAAI,uBAAuB,GAAG,OAAO,KAAA;CAErC,MAAM,mBAAmB,YAAY;CACrC,MAAM,uBAAuB,oBAAoB;CACjD,MAAM,aACJ,aAAa,uBAAuB,mBAAmB,uBAAuB;CAEhF,OAAO;EACL;EACA,gBAAgB,GAAG,oBAAoB,UAAU,aAAa,YAAY,CAAC;EAC3E,iBAAiB,GAAG,oBAAoB,WAAW,aAAa,YAAY,CAAC;EAC7E,iBAAiB,GAAG,oBAAoB,WAAW,aAAa,YAAY,CAAC;EAC7E,YAAY,GAAG,oBAAoB,WAAW,CAAC;EAChD;;AAMH,SAAgB,sBAAsB,QAAgB,SAAqC;CAEzF,OAAO;iBACQ,IAFY,gBAAgB,OAAO,CAAC,YAErB;gBAChB,gBAAgB,QAAQ,aAAa,CAAC;qBACjC,QAAQ,eAAe;sBACtB,QAAQ,gBAAgB;uBACvB,QAAQ,gBAAgB;iBAC9B,QAAQ,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-axes.js","names":[],"sources":["../../../src/build/google-fonts/get-axes.ts"],"sourcesContent":["// Ported from Next.js: packages/font/src/google/get-font-axes.ts\n// https://github.com/vercel/next.js/blob/canary/packages/font/src/google/get-font-axes.ts\n//\n// Resolves the axis values that belong in a Google Fonts URL given the\n// caller's requested weights, styles, and (optional) selected variable axes.\n// For variable fonts this is the only place that turns the literal sentinel\n// `\"variable\"` into the actual `min..max` range from the bundled metadata.\n\nimport { googleFontsMetadata } from \"./font-metadata.js\";\nimport type { FontAxes } from \"./build-url.js\";\n\nconst formatAvailableValues = (values: string[]): string =>\n values.map((val) => `\\`${val}\\``).join(\", \");\n\nexport function getFontAxes(\n fontFamily: string,\n weights: string[],\n styles: string[],\n selectedVariableAxes?: string[],\n): FontAxes {\n const hasItalic = styles.includes(\"italic\");\n const hasNormal = styles.includes(\"normal\");\n // Google treats omitted ital as ital=0, so italic-only requests do not need\n // to enumerate ital=0; just ['1'] suffices.\n const ital = hasItalic ? [...(hasNormal ? [\"0\"] : []), \"1\"] : undefined;\n\n // Variable-font sentinel: a single \"variable\" entry means the caller wants\n // the full axis range from metadata, not a list of explicit weights.\n if (weights[0] === \"variable\") {\n const allAxes = googleFontsMetadata[fontFamily].axes;\n if (!allAxes) {\n // Reaching this branch means validate accepted a \"variable\" weight for\n // a non-variable font, which should be impossible because the\n // metadata-based validator rejects this earlier. Treat as an internal\n // invariant.\n throw new Error(\"invariant variable font without axes\");\n }\n\n if (selectedVariableAxes) {\n const definableAxes = allAxes.map(({ tag }) => tag).filter((tag) => tag !== \"wght\");\n if (definableAxes.length === 0) {\n throw new Error(`Font \\`${fontFamily}\\` has no definable \\`axes\\``);\n }\n if (!Array.isArray(selectedVariableAxes)) {\n throw new Error(\n `Invalid axes value for font \\`${fontFamily}\\`, expected an array of axes.\\nAvailable axes: ${formatAvailableValues(definableAxes)}`,\n );\n }\n for (const key of selectedVariableAxes) {\n if (!definableAxes.includes(key)) {\n throw new Error(\n `Invalid axes value \\`${key}\\` for font \\`${fontFamily}\\`.\\nAvailable axes: ${formatAvailableValues(definableAxes)}`,\n );\n }\n }\n }\n\n let weightAxis: string | undefined;\n let variableAxes: [string, string][] | undefined;\n for (const { tag, min, max } of allAxes) {\n if (tag === \"wght\") {\n weightAxis = `${min}..${max}`;\n } else if (selectedVariableAxes?.includes(tag)) {\n if (!variableAxes) variableAxes = [];\n variableAxes.push([tag, `${min}..${max}`]);\n }\n }\n\n return {\n wght: weightAxis ? [weightAxis] : undefined,\n ital,\n variableAxes,\n };\n }\n\n // Non-variable path: weights are explicit face values that the URL builder\n // emits verbatim.\n return {\n wght: weights,\n ital,\n variableAxes: undefined,\n };\n}\n"],"mappings":";;AAWA,MAAM,yBAAyB,WAC7B,OAAO,KAAK,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK;AAE9C,SAAgB,YACd,YACA,SACA,QACA,sBACU;CACV,MAAM,YAAY,OAAO,SAAS,SAAS;CAC3C,MAAM,YAAY,OAAO,SAAS,SAAS;CAG3C,MAAM,OAAO,YAAY,CAAC,GAAI,YAAY,CAAC,IAAI,GAAG,EAAE,EAAG,IAAI,GAAG,KAAA;AAI9D,KAAI,QAAQ,OAAO,YAAY;EAC7B,MAAM,UAAU,oBAAoB,YAAY;AAChD,MAAI,CAAC,QAKH,OAAM,IAAI,MAAM,uCAAuC;AAGzD,MAAI,sBAAsB;GACxB,MAAM,gBAAgB,QAAQ,KAAK,EAAE,UAAU,IAAI,CAAC,QAAQ,QAAQ,QAAQ,OAAO;AACnF,OAAI,cAAc,WAAW,EAC3B,OAAM,IAAI,MAAM,UAAU,WAAW,8BAA8B;AAErE,OAAI,CAAC,MAAM,QAAQ,qBAAqB,CACtC,OAAM,IAAI,MACR,iCAAiC,WAAW,kDAAkD,sBAAsB,cAAc,GACnI;AAEH,QAAK,MAAM,OAAO,qBAChB,KAAI,CAAC,cAAc,SAAS,IAAI,CAC9B,OAAM,IAAI,MACR,wBAAwB,IAAI,gBAAgB,WAAW,uBAAuB,sBAAsB,cAAc,GACnH;;EAKP,IAAI;EACJ,IAAI;AACJ,OAAK,MAAM,EAAE,KAAK,KAAK,SAAS,QAC9B,KAAI,QAAQ,OACV,cAAa,GAAG,IAAI,IAAI;WACf,sBAAsB,SAAS,IAAI,EAAE;AAC9C,OAAI,CAAC,aAAc,gBAAe,EAAE;AACpC,gBAAa,KAAK,CAAC,KAAK,GAAG,IAAI,IAAI,MAAM,CAAC;;AAI9C,SAAO;GACL,MAAM,aAAa,CAAC,WAAW,GAAG,KAAA;GAClC;GACA;GACD;;AAKH,QAAO;EACL,MAAM;EACN;EACA,cAAc,KAAA;EACf"}
1
+ {"version":3,"file":"get-axes.js","names":[],"sources":["../../../src/build/google-fonts/get-axes.ts"],"sourcesContent":["// Ported from Next.js: packages/font/src/google/get-font-axes.ts\n// https://github.com/vercel/next.js/blob/canary/packages/font/src/google/get-font-axes.ts\n//\n// Resolves the axis values that belong in a Google Fonts URL given the\n// caller's requested weights, styles, and (optional) selected variable axes.\n// For variable fonts this is the only place that turns the literal sentinel\n// `\"variable\"` into the actual `min..max` range from the bundled metadata.\n\nimport { googleFontsMetadata } from \"./font-metadata.js\";\nimport type { FontAxes } from \"./build-url.js\";\n\nconst formatAvailableValues = (values: string[]): string =>\n values.map((val) => `\\`${val}\\``).join(\", \");\n\nexport function getFontAxes(\n fontFamily: string,\n weights: string[],\n styles: string[],\n selectedVariableAxes?: string[],\n): FontAxes {\n const hasItalic = styles.includes(\"italic\");\n const hasNormal = styles.includes(\"normal\");\n // Google treats omitted ital as ital=0, so italic-only requests do not need\n // to enumerate ital=0; just ['1'] suffices.\n const ital = hasItalic ? [...(hasNormal ? [\"0\"] : []), \"1\"] : undefined;\n\n // Variable-font sentinel: a single \"variable\" entry means the caller wants\n // the full axis range from metadata, not a list of explicit weights.\n if (weights[0] === \"variable\") {\n const allAxes = googleFontsMetadata[fontFamily].axes;\n if (!allAxes) {\n // Reaching this branch means validate accepted a \"variable\" weight for\n // a non-variable font, which should be impossible because the\n // metadata-based validator rejects this earlier. Treat as an internal\n // invariant.\n throw new Error(\"invariant variable font without axes\");\n }\n\n if (selectedVariableAxes) {\n const definableAxes = allAxes.map(({ tag }) => tag).filter((tag) => tag !== \"wght\");\n if (definableAxes.length === 0) {\n throw new Error(`Font \\`${fontFamily}\\` has no definable \\`axes\\``);\n }\n if (!Array.isArray(selectedVariableAxes)) {\n throw new Error(\n `Invalid axes value for font \\`${fontFamily}\\`, expected an array of axes.\\nAvailable axes: ${formatAvailableValues(definableAxes)}`,\n );\n }\n for (const key of selectedVariableAxes) {\n if (!definableAxes.includes(key)) {\n throw new Error(\n `Invalid axes value \\`${key}\\` for font \\`${fontFamily}\\`.\\nAvailable axes: ${formatAvailableValues(definableAxes)}`,\n );\n }\n }\n }\n\n let weightAxis: string | undefined;\n let variableAxes: [string, string][] | undefined;\n for (const { tag, min, max } of allAxes) {\n if (tag === \"wght\") {\n weightAxis = `${min}..${max}`;\n } else if (selectedVariableAxes?.includes(tag)) {\n if (!variableAxes) variableAxes = [];\n variableAxes.push([tag, `${min}..${max}`]);\n }\n }\n\n return {\n wght: weightAxis ? [weightAxis] : undefined,\n ital,\n variableAxes,\n };\n }\n\n // Non-variable path: weights are explicit face values that the URL builder\n // emits verbatim.\n return {\n wght: weights,\n ital,\n variableAxes: undefined,\n };\n}\n"],"mappings":";;AAWA,MAAM,yBAAyB,WAC7B,OAAO,KAAK,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK;AAE9C,SAAgB,YACd,YACA,SACA,QACA,sBACU;CACV,MAAM,YAAY,OAAO,SAAS,SAAS;CAC3C,MAAM,YAAY,OAAO,SAAS,SAAS;CAG3C,MAAM,OAAO,YAAY,CAAC,GAAI,YAAY,CAAC,IAAI,GAAG,EAAE,EAAG,IAAI,GAAG,KAAA;CAI9D,IAAI,QAAQ,OAAO,YAAY;EAC7B,MAAM,UAAU,oBAAoB,YAAY;EAChD,IAAI,CAAC,SAKH,MAAM,IAAI,MAAM,uCAAuC;EAGzD,IAAI,sBAAsB;GACxB,MAAM,gBAAgB,QAAQ,KAAK,EAAE,UAAU,IAAI,CAAC,QAAQ,QAAQ,QAAQ,OAAO;GACnF,IAAI,cAAc,WAAW,GAC3B,MAAM,IAAI,MAAM,UAAU,WAAW,8BAA8B;GAErE,IAAI,CAAC,MAAM,QAAQ,qBAAqB,EACtC,MAAM,IAAI,MACR,iCAAiC,WAAW,kDAAkD,sBAAsB,cAAc,GACnI;GAEH,KAAK,MAAM,OAAO,sBAChB,IAAI,CAAC,cAAc,SAAS,IAAI,EAC9B,MAAM,IAAI,MACR,wBAAwB,IAAI,gBAAgB,WAAW,uBAAuB,sBAAsB,cAAc,GACnH;;EAKP,IAAI;EACJ,IAAI;EACJ,KAAK,MAAM,EAAE,KAAK,KAAK,SAAS,SAC9B,IAAI,QAAQ,QACV,aAAa,GAAG,IAAI,IAAI;OACnB,IAAI,sBAAsB,SAAS,IAAI,EAAE;GAC9C,IAAI,CAAC,cAAc,eAAe,EAAE;GACpC,aAAa,KAAK,CAAC,KAAK,GAAG,IAAI,IAAI,MAAM,CAAC;;EAI9C,OAAO;GACL,MAAM,aAAa,CAAC,WAAW,GAAG,KAAA;GAClC;GACA;GACD;;CAKH,OAAO;EACL,MAAM;EACN;EACA,cAAc,KAAA;EACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"sort-variants.js","names":[],"sources":["../../../src/build/google-fonts/sort-variants.ts"],"sourcesContent":["// Ported from Next.js: packages/font/src/google/sort-fonts-variant-values.ts\n// https://github.com/vercel/next.js/blob/canary/packages/font/src/google/sort-fonts-variant-values.ts\n//\n// Comparator used by `Array.prototype.sort` when assembling the variant\n// segment of a Google Fonts URL. Google's CSS API requires variant values to\n// be ordered numerically, not lexically. The string ordering of\n// `[\"100\",\"1000\",\"300\"]` would put 1000 before 300, and `[\"1,100\",\"0,200\"]`\n// would put the higher ital prefix first; both produce HTTP 400.\n\nexport function sortFontsVariantValues(valA: string, valB: string): number {\n // \"ital,wght\" pair format: compare ital first, then wght when ital matches.\n if (valA.includes(\",\") && valB.includes(\",\")) {\n const [aPrefix, aSuffix] = valA.split(\",\", 2);\n const [bPrefix, bSuffix] = valB.split(\",\", 2);\n\n if (aPrefix === bPrefix) {\n return parseInt(aSuffix) - parseInt(bSuffix);\n }\n return parseInt(aPrefix) - parseInt(bPrefix);\n }\n\n // Plain weight string: numeric compare.\n return parseInt(valA) - parseInt(valB);\n}\n"],"mappings":";AASA,SAAgB,uBAAuB,MAAc,MAAsB;AAEzE,KAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,EAAE;EAC5C,MAAM,CAAC,SAAS,WAAW,KAAK,MAAM,KAAK,EAAE;EAC7C,MAAM,CAAC,SAAS,WAAW,KAAK,MAAM,KAAK,EAAE;AAE7C,MAAI,YAAY,QACd,QAAO,SAAS,QAAQ,GAAG,SAAS,QAAQ;AAE9C,SAAO,SAAS,QAAQ,GAAG,SAAS,QAAQ;;AAI9C,QAAO,SAAS,KAAK,GAAG,SAAS,KAAK"}
1
+ {"version":3,"file":"sort-variants.js","names":[],"sources":["../../../src/build/google-fonts/sort-variants.ts"],"sourcesContent":["// Ported from Next.js: packages/font/src/google/sort-fonts-variant-values.ts\n// https://github.com/vercel/next.js/blob/canary/packages/font/src/google/sort-fonts-variant-values.ts\n//\n// Comparator used by `Array.prototype.sort` when assembling the variant\n// segment of a Google Fonts URL. Google's CSS API requires variant values to\n// be ordered numerically, not lexically. The string ordering of\n// `[\"100\",\"1000\",\"300\"]` would put 1000 before 300, and `[\"1,100\",\"0,200\"]`\n// would put the higher ital prefix first; both produce HTTP 400.\n\nexport function sortFontsVariantValues(valA: string, valB: string): number {\n // \"ital,wght\" pair format: compare ital first, then wght when ital matches.\n if (valA.includes(\",\") && valB.includes(\",\")) {\n const [aPrefix, aSuffix] = valA.split(\",\", 2);\n const [bPrefix, bSuffix] = valB.split(\",\", 2);\n\n if (aPrefix === bPrefix) {\n return parseInt(aSuffix) - parseInt(bSuffix);\n }\n return parseInt(aPrefix) - parseInt(bPrefix);\n }\n\n // Plain weight string: numeric compare.\n return parseInt(valA) - parseInt(valB);\n}\n"],"mappings":";AASA,SAAgB,uBAAuB,MAAc,MAAsB;CAEzE,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,EAAE;EAC5C,MAAM,CAAC,SAAS,WAAW,KAAK,MAAM,KAAK,EAAE;EAC7C,MAAM,CAAC,SAAS,WAAW,KAAK,MAAM,KAAK,EAAE;EAE7C,IAAI,YAAY,SACd,OAAO,SAAS,QAAQ,GAAG,SAAS,QAAQ;EAE9C,OAAO,SAAS,QAAQ,GAAG,SAAS,QAAQ;;CAI9C,OAAO,SAAS,KAAK,GAAG,SAAS,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":[],"sources":["../../../src/build/google-fonts/validate.ts"],"sourcesContent":["// Ported from Next.js: packages/font/src/google/validate-google-font-function-call.ts\n// https://github.com/vercel/next.js/blob/canary/packages/font/src/google/validate-google-font-function-call.ts\n//\n// Vinext drops Next's SWC-coupled `(functionName, fontFunctionArgument)`\n// calling convention because the plugin already knows the family at parse\n// time. Behaviour is otherwise identical: validate the caller's options\n// against the bundled metadata, default missing fields, and reject anything\n// Google Fonts would reject at request time.\n\nimport { googleFontsMetadata } from \"./font-metadata.js\";\n\nconst ALLOWED_DISPLAY_VALUES = [\"auto\", \"block\", \"swap\", \"fallback\", \"optional\"];\n\ntype GoogleFontOptions = {\n weight?: string | string[];\n style?: string | string[];\n preload?: boolean;\n display?: string;\n axes?: string[];\n fallback?: string[];\n adjustFontFallback?: boolean;\n variable?: string;\n subsets?: string[];\n};\n\ntype ValidatedGoogleFontOptions = {\n fontFamily: string;\n weights: string[];\n styles: string[];\n display: string;\n preload: boolean;\n selectedVariableAxes?: string[];\n fallback?: string[];\n adjustFontFallback: boolean;\n variable?: string;\n subsets: string[];\n};\n\nconst formatAvailableValues = (values: string[]): string =>\n values.map((val) => `\\`${val}\\``).join(\", \");\n\nconst dedupe = (values: string[]): string[] => Array.from(new Set(values));\n\nexport function validateGoogleFontOptions(\n fontFamily: string,\n options: GoogleFontOptions,\n): ValidatedGoogleFontOptions {\n const {\n weight,\n style,\n display = \"swap\",\n axes,\n fallback,\n adjustFontFallback = true,\n variable,\n subsets = [],\n } = options;\n let preload = options.preload ?? true;\n\n const fontFamilyData = googleFontsMetadata[fontFamily];\n if (!fontFamilyData) {\n throw new Error(`Unknown font \\`${fontFamily}\\``);\n }\n\n if (axes !== undefined && !Array.isArray(axes)) {\n throw new Error(\n `Invalid axes value for font \\`${fontFamily}\\`, expected an array of axis names.`,\n );\n }\n\n const availableSubsets = fontFamilyData.subsets;\n if (availableSubsets.length === 0) {\n // No preloadable subsets means preload is meaningless. Silently disable\n // it rather than forcing the caller to opt out.\n preload = false;\n } else if (preload) {\n // Deliberate parity gap: Next.js uses `if (!subsets)` so an explicit\n // `subsets: []` passes silently. vinext rejects it as well, since an\n // empty subsets array with preload enabled is always a caller mistake.\n if (subsets.length === 0) {\n throw new Error(\n `Preload is enabled but no subsets were specified for font \\`${fontFamily}\\`. Please specify subsets or disable preloading if your intended subset can't be preloaded.\\nAvailable subsets: ${formatAvailableValues(availableSubsets)}`,\n );\n }\n for (const subset of subsets) {\n if (!availableSubsets.includes(subset)) {\n throw new Error(\n `Unknown subset \\`${subset}\\` for font \\`${fontFamily}\\`.\\nAvailable subsets: ${formatAvailableValues(availableSubsets)}`,\n );\n }\n }\n }\n\n const fontWeights = fontFamilyData.weights;\n const fontStyles = fontFamilyData.styles;\n\n const weights = !weight ? [] : dedupe(Array.isArray(weight) ? weight : [weight]);\n const styles = !style ? [] : dedupe(Array.isArray(style) ? style : [style]);\n\n if (weights.length === 0) {\n if (fontWeights.includes(\"variable\")) {\n // Caller said \"any weight\" and the font has a variable face, so use it.\n weights.push(\"variable\");\n } else {\n throw new Error(\n `Missing weight for font \\`${fontFamily}\\`.\\nAvailable weights: ${formatAvailableValues(fontWeights)}`,\n );\n }\n }\n\n if (weights.length > 1 && weights.includes(\"variable\")) {\n throw new Error(\n `Unexpected \\`variable\\` in weight array for font \\`${fontFamily}\\`. You only need \\`variable\\`, it includes all available weights.`,\n );\n }\n\n for (const selectedWeight of weights) {\n if (!fontWeights.includes(selectedWeight)) {\n throw new Error(\n `Unknown weight \\`${selectedWeight}\\` for font \\`${fontFamily}\\`.\\nAvailable weights: ${formatAvailableValues(fontWeights)}`,\n );\n }\n }\n\n if (styles.length === 0) {\n if (fontStyles.length === 1) {\n // Italic-only fonts (rare) have no normal face, so use that face.\n styles.push(fontStyles[0]);\n } else {\n styles.push(\"normal\");\n }\n }\n\n for (const selectedStyle of styles) {\n if (!fontStyles.includes(selectedStyle)) {\n throw new Error(\n `Unknown style \\`${selectedStyle}\\` for font \\`${fontFamily}\\`.\\nAvailable styles: ${formatAvailableValues(fontStyles)}`,\n );\n }\n }\n\n if (!ALLOWED_DISPLAY_VALUES.includes(display)) {\n throw new Error(\n `Invalid display value \\`${display}\\` for font \\`${fontFamily}\\`.\\nAvailable display values: ${formatAvailableValues(ALLOWED_DISPLAY_VALUES)}`,\n );\n }\n\n if (axes) {\n if (!fontWeights.includes(\"variable\")) {\n throw new Error(\"Axes can only be defined for variable fonts.\");\n }\n if (weights[0] !== \"variable\") {\n throw new Error(\n \"Axes can only be defined for variable fonts when the weight property is nonexistent or set to `variable`.\",\n );\n }\n }\n\n return {\n fontFamily,\n weights,\n styles,\n display,\n preload,\n selectedVariableAxes: axes,\n fallback,\n adjustFontFallback,\n variable,\n subsets,\n };\n}\n"],"mappings":";;AAWA,MAAM,yBAAyB;CAAC;CAAQ;CAAS;CAAQ;CAAY;CAAW;AA2BhF,MAAM,yBAAyB,WAC7B,OAAO,KAAK,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK;AAE9C,MAAM,UAAU,WAA+B,MAAM,KAAK,IAAI,IAAI,OAAO,CAAC;AAE1E,SAAgB,0BACd,YACA,SAC4B;CAC5B,MAAM,EACJ,QACA,OACA,UAAU,QACV,MACA,UACA,qBAAqB,MACrB,UACA,UAAU,EAAE,KACV;CACJ,IAAI,UAAU,QAAQ,WAAW;CAEjC,MAAM,iBAAiB,oBAAoB;AAC3C,KAAI,CAAC,eACH,OAAM,IAAI,MAAM,kBAAkB,WAAW,IAAI;AAGnD,KAAI,SAAS,KAAA,KAAa,CAAC,MAAM,QAAQ,KAAK,CAC5C,OAAM,IAAI,MACR,iCAAiC,WAAW,sCAC7C;CAGH,MAAM,mBAAmB,eAAe;AACxC,KAAI,iBAAiB,WAAW,EAG9B,WAAU;UACD,SAAS;AAIlB,MAAI,QAAQ,WAAW,EACrB,OAAM,IAAI,MACR,+DAA+D,WAAW,mHAAmH,sBAAsB,iBAAiB,GACrO;AAEH,OAAK,MAAM,UAAU,QACnB,KAAI,CAAC,iBAAiB,SAAS,OAAO,CACpC,OAAM,IAAI,MACR,oBAAoB,OAAO,gBAAgB,WAAW,0BAA0B,sBAAsB,iBAAiB,GACxH;;CAKP,MAAM,cAAc,eAAe;CACnC,MAAM,aAAa,eAAe;CAElC,MAAM,UAAU,CAAC,SAAS,EAAE,GAAG,OAAO,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;CAChF,MAAM,SAAS,CAAC,QAAQ,EAAE,GAAG,OAAO,MAAM,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;AAE3E,KAAI,QAAQ,WAAW,EACrB,KAAI,YAAY,SAAS,WAAW,CAElC,SAAQ,KAAK,WAAW;KAExB,OAAM,IAAI,MACR,6BAA6B,WAAW,0BAA0B,sBAAsB,YAAY,GACrG;AAIL,KAAI,QAAQ,SAAS,KAAK,QAAQ,SAAS,WAAW,CACpD,OAAM,IAAI,MACR,sDAAsD,WAAW,oEAClE;AAGH,MAAK,MAAM,kBAAkB,QAC3B,KAAI,CAAC,YAAY,SAAS,eAAe,CACvC,OAAM,IAAI,MACR,oBAAoB,eAAe,gBAAgB,WAAW,0BAA0B,sBAAsB,YAAY,GAC3H;AAIL,KAAI,OAAO,WAAW,EACpB,KAAI,WAAW,WAAW,EAExB,QAAO,KAAK,WAAW,GAAG;KAE1B,QAAO,KAAK,SAAS;AAIzB,MAAK,MAAM,iBAAiB,OAC1B,KAAI,CAAC,WAAW,SAAS,cAAc,CACrC,OAAM,IAAI,MACR,mBAAmB,cAAc,gBAAgB,WAAW,yBAAyB,sBAAsB,WAAW,GACvH;AAIL,KAAI,CAAC,uBAAuB,SAAS,QAAQ,CAC3C,OAAM,IAAI,MACR,2BAA2B,QAAQ,gBAAgB,WAAW,iCAAiC,sBAAsB,uBAAuB,GAC7I;AAGH,KAAI,MAAM;AACR,MAAI,CAAC,YAAY,SAAS,WAAW,CACnC,OAAM,IAAI,MAAM,+CAA+C;AAEjE,MAAI,QAAQ,OAAO,WACjB,OAAM,IAAI,MACR,4GACD;;AAIL,QAAO;EACL;EACA;EACA;EACA;EACA;EACA,sBAAsB;EACtB;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"validate.js","names":[],"sources":["../../../src/build/google-fonts/validate.ts"],"sourcesContent":["// Ported from Next.js: packages/font/src/google/validate-google-font-function-call.ts\n// https://github.com/vercel/next.js/blob/canary/packages/font/src/google/validate-google-font-function-call.ts\n//\n// Vinext drops Next's SWC-coupled `(functionName, fontFunctionArgument)`\n// calling convention because the plugin already knows the family at parse\n// time. Behaviour is otherwise identical: validate the caller's options\n// against the bundled metadata, default missing fields, and reject anything\n// Google Fonts would reject at request time.\n\nimport { googleFontsMetadata } from \"./font-metadata.js\";\n\nconst ALLOWED_DISPLAY_VALUES = [\"auto\", \"block\", \"swap\", \"fallback\", \"optional\"];\n\ntype GoogleFontOptions = {\n weight?: string | string[];\n style?: string | string[];\n preload?: boolean;\n display?: string;\n axes?: string[];\n fallback?: string[];\n adjustFontFallback?: boolean;\n variable?: string;\n subsets?: string[];\n};\n\ntype ValidatedGoogleFontOptions = {\n fontFamily: string;\n weights: string[];\n styles: string[];\n display: string;\n preload: boolean;\n selectedVariableAxes?: string[];\n fallback?: string[];\n adjustFontFallback: boolean;\n variable?: string;\n subsets: string[];\n};\n\nconst formatAvailableValues = (values: string[]): string =>\n values.map((val) => `\\`${val}\\``).join(\", \");\n\nconst dedupe = (values: string[]): string[] => Array.from(new Set(values));\n\nexport function validateGoogleFontOptions(\n fontFamily: string,\n options: GoogleFontOptions,\n): ValidatedGoogleFontOptions {\n const {\n weight,\n style,\n display = \"swap\",\n axes,\n fallback,\n adjustFontFallback = true,\n variable,\n subsets = [],\n } = options;\n let preload = options.preload ?? true;\n\n const fontFamilyData = googleFontsMetadata[fontFamily];\n if (!fontFamilyData) {\n throw new Error(`Unknown font \\`${fontFamily}\\``);\n }\n\n if (axes !== undefined && !Array.isArray(axes)) {\n throw new Error(\n `Invalid axes value for font \\`${fontFamily}\\`, expected an array of axis names.`,\n );\n }\n\n const availableSubsets = fontFamilyData.subsets;\n if (availableSubsets.length === 0) {\n // No preloadable subsets means preload is meaningless. Silently disable\n // it rather than forcing the caller to opt out.\n preload = false;\n } else if (preload) {\n // Deliberate parity gap: Next.js uses `if (!subsets)` so an explicit\n // `subsets: []` passes silently. vinext rejects it as well, since an\n // empty subsets array with preload enabled is always a caller mistake.\n if (subsets.length === 0) {\n throw new Error(\n `Preload is enabled but no subsets were specified for font \\`${fontFamily}\\`. Please specify subsets or disable preloading if your intended subset can't be preloaded.\\nAvailable subsets: ${formatAvailableValues(availableSubsets)}`,\n );\n }\n for (const subset of subsets) {\n if (!availableSubsets.includes(subset)) {\n throw new Error(\n `Unknown subset \\`${subset}\\` for font \\`${fontFamily}\\`.\\nAvailable subsets: ${formatAvailableValues(availableSubsets)}`,\n );\n }\n }\n }\n\n const fontWeights = fontFamilyData.weights;\n const fontStyles = fontFamilyData.styles;\n\n const weights = !weight ? [] : dedupe(Array.isArray(weight) ? weight : [weight]);\n const styles = !style ? [] : dedupe(Array.isArray(style) ? style : [style]);\n\n if (weights.length === 0) {\n if (fontWeights.includes(\"variable\")) {\n // Caller said \"any weight\" and the font has a variable face, so use it.\n weights.push(\"variable\");\n } else {\n throw new Error(\n `Missing weight for font \\`${fontFamily}\\`.\\nAvailable weights: ${formatAvailableValues(fontWeights)}`,\n );\n }\n }\n\n if (weights.length > 1 && weights.includes(\"variable\")) {\n throw new Error(\n `Unexpected \\`variable\\` in weight array for font \\`${fontFamily}\\`. You only need \\`variable\\`, it includes all available weights.`,\n );\n }\n\n for (const selectedWeight of weights) {\n if (!fontWeights.includes(selectedWeight)) {\n throw new Error(\n `Unknown weight \\`${selectedWeight}\\` for font \\`${fontFamily}\\`.\\nAvailable weights: ${formatAvailableValues(fontWeights)}`,\n );\n }\n }\n\n if (styles.length === 0) {\n if (fontStyles.length === 1) {\n // Italic-only fonts (rare) have no normal face, so use that face.\n styles.push(fontStyles[0]);\n } else {\n styles.push(\"normal\");\n }\n }\n\n for (const selectedStyle of styles) {\n if (!fontStyles.includes(selectedStyle)) {\n throw new Error(\n `Unknown style \\`${selectedStyle}\\` for font \\`${fontFamily}\\`.\\nAvailable styles: ${formatAvailableValues(fontStyles)}`,\n );\n }\n }\n\n if (!ALLOWED_DISPLAY_VALUES.includes(display)) {\n throw new Error(\n `Invalid display value \\`${display}\\` for font \\`${fontFamily}\\`.\\nAvailable display values: ${formatAvailableValues(ALLOWED_DISPLAY_VALUES)}`,\n );\n }\n\n if (axes) {\n if (!fontWeights.includes(\"variable\")) {\n throw new Error(\"Axes can only be defined for variable fonts.\");\n }\n if (weights[0] !== \"variable\") {\n throw new Error(\n \"Axes can only be defined for variable fonts when the weight property is nonexistent or set to `variable`.\",\n );\n }\n }\n\n return {\n fontFamily,\n weights,\n styles,\n display,\n preload,\n selectedVariableAxes: axes,\n fallback,\n adjustFontFallback,\n variable,\n subsets,\n };\n}\n"],"mappings":";;AAWA,MAAM,yBAAyB;CAAC;CAAQ;CAAS;CAAQ;CAAY;CAAW;AA2BhF,MAAM,yBAAyB,WAC7B,OAAO,KAAK,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK;AAE9C,MAAM,UAAU,WAA+B,MAAM,KAAK,IAAI,IAAI,OAAO,CAAC;AAE1E,SAAgB,0BACd,YACA,SAC4B;CAC5B,MAAM,EACJ,QACA,OACA,UAAU,QACV,MACA,UACA,qBAAqB,MACrB,UACA,UAAU,EAAE,KACV;CACJ,IAAI,UAAU,QAAQ,WAAW;CAEjC,MAAM,iBAAiB,oBAAoB;CAC3C,IAAI,CAAC,gBACH,MAAM,IAAI,MAAM,kBAAkB,WAAW,IAAI;CAGnD,IAAI,SAAS,KAAA,KAAa,CAAC,MAAM,QAAQ,KAAK,EAC5C,MAAM,IAAI,MACR,iCAAiC,WAAW,sCAC7C;CAGH,MAAM,mBAAmB,eAAe;CACxC,IAAI,iBAAiB,WAAW,GAG9B,UAAU;MACL,IAAI,SAAS;EAIlB,IAAI,QAAQ,WAAW,GACrB,MAAM,IAAI,MACR,+DAA+D,WAAW,mHAAmH,sBAAsB,iBAAiB,GACrO;EAEH,KAAK,MAAM,UAAU,SACnB,IAAI,CAAC,iBAAiB,SAAS,OAAO,EACpC,MAAM,IAAI,MACR,oBAAoB,OAAO,gBAAgB,WAAW,0BAA0B,sBAAsB,iBAAiB,GACxH;;CAKP,MAAM,cAAc,eAAe;CACnC,MAAM,aAAa,eAAe;CAElC,MAAM,UAAU,CAAC,SAAS,EAAE,GAAG,OAAO,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;CAChF,MAAM,SAAS,CAAC,QAAQ,EAAE,GAAG,OAAO,MAAM,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;CAE3E,IAAI,QAAQ,WAAW,GACrB,IAAI,YAAY,SAAS,WAAW,EAElC,QAAQ,KAAK,WAAW;MAExB,MAAM,IAAI,MACR,6BAA6B,WAAW,0BAA0B,sBAAsB,YAAY,GACrG;CAIL,IAAI,QAAQ,SAAS,KAAK,QAAQ,SAAS,WAAW,EACpD,MAAM,IAAI,MACR,sDAAsD,WAAW,oEAClE;CAGH,KAAK,MAAM,kBAAkB,SAC3B,IAAI,CAAC,YAAY,SAAS,eAAe,EACvC,MAAM,IAAI,MACR,oBAAoB,eAAe,gBAAgB,WAAW,0BAA0B,sBAAsB,YAAY,GAC3H;CAIL,IAAI,OAAO,WAAW,GACpB,IAAI,WAAW,WAAW,GAExB,OAAO,KAAK,WAAW,GAAG;MAE1B,OAAO,KAAK,SAAS;CAIzB,KAAK,MAAM,iBAAiB,QAC1B,IAAI,CAAC,WAAW,SAAS,cAAc,EACrC,MAAM,IAAI,MACR,mBAAmB,cAAc,gBAAgB,WAAW,yBAAyB,sBAAsB,WAAW,GACvH;CAIL,IAAI,CAAC,uBAAuB,SAAS,QAAQ,EAC3C,MAAM,IAAI,MACR,2BAA2B,QAAQ,gBAAgB,WAAW,iCAAiC,sBAAsB,uBAAuB,GAC7I;CAGH,IAAI,MAAM;EACR,IAAI,CAAC,YAAY,SAAS,WAAW,EACnC,MAAM,IAAI,MAAM,+CAA+C;EAEjE,IAAI,QAAQ,OAAO,YACjB,MAAM,IAAI,MACR,4GACD;;CAIL,OAAO;EACL;EACA;EACA;EACA;EACA;EACA,sBAAsB;EACtB;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"layout-classification.js","names":[],"sources":["../../src/build/layout-classification.ts"],"sourcesContent":["/**\n * Layout classification — determines whether each layout in an App Router\n * route tree is static or dynamic via two complementary detection layers:\n *\n * Layer 1: Segment config (`export const dynamic`, `export const revalidate`)\n * Layer 2: Module graph traversal (checks for transitive dynamic shim imports)\n *\n * Layer 3 (probe-based runtime detection) is handled separately in\n * `app-page-execution.ts` at request time.\n *\n * Every result is carried as a `LayoutBuildClassification` tagged variant so\n * operators can trace which layer produced a decision via the structured\n * `ClassificationReason` sidecar without that metadata leaking onto the wire.\n */\n\nimport { classifyLayoutSegmentConfig } from \"./report.js\";\nimport { AppElementsWire } from \"../server/app-elements.js\";\nimport { createAppPageTreePath } from \"../server/app-page-route-wiring.js\";\nimport type {\n ClassificationReason,\n LayoutBuildClassification,\n ModuleGraphStaticReason,\n} from \"./layout-classification-types.js\";\n\ntype ModuleGraphClassification = \"static\" | \"needs-probe\";\n\ntype ModuleGraphClassificationResult = {\n result: ModuleGraphClassification;\n /** First dynamic shim module ID encountered during BFS, when any. */\n firstShimMatch?: string;\n};\n\nexport type ModuleInfoProvider = {\n getModuleInfo(id: string): {\n importedIds: string[];\n dynamicImportedIds: string[];\n } | null;\n};\n\ntype LayoutEntry = {\n /** Rollup/Vite module ID for the layout file. */\n moduleId: string;\n /** Directory depth from the app root, used to build the stable layout ID. */\n treePosition: number;\n /** Segment config source code extracted at build time, or null when absent. */\n segmentConfig?: { code: string } | null;\n};\n\ntype RouteForClassification = {\n layouts: readonly LayoutEntry[];\n routeSegments: string[];\n};\n\n/**\n * BFS traversal of a layout's dependency tree. If any transitive import\n * resolves to a dynamic shim path (headers, cache, server), the layout\n * cannot be proven static at build time and needs a runtime probe.\n *\n * The returned object carries the classification plus the first matching\n * shim module ID (when any). Operators use the shim ID via the debug\n * channel to trace why a layout was flagged for probing.\n */\nexport function classifyLayoutByModuleGraph(\n layoutModuleId: string,\n dynamicShimPaths: ReadonlySet<string>,\n moduleInfo: ModuleInfoProvider,\n): ModuleGraphClassificationResult {\n const visited = new Set<string>();\n const queue: string[] = [layoutModuleId];\n let head = 0;\n\n while (head < queue.length) {\n const currentId = queue[head++]!;\n\n if (visited.has(currentId)) continue;\n visited.add(currentId);\n\n if (dynamicShimPaths.has(currentId)) {\n return { result: \"needs-probe\", firstShimMatch: currentId };\n }\n\n const info = moduleInfo.getModuleInfo(currentId);\n if (!info) continue;\n\n for (const importedId of info.importedIds) {\n if (!visited.has(importedId)) queue.push(importedId);\n }\n for (const dynamicId of info.dynamicImportedIds) {\n if (!visited.has(dynamicId)) queue.push(dynamicId);\n }\n }\n\n return { result: \"static\" };\n}\n\nexport function moduleGraphReason(\n graphResult: ModuleGraphClassificationResult & { result: \"static\" },\n): ModuleGraphStaticReason;\nexport function moduleGraphReason(\n graphResult: ModuleGraphClassificationResult,\n): ClassificationReason;\nexport function moduleGraphReason(\n graphResult: ModuleGraphClassificationResult,\n): ClassificationReason {\n if (graphResult.firstShimMatch === undefined) {\n return { layer: \"module-graph\", result: graphResult.result };\n }\n return {\n layer: \"module-graph\",\n result: graphResult.result,\n firstShimMatch: graphResult.firstShimMatch,\n };\n}\n\nexport function isStaticModuleGraphResult(\n graphResult: ModuleGraphClassificationResult,\n): graphResult is ModuleGraphClassificationResult & { result: \"static\" } {\n return graphResult.result === \"static\";\n}\n\n/**\n * Classifies all layouts across all routes using a two-layer strategy:\n *\n * 1. Segment config (Layer 1) — short-circuits to \"static\" or \"dynamic\"\n * 2. Module graph (Layer 2) — BFS for dynamic shim imports → \"static\" or \"needs-probe\"\n *\n * Shared layouts (same file appearing in multiple routes) are classified once\n * and deduplicated by layout ID.\n *\n * @internal Not called by production code. The `generateBundle` hook in\n * `index.ts` calls `classifyLayoutByModuleGraph` directly and composes\n * via the numeric-index manifest in `route-classification-manifest.ts`.\n * Used only by `tests/layout-classification.test.ts`.\n */\nexport function classifyAllRouteLayouts(\n routes: readonly RouteForClassification[],\n dynamicShimPaths: ReadonlySet<string>,\n moduleInfo: ModuleInfoProvider,\n): Map<string, LayoutBuildClassification> {\n const result = new Map<string, LayoutBuildClassification>();\n\n for (const route of routes) {\n for (const layout of route.layouts) {\n const layoutId = AppElementsWire.encodeLayoutId(\n createAppPageTreePath(route.routeSegments, layout.treePosition),\n );\n\n if (result.has(layoutId)) continue;\n\n // Layer 1: segment config\n if (layout.segmentConfig) {\n const configResult = classifyLayoutSegmentConfig(layout.segmentConfig.code);\n if (configResult.kind !== \"absent\") {\n result.set(layoutId, configResult);\n continue;\n }\n }\n\n // Layer 2: module graph\n const graphResult = classifyLayoutByModuleGraph(\n layout.moduleId,\n dynamicShimPaths,\n moduleInfo,\n );\n const reason = moduleGraphReason(graphResult);\n result.set(layoutId, { kind: graphResult.result, reason });\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,4BACd,gBACA,kBACA,YACiC;CACjC,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,QAAkB,CAAC,eAAe;CACxC,IAAI,OAAO;AAEX,QAAO,OAAO,MAAM,QAAQ;EAC1B,MAAM,YAAY,MAAM;AAExB,MAAI,QAAQ,IAAI,UAAU,CAAE;AAC5B,UAAQ,IAAI,UAAU;AAEtB,MAAI,iBAAiB,IAAI,UAAU,CACjC,QAAO;GAAE,QAAQ;GAAe,gBAAgB;GAAW;EAG7D,MAAM,OAAO,WAAW,cAAc,UAAU;AAChD,MAAI,CAAC,KAAM;AAEX,OAAK,MAAM,cAAc,KAAK,YAC5B,KAAI,CAAC,QAAQ,IAAI,WAAW,CAAE,OAAM,KAAK,WAAW;AAEtD,OAAK,MAAM,aAAa,KAAK,mBAC3B,KAAI,CAAC,QAAQ,IAAI,UAAU,CAAE,OAAM,KAAK,UAAU;;AAItD,QAAO,EAAE,QAAQ,UAAU;;AAS7B,SAAgB,kBACd,aACsB;AACtB,KAAI,YAAY,mBAAmB,KAAA,EACjC,QAAO;EAAE,OAAO;EAAgB,QAAQ,YAAY;EAAQ;AAE9D,QAAO;EACL,OAAO;EACP,QAAQ,YAAY;EACpB,gBAAgB,YAAY;EAC7B;;AAGH,SAAgB,0BACd,aACuE;AACvE,QAAO,YAAY,WAAW;;;;;;;;;;;;;;;;AAiBhC,SAAgB,wBACd,QACA,kBACA,YACwC;CACxC,MAAM,yBAAS,IAAI,KAAwC;AAE3D,MAAK,MAAM,SAAS,OAClB,MAAK,MAAM,UAAU,MAAM,SAAS;EAClC,MAAM,WAAW,gBAAgB,eAC/B,sBAAsB,MAAM,eAAe,OAAO,aAAa,CAChE;AAED,MAAI,OAAO,IAAI,SAAS,CAAE;AAG1B,MAAI,OAAO,eAAe;GACxB,MAAM,eAAe,4BAA4B,OAAO,cAAc,KAAK;AAC3E,OAAI,aAAa,SAAS,UAAU;AAClC,WAAO,IAAI,UAAU,aAAa;AAClC;;;EAKJ,MAAM,cAAc,4BAClB,OAAO,UACP,kBACA,WACD;EACD,MAAM,SAAS,kBAAkB,YAAY;AAC7C,SAAO,IAAI,UAAU;GAAE,MAAM,YAAY;GAAQ;GAAQ,CAAC;;AAI9D,QAAO"}
1
+ {"version":3,"file":"layout-classification.js","names":[],"sources":["../../src/build/layout-classification.ts"],"sourcesContent":["/**\n * Layout classification — determines whether each layout in an App Router\n * route tree is static or dynamic via two complementary detection layers:\n *\n * Layer 1: Segment config (`export const dynamic`, `export const revalidate`)\n * Layer 2: Module graph traversal (checks for transitive dynamic shim imports)\n *\n * Layer 3 (probe-based runtime detection) is handled separately in\n * `app-page-execution.ts` at request time.\n *\n * Every result is carried as a `LayoutBuildClassification` tagged variant so\n * operators can trace which layer produced a decision via the structured\n * `ClassificationReason` sidecar without that metadata leaking onto the wire.\n */\n\nimport { classifyLayoutSegmentConfig } from \"./report.js\";\nimport { AppElementsWire } from \"../server/app-elements.js\";\nimport { createAppPageTreePath } from \"../server/app-page-route-wiring.js\";\nimport type {\n ClassificationReason,\n LayoutBuildClassification,\n ModuleGraphStaticReason,\n} from \"./layout-classification-types.js\";\n\ntype ModuleGraphClassification = \"static\" | \"needs-probe\";\n\ntype ModuleGraphClassificationResult = {\n result: ModuleGraphClassification;\n /** First dynamic shim module ID encountered during BFS, when any. */\n firstShimMatch?: string;\n};\n\nexport type ModuleInfoProvider = {\n getModuleInfo(id: string): {\n importedIds: string[];\n dynamicImportedIds: string[];\n } | null;\n};\n\ntype LayoutEntry = {\n /** Rollup/Vite module ID for the layout file. */\n moduleId: string;\n /** Directory depth from the app root, used to build the stable layout ID. */\n treePosition: number;\n /** Segment config source code extracted at build time, or null when absent. */\n segmentConfig?: { code: string } | null;\n};\n\ntype RouteForClassification = {\n layouts: readonly LayoutEntry[];\n routeSegments: string[];\n};\n\n/**\n * BFS traversal of a layout's dependency tree. If any transitive import\n * resolves to a dynamic shim path (headers, cache, server), the layout\n * cannot be proven static at build time and needs a runtime probe.\n *\n * The returned object carries the classification plus the first matching\n * shim module ID (when any). Operators use the shim ID via the debug\n * channel to trace why a layout was flagged for probing.\n */\nexport function classifyLayoutByModuleGraph(\n layoutModuleId: string,\n dynamicShimPaths: ReadonlySet<string>,\n moduleInfo: ModuleInfoProvider,\n): ModuleGraphClassificationResult {\n const visited = new Set<string>();\n const queue: string[] = [layoutModuleId];\n let head = 0;\n\n while (head < queue.length) {\n const currentId = queue[head++]!;\n\n if (visited.has(currentId)) continue;\n visited.add(currentId);\n\n if (dynamicShimPaths.has(currentId)) {\n return { result: \"needs-probe\", firstShimMatch: currentId };\n }\n\n const info = moduleInfo.getModuleInfo(currentId);\n if (!info) continue;\n\n for (const importedId of info.importedIds) {\n if (!visited.has(importedId)) queue.push(importedId);\n }\n for (const dynamicId of info.dynamicImportedIds) {\n if (!visited.has(dynamicId)) queue.push(dynamicId);\n }\n }\n\n return { result: \"static\" };\n}\n\nexport function moduleGraphReason(\n graphResult: ModuleGraphClassificationResult & { result: \"static\" },\n): ModuleGraphStaticReason;\nexport function moduleGraphReason(\n graphResult: ModuleGraphClassificationResult,\n): ClassificationReason;\nexport function moduleGraphReason(\n graphResult: ModuleGraphClassificationResult,\n): ClassificationReason {\n if (graphResult.firstShimMatch === undefined) {\n return { layer: \"module-graph\", result: graphResult.result };\n }\n return {\n layer: \"module-graph\",\n result: graphResult.result,\n firstShimMatch: graphResult.firstShimMatch,\n };\n}\n\nexport function isStaticModuleGraphResult(\n graphResult: ModuleGraphClassificationResult,\n): graphResult is ModuleGraphClassificationResult & { result: \"static\" } {\n return graphResult.result === \"static\";\n}\n\n/**\n * Classifies all layouts across all routes using a two-layer strategy:\n *\n * 1. Segment config (Layer 1) — short-circuits to \"static\" or \"dynamic\"\n * 2. Module graph (Layer 2) — BFS for dynamic shim imports → \"static\" or \"needs-probe\"\n *\n * Shared layouts (same file appearing in multiple routes) are classified once\n * and deduplicated by layout ID.\n *\n * @internal Not called by production code. The `generateBundle` hook in\n * `index.ts` calls `classifyLayoutByModuleGraph` directly and composes\n * via the numeric-index manifest in `route-classification-manifest.ts`.\n * Used only by `tests/layout-classification.test.ts`.\n */\nexport function classifyAllRouteLayouts(\n routes: readonly RouteForClassification[],\n dynamicShimPaths: ReadonlySet<string>,\n moduleInfo: ModuleInfoProvider,\n): Map<string, LayoutBuildClassification> {\n const result = new Map<string, LayoutBuildClassification>();\n\n for (const route of routes) {\n for (const layout of route.layouts) {\n const layoutId = AppElementsWire.encodeLayoutId(\n createAppPageTreePath(route.routeSegments, layout.treePosition),\n );\n\n if (result.has(layoutId)) continue;\n\n // Layer 1: segment config\n if (layout.segmentConfig) {\n const configResult = classifyLayoutSegmentConfig(layout.segmentConfig.code);\n if (configResult.kind !== \"absent\") {\n result.set(layoutId, configResult);\n continue;\n }\n }\n\n // Layer 2: module graph\n const graphResult = classifyLayoutByModuleGraph(\n layout.moduleId,\n dynamicShimPaths,\n moduleInfo,\n );\n const reason = moduleGraphReason(graphResult);\n result.set(layoutId, { kind: graphResult.result, reason });\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,4BACd,gBACA,kBACA,YACiC;CACjC,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,QAAkB,CAAC,eAAe;CACxC,IAAI,OAAO;CAEX,OAAO,OAAO,MAAM,QAAQ;EAC1B,MAAM,YAAY,MAAM;EAExB,IAAI,QAAQ,IAAI,UAAU,EAAE;EAC5B,QAAQ,IAAI,UAAU;EAEtB,IAAI,iBAAiB,IAAI,UAAU,EACjC,OAAO;GAAE,QAAQ;GAAe,gBAAgB;GAAW;EAG7D,MAAM,OAAO,WAAW,cAAc,UAAU;EAChD,IAAI,CAAC,MAAM;EAEX,KAAK,MAAM,cAAc,KAAK,aAC5B,IAAI,CAAC,QAAQ,IAAI,WAAW,EAAE,MAAM,KAAK,WAAW;EAEtD,KAAK,MAAM,aAAa,KAAK,oBAC3B,IAAI,CAAC,QAAQ,IAAI,UAAU,EAAE,MAAM,KAAK,UAAU;;CAItD,OAAO,EAAE,QAAQ,UAAU;;AAS7B,SAAgB,kBACd,aACsB;CACtB,IAAI,YAAY,mBAAmB,KAAA,GACjC,OAAO;EAAE,OAAO;EAAgB,QAAQ,YAAY;EAAQ;CAE9D,OAAO;EACL,OAAO;EACP,QAAQ,YAAY;EACpB,gBAAgB,YAAY;EAC7B;;AAGH,SAAgB,0BACd,aACuE;CACvE,OAAO,YAAY,WAAW;;;;;;;;;;;;;;;;AAiBhC,SAAgB,wBACd,QACA,kBACA,YACwC;CACxC,MAAM,yBAAS,IAAI,KAAwC;CAE3D,KAAK,MAAM,SAAS,QAClB,KAAK,MAAM,UAAU,MAAM,SAAS;EAClC,MAAM,WAAW,gBAAgB,eAC/B,sBAAsB,MAAM,eAAe,OAAO,aAAa,CAChE;EAED,IAAI,OAAO,IAAI,SAAS,EAAE;EAG1B,IAAI,OAAO,eAAe;GACxB,MAAM,eAAe,4BAA4B,OAAO,cAAc,KAAK;GAC3E,IAAI,aAAa,SAAS,UAAU;IAClC,OAAO,IAAI,UAAU,aAAa;IAClC;;;EAKJ,MAAM,cAAc,4BAClB,OAAO,UACP,kBACA,WACD;EACD,MAAM,SAAS,kBAAkB,YAAY;EAC7C,OAAO,IAAI,UAAU;GAAE,MAAM,YAAY;GAAQ;GAAQ,CAAC;;CAI9D,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"nitro-route-rules.js","names":[],"sources":["../../src/build/nitro-route-rules.ts"],"sourcesContent":["import { appRouter, type AppRoute } from \"../routing/app-router.js\";\nimport { apiRouter, pagesRouter, type Route } from \"../routing/pages-router.js\";\nimport { buildReportRows, type RouteRow } from \"./report.js\";\n\n// Mirrors Nitro's NitroRouteConfig — hand-rolled because nitropack is not a direct dependency.\nexport type NitroRouteRuleConfig = Record<string, unknown> & {\n swr?: boolean | number;\n cache?: unknown;\n static?: boolean;\n isr?: boolean | number;\n prerender?: boolean;\n};\n\ntype NitroRouteRules = Record<string, { swr: number }>;\n\n/**\n * Scans the filesystem for route files and generates Nitro `routeRules` for ISR routes.\n *\n * Note: this duplicates the filesystem scanning that `printBuildReport` also performs.\n * The `nitro.setup` hook runs during Nitro initialization (before the build), while\n * `printBuildReport` runs after the build, so sharing results is non-trivial. This is\n * a future optimization target.\n *\n * Unlike `printBuildReport`, this path does not receive `prerenderResult`, so routes\n * classified as `unknown` by static analysis (which `printBuildReport` might upgrade\n * to `static` via speculative prerender) are skipped here.\n */\nexport async function collectNitroRouteRules(options: {\n appDir?: string | null;\n pagesDir?: string | null;\n pageExtensions: string[];\n}): Promise<NitroRouteRules> {\n const { appDir, pageExtensions, pagesDir } = options;\n\n let appRoutes: AppRoute[] = [];\n let pageRoutes: Route[] = [];\n let apiRoutes: Route[] = [];\n\n if (appDir) {\n appRoutes = await appRouter(appDir, pageExtensions);\n }\n\n if (pagesDir) {\n const [pages, apis] = await Promise.all([\n pagesRouter(pagesDir, pageExtensions),\n apiRouter(pagesDir, pageExtensions),\n ]);\n pageRoutes = pages;\n apiRoutes = apis;\n }\n\n return generateNitroRouteRules(buildReportRows({ appRoutes, pageRoutes, apiRoutes }));\n}\n\nexport function generateNitroRouteRules(rows: RouteRow[]): NitroRouteRules {\n const rules: NitroRouteRules = {};\n\n for (const row of rows) {\n if (\n row.type === \"isr\" &&\n typeof row.revalidate === \"number\" &&\n Number.isFinite(row.revalidate) &&\n row.revalidate > 0\n ) {\n rules[convertToNitroPattern(row.pattern)] = { swr: row.revalidate };\n }\n }\n\n return rules;\n}\n\n/**\n * Converts vinext's internal `:param` route syntax to Nitro's rou3\n * pattern format. Nitro uses `rou3` for routeRules matching, which\n * supports `*` (single-segment) and `**` (multi-segment) wildcards.\n *\n * /blog/:slug -> /blog/* (single segment)\n * /docs/:slug+ -> /docs/** (one or more segments — catch-all)\n * /docs/:slug* -> /docs/** (zero or more segments — optional catch-all)\n * /about -> /about (unchanged)\n * /:a/:b produces `/*`/`/*` (consecutive single-segment params)\n */\nexport function convertToNitroPattern(pattern: string): string {\n return pattern\n .split(\"/\")\n .map((segment) => {\n if (segment.startsWith(\":\")) {\n // Catch-all (:param+) and optional catch-all (:param*) match multiple segments → **\n // Single dynamic param (:param) matches one segment → *\n return segment.endsWith(\"+\") || segment.endsWith(\"*\") ? \"**\" : \"*\";\n }\n return segment;\n })\n .join(\"/\");\n}\n\nexport function mergeNitroRouteRules(\n existingRouteRules: Record<string, NitroRouteRuleConfig> | undefined,\n generatedRouteRules: NitroRouteRules,\n): {\n routeRules: Record<string, NitroRouteRuleConfig>;\n skippedRoutes: string[];\n} {\n const routeRules = { ...existingRouteRules };\n const skippedRoutes: string[] = [];\n\n for (const [route, generatedRule] of Object.entries(generatedRouteRules)) {\n const existingRule = routeRules[route];\n\n if (existingRule && hasUserDefinedCacheRule(existingRule)) {\n skippedRoutes.push(route);\n continue;\n }\n\n routeRules[route] = {\n ...existingRule,\n ...generatedRule,\n };\n }\n\n return { routeRules, skippedRoutes };\n}\n\nfunction hasUserDefinedCacheRule(rule: NitroRouteRuleConfig): boolean {\n return (\n rule.swr !== undefined ||\n rule.cache !== undefined ||\n rule.static !== undefined ||\n rule.isr !== undefined ||\n rule.prerender !== undefined\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,eAAsB,uBAAuB,SAIhB;CAC3B,MAAM,EAAE,QAAQ,gBAAgB,aAAa;CAE7C,IAAI,YAAwB,EAAE;CAC9B,IAAI,aAAsB,EAAE;CAC5B,IAAI,YAAqB,EAAE;AAE3B,KAAI,OACF,aAAY,MAAM,UAAU,QAAQ,eAAe;AAGrD,KAAI,UAAU;EACZ,MAAM,CAAC,OAAO,QAAQ,MAAM,QAAQ,IAAI,CACtC,YAAY,UAAU,eAAe,EACrC,UAAU,UAAU,eAAe,CACpC,CAAC;AACF,eAAa;AACb,cAAY;;AAGd,QAAO,wBAAwB,gBAAgB;EAAE;EAAW;EAAY;EAAW,CAAC,CAAC;;AAGvF,SAAgB,wBAAwB,MAAmC;CACzE,MAAM,QAAyB,EAAE;AAEjC,MAAK,MAAM,OAAO,KAChB,KACE,IAAI,SAAS,SACb,OAAO,IAAI,eAAe,YAC1B,OAAO,SAAS,IAAI,WAAW,IAC/B,IAAI,aAAa,EAEjB,OAAM,sBAAsB,IAAI,QAAQ,IAAI,EAAE,KAAK,IAAI,YAAY;AAIvE,QAAO;;;;;;;;;;;;;AAcT,SAAgB,sBAAsB,SAAyB;AAC7D,QAAO,QACJ,MAAM,IAAI,CACV,KAAK,YAAY;AAChB,MAAI,QAAQ,WAAW,IAAI,CAGzB,QAAO,QAAQ,SAAS,IAAI,IAAI,QAAQ,SAAS,IAAI,GAAG,OAAO;AAEjE,SAAO;GACP,CACD,KAAK,IAAI;;AAGd,SAAgB,qBACd,oBACA,qBAIA;CACA,MAAM,aAAa,EAAE,GAAG,oBAAoB;CAC5C,MAAM,gBAA0B,EAAE;AAElC,MAAK,MAAM,CAAC,OAAO,kBAAkB,OAAO,QAAQ,oBAAoB,EAAE;EACxE,MAAM,eAAe,WAAW;AAEhC,MAAI,gBAAgB,wBAAwB,aAAa,EAAE;AACzD,iBAAc,KAAK,MAAM;AACzB;;AAGF,aAAW,SAAS;GAClB,GAAG;GACH,GAAG;GACJ;;AAGH,QAAO;EAAE;EAAY;EAAe;;AAGtC,SAAS,wBAAwB,MAAqC;AACpE,QACE,KAAK,QAAQ,KAAA,KACb,KAAK,UAAU,KAAA,KACf,KAAK,WAAW,KAAA,KAChB,KAAK,QAAQ,KAAA,KACb,KAAK,cAAc,KAAA"}
1
+ {"version":3,"file":"nitro-route-rules.js","names":[],"sources":["../../src/build/nitro-route-rules.ts"],"sourcesContent":["import { appRouter, type AppRoute } from \"../routing/app-router.js\";\nimport { apiRouter, pagesRouter, type Route } from \"../routing/pages-router.js\";\nimport { buildReportRows, type RouteRow } from \"./report.js\";\n\n// Mirrors Nitro's NitroRouteConfig — hand-rolled because nitropack is not a direct dependency.\nexport type NitroRouteRuleConfig = Record<string, unknown> & {\n swr?: boolean | number;\n cache?: unknown;\n static?: boolean;\n isr?: boolean | number;\n prerender?: boolean;\n};\n\ntype NitroRouteRules = Record<string, { swr: number }>;\n\n/**\n * Scans the filesystem for route files and generates Nitro `routeRules` for ISR routes.\n *\n * Note: this duplicates the filesystem scanning that `printBuildReport` also performs.\n * The `nitro.setup` hook runs during Nitro initialization (before the build), while\n * `printBuildReport` runs after the build, so sharing results is non-trivial. This is\n * a future optimization target.\n *\n * Unlike `printBuildReport`, this path does not receive `prerenderResult`, so routes\n * classified as `unknown` by static analysis (which `printBuildReport` might upgrade\n * to `static` via speculative prerender) are skipped here.\n */\nexport async function collectNitroRouteRules(options: {\n appDir?: string | null;\n pagesDir?: string | null;\n pageExtensions: string[];\n}): Promise<NitroRouteRules> {\n const { appDir, pageExtensions, pagesDir } = options;\n\n let appRoutes: AppRoute[] = [];\n let pageRoutes: Route[] = [];\n let apiRoutes: Route[] = [];\n\n if (appDir) {\n appRoutes = await appRouter(appDir, pageExtensions);\n }\n\n if (pagesDir) {\n const [pages, apis] = await Promise.all([\n pagesRouter(pagesDir, pageExtensions),\n apiRouter(pagesDir, pageExtensions),\n ]);\n pageRoutes = pages;\n apiRoutes = apis;\n }\n\n return generateNitroRouteRules(buildReportRows({ appRoutes, pageRoutes, apiRoutes }));\n}\n\nexport function generateNitroRouteRules(rows: RouteRow[]): NitroRouteRules {\n const rules: NitroRouteRules = {};\n\n for (const row of rows) {\n if (\n row.type === \"isr\" &&\n typeof row.revalidate === \"number\" &&\n Number.isFinite(row.revalidate) &&\n row.revalidate > 0\n ) {\n rules[convertToNitroPattern(row.pattern)] = { swr: row.revalidate };\n }\n }\n\n return rules;\n}\n\n/**\n * Converts vinext's internal `:param` route syntax to Nitro's rou3\n * pattern format. Nitro uses `rou3` for routeRules matching, which\n * supports `*` (single-segment) and `**` (multi-segment) wildcards.\n *\n * /blog/:slug -> /blog/* (single segment)\n * /docs/:slug+ -> /docs/** (one or more segments — catch-all)\n * /docs/:slug* -> /docs/** (zero or more segments — optional catch-all)\n * /about -> /about (unchanged)\n * /:a/:b produces `/*`/`/*` (consecutive single-segment params)\n */\nexport function convertToNitroPattern(pattern: string): string {\n return pattern\n .split(\"/\")\n .map((segment) => {\n if (segment.startsWith(\":\")) {\n // Catch-all (:param+) and optional catch-all (:param*) match multiple segments → **\n // Single dynamic param (:param) matches one segment → *\n return segment.endsWith(\"+\") || segment.endsWith(\"*\") ? \"**\" : \"*\";\n }\n return segment;\n })\n .join(\"/\");\n}\n\nexport function mergeNitroRouteRules(\n existingRouteRules: Record<string, NitroRouteRuleConfig> | undefined,\n generatedRouteRules: NitroRouteRules,\n): {\n routeRules: Record<string, NitroRouteRuleConfig>;\n skippedRoutes: string[];\n} {\n const routeRules = { ...existingRouteRules };\n const skippedRoutes: string[] = [];\n\n for (const [route, generatedRule] of Object.entries(generatedRouteRules)) {\n const existingRule = routeRules[route];\n\n if (existingRule && hasUserDefinedCacheRule(existingRule)) {\n skippedRoutes.push(route);\n continue;\n }\n\n routeRules[route] = {\n ...existingRule,\n ...generatedRule,\n };\n }\n\n return { routeRules, skippedRoutes };\n}\n\nfunction hasUserDefinedCacheRule(rule: NitroRouteRuleConfig): boolean {\n return (\n rule.swr !== undefined ||\n rule.cache !== undefined ||\n rule.static !== undefined ||\n rule.isr !== undefined ||\n rule.prerender !== undefined\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,eAAsB,uBAAuB,SAIhB;CAC3B,MAAM,EAAE,QAAQ,gBAAgB,aAAa;CAE7C,IAAI,YAAwB,EAAE;CAC9B,IAAI,aAAsB,EAAE;CAC5B,IAAI,YAAqB,EAAE;CAE3B,IAAI,QACF,YAAY,MAAM,UAAU,QAAQ,eAAe;CAGrD,IAAI,UAAU;EACZ,MAAM,CAAC,OAAO,QAAQ,MAAM,QAAQ,IAAI,CACtC,YAAY,UAAU,eAAe,EACrC,UAAU,UAAU,eAAe,CACpC,CAAC;EACF,aAAa;EACb,YAAY;;CAGd,OAAO,wBAAwB,gBAAgB;EAAE;EAAW;EAAY;EAAW,CAAC,CAAC;;AAGvF,SAAgB,wBAAwB,MAAmC;CACzE,MAAM,QAAyB,EAAE;CAEjC,KAAK,MAAM,OAAO,MAChB,IACE,IAAI,SAAS,SACb,OAAO,IAAI,eAAe,YAC1B,OAAO,SAAS,IAAI,WAAW,IAC/B,IAAI,aAAa,GAEjB,MAAM,sBAAsB,IAAI,QAAQ,IAAI,EAAE,KAAK,IAAI,YAAY;CAIvE,OAAO;;;;;;;;;;;;;AAcT,SAAgB,sBAAsB,SAAyB;CAC7D,OAAO,QACJ,MAAM,IAAI,CACV,KAAK,YAAY;EAChB,IAAI,QAAQ,WAAW,IAAI,EAGzB,OAAO,QAAQ,SAAS,IAAI,IAAI,QAAQ,SAAS,IAAI,GAAG,OAAO;EAEjE,OAAO;GACP,CACD,KAAK,IAAI;;AAGd,SAAgB,qBACd,oBACA,qBAIA;CACA,MAAM,aAAa,EAAE,GAAG,oBAAoB;CAC5C,MAAM,gBAA0B,EAAE;CAElC,KAAK,MAAM,CAAC,OAAO,kBAAkB,OAAO,QAAQ,oBAAoB,EAAE;EACxE,MAAM,eAAe,WAAW;EAEhC,IAAI,gBAAgB,wBAAwB,aAAa,EAAE;GACzD,cAAc,KAAK,MAAM;GACzB;;EAGF,WAAW,SAAS;GAClB,GAAG;GACH,GAAG;GACJ;;CAGH,OAAO;EAAE;EAAY;EAAe;;AAGtC,SAAS,wBAAwB,MAAqC;CACpE,OACE,KAAK,QAAQ,KAAA,KACb,KAAK,UAAU,KAAA,KACf,KAAK,WAAW,KAAA,KAChB,KAAK,QAAQ,KAAA,KACb,KAAK,cAAc,KAAA"}
@@ -5,13 +5,24 @@ type PrecompressResult = {
5
5
  totalBrotliBytes: number;
6
6
  };
7
7
  /**
8
- * Precompress all compressible hashed assets under `clientDir/assets/`.
8
+ * Precompress all compressible hashed assets under `clientDir/<assetsDir>/`.
9
9
  *
10
10
  * Writes `.br`, `.gz`, and `.zst` files alongside each original.
11
11
  * Safe to re-run — overwrites existing compressed variants with identical
12
12
  * output, and never compresses `.br`, `.gz`, or `.zst` files themselves.
13
+ *
14
+ * `assetsDir` defaults to `"assets"` (Vite's historical default). When
15
+ * `assetPrefix` is configured the build writes assets to a different
16
+ * directory (e.g. `"cdn/_next/static"` for a path prefix, or `"_next/static"`
17
+ * for an absolute URL prefix); callers should resolve that with
18
+ * `resolveAssetsDir(assetPrefix)` and thread it through. Without this,
19
+ * `assetPrefix` builds would walk an empty `assets/` directory and emit
20
+ * zero compressed variants.
13
21
  */
14
- declare function precompressAssets(clientDir: string, onProgress?: (completed: number, total: number, file: string) => void): Promise<PrecompressResult>;
22
+ declare function precompressAssets(clientDir: string, options?: {
23
+ /** Subdirectory under `clientDir` containing hashed assets. Defaults to `"assets"`. */assetsDir?: string;
24
+ onProgress?: (completed: number, total: number, file: string) => void;
25
+ }): Promise<PrecompressResult>;
15
26
  //#endregion
16
27
  export { precompressAssets };
17
28
  //# sourceMappingURL=precompress.d.ts.map
@@ -56,14 +56,23 @@ async function* walkFiles(dir, base = dir) {
56
56
  }
57
57
  }
58
58
  /**
59
- * Precompress all compressible hashed assets under `clientDir/assets/`.
59
+ * Precompress all compressible hashed assets under `clientDir/<assetsDir>/`.
60
60
  *
61
61
  * Writes `.br`, `.gz`, and `.zst` files alongside each original.
62
62
  * Safe to re-run — overwrites existing compressed variants with identical
63
63
  * output, and never compresses `.br`, `.gz`, or `.zst` files themselves.
64
+ *
65
+ * `assetsDir` defaults to `"assets"` (Vite's historical default). When
66
+ * `assetPrefix` is configured the build writes assets to a different
67
+ * directory (e.g. `"cdn/_next/static"` for a path prefix, or `"_next/static"`
68
+ * for an absolute URL prefix); callers should resolve that with
69
+ * `resolveAssetsDir(assetPrefix)` and thread it through. Without this,
70
+ * `assetPrefix` builds would walk an empty `assets/` directory and emit
71
+ * zero compressed variants.
64
72
  */
65
- async function precompressAssets(clientDir, onProgress) {
66
- const assetsDir = path.join(clientDir, "assets");
73
+ async function precompressAssets(clientDir, options = {}) {
74
+ const { assetsDir: assetsSubdir = "assets", onProgress } = options;
75
+ const assetsDir = path.join(clientDir, assetsSubdir);
67
76
  const result = {
68
77
  filesCompressed: 0,
69
78
  totalOriginalBytes: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"precompress.js","names":[],"sources":["../../src/build/precompress.ts"],"sourcesContent":["/**\n * Build-time precompression for hashed static assets.\n *\n * Generates .br (brotli q5), .gz (gzip l8), and .zst (zstd l8) files\n * alongside compressible assets in dist/client/assets/. Served directly by\n * the production server — no per-request compression needed for immutable\n * build output.\n *\n * Only targets assets/ (hashed, immutable) — public directory files use\n * on-the-fly compression since they may change between deploys.\n */\nimport fsp from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport zlib from \"node:zlib\";\nimport { promisify } from \"node:util\";\n\nconst brotliCompress = promisify(zlib.brotliCompress);\nconst gzip = promisify(zlib.gzip);\nconst zstdCompress = typeof zlib.zstdCompress === \"function\" ? promisify(zlib.zstdCompress) : null;\n\n/** File extensions worth compressing (text-based, not already compressed). */\nconst COMPRESSIBLE_EXTENSIONS = new Set([\n \".js\",\n \".mjs\",\n \".css\",\n \".html\",\n \".json\",\n \".xml\",\n \".svg\",\n \".txt\",\n \".map\",\n \".wasm\",\n]);\n\n/** Below this size, compression overhead exceeds savings. */\nconst MIN_SIZE = 1024;\n\n/**\n * Past ~8 parallel files, mixed-size asset sets spend more time queueing zlib\n * work than making forward progress. Keep the batch size bounded even on\n * higher-core machines.\n */\nconst CONCURRENCY = Math.min(os.availableParallelism(), 8);\n\ntype PrecompressResult = {\n filesCompressed: number;\n totalOriginalBytes: number;\n /** Sum of brotli-compressed sizes (used for compression ratio reporting). */\n totalBrotliBytes: number;\n};\n\n/**\n * Walk a directory recursively, yielding relative paths for regular files.\n */\nasync function* walkFiles(dir: string, base: string = dir): AsyncGenerator<string> {\n let entries;\n try {\n entries = await fsp.readdir(dir, { withFileTypes: true });\n } catch {\n return; // directory doesn't exist\n }\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n yield* walkFiles(fullPath, base);\n } else if (entry.isFile()) {\n yield path.relative(base, fullPath);\n }\n }\n}\n\n/**\n * Precompress all compressible hashed assets under `clientDir/assets/`.\n *\n * Writes `.br`, `.gz`, and `.zst` files alongside each original.\n * Safe to re-run — overwrites existing compressed variants with identical\n * output, and never compresses `.br`, `.gz`, or `.zst` files themselves.\n */\nexport async function precompressAssets(\n clientDir: string,\n onProgress?: (completed: number, total: number, file: string) => void,\n): Promise<PrecompressResult> {\n const assetsDir = path.join(clientDir, \"assets\");\n const result: PrecompressResult = {\n filesCompressed: 0,\n totalOriginalBytes: 0,\n totalBrotliBytes: 0,\n };\n\n // Collect compressible file paths, then read + compress in bounded chunks\n // to keep peak memory at O(CONCURRENCY * max_file_size) instead of\n // O(total_assets).\n const filePaths: string[] = [];\n\n for await (const relativePath of walkFiles(assetsDir)) {\n const ext = path.extname(relativePath).toLowerCase();\n\n if (!COMPRESSIBLE_EXTENSIONS.has(ext)) continue;\n // .br/.gz/.zst are intentionally absent from COMPRESSIBLE_EXTENSIONS, so\n // precompressed variants generated by a previous run are never re-compressed.\n\n filePaths.push(path.join(assetsDir, relativePath));\n }\n\n let processed = 0;\n for (let i = 0; i < filePaths.length; i += CONCURRENCY) {\n const chunk = filePaths.slice(i, i + CONCURRENCY);\n await Promise.all(\n chunk.map(async (fullPath) => {\n const content = await fsp.readFile(fullPath);\n // readFile already done before this check — stat()-first would save\n // the read for tiny files but costs an extra syscall per file;\n // sub-1KB hashed assets are rare enough that read-first is cheaper.\n if (content.length < MIN_SIZE) return;\n\n // Compress all variants concurrently within each file\n const compressions: Promise<Buffer>[] = [\n brotliCompress(content, {\n params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 5 },\n }),\n gzip(content, { level: 8 }),\n ];\n if (zstdCompress) {\n compressions.push(\n zstdCompress(content, {\n params: { [zlib.constants.ZSTD_c_compressionLevel]: 8 },\n }),\n );\n }\n\n const results = await Promise.all(compressions);\n const [brContent, gzContent, zstdContent] = results;\n\n const writes = [\n fsp.writeFile(fullPath + \".br\", brContent),\n fsp.writeFile(fullPath + \".gz\", gzContent),\n ];\n if (zstdContent) {\n writes.push(fsp.writeFile(fullPath + \".zst\", zstdContent));\n }\n await Promise.all(writes);\n\n // Increment counters only after all writes succeed, so partial\n // failures (e.g. ENOSPC mid-write) don't inflate the reported totals.\n result.filesCompressed++;\n result.totalOriginalBytes += content.length;\n result.totalBrotliBytes += brContent.length;\n }),\n );\n // Report progress once per chunk to avoid non-deterministic ordering\n // within Promise.all (smaller files complete before larger ones).\n // Progress tracks all files (including skipped ones below MIN_SIZE),\n // which differs from filesCompressed (only files actually compressed).\n processed += chunk.length;\n onProgress?.(processed, filePaths.length, path.basename(chunk[chunk.length - 1]));\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,iBAAiB,UAAU,KAAK,eAAe;AACrD,MAAM,OAAO,UAAU,KAAK,KAAK;AACjC,MAAM,eAAe,OAAO,KAAK,iBAAiB,aAAa,UAAU,KAAK,aAAa,GAAG;;AAG9F,MAAM,0BAA0B,IAAI,IAAI;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;AAGF,MAAM,WAAW;;;;;;AAOjB,MAAM,cAAc,KAAK,IAAI,GAAG,sBAAsB,EAAE,EAAE;;;;AAY1D,gBAAgB,UAAU,KAAa,OAAe,KAA6B;CACjF,IAAI;AACJ,KAAI;AACF,YAAU,MAAM,IAAI,QAAQ,KAAK,EAAE,eAAe,MAAM,CAAC;SACnD;AACN;;AAEF,MAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,WAAW,KAAK,KAAK,KAAK,MAAM,KAAK;AAC3C,MAAI,MAAM,aAAa,CACrB,QAAO,UAAU,UAAU,KAAK;WACvB,MAAM,QAAQ,CACvB,OAAM,KAAK,SAAS,MAAM,SAAS;;;;;;;;;;AAYzC,eAAsB,kBACpB,WACA,YAC4B;CAC5B,MAAM,YAAY,KAAK,KAAK,WAAW,SAAS;CAChD,MAAM,SAA4B;EAChC,iBAAiB;EACjB,oBAAoB;EACpB,kBAAkB;EACnB;CAKD,MAAM,YAAsB,EAAE;AAE9B,YAAW,MAAM,gBAAgB,UAAU,UAAU,EAAE;EACrD,MAAM,MAAM,KAAK,QAAQ,aAAa,CAAC,aAAa;AAEpD,MAAI,CAAC,wBAAwB,IAAI,IAAI,CAAE;AAIvC,YAAU,KAAK,KAAK,KAAK,WAAW,aAAa,CAAC;;CAGpD,IAAI,YAAY;AAChB,MAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK,aAAa;EACtD,MAAM,QAAQ,UAAU,MAAM,GAAG,IAAI,YAAY;AACjD,QAAM,QAAQ,IACZ,MAAM,IAAI,OAAO,aAAa;GAC5B,MAAM,UAAU,MAAM,IAAI,SAAS,SAAS;AAI5C,OAAI,QAAQ,SAAS,SAAU;GAG/B,MAAM,eAAkC,CACtC,eAAe,SAAS,EACtB,QAAQ,GAAG,KAAK,UAAU,uBAAuB,GAAG,EACrD,CAAC,EACF,KAAK,SAAS,EAAE,OAAO,GAAG,CAAC,CAC5B;AACD,OAAI,aACF,cAAa,KACX,aAAa,SAAS,EACpB,QAAQ,GAAG,KAAK,UAAU,0BAA0B,GAAG,EACxD,CAAC,CACH;GAIH,MAAM,CAAC,WAAW,WAAW,eADb,MAAM,QAAQ,IAAI,aAAa;GAG/C,MAAM,SAAS,CACb,IAAI,UAAU,WAAW,OAAO,UAAU,EAC1C,IAAI,UAAU,WAAW,OAAO,UAAU,CAC3C;AACD,OAAI,YACF,QAAO,KAAK,IAAI,UAAU,WAAW,QAAQ,YAAY,CAAC;AAE5D,SAAM,QAAQ,IAAI,OAAO;AAIzB,UAAO;AACP,UAAO,sBAAsB,QAAQ;AACrC,UAAO,oBAAoB,UAAU;IACrC,CACH;AAKD,eAAa,MAAM;AACnB,eAAa,WAAW,UAAU,QAAQ,KAAK,SAAS,MAAM,MAAM,SAAS,GAAG,CAAC;;AAGnF,QAAO"}
1
+ {"version":3,"file":"precompress.js","names":[],"sources":["../../src/build/precompress.ts"],"sourcesContent":["/**\n * Build-time precompression for hashed static assets.\n *\n * Generates .br (brotli q5), .gz (gzip l8), and .zst (zstd l8) files\n * alongside compressible assets in dist/client/assets/. Served directly by\n * the production server — no per-request compression needed for immutable\n * build output.\n *\n * Only targets assets/ (hashed, immutable) — public directory files use\n * on-the-fly compression since they may change between deploys.\n */\nimport fsp from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport zlib from \"node:zlib\";\nimport { promisify } from \"node:util\";\n\nconst brotliCompress = promisify(zlib.brotliCompress);\nconst gzip = promisify(zlib.gzip);\nconst zstdCompress = typeof zlib.zstdCompress === \"function\" ? promisify(zlib.zstdCompress) : null;\n\n/** File extensions worth compressing (text-based, not already compressed). */\nconst COMPRESSIBLE_EXTENSIONS = new Set([\n \".js\",\n \".mjs\",\n \".css\",\n \".html\",\n \".json\",\n \".xml\",\n \".svg\",\n \".txt\",\n \".map\",\n \".wasm\",\n]);\n\n/** Below this size, compression overhead exceeds savings. */\nconst MIN_SIZE = 1024;\n\n/**\n * Past ~8 parallel files, mixed-size asset sets spend more time queueing zlib\n * work than making forward progress. Keep the batch size bounded even on\n * higher-core machines.\n */\nconst CONCURRENCY = Math.min(os.availableParallelism(), 8);\n\ntype PrecompressResult = {\n filesCompressed: number;\n totalOriginalBytes: number;\n /** Sum of brotli-compressed sizes (used for compression ratio reporting). */\n totalBrotliBytes: number;\n};\n\n/**\n * Walk a directory recursively, yielding relative paths for regular files.\n */\nasync function* walkFiles(dir: string, base: string = dir): AsyncGenerator<string> {\n let entries;\n try {\n entries = await fsp.readdir(dir, { withFileTypes: true });\n } catch {\n return; // directory doesn't exist\n }\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n yield* walkFiles(fullPath, base);\n } else if (entry.isFile()) {\n yield path.relative(base, fullPath);\n }\n }\n}\n\n/**\n * Precompress all compressible hashed assets under `clientDir/<assetsDir>/`.\n *\n * Writes `.br`, `.gz`, and `.zst` files alongside each original.\n * Safe to re-run — overwrites existing compressed variants with identical\n * output, and never compresses `.br`, `.gz`, or `.zst` files themselves.\n *\n * `assetsDir` defaults to `\"assets\"` (Vite's historical default). When\n * `assetPrefix` is configured the build writes assets to a different\n * directory (e.g. `\"cdn/_next/static\"` for a path prefix, or `\"_next/static\"`\n * for an absolute URL prefix); callers should resolve that with\n * `resolveAssetsDir(assetPrefix)` and thread it through. Without this,\n * `assetPrefix` builds would walk an empty `assets/` directory and emit\n * zero compressed variants.\n */\nexport async function precompressAssets(\n clientDir: string,\n options: {\n /** Subdirectory under `clientDir` containing hashed assets. Defaults to `\"assets\"`. */\n assetsDir?: string;\n onProgress?: (completed: number, total: number, file: string) => void;\n } = {},\n): Promise<PrecompressResult> {\n const { assetsDir: assetsSubdir = \"assets\", onProgress } = options;\n const assetsDir = path.join(clientDir, assetsSubdir);\n const result: PrecompressResult = {\n filesCompressed: 0,\n totalOriginalBytes: 0,\n totalBrotliBytes: 0,\n };\n\n // Collect compressible file paths, then read + compress in bounded chunks\n // to keep peak memory at O(CONCURRENCY * max_file_size) instead of\n // O(total_assets).\n const filePaths: string[] = [];\n\n for await (const relativePath of walkFiles(assetsDir)) {\n const ext = path.extname(relativePath).toLowerCase();\n\n if (!COMPRESSIBLE_EXTENSIONS.has(ext)) continue;\n // .br/.gz/.zst are intentionally absent from COMPRESSIBLE_EXTENSIONS, so\n // precompressed variants generated by a previous run are never re-compressed.\n\n filePaths.push(path.join(assetsDir, relativePath));\n }\n\n let processed = 0;\n for (let i = 0; i < filePaths.length; i += CONCURRENCY) {\n const chunk = filePaths.slice(i, i + CONCURRENCY);\n await Promise.all(\n chunk.map(async (fullPath) => {\n const content = await fsp.readFile(fullPath);\n // readFile already done before this check — stat()-first would save\n // the read for tiny files but costs an extra syscall per file;\n // sub-1KB hashed assets are rare enough that read-first is cheaper.\n if (content.length < MIN_SIZE) return;\n\n // Compress all variants concurrently within each file\n const compressions: Promise<Buffer>[] = [\n brotliCompress(content, {\n params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 5 },\n }),\n gzip(content, { level: 8 }),\n ];\n if (zstdCompress) {\n compressions.push(\n zstdCompress(content, {\n params: { [zlib.constants.ZSTD_c_compressionLevel]: 8 },\n }),\n );\n }\n\n const results = await Promise.all(compressions);\n const [brContent, gzContent, zstdContent] = results;\n\n const writes = [\n fsp.writeFile(fullPath + \".br\", brContent),\n fsp.writeFile(fullPath + \".gz\", gzContent),\n ];\n if (zstdContent) {\n writes.push(fsp.writeFile(fullPath + \".zst\", zstdContent));\n }\n await Promise.all(writes);\n\n // Increment counters only after all writes succeed, so partial\n // failures (e.g. ENOSPC mid-write) don't inflate the reported totals.\n result.filesCompressed++;\n result.totalOriginalBytes += content.length;\n result.totalBrotliBytes += brContent.length;\n }),\n );\n // Report progress once per chunk to avoid non-deterministic ordering\n // within Promise.all (smaller files complete before larger ones).\n // Progress tracks all files (including skipped ones below MIN_SIZE),\n // which differs from filesCompressed (only files actually compressed).\n processed += chunk.length;\n onProgress?.(processed, filePaths.length, path.basename(chunk[chunk.length - 1]));\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,iBAAiB,UAAU,KAAK,eAAe;AACrD,MAAM,OAAO,UAAU,KAAK,KAAK;AACjC,MAAM,eAAe,OAAO,KAAK,iBAAiB,aAAa,UAAU,KAAK,aAAa,GAAG;;AAG9F,MAAM,0BAA0B,IAAI,IAAI;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;AAGF,MAAM,WAAW;;;;;;AAOjB,MAAM,cAAc,KAAK,IAAI,GAAG,sBAAsB,EAAE,EAAE;;;;AAY1D,gBAAgB,UAAU,KAAa,OAAe,KAA6B;CACjF,IAAI;CACJ,IAAI;EACF,UAAU,MAAM,IAAI,QAAQ,KAAK,EAAE,eAAe,MAAM,CAAC;SACnD;EACN;;CAEF,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,WAAW,KAAK,KAAK,KAAK,MAAM,KAAK;EAC3C,IAAI,MAAM,aAAa,EACrB,OAAO,UAAU,UAAU,KAAK;OAC3B,IAAI,MAAM,QAAQ,EACvB,MAAM,KAAK,SAAS,MAAM,SAAS;;;;;;;;;;;;;;;;;;AAoBzC,eAAsB,kBACpB,WACA,UAII,EAAE,EACsB;CAC5B,MAAM,EAAE,WAAW,eAAe,UAAU,eAAe;CAC3D,MAAM,YAAY,KAAK,KAAK,WAAW,aAAa;CACpD,MAAM,SAA4B;EAChC,iBAAiB;EACjB,oBAAoB;EACpB,kBAAkB;EACnB;CAKD,MAAM,YAAsB,EAAE;CAE9B,WAAW,MAAM,gBAAgB,UAAU,UAAU,EAAE;EACrD,MAAM,MAAM,KAAK,QAAQ,aAAa,CAAC,aAAa;EAEpD,IAAI,CAAC,wBAAwB,IAAI,IAAI,EAAE;EAIvC,UAAU,KAAK,KAAK,KAAK,WAAW,aAAa,CAAC;;CAGpD,IAAI,YAAY;CAChB,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK,aAAa;EACtD,MAAM,QAAQ,UAAU,MAAM,GAAG,IAAI,YAAY;EACjD,MAAM,QAAQ,IACZ,MAAM,IAAI,OAAO,aAAa;GAC5B,MAAM,UAAU,MAAM,IAAI,SAAS,SAAS;GAI5C,IAAI,QAAQ,SAAS,UAAU;GAG/B,MAAM,eAAkC,CACtC,eAAe,SAAS,EACtB,QAAQ,GAAG,KAAK,UAAU,uBAAuB,GAAG,EACrD,CAAC,EACF,KAAK,SAAS,EAAE,OAAO,GAAG,CAAC,CAC5B;GACD,IAAI,cACF,aAAa,KACX,aAAa,SAAS,EACpB,QAAQ,GAAG,KAAK,UAAU,0BAA0B,GAAG,EACxD,CAAC,CACH;GAIH,MAAM,CAAC,WAAW,WAAW,eAAe,MADtB,QAAQ,IAAI,aAAa;GAG/C,MAAM,SAAS,CACb,IAAI,UAAU,WAAW,OAAO,UAAU,EAC1C,IAAI,UAAU,WAAW,OAAO,UAAU,CAC3C;GACD,IAAI,aACF,OAAO,KAAK,IAAI,UAAU,WAAW,QAAQ,YAAY,CAAC;GAE5D,MAAM,QAAQ,IAAI,OAAO;GAIzB,OAAO;GACP,OAAO,sBAAsB,QAAQ;GACrC,OAAO,oBAAoB,UAAU;IACrC,CACH;EAKD,aAAa,MAAM;EACnB,aAAa,WAAW,UAAU,QAAQ,KAAK,SAAS,MAAM,MAAM,SAAS,GAAG,CAAC;;CAGnF,OAAO"}
@@ -107,6 +107,22 @@ type PrerenderAppOptionsInternal = PrerenderAppOptions & {
107
107
  port: number;
108
108
  };
109
109
  };
110
+ /**
111
+ * Reconstruct the RSC payload from a prerender HTML response by parsing the
112
+ * inline bootstrap chunk scripts emitted by createRscEmbedTransform.
113
+ *
114
+ * Returns null when the HTML contains no chunk scripts at all — the caller
115
+ * should fall back to a second handler invocation. This is reachable when
116
+ * middleware short-circuits the App Router pipeline with a custom 200 HTML
117
+ * response that never went through createRscEmbedTransform.
118
+ *
119
+ * Throws on partial or malformed embeds (chunks present but no done marker,
120
+ * tampered chunk JSON, etc.) — those are real vinext-internal regressions.
121
+ *
122
+ * Safe regex usage: safeJsonStringify (used by createRscEmbedTransform) escapes
123
+ * all '<' and '>' in the embedded JSON, preventing false </script> matches.
124
+ */
125
+ declare function extractRscPayloadFromPrerenderedHtml(html: string): Uint8Array | null;
110
126
  /**
111
127
  * Determine the HTML output file path for a URL.
112
128
  * Respects trailingSlash config.
@@ -189,5 +205,5 @@ declare function writePrerenderIndex(routes: PrerenderRouteResult[], outDir: str
189
205
  trailingSlash?: boolean;
190
206
  }): void;
191
207
  //#endregion
192
- export { PrerenderResult, PrerenderRouteResult, StaticParamsMap, getOutputPath, getRscOutputPath, prerenderApp, prerenderPages, readPrerenderSecret, resolveParentParams, writePrerenderIndex };
208
+ export { PrerenderResult, PrerenderRouteResult, StaticParamsMap, extractRscPayloadFromPrerenderedHtml, getOutputPath, getRscOutputPath, prerenderApp, prerenderPages, readPrerenderSecret, resolveParentParams, writePrerenderIndex };
193
209
  //# sourceMappingURL=prerender.d.ts.map
@@ -1,7 +1,10 @@
1
1
  import { createValidFileMatcher, findFileWithExtensions } from "../routing/file-matcher.js";
2
+ import { VINEXT_PRERENDER_SECRET_HEADER } from "../server/headers.js";
3
+ import { normalizeStaticPathsEntry } from "../routing/route-pattern.js";
2
4
  import { headersContextFromRequest, runWithHeadersContext } from "../shims/headers.js";
3
5
  import { NoOpCacheHandler, _consumeRequestScopedCacheLife, getCacheHandler, setCacheHandler } from "../shims/cache.js";
4
6
  import { classifyAppRoute, classifyPagesRoute, getAppRouteRenderEntryPath } from "./report.js";
7
+ import { concatUint8Arrays, decodeRscEmbeddedChunk } from "../server/app-rsc-embedded-chunks.js";
5
8
  import { readPrerenderSecret } from "./server-manifest.js";
6
9
  import { startProdServer } from "../server/prod-server.js";
7
10
  import fs from "node:fs";
@@ -31,6 +34,62 @@ function getErrorMessageWithStack(err) {
31
34
  /** Sentinel path used to trigger 404 rendering without a real route match. */
32
35
  const NOT_FOUND_SENTINEL_PATH = "/__vinext_nonexistent_for_404__";
33
36
  const DEFAULT_CONCURRENCY = Math.min(os.availableParallelism(), 8);
37
+ const RSC_CHUNK_SCRIPT_PREFIX = "self.__VINEXT_RSC_CHUNKS__=self.__VINEXT_RSC_CHUNKS__||[];";
38
+ const RSC_DONE_MARKER = "__VINEXT_RSC_DONE__=true";
39
+ const RSC_CHUNK_FULL_PREFIX = `${RSC_CHUNK_SCRIPT_PREFIX}self.__VINEXT_RSC_CHUNKS__.push(`;
40
+ /**
41
+ * Reconstruct the RSC payload from a prerender HTML response by parsing the
42
+ * inline bootstrap chunk scripts emitted by createRscEmbedTransform.
43
+ *
44
+ * Returns null when the HTML contains no chunk scripts at all — the caller
45
+ * should fall back to a second handler invocation. This is reachable when
46
+ * middleware short-circuits the App Router pipeline with a custom 200 HTML
47
+ * response that never went through createRscEmbedTransform.
48
+ *
49
+ * Throws on partial or malformed embeds (chunks present but no done marker,
50
+ * tampered chunk JSON, etc.) — those are real vinext-internal regressions.
51
+ *
52
+ * Safe regex usage: safeJsonStringify (used by createRscEmbedTransform) escapes
53
+ * all '<' and '>' in the embedded JSON, preventing false <\/script> matches.
54
+ */
55
+ function extractRscPayloadFromPrerenderedHtml(html) {
56
+ const scriptPattern = /<script(?:\s[^>]*)?>([\s\S]*?)<\/script>/gi;
57
+ const chunks = [];
58
+ let sawDone = false;
59
+ let match;
60
+ while ((match = scriptPattern.exec(html)) !== null) {
61
+ const script = (match[1] ?? "").trim().replace(/;$/, "");
62
+ if (script === `self.${RSC_DONE_MARKER}`) {
63
+ sawDone = true;
64
+ continue;
65
+ }
66
+ if (script.startsWith(RSC_CHUNK_SCRIPT_PREFIX)) chunks.push(decodeRscEmbeddedChunk(parseRscChunkPushArgument(script)));
67
+ }
68
+ if (chunks.length === 0 && !sawDone) return null;
69
+ if (chunks.length === 0) throw new Error("[vinext] Malformed prerender RSC embed: done marker present without chunk scripts");
70
+ if (!sawDone) throw new Error("[vinext] Malformed prerender RSC embed: missing __VINEXT_RSC_DONE__ marker");
71
+ return concatUint8Arrays(chunks);
72
+ }
73
+ /**
74
+ * Parse the JSON argument of a single chunk-push script. The script
75
+ * shape is exactly `<prefix>(<safeJsonStringify(chunk)>)` because the writer
76
+ * concatenates those literals — so the body always starts with the full
77
+ * prefix and ends with `)`. JSON.parse on the slice catches any tampering or
78
+ * trailing code.
79
+ */
80
+ function parseRscChunkPushArgument(script) {
81
+ if (!script.startsWith(RSC_CHUNK_FULL_PREFIX) || !script.endsWith(")")) throw new Error("[vinext] Malformed prerender RSC embed: unexpected chunk script shape");
82
+ const jsonSource = script.slice(RSC_CHUNK_FULL_PREFIX.length, -1);
83
+ let parsed;
84
+ try {
85
+ parsed = JSON.parse(jsonSource);
86
+ } catch {
87
+ throw new Error("[vinext] Malformed prerender RSC embed: invalid chunk JSON");
88
+ }
89
+ if (typeof parsed === "string") return parsed;
90
+ if (Array.isArray(parsed) && parsed.length === 2 && parsed[0] === 3 && typeof parsed[1] === "string") return [parsed[0], parsed[1]];
91
+ throw new Error("[vinext] Malformed prerender RSC embed: unsupported chunk payload");
92
+ }
34
93
  /**
35
94
  * Run an array of async tasks with bounded concurrency.
36
95
  * Results are returned in the same order as `items`.
@@ -53,8 +112,14 @@ async function runWithConcurrency(items, concurrency, fn) {
53
112
  * Build a URL path from a route pattern and params.
54
113
  * "/posts/:id" + { id: "42" } → "/posts/42"
55
114
  * "/docs/:slug+" + { slug: ["a", "b"] } → "/docs/a/b"
115
+ *
116
+ * Throws a descriptive error rather than a cryptic `Cannot read properties of
117
+ * undefined` if `params` itself is missing or required keys are absent — the
118
+ * caller (prerenderPages / prerenderApp) catches this and surfaces it as a
119
+ * per-route error result.
56
120
  */
57
121
  function buildUrlFromParams(pattern, params) {
122
+ if (params === void 0 || params === null) throw new Error(`[vinext] buildUrlFromParams: params is ${params === null ? "null" : "undefined"} for pattern "${pattern}". Check that getStaticPaths / generateStaticParams returned an object with a "params" key, or pass a string path (see https://nextjs.org/docs/pages/api-reference/functions/get-static-paths).`);
58
123
  const parts = pattern.split("/").filter(Boolean);
59
124
  const result = [];
60
125
  for (const part of parts) if (part.endsWith("+") || part.endsWith("*")) {
@@ -167,7 +232,7 @@ async function prerenderPages({ routes, apiRoutes, pagesDir, outDir, config, mod
167
232
  ownedProdServerHandle = srv;
168
233
  return srv;
169
234
  })()).port}`;
170
- const secretHeaders = prerenderSecret ? { "x-vinext-prerender-secret": prerenderSecret } : {};
235
+ const secretHeaders = prerenderSecret ? { [VINEXT_PRERENDER_SECRET_HEADER]: prerenderSecret } : {};
171
236
  const renderPage = (urlPath) => fetch(`${baseUrl}${urlPath}`, {
172
237
  headers: secretHeaders,
173
238
  redirect: "manual"
@@ -244,14 +309,34 @@ async function prerenderPages({ routes, apiRoutes, pagesDir, outDir, config, mod
244
309
  continue;
245
310
  }
246
311
  const paths = pathsResult?.paths ?? [];
247
- for (const { params } of paths) {
248
- const urlPath = buildUrlFromParams(route.pattern, params);
249
- pagesToRender.push({
250
- route,
251
- urlPath,
252
- params,
253
- revalidate
312
+ let entryError = null;
313
+ for (const item of paths) {
314
+ const normalized = normalizeStaticPathsEntry(item, route.pattern);
315
+ if ("error" in normalized) {
316
+ entryError = normalized.error;
317
+ break;
318
+ }
319
+ const { params } = normalized;
320
+ try {
321
+ const urlPath = buildUrlFromParams(route.pattern, params);
322
+ pagesToRender.push({
323
+ route,
324
+ urlPath,
325
+ params,
326
+ revalidate
327
+ });
328
+ } catch (e) {
329
+ entryError = e.message;
330
+ break;
331
+ }
332
+ }
333
+ if (entryError) {
334
+ results.push({
335
+ route: route.pattern,
336
+ status: "error",
337
+ error: entryError
254
338
  });
339
+ continue;
255
340
  }
256
341
  } else pagesToRender.push({
257
342
  route,
@@ -379,7 +464,7 @@ async function prerenderApp({ routes, outDir, config, mode, rscBundlePath, ...op
379
464
  ownedProdServerHandle = srv;
380
465
  return srv;
381
466
  })()).port}`;
382
- const secretHeaders = prerenderSecret ? { "x-vinext-prerender-secret": prerenderSecret } : {};
467
+ const secretHeaders = prerenderSecret ? { [VINEXT_PRERENDER_SECRET_HEADER]: prerenderSecret } : {};
383
468
  rscHandler = (req) => {
384
469
  const parsed = new URL(req.url);
385
470
  const url = `${baseUrl}${parsed.pathname}${parsed.search}`;
@@ -509,6 +594,7 @@ async function prerenderApp({ routes, outDir, config, mode, rscBundlePath, ...op
509
594
  continue;
510
595
  }
511
596
  for (const params of paramSets) {
597
+ if (params === null || params === void 0) throw new Error(`generateStaticParams() for ${route.pattern} returned an entry with no params object.`);
512
598
  const urlPath = buildUrlFromParams(route.pattern, params);
513
599
  urlsToRender.push({
514
600
  urlPath,
@@ -595,25 +681,30 @@ async function prerenderApp({ routes, outDir, config, mode, rscBundlePath, ...op
595
681
  error: "RSC handler returned no prerender HTML"
596
682
  };
597
683
  const html = htmlRender.html;
598
- const rscRequest = new Request(`http://localhost${urlPath}`, { headers: {
599
- Accept: "text/x-component",
600
- RSC: "1"
601
- } });
602
- const rscRes = await runWithHeadersContext(headersContextFromRequest(rscRequest), () => rscHandler(rscRequest));
603
- const rscData = rscRes.ok ? await rscRes.text() : null;
684
+ let rscData = extractRscPayloadFromPrerenderedHtml(html);
685
+ if (rscData === null) {
686
+ const rscRequest = new Request(`http://localhost${urlPath}`, { headers: {
687
+ Accept: "text/x-component",
688
+ RSC: "1"
689
+ } });
690
+ const rscRes = await runWithHeadersContext(headersContextFromRequest(rscRequest), () => rscHandler(rscRequest));
691
+ if (!rscRes.ok) {
692
+ await rscRes.body?.cancel();
693
+ throw new Error(`[vinext] prerenderApp: RSC fallback returned ${rscRes.status} for ${urlPath}`);
694
+ }
695
+ rscData = new Uint8Array(await rscRes.arrayBuffer());
696
+ }
604
697
  const outputFiles = [];
605
698
  const htmlOutputPath = getOutputPath(urlPath, config.trailingSlash);
606
699
  const htmlFullPath = path.join(outDir, htmlOutputPath);
607
700
  fs.mkdirSync(path.dirname(htmlFullPath), { recursive: true });
608
701
  fs.writeFileSync(htmlFullPath, html, "utf-8");
609
702
  outputFiles.push(htmlOutputPath);
610
- if (rscData !== null) {
611
- const rscOutputPath = getRscOutputPath(urlPath);
612
- const rscFullPath = path.join(outDir, rscOutputPath);
613
- fs.mkdirSync(path.dirname(rscFullPath), { recursive: true });
614
- fs.writeFileSync(rscFullPath, rscData, "utf-8");
615
- outputFiles.push(rscOutputPath);
616
- }
703
+ const rscOutputPath = getRscOutputPath(urlPath);
704
+ const rscFullPath = path.join(outDir, rscOutputPath);
705
+ fs.mkdirSync(path.dirname(rscFullPath), { recursive: true });
706
+ fs.writeFileSync(rscFullPath, rscData);
707
+ outputFiles.push(rscOutputPath);
617
708
  const renderedCacheControl = resolveRenderedCacheControl(htmlRender.requestCacheLife ?? {}, htmlCacheControl, config.expireTime);
618
709
  const renderedRevalidate = typeof revalidate === "number" ? renderedCacheControl.revalidate === void 0 ? revalidate : Math.min(revalidate, renderedCacheControl.revalidate) : renderedCacheControl.revalidate ?? revalidate;
619
710
  return {
@@ -755,6 +846,6 @@ function writePrerenderIndex(routes, outDir, options) {
755
846
  fs.writeFileSync(path.join(outDir, "vinext-prerender.json"), JSON.stringify(index, null, 2), "utf-8");
756
847
  }
757
848
  //#endregion
758
- export { getOutputPath, getRscOutputPath, prerenderApp, prerenderPages, readPrerenderSecret, resolveParentParams, writePrerenderIndex };
849
+ export { extractRscPayloadFromPrerenderedHtml, getOutputPath, getRscOutputPath, prerenderApp, prerenderPages, readPrerenderSecret, resolveParentParams, writePrerenderIndex };
759
850
 
760
851
  //# sourceMappingURL=prerender.js.map