vinext 0.2.1 → 1.0.0-beta.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 (236) hide show
  1. package/README.md +67 -30
  2. package/dist/build/assets-ignore.js +1 -1
  3. package/dist/build/clean-output.js +1 -1
  4. package/dist/build/client-build-config.d.ts +13 -92
  5. package/dist/build/client-build-config.js +23 -99
  6. package/dist/build/css-url-assets.js +3 -3
  7. package/dist/build/google-fonts/fallback-metrics.js +1 -1
  8. package/dist/build/google-fonts/font-metadata.js +1 -1
  9. package/dist/build/inject-pregenerated-paths.js +1 -1
  10. package/dist/build/inline-css.js +2 -5
  11. package/dist/build/module-dependency-cache.d.ts +4 -0
  12. package/dist/build/module-dependency-cache.js +13 -0
  13. package/dist/build/next-client-runtime-manifests.js +1 -1
  14. package/dist/build/pages-client-assets-module.js +1 -1
  15. package/dist/build/precompress.js +7 -7
  16. package/dist/build/prerender-paths.d.ts +23 -0
  17. package/dist/build/prerender-paths.js +291 -0
  18. package/dist/build/prerender-server-pool.js +2 -2
  19. package/dist/build/prerender.d.ts +12 -1
  20. package/dist/build/prerender.js +2 -2
  21. package/dist/build/preview-credentials.d.ts +11 -0
  22. package/dist/build/preview-credentials.js +19 -0
  23. package/dist/build/report.d.ts +0 -3
  24. package/dist/build/report.js +2 -4
  25. package/dist/build/run-prerender.d.ts +2 -11
  26. package/dist/build/run-prerender.js +2 -10
  27. package/dist/build/server-manifest.js +1 -1
  28. package/dist/build/ssr-manifest.d.ts +4 -0
  29. package/dist/build/ssr-manifest.js +10 -6
  30. package/dist/build/standalone.js +37 -37
  31. package/dist/cache/cache-adapters-virtual.d.ts +7 -17
  32. package/dist/cache/cache-adapters-virtual.js +35 -2
  33. package/dist/check.d.ts +0 -16
  34. package/dist/check.js +17 -34
  35. package/dist/cli.js +86 -101
  36. package/dist/client/instrumentation-client-inject.js +1 -1
  37. package/dist/client/pages-router-link-navigation.js +1 -1
  38. package/dist/config/config-matchers.js +2 -2
  39. package/dist/config/dotenv.js +1 -1
  40. package/dist/config/next-config.d.ts +4 -1
  41. package/dist/config/next-config.js +82 -16
  42. package/dist/config/prerender.d.ts +12 -2
  43. package/dist/config/prerender.js +22 -12
  44. package/dist/config/server-external-packages.js +1 -1
  45. package/dist/config/tsconfig-paths.js +7 -3
  46. package/dist/{node_modules/.pnpm/am-i-vibing@0.5.0/node_modules → deps/.pnpm/am-i-vibing@0.5.0/deps}/am-i-vibing/dist/detector-1yx2Hoe0.js +2 -2
  47. package/dist/deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js +50 -0
  48. package/dist/entries/app-rsc-entry.js +12 -5
  49. package/dist/entries/app-rsc-manifest.js +4 -4
  50. package/dist/entries/pages-client-entry.js +6 -5
  51. package/dist/entries/pages-server-entry.js +15 -26
  52. package/dist/entries/runtime-entry-module.js +2 -2
  53. package/dist/image/image-adapters-virtual.js +1 -0
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.js +500 -338
  56. package/dist/init-cloudflare.js +13 -4
  57. package/dist/init-platform.d.ts +10 -1
  58. package/dist/init-platform.js +79 -13
  59. package/dist/init.d.ts +11 -3
  60. package/dist/init.js +133 -35
  61. package/dist/plugins/ast-utils.js +1 -1
  62. package/dist/plugins/dynamic-preload-metadata.js +7 -7
  63. package/dist/plugins/extensionless-dynamic-import.js +1 -1
  64. package/dist/plugins/fonts.js +3 -3
  65. package/dist/plugins/ignore-dynamic-requests.js +13 -8
  66. package/dist/plugins/import-meta-url.js +16 -17
  67. package/dist/plugins/middleware-export-validation.js +1 -1
  68. package/dist/plugins/middleware-server-only.js +2 -2
  69. package/dist/plugins/og-asset-ownership.js +7 -6
  70. package/dist/plugins/og-assets.js +4 -5
  71. package/dist/plugins/optimize-imports.js +12 -13
  72. package/dist/plugins/postcss.js +1 -1
  73. package/dist/plugins/remove-console.js +1 -1
  74. package/dist/plugins/require-context.js +1 -1
  75. package/dist/plugins/sass.js +2 -2
  76. package/dist/plugins/server-externals-manifest.js +1 -1
  77. package/dist/plugins/strip-server-exports.js +1 -1
  78. package/dist/plugins/styled-jsx.js +3 -2
  79. package/dist/plugins/typeof-window.js +1 -1
  80. package/dist/routing/app-route-graph.d.ts +3 -10
  81. package/dist/routing/app-route-graph.js +28 -76
  82. package/dist/routing/app-router.d.ts +0 -5
  83. package/dist/routing/app-router.js +0 -5
  84. package/dist/routing/file-matcher.d.ts +2 -6
  85. package/dist/routing/file-matcher.js +10 -11
  86. package/dist/routing/pages-router.js +3 -3
  87. package/dist/server/api-handler.js +41 -33
  88. package/dist/server/app-browser-entry.js +15 -11
  89. package/dist/server/app-browser-navigation-controller.js +9 -4
  90. package/dist/server/app-browser-server-action-client.js +1 -1
  91. package/dist/server/app-elements-wire.d.ts +2 -1
  92. package/dist/server/app-fallback-renderer.d.ts +8 -0
  93. package/dist/server/app-fallback-renderer.js +13 -1
  94. package/dist/server/app-layout-param-observation.d.ts +1 -1
  95. package/dist/server/app-page-boundary-render.d.ts +14 -1
  96. package/dist/server/app-page-boundary-render.js +107 -54
  97. package/dist/server/app-page-cache-render.d.ts +1 -1
  98. package/dist/server/app-page-dispatch.d.ts +2 -1
  99. package/dist/server/app-page-dispatch.js +29 -40
  100. package/dist/server/app-page-element-builder.d.ts +2 -1
  101. package/dist/server/app-page-element-builder.js +3 -3
  102. package/dist/server/app-page-execution.d.ts +3 -1
  103. package/dist/server/app-page-execution.js +31 -39
  104. package/dist/server/app-page-render.d.ts +1 -1
  105. package/dist/server/app-page-request.js +1 -1
  106. package/dist/server/app-page-route-wiring.js +4 -4
  107. package/dist/server/app-route-handler-execution.d.ts +1 -1
  108. package/dist/server/app-route-tree-prefetch.js +1 -1
  109. package/dist/server/app-rsc-cache-busting.js +1 -2
  110. package/dist/server/app-rsc-handler.js +2 -2
  111. package/dist/server/app-rsc-redirect-flight.d.ts +66 -0
  112. package/dist/server/app-rsc-redirect-flight.js +71 -0
  113. package/dist/server/app-rsc-render-mode.d.ts +2 -5
  114. package/dist/server/app-rsc-render-mode.js +2 -12
  115. package/dist/server/app-segment-config.js +2 -2
  116. package/dist/server/app-server-action-execution.js +3 -3
  117. package/dist/server/app-ssr-entry.js +4 -1
  118. package/dist/server/app-ssr-stream.d.ts +2 -1
  119. package/dist/server/app-ssr-stream.js +4 -1
  120. package/dist/server/cache-proof.js +1 -1
  121. package/dist/server/default-global-error-module.d.ts +3 -1
  122. package/dist/server/default-not-found-module.d.ts +3 -1
  123. package/dist/server/dev-lockfile.js +2 -3
  124. package/dist/server/dev-module-runner.js +1 -1
  125. package/dist/server/dev-origin-check.d.ts +2 -2
  126. package/dist/server/dev-origin-check.js +2 -2
  127. package/dist/server/dev-route-files.js +1 -1
  128. package/dist/server/dev-server.js +256 -164
  129. package/dist/server/dev-stack-sourcemap.js +4 -3
  130. package/dist/server/headers.d.ts +3 -1
  131. package/dist/server/headers.js +3 -1
  132. package/dist/server/image-optimization.d.ts +12 -1
  133. package/dist/server/image-optimization.js +15 -3
  134. package/dist/server/implicit-tags.js +2 -1
  135. package/dist/server/instrumentation.js +2 -2
  136. package/dist/server/isr-cache.d.ts +12 -4
  137. package/dist/server/isr-cache.js +3 -3
  138. package/dist/server/metadata-routes.js +4 -4
  139. package/dist/server/middleware-response-headers.js +1 -1
  140. package/dist/server/middleware-runtime.js +1 -1
  141. package/dist/server/middleware.d.ts +1 -0
  142. package/dist/server/middleware.js +1 -1
  143. package/dist/server/navigation-planner.d.ts +2 -0
  144. package/dist/server/navigation-planner.js +8 -2
  145. package/dist/server/next-error-digest.d.ts +9 -24
  146. package/dist/server/next-error-digest.js +23 -15
  147. package/dist/server/operation-token.js +1 -1
  148. package/dist/server/pages-body-parser-config.js +2 -1
  149. package/dist/server/pages-dev-hydration.d.ts +14 -0
  150. package/dist/server/pages-dev-hydration.js +83 -0
  151. package/dist/server/pages-dev-module-url.js +2 -2
  152. package/dist/server/pages-node-compat.d.ts +13 -6
  153. package/dist/server/pages-node-compat.js +44 -45
  154. package/dist/server/pages-page-data.d.ts +1 -1
  155. package/dist/server/pages-page-data.js +5 -4
  156. package/dist/server/pages-page-handler.js +61 -29
  157. package/dist/server/pages-page-response.d.ts +2 -2
  158. package/dist/server/pages-page-response.js +2 -2
  159. package/dist/server/pages-preview.d.ts +26 -0
  160. package/dist/server/pages-preview.js +165 -0
  161. package/dist/server/pages-readiness.d.ts +2 -1
  162. package/dist/server/pages-readiness.js +4 -2
  163. package/dist/server/pages-request-pipeline.js +1 -1
  164. package/dist/server/prerender-manifest.d.ts +15 -1
  165. package/dist/server/prerender-manifest.js +29 -1
  166. package/dist/server/prod-server.d.ts +6 -5
  167. package/dist/server/prod-server.js +15 -15
  168. package/dist/server/request-pipeline.js +1 -1
  169. package/dist/server/seed-cache.js +1 -1
  170. package/dist/server/socket-error-backstop.js +1 -1
  171. package/dist/server/static-file-cache.js +8 -9
  172. package/dist/server/worker-utils.js +1 -1
  173. package/dist/shims/cache.d.ts +1 -1
  174. package/dist/shims/cache.js +2 -1
  175. package/dist/shims/cdn-cache.d.ts +2 -7
  176. package/dist/shims/cdn-cache.js +2 -14
  177. package/dist/shims/constants.js +1 -1
  178. package/dist/shims/error-boundary.d.ts +4 -4
  179. package/dist/shims/error.d.ts +21 -5
  180. package/dist/shims/error.js +52 -14
  181. package/dist/shims/fetch-cache.js +1 -1
  182. package/dist/shims/font-utils.js +1 -1
  183. package/dist/shims/form.d.ts +1 -1
  184. package/dist/shims/head.js +3 -3
  185. package/dist/shims/headers.js +6 -4
  186. package/dist/shims/internal/pages-data-fetch-dedup.js +5 -3
  187. package/dist/shims/layout-segment-context.d.ts +1 -1
  188. package/dist/shims/link.d.ts +3 -1
  189. package/dist/shims/link.js +6 -3
  190. package/dist/shims/navigation-errors.d.ts +2 -1
  191. package/dist/shims/navigation-errors.js +9 -13
  192. package/dist/shims/navigation.d.ts +1 -1
  193. package/dist/shims/navigation.js +5 -5
  194. package/dist/shims/request-state-types.d.ts +2 -2
  195. package/dist/shims/router-state.d.ts +1 -0
  196. package/dist/shims/router.d.ts +2 -1
  197. package/dist/shims/router.js +18 -11
  198. package/dist/shims/script.js +1 -1
  199. package/dist/shims/server.js +2 -2
  200. package/dist/shims/slot.d.ts +1 -1
  201. package/dist/shims/thenable-params.js +1 -1
  202. package/dist/shims/unified-request-context.d.ts +1 -1
  203. package/dist/typegen.js +9 -11
  204. package/dist/utils/client-build-manifest.js +2 -2
  205. package/dist/utils/client-entry-manifest.js +1 -1
  206. package/dist/utils/client-runtime-metadata.js +1 -1
  207. package/dist/utils/commonjs-loader.js +3 -3
  208. package/dist/utils/mdx-scan.js +1 -1
  209. package/dist/utils/path.d.ts +1 -13
  210. package/dist/utils/path.js +1 -15
  211. package/dist/utils/plugin-options.d.ts +4 -0
  212. package/dist/utils/plugin-options.js +8 -0
  213. package/dist/utils/project.d.ts +1 -7
  214. package/dist/utils/project.js +2 -8
  215. package/dist/utils/public-routes.js +2 -2
  216. package/dist/utils/react-version.js +1 -1
  217. package/dist/utils/redirect-digest.d.ts +9 -0
  218. package/dist/utils/redirect-digest.js +25 -0
  219. package/dist/utils/vinext-root.js +1 -1
  220. package/dist/utils/vite-version.d.ts +6 -13
  221. package/dist/utils/vite-version.js +68 -34
  222. package/package.json +33 -14
  223. package/dist/cloudflare/index.d.ts +0 -3
  224. package/dist/cloudflare/index.js +0 -3
  225. package/dist/packages/cloudflare/src/cache/cdn-adapter.runtime.js +0 -102
  226. package/dist/packages/cloudflare/src/cache/kv-data-adapter.runtime.d.ts +0 -126
  227. package/dist/packages/cloudflare/src/cache/kv-data-adapter.runtime.js +0 -442
  228. package/dist/packages/cloudflare/src/deploy-config.js +0 -150
  229. package/dist/packages/cloudflare/src/deploy-help.js +0 -55
  230. package/dist/packages/cloudflare/src/deploy.js +0 -272
  231. package/dist/packages/cloudflare/src/tpr.d.ts +0 -45
  232. package/dist/packages/cloudflare/src/tpr.js +0 -582
  233. package/dist/packages/cloudflare/src/utils/cache-control-metadata.js +0 -20
  234. /package/dist/build/google-fonts/{fallback-metrics-data.js → fallback-metrics-data.json.js} +0 -0
  235. /package/dist/build/google-fonts/{font-data.js → font-data.json.js} +0 -0
  236. /package/dist/{node_modules/.pnpm/process-ancestry@0.1.0/node_modules → deps/.pnpm/process-ancestry@0.1.0/deps}/process-ancestry/dist/index.js +0 -0
