vinext 1.3.1 → 1.4.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 (234) hide show
  1. package/README.md +5 -2
  2. package/THIRD_PARTY_LICENSES.md +47 -0
  3. package/dist/_virtual/_rolldown/runtime.js +3 -2
  4. package/dist/build/prerender.js +1 -1
  5. package/dist/build/report.d.ts +0 -14
  6. package/dist/build/report.js +1 -51
  7. package/dist/check.js +1 -1
  8. package/dist/cli.js +3 -0
  9. package/dist/client/dev-error-overlay.js +1 -1
  10. package/dist/client/navigation-runtime.d.ts +13 -1
  11. package/dist/client/navigation-runtime.js +1 -1
  12. package/dist/config/next-config.d.ts +19 -0
  13. package/dist/config/next-config.js +64 -1
  14. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
  15. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
  16. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
  17. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
  18. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
  19. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
  20. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
  21. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
  22. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
  23. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
  24. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
  25. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
  26. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
  27. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
  28. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
  29. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
  30. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
  31. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
  32. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
  33. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
  34. package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
  35. package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
  36. package/dist/entries/app-rsc-entry.js +17 -48
  37. package/dist/entries/app-rsc-manifest.js +3 -4
  38. package/dist/entries/app-ssr-entry.js +1 -0
  39. package/dist/entries/pages-server-entry.js +33 -8
  40. package/dist/index.js +83 -70
  41. package/dist/init-cloudflare.d.ts +1 -3
  42. package/dist/init-cloudflare.js +10 -48
  43. package/dist/init-platform.d.ts +2 -0
  44. package/dist/init-platform.js +4 -0
  45. package/dist/plugins/extensionless-dynamic-import.js +6 -2
  46. package/dist/plugins/next-intl-catalog.d.ts +12 -0
  47. package/dist/plugins/next-intl-catalog.js +85 -0
  48. package/dist/plugins/pages-node-externals.d.ts +1 -0
  49. package/dist/plugins/pages-node-externals.js +1 -1
  50. package/dist/plugins/use-cache-callable.d.ts +1 -1
  51. package/dist/plugins/use-cache-callable.js +136 -94
  52. package/dist/routing/app-route-graph.d.ts +6 -0
  53. package/dist/routing/app-route-graph.js +9 -1
  54. package/dist/server/api-handler.js +19 -4
  55. package/dist/server/app-bfcache-identity.js +1 -1
  56. package/dist/server/app-browser-entry.js +79 -63
  57. package/dist/server/app-browser-history-controller.d.ts +5 -4
  58. package/dist/server/app-browser-history-controller.js +93 -15
  59. package/dist/server/app-browser-navigation-controller.d.ts +2 -2
  60. package/dist/server/app-browser-navigation-controller.js +1 -2
  61. package/dist/server/app-browser-rsc-redirect.js +4 -4
  62. package/dist/server/app-browser-server-action-client.d.ts +2 -0
  63. package/dist/server/app-browser-server-action-client.js +4 -3
  64. package/dist/server/app-browser-state.d.ts +2 -4
  65. package/dist/server/app-browser-state.js +9 -4
  66. package/dist/server/app-browser-supplemental-refresh.js +16 -1
  67. package/dist/server/app-browser-visible-commit.d.ts +1 -1
  68. package/dist/server/app-browser-visible-commit.js +2 -12
  69. package/dist/server/app-elements-wire.d.ts +6 -38
  70. package/dist/server/app-elements-wire.js +4 -41
  71. package/dist/server/app-elements.d.ts +2 -2
  72. package/dist/server/app-elements.js +2 -2
  73. package/dist/server/app-history-state.d.ts +2 -2
  74. package/dist/server/app-history-state.js +5 -2
  75. package/dist/server/app-mounted-layouts.d.ts +21 -0
  76. package/dist/server/app-mounted-layouts.js +67 -0
  77. package/dist/server/app-optimistic-routing.d.ts +19 -1
  78. package/dist/server/app-optimistic-routing.js +42 -2
  79. package/dist/server/app-page-boundary-render.js +7 -6
  80. package/dist/server/app-page-boundary.js +2 -2
  81. package/dist/server/app-page-cache-finalizer.d.ts +12 -1
  82. package/dist/server/app-page-cache-finalizer.js +70 -29
  83. package/dist/server/app-page-cache.d.ts +13 -1
  84. package/dist/server/app-page-cache.js +31 -9
  85. package/dist/server/app-page-dispatch.d.ts +5 -10
  86. package/dist/server/app-page-dispatch.js +84 -154
  87. package/dist/server/app-page-element-builder.d.ts +2 -2
  88. package/dist/server/app-page-element-builder.js +10 -9
  89. package/dist/server/app-page-execution.d.ts +17 -52
  90. package/dist/server/app-page-execution.js +99 -95
  91. package/dist/server/app-page-head.d.ts +13 -0
  92. package/dist/server/app-page-head.js +44 -16
  93. package/dist/server/app-page-http-access-fallback-metadata.d.ts +1 -0
  94. package/dist/server/app-page-http-access-fallback-metadata.js +2 -2
  95. package/dist/server/app-page-layout-gate.d.ts +35 -0
  96. package/dist/server/app-page-layout-gate.js +50 -0
  97. package/dist/server/app-page-params.d.ts +0 -1
  98. package/dist/server/app-page-params.js +1 -14
  99. package/dist/server/app-page-probe.d.ts +3 -21
  100. package/dist/server/app-page-probe.js +4 -37
  101. package/dist/server/app-page-render.d.ts +2 -12
  102. package/dist/server/app-page-render.js +89 -220
  103. package/dist/server/app-page-request.d.ts +1 -3
  104. package/dist/server/app-page-request.js +1 -1
  105. package/dist/server/app-page-response.js +3 -3
  106. package/dist/server/app-page-route-wiring.d.ts +13 -6
  107. package/dist/server/app-page-route-wiring.js +67 -61
  108. package/dist/server/app-page-rsc-render-status.d.ts +27 -1
  109. package/dist/server/app-page-rsc-render-status.js +121 -13
  110. package/dist/server/app-page-stream.d.ts +2 -0
  111. package/dist/server/app-page-stream.js +2 -2
  112. package/dist/server/app-pages-bridge.d.ts +4 -0
  113. package/dist/server/app-pages-bridge.js +7 -3
  114. package/dist/server/app-render-dependency.d.ts +11 -4
  115. package/dist/server/app-render-dependency.js +86 -38
  116. package/dist/server/app-request-stage-dispatch.js +1 -1
  117. package/dist/server/app-route-handler-cache.js +2 -2
  118. package/dist/server/app-route-handler-dispatch.js +14 -9
  119. package/dist/server/app-route-handler-execution.js +8 -3
  120. package/dist/server/app-route-handler-policy.d.ts +1 -1
  121. package/dist/server/app-route-handler-policy.js +3 -3
  122. package/dist/server/app-route-handler-response.js +1 -1
  123. package/dist/server/app-route-handler-runtime.js +17 -4
  124. package/dist/server/app-rsc-cache-busting.d.ts +2 -2
  125. package/dist/server/app-rsc-cache-busting.js +4 -4
  126. package/dist/server/app-rsc-error-handler.d.ts +2 -1
  127. package/dist/server/app-rsc-error-handler.js +9 -1
  128. package/dist/server/app-rsc-errors.d.ts +8 -0
  129. package/dist/server/app-rsc-errors.js +8 -1
  130. package/dist/server/app-rsc-handler.d.ts +5 -5
  131. package/dist/server/app-rsc-handler.js +30 -24
  132. package/dist/server/app-rsc-request-normalization.d.ts +0 -4
  133. package/dist/server/app-rsc-request-normalization.js +1 -4
  134. package/dist/server/app-rsc-response-finalizer.js +2 -2
  135. package/dist/server/app-rsc-response-stage.js +5 -3
  136. package/dist/server/app-server-action-execution.d.ts +3 -1
  137. package/dist/server/app-server-action-execution.js +7 -4
  138. package/dist/server/app-ssr-entry.d.ts +2 -0
  139. package/dist/server/app-ssr-entry.js +9 -8
  140. package/dist/server/app-ssr-stream.js +1 -1
  141. package/dist/server/app-visited-response-cache.d.ts +36 -1
  142. package/dist/server/app-visited-response-cache.js +46 -5
  143. package/dist/server/app-worker-stages.d.ts +25 -3
  144. package/dist/server/app-worker-stages.js +45 -6
  145. package/dist/server/artifact-compatibility.d.ts +0 -1
  146. package/dist/server/artifact-compatibility.js +1 -10
  147. package/dist/server/cache-proof.d.ts +1 -115
  148. package/dist/server/cache-proof.js +1 -544
  149. package/dist/server/cacheability-request.js +13 -8
  150. package/dist/server/dev-server.js +4 -3
  151. package/dist/server/headers.d.ts +6 -3
  152. package/dist/server/headers.js +9 -5
  153. package/dist/server/isr-cache.d.ts +8 -2
  154. package/dist/server/isr-cache.js +26 -1
  155. package/dist/server/metadata-route-response.js +32 -15
  156. package/dist/server/multi-stage.d.ts +52 -11
  157. package/dist/server/multi-stage.js +13 -1
  158. package/dist/server/navigation-planner.js +1 -1
  159. package/dist/server/pages-api-route.js +28 -19
  160. package/dist/server/pages-media-type.d.ts +21 -1
  161. package/dist/server/pages-media-type.js +69 -5
  162. package/dist/server/pages-node-compat.js +52 -27
  163. package/dist/server/pages-page-handler.js +11 -20
  164. package/dist/server/pages-request-pipeline.d.ts +8 -0
  165. package/dist/server/pages-request-pipeline.js +2 -2
  166. package/dist/server/pages-request-stage-entry.js +14 -12
  167. package/dist/server/pages-response-stage-entry.js +9 -3
  168. package/dist/server/prod-server.js +5 -1
  169. package/dist/server/request-pipeline.d.ts +6 -0
  170. package/dist/server/request-pipeline.js +21 -1
  171. package/dist/server/shared-cache-identity.d.ts +23 -0
  172. package/dist/server/shared-cache-identity.js +36 -0
  173. package/dist/server/worker-stages.d.ts +16 -3
  174. package/dist/server/worker-stages.js +23 -4
  175. package/dist/shims/cache-handler.js +2 -2
  176. package/dist/shims/cache-request-state.d.ts +17 -20
  177. package/dist/shims/cache-request-state.js +16 -21
  178. package/dist/shims/cache-runtime.js +27 -11
  179. package/dist/shims/cache.d.ts +8 -7
  180. package/dist/shims/cache.js +17 -19
  181. package/dist/shims/cacheability-classification.d.ts +2 -0
  182. package/dist/shims/cdn-cache.d.ts +22 -5
  183. package/dist/shims/client-page-root.js +2 -2
  184. package/dist/shims/dynamic.js +9 -6
  185. package/dist/shims/error-boundary.js +2 -2
  186. package/dist/shims/fetch-cache-state.d.ts +5 -1
  187. package/dist/shims/fetch-cache-state.js +1 -3
  188. package/dist/shims/fetch-cache.d.ts +2 -1
  189. package/dist/shims/fetch-cache.js +34 -24
  190. package/dist/shims/form.js +2 -2
  191. package/dist/shims/headers.d.ts +8 -23
  192. package/dist/shims/headers.js +17 -67
  193. package/dist/shims/internal/navigation-untracked.js +1 -1
  194. package/dist/shims/link.js +3 -1
  195. package/dist/shims/metadata.d.ts +23 -21
  196. package/dist/shims/metadata.js +62 -24
  197. package/dist/shims/navigation-server.js +1 -1
  198. package/dist/shims/navigation.d.ts +74 -7
  199. package/dist/shims/navigation.js +183 -29
  200. package/dist/shims/navigation.react-server.js +2 -2
  201. package/dist/shims/request-state-types.d.ts +2 -2
  202. package/dist/shims/slot.d.ts +12 -0
  203. package/dist/shims/slot.js +37 -9
  204. package/dist/shims/unified-request-context.d.ts +1 -1
  205. package/dist/shims/unified-request-context.js +2 -3
  206. package/dist/utils/cache-control-metadata.d.ts +5 -0
  207. package/dist/utils/cache-control-metadata.js +9 -1
  208. package/dist/utils/project.d.ts +2 -2
  209. package/dist/utils/project.js +3 -16
  210. package/dist/utils/regex.d.ts +5 -0
  211. package/dist/utils/regex.js +11 -1
  212. package/dist/utils/text-stream.d.ts +10 -5
  213. package/dist/utils/text-stream.js +6 -6
  214. package/package.json +2 -1
  215. package/dist/build/layout-classification-types.d.ts +0 -60
  216. package/dist/build/layout-classification-types.js +0 -1
  217. package/dist/build/layout-classification.d.ts +0 -62
  218. package/dist/build/layout-classification.js +0 -98
  219. package/dist/build/route-classification-injector.d.ts +0 -33
  220. package/dist/build/route-classification-injector.js +0 -59
  221. package/dist/build/route-classification-manifest.d.ts +0 -54
  222. package/dist/build/route-classification-manifest.js +0 -143
  223. package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -11
  224. package/dist/server/app-browser-client-reuse-manifest.js +0 -101
  225. package/dist/server/app-layout-param-observation.d.ts +0 -42
  226. package/dist/server/app-layout-param-observation.js +0 -168
  227. package/dist/server/client-reuse-manifest.d.ts +0 -103
  228. package/dist/server/client-reuse-manifest.js +0 -209
  229. package/dist/server/skip-cache-proof.d.ts +0 -60
  230. package/dist/server/skip-cache-proof.js +0 -168
  231. package/dist/server/static-layout-client-reuse-proof.d.ts +0 -14
  232. package/dist/server/static-layout-client-reuse-proof.js +0 -33
  233. package/dist/utils/sorted-array.d.ts +0 -8
  234. package/dist/utils/sorted-array.js +0 -20
