@wular/pnext 0.1.5 → 0.1.7

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 (302) hide show
  1. package/bin/pnext +9 -2
  2. package/dist/server/_chunks/aliases-j47a10ce.js +44 -0
  3. package/dist/server/_chunks/analyze-arswqe6s.js +445 -0
  4. package/dist/server/_chunks/boot-af0mv3dy.js +36 -0
  5. package/dist/server/_chunks/build-spy3dxp4.js +84 -0
  6. package/dist/server/_chunks/build-t9h0hec3.js +3550 -0
  7. package/dist/server/_chunks/build-tier-m7yvqz61.js +2472 -0
  8. package/dist/server/_chunks/compile-53j02j27.js +22 -0
  9. package/dist/server/_chunks/config-1yzwexq6.js +27 -0
  10. package/dist/server/_chunks/config-n2z7yxps.js +22 -0
  11. package/dist/server/_chunks/create-meec9hs6.js +134 -0
  12. package/dist/server/_chunks/dev-fjmqg6en.js +220 -0
  13. package/dist/server/_chunks/esbuild-yyktfrtt.js +15 -0
  14. package/dist/server/_chunks/generate-n9sh6hzt.js +21 -0
  15. package/dist/server/_chunks/index-0374j2b9.js +66 -0
  16. package/dist/server/_chunks/index-06nyqntx.js +213 -0
  17. package/dist/server/_chunks/index-1011cscr.js +5263 -0
  18. package/dist/server/_chunks/index-11sfk4hb.js +170 -0
  19. package/dist/server/_chunks/index-20ppawv7.js +297 -0
  20. package/dist/server/_chunks/index-2dv4y4wd.js +1065 -0
  21. package/dist/server/_chunks/index-2vz0wzdn.js +59 -0
  22. package/dist/server/_chunks/index-2wfv4kvx.js +182 -0
  23. package/dist/server/_chunks/index-357na4a8.js +109 -0
  24. package/dist/server/_chunks/index-3b3at80h.js +109 -0
  25. package/dist/server/_chunks/index-3tf1xjsp.js +6166 -0
  26. package/dist/server/_chunks/index-3xbr4eyv.js +105 -0
  27. package/dist/server/_chunks/index-4399bvd2.js +18 -0
  28. package/dist/server/_chunks/index-4hgjrqh7.js +851 -0
  29. package/dist/server/_chunks/index-4q2gbfwk.js +2530 -0
  30. package/dist/server/_chunks/index-4t92hdxd.js +172 -0
  31. package/dist/server/_chunks/index-4zzebszd.js +10 -0
  32. package/dist/server/_chunks/index-5gyr4emz.js +107 -0
  33. package/dist/server/_chunks/index-5hr4062s.js +70 -0
  34. package/dist/server/_chunks/index-68m3mwbd.js +84 -0
  35. package/dist/server/_chunks/index-6b009mt0.js +56 -0
  36. package/dist/server/_chunks/index-6e4fqv30.js +588 -0
  37. package/dist/server/_chunks/index-6gex3pfa.js +15 -0
  38. package/dist/server/_chunks/index-6kp9r0d9.js +11 -0
  39. package/dist/server/_chunks/index-6q7zvrap.js +134 -0
  40. package/dist/server/_chunks/index-73z4esab.js +38 -0
  41. package/dist/server/_chunks/index-79ngvam8.js +60 -0
  42. package/dist/server/_chunks/index-7wc9n8be.js +25 -0
  43. package/dist/server/_chunks/index-8k7pfejn.js +1599 -0
  44. package/dist/server/_chunks/index-8kcxdfya.js +206 -0
  45. package/dist/server/_chunks/index-91x12ykq.js +274 -0
  46. package/dist/server/_chunks/index-9ch50vtq.js +18 -0
  47. package/dist/server/_chunks/index-9hx2641q.js +28 -0
  48. package/dist/server/_chunks/index-9n2914ww.js +535 -0
  49. package/dist/server/_chunks/index-9ych9ma8.js +207 -0
  50. package/dist/server/_chunks/index-b6wtkdp4.js +24 -0
  51. package/dist/server/_chunks/index-bcws5eh2.js +35 -0
  52. package/dist/server/_chunks/index-c0g2wf3z.js +92 -0
  53. package/dist/server/_chunks/index-cf4rvxv6.js +95 -0
  54. package/dist/server/_chunks/index-cjgqs13g.js +65 -0
  55. package/dist/server/_chunks/index-ckkdpht5.js +41 -0
  56. package/dist/server/_chunks/index-cyfednwb.js +87 -0
  57. package/dist/server/_chunks/index-danncfhy.js +311 -0
  58. package/dist/server/_chunks/index-dg0f05zs.js +199 -0
  59. package/dist/server/_chunks/index-e3a6yx84.js +18 -0
  60. package/dist/server/_chunks/index-e88tyv35.js +45 -0
  61. package/dist/server/_chunks/index-eajaspjk.js +1253 -0
  62. package/dist/server/_chunks/index-eeaanp2e.js +483 -0
  63. package/dist/server/_chunks/index-egykcqg3.js +101 -0
  64. package/dist/server/_chunks/index-en7n9f7m.js +22 -0
  65. package/dist/server/_chunks/index-ezgj0tr1.js +88 -0
  66. package/dist/server/_chunks/index-fkp000p1.js +590 -0
  67. package/dist/server/_chunks/index-fn1chkkd.js +214 -0
  68. package/dist/server/_chunks/index-fp8r0sqs.js +64 -0
  69. package/dist/server/_chunks/index-ggk2j965.js +9432 -0
  70. package/dist/server/_chunks/index-grta8ap3.js +238 -0
  71. package/dist/server/_chunks/index-h2a70tg4.js +7 -0
  72. package/dist/server/_chunks/index-h4xy648y.js +51 -0
  73. package/dist/server/_chunks/index-hkdfj58q.js +92 -0
  74. package/dist/server/_chunks/index-j2zrcp1k.js +66 -0
  75. package/dist/server/_chunks/index-jcsjq3d1.js +20 -0
  76. package/dist/server/_chunks/index-jepjvcrf.js +198 -0
  77. package/dist/server/_chunks/index-jks0x0a1.js +14 -0
  78. package/dist/server/_chunks/index-jx7bqvw1.js +57 -0
  79. package/dist/server/_chunks/index-k1g3epw0.js +1299 -0
  80. package/dist/server/_chunks/index-knp0s912.js +7 -0
  81. package/dist/server/_chunks/index-kq8kpzye.js +472 -0
  82. package/dist/server/_chunks/index-kqyy1d4f.js +50 -0
  83. package/dist/server/_chunks/index-kresp2n8.js +445 -0
  84. package/dist/server/_chunks/index-ms9v9tnx.js +31 -0
  85. package/dist/server/_chunks/index-n4hxpng2.js +11 -0
  86. package/dist/server/_chunks/index-ncnes8c6.js +17 -0
  87. package/dist/server/_chunks/index-nqh3xhdc.js +57 -0
  88. package/dist/server/_chunks/index-nyrba2kr.js +4130 -0
  89. package/dist/server/_chunks/index-p77b4kcx.js +296 -0
  90. package/dist/server/_chunks/index-pym1cezq.js +39 -0
  91. package/dist/server/_chunks/index-q738kkhj.js +100 -0
  92. package/dist/server/_chunks/index-qjj6gddn.js +54 -0
  93. package/dist/server/_chunks/index-qm6kmhqs.js +110 -0
  94. package/dist/server/_chunks/index-qn4z5s3c.js +819 -0
  95. package/dist/server/_chunks/index-qpwsgt3a.js +158 -0
  96. package/dist/server/_chunks/index-r97ptz1q.js +97 -0
  97. package/dist/server/_chunks/index-ras0sdab.js +26 -0
  98. package/dist/server/_chunks/index-rcs322t1.js +19 -0
  99. package/dist/server/_chunks/index-rn8dyr1f.js +126 -0
  100. package/dist/server/_chunks/index-rt9qq1va.js +4 -0
  101. package/dist/server/_chunks/index-rthrsed5.js +356 -0
  102. package/dist/server/_chunks/index-sctcgyvv.js +185 -0
  103. package/dist/server/_chunks/index-sjpckxqn.js +213 -0
  104. package/dist/server/_chunks/index-sq3kvz3g.js +200 -0
  105. package/dist/server/_chunks/index-stbk3jhn.js +31 -0
  106. package/dist/server/_chunks/index-sv8m6789.js +266 -0
  107. package/dist/server/_chunks/index-tgcakdxc.js +125 -0
  108. package/dist/server/_chunks/index-tgsfjmep.js +74 -0
  109. package/dist/server/_chunks/index-tq0pc7eg.js +154 -0
  110. package/dist/server/_chunks/index-tq1f96v7.js +51 -0
  111. package/dist/server/_chunks/index-tqn2qnnn.js +241 -0
  112. package/dist/server/_chunks/index-tvqkq6e6.js +128 -0
  113. package/dist/server/_chunks/index-v1ags1na.js +132 -0
  114. package/dist/server/_chunks/index-vvmmknm1.js +1431 -0
  115. package/dist/server/_chunks/index-vvq7rqtn.js +329 -0
  116. package/dist/server/_chunks/index-vz0km5qk.js +33 -0
  117. package/dist/server/_chunks/index-w6h8m6vp.js +138 -0
  118. package/dist/server/_chunks/index-web361b8.js +138 -0
  119. package/dist/server/_chunks/index-wpfhfbs4.js +194 -0
  120. package/dist/server/_chunks/index-x0y005nh.js +283 -0
  121. package/dist/server/_chunks/index-x3yn4ywm.js +22 -0
  122. package/dist/server/_chunks/index-x93hv0sc.js +271 -0
  123. package/dist/server/_chunks/index-xvj80c3a.js +30 -0
  124. package/dist/server/_chunks/index-xywjg2vc.js +100 -0
  125. package/dist/server/_chunks/index-y2jr2n72.js +152 -0
  126. package/dist/server/_chunks/index-y36a0ybw.js +57 -0
  127. package/dist/server/_chunks/index-ye9hmsvf.js +47 -0
  128. package/dist/server/_chunks/index-yhxkxghe.js +56 -0
  129. package/dist/server/_chunks/index-ym67zqxp.js +130 -0
  130. package/dist/server/_chunks/index-ytjvpbm2.js +736 -0
  131. package/dist/server/_chunks/index-yz54pxrh.js +960 -0
  132. package/dist/server/_chunks/index-z4z9zv3b.js +733 -0
  133. package/dist/server/_chunks/index-z84ab1w0.js +1270 -0
  134. package/dist/server/_chunks/index-z88qv16t.js +11 -0
  135. package/dist/server/_chunks/index-zqpqyg8p.js +666 -0
  136. package/dist/server/_chunks/loader-7yw0j98z.js +78 -0
  137. package/dist/server/_chunks/modules-jn8bmbn8.js +74 -0
  138. package/dist/server/_chunks/pipeline-yy9jhydf.js +832 -0
  139. package/dist/server/_chunks/production-jar9ztm3.js +44 -0
  140. package/dist/server/_chunks/proxy-config-j84dgksn.js +21 -0
  141. package/dist/server/_chunks/proxy-w1d0wmsn.js +33 -0
  142. package/dist/server/_chunks/router-k1reahfn.js +498 -0
  143. package/dist/server/_chunks/routes-2s277fc6.js +64 -0
  144. package/dist/server/_chunks/run-pvd8bs1t.js +696 -0
  145. package/dist/server/_chunks/server-mt4a994c.js +1835 -0
  146. package/dist/server/_chunks/tsconfig-defaults-1nb3308g.js +20 -0
  147. package/dist/server/_chunks/typegen-0qr0459b.js +35 -0
  148. package/dist/server/api/client-cache.js +14 -0
  149. package/dist/server/cli/index.js +378 -0
  150. package/dist/server/cli/start.js +137 -0
  151. package/dist/server/client/reference.js +16 -0
  152. package/dist/server/compat/next/cache.js +56 -0
  153. package/dist/server/compat/next/canonical-url.js +13 -0
  154. package/dist/server/compat/next/client-cache.js +57 -0
  155. package/dist/server/compat/next/client-navigation.js +232 -0
  156. package/dist/server/compat/next/client-only.js +1 -0
  157. package/dist/server/compat/next/client-script.js +178 -0
  158. package/dist/server/compat/next/client-server.js +34 -0
  159. package/dist/server/compat/next/config-headers.js +32 -0
  160. package/dist/server/compat/next/config-loader.js +25 -0
  161. package/dist/server/compat/next/config.js +10 -0
  162. package/dist/server/compat/next/constants.js +18 -0
  163. package/dist/server/compat/next/custom-server.js +10 -0
  164. package/dist/server/compat/next/dist/client/components/app-router-headers.js +48 -0
  165. package/dist/server/compat/next/dist/server/web/spec-extension/revalidate.js +27 -0
  166. package/dist/server/compat/next/dist/server/web/spec-extension/unstable-cache.js +25 -0
  167. package/dist/server/compat/next/dist/server/web/spec-extension/unstable-no-store.js +25 -0
  168. package/dist/server/compat/next/dynamic.js +32 -0
  169. package/dist/server/compat/next/error.js +112 -0
  170. package/dist/server/compat/next/font/cache.js +14 -0
  171. package/dist/server/compat/next/font/google.js +3 -0
  172. package/dist/server/compat/next/font/index.js +1 -0
  173. package/dist/server/compat/next/font/local.js +22 -0
  174. package/dist/server/compat/next/font/runtime-client.js +33 -0
  175. package/dist/server/compat/next/font/runtime.js +41 -0
  176. package/dist/server/compat/next/font/shared.js +22 -0
  177. package/dist/server/compat/next/form.js +129 -0
  178. package/dist/server/compat/next/head.js +10 -0
  179. package/dist/server/compat/next/headers.js +30 -0
  180. package/dist/server/compat/next/image/client.js +11 -0
  181. package/dist/server/compat/next/image/config.js +18 -0
  182. package/dist/server/compat/next/image/optimizer.js +25 -0
  183. package/dist/server/compat/next/image/patterns.js +12 -0
  184. package/dist/server/compat/next/image/props.js +16 -0
  185. package/dist/server/compat/next/image/shared.js +86 -0
  186. package/dist/server/compat/next/image/static-metadata.js +32 -0
  187. package/dist/server/compat/next/image/validate.js +8 -0
  188. package/dist/server/compat/next/image.js +59 -0
  189. package/dist/server/compat/next/index.js +1 -0
  190. package/dist/server/compat/next/legacy-image.js +78 -0
  191. package/dist/server/compat/next/legacy-request-apis.js +24 -0
  192. package/dist/server/compat/next/link-transform.js +14 -0
  193. package/dist/server/compat/next/link.js +14 -0
  194. package/dist/server/compat/next/navigation.js +190 -0
  195. package/dist/server/compat/next/offline.js +45 -0
  196. package/dist/server/compat/next/og.js +8 -0
  197. package/dist/server/compat/next/preferred-region.js +8 -0
  198. package/dist/server/compat/next/redirects.js +30 -0
  199. package/dist/server/compat/next/resource-hints.js +30 -0
  200. package/dist/server/compat/next/rewrites.js +41 -0
  201. package/dist/server/compat/next/root-params.js +121 -0
  202. package/dist/server/compat/next/route-state.js +23 -0
  203. package/dist/server/compat/next/router.js +103 -0
  204. package/dist/server/compat/next/script.js +37 -0
  205. package/dist/server/compat/next/server-only.js +1 -0
  206. package/dist/server/compat/next/server.js +131 -0
  207. package/dist/server/compat/next/svgr.js +14 -0
  208. package/dist/server/compat/next/telemetry.js +10 -0
  209. package/dist/server/compat/next/usage.js +13 -0
  210. package/dist/server/compat/next/user-agent.js +12 -0
  211. package/dist/server/compat/next/web-vitals.js +35 -0
  212. package/dist/server/compat/react/action-state.js +11 -0
  213. package/dist/server/compat/react/client-lite.js +83 -0
  214. package/dist/server/compat/react/client.js +131 -0
  215. package/dist/server/compat/react/compiler-runtime.js +42 -0
  216. package/dist/server/compat/react/dom-client.js +106 -0
  217. package/dist/server/compat/react/dom-react-server.js +37 -0
  218. package/dist/server/compat/react/dom-server.js +40 -0
  219. package/dist/server/compat/react/dom.js +52 -0
  220. package/dist/server/compat/react/hooks-extra.js +12 -0
  221. package/dist/server/compat/react/internals.js +14 -0
  222. package/dist/server/compat/react/parity.js +11 -0
  223. package/dist/server/compat/react/preact.js +113 -0
  224. package/dist/server/compat/react/react-server.js +133 -0
  225. package/dist/server/compat/react/router-shim.js +8 -0
  226. package/dist/server/compat/react/server-component-use.js +14 -0
  227. package/dist/server/compat/react/server-inserted-html.js +14 -0
  228. package/dist/server/compat/react/server.js +194 -0
  229. package/dist/server/compat/react/style-values.js +10 -0
  230. package/dist/server/compat/react/use.js +10 -0
  231. package/dist/server/compat/react/view-transition.js +12 -0
  232. package/dist/server/generation.json +1 -0
  233. package/package.json +4 -1
  234. package/src/api/dynamic.tsx +2 -0
  235. package/src/api/server.ts +24 -6
  236. package/src/cli/adapters/vercel-warm.ts +315 -61
  237. package/src/cli/adapters/vercel.ts +348 -71
  238. package/src/cli/build.ts +58 -33
  239. package/src/cli/index.ts +23 -10
  240. package/src/cli/serve/entry.ts +21 -159
  241. package/src/cli/serve/immutable.ts +31 -0
  242. package/src/cli/serve/pipeline.ts +82 -84
  243. package/src/cli/start.ts +3 -1
  244. package/src/client/chunk-fold.ts +19 -6
  245. package/src/client/react-tier.ts +3 -2
  246. package/src/client/reference-stub.ts +21 -2
  247. package/src/compat/actions/client-plugin.ts +4 -2
  248. package/src/compat/actions/config.ts +6 -5
  249. package/src/compat/actions/extensions.ts +2 -3
  250. package/src/compat/aliases.ts +8 -1
  251. package/src/compat/bundler/config.ts +88 -0
  252. package/src/compat/bundler/optimize-package-imports.ts +86 -26
  253. package/src/compat/bundler/relay-transform.ts +15 -3
  254. package/src/compat/cache-control.ts +16 -8
  255. package/src/compat/css/modules.ts +18 -5
  256. package/src/compat/lifecycle/error-funnel.ts +1 -1
  257. package/src/compat/lifecycle/instrumentation.ts +117 -24
  258. package/src/compat/lifecycle/testmode.ts +3 -2
  259. package/src/compat/next/config-loader.ts +137 -13
  260. package/src/compat/next/font/runtime.ts +22 -2
  261. package/src/compat/next/og.ts +3 -3
  262. package/src/compat/next/usage.ts +3 -2
  263. package/src/compat/pages/api.ts +83 -14
  264. package/src/compat/pages/router.ts +30 -14
  265. package/src/compat/register/bundler.ts +3 -1
  266. package/src/compat/register/middleware.ts +1 -1
  267. package/src/compat/register/otel.ts +5 -9
  268. package/src/compat/register/render.ts +3 -1
  269. package/src/compat/register/use-cache.ts +3 -1
  270. package/src/compat/release.ts +46 -0
  271. package/src/compat/segment/serve.ts +1 -1
  272. package/src/compat/validation/validate.ts +10 -7
  273. package/src/config.ts +51 -7
  274. package/src/css/assets.ts +213 -0
  275. package/src/css/build.ts +174 -238
  276. package/src/dev/server.ts +27 -8
  277. package/src/extensions.ts +4 -0
  278. package/src/render/hooks.ts +13 -0
  279. package/src/render/renderer.ts +52 -32
  280. package/src/request/context.ts +9 -0
  281. package/src/resolve/dynamic.ts +3 -1
  282. package/src/resolve/imports.ts +12 -52
  283. package/src/resolve/package-json.ts +56 -0
  284. package/src/resolve/scan-facts.ts +65 -0
  285. package/src/routing/href.ts +10 -3
  286. package/src/routing/match.ts +287 -0
  287. package/src/routing/metadata-files.ts +19 -5
  288. package/src/routing/proxy-config.ts +137 -0
  289. package/src/routing/proxy.ts +35 -134
  290. package/src/routing/routes.ts +22 -281
  291. package/src/runtime/fingerprint.ts +23 -8
  292. package/src/runtime/load.ts +170 -0
  293. package/src/runtime/loader.ts +215 -43
  294. package/src/runtime/module-cache.ts +13 -0
  295. package/src/runtime/modules.ts +370 -81
  296. package/src/runtime/prebundle.ts +81 -0
  297. package/src/runtime/production.ts +391 -0
  298. package/src/runtime/release-graph.ts +334 -0
  299. package/src/runtime/vendor-build.ts +724 -13
  300. package/src/runtime/vendor.ts +16 -3
  301. package/src/types.ts +2 -0
  302. package/src/utils/fs.ts +89 -3
