vinext 1.3.1 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +25 -22
  2. package/THIRD_PARTY_LICENSES.md +47 -0
  3. package/dist/_virtual/_rolldown/runtime.js +3 -2
  4. package/dist/build/prerender.js +4 -3
  5. package/dist/build/report.d.ts +0 -14
  6. package/dist/build/report.js +1 -51
  7. package/dist/check.js +4 -7
  8. package/dist/cli.js +3 -0
  9. package/dist/client/dev-error-overlay-store.d.ts +1 -0
  10. package/dist/client/dev-error-overlay.d.ts +2 -0
  11. package/dist/client/dev-error-overlay.js +20 -4
  12. package/dist/client/navigation-runtime.d.ts +13 -1
  13. package/dist/client/navigation-runtime.js +1 -1
  14. package/dist/config/config-matchers.js +2 -0
  15. package/dist/config/destination-params.d.ts +2 -1
  16. package/dist/config/destination-params.js +52 -2
  17. package/dist/config/next-config.d.ts +25 -0
  18. package/dist/config/next-config.js +82 -4
  19. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
  20. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
  21. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
  22. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
  23. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
  24. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
  25. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
  26. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
  27. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
  28. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
  29. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
  30. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
  31. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
  32. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
  33. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
  34. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
  35. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
  36. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
  37. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
  38. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
  39. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
  40. package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
  41. package/dist/entries/app-rsc-entry.js +17 -49
  42. package/dist/entries/app-rsc-manifest.js +3 -4
  43. package/dist/entries/app-ssr-entry.js +1 -0
  44. package/dist/entries/pages-server-entry.js +36 -9
  45. package/dist/index.js +112 -90
  46. package/dist/init-cloudflare.d.ts +1 -3
  47. package/dist/init-cloudflare.js +10 -48
  48. package/dist/init-platform.d.ts +2 -0
  49. package/dist/init-platform.js +4 -0
  50. package/dist/plugins/extensionless-dynamic-import.js +6 -2
  51. package/dist/plugins/next-intl-catalog.d.ts +12 -0
  52. package/dist/plugins/next-intl-catalog.js +85 -0
  53. package/dist/plugins/pages-node-externals.d.ts +1 -0
  54. package/dist/plugins/pages-node-externals.js +1 -1
  55. package/dist/plugins/strip-server-exports.js +2 -1
  56. package/dist/plugins/use-cache-callable.d.ts +1 -1
  57. package/dist/plugins/use-cache-callable.js +136 -94
  58. package/dist/routing/app-route-graph.d.ts +6 -0
  59. package/dist/routing/app-route-graph.js +9 -1
  60. package/dist/server/api-handler.js +21 -5
  61. package/dist/server/app-bfcache-identity.js +1 -1
  62. package/dist/server/app-browser-entry.js +86 -66
  63. package/dist/server/app-browser-history-controller.d.ts +5 -4
  64. package/dist/server/app-browser-history-controller.js +93 -15
  65. package/dist/server/app-browser-navigation-controller.d.ts +2 -2
  66. package/dist/server/app-browser-navigation-controller.js +1 -2
  67. package/dist/server/app-browser-rsc-redirect.js +7 -7
  68. package/dist/server/app-browser-server-action-client.d.ts +2 -0
  69. package/dist/server/app-browser-server-action-client.js +5 -4
  70. package/dist/server/app-browser-state.d.ts +2 -4
  71. package/dist/server/app-browser-state.js +9 -4
  72. package/dist/server/app-browser-supplemental-refresh.js +16 -1
  73. package/dist/server/app-browser-visible-commit.d.ts +1 -1
  74. package/dist/server/app-browser-visible-commit.js +4 -14
  75. package/dist/server/app-elements-wire.d.ts +6 -38
  76. package/dist/server/app-elements-wire.js +4 -41
  77. package/dist/server/app-elements.d.ts +2 -2
  78. package/dist/server/app-elements.js +2 -2
  79. package/dist/server/app-history-state.d.ts +2 -2
  80. package/dist/server/app-history-state.js +5 -2
  81. package/dist/server/app-mounted-layouts.d.ts +21 -0
  82. package/dist/server/app-mounted-layouts.js +67 -0
  83. package/dist/server/app-optimistic-routing.d.ts +19 -1
  84. package/dist/server/app-optimistic-routing.js +43 -4
  85. package/dist/server/app-page-boundary-render.js +10 -14
  86. package/dist/server/app-page-boundary.js +2 -2
  87. package/dist/server/app-page-cache-finalizer.d.ts +12 -1
  88. package/dist/server/app-page-cache-finalizer.js +70 -29
  89. package/dist/server/app-page-cache.d.ts +13 -1
  90. package/dist/server/app-page-cache.js +31 -9
  91. package/dist/server/app-page-dispatch.d.ts +5 -11
  92. package/dist/server/app-page-dispatch.js +84 -155
  93. package/dist/server/app-page-element-builder.d.ts +2 -2
  94. package/dist/server/app-page-element-builder.js +13 -12
  95. package/dist/server/app-page-execution.d.ts +17 -52
  96. package/dist/server/app-page-execution.js +102 -95
  97. package/dist/server/app-page-head.d.ts +13 -0
  98. package/dist/server/app-page-head.js +44 -16
  99. package/dist/server/app-page-http-access-fallback-metadata.d.ts +1 -0
  100. package/dist/server/app-page-http-access-fallback-metadata.js +2 -2
  101. package/dist/server/app-page-layout-gate.d.ts +35 -0
  102. package/dist/server/app-page-layout-gate.js +50 -0
  103. package/dist/server/app-page-params.d.ts +0 -1
  104. package/dist/server/app-page-params.js +1 -14
  105. package/dist/server/app-page-probe.d.ts +3 -21
  106. package/dist/server/app-page-probe.js +4 -37
  107. package/dist/server/app-page-render.d.ts +2 -13
  108. package/dist/server/app-page-render.js +103 -234
  109. package/dist/server/app-page-request.d.ts +1 -3
  110. package/dist/server/app-page-request.js +1 -1
  111. package/dist/server/app-page-response.js +3 -3
  112. package/dist/server/app-page-route-wiring.d.ts +13 -6
  113. package/dist/server/app-page-route-wiring.js +86 -63
  114. package/dist/server/app-page-rsc-render-status.d.ts +27 -1
  115. package/dist/server/app-page-rsc-render-status.js +121 -13
  116. package/dist/server/app-page-stream.d.ts +12 -8
  117. package/dist/server/app-page-stream.js +4 -3
  118. package/dist/server/app-pages-bridge.d.ts +4 -0
  119. package/dist/server/app-pages-bridge.js +7 -3
  120. package/dist/server/app-render-dependency.d.ts +11 -4
  121. package/dist/server/app-render-dependency.js +86 -38
  122. package/dist/server/app-request-stage-dispatch.js +1 -1
  123. package/dist/server/app-request-stage-independent-entry.js +1 -1
  124. package/dist/server/app-route-handler-cache.js +2 -2
  125. package/dist/server/app-route-handler-dispatch.js +14 -9
  126. package/dist/server/app-route-handler-execution.js +11 -5
  127. package/dist/server/app-route-handler-policy.d.ts +1 -1
  128. package/dist/server/app-route-handler-policy.js +3 -3
  129. package/dist/server/app-route-handler-response.js +1 -1
  130. package/dist/server/app-route-handler-runtime.d.ts +1 -1
  131. package/dist/server/app-route-handler-runtime.js +28 -11
  132. package/dist/server/app-router-entry.js +1 -1
  133. package/dist/server/app-rsc-cache-busting.d.ts +12 -12
  134. package/dist/server/app-rsc-cache-busting.js +31 -72
  135. package/dist/server/app-rsc-error-handler.d.ts +2 -1
  136. package/dist/server/app-rsc-error-handler.js +10 -2
  137. package/dist/server/app-rsc-errors.d.ts +8 -0
  138. package/dist/server/app-rsc-errors.js +11 -1
  139. package/dist/server/app-rsc-handler.d.ts +5 -5
  140. package/dist/server/app-rsc-handler.js +80 -83
  141. package/dist/server/app-rsc-request-normalization.d.ts +10 -16
  142. package/dist/server/app-rsc-request-normalization.js +12 -18
  143. package/dist/server/app-rsc-response-finalizer.js +2 -2
  144. package/dist/server/app-rsc-response-stage.js +9 -15
  145. package/dist/server/app-server-action-execution.d.ts +3 -1
  146. package/dist/server/app-server-action-execution.js +15 -8
  147. package/dist/server/app-ssr-entry.d.ts +8 -0
  148. package/dist/server/app-ssr-entry.js +22 -16
  149. package/dist/server/app-ssr-stream.js +1 -1
  150. package/dist/server/app-visited-response-cache.d.ts +36 -1
  151. package/dist/server/app-visited-response-cache.js +46 -5
  152. package/dist/server/app-worker-stages.d.ts +37 -6
  153. package/dist/server/app-worker-stages.js +81 -9
  154. package/dist/server/artifact-compatibility.d.ts +0 -1
  155. package/dist/server/artifact-compatibility.js +1 -10
  156. package/dist/server/bfcache-identity.d.ts +7 -0
  157. package/dist/server/bfcache-identity.js +10 -1
  158. package/dist/server/cache-proof.d.ts +1 -115
  159. package/dist/server/cache-proof.js +1 -544
  160. package/dist/server/cacheability-manifest.js +1 -2
  161. package/dist/server/cacheability-request.js +13 -8
  162. package/dist/server/dev-origin-check.d.ts +2 -1
  163. package/dist/server/dev-origin-check.js +2 -1
  164. package/dist/server/dev-server.js +6 -4
  165. package/dist/server/headers.d.ts +6 -3
  166. package/dist/server/headers.js +9 -5
  167. package/dist/server/image-optimization.d.ts +5 -0
  168. package/dist/server/image-optimization.js +6 -1
  169. package/dist/server/isr-cache.d.ts +8 -2
  170. package/dist/server/isr-cache.js +30 -2
  171. package/dist/server/metadata-route-response.js +32 -15
  172. package/dist/server/middleware-matcher.js +19 -6
  173. package/dist/server/middleware-runtime.js +6 -2
  174. package/dist/server/multi-stage.d.ts +57 -12
  175. package/dist/server/multi-stage.js +13 -1
  176. package/dist/server/navigation-planner.js +1 -1
  177. package/dist/server/pages-api-route.js +28 -19
  178. package/dist/server/pages-media-type.d.ts +21 -1
  179. package/dist/server/pages-media-type.js +69 -5
  180. package/dist/server/pages-node-compat.d.ts +1 -1
  181. package/dist/server/pages-node-compat.js +54 -27
  182. package/dist/server/pages-page-data.js +2 -1
  183. package/dist/server/pages-page-handler.js +28 -26
  184. package/dist/server/pages-page-response.d.ts +9 -0
  185. package/dist/server/pages-page-response.js +18 -4
  186. package/dist/server/pages-request-pipeline.d.ts +8 -0
  187. package/dist/server/pages-request-pipeline.js +2 -2
  188. package/dist/server/pages-request-stage-entry.js +36 -14
  189. package/dist/server/pages-response-stage-entry.js +9 -3
  190. package/dist/server/pages-router-entry.js +3 -2
  191. package/dist/server/prod-server.d.ts +2 -2
  192. package/dist/server/prod-server.js +47 -9
  193. package/dist/server/request-error-log.d.ts +9 -0
  194. package/dist/server/request-error-log.js +13 -0
  195. package/dist/server/request-pipeline.d.ts +15 -4
  196. package/dist/server/request-pipeline.js +43 -15
  197. package/dist/server/rsc-completion-metadata.js +3 -0
  198. package/dist/server/shared-cache-identity.d.ts +23 -0
  199. package/dist/server/shared-cache-identity.js +36 -0
  200. package/dist/server/static-file-cache.d.ts +9 -0
  201. package/dist/server/static-file-cache.js +13 -2
  202. package/dist/server/worker-stages.d.ts +16 -3
  203. package/dist/server/worker-stages.js +23 -4
  204. package/dist/shims/cache-handler.js +2 -2
  205. package/dist/shims/cache-request-state.d.ts +23 -26
  206. package/dist/shims/cache-request-state.js +22 -57
  207. package/dist/shims/cache-runtime.d.ts +3 -1
  208. package/dist/shims/cache-runtime.js +94 -48
  209. package/dist/shims/cache.d.ts +16 -10
  210. package/dist/shims/cache.js +47 -36
  211. package/dist/shims/cacheability-classification.d.ts +2 -0
  212. package/dist/shims/cdn-cache.d.ts +22 -5
  213. package/dist/shims/client-hook-error.d.ts +2 -0
  214. package/dist/shims/client-hook-error.js +16 -1
  215. package/dist/shims/client-page-root.js +2 -2
  216. package/dist/shims/dynamic.js +9 -6
  217. package/dist/shims/error-boundary.js +2 -2
  218. package/dist/shims/fetch-cache-state.d.ts +5 -1
  219. package/dist/shims/fetch-cache-state.js +1 -3
  220. package/dist/shims/fetch-cache.d.ts +2 -1
  221. package/dist/shims/fetch-cache.js +39 -25
  222. package/dist/shims/form.js +2 -2
  223. package/dist/shims/headers.d.ts +10 -24
  224. package/dist/shims/headers.js +22 -70
  225. package/dist/shims/internal/cache-context-accessor.d.ts +1 -1
  226. package/dist/shims/internal/navigation-untracked.js +1 -1
  227. package/dist/shims/link.js +8 -11
  228. package/dist/shims/metadata.d.ts +23 -21
  229. package/dist/shims/metadata.js +62 -24
  230. package/dist/shims/navigation-server.js +1 -1
  231. package/dist/shims/navigation.d.ts +74 -7
  232. package/dist/shims/navigation.js +184 -31
  233. package/dist/shims/navigation.react-server.js +2 -2
  234. package/dist/shims/request-state-types.d.ts +3 -2
  235. package/dist/shims/slot.d.ts +16 -0
  236. package/dist/shims/slot.js +44 -9
  237. package/dist/shims/unified-request-context.d.ts +7 -1
  238. package/dist/shims/unified-request-context.js +3 -3
  239. package/dist/utils/cache-control-metadata.d.ts +5 -0
  240. package/dist/utils/cache-control-metadata.js +9 -1
  241. package/dist/utils/cache-life-profiles.d.ts +33 -0
  242. package/dist/utils/cache-life-profiles.js +111 -0
  243. package/dist/utils/middleware-request-headers.d.ts +14 -3
  244. package/dist/utils/middleware-request-headers.js +54 -7
  245. package/dist/utils/project.d.ts +2 -2
  246. package/dist/utils/project.js +3 -16
  247. package/dist/utils/regex.d.ts +5 -0
  248. package/dist/utils/regex.js +11 -1
  249. package/dist/utils/text-stream.d.ts +10 -5
  250. package/dist/utils/text-stream.js +6 -6
  251. package/package.json +2 -1
  252. package/dist/build/layout-classification-types.d.ts +0 -60
  253. package/dist/build/layout-classification-types.js +0 -1
  254. package/dist/build/layout-classification.d.ts +0 -62
  255. package/dist/build/layout-classification.js +0 -98
  256. package/dist/build/route-classification-injector.d.ts +0 -33
  257. package/dist/build/route-classification-injector.js +0 -59
  258. package/dist/build/route-classification-manifest.d.ts +0 -54
  259. package/dist/build/route-classification-manifest.js +0 -143
  260. package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -11
  261. package/dist/server/app-browser-client-reuse-manifest.js +0 -101
  262. package/dist/server/app-layout-param-observation.d.ts +0 -42
  263. package/dist/server/app-layout-param-observation.js +0 -168
  264. package/dist/server/client-reuse-manifest.d.ts +0 -103
  265. package/dist/server/client-reuse-manifest.js +0 -209
  266. package/dist/server/skip-cache-proof.d.ts +0 -60
  267. package/dist/server/skip-cache-proof.js +0 -168
  268. package/dist/server/static-layout-client-reuse-proof.d.ts +0 -14
  269. package/dist/server/static-layout-client-reuse-proof.js +0 -33
  270. package/dist/utils/sorted-array.d.ts +0 -8
  271. package/dist/utils/sorted-array.js +0 -20
