vinext 0.1.8 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/README.md +51 -30
  2. package/dist/build/css-url-assets.d.ts +3 -1
  3. package/dist/build/css-url-assets.js +18 -1
  4. package/dist/build/inject-pregenerated-paths.d.ts +7 -0
  5. package/dist/build/inject-pregenerated-paths.js +21 -0
  6. package/dist/build/layout-classification.js +1 -1
  7. package/dist/build/nitro-route-rules.js +1 -1
  8. package/dist/build/pages-client-assets-module.d.ts +11 -0
  9. package/dist/build/pages-client-assets-module.js +27 -0
  10. package/dist/build/prerender-server-entry.d.ts +1 -0
  11. package/dist/build/prerender-server-entry.js +49 -0
  12. package/dist/build/prerender-server-pool.d.ts +44 -0
  13. package/dist/build/prerender-server-pool.js +194 -0
  14. package/dist/build/prerender.d.ts +2 -1
  15. package/dist/build/prerender.js +98 -27
  16. package/dist/build/report.d.ts +13 -2
  17. package/dist/build/report.js +99 -2
  18. package/dist/build/run-prerender.d.ts +7 -0
  19. package/dist/build/run-prerender.js +12 -2
  20. package/dist/build/standalone.js +2 -0
  21. package/dist/cache/cache-adapters-virtual.js +3 -3
  22. package/dist/check.d.ts +4 -6
  23. package/dist/check.js +48 -11
  24. package/dist/cli-args.d.ts +1 -2
  25. package/dist/cli-args.js +1 -1
  26. package/dist/cli-dev-config.d.ts +12 -0
  27. package/dist/cli-dev-config.js +23 -0
  28. package/dist/cli.js +112 -96
  29. package/dist/{server → client}/dev-error-overlay-store.d.ts +1 -1
  30. package/dist/{server → client}/dev-error-overlay-store.js +1 -1
  31. package/dist/{server → client}/dev-error-overlay.d.ts +1 -1
  32. package/dist/{server → client}/dev-error-overlay.js +2 -2
  33. package/dist/client/navigation-runtime.d.ts +2 -0
  34. package/dist/client/navigation-runtime.js +3 -1
  35. package/dist/client/vinext-next-data.d.ts +4 -1
  36. package/dist/client/window-next.d.ts +2 -1
  37. package/dist/cloudflare/index.d.ts +2 -2
  38. package/dist/cloudflare/index.js +2 -2
  39. package/dist/config/config-matchers.js +45 -19
  40. package/dist/config/next-config.d.ts +41 -9
  41. package/dist/config/next-config.js +60 -3
  42. package/dist/config/prerender.d.ts +34 -0
  43. package/dist/config/prerender.js +55 -0
  44. package/dist/entries/app-browser-entry.js +5 -1
  45. package/dist/entries/app-rsc-entry.d.ts +5 -3
  46. package/dist/entries/app-rsc-entry.js +44 -10
  47. package/dist/entries/app-rsc-manifest.js +2 -0
  48. package/dist/entries/pages-client-entry.d.ts +3 -0
  49. package/dist/entries/pages-client-entry.js +28 -3
  50. package/dist/entries/pages-server-entry.js +23 -6
  51. package/dist/image/image-adapters-virtual.d.ts +59 -0
  52. package/dist/image/image-adapters-virtual.js +59 -0
  53. package/dist/index.d.ts +33 -0
  54. package/dist/index.js +482 -120
  55. package/dist/init-cloudflare.d.ts +43 -0
  56. package/dist/init-cloudflare.js +839 -0
  57. package/dist/init-platform.d.ts +40 -0
  58. package/dist/init-platform.js +195 -0
  59. package/dist/init.d.ts +16 -38
  60. package/dist/init.js +209 -99
  61. package/dist/node_modules/.pnpm/am-i-vibing@0.5.0/node_modules/am-i-vibing/dist/detector-1yx2Hoe0.js +294 -0
  62. package/dist/node_modules/.pnpm/process-ancestry@0.1.0/node_modules/process-ancestry/dist/index.js +94 -0
  63. package/dist/{cloudflare → packages/cloudflare}/src/cache/cdn-adapter.runtime.js +1 -1
  64. package/dist/{cloudflare → packages/cloudflare}/src/cache/kv-data-adapter.runtime.d.ts +2 -2
  65. package/dist/{cloudflare → packages/cloudflare}/src/cache/kv-data-adapter.runtime.js +9 -2
  66. package/dist/packages/cloudflare/src/deploy-config.js +150 -0
  67. package/dist/packages/cloudflare/src/deploy-help.js +55 -0
  68. package/dist/packages/cloudflare/src/deploy.js +272 -0
  69. package/dist/{cloudflare → packages/cloudflare/src}/tpr.d.ts +4 -41
  70. package/dist/{cloudflare → packages/cloudflare/src}/tpr.js +44 -20
  71. package/dist/plugins/ast-scope.d.ts +16 -0
  72. package/dist/plugins/ast-scope.js +62 -0
  73. package/dist/plugins/ast-utils.d.ts +27 -1
  74. package/dist/plugins/ast-utils.js +32 -1
  75. package/dist/plugins/css-module-imports.d.ts +14 -0
  76. package/dist/plugins/css-module-imports.js +59 -0
  77. package/dist/plugins/extensionless-dynamic-import.js +2 -2
  78. package/dist/plugins/fonts.js +1 -1
  79. package/dist/plugins/ignore-dynamic-requests.d.ts +11 -0
  80. package/dist/plugins/ignore-dynamic-requests.js +530 -0
  81. package/dist/plugins/og-assets.js +2 -1
  82. package/dist/plugins/optimize-imports.js +1 -1
  83. package/dist/plugins/rsc-reference-validation-normalizer.d.ts +12 -0
  84. package/dist/plugins/rsc-reference-validation-normalizer.js +48 -0
  85. package/dist/plugins/sass.d.ts +17 -1
  86. package/dist/plugins/sass.js +74 -1
  87. package/dist/plugins/styled-jsx.d.ts +16 -0
  88. package/dist/plugins/styled-jsx.js +149 -0
  89. package/dist/plugins/typeof-window.d.ts +1 -1
  90. package/dist/plugins/typeof-window.js +28 -56
  91. package/dist/routing/app-route-graph.d.ts +23 -2
  92. package/dist/routing/app-route-graph.js +138 -38
  93. package/dist/routing/file-matcher.d.ts +11 -1
  94. package/dist/routing/file-matcher.js +18 -3
  95. package/dist/routing/pages-router.js +2 -2
  96. package/dist/server/api-handler.js +9 -14
  97. package/dist/server/app-browser-action-result.d.ts +4 -1
  98. package/dist/server/app-browser-action-result.js +8 -1
  99. package/dist/server/app-browser-entry.js +198 -57
  100. package/dist/server/app-browser-interception-context.d.ts +1 -0
  101. package/dist/server/app-browser-interception-context.js +4 -2
  102. package/dist/server/app-browser-navigation-controller.d.ts +2 -0
  103. package/dist/server/app-browser-navigation-controller.js +60 -31
  104. package/dist/server/app-browser-server-action-client.d.ts +1 -1
  105. package/dist/server/app-browser-server-action-client.js +8 -7
  106. package/dist/server/app-browser-state.d.ts +12 -1
  107. package/dist/server/app-browser-state.js +25 -8
  108. package/dist/server/app-browser-visible-commit.d.ts +6 -1
  109. package/dist/server/app-browser-visible-commit.js +42 -24
  110. package/dist/server/app-elements-wire.d.ts +9 -2
  111. package/dist/server/app-elements-wire.js +8 -1
  112. package/dist/server/app-elements.d.ts +2 -2
  113. package/dist/server/app-elements.js +4 -3
  114. package/dist/server/app-fallback-renderer.d.ts +2 -1
  115. package/dist/server/app-fallback-renderer.js +10 -6
  116. package/dist/server/app-hydration-cache-publication.d.ts +11 -0
  117. package/dist/server/app-hydration-cache-publication.js +43 -0
  118. package/dist/server/app-middleware.d.ts +4 -3
  119. package/dist/server/app-middleware.js +8 -3
  120. package/dist/server/app-optimistic-routing.js +11 -4
  121. package/dist/server/app-page-boundary.js +2 -1
  122. package/dist/server/app-page-cache-finalizer.d.ts +1 -0
  123. package/dist/server/app-page-cache-finalizer.js +5 -4
  124. package/dist/server/app-page-cache-render.d.ts +1 -0
  125. package/dist/server/app-page-cache-render.js +8 -4
  126. package/dist/server/app-page-cache.d.ts +1 -0
  127. package/dist/server/app-page-cache.js +27 -7
  128. package/dist/server/app-page-dispatch.d.ts +1 -0
  129. package/dist/server/app-page-dispatch.js +26 -8
  130. package/dist/server/app-page-element-builder.d.ts +2 -1
  131. package/dist/server/app-page-element-builder.js +59 -4
  132. package/dist/server/app-page-execution.js +2 -1
  133. package/dist/server/app-page-probe.js +5 -0
  134. package/dist/server/app-page-render-identity.d.ts +2 -0
  135. package/dist/server/app-page-render-identity.js +3 -2
  136. package/dist/server/app-page-render.d.ts +2 -0
  137. package/dist/server/app-page-render.js +85 -16
  138. package/dist/server/app-page-request.d.ts +14 -0
  139. package/dist/server/app-page-request.js +69 -4
  140. package/dist/server/app-page-response.d.ts +7 -0
  141. package/dist/server/app-page-response.js +16 -4
  142. package/dist/server/app-page-route-wiring.d.ts +8 -1
  143. package/dist/server/app-page-route-wiring.js +32 -18
  144. package/dist/server/app-page-segment-state.d.ts +2 -1
  145. package/dist/server/app-page-segment-state.js +3 -1
  146. package/dist/server/app-page-stream.d.ts +7 -1
  147. package/dist/server/app-page-stream.js +3 -1
  148. package/dist/server/app-route-handler-execution.js +5 -1
  149. package/dist/server/app-route-handler-response.js +1 -0
  150. package/dist/server/app-route-handler-runtime.js +1 -1
  151. package/dist/server/app-route-tree-prefetch.d.ts +43 -0
  152. package/dist/server/app-route-tree-prefetch.js +187 -0
  153. package/dist/server/app-router-entry.js +9 -2
  154. package/dist/server/app-rsc-cache-busting.d.ts +2 -1
  155. package/dist/server/app-rsc-cache-busting.js +9 -4
  156. package/dist/server/app-rsc-handler.d.ts +7 -0
  157. package/dist/server/app-rsc-handler.js +148 -39
  158. package/dist/server/app-rsc-render-mode.d.ts +3 -2
  159. package/dist/server/app-rsc-render-mode.js +4 -1
  160. package/dist/server/app-rsc-request-normalization.d.ts +6 -6
  161. package/dist/server/app-rsc-request-normalization.js +10 -8
  162. package/dist/server/app-segment-config.d.ts +11 -0
  163. package/dist/server/app-segment-config.js +62 -6
  164. package/dist/server/app-server-action-execution.d.ts +1 -0
  165. package/dist/server/app-server-action-execution.js +61 -30
  166. package/dist/server/app-ssr-entry.d.ts +3 -0
  167. package/dist/server/app-ssr-entry.js +13 -5
  168. package/dist/server/app-ssr-stream.d.ts +7 -3
  169. package/dist/server/app-ssr-stream.js +10 -6
  170. package/dist/server/app-visited-response-cache.d.ts +6 -0
  171. package/dist/server/app-visited-response-cache.js +3 -1
  172. package/dist/server/cache-control.d.ts +3 -1
  173. package/dist/server/cache-control.js +13 -1
  174. package/dist/server/client-trace-metadata.js +26 -0
  175. package/dist/server/default-global-not-found-module.d.ts +14 -0
  176. package/dist/server/default-global-not-found-module.js +14 -0
  177. package/dist/server/dev-route-files.js +4 -0
  178. package/dist/server/dev-server.d.ts +11 -1
  179. package/dist/server/dev-server.js +94 -35
  180. package/dist/server/dev-stack-sourcemap.d.ts +1 -1
  181. package/dist/server/dev-stack-sourcemap.js +1 -1
  182. package/dist/server/fetch-handler.d.ts +2 -0
  183. package/dist/server/fetch-handler.js +18 -0
  184. package/dist/server/headers.d.ts +7 -15
  185. package/dist/server/headers.js +11 -18
  186. package/dist/server/image-optimization.d.ts +51 -1
  187. package/dist/server/image-optimization.js +52 -2
  188. package/dist/server/implicit-tags.js +1 -1
  189. package/dist/server/isr-cache.d.ts +3 -2
  190. package/dist/server/isr-cache.js +9 -5
  191. package/dist/server/metadata-routes.d.ts +3 -1
  192. package/dist/server/metadata-routes.js +12 -2
  193. package/dist/server/middleware-runtime.js +6 -1
  194. package/dist/server/navigation-planner.d.ts +1 -0
  195. package/dist/server/navigation-planner.js +14 -3
  196. package/dist/server/pages-api-route.js +2 -2
  197. package/dist/server/pages-asset-tags.d.ts +4 -6
  198. package/dist/server/pages-asset-tags.js +12 -12
  199. package/dist/server/pages-client-assets.d.ts +12 -0
  200. package/dist/server/pages-client-assets.js +10 -0
  201. package/dist/server/pages-data-route.d.ts +4 -2
  202. package/dist/server/pages-data-route.js +18 -4
  203. package/dist/server/pages-dev-module-url.d.ts +2 -1
  204. package/dist/server/pages-dev-module-url.js +6 -3
  205. package/dist/server/pages-node-compat.d.ts +19 -1
  206. package/dist/server/pages-node-compat.js +81 -4
  207. package/dist/server/pages-page-data.d.ts +33 -1
  208. package/dist/server/pages-page-data.js +62 -33
  209. package/dist/server/pages-page-handler.d.ts +2 -1
  210. package/dist/server/pages-page-handler.js +38 -19
  211. package/dist/server/pages-page-response.d.ts +8 -0
  212. package/dist/server/pages-page-response.js +7 -3
  213. package/dist/server/pages-request-pipeline.d.ts +9 -5
  214. package/dist/server/pages-request-pipeline.js +55 -7
  215. package/dist/server/pages-router-entry.d.ts +30 -0
  216. package/dist/server/pages-router-entry.js +108 -0
  217. package/dist/server/prerender-manifest.d.ts +3 -1
  218. package/dist/server/prerender-route-params.js +1 -1
  219. package/dist/server/prod-server.d.ts +5 -3
  220. package/dist/server/prod-server.js +68 -39
  221. package/dist/server/request-pipeline.js +2 -1
  222. package/dist/server/seed-cache.js +4 -4
  223. package/dist/shims/app-router-scroll-state.d.ts +1 -0
  224. package/dist/shims/app-router-scroll-state.js +1 -0
  225. package/dist/shims/app-router-scroll.js +2 -1
  226. package/dist/shims/cache-handler.js +8 -1
  227. package/dist/shims/cache.js +22 -15
  228. package/dist/shims/cdn-cache.js +1 -1
  229. package/dist/shims/dynamic-preload-chunks.js +2 -1
  230. package/dist/shims/fetch-cache.d.ts +3 -1
  231. package/dist/shims/fetch-cache.js +77 -52
  232. package/dist/shims/form.d.ts +4 -2
  233. package/dist/shims/form.js +37 -43
  234. package/dist/shims/headers.d.ts +7 -1
  235. package/dist/shims/headers.js +17 -3
  236. package/dist/shims/image.js +75 -14
  237. package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +10 -0
  238. package/dist/shims/internal/app-prefetch-fetch-queue.js +61 -0
  239. package/dist/shims/internal/app-route-detection.d.ts +2 -17
  240. package/dist/shims/internal/app-route-detection.js +4 -17
  241. package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +23 -0
  242. package/dist/shims/internal/hybrid-client-route-owner-direct.js +51 -0
  243. package/dist/shims/internal/hybrid-client-route-owner.d.ts +3 -15
  244. package/dist/shims/internal/hybrid-client-route-owner.js +40 -58
  245. package/dist/shims/internal/pages-data-fetch-dedup.d.ts +10 -5
  246. package/dist/shims/internal/pages-data-fetch-dedup.js +84 -14
  247. package/dist/shims/internal/pages-data-target.d.ts +18 -12
  248. package/dist/shims/internal/pages-data-target.js +97 -13
  249. package/dist/shims/internal/pages-router-components.d.ts +7 -0
  250. package/dist/shims/internal/pages-router-components.js +13 -0
  251. package/dist/shims/layout-segment-context.d.ts +4 -1
  252. package/dist/shims/layout-segment-context.js +18 -4
  253. package/dist/shims/link.d.ts +1 -1
  254. package/dist/shims/link.js +224 -58
  255. package/dist/shims/navigation.d.ts +19 -3
  256. package/dist/shims/navigation.js +245 -47
  257. package/dist/shims/request-context.js +18 -0
  258. package/dist/shims/root-params.d.ts +15 -1
  259. package/dist/shims/root-params.js +21 -1
  260. package/dist/shims/router.d.ts +5 -7
  261. package/dist/shims/router.js +387 -102
  262. package/dist/shims/server.js +3 -2
  263. package/dist/shims/slot.js +3 -6
  264. package/dist/shims/unified-request-context.js +1 -0
  265. package/dist/typegen.js +1 -1
  266. package/dist/utils/client-runtime-metadata.d.ts +2 -18
  267. package/dist/utils/client-runtime-metadata.js +31 -22
  268. package/dist/utils/dev-stack-sourcemap-endpoint.d.ts +4 -0
  269. package/dist/{server → utils}/dev-stack-sourcemap-endpoint.js +1 -1
  270. package/dist/utils/domain-locale.d.ts +6 -3
  271. package/dist/{server → utils}/middleware-request-headers.d.ts +1 -1
  272. package/dist/{server → utils}/middleware-request-headers.js +3 -3
  273. package/dist/utils/project.d.ts +48 -2
  274. package/dist/utils/project.js +225 -4
  275. package/dist/utils/protocol-headers.d.ts +23 -0
  276. package/dist/utils/protocol-headers.js +23 -0
  277. package/dist/utils/react-version.d.ts +4 -0
  278. package/dist/utils/react-version.js +44 -0
  279. package/dist/utils/vite-version.d.ts +2 -0
  280. package/dist/utils/vite-version.js +11 -1
  281. package/package.json +47 -2
  282. package/dist/deploy.d.ts +0 -197
  283. package/dist/deploy.js +0 -1040
  284. package/dist/server/dev-stack-sourcemap-endpoint.d.ts +0 -4
  285. /package/dist/{cloudflare → packages/cloudflare}/src/utils/cache-control-metadata.js +0 -0
