vinext 1.3.0 → 1.4.0

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 (529) hide show
  1. package/README.md +5 -2
  2. package/THIRD_PARTY_LICENSES.md +47 -0
  3. package/dist/_virtual/_rolldown/runtime.js +4 -3
  4. package/dist/build/action-owner-manifest.d.ts +3 -2
  5. package/dist/build/action-owner-manifest.js +18 -2
  6. package/dist/build/app-page-static-eligibility.d.ts +17 -1
  7. package/dist/build/app-page-static-eligibility.js +80 -13
  8. package/dist/build/clean-output.d.ts +2 -1
  9. package/dist/build/client-build-config.d.ts +13 -3
  10. package/dist/build/client-build-config.js +46 -9
  11. package/dist/build/client-reference-async.d.ts +48 -0
  12. package/dist/build/client-reference-async.js +123 -0
  13. package/dist/build/client-reference-chunks.d.ts +32 -0
  14. package/dist/build/client-reference-chunks.js +111 -0
  15. package/dist/build/client-reference-groups.d.ts +9 -1
  16. package/dist/build/client-reference-groups.js +40 -2
  17. package/dist/build/css-url-assets.d.ts +2 -1
  18. package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
  19. package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
  20. package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
  21. package/dist/build/google-fonts/font-metadata.d.ts +2 -1
  22. package/dist/build/google-fonts/validate.d.ts +2 -1
  23. package/dist/build/inline-css.d.ts +2 -1
  24. package/dist/build/module-dependency-cache.d.ts +2 -1
  25. package/dist/build/next-client-runtime-manifests.d.ts +2 -1
  26. package/dist/build/precompress.d.ts +2 -1
  27. package/dist/build/precompress.js +1 -1
  28. package/dist/build/prerender-paths.d.ts +2 -1
  29. package/dist/build/prerender-phase.d.ts +2 -1
  30. package/dist/build/prerender-server-pool.js +1 -1
  31. package/dist/build/prerender.d.ts +3 -2
  32. package/dist/build/prerender.js +6 -5
  33. package/dist/build/report.d.ts +2 -15
  34. package/dist/build/report.js +1 -51
  35. package/dist/build/run-prerender.d.ts +2 -1
  36. package/dist/build/server-actions-encryption-key.d.ts +2 -1
  37. package/dist/build/ssr-manifest.js +25 -2
  38. package/dist/build/standalone.d.ts +2 -1
  39. package/dist/cache/cache-adapters-virtual.d.ts +2 -1
  40. package/dist/cache.js +1 -2
  41. package/dist/check.d.ts +2 -1
  42. package/dist/check.js +5 -1
  43. package/dist/cli-args.d.ts +2 -1
  44. package/dist/cli.js +5 -0
  45. package/dist/client/client-redirect-matcher.js +2 -1
  46. package/dist/client/client-redirects.d.ts +4 -3
  47. package/dist/client/client-redirects.js +2 -1
  48. package/dist/client/client-rewrites.d.ts +2 -1
  49. package/dist/client/dev-error-overlay-store.d.ts +2 -1
  50. package/dist/client/dev-error-overlay.js +1 -1
  51. package/dist/client/index.js +1 -2
  52. package/dist/client/instrumentation-client-state.js +5 -5
  53. package/dist/client/navigation-runtime.d.ts +16 -2
  54. package/dist/client/navigation-runtime.js +2 -2
  55. package/dist/client/pages-router-link-navigation.d.ts +2 -1
  56. package/dist/client/vinext-next-data.d.ts +25 -1
  57. package/dist/client/window-next.d.ts +2 -1
  58. package/dist/config/config-matchers.d.ts +12 -1
  59. package/dist/config/config-matchers.js +111 -16
  60. package/dist/config/dotenv.d.ts +2 -1
  61. package/dist/config/next-config.d.ts +32 -1
  62. package/dist/config/next-config.js +93 -5
  63. package/dist/config/tsconfig-paths.d.ts +2 -1
  64. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
  65. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
  66. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
  67. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
  68. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
  69. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
  70. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
  71. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
  72. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
  73. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
  74. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
  75. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
  76. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
  77. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
  78. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
  79. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
  80. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
  81. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
  82. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
  83. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
  84. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
  85. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
  86. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
  87. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
  88. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
  89. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
  90. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
  91. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
  92. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
  93. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
  94. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
  95. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
  96. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
  97. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
  98. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
  99. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
  100. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
  101. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
  102. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
  103. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
  104. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
  105. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
  106. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
  107. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
  108. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
  109. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
  110. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
  111. package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
  112. package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
  113. package/dist/entries/app-browser-entry.d.ts +20 -5
  114. package/dist/entries/app-browser-entry.js +79 -6
  115. package/dist/entries/app-rsc-entry.d.ts +2 -1
  116. package/dist/entries/app-rsc-entry.js +59 -60
  117. package/dist/entries/app-rsc-manifest.d.ts +2 -1
  118. package/dist/entries/app-rsc-manifest.js +56 -4
  119. package/dist/entries/app-ssr-entry.js +1 -0
  120. package/dist/entries/pages-entry-helpers.js +1 -2
  121. package/dist/entries/pages-server-entry.d.ts +2 -1
  122. package/dist/entries/pages-server-entry.js +34 -9
  123. package/dist/entries/runtime-entry-module.d.ts +1 -0
  124. package/dist/entries/runtime-entry-module.js +4 -1
  125. package/dist/image/image-adapters-virtual.d.ts +2 -1
  126. package/dist/index.js +184 -103
  127. package/dist/init-cloudflare.d.ts +1 -3
  128. package/dist/init-cloudflare.js +10 -48
  129. package/dist/init-platform.d.ts +2 -0
  130. package/dist/init-platform.js +4 -0
  131. package/dist/plugins/client-compile-hints.d.ts +30 -0
  132. package/dist/plugins/client-compile-hints.js +88 -0
  133. package/dist/plugins/client-reference-dedup.d.ts +2 -1
  134. package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
  135. package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
  136. package/dist/plugins/dynamic-preload-metadata.js +1 -1
  137. package/dist/plugins/environment.d.ts +2 -1
  138. package/dist/plugins/extensionless-dynamic-import.js +6 -2
  139. package/dist/plugins/fonts.js +9 -12
  140. package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
  141. package/dist/plugins/import-meta-url.d.ts +2 -1
  142. package/dist/plugins/next-intl-catalog.d.ts +12 -0
  143. package/dist/plugins/next-intl-catalog.js +85 -0
  144. package/dist/plugins/og-assets.d.ts +2 -1
  145. package/dist/plugins/og-assets.js +2 -3
  146. package/dist/plugins/optimize-imports.d.ts +2 -1
  147. package/dist/plugins/pages-node-externals.d.ts +3 -1
  148. package/dist/plugins/pages-node-externals.js +1 -1
  149. package/dist/plugins/remove-console.d.ts +2 -1
  150. package/dist/plugins/require-condition-resolution.d.ts +2 -1
  151. package/dist/plugins/rsc-client-reference-loaders.d.ts +8 -0
  152. package/dist/plugins/rsc-client-reference-loaders.js +170 -68
  153. package/dist/plugins/rsc-client-shim-excludes.js +2 -0
  154. package/dist/plugins/sass.d.ts +2 -1
  155. package/dist/plugins/strip-server-exports.d.ts +2 -1
  156. package/dist/plugins/styled-jsx.d.ts +2 -1
  157. package/dist/plugins/transform-result.d.ts +2 -1
  158. package/dist/plugins/typeof-window.d.ts +2 -1
  159. package/dist/plugins/use-cache-callable.d.ts +1 -1
  160. package/dist/plugins/use-cache-callable.js +136 -94
  161. package/dist/plugins/worker-image-imports.js +1 -1
  162. package/dist/plugins/worker-use-server.d.ts +2 -1
  163. package/dist/routing/app-route-graph.d.ts +46 -0
  164. package/dist/routing/app-route-graph.js +131 -51
  165. package/dist/routing/browser-route-manifest.d.ts +2 -1
  166. package/dist/routing/optimistic-route-trie.d.ts +2 -1
  167. package/dist/routing/route-matching.d.ts +2 -1
  168. package/dist/routing/route-pattern.d.ts +2 -1
  169. package/dist/server/accept-encoding.d.ts +2 -1
  170. package/dist/server/api-handler.js +19 -4
  171. package/dist/server/app-action-forwarding.d.ts +2 -1
  172. package/dist/server/app-bfcache-identity.d.ts +2 -1
  173. package/dist/server/app-bfcache-identity.js +1 -1
  174. package/dist/server/app-browser-action-result.d.ts +2 -1
  175. package/dist/server/app-browser-entry.js +106 -66
  176. package/dist/server/app-browser-error.d.ts +2 -1
  177. package/dist/server/app-browser-history-controller.d.ts +7 -5
  178. package/dist/server/app-browser-history-controller.js +93 -15
  179. package/dist/server/app-browser-hydration.d.ts +2 -1
  180. package/dist/server/app-browser-interception-context.d.ts +2 -1
  181. package/dist/server/app-browser-navigation-controller.d.ts +2 -2
  182. package/dist/server/app-browser-navigation-controller.js +16 -12
  183. package/dist/server/app-browser-popstate.d.ts +2 -1
  184. package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
  185. package/dist/server/app-browser-rsc-redirect.js +4 -4
  186. package/dist/server/app-browser-server-action-client.d.ts +4 -1
  187. package/dist/server/app-browser-server-action-client.js +4 -3
  188. package/dist/server/app-browser-state.d.ts +2 -4
  189. package/dist/server/app-browser-state.js +9 -4
  190. package/dist/server/app-browser-stream.d.ts +2 -1
  191. package/dist/server/app-browser-supplemental-refresh.js +16 -1
  192. package/dist/server/app-browser-visible-commit.d.ts +3 -2
  193. package/dist/server/app-browser-visible-commit.js +2 -12
  194. package/dist/server/app-client-reference-manifest.d.ts +31 -0
  195. package/dist/server/app-client-reference-manifest.js +46 -0
  196. package/dist/server/app-client-reference-preloader.d.ts +25 -5
  197. package/dist/server/app-client-reference-preloader.js +22 -7
  198. package/dist/server/app-elements-wire.d.ts +8 -39
  199. package/dist/server/app-elements-wire.js +4 -41
  200. package/dist/server/app-elements.d.ts +4 -2
  201. package/dist/server/app-elements.js +4 -2
  202. package/dist/server/app-fallback-renderer.d.ts +9 -2
  203. package/dist/server/app-fallback-renderer.js +4 -1
  204. package/dist/server/app-history-state.d.ts +4 -3
  205. package/dist/server/app-history-state.js +5 -2
  206. package/dist/server/app-inline-css-client.d.ts +2 -1
  207. package/dist/server/app-metadata-tracing.d.ts +2 -1
  208. package/dist/server/app-mounted-layouts.d.ts +21 -0
  209. package/dist/server/app-mounted-layouts.js +67 -0
  210. package/dist/server/app-optimistic-routing.d.ts +37 -2
  211. package/dist/server/app-optimistic-routing.js +75 -2
  212. package/dist/server/app-page-boundary-render.d.ts +20 -2
  213. package/dist/server/app-page-boundary-render.js +224 -40
  214. package/dist/server/app-page-boundary.d.ts +34 -5
  215. package/dist/server/app-page-boundary.js +41 -8
  216. package/dist/server/app-page-cache-finalizer.d.ts +14 -2
  217. package/dist/server/app-page-cache-finalizer.js +71 -30
  218. package/dist/server/app-page-cache-render.d.ts +10 -2
  219. package/dist/server/app-page-cache-render.js +14 -2
  220. package/dist/server/app-page-cache.d.ts +13 -1
  221. package/dist/server/app-page-cache.js +33 -11
  222. package/dist/server/app-page-dispatch.d.ts +39 -11
  223. package/dist/server/app-page-dispatch.js +236 -177
  224. package/dist/server/app-page-element-builder.d.ts +19 -3
  225. package/dist/server/app-page-element-builder.js +193 -71
  226. package/dist/server/app-page-execution.d.ts +43 -51
  227. package/dist/server/app-page-execution.js +205 -92
  228. package/dist/server/app-page-head.d.ts +108 -3
  229. package/dist/server/app-page-head.js +337 -154
  230. package/dist/server/app-page-http-access-fallback-metadata.d.ts +49 -2
  231. package/dist/server/app-page-http-access-fallback-metadata.js +77 -2
  232. package/dist/server/app-page-layout-gate.d.ts +35 -0
  233. package/dist/server/app-page-layout-gate.js +50 -0
  234. package/dist/server/app-page-method.d.ts +2 -1
  235. package/dist/server/app-page-params.d.ts +0 -1
  236. package/dist/server/app-page-params.js +1 -14
  237. package/dist/server/app-page-probe.d.ts +5 -22
  238. package/dist/server/app-page-probe.js +4 -37
  239. package/dist/server/app-page-render-identity.d.ts +2 -1
  240. package/dist/server/app-page-render.d.ts +9 -13
  241. package/dist/server/app-page-render.js +108 -214
  242. package/dist/server/app-page-request.d.ts +15 -4
  243. package/dist/server/app-page-request.js +2 -2
  244. package/dist/server/app-page-response.js +3 -3
  245. package/dist/server/app-page-route-wiring.d.ts +65 -8
  246. package/dist/server/app-page-route-wiring.js +259 -103
  247. package/dist/server/app-page-rsc-render-status.d.ts +29 -2
  248. package/dist/server/app-page-rsc-render-status.js +121 -13
  249. package/dist/server/app-page-search-params-observation.d.ts +7 -2
  250. package/dist/server/app-page-search-params-observation.js +8 -1
  251. package/dist/server/app-page-segment-plan.d.ts +2 -1
  252. package/dist/server/app-page-stream.d.ts +33 -1
  253. package/dist/server/app-page-stream.js +25 -6
  254. package/dist/server/app-pages-bridge.d.ts +6 -1
  255. package/dist/server/app-pages-bridge.js +7 -3
  256. package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
  257. package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
  258. package/dist/server/app-prerender-endpoints.d.ts +2 -1
  259. package/dist/server/app-prerender-static-params.d.ts +2 -1
  260. package/dist/server/app-render-dependency.d.ts +21 -4
  261. package/dist/server/app-render-dependency.js +100 -33
  262. package/dist/server/app-request-stage-dispatch.js +1 -1
  263. package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
  264. package/dist/server/app-response-stage-entry.d.ts +2 -1
  265. package/dist/server/app-route-handler-cache.d.ts +2 -1
  266. package/dist/server/app-route-handler-cache.js +2 -2
  267. package/dist/server/app-route-handler-dispatch.d.ts +2 -1
  268. package/dist/server/app-route-handler-dispatch.js +15 -10
  269. package/dist/server/app-route-handler-execution.d.ts +2 -1
  270. package/dist/server/app-route-handler-execution.js +8 -3
  271. package/dist/server/app-route-handler-policy.d.ts +1 -1
  272. package/dist/server/app-route-handler-policy.js +3 -3
  273. package/dist/server/app-route-handler-response.d.ts +2 -1
  274. package/dist/server/app-route-handler-response.js +1 -1
  275. package/dist/server/app-route-handler-runtime.d.ts +2 -1
  276. package/dist/server/app-route-handler-runtime.js +17 -4
  277. package/dist/server/app-route-module-loader.d.ts +18 -1
  278. package/dist/server/app-route-module-loader.js +8 -0
  279. package/dist/server/app-route-tree-prefetch.d.ts +2 -1
  280. package/dist/server/app-rsc-cache-busting.d.ts +2 -2
  281. package/dist/server/app-rsc-cache-busting.js +4 -4
  282. package/dist/server/app-rsc-error-handler.d.ts +4 -2
  283. package/dist/server/app-rsc-error-handler.js +9 -1
  284. package/dist/server/app-rsc-errors.d.ts +10 -1
  285. package/dist/server/app-rsc-errors.js +8 -1
  286. package/dist/server/app-rsc-handler.d.ts +7 -6
  287. package/dist/server/app-rsc-handler.js +36 -34
  288. package/dist/server/app-rsc-request-normalization.d.ts +0 -4
  289. package/dist/server/app-rsc-request-normalization.js +1 -4
  290. package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
  291. package/dist/server/app-rsc-response-finalizer.js +2 -2
  292. package/dist/server/app-rsc-response-stage.js +5 -3
  293. package/dist/server/app-rsc-route-matching.d.ts +38 -1
  294. package/dist/server/app-rsc-route-matching.js +24 -0
  295. package/dist/server/app-segment-config.d.ts +2 -1
  296. package/dist/server/app-segment-config.js +1 -14
  297. package/dist/server/app-server-action-execution.d.ts +5 -2
  298. package/dist/server/app-server-action-execution.js +10 -7
  299. package/dist/server/app-ssr-entry.d.ts +8 -0
  300. package/dist/server/app-ssr-entry.js +98 -50
  301. package/dist/server/app-ssr-error-meta.d.ts +2 -1
  302. package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
  303. package/dist/server/app-ssr-stream.d.ts +22 -10
  304. package/dist/server/app-ssr-stream.js +300 -68
  305. package/dist/server/app-static-generation.d.ts +2 -1
  306. package/dist/server/app-streamed-client-references.d.ts +39 -0
  307. package/dist/server/app-streamed-client-references.js +156 -0
  308. package/dist/server/app-visited-response-cache.d.ts +38 -2
  309. package/dist/server/app-visited-response-cache.js +46 -5
  310. package/dist/server/app-worker-stages.d.ts +27 -4
  311. package/dist/server/app-worker-stages.js +45 -6
  312. package/dist/server/artifact-compatibility.d.ts +2 -2
  313. package/dist/server/artifact-compatibility.js +1 -10
  314. package/dist/server/bfcache-identity.d.ts +2 -1
  315. package/dist/server/cache-headers.d.ts +2 -1
  316. package/dist/server/cache-proof.d.ts +1 -115
  317. package/dist/server/cache-proof.js +1 -544
  318. package/dist/server/cacheability-request.d.ts +2 -1
  319. package/dist/server/cacheability-request.js +13 -8
  320. package/dist/server/config-headers.d.ts +2 -1
  321. package/dist/server/csp.d.ts +2 -1
  322. package/dist/server/default-global-not-found-module.d.ts +2 -1
  323. package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
  324. package/dist/server/default-http-access-fallback-modules.js +31 -0
  325. package/dist/server/defer-until-stream-consumed.d.ts +34 -0
  326. package/dist/server/defer-until-stream-consumed.js +154 -21
  327. package/dist/server/dev-lockfile.d.ts +32 -2
  328. package/dist/server/dev-lockfile.js +46 -2
  329. package/dist/server/dev-module-runner.d.ts +2 -1
  330. package/dist/server/dev-server.js +14 -6
  331. package/dist/server/fetch-handler.js +1 -2
  332. package/dist/server/file-based-metadata.d.ts +2 -1
  333. package/dist/server/framework-tracer.d.ts +2 -1
  334. package/dist/server/headers.d.ts +6 -3
  335. package/dist/server/headers.js +9 -5
  336. package/dist/server/html.d.ts +1 -0
  337. package/dist/server/html.js +19 -1
  338. package/dist/server/http-conditional.d.ts +2 -1
  339. package/dist/server/http-error-responses.d.ts +2 -1
  340. package/dist/server/implicit-tags.d.ts +2 -1
  341. package/dist/server/isr-cache.d.ts +8 -2
  342. package/dist/server/isr-cache.js +26 -1
  343. package/dist/server/metadata-route-build-data.d.ts +2 -1
  344. package/dist/server/metadata-route-build-data.js +1 -1
  345. package/dist/server/metadata-route-response.d.ts +2 -1
  346. package/dist/server/metadata-route-response.js +32 -15
  347. package/dist/server/metadata-routes.d.ts +2 -1
  348. package/dist/server/middleware-runtime.d.ts +2 -1
  349. package/dist/server/multi-stage.d.ts +52 -11
  350. package/dist/server/multi-stage.js +13 -1
  351. package/dist/server/navigation-planner.js +1 -1
  352. package/dist/server/navigation-trace.d.ts +2 -1
  353. package/dist/server/next-error-digest.d.ts +2 -1
  354. package/dist/server/nitro-public-files-plugin.d.ts +2 -1
  355. package/dist/server/nitro-public-files.d.ts +2 -1
  356. package/dist/server/opentelemetry-api.d.ts +2 -1
  357. package/dist/server/operation-token.d.ts +2 -1
  358. package/dist/server/pages-api-route.d.ts +2 -1
  359. package/dist/server/pages-api-route.js +28 -19
  360. package/dist/server/pages-asset-tags.d.ts +2 -1
  361. package/dist/server/pages-body-parser-config.d.ts +2 -1
  362. package/dist/server/pages-client-assets.d.ts +4 -0
  363. package/dist/server/pages-data-route.d.ts +2 -1
  364. package/dist/server/pages-document-asset-props.d.ts +2 -1
  365. package/dist/server/pages-document-initial-props.d.ts +2 -1
  366. package/dist/server/pages-execution-tracing.d.ts +2 -1
  367. package/dist/server/pages-execution-tracing.js +1 -1
  368. package/dist/server/pages-get-initial-props.d.ts +2 -1
  369. package/dist/server/pages-media-type.d.ts +21 -1
  370. package/dist/server/pages-media-type.js +69 -5
  371. package/dist/server/pages-node-compat.js +52 -27
  372. package/dist/server/pages-page-data.d.ts +7 -1
  373. package/dist/server/pages-page-data.js +35 -12
  374. package/dist/server/pages-page-handler.d.ts +3 -2
  375. package/dist/server/pages-page-handler.js +27 -27
  376. package/dist/server/pages-page-method.d.ts +2 -1
  377. package/dist/server/pages-page-response.d.ts +2 -1
  378. package/dist/server/pages-preview.d.ts +2 -1
  379. package/dist/server/pages-readiness.d.ts +2 -1
  380. package/dist/server/pages-request-pipeline.d.ts +10 -1
  381. package/dist/server/pages-request-pipeline.js +6 -7
  382. package/dist/server/pages-request-stage-entry.d.ts +2 -1
  383. package/dist/server/pages-request-stage-entry.js +14 -12
  384. package/dist/server/pages-response-stage-entry.d.ts +2 -1
  385. package/dist/server/pages-response-stage-entry.js +9 -3
  386. package/dist/server/pages-route-data-kind.d.ts +2 -1
  387. package/dist/server/prerender-cache-life-header.d.ts +2 -1
  388. package/dist/server/prerender-route-params.d.ts +2 -1
  389. package/dist/server/prod-server.js +14 -4
  390. package/dist/server/request-log.d.ts +2 -1
  391. package/dist/server/request-pipeline.d.ts +6 -0
  392. package/dist/server/request-pipeline.js +21 -1
  393. package/dist/server/request-tracing.d.ts +2 -1
  394. package/dist/server/request-tracing.js +1 -1
  395. package/dist/server/response-start-tracing.js +7 -29
  396. package/dist/server/rsc-render-stream.d.ts +4 -0
  397. package/dist/server/rsc-render-stream.js +25 -0
  398. package/dist/server/seed-cache.d.ts +2 -1
  399. package/dist/server/seed-cache.js +1 -1
  400. package/dist/server/shared-cache-identity.d.ts +23 -0
  401. package/dist/server/shared-cache-identity.js +36 -0
  402. package/dist/server/static-file-cache.d.ts +2 -1
  403. package/dist/server/static-file-cache.js +1 -0
  404. package/dist/server/worker-revalidation-context.d.ts +2 -1
  405. package/dist/server/worker-stages.d.ts +18 -4
  406. package/dist/server/worker-stages.js +23 -4
  407. package/dist/shims/app.d.ts +2 -1
  408. package/dist/shims/cache-callable-runtime.d.ts +2 -1
  409. package/dist/shims/cache-handler.d.ts +8 -3
  410. package/dist/shims/cache-handler.js +31 -11
  411. package/dist/shims/cache-request-state.d.ts +17 -20
  412. package/dist/shims/cache-request-state.js +16 -21
  413. package/dist/shims/cache-runtime.js +27 -11
  414. package/dist/shims/cache.d.ts +8 -7
  415. package/dist/shims/cache.js +17 -19
  416. package/dist/shims/cacheability-classification.d.ts +2 -0
  417. package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
  418. package/dist/shims/caught-not-found-boundaries.js +48 -0
  419. package/dist/shims/cdn-cache.d.ts +22 -5
  420. package/dist/shims/cdn-purge-routes.d.ts +2 -1
  421. package/dist/shims/client-locale.js +2 -1
  422. package/dist/shims/client-page-root.d.ts +2 -1
  423. package/dist/shims/client-page-root.js +2 -2
  424. package/dist/shims/config.d.ts +2 -1
  425. package/dist/shims/default-forbidden.d.ts +4 -0
  426. package/dist/shims/default-forbidden.js +18 -0
  427. package/dist/shims/default-not-found.d.ts +0 -5
  428. package/dist/shims/default-not-found.js +5 -41
  429. package/dist/shims/default-unauthorized.d.ts +4 -0
  430. package/dist/shims/default-unauthorized.js +18 -0
  431. package/dist/shims/dynamic.js +9 -6
  432. package/dist/shims/error-boundary.d.ts +39 -3
  433. package/dist/shims/error-boundary.js +33 -18
  434. package/dist/shims/fetch-cache-state.d.ts +5 -1
  435. package/dist/shims/fetch-cache-state.js +1 -3
  436. package/dist/shims/fetch-cache.d.ts +2 -1
  437. package/dist/shims/fetch-cache.js +34 -24
  438. package/dist/shims/font-google.js +1 -2
  439. package/dist/shims/font-utils.d.ts +3 -2
  440. package/dist/shims/font-utils.js +5 -3
  441. package/dist/shims/form.js +3 -3
  442. package/dist/shims/headers.d.ts +8 -23
  443. package/dist/shims/headers.js +17 -67
  444. package/dist/shims/http-access-error-fallback.d.ts +7 -0
  445. package/dist/shims/http-access-error-fallback.js +47 -0
  446. package/dist/shims/image.d.ts +1 -22
  447. package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
  448. package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
  449. package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
  450. package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
  451. package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
  452. package/dist/shims/internal/client-reference-loader.d.ts +7 -0
  453. package/dist/shims/internal/client-reference-loader.js +91 -0
  454. package/dist/shims/internal/cookie-serialize.d.ts +2 -1
  455. package/dist/shims/internal/cookies.js +1 -2
  456. package/dist/shims/internal/headers-state.d.ts +2 -0
  457. package/dist/shims/internal/headers-state.js +6 -1
  458. package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +2 -1
  459. package/dist/shims/internal/interpolate-as.d.ts +2 -1
  460. package/dist/shims/internal/navigation-untracked.js +1 -1
  461. package/dist/shims/internal/pages-data-target.d.ts +2 -1
  462. package/dist/shims/internal/pages-data-url.d.ts +2 -1
  463. package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
  464. package/dist/shims/link.js +197 -52
  465. package/dist/shims/metadata.d.ts +52 -29
  466. package/dist/shims/metadata.js +142 -42
  467. package/dist/shims/navigation-errors.d.ts +2 -1
  468. package/dist/shims/navigation-server.js +1 -1
  469. package/dist/shims/navigation.d.ts +95 -8
  470. package/dist/shims/navigation.js +255 -47
  471. package/dist/shims/navigation.react-server.js +2 -2
  472. package/dist/shims/pages-router-runtime.d.ts +2 -1
  473. package/dist/shims/ppr-fallback-shell.d.ts +2 -1
  474. package/dist/shims/request-state-types.d.ts +2 -2
  475. package/dist/shims/router.js +14 -3
  476. package/dist/shims/slot.d.ts +12 -0
  477. package/dist/shims/slot.js +37 -9
  478. package/dist/shims/unified-request-context.d.ts +1 -1
  479. package/dist/shims/unified-request-context.js +5 -6
  480. package/dist/typegen.d.ts +2 -1
  481. package/dist/utils/cache-control-metadata.d.ts +5 -0
  482. package/dist/utils/cache-control-metadata.js +9 -1
  483. package/dist/utils/client-build-manifest.d.ts +4 -1
  484. package/dist/utils/client-build-manifest.js +9 -2
  485. package/dist/utils/client-entry-manifest.d.ts +13 -0
  486. package/dist/utils/client-entry-manifest.js +20 -1
  487. package/dist/utils/client-reference-chunks.d.ts +45 -0
  488. package/dist/utils/client-reference-chunks.js +30 -0
  489. package/dist/utils/client-runtime-metadata.d.ts +9 -1
  490. package/dist/utils/client-runtime-metadata.js +40 -9
  491. package/dist/utils/compare.d.ts +9 -0
  492. package/dist/utils/compare.js +15 -1
  493. package/dist/utils/lazy-chunks.d.ts +14 -0
  494. package/dist/utils/lazy-chunks.js +27 -1
  495. package/dist/utils/middleware-request-headers.d.ts +2 -1
  496. package/dist/utils/project.d.ts +4 -3
  497. package/dist/utils/project.js +12 -17
  498. package/dist/utils/query.d.ts +2 -1
  499. package/dist/utils/regex.d.ts +5 -0
  500. package/dist/utils/regex.js +11 -1
  501. package/dist/utils/text-stream.d.ts +10 -5
  502. package/dist/utils/text-stream.js +6 -6
  503. package/dist/utils/vite-cli-invocation.d.ts +2 -1
  504. package/package.json +6 -5
  505. package/dist/build/layout-classification-types.d.ts +0 -60
  506. package/dist/build/layout-classification-types.js +0 -1
  507. package/dist/build/layout-classification.d.ts +0 -61
  508. package/dist/build/layout-classification.js +0 -98
  509. package/dist/build/route-classification-injector.d.ts +0 -32
  510. package/dist/build/route-classification-injector.js +0 -59
  511. package/dist/build/route-classification-manifest.d.ts +0 -53
  512. package/dist/build/route-classification-manifest.js +0 -143
  513. package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
  514. package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -10
  515. package/dist/server/app-browser-client-reuse-manifest.js +0 -101
  516. package/dist/server/app-layout-param-observation.d.ts +0 -41
  517. package/dist/server/app-layout-param-observation.js +0 -168
  518. package/dist/server/client-reuse-manifest.d.ts +0 -102
  519. package/dist/server/client-reuse-manifest.js +0 -209
  520. package/dist/server/default-not-found-module.d.ts +0 -19
  521. package/dist/server/default-not-found-module.js +0 -18
  522. package/dist/server/rsc-stream-hints.d.ts +0 -21
  523. package/dist/server/rsc-stream-hints.js +0 -227
  524. package/dist/server/skip-cache-proof.d.ts +0 -60
  525. package/dist/server/skip-cache-proof.js +0 -168
  526. package/dist/server/static-layout-client-reuse-proof.d.ts +0 -13
  527. package/dist/server/static-layout-client-reuse-proof.js +0 -33
  528. package/dist/utils/sorted-array.d.ts +0 -7
  529. package/dist/utils/sorted-array.js +0 -20