@@ -1,30 +1,102 @@
1
1
  import { VINEXT_RSC_VARY_HEADER } from "./app-rsc-vary.js";
2
+ import { APP_RSC_RENDER_MODE_NAVIGATION } from "./app-rsc-render-mode.js";
2
3
  import { cacheabilityManifestPageState, cacheabilityRequestIdentity, cacheabilityRoutePathname } from "./cacheability-manifest.js";
3
4
  import { keepOnlyValidatedRscCacheBustingSearchParam } from "./app-rsc-cache-busting.js";
4
5
  import { isTrustedPrerenderState } from "./prerender-route-params.js";
6
+ import { VINEXT_CACHE_IDENTITY_ORIGIN, withCacheIdentityOrigin } from "./multi-stage.js";
5
7
  //#region src/server/app-worker-stages.ts
6
- const APP_WORKER_RESPONSE_STAGE_PROTOCOL_VERSION = 11;
8
+ const APP_WORKER_RESPONSE_STAGE_PROTOCOL_VERSION = 13;
7
9
  const APP_METADATA_RESPONSE_STAGE_NO_MATCH_HEADER = "x-vinext-app-metadata-stage-no-match";
8
10
  const STATIC_FILE_SIGNAL_TOKEN_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
9
11
  /** Normalize a shared App page HEAD request onto its method-invariant GET representation. */
