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,513 +1,425 @@
1
- /**
2
- * next.config.js / next.config.mjs / next.config.ts parser
3
- *
4
- * Loads the Next.js config file (if present) and extracts supported options.
5
- * Unsupported options are logged as warnings.
6
- */
7
- import path from "node:path";
1
+ import { normalizePageExtensions } from "../routing/file-matcher.js";
2
+ import { isExternalUrl } from "./config-matchers.js";
3
+ import { PHASE_DEVELOPMENT_SERVER } from "../shims/constants.js";
8
4
  import { createRequire } from "node:module";
9
5
  import fs from "node:fs";
6
+ import path from "node:path";
10
7
  import { randomUUID } from "node:crypto";
11
- import { PHASE_DEVELOPMENT_SERVER } from "../shims/constants.js";
12
- import { normalizePageExtensions } from "../routing/file-matcher.js";
13
- import { isExternalUrl } from "./config-matchers.js";
8
+ //#region src/config/next-config.ts
14
9
  /**
15
- * Parse a body size limit value (string or number) into bytes.
16
- * Accepts Next.js-style strings like "1mb", "500kb", "10mb", bare number strings like "1048576" (bytes),
17
- * and numeric values. Supports b, kb, mb, gb, tb, pb units.
18
- * Returns the default 1MB if the value is not provided or invalid.
19
- * Throws if the parsed value is less than 1.
20
- */
21
- export function parseBodySizeLimit(value) {
22
- if (value === undefined || value === null)
23
- return 1 * 1024 * 1024;
24
- if (typeof value === "number") {
25
- if (value < 1)
26
- throw new Error(`Body size limit must be a positive number, got ${value}`);
27
- return value;
28
- }
29
- const trimmed = value.trim();
30
- const match = trimmed.match(/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb|tb|pb)?$/i);
31
- if (!match) {
32
- console.warn(`[vinext] Invalid bodySizeLimit value: "${value}". Expected a number or a string like "1mb", "500kb". Falling back to 1MB.`);
33
- return 1 * 1024 * 1024;
34
- }
35
- const num = parseFloat(match[1]);
36
- const unit = (match[2] ?? "b").toLowerCase();
37
- let bytes;
38
- switch (unit) {
39
- case "b":
40
- bytes = Math.floor(num);
41
- break;
42
- case "kb":
43
- bytes = Math.floor(num * 1024);
44
- break;
45
- case "mb":
46
- bytes = Math.floor(num * 1024 * 1024);
47
- break;
48
- case "gb":
49
- bytes = Math.floor(num * 1024 * 1024 * 1024);
50
- break;
51
- case "tb":
52
- bytes = Math.floor(num * 1024 * 1024 * 1024 * 1024);
53
- break;
54
- case "pb":
55
- bytes = Math.floor(num * 1024 * 1024 * 1024 * 1024 * 1024);
56
- break;
57
- default:
58
- return 1 * 1024 * 1024;
59
- }
60
- if (bytes < 1)
61
- throw new Error(`Body size limit must be a positive number, got ${bytes}`);
62
- return bytes;
10
+ * next.config.js / next.config.mjs / next.config.ts parser
11
+ *
12
+ * Loads the Next.js config file (if present) and extracts supported options.
13
+ * Unsupported options are logged as warnings.
14
+ */
15
+ /**
16
+ * Parse a body size limit value (string or number) into bytes.
17
+ * Accepts Next.js-style strings like "1mb", "500kb", "10mb", bare number strings like "1048576" (bytes),
18
+ * and numeric values. Supports b, kb, mb, gb, tb, pb units.
19
+ * Returns the default 1MB if the value is not provided or invalid.
20
+ * Throws if the parsed value is less than 1.
21
+ */
22
+ function parseBodySizeLimit(value) {
23
+ if (value === void 0 || value === null) return 1 * 1024 * 1024;
24
+ if (typeof value === "number") {
25
+ if (value < 1) throw new Error(`Body size limit must be a positive number, got ${value}`);
26
+ return value;
27
+ }
28
+ const match = value.trim().match(/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb|tb|pb)?$/i);
29
+ if (!match) {
30
+ console.warn(`[vinext] Invalid bodySizeLimit value: "${value}". Expected a number or a string like "1mb", "500kb". Falling back to 1MB.`);
31
+ return 1 * 1024 * 1024;
32
+ }
33
+ const num = parseFloat(match[1]);
34
+ const unit = (match[2] ?? "b").toLowerCase();
35
+ let bytes;
36
+ switch (unit) {
37
+ case "b":
38
+ bytes = Math.floor(num);
39
+ break;
40
+ case "kb":
41
+ bytes = Math.floor(num * 1024);
42
+ break;
43
+ case "mb":
44
+ bytes = Math.floor(num * 1024 * 1024);
45
+ break;
46
+ case "gb":
47
+ bytes = Math.floor(num * 1024 * 1024 * 1024);
48
+ break;
49
+ case "tb":
50
+ bytes = Math.floor(num * 1024 * 1024 * 1024 * 1024);
51
+ break;
52
+ case "pb":
53
+ bytes = Math.floor(num * 1024 * 1024 * 1024 * 1024 * 1024);
54
+ break;
55
+ default: return 1 * 1024 * 1024;
56
+ }
57
+ if (bytes < 1) throw new Error(`Body size limit must be a positive number, got ${bytes}`);
58
+ return bytes;
63
59
  }