@@ -1,5 +1,4 @@
1
1
  import { RenderRequestApiKind } from "../server/cache-proof.js";
2
- import { CacheLifeConfig } from "./cache-request-state.js";
3
2
  import { ConnectionProbeResult, HeadersAccessPhase, RenderDynamicLatch, VinextHeadersShimState, createRenderDynamicLatch, getHeadersAccessPhase, isInsideAnyCacheScope, isRenderDynamicLatched, markDynamicUsage, markRenderRequestApiUsage, onRenderDynamicLatched, throwIfInsideCacheScope, throwIfStaticGenerationAccessError } from "./internal/headers-state.js";
4
3
  import { ReadonlyRequestCookies } from "@vinext/types/next/upstream/dist/server/web/spec-extension/adapters/request-cookies";
5
4
  import { ResponseCookie } from "@vinext/types/next/upstream/dist/compiled/@edge-runtime/cookies/index";
@@ -19,27 +18,11 @@ type HeadersContextFromRequestOptions = {
19
18
  draftModeSecret?: string;
20
19
  };
21
20
  /**
22
- * Measure dynamic usage in a child async scope without clearing the parent.
23
- * Concurrent work that already belongs to the request (such as deferred
24
- * metadata) keeps writing to the parent state and therefore remains visible
25
- * to the final cache policy.
26
- */
27
- export declare function runWithIsolatedDynamicUsage<T>(fn: () => T | Promise<T>): Promise<{
28
- result: T;
29
- dynamicDetected: boolean;
30
- }>;
31
- /**
32
- * Run a pre-render probe without letting its dynamic API usage classify the
33
- * request. Next.js has no probe: only the render decides whether a page is
34
- * dynamic, and the render runs the probed layouts and page again. Returns the
35
- * probe's own usage and cacheLife for a caller whose probe response replaces
36
- * the render.
37
- */
38
- export declare function runWithDetachedDynamicUsage<T>(fn: () => T | Promise<T>): Promise<{
39
- result: T;
40
- dynamicDetected: boolean;
41
- cacheLife: CacheLifeConfig | null;
42
- }>;
21
+ * Run a layout probe without letting its dynamic API usage, fetch tags or
22
+ * cacheLife reach the request. Next.js has no probe: only the render decides
23
+ * whether a page is dynamic and how long it is cached.
24
+ */
25
+ export declare function runWithDetachedDynamicUsage<T>(fn: () => T | Promise<T>): Promise<T>;
43
26
  export declare function runWithConnectionProbe<T>(fn: () => T | Promise<T>): Promise<ConnectionProbeResult<T>>;