10
12
  function prepareSharedAppPageDispatch(request, cache) {
11
13
  return cache !== "bypass" && request.method.toUpperCase() === "HEAD" ? new Request(request, { method: "GET" }) : request;
12
14
  }
15
+ function sharedAppCacheIdentity(requestUrl, init, props) {
16
+ return {
17
+ props: {
18
+ ...props,
19
+ requestOrigin: VINEXT_CACHE_IDENTITY_ORIGIN
20
+ },
21
+ request: new Request(withCacheIdentityOrigin(requestUrl), init)
22
+ };
23
+ }
24
+ /**
25
+ * Build the cache identity of a shared App Router dispatch: the dispatched
26
+ * request and props under the cache identity origin.
27
+ */
28
+ function createSharedAppCacheIdentity(request, props) {
29
+ return sharedAppCacheIdentity(request.url, {
30
+ headers: new Headers(request.headers),
31
+ method: request.method
32
+ }, props);
33
+ }
13
34
  /**
14
35
  * Build the query-free cache identity of a shared App page dispatch. The user
15
- * query leaves both the URL and `resolvedUrl`; the `.rsc` suffix, an RSC
16
- * request's validated `_rsc`, and the render mode stay because they select the
17
- * representation. HTML identities also drop the RSC selector headers.
36
+ * query leaves both the URL and `resolvedUrl`; an RSC request's validated
37
+ * `_rsc` and the render mode stay because they select the representation. HTML identities also drop the RSC selector headers.
18
38
  */
