@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
@@ -9,10 +9,12 @@ import {
9
9
  normalizeFarmRouteRuntimeConfig
10
10
  } from "./chunk-2J7W2WND.mjs";
11
11
  import {
12
- createFarmCacheKey,
13
12
  createRouteDataCacheTag,
14
13
  getFarmDataCache
15
- } from "./chunk-F6SJAKFJ.mjs";
14
+ } from "./chunk-IV6CQY7O.mjs";
15
+ import {
16
+ createFarmCacheKey
17
+ } from "./chunk-CNOQY6Z7.mjs";
16
18
  import {
17
19
  __name
18
20
  } from "./chunk-LPEX4YW6.mjs";
@@ -7,7 +7,7 @@ var _chunkSU7MH53Pcjs = require('./chunk-SU7MH53P.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkB6ZCT36Xcjs = require('./chunk-B6ZCT36X.cjs');
10
+ var _chunkWNLBF77Xcjs = require('./chunk-WNLBF77X.cjs');
11
11
 
12
12
 
13
13
  var _chunk5OVTOKGHcjs = require('./chunk-5OVTOKGH.cjs');
@@ -52,7 +52,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, shouldBlockUnload, "shouldBlockUnload");
52
52
  function navigateViaRouter(href, basePath, replace, options = {}) {
53
53
  if (typeof window === "undefined") return;
54
54
  const url = _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, href, basePath);
55
- const spaRouter = _chunkB6ZCT36Xcjs.getInstalledFarmSPARouter.call(void 0, );
55
+ const spaRouter = _chunkWNLBF77Xcjs.getInstalledFarmSPARouter.call(void 0, );
56
56
  if (spaRouter) {
57
57
  void spaRouter.navigate(url, {
58
58
  replace,
@@ -65,7 +65,7 @@ function navigateViaRouter(href, basePath, replace, options = {}) {
65
65
  } else {
66
66
  window.history.pushState(null, "", url);
67
67
  }
68
- _chunkB6ZCT36Xcjs.notifyHistoryChange.call(void 0, "url-search");
68
+ _chunkWNLBF77Xcjs.notifyHistoryChange.call(void 0, "url-search");
69
69
  }
70
70
  _chunkS3JO3N4Hcjs.__name.call(void 0, navigateViaRouter, "navigateViaRouter");
71
71
  function useRouter(options = {}) {
@@ -85,7 +85,7 @@ function useRouter(options = {}) {
85
85
  setState(readRouterState(basePath, routeMatcher));
86
86
  }, "handlePopState");
87
87
  handlePopState();
88
- const unsubscribe = _chunkB6ZCT36Xcjs.subscribeHistoryChange.call(void 0, handlePopState);
88
+ const unsubscribe = _chunkWNLBF77Xcjs.subscribeHistoryChange.call(void 0, handlePopState);
89
89
  return unsubscribe;
90
90
  }, [basePath, routeMatcher]);
91
91
  const push = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (href, navigateOptions) => {
@@ -96,11 +96,11 @@ function useRouter(options = {}) {
96
96
  }, "replace");
97
97
  const pushState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
98
98
  if (typeof window === "undefined") return;
99
- _chunkB6ZCT36Xcjs.getRouter.call(void 0, ).pushState(pageState, resolveClientHref(href, basePath));
99
+ _chunkWNLBF77Xcjs.getRouter.call(void 0, ).pushState(pageState, resolveClientHref(href, basePath));
100
100
  }, "pushState");
101
101
  const replaceState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pageState, href) => {
102
102
  if (typeof window === "undefined") return;
103
- _chunkB6ZCT36Xcjs.getRouter.call(void 0, ).replaceState(pageState, resolveClientHref(href, basePath));
103
+ _chunkWNLBF77Xcjs.getRouter.call(void 0, ).replaceState(pageState, resolveClientHref(href, basePath));
104
104
  }, "replaceState");
105
105
  const back = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