44
27
  export declare function suspendConnectionProbe(): Promise<never> | null;
45
28
  export declare function peekRenderRequestApiUsage(): RenderRequestApiKind[];
@@ -214,7 +197,9 @@ declare class RequestCookies {
214
197
  private _cookies;
215
198
  private _responseCookies;
216
199
  constructor(cookies: Map<string, string>, mutable?: boolean);
217
- get(name: string): ResponseCookie | undefined;
200
+ get(nameOrOptions: string | {
201
+ name: string;
202
+ }): ResponseCookie | undefined;
218
203
  getAll(nameOrOptions?: string | {
219
204
  name: string;
220
205
  }): ResponseCookie[];
@@ -84,78 +84,27 @@ function mergeMiddlewareSetCookies(ctx, rawHeader) {
84
84
  return merged;
85
85
  }
86
86
  /**
87
- * Measure dynamic usage in a child async scope without clearing the parent.
88
- * Concurrent work that already belongs to the request (such as deferred
89
- * metadata) keeps writing to the parent state and therefore remains visible
90
- * to the final cache policy.
91
- */
92
- async function runWithIsolatedDynamicUsage(fn) {
93
- const runInChildState = async (childState) => {
94
- return {
95
- result: await fn(),
96
- dynamicDetected: childState.dynamicUsageDetected
97
- };
98
- };
99
- if (isInsideUnifiedScope()) {
100
- let childState = null;
101
- return await runWithUnifiedStateMutation((context) => {
102
- context.dynamicUsageDetected = false;
103
- childState = context;
104
- }, () => {
105
- if (!childState) throw new Error("Dynamic usage scope was not initialized");
106
- return runInChildState(childState);
107
- });
108
- }
109
- const parentState = getHeadersShimState();
110
- const childState = {
111
- ...parentState,
112
- renderDynamicLatch: ensureRenderDynamicLatch(parentState),
113
- dynamicUsageDetected: false
114
- };
115
- return await headersShimAls.run(childState, () => runInChildState(childState));
116
- }
117
- /**
118
- * Run a pre-render probe without letting its dynamic API usage classify the
119
- * request. Next.js has no probe: only the render decides whether a page is
120
- * dynamic, and the render runs the probed layouts and page again. Returns the
121
- * probe's own usage and cacheLife for a caller whose probe response replaces
122
- * the render.
87
+ * Run a layout probe without letting its dynamic API usage, fetch tags or
88
+ * cacheLife reach the request. Next.js has no probe: only the render decides
89
+ * whether a page is dynamic and how long it is cached.
123
90
  */
124
91
  async function runWithDetachedDynamicUsage(fn) {
125
- const runInChildState = async (childState, cacheLifeSink) => {
126
- return {
127
- result: await fn(),
128
- cacheLife: cacheLifeSink?.cacheLife ?? null,
129
- dynamicDetected: childState.dynamicUsageDetected || childState.renderDynamicLatch.dynamic
130
- };
131
- };
132
- if (isInsideUnifiedScope()) {
133
- let childState = null;
134
- const cacheLifeSink = { cacheLife: null };
135
- return await runWithUnifiedStateMutation((context) => {
136
- context.cacheLifeSink = cacheLifeSink;
137
- context.dynamicUsageDetected = false;
138
- context.renderDynamicLatch = createRenderDynamicLatch();
139
- context.renderRequestApiUsage = /* @__PURE__ */ new Set();
140
- context.requestCache = /* @__PURE__ */ new WeakMap();
141
- context.cacheableFetchUrls = /* @__PURE__ */ new Set();
142
- context.currentRequestTags = [];
143
- context.dynamicFetchUrls = /* @__PURE__ */ new Set();
144
- context.requestScopedCacheLife = null;
145
- context.unstableCacheObservations = /* @__PURE__ */ new Map();
146
- childState = context;
147
- }, () => {
148
- if (!childState) throw new Error("Dynamic usage scope was not initialized");
149
- return runInChildState(childState, cacheLifeSink);
150
- });
151
- }
92
+ if (isInsideUnifiedScope()) return await runWithUnifiedStateMutation((context) => {
93
+ context.dynamicUsageDetected = false;
94
+ context.renderDynamicLatch = createRenderDynamicLatch();
95
+ context.renderRequestApiUsage = /* @__PURE__ */ new Set();
96
+ context.requestCache = /* @__PURE__ */ new WeakMap();
97
+ context.currentRequestTags = [];
98
+ context.dynamicFetchUrls = /* @__PURE__ */ new Set();
99
+ context.requestScopedCacheLife = null;
100
+ }, fn);
152
101
  const childState = {
153
102
  ...getHeadersShimState(),
154
103
  dynamicUsageDetected: false,
155
104
  renderDynamicLatch: createRenderDynamicLatch(),
156
105
  renderRequestApiUsage: /* @__PURE__ */ new Set()
157
106
  };
158
- return await headersShimAls.run(childState, () => runInChildState(childState, null));
107
+ return await headersShimAls.run(childState, fn);
159
108
  }
160
109
  async function runWithConnectionProbe(fn) {
161
110
  const parentState = getHeadersShimState();
@@ -513,7 +462,7 @@ function _wrapMutableCookies(cookies) {
513
462
  }
514
463
  function _sealCookies(cookies) {
515
464
  return new Proxy(cookies, { get(target, prop) {
516
- if (prop === "set" || prop === "delete") throw new ReadonlyRequestCookiesError();
465
+ if (prop === "set" || prop === "delete" || prop === "clear") return ReadonlyRequestCookiesError.callable;
517
466
  const value = Reflect.get(target, prop, target);
518
467
  return typeof value === "function" ? value.bind(target) : value;
519
468
  } });
@@ -761,7 +710,8 @@ var RequestCookies = class {
761
710
  value
762
711
  })])) : null;
