@farm.js/core 0.1.26 → 0.1.28

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 (231) hide show
  1. package/dist/agent-runtime.d.mts +8 -9
  2. package/dist/agent-runtime.d.ts +8 -9
  3. package/dist/api/client.cjs +5 -7
  4. package/dist/api/client.d.mts +5 -5
  5. package/dist/api/client.d.ts +5 -5
  6. package/dist/api/client.mjs +4 -6
  7. package/dist/api/route-manager.cjs +12 -10
  8. package/dist/api/route-manager.d.mts +7 -8
  9. package/dist/api/route-manager.d.ts +7 -8
  10. package/dist/api/route-manager.mjs +11 -9
  11. package/dist/api/runtime.cjs +15 -8
  12. package/dist/api/runtime.d.mts +36 -3
  13. package/dist/api/runtime.d.ts +36 -3
  14. package/dist/api/runtime.mjs +14 -7
  15. package/dist/{api-client-Cx54IR5g.d.mts → api-client-BjMmY8OD.d.mts} +2 -3
  16. package/dist/{api-client-DykpaKcY.d.ts → api-client-CyFtZFJ4.d.ts} +2 -3
  17. package/dist/api.cjs +16 -14
  18. package/dist/api.d.mts +9 -10
  19. package/dist/api.d.ts +9 -10
  20. package/dist/api.mjs +16 -14
  21. package/dist/{app-29vG5tmY.d.mts → app-DSSq6wiN.d.mts} +3 -4
  22. package/dist/{app-Cx71s_PT.d.ts → app-M8nVWvNU.d.ts} +3 -4
  23. package/dist/app-markdown.cjs +10 -4
  24. package/dist/app-markdown.d.mts +9 -10
  25. package/dist/app-markdown.d.ts +9 -10
  26. package/dist/app-markdown.mjs +9 -3
  27. package/dist/cache-invalidation-BD0z_lfu.d.mts +4 -0
  28. package/dist/cache-invalidation-BD0z_lfu.d.ts +4 -0
  29. package/dist/cache.cjs +6 -4
  30. package/dist/cache.d.mts +11 -6
  31. package/dist/cache.d.ts +11 -6
  32. package/dist/cache.mjs +7 -5
  33. package/dist/{chunk-OFKG57MZ.mjs → chunk-2CNBR3EB.mjs} +2 -2
  34. package/dist/{chunk-JM5GQL4H.mjs → chunk-2DLN6HG4.mjs} +1 -1
  35. package/dist/{chunk-UUYF3CHN.mjs → chunk-2N5PX3LS.mjs} +2 -2
  36. package/dist/{chunk-H6G5INWM.cjs → chunk-2SDO73HK.cjs} +14 -156
  37. package/dist/{chunk-3TQWUUNP.cjs → chunk-3LUF2PE2.cjs} +10 -5
  38. package/dist/{chunk-SYGGPS4A.mjs → chunk-4IEPYMHF.mjs} +3 -3
  39. package/dist/{chunk-WD5PNSOB.mjs → chunk-4V7GIE2U.mjs} +6 -4
  40. package/dist/{chunk-2CT6XUNO.cjs → chunk-55ZY4ZA7.cjs} +4 -4
  41. package/dist/chunk-5MKEDGLD.cjs +53 -0
  42. package/dist/{chunk-I7PUUDGY.cjs → chunk-63H6BKXG.cjs} +2 -2
  43. package/dist/{chunk-FG5H2VCJ.mjs → chunk-6ZCMSZ5U.mjs} +2 -2
  44. package/dist/{chunk-ZMN3H73H.cjs → chunk-75DYEVXI.cjs} +13 -11
  45. package/dist/{chunk-QJ4D3UKJ.cjs → chunk-A672WZEG.cjs} +4 -4
  46. package/dist/{chunk-IXTFU4PL.cjs → chunk-BJPBQNIE.cjs} +14 -14
  47. package/dist/{chunk-QGG336NI.mjs → chunk-BXFWA23T.mjs} +2 -2
  48. package/dist/chunk-CNOQY6Z7.mjs +156 -0
  49. package/dist/{chunk-DW34V5SM.cjs → chunk-CTV2TTNP.cjs} +4 -4
  50. package/dist/{chunk-OAVTUMJP.cjs → chunk-D4JE5NNV.cjs} +12 -12
  51. package/dist/{chunk-KLSSO6YD.mjs → chunk-E76XC6ZG.mjs} +2 -2
  52. package/dist/{chunk-G3HRIVEY.cjs → chunk-ES4B2IXW.cjs} +2 -2
  53. package/dist/{chunk-W2HZKYES.cjs → chunk-EWZ3XHKQ.cjs} +2 -2
  54. package/dist/{chunk-BD2U4ZL6.cjs → chunk-EXLKRR4U.cjs} +10 -10
  55. package/dist/{chunk-SZ4LYNUX.cjs → chunk-F52CDFJM.cjs} +89 -83
  56. package/dist/{chunk-ARXCHQLX.mjs → chunk-FB3H4INL.mjs} +4 -4
  57. package/dist/{chunk-QPPQHB6X.mjs → chunk-FVCSLZWT.mjs} +19 -13
  58. package/dist/{chunk-WD4YXVLV.mjs → chunk-GZYH4OER.mjs} +1 -1
  59. package/dist/{chunk-DX4VKYAJ.cjs → chunk-I26CZYPV.cjs} +6 -4
  60. package/dist/{chunk-3TQG7CGC.cjs → chunk-ID6OVSLH.cjs} +164 -129
  61. package/dist/{chunk-F6SJAKFJ.mjs → chunk-IV6CQY7O.mjs} +12 -154
  62. package/dist/{chunk-6D242YGO.mjs → chunk-JATSG2ZO.mjs} +1 -1
  63. package/dist/{chunk-U74A3P2P.cjs → chunk-JLRDISQL.cjs} +7 -7
  64. package/dist/{chunk-H7CJRJ4L.cjs → chunk-JUFRXDTK.cjs} +18 -18
  65. package/dist/{chunk-OOIL3BWR.mjs → chunk-K3YEZLSY.mjs} +65 -8
  66. package/dist/{chunk-Y4YWHNKU.cjs → chunk-KH7BN726.cjs} +9 -9
  67. package/dist/{chunk-WFPRVVF2.cjs → chunk-KOQ555NR.cjs} +22 -14
  68. package/dist/{chunk-VZWO3XVL.mjs → chunk-KXGDXYUC.mjs} +3 -3
  69. package/dist/{chunk-3IL5UC5I.cjs → chunk-KZLND3D2.cjs} +2 -2
  70. package/dist/{chunk-QLXEYIAW.cjs → chunk-MH24QDVJ.cjs} +13 -13
  71. package/dist/{chunk-TKDY6AJP.mjs → chunk-MKMBQSNQ.mjs} +1 -1
  72. package/dist/{chunk-OCE65DDM.mjs → chunk-MNUGPHLN.mjs} +1 -1
  73. package/dist/{chunk-74RZNRY6.mjs → chunk-NVBS5WSZ.mjs} +1 -1
  74. package/dist/chunk-NYJMY3JA.cjs +156 -0
  75. package/dist/{chunk-VVJCWBIE.mjs → chunk-O3DTUAX2.mjs} +2 -2
  76. package/dist/chunk-O6XNAMBV.mjs +53 -0
  77. package/dist/{chunk-YAOX43YI.cjs → chunk-PZNCMPJF.cjs} +5 -5
  78. package/dist/{chunk-YMUH2BLR.mjs → chunk-PZPDGOU5.mjs} +14 -6
  79. package/dist/{chunk-52SH7TKB.mjs → chunk-QG5HNS7P.mjs} +2 -2
  80. package/dist/{chunk-CEYUWDWA.mjs → chunk-QZCT2CQ4.mjs} +10 -5
  81. package/dist/{chunk-RAI7NULA.mjs → chunk-REGFZJEJ.mjs} +1 -1
  82. package/dist/{chunk-QMV4QELL.mjs → chunk-S5GDHOE4.mjs} +4 -2
  83. package/dist/{chunk-CRQPYWLK.cjs → chunk-SORB3MAR.cjs} +14 -14
  84. package/dist/{chunk-DU2CASV6.mjs → chunk-T7HQ3I4C.mjs} +1 -1
  85. package/dist/{chunk-RCYINC4A.cjs → chunk-TII23GJC.cjs} +3 -3
  86. package/dist/{chunk-PPIW3MH6.mjs → chunk-UX2DD2VK.mjs} +1 -1
  87. package/dist/{chunk-I4J452B7.cjs → chunk-VHJGDMCG.cjs} +3 -3
  88. package/dist/{chunk-3WSWXPYM.cjs → chunk-VQXDC5UV.cjs} +4 -4
  89. package/dist/{chunk-B6ZCT36X.cjs → chunk-WNLBF77X.cjs} +4 -4
  90. package/dist/{chunk-GDUYXFIS.mjs → chunk-X7WVQMIB.mjs} +4 -4
  91. package/dist/{chunk-5SPPCN5J.mjs → chunk-XNPDONUH.mjs} +1 -1
  92. package/dist/{chunk-QIH2HD6H.cjs → chunk-XSPGWQWA.cjs} +86 -29
  93. package/dist/{chunk-ALIFMS4A.cjs → chunk-Y7GW7J46.cjs} +1 -1
  94. package/dist/{chunk-L6V3P73N.mjs → chunk-YDQZGSDS.mjs} +5 -5
  95. package/dist/{chunk-C3VRMB6H.cjs → chunk-ZCU4NZ3M.cjs} +6 -6
  96. package/dist/{chunk-UXQXGB5A.mjs → chunk-ZRIE4KMG.mjs} +63 -28
  97. package/dist/{client-plugins-B8RPJnot.d.mts → client-plugins-CgYNY7jF.d.mts} +1656 -1477
  98. package/dist/{client-plugins-bPBf4haK.d.ts → client-plugins-Fl9Og3yB.d.ts} +1656 -1477
  99. package/dist/client-plugins.d.mts +8 -9
  100. package/dist/client-plugins.d.ts +8 -9
  101. package/dist/client.cjs +12 -13
  102. package/dist/client.d.mts +10 -11
  103. package/dist/client.d.ts +10 -11
  104. package/dist/client.mjs +11 -12
  105. package/dist/config.d.mts +8 -9
  106. package/dist/config.d.ts +8 -9
  107. package/dist/{devtools-5D4ZDRPR.mjs → devtools-3E7ZANMZ.mjs} +7 -4
  108. package/dist/{devtools-QZJEUOJW.cjs → devtools-5AREISIA.cjs} +8 -5
  109. package/dist/docs.cjs +10 -7
  110. package/dist/docs.mjs +9 -6
  111. package/dist/{endpoint-1zA994xL.d.ts → endpoint-CA-TNX60.d.ts} +1 -1
  112. package/dist/{endpoint-DAc96i93.d.mts → endpoint-CCHFqyTE.d.mts} +1 -1
  113. package/dist/index.cjs +58 -55
  114. package/dist/index.d.mts +17 -18
  115. package/dist/index.d.ts +17 -18
  116. package/dist/index.mjs +69 -66
  117. package/dist/{integration-api-BbaiokCC.d.ts → integration-api-0y4FXJpC.d.mts} +128 -1
  118. package/dist/{integration-api-BbaiokCC.d.mts → integration-api-BPJo5oXb.d.ts} +128 -1
  119. package/dist/integrations.d.mts +8 -9
  120. package/dist/integrations.d.ts +8 -9
  121. package/dist/internal/app-markdown-runtime.cjs +9 -3
  122. package/dist/internal/app-markdown-runtime.d.mts +9 -9
  123. package/dist/internal/app-markdown-runtime.d.ts +9 -9
  124. package/dist/internal/app-markdown-runtime.mjs +8 -2
  125. package/dist/internal/build-runtime.cjs +26 -24
  126. package/dist/internal/build-runtime.d.mts +10 -11
  127. package/dist/internal/build-runtime.d.ts +10 -11
  128. package/dist/internal/build-runtime.mjs +25 -23
  129. package/dist/internal/cli-runtime.cjs +16 -12
  130. package/dist/internal/cli-runtime.mjs +15 -11
  131. package/dist/internal/client-error-overlay.cjs +4 -4
  132. package/dist/internal/client-error-overlay.mjs +1 -1
  133. package/dist/internal/client-runtime.cjs +5 -1
  134. package/dist/internal/client-runtime.d.mts +1 -0
  135. package/dist/internal/client-runtime.d.ts +1 -0
  136. package/dist/internal/client-runtime.mjs +4 -0
  137. package/dist/internal/compression-runtime.d.mts +8 -9
  138. package/dist/internal/compression-runtime.d.ts +8 -9
  139. package/dist/internal/config-runtime.cjs +8 -5
  140. package/dist/internal/config-runtime.d.mts +9 -10
  141. package/dist/internal/config-runtime.d.ts +9 -10
  142. package/dist/internal/config-runtime.mjs +7 -4
  143. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  144. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  145. package/dist/internal/production-runtime.cjs +20 -16
  146. package/dist/internal/production-runtime.d.mts +13 -14
  147. package/dist/internal/production-runtime.d.ts +13 -14
  148. package/dist/internal/production-runtime.mjs +20 -16
  149. package/dist/markdown.cjs +8 -2
  150. package/dist/markdown.d.mts +36 -153
  151. package/dist/markdown.d.ts +36 -153
  152. package/dist/markdown.mjs +7 -1
  153. package/dist/{metadata-C3na4CBj.d.mts → metadata-B0X-qtcQ.d.mts} +1 -1
  154. package/dist/{metadata-CzBP4Mfp.d.ts → metadata-BdDKgd7K.d.ts} +1 -1
  155. package/dist/middleware.cjs +4 -4
  156. package/dist/middleware.d.mts +9 -10
  157. package/dist/middleware.d.ts +9 -10
  158. package/dist/middleware.mjs +3 -3
  159. package/dist/navigation.cjs +5 -5
  160. package/dist/navigation.d.mts +10 -11
  161. package/dist/navigation.d.ts +10 -11
  162. package/dist/navigation.mjs +4 -4
  163. package/dist/{nitro-ZKLGOTVY.mjs → nitro-NAKCRVHX.mjs} +4 -3
  164. package/dist/{nitro-KQDU7CFE.cjs → nitro-VYDZGYFY.cjs} +4 -3
  165. package/dist/plugin.cjs +26 -21
  166. package/dist/plugin.d.mts +9 -10
  167. package/dist/plugin.d.ts +9 -10
  168. package/dist/plugin.mjs +26 -21
  169. package/dist/{production-runtime-DP94hPGe.d.mts → production-runtime-BjgFgDIg.d.mts} +1 -1
  170. package/dist/{production-runtime-CYg4wM4E.d.ts → production-runtime-Dx_qMA3t.d.ts} +1 -1
  171. package/dist/query/client.cjs +6 -6
  172. package/dist/query/client.mjs +2 -2
  173. package/dist/{render-plan-Bl6Fzg5z.d.ts → render-plan-B41EWmBb.d.ts} +1 -1
  174. package/dist/{render-plan-CKAJg0jC.d.mts → render-plan-_1TAWODt.d.mts} +1 -1
  175. package/dist/renderer-client.cjs +13 -14
  176. package/dist/renderer-client.d.mts +6 -7
  177. package/dist/renderer-client.d.ts +6 -7
  178. package/dist/renderer-client.mjs +6 -7
  179. package/dist/{request-CrBCcPZZ.d.mts → request-BhE4luLv.d.mts} +1 -1
  180. package/dist/{request-CR-Bp1Px.d.ts → request-Dbf3G0zM.d.ts} +1 -1
  181. package/dist/request.d.mts +9 -10
  182. package/dist/request.d.ts +9 -10
  183. package/dist/{route-rendering-CZH5FegB.d.ts → route-rendering-Z7PveTZE.d.ts} +1 -1
  184. package/dist/{route-rendering-C1NAHo-C.d.mts → route-rendering-zzfx_GHf.d.mts} +1 -1
  185. package/dist/{router-B57eDJ3u.d.mts → router-BatNMsa1.d.mts} +1 -1
  186. package/dist/{router-Cg_kD3Bd.d.ts → router-DtNRhQl3.d.ts} +1 -1
  187. package/dist/routes.cjs +6 -5
  188. package/dist/routes.d.mts +6 -7
  189. package/dist/routes.d.ts +6 -7
  190. package/dist/routes.mjs +5 -4
  191. package/dist/server-fn-client.d.mts +4 -4
  192. package/dist/server-fn-client.d.ts +4 -4
  193. package/dist/server-fn.cjs +6 -5
  194. package/dist/server-fn.d.mts +2 -1
  195. package/dist/server-fn.d.ts +2 -1
  196. package/dist/server-fn.mjs +5 -4
  197. package/dist/server-plugins.d.mts +8 -9
  198. package/dist/server-plugins.d.ts +8 -9
  199. package/dist/server-query-client.cjs +5 -7
  200. package/dist/server-query-client.d.mts +2 -1
  201. package/dist/server-query-client.d.ts +2 -1
  202. package/dist/server-query-client.mjs +4 -6
  203. package/dist/server-query.cjs +7 -6
  204. package/dist/server-query.d.mts +2 -1
  205. package/dist/server-query.d.ts +2 -1
  206. package/dist/server-query.mjs +6 -5
  207. package/dist/server.cjs +235 -131
  208. package/dist/server.d.mts +14 -15
  209. package/dist/server.d.ts +14 -15
  210. package/dist/server.mjs +222 -118
  211. package/dist/{spa-router-BstQUO6Q.d.ts → spa-router-BE3bwU-J.d.ts} +2 -2
  212. package/dist/{spa-router-DTdbuinx.d.mts → spa-router-DQOnHZVj.d.mts} +2 -2
  213. package/dist/testing.cjs +17 -15
  214. package/dist/testing.d.mts +7 -8
  215. package/dist/testing.d.ts +7 -8
  216. package/dist/testing.mjs +14 -12
  217. package/dist/{utils-CS3ZLnEJ.d.mts → utils-DLK1ERNl.d.mts} +1 -1
  218. package/dist/{utils-D3rdsIvM.d.ts → utils-u7ZBSWAK.d.ts} +1 -1
  219. package/dist/version.cjs +2 -2
  220. package/dist/version.mjs +1 -1
  221. package/dist/vite.cjs +22 -20
  222. package/dist/vite.d.mts +8 -9
  223. package/dist/vite.d.ts +8 -9
  224. package/dist/vite.mjs +21 -19
  225. package/package.json +1 -1
  226. package/dist/route-B0XrsrFk.d.mts +0 -128
  227. package/dist/route-DOEpbyWZ.d.ts +0 -128
  228. package/dist/{chunk-YOYF2E4U.mjs → chunk-LNZ7JZUS.mjs} +0 -0
  229. package/dist/{chunk-N4RLRSWW.cjs → chunk-SUIBNSNO.cjs} +0 -0
  230. package/dist/{chunk-TIKNUAU7.mjs → chunk-VUMAE7NC.mjs} +3 -3
  231. package/dist/{chunk-WM6HL7E7.cjs → chunk-ZHVYQL3H.cjs} +2 -2
