@farm.js/core 0.1.40 → 0.1.42

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 (238) hide show
  1. package/dist/{agent-mcp-DRlXq3lM.d.ts → agent-mcp-SSD6L3VZ.d.ts} +8 -2
  2. package/dist/{agent-mcp-XNF4JqHw.d.mts → agent-mcp-ssVy_tea.d.mts} +8 -2
  3. package/dist/agent-runtime.d.mts +2 -2
  4. package/dist/agent-runtime.d.ts +2 -2
  5. package/dist/api/client.cjs +3 -3
  6. package/dist/api/client.mjs +2 -2
  7. package/dist/api/route-manager.cjs +8 -8
  8. package/dist/api/route-manager.d.mts +4 -4
  9. package/dist/api/route-manager.d.ts +4 -4
  10. package/dist/api/route-manager.mjs +7 -7
  11. package/dist/api/runtime.cjs +6 -6
  12. package/dist/api/runtime.d.mts +3 -3
  13. package/dist/api/runtime.d.ts +3 -3
  14. package/dist/api/runtime.mjs +5 -5
  15. package/dist/api.cjs +10 -10
  16. package/dist/api.d.mts +4 -4
  17. package/dist/api.d.ts +4 -4
  18. package/dist/api.mjs +9 -9
  19. package/dist/{app-CWjCklhF.d.mts → app-1h3lVT4a.d.mts} +5 -5
  20. package/dist/{app-CDJHPqZn.d.ts → app-KjFzdCqy.d.ts} +5 -5
  21. package/dist/app-manifest-D3RkVNuS.d.mts +120 -0
  22. package/dist/app-manifest-DaW8-tvX.d.ts +120 -0
  23. package/dist/app-markdown.d.mts +3 -3
  24. package/dist/app-markdown.d.ts +3 -3
  25. package/dist/cache.cjs +3 -3
  26. package/dist/cache.mjs +2 -2
  27. package/dist/{chunk-UM3ZV5EP.mjs → chunk-24SP5TGU.mjs} +1 -1
  28. package/dist/{chunk-B6IMBBOS.cjs → chunk-25LPIZSX.cjs} +3 -3
  29. package/dist/{chunk-WW374SGU.mjs → chunk-26RUNDIR.mjs} +1 -1
  30. package/dist/{chunk-B77AUCBV.cjs → chunk-2FUIT2G2.cjs} +3 -3
  31. package/dist/{chunk-IMQO6ZUU.mjs → chunk-2JZHQDUY.mjs} +2 -2
  32. package/dist/{chunk-BPGO2IEP.mjs → chunk-35WS7P2V.mjs} +24 -126
  33. package/dist/{chunk-XKIUHXHW.mjs → chunk-375K2ZVU.mjs} +46 -52
  34. package/dist/{chunk-MNUSIXGS.mjs → chunk-4KQDHTWX.mjs} +1 -1
  35. package/dist/{chunk-DATEWH3W.cjs → chunk-6IZWX6ES.cjs} +22 -8
  36. package/dist/{chunk-Y6LRPO2K.mjs → chunk-6LVRDOAW.mjs} +19 -5
  37. package/dist/{chunk-UMQAK3KP.cjs → chunk-6MVFHNYZ.cjs} +2 -2
  38. package/dist/{chunk-OLQ73ZO5.mjs → chunk-6PKXK4TY.mjs} +3 -3
  39. package/dist/{chunk-PYQ3ZG4Z.mjs → chunk-724JLMS4.mjs} +4 -4
  40. package/dist/{chunk-PNCM5MFD.mjs → chunk-7UEEHAW7.mjs} +1 -1
  41. package/dist/{chunk-EW4MEVLE.cjs → chunk-7YHSD3Z6.cjs} +82 -118
  42. package/dist/{chunk-DKU6NXRK.cjs → chunk-AHFRQMRX.cjs} +1 -1
  43. package/dist/{chunk-7VAJSSPG.mjs → chunk-B2GSRB3P.mjs} +1 -1
  44. package/dist/{chunk-JXB6DVCO.mjs → chunk-BPNRQ5BA.mjs} +1 -1
  45. package/dist/{chunk-FLZ4H25A.cjs → chunk-BXJ5HJTJ.cjs} +13 -12
  46. package/dist/{chunk-GNVEJUT5.cjs → chunk-C5KVWHIH.cjs} +21 -21
  47. package/dist/chunk-COABSY3U.mjs +196 -0
  48. package/dist/{chunk-Y2GNNXGV.cjs → chunk-D64OPY6A.cjs} +5 -5
  49. package/dist/{chunk-BYQVROIP.mjs → chunk-DMRPN25V.mjs} +69 -0
  50. package/dist/{chunk-I64GEPOB.cjs → chunk-FEYQCYT7.cjs} +3 -3
  51. package/dist/{chunk-AXB5P7BK.mjs → chunk-FIAPD365.mjs} +1 -1
  52. package/dist/{chunk-7FHZ3E6D.cjs → chunk-GB7LDGY5.cjs} +2 -2
  53. package/dist/{chunk-45UZKX2J.mjs → chunk-HJ64F4GS.mjs} +2 -2
  54. package/dist/{chunk-IRYK4Z5M.cjs → chunk-I5MG3TKE.cjs} +2 -2
  55. package/dist/{chunk-YR2P74F7.cjs → chunk-IFWSR7YZ.cjs} +2 -2
  56. package/dist/{chunk-5E65AL7P.mjs → chunk-IN6RCKLL.mjs} +5 -4
  57. package/dist/{chunk-CKFK3Z2V.mjs → chunk-IVQY6UTY.mjs} +1 -1
  58. package/dist/{chunk-3TB5QGUW.cjs → chunk-JAXDRRRC.cjs} +70 -1
  59. package/dist/{chunk-EORXKFLR.cjs → chunk-JEIG3EWE.cjs} +1 -1
  60. package/dist/{chunk-54QWHSNR.cjs → chunk-JG3MEQUH.cjs} +150 -156
  61. package/dist/{chunk-TFX4RTH2.mjs → chunk-JOW4HDJO.mjs} +1 -1
  62. package/dist/{chunk-H44XGLFU.cjs → chunk-L6A26QT5.cjs} +9 -9
  63. package/dist/{chunk-OZN4XL6L.cjs → chunk-LIZTLA5F.cjs} +7 -6
  64. package/dist/{chunk-62DY5GKS.mjs → chunk-LLUA2LSC.mjs} +2 -2
  65. package/dist/{chunk-LDPKAYVS.cjs → chunk-LYIZHJTK.cjs} +2 -2
  66. package/dist/{chunk-2DMWQWNJ.mjs → chunk-MEASUNVY.mjs} +1 -1
  67. package/dist/{chunk-T4II4MMW.mjs → chunk-MHHCLYXU.mjs} +1 -1
  68. package/dist/{chunk-SHFXCE5A.cjs → chunk-MHN4UR5U.cjs} +4 -4
  69. package/dist/{chunk-5JEC43MQ.cjs → chunk-MN4TQJ3W.cjs} +9 -9
  70. package/dist/{chunk-5XS5NCVM.cjs → chunk-MY5PZYAD.cjs} +4 -4
  71. package/dist/{chunk-2JG2LJDI.cjs → chunk-NBPNUQYO.cjs} +2 -2
  72. package/dist/{chunk-4XO5GSD6.cjs → chunk-NFG4PUPI.cjs} +2 -2
  73. package/dist/{chunk-Y4QVEU67.mjs → chunk-NU25TRIO.mjs} +5 -4
  74. package/dist/{chunk-5LL6TKII.mjs → chunk-O7USYJ4U.mjs} +1 -1
  75. package/dist/{chunk-VBN3UAPQ.mjs → chunk-P2UJF4SS.mjs} +1 -1
  76. package/dist/{chunk-T6DLMX5V.mjs → chunk-PIZXONIS.mjs} +73 -109
  77. package/dist/{chunk-KK22JPQM.cjs → chunk-QEILRWVV.cjs} +30 -132
  78. package/dist/{chunk-UXMIFB44.cjs → chunk-QIBP5EFA.cjs} +5 -5
  79. package/dist/{chunk-TAKG7ZCD.cjs → chunk-QKZMB7LY.cjs} +14 -14
  80. package/dist/{chunk-FCOLU5P6.mjs → chunk-QTEJGB5A.mjs} +39 -16
  81. package/dist/{chunk-QJM7A4CR.cjs → chunk-S7MTDRYA.cjs} +10 -10
  82. package/dist/{chunk-ACLPN56I.mjs → chunk-SGB4IW7K.mjs} +1 -1
  83. package/dist/{chunk-GKQL726H.cjs → chunk-TCJ4A4A2.cjs} +78 -82
  84. package/dist/{chunk-ZKVJYQPO.mjs → chunk-TUL355PH.mjs} +13 -17
  85. package/dist/{chunk-H56MQYEG.mjs → chunk-U2UC7UGP.mjs} +1 -1
  86. package/dist/{chunk-I63UCMXW.mjs → chunk-ULQOP5UI.mjs} +2 -2
  87. package/dist/{chunk-HBEBV7OZ.mjs → chunk-UQUEANTY.mjs} +1 -1
  88. package/dist/chunk-VHRS3MCW.cjs +196 -0
  89. package/dist/{chunk-WCWV25PG.mjs → chunk-VTBXE6QG.mjs} +2 -2
  90. package/dist/{chunk-E55H6UKH.cjs → chunk-WLHA5USH.cjs} +9 -9
  91. package/dist/{chunk-YJBWB6GF.mjs → chunk-WMBRZI5V.mjs} +1 -1
  92. package/dist/{chunk-AGR7F3LA.cjs → chunk-WROEFVNO.cjs} +3 -3
  93. package/dist/{chunk-CA62IQY3.cjs → chunk-WU7ZS3EM.cjs} +2 -2
  94. package/dist/{chunk-ZOABCQGT.mjs → chunk-X3NGFVRF.mjs} +37 -22
  95. package/dist/{chunk-XJAEZCT6.mjs → chunk-XUC6CFLE.mjs} +1 -1
  96. package/dist/{chunk-6ILGLCXF.cjs → chunk-YWCYV7QC.cjs} +8 -8
  97. package/dist/{chunk-T36UJS3X.mjs → chunk-YYQVGKO5.mjs} +2 -2
  98. package/dist/{chunk-EGCT3AHF.cjs → chunk-ZATTDMBW.cjs} +127 -104
  99. package/dist/{chunk-PGW7HZE2.cjs → chunk-ZS6HDNOM.cjs} +6 -6
  100. package/dist/{chunk-XVIEGKTT.cjs → chunk-ZTP3BJG6.cjs} +41 -26
  101. package/dist/{client-plugins-B_5QbNrp.d.mts → client-plugins-C9Py_50W.d.mts} +79 -7
  102. package/dist/{client-plugins-DgSfIWIF.d.ts → client-plugins-DIem0I0W.d.ts} +79 -7
  103. package/dist/client-plugins.d.mts +2 -2
  104. package/dist/client-plugins.d.ts +2 -2
  105. package/dist/client.cjs +5 -5
  106. package/dist/client.d.mts +6 -6
  107. package/dist/client.d.ts +6 -6
  108. package/dist/client.mjs +4 -4
  109. package/dist/client.react-server.mjs +2 -0
  110. package/dist/config.d.mts +2 -2
  111. package/dist/config.d.ts +2 -2
  112. package/dist/{devtools-ANJ7JAPQ.cjs → devtools-2RY3EKHL.cjs} +6 -6
  113. package/dist/{devtools-VEQQDVHE.mjs → devtools-Q3LBNUJ7.mjs} +5 -5
  114. package/dist/docs.cjs +8 -8
  115. package/dist/docs.d.mts +3 -3
  116. package/dist/docs.d.ts +3 -3
  117. package/dist/docs.mjs +7 -7
  118. package/dist/headers.cjs +4 -4
  119. package/dist/headers.mjs +3 -3
  120. package/dist/image/server.d.mts +1 -1
  121. package/dist/image/server.d.ts +1 -1
  122. package/dist/image/sharp.d.mts +1 -1
  123. package/dist/image/sharp.d.ts +1 -1
  124. package/dist/{image-config-Duob7wER.d.ts → image-config-BpH1q5R8.d.mts} +4 -1
  125. package/dist/{image-config-Duob7wER.d.mts → image-config-BpH1q5R8.d.ts} +4 -1
  126. package/dist/image.d.mts +1 -1
  127. package/dist/image.d.ts +1 -1
  128. package/dist/index.cjs +40 -38
  129. package/dist/index.d.mts +16 -135
  130. package/dist/index.d.ts +16 -135
  131. package/dist/index.mjs +39 -37
  132. package/dist/integrations.d.mts +2 -2
  133. package/dist/integrations.d.ts +2 -2
  134. package/dist/internal/app-markdown-runtime.d.mts +3 -3
  135. package/dist/internal/app-markdown-runtime.d.ts +3 -3
  136. package/dist/internal/build-runtime.cjs +23 -23
  137. package/dist/internal/build-runtime.d.mts +4 -4
  138. package/dist/internal/build-runtime.d.ts +4 -4
  139. package/dist/internal/build-runtime.mjs +22 -22
  140. package/dist/internal/cli-runtime.cjs +13 -13
  141. package/dist/internal/cli-runtime.mjs +12 -12
  142. package/dist/internal/client-error-overlay.cjs +4 -4
  143. package/dist/internal/client-error-overlay.mjs +1 -1
  144. package/dist/internal/compression-runtime.d.mts +2 -2
  145. package/dist/internal/compression-runtime.d.ts +2 -2
  146. package/dist/internal/config-runtime.cjs +6 -6
  147. package/dist/internal/config-runtime.d.mts +3 -3
  148. package/dist/internal/config-runtime.d.ts +3 -3
  149. package/dist/internal/config-runtime.mjs +5 -5
  150. package/dist/internal/docs-precompiled-runtime.cjs +3 -3
  151. package/dist/internal/docs-precompiled-runtime.mjs +2 -2
  152. package/dist/internal/infra-analytics-runtime.cjs +5 -5
  153. package/dist/internal/infra-analytics-runtime.mjs +3 -3
  154. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  155. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  156. package/dist/internal/production-runtime.cjs +21 -13
  157. package/dist/internal/production-runtime.d.mts +29 -126
  158. package/dist/internal/production-runtime.d.ts +29 -126
  159. package/dist/internal/production-runtime.mjs +21 -13
  160. package/dist/markdown.d.mts +2 -2
  161. package/dist/markdown.d.ts +2 -2
  162. package/dist/middleware.cjs +7 -7
  163. package/dist/middleware.d.mts +4 -4
  164. package/dist/middleware.d.ts +4 -4
  165. package/dist/middleware.mjs +6 -6
  166. package/dist/navigation.cjs +4 -4
  167. package/dist/navigation.d.mts +5 -5
  168. package/dist/navigation.d.ts +5 -5
  169. package/dist/navigation.mjs +3 -3
  170. package/dist/{nitro-NFG2LBRC.mjs → nitro-KDACKNHU.mjs} +1 -1
  171. package/dist/{nitro-S2QABUFA.cjs → nitro-NPGU6VBT.cjs} +2 -2
  172. package/dist/plugin.cjs +21 -21
  173. package/dist/plugin.d.mts +4 -3
  174. package/dist/plugin.d.ts +4 -3
  175. package/dist/plugin.mjs +20 -20
  176. package/dist/{production-runtime-j_WCfuwB.d.mts → production-runtime-CHFKIgpW.d.mts} +1 -1
  177. package/dist/{production-runtime-DfknD3g_.d.ts → production-runtime-bjjWq-DA.d.ts} +1 -1
  178. package/dist/query/client.cjs +2 -2
  179. package/dist/query/client.mjs +3 -3
  180. package/dist/{render-plan-CFIhcYYS.d.ts → render-plan-B2UndB4x.d.ts} +1 -1
  181. package/dist/{render-plan-ChUtsymc.d.mts → render-plan-DOHg6wdO.d.mts} +1 -1
  182. package/dist/renderer-client.d.mts +4 -4
  183. package/dist/renderer-client.d.ts +4 -4
  184. package/dist/{request-F4HRwzSd.d.mts → request-DQcGfdgQ.d.mts} +1 -1
  185. package/dist/{request-RJvelT8L.d.ts → request-DVNXRQrI.d.ts} +1 -1
  186. package/dist/request.cjs +3 -3
  187. package/dist/request.d.mts +3 -3
  188. package/dist/request.d.ts +3 -3
  189. package/dist/request.mjs +2 -2
  190. package/dist/{route-rendering-D4coJ-kw.d.ts → route-rendering-B_6fj-GG.d.ts} +1 -1
  191. package/dist/{route-rendering-3a4fbNyC.d.mts → route-rendering-CEX4mFn-.d.mts} +1 -1
  192. package/dist/{router-WLEW3Te1.d.ts → router-CHEMHm1P.d.ts} +1 -1
  193. package/dist/{router-DqIssGRO.d.mts → router-CKHPBKXX.d.mts} +1 -1
  194. package/dist/routes.cjs +4 -4
  195. package/dist/routes.d.mts +2 -2
  196. package/dist/routes.d.ts +2 -2
  197. package/dist/routes.mjs +3 -3
  198. package/dist/{runtime-BrNdLOq9.d.ts → runtime-Br2ZDTAv.d.ts} +1 -1
  199. package/dist/{runtime-CmE_j-js.d.mts → runtime-jj8TKNsy.d.mts} +1 -1
  200. package/dist/server-fn.cjs +4 -4
  201. package/dist/server-fn.mjs +3 -3
  202. package/dist/server-plugins.cjs +5 -5
  203. package/dist/server-plugins.d.mts +3 -3
  204. package/dist/server-plugins.d.ts +3 -3
  205. package/dist/server-plugins.mjs +4 -4
  206. package/dist/server-query.cjs +5 -5
  207. package/dist/server-query.mjs +4 -4
  208. package/dist/server.cjs +46 -46
  209. package/dist/server.d.mts +10 -9
  210. package/dist/server.d.ts +10 -9
  211. package/dist/server.mjs +25 -25
  212. package/dist/{spa-router-C41zjnFl.d.mts → spa-router-BEvS9Erj.d.mts} +2 -2
  213. package/dist/{spa-router-D_0VXqPC.d.ts → spa-router-DmCuH5B7.d.ts} +2 -2
  214. package/dist/ssg-57v6cZcW.d.mts +184 -0
  215. package/dist/ssg-gT093ETk.d.ts +184 -0
  216. package/dist/testing.cjs +11 -11
  217. package/dist/testing.d.mts +2 -2
  218. package/dist/testing.d.ts +2 -2
  219. package/dist/testing.mjs +8 -8
  220. package/dist/theme/server.cjs +4 -4
  221. package/dist/theme/server.mjs +3 -3
  222. package/dist/{utils-YYcWsOJp.d.ts → utils-CCTKvR-P.d.ts} +1 -1
  223. package/dist/{utils-BKWSe3S7.d.mts → utils-raHHQVyL.d.mts} +1 -1
  224. package/dist/version.cjs +2 -2
  225. package/dist/version.mjs +1 -1
  226. package/dist/vite.cjs +38 -22
  227. package/dist/vite.d.mts +41 -4
  228. package/dist/vite.d.ts +41 -4
  229. package/dist/vite.mjs +38 -22
  230. package/dist/workflows.cjs +2 -2
  231. package/dist/workflows.mjs +1 -1
  232. package/package.json +2 -1
  233. package/dist/chunk-DAO7JGTS.mjs +0 -73
  234. package/dist/chunk-SYQ3MOWW.cjs +0 -73
  235. package/dist/programmatic-routes-client-DcoxEaLe.d.mts +0 -55
  236. package/dist/programmatic-routes-client-DcoxEaLe.d.ts +0 -55
  237. /package/dist/{chunk-MOSYH4CY.mjs → chunk-FWCGUVVL.mjs} +0 -0
  238. /package/dist/{chunk-4A3YUB4D.cjs → chunk-KF6VDJH7.cjs} +0 -0