@@ -196,7 +196,7 @@ function findViteConfigPath(root) {
196
196
  function formatMissingCloudflarePluginError(options) {
197
197
  const cfArg = options.isAppRouter ? "{\n viteEnvironment: { name: \"rsc\", childEnvironments: [\"ssr\"] },\n }" : "";
198
198
  const configRef = options.configFile ? options.configFile : "your Vite config";
199
- return `[vinext] Missing @cloudflare/vite-plugin in ${configRef}.\n\n Cloudflare Workers builds require the cloudflare() plugin.\n Run \`vinext init --platform=cloudflare\` to update ${configRef}.\n\n Expected plugin shape:\n\n cloudflare(${cfArg})`;
199
+ return `[vinext] Missing @cloudflare/vite-plugin in ${configRef}.\n\n Cloudflare Workers builds require the cloudflare() plugin.\n ${options.initUpdatesConfig === false ? `Add it to ${configRef}.` : `Run \`vinext init --platform=cloudflare\` to update ${configRef}.`}\n\n Expected plugin shape:\n\n cloudflare(${cfArg})`;
200
200
  }
201
201
  /** Check whether a wrangler config file exists in the given directory. */
202
202
  function hasWranglerConfig(root) {
@@ -251,12 +251,10 @@ function detectProject(root) {
251
251
  }
252
252
  }
253
253
  hasISR = hasISR || detectCacheComponents(root);
254
- const allDeps = {
254
+ const hasCodeHike = "codehike" in {
255
255
  ...pkg?.dependencies,
256
256
  ...pkg?.devDependencies
257
257
  };
258
- const hasCodeHike = "codehike" in allDeps;
259
- const nativeModulesToStub = detectNativeModules(allDeps);
260
258
  return {
261
259
  root,
262
260
  isAppRouter,
@@ -271,8 +269,7 @@ function detectProject(root) {
271
269
  hasISR,
272
270
  hasTypeModule,
273
271
  hasMDX,
274
- hasCodeHike,
275
- nativeModulesToStub
272
+ hasCodeHike
276
273
  };
277
274
  }
278
275
  const ISR_PATTERN = /export\s+(?:const\s+revalidate\s*=|(?:async\s+)?function\s+getStaticProps\b|const\s+getStaticProps\s*=|\{[^}]*\bgetStaticProps\b[^}]*\})/;
@@ -333,6 +330,14 @@ function detectMDXFromConfig(root) {
333
330
  }
334
331
  return false;
335
332
  }
333
+ /**
334
+ * Next.js copies a set legacy `experimental.cacheComponents` over the
335
+ * top-level key (warnOptionHasBeenMovedOutOfExperimental).
336
+ */
337
+ function configEnablesCacheComponents(content) {
338
+ if (/\bexperimental\s*:\s*\{[^}]*\bcacheComponents\s*:\s*false\b/.test(content)) return false;
339
+ return /\bcacheComponents\s*:\s*true\b/.test(content);
340
+ }
336
341
  function detectCacheComponents(root) {
337
342
  for (const fileName of [
338
343
  "next.config.ts",
@@ -344,21 +349,11 @@ function detectCacheComponents(root) {
344
349
  const configPath = path.join(root, fileName);
345
350
  if (!fs.existsSync(configPath)) continue;
346
351
  try {
347
- if (/\bcacheComponents\s*:\s*true\b/.test(fs.readFileSync(configPath, "utf-8"))) return true;
352
+ if (configEnablesCacheComponents(fs.readFileSync(configPath, "utf-8"))) return true;
348
353
  } catch {}
349
354
  }
350
355
  return false;
351
356
  }
352
- const NATIVE_MODULES_TO_STUB = [
353
- "@resvg/resvg-js",
354
- "satori",
355
- "lightningcss",
356
- "@napi-rs/canvas",
357
- "sharp"
358
- ];
359
- function detectNativeModules(allDeps) {
360
- return NATIVE_MODULES_TO_STUB.filter((mod) => mod in allDeps);
361
- }
362
357
  /**
363
358
  * Check if a package is resolvable from a given root directory using Node's
364
359
  * module resolution. Handles hoisting, pnpm symlinks, monorepos, and Yarn PnP.
@@ -51,4 +51,5 @@ export declare function mergeRewriteQuery(originalUrl: string, rewriteUrl: strin
51
51
  * and fragment identifier.
52
52
  */
53
53
  export declare function appendSearchParamsToUrl(url: string, params: Iterable<[string, string]>): string;
54
- //#endregion
54
+ //#endregion
55
+ export {};
@@ -1,3 +1,8 @@
1
1
  //#region src/utils/regex.d.ts
2
2
  export declare function escapeRegExp(value: string): string;
3
+ /**
4
+ * Return the literal a RegExp matches when it is just `^literal$` (as built
5
+ * from `escapeRegExp`), or null for any other pattern.
6
+ */
7
+ export declare function exactRegExpLiteral(pattern: RegExp): string | null;
3
8
  //#endregion
@@ -2,5 +2,15 @@
2
2
  function escapeRegExp(value) {
3
3
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4
4
  }
5
+ const EXACT_REGEXP_SOURCE_RE = /^\^((?:\\[.*+?^${}()|[\]\\/]|[^.*+?^${}()|[\]\\])*)\$$/;
6
+ /**
7
+ * Return the literal a RegExp matches when it is just `^literal$` (as built
8
+ * from `escapeRegExp`), or null for any other pattern.
9
+ */
10
+ function exactRegExpLiteral(pattern) {
11
+ if (pattern.flags !== "") return null;
12
+ const body = EXACT_REGEXP_SOURCE_RE.exec(pattern.source)?.[1];
13
+ return body === void 0 ? null : body.replace(/\\(.)/g, "$1");
14
+ }
5
15
  //#endregion
6
- export { escapeRegExp };
16
+ export { escapeRegExp, exactRegExpLiteral };
@@ -15,13 +15,18 @@
15
15
  */
16
16
  export declare function readStreamAsText(stream: ReadableStream<Uint8Array>): Promise<string>;
17
17
  /**
18
- * Drain a UTF-8 byte stream up to `maxBytes` of *raw* input, returning the
19
- * decoded text. If the raw size limit is exceeded, cancellation is signalled
20
- * and `onLimitExceeded` is invoked; it MUST throw — its return type is
21
- * `never` to enforce that. Each caller passes its own error type.
18
+ * Drain a byte stream up to `maxBytes` of *raw* input, returning the decoded
19
+ * text (UTF-8 unless the caller passes its own `decoder`). If the raw size
20
+ * limit is exceeded, cancellation is signalled and `onLimitExceeded` is
21
+ * invoked; it MUST throw — its return type is `never` to enforce that. Each
22
+ * caller passes its own error type.
22
23
  *
23
24
  * The size check is on raw bytes (pre-decode) to bound memory before
24
25
  * paying the decoder cost.
25
26
  */
26
- export declare function readStreamAsTextWithLimit(stream: ReadableStream<Uint8Array>, maxBytes: number, onLimitExceeded: () => never): Promise<string>;
27
+ export declare function readStreamAsTextWithLimit(stream: ReadableStream<Uint8Array>, maxBytes: number, onLimitExceeded: () => never, decoder?: {
28
+ decode(input?: Uint8Array, options?: {
29
+ stream?: boolean;
30
+ }): string;
31
+ }): Promise<string>;
27
32
  //#endregion
@@ -30,17 +30,17 @@ async function readStreamAsText(stream) {
30
30
  }
31
31
  }
32
32
  /**
33
- * Drain a UTF-8 byte stream up to `maxBytes` of *raw* input, returning the
34
- * decoded text. If the raw size limit is exceeded, cancellation is signalled
35
- * and `onLimitExceeded` is invoked; it MUST throw — its return type is
36
- * `never` to enforce that. Each caller passes its own error type.
33
+ * Drain a byte stream up to `maxBytes` of *raw* input, returning the decoded
34
+ * text (UTF-8 unless the caller passes its own `decoder`). If the raw size
35
+ * limit is exceeded, cancellation is signalled and `onLimitExceeded` is
36
+ * invoked; it MUST throw — its return type is `never` to enforce that. Each
37
+ * caller passes its own error type.
37
38
  *
38
39
  * The size check is on raw bytes (pre-decode) to bound memory before
39
40
  * paying the decoder cost.
40
41
  */
41
- async function readStreamAsTextWithLimit(stream, maxBytes, onLimitExceeded) {
42
+ async function readStreamAsTextWithLimit(stream, maxBytes, onLimitExceeded, decoder = new TextDecoder()) {
42
43
  const reader = stream.getReader();
43
- const decoder = new TextDecoder();
44
44
  const chunks = [];
45
45
  let totalSize = 0;
46
46
  try {
@@ -18,4 +18,5 @@ export declare function getViteCliInvocation(argv?: string[]): Invocation | unde
18
18
  export declare function isViteCliConfigFile(configFile: string, inlineConfig?: Pick<InlineConfig, "root" | "configFile">): boolean;
19
19
  export declare function isViteCliInvocation(command: Command, argv?: string[]): boolean;
20
20
  export declare function claimViteCliBuildInvocation(argv?: string[]): boolean;
21
- //#endregion
21
+ //#endregion
22
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vinext",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Run Next.js apps on Vite. Drop-in replacement for the next CLI.",
5
5
  "homepage": "https://vinext.dev/",
6
6
  "license": "MIT",
@@ -230,7 +230,7 @@
230
230
  "magic-string": "^0.30.21",
231
231
  "vite-plugin-commonjs": "^0.10.4",
232
232
  "web-vitals": "^4.2.4",
233
- "@vinext/types": "^1.0.1"
233
+ "@vinext/types": "^1.0.2"
234
234
  },
235
235
  "devDependencies": {
236
236
  "@types/node": "^25.9.2",
@@ -240,13 +240,14 @@
240
240
  "@vitejs/plugin-react": "^6.1.0",
241
241
  "@vitejs/plugin-rsc": "^0.5.38",
242
242
  "am-i-vibing": "^0.5.0",
243
+ "iconv-lite": "0.4.24",
243
244
  "ignore": "5.3.2",
244
- "image-size": "2.0.2",
245
+ "image-size": "2.0.4",
245
246
  "pathslash": "^0.1.0",
246
247
  "react-server-dom-webpack": "^19.3.1",
247
248
  "ua-parser-js": "1.0.35",
248
- "vite": "npm:@voidzero-dev/vite-plus-core@1.1.0",
249
- "vite-plus": "1.1.0"
249
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
250
+ "vite-plus": "1.3.0"
250
251
  },
251
252
  "peerDependencies": {
252
253
  "@mdx-js/rollup": "^3.0.0",
@@ -1,60 +0,0 @@
1
- //#region src/build/layout-classification-types.d.ts
2
- /**
3
- * Shared types for the layout classification pipeline.
4
- *
5
- * Kept in a leaf module so both `report.ts` (which implements segment-config
6
- * classification) and `layout-classification.ts` (which composes the full
7
- * pipeline) can import them without forming a cycle.
8
- *
9
- * The wire contract between build and runtime is intentionally narrow: the
10
- * runtime only cares about the `"static" | "dynamic"` decision for a layout.
11
- * Reasons live in a sidecar structure so operators can trace how each
12
- * decision was made without bloating the hot-path payload.
13
- */
14
- /**
15
- * Structured record of which classifier layer produced a decision and what
16
- * evidence it used. Kept as a discriminated union so each layer can carry
17
- * its own diagnostic shape without the consumer having to fall back to
18
- * stringly-typed `reason` fields.
19
- */
20
- export type ClassificationReason = {
21
- layer: "segment-config";
22
- key: "dynamic" | "revalidate";
23
- value: string | number;
24
- } | {
25
- layer: "module-graph";
26
- result: "static" | "needs-probe";
27
- firstShimMatch?: string;
28
- } | {
29
- layer: "runtime-probe";
30
- outcome: "static" | "dynamic";
31
- error?: string;
32
- } | {
33
- layer: "no-classifier";
34
- };
35
- export type ModuleGraphStaticReason = {
36
- layer: "module-graph";
37
- result: "static";
38
- firstShimMatch?: string;
39
- };
40
- /**
41
- * Build-time classification outcome for a single layout. Tagged with `kind`
42
- * so callers can branch exhaustively and carry diagnostic reasons alongside
43
- * the decision.
44
- *
45
- * `absent` means no classifier layer had anything to say — the caller should
46
- * defer to the next layer (or to the runtime probe).
47
- */
48
- export type LayoutBuildClassification = {
49
- kind: "absent";
50
- } | {
51
- kind: "static";
52
- reason: ClassificationReason;
53
- } | {
54
- kind: "dynamic";
55
- reason: ClassificationReason;
56
- } | {
57
- kind: "needs-probe";
58
- reason: ClassificationReason;
59
- };
60
- //#endregion
@@ -1 +0,0 @@
1
- export {};
@@ -1,61 +0,0 @@
1
- import { ClassificationReason, LayoutBuildClassification, ModuleGraphStaticReason } from "./layout-classification-types.js";
2
- //#region src/build/layout-classification.d.ts
3
- type ModuleGraphClassification = "static" | "needs-probe";
4
- type ModuleGraphClassificationResult = {
5
- result: ModuleGraphClassification;
6
- /** First dynamic shim module ID encountered during BFS, when any. */
7
- firstShimMatch?: string;
8
- };
9
- export type ModuleInfoProvider = {
10
- getModuleInfo(id: string): {
11
- importedIds: string[];
12
- dynamicImportedIds: string[];
13
- } | null;
14
- };
15
- type LayoutEntry = {
16
- /** Rollup/Vite module ID for the layout file. */
17
- moduleId: string;
18
- /** Directory depth from the app root, used to build the stable layout ID. */
19
- treePosition: number;
20
- /** Segment config source code extracted at build time, or null when absent. */
21
- segmentConfig?: {
22
- code: string;
23
- } | null;
24
- };
25
- type RouteForClassification = {
26
- layouts: readonly LayoutEntry[];
27
- routeSegments: string[];
28
- };
29
- /**
30
- * BFS traversal of a layout's dependency tree. If any transitive import
31
- * resolves to a dynamic shim path (headers, cache, server), the layout
32
- * cannot be proven static at build time and needs a runtime probe.
33
- *
34
- * The returned object carries the classification plus the first matching
35
- * shim module ID (when any). Operators use the shim ID via the debug
36
- * channel to trace why a layout was flagged for probing.
37
- */
38
- export declare function classifyLayoutByModuleGraph(layoutModuleId: string, dynamicShimPaths: ReadonlySet<string>, moduleInfo: ModuleInfoProvider): ModuleGraphClassificationResult;
39
- export declare function moduleGraphReason(graphResult: ModuleGraphClassificationResult & {
40
- result: "static";
41
- }): ModuleGraphStaticReason;
42
- export declare function moduleGraphReason(graphResult: ModuleGraphClassificationResult): ClassificationReason;
43
- export declare function isStaticModuleGraphResult(graphResult: ModuleGraphClassificationResult): graphResult is ModuleGraphClassificationResult & {
44
- result: "static";
45
- };
46
- /**
47
- * Classifies all layouts across all routes using a two-layer strategy:
48
- *
49
- * 1. Segment config (Layer 1) — short-circuits to "static" or "dynamic"
50
- * 2. Module graph (Layer 2) — BFS for dynamic shim imports → "static" or "needs-probe"
51
- *
52
- * Shared layouts (same file appearing in multiple routes) are classified once
53
- * and deduplicated by layout ID.
54
- *
55
- * @internal Not called by production code. The `renderChunk` hook in
56
- * `index.ts` calls `classifyLayoutByModuleGraph` directly and composes
57
- * via the numeric-index manifest in `route-classification-manifest.ts`.
58
- * Used only by `tests/layout-classification.test.ts`.
59
- */
60
- export declare function classifyAllRouteLayouts(routes: readonly RouteForClassification[], dynamicShimPaths: ReadonlySet<string>, moduleInfo: ModuleInfoProvider): Map<string, LayoutBuildClassification>;
61
- //#endregion
@@ -1,98 +0,0 @@
1
- import { classifyLayoutSegmentConfig } from "./report.js";
2
- import { AppElementsWire } from "../server/app-elements-wire.js";
3
- import "../server/app-elements.js";
4
- import { createAppPageTreePath } from "../server/app-page-route-wiring.js";
5
- //#region src/build/layout-classification.ts
6
- /**
7
- * Layout classification — determines whether each layout in an App Router
8
- * route tree is static or dynamic via two complementary detection layers:
9
- *
10
- * Layer 1: Segment config (`export const dynamic`, `export const revalidate`)
11
- * Layer 2: Module graph traversal (checks for transitive dynamic shim imports)
12
- *
13
- * Layer 3 (probe-based runtime detection) is handled separately in
14
- * `app-page-execution.ts` at request time.
15
- *
16
- * Every result is carried as a `LayoutBuildClassification` tagged variant so
17
- * operators can trace which layer produced a decision via the structured
18
- * `ClassificationReason` sidecar without that metadata leaking onto the wire.
19
- */
20
- /**
21
- * BFS traversal of a layout's dependency tree. If any transitive import
22
- * resolves to a dynamic shim path (headers, cache, server), the layout
23
- * cannot be proven static at build time and needs a runtime probe.
24
- *
25
- * The returned object carries the classification plus the first matching
26
- * shim module ID (when any). Operators use the shim ID via the debug
27
- * channel to trace why a layout was flagged for probing.
28
- */
29
- function classifyLayoutByModuleGraph(layoutModuleId, dynamicShimPaths, moduleInfo) {
30
- const visited = /* @__PURE__ */ new Set();
31
- const queue = [layoutModuleId];
32
- let head = 0;
33
- while (head < queue.length) {
34
- const currentId = queue[head++];
35
- if (visited.has(currentId)) continue;
36
- visited.add(currentId);
37
- if (dynamicShimPaths.has(currentId)) return {
38
- result: "needs-probe",
39
- firstShimMatch: currentId
40
- };
41
- const info = moduleInfo.getModuleInfo(currentId);
42
- if (!info) continue;
43
- for (const importedId of info.importedIds) if (!visited.has(importedId)) queue.push(importedId);
44
- for (const dynamicId of info.dynamicImportedIds) if (!visited.has(dynamicId)) queue.push(dynamicId);
45
- }
46
- return { result: "static" };
47
- }
48
- function moduleGraphReason(graphResult) {
49
- if (graphResult.firstShimMatch === void 0) return {
50
- layer: "module-graph",
51
- result: graphResult.result
52
- };
53
- return {
54
- layer: "module-graph",
55
- result: graphResult.result,
56
- firstShimMatch: graphResult.firstShimMatch
57
- };
58
- }
59
- function isStaticModuleGraphResult(graphResult) {
60
- return graphResult.result === "static";
61
- }
62
- /**
63
- * Classifies all layouts across all routes using a two-layer strategy:
64
- *
65
- * 1. Segment config (Layer 1) — short-circuits to "static" or "dynamic"
66
- * 2. Module graph (Layer 2) — BFS for dynamic shim imports → "static" or "needs-probe"
67
- *
68
- * Shared layouts (same file appearing in multiple routes) are classified once
69
- * and deduplicated by layout ID.
70
- *
71
- * @internal Not called by production code. The `renderChunk` hook in
72
- * `index.ts` calls `classifyLayoutByModuleGraph` directly and composes
73
- * via the numeric-index manifest in `route-classification-manifest.ts`.
74
- * Used only by `tests/layout-classification.test.ts`.
75
- */
76
- function classifyAllRouteLayouts(routes, dynamicShimPaths, moduleInfo) {
77
- const result = /* @__PURE__ */ new Map();
78
- for (const route of routes) for (const layout of route.layouts) {
79
- const layoutId = AppElementsWire.encodeLayoutId(createAppPageTreePath(route.routeSegments, layout.treePosition));
80
- if (result.has(layoutId)) continue;
81
- if (layout.segmentConfig) {
82
- const configResult = classifyLayoutSegmentConfig(layout.segmentConfig.code);
83
- if (configResult.kind !== "absent") {
84
- result.set(layoutId, configResult);
85
- continue;
86
- }
87
- }
88
- const graphResult = classifyLayoutByModuleGraph(layout.moduleId, dynamicShimPaths, moduleInfo);
89
- const reason = moduleGraphReason(graphResult);
90
- result.set(layoutId, {
91
- kind: graphResult.result,
92
- reason
93
- });
94
- }
95
- return result;
96
- }
97
- //#endregion
98
- export { classifyAllRouteLayouts, classifyLayoutByModuleGraph, isStaticModuleGraphResult, moduleGraphReason };
@@ -1,32 +0,0 @@
1
- import { ModuleInfoProvider } from "./layout-classification.js";
2
- import { RouteClassificationManifest } from "./route-classification-manifest.js";
3
- //#region src/build/route-classification-injector.d.ts
4
- /**
5
- * Build-time route classification injection.
6
- *
7
- * Codegen describes route shape by emitting stable `__VINEXT_CLASS` stubs and
8
- * per-route call sites. This module owns the behavioral side of replacing
9
- * those stubs with build-time decisions once the final RSC module graph exists.
10
- */
11
- type RouteClassificationChunk = {
12
- code: string;
13
- fileName: string;
14
- };
15
- type RouteClassificationInjectionPlan = {
16
- kind: "skip";
17
- } | {
18
- code: string;
19
- fileName: string;
20
- kind: "patch";
21
- map: null;
22
- };
23
- type PlanRouteClassificationInjectionOptions = {
24
- canonicalizeLayoutPath?: (path: string) => string;
25
- chunks: readonly RouteClassificationChunk[];
26
- dynamicShimPaths: ReadonlySet<string>;
27
- enableDebugReasons: boolean;
28
- manifest: RouteClassificationManifest;
29
- moduleInfo: ModuleInfoProvider;
30
- };
31
- export declare function planRouteClassificationInjection(options: PlanRouteClassificationInjectionOptions): RouteClassificationInjectionPlan;
32
- //#endregion
@@ -1,59 +0,0 @@
1
- import { buildClassificationReplacement, buildReasonsReplacement } from "./route-classification-manifest.js";
2
- import { classifyLayoutByModuleGraph, isStaticModuleGraphResult, moduleGraphReason } from "./layout-classification.js";
3
- //#region src/build/route-classification-injector.ts
4
- const CLASS_STUB_RE = /function __VINEXT_CLASS\(routeIdx\)\s*\{\s*return null;?\s*\}/;
5
- const REASONS_STUB_RE = /function __VINEXT_CLASS_REASONS\(routeIdx\)\s*\{\s*return null;?\s*\}/;
6
- function identityPath(path) {
7
- return path;
8
- }
9
- function findClassificationChunk(chunks) {
10
- const chunksMentioningStub = chunks.filter((chunk) => chunk.code.includes("__VINEXT_CLASS"));
11
- const chunksWithStubBody = chunksMentioningStub.filter((chunk) => CLASS_STUB_RE.test(chunk.code));
12
- const chunkWithStubBody = chunksWithStubBody[0];
13
- if (chunksMentioningStub.length === 0) return null;
14
- if (chunkWithStubBody === void 0) throw new Error(`vinext: build-time classification — __VINEXT_CLASS is referenced in ${chunksMentioningStub.map((chunk) => chunk.fileName).join(", ")} but no chunk contains the stub body. The generator and the classification injector have drifted.`);
15
- if (chunksWithStubBody.length > 1) throw new Error(`vinext: build-time classification — expected __VINEXT_CLASS stub in exactly one RSC chunk, found ${chunksWithStubBody.length}`);
16
- return chunkWithStubBody;
17
- }
18
- function buildLayer2Classifications(options) {
19
- const canonicalizeLayoutPath = options.canonicalizeLayoutPath ?? identityPath;
20
- const layer2PerRoute = /* @__PURE__ */ new Map();
21
- const graphCache = /* @__PURE__ */ new Map();
22
- for (let routeIdx = 0; routeIdx < options.manifest.routes.length; routeIdx++) {
23
- const route = options.manifest.routes[routeIdx];
24
- const perRoute = /* @__PURE__ */ new Map();
25
- for (let layoutIdx = 0; layoutIdx < route.layoutPaths.length; layoutIdx++) {
26
- if (route.layer1.has(layoutIdx)) continue;
27
- const layoutModuleId = canonicalizeLayoutPath(route.layoutPaths[layoutIdx]);
28
- if (!options.moduleInfo.getModuleInfo(layoutModuleId)) continue;
29
- let graphResult = graphCache.get(layoutModuleId);
30
- if (graphResult === void 0) {
31
- graphResult = classifyLayoutByModuleGraph(layoutModuleId, options.dynamicShimPaths, options.moduleInfo);
32
- graphCache.set(layoutModuleId, graphResult);
33
- }
34
- if (isStaticModuleGraphResult(graphResult)) perRoute.set(layoutIdx, moduleGraphReason(graphResult));
35
- }
36
- if (perRoute.size > 0) layer2PerRoute.set(routeIdx, perRoute);
37
- }
38
- return layer2PerRoute;
39
- }
40
- function planRouteClassificationInjection(options) {
41
- const target = findClassificationChunk(options.chunks);
42
- if (!target) return { kind: "skip" };
43
- if (options.enableDebugReasons && !REASONS_STUB_RE.test(target.code)) throw new Error("vinext: build-time classification — __VINEXT_CLASS_REASONS stub is missing alongside __VINEXT_CLASS. The generator and the classification injector have drifted.");
44
- const layer2PerRoute = buildLayer2Classifications(options);
45
- const patchedBody = `function __VINEXT_CLASS(routeIdx) { return (${buildClassificationReplacement(options.manifest, layer2PerRoute)})(routeIdx); }`;
46
- let code = target.code.replace(CLASS_STUB_RE, patchedBody);
47
- if (options.enableDebugReasons) {
48
- const patchedReasonsBody = `function __VINEXT_CLASS_REASONS(routeIdx) { return (${buildReasonsReplacement(options.manifest, layer2PerRoute)})(routeIdx); }`;
49
- code = code.replace(REASONS_STUB_RE, patchedReasonsBody);
50
- }
51
- return {
52
- code,
53
- fileName: target.fileName,
54
- kind: "patch",
55
- map: null
56
- };
57
- }
58
- //#endregion
59
- export { planRouteClassificationInjection };
@@ -1,53 +0,0 @@
1
- import { AppRoute } from "../routing/app-route-graph.js";
2
- import { ClassificationReason, ModuleGraphStaticReason } from "./layout-classification-types.js";
3
- //#region src/build/route-classification-manifest.d.ts
4
- type Layer1Class = "static" | "dynamic";
5
- type RouteManifestEntry = {
6
- /** Route pattern for diagnostics (e.g. "/blog/:slug"). */
7
- pattern: string;
8
- /** Absolute file paths for each layout, ordered root → leaf. */
9
- layoutPaths: string[];
10
- /** Layer 1 (segment config) results keyed by numeric layout index. */
11
- layer1: Map<number, Layer1Class>;
12
- /**
13
- * Structured reasons for every Layer 1 decision, keyed by the same layout
14
- * index. Always populated in lockstep with `layer1` so the debug channel
15
- * can surface which segment-config field produced the decision.
16
- */
17
- layer1Reasons: Map<number, ClassificationReason>;
18
- };
19
- export type RouteClassificationManifest = {
20
- routes: RouteManifestEntry[];
21
- };
22
- /**
23
- * Reads each layout's source at build time and runs Layer 1 segment-config
24
- * classification. Fails loudly if any layout file is missing — a missing
25
- * layout means the routing scan and the filesystem have drifted, and shipping
26
- * a build in that state would silently break layout rendering.
27
- */
28
- export declare function collectRouteClassificationManifest(routes: readonly AppRoute[]): RouteClassificationManifest;
29
- /**
30
- * Builds a JavaScript arrow-function expression that dispatches route index
31
- * to a pre-computed `Map<layoutIndex, "static" | "dynamic">` of build-time
32
- * classifications. The returned string is suitable for embedding into the
33
- * generated RSC entry via the `renderChunk` hook.
34
- *
35
- * `layer2PerRoute` is typed to only carry `"static"` entries — the
36
- * module-graph classifier can only prove static, so "needs-probe" results
37
- * are omitted by the caller before this map is constructed.
38
- */
39
- export declare function buildClassificationReplacement(manifest: RouteClassificationManifest, layer2PerRoute: ReadonlyMap<number, ReadonlyMap<number, ModuleGraphStaticReason>>): string;
40
- /**
41
- * Sibling of `buildClassificationReplacement`: emits a dispatch function
42
- * that returns `Map<layoutIndex, ClassificationReason>` per route.
43
- *
44
- * The runtime consults this map only when `VINEXT_DEBUG_CLASSIFICATION` is
45
- * set, and the plugin only patches this dispatcher into the built bundle when
46
- * that env var is present at build time.
47
- *
48
- * Layer 1 priority applies the same way as in `buildClassificationReplacement`:
49
- * a segment-config reason must override a module-graph reason for the same
50
- * layout index.
51
- */
52
- export declare function buildReasonsReplacement(manifest: RouteClassificationManifest, layer2PerRoute: ReadonlyMap<number, ReadonlyMap<number, ModuleGraphStaticReason>>): string;
53
- //#endregion