763
712
  }
764
- get(name) {
713
+ get(nameOrOptions) {
714
+ const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions.name;
765
715
  if (this._responseCookies) return this._responseCookies.get(name);
766
716
  const value = this._cookies.get(name);
767
717
  if (value === void 0) return void 0;
@@ -877,4 +827,4 @@ function serializeMutableCookie(cookie) {
877
827
  });
878
828
  }
879
829
  //#endregion
880
- export { applyEffectiveRequestCookieHeader, applyMiddlewareRequestHeaders, consumeDynamicUsage, consumeInvalidDynamicUsageError, consumeRenderRequestApiUsage, cookies, createRenderDynamicLatch, draftMode, getActiveDraftModeState, getAndClearPendingCookies, getDraftModeCookieHeader, getEffectiveRequestCookieHeader, getHeadersAccessPhase, getHeadersContext, hasDraftModeCookieHeader, hasEffectiveRequestCookieChanges, headers, headersContextFromRequest, isDraftModeEnabled, isDraftModeRequest, isInsideAnyCacheScope, isRenderDynamicLatched, markDynamicUsage, markRenderRequestApiUsage, onRenderDynamicLatched, peekDynamicUsage, peekRenderRequestApiUsage, replaceHeadersContext, restoreDraftModeTransition, runWithConnectionProbe, runWithDetachedDynamicUsage, runWithHeadersContext, runWithIsolatedDynamicUsage, setHeadersAccessPhase, setHeadersContext, suspendConnectionProbe, throwIfInsideCacheScope, throwIfStaticGenerationAccessError };
830
+ export { applyEffectiveRequestCookieHeader, applyMiddlewareRequestHeaders, consumeDynamicUsage, consumeInvalidDynamicUsageError, consumeRenderRequestApiUsage, cookies, createRenderDynamicLatch, draftMode, getActiveDraftModeState, getAndClearPendingCookies, getDraftModeCookieHeader, getEffectiveRequestCookieHeader, getHeadersAccessPhase, getHeadersContext, hasDraftModeCookieHeader, hasEffectiveRequestCookieChanges, headers, headersContextFromRequest, isDraftModeEnabled, isDraftModeRequest, isInsideAnyCacheScope, isRenderDynamicLatched, markDynamicUsage, markRenderRequestApiUsage, onRenderDynamicLatched, peekDynamicUsage, peekRenderRequestApiUsage, replaceHeadersContext, restoreDraftModeTransition, runWithConnectionProbe, runWithDetachedDynamicUsage, runWithHeadersContext, setHeadersAccessPhase, setHeadersContext, suspendConnectionProbe, throwIfInsideCacheScope, throwIfStaticGenerationAccessError };
@@ -1,5 +1,5 @@
1
- import { getNavigationContext } from "../navigation-context-state.js";
2
1
  import { getPagesNavigationContext } from "./pages-router-accessor.js";
2
+ import { getNavigationContext } from "../navigation-context-state.js";
3
3
  import { getClientNavigationState, useClientNavigationRenderSnapshot } from "../navigation.js";
4
4
  //#region src/shims/internal/navigation-untracked.ts