@@ -1,14 +1,14 @@
1
- import { ay as FarmConfig, a8 as ParsedRoute, bj as ResolvedFarmRouteRuntimeConfig, bk as ApplicationMetadataRouteKind, ak as RouteModule, aZ as LayoutModule, b4 as SSGCollectionResult, aa as FarmRequest, ab as FarmResponse, bl as ResolvedFarmAPIConfig, bm as FarmDocsResolvedConfig, be as FarmMarkdownResolvedConfig, am as FarmMdxResolvedConfig, _ as ResolvedFarmDevtoolsConfig, bn as ResolvedFarmDevIndicatorsConfig, bo as ResolvedFarmAuthConfig, bp as ResolvedFarmPerformanceConfig, bq as ResolvedFarmSecurityConfig } from './client-plugins-DgSfIWIF.js';
1
+ import { ay as FarmConfig, a8 as ParsedRoute, bk as ResolvedFarmRouteRuntimeConfig, bl as ApplicationMetadataRouteKind, ak as RouteModule, aZ as LayoutModule, b4 as SSGCollectionResult, aa as FarmRequest, ab as FarmResponse, bm as ResolvedFarmAPIConfig, bn as FarmDocsResolvedConfig, bg as FarmMarkdownResolvedConfig, am as FarmMdxResolvedConfig, _ as ResolvedFarmDevtoolsConfig, bo as ResolvedFarmDevIndicatorsConfig, bp as ResolvedFarmAuthConfig, bq as ResolvedFarmPerformanceConfig, br as ResolvedFarmSecurityConfig } from './client-plugins-DIem0I0W.js';
2
2
  import { F as FarmWorkflowsResolvedConfig } from './workflows-IWP1ddBm.js';