19
39
  function createSharedAppPageCacheIdentity(request, props) {
20
40
  const queryFree = withoutAppPageDispatchQuery(request.url, props);
21
41
  const headers = new Headers(request.headers);
22
42
  if (!props.isRscRequest) for (const name of VINEXT_RSC_VARY_HEADER.split(",")) headers.delete(name.trim());
23
43
  return {
24
- props: queryFree.props,
25
- request: new Request(queryFree.url, {
44
+ ...sharedAppCacheIdentity(queryFree.url, {
26
45
  headers,
27
46
  method: request.method
47
+ }, queryFree.props),
48
+ queryFree: true
49
+ };
50
+ }
51
+ /**
52
+ * Build the query-free cache identity of a shared Route Handler or metadata
53
+ * route dispatch. Next.js keys a route handler by its pathname: the query and
54
+ * the RSC selectors pick no representation of a handler's response, and a
55
+ * handler that reads the request's URL or headers is dynamic, so admission
56
+ * refuses its response. Keeping them in the identity would only let a client
57
+ * store one entry per query or selector value. The method, path and route
58
+ * props stay; the selector headers and the props derived from them leave.
59
+ */
60
+ function createSharedAppRouteCacheIdentity(request, props) {
61
+ const url = new URL(request.url);
62
+ url.search = "";
63
+ const headers = new Headers(request.headers);
64
+ for (const name of VINEXT_RSC_VARY_HEADER.split(",")) headers.delete(name.trim());
65
+ const searchIndex = props.resolvedUrl.indexOf("?");
66
+ return {
67
+ ...sharedAppCacheIdentity(url.toString(), {
68
+ headers,
69
+ method: request.method
70
+ }, {
71
+ ...props,
72
+ ...props.kind === "app-metadata" ? {} : {
73
+ interceptionContext: null,
74
+ interceptionId: null
75
+ },
76
+ isRscRequest: false,
77
+ mountedSlotsHeader: null,
78
+ renderMode: APP_RSC_RENDER_MODE_NAVIGATION,
79
+ resolvedUrl: searchIndex === -1 ? props.resolvedUrl : props.resolvedUrl.slice(0, searchIndex)
80
+ }),
81
+ queryFree: true
82
+ };
83
+ }
84
+ /**
85
+ * Build the cache identity of a shared hybrid Pages page dispatch: the
86
+ * dispatched request and props under `origin`, so every host that names it
87
+ * shares one entry.
88
+ */
89
+ function createSharedHybridPagesCacheIdentity(request, props, origin) {
90
+ return {
91
+ props: {
92
+ ...props,
93
+ requestOrigin: origin,
94
+ requestUrl: withCacheIdentityOrigin(props.requestUrl, origin)
95
+ },
96
+ regenerateFromDispatch: true,
97
+ request: new Request(withCacheIdentityOrigin(request.url, origin), {
98
+ headers: new Headers(request.headers),
99
+ method: request.method
28
100
  })
29
101
  };
30
102
  }
@@ -80,12 +152,12 @@ function isCanonicalHttpOrigin(value) {
80
152
  function isAppWorkerResponseStageProps(value) {
81
153
  if (!value || typeof value !== "object") return false;
82
154
  const props = value;
83
- if (props.protocolVersion !== 11 || props.buildId !== null && typeof props.buildId !== "string" || !isResponseStageCacheability(props.cacheability) || props.draftModeCookie !== null && typeof props.draftModeCookie !== "string" || props.middlewareCookieOverlay !== null && typeof props.middlewareCookieOverlay !== "string" || !isCanonicalHttpOrigin(props.requestOrigin) || props.scriptNonce !== null && typeof props.scriptNonce !== "string") return false;
155
+ if (props.protocolVersion !== 13 || props.buildId !== null && typeof props.buildId !== "string" || !isResponseStageCacheability(props.cacheability) || props.draftModeCookie !== null && typeof props.draftModeCookie !== "string" || props.middlewareCookieOverlay !== null && typeof props.middlewareCookieOverlay !== "string" || !isCanonicalHttpOrigin(props.requestOrigin) || props.scriptNonce !== null && typeof props.scriptNonce !== "string") return false;
84
156
  if (props.kind === "app-full-request") return typeof props.headRequest === "boolean" && typeof props.prerenderDiscovery === "boolean" && typeof props.staticFileSignalToken === "string" && STATIC_FILE_SIGNAL_TOKEN_RE.test(props.staticFileSignalToken) && (props.trustedPrerenderState === null || isTrustedPrerenderState(props.trustedPrerenderState));
85
157
  if (props.kind === "hybrid-pages") {
86
158
  const hybrid = props;
87
159
  const appRouteMatch = hybrid.appRouteMatch;
88
- return typeof hybrid.allowRscDocumentFallback === "boolean" && (appRouteMatch === null || typeof appRouteMatch === "object" && typeof appRouteMatch.isDynamic === "boolean" && typeof appRouteMatch.pattern === "string" && appRouteMatch.pattern.startsWith("/")) && typeof hybrid.canonicalPathname === "string" && hybrid.canonicalPathname.startsWith("/") && typeof hybrid.cleanPathname === "string" && hybrid.cleanPathname.startsWith("/") && typeof hybrid.isDataRequest === "boolean" && typeof hybrid.isRscRequest === "boolean" && (hybrid.matchKind === "dynamic" || hybrid.matchKind === "static") && (hybrid.preHandlerHeaders === null || isSerializedHeaders(hybrid.preHandlerHeaders)) && (hybrid.resourceKind === "api" || hybrid.resourceKind === "page") && typeof hybrid.requestUrl === "string" && typeof hybrid.resolvedUrl === "string" && hybrid.resolvedUrl.startsWith("/");
160
+ return typeof hybrid.allowRscDocumentFallback === "boolean" && (appRouteMatch === null || typeof appRouteMatch === "object" && typeof appRouteMatch.isDynamic === "boolean" && typeof appRouteMatch.pattern === "string" && appRouteMatch.pattern.startsWith("/")) && typeof hybrid.canonicalPathname === "string" && hybrid.canonicalPathname.startsWith("/") && typeof hybrid.cleanPathname === "string" && hybrid.cleanPathname.startsWith("/") && typeof hybrid.isDataRequest === "boolean" && typeof hybrid.isRscRequest === "boolean" && (hybrid.matchKind === "dynamic" || hybrid.matchKind === "static") && (hybrid.preHandlerHeaders === null || isSerializedHeaders(hybrid.preHandlerHeaders)) && (hybrid.resourceKind === "api" || hybrid.resourceKind === "page") && typeof hybrid.requestUrl === "string" && typeof hybrid.resolvedUrl === "string" && hybrid.resolvedUrl.startsWith("/") && typeof hybrid.sharedAcrossHosts === "boolean";
89
161
  }
90
162
  if (props.kind === "app-metadata" || props.kind === "app-not-found") {
91
163
  const special = props;
@@ -102,4 +174,4 @@ function isResponseStageCacheability(value) {
102
174
  return (cacheability.probeMode === null || cacheability.probeMode === "probe" || cacheability.probeMode === "identity") && (cacheability.policyHeaders === null || Array.isArray(cacheability.policyHeaders) && cacheability.policyHeaders.every((entry) => Array.isArray(entry) && entry.length === 2 && typeof entry[0] === "string" && typeof entry[1] === "string")) && (cacheability.representation === void 0 || cacheability.representation === "app-route" || cacheability.representation === "html" || cacheability.representation === "pages-data" || cacheability.representation === "rsc-full" || cacheability.representation === "rsc-loading-shell") && typeof cacheability.resolvedRoutePathname === "string" && cacheability.resolvedRoutePathname.startsWith("/");
103
175
  }
104
176
  //#endregion
105
- export { APP_METADATA_RESPONSE_STAGE_NO_MATCH_HEADER, APP_WORKER_RESPONSE_STAGE_PROTOCOL_VERSION, createSharedAppPageCacheIdentity, isAppWorkerResponseStageProps, isStaticCandidateAppPageDispatch, prepareSharedAppPageDispatch, withoutAppPageDispatchQuery };
177
+ export { APP_METADATA_RESPONSE_STAGE_NO_MATCH_HEADER, APP_WORKER_RESPONSE_STAGE_PROTOCOL_VERSION, createSharedAppCacheIdentity, createSharedAppPageCacheIdentity, createSharedAppRouteCacheIdentity, createSharedHybridPagesCacheIdentity, isAppWorkerResponseStageProps, isStaticCandidateAppPageDispatch, prepareSharedAppPageDispatch, withoutAppPageDispatchQuery };
@@ -11,7 +11,6 @@ export type ArtifactCompatibilityEnvelope = Readonly<{
11
11
  rootBoundaryId: string | null;
12
12
  renderEpoch: string | null;
13
13
  }>;
14
- export declare const ARTIFACT_COMPATIBILITY_PROOF_FIELDS: readonly (keyof ArtifactCompatibilityEnvelope)[];
15
14
  type ArtifactCompatibilityEnvelopeInput = Readonly<{
16
15
  graphVersion?: string | null;
17
16
  deploymentVersion?: string | null;
@@ -4,15 +4,6 @@ import { fnv1a64 } from "../utils/hash.js";
4
4
  const ARTIFACT_COMPATIBILITY_SCHEMA_VERSION = 1;
5
5
  const APP_ELEMENTS_SCHEMA_VERSION = 1;
6
6
  const RSC_PAYLOAD_SCHEMA_VERSION = 1;
7
- const ARTIFACT_COMPATIBILITY_PROOF_FIELDS = [
8
- "schemaVersion",
9
- "graphVersion",
10
- "deploymentVersion",
11
- "appElementsSchemaVersion",
12
- "rscPayloadSchemaVersion",
13
- "rootBoundaryId",
14
- "renderEpoch"
15
- ];
16
7
  function createArtifactCompatibilityEnvelope(input = {}) {
17
8
  return {
18
9
  schemaVersion: 1,
@@ -88,4 +79,4 @@ function evaluateArtifactCompatibility(current, candidate, options = {}) {
88
79
  return { kind: "compatible" };
89
80
  }
90
81
  //#endregion
91
- export { APP_ELEMENTS_SCHEMA_VERSION, ARTIFACT_COMPATIBILITY_PROOF_FIELDS, ARTIFACT_COMPATIBILITY_SCHEMA_VERSION, RSC_PAYLOAD_SCHEMA_VERSION, createArtifactCompatibilityEnvelope, createArtifactCompatibilityGraphVersion, evaluateArtifactCompatibility, parseArtifactCompatibilityEnvelope };
82
+ export { APP_ELEMENTS_SCHEMA_VERSION, ARTIFACT_COMPATIBILITY_SCHEMA_VERSION, RSC_PAYLOAD_SCHEMA_VERSION, createArtifactCompatibilityEnvelope, createArtifactCompatibilityGraphVersion, evaluateArtifactCompatibility, parseArtifactCompatibilityEnvelope };
@@ -3,6 +3,13 @@ type ParallelSlotBindingState = "active" | "default" | "unmatched";
3
3
  export declare function createNestedBfcacheSlotSegmentId(parentSlotId: string, level: number): string;
4
4
  export declare function isNestedBfcacheSlotSegmentId(id: string): boolean;
5
5
  export declare function isNestedBfcacheSlotSegmentIdFor(id: string, parentSlotId: string): boolean;
6
+ /**
7
+ * Activity key for a route segment whose directory has no layout of its own.
8
+ * Next.js keeps a layout-router Activity list at every segment level, implicit
9
+ * layouts included, keyed by the child segment. The tag keeps these keys apart
10
+ * from identity strings, whose kinds never use it, and from BFCache ids.
11
+ */
12
+ export declare function createBfcacheChildSegmentStateKey(segmentPathKey: string): string;
6
13
  export type BfcacheSegmentIdentity = string;
7
14
  export type BfcacheSegmentDescriptor = {
8
15
  kind: "page";
@@ -13,6 +13,15 @@ function isNestedBfcacheSlotSegmentId(id) {
13
13
  function isNestedBfcacheSlotSegmentIdFor(id, parentSlotId) {
14
14
  return isNestedBfcacheSlotSegmentId(id) && id.startsWith(createNestedBfcacheSlotParentPrefix(parentSlotId));
15
15
  }
16
+ /**
17
+ * Activity key for a route segment whose directory has no layout of its own.
18
+ * Next.js keeps a layout-router Activity list at every segment level, implicit
19
+ * layouts included, keyed by the child segment. The tag keeps these keys apart
20
+ * from identity strings, whose kinds never use it, and from BFCache ids.
21
+ */
22
+ function createBfcacheChildSegmentStateKey(segmentPathKey) {
23
+ return JSON.stringify(["segment", segmentPathKey]);
24
+ }
16
25
  function deriveBfcacheSegmentIdentity(descriptor) {
17
26
  switch (descriptor.kind) {
18
27
  case "page":
@@ -49,4 +58,4 @@ function deriveBfcacheSegmentIdentity(descriptor) {
49
58
  }
50
59
  }
51
60
  //#endregion
52
- export { createNestedBfcacheSlotSegmentId, deriveBfcacheSegmentIdentity, isNestedBfcacheSlotSegmentId, isNestedBfcacheSlotSegmentIdFor };
61
+ export { createBfcacheChildSegmentStateKey, createNestedBfcacheSlotSegmentId, deriveBfcacheSegmentIdentity, isNestedBfcacheSlotSegmentId, isNestedBfcacheSlotSegmentIdFor };
@@ -1,5 +1,4 @@
1
- import { AppRouteSemanticIds } from "../routing/app-route-graph.js";
2
- import { ArtifactCompatibilityEnvelope, ArtifactCompatibilityEvaluationOptions } from "./artifact-compatibility.js";
1
+ import { ArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
3
2
  //#region src/server/cache-proof.d.ts
4
3
  export declare const CACHE_PROOF_MODEL_SCHEMA_VERSION = 1;
5
4
  export type CacheProofModelSchemaVersion = 1;
@@ -25,22 +24,8 @@ export type CacheVariantBudget = Readonly<{
25
24
  maxValuesPerDimension: number;
26
25
  maxVariantsPerRoute: number;
27
26
  }>;
28
- export declare const DEFAULT_CACHE_VARIANT_BUDGET: {
29
- maxDimensionCount: number;
30
- maxDimensionNameLength: number;
31
- maxDimensionValueLength: number;
32
- maxEncodedLength: number;
33
- maxValuesPerDimension: number;
34
- maxVariantsPerRoute: number;
35
- };
36
27
  export type CacheVariantDimensionSource = "auth" | "cookie" | "custom" | "draft-mode" | "header" | "interception" | "mounted-slots" | "params" | "route" | "search" | "session";
37
28
  export type CacheVariantDimensionPrivacy = "internal" | "private" | "public";
38
- export type CacheVariantDimensionInput = Readonly<{
39
- name: string;
40
- privacy: CacheVariantDimensionPrivacy;
41
- source: CacheVariantDimensionSource;
42
- values: readonly string[];
43
- }>;
44
29
  export type CacheVariantDimension = Readonly<{
45
30
  encoded: string;
46
31
  name: string;
@@ -96,47 +81,6 @@ export type CacheVariant = Readonly<{
96
81
  output: CacheProofOutputScope;
97
82
  schemaVersion: CacheProofModelSchemaVersion;
98
83
  }>;
99
- export type BuildCacheVariantInput = Readonly<{
100
- budget: CacheVariantBudget;
101
- dimensions: readonly CacheVariantDimensionInput[];
102
- output: CacheProofOutputScope;
103
- }>;
104
- export type BuildCacheVariantResult = Readonly<{
105
- kind: "variant";
106
- variant: CacheVariant;
107
- }> | Readonly<{
108
- kind: "breakerFallback";
109
- fallback: CacheProofBreakerFallback;
110
- }>;
111
- export type CacheVariantRouteBudget = Readonly<{
112
- routeId: string;
113
- variantCacheKeys: readonly string[];
114
- }>;
115
- export type CacheVariantRouteBudgetAdmission = Readonly<{
116
- didConsumeRouteVariantBudget: boolean;
117
- kind: "variant";
118
- routeBudget: CacheVariantRouteBudget;
119
- variant: CacheVariant;
120
- }> | Readonly<{
121
- fallback: CacheProofBreakerFallback;
122
- kind: "breakerFallback";
123
- routeBudget: CacheVariantRouteBudget | null;
124
- }>;
125
- export type BuildCacheVariantWithRouteBudgetInput = BuildCacheVariantInput & Readonly<{
126
- routeBudget: CacheVariantRouteBudget | null;
127
- }>;
128
- export type BuildCacheVariantWithRouteBudgetResult = CacheVariantRouteBudgetAdmission;
129
- export type AppRouteCacheProofGraphScopeInput = Readonly<{
130
- ids: AppRouteSemanticIds;
131
- }>;
132
- export type AppRouteCacheProofGraphScope = Readonly<{
133
- layoutIds: readonly string[];
134
- pageId: string | null;
135
- routeHandlerId: string | null;
136
- routeId: string;
137
- slotIds: readonly string[];
138
- templateIds: readonly string[];
139
- }>;
140
84
  export type BoundaryOutcome = Readonly<{
141
85
  kind: "error";
142
86
  digest?: string;
@@ -158,16 +102,6 @@ export type BoundaryOutcome = Readonly<{
158
102
  }> | Readonly<{
159
103
  kind: "unknown";
160
104
  }>;
161
- export type BoundaryOutcomeCompatibility = Readonly<{
162
- kind: "compatible";
163
- outcome: BoundaryOutcome;
164
- reason: "CP_BOUNDARY_OUTCOME_MATCH";
165
- }> | Readonly<{
166
- candidate: BoundaryOutcome;
167
- expected: BoundaryOutcome;
168
- fallback: CacheProofBreakerFallback;
169
- kind: "incompatible";
170
- }>;
171
105
  export type RenderObservationCompleteness = "complete" | "partial" | "unknown";
172
106
  export type RenderCacheability = "private" | "public" | "uncacheable" | "unknown";
173
107
  export type RenderRequestApiKind = "connection" | "cookies" | "draftMode" | "headers" | "params" | "searchParams";
@@ -233,7 +167,6 @@ export type ClassifyRenderObservationDowngradeInput = Readonly<{
233
167
  dynamicFetches: readonly string[];
234
168
  requestApis: readonly RenderRequestApiObservation[];
235
169
  }>;
236
- export type ClassifyCacheVariantDimensionDowngradeInput = Pick<CacheVariantDimensionInput, "source">;
237
170
  export type RenderObservation = Readonly<{
238
171
  boundaryOutcome: BoundaryOutcome;
239
172
  cacheTags: readonly string[];
@@ -260,18 +193,6 @@ export type StaticLayoutReuseProof = Readonly<{
260
193
  export type StaticLayoutArtifactReuseProof = StaticLayoutReuseProof & Readonly<{
261
194
  candidateArtifactCompatibility: ArtifactCompatibilityEnvelope;
262
195
  }>;
263
- export type BuildStaticLayoutReuseProofInput = Readonly<{
264
- candidateObservation: RenderObservation;
265
- candidateVariant: CacheVariant;
266
- currentOutput: CacheProofOutputScope;
267
- }>;
268
- export type BuildStaticLayoutReuseProofResult = Readonly<{
269
- kind: "proof";
270
- proof: StaticLayoutReuseProof;
271
- }> | Readonly<{
272
- kind: "rejected";
273
- fallback: CacheProofBreakerFallback;
274
- }>;
275
196
  export type CacheProofHotPathMetric = Readonly<{
276
197
  code: CacheProofTraceCode;
277
198
  fields: CacheProofTraceFields;
@@ -305,13 +226,6 @@ export type CacheEntryReuseProof = Readonly<{
305
226
  decision: CacheEntryReuseDecision | null;
306
227
  kind: "runtime-cache-entry";
307
228
  }>;
308
- export type CreateStaticLayoutArtifactReuseDecisionInput = Readonly<{
309
- candidateArtifactCompatibility: ArtifactCompatibilityEnvelope;
310
- candidateObservation: RenderObservation;
311
- candidateVariant: BuildCacheVariantWithRouteBudgetResult;
312
- currentArtifactCompatibility: ArtifactCompatibilityEnvelope;
313
- currentOutput: CacheProofOutputScope;
314
- }> & ArtifactCompatibilityEvaluationOptions;
315
229
  export type BuildRenderObservationInput = Readonly<{
316
230
  boundaryOutcome: BoundaryOutcome;
317
231
  cacheTags: readonly string[];
@@ -326,31 +240,6 @@ export type BuildRenderRequestApiObservationsInput = Readonly<{
326
240
  completeness: RenderObservationCompleteness;
327
241
  observed: readonly RenderRequestApiKind[];
328
242
  }>;
329
- export type DisabledCacheProofDecision = Readonly<{
330
- canReuse: false;
331
- fallback: CacheProofBreakerFallback;
332
- kind: "disabled";
333
- observation: RenderObservation;
334
- staticLayoutProof?: StaticLayoutReuseProof;
335
- variant: CacheVariant;
336
- }>;
337
- export type CreateDisabledCacheProofDecisionInput = Readonly<{
338
- observation: RenderObservation;
339
- staticLayoutProof?: StaticLayoutReuseProof;
340
- variant: CacheVariant;
341
- }>;
342
- export declare function createAppRouteCacheProofGraphScope(route: AppRouteCacheProofGraphScopeInput): AppRouteCacheProofGraphScope;
343
- export declare function buildCacheVariant(input: BuildCacheVariantInput): BuildCacheVariantResult;
344
- export declare function enforceCacheVariantRouteBudget(input: {
345
- routeBudget: CacheVariantRouteBudget | null;
346
- variant: CacheVariant;
347
- }): CacheVariantRouteBudgetAdmission;
348
- export declare function buildCacheVariantWithRouteBudget(input: BuildCacheVariantWithRouteBudgetInput): BuildCacheVariantWithRouteBudgetResult;
349
- export declare function buildBoundaryOutcomeCompatibility(input: {
350
- candidate: BoundaryOutcome;
351
- expected: BoundaryOutcome;
352
- }): BoundaryOutcomeCompatibility;
353
- export declare function classifyCacheVariantDimensionDowngrade(input: ClassifyCacheVariantDimensionDowngradeInput): CacheProofDowngradeReason | null;
354
243
  export declare function classifyRenderObservationDowngrade(input: ClassifyRenderObservationDowngradeInput): CacheProofDowngradeClassification;
355
244
  export declare function buildRenderRequestApiObservations(input: BuildRenderRequestApiObservationsInput): RenderRequestApiObservation[];
356
245
  export declare function buildRenderObservation(input: BuildRenderObservationInput): RenderObservation;
@@ -361,8 +250,5 @@ export declare function hasCompleteNegativeRequestApiProof(observation: RenderOb
361
250
  * entries with this proof.
362
251
  */
363
252
  export declare function hasQueryInvariantRenderProof(observation: RenderObservation | undefined): boolean;
364
- export declare function buildStaticLayoutReuseProof(input: BuildStaticLayoutReuseProofInput): BuildStaticLayoutReuseProofResult;
365
- export declare function createStaticLayoutArtifactReuseDecision(input: CreateStaticLayoutArtifactReuseDecisionInput): StaticLayoutArtifactReuseDecision;
366
253
  export declare function createCacheEntryReuseProof(decision: StaticLayoutArtifactReuseDecision | null): CacheEntryReuseProof;
367
- export declare function createDisabledCacheProofDecision(input: CreateDisabledCacheProofDecisionInput): DisabledCacheProofDecision;
368
254
  //#endregion