5
5
  /**
@@ -192,7 +192,7 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale, owner
192
192
  ]);
193
193
  if (routeManifestLoaded === false) return;
194
194
  if (navigationEpoch !== linkPrefetchNavigationEpoch) return;
195
- const { getPrefetchInterceptionContext, getPrefetchCache, getPrefetchedUrls, getMountedSlotsHeader, createAppPrefetchRequestHeaders, discardLearningOnlyPrefetchCacheEntry, fetchRouteTreeGatedPrefetch, hasFreshLearningOnlyPrefetchCacheEntry, hasSearchAgnosticPrefetchShellForRoute, hasPrefetchCacheEntryForNavigation, prefetchRscResponse, prepareNavigationPrefetchSnapshot, promotePrefetchCacheEntryForNavigation, DYNAMIC_NAVIGATION_CACHE_TTL, PREFETCH_CACHE_TTL } = navigation;
195
+ const { getPrefetchInterceptionContext, getPrefetchCache, getPrefetchedUrls, getMountedSlotsHeader, createAppPrefetchRequestHeaders, discardLearningOnlyPrefetchCacheEntry, fetchRouteTreeGatedPrefetch, hasFreshLearningOnlyPrefetchCacheEntry, hasSearchAgnosticPrefetchShellForRoute, hasPrefetchCacheEntryForNavigation, prefetchRscResponse, prepareNavigationPrefetchSnapshot, promotePrefetchCacheEntryForNavigation, seedFullPrefetchFromVisitedResponse, hasNavigationFreshVisitedResponse, DYNAMIC_NAVIGATION_CACHE_TTL, PREFETCH_CACHE_TTL } = navigation;
196
196
  const { createRscRequestUrl } = rscCacheBusting;
197
197
  const { NEXT_ROUTER_PREFETCH_HEADER, NEXT_ROUTER_SEGMENT_PREFETCH_HEADER, VINEXT_MOUNTED_SLOTS_HEADER } = headersModule;
198
198
  const hybridOwner = HAS_PAGES_ROUTER ? hybridRouteOwner.resolveHybridClientRouteOwner(prefetchHref, __basePath) : null;
@@ -314,6 +314,8 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale, owner
314
314
  }
315
315
  return;
316
316
  }
317
+ if (autoPrefetch.dynamicStaleTime === "full-prefetch" && seedFullPrefetchFromVisitedResponse(rscUrl, interceptionContext, mountedSlotsHeader, additionalRscUrls)) return;
318
+ if (autoPrefetch.dynamicStaleTime !== "full-prefetch" && hasNavigationFreshVisitedResponse(rscUrl, interceptionContext, mountedSlotsHeader, additionalRscUrls)) return;
317
319
  prefetched.add(cacheKey);
318
320
  const gateViaRouteTree = (__prefetchInlining || requiresRouteTreePrefetch) && mode === "auto" && autoPrefetch.prefetchShellFirst;
319
321
  const gateViaExplicitSearchShell = mode === "full" && hasSearchParams && autoPrefetch.prefetchShellFirst && mountedSlotsHeader === null;
@@ -21,12 +21,13 @@ export declare function mergeViewport(viewportList: readonly Viewport[]): Resolv
21
21
  export declare function ViewportHead({ viewport }: {
22
22
  viewport: Viewport;
23
23
  }): React.JSX.Element;
24
+ type MetadataTitle = string | {
25
+ default?: string;
26
+ template?: string | null;
27
+ absolute?: string;
28
+ };
24
29
  export type Metadata = {
25
- title?: string | {
26
- default?: string;
27
- template?: string | null;
28
- absolute?: string;
29
- };
30
+ title?: MetadataTitle;
30
31
  description?: string;
31
32
  generator?: string;
32
33
  applicationName?: string;
@@ -52,7 +53,7 @@ export type Metadata = {
52
53
  [key: string]: unknown;
53
54
  };
54
55
  openGraph?: {
55
- title?: string;
56
+ title?: MetadataTitle;
56
57
  description?: string;
57
58
  url?: string | URL;
58
59
  siteName?: string;
@@ -68,19 +69,19 @@ export type Metadata = {
68
69
  publishedTime?: string;
69
70
  modifiedTime?: string;
70
71
  authors?: string[];
71
- };
72
+ } | null;
72
73
  twitter?: {
73
74
  card?: string;
74
75
  site?: string;
75
76
  siteId?: string;
76
- title?: string;
77
+ title?: MetadataTitle;
77
78
  description?: string;
78
79
  images?: string | URL | SocialImageDescriptor | Array<string | URL | SocialImageDescriptor>;
79
80
  creator?: string;
80
81
  creatorId?: string;
81
82
  players?: TwitterPlayerDescriptor | TwitterPlayerDescriptor[];
82
83
  app?: TwitterAppDescriptor;
83
- };
84
+ } | null;
84
85
  icons?: IconsMetadata;
85
86
  manifest?: string | URL;
86
87
  alternates?: {
@@ -206,17 +207,15 @@ type IconsMap = {
206
207
  };
207
208
  type IconsMetadata = IconInput | IconInput[] | IconsMap;
208
209
  export type MetadataMergeEntry = {
210
+ /** Passes on the title template it received rather than its own. */
209
211
  isPage?: boolean;
210
212
  metadata: Metadata;
211
213
  };
212
214
  /**
213
215
  * Merge metadata from multiple sources (layouts + page).
214
216
  *
215
- * The list is ordered [rootLayout, nestedLayout, ..., page].
216
- * Title template from layouts applies to the page title but NOT to
217
- * the segment that defines the template itself. `title.absolute`
218
- * skips all templates. `title.default` is the fallback when no
219
- * child provides a title.
217
+ * The list is ordered [rootLayout, nestedLayout, ..., page], with titles
218
+ * resolved as {@link mergeMetadataEntries} does.
220
219
  *
221
220
  * Shallow merge: later entries override earlier ones (per Next.js docs).
222
221
  */
@@ -237,22 +236,25 @@ export declare function postProcessMetadata(merged: Metadata): Metadata;
237
236
  /**
238
237
  * Merge metadata from multiple sources (layouts + page).
239
238
  *
240
- * The list is ordered [rootLayout, nestedLayout, ..., page].
241
- * Title template from layouts applies to the page title but NOT to
242
- * the segment that defines the template itself. `title.absolute`
243
- * skips all templates. `title.default` is the fallback when no
244
- * child provides a title.
239
+ * The list is ordered [rootLayout, nestedLayout, ..., page]. Like Next.js's
240
+ * accumulateMetadata, each title resolves with the template of the title
241
+ * before it: a `title.template` wraps later titles, not its own entry's
242
+ * `title.default`, and a plain-string title, or one without a template,
243
+ * clears it. An `isPage` entry passes on the template it received.
244
+ * `title.absolute` skips all templates.
245
245
  *
246
246
  * For top-level keys, later entries override earlier ones. `other` custom meta
247
247
  * tags are the exception: Next.js merges those across segments.
248
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/resolve-metadata.ts (accumulateMetadata)
248
249
  */
249
250
  export declare function mergeMetadataEntries(entries: readonly MetadataMergeEntry[]): Metadata;
250
251
  /**
251
252
  * Merge metadata into the `parent` a later segment's resolver receives. Like
252
253
  * {@link mergeMetadataEntries}, except the title stays resolved as Next.js's
253
254
  * `{ absolute, template }`, so `(await parent).title?.absolute` reads the
254
- * title so far. `template` is the one the next title gets, so merging this
255
- * parent with later entries resolves their titles as the full merge does.
255
+ * title so far. `template` is the last title's own, the one the next title
256
+ * gets, so merging this parent with later entries resolves their titles as
257
+ * the full merge does.
256
258
  * https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/resolvers/resolve-title.ts
257
259
  */