3
3
  import { FarmCronResolvedConfig } from './cron.js';
4
- import { R as ResolvedFarmImageConfig } from './image-config-Duob7wER.js';
4
+ import { R as ResolvedFarmImageConfig } from './image-config-BpH1q5R8.js';
5
5
  import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.js';
6
- import { P as ProgrammaticClientRoutes } from './programmatic-routes-client-DcoxEaLe.js';
6
+ import { P as ProgrammaticClientRoutes } from './ssg-gT093ETk.js';
7
7
  import { ViteDevServer } from 'vite';
8
8
  import { F as FarmIslandStrategy } from './island-CfGru1MO.js';
9
- import { M as MetadataImageKind, c as createFarmDefaultMCPServer } from './agent-mcp-DRlXq3lM.js';
9
+ import { M as MetadataImageKind, c as createFarmDefaultMCPServer } from './agent-mcp-SSD6L3VZ.js';
10
10
  import { FarmServerRendererRuntime, FarmRenderer } from './renderer.js';
11
- import { F as FarmRouteRenderPlan } from './render-plan-CFIhcYYS.js';
11
+ import { F as FarmRouteRenderPlan } from './render-plan-B2UndB4x.js';
12
12
  import { R as ResolvedFarmI18nConfig } from './types-CnH8DOqo.js';