package/dist/cli.js CHANGED
@@ -1,29 +1,28 @@
1
1
  #!/usr/bin/env node
2
+ import path, { toSlash } from "./deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
3
  import { detectPackageManager, ensureViteConfigCompatibility, hasAppDir, hasViteConfig } from "./utils/project.js";
3
- import { normalizePathSeparators } from "./utils/path.js";
4
4
  import { formatReport, runCheck } from "./check.js";
5
5
  import { parseArgs } from "./cli-args.js";
6
6
  import { createDevServerConfigPlugin, normalizeDevServerHostname } from "./cli-dev-config.js";
7
7
  import { PHASE_PRODUCTION_BUILD } from "./shims/constants.js";
8
- import { createRscCompatibilityId, loadNextConfig, resolveNextConfig } from "./config/next-config.js";
8
+ import { createRscCompatibilityId, findVinextNextConfigInPlugins, loadNextConfig, resolveNextConfig, resolveNextConfigInput } from "./config/next-config.js";
9
9
  import { generateRouteTypes } from "./typegen.js";
10
10
  import { clearPagesClientAssetsBuildMetadata } from "./build/pages-client-assets-module.js";
11
- import { findVinextPrerenderConfigInPlugins, formatVinextPrerenderLabel, resolveVinextPrerenderDecision } from "./config/prerender.js";
11
+ import { runWithPreviewBuildCredentials } from "./build/preview-credentials.js";
12
+ import { findVinextPrerenderConfigInPlugins, findVinextRouteRootConfigInPlugins, formatVinextPrerenderLabel, resolveVinextPrerenderDecision } from "./config/prerender.js";
12
13
  import vinext from "./index.js";
