vinext 0.0.53 → 0.0.55

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 (276) hide show
  1. package/README.md +1 -0
  2. package/dist/build/inline-css.d.ts +7 -0
  3. package/dist/build/inline-css.js +50 -0
  4. package/dist/build/inline-css.js.map +1 -0
  5. package/dist/build/prerender.js +2 -1
  6. package/dist/build/prerender.js.map +1 -1
  7. package/dist/check.js +19 -3
  8. package/dist/check.js.map +1 -1
  9. package/dist/client/navigation-runtime.d.ts +3 -1
  10. package/dist/client/navigation-runtime.js +1 -1
  11. package/dist/client/navigation-runtime.js.map +1 -1
  12. package/dist/client/window-next.d.ts +7 -0
  13. package/dist/client/window-next.js.map +1 -1
  14. package/dist/config/next-config.d.ts +97 -2
  15. package/dist/config/next-config.js +155 -6
  16. package/dist/config/next-config.js.map +1 -1
  17. package/dist/config/tsconfig-paths.d.ts +12 -3
  18. package/dist/config/tsconfig-paths.js +55 -24
  19. package/dist/config/tsconfig-paths.js.map +1 -1
  20. package/dist/deploy.js +13 -0
  21. package/dist/deploy.js.map +1 -1
  22. package/dist/entries/app-browser-entry.d.ts +11 -1
  23. package/dist/entries/app-browser-entry.js +16 -6
  24. package/dist/entries/app-browser-entry.js.map +1 -1
  25. package/dist/entries/app-rsc-entry.d.ts +9 -1
  26. package/dist/entries/app-rsc-entry.js +30 -5
  27. package/dist/entries/app-rsc-entry.js.map +1 -1
  28. package/dist/entries/app-rsc-manifest.d.ts +21 -1
  29. package/dist/entries/app-rsc-manifest.js +28 -9
  30. package/dist/entries/app-rsc-manifest.js.map +1 -1
  31. package/dist/entries/pages-client-entry.d.ts +4 -1
  32. package/dist/entries/pages-client-entry.js +18 -2
  33. package/dist/entries/pages-client-entry.js.map +1 -1
  34. package/dist/entries/pages-server-entry.js +123 -8
  35. package/dist/entries/pages-server-entry.js.map +1 -1
  36. package/dist/entries/runtime-entry-module.d.ts +1 -10
  37. package/dist/entries/runtime-entry-module.js +2 -12
  38. package/dist/entries/runtime-entry-module.js.map +1 -1
  39. package/dist/index.js +144 -44
  40. package/dist/index.js.map +1 -1
  41. package/dist/plugins/import-meta-url.d.ts +16 -0
  42. package/dist/plugins/import-meta-url.js +193 -0
  43. package/dist/plugins/import-meta-url.js.map +1 -0
  44. package/dist/plugins/remove-console.d.ts +16 -0
  45. package/dist/plugins/remove-console.js +176 -0
  46. package/dist/plugins/remove-console.js.map +1 -0
  47. package/dist/routing/app-route-graph.d.ts +24 -1
  48. package/dist/routing/app-route-graph.js +52 -4
  49. package/dist/routing/app-route-graph.js.map +1 -1
  50. package/dist/routing/app-router.d.ts +2 -2
  51. package/dist/routing/app-router.js +2 -2
  52. package/dist/routing/app-router.js.map +1 -1
  53. package/dist/routing/file-matcher.d.ts +21 -1
  54. package/dist/routing/file-matcher.js +39 -1
  55. package/dist/routing/file-matcher.js.map +1 -1
  56. package/dist/routing/pages-router.d.ts +1 -1
  57. package/dist/routing/pages-router.js +10 -3
  58. package/dist/routing/pages-router.js.map +1 -1
  59. package/dist/server/api-handler.js +1 -1
  60. package/dist/server/app-browser-action-result.d.ts +9 -16
  61. package/dist/server/app-browser-action-result.js +25 -14
  62. package/dist/server/app-browser-action-result.js.map +1 -1
  63. package/dist/server/app-browser-entry.js +195 -60
  64. package/dist/server/app-browser-entry.js.map +1 -1
  65. package/dist/server/app-browser-mpa-navigation.d.ts +16 -0
  66. package/dist/server/app-browser-mpa-navigation.js +36 -0
  67. package/dist/server/app-browser-mpa-navigation.js.map +1 -0
  68. package/dist/server/app-browser-navigation-controller.d.ts +2 -0
  69. package/dist/server/app-browser-navigation-controller.js +4 -0
  70. package/dist/server/app-browser-navigation-controller.js.map +1 -1
  71. package/dist/server/app-browser-popstate.d.ts +3 -1
  72. package/dist/server/app-browser-popstate.js +15 -1
  73. package/dist/server/app-browser-popstate.js.map +1 -1
  74. package/dist/server/app-browser-state.js +2 -1
  75. package/dist/server/app-browser-state.js.map +1 -1
  76. package/dist/server/app-elements-wire.d.ts +13 -4
  77. package/dist/server/app-elements-wire.js +10 -1
  78. package/dist/server/app-elements-wire.js.map +1 -1
  79. package/dist/server/app-elements.d.ts +2 -2
  80. package/dist/server/app-elements.js +2 -2
  81. package/dist/server/app-elements.js.map +1 -1
  82. package/dist/server/app-fallback-renderer.d.ts +15 -5
  83. package/dist/server/app-fallback-renderer.js +10 -4
  84. package/dist/server/app-fallback-renderer.js.map +1 -1
  85. package/dist/server/app-inline-css-client.d.ts +7 -0
  86. package/dist/server/app-inline-css-client.js +37 -0
  87. package/dist/server/app-inline-css-client.js.map +1 -0
  88. package/dist/server/app-layout-param-observation.d.ts +30 -0
  89. package/dist/server/app-layout-param-observation.js +130 -0
  90. package/dist/server/app-layout-param-observation.js.map +1 -0
  91. package/dist/server/app-page-boundary-render.js +2 -2
  92. package/dist/server/app-page-boundary-render.js.map +1 -1
  93. package/dist/server/app-page-boundary.d.ts +21 -1
  94. package/dist/server/app-page-boundary.js +28 -3
  95. package/dist/server/app-page-boundary.js.map +1 -1
  96. package/dist/server/app-page-cache.d.ts +7 -3
  97. package/dist/server/app-page-cache.js +7 -7
  98. package/dist/server/app-page-cache.js.map +1 -1
  99. package/dist/server/app-page-dispatch.d.ts +10 -1
  100. package/dist/server/app-page-dispatch.js +126 -79
  101. package/dist/server/app-page-dispatch.js.map +1 -1
  102. package/dist/server/app-page-element-builder.js +12 -28
  103. package/dist/server/app-page-element-builder.js.map +1 -1
  104. package/dist/server/app-page-params.d.ts +2 -1
  105. package/dist/server/app-page-params.js +14 -1
  106. package/dist/server/app-page-params.js.map +1 -1
  107. package/dist/server/app-page-probe.d.ts +12 -1
  108. package/dist/server/app-page-probe.js +116 -1
  109. package/dist/server/app-page-probe.js.map +1 -1
  110. package/dist/server/app-page-render-identity.d.ts +22 -0
  111. package/dist/server/app-page-render-identity.js +42 -0
  112. package/dist/server/app-page-render-identity.js.map +1 -0
  113. package/dist/server/app-page-render.d.ts +8 -1
  114. package/dist/server/app-page-render.js +4 -1
  115. package/dist/server/app-page-render.js.map +1 -1
  116. package/dist/server/app-page-request.d.ts +6 -3
  117. package/dist/server/app-page-request.js +5 -2
  118. package/dist/server/app-page-request.js.map +1 -1
  119. package/dist/server/app-page-response.js +2 -2
  120. package/dist/server/app-page-response.js.map +1 -1
  121. package/dist/server/app-page-route-wiring.d.ts +15 -0
  122. package/dist/server/app-page-route-wiring.js +7 -5
  123. package/dist/server/app-page-route-wiring.js.map +1 -1
  124. package/dist/server/app-page-stream.d.ts +11 -0
  125. package/dist/server/app-page-stream.js +1 -0
  126. package/dist/server/app-page-stream.js.map +1 -1
  127. package/dist/server/app-route-handler-response.js +37 -5
  128. package/dist/server/app-route-handler-response.js.map +1 -1
  129. package/dist/server/app-rsc-cache-busting.d.ts +3 -2
  130. package/dist/server/app-rsc-cache-busting.js +9 -7
  131. package/dist/server/app-rsc-cache-busting.js.map +1 -1
  132. package/dist/server/app-rsc-handler.d.ts +14 -3
  133. package/dist/server/app-rsc-handler.js +56 -6
  134. package/dist/server/app-rsc-handler.js.map +1 -1
  135. package/dist/server/app-rsc-request-normalization.d.ts +2 -1
  136. package/dist/server/app-rsc-request-normalization.js +3 -2
  137. package/dist/server/app-rsc-request-normalization.js.map +1 -1
  138. package/dist/server/app-segment-config.d.ts +1 -1
  139. package/dist/server/app-segment-config.js +4 -1
  140. package/dist/server/app-segment-config.js.map +1 -1
  141. package/dist/server/app-server-action-execution.d.ts +26 -3
  142. package/dist/server/app-server-action-execution.js +240 -29
  143. package/dist/server/app-server-action-execution.js.map +1 -1
  144. package/dist/server/app-ssr-entry.d.ts +6 -0
  145. package/dist/server/app-ssr-entry.js +22 -7
  146. package/dist/server/app-ssr-entry.js.map +1 -1
  147. package/dist/server/app-ssr-error-meta.js +3 -3
  148. package/dist/server/app-ssr-error-meta.js.map +1 -1
  149. package/dist/server/app-ssr-stream.d.ts +2 -1
  150. package/dist/server/app-ssr-stream.js +176 -31
  151. package/dist/server/app-ssr-stream.js.map +1 -1
  152. package/dist/server/artifact-compatibility.d.ts +2 -1
  153. package/dist/server/artifact-compatibility.js +10 -1
  154. package/dist/server/artifact-compatibility.js.map +1 -1
  155. package/dist/server/client-reuse-manifest.d.ts +9 -4
  156. package/dist/server/client-reuse-manifest.js +2 -1
  157. package/dist/server/client-reuse-manifest.js.map +1 -1
  158. package/dist/server/client-trace-metadata.d.ts +31 -0
  159. package/dist/server/client-trace-metadata.js +83 -0
  160. package/dist/server/client-trace-metadata.js.map +1 -0
  161. package/dist/server/cookie-utils.d.ts +13 -0
  162. package/dist/server/cookie-utils.js +20 -0
  163. package/dist/server/cookie-utils.js.map +1 -0
  164. package/dist/server/dev-server.d.ts +8 -1
  165. package/dist/server/dev-server.js +83 -12
  166. package/dist/server/dev-server.js.map +1 -1
  167. package/dist/server/document-initial-head.d.ts +7 -0
  168. package/dist/server/document-initial-head.js +35 -0
  169. package/dist/server/document-initial-head.js.map +1 -0
  170. package/dist/server/html.d.ts +2 -1
  171. package/dist/server/html.js +6 -1
  172. package/dist/server/html.js.map +1 -1
  173. package/dist/server/isr-cache.d.ts +7 -5
  174. package/dist/server/isr-cache.js +17 -6
  175. package/dist/server/isr-cache.js.map +1 -1
  176. package/dist/server/middleware-runtime.js +1 -2
  177. package/dist/server/middleware-runtime.js.map +1 -1
  178. package/dist/server/pages-document-initial-props.d.ts +89 -0
  179. package/dist/server/pages-document-initial-props.js +140 -0
  180. package/dist/server/pages-document-initial-props.js.map +1 -0
  181. package/dist/server/pages-node-compat.js +1 -1
  182. package/dist/server/pages-page-data.js +3 -0
  183. package/dist/server/pages-page-data.js.map +1 -1
  184. package/dist/server/pages-page-method.d.ts +48 -0
  185. package/dist/server/pages-page-method.js +19 -0
  186. package/dist/server/pages-page-method.js.map +1 -0
  187. package/dist/server/pages-page-response.d.ts +20 -0
  188. package/dist/server/pages-page-response.js +37 -7
  189. package/dist/server/pages-page-response.js.map +1 -1
  190. package/dist/server/pages-serializable-props.d.ts +25 -0
  191. package/dist/server/pages-serializable-props.js +69 -0
  192. package/dist/server/pages-serializable-props.js.map +1 -0
  193. package/dist/server/prod-server.js +16 -6
  194. package/dist/server/prod-server.js.map +1 -1
  195. package/dist/server/server-action-not-found.js +3 -2
  196. package/dist/server/server-action-not-found.js.map +1 -1
  197. package/dist/server/skip-cache-proof.d.ts +23 -2
  198. package/dist/server/skip-cache-proof.js +81 -12
  199. package/dist/server/skip-cache-proof.js.map +1 -1
  200. package/dist/server/static-file-cache.js +2 -1
  201. package/dist/server/static-file-cache.js.map +1 -1
  202. package/dist/server/static-layout-client-reuse-proof.d.ts +16 -0
  203. package/dist/server/static-layout-client-reuse-proof.js +35 -0
  204. package/dist/server/static-layout-client-reuse-proof.js.map +1 -0
  205. package/dist/shims/app-router-scroll-state.d.ts +4 -2
  206. package/dist/shims/app-router-scroll-state.js +16 -3
  207. package/dist/shims/app-router-scroll-state.js.map +1 -1
  208. package/dist/shims/app-router-scroll.d.ts +16 -2
  209. package/dist/shims/app-router-scroll.js +18 -3
  210. package/dist/shims/app-router-scroll.js.map +1 -1
  211. package/dist/shims/cache.d.ts +27 -1
  212. package/dist/shims/cache.js +108 -6
  213. package/dist/shims/cache.js.map +1 -1
  214. package/dist/shims/document.d.ts +6 -0
  215. package/dist/shims/document.js +7 -8
  216. package/dist/shims/document.js.map +1 -1
  217. package/dist/shims/error-boundary.d.ts +4 -4
  218. package/dist/shims/error-boundary.js +27 -28
  219. package/dist/shims/error-boundary.js.map +1 -1
  220. package/dist/shims/error.js +3 -0
  221. package/dist/shims/error.js.map +1 -1
  222. package/dist/shims/fetch-cache.d.ts +3 -1
  223. package/dist/shims/fetch-cache.js +16 -5
  224. package/dist/shims/fetch-cache.js.map +1 -1
  225. package/dist/shims/hash-scroll.d.ts +4 -1
  226. package/dist/shims/hash-scroll.js +13 -1
  227. package/dist/shims/hash-scroll.js.map +1 -1
  228. package/dist/shims/head-state.d.ts +1 -0
  229. package/dist/shims/head-state.js +18 -3
  230. package/dist/shims/head-state.js.map +1 -1
  231. package/dist/shims/head.d.ts +35 -1
  232. package/dist/shims/head.js +113 -14
  233. package/dist/shims/head.js.map +1 -1
  234. package/dist/shims/headers.d.ts +7 -0
  235. package/dist/shims/headers.js +9 -1
  236. package/dist/shims/headers.js.map +1 -1
  237. package/dist/shims/internal/app-route-detection.d.ts +37 -0
  238. package/dist/shims/internal/app-route-detection.js +69 -0
  239. package/dist/shims/internal/app-route-detection.js.map +1 -0
  240. package/dist/shims/internal/pages-data-fetch-dedup.d.ts +56 -0
  241. package/dist/shims/internal/pages-data-fetch-dedup.js +70 -0
  242. package/dist/shims/internal/pages-data-fetch-dedup.js.map +1 -0
  243. package/dist/shims/link.d.ts +18 -2
  244. package/dist/shims/link.js +98 -8
  245. package/dist/shims/link.js.map +1 -1
  246. package/dist/shims/metadata.d.ts +7 -6
  247. package/dist/shims/metadata.js +9 -5
  248. package/dist/shims/metadata.js.map +1 -1
  249. package/dist/shims/navigation.d.ts +40 -3
  250. package/dist/shims/navigation.js +124 -25
  251. package/dist/shims/navigation.js.map +1 -1
  252. package/dist/shims/router.d.ts +5 -0
  253. package/dist/shims/router.js +51 -21
  254. package/dist/shims/router.js.map +1 -1
  255. package/dist/shims/script.d.ts +11 -1
  256. package/dist/shims/script.js +75 -6
  257. package/dist/shims/script.js.map +1 -1
  258. package/dist/shims/thenable-params.d.ts +5 -2
  259. package/dist/shims/thenable-params.js +25 -1
  260. package/dist/shims/thenable-params.js.map +1 -1
  261. package/dist/shims/unified-request-context.js +3 -0
  262. package/dist/shims/unified-request-context.js.map +1 -1
  263. package/dist/utils/client-build-manifest.d.ts +15 -0
  264. package/dist/utils/client-build-manifest.js +54 -0
  265. package/dist/utils/client-build-manifest.js.map +1 -0
  266. package/dist/utils/hash.js +1 -1
  267. package/dist/utils/hash.js.map +1 -1
  268. package/dist/utils/lazy-chunks.d.ts +1 -1
  269. package/dist/utils/lazy-chunks.js.map +1 -1
  270. package/dist/utils/path.d.ts +13 -0
  271. package/dist/utils/path.js +16 -0
  272. package/dist/utils/path.js.map +1 -0
  273. package/dist/utils/vite-version.d.ts +11 -0
  274. package/dist/utils/vite-version.js +36 -0
  275. package/dist/utils/vite-version.js.map +1 -0
  276. package/package.json +2 -2