@@ -0,0 +1,1270 @@
1
+ // @bun
2
+ import {
3
+ actionId,
4
+ inlineUseServerFunctions,
5
+ moduleLevelUseServer,
6
+ workspaceRelative
7
+ } from "./index-6q7zvrap.js";
8
+ import {
9
+ isTaggedPrimitiveThrow,
10
+ tagPrimitiveThrow,
11
+ untagPrimitiveThrow
12
+ } from "./index-79ngvam8.js";
13
+ import {
14
+ revalidationEventCount
15
+ } from "./index-9n2914ww.js";
16
+ import {
17
+ getNextConfig,
18
+ nextConfigReleased
19
+ } from "./index-6e4fqv30.js";
20
+ import {
21
+ pathToFileHref
22
+ } from "./index-x93hv0sc.js";
23
+ import {
24
+ runWithRequest,
25
+ setPhase
26
+ } from "./index-grta8ap3.js";
27
+
28
+ // src/compat/actions/config.ts
29
+ import { existsSync } from "fs";
30
+ import { createRequire } from "module";
31
+ import path from "path";
32
+
33
+ // src/compat/actions/endpoint.ts
34
+ import { isNotFoundError, isRedirectError } from "../../../src/api/navigation.ts";
35
+ import { toNextRequest } from "../../../src/api/server.ts";
36
+
37
+ // src/compat/lifecycle/error-serialize.ts
38
+ var REDACTED_MESSAGE = "Minified React error #441; visit https://react.dev/errors/441 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
39
+ function stableDigest(input) {
40
+ let hash = 5381;
41
+ for (let i = 0;i < input.length; i++) {
42
+ hash = hash * 33 ^ input.charCodeAt(i);
43
+ }
44
+ return (hash >>> 0).toString();
45
+ }
46
+ function customDigest(error) {
47
+ const digest = error.digest;
48
+ return typeof digest === "string" && digest.length > 0 ? digest : undefined;
49
+ }
50
+ function digestSuffix(error) {
51
+ if (!isTaggedPrimitiveThrow(error))
52
+ return "";
53
+ const raw = untagPrimitiveThrow(error);
54
+ return raw === null || raw === undefined ? "@E394" : "";
55
+ }
56
+ function wrapThrownValue(value) {
57
+ const error = tagPrimitiveThrow(value);
58
+ error.stack = `Error: ${error.message}
59
+ at stringify (<anonymous>)`;
60
+ return error;
61
+ }
62
+ function formatErrorLog(trace, digest, error) {
63
+ const environmentName = error?.environmentName;
64
+ const environment = typeof environmentName === "string" ? ` environmentName: '${environmentName}',
65
+ ` : "";
66
+ return `\u2A2F ${trace} {
67
+ ${environment} digest: '${digest}'
68
+ }`;
69
+ }
70
+ function serializeBoundaryError(ctx) {
71
+ const { error, dev } = ctx;
72
+ const custom = customDigest(error);
73
+ const digest = custom ?? stableDigest(`${error.message}${error.stack ?? ""}`) + digestSuffix(error);
74
+ const boundaryError = new Error(dev ? error.message : REDACTED_MESSAGE);
75
+ boundaryError.name = error.name || "Error";
76
+ boundaryError.digest = digest;
77
+ boundaryError.stack = undefined;
78
+ return boundaryError;
79
+ }
80
+
81
+ // src/compat/actions/registry.ts
82
+ var registry = new Map;
83
+ function registerActionModule(filePath, exportNames, options = {}) {
84
+ const modulePath = options.modulePath ?? filePath;
85
+ const entries = [];
86
+ for (const exportName of exportNames) {
87
+ const id = actionId(filePath, exportName, options.root);
88
+ const entry = { id, modulePath, exportName, filePath };
89
+ registry.set(id, entry);
90
+ entries.push(entry);
91
+ }
92
+ return entries;
93
+ }
94
+ function lookupAction(id) {
95
+ const entry = registry.get(id);
96
+ if (!entry)
97
+ return;
98
+ return { modulePath: entry.modulePath, exportName: entry.exportName };
99
+ }
100
+ function lookupActionSource(id) {
101
+ return registry.get(id)?.filePath;
102
+ }
103
+ function clearActions() {
104
+ registry.clear();
105
+ }
106
+
107
+ // src/compat/actions/instances.ts
108
+ import { createHash } from "crypto";
109
+ var instances = new Map;
110
+ function createInstanceScope(routeId) {
111
+ return { routeId, counts: new Map };
112
+ }
113
+ function registerActionInstance(scope, fn) {
114
+ const callable = fn;
115
+ const hash = sourceHash(callable);
116
+ const index = scope.counts.get(hash) ?? 0;
117
+ scope.counts.set(hash, index + 1);
118
+ const id = `i:${scope.routeId}:${hash}:${index}`;
119
+ instances.set(id, callable);
120
+ return id;
121
+ }
122
+ function lookupActionInstance(id) {
123
+ return instances.get(id);
124
+ }
125
+ function isInstanceActionId(id) {
126
+ return id.startsWith("i:");
127
+ }
128
+ function instanceActionRouteId(id) {
129
+ if (!isInstanceActionId(id))
130
+ return;
131
+ const parts = id.split(":");
132
+ if (parts.length < 4)
133
+ return;
134
+ return parts.slice(1, -2).join(":");
135
+ }
136
+ globalThis.__pnextMarkInlineAction = (fn) => {
137
+ if (typeof fn === "function")
138
+ fn.$$pnextInlineAction = true;
139
+ return fn;
140
+ };
141
+ function isMarkedInlineAction(fn) {
142
+ return typeof fn === "function" && fn.$$pnextInlineAction === true;
143
+ }
144
+ globalThis.__pnextTagInlineAction = (fn, id) => {
145
+ if (typeof fn !== "function")
146
+ return;
147
+ const tagged = fn;
148
+ instances.set(id, tagged);
149
+ tagged.$$pnextAssignedId = id;
150
+ if (!("$$id" in tagged)) {
151
+ Object.defineProperty(tagged, "$$id", { value: id, configurable: true, writable: true });
152
+ }
153
+ };
154
+ function overriddenActionId(fn) {
155
+ if (typeof fn !== "function")
156
+ return;
157
+ const tagged = fn;
158
+ if (typeof tagged.$$id === "string" && tagged.$$id !== tagged.$$pnextAssignedId) {
159
+ return tagged.$$id;
160
+ }
161
+ return;
162
+ }
163
+ function assignedInlineActionId(fn) {
164
+ if (typeof fn !== "function")
165
+ return;
166
+ const tagged = fn;
167
+ return typeof tagged.$$pnextAssignedId === "string" ? tagged.$$pnextAssignedId : undefined;
168
+ }
169
+ function sourceHash(fn) {
170
+ let source = "";
171
+ try {
172
+ source = String(fn);
173
+ } catch {
174
+ source = "opaque";
175
+ }
176
+ return createHash("sha256").update(source).digest("hex").slice(0, 10);
177
+ }
178
+
179
+ // src/compat/actions/rewrite.ts
180
+ function rewriteInlineActionTags(source, file, root) {
181
+ if (!source.includes("use server"))
182
+ return source;
183
+ if (moduleLevelUseServer(source))
184
+ return source;
185
+ const topLevel = inlineUseServerFunctions(source).filter((action) => action.start === 0 || source[action.start - 1] === `
186
+ `);
187
+ if (topLevel.length === 0)
188
+ return source;
189
+ const key = workspaceRelative(file, root);
190
+ const insertions = [];
191
+ const fallbacks = [];
192
+ for (const action of topLevel) {
193
+ if (source.includes(`__pnextTagInlineAction(${action.name},`))
194
+ continue;
195
+ const id = inlineActionId(key, action.name);
196
+ const tag = `
197
+ ;typeof ${action.name} === 'function' && globalThis.__pnextTagInlineAction && globalThis.__pnextTagInlineAction(${action.name}, ${JSON.stringify(id)});`;
198
+ const at = declarationEnd(source, action.directiveEnd);
199
+ if (at === undefined)
200
+ fallbacks.push(tag);
201
+ else
202
+ insertions.push({ at, text: tag });
203
+ }
204
+ let out = source;
205
+ for (const { at, text } of insertions.sort((a, b) => b.at - a.at)) {
206
+ out = out.slice(0, at) + text + out.slice(at);
207
+ }
208
+ if (fallbacks.length > 0)
209
+ out = `${out}
210
+ ${fallbacks.join(`
211
+ `)}
212
+ `;
213
+ return out;
214
+ }
215
+ function rewriteAnonymousInlineActionMarks(source) {
216
+ if (!source.includes("use server"))
217
+ return source;
218
+ if (moduleLevelUseServer(source))
219
+ return source;
220
+ const wraps = anonymousInlineActionSpans(source);
221
+ if (wraps.length === 0)
222
+ return source;
223
+ let out = source;
224
+ for (const { start, end } of wraps.sort((a, b) => b.start - a.start)) {
225
+ const fn = out.slice(start, end);
226
+ out = `${out.slice(0, start)}(globalThis.__pnextMarkInlineAction ? globalThis.__pnextMarkInlineAction(${fn}) : ${fn})${out.slice(end)}`;
227
+ }
228
+ return out;
229
+ }
230
+ function anonymousInlineActionSpans(source) {
231
+ const directive = /\{\s*(['"])use server\1\s*;?/g;
232
+ const spans = [];
233
+ for (let match;match = directive.exec(source); ) {
234
+ const start = functionExpressionStart(source, match.index);
235
+ if (start === undefined)
236
+ continue;
237
+ const end = bodyEnd(source, match.index);
238
+ if (end === undefined)
239
+ continue;
240
+ spans.push({ start, end, directiveEnd: match.index + match[0].length });
241
+ }
242
+ return spans;
243
+ }
244
+ function functionExpressionStart(source, open) {
245
+ let i = skipBackWhitespace(source, open - 1);
246
+ if (source[i] === ">" && source[i - 1] === "=") {
247
+ i = skipBackWhitespace(source, i - 2);
248
+ const head = source[i] === ")" ? matchingOpenParen(source, i) : identifierStart(source, i);
249
+ if (head === undefined)
250
+ return;
251
+ i = head;
252
+ } else if (source[i] === ")") {
253
+ const paren = matchingOpenParen(source, i);
254
+ if (paren === undefined)
255
+ return;
256
+ let j = skipBackWhitespace(source, paren - 1);
257
+ const name = identifierStart(source, j);
258
+ if (name === undefined)
259
+ return;
260
+ if (source.slice(name, j + 1) !== "function") {
261
+ j = skipBackWhitespace(source, name - 1);
262
+ const keyword = identifierStart(source, j);
263
+ if (keyword === undefined || source.slice(keyword, j + 1) !== "function")
264
+ return;
265
+ i = keyword;
266
+ } else {
267
+ i = name;
268
+ }
269
+ } else {
270
+ return;
271
+ }
272
+ const withAsync = precedingKeyword(source, i, "async");
273
+ if (withAsync !== undefined)
274
+ i = withAsync;
275
+ const before = skipBackWhitespace(source, i - 1);
276
+ if (before < 0)
277
+ return;
278
+ if (source[before] === "{")
279
+ return isJsxExpressionContainer(source, before) ? i : undefined;
280
+ return "(,:[=?&|".includes(source[before] ?? "") ? i : undefined;
281
+ }
282
+ function isJsxExpressionContainer(source, open) {
283
+ const before = skipBackWhitespace(source, open - 1);
284
+ if (before < 0)
285
+ return false;
286
+ const ch = source[before];
287
+ if (source[before - 1] === "=")
288
+ return false;
289
+ return ch === "=" || ch === ">";
290
+ }
291
+ function skipBackWhitespace(source, from) {
292
+ let i = from;
293
+ while (i >= 0 && /\s/.test(source[i] ?? ""))
294
+ i--;
295
+ return i;
296
+ }
297
+ function identifierStart(source, end) {
298
+ if (!/[\w$]/.test(source[end] ?? ""))
299
+ return;
300
+ let i = end;
301
+ while (i >= 0 && /[\w$]/.test(source[i] ?? ""))
302
+ i--;
303
+ return i + 1;
304
+ }
305
+ function matchingOpenParen(source, close) {
306
+ let depth = 0;
307
+ for (let i = close;i >= 0; i--) {
308
+ if (source[i] === ")")
309
+ depth++;
310
+ else if (source[i] === "(") {
311
+ depth--;
312
+ if (depth === 0)
313
+ return i;
314
+ }
315
+ }
316
+ return;
317
+ }
318
+ function precedingKeyword(source, at, keyword) {
319
+ const end = skipBackWhitespace(source, at - 1);
320
+ const start = identifierStart(source, end);
321
+ if (start === undefined || source.slice(start, end + 1) !== keyword)
322
+ return;
323
+ return start;
324
+ }
325
+ function bodyEnd(source, open) {
326
+ const end = declarationEnd(source, open + 1);
327
+ if (end === undefined)
328
+ return;
329
+ return source[end - 1] === ";" ? end - 1 : end;
330
+ }
331
+ function declarationEnd(source, directiveEnd) {
332
+ let open = -1;
333
+ for (let i = directiveEnd - 1;i >= 0; i--) {
334
+ if (source[i] === "{") {
335
+ open = i;
336
+ break;
337
+ }
338
+ }
339
+ if (open === -1)
340
+ return;
341
+ let depth = 0;
342
+ for (let i = open;i < source.length; i++) {
343
+ const ch = source[i];
344
+ if (ch === '"' || ch === "'" || ch === "`") {
345
+ i = skipString(source, i, ch);
346
+ continue;
347
+ }
348
+ if (ch === "/" && source[i + 1] === "/") {
349
+ const nl = source.indexOf(`
350
+ `, i + 2);
351
+ if (nl === -1)
352
+ return;
353
+ i = nl;
354
+ continue;
355
+ }
356
+ if (ch === "/" && source[i + 1] === "*") {
357
+ const end = source.indexOf("*/", i + 2);
358
+ if (end === -1)
359
+ return;
360
+ i = end + 1;
361
+ continue;
362
+ }
363
+ if (ch === "{")
364
+ depth++;
365
+ else if (ch === "}") {
366
+ depth--;
367
+ if (depth === 0) {
368
+ let end = i + 1;
369
+ if (source[end] === ";")
370
+ end += 1;
371
+ return end;
372
+ }
373
+ }
374
+ }
375
+ return;
376
+ }
377
+ function skipString(source, i, quote) {
378
+ for (let j = i + 1;j < source.length; j++) {
379
+ const ch = source[j];
380
+ if (ch === "\\") {
381
+ j += 1;
382
+ continue;
383
+ }
384
+ if (ch === quote)
385
+ return j;
386
+ if (quote === "`" && ch === "$" && source[j + 1] === "{") {
387
+ let depth = 1;
388
+ j += 2;
389
+ while (j < source.length && depth > 0) {
390
+ if (source[j] === "{")
391
+ depth++;
392
+ else if (source[j] === "}")
393
+ depth--;
394
+ j++;
395
+ }
396
+ j -= 1;
397
+ }
398
+ }
399
+ return source.length;
400
+ }
401
+ function inlineActionId(fileKey, name) {
402
+ return `if:${encodeURIComponent(fileKey)}:${encodeURIComponent(name)}`;
403
+ }
404
+ function inlineActionModuleKey(id) {
405
+ if (!id.startsWith("if:"))
406
+ return;
407
+ const rest = id.slice(3);
408
+ const separator = rest.lastIndexOf(":");
409
+ if (separator === -1)
410
+ return;
411
+ try {
412
+ return decodeURIComponent(rest.slice(0, separator));
413
+ } catch {
414
+ return;
415
+ }
416
+ }
417
+ function isInlineActionId(id) {
418
+ return id.startsWith("if:");
419
+ }
420
+
421
+ // src/compat/actions/return.ts
422
+ var TEMP_REF_MARKER = "$$pnext_temp_ref";
423
+ var ACTION_ELEMENT_MARKER = "$$pnext_element";
424
+ var ACTION_ELEMENT_HTML_MARKER = "$$pnext_element_html";
425
+ var clientReferenceSymbol = Symbol.for("pnext.clientReference");
426
+ var ACTION_STREAM_CONTENT_TYPE = "x-component/pnext-stream";
427
+ function createTempRefScope() {
428
+ const ids = new WeakMap;
429
+ let active = false;
430
+ return {
431
+ track(object, id) {
432
+ ids.set(object, id);
433
+ active = true;
434
+ },
435
+ idFor(value) {
436
+ if (value === null || typeof value !== "object")
437
+ return;
438
+ return ids.get(value);
439
+ },
440
+ get active() {
441
+ return active;
442
+ }
443
+ };
444
+ }
445
+ function extractTempRefs(value, scope, seen = new Set) {
446
+ if (value === null || typeof value !== "object")
447
+ return value;
448
+ if (seen.has(value))
449
+ return value;
450
+ seen.add(value);
451
+ if (Array.isArray(value)) {
452
+ for (let i = 0;i < value.length; i++)
453
+ value[i] = extractTempRefs(value[i], scope, seen);
454
+ return value;
455
+ }
456
+ const record = value;
457
+ const id = record[TEMP_REF_MARKER];
458
+ if (typeof id === "string") {
459
+ delete record[TEMP_REF_MARKER];
460
+ scope.track(record, id);
461
+ }
462
+ for (const key of Object.keys(record)) {
463
+ record[key] = extractTempRefs(record[key], scope, seen);
464
+ }
465
+ return record;
466
+ }
467
+ async function serializeReturnWithTempRefs(value, scope, renderElement) {
468
+ const walk = async (input, seen) => {
469
+ if (input === null || typeof input !== "object")
470
+ return input;
471
+ const marker = scope.active ? scope.idFor(input) : undefined;
472
+ if (marker !== undefined)
473
+ return { [TEMP_REF_MARKER]: marker };
474
+ if (seen.has(input))
475
+ return input;
476
+ seen.add(input);
477
+ const element = clientReferenceElement(input);
478
+ if (element) {
479
+ return {
480
+ [ACTION_ELEMENT_MARKER]: {
481
+ id: element.id,
482
+ props: await walk(element.props, seen),
483
+ ...element.key !== undefined ? { key: element.key } : {}
484
+ }
485
+ };
486
+ }
487
+ if (renderElement && isServerElement(input)) {
488
+ return { [ACTION_ELEMENT_HTML_MARKER]: await renderElement(input) };
489
+ }
490
+ if (Array.isArray(input))
491
+ return Promise.all(input.map((item) => walk(item, seen)));
492
+ const proto = Object.getPrototypeOf(input);
493
+ if (proto !== Object.prototype && proto !== null)
494
+ return input;
495
+ const out = {};
496
+ for (const [key, item] of Object.entries(input)) {
497
+ out[key] = await walk(item, seen);
498
+ }
499
+ return out;
500
+ };
501
+ return walk(value, new Set);
502
+ }
503
+ function isServerElement(value) {
504
+ const vnode = value;
505
+ if (!("type" in vnode) || !("props" in vnode))
506
+ return false;
507
+ if (vnode.$$typeof === Symbol.for("react.element"))
508
+ return true;
509
+ return Object.prototype.hasOwnProperty.call(value, "constructor") && value.constructor === undefined;
510
+ }
511
+ function clientReferenceElement(value) {
512
+ const vnode = value;
513
+ if (typeof vnode.type !== "function")
514
+ return;
515
+ const reference = vnode.type[clientReferenceSymbol];
516
+ if (typeof reference?.id !== "string")
517
+ return;
518
+ const key = typeof vnode.key === "string" || typeof vnode.key === "number" ? vnode.key : undefined;
519
+ return { id: reference.id, props: vnode.props ?? {}, ...key !== undefined ? { key } : {} };
520
+ }
521
+ function isReadableStreamReturn(value) {
522
+ return typeof ReadableStream !== "undefined" && value instanceof ReadableStream;
523
+ }
524
+
525
+ // src/compat/actions/protocol.ts
526
+ var ACTION_ID_HEADER = "next-action";
527
+ var ACTION_REDIRECT_HEADER = "x-action-redirect";
528
+ var ACTION_REFRESH_HEADER = "x-pnext-action-refresh";
529
+ var NEXT_ACTION_REVALIDATED_HEADER = "x-action-revalidated";
530
+ var ACTION_NOT_FOUND_HEADER = "x-pnext-action-not-found";
531
+ var NEXT_ACTION_NOT_FOUND_HEADER = "x-nextjs-action-not-found";
532
+ var REDIRECT_TYPE_HEADER = "x-pnext-redirect-type";
533
+ var ACTION_ERROR_DIGEST_HEADER = "x-pnext-action-error-digest";
534
+ var ARG_ACTION_MARKER = "$$pnext_action_ref";
535
+ var ACTION_ID_FIELD = "$pnext_action_id";
536
+ var SUBMIT_ACTION_ID_FIELD = "$pnext_submit_action_id";
537
+ var ACTION_ARGS_FIELD = "$pnext_args";
538
+ var FORM_STATE_FIELD = "$pnext_form_state";
539
+ var ARG_FORMDATA_MARKER = "$$pnext_fd";
540
+ var ARG_FILE_MARKER = "$$pnext_file";
541
+ var ARG_FORMDATA_PREFIX = "$pnext_fd_";
542
+ var ARG_FILE_PREFIX = "$pnext_file_";
543
+ var PROP_ACTION_MARKER = "$$pnextAction";
544
+ var MAX_ACTION_ARGS = 1000;
545
+ function tooManyArgsMessage(count) {
546
+ return `Server Action arguments list is too long (${count}). Maximum allowed is ${MAX_ACTION_ARGS}.`;
547
+ }
548
+ var MASKED_ACTION_ERROR = "Minified React error #441; visit https://react.dev/errors/441 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
549
+
550
+ // src/compat/actions/endpoint.ts
551
+ var DEFAULT_BODY_LIMIT_BYTES = 1024 * 1024;
552
+ function installServerActionDispatch(importModule) {
553
+ globalThis.__PNEXT_SERVER_ACTIONS__ = {
554
+ async call(dispatchId, dispatchArgs) {
555
+ const target = lookupAction(dispatchId);
556
+ if (!target) {
557
+ throw new Error(`Failed to find Server Action "${dispatchId}". This request might be from an older or newer deployment.`);
558
+ }
559
+ const module = await importModule(target.modulePath);
560
+ const fn = module[target.exportName];
561
+ if (typeof fn !== "function") {
562
+ throw new Error(`Failed to find Server Action "${dispatchId}".`);
563
+ }
564
+ return fn(...dispatchArgs);
565
+ }
566
+ };
567
+ }
568
+ async function runAction(request, options) {
569
+ const id = request.headers.get(ACTION_ID_HEADER);
570
+ if (!id) {
571
+ return errorResponse(`Missing ${ACTION_ID_HEADER} header`, 400);
572
+ }
573
+ installServerActionDispatch(options.importModule);
574
+ let action;
575
+ try {
576
+ action = await resolveAction(id, request, options);
577
+ } catch (error) {
578
+ console.error(error);
579
+ action = undefined;
580
+ }
581
+ if (!action) {
582
+ console.error(`Failed to find Server Action "${id}". This request might be from an older or newer deployment.
583
+ ` + "Read more: https://nextjs.org/docs/messages/failed-to-find-server-action");
584
+ return new Response(`Server Action "${id}" was not found on the server.`, {
585
+ status: 404,
586
+ headers: {
587
+ "content-type": "text/plain; charset=utf-8",
588
+ [NEXT_ACTION_NOT_FOUND_HEADER]: "1"
589
+ }
590
+ });
591
+ }
592
+ const limit = options.maxBodyBytes ?? DEFAULT_BODY_LIMIT_BYTES;
593
+ let args;
594
+ try {
595
+ args = await decodeArgs(request, limit);
596
+ } catch (error) {
597
+ if (error instanceof BodyLimitError) {
598
+ console.error(`Error: ${error.message}`);
599
+ console.error("To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit");
600
+ return errorResponse(options.dev ? error.message : MASKED_ACTION_ERROR, 500);
601
+ }
602
+ return errorResponse(`Invalid action payload: ${messageOf(error)}`, 400);
603
+ }
604
+ try {
605
+ args = await reviveActionRefs(args, (id2) => resolveAction(id2, request, options));
606
+ } catch (error) {
607
+ if (error instanceof UnknownActionReferenceError) {
608
+ return errorResponse(error.message, 404);
609
+ }
610
+ return errorResponse(`Invalid action payload: ${messageOf(error)}`, 400);
611
+ }
612
+ if (args.length > MAX_ACTION_ARGS) {
613
+ const message = tooManyArgsMessage(args.length);
614
+ console.error(`Error: ${message}`);
615
+ return errorResponse(options.dev ? message : MASKED_ACTION_ERROR, 500);
616
+ }
617
+ const tempRefs = createTempRefScope();
618
+ args = args.map((arg) => extractTempRefs(arg, tempRefs));
619
+ const responseHeaders = new Headers;
620
+ const revalidationsBefore = revalidationEventCount();
621
+ const nextRequest = toNextRequest(request);
622
+ try {
623
+ setPhase("action");
624
+ const data = await runWithRequest(nextRequest, () => Promise.resolve(action(...args)), {}, { responseHeaders }).finally(() => setPhase("render"));
625
+ const refresh = revalidationEventCount() !== revalidationsBefore || hasSetCookie(responseHeaders);
626
+ if (isReadableStreamReturn(data)) {
627
+ const headers2 = new Headers({ "content-type": ACTION_STREAM_CONTENT_TYPE });
628
+ setRefreshHeaders(headers2, refresh);
629
+ return withResponseHeaders(new Response(data, { status: 200, headers: headers2 }), responseHeaders);
630
+ }
631
+ const serialized = await serializeReturnWithTempRefs(data, tempRefs, options.renderActionElement);
632
+ const body = {
633
+ data: encodeBinaryReturn(serialized)
634
+ };
635
+ const headers = new Headers({ "content-type": "application/json; charset=utf-8" });
636
+ setRefreshHeaders(headers, refresh);
637
+ return withResponseHeaders(new Response(JSON.stringify(body), { status: 200, headers }), responseHeaders);
638
+ } catch (error) {
639
+ if (isRedirectError(error)) {
640
+ return withResponseHeaders(redirectResponse(error, revalidationEventCount() !== revalidationsBefore || hasSetCookie(responseHeaders)), responseHeaders);
641
+ }
642
+ if (isNotFoundError(error)) {
643
+ return withResponseHeaders(new Response("Not found", {
644
+ status: 404,
645
+ headers: {
646
+ "content-type": "text/plain; charset=utf-8",
647
+ [ACTION_NOT_FOUND_HEADER]: "1"
648
+ }
649
+ }), responseHeaders);
650
+ }
651
+ const message = messageOf(error);
652
+ let digest;
653
+ if (error instanceof Error) {
654
+ digest = serializeBoundaryError({ error, dev: Boolean(options.dev) }).digest;
655
+ const trace = error.stack ?? error.message;
656
+ console.error(typeof digest === "string" ? `${trace}
657
+ digest: '${digest}'` : trace);
658
+ } else {
659
+ console.error(error);
660
+ }
661
+ await options.onError?.(error, request);
662
+ const masked = errorResponse(options.dev ? message : MASKED_ACTION_ERROR, 500);
663
+ if (typeof digest === "string")
664
+ masked.headers.set(ACTION_ERROR_DIGEST_HEADER, digest);
665
+ return withResponseHeaders(masked, responseHeaders);
666
+ }
667
+ }
668
+ async function resolveAction(id, request, options) {
669
+ if (isInlineActionId(id)) {
670
+ let instance = lookupActionInstance(id);
671
+ if (!instance && options.importSourceModule) {
672
+ const moduleKey = inlineActionModuleKey(id);
673
+ if (moduleKey) {
674
+ try {
675
+ await options.importSourceModule(moduleKey);
676
+ } catch {}
677
+ instance = lookupActionInstance(id);
678
+ }
679
+ }
680
+ return instance;
681
+ }
682
+ if (isInstanceActionId(id)) {
683
+ let instance = lookupActionInstance(id);
684
+ if (!instance && options.rerenderRoute) {
685
+ const routeId = instanceActionRouteId(id);
686
+ if (routeId) {
687
+ try {
688
+ await options.rerenderRoute(routeId, request);
689
+ } catch {}
690
+ instance = lookupActionInstance(id);
691
+ }
692
+ }
693
+ return instance;
694
+ }
695
+ const target = lookupAction(id);
696
+ if (!target)
697
+ return;
698
+ const module = await options.importModule(target.modulePath);
699
+ const action = module[target.exportName];
700
+ return typeof action === "function" ? action : undefined;
701
+ }
702
+
703
+ class BodyLimitError extends Error {
704
+ }
705
+ async function readBodyBytesWithLimit(request, limit) {
706
+ const bytes = await request.arrayBuffer();
707
+ if (bytes.byteLength > limit) {
708
+ throw new BodyLimitError(`Body exceeded ${formatLimit(limit)} limit`);
709
+ }
710
+ return bytes;
711
+ }
712
+ function bufferedFormRequest(request, bytes) {
713
+ const headers = new Headers(request.headers);
714
+ headers.delete("content-length");
715
+ return new Request(request.url, {
716
+ method: request.method,
717
+ headers,
718
+ body: bytes.byteLength === 0 ? undefined : bytes
719
+ });
720
+ }
721
+ function formatLimit(limit) {
722
+ if (limit % (1024 * 1024) === 0)
723
+ return `${limit / (1024 * 1024)}mb`;
724
+ if (limit % 1024 === 0)
725
+ return `${limit / 1024}kb`;
726
+ return `${limit} bytes`;
727
+ }
728
+ async function decodeArgs(request, limit) {
729
+ const bytes = await readBodyBytesWithLimit(request, limit);
730
+ const contentType = request.headers.get("content-type") ?? "";
731
+ if (contentType.includes("multipart/form-data") || contentType.includes("form-urlencoded")) {
732
+ const form = await bufferedFormRequest(request, bytes).formData();
733
+ const argsField = form.get(ACTION_ARGS_FIELD);
734
+ form.delete(ACTION_ID_FIELD);
735
+ if (typeof argsField === "string") {
736
+ form.delete(ACTION_ARGS_FIELD);
737
+ return decodeStructuredArgs(argsField, form);
738
+ }
739
+ const stateField = form.get(FORM_STATE_FIELD);
740
+ if (typeof stateField === "string") {
741
+ form.delete(FORM_STATE_FIELD);
742
+ let state = null;
743
+ try {
744
+ state = JSON.parse(stateField);
745
+ } catch {
746
+ state = stateField;
747
+ }
748
+ return [state, form];
749
+ }
750
+ return [form];
751
+ }
752
+ const text = new TextDecoder("utf-8").decode(bytes);
753
+ if (text.trim() === "")
754
+ return [];
755
+ const parsed = JSON.parse(text);
756
+ return Array.isArray(parsed) ? parsed : [parsed];
757
+ }
758
+ async function reviveActionRefs(args, resolve) {
759
+ const reviveValue = async (value) => {
760
+ if (value === null || typeof value !== "object")
761
+ return value;
762
+ if (Array.isArray(value))
763
+ return Promise.all(value.map(reviveValue));
764
+ const record = value;
765
+ if (typeof record[ARG_ACTION_MARKER] === "string") {
766
+ const fn = await resolve(record[ARG_ACTION_MARKER]);
767
+ if (!fn) {
768
+ const id = String(record[ARG_ACTION_MARKER]);
769
+ console.error(`Failed to find Server Action "${id}". This request might be from an older or newer deployment.
770
+ ` + "Read more: https://nextjs.org/docs/messages/failed-to-find-server-action");
771
+ throw new UnknownActionReferenceError(id);
772
+ }
773
+ return fn;
774
+ }
775
+ if (record.$$pnext_undefined === true)
776
+ return;
777
+ const binary = reviveBinaryMarker(record);
778
+ if (binary !== undefined)
779
+ return binary;
780
+ if (typeof record.$$pnext_date === "string")
781
+ return new Date(record.$$pnext_date);
782
+ if (Array.isArray(record.$$pnext_map)) {
783
+ const entries = await Promise.all(record.$$pnext_map.map(async ([k, v]) => [await reviveValue(k), await reviveValue(v)]));
784
+ return new Map(entries);
785
+ }
786
+ if (Array.isArray(record.$$pnext_set)) {
787
+ return new Set(await Promise.all(record.$$pnext_set.map(reviveValue)));
788
+ }
789
+ if (value instanceof FormData || value instanceof Blob)
790
+ return value;
791
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {
792
+ return value;
793
+ }
794
+ const out = {};
795
+ for (const [key, item] of Object.entries(record))
796
+ out[key] = await reviveValue(item);
797
+ return out;
798
+ };
799
+ return Promise.all(args.map(reviveValue));
800
+ }
801
+ var TYPED_ARRAY_MARKER = "$$pnext_typed_array";
802
+ var ARRAY_BUFFER_MARKER = "$$pnext_array_buffer";
803
+ var TYPED_ARRAY_CTORS = {
804
+ Int8Array,
805
+ Uint8Array,
806
+ Uint8ClampedArray,
807
+ Int16Array,
808
+ Uint16Array,
809
+ Int32Array,
810
+ Uint32Array,
811
+ Float32Array,
812
+ Float64Array,
813
+ BigInt64Array,
814
+ BigUint64Array
815
+ };
816
+ function isTypedArrayView(value) {
817
+ return ArrayBuffer.isView(value) && !(value instanceof DataView);
818
+ }
819
+ function encodeBinaryReturn(value, seen = new Set) {
820
+ if (value === null || typeof value !== "object")
821
+ return value;
822
+ if (value instanceof ArrayBuffer) {
823
+ return { [ARRAY_BUFFER_MARKER]: Buffer.from(new Uint8Array(value)).toString("base64") };
824
+ }
825
+ if (isTypedArrayView(value)) {
826
+ const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
827
+ return {
828
+ [TYPED_ARRAY_MARKER]: {
829
+ type: value.constructor.name,
830
+ data: Buffer.from(bytes).toString("base64")
831
+ }
832
+ };
833
+ }
834
+ if (seen.has(value))
835
+ return value;
836
+ seen.add(value);
837
+ if (Array.isArray(value))
838
+ return value.map((item) => encodeBinaryReturn(item, seen));
839
+ const proto = Object.getPrototypeOf(value);
840
+ if (proto !== Object.prototype && proto !== null)
841
+ return value;
842
+ const out = {};
843
+ for (const [key, item] of Object.entries(value)) {
844
+ out[key] = encodeBinaryReturn(item, seen);
845
+ }
846
+ return out;
847
+ }
848
+ function reviveBinaryMarker(record) {
849
+ const typed = record[TYPED_ARRAY_MARKER];
850
+ if (typed && typeof typed === "object") {
851
+ const { type, data } = typed;
852
+ const Ctor = type ? TYPED_ARRAY_CTORS[type] : undefined;
853
+ if (Ctor && typeof data === "string") {
854
+ const bytes = Buffer.from(data, "base64");
855
+ return new Ctor(bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength));
856
+ }
857
+ }
858
+ const buffer = record[ARRAY_BUFFER_MARKER];
859
+ if (typeof buffer === "string") {
860
+ const bytes = Buffer.from(buffer, "base64");
861
+ return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
862
+ }
863
+ return;
864
+ }
865
+
866
+ class UnknownActionReferenceError extends Error {
867
+ actionId;
868
+ constructor(actionId2) {
869
+ super(`Server Action "${actionId2}" was not found on the server.`);
870
+ this.actionId = actionId2;
871
+ }
872
+ }
873
+ function decodeStructuredArgs(argsJson, form) {
874
+ const parsed = JSON.parse(argsJson);
875
+ const list = Array.isArray(parsed) ? parsed : [parsed];
876
+ return list.map((item) => reviveArg(item, form));
877
+ }
878
+ function reviveArg(value, form) {
879
+ if (value === null || typeof value !== "object")
880
+ return value;
881
+ if (Array.isArray(value))
882
+ return value.map((item) => reviveArg(item, form));
883
+ const record = value;
884
+ if (typeof record[ARG_FORMDATA_MARKER] === "number") {
885
+ const slot = record[ARG_FORMDATA_MARKER];
886
+ const prefix = `${ARG_FORMDATA_PREFIX}${slot}:`;
887
+ const data = new FormData;
888
+ for (const [key, item] of form.entries()) {
889
+ if (key.startsWith(prefix))
890
+ data.append(key.slice(prefix.length), item);
891
+ }
892
+ return data;
893
+ }
894
+ if (typeof record[ARG_FILE_MARKER] === "number") {
895
+ const slot = record[ARG_FILE_MARKER];
896
+ return form.get(`${ARG_FILE_PREFIX}${slot}`);
897
+ }
898
+ const revived = {};
899
+ for (const [key, item] of Object.entries(record))
900
+ revived[key] = reviveArg(item, form);
901
+ return revived;
902
+ }
903
+ function redirectResponse(error, refresh) {
904
+ const redirectType = error.redirectType;
905
+ const headers = new Headers({
906
+ location: error.location,
907
+ [ACTION_REDIRECT_HEADER]: error.location
908
+ });
909
+ if (redirectType === "replace")
910
+ headers.set(REDIRECT_TYPE_HEADER, "replace");
911
+ setRefreshHeaders(headers, refresh);
912
+ return new Response(null, { status: 303, headers });
913
+ }
914
+ function setRefreshHeaders(headers, refresh) {
915
+ if (!refresh)
916
+ return;
917
+ headers.set(ACTION_REFRESH_HEADER, "1");
918
+ headers.set(NEXT_ACTION_REVALIDATED_HEADER, "1");
919
+ }
920
+ function errorResponse(message, status) {
921
+ return new Response(message, {
922
+ status,
923
+ headers: { "content-type": "text/plain; charset=utf-8" }
924
+ });
925
+ }
926
+ function withResponseHeaders(response, extra) {
927
+ const setCookies = extra.getSetCookie?.() ?? [];
928
+ if (setCookies.length === 0)
929
+ return response;
930
+ for (const cookie of setCookies)
931
+ response.headers.append("set-cookie", cookie);
932
+ return response;
933
+ }
934
+ function hasSetCookie(headers) {
935
+ return headers.has("set-cookie");
936
+ }
937
+ function messageOf(error) {
938
+ return error instanceof Error ? error.message : String(error);
939
+ }
940
+
941
+ // src/compat/actions/config.ts
942
+ var SIZE_LIMIT_ERROR = "Server Actions Size Limit must be a valid number or filesize format larger than 1MB";
943
+ async function loadServerActionsConfig(root) {
944
+ const config = await loadResolvedNextConfig(root);
945
+ const experimental = config?.experimental;
946
+ const limit = config?.serverActions?.bodySizeLimit ?? (experimental && typeof experimental === "object" && experimental.serverActions ? experimental.serverActions.bodySizeLimit : undefined);
947
+ if (limit === undefined)
948
+ return { bodySizeLimitBytes: DEFAULT_BODY_LIMIT_BYTES };
949
+ return { bodySizeLimitBytes: parseBodySizeLimit(limit) };
950
+ }
951
+ async function loadResolvedNextConfig(root) {
952
+ return loadNextConfigFromStore() ?? await loadNextConfig(root);
953
+ }
954
+ function loadNextConfigFromStore() {
955
+ try {
956
+ const store = getNextConfig();
957
+ return store && Object.keys(store).length > 0 ? store : undefined;
958
+ } catch {
959
+ return;
960
+ }
961
+ }
962
+ async function loadNextConfig(root) {
963
+ if (nextConfigReleased())
964
+ return getNextConfig();
965
+ for (const name of ["next.config.js", "next.config.mjs", "next.config.cjs"]) {
966
+ const file = path.join(root, name);
967
+ if (!existsSync(file))
968
+ continue;
969
+ try {
970
+ if (name.endsWith(".js") || name.endsWith(".cjs")) {
971
+ const requireFrom = createRequire(path.join(root, "noop.js"));
972
+ delete requireFrom.cache[requireFrom.resolve(file)];
973
+ const required = requireFrom(file);
974
+ let value2 = required && typeof required === "object" && "default" in required ? required.default : required;
975
+ if (typeof value2 === "function") {
976
+ value2 = await value2("phase-production-server", { defaultConfig: {} });
977
+ }
978
+ return value2 ?? undefined;
979
+ }
980
+ const loaded = await import(`${pathToFileHref(file)}?v=${Date.now()}`);
981
+ let value = loaded.default ?? loaded;
982
+ if (typeof value === "function") {
983
+ value = await value("phase-production-server", { defaultConfig: {} });
984
+ }
985
+ return value ?? undefined;
986
+ } catch {
987
+ return;
988
+ }
989
+ }
990
+ return;
991
+ }
992
+ function validateServerActionsConfigSync(root) {
993
+ let config = nextConfigReleased() ? getNextConfig() : undefined;
994
+ const requireFrom = createRequire(path.join(root, "noop.js"));
995
+ for (const name of config ? [] : ["next.config.js", "next.config.cjs"]) {
996
+ const file = path.join(root, name);
997
+ if (!existsSync(file))
998
+ continue;
999
+ try {
1000
+ delete requireFrom.cache[requireFrom.resolve(file)];
1001
+ let value = requireFrom(file);
1002
+ if (value && typeof value === "object" && "default" in value) {
1003
+ value = value.default;
1004
+ }
1005
+ if (typeof value === "function") {
1006
+ value = value("phase-production-server", { defaultConfig: {} });
1007
+ }
1008
+ config = value;
1009
+ } catch (error) {
1010
+ if (error instanceof Error && error.message === SIZE_LIMIT_ERROR)
1011
+ throw error;
1012
+ return;
1013
+ }
1014
+ break;
1015
+ }
1016
+ if (!config)
1017
+ return;
1018
+ const experimental = config.experimental;
1019
+ const limit = config.serverActions?.bodySizeLimit ?? (experimental && typeof experimental === "object" && experimental.serverActions ? experimental.serverActions.bodySizeLimit : undefined);
1020
+ if (limit === undefined)
1021
+ return;
1022
+ parseBodySizeLimit(limit);
1023
+ }
1024
+ function parseBodySizeLimit(value) {
1025
+ if (typeof value === "number") {
1026
+ if (!Number.isFinite(value) || value <= 0)
1027
+ throw new Error(SIZE_LIMIT_ERROR);
1028
+ return Math.floor(value);
1029
+ }
1030
+ if (typeof value === "string") {
1031
+ const match = /^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/i.exec(value.trim());
1032
+ if (!match)
1033
+ throw new Error(SIZE_LIMIT_ERROR);
1034
+ const amount = Number(match[1]);
1035
+ if (!Number.isFinite(amount) || amount <= 0)
1036
+ throw new Error(SIZE_LIMIT_ERROR);
1037
+ const unit = (match[2] ?? "b").toLowerCase();
1038
+ const factor = unit === "gb" ? 1073741824 : unit === "mb" ? 1048576 : unit === "kb" ? 1024 : 1;
1039
+ return Math.floor(amount * factor);
1040
+ }
1041
+ throw new Error(SIZE_LIMIT_ERROR);
1042
+ }
1043
+
1044
+ // src/compat/next/rewrites.ts
1045
+ var VALID_CONDITION_TYPES = new Set(["host", "header", "query", "cookie"]);
1046
+ async function loadCompatRewrites(root) {
1047
+ let config = await loadResolvedNextConfig(root);
1048
+ if (typeof config?.rewrites !== "function")
1049
+ config = await loadNextConfig(root);
1050
+ const producer = config?.rewrites;
1051
+ if (typeof producer !== "function")
1052
+ return [];
1053
+ let value;
1054
+ try {
1055
+ value = await producer();
1056
+ } catch {
1057
+ return [];
1058
+ }
1059
+ const entries = Array.isArray(value) ? value.map((entry) => ({ ...entry, fallback: false })) : value && typeof value === "object" ? ["beforeFiles", "afterFiles", "fallback"].flatMap((key) => {
1060
+ const list = value[key];
1061
+ return Array.isArray(list) ? list.map((entry) => ({ ...entry, fallback: key === "fallback" })) : [];
1062
+ }) : [];
1063
+ const rewrites = [];
1064
+ for (const entry of entries) {
1065
+ if (!entry?.source || !entry.destination)
1066
+ continue;
1067
+ const has = parseConditions(entry.has);
1068
+ const missing = parseConditions(entry.missing);
1069
+ if (has === null || missing === null)
1070
+ continue;
1071
+ const compiled = compileSource(entry.source);
1072
+ if (compiled) {
1073
+ rewrites.push({
1074
+ ...compiled,
1075
+ destination: entry.destination,
1076
+ has,
1077
+ missing,
1078
+ fallback: entry.fallback,
1079
+ outsideBasePath: entry.basePath === false
1080
+ });
1081
+ }
1082
+ }
1083
+ return rewrites;
1084
+ }
1085
+ function parseConditions(value) {
1086
+ if (value === undefined)
1087
+ return [];
1088
+ if (!Array.isArray(value))
1089
+ return null;
1090
+ const conditions = [];
1091
+ for (const raw of value) {
1092
+ if (!raw || typeof raw !== "object")
1093
+ return null;
1094
+ const { type, key, value: condValue } = raw;
1095
+ if (typeof type !== "string" || !VALID_CONDITION_TYPES.has(type))
1096
+ return null;
1097
+ if (key !== undefined && typeof key !== "string")
1098
+ return null;
1099
+ if (condValue !== undefined && typeof condValue !== "string")
1100
+ return null;
1101
+ conditions.push({
1102
+ type,
1103
+ ...typeof key === "string" ? { key } : {},
1104
+ ...typeof condValue === "string" ? { value: condValue } : {}
1105
+ });
1106
+ }
1107
+ return conditions;
1108
+ }
1109
+ function compileSource(source) {
1110
+ const paramNames = [];
1111
+ const segments = source.split("/").filter(Boolean);
1112
+ const parts = [];
1113
+ for (const segment of segments) {
1114
+ const custom = /^:([A-Za-z_$][\w$]*)\((.*)\)$/.exec(segment);
1115
+ if (custom?.[1] !== undefined && custom[2] !== undefined) {
1116
+ paramNames.push(custom[1]);
1117
+ parts.push(`(${custom[2]})`);
1118
+ continue;
1119
+ }
1120
+ const catchAll = /^:([A-Za-z_$][\w$]*)[*+]$/.exec(segment);
1121
+ if (catchAll?.[1]) {
1122
+ paramNames.push(catchAll[1]);
1123
+ parts.push("(.*)");
1124
+ continue;
1125
+ }
1126
+ const optional = /^:([A-Za-z_$][\w$]*)\?$/.exec(segment);
1127
+ if (optional?.[1]) {
1128
+ paramNames.push(optional[1]);
1129
+ parts.push("([^/]*)");
1130
+ continue;
1131
+ }
1132
+ const param = /^:([A-Za-z_$][\w$]*)$/.exec(segment);
1133
+ if (param?.[1]) {
1134
+ paramNames.push(param[1]);
1135
+ parts.push("([^/]+)");
1136
+ continue;
1137
+ }
1138
+ if (segment.startsWith("(") && segment.endsWith(")")) {
1139
+ parts.push(`(?:${segment.slice(1, -1)})`);
1140
+ continue;
1141
+ }
1142
+ if (/^[\w.\- ]+$/.test(segment)) {
1143
+ parts.push(segment.replace(/\./g, "\\."));
1144
+ continue;
1145
+ }
1146
+ if (/[.*+?^${}()|[\]\\]/.test(segment))
1147
+ return null;
1148
+ parts.push(segment.replace(/[/\\]/g, ""));
1149
+ }
1150
+ return { regex: new RegExp(`^/${parts.join("/")}/?$`), paramNames };
1151
+ }
1152
+ function evaluateCondition(condition, ctx) {
1153
+ const target = conditionTarget(condition, ctx);
1154
+ if (target === undefined)
1155
+ return null;
1156
+ if (condition.value === undefined)
1157
+ return {};
1158
+ const regex = new RegExp(`^(?:${condition.value})$`);
1159
+ const match = regex.exec(target);
1160
+ if (!match)
1161
+ return null;
1162
+ return match.groups ? { ...match.groups } : {};
1163
+ }
1164
+ function conditionTarget(condition, ctx) {
1165
+ switch (condition.type) {
1166
+ case "host":
1167
+ return ctx.host;
1168
+ case "header":
1169
+ return condition.key ? ctx.headers.get(condition.key) ?? undefined : undefined;
1170
+ case "cookie":
1171
+ return condition.key ? ctx.cookies[condition.key] : undefined;
1172
+ case "query":
1173
+ return condition.key ? ctx.query.get(condition.key) ?? undefined : undefined;
1174
+ default:
1175
+ return;
1176
+ }
1177
+ }
1178
+ function applyCompatRewrites(rewrites, pathname, ctx) {
1179
+ return resolveCompatRewrite(rewrites, pathname, ctx)?.pathname;
1180
+ }
1181
+ function resolveCompatRewrite(rewrites, pathname, ctx) {
1182
+ const context = ctx ?? {
1183
+ host: "",
1184
+ headers: new Headers,
1185
+ cookies: {},
1186
+ query: new URLSearchParams
1187
+ };
1188
+ for (const rewrite of rewrites) {
1189
+ const match = rewrite.regex.exec(pathname);
1190
+ if (!match)
1191
+ continue;
1192
+ const params = {};
1193
+ rewrite.paramNames.forEach((name, index) => {
1194
+ params[name] = match[index + 1] ?? "";
1195
+ });
1196
+ const conditionParams = evaluateConditions(rewrite, context);
1197
+ if (conditionParams === null)
1198
+ continue;
1199
+ Object.assign(params, conditionParams);
1200
+ const [destPath, destQuery] = splitDestination(rewrite.destination);
1201
+ const { pathname: newPath, used: usedInPath } = substitute(destPath, params);
1202
+ const search = new URLSearchParams(context.query);
1203
+ let usedInQuery = false;
1204
+ if (destQuery) {
1205
+ const destParams = new URLSearchParams(destQuery);
1206
+ for (const [key, rawValue] of destParams.entries()) {
1207
+ const { pathname: value, used } = substitute(rawValue, params);
1208
+ if (used)
1209
+ usedInQuery = true;
1210
+ search.set(key, value);
1211
+ }
1212
+ }
1213
+ const anyUsed = usedInPath.size > 0 || usedInQuery;
1214
+ if (!anyUsed) {
1215
+ for (const [name, value] of Object.entries(params)) {
1216
+ if (!search.has(name))
1217
+ search.append(name, value);
1218
+ }
1219
+ }
1220
+ return {
1221
+ pathname: newPath,
1222
+ search,
1223
+ destination: /^https?:/.test(newPath) ? normalizeDestination(newPath, search) : undefined
1224
+ };
1225
+ }
1226
+ return;
1227
+ }
1228
+ function normalizeDestination(pathname, search) {
1229
+ try {
1230
+ const destination = new URL(pathname);
1231
+ for (const [key, value] of search.entries()) {
1232
+ destination.searchParams.set(key, value);
1233
+ }
1234
+ return destination.toString();
1235
+ } catch {
1236
+ return;
1237
+ }
1238
+ }
1239
+ function evaluateConditions(rule, ctx) {
1240
+ const params = {};
1241
+ for (const condition of rule.has) {
1242
+ const captured = evaluateCondition(condition, ctx);
1243
+ if (captured === null)
1244
+ return null;
1245
+ Object.assign(params, captured);
1246
+ }
1247
+ for (const condition of rule.missing) {
1248
+ if (evaluateCondition(condition, ctx) !== null)
1249
+ return null;
1250
+ }
1251
+ return params;
1252
+ }
1253
+ function splitDestination(destination) {
1254
+ const index = destination.indexOf("?");
1255
+ if (index === -1)
1256
+ return [destination, undefined];
1257
+ return [destination.slice(0, index), destination.slice(index + 1)];
1258
+ }
1259
+ function substitute(template, params) {
1260
+ const used = new Set;
1261
+ const result = template.replace(/:([A-Za-z_$][\w$]*)(\*|\+|\?)?/g, (whole, name) => {
1262
+ if (!(name in params))
1263
+ return whole;
1264
+ used.add(name);
1265
+ return params[name] ?? "";
1266
+ });
1267
+ return { pathname: result, used };
1268
+ }
1269
+
1270
+ export { wrapThrownValue, formatErrorLog, serializeBoundaryError, registerActionModule, lookupActionSource, clearActions, createInstanceScope, registerActionInstance, isInstanceActionId, instanceActionRouteId, isMarkedInlineAction, overriddenActionId, assignedInlineActionId, rewriteInlineActionTags, rewriteAnonymousInlineActionMarks, anonymousInlineActionSpans, inlineActionModuleKey, isInlineActionId, ACTION_ID_HEADER, ACTION_REDIRECT_HEADER, ACTION_REFRESH_HEADER, NEXT_ACTION_REVALIDATED_HEADER, ACTION_NOT_FOUND_HEADER, NEXT_ACTION_NOT_FOUND_HEADER, REDIRECT_TYPE_HEADER, ACTION_ID_FIELD, SUBMIT_ACTION_ID_FIELD, FORM_STATE_FIELD, PROP_ACTION_MARKER, MASKED_ACTION_ERROR, runAction, loadServerActionsConfig, loadResolvedNextConfig, loadNextConfig, validateServerActionsConfigSync, loadCompatRewrites, parseConditions, compileSource, applyCompatRewrites, resolveCompatRewrite, evaluateConditions, splitDestination, substitute };