vinext 1.2.0 → 1.3.0

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 (283) hide show
  1. package/README.md +13 -10
  2. package/dist/build/client-build-config.d.ts +64 -3
  3. package/dist/build/client-build-config.js +131 -4
  4. package/dist/build/client-reference-groups.d.ts +163 -0
  5. package/dist/build/client-reference-groups.js +534 -0
  6. package/dist/build/module-dependency-cache.d.ts +31 -0
  7. package/dist/build/module-dependency-cache.js +51 -1
  8. package/dist/build/next-client-runtime-manifests.d.ts +10 -1
  9. package/dist/build/next-client-runtime-manifests.js +19 -4
  10. package/dist/build/nitro-public-files.d.ts +24 -0
  11. package/dist/build/nitro-public-files.js +60 -0
  12. package/dist/build/output-root-externals.d.ts +21 -0
  13. package/dist/build/output-root-externals.js +40 -0
  14. package/dist/build/pages-client-assets-module.js +1 -1
  15. package/dist/build/prerender-paths.js +6 -3
  16. package/dist/build/prerender.js +1 -1
  17. package/dist/build/server-actions-encryption-key.d.ts +23 -0
  18. package/dist/build/server-actions-encryption-key.js +101 -0
  19. package/dist/build/ssr-manifest.d.ts +3 -0
  20. package/dist/build/ssr-manifest.js +10 -1
  21. package/dist/check.js +5 -6
  22. package/dist/cli-dev-config.js +3 -3
  23. package/dist/cli.js +1 -1
  24. package/dist/client/client-rewrite-params.d.ts +9 -0
  25. package/dist/client/client-rewrite-params.js +20 -0
  26. package/dist/client/dev-error-overlay.js +2 -1
  27. package/dist/client/navigation-runtime.d.ts +25 -2
  28. package/dist/client/navigation-runtime.js +42 -11
  29. package/dist/client/vinext-next-data.d.ts +0 -1
  30. package/dist/config/config-matchers.d.ts +15 -40
  31. package/dist/config/config-matchers.js +195 -262
  32. package/dist/config/config-source.d.ts +34 -0
  33. package/dist/config/config-source.js +141 -0
  34. package/dist/config/header-params.d.ts +29 -0
  35. package/dist/config/header-params.js +106 -0
  36. package/dist/config/next-config.d.ts +7 -5
  37. package/dist/config/next-config.js +120 -7
  38. package/dist/entries/app-browser-entry.d.ts +14 -1
  39. package/dist/entries/app-browser-entry.js +26 -36
  40. package/dist/entries/app-rsc-entry.d.ts +2 -0
  41. package/dist/entries/app-rsc-entry.js +92 -57
  42. package/dist/entries/app-rsc-manifest.d.ts +10 -0
  43. package/dist/entries/app-rsc-manifest.js +20 -1
  44. package/dist/entries/app-ssr-entry.d.ts +4 -1
  45. package/dist/entries/app-ssr-entry.js +9 -2
  46. package/dist/entries/pages-client-entry.d.ts +1 -0
  47. package/dist/entries/pages-client-entry.js +6 -6
  48. package/dist/entries/pages-server-entry.js +17 -14
  49. package/dist/index.d.ts +11 -0
  50. package/dist/index.js +350 -175
  51. package/dist/init.d.ts +1 -1
  52. package/dist/init.js +103 -6
  53. package/dist/plugins/ast-utils.d.ts +53 -2
  54. package/dist/plugins/ast-utils.js +90 -2
  55. package/dist/plugins/cloudflare-dev-module-urls.d.ts +41 -0
  56. package/dist/plugins/cloudflare-dev-module-urls.js +271 -0
  57. package/dist/plugins/commonjs-esm-facade.js +2 -2
  58. package/dist/plugins/css-module-imports.js +13 -20
  59. package/dist/plugins/dynamic-preload-metadata.js +2 -3
  60. package/dist/plugins/extensionless-dynamic-import.js +2 -3
  61. package/dist/plugins/fonts.d.ts +1 -1
  62. package/dist/plugins/fonts.js +3 -3
  63. package/dist/plugins/ignore-dynamic-requests.js +2 -3
  64. package/dist/plugins/import-meta-url.js +3 -4
  65. package/dist/plugins/instrumentation-client.js +3 -2
  66. package/dist/plugins/middleware-export-validation.js +2 -3
  67. package/dist/plugins/og-harfbuzz.js +2 -3
  68. package/dist/plugins/optimize-imports.d.ts +25 -2
  69. package/dist/plugins/optimize-imports.js +109 -24
  70. package/dist/plugins/pages-node-externals.js +2 -3
  71. package/dist/plugins/remove-console.js +2 -18
  72. package/dist/plugins/require-condition-resolution.js +3 -3
  73. package/dist/plugins/require-context.js +2 -3
  74. package/dist/plugins/rsc-client-reference-loaders.d.ts +45 -1
  75. package/dist/plugins/rsc-client-reference-loaders.js +336 -18
  76. package/dist/plugins/strip-server-exports.js +3 -4
  77. package/dist/plugins/styled-jsx.js +2 -3
  78. package/dist/plugins/use-cache-callable.d.ts +26 -2
  79. package/dist/plugins/use-cache-callable.js +101 -36
  80. package/dist/plugins/worker-image-imports.d.ts +1 -0
  81. package/dist/plugins/worker-image-imports.js +31 -34
  82. package/dist/plugins/worker-use-server.js +38 -14
  83. package/dist/routing/app-route-graph.d.ts +1 -1
  84. package/dist/routing/browser-route-manifest.d.ts +43 -0
  85. package/dist/routing/browser-route-manifest.js +195 -0
  86. package/dist/routing/hashed-route-patterns.d.ts +4 -0
  87. package/dist/routing/hashed-route-patterns.js +22 -0
  88. package/dist/routing/optimistic-route-trie.d.ts +27 -0
  89. package/dist/routing/optimistic-route-trie.js +102 -0
  90. package/dist/routing/route-validation.d.ts +6 -1
  91. package/dist/routing/route-validation.js +26 -10
  92. package/dist/server/api-handler.js +1 -1
  93. package/dist/server/app-action-forwarding.d.ts +8 -0
  94. package/dist/server/app-action-forwarding.js +17 -3
  95. package/dist/server/app-browser-entry.js +149 -62
  96. package/dist/server/app-browser-error.d.ts +3 -1
  97. package/dist/server/app-browser-error.js +7 -2
  98. package/dist/server/app-browser-interception-context.d.ts +2 -2
  99. package/dist/server/app-browser-interception-context.js +1 -1
  100. package/dist/server/app-browser-mpa-navigation.d.ts +1 -0
  101. package/dist/server/app-browser-mpa-navigation.js +6 -5
  102. package/dist/server/app-browser-navigation-controller.d.ts +17 -6
  103. package/dist/server/app-browser-navigation-controller.js +88 -26
  104. package/dist/server/app-browser-prefetch-response.js +2 -2
  105. package/dist/server/app-browser-state.d.ts +2 -2
  106. package/dist/server/app-browser-state.js +1 -1
  107. package/dist/server/app-browser-supplemental-refresh.js +1 -1
  108. package/dist/server/app-browser-visible-commit.d.ts +4 -4
  109. package/dist/server/app-client-reference-preloader.d.ts +23 -0
  110. package/dist/server/app-client-reference-preloader.js +30 -7
  111. package/dist/server/app-fallback-renderer.js +2 -1
  112. package/dist/server/app-middleware.d.ts +6 -0
  113. package/dist/server/app-middleware.js +8 -10
  114. package/dist/server/app-optimistic-routing.d.ts +8 -10
  115. package/dist/server/app-optimistic-routing.js +4 -95
  116. package/dist/server/app-page-boundary-render.js +8 -1
  117. package/dist/server/app-page-cache-render.js +1 -0
  118. package/dist/server/app-page-dispatch.js +3 -1
  119. package/dist/server/app-page-render.js +4 -2
  120. package/dist/server/app-page-rsc-render-status.d.ts +1 -0
  121. package/dist/server/app-page-rsc-render-status.js +1 -0
  122. package/dist/server/app-page-search-params-observation.d.ts +1 -4
  123. package/dist/server/app-page-search-params-observation.js +8 -10
  124. package/dist/server/app-page-stream.d.ts +7 -0
  125. package/dist/server/app-page-stream.js +1 -0
  126. package/dist/server/app-pages-bridge.d.ts +2 -1
  127. package/dist/server/app-pages-bridge.js +12 -8
  128. package/dist/server/app-prerender-endpoints.js +1 -1
  129. package/dist/server/app-prerender-static-params.js +3 -2
  130. package/dist/server/app-render-abort-error.d.ts +19 -0
  131. package/dist/server/app-render-abort-error.js +31 -1
  132. package/dist/server/app-render-dependency.js +42 -2
  133. package/dist/server/app-request-stage-independent-entry.js +7 -7
  134. package/dist/server/app-response-stage-entry.js +5 -5
  135. package/dist/server/app-route-handler-dispatch.js +3 -1
  136. package/dist/server/app-route-handler-execution.d.ts +2 -0
  137. package/dist/server/app-route-handler-execution.js +9 -2
  138. package/dist/server/app-route-handler-middleware-context.d.ts +2 -1
  139. package/dist/server/app-route-handler-middleware-context.js +3 -3
  140. package/dist/server/app-route-handler-response.d.ts +2 -1
  141. package/dist/server/app-route-handler-response.js +2 -2
  142. package/dist/server/app-route-handler-runtime.d.ts +2 -0
  143. package/dist/server/app-route-handler-runtime.js +21 -4
  144. package/dist/server/app-route-module-loader.js +7 -6
  145. package/dist/server/app-route-tree.d.ts +20 -0
  146. package/dist/server/app-route-tree.js +18 -0
  147. package/dist/server/app-router-entry.js +7 -7
  148. package/dist/server/app-rsc-cache-busting.d.ts +16 -0
  149. package/dist/server/app-rsc-cache-busting.js +29 -12
  150. package/dist/server/app-rsc-combined-handler.js +8 -1
  151. package/dist/server/app-rsc-errors.d.ts +7 -0
  152. package/dist/server/app-rsc-errors.js +9 -2
  153. package/dist/server/app-rsc-handler.d.ts +4 -1
  154. package/dist/server/app-rsc-handler.js +151 -135
  155. package/dist/server/app-rsc-request-normalization.js +3 -3
  156. package/dist/server/app-rsc-response-finalizer.d.ts +5 -0
  157. package/dist/server/app-rsc-response-finalizer.js +4 -1
  158. package/dist/server/app-rsc-response-stage.js +5 -3
  159. package/dist/server/app-rsc-route-matching.d.ts +1 -0
  160. package/dist/server/app-rsc-route-matching.js +1 -1
  161. package/dist/server/app-server-action-execution.d.ts +23 -6
  162. package/dist/server/app-server-action-execution.js +51 -57
  163. package/dist/server/app-ssr-entry.d.ts +6 -0
  164. package/dist/server/app-ssr-entry.js +21 -11
  165. package/dist/server/app-ssr-stream.d.ts +7 -0
  166. package/dist/server/app-ssr-stream.js +13 -1
  167. package/dist/server/app-visited-response-cache.js +2 -2
  168. package/dist/server/config-headers.js +13 -4
  169. package/dist/server/defer-until-stream-consumed.d.ts +2 -1
  170. package/dist/server/defer-until-stream-consumed.js +3 -1
  171. package/dist/server/dev-server.js +1 -1
  172. package/dist/server/image-optimization.js +1 -0
  173. package/dist/server/isolate-shared-promise.d.ts +10 -0
  174. package/dist/server/isolate-shared-promise.js +33 -0
  175. package/dist/server/isr-cache.js +3 -2
  176. package/dist/server/metadata-route-response.js +2 -2
  177. package/dist/server/middleware-matcher-pattern.d.ts +0 -1
  178. package/dist/server/middleware-matcher-pattern.js +11 -140
  179. package/dist/server/middleware-matcher.js +5 -6
  180. package/dist/server/middleware-response-headers.d.ts +31 -0
  181. package/dist/server/middleware-response-headers.js +57 -1
  182. package/dist/server/middleware-runtime.js +30 -17
  183. package/dist/server/navigation-planner.d.ts +2 -2
  184. package/dist/server/navigation-planner.js +1 -1
  185. package/dist/server/nitro-public-files-plugin.d.ts +38 -0
  186. package/dist/server/nitro-public-files-plugin.js +106 -0
  187. package/dist/server/nitro-public-files.d.ts +21 -0
  188. package/dist/server/nitro-public-files.js +39 -0
  189. package/dist/server/open-redirect.d.ts +11 -4
  190. package/dist/server/open-redirect.js +11 -4
  191. package/dist/server/pages-api-route.js +2 -2
  192. package/dist/server/pages-asset-tags.d.ts +5 -0
  193. package/dist/server/pages-asset-tags.js +9 -2
  194. package/dist/server/pages-client-assets.d.ts +4 -1
  195. package/dist/server/pages-data-route.js +2 -1
  196. package/dist/server/pages-i18n.d.ts +18 -0
  197. package/dist/server/pages-i18n.js +18 -2
  198. package/dist/server/pages-node-compat.d.ts +5 -3
  199. package/dist/server/pages-node-compat.js +35 -16
  200. package/dist/server/pages-page-data.js +1 -1
  201. package/dist/server/pages-page-handler.js +1 -1
  202. package/dist/server/pages-page-response.js +1 -1
  203. package/dist/server/pages-request-pipeline.d.ts +6 -1
  204. package/dist/server/pages-request-pipeline.js +35 -39
  205. package/dist/server/pages-request-stage-entry.js +20 -10
  206. package/dist/server/pages-response-stage-entry.js +1 -1
  207. package/dist/server/pages-revalidate.js +3 -2
  208. package/dist/server/pages-router-entry.js +2 -2
  209. package/dist/server/prod-server.d.ts +2 -2
  210. package/dist/server/prod-server.js +74 -36
  211. package/dist/server/proxy-trust.d.ts +6 -0
  212. package/dist/server/proxy-trust.js +12 -6
  213. package/dist/server/request-pipeline.d.ts +5 -0
  214. package/dist/server/request-pipeline.js +12 -1
  215. package/dist/server/rsc-stream-hints.d.ts +1 -1
  216. package/dist/server/rsc-stream-hints.js +21 -3
  217. package/dist/server/server-reference-loader.js +10 -1
  218. package/dist/server/static-file-cache.js +15 -3
  219. package/dist/server/worker-image-optimization.js +19 -6
  220. package/dist/server/worker-utils.js +1 -1
  221. package/dist/shims/cache-handler.js +3 -2
  222. package/dist/shims/cache-request-state.d.ts +40 -3
  223. package/dist/shims/cache-request-state.js +70 -5
  224. package/dist/shims/cache-runtime.js +47 -19
  225. package/dist/shims/cache.d.ts +2 -2
  226. package/dist/shims/cache.js +17 -8
  227. package/dist/shims/cdn-purge-routes.d.ts +24 -0
  228. package/dist/shims/cdn-purge-routes.js +77 -0
  229. package/dist/shims/dynamic.js +17 -4
  230. package/dist/shims/form.js +8 -3
  231. package/dist/shims/head.js +1 -1
  232. package/dist/shims/headers.js +2 -2
  233. package/dist/shims/image-props.d.ts +93 -0
  234. package/dist/shims/image-props.js +323 -0
  235. package/dist/shims/image.d.ts +4 -18
  236. package/dist/shims/image.js +4 -319
  237. package/dist/shims/internal/headers-state.d.ts +7 -0
  238. package/dist/shims/internal/headers-state.js +14 -2
  239. package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +4 -1
  240. package/dist/shims/internal/hybrid-client-route-owner-direct.js +32 -15
  241. package/dist/shims/internal/hybrid-client-route-owner.js +9 -8
  242. package/dist/shims/link-prefetch.js +5 -4
  243. package/dist/shims/link.js +7 -5
  244. package/dist/shims/navigation.d.ts +1 -1
  245. package/dist/shims/navigation.js +21 -10
  246. package/dist/shims/og.js +35 -10
  247. package/dist/shims/request-context.d.ts +13 -0
  248. package/dist/shims/router.js +28 -52
  249. package/dist/shims/server.d.ts +42 -8
  250. package/dist/shims/server.js +99 -15
  251. package/dist/shims/thenable-params.d.ts +6 -1
  252. package/dist/shims/thenable-params.js +11 -2
  253. package/dist/shims/unified-request-context.d.ts +5 -0
  254. package/dist/shims/unified-request-context.js +2 -0
  255. package/dist/shims/url-utils.d.ts +7 -0
  256. package/dist/shims/url-utils.js +12 -3
  257. package/dist/utils/asset-prefix.d.ts +7 -0
  258. package/dist/utils/asset-prefix.js +10 -1
  259. package/dist/utils/client-build-manifest.js +12 -5
  260. package/dist/utils/client-runtime-metadata.d.ts +1 -0
  261. package/dist/utils/client-runtime-metadata.js +15 -2
  262. package/dist/utils/domain-locale.js +1 -1
  263. package/dist/utils/lazy-chunks.d.ts +4 -0
  264. package/dist/utils/manifest-paths.d.ts +14 -0
  265. package/dist/utils/manifest-paths.js +22 -1
  266. package/dist/utils/path-to-regexp.d.ts +21 -0
  267. package/dist/{server/middleware-path-to-regexp.js → utils/path-to-regexp.js} +14 -11
  268. package/dist/utils/plugin-react-version.d.ts +15 -0
  269. package/dist/utils/plugin-react-version.js +64 -0
  270. package/dist/utils/plugin-rsc-version.d.ts +2 -0
  271. package/dist/utils/plugin-rsc-version.js +28 -2
  272. package/dist/utils/public-routes.d.ts +2 -0
  273. package/dist/utils/public-routes.js +18 -7
  274. package/dist/utils/react-version.d.ts +7 -0
  275. package/dist/utils/react-version.js +39 -16
  276. package/package.json +6 -6
  277. package/dist/build/nitro-route-rules.d.ts +0 -47
  278. package/dist/build/nitro-route-rules.js +0 -79
  279. package/dist/plugins/cache-flight-codec.d.ts +0 -19
  280. package/dist/plugins/cache-flight-codec.js +0 -68
  281. package/dist/server/middleware-path-to-regexp.d.ts +0 -13
  282. package/dist/utils/regex-safety.d.ts +0 -17
  283. package/dist/utils/regex-safety.js +0 -789
