vinext 1.0.0-beta.1 → 1.0.0-beta.3

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 (234) hide show
  1. package/README.md +10 -10
  2. package/dist/build/client-build-config.js +8 -1
  3. package/dist/build/report.d.ts +8 -1
  4. package/dist/build/report.js +12 -2
  5. package/dist/check.js +19 -2
  6. package/dist/cli.js +3 -2
  7. package/dist/config/config-matchers.d.ts +13 -37
  8. package/dist/config/config-matchers.js +35 -122
  9. package/dist/config/next-config.d.ts +15 -5
  10. package/dist/config/next-config.js +7 -1
  11. package/dist/config/request-context.d.ts +14 -0
  12. package/dist/config/request-context.js +26 -0
  13. package/dist/entries/app-browser-entry.d.ts +4 -10
  14. package/dist/entries/app-browser-entry.js +20 -4
  15. package/dist/entries/app-rsc-entry.js +30 -9
  16. package/dist/entries/app-rsc-manifest.js +36 -0
  17. package/dist/entries/pages-client-entry.js +0 -1
  18. package/dist/entries/pages-server-entry.js +13 -5
  19. package/dist/index.js +194 -101
  20. package/dist/init-cloudflare.d.ts +3 -1
  21. package/dist/init-cloudflare.js +59 -5
  22. package/dist/init.d.ts +6 -4
  23. package/dist/init.js +20 -22
  24. package/dist/plugins/extensionless-dynamic-import.js +23 -18
  25. package/dist/plugins/ignore-dynamic-requests.js +3 -1
  26. package/dist/plugins/import-meta-url.js +17 -6
  27. package/dist/plugins/og-assets.js +1 -1
  28. package/dist/plugins/require-context.js +20 -15
  29. package/dist/plugins/transform-cache.d.ts +19 -0
  30. package/dist/plugins/transform-cache.js +36 -0
  31. package/dist/routing/app-route-graph.d.ts +27 -11
  32. package/dist/routing/app-route-graph.js +158 -22
  33. package/dist/routing/app-router.js +12 -6
  34. package/dist/routing/file-matcher.d.ts +11 -22
  35. package/dist/routing/file-matcher.js +21 -33
  36. package/dist/routing/pages-router.js +23 -29
  37. package/dist/routing/route-matching.d.ts +14 -1
  38. package/dist/routing/route-matching.js +13 -1
  39. package/dist/routing/route-pattern.d.ts +2 -1
  40. package/dist/routing/route-pattern.js +7 -4
  41. package/dist/routing/route-trie.d.ts +5 -1
  42. package/dist/routing/route-trie.js +5 -2
  43. package/dist/server/api-handler.d.ts +2 -0
  44. package/dist/server/api-handler.js +3 -3
  45. package/dist/server/app-browser-entry.js +110 -37
  46. package/dist/server/app-browser-history-controller.d.ts +1 -1
  47. package/dist/server/app-browser-history-controller.js +3 -3
  48. package/dist/server/app-browser-navigation-controller.d.ts +23 -21
  49. package/dist/server/app-browser-navigation-controller.js +2 -2
  50. package/dist/server/app-browser-state.js +1 -1
  51. package/dist/server/app-browser-visible-commit.js +1 -1
  52. package/dist/server/app-fallback-renderer.d.ts +3 -0
  53. package/dist/server/app-fallback-renderer.js +4 -2
  54. package/dist/server/app-middleware.js +2 -1
  55. package/dist/server/app-page-boundary-render.d.ts +12 -1
  56. package/dist/server/app-page-boundary-render.js +84 -2
  57. package/dist/server/app-page-cache-finalizer.d.ts +1 -1
  58. package/dist/server/app-page-cache-finalizer.js +1 -1
  59. package/dist/server/app-page-cache.d.ts +2 -2
  60. package/dist/server/app-page-cache.js +16 -2
  61. package/dist/server/app-page-dispatch.d.ts +19 -2
  62. package/dist/server/app-page-dispatch.js +45 -23
  63. package/dist/server/app-page-element-builder.d.ts +9 -2
  64. package/dist/server/app-page-element-builder.js +144 -33
  65. package/dist/server/app-page-head.d.ts +56 -4
  66. package/dist/server/app-page-head.js +216 -85
  67. package/dist/server/app-page-http-access-fallback-metadata.d.ts +29 -0
  68. package/dist/server/app-page-http-access-fallback-metadata.js +114 -0
  69. package/dist/server/app-page-probe.d.ts +4 -0
  70. package/dist/server/app-page-probe.js +6 -2
  71. package/dist/server/app-page-render.d.ts +2 -2
  72. package/dist/server/app-page-render.js +1 -1
  73. package/dist/server/app-page-request.d.ts +15 -0
  74. package/dist/server/app-page-request.js +134 -14
  75. package/dist/server/app-page-response.js +1 -1
  76. package/dist/server/app-page-route-wiring.d.ts +16 -0
  77. package/dist/server/app-page-route-wiring.js +254 -52
  78. package/dist/server/app-pages-bridge.d.ts +1 -1
  79. package/dist/server/app-pages-bridge.js +2 -1
  80. package/dist/server/app-post-middleware-context.d.ts +1 -1
  81. package/dist/server/app-post-middleware-context.js +1 -1
  82. package/dist/server/app-route-handler-cache.js +4 -0
  83. package/dist/server/app-route-handler-dispatch.js +40 -20
  84. package/dist/server/app-route-handler-execution.d.ts +6 -1
  85. package/dist/server/app-route-handler-execution.js +42 -16
  86. package/dist/server/app-route-handler-policy.d.ts +2 -0
  87. package/dist/server/app-route-handler-policy.js +3 -3
  88. package/dist/server/app-route-handler-response.js +1 -1
  89. package/dist/server/app-route-module-loader.d.ts +9 -1
  90. package/dist/server/app-route-module-loader.js +4 -0
  91. package/dist/server/app-router-entry.js +6 -3
  92. package/dist/server/app-rsc-cache-busting.d.ts +1 -1
  93. package/dist/server/app-rsc-errors.d.ts +1 -1
  94. package/dist/server/app-rsc-errors.js +22 -2
  95. package/dist/server/app-rsc-handler.d.ts +10 -5
  96. package/dist/server/app-rsc-handler.js +73 -33
  97. package/dist/server/app-rsc-request-normalization.d.ts +3 -2
  98. package/dist/server/app-rsc-request-normalization.js +8 -2
  99. package/dist/server/app-rsc-response-finalizer.d.ts +2 -2
  100. package/dist/server/app-rsc-response-finalizer.js +5 -11
  101. package/dist/server/app-rsc-route-matching.d.ts +29 -0
  102. package/dist/server/app-rsc-route-matching.js +93 -11
  103. package/dist/server/app-segment-config.js +13 -3
  104. package/dist/server/app-server-action-execution.d.ts +3 -1
  105. package/dist/server/app-server-action-execution.js +9 -7
  106. package/dist/server/app-ssr-entry.js +6 -6
  107. package/dist/server/app-ssr-stream.d.ts +1 -7
  108. package/dist/server/app-ssr-stream.js +2 -10
  109. package/dist/server/cache-control.d.ts +2 -2
  110. package/dist/server/cache-control.js +2 -1
  111. package/dist/server/config-headers.d.ts +24 -0
  112. package/dist/server/config-headers.js +52 -0
  113. package/dist/server/dev-initial-server-error.d.ts +1 -1
  114. package/dist/server/dev-server.d.ts +3 -1
  115. package/dist/server/dev-server.js +170 -321
  116. package/dist/server/headers.d.ts +2 -2
  117. package/dist/server/headers.js +4 -3
  118. package/dist/server/isr-cache.d.ts +11 -34
  119. package/dist/server/isr-cache.js +33 -43
  120. package/dist/server/isr-decision.d.ts +2 -2
  121. package/dist/server/middleware-matcher-pattern.d.ts +22 -0
  122. package/dist/server/middleware-matcher-pattern.js +219 -0
  123. package/dist/server/middleware-matcher.d.ts +2 -7
  124. package/dist/server/middleware-matcher.js +13 -60
  125. package/dist/server/middleware-path-to-regexp.d.ts +14 -0
  126. package/dist/server/middleware-path-to-regexp.js +228 -0
  127. package/dist/server/middleware-runtime.js +4 -3
  128. package/dist/server/middleware.d.ts +1 -1
  129. package/dist/server/middleware.js +2 -1
  130. package/dist/server/pages-api-route.d.ts +2 -0
  131. package/dist/server/pages-api-route.js +4 -1
  132. package/dist/server/pages-data-route.d.ts +11 -1
  133. package/dist/server/pages-data-route.js +16 -1
  134. package/dist/server/pages-dev-hydration.js +0 -1
  135. package/dist/server/pages-get-initial-props.d.ts +16 -3
  136. package/dist/server/pages-get-initial-props.js +17 -10
  137. package/dist/server/pages-i18n.js +64 -16
  138. package/dist/server/pages-node-compat.d.ts +2 -0
  139. package/dist/server/pages-node-compat.js +7 -3
  140. package/dist/server/pages-page-data.d.ts +64 -10
  141. package/dist/server/pages-page-data.js +349 -80
  142. package/dist/server/pages-page-handler.d.ts +9 -3
  143. package/dist/server/pages-page-handler.js +131 -36
  144. package/dist/server/pages-page-response.d.ts +5 -3
  145. package/dist/server/pages-page-response.js +24 -27
  146. package/dist/server/pages-readiness.d.ts +3 -3
  147. package/dist/server/pages-request-pipeline.d.ts +8 -0
  148. package/dist/server/pages-request-pipeline.js +30 -12
  149. package/dist/server/pages-revalidate.d.ts +1 -1
  150. package/dist/server/pages-revalidate.js +54 -8
  151. package/dist/server/pages-router-entry.d.ts +1 -0
  152. package/dist/server/pages-router-entry.js +16 -4
  153. package/dist/server/prerender-route-params.js +2 -2
  154. package/dist/server/prod-server.d.ts +3 -5
  155. package/dist/server/prod-server.js +72 -35
  156. package/dist/server/request-pipeline.d.ts +15 -29
  157. package/dist/server/request-pipeline.js +24 -59
  158. package/dist/server/revalidation-host.d.ts +11 -0
  159. package/dist/server/revalidation-host.js +19 -0
  160. package/dist/server/rsc-stream-hints.js +122 -18
  161. package/dist/server/worker-revalidation-context.d.ts +13 -0
  162. package/dist/server/worker-revalidation-context.js +29 -0
  163. package/dist/shims/app.d.ts +1 -1
  164. package/dist/shims/cache-handler.d.ts +1 -1
  165. package/dist/shims/cache-handler.js +10 -7
  166. package/dist/shims/cache-request-state.d.ts +27 -1
  167. package/dist/shims/cache-request-state.js +60 -1
  168. package/dist/shims/cache-runtime.d.ts +18 -1
  169. package/dist/shims/cache-runtime.js +26 -8
  170. package/dist/shims/cache.d.ts +5 -5
  171. package/dist/shims/cache.js +27 -11
  172. package/dist/shims/document.d.ts +42 -83
  173. package/dist/shims/document.js +62 -53
  174. package/dist/shims/dynamic.d.ts +5 -25
  175. package/dist/shims/dynamic.js +29 -8
  176. package/dist/shims/error.d.ts +1 -1
  177. package/dist/shims/error.js +2 -2
  178. package/dist/shims/fetch-cache.js +13 -4
  179. package/dist/shims/font-google-base.d.ts +11 -4
  180. package/dist/shims/font-google-base.js +17 -8
  181. package/dist/shims/font-local.d.ts +10 -3
  182. package/dist/shims/font-local.js +41 -10
  183. package/dist/shims/head.d.ts +13 -2
  184. package/dist/shims/head.js +3 -3
  185. package/dist/shims/headers.d.ts +37 -43
  186. package/dist/shims/headers.js +183 -74
  187. package/dist/shims/image.d.ts +27 -37
  188. package/dist/shims/image.js +21 -14
  189. package/dist/shims/internal/cookie-serialize.d.ts +12 -9
  190. package/dist/shims/internal/cookie-serialize.js +10 -7
  191. package/dist/shims/internal/hybrid-client-route-owner.js +3 -1
  192. package/dist/shims/internal/interpolate-as.d.ts +15 -1
  193. package/dist/shims/internal/interpolate-as.js +27 -2
  194. package/dist/shims/internal/utils.d.ts +3 -3
  195. package/dist/shims/legacy-image.d.ts +3 -37
  196. package/dist/shims/legacy-image.js +6 -16
  197. package/dist/shims/link.d.ts +15 -22
  198. package/dist/shims/link.js +34 -13
  199. package/dist/shims/metadata.d.ts +7 -17
  200. package/dist/shims/metadata.js +74 -24
  201. package/dist/shims/navigation-context-state.d.ts +1 -1
  202. package/dist/shims/navigation.d.ts +7 -3
  203. package/dist/shims/navigation.js +25 -14
  204. package/dist/shims/navigation.react-server.js +1 -1
  205. package/dist/shims/next-shims-augmentations.d.ts +1 -0
  206. package/dist/shims/next-shims-public.d.ts +1 -0
  207. package/dist/shims/public-shim-map.json.js +103 -0
  208. package/dist/shims/readonly-url-search-params.d.ts +3 -3
  209. package/dist/shims/readonly-url-search-params.js +3 -3
  210. package/dist/shims/request-context.d.ts +4 -1
  211. package/dist/shims/request-state-types.d.ts +1 -1
  212. package/dist/shims/router.d.ts +55 -21
  213. package/dist/shims/router.js +180 -44
  214. package/dist/shims/script.d.ts +6 -10
  215. package/dist/shims/script.js +7 -4
  216. package/dist/shims/server.d.ts +50 -26
  217. package/dist/shims/server.js +193 -55
  218. package/dist/shims/unified-request-context.d.ts +22 -3
  219. package/dist/shims/unified-request-context.js +84 -1
  220. package/dist/shims/url-safety.d.ts +1 -1
  221. package/dist/shims/url-safety.js +2 -2
  222. package/dist/typegen.d.ts +8 -2
  223. package/dist/typegen.js +76 -15
  224. package/dist/utils/cache-control-metadata.d.ts +2 -1
  225. package/dist/utils/cache-control-metadata.js +5 -1
  226. package/dist/utils/domain-locale.d.ts +2 -2
  227. package/dist/utils/external-url.d.ts +5 -0
  228. package/dist/utils/external-url.js +7 -0
  229. package/dist/utils/html-limited-bots.js +1 -1
  230. package/dist/utils/protocol-headers.d.ts +7 -1
  231. package/dist/utils/protocol-headers.js +7 -1
  232. package/dist/utils/regex-safety.d.ts +8 -0
  233. package/dist/utils/regex-safety.js +737 -0
  234. package/package.json +13 -2