64
- const CONFIG_FILES = ["next.config.ts", "next.config.mjs", "next.config.js", "next.config.cjs"];
60
+ const CONFIG_FILES = [
61
+ "next.config.ts",
62
+ "next.config.mjs",
63
+ "next.config.js",
64
+ "next.config.cjs"
65
+ ];
65
66
  /**
66
- * Check whether an error indicates a CJS module was loaded in an ESM context
67
- * (i.e. the file uses `require()` which is not available in ESM).
68
- */
67
+ * Check whether an error indicates a CJS module was loaded in an ESM context
68
+ * (i.e. the file uses `require()` which is not available in ESM).
69
+ */
69
70
  function isCjsError(e) {
70
- if (!(e instanceof Error))
71
- return false;
72
- const msg = e.message;
73
- return (msg.includes("require is not a function") ||
74
- msg.includes("require is not defined") ||
75
- msg.includes("exports is not defined") ||
76
- msg.includes("module is not defined") ||
77
- msg.includes("__dirname is not defined") ||
78
- msg.includes("__filename is not defined"));
71
+ if (!(e instanceof Error)) return false;
72
+ const msg = e.message;
73
+ return msg.includes("require is not a function") || msg.includes("require is not defined") || msg.includes("exports is not defined") || msg.includes("module is not defined") || msg.includes("__dirname is not defined") || msg.includes("__filename is not defined");
79
74
  }
80
75
  /**
81
- * Emit a warning when config loading fails, with a targeted hint for
82
- * known plugin wrappers that are unnecessary in vinext.
83
- */
76
+ * Emit a warning when config loading fails, with a targeted hint for
77
+ * known plugin wrappers that are unnecessary in vinext.
78
+ */
84
79
  function warnConfigLoadFailure(filename, err) {
85
- const msg = err.message ?? "";
86
- const stack = err.stack ?? "";
87
- const isNextIntlPlugin = msg.includes("next-intl") ||
88
- stack.includes("next-intl/plugin") ||
89
- stack.includes("next-intl/dist");
90
- console.warn(`[vinext] Failed to load ${filename}: ${msg}`);
91
- if (isNextIntlPlugin) {
92
- console.warn("[vinext] Hint: createNextIntlPlugin() is not needed with vinext. " +
93
- "Remove the next-intl/plugin wrapper from your next.config — " +
94
- "vinext auto-detects next-intl and registers the i18n config alias automatically.");
95
- }
80
+ const msg = err.message ?? "";
81
+ const stack = err.stack ?? "";
82
+ const isNextIntlPlugin = msg.includes("next-intl") || stack.includes("next-intl/plugin") || stack.includes("next-intl/dist");
83
+ console.log();
84
+ console.error(`[vinext] Failed to load ${filename}: ${msg}`);
85
+ console.log();
86
+ if (isNextIntlPlugin) console.warn("[vinext] Hint: createNextIntlPlugin() is not needed with vinext. Remove the next-intl/plugin wrapper from your next.config — vinext auto-detects next-intl and registers the i18n config alias automatically.");
96
87
  }
97
88
  /**
98
- * Unwrap the config value from a loaded module, calling it if it's a
99
- * function-form config (Next.js supports `module.exports = (phase, opts) => config`).
100
- */
89
+ * Unwrap the config value from a loaded module, calling it if it's a
90
+ * function-form config (Next.js supports `module.exports = (phase, opts) => config`).
91
+ */
101
92
  async function unwrapConfig(mod, phase = PHASE_DEVELOPMENT_SERVER) {
102
- const config = mod.default ?? mod;
103
- if (typeof config === "function") {
104
- const result = await config(phase, {
105
- defaultConfig: {},
106
- });
107
- return result;
108
- }
109
- return config;
93
+ const config = mod.default ?? mod;
94
+ if (typeof config === "function") return await config(phase, { defaultConfig: {} });
95
+ return config;
110
96
  }
