vinext 0.0.30 → 0.0.32

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 (435) hide show
  1. package/README.md +15 -7
  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 +581 -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 +681 -571
  19. package/dist/check.js.map +1 -1
  20. package/dist/cli.d.ts +1 -15
  21. package/dist/cli.js +432 -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 -380
  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 +376 -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 +444 -212
  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 +86 -114
  68. package/dist/entries/pages-server-entry.js.map +1 -1
  69. package/dist/index.d.ts +92 -60
  70. package/dist/index.js +2151 -3133
  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 +560 -670
  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 +160 -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 +19 -15
  112. package/dist/server/dev-server.js +543 -871
  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 +181 -210
  119. package/dist/server/image-optimization.js.map +1 -1
  120. package/dist/server/instrumentation.d.ts +34 -59
  121. package/dist/server/instrumentation.js +112 -125
  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 +106 -128
  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 +270 -317
  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 +61 -61
  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 +32 -47
  136. package/dist/server/middleware.js +261 -409
  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 +38 -30
  142. package/dist/server/pages-i18n.js +112 -139
  143. package/dist/server/pages-i18n.js.map +1 -1
  144. package/dist/server/prod-server.d.ts +19 -31
  145. package/dist/server/prod-server.js +715 -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 +20 -45
  162. package/dist/shims/cache-runtime.js +271 -422
  163. package/dist/shims/cache-runtime.js.map +1 -1
  164. package/dist/shims/cache.d.ts +130 -121
  165. package/dist/shims/cache.js +339 -427
  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 +6 -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 -164
  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 +16 -14
  191. package/dist/shims/fetch-cache.js +439 -645
  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 +8 -13
  208. package/dist/shims/head-state.js +25 -42
  209. package/dist/shims/head-state.js.map +1 -1
  210. package/dist/shims/head.d.ts +17 -20
  211. package/dist/shims/head.js +194 -250
  212. package/dist/shims/head.js.map +1 -1
  213. package/dist/shims/headers.d.ts +84 -78
  214. package/dist/shims/headers.js +447 -575
  215. package/dist/shims/headers.js.map +1 -1
  216. package/dist/shims/i18n-context.d.ts +16 -20
  217. package/dist/shims/i18n-context.js +35 -48
  218. package/dist/shims/i18n-context.js.map +1 -1
  219. package/dist/shims/i18n-state.d.ts +8 -14
  220. package/dist/shims/i18n-state.js +34 -42
  221. package/dist/shims/i18n-state.js.map +1 -1
  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 -46
  226. package/dist/shims/image.js +283 -308
  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 +7 -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 -37
  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 +255 -391
  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 -546
  258. package/dist/shims/metadata.js.map +1 -1
  259. package/dist/shims/navigation-state.d.ts +10 -18
  260. package/dist/shims/navigation-state.js +66 -74
  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 +505 -704
  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 -60
  272. package/dist/shims/request-context.js.map +1 -1
  273. package/dist/shims/request-state-types.d.ts +11 -11
  274. package/dist/shims/request-state-types.js +0 -1
  275. package/dist/shims/router-state.d.ts +13 -10
  276. package/dist/shims/router-state.js +34 -43
  277. package/dist/shims/router-state.js.map +1 -1
  278. package/dist/shims/router.d.ts +81 -85
  279. package/dist/shims/router.js +506 -628
  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 +213 -164
  287. package/dist/shims/server.js +545 -478
  288. package/dist/shims/server.js.map +1 -1
  289. package/dist/shims/unified-request-context.d.ts +20 -20
  290. package/dist/shims/unified-request-context.js +81 -99
  291. package/dist/shims/unified-request-context.js.map +1 -1
  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 +17 -9
  305. package/dist/utils/domain-locale.js +36 -56
  306. package/dist/utils/domain-locale.js.map +1 -1
  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 +10 -9
  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/pages-i18n.d.ts.map +0 -1
  367. package/dist/server/prod-server.d.ts.map +0 -1
  368. package/dist/server/request-log.d.ts.map +0 -1
  369. package/dist/server/request-pipeline.d.ts.map +0 -1
  370. package/dist/server/worker-utils.d.ts.map +0 -1
  371. package/dist/shims/amp.d.ts.map +0 -1
  372. package/dist/shims/app.d.ts.map +0 -1
  373. package/dist/shims/app.js.map +0 -1
  374. package/dist/shims/cache-runtime.d.ts.map +0 -1
  375. package/dist/shims/cache.d.ts.map +0 -1
  376. package/dist/shims/client-only.d.ts.map +0 -1
  377. package/dist/shims/client-only.js.map +0 -1
  378. package/dist/shims/compat-router.d.ts.map +0 -1
  379. package/dist/shims/config.d.ts.map +0 -1
  380. package/dist/shims/constants.d.ts.map +0 -1
  381. package/dist/shims/document.d.ts.map +0 -1
  382. package/dist/shims/dynamic.d.ts.map +0 -1
  383. package/dist/shims/error-boundary.d.ts.map +0 -1
  384. package/dist/shims/error.d.ts.map +0 -1
  385. package/dist/shims/fetch-cache.d.ts.map +0 -1
  386. package/dist/shims/font-google-base.d.ts.map +0 -1
  387. package/dist/shims/font-google.d.ts.map +0 -1
  388. package/dist/shims/font-google.generated.d.ts.map +0 -1
  389. package/dist/shims/font-google.js.map +0 -1
  390. package/dist/shims/font-local.d.ts.map +0 -1
  391. package/dist/shims/form.d.ts.map +0 -1
  392. package/dist/shims/head-state.d.ts.map +0 -1
  393. package/dist/shims/head.d.ts.map +0 -1
  394. package/dist/shims/headers.d.ts.map +0 -1
  395. package/dist/shims/i18n-context.d.ts.map +0 -1
  396. package/dist/shims/i18n-state.d.ts.map +0 -1
  397. package/dist/shims/image-config.d.ts.map +0 -1
  398. package/dist/shims/image.d.ts.map +0 -1
  399. package/dist/shims/internal/api-utils.d.ts.map +0 -1
  400. package/dist/shims/internal/api-utils.js.map +0 -1
  401. package/dist/shims/internal/app-router-context.d.ts.map +0 -1
  402. package/dist/shims/internal/cookies.d.ts.map +0 -1
  403. package/dist/shims/internal/cookies.js.map +0 -1
  404. package/dist/shims/internal/parse-cookie-header.d.ts.map +0 -1
  405. package/dist/shims/internal/router-context.d.ts.map +0 -1
  406. package/dist/shims/internal/utils.d.ts.map +0 -1
  407. package/dist/shims/internal/work-unit-async-storage.d.ts.map +0 -1
  408. package/dist/shims/layout-segment-context.d.ts.map +0 -1
  409. package/dist/shims/legacy-image.d.ts.map +0 -1
  410. package/dist/shims/link.d.ts.map +0 -1
  411. package/dist/shims/metadata.d.ts.map +0 -1
  412. package/dist/shims/navigation-state.d.ts.map +0 -1
  413. package/dist/shims/navigation.d.ts.map +0 -1
  414. package/dist/shims/og.d.ts.map +0 -1
  415. package/dist/shims/og.js.map +0 -1
  416. package/dist/shims/readonly-url-search-params.d.ts.map +0 -1
  417. package/dist/shims/request-context.d.ts.map +0 -1
  418. package/dist/shims/request-state-types.d.ts.map +0 -1
  419. package/dist/shims/request-state-types.js.map +0 -1
  420. package/dist/shims/router-state.d.ts.map +0 -1
  421. package/dist/shims/router.d.ts.map +0 -1
  422. package/dist/shims/script.d.ts.map +0 -1
  423. package/dist/shims/server-only.d.ts.map +0 -1
  424. package/dist/shims/server-only.js.map +0 -1
  425. package/dist/shims/server.d.ts.map +0 -1
  426. package/dist/shims/unified-request-context.d.ts.map +0 -1
  427. package/dist/shims/url-safety.d.ts.map +0 -1
  428. package/dist/shims/url-utils.d.ts.map +0 -1
  429. package/dist/shims/web-vitals.d.ts.map +0 -1
  430. package/dist/utils/base-path.d.ts.map +0 -1
  431. package/dist/utils/domain-locale.d.ts.map +0 -1
  432. package/dist/utils/hash.d.ts.map +0 -1
  433. package/dist/utils/manifest-paths.d.ts.map +0 -1
  434. package/dist/utils/project.d.ts.map +0 -1
  435. package/dist/utils/query.d.ts.map +0 -1
