@farm.js/core 0.1.62 → 0.1.63

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 (158) hide show
  1. package/dist/{agent-mcp.d-BKZ3UNbt.d.mts → agent-mcp.d-CCQ-wKwg.d.mts} +1 -1
  2. package/dist/{agent-mcp.d-C1zr_nGS.d.ts → agent-mcp.d-DOJCBSh9.d.ts} +1 -1
  3. package/dist/agent-runtime.d.mts +1 -1
  4. package/dist/agent-runtime.d.ts +1 -1
  5. package/dist/analyzer-KEA5JVDR.cjs +15 -0
  6. package/dist/{analyzer-YESYU3GK.mjs → analyzer-WNPQPWFR.mjs} +2 -2
  7. package/dist/api/route-manager.d.mts +3 -3
  8. package/dist/api/route-manager.d.ts +3 -3
  9. package/dist/api/runtime.d.mts +2 -2
  10. package/dist/api/runtime.d.ts +2 -2
  11. package/dist/api.d.mts +3 -3
  12. package/dist/api.d.ts +3 -3
  13. package/dist/{app-manifest.d-ntch_bvA.d.ts → app-manifest.d-BaA0omsv.d.mts} +9 -1
  14. package/dist/{app-manifest.d-BpvhfKRH.d.mts → app-manifest.d-poayV4lq.d.ts} +9 -1
  15. package/dist/app-markdown.d.mts +2 -2
  16. package/dist/app-markdown.d.ts +2 -2
  17. package/dist/{app.d-AE8_v3Db.d.ts → app.d-D4Dn03E3.d.ts} +4 -4
  18. package/dist/{app.d-CysWA_8v.d.mts → app.d-DdWxeIGU.d.mts} +4 -4
  19. package/dist/{chunk-RZNCMRD3.mjs → chunk-4DIKLG56.mjs} +1 -1
  20. package/dist/{chunk-ZVIEFTUA.cjs → chunk-5IKQ7BIR.cjs} +2 -2
  21. package/dist/{chunk-WKJQ2FJA.cjs → chunk-5L7I6AMY.cjs} +3 -3
  22. package/dist/{chunk-VM7X5CKC.mjs → chunk-7FFW7DC4.mjs} +29 -3
  23. package/dist/{chunk-JEJQGZI7.cjs → chunk-ANXU3D32.cjs} +2 -2
  24. package/dist/{chunk-VWW4Q3BJ.mjs → chunk-BA2IA32Q.mjs} +1 -1
  25. package/dist/{chunk-SG57PX7K.cjs → chunk-BTVDYS4B.cjs} +7 -2
  26. package/dist/{chunk-IQIKPKFP.mjs → chunk-CBDRR3J3.mjs} +96 -16
  27. package/dist/{chunk-OUWRNHTV.mjs → chunk-EENTT56C.mjs} +10 -10
  28. package/dist/{chunk-XX32BOMM.cjs → chunk-EYLC6GD6.cjs} +44 -18
  29. package/dist/{chunk-SM25ZC4S.cjs → chunk-FNHN3RBD.cjs} +1 -1
  30. package/dist/{chunk-T46NNU4D.mjs → chunk-GPKBUME5.mjs} +1 -1
  31. package/dist/{chunk-2JYBLE63.mjs → chunk-LA45FN37.mjs} +762 -235
  32. package/dist/chunk-LA6O5EL2.mjs +254 -0
  33. package/dist/{chunk-UWI3SJAK.cjs → chunk-LFFSDZ4Y.cjs} +3 -3
  34. package/dist/chunk-LWWDTBGL.cjs +254 -0
  35. package/dist/{chunk-ZBUAOGMY.mjs → chunk-O5FCWI6O.mjs} +1 -1
  36. package/dist/{chunk-RMUD75WT.cjs → chunk-PVJX4UPA.cjs} +323 -243
  37. package/dist/{chunk-GGNJAGGE.cjs → chunk-QN5WRQSQ.cjs} +971 -444
  38. package/dist/{chunk-NT3QDN2E.mjs → chunk-RFYL5OLP.mjs} +1 -1
  39. package/dist/{chunk-LVWGURLD.mjs → chunk-S2NUYHRY.mjs} +1 -1
  40. package/dist/{chunk-2WZTGPK6.mjs → chunk-SQ5O7I3L.mjs} +7 -2
  41. package/dist/{chunk-545WJ5UG.cjs → chunk-U6WCUVSV.cjs} +2 -2
  42. package/dist/{chunk-2CNKQC3G.mjs → chunk-XICXQXYE.mjs} +1 -1
  43. package/dist/{chunk-AJB3DHN6.cjs → chunk-Y2YBNQ3D.cjs} +2 -2
  44. package/dist/{chunk-EXXFSZOC.cjs → chunk-Z74NNER4.cjs} +86 -86
  45. package/dist/{client-component.d-Bgt3x5Fu.d.ts → client-component.d-CQLvqLAJ.d.ts} +14 -3
  46. package/dist/{client-component.d-BoqC2MLC.d.mts → client-component.d-CSEFlHfG.d.mts} +14 -3
  47. package/dist/{client-plugins.d-CWyYBxXf.d.mts → client-plugins.d-BTF0gZm4.d.mts} +10 -1
  48. package/dist/{client-plugins.d-BcqIy4au.d.ts → client-plugins.d-BgPUYPc9.d.ts} +10 -1
  49. package/dist/client-plugins.d.mts +1 -1
  50. package/dist/client-plugins.d.ts +1 -1
  51. package/dist/client.d.mts +6 -6
  52. package/dist/client.d.ts +6 -6
  53. package/dist/config.d.mts +1 -1
  54. package/dist/config.d.ts +1 -1
  55. package/dist/desktop.d.mts +2 -2
  56. package/dist/desktop.d.ts +2 -2
  57. package/dist/{devtools-NUVXYG7I.mjs → devtools-HDKTYIZF.mjs} +2 -2
  58. package/dist/{devtools-SVRSGPNC.cjs → devtools-ZHN5JLVI.cjs} +3 -3
  59. package/dist/docs.cjs +4 -4
  60. package/dist/docs.d.mts +2 -2
  61. package/dist/docs.d.ts +2 -2
  62. package/dist/docs.mjs +3 -3
  63. package/dist/index.cjs +12 -12
  64. package/dist/{index.d-nAncqTXz.d.ts → index.d-Coow7bD4.d.ts} +1 -1
  65. package/dist/{index.d-BDaiu2i5.d.mts → index.d-Dbjx0ku7.d.mts} +1 -1
  66. package/dist/index.d.mts +16 -16
  67. package/dist/index.d.ts +16 -16
  68. package/dist/index.mjs +11 -11
  69. package/dist/integrations.d.mts +1 -1
  70. package/dist/integrations.d.ts +1 -1
  71. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  72. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  73. package/dist/internal/build-runtime.cjs +13 -13
  74. package/dist/internal/build-runtime.d.mts +3 -3
  75. package/dist/internal/build-runtime.d.ts +3 -3
  76. package/dist/internal/build-runtime.mjs +12 -12
  77. package/dist/internal/cli-runtime.cjs +3 -3
  78. package/dist/internal/cli-runtime.mjs +2 -2
  79. package/dist/internal/client-error-overlay.cjs +4 -4
  80. package/dist/internal/client-error-overlay.mjs +1 -1
  81. package/dist/internal/client-runtime.d.mts +4 -4
  82. package/dist/internal/client-runtime.d.ts +4 -4
  83. package/dist/internal/compression-runtime.d.mts +1 -1
  84. package/dist/internal/compression-runtime.d.ts +1 -1
  85. package/dist/internal/config-runtime.cjs +4 -4
  86. package/dist/internal/config-runtime.d.mts +3 -3
  87. package/dist/internal/config-runtime.d.ts +3 -3
  88. package/dist/internal/config-runtime.mjs +3 -3
  89. package/dist/internal/infra-analytics-runtime.cjs +8 -6
  90. package/dist/internal/infra-analytics-runtime.mjs +6 -4
  91. package/dist/internal/native-server-fns.cjs +4 -4
  92. package/dist/internal/native-server-fns.mjs +3 -3
  93. package/dist/internal/product-telemetry-runtime.cjs +17 -211
  94. package/dist/internal/product-telemetry-runtime.mjs +10 -204
  95. package/dist/internal/production-runtime.cjs +7 -6
  96. package/dist/internal/production-runtime.d.mts +10 -10
  97. package/dist/internal/production-runtime.d.ts +10 -10
  98. package/dist/internal/production-runtime.mjs +7 -6
  99. package/dist/internal/react-cache.cjs +21 -1
  100. package/dist/internal/react-cache.d.mts +8 -1
  101. package/dist/internal/react-cache.d.ts +8 -1
  102. package/dist/internal/react-cache.mjs +21 -1
  103. package/dist/markdown.d.mts +1 -1
  104. package/dist/markdown.d.ts +1 -1
  105. package/dist/middleware.d.mts +3 -3
  106. package/dist/middleware.d.ts +3 -3
  107. package/dist/{navigation-delegate.d-CSCm8ZxL.d.mts → navigation-delegate.d-Ca_BV0Wu.d.mts} +1 -1
  108. package/dist/{navigation-delegate.d-BbUHRXxG.d.ts → navigation-delegate.d-aHiPI6GL.d.ts} +1 -1
  109. package/dist/navigation.d.mts +4 -4
  110. package/dist/navigation.d.ts +4 -4
  111. package/dist/plugin.cjs +7 -7
  112. package/dist/plugin.d.mts +3 -3
  113. package/dist/plugin.d.ts +3 -3
  114. package/dist/plugin.mjs +6 -6
  115. package/dist/{production-runtime.d-DgT24A0f.d.ts → production-runtime.d-C0rF7a10.d.ts} +1 -1
  116. package/dist/{production-runtime.d-CcQiDko5.d.mts → production-runtime.d-CnAsSWgF.d.mts} +1 -1
  117. package/dist/{render-plan.d-CyrX6MDs.d.ts → render-plan.d-BxeITFT1.d.ts} +1 -1
  118. package/dist/{render-plan.d-BH9WF-JZ.d.mts → render-plan.d-Z-93m5GZ.d.mts} +1 -1
  119. package/dist/renderer-client.d.mts +4 -4
  120. package/dist/renderer-client.d.ts +4 -4
  121. package/dist/{request.d-CUrPnCW7.d.mts → request.d-8_fMFNEb.d.mts} +1 -1
  122. package/dist/{request.d-BB8M8bcD.d.ts → request.d-X7Q1vmGF.d.ts} +1 -1
  123. package/dist/request.d.mts +2 -2
  124. package/dist/request.d.ts +2 -2
  125. package/dist/{route-rendering.d-CYxlzaFm.d.mts → route-rendering.d-BInmBmul.d.mts} +1 -1
  126. package/dist/{route-rendering.d-DYqZMIf4.d.ts → route-rendering.d-BUr3Jp8S.d.ts} +1 -1
  127. package/dist/{router.d-7o24CD8u.d.mts → router.d-CZQmbpHx.d.mts} +1 -1
  128. package/dist/{router.d-DaKo507j.d.ts → router.d-crorSRiW.d.ts} +1 -1
  129. package/dist/routes.d.mts +1 -1
  130. package/dist/routes.d.ts +1 -1
  131. package/dist/{rsc-pipeline-RFLHDAKD.mjs → rsc-pipeline-3MPRULGA.mjs} +3 -3
  132. package/dist/{rsc-pipeline-OF2I7PCX.cjs → rsc-pipeline-RHEZNBFQ.cjs} +4 -4
  133. package/dist/{runtime-LBTK62AD.cjs → runtime-OZKFZQCU.cjs} +5 -5
  134. package/dist/{runtime-M6UJCSLA.mjs → runtime-X5UR7VHP.mjs} +3 -3
  135. package/dist/{runtime.d-CN73a-IL.d.ts → runtime.d-CCsjTZJW.d.ts} +1 -1
  136. package/dist/{runtime.d-CcNuzhX6.d.mts → runtime.d-CETtpLb-.d.mts} +1 -1
  137. package/dist/server-plugins.d.mts +2 -2
  138. package/dist/server-plugins.d.ts +2 -2
  139. package/dist/server.cjs +24 -24
  140. package/dist/server.d.mts +9 -9
  141. package/dist/server.d.ts +9 -9
  142. package/dist/server.mjs +9 -9
  143. package/dist/{spa-router.d-Cvgf5QP4.d.ts → spa-router.d-CCADbSqJ.d.ts} +2 -2
  144. package/dist/{spa-router.d-CNi77LZm.d.mts → spa-router.d-CtSHzXlC.d.mts} +2 -2
  145. package/dist/testing.d.mts +1 -1
  146. package/dist/testing.d.ts +1 -1
  147. package/dist/{utils.d-C3H-14_Y.d.ts → utils.d-CjyE-npA.d.ts} +1 -1
  148. package/dist/{utils.d-D8VfzZYn.d.mts → utils.d-zFPHKFFJ.d.mts} +1 -1
  149. package/dist/version.cjs +2 -2
  150. package/dist/version.mjs +1 -1
  151. package/dist/vite.cjs +11 -7
  152. package/dist/vite.d.mts +23 -5
  153. package/dist/vite.d.ts +23 -5
  154. package/dist/vite.mjs +10 -6
  155. package/package.json +1 -1
  156. package/dist/analyzer-2AHWJJR7.cjs +0 -15
  157. package/dist/chunk-CSLUBKGG.mjs +0 -44
  158. package/dist/chunk-SGBNF56S.cjs +0 -44
