vinext 1.3.0 → 1.3.1

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 (391) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +1 -1
  2. package/dist/build/action-owner-manifest.d.ts +3 -2
  3. package/dist/build/action-owner-manifest.js +18 -2
  4. package/dist/build/app-page-static-eligibility.d.ts +17 -1
  5. package/dist/build/app-page-static-eligibility.js +80 -13
  6. package/dist/build/clean-output.d.ts +2 -1
  7. package/dist/build/client-build-config.d.ts +13 -3
  8. package/dist/build/client-build-config.js +46 -9
  9. package/dist/build/client-reference-async.d.ts +48 -0
  10. package/dist/build/client-reference-async.js +123 -0
  11. package/dist/build/client-reference-chunks.d.ts +32 -0
  12. package/dist/build/client-reference-chunks.js +111 -0
  13. package/dist/build/client-reference-groups.d.ts +9 -1
  14. package/dist/build/client-reference-groups.js +40 -2
  15. package/dist/build/css-url-assets.d.ts +2 -1
  16. package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
  17. package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
  18. package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
  19. package/dist/build/google-fonts/font-metadata.d.ts +2 -1
  20. package/dist/build/google-fonts/validate.d.ts +2 -1
  21. package/dist/build/inline-css.d.ts +2 -1
  22. package/dist/build/layout-classification.d.ts +2 -1
  23. package/dist/build/module-dependency-cache.d.ts +2 -1
  24. package/dist/build/next-client-runtime-manifests.d.ts +2 -1
  25. package/dist/build/precompress.d.ts +2 -1
  26. package/dist/build/precompress.js +1 -1
  27. package/dist/build/prerender-paths.d.ts +2 -1
  28. package/dist/build/prerender-phase.d.ts +2 -1
  29. package/dist/build/prerender-server-pool.js +1 -1
  30. package/dist/build/prerender.d.ts +3 -2
  31. package/dist/build/prerender.js +5 -4
  32. package/dist/build/report.d.ts +2 -1
  33. package/dist/build/route-classification-injector.d.ts +2 -1
  34. package/dist/build/route-classification-manifest.d.ts +2 -1
  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 +4 -0
  43. package/dist/cli-args.d.ts +2 -1
  44. package/dist/cli.js +2 -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/index.js +1 -2
  51. package/dist/client/instrumentation-client-state.js +5 -5
  52. package/dist/client/navigation-runtime.d.ts +3 -1
  53. package/dist/client/navigation-runtime.js +1 -1
  54. package/dist/client/pages-router-link-navigation.d.ts +2 -1
  55. package/dist/client/vinext-next-data.d.ts +25 -1
  56. package/dist/client/window-next.d.ts +2 -1
  57. package/dist/config/config-matchers.d.ts +12 -1
  58. package/dist/config/config-matchers.js +111 -16
  59. package/dist/config/dotenv.d.ts +2 -1
  60. package/dist/config/next-config.d.ts +13 -1
  61. package/dist/config/next-config.js +29 -4
  62. package/dist/config/tsconfig-paths.d.ts +2 -1
  63. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
  64. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
  65. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
  66. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
  67. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
  68. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
  69. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
  70. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
  71. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
  72. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
  73. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
  74. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
  75. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
  76. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
  77. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
  78. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
  79. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
  80. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
  81. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
  82. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
  83. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
  84. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
  85. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
  86. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
  87. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
  88. package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
  89. package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
  90. package/dist/entries/app-browser-entry.d.ts +20 -5
  91. package/dist/entries/app-browser-entry.js +79 -6
  92. package/dist/entries/app-rsc-entry.d.ts +2 -1
  93. package/dist/entries/app-rsc-entry.js +42 -12
  94. package/dist/entries/app-rsc-manifest.d.ts +2 -1
  95. package/dist/entries/app-rsc-manifest.js +53 -0
  96. package/dist/entries/pages-entry-helpers.js +1 -2
  97. package/dist/entries/pages-server-entry.d.ts +2 -1
  98. package/dist/entries/pages-server-entry.js +1 -1
  99. package/dist/entries/runtime-entry-module.d.ts +1 -0
  100. package/dist/entries/runtime-entry-module.js +4 -1
  101. package/dist/image/image-adapters-virtual.d.ts +2 -1
  102. package/dist/index.js +102 -34
  103. package/dist/plugins/client-compile-hints.d.ts +30 -0
  104. package/dist/plugins/client-compile-hints.js +88 -0
  105. package/dist/plugins/client-reference-dedup.d.ts +2 -1
  106. package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
  107. package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
  108. package/dist/plugins/dynamic-preload-metadata.js +1 -1
  109. package/dist/plugins/environment.d.ts +2 -1
  110. package/dist/plugins/fonts.js +9 -12
  111. package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
  112. package/dist/plugins/import-meta-url.d.ts +2 -1
  113. package/dist/plugins/og-assets.d.ts +2 -1
  114. package/dist/plugins/og-assets.js +2 -3
  115. package/dist/plugins/optimize-imports.d.ts +2 -1
  116. package/dist/plugins/pages-node-externals.d.ts +2 -1
  117. package/dist/plugins/remove-console.d.ts +2 -1
  118. package/dist/plugins/require-condition-resolution.d.ts +2 -1
  119. package/dist/plugins/rsc-client-reference-loaders.d.ts +8 -0
  120. package/dist/plugins/rsc-client-reference-loaders.js +170 -68
  121. package/dist/plugins/rsc-client-shim-excludes.js +2 -0
  122. package/dist/plugins/sass.d.ts +2 -1
  123. package/dist/plugins/strip-server-exports.d.ts +2 -1
  124. package/dist/plugins/styled-jsx.d.ts +2 -1
  125. package/dist/plugins/transform-result.d.ts +2 -1
  126. package/dist/plugins/typeof-window.d.ts +2 -1
  127. package/dist/plugins/worker-image-imports.js +1 -1
  128. package/dist/plugins/worker-use-server.d.ts +2 -1
  129. package/dist/routing/app-route-graph.d.ts +40 -0
  130. package/dist/routing/app-route-graph.js +122 -50
  131. package/dist/routing/browser-route-manifest.d.ts +2 -1
  132. package/dist/routing/optimistic-route-trie.d.ts +2 -1
  133. package/dist/routing/route-matching.d.ts +2 -1
  134. package/dist/routing/route-pattern.d.ts +2 -1
  135. package/dist/server/accept-encoding.d.ts +2 -1
  136. package/dist/server/app-action-forwarding.d.ts +2 -1
  137. package/dist/server/app-bfcache-identity.d.ts +2 -1
  138. package/dist/server/app-browser-action-result.d.ts +2 -1
  139. package/dist/server/app-browser-client-reuse-manifest.d.ts +2 -1
  140. package/dist/server/app-browser-entry.js +30 -6
  141. package/dist/server/app-browser-error.d.ts +2 -1
  142. package/dist/server/app-browser-history-controller.d.ts +2 -1
  143. package/dist/server/app-browser-hydration.d.ts +2 -1
  144. package/dist/server/app-browser-interception-context.d.ts +2 -1
  145. package/dist/server/app-browser-navigation-controller.js +15 -10
  146. package/dist/server/app-browser-popstate.d.ts +2 -1
  147. package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
  148. package/dist/server/app-browser-server-action-client.d.ts +2 -1
  149. package/dist/server/app-browser-state.js +1 -1
  150. package/dist/server/app-browser-stream.d.ts +2 -1
  151. package/dist/server/app-browser-visible-commit.d.ts +2 -1
  152. package/dist/server/app-client-reference-manifest.d.ts +31 -0
  153. package/dist/server/app-client-reference-manifest.js +46 -0
  154. package/dist/server/app-client-reference-preloader.d.ts +25 -5
  155. package/dist/server/app-client-reference-preloader.js +22 -7
  156. package/dist/server/app-elements-wire.d.ts +2 -1
  157. package/dist/server/app-elements.d.ts +2 -0
  158. package/dist/server/app-elements.js +3 -1
  159. package/dist/server/app-fallback-renderer.d.ts +9 -2
  160. package/dist/server/app-fallback-renderer.js +4 -1
  161. package/dist/server/app-history-state.d.ts +2 -1
  162. package/dist/server/app-inline-css-client.d.ts +2 -1
  163. package/dist/server/app-layout-param-observation.d.ts +2 -1
  164. package/dist/server/app-metadata-tracing.d.ts +2 -1
  165. package/dist/server/app-optimistic-routing.d.ts +18 -1
  166. package/dist/server/app-optimistic-routing.js +34 -1
  167. package/dist/server/app-page-boundary-render.d.ts +20 -2
  168. package/dist/server/app-page-boundary-render.js +221 -38
  169. package/dist/server/app-page-boundary.d.ts +34 -5
  170. package/dist/server/app-page-boundary.js +40 -7
  171. package/dist/server/app-page-cache-finalizer.d.ts +2 -1
  172. package/dist/server/app-page-cache-finalizer.js +1 -1
  173. package/dist/server/app-page-cache-render.d.ts +10 -2
  174. package/dist/server/app-page-cache-render.js +14 -2
  175. package/dist/server/app-page-cache.js +2 -2
  176. package/dist/server/app-page-dispatch.d.ts +34 -1
  177. package/dist/server/app-page-dispatch.js +163 -34
  178. package/dist/server/app-page-element-builder.d.ts +17 -1
  179. package/dist/server/app-page-element-builder.js +187 -66
  180. package/dist/server/app-page-execution.d.ts +28 -1
  181. package/dist/server/app-page-execution.js +114 -5
  182. package/dist/server/app-page-head.d.ts +95 -3
  183. package/dist/server/app-page-head.js +307 -152
  184. package/dist/server/app-page-http-access-fallback-metadata.d.ts +48 -2
  185. package/dist/server/app-page-http-access-fallback-metadata.js +76 -1
  186. package/dist/server/app-page-method.d.ts +2 -1
  187. package/dist/server/app-page-probe.d.ts +2 -1
  188. package/dist/server/app-page-render-identity.d.ts +2 -1
  189. package/dist/server/app-page-render.d.ts +7 -1
  190. package/dist/server/app-page-render.js +35 -10
  191. package/dist/server/app-page-request.d.ts +14 -1
  192. package/dist/server/app-page-request.js +1 -1
  193. package/dist/server/app-page-route-wiring.d.ts +52 -2
  194. package/dist/server/app-page-route-wiring.js +197 -47
  195. package/dist/server/app-page-rsc-render-status.d.ts +2 -1
  196. package/dist/server/app-page-search-params-observation.d.ts +7 -2
  197. package/dist/server/app-page-search-params-observation.js +8 -1
  198. package/dist/server/app-page-segment-plan.d.ts +2 -1
  199. package/dist/server/app-page-stream.d.ts +31 -1
  200. package/dist/server/app-page-stream.js +23 -4
  201. package/dist/server/app-pages-bridge.d.ts +2 -1
  202. package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
  203. package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
  204. package/dist/server/app-prerender-endpoints.d.ts +2 -1
  205. package/dist/server/app-prerender-static-params.d.ts +2 -1
  206. package/dist/server/app-render-dependency.d.ts +11 -1
  207. package/dist/server/app-render-dependency.js +26 -7
  208. package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
  209. package/dist/server/app-response-stage-entry.d.ts +2 -1
  210. package/dist/server/app-route-handler-cache.d.ts +2 -1
  211. package/dist/server/app-route-handler-dispatch.d.ts +2 -1
  212. package/dist/server/app-route-handler-dispatch.js +1 -1
  213. package/dist/server/app-route-handler-execution.d.ts +2 -1
  214. package/dist/server/app-route-handler-response.d.ts +2 -1
  215. package/dist/server/app-route-handler-runtime.d.ts +2 -1
  216. package/dist/server/app-route-module-loader.d.ts +18 -1
  217. package/dist/server/app-route-module-loader.js +8 -0
  218. package/dist/server/app-route-tree-prefetch.d.ts +2 -1
  219. package/dist/server/app-rsc-error-handler.d.ts +2 -1
  220. package/dist/server/app-rsc-errors.d.ts +2 -1
  221. package/dist/server/app-rsc-handler.d.ts +2 -1
  222. package/dist/server/app-rsc-handler.js +6 -10
  223. package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
  224. package/dist/server/app-rsc-route-matching.d.ts +38 -1
  225. package/dist/server/app-rsc-route-matching.js +24 -0
  226. package/dist/server/app-segment-config.d.ts +2 -1
  227. package/dist/server/app-segment-config.js +1 -14
  228. package/dist/server/app-server-action-execution.d.ts +2 -1
  229. package/dist/server/app-server-action-execution.js +3 -3
  230. package/dist/server/app-ssr-entry.d.ts +6 -0
  231. package/dist/server/app-ssr-entry.js +91 -44
  232. package/dist/server/app-ssr-error-meta.d.ts +2 -1
  233. package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
  234. package/dist/server/app-ssr-stream.d.ts +22 -10
  235. package/dist/server/app-ssr-stream.js +299 -67
  236. package/dist/server/app-static-generation.d.ts +2 -1
  237. package/dist/server/app-streamed-client-references.d.ts +39 -0
  238. package/dist/server/app-streamed-client-references.js +156 -0
  239. package/dist/server/app-visited-response-cache.d.ts +2 -1
  240. package/dist/server/app-worker-stages.d.ts +2 -1
  241. package/dist/server/artifact-compatibility.d.ts +2 -1
  242. package/dist/server/bfcache-identity.d.ts +2 -1
  243. package/dist/server/cache-headers.d.ts +2 -1
  244. package/dist/server/cacheability-request.d.ts +2 -1
  245. package/dist/server/client-reuse-manifest.d.ts +2 -1
  246. package/dist/server/config-headers.d.ts +2 -1
  247. package/dist/server/csp.d.ts +2 -1
  248. package/dist/server/default-global-not-found-module.d.ts +2 -1
  249. package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
  250. package/dist/server/default-http-access-fallback-modules.js +31 -0
  251. package/dist/server/defer-until-stream-consumed.d.ts +34 -0
  252. package/dist/server/defer-until-stream-consumed.js +154 -21
  253. package/dist/server/dev-lockfile.d.ts +32 -2
  254. package/dist/server/dev-lockfile.js +46 -2
  255. package/dist/server/dev-module-runner.d.ts +2 -1
  256. package/dist/server/dev-server.js +10 -3
  257. package/dist/server/fetch-handler.js +1 -2
  258. package/dist/server/file-based-metadata.d.ts +2 -1
  259. package/dist/server/framework-tracer.d.ts +2 -1
  260. package/dist/server/html.d.ts +1 -0
  261. package/dist/server/html.js +19 -1
  262. package/dist/server/http-conditional.d.ts +2 -1
  263. package/dist/server/http-error-responses.d.ts +2 -1
  264. package/dist/server/implicit-tags.d.ts +2 -1
  265. package/dist/server/metadata-route-build-data.d.ts +2 -1
  266. package/dist/server/metadata-route-build-data.js +1 -1
  267. package/dist/server/metadata-route-response.d.ts +2 -1
  268. package/dist/server/metadata-route-response.js +1 -1
  269. package/dist/server/metadata-routes.d.ts +2 -1
  270. package/dist/server/middleware-runtime.d.ts +2 -1
  271. package/dist/server/navigation-trace.d.ts +2 -1
  272. package/dist/server/next-error-digest.d.ts +2 -1
  273. package/dist/server/nitro-public-files-plugin.d.ts +2 -1
  274. package/dist/server/nitro-public-files.d.ts +2 -1
  275. package/dist/server/opentelemetry-api.d.ts +2 -1
  276. package/dist/server/operation-token.d.ts +2 -1
  277. package/dist/server/pages-api-route.d.ts +2 -1
  278. package/dist/server/pages-asset-tags.d.ts +2 -1
  279. package/dist/server/pages-body-parser-config.d.ts +2 -1
  280. package/dist/server/pages-client-assets.d.ts +4 -0
  281. package/dist/server/pages-data-route.d.ts +2 -1
  282. package/dist/server/pages-document-asset-props.d.ts +2 -1
  283. package/dist/server/pages-document-initial-props.d.ts +2 -1
  284. package/dist/server/pages-execution-tracing.d.ts +2 -1
  285. package/dist/server/pages-execution-tracing.js +1 -1
  286. package/dist/server/pages-get-initial-props.d.ts +2 -1
  287. package/dist/server/pages-page-data.d.ts +7 -1
  288. package/dist/server/pages-page-data.js +35 -12
  289. package/dist/server/pages-page-handler.d.ts +3 -2
  290. package/dist/server/pages-page-handler.js +16 -7
  291. package/dist/server/pages-page-method.d.ts +2 -1
  292. package/dist/server/pages-page-response.d.ts +2 -1
  293. package/dist/server/pages-preview.d.ts +2 -1
  294. package/dist/server/pages-readiness.d.ts +2 -1
  295. package/dist/server/pages-request-pipeline.d.ts +2 -1
  296. package/dist/server/pages-request-pipeline.js +4 -5
  297. package/dist/server/pages-request-stage-entry.d.ts +2 -1
  298. package/dist/server/pages-response-stage-entry.d.ts +2 -1
  299. package/dist/server/pages-route-data-kind.d.ts +2 -1
  300. package/dist/server/prerender-cache-life-header.d.ts +2 -1
  301. package/dist/server/prerender-route-params.d.ts +2 -1
  302. package/dist/server/prod-server.js +9 -3
  303. package/dist/server/request-log.d.ts +2 -1
  304. package/dist/server/request-tracing.d.ts +2 -1
  305. package/dist/server/request-tracing.js +1 -1
  306. package/dist/server/response-start-tracing.js +7 -29
  307. package/dist/server/rsc-render-stream.d.ts +4 -0
  308. package/dist/server/rsc-render-stream.js +25 -0
  309. package/dist/server/seed-cache.d.ts +2 -1
  310. package/dist/server/seed-cache.js +1 -1
  311. package/dist/server/static-file-cache.d.ts +2 -1
  312. package/dist/server/static-file-cache.js +1 -0
  313. package/dist/server/static-layout-client-reuse-proof.d.ts +2 -1
  314. package/dist/server/worker-revalidation-context.d.ts +2 -1
  315. package/dist/server/worker-stages.d.ts +2 -1
  316. package/dist/shims/app.d.ts +2 -1
  317. package/dist/shims/cache-callable-runtime.d.ts +2 -1
  318. package/dist/shims/cache-handler.d.ts +8 -3
  319. package/dist/shims/cache-handler.js +29 -9
  320. package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
  321. package/dist/shims/caught-not-found-boundaries.js +48 -0
  322. package/dist/shims/cdn-purge-routes.d.ts +2 -1
  323. package/dist/shims/client-locale.js +2 -1
  324. package/dist/shims/client-page-root.d.ts +2 -1
  325. package/dist/shims/config.d.ts +2 -1
  326. package/dist/shims/default-forbidden.d.ts +4 -0
  327. package/dist/shims/default-forbidden.js +18 -0
  328. package/dist/shims/default-not-found.d.ts +0 -5
  329. package/dist/shims/default-not-found.js +5 -41
  330. package/dist/shims/default-unauthorized.d.ts +4 -0
  331. package/dist/shims/default-unauthorized.js +18 -0
  332. package/dist/shims/error-boundary.d.ts +39 -3
  333. package/dist/shims/error-boundary.js +31 -16
  334. package/dist/shims/font-google.js +1 -2
  335. package/dist/shims/font-utils.d.ts +3 -2
  336. package/dist/shims/font-utils.js +5 -3
  337. package/dist/shims/form.js +1 -1
  338. package/dist/shims/http-access-error-fallback.d.ts +7 -0
  339. package/dist/shims/http-access-error-fallback.js +47 -0
  340. package/dist/shims/image.d.ts +1 -22
  341. package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
  342. package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
  343. package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
  344. package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
  345. package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
  346. package/dist/shims/internal/client-reference-loader.d.ts +7 -0
  347. package/dist/shims/internal/client-reference-loader.js +91 -0
  348. package/dist/shims/internal/cookie-serialize.d.ts +2 -1
  349. package/dist/shims/internal/cookies.js +1 -2
  350. package/dist/shims/internal/headers-state.d.ts +2 -0
  351. package/dist/shims/internal/headers-state.js +6 -1
  352. package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +2 -1
  353. package/dist/shims/internal/interpolate-as.d.ts +2 -1
  354. package/dist/shims/internal/pages-data-target.d.ts +2 -1
  355. package/dist/shims/internal/pages-data-url.d.ts +2 -1
  356. package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
  357. package/dist/shims/link.js +195 -52
  358. package/dist/shims/metadata.d.ts +32 -11
  359. package/dist/shims/metadata.js +88 -26
  360. package/dist/shims/navigation-errors.d.ts +2 -1
  361. package/dist/shims/navigation.d.ts +22 -2
  362. package/dist/shims/navigation.js +74 -20
  363. package/dist/shims/pages-router-runtime.d.ts +2 -1
  364. package/dist/shims/ppr-fallback-shell.d.ts +2 -1
  365. package/dist/shims/router.js +14 -3
  366. package/dist/shims/unified-request-context.js +3 -3
  367. package/dist/typegen.d.ts +2 -1
  368. package/dist/utils/client-build-manifest.d.ts +4 -1
  369. package/dist/utils/client-build-manifest.js +9 -2
  370. package/dist/utils/client-entry-manifest.d.ts +13 -0
  371. package/dist/utils/client-entry-manifest.js +20 -1
  372. package/dist/utils/client-reference-chunks.d.ts +45 -0
  373. package/dist/utils/client-reference-chunks.js +30 -0
  374. package/dist/utils/client-runtime-metadata.d.ts +9 -1
  375. package/dist/utils/client-runtime-metadata.js +40 -9
  376. package/dist/utils/compare.d.ts +9 -0
  377. package/dist/utils/compare.js +15 -1
  378. package/dist/utils/lazy-chunks.d.ts +14 -0
  379. package/dist/utils/lazy-chunks.js +27 -1
  380. package/dist/utils/middleware-request-headers.d.ts +2 -1
  381. package/dist/utils/project.d.ts +2 -1
  382. package/dist/utils/project.js +9 -1
  383. package/dist/utils/query.d.ts +2 -1
  384. package/dist/utils/sorted-array.d.ts +2 -1
  385. package/dist/utils/vite-cli-invocation.d.ts +2 -1
  386. package/package.json +5 -5
  387. package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
  388. package/dist/server/default-not-found-module.d.ts +0 -19
  389. package/dist/server/default-not-found-module.js +0 -18
  390. package/dist/server/rsc-stream-hints.d.ts +0 -21
  391. package/dist/server/rsc-stream-hints.js +0 -227
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
10
10
  var __copyProps = (to, from, except, desc) => {
11
11
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
12
  key = keys[i];
@@ -2,7 +2,7 @@ import { AppRoute } from "../routing/app-route-graph.js";
2
2
  import { Rollup } from "vite";
3
3
  import { RscPluginManager } from "@vitejs/plugin-rsc";
4
4
  //#region src/build/action-owner-manifest.d.ts
5
- type ActionOwnerRoute = Pick<AppRoute, "errorPath" | "errorPaths" | "forbiddenPath" | "forbiddenPaths" | "layoutErrorPaths" | "layouts" | "loadingPath" | "loadingPaths" | "notFoundPath" | "notFoundPaths" | "pagePath" | "parallelSlots" | "pattern" | "siblingIntercepts" | "templates" | "unauthorizedPath" | "unauthorizedPaths">;
5
+ type ActionOwnerRoute = Pick<AppRoute, "errorPath" | "errorPaths" | "forbiddenPath" | "forbiddenPaths" | "layoutErrorPaths" | "layouts" | "loadingPath" | "loadingPaths" | "notFoundPath" | "notFoundPaths" | "pagePath" | "parallelSlots" | "pattern" | "segmentForbiddenPaths" | "segmentNotFoundPaths" | "segmentUnauthorizedPaths" | "siblingIntercepts" | "templates" | "unauthorizedPath" | "unauthorizedPaths">;
6
6
  export type ActionOwnerRouteReachability = Map<string, {
7
7
  clientReferenceImportIds: Set<string>;
8
8
  serverReferenceIds: Set<string>;
@@ -38,4 +38,5 @@ export declare function addClientActionReachability(options: {
38
38
  routeReachability: ActionOwnerRouteReachability;
39
39
  } & ActionOwnerReferenceMaps): void;
40
40
  export declare function buildActionOwnerManifest(routeReachability: ActionOwnerRouteReachability): Record<string, string[]>;
41
- //#endregion
41
+ //#endregion
42
+ export {};
@@ -15,6 +15,9 @@ function actionOwnerRouteEntryIds(route) {
15
15
  ...route.forbiddenPaths ?? [],
16
16
  route.unauthorizedPath,
17
17
  ...route.unauthorizedPaths ?? [],
18
+ ...route.segmentNotFoundPaths ?? [],
19
+ ...route.segmentForbiddenPaths ?? [],
20
+ ...route.segmentUnauthorizedPaths ?? [],
18
21
  ...route.parallelSlots.flatMap((slot) => [
19
22
  slot.pagePath,
20
23
  slot.defaultPath,
@@ -24,18 +27,31 @@ function actionOwnerRouteEntryIds(route) {
24
27
  ...slot.loadingPaths ?? [],
25
28
  slot.errorPath,
26
29
  slot.notFoundPath,
30
+ ...slot.notFoundPaths ?? [],
27
31
  ...slot.interceptingRoutes.flatMap((intercept) => [
28
32
  intercept.pagePath,
29
33
  ...intercept.layoutPaths,
30
34
  ...intercept.loadingPaths ?? [],
31
- intercept.notFoundPath
35
+ intercept.notFoundPath,
36
+ intercept.forbiddenPath,
37
+ intercept.unauthorizedPath,
38
+ ...intercept.notFoundPaths ?? [],
39
+ ...intercept.forbiddenPaths ?? [],
40
+ ...intercept.unauthorizedPaths ?? [],
41
+ ...intercept.errorPaths ?? []
32
42
  ])
33
43
  ]),
34
44
  ...route.siblingIntercepts.flatMap((intercept) => [
35
45
  intercept.pagePath,
36
46
  ...intercept.layoutPaths,
37
47
  ...intercept.loadingPaths ?? [],
38
- intercept.notFoundPath
48
+ intercept.notFoundPath,
49
+ intercept.forbiddenPath,
50
+ intercept.unauthorizedPath,
51
+ ...intercept.notFoundPaths ?? [],
52
+ ...intercept.forbiddenPaths ?? [],
53
+ ...intercept.unauthorizedPaths ?? [],
54
+ ...intercept.errorPaths ?? []
39
55
  ])
40
56
  ].filter((value) => typeof value === "string");
41
57
  }
@@ -12,4 +12,20 @@ import { AppRoute } from "../routing/app-route-graph.js";
12
12
  * unreadable route's fallback, so it never certifies one.
13
13
  */
14
14
  export declare function classifyAppPageRouteStaticEligibility(route: AppRoute, readMdxEsm: ((source: string) => string) | null): "eligible" | "ineligible" | "unreadable";
15
- //#endregion
15
+ /**
16
+ * Whether the route's segment config rules out static generation, so Next.js
17
+ * renders it on every request. An "unreadable" route or a source that can't be
18
+ * read counts as not dynamic.
19
+ */
20
+ export declare function isAppPageRouteRenderedDynamically(route: AppRoute, readMdxEsm: ((source: string) => string) | null): boolean;
21
+ type AppRouteIntercept = AppRoute["siblingIntercepts"][number];
22
+ /**
23
+ * Whether Next.js renders an intercepted page on every request. Next.js builds
24
+ * the intercepting page as its own route (`/feed/(.)photos/[id]`): the
25
+ * layouts of every folder from `app/` down to the intercepting page, then the
26
+ * page. `layoutPaths` are the candidate layouts; those outside the page's
27
+ * folder chain are ignored. An unreadable source counts as not dynamic.
28
+ */
29
+ export declare function isAppInterceptRenderedDynamically(intercept: AppRouteIntercept, layoutPaths: readonly string[], readMdxEsm: ((source: string) => string) | null): boolean;
30
+ //#endregion
31
+ export {};
@@ -1,21 +1,15 @@
1
+ import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
1
2
  import { extractExportConstNumber, extractExportConstString, hasRuntimeExportedName } from "./report.js";
2
3
  import { collectAppPageStaticGenerationRuntimes, hasAppPageGenerateStaticParamsAtLastDynamicSegment, isAppPageStaticEligible, isEdgeRuntime, resolveAppPageSegmentConfig, resolveAppPageStaticGenerationRuntime } from "../server/app-segment-config.js";
3
4
  import fs from "node:fs";
4
5
  //#region src/build/app-page-static-eligibility.ts
5
6
  /**
6
- * Whether Next.js classifies an App page route as static or SSG, read from its
7
- * layout, page and parallel-slot sources with the helpers dispatch applies to
8
- * the loaded modules. Only such a route has listed paths.
9
- *
10
- * An MDX source read without the MDX parser has unknown exports, so its route
11
- * is "unreadable". Its paths are still listed: the built runtime reads the real
12
- * exports and never stores a route that isn't static, while an unlisted path's
13
- * render failure would be dropped instead of failing. But no probe renders an
14
- * unreadable route's fallback, so it never certifies one.
7
+ * Read the segment config exports of App layout and page sources. A source MDX
8
+ * without the MDX parser leaves the reader "unreadable".
15
9
  */
16
- function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
10
+ function createSegmentConfigReader(readMdxEsm) {
17
11
  let unreadable = false;
18
- const readSegmentConfig = (filePath) => {
12
+ const read = (filePath) => {
19
13
  if (!filePath) return null;
20
14
  let code = fs.readFileSync(filePath, "utf8");
21
15
  if (filePath.toLowerCase().endsWith(".mdx")) {
@@ -36,6 +30,24 @@ function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
36
30
  ...runtime === null ? {} : { runtime }
37
31
  };
38
32
  };
33
+ return {
34
+ isUnreadable: () => unreadable,
35
+ read
36
+ };
37
+ }
38
+ /**
39
+ * Whether Next.js classifies an App page route as static or SSG, read from its
40
+ * layout, page and parallel-slot sources with the helpers dispatch applies to
41
+ * the loaded modules. Only such a route has listed paths.
42
+ *
43
+ * An MDX source read without the MDX parser has unknown exports, so its route
44
+ * is "unreadable". Its paths are still listed: the built runtime reads the real
45
+ * exports and never stores a route that isn't static, while an unlisted path's
46
+ * render failure would be dropped instead of failing. But no probe renders an
47
+ * unreadable route's fallback, so it never certifies one.
48
+ */
49
+ function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
50
+ const { isUnreadable, read: readSegmentConfig } = createSegmentConfigReader(readMdxEsm);
39
51
  const layouts = route.layouts.map(readSegmentConfig);
40
52
  const page = readSegmentConfig(route.pagePath);
41
53
  const parallelBranches = route.parallelSlots.map((slot) => ({
@@ -48,7 +60,7 @@ function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
48
60
  page: readSegmentConfig(slot.pagePath ?? slot.defaultPath),
49
61
  routeSegments: slot.routeSegments
50
62
  }));
51
- if (unreadable) return "unreadable";
63
+ if (isUnreadable()) return "unreadable";
52
64
  const segmentConfig = resolveAppPageSegmentConfig({
53
65
  layouts,
54
66
  layoutTreePositions: route.layoutTreePositions,
@@ -78,5 +90,60 @@ function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
78
90
  revalidateSeconds: segmentConfig.revalidateSeconds
79
91
  }) ? "eligible" : "ineligible";
80
92
  }
93
+ /**
94
+ * Whether the route's segment config rules out static generation, so Next.js
95
+ * renders it on every request. An "unreadable" route or a source that can't be
96
+ * read counts as not dynamic.
97
+ */
98
+ function isAppPageRouteRenderedDynamically(route, readMdxEsm) {
99
+ try {
100
+ return classifyAppPageRouteStaticEligibility(route, readMdxEsm) === "ineligible";
101
+ } catch {
102
+ return false;
103
+ }
104
+ }
105
+ const INTERCEPTION_MARKER_RE = /^(?:\(\.\.\.\)|\(\.\.\)\(\.\.\)|\(\.\.\)|\(\.\))/;
106
+ /**
107
+ * Whether Next.js renders an intercepted page on every request. Next.js builds
108
+ * the intercepting page as its own route (`/feed/(.)photos/[id]`): the
109
+ * layouts of every folder from `app/` down to the intercepting page, then the
110
+ * page. `layoutPaths` are the candidate layouts; those outside the page's
111
+ * folder chain are ignored. An unreadable source counts as not dynamic.
112
+ */
113
+ function isAppInterceptRenderedDynamically(intercept, layoutPaths, readMdxEsm) {
114
+ if (!intercept.sourcePageSegments) return false;
115
+ const routeSegments = intercept.sourcePageSegments.map((segment) => segment.replace(INTERCEPTION_MARKER_RE, ""));
116
+ try {
117
+ const pageDir = path.dirname(intercept.pagePath);
118
+ const layoutsByPosition = /* @__PURE__ */ new Map();
119
+ for (const layoutPath of layoutPaths) {
120
+ const relative = path.relative(path.dirname(layoutPath), pageDir);
121
+ if (relative.startsWith("..") || path.isAbsolute(relative)) continue;
122
+ const depthBelowLayout = relative.split("/").filter(Boolean).length;
123
+ layoutsByPosition.set(routeSegments.length - depthBelowLayout, layoutPath);
124
+ }
125
+ const layoutTreePositions = [...layoutsByPosition.keys()].sort((a, b) => a - b);
126
+ const { isUnreadable, read } = createSegmentConfigReader(readMdxEsm);
127
+ const layouts = layoutTreePositions.map((position) => read(layoutsByPosition.get(position)));
128
+ const page = read(intercept.pagePath);
129
+ if (isUnreadable()) return false;
130
+ const tree = {
131
+ layouts,
132
+ layoutTreePositions,
133
+ page,
134
+ routeSegments
135
+ };
136
+ const segmentConfig = resolveAppPageSegmentConfig(tree);
137
+ return !isAppPageStaticEligible({
138
+ dynamicConfig: segmentConfig.dynamicConfig,
139
+ hasGenerateStaticParams: hasAppPageGenerateStaticParamsAtLastDynamicSegment(tree),
140
+ isDynamicRoute: routeSegments.some((segment) => segment.startsWith("[") && segment.endsWith("]")),
141
+ isStaticGenerationEdgeRuntime: isEdgeRuntime(resolveAppPageStaticGenerationRuntime(collectAppPageStaticGenerationRuntimes(tree))),
142
+ revalidateSeconds: segmentConfig.revalidateSeconds
143
+ });
144
+ } catch {
145
+ return false;
146
+ }
147
+ }
81
148
  //#endregion
82
- export { classifyAppPageRouteStaticEligibility };
149
+ export { classifyAppPageRouteStaticEligibility, isAppInterceptRenderedDynamically, isAppPageRouteRenderedDynamically };
@@ -9,4 +9,5 @@ type CleanBuildOutputResult = {
9
9
  outDir: string;
10
10
  };
11
11
  export declare function cleanBuildOutput(options: CleanBuildOutputOptions): CleanBuildOutputResult;
12
- //#endregion
12
+ //#endregion
13
+ export {};
@@ -13,15 +13,24 @@ type ClientAssetFileNameInfo = {
13
13
  * an asset (a single output asset can carry several `originalFileNames`).
14
14
  */
15
15
  export declare function createClientAssetFileNames(assetsDir: string): (assetInfo: ClientAssetFileNameInfo) => string;
16
+ /**
17
+ * The App Router client build module that registers the client references
18
+ * whose modules are in the "vinext" chunk (see
19
+ * plugins/rsc-client-reference-loaders.ts). It joins that chunk, so it loads
20
+ * with the browser entry without adding to the entry's own chunk.
21
+ */
22
+ export declare const RESOLVED_EAGER_CLIENT_REFERENCES_ID = "\0virtual:vinext-client-reference-eager";
16
23
  /**
17
24
  * Create a manualChunks function for client builds.
18
25
  *
19
26
  * Splits the client bundle into:
20
27
  * - "framework" — React, ReactDOM, and scheduler (loaded on every page)
21
28
  * - "vinext" — shared vinext runtime shims
29
+ * - "vinext-app-router" — the App Router runtime, in Pages Router builds
22
30
  *
23
- * Route-owned client shims and all other vendor code are left to the bundler's
24
- * graph-based chunking so they stay behind their client-reference boundaries.
31
+ * Route-owned (App Router) or page-owned (Pages Router) client shims and all
32
+ * other vendor code are left to the bundler's graph-based chunking so they
33
+ * load only where they're used.
25
34
  *
26
35
  * Why not split every npm package into its own chunk?
27
36
  * - Per-package splitting (`vendor-X`) creates 50-200+ chunks for a
@@ -187,4 +196,5 @@ export declare function assertClientOutDirIsSeparate(root: string, dirs: {
187
196
  * seen to evaluate modules out of order and break hydration.
188
197
  */
189
198
  export declare function hasUserClientChunkGroups(output: unknown, ownGroups: ReadonlySet<unknown>): boolean;
190
- //#endregion
199
+ //#endregion
200
+ export {};
@@ -10,6 +10,7 @@ const ROUTE_OWNED_CLIENT_SHIMS = /* @__PURE__ */ new Set([
10
10
  "dynamic-preload-chunks",
11
11
  "form",
12
12
  "image",
13
+ "image-config",
13
14
  "image-props",
14
15
  "internal/hybrid-client-route-owner",
15
16
  "layout-segment-context",
@@ -20,6 +21,31 @@ const ROUTE_OWNED_CLIENT_SHIMS = /* @__PURE__ */ new Set([
20
21
  "script",
21
22
  "web-vitals"
22
23
  ]);
24
+ const PAGE_OWNED_CLIENT_SHIMS = /* @__PURE__ */ new Set([
25
+ "dynamic",
26
+ "dynamic-preload-chunks",
27
+ "form",
28
+ "image",
29
+ "image-config",
30
+ "image-props",
31
+ "legacy-image",
32
+ "offline",
33
+ "script",
34
+ "web-vitals",
35
+ "error"
36
+ ]);
37
+ const PAGES_APP_ROUTER_RUNTIME_SHIMS = /* @__PURE__ */ new Set([
38
+ "app-router-scroll-state",
39
+ "internal/app-prefetch-rsc-request",
40
+ "internal/navigation-untracked",
41
+ "internal/pages-router-accessor",
42
+ "navigation",
43
+ "navigation-context-state",
44
+ "navigation-errors",
45
+ "ppr-fallback-shell",
46
+ "readonly-url-search-params",
47
+ "unrecognized-action-error"
48
+ ]);
23
49
  const NEXT_CLIENT_CSS_ASSET_FILE_NAMES = "css/[hash][extname]";
24
50
  const NEXT_CLIENT_STATIC_MEDIA_FILE_NAMES = "media/[name].[hash:8][extname]";
25
51
  function joinAssetFileNamePattern(assetsDir, pattern) {
@@ -65,14 +91,23 @@ function getPackageName(id) {
65
91
  return rest.split("/")[0] || null;
66
92
  }
67
93
  /**
94
+ * The App Router client build module that registers the client references
95
+ * whose modules are in the "vinext" chunk (see
96
+ * plugins/rsc-client-reference-loaders.ts). It joins that chunk, so it loads
97
+ * with the browser entry without adding to the entry's own chunk.
98
+ */
99
+ const RESOLVED_EAGER_CLIENT_REFERENCES_ID = "\0virtual:vinext-client-reference-eager";
100
+ /**
68
101
  * Create a manualChunks function for client builds.
69
102
  *
70
103
  * Splits the client bundle into:
71
104
  * - "framework" — React, ReactDOM, and scheduler (loaded on every page)
72
105
  * - "vinext" — shared vinext runtime shims
106
+ * - "vinext-app-router" — the App Router runtime, in Pages Router builds
73
107
  *
74
- * Route-owned client shims and all other vendor code are left to the bundler's
75
- * graph-based chunking so they stay behind their client-reference boundaries.
108
+ * Route-owned (App Router) or page-owned (Pages Router) client shims and all
109
+ * other vendor code are left to the bundler's graph-based chunking so they
110
+ * load only where they're used.
76
111
  *
77
112
  * Why not split every npm package into its own chunk?
78
113
  * - Per-package splitting (`vendor-X`) creates 50-200+ chunks for a
@@ -90,17 +125,19 @@ function getPackageName(id) {
90
125
  * and route-specific code stays in route chunks.
91
126
  */
92
127
  function createClientManualChunks(shimsDir, preserveRouteBoundaries = false) {
128
+ const instrumentationStatePrefix = path.join(shimsDir, "../client/instrumentation-client-state.");
93
129
  return function clientManualChunks(id) {
130
+ if (id === "\0virtual:vinext-client-reference-eager") return "vinext";
94
131
  const slashedId = toSlash(id);
95
132
  if (slashedId.startsWith(shimsDir)) {
96
- if (preserveRouteBoundaries) {
97
- const relativeId = slashedId.slice(shimsDir.length).split("?", 1)[0] ?? "";
98
- const extensionIndex = relativeId.lastIndexOf(".");
99
- const shimName = extensionIndex === -1 ? relativeId : relativeId.slice(0, extensionIndex);
100
- if (ROUTE_OWNED_CLIENT_SHIMS.has(shimName)) return void 0;
101
- }
133
+ const relativeId = slashedId.slice(shimsDir.length).split("?", 1)[0] ?? "";
134
+ const extensionIndex = relativeId.lastIndexOf(".");
135
+ const shimName = extensionIndex === -1 ? relativeId : relativeId.slice(0, extensionIndex);
136
+ if ((preserveRouteBoundaries ? ROUTE_OWNED_CLIENT_SHIMS : PAGE_OWNED_CLIENT_SHIMS).has(shimName)) return void 0;
137
+ if (!preserveRouteBoundaries && PAGES_APP_ROUTER_RUNTIME_SHIMS.has(shimName)) return "vinext-app-router";
102
138
  return "vinext";
103
139
  }
140
+ if (slashedId.startsWith(instrumentationStatePrefix)) return "vinext";
104
141
  if (id.includes("node_modules")) {
105
142
  const pkg = getPackageName(id);
106
143
  if (!pkg) return void 0;
@@ -410,4 +447,4 @@ function hasUserClientChunkGroups(output, ownGroups) {
410
447
  return Array.isArray(output) ? output.some((entry) => hasChunkGroups(entry, ownGroups)) : hasChunkGroups(output, ownGroups);
411
448
  }
412
449
  //#endregion
413
- export { RSC_FRAMEWORK_CHUNK_TEST, assertClientOutDirIsSeparate, createClientAssetFileNames, createClientCodeSplittingConfig, createClientManualChunks, createClientOutputFileNameDefaults, createMultiStageChunkFileNames, createMultiStageCodeSplittingConfig, createRscFrameworkChunkOutputConfig, createWorkerFileNames, findUnsupportedClientOutputFileNames, getBuildBundlerOptions, getClientTreeshakeConfig, getOutputFileNames, hasUserClientChunkGroups, isRscFrameworkModule, sanitizeRscChunkFileName, withBuildBundlerOptions };
450
+ export { RESOLVED_EAGER_CLIENT_REFERENCES_ID, RSC_FRAMEWORK_CHUNK_TEST, assertClientOutDirIsSeparate, createClientAssetFileNames, createClientCodeSplittingConfig, createClientManualChunks, createClientOutputFileNameDefaults, createMultiStageChunkFileNames, createMultiStageCodeSplittingConfig, createRscFrameworkChunkOutputConfig, createWorkerFileNames, findUnsupportedClientOutputFileNames, getBuildBundlerOptions, getClientTreeshakeConfig, getOutputFileNames, hasUserClientChunkGroups, isRscFrameworkModule, sanitizeRscChunkFileName, withBuildBundlerOptions };
@@ -0,0 +1,48 @@
1
+ //#region src/build/client-reference-async.d.ts
2
+ type AsyncModuleGraphInfo = {
3
+ code: string | null;
4
+ importedIds: readonly string[];
5
+ };
6
+ /** A chunk of the emitted output, as `renderChunk`'s `meta.chunks` lists it. */
7
+ export type EmittedChunk = {
8
+ fileName: string;
9
+ /** The chunks it imports statically, by file name, and its externals. */
10
+ imports: readonly string[];
11
+ /** Its modules, with their code after tree-shaking. */
12
+ modules: Readonly<Record<string, {
13
+ code: string | null;
14
+ renderedLength: number;
15
+ }>>;
16
+ };
17
+ /**
18
+ * Whether `code` awaits at the top level of the module: an `await`, a
19
+ * `for await` or an `await using` outside any function. Code that fails to
20
+ * parse counts as synchronous.
21
+ */
22
+ export declare function hasTopLevelAwait(code: string): boolean;
23
+ /**
24
+ * The `roots` whose evaluation is asynchronous in the emitted output: the
25
+ * module, or a module it imports at any depth, awaits at its top level. Webpack
26
+ * calls these async modules, and React's Flight client suspends on them as they
27
+ * load. Only what the output keeps counts: modules tree-shaking dropped don't
28
+ * make a module async. Neither do imports of a module in a chunk the
29
+ * importer's chunks never load, nor of one `declaresSideEffects` reports, which
30
+ * the output drops when unused. Other imports stay: the imported module's side
31
+ * effects, its await included, run before the importer.
32
+ */
33
+ export declare function collectAsyncModules(options: {
34
+ roots: readonly string[];
35
+ getModuleInfo: (id: string) => AsyncModuleGraphInfo | null;
36
+ chunks: readonly EmittedChunk[];
37
+ declaresSideEffects?: (id: string) => boolean;
38
+ }): Set<string>;
39
+ /**
40
+ * Whether a module's package declares which of its modules have side effects
41
+ * (`sideEffects` other than `true` in the nearest package.json naming a
42
+ * package or declaring it). A bundler drops an unused import of a module the
43
+ * declaration marks side-effect-free, which Rolldown's module info doesn't
44
+ * report, so an import into such a package may not survive.
45
+ */
46
+ export declare function createSideEffectsDeclarationCheck(): (id: string) => boolean;
47
+ //#endregion
48
+ export {};
@@ -0,0 +1,123 @@
1
+ import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
+ import { parseProgram, walkAst } from "../plugins/ast-utils.js";
3
+ import fs from "node:fs";
4
+ //#region src/build/client-reference-async.ts
5
+ /**
6
+ * Whether `code` awaits at the top level of the module: an `await`, a
7
+ * `for await` or an `await using` outside any function. Code that fails to
8
+ * parse counts as synchronous.
9
+ */
10
+ function hasTopLevelAwait(code) {
11
+ if (!code.includes("await")) return false;
12
+ let program;
13
+ try {
14
+ program = parseProgram(code, { sourceType: "module" });
15
+ } catch {
16
+ return false;
17
+ }
18
+ let found = false;
19
+ walkAst(program, (node) => {
20
+ if (found) return false;
21
+ if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return false;
22
+ if (node.type === "AwaitExpression") {
23
+ found = true;
24
+ return false;
25
+ }
26
+ if (node.type === "ForOfStatement" && node.await || node.type === "VariableDeclaration" && node.kind === "await using") found = true;
27
+ });
28
+ return found;
29
+ }
30
+ /**
31
+ * The `roots` whose evaluation is asynchronous in the emitted output: the
32
+ * module, or a module it imports at any depth, awaits at its top level. Webpack
33
+ * calls these async modules, and React's Flight client suspends on them as they
34
+ * load. Only what the output keeps counts: modules tree-shaking dropped don't
35
+ * make a module async. Neither do imports of a module in a chunk the
36
+ * importer's chunks never load, nor of one `declaresSideEffects` reports, which
37
+ * the output drops when unused. Other imports stay: the imported module's side
38
+ * effects, its await included, run before the importer.
39
+ */
40
+ function collectAsyncModules(options) {
41
+ const chunkOf = /* @__PURE__ */ new Map();
42
+ for (const chunk of options.chunks) for (const [id, module] of Object.entries(chunk.modules)) if (module.renderedLength > 0) chunkOf.set(id, chunk);
43
+ const chunksByFile = new Map(options.chunks.map((chunk) => [chunk.fileName, chunk]));
44
+ const loadedChunks = /* @__PURE__ */ new Map();
45
+ const chunksLoadedWith = (chunk) => {
46
+ let files = loadedChunks.get(chunk);
47
+ if (files) return files;
48
+ files = /* @__PURE__ */ new Set([chunk.fileName]);
49
+ const queue = [chunk];
50
+ for (let index = 0; index < queue.length; index++) for (const file of queue[index].imports) {
51
+ const imported = chunksByFile.get(file);
52
+ if (!imported || files.has(file)) continue;
53
+ files.add(file);
54
+ queue.push(imported);
55
+ }
56
+ loadedChunks.set(chunk, files);
57
+ return files;
58
+ };
59
+ const importers = /* @__PURE__ */ new Map();
60
+ const awaiting = [];
61
+ const visited = /* @__PURE__ */ new Set();
62
+ const stack = options.roots.filter((id) => chunkOf.has(id));
63
+ while (stack.length > 0) {
64
+ const id = stack.pop();
65
+ if (visited.has(id)) continue;
66
+ visited.add(id);
67
+ const chunk = chunkOf.get(id);
68
+ const info = options.getModuleInfo(id);
69
+ const code = chunk.modules[id].code ?? info?.code ?? null;
70
+ if (code !== null && hasTopLevelAwait(code)) awaiting.push(id);
71
+ const loaded = chunksLoadedWith(chunk);
72
+ for (const imported of info?.importedIds ?? []) {
73
+ const importedChunk = chunkOf.get(imported);
74
+ if (!importedChunk || !loaded.has(importedChunk.fileName)) continue;
75
+ if (options.declaresSideEffects?.(imported)) continue;
76
+ let list = importers.get(imported);
77
+ if (!list) importers.set(imported, list = []);
78
+ list.push(id);
79
+ stack.push(imported);
80
+ }
81
+ }
82
+ const asyncModules = new Set(awaiting);
83
+ for (let index = 0; index < awaiting.length; index++) for (const importer of importers.get(awaiting[index]) ?? []) {
84
+ if (asyncModules.has(importer)) continue;
85
+ asyncModules.add(importer);
86
+ awaiting.push(importer);
87
+ }
88
+ return new Set(options.roots.filter((id) => asyncModules.has(id)));
89
+ }
90
+ /**
91
+ * Whether a module's package declares which of its modules have side effects
92
+ * (`sideEffects` other than `true` in the nearest package.json naming a
93
+ * package or declaring it). A bundler drops an unused import of a module the
94
+ * declaration marks side-effect-free, which Rolldown's module info doesn't
95
+ * report, so an import into such a package may not survive.
96
+ */
97
+ function createSideEffectsDeclarationCheck() {
98
+ const byDirectory = /* @__PURE__ */ new Map();
99
+ const declares = (directory) => {
100
+ const cached = byDirectory.get(directory);
101
+ if (cached !== void 0) return cached;
102
+ let pkg;
103
+ try {
104
+ pkg = JSON.parse(fs.readFileSync(path.join(directory, "package.json"), "utf8"));
105
+ } catch {
106
+ pkg = void 0;
107
+ }
108
+ let result;
109
+ if (pkg && typeof pkg === "object" && ("sideEffects" in pkg || "name" in pkg)) result = "sideEffects" in pkg && pkg.sideEffects !== true;
110
+ else {
111
+ const parent = path.dirname(directory);
112
+ result = parent !== directory && declares(parent);
113
+ }
114
+ byDirectory.set(directory, result);
115
+ return result;
116
+ };
117
+ return (id) => {
118
+ const file = id.split("?")[0];
119
+ return !id.startsWith("\0") && path.isAbsolute(file) && declares(path.dirname(file));
120
+ };
121
+ }
122
+ //#endregion
123
+ export { collectAsyncModules, createSideEffectsDeclarationCheck, hasTopLevelAwait };
@@ -0,0 +1,32 @@
1
+ import { ClientReferenceChunks } from "../utils/client-reference-chunks.js";
2
+ import { ResolvedConfig, Rollup } from "vite";
3
+ //#region src/build/client-reference-chunks.d.ts
4
+ /**
5
+ * Collect what each App Router client reference loads in the browser from the
6
+ * client bundle: the chunk holding the module that registers it (see
7
+ * plugins/rsc-client-reference-loaders.ts), and the JS chunks and stylesheets
8
+ * that chunk needs, as Vite's preload helper would load them for a dynamic
9
+ * import. JS chunks the App browser entry imports statically have loaded
10
+ * before any Flight row decodes, so they are left out.
11
+ *
12
+ * @param moduleKeys Client reference modules by resolved id, with the keys of
13
+ * the references each registers.
14
+ * @param modulePreload The client build's `build.modulePreload`, which picks
15
+ * the JS chunks to modulepreload, as it does for Vite's preload helper. Its
16
+ * `resolveDependencies` sees the chunk that dynamically imports each
17
+ * registering module as the host, as Vite passes it.
18
+ */
19
+ export declare function collectClientReferenceChunks(bundle: Rollup.OutputBundle, moduleKeys: ReadonlyMap<string, readonly string[]>, appBrowserEntry: Rollup.OutputChunk | undefined, modulePreload?: ResolvedConfig["build"]["modulePreload"]): ClientReferenceChunks | undefined;
20
+ /**
21
+ * Vite's build manifest keys a dynamic import by the module it imports, and
22
+ * next/dynamic's SSR preloads look up the module a boundary imports (see
23
+ * shims/dynamic-preload-chunks.tsx). The client build imports a client
24
+ * reference outside every group through the module that registers it, not
25
+ * the reference's own module, so map the reference's module to the chunk of
26
+ * the module that registers it, keyed as Vite keys a manifest entry.
27
+ *
28
+ * @param getImportedIds A module's static imports, as the bundler resolved
29
+ * them.
30
+ */
31
+ export declare function collectClientReferenceSources(bundle: Rollup.OutputBundle, getImportedIds: (moduleId: string) => readonly string[] | undefined, root: string): Record<string, string> | undefined;
32
+ //#endregion