@@ -1,3 +1,3 @@
1
- import { KVCacheHandler } from "./src/cache/kv-data-adapter.runtime.js";
2
- import { TPROptions, TPRResult, runTPR } from "./tpr.js";
1
+ import { KVCacheHandler } from "../packages/cloudflare/src/cache/kv-data-adapter.runtime.js";
2
+ import { TPROptions, TPRResult, runTPR } from "../packages/cloudflare/src/tpr.js";
3
3
  export { KVCacheHandler, type TPROptions, type TPRResult, runTPR };
@@ -1,3 +1,3 @@
1
- import { KVCacheHandler } from "./src/cache/kv-data-adapter.runtime.js";
2
- import { runTPR } from "./tpr.js";
1
+ import { KVCacheHandler } from "../packages/cloudflare/src/cache/kv-data-adapter.runtime.js";
2
+ import { runTPR } from "../packages/cloudflare/src/tpr.js";
3
3
  export { KVCacheHandler, runTPR };
@@ -1,5 +1,5 @@
1
- import { VINEXT_MW_CTX_HEADER, VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SECRET_HEADER } from "../server/headers.js";
2
- import { buildRequestHeadersFromMiddlewareResponse } from "../server/middleware-request-headers.js";
1
+ import { VINEXT_MW_CTX_HEADER, VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SECRET_HEADER } from "../utils/protocol-headers.js";
2
+ import { buildRequestHeadersFromMiddlewareResponse } from "../utils/middleware-request-headers.js";
3
3
  import { parseCookieHeader } from "../utils/parse-cookie.js";
