@farm.js/core 0.1.36 → 0.1.38

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 (272) hide show
  1. package/dist/{agent-mcp-BVExL8rZ.d.mts → agent-mcp-BwKlpnc7.d.mts} +1 -1
  2. package/dist/{agent-mcp-luzfXK-P.d.ts → agent-mcp-De1imoMS.d.ts} +1 -1
  3. package/dist/{agent-mcp-handler-SJAHFSPI.cjs → agent-mcp-handler-MRGP3WJ3.cjs} +5 -5
  4. package/dist/{agent-mcp-handler-LPJ2CADR.mjs → agent-mcp-handler-OLRMZONF.mjs} +4 -4
  5. package/dist/agent-runtime.cjs +3 -3
  6. package/dist/agent-runtime.d.mts +1 -1
  7. package/dist/agent-runtime.d.ts +1 -1
  8. package/dist/agent-runtime.mjs +2 -2
  9. package/dist/api/client.cjs +3 -3
  10. package/dist/api/client.mjs +2 -2
  11. package/dist/api/route-manager.cjs +6 -6
  12. package/dist/api/route-manager.d.mts +3 -3
  13. package/dist/api/route-manager.d.ts +3 -3
  14. package/dist/api/route-manager.mjs +5 -5
  15. package/dist/api/runtime.cjs +4 -4
  16. package/dist/api/runtime.d.mts +2 -2
  17. package/dist/api/runtime.d.ts +2 -2
  18. package/dist/api/runtime.mjs +3 -3
  19. package/dist/api.cjs +9 -8
  20. package/dist/api.d.mts +3 -3
  21. package/dist/api.d.ts +3 -3
  22. package/dist/api.mjs +8 -7
  23. package/dist/{app-BukwkFIu.d.mts → app-CFZt-srr.d.mts} +21 -3
  24. package/dist/{app-Yfa2dsFy.d.ts → app-kT_QXTdx.d.ts} +21 -3
  25. package/dist/app-markdown.cjs +6 -4
  26. package/dist/app-markdown.d.mts +3 -3
  27. package/dist/app-markdown.d.ts +3 -3
  28. package/dist/app-markdown.mjs +5 -3
  29. package/dist/{chunk-ADEA7PN3.cjs → chunk-2DD4JMQC.cjs} +113 -22
  30. package/dist/chunk-2ZYGC6SS.cjs +576 -0
  31. package/dist/{chunk-JZVADIOD.cjs → chunk-34UCJRQO.cjs} +2 -2
  32. package/dist/{chunk-D2BB47NB.cjs → chunk-3LOLJTFV.cjs} +6 -6
  33. package/dist/{chunk-KXWRO25S.cjs → chunk-472NCAZ7.cjs} +3 -3
  34. package/dist/chunk-4E5QXOCL.cjs +109 -0
  35. package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
  36. package/dist/{chunk-VQLJWDVW.cjs → chunk-4IE345DM.cjs} +37 -19
  37. package/dist/{chunk-O6WAEAX3.mjs → chunk-5BWWFHR2.mjs} +70 -15
  38. package/dist/{chunk-JNUWCDTF.cjs → chunk-5D2JIPLH.cjs} +2 -2
  39. package/dist/{chunk-BO36SELV.cjs → chunk-5OKBARDN.cjs} +2 -2
  40. package/dist/{chunk-AO6RYU5N.cjs → chunk-5PWXMJOH.cjs} +30 -22
  41. package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
  42. package/dist/chunk-6BK3K2GB.mjs +318 -0
  43. package/dist/{chunk-O6I6VWKK.mjs → chunk-6HB6V3R7.mjs} +1 -1
  44. package/dist/{chunk-UXFQ3UDA.cjs → chunk-6XWDE2P2.cjs} +61 -4
  45. package/dist/{chunk-VILIPRS6.mjs → chunk-7FPTZLKH.mjs} +1 -1
  46. package/dist/{chunk-SC2WYWPF.mjs → chunk-7PEP3BUT.mjs} +3 -3
  47. package/dist/{chunk-4E5AEDKY.mjs → chunk-A3EAIURZ.mjs} +25 -7
  48. package/dist/{chunk-YDQZGSDS.mjs → chunk-ARC7I3O2.mjs} +1 -1
  49. package/dist/{chunk-LSZAVSGY.mjs → chunk-B6G5CKMC.mjs} +101 -10
  50. package/dist/{chunk-3KZS4SUS.mjs → chunk-BZHXGVMA.mjs} +1 -1
  51. package/dist/{chunk-KN7K4VQN.mjs → chunk-CNNOLE4O.mjs} +1 -1
  52. package/dist/{chunk-4GLOOWKE.mjs → chunk-CQMVIOYP.mjs} +1 -1
  53. package/dist/{chunk-2ELDTQRN.mjs → chunk-CUM5NYL5.mjs} +1 -1
  54. package/dist/{chunk-HITLGIAO.cjs → chunk-CY2ZQ5C6.cjs} +7 -6
  55. package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
  56. package/dist/{chunk-QORUJDIV.mjs → chunk-DRLKAXDM.mjs} +2 -2
  57. package/dist/{chunk-DQQOKWYA.cjs → chunk-EIPC3FDA.cjs} +12 -4
  58. package/dist/{chunk-HOXTWRGB.mjs → chunk-EKF7KDFD.mjs} +5 -2
  59. package/dist/{chunk-42NHY7HW.cjs → chunk-EKN7NSZO.cjs} +62 -14
  60. package/dist/{chunk-YKX5BK66.cjs → chunk-EMO6K4YY.cjs} +7 -7
  61. package/dist/{chunk-6SJ2KJTA.mjs → chunk-EPYU2EBL.mjs} +1 -1
  62. package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
  63. package/dist/{chunk-PTZ2TVNE.cjs → chunk-H5CLOUZS.cjs} +5 -5
  64. package/dist/{chunk-DTSROJ5J.mjs → chunk-HD5CF3OE.mjs} +1 -1
  65. package/dist/{chunk-35GKZR22.mjs → chunk-HXRYZWTA.mjs} +1 -1
  66. package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
  67. package/dist/{chunk-MKYBIIAQ.mjs → chunk-IBUQWVYA.mjs} +17 -1
  68. package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
  69. package/dist/{chunk-W7LF2J2S.mjs → chunk-INL3THCU.mjs} +1 -1
  70. package/dist/{chunk-WZ77PUAM.mjs → chunk-IVLZZZEI.mjs} +1 -1
  71. package/dist/{chunk-ENLZ4R3Y.mjs → chunk-J7K2NZD6.mjs} +7 -6
  72. package/dist/{chunk-BPOF5U4N.mjs → chunk-JCKYH4LG.mjs} +10 -7
  73. package/dist/{chunk-77GNHH2Z.cjs → chunk-JCYYXBAJ.cjs} +3 -3
  74. package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
  75. package/dist/{chunk-ZWM5KGAA.cjs → chunk-KCQBAKIY.cjs} +23 -20
  76. package/dist/{chunk-OTC5BDGO.mjs → chunk-KHKLMNI5.mjs} +12 -7
  77. package/dist/{chunk-DZ5ZVB2K.cjs → chunk-KKSTAEMY.cjs} +1 -1
  78. package/dist/{chunk-N2NAS2AM.cjs → chunk-L4DD7ODZ.cjs} +2 -2
  79. package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
  80. package/dist/{chunk-OO7GXVSR.mjs → chunk-LI2F57NI.mjs} +1 -1
  81. package/dist/{chunk-NRSN7G7E.mjs → chunk-MLY2RP5R.mjs} +10 -2
  82. package/dist/{chunk-BPMATOP2.cjs → chunk-N32CC42M.cjs} +25 -20
  83. package/dist/{chunk-FNO7A7CM.cjs → chunk-NBBEQLOK.cjs} +34 -16
  84. package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
  85. package/dist/{chunk-GQRWBCWK.mjs → chunk-OAHTRMIC.mjs} +13 -5
  86. package/dist/{chunk-35WV46VL.mjs → chunk-OCIEZME4.mjs} +876 -685
  87. package/dist/{chunk-UH6QN5NL.mjs → chunk-P664ZVTV.mjs} +2 -2
  88. package/dist/{chunk-TE2G5ION.cjs → chunk-PGZDEPTM.cjs} +88 -33
  89. package/dist/{chunk-FDR64H6B.mjs → chunk-POSPE3IO.mjs} +59 -2
  90. package/dist/{chunk-UVW64BCB.cjs → chunk-Q3NXS4MU.cjs} +16 -14
  91. package/dist/{chunk-4WCZJQUO.mjs → chunk-QFW2IH5E.mjs} +57 -9
  92. package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
  93. package/dist/chunk-QRKIMN7T.mjs +48 -0
  94. package/dist/chunk-QTXBII4Z.cjs +632 -0
  95. package/dist/{chunk-CI6E3UOH.cjs → chunk-RG4A6LB2.cjs} +7 -7
  96. package/dist/{chunk-BJPBQNIE.cjs → chunk-RW63BOV7.cjs} +2 -2
  97. package/dist/{chunk-FO427P6I.cjs → chunk-RWFLWR5J.cjs} +10 -10
  98. package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
  99. package/dist/{chunk-EUV4YR3V.cjs → chunk-SGBJ247Q.cjs} +18 -2
  100. package/dist/chunk-SGBZPZUW.mjs +75 -0
  101. package/dist/{chunk-2NNMOPDN.mjs → chunk-SKVTP5PR.mjs} +4 -1
  102. package/dist/{chunk-2YTDKNH3.cjs → chunk-TGFQVLLF.cjs} +956 -765
  103. package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
  104. package/dist/{chunk-276VJSM6.mjs → chunk-TUBTR2OP.mjs} +250 -118
  105. package/dist/{chunk-GQ3Z3IZI.cjs → chunk-TYJALEHQ.cjs} +18 -18
  106. package/dist/chunk-TYMMBFN2.mjs +109 -0
  107. package/dist/chunk-U6QLDL3G.mjs +576 -0
  108. package/dist/{chunk-U4KT7QP3.cjs → chunk-ULASELLA.cjs} +26 -1
  109. package/dist/chunk-UXHS27O6.cjs +75 -0
  110. package/dist/{chunk-WWIKMBRN.mjs → chunk-VNGH5MLF.mjs} +17 -1
  111. package/dist/{chunk-EZDQRNQ7.mjs → chunk-VT4WFRHA.mjs} +23 -5
  112. package/dist/{chunk-CBJJH36A.cjs → chunk-VU6AAZVY.cjs} +20 -4
  113. package/dist/{chunk-27ZWSI3W.cjs → chunk-VXEEATVD.cjs} +2 -2
  114. package/dist/{chunk-EWET4D2Y.mjs → chunk-W36M2BQ4.mjs} +3 -3
  115. package/dist/{chunk-4WQ6PGSJ.cjs → chunk-WEW2JVA4.cjs} +4 -4
  116. package/dist/{chunk-4E5WBPEG.mjs → chunk-WFRT7JPX.mjs} +8 -533
  117. package/dist/{chunk-T4OGRVNS.mjs → chunk-WLL43JMO.mjs} +2 -2
  118. package/dist/chunk-WW46B6HA.cjs +318 -0
  119. package/dist/{chunk-TKSCR644.cjs → chunk-WXJLNP33.cjs} +2 -2
  120. package/dist/{chunk-S6VYG6XU.cjs → chunk-XKG2BLFN.cjs} +2 -2
  121. package/dist/{chunk-4NU4GGTC.cjs → chunk-XKVVMZP5.cjs} +6 -3
  122. package/dist/{chunk-NMHWYWDR.cjs → chunk-YR2VBEMO.cjs} +658 -526
  123. package/dist/{chunk-OHLSEQ57.mjs → chunk-ZJD2PN6Z.mjs} +10 -8
  124. package/dist/{chunk-3BU22U3M.cjs → chunk-ZXH4TS3F.cjs} +5 -2
  125. package/dist/{client-plugins-r1mOtSC1.d.ts → client-plugins-BvlNhGEB.d.ts} +54 -7
  126. package/dist/{client-plugins-C3mK9Pol.d.mts → client-plugins-DUrIYX9B.d.mts} +54 -7
  127. package/dist/client-plugins.d.mts +1 -1
  128. package/dist/client-plugins.d.ts +1 -1
  129. package/dist/client.cjs +8 -8
  130. package/dist/client.d.mts +5 -5
  131. package/dist/client.d.ts +5 -5
  132. package/dist/client.mjs +7 -7
  133. package/dist/config.d.mts +1 -1
  134. package/dist/config.d.ts +1 -1
  135. package/dist/{devtools-ERIKFEXX.mjs → devtools-JYJNOLPQ.mjs} +8 -6
  136. package/dist/{devtools-JZJJY5CK.cjs → devtools-VQWJANJV.cjs} +9 -7
  137. package/dist/docs.cjs +12 -10
  138. package/dist/docs.d.mts +20 -2
  139. package/dist/docs.d.ts +20 -2
  140. package/dist/docs.mjs +11 -9
  141. package/dist/headers.cjs +6 -4
  142. package/dist/headers.d.mts +11 -1
  143. package/dist/headers.d.ts +11 -1
  144. package/dist/headers.mjs +5 -3
  145. package/dist/i18n/client.cjs +11 -11
  146. package/dist/i18n/client.mjs +3 -3
  147. package/dist/index.cjs +62 -46
  148. package/dist/index.d.mts +16 -16
  149. package/dist/index.d.ts +16 -16
  150. package/dist/index.mjs +62 -46
  151. package/dist/integrations.cjs +5 -3
  152. package/dist/integrations.d.mts +1 -1
  153. package/dist/integrations.d.ts +1 -1
  154. package/dist/integrations.mjs +4 -2
  155. package/dist/internal/app-markdown-runtime.cjs +5 -3
  156. package/dist/internal/app-markdown-runtime.d.mts +19 -5
  157. package/dist/internal/app-markdown-runtime.d.ts +19 -5
  158. package/dist/internal/app-markdown-runtime.mjs +4 -2
  159. package/dist/internal/build-runtime.cjs +33 -30
  160. package/dist/internal/build-runtime.d.mts +3 -3
  161. package/dist/internal/build-runtime.d.ts +3 -3
  162. package/dist/internal/build-runtime.mjs +32 -29
  163. package/dist/internal/cli-runtime.cjs +14 -12
  164. package/dist/internal/cli-runtime.mjs +13 -11
  165. package/dist/internal/client-error-overlay.cjs +4 -4
  166. package/dist/internal/client-error-overlay.mjs +1 -1
  167. package/dist/internal/client-runtime.cjs +2 -2
  168. package/dist/internal/client-runtime.mjs +1 -1
  169. package/dist/internal/compression-runtime.d.mts +1 -1
  170. package/dist/internal/compression-runtime.d.ts +1 -1
  171. package/dist/internal/config-runtime.cjs +9 -7
  172. package/dist/internal/config-runtime.d.mts +2 -2
  173. package/dist/internal/config-runtime.d.ts +2 -2
  174. package/dist/internal/config-runtime.mjs +8 -6
  175. package/dist/internal/docs-precompiled-runtime.cjs +19 -13
  176. package/dist/internal/docs-precompiled-runtime.d.mts +5 -0
  177. package/dist/internal/docs-precompiled-runtime.d.ts +5 -0
  178. package/dist/internal/docs-precompiled-runtime.mjs +14 -8
  179. package/dist/internal/infra-analytics-runtime.cjs +5 -5
  180. package/dist/internal/infra-analytics-runtime.mjs +3 -3
  181. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  182. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  183. package/dist/internal/production-node-env.cjs +6 -2
  184. package/dist/internal/production-node-env.d.mts +10 -1
  185. package/dist/internal/production-node-env.d.ts +10 -1
  186. package/dist/internal/production-node-env.mjs +5 -1
  187. package/dist/internal/production-runtime.cjs +39 -54
  188. package/dist/internal/production-runtime.d.mts +51 -11
  189. package/dist/internal/production-runtime.d.ts +51 -11
  190. package/dist/internal/production-runtime.mjs +39 -54
  191. package/dist/markdown.cjs +8 -2
  192. package/dist/markdown.d.mts +1 -1
  193. package/dist/markdown.d.ts +1 -1
  194. package/dist/markdown.mjs +7 -1
  195. package/dist/middleware.cjs +10 -8
  196. package/dist/middleware.d.mts +27 -5
  197. package/dist/middleware.d.ts +27 -5
  198. package/dist/middleware.mjs +10 -8
  199. package/dist/navigation.cjs +7 -7
  200. package/dist/navigation.d.mts +4 -4
  201. package/dist/navigation.d.ts +4 -4
  202. package/dist/navigation.mjs +6 -6
  203. package/dist/plugin.cjs +25 -23
  204. package/dist/plugin.d.mts +1 -1
  205. package/dist/plugin.d.ts +1 -1
  206. package/dist/plugin.mjs +24 -22
  207. package/dist/{production-runtime-CCeVZXst.d.mts → production-runtime-BQ4_WLwQ.d.mts} +1 -1
  208. package/dist/{production-runtime-DPnsggY3.d.ts → production-runtime-D2aMyzjr.d.ts} +1 -1
  209. package/dist/query/client.cjs +9 -9
  210. package/dist/query/client.mjs +4 -4
  211. package/dist/{render-plan-Cw4f5E_R.d.ts → render-plan-25p4hrj4.d.ts} +1 -1
  212. package/dist/{render-plan-BuGaPFe6.d.mts → render-plan-DtkXMN8D.d.mts} +1 -1
  213. package/dist/renderer-client.cjs +12 -12
  214. package/dist/renderer-client.d.mts +3 -3
  215. package/dist/renderer-client.d.ts +3 -3
  216. package/dist/renderer-client.mjs +4 -4
  217. package/dist/renderer.d.mts +13 -4
  218. package/dist/renderer.d.ts +13 -4
  219. package/dist/{request-CsGARcAw.d.mts → request-DgCkIdcn.d.mts} +4 -2
  220. package/dist/{request-Bkg-hERy.d.ts → request-jF4jwx8f.d.ts} +4 -2
  221. package/dist/request.cjs +3 -3
  222. package/dist/request.d.mts +2 -2
  223. package/dist/request.d.ts +2 -2
  224. package/dist/request.mjs +2 -2
  225. package/dist/{route-rendering-BUZMH_64.d.ts → route-rendering-Bji6S6a_.d.ts} +1 -1
  226. package/dist/{route-rendering-f11yh5dp.d.mts → route-rendering-CSBF78Ya.d.mts} +1 -1
  227. package/dist/{router-Cp6yRE8A.d.mts → router-B09Ui3Qm.d.mts} +1 -1
  228. package/dist/{router-B8CR9GbD.d.ts → router-CPB9cXtG.d.ts} +1 -1
  229. package/dist/routes.cjs +2 -2
  230. package/dist/routes.d.mts +1 -1
  231. package/dist/routes.d.ts +1 -1
  232. package/dist/routes.mjs +1 -1
  233. package/dist/{runtime-CAEv36S_.d.mts → runtime-CM6E6yuI.d.mts} +1 -1
  234. package/dist/{runtime-CQVsT330.d.ts → runtime-EDMwLdjv.d.ts} +1 -1
  235. package/dist/server-fn.cjs +3 -3
  236. package/dist/server-fn.mjs +2 -2
  237. package/dist/server-plugins.cjs +5 -5
  238. package/dist/server-plugins.d.mts +2 -2
  239. package/dist/server-plugins.d.ts +2 -2
  240. package/dist/server-plugins.mjs +4 -4
  241. package/dist/server-query.cjs +4 -4
  242. package/dist/server-query.mjs +3 -3
  243. package/dist/server.cjs +51 -49
  244. package/dist/server.d.mts +7 -7
  245. package/dist/server.d.ts +7 -7
  246. package/dist/server.mjs +29 -27
  247. package/dist/{spa-router-BuciWGCZ.d.ts → spa-router-B_N8XgVu.d.ts} +2 -2
  248. package/dist/{spa-router-DwbqGkGj.d.mts → spa-router-Cgimzfbi.d.mts} +2 -2
  249. package/dist/testing.cjs +8 -8
  250. package/dist/testing.d.mts +1 -1
  251. package/dist/testing.d.ts +1 -1
  252. package/dist/testing.mjs +6 -6
  253. package/dist/theme/server.cjs +4 -4
  254. package/dist/theme/server.mjs +3 -3
  255. package/dist/{utils-CaoWKtYM.d.ts → utils-BNxAKAuT.d.ts} +1 -1
  256. package/dist/{utils-B9V0S_yL.d.mts → utils-DZciYXYl.d.mts} +1 -1
  257. package/dist/version.cjs +2 -2
  258. package/dist/version.mjs +1 -1
  259. package/dist/vite.cjs +25 -23
  260. package/dist/vite.d.mts +1 -1
  261. package/dist/vite.d.ts +1 -1
  262. package/dist/vite.mjs +24 -22
  263. package/package.json +1 -1
  264. package/types/middleware.d.ts +5 -1
  265. package/dist/chunk-655RLQQL.mjs +0 -43
  266. package/dist/chunk-FXEF4PPL.mjs +0 -47
  267. package/dist/chunk-IZY3V5XW.mjs +0 -23
  268. package/dist/chunk-MRMI32SN.cjs +0 -1157
  269. package/dist/chunk-MT763TDW.cjs +0 -43
  270. package/dist/chunk-XD32KALF.cjs +0 -47
  271. /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
  272. /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