13
14
  import { runPrerender } from "./build/run-prerender.js";
14
- import { loadDotenv } from "./config/dotenv.js";
15
- import { deploy, parseDeployArgs } from "./packages/cloudflare/src/deploy.js";
16
- import { printDeployHelp } from "./packages/cloudflare/src/deploy-help.js";
15
+ import { emitPrerenderPathManifest } from "./build/prerender-paths.js";
17
16
  import { getReactUpgradeDeps } from "./utils/react-version.js";
18
17
  import { init } from "./init.js";
19
- import { INIT_PLATFORMS, resolveInitPlatform, resolveInitPrerender } from "./init-platform.js";
18
+ import { resolveInitOptions } from "./init-platform.js";
19
+ import { loadDotenv } from "./config/dotenv.js";
20
20
  import { resolveVinextPackageRoot } from "./utils/vinext-root.js";
21
21
  import { emitStandaloneOutput } from "./build/standalone.js";
22
22
  import { cleanBuildOutput } from "./build/clean-output.js";
23
23
  import { formatAlreadyRunningError, tryAcquireLockfile } from "./server/dev-lockfile.js";
24
24
  import { createRequire } from "node:module";
25
25
  import fs from "node:fs";
26
- import path from "node:path";
27
26
  import { pathToFileURL } from "node:url";
28
27
  import { randomBytes } from "node:crypto";
29
28
  import { execFileSync } from "node:child_process";
@@ -34,7 +33,6 @@ import { execFileSync } from "node:child_process";
34
33
  * vinext dev Start development server (Vite)
35
34
  * vinext build Build for production
36
35
  * vinext start Start production server
37
- * vinext deploy Deprecated Cloudflare deploy shim
38
36
  * vinext typegen Generate App Router route helper types
39
37
  * vinext lint Run linter (delegates to eslint/oxlint)
40
38
  *
@@ -128,7 +126,11 @@ function hasPagesDir() {
128
126
  return fs.existsSync(path.join(process.cwd(), "pages")) || fs.existsSync(path.join(process.cwd(), "src", "pages"));
129
127
  }
