@farm.js/core 0.1.60 → 0.1.62

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 (265) hide show
  1. package/dist/{agent-mcp.d-C-2S9bnP.d.mts → agent-mcp.d-BKZ3UNbt.d.mts} +1 -1
  2. package/dist/{agent-mcp.d-SIoCUP1I.d.ts → agent-mcp.d-C1zr_nGS.d.ts} +1 -1
  3. package/dist/agent-runtime.cjs +3 -3
  4. package/dist/agent-runtime.d.mts +2 -2
  5. package/dist/agent-runtime.d.ts +2 -2
  6. package/dist/agent-runtime.mjs +2 -2
  7. package/dist/analyzer-2AHWJJR7.cjs +15 -0
  8. package/dist/analyzer-YESYU3GK.mjs +15 -0
  9. package/dist/api/route-manager.cjs +4 -4
  10. package/dist/api/route-manager.d.mts +4 -4
  11. package/dist/api/route-manager.d.ts +4 -4
  12. package/dist/api/route-manager.mjs +3 -3
  13. package/dist/api/runtime.cjs +3 -3
  14. package/dist/api/runtime.d.mts +3 -3
  15. package/dist/api/runtime.d.ts +3 -3
  16. package/dist/api/runtime.mjs +2 -2
  17. package/dist/api.cjs +5 -5
  18. package/dist/api.d.mts +4 -4
  19. package/dist/api.d.ts +4 -4
  20. package/dist/api.mjs +4 -4
  21. package/dist/{app-manifest.d-DrSAHskY.d.mts → app-manifest.d-BpvhfKRH.d.mts} +1 -1
  22. package/dist/{app-manifest.d-Tb3CJpL4.d.ts → app-manifest.d-ntch_bvA.d.ts} +1 -1
  23. package/dist/app-markdown.d.mts +3 -3
  24. package/dist/app-markdown.d.ts +3 -3
  25. package/dist/{app.d-CmWlYpZJ.d.ts → app.d-AE8_v3Db.d.ts} +4 -10
  26. package/dist/{app.d-D6QQM_kk.d.mts → app.d-CysWA_8v.d.mts} +4 -10
  27. package/dist/{chunk-FORSVMEJ.mjs → chunk-2CNKQC3G.mjs} +1 -1
  28. package/dist/{chunk-ZFUKPWFC.mjs → chunk-2JYBLE63.mjs} +416 -208
  29. package/dist/{chunk-QRX4JRBO.cjs → chunk-3CCAICF7.cjs} +5 -5
  30. package/dist/{chunk-ANHZ6SUL.mjs → chunk-3TXKFRSO.mjs} +1 -1
  31. package/dist/{chunk-BHJAYPYU.mjs → chunk-3UZVPO72.mjs} +1 -1
  32. package/dist/{chunk-6UUH4N4J.mjs → chunk-43V3ANPQ.mjs} +1 -1
  33. package/dist/chunk-4EBC7EMW.cjs +8 -0
  34. package/dist/{chunk-VZY7MAVS.cjs → chunk-4IHMHFQB.cjs} +27 -1
  35. package/dist/{chunk-FK25QSVC.cjs → chunk-4P5634G6.cjs} +2 -2
  36. package/dist/{chunk-4JTQPOKO.cjs → chunk-53ZCZ46B.cjs} +2 -2
  37. package/dist/{chunk-NQJDO7K7.cjs → chunk-545WJ5UG.cjs} +321 -37
  38. package/dist/{chunk-VU3MYZPO.mjs → chunk-5FE5YT2N.mjs} +26 -0
  39. package/dist/{chunk-A5BJKSZE.cjs → chunk-5IQ2ERQA.cjs} +2 -2
  40. package/dist/{chunk-SJRCWF4Z.mjs → chunk-5Y22WNTO.mjs} +2 -2
  41. package/dist/{chunk-U4BJKNIR.cjs → chunk-752XUZIM.cjs} +11 -6
  42. package/dist/{chunk-JBK7UJOI.cjs → chunk-AJB3DHN6.cjs} +2 -2
  43. package/dist/{chunk-YB44NKC2.cjs → chunk-AXVRUDMB.cjs} +2 -2
  44. package/dist/{chunk-LJVNMGE3.mjs → chunk-BM2LH2JM.mjs} +8 -3
  45. package/dist/{chunk-YI6FKTTN.cjs → chunk-BT4SEFLC.cjs} +261 -38
  46. package/dist/{chunk-LIFUPCXW.cjs → chunk-CFG4QERR.cjs} +13 -2
  47. package/dist/{chunk-3OWVWZ6R.cjs → chunk-CLFEQGET.cjs} +6 -6
  48. package/dist/{chunk-OZK2DS44.mjs → chunk-CROAFCMW.mjs} +1 -1
  49. package/dist/{chunk-2KTYMMWT.mjs → chunk-DPE53XWL.mjs} +1 -1
  50. package/dist/{chunk-3PX4AIXO.mjs → chunk-DQF3QLOH.mjs} +258 -35
  51. package/dist/{chunk-FSQMN2MQ.mjs → chunk-E46NXBNJ.mjs} +1 -1
  52. package/dist/{chunk-EGVC4LIG.mjs → chunk-E4RDMG3K.mjs} +1 -1
  53. package/dist/{chunk-X2CZTWQA.mjs → chunk-ECKQFEX2.mjs} +1 -1
  54. package/dist/{chunk-MTWXOEI4.cjs → chunk-EXXFSZOC.cjs} +246 -193
  55. package/dist/{chunk-UYSTTPYJ.cjs → chunk-GGNJAGGE.cjs} +643 -435
  56. package/dist/{chunk-XTG73QZA.cjs → chunk-GVOMPU3Y.cjs} +12 -8
  57. package/dist/{chunk-ZP32GNJQ.cjs → chunk-I32V5CZL.cjs} +14 -13
  58. package/dist/{chunk-37PYUEK5.mjs → chunk-IOF4KXMP.mjs} +7 -3
  59. package/dist/{chunk-ILMTRGBG.mjs → chunk-IQIKPKFP.mjs} +157 -45
  60. package/dist/{chunk-5JNUYGNF.cjs → chunk-IWRLV46X.cjs} +2 -2
  61. package/dist/{chunk-KPOMS5RO.cjs → chunk-J3GFOQOL.cjs} +3 -3
  62. package/dist/{chunk-NHD7BAKD.mjs → chunk-JCEFKP5M.mjs} +41 -25
  63. package/dist/{analyzer-LCSI3NSH.cjs → chunk-JEJQGZI7.cjs} +16 -13
  64. package/dist/{chunk-LB3DPQP6.cjs → chunk-JLDNXURZ.cjs} +23 -23
  65. package/dist/{chunk-VGG74PSU.cjs → chunk-L2JG337G.cjs} +2 -2
  66. package/dist/chunk-L4RTTTVE.mjs +8 -0
  67. package/dist/chunk-LEJDW34D.cjs +115 -0
  68. package/dist/{analyzer-22BEYV7S.mjs → chunk-LVWGURLD.mjs} +6 -3
  69. package/dist/{chunk-Z5A6CNV2.mjs → chunk-MK5E44WP.mjs} +1 -1
  70. package/dist/{chunk-T4EW7AAD.mjs → chunk-NKRZLQUK.mjs} +2 -2
  71. package/dist/{chunk-HPWB57PZ.mjs → chunk-NT3QDN2E.mjs} +1 -1
  72. package/dist/{chunk-T7I62A4C.mjs → chunk-OUWRNHTV.mjs} +81 -28
  73. package/dist/{chunk-GFT5AHAT.mjs → chunk-QDWMCFTH.mjs} +12 -1
  74. package/dist/{chunk-AER5I65K.mjs → chunk-QTD6EMN2.mjs} +1 -1
  75. package/dist/{chunk-UDJY2ZGY.cjs → chunk-RMUD75WT.cjs} +413 -301
  76. package/dist/chunk-RZNCMRD3.mjs +141 -0
  77. package/dist/{chunk-D7LTCK3U.mjs → chunk-SA7MLSP4.mjs} +11 -6
  78. package/dist/{chunk-2FRLSDBT.cjs → chunk-SM25ZC4S.cjs} +1 -1
  79. package/dist/{chunk-3YMLUNL2.cjs → chunk-SVXOCTQ2.cjs} +1 -1
  80. package/dist/{chunk-W2RZ73IU.cjs → chunk-SYXPWJ7N.cjs} +8 -8
  81. package/dist/{chunk-F6Y7ZAPQ.mjs → chunk-T46NNU4D.mjs} +6 -3
  82. package/dist/{chunk-IFHPDLIS.mjs → chunk-TGULJSHD.mjs} +5 -4
  83. package/dist/{chunk-JPIUGDK4.mjs → chunk-TZVUF5JJ.mjs} +1 -1
  84. package/dist/chunk-UWI3SJAK.cjs +141 -0
  85. package/dist/{chunk-JI5D7MXY.mjs → chunk-UYRI6U3P.mjs} +1 -1
  86. package/dist/{chunk-D2X5MUF5.cjs → chunk-V727H3RI.cjs} +47 -31
  87. package/dist/{chunk-ZMHAFH4R.mjs → chunk-VM7X5CKC.mjs} +2 -2
  88. package/dist/{chunk-VPTWKOCY.mjs → chunk-VWW4Q3BJ.mjs} +287 -6
  89. package/dist/{chunk-4P23B7DU.cjs → chunk-WKJQ2FJA.cjs} +3 -3
  90. package/dist/{chunk-HASX6DC7.cjs → chunk-WKPBIT5Q.cjs} +8 -8
  91. package/dist/{chunk-RAWWCDCT.cjs → chunk-WYAXRIYP.cjs} +3 -3
  92. package/dist/{chunk-3TL3AH25.cjs → chunk-X4K7TYN6.cjs} +12 -7
  93. package/dist/chunk-XCXHQBMM.mjs +115 -0
  94. package/dist/{chunk-DPJ66FSI.cjs → chunk-XX32BOMM.cjs} +7 -7
  95. package/dist/{chunk-2IAPKPEB.cjs → chunk-YN6BHOYY.cjs} +6 -6
  96. package/dist/{chunk-CBKRS3M4.cjs → chunk-Z7P2BTZ3.cjs} +7 -6
  97. package/dist/{chunk-SX7EECTS.mjs → chunk-ZBUAOGMY.mjs} +1 -1
  98. package/dist/{chunk-RPUJHJHE.mjs → chunk-ZFWYCVKS.mjs} +4 -3
  99. package/dist/{chunk-IFXSBJPN.cjs → chunk-ZVIEFTUA.cjs} +20 -17
  100. package/dist/{chunk-EXUONJYV.mjs → chunk-ZZI56IUY.mjs} +3 -3
  101. package/dist/{programmatic-routes-client.d-CLG2N1yH.d.ts → client-component.d-Bgt3x5Fu.d.ts} +18 -3
  102. package/dist/{programmatic-routes-client.d-CPbNqtIi.d.mts → client-component.d-BoqC2MLC.d.mts} +18 -3
  103. package/dist/{client-plugins.d-vXrbcfJ1.d.ts → client-plugins.d-BcqIy4au.d.ts} +1 -1
  104. package/dist/{client-plugins.d-CgQQ-EAv.d.mts → client-plugins.d-CWyYBxXf.d.mts} +1 -1
  105. package/dist/client-plugins.d.mts +2 -2
  106. package/dist/client-plugins.d.ts +2 -2
  107. package/dist/client.d.mts +7 -7
  108. package/dist/client.d.ts +7 -7
  109. package/dist/{config.d-DqZkLwef.d.ts → config.d-qt-mE8O5.d.mts} +6 -2
  110. package/dist/{config.d-DqZkLwef.d.mts → config.d-qt-mE8O5.d.ts} +6 -2
  111. package/dist/config.d.mts +2 -2
  112. package/dist/config.d.ts +2 -2
  113. package/dist/cron.cjs +12 -2
  114. package/dist/cron.d.mts +101 -3
  115. package/dist/cron.d.ts +101 -3
  116. package/dist/cron.mjs +11 -1
  117. package/dist/desktop.d.mts +3 -3
  118. package/dist/desktop.d.ts +3 -3
  119. package/dist/{devtools-KQZ6SRCJ.mjs → devtools-NUVXYG7I.mjs} +6 -6
  120. package/dist/{devtools-UF6JYHUN.cjs → devtools-SVRSGPNC.cjs} +8 -8
  121. package/dist/docs.cjs +9 -9
  122. package/dist/docs.d.mts +3 -3
  123. package/dist/docs.d.ts +3 -3
  124. package/dist/docs.mjs +8 -8
  125. package/dist/image/server.cjs +3 -3
  126. package/dist/image/server.mjs +2 -2
  127. package/dist/image/sharp.cjs +10 -10
  128. package/dist/image/sharp.mjs +2 -2
  129. package/dist/index.cjs +42 -27
  130. package/dist/{index.d-Dmfb7Kb_.d.mts → index.d-BDaiu2i5.d.mts} +1 -1
  131. package/dist/{index.d-DlCELfhf.d.ts → index.d-nAncqTXz.d.ts} +1 -1
  132. package/dist/index.d.mts +18 -18
  133. package/dist/index.d.ts +18 -18
  134. package/dist/index.mjs +42 -27
  135. package/dist/integrations.cjs +3 -3
  136. package/dist/integrations.d.mts +2 -2
  137. package/dist/integrations.d.ts +2 -2
  138. package/dist/integrations.mjs +2 -2
  139. package/dist/internal/app-markdown-runtime.d.mts +3 -3
  140. package/dist/internal/app-markdown-runtime.d.ts +3 -3
  141. package/dist/internal/build-runtime.cjs +27 -22
  142. package/dist/internal/build-runtime.d.mts +4 -4
  143. package/dist/internal/build-runtime.d.ts +4 -4
  144. package/dist/internal/build-runtime.mjs +26 -21
  145. package/dist/internal/cli-runtime.cjs +12 -11
  146. package/dist/internal/cli-runtime.mjs +11 -10
  147. package/dist/internal/client-error-overlay.cjs +4 -4
  148. package/dist/internal/client-error-overlay.mjs +1 -1
  149. package/dist/internal/client-runtime.d.mts +5 -5
  150. package/dist/internal/client-runtime.d.ts +5 -5
  151. package/dist/internal/compression-runtime.d.mts +2 -2
  152. package/dist/internal/compression-runtime.d.ts +2 -2
  153. package/dist/internal/config-runtime.cjs +8 -8
  154. package/dist/internal/config-runtime.d.mts +5 -5
  155. package/dist/internal/config-runtime.d.ts +5 -5
  156. package/dist/internal/config-runtime.mjs +7 -7
  157. package/dist/internal/form-actions.cjs +4 -4
  158. package/dist/internal/form-actions.mjs +3 -3
  159. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  160. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  161. package/dist/internal/metadata-image-runtime.cjs +3 -3
  162. package/dist/internal/metadata-image-runtime.mjs +2 -2
  163. package/dist/internal/native-server-fns.cjs +25 -0
  164. package/dist/internal/native-server-fns.d.mts +42 -0
  165. package/dist/internal/native-server-fns.d.ts +42 -0
  166. package/dist/internal/native-server-fns.mjs +25 -0
  167. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  168. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  169. package/dist/internal/production-node-env.cjs +2 -2
  170. package/dist/internal/production-node-env.mjs +1 -1
  171. package/dist/internal/production-runtime.cjs +16 -10
  172. package/dist/internal/production-runtime.d.mts +39 -12
  173. package/dist/internal/production-runtime.d.ts +39 -12
  174. package/dist/internal/production-runtime.mjs +15 -9
  175. package/dist/internal/react-cache.cjs +51 -0
  176. package/dist/internal/react-cache.d.mts +3 -0
  177. package/dist/internal/react-cache.d.ts +3 -0
  178. package/dist/internal/react-cache.mjs +51 -0
  179. package/dist/markdown.d.mts +2 -2
  180. package/dist/markdown.d.ts +2 -2
  181. package/dist/middleware.cjs +3 -3
  182. package/dist/middleware.d.mts +4 -4
  183. package/dist/middleware.d.ts +4 -4
  184. package/dist/middleware.mjs +2 -2
  185. package/dist/mobile.d.mts +10 -4
  186. package/dist/mobile.d.ts +10 -4
  187. package/dist/{modules-VHD7BELU.mjs → modules-KOKD4XS6.mjs} +2 -2
  188. package/dist/modules-QTP7WJPD.cjs +13 -0
  189. package/dist/native-server-fn-handler-GLRHAYWV.mjs +28 -0
  190. package/dist/native-server-fn-handler-J5MYRXN6.cjs +28 -0
  191. package/dist/native-specs-5OLED4MM.cjs +15 -0
  192. package/dist/{native-specs-BD7HOTMJ.mjs → native-specs-LDV6IZ4N.mjs} +1 -1
  193. package/dist/{native-tree-VWNW2MQ2.mjs → native-tree-AS5L3ID3.mjs} +2 -2
  194. package/dist/{native-tree-6G5O53O3.cjs → native-tree-Z2WYUJEV.cjs} +3 -3
  195. package/dist/native.cjs +1 -1
  196. package/dist/native.d.mts +5 -5
  197. package/dist/native.d.ts +5 -5
  198. package/dist/native.mjs +1 -1
  199. package/dist/{navigation-delegate.d-JXx40JzR.d.ts → navigation-delegate.d-BbUHRXxG.d.ts} +1 -1
  200. package/dist/{navigation-delegate.d-CnOTWOyi.d.mts → navigation-delegate.d-CSCm8ZxL.d.mts} +1 -1
  201. package/dist/navigation.d.mts +5 -5
  202. package/dist/navigation.d.ts +5 -5
  203. package/dist/{nitro-FLN6DRGJ.mjs → nitro-DD4QCA66.mjs} +5 -5
  204. package/dist/{nitro-HXAZZQKY.cjs → nitro-VRDX2H4M.cjs} +8 -8
  205. package/dist/plugin.cjs +19 -18
  206. package/dist/plugin.d.mts +5 -5
  207. package/dist/plugin.d.ts +5 -5
  208. package/dist/plugin.mjs +18 -17
  209. package/dist/{port-WOOQ3V56.mjs → port-UFUZL6RI.mjs} +2 -2
  210. package/dist/{port-C6GBH4C6.cjs → port-VTLHPZOI.cjs} +10 -10
  211. package/dist/{production-runtime.d-CP5s6RuY.d.mts → production-runtime.d-CcQiDko5.d.mts} +1 -1
  212. package/dist/{production-runtime.d-N-cE3pmy.d.ts → production-runtime.d-DgT24A0f.d.ts} +1 -1
  213. package/dist/{render-plan.d-DZ-qjjdG.d.mts → render-plan.d-BH9WF-JZ.d.mts} +1 -1
  214. package/dist/{render-plan.d-B9lAP3uX.d.ts → render-plan.d-CyrX6MDs.d.ts} +1 -1
  215. package/dist/renderer-client.d.mts +5 -5
  216. package/dist/renderer-client.d.ts +5 -5
  217. package/dist/{request.d-BiicaNxb.d.ts → request.d-BB8M8bcD.d.ts} +1 -1
  218. package/dist/{request.d-DV0oeUit.d.mts → request.d-CUrPnCW7.d.mts} +1 -1
  219. package/dist/request.d.mts +3 -3
  220. package/dist/request.d.ts +3 -3
  221. package/dist/{route-rendering.d-BrIKA51A.d.mts → route-rendering.d-CYxlzaFm.d.mts} +1 -1
  222. package/dist/{route-rendering.d-Iss0C7GR.d.ts → route-rendering.d-DYqZMIf4.d.ts} +1 -1
  223. package/dist/{router.d-mNTbOGV_.d.mts → router.d-7o24CD8u.d.mts} +1 -1
  224. package/dist/{router.d-DjGn_al7.d.ts → router.d-DaKo507j.d.ts} +1 -1
  225. package/dist/{routes.d-BKSjHuH9.d.ts → routes.d-BknKQcTu.d.ts} +7 -1
  226. package/dist/{routes.d-qd8Qf4LG.d.mts → routes.d-D1IrO9KK.d.mts} +7 -1
  227. package/dist/routes.d.mts +2 -2
  228. package/dist/routes.d.ts +2 -2
  229. package/dist/{rsc-pipeline-SVLBTY7H.cjs → rsc-pipeline-OF2I7PCX.cjs} +8 -8
  230. package/dist/{rsc-pipeline-WBLBDQXA.mjs → rsc-pipeline-RFLHDAKD.mjs} +7 -7
  231. package/dist/{runtime-DGUOWSMF.cjs → runtime-LBTK62AD.cjs} +70 -47
  232. package/dist/{runtime-HFZTVNFF.mjs → runtime-M6UJCSLA.mjs} +38 -15
  233. package/dist/{runtime.d-Bm_4hP5T.d.ts → runtime.d-CN73a-IL.d.ts} +1 -1
  234. package/dist/{runtime.d-BNVbojF1.d.mts → runtime.d-CcNuzhX6.d.mts} +1 -1
  235. package/dist/server-action-security.cjs +3 -3
  236. package/dist/server-action-security.mjs +2 -2
  237. package/dist/server-fn.cjs +4 -4
  238. package/dist/server-fn.mjs +3 -3
  239. package/dist/server-plugins.d.mts +3 -3
  240. package/dist/server-plugins.d.ts +3 -3
  241. package/dist/server-query.cjs +5 -5
  242. package/dist/server-query.mjs +4 -4
  243. package/dist/server.cjs +38 -37
  244. package/dist/server.d.mts +10 -10
  245. package/dist/server.d.ts +10 -10
  246. package/dist/server.mjs +23 -22
  247. package/dist/{spa-router.d-DHDoXxDE.d.mts → spa-router.d-CNi77LZm.d.mts} +2 -2
  248. package/dist/{spa-router.d-DAtnNoBe.d.ts → spa-router.d-Cvgf5QP4.d.ts} +2 -2
  249. package/dist/testing.cjs +6 -6
  250. package/dist/testing.d.mts +2 -2
  251. package/dist/testing.d.ts +2 -2
  252. package/dist/testing.mjs +4 -4
  253. package/dist/{utils.d-DwZ-KLSB.d.ts → utils.d-C3H-14_Y.d.ts} +1 -1
  254. package/dist/{utils.d-uKZcKJk4.d.mts → utils.d-D8VfzZYn.d.mts} +1 -1
  255. package/dist/version.cjs +2 -2
  256. package/dist/version.mjs +1 -1
  257. package/dist/vite.cjs +21 -18
  258. package/dist/vite.d.mts +5 -5
  259. package/dist/vite.d.ts +5 -5
  260. package/dist/vite.mjs +20 -17
  261. package/dist/workflows.cjs +3 -3
  262. package/dist/workflows.mjs +2 -2
  263. package/package.json +12 -2
  264. package/dist/modules-WT5D3AWY.cjs +0 -13
  265. package/dist/native-specs-IQQRJOOW.cjs +0 -15