4
4
  //#region src/config/config-matchers.ts
5
5
  /**
@@ -133,7 +133,7 @@ function _getRedirectIndex(redirects) {
133
133
  const alternation = m[1];
134
134
  const optional = m[2] === "?";
135
135
  const suffix = "/" + m[3];
136
- const altRe = safeRegExp("^(?:" + alternation + ")$");
136
+ const altRe = safeRegExp("^(?:" + alternation + ")$", "i");
137
137
  if (!altRe) {
138
138
  linear.push([i, redirect]);
139
139
  continue;
@@ -145,9 +145,10 @@ function _getRedirectIndex(redirects) {
145
145
  redirect,
146
146
  originalIndex: i
147
147
  };
148
- const bucket = localeStatic.get(suffix);
148
+ const bucketKey = suffix.toLowerCase();
149
+ const bucket = localeStatic.get(bucketKey);
149
150
  if (bucket) bucket.push(entry);
150
- else localeStatic.set(suffix, [entry]);
151
+ else localeStatic.set(bucketKey, [entry]);
151
152
  } else linear.push([i, redirect]);
152
153
  }
153
154
  index = {
@@ -393,7 +394,7 @@ function normalizeHost(hostHeader, fallbackHostname) {
393
394
  */
394
395
  function applyMiddlewareRequestHeaders(middlewareHeaders, request, options = {}) {
395
396
  const nextHeaders = buildRequestHeadersFromMiddlewareResponse(request.headers, middlewareHeaders, options);
396
- for (const key of Object.keys(middlewareHeaders)) if (key.startsWith("x-middleware-")) delete middlewareHeaders[key];
397
+ for (const key of Object.keys(middlewareHeaders)) if (key.startsWith("x-middleware-") && key !== "x-middleware-cache") delete middlewareHeaders[key];
397
398
  if (nextHeaders) request = new Request(request.url, {
398
399
  method: request.method,
399
400
  headers: nextHeaders,
@@ -526,11 +527,19 @@ function extractConstraint(str, re) {
526
527
  *
527
528
  * The root path `"/"` is preserved as-is.
528
529
  */
529
- function stripTrailingSlashForConfigMatch(pathname) {
530
- return pathname.length > 1 && pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
530
+ function stripTrailingSlashForConfigMatch(value) {
531
+ return value.length > 1 && value.endsWith("/") ? value.slice(0, -1) : value;
532
+ }
533
+ function configPathEquals(a, b) {
534
+ return a.toLowerCase() === b.toLowerCase();
535
+ }
536
+ function configPathStartsWith(pathname, prefix) {
537
+ return pathname.slice(0, prefix.length).toLowerCase() === prefix.toLowerCase();
531
538
  }
532
539
  function matchConfigPattern(pathname, pattern) {
540
+ const pathnameHadTrailingSlash = pathname.length > 1 && pathname.endsWith("/");
533
541
  pathname = stripTrailingSlashForConfigMatch(pathname);
542
+ if (pathnameHadTrailingSlash) pattern = stripTrailingSlashForConfigMatch(pattern);
534
543
  const catchAllAnchor = /:[\w-]+[*+]/.test(pattern);
535
544
  const namedParamCount = (pattern.match(/:[\w-]+/g) || []).length;
536
545
  if (pattern.includes("(") || pattern.includes("\\") || /:[\w-]+[*+][^/]/.test(pattern) || /:[\w-]+\./.test(pattern) || /[^/]:[\w-]+/.test(pattern) || catchAllAnchor && namedParamCount > 1) try {
@@ -556,7 +565,7 @@ function matchConfigPattern(pathname, pattern) {
556
565
  }
557
566
  } else if (tok[0] === ".") regexStr += "\\.";
558
567
  else regexStr += tok[0];
559
- const re = safeRegExp("^" + regexStr + "$");
568
+ const re = safeRegExp("^" + regexStr + "$", "i");
560
569
  return re ? {
561
570
  re,
562
571
  paramNames
@@ -575,7 +584,7 @@ function matchConfigPattern(pathname, pattern) {
575
584
  const paramName = catchAllMatch[1];
576
585
  const isPlus = catchAllMatch[2] === "+";
577
586
  const prefixNoSlash = prefix.replace(/\/$/, "");
578
- if (!pathname.startsWith(prefixNoSlash)) return null;
587
+ if (!configPathStartsWith(pathname, prefixNoSlash)) return null;
579
588
  const charAfter = pathname[prefixNoSlash.length];
580
589
  if (charAfter !== void 0 && charAfter !== "/") return null;
581
590
  const rest = pathname.slice(prefixNoSlash.length);
@@ -588,7 +597,7 @@ function matchConfigPattern(pathname, pattern) {
588
597
  if (parts.length !== pathParts.length) return null;
589
598
  const params = Object.create(null);
590
599
  for (let i = 0; i < parts.length; i++) if (parts[i].startsWith(":")) params[parts[i].slice(1)] = pathParts[i];
591
- else if (parts[i] !== pathParts[i]) return null;
600
+ else if (!configPathEquals(parts[i], pathParts[i])) return null;
592
601
  return params;
593
602
  }
594
603
  /**
@@ -628,12 +637,12 @@ function matchConfigPattern(pathname, pattern) {
628
637
  */
629
638
  function matchRedirect(pathname, redirects, ctx, basePathState = _BASEPATH_DEFAULT) {
630
639
  if (redirects.length === 0) return null;
631
- pathname = stripTrailingSlashForConfigMatch(pathname);
640
+ const normalizedPathname = stripTrailingSlashForConfigMatch(pathname);
632
641
  const index = _getRedirectIndex(redirects);
633
642
  let localeMatch = null;
634
643
  let localeMatchIndex = Infinity;
635
644
  if (index.localeStatic.size > 0) {
636
- const noLocaleBucket = index.localeStatic.get(pathname);
645
+ const noLocaleBucket = index.localeStatic.get(normalizedPathname.toLowerCase());
637
646
  if (noLocaleBucket) for (const entry of noLocaleBucket) {
638
647
  if (!entry.optional) continue;
639
648
  if (entry.originalIndex >= localeMatchIndex) continue;
@@ -651,11 +660,11 @@ function matchRedirect(pathname, redirects, ctx, basePathState = _BASEPATH_DEFAU
651
660
  localeMatchIndex = entry.originalIndex;
652
661
  break;
653
662
  }
654
- const slashTwo = pathname.indexOf("/", 1);
663
+ const slashTwo = normalizedPathname.indexOf("/", 1);
655
664
  if (slashTwo !== -1) {
656
- const suffix = pathname.slice(slashTwo);
657
- const localePart = pathname.slice(1, slashTwo);
658
- const localeBucket = index.localeStatic.get(suffix);
665
+ const suffix = normalizedPathname.slice(slashTwo);
666
+ const localePart = normalizedPathname.slice(1, slashTwo);
667
+ const localeBucket = index.localeStatic.get(suffix.toLowerCase());
659
668
  if (localeBucket) for (const entry of localeBucket) {
660
669
  if (entry.originalIndex >= localeMatchIndex) continue;
661
670
  if (!entry.altRe.test(localePart)) continue;
@@ -746,7 +755,22 @@ function substituteDestinationParams(destination, params) {
746
755
  paramRe = new RegExp(`:(${paramAlternation})([+*])?(?![A-Za-z0-9_])`, "g");
747
756
  _compiledDestinationParamCache.set(cacheKey, paramRe);
748
757
  }
749
- return destination.replace(paramRe, (_token, key) => params[key]);
758
+ const replaceParams = (value, encodeParam) => value.replace(paramRe, (_token, key) => encodeParam(params[key]));
759
+ const hashIndex = destination.indexOf("#");
760
+ const beforeHash = hashIndex === -1 ? destination : destination.slice(0, hashIndex);
761
+ const hash = hashIndex === -1 ? "" : destination.slice(hashIndex);
762
+ const queryIndex = beforeHash.indexOf("?");
763
+ if (queryIndex !== -1) {
764
+ const beforeQuery = beforeHash.slice(0, queryIndex);
765
+ const query = beforeHash.slice(queryIndex + 1);
766
+ return `${replaceParams(beforeQuery, (value) => value)}?${replaceParams(query, encodeDestinationQueryParamValue)}${replaceParams(hash, (value) => value)}`;
767
+ }
768
+ return replaceParams(destination, (value) => value);
769
+ }
770
+ function encodeDestinationQueryParamValue(value) {
771
+ const params = new URLSearchParams();
772
+ params.set("", value);
773
+ return params.toString().slice(1);
750
774
  }
751
775
  /**
752
776
  * Substitute params into a redirect/rewrite destination and sanitize the
@@ -956,11 +980,13 @@ async function proxyExternalRequest(request, externalUrl) {
956
980
  * when evaluating headers, so this parameter is required.
957
981
  */
958
982
  function matchHeaders(pathname, headers, ctx, basePathState = _BASEPATH_DEFAULT) {
983
+ const pathnameHadTrailingSlash = pathname.length > 1 && pathname.endsWith("/");
959
984
  pathname = stripTrailingSlashForConfigMatch(pathname);
960
985
  const result = [];
961
986
  for (const rule of headers) {
962
987
  if (!shouldEvaluateRule(rule.basePath, basePathState)) continue;
963
- const sourceRegex = getCachedRegex(_compiledHeaderSourceCache, rule.source, () => safeRegExp("^" + escapeHeaderSource(rule.source) + "$"));
988
+ const source = pathnameHadTrailingSlash ? stripTrailingSlashForConfigMatch(rule.source) : rule.source;
989
+ const sourceRegex = getCachedRegex(_compiledHeaderSourceCache, source, () => safeRegExp("^" + escapeHeaderSource(source) + "$", "i"));
964
990
  if (sourceRegex && sourceRegex.test(pathname)) {
965
991
  if (rule.has || rule.missing) {
966
992
  if (!checkHasConditions(rule.has, rule.missing, ctx)) continue;
@@ -82,6 +82,10 @@ type MdxOptions = {
82
82
  rehypePlugins?: unknown[];
83
83
  recmaPlugins?: unknown[];
84
84
  };
85
+ type PrefetchInliningConfig = false | {
86
+ maxBundleSize: number;
87
+ maxSize: number;
88
+ };
85
89
  type NextConfig = {
86
90
  /** Additional env variables */env?: Record<string, string>; /** Base URL path prefix */
87
91
  basePath?: string;
@@ -107,7 +111,7 @@ type NextConfig = {
107
111
  }; /** Custom response headers */
108
112
  headers?: () => Promise<NextHeader[]> | NextHeader[]; /** Image optimization config */
109
113
  images?: {
110
- remotePatterns?: Array<{
114
+ remotePatterns?: Array<URL | {
111
115
  protocol?: string;
112
116
  hostname: string;
113
117
  port?: string;
@@ -123,7 +127,15 @@ type NextConfig = {
123
127
  dangerouslyAllowLocalIP?: boolean; /** Content-Disposition header for image responses. Defaults to "inline". */
124
128
  contentDispositionType?: "inline" | "attachment"; /** Content-Security-Policy header for image responses. Defaults to "script-src 'none'; frame-src 'none'; sandbox;" */
125
129
  contentSecurityPolicy?: string;
126
- }; /** Build output mode: 'export' for full static export, 'standalone' for single server */
130
+ };
131
+ /**
132
+ * Enable React Strict Mode. When `true`, the client root is wrapped in
133
+ * `<React.StrictMode>` so React runs its dev-only strict checks (double-
134
+ * invoked effects/render, deprecation warnings). `null`/unset resolves per
135
+ * router: OFF for the Pages Router, ON for the App Router — matching Next.js.
136
+ * @see https://nextjs.org/docs/app/api-reference/config/next-config-js/reactStrictMode
137
+ */
138
+ reactStrictMode?: boolean | null; /** Build output mode: 'export' for full static export, 'standalone' for single server */
127
139
  output?: "export" | "standalone"; /** File extensions treated as routable pages/routes (Next.js pageExtensions) */
128
140
  pageExtensions?: string[]; /** Turbopack-compatible module resolution options. */
129
141
  turbopack?: {
@@ -194,6 +206,15 @@ type NextConfig = {
194
206
  * `useRouter().experimental_gesturePush()`.
195
207
  */
196
208
  gestureTransition?: boolean;
209
+ /**
210
+ * Enables App Router Segment Cache prefetch inlining. When provided as an
211
+ * object, thresholds are resolved with Next.js defaults and non-finite
212
+ * values are clamped to Number.MAX_SAFE_INTEGER.
213
+ */
214
+ prefetchInlining?: boolean | {
215
+ maxBundleSize?: number;
216
+ maxSize?: number;
217
+ };
197
218
  [key: string]: unknown;
198
219
  };
199
220
  /**
@@ -254,11 +275,10 @@ type ResolvedNextConfig = {
254
275
  */
255
276
  gestureTransition: boolean;
256
277
  /**
257
- * Whether `experimental.prefetchInlining` is configured. Next.js uses this
258
- * with the Segment Cache to fetch the route tree before the bundled inlined
259
- * segment payload.
278
+ * Resolved `experimental.prefetchInlining` config. Next.js normalizes `true`
279
+ * and partial object config into concrete thresholds.
260
280
  */
261
- prefetchInlining: boolean;
281
+ prefetchInlining: PrefetchInliningConfig;
262
282
  redirects: NextRedirect[];
263
283
  rewrites: {
264
284
  beforeFiles: NextRewrite[];
@@ -273,8 +293,10 @@ type ResolvedNextConfig = {
273
293
  allowedDevOrigins: string[]; /** Extra allowed origins for server action CSRF validation (from experimental.serverActions.allowedOrigins). */
274
294
  serverActionsAllowedOrigins: string[]; /** Packages whose barrel imports should be optimized (from experimental.optimizePackageImports). */
275
295
  optimizePackageImports: string[]; /** Packages explicitly requested for server/client transpilation. */
276
- transpilePackages: string[]; /** Inline app CSS into production HTML (from experimental.inlineCss). */
277
- inlineCss: boolean; /** Parsed body size limit for server actions in bytes (from experimental.serverActions.bodySizeLimit). Defaults to 1MB. */
296
+ transpilePackages: string[]; /** Packages treated as application code by Turbopack's foreign-code condition. */
297
+ turbopackTranspilePackages: string[]; /** Inline app CSS into production HTML (from experimental.inlineCss). */
298
+ inlineCss: boolean; /** Enable standalone route-miss 404 handling (from experimental.globalNotFound). */
299
+ globalNotFound: boolean; /** Parsed body size limit for server actions in bytes (from experimental.serverActions.bodySizeLimit). Defaults to 1MB. */
278
300
  serverActionsBodySizeLimit: number; /** Verbatim body size limit config value (e.g. "2mb") for the "Body exceeded {limit} limit" error. Defaults to "1 MB". */
279
301
  serverActionsBodySizeLimitLabel: string; /** Route-level expire fallback in seconds for ISR entries with numeric revalidate. */
280
302
  expireTime: number;
@@ -348,6 +370,16 @@ type ResolvedNextConfig = {
348
370
  * `test/e2e/optimized-loading` test fixture.
349
371
  */
350
372
  disableOptimizedLoading: boolean;
373
+ /**
374
+ * Resolved `reactStrictMode` from next.config, preserved as `boolean | null`
375
+ * so each router can apply its own default (Next.js resolves `null` to OFF
376
+ * for the Pages Router and ON for the App Router). When the effective value
377
+ * is `true`, the client root is wrapped in `<React.StrictMode>`.
378
+ *
379
+ * See `.nextjs-ref/packages/next/src/build/define-env.ts`
380
+ * (`__NEXT_STRICT_MODE` / `__NEXT_STRICT_MODE_APP`).
381
+ */
382
+ reactStrictMode: boolean | null;
351
383
  /**
352
384
  * Mirrors Next.js `experimental.scrollRestoration`. When true, the Pages
353
385
  * Router client takes ownership of browser history scroll restoration by
@@ -532,4 +564,4 @@ declare function extractMdxOptions(config: NextConfig, root?: string): Promise<M
532
564
  */
533
565
  declare function detectNextIntlConfig(root: string, resolved: ResolvedNextConfig): void;
534
566
  //#endregion
535
- export { HasCondition, MdxOptions, NextConfig, NextConfigInput, NextHeader, NextI18nConfig, NextRedirect, NextRewrite, PHASE_PRODUCTION_BUILD, ResolvedNextConfig, createRscCompatibilityId, detectNextIntlConfig, extractMdxOptions, findNextConfigPath, lightningCssFeatureNamesToMask, loadNextConfig, normalizeAssetPrefix, parseBodySizeLimit, reassignsModuleExports, referencesCjsGlobals, resolveNextConfig, resolveNextConfigInput };
567
+ export { HasCondition, MdxOptions, NextConfig, NextConfigInput, NextHeader, NextI18nConfig, NextRedirect, NextRewrite, PHASE_PRODUCTION_BUILD, PrefetchInliningConfig, ResolvedNextConfig, createRscCompatibilityId, detectNextIntlConfig, extractMdxOptions, findNextConfigPath, lightningCssFeatureNamesToMask, loadNextConfig, normalizeAssetPrefix, parseBodySizeLimit, reassignsModuleExports, referencesCjsGlobals, resolveNextConfig, resolveNextConfigInput };
@@ -72,6 +72,7 @@ const CONFIG_FILES = [
72
72
  "next.config.cjs"
73
73
  ];
74
74
  const DEFAULT_EXPIRE_TIME = 31536e3;
75
+ const DEFAULT_TRANSPILED_PACKAGES = ["geist"];
75
76
  /**
76
77
  * Default cap for the App Router preload `Link` header length, matching the
77
78
  * Next.js `defaultConfig.reactMaxHeadersLength`.
@@ -252,6 +253,31 @@ function findNextConfigPath(root) {
252
253
  }
253
254
  return null;
254
255
  }
256
+ function hasConfigProperty(config, propertyPath) {
257
+ let current = config;
258
+ for (const property of propertyPath.split(".")) {
259
+ if (!isUnknownRecord(current) || current[property] === void 0) return false;
260
+ current = current[property];
261
+ }
262
+ return true;
263
+ }
264
+ const emittedConfigWarnings = /* @__PURE__ */ new Set();
265
+ function warnConfigOnce(message) {
266
+ if (emittedConfigWarnings.has(message)) return;
267
+ emittedConfigWarnings.add(message);
268
+ console.warn(message);
269
+ }
270
+ function warnDeprecatedConfigOptions(config, root) {
271
+ const configFileName = path.basename(findNextConfigPath(root) ?? "next.config.js");
272
+ const warnings = [
273
+ ["experimental.middlewarePrefetch", `\`experimental.middlewarePrefetch\` is deprecated. Please use \`experimental.proxyPrefetch\` instead in ${configFileName}.`],
274
+ ["experimental.middlewareClientMaxBodySize", `\`experimental.middlewareClientMaxBodySize\` is deprecated. Please use \`experimental.proxyClientMaxBodySize\` instead in ${configFileName}.`],
275
+ ["experimental.externalMiddlewareRewritesResolve", `\`experimental.externalMiddlewareRewritesResolve\` is deprecated. Please use \`experimental.externalProxyRewritesResolve\` instead in ${configFileName}.`],
276
+ ["skipMiddlewareUrlNormalize", `\`skipMiddlewareUrlNormalize\` is deprecated. Please use \`skipProxyUrlNormalize\` instead in ${configFileName}.`],
277
+ ["experimental.instrumentationHook", `\`experimental.instrumentationHook\` is no longer needed, because \`instrumentation.js\` is available by default. You can remove it from ${configFileName}.`]
278
+ ];
279
+ for (const [propertyPath, warning] of warnings) if (hasConfigProperty(config, propertyPath)) warnConfigOnce(warning);
280
+ }
255
281
  async function resolveNextConfigInput(config, phase = PHASE_DEVELOPMENT_SERVER) {
256
282
  return await resolveConfigValue(config, phase);
257
283
  }
@@ -534,6 +560,18 @@ function resolveStaleTimes(experimental) {
534
560
  static: Number.isFinite(staticRaw) && staticRaw >= 0 ? staticRaw : DEFAULT_STALE_TIMES.static
535
561
  };
536
562
  }
563
+ function normalizePrefetchInliningConfig(value) {
564
+ if (!value) return false;
565
+ const raw = isUnknownRecord(value) ? value : null;
566
+ const maxSize = raw ? raw.maxSize ?? 2048 : 2048;
567
+ const maxBundleSize = raw ? raw.maxBundleSize ?? 10240 : 10240;
568
+ const normalizedMaxSize = Number(maxSize);
569
+ const normalizedMaxBundleSize = Number(maxBundleSize);
570
+ return {
571
+ maxBundleSize: Number.isFinite(normalizedMaxBundleSize) ? normalizedMaxBundleSize : Number.MAX_SAFE_INTEGER,
572
+ maxSize: Number.isFinite(normalizedMaxSize) ? normalizedMaxSize : Number.MAX_SAFE_INTEGER
573
+ };
574
+ }
537
575
  /**
538
576
  * Resolve a NextConfig into a fully-resolved ResolvedNextConfig.
539
577
  * Awaits async functions for redirects/rewrites/headers.
@@ -570,7 +608,9 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
570
608
  serverActionsAllowedOrigins: [],
571
609
  optimizePackageImports: [],
572
610
  transpilePackages: [],
611
+ turbopackTranspilePackages: [...DEFAULT_TRANSPILED_PACKAGES],
573
612
  inlineCss: false,
613
+ globalNotFound: false,
574
614
  serverActionsBodySizeLimit: 1 * 1024 * 1024,
575
615
  serverActionsBodySizeLimitLabel: "1 MB",
576
616
  expireTime: DEFAULT_EXPIRE_TIME,
@@ -587,6 +627,7 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
587
627
  sassOptions: null,
588
628
  removeConsole: false,
589
629
  disableOptimizedLoading: false,
630
+ reactStrictMode: null,
590
631
  scrollRestoration: false,
591
632
  compilerDefine: {},
592
633
  compilerDefineServer: {},
@@ -602,6 +643,7 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
602
643
  detectNextIntlConfig(root, resolved);
603
644
  return resolved;
604
645
  }
646
+ warnDeprecatedConfigOptions(config, root);
605
647
  let redirects = [];
606
648
  if (config.redirects) {
607
649
  const result = await config.redirects();
@@ -653,12 +695,13 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
653
695
  const rawOptimize = experimental?.optimizePackageImports;
654
696
  const optimizePackageImports = Array.isArray(rawOptimize) ? rawOptimize.filter((x) => typeof x === "string") : [];
655
697
  const inlineCss = experimental?.inlineCss === true;
656
- const prefetchInlining = experimental?.prefetchInlining === true || isUnknownRecord(experimental?.prefetchInlining);
698
+ const globalNotFound = experimental?.globalNotFound === true;
699
+ const prefetchInlining = normalizePrefetchInliningConfig(experimental?.prefetchInlining);
657
700
  const appShells = experimental?.appShells === true;
658
701
  if (appShells) {
659
702
  const missingCoFlags = [];
660
703
  if (!config.cacheComponents) missingCoFlags.push("cacheComponents");
661
- if (experimental?.prefetchInlining !== true) missingCoFlags.push("experimental.prefetchInlining");
704
+ if (!prefetchInlining) missingCoFlags.push("experimental.prefetchInlining");
662
705
  if (experimental?.varyParams !== true) missingCoFlags.push("experimental.varyParams");
663
706
  if (experimental?.optimisticRouting !== true) missingCoFlags.push("experimental.optimisticRouting");
664
707
  if (experimental?.cachedNavigations !== true) missingCoFlags.push("experimental.cachedNavigations");
@@ -668,6 +711,7 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
668
711
  const legacyServerComponentsExternal = readStringArray(experimental?.serverComponentsExternalPackages);
669
712
  const serverExternalPackages = topLevelServerExternalPackages ?? legacyServerComponentsExternal;
670
713
  const transpilePackages = readStringArray(config.transpilePackages);
714
+ const turbopackTranspilePackages = [...transpilePackages, ...DEFAULT_TRANSPILED_PACKAGES];
671
715
  if (experimental?.swcEnvOptions !== void 0) console.warn("[vinext] next.config option \"experimental.swcEnvOptions\" is not applicable and will be ignored (vinext uses Vite, not SWC). A Vite-compatible polyfill solution may be explored in the future.");
672
716
  if (experimental?.rootParams !== void 0) console.warn("[vinext] `experimental.rootParams` is no longer needed, because `next/root-params` is available by default. You can remove it from next.config.(js|mjs|ts).");
673
717
  const useLightningcss = experimental?.useLightningcss === true;
@@ -706,6 +750,16 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
706
750
  fallback: applyLocaleToRoutes(rewrites.fallback, i18n, "rewrite", opts)
707
751
  };
708
752
  }
753
+ const images = config.images ? {
754
+ ...config.images,
755
+ remotePatterns: config.images.remotePatterns?.map((pattern) => pattern instanceof URL ? {
756
+ protocol: pattern.protocol.slice(0, -1),
757
+ hostname: pattern.hostname,
758
+ port: pattern.port,
759
+ pathname: pattern.pathname,
760
+ search: pattern.search
761
+ } : { ...pattern })
762
+ } : void 0;
709
763
  const resolved = {
710
764
  env: config.env ?? {},
711
765
  basePath: config.basePath ?? "",
@@ -723,7 +777,7 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
723
777
  redirects,
724
778
  rewrites,
725
779
  headers,
726
- images: config.images,
780
+ images,
727
781
  i18n,
728
782
  mdx,
729
783
  aliases,
@@ -731,7 +785,9 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
731
785
  serverActionsAllowedOrigins,
732
786
  optimizePackageImports,
733
787
  transpilePackages,
788
+ turbopackTranspilePackages,
734
789
  inlineCss,
790
+ globalNotFound,
735
791
  serverActionsBodySizeLimit,
736
792
  serverActionsBodySizeLimitLabel,
737
793
  expireTime: typeof config.expireTime === "number" ? config.expireTime : DEFAULT_EXPIRE_TIME,
@@ -748,6 +804,7 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
748
804
  sassOptions: readOptionalRecord(config.sassOptions) ?? null,
749
805
  removeConsole: config.compiler?.removeConsole === true ? true : isUnknownRecord(config.compiler?.removeConsole) ? { exclude: readStringArray(config.compiler.removeConsole.exclude) } : false,
750
806
  disableOptimizedLoading: experimental?.disableOptimizedLoading === true,
807
+ reactStrictMode: typeof config.reactStrictMode === "boolean" ? config.reactStrictMode : null,
751
808
  scrollRestoration: experimental?.scrollRestoration === true,
752
809
  compilerDefine: serializeCompilerDefine(config.compiler?.define),
753
810
  compilerDefineServer: serializeCompilerDefine(config.compiler?.defineServer),
@@ -0,0 +1,34 @@
1
+ import { PluginOption } from "vite";
2
+
3
+ //#region src/config/prerender.d.ts
4
+ type VinextPrerenderConfig = true | {
5
+ /**
6
+ * Routes to pre-render after the production build.
7
+ *
8
+ * Currently only `"*"` is supported, which pre-renders every discovered
9
+ * App Router and Pages Router route that vinext can statically render.
10
+ */
11
+ routes: "*";
12
+ };
13
+ type ResolvedVinextPrerenderConfig = {
14
+ routes: "*";
15
+ };
16
+ type VinextPrerenderDecisionReason = "flag" | "next-export" | "vinext-config";
17
+ type VinextPrerenderDecision = ResolvedVinextPrerenderConfig & {
18
+ reason: VinextPrerenderDecisionReason;
19
+ };
20
+ declare const VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY = "__vinextPrerenderConfig";
21
+ type ViteConfigLoader = {
22
+ loadConfigFromFile: typeof import("vite").loadConfigFromFile;
23
+ };
24
+ declare function normalizeVinextPrerenderConfig(config: VinextPrerenderConfig | undefined): ResolvedVinextPrerenderConfig | null;
25
+ declare function findVinextPrerenderConfigInPlugins(plugins: PluginOption[] | undefined): ResolvedVinextPrerenderConfig | null;
26
+ declare function loadVinextPrerenderConfigFromViteConfig(vite: ViteConfigLoader, root: string): Promise<ResolvedVinextPrerenderConfig | null>;
27
+ declare function resolveVinextPrerenderDecision(options: {
28
+ prerenderAllFlag?: boolean;
29
+ vinextPrerenderConfig?: ResolvedVinextPrerenderConfig | null;
30
+ nextOutput?: string;
31
+ }): VinextPrerenderDecision | null;
32
+ declare function formatVinextPrerenderLabel(decision: VinextPrerenderDecision): string;
33
+ //#endregion
34
+ export { ResolvedVinextPrerenderConfig, VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY, VinextPrerenderConfig, VinextPrerenderDecision, VinextPrerenderDecisionReason, findVinextPrerenderConfigInPlugins, formatVinextPrerenderLabel, loadVinextPrerenderConfigFromViteConfig, normalizeVinextPrerenderConfig, resolveVinextPrerenderDecision };
@@ -0,0 +1,55 @@
1
+ import { isUnknownRecord } from "../utils/record.js";
2
+ //#region src/config/prerender.ts
3
+ const VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY = "__vinextPrerenderConfig";
4
+ function normalizeVinextPrerenderConfig(config) {
5
+ if (config === void 0) return null;
6
+ if (config === true) return { routes: "*" };
7
+ if (!isUnknownRecord(config)) throw new Error("[vinext] Invalid `prerender` config. Use `true` or `{ routes: \"*\" }`.");
8
+ if (config.routes === "*") return { routes: "*" };
9
+ throw new Error("[vinext] Unsupported `prerender.routes` config. Currently only `routes: \"*\"` is supported.");
10
+ }
11
+ function flattenPluginOptions(value, target) {
12
+ if (Array.isArray(value)) {
13
+ for (const item of value) flattenPluginOptions(item, target);
14
+ return;
15
+ }
16
+ if (value) target.push(value);
17
+ }
18
+ function findVinextPrerenderConfigInPlugins(plugins) {
19
+ const flattened = [];
20
+ flattenPluginOptions(plugins, flattened);
21
+ for (const plugin of flattened) {
22
+ if (!isUnknownRecord(plugin)) continue;
23
+ const prerenderConfig = plugin[VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY];
24
+ if (prerenderConfig) return prerenderConfig;
25
+ }
26
+ return null;
27
+ }
28
+ async function loadVinextPrerenderConfigFromViteConfig(vite, root) {
29
+ return findVinextPrerenderConfigInPlugins((await vite.loadConfigFromFile({
30
+ command: "build",
31
+ mode: "production"
32
+ }, void 0, root))?.config.plugins);
33
+ }
34
+ function resolveVinextPrerenderDecision(options) {
35
+ if (options.prerenderAllFlag) return {
36
+ routes: "*",
37
+ reason: "flag"
38
+ };
39
+ if (options.nextOutput === "export") return {
40
+ routes: "*",
41
+ reason: "next-export"
42
+ };
43
+ if (options.vinextPrerenderConfig?.routes === "*") return {
44
+ routes: "*",
45
+ reason: "vinext-config"
46
+ };
47
+ return null;
48
+ }
49
+ function formatVinextPrerenderLabel(decision) {
50
+ if (decision.reason === "next-export") return "Pre-rendering all routes (output: 'export')...";
51
+ if (decision.reason === "vinext-config") return "Pre-rendering all routes (vinext prerender config)...";
52
+ return "Pre-rendering all routes...";
53
+ }
54
+ //#endregion
55
+ export { VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY, findVinextPrerenderConfigInPlugins, formatVinextPrerenderLabel, loadVinextPrerenderConfigFromViteConfig, normalizeVinextPrerenderConfig, resolveVinextPrerenderDecision };
@@ -47,12 +47,16 @@ function toDocumentOnlyAppRoute(route) {
47
47
  isDynamic: route.isDynamic
48
48
  };
49
49
  }
50
+ function requiresDynamicNavigationRequest(route) {
51
+ return route.isDynamic && route.parallelSlots.length > 0;
52
+ }
50
53
  /** Project an `AppRoute` down to the public `VinextLinkPrefetchRoute` shape. */
51
54
  function toLinkPrefetchRoute(route) {
52
55
  return {
53
56
  canPrefetchLoadingShell: route.loadingPath !== null,
54
57
  patternParts: [...route.patternParts],
55
- isDynamic: route.isDynamic
58
+ isDynamic: route.isDynamic,
59
+ ...requiresDynamicNavigationRequest(route) ? { requiresDynamicNavigationRequest: true } : {}
56
60
  };
57
61
  }
58
62
  function buildRouteManifestExpression(routeManifest) {
@@ -1,4 +1,4 @@
1
- import { NextHeader, NextI18nConfig, NextRedirect, NextRewrite } from "../config/next-config.js";
1
+ import { NextHeader, NextI18nConfig, NextRedirect, NextRewrite, PrefetchInliningConfig } from "../config/next-config.js";
2
2
  import { AppRoute } from "../routing/app-route-graph.js";
3
3
  import { MetadataFileRoute } from "../server/metadata-routes.js";
4
4
  import { ImageConfig } from "../server/image-optimization.js";
@@ -43,8 +43,10 @@ type AppRouterConfig = {
43
43
  */
44
44
  reactMaxHeadersLength?: number; /** Maximum in-memory cache size in bytes. 0 disables the default memory cache. */
45
45
  cacheMaxMemorySize?: number; /** Inline app CSS into production HTML (from experimental.inlineCss). */
46
- inlineCss?: boolean; /** Enables Next.js Cache Components semantics for App Router document HTML. */
47
- cacheComponents?: boolean; /** Whether the RSC build discovered any server references. Defaults to true. */
46
+ inlineCss?: boolean; /** Enable standalone route-miss 404 handling (from experimental.globalNotFound). */
47
+ globalNotFound?: boolean; /** Enables Next.js Cache Components semantics for App Router document HTML. */
48
+ cacheComponents?: boolean; /** Resolved `experimental.prefetchInlining` thresholds. */
49
+ prefetchInlining?: PrefetchInliningConfig; /** Whether the RSC build discovered any server references. Defaults to true. */
48
50
  hasServerActions?: boolean; /** Internationalization routing config for middleware matcher locale handling. */
49
51
  i18n?: NextI18nConfig | null;
50
52
  imageConfig?: ImageConfig;