13
13
  import { F as FarmI18nRuntime } from './runtime-BgDQzBiu.js';
14
14
  import { R as ResolvedFarmThemeConfig } from './types-DQnyD3VD.js';
@@ -0,0 +1,120 @@
1
+ import { b7 as FarmMCPCatalogDetails, b8 as ResolvedFarmAppManifestConfig } from './client-plugins-C9Py_50W.mjs';
2
+
3
+ interface FarmAppManifestWebMCPTool {
4
+ name: string;
5
+ title?: string;
6
+ description?: string;
7
+ readOnlyHint?: boolean;
8
+ destructiveHint?: boolean;
9
+ idempotentHint?: boolean;
10
+ openWorldHint?: boolean;
11
+ /** The input JSON Schema when the source writes it out; omitted when it's computed. */
12
+ inputSchema?: Record<string, unknown>;
13
+ /** `"computed"` when the schema is built at runtime, so it can't be read from source. */
14
+ inputSchemaSource: "literal" | "computed" | "none";
15
+ }
16
+
17
+ type FarmAppManifestToolSource = "endpoint" | "defineTool" | "serverFunction";
18
+ interface FarmAppManifestTool {
19
+ name: string;
20
+ title?: string;
21
+ description?: string;
22
+ /** How the app defined it: an API endpoint, `defineTool`, or a server function. */
23
+ source: FarmAppManifestToolSource;
24
+ readOnlyHint?: boolean;
25
+ destructiveHint?: boolean;
26
+ idempotentHint?: boolean;
27
+ openWorldHint?: boolean;
28
+ /**
29
+ * JSON Schemas, when the server published them (`@farm.js/mcp` does) and
30
+ * `agent.manifest.mcp.schemas` isn't `false`.
31
+ */
32
+ inputSchema?: Readonly<Record<string, unknown>>;
33
+ outputSchema?: Readonly<Record<string, unknown>>;
34
+ }
35
+ type ServerDetails = NonNullable<FarmMCPCatalogDetails>;
36
+ interface FarmAppManifestServer {
37
+ name: string;
38
+ version: string;
39
+ path: string;
40
+ /**
41
+ * `"required"` when the server runs `authorize` or a guard covers its path: an anonymous
42
+ * client lists nothing, so `tools`, `resources` and `prompts` are empty.
43
+ */
44
+ authorization: "none" | "required";
45
+ tools: FarmAppManifestTool[];
46
+ resources: NonNullable<ServerDetails["resources"]>;
47
+ prompts: NonNullable<ServerDetails["prompts"]>;
48
+ }
49
+ /**
50
+ * The manifest document. A section the app hid with `agent.manifest` is `null`, unlike an
51
+ * empty list, which means there is nothing to show.
52
+ */
53
+ interface FarmAppManifest {
54
+ schemaVersion: 1;
55
+ /** `farm`, `renderer` and `build` are left out when `agent.manifest.app` hides them. */
56
+ app: {
57
+ farm?: string;
58
+ renderer?: string;
59
+ basePath: string;
60
+ build?: string;
61
+ } | null;
62
+ /**
63
+ * Installed versions of the app's `@farm.js/*` and `@farming-labs/*` packages; `null`
64
+ * versions with `agent.manifest.packages: "names"`.
65
+ */
66
+ packages: Record<string, string | null> | null;
67
+ mcp: {
68
+ servers: FarmAppManifestServer[];
69
+ } | null;
70
+ /** Browser tools from `@farm.js/webmcp`, read from the app's source. */
71
+ webmcp: {
72
+ enabled: boolean;
73
+ tools: FarmAppManifestWebMCPTool[];
74
+ } | null;
75
+ /** The app's integrations: which slot each fills and which provider, never their config. */
76
+ integrations: {
77
+ key: string;
78
+ category: string;
79
+ type: string;
80
+ }[] | null;
81
+ agent: {
82
+ apiCatalog: string | null;
83
+ llmsTxt: boolean;
84
+ openapi: string | null;
85
+ } | null;
86
+ plugins: string[] | null;
87
+ }
88
+ /** What the manifest reads from config; serializable, so a production build embeds it. */
89
+ interface FarmAppManifestInput {
90
+ renderer: string;
91
+ basePath: string;
92
+ /** The build's ID, or "development". */
93
+ build: string;
94
+ packages: Record<string, string>;
95
+ webmcp: NonNullable<FarmAppManifest["webmcp"]>;
96
+ integrations: NonNullable<FarmAppManifest["integrations"]>;
97
+ agent: NonNullable<FarmAppManifest["agent"]>;
98
+ plugins: string[];
99
+ /** Resolved `agent.manifest` options; every section is shown without them. */
100
+ sections?: ResolvedFarmAppManifestConfig;
101
+ /**
102
+ * The default read-only MCP server (`agent.mcp`) while the app would serve it. Set by the
103
+ * server at runtime, not serialized: it answers only while no other MCP server is listed.
104
+ */
105
+ defaultMCP?: () => {
106
+ name: string;
107
+ version: string;
108
+ path: string;
109
+ } | undefined;
110
+ /**
111
+ * Whether a guard written for a path (middleware, an integration's `protectedRoutes`)
112
+ * covers an MCP server's endpoint. Set by the server at runtime: such a server is listed
113
+ * as requiring authorization, without its tools, resources or prompts.
114
+ */
115
+ guardCoversPath?: (path: string) => boolean;
116
+ }
117
+ /** Answers `/.well-known/farmjs.json`: the same public document for every request. */
118
+ declare function createFarmAppManifestResponse(request: Request, input: FarmAppManifestInput): Promise<Response>;
119
+
120
+ export { type FarmAppManifest as F, type FarmAppManifestServer as a, type FarmAppManifestTool as b, createFarmAppManifestResponse as c };
@@ -0,0 +1,120 @@
1
+ import { b7 as FarmMCPCatalogDetails, b8 as ResolvedFarmAppManifestConfig } from './client-plugins-DIem0I0W.js';
2
+
3
+ interface FarmAppManifestWebMCPTool {
4
+ name: string;
5
+ title?: string;
6
+ description?: string;
7
+ readOnlyHint?: boolean;
8
+ destructiveHint?: boolean;
9
+ idempotentHint?: boolean;
10
+ openWorldHint?: boolean;
11
+ /** The input JSON Schema when the source writes it out; omitted when it's computed. */
12
+ inputSchema?: Record<string, unknown>;
13
+ /** `"computed"` when the schema is built at runtime, so it can't be read from source. */
14
+ inputSchemaSource: "literal" | "computed" | "none";
15
+ }
16
+
17
+ type FarmAppManifestToolSource = "endpoint" | "defineTool" | "serverFunction";
18
+ interface FarmAppManifestTool {
19
+ name: string;
20
+ title?: string;
21
+ description?: string;
22
+ /** How the app defined it: an API endpoint, `defineTool`, or a server function. */
23
+ source: FarmAppManifestToolSource;
24
+ readOnlyHint?: boolean;
25
+ destructiveHint?: boolean;
26
+ idempotentHint?: boolean;
27
+ openWorldHint?: boolean;
28
+ /**
29
+ * JSON Schemas, when the server published them (`@farm.js/mcp` does) and
30
+ * `agent.manifest.mcp.schemas` isn't `false`.
31
+ */
32
+ inputSchema?: Readonly<Record<string, unknown>>;
33
+ outputSchema?: Readonly<Record<string, unknown>>;
34
+ }
35
+ type ServerDetails = NonNullable<FarmMCPCatalogDetails>;
36
+ interface FarmAppManifestServer {
37
+ name: string;
38
+ version: string;
39
+ path: string;
40
+ /**
41
+ * `"required"` when the server runs `authorize` or a guard covers its path: an anonymous
42
+ * client lists nothing, so `tools`, `resources` and `prompts` are empty.
43
+ */
44
+ authorization: "none" | "required";
45
+ tools: FarmAppManifestTool[];
46
+ resources: NonNullable<ServerDetails["resources"]>;
47
+ prompts: NonNullable<ServerDetails["prompts"]>;
48
+ }
49
+ /**
50
+ * The manifest document. A section the app hid with `agent.manifest` is `null`, unlike an
51
+ * empty list, which means there is nothing to show.
52
+ */
53
+ interface FarmAppManifest {
54
+ schemaVersion: 1;
55
+ /** `farm`, `renderer` and `build` are left out when `agent.manifest.app` hides them. */
56
+ app: {
57
+ farm?: string;
58
+ renderer?: string;
59
+ basePath: string;
60
+ build?: string;
61
+ } | null;
62
+ /**
63
+ * Installed versions of the app's `@farm.js/*` and `@farming-labs/*` packages; `null`
64
+ * versions with `agent.manifest.packages: "names"`.
65
+ */
66
+ packages: Record<string, string | null> | null;
67
+ mcp: {
68
+ servers: FarmAppManifestServer[];
69
+ } | null;
70
+ /** Browser tools from `@farm.js/webmcp`, read from the app's source. */
71
+ webmcp: {
72
+ enabled: boolean;
73
+ tools: FarmAppManifestWebMCPTool[];
74
+ } | null;
75
+ /** The app's integrations: which slot each fills and which provider, never their config. */
76
+ integrations: {
77
+ key: string;
78
+ category: string;
79
+ type: string;
80
+ }[] | null;
81
+ agent: {
82
+ apiCatalog: string | null;
83
+ llmsTxt: boolean;
84
+ openapi: string | null;
85
+ } | null;
86
+ plugins: string[] | null;
87
+ }
88
+ /** What the manifest reads from config; serializable, so a production build embeds it. */
89
+ interface FarmAppManifestInput {
90
+ renderer: string;
91
+ basePath: string;
92
+ /** The build's ID, or "development". */
93
+ build: string;
94
+ packages: Record<string, string>;
95
+ webmcp: NonNullable<FarmAppManifest["webmcp"]>;
96
+ integrations: NonNullable<FarmAppManifest["integrations"]>;
97
+ agent: NonNullable<FarmAppManifest["agent"]>;
98
+ plugins: string[];
99
+ /** Resolved `agent.manifest` options; every section is shown without them. */
100
+ sections?: ResolvedFarmAppManifestConfig;
101
+ /**
102
+ * The default read-only MCP server (`agent.mcp`) while the app would serve it. Set by the
103
+ * server at runtime, not serialized: it answers only while no other MCP server is listed.
104
+ */
105
+ defaultMCP?: () => {
106
+ name: string;
107
+ version: string;
108
+ path: string;
109
+ } | undefined;
110
+ /**
111
+ * Whether a guard written for a path (middleware, an integration's `protectedRoutes`)
112
+ * covers an MCP server's endpoint. Set by the server at runtime: such a server is listed
113
+ * as requiring authorization, without its tools, resources or prompts.
114
+ */
115
+ guardCoversPath?: (path: string) => boolean;
116
+ }
117
+ /** Answers `/.well-known/farmjs.json`: the same public document for every request. */
118
+ declare function createFarmAppManifestResponse(request: Request, input: FarmAppManifestInput): Promise<Response>;
119
+
120
+ export { type FarmAppManifest as F, type FarmAppManifestServer as a, type FarmAppManifestTool as b, createFarmAppManifestResponse as c };
@@ -1,5 +1,5 @@
1
- import { al as FarmMdxComponents, am as FarmMdxResolvedConfig, ak as RouteModule } from './client-plugins-B_5QbNrp.mjs';
2
- export { ar as FARM_MARKDOWN_CONTENT_TYPE, ap as FarmMdxComponent, aq as FarmMdxUserConfig, as as createFarmMarkdownErrorBody, at as farmRequestWantsMarkdown, an as resolveFarmMdxComponentsModulePath, ao as resolveMdxConfig } from './client-plugins-B_5QbNrp.mjs';
1
+ import { al as FarmMdxComponents, am as FarmMdxResolvedConfig, ak as RouteModule } from './client-plugins-C9Py_50W.mjs';
2
+ export { ar as FARM_MARKDOWN_CONTENT_TYPE, ap as FarmMdxComponent, aq as FarmMdxUserConfig, as as createFarmMarkdownErrorBody, at as farmRequestWantsMarkdown, an as resolveFarmMdxComponentsModulePath, ao as resolveMdxConfig } from './client-plugins-C9Py_50W.mjs';
3
3
  export { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, FarmMarkdownPageModuleInput, FarmMarkdownPageSource, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, createMarkdownMetadata, isFarmMarkdownPageFile, isFarmMarkdownPublicSourceResponse, normalizeFarmMarkdownRoutePath, parseMarkdownFrontmatter, titleFromMarkdown } from './internal/app-markdown-runtime.mjs';