@@ -0,0 +1,141 @@
1
+ import {
2
+ readAliases,
3
+ resolveFile
4
+ } from "./chunk-LVWGURLD.mjs";
5
+ import {
6
+ transformFarmServerFns
7
+ } from "./chunk-GNZIAJGB.mjs";
8
+
9
+ // src/mobile/native-server-fns.ts
10
+ import { createHash } from "crypto";
11
+ import { readdirSync, readFileSync, realpathSync } from "fs";
12
+ import path from "path";
13
+ var SCRIPT = /\.(?:tsx|ts|jsx|js|mjs)$/;
14
+ var NATIVE_SCREEN = /^(?:page|layout)\.(?:native|android|ios)\.(?:tsx|ts|jsx|js)$/;
15
+ var IMPORT_SPECIFIERS = /(?:^|[^\w$.])(?:import|export)\s*(?:type\s+)?(?:[\w$*{}\s,]+\s+from\s*)?["']([^"']+)["']|import\(\s*["']([^"']+)["']\s*\)/g;
16
+ function posix(file) {
17
+ return file.split(path.sep).join("/");
18
+ }
19
+ function real(file) {
20
+ try {
21
+ return realpathSync(file);
22
+ } catch {
23
+ return file;
24
+ }
25
+ }
26
+ function farmNativeServerFnId(root, file, exportName) {
27
+ const relative = posix(path.relative(real(root), real(file)));
28
+ return createHash("sha256").update(`${relative}#${exportName}`).digest("base64url").slice(0, 20);
29
+ }
30
+ function describeFarmNativeServerFnModule(root, file, code) {
31
+ if (!code.includes("createServerFn") && !code.includes("createServerQuery")) return void 0;
32
+ let analysis;
33
+ try {
34
+ analysis = transformFarmServerFns(code, file, { environment: "client" });
35
+ } catch (error) {
36
+ const named = new Error(`${file}: ${error instanceof Error ? error.message : String(error)}`);
37
+ named.cause = error;
38
+ throw named;
39
+ }
40
+ if (!analysis || analysis.exports.length === 0) return void 0;
41
+ return {
42
+ file,
43
+ exports: analysis.exports.map((name) => ({ name, id: farmNativeServerFnId(root, file, name) }))
44
+ };
45
+ }
46
+ function findFarmNativeScreenFiles(appDirs) {
47
+ const files = [];
48
+ const visit = (dir) => {
49
+ let entries;
50
+ try {
51
+ entries = readdirSync(dir, { withFileTypes: true });
52
+ } catch {
53
+ return;
54
+ }
55
+ for (const entry of entries) {
56
+ if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
57
+ const file = path.join(dir, entry.name);
58
+ if (entry.isDirectory()) visit(file);
59
+ else if (NATIVE_SCREEN.test(entry.name)) files.push(file);
60
+ }
61
+ };
62
+ for (const dir of appDirs) visit(dir);
63
+ return files.sort();
64
+ }
65
+ function collectFarmNativeServerFns(options) {
66
+ const { root, srcDir } = options;
67
+ const aliases = readAliases(root, srcDir);
68
+ const seen = /* @__PURE__ */ new Set();
69
+ const found = /* @__PURE__ */ new Map();
70
+ const queue = [...options.entries];
71
+ while (queue.length > 0) {
72
+ const file = queue.pop();
73
+ if (seen.has(file)) continue;
74
+ seen.add(file);
75
+ let code;
76
+ try {
77
+ code = readFileSync(file, "utf8");
78
+ } catch {
79
+ continue;
80
+ }
81
+ const module = describeFarmNativeServerFnModule(root, file, code);
82
+ if (module) {
83
+ found.set(file, module);
84
+ continue;
85
+ }
86
+ for (const match of code.matchAll(IMPORT_SPECIFIERS)) {
87
+ const specifier = match[1] ?? match[2];
88
+ let candidates;
89
+ if (specifier.startsWith(".")) candidates = [path.resolve(path.dirname(file), specifier)];
90
+ else {
91
+ const alias = aliases.find(
92
+ (entry) => specifier.startsWith(entry.prefix) || specifier === entry.prefix.replace(/\/$/, "")
93
+ );
94
+ if (alias) {
95
+ candidates = alias.targets.map(
96
+ (target) => path.join(target, specifier.slice(alias.prefix.length))
97
+ );
98
+ }
99
+ }
100
+ for (const candidate of candidates ?? []) {
101
+ const resolved = resolveFile(candidate);
102
+ if (resolved && SCRIPT.test(resolved) && !resolved.includes(`${path.sep}node_modules${path.sep}`)) {
103
+ queue.push(resolved);
104
+ break;
105
+ }
106
+ }
107
+ }
108
+ }
109
+ return [...found.values()].sort((left, right) => left.file < right.file ? -1 : 1);
110
+ }
111
+ var FARM_DEV_SERVER_MODULE_LOADER = /* @__PURE__ */ Symbol.for("farm.dev.loadServerModule");
112
+ function createFarmDevNativeServerFnResolver(options) {
113
+ return async (id) => {
114
+ const modules = collectFarmNativeServerFns({
115
+ root: options.root,
116
+ srcDir: options.srcDir,
117
+ entries: findFarmNativeScreenFiles(options.appDirs())
118
+ });
119
+ for (const module of modules) {
120
+ const entry = module.exports.find((candidate) => candidate.id === id);
121
+ if (!entry) continue;
122
+ const load = globalThis[FARM_DEV_SERVER_MODULE_LOADER];
123
+ if (!load) {
124
+ throw new Error(
125
+ "Native server function calls need the Farm dev server or a production build."
126
+ );
127
+ }
128
+ return (await load(module.file))[entry.name];
129
+ }
130
+ return void 0;
131
+ };
132
+ }
133
+
134
+ export {
135
+ farmNativeServerFnId,
136
+ describeFarmNativeServerFnModule,
137
+ findFarmNativeScreenFiles,
138
+ collectFarmNativeServerFns,
139
+ FARM_DEV_SERVER_MODULE_LOADER,
140
+ createFarmDevNativeServerFnResolver
141
+ };
@@ -180,15 +180,20 @@ async function scanRoutePatterns(options) {
180
180
  }