@@ -1,11 +1,13 @@
1
- import { createRequestContext, runWithRequestContext } from "../shims/unified-request-context.js";
1
+ import { closeAfterResponse, closeAfterResponseWithBody, createRequestContext, runWithRequestContext } from "../shims/unified-request-context.js";
2
2
  import { addBasePathToPathname, hasBasePath, stripBasePath } from "../utils/base-path.js";
3
3
  import { getRequestExecutionContext } from "../shims/request-context.js";
4
- import { VINEXT_MW_CTX_HEADER, VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SPECULATIVE_HEADER } from "../utils/protocol-headers.js";
4
+ import { VINEXT_MW_CTX_HEADER, VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SPECULATIVE_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
5
5
  import { ACTION_REVALIDATED_HEADER } from "./headers.js";
6
- import { isExternalUrl, matchRedirect, matchRewrite, preserveRedirectDestinationQuery, proxyExternalRequest, requestContextFromRequest, sanitizeDestination } from "../config/config-matchers.js";
6
+ import { requestContextFromRequest } from "../config/request-context.js";
7
+ import { isExternalUrl } from "../utils/external-url.js";
7
8
  import { notFoundResponse } from "./http-error-responses.js";
8
- import { applyConfigHeadersToResponse, cloneRequestWithHeaders, cloneRequestWithUrl, filterInternalHeaders, normalizeTrailingSlash, resolvePublicFileRoute } from "./request-pipeline.js";
9
+ import { cloneRequestWithHeaders, cloneRequestWithUrl, filterInternalHeaders, normalizeTrailingSlash, resolvePublicFileRoute } from "./request-pipeline.js";
10
+ import { isOnDemandRevalidateRequest } from "./isr-cache.js";
9
11
  import { headersContextFromRequest } from "../shims/headers.js";
10
12
  import { ensureFetchPatch, setCurrentFetchSoftTags } from "../shims/fetch-cache.js";
11
13
  import { mergeRewriteQuery } from "../utils/query.js";
@@ -19,17 +21,20 @@ import "./app-page-response.js";
19
21
  import { parseNextHttpErrorDigest } from "./next-error-digest.js";
20
22
  import { matchPrerenderRouteParamsPayload, readTrustedPrerenderRouteParams, serializePrerenderRouteParamsHeader } from "./prerender-route-params.js";
21
23
  import { getRenderedConcreteUrlPathsForRoute } from "./pregenerated-concrete-paths.js";
22
- import { flattenErrorCauses } from "../utils/error-cause.js";
23
- import { pickRootParams, setRootParams } from "../shims/root-params.js";
24
24
  import { createServerActionNotFoundResponse, getServerActionNotFoundMessage } from "./server-action-not-found.js";
25
25
  import { buildPageCacheTags } from "./implicit-tags.js";
26
26
  import { buildPostMwRequestContext } from "./app-post-middleware-context.js";
27
+ import { pickRootParams, setRootParams } from "../shims/root-params.js";
27
28
  import { createRouteTreePrefetchResponse, isRouteTreePrefetchRequest } from "./app-route-tree-prefetch.js";
29
+ import { flattenErrorCauses } from "../utils/error-cause.js";
28
30
  import { finalizeAppRscResponse } from "./app-rsc-response-finalizer.js";
29
31
  import { normalizeRscRequest } from "./app-rsc-request-normalization.js";
30
32
  import { runWithPrerenderWorkUnit } from "./prerender-work-unit-setup.js";
31
33
  //#region src/server/app-rsc-handler.ts
32
34
  const STATIC_METADATA_CONFIG_HEADER_OVERRIDES = /* @__PURE__ */ new Set(["cache-control"]);
35
+ const HAS_CONFIG_HEADERS = process.env.__VINEXT_HAS_CONFIG_HEADERS !== "false";
36
+ const HAS_CONFIG_REDIRECTS = process.env.__VINEXT_HAS_CONFIG_REDIRECTS !== "false";
37
+ const HAS_CONFIG_REWRITES = process.env.__VINEXT_HAS_CONFIG_REWRITES !== "false";
33
38
  function applyMiddlewareContextToResponse(response, middlewareContext) {
34
39
  if (!middlewareContext.headers && middlewareContext.status == null) return response;
35
40
  const headers = new Headers(response.headers);
@@ -61,12 +66,14 @@ function redirectDestinationWithBasePath(destination, basePath, hadBasePath) {
61
66
  return basePath + destination;
62
67
  }
63
68
  async function applyRewrite(options, cleanPathname) {
64
- if (!options.rewrites.length) return null;
65
- const rewritten = matchRewrite(cleanPathname, options.rewrites, options.requestContext, options.basePathState);
69
+ if (!HAS_CONFIG_REWRITES || !options.rewrites.length) return null;
70
+ const sourcePathname = options.paramsPathname ?? cleanPathname;
71
+ const configMatchers = await import("../config/config-matchers.js");
72
+ const rewritten = configMatchers.matchRewrite(sourcePathname, options.rewrites, options.requestContext, options.basePathState, options.paramsPathname);
66
73
  if (!rewritten) return null;
67
74
  if (isExternalUrl(rewritten)) {
68
75
  options.clearRequestContext();
69
- return proxyExternalRequest(options.request, rewritten);
76
+ return configMatchers.proxyExternalRequest(options.request, rewritten);
70
77
  }
71
78
  return rewritten;
72
79
  }
@@ -81,9 +88,10 @@ function requestContextForResolvedUrl(requestContext, resolvedUrl, baseUrl) {
81
88
  function pathnameForResolvedUrl(resolvedUrl) {
82
89
  return resolvedUrl.split("#", 1)[0].split("?", 1)[0];
83
90
  }
84
- function applyConfigHeadersToMiddlewareRedirect(response, options) {
91
+ async function applyConfigHeadersToMiddlewareRedirect(response, options) {
85
92
  if (response.status < 300 || response.status >= 400) return response;
86
- if (!options.configHeaders.length) return response;
93
+ if (!HAS_CONFIG_HEADERS || !options.configHeaders.length) return response;
94
+ const { applyConfigHeadersToResponse } = await import("./config-headers.js");
87
95
  const headers = new Headers();
88
96
  applyConfigHeadersToResponse(headers, {
89
97
  configHeaders: options.configHeaders,
@@ -130,6 +138,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
130
138
  const normalized = normalizeRscRequest(request, options.basePath, canHandleOutsideBasePath);
131
139
  if (normalized instanceof Response) return normalized;
132
140
  const { url, isRscRequest, interceptionContextHeader, mountedSlotsHeader, renderMode, clientReuseManifest, hadBasePath } = normalized;
141
+ const { requestCleanPathname } = normalized;
133
142
  let { pathname, cleanPathname } = normalized;
134
143
  let resolvedUrl = cleanPathname + url.search;
135
144
  const originalResolvedUrl = resolvedUrl;
@@ -139,6 +148,8 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
139
148
  basePath: options.basePath,
140
149
  hadBasePath
141
150
  };
151
+ let cleanPathnameIsRequestPathname = true;
152
+ const matchCleanPathname = () => cleanPathnameIsRequestPathname && options.matchRequestRoute ? options.matchRequestRoute(requestCleanPathname) : options.matchRoute(cleanPathname);
142
153
  if (pathname === "/__vinext/prerender/static-params" || pathname === "/__vinext/prerender/pages-static-paths") {
143
154
  const { handleAppPrerenderEndpoint } = await import("./app-prerender-endpoints.js");
144
155
  const prerenderEndpointResponse = await handleAppPrerenderEndpoint(request, {
@@ -152,13 +163,15 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
152
163
  });
153
164
  if (prerenderEndpointResponse) return prerenderEndpointResponse;
154
165
  }
155
- const trailingSlashRedirect = normalizeTrailingSlash(pathname, hadBasePath ? options.basePath : "", options.trailingSlash, url.search);
166
+ const trailingSlashRedirect = normalizeTrailingSlash(requestCleanPathname, hadBasePath ? options.basePath : "", options.trailingSlash, url.search);
156
167
  if (trailingSlashRedirect) return trailingSlashRedirect;
157
168
  const matchPathname = (p) => normalizeDefaultLocalePathname(p, options.i18nConfig, { hostname: url.hostname });
158
- const redirect = matchRedirect(matchPathname(stripRscSuffix(pathname)), options.configRedirects, preMiddlewareRequestContext, basePathState);
159
- if (redirect) {
160
- const destination = sanitizeDestination(redirectDestinationWithBasePath(redirect.destination, options.basePath, hadBasePath));
161
- const location = isRscRequest && request.headers.get("RSC") === "1" ? await createRscRedirectLocation(destination, request) : preserveRedirectDestinationQuery(destination, url.search);
169
+ const redirectPathname = matchPathname(requestCleanPathname);
170
+ const configMatchers = HAS_CONFIG_REDIRECTS && options.configRedirects.length ? await import("../config/config-matchers.js") : null;
171
+ const redirect = configMatchers ? configMatchers.matchRedirect(redirectPathname, options.configRedirects, preMiddlewareRequestContext, basePathState) : null;
172
+ if (configMatchers && redirect) {
173
+ const destination = configMatchers.sanitizeDestination(redirectDestinationWithBasePath(redirect.destination, options.basePath, hadBasePath));
174
+ const location = isRscRequest && request.headers.get("RSC") === "1" ? await createRscRedirectLocation(destination, request) : configMatchers.preserveRedirectDestinationQuery(destination, url.search);
162
175
  return new Response(null, {
163
176
  status: redirect.permanent ? 308 : 307,
164
177
  headers: { Location: location }
@@ -178,8 +191,9 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
178
191
  };
179
192
  let didMiddlewareRewrite = false;
180
193
  let didMiddlewareRewritePathname = false;
181
- if (options.runMiddleware) {
182
- const middlewareResult = await options.runMiddleware({
194
+ const runMiddleware = isOnDemandRevalidateRequest(request.headers.get("x-prerender-revalidate")) ? void 0 : options.runMiddleware;
195
+ if (runMiddleware) {
196
+ const middlewareResult = await runMiddleware({
183
197
  cleanPathname,
184
198
  context: middlewareContext,
185
199
  hadBasePath,
@@ -189,11 +203,12 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
189
203
  if (middlewareResult.kind === "response") return applyConfigHeadersToMiddlewareRedirect(middlewareResult.response, {
190
204
  basePathState,
191
205
  configHeaders: options.configHeaders,
192
- pathname: matchPathname(cleanPathname),
206
+ pathname: matchPathname(requestCleanPathname),
193
207
  requestContext: preMiddlewareRequestContext
194
208
  });
195
209
  cleanPathname = middlewareResult.cleanPathname;
196
210
  didMiddlewareRewrite = middlewareResult.rewritten;
211
+ if (didMiddlewareRewrite || cleanPathname !== normalized.cleanPathname) cleanPathnameIsRequestPathname = false;
197
212
  didMiddlewareRewritePathname = cleanPathname !== normalized.cleanPathname;
198
213
  if (middlewareResult.search !== null) url.search = middlewareResult.search;
199
214
  resolvedUrl = cleanPathname + url.search;
@@ -214,12 +229,14 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
214
229
  clearRequestContext: options.clearRequestContext,
215
230
  request: normalizedUserlandRequest,
216
231
  requestContext: requestContextForResolvedUrl(postMiddlewareRequestContext, resolvedUrl, url),
232
+ paramsPathname: matchPathname(cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname),
217
233
  rewrites: [rewrite]
218
234
  }, matchPathname(cleanPathname));
219
235
  if (beforeFilesRewrite instanceof Response) return beforeFilesRewrite;
220
236
  if (beforeFilesRewrite) {
221
237
  resolvedUrl = mergeRewriteQuery(resolvedUrl, beforeFilesRewrite);
222
238
  cleanPathname = pathnameForResolvedUrl(resolvedUrl);
239
+ cleanPathnameIsRequestPathname = false;
223
240
  filesystemRouteEligible = true;
224
241
  }
225
242
  }
@@ -238,14 +255,16 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
238
255
  clearRequestContext: options.clearRequestContext,
239
256
  request: normalizedUserlandRequest,
240
257
  requestContext: requestContextForResolvedUrl(postMiddlewareRequestContext, resolvedUrl, url),
258
+ paramsPathname: matchPathname(cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname),
241
259
  rewrites: [rewrite]
242
260
  }, matchPathname(cleanPathname));
243
261
  if (rewritten instanceof Response) return rewritten;
244
262
  if (!rewritten) continue;
245
263
  resolvedUrl = mergeRewriteQuery(resolvedUrl, rewritten);
246
264
  cleanPathname = pathnameForResolvedUrl(resolvedUrl);
265
+ cleanPathnameIsRequestPathname = false;
247
266
  filesystemRouteEligible = true;
248
- actionMatch = options.matchRoute(cleanPathname);
267
+ actionMatch = matchCleanPathname();
249
268
  if (actionMatch) break;
250
269
  }
251
270
  if (!actionMatch) for (const rewrite of options.configRewrites.fallback) {
@@ -254,14 +273,16 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
254
273
  clearRequestContext: options.clearRequestContext,
255
274
  request: normalizedUserlandRequest,
256
275
  requestContext: requestContextForResolvedUrl(postMiddlewareRequestContext, resolvedUrl, url),
276
+ paramsPathname: matchPathname(cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname),
257
277
  rewrites: [rewrite]
258
278
  }, matchPathname(cleanPathname));
259
279
  if (rewritten instanceof Response) return rewritten;
260
280
  if (!rewritten) continue;
261
281
  resolvedUrl = mergeRewriteQuery(resolvedUrl, rewritten);
262
282
  cleanPathname = pathnameForResolvedUrl(resolvedUrl);
283
+ cleanPathnameIsRequestPathname = false;
263
284
  filesystemRouteEligible = true;
264
- actionMatch = options.matchRoute(cleanPathname);
285
+ actionMatch = matchCleanPathname();
265
286
  if (actionMatch) break;
266
287
  }
267
288
  resolvedLateRewritesForAction = filesystemRouteEligible;
@@ -275,16 +296,17 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
275
296
  }
276
297
  if (filesystemRouteEligible && options.handleMetadataRouteRequest) {
277
298
  const metadataRouteResponse = await options.handleMetadataRouteRequest(cleanPathname);
278
- if (metadataRouteResponse) {
299
+ if (metadataRouteResponse && HAS_CONFIG_HEADERS && options.configHeaders.length) {
300
+ const { applyConfigHeadersToResponse } = await import("./config-headers.js");
279
301
  applyConfigHeadersToResponse(metadataRouteResponse.headers, {
280
302
  basePathState,
281
303
  configHeaders: options.configHeaders,
282
304
  overwriteExisting: STATIC_METADATA_CONFIG_HEADER_OVERRIDES,
283
- pathname: matchPathname(cleanPathname),
305
+ pathname: matchPathname(cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname),
284
306
  requestContext: preMiddlewareRequestContext
285
307
  });
286
- return applyMiddlewareContextToResponse(metadataRouteResponse, middlewareContext);
287
308
  }
309
+ if (metadataRouteResponse) return applyMiddlewareContextToResponse(metadataRouteResponse, middlewareContext);
288
310
  }
289
311
  const publicFileResponse = filesystemRouteEligible ? resolvePublicFileRoute({
290
312
  cleanPathname,
@@ -306,7 +328,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
306
328
  searchParams: getResolvedSearchParams(),
307
329
  params: {}
308
330
  });
309
- const preActionMatch = filesystemRouteEligible ? options.matchRoute(cleanPathname) : null;
331
+ const preActionMatch = filesystemRouteEligible ? matchCleanPathname() : null;
310
332
  if (preActionMatch) setRootParams(pickRootParams(preActionMatch.params, preActionMatch.route.rootParamNames));
311
333
  if (pagesDataRequest && didMiddlewareRewritePathname && preActionMatch) {
312
334
  const headers = new Headers();
@@ -327,7 +349,8 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
327
349
  cleanPathname,
328
350
  contentType,
329
351
  middlewareContext,
330
- request
352
+ request,
353
+ routeMatch: preActionMatch
331
354
  });
332
355
  else if (preActionMatch?.route.__loadPage && !preActionMatch.route.__loadRouteHandler) return createMissingServerActionResponse(options, null);
333
356
  }
@@ -351,6 +374,8 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
351
374
  middlewareContext,
352
375
  mountedSlotsHeader,
353
376
  request,
377
+ routeMatch: preActionMatch,
378
+ routePathname: cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname,
354
379
  searchParams: getResolvedSearchParams()
355
380
  }) : null;
356
381
  if (serverActionResponse) return serverActionResponse;
@@ -390,16 +415,18 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
390
415
  clearRequestContext: options.clearRequestContext,
391
416
  request: normalizedUserlandRequest,
392
417
  requestContext: requestContextForResolvedUrl(postMiddlewareRequestContext, resolvedUrl, url),
418
+ paramsPathname: matchPathname(cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname),
393
419
  rewrites: [rewrite]
394
420
  }, matchPathname(cleanPathname));
395
421
  if (afterFilesRewrite instanceof Response) return afterFilesRewrite;
396
422
  if (!afterFilesRewrite) continue;
397
423
  resolvedUrl = mergeRewriteQuery(resolvedUrl, afterFilesRewrite);
398
424
  cleanPathname = pathnameForResolvedUrl(resolvedUrl);
425
+ cleanPathnameIsRequestPathname = false;
399
426
  filesystemRouteEligible = true;
400
427
  const claimedRscCacheBustingRedirect = await validateClaimedOutsideBasePathRsc();
401
428
  if (claimedRscCacheBustingRedirect) return claimedRscCacheBustingRedirect;
402
- match = options.matchRoute(cleanPathname);
429
+ match = matchCleanPathname();
403
430
  const rewrittenStaticPagesResponse = await renderPagesForMatchKind("static");
404
431
  if (rewrittenStaticPagesResponse) {
405
432
  options.clearRequestContext();
@@ -423,16 +450,18 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
423
450
  clearRequestContext: options.clearRequestContext,
424
451
  request: normalizedUserlandRequest,
425
452
  requestContext: requestContextForResolvedUrl(postMiddlewareRequestContext, resolvedUrl, url),
453
+ paramsPathname: matchPathname(cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname),
426
454
  rewrites: [rewrite]
427
455
  }, matchPathname(cleanPathname));