4
4
  import './lifecycle-DK06VuKP.mjs';
5
5
  import './integration-api-DWyMmvrR.mjs';
@@ -29,7 +29,7 @@ import './server-action-security.mjs';
29
29
  import './layers-CM5i6T7z.mjs';
30
30
  import 'rolldown/utils';
31
31
  import 'rolldown';
32
- import './image-config-Duob7wER.mjs';
32
+ import './image-config-BpH1q5R8.mjs';
33
33
  import './types-CnH8DOqo.mjs';
34
34
  import './types-DQnyD3VD.mjs';
35
35
  import './font.mjs';
@@ -1,5 +1,5 @@
1
- import { al as FarmMdxComponents, am as FarmMdxResolvedConfig, ak as RouteModule } from './client-plugins-DgSfIWIF.js';
2
- export { ar as FARM_MARKDOWN_CONTENT_TYPE, ap as FarmMdxComponent, aq as FarmMdxUserConfig, as as createFarmMarkdownErrorBody, at as farmRequestWantsMarkdown, an as resolveFarmMdxComponentsModulePath, ao as resolveMdxConfig } from './client-plugins-DgSfIWIF.js';
1
+ import { al as FarmMdxComponents, am as FarmMdxResolvedConfig, ak as RouteModule } from './client-plugins-DIem0I0W.js';
2
+ export { ar as FARM_MARKDOWN_CONTENT_TYPE, ap as FarmMdxComponent, aq as FarmMdxUserConfig, as as createFarmMarkdownErrorBody, at as farmRequestWantsMarkdown, an as resolveFarmMdxComponentsModulePath, ao as resolveMdxConfig } from './client-plugins-DIem0I0W.js';
3
3
  export { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, FarmMarkdownPageModuleInput, FarmMarkdownPageSource, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, createMarkdownMetadata, isFarmMarkdownPageFile, isFarmMarkdownPublicSourceResponse, normalizeFarmMarkdownRoutePath, parseMarkdownFrontmatter, titleFromMarkdown } from './internal/app-markdown-runtime.js';