@@ -1,15 +1,18 @@
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
+ var _chunkUXHS27O6cjs = require('./chunk-UXHS27O6.cjs');
4
+
5
+
3
6
  var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
4
7
 
5
8
 
6
9
  var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
7
10
 
8
11
 
9
- var _chunkFO427P6Icjs = require('./chunk-FO427P6I.cjs');
12
+ var _chunkRWFLWR5Jcjs = require('./chunk-RWFLWR5J.cjs');
10
13
 
11
14
 
12
- var _chunkSJNMVDDFcjs = require('./chunk-SJNMVDDF.cjs');
15
+ var _chunkFUCSUGDMcjs = require('./chunk-FUCSUGDM.cjs');
13
16
 
14
17
 
15
18
  var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
@@ -20,7 +23,7 @@ var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
20
23
 
21
24
 
22
25
 
23
- var _chunkS6VYG6XUcjs = require('./chunk-S6VYG6XU.cjs');
26
+ var _chunkXKG2BLFNcjs = require('./chunk-XKG2BLFN.cjs');
24
27
 
25
28
 
26
29
  var _chunk6V4TDWECcjs = require('./chunk-6V4TDWEC.cjs');
@@ -44,7 +47,7 @@ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
44
47
  var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
45
48
 
46
49
 
47
- var _chunkUXFQ3UDAcjs = require('./chunk-UXFQ3UDA.cjs');
50
+ var _chunk6XWDE2P2cjs = require('./chunk-6XWDE2P2.cjs');
48
51
 