106
106
  if (typeof window !== "undefined") {
@@ -124,25 +124,25 @@ function useRouter(options = {}) {
124
124
  }
125
125
  _chunkS3JO3N4Hcjs.__name.call(void 0, useRouter, "useRouter");
126
126
  function usePageState() {
127
- const [state, setState] = _react.useState.call(void 0, () => _chunkB6ZCT36Xcjs.readPageState.call(void 0, ));
127
+ const [state, setState] = _react.useState.call(void 0, () => _chunkWNLBF77Xcjs.readPageState.call(void 0, ));
128
128
  _react.useEffect.call(void 0, () => {
129
129
  if (typeof window === "undefined") return;
130
130
  const handlePopState = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
131
- setState(_chunkB6ZCT36Xcjs.readPageState.call(void 0, ));
131
+ setState(_chunkWNLBF77Xcjs.readPageState.call(void 0, ));
132
132
  }, "handlePopState");
133
133
  handlePopState();
134
- return _chunkB6ZCT36Xcjs.subscribeHistoryChange.call(void 0, handlePopState);
134
+ return _chunkWNLBF77Xcjs.subscribeHistoryChange.call(void 0, handlePopState);
135
135
  }, []);
136
136
  return state;
137
137
  }
138
138
  _chunkS3JO3N4Hcjs.__name.call(void 0, usePageState, "usePageState");
139
139
  function useNavigation() {
140
140
  const [state, setState] = _react.useState.call(void 0,
141
- () => _chunkB6ZCT36Xcjs.getRouter.call(void 0, ).getNavigationState()
141
+ () => _chunkWNLBF77Xcjs.getRouter.call(void 0, ).getNavigationState()
142
142
  );
143
143
  _react.useEffect.call(void 0, () => {
144
144
  if (typeof window === "undefined") return;
145
- return _chunkB6ZCT36Xcjs.getRouter.call(void 0, ).subscribeNavigation(setState);
145
+ return _chunkWNLBF77Xcjs.getRouter.call(void 0, ).subscribeNavigation(setState);
146
146
  }, []);
147
147
  return state;
148
148
  }