4
4
  import './lifecycle-DK06VuKP.js';
5
5
  import './integration-api-BuPHMeKz.js';
@@ -29,7 +29,7 @@ import './server-action-security.js';
29
29
  import './layers-CM5i6T7z.js';
30
30
  import 'rolldown/utils';
31
31
  import 'rolldown';
32
- import './image-config-Duob7wER.js';
32
+ import './image-config-BpH1q5R8.js';
33
33
  import './types-CnH8DOqo.js';
34
34
  import './types-DQnyD3VD.js';
35
35
  import './font.js';
package/dist/cache.cjs CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkUMQAK3KPcjs = require('./chunk-UMQAK3KP.cjs');
19
+ var _chunk6MVFHNYZcjs = require('./chunk-6MVFHNYZ.cjs');
20
20
  require('./chunk-GS3WR5HX.cjs');
21
21
  require('./chunk-LIUGYUX3.cjs');
22
22
 
@@ -26,7 +26,7 @@ var _chunkNYJMY3JAcjs = require('./chunk-NYJMY3JA.cjs');
26
26
 
27
27
 
28
28
  var _chunkZEG3OPIBcjs = require('./chunk-ZEG3OPIB.cjs');
29
- require('./chunk-DATEWH3W.cjs');
29
+ require('./chunk-6IZWX6ES.cjs');
30
30
  require('./chunk-S3JO3N4H.cjs');
31
31
 
32
32
 
@@ -49,4 +49,4 @@ require('./chunk-S3JO3N4H.cjs');
49
49
 
50
50
 
51
51
 
52
- exports.FarmDataCache = _chunkUMQAK3KPcjs.FarmDataCache; exports.PPR_SHELL_ADAPTER_TTL_SECONDS = _chunkUMQAK3KPcjs.PPR_SHELL_ADAPTER_TTL_SECONDS; exports.applyFarmCacheInvalidationTargets = _chunkUMQAK3KPcjs.applyFarmCacheInvalidationTargets; exports.applyFarmCacheInvalidations = _chunkZEG3OPIBcjs.applyFarmCacheInvalidations; exports.configureFarmCache = _chunkUMQAK3KPcjs.configureFarmCache; exports.createFarmCacheInvalidationStream = _chunkUMQAK3KPcjs.createFarmCacheInvalidationStream; exports.createFarmCacheKey = _chunkNYJMY3JAcjs.createFarmCacheKey; exports.createPathCacheTag = _chunkUMQAK3KPcjs.createPathCacheTag; exports.createRouteDataCacheKey = _chunkNYJMY3JAcjs.createRouteDataCacheKey; exports.createRouteDataCacheTag = _chunkUMQAK3KPcjs.createRouteDataCacheTag; exports.defineCacheKey = _chunkUMQAK3KPcjs.defineCacheKey; exports.getFarmDataCache = _chunkUMQAK3KPcjs.getFarmDataCache; exports.invalidate = _chunkUMQAK3KPcjs.invalidate; exports.invalidateRouteData = _chunkUMQAK3KPcjs.invalidateRouteData; exports.normalizeRevalidatePath = _chunkUMQAK3KPcjs.normalizeRevalidatePath; exports.revalidatePath = _chunkUMQAK3KPcjs.revalidatePath; exports.revalidateTag = _chunkUMQAK3KPcjs.revalidateTag; exports.storageCacheAdapter = _chunkUMQAK3KPcjs.storageCacheAdapter; exports.unstable_cache = _chunkUMQAK3KPcjs.unstable_cache; exports.updateTag = _chunkUMQAK3KPcjs.updateTag;
52
+ exports.FarmDataCache = _chunk6MVFHNYZcjs.FarmDataCache; exports.PPR_SHELL_ADAPTER_TTL_SECONDS = _chunk6MVFHNYZcjs.PPR_SHELL_ADAPTER_TTL_SECONDS; exports.applyFarmCacheInvalidationTargets = _chunk6MVFHNYZcjs.applyFarmCacheInvalidationTargets; exports.applyFarmCacheInvalidations = _chunkZEG3OPIBcjs.applyFarmCacheInvalidations; exports.configureFarmCache = _chunk6MVFHNYZcjs.configureFarmCache; exports.createFarmCacheInvalidationStream = _chunk6MVFHNYZcjs.createFarmCacheInvalidationStream; exports.createFarmCacheKey = _chunkNYJMY3JAcjs.createFarmCacheKey; exports.createPathCacheTag = _chunk6MVFHNYZcjs.createPathCacheTag; exports.createRouteDataCacheKey = _chunkNYJMY3JAcjs.createRouteDataCacheKey; exports.createRouteDataCacheTag = _chunk6MVFHNYZcjs.createRouteDataCacheTag; exports.defineCacheKey = _chunk6MVFHNYZcjs.defineCacheKey; exports.getFarmDataCache = _chunk6MVFHNYZcjs.getFarmDataCache; exports.invalidate = _chunk6MVFHNYZcjs.invalidate; exports.invalidateRouteData = _chunk6MVFHNYZcjs.invalidateRouteData; exports.normalizeRevalidatePath = _chunk6MVFHNYZcjs.normalizeRevalidatePath; exports.revalidatePath = _chunk6MVFHNYZcjs.revalidatePath; exports.revalidateTag = _chunk6MVFHNYZcjs.revalidateTag; exports.storageCacheAdapter = _chunk6MVFHNYZcjs.storageCacheAdapter; exports.unstable_cache = _chunk6MVFHNYZcjs.unstable_cache; exports.updateTag = _chunk6MVFHNYZcjs.updateTag;
package/dist/cache.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  storageCacheAdapter,
17
17
  unstable_cache,
18
18
  updateTag
19
- } from "./chunk-7VAJSSPG.mjs";
19
+ } from "./chunk-B2GSRB3P.mjs";
20
20
  import "./chunk-4GP3XZ4Z.mjs";
21
21
  import "./chunk-C4NCTZLM.mjs";
22
22
  import {
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  applyFarmCacheInvalidations
28
28
  } from "./chunk-4SIYUGRY.mjs";
29
- import "./chunk-Y6LRPO2K.mjs";
29
+ import "./chunk-6LVRDOAW.mjs";
30
30
  import "./chunk-LPEX4YW6.mjs";
31
31
  export {
32
32
  FarmDataCache,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useRouter
3
- } from "./chunk-OLQ73ZO5.mjs";
3
+ } from "./chunk-6PKXK4TY.mjs";
4
4
  import {
5
5
  getRouter
6
6
  } from "./chunk-TS4JHGUJ.mjs";
@@ -4,7 +4,7 @@
4
4
  var _chunkFJ3M4CUXcjs = require('./chunk-FJ3M4CUX.cjs');
5
5
 
6
6
 
7
- var _chunkDATEWH3Wcjs = require('./chunk-DATEWH3W.cjs');
7
+ var _chunk6IZWX6EScjs = require('./chunk-6IZWX6ES.cjs');
8
8
 
9
9
 
10
10
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -143,11 +143,11 @@ function addFarmCspNonceToScriptTags(html, nonce) {
143
143
  return createFarmScriptTagRewriter((tag) => stampScriptTag(tag, nonce)).write(html, true);
144
144
  }
145
145
  _chunkS3JO3N4Hcjs.__name.call(void 0, addFarmCspNonceToScriptTags, "addFarmCspNonceToScriptTags");
