@farm.js/core 0.1.70 → 0.1.71

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 (184) hide show
  1. package/dist/{agent-mcp-handler-6T2Z7TB6.cjs → agent-mcp-handler-KE4J3W7S.cjs} +3 -3
  2. package/dist/{agent-mcp-handler-CPU354QQ.mjs → agent-mcp-handler-VIT4GOSR.mjs} +2 -2
  3. package/dist/{agent-mcp.d-DulgFLBt.d.ts → agent-mcp.d-BzNw6JI8.d.ts} +14 -4
  4. package/dist/{agent-mcp.d-TAs1ES2F.d.mts → agent-mcp.d-CgFen3EH.d.mts} +14 -4
  5. package/dist/agent-runtime.d.mts +1 -1
  6. package/dist/agent-runtime.d.ts +1 -1
  7. package/dist/analyzer-LPIVRSTJ.cjs +16 -0
  8. package/dist/{analyzer-QGRBLETM.mjs → analyzer-VK3BAOFI.mjs} +2 -2
  9. package/dist/api/node.d.mts +3 -3
  10. package/dist/api/node.d.ts +3 -3
  11. package/dist/api/route-manager.d.mts +3 -3
  12. package/dist/api/route-manager.d.ts +3 -3
  13. package/dist/api/runtime.d.mts +2 -2
  14. package/dist/api/runtime.d.ts +2 -2
  15. package/dist/api.d.mts +4 -4
  16. package/dist/api.d.ts +4 -4
  17. package/dist/{app-manifest.d-C-nf3Vmm.d.ts → app-manifest.d-DY4JfJxi.d.ts} +1 -1
  18. package/dist/{app-manifest.d-6zXb90o6.d.mts → app-manifest.d-DpDK_B1k.d.mts} +1 -1
  19. package/dist/app-markdown.cjs +5 -3
  20. package/dist/app-markdown.d.mts +3 -3
  21. package/dist/app-markdown.d.ts +3 -3
  22. package/dist/app-markdown.mjs +4 -2
  23. package/dist/{app.d-C2xeMIYT.d.ts → app.d-BeK6bb1c.d.ts} +8 -6
  24. package/dist/{app.d-DF0aundc.d.mts → app.d-D-5UNrFd.d.mts} +8 -6
  25. package/dist/{chunk-HAXFV2CD.mjs → chunk-2CQC5CMD.mjs} +1 -1
  26. package/dist/{chunk-IEN2EFE5.cjs → chunk-2IFT2CSA.cjs} +4 -4
  27. package/dist/{chunk-BPUVDCGG.cjs → chunk-3BQ7QHUH.cjs} +3 -3
  28. package/dist/{chunk-JFVT5ZZV.mjs → chunk-4OD2LXF2.mjs} +1 -1
  29. package/dist/{chunk-CCHJWJGP.mjs → chunk-7BUE2GM6.mjs} +141 -86
  30. package/dist/{chunk-FJ5YCERM.cjs → chunk-7OHJWFLB.cjs} +387 -331
  31. package/dist/{chunk-5R3JQPWD.mjs → chunk-AYVGD3PK.mjs} +1 -1
  32. package/dist/{chunk-K7JMTAFH.cjs → chunk-CSQPMV3Q.cjs} +16 -6
  33. package/dist/{chunk-N62IYXYD.mjs → chunk-DPIGYXSV.mjs} +1 -1
  34. package/dist/{chunk-LECZ5DPZ.cjs → chunk-DPYBVVL3.cjs} +2 -2
  35. package/dist/{chunk-RMOU3PR4.mjs → chunk-GUU3IZSM.mjs} +63 -23
  36. package/dist/{chunk-EDZU7YRK.mjs → chunk-IGXS54GC.mjs} +2 -2
  37. package/dist/{chunk-3WS5AZ3R.mjs → chunk-IYDJNCR7.mjs} +1 -1
  38. package/dist/{chunk-R7254L3R.mjs → chunk-J5ASGNKF.mjs} +23 -0
  39. package/dist/{chunk-75E5FDX2.mjs → chunk-JMFTKNBA.mjs} +10 -10
  40. package/dist/{chunk-DIHBWZDZ.cjs → chunk-JVA4PIYN.cjs} +408 -294
  41. package/dist/{chunk-XYVPTTUT.cjs → chunk-KEB7AGS6.cjs} +4 -4
  42. package/dist/{chunk-TLSSIYAL.mjs → chunk-KQAB5LML.mjs} +10 -3
  43. package/dist/{chunk-M6U6E4F7.cjs → chunk-KWST2O22.cjs} +108 -68
  44. package/dist/{chunk-NSZY3EWG.cjs → chunk-L6E4SHUB.cjs} +31 -8
  45. package/dist/{chunk-MZLJFNMH.cjs → chunk-MEJCP2LX.cjs} +1 -1
  46. package/dist/{chunk-A2TH5MKE.mjs → chunk-MITIAOUQ.mjs} +3 -3
  47. package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
  48. package/dist/{chunk-4AC4PXZO.cjs → chunk-N3XO5AL5.cjs} +2 -2
  49. package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
  50. package/dist/{chunk-32SYRIQ7.cjs → chunk-PLXD2MJV.cjs} +3 -3
  51. package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
  52. package/dist/{chunk-3EXCZJEN.mjs → chunk-QUFENL7Q.mjs} +1 -1
  53. package/dist/{chunk-NYF7A4UW.mjs → chunk-RJUCNO7R.mjs} +1 -1
  54. package/dist/{chunk-K4UGCUXX.cjs → chunk-SXMWVP2L.cjs} +7 -7
  55. package/dist/{chunk-VG6HYT5K.cjs → chunk-TP4RAV7Y.cjs} +9 -9
  56. package/dist/{chunk-I7NUT24Z.cjs → chunk-UISZLYKY.cjs} +2 -2
  57. package/dist/{chunk-KPMLDT3B.mjs → chunk-UQUOSNRN.mjs} +378 -264
  58. package/dist/{chunk-QZHTDVH4.mjs → chunk-V25GSH43.mjs} +1 -1
  59. package/dist/{chunk-65FPDDT4.cjs → chunk-VXB5CMNC.cjs} +2 -2
  60. package/dist/{chunk-5IJRJWJS.mjs → chunk-W2T6NDNP.mjs} +10 -0
  61. package/dist/{chunk-JRF2SKCD.mjs → chunk-X7LGLF33.mjs} +1 -1
  62. package/dist/{chunk-QEWWKYDL.cjs → chunk-YCNHUIPR.cjs} +17 -10
  63. package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
  64. package/dist/{chunk-A7HCBHMC.cjs → chunk-ZPUAOKHV.cjs} +3 -3
  65. package/dist/{client-component.d-Bk5qKJM-.d.mts → client-component.d-DwpH251K.d.mts} +2 -2
  66. package/dist/{client-component.d-DNbC4oWI.d.ts → client-component.d-fYupugbZ.d.ts} +2 -2
  67. package/dist/{client-plugins.d-DwUqh4gp.d.ts → client-plugins.d-BxqFfHpM.d.ts} +8 -5
  68. package/dist/{client-plugins.d-Pi9nG0W0.d.mts → client-plugins.d-k3bOT5gz.d.mts} +8 -5
  69. package/dist/client-plugins.d.mts +1 -1
  70. package/dist/client-plugins.d.ts +1 -1
  71. package/dist/client.d.mts +6 -6
  72. package/dist/client.d.ts +6 -6
  73. package/dist/config.d.mts +1 -1
  74. package/dist/config.d.ts +1 -1
  75. package/dist/desktop.d.mts +2 -2
  76. package/dist/desktop.d.ts +2 -2
  77. package/dist/{devtools-CB43AHEP.mjs → devtools-6MXPFPNJ.mjs} +2 -2
  78. package/dist/{devtools-L5DUNDF3.cjs → devtools-O5625KCK.cjs} +3 -3
  79. package/dist/docs.cjs +4 -4
  80. package/dist/docs.d.mts +2 -2
  81. package/dist/docs.d.ts +2 -2
  82. package/dist/docs.mjs +3 -3
  83. package/dist/environment/vite.cjs +3 -3
  84. package/dist/environment/vite.mjs +2 -2
  85. package/dist/{headers.d-CE6OWB-n.d.ts → headers.d-DalIGbVO.d.ts} +1 -1
  86. package/dist/{headers.d-DED1hHh4.d.mts → headers.d-sNT7ZQiU.d.mts} +1 -1
  87. package/dist/index.cjs +20 -18
  88. package/dist/{index.d-c9UwIqDy.d.ts → index.d-BcA-secm.d.ts} +1 -1
  89. package/dist/{index.d-CbvOjJcp.d.mts → index.d-DDHHAv7j.d.mts} +1 -1
  90. package/dist/index.d.mts +18 -18
  91. package/dist/index.d.ts +18 -18
  92. package/dist/index.mjs +19 -17
  93. package/dist/integrations/orm.d.mts +1 -1
  94. package/dist/integrations/orm.d.ts +1 -1
  95. package/dist/integrations.d.mts +1 -1
  96. package/dist/integrations.d.ts +1 -1
  97. package/dist/internal/app-markdown-runtime.cjs +4 -2
  98. package/dist/internal/app-markdown-runtime.d.mts +11 -3
  99. package/dist/internal/app-markdown-runtime.d.ts +11 -3
  100. package/dist/internal/app-markdown-runtime.mjs +3 -1
  101. package/dist/internal/build-runtime.cjs +19 -19
  102. package/dist/internal/build-runtime.d.mts +3 -3
  103. package/dist/internal/build-runtime.d.ts +3 -3
  104. package/dist/internal/build-runtime.mjs +18 -18
  105. package/dist/internal/cli-runtime.cjs +6 -4
  106. package/dist/internal/cli-runtime.mjs +5 -3
  107. package/dist/internal/client-error-overlay.cjs +4 -4
  108. package/dist/internal/client-error-overlay.mjs +1 -1
  109. package/dist/internal/client-runtime.d.mts +4 -4
  110. package/dist/internal/client-runtime.d.ts +4 -4
  111. package/dist/internal/compression-runtime.d.mts +1 -1
  112. package/dist/internal/compression-runtime.d.ts +1 -1
  113. package/dist/internal/config-runtime.cjs +4 -4
  114. package/dist/internal/config-runtime.d.mts +3 -3
  115. package/dist/internal/config-runtime.d.ts +3 -3
  116. package/dist/internal/config-runtime.mjs +3 -3
  117. package/dist/internal/infra-analytics-runtime.cjs +7 -7
  118. package/dist/internal/infra-analytics-runtime.mjs +5 -5
  119. package/dist/internal/native-server-fns.cjs +4 -4
  120. package/dist/internal/native-server-fns.mjs +3 -3
  121. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  122. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  123. package/dist/internal/production-runtime.cjs +6 -6
  124. package/dist/internal/production-runtime.d.mts +14 -9
  125. package/dist/internal/production-runtime.d.ts +14 -9
  126. package/dist/internal/production-runtime.mjs +5 -5
  127. package/dist/markdown.d.mts +1 -1
  128. package/dist/markdown.d.ts +1 -1
  129. package/dist/middleware.d.mts +1 -1
  130. package/dist/middleware.d.ts +1 -1
  131. package/dist/{mount.d-BvWxf8ZE.d.mts → mount.d-C1PONsEe.d.mts} +1 -1
  132. package/dist/{mount.d-DngLY7NL.d.ts → mount.d-D3JOux2V.d.ts} +1 -1
  133. package/dist/{navigation-delegate.d-CMyl1h2l.d.mts → navigation-delegate.d-CJQQHboA.d.mts} +1 -1
  134. package/dist/{navigation-delegate.d-zZogiDfa.d.ts → navigation-delegate.d-CQQPbdkE.d.ts} +1 -1
  135. package/dist/navigation.d.mts +4 -4
  136. package/dist/navigation.d.ts +4 -4
  137. package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
  138. package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
  139. package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
  140. package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
  141. package/dist/plugin.cjs +13 -13
  142. package/dist/plugin.d.mts +4 -4
  143. package/dist/plugin.d.ts +4 -4
  144. package/dist/plugin.mjs +12 -12
  145. package/dist/{render-plan.d-Di1znBDW.d.mts → render-plan.d-CiUj0rq5.d.mts} +1 -1
  146. package/dist/{render-plan.d-DQj2bzd2.d.ts → render-plan.d-DHuJMJRP.d.ts} +1 -1
  147. package/dist/renderer-client.d.mts +4 -4
  148. package/dist/renderer-client.d.ts +4 -4
  149. package/dist/{request.d-CJWzfDYJ.d.mts → request.d-D-F7o7tb.d.mts} +1 -1
  150. package/dist/{request.d-C5vyoYeL.d.ts → request.d-DRUbOmYD.d.ts} +1 -1
  151. package/dist/request.d.mts +2 -2
  152. package/dist/request.d.ts +2 -2
  153. package/dist/{route-rendering.d-C-et2TZ1.d.mts → route-rendering.d-6smgwT2t.d.mts} +1 -1
  154. package/dist/{route-rendering.d-DhsY5M2I.d.ts → route-rendering.d-KwqM_mlK.d.ts} +1 -1
  155. package/dist/{router.d-CJB-Ntni.d.ts → router.d-B6sesMRD.d.ts} +1 -1
  156. package/dist/{router.d-BMDS5s5X.d.mts → router.d-BYmDeDlp.d.mts} +1 -1
  157. package/dist/routes.d.mts +1 -1
  158. package/dist/routes.d.ts +1 -1
  159. package/dist/{rsc-pipeline-NJKLZ3YE.cjs → rsc-pipeline-P4PCWDO2.cjs} +4 -4
  160. package/dist/{rsc-pipeline-AXQJCCHI.mjs → rsc-pipeline-R2GOKIMU.mjs} +3 -3
  161. package/dist/{runtime-JXNEKOSE.mjs → runtime-DP5DYGW5.mjs} +3 -3
  162. package/dist/{runtime-DMW6DDOI.cjs → runtime-WA2Q4SLG.cjs} +5 -5
  163. package/dist/{runtime.d-BonodRI9.d.mts → runtime.d-BFSJf-ww.d.mts} +1 -1
  164. package/dist/{runtime.d-uw4123iI.d.ts → runtime.d-CbdMI0Oy.d.ts} +1 -1
  165. package/dist/server-plugins.d.mts +3 -3
  166. package/dist/server-plugins.d.ts +3 -3
  167. package/dist/server.cjs +33 -33
  168. package/dist/server.d.mts +10 -10
  169. package/dist/server.d.ts +10 -10
  170. package/dist/server.mjs +15 -15
  171. package/dist/{spa-router.d-rha3M95y.d.mts → spa-router.d-D4EDwR20.d.mts} +2 -2
  172. package/dist/{spa-router.d-l0d9pPZj.d.ts → spa-router.d-mC1D5cTN.d.ts} +2 -2
  173. package/dist/testing.d.mts +1 -1
  174. package/dist/testing.d.ts +1 -1
  175. package/dist/{utils.d-BK-PTOF8.d.ts → utils.d-A2X3a6z_.d.ts} +1 -1
  176. package/dist/{utils.d-BzuTobEc.d.mts → utils.d-DxMzteqE.d.mts} +1 -1
  177. package/dist/version.cjs +2 -2
  178. package/dist/version.mjs +1 -1
  179. package/dist/vite.cjs +13 -13
  180. package/dist/vite.d.mts +7 -5
  181. package/dist/vite.d.ts +7 -5
  182. package/dist/vite.mjs +12 -12
  183. package/package.json +2 -2
  184. package/dist/analyzer-GUIRJWZH.cjs +0 -16
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createFarmMarkdownRouteModule
3
- } from "./chunk-R7254L3R.mjs";
3
+ } from "./chunk-J5ASGNKF.mjs";
4
4
 