@@ -1,15 +1,20 @@
1
+ import {
2
+ emitFarmEvent
3
+ } from "./chunk-FUZEBRP3.mjs";
4
+ import {
5
+ getActiveFarmI18nSnapshot
6
+ } from "./chunk-C4NCTZLM.mjs";
7
+ import {
8
+ createFarmCacheKey,
9
+ createRouteDataCacheKey,
10
+ getFunctionCacheIdentity
11
+ } from "./chunk-CNOQY6Z7.mjs";
1
12
  import {
2
13
  encodeFarmCacheInvalidations,
3
14
  notifyFarmCacheInvalidation,
4
15
  notifyFarmCacheTask,
5
16
  subscribeFarmCacheInvalidation
6
17
  } from "./chunk-4SIYUGRY.mjs";
7
- import {
8
- getActiveFarmI18nSnapshot
9
- } from "./chunk-C4NCTZLM.mjs";
10
- import {
11
- emitFarmEvent
12
- } from "./chunk-FUZEBRP3.mjs";
13
18
  import {
14
19
  __name
15
20
  } from "./chunk-LPEX4YW6.mjs";
@@ -812,10 +817,6 @@ function createRouteDataCacheTag(key) {
812
817
  return `route-data:${createRouteDataCacheKey(key)}`;
813
818
  }