@@ -1,303 +1,608 @@
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 returnObjects = extractGetStaticPropsReturnObjects(code);
71
+ if (returnObjects) {
72
+ for (const searchSpace of returnObjects) {
73
+ const revalidate = extractTopLevelRevalidateValue(searchSpace);
74
+ if (revalidate !== null) return revalidate;
75
+ }
76
+ return null;
77
+ }
78
+ const m = /\brevalidate\s*:\s*(-?\d+(?:\.\d+)?|Infinity|false)\b/.exec(code);
79
+ if (!m) return null;
80
+ if (m[1] === "false") return false;
81
+ if (m[1] === "Infinity") return Infinity;
82
+ return parseFloat(m[1]);
83
+ }
84
+ function extractTopLevelRevalidateValue(code) {
85
+ let braceDepth = 0;
86
+ let parenDepth = 0;
87
+ let bracketDepth = 0;
88
+ let quote = null;
89
+ let inLineComment = false;
90
+ let inBlockComment = false;
91
+ for (let i = 0; i < code.length; i++) {
92
+ const char = code[i];
93
+ const next = code[i + 1];
94
+ if (inLineComment) {
95
+ if (char === "\n") inLineComment = false;
96
+ continue;
97
+ }
98
+ if (inBlockComment) {
99
+ if (char === "*" && next === "/") {
100
+ inBlockComment = false;
101
+ i++;
102
+ }
103
+ continue;
104
+ }
105
+ if (quote) {
106
+ if (char === "\\") {
107
+ i++;
108
+ continue;
109
+ }
110
+ if (char === quote) quote = null;
111
+ continue;
112
+ }
113
+ if (char === "/" && next === "/") {
114
+ inLineComment = true;
115
+ i++;
116
+ continue;
117
+ }
118
+ if (char === "/" && next === "*") {
119
+ inBlockComment = true;
120
+ i++;
121
+ continue;
122
+ }
123
+ if (char === "\"" || char === "'" || char === "`") {
124
+ quote = char;
125
+ continue;
126
+ }
127
+ if (char === "{") {
128
+ braceDepth++;
129
+ continue;
130
+ }
131
+ if (char === "}") {
132
+ braceDepth--;
133
+ continue;
134
+ }
135
+ if (char === "(") {
136
+ parenDepth++;
137
+ continue;
138
+ }
139
+ if (char === ")") {
140
+ parenDepth--;
141
+ continue;
142
+ }
143
+ if (char === "[") {
144
+ bracketDepth++;
145
+ continue;
146
+ }
147
+ if (char === "]") {
148
+ bracketDepth--;
149
+ continue;
150
+ }
151
+ if (braceDepth === 1 && parenDepth === 0 && bracketDepth === 0 && matchesKeywordAt(code, i, "revalidate")) {
152
+ const colonIndex = findNextNonWhitespaceIndex(code, i + 10);
153
+ if (colonIndex === -1 || code[colonIndex] !== ":") continue;
154
+ const valueStart = findNextNonWhitespaceIndex(code, colonIndex + 1);
155
+ if (valueStart === -1) return null;
156
+ const valueMatch = /^(-?\d+(?:\.\d+)?|Infinity|false)\b/.exec(code.slice(valueStart));
157
+ if (!valueMatch) return null;
158
+ if (valueMatch[1] === "false") return false;
159
+ if (valueMatch[1] === "Infinity") return Infinity;
160
+ return parseFloat(valueMatch[1]);
161
+ }
162
+ }
163
+ return null;
164
+ }
165
+ function extractGetStaticPropsReturnObjects(code) {
166
+ const declarationMatch = /(?:^|\n)\s*(?:export\s+)?(?:async\s+)?function\s+getStaticProps\b|(?:^|\n)\s*(?:export\s+)?(?:const|let|var)\s+getStaticProps\b/.exec(code);
167
+ if (!declarationMatch) {
168
+ if (/(?:^|\n)\s*export\s*\{[^}]*\bgetStaticProps\b[^}]*\}\s*from\b/.test(code)) return [];
169
+ return null;
170
+ }
171
+ const declaration = extractGetStaticPropsDeclaration(code, declarationMatch);
172
+ if (declaration === null) return [];
173
+ const returnObjects = declaration.trimStart().startsWith("{") ? collectReturnObjectsFromFunctionBody(declaration) : [];
174
+ if (returnObjects.length > 0) return returnObjects;
175
+ const arrowMatch = declaration.search(/=>\s*\(\s*\{/);
176
+ if (arrowMatch === -1) return [];
177
+ const braceStart = declaration.indexOf("{", arrowMatch);
178
+ if (braceStart === -1) return [];
179
+ const braceEnd = findMatchingBrace(declaration, braceStart);
180
+ if (braceEnd === -1) return [];
181
+ return [declaration.slice(braceStart, braceEnd + 1)];
182
+ }
183
+ function extractGetStaticPropsDeclaration(code, declarationMatch) {
184
+ const declarationStart = declarationMatch.index;
185
+ const declarationText = declarationMatch[0];
186
+ const declarationTail = code.slice(declarationStart);
187
+ if (declarationText.includes("function getStaticProps")) return extractFunctionBody(code, declarationStart + declarationText.length);
188
+ const functionExpressionMatch = /(?:async\s+)?function\b/.exec(declarationTail);
189
+ if (functionExpressionMatch) return extractFunctionBody(declarationTail, functionExpressionMatch.index);
190
+ const blockBodyMatch = /=>\s*\{/.exec(declarationTail);
191
+ if (blockBodyMatch) {
192
+ const braceStart = declarationTail.indexOf("{", blockBodyMatch.index);
193
+ if (braceStart === -1) return null;
194
+ const braceEnd = findMatchingBrace(declarationTail, braceStart);
195
+ if (braceEnd === -1) return null;
196
+ return declarationTail.slice(braceStart, braceEnd + 1);
197
+ }
198
+ const implicitArrowMatch = declarationTail.search(/=>\s*\(\s*\{/);
199
+ if (implicitArrowMatch === -1) return null;
200
+ const implicitBraceStart = declarationTail.indexOf("{", implicitArrowMatch);
201
+ if (implicitBraceStart === -1) return null;
202
+ const implicitBraceEnd = findMatchingBrace(declarationTail, implicitBraceStart);
203
+ if (implicitBraceEnd === -1) return null;
204
+ return declarationTail.slice(0, implicitBraceEnd + 1);
205
+ }
206
+ function extractFunctionBody(code, functionStart) {
207
+ const bodyEnd = findFunctionBodyEnd(code, functionStart);
208
+ if (bodyEnd === -1) return null;
209
+ const paramsStart = code.indexOf("(", functionStart);
210
+ if (paramsStart === -1) return null;
211
+ const paramsEnd = findMatchingParen(code, paramsStart);
212
+ if (paramsEnd === -1) return null;
213
+ const bodyStart = code.indexOf("{", paramsEnd + 1);
214
+ if (bodyStart === -1) return null;
215
+ return code.slice(bodyStart, bodyEnd + 1);
216
+ }
217
+ function collectReturnObjectsFromFunctionBody(code) {
218
+ const returnObjects = [];
219
+ let quote = null;
220
+ let inLineComment = false;
221
+ let inBlockComment = false;
222
+ for (let i = 0; i < code.length; i++) {
223
+ const char = code[i];
224
+ const next = code[i + 1];
225
+ if (inLineComment) {
226
+ if (char === "\n") inLineComment = false;
227
+ continue;
228
+ }
229
+ if (inBlockComment) {
230
+ if (char === "*" && next === "/") {
231
+ inBlockComment = false;
232
+ i++;
233
+ }
234
+ continue;
235
+ }
236
+ if (quote) {
237
+ if (char === "\\") {
238
+ i++;
239
+ continue;
240
+ }
241
+ if (char === quote) quote = null;
242
+ continue;
243
+ }
244
+ if (char === "/" && next === "/") {
245
+ inLineComment = true;
246
+ i++;
247
+ continue;
248
+ }
249
+ if (char === "/" && next === "*") {
250
+ inBlockComment = true;
251
+ i++;
252
+ continue;
253
+ }
254
+ if (char === "\"" || char === "'" || char === "`") {
255
+ quote = char;
256
+ continue;
257
+ }
258
+ if (matchesKeywordAt(code, i, "function")) {
259
+ const nestedBodyEnd = findFunctionBodyEnd(code, i);
260
+ if (nestedBodyEnd !== -1) i = nestedBodyEnd;
261
+ continue;
262
+ }
263
+ if (matchesKeywordAt(code, i, "class")) {
264
+ const classBodyEnd = findClassBodyEnd(code, i);
265
+ if (classBodyEnd !== -1) i = classBodyEnd;
266
+ continue;
267
+ }
268
+ if (char === "=" && next === ">") {
269
+ const nestedBodyEnd = findArrowFunctionBodyEnd(code, i);
270
+ if (nestedBodyEnd !== -1) i = nestedBodyEnd;
271
+ continue;
272
+ }
273
+ if (char >= "A" && char <= "Z" || char >= "a" && char <= "z" || char === "_" || char === "$" || char === "*") {
274
+ const methodBodyEnd = findObjectMethodBodyEnd(code, i);
275
+ if (methodBodyEnd !== -1) {
276
+ i = methodBodyEnd;
277
+ continue;
278
+ }
279
+ }
280
+ if (matchesKeywordAt(code, i, "return")) {
281
+ const braceStart = findNextNonWhitespaceIndex(code, i + 6);
282
+ if (braceStart === -1 || code[braceStart] !== "{") continue;
283
+ const braceEnd = findMatchingBrace(code, braceStart);
284
+ if (braceEnd === -1) continue;
285
+ returnObjects.push(code.slice(braceStart, braceEnd + 1));
286
+ i = braceEnd;
287
+ }
288
+ }
289
+ return returnObjects;
290
+ }
291
+ function findFunctionBodyEnd(code, functionStart) {
292
+ const paramsStart = code.indexOf("(", functionStart);
293
+ if (paramsStart === -1) return -1;
294
+ const paramsEnd = findMatchingParen(code, paramsStart);
295
+ if (paramsEnd === -1) return -1;
296
+ const bodyStart = code.indexOf("{", paramsEnd + 1);
297
+ if (bodyStart === -1) return -1;
298
+ return findMatchingBrace(code, bodyStart);
299
+ }
300
+ function findClassBodyEnd(code, classStart) {
301
+ const bodyStart = code.indexOf("{", classStart + 5);
302
+ if (bodyStart === -1) return -1;
303
+ return findMatchingBrace(code, bodyStart);
304
+ }
305
+ function findArrowFunctionBodyEnd(code, arrowIndex) {
306
+ const bodyStart = findNextNonWhitespaceIndex(code, arrowIndex + 2);
307
+ if (bodyStart === -1 || code[bodyStart] !== "{") return -1;
308
+ return findMatchingBrace(code, bodyStart);
309
+ }
310
+ function findObjectMethodBodyEnd(code, start) {
311
+ let i = start;
312
+ if (matchesKeywordAt(code, i, "async")) {
313
+ const afterAsync = findNextNonWhitespaceIndex(code, i + 5);
314
+ if (afterAsync === -1) return -1;
315
+ if (code[afterAsync] !== "(") i = afterAsync;
316
+ }
317
+ if (code[i] === "*") {
318
+ i = findNextNonWhitespaceIndex(code, i + 1);
319
+ if (i === -1) return -1;
320
+ }
321
+ if (!/[A-Za-z_$]/.test(code[i] ?? "")) return -1;
322
+ const nameStart = i;
323
+ while (/[A-Za-z0-9_$]/.test(code[i] ?? "")) i++;
324
+ const name = code.slice(nameStart, i);
325
+ if (name === "if" || name === "for" || name === "while" || name === "switch" || name === "catch" || name === "function" || name === "return" || name === "const" || name === "let" || name === "var" || name === "new") return -1;
326
+ if (name === "get" || name === "set") {
327
+ const afterAccessor = findNextNonWhitespaceIndex(code, i);
328
+ if (afterAccessor === -1) return -1;
329
+ if (code[afterAccessor] !== "(") {
330
+ i = afterAccessor;
331
+ if (!/[A-Za-z_$]/.test(code[i] ?? "")) return -1;
332
+ while (/[A-Za-z0-9_$]/.test(code[i] ?? "")) i++;
333
+ }
334
+ }
335
+ const paramsStart = findNextNonWhitespaceIndex(code, i);
336
+ if (paramsStart === -1 || code[paramsStart] !== "(") return -1;
337
+ const paramsEnd = findMatchingParen(code, paramsStart);
338
+ if (paramsEnd === -1) return -1;
339
+ const bodyStart = findNextNonWhitespaceIndex(code, paramsEnd + 1);
340
+ if (bodyStart === -1 || code[bodyStart] !== "{") return -1;
341
+ return findMatchingBrace(code, bodyStart);
342
+ }
343
+ function findNextNonWhitespaceIndex(code, start) {
344
+ for (let i = start; i < code.length; i++) if (!/\s/.test(code[i])) return i;
345
+ return -1;
346
+ }
347
+ function matchesKeywordAt(code, index, keyword) {
348
+ const before = index === 0 ? "" : code[index - 1];
349
+ const after = code[index + keyword.length] ?? "";
350
+ return code.startsWith(keyword, index) && (before === "" || !/[A-Za-z0-9_$]/.test(before)) && (after === "" || !/[A-Za-z0-9_$]/.test(after));
351
+ }
352
+ function findMatchingBrace(code, start) {
353
+ return findMatchingToken(code, start, "{", "}");
354
+ }
355
+ function findMatchingParen(code, start) {
356
+ return findMatchingToken(code, start, "(", ")");
357
+ }
358
+ function findMatchingToken(code, start, openToken, closeToken) {
359
+ let depth = 0;
360
+ let quote = null;
361
+ let inLineComment = false;
362
+ let inBlockComment = false;
363
+ for (let i = start; i < code.length; i++) {
364
+ const char = code[i];
365
+ const next = code[i + 1];
366
+ if (inLineComment) {
367
+ if (char === "\n") inLineComment = false;
368
+ continue;
369
+ }
370
+ if (inBlockComment) {
371
+ if (char === "*" && next === "/") {
372
+ inBlockComment = false;
373
+ i++;
374
+ }
375
+ continue;
376
+ }
377
+ if (quote) {
378
+ if (char === "\\") {
379
+ i++;
380
+ continue;
381
+ }
382
+ if (char === quote) quote = null;
383
+ continue;
384
+ }
385
+ if (char === "/" && next === "/") {
386
+ inLineComment = true;
387
+ i++;
388
+ continue;
389
+ }
390
+ if (char === "/" && next === "*") {
391
+ inBlockComment = true;
392
+ i++;
393
+ continue;
394
+ }
395
+ if (char === "\"" || char === "'" || char === "`") {
396
+ quote = char;
397
+ continue;
398
+ }
399
+ if (char === openToken) {
400
+ depth++;
401
+ continue;
402
+ }
403
+ if (char === closeToken) {
404
+ depth--;
405
+ if (depth === 0) return i;
406
+ }
407
+ }
408
+ return -1;
96
409
  }
97
- // ─── Route classification ─────────────────────────────────────────────────────
98
410
  /**
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" };
411
+ * Classifies a Pages Router page file by reading its source and examining
412
+ * which data-fetching exports it contains.
413
+ *
414
+ * API routes (files under pages/api/) are always `api`.
415
+ */
416
+ function classifyPagesRoute(filePath) {
417
+ if (filePath.replace(/\\/g, "/").includes("/pages/api/")) return { type: "api" };
418
+ let code;
419
+ try {
420
+ code = fs.readFileSync(filePath, "utf8");
421
+ } catch {
422
+ return { type: "unknown" };
423
+ }
424
+ if (hasNamedExport(code, "getServerSideProps")) return { type: "ssr" };
425
+ if (hasNamedExport(code, "getStaticProps")) {
426
+ const revalidate = extractGetStaticPropsRevalidate(code);
427
+ if (revalidate === null || revalidate === false || revalidate === Infinity) return { type: "static" };
428
+ if (revalidate === 0) return { type: "ssr" };
429
+ return {
430
+ type: "isr",
431
+ revalidate
432
+ };
433
+ }
434
+ return { type: "static" };
132
435
  }
133
436
  /**
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" };
437
+ * Classifies an App Router route.
438
+ *
439
+ * @param pagePath Absolute path to the page.tsx (null for API-only routes)
440
+ * @param routePath Absolute path to the route.ts handler (null for page routes)
441
+ * @param isDynamic Whether the URL pattern contains dynamic segments
442
+ */
443
+ function classifyAppRoute(pagePath, routePath, isDynamic) {
444
+ if (routePath !== null && pagePath === null) return { type: "api" };
445
+ const filePath = pagePath ?? routePath;
446
+ if (!filePath) return { type: "unknown" };
447
+ let code;
448
+ try {
449
+ code = fs.readFileSync(filePath, "utf8");
450
+ } catch {
451
+ return { type: "unknown" };
452
+ }
453
+ const dynamicValue = extractExportConstString(code, "dynamic");
454
+ if (dynamicValue === "force-dynamic") return { type: "ssr" };
455
+ if (dynamicValue === "force-static" || dynamicValue === "error") return { type: "static" };
456
+ const revalidateValue = extractExportConstNumber(code, "revalidate");
457
+ if (revalidateValue !== null) {
458
+ if (revalidateValue === Infinity) return { type: "static" };
459
+ if (revalidateValue === 0) return { type: "ssr" };
460
+ if (revalidateValue > 0) return {
461
+ type: "isr",
462
+ revalidate: revalidateValue
463
+ };
464
+ }
465
+ if (isDynamic) return { type: "ssr" };
466
+ return { type: "unknown" };
182
467
  }
183
- // ─── Row building ─────────────────────────────────────────────────────────────
184
468
  /**
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;
469
+ * Builds a sorted list of RouteRow objects from the discovered routes.
470
+ * Routes are sorted alphabetically by path, matching filesystem order.
471
+ *
472
+ * When `prerenderResult` is provided, routes that were classified as `unknown`
473
+ * by static analysis but were successfully rendered speculatively are upgraded
474
+ * to `static` (confirmed by execution). The `prerendered` flag is set on those
475
+ * rows so the formatter can add a legend note.
476
+ */
477
+ function buildReportRows(options) {
478
+ const rows = [];
479
+ const renderedRoutes = /* @__PURE__ */ new Set();
480
+ if (options.prerenderResult) {
481
+ for (const r of options.prerenderResult.routes) if (r.status === "rendered") renderedRoutes.add(r.route);
482
+ }
483
+ for (const route of options.pageRoutes ?? []) {
484
+ const { type, revalidate } = classifyPagesRoute(route.filePath);
485
+ rows.push({
486
+ pattern: route.pattern,
487
+ type,
488
+ revalidate
489
+ });
490
+ }
491
+ for (const route of options.apiRoutes ?? []) rows.push({
492
+ pattern: route.pattern,
493
+ type: "api"
494
+ });
495
+ for (const route of options.appRoutes ?? []) {
496
+ const { type, revalidate } = classifyAppRoute(route.pagePath, route.routePath, route.isDynamic);
497
+ if (type === "unknown" && renderedRoutes.has(route.pattern)) rows.push({
498
+ pattern: route.pattern,
499
+ type: "static",
500
+ prerendered: true
501
+ });
502
+ else rows.push({
503
+ pattern: route.pattern,
504
+ type,
505
+ revalidate
506
+ });
507
+ }
508
+ rows.sort((a, b) => a.pattern.localeCompare(b.pattern));
509
+ return rows;
204
510
  }
205
- // ─── Formatting ───────────────────────────────────────────────────────────────
206
511
  const SYMBOLS = {
207
- static: "○",
208
- isr: "◐",
209
- ssr: "ƒ",
210
- unknown: "?",
211
- api: "λ",
512
+ static: "○",
513
+ isr: "◐",
514
+ ssr: "ƒ",
515
+ unknown: "?",
516
+ api: "λ"
212
517
  };
213
518
  const LABELS = {
214
- static: "Static",
215
- isr: "ISR",
216
- ssr: "Dynamic",
217
- unknown: "Unknown",
218
- api: "API",
519
+ static: "Static",
520
+ isr: "ISR",
521
+ ssr: "Dynamic",
522
+ unknown: "Unknown",
523
+ api: "API"
219
524
  };
220
525
  /**
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");
526
+ * Formats a list of RouteRows into a Next.js-style build report string.
527
+ *
528
+ * Example output:
529
+ * Route (pages)
530
+ * ┌ ○ /
531
+ * ├ ◐ /blog/:slug (60s)
532
+ * ├ ƒ /dashboard
533
+ * └ λ /api/posts
534
+ *
535
+ * ○ Static ◐ ISR ƒ Dynamic λ API
536
+ */
537
+ function formatBuildReport(rows, routerLabel = "app") {
538
+ if (rows.length === 0) return "";
539
+ const lines = [];
540
+ lines.push(` Route (${routerLabel})`);
541
+ const maxPatternLen = Math.max(...rows.map((r) => r.pattern.length));
542
+ rows.forEach((row, i) => {
543
+ const isLast = i === rows.length - 1;
544
+ const corner = rows.length === 1 ? "─" : i === 0 ? "┌" : isLast ? "└" : "├";
545
+ const sym = SYMBOLS[row.type];
546
+ const suffix = row.type === "isr" && row.revalidate !== void 0 ? ` (${row.revalidate}s)` : "";
547
+ const padding = " ".repeat(maxPatternLen - row.pattern.length);
548
+ lines.push(` ${corner} ${sym} ${row.pattern}${padding}${suffix}`);
549
+ });
550
+ lines.push("");
551
+ const usedTypes = [...new Set(rows.map((r) => r.type))].sort((a, b) => LABELS[a].localeCompare(LABELS[b]));
552
+ lines.push(" " + usedTypes.map((t) => `${SYMBOLS[t]} ${LABELS[t]}`).join(" "));
553
+ if (usedTypes.includes("unknown")) {
554
+ lines.push("");
555
+ lines.push(" ? Some routes could not be classified. vinext currently uses static analysis");
556
+ lines.push(" and cannot detect dynamic API usage (headers(), cookies(), etc.) at build time.");
557
+ lines.push(" Automatic classification will be improved in a future release.");
558
+ }
559
+ if (rows.some((r) => r.prerendered)) {
560
+ lines.push("");
561
+ lines.push(" Routes marked static were confirmed by speculative prerender (attempted render");
562
+ lines.push(" succeeded without dynamic API usage).");
563
+ }
564
+ return lines.join("\n");
259
565
  }
260
- // ─── Directory detection ──────────────────────────────────────────────────────
261
566
  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;
567
+ for (const candidate of candidates) {
568
+ const full = path.join(root, candidate);
569
+ try {
570
+ if (fs.statSync(full).isDirectory()) return full;
571
+ } catch {}
572
+ }
573
+ return null;
268
574
  }
269
- // ─── Main entry point ─────────────────────────────────────────────────────────
270
575
  /**
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
- }
576
+ * Scans the project at `root`, classifies all routes, and prints the
577
+ * Next.js-style build report to stdout.
578
+ *
579
+ * Called at the end of `vinext build` in cli.ts.
580
+ */
581
+ async function printBuildReport(options) {
582
+ const { root } = options;
583
+ const appDir = findDir(root, "app", "src/app");
584
+ const pagesDir = findDir(root, "pages", "src/pages");
585
+ if (!appDir && !pagesDir) return;
586
+ if (appDir) {
587
+ const { appRouter } = await import("../routing/app-router.js");
588
+ const rows = buildReportRows({
589
+ appRoutes: await appRouter(appDir, options.pageExtensions),
590
+ prerenderResult: options.prerenderResult
591
+ });
592
+ if (rows.length > 0) console.log("\n" + formatBuildReport(rows, "app"));
593
+ }
594
+ if (pagesDir) {
595
+ const { pagesRouter, apiRouter } = await import("../routing/pages-router.js");
596
+ const [pageRoutes, apiRoutes] = await Promise.all([pagesRouter(pagesDir, options.pageExtensions), apiRouter(pagesDir, options.pageExtensions)]);
597
+ const rows = buildReportRows({
598
+ pageRoutes,
599
+ apiRoutes,
600
+ prerenderResult: options.prerenderResult
601
+ });
602
+ if (rows.length > 0) console.log("\n" + formatBuildReport(rows, "pages"));
603
+ }
302
604
  }
605
+ //#endregion
606
+ export { buildReportRows, classifyAppRoute, classifyPagesRoute, extractExportConstNumber, extractExportConstString, extractGetStaticPropsRevalidate, findDir, formatBuildReport, hasNamedExport, printBuildReport };
607
+
303
608
  //# sourceMappingURL=report.js.map