@@ -0,0 +1,24 @@
1
+ //#region src/build/nitro-public-files.d.ts
2
+ /** The Nitro options this integration reads and updates. */
3
+ export type NitroPublicFilesOptions = {
4
+ dev?: boolean;
5
+ preset?: string;
6
+ baseURL?: string;
7
+ serveStatic?: boolean | string;
8
+ plugins?: string[];
9
+ virtual?: Record<string, string | (() => string)>;
10
+ output?: {
11
+ publicDir?: string;
12
+ };
13
+ };
14
+ /**
15
+ * Register vinext's Nitro runtime plugin on presets whose server serves the
16
+ * static output, so requests for public files run through vinext, including
17
+ * its middleware, and vinext can serve the public files its router resolves.
18
+ *
19
+ * Nitro serves the static output from its root, so this applies only when
20
+ * Nitro's `baseURL` is the root; vinext applies its own `basePath`. Returns
21
+ * whether the plugin is registered.
22
+ */
23
+ export declare function registerNitroPublicFiles(options: NitroPublicFilesOptions, pluginModule: string, getPublicFiles: () => string[]): boolean;
24
+ //#endregion
@@ -0,0 +1,60 @@
1
+ import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
+ import fs from "node:fs";
3
+ //#region src/build/nitro-public-files.ts
4
+ const NITRO_PUBLIC_FILES_PLUGIN = "#vinext/nitro-public-files";
5
+ const CDN_STATIC_PRESETS = /* @__PURE__ */ new Set(["aws-amplify"]);
6
+ const COMPRESSED_EXTENSIONS = [
7
+ ".br",
8
+ ".gz",
9
+ ".zst"
10
+ ];
11
+ function toNitroAssetId(relativePath) {
12
+ let decoded = relativePath;
13
+ try {
14
+ decoded = decodeURIComponent(relativePath);
15
+ } catch {}
16
+ return "/" + decoded.replace(/^\.?\//, "");
17
+ }
18
+ /**
19
+ * List the static files Nitro serves for the files in `public/`, keyed as
20
+ * Nitro's static handler keys them: each file that Nitro copied to its output
21
+ * directory, and the compressed copies of it that Nitro wrote there.
22
+ */
23
+ function listNitroPublicAssets(publicFiles, outputPublicDir) {
24
+ if (!outputPublicDir) return [];
25
+ const assets = [];
26
+ for (const file of publicFiles) {
27
+ const relativePath = file.slice(1);
28
+ for (const extension of ["", ...COMPRESSED_EXTENSIONS]) if (fs.statSync(path.join(outputPublicDir, relativePath + extension), { throwIfNoEntry: false })?.isFile()) assets.push(toNitroAssetId(relativePath + extension));
29
+ }
30
+ return [...new Set(assets)].sort();
31
+ }
32
+ /**
33
+ * Register vinext's Nitro runtime plugin on presets whose server serves the
34
+ * static output, so requests for public files run through vinext, including
35
+ * its middleware, and vinext can serve the public files its router resolves.
36
+ *
37
+ * Nitro serves the static output from its root, so this applies only when
38
+ * Nitro's `baseURL` is the root; vinext applies its own `basePath`. Returns
39
+ * whether the plugin is registered.
40
+ */
41
+ function registerNitroPublicFiles(options, pluginModule, getPublicFiles) {
42
+ if (options.dev || !options.serveStatic) return false;
43
+ if (options.preset && CDN_STATIC_PRESETS.has(options.preset.replaceAll("_", "-"))) return false;
44
+ if ((options.baseURL ?? "/") !== "/") return false;
45
+ options.virtual ??= {};
46
+ options.virtual[NITRO_PUBLIC_FILES_PLUGIN] = () => [
47
+ "import { fetchViteEnv } from \"nitro/vite/runtime\";",
48
+ `import { createNitroPublicFilesPlugin } from ${JSON.stringify(pluginModule)};`,
49
+ "export default createNitroPublicFilesPlugin({",
50
+ ` publicAssets: ${JSON.stringify(listNitroPublicAssets(getPublicFiles(), options.output?.publicDir))},`,
51
+ " fetchApp: (request) => fetchViteEnv(\"ssr\", request),",
52
+ "});",
53
+ ""
54
+ ].join("\n");
55
+ options.plugins ??= [];
56
+ if (!options.plugins.includes(NITRO_PUBLIC_FILES_PLUGIN)) options.plugins.push(NITRO_PUBLIC_FILES_PLUGIN);
57
+ return true;
58
+ }
59
+ //#endregion
60
+ export { registerNitroPublicFiles };
@@ -0,0 +1,21 @@
1
+ import MagicString from "magic-string";
2
+ //#region src/build/output-root-externals.d.ts
3
+ /**
4
+ * Rewrite external virtual ids into imports of files that live at a fixed
5
+ * place relative to the output root.
6
+ *
7
+ * Some server modules (the cacheability manifest, the pregenerated concrete
8
+ * paths, the Pages client assets) are written beside the server entry, and
9
+ * deploy steps can rewrite them after the build. Rolldown leaves a relative
10
+ * external specifier exactly as written, but it can move the importing module
11
+ * into any chunk, for example a shared chunk under `_next/static/` when the
12
+ * entry becomes a facade. Keeping the virtual id external and resolving it
13
+ * against each chunk's own location keeps the import pointing at the file.
14
+ *
15
+ * `targets` maps each external id to its file path relative to the output root.
16
+ */
17
+ export declare function rewriteOutputRootExternals(code: string, chunkFileName: string, targets: ReadonlyMap<string, string>): {
18
+ code: string;
19
+ map: ReturnType<MagicString["generateMap"]>;
20
+ } | null;
21
+ //#endregion
@@ -0,0 +1,40 @@
1
+ import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
+ import { escapeRegExp } from "../utils/regex.js";
3
+ import MagicString from "magic-string";
4
+ //#region src/build/output-root-externals.ts
5
+ /**
6
+ * Rewrite external virtual ids into imports of files that live at a fixed
7
+ * place relative to the output root.
8
+ *
9
+ * Some server modules (the cacheability manifest, the pregenerated concrete
10
+ * paths, the Pages client assets) are written beside the server entry, and
11
+ * deploy steps can rewrite them after the build. Rolldown leaves a relative
12
+ * external specifier exactly as written, but it can move the importing module
13
+ * into any chunk, for example a shared chunk under `_next/static/` when the
14
+ * entry becomes a facade. Keeping the virtual id external and resolving it
15
+ * against each chunk's own location keeps the import pointing at the file.
16
+ *
17
+ * `targets` maps each external id to its file path relative to the output root.
18
+ */
19
+ function rewriteOutputRootExternals(code, chunkFileName, targets) {
20
+ let output = null;
21
+ const chunkDir = path.posix.dirname(chunkFileName);
22
+ for (const [id, target] of targets) {
23
+ if (!code.includes(id)) continue;
24
+ let specifier = path.posix.relative(chunkDir, target);
25
+ if (!specifier.startsWith(".")) specifier = `./${specifier}`;
26
+ const quotedId = new RegExp(`(["'])${escapeRegExp(id)}\\1`, "g");
27
+ for (const match of code.matchAll(quotedId)) {
28
+ output ??= new MagicString(code);
29
+ const quote = match[1];
30
+ output.overwrite(match.index, match.index + match[0].length, quote + specifier + quote);
31
+ }
32
+ }
33
+ if (output === null) return null;
34
+ return {
35
+ code: output.toString(),
36
+ map: output.generateMap({ hires: "boundary" })
37
+ };
38
+ }
39
+ //#endregion
40
+ export { rewriteOutputRootExternals };
@@ -6,7 +6,7 @@ import fs from "node:fs";
6
6
  //#region src/build/pages-client-assets-module.ts
7
7
  const PAGES_CLIENT_ASSETS_MODULE = "vinext-client-assets.js";
8
8
  function buildPagesClientAssetsModule(assets) {
9
- const prepared = assets.ssrManifest ? {
9
+ const prepared = assets.ssrManifest && !assets.sharedChunks ? {
10
10
  ...assets,
11
11
  sharedChunks: getSharedChunkFiles(assets.ssrManifest)
12
12
  } : assets;
@@ -3,13 +3,13 @@ import { findDir } from "../utils/project.js";
3
3
  import { BLOCKED_PAGES, PHASE_PRODUCTION_BUILD } from "../shims/constants.js";
4
4
  import { VINEXT_PRERENDER_SECRET_HEADER } from "../utils/protocol-headers.js";
5
5
  import { isExternalUrl } from "../utils/external-url.js";
6
+ import "../server/headers.js";
6
7
  import { matchHeaders, matchesRewriteSource } from "../config/config-matchers.js";
7
8
  import { loadNextConfig, resolveNextConfig } from "../config/next-config.js";
8
9
  import { appRouteHasMainTreeLoadingBoundary, appRouter, matchAppRoute } from "../routing/app-router.js";
9
10
  import { apiRouter, matchRoute, pagesRouter } from "../routing/pages-router.js";
10
- import "../server/headers.js";
11
11
  import { matchesMiddlewarePathname } from "../server/middleware-matcher.js";
12
- import { extractLocaleFromUrl, normalizeDefaultLocalePathname } from "../server/pages-i18n.js";
12
+ import { extractLocaleFromUrl, normalizeDefaultLocalePathname, shouldRestoreLocaleRootTrailingSlash } from "../server/pages-i18n.js";
13
13
  import { classifyAppRoute, classifyAppRouteHandler, classifyPagesRoute, extractExportConstString, extractMiddlewareMatcherConfig, getAppRouteRenderEntryPath } from "./report.js";
14
14
  import { normalizeStaticPathname, normalizeStaticPathsEntry } from "../routing/route-pattern.js";
15
15
  import { buildPagesDataHref } from "../shims/internal/pages-data-url.js";
@@ -578,7 +578,10 @@ async function resolveAppWarmPaths(options) {
578
578
  function cachePolicyRuleMatchesWarmPath(pathname, rule, config) {
579
579
  const canonicalPathname = normalizePathTrailingSlash(pathname, config.trailingSlash);
580
580
  return [void 0, ...config.i18n?.domains?.map((domain) => domain.domain) ?? []].some((hostname) => {
581
- const matchPathname = normalizeDefaultLocalePathname(canonicalPathname, config.i18n, { hostname });
581
+ const matchPathname = normalizeDefaultLocalePathname(canonicalPathname, config.i18n, {
582
+ hostname,
583
+ restoreRootTrailingSlash: shouldRestoreLocaleRootTrailingSlash(canonicalPathname, config)
584
+ });
582
585
  let sourceMatched = false;
583
586
  matchHeaders(matchPathname, [rule], {
584
587
  cookies: {},
@@ -3,8 +3,8 @@ import { createValidFileMatcher, findFileWithExtensions } from "../routing/file-
3
3
  import { isUnknownRecord } from "../utils/record.js";
4
4
  import { BLOCKED_PAGES } from "../shims/constants.js";
5
5
  import { VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SECRET_HEADER, VINEXT_PRERENDER_SPECULATIVE_HEADER } from "../utils/protocol-headers.js";
6
- import { appRouteLayoutStaticParamsGroups } from "../routing/app-router.js";
7
6
  import { NEXT_CACHE_TAGS_HEADER, VINEXT_METADATA_ROUTE_CACHE_HEADER, VINEXT_PRERENDER_CACHE_LIFE_HEADER, VINEXT_PRERENDER_METADATA_ROUTES_PATH, VINEXT_PRERENDER_RENDER_ERROR_HEADER, VINEXT_PRERENDER_SPECIAL_ERROR_HEADER } from "../server/headers.js";
7
+ import { appRouteLayoutStaticParamsGroups } from "../routing/app-router.js";
8
8
  import { extractLocaleFromUrl } from "../server/pages-i18n.js";
9
9
  import { classifyAppRoute, classifyPagesRoute, getAppRouteRenderEntryPath } from "./report.js";
10
10
  import { resolveClientStaleTimeSeconds } from "../utils/cache-control-metadata.js";
@@ -0,0 +1,23 @@
1
+ //#region src/build/server-actions-encryption-key.d.ts
2
+ type LoadEncryptionKeyOptions = {
3
+ root: string;
4
+ isBuild: boolean;
5
+ /** Defaults to `process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY`. */
6
+ providedKey?: string;
7
+ now?: number;
8
+ /** Defaults to Docker detection; Docker filesystems are likely ephemeral. */
9
+ hasPersistentStorage?: boolean;
10
+ };
11
+ /**
12
+ * Return NEXT_SERVER_ACTIONS_ENCRYPTION_KEY when set, otherwise a generated
13
+ * key that is cached in `.vinext/cache` for 14 days.
14
+ */
15
+ export declare function loadOrGenerateServerActionsEncryptionKey(options: LoadEncryptionKeyOptions): string;
16
+ /**
17
+ * The cached key lives inside the project root, which the dev server serves.
18
+ * Return the `server.fs.deny` entries that keep it private, preserving Vite's
19
+ * defaults and any configured entries. Like `.env` files, it is only exposed
20
+ * when `server.fs.strict` is false, which turns off Vite's file restrictions.
21
+ */
22
+ export declare function getServerActionsKeyCacheFsDeny(configuredDeny: string[] | undefined): string[];
23
+ //#endregion
@@ -0,0 +1,101 @@
1
+ import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
+ import fs from "node:fs";
3
+ import { randomBytes } from "node:crypto";
4
+ //#region src/build/server-actions-encryption-key.ts
5
+ /**
6
+ * Ported from Next.js: packages/next/src/server/app-render/encryption-utils-server.ts
7
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/encryption-utils-server.ts
8
+ *
9
+ * Next salts server-reference IDs with this key, so keeping it stable keeps
10
+ * client chunk names stable across rebuilds of identical source. Next caches
11
+ * a generated key under `<distDir>/cache` for builds and `<distDir>/dev/cache`
12
+ * for dev; vinext uses `<root>/.vinext/cache` and `<root>/.vinext/dev/cache`
13
+ * because `dist/` is wiped by every build.
14
+ */
15
+ const CONFIG_FILE = ".rscinfo";
16
+ const ENCRYPTION_KEY = "encryption.key";
17
+ const ENCRYPTION_EXPIRE_AT = "encryption.expire_at";
18
+ const EXPIRATION = 12096e5;
19
+ const VITE_DEFAULT_FS_DENY = [
20
+ ".env",
21
+ ".env.*",
22
+ "*.{crt,pem,key,p12,pfx,cer,der}",
23
+ ".npmrc",
24
+ ".yarnrc.yml",
25
+ "**/.git/**"
26
+ ];
27
+ const KEY_CACHE_FS_DENY = `**/.vinext/**/${CONFIG_FILE}`;
28
+ let isDockerResult;
29
+ function isDocker() {
30
+ if (isDockerResult === void 0) {
31
+ let hasDockerEnv = false;
32
+ try {
33
+ fs.statSync("/.dockerenv");
34
+ hasDockerEnv = true;
35
+ } catch {}
36
+ let hasDockerCGroup = false;
37
+ if (!hasDockerEnv) try {
38
+ hasDockerCGroup = fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
39
+ } catch {}
40
+ isDockerResult = hasDockerEnv || hasDockerCGroup;
41
+ }
42
+ return isDockerResult;
43
+ }
44
+ function readCachedKey(configPath, isBuild, providedKey, now) {
45
+ if (!fs.existsSync(configPath)) return void 0;
46
+ try {
47
+ const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
48
+ if (typeof config !== "object" || config === null) return void 0;
49
+ const cachedKey = config[ENCRYPTION_KEY];
50
+ const expireAt = config[ENCRYPTION_EXPIRE_AT];
51
+ if (typeof cachedKey !== "string" || typeof expireAt !== "number") return void 0;
52
+ if (isBuild && expireAt < now) return void 0;
53
+ if (cachedKey && providedKey && cachedKey !== providedKey) return void 0;
54
+ return cachedKey;
55
+ } catch {
56
+ return;
57
+ }
58
+ }
59
+ /**
60
+ * Return NEXT_SERVER_ACTIONS_ENCRYPTION_KEY when set, otherwise a generated
61
+ * key that is cached in `.vinext/cache` for 14 days.
62
+ */
63
+ function loadOrGenerateServerActionsEncryptionKey(options) {
64
+ const providedKey = "providedKey" in options ? options.providedKey : process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY;
65
+ const generateKey = () => providedKey || randomBytes(32).toString("base64");
66
+ if (!(options.hasPersistentStorage ?? !isDocker())) return generateKey();
67
+ const now = options.now ?? Date.now();
68
+ const cacheDir = options.isBuild ? path.join(options.root, ".vinext", "cache") : path.join(options.root, ".vinext", "dev", "cache");
69
+ const configPath = path.join(cacheDir, CONFIG_FILE);
70
+ const cachedKey = readCachedKey(configPath, options.isBuild, providedKey, now);
71
+ if (cachedKey !== void 0) {
72
+ restrictKeyCacheMode(configPath);
73
+ return cachedKey;
74
+ }
75
+ const key = generateKey();
76
+ try {
77
+ fs.mkdirSync(cacheDir, { recursive: true });
78
+ fs.writeFileSync(configPath, JSON.stringify({
79
+ [ENCRYPTION_KEY]: key,
80
+ [ENCRYPTION_EXPIRE_AT]: now + EXPIRATION
81
+ }), { mode: 384 });
82
+ restrictKeyCacheMode(configPath);
83
+ } catch {}
84
+ return key;
85
+ }
86
+ function restrictKeyCacheMode(configPath) {
87
+ try {
88
+ fs.chmodSync(configPath, 384);
89
+ } catch {}
90
+ }
91
+ /**
92
+ * The cached key lives inside the project root, which the dev server serves.
93
+ * Return the `server.fs.deny` entries that keep it private, preserving Vite's
94
+ * defaults and any configured entries. Like `.env` files, it is only exposed
95
+ * when `server.fs.strict` is false, which turns off Vite's file restrictions.
96
+ */
97
+ function getServerActionsKeyCacheFsDeny(configuredDeny) {
98
+ return configuredDeny ? [KEY_CACHE_FS_DENY] : [...VITE_DEFAULT_FS_DENY, KEY_CACHE_FS_DENY];
99
+ }
100
+ //#endregion
101
+ export { getServerActionsKeyCacheFsDeny, loadOrGenerateServerActionsEncryptionKey };
@@ -2,6 +2,9 @@
2
2
  export type BundleBackfillChunk = {
3
3
  type: "chunk";
4
4
  fileName: string;
5
+ name?: string;
6
+ isEntry?: boolean;
7
+ facadeModuleId?: string | null;
5
8
  imports?: string[];
6
9
  modules?: Record<string, unknown>;
7
10
  viteMetadata?: {
@@ -1,7 +1,13 @@
1
1
  import path, { toSlash } from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
- import { collapseDuplicateBase, manifestFileWithBase } from "../utils/manifest-paths.js";
2
+ import { SSR_MANIFEST_SHARED_CHUNKS_KEY, collapseDuplicateBase, isSharedClientChunkName, manifestFileWithBase } from "../utils/manifest-paths.js";
3
3
  import fs from "node:fs";
4
4
  //#region src/build/ssr-manifest.ts
5
+ const PAGES_CLIENT_ENTRY_ID = "virtual:vinext-client-entry";
6
+ function isPagesClientEntryFacade(facadeModuleId) {
7
+ if (!facadeModuleId) return false;
8
+ const id = toSlash(facadeModuleId.startsWith("\0") ? facadeModuleId.slice(1) : facadeModuleId);
9
+ return id === PAGES_CLIENT_ENTRY_ID || id.endsWith(`/${PAGES_CLIENT_ENTRY_ID}`);
10
+ }
5
11
  /**
6
12
  * Realpath with NATIVE separators (backslashes on Windows). Callers apply
7
13
  * `toSlash` where the result becomes a module id / manifest key.
@@ -50,6 +56,7 @@ function normalizeManifestModuleId(moduleId, root) {
50
56
  }
51
57
  function augmentSsrManifestFromBundle(ssrManifest, bundle, root, base = "/") {
52
58
  const nextManifest = {};
59
+ const sharedChunkFiles = /* @__PURE__ */ new Set();
53
60
  for (const [key, files] of Object.entries(ssrManifest)) {
54
61
  const normalizedKey = normalizeManifestModuleId(key, root);
55
62
  if (!nextManifest[normalizedKey]) nextManifest[normalizedKey] = /* @__PURE__ */ new Set();
@@ -58,6 +65,7 @@ function augmentSsrManifestFromBundle(ssrManifest, bundle, root, base = "/") {
58
65
  for (const item of Object.values(bundle)) {
59
66
  if (item.type !== "chunk") continue;
60
67
  const chunk = item;
68
+ if (chunk.fileName.endsWith(".js") && (isSharedClientChunkName(chunk.name) || chunk.isEntry && isPagesClientEntryFacade(chunk.facadeModuleId))) sharedChunkFiles.add(manifestFileWithBase(chunk.fileName, base));
61
69
  const files = /* @__PURE__ */ new Set();
62
70
  files.add(manifestFileWithBase(chunk.fileName, base));
63
71
  for (const importedFile of chunk.imports ?? []) files.add(manifestFileWithBase(importedFile, base));
@@ -71,6 +79,7 @@ function augmentSsrManifestFromBundle(ssrManifest, bundle, root, base = "/") {
71
79
  for (const file of files) nextManifest[key].add(file);
72
80
  }
73
81
  }
82
+ if (sharedChunkFiles.size > 0) nextManifest[SSR_MANIFEST_SHARED_CHUNKS_KEY] = sharedChunkFiles;
74
83
  return Object.fromEntries(Object.entries(nextManifest).map(([key, files]) => [key, [...files]]));
75
84
  }
76
85
  //#endregion
package/dist/check.js CHANGED
@@ -3,10 +3,9 @@ import path from "./deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
3
3
  import { detectPackageManager, findDir, findViteConfigPath } from "./utils/project.js";
4
4
  import { normalizePageExtensions } from "./routing/file-matcher.js";
5
5
  import { POSTCSS_CONFIG_FILES } from "./plugins/postcss.js";
6
- import { unwrapExpression } from "./plugins/ast-utils.js";
6
+ import { parseProgram, unwrapExpression } from "./plugins/ast-utils.js";
7
7
  import { require_ignore } from "./deps/.pnpm/ignore@5.3.2/deps/ignore/index.js";
8
8
  import fs from "node:fs";
9
- import { parseAst } from "vite";
10
9
  //#region src/check.ts
11
10
  /**
12
11
  * vinext check — compatibility scanner for Next.js apps
@@ -813,7 +812,7 @@ function propertyKeyName(prop) {
813
812
  * object — top-level keys plus, for each object-valued property, its child keys
814
813
  * (used for dot-notation options like `experimental.ppr`).
815
814
  *
816
- * Uses Vite's `parseAst` (the bundled oxc parser) instead of scanning text, so
815
+ * Uses Vite's bundled oxc parser instead of scanning text, so
817
816
  * comments, string values, and other non-key mentions of an option name are
818
817
  * never mistaken for a real config option. Returns empty sets if the file cannot
819
818
  * be parsed — the check is advisory, so a parse failure simply reports nothing.
@@ -824,7 +823,7 @@ function collectConfigKeys(source) {
824
823
  let pageExtensions;
825
824
  let program;
826
825
  try {
827
- program = parseAst(source, { lang: "ts" });
826
+ program = parseProgram(source, { lang: "ts" });
828
827
  } catch {
829
828
  return {
830
829
  top,
@@ -971,7 +970,7 @@ function isNextConfigWithCjsGlobals(rel, content) {
971
970
  if (/^next\.config\.(?:ts|mts|cjs)$/.test(rel)) return true;
972
971
  if (rel !== "next.config.js") return false;
973
972
  try {
974
- return !parseAst(content).body.some((node) => node.type === "ImportDeclaration" || node.type.startsWith("Export"));
973
+ return !parseProgram(content).body.some((node) => node.type === "ImportDeclaration" || node.type.startsWith("Export"));
975
974
  } catch {
976
975
  return false;
977
976
  }
@@ -984,7 +983,7 @@ function isNextConfigWithCjsGlobals(rel, content) {
984
983
  function exportsPostcssPluginsOnlyObject(content) {
985
984
  let program;
986
985
  try {
987
- program = parseAst(content, { lang: "ts" });
986
+ program = parseProgram(content, { lang: "ts" });
988
987
  } catch {
989
988
  return false;
990
989
  }
@@ -28,7 +28,7 @@ function claimViteCliDevInvocation(root, isRestart = false, isReserved = false)
28
28
  return true;
29
29
  }
30
30
  function applyDevServerDefaults(server, options) {
31
- server.port = options.port ?? server.port ?? 3e3;
31
+ if (options.port !== void 0) server.port = options.port;
32
32
  server.host = options.hostname ?? server.host ?? "localhost";
33
33
  }
34
34
  function createDevServerLifecyclePlugin(options, isEnabled) {
@@ -114,7 +114,7 @@ function configureDevServerLifecycle(server) {
114
114
  const listenServer = server.listen.bind(server);
115
115
  server.listen = async (port, isRestart) => {
116
116
  if (server.config.server.middlewareMode || process.env.VINEXT_NO_DEV_LOCK === "1") return listenServer(port, isRestart);
117
- const configuredPort = port ?? server.config.server.port ?? 3e3;
117
+ const configuredPort = port ?? server.config.server.port;
118
118
  const hostname = normalizeDevServerHostname(server.config.server.host);
119
119
  const displayHostname = hostname === "0.0.0.0" ? "localhost" : hostname;
120
120
  const restartingLock = activeDevServerLocks.get(root);
@@ -155,7 +155,7 @@ function configureDevServerLifecycle(server) {
155
155
  };
156
156
  server.httpServer?.on("listening", () => {
157
157
  if (!activeLock) return;
158
- const port = server.config.server.port ?? 3e3;
158
+ const port = server.config.server.port;
159
159
  const hostname = normalizeDevServerHostname(server.config.server.host);
160
160
  const displayHostname = hostname === "0.0.0.0" ? "localhost" : hostname;
161
161
  const lock = activeLock;
package/dist/cli.js CHANGED
@@ -364,7 +364,7 @@ function printHelp(cmd) {
364
364
  --version Show version
365
365
 
366
366
  Examples:
367
- vinext dev Start dev server on port 3000
367
+ vinext dev Start dev server
368
368
  vinext dev --port 4000 Start dev server on port 4000
369
369
  vinext build Build for production
370
370
  vinext typegen Generate route helper types
@@ -0,0 +1,9 @@
1
+ //#region src/client/client-rewrite-params.d.ts
2
+ /**
3
+ * Whether a rewrite to `destination` appends the source `params` to its
4
+ * query. Next.js does that when the destination's path, host and hash use
5
+ * none of them, for each param its query does not already name; the Pages
6
+ * router's sync rewrite path does not, so it defers these rewrites.
7
+ */
8
+ export declare function clientRewriteAppendsParams(destination: string, params: Record<string, string>): boolean;
9
+ //#endregion
@@ -0,0 +1,20 @@
1
+ //#region src/client/client-rewrite-params.ts
2
+ /**
3
+ * Whether a rewrite to `destination` appends the source `params` to its
4
+ * query. Next.js does that when the destination's path, host and hash use
5
+ * none of them, for each param its query does not already name; the Pages
6
+ * router's sync rewrite path does not, so it defers these rewrites.
7
+ */
8
+ function clientRewriteAppendsParams(destination, params) {
9
+ const keys = Object.keys(params).filter((key) => key !== "nextInternalLocale");
10
+ if (keys.length === 0) return false;
11
+ const hashIndex = destination.indexOf("#");
12
+ const beforeHash = hashIndex === -1 ? destination : destination.slice(0, hashIndex);
13
+ const queryIndex = beforeHash.indexOf("?");
14
+ const withoutQuery = (queryIndex === -1 ? beforeHash : beforeHash.slice(0, queryIndex)) + (hashIndex === -1 ? "" : destination.slice(hashIndex));
15
+ if (keys.some((key) => new RegExp(`:${key}(?![A-Za-z0-9_])`).test(withoutQuery))) return false;
16
+ const queryKeys = new Set(queryIndex === -1 ? [] : new URLSearchParams(beforeHash.slice(queryIndex + 1)).keys());
17
+ return keys.some((key) => !queryKeys.has(key));
18
+ }
19
+ //#endregion
20
+ export { clientRewriteAppendsParams };
@@ -26,11 +26,12 @@ function installDevErrorOverlay() {
26
26
  installed = true;
27
27
  window.addEventListener("error", (event) => {
28
28
  const err = event.error;
29
+ if (!err) return;
29
30
  if (isNavigationSignalError(err)) return;
30
31
  if (err instanceof Error) {
31
32
  if (alreadyReported(err)) return;
32
33
  reportDevError(err, { source: "window-error" });
33
- } else if (event.message) reportDevError(new Error(event.message), { source: "window-error" });
34
+ } else reportDevError(event.message ? new Error(event.message) : err, { source: "window-error" });
34
35
  });
35
36
  window.addEventListener("unhandledrejection", (event) => {
36
37
  const reason = event.reason;
@@ -1,4 +1,4 @@
1
- import { RouteManifest } from "../routing/app-route-graph.js";
1
+ import { BrowserRouteManifest, BrowserRouteManifestWire } from "../routing/browser-route-manifest.js";
2
2
  import { AppRouterScrollIntent } from "../shims/app-router-scroll-state.js";
3
3
  //#region src/client/navigation-runtime.d.ts
4
4
  type NavigationRuntimeSnapshot = {
@@ -7,6 +7,8 @@ type NavigationRuntimeSnapshot = {
7
7
  };
8
8
  export type NavigationRuntimeRscChunk = string | [3, string];
9
9
  export type NavigationRuntimeRscBootstrap = {
10
+ /** The server's App Router RSC compatibility ID for this page. */
11
+ compatibilityId?: string;
10
12
  done?: boolean;
11
13
  dynamicStaleTimeSeconds?: number;
12
14
  initialCacheKind?: "dynamic" | "static";
@@ -68,9 +70,15 @@ export type NavigationRuntimeFunctions = {
68
70
  * committing writes its URL first, as Next.js does from an insertion effect.
69
71
  */
70
72
  flushCommittingNavigationUrl?: () => void;
73
+ /**
74
+ * Starts loading the browser RouteManifest chunk, or joins the load in
75
+ * progress. Returns null once the manifest is registered. Created by
76
+ * createNavigationRuntimeRouteManifestLoader.
77
+ */
78
+ loadRouteManifest?: () => Promise<boolean> | null;
71
79
  };
72
80
  export type NavigationRuntimeBootstrap = {
73
- routeManifest: RouteManifest | null;
81
+ routeManifest: BrowserRouteManifest | null;
74
82
  rsc: NavigationRuntimeRscBootstrap | undefined;
75
83
  };
76
84
  export type NavigationRuntime = {
@@ -82,6 +90,21 @@ export declare function getNavigationRuntime(): NavigationRuntime | null;
82
90
  export declare function registerNavigationRuntimeBootstrap(bootstrap: Partial<NavigationRuntimeBootstrap>): NavigationRuntime;
83
91
  export declare function registerNavigationRuntimeFunctions(functions: Partial<NavigationRuntimeFunctions>): NavigationRuntime;
84
92
  export declare function ensureNavigationRuntimeRscBootstrap(): NavigationRuntimeRscBootstrap;
93
+ /**
94
+ * The browser entry does not inline the RouteManifest: the manifest grows with
95
+ * every route of the app, so it lives in its own chunk that loads alongside
96
+ * hydration. The navigation planner needs it to classify commits (root layout
97
+ * changes, intercepted payloads, preserved slots), so navigations, commits and
98
+ * prefetches that read it wait for this load first.
99
+ */
100
+ export declare function createNavigationRuntimeRouteManifestLoader(importManifest: () => Promise<{
101
+ default: BrowserRouteManifestWire | null;
102
+ }>): () => Promise<boolean> | null;
103
+ /**
104
+ * Starts or joins the RouteManifest load. Resolves whether it loaded, and
105
+ * returns null once it has (or when no App Router runtime registered a loader).
106
+ */
107
+ export declare function loadNavigationRuntimeRouteManifest(): Promise<boolean> | null;
85
108
  export declare function hasAppNavigationRuntime(): boolean;
86
109
  /**
87
110
  * True when the App Router has installed its runtime bootstrap on `window`,