428
456
  if (fallbackRewrite instanceof Response) return fallbackRewrite;
429
457
  if (!fallbackRewrite) continue;
430
458
  resolvedUrl = mergeRewriteQuery(resolvedUrl, fallbackRewrite);
431
459
  cleanPathname = pathnameForResolvedUrl(resolvedUrl);
460
+ cleanPathnameIsRequestPathname = false;
432
461
  filesystemRouteEligible = true;
433
462
  const claimedRscCacheBustingRedirect = await validateClaimedOutsideBasePathRsc();
434
463
  if (claimedRscCacheBustingRedirect) return claimedRscCacheBustingRedirect;
435
- match = options.matchRoute(cleanPathname);
464
+ match = matchCleanPathname();
436
465
  const rewrittenStaticPagesResponse = await renderPagesForMatchKind("static");
437
466
  if (rewrittenStaticPagesResponse) {
438
467
  options.clearRequestContext();
@@ -453,7 +482,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
453
482
  }
454
483
  if (pagesDataRequest) {
455
484
  options.clearRequestContext();
456
- if (options.runMiddleware && (middlewareContext.status === null || middlewareContext.status === 200 || middlewareContext.status === 404)) {
485
+ if (runMiddleware && (middlewareContext.status === null || middlewareContext.status === 200 || middlewareContext.status === 404)) {
457
486
  const response = buildNextDataNotFoundResponse();
458
487
  const headers = new Headers(response.headers);
459
488
  headers.set("x-nextjs-matched-path", matchPathname(canonicalPathname));
@@ -536,6 +565,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
536
565
  actionFailed,
537
566
  handlerStart,
538
567
  interceptionContext: interceptionContextHeader,
568
+ interceptionPathname: cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname,
539
569
  isProgressiveActionRender,
540
570
  isRscRequest,
541
571
  middlewareContext,
@@ -604,9 +634,11 @@ function createAppRscHandler(options) {
604
634
  const pagesDataNormalization = options.renderPagesFallback && pagesDataCandidate ? normalizePagesDataRequest(pagesDataCandidate, options.buildId, "", typeof options.runMiddleware === "function" && options.trailingSlash) : null;
605
635
  if (pagesDataNormalization?.notFoundResponse) return pagesDataNormalization.notFoundResponse;
606
636
  const isPagesDataRequest = pagesDataNormalization?.isDataReq === true;
637
+ const executionContext = isExecutionContextLike(ctx) ? ctx : getRequestExecutionContext() ?? null;
607
638
  const prerenderRouteParamsPayload = readTrustedPrerenderRouteParams(rawRequest);
608
639
  const isTrustedSpeculativePrerender = process.env.VINEXT_PRERENDER === "1" && rawRequest.headers.get("x-vinext-prerender-secret") !== null && rawRequest.headers.get("x-vinext-prerender-speculative") === "1";
609
- const filteredHeaders = filterInternalHeaders(rawRequest.headers);
640
+ const filteredHeaders = executionContext?.isInternalPagesRevalidation ? new Headers(rawRequest.headers) : filterInternalHeaders(rawRequest.headers);
641
+ filteredHeaders.delete(VINEXT_REVALIDATE_HOST_HEADER);
610
642
  if (mwCtx !== null) filteredHeaders.set(VINEXT_MW_CTX_HEADER, mwCtx);
611
643
  const prerenderRouteParamsHeader = serializePrerenderRouteParamsHeader(prerenderRouteParamsPayload);
612
644
  if (prerenderRouteParamsHeader !== null) filteredHeaders.set(VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, prerenderRouteParamsHeader);
@@ -619,12 +651,12 @@ function createAppRscHandler(options) {
619
651
  }
620
652
  const request = cloneRequestWithHeaders(appRequest, filteredHeaders);
621
653
  const pagesDataRequest = pagesDataNormalization?.isDataReq ? cloneRequestWithHeaders(pagesDataCandidate, filteredHeaders) : null;
622
- const executionContext = isExecutionContextLike(ctx) ? ctx : getRequestExecutionContext() ?? null;
623
- return runWithRequestContext(createRequestContext({
654
+ const requestContext = createRequestContext({
624
655
  headersContext: headersContextFromRequest(request, { draftModeSecret: options.draftModeSecret }),
625
656
  executionContext,
626
657
  unstableCacheRevalidation: "background"
627
- }), () => runWithPrerenderWorkUnit(async () => {
658
+ });
659
+ const responsePromise = runWithRequestContext(requestContext, () => runWithPrerenderWorkUnit(async () => {
628
660
  ensureFetchPatch();
629
661
  const preMiddlewareRequestContext = requestContextFromRequest(request);
630
662
  let response;
@@ -641,6 +673,14 @@ function createAppRscHandler(options) {
641
673
  requestContext: preMiddlewareRequestContext
642
674
  });
643
675
  }, { route: () => new URL(request.url).pathname }));
676
+ let response;
677
+ try {
678
+ response = await responsePromise;
679
+ } catch (error) {
680
+ await closeAfterResponse(requestContext);
681
+ throw error;
682
+ }
683
+ return closeAfterResponseWithBody(response, requestContext);
644
684
  };
645
685
  }
646
686
  //#endregion
@@ -1,12 +1,13 @@
1
1
  import { ClientReuseManifestParseResult } from "./client-reuse-manifest.js";
2
- import { normalizeMountedSlotsHeader } from "./app-mounted-slots-header.js";
3
2
  import { AppRscRenderMode } from "./app-rsc-render-mode.js";
3
+ import { normalizeMountedSlotsHeader } from "./app-mounted-slots-header.js";
4
4
 
5
5
  //#region src/server/app-rsc-request-normalization.d.ts
6
6
  type NormalizedRscRequest = {
7
7
  /** Parsed URL. Callers may mutate `url.search` after middleware runs. */url: URL; /** Normalized pathname with basePath stripped. Used for all internal routing. */
8
8
  pathname: string; /** Pathname with `.rsc` suffix removed. Used for route matching and navigation context. */
9
- cleanPathname: string; /** True when the request targets a canonical `.rsc` payload URL. */
9
+ cleanPathname: string; /** Original encoded request pathname with basePath and `.rsc` removed. */
10
+ requestCleanPathname: string; /** True when the request targets a canonical `.rsc` payload URL. */
10
11
  isRscRequest: boolean; /** Sanitized X-Vinext-Interception-Context header (null bytes stripped). null when absent. */
11
12
  interceptionContextHeader: string | null; /** Normalized x-vinext-mounted-slots header (deduplicated, sorted). null when absent or blank. */
12
13
  mountedSlotsHeader: string | null; /** Semantic RSC payload mode. HTML requests always normalize to "navigation". */
@@ -50,14 +50,19 @@ function normalizeRscRequest(request, basePath, allowOutsideBasePath = false) {
50
50
  return badRequestResponse();
51
51
  }
52
52
  let pathname = normalizePath(decoded);
53
+ let requestPathname = url.pathname;
53
54
  let hadBasePath = true;
54
55
  if (basePath) {
55
- hadBasePath = hasBasePath(pathname, basePath);
56
+ hadBasePath = hasBasePath(requestPathname, basePath);
56
57
  if (!hadBasePath && !pathname.startsWith("/__vinext/") && !allowOutsideBasePath) return notFoundResponse();
57
- if (hadBasePath) pathname = stripBasePath(pathname, basePath);
58
+ if (hadBasePath) {
59
+ pathname = stripBasePath(pathname, basePath);
60
+ requestPathname = stripBasePath(requestPathname, basePath);
61
+ }
58
62
  }
59
63
  const isRscRequest = pathname.endsWith(".rsc") || request.headers.get("RSC") === "1";
60
64
  const cleanPathname = stripRscSuffix(pathname);
65
+ const requestCleanPathname = stripRscSuffix(requestPathname);
61
66
  const interceptionContextHeader = normalizeInterceptionContextHeader(request.headers.get(VINEXT_INTERCEPTION_CONTEXT_HEADER));
62
67
  const mountedSlotsHeader = normalizeMountedSlotsHeader(request.headers.get(VINEXT_MOUNTED_SLOTS_HEADER));
63
68
  const renderMode = isRscRequest ? parseAppRscRenderMode(request.headers.get(VINEXT_RSC_RENDER_MODE_HEADER)) : APP_RSC_RENDER_MODE_NAVIGATION;
@@ -67,6 +72,7 @@ function normalizeRscRequest(request, basePath, allowOutsideBasePath = false) {
67
72
  url,
68
73
  pathname,
69
74
  cleanPathname,
75
+ requestCleanPathname,
70
76
  isRscRequest,
71
77
  interceptionContextHeader,
72
78
  mountedSlotsHeader,
@@ -1,5 +1,5 @@
1
1
  import { NextHeader, NextI18nConfig } from "../config/next-config.js";
2
- import { RequestContext } from "../config/config-matchers.js";
2
+ import { RequestContext } from "../config/request-context.js";
3
3
 
4
4
  //#region src/server/app-rsc-response-finalizer.d.ts
5
5
  type FinalizeAppRscResponseOptions = {
@@ -32,6 +32,6 @@ type FinalizeAppRscResponseOptions = {
32
32
  * headers that throw on mutation, and Next.js does not apply config headers
33
33
  * to redirects regardless.
34
34
  */
35
- declare function finalizeAppRscResponse(response: Response, request: Request, options: FinalizeAppRscResponseOptions): Response;
35
+ declare function finalizeAppRscResponse(response: Response, request: Request, options: FinalizeAppRscResponseOptions): Promise<Response>;
36
36
  //#endregion
37
37
  export { finalizeAppRscResponse };
@@ -1,13 +1,11 @@
1
- import { normalizePathnameForRouteMatch } from "../routing/utils.js";
2
1
  import { hasBasePath, stripBasePath } from "../utils/base-path.js";
3
2
  import "./headers.js";
4
- import { normalizePath } from "./normalize-path.js";
5
- import { applyConfigHeadersToResponse } from "./request-pipeline.js";
6
3
  import { applyCdnResponseHeaders } from "./cache-control.js";
7
4
  import { normalizeDefaultLocalePathname } from "./pages-i18n.js";
8
5
  import { VINEXT_RSC_VARY_HEADER } from "./app-rsc-cache-busting.js";
9
6
  import { mergeVaryHeader } from "./middleware-response-headers.js";
10
7
  //#region src/server/app-rsc-response-finalizer.ts
8
+ const HAS_CONFIG_HEADERS = process.env.__VINEXT_HAS_CONFIG_HEADERS !== "false";
11
9
  /**
12
10
  * Apply App Router response finalization that must happen outside individual
13
11
  * route dispatchers.
@@ -20,7 +18,7 @@ import { mergeVaryHeader } from "./middleware-response-headers.js";
20
18
  * headers that throw on mutation, and Next.js does not apply config headers
21
19
  * to redirects regardless.
22
20
  */
23
- function finalizeAppRscResponse(response, request, options) {
21
+ async function finalizeAppRscResponse(response, request, options) {
24
22
  if (response.status >= 300 && response.status < 400) return response;
25
23
  if (!response.headers.has("x-vinext-static-file")) {
26
24
  const varyHeader = response.headers.get("Vary");
@@ -28,17 +26,13 @@ function finalizeAppRscResponse(response, request, options) {
28
26
  else if (varyHeader !== VINEXT_RSC_VARY_HEADER) mergeVaryHeader(response.headers, VINEXT_RSC_VARY_HEADER);
29
27
  }
30
28
  if (!response.headers.has("Cache-Control")) applyCdnResponseHeaders(response.headers, { cacheControl: "" });
31
- if (!options.configHeaders.length) return response;
29
+ if (!HAS_CONFIG_HEADERS || !options.configHeaders.length) return response;
32
30
  const url = new URL(request.url);
33
- let pathname;
34
- try {
35
- pathname = normalizePath(normalizePathnameForRouteMatch(url.pathname));
36
- } catch {
37
- pathname = url.pathname;
38
- }
31
+ let pathname = url.pathname;
39
32
  const hadBasePath = !options.basePath || hasBasePath(pathname, options.basePath);
40
33
  pathname = stripBasePath(pathname, options.basePath);
41
34
  const matchPathname = options.i18nConfig ? normalizeDefaultLocalePathname(pathname, options.i18nConfig, { hostname: url.hostname }) : pathname;
35
+ const { applyConfigHeadersToResponse } = await import("./config-headers.js");
42
36
  applyConfigHeadersToResponse(response.headers, {
43
37
  configHeaders: options.configHeaders,
44
38
  pathname: matchPathname,
@@ -33,9 +33,16 @@ type AppRscInterceptForMatching = {
33
33
  interceptLayouts: readonly unknown[];
34
34
  interceptLayoutSegments?: readonly (readonly string[])[];
35
35
  interceptBranchSegments?: readonly string[];
36
+ interceptLoadings?: readonly unknown[];
37
+ interceptLoadingTreePositions?: readonly number[];
38
+ interceptNotFoundBranchSegments?: readonly string[];
36
39
  __loadInterceptLayouts?: readonly (() => Promise<unknown>)[] | null;
40
+ __loadInterceptLoadings?: readonly (() => Promise<unknown>)[] | null;
37
41
  page: unknown;
38
42
  __pageLoader?: (() => Promise<unknown>) | null;
43
+ notFound?: unknown;
44
+ __loadNotFound?: (() => Promise<unknown>) | null;
45
+ notFoundTreePosition?: number | null;
39
46
  params: readonly string[];
40
47
  };
41
48
  type AppRscSlotForMatching = {
@@ -50,14 +57,23 @@ type AppRscSiblingInterceptForMatching = {
50
57
  interceptLayouts: readonly unknown[];
51
58
  interceptLayoutSegments?: readonly (readonly string[])[];
52
59
  interceptBranchSegments?: readonly string[];
60
+ interceptLoadings?: readonly unknown[];
61
+ interceptLoadingTreePositions?: readonly number[];
62
+ interceptNotFoundBranchSegments?: readonly string[];
53
63
  __loadInterceptLayouts?: readonly (() => Promise<unknown>)[] | null;
64
+ __loadInterceptLoadings?: readonly (() => Promise<unknown>)[] | null;
54
65
  page: unknown;
55
66
  __pageLoader?: (() => Promise<unknown>) | null;
67
+ notFound?: unknown;
68
+ __loadNotFound?: (() => Promise<unknown>) | null;
69
+ notFoundTreePosition?: number | null;
56
70
  params: readonly string[];
57
71
  };
58
72
  type AppRscRouteForMatching = {
73
+ __loadRouteHandler?: unknown;
59
74
  pattern: string;
60
75
  patternParts: string[];
76
+ routeHandler?: unknown;
61
77
  slots?: Record<string, AppRscSlotForMatching>;
62
78
  siblingIntercepts?: AppRscSiblingInterceptForMatching[];
63
79
  };
@@ -68,6 +84,8 @@ type AppRscInterceptMatch = AppRscInterceptLookupEntry & {
68
84
  type AppRscInterceptLoadState = {
69
85
  page: unknown;
70
86
  pageLoading: Promise<unknown> | null;
87
+ notFound: unknown;
88
+ notFoundLoading: Promise<unknown> | null;
71
89
  interceptLayoutsLoading: Promise<readonly unknown[]> | null;
72
90
  };
73
91
  type AppRscInterceptLookupEntry = {
@@ -81,9 +99,16 @@ type AppRscInterceptLookupEntry = {
81
99
  interceptLayouts: readonly unknown[];
82
100
  interceptLayoutSegments?: readonly (readonly string[])[];
83
101
  interceptBranchSegments?: readonly string[];
102
+ interceptLoadings?: readonly unknown[];
103
+ interceptLoadingTreePositions?: readonly number[];
104
+ interceptNotFoundBranchSegments?: readonly string[];
84
105
  __loadInterceptLayouts?: readonly (() => Promise<unknown>)[] | null;
106
+ __loadInterceptLoadings?: readonly (() => Promise<unknown>)[] | null;
85
107
  page: unknown;
86
108
  __pageLoader?: (() => Promise<unknown>) | null;
109
+ notFound: unknown;
110
+ __loadNotFound?: (() => Promise<unknown>) | null;
111
+ notFoundTreePosition?: number | null;
87
112
  __loadState: AppRscInterceptLoadState;
88
113
  params: readonly string[];
89
114
  slotId: string | null;
@@ -93,6 +118,10 @@ declare function createAppRscRouteMatcher<Route extends AppRscRouteForMatching>(
93
118
  route: Route;
94
119
  params: AppRscRouteParams;
95
120
  } | null;
121
+ matchRequestRoute(url: string): {
122
+ route: Route;
123
+ params: AppRscRouteParams;
124
+ } | null;
96
125
  findIntercept(pathname: string, sourcePathname?: string | null): AppRscInterceptMatch | null;
97
126
  };
98
127
  declare function matchAppRscRoutePattern(urlParts: string[], patternParts: string[]): AppRscRouteParams | null;