@farm.js/core 0.1.49 → 0.1.50

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 (310) hide show
  1. package/dist/{agent-mcp-Bb8hnnqd.d.ts → agent-mcp-9BMbRgg_.d.ts} +1 -1
  2. package/dist/{agent-mcp-ir3v4fHf.d.mts → agent-mcp-CIMH324y.d.mts} +1 -1
  3. package/dist/agent-runtime.cjs +3 -3
  4. package/dist/agent-runtime.d.mts +6 -6
  5. package/dist/agent-runtime.d.ts +6 -6
  6. package/dist/agent-runtime.mjs +2 -2
  7. package/dist/analyzer-CN7C74WX.cjs +1066 -0
  8. package/dist/analyzer-DDW34OMC.mjs +1066 -0
  9. package/dist/api/client.d.mts +0 -1
  10. package/dist/api/client.d.ts +0 -1
  11. package/dist/api/route-manager.cjs +5 -5
  12. package/dist/api/route-manager.d.mts +10 -10
  13. package/dist/api/route-manager.d.ts +10 -10
  14. package/dist/api/route-manager.mjs +4 -4
  15. package/dist/api/runtime.cjs +3 -3
  16. package/dist/api/runtime.d.mts +7 -7
  17. package/dist/api/runtime.d.ts +7 -7
  18. package/dist/api/runtime.mjs +2 -2
  19. package/dist/api.cjs +6 -6
  20. package/dist/api.d.mts +10 -10
  21. package/dist/api.d.ts +10 -10
  22. package/dist/api.mjs +5 -5
  23. package/dist/{app-y649szYm.d.ts → app-BWibTHVT.d.ts} +7 -7
  24. package/dist/{app-DLzz02du.d.mts → app-DVJ13FPA.d.mts} +7 -7
  25. package/dist/{app-manifest-Crn8Qd3U.d.mts → app-manifest-CQDJOKL2.d.mts} +1 -1
  26. package/dist/{app-manifest-DNeTKMRL.d.ts → app-manifest-D0kaXdwu.d.ts} +1 -1
  27. package/dist/app-markdown.d.mts +7 -7
  28. package/dist/app-markdown.d.ts +7 -7
  29. package/dist/cache.d.mts +4 -3
  30. package/dist/cache.d.ts +4 -3
  31. package/dist/{chunk-VJXLUTBM.mjs → chunk-2DEPNLXK.mjs} +7 -7
  32. package/dist/chunk-2G63BIRL.mjs +227 -0
  33. package/dist/chunk-2GLQSIZD.mjs +55 -0
  34. package/dist/{chunk-ACI52TCN.mjs → chunk-2VCC3GVC.mjs} +1 -1
  35. package/dist/chunk-3ATXWZPH.cjs +227 -0
  36. package/dist/{chunk-C5S457CK.cjs → chunk-474FO3UE.cjs} +68 -54
  37. package/dist/{chunk-QNQEK3OF.cjs → chunk-4T25YCZ5.cjs} +14 -14
  38. package/dist/{chunk-ATHPRVP2.mjs → chunk-5V4KZOZO.mjs} +1 -1
  39. package/dist/{chunk-FGJQS4EC.cjs → chunk-6QA2SXVH.cjs} +2 -2
  40. package/dist/{chunk-XLYXG73A.mjs → chunk-75WWOZ5C.mjs} +22 -0
  41. package/dist/{chunk-QFQDRJKJ.mjs → chunk-76R5GJER.mjs} +2 -2
  42. package/dist/{chunk-NG44F7AH.mjs → chunk-7ONZDKVY.mjs} +2 -2
  43. package/dist/{chunk-4IICUBQX.cjs → chunk-A5BJKSZE.cjs} +2 -2
  44. package/dist/{chunk-TTYXOAB7.mjs → chunk-ANHZ6SUL.mjs} +1 -1
  45. package/dist/{chunk-ZBS3GOQZ.cjs → chunk-AQLHD6HZ.cjs} +35 -61
  46. package/dist/{chunk-4HM5B5RR.cjs → chunk-B5S2JS6M.cjs} +117 -115
  47. package/dist/{chunk-AXRNEVCS.cjs → chunk-B6PREBN6.cjs} +8 -8
  48. package/dist/{chunk-JOHXK4BB.mjs → chunk-BW6SCVYX.mjs} +1 -1
  49. package/dist/{chunk-LZBM35DH.mjs → chunk-C73RIAEF.mjs} +4 -4
  50. package/dist/chunk-CGCJ2TJU.cjs +55 -0
  51. package/dist/{chunk-UYQOIPXE.mjs → chunk-CPXDDWGL.mjs} +1 -1
  52. package/dist/{chunk-JPAVNDZH.cjs → chunk-CY7H5KS4.cjs} +25 -25
  53. package/dist/{chunk-4S7M63WX.cjs → chunk-DGOLAZLV.cjs} +22 -1
  54. package/dist/{chunk-73XBJRZW.cjs → chunk-E2BMCNMJ.cjs} +2 -2
  55. package/dist/{chunk-FR4HJDI6.cjs → chunk-F5LERVY3.cjs} +21 -24
  56. package/dist/{chunk-A7DK663W.cjs → chunk-FACTMUPI.cjs} +27 -27
  57. package/dist/chunk-G2KTRMWA.mjs +40 -0
  58. package/dist/{chunk-C6U66WWF.mjs → chunk-GFT5AHAT.mjs} +13 -0
  59. package/dist/{chunk-NPPT4RWF.cjs → chunk-GOOK2J2W.cjs} +7 -7
  60. package/dist/{chunk-NW2BKDVT.mjs → chunk-HHFMECFO.mjs} +1 -1
  61. package/dist/{chunk-J27BZO67.mjs → chunk-HWCHIBJZ.mjs} +21 -24
  62. package/dist/{chunk-HTLCLOXQ.cjs → chunk-HYN3LLG7.cjs} +3 -3
  63. package/dist/{chunk-HELQXYVI.cjs → chunk-I2DQGS56.cjs} +11 -9
  64. package/dist/{chunk-SSNN55Q6.cjs → chunk-IQXGHGZF.cjs} +5 -5
  65. package/dist/{chunk-ZSIGEHSE.cjs → chunk-IUBDMDZZ.cjs} +21 -180
  66. package/dist/{chunk-Z3BXMMFF.mjs → chunk-IWJKJDNW.mjs} +38 -24
  67. package/dist/{chunk-DGVVVYKD.mjs → chunk-JJOWY3XD.mjs} +2 -2
  68. package/dist/{chunk-6XFGJBYX.cjs → chunk-JYNNIGQO.cjs} +16 -7
  69. package/dist/{chunk-XO6WL6NL.mjs → chunk-KGP76FSV.mjs} +1 -1
  70. package/dist/{chunk-GXSMF7UR.mjs → chunk-KO2NWUKN.mjs} +1 -1
  71. package/dist/{chunk-AIHD6VME.cjs → chunk-KZH6YLND.cjs} +154 -126
  72. package/dist/{chunk-5566GNEG.cjs → chunk-LIFUPCXW.cjs} +13 -0
  73. package/dist/{chunk-I2SWKWO7.mjs → chunk-LJDIFIJ2.mjs} +1 -1
  74. package/dist/{chunk-KZT2VHRQ.cjs → chunk-LYWAGXXW.cjs} +11 -11
  75. package/dist/{chunk-RYDDUCNJ.mjs → chunk-M7LKA632.mjs} +1 -1
  76. package/dist/{chunk-6LH33DLL.cjs → chunk-NJVFPJ2Y.cjs} +2 -2
  77. package/dist/{chunk-JWP56HCP.mjs → chunk-OD6WM3I7.mjs} +2 -2
  78. package/dist/{chunk-MJ6IC4K2.mjs → chunk-OTOOJIUB.mjs} +1 -1
  79. package/dist/{chunk-R2SEZEBC.cjs → chunk-OYNNA4DD.cjs} +4 -4
  80. package/dist/{chunk-GBPDSUFE.mjs → chunk-OZK2DS44.mjs} +1 -1
  81. package/dist/chunk-QXJADAQB.cjs +40 -0
  82. package/dist/{chunk-J5VCA45K.cjs → chunk-RHOR2J6V.cjs} +1 -1
  83. package/dist/{chunk-YQGZLCT4.cjs → chunk-RWT2BTJT.cjs} +6 -6
  84. package/dist/{chunk-3HBFI373.cjs → chunk-S5AQ7CAC.cjs} +14 -14
  85. package/dist/{chunk-HNAUK3SC.mjs → chunk-SHJJM6OG.mjs} +40 -199
  86. package/dist/{chunk-LL7TDMOM.mjs → chunk-SMUW7UST.mjs} +33 -59
  87. package/dist/{chunk-VCFBQFOV.mjs → chunk-SN5VSO3Q.mjs} +9 -7
  88. package/dist/{chunk-DM3TFCC2.cjs → chunk-SUV6YO4Q.cjs} +5 -5
  89. package/dist/{chunk-JUMPFVMK.mjs → chunk-TUOO6IK3.mjs} +9 -0
  90. package/dist/chunk-UB7RVEMX.mjs +73 -0
  91. package/dist/{chunk-CDTIXBKN.mjs → chunk-UN6N623E.mjs} +2 -2
  92. package/dist/{chunk-BEXYFR2R.cjs → chunk-UY6HS5PF.cjs} +2 -2
  93. package/dist/{chunk-HAH4FBTA.mjs → chunk-VAHBCI6X.mjs} +1 -1
  94. package/dist/{chunk-N25RPPO5.cjs → chunk-WAPQWAE6.cjs} +10 -10
  95. package/dist/{chunk-Z4LTSH7D.mjs → chunk-WVBUXNBX.mjs} +71 -43
  96. package/dist/{chunk-ALD2WMLA.mjs → chunk-WXHDVXJE.mjs} +2 -2
  97. package/dist/{chunk-EVCQX243.cjs → chunk-X2EL3BLH.cjs} +2 -2
  98. package/dist/{chunk-EA5PMJDU.mjs → chunk-X3HOVNHI.mjs} +1 -1
  99. package/dist/{chunk-XXB37YET.cjs → chunk-XLRLSTJ6.cjs} +7 -7
  100. package/dist/{chunk-DRFADSKY.mjs → chunk-XXXRRVY6.mjs} +4 -4
  101. package/dist/{chunk-EXHEPWFJ.cjs → chunk-YAXOEAND.cjs} +10 -10
  102. package/dist/{chunk-PEHL3IZL.cjs → chunk-YB44NKC2.cjs} +2 -2
  103. package/dist/chunk-YKHRCY4T.cjs +73 -0
  104. package/dist/{chunk-IVHPRF4W.mjs → chunk-ZLOQQ2UF.mjs} +32 -30
  105. package/dist/client/lifecycle.d.mts +1 -1
  106. package/dist/client/lifecycle.d.ts +1 -1
  107. package/dist/{client-plugins-DFDQUI9Q.d.ts → client-plugins-BPfltM5m.d.ts} +15 -8
  108. package/dist/{client-plugins-BNBeyLMi.d.mts → client-plugins-D4RO59f0.d.mts} +15 -8
  109. package/dist/client-plugins.d.mts +6 -6
  110. package/dist/client-plugins.d.ts +6 -6
  111. package/dist/client.cjs +11 -8
  112. package/dist/client.d.mts +11 -10
  113. package/dist/client.d.ts +11 -10
  114. package/dist/client.mjs +12 -9
  115. package/dist/client.react-server.mjs +1 -1
  116. package/dist/config-CnhyvvmT.d.mts +188 -0
  117. package/dist/config-CnhyvvmT.d.ts +188 -0
  118. package/dist/config.d.mts +6 -6
  119. package/dist/config.d.ts +6 -6
  120. package/dist/desktop.d.mts +7 -7
  121. package/dist/desktop.d.ts +7 -7
  122. package/dist/{dev-guard-YO6KPIOQ.mjs → dev-guard-4PFQNXQX.mjs} +2 -1
  123. package/dist/{dev-guard-PLHL6OTJ.cjs → dev-guard-YLO5DE3H.cjs} +4 -3
  124. package/dist/{devtools-A37WWJZL.cjs → devtools-N5XTOECL.cjs} +8 -8
  125. package/dist/{devtools-BLKHPY3C.mjs → devtools-STG7HPRV.mjs} +7 -7
  126. package/dist/docs.cjs +10 -10
  127. package/dist/docs.d.mts +7 -7
  128. package/dist/docs.d.ts +7 -7
  129. package/dist/docs.mjs +9 -9
  130. package/dist/environment/vite.d.mts +1 -1
  131. package/dist/environment/vite.d.ts +1 -1
  132. package/dist/generate-route-types-DQP0cUzk.d.ts +33 -0
  133. package/dist/generate-route-types-TF5Wwtvz.d.mts +33 -0
  134. package/dist/i18n/client.d.mts +2 -2
  135. package/dist/i18n/client.d.ts +2 -2
  136. package/dist/i18n/index.d.mts +3 -3
  137. package/dist/i18n/index.d.ts +3 -3
  138. package/dist/i18n/server.d.mts +5 -5
  139. package/dist/i18n/server.d.ts +5 -5
  140. package/dist/image/server.cjs +3 -3
  141. package/dist/image/server.mjs +2 -2
  142. package/dist/image/sharp.cjs +10 -10
  143. package/dist/image/sharp.mjs +2 -2
  144. package/dist/{index-CeJ9_s9p.d.mts → index-C-N3Pwg-.d.ts} +2 -2
  145. package/dist/{index-MocnSP3a.d.ts → index-D3l4tREW.d.ts} +2 -2
  146. package/dist/{index-Cl3akY5U.d.mts → index-DPUAPho_.d.mts} +2 -2
  147. package/dist/{index-DBdiTkNc.d.ts → index-k8o8eUOd.d.mts} +2 -2
  148. package/dist/index.cjs +72 -65
  149. package/dist/index.d.mts +29 -45
  150. package/dist/index.d.ts +29 -45
  151. package/dist/index.mjs +77 -70
  152. package/dist/integrations.cjs +3 -3
  153. package/dist/integrations.d.mts +6 -6
  154. package/dist/integrations.d.ts +6 -6
  155. package/dist/integrations.mjs +2 -2
  156. package/dist/internal/app-markdown-runtime.d.mts +7 -7
  157. package/dist/internal/app-markdown-runtime.d.ts +7 -7
  158. package/dist/internal/build-runtime.cjs +35 -32
  159. package/dist/internal/build-runtime.d.mts +9 -9
  160. package/dist/internal/build-runtime.d.ts +9 -9
  161. package/dist/internal/build-runtime.mjs +34 -31
  162. package/dist/internal/cli-runtime.cjs +16 -15
  163. package/dist/internal/cli-runtime.mjs +16 -15
  164. package/dist/internal/client-error-overlay.cjs +4 -4
  165. package/dist/internal/client-error-overlay.mjs +1 -1
  166. package/dist/internal/client-runtime.cjs +19 -2
  167. package/dist/internal/client-runtime.d.mts +45 -3
  168. package/dist/internal/client-runtime.d.ts +45 -3
  169. package/dist/internal/client-runtime.mjs +19 -2
  170. package/dist/internal/compression-runtime.d.mts +6 -6
  171. package/dist/internal/compression-runtime.d.ts +6 -6
  172. package/dist/internal/config-runtime.cjs +17 -10
  173. package/dist/internal/config-runtime.d.mts +259 -18
  174. package/dist/internal/config-runtime.d.ts +259 -18
  175. package/dist/internal/config-runtime.mjs +15 -8
  176. package/dist/internal/form-actions.cjs +4 -4
  177. package/dist/internal/form-actions.mjs +3 -3
  178. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  179. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  180. package/dist/internal/metadata-image-runtime.cjs +3 -3
  181. package/dist/internal/metadata-image-runtime.mjs +2 -2
  182. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  183. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  184. package/dist/internal/production-runtime.cjs +12 -12
  185. package/dist/internal/production-runtime.d.mts +19 -19
  186. package/dist/internal/production-runtime.d.ts +19 -19
  187. package/dist/internal/production-runtime.mjs +14 -14
  188. package/dist/{layers-D9fbe-rz.d.ts → layers-CcS42OGR.d.mts} +1 -1
  189. package/dist/{layers-D9fbe-rz.d.mts → layers-CcS42OGR.d.ts} +1 -1
  190. package/dist/{lifecycle-DK06VuKP.d.ts → lifecycle-C2aLBOwu.d.mts} +1 -1
  191. package/dist/{lifecycle-DK06VuKP.d.mts → lifecycle-C2aLBOwu.d.ts} +1 -1
  192. package/dist/markdown.d.mts +6 -6
  193. package/dist/markdown.d.ts +6 -6
  194. package/dist/middleware.cjs +7 -7
  195. package/dist/middleware.d.mts +8 -8
  196. package/dist/middleware.d.ts +8 -8
  197. package/dist/middleware.mjs +6 -6
  198. package/dist/mobile.cjs +9 -0
  199. package/dist/mobile.d.mts +67 -0
  200. package/dist/mobile.d.ts +67 -0
  201. package/dist/mobile.mjs +9 -0
  202. package/dist/navigation-delegate-8xg3Zvp4.d.ts +29 -0
  203. package/dist/navigation-delegate-ji6elCKy.d.mts +29 -0
  204. package/dist/navigation.cjs +5 -5
  205. package/dist/navigation.d.mts +9 -9
  206. package/dist/navigation.d.ts +9 -9
  207. package/dist/navigation.mjs +4 -4
  208. package/dist/{nitro-UT2J5A5D.mjs → nitro-2Q5NVY7L.mjs} +2 -2
  209. package/dist/{nitro-BIXIKJZS.cjs → nitro-YPSZBYDK.cjs} +3 -3
  210. package/dist/platform.cjs +2 -1
  211. package/dist/platform.d.mts +4 -3
  212. package/dist/platform.d.ts +4 -3
  213. package/dist/platform.mjs +2 -1
  214. package/dist/{plugin-4KYXV7BB.mjs → plugin-53SY5YBS.mjs} +1 -1
  215. package/dist/{plugin-WBANOZQM.cjs → plugin-HZIBL3DW.cjs} +2 -2
  216. package/dist/plugin.cjs +30 -28
  217. package/dist/plugin.d.mts +13 -8
  218. package/dist/plugin.d.ts +13 -8
  219. package/dist/plugin.mjs +29 -27
  220. package/dist/{production-runtime-DcD-GRAv.d.mts → production-runtime-DXnQQkQf.d.mts} +3 -3
  221. package/dist/{production-runtime-B3qFFtKF.d.ts → production-runtime-TdKaYRj0.d.ts} +3 -3
  222. package/dist/production-vite-BQFAlG7n.d.mts +13 -0
  223. package/dist/production-vite-BQFAlG7n.d.ts +13 -0
  224. package/dist/{programmatic-routes-client-fD9f4XqU.d.ts → programmatic-routes-client-BwiTndEC.d.ts} +2 -2
  225. package/dist/{programmatic-routes-client-DzbYGiZQ.d.mts → programmatic-routes-client-Dh1SDLSM.d.mts} +2 -2
  226. package/dist/query/client.cjs +6 -6
  227. package/dist/query/client.mjs +2 -2
  228. package/dist/{render-plan-B6cfssrr.d.ts → render-plan-BPbwRbuN.d.ts} +1 -1
  229. package/dist/{render-plan-DqJ51ufr.d.mts → render-plan-BvCGXF6K.d.mts} +1 -1
  230. package/dist/renderer-client.cjs +9 -6
  231. package/dist/renderer-client.d.mts +9 -8
  232. package/dist/renderer-client.d.ts +9 -8
  233. package/dist/renderer-client.mjs +6 -3
  234. package/dist/{request-jhvUMXRx.d.ts → request-B8PGTZNR.d.ts} +1 -1
  235. package/dist/{request-UuAxHn8h.d.mts → request-C_xTkJib.d.mts} +1 -1
  236. package/dist/request.d.mts +7 -7
  237. package/dist/request.d.ts +7 -7
  238. package/dist/{resolver-DC57A4vz.d.ts → resolver-CJ-D9nP-.d.ts} +1 -1
  239. package/dist/{resolver-C2G-3Tm6.d.mts → resolver-TDyZKgKI.d.mts} +1 -1
  240. package/dist/{route-rendering-Cou00t1X.d.mts → route-rendering-DlddURL1.d.mts} +1 -1
  241. package/dist/{route-rendering-Sn50cYZf.d.ts → route-rendering-RNtcj607.d.ts} +1 -1
  242. package/dist/{router-0X9DCTcm.d.mts → router-B97eB0Mq.d.mts} +1 -1
  243. package/dist/{router-xwLvi48p.d.ts → router-qUVaoEN8.d.ts} +1 -1
  244. package/dist/routes-8PT9cl60.d.ts +121 -0
  245. package/dist/routes-kEUsXHx3.d.mts +121 -0
  246. package/dist/routes.d.mts +6 -6
  247. package/dist/routes.d.ts +6 -6
  248. package/dist/{rsc-pipeline-VKHMABDJ.cjs → rsc-pipeline-L4XOZ2TE.cjs} +13 -11
  249. package/dist/{rsc-pipeline-F6ZPH5MU.mjs → rsc-pipeline-T3775JUA.mjs} +12 -10
  250. package/dist/runtime-BIBGJO7V.cjs +1005 -0
  251. package/dist/{runtime-B9HmxiZc.d.ts → runtime-C4CmlOOh.d.ts} +2 -2
  252. package/dist/{runtime-tkSXZiqO.d.ts → runtime-C8GUnNeP.d.ts} +1 -1
  253. package/dist/{runtime-CMrsyChI.d.mts → runtime-CaDswfWi.d.mts} +1 -1
  254. package/dist/{runtime-CCxTmGuf.d.mts → runtime-CihDZ2Rn.d.mts} +2 -2
  255. package/dist/runtime-HRSFC4ZC.mjs +1005 -0
  256. package/dist/{schema-dev-notice-O3I5HLXK.mjs → schema-dev-notice-LZ5NXGLN.mjs} +2 -2
  257. package/dist/{schema-dev-notice-Z73J3NJ6.cjs → schema-dev-notice-XV7GZ3QJ.cjs} +4 -4
  258. package/dist/server-action-security.cjs +3 -3
  259. package/dist/server-action-security.mjs +2 -2
  260. package/dist/server-fn-client.d.mts +0 -1
  261. package/dist/server-fn-client.d.ts +0 -1
  262. package/dist/server-fn.cjs +4 -4
  263. package/dist/server-fn.d.mts +0 -1
  264. package/dist/server-fn.d.ts +0 -1
  265. package/dist/server-fn.mjs +3 -3
  266. package/dist/server-plugins.cjs +1 -1
  267. package/dist/server-plugins.d.mts +7 -7
  268. package/dist/server-plugins.d.ts +7 -7
  269. package/dist/server-plugins.mjs +1 -1
  270. package/dist/server-query-client.d.mts +0 -1
  271. package/dist/server-query-client.d.ts +0 -1
  272. package/dist/server-query.cjs +5 -5
  273. package/dist/server-query.d.mts +0 -1
  274. package/dist/server-query.d.ts +0 -1
  275. package/dist/server-query.mjs +4 -4
  276. package/dist/server.cjs +88 -65
  277. package/dist/server.d.mts +22 -17
  278. package/dist/server.d.ts +22 -17
  279. package/dist/server.mjs +63 -40
  280. package/dist/{spa-router-B48EjsS1.d.mts → spa-router-Dlv5ofg0.d.mts} +4 -4
  281. package/dist/{spa-router-B06APnGK.d.ts → spa-router-qapSboKz.d.ts} +4 -4
  282. package/dist/testing.cjs +7 -7
  283. package/dist/testing.d.mts +6 -6
  284. package/dist/testing.d.ts +6 -6
  285. package/dist/testing.mjs +5 -5
  286. package/dist/{types--Wh02r5_.d.mts → types-C41ePjvP.d.mts} +1 -1
  287. package/dist/{types--Wh02r5_.d.ts → types-C41ePjvP.d.ts} +1 -1
  288. package/dist/{utils-C5fyK2tE.d.ts → utils-A-cYF81u.d.ts} +1 -1
  289. package/dist/{utils-hyAwmcN6.d.mts → utils-DyvlSxFk.d.mts} +1 -1
  290. package/dist/version.cjs +2 -2
  291. package/dist/version.mjs +1 -1
  292. package/dist/vite.cjs +30 -28
  293. package/dist/vite.d.mts +9 -9
  294. package/dist/vite.d.ts +9 -9
  295. package/dist/vite.mjs +29 -27
  296. package/dist/{workflows-Df1C_7OG.d.mts → workflows-CRMzQZ3k.d.mts} +2 -1
  297. package/dist/{workflows-Df1C_7OG.d.ts → workflows-CRMzQZ3k.d.ts} +2 -1
  298. package/dist/workflows.cjs +3 -3
  299. package/dist/workflows.d.mts +1 -1
  300. package/dist/workflows.d.ts +1 -1
  301. package/dist/workflows.mjs +2 -2
  302. package/package.json +10 -2
  303. package/dist/cache-invalidation-BD0z_lfu.d.mts +0 -4
  304. package/dist/cache-invalidation-BD0z_lfu.d.ts +0 -4
  305. package/dist/chunk-45EUIICW.mjs +0 -15
  306. package/dist/chunk-V7KTQR4C.cjs +0 -15
  307. package/dist/{chunk-BR5FSKZ5.cjs → chunk-EQWWOQTK.cjs} +0 -0
  308. package/dist/{chunk-5OJVKXFV.cjs → chunk-N7JQXQAV.cjs} +2 -2
  309. package/dist/{chunk-VR4SEDEM.mjs → chunk-VOZ5DI7D.mjs} +0 -0
  310. package/dist/{chunk-72KABRWN.mjs → chunk-WSDKXV4E.mjs} +4 -4