@@ -155,7 +155,7 @@ function useBlocker(options) {
155
155
  if (typeof window === "undefined" || !active) {
156
156
  return;
157
157
  }
158
- return _chunkB6ZCT36Xcjs.getRouter.call(void 0, ).addBlocker(
158
+ return _chunkWNLBF77Xcjs.getRouter.call(void 0, ).addBlocker(
159
159
  async (context) => {
160
160
  const current = optionsRef.current;
161
161
  const when = typeof current.when === "function" ? current.when(context) : current.when;
@@ -179,7 +179,7 @@ function useScrollRestoration(key) {
179
179
  _react.useEffect.call(void 0, () => {
180
180
  const element = ref.current;
181
181
  if (!element) return;
182
- return _chunkB6ZCT36Xcjs.getRouter.call(void 0, ).registerScrollElement(key, element);
182
+ return _chunkWNLBF77Xcjs.getRouter.call(void 0, ).registerScrollElement(key, element);
183
183
  }, [key]);
184
184
  return ref;
185
185
  }
@@ -201,7 +201,7 @@ function readRouterState(basePath, routeMatcher) {
201
201
  pathname,
202
202
  searchParams: url.searchParams,
203
203
  params: _optionalChain([routeMatcher, 'optionalAccess', _5 => _5.match, 'call', _6 => _6(routePathname), 'optionalAccess', _7 => _7.params]) || {},
204
- pageState: typeof window === "undefined" ? null : _chunkB6ZCT36Xcjs.readPageState.call(void 0, )
204
+ pageState: typeof window === "undefined" ? null : _chunkWNLBF77Xcjs.readPageState.call(void 0, )
205
205
  };
206
206
  }
207
207
  _chunkS3JO3N4Hcjs.__name.call(void 0, readRouterState, "readRouterState");
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-TVGP4BBZ.mjs";
16
16
  import {
17
17
  farmAcceptQuality
18
- } from "./chunk-OOIL3BWR.mjs";
18
+ } from "./chunk-K3YEZLSY.mjs";
19
19
  import {
20
20
  matchesFarmIfNoneMatch
21
21
  } from "./chunk-XF7Q24PF.mjs";
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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 _chunkQIH2HD6Hcjs = require('./chunk-QIH2HD6H.cjs');
4
+ var _chunkXSPGWQWAcjs = require('./chunk-XSPGWQWA.cjs');
5
5
 
6
6
 
7
7
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -116,7 +116,7 @@ async function createFarmMarkdownSourceResponse(options) {
116
116
  }
117
117
  const url = new URL(options.request.url);
118
118
  const hasMarkdownExtension = url.pathname.toLowerCase().endsWith(".md");
119
- if (!hasMarkdownExtension && !_chunkQIH2HD6Hcjs.requestAcceptsMarkdown.call(void 0, options.request.headers.get("accept"))) {
119
+ if (!hasMarkdownExtension && !_chunkXSPGWQWAcjs.requestAcceptsMarkdown.call(void 0, options.request.headers.get("accept"))) {
120
120
  return null;
121
121
  }
122
122
  const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);
@@ -134,7 +134,7 @@ async function createFarmMarkdownSourceResponse(options) {
134
134
  if (!hasMarkdownExtension) {
135
135
  headers.set("Vary", "Accept");
136
136
  }
137
- return _chunkQIH2HD6Hcjs.createFarmMarkdownViewResponse.call(void 0, {
137
+ return _chunkXSPGWQWAcjs.createFarmMarkdownViewResponse.call(void 0, {
138
138
  request: options.request,
139
139
  requestUrl: url,
140
140
  markdown: source.source,
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.1.26";
2
+ var version = "0.1.28";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkARJWXNQLcjs = require('./chunk-ARJWXNQL.cjs');
3
+ var _chunk2SDO73HKcjs = require('./chunk-2SDO73HK.cjs');
4
4
 
5
5
 
6
- var _chunkH6G5INWMcjs = require('./chunk-H6G5INWM.cjs');
6
+ var _chunkARJWXNQLcjs = require('./chunk-ARJWXNQL.cjs');
7
7
 
8
8
 
9
9
 
@@ -220,7 +220,7 @@ async function applyEndpointInvalidations(declaration, context, result) {
220
220
  "Endpoint invalidates must resolve to an array of { key }, { path }, or { tag } targets"
221
221
  );
222
222
  }
223
- return _chunkH6G5INWMcjs.applyFarmCacheInvalidationTargets.call(void 0, targets);
223
+ return _chunk2SDO73HKcjs.applyFarmCacheInvalidationTargets.call(void 0, targets);
224
224
  }
225
225
  _chunkS3JO3N4Hcjs.__name.call(void 0, applyEndpointInvalidations, "applyEndpointInvalidations");
226
226
  function createInitialEndpointContext(value) {
@@ -15,7 +15,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
15
15
  var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
16
16
 
17
17
 
18
- var _chunkQIH2HD6Hcjs = require('./chunk-QIH2HD6H.cjs');
18
+ var _chunkXSPGWQWAcjs = require('./chunk-XSPGWQWA.cjs');
19
19
 
20
20
 
21
21
  var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
@@ -1181,11 +1181,11 @@ function shouldReturnMarkdown(request) {
1181
1181
  if (url.pathname.endsWith(".md")) return true;
1182
1182
  const accept = request.headers.get("accept");
1183
1183
  const markdown = Math.max(
1184
- _chunkQIH2HD6Hcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
1185
- _chunkQIH2HD6Hcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
1184
+ _chunkXSPGWQWAcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
1185
+ _chunkXSPGWQWAcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
1186
1186
  );
1187
1187
  if (markdown <= 0) return false;
1188
- return markdown >= _chunkQIH2HD6Hcjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
1188
+ return markdown >= _chunkXSPGWQWAcjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
1189
1189
  }
1190
1190
  _chunkS3JO3N4Hcjs.__name.call(void 0, shouldReturnMarkdown, "shouldReturnMarkdown");
1191
1191
  function escapeAttribute(value) {
@@ -16,7 +16,7 @@ var _chunkJ7FSKED3cjs = require('./chunk-J7FSKED3.cjs');
16
16
 
17
17
 
18
18
 
19
- var _chunk3TQWUUNPcjs = require('./chunk-3TQWUUNP.cjs');
19
+ var _chunk3LUF2PE2cjs = require('./chunk-3LUF2PE2.cjs');
20
20
 
21
21
 
22
22
 
@@ -30,7 +30,7 @@ var _chunkQBK2AA4Ucjs = require('./chunk-QBK2AA4U.cjs');
30
30
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
31
31
 
32
32
  // src/client/metadata-reconciler.ts
33
- var MANAGED_ATTRIBUTE = _chunk3TQWUUNPcjs.FARM_METADATA_ATTRIBUTE;
33
+ var MANAGED_ATTRIBUTE = _chunk3LUF2PE2cjs.FARM_METADATA_ATTRIBUTE;
34
34
  var OWNED_SELECTORS = [
35
35
  'meta[name="description"]',
36
36
  'meta[name="keywords"]',
@@ -65,8 +65,8 @@ function removeAll(selector) {
65
65
  }
66
66
  _chunkS3JO3N4Hcjs.__name.call(void 0, removeAll, "removeAll");
67
67
  function applyFarmMetadataToDocument(metadata, pathname) {
68
- document.title = _chunk3TQWUUNPcjs.resolveMetadataTitle.call(void 0, _optionalChain([metadata, 'optionalAccess', _ => _.title])) || "Farm.js App";
69
- const rendered = _chunk3TQWUUNPcjs.renderMetadataHead.call(void 0, metadata, { pathname });
68
+ document.title = _chunk3LUF2PE2cjs.resolveMetadataTitle.call(void 0, _optionalChain([metadata, 'optionalAccess', _ => _.title])) || "Farm.js App";
69
+ const rendered = _chunk3LUF2PE2cjs.renderMetadataHead.call(void 0, metadata, { pathname });
70
70
  const template = document.createElement("template");
71
71
  template.innerHTML = rendered.tags;
72
72
  removeAll(OWNED_SELECTORS);
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  isEndpointFailure,
3
3
  resolvePluginRoutes
4
- } from "./chunk-SYGGPS4A.mjs";
4
+ } from "./chunk-4IEPYMHF.mjs";
5
5
  import {
6
6
  registerAPIRouteShape
7
7
  } from "./chunk-W3B4PKAW.mjs";
8
- import {
9
- resolveFarmAPICanonicalPathname
10
- } from "./chunk-I6XDAKWQ.mjs";
11
8
  import {
12
9
  omitFarmResponseBody
13
10
  } from "./chunk-5WI2S4CO.mjs";
11
+ import {
12
+ resolveFarmAPICanonicalPathname
13
+ } from "./chunk-I6XDAKWQ.mjs";
14
14
  import {
15
15
  DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT,
16
16
  bufferFarmRequestBody,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createRouteDataCacheKey
3
- } from "./chunk-F6SJAKFJ.mjs";
3
+ } from "./chunk-CNOQY6Z7.mjs";
4
4
  import {
5
5
  subscribeFarmCacheInvalidation
6
6
  } from "./chunk-4SIYUGRY.mjs";
@@ -3,6 +3,12 @@
3
3
  var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
4
4
 
5
5
 
6
+ var _chunk5MKEDGLDcjs = require('./chunk-5MKEDGLD.cjs');
7
+
8
+
9
+ var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
10
+
11
+
6
12
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
7
13
 
8
14
  // src/markdown-view.ts
@@ -276,8 +282,14 @@ function ifNoneMatchIncludes(header, etag) {
276
282
  _chunkS3JO3N4Hcjs.__name.call(void 0, ifNoneMatchIncludes, "ifNoneMatchIncludes");
277
283
  function createFarmMarkdownViewResponse(options) {
278
284
  const url = _nullishCoalesce(options.requestUrl, () => ( new URL(options.request.url)));
279
- const view = url.searchParams.has("actions") ? selectFarmPageActionsView(options.markdownPath, _nullishCoalesce(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, _nullishCoalesce(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
  _chunkJ63ZH5OQcjs.emitFarmAgentRead.call(void 0, options.request, "markdown", status, readMarkdownViewName(url.searchParams));
282
294
  for (const [name, value] of Object.entries(_nullishCoalesce(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,27 +386,53 @@ 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 _optionalChain([pageResponse, 'access', _11 => _11.body, 'optionalAccess', _12 => _12.cancel, 'call', _13 => _13(), 'access', _14 => _14.catch, 'call', _15 => _15(() => {
415
+ })]);
416
+ return _nullishCoalesce(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 (!_optionalChain([form, 'access', _16 => _16.action, 'optionalAccess', _17 => _17.startsWith, 'call', _18 => _18("/")])) continue;
429
+ const pathname = new URL(form.action, pageUrl.origin).pathname;
430
+ const tool = _nullishCoalesce(_chunk5MKEDGLDcjs._findFarmMCPEndpointTool.call(void 0, form.method, pathname, options.apiServerBasePath), () => ( _chunk5MKEDGLDcjs._findFarmMCPEndpointTool.call(void 0, form.method, _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname), options.apiServerBasePath)));
431
+ if (tool) form.tool = tool;
432
+ }
395
433
  const markdown = htmlToMarkdown(html, {
396
- title: _optionalChain([target, 'access', _11 => _11.route, 'optionalAccess', _12 => _12.title]),
397
- includeMetadata: _nullishCoalesce(_optionalChain([options, 'access', _13 => _13.config, 'optionalAccess', _14 => _14.includeMetadata]), () => ( true)),
434
+ title: _optionalChain([target, 'access', _19 => _19.route, 'optionalAccess', _20 => _20.title]),
435
+ includeMetadata: _nullishCoalesce(_optionalChain([options, 'access', _21 => _21.config, 'optionalAccess', _22 => _22.includeMetadata]), () => ( true)),
398
436
  sourcePath: target.pathname,
399
437
  actionsPath: actions.length > 0 ? `${markdownPath}?actions` : void 0
400
438
  });
@@ -406,17 +444,21 @@ async function createMarkdownMirrorResponse(options) {
406
444
  if (!hasMarkdownExtension) {
407
445
  headersOut.set("Vary", "Accept");
408
446
  }
409
- for (const token of _nullishCoalesce(_optionalChain([pageResponse, 'access', _15 => _15.headers, 'access', _16 => _16.get, 'call', _17 => _17("vary"), 'optionalAccess', _18 => _18.split, 'call', _19 => _19(",")]), () => ( []))) {
447
+ for (const token of _nullishCoalesce(_optionalChain([pageResponse, 'access', _23 => _23.headers, 'access', _24 => _24.get, 'call', _25 => _25("vary"), 'optionalAccess', _26 => _26.split, 'call', _27 => _27(",")]), () => ( []))) {
410
448
  const name = token.trim();
411
449
  if (name && name.toLowerCase() !== "accept") appendHeaderToken(headersOut, "Vary", name);
412
450
  }
413
451
  const pageCacheControl = pageResponse.headers.get("cache-control");
414
- const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access', _20 => _20.route, 'optionalAccess', _21 => _21.cache]), () => ( _optionalChain([options, 'access', _22 => _22.config, 'optionalAccess', _23 => _23.cache]))), () => ( false));
452
+ const cache = _nullishCoalesce(_nullishCoalesce(_optionalChain([target, 'access', _28 => _28.route, 'optionalAccess', _29 => _29.cache]), () => ( _optionalChain([options, 'access', _30 => _30.config, 'optionalAccess', _31 => _31.cache]))), () => ( false));
415
453
  headersOut.set(
416
454
  "Cache-Control",
417
455
  pageCacheControl && isPrivateCacheControl(pageCacheControl) ? pageCacheControl : createMarkdownCacheHeader(cache)
418
456
  );
419
- const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(_optionalChain([value, 'optionalAccess', _24 => _24.trim, 'call', _25 => _25()]))).join(", ");
457
+ preserveMarkdownResponseCookies(pageResponse.headers, headersOut);
458
+ if (pageResponse.status >= 400) {
459
+ preserveMarkdownResponseControlHeaders(pageResponse.headers, headersOut);
460
+ }
461
+ const robots = [pageResponse.headers.get("x-robots-tag"), readHtmlMetaContent(html, "robots")].filter((value) => Boolean(_optionalChain([value, 'optionalAccess', _32 => _32.trim, 'call', _33 => _33()]))).join(", ");
420
462
  if (robots) headersOut.set("X-Robots-Tag", robots);
421
463
  const canonical = readHtmlCanonicalHref(html);
422
464
  if (canonical) {
@@ -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
  _chunkS3JO3N4Hcjs.__name.call(void 0, 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
+ _chunkS3JO3N4Hcjs.__name.call(void 0, 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
+ _chunkS3JO3N4Hcjs.__name.call(void 0, preserveMarkdownResponseCookies, "preserveMarkdownResponseCookies");
475
532
  function applyMarkdownNegotiationHeaders(response, options) {
476
533
  if (!isHtmlResponse(response)) {
477
534
  return response;
@@ -673,7 +730,7 @@ function getFarmMarkdownAlternatePath(config, pathname) {
673
730
  }
674
731
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmMarkdownAlternatePath, "getFarmMarkdownAlternatePath");
675
732
  function isFarmMarkdownMirrorExposed(config, pathname) {
676
- if (!_optionalChain([config, 'optionalAccess', _26 => _26.enabled])) return false;
733
+ if (!_optionalChain([config, 'optionalAccess', _34 => _34.enabled])) return false;
677
734
  return config.expose === true || findExposedMarkdownRoute(config, pathname) !== null;
678
735
  }
679
736
  _chunkS3JO3N4Hcjs.__name.call(void 0, isFarmMarkdownMirrorExposed, "isFarmMarkdownMirrorExposed");
@@ -766,7 +823,7 @@ function extractHtmlBody(html) {
766
823
  const body = rootMatch ? rootMatch[1] : bodyMatch ? bodyMatch[1] : html;
767
824
  const main = extractFirstElementContent(body, ["main"]);
768
825
  if (main !== void 0) return main;
769
- const articles = _nullishCoalesce(_optionalChain([body, 'access', _27 => _27.match, 'call', _28 => _28(/<article\b/gi), 'optionalAccess', _29 => _29.length]), () => ( 0));
826
+ const articles = _nullishCoalesce(_optionalChain([body, 'access', _35 => _35.match, 'call', _36 => _36(/<article\b/gi), 'optionalAccess', _37 => _37.length]), () => ( 0));
770
827
  return articles === 1 ? _nullishCoalesce(extractFirstElementContent(body, ["article"]), () => ( body)) : body;
771
828
  }
772
829
  _chunkS3JO3N4Hcjs.__name.call(void 0, extractHtmlBody, "extractHtmlBody");
@@ -782,7 +839,7 @@ function extractFirstElementContent(html, tagNames) {
782
839
  _chunkS3JO3N4Hcjs.__name.call(void 0, extractFirstElementContent, "extractFirstElementContent");
783
840
  function readHtmlMetaContent(html, name) {
784
841
  for (const match of html.matchAll(/<meta\b([^>]*)>/gi)) {
785
- if (_optionalChain([readHtmlAttribute, 'call', _30 => _30(match[1], "name"), 'optionalAccess', _31 => _31.toLowerCase, 'call', _32 => _32()]) === name) {
842
+ if (_optionalChain([readHtmlAttribute, 'call', _38 => _38(match[1], "name"), 'optionalAccess', _39 => _39.toLowerCase, 'call', _40 => _40()]) === name) {
786
843
  return readHtmlAttribute(match[1], "content");
787
844
  }
788
845
  }
@@ -791,8 +848,8 @@ function readHtmlMetaContent(html, name) {
791
848
  _chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlMetaContent, "readHtmlMetaContent");
792
849
  function readHtmlCanonicalHref(html) {
793
850
  for (const match of html.matchAll(/<link\b([^>]*)>/gi)) {
794
- const rel = _optionalChain([readHtmlAttribute, 'call', _33 => _33(match[1], "rel"), 'optionalAccess', _34 => _34.toLowerCase, 'call', _35 => _35(), 'access', _36 => _36.split, 'call', _37 => _37(/\s+/)]);
795
- if (_optionalChain([rel, 'optionalAccess', _38 => _38.includes, 'call', _39 => _39("canonical")])) return readHtmlAttribute(match[1], "href");
851
+ const rel = _optionalChain([readHtmlAttribute, 'call', _41 => _41(match[1], "rel"), 'optionalAccess', _42 => _42.toLowerCase, 'call', _43 => _43(), 'access', _44 => _44.split, 'call', _45 => _45(/\s+/)]);
852
+ if (_optionalChain([rel, 'optionalAccess', _46 => _46.includes, 'call', _47 => _47("canonical")])) return readHtmlAttribute(match[1], "href");
796
853
  }
797
854
  return void 0;
798
855
  }
@@ -819,7 +876,7 @@ function extractFarmPageActions(html, pageUrl) {
819
876
  }
820
877
  _chunkS3JO3N4Hcjs.__name.call(void 0, extractFarmPageActions, "extractFarmPageActions");
821
878
  function readPageForm(attributes, content, pageUrl, labelsFor) {
822
- const method = _optionalChain([readDecodedAttribute, 'call', _40 => _40(attributes, "method"), 'optionalAccess', _41 => _41.trim, 'call', _42 => _42(), 'access', _43 => _43.toLowerCase, 'call', _44 => _44()]);
879
+ const method = _optionalChain([readDecodedAttribute, 'call', _48 => _48(attributes, "method"), 'optionalAccess', _49 => _49.trim, 'call', _50 => _50(), 'access', _51 => _51.toLowerCase, 'call', _52 => _52()]);
823
880
  if (method === "dialog") return void 0;
824
881
  const target = resolveFormTarget(readDecodedAttribute(attributes, "action"), pageUrl);
825
882
  const form = {
@@ -829,11 +886,11 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
829
886
  submit: []
830
887
  };
831
888
  const name = _nullishCoalesce(_nullishCoalesce(readDecodedAttribute(attributes, "aria-label"), () => ( readDecodedAttribute(attributes, "name"))), () => ( readDecodedAttribute(attributes, "id")));
832
- if (_optionalChain([name, 'optionalAccess', _45 => _45.trim, 'call', _46 => _46()])) form.name = name.trim();
889
+ if (_optionalChain([name, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()])) form.name = name.trim();
833
890
  if (target) form.action = target;
834
891
  else form.requiresJavaScript = true;
835
892
  if (form.method === "POST") {
836
- const enctype = _optionalChain([readDecodedAttribute, 'call', _47 => _47(attributes, "enctype"), 'optionalAccess', _48 => _48.trim, 'call', _49 => _49(), 'access', _50 => _50.toLowerCase, 'call', _51 => _51()]);
893
+ const enctype = _optionalChain([readDecodedAttribute, 'call', _55 => _55(attributes, "enctype"), 'optionalAccess', _56 => _56.trim, 'call', _57 => _57(), 'access', _58 => _58.toLowerCase, 'call', _59 => _59()]);
837
894
  form.enctype = enctype && FORM_ENCTYPES.has(enctype) ? enctype : "application/x-www-form-urlencoded";
838
895
  }
839
896
  const wrappingLabels = [...content.matchAll(/<label\b[^>]*>([\s\S]*?)<\/label>/gi)].map(
@@ -844,13 +901,13 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
844
901
  })
845
902
  );
846
903
  const labelOf = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (controlAttributes, index) => {
847
- const aria = _optionalChain([readDecodedAttribute, 'call', _52 => _52(controlAttributes, "aria-label"), 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()]);
904
+ const aria = _optionalChain([readDecodedAttribute, 'call', _60 => _60(controlAttributes, "aria-label"), 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()]);
848
905
  if (aria) return aria;
849
906
  const id = readDecodedAttribute(controlAttributes, "id");
850
907
  const forLabel = id ? labelsFor.get(id) : void 0;
851
908
  if (forLabel) return forLabel;
852
909
  const wrapping = wrappingLabels.find((label) => label.start < index && index < label.end);
853
- return _optionalChain([wrapping, 'optionalAccess', _55 => _55.text]) || void 0;
910
+ return _optionalChain([wrapping, 'optionalAccess', _63 => _63.text]) || void 0;
854
911
  }, "labelOf");
855
912
  const groups = /* @__PURE__ */ new Map();
856
913
  const controls = /<(input)\b([^>]*)>|<(select|textarea|button)\b([^>]*)>([\s\S]*?)<\/\3>/gi;
@@ -861,7 +918,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
861
918
  if (hasHtmlAttribute(controlAttributes, "disabled")) continue;
862
919
  const label = labelOf(controlAttributes, match.index);
863
920
  const fieldName = readDecodedAttribute(controlAttributes, "name");
864
- const typeAttribute = _optionalChain([readDecodedAttribute, 'call', _56 => _56(controlAttributes, "type"), 'optionalAccess', _57 => _57.trim, 'call', _58 => _58(), 'access', _59 => _59.toLowerCase, 'call', _60 => _60()]);
921
+ const typeAttribute = _optionalChain([readDecodedAttribute, 'call', _64 => _64(controlAttributes, "type"), 'optionalAccess', _65 => _65.trim, 'call', _66 => _66(), 'access', _67 => _67.toLowerCase, 'call', _68 => _68()]);
865
922
  const type = tag === "input" ? _nullishCoalesce(typeAttribute, () => ( "text")) : tag === "button" ? _nullishCoalesce(typeAttribute, () => ( "submit")) : tag;
866
923
  if (tag === "button" && !["button", "reset"].includes(type) || tag === "input" && (type === "submit" || type === "image")) {
867
924
  const submit = {
@@ -875,7 +932,7 @@ function readPageForm(attributes, content, pageUrl, labelsFor) {
875
932
  const resolved = resolveFormTarget(formAction, pageUrl);
876
933
  if (resolved) submit.action = resolved;
877
934
  }
878
- const formMethod = _optionalChain([readDecodedAttribute, 'call', _61 => _61(controlAttributes, "formmethod"), 'optionalAccess', _62 => _62.toLowerCase, 'call', _63 => _63()]);
935
+ const formMethod = _optionalChain([readDecodedAttribute, 'call', _69 => _69(controlAttributes, "formmethod"), 'optionalAccess', _70 => _70.toLowerCase, 'call', _71 => _71()]);
879
936
  if (formMethod === "get" || formMethod === "post") submit.method = formMethod.toUpperCase();
880
937
  form.submit.push(submit);
881
938
  continue;
@@ -954,7 +1011,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, readPageForm, "readPageForm");
954
1011
  function resolveFormTarget(action, pageUrl) {
955
1012
  let target;
956
1013
  try {
957
- target = new URL(_optionalChain([action, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()]) || pageUrl.href, pageUrl);
1014
+ target = new URL(_optionalChain([action, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()]) || pageUrl.href, pageUrl);
958
1015
  } catch (e4) {
959
1016
  return void 0;
960
1017
  }
@@ -986,7 +1043,7 @@ function readHtmlAttribute(attributes, name) {
986
1043
  _chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlAttribute, "readHtmlAttribute");
987
1044
  function readCodeLanguage(attributesList) {
988
1045
  for (const attributes of attributesList) {
989
- const language = _nullishCoalesce(_nullishCoalesce(readHtmlAttribute(attributes, "data-language"), () => ( readHtmlAttribute(attributes, "data-lang"))), () => ( _optionalChain([readHtmlAttribute, 'call', _66 => _66(attributes, "class"), 'optionalAccess', _67 => _67.match, 'call', _68 => _68(/(?:^|\s)lang(?:uage)?-(\S+)/), 'optionalAccess', _69 => _69[1]])));
1046
+ const language = _nullishCoalesce(_nullishCoalesce(readHtmlAttribute(attributes, "data-language"), () => ( readHtmlAttribute(attributes, "data-lang"))), () => ( _optionalChain([readHtmlAttribute, 'call', _74 => _74(attributes, "class"), 'optionalAccess', _75 => _75.match, 'call', _76 => _76(/(?:^|\s)lang(?:uage)?-(\S+)/), 'optionalAccess', _77 => _77[1]])));
990
1047
  if (language && /^[\w#+.-]+$/.test(language)) return language;
991
1048
  }
992
1049
  return void 0;
@@ -1099,7 +1156,7 @@ function matchClosingTags(html) {
1099
1156
  while (match = tags.exec(html)) {
1100
1157
  const name = match[2].toLowerCase();
1101
1158
  if (match[1]) {
1102
- const start = _optionalChain([open, 'access', _70 => _70.get, 'call', _71 => _71(name), 'optionalAccess', _72 => _72.pop, 'call', _73 => _73()]);
1159
+ const start = _optionalChain([open, 'access', _78 => _78.get, 'call', _79 => _79(name), 'optionalAccess', _80 => _80.pop, 'call', _81 => _81()]);
1103
1160
  if (start !== void 0) closes.set(start, match.index + match[0].length);
1104
1161
  } else if (!VOID_TAGS.has(name) && !isSelfClosingTag(match[0])) {
1105
1162
  let starts = open.get(name);
@@ -1134,7 +1191,7 @@ function resolveStreamedBoundaries(html, { boundaries, placeholders }) {
1134
1191
  let cursor = 0;
1135
1192
  let match;
1136
1193
  while (match = openingTag.exec(html)) {
1137
- const id = _optionalChain([/\sid="([^"]*)"/, 'access', _74 => _74.exec, 'call', _75 => _75(match[2]), 'optionalAccess', _76 => _76[1]]);
1194
+ const id = _optionalChain([/\sid="([^"]*)"/, 'access', _82 => _82.exec, 'call', _83 => _83(match[2]), 'optionalAccess', _84 => _84[1]]);
1138
1195
  if (!id || !wanted.has(id) || segments.has(id)) continue;
1139
1196
  const close = closingTags.get(match.index);
1140
1197
  if (close === void 0) continue;
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var version = "0.1.26";
2
+ var version = "0.1.28";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -7,22 +7,22 @@ import {
7
7
  FarmClientDataCache,
8
8
  getFarmClientDataCache,
9
9
  normalizeFarmClientCacheKey
10
- } from "./chunk-5SPPCN5J.mjs";
10
+ } from "./chunk-XNPDONUH.mjs";
11
11
  import {
12
12
  createClientCancellation
13
13
  } from "./chunk-QVYLBY73.mjs";
14
14
  import {
15
15
  resolveAPIRequestRuntime
16
16
  } from "./chunk-G4MWPDSE.mjs";
17
- import {
18
- matchAPIRoute,
19
- parseDynamicSegment
20
- } from "./chunk-O7BH5O46.mjs";
21
17
  import {
22
18
  isFarmAPIStream,
23
19
  isJSONStreamResponse,
24
20
  readJSONStream
25
21
  } from "./chunk-EMLAPBEM.mjs";
22
+ import {
23
+ matchAPIRoute,
24
+ parseDynamicSegment
25
+ } from "./chunk-O7BH5O46.mjs";
26
26
  import {
27
27
  getFarmAPIBaseURL,
28
28
  resolveFarmAPIRequestURL