181
181
  }
182
182
  if (!options.platformFiles) return { pages, modules };
183
+ const nativeOnlyPages = /* @__PURE__ */ new Set();
183
184
  for (const [pattern, files] of nativePages) {
184
- if (!pages.has(pattern)) {
185
- const file = path.relative(root, Object.values(files)[0]);
186
- throw new Error(
187
- `${file.replace(/\\/g, "/")} has no web page next to it. Add ${path.join(path.dirname(file), "page.tsx").replace(/\\/g, "/")}: it is the route's web screen and the fallback on every platform.`
188
- );
185
+ if (pages.has(pattern)) continue;
186
+ if (files.native) {
187
+ nativeOnlyPages.add(pattern);
188
+ continue;
189
189
  }
190
+ const file = path.relative(root, Object.values(files)[0]);
191
+ const dir = path.dirname(file);
192
+ throw new Error(
193
+ `${file.replace(/\\/g, "/")} has no web page next to it. Add ${path.join(dir, "page.tsx").replace(/\\/g, "/")} (the route's web screen and fallback), or ${path.join(dir, "page.native.tsx").replace(/\\/g, "/")} to make the route native-only on both OSes.`
194
+ );
190
195
  }
191
- return { pages, modules, pageFiles, nativePages, nativeLayouts };
196
+ return { pages, modules, pageFiles, nativePages, nativeLayouts, nativeOnlyPages };
192
197
  }
