vinext 0.0.29 → 0.0.31

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 (428) hide show
  1. package/README.md +12 -6
  2. package/dist/build/prerender.d.ts +188 -0
  3. package/dist/build/prerender.js +675 -0
  4. package/dist/build/prerender.js.map +1 -0
  5. package/dist/build/report.d.ts +45 -46
  6. package/dist/build/report.js +247 -276
  7. package/dist/build/report.js.map +1 -1
  8. package/dist/build/run-prerender.d.ts +62 -0
  9. package/dist/build/run-prerender.js +183 -0
  10. package/dist/build/run-prerender.js.map +1 -0
  11. package/dist/build/server-manifest.d.ts +19 -0
  12. package/dist/build/server-manifest.js +29 -0
  13. package/dist/build/server-manifest.js.map +1 -0
  14. package/dist/build/static-export.d.ts +51 -66
  15. package/dist/build/static-export.js +51 -545
  16. package/dist/build/static-export.js.map +1 -1
  17. package/dist/check.d.ts +26 -24
  18. package/dist/check.js +591 -567
  19. package/dist/check.js.map +1 -1
  20. package/dist/cli.d.ts +1 -15
  21. package/dist/cli.js +430 -491
  22. package/dist/cli.js.map +1 -1
  23. package/dist/client/entry.d.ts +1 -2
  24. package/dist/client/entry.js +49 -62
  25. package/dist/client/entry.js.map +1 -1
  26. package/dist/client/validate-module-path.d.ts +4 -1
  27. package/dist/client/validate-module-path.js +23 -28
  28. package/dist/client/validate-module-path.js.map +1 -1
  29. package/dist/client/vinext-next-data.d.ts +15 -20
  30. package/dist/client/vinext-next-data.js +0 -1
  31. package/dist/cloudflare/index.d.ts +3 -8
  32. package/dist/cloudflare/index.js +3 -8
  33. package/dist/cloudflare/kv-cache-handler.d.ts +95 -105
  34. package/dist/cloudflare/kv-cache-handler.js +354 -366
  35. package/dist/cloudflare/kv-cache-handler.js.map +1 -1
  36. package/dist/cloudflare/tpr.d.ts +36 -34
  37. package/dist/cloudflare/tpr.js +460 -603
  38. package/dist/cloudflare/tpr.js.map +1 -1
  39. package/dist/config/config-matchers.d.ts +31 -40
  40. package/dist/config/config-matchers.js +727 -936
  41. package/dist/config/config-matchers.js.map +1 -1
  42. package/dist/config/dotenv.d.ts +18 -11
  43. package/dist/config/dotenv.js +79 -84
  44. package/dist/config/dotenv.js.map +1 -1
  45. package/dist/config/next-config.d.ts +156 -146
  46. package/dist/config/next-config.js +374 -464
  47. package/dist/config/next-config.js.map +1 -1
  48. package/dist/deploy.d.ts +87 -96
  49. package/dist/deploy.js +490 -628
  50. package/dist/deploy.js.map +1 -1
  51. package/dist/entries/app-browser-entry.d.ts +4 -1
  52. package/dist/entries/app-browser-entry.js +12 -8
  53. package/dist/entries/app-browser-entry.js.map +1 -1
  54. package/dist/entries/app-rsc-entry.d.ts +33 -20
  55. package/dist/entries/app-rsc-entry.js +618 -343
  56. package/dist/entries/app-rsc-entry.js.map +1 -1
  57. package/dist/entries/app-ssr-entry.d.ts +9 -1
  58. package/dist/entries/app-ssr-entry.js +61 -28
  59. package/dist/entries/app-ssr-entry.js.map +1 -1
  60. package/dist/entries/pages-client-entry.d.ts +6 -2
  61. package/dist/entries/pages-client-entry.js +30 -33
  62. package/dist/entries/pages-client-entry.js.map +1 -1
  63. package/dist/entries/pages-entry-helpers.d.ts +5 -1
  64. package/dist/entries/pages-entry-helpers.js +17 -14
  65. package/dist/entries/pages-entry-helpers.js.map +1 -1
  66. package/dist/entries/pages-server-entry.d.ts +6 -2
  67. package/dist/entries/pages-server-entry.js +229 -207
  68. package/dist/entries/pages-server-entry.js.map +1 -1
  69. package/dist/index.d.ts +82 -62
  70. package/dist/index.js +2172 -3125
  71. package/dist/index.js.map +1 -1
  72. package/dist/init.d.ts +40 -37
  73. package/dist/init.js +201 -258
  74. package/dist/init.js.map +1 -1
  75. package/dist/plugins/async-hooks-stub.d.ts +7 -3
  76. package/dist/plugins/async-hooks-stub.js +39 -42
  77. package/dist/plugins/async-hooks-stub.js.map +1 -1
  78. package/dist/plugins/client-reference-dedup.d.ts +7 -3
  79. package/dist/plugins/client-reference-dedup.js +63 -88
  80. package/dist/plugins/client-reference-dedup.js.map +1 -1
  81. package/dist/routing/app-router.d.ts +100 -96
  82. package/dist/routing/app-router.js +563 -659
  83. package/dist/routing/app-router.js.map +1 -1
  84. package/dist/routing/file-matcher.d.ts +18 -15
  85. package/dist/routing/file-matcher.js +65 -65
  86. package/dist/routing/file-matcher.js.map +1 -1
  87. package/dist/routing/pages-router.d.ts +23 -24
  88. package/dist/routing/pages-router.js +147 -172
  89. package/dist/routing/pages-router.js.map +1 -1
  90. package/dist/routing/route-trie.d.ts +23 -20
  91. package/dist/routing/route-trie.js +131 -151
  92. package/dist/routing/route-trie.js.map +1 -1
  93. package/dist/routing/route-validation.d.ts +5 -2
  94. package/dist/routing/route-validation.js +98 -130
  95. package/dist/routing/route-validation.js.map +1 -1
  96. package/dist/routing/utils.d.ts +10 -7
  97. package/dist/routing/utils.js +75 -111
  98. package/dist/routing/utils.js.map +1 -1
  99. package/dist/server/api-handler.d.ts +8 -13
  100. package/dist/server/api-handler.js +161 -193
  101. package/dist/server/api-handler.js.map +1 -1
  102. package/dist/server/app-router-entry.d.ts +6 -16
  103. package/dist/server/app-router-entry.js +26 -54
  104. package/dist/server/app-router-entry.js.map +1 -1
  105. package/dist/server/dev-module-runner.d.ts +11 -64
  106. package/dist/server/dev-module-runner.js +89 -101
  107. package/dist/server/dev-module-runner.js.map +1 -1
  108. package/dist/server/dev-origin-check.d.ts +12 -10
  109. package/dist/server/dev-origin-check.js +98 -108
  110. package/dist/server/dev-origin-check.js.map +1 -1
  111. package/dist/server/dev-server.d.ts +17 -13
  112. package/dist/server/dev-server.js +547 -874
  113. package/dist/server/dev-server.js.map +1 -1
  114. package/dist/server/html.d.ts +4 -1
  115. package/dist/server/html.js +25 -26
  116. package/dist/server/html.js.map +1 -1
  117. package/dist/server/image-optimization.d.ts +31 -28
  118. package/dist/server/image-optimization.js +183 -200
  119. package/dist/server/image-optimization.js.map +1 -1
  120. package/dist/server/instrumentation.d.ts +25 -22
  121. package/dist/server/instrumentation.js +110 -122
  122. package/dist/server/instrumentation.js.map +1 -1
  123. package/dist/server/isr-cache.d.ts +16 -26
  124. package/dist/server/isr-cache.js +109 -126
  125. package/dist/server/isr-cache.js.map +1 -1
  126. package/dist/server/metadata-routes.d.ts +85 -88
  127. package/dist/server/metadata-routes.js +277 -286
  128. package/dist/server/metadata-routes.js.map +1 -1
  129. package/dist/server/middleware-codegen.d.ts +7 -4
  130. package/dist/server/middleware-codegen.js +98 -65
  131. package/dist/server/middleware-codegen.js.map +1 -1
  132. package/dist/server/middleware-request-headers.d.ts +8 -6
  133. package/dist/server/middleware-request-headers.js +47 -65
  134. package/dist/server/middleware-request-headers.js.map +1 -1
  135. package/dist/server/middleware.d.ts +31 -47
  136. package/dist/server/middleware.js +276 -363
  137. package/dist/server/middleware.js.map +1 -1
  138. package/dist/server/normalize-path.d.ts +4 -1
  139. package/dist/server/normalize-path.js +33 -47
  140. package/dist/server/normalize-path.js.map +1 -1
  141. package/dist/server/pages-i18n.d.ts +58 -0
  142. package/dist/server/pages-i18n.js +125 -0
  143. package/dist/server/pages-i18n.js.map +1 -0
  144. package/dist/server/prod-server.d.ts +19 -31
  145. package/dist/server/prod-server.js +714 -945
  146. package/dist/server/prod-server.js.map +1 -1
  147. package/dist/server/request-log.d.ts +18 -12
  148. package/dist/server/request-log.js +45 -52
  149. package/dist/server/request-log.js.map +1 -1
  150. package/dist/server/request-pipeline.d.ts +9 -17
  151. package/dist/server/request-pipeline.js +133 -184
  152. package/dist/server/request-pipeline.js.map +1 -1
  153. package/dist/server/worker-utils.d.ts +4 -1
  154. package/dist/server/worker-utils.js +31 -37
  155. package/dist/server/worker-utils.js.map +1 -1
  156. package/dist/shims/amp.d.ts +5 -2
  157. package/dist/shims/amp.js +19 -15
  158. package/dist/shims/amp.js.map +1 -1
  159. package/dist/shims/app.d.ts +8 -10
  160. package/dist/shims/app.js +0 -1
  161. package/dist/shims/cache-runtime.d.ts +21 -43
  162. package/dist/shims/cache-runtime.js +271 -405
  163. package/dist/shims/cache-runtime.js.map +1 -1
  164. package/dist/shims/cache.d.ts +131 -119
  165. package/dist/shims/cache.js +339 -418
  166. package/dist/shims/cache.js.map +1 -1
  167. package/dist/shims/client-only.d.ts +1 -18
  168. package/dist/shims/client-only.js +0 -17
  169. package/dist/shims/compat-router.d.ts +4 -1
  170. package/dist/shims/compat-router.js +23 -19
  171. package/dist/shims/compat-router.js.map +1 -1
  172. package/dist/shims/config.d.ts +7 -5
  173. package/dist/shims/config.js +16 -23
  174. package/dist/shims/config.js.map +1 -1
  175. package/dist/shims/constants.d.ts +119 -118
  176. package/dist/shims/constants.js +159 -165
  177. package/dist/shims/constants.js.map +1 -1
  178. package/dist/shims/document.d.ts +20 -16
  179. package/dist/shims/document.js +41 -22
  180. package/dist/shims/document.js.map +1 -1
  181. package/dist/shims/dynamic.d.ts +13 -22
  182. package/dist/shims/dynamic.js +122 -136
  183. package/dist/shims/dynamic.js.map +1 -1
  184. package/dist/shims/error-boundary.d.ts +22 -15
  185. package/dist/shims/error-boundary.js +81 -79
  186. package/dist/shims/error-boundary.js.map +1 -1
  187. package/dist/shims/error.d.ts +11 -12
  188. package/dist/shims/error.js +35 -39
  189. package/dist/shims/error.js.map +1 -1
  190. package/dist/shims/fetch-cache.d.ts +26 -10
  191. package/dist/shims/fetch-cache.js +443 -586
  192. package/dist/shims/fetch-cache.js.map +1 -1
  193. package/dist/shims/font-google-base.d.ts +28 -26
  194. package/dist/shims/font-google-base.js +238 -325
  195. package/dist/shims/font-google-base.js.map +1 -1
  196. package/dist/shims/font-google.d.ts +3 -3
  197. package/dist/shims/font-google.generated.d.ts +1928 -1924
  198. package/dist/shims/font-google.generated.js +1928 -2133
  199. package/dist/shims/font-google.generated.js.map +1 -1
  200. package/dist/shims/font-google.js +3 -3
  201. package/dist/shims/font-local.d.ts +28 -26
  202. package/dist/shims/font-local.js +204 -260
  203. package/dist/shims/font-local.js.map +1 -1
  204. package/dist/shims/form.d.ts +13 -27
  205. package/dist/shims/form.js +128 -180
  206. package/dist/shims/form.js.map +1 -1
  207. package/dist/shims/head-state.d.ts +9 -10
  208. package/dist/shims/head-state.js +25 -39
  209. package/dist/shims/head-state.js.map +1 -1
  210. package/dist/shims/head.d.ts +16 -18
  211. package/dist/shims/head.js +185 -153
  212. package/dist/shims/head.js.map +1 -1
  213. package/dist/shims/headers.d.ts +84 -71
  214. package/dist/shims/headers.js +447 -583
  215. package/dist/shims/headers.js.map +1 -1
  216. package/dist/shims/i18n-context.d.ts +23 -0
  217. package/dist/shims/i18n-context.js +44 -0
  218. package/dist/shims/i18n-context.js.map +1 -0
  219. package/dist/shims/i18n-state.d.ts +14 -0
  220. package/dist/shims/i18n-state.js +45 -0
  221. package/dist/shims/i18n-state.js.map +1 -0
  222. package/dist/shims/image-config.d.ts +11 -8
  223. package/dist/shims/image-config.js +50 -83
  224. package/dist/shims/image-config.js.map +1 -1
  225. package/dist/shims/image.d.ts +37 -44
  226. package/dist/shims/image.js +284 -301
  227. package/dist/shims/image.js.map +1 -1
  228. package/dist/shims/internal/api-utils.d.ts +7 -4
  229. package/dist/shims/internal/api-utils.js +0 -6
  230. package/dist/shims/internal/app-router-context.d.ts +22 -17
  231. package/dist/shims/internal/app-router-context.js +17 -13
  232. package/dist/shims/internal/app-router-context.js.map +1 -1
  233. package/dist/shims/internal/cookies.d.ts +2 -9
  234. package/dist/shims/internal/cookies.js +2 -9
  235. package/dist/shims/internal/parse-cookie-header.d.ts +4 -1
  236. package/dist/shims/internal/parse-cookie-header.js +29 -29
  237. package/dist/shims/internal/parse-cookie-header.js.map +1 -1
  238. package/dist/shims/internal/router-context.d.ts +6 -1
  239. package/dist/shims/internal/router-context.js +11 -7
  240. package/dist/shims/internal/router-context.js.map +1 -1
  241. package/dist/shims/internal/utils.d.ts +40 -36
  242. package/dist/shims/internal/utils.js +24 -30
  243. package/dist/shims/internal/utils.js.map +1 -1
  244. package/dist/shims/internal/work-unit-async-storage.d.ts +6 -10
  245. package/dist/shims/internal/work-unit-async-storage.js +14 -11
  246. package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
  247. package/dist/shims/layout-segment-context.d.ts +11 -14
  248. package/dist/shims/layout-segment-context.js +24 -23
  249. package/dist/shims/layout-segment-context.js.map +1 -1
  250. package/dist/shims/legacy-image.d.ts +39 -46
  251. package/dist/shims/legacy-image.js +47 -42
  252. package/dist/shims/legacy-image.js.map +1 -1
  253. package/dist/shims/link.d.ts +32 -36
  254. package/dist/shims/link.js +262 -382
  255. package/dist/shims/link.js.map +1 -1
  256. package/dist/shims/metadata.d.ts +210 -202
  257. package/dist/shims/metadata.js +545 -544
  258. package/dist/shims/metadata.js.map +1 -1
  259. package/dist/shims/navigation-state.d.ts +19 -13
  260. package/dist/shims/navigation-state.js +68 -58
  261. package/dist/shims/navigation-state.js.map +1 -1
  262. package/dist/shims/navigation.d.ts +59 -63
  263. package/dist/shims/navigation.js +508 -690
  264. package/dist/shims/navigation.js.map +1 -1
  265. package/dist/shims/og.d.ts +2 -20
  266. package/dist/shims/og.js +2 -19
  267. package/dist/shims/readonly-url-search-params.d.ts +8 -5
  268. package/dist/shims/readonly-url-search-params.js +26 -22
  269. package/dist/shims/readonly-url-search-params.js.map +1 -1
  270. package/dist/shims/request-context.d.ts +8 -5
  271. package/dist/shims/request-context.js +50 -51
  272. package/dist/shims/request-context.js.map +1 -1
  273. package/dist/shims/request-state-types.d.ts +11 -0
  274. package/dist/shims/request-state-types.js +1 -0
  275. package/dist/shims/router-state.d.ts +15 -1
  276. package/dist/shims/router-state.js +34 -41
  277. package/dist/shims/router-state.js.map +1 -1
  278. package/dist/shims/router.d.ts +81 -81
  279. package/dist/shims/router.js +517 -543
  280. package/dist/shims/router.js.map +1 -1
  281. package/dist/shims/script.d.ts +39 -48
  282. package/dist/shims/script.js +107 -160
  283. package/dist/shims/script.js.map +1 -1
  284. package/dist/shims/server-only.d.ts +1 -19
  285. package/dist/shims/server-only.js +0 -18
  286. package/dist/shims/server.d.ts +175 -157
  287. package/dist/shims/server.js +462 -432
  288. package/dist/shims/server.js.map +1 -1
  289. package/dist/shims/unified-request-context.d.ts +66 -0
  290. package/dist/shims/unified-request-context.js +98 -0
  291. package/dist/shims/unified-request-context.js.map +1 -0
  292. package/dist/shims/url-safety.d.ts +4 -1
  293. package/dist/shims/url-safety.js +15 -11
  294. package/dist/shims/url-safety.js.map +1 -1
  295. package/dist/shims/url-utils.d.ts +8 -5
  296. package/dist/shims/url-utils.js +62 -93
  297. package/dist/shims/url-utils.js.map +1 -1
  298. package/dist/shims/web-vitals.d.ts +10 -8
  299. package/dist/shims/web-vitals.js +9 -15
  300. package/dist/shims/web-vitals.js.map +1 -1
  301. package/dist/utils/base-path.d.ts +5 -2
  302. package/dist/utils/base-path.js +21 -19
  303. package/dist/utils/base-path.js.map +1 -1
  304. package/dist/utils/domain-locale.d.ts +26 -0
  305. package/dist/utils/domain-locale.js +44 -0
  306. package/dist/utils/domain-locale.js.map +1 -0
  307. package/dist/utils/hash.d.ts +4 -1
  308. package/dist/utils/hash.js +19 -17
  309. package/dist/utils/hash.js.map +1 -1
  310. package/dist/utils/manifest-paths.d.ts +6 -3
  311. package/dist/utils/manifest-paths.js +15 -16
  312. package/dist/utils/manifest-paths.js.map +1 -1
  313. package/dist/utils/project.d.ts +13 -11
  314. package/dist/utils/project.js +169 -216
  315. package/dist/utils/project.js.map +1 -1
  316. package/dist/utils/query.d.ts +8 -6
  317. package/dist/utils/query.js +57 -67
  318. package/dist/utils/query.js.map +1 -1
  319. package/package.json +11 -10
  320. package/dist/build/report.d.ts.map +0 -1
  321. package/dist/build/static-export.d.ts.map +0 -1
  322. package/dist/check.d.ts.map +0 -1
  323. package/dist/cli.d.ts.map +0 -1
  324. package/dist/client/entry.d.ts.map +0 -1
  325. package/dist/client/validate-module-path.d.ts.map +0 -1
  326. package/dist/client/vinext-next-data.d.ts.map +0 -1
  327. package/dist/client/vinext-next-data.js.map +0 -1
  328. package/dist/cloudflare/index.d.ts.map +0 -1
  329. package/dist/cloudflare/index.js.map +0 -1
  330. package/dist/cloudflare/kv-cache-handler.d.ts.map +0 -1
  331. package/dist/cloudflare/tpr.d.ts.map +0 -1
  332. package/dist/config/config-matchers.d.ts.map +0 -1
  333. package/dist/config/dotenv.d.ts.map +0 -1
  334. package/dist/config/next-config.d.ts.map +0 -1
  335. package/dist/deploy.d.ts.map +0 -1
  336. package/dist/entries/app-browser-entry.d.ts.map +0 -1
  337. package/dist/entries/app-rsc-entry.d.ts.map +0 -1
  338. package/dist/entries/app-ssr-entry.d.ts.map +0 -1
  339. package/dist/entries/pages-client-entry.d.ts.map +0 -1
  340. package/dist/entries/pages-entry-helpers.d.ts.map +0 -1
  341. package/dist/entries/pages-server-entry.d.ts.map +0 -1
  342. package/dist/index.d.ts.map +0 -1
  343. package/dist/init.d.ts.map +0 -1
  344. package/dist/plugins/async-hooks-stub.d.ts.map +0 -1
  345. package/dist/plugins/client-reference-dedup.d.ts.map +0 -1
  346. package/dist/routing/app-router.d.ts.map +0 -1
  347. package/dist/routing/file-matcher.d.ts.map +0 -1
  348. package/dist/routing/pages-router.d.ts.map +0 -1
  349. package/dist/routing/route-trie.d.ts.map +0 -1
  350. package/dist/routing/route-validation.d.ts.map +0 -1
  351. package/dist/routing/utils.d.ts.map +0 -1
  352. package/dist/server/api-handler.d.ts.map +0 -1
  353. package/dist/server/app-router-entry.d.ts.map +0 -1
  354. package/dist/server/dev-module-runner.d.ts.map +0 -1
  355. package/dist/server/dev-origin-check.d.ts.map +0 -1
  356. package/dist/server/dev-server.d.ts.map +0 -1
  357. package/dist/server/html.d.ts.map +0 -1
  358. package/dist/server/image-optimization.d.ts.map +0 -1
  359. package/dist/server/instrumentation.d.ts.map +0 -1
  360. package/dist/server/isr-cache.d.ts.map +0 -1
  361. package/dist/server/metadata-routes.d.ts.map +0 -1
  362. package/dist/server/middleware-codegen.d.ts.map +0 -1
  363. package/dist/server/middleware-request-headers.d.ts.map +0 -1
  364. package/dist/server/middleware.d.ts.map +0 -1
  365. package/dist/server/normalize-path.d.ts.map +0 -1
  366. package/dist/server/prod-server.d.ts.map +0 -1
  367. package/dist/server/request-log.d.ts.map +0 -1
  368. package/dist/server/request-pipeline.d.ts.map +0 -1
  369. package/dist/server/worker-utils.d.ts.map +0 -1
  370. package/dist/shims/amp.d.ts.map +0 -1
  371. package/dist/shims/app.d.ts.map +0 -1
  372. package/dist/shims/app.js.map +0 -1
  373. package/dist/shims/cache-runtime.d.ts.map +0 -1
  374. package/dist/shims/cache.d.ts.map +0 -1
  375. package/dist/shims/client-only.d.ts.map +0 -1
  376. package/dist/shims/client-only.js.map +0 -1
  377. package/dist/shims/compat-router.d.ts.map +0 -1
  378. package/dist/shims/config.d.ts.map +0 -1
  379. package/dist/shims/constants.d.ts.map +0 -1
  380. package/dist/shims/document.d.ts.map +0 -1
  381. package/dist/shims/dynamic.d.ts.map +0 -1
  382. package/dist/shims/error-boundary.d.ts.map +0 -1
  383. package/dist/shims/error.d.ts.map +0 -1
  384. package/dist/shims/fetch-cache.d.ts.map +0 -1
  385. package/dist/shims/font-google-base.d.ts.map +0 -1
  386. package/dist/shims/font-google.d.ts.map +0 -1
  387. package/dist/shims/font-google.generated.d.ts.map +0 -1
  388. package/dist/shims/font-google.js.map +0 -1
  389. package/dist/shims/font-local.d.ts.map +0 -1
  390. package/dist/shims/form.d.ts.map +0 -1
  391. package/dist/shims/head-state.d.ts.map +0 -1
  392. package/dist/shims/head.d.ts.map +0 -1
  393. package/dist/shims/headers.d.ts.map +0 -1
  394. package/dist/shims/image-config.d.ts.map +0 -1
  395. package/dist/shims/image.d.ts.map +0 -1
  396. package/dist/shims/internal/api-utils.d.ts.map +0 -1
  397. package/dist/shims/internal/api-utils.js.map +0 -1
  398. package/dist/shims/internal/app-router-context.d.ts.map +0 -1
  399. package/dist/shims/internal/cookies.d.ts.map +0 -1
  400. package/dist/shims/internal/cookies.js.map +0 -1
  401. package/dist/shims/internal/parse-cookie-header.d.ts.map +0 -1
  402. package/dist/shims/internal/router-context.d.ts.map +0 -1
  403. package/dist/shims/internal/utils.d.ts.map +0 -1
  404. package/dist/shims/internal/work-unit-async-storage.d.ts.map +0 -1
  405. package/dist/shims/layout-segment-context.d.ts.map +0 -1
  406. package/dist/shims/legacy-image.d.ts.map +0 -1
  407. package/dist/shims/link.d.ts.map +0 -1
  408. package/dist/shims/metadata.d.ts.map +0 -1
  409. package/dist/shims/navigation-state.d.ts.map +0 -1
  410. package/dist/shims/navigation.d.ts.map +0 -1
  411. package/dist/shims/og.d.ts.map +0 -1
  412. package/dist/shims/og.js.map +0 -1
  413. package/dist/shims/readonly-url-search-params.d.ts.map +0 -1
  414. package/dist/shims/request-context.d.ts.map +0 -1
  415. package/dist/shims/router-state.d.ts.map +0 -1
  416. package/dist/shims/router.d.ts.map +0 -1
  417. package/dist/shims/script.d.ts.map +0 -1
  418. package/dist/shims/server-only.d.ts.map +0 -1
  419. package/dist/shims/server-only.js.map +0 -1
  420. package/dist/shims/server.d.ts.map +0 -1
  421. package/dist/shims/url-safety.d.ts.map +0 -1
  422. package/dist/shims/url-utils.d.ts.map +0 -1
  423. package/dist/shims/web-vitals.d.ts.map +0 -1
  424. package/dist/utils/base-path.d.ts.map +0 -1
  425. package/dist/utils/hash.d.ts.map +0 -1
  426. package/dist/utils/manifest-paths.d.ts.map +0 -1
  427. package/dist/utils/project.d.ts.map +0 -1
  428. package/dist/utils/query.d.ts.map +0 -1
