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
@@ -1,20 +1,15 @@
1
1
  import { isUnknownRecord } from "../utils/record.js";
2
+ import { decodeBrowserRouteManifest } from "../routing/browser-route-manifest.js";
2
3
  import { NAVIGATION_RUNTIME_SYMBOL_DESCRIPTION } from "./browser-globals.js";
3
4
  //#region src/client/navigation-runtime.ts
4
5
  const NAVIGATION_RUNTIME_KEY = Symbol.for(NAVIGATION_RUNTIME_SYMBOL_DESCRIPTION);
5
6
  const ROUTE_MANIFEST_SEGMENT_GRAPH_MAP_KEYS = [
6
- "boundaries",
7
- "defaults",
8
7
  "interceptions",
9
8
  "interceptionsBySlotId",
10
9
  "layouts",
11
- "pages",
12
10
  "rootBoundaries",
13
- "routeHandlers",
14
11
  "routes",
15
- "slotBindings",
16
- "slots",
17
- "templates"
12
+ "slotBindings"
18
13
  ];
19
14
  function createNavigationRuntime() {
20
15
  return {
@@ -31,7 +26,7 @@ function readRuntimeWindow() {
31
26
  }
32
27
  function isNavigationRuntimeFunctions(value) {
33
28
  if (!isUnknownRecord(value)) return false;
34
- return isOptionalRuntimeFunction(Reflect.get(value, "clearNavigationCaches")) && isOptionalRuntimeFunction(Reflect.get(value, "commitHashNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "navigateExternal")) && isOptionalRuntimeFunction(Reflect.get(value, "navigate")) && isOptionalRuntimeFunction(Reflect.get(value, "getPrefetchRouterState")) && isOptionalRuntimeFunction(Reflect.get(value, "notifyLinkNavigationStart")) && isOptionalRuntimeFunction(Reflect.get(value, "pingVisibleLinks")) && isOptionalRuntimeFunction(Reflect.get(value, "preparePrefetchResponse")) && isOptionalRuntimeFunction(Reflect.get(value, "claimCurrentHistoryTreeSnapshot")) && isOptionalRuntimeFunction(Reflect.get(value, "commitAppOwnedHistoryStateWrite")) && isOptionalRuntimeFunction(Reflect.get(value, "discardPendingNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "flushCommittingNavigationUrl"));
29
+ return isOptionalRuntimeFunction(Reflect.get(value, "clearNavigationCaches")) && isOptionalRuntimeFunction(Reflect.get(value, "commitHashNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "navigateExternal")) && isOptionalRuntimeFunction(Reflect.get(value, "navigate")) && isOptionalRuntimeFunction(Reflect.get(value, "getPrefetchRouterState")) && isOptionalRuntimeFunction(Reflect.get(value, "notifyLinkNavigationStart")) && isOptionalRuntimeFunction(Reflect.get(value, "pingVisibleLinks")) && isOptionalRuntimeFunction(Reflect.get(value, "preparePrefetchResponse")) && isOptionalRuntimeFunction(Reflect.get(value, "claimCurrentHistoryTreeSnapshot")) && isOptionalRuntimeFunction(Reflect.get(value, "commitAppOwnedHistoryStateWrite")) && isOptionalRuntimeFunction(Reflect.get(value, "discardPendingNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "flushCommittingNavigationUrl")) && isOptionalRuntimeFunction(Reflect.get(value, "loadRouteManifest"));
35
30
  }
36
31
  function isNavigationRuntimeRscChunk(value) {
37
32
  if (typeof value === "string") return true;
@@ -49,6 +44,7 @@ function isNavigationRuntimeParams(value) {
49
44
  }
50
45
  function isNavigationRuntimeRscBootstrap(value) {
51
46
  if (!isUnknownRecord(value)) return false;
47
+ const compatibilityId = Reflect.get(value, "compatibilityId");
52
48
  const done = Reflect.get(value, "done");
53
49
  const dynamicStaleTimeSeconds = Reflect.get(value, "dynamicStaleTimeSeconds");
54
50
  const initialCacheKind = Reflect.get(value, "initialCacheKind");
@@ -58,7 +54,7 @@ function isNavigationRuntimeRscBootstrap(value) {
58
54
  const renderedSearch = Reflect.get(value, "renderedSearch");
59
55
  const rsc = Reflect.get(value, "rsc");
60
56
  const staleTimeSeconds = Reflect.get(value, "staleTimeSeconds");
61
- return (done === void 0 || typeof done === "boolean") && isOptionalStaleTimeSeconds(dynamicStaleTimeSeconds) && (initialCacheKind === void 0 || initialCacheKind === "dynamic" || initialCacheKind === "static") && (searchParamsFromBrowser === void 0 || typeof searchParamsFromBrowser === "boolean") && (nav === void 0 || isNavigationRuntimeSnapshot(nav)) && (params === void 0 || isNavigationRuntimeParams(params)) && (renderedSearch === void 0 || typeof renderedSearch === "string") && Array.isArray(rsc) && rsc.every(isNavigationRuntimeRscChunk) && isOptionalStaleTimeSeconds(staleTimeSeconds);
57
+ return (compatibilityId === void 0 || typeof compatibilityId === "string") && (done === void 0 || typeof done === "boolean") && isOptionalStaleTimeSeconds(dynamicStaleTimeSeconds) && (initialCacheKind === void 0 || initialCacheKind === "dynamic" || initialCacheKind === "static") && (searchParamsFromBrowser === void 0 || typeof searchParamsFromBrowser === "boolean") && (nav === void 0 || isNavigationRuntimeSnapshot(nav)) && (params === void 0 || isNavigationRuntimeParams(params)) && (renderedSearch === void 0 || typeof renderedSearch === "string") && Array.isArray(rsc) && rsc.every(isNavigationRuntimeRscChunk) && isOptionalStaleTimeSeconds(staleTimeSeconds);
62
58
  }
63
59
  function isOptionalStaleTimeSeconds(value) {
64
60
  return value === void 0 || typeof value === "number" && Number.isFinite(value) && value >= 0;
@@ -71,7 +67,7 @@ function isNullableString(value) {
71
67
  }
72
68
  function isNavigationRuntimeInterception(value) {
73
69
  if (!isUnknownRecord(value)) return false;
74
- return typeof value.id === "string" && typeof value.sourcePattern === "string" && isReadonlyStringArray(value.sourcePatternParts) && typeof value.targetPattern === "string" && isReadonlyStringArray(value.targetPatternParts) && typeof value.slotId === "string" && isNullableString(value.ownerLayoutId) && isNullableString(value.interceptingRouteId) && isNullableString(value.targetRouteId);
70
+ return typeof value.id === "string" && isReadonlyStringArray(value.sourcePatternParts) && isReadonlyStringArray(value.targetPatternParts) && typeof value.slotId === "string" && isNullableString(value.ownerLayoutId) && isNullableString(value.targetRouteId);
75
71
  }
76
72
  function isNavigationRuntimeInterceptionArray(value) {
77
73
  return Array.isArray(value) && value.every(isNavigationRuntimeInterception);
@@ -150,6 +146,41 @@ function ensureNavigationRuntimeRscBootstrapForRuntime(runtime) {
150
146
  }
151
147
  return rscBootstrap;
152
148
  }
149
+ /**
150
+ * The browser entry does not inline the RouteManifest: the manifest grows with
151
+ * every route of the app, so it lives in its own chunk that loads alongside
152
+ * hydration. The navigation planner needs it to classify commits (root layout
153
+ * changes, intercepted payloads, preserved slots), so navigations, commits and
154
+ * prefetches that read it wait for this load first.
155
+ */
156
+ function createNavigationRuntimeRouteManifestLoader(importManifest) {
157
+ let loaded = false;
158
+ let reportedFailure = false;
159
+ let pending = null;
160
+ return () => {
161
+ if (loaded) return null;
162
+ pending ??= importManifest().then(({ default: wire }) => {
163
+ registerNavigationRuntimeBootstrap({ routeManifest: wire === null ? null : decodeBrowserRouteManifest(wire) });
164
+ loaded = true;
165
+ return true;
166
+ }).catch((error) => {
167
+ pending = null;
168
+ if (!reportedFailure) {
169
+ reportedFailure = true;
170
+ console.error("[vinext] Failed to load the App Router route manifest:", error);
171
+ }
172
+ return false;
173
+ });
174
+ return pending;
175
+ };
176
+ }
177
+ /**
178
+ * Starts or joins the RouteManifest load. Resolves whether it loaded, and
179
+ * returns null once it has (or when no App Router runtime registered a loader).
180
+ */
181
+ function loadNavigationRuntimeRouteManifest() {
182
+ return getNavigationRuntime()?.functions.loadRouteManifest?.() ?? null;
183
+ }
153
184
  function hasAppNavigationRuntime() {
154
185
  return typeof getNavigationRuntime()?.functions.navigate === "function";
155
186
  }
@@ -169,4 +200,4 @@ function hasAppNavigationRuntimeBootstrap() {
169
200
  return getNavigationRuntime() !== null;
170
201
  }
171
202
  //#endregion
172
- export { NAVIGATION_RUNTIME_KEY, ensureNavigationRuntimeRscBootstrap, getNavigationRuntime, hasAppNavigationRuntime, hasAppNavigationRuntimeBootstrap, registerNavigationRuntimeBootstrap, registerNavigationRuntimeFunctions };
203
+ export { NAVIGATION_RUNTIME_KEY, createNavigationRuntimeRouteManifestLoader, ensureNavigationRuntimeRscBootstrap, getNavigationRuntime, hasAppNavigationRuntime, hasAppNavigationRuntimeBootstrap, loadNavigationRuntimeRouteManifest, registerNavigationRuntimeBootstrap, registerNavigationRuntimeFunctions };
@@ -21,7 +21,6 @@ export type VinextLinkPrefetchRoute = {
21
21
  */
22
22
  export type VinextPagesLinkPrefetchRoute = {
23
23
  canPrefetchLoadingShell: false;
24
- documentOnly?: boolean;
25
24
  isDynamic: boolean;
26
25
  patternParts: string[];
27
26
  requiresDynamicNavigationRequest?: boolean;
@@ -2,34 +2,8 @@ import { HasCondition, NextHeader, NextI18nConfig, NextRedirect, NextRewrite } f
2
2
  import { RequestContext, normalizeHost, parseCookies, requestContextFromRequest } from "./request-context.js";
3
3
  import { RedirectDestinationQueryPart } from "./destination-params.js";
4
4
  import { isExternalUrl } from "../utils/external-url.js";
5
+ import { configSourceError, matchConfigPattern } from "./config-source.js";
5
6
  //#region src/config/config-matchers.d.ts
6
- /**
7
- * Detect regex patterns vulnerable to catastrophic backtracking (ReDoS).
8
- *
9
- * Uses the same deterministic structural analysis as middleware matcher
10
- * validation. Nested bounded repetition is accepted only when its repeated
11
- * language has fixed width and unambiguous branches; a fixed outer count can
12
- * otherwise still cause polynomially catastrophic backtracking on long near
13
- * misses.
14
- *
15
- * Returns true if the pattern appears safe, false if it's potentially dangerous.
16
- */
17
- export declare function isSafeRegex(pattern: string, flags?: string): boolean;
18
- /**
19
- * Compile a regex pattern safely. Returns the compiled RegExp or null if the
20
- * pattern is invalid or vulnerable to ReDoS.
21
- *
22
- * Logs a warning when a pattern is rejected so developers can fix their config.
23
- */
24
- export declare function safeRegExp(pattern: string, flags?: string): RegExp | null;
25
- /**
26
- * Convert a Next.js header/rewrite/redirect source pattern into a regex string.
27
- *
28
- * Regex groups in the source (e.g. `(\d+)`) are extracted first, the remaining
29
- * text is escaped/converted in a **single pass** (avoiding chained `.replace()`
30
- * which CodeQL flags as incomplete sanitization), then groups are restored.
31
- */
32
- export declare function escapeHeaderSource(source: string): string;
33
7
  /**
34
8
  * basePath gating state passed alongside the pathname to every matcher.
35
9
  *
@@ -75,7 +49,6 @@ export declare function applyMiddlewareRequestHeaders(middlewareHeaders: Record<
75
49
  postMwReqCtx: RequestContext;
76
50
  };
77
51
  export declare function checkHasConditions(has: HasCondition[] | undefined, missing: HasCondition[] | undefined, ctx: RequestContext): boolean;
78
- export declare function matchConfigPattern(pathname: string, pattern: string): Record<string, string> | null;
79
52
  /**
80
53
  * A matched config redirect. `destinationQuery` holds the destination query's
81
54
  * parts, split before params were substituted, for merging the request query.
@@ -220,17 +193,19 @@ export declare function matchHeaders(pathname: string, headers: NextHeader[], ct
220
193
  * starts with `/:nextInternalLocale(en|sv|nl)` so that locale-prefixed
221
194
  * URLs match. For redirects only, a second variant prefixed with
222
195
  * `/${defaultLocale}` is also emitted, matching Next.js exactly.
223
- * - **Vinext divergence**: we ALSO retain the original (unprefixed) source
224
- * so that requests for the default locale that arrive without a prefix
225
- * still match. Next.js solves this upstream by path-normalising every
226
- * incoming default-locale request to include the prefix
227
- * (`resolve-routes.ts` lines ~251-263); vinext currently does that
228
- * normalisation only inside the pages-server-entry route matcher, so
229
- * the rewrite/redirect matcher would otherwise miss unprefixed paths.
230
- * Keeping the unprefixed variant gives functionally identical behaviour
231
- * without requiring a server-wide path normalisation pass. The original
232
- * source is appended LAST so the locale-aware variants win when both
233
- * forms could match.
196
+ * - Headers get only that variant, exactly like Next.js. Every header
197
+ * matcher caller splices the (domain-aware) default locale into
198
+ * unprefixed request paths first (`normalizeDefaultLocalePathname`,
199
+ * mirroring `resolve-routes.ts`), so `/about` is matched as `/en/about`.
200
+ * `/_next/*` paths are left unprefixed and therefore only match
201
+ * `locale: false` rules, as in Next.js.
202
+ * - **Vinext divergence (redirects/rewrites only)**: we ALSO retain the
203
+ * original (unprefixed) source, appended LAST so the locale-aware
204
+ * variants win when both forms could match. Their callers normalise
205
+ * default-locale paths too, so this is a legacy fallback. Headers never
206
+ * get it: it would apply rules Next.js skips (`/((?!api).*)` would match
207
+ * `/fr/api/x` as `fr/api/x`), and default-locale requests would match
208
+ * both variants, appending additive headers such as `Set-Cookie` twice.
234
209
  *
235
210
  * Destinations that are local (start with `/`) are similarly rewritten with
236
211
  * `/:nextInternalLocale` for the locale-capture variant so the locale
@@ -243,4 +218,4 @@ export declare function applyLocaleToRoutes<T extends NextRedirect | NextRewrite
243
218
  trailingSlash?: boolean;
244
219
  }): T[];
245
220
  //#endregion
246
- export { type RequestContext, isExternalUrl, normalizeHost, parseCookies, requestContextFromRequest };
221
+ export { type RequestContext, configSourceError, isExternalUrl, matchConfigPattern, normalizeHost, parseCookies, requestContextFromRequest };