193
198
  function scanPlatformRouteFiles(appDir, files, nativePages, nativeLayouts) {
194
199
  const seen = /* @__PURE__ */ new Map();
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var version = "0.1.60";
2
+ var version = "0.1.62";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -233,7 +233,7 @@ ${body}
233
233
  return `/**
234
234
  * Auto-generated from the Codegen specs in src/native: native.<module> from @farm.js/core/native.
235
235
  * Web screens reach a module's Promise methods only when mobile.modules.<name>.web is true, and
236
- * only inside the Android shell; check native.<module>.available() first.
236
+ * only inside the mobile shell; check native.<module>.available() first.
237
237
  */
238
238
  declare module "@farm.js/core/native" {
239
239
  interface FarmNativeModules {
@@ -17,7 +17,7 @@ var _chunkKORZ6PREcjs = require('./chunk-KORZ6PRE.cjs');
17
17
 
18
18
 
19
19
 
20
- var _chunkCBKRS3M4cjs = require('./chunk-CBKRS3M4.cjs');
20
+ var _chunkZ7P2BTZ3cjs = require('./chunk-Z7P2BTZ3.cjs');
21
21
 
22
22
 
23
23
  var _chunkJXIYH2NOcjs = require('./chunk-JXIYH2NO.cjs');
@@ -99,7 +99,7 @@ var APIRouteManager = class {
99
99
  await this.loadProgrammaticApiRoutes(appDir);
100
100
  }
101
101
  this.routes = new Map(
102
- _chunkCBKRS3M4cjs.mergePluginAPIRoutes.call(void 0, [...this.routes.values()], this.plugins, void 0, {
102
+ _chunkZ7P2BTZ3cjs.mergePluginAPIRoutes.call(void 0, [...this.routes.values()], this.plugins, void 0, {
103
103
  bodySizeLimit: this.bodySizeLimit,
104
104
  dispatch: this.dispatch
105
105
  }).map((route) => [route.path, route])
@@ -147,7 +147,7 @@ var APIRouteManager = class {
147
147
  const routeModule = await this.loadModule(filePath);
148
148
  const endpoints = {};
149
149
  const availableMethods = [];
150
- for (const method of _chunkCBKRS3M4cjs.API_ROUTE_METHODS) {
150
+ for (const method of _chunkZ7P2BTZ3cjs.API_ROUTE_METHODS) {
151
151
  if (routeModule[method]) {
152
152
  endpoints[method] = routeModule[method];
153
153
  availableMethods.push(method);
@@ -329,7 +329,7 @@ var APIRouteManager = class {
329
329
  const url = new URL(request.url);
330
330
  const pathname = url.pathname;
331
331
  const method = request.method.toUpperCase();
332
- const match = _chunkCBKRS3M4cjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
332
+ const match = _chunkZ7P2BTZ3cjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
333
333
  if (!match) {
334
334
  return new Response(JSON.stringify({ error: "Not Found" }), {
335
335
  status: 404,
@@ -337,19 +337,19 @@ var APIRouteManager = class {
337
337
  });
338
338
  }
339
339
  const { route, params } = match;
340
- const endpoint = _chunkCBKRS3M4cjs.resolveAPIRouteEndpoint.call(void 0, route, method);
340
+ const endpoint = _chunkZ7P2BTZ3cjs.resolveAPIRouteEndpoint.call(void 0, route, method);
341
341
  if (!endpoint) {
342
342
  return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
343
343
  status: 405,
344
344
  headers: {
345
- Allow: _chunkCBKRS3M4cjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
345
+ Allow: _chunkZ7P2BTZ3cjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
346
346
  "Content-Type": "application/json"
347
347
  }
348
348
  });
349
349
  }
350
350
  const invoke = async () => {
351
351
  try {
352
- return await _chunkCBKRS3M4cjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, this.bodySizeLimit);
352
+ return await _chunkZ7P2BTZ3cjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, this.bodySizeLimit);
353
353
  } catch (error) {
354
354
  if (options.throwOnError) throw error;
355
355
  console.error(`[API Error] ${pathname}:`, error);
@@ -371,7 +371,7 @@ var APIRouteManager = class {
371
371
  return Boolean(this.matchRoute(pathname));
372
372
  }
373
373
  matchRoute(pathname) {
374
- return _chunkCBKRS3M4cjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
374
+ return _chunkZ7P2BTZ3cjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
375
375
  }
376
376
  /**
377
377
  * Get all routes for client type generation
@@ -5,18 +5,21 @@ import {
5
5
  loadFarmDocsPage,
6
6
  resolveFarmDocsContentDir,
7
7
  toFarmDocsMarkdownPage
8
- } from "./chunk-2KTYMMWT.mjs";
8
+ } from "./chunk-DPE53XWL.mjs";
9
9
  import {
10
10
  docsEngine,
11
11
  loadFarmDocsEngine
12
12
  } from "./chunk-VE3FWJBO.mjs";
13
13
  import {
14
14
  resolveDocsConfig
15
- } from "./chunk-VPTWKOCY.mjs";
15
+ } from "./chunk-VWW4Q3BJ.mjs";
16
16
  import {
17
17
  getFarmDocsAdapterConfigModule,
18
18
  isSecretDocsConfigKey
19
19
  } from "./chunk-EJCVG25Z.mjs";
20
+ import {
21
+ cloneFarmRequest
22
+ } from "./chunk-QDWMCFTH.mjs";
20
23
 
21
24
  // src/docs/adapter.ts
22
25
  import { createRequire } from "module";
@@ -241,7 +244,7 @@ function isDocsCloudAction(action) {
241
244
  }
242
245
  async function readJson(request) {
243
246
  try {
244
- return await request.clone().json();
247
+ return await cloneFarmRequest(request).json();
245
248
  } catch {
246
249
  return void 0;
247
250
  }
@@ -22,11 +22,12 @@ import {
22
22
  } from "./chunk-CO6UYM2D.mjs";
23
23
  import {
24
24
  bufferFarmRequestBody,
25
+ cloneFarmRequest,
25
26
  createFarmRequestBodyErrorResponse,
26
27
  readNodeRequestBody,
27
28
  resolveFarmServerConfig,
28
29
  withFarmRequestClientAddress
29
- } from "./chunk-GFT5AHAT.mjs";
30
+ } from "./chunk-QDWMCFTH.mjs";
30
31
  import {
31
32
  clearRequestContext,
32
33
  deleteRequestContext,
@@ -1320,10 +1321,10 @@ async function readIntegrationValidationBody(request, format) {
1320
1321
  if (format === "form") {
1321
1322
  return {
1322
1323
  success: true,
1323
- data: createFormInput(await request.clone().formData())
1324
+ data: createFormInput(await cloneFarmRequest(request).formData())
1324
1325
  };
1325
1326
  }
1326
- const text = await request.clone().text();
1327
+ const text = await cloneFarmRequest(request).text();
1327
1328
  if (text.trim().length === 0) {
1328
1329
  return {
1329
1330
  success: true,
@@ -1771,7 +1772,7 @@ async function dispatchIntegrationRequests(integrations, runtime, request, optio
1771
1772
  { ...runtime, integration },
1772
1773
  // Each dispatch buffers the body it is given, so hand every integration
1773
1774
  // its own clone rather than a Request another dispatch already read.
1774
- request.clone(),
1775
+ cloneFarmRequest(request),
1775
1776
  {
1776
1777
  currentRequest: options.currentRequest,
1777
1778
  ranMiddleware: options.ranMiddleware,
@@ -15,7 +15,7 @@ import {
15
15
  createFarmRequestBodyErrorResponse,
16
16
  readFarmRequestBody,
17
17
  resolveFarmServerConfig
18
- } from "./chunk-GFT5AHAT.mjs";
18
+ } from "./chunk-QDWMCFTH.mjs";
19
19
  import {
20
20
  validateConfigRouteSource
21
21
  } from "./chunk-ONG4RDW3.mjs";
@@ -0,0 +1,141 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+
4
+ var _chunkJEJQGZI7cjs = require('./chunk-JEJQGZI7.cjs');
5
+
6
+
7
+ var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
8
+
9
+ // src/mobile/native-server-fns.ts
10
+ var _crypto = require('crypto');
11
+ var _fs = require('fs');
12
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
13
+ var SCRIPT = /\.(?:tsx|ts|jsx|js|mjs)$/;
14
+ var NATIVE_SCREEN = /^(?:page|layout)\.(?:native|android|ios)\.(?:tsx|ts|jsx|js)$/;
15
+ var IMPORT_SPECIFIERS = /(?:^|[^\w$.])(?:import|export)\s*(?:type\s+)?(?:[\w$*{}\s,]+\s+from\s*)?["']([^"']+)["']|import\(\s*["']([^"']+)["']\s*\)/g;
16
+ function posix(file) {
17
+ return file.split(_path2.default.sep).join("/");
18
+ }
19
+ function real(file) {
20
+ try {
21
+ return _fs.realpathSync.call(void 0, file);
22
+ } catch (e) {
23
+ return file;
24
+ }
25
+ }
26
+ function farmNativeServerFnId(root, file, exportName) {
27
+ const relative = posix(_path2.default.relative(real(root), real(file)));
28
+ return _crypto.createHash.call(void 0, "sha256").update(`${relative}#${exportName}`).digest("base64url").slice(0, 20);
29
+ }
30
+ function describeFarmNativeServerFnModule(root, file, code) {
31
+ if (!code.includes("createServerFn") && !code.includes("createServerQuery")) return void 0;
32
+ let analysis;
33
+ try {
34
+ analysis = _chunkPIUTGRDIcjs.transformFarmServerFns.call(void 0, code, file, { environment: "client" });
35
+ } catch (error) {
36
+ const named = new Error(`${file}: ${error instanceof Error ? error.message : String(error)}`);
37
+ named.cause = error;
38
+ throw named;
39
+ }
40
+ if (!analysis || analysis.exports.length === 0) return void 0;
41
+ return {
42
+ file,
43
+ exports: analysis.exports.map((name) => ({ name, id: farmNativeServerFnId(root, file, name) }))
44
+ };
45
+ }
46
+ function findFarmNativeScreenFiles(appDirs) {
47
+ const files = [];
48
+ const visit = (dir) => {
49
+ let entries;
50
+ try {
51
+ entries = _fs.readdirSync.call(void 0, dir, { withFileTypes: true });
52
+ } catch (e2) {
53
+ return;
54
+ }
55
+ for (const entry of entries) {
56
+ if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
57
+ const file = _path2.default.join(dir, entry.name);
58
+ if (entry.isDirectory()) visit(file);
59
+ else if (NATIVE_SCREEN.test(entry.name)) files.push(file);
60
+ }
61
+ };
62
+ for (const dir of appDirs) visit(dir);
63
+ return files.sort();
64
+ }
65
+ function collectFarmNativeServerFns(options) {
66
+ const { root, srcDir } = options;
67
+ const aliases = _chunkJEJQGZI7cjs.readAliases.call(void 0, root, srcDir);
68
+ const seen = /* @__PURE__ */ new Set();
69
+ const found = /* @__PURE__ */ new Map();
70
+ const queue = [...options.entries];
71
+ while (queue.length > 0) {
72
+ const file = queue.pop();
73
+ if (seen.has(file)) continue;
74
+ seen.add(file);
75
+ let code;
76
+ try {
77
+ code = _fs.readFileSync.call(void 0, file, "utf8");
78
+ } catch (e3) {
79
+ continue;
80
+ }
81
+ const module = describeFarmNativeServerFnModule(root, file, code);
82
+ if (module) {
83
+ found.set(file, module);
84
+ continue;
85
+ }
86
+ for (const match of code.matchAll(IMPORT_SPECIFIERS)) {
87
+ const specifier = _nullishCoalesce(match[1], () => ( match[2]));
88
+ let candidates;
89
+ if (specifier.startsWith(".")) candidates = [_path2.default.resolve(_path2.default.dirname(file), specifier)];
90
+ else {
91
+ const alias = aliases.find(
92
+ (entry) => specifier.startsWith(entry.prefix) || specifier === entry.prefix.replace(/\/$/, "")
93
+ );
94
+ if (alias) {
95
+ candidates = alias.targets.map(
96
+ (target) => _path2.default.join(target, specifier.slice(alias.prefix.length))
97
+ );
98
+ }
99
+ }
100
+ for (const candidate of _nullishCoalesce(candidates, () => ( []))) {
101
+ const resolved = _chunkJEJQGZI7cjs.resolveFile.call(void 0, candidate);
102
+ if (resolved && SCRIPT.test(resolved) && !resolved.includes(`${_path2.default.sep}node_modules${_path2.default.sep}`)) {
103
+ queue.push(resolved);
104
+ break;
105
+ }
106
+ }
107
+ }
108
+ }
109
+ return [...found.values()].sort((left, right) => left.file < right.file ? -1 : 1);
110
+ }
111
+ var FARM_DEV_SERVER_MODULE_LOADER = /* @__PURE__ */ Symbol.for("farm.dev.loadServerModule");
112
+ function createFarmDevNativeServerFnResolver(options) {
113
+ return async (id) => {
114
+ const modules = collectFarmNativeServerFns({
115
+ root: options.root,
116
+ srcDir: options.srcDir,
117
+ entries: findFarmNativeScreenFiles(options.appDirs())
118
+ });
119
+ for (const module of modules) {
120
+ const entry = module.exports.find((candidate) => candidate.id === id);
121
+ if (!entry) continue;
122
+ const load = globalThis[FARM_DEV_SERVER_MODULE_LOADER];
123
+ if (!load) {
124
+ throw new Error(
125
+ "Native server function calls need the Farm dev server or a production build."
126
+ );
127
+ }
128
+ return (await load(module.file))[entry.name];
129
+ }
130
+ return void 0;
131
+ };
132
+ }
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ exports.farmNativeServerFnId = farmNativeServerFnId; exports.describeFarmNativeServerFnModule = describeFarmNativeServerFnModule; exports.findFarmNativeScreenFiles = findFarmNativeScreenFiles; exports.collectFarmNativeServerFns = collectFarmNativeServerFns; exports.FARM_DEV_SERVER_MODULE_LOADER = FARM_DEV_SERVER_MODULE_LOADER; exports.createFarmDevNativeServerFnResolver = createFarmDevNativeServerFnResolver;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  _withFarmGuardedResponseCache
3
- } from "./chunk-EGVC4LIG.mjs";
3
+ } from "./chunk-E4RDMG3K.mjs";
4
4
  import {
5
5
  _markFarmOwnedResponse,
6
6
  _withFarmResponseHeaders
@@ -926,17 +926,50 @@ function splitFarmCssDeclarations(css) {
926
926
  push(css.length);
927
927
  return out;
928
928
  }
929
- function resolveFarmNativeInlineStyle(css) {
929
+ function substituteFarmNativeVars(value, vars, depth = 0) {
930
+ if (!value.includes("var(")) return value;
931
+ if (depth > 8) return void 0;
932
+ let missing = false;
933
+ const replaced = value.replace(
934
+ /var\(\s*(--[\w-]+)\s*(?:,\s*([^()]*(?:\([^()]*\))?[^()]*))?\)/g,
935
+ (_, name, fallback) => {
936
+ const resolved = _nullishCoalesce(vars[name], () => ( _optionalChain([fallback, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()])));
937
+ if (resolved === void 0) {
938
+ missing = true;
939
+ return "";
940
+ }
941
+ return resolved;
942
+ }
943
+ );
944
+ return missing ? void 0 : substituteFarmNativeVars(replaced, vars, depth + 1);
945
+ }
946
+ function resolveFarmNativeInlineStyle(css, vars = {
947
+ light: {},
948
+ dark: {}
949
+ }) {
930
950
  const style = {};
951
+ const dark = {};
931
952
  const unsupported = [];
953
+ const themes = [
954
+ [style, vars.light],
955
+ [dark, { ...vars.light, ...vars.dark }]
956
+ ];
932
957
  for (const [property, raw] of splitFarmCssDeclarations(css)) {
933
- const value = raw.toLowerCase();
934
958
  if (!property) continue;
935
- const resolved = resolveFarmNativeDeclaration(property, value);
936
- if (resolved) Object.assign(style, resolved);
937
- else if (resolved === void 0) unsupported.push(`${property}: ${value}`);
959
+ for (const [target, themeVars] of themes) {
960
+ const value = _optionalChain([substituteFarmNativeVars, 'call', _7 => _7(raw, themeVars), 'optionalAccess', _8 => _8.toLowerCase, 'call', _9 => _9()]);
961
+ const resolved = value === void 0 ? void 0 : resolveFarmNativeDeclaration(property, value);
962
+ if (resolved === void 0) {
963
+ unsupported.push(`${property}: ${raw.toLowerCase()}`);
964
+ break;
965
+ }
966
+ if (resolved) Object.assign(target, resolved);
967
+ }
968
+ }
969
+ for (const key of Object.keys(dark)) {
970
+ if (dark[key] === style[key]) delete dark[key];
938
971
  }
939
- return { style, unsupported };
972
+ return { style, dark, unsupported };
940
973
  }
941
974
  function oklchToHex(value) {
942
975
  const match = /^oklch\(\s*([\d.]+)(%?)\s+([\d.]+)\s+([\d.]+|none)(?:deg)?\s*(?:\/\s*([\d.]+)(%?))?\s*\)$/.exec(
@@ -1052,7 +1085,7 @@ function createFarmNativeTheme(declarations, vars = {
1052
1085
  const px = light === void 0 ? void 0 : themeLength(light);
1053
1086
  const key = name.slice(5);
1054
1087
  if (px === void 0) delete theme.text[key];
1055
- else theme.text[key] = [px, _nullishCoalesce(_optionalChain([theme, 'access', _5 => _5.text, 'access', _6 => _6[key], 'optionalAccess', _7 => _7[1]]), () => ( Number.NaN))];
1088
+ else theme.text[key] = [px, _nullishCoalesce(_optionalChain([theme, 'access', _10 => _10.text, 'access', _11 => _11[key], 'optionalAccess', _12 => _12[1]]), () => ( Number.NaN))];
1056
1089
  continue;
1057
1090
  }
1058
1091
  const numeric = [
@@ -1218,12 +1251,12 @@ function parseFarmNativeStylesheet(css) {
1218
1251
  for (const text2 of splitList(prelude)) {
1219
1252
  const selector = parseSelector(text2);
1220
1253
  if (selector === null) continue;
1221
- const subject = _optionalChain([selector, 'optionalAccess', _8 => _8.steps, 'access', _9 => _9[0], 'access', _10 => _10.compound]);
1254
+ const subject = _optionalChain([selector, 'optionalAccess', _13 => _13.steps, 'access', _14 => _14[0], 'access', _15 => _15.compound]);
1222
1255
  if (context.layered) {
1223
- for (const name of _nullishCoalesce(_optionalChain([subject, 'optionalAccess', _11 => _11.classes]), () => ( []))) sheet.layered.add(name);
1256
+ for (const name of _nullishCoalesce(_optionalChain([subject, 'optionalAccess', _16 => _16.classes]), () => ( []))) sheet.layered.add(name);
1224
1257
  continue;
1225
1258
  }
1226
- if (selector && selector.steps.length === 1 && _optionalChain([subject, 'optionalAccess', _12 => _12.tag]) === "html" && !subject.classes.length) {
1259
+ if (selector && selector.steps.length === 1 && _optionalChain([subject, 'optionalAccess', _17 => _17.tag]) === "html" && !subject.classes.length) {
1227
1260
  for (const [property, value] of declarations) {
1228
1261
  if (property.startsWith("--")) {
1229
1262
  (context.dark ? sheet.vars.dark : sheet.vars.light)[property] = value;
@@ -1233,8 +1266,8 @@ function parseFarmNativeStylesheet(css) {
1233
1266
  if (!selector || context.unknownMedia || applies) {
1234
1267
  const fallback = /(?:^|[\s>+~])([a-zA-Z][\w-]*)?((?:[.#:[][^\s>+~]*)?)$/.exec(text2);
1235
1268
  sheet.unknown.push({
1236
- classes: [...(_nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _13 => _13[2]]), () => ( ""))).matchAll(/\.([\w-]+)/g)].map((match) => match[1]),
1237
- tag: _optionalChain([fallback, 'optionalAccess', _14 => _14[1], 'optionalAccess', _15 => _15.toLowerCase, 'call', _16 => _16()]),
1269
+ classes: [...(_nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _18 => _18[2]]), () => ( ""))).matchAll(/\.([\w-]+)/g)].map((match) => match[1]),
1270
+ tag: _optionalChain([fallback, 'optionalAccess', _19 => _19[1], 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]),
1238
1271
  text: context.unknownMedia ? `${context.unknownMedia} ${text2}` : applies ? `${text2} { @apply }` : text2
1239
1272
  });
1240
1273
  continue;
@@ -1302,23 +1335,6 @@ function matches(selector, element) {
1302
1335
  };
1303
1336
  return step(0, element);
1304
1337
  }
1305
- function substitute(value, vars, depth = 0) {
1306
- if (!value.includes("var(")) return value;
1307
- if (depth > 8) return void 0;
1308
- let missing = false;
1309
- const replaced = value.replace(
1310
- /var\(\s*(--[\w-]+)\s*(?:,\s*([^()]*(?:\([^()]*\))?[^()]*))?\)/g,
1311
- (_, name, fallback) => {
1312
- const resolved = _nullishCoalesce(vars[name], () => ( _optionalChain([fallback, 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()])));
1313
- if (resolved === void 0) {
1314
- missing = true;
1315
- return "";
1316
- }
1317
- return resolved;
1318
- }
1319
- );
1320
- return missing ? void 0 : substitute(replaced, vars, depth + 1);
1321
- }
1322
1338
  function cascadeFarmNativeStylesheets(sheets, element) {
1323
1339
  const style = {};
1324
1340
  const dark = {};
@@ -1342,7 +1358,7 @@ function cascadeFarmNativeStylesheets(sheets, element) {
1342
1358
  const themes = rule.dark ? [dark] : [style, dark];
1343
1359
  for (const target of themes) {
1344
1360
  const vars = target === dark ? { ...sheet.vars.light, ...sheet.vars.dark } : sheet.vars.light;
1345
- const value = substitute(raw, vars);
1361
+ const value = substituteFarmNativeVars(raw, vars);
1346
1362
  const resolved = value === void 0 ? void 0 : resolveFarmNativeDeclaration(property, value.toLowerCase().trim());
1347
1363
  if (resolved === void 0) {
1348
1364
  const message = `${property}: ${raw}`;
@@ -1369,7 +1385,7 @@ function inspectFarmNativeStylesheets(sheets, target) {
1369
1385
  styled = true;
1370
1386
  for (const [property, raw] of rule.declarations) {
1371
1387
  for (const vars of [sheet.vars.light, { ...sheet.vars.light, ...sheet.vars.dark }]) {
1372
- const value = substitute(raw, vars);
1388
+ const value = substituteFarmNativeVars(raw, vars);
1373
1389
  if (value === void 0 || resolveFarmNativeDeclaration(property, value.toLowerCase().trim()) === void 0) {
1374
1390
  const message = `"${rule.text} { ${property}: ${raw} }" has no native-tier style`;
1375
1391
  if (!problems.includes(message)) problems.push(message);
@@ -20,10 +20,10 @@ import {
20
20
  import {
21
21
  createFarmWeakETag,
22
22
  matchesFarmIfNoneMatch
23
- } from "./chunk-GFT5AHAT.mjs";
23
+ } from "./chunk-QDWMCFTH.mjs";
24
24
  import {
25
25
  FARM_VERSION
26
- } from "./chunk-HPWB57PZ.mjs";
26
+ } from "./chunk-NT3QDN2E.mjs";
27
27
  import {
28
28
  applyFarmBasePath
29
29
  } from "./chunk-SF3JB56B.mjs";