258
260
  export declare function mergeParentMetadataEntries(entries: readonly MetadataMergeEntry[]): Metadata;
@@ -131,11 +131,8 @@ function resolveThemeColor(themeColor) {
131
131
  /**
132
132
  * Merge metadata from multiple sources (layouts + page).
133
133
  *
134
- * The list is ordered [rootLayout, nestedLayout, ..., page].
135
- * Title template from layouts applies to the page title but NOT to
136
- * the segment that defines the template itself. `title.absolute`
137
- * skips all templates. `title.default` is the fallback when no
138
- * child provides a title.
134
+ * The list is ordered [rootLayout, nestedLayout, ..., page], with titles
135
+ * resolved as {@link mergeMetadataEntries} does.
139
136
  *
140
137
  * Shallow merge: later entries override earlier ones (per Next.js docs).
141
138
  */
@@ -162,6 +159,10 @@ function resolveStringTitle(title) {
162
159
  if (typeof title === "string") return title;
163
160
  if (title && typeof title === "object") return title.absolute ?? title.default ?? void 0;
164
161
  }
162
+ /** The text a social title renders, a raw `{ default }` title's default if it is not resolved. */
163
+ function renderedTitle(title) {
164
+ return title && typeof title === "object" ? title.absolute || title.default : title;
165
+ }
165
166
  function applyTitleTemplate(template, title) {
166
167
  return template ? template.replace(/%s/g, title) : title;
167
168
  }
@@ -233,14 +234,16 @@ function postProcessMetadata(merged) {
233
234
  /**
234
235
  * Merge metadata from multiple sources (layouts + page).
235
236
  *
236
- * The list is ordered [rootLayout, nestedLayout, ..., page].
237
- * Title template from layouts applies to the page title but NOT to
238
- * the segment that defines the template itself. `title.absolute`
239
- * skips all templates. `title.default` is the fallback when no
240
- * child provides a title.
237
+ * The list is ordered [rootLayout, nestedLayout, ..., page]. Like Next.js's
238
+ * accumulateMetadata, each title resolves with the template of the title
239
+ * before it: a `title.template` wraps later titles, not its own entry's
240
+ * `title.default`, and a plain-string title, or one without a template,
241
+ * clears it. An `isPage` entry passes on the template it received.
242
+ * `title.absolute` skips all templates.
241
243
  *
242
244
  * For top-level keys, later entries override earlier ones. `other` custom meta
243
245
  * tags are the exception: Next.js merges those across segments.
246
+ * https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/resolve-metadata.ts (accumulateMetadata)
244
247
  */
245
248
  function mergeMetadataEntries(entries) {
246
249
  return mergeEntries(entries, false);
@@ -249,20 +252,29 @@ function mergeMetadataEntries(entries) {
249
252
  * Merge metadata into the `parent` a later segment's resolver receives. Like
250
253
  * {@link mergeMetadataEntries}, except the title stays resolved as Next.js's
251
254
  * `{ absolute, template }`, so `(await parent).title?.absolute` reads the
252
- * title so far. `template` is the one the next title gets, so merging this
253
- * parent with later entries resolves their titles as the full merge does.
255
+ * title so far. `template` is the last title's own, the one the next title
256
+ * gets, so merging this parent with later entries resolves their titles as
257
+ * the full merge does.
254
258
  * https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/resolvers/resolve-title.ts
255
259
  */
256
260
  function mergeParentMetadataEntries(entries) {
257
261
  return mergeEntries(entries, true);
258
262
  }
263
+ const SOCIAL_TITLE_KEYS = ["openGraph", "twitter"];
264
+ function titleTemplateOf(title) {
265
+ return typeof title === "object" && title ? title.template ?? null : null;
266
+ }
259
267
  function mergeEntries(entries, resolvedTitle) {
260
268
  if (entries.length === 0) return {};
261
269
  const merged = {};
262
- let parentTemplate;
270
+ const titleTemplates = {
271
+ title: null,
272
+ openGraph: null,
273
+ twitter: null
274
+ };
275
+ let stashedTemplates = { ...titleTemplates };
263
276
  for (const entry of entries) {
264
277
  const meta = entry.metadata;
265
- const isPage = Boolean(entry.isPage);
266
278
  for (const key of Object.keys(meta)) {
267
279
  if (key === "title") continue;
268
280
  const incoming = meta[key];
@@ -273,13 +285,37 @@ function mergeEntries(entries, resolvedTitle) {
273
285
  };
274
286
  else merged[key] = incoming;
275
287
  }
276
- if (meta.title !== void 0) merged.title = resolveTitle(meta.title, parentTemplate);
277
- if (!isPage && meta.title && typeof meta.title === "object" && meta.title.template) parentTemplate = meta.title.template;
288
+ if (meta.title !== void 0) {
289
+ merged.title = resolveTitle(meta.title, stashedTemplates.title ?? void 0);
290
+ titleTemplates.title = titleTemplateOf(meta.title);
291
+ }
292
+ for (const key of SOCIAL_TITLE_KEYS) {
293
+ if (!Object.hasOwn(meta, key)) continue;
294
+ const social = meta[key];
295
+ titleTemplates[key] = titleTemplateOf(social?.title);
296
+ merged[key] = social ? {
297
+ ...social,
298
+ title: resolveTitle(social.title, stashedTemplates[key] ?? void 0)
299
+ } : null;
300
+ }
301
+ if (!entry.isPage) stashedTemplates = { ...titleTemplates };
302
+ }
303
+ if (resolvedTitle) {
304
+ if (Object.hasOwn(merged, "title")) merged.title = {
305
+ absolute: resolveStringTitle(merged.title) ?? "",
306
+ template: titleTemplates.title
307
+ };
308
+ for (const key of SOCIAL_TITLE_KEYS) {
309
+ const social = merged[key];
310
+ if (social) merged[key] = {
311
+ ...social,
312
+ title: {
313
+ absolute: resolveStringTitle(social.title) ?? "",
314
+ template: titleTemplates[key]
315
+ }
316
+ };
317
+ }
278
318
  }
279
- if (resolvedTitle && Object.hasOwn(merged, "title")) merged.title = {
280
- absolute: resolveStringTitle(merged.title) ?? "",
281
- template: parentTemplate ?? null
282
- };
283
319
  return merged;
284
320
  }
285
321
  /**
@@ -569,9 +605,10 @@ function MetadataHead({ metadata, pathname = "/", trailingSlash, streamedIconKey
569
605
  }
570
606
  if (metadata.openGraph) {
571
607
  const og = metadata.openGraph;
572
- if (og.title) elements.push(/* @__PURE__ */ jsx("meta", {
608
+ const ogTitle = renderedTitle(og.title);
609
+ if (ogTitle) elements.push(/* @__PURE__ */ jsx("meta", {
573
610
  property: "og:title",
574
- content: og.title
611
+ content: ogTitle
575
612
  }, key++));
576
613
  if (og.description) elements.push(/* @__PURE__ */ jsx("meta", {
577
614
  property: "og:description",
@@ -702,9 +739,10 @@ function MetadataHead({ metadata, pathname = "/", trailingSlash, streamedIconKey
702
739
  name: "twitter:site:id",
703
740
  content: tw.siteId
704
741
  }, key++));
705
- if (tw.title) elements.push(/* @__PURE__ */ jsx("meta", {
742
+ const twTitle = renderedTitle(tw.title);
743
+ if (twTitle) elements.push(/* @__PURE__ */ jsx("meta", {
706
744
  name: "twitter:title",
707
- content: tw.title
745
+ content: twTitle
708
746
  }, key++));
709
747
  if (tw.description) elements.push(/* @__PURE__ */ jsx("meta", {
710
748
  name: "twitter:description",
@@ -1,3 +1,3 @@
1
- import { GLOBAL_ACCESSORS_KEY, ServerInsertedHTMLContext, _registerStateAccessors, clearClientHydrationContext, clearServerInsertedHTML, flushServerInsertedHTML, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getLayoutSegmentContext, getNavigationContext, registerServerInsertedHTMLCallback, renderServerInsertedHTML, setNavigationContext } from "./navigation-context-state.js";
2
1
  import { BailoutToCSRError, DynamicServerError, HTTP_ERROR_FALLBACK_ERROR_CODE, RedirectType, decodeRedirectError, forbidden, getAccessFallbackHTTPStatus, isBailoutToCSRError, isDynamicServerError, isHTTPAccessFallbackError, isNextRouterError, isRedirectError, notFound, permanentRedirect, redirect, unauthorized, unstable_rethrow } from "./navigation-errors.js";
2
+ import { GLOBAL_ACCESSORS_KEY, ServerInsertedHTMLContext, _registerStateAccessors, clearClientHydrationContext, clearServerInsertedHTML, flushServerInsertedHTML, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getLayoutSegmentContext, getNavigationContext, registerServerInsertedHTMLCallback, renderServerInsertedHTML, setNavigationContext } from "./navigation-context-state.js";
3
3
  export { BailoutToCSRError, DynamicServerError, GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, RedirectType, ServerInsertedHTMLContext, _registerStateAccessors, clearClientHydrationContext, clearServerInsertedHTML, decodeRedirectError, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getLayoutSegmentContext, getNavigationContext, isBailoutToCSRError, isDynamicServerError, isHTTPAccessFallbackError, isNextRouterError, isRedirectError, notFound, permanentRedirect, redirect, registerServerInsertedHTMLCallback, renderServerInsertedHTML, setNavigationContext, unauthorized, unstable_rethrow };
@@ -1,14 +1,14 @@
1
1
  import { AppRouterScrollIntent } from "./app-router-scroll-state.js";
2
- import { NavigationRuntimeVisibleCommitMode } from "../client/navigation-runtime.js";
3
- import { AppElements } from "../server/app-elements-wire.js";
4
- import "../server/app-elements.js";
5
2
  import { AppRouterInstance, NavigateOptions, PrefetchOptions as PrefetchOptions$1 } from "./internal/app-router-context.js";
6
3
  import { AppRoutePrefetchPolicy } from "./internal/app-route-prefetch-policy.js";
4
+ import { AppElements } from "../server/app-elements-wire.js";
5
+ import "../server/app-elements.js";
7
6
  import { ReadonlyURLSearchParams } from "./readonly-url-search-params.js";
8
7
  import { AppRscRenderMode } from "../server/app-rsc-render-mode.js";
9
8
  import { GLOBAL_ACCESSORS_KEY, NavigationContext, NavigationStateAccessors, SegmentMap, ServerInsertedHTMLContext, _registerStateAccessors, clearServerInsertedHTML, flushServerInsertedHTML, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getLayoutSegmentContext, getNavigationContext, renderServerInsertedHTML, setNavigationContext } from "./navigation-context-state.js";
10
9
  import { BailoutToCSRError, DynamicServerError, HTTP_ERROR_FALLBACK_ERROR_CODE, RedirectType, decodeRedirectError, forbidden, getAccessFallbackHTTPStatus, isBailoutToCSRError, isDynamicServerError, isHTTPAccessFallbackError, isNextRouterError, isRedirectError, notFound, permanentRedirect, redirect, unauthorized, unstable_rethrow } from "./navigation-errors.js";
11
10
  import { UnrecognizedActionError, unstable_isUnrecognizedActionError } from "./unrecognized-action-error.js";
11
+ import { NavigationRuntimeVisibleCommitMode } from "../client/navigation-runtime.js";
12
12
  import * as React$1 from "react";
13
13
  import { Params } from "@vinext/types/next/upstream/dist/server/request/params";
14
14
  //#region src/shims/navigation.d.ts
@@ -50,6 +50,12 @@ export type CachedRscResponse = {
50
50
  mountedSlotsHeader?: string | null;
51
51
  paramsHeader: string | null;
52
52
  preparedElements?: AppElements;
53
+ /**
54
+ * When the payload arrived from the server. A navigation that commits a
55
+ * prefetched payload keeps the prefetch's time, so a later full prefetch
56
+ * judges the data by its age, not by the navigation that reused it.
57
+ */
58
+ receivedAt?: number;
53
59
  /**
54
60
  * Streamed `redirect()` side-channel headers. A replayed snapshot must keep
55
61
  * them so the navigation follows the redirect instead of decoding the
@@ -145,7 +151,26 @@ export declare function discardLearningOnlyPrefetchCacheEntry(rscUrl: string, in
145
151
  * page reflects the cookies and headers at hover time.
146
152
  */
147
153
  export declare function promotePrefetchCacheEntryForNavigation(cacheKey: string, entry: PrefetchCacheEntry): void;
148
- export declare function invalidatePrefetchCache(): void;
154
+ export type InvalidatePrefetchCacheOptions = {
155
+ /** Prefetch the visible links again right away. Defaults to true. */
156
+ pingVisibleLinks?: boolean;
157
+ };
158
+ export declare function invalidatePrefetchCache(options?: InvalidatePrefetchCacheOptions): void;
159
+ /**
160
+ * Evict the prefetch entries that may hold dynamic data, for a Server Action
161
+ * that called `refresh()`. Like Next.js's dynamic-only revalidation, which
162
+ * evicts its BFCache but keeps its prefetch cache, this keeps route trees,
163
+ * static prefetches and full prefetches. It drops navigation responses, and
164
+ * automatic prefetches whose page rendered dynamically or hasn't finished
165
+ * rendering, including those only kept to learn a route: Next.js's automatic
166
+ * prefetches never hold dynamic data.
167
+ */
168
+ export declare function invalidateDynamicPrefetchCache(): void;
169
+ /**
170
+ * Notify the prefetches that stood in for a visited response (see
171
+ * `hasNavigationFreshVisitedResponse`), as the visited responses are cleared.
172
+ */
173
+ export declare function invalidateVisitedResponsePrefetches(): void;
149
174
  /**
150
175
  * Prevent completed navigation responses from becoming authoritative again
151
176
  * after restoring a history snapshot. Explicit Link/router prefetches remain
@@ -153,7 +178,21 @@ export declare function invalidatePrefetchCache(): void;
153
178
  * responses retain the cache reuse licensed by Next's segment cache.
154
179
  */
155
180
  export declare function disableNavigationResponsePrefetchCacheReuse(): void;
156
- export declare function seedPrefetchResponseSnapshot(rscUrl: string, snapshot: CachedRscResponse, interceptionContext?: string | null, mountedSlotsHeader?: string | null, fallbackTtlMs?: number, reuseAfterHistoryRestore?: boolean): void;
181
+ export declare function seedPrefetchResponseSnapshot(rscUrl: string, snapshot: CachedRscResponse, interceptionContext?: string | null, mountedSlotsHeader?: string | null, fallbackTtlMs?: number, reuseAfterHistoryRestore?: boolean, expiresAt?: number): void;
182
+ /**
183
+ * Fulfill a full prefetch from the visited response of an earlier navigation,
184
+ * as Next.js does from its BFCache, instead of issuing a request. The data is
185
+ * fresh for the static stale time from the navigation, not the dynamic one
186
+ * (`attemptToFulfillDynamicSegmentFromBFCache`).
187
+ */
188
+ export declare function seedFullPrefetchFromVisitedResponse(rscUrl: string, interceptionContext: string | null, mountedSlotsHeader: string | null, additionalRscUrls?: readonly string[], onInvalidate?: () => void): boolean;
189
+ /**
190
+ * Whether a navigation to the URL would reuse the response of an earlier one,
191
+ * so a prefetch has nothing to fetch. Like Next.js, whose navigation keeps the
192
+ * route and its segments for `staleTimes.dynamic`. `onInvalidate` fires when
193
+ * that reuse ends.
194
+ */
195
+ export declare function hasNavigationFreshVisitedResponse(rscUrl: string, interceptionContext: string | null, mountedSlotsHeader: string | null, additionalRscUrls?: readonly string[], onInvalidate?: () => void): boolean;
157
196
  export declare function deletePrefetchResponseSnapshot(rscUrl: string, snapshot: CachedRscResponse, interceptionContext?: string | null): void;
158
197
  /**
159
198
  * Store a prefetched RSC response in the cache by snapshotting it to an
@@ -271,10 +310,33 @@ type ClientNavigationState = {
271
310
  originalPushState: typeof window.history.pushState;
272
311
  originalReplaceState: typeof window.history.replaceState;
273
312
  patchInstalled: boolean;
313
+ routerHistoryWriteDepth: number;
314
+ routerHistoryWrite: RouterHistoryWrite | null;
274
315
  hasPendingNavigationUpdate: boolean;
275
316
  suppressUrlNotifyCount: number;
276
317
  navigationSnapshotActiveCount: number;
277
318
  };
319
+ type RouterHistoryWrite = {
320
+ method: "pushState" | "replaceState";
321
+ data: unknown;
322
+ url: string | URL;
323
+ href: string;
324
+ land: RouterHistoryWriteLanding | undefined;
325
+ threw: boolean;
326
+ landed: boolean;
327
+ };
328
+ /**
329
+ * Runs as a router history write lands, after any writes a history wrapper
330
+ * installed after boot made before forwarding it. Returns the data to write
331
+ * (re-stamped when those writes moved the traversal indices) and a commit to
332
+ * run once the write succeeds, before any write the wrapper makes after it. A
333
+ * wrapper installed before boot is the original method called after `land`, so
334
+ * writes it makes through the live methods are not accounted for.
335
+ */
336
+ export type RouterHistoryWriteLanding = (data: unknown) => {
337
+ data: unknown;
338
+ commit: () => void;
339
+ };
278
340
  type CommitClientNavigationStateOptions = {
279
341
  releaseSnapshot?: boolean;
280
342
  };
@@ -348,8 +410,8 @@ export declare function useParams<T extends Params = Params>(): T | null;
348
410
  * must opt in explicitly if they also own an activated render snapshot.
349
411
  */
350
412
  export declare function commitClientNavigationState(navId?: number, options?: CommitClientNavigationStateOptions): void;
351
- export declare function pushHistoryStateWithoutNotify(data: unknown, unused: string, url?: string | URL | null): void;
352
- export declare function replaceHistoryStateWithoutNotify(data: unknown, unused: string, url?: string | URL | null): void;
413
+ export declare function pushHistoryStateWithoutNotify(data: unknown, unused: string, url?: string | URL | null, land?: RouterHistoryWriteLanding): void;
414
+ export declare function replaceHistoryStateWithoutNotify(data: unknown, unused: string, url?: string | URL | null, land?: RouterHistoryWriteLanding): void;
353
415
  /**
354
416
  * Save the current scroll position into the current history state.
355
417
  * Called before every navigation to enable scroll restoration on back/forward.
@@ -363,6 +425,11 @@ export declare function applyAppRouterScrollFallback(intent: AppRouterScrollInte
363
425
  * Navigate to a URL, handling external URLs, hash-only changes, and RSC navigation.
364
426
  */
365
427
  export declare function navigateClientSide(href: string, mode: "push" | "replace", scroll: boolean, programmaticTransition?: boolean, visibleCommitMode?: NavigationRuntimeVisibleCommitMode): Promise<void>;
428
+ /**
429
+ * Called by the App Router browser entry for each RSC navigation it runs.
430
+ * Returns a release callback for the navigation's settlement.
431
+ */
432
+ export declare function trackAppRouterNavigationInFlight(): () => void;
366
433
  /**
367
434
  * Public App Router instance, exposed for the browser entry so it can wire
368
435
  * `window.next.router` to the same singleton returned from `useRouter()`.