@@ -16,14 +16,18 @@ import {
16
16
  createFarmClientOptimizeDepsEntries,
17
17
  createFarmSourceAlias,
18
18
  createFarmThemeCssPlugin,
19
+ ensureFarmPackageClientReference,
19
20
  farmFontImportsPlugin,
21
+ farmRelativeImportFiles,
20
22
  generateClientCachePersistenceCode,
21
23
  generateFarmClientPluginEntryCode,
22
24
  generateFarmIntegrationProviderClientCode,
23
25
  getClientModuleMetadata,
26
+ getFarmClientReachableModules,
24
27
  getIslandStrategyExport,
25
28
  hasUseClientDirective,
26
29
  inferFarmIslandStrategy,
30
+ invalidateFarmClientReachableModules,
27
31
  isFarmDocsClientConfigModule,
28
32
  isFarmPackageClientBoundary,
29
33
  isIsolatableClientBoundarySource,
@@ -36,8 +40,9 @@ import {
36
40
  resolveFarmRouteRootStrategy,
37
41
  resolveModuleSourcePath,
38
42
  rewriteFarmPackageClientImports,
43
+ rewriteFarmReactServerImports,
39
44
  stripUseClientDirective
40
- } from "./chunk-2JYBLE63.mjs";
45
+ } from "./chunk-LA45FN37.mjs";
41
46
  import {
42
47
  loadTailwindVitePlugin
43
48
  } from "./chunk-OM7WILES.mjs";