@@ -0,0 +1,1005 @@
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(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await 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
+
3
+
4
+ var _chunkLYWAGXXWcjs = require('./chunk-LYWAGXXW.cjs');
5
+ require('./chunk-OZC2JPW6.cjs');
6
+
7
+
8
+ var _chunk3ATXWZPHcjs = require('./chunk-3ATXWZPH.cjs');
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ var _chunkYKHRCY4Tcjs = require('./chunk-YKHRCY4T.cjs');
17
+ require('./chunk-5YPBFMBN.cjs');
18
+
19
+
20
+ var _chunkBPNOYILCcjs = require('./chunk-BPNOYILC.cjs');
21
+ require('./chunk-V56632LA.cjs');
22
+ require('./chunk-LSHX2H5G.cjs');
23
+ require('./chunk-STF6VDYQ.cjs');
24
+
25
+
26
+ var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
27
+ require('./chunk-NYQSC4DX.cjs');
28
+ require('./chunk-SG57PX7K.cjs');
29
+ require('./chunk-HIFIG6HL.cjs');
30
+ require('./chunk-6JHZPB52.cjs');
31
+ require('./chunk-HEPJIKKQ.cjs');
32
+ require('./chunk-3EIPOTZV.cjs');
33
+
34
+
35
+ var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
36
+ require('./chunk-2HW5LWAH.cjs');
37
+ require('./chunk-DQJ2CIH7.cjs');
38
+ require('./chunk-IQXGHGZF.cjs');
39
+ require('./chunk-C7425KDG.cjs');
40
+ require('./chunk-2KMIJDY6.cjs');
41
+ require('./chunk-6QA2SXVH.cjs');
42
+ require('./chunk-WT6RAN2I.cjs');
43
+ require('./chunk-WJFFPXCV.cjs');
44
+ require('./chunk-SHIWRBFI.cjs');
45
+ require('./chunk-WAPQWAE6.cjs');
46
+ require('./chunk-DUIP64BF.cjs');
47
+ require('./chunk-PFV2KPDZ.cjs');
48
+ require('./chunk-ZXK2EYQW.cjs');
49
+ require('./chunk-J2ZEVDEK.cjs');
50
+ require('./chunk-5DX3O6TT.cjs');
51
+ require('./chunk-JZMZKABS.cjs');
52
+ require('./chunk-6ONBZGVH.cjs');
53
+ require('./chunk-E7QOEV5Z.cjs');
54
+ require('./chunk-OYZXVBZP.cjs');
55
+ require('./chunk-ITV4QQL2.cjs');
56
+ require('./chunk-FEFCISOX.cjs');
57
+ require('./chunk-LNVGXUL3.cjs');
58
+ require('./chunk-XN2MB4QZ.cjs');
59
+ require('./chunk-JHXJBNLY.cjs');
60
+ require('./chunk-EVIWKPJV.cjs');
61
+ require('./chunk-Z5MZDFX4.cjs');
62
+ require('./chunk-LIFUPCXW.cjs');
63
+ require('./chunk-JYT7AN37.cjs');
64
+ require('./chunk-B5BBTPJQ.cjs');
65
+ require('./chunk-HA7YRO53.cjs');
66
+ require('./chunk-CA7DNRHO.cjs');
67
+ require('./chunk-IWFV5ZED.cjs');
68
+ require('./chunk-6FXBJPF5.cjs');
69
+ require('./chunk-E552H232.cjs');
70
+ require('./chunk-UZCMMJJT.cjs');
71
+ require('./chunk-6XQSPIN6.cjs');
72
+ require('./chunk-7JUIK547.cjs');
73
+ require('./chunk-A25FXJ7D.cjs');
74
+ require('./chunk-6CTFVBAT.cjs');
75
+ require('./chunk-3BIASUGR.cjs');
76
+ require('./chunk-OWQV6MLM.cjs');
77
+
78
+
79
+ var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
80
+
81
+
82
+
83
+ var _chunkYTVSWXEZcjs = require('./chunk-YTVSWXEZ.cjs');
84
+ require('./chunk-BTZ5O6VM.cjs');
85
+
86
+ // src/mobile/runtime.ts
87
+ var _promises = require('fs/promises');
88
+ var _path = require('path'); var path2 = _interopRequireWildcard(_path); var path = _interopRequireWildcard(_path);
89
+
90
+ // src/mobile/config.ts
91
+ var MOBILE_KEYS = /* @__PURE__ */ new Set(["name", "id", "server", "tabs", "routes", "native"]);
92
+ var ROUTE_KEYS = /* @__PURE__ */ new Set(["presentation"]);
93
+ var TAB_KEYS = /* @__PURE__ */ new Set(["path", "title", "icon"]);
94
+ var NATIVE_KEYS = /* @__PURE__ */ new Set(["engine", "auto", "routes", "islands", "prefetch", "budgets"]);
95
+ var NATIVE_ROUTE_KEYS = /* @__PURE__ */ new Set(["screen", "android", "ios", "presentation"]);
96
+ var BUDGET_KEYS = /* @__PURE__ */ new Set(["appSizeMb", "screenOpenMs", "droppedFrames"]);
97
+ var PAGE_KEYS = /* @__PURE__ */ new Set(["presentation", "prefetch", "native"]);
98
+ var PRESENTATIONS = /* @__PURE__ */ new Set(["push", "modal", "replace"]);
99
+ var SCREENS = /* @__PURE__ */ new Set(["web", "native", "platform"]);
100
+ var ENGINES = /* @__PURE__ */ new Set(["react-native", "platform"]);
101
+ var AUTO_MODES = /* @__PURE__ */ new Set(["off", "report", "on"]);
102
+ var MOBILE_OS = /* @__PURE__ */ new Set(["android", "ios"]);
103
+ var MAX_TABS = 5;
104
+ var APP_ID_SEGMENT = /^[A-Za-z][A-Za-z0-9]*$/;
105
+ var JAVA_KEYWORDS = new Set(
106
+ "abstract assert boolean break byte case catch char class const continue default do double else enum extends false final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchronized this throw throws transient true try void volatile while".split(" ")
107
+ );
108
+ var ICON_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
109
+ var ISLAND_NAME = /^[A-Z][A-Za-z0-9]*$/;
110
+ function mobileChecker(context) {
111
+ return _chunkYKHRCY4Tcjs.createPlatformBlockChecker.call(void 0, context ? `mobile (os: ${context.os})` : "mobile");
112
+ }
113
+ function isLoopbackOrLanHost(hostname) {
114
+ const host = hostname.replace(/^\[|\]$/g, "").toLowerCase();
115
+ if (host === "localhost" || host.endsWith(".localhost") || host.endsWith(".local")) return true;
116
+ if (host === "::1" || /^fe[89ab][0-9a-f]:/.test(host) || /^f[cd][0-9a-f]{2}:/.test(host)) {
117
+ return true;
118
+ }
119
+ const ipv4 = host.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
120
+ if (!ipv4) return false;
121
+ const [a, b] = [Number(ipv4[1]), Number(ipv4[2])];
122
+ return a === 127 || a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254;
123
+ }
124
+ function resolveFarmMobileServer(value, context, check = mobileChecker(), key = "server") {
125
+ let url;
126
+ try {
127
+ url = new URL(value);
128
+ } catch (e) {
129
+ return check.fail(`${key} must be an absolute URL such as "https://notes.example.com".`);
130
+ }
131
+ if (url.username || url.password || url.search || url.hash || url.pathname !== "/") {
132
+ check.fail(
133
+ `${key} must be an origin such as "https://notes.example.com", without a path, query, or credentials. A base path comes from basePath.`
134
+ );
135
+ }
136
+ if (url.protocol === "https:") return url.origin;
137
+ if (url.protocol !== "http:") check.fail(`${key} must use https://, got "${url.protocol}".`);
138
+ if (context.command !== "dev") {
139
+ check.fail(
140
+ `${key} must use https:// in a build, got "${value}". http:// is allowed only for loopback and LAN hosts in dev.`
141
+ );
142
+ }
143
+ if (!isLoopbackOrLanHost(url.hostname)) {
144
+ check.fail(
145
+ `${key} may use http:// only for a loopback or LAN host (such as http://10.0.2.2:3000 for the Android emulator), got "${value}". Use https:// for public hosts.`
146
+ );
147
+ }
148
+ return url.origin;
149
+ }
150
+ function checkAppId(id, { fail }) {
151
+ const segments = id.split(".");
152
+ if (segments.length < 2 || !segments.every((segment) => APP_ID_SEGMENT.test(segment))) {
153
+ fail(
154
+ `id must be a reverse-DNS identifier such as "com.example.notes", with segments of letters and digits that start with a letter (valid on Android and iOS), got "${id}".`
155
+ );
156
+ }
157
+ const keyword = segments.find((segment) => JAVA_KEYWORDS.has(segment.toLowerCase()));
158
+ if (keyword) fail(`id segment "${keyword}" is a Java keyword, which Android rejects.`);
159
+ }
160
+ function nativeModuleMovedMessage(where, pattern) {
161
+ const dir = pattern === "/" ? "" : stripRouteGroupsFromPattern(pattern);
162
+ return `${where}.native no longer names a src/native/ module (src/native/ is for native module specs). Add src/app${dir}/page.native.tsx next to its page.tsx, or set native: { routes: { "${pattern}": { screen: "native" } } }.`;
163
+ }
164
+ function checkRouteKey(pattern, where, { fail }) {
165
+ if (!pattern.startsWith("/")) fail(`${where}: the key must be an app route such as "/notes".`);
166
+ }
167
+ function checkPresentation(value, where, { fail }) {
168
+ if (value !== void 0 && !PRESENTATIONS.has(value)) {
169
+ fail(`${where}.presentation must be "push", "modal", or "replace".`);
170
+ }
171
+ }
172
+ function checkPrefetch(value, where, { fail }) {
173
+ if (value !== void 0 && value !== "intent" && value !== "off") {
174
+ fail(`${where}prefetch must be "intent" or "off".`);
175
+ }
176
+ }
177
+ function validateNativeConfig(native, check) {
178
+ const { checkKeys } = check;
179
+ function fail(message) {
180
+ return check.fail(message);
181
+ }
182
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, native)) {
183
+ fail('native must be an object, such as { routes: { "/feed": { screen: "native" } } }.');
184
+ }
185
+ checkKeys(native, NATIVE_KEYS, "native.");
186
+ if (native.engine !== void 0 && !ENGINES.has(native.engine)) {
187
+ fail('native.engine must be "react-native" or "platform".');
188
+ }
189
+ if (native.auto !== void 0 && !AUTO_MODES.has(native.auto)) {
190
+ fail('native.auto must be "off", "report", or "on".');
191
+ }
192
+ checkPrefetch(native.prefetch, "native.", check);
193
+ if (native.islands !== void 0) {
194
+ if (!Array.isArray(native.islands) || !native.islands.every((entry) => typeof entry === "string" && ISLAND_NAME.test(entry))) {
195
+ fail('native.islands must be an array of component names, such as ["Map", "Video"].');
196
+ }
197
+ }
198
+ if (native.budgets !== void 0) {
199
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, native.budgets)) {
200
+ fail("native.budgets must be an object, such as { screenOpenMs: 300 }.");
201
+ }
202
+ checkKeys(native.budgets, BUDGET_KEYS, "native.budgets.");
203
+ for (const [key, value] of Object.entries(native.budgets)) {
204
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
205
+ fail(`native.budgets.${key} must be a number of 0 or more.`);
206
+ }
207
+ }
208
+ }
209
+ if (native.routes === void 0) return;
210
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, native.routes)) {
211
+ fail(
212
+ 'native.routes must be an object keyed by route, such as { "/notes/new": { presentation: "modal" } }.'
213
+ );
214
+ }
215
+ for (const [pattern, route] of Object.entries(native.routes)) {
216
+ const where = `native.routes["${pattern}"]`;
217
+ checkRouteKey(pattern, where, check);
218
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, route)) fail(`${where} must be an object, such as { screen: "native" }.`);
219
+ if (typeof route.native === "string") fail(nativeModuleMovedMessage(where, pattern));
220
+ checkKeys(route, NATIVE_ROUTE_KEYS, `${where}.`);
221
+ if (route.screen === void 0) {
222
+ fail(`${where}.screen is required: "web", "native", or "platform".`);
223
+ }
224
+ for (const field of ["screen", "android", "ios"]) {
225
+ if (route[field] !== void 0 && !SCREENS.has(route[field])) {
226
+ fail(`${where}.${field} must be "web", "native", or "platform".`);
227
+ }
228
+ }
229
+ checkPresentation(route.presentation, where, check);
230
+ }
231
+ }
232
+ function validateFarmMobilePageConfig(value, where, context) {
233
+ const check = mobileChecker(context);
234
+ const { checkKeys } = check;
235
+ function fail(message) {
236
+ return check.fail(message);
237
+ }
238
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, value)) {
239
+ fail(`${where}: export const mobile must be an object, such as { presentation: "modal" }.`);
240
+ }
241
+ checkKeys(value, PAGE_KEYS, `${where}: mobile.`);
242
+ checkPresentation(value.presentation, `${where}: mobile`, check);
243
+ checkPrefetch(value.prefetch, `${where}: mobile.`, check);
244
+ if (value.native !== void 0 && value.native !== false) {
245
+ fail(
246
+ `${where}: mobile.native can only be false. A native screen comes from a page.native.tsx next to the page.`
247
+ );
248
+ }
249
+ return value;
250
+ }
251
+ function validateFarmMobileConfig(input, context) {
252
+ const check = mobileChecker(context);
253
+ const { checkKeys, optionalString } = check;
254
+ function fail(message) {
255
+ return check.fail(message);
256
+ }
257
+ if (input === void 0) return void 0;
258
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, input)) {
259
+ fail(
260
+ context ? 'the function must return an object, such as { id: "com.example.notes" }.' : 'must be an object, such as { id: "com.example.notes" }, or a function that returns one.'
261
+ );
262
+ }
263
+ checkKeys(input, MOBILE_KEYS, "");
264
+ optionalString(input.name, "name");
265
+ const id = optionalString(input.id, "id");
266
+ if (id !== void 0) checkAppId(id, check);
267
+ const server = optionalString(input.server, "server");
268
+ if (server !== void 0) resolveFarmMobileServer(server, _nullishCoalesce(context, () => ( { command: "build" })), check);
269
+ if (input.tabs !== void 0) {
270
+ if (!Array.isArray(input.tabs)) {
271
+ fail('tabs must be an array, such as [{ path: "/", title: "Home", icon: "home" }].');
272
+ }
273
+ const tabs = input.tabs;
274
+ if (tabs.length > MAX_TABS) {
275
+ fail(`tabs has ${tabs.length} entries; a tab bar shows at most ${MAX_TABS}.`);
276
+ }
277
+ const seen = /* @__PURE__ */ new Set();
278
+ tabs.forEach((tab, index) => {
279
+ const where = `tabs[${index}]`;
280
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, tab)) {
281
+ fail(`${where} must be an object, such as { path: "/", title: "Home", icon: "home" }.`);
282
+ }
283
+ checkKeys(tab, TAB_KEYS, `${where}.`);
284
+ const { path: tabPath, title, icon } = tab;
285
+ if (typeof tabPath !== "string" || !tabPath.startsWith("/")) {
286
+ fail(`${where}.path must be a route path such as "/notes".`);
287
+ }
288
+ if (/[[\]()?#]/.test(tabPath)) {
289
+ fail(`${where}.path must be a static route such as "/notes", got "${tabPath}".`);
290
+ }
291
+ if (seen.has(tabPath)) fail(`${where}.path "${tabPath}" is already a tab.`);
292
+ seen.add(tabPath);
293
+ if (optionalString(title, `${where}.title`) === void 0) {
294
+ fail(`${where}.title must be a non-empty string.`);
295
+ }
296
+ const iconName = optionalString(icon, `${where}.icon`);
297
+ if (iconName === void 0 || !ICON_NAME.test(iconName)) {
298
+ fail(
299
+ `${where}.icon must be an icon name such as "note.text" or "ic_notes", got "${String(icon)}".`
300
+ );
301
+ }
302
+ });
303
+ }
304
+ if (input.routes !== void 0) {
305
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, input.routes)) {
306
+ fail(
307
+ 'routes must be an object keyed by route, such as { "/notes/new": { presentation: "modal" } }.'
308
+ );
309
+ }
310
+ for (const [pattern, route] of Object.entries(input.routes)) {
311
+ const where = `routes["${pattern}"]`;
312
+ checkRouteKey(pattern, where, check);
313
+ if (!_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, route)) {
314
+ fail(`${where} must be an object, such as { presentation: "modal" }.`);
315
+ }
316
+ if (route.native !== void 0) fail(nativeModuleMovedMessage(where, pattern));
317
+ checkKeys(route, ROUTE_KEYS, `${where}.`);
318
+ checkPresentation(route.presentation, where, check);
319
+ }
320
+ }
321
+ if (input.native !== void 0) validateNativeConfig(input.native, check);
322
+ if (_chunkYKHRCY4Tcjs.isPlainObject.call(void 0, input.routes) && _chunkYKHRCY4Tcjs.isPlainObject.call(void 0, input.native)) {
323
+ const nativeRoutes = _chunkYKHRCY4Tcjs.isPlainObject.call(void 0, input.native.routes) ? input.native.routes : {};
324
+ const presented = new Map(
325
+ Object.entries(input.routes).filter(([, route]) => _chunkYKHRCY4Tcjs.isPlainObject.call(void 0, route) && route.presentation !== void 0).map(([pattern]) => [stripRouteGroupsFromPattern(pattern), pattern])
326
+ );
327
+ for (const [pattern, route] of Object.entries(nativeRoutes)) {
328
+ const other = presented.get(stripRouteGroupsFromPattern(pattern));
329
+ if (other !== void 0 && _chunkYKHRCY4Tcjs.isPlainObject.call(void 0, route) && route.presentation !== void 0) {
330
+ fail(
331
+ `routes["${other}"].presentation and native.routes["${pattern}"].presentation set the same field. Keep one.`
332
+ );
333
+ }
334
+ }
335
+ }
336
+ return input;
337
+ }
338
+ function stripRouteGroupsFromPattern(pattern) {
339
+ const segments = pattern.split("/").filter((segment) => segment && !(segment.startsWith("(") && segment.endsWith(")")));
340
+ return segments.length === 0 ? "/" : `/${segments.join("/")}`;
341
+ }
342
+ function safeShape(pattern) {
343
+ try {
344
+ return _chunkYTVSWXEZcjs.getRoutePatternShape.call(void 0, pattern);
345
+ } catch (e2) {
346
+ return void 0;
347
+ }
348
+ }
349
+ function resolveFarmMobileConfig(input, options, context) {
350
+ const config = _nullishCoalesce(validateFarmMobileConfig(input, context), () => ( {}));
351
+ const check = mobileChecker(context);
352
+ function fail(message) {
353
+ return check.fail(message);
354
+ }
355
+ const pages = new Set(options.routes.map(stripRouteGroupsFromPattern));
356
+ const byShape = /* @__PURE__ */ new Map();
357
+ for (const page of pages) {
358
+ const shape = safeShape(page);
359
+ if (shape) byShape.set(shape, page);
360
+ }
361
+ const tabs = (_nullishCoalesce(config.tabs, () => ( []))).map((tab, index) => {
362
+ const tabPath = stripRouteGroupsFromPattern(tab.path);
363
+ if (!pages.has(tabPath)) {
364
+ fail(
365
+ `tabs[${index}].path "${tab.path}" is not a page route. Add src/app${tabPath === "/" ? "" : tabPath}/page.tsx or pick an existing route.`
366
+ );
367
+ }
368
+ return { path: tabPath, title: tab.title.trim(), icon: tab.icon.trim() };
369
+ });
370
+ const tabPaths = new Set(tabs.map((tab) => tab.path));
371
+ const checkPage = (key, where) => {
372
+ const pattern = stripRouteGroupsFromPattern(key);
373
+ if (!pages.has(pattern)) {
374
+ const shape = safeShape(pattern);
375
+ const sameShape = shape ? byShape.get(shape) : void 0;
376
+ fail(
377
+ sameShape ? `${where} is not a page route; did you mean "${sameShape}"?` : `${where} is not a page route. Keys are app route patterns such as "/notes/[id]".`
378
+ );
379
+ }
380
+ return pattern;
381
+ };
382
+ const checkTabPresentation = (pattern, where, presentation) => {
383
+ if (presentation !== void 0 && tabPaths.has(pattern)) {
384
+ fail(`${where}.presentation does not apply to a tab route; tabs switch in place.`);
385
+ }
386
+ };
387
+ const routes = {};
388
+ for (const [key, route] of Object.entries(_nullishCoalesce(config.routes, () => ( {})))) {
389
+ const where = `routes["${key}"]`;
390
+ const pattern = checkPage(key, where);
391
+ checkTabPresentation(pattern, where, route.presentation);
392
+ routes[pattern] = route.presentation ? { presentation: route.presentation } : {};
393
+ }
394
+ const native = _nullishCoalesce(config.native, () => ( {}));
395
+ const nativeRoutes = {};
396
+ for (const [key, route] of Object.entries(_nullishCoalesce(native.routes, () => ( {})))) {
397
+ const where = `native.routes["${key}"]`;
398
+ const pattern = checkPage(key, where);
399
+ checkTabPresentation(pattern, where, route.presentation);
400
+ nativeRoutes[pattern] = Object.fromEntries(
401
+ ["screen", "android", "ios", "presentation"].filter((field) => route[field] !== void 0).map((field) => [field, route[field]])
402
+ );
403
+ }
404
+ const pkg = _chunkYKHRCY4Tcjs.readAppPackageJson.call(void 0, options.root);
405
+ const name = _optionalChain([config, 'access', _ => _.name, 'optionalAccess', _2 => _2.trim, 'call', _3 => _3()]) || _chunkYKHRCY4Tcjs.resolveAppPackageName.call(void 0, options.root, pkg) || "Farm App";
406
+ const idName = name.replace(/[^A-Za-z0-9]+/g, "").replace(/^[^A-Za-z]+/, "") || "app";
407
+ const id = _optionalChain([config, 'access', _4 => _4.id, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]) || `local.farm.${idName.toLowerCase()}`;
408
+ if (!_optionalChain([config, 'access', _7 => _7.id, 'optionalAccess', _8 => _8.trim, 'call', _9 => _9()])) {
409
+ checkAppId(id, {
410
+ ...check,
411
+ fail: (message) => fail(
412
+ `${message} It comes from the app's name; set mobile.id, such as "com.example.notes".`
413
+ )
414
+ });
415
+ }
416
+ return {
417
+ name,
418
+ id,
419
+ ...config.server ? { server: resolveFarmMobileServer(config.server, context) } : {},
420
+ tabs,
421
+ routes,
422
+ native: {
423
+ engine: _nullishCoalesce(native.engine, () => ( "react-native")),
424
+ auto: _nullishCoalesce(native.auto, () => ( "report")),
425
+ routes: nativeRoutes,
426
+ islands: [...new Set(_nullishCoalesce(native.islands, () => ( [])))].sort(),
427
+ prefetch: _nullishCoalesce(native.prefetch, () => ( "intent")),
428
+ budgets: { ...native.budgets }
429
+ }
430
+ };
431
+ }
432
+ function createFarmMobileContext(options) {
433
+ const os = _nullishCoalesce(options.os, () => ( "android"));
434
+ if (!MOBILE_OS.has(os)) throw new TypeError(`--os must be android or ios, got "${os}".`);
435
+ if (options.command !== "dev" && options.command !== "build") {
436
+ throw new TypeError(`--command must be dev or build, got "${options.command}".`);
437
+ }
438
+ return Object.freeze({
439
+ os,
440
+ mode: options.mode,
441
+ command: options.command,
442
+ profile: _chunkYKHRCY4Tcjs.resolvePlatformProfile.call(void 0, options.profile),
443
+ env: Object.freeze({ ...process.env }),
444
+ root: options.root
445
+ });
446
+ }
447
+ function resolveFarmMobileBlock(input, context, cache) {
448
+ return _chunkYKHRCY4Tcjs.resolvePlatformBlock.call(void 0,
449
+ input,
450
+ context,
451
+ (value, ctx) => _nullishCoalesce(validateFarmMobileConfig(value, ctx), () => ( {})),
452
+ cache
453
+ );
454
+ }
455
+
456
+ // src/mobile/report.ts
457
+ function createFarmMobileNativeReport(options) {
458
+ const summary = { routes: 0, analyzed: 0, port: 0, portableNoWin: 0, blocked: 0, native: 0 };
459
+ const routes = options.routes.map((route) => {
460
+ const decision = options.screens[route];
461
+ const analyzed = options.analysis[route];
462
+ summary.routes += 1;
463
+ if (decision.screen !== "web") summary.native += 1;
464
+ if (analyzed) {
465
+ summary.analyzed += 1;
466
+ if (analyzed.decision === "port") summary.port += 1;
467
+ else if (analyzed.portable) summary.portableNoWin += 1;
468
+ else summary.blocked += 1;
469
+ }
470
+ const { route: _route, ...analysis } = _nullishCoalesce(analyzed, () => ( {}));
471
+ return {
472
+ route,
473
+ screen: decision.screen,
474
+ source: decision.source,
475
+ ...decision.requested ? { requested: decision.requested } : {},
476
+ ...decision.file ? { file: decision.file } : {},
477
+ ...analyzed ? { analysis } : {}
478
+ };
479
+ });
480
+ return {
481
+ version: 1,
482
+ os: options.os,
483
+ engine: options.engine,
484
+ auto: options.auto,
485
+ summary,
486
+ routes
487
+ };
488
+ }
489
+ function reasonFor(entry) {
490
+ const analysis = entry.analysis;
491
+ if (!analysis) {
492
+ if (entry.source === "page") return `${entry.file}: mobile.native false`;
493
+ if (entry.source === "file") return entry.file;
494
+ if (entry.source === "config") {
495
+ return entry.file ? `native.routes, ${entry.file}` : "native.routes";
496
+ }
497
+ return "";
498
+ }
499
+ if (analysis.portable) {
500
+ return analysis.wins.length > 0 ? `portable; ${analysis.wins.join(", ")}` : `portable; no win (${analysis.elements.total} elements)`;
501
+ }
502
+ const [first, ...rest] = analysis.blockers;
503
+ const where = first.file ? `${first.file}:${first.line}:${first.column} ` : "";
504
+ return `${where}${first.message}${rest.length > 0 ? ` (+${rest.length} more)` : ""}`;
505
+ }
506
+ function formatFarmMobileNativeReport(report, options = {}) {
507
+ const rows = report.routes.map((entry) => [
508
+ entry.route,
509
+ entry.screen,
510
+ entry.analysis ? entry.analysis.decision : "-",
511
+ entry.analysis ? `${entry.analysis.elements.mapped}/${entry.analysis.elements.total}` : "",
512
+ entry.analysis ? `${entry.analysis.portablePercent}%` : "",
513
+ reasonFor(entry)
514
+ ]);
515
+ const header = ["route", "screen", "decision", "mapped", "portable", "reason"];
516
+ const widths = header.map(
517
+ (title, column) => Math.min(
518
+ column === 0 ? 40 : 12,
519
+ Math.max(title.length, ...rows.map((row) => row[column].length))
520
+ )
521
+ );
522
+ const line = (cells) => cells.map(
523
+ (cell, column) => column === cells.length - 1 ? cell : cell.padEnd(widths[column]).slice(0, widths[column])
524
+ ).join(" ").trimEnd();
525
+ const { summary } = report;
526
+ const lines = [
527
+ `mobile.native.auto: "${report.auto}" (os: ${report.os})`,
528
+ "",
529
+ line(header),
530
+ ...rows.map(line),
531
+ "",
532
+ `${summary.routes} routes: ${summary.port} port, ${summary.portableNoWin} portable without a win, ${summary.blocked} blocked, ${summary.native} native from files or config`
533
+ ];
534
+ if (options.stats) {
535
+ const { modules, parsed, cached, ms } = options.stats;
536
+ lines.push(`analyzed ${modules} modules (${parsed} parsed, ${cached} cached) in ${ms} ms`);
537
+ }
538
+ if (options.file) lines.push(`full report: ${options.file}`);
539
+ return lines.join("\n");
540
+ }
541
+
542
+ // src/mobile/screens.ts
543
+
544
+ function createFarmMobileModuleId(route) {
545
+ return route === "/" ? "app" : `app${route}`;
546
+ }
547
+ function relativeFile(root, file) {
548
+ return path.relative(root, file).split(path.sep).join("/");
549
+ }
550
+ function resolveFarmMobileScreens(options) {
551
+ const { os, root } = options;
552
+ const { native } = options.mobile;
553
+ const prefix = `mobile (os: ${os})`;
554
+ const nativeTier = native.engine === "platform" ? "platform" : "native";
555
+ const platformFileName = os === "android" ? "page.kt" : "page.swift";
556
+ const screens = {};
557
+ const warnings = [];
558
+ for (const route of options.routes) {
559
+ const where = `native.routes["${route}"]`;
560
+ const routeConfig = native.routes[route];
561
+ const tier = routeConfig ? _nullishCoalesce(routeConfig[os], () => ( routeConfig.screen)) : void 0;
562
+ const tierKey = _optionalChain([routeConfig, 'optionalAccess', _10 => _10[os]]) !== void 0 ? os : "screen";
563
+ const page = _optionalChain([options, 'access', _11 => _11.pageExports, 'optionalAccess', _12 => _12.get, 'call', _13 => _13(route)]);
564
+ const files = _nullishCoalesce(_optionalChain([options, 'access', _14 => _14.nativePages, 'optionalAccess', _15 => _15.get, 'call', _16 => _16(route)]), () => ( {}));
565
+ const reactFile = _nullishCoalesce(files[os], () => ( files.native));
566
+ const platformFile = os === "android" ? files.kt : files.swift;
567
+ const module = createFarmMobileModuleId(route);
568
+ if (native.engine === "platform") {
569
+ const reactNative = _nullishCoalesce(_nullishCoalesce(files.native, () => ( files.ios)), () => ( files.android));
570
+ if (reactNative) {
571
+ throw new TypeError(
572
+ `${prefix}: ${relativeFile(root, reactNative)} is a React Native screen, but native.engine is "platform" (no React Native). Remove the file or use ${platformFileName}.`
573
+ );
574
+ }
575
+ }
576
+ if (reactFile && platformFile) {
577
+ throw new TypeError(
578
+ `${prefix}: "${route}" has two screens on ${os}: ${relativeFile(root, reactFile)} and ${relativeFile(root, platformFile)}. Keep one.`
579
+ );
580
+ }
581
+ const configPresentation = _nullishCoalesce(_optionalChain([options, 'access', _17 => _17.mobile, 'access', _18 => _18.routes, 'access', _19 => _19[route], 'optionalAccess', _20 => _20.presentation]), () => ( _optionalChain([routeConfig, 'optionalAccess', _21 => _21.presentation])));
582
+ if (_optionalChain([page, 'optionalAccess', _22 => _22.config, 'access', _23 => _23.presentation]) !== void 0 && configPresentation !== void 0) {
583
+ warnings.push(
584
+ `${page.file}: mobile.presentation "${page.config.presentation}" overrides the config's "${configPresentation}" for "${route}".`
585
+ );
586
+ }
587
+ const base = {
588
+ presentation: _nullishCoalesce(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _24 => _24.config, 'access', _25 => _25.presentation]), () => ( configPresentation)), () => ( "push")),
589
+ prefetch: _nullishCoalesce(_optionalChain([page, 'optionalAccess', _26 => _26.config, 'access', _27 => _27.prefetch]), () => ( native.prefetch))
590
+ };
591
+ if (_optionalChain([page, 'optionalAccess', _28 => _28.config, 'access', _29 => _29.native]) === false) {
592
+ if (tier !== void 0 && tier !== "web") {
593
+ warnings.push(
594
+ `${page.file}: mobile.native false overrides ${where}.${tierKey} "${tier}"; the route stays web.`
595
+ );
596
+ }
597
+ for (const unused of [reactFile, platformFile]) {
598
+ if (unused) {
599
+ warnings.push(
600
+ `${relativeFile(root, unused)} is unused: ${page.file} sets mobile.native to false.`
601
+ );
602
+ }
603
+ }
604
+ screens[route] = { screen: "web", source: "page", file: page.file, ...base };
605
+ continue;
606
+ }
607
+ if (tier === "web") {
608
+ screens[route] = { screen: "web", source: "config", ...base };
609
+ continue;
610
+ }
611
+ if (tier === "platform" || tier === "native" && nativeTier === "platform" && platformFile) {
612
+ if (!platformFile) {
613
+ throw new TypeError(
614
+ `${prefix}: ${where}.${tierKey} is "platform", which needs ${platformFileName} next to the route's page.tsx.`
615
+ );
616
+ }
617
+ screens[route] = {
618
+ screen: "platform",
619
+ source: "config",
620
+ file: relativeFile(root, platformFile),
621
+ module,
622
+ ...base
623
+ };
624
+ continue;
625
+ }
626
+ if (tier === "native") {
627
+ if (nativeTier === "native" && reactFile) {
628
+ screens[route] = {
629
+ screen: "native",
630
+ source: "config",
631
+ file: relativeFile(root, reactFile),
632
+ module,
633
+ ...base
634
+ };
635
+ continue;
636
+ }
637
+ const blockers = _optionalChain([options, 'access', _30 => _30.analyzerBlockers, 'optionalAccess', _31 => _31.get, 'call', _32 => _32(route)]);
638
+ warnings.push(
639
+ `${where}.${tierKey} is "native", but "${route}" has no ${nativeTier === "native" ? "page.native.tsx" : platformFileName} and Farm cannot port pages yet, so it stays web` + (_optionalChain([blockers, 'optionalAccess', _33 => _33.length]) ? `. The analyzer would keep it web: ${blockers.join("; ")}` : "") + ". This fails the build once native screens ship."
640
+ );
641
+ screens[route] = { screen: "web", source: "config", requested: nativeTier, ...base };
642
+ continue;
643
+ }
644
+ const file = _nullishCoalesce(reactFile, () => ( platformFile));
645
+ if (file) {
646
+ screens[route] = {
647
+ screen: reactFile ? "native" : "platform",
648
+ source: "file",
649
+ file: relativeFile(root, file),
650
+ module,
651
+ ...base
652
+ };
653
+ continue;
654
+ }
655
+ if (native.auto === "on" && _optionalChain([options, 'access', _34 => _34.analyzerPorts, 'optionalAccess', _35 => _35.has, 'call', _36 => _36(route)])) {
656
+ screens[route] = { screen: "web", source: "analyzer", requested: nativeTier, ...base };
657
+ continue;
658
+ }
659
+ screens[route] = { screen: "web", source: "default", ...base };
660
+ }
661
+ return { screens, warnings };
662
+ }
663
+ function unwrap(node) {
664
+ let current = node;
665
+ while (current.type === "TSAsExpression" || current.type === "TSSatisfiesExpression" || current.type === "ParenthesizedExpression") {
666
+ current = current.expression;
667
+ }
668
+ return current;
669
+ }
670
+ function literalValue(node, fail) {
671
+ const value = unwrap(node);
672
+ if (value.type === "Literal") return value.value;
673
+ if (value.type === "ObjectExpression") {
674
+ const result = {};
675
+ for (const property of value.properties) {
676
+ const key = property.key;
677
+ if (property.type !== "Property" || property.computed || !key) {
678
+ fail("must be an object literal without spreads or computed keys");
679
+ }
680
+ const name = key.type === "Identifier" ? key.name : key.value;
681
+ if (typeof name !== "string") fail("must use plain keys");
682
+ result[name] = literalValue(property.value, fail);
683
+ }
684
+ return result;
685
+ }
686
+ return fail('must use literal values, such as { presentation: "modal" }');
687
+ }
688
+ function readFarmMobilePageExport(source, file, parse, context) {
689
+ if (!/\bmobile\b/.test(source)) return void 0;
690
+ const prefix = context ? `mobile (os: ${context.os})` : "mobile";
691
+ const fail = (message) => {
692
+ throw new TypeError(
693
+ `${prefix}: ${file}: export const mobile ${message}. Farm reads it without running the page.`
694
+ );
695
+ };
696
+ for (const statement of parse(file, source).body) {
697
+ if (statement.type !== "ExportNamedDeclaration") continue;
698
+ for (const specifier of _nullishCoalesce(statement.specifiers, () => ( []))) {
699
+ const exported = specifier.exported;
700
+ if ((_nullishCoalesce(exported.name, () => ( exported.value))) === "mobile") {
701
+ fail("must be declared in place, as export const mobile = { ... }");
702
+ }
703
+ }
704
+ const declaration = statement.declaration;
705
+ if (!declaration) continue;
706
+ if (declaration.type === "VariableDeclaration") {
707
+ for (const declarator of declaration.declarations) {
708
+ const id = declarator.id;
709
+ if (id.type !== "Identifier" || id.name !== "mobile") continue;
710
+ if (declaration.kind !== "const") fail("must be a const");
711
+ if (!declarator.init) fail("needs a value");
712
+ const value = literalValue(declarator.init, fail);
713
+ return validateFarmMobilePageConfig(value, file, context);
714
+ }
715
+ } else if (_optionalChain([declaration, 'access', _37 => _37.id, 'optionalAccess', _38 => _38.name]) === "mobile") {
716
+ fail('must be an object, such as export const mobile = { presentation: "modal" }');
717
+ }
718
+ }
719
+ return void 0;
720
+ }
721
+
722
+ // src/mobile/routes.ts
723
+ var REGEX_SPECIAL = /[\\^$.|?*+()[\]{}]/g;
724
+ function escapeRegex(value) {
725
+ return value.replace(REGEX_SPECIAL, "\\$&");
726
+ }
727
+ function caseInsensitive(value) {
728
+ return Array.from(value).map((character) => {
729
+ const lower = character.toLowerCase();
730
+ const upper = character.toUpperCase();
731
+ return lower === upper ? escapeRegex(character) : `[${upper}${lower}]`;
732
+ }).join("");
733
+ }
734
+ function decodeSegment(segment) {
735
+ try {
736
+ return decodeURIComponent(segment);
737
+ } catch (e3) {
738
+ return segment;
739
+ }
740
+ }
741
+ function createFarmMobileRoutePattern(pattern, options = {}) {
742
+ let source = `^${escapeRegex(_chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, options.basePath))}`;
743
+ const i18n = options.i18n;
744
+ if (i18n && i18n.routing !== "none" && i18n.locales.length > 0) {
745
+ const locale = `/(?:${i18n.locales.map(caseInsensitive).join("|")})`;
746
+ source += `(?:${locale}|(?!${locale}(?:/|$)))`;
747
+ }
748
+ for (const segment of pattern.split("/").filter(Boolean)) {
749
+ if (segment.startsWith("(") && segment.endsWith(")")) continue;
750
+ if (segment.startsWith("[[...") && segment.endsWith("]]")) source += "(?:/[^/]+)*";
751
+ else if (segment.startsWith("[...") && segment.endsWith("]")) source += "(?:/[^/]+)+";
752
+ else if (segment.startsWith("[") && segment.endsWith("]")) source += "/[^/]+";
753
+ else source += `/${escapeRegex(decodeSegment(segment))}`;
754
+ }
755
+ return `${source}/?$`;
756
+ }
757
+ function stripRouteGroups(pattern) {
758
+ const segments = pattern.split("/").filter((segment) => segment && !(segment.startsWith("(") && segment.endsWith(")")));
759
+ return segments.length === 0 ? "/" : `/${segments.join("/")}`;
760
+ }
761
+ function createFarmMobileRouteManifest(mobile, options) {
762
+ const server = _nullishCoalesce(options.server, () => ( mobile.server));
763
+ if (!server) {
764
+ throw new TypeError(
765
+ 'mobile: server is required, such as server: "https://notes.example.com" (the web deployment the app loads pages from).'
766
+ );
767
+ }
768
+ const basePath = _chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, options.basePath);
769
+ const tabIndex = new Map(mobile.tabs.map((tab, index) => [tab.path, index]));
770
+ const routes = [...new Set(options.routes.map(stripRouteGroups))].sort().sort((left, right) => _chunkYTVSWXEZcjs.compareRoutePatternSpecificity.call(void 0, left, right));
771
+ const screens = _nullishCoalesce(options.screens, () => ( resolveFarmMobileScreens({ root: "", os: _nullishCoalesce(options.os, () => ( "android")), routes, mobile }).screens));
772
+ const rules = routes.map((route) => {
773
+ const decision = _nullishCoalesce(screens[route], () => ( {
774
+ screen: "web",
775
+ source: "default",
776
+ presentation: "push",
777
+ prefetch: mobile.native.prefetch
778
+ }));
779
+ const tab = tabIndex.get(route);
780
+ return {
781
+ route,
782
+ pattern: createFarmMobileRoutePattern(route, options),
783
+ presentation: tab !== void 0 ? "tab" : decision.presentation,
784
+ ...tab !== void 0 ? { tab } : {},
785
+ screen: decision.screen,
786
+ source: decision.source,
787
+ ...decision.module ? { module: decision.module } : {},
788
+ ...decision.prefetch !== mobile.native.prefetch ? { prefetch: decision.prefetch } : {}
789
+ };
790
+ });
791
+ rules.push({ pattern: "^/", presentation: "push", screen: "web" });
792
+ return {
793
+ version: 1,
794
+ server,
795
+ tabs: mobile.tabs.map((tab) => ({
796
+ ...tab,
797
+ path: basePath ? tab.path === "/" ? basePath : `${basePath}${tab.path}` : tab.path
798
+ })),
799
+ prefetch: mobile.native.prefetch,
800
+ rules
801
+ };
802
+ }
803
+
804
+ // src/mobile/runtime.ts
805
+ var FarmMobileError = class extends Error {
806
+ constructor() {
807
+ super(...arguments);
808
+ this.name = "FarmMobileError";
809
+ }
810
+ };
811
+ function getFarmMobileOutputDirs(distDir) {
812
+ const root = path2.join(distDir, "output", "mobile");
813
+ return {
814
+ root,
815
+ routes: path2.join(root, "farm-routes.json"),
816
+ www: path2.join(root, "www"),
817
+ android: path2.join(root, "android"),
818
+ ios: path2.join(root, "ios"),
819
+ dist: path2.join(root, "dist"),
820
+ report: path2.join(root, "native-report.json"),
821
+ analyzerCache: path2.join(distDir, "cache", "mobile", "analyzer.json")
822
+ };
823
+ }
824
+ var SCRIPT_PAGE = /\.(?:tsx|ts|jsx|js)$/;
825
+ function scriptLang(file) {
826
+ return file.endsWith(".tsx") ? "tsx" : file.endsWith(".ts") ? "ts" : "jsx";
827
+ }
828
+ async function readPageExports(root, pageFiles, os) {
829
+ const exports = /* @__PURE__ */ new Map();
830
+ let parseSync;
831
+ await Promise.all(
832
+ [...pageFiles].map(async ([route, file]) => {
833
+ if (!SCRIPT_PAGE.test(file)) return;
834
+ const source = await _promises.readFile.call(void 0, file, "utf8");
835
+ if (!/\bmobile\b/.test(source)) return;
836
+ await _asyncNullishCoalesce(parseSync, async () => ( (parseSync = (await import("rolldown/utils")).parseSync)));
837
+ const parse = parseSync;
838
+ const relative3 = path2.relative(root, file).split(path2.sep).join("/");
839
+ const config = readFarmMobilePageExport(
840
+ source,
841
+ relative3,
842
+ (name, code) => parse(name, code, { lang: scriptLang(name) }).program,
843
+ { os }
844
+ );
845
+ if (config) exports.set(route, { file: relative3, config });
846
+ })
847
+ );
848
+ return exports;
849
+ }
850
+ async function resolveFarmMobileApp(options = {}) {
851
+ const root = path2.resolve(_nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'access', _39 => _39.config, 'optionalAccess', _40 => _40.root]), () => ( options.root)), () => ( process.cwd())));
852
+ const command = _nullishCoalesce(options.command, () => ( "build"));
853
+ const mode = command === "dev" ? "development" : "production";
854
+ const userConfig = options.userConfig === void 0 ? await _chunkLYWAGXXWcjs.loadConfig.call(void 0, root, void 0, mode) : options.userConfig;
855
+ if (_optionalChain([userConfig, 'optionalAccess', _41 => _41.mobile]) === void 0) {
856
+ throw new FarmMobileError(
857
+ 'farm.config.ts has no `mobile` entry. Add one, such as `mobile: { id: "com.example.notes", server: "https://notes.example.com" }`.'
858
+ );
859
+ }
860
+ const context = createFarmMobileContext({
861
+ command,
862
+ profile: options.profile,
863
+ os: options.os,
864
+ root,
865
+ mode
866
+ });
867
+ const block = await resolveFarmMobileBlock(userConfig.mobile, context, options.cache);
868
+ const config = await _asyncNullishCoalesce(options.config, async () => ( await _chunkLYWAGXXWcjs.resolveConfig.call(void 0, { ...userConfig, root }, mode)));
869
+ const scan = await _chunk3ATXWZPHcjs.scanRoutePatterns.call(void 0, {
870
+ root,
871
+ srcDir: config.srcDir,
872
+ sourceRoots: _chunk5Y2P454Ocjs.getFarmSourceRoots.call(void 0, config),
873
+ componentExtensions: _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, config.renderer),
874
+ platformFiles: true
875
+ });
876
+ const routes = [...scan.pages].sort();
877
+ const mobile = resolveFarmMobileConfig(block, { root, srcDir: config.srcDir, routes }, context);
878
+ const pageExports = await readPageExports(root, scan.pageFiles, context.os);
879
+ for (const [route, page] of pageExports) {
880
+ if (page.config.presentation !== void 0 && mobile.tabs.some((tab) => tab.path === route)) {
881
+ throw new TypeError(
882
+ `mobile (os: ${context.os}): ${page.file}: mobile.presentation does not apply to a tab route; tabs switch in place.`
883
+ );
884
+ }
885
+ }
886
+ const screenOptions = {
887
+ root,
888
+ os: context.os,
889
+ routes,
890
+ mobile,
891
+ nativePages: scan.nativePages,
892
+ pageExports
893
+ };
894
+ let { screens, warnings } = resolveFarmMobileScreens(screenOptions);
895
+ let report;
896
+ let analyzerStats;
897
+ const analyze = options.analyze === "always" || options.analyze === true && mobile.native.auto !== "off";
898
+ if (analyze) {
899
+ const candidates = routes.filter((route) => {
900
+ const decision = screens[route];
901
+ return decision.source === "default" || decision.requested !== void 0;
902
+ });
903
+ const { analyzeFarmMobileRoutes } = await import("./analyzer-CN7C74WX.cjs");
904
+ const result = await analyzeFarmMobileRoutes({
905
+ root,
906
+ srcDir: config.srcDir,
907
+ routes: candidates,
908
+ pageFiles: scan.pageFiles,
909
+ serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _42 => _42.experimental, 'optionalAccess', _43 => _43.serverComponents])) !== void 0,
910
+ cacheFile: path2.resolve(root, getFarmMobileOutputDirs(config.distDir).analyzerCache)
911
+ });
912
+ analyzerStats = result.stats;
913
+ ({ screens, warnings } = resolveFarmMobileScreens({
914
+ ...screenOptions,
915
+ analyzerPorts: new Set(
916
+ Object.values(result.routes).filter((route) => route.decision === "port").map((route) => route.route)
917
+ ),
918
+ analyzerBlockers: new Map(
919
+ Object.values(result.routes).map((route) => [
920
+ route.route,
921
+ route.blockers.map(
922
+ (blocker) => `${blocker.file ? `${blocker.file}:${blocker.line}:${blocker.column} ` : ""}${blocker.message}`
923
+ )
924
+ ])
925
+ )
926
+ }));
927
+ report = createFarmMobileNativeReport({
928
+ os: context.os,
929
+ engine: mobile.native.engine,
930
+ auto: mobile.native.auto,
931
+ routes,
932
+ screens,
933
+ analysis: result.routes
934
+ });
935
+ }
936
+ const nativeLayouts = Object.fromEntries(
937
+ [...scan.nativeLayouts].sort().map(([route, files]) => [
938
+ route,
939
+ Object.fromEntries(
940
+ Object.entries(files).map(([platform, file]) => [
941
+ platform,
942
+ path2.relative(root, file).split(path2.sep).join("/")
943
+ ])
944
+ )
945
+ ])
946
+ );
947
+ const server = options.server === void 0 ? void 0 : resolveFarmMobileServer(options.server, context, void 0, "the server URL");
948
+ if (!server && !mobile.server) {
949
+ throw new FarmMobileError(
950
+ `mobile (os: ${context.os}): server is required, such as server: "https://notes.example.com" (the web deployment the app loads pages from).`
951
+ );
952
+ }
953
+ const i18n = config.i18n && typeof config.i18n === "object" && config.i18n.enabled ? { locales: config.i18n.locales, routing: config.i18n.routing } : null;
954
+ const manifest = createFarmMobileRouteManifest(mobile, {
955
+ routes,
956
+ server,
957
+ basePath: config.basePath,
958
+ i18n,
959
+ screens
960
+ });
961
+ return {
962
+ context,
963
+ mobile,
964
+ manifest,
965
+ config,
966
+ screens,
967
+ warnings,
968
+ nativeLayouts,
969
+ pageFiles: scan.pageFiles,
970
+ ...report ? { report, analyzerStats } : {}
971
+ };
972
+ }
973
+ async function generateFarmMobileRoutes(options = {}) {
974
+ const app = await resolveFarmMobileApp(options);
975
+ const dirs = getFarmMobileOutputDirs(app.config.distDir);
976
+ const file = path2.resolve(app.config.root, dirs.routes);
977
+ await _promises.mkdir.call(void 0, path2.dirname(file), { recursive: true });
978
+ await _promises.writeFile.call(void 0, file, `${JSON.stringify(app.manifest, null, 2)}
979
+ `);
980
+ if (!app.report) return { ...app, file };
981
+ const reportFile = path2.resolve(app.config.root, dirs.report);
982
+ await _promises.writeFile.call(void 0, reportFile, `${JSON.stringify(app.report, null, 2)}
983
+ `);
984
+ const table = formatFarmMobileNativeReport(app.report, {
985
+ stats: app.analyzerStats,
986
+ file: path2.relative(app.config.root, reportFile).split(path2.sep).join("/")
987
+ });
988
+ return { ...app, file, reportFile, table };
989
+ }
990
+
991
+
992
+
993
+
994
+
995
+
996
+
997
+
998
+
999
+
1000
+
1001
+
1002
+
1003
+
1004
+
1005
+ exports.FarmMobileError = FarmMobileError; exports.createFarmMobileContext = createFarmMobileContext; exports.createFarmMobileModuleId = createFarmMobileModuleId; exports.createFarmMobileRouteManifest = createFarmMobileRouteManifest; exports.createFarmMobileRoutePattern = createFarmMobileRoutePattern; exports.formatFarmMobileNativeReport = formatFarmMobileNativeReport; exports.generateFarmMobileRoutes = generateFarmMobileRoutes; exports.getFarmMobileOutputDirs = getFarmMobileOutputDirs; exports.readFarmMobilePageExport = readFarmMobilePageExport; exports.resolveFarmMobileApp = resolveFarmMobileApp; exports.resolveFarmMobileBlock = resolveFarmMobileBlock; exports.resolveFarmMobileConfig = resolveFarmMobileConfig; exports.resolveFarmMobileScreens = resolveFarmMobileScreens; exports.validateFarmMobileConfig = validateFarmMobileConfig;