@@ -1,18 +1,22 @@
1
- import { addBasePathToPathname, hasBasePath } from "../utils/base-path.js";
2
- import { ACTION_REDIRECT_HEADER, ACTION_REDIRECT_STATUS_HEADER, ACTION_REDIRECT_TYPE_HEADER, ACTION_REVALIDATED_HEADER } from "./headers.js";
1
+ import { addBasePathToPathname, hasBasePath, stripBasePath } from "../utils/base-path.js";
2
+ import { ACTION_FORWARDED_HEADER, ACTION_REDIRECT_HEADER, ACTION_REDIRECT_STATUS_HEADER, ACTION_REDIRECT_TYPE_HEADER, ACTION_REVALIDATED_HEADER } from "./headers.js";
3
3
  import { isExternalUrl } from "../config/config-matchers.js";
4
4
  import { internalServerErrorResponse, payloadTooLargeResponse } from "./http-error-responses.js";
5
5
  import { validateCsrfOrigin, validateServerActionPayload } from "./request-pipeline.js";
6
+ import { headersContextFromRequest, setHeadersContext } from "../shims/headers.js";
6
7
  import { getAndClearActionRevalidationKind } from "../shims/cache.js";
7
8
  import { APP_RSC_RENDER_MODE_ACTION_RERENDER_PRESERVE_UI } from "./app-rsc-render-mode.js";
8
- import { setCurrentFetchCacheMode } from "../shims/fetch-cache.js";
9
+ import { setCurrentFetchCacheMode, setCurrentFetchSoftTags } from "../shims/fetch-cache.js";
9
10
  import { VINEXT_RSC_CONTENT_TYPE, VINEXT_RSC_VARY_HEADER, applyRscCompatibilityIdHeader } from "./app-rsc-cache-busting.js";
11
+ import { readStreamAsTextWithLimit } from "../utils/text-stream.js";
10
12
  import { createServerActionNotFoundResponse, getServerActionNotFoundMessage, isServerActionNotFoundError } from "./server-action-not-found.js";
11
13
  import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
12
14
  import { applyEdgeRuntimeHeader } from "./app-page-response.js";
13
15
  import { getNextErrorDigest, parseNextHttpErrorDigest, parseNextRedirectDigest } from "./next-error-digest.js";
14
- import { readStreamAsTextWithLimit } from "../utils/text-stream.js";
16
+ import { deferUntilStreamConsumed } from "./app-page-stream.js";
15
17
  import { resolveAppPageActionRerenderTarget } from "./app-page-request.js";
18
+ import { buildPageCacheTags } from "./implicit-tags.js";
19
+ import { getSetCookieName } from "./cookie-utils.js";
16
20
  //#region src/server/app-server-action-execution.ts
17
21
  /**
18
22
  * Matches Next.js' server action argument cap to prevent stack overflow in
@@ -21,6 +25,16 @@ import { resolveAppPageActionRerenderTarget } from "./app-page-request.js";
21
25
  const SERVER_ACTION_ARGS_LIMIT = 1e3;
22
26
  const ACTION_DID_NOT_REVALIDATE = 0;
23
27
  const ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC = 1;
28
+ const ACTION_REDIRECT_RENDER_STRIPPED_HEADERS = [
29
+ "accept",
30
+ "content-length",
31
+ "content-type",
32
+ "next-action",
33
+ "origin",
34
+ "rsc",
35
+ "x-action-forwarded",
36
+ "x-rsc-action"
37
+ ];
24
38
  function setActionRevalidatedHeader(headers, kind) {
25
39
  if (kind === ACTION_DID_NOT_REVALIDATE) return;
26
40
  headers.set(ACTION_REVALIDATED_HEADER, JSON.stringify(kind));
@@ -30,9 +44,96 @@ function resolveActionRevalidationKind(hasModifiedCookies) {
30
44
  if (hasModifiedCookies) return ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC;
31
45
  return revalidationKind;
32
46
  }
47
+ function cloneActionRedirectHeaders(requestHeaders) {
48
+ const headers = new Headers(requestHeaders);
49
+ for (const header of ACTION_REDIRECT_RENDER_STRIPPED_HEADERS) headers.delete(header);
50
+ return headers;
51
+ }
52
+ function readSetCookieNameValue(setCookie) {
53
+ const equalsIndex = setCookie.indexOf("=");
54
+ if (equalsIndex <= 0) return null;
55
+ const name = setCookie.slice(0, equalsIndex).trim();
56
+ const valueEnd = setCookie.indexOf(";", equalsIndex + 1);
57
+ return {
58
+ name,
59
+ value: setCookie.slice(equalsIndex + 1, valueEnd === -1 ? void 0 : valueEnd)
60
+ };
61
+ }
62
+ function isExpiredSetCookie(setCookie) {
63
+ return /(?:^|;\s*)max-age=0(?:;|$)/i.test(setCookie) || /(?:^|;\s*)expires=Thu,\s*0?1[\s-]+Jan[\s-]+1970/i.test(setCookie);
64
+ }
65
+ function applySetCookieMutationsToRequestCookieHeader(cookieHeader, setCookies) {
66
+ const cookies = /* @__PURE__ */ new Map();
67
+ if (cookieHeader) for (const part of cookieHeader.split(";")) {
68
+ const trimmed = part.trim();
69
+ if (!trimmed) continue;
70
+ const equalsIndex = trimmed.indexOf("=");
71
+ if (equalsIndex <= 0) continue;
72
+ cookies.set(trimmed.slice(0, equalsIndex), trimmed.slice(equalsIndex + 1));
73
+ }
74
+ for (const setCookie of setCookies) {
75
+ const entry = readSetCookieNameValue(setCookie);
76
+ if (!entry) continue;
77
+ if (isExpiredSetCookie(setCookie)) cookies.delete(entry.name);
78
+ else cookies.set(entry.name, entry.value);
79
+ }
80
+ return cookies.size === 0 ? null : [...cookies].map(([name, value]) => `${name}=${value}`).join("; ");
81
+ }
82
+ function createActionRedirectRenderRequest(options) {
83
+ const headers = cloneActionRedirectHeaders(options.request.headers);
84
+ const cookieHeader = applySetCookieMutationsToRequestCookieHeader(headers.get("cookie"), options.pendingCookies);
85
+ if (cookieHeader === null) headers.delete("cookie");
86
+ else headers.set("cookie", cookieHeader);
87
+ return new Request(options.url, {
88
+ headers,
89
+ method: "GET"
90
+ });
91
+ }
92
+ function withoutRscBodyHeaders(headers) {
93
+ const nextHeaders = new Headers(headers);
94
+ nextHeaders.delete("Content-Type");
95
+ nextHeaders.delete("Vary");
96
+ return nextHeaders;
97
+ }
98
+ function isReadableStreamBody(body) {
99
+ return typeof ReadableStream !== "undefined" && body instanceof ReadableStream;
100
+ }
101
+ function createServerActionRscResponse(body, init, clearRequestContext) {
102
+ if (!isReadableStreamBody(body)) {
103
+ clearRequestContext();
104
+ return new Response(body, init);
105
+ }
106
+ return new Response(deferUntilStreamConsumed(body, clearRequestContext), init);
107
+ }
33
108
  function isRequestBodyTooLarge(error) {
34
109
  return error instanceof Error && error.message === "Request body too large";
35
110
  }
111
+ /**
112
+ * Collapse repeated `cookies().set(name, ...)` / `cookies().delete(name)`
113
+ * calls down to the last value per name, matching Next.js'
114
+ * `MutableRequestCookiesAdapter` semantics. Next.js stores response cookies in
115
+ * a `ResponseCookies` Map keyed by name — multiple sets for the same cookie
116
+ * collapse to the final value, and emit a single Set-Cookie header.
117
+ *
118
+ * Insertion order is preserved by first occurrence (Map iteration order),
119
+ * which mirrors how `ResponseCookies` iterates its underlying Map. See
120
+ * packages/next/src/server/web/spec-extension/adapters/request-cookies.ts.
121
+ * Issue: https://github.com/cloudflare/vinext/issues/1481
122
+ */
123
+ function dedupePendingCookies(cookies) {
124
+ if (cookies.length <= 1) return cookies.slice();
125
+ const byName = /* @__PURE__ */ new Map();
126
+ const unkeyed = [];
127
+ for (const cookie of cookies) {
128
+ const name = getSetCookieName(cookie);
129
+ if (name === null) {
130
+ unkeyed.push(cookie);
131
+ continue;
132
+ }
133
+ byName.set(name, cookie);
134
+ }
135
+ return [...unkeyed, ...byName.values()];
136
+ }
36
137
  function isAppServerActionFunction(action) {
37
138
  return typeof action === "function";
38
139
  }
@@ -120,6 +221,56 @@ function applyActionRedirectBasePath(url, basePath) {
120
221
  const suffix = splitAt === -1 ? "" : url.slice(splitAt);
121
222
  return `${addBasePathToPathname(pathname, basePath)}${suffix}`;
122
223
  }