111
97
  /**
112
- * Find and load the next.config file from the project root.
113
- * Returns null if no config file is found.
114
- *
115
- * Attempts Vite's module runner first so TS configs and extensionless local
116
- * imports (e.g. `import "./env"`) resolve consistently. If loading fails due
117
- * to CJS constructs (`require`, `module.exports`), falls back to `createRequire`
118
- * so common CJS plugin wrappers (nextra, @next/mdx, etc.) still work.
119
- */
120
- export async function loadNextConfig(root, phase = PHASE_DEVELOPMENT_SERVER) {
121
- for (const filename of CONFIG_FILES) {
122
- const configPath = path.join(root, filename);
123
- if (!fs.existsSync(configPath))
124
- continue;
125
- try {
126
- // Load config via Vite's module runner (TS + extensionless import support)
127
- const { runnerImport } = await import("vite");
128
- const { module: mod } = await runnerImport(configPath, {
129
- root,
130
- logLevel: "error",
131
- clearScreen: false,
132
- });
133
- return await unwrapConfig(mod, phase);
134
- }
135
- catch (e) {
136
- // If the error indicates a CJS file loaded in ESM context, retry with
137
- // createRequire which provides a proper CommonJS environment.
138
- if (isCjsError(e) && (filename.endsWith(".js") || filename.endsWith(".cjs"))) {
139
- try {
140
- const require = createRequire(path.join(root, "package.json"));
141
- const mod = require(configPath);
142
- return await unwrapConfig({ default: mod }, phase);
143
- }
144
- catch (e2) {
145
- warnConfigLoadFailure(filename, e2);
146
- return null;
147
- }
148
- }
149
- warnConfigLoadFailure(filename, e);
150
- return null;
151
- }
152
- }
153
- return null;
98
+ * Find and load the next.config file from the project root.
99
+ * Returns null if no config file is found.
100
+ *
101
+ * Attempts Vite's module runner first so TS configs and extensionless local
102
+ * imports (e.g. `import "./env"`) resolve consistently. If loading fails due
103
+ * to CJS constructs (`require`, `module.exports`), falls back to `createRequire`
104
+ * so common CJS plugin wrappers (nextra, @next/mdx, etc.) still work.
105
+ */
106
+ async function loadNextConfig(root, phase = PHASE_DEVELOPMENT_SERVER) {
107
+ for (const filename of CONFIG_FILES) {
108
+ const configPath = path.join(root, filename);
109
+ if (!fs.existsSync(configPath)) continue;
110
+ try {
111
+ const { runnerImport } = await import("vite");
112
+ const { module: mod } = await runnerImport(configPath, {
113
+ root,
114
+ logLevel: "error",
115
+ clearScreen: false
116
+ });
117
+ return await unwrapConfig(mod, phase);
118
+ } catch (e) {
119
+ if (isCjsError(e) && (filename.endsWith(".js") || filename.endsWith(".cjs"))) try {
120
+ return await unwrapConfig({ default: createRequire(path.join(root, "package.json"))(configPath) }, phase);
121
+ } catch (e2) {
122
+ warnConfigLoadFailure(filename, e2);
123
+ throw e2;
124
+ }
125
+ warnConfigLoadFailure(filename, e);
126
+ throw e;
127
+ }
128
+ }
129
+ return null;
154
130
  }
155
131
  /**
156
- * Generate a UUID that doesn't contain "ad" to avoid false-positive ad-blocker hits.
157
- * Mirrors Next.js's own nanoid retry loop.
158
- */
132
+ * Generate a UUID that doesn't contain "ad" to avoid false-positive ad-blocker hits.
133
+ * Mirrors Next.js's own nanoid retry loop.
134
+ */
159
135
  function safeUUID() {
160
- let id = randomUUID();
161
- while (/ad/i.test(id))
162
- id = randomUUID();
163
- return id;
136
+ let id = randomUUID();
137
+ while (/ad/i.test(id)) id = randomUUID();
138
+ return id;
164
139
  }
165
140
  /**
166
- * Call the user's generateBuildId function and validate its return value.
167
- * Follows Next.js semantics: null return falls back to a random UUID; any
168
- * other non-string throws. Leading/trailing whitespace is trimmed.
169
- *
170
- * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/generateBuildId
171
- */
141
+ * Call the user's generateBuildId function and validate its return value.
142
+ * Follows Next.js semantics: null return falls back to a random UUID; any
143
+ * other non-string throws. Leading/trailing whitespace is trimmed.
144
+ *
145
+ * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/generateBuildId
146
+ */
172
147
  async function resolveBuildId(generate) {
173
- if (!generate)
174
- return safeUUID();
175
- const result = await generate();
176
- if (result === null)
177
- return safeUUID();
178
- if (typeof result !== "string") {
179
- throw new Error("generateBuildId did not return a string. https://nextjs.org/docs/messages/generatebuildid-not-a-string");
180
- }
181
- const trimmed = result.trim();
182
- if (trimmed.length === 0) {
183
- throw new Error("generateBuildId returned an empty string. https://nextjs.org/docs/messages/generatebuildid-not-a-string");
184
- }
185
- return trimmed;
148
+ if (!generate) return safeUUID();
149
+ const result = await generate();
150
+ if (result === null) return safeUUID();
151
+ if (typeof result !== "string") throw new Error("generateBuildId did not return a string. https://nextjs.org/docs/messages/generatebuildid-not-a-string");
152
+ const trimmed = result.trim();
153
+ if (trimmed.length === 0) throw new Error("generateBuildId returned an empty string. https://nextjs.org/docs/messages/generatebuildid-not-a-string");
154
+ return trimmed;
186
155
  }
187
156
  /**
188
- * Resolve a NextConfig into a fully-resolved ResolvedNextConfig.
189
- * Awaits async functions for redirects/rewrites/headers.
190
- */
191
- export async function resolveNextConfig(config, root = process.cwd()) {
192
- if (!config) {
193
- const buildId = await resolveBuildId(undefined);
194
- const resolved = {
195
- env: {},
196
- basePath: "",
197
- trailingSlash: false,
198
- output: "",
199
- pageExtensions: normalizePageExtensions(),
200
- cacheComponents: false,
201
- redirects: [],
202
- rewrites: { beforeFiles: [], afterFiles: [], fallback: [] },
203
- headers: [],
204
- images: undefined,
205
- i18n: null,
206
- mdx: null,
207
- aliases: {},
208
- allowedDevOrigins: [],
209
- serverActionsAllowedOrigins: [],
210
- serverActionsBodySizeLimit: 1 * 1024 * 1024,
211
- buildId,
212
- };
213
- detectNextIntlConfig(root, resolved);
214
- return resolved;
215
- }
216
- // Resolve redirects
217
- let redirects = [];
218
- if (config.redirects) {
219
- const result = await config.redirects();
220
- redirects = Array.isArray(result) ? result : [];
221
- }
222
- // Resolve rewrites
223
- let rewrites = {
224
- beforeFiles: [],
225
- afterFiles: [],
226
- fallback: [],
227
- };
228
- if (config.rewrites) {
229
- const result = await config.rewrites();
230
- if (Array.isArray(result)) {
231
- rewrites.afterFiles = result;
232
- }
233
- else {
234
- rewrites = {
235
- beforeFiles: result.beforeFiles ?? [],
236
- afterFiles: result.afterFiles ?? [],
237
- fallback: result.fallback ?? [],
238
- };
239
- }
240
- }
241
- {
242
- const allRewrites = [...rewrites.beforeFiles, ...rewrites.afterFiles, ...rewrites.fallback];
243
- const externalRewrites = allRewrites.filter((rewrite) => isExternalUrl(rewrite.destination));
244
- if (externalRewrites.length > 0) {
245
- const noun = externalRewrites.length === 1 ? "external rewrite" : "external rewrites";
246
- const listing = externalRewrites
247
- .map((rewrite) => ` ${rewrite.source} ${rewrite.destination}`)
248
- .join("\n");
249
- console.warn(`[vinext] Found ${externalRewrites.length} ${noun} that proxy requests to external origins:\n` +
250
- `${listing}\n` +
251
- `Request headers, including credential headers (cookie, authorization, proxy-authorization, x-api-key), ` +
252
- `are forwarded to the external origin to match Next.js behavior. ` +
253
- `If you do not want to forward credentials, use an API route or route handler where you control exactly which headers are sent.`);
254
- }
255
- }
256
- // Resolve headers
257
- let headers = [];
258
- if (config.headers) {
259
- headers = await config.headers();
260
- }
261
- // Probe wrapped webpack config once so alias extraction and MDX extraction
262
- // observe the same mock environment.
263
- const webpackProbe = await probeWebpackConfig(config, root);
264
- const mdx = webpackProbe.mdx;
265
- const aliases = {
266
- ...extractTurboAliases(config, root),
267
- ...webpackProbe.aliases,
268
- };
269
- const allowedDevOrigins = Array.isArray(config.allowedDevOrigins) ? config.allowedDevOrigins : [];
270
- // Resolve serverActions.allowedOrigins and bodySizeLimit from experimental config
271
- const experimental = config.experimental;
272
- const serverActionsConfig = experimental?.serverActions;
273
- const serverActionsAllowedOrigins = Array.isArray(serverActionsConfig?.allowedOrigins)
274
- ? serverActionsConfig.allowedOrigins
275
- : [];
276
- const serverActionsBodySizeLimit = parseBodySizeLimit(serverActionsConfig?.bodySizeLimit);
277
- // Warn about unsupported webpack usage. We preserve alias injection and
278
- // extract MDX settings, but all other webpack customization is still ignored.
279
- if (config.webpack !== undefined) {
280
- if (mdx || Object.keys(webpackProbe.aliases).length > 0) {
281
- console.warn('[vinext] next.config option "webpack" is only partially supported. ' +
282
- "vinext preserves resolve.alias entries and MDX loader settings, but other webpack customization is ignored");
283
- }
284
- else {
285
- console.warn('[vinext] next.config option "webpack" is not yet supported and will be ignored');
286
- }
287
- }
288
- const output = config.output ?? "";
289
- if (output && output !== "export" && output !== "standalone") {
290
- console.warn(`[vinext] Unknown output mode "${output}", ignoring`);
291
- }
292
- const pageExtensions = normalizePageExtensions(config.pageExtensions);
293
- // Parse i18n config
294
- let i18n = null;
295
- if (config.i18n) {
296
- i18n = {
297
- locales: config.i18n.locales,
298
- defaultLocale: config.i18n.defaultLocale,
299
- localeDetection: config.i18n.localeDetection ?? true,
300
- domains: config.i18n.domains,
301
- };
302
- }
303
- const buildId = await resolveBuildId(config.generateBuildId);
304
- const resolved = {
305
- env: config.env ?? {},
306
- basePath: config.basePath ?? "",
307
- trailingSlash: config.trailingSlash ?? false,
308
- output: output === "export" || output === "standalone" ? output : "",
309
- pageExtensions,
310
- cacheComponents: config.cacheComponents ?? false,
311
- redirects,
312
- rewrites,
313
- headers,
314
- images: config.images,
315
- i18n,
316
- mdx,
317
- aliases,
318
- allowedDevOrigins,
319
- serverActionsAllowedOrigins,
320
- serverActionsBodySizeLimit,
321
- buildId,
322
- };
323
- // Auto-detect next-intl (lowest priority — explicit aliases from
324
- // webpack/turbopack already in `aliases` take precedence)
325
- detectNextIntlConfig(root, resolved);
326
- return resolved;
157
+ * Resolve a NextConfig into a fully-resolved ResolvedNextConfig.
158
+ * Awaits async functions for redirects/rewrites/headers.
159
+ */
160
+ async function resolveNextConfig(config, root = process.cwd()) {
161
+ if (!config) {
162
+ const buildId = await resolveBuildId(void 0);
163
+ const resolved = {
164
+ env: {},
165
+ basePath: "",
166
+ trailingSlash: false,
167
+ output: "",
168
+ pageExtensions: normalizePageExtensions(),
169
+ cacheComponents: false,
170
+ redirects: [],
171
+ rewrites: {
172
+ beforeFiles: [],
173
+ afterFiles: [],
174
+ fallback: []
175
+ },
176
+ headers: [],
177
+ images: void 0,
178
+ i18n: null,
179
+ mdx: null,
180
+ aliases: {},
181
+ allowedDevOrigins: [],
182
+ serverActionsAllowedOrigins: [],
183
+ serverActionsBodySizeLimit: 1 * 1024 * 1024,
184
+ serverExternalPackages: [],
185
+ buildId
186
+ };
187
+ detectNextIntlConfig(root, resolved);
188
+ return resolved;
189
+ }
190
+ let redirects = [];
191
+ if (config.redirects) {
192
+ const result = await config.redirects();
193
+ redirects = Array.isArray(result) ? result : [];
194
+ }
195
+ let rewrites = {
196
+ beforeFiles: [],
197
+ afterFiles: [],
198
+ fallback: []
199
+ };
200
+ if (config.rewrites) {
201
+ const result = await config.rewrites();
202
+ if (Array.isArray(result)) rewrites.afterFiles = result;
203
+ else rewrites = {
204
+ beforeFiles: result.beforeFiles ?? [],
205
+ afterFiles: result.afterFiles ?? [],
206
+ fallback: result.fallback ?? []
207
+ };
208
+ }
209
+ {
210
+ const externalRewrites = [
211
+ ...rewrites.beforeFiles,
212
+ ...rewrites.afterFiles,
213
+ ...rewrites.fallback
214
+ ].filter((rewrite) => isExternalUrl(rewrite.destination));
215
+ if (externalRewrites.length > 0) {
216
+ const noun = externalRewrites.length === 1 ? "external rewrite" : "external rewrites";
217
+ const listing = externalRewrites.map((rewrite) => ` ${rewrite.source} → ${rewrite.destination}`).join("\n");
218
+ console.warn(`[vinext] Found ${externalRewrites.length} ${noun} that proxy requests to external origins:\n${listing}\nRequest headers, including credential headers (cookie, authorization, proxy-authorization, x-api-key), are forwarded to the external origin to match Next.js behavior. If you do not want to forward credentials, use an API route or route handler where you control exactly which headers are sent.`);
219
+ }
220
+ }
221
+ let headers = [];
222
+ if (config.headers) headers = await config.headers();
223
+ const webpackProbe = await probeWebpackConfig(config, root);
224
+ const mdx = webpackProbe.mdx;
225
+ const aliases = {
226
+ ...extractTurboAliases(config, root),
227
+ ...webpackProbe.aliases
228
+ };
229
+ const allowedDevOrigins = Array.isArray(config.allowedDevOrigins) ? config.allowedDevOrigins : [];
230
+ const experimental = config.experimental;
231
+ const serverActionsConfig = experimental?.serverActions;
232
+ const serverActionsAllowedOrigins = Array.isArray(serverActionsConfig?.allowedOrigins) ? serverActionsConfig.allowedOrigins : [];
233
+ const serverActionsBodySizeLimit = parseBodySizeLimit(serverActionsConfig?.bodySizeLimit);
234
+ const legacyServerComponentsExternal = experimental?.serverComponentsExternalPackages;
235
+ const serverExternalPackages = Array.isArray(config.serverExternalPackages) ? config.serverExternalPackages : Array.isArray(legacyServerComponentsExternal) ? legacyServerComponentsExternal : [];
236
+ if (config.webpack !== void 0) if (mdx || Object.keys(webpackProbe.aliases).length > 0) console.warn("[vinext] next.config option \"webpack\" is only partially supported. vinext preserves resolve.alias entries and MDX loader settings, but other webpack customization is ignored");
237
+ else console.warn("[vinext] next.config option \"webpack\" is not yet supported and will be ignored");
238
+ const output = config.output ?? "";
239
+ if (output && output !== "export" && output !== "standalone") console.warn(`[vinext] Unknown output mode "${output}", ignoring`);
240
+ const pageExtensions = normalizePageExtensions(config.pageExtensions);
241
+ let i18n = null;
242
+ if (config.i18n) i18n = {
243
+ locales: config.i18n.locales,
244
+ defaultLocale: config.i18n.defaultLocale,
245
+ localeDetection: config.i18n.localeDetection ?? true,
246
+ domains: config.i18n.domains
247
+ };
248
+ const buildId = await resolveBuildId(config.generateBuildId);
249
+ const resolved = {
250
+ env: config.env ?? {},
251
+ basePath: config.basePath ?? "",
252
+ trailingSlash: config.trailingSlash ?? false,
253
+ output: output === "export" || output === "standalone" ? output : "",
254
+ pageExtensions,
255
+ cacheComponents: config.cacheComponents ?? false,
256
+ redirects,
257
+ rewrites,
258
+ headers,
259
+ images: config.images,
260
+ i18n,
261
+ mdx,
262
+ aliases,
263
+ allowedDevOrigins,
264
+ serverActionsAllowedOrigins,
265
+ serverActionsBodySizeLimit,
266
+ serverExternalPackages,
267
+ buildId
268
+ };
269
+ detectNextIntlConfig(root, resolved);
270
+ return resolved;
327
271
  }
328
272
  function normalizeAliasEntries(aliases, root) {
329
- if (!aliases)
330
- return {};
331
- const normalized = {};
332
- for (const [key, value] of Object.entries(aliases)) {
333
- if (typeof value !== "string")
334
- continue;
335
- normalized[key] = path.isAbsolute(value) ? value : path.resolve(root, value);
336
- }
337
- return normalized;
273
+ if (!aliases) return {};
274
+ const normalized = {};
275
+ for (const [key, value] of Object.entries(aliases)) {
276
+ if (typeof value !== "string") continue;
277
+ normalized[key] = path.isAbsolute(value) ? value : path.resolve(root, value);
278
+ }
279
+ return normalized;
338
280
  }
339
281
  function extractTurboAliases(config, root) {
340
- const experimental = config.experimental;
341
- const experimentalTurbo = experimental?.turbo;
342
- const topLevelTurbopack = config.turbopack;
343
- return {
344
- ...normalizeAliasEntries(experimentalTurbo?.resolveAlias, root),
345
- ...normalizeAliasEntries(topLevelTurbopack?.resolveAlias, root),
346
- };
282
+ const experimentalTurbo = config.experimental?.turbo;
283
+ const topLevelTurbopack = config.turbopack;
284
+ return {
285
+ ...normalizeAliasEntries(experimentalTurbo?.resolveAlias, root),
286
+ ...normalizeAliasEntries(topLevelTurbopack?.resolveAlias, root)
287
+ };
347
288
  }
348
289
  async function probeWebpackConfig(config, root) {
349
- if (typeof config.webpack !== "function") {
350
- return { aliases: {}, mdx: null };
351
- }
352
- const mockModuleRules = [];
353
- const mockConfig = {
354
- context: root,
355
- resolve: { alias: {} },
356
- module: { rules: mockModuleRules },
357
- plugins: [],
358
- };
359
- const mockOptions = {
360
- defaultLoaders: { babel: { loader: "next-babel-loader" } },
361
- isServer: false,
362
- dev: false,
363
- dir: root,
364
- };
365
- try {
366
- const result = await config.webpack(mockConfig, mockOptions);
367
- const finalConfig = result ?? mockConfig;
368
- const rules = finalConfig.module?.rules ?? mockModuleRules;
369
- return {
370
- aliases: normalizeAliasEntries(finalConfig.resolve?.alias, root),
371
- mdx: extractMdxOptionsFromRules(rules),
372
- };
373
- }
374
- catch {
375
- return { aliases: {}, mdx: null };
376
- }
290
+ if (typeof config.webpack !== "function") return {
291
+ aliases: {},
292
+ mdx: null
293
+ };
294
+ const mockModuleRules = [];
295
+ const mockConfig = {
296
+ context: root,
297
+ resolve: { alias: {} },
298
+ module: { rules: mockModuleRules },
299
+ plugins: []
300
+ };
301
+ const mockOptions = {
302
+ defaultLoaders: { babel: { loader: "next-babel-loader" } },
303
+ isServer: false,
304
+ dev: false,
305
+ dir: root
306
+ };
307
+ try {
308
+ const finalConfig = await config.webpack(mockConfig, mockOptions) ?? mockConfig;
309
+ const rules = finalConfig.module?.rules ?? mockModuleRules;
310
+ return {
311
+ aliases: normalizeAliasEntries(finalConfig.resolve?.alias, root),
312
+ mdx: extractMdxOptionsFromRules(rules)
313
+ };
314
+ } catch {
315
+ return {
316
+ aliases: {},
317
+ mdx: null
318
+ };
319
+ }
377
320
  }
378
321
  /**
379
- * Extract MDX compilation options (remark/rehype/recma plugins) from
380
- * a Next.js config that uses @next/mdx.
381
- *
382
- * @next/mdx wraps the config with a webpack function that injects an MDX
383
- * loader rule. The remark/rehype plugins are captured in that closure.
384
- * We probe the webpack function with a mock config to extract them.
385
- */
386
- export async function extractMdxOptions(config, root = process.cwd()) {
387
- return (await probeWebpackConfig(config, root)).mdx;
322
+ * Extract MDX compilation options (remark/rehype/recma plugins) from
323
+ * a Next.js config that uses @next/mdx.
324
+ *
325
+ * @next/mdx wraps the config with a webpack function that injects an MDX
326
+ * loader rule. The remark/rehype plugins are captured in that closure.
327
+ * We probe the webpack function with a mock config to extract them.
328
+ */
329
+ async function extractMdxOptions(config, root = process.cwd()) {
330
+ return (await probeWebpackConfig(config, root)).mdx;
388
331
  }
389
332
  /**
390
- * Probe file candidates relative to root. Returns the first one that exists,
391
- * or null if none match.
392
- */
333
+ * Probe file candidates relative to root. Returns the first one that exists,
334
+ * or null if none match.
335
+ */
393
336
  function probeFiles(root, candidates) {
394
- for (const candidate of candidates) {
395
- const abs = path.resolve(root, candidate);
396
- if (fs.existsSync(abs))
397
- return abs;
398
- }
399
- return null;
337
+ for (const candidate of candidates) {
338
+ const abs = path.resolve(root, candidate);
339
+ if (fs.existsSync(abs)) return abs;
340
+ }
341
+ return null;
400
342
  }
401
343
  const I18N_REQUEST_CANDIDATES = [
402
- "i18n/request.ts",
403
- "i18n/request.tsx",
404
- "i18n/request.js",
405
- "i18n/request.jsx",
406
- "src/i18n/request.ts",
407
- "src/i18n/request.tsx",
408
- "src/i18n/request.js",
409
- "src/i18n/request.jsx",
344
+ "i18n/request.ts",
345
+ "i18n/request.tsx",
346
+ "i18n/request.js",
347
+ "i18n/request.jsx",
348
+ "src/i18n/request.ts",
349
+ "src/i18n/request.tsx",
350
+ "src/i18n/request.js",
351
+ "src/i18n/request.jsx"
410
352
  ];
411
353
  /**
412
- * Detect next-intl in the project and auto-register the `next-intl/config`
413
- * alias if needed.
414
- *
415
- * next-intl's `createNextIntlPlugin()` crashes in vinext because it calls
416
- * `require('next/package.json')` to check the Next.js version. Instead,
417
- * vinext detects next-intl and registers the alias automatically.
418
- *
419
- * Note: `require.resolve('next-intl')` walks up to parent `node_modules`
420
- * directories via standard Node module resolution. In a monorepo, next-intl
421
- * installed at the workspace root will trigger detection even if not listed
422
- * in the project's own package.json. This is acceptable since a workspace-root
423
- * install implies the user wants it available.
424
- *
425
- * Mutates `resolved.aliases` and `resolved.env` in place.
426
- */
427
- export function detectNextIntlConfig(root, resolved) {
428
- // Explicit alias wins — user or plugin already set it
429
- if (resolved.aliases["next-intl/config"])
430
- return;
431
- // Check if next-intl is installed (use main entry — some packages
432
- // don't expose ./package.json in their exports map)
433
- const require = createRequire(path.join(root, "package.json"));
434
- try {
435
- require.resolve("next-intl");
436
- }
437
- catch {
438
- return; // next-intl not installed
439
- }
440
- // Probe for the i18n request config file
441
- const configPath = probeFiles(root, I18N_REQUEST_CANDIDATES);
442
- if (!configPath)
443
- return;
444
- resolved.aliases["next-intl/config"] = configPath;
445
- if (resolved.trailingSlash) {
446
- resolved.env._next_intl_trailing_slash = "true";
447
- }
354
+ * Detect next-intl in the project and auto-register the `next-intl/config`
355
+ * alias if needed.
356
+ *
357
+ * next-intl's `createNextIntlPlugin()` crashes in vinext because it calls
358
+ * `require('next/package.json')` to check the Next.js version. Instead,
359
+ * vinext detects next-intl and registers the alias automatically.
360
+ *
361
+ * Note: `require.resolve('next-intl')` walks up to parent `node_modules`
362
+ * directories via standard Node module resolution. In a monorepo, next-intl
363
+ * installed at the workspace root will trigger detection even if not listed
364
+ * in the project's own package.json. This is acceptable since a workspace-root
365
+ * install implies the user wants it available.
366
+ *
367
+ * Mutates `resolved.aliases` and `resolved.env` in place.
368
+ */
369
+ function detectNextIntlConfig(root, resolved) {
370
+ if (resolved.aliases["next-intl/config"]) return;
371
+ const require = createRequire(path.join(root, "package.json"));
372
+ try {
373
+ require.resolve("next-intl");
374
+ } catch {
375
+ return;
376
+ }
377
+ const configPath = probeFiles(root, I18N_REQUEST_CANDIDATES);
378
+ if (!configPath) return;
379
+ resolved.aliases["next-intl/config"] = configPath;
380
+ if (resolved.trailingSlash) resolved.env._next_intl_trailing_slash = "true";
448
381
  }
449
382
  function extractMdxOptionsFromRules(rules) {
450
- // Search through webpack rules for the MDX loader injected by @next/mdx
451
- for (const rule of rules) {
452
- const loaders = extractMdxLoaders(rule);
453
- if (loaders)
454
- return loaders;
455
- }
456
- return null;
383
+ for (const rule of rules) {
384
+ const loaders = extractMdxLoaders(rule);
385
+ if (loaders) return loaders;
386
+ }
387
+ return null;
457
388
  }
458
389
  /**
459
- * Recursively search a webpack rule (which may have nested `oneOf` arrays)
460
- * for an MDX loader and extract its remark/rehype/recma plugin options.
461
- */
390
+ * Recursively search a webpack rule (which may have nested `oneOf` arrays)
391
+ * for an MDX loader and extract its remark/rehype/recma plugin options.
392
+ */
462
393
  function extractMdxLoaders(rule) {
463
- if (!rule)
464
- return null;
465
- // Check `oneOf` arrays (Next.js uses these extensively)
466
- if (Array.isArray(rule.oneOf)) {
467
- for (const child of rule.oneOf) {
468
- const result = extractMdxLoaders(child);
469
- if (result)
470
- return result;
471
- }
472
- }
473
- // Check `use` array (loader chain)
474
- const use = Array.isArray(rule.use) ? rule.use : rule.use ? [rule.use] : [];
475
- for (const loader of use) {
476
- const loaderPath = typeof loader === "string" ? loader : loader?.loader;
477
- if (typeof loaderPath === "string" && isMdxLoader(loaderPath)) {
478
- const opts = typeof loader === "object" ? loader.options : {};
479
- return extractPluginsFromOptions(opts);
480
- }
481
- }
482
- // Check direct `loader` field
483
- if (typeof rule.loader === "string" && isMdxLoader(rule.loader)) {
484
- return extractPluginsFromOptions(rule.options);
485
- }
486
- return null;
394
+ if (!rule) return null;
395
+ if (Array.isArray(rule.oneOf)) for (const child of rule.oneOf) {
396
+ const result = extractMdxLoaders(child);
397
+ if (result) return result;
398
+ }
399
+ const use = Array.isArray(rule.use) ? rule.use : rule.use ? [rule.use] : [];
400
+ for (const loader of use) {
401
+ const loaderPath = typeof loader === "string" ? loader : loader?.loader;
402
+ if (typeof loaderPath === "string" && isMdxLoader(loaderPath)) return extractPluginsFromOptions(typeof loader === "object" ? loader.options : {});
403
+ }
404
+ if (typeof rule.loader === "string" && isMdxLoader(rule.loader)) return extractPluginsFromOptions(rule.options);
405
+ return null;
487
406
  }
488
407
  function isMdxLoader(loaderPath) {
489
- return (loaderPath.includes("mdx") &&
490
- (loaderPath.includes("@next") ||
491
- loaderPath.includes("@mdx-js") ||
492
- loaderPath.includes("mdx-js-loader") ||
493
- loaderPath.includes("next-mdx")));
408
+ return loaderPath.includes("mdx") && (loaderPath.includes("@next") || loaderPath.includes("@mdx-js") || loaderPath.includes("mdx-js-loader") || loaderPath.includes("next-mdx"));
494
409
  }
495
410
  function extractPluginsFromOptions(opts) {
496
- if (!opts || typeof opts !== "object")
497
- return null;
498
- const remarkPlugins = Array.isArray(opts.remarkPlugins) ? opts.remarkPlugins : undefined;
499
- const rehypePlugins = Array.isArray(opts.rehypePlugins) ? opts.rehypePlugins : undefined;
500
- const recmaPlugins = Array.isArray(opts.recmaPlugins) ? opts.recmaPlugins : undefined;
501
- // Only return if at least one plugin array is non-empty
502
- if ((remarkPlugins && remarkPlugins.length > 0) ||
503
- (rehypePlugins && rehypePlugins.length > 0) ||
504
- (recmaPlugins && recmaPlugins.length > 0)) {
505
- return {
506
- ...(remarkPlugins && remarkPlugins.length > 0 ? { remarkPlugins } : {}),
507
- ...(rehypePlugins && rehypePlugins.length > 0 ? { rehypePlugins } : {}),
508
- ...(recmaPlugins && recmaPlugins.length > 0 ? { recmaPlugins } : {}),
509
- };
510
- }
511
- return null;
411
+ if (!opts || typeof opts !== "object") return null;
412
+ const remarkPlugins = Array.isArray(opts.remarkPlugins) ? opts.remarkPlugins : void 0;
413
+ const rehypePlugins = Array.isArray(opts.rehypePlugins) ? opts.rehypePlugins : void 0;
414
+ const recmaPlugins = Array.isArray(opts.recmaPlugins) ? opts.recmaPlugins : void 0;
415
+ if (remarkPlugins && remarkPlugins.length > 0 || rehypePlugins && rehypePlugins.length > 0 || recmaPlugins && recmaPlugins.length > 0) return {
416
+ ...remarkPlugins && remarkPlugins.length > 0 ? { remarkPlugins } : {},
417
+ ...rehypePlugins && rehypePlugins.length > 0 ? { rehypePlugins } : {},
418
+ ...recmaPlugins && recmaPlugins.length > 0 ? { recmaPlugins } : {}
419
+ };
420
+ return null;
512
421
  }
422
+ //#endregion
423
+ export { detectNextIntlConfig, extractMdxOptions, loadNextConfig, parseBodySizeLimit, resolveNextConfig };
424
+
513
425
  //# sourceMappingURL=next-config.js.map