@@ -1,303 +1,274 @@
1
- /**
2
- * Build report — prints a Next.js-style route table after `vinext build`.
3
- *
4
- * Classifies every discovered route as:
5
- * ○ Static — confirmed static: force-static or revalidate=Infinity
6
- * ◐ ISR — statically rendered, revalidated on a timer (revalidate=N)
7
- * ƒ Dynamic — confirmed dynamic: force-dynamic, revalidate=0, or getServerSideProps
8
- * ? Unknown — no explicit config; likely dynamic but not confirmed
9
- * λ API — API route handler
10
- *
11
- * Classification uses regex-based static source analysis (no module
12
- * execution). Vite's parseAst() is NOT used because it doesn't handle
13
- * TypeScript syntax.
14
- *
15
- * Limitation: without running the build, we cannot detect dynamic API usage
16
- * (headers(), cookies(), connection(), etc.) that implicitly forces a route
17
- * dynamic. Routes without explicit `export const dynamic` or
18
- * `export const revalidate` are classified as "unknown" rather than "static"
19
- * to avoid false confidence.
20
- */
21
1
  import fs from "node:fs";
22
2
  import path from "node:path";
23
- // ─── Regex-based export detection ────────────────────────────────────────────
3
+ //#region src/build/report.ts
4
+ /**
5
+ * Build report — prints a Next.js-style route table after `vinext build`.
6
+ *
7
+ * Classifies every discovered route as:
8
+ * ○ Static — confirmed static: force-static or revalidate=Infinity
9
+ * ◐ ISR — statically rendered, revalidated on a timer (revalidate=N)
10
+ * ƒ Dynamic — confirmed dynamic: force-dynamic, revalidate=0, or getServerSideProps
11
+ * ? Unknown — no explicit config; likely dynamic but not confirmed
12
+ * λ API — API route handler
13
+ *
14
+ * Classification uses regex-based static source analysis (no module
15
+ * execution). Vite's parseAst() is NOT used because it doesn't handle
16
+ * TypeScript syntax.
17
+ *
18
+ * Limitation: without running the build, we cannot detect dynamic API usage
19
+ * (headers(), cookies(), connection(), etc.) that implicitly forces a route
20
+ * dynamic. Routes without explicit `export const dynamic` or
21
+ * `export const revalidate` are classified as "unknown" rather than "static"
22
+ * to avoid false confidence.
23
+ */
24
24
  /**
25
- * Returns true if the source code contains a named export with the given name.
26
- * Handles all three common export forms:
27
- * export function foo() {}
28
- * export const foo = ...
29
- * export { foo }
30
- */
31
- export function hasNamedExport(code, name) {
32
- // Function / generator / async function declaration
33
- const fnRe = new RegExp(`(?:^|\\n)\\s*export\\s+(?:async\\s+)?function\\s+${name}\\b`);
34
- if (fnRe.test(code))
35
- return true;
36
- // Variable declaration (const / let / var)
37
- const varRe = new RegExp(`(?:^|\\n)\\s*export\\s+(?:const|let|var)\\s+${name}\\s*[=:]`);
38
- if (varRe.test(code))
39
- return true;
40
- // Re-export specifier: export { foo } or export { foo as bar }
41
- const reRe = new RegExp(`export\\s*\\{[^}]*\\b${name}\\b[^}]*\\}`);
42
- if (reRe.test(code))
43
- return true;
44
- return false;
25
+ * Returns true if the source code contains a named export with the given name.
26
+ * Handles all three common export forms:
27
+ * export function foo() {}
28
+ * export const foo = ...
29
+ * export { foo }
30
+ */
31
+ function hasNamedExport(code, name) {
32
+ if (new RegExp(`(?:^|\\n)\\s*export\\s+(?:async\\s+)?function\\s+${name}\\b`).test(code)) return true;
33
+ if (new RegExp(`(?:^|\\n)\\s*export\\s+(?:const|let|var)\\s+${name}\\s*[=:]`).test(code)) return true;
34
+ if (new RegExp(`export\\s*\\{[^}]*\\b${name}\\b[^}]*\\}`).test(code)) return true;
35
+ return false;
45
36
  }
46
37
  /**
47
- * Extracts the string value of `export const <name> = "value"`.
48
- * Handles optional TypeScript type annotations:
49
- * export const dynamic: string = "force-dynamic"
50
- * Returns null if the export is absent or not a string literal.
51
- */
52
- export function extractExportConstString(code, name) {
53
- const re = new RegExp(`(?:^|\\n)\\s*export\\s+const\\s+${name}\\s*(?::[^=]+)?\\s*=\\s*['"]([^'"]+)['"]`, "m");
54
- const m = re.exec(code);
55
- return m ? m[1] : null;
38
+ * Extracts the string value of `export const <name> = "value"`.
39
+ * Handles optional TypeScript type annotations:
40
+ * export const dynamic: string = "force-dynamic"
41
+ * Returns null if the export is absent or not a string literal.
42
+ */
43
+ function extractExportConstString(code, name) {
44
+ const m = new RegExp(`^\\s*export\\s+const\\s+${name}\\s*(?::[^=]+)?\\s*=\\s*['"]([^'"]+)['"]`, "m").exec(code);
45
+ return m ? m[1] : null;
56
46
  }
57
47
  /**
58
- * Extracts the numeric value of `export const <name> = <number>`.
59
- * Supports integers, decimals, negative values, and `Infinity`.
60
- * Handles optional TypeScript type annotations.
61
- * Returns null if the export is absent or not a number.
62
- */
63
- export function extractExportConstNumber(code, name) {
64
- const re = new RegExp(`(?:^|\\n)\\s*export\\s+const\\s+${name}\\s*(?::[^=]+)?\\s*=\\s*(-?\\d+(?:\\.\\d+)?|Infinity)`, "m");
65
- const m = re.exec(code);
66
- if (!m)
67
- return null;
68
- return m[1] === "Infinity" ? Infinity : parseFloat(m[1]);
48
+ * Extracts the numeric value of `export const <name> = <number>`.
49
+ * Supports integers, decimals, negative values, and `Infinity`.
50
+ * Handles optional TypeScript type annotations.
51
+ * Returns null if the export is absent or not a number.
52
+ */
53
+ function extractExportConstNumber(code, name) {
54
+ const m = new RegExp(`^\\s*export\\s+const\\s+${name}\\s*(?::[^=]+)?\\s*=\\s*(-?\\d+(?:\\.\\d+)?|Infinity)`, "m").exec(code);
55
+ if (!m) return null;
56
+ return m[1] === "Infinity" ? Infinity : parseFloat(m[1]);
69
57
  }
70
58
  /**
71
- * Extracts the `revalidate` value from inside a `getStaticProps` return object.
72
- * Looks for: revalidate: <number> or revalidate: false or revalidate: Infinity
73
- *
74
- * Returns:
75
- * number — a positive revalidation interval (enables ISR)
76
- * 0 — treat as SSR (revalidate every request)
77
- * false — fully static (no revalidation)
78
- * Infinity — fully static (treated same as false by Next.js)
79
- * null — no `revalidate` key found (fully static)
80
- */
81
- export function extractGetStaticPropsRevalidate(code) {
82
- // TODO: This regex matches `revalidate:` anywhere in the file, not scoped to
83
- // the getStaticProps return object. A config object or comment elsewhere in
84
- // the file (e.g. `const defaults = { revalidate: 30 }`) could produce a false
85
- // positive. Rare in practice, but a proper AST-based approach would be more
86
- // accurate.
87
- const re = /\brevalidate\s*:\s*(-?\d+(?:\.\d+)?|Infinity|false)\b/;
88
- const m = re.exec(code);
89
- if (!m)
90
- return null;
91
- if (m[1] === "false")
92
- return false;
93
- if (m[1] === "Infinity")
94
- return Infinity;
95
- return parseFloat(m[1]);
59
+ * Extracts the `revalidate` value from inside a `getStaticProps` return object.
60
+ * Looks for: revalidate: <number> or revalidate: false or revalidate: Infinity
61
+ *
62
+ * Returns:
63
+ * number — a positive revalidation interval (enables ISR)
64
+ * 0 — treat as SSR (revalidate every request)
65
+ * false — fully static (no revalidation)
66
+ * Infinity — fully static (treated same as false by Next.js)
67
+ * null — no `revalidate` key found (fully static)
68
+ */
69
+ function extractGetStaticPropsRevalidate(code) {
70
+ const m = /\brevalidate\s*:\s*(-?\d+(?:\.\d+)?|Infinity|false)\b/.exec(code);
71
+ if (!m) return null;
72
+ if (m[1] === "false") return false;
73
+ if (m[1] === "Infinity") return Infinity;
74
+ return parseFloat(m[1]);
96
75
  }
97
- // ─── Route classification ─────────────────────────────────────────────────────
98
76
  /**
99
- * Classifies a Pages Router page file by reading its source and examining
100
- * which data-fetching exports it contains.
101
- *
102
- * API routes (files under pages/api/) are always `api`.
103
- */
104
- export function classifyPagesRoute(filePath) {
105
- // API routes are identified by their path
106
- const normalized = filePath.replace(/\\/g, "/");
107
- if (normalized.includes("/pages/api/")) {
108
- return { type: "api" };
109
- }
110
- let code;
111
- try {
112
- code = fs.readFileSync(filePath, "utf8");
113
- }
114
- catch {
115
- return { type: "unknown" };
116
- }
117
- if (hasNamedExport(code, "getServerSideProps")) {
118
- return { type: "ssr" };
119
- }
120
- if (hasNamedExport(code, "getStaticProps")) {
121
- const revalidate = extractGetStaticPropsRevalidate(code);
122
- if (revalidate === null || revalidate === false || revalidate === Infinity) {
123
- return { type: "static" };
124
- }
125
- if (revalidate === 0) {
126
- return { type: "ssr" };
127
- }
128
- // Positive number → ISR
129
- return { type: "isr", revalidate };
130
- }
131
- return { type: "static" };
77
+ * Classifies a Pages Router page file by reading its source and examining
78
+ * which data-fetching exports it contains.
79
+ *
80
+ * API routes (files under pages/api/) are always `api`.
81
+ */
82
+ function classifyPagesRoute(filePath) {
83
+ if (filePath.replace(/\\/g, "/").includes("/pages/api/")) return { type: "api" };
84
+ let code;
85
+ try {
86
+ code = fs.readFileSync(filePath, "utf8");
87
+ } catch {
88
+ return { type: "unknown" };
89
+ }
90
+ if (hasNamedExport(code, "getServerSideProps")) return { type: "ssr" };
91
+ if (hasNamedExport(code, "getStaticProps")) {
92
+ const revalidate = extractGetStaticPropsRevalidate(code);
93
+ if (revalidate === null || revalidate === false || revalidate === Infinity) return { type: "static" };
94
+ if (revalidate === 0) return { type: "ssr" };
95
+ return {
96
+ type: "isr",
97
+ revalidate
98
+ };
99
+ }
100
+ return { type: "static" };
132
101
  }
133
102
  /**
134
- * Classifies an App Router route.
135
- *
136
- * @param pagePath Absolute path to the page.tsx (null for API-only routes)
137
- * @param routePath Absolute path to the route.ts handler (null for page routes)
138
- * @param isDynamic Whether the URL pattern contains dynamic segments
139
- */
140
- export function classifyAppRoute(pagePath, routePath, isDynamic) {
141
- // Route handlers with no page component API
142
- if (routePath !== null && pagePath === null) {
143
- return { type: "api" };
144
- }
145
- const filePath = pagePath ?? routePath;
146
- if (!filePath)
147
- return { type: "unknown" };
148
- let code;
149
- try {
150
- code = fs.readFileSync(filePath, "utf8");
151
- }
152
- catch {
153
- return { type: "unknown" };
154
- }
155
- // Check `export const dynamic`
156
- const dynamicValue = extractExportConstString(code, "dynamic");
157
- if (dynamicValue === "force-dynamic") {
158
- return { type: "ssr" };
159
- }
160
- if (dynamicValue === "force-static" || dynamicValue === "error") {
161
- // "error" enforces static rendering — it throws if dynamic APIs are used,
162
- // so the page is statically rendered (same as force-static for classification).
163
- return { type: "static" };
164
- }
165
- // Check `export const revalidate`
166
- const revalidateValue = extractExportConstNumber(code, "revalidate");
167
- if (revalidateValue !== null) {
168
- if (revalidateValue === Infinity)
169
- return { type: "static" };
170
- if (revalidateValue === 0)
171
- return { type: "ssr" };
172
- if (revalidateValue > 0)
173
- return { type: "isr", revalidate: revalidateValue };
174
- }
175
- // Fall back to isDynamic flag (dynamic URL segments without explicit config)
176
- if (isDynamic)
177
- return { type: "ssr" };
178
- // No explicit config and no dynamic URL segments — we can't confirm static
179
- // without running the build (dynamic API calls like headers() are invisible
180
- // to static analysis). Report as unknown rather than falsely claiming static.
181
- return { type: "unknown" };
103
+ * Classifies an App Router route.
104
+ *
105
+ * @param pagePath Absolute path to the page.tsx (null for API-only routes)
106
+ * @param routePath Absolute path to the route.ts handler (null for page routes)
107
+ * @param isDynamic Whether the URL pattern contains dynamic segments
108
+ */
109
+ function classifyAppRoute(pagePath, routePath, isDynamic) {
110
+ if (routePath !== null && pagePath === null) return { type: "api" };
111
+ const filePath = pagePath ?? routePath;
112
+ if (!filePath) return { type: "unknown" };
113
+ let code;
114
+ try {
115
+ code = fs.readFileSync(filePath, "utf8");
116
+ } catch {
117
+ return { type: "unknown" };
118
+ }
119
+ const dynamicValue = extractExportConstString(code, "dynamic");
120
+ if (dynamicValue === "force-dynamic") return { type: "ssr" };
121
+ if (dynamicValue === "force-static" || dynamicValue === "error") return { type: "static" };
122
+ const revalidateValue = extractExportConstNumber(code, "revalidate");
123
+ if (revalidateValue !== null) {
124
+ if (revalidateValue === Infinity) return { type: "static" };
125
+ if (revalidateValue === 0) return { type: "ssr" };
126
+ if (revalidateValue > 0) return {
127
+ type: "isr",
128
+ revalidate: revalidateValue
129
+ };
130
+ }
131
+ if (isDynamic) return { type: "ssr" };
132
+ return { type: "unknown" };
182
133
  }
183
- // ─── Row building ─────────────────────────────────────────────────────────────
184
134
  /**
185
- * Builds a sorted list of RouteRow objects from the discovered routes.
186
- * Routes are sorted alphabetically by path, matching filesystem order.
187
- */
188
- export function buildReportRows(options) {
189
- const rows = [];
190
- for (const route of options.pageRoutes ?? []) {
191
- const { type, revalidate } = classifyPagesRoute(route.filePath);
192
- rows.push({ pattern: route.pattern, type, revalidate });
193
- }
194
- for (const route of options.apiRoutes ?? []) {
195
- rows.push({ pattern: route.pattern, type: "api" });
196
- }
197
- for (const route of options.appRoutes ?? []) {
198
- const { type, revalidate } = classifyAppRoute(route.pagePath, route.routePath, route.isDynamic);
199
- rows.push({ pattern: route.pattern, type, revalidate });
200
- }
201
- // Sort purely by path — mirrors filesystem order, matching Next.js output style
202
- rows.sort((a, b) => a.pattern.localeCompare(b.pattern));
203
- return rows;
135
+ * Builds a sorted list of RouteRow objects from the discovered routes.
136
+ * Routes are sorted alphabetically by path, matching filesystem order.
137
+ *
138
+ * When `prerenderResult` is provided, routes that were classified as `unknown`
139
+ * by static analysis but were successfully rendered speculatively are upgraded
140
+ * to `static` (confirmed by execution). The `prerendered` flag is set on those
141
+ * rows so the formatter can add a legend note.
142
+ */
143
+ function buildReportRows(options) {
144
+ const rows = [];
145
+ const renderedRoutes = /* @__PURE__ */ new Set();
146
+ if (options.prerenderResult) {
147
+ for (const r of options.prerenderResult.routes) if (r.status === "rendered") renderedRoutes.add(r.route);
148
+ }
149
+ for (const route of options.pageRoutes ?? []) {
150
+ const { type, revalidate } = classifyPagesRoute(route.filePath);
151
+ rows.push({
152
+ pattern: route.pattern,
153
+ type,
154
+ revalidate
155
+ });
156
+ }
157
+ for (const route of options.apiRoutes ?? []) rows.push({
158
+ pattern: route.pattern,
159
+ type: "api"
160
+ });
161
+ for (const route of options.appRoutes ?? []) {
162
+ const { type, revalidate } = classifyAppRoute(route.pagePath, route.routePath, route.isDynamic);
163
+ if (type === "unknown" && renderedRoutes.has(route.pattern)) rows.push({
164
+ pattern: route.pattern,
165
+ type: "static",
166
+ prerendered: true
167
+ });
168
+ else rows.push({
169
+ pattern: route.pattern,
170
+ type,
171
+ revalidate
172
+ });
173
+ }
174
+ rows.sort((a, b) => a.pattern.localeCompare(b.pattern));
175
+ return rows;
204
176
  }
205
- // ─── Formatting ───────────────────────────────────────────────────────────────
206
177
  const SYMBOLS = {
207
- static: "○",
208
- isr: "◐",
209
- ssr: "ƒ",
210
- unknown: "?",
211
- api: "λ",
178
+ static: "○",
179
+ isr: "◐",
180
+ ssr: "ƒ",
181
+ unknown: "?",
182
+ api: "λ"
212
183
  };
213
184
  const LABELS = {
214
- static: "Static",
215
- isr: "ISR",
216
- ssr: "Dynamic",
217
- unknown: "Unknown",
218
- api: "API",
185
+ static: "Static",
186
+ isr: "ISR",
187
+ ssr: "Dynamic",
188
+ unknown: "Unknown",
189
+ api: "API"
219
190
  };
220
191
  /**
221
- * Formats a list of RouteRows into a Next.js-style build report string.
222
- *
223
- * Example output:
224
- * Route (pages)
225
- * ┌ ○ /
226
- * ├ ◐ /blog/:slug (60s)
227
- * ├ ƒ /dashboard
228
- * └ λ /api/posts
229
- *
230
- * ○ Static ◐ ISR ƒ Dynamic λ API
231
- */
232
- export function formatBuildReport(rows, routerLabel = "app") {
233
- if (rows.length === 0)
234
- return "";
235
- const lines = [];
236
- lines.push(` Route (${routerLabel})`);
237
- // Determine padding width from the longest pattern
238
- const maxPatternLen = Math.max(...rows.map((r) => r.pattern.length));
239
- rows.forEach((row, i) => {
240
- const isLast = i === rows.length - 1;
241
- const corner = i === 0 ? "" : isLast ? "└" : "";
242
- const sym = SYMBOLS[row.type];
243
- const suffix = row.type === "isr" && row.revalidate !== undefined ? ` (${row.revalidate}s)` : "";
244
- const padding = " ".repeat(maxPatternLen - row.pattern.length);
245
- lines.push(` ${corner} ${sym} ${row.pattern}${padding}${suffix}`);
246
- });
247
- lines.push("");
248
- // Legend — only include types that appear in this report, sorted alphabetically by label
249
- const usedTypes = [...new Set(rows.map((r) => r.type))].sort((a, b) => LABELS[a].localeCompare(LABELS[b]));
250
- lines.push(" " + usedTypes.map((t) => `${SYMBOLS[t]} ${LABELS[t]}`).join(" "));
251
- // Explanatory note only shown when unknown routes are present
252
- if (usedTypes.includes("unknown")) {
253
- lines.push("");
254
- lines.push(" ? Some routes could not be classified. vinext currently uses static analysis");
255
- lines.push(" and cannot detect dynamic API usage (headers(), cookies(), etc.) at build time.");
256
- lines.push(" Automatic classification will be improved in a future release.");
257
- }
258
- return lines.join("\n");
192
+ * Formats a list of RouteRows into a Next.js-style build report string.
193
+ *
194
+ * Example output:
195
+ * Route (pages)
196
+ * ┌ ○ /
197
+ * ├ ◐ /blog/:slug (60s)
198
+ * ├ ƒ /dashboard
199
+ * └ λ /api/posts
200
+ *
201
+ * ○ Static ◐ ISR ƒ Dynamic λ API
202
+ */
203
+ function formatBuildReport(rows, routerLabel = "app") {
204
+ if (rows.length === 0) return "";
205
+ const lines = [];
206
+ lines.push(` Route (${routerLabel})`);
207
+ const maxPatternLen = Math.max(...rows.map((r) => r.pattern.length));
208
+ rows.forEach((row, i) => {
209
+ const isLast = i === rows.length - 1;
210
+ const corner = rows.length === 1 ? "─" : i === 0 ? "┌" : isLast ? "└" : "├";
211
+ const sym = SYMBOLS[row.type];
212
+ const suffix = row.type === "isr" && row.revalidate !== void 0 ? ` (${row.revalidate}s)` : "";
213
+ const padding = " ".repeat(maxPatternLen - row.pattern.length);
214
+ lines.push(` ${corner} ${sym} ${row.pattern}${padding}${suffix}`);
215
+ });
216
+ lines.push("");
217
+ const usedTypes = [...new Set(rows.map((r) => r.type))].sort((a, b) => LABELS[a].localeCompare(LABELS[b]));
218
+ lines.push(" " + usedTypes.map((t) => `${SYMBOLS[t]} ${LABELS[t]}`).join(" "));
219
+ if (usedTypes.includes("unknown")) {
220
+ lines.push("");
221
+ lines.push(" ? Some routes could not be classified. vinext currently uses static analysis");
222
+ lines.push(" and cannot detect dynamic API usage (headers(), cookies(), etc.) at build time.");
223
+ lines.push(" Automatic classification will be improved in a future release.");
224
+ }
225
+ if (rows.some((r) => r.prerendered)) {
226
+ lines.push("");
227
+ lines.push(" Routes marked static were confirmed by speculative prerender (attempted render");
228
+ lines.push(" succeeded without dynamic API usage).");
229
+ }
230
+ return lines.join("\n");
259
231
  }
260
- // ─── Directory detection ──────────────────────────────────────────────────────
261
232
  function findDir(root, ...candidates) {
262
- for (const candidate of candidates) {
263
- const full = path.join(root, candidate);
264
- if (fs.existsSync(full) && fs.statSync(full).isDirectory())
265
- return full;
266
- }
267
- return null;
233
+ for (const candidate of candidates) {
234
+ const full = path.join(root, candidate);
235
+ try {
236
+ if (fs.statSync(full).isDirectory()) return full;
237
+ } catch {}
238
+ }
239
+ return null;
268
240
  }
269
- // ─── Main entry point ─────────────────────────────────────────────────────────
270
241
  /**
271
- * Scans the project at `root`, classifies all routes, and prints the
272
- * Next.js-style build report to stdout.
273
- *
274
- * Called at the end of `vinext build` in cli.ts.
275
- */
276
- export async function printBuildReport(options) {
277
- const { root } = options;
278
- const appDir = findDir(root, "app", "src/app");
279
- const pagesDir = findDir(root, "pages", "src/pages");
280
- if (!appDir && !pagesDir)
281
- return;
282
- if (appDir) {
283
- // Dynamic import to avoid loading routing code unless needed
284
- const { appRouter } = await import("../routing/app-router.js");
285
- const routes = await appRouter(appDir, options.pageExtensions);
286
- const rows = buildReportRows({ appRoutes: routes });
287
- if (rows.length > 0) {
288
- console.log("\n" + formatBuildReport(rows, "app"));
289
- }
290
- }
291
- if (pagesDir) {
292
- const { pagesRouter, apiRouter } = await import("../routing/pages-router.js");
293
- const [pageRoutes, apiRoutes] = await Promise.all([
294
- pagesRouter(pagesDir, options.pageExtensions),
295
- apiRouter(pagesDir, options.pageExtensions),
296
- ]);
297
- const rows = buildReportRows({ pageRoutes, apiRoutes });
298
- if (rows.length > 0) {
299
- console.log("\n" + formatBuildReport(rows, "pages"));
300
- }
301
- }
242
+ * Scans the project at `root`, classifies all routes, and prints the
243
+ * Next.js-style build report to stdout.
244
+ *
245
+ * Called at the end of `vinext build` in cli.ts.
246
+ */
247
+ async function printBuildReport(options) {
248
+ const { root } = options;
249
+ const appDir = findDir(root, "app", "src/app");
250
+ const pagesDir = findDir(root, "pages", "src/pages");
251
+ if (!appDir && !pagesDir) return;
252
+ if (appDir) {
253
+ const { appRouter } = await import("../routing/app-router.js");
254
+ const rows = buildReportRows({
255
+ appRoutes: await appRouter(appDir, options.pageExtensions),
256
+ prerenderResult: options.prerenderResult
257
+ });
258
+ if (rows.length > 0) console.log("\n" + formatBuildReport(rows, "app"));
259
+ }
260
+ if (pagesDir) {
261
+ const { pagesRouter, apiRouter } = await import("../routing/pages-router.js");
262
+ const [pageRoutes, apiRoutes] = await Promise.all([pagesRouter(pagesDir, options.pageExtensions), apiRouter(pagesDir, options.pageExtensions)]);
263
+ const rows = buildReportRows({
264
+ pageRoutes,
265
+ apiRoutes,
266
+ prerenderResult: options.prerenderResult
267
+ });
268
+ if (rows.length > 0) console.log("\n" + formatBuildReport(rows, "pages"));
269
+ }
302
270
  }
271
+ //#endregion
272
+ export { buildReportRows, classifyAppRoute, classifyPagesRoute, extractExportConstNumber, extractExportConstString, extractGetStaticPropsRevalidate, findDir, formatBuildReport, hasNamedExport, printBuildReport };
273
+
303
274
  //# sourceMappingURL=report.js.map