146
- function stampFarmCspNonce(html, nonce = _chunkDATEWH3Wcjs._resolveCurrentCspNonce.call(void 0, )) {
146
+ function stampFarmCspNonce(html, nonce = _chunk6IZWX6EScjs._resolveCurrentCspNonce.call(void 0, )) {
147
147
  return nonce && html ? addFarmCspNonceToScriptTags(html, nonce) : html;
148
148
  }
149
149
  _chunkS3JO3N4Hcjs.__name.call(void 0, stampFarmCspNonce, "stampFarmCspNonce");
150
- function replaceFarmCspNonceMarker(html, marker, nonce = _chunkDATEWH3Wcjs._resolveCurrentCspNonce.call(void 0, )) {
150
+ function replaceFarmCspNonceMarker(html, marker, nonce = _chunk6IZWX6EScjs._resolveCurrentCspNonce.call(void 0, )) {
151
151
  validateCspNonce(marker);
152
152
  if (nonce) validateCspNonce(nonce);
153
153
  return createFarmScriptTagRewriter((tag) => {
@@ -34,7 +34,7 @@ import {
34
34
  } from "./chunk-4SIYUGRY.mjs";
35
35
  import {
36
36
  _resolveCurrentRequest
37
- } from "./chunk-Y6LRPO2K.mjs";
37
+ } from "./chunk-6LVRDOAW.mjs";
38
38
  import {
39
39
  __name
40
40
  } from "./chunk-LPEX4YW6.mjs";
@@ -9,7 +9,7 @@ var _chunk7W3CPVXScjs = require('./chunk-7W3CPVXS.cjs');
9
9
  var _chunkAI7QMY7Ocjs = require('./chunk-AI7QMY7O.cjs');
10
10
 
11
11
 
12
- var _chunkXVIEGKTTcjs = require('./chunk-XVIEGKTT.cjs');
12
+ var _chunkZTP3BJG6cjs = require('./chunk-ZTP3BJG6.cjs');
13
13
 
14
14
 
15
15
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -20,12 +20,12 @@ function _setDefaultFarmThemeConfig(config, basePath = "/") {
20
20
  defaultThemeConfig = _chunkOI6CMLWXcjs.resolveFarmThemeConfig.call(void 0, config, basePath);
21
21
  }
22
22
  _chunkS3JO3N4Hcjs.__name.call(void 0, _setDefaultFarmThemeConfig, "_setDefaultFarmThemeConfig");
23
- function getTheme(request = _chunkXVIEGKTTcjs.getCurrentRequestOrNull.call(void 0, )) {
23
+ function getTheme(request = _chunkZTP3BJG6cjs.getCurrentRequestOrNull.call(void 0, )) {
24
24
  if (!request) return defaultThemeConfig.default;
25
25
  return readFarmThemePreference(request, defaultThemeConfig);
26
26
  }
27
27
  _chunkS3JO3N4Hcjs.__name.call(void 0, getTheme, "getTheme");
28
- function getThemeSnapshot(request = _chunkXVIEGKTTcjs.getCurrentRequestOrNull.call(void 0, )) {
28
+ function getThemeSnapshot(request = _chunkZTP3BJG6cjs.getCurrentRequestOrNull.call(void 0, )) {
29
29
  const theme = request ? readFarmThemePreference(request, defaultThemeConfig) : defaultThemeConfig.default;
30
30
  return {
31
31
  theme,
@@ -4,14 +4,14 @@ import {
4
4
  loadFarmDocsPage,
5
5
  resolveFarmDocsContentDir,
6
6
  toFarmDocsMarkdownPage
7
- } from "./chunk-HBEBV7OZ.mjs";
7
+ } from "./chunk-UQUEANTY.mjs";
8
8
  import {
9
9
  docsEngine,
10
10
  loadFarmDocsEngine
11
11
  } from "./chunk-2VQKKQ6D.mjs";
12
12
  import {
13
13
  resolveDocsConfig
14
- } from "./chunk-Y4QVEU67.mjs";
14
+ } from "./chunk-NU25TRIO.mjs";
15
15
  import {
16
16
  getFarmDocsAdapterConfigModule,
17
17
  isSecretDocsConfigKey
@@ -8,8 +8,11 @@ import {
8
8
  resolveSchemaModels
9
9
  } from "./chunk-WDMIW6Q6.mjs";
10
10
  import {
11
- mergeRouteRenderingDirectiveConfig
12
- } from "./chunk-DAO7JGTS.mjs";
11
+ getOptionalCatchAllParameterNames,
12
+ materializeSSGRoutePath,
13
+ mergeRouteRenderingDirectiveConfig,
14
+ normalizeStaticPathParams
15
+ } from "./chunk-COABSY3U.mjs";
13
16
  import {
14
17
  createEnvTypeDeclarations,
15
18
  generateEnvTypes
@@ -29,13 +32,13 @@ import {
29
32
  } from "./chunk-RHAZ22ZN.mjs";
30
33
  import {
31
34
  discoverProgrammaticRoutePaths
32
- } from "./chunk-MOSYH4CY.mjs";
35
+ } from "./chunk-FWCGUVVL.mjs";
33
36
  import {
34
37
  readFarmI18nCatalogs
35
38
  } from "./chunk-QCFBDFRS.mjs";
36
39
  import {
37
40
  resolvePluginRoutes
38
- } from "./chunk-2DMWQWNJ.mjs";
41
+ } from "./chunk-MEASUNVY.mjs";
39
42
  import {
40
43
  parseRoutePath
41
44
  } from "./chunk-KI3MESHB.mjs";
@@ -44,10 +47,8 @@ import {
44
47
  } from "./chunk-LPEX4YW6.mjs";
45
48
 
46
49
  // src/ssg.ts
50
+ import { readFileSync } from "fs";
47
51
  import { readFile } from "fs/promises";
48
- var OPTIONAL_CATCH_ALL_SEGMENT = /^\[\[\.\.\.([^\]]+)\]\]$/;
49
- var REQUIRED_CATCH_ALL_SEGMENT = /^\[\.\.\.([^\]]+)\]$/;
50
- var REQUIRED_DYNAMIC_SEGMENT = /^\[([^\]]+)\]$/;
51
52
  var REQUEST_API_LABELS = /* @__PURE__ */ new Map([
52
53
  ["cookies", "request cookies"],
53
54
  ["headers", "request headers"],
@@ -317,6 +318,17 @@ function parseRouteRenderingDirective(source) {
317
318
  return void 0;
318
319
  }
319
320
  __name(parseRouteRenderingDirective, "parseRouteRenderingDirective");
321
+ function readRouteRenderingDirectiveFromFile(modulePath) {
322
+ try {
323
+ const source = readFileSync(modulePath, "utf8");
324
+ const directive = parseRouteRenderingDirective(source);
325
+ if (findRequestBoundSourceBlockers(source).length === 0) return directive;
326
+ return { ...directive ?? { ssg: false, ppr: false, directive: "" }, requestBound: true };
327
+ } catch {
328
+ return void 0;
329
+ }
330
+ }
331
+ __name(readRouteRenderingDirectiveFromFile, "readRouteRenderingDirectiveFromFile");
320
332
  function parseKnownRenderingDirective(directive) {
321
333
  const normalized = directive.trim().toLowerCase();
322
334
  const match = normalized.match(
@@ -495,121 +507,6 @@ Add \`export const dynamic = "force-static";\` after verifying that imported cod
495
507
  return { ssg: ssgPages, ssr: ssrRoutes };
496
508
  }
497
509
  __name(collectSSGPages, "collectSSGPages");
498
- function materializeSSGRoutePath(routePattern, params) {
499
- const outputSegments = [];
500
- for (const segment of routePattern.split("/")) {
501
- if (!segment) {
502
- continue;
503
- }
504
- const optionalCatchAll = segment.match(OPTIONAL_CATCH_ALL_SEGMENT);
505
- if (optionalCatchAll) {
506
- const parameterName = optionalCatchAll[1];
507
- const value = params[parameterName];
508
- const values = readCatchAllSegments(value, {
509
- optional: true,
510
- parameterName,
511
- routePattern
512
- });
513
- outputSegments.push(...values.map(encodePathSegment));
514
- continue;
515
- }
516
- const requiredCatchAll = segment.match(REQUIRED_CATCH_ALL_SEGMENT);
517
- if (requiredCatchAll) {
518
- const parameterName = requiredCatchAll[1];
519
- const value = params[parameterName];
520
- const values = readCatchAllSegments(value, {
521
- optional: false,
522
- parameterName,
523
- routePattern
524
- });
525
- outputSegments.push(...values.map(encodePathSegment));
526
- continue;
527
- }
528
- const requiredDynamic = segment.match(REQUIRED_DYNAMIC_SEGMENT);
529
- if (requiredDynamic) {
530
- const parameterName = requiredDynamic[1];
531
- const value = params[parameterName];
532
- if (isStaticPathArray(value)) {
533
- throw new Error(
534
- `Cannot materialize SSG route "${routePattern}": parameter "${parameterName}" must be a scalar value; arrays are only supported for catch-all segments.`
535
- );
536
- }
537
- if (isMissingPathValue(value)) {
538
- throw missingRequiredParameterError(routePattern, parameterName);
539
- }
540
- outputSegments.push(encodePathSegment(value));
541
- continue;
542
- }
543
- outputSegments.push(segment);
544
- }
545
- return outputSegments.length > 0 ? `/${outputSegments.join("/")}` : "/";
546
- }
547
- __name(materializeSSGRoutePath, "materializeSSGRoutePath");
548
- function readCatchAllSegments(value, options) {
549
- if (isMissingPathValue(value) || isStaticPathArray(value) && value.length === 0) {
550
- if (options.optional) {
551
- return [];
552
- }
553
- throw missingRequiredParameterError(options.routePattern, options.parameterName);
554
- }
555
- const segments = isStaticPathArray(value) ? [...value] : [value];
556
- if (segments.some(isMissingPathValue)) {
557
- throw new Error(
558
- `Cannot materialize SSG route "${options.routePattern}": catch-all parameter "${options.parameterName}" contains an empty path segment.`
559
- );
560
- }
561
- return segments;
562
- }
563
- __name(readCatchAllSegments, "readCatchAllSegments");
564
- function getOptionalCatchAllParameterNames(routePattern) {
565
- return new Set(
566
- routePattern.split("/").map((segment) => segment.match(OPTIONAL_CATCH_ALL_SEGMENT)?.[1]).filter((name) => Boolean(name))
567
- );
568
- }
569
- __name(getOptionalCatchAllParameterNames, "getOptionalCatchAllParameterNames");
570
- function normalizeStaticPathParams(params, optionalCatchAllParams) {
571
- const entries = Object.entries(params).map(([key, value]) => {
572
- const emptyOptionalCatchAll = optionalCatchAllParams.has(key) && (isMissingPathValue(value) || isStaticPathArray(value) && value.length === 0);
573
- return [
574
- key,
575
- emptyOptionalCatchAll ? "" : isStaticPathArray(value) ? value.map(String).join("/") : String(value)
576
- ];
577
- });
578
- for (const name of optionalCatchAllParams) {
579
- if (!Object.prototype.hasOwnProperty.call(params, name)) {
580
- entries.push([name, ""]);
581
- }
582
- }
583
- return Object.fromEntries(entries);
584
- }
585
- __name(normalizeStaticPathParams, "normalizeStaticPathParams");
586
- function isMissingPathValue(value) {
587
- return value === "" || value === null || typeof value === "undefined";
588
- }
589
- __name(isMissingPathValue, "isMissingPathValue");
590
- function isStaticPathArray(value) {
591
- return Array.isArray(value);
592
- }
593
- __name(isStaticPathArray, "isStaticPathArray");
594
- function missingRequiredParameterError(routePattern, parameterName) {
595
- return new Error(
596
- `Cannot materialize SSG route "${routePattern}": required parameter "${parameterName}" is missing or empty.`
597
- );
598
- }
599
- __name(missingRequiredParameterError, "missingRequiredParameterError");
600
- function encodePathSegment(value) {
601
- const encoded = encodeURIComponent(String(value)).replace(
602
- /[!'()*]/g,
603
- (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`
604
- );
605
- if (encoded === "." || encoded === "..") {
606
- throw new Error(
607
- `Cannot materialize SSG path segment "${encoded}": dot-only segments are unsafe to prerender.`
608
- );
609
- }
610
- return encoded;
611
- }
612
- __name(encodePathSegment, "encodePathSegment");
613
510
  function isSSGModule(mod) {
614
511
  return resolveRouteRenderingConfig(mod).ssg;
615
512
  }
@@ -891,7 +788,7 @@ function argumentType(kind) {
891
788
  __name(argumentType, "argumentType");
892
789
 
893
790
  // src/type-artifacts.ts
894
- import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync, unlinkSync } from "fs";
791
+ import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync2, unlinkSync } from "fs";
895
792
  import { dirname as dirname4, isAbsolute as isAbsolute3, join as join4, resolve as resolve4 } from "path";
896
793
 
897
794
  // src/content-types.ts
@@ -1292,7 +1189,7 @@ function writeOrCheckGeneratedFile(filePath, content, check, stalePaths) {
1292
1189
  }
1293
1190
  __name(writeOrCheckGeneratedFile, "writeOrCheckGeneratedFile");
1294
1191
  function checkGeneratedFile(filePath, content, stalePaths) {
1295
- if (!existsSync3(filePath) || readFileSync(filePath, "utf8") !== content) {
1192
+ if (!existsSync3(filePath) || readFileSync2(filePath, "utf8") !== content) {
1296
1193
  stalePaths.push(filePath);
1297
1194
  }
1298
1195
  }
@@ -1307,7 +1204,7 @@ function removeLegacyTypeArtifacts(root, srcDir) {
1307
1204
  for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
1308
1205
  const filePath = join4(root, srcDir, fileName);
1309
1206
  if (!existsSync3(filePath)) continue;
1310
- const source = readFileSync(filePath, "utf8");
1207
+ const source = readFileSync2(filePath, "utf8");
1311
1208
  if (source.includes(marker)) {
1312
1209
  unlinkSync(filePath);
1313
1210
  }
@@ -1318,7 +1215,7 @@ function collectLegacyTypeArtifacts(root, srcDir, stalePaths) {
1318
1215
  for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
1319
1216
  const filePath = join4(root, srcDir, fileName);
1320
1217
  if (!existsSync3(filePath)) continue;
1321
- if (readFileSync(filePath, "utf8").includes(marker)) stalePaths.push(filePath);
1218
+ if (readFileSync2(filePath, "utf8").includes(marker)) stalePaths.push(filePath);
1322
1219
  }
1323
1220
  }
1324
1221
  __name(collectLegacyTypeArtifacts, "collectLegacyTypeArtifacts");
@@ -1329,6 +1226,7 @@ export {
1329
1226
  analyzeStaticRouteCandidate,
1330
1227
  findRequestBoundSourceBlockers,
1331
1228
  parseRouteRenderingDirective,
1229
+ readRouteRenderingDirectiveFromFile,
1332
1230
  collectSSGPages,
1333
1231
  isSSGModule,
1334
1232
  hasISR,