5
5
  // src/app-markdown.ts
6
6
  import { readFile } from "fs/promises";
@@ -28,6 +28,9 @@ var _chunkAQIRXBBYcjs = require('./chunk-AQIRXBBY.cjs');
28
28
  var _chunkMTBDJ326cjs = require('./chunk-MTBDJ326.cjs');
29
29
 
30
30
 
31
+ var _chunkL6E4SHUBcjs = require('./chunk-L6E4SHUB.cjs');
32
+
33
+
31
34
  var _chunkGBMWLDCCcjs = require('./chunk-GBMWLDCC.cjs');
32
35
 
33
36
 
@@ -420,6 +423,13 @@ async function collectSSGPages(routes, loadModule, options = {}) {
420
423
  continue;
421
424
  }
422
425
  const source = await _promises.readFile.call(void 0, route.filePath, "utf8").catch(() => void 0);
426
+ if (_optionalChain([options, 'access', _41 => _41.docsAdapterRoutes, 'optionalAccess', _42 => _42.owns, 'call', _43 => _43(route.path)]) && _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, route.filePath)) {
427
+ ssrRoutes.push(route.path);
428
+ if (options.suggestStaticRendering !== false && analyzeStaticRouteCandidate(null, source, { isDynamic: route.isDynamic }).candidate) {
429
+ staticCandidateDocsPages += 1;
430
+ }
431
+ continue;
432
+ }
423
433
  const configuredRendering = resolveConfiguredRouteRenderingConfig(mod, source);