814
819
  __name(createRouteDataCacheTag, "createRouteDataCacheTag");
815
- function createRouteDataCacheKey(key) {
816
- return createFarmCacheKey(Array.isArray(key) ? key : [key]);
817
- }
818
- __name(createRouteDataCacheKey, "createRouteDataCacheKey");
819
820
  function normalizeRevalidatePath(routePath) {
820
821
  if (typeof routePath !== "string") {
821
822
  throw new TypeError("revalidatePath expects a path string.");
@@ -840,10 +841,6 @@ function normalizeRevalidatePath(routePath) {
840
841
  return normalized || "/";
841
842
  }
842
843
  __name(normalizeRevalidatePath, "normalizeRevalidatePath");
843
- function createFarmCacheKey(parts) {
844
- return stableSerialize(parts);
845
- }
846
- __name(createFarmCacheKey, "createFarmCacheKey");
847
844
  function normalizeRevalidate(revalidate) {
848
845
  if (revalidate === false || revalidate === void 0) {
849
846
  return revalidate;
@@ -934,143 +931,6 @@ function assertFarmCacheInvalidationTarget(target) {
934
931
  throw new TypeError("Cache invalidation targets must contain a string/array key, path, or tag.");
935
932
  }
936
933
  __name(assertFarmCacheInvalidationTarget, "assertFarmCacheInvalidationTarget");
937
- function getFunctionCacheIdentity(fn) {
938
- const name = fn.name || "anonymous";
939
- return `${name}:${hashFunctionSource(String(fn))}`;
940
- }
941
- __name(getFunctionCacheIdentity, "getFunctionCacheIdentity");
942
- function hashFunctionSource(source) {
943
- let hash = 2166136261;
944
- for (let index = 0; index < source.length; index++) {
945
- hash ^= source.charCodeAt(index);
946
- hash = Math.imul(hash, 16777619);
947
- }
948
- return (hash >>> 0).toString(36);
949
- }
950
- __name(hashFunctionSource, "hashFunctionSource");
951
- function compareCodepoint(a, b) {
952
- return a < b ? -1 : a > b ? 1 : 0;
953
- }
954
- __name(compareCodepoint, "compareCodepoint");
955
- function serializeBinaryBytes(bytes) {
956
- return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
957
- }
958
- __name(serializeBinaryBytes, "serializeBinaryBytes");
959
- function serializeCanonicalStringEntries(entries, seen) {
960
- const valuesByKey = /* @__PURE__ */ new Map();
961
- for (const [key, item] of entries) {
962
- const values = valuesByKey.get(key);
963
- if (values) values.push(item);
964
- else valuesByKey.set(key, [item]);
965
- }
966
- return Array.from(valuesByKey.keys()).sort(compareCodepoint).flatMap(
967
- (key) => valuesByKey.get(key).map((item) => `[${stableSerialize(key, seen)},${stableSerialize(item, seen)}]`)
968
- ).join(",");
969
- }
970
- __name(serializeCanonicalStringEntries, "serializeCanonicalStringEntries");
971
- function isPlainCacheKeyObject(value) {
972
- const prototype = Object.getPrototypeOf(value);
973
- if (prototype === null) return true;
974
- const constructor = Object.getOwnPropertyDescriptor(prototype, "constructor")?.value;
975
- return Object.getPrototypeOf(prototype) === null && typeof constructor === "function" && constructor.name === "Object";
976
- }
977
- __name(isPlainCacheKeyObject, "isPlainCacheKeyObject");
978
- function getCacheKeyValueType(value) {
979
- const prototype = Object.getPrototypeOf(value);
980
- const constructor = prototype ? Object.getOwnPropertyDescriptor(prototype, "constructor")?.value : void 0;
981
- if (typeof constructor === "function" && constructor.name) {
982
- return constructor.name;
983
- }
984
- return Object.prototype.toString.call(value).slice(8, -1) || "object";
985
- }
986
- __name(getCacheKeyValueType, "getCacheKeyValueType");
987
- function stableSerialize(value, seen = /* @__PURE__ */ new WeakSet()) {
988
- if (value === null) return "null";
989
- if (value === void 0) return "undefined";
990
- const valueType = typeof value;
991
- if (valueType === "string") return JSON.stringify(value);
992
- if (valueType === "number" || valueType === "boolean" || valueType === "bigint") {
993
- return `${valueType}:${String(value)}`;
994
- }
995
- if (valueType === "symbol") {
996
- return `symbol:${String(value)}`;
997
- }
998
- if (valueType === "function") {
999
- return `function:${getFunctionCacheIdentity(value)}`;
1000
- }
1001
- if (value instanceof Date) {
1002
- return Number.isNaN(value.getTime()) ? "date:invalid" : `date:${value.toISOString()}`;
1003
- }
1004
- if (value instanceof URL) {
1005
- return `url:${value.toString()}`;
1006
- }
1007
- if (value instanceof RegExp) {
1008
- return `regexp:${value.toString()}`;
1009
- }
1010
- if (value instanceof ArrayBuffer) {
1011
- return `arraybuffer:${serializeBinaryBytes(new Uint8Array(value))}`;
1012
- }
1013
- if (typeof SharedArrayBuffer !== "undefined" && value instanceof SharedArrayBuffer) {
1014
- return `sharedarraybuffer:${serializeBinaryBytes(new Uint8Array(value))}`;
1015
- }
1016
- if (ArrayBuffer.isView(value)) {
1017
- const viewType = Object.prototype.toString.call(value).slice(8, -1);
1018
- const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
1019
- return `binary:${viewType}:${serializeBinaryBytes(bytes)}`;
1020
- }
1021
- if (value && typeof value === "object") {
1022
- if (seen.has(value)) {
1023
- return "[Circular]";
1024
- }
1025
- seen.add(value);
1026
- if (Array.isArray(value)) {
1027
- const items = [];
1028
- for (let index = 0; index < value.length; index++) {
1029
- items.push(
1030
- Object.prototype.hasOwnProperty.call(value, index) ? stableSerialize(value[index], seen) : "[Hole]"
1031
- );
1032
- }
1033
- seen.delete(value);
1034
- return `[${items.join(",")}]`;
1035
- }
1036
- if (value instanceof Set) {
1037
- const items = Array.from(value, (item) => stableSerialize(item, seen)).sort(compareCodepoint);
1038
- seen.delete(value);
1039
- return `set:[${items.join(",")}]`;
1040
- }
1041
- if (value instanceof Map) {
1042
- const items = Array.from(
1043
- value,
1044
- ([key, item]) => `[${stableSerialize(key, seen)},${stableSerialize(item, seen)}]`
1045
- ).sort(compareCodepoint);
1046
- seen.delete(value);
1047
- return `map:[${items.join(",")}]`;
1048
- }
1049
- if (value instanceof URLSearchParams) {
1050
- const serialized2 = serializeCanonicalStringEntries(value, seen);
1051
- seen.delete(value);
1052
- return `urlsearchparams:[${serialized2}]`;
1053
- }
1054
- if (value instanceof Headers) {
1055
- const serialized2 = serializeCanonicalStringEntries(value, seen);
1056
- seen.delete(value);
1057
- return `headers:[${serialized2}]`;
1058
- }
1059
- if (!isPlainCacheKeyObject(value)) {
1060
- throw new TypeError(
1061
- `Cache keys do not support ${getCacheKeyValueType(value)} values. Convert the value to an explicit stable string or structured key before caching.`
1062
- );
1063
- }
1064
- const entries = Object.entries(value).sort(
1065
- ([a], [b]) => compareCodepoint(a, b)
1066
- );
1067
- const serialized = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item, seen)}`).join(",");
1068
- seen.delete(value);
1069
- return `{${serialized}}`;
1070
- }
1071
- return String(value);
1072
- }
1073
- __name(stableSerialize, "stableSerialize");
1074
934
 
1075
935
  export {
1076
936
  createFarmCacheInvalidationStream,
@@ -1088,7 +948,5 @@ export {
1088
948
  applyFarmCacheInvalidationTargets,
1089
949
  createPathCacheTag,
1090
950
  createRouteDataCacheTag,
1091
- createRouteDataCacheKey,
1092
- normalizeRevalidatePath,
1093
- createFarmCacheKey
951
+ normalizeRevalidatePath
1094
952
  };
@@ -16,7 +16,7 @@ import {
16
16
  FARM_METADATA_ATTRIBUTE,
17
17
  renderMetadataHead,
18
18
  resolveMetadataTitle
19
- } from "./chunk-CEYUWDWA.mjs";
19
+ } from "./chunk-QZCT2CQ4.mjs";
20
20
  import {
21
21
  createFarmDeploymentMismatchError,
22
22
  createFarmDeploymentRequestHeaders,
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkCRQPYWLKcjs = require('./chunk-CRQPYWLK.cjs');
3
+ var _chunkSORB3MARcjs = require('./chunk-SORB3MAR.cjs');
4
4
 
5
5
 
6
- var _chunkB6ZCT36Xcjs = require('./chunk-B6ZCT36X.cjs');
6
+ var _chunkWNLBF77Xcjs = require('./chunk-WNLBF77X.cjs');
7
7
 
8
8
 
9
9
  var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
@@ -13,7 +13,7 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
13
13
 
14
14
  // src/navigation.ts
15
15
  function useRouter2() {
16
- const router = _chunkCRQPYWLKcjs.useRouter.call(void 0, );
16
+ const router = _chunkSORB3MARcjs.useRouter.call(void 0, );
17
17
  return {
18
18
  push: router.push,
19
19
  replace: router.replace,
@@ -21,21 +21,21 @@ function useRouter2() {
21
21
  forward: router.forward,
22
22
  refresh() {
23
23
  if (typeof window === "undefined") return Promise.resolve();
24
- return _chunkB6ZCT36Xcjs.getRouter.call(void 0, ).refresh();
24
+ return _chunkWNLBF77Xcjs.getRouter.call(void 0, ).refresh();
25
25
  },
26
26
  prefetch(href) {
27
27
  if (typeof window === "undefined") return Promise.resolve();
28
- return _chunkB6ZCT36Xcjs.getRouter.call(void 0, ).prefetch(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href));
28
+ return _chunkWNLBF77Xcjs.getRouter.call(void 0, ).prefetch(_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href));
29
29
  }
30
30
  };
31
31
  }
32
32
  _chunkS3JO3N4Hcjs.__name.call(void 0, useRouter2, "useRouter");
33
33
  function usePathname() {
34
- return _chunkCRQPYWLKcjs.useRouter.call(void 0, ).pathname;
34
+ return _chunkSORB3MARcjs.useRouter.call(void 0, ).pathname;
35
35
  }
36
36
  _chunkS3JO3N4Hcjs.__name.call(void 0, usePathname, "usePathname");
37
37
  function useSearchParams() {
38
- return _chunkCRQPYWLKcjs.useRouter.call(void 0, ).searchParams;
38
+ return _chunkSORB3MARcjs.useRouter.call(void 0, ).searchParams;
39
39
  }
40
40
  _chunkS3JO3N4Hcjs.__name.call(void 0, useSearchParams, "useSearchParams");
41
41
 
@@ -6,10 +6,10 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
6
6
  var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
7
7
 
8
8
 
9
- var _chunkBD2U4ZL6cjs = require('./chunk-BD2U4ZL6.cjs');
9
+ var _chunkEXLKRR4Ucjs = require('./chunk-EXLKRR4U.cjs');
10
10
 
11
11
 
12
- var _chunkN4RLRSWWcjs = require('./chunk-N4RLRSWW.cjs');
12
+ var _chunkSUIBNSNOcjs = require('./chunk-SUIBNSNO.cjs');
13
13
 
14
14
 
15
15
  var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
@@ -19,7 +19,7 @@ var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
19
19
 
20
20
 
21
21
 
22
- var _chunkYAOX43YIcjs = require('./chunk-YAOX43YI.cjs');
22
+ var _chunkPZNCMPJFcjs = require('./chunk-PZNCMPJF.cjs');
23
23
 
24
24
 
25
25
  var _chunk6V4TDWECcjs = require('./chunk-6V4TDWEC.cjs');
@@ -105,7 +105,7 @@ function farmApiPlugin(options = {}) {
105
105
  const existing = apiRoutesCache.get(routePath);
106
106
  const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
107
107
  if (existingFile) {
108
- throw new (0, _chunkBD2U4ZL6cjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
108
+ throw new (0, _chunkEXLKRR4Ucjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
109
109
  }
110
110
  if (existing) {
111
111
  if (!existing.methods.includes(normalizedMethod)) {
@@ -189,7 +189,7 @@ function farmApiPlugin(options = {}) {
189
189
  const url = new URL(request.url);
190
190
  const method = request.method.toUpperCase();
191
191
  const pathname = url.pathname;
192
- const match = _chunkYAOX43YIcjs.matchAPIRouteAtBasePath.call(void 0, apiRoutesCache, pathname, basePath);
192
+ const match = _chunkPZNCMPJFcjs.matchAPIRouteAtBasePath.call(void 0, apiRoutesCache, pathname, basePath);
193
193
  if (!match) {
194
194
  return new Response(JSON.stringify({ error: "Not Found" }), {
195
195
  status: 404,
@@ -197,18 +197,18 @@ function farmApiPlugin(options = {}) {
197
197
  });
198
198
  }
199
199
  const { route, params } = match;
200
- const endpoint = _chunkYAOX43YIcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
200
+ const endpoint = _chunkPZNCMPJFcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
201
201
  if (!endpoint) {
202
202
  return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
203
203
  status: 405,
204
204
  headers: {
205
- Allow: _chunkYAOX43YIcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
205
+ Allow: _chunkPZNCMPJFcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
206
206
  "Content-Type": "application/json"
207
207
  }
208
208
  });
209
209
  }
210
210
  try {
211
- return await _chunkYAOX43YIcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, bodySizeLimit);
211
+ return await _chunkPZNCMPJFcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, bodySizeLimit);
212
212
  } catch (error) {
213
213
  return new Response(JSON.stringify({ error: error.message || "Internal Server Error" }), {
214
214
  status: 500,
@@ -255,7 +255,7 @@ function farmApiPlugin(options = {}) {
255
255
  const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, filePath);
256
256
  const endpoints = {};
257
257
  const availableMethods = [];
258
- for (const method of _chunkYAOX43YIcjs.API_ROUTE_METHODS) {
258
+ for (const method of _chunkPZNCMPJFcjs.API_ROUTE_METHODS) {
259
259
  if (routeModule[method]) {
260
260
  availableMethods.push(method);
261
261
  endpoints[method] = routeModule[method];
@@ -268,7 +268,7 @@ function farmApiPlugin(options = {}) {
268
268
  log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
269
269
  }
270
270
  } catch (e) {
271
- if (e instanceof _chunkBD2U4ZL6cjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
271
+ if (e instanceof _chunkEXLKRR4Ucjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
272
272
  log(`API route load failed at ${filePath}: ${e.message}`);
273
273
  }
274
274
  }
@@ -295,7 +295,7 @@ function farmApiPlugin(options = {}) {
295
295
  }
296
296
  }
297
297
  } catch (e) {
298
- if (e instanceof _chunkBD2U4ZL6cjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
298
+ if (e instanceof _chunkEXLKRR4Ucjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
299
299
  log(`Root routes.ts load failed: ${e.message}`);
300
300
  }
301
301
  break;
@@ -305,7 +305,7 @@ function farmApiPlugin(options = {}) {
305
305
  const discoverProgrammaticRoutes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
306
306
  const path = await import("path");
307
307
  const srcRoot = path.join(server.config.root, srcDir);
308
- const routeFiles = _chunkN4RLRSWWcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot);
308
+ const routeFiles = _chunkSUIBNSNOcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot);
309
309
  if (routeFiles.length === 0) return;
310
310
  const { getProgrammaticRouteManifest } = await import("./routes.cjs");
311
311
  for (const routeFile of routeFiles) {
@@ -326,7 +326,7 @@ function farmApiPlugin(options = {}) {
326
326
  }
327
327
  }
328
328
  } catch (e) {
329
- if (e instanceof _chunkBD2U4ZL6cjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
329
+ if (e instanceof _chunkEXLKRR4Ucjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
330
330
  log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
331
331
  }
332
332
  }
@@ -378,7 +378,7 @@ function farmApiPlugin(options = {}) {
378
378
  const pathname = url.split("?")[0];
379
379
  const method = req.method || "GET";
380
380
  if (discoveryPromise) await waitForDiscovery();
381
- if (!_chunkYAOX43YIcjs.matchAPIRouteAtBasePath.call(void 0, apiRoutesCache, pathname, basePath)) {
381
+ if (!_chunkPZNCMPJFcjs.matchAPIRouteAtBasePath.call(void 0, apiRoutesCache, pathname, basePath)) {
382
382
  return next();
383
383
  }
384
384
  if (!apiRouterHandler) {
@@ -399,7 +399,7 @@ function farmApiPlugin(options = {}) {
399
399
  }
400
400
  const currentUrl = req.url || url;
401
401
  const currentPathname = currentUrl.split("?")[0];
402
- if (currentPathname !== pathname && !_chunkYAOX43YIcjs.matchAPIRouteAtBasePath.call(void 0, apiRoutesCache, currentPathname, basePath)) {
402
+ if (currentPathname !== pathname && !_chunkPZNCMPJFcjs.matchAPIRouteAtBasePath.call(void 0, apiRoutesCache, currentPathname, basePath)) {
403
403
  return next();
404
404
  }
405
405
  const fullUrl = _chunk5ZSWG4UXcjs.resolveFarmRequestURL.call(void 0, req);
@@ -503,7 +503,7 @@ function farmApiPlugin(options = {}) {
503
503
  log(`API router recreated`);
504
504
  } catch (e) {
505
505
  restoreRouteState(previousState);
506
- if (e instanceof _chunkBD2U4ZL6cjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
506
+ if (e instanceof _chunkEXLKRR4Ucjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
507
507
  log(`Root routes.ts HMR failed: ${e.message}`);
508
508
  }
509
509
  return [];
@@ -531,7 +531,7 @@ function farmApiPlugin(options = {}) {
531
531
  const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, file);
532
532
  removeEndpointsFromFile(file);
533
533
  const availableMethods = [];
534
- for (const method of _chunkYAOX43YIcjs.API_ROUTE_METHODS) {
534
+ for (const method of _chunkPZNCMPJFcjs.API_ROUTE_METHODS) {
535
535
  if (!routeModule[method]) continue;
536
536
  availableMethods.push(method);
537
537
  addEndpoint(routePath, file, method, routeModule[method]);
@@ -541,7 +541,7 @@ function farmApiPlugin(options = {}) {
541
541
  log(`API router recreated`);
542
542
  } catch (e) {
543
543
  restoreRouteState(previousState);
544
- if (e instanceof _chunkBD2U4ZL6cjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
544
+ if (e instanceof _chunkEXLKRR4Ucjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
545
545
  log(`API route HMR failed: ${e.message}`);
546
546
  }
547
547
  return [];
@@ -1,6 +1,12 @@
1
1
  import {
2
2
  emitFarmAgentRead
3
3
  } from "./chunk-MVL2RAJW.mjs";
4
+ import {
5
+ _findFarmMCPEndpointTool
6
+ } from "./chunk-O6XNAMBV.mjs";
7
+ import {
8
+ stripFarmBasePath
9
+ } from "./chunk-4RB44K6Z.mjs";
4
10
  import {
5
11
  __name
6
12
  } from "./chunk-LPEX4YW6.mjs";
@@ -276,8 +282,14 @@ function ifNoneMatchIncludes(header, etag) {
276
282
  __name(ifNoneMatchIncludes, "ifNoneMatchIncludes");
277
283
  function createFarmMarkdownViewResponse(options) {
278
284
  const url = options.requestUrl ?? new URL(options.request.url);
279
- const view = url.searchParams.has("actions") ? selectFarmPageActionsView(options.markdownPath, options.actions ?? [], options.headers) : selectFarmMarkdownView(options.markdown, url.searchParams, options.markdownPath);
280
- const status = view.status === 200 ? options.status : view.status;
285
+ const view = options.status >= 400 ? { status: options.status, body: options.markdown } : url.searchParams.has("actions") ? selectFarmPageActionsView(options.markdownPath, options.actions ?? [], options.headers) : selectFarmMarkdownView(options.markdown, url.searchParams, options.markdownPath);
286
+ let status = view.status === 200 ? options.status : view.status;
287
+ const ifMatch = options.request.headers.get("if-match");
288
+ const preconditionFailed = status >= 200 && status < 300 && ifMatch !== null && ifMatch.trim() !== "*";
289
+ if (preconditionFailed) {
290
+ status = 412;
291
+ options.headers.set("Cache-Control", "no-store");
292
+ }
281
293
  emitFarmAgentRead(options.request, "markdown", status, readMarkdownViewName(url.searchParams));
282
294
  for (const [name, value] of Object.entries(view.headers ?? {}))
283
295
  options.headers.append(name, value);
@@ -286,7 +298,7 @@ function createFarmMarkdownViewResponse(options) {
286
298
  if (status === 200 && ifNoneMatchIncludes(options.request.headers.get("if-none-match"), etag)) {
287
299
  return new Response(null, { status: 304, headers: options.headers });
288
300
  }
289
- return new Response(options.request.method === "HEAD" ? null : view.body, {
301
+ return new Response(preconditionFailed || options.request.method === "HEAD" ? null : view.body, {
290
302
  status,
291
303
  headers: options.headers
292
304
  });
@@ -374,24 +386,50 @@ async function createMarkdownMirrorResponse(options) {
374
386
  for (const name of FARM_MARKDOWN_VIEW_PARAMS) pageUrl.searchParams.delete(name);
375
387
  const headers = new Headers(options.request.headers);
376
388
  headers.set("accept", "text/html");
389
+ headers.delete("if-match");
390
+ headers.delete("if-unmodified-since");
391
+ headers.delete("if-none-match");
392
+ headers.delete("if-modified-since");
393
+ headers.delete("range");
394
+ headers.delete("if-range");
377
395
  const pageResponse = await options.renderPage(
378
396
  new Request(pageUrl, {
379
397
  method: "GET",
380
- headers
398
+ headers,
399
+ signal: options.request.signal
381
400
  })
382
401
  );
402
+ if (pageResponse.status === 204 || pageResponse.status === 205 || pageResponse.status === 304) {
403
+ return pageResponse;
404
+ }
383
405
  const redirects = pageResponse.status >= 300 && pageResponse.status < 400 && pageResponse.headers.has("location");
384
406
  if (redirects || !isHtmlResponse(pageResponse)) {
385
- return createMarkdownAccessResponse(
407
+ const accessResponse = createMarkdownAccessResponse(
386
408
  pageResponse,
387
409
  target.pathname,
388
410
  pageUrl,
389
411
  options.request.method === "HEAD"
390
412
  );
413
+ if (accessResponse || options.request.method === "HEAD") {
414
+ void pageResponse.body?.cancel().catch(() => {
415
+ });
416
+ return accessResponse ?? new Response(null, {
417
+ status: pageResponse.status,
418
+ statusText: pageResponse.statusText,
419
+ headers: pageResponse.headers
420
+ });
421
+ }
422
+ return pageResponse;
391
423
  }
392
424
  const html = await pageResponse.text();
393
425
  const markdownPath = target.pathname === "/" ? "/index.md" : `${target.pathname}.md`;
394
- const actions = extractFarmPageActions(html, pageUrl);
426
+ const actions = pageResponse.status >= 400 ? [] : extractFarmPageActions(html, pageUrl);
427
+ for (const form of actions) {
428
+ if (!form.action?.startsWith("/")) continue;
429
+ const pathname = new URL(form.action, pageUrl.origin).pathname;
430
+ const tool = _findFarmMCPEndpointTool(form.method, pathname, options.apiServerBasePath) ?? _findFarmMCPEndpointTool(form.method, stripFarmBasePath(pathname), options.apiServerBasePath);
431
+ if (tool) form.tool = tool;
432
+ }
395
433
  const markdown = htmlToMarkdown(html, {
396
434
  title: target.route?.title,
397
435
  includeMetadata: options.config?.includeMetadata ?? true,
@@ -416,6 +454,10 @@ async function createMarkdownMirrorResponse(options) {
416
454
  "Cache-Control",
417
455
  pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : createMarkdownCacheHeader(cache)
418
456
  );
457
+ preserveMarkdownResponseCookies(pageResponse.headers, headersOut);
458
+ if (pageResponse.status >= 400) {
459
+ preserveMarkdownResponseControlHeaders(pageResponse.headers, headersOut);
460
+ }
419
461
  const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(value?.trim())).join(", ");
420
462
  if (robots) headersOut.set("X-Robots-Tag", robots);
421
463
  const canonical = readHtmlCanonicalHref(html);
@@ -445,6 +487,8 @@ function createMarkdownAccessResponse(pageResponse, pathname, pageUrl, head) {
445
487
  "Cache-Control": "no-store",
446
488
  "X-Farm-Markdown-Route": pathname
447
489
  });
490
+ preserveMarkdownResponseCookies(pageResponse.headers, headers);
491
+ preserveMarkdownResponseControlHeaders(pageResponse.headers, headers);
448
492
  let body;
449
493
  if (redirect) {
450
494
  let target;
@@ -459,8 +503,6 @@ function createMarkdownAccessResponse(pageResponse, pathname, pageUrl, head) {
459
503
  \`${pathname}\` redirects to [${target}](${target}). The page may require signing in.
460
504
  `;
461
505
  } else {
462
- const authenticate = pageResponse.headers.get("www-authenticate");
463
- if (authenticate) headers.set("WWW-Authenticate", authenticate);
464
506
  body = pageResponse.status === 401 ? `# Sign-in required
465
507
 
466
508
  \`${pathname}\` requires signing in.
@@ -472,6 +514,21 @@ This account cannot read \`${pathname}\`.
472
514
  return new Response(head ? null : body, { status: pageResponse.status, headers });
473
515
  }
474
516
  __name(createMarkdownAccessResponse, "createMarkdownAccessResponse");
517
+ function preserveMarkdownResponseControlHeaders(source, target) {
518
+ for (const name of ["WWW-Authenticate", "Proxy-Authenticate", "Retry-After", "Allow"]) {
519
+ const value = source.get(name);
520
+ if (value !== null) target.set(name, value);
521
+ }
522
+ }
523
+ __name(preserveMarkdownResponseControlHeaders, "preserveMarkdownResponseControlHeaders");
524
+ function preserveMarkdownResponseCookies(source, target) {
525
+ const getSetCookie = source.getSetCookie;
526
+ const cookies = typeof getSetCookie === "function" ? getSetCookie.call(source) : source.has("set-cookie") ? [source.get("set-cookie")] : [];
527
+ if (cookies.length === 0) return;
528
+ for (const cookie of cookies) target.append("Set-Cookie", cookie);
529
+ target.set("Cache-Control", "private, no-store");
530
+ }
531
+ __name(preserveMarkdownResponseCookies, "preserveMarkdownResponseCookies");
475
532
  function applyMarkdownNegotiationHeaders(response, options) {
476
533
  if (!isHtmlResponse(response)) {
477
534
  return response;
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkI7PUUDGYcjs = require('./chunk-I7PUUDGY.cjs');
4
+ var _chunk63H6BKXGcjs = require('./chunk-63H6BKXG.cjs');
5
5
 
6
6
 
7
7
  var _chunkSK35NQKKcjs = require('./chunk-SK35NQKK.cjs');
8
8
 
9
9
 
10
- var _chunkH6G5INWMcjs = require('./chunk-H6G5INWM.cjs');
10
+ var _chunkNYJMY3JAcjs = require('./chunk-NYJMY3JA.cjs');
11
11
 
12
12
 
13
13
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -40,7 +40,7 @@ var serverQueryClientState = _nullishCoalesce(serverQueryClientGlobal[FARM_SERVE
40
40
  _nullishCoalesce(serverQueryClientState.latestOwners, () => ( (serverQueryClientState.latestOwners = /* @__PURE__ */ new Map())));
41
41
  _nullishCoalesce(serverQueryClientState.owners, () => ( (serverQueryClientState.owners = /* @__PURE__ */ new Set())));
42
42
  function isServerQueryOwnerSuperseded(owner, key) {
43
- const cache = _chunkI7PUUDGYcjs.getFarmClientDataCache.call(void 0, );
43
+ const cache = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
44
44
  const resolved = cache.resolveKey(key);
45
45
  for (const superseded of _nullishCoalesce(owner.supersededKeys, () => ( []))) {
46
46
  if (cache.resolveKey(superseded) === resolved) return true;
@@ -50,7 +50,7 @@ function isServerQueryOwnerSuperseded(owner, key) {
50
50
  _chunkS3JO3N4Hcjs.__name.call(void 0, isServerQueryOwnerSuperseded, "isServerQueryOwnerSuperseded");
51
51
  function claimServerQueryKey(owner, key) {
52
52
  if (isServerQueryOwnerSuperseded(owner, key)) return false;
53
- const resolved = _chunkI7PUUDGYcjs.getFarmClientDataCache.call(void 0, ).resolveKey(key);
53
+ const resolved = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, ).resolveKey(key);
54
54
  for (const older of serverQueryClientState.owners) {
55
55
  if (older === owner) break;
56
56
  older.supersededKeys.add(resolved);
@@ -83,7 +83,7 @@ function beginFarmServerQueryAction(actionId, args) {
83
83
  _chunkS3JO3N4Hcjs.__name.call(void 0, beginFarmServerQueryAction, "beginFarmServerQueryAction");
84
84
  function completeFarmServerQueryAction(invocation, value) {
85
85
  if (!_chunkSK35NQKKcjs.isFarmServerQueryResult.call(void 0, value)) return value;
86
- const cache = _chunkI7PUUDGYcjs.getFarmClientDataCache.call(void 0, );
86
+ const cache = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
87
87
  const metadata = value.__farmServerQuery;
88
88
  if (!shouldApplyFarmServerQueryActionResult(invocation)) {
89
89
  return value.data;
@@ -125,11 +125,11 @@ function createServerQueryCallKey(query, input) {
125
125
  id = ++serverQueryClientState.nextFunctionId;
126
126
  serverQueryClientState.functionIds.set(query, id);
127
127
  }
128
- return _chunkH6G5INWMcjs.createFarmCacheKey.call(void 0, ["server-query-call", id, input]);
128
+ return _chunkNYJMY3JAcjs.createFarmCacheKey.call(void 0, ["server-query-call", id, input]);
129
129
  }
130
130
  _chunkS3JO3N4Hcjs.__name.call(void 0, createServerQueryCallKey, "createServerQueryCallKey");
131
131
  async function fetchServerQuery(query, input, options = {}) {
132
- const cache = _chunkI7PUUDGYcjs.getFarmClientDataCache.call(void 0, );
132
+ const cache = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
133
133
  const provisionalKey = createServerQueryCallKey(query, input);
134
134
  const entry = cache.get(provisionalKey);
135
135
  const stale = cache.isStale(provisionalKey);
@@ -151,11 +151,11 @@ function prefetchServerQuery(query, input, options = {}) {
151
151
  _chunkS3JO3N4Hcjs.__name.call(void 0, prefetchServerQuery, "prefetchServerQuery");
152
152
  async function executeServerQuery(query, input, provisionalKey, options) {
153
153
  assertNotRawServerQueryInBrowser(query);
154
- const cache = _chunkI7PUUDGYcjs.getFarmClientDataCache.call(void 0, );
154
+ const cache = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
155
155
  const inflight = cache.getInflight(provisionalKey);
156
156
  if (inflight && !options.force) return inflight;
157
157
  const owner = {
158
- invalidations: _chunkI7PUUDGYcjs.trackFarmClientCacheInvalidations.call(void 0, cache),
158
+ invalidations: _chunk63H6BKXGcjs.trackFarmClientCacheInvalidations.call(void 0, cache),
159
159
  supersededKeys: /* @__PURE__ */ new Set()
160
160
  };
161
161
  serverQueryClientState.latestOwners.set(provisionalKey, owner);