130
128
  async function loadBuildViteConfigMetadata(vite, root) {
131
- if (!hasViteConfig(root)) return { prerenderConfig: null };
129
+ if (!hasViteConfig(root)) return {
130
+ nextConfig: null,
131
+ prerenderConfig: null,
132
+ routeRootConfig: null
133
+ };
132
134
  const loaded = await vite.loadConfigFromFile({
133
135
  command: "build",
134
136
  mode: "production"
@@ -136,7 +138,9 @@ async function loadBuildViteConfigMetadata(vite, root) {
136
138
  const emptyOutDir = loaded?.config.build?.emptyOutDir;
137
139
  return {
138
140
  emptyOutDir: typeof emptyOutDir === "boolean" ? emptyOutDir : void 0,
139
- prerenderConfig: findVinextPrerenderConfigInPlugins(loaded?.config.plugins)
141
+ nextConfig: await findVinextNextConfigInPlugins(loaded?.config.plugins),
142
+ prerenderConfig: await findVinextPrerenderConfigInPlugins(loaded?.config.plugins),
143
+ routeRootConfig: await findVinextRouteRootConfigInPlugins(loaded?.config.plugins)
140
144
  };
141
145
  }
142
146
  /**
@@ -277,12 +281,12 @@ async function buildApp() {
277
281
  });
278
282
  applyViteConfigCompatibility(process.cwd());
279
283
  const vite = await loadVite();
280
- const viteMajorVersion = Number.parseInt(vite.version, 10) || 7;
281
- const withBuildBundlerOptions = (bundlerOptions) => viteMajorVersion >= 8 ? { rolldownOptions: bundlerOptions } : { rollupOptions: bundlerOptions };
284
+ const withBuildBundlerOptions = (bundlerOptions) => ({ rolldownOptions: bundlerOptions });
282
285
  console.log(`\n vinext build (Vite ${getViteVersion()})\n`);
283
- const root = process.cwd();
284
- const isApp = hasAppDir(normalizePathSeparators(root));
285
- const resolvedNextConfig = await resolveNextConfig(await loadNextConfig(root, PHASE_PRODUCTION_BUILD), root);
286
+ const root = toSlash(process.cwd());
287
+ const isApp = hasAppDir(root);
288
+ const buildConfigMetadata = await loadBuildViteConfigMetadata(vite, root);
289
+ const resolvedNextConfig = await resolveNextConfig(buildConfigMetadata.nextConfig ? await resolveNextConfigInput(buildConfigMetadata.nextConfig, PHASE_PRODUCTION_BUILD) : await loadNextConfig(root, PHASE_PRODUCTION_BUILD), root);
286
290
  process.env.__VINEXT_SHARED_BUILD_ID = resolvedNextConfig.buildId;
287
291
  process.env.__VINEXT_SHARED_RSC_COMPATIBILITY_ID = createRscCompatibilityId(resolvedNextConfig);
288
292
  if (!process.env.__VINEXT_SHARED_REVALIDATE_SECRET) process.env.__VINEXT_SHARED_REVALIDATE_SECRET = randomBytes(32).toString("hex");
@@ -308,7 +312,6 @@ async function buildApp() {
308
312
  });
309
313
  }
310
314
  }
311
- const buildConfigMetadata = await loadBuildViteConfigMetadata(vite, root);
312
315
  cleanBuildOutput({
313
316
  root,
314
317
  outDir: distDir,
@@ -317,46 +320,48 @@ async function buildApp() {
317
320
  const isHybrid = isApp && hasPagesDir();
318
321
  const pagesClientAssetsBuildSession = isHybrid ? randomBytes(16).toString("hex") : null;
319
322
  if (pagesClientAssetsBuildSession) process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION = pagesClientAssetsBuildSession;
320
- try {
321
- const config = buildViteConfig({}, logger);
322
- await (await vite.createBuilder(config)).buildApp();
323
- if (isHybrid) {
324
- console.log(" Building Pages Router server (hybrid)...");
325
- const root = process.cwd();
326
- let userTransformPlugins = [];
327
- if (hasViteConfig(process.cwd())) {
328
- const loaded = await vite.loadConfigFromFile({
329
- command: "build",
330
- mode: "production",
331
- isSsrBuild: true
332
- }, void 0, root);
333
- if (loaded?.config.plugins) userTransformPlugins = loaded.config.plugins.flat(Infinity).filter((p) => !!p && typeof p.name === "string" && !p.name.startsWith("vinext:") && !p.name.startsWith("vite:react") && !p.name.startsWith("rsc:") && p.name !== "vite-rsc-load-module-dev-proxy" && p.name !== "vite-tsconfig-paths" && !p.name.startsWith("vite-plugin-cloudflare"));
334
- }
335
- await vite.build({
336
- root,
337
- configFile: false,
338
- plugins: [...userTransformPlugins, vinext({ disableAppRouter: true })],
339
- resolve: { dedupe: [
340
- "react",
341
- "react-dom",
342
- "react/jsx-runtime",
343
- "react/jsx-dev-runtime"
344
- ] },
345
- ...logger ? { customLogger: logger } : {},
346
- build: {
347
- outDir: "dist/server",
348
- emptyOutDir: false,
349
- ssr: "virtual:vinext-server-entry",
350
- ...withBuildBundlerOptions({ output: { entryFileNames: "entry.js" } })
323
+ await runWithPreviewBuildCredentials(async () => {
324
+ try {
325
+ const config = buildViteConfig({}, logger);
326
+ await (await vite.createBuilder(config)).buildApp();
327
+ if (isHybrid) {
328
+ console.log(" Building Pages Router server (hybrid)...");
329
+ const root = process.cwd();
330
+ let userTransformPlugins = [];
331
+ if (hasViteConfig(process.cwd())) {
332
+ const loaded = await vite.loadConfigFromFile({
333
+ command: "build",
334
+ mode: "production",
335
+ isSsrBuild: true
336
+ }, void 0, root);
337
+ if (loaded?.config.plugins) userTransformPlugins = loaded.config.plugins.flat(Infinity).filter((p) => !!p && typeof p.name === "string" && !p.name.startsWith("vinext:") && !p.name.startsWith("vite:react") && !p.name.startsWith("rsc:") && p.name !== "vite-rsc-load-module-dev-proxy" && !p.name.startsWith("vite-plugin-cloudflare"));
351
338
  }
352
- });
353
- }
354
- } finally {
355
- if (pagesClientAssetsBuildSession) {
356
- clearPagesClientAssetsBuildMetadata(pagesClientAssetsBuildSession);
357
- if (process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION === pagesClientAssetsBuildSession) delete process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION;
339
+ await vite.build({
340
+ root,
341
+ configFile: false,
342
+ plugins: [...userTransformPlugins, vinext({ disableAppRouter: true })],
343
+ resolve: { dedupe: [
344
+ "react",
345
+ "react-dom",
346
+ "react/jsx-runtime",
347
+ "react/jsx-dev-runtime"
348
+ ] },
349
+ ...logger ? { customLogger: logger } : {},
350
+ build: {
351
+ outDir: "dist/server",
352
+ emptyOutDir: false,
353
+ ssr: "virtual:vinext-server-entry",
354
+ ...withBuildBundlerOptions({ output: { entryFileNames: "entry.js" } })
355
+ }
356
+ });
357
+ }
358
+ } finally {
359
+ if (pagesClientAssetsBuildSession) {
360
+ clearPagesClientAssetsBuildMetadata(pagesClientAssetsBuildSession);
361
+ if (process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION === pagesClientAssetsBuildSession) delete process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION;
362
+ }
358
363
  }
359
- }
364
+ });
360
365
  if (outputMode === "standalone") {
361
366
  const standalone = emitStandaloneOutput({
362
367
  root: process.cwd(),
@@ -380,14 +385,20 @@ async function buildApp() {
380
385
  process.stdout.write("\x1B[0m");
381
386
  console.log(` ${formatVinextPrerenderLabel(prerenderDecision)}`);
382
387
  prerenderResult = await runPrerender({
383
- root: normalizePathSeparators(process.cwd()),
384
- concurrency: parsed.prerenderConcurrency
388
+ root,
389
+ concurrency: parsed.prerenderConcurrency,
390
+ nextConfig: resolvedNextConfig
391
+ });
392
+ await emitPrerenderPathManifest({
393
+ root,
394
+ nextConfig: resolvedNextConfig,
395
+ routeRootConfig: buildConfigMetadata.routeRootConfig
385
396
  });
386
397
  }
387
398
  process.stdout.write("\x1B[0m");
388
399
  const { printBuildReport } = await import("./build/report.js");
389
400
  await printBuildReport({
390
- root: normalizePathSeparators(process.cwd()),
401
+ root,
391
402
  pageExtensions: resolvedNextConfig.pageExtensions,
392
403
  prerenderResult: prerenderResult ?? void 0
393
404
  });
@@ -452,39 +463,15 @@ async function lint() {
452
463
  process.exit(1);
453
464
  }
454
465
  }
455
- async function deployCommand() {
456
- const parsed = parseDeployArgs(rawArgs);
457
- if (parsed.help) {
458
- printDeployDeprecationWarning();
459
- printDeployHelp();
460
- return;
461
- }
462
- printDeployDeprecationWarning();
463
- await loadVite();
464
- console.log(`\n vinext deploy (Vite ${getViteVersion()})\n`);
465
- await deploy({
466
- root: process.cwd(),
467
- preview: parsed.preview,
468
- env: parsed.env,
469
- skipBuild: parsed.skipBuild,
470
- dryRun: parsed.dryRun,
471
- name: parsed.name,
472
- prerenderAll: parsed.prerenderAll,
473
- prerenderConcurrency: parsed.prerenderConcurrency,
474
- experimentalTPR: parsed.experimentalTPR,
475
- tprCoverage: parsed.tprCoverage,
476
- tprLimit: parsed.tprLimit,
477
- tprWindow: parsed.tprWindow
478
- });
479
- }
480
- function printDeployDeprecationWarning() {
481
- console.log(" ⚠️ Warning: `vinext deploy` has moved to the `@vinext/cloudflare` package.\n Please switch to `npx @vinext/cloudflare deploy` or `vp exec vinext-cloudflare deploy`; this compatibility command will be removed in a future release.\n");
466
+ function failRemovedDeployCommand() {
467
+ console.error("\n Error: `vinext deploy` has moved to the `@vinext/cloudflare` package.\n\n Run `npx @vinext/cloudflare deploy` or `vp exec vinext-cloudflare deploy` instead.\n");
468
+ process.exit(1);
482
469
  }
483
470
  async function check() {
484
471
  if (parseArgs(rawArgs).help) return printHelp("check");
485
472
  console.log(`\n vinext check\n`);
486
473
  console.log(" Scanning project...\n");
487
- const result = runCheck(normalizePathSeparators(process.cwd()));
474
+ const result = runCheck(toSlash(process.cwd()));
488
475
  console.log(formatReport(result));
489
476
  }
490
477
  async function typegen() {
@@ -508,17 +495,13 @@ async function initCommand() {
508
495
  const port = parsed.port ?? 3001;
509
496
  const skipCheck = rawArgs.includes("--skip-check");
510
497
  const force = rawArgs.includes("--force");
511
- const platform = await resolveInitPlatform(rawArgs);
512
- const platformOptions = await INIT_PLATFORMS[platform].options(rawArgs);
513
- const prerender = await resolveInitPrerender(rawArgs);
498
+ const initOptions = await resolveInitOptions(rawArgs);
514
499
  await init({
515
500
  root: process.cwd(),
516
501
  port,
517
502
  skipCheck,
518
503
  force,
519
- platform,
520
- prerender,
521
- cloudflare: platform === "cloudflare" ? platformOptions : void 0
504
+ ...initOptions
522
505
  });
523
506
  }
524
507
  function printHelp(cmd) {
@@ -574,11 +557,7 @@ function printHelp(cmd) {
574
557
  `);
575
558
  return;
576
559
  }
577
- if (cmd === "deploy") {
578
- printDeployDeprecationWarning();
579
- printDeployHelp();
580
- return;
581
- }
560
+ if (cmd === "deploy") failRemovedDeployCommand();
582
561
  if (cmd === "check") {
583
562
  console.log(`
584
563
  vinext check - Scan Next.js app for compatibility
@@ -611,6 +590,11 @@ function printHelp(cmd) {
611
590
  --platform <target> Deployment target: cloudflare or node
612
591
  --prerender Configure vinext build to pre-render all static routes
613
592
  (default: prompt, with No selected by default)
593
+ --experimental-warm-cdn-cache
594
+ Add experimental CDN pre-warming to the Cloudflare deploy script
595
+ (Workers Cache CDN only, default: prompt with No)
596
+ --cdn-cache <type> Cloudflare CDN cache: workers-cache or data-cache
597
+ (default: workers-cache)
614
598
  --data-cache <type> Cloudflare data cache: kv or none (default: kv)
615
599
  --image-optimization <type>
616
600
  Cloudflare image optimization: cloudflare-images or none
@@ -619,11 +603,15 @@ function printHelp(cmd) {
619
603
  Examples:
620
604
  vinext init Prompt for a deployment platform
621
605
  vinext init --platform=cloudflare Configure Cloudflare Workers (default)
606
+ vinext init --platform=cloudflare --cdn-cache=data-cache
607
+ Fall through CDN caching to the data cache
622
608
  vinext init --platform=cloudflare --data-cache=kv
623
609
  Configure the default Cloudflare cache handlers
624
610
  vinext init --platform=cloudflare --image-optimization=none
625
611
  Do not configure Cloudflare Images
626
612
  vinext init --prerender Add prerender: { routes: "*" } to vite.config.ts
613
+ vinext init --experimental-warm-cdn-cache
614
+ Add experimental CDN pre-warming to deploy:vinext
627
615
  vinext init --platform=node Configure a Node deployment
628
616
  vinext init -p 4000 Use port 4000 for dev:vinext
629
617
  vinext init --force Overwrite existing vite.config.ts
@@ -722,10 +710,7 @@ switch (command) {
722
710
  });
723
711
  break;
724
712
  case "deploy":
725
- deployCommand().catch((e) => {
726
- console.error(e);
727
- process.exit(1);
728
- });
713
+ failRemovedDeployCommand();
729
714
  break;
730
715
  case "init":
731
716
  initCommand().catch((e) => {
@@ -1,5 +1,5 @@
1
+ import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
1
2
  import fs from "node:fs";
2
- import path from "node:path";
3
3
  //#region src/client/instrumentation-client-inject.ts
4
4
  /** Resolve empty-module next to this file (.js in dist, .ts in source). */
5
5
  function resolveInstrumentationClientEmptyModule(dir) {
@@ -2,7 +2,7 @@ import { stripBasePath } from "../utils/base-path.js";
2
2
  import { getLocalePathPrefix } from "../utils/domain-locale.js";
3
3
  //#region src/client/pages-router-link-navigation.ts
4
4
  function resolvePagesRouterQueryOnlyHref(href, { asPath, basePath, fallbackHref, locales }) {
5
- if (!href.startsWith("?")) return href;
5
+ if (!href.startsWith("?") && !href.startsWith("#")) return href;
6
6
  try {
7
7
  const fallbackUrl = new URL(fallbackHref);
8
8
  const base = new URL(asPath ?? `${stripBasePath(fallbackUrl.pathname, basePath)}${fallbackUrl.search}${fallbackUrl.hash}`, "http://vinext.local");
@@ -159,7 +159,7 @@ function _getRedirectIndex(redirects) {
159
159
  return index;
160
160
  }
161
161
  /** Hop-by-hop headers that should not be forwarded through a proxy. */
162
- const HOP_BY_HOP_HEADERS = new Set([
162
+ const HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
163
163
  "connection",
164
164
  "keep-alive",
165
165
  "proxy-authenticate",
@@ -175,7 +175,7 @@ const HOP_BY_HOP_HEADERS = new Set([
175
175
  * still forwards proxy auth credentials, while response sanitization strips
176
176
  * them before returning data to the client.
177
177
  */
178
- const REQUEST_HOP_BY_HOP_HEADERS = new Set([
178
+ const REQUEST_HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
179
179
  "connection",
180
180
  "keep-alive",
181
181
  "te",
@@ -1,5 +1,5 @@
1
+ import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
1
2
  import fs from "node:fs";
2
- import path from "node:path";
3
3
  import { parseEnv } from "node:util";
4
4
  //#region src/config/dotenv.ts
5
5
  /**
@@ -1,6 +1,8 @@
1
1
  import { PHASE_PRODUCTION_BUILD } from "../shims/constants.js";
2
+ import { PluginOption } from "vite";
2
3
 
3
4
  //#region src/config/next-config.d.ts
5
+ declare const VINEXT_NEXT_CONFIG_PLUGIN_PROPERTY = "__vinextNextConfig";
4
6
  /**
5
7
  * Parse a body size limit value (string or number) into bytes.
6
8
  * Accepts Next.js-style strings like "1mb", "500kb", "10mb", bare number strings like "1048576" (bytes),
@@ -241,6 +243,7 @@ type NextConfigFactory = (phase: string, opts: {
241
243
  defaultConfig: NextConfig;
242
244
  }) => NextConfig | Promise<NextConfig>;
243
245
  type NextConfigInput = NextConfig | NextConfigFactory;
246
+ declare function findVinextNextConfigInPlugins(plugins: PluginOption[] | undefined): Promise<NextConfigInput | null>;
244
247
  /**
245
248
  * Resolved configuration with all async values awaited.
246
249
  */
@@ -564,4 +567,4 @@ declare function extractMdxOptions(config: NextConfig, root?: string): Promise<M
564
567
  */
565
568
  declare function detectNextIntlConfig(root: string, resolved: ResolvedNextConfig): void;
566
569
  //#endregion
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 };
570
+ export { HasCondition, MdxOptions, NextConfig, NextConfigInput, NextHeader, NextI18nConfig, NextRedirect, NextRewrite, PHASE_PRODUCTION_BUILD, PrefetchInliningConfig, ResolvedNextConfig, VINEXT_NEXT_CONFIG_PLUGIN_PROPERTY, createRscCompatibilityId, detectNextIntlConfig, extractMdxOptions, findNextConfigPath, findVinextNextConfigInPlugins, lightningCssFeatureNamesToMask, loadNextConfig, normalizeAssetPrefix, parseBodySizeLimit, reassignsModuleExports, referencesCjsGlobals, resolveNextConfig, resolveNextConfigInput };
@@ -1,14 +1,14 @@
1
+ import path, { toSlash } from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
1
2
  import { normalizePageExtensions } from "../routing/file-matcher.js";
2
3
  import { applyLocaleToRoutes, isExternalUrl } from "./config-matchers.js";
3
4
  import { isUnknownRecord } from "../utils/record.js";
4
5
  import { getHtmlLimitedBotRegex } from "../utils/html-limited-bots.js";
6
+ import { flattenPluginOptions } from "../utils/plugin-options.js";
5
7
  import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from "../shims/constants.js";
6
8
  import { loadTsconfigResolutionForRoot } from "./tsconfig-paths.js";
7
- import { getViteMajorVersion } from "../utils/vite-version.js";
8
9
  import { loadCommonJsModule, shouldRetryAsCommonJs } from "../utils/commonjs-loader.js";
9
10
  import { createRequire } from "node:module";
10
11
  import fs from "node:fs";
11
- import path from "node:path";
12
12
  import { fileURLToPath } from "node:url";
13
13
  import { randomUUID } from "node:crypto";
14
14
  import commonjs from "vite-plugin-commonjs";
@@ -19,6 +19,7 @@ import commonjs from "vite-plugin-commonjs";
19
19
  * Loads the Next.js config file (if present) and extracts supported options.
20
20
  * Unsupported options are logged as warnings.
21
21
  */
22
+ const VINEXT_NEXT_CONFIG_PLUGIN_PROPERTY = "__vinextNextConfig";
22
23
  /**
23
24
  * Parse a body size limit value (string or number) into bytes.
24
25
  * Accepts Next.js-style strings like "1mb", "500kb", "10mb", bare number strings like "1048576" (bytes),
@@ -64,6 +65,15 @@ function parseBodySizeLimit(value) {
64
65
  if (bytes < 1) throw new Error(`Body size limit must be a positive number, got ${bytes}`);
65
66
  return bytes;
66
67
  }
68
+ async function findVinextNextConfigInPlugins(plugins) {
69
+ const flattened = await flattenPluginOptions(plugins);
70
+ for (const plugin of flattened) {
71
+ if (!isUnknownRecord(plugin)) continue;
72
+ const nextConfig = plugin[VINEXT_NEXT_CONFIG_PLUGIN_PROPERTY];
73
+ if (nextConfig) return nextConfig;
74
+ }
75
+ return null;
76
+ }
67
77
  const CONFIG_FILES = [
68
78
  "next.config.ts",
69
79
  "next.config.mts",
@@ -151,10 +161,12 @@ async function unwrapConfig(mod, phase = PHASE_DEVELOPMENT_SERVER) {
151
161
  /**
152
162
  * Resolve a path through filesystem symlinks, falling back to the original
153
163
  * path when the file does not exist (e.g. virtual ids, query-suffixed ids).
164
+ * Output is forward-slashed so it compares consistently with pathslash
165
+ * results (fs.realpathSync returns backslashes on Windows).
154
166
  */
155
167
  function safeRealpath(p) {
156
168
  try {
157
- return fs.realpathSync(p);
169
+ return toSlash(fs.realpathSync(p));
158
170
  } catch {
159
171
  return p;
160
172
  }
@@ -315,7 +327,7 @@ async function loadNextConfig(root, phase = DEFAULT_PHASE) {
315
327
  const filename = path.basename(configPath);
316
328
  const isTypeScriptConfig = /\.[cm]?ts$/.test(configPath);
317
329
  const tsconfigResolution = loadTsconfigResolutionForRoot(root);
318
- const useNativeTsconfigPaths = !!(isTypeScriptConfig ? tsconfigResolution.baseUrl : null) && getViteMajorVersion() >= 8;
330
+ const useNativeTsconfigPaths = !!(isTypeScriptConfig ? tsconfigResolution.baseUrl : null);
319
331
  const normalizedConfigPath = safeRealpath(path.resolve(configPath));
320
332
  try {
321
333
  const { runnerImport } = await import("vite");
@@ -440,8 +452,8 @@ function createRscCompatibilityId(nextConfig) {
440
452
  * @returns A filesystem path suitable for path operations
441
453
  */
442
454
  function resolveCacheHandlerPathToFilesystem(filePath) {
443
- if (filePath.startsWith("file://")) return fileURLToPath(filePath);
444
- return filePath;
455
+ if (filePath.startsWith("file://")) return toSlash(fileURLToPath(filePath));
456
+ return toSlash(filePath);
445
457
  }
446
458
  function resolveHtmlLimitedBots(value) {
447
459
  const source = value instanceof RegExp ? value.source : typeof value === "string" ? value : void 0;
@@ -572,11 +584,71 @@ function normalizePrefetchInliningConfig(value) {
572
584
  maxSize: Number.isFinite(normalizedMaxSize) ? normalizedMaxSize : Number.MAX_SAFE_INTEGER
573
585
  };
574
586
  }
587
+ function normalizeI18nConfig(value) {
588
+ if (!value) return null;
589
+ const i18nType = typeof value;
590
+ if (i18nType !== "object") throw new Error(`Specified i18n should be an object received ${i18nType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
591
+ const i18n = value;
592
+ if (!Array.isArray(i18n.locales)) throw new Error(`Specified i18n.locales should be an Array received ${typeof i18n.locales}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
593
+ if (i18n.locales.length > 100) console.warn(`Received ${i18n.locales.length} i18n.locales items which exceeds the recommended max of 100.\nSee more info here: https://nextjs.org/docs/advanced-features/i18n-routing#how-does-this-work-with-static-generation`);
594
+ if (!i18n.defaultLocale || typeof i18n.defaultLocale !== "string") throw new Error("Specified i18n.defaultLocale should be a string.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config");
595
+ if (i18n.domains !== void 0 && !Array.isArray(i18n.domains)) throw new Error(`Specified i18n.domains must be an array of domain objects e.g. [ { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] } ] received ${typeof i18n.domains}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
596
+ if (i18n.domains) {
597
+ const invalidDomainItems = i18n.domains.filter((item) => {
598
+ if (!isUnknownRecord(item) || !item.defaultLocale) return true;
599
+ if (!item.domain || typeof item.domain !== "string") return true;
600
+ if (item.domain.includes(":")) {
601
+ console.warn(`i18n domain: "${item.domain}" is invalid it should be a valid domain without protocol (https://) or port (:3000) e.g. example.vercel.sh`);
602
+ return true;
603
+ }
604
+ const defaultLocaleDuplicate = i18n.domains.find((other) => isUnknownRecord(other) && other.defaultLocale === item.defaultLocale && other.domain !== item.domain);
605
+ if (defaultLocaleDuplicate && isUnknownRecord(defaultLocaleDuplicate)) {
606
+ console.warn(`Both ${item.domain} and ${String(defaultLocaleDuplicate.domain)} configured the defaultLocale ${item.defaultLocale} but only one can. Change one item's default locale to continue`);
607
+ return true;
608
+ }
609
+ let hasInvalidLocale = false;
610
+ if (Array.isArray(item.locales)) for (const locale of item.locales) {
611
+ if (typeof locale !== "string") hasInvalidLocale = true;
612
+ for (const domainItem of i18n.domains) {
613
+ if (domainItem === item || !isUnknownRecord(domainItem)) continue;
614
+ const domainLocales = domainItem.locales;
615
+ if (domainLocales && domainLocales.includes(locale)) {
616
+ console.warn(`Both ${item.domain} and ${String(domainItem.domain)} configured the locale (${String(locale)}) but only one can. Remove it from one i18n.domains config to continue`);
617
+ hasInvalidLocale = true;
618
+ break;
619
+ }
620
+ }
621
+ }
622
+ return hasInvalidLocale;
623
+ });
624
+ if (invalidDomainItems.length > 0) throw new Error(`Invalid i18n.domains values:\n${invalidDomainItems.map((item) => JSON.stringify(item)).join("\n")}\n\ndomains value must follow format { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] }.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
625
+ }
626
+ const invalidLocales = i18n.locales.filter((locale) => typeof locale !== "string");
627
+ if (invalidLocales.length > 0) throw new Error(`Specified i18n.locales contains invalid values (${invalidLocales.map(String).join(", ")}), locales must be valid locale tags provided as strings e.g. "en-US".\nSee here for list of valid language sub-tags: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry`);
628
+ const locales = i18n.locales;
629
+ if (!locales.includes(i18n.defaultLocale)) throw new Error("Specified i18n.defaultLocale should be included in i18n.locales.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config");
630
+ const normalizedLocales = /* @__PURE__ */ new Set();
631
+ const duplicateLocales = /* @__PURE__ */ new Set();
632
+ for (const locale of locales) {
633
+ const localeLower = locale.toLowerCase();
634
+ if (normalizedLocales.has(localeLower)) duplicateLocales.add(locale);
635
+ normalizedLocales.add(localeLower);
636
+ }
637
+ if (duplicateLocales.size > 0) throw new Error(`Specified i18n.locales contains the following duplicate locales:\n${[...duplicateLocales].join(", ")}\nEach locale should be listed only once.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
638
+ const localeDetectionType = typeof i18n.localeDetection;
639
+ if (localeDetectionType !== "boolean" && localeDetectionType !== "undefined") throw new Error(`Specified i18n.localeDetection should be undefined or a boolean received ${localeDetectionType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
640
+ return {
641
+ locales: [i18n.defaultLocale, ...locales.filter((locale) => locale !== i18n.defaultLocale)],
642
+ defaultLocale: i18n.defaultLocale,
643
+ localeDetection: i18n.localeDetection ?? true,
644
+ domains: i18n.domains
645
+ };
646
+ }
575
647
  /**
576
648
  * Resolve a NextConfig into a fully-resolved ResolvedNextConfig.
577
649
  * Awaits async functions for redirects/rewrites/headers.
578
650
  */
579
- async function resolveNextConfig(config, root = process.cwd(), options = {}) {
651
+ async function resolveNextConfig(config, root = toSlash(process.cwd()), options = {}) {
580
652
  if (!config) {
581
653
  const buildId = await resolveBuildId(void 0);
582
654
  const deploymentId = resolveDeploymentId(void 0);
@@ -644,6 +716,7 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
644
716
  return resolved;
645
717
  }
646
718
  warnDeprecatedConfigOptions(config, root);
719
+ const i18n = normalizeI18nConfig(config.i18n);
647
720
  let redirects = [];
648
721
  if (config.redirects) {
649
722
  const result = await config.redirects();
@@ -730,13 +803,6 @@ async function resolveNextConfig(config, root = process.cwd(), options = {}) {
730
803
  const experimentalTurbo = readOptionalRecord(experimental?.turbo);
731
804
  const turbopack = readOptionalRecord(config.turbopack);
732
805
  const resolveExtensions = Array.isArray(turbopack?.resolveExtensions) ? readStringArray(turbopack.resolveExtensions) : Array.isArray(experimentalTurbo?.resolveExtensions) ? readStringArray(experimentalTurbo.resolveExtensions) : null;
733
- let i18n = null;
734
- if (config.i18n) i18n = {
735
- locales: config.i18n.locales,
736
- defaultLocale: config.i18n.defaultLocale,
737
- localeDetection: config.i18n.localeDetection ?? true,
738
- domains: config.i18n.domains
739
- };
740
806
  const buildId = await resolveBuildId(config.generateBuildId);
741
807
  const deploymentId = resolveDeploymentId(config.deploymentId);
742
808
  const cacheHandler = typeof config.cacheHandler === "string" ? resolveCacheHandlerPathToFilesystem(config.cacheHandler) : void 0;
@@ -997,7 +1063,7 @@ function invokeLoaderSideEffects(rules, root) {
997
1063
  * loader rule. The remark/rehype plugins are captured in that closure.
998
1064
  * We probe the webpack function with a mock config to extract them.
999
1065
  */
1000
- async function extractMdxOptions(config, root = process.cwd()) {
1066
+ async function extractMdxOptions(config, root = toSlash(process.cwd())) {
1001
1067
  return (await probeWebpackConfig(config, root, false)).mdx;
1002
1068
  }
1003
1069
  /**
@@ -1091,4 +1157,4 @@ function extractPluginsFromOptions(opts) {
1091
1157
  return null;
1092
1158
  }
1093
1159
  //#endregion
1094
- export { PHASE_PRODUCTION_BUILD, createRscCompatibilityId, detectNextIntlConfig, extractMdxOptions, findNextConfigPath, lightningCssFeatureNamesToMask, loadNextConfig, normalizeAssetPrefix, parseBodySizeLimit, reassignsModuleExports, referencesCjsGlobals, resolveNextConfig, resolveNextConfigInput };
1160
+ export { PHASE_PRODUCTION_BUILD, VINEXT_NEXT_CONFIG_PLUGIN_PROPERTY, createRscCompatibilityId, detectNextIntlConfig, extractMdxOptions, findNextConfigPath, findVinextNextConfigInPlugins, lightningCssFeatureNamesToMask, loadNextConfig, normalizeAssetPrefix, parseBodySizeLimit, reassignsModuleExports, referencesCjsGlobals, resolveNextConfig, resolveNextConfigInput };
@@ -1,3 +1,4 @@
1
+ import { VINEXT_CACHE_CONFIG_PLUGIN_PROPERTY, VinextCacheConfig, findVinextCacheConfigInPlugins, loadVinextCacheConfigFromViteConfig } from "../cache/cache-adapters-virtual.js";
1
2
  import { PluginOption } from "vite";
2
3
 
3
4
  //#region src/config/prerender.d.ts
@@ -18,12 +19,21 @@ type VinextPrerenderDecision = ResolvedVinextPrerenderConfig & {
18
19
  reason: VinextPrerenderDecisionReason;
19
20
  };
20
21
  declare const VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY = "__vinextPrerenderConfig";
22
+ declare const VINEXT_ROUTE_ROOT_CONFIG_PLUGIN_PROPERTY = "__vinextRouteRootConfig";
23
+ type VinextRouteRootConfig = {
24
+ appDir?: string;
25
+ disableAppRouter?: boolean;
26
+ rscOutDir?: string;
27
+ ssrOutDir?: string;
28
+ };
21
29
  type ViteConfigLoader = {
22
30
  loadConfigFromFile: typeof import("vite").loadConfigFromFile;
23
31
  };
24
32
  declare function normalizeVinextPrerenderConfig(config: VinextPrerenderConfig | undefined): ResolvedVinextPrerenderConfig | null;
25
- declare function findVinextPrerenderConfigInPlugins(plugins: PluginOption[] | undefined): ResolvedVinextPrerenderConfig | null;
33
+ declare function findVinextPrerenderConfigInPlugins(plugins: PluginOption[] | undefined): Promise<ResolvedVinextPrerenderConfig | null>;
34
+ declare function findVinextRouteRootConfigInPlugins(plugins: PluginOption[] | undefined): Promise<VinextRouteRootConfig | null>;
26
35
  declare function loadVinextPrerenderConfigFromViteConfig(vite: ViteConfigLoader, root: string): Promise<ResolvedVinextPrerenderConfig | null>;
36
+ declare function loadVinextRouteRootConfigFromViteConfig(vite: ViteConfigLoader, root: string): Promise<VinextRouteRootConfig | null>;
27
37
  declare function resolveVinextPrerenderDecision(options: {
28
38
  prerenderAllFlag?: boolean;
29
39
  vinextPrerenderConfig?: ResolvedVinextPrerenderConfig | null;
@@ -31,4 +41,4 @@ declare function resolveVinextPrerenderDecision(options: {
31
41
  }): VinextPrerenderDecision | null;
32
42
  declare function formatVinextPrerenderLabel(decision: VinextPrerenderDecision): string;
33
43
  //#endregion
34
- export { ResolvedVinextPrerenderConfig, VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY, VinextPrerenderConfig, VinextPrerenderDecision, VinextPrerenderDecisionReason, findVinextPrerenderConfigInPlugins, formatVinextPrerenderLabel, loadVinextPrerenderConfigFromViteConfig, normalizeVinextPrerenderConfig, resolveVinextPrerenderDecision };
44
+ export { ResolvedVinextPrerenderConfig, VINEXT_CACHE_CONFIG_PLUGIN_PROPERTY, VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY, VINEXT_ROUTE_ROOT_CONFIG_PLUGIN_PROPERTY, type VinextCacheConfig, VinextPrerenderConfig, VinextPrerenderDecision, VinextPrerenderDecisionReason, VinextRouteRootConfig, findVinextCacheConfigInPlugins, findVinextPrerenderConfigInPlugins, findVinextRouteRootConfigInPlugins, formatVinextPrerenderLabel, loadVinextCacheConfigFromViteConfig, loadVinextPrerenderConfigFromViteConfig, loadVinextRouteRootConfigFromViteConfig, normalizeVinextPrerenderConfig, resolveVinextPrerenderDecision };