424
434
  const rendering = resolveRouteRenderingConfig(mod, source);
425
435
  if (configuredRendering.ssg && !rendering.ssg && source) {
@@ -458,7 +468,7 @@ async function collectSSGPages(routes, loadModule, options = {}) {
458
468
  } else {
459
469
  ssrRoutes.push(route.path);
460
470
  if (options.suggestStaticRendering !== false && analyzeStaticRouteCandidate(mod, source, { isDynamic: route.isDynamic }).candidate) {
461
- if (_optionalChain([options, 'access', _41 => _41.docsAdapterRoutes, 'optionalAccess', _42 => _42.owns, 'call', _43 => _43(route.path)])) staticCandidateDocsPages += 1;
471
+ if (_optionalChain([options, 'access', _44 => _44.docsAdapterRoutes, 'optionalAccess', _45 => _45.owns, 'call', _46 => _46(route.path)])) staticCandidateDocsPages += 1;
462
472
  else staticCandidateRoutes.push(route.path);
463
473
  }
464
474
  }
@@ -478,7 +488,7 @@ async function collectSSGPages(routes, loadModule, options = {}) {
478
488
  Add \`export const dynamic = "force-static";\` after verifying that imported code does not read cookies, headers, authentication, or other request data.`
479
489
  );
480
490
  }