224
+ function buildServerActionPageTags(route, pathname) {
225
+ return buildPageCacheTags(pathname, [], [...route.routeSegments ?? []], "page");
226
+ }
227
+ function resolveInternalActionRedirectTarget(redirectUrl, requestUrl, basePath) {
228
+ if (isExternalUrl(redirectUrl)) {
229
+ const requestOrigin = new URL(requestUrl).origin;
230
+ const parsed = new URL(redirectUrl);
231
+ if (parsed.origin !== requestOrigin) return null;
232
+ if (basePath && !hasBasePath(parsed.pathname, basePath)) return null;
233
+ return parsed;
234
+ }
235
+ let resolvedBase = requestUrl;
236
+ if (!redirectUrl.startsWith("/") && !/^[a-z]+:/i.test(redirectUrl)) {
237
+ const parsedRequestUrl = new URL(requestUrl);
238
+ let pathname = parsedRequestUrl.pathname;
239
+ if (!pathname.endsWith("/")) pathname = pathname + "/";
240
+ resolvedBase = `${parsedRequestUrl.origin}${pathname}${parsedRequestUrl.search}`;
241
+ }
242
+ return new URL(redirectUrl, resolvedBase);
243
+ }
244
+ function isAncestorRouteRedirect(targetPathname, currentPathname) {
245
+ return targetPathname !== "/" && currentPathname.startsWith(`${targetPathname}/`);
246
+ }
247
+ function splitActionRedirectPathname(pathname) {
248
+ return pathname.split("/").filter(Boolean);
249
+ }
250
+ function isStaleChildSiblingRouteRedirect(targetPathname, currentPathname) {
251
+ const targetSegments = splitActionRedirectPathname(targetPathname);
252
+ const currentSegments = splitActionRedirectPathname(currentPathname);
253
+ if (targetSegments.length === 0 || currentSegments.length <= targetSegments.length) return false;
254
+ let commonPrefixLength = 0;
255
+ const maxPrefixLength = Math.min(targetSegments.length, currentSegments.length);
256
+ while (commonPrefixLength < maxPrefixLength && targetSegments[commonPrefixLength] === currentSegments[commonPrefixLength]) commonPrefixLength++;
257
+ return commonPrefixLength > 0 && commonPrefixLength < targetSegments.length;
258
+ }
259
+ function normalizeRuntime(runtime) {
260
+ if (runtime === "edge" || runtime === "experimental-edge") return "edge";
261
+ return "nodejs";
262
+ }
263
+ function shouldUseForwardedActionRedirectStatus(options) {
264
+ if (options.actionWasForwarded) return true;
265
+ if (isAncestorRouteRedirect(options.targetPathname, options.currentPathname)) return true;
266
+ if (isStaleChildSiblingRouteRedirect(options.targetPathname, options.currentPathname)) return true;
267
+ if (!options.currentRoute || !options.resolveRouteRuntime) return false;
268
+ return normalizeRuntime(options.resolveRouteRuntime(options.currentRoute)) !== normalizeRuntime(options.resolveRouteRuntime(options.targetRoute));
269
+ }
270
+ function canRenderActionRedirectTarget(route) {
271
+ if ("routeHandler" in route && route.routeHandler) return false;
272
+ return route.page !== null && route.page !== void 0;
273
+ }
123
274
  function getActionHttpFallbackStatus(error) {
124
275
  const digest = getNextErrorDigest(error);
125
276
  if (!digest) return null;
@@ -153,10 +304,6 @@ function isProgressiveServerActionRequest(request, contentType, actionId) {
153
304
  }
154
305
  async function handleProgressiveServerActionRequest(options) {
155
306
  if (!isProgressiveServerActionRequest(options.request, options.contentType, options.actionId)) return null;
156
- if (options.request.headers.get("x-action-forwarded")) return createActionNotFoundResponse(null, {
157
- clearRequestContext: options.clearRequestContext,
158
- getAndClearPendingCookies: options.getAndClearPendingCookies
159
- });
160
307
  const csrfResponse = validateCsrfOrigin(options.request, options.allowedOrigins);
161
308
  if (csrfResponse) return csrfResponse;
162
309
  if (parseInt(options.request.headers.get("content-length") || "0", 10) > options.maxActionBodySize) {
@@ -210,19 +357,27 @@ async function handleProgressiveServerActionRequest(options) {
210
357
  options.setHeadersAccessPhase(previousHeadersPhase);
211
358
  }
212
359
  if (!actionRedirect) {
213
- getAndClearActionRevalidationKind();
360
+ const actionPendingCookies = options.getAndClearPendingCookies();
361
+ const actionDraftCookie = options.getDraftModeCookieHeader();
362
+ const revalidationKind = resolveActionRevalidationKind(actionPendingCookies.length > 0 || Boolean(actionDraftCookie));
214
363
  if (actionFailed) return {
215
364
  kind: "form-state",
216
365
  formState: null,
217
366
  actionError,
218
- actionFailed
367
+ actionFailed,
368
+ pendingCookies: actionPendingCookies,
369
+ draftCookie: actionDraftCookie,
370
+ revalidationKind
219
371
  };
220
372
  return {
221
373
  kind: "form-state",
222
- formState: await options.decodeFormState(actionResult, body) ?? null
374
+ formState: await options.decodeFormState(actionResult, body) ?? null,
375
+ pendingCookies: actionPendingCookies,
376
+ draftCookie: actionDraftCookie,
377
+ revalidationKind
223
378
  };
224
379
  }
225
- const actionPendingCookies = options.getAndClearPendingCookies();
380
+ const actionPendingCookies = dedupePendingCookies(options.getAndClearPendingCookies());
226
381
  const actionDraftCookie = options.getDraftModeCookieHeader();
227
382
  const actionRevalidationKind = resolveActionRevalidationKind(actionPendingCookies.length > 0 || Boolean(actionDraftCookie));
228
383
  options.clearRequestContext();
@@ -260,10 +415,6 @@ async function handleProgressiveServerActionRequest(options) {
260
415
  }
261
416
  async function handleServerActionRscRequest(options) {
262
417
  if (options.request.method.toUpperCase() !== "POST" || !options.actionId) return null;
263
- if (options.request.headers.get("x-action-forwarded")) return createActionNotFoundResponse(options.actionId, {
264
- clearRequestContext: options.clearRequestContext,
265
- getAndClearPendingCookies: options.getAndClearPendingCookies
266
- });
267
418
  const csrfResponse = validateCsrfOrigin(options.request, options.allowedOrigins);
268
419
  if (csrfResponse) return csrfResponse;
269
420
  if (parseInt(options.request.headers.get("content-length") || "0", 10) > options.maxActionBodySize) {
@@ -305,6 +456,7 @@ async function handleServerActionRscRequest(options) {
305
456
  let returnValue;
306
457
  let actionRedirect = null;
307
458
  let actionStatus = 200;
459
+ const actionWasForwarded = Boolean(options.request.headers.get(ACTION_FORWARDED_HEADER));
308
460
  const previousHeadersPhase = options.setHeadersAccessPhase("action");
309
461
  try {
310
462
  try {
@@ -340,10 +492,9 @@ async function handleServerActionRscRequest(options) {
340
492
  options.setHeadersAccessPhase(previousHeadersPhase);
341
493
  }
342
494
  if (actionRedirect) {
343
- const actionPendingCookies = options.getAndClearPendingCookies();
495
+ const actionPendingCookies = dedupePendingCookies(options.getAndClearPendingCookies());
344
496
  const actionDraftCookie = options.getDraftModeCookieHeader();
345
497
  const actionRevalidationKind = resolveActionRevalidationKind(actionPendingCookies.length > 0 || Boolean(actionDraftCookie));
346
- options.clearRequestContext();
347
498
  const redirectHeaders = new Headers({
348
499
  "Content-Type": VINEXT_RSC_CONTENT_TYPE,
349
500
  Vary: VINEXT_RSC_VARY_HEADER
@@ -351,27 +502,83 @@ async function handleServerActionRscRequest(options) {
351
502
  applyEdgeRuntimeHeader(redirectHeaders, options.isEdgeRuntime);
352
503
  mergeMiddlewareResponseHeaders(redirectHeaders, options.middlewareHeaders);
353
504
  applyRscCompatibilityIdHeader(redirectHeaders);
354
- redirectHeaders.set(ACTION_REDIRECT_HEADER, applyActionRedirectBasePath(actionRedirect.url, options.basePath ?? ""));
505
+ const actionRedirectUrl = applyActionRedirectBasePath(actionRedirect.url, options.basePath ?? "");
506
+ redirectHeaders.set(ACTION_REDIRECT_HEADER, actionRedirectUrl);
355
507
  redirectHeaders.set(ACTION_REDIRECT_TYPE_HEADER, actionRedirect.type);
356
508
  redirectHeaders.set(ACTION_REDIRECT_STATUS_HEADER, String(actionRedirect.status));
357
509
  for (const cookie of actionPendingCookies) redirectHeaders.append("Set-Cookie", cookie);
358
510
  if (actionDraftCookie) redirectHeaders.append("Set-Cookie", actionDraftCookie);
359
511
  setActionRevalidatedHeader(redirectHeaders, actionRevalidationKind);
360
- return new Response("", {
361
- status: 200,
362
- headers: redirectHeaders
512
+ const redirectTarget = resolveInternalActionRedirectTarget(actionRedirectUrl, options.request.url, options.basePath ?? "");
513
+ if (!redirectTarget) {
514
+ options.clearRequestContext();
515
+ return new Response(null, {
516
+ status: 303,
517
+ headers: withoutRscBodyHeaders(redirectHeaders)
518
+ });
519
+ }
520
+ const targetPathname = stripBasePath(redirectTarget.pathname, options.basePath ?? "");
521
+ const targetMatch = options.matchRoute(targetPathname);
522
+ if (!targetMatch || !canRenderActionRedirectTarget(targetMatch.route)) {
523
+ options.clearRequestContext();
524
+ return new Response(null, {
525
+ status: 303,
526
+ headers: withoutRscBodyHeaders(redirectHeaders)
527
+ });
528
+ }
529
+ const currentMatch = options.matchRoute(options.cleanPathname);
530
+ const redirectRenderRequest = createActionRedirectRenderRequest({
531
+ pendingCookies: [...actionPendingCookies, ...actionDraftCookie ? [actionDraftCookie] : []],
532
+ request: options.request,
533
+ url: redirectTarget
534
+ });
535
+ setHeadersContext(headersContextFromRequest(redirectRenderRequest));
536
+ options.setNavigationContext({
537
+ pathname: targetPathname,
538
+ searchParams: redirectTarget.searchParams,
539
+ params: targetMatch.params
540
+ });
541
+ setCurrentFetchCacheMode(options.resolveRouteFetchCacheMode?.(targetMatch.route) ?? null);
542
+ setCurrentFetchSoftTags(buildServerActionPageTags(targetMatch.route, targetPathname));
543
+ const element = options.buildPageElement({
544
+ cleanPathname: targetPathname,
545
+ interceptOpts: void 0,
546
+ isRscRequest: true,
547
+ mountedSlotsHeader: null,
548
+ params: targetMatch.params,
549
+ request: redirectRenderRequest,
550
+ route: targetMatch.route,
551
+ searchParams: redirectTarget.searchParams,
552
+ renderMode: APP_RSC_RENDER_MODE_ACTION_RERENDER_PRESERVE_UI
363
553
  });
554
+ const onRenderError = options.createRscOnErrorHandler(redirectRenderRequest, targetPathname, targetMatch.route.pattern);
555
+ return createServerActionRscResponse(await options.renderToReadableStream({
556
+ root: element,
557
+ returnValue
558
+ }, {
559
+ temporaryReferences,
560
+ onError: onRenderError
561
+ }), {
562
+ status: shouldUseForwardedActionRedirectStatus({
563
+ actionWasForwarded,
564
+ currentPathname: options.cleanPathname,
565
+ currentRoute: currentMatch?.route ?? null,
566
+ resolveRouteRuntime: options.resolveRouteRuntime,
567
+ targetPathname,
568
+ targetRoute: targetMatch.route
569
+ }) ? 200 : 303,
570
+ headers: redirectHeaders
571
+ }, options.clearRequestContext);
364
572
  }
365
- const actionPendingCookies = options.getAndClearPendingCookies();
573
+ const actionPendingCookies = dedupePendingCookies(options.getAndClearPendingCookies());
366
574
  const actionDraftCookie = options.getDraftModeCookieHeader();
367
575
  const actionRevalidationKind = resolveActionRevalidationKind(actionPendingCookies.length > 0 || Boolean(actionDraftCookie));
368
- if (actionRevalidationKind === ACTION_DID_NOT_REVALIDATE) {
576
+ if (actionWasForwarded || actionStatus === 200 && actionRevalidationKind === ACTION_DID_NOT_REVALIDATE) {
369
577
  const onRenderError = options.createRscOnErrorHandler(options.request, options.cleanPathname, options.cleanPathname);
370
578
  const rscStream = await options.renderToReadableStream({ returnValue }, {
371
579
  temporaryReferences,
372
580
  onError: onRenderError
373
581
  });
374
- options.clearRequestContext();
375
582
  const actionHeaders = new Headers({
376
583
  "Content-Type": VINEXT_RSC_CONTENT_TYPE,
377
584
  Vary: VINEXT_RSC_VARY_HEADER
@@ -379,10 +586,13 @@ async function handleServerActionRscRequest(options) {
379
586
  applyEdgeRuntimeHeader(actionHeaders, options.isEdgeRuntime);
380
587
  mergeMiddlewareResponseHeaders(actionHeaders, options.middlewareHeaders);
381
588
  applyRscCompatibilityIdHeader(actionHeaders);
382
- return new Response(rscStream, {
589
+ for (const cookie of actionPendingCookies) actionHeaders.append("Set-Cookie", cookie);
590
+ if (actionDraftCookie) actionHeaders.append("Set-Cookie", actionDraftCookie);
591
+ setActionRevalidatedHeader(actionHeaders, actionRevalidationKind);
592
+ return createServerActionRscResponse(rscStream, {
383
593
  status: options.middlewareStatus ?? actionStatus,
384
594
  headers: actionHeaders
385
- });
595
+ }, options.clearRequestContext);
386
596
  }
387
597
  const match = options.matchRoute(options.cleanPathname);
388
598
  let element;
@@ -405,6 +615,7 @@ async function handleServerActionRscRequest(options) {
405
615
  params: actionRerenderTarget.navigationParams
406
616
  });
407
617
  setCurrentFetchCacheMode(options.resolveRouteFetchCacheMode?.(actionRerenderTarget.route) ?? null);
618
+ setCurrentFetchSoftTags(buildServerActionPageTags(actionRerenderTarget.route, options.cleanPathname));
408
619
  element = options.buildPageElement({
409
620
  cleanPathname: options.cleanPathname,
410
621
  interceptOpts: actionRerenderTarget.interceptOpts,
@@ -437,10 +648,10 @@ async function handleServerActionRscRequest(options) {
437
648
  mergeMiddlewareResponseHeaders(actionHeaders, options.middlewareHeaders);
438
649
  applyRscCompatibilityIdHeader(actionHeaders);
439
650
  setActionRevalidatedHeader(actionHeaders, actionRevalidationKind);
440
- const actionResponse = new Response(rscStream, {
651
+ const actionResponse = createServerActionRscResponse(rscStream, {
441
652
  status: options.middlewareStatus ?? actionStatus,
442
653
  headers: actionHeaders
443
- });
654
+ }, options.clearRequestContext);
444
655
  if (actionPendingCookies.length > 0 || actionDraftCookie) {
445
656
  for (const cookie of actionPendingCookies) actionResponse.headers.append("Set-Cookie", cookie);
446
657
  if (actionDraftCookie) actionResponse.headers.append("Set-Cookie", actionDraftCookie);
@@ -1 +1 @@
1
- {"version":3,"file":"app-server-action-execution.js","names":[],"sources":["../../src/server/app-server-action-execution.ts"],"sourcesContent":["import { getAndClearActionRevalidationKind, type ActionRevalidationKind } from \"vinext/shims/cache\";\nimport type { HeadersAccessPhase } from \"vinext/shims/headers\";\nimport { type FetchCacheMode, setCurrentFetchCacheMode } from \"vinext/shims/fetch-cache\";\nimport type { ReactFormState } from \"react-dom/client\";\nimport { isExternalUrl } from \"../config/config-matchers.js\";\nimport { addBasePathToPathname, hasBasePath } from \"../utils/base-path.js\";\nimport {\n ACTION_FORWARDED_HEADER,\n ACTION_REDIRECT_HEADER,\n ACTION_REDIRECT_STATUS_HEADER,\n ACTION_REDIRECT_TYPE_HEADER,\n ACTION_REVALIDATED_HEADER,\n} from \"./headers.js\";\nimport {\n VINEXT_RSC_CONTENT_TYPE,\n VINEXT_RSC_VARY_HEADER,\n applyRscCompatibilityIdHeader,\n} from \"./app-rsc-cache-busting.js\";\nimport { applyEdgeRuntimeHeader } from \"./app-page-response.js\";\nimport { resolveAppPageActionRerenderTarget } from \"./app-page-request.js\";\nimport { mergeMiddlewareResponseHeaders } from \"./middleware-response-headers.js\";\nimport {\n APP_RSC_RENDER_MODE_ACTION_RERENDER_PRESERVE_UI,\n type AppRscRenderMode,\n} from \"./app-rsc-render-mode.js\";\nimport {\n getNextErrorDigest,\n parseNextHttpErrorDigest,\n parseNextRedirectDigest,\n} from \"./next-error-digest.js\";\nimport { validateCsrfOrigin, validateServerActionPayload } from \"./request-pipeline.js\";\nimport { readStreamAsTextWithLimit } from \"../utils/text-stream.js\";\nimport {\n createServerActionNotFoundResponse,\n getServerActionNotFoundMessage,\n isServerActionNotFoundError,\n} from \"./server-action-not-found.js\";\nimport { internalServerErrorResponse, payloadTooLargeResponse } from \"./http-error-responses.js\";\n\ntype AppPageParams = Record<string, string | string[]>;\n\ntype AppServerActionErrorReporter = (\n error: Error,\n request: { path: string; method: string; headers: Record<string, string> },\n route: { routerKind: \"App Router\"; routePath: string; routeType: \"action\" },\n) => void;\n\ntype AppServerActionDecoder = (body: FormData) => Promise<unknown>;\ntype AppServerActionFormStateDecoder = (\n actionResult: unknown,\n body: FormData,\n) => Promise<ReactFormState | undefined>;\n\ntype ReadFormDataWithLimit = (request: Request, maxBytes: number) => Promise<FormData>;\n\ntype ReadBodyWithLimit = (request: Request, maxBytes: number) => Promise<string>;\n\ntype AppServerActionFunction = (...args: unknown[]) => unknown;\n\ntype AppServerActionReturnValue =\n | {\n data: unknown;\n ok: true;\n }\n | {\n data: unknown;\n ok: false;\n };\n\ntype AppServerActionRedirect = {\n status: number;\n type: string;\n url: string;\n};\n\ntype AppServerActionRoute = {\n pattern: string;\n};\n\ntype ProgressiveServerActionResult =\n | {\n formState: ReactFormState | null;\n kind: \"form-state\";\n }\n | {\n actionError: unknown;\n actionFailed: true;\n formState: null;\n kind: \"form-state\";\n };\n\ntype AppServerActionMatch<TRoute extends AppServerActionRoute> = {\n params: AppPageParams;\n route: TRoute;\n};\n\ntype AppServerActionIntercept<TPage = unknown> = {\n matchedParams: AppPageParams;\n page: TPage;\n slotId?: string | null;\n slotKey: string;\n sourceRouteIndex: number;\n};\n\ntype BuildServerActionPageElementOptions<TRoute extends AppServerActionRoute, TInterceptOpts> = {\n cleanPathname: string;\n interceptOpts: TInterceptOpts | undefined;\n isRscRequest: boolean;\n mountedSlotsHeader: string | null;\n params: AppPageParams;\n request: Request;\n route: TRoute;\n searchParams: URLSearchParams;\n renderMode: AppRscRenderMode;\n};\n\ntype AppServerActionRscModel<TElement> = {\n /**\n * Omitted when the action did not invalidate page data. This mirrors Next.js'\n * empty Flight payload for non-revalidating fetch actions: the client resolves\n * the action value without committing a visible router update.\n */\n root?: TElement;\n returnValue: AppServerActionReturnValue;\n};\n\ntype RenderServerActionRscStreamOptions<TTemporaryReferences> = {\n onError: (error: unknown) => unknown;\n temporaryReferences: TTemporaryReferences;\n};\n\ntype DecodeServerActionReplyOptions<TTemporaryReferences> = {\n temporaryReferences: TTemporaryReferences;\n};\n\nexport type HandleProgressiveServerActionRequestOptions = {\n actionId: string | null;\n allowedOrigins: string[];\n /** Configured next.config `basePath`. Prefixed onto progressive Location targets. */\n basePath?: string;\n cleanPathname: string;\n clearRequestContext: () => void;\n contentType: string;\n decodeAction: AppServerActionDecoder;\n decodeFormState: AppServerActionFormStateDecoder;\n getAndClearPendingCookies: () => string[];\n getDraftModeCookieHeader: () => string | null | undefined;\n maxActionBodySize: number;\n middlewareHeaders: Headers | null;\n readFormDataWithLimit: ReadFormDataWithLimit;\n reportRequestError: AppServerActionErrorReporter;\n request: Request;\n setHeadersAccessPhase: (phase: HeadersAccessPhase) => HeadersAccessPhase;\n};\n\nexport type HandleServerActionRscRequestOptions<\n TElement,\n TRoute extends AppServerActionRoute,\n TInterceptOpts,\n TTemporaryReferences,\n TPage = unknown,\n> = {\n actionId: string | null;\n allowedOrigins: string[];\n /** Configured next.config `basePath`. Prefixed onto ACTION_REDIRECT_HEADER targets. */\n basePath?: string;\n buildPageElement: (\n options: BuildServerActionPageElementOptions<TRoute, TInterceptOpts>,\n ) => TElement;\n cleanPathname: string;\n clearRequestContext: () => void;\n contentType: string;\n createNotFoundElement: (routeId: string) => TElement;\n createPayloadRouteId: (pathname: string, interceptionContext: string | null) => string;\n createRscOnErrorHandler: (\n request: Request,\n pathname: string,\n pattern: string,\n ) => (error: unknown) => unknown;\n createTemporaryReferenceSet: () => TTemporaryReferences;\n decodeReply: (\n body: string | FormData,\n options: DecodeServerActionReplyOptions<TTemporaryReferences>,\n ) => Promise<unknown[]> | unknown[];\n findIntercept: (pathname: string) => AppServerActionIntercept<TPage> | null;\n getAndClearPendingCookies: () => string[];\n getDraftModeCookieHeader: () => string | null | undefined;\n getRouteParamNames: (route: TRoute) => readonly string[];\n getSourceRoute: (sourceRouteIndex: number) => TRoute | undefined;\n isEdgeRuntime?: boolean;\n isRscRequest: boolean;\n loadServerAction: (actionId: string) => Promise<unknown>;\n matchRoute: (pathname: string) => AppServerActionMatch<TRoute> | null;\n maxActionBodySize: number;\n middlewareHeaders: Headers | null;\n middlewareStatus: number | null | undefined;\n mountedSlotsHeader: string | null;\n readBodyWithLimit: ReadBodyWithLimit;\n readFormDataWithLimit: ReadFormDataWithLimit;\n renderToReadableStream: (\n model: AppServerActionRscModel<TElement>,\n options: RenderServerActionRscStreamOptions<TTemporaryReferences>,\n ) => BodyInit | null | Promise<BodyInit | null>;\n reportRequestError: AppServerActionErrorReporter;\n resolveRouteFetchCacheMode?: (route: TRoute) => FetchCacheMode | null;\n request: Request;\n sanitizeErrorForClient: (error: unknown) => unknown;\n searchParams: URLSearchParams;\n setHeadersAccessPhase: (phase: HeadersAccessPhase) => HeadersAccessPhase;\n setNavigationContext: (context: {\n params: AppPageParams;\n pathname: string;\n searchParams: URLSearchParams;\n }) => void;\n toInterceptOpts: (intercept: AppServerActionIntercept<TPage>) => TInterceptOpts;\n};\n\n/**\n * Matches Next.js' server action argument cap to prevent stack overflow in\n * Function.prototype.apply when decoding hostile action payloads.\n */\nconst SERVER_ACTION_ARGS_LIMIT = 1000;\nconst ACTION_DID_NOT_REVALIDATE = 0 satisfies ActionRevalidationKind;\nconst ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC = 1 satisfies ActionRevalidationKind;\n\nfunction setActionRevalidatedHeader(headers: Headers, kind: ActionRevalidationKind): void {\n if (kind === ACTION_DID_NOT_REVALIDATE) return;\n headers.set(ACTION_REVALIDATED_HEADER, JSON.stringify(kind));\n}\n\nfunction resolveActionRevalidationKind(hasModifiedCookies: boolean): ActionRevalidationKind {\n const revalidationKind = getAndClearActionRevalidationKind();\n // Cookie mutations are a hard override to STATIC_AND_DYNAMIC: any cookie\n // change can invalidate downstream cached payloads regardless of what\n // (if anything) the action explicitly revalidated, so we always emit the\n // strongest kind. STATIC_AND_DYNAMIC is also the lowest numeric value, so\n // this matches the max-precedence semantics in markActionRevalidation.\n if (hasModifiedCookies) return ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC;\n return revalidationKind;\n}\n\nfunction isRequestBodyTooLarge(error: unknown): boolean {\n return error instanceof Error && error.message === \"Request body too large\";\n}\n\nfunction isAppServerActionFunction(action: unknown): action is AppServerActionFunction {\n return typeof action === \"function\";\n}\n\nfunction normalizeError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\nfunction getServerActionFailureMessage(error: unknown): string {\n return error instanceof Error && error.message ? error.message : String(error);\n}\n\nfunction validateServerActionArgs(args: readonly unknown[]): void {\n if (args.length > SERVER_ACTION_ARGS_LIMIT) {\n throw new Error(\n `Server Action arguments list is too long (${args.length}). Maximum allowed is ${SERVER_ACTION_ARGS_LIMIT}.`,\n );\n }\n}\n\nexport async function readActionBodyWithLimit(request: Request, maxBytes: number): Promise<string> {\n if (!request.body) return \"\";\n return readStreamAsTextWithLimit(request.body, maxBytes, () => {\n throw new Error(\"Request body too large\");\n });\n}\n\nexport async function readActionFormDataWithLimit(\n request: Request,\n maxBytes: number,\n): Promise<FormData> {\n if (!request.body) return new FormData();\n\n const reader = request.body.getReader();\n const chunks: Uint8Array[] = [];\n let totalSize = 0;\n\n for (;;) {\n const result = await reader.read();\n if (result.done) break;\n\n totalSize += result.value.byteLength;\n if (totalSize > maxBytes) {\n await reader.cancel();\n throw new Error(\"Request body too large\");\n }\n chunks.push(result.value);\n }\n\n const combined = new Uint8Array(totalSize);\n let offset = 0;\n for (const chunk of chunks) {\n combined.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return new Response(combined, {\n headers: { \"Content-Type\": request.headers.get(\"content-type\") || \"\" },\n }).formData();\n}\n\nfunction getActionRedirect(error: unknown): AppServerActionRedirect | null {\n const digest = getNextErrorDigest(error);\n if (!digest) return null;\n\n const redirect = parseNextRedirectDigest(digest);\n if (!redirect) return null;\n\n return {\n status: redirect.status,\n type: redirect.type ?? \"push\",\n url: redirect.url,\n };\n}\n\n/**\n * Prepend the configured next.config `basePath` to a server-action redirect\n * target before it goes on the wire.\n *\n * `redirect(\"/foo\")` called from a server action mounted at `/base/...` must\n * land the browser at `/base/foo`, mirroring how Next.js threads basePath\n * through `addPathPrefix(getURLFromRedirectError(err), basePath)` in\n * `app-render.tsx` for SSR redirects and in `action-handler.ts` for action\n * redirects.\n *\n * Idempotent and external-aware:\n * - Empty basePath → returned unchanged.\n * - External URLs (`http://`, `https://`, `data:`, protocol-relative `//`)\n * are returned unchanged because the framework does not own those routes.\n * - Targets that already start with the configured basePath are returned\n * unchanged so this helper can be applied at any layer without risk of\n * double-prefixing (`/base/base/foo`).\n *\n * Exported for tests. Used by both the progressive (no-JS form POST) and\n * RSC (`ACTION_REDIRECT_HEADER`) action redirect paths below.\n *\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/action-handler.ts\n */\nexport function applyActionRedirectBasePath(url: string, basePath: string): string {\n if (!basePath) return url;\n if (isExternalUrl(url)) return url;\n // Pathnames that already include basePath are returned as-is.\n if (hasBasePath(url, basePath)) return url;\n // Relative or hash/query-only targets cannot be prefixed safely without an\n // origin; leave them to the caller's URL resolution.\n if (!url.startsWith(\"/\")) return url;\n // Split off optional query+hash so addBasePathToPathname only operates on\n // the path. We must accept hash too because Next.js redirect targets may\n // contain \"#anchor\".\n const queryIndex = url.indexOf(\"?\");\n const hashIndex = url.indexOf(\"#\");\n const splitAt =\n queryIndex === -1 ? hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);\n const pathname = splitAt === -1 ? url : url.slice(0, splitAt);\n const suffix = splitAt === -1 ? \"\" : url.slice(splitAt);\n return `${addBasePathToPathname(pathname, basePath)}${suffix}`;\n}\n\nfunction getActionHttpFallbackStatus(error: unknown): number | null {\n const digest = getNextErrorDigest(error);\n if (!digest) return null;\n\n const httpError = parseNextHttpErrorDigest(digest);\n if (!httpError || !Number.isInteger(httpError.status)) return null;\n\n return httpError.status;\n}\n\nfunction createServerActionErrorResponse(\n error: unknown,\n options: {\n cleanPathname: string;\n clearRequestContext: () => void;\n getAndClearPendingCookies: () => string[];\n reportRequestError: AppServerActionErrorReporter;\n request: Request;\n },\n): Response {\n options.getAndClearPendingCookies();\n console.error(\"[vinext] Server action error:\", error);\n options.reportRequestError(\n normalizeError(error),\n {\n path: options.cleanPathname,\n method: options.request.method,\n headers: Object.fromEntries(options.request.headers.entries()),\n },\n { routerKind: \"App Router\", routePath: options.cleanPathname, routeType: \"action\" },\n );\n options.clearRequestContext();\n return internalServerErrorResponse(\n process.env.NODE_ENV === \"production\"\n ? undefined\n : \"Server action failed: \" + getServerActionFailureMessage(error),\n );\n}\n\nfunction createActionNotFoundResponse(\n actionId: string | null,\n options: {\n clearRequestContext: () => void;\n getAndClearPendingCookies: () => string[];\n },\n): Response {\n options.getAndClearPendingCookies();\n console.warn(getServerActionNotFoundMessage(actionId));\n options.clearRequestContext();\n return createServerActionNotFoundResponse();\n}\n\nexport function isProgressiveServerActionRequest(\n request: Pick<Request, \"method\">,\n contentType: string,\n actionId: string | null,\n): boolean {\n return (\n request.method.toUpperCase() === \"POST\" &&\n contentType.startsWith(\"multipart/form-data\") &&\n !actionId\n );\n}\n\nexport async function handleProgressiveServerActionRequest(\n options: HandleProgressiveServerActionRequestOptions,\n): Promise<Response | ProgressiveServerActionResult | null> {\n if (!isProgressiveServerActionRequest(options.request, options.contentType, options.actionId)) {\n return null;\n }\n\n // Defensive guard: prevent infinite forwarding loops. See handleServerActionRscRequest.\n if (options.request.headers.get(ACTION_FORWARDED_HEADER)) {\n return createActionNotFoundResponse(null, {\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n });\n }\n\n const csrfResponse = validateCsrfOrigin(options.request, options.allowedOrigins);\n if (csrfResponse) {\n return csrfResponse;\n }\n\n const contentLength = parseInt(options.request.headers.get(\"content-length\") || \"0\", 10);\n if (contentLength > options.maxActionBodySize) {\n options.clearRequestContext();\n return payloadTooLargeResponse();\n }\n\n try {\n let body: FormData;\n try {\n // Progressive submissions can still fall through to a regular page render when\n // the multipart body is not an action payload. Read a clone so that fallback\n // code can still consume the original request body.\n body = await options.readFormDataWithLimit(\n options.request.clone(),\n options.maxActionBodySize,\n );\n } catch (error) {\n if (isRequestBodyTooLarge(error)) {\n options.clearRequestContext();\n return payloadTooLargeResponse();\n }\n throw error;\n }\n\n const payloadResponse = await validateServerActionPayload(body);\n if (payloadResponse) {\n options.clearRequestContext();\n return payloadResponse;\n }\n\n const action = await options.decodeAction(body);\n if (!isAppServerActionFunction(action)) {\n return null;\n }\n\n let actionRedirect: AppServerActionRedirect | null = null;\n let actionError: unknown = undefined;\n let actionFailed = false;\n let actionResult: unknown;\n const previousHeadersPhase = options.setHeadersAccessPhase(\"action\");\n try {\n actionResult = await action();\n } catch (error) {\n actionRedirect = getActionRedirect(error);\n if (!actionRedirect) {\n actionError = error;\n actionFailed = true;\n const isControlFlow =\n getActionHttpFallbackStatus(error) !== null || isServerActionNotFoundError(error, null);\n if (!isControlFlow) {\n console.error(\"[vinext] Server action error:\", error);\n options.reportRequestError(\n normalizeError(error),\n {\n path: options.cleanPathname,\n method: options.request.method,\n headers: Object.fromEntries(options.request.headers.entries()),\n },\n { routerKind: \"App Router\", routePath: options.cleanPathname, routeType: \"action\" },\n );\n }\n }\n } finally {\n options.setHeadersAccessPhase(previousHeadersPhase);\n }\n\n if (!actionRedirect) {\n getAndClearActionRevalidationKind();\n if (actionFailed) {\n return { kind: \"form-state\", formState: null, actionError, actionFailed };\n }\n\n const formState = await options.decodeFormState(actionResult, body);\n return { kind: \"form-state\", formState: formState ?? null };\n }\n\n const actionPendingCookies = options.getAndClearPendingCookies();\n const actionDraftCookie = options.getDraftModeCookieHeader();\n const actionRevalidationKind = resolveActionRevalidationKind(\n actionPendingCookies.length > 0 || Boolean(actionDraftCookie),\n );\n options.clearRequestContext();\n\n const headers = new Headers();\n // Prefix the configured basePath onto the redirect target before it\n // becomes an absolute Location URL. Mirrors Next.js, which threads\n // basePath through `addPathPrefix(...)` for server-action redirects.\n const prefixedRedirectUrl = applyActionRedirectBasePath(\n actionRedirect.url,\n options.basePath ?? \"\",\n );\n headers.set(\"Location\", new URL(prefixedRedirectUrl, options.request.url).toString());\n mergeMiddlewareResponseHeaders(headers, options.middlewareHeaders);\n for (const cookie of actionPendingCookies) {\n headers.append(\"Set-Cookie\", cookie);\n }\n if (actionDraftCookie) {\n headers.append(\"Set-Cookie\", actionDraftCookie);\n }\n setActionRevalidatedHeader(headers, actionRevalidationKind);\n\n return new Response(null, {\n status: 303,\n headers,\n });\n } catch (error) {\n if (isServerActionNotFoundError(error, null)) {\n return createActionNotFoundResponse(null, {\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n });\n }\n\n getAndClearActionRevalidationKind();\n options.getAndClearPendingCookies();\n console.error(\"[vinext] Server action payload parsing error:\", error);\n options.reportRequestError(\n normalizeError(error),\n {\n path: options.cleanPathname,\n method: options.request.method,\n headers: Object.fromEntries(options.request.headers.entries()),\n },\n { routerKind: \"App Router\", routePath: options.cleanPathname, routeType: \"action\" },\n );\n options.clearRequestContext();\n return internalServerErrorResponse(\n process.env.NODE_ENV === \"production\"\n ? undefined\n : \"Server action parsing failed: \" + getServerActionFailureMessage(error),\n );\n }\n}\n\nexport async function handleServerActionRscRequest<\n TElement,\n TRoute extends AppServerActionRoute,\n TInterceptOpts,\n TTemporaryReferences,\n TPage = unknown,\n>(\n options: HandleServerActionRscRequestOptions<\n TElement,\n TRoute,\n TInterceptOpts,\n TTemporaryReferences,\n TPage\n >,\n): Promise<Response | null> {\n if (options.request.method.toUpperCase() !== \"POST\" || !options.actionId) {\n return null;\n }\n\n // Defensive guard: if this request has already been forwarded between workers,\n // do not attempt to process it again. Prevents infinite forwarding loops when\n // middleware rewrites action POSTs. Matches Next.js behavior:\n // https://github.com/vercel/next.js/commit/20892dd44e1321c13f755f051e48c3cadd75204b\n if (options.request.headers.get(ACTION_FORWARDED_HEADER)) {\n return createActionNotFoundResponse(options.actionId, {\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n });\n }\n\n const csrfResponse = validateCsrfOrigin(options.request, options.allowedOrigins);\n if (csrfResponse) return csrfResponse;\n\n const contentLength = parseInt(options.request.headers.get(\"content-length\") || \"0\", 10);\n if (contentLength > options.maxActionBodySize) {\n options.clearRequestContext();\n return payloadTooLargeResponse();\n }\n\n try {\n let body: string | FormData;\n try {\n body = options.contentType.startsWith(\"multipart/form-data\")\n ? await options.readFormDataWithLimit(options.request, options.maxActionBodySize)\n : await options.readBodyWithLimit(options.request, options.maxActionBodySize);\n } catch (error) {\n if (isRequestBodyTooLarge(error)) {\n options.clearRequestContext();\n return payloadTooLargeResponse();\n }\n throw error;\n }\n\n const payloadResponse = await validateServerActionPayload(body);\n if (payloadResponse) {\n options.clearRequestContext();\n return payloadResponse;\n }\n\n let action: unknown;\n try {\n action = await options.loadServerAction(options.actionId);\n } catch (error) {\n if (isServerActionNotFoundError(error, options.actionId)) {\n return createActionNotFoundResponse(options.actionId, {\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n });\n }\n\n throw error;\n }\n\n if (!isAppServerActionFunction(action)) {\n return createActionNotFoundResponse(options.actionId, {\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n });\n }\n\n const temporaryReferences = options.createTemporaryReferenceSet();\n const args = await options.decodeReply(body, { temporaryReferences });\n let returnValue: AppServerActionReturnValue;\n let actionRedirect: AppServerActionRedirect | null = null;\n let actionStatus = 200;\n const previousHeadersPhase = options.setHeadersAccessPhase(\"action\");\n try {\n try {\n validateServerActionArgs(args);\n const data = await action.apply(null, args);\n returnValue = { ok: true, data };\n } catch (error) {\n actionRedirect = getActionRedirect(error);\n if (actionRedirect) {\n returnValue = { ok: true, data: undefined };\n } else {\n const httpFallbackStatus = getActionHttpFallbackStatus(error);\n if (httpFallbackStatus !== null) {\n actionStatus = httpFallbackStatus;\n returnValue = { ok: false, data: error };\n } else {\n console.error(\"[vinext] Server action error:\", error);\n returnValue = { ok: false, data: options.sanitizeErrorForClient(error) };\n }\n }\n }\n } finally {\n options.setHeadersAccessPhase(previousHeadersPhase);\n }\n\n if (actionRedirect) {\n const actionPendingCookies = options.getAndClearPendingCookies();\n const actionDraftCookie = options.getDraftModeCookieHeader();\n const actionRevalidationKind = resolveActionRevalidationKind(\n actionPendingCookies.length > 0 || Boolean(actionDraftCookie),\n );\n options.clearRequestContext();\n const redirectHeaders = new Headers({\n \"Content-Type\": VINEXT_RSC_CONTENT_TYPE,\n Vary: VINEXT_RSC_VARY_HEADER,\n });\n applyEdgeRuntimeHeader(redirectHeaders, options.isEdgeRuntime);\n mergeMiddlewareResponseHeaders(redirectHeaders, options.middlewareHeaders);\n applyRscCompatibilityIdHeader(redirectHeaders);\n // Prefix basePath onto the redirect target. The client-side handler in\n // app-browser-entry reads ACTION_REDIRECT_HEADER and calls\n // window.location.assign/replace verbatim, so the value must already\n // be a basePath-prefixed URL.\n redirectHeaders.set(\n ACTION_REDIRECT_HEADER,\n applyActionRedirectBasePath(actionRedirect.url, options.basePath ?? \"\"),\n );\n redirectHeaders.set(ACTION_REDIRECT_TYPE_HEADER, actionRedirect.type);\n redirectHeaders.set(ACTION_REDIRECT_STATUS_HEADER, String(actionRedirect.status));\n for (const cookie of actionPendingCookies) {\n redirectHeaders.append(\"Set-Cookie\", cookie);\n }\n if (actionDraftCookie) redirectHeaders.append(\"Set-Cookie\", actionDraftCookie);\n setActionRevalidatedHeader(redirectHeaders, actionRevalidationKind);\n return new Response(\"\", { status: 200, headers: redirectHeaders });\n }\n\n const actionPendingCookies = options.getAndClearPendingCookies();\n const actionDraftCookie = options.getDraftModeCookieHeader();\n const actionRevalidationKind = resolveActionRevalidationKind(\n actionPendingCookies.length > 0 || Boolean(actionDraftCookie),\n );\n\n const shouldSkipPageRendering = actionRevalidationKind === ACTION_DID_NOT_REVALIDATE;\n if (shouldSkipPageRendering) {\n const onRenderError = options.createRscOnErrorHandler(\n options.request,\n options.cleanPathname,\n options.cleanPathname,\n );\n const rscStream = await options.renderToReadableStream(\n { returnValue },\n { temporaryReferences, onError: onRenderError },\n );\n\n options.clearRequestContext();\n\n const actionHeaders = new Headers({\n \"Content-Type\": VINEXT_RSC_CONTENT_TYPE,\n Vary: VINEXT_RSC_VARY_HEADER,\n });\n applyEdgeRuntimeHeader(actionHeaders, options.isEdgeRuntime);\n mergeMiddlewareResponseHeaders(actionHeaders, options.middlewareHeaders);\n applyRscCompatibilityIdHeader(actionHeaders);\n\n return new Response(rscStream, {\n status: options.middlewareStatus ?? actionStatus,\n headers: actionHeaders,\n });\n }\n\n const match = options.matchRoute(options.cleanPathname);\n let element: TElement;\n let errorPattern = match ? match.route.pattern : options.cleanPathname;\n if (match) {\n const { route: actionRoute, params: actionParams } = match;\n const actionRerenderTarget = resolveAppPageActionRerenderTarget({\n cleanPathname: options.cleanPathname,\n currentParams: actionParams,\n currentRoute: actionRoute,\n findIntercept: options.findIntercept,\n getRouteParamNames: options.getRouteParamNames,\n getSourceRoute: options.getSourceRoute,\n isRscRequest: options.isRscRequest,\n toInterceptOpts: options.toInterceptOpts,\n });\n\n options.setNavigationContext({\n pathname: options.cleanPathname,\n searchParams: options.searchParams,\n params: actionRerenderTarget.navigationParams,\n });\n setCurrentFetchCacheMode(\n options.resolveRouteFetchCacheMode?.(actionRerenderTarget.route) ?? null,\n );\n element = options.buildPageElement({\n cleanPathname: options.cleanPathname,\n interceptOpts: actionRerenderTarget.interceptOpts,\n isRscRequest: options.isRscRequest,\n mountedSlotsHeader: options.mountedSlotsHeader,\n params: actionRerenderTarget.params,\n request: options.request,\n route: actionRerenderTarget.route,\n searchParams: options.searchParams,\n renderMode: APP_RSC_RENDER_MODE_ACTION_RERENDER_PRESERVE_UI,\n });\n errorPattern = actionRerenderTarget.route.pattern;\n } else {\n const actionRouteId = options.createPayloadRouteId(options.cleanPathname, null);\n element = options.createNotFoundElement(actionRouteId);\n }\n\n const onRenderError = options.createRscOnErrorHandler(\n options.request,\n options.cleanPathname,\n errorPattern,\n );\n const rscStream = await options.renderToReadableStream(\n { root: element, returnValue },\n { temporaryReferences, onError: onRenderError },\n );\n\n const actionHeaders = new Headers({\n \"Content-Type\": VINEXT_RSC_CONTENT_TYPE,\n Vary: VINEXT_RSC_VARY_HEADER,\n });\n applyEdgeRuntimeHeader(actionHeaders, options.isEdgeRuntime);\n mergeMiddlewareResponseHeaders(actionHeaders, options.middlewareHeaders);\n applyRscCompatibilityIdHeader(actionHeaders);\n setActionRevalidatedHeader(actionHeaders, actionRevalidationKind);\n const actionResponse = new Response(rscStream, {\n status: options.middlewareStatus ?? actionStatus,\n headers: actionHeaders,\n });\n if (actionPendingCookies.length > 0 || actionDraftCookie) {\n for (const cookie of actionPendingCookies) {\n actionResponse.headers.append(\"Set-Cookie\", cookie);\n }\n if (actionDraftCookie) actionResponse.headers.append(\"Set-Cookie\", actionDraftCookie);\n }\n return actionResponse;\n } catch (error) {\n getAndClearActionRevalidationKind();\n return createServerActionErrorResponse(error, {\n cleanPathname: options.cleanPathname,\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n reportRequestError: options.reportRequestError,\n request: options.request,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6NA,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;AAClC,MAAM,2CAA2C;AAEjD,SAAS,2BAA2B,SAAkB,MAAoC;CACxF,IAAI,SAAS,2BAA2B;CACxC,QAAQ,IAAI,2BAA2B,KAAK,UAAU,KAAK,CAAC;;AAG9D,SAAS,8BAA8B,oBAAqD;CAC1F,MAAM,mBAAmB,mCAAmC;CAM5D,IAAI,oBAAoB,OAAO;CAC/B,OAAO;;AAGT,SAAS,sBAAsB,OAAyB;CACtD,OAAO,iBAAiB,SAAS,MAAM,YAAY;;AAGrD,SAAS,0BAA0B,QAAoD;CACrF,OAAO,OAAO,WAAW;;AAG3B,SAAS,eAAe,OAAuB;CAC7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B,IAAI,SAAS,WAAW;GAC7C,QAAQ,QAAQ,oBAAoB;GACpC,SAAS;GACV,CAAC;EACF,IAAI,qBAAqB,SAAS,KAAK,mBAAmB;GACxD,KAAK,MAAM,UAAU,sBACnB,eAAe,QAAQ,OAAO,cAAc,OAAO;GAErD,IAAI,mBAAmB,eAAe,QAAQ,OAAO,cAAc,kBAAkB;;EAEvF,OAAO;UACA,OAAO;EACd,mCAAmC;EACnC,OAAO,gCAAgC,OAAO;GAC5C,eAAe,QAAQ;GACvB,qBAAqB,QAAQ;GAC7B,2BAA2B,QAAQ;GACnC,oBAAoB,QAAQ;GAC5B,SAAS,QAAQ;GAClB,CAAC"}
1
+ {"version":3,"file":"app-server-action-execution.js","names":[],"sources":["../../src/server/app-server-action-execution.ts"],"sourcesContent":["import { getAndClearActionRevalidationKind, type ActionRevalidationKind } from \"vinext/shims/cache\";\nimport {\n headersContextFromRequest,\n setHeadersContext,\n type HeadersAccessPhase,\n} from \"vinext/shims/headers\";\nimport {\n type FetchCacheMode,\n setCurrentFetchCacheMode,\n setCurrentFetchSoftTags,\n} from \"vinext/shims/fetch-cache\";\nimport type { ReactFormState } from \"react-dom/client\";\nimport { isExternalUrl } from \"../config/config-matchers.js\";\nimport { addBasePathToPathname, hasBasePath, stripBasePath } from \"../utils/base-path.js\";\nimport {\n ACTION_FORWARDED_HEADER,\n ACTION_REDIRECT_HEADER,\n ACTION_REDIRECT_STATUS_HEADER,\n ACTION_REDIRECT_TYPE_HEADER,\n ACTION_REVALIDATED_HEADER,\n} from \"./headers.js\";\nimport {\n VINEXT_RSC_CONTENT_TYPE,\n VINEXT_RSC_VARY_HEADER,\n applyRscCompatibilityIdHeader,\n} from \"./app-rsc-cache-busting.js\";\nimport { applyEdgeRuntimeHeader } from \"./app-page-response.js\";\nimport { resolveAppPageActionRerenderTarget } from \"./app-page-request.js\";\nimport { deferUntilStreamConsumed } from \"./app-page-stream.js\";\nimport { buildPageCacheTags } from \"./implicit-tags.js\";\nimport { mergeMiddlewareResponseHeaders } from \"./middleware-response-headers.js\";\nimport { getSetCookieName } from \"./cookie-utils.js\";\nimport {\n APP_RSC_RENDER_MODE_ACTION_RERENDER_PRESERVE_UI,\n type AppRscRenderMode,\n} from \"./app-rsc-render-mode.js\";\nimport {\n getNextErrorDigest,\n parseNextHttpErrorDigest,\n parseNextRedirectDigest,\n} from \"./next-error-digest.js\";\nimport { validateCsrfOrigin, validateServerActionPayload } from \"./request-pipeline.js\";\nimport { readStreamAsTextWithLimit } from \"../utils/text-stream.js\";\nimport {\n createServerActionNotFoundResponse,\n getServerActionNotFoundMessage,\n isServerActionNotFoundError,\n} from \"./server-action-not-found.js\";\nimport { internalServerErrorResponse, payloadTooLargeResponse } from \"./http-error-responses.js\";\n\ntype AppPageParams = Record<string, string | string[]>;\n\ntype AppServerActionErrorReporter = (\n error: Error,\n request: { path: string; method: string; headers: Record<string, string> },\n route: { routerKind: \"App Router\"; routePath: string; routeType: \"action\" },\n) => void;\n\ntype AppServerActionDecoder = (body: FormData) => Promise<unknown>;\ntype AppServerActionFormStateDecoder = (\n actionResult: unknown,\n body: FormData,\n) => Promise<ReactFormState | undefined>;\n\ntype ReadFormDataWithLimit = (request: Request, maxBytes: number) => Promise<FormData>;\n\ntype ReadBodyWithLimit = (request: Request, maxBytes: number) => Promise<string>;\n\ntype AppServerActionFunction = (...args: unknown[]) => unknown;\n\ntype AppServerActionReturnValue =\n | {\n data: unknown;\n ok: true;\n }\n | {\n data: unknown;\n ok: false;\n };\n\ntype AppServerActionRedirect = {\n status: number;\n type: string;\n url: string;\n};\n\ntype AppServerActionRoute = {\n page?: unknown;\n pattern: string;\n routeHandler?: unknown;\n routeSegments?: readonly string[];\n};\n\n/**\n * Side-effect headers captured during a progressive (no-JS) server action's\n * non-redirect execution. The caller (app-rsc-handler) must apply these to the\n * page render response so that `cookies().set(...)` and revalidation kinds\n * propagate to the browser. Without this, no-JS form submissions silently\n * lose cookie/header mutations — see issue #1483.\n *\n * Next.js' equivalent path mutates `res.setHeader('set-cookie', ...)` during\n * action execution (action-handler.ts → app-render.tsx), then `sendResponse`\n * merges those headers with the rendered Response. vinext works with Response\n * objects directly so the cookies must ride out via the result instead.\n */\ntype ProgressiveServerActionSideEffects = {\n /** `Set-Cookie` headers from `cookies().set(...)` / `cookies().delete(...)`. */\n pendingCookies: string[];\n /** `Set-Cookie` header from `draftMode().enable()/disable()` (if any). */\n draftCookie: string | null | undefined;\n /** Resolved revalidation kind to emit via `x-action-revalidated`. */\n revalidationKind: ActionRevalidationKind;\n};\n\ntype AppServerActionRouteRuntime = \"edge\" | \"experimental-edge\" | \"nodejs\" | null;\n\ntype ProgressiveServerActionResult =\n | ({\n formState: ReactFormState | null;\n kind: \"form-state\";\n } & ProgressiveServerActionSideEffects)\n | ({\n actionError: unknown;\n actionFailed: true;\n formState: null;\n kind: \"form-state\";\n } & ProgressiveServerActionSideEffects);\n\ntype AppServerActionMatch<TRoute extends AppServerActionRoute> = {\n params: AppPageParams;\n route: TRoute;\n};\n\ntype AppServerActionIntercept<TPage = unknown> = {\n matchedParams: AppPageParams;\n page: TPage;\n slotId?: string | null;\n slotKey: string;\n sourceRouteIndex: number;\n};\n\ntype BuildServerActionPageElementOptions<TRoute extends AppServerActionRoute, TInterceptOpts> = {\n cleanPathname: string;\n interceptOpts: TInterceptOpts | undefined;\n isRscRequest: boolean;\n mountedSlotsHeader: string | null;\n params: AppPageParams;\n request: Request;\n route: TRoute;\n searchParams: URLSearchParams;\n renderMode: AppRscRenderMode;\n};\n\ntype AppServerActionRscModel<TElement> = {\n /**\n * Omitted when the action did not invalidate page data. This mirrors Next.js'\n * empty Flight payload for non-revalidating fetch actions: the client resolves\n * the action value without committing a visible router update.\n */\n root?: TElement;\n returnValue: AppServerActionReturnValue;\n};\n\ntype RenderServerActionRscStreamOptions<TTemporaryReferences> = {\n onError: (error: unknown) => unknown;\n temporaryReferences: TTemporaryReferences;\n};\n\ntype DecodeServerActionReplyOptions<TTemporaryReferences> = {\n temporaryReferences: TTemporaryReferences;\n};\n\nexport type HandleProgressiveServerActionRequestOptions = {\n actionId: string | null;\n allowedOrigins: string[];\n /** Configured next.config `basePath`. Prefixed onto progressive Location targets. */\n basePath?: string;\n cleanPathname: string;\n clearRequestContext: () => void;\n contentType: string;\n decodeAction: AppServerActionDecoder;\n decodeFormState: AppServerActionFormStateDecoder;\n getAndClearPendingCookies: () => string[];\n getDraftModeCookieHeader: () => string | null | undefined;\n maxActionBodySize: number;\n middlewareHeaders: Headers | null;\n readFormDataWithLimit: ReadFormDataWithLimit;\n reportRequestError: AppServerActionErrorReporter;\n request: Request;\n setHeadersAccessPhase: (phase: HeadersAccessPhase) => HeadersAccessPhase;\n};\n\nexport type HandleServerActionRscRequestOptions<\n TElement,\n TRoute extends AppServerActionRoute,\n TInterceptOpts,\n TTemporaryReferences,\n TPage = unknown,\n> = {\n actionId: string | null;\n allowedOrigins: string[];\n /** Configured next.config `basePath`. Prefixed onto ACTION_REDIRECT_HEADER targets. */\n basePath?: string;\n buildPageElement: (\n options: BuildServerActionPageElementOptions<TRoute, TInterceptOpts>,\n ) => TElement;\n cleanPathname: string;\n clearRequestContext: () => void;\n contentType: string;\n createNotFoundElement: (routeId: string) => TElement;\n createPayloadRouteId: (pathname: string, interceptionContext: string | null) => string;\n createRscOnErrorHandler: (\n request: Request,\n pathname: string,\n pattern: string,\n ) => (error: unknown) => unknown;\n createTemporaryReferenceSet: () => TTemporaryReferences;\n decodeReply: (\n body: string | FormData,\n options: DecodeServerActionReplyOptions<TTemporaryReferences>,\n ) => Promise<unknown[]> | unknown[];\n findIntercept: (pathname: string) => AppServerActionIntercept<TPage> | null;\n getAndClearPendingCookies: () => string[];\n getDraftModeCookieHeader: () => string | null | undefined;\n getRouteParamNames: (route: TRoute) => readonly string[];\n getSourceRoute: (sourceRouteIndex: number) => TRoute | undefined;\n isEdgeRuntime?: boolean;\n isRscRequest: boolean;\n loadServerAction: (actionId: string) => Promise<unknown>;\n matchRoute: (pathname: string) => AppServerActionMatch<TRoute> | null;\n maxActionBodySize: number;\n middlewareHeaders: Headers | null;\n middlewareStatus: number | null | undefined;\n mountedSlotsHeader: string | null;\n readBodyWithLimit: ReadBodyWithLimit;\n readFormDataWithLimit: ReadFormDataWithLimit;\n renderToReadableStream: (\n model: AppServerActionRscModel<TElement>,\n options: RenderServerActionRscStreamOptions<TTemporaryReferences>,\n ) => BodyInit | null | Promise<BodyInit | null>;\n reportRequestError: AppServerActionErrorReporter;\n resolveRouteFetchCacheMode?: (route: TRoute) => FetchCacheMode | null;\n resolveRouteRuntime?: (route: TRoute) => AppServerActionRouteRuntime;\n request: Request;\n sanitizeErrorForClient: (error: unknown) => unknown;\n searchParams: URLSearchParams;\n setHeadersAccessPhase: (phase: HeadersAccessPhase) => HeadersAccessPhase;\n setNavigationContext: (context: {\n params: AppPageParams;\n pathname: string;\n searchParams: URLSearchParams;\n }) => void;\n toInterceptOpts: (intercept: AppServerActionIntercept<TPage>) => TInterceptOpts;\n};\n\n/**\n * Matches Next.js' server action argument cap to prevent stack overflow in\n * Function.prototype.apply when decoding hostile action payloads.\n */\nconst SERVER_ACTION_ARGS_LIMIT = 1000;\nconst ACTION_DID_NOT_REVALIDATE = 0 satisfies ActionRevalidationKind;\nconst ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC = 1 satisfies ActionRevalidationKind;\nconst ACTION_REDIRECT_RENDER_STRIPPED_HEADERS = [\n \"accept\",\n \"content-length\",\n \"content-type\",\n \"next-action\",\n \"origin\",\n \"rsc\",\n \"x-action-forwarded\",\n \"x-rsc-action\",\n];\n\nfunction setActionRevalidatedHeader(headers: Headers, kind: ActionRevalidationKind): void {\n if (kind === ACTION_DID_NOT_REVALIDATE) return;\n headers.set(ACTION_REVALIDATED_HEADER, JSON.stringify(kind));\n}\n\nfunction resolveActionRevalidationKind(hasModifiedCookies: boolean): ActionRevalidationKind {\n const revalidationKind = getAndClearActionRevalidationKind();\n // Cookie mutations are a hard override to STATIC_AND_DYNAMIC: any cookie\n // change can invalidate downstream cached payloads regardless of what\n // (if anything) the action explicitly revalidated, so we always emit the\n // strongest kind. STATIC_AND_DYNAMIC is also the lowest numeric value, so\n // this matches the max-precedence semantics in markActionRevalidation.\n if (hasModifiedCookies) return ACTION_DID_REVALIDATE_STATIC_AND_DYNAMIC;\n return revalidationKind;\n}\n\nfunction cloneActionRedirectHeaders(requestHeaders: Headers): Headers {\n const headers = new Headers(requestHeaders);\n for (const header of ACTION_REDIRECT_RENDER_STRIPPED_HEADERS) {\n headers.delete(header);\n }\n return headers;\n}\n\nfunction readSetCookieNameValue(setCookie: string): { name: string; value: string } | null {\n const equalsIndex = setCookie.indexOf(\"=\");\n if (equalsIndex <= 0) return null;\n\n const name = setCookie.slice(0, equalsIndex).trim();\n const valueEnd = setCookie.indexOf(\";\", equalsIndex + 1);\n const value = setCookie.slice(equalsIndex + 1, valueEnd === -1 ? undefined : valueEnd);\n\n return { name, value };\n}\n\nfunction isExpiredSetCookie(setCookie: string): boolean {\n return (\n /(?:^|;\\s*)max-age=0(?:;|$)/i.test(setCookie) ||\n /(?:^|;\\s*)expires=Thu,\\s*0?1[\\s-]+Jan[\\s-]+1970/i.test(setCookie)\n );\n}\n\nfunction applySetCookieMutationsToRequestCookieHeader(\n cookieHeader: string | null,\n setCookies: readonly string[],\n): string | null {\n const cookies = new Map<string, string>();\n if (cookieHeader) {\n for (const part of cookieHeader.split(\";\")) {\n const trimmed = part.trim();\n if (!trimmed) continue;\n const equalsIndex = trimmed.indexOf(\"=\");\n if (equalsIndex <= 0) continue;\n cookies.set(trimmed.slice(0, equalsIndex), trimmed.slice(equalsIndex + 1));\n }\n }\n\n for (const setCookie of setCookies) {\n const entry = readSetCookieNameValue(setCookie);\n if (!entry) continue;\n if (isExpiredSetCookie(setCookie)) {\n cookies.delete(entry.name);\n } else {\n // Cookie header values are raw (not URL-encoded), and\n // readSetCookieNameValue extracts the value verbatim from the\n // Set-Cookie header, so store it as-is.\n cookies.set(entry.name, entry.value);\n }\n }\n\n return cookies.size === 0\n ? null\n : [...cookies].map(([name, value]) => `${name}=${value}`).join(\"; \");\n}\n\nfunction createActionRedirectRenderRequest(options: {\n pendingCookies: readonly string[];\n request: Request;\n url: URL;\n}): Request {\n const headers = cloneActionRedirectHeaders(options.request.headers);\n const cookieHeader = applySetCookieMutationsToRequestCookieHeader(\n headers.get(\"cookie\"),\n options.pendingCookies,\n );\n if (cookieHeader === null) {\n headers.delete(\"cookie\");\n } else {\n headers.set(\"cookie\", cookieHeader);\n }\n\n return new Request(options.url, {\n headers,\n method: \"GET\",\n });\n}\n\nfunction withoutRscBodyHeaders(headers: Headers): Headers {\n const nextHeaders = new Headers(headers);\n nextHeaders.delete(\"Content-Type\");\n nextHeaders.delete(\"Vary\");\n return nextHeaders;\n}\n\nfunction isReadableStreamBody(body: BodyInit | null): body is ReadableStream<Uint8Array> {\n return typeof ReadableStream !== \"undefined\" && body instanceof ReadableStream;\n}\n\nfunction createServerActionRscResponse(\n body: BodyInit | null,\n init: ResponseInit,\n clearRequestContext: () => void,\n): Response {\n if (!isReadableStreamBody(body)) {\n clearRequestContext();\n return new Response(body, init);\n }\n\n return new Response(deferUntilStreamConsumed(body, clearRequestContext), init);\n}\n\nfunction isRequestBodyTooLarge(error: unknown): boolean {\n return error instanceof Error && error.message === \"Request body too large\";\n}\n\n/**\n * Collapse repeated `cookies().set(name, ...)` / `cookies().delete(name)`\n * calls down to the last value per name, matching Next.js'\n * `MutableRequestCookiesAdapter` semantics. Next.js stores response cookies in\n * a `ResponseCookies` Map keyed by name — multiple sets for the same cookie\n * collapse to the final value, and emit a single Set-Cookie header.\n *\n * Insertion order is preserved by first occurrence (Map iteration order),\n * which mirrors how `ResponseCookies` iterates its underlying Map. See\n * packages/next/src/server/web/spec-extension/adapters/request-cookies.ts.\n * Issue: https://github.com/cloudflare/vinext/issues/1481\n */\nfunction dedupePendingCookies(cookies: readonly string[]): string[] {\n if (cookies.length <= 1) {\n return cookies.slice();\n }\n const byName = new Map<string, string>();\n const unkeyed: string[] = [];\n for (const cookie of cookies) {\n const name = getSetCookieName(cookie);\n if (name === null) {\n unkeyed.push(cookie);\n continue;\n }\n // Map.set on an existing key replaces the value but preserves the\n // insertion position of the original key — exactly the behaviour we need\n // for `cookies().set(\"foo\", \"1\"); cookies().set(\"bar\", \"2\"); cookies().set(\"foo\", \"3\")`\n // to come out as [foo=3, bar=2].\n byName.set(name, cookie);\n }\n return [...unkeyed, ...byName.values()];\n}\n\nfunction isAppServerActionFunction(action: unknown): action is AppServerActionFunction {\n return typeof action === \"function\";\n}\n\nfunction normalizeError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\nfunction getServerActionFailureMessage(error: unknown): string {\n return error instanceof Error && error.message ? error.message : String(error);\n}\n\nfunction validateServerActionArgs(args: readonly unknown[]): void {\n if (args.length > SERVER_ACTION_ARGS_LIMIT) {\n throw new Error(\n `Server Action arguments list is too long (${args.length}). Maximum allowed is ${SERVER_ACTION_ARGS_LIMIT}.`,\n );\n }\n}\n\nexport async function readActionBodyWithLimit(request: Request, maxBytes: number): Promise<string> {\n if (!request.body) return \"\";\n return readStreamAsTextWithLimit(request.body, maxBytes, () => {\n throw new Error(\"Request body too large\");\n });\n}\n\nexport async function readActionFormDataWithLimit(\n request: Request,\n maxBytes: number,\n): Promise<FormData> {\n if (!request.body) return new FormData();\n\n const reader = request.body.getReader();\n const chunks: Uint8Array[] = [];\n let totalSize = 0;\n\n for (;;) {\n const result = await reader.read();\n if (result.done) break;\n\n totalSize += result.value.byteLength;\n if (totalSize > maxBytes) {\n await reader.cancel();\n throw new Error(\"Request body too large\");\n }\n chunks.push(result.value);\n }\n\n const combined = new Uint8Array(totalSize);\n let offset = 0;\n for (const chunk of chunks) {\n combined.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return new Response(combined, {\n headers: { \"Content-Type\": request.headers.get(\"content-type\") || \"\" },\n }).formData();\n}\n\nfunction getActionRedirect(error: unknown): AppServerActionRedirect | null {\n const digest = getNextErrorDigest(error);\n if (!digest) return null;\n\n const redirect = parseNextRedirectDigest(digest);\n if (!redirect) return null;\n\n return {\n status: redirect.status,\n type: redirect.type ?? \"push\",\n url: redirect.url,\n };\n}\n\n/**\n * Prepend the configured next.config `basePath` to a server-action redirect\n * target before it goes on the wire.\n *\n * `redirect(\"/foo\")` called from a server action mounted at `/base/...` must\n * land the browser at `/base/foo`, mirroring how Next.js threads basePath\n * through `addPathPrefix(getURLFromRedirectError(err), basePath)` in\n * `app-render.tsx` for SSR redirects and in `action-handler.ts` for action\n * redirects.\n *\n * Idempotent and external-aware:\n * - Empty basePath → returned unchanged.\n * - External URLs (`http://`, `https://`, `data:`, protocol-relative `//`)\n * are returned unchanged because the framework does not own those routes.\n * - Targets that already start with the configured basePath are returned\n * unchanged so this helper can be applied at any layer without risk of\n * double-prefixing (`/base/base/foo`).\n *\n * Exported for tests. Used by both the progressive (no-JS form POST) and\n * RSC (`ACTION_REDIRECT_HEADER`) action redirect paths below.\n *\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/action-handler.ts\n */\nexport function applyActionRedirectBasePath(url: string, basePath: string): string {\n if (!basePath) return url;\n if (isExternalUrl(url)) return url;\n // Pathnames that already include basePath are returned as-is.\n if (hasBasePath(url, basePath)) return url;\n // Relative or hash/query-only targets cannot be prefixed safely without an\n // origin; leave them to the caller's URL resolution.\n if (!url.startsWith(\"/\")) return url;\n // Split off optional query+hash so addBasePathToPathname only operates on\n // the path. We must accept hash too because Next.js redirect targets may\n // contain \"#anchor\".\n const queryIndex = url.indexOf(\"?\");\n const hashIndex = url.indexOf(\"#\");\n const splitAt =\n queryIndex === -1 ? hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);\n const pathname = splitAt === -1 ? url : url.slice(0, splitAt);\n const suffix = splitAt === -1 ? \"\" : url.slice(splitAt);\n return `${addBasePathToPathname(pathname, basePath)}${suffix}`;\n}\n\nfunction buildServerActionPageTags(route: AppServerActionRoute, pathname: string): string[] {\n return buildPageCacheTags(pathname, [], [...(route.routeSegments ?? [])], \"page\");\n}\n\nfunction resolveInternalActionRedirectTarget(\n redirectUrl: string,\n requestUrl: string,\n basePath: string,\n): URL | null {\n if (isExternalUrl(redirectUrl)) {\n const requestOrigin = new URL(requestUrl).origin;\n const parsed = new URL(redirectUrl);\n if (parsed.origin !== requestOrigin) return null;\n if (basePath && !hasBasePath(parsed.pathname, basePath)) return null;\n return parsed;\n }\n\n let resolvedBase = requestUrl;\n if (!redirectUrl.startsWith(\"/\") && !/^[a-z]+:/i.test(redirectUrl)) {\n const parsedRequestUrl = new URL(requestUrl);\n let pathname = parsedRequestUrl.pathname;\n if (!pathname.endsWith(\"/\")) {\n pathname = pathname + \"/\";\n }\n resolvedBase = `${parsedRequestUrl.origin}${pathname}${parsedRequestUrl.search}`;\n }\n\n return new URL(redirectUrl, resolvedBase);\n}\n\nfunction isAncestorRouteRedirect(targetPathname: string, currentPathname: string): boolean {\n return targetPathname !== \"/\" && currentPathname.startsWith(`${targetPathname}/`);\n}\n\nfunction splitActionRedirectPathname(pathname: string): string[] {\n return pathname.split(\"/\").filter(Boolean);\n}\n\nfunction isStaleChildSiblingRouteRedirect(\n targetPathname: string,\n currentPathname: string,\n): boolean {\n const targetSegments = splitActionRedirectPathname(targetPathname);\n const currentSegments = splitActionRedirectPathname(currentPathname);\n // Only deeper-to-shallower redirects can be stale in the Next.js worker\n // model (same-depth siblings share the same page worker). The depth guard\n // ensures we don't misclassify same-level redirects.\n if (targetSegments.length === 0 || currentSegments.length <= targetSegments.length) {\n return false;\n }\n\n let commonPrefixLength = 0;\n const maxPrefixLength = Math.min(targetSegments.length, currentSegments.length);\n while (\n commonPrefixLength < maxPrefixLength &&\n targetSegments[commonPrefixLength] === currentSegments[commonPrefixLength]\n ) {\n commonPrefixLength++;\n }\n\n return commonPrefixLength > 0 && commonPrefixLength < targetSegments.length;\n}\n\nfunction normalizeRuntime(runtime: AppServerActionRouteRuntime): \"edge\" | \"nodejs\" {\n if (runtime === \"edge\" || runtime === \"experimental-edge\") {\n return \"edge\";\n }\n return \"nodejs\";\n}\n\nfunction shouldUseForwardedActionRedirectStatus<TRoute extends AppServerActionRoute>(options: {\n actionWasForwarded: boolean;\n currentPathname: string;\n currentRoute: TRoute | null;\n resolveRouteRuntime?: (route: TRoute) => AppServerActionRouteRuntime;\n targetPathname: string;\n targetRoute: TRoute;\n}): boolean {\n if (options.actionWasForwarded) return true;\n if (isAncestorRouteRedirect(options.targetPathname, options.currentPathname)) return true;\n if (isStaleChildSiblingRouteRedirect(options.targetPathname, options.currentPathname)) {\n return true;\n }\n if (!options.currentRoute || !options.resolveRouteRuntime) return false;\n\n const currentRuntime = normalizeRuntime(options.resolveRouteRuntime(options.currentRoute));\n const targetRuntime = normalizeRuntime(options.resolveRouteRuntime(options.targetRoute));\n return currentRuntime !== targetRuntime;\n}\n\nfunction canRenderActionRedirectTarget(route: AppServerActionRoute): boolean {\n if (\"routeHandler\" in route && route.routeHandler) return false;\n return route.page !== null && route.page !== undefined;\n}\n\nfunction getActionHttpFallbackStatus(error: unknown): number | null {\n const digest = getNextErrorDigest(error);\n if (!digest) return null;\n\n const httpError = parseNextHttpErrorDigest(digest);\n if (!httpError || !Number.isInteger(httpError.status)) return null;\n\n return httpError.status;\n}\n\nfunction createServerActionErrorResponse(\n error: unknown,\n options: {\n cleanPathname: string;\n clearRequestContext: () => void;\n getAndClearPendingCookies: () => string[];\n reportRequestError: AppServerActionErrorReporter;\n request: Request;\n },\n): Response {\n options.getAndClearPendingCookies();\n console.error(\"[vinext] Server action error:\", error);\n options.reportRequestError(\n normalizeError(error),\n {\n path: options.cleanPathname,\n method: options.request.method,\n headers: Object.fromEntries(options.request.headers.entries()),\n },\n { routerKind: \"App Router\", routePath: options.cleanPathname, routeType: \"action\" },\n );\n options.clearRequestContext();\n return internalServerErrorResponse(\n process.env.NODE_ENV === \"production\"\n ? undefined\n : \"Server action failed: \" + getServerActionFailureMessage(error),\n );\n}\n\nfunction createActionNotFoundResponse(\n actionId: string | null,\n options: {\n clearRequestContext: () => void;\n getAndClearPendingCookies: () => string[];\n },\n): Response {\n options.getAndClearPendingCookies();\n console.warn(getServerActionNotFoundMessage(actionId));\n options.clearRequestContext();\n return createServerActionNotFoundResponse();\n}\n\nexport function isProgressiveServerActionRequest(\n request: Pick<Request, \"method\">,\n contentType: string,\n actionId: string | null,\n): boolean {\n return (\n request.method.toUpperCase() === \"POST\" &&\n contentType.startsWith(\"multipart/form-data\") &&\n !actionId\n );\n}\n\nexport async function handleProgressiveServerActionRequest(\n options: HandleProgressiveServerActionRequestOptions,\n): Promise<Response | ProgressiveServerActionResult | null> {\n if (!isProgressiveServerActionRequest(options.request, options.contentType, options.actionId)) {\n return null;\n }\n\n // Progressive form submissions (multipart form data without an actionId)\n // don't carry a forwarded-action header. They route to the visible page\n // directly and can't be redirected cross-runtime, so no forwarded guard is\n // needed here.\n const csrfResponse = validateCsrfOrigin(options.request, options.allowedOrigins);\n if (csrfResponse) {\n return csrfResponse;\n }\n\n const contentLength = parseInt(options.request.headers.get(\"content-length\") || \"0\", 10);\n if (contentLength > options.maxActionBodySize) {\n options.clearRequestContext();\n return payloadTooLargeResponse();\n }\n\n try {\n let body: FormData;\n try {\n // Progressive submissions can still fall through to a regular page render when\n // the multipart body is not an action payload. Read a clone so that fallback\n // code can still consume the original request body.\n body = await options.readFormDataWithLimit(\n options.request.clone(),\n options.maxActionBodySize,\n );\n } catch (error) {\n if (isRequestBodyTooLarge(error)) {\n options.clearRequestContext();\n return payloadTooLargeResponse();\n }\n throw error;\n }\n\n const payloadResponse = await validateServerActionPayload(body);\n if (payloadResponse) {\n options.clearRequestContext();\n return payloadResponse;\n }\n\n const action = await options.decodeAction(body);\n if (!isAppServerActionFunction(action)) {\n return null;\n }\n\n let actionRedirect: AppServerActionRedirect | null = null;\n let actionError: unknown = undefined;\n let actionFailed = false;\n let actionResult: unknown;\n const previousHeadersPhase = options.setHeadersAccessPhase(\"action\");\n try {\n actionResult = await action();\n } catch (error) {\n actionRedirect = getActionRedirect(error);\n if (!actionRedirect) {\n actionError = error;\n actionFailed = true;\n const isControlFlow =\n getActionHttpFallbackStatus(error) !== null || isServerActionNotFoundError(error, null);\n if (!isControlFlow) {\n console.error(\"[vinext] Server action error:\", error);\n options.reportRequestError(\n normalizeError(error),\n {\n path: options.cleanPathname,\n method: options.request.method,\n headers: Object.fromEntries(options.request.headers.entries()),\n },\n { routerKind: \"App Router\", routePath: options.cleanPathname, routeType: \"action\" },\n );\n }\n }\n } finally {\n options.setHeadersAccessPhase(previousHeadersPhase);\n }\n\n if (!actionRedirect) {\n // Capture cookies/headers set during action execution so the caller can\n // apply them to the rendered page response. Mirrors Next.js'\n // `res.setHeader('set-cookie', ...)` path in app-render.tsx, which\n // flushes `requestStore.mutableCookies` onto the response before SSR\n // streaming begins. Without this, no-JS server-action form POSTs lose\n // cookies/headers — see issue #1483.\n const actionPendingCookies = options.getAndClearPendingCookies();\n const actionDraftCookie = options.getDraftModeCookieHeader();\n const revalidationKind = resolveActionRevalidationKind(\n actionPendingCookies.length > 0 || Boolean(actionDraftCookie),\n );\n\n if (actionFailed) {\n return {\n kind: \"form-state\",\n formState: null,\n actionError,\n actionFailed,\n pendingCookies: actionPendingCookies,\n draftCookie: actionDraftCookie,\n revalidationKind,\n };\n }\n\n const formState = await options.decodeFormState(actionResult, body);\n return {\n kind: \"form-state\",\n formState: formState ?? null,\n pendingCookies: actionPendingCookies,\n draftCookie: actionDraftCookie,\n revalidationKind,\n };\n }\n\n const actionPendingCookies = dedupePendingCookies(options.getAndClearPendingCookies());\n const actionDraftCookie = options.getDraftModeCookieHeader();\n const actionRevalidationKind = resolveActionRevalidationKind(\n actionPendingCookies.length > 0 || Boolean(actionDraftCookie),\n );\n options.clearRequestContext();\n\n const headers = new Headers();\n // Prefix the configured basePath onto the redirect target before it\n // becomes an absolute Location URL. Mirrors Next.js, which threads\n // basePath through `addPathPrefix(...)` for server-action redirects.\n const prefixedRedirectUrl = applyActionRedirectBasePath(\n actionRedirect.url,\n options.basePath ?? \"\",\n );\n headers.set(\"Location\", new URL(prefixedRedirectUrl, options.request.url).toString());\n mergeMiddlewareResponseHeaders(headers, options.middlewareHeaders);\n for (const cookie of actionPendingCookies) {\n headers.append(\"Set-Cookie\", cookie);\n }\n if (actionDraftCookie) {\n headers.append(\"Set-Cookie\", actionDraftCookie);\n }\n setActionRevalidatedHeader(headers, actionRevalidationKind);\n\n return new Response(null, {\n status: 303,\n headers,\n });\n } catch (error) {\n if (isServerActionNotFoundError(error, null)) {\n return createActionNotFoundResponse(null, {\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n });\n }\n\n getAndClearActionRevalidationKind();\n options.getAndClearPendingCookies();\n console.error(\"[vinext] Server action payload parsing error:\", error);\n options.reportRequestError(\n normalizeError(error),\n {\n path: options.cleanPathname,\n method: options.request.method,\n headers: Object.fromEntries(options.request.headers.entries()),\n },\n { routerKind: \"App Router\", routePath: options.cleanPathname, routeType: \"action\" },\n );\n options.clearRequestContext();\n return internalServerErrorResponse(\n process.env.NODE_ENV === \"production\"\n ? undefined\n : \"Server action parsing failed: \" + getServerActionFailureMessage(error),\n );\n }\n}\n\nexport async function handleServerActionRscRequest<\n TElement,\n TRoute extends AppServerActionRoute,\n TInterceptOpts,\n TTemporaryReferences,\n TPage = unknown,\n>(\n options: HandleServerActionRscRequestOptions<\n TElement,\n TRoute,\n TInterceptOpts,\n TTemporaryReferences,\n TPage\n >,\n): Promise<Response | null> {\n if (options.request.method.toUpperCase() !== \"POST\" || !options.actionId) {\n return null;\n }\n\n const csrfResponse = validateCsrfOrigin(options.request, options.allowedOrigins);\n if (csrfResponse) return csrfResponse;\n\n const contentLength = parseInt(options.request.headers.get(\"content-length\") || \"0\", 10);\n if (contentLength > options.maxActionBodySize) {\n options.clearRequestContext();\n return payloadTooLargeResponse();\n }\n\n try {\n let body: string | FormData;\n try {\n body = options.contentType.startsWith(\"multipart/form-data\")\n ? await options.readFormDataWithLimit(options.request, options.maxActionBodySize)\n : await options.readBodyWithLimit(options.request, options.maxActionBodySize);\n } catch (error) {\n if (isRequestBodyTooLarge(error)) {\n options.clearRequestContext();\n return payloadTooLargeResponse();\n }\n throw error;\n }\n\n const payloadResponse = await validateServerActionPayload(body);\n if (payloadResponse) {\n options.clearRequestContext();\n return payloadResponse;\n }\n\n let action: unknown;\n try {\n action = await options.loadServerAction(options.actionId);\n } catch (error) {\n if (isServerActionNotFoundError(error, options.actionId)) {\n return createActionNotFoundResponse(options.actionId, {\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n });\n }\n\n throw error;\n }\n\n if (!isAppServerActionFunction(action)) {\n return createActionNotFoundResponse(options.actionId, {\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n });\n }\n\n const temporaryReferences = options.createTemporaryReferenceSet();\n const args = await options.decodeReply(body, { temporaryReferences });\n let returnValue: AppServerActionReturnValue;\n let actionRedirect: AppServerActionRedirect | null = null;\n let actionStatus = 200;\n const actionWasForwarded = Boolean(options.request.headers.get(ACTION_FORWARDED_HEADER));\n const previousHeadersPhase = options.setHeadersAccessPhase(\"action\");\n try {\n try {\n validateServerActionArgs(args);\n const data = await action.apply(null, args);\n returnValue = { ok: true, data };\n } catch (error) {\n actionRedirect = getActionRedirect(error);\n if (actionRedirect) {\n returnValue = { ok: true, data: undefined };\n } else {\n const httpFallbackStatus = getActionHttpFallbackStatus(error);\n if (httpFallbackStatus !== null) {\n actionStatus = httpFallbackStatus;\n returnValue = { ok: false, data: error };\n } else {\n console.error(\"[vinext] Server action error:\", error);\n returnValue = { ok: false, data: options.sanitizeErrorForClient(error) };\n }\n }\n }\n } finally {\n options.setHeadersAccessPhase(previousHeadersPhase);\n }\n\n if (actionRedirect) {\n const actionPendingCookies = dedupePendingCookies(options.getAndClearPendingCookies());\n const actionDraftCookie = options.getDraftModeCookieHeader();\n const actionRevalidationKind = resolveActionRevalidationKind(\n actionPendingCookies.length > 0 || Boolean(actionDraftCookie),\n );\n const redirectHeaders = new Headers({\n \"Content-Type\": VINEXT_RSC_CONTENT_TYPE,\n Vary: VINEXT_RSC_VARY_HEADER,\n });\n applyEdgeRuntimeHeader(redirectHeaders, options.isEdgeRuntime);\n mergeMiddlewareResponseHeaders(redirectHeaders, options.middlewareHeaders);\n applyRscCompatibilityIdHeader(redirectHeaders);\n // Prefix basePath onto the redirect target. The client-side handler in\n // app-browser-entry reads ACTION_REDIRECT_HEADER and calls\n // window.location.assign/replace verbatim, so the value must already\n // be a basePath-prefixed URL.\n const actionRedirectUrl = applyActionRedirectBasePath(\n actionRedirect.url,\n options.basePath ?? \"\",\n );\n redirectHeaders.set(ACTION_REDIRECT_HEADER, actionRedirectUrl);\n redirectHeaders.set(ACTION_REDIRECT_TYPE_HEADER, actionRedirect.type);\n redirectHeaders.set(ACTION_REDIRECT_STATUS_HEADER, String(actionRedirect.status));\n for (const cookie of actionPendingCookies) {\n redirectHeaders.append(\"Set-Cookie\", cookie);\n }\n if (actionDraftCookie) redirectHeaders.append(\"Set-Cookie\", actionDraftCookie);\n setActionRevalidatedHeader(redirectHeaders, actionRevalidationKind);\n\n const redirectTarget = resolveInternalActionRedirectTarget(\n actionRedirectUrl,\n options.request.url,\n options.basePath ?? \"\",\n );\n if (!redirectTarget) {\n options.clearRequestContext();\n return new Response(null, {\n status: 303,\n headers: withoutRscBodyHeaders(redirectHeaders),\n });\n }\n\n const targetPathname = stripBasePath(redirectTarget.pathname, options.basePath ?? \"\");\n const targetMatch = options.matchRoute(targetPathname);\n if (!targetMatch || !canRenderActionRedirectTarget(targetMatch.route)) {\n options.clearRequestContext();\n return new Response(null, {\n status: 303,\n headers: withoutRscBodyHeaders(redirectHeaders),\n });\n }\n const currentMatch = options.matchRoute(options.cleanPathname);\n\n const redirectRenderRequest = createActionRedirectRenderRequest({\n pendingCookies: [\n ...actionPendingCookies,\n ...(actionDraftCookie ? [actionDraftCookie] : []),\n ],\n request: options.request,\n url: redirectTarget,\n });\n setHeadersContext(headersContextFromRequest(redirectRenderRequest));\n options.setNavigationContext({\n pathname: targetPathname,\n searchParams: redirectTarget.searchParams,\n params: targetMatch.params,\n });\n setCurrentFetchCacheMode(options.resolveRouteFetchCacheMode?.(targetMatch.route) ?? null);\n setCurrentFetchSoftTags(buildServerActionPageTags(targetMatch.route, targetPathname));\n const element = options.buildPageElement({\n cleanPathname: targetPathname,\n interceptOpts: undefined,\n isRscRequest: true,\n mountedSlotsHeader: null,\n params: targetMatch.params,\n request: redirectRenderRequest,\n route: targetMatch.route,\n searchParams: redirectTarget.searchParams,\n renderMode: APP_RSC_RENDER_MODE_ACTION_RERENDER_PRESERVE_UI,\n });\n const onRenderError = options.createRscOnErrorHandler(\n redirectRenderRequest,\n targetPathname,\n targetMatch.route.pattern,\n );\n const rscStream = await options.renderToReadableStream(\n { root: element, returnValue },\n { temporaryReferences, onError: onRenderError },\n );\n const redirectResponseStatus = shouldUseForwardedActionRedirectStatus({\n actionWasForwarded,\n currentPathname: options.cleanPathname,\n currentRoute: currentMatch?.route ?? null,\n resolveRouteRuntime: options.resolveRouteRuntime,\n targetPathname,\n targetRoute: targetMatch.route,\n })\n ? 200\n : 303;\n\n return createServerActionRscResponse(\n rscStream,\n { status: redirectResponseStatus, headers: redirectHeaders },\n options.clearRequestContext,\n );\n }\n\n const actionPendingCookies = dedupePendingCookies(options.getAndClearPendingCookies());\n const actionDraftCookie = options.getDraftModeCookieHeader();\n const actionRevalidationKind = resolveActionRevalidationKind(\n actionPendingCookies.length > 0 || Boolean(actionDraftCookie),\n );\n\n // When an action returned a non-200 HTTP fallback status (e.g. 404 from\n // notFound()), skip the early page render so the error boundary displays\n // the fallback payload embedded in returnValue. Forwarded actions always\n // skip rerendering regardless of status (the forwarded worker doesn't own\n // the page's layout tree). Otherwise only skip when the action status is\n // 200 and no revalidation side-effects occurred.\n const shouldSkipPageRendering =\n actionWasForwarded ||\n (actionStatus === 200 && actionRevalidationKind === ACTION_DID_NOT_REVALIDATE);\n if (shouldSkipPageRendering) {\n const onRenderError = options.createRscOnErrorHandler(\n options.request,\n options.cleanPathname,\n options.cleanPathname,\n );\n const rscStream = await options.renderToReadableStream(\n { returnValue },\n { temporaryReferences, onError: onRenderError },\n );\n\n const actionHeaders = new Headers({\n \"Content-Type\": VINEXT_RSC_CONTENT_TYPE,\n Vary: VINEXT_RSC_VARY_HEADER,\n });\n applyEdgeRuntimeHeader(actionHeaders, options.isEdgeRuntime);\n mergeMiddlewareResponseHeaders(actionHeaders, options.middlewareHeaders);\n applyRscCompatibilityIdHeader(actionHeaders);\n for (const cookie of actionPendingCookies) {\n actionHeaders.append(\"Set-Cookie\", cookie);\n }\n if (actionDraftCookie) actionHeaders.append(\"Set-Cookie\", actionDraftCookie);\n setActionRevalidatedHeader(actionHeaders, actionRevalidationKind);\n\n return createServerActionRscResponse(\n rscStream,\n {\n status: options.middlewareStatus ?? actionStatus,\n headers: actionHeaders,\n },\n options.clearRequestContext,\n );\n }\n\n const match = options.matchRoute(options.cleanPathname);\n let element: TElement;\n let errorPattern = match ? match.route.pattern : options.cleanPathname;\n if (match) {\n const { route: actionRoute, params: actionParams } = match;\n const actionRerenderTarget = resolveAppPageActionRerenderTarget({\n cleanPathname: options.cleanPathname,\n currentParams: actionParams,\n currentRoute: actionRoute,\n findIntercept: options.findIntercept,\n getRouteParamNames: options.getRouteParamNames,\n getSourceRoute: options.getSourceRoute,\n isRscRequest: options.isRscRequest,\n toInterceptOpts: options.toInterceptOpts,\n });\n\n options.setNavigationContext({\n pathname: options.cleanPathname,\n searchParams: options.searchParams,\n params: actionRerenderTarget.navigationParams,\n });\n setCurrentFetchCacheMode(\n options.resolveRouteFetchCacheMode?.(actionRerenderTarget.route) ?? null,\n );\n setCurrentFetchSoftTags(\n buildServerActionPageTags(actionRerenderTarget.route, options.cleanPathname),\n );\n element = options.buildPageElement({\n cleanPathname: options.cleanPathname,\n interceptOpts: actionRerenderTarget.interceptOpts,\n isRscRequest: options.isRscRequest,\n mountedSlotsHeader: options.mountedSlotsHeader,\n params: actionRerenderTarget.params,\n request: options.request,\n route: actionRerenderTarget.route,\n searchParams: options.searchParams,\n renderMode: APP_RSC_RENDER_MODE_ACTION_RERENDER_PRESERVE_UI,\n });\n errorPattern = actionRerenderTarget.route.pattern;\n } else {\n const actionRouteId = options.createPayloadRouteId(options.cleanPathname, null);\n element = options.createNotFoundElement(actionRouteId);\n }\n\n const onRenderError = options.createRscOnErrorHandler(\n options.request,\n options.cleanPathname,\n errorPattern,\n );\n const rscStream = await options.renderToReadableStream(\n { root: element, returnValue },\n { temporaryReferences, onError: onRenderError },\n );\n\n const actionHeaders = new Headers({\n \"Content-Type\": VINEXT_RSC_CONTENT_TYPE,\n Vary: VINEXT_RSC_VARY_HEADER,\n });\n applyEdgeRuntimeHeader(actionHeaders, options.isEdgeRuntime);\n mergeMiddlewareResponseHeaders(actionHeaders, options.middlewareHeaders);\n applyRscCompatibilityIdHeader(actionHeaders);\n setActionRevalidatedHeader(actionHeaders, actionRevalidationKind);\n const actionResponse = createServerActionRscResponse(\n rscStream,\n {\n status: options.middlewareStatus ?? actionStatus,\n headers: actionHeaders,\n },\n options.clearRequestContext,\n );\n if (actionPendingCookies.length > 0 || actionDraftCookie) {\n for (const cookie of actionPendingCookies) {\n actionResponse.headers.append(\"Set-Cookie\", cookie);\n }\n if (actionDraftCookie) actionResponse.headers.append(\"Set-Cookie\", actionDraftCookie);\n }\n return actionResponse;\n } catch (error) {\n getAndClearActionRevalidationKind();\n return createServerActionErrorResponse(error, {\n cleanPathname: options.cleanPathname,\n clearRequestContext: options.clearRequestContext,\n getAndClearPendingCookies: options.getAndClearPendingCookies,\n reportRequestError: options.reportRequestError,\n request: options.request,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmQA,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;AAClC,MAAM,2CAA2C;AACjD,MAAM,0CAA0C;CAC9C;CACA;CAC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