49
52
 
50
53
 
@@ -65,6 +68,7 @@ function farmApiPlugin(options = {}) {
65
68
  let apiRoutesCache = /* @__PURE__ */ new Map();
66
69
  let apiRouterHandler = null;
67
70
  let projectRoot = process.cwd();
71
+ let devServer;
68
72
  let pluginMergedRoutes = null;
69
73
  const servedRoutes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _nullishCoalesce(pluginMergedRoutes, () => ( apiRoutesCache)), "servedRoutes");
70
74
  let routePlugins;
@@ -110,7 +114,7 @@ function farmApiPlugin(options = {}) {
110
114
  const existing = apiRoutesCache.get(routePath);
111
115
  const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
112
116
  if (existingFile) {
113
- throw new (0, _chunkFO427P6Icjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
117
+ throw new (0, _chunkRWFLWR5Jcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
114
118
  }
115
119
  if (existing) {
116
120
  if (!existing.methods.includes(normalizedMethod)) {
@@ -186,11 +190,14 @@ function farmApiPlugin(options = {}) {
186
190
  const createRouter = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
187
191
  const plugins = options.plugins ? await (_nullishCoalesce(routePlugins, () => ( (routePlugins = Promise.resolve(options.plugins({ root: projectRoot })))))) : [];
188
192
  pluginMergedRoutes = plugins.length ? new Map(
189
- _chunkS6VYG6XUcjs.mergePluginAPIRoutes.call(void 0, [...apiRoutesCache.values()], plugins, void 0, {
193
+ _chunkXKG2BLFNcjs.mergePluginAPIRoutes.call(void 0, [...apiRoutesCache.values()], plugins, void 0, {
190
194
  bodySizeLimit,
191
195
  // A plugin calling an app endpoint (an MCP tool, say) goes back through this server,
192
196
  // so the middleware that guards the endpoint's path runs for it.
193
- dispatch: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (request) => fetch(request, { redirect: "manual" }), "dispatch")
197
+ dispatch: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (request) => {
198
+ if (!devServer) throw new Error("The Farm API dev server is not running.");
199
+ return _chunkUXHS27O6cjs.createFarmDevServerDispatch.call(void 0, devServer)(request);
200
+ }, "dispatch")
194
201
  }).map((route) => [route.path, route])
195
202
  ) : null;
196
203
  const totalEndpoints = Array.from(servedRoutes().values()).reduce(
@@ -203,7 +210,7 @@ function farmApiPlugin(options = {}) {
203
210
  const url = new URL(request.url);
204
211
  const method = request.method.toUpperCase();
205
212
  const pathname = url.pathname;
206
- const match = _chunkS6VYG6XUcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath);
213
+ const match = _chunkXKG2BLFNcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath);
207
214
  if (!match) {
208
215
  return new Response(JSON.stringify({ error: "Not Found" }), {
209
216
  status: 404,
@@ -211,18 +218,18 @@ function farmApiPlugin(options = {}) {
211
218
  });
212
219
  }
213
220
  const { route, params } = match;
214
- const endpoint = _chunkS6VYG6XUcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
221
+ const endpoint = _chunkXKG2BLFNcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
215
222
  if (!endpoint) {
216
223
  return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
217
224
  status: 405,
218
225
  headers: {
219
- Allow: _chunkS6VYG6XUcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
226
+ Allow: _chunkXKG2BLFNcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
220
227
  "Content-Type": "application/json"
221
228
  }
222
229
  });
223
230
  }
224
231
  try {
225
- return await _chunkS6VYG6XUcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, bodySizeLimit);
232
+ return await _chunkXKG2BLFNcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, bodySizeLimit);
226
233
  } catch (error) {
227
234
  return new Response(JSON.stringify({ error: error.message || "Internal Server Error" }), {
228
235
  status: 500,
@@ -238,6 +245,7 @@ function farmApiPlugin(options = {}) {
238
245
  enforce: "pre",
239
246
  configureServer(server) {
240
247
  projectRoot = server.config.root;
248
+ devServer = server;
241
249
  const discoverFileRoutes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (apiDir) => {
242
250
  const fs = await import("fs");
243
251
  const path = await import("path");
@@ -270,7 +278,7 @@ function farmApiPlugin(options = {}) {
270
278
  const routeModule = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, filePath);
271
279
  const endpoints = {};
272
280
  const availableMethods = [];
273
- for (const method of _chunkS6VYG6XUcjs.API_ROUTE_METHODS) {
281
+ for (const method of _chunkXKG2BLFNcjs.API_ROUTE_METHODS) {
274
282
  if (routeModule[method]) {
275
283
  availableMethods.push(method);
276
284
  endpoints[method] = routeModule[method];
@@ -283,7 +291,7 @@ function farmApiPlugin(options = {}) {
283
291
  log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
284
292
  }
285
293
  } catch (e) {
286
- if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
294
+ if (e instanceof _chunkRWFLWR5Jcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
287
295
  log(`API route load failed at ${filePath}: ${e.message}`);
288
296
  }
289
297
  }
@@ -310,7 +318,7 @@ function farmApiPlugin(options = {}) {
310
318
  }
311
319
  }
312
320
  } catch (e) {
313
- if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
321
+ if (e instanceof _chunkRWFLWR5Jcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
314
322
  log(`Root routes.ts load failed: ${e.message}`);
315
323
  }
316
324
  break;
@@ -320,7 +328,7 @@ function farmApiPlugin(options = {}) {
320
328
  const discoverProgrammaticRoutes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
321
329
  const path = await import("path");
322
330
  const srcRoot = path.join(server.config.root, srcDir);
323
- const routeFiles = _chunkSJNMVDDFcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot);
331
+ const routeFiles = _chunkFUCSUGDMcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot);
324
332
  if (routeFiles.length === 0) return;
325
333
  const { getProgrammaticRouteManifest } = await import("./routes.cjs");
326
334
  for (const routeFile of routeFiles) {
@@ -341,7 +349,7 @@ function farmApiPlugin(options = {}) {
341
349
  }
342
350
  }
343
351
  } catch (e) {
344
- if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
352
+ if (e instanceof _chunkRWFLWR5Jcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
345
353
  log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
346
354
  }
347
355
  }
@@ -393,7 +401,7 @@ function farmApiPlugin(options = {}) {
393
401
  const pathname = url.split("?")[0];
394
402
  const method = req.method || "GET";
395
403
  if (discoveryPromise) await waitForDiscovery();
396
- if (!_chunkS6VYG6XUcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath)) {
404
+ if (!_chunkXKG2BLFNcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath)) {
397
405
  return next();
398
406
  }
399
407
  if (!apiRouterHandler) {
@@ -414,10 +422,10 @@ function farmApiPlugin(options = {}) {
414
422
  }
415
423
  const currentUrl = req.url || url;
416
424
  const currentPathname = currentUrl.split("?")[0];
417
- if (currentPathname !== pathname && !_chunkS6VYG6XUcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), currentPathname, basePath)) {
425
+ if (currentPathname !== pathname && !_chunkXKG2BLFNcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), currentPathname, basePath)) {
418
426
  return next();
419
427
  }
420
- const fullUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req);
428
+ const fullUrl = _chunk6XWDE2P2cjs.resolveFarmRequestURL.call(void 0, req);
421
429
  const headers = new Headers();
422
430
  for (const [key, value] of Object.entries(req.headers)) {
423
431
  if (value) {
@@ -518,7 +526,7 @@ function farmApiPlugin(options = {}) {
518
526
  log(`API router recreated`);
519
527
  } catch (e) {
520
528
  restoreRouteState(previousState);
521
- if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
529
+ if (e instanceof _chunkRWFLWR5Jcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
522
530
  log(`Root routes.ts HMR failed: ${e.message}`);
523
531
  }
524
532
  return [];
@@ -546,7 +554,7 @@ function farmApiPlugin(options = {}) {
546
554
  const routeModule = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, file);
547
555
  removeEndpointsFromFile(file);
548
556
  const availableMethods = [];
549
- for (const method of _chunkS6VYG6XUcjs.API_ROUTE_METHODS) {
557
+ for (const method of _chunkXKG2BLFNcjs.API_ROUTE_METHODS) {
550
558
  if (!routeModule[method]) continue;
551
559
  availableMethods.push(method);
552
560
  addEndpoint(routePath, file, method, routeModule[method]);
@@ -556,7 +564,7 @@ function farmApiPlugin(options = {}) {
556
564
  log(`API router recreated`);
557
565
  } catch (e) {
558
566
  restoreRouteState(previousState);
559
- if (e instanceof _chunkFO427P6Icjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
567
+ if (e instanceof _chunkRWFLWR5Jcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
560
568
  log(`API route HMR failed: ${e.message}`);
561
569
  }
562
570
  return [];
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compiledFarmI18nMessages,
3
3
  getFarmI18nClientState
4
- } from "./chunk-F2SE2VDO.mjs";
4
+ } from "./chunk-IHQIOZLC.mjs";
5
5
  import {
6
6
  __name
7
7
  } from "./chunk-LPEX4YW6.mjs";
@@ -0,0 +1,318 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-LPEX4YW6.mjs";
4
+
5
+ // src/nitro/node-server-entry.ts
6
+ var FARM_NODE_ENV_MODULE_FILE = "farm-node-env.mjs";
7
+ var FARM_NODE_ENV_MODULE_SOURCE = `if (!process.env.NODE_ENV) process.env.NODE_ENV = "production";
8
+ `;
9
+ function createFarmNodeServerEntry(options) {
10
+ const serverConfig = JSON.stringify(options.server);
11
+ const nitroEntryImport = `./${options.nitroEntryFile.replace(/^\.\//, "")}`;
12
+ return `
13
+ import "./${FARM_NODE_ENV_MODULE_FILE}";
14
+ import "#nitro/virtual/polyfills";
15
+ import { NodeRequest, serve } from ${JSON.stringify(options.nodeAdapterModule)};
16
+ import wsAdapter from ${JSON.stringify(options.websocketAdapterModule)};
17
+ import { resolveWebsocketHooks, useNitroApp, useNitroHooks } from "#nitro/runtime/app";
18
+ import { useRuntimeConfig } from "#nitro/runtime/runtime-config";
19
+ import { trapUnhandledErrors } from "#nitro/runtime/error/hooks";
20
+ import { setupCloseHooks } from "#nitro/runtime/shutdown";
21
+ import { startScheduleRunner } from "#nitro/runtime/task";
22
+ import { tracingSrvxPlugins } from "#nitro/virtual/tracing";
23
+ import { farmProductionLifecycle } from ${JSON.stringify(nitroEntryImport)};
24
+
25
+ const farmServerConfig = ${serverConfig};
26
+ if (!process.env.NITRO_SHUTDOWN_TIMEOUT) {
27
+ process.env.NITRO_SHUTDOWN_TIMEOUT = String(farmServerConfig.gracefulShutdownTimeout);
28
+ }
29
+ const shutdownConfig = {
30
+ disabled: Boolean(process.env.NITRO_SHUTDOWN_DISABLED),
31
+ signals: (process.env.NITRO_SHUTDOWN_SIGNALS || "SIGTERM SIGINT")
32
+ .split(" ")
33
+ .map((signal) => signal.trim())
34
+ .filter(Boolean),
35
+ timeout: Number.parseInt(process.env.NITRO_SHUTDOWN_TIMEOUT || "", 10) || 30000,
36
+ forceExit: !process.env.NITRO_SHUTDOWN_NO_FORCE_EXIT,
37
+ };
38
+
39
+ const nitroApp = useNitroApp();
40
+ useNitroHooks().hook("close", async () => {
41
+ try {
42
+ await farmProductionLifecycle.close("production-server-closed");
43
+ } catch (error) {
44
+ process.exitCode = 1;
45
+ throw error;
46
+ }
47
+ });
48
+
49
+ let startupSignal;
50
+ let resolveStartupSignal;
51
+ const startupSignalPromise = new Promise((resolve) => {
52
+ resolveStartupSignal = resolve;
53
+ });
54
+ const startupSignalListeners = new Map();
55
+ if (!shutdownConfig.disabled) {
56
+ for (const signal of shutdownConfig.signals) {
57
+ const listener = (receivedSignal) => {
58
+ if (!startupSignal) {
59
+ startupSignal = receivedSignal;
60
+ resolveStartupSignal(receivedSignal);
61
+ }
62
+ farmProductionLifecycle.beginDrain(receivedSignal);
63
+ };
64
+ startupSignalListeners.set(signal, listener);
65
+ process.once(signal, listener);
66
+ }
67
+ }
68
+
69
+ try {
70
+ await Promise.race([
71
+ Promise.resolve().then(() => farmProductionLifecycle.start()),
72
+ startupSignalPromise,
73
+ ]);
74
+ } catch (error) {
75
+ await farmProductionLifecycle.close("production-start-failed").catch((closeError) => {
76
+ console.error("[Farm] Runtime cleanup after startup failure failed:", closeError);
77
+ });
78
+ throw error;
79
+ } finally {
80
+ for (const [signal, listener] of startupSignalListeners) {
81
+ process.removeListener(signal, listener);
82
+ }
83
+ }
84
+
85
+ if (startupSignal) {
86
+ let startupCloseTimer;
87
+ const startupCloseCompleted = await Promise.race([
88
+ Promise.resolve()
89
+ .then(() => farmProductionLifecycle.close(startupSignal))
90
+ .then(
91
+ () => true,
92
+ (error) => {
93
+ console.error("[Farm] Runtime shutdown during startup failed:", error);
94
+ process.exitCode = 1;
95
+ return true;
96
+ },
97
+ ),
98
+ new Promise((resolve) => {
99
+ startupCloseTimer = setTimeout(() => resolve(false), farmServerConfig.gracefulShutdownTimeout);
100
+ }),
101
+ ]);
102
+ clearTimeout(startupCloseTimer);
103
+ if (!startupCloseCompleted) {
104
+ console.warn("[Farm] Runtime startup did not settle before shutdown; forcing cleanup");
105
+ let forcedCloseTimer;
106
+ const forcedCloseCompleted = await Promise.race([
107
+ Promise.resolve()
108
+ .then(() => farmProductionLifecycle.forceClose(startupSignal))
109
+ .then(
110
+ () => true,
111
+ (error) => {
112
+ console.error("[Farm] Forced runtime shutdown during startup failed:", error);
113
+ process.exitCode = 1;
114
+ return true;
115
+ },
116
+ ),
117
+ new Promise((resolve) => {
118
+ forcedCloseTimer = setTimeout(
119
+ () => resolve(false),
120
+ farmServerConfig.gracefulShutdownTimeout,
121
+ );
122
+ }),
123
+ ]);
124
+ clearTimeout(forcedCloseTimer);
125
+ if (!forcedCloseCompleted) {
126
+ console.error("[Farm] Forced runtime shutdown during startup timed out");
127
+ process.exitCode = 1;
128
+ }
129
+ }
130
+ process.exit(process.exitCode || 0);
131
+ }
132
+
133
+ const cert = process.env.NITRO_SSL_CERT;
134
+ const key = process.env.NITRO_SSL_KEY;
135
+ const configuredPort = Number(process.env.NITRO_PORT || process.env.PORT);
136
+ const port = Number.isFinite(configuredPort) && configuredPort > 0 ? configuredPort : 3000;
137
+ const host = process.env.NITRO_HOST || process.env.HOST;
138
+ const socketPath = process.env.NITRO_UNIX_SOCKET;
139
+ const server = serve({
140
+ manual: true,
141
+ silent: true,
142
+ gracefulShutdown: false,
143
+ port,
144
+ hostname: host,
145
+ node: socketPath ? { path: socketPath } : undefined,
146
+ tls: cert && key ? { cert, key } : undefined,
147
+ fetch: nitroApp.fetch,
148
+ plugins: [...tracingSrvxPlugins],
149
+ });
150
+ const nodeServer = server.node?.server;
151
+ if (!nodeServer) throw new Error("[Farm] Nitro did not create a Node server");
152
+
153
+ nodeServer.headersTimeout = farmServerConfig.headersTimeout;
154
+ nodeServer.requestTimeout = farmServerConfig.requestTimeout;
155
+ nodeServer.keepAliveTimeout = farmServerConfig.keepAliveTimeout;
156
+
157
+ let isShuttingDown = false;
158
+ nodeServer.on("request", (_request, response) => {
159
+ response.once("finish", () => {
160
+ if (isShuttingDown) nodeServer.closeIdleConnections?.();
161
+ });
162
+ });
163
+
164
+ if (import.meta._websocket) {
165
+ const { handleUpgrade } = wsAdapter({ resolve: resolveWebsocketHooks });
166
+ nodeServer.on("upgrade", (request, socket, head) => {
167
+ handleUpgrade(
168
+ request,
169
+ socket,
170
+ head,
171
+ new NodeRequest({ req: request, upgrade: { socket, head } }),
172
+ );
173
+ });
174
+ }
175
+
176
+ setupCloseHooks(server);
177
+ trapUnhandledErrors();
178
+
179
+ let shutdownPromise;
180
+ async function shutdown(signal) {
181
+ isShuttingDown = true;
182
+ farmProductionLifecycle.beginDrain(signal);
183
+
184
+ const gracefulClose = server.close().then(
185
+ () => true,
186
+ (error) => {
187
+ console.error("[Farm] Runtime shutdown failed:", error);
188
+ process.exitCode = 1;
189
+ return true;
190
+ },
191
+ );
192
+ nodeServer.closeIdleConnections?.();
193
+ let gracefulTimer;
194
+ const gracefullyClosed = await Promise.race([
195
+ gracefulClose,
196
+ new Promise((resolve) => {
197
+ gracefulTimer = setTimeout(() => resolve(false), shutdownConfig.timeout);
198
+ }),
199
+ ]);
200
+ clearTimeout(gracefulTimer);
201
+
202
+ if (!gracefullyClosed) {
203
+ console.warn("[Farm] Graceful shutdown timed out; forcing cleanup");
204
+ void server.close(true).catch((error) => {
205
+ console.error("[Farm] Forced server shutdown failed:", error);
206
+ process.exitCode = 1;
207
+ });
208
+
209
+ let forceTimer;
210
+ const forceClosed = await Promise.race([
211
+ Promise.resolve()
212
+ .then(() => farmProductionLifecycle.forceClose("production-server-closed"))
213
+ .then(
214
+ () => true,
215
+ (error) => {
216
+ console.error("[Farm] Forced runtime shutdown failed:", error);
217
+ process.exitCode = 1;
218
+ return true;
219
+ },
220
+ ),
221
+ new Promise((resolve) => {
222
+ forceTimer = setTimeout(() => resolve(false), shutdownConfig.timeout);
223
+ }),
224
+ ]);
225
+ clearTimeout(forceTimer);
226
+ if (!forceClosed) {
227
+ console.error("[Farm] Forced runtime shutdown timed out");
228
+ process.exitCode = 1;
229
+ }
230
+ }
231
+
232
+ if (shutdownConfig.forceExit) process.exit(process.exitCode || 0);
233
+ }
234
+
235
+ if (!shutdownConfig.disabled) {
236
+ for (const signal of shutdownConfig.signals) {
237
+ process.once(signal, (receivedSignal) => {
238
+ shutdownPromise ||= shutdown(receivedSignal);
239
+ });
240
+ }
241
+ }
242
+
243
+ try {
244
+ await server.serve();
245
+ const protocol = cert && key ? "https" : "http";
246
+ const addressInfo = nodeServer.address();
247
+ if (typeof addressInfo === "string") {
248
+ console.log(\`Listening on unix socket \${addressInfo}\`);
249
+ } else if (addressInfo) {
250
+ const configuredBaseURL = useRuntimeConfig().app.baseURL || "";
251
+ const baseURL = configuredBaseURL.endsWith("/")
252
+ ? configuredBaseURL.slice(0, -1)
253
+ : configuredBaseURL;
254
+ const address = addressInfo.family === "IPv6"
255
+ ? \`[\${addressInfo.address}]\`
256
+ : addressInfo.address;
257
+ console.log(\`Listening on \${protocol}://\${address}:\${addressInfo.port}\${baseURL}\`);
258
+ }
259
+ } catch (error) {
260
+ console.error(error);
261
+ process.exitCode = 1;
262
+ await farmProductionLifecycle.close("production-listen-error").catch((closeError) => {
263
+ console.error("[Farm] Runtime cleanup after listen failure failed:", closeError);
264
+ });
265
+ throw error;
266
+ }
267
+
268
+ if (import.meta._tasks) {
269
+ startScheduleRunner({ waitUntil: server.waitUntil });
270
+ }
271
+
272
+ export default {};
273
+ `.trim();
274
+ }
275
+ __name(createFarmNodeServerEntry, "createFarmNodeServerEntry");
276
+
277
+ // src/build/production-node-env.ts
278
+ var productionNodeEnvStateKey = /* @__PURE__ */ Symbol.for("@farm.js/core/production-node-env-state");
279
+ function getProductionNodeEnvState() {
280
+ return Reflect.get(globalThis, productionNodeEnvStateKey);
281
+ }
282
+ __name(getProductionNodeEnvState, "getProductionNodeEnvState");
283
+ async function withProductionNodeEnv(operation) {
284
+ let state = getProductionNodeEnvState();
285
+ if (state) {
286
+ state.depth += 1;
287
+ } else {
288
+ state = {
289
+ depth: 1,
290
+ original: process.env.NODE_ENV
291
+ };
292
+ Reflect.set(globalThis, productionNodeEnvStateKey, state);
293
+ }
294
+ process.env.NODE_ENV = "production";
295
+ try {
296
+ return await operation();
297
+ } finally {
298
+ state.depth -= 1;
299
+ if (state.depth > 0) {
300
+ process.env.NODE_ENV = "production";
301
+ } else {
302
+ Reflect.deleteProperty(globalThis, productionNodeEnvStateKey);
303
+ if (state.original === void 0) {
304
+ delete process.env.NODE_ENV;
305
+ } else {
306
+ process.env.NODE_ENV = state.original;
307
+ }
308
+ }
309
+ }
310
+ }
311
+ __name(withProductionNodeEnv, "withProductionNodeEnv");
312
+
313
+ export {
314
+ FARM_NODE_ENV_MODULE_FILE,
315
+ FARM_NODE_ENV_MODULE_SOURCE,
316
+ createFarmNodeServerEntry,
317
+ withProductionNodeEnv
318
+ };
@@ -34,7 +34,7 @@ import {
34
34
  } from "./chunk-4SIYUGRY.mjs";
35
35
  import {
36
36
  _runWithCurrentRequest
37
- } from "./chunk-FDR64H6B.mjs";
37
+ } from "./chunk-POSPE3IO.mjs";
38
38
  import {
39
39
  __name
40
40
  } from "./chunk-LPEX4YW6.mjs";
@@ -1,6 +1,8 @@
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
- var _chunkU4KT7QP3cjs = require('./chunk-U4KT7QP3.cjs');
3
+
4
+
5
+ var _chunkULASELLAcjs = require('./chunk-ULASELLA.cjs');
4
6
 
5
7
 
6
8
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -28,7 +30,61 @@ function getRequestReads() {
28
30
  }
29
31
  _chunkS3JO3N4Hcjs.__name.call(void 0, getRequestReads, "getRequestReads");
30
32
  var requestReads = getRequestReads();
31
- _chunkU4KT7QP3cjs._setCurrentRequestResolver.call(void 0, () => requestStore.getStore());
33
+ function countRequestRead(request) {
34
+ requestReads.set(request, (_nullishCoalesce(requestReads.get(request), () => ( 0))) + 1);
35
+ }
36
+ _chunkS3JO3N4Hcjs.__name.call(void 0, countRequestRead, "countRequestRead");
37
+ var appRequestViews = /* @__PURE__ */ new WeakMap();
38
+ function getAppRequestView(request) {
39
+ const existing = appRequestViews.get(request);
40
+ if (existing) return existing;
41
+ let view;
42
+ if (request.method !== "GET" && request.method !== "HEAD") {
43
+ countRequestRead(request);
44
+ view = request;
45
+ } else {
46
+ view = new Request(request);
47
+ Object.defineProperties(view, {
48
+ // The rendered request's own signal, so aborting it reaches the handler unchanged.
49
+ signal: { configurable: true, get: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => request.signal, "get") },
50
+ headers: {
51
+ configurable: true,
52
+ get() {
53
+ countRequestRead(request);
54
+ return request.headers;
55
+ }
56
+ },
57
+ clone: {
58
+ configurable: true,
59
+ value() {
60
+ countRequestRead(request);
61
+ return request.clone();
62
+ }
63
+ }
64
+ });
65
+ }
66
+ appRequestViews.set(request, view);
67
+ return view;
68
+ }
69
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getAppRequestView, "getAppRequestView");
70
+ _chunkULASELLAcjs._setCurrentRequestResolver.call(void 0, () => requestStore.getStore());
71
+ var CSP_NONCE_STORAGE_KEY = /* @__PURE__ */ Symbol.for("@farm.js/core/csp-nonce-storage");
72
+ function getCspNonceStore() {
73
+ const runtime = globalThis;
74
+ const existing = runtime[CSP_NONCE_STORAGE_KEY];
75
+ if (existing instanceof _async_hooks.AsyncLocalStorage) return existing;
76
+ const storage = new (0, _async_hooks.AsyncLocalStorage)();
77
+ runtime[CSP_NONCE_STORAGE_KEY] = storage;
78
+ return storage;
79
+ }
80
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getCspNonceStore, "getCspNonceStore");
81
+ var cspNonceStore = getCspNonceStore();
82
+ _chunkULASELLAcjs._setCspNonceResolver.call(void 0, () => cspNonceStore.getStore());
83
+ function _runWithFarmCspNonce(nonce, fn) {
84
+ return nonce ? cspNonceStore.run(nonce, fn) : fn();
85
+ }
86
+ _chunkS3JO3N4Hcjs.__name.call(void 0, _runWithFarmCspNonce, "_runWithFarmCspNonce");
87
+ _chunkULASELLAcjs._setAppRequestView.call(void 0, getAppRequestView);
32
88
  function resolveFarmRequestURL(req, options = {}) {
33
89
  if (options.origin) {
34
90
  return new URL(req.url || "/", options.origin);
@@ -116,7 +172,7 @@ function getCurrentRequest() {
116
172
  "No current request is available. getCurrentRequest() can only be used during server rendering."
117
173
  );
118
174
  }
119
- requestReads.set(request, (_nullishCoalesce(requestReads.get(request), () => ( 0))) + 1);
175
+ countRequestRead(request);
120
176
  return request;
121
177
  }
122
178
  _chunkS3JO3N4Hcjs.__name.call(void 0, getCurrentRequest, "getCurrentRequest");
@@ -137,4 +193,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, getCurrentRequestOrNull, "getCurrentReques
137
193
 
138
194
 
139
195
 
140
- exports.resolveFarmRequestURL = resolveFarmRequestURL; exports.resolveFarmWebRequestOrigin = resolveFarmWebRequestOrigin; exports.createWebRequestFromFarmRequest = createWebRequestFromFarmRequest; exports._runWithCurrentRequest = _runWithCurrentRequest; exports.getCurrentRequest = getCurrentRequest; exports._getRequestReadCount = _getRequestReadCount; exports.getCurrentRequestOrNull = getCurrentRequestOrNull;
196
+
197
+ exports._runWithFarmCspNonce = _runWithFarmCspNonce; exports.resolveFarmRequestURL = resolveFarmRequestURL; exports.resolveFarmWebRequestOrigin = resolveFarmWebRequestOrigin; exports.createWebRequestFromFarmRequest = createWebRequestFromFarmRequest; exports._runWithCurrentRequest = _runWithCurrentRequest; exports.getCurrentRequest = getCurrentRequest; exports._getRequestReadCount = _getRequestReadCount; exports.getCurrentRequestOrNull = getCurrentRequestOrNull;
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-ZMSZZXOR.mjs";
28
28
  import {
29
29
  getIntegrationSchemas
30
- } from "./chunk-MKYBIIAQ.mjs";
30
+ } from "./chunk-IBUQWVYA.mjs";
31
31
  import {
32
32
  __name
33
33
  } from "./chunk-LPEX4YW6.mjs";
@@ -7,13 +7,13 @@ import {
7
7
  notifyHistoryChange,
8
8
  readPageState,
9
9
  subscribeHistoryChange
10
- } from "./chunk-XCMCS4DA.mjs";
10
+ } from "./chunk-ND2CWPOD.mjs";
11
11
  import {
12
12
  getFarmI18nClientState
13
- } from "./chunk-F2SE2VDO.mjs";
13
+ } from "./chunk-IHQIOZLC.mjs";
14
14
  import {
15
15
  _resolveCurrentRequest
16
- } from "./chunk-IZY3V5XW.mjs";
16
+ } from "./chunk-QRKIMN7T.mjs";
17
17
  import {
18
18
  stripFarmLocaleFromPathname
19
19
  } from "./chunk-L3KT7IXV.mjs";