481
- if (staticCandidateDocsPages > 0 && !_optionalChain([options, 'access', _44 => _44.docsAdapterRoutes, 'optionalAccess', _45 => _45.prerender])) {
491
+ if (staticCandidateDocsPages > 0 && !_optionalChain([options, 'access', _47 => _47.docsAdapterRoutes, 'optionalAccess', _48 => _48.prerender])) {
482
492
  console.warn(
483
493
  `[Farm.js] ${staticCandidateDocsPages} docs page${staticCandidateDocsPages === 1 ? " renders" : "s render"} on each request. Set \`docs.prerender: true\` in farm.config.ts to prerender docs pages on Node and serverless targets.`
484
494
  );
@@ -760,7 +770,7 @@ function fieldTsType(field) {
760
770
  case "json":
761
771
  return "unknown";
762
772
  case "enum":
763
- return _optionalChain([field, 'access', _46 => _46.values, 'optionalAccess', _47 => _47.length]) ? field.values.map((value) => JSON.stringify(value)).join(" | ") : "string";
773
+ return _optionalChain([field, 'access', _49 => _49.values, 'optionalAccess', _50 => _50.length]) ? field.values.map((value) => JSON.stringify(value)).join(" | ") : "string";
764
774
  // id, uuid, string, text, datetime all travel as strings over JSON.
765
775
  default:
766
776
  return "string";
@@ -784,7 +794,7 @@ async function generateFarmTypeArtifacts(options) {
784
794
  const shouldGenerateApi = options.api !== false;
785
795
  const shouldGenerateEnv = options.env !== false;
786
796
  const shouldGenerateImages = options.images !== false;
787
- const shouldGenerateI18n = options.i18n !== false && _optionalChain([options, 'access', _48 => _48.i18nConfig, 'optionalAccess', _49 => _49.enabled]);
797
+ const shouldGenerateI18n = options.i18n !== false && _optionalChain([options, 'access', _51 => _51.i18nConfig, 'optionalAccess', _52 => _52.enabled]);
788
798
  const sourceRoots = _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, { root, srcDir, layers: options.layers });
789
799
  const appDirs = _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, { root, srcDir, layers: options.layers });
790
800
  const result = {
@@ -829,7 +839,7 @@ async function generateFarmTypeArtifacts(options) {
829
839
  const apiRoutes = generator.scanAPIRoutes();
830
840
  const apiTypesPath = options.apiTypesOutFile ? _path.resolve.call(void 0, root, options.apiTypesOutFile) : _path.join.call(void 0, root, srcDir, "lib", "api.generated.ts");
831
841
  const pluginRoutes = _chunk2AFW7673cjs.resolvePluginRoutes.call(void 0,
832
- _optionalChain([options, 'access', _50 => _50.plugins, 'optionalAccess', _51 => _51.filter, 'call', _52 => _52((plugin) => plugin.name !== _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN)])
842
+ _optionalChain([options, 'access', _53 => _53.plugins, 'optionalAccess', _54 => _54.filter, 'call', _55 => _55((plugin) => plugin.name !== _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN)])
833
843
  );
834
844
  const configFiles = [
835
845
  ...(_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.configFile).filter((file) => Boolean(file)),
@@ -906,7 +916,7 @@ async function generateFarmTypeArtifacts(options) {
906
916
  });
907
917
  }
908
918
  }
909
- if (shouldRefreshUnifiedTypes && _optionalChain([options, 'access', _53 => _53.i18nConfig, 'optionalAccess', _54 => _54.enabled]) && !options.i18nTypesOutFile) {
919
+ if (shouldRefreshUnifiedTypes && _optionalChain([options, 'access', _56 => _56.i18nConfig, 'optionalAccess', _57 => _57.enabled]) && !options.i18nTypesOutFile) {
910
920
  const { signatures } = await _chunkBBPDJGCUcjs.readFarmI18nCatalogs.call(void 0, options.i18nConfig);
911
921
  unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
912
922
  result.i18nTypesPath = unifiedTypesPath;
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-423SSBYQ.mjs";
16
16
  import {
17
17
  FARM_VERSION
18
- } from "./chunk-NYF7A4UW.mjs";
18
+ } from "./chunk-RJUCNO7R.mjs";
19
19
 
20
20
  // src/mobile/analyzer.ts
21
21
  import { createHash } from "crypto";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkMZLJFNMHcjs = require('./chunk-MZLJFNMH.cjs');
3
+ var _chunkMEJCP2LXcjs = require('./chunk-MEJCP2LX.cjs');
4
4
 
5
5
  // src/deployment-environment.ts
6
6
  function isFarmProductionDeploymentEnvironment(env = process.env) {
@@ -90,7 +90,7 @@ function createFarmProductionSiteReporter(options) {
90
90
  schemaVersion: FARM_PRODUCTION_SITE_TELEMETRY_SCHEMA_VERSION,
91
91
  eventType: FARM_PRODUCTION_SITE_ATTESTATION_EVENT_TYPE,
92
92
  packageName: FARM_PRODUCTION_SITE_TELEMETRY_PACKAGE_NAME,
93
- packageVersion: sanitizeDetail(_chunkMZLJFNMHcjs.FARM_VERSION, "unknown"),
93
+ packageVersion: sanitizeDetail(_chunkMEJCP2LXcjs.FARM_VERSION, "unknown"),
94
94
  renderer: sanitizeDetail(options.renderer, "custom"),
95
95
  deployTarget: sanitizeDetail(options.deployTarget, "custom")
96
96
  };
@@ -9,7 +9,7 @@ import {
9
9
  collectSSGPages,
10
10
  matchSSGPage,
11
11
  resolveRouteRenderingConfigFromFile
12
- } from "./chunk-5IJRJWJS.mjs";
12
+ } from "./chunk-W2T6NDNP.mjs";
13
13
  import {
14
14
  createFarmMetadataImageResponse
15
15
  } from "./chunk-CROAFCMW.mjs";
@@ -42,7 +42,7 @@ import {
42
42
  } from "./chunk-NA77GEIU.mjs";
43
43
  import {
44
44
  listFarmMCPLlmsTxtLinks
45
- } from "./chunk-A2TH5MKE.mjs";
45
+ } from "./chunk-MITIAOUQ.mjs";
46
46
  import {
47
47
  FARM_DEFAULT_MCP_PATH,
48
48
  collectFarmDefaultMCPPages,
@@ -50,7 +50,7 @@ import {
50
50
  farmConfigMountsMCP,
51
51
  isFarmDefaultMCPPathname,
52
52
  resolveFarmDefaultMCPServer
53
- } from "./chunk-75E5FDX2.mjs";
53
+ } from "./chunk-JMFTKNBA.mjs";
54
54
  import {
55
55
  getFarmFormState,
56
56
  handleFarmFormActionRequest,
@@ -76,7 +76,7 @@ import {
76
76
  resolveProgrammaticClientRoutes,
77
77
  runWithPackageClientBoundaryCacheFile,
78
78
  usesFarmServerTree
79
- } from "./chunk-JRF2SKCD.mjs";
79
+ } from "./chunk-X7LGLF33.mjs";
80
80
  import {
81
81
  FARM_ISLAND_REPLAYABLE_SELECTOR
82
82
  } from "./chunk-S32PDOLO.mjs";
@@ -93,7 +93,7 @@ import {
93
93
  } from "./chunk-TPA2PV5J.mjs";
94
94
  import {
95
95
  normalizeRouteRules
96
- } from "./chunk-R2ZHU37O.mjs";
96
+ } from "./chunk-NLRAQXAA.mjs";
97
97
  import {
98
98
  resolveFarmDevtoolsConfig
99
99
  } from "./chunk-CU5SYTJG.mjs";
@@ -154,10 +154,10 @@ import {
154
154
  import {
155
155
  createFarmMarkdownRouteModuleFromFile,
156
156
  loadFarmMdxComponents
157
- } from "./chunk-5R3JQPWD.mjs";
157
+ } from "./chunk-AYVGD3PK.mjs";
158
158
  import {
159
159
  isFarmMarkdownPageFile
160
- } from "./chunk-R7254L3R.mjs";
160
+ } from "./chunk-J5ASGNKF.mjs";
161
161
  import {
162
162
  resolveFarmMdxComponentsModulePath,
163
163
  resolveMdxConfig
@@ -278,7 +278,7 @@ import {
278
278
  } from "./chunk-2DA7CLY7.mjs";
279
279
  import {
280
280
  FARM_VERSION
281
- } from "./chunk-NYF7A4UW.mjs";
281
+ } from "./chunk-RJUCNO7R.mjs";
282
282
  import {
283
283
  resolveFarmTrailingSlashRedirect,
284
284
  setFarmTrailingSlashPreference
@@ -5210,13 +5210,15 @@ var ServerRenderer = class {
5210
5210
  const server = this.getDefaultMCPServer();
5211
5211
  const request2 = getCurrentRequestOrNull() ?? createWebRequestFromFarmRequest(req, { trustProxy: this.config.server?.trustProxy });
5212
5212
  try {
5213
- const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-CPU354QQ.mjs");
5213
+ const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-VIT4GOSR.mjs");
5214
5214
  const origin = new URL(request2.url).origin;
5215
5215
  const i18n = this.i18nRuntime?.config;
5216
+ const metadataBase = await this.getRootMetadataBase();
5216
5217
  const response = await handleFarmDefaultMCPRequest(request2, {
5217
5218
  server,
5218
5219
  basePath: this.config.basePath,
5219
5220
  i18n,
5221
+ metadataBase,
5220
5222
  listPages: async () => {
5221
5223
  const sources = await Promise.all(
5222
5224
  this.getAgentListedRoutes().map(async ([pattern, route]) => {
@@ -5229,6 +5231,7 @@ var ServerRenderer = class {
5229
5231
  sources.filter((source) => source !== null),
5230
5232
  {
5231
5233
  origin,
5234
+ metadataBase,
5232
5235
  basePath: this.config.basePath,
5233
5236
  markdown: resolveMarkdownConfig(this.config.md),
5234
5237
  trailingSlash: this.config.trailingSlash,
@@ -5313,16 +5316,17 @@ var ServerRenderer = class {
5313
5316
  };
5314
5317
  }
5315
5318
  /**
5316
- * The origin llms.txt and llms-full.txt link to: the root layout's `metadataBase`, else the
5317
- * request's origin, as for the sitemap and the production server.
5319
+ * The origin llms.txt, llms-full.txt and list_pages link to: the root layout's
5320
+ * `metadataBase`, else the request's origin, as for the sitemap and the production server.
5318
5321
  */
5319
5322
  async getAgentOrigin(request2) {
5323
+ return resolveFarmAgentOrigin(await this.getRootMetadataBase(), new URL(request2.url).origin);
5324
+ }
5325
+ /** The root layout's `metadataBase`, which generated agent files and list_pages link to. */
5326
+ async getRootMetadataBase() {
5320
5327
  const rootLayout = this.routeManager.getLayouts().get("/");
5321
5328
  const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
5322
- return resolveFarmAgentOrigin(
5323
- rootMetadata?.metadataBase,
5324
- new URL(request2.url).origin
5325
- );
5329
+ return rootMetadata?.metadataBase;
5326
5330
  }
5327
5331
  /**
5328
5332
  * Reads page mirrors back through this dev server, the way its .md handler
@@ -7476,17 +7480,23 @@ function mergeNoExternal(farmValue, userValue) {
7476
7480
  const normalize = (value) => value == null || value === true ? [] : Array.isArray(value) ? value : [value];
7477
7481
  return Array.from(/* @__PURE__ */ new Set([...normalize(farmValue), ...normalize(userValue)]));
7478
7482
  }
7479
- function mergeAlias(farmValue, userValue) {
7483
+ function mergeFarmViteAlias(farmValue, userValue) {
7480
7484
  if (!farmValue) return userValue || {};
7481
7485
  if (!userValue) return farmValue;
7482
7486
  if (!Array.isArray(farmValue) && !Array.isArray(userValue)) {
7483
7487
  return {
7484
- ...farmValue,
7485
- ...userValue
7488
+ ...userValue,
7489
+ ...Object.fromEntries(
7490
+ Object.entries(farmValue).filter(
7491
+ ([find]) => !Object.prototype.hasOwnProperty.call(userValue, find)
7492
+ )
7493
+ )
7486
7494
  };
7487
7495
  }
7488
7496
  const normalize = (value) => Array.isArray(value) ? [...value] : Object.entries(value).map(([find, replacement]) => ({ find, replacement }));
7489
- return [...normalize(userValue), ...normalize(farmValue)];
7497
+ const userEntries = normalize(userValue);
7498
+ const userNames = new Set(userEntries.map((entry) => entry.find));
7499
+ return [...userEntries, ...normalize(farmValue).filter((entry) => !userNames.has(entry.find))];
7490
7500
  }
7491
7501
  function mergeFarmViteConfig(farmConfig, userConfig = {}) {
7492
7502
  const noDiscovery = userConfig.optimizeDeps?.noDiscovery ?? farmConfig.optimizeDeps?.noDiscovery;
@@ -7502,7 +7512,7 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
7502
7512
  resolve: {
7503
7513
  ...farmConfig.resolve,
7504
7514
  ...userConfig.resolve,
7505
- alias: mergeAlias(farmConfig.resolve?.alias, userConfig.resolve?.alias),
7515
+ alias: mergeFarmViteAlias(farmConfig.resolve?.alias, userConfig.resolve?.alias),
7506
7516
  dedupe: Array.from(
7507
7517
  /* @__PURE__ */ new Set([...farmConfig.resolve?.dedupe || [], ...userConfig.resolve?.dedupe || []])
7508
7518
  )
@@ -7538,7 +7548,33 @@ function mergeExternal(farmValue, userValue) {
7538
7548
  if (farmValue === true || userValue === true) return true;
7539
7549
  return Array.from(/* @__PURE__ */ new Set([...farmValue, ...userValue]));
7540
7550
  }
7541
- function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
7551
+ var FARM_CLIENT_OWNED_OUTPUT_OPTIONS = [
7552
+ "dir",
7553
+ "file",
7554
+ "format",
7555
+ "entryFileNames",
7556
+ "chunkFileNames",
7557
+ "assetFileNames",
7558
+ "hashCharacters"
7559
+ ];
7560
+ function isFarmOwnedClientOutputOption(key) {
7561
+ return FARM_CLIENT_OWNED_OUTPUT_OPTIONS.includes(key) || key.startsWith("sourcemap");
7562
+ }
7563
+ function mergeFarmClientOutputOptions(farmOutput, userOutput) {
7564
+ if (userOutput === void 0) return farmOutput;
7565
+ if (Array.isArray(userOutput) || Array.isArray(farmOutput)) {
7566
+ throw new Error(
7567
+ "Farm builds one client output: set vite.build.rolldownOptions.output (or rollupOptions.output) to an object, not an array."
7568
+ );
7569
+ }
7570
+ const app = Object.fromEntries(
7571
+ Object.entries(userOutput).filter(
7572
+ ([key, value]) => value !== void 0 && !isFarmOwnedClientOutputOption(key)
7573
+ )
7574
+ );
7575
+ return { ...app, ...farmOutput };
7576
+ }
7577
+ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}, options = {}) {
7542
7578
  const {
7543
7579
  plugins: _plugins,
7544
7580
  root: _root,
@@ -7566,13 +7602,15 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
7566
7602
  } = userBuild;
7567
7603
  const {
7568
7604
  input: _input,
7569
- output: _output,
7605
+ output: userOutput,
7570
7606
  ...userBundlerOptions
7571
7607
  } = {
7572
7608
  ...userRollupOptions,
7573
7609
  ...userRolldownOptions
7574
7610
  };
7575
7611
  const merged = mergeFarmViteConfig(farmConfig, shared);
7612
+ const farmBundlerOptions = farmConfig.build?.rollupOptions;
7613
+ const output = options.clientOutput ? mergeFarmClientOutputOptions(farmBundlerOptions?.output, userOutput) : farmBundlerOptions?.output;
7576
7614
  return {
7577
7615
  ...merged,
7578
7616
  build: {
@@ -7580,7 +7618,8 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
7580
7618
  ...farmConfig.build,
7581
7619
  rollupOptions: {
7582
7620
  ...userBundlerOptions,
7583
- ...farmConfig.build?.rollupOptions
7621
+ ...farmBundlerOptions,
7622
+ ...output === void 0 ? {} : { output }
7584
7623
  }
7585
7624
  },
7586
7625
  css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
@@ -7655,6 +7694,7 @@ export {
7655
7694
  createFarmClientOptimizeDepsEntries,
7656
7695
  createFarmClientOptimizeDepsConfig,
7657
7696
  createFarmSourceAlias,
7697
+ mergeFarmViteAlias,
7658
7698
  mergeFarmViteConfig,
7659
7699
  mergeFarmProductionViteConfig,
7660
7700
  createFarmThemeCssPlugin
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-FN5UEC7I.mjs";
11
11
  import {
12
12
  resolveDeployOutputPath
13
- } from "./chunk-3WS5AZ3R.mjs";
13
+ } from "./chunk-IYDJNCR7.mjs";
14
14
  import {
15
15
  farmDesktopDevGuardPlugin,
16
16
  loadFarmReactPlugin
@@ -210,7 +210,7 @@ async function resolveFarmRscServerPlugins(userConfig, config, root) {
210
210
  }
211
211
  async function configureFarmRscPlugins(config, command) {
212
212
  if (config.plugins.length === 0) return config;
213
- const { PluginManager } = await import("./plugin-VEBRN7A3.mjs");
213
+ const { PluginManager } = await import("./plugin-QZT747YW.mjs");
214
214
  const manager = new PluginManager({
215
215
  config,
216
216
  isDev: command === "serve",
@@ -7,7 +7,7 @@ import {
7
7
  normalizeRouteRules,
8
8
  routeRulesToHeaders,
9
9
  routeRulesToRedirects
10
- } from "./chunk-R2ZHU37O.mjs";
10
+ } from "./chunk-NLRAQXAA.mjs";
11
11
  import {
12
12
  assertPluginDependencies
13
13
  } from "./chunk-XR2ZIBQK.mjs";
@@ -75,6 +75,27 @@ async function evaluateMdxSource(source, filePath) {
75
75
  remarkPlugins: [remarkGfm]
76
76
  });
77
77
  }
78
+ var MARKDOWN_ROUTE_CONFIG_EXPORT = /^export\s+const\s+(dynamic|revalidate|ssg)\s*=\s*("[^"\\]*"|'[^'\\]*'|\d+(?:\.\d+)?|true|false)\s*;?\s*$/;
79
+ function readFarmMarkdownRouteConfig(body) {
80
+ const config = {};
81
+ let fence;
82
+ for (const line of body.split(/\r?\n/)) {
83
+ const marker = line.match(/^ {0,3}(`{3,}|~{3,})/)?.[1];
84
+ if (fence) {
85
+ if (marker && marker[0] === fence[0] && marker.length >= fence.length) fence = void 0;
86
+ continue;
87
+ }
88
+ if (marker) {
89
+ fence = marker;
90
+ continue;
91
+ }
92
+ const match = line.match(MARKDOWN_ROUTE_CONFIG_EXPORT);
93
+ if (!match) continue;
94
+ const literal = match[2];
95
+ config[match[1]] = literal === "true" ? true : literal === "false" ? false : /^\d/.test(literal) ? Number(literal) : literal.slice(1, -1);
96
+ }
97
+ return config;
98
+ }
78
99
  function createFarmMarkdownRouteModule(input) {
79
100
  const { body } = parseMarkdownFrontmatter(input.source);
80
101
  const className = input.config?.className || "farm-markdown";
@@ -110,6 +131,7 @@ function createFarmMarkdownRouteModule(input) {
110
131
  );
111
132
  }
112
133
  return {
134
+ ...readFarmMarkdownRouteConfig(body),
113
135
  default: FarmMarkdownPage,
114
136
  metadata: createMarkdownMetadata(input.source, input.filePath),
115
137
  source: input.source
@@ -287,6 +309,7 @@ export {
287
309
  parseMarkdownFrontmatter,
288
310
  titleFromMarkdown,
289
311
  createMarkdownMetadata,
312
+ readFarmMarkdownRouteConfig,
290
313
  createFarmMarkdownRouteModule,
291
314
  isFarmMarkdownPublicSourceResponse,
292
315
  FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
@@ -1,5 +1,7 @@
1
1
  import {
2
- collectFarmLlmsTxtPages
2
+ collectFarmLlmsTxtPages,
3
+ getFarmAgentPagePublicPath,
4
+ resolveFarmAgentOrigin
3
5
  } from "./chunk-Z3GPAFIA.mjs";
4
6
  import {
5
7
  getFarmMarkdownMirrorPath,
@@ -13,10 +15,6 @@ import {
13
15
  normalizeFarmTrailingSlashPathname
14
16
  } from "./chunk-4O26BPUY.mjs";
15
17
  import {
16
- localizeFarmPathname
17
- } from "./chunk-7S7AAK2D.mjs";
18
- import {
19
- applyFarmBasePath,
20
18
  stripFarmBasePath
21
19
  } from "./chunk-SF3JB56B.mjs";
22
20
 
@@ -114,8 +112,7 @@ function collectFarmDefaultMCPPages(sources, options) {
114
112
  if (!isFarmMarkdownMirrorExposed(options.markdown, source.pattern)) continue;
115
113
  readable.push({ pattern: source.pattern, metadata: module?.metadata });
116
114
  }
117
- const i18n = resolveFarmDefaultMCPI18n(options.i18n, options.basePath);
118
- const toPublicPath = (pathname) => i18n ? localizeFarmPathname(pathname, i18n.defaultLocale, i18n) : applyFarmBasePath(pathname, options.basePath);
115
+ const base = resolveFarmAgentOrigin(options.metadataBase, options.origin);
119
116
  return collectFarmLlmsTxtPages(readable, {
120
117
  origin: options.origin,
121
118
  basePath: options.basePath,
@@ -124,13 +121,16 @@ function collectFarmDefaultMCPPages(sources, options) {
124
121
  path: page.path,
125
122
  title: page.title,
126
123
  // As the sitemap lists it: '/base' without trailingSlash ('/base/' redirects there).
127
- url: `${options.origin}${normalizeFarmTrailingSlashPathname(
128
- toPublicPath(page.path),
124
+ url: `${base}${normalizeFarmTrailingSlashPathname(
125
+ getFarmAgentPagePublicPath(page.path, options),
129
126
  options.trailingSlash === true
130
127
  )}`,
131
128
  ...page.description ? { description: page.description } : {},
132
129
  // A mirror keeps its .md URL whatever trailingSlash says, as llms.txt links it.
133
- markdownUrl: `${options.origin}${toPublicPath(getFarmMarkdownMirrorPath(page.path))}`
130
+ markdownUrl: `${options.origin}${getFarmAgentPagePublicPath(
131
+ getFarmMarkdownMirrorPath(page.path),
132
+ options
133
+ )}`
134
134
  }));
135
135
  }
136
136
  function resolveFarmDefaultMCPI18n(i18n, basePath) {