@@ -65,9 +70,6 @@ import {
65
70
  import {
66
71
  FARM_NATIVE_TREE_CONTENT_TYPE
67
72
  } from "./chunk-LLZSYFOM.mjs";
68
- import {
69
- isFarmPreviewDeploymentEnvironment
70
- } from "./chunk-CSLUBKGG.mjs";
71
73
  import {
72
74
  FARM_API_CATALOG_PATH,
73
75
  createFarmAiCatalogResponse,
@@ -82,10 +84,13 @@ import {
82
84
  resolveFarmMCPRouteLabel,
83
85
  resolveFarmMarkdownRouteLabel,
84
86
  setFarmRouteLabel
85
- } from "./chunk-VM7X5CKC.mjs";
87
+ } from "./chunk-7FFW7DC4.mjs";
86
88
  import {
87
89
  FARM_DEFAULT_MCP_PATH
88
90
  } from "./chunk-UZZ6IEQP.mjs";
91
+ import {
92
+ isFarmPreviewDeploymentEnvironment
93
+ } from "./chunk-LA6O5EL2.mjs";
89
94
  import {
90
95
  createFarmServerFnBoundaryModule,
91
96
  isFarmServerFnBoundaryId,
@@ -252,7 +257,7 @@ import {
252
257
  } from "./chunk-QDWMCFTH.mjs";
253
258
  import {
254
259
  FARM_VERSION
255
- } from "./chunk-NT3QDN2E.mjs";
260
+ } from "./chunk-RFYL5OLP.mjs";
256
261
  import {
257
262
  DEFAULT_FARM_API_BASE_PATH
258
263
  } from "./chunk-W6QLRQ3V.mjs";
@@ -692,6 +697,11 @@ import { rewriteFormStatusImports } from "@farm.js/islx/compiler";
692
697
  import path5 from "path";
693
698
  import { parseAst } from "rolldown/parseAst";
694
699
  var FARM_REACT_CACHE_MODULE = "@farm.js/core/internal/react-cache";
700
+ var REACT_CACHE_LOCAL = "__farm_react_cache__";
701
+ var REACT_CACHE_APIS = {
702
+ cache: REACT_CACHE_LOCAL,
703
+ cacheSignal: "__farm_react_cache_signal__"
704
+ };
695
705
  function rewriteFarmReactCacheImport(code, file) {
696
706
  if (!code.includes("cache") || !code.includes("react")) return null;
697
707
  const extension = path5.extname(file).slice(1);
@@ -702,15 +712,25 @@ function rewriteFarmReactCacheImport(code, file) {
702
712
  } catch {
703
713
  return null;
704
714
  }
705
- let output = code;
715
+ const edits = [];
706
716
  const declarations = (program.body ?? []).filter(
707
717
  (node) => node.type === "ImportDeclaration" && node.source?.value === "react" && node.importKind !== "type"
708
718
  );
709
- let changed = false;
710
- for (const node of [...declarations].sort((left, right) => right.start - left.start)) {
719
+ const namespaces = /* @__PURE__ */ new Set();
720
+ let memberImportAt = null;
721
+ for (const node of declarations) {
711
722
  const specifiers = node.specifiers ?? [];
723
+ for (const specifier of specifiers) {
724
+ if (specifier.type === "ImportDefaultSpecifier" || specifier.type === "ImportNamespaceSpecifier") {
725
+ namespaces.add(specifier.local.name);
726
+ memberImportAt ?? (memberImportAt = node.end);
727
+ }
728
+ }
712
729
  const caches = specifiers.filter(
713
- (specifier) => specifier.type === "ImportSpecifier" && specifier.importKind !== "type" && (specifier.imported?.name ?? specifier.imported?.value) === "cache"
730
+ (specifier) => specifier.type === "ImportSpecifier" && specifier.importKind !== "type" && Object.prototype.hasOwnProperty.call(
731
+ REACT_CACHE_APIS,
732
+ specifier.imported?.name ?? specifier.imported?.value ?? ""
733
+ )
714
734
  );
715
735
  if (caches.length === 0) continue;
716
736
  const others = specifiers.filter((specifier) => !caches.includes(specifier));
@@ -723,12 +743,48 @@ function rewriteFarmReactCacheImport(code, file) {
723
743
  ].join(", ");
724
744
  const lines = [
725
745
  ...clause ? [`import ${clause} from "react";`] : [],
726
- `import { ${caches.map((specifier) => `cache as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
746
+ `import { ${caches.map((specifier) => `${specifier.imported?.name ?? specifier.imported?.value} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
727
747
  ];
728
- output = output.slice(0, node.start) + lines.join("\n") + output.slice(node.end);
729
- changed = true;
748
+ edits.push({ start: node.start, end: node.end, text: lines.join("\n") });
749
+ }
750
+ if (namespaces.size > 0 && memberImportAt !== null) {
751
+ const used = /* @__PURE__ */ new Set();
752
+ const visit = (node) => {
753
+ if (!node || typeof node !== "object") return;
754
+ if (Array.isArray(node)) {
755
+ for (const child of node) visit(child);
756
+ return;
757
+ }
758
+ const current = node;
759
+ if (typeof current.type !== "string") return;
760
+ if (current.type === "ImportDeclaration") return;
761
+ if (current.type === "MemberExpression" && !current.computed && current.object?.type === "Identifier" && namespaces.has(current.object.name) && Object.prototype.hasOwnProperty.call(REACT_CACHE_APIS, current.property?.name ?? "")) {
762
+ const name = current.property.name;
763
+ edits.push({ start: current.start, end: current.end, text: REACT_CACHE_APIS[name] });
764
+ used.add(name);
765
+ return;
766
+ }
767
+ for (const [key, value] of Object.entries(current)) {
768
+ if (key === "start" || key === "end" || key === "loc" || key === "range") continue;
769
+ if (value && typeof value === "object") visit(value);
770
+ }
771
+ };
772
+ visit(program);
773
+ if (used.size > 0) {
774
+ edits.push({
775
+ start: memberImportAt,
776
+ end: memberImportAt,
777
+ text: `
778
+ import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
779
+ });
780
+ }
781
+ }
782
+ if (edits.length === 0) return null;
783
+ let output = code;
784
+ for (const edit of edits.sort((left, right) => right.start - left.start)) {
785
+ output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);
730
786
  }
731
- return changed ? output : null;
787
+ return output;
732
788
  }
733
789
 
734
790
  // src/navigation/page-data-error.ts
@@ -824,7 +880,7 @@ function loadFarmWorkflowsDevRuntime() {
824
880
  return import("./workflows.mjs");
825
881
  }
826
882
  function loadFarmDevtoolsSnapshotRuntime() {
827
- return import("./devtools-NUVXYG7I.mjs");
883
+ return import("./devtools-HDKTYIZF.mjs");
828
884
  }
829
885
  function loadFarmDevtoolsUIRuntime() {
830
886
  return import("./devtools-ui-CYBVFLPH.mjs");
@@ -850,6 +906,7 @@ function farmI18nClientBridgePlugin() {
850
906
  }
851
907
  var FARM_SERVER_ONLY_ENTRIES = /* @__PURE__ */ new Set(["@farm.js/core/og"]);
852
908
  var SERVER_ONLY_PACKAGE = "server-only";
909
+ var farmReactServerFiles = /* @__PURE__ */ new Set();
853
910
  var FARM_SERVER_ONLY_PACKAGE_ID = "\0farm:server-only";
854
911
  var FARM_PLATFORM_ENTRY = "@farm.js/core/platform";
855
912
  var FARM_PLATFORM_CLIENT_ID = "\0farm:platform-client";
@@ -3619,9 +3676,29 @@ export const manifest = getManifest();
3619
3676
  async transform(code, id, transformOptions) {
3620
3677
  const actionConfig = farmApp?.getConfig() ?? options;
3621
3678
  let rewrotePackageImports = false;
3622
- if (resolveFarmServerComponentsMode(actionConfig.experimental?.serverComponents) === "islands" && !id.includes("/node_modules/") && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !hasUseClientDirective(code)) {
3679
+ if (resolveFarmServerComponentsMode(actionConfig.experimental?.serverComponents) === "islands" && (!id.includes("/node_modules/") || transformOptions?.ssr === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !hasUseClientDirective(code)) {
3623
3680
  const file = id.split("?", 1)[0];
3624
3681
  const projectRoot = actionConfig.root || server?.config.root || process.cwd();
3682
+ if (transformOptions?.ssr === true) {
3683
+ if (farmReactServerFiles.has(file)) {
3684
+ for (const child of farmRelativeImportFiles(code, file))
3685
+ farmReactServerFiles.add(child);
3686
+ }
3687
+ const serverModule = farmReactServerFiles.has(file) || !getFarmClientReachableModules(
3688
+ path6.resolve(projectRoot, actionConfig.srcDir || "src"),
3689
+ projectRoot
3690
+ ).has(path6.resolve(file));
3691
+ const reactServer = !serverModule ? null : rewriteFarmReactServerImports({
3692
+ code,
3693
+ file,
3694
+ reference: (specifier, exportName) => ensureFarmPackageClientReference(projectRoot, specifier, exportName),
3695
+ onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
3696
+ });
3697
+ if (reactServer !== null) {
3698
+ code = reactServer;
3699
+ rewrotePackageImports = true;
3700
+ }
3701
+ }
3625
3702
  const referenced = rewriteFarmPackageClientImports({
3626
3703
  code,
3627
3704
  file,
@@ -3908,6 +3985,9 @@ if (import.meta.hot) {
3908
3985
  logger.error(`SSG build failed: ${error}`);
3909
3986
  }
3910
3987
  },
3988
+ watchChange() {
3989
+ invalidateFarmClientReachableModules();
3990
+ },
3911
3991
  async handleHotUpdate(ctx) {
3912
3992
  const { file, server: server2, modules } = ctx;
3913
3993
  if (initialPluginManager) {
@@ -31,14 +31,14 @@ import {
31
31
  import {
32
32
  collectFarmNativeServerFns,
33
33
  findFarmNativeScreenFiles
34
- } from "./chunk-RZNCMRD3.mjs";
34
+ } from "./chunk-4DIKLG56.mjs";
35
35
  import {
36
36
  assertFarmDocsAdapterServesNoGuardedPages,
37
37
  compileFarmDocsAdapterEdgeManifest,
38
38
  createFarmDocsAPIHandler,
39
39
  hasFarmDocsRuntimeAdapter,
40
40
  listFarmDocsAdapterPages
41
- } from "./chunk-T46NNU4D.mjs";
41
+ } from "./chunk-GPKBUME5.mjs";
42
42
  import {
43
43
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
44
44
  createFarmDocsHandler,
@@ -58,7 +58,7 @@ import {
58
58
  } from "./chunk-ALEUMLJN.mjs";
59
59
  import {
60
60
  FARM_PRERENDER_ENV
61
- } from "./chunk-2CNKQC3G.mjs";
61
+ } from "./chunk-XICXQXYE.mjs";
62
62
  import {
63
63
  loadFarmDocsEngine
64
64
  } from "./chunk-VE3FWJBO.mjs";
@@ -67,7 +67,7 @@ import {
67
67
  getDeployTargetForPreset,
68
68
  hasCustomFarmRouteContext,
69
69
  resolveDeployOutputPath
70
- } from "./chunk-VWW4Q3BJ.mjs";
70
+ } from "./chunk-BA2IA32Q.mjs";
71
71
  import {
72
72
  resolveFarmInstrumentationFile
73
73
  } from "./chunk-N35YPV4N.mjs";
@@ -111,7 +111,7 @@ import {
111
111
  usePackageClientBoundaryCacheFile,
112
112
  usesFarmServerTree,
113
113
  withPackageClientBoundaryCache
114
- } from "./chunk-2JYBLE63.mjs";
114
+ } from "./chunk-LA45FN37.mjs";
115
115
  import {
116
116
  loadTailwindVitePlugin
117
117
  } from "./chunk-OM7WILES.mjs";
@@ -142,9 +142,6 @@ import {
142
142
  import {
143
143
  farmPluginMayAffectRuntimePath
144
144
  } from "./chunk-UUMKLGUU.mjs";
145
- import {
146
- isFarmPreviewDeploymentEnvironment
147
- } from "./chunk-CSLUBKGG.mjs";
148
145
  import {
149
146
  FARM_API_CATALOG_PATH,
150
147
  FARM_APP_MANIFEST_LEGACY_PATH,
@@ -152,12 +149,15 @@ import {
152
149
  listFarmBuiltInRoutePaths,
153
150
  resolveFarmApiCatalogInput,
154
151
  resolveFarmAppManifestInput
155
- } from "./chunk-VM7X5CKC.mjs";
152
+ } from "./chunk-7FFW7DC4.mjs";
156
153
  import {
157
154
  FARM_DEFAULT_MCP_PATH,
158
155
  createFarmDefaultMCPServer,
159
156
  farmConfigMountsMCP
160
157
  } from "./chunk-UZZ6IEQP.mjs";
158
+ import {
159
+ isFarmPreviewDeploymentEnvironment
160
+ } from "./chunk-LA6O5EL2.mjs";
161
161
  import {
162
162
  FARM_NATIVE_SERVER_FN_PLUGIN
163
163
  } from "./chunk-L4RTTTVE.mjs";
@@ -264,7 +264,7 @@ import {
264
264
  } from "./chunk-2I6PUKWJ.mjs";
265
265
  import {
266
266
  FARM_VERSION
267
- } from "./chunk-NT3QDN2E.mjs";
267
+ } from "./chunk-RFYL5OLP.mjs";
268
268
  import {
269
269
  getFarmPresetRuntime
270
270
  } from "./chunk-UAQD67HM.mjs";
@@ -4,13 +4,19 @@
4
4
  var _chunkQAS7KE7Jcjs = require('./chunk-QAS7KE7J.cjs');
5
5
 
6
6
 
7
- var _chunkSG57PX7Kcjs = require('./chunk-SG57PX7K.cjs');
7
+ var _chunkLWWDTBGLcjs = require('./chunk-LWWDTBGL.cjs');
8
+
9
+
10
+ var _chunkBTVDYS4Bcjs = require('./chunk-BTVDYS4B.cjs');
8
11
 
9
12
 
10
13
 
11
14
  var _chunkLT4VAF5Zcjs = require('./chunk-LT4VAF5Z.cjs');
12
15
 
13
16
 
17
+ var _chunk2KMIJDY6cjs = require('./chunk-2KMIJDY6.cjs');
18
+
19
+
14
20
 
15
21
  var _chunkLRB5OVRTcjs = require('./chunk-LRB5OVRT.cjs');
16
22
 
@@ -23,7 +29,7 @@ var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
23
29
  var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
24
30
 
25
31
 
26
- var _chunkSM25ZC4Scjs = require('./chunk-SM25ZC4S.cjs');
32
+ var _chunkFNHN3RBDcjs = require('./chunk-FNHN3RBD.cjs');
27
33
 
28
34
 
29
35
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
@@ -250,7 +256,7 @@ function resolveFarmAppManifestInput(config, extra) {
250
256
  const llms = _optionalChain([config, 'access', _17 => _17.agent, 'optionalAccess', _18 => _18.llmsTxt]);
251
257
  const plugins = (_nullishCoalesce(config.plugins, () => ( []))).map(({ name }) => name);
252
258
  const webmcp = plugins.includes("farm:webmcp");
253
- const sections = _chunkSG57PX7Kcjs.resolveFarmAppManifestConfig.call(void 0, _optionalChain([config, 'access', _19 => _19.agent, 'optionalAccess', _20 => _20.manifest]));
259
+ const sections = _chunkBTVDYS4Bcjs.resolveFarmAppManifestConfig.call(void 0, _optionalChain([config, 'access', _19 => _19.agent, 'optionalAccess', _20 => _20.manifest]));
254
260
  return {
255
261
  renderer: _nullishCoalesce(_optionalChain([config, 'access', _21 => _21.renderer, 'optionalAccess', _22 => _22.name]), () => ( "react")),
256
262
  basePath: config.basePath || "/",
@@ -275,14 +281,14 @@ var SOURCES = {
275
281
  standalone: "defineTool",
276
282
  serverFunction: "serverFunction"
277
283
  };
278
- var DEFAULT_SECTIONS = _chunkSG57PX7Kcjs.resolveFarmAppManifestConfig.call(void 0, void 0);
284
+ var DEFAULT_SECTIONS = _chunkBTVDYS4Bcjs.resolveFarmAppManifestConfig.call(void 0, void 0);
279
285
  function createFarmAppManifest(input) {
280
286
  const sections = _nullishCoalesce(input.sections, () => ( DEFAULT_SECTIONS));
281
287
  const { app, mcp, webmcp } = sections;
282
288
  return {
283
289
  schemaVersion: 1,
284
290
  app: app ? {
285
- ...app.version ? { farm: _chunkSM25ZC4Scjs.FARM_VERSION } : {},
291
+ ...app.version ? { farm: _chunkFNHN3RBDcjs.FARM_VERSION } : {},
286
292
  ...app.renderer ? { renderer: input.renderer } : {},
287
293
  basePath: input.basePath,
288
294
  ...app.build ? { build: input.build } : {}
@@ -295,21 +301,41 @@ function createFarmAppManifest(input) {
295
301
  } : null,
296
302
  integrations: sections.integrations ? input.integrations : null,
297
303
  agent: sections.agent ? input.agent : null,
298
- plugins: sections.plugins ? input.plugins : null
304
+ plugins: sections.plugins ? input.plugins : null,
305
+ site: sections.site ? { url: resolveFarmSiteUrl() } : null
299
306
  };
300
307
  }
308
+ function asUrl(value) {
309
+ const trimmed = _optionalChain([value, 'optionalAccess', _29 => _29.trim, 'call', _30 => _30()]);
310
+ if (!trimmed) return void 0;
311
+ return /^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
312
+ }
313
+ function resolveFarmSiteUrl() {
314
+ const read = _chunk2KMIJDY6cjs.readFarmEnvironmentValue;
315
+ const explicit = read("FARM_SITE_URL");
316
+ const candidates = _optionalChain([explicit, 'optionalAccess', _31 => _31.trim, 'call', _32 => _32()]) ? [explicit] : [
317
+ asUrl(read("VERCEL_PROJECT_PRODUCTION_URL")),
318
+ read("RENDER_EXTERNAL_URL"),
319
+ asUrl(read("RAILWAY_PUBLIC_DOMAIN"))
320
+ ];
321
+ for (const candidate of candidates) {
322
+ const origin = candidate ? _chunkLWWDTBGLcjs.normalizeFarmProductionSiteOrigin.call(void 0, candidate) : void 0;
323
+ if (origin) return origin;
324
+ }
325
+ return null;
326
+ }
301
327
  function listServers(input, mcp) {
302
328
  const servers = _chunkLRB5OVRTcjs._listFarmMCPCatalogs.call(void 0, ).map(({ server, tools, details }) => {
303
- const open = _optionalChain([details, 'optionalAccess', _29 => _29.public]) === true && !_optionalChain([input, 'access', _30 => _30.guardCoversPath, 'optionalCall', _31 => _31(server.path)]);
329
+ const open = _optionalChain([details, 'optionalAccess', _33 => _33.public]) === true && !_optionalChain([input, 'access', _34 => _34.guardCoversPath, 'optionalCall', _35 => _35(server.path)]);
304
330
  return {
305
331
  name: server.name,
306
332
  version: server.version,
307
333
  path: server.path,
308
334
  authorization: open ? "none" : "required",
309
- resources: open ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _32 => _32.resources]), () => ( []))] : [],
310
- prompts: open ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _33 => _33.prompts]), () => ( []))] : [],
335
+ resources: open ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _36 => _36.resources]), () => ( []))] : [],
336
+ prompts: open ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _37 => _37.prompts]), () => ( []))] : [],
311
337
  tools: (open ? tools : []).map((tool) => {
312
- const schemas = _optionalChain([details, 'optionalAccess', _34 => _34.schemas, 'optionalAccess', _35 => _35[tool.name]]);
338
+ const schemas = _optionalChain([details, 'optionalAccess', _38 => _38.schemas, 'optionalAccess', _39 => _39[tool.name]]);
313
339
  const hints = Object.fromEntries(
314
340
  ["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"].filter((hint) => typeof tool[hint] === "boolean").map((hint) => [hint, tool[hint]])
315
341
  );
@@ -320,7 +346,7 @@ function listServers(input, mcp) {
320
346
  source: SOURCES[tool.kind],
321
347
  ...hints,
322
348
  ...schemas ? { inputSchema: schemas.input } : {},
323
- ..._optionalChain([schemas, 'optionalAccess', _36 => _36.output]) ? { outputSchema: schemas.output } : {}
349
+ ..._optionalChain([schemas, 'optionalAccess', _40 => _40.output]) ? { outputSchema: schemas.output } : {}
324
350
  };
325
351
  })
326
352
  };
@@ -338,7 +364,7 @@ function withoutSchemas({
338
364
  return tool;
339
365
  }
340
366
  function listDefaultServer(input) {
341
- const server = _optionalChain([input, 'access', _37 => _37.defaultMCP, 'optionalCall', _38 => _38()]);
367
+ const server = _optionalChain([input, 'access', _41 => _41.defaultMCP, 'optionalCall', _42 => _42()]);
342
368
  if (!server) return [];
343
369
  return [
344
370
  {
@@ -409,12 +435,12 @@ function listFarmBuiltInRoutePaths(input) {
409
435
  ...agent.apiCatalog ? [FARM_API_CATALOG_PATH] : [],
410
436
  ...agent.aiCatalog !== false ? [FARM_AI_CATALOG_PATH, FARM_ARD_PATH] : [],
411
437
  ...agent.mcp === true ? [_chunkQAS7KE7Jcjs.FARM_DEFAULT_MCP_PATH, `${_chunkQAS7KE7Jcjs.FARM_DEFAULT_MCP_PATH}${FARM_MCP_SERVER_CARD_SUFFIX}`] : [],
412
- ..._optionalChain([agent, 'access', _39 => _39.llmsTxt, 'optionalAccess', _40 => _40.enabled]) ? ["/llms.txt"] : [],
413
- ..._optionalChain([agent, 'access', _41 => _41.llmsTxt, 'optionalAccess', _42 => _42.enabled]) && agent.llmsTxt.full ? ["/llms-full.txt"] : [],
414
- ..._optionalChain([agent, 'access', _43 => _43.sitemap, 'optionalAccess', _44 => _44.enabled]) ? ["/sitemap.xml"] : [],
415
- ..._optionalChain([agent, 'access', _45 => _45.crawlers, 'optionalAccess', _46 => _46.enabled]) ? ["/robots.txt"] : [],
416
- ..._optionalChain([input, 'access', _47 => _47.openapi, 'optionalAccess', _48 => _48.route]) ? [input.openapi.route] : [],
417
- ..._optionalChain([input, 'access', _49 => _49.openapi, 'optionalAccess', _50 => _50.specRoute]) ? [input.openapi.specRoute] : []
438
+ ..._optionalChain([agent, 'access', _43 => _43.llmsTxt, 'optionalAccess', _44 => _44.enabled]) ? ["/llms.txt"] : [],
439
+ ..._optionalChain([agent, 'access', _45 => _45.llmsTxt, 'optionalAccess', _46 => _46.enabled]) && agent.llmsTxt.full ? ["/llms-full.txt"] : [],
440
+ ..._optionalChain([agent, 'access', _47 => _47.sitemap, 'optionalAccess', _48 => _48.enabled]) ? ["/sitemap.xml"] : [],
441
+ ..._optionalChain([agent, 'access', _49 => _49.crawlers, 'optionalAccess', _50 => _50.enabled]) ? ["/robots.txt"] : [],
442
+ ..._optionalChain([input, 'access', _51 => _51.openapi, 'optionalAccess', _52 => _52.route]) ? [input.openapi.route] : [],
443
+ ..._optionalChain([input, 'access', _53 => _53.openapi, 'optionalAccess', _54 => _54.specRoute]) ? [input.openapi.specRoute] : []
418
444
  ];
419
445
  }
420
446
  function normalize(pathname) {
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var version = "0.1.62";
2
+ var version = "0.1.63";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-VE3FWJBO.mjs";
13
13
  import {
14
14
  resolveDocsConfig
15
- } from "./chunk-VWW4Q3BJ.mjs";
15
+ } from "./chunk-BA2IA32Q.mjs";
16
16
  import {
17
17
  getFarmDocsAdapterConfigModule,
18
18
  isSecretDocsConfigKey