@farm.js/core 0.1.42 → 0.1.43

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 (235) hide show
  1. package/dist/{agent-mcp-ssVy_tea.d.mts → agent-mcp-3KDz4hr9.d.mts} +1 -1
  2. package/dist/{agent-mcp-SSD6L3VZ.d.ts → agent-mcp-6yRebHk7.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/api/route-manager.d.mts +3 -3
  6. package/dist/api/route-manager.d.ts +3 -3
  7. package/dist/api/runtime.d.mts +2 -2
  8. package/dist/api/runtime.d.ts +2 -2
  9. package/dist/api.cjs +2 -2
  10. package/dist/api.d.mts +8 -3
  11. package/dist/api.d.ts +8 -3
  12. package/dist/api.mjs +1 -1
  13. package/dist/{app-KjFzdCqy.d.ts → app-8Db1zR-2.d.ts} +8 -4
  14. package/dist/{app-1h3lVT4a.d.mts → app-DlTWv4cn.d.mts} +8 -4
  15. package/dist/{app-manifest-D3RkVNuS.d.mts → app-manifest-TRzS7ZZ9.d.mts} +1 -1
  16. package/dist/{app-manifest-DaW8-tvX.d.ts → app-manifest-cO2jkG1F.d.ts} +1 -1
  17. package/dist/app-markdown.d.mts +2 -2
  18. package/dist/app-markdown.d.ts +2 -2
  19. package/dist/{chunk-ECKF2BAM.cjs → chunk-2GVF3C2F.cjs} +255 -42
  20. package/dist/chunk-2NXO5SBY.mjs +57 -0
  21. package/dist/chunk-3BROEWFY.cjs +39 -0
  22. package/dist/{chunk-NU25TRIO.mjs → chunk-4MRQ5OKQ.mjs} +11 -7
  23. package/dist/{chunk-375K2ZVU.mjs → chunk-4OCEMK72.mjs} +259 -48
  24. package/dist/{chunk-6PKXK4TY.mjs → chunk-53ZV6K65.mjs} +1 -1
  25. package/dist/{chunk-LYIZHJTK.cjs → chunk-5LPHJZSI.cjs} +14 -14
  26. package/dist/chunk-5NIWBWDD.mjs +97 -0
  27. package/dist/{chunk-NRDBW4MP.mjs → chunk-7IQQIPRZ.mjs} +10 -0
  28. package/dist/{chunk-QTEJGB5A.mjs → chunk-7SCCY6SI.mjs} +79 -176
  29. package/dist/chunk-APDGOKKE.cjs +148 -0
  30. package/dist/chunk-AZBSVLRM.cjs +132 -0
  31. package/dist/{chunk-ZS6HDNOM.cjs → chunk-BKPXWRTT.cjs} +6 -6
  32. package/dist/chunk-CEDPEDNW.cjs +98 -0
  33. package/dist/chunk-D5RFPV2H.mjs +148 -0
  34. package/dist/{chunk-724JLMS4.mjs → chunk-F646BZ4Y.mjs} +4 -2
  35. package/dist/{chunk-C5KVWHIH.cjs → chunk-G2Z5DGMS.cjs} +5 -3
  36. package/dist/{chunk-7YHSD3Z6.cjs → chunk-GVNCWSQV.cjs} +83 -29
  37. package/dist/{chunk-24SP5TGU.mjs → chunk-H4LXPWI2.mjs} +2 -2
  38. package/dist/chunk-H7BLEEAE.cjs +57 -0
  39. package/dist/{chunk-QKZMB7LY.cjs → chunk-HUMEHX24.cjs} +2 -2
  40. package/dist/{chunk-BD3D7EZV.cjs → chunk-IXFOBGLQ.cjs} +9 -3
  41. package/dist/{chunk-JG3MEQUH.cjs → chunk-JDJAPCR2.cjs} +420 -209
  42. package/dist/{chunk-MHN4UR5U.cjs → chunk-KFZZFZ7J.cjs} +7 -7
  43. package/dist/chunk-LRJRXXQZ.cjs +109 -0
  44. package/dist/{chunk-BXJ5HJTJ.cjs → chunk-LVABUXLA.cjs} +15 -11
  45. package/dist/{chunk-HCSVR4YZ.mjs → chunk-M3BXTWJM.mjs} +18 -0
  46. package/dist/{chunk-2JZHQDUY.mjs → chunk-NXO75WY4.mjs} +1 -1
  47. package/dist/{chunk-TUL355PH.mjs → chunk-OYSGGV6O.mjs} +135 -160
  48. package/dist/{chunk-JR4QCLJY.cjs → chunk-PDU4P2IC.cjs} +19 -1
  49. package/dist/chunk-PJEHUSHA.mjs +229 -0
  50. package/dist/chunk-QGH2RQVF.mjs +132 -0
  51. package/dist/{chunk-YWMZUGIS.mjs → chunk-R3ZFQJEF.mjs} +247 -34
  52. package/dist/{chunk-ZATTDMBW.cjs → chunk-RACQTC7K.cjs} +270 -367
  53. package/dist/{chunk-WSOBCAYO.cjs → chunk-RQYTOFQM.cjs} +23 -23
  54. package/dist/chunk-S34OBRMZ.mjs +109 -0
  55. package/dist/{chunk-TS4JHGUJ.mjs → chunk-S3ZEMCE6.mjs} +9 -3
  56. package/dist/{chunk-WWFTAUFG.cjs → chunk-SBH2JLLF.cjs} +12 -2
  57. package/dist/{chunk-YSLWRWWP.cjs → chunk-SKK6UF5P.cjs} +200 -46
  58. package/dist/chunk-T7J7E63D.cjs +144 -0
  59. package/dist/{chunk-PIZXONIS.mjs → chunk-TESO7EFU.mjs} +55 -1
  60. package/dist/{chunk-TCJ4A4A2.cjs → chunk-VIVQERJ5.cjs} +318 -344
  61. package/dist/{chunk-JIYYX7WU.mjs → chunk-VLXNGUKO.mjs} +1 -1
  62. package/dist/{chunk-OFZUJMCU.mjs → chunk-WPJQN64R.mjs} +195 -41
  63. package/dist/chunk-XARSG2TG.mjs +144 -0
  64. package/dist/chunk-XUGFRFD2.mjs +39 -0
  65. package/dist/{chunk-AHFRQMRX.cjs → chunk-YBDSTNMH.cjs} +1 -1
  66. package/dist/{chunk-U2UC7UGP.mjs → chunk-YGZH4T2X.mjs} +1 -1
  67. package/dist/chunk-YKUEJ3MG.cjs +229 -0
  68. package/dist/{chunk-IVQY6UTY.mjs → chunk-ZYWJIPKQ.mjs} +1 -1
  69. package/dist/{client-plugins-C9Py_50W.d.mts → client-plugins-Cv0OJtnM.d.mts} +21 -2
  70. package/dist/{client-plugins-DIem0I0W.d.ts → client-plugins-kwQuZcWq.d.ts} +21 -2
  71. package/dist/client-plugins.d.mts +1 -1
  72. package/dist/client-plugins.d.ts +1 -1
  73. package/dist/client.cjs +4 -3
  74. package/dist/client.d.mts +5 -5
  75. package/dist/client.d.ts +5 -5
  76. package/dist/client.mjs +3 -2
  77. package/dist/config.d.mts +1 -1
  78. package/dist/config.d.ts +1 -1
  79. package/dist/{devtools-Q3LBNUJ7.mjs → devtools-M22FEFPK.mjs} +3 -3
  80. package/dist/{devtools-2RY3EKHL.cjs → devtools-MLB3JJMC.cjs} +4 -4
  81. package/dist/docs.cjs +5 -5
  82. package/dist/docs.d.mts +2 -2
  83. package/dist/docs.d.ts +2 -2
  84. package/dist/docs.mjs +4 -4
  85. package/dist/index-CQOp8EmB.d.mts +48 -0
  86. package/dist/index-DAl0QTZS.d.ts +48 -0
  87. package/dist/index.cjs +40 -23
  88. package/dist/index.d.mts +15 -15
  89. package/dist/index.d.ts +15 -15
  90. package/dist/index.mjs +45 -28
  91. package/dist/integrations.d.mts +1 -1
  92. package/dist/integrations.d.ts +1 -1
  93. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  94. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  95. package/dist/internal/build-runtime.cjs +28 -14
  96. package/dist/internal/build-runtime.d.mts +12 -16
  97. package/dist/internal/build-runtime.d.ts +12 -16
  98. package/dist/internal/build-runtime.mjs +27 -13
  99. package/dist/internal/cli-runtime.cjs +22 -10
  100. package/dist/internal/cli-runtime.mjs +22 -10
  101. package/dist/internal/client-error-overlay.cjs +4 -4
  102. package/dist/internal/client-error-overlay.mjs +1 -1
  103. package/dist/internal/client-runtime.cjs +5 -1
  104. package/dist/internal/client-runtime.d.mts +1 -0
  105. package/dist/internal/client-runtime.d.ts +1 -0
  106. package/dist/internal/client-runtime.mjs +4 -0
  107. package/dist/internal/compression-runtime.d.mts +1 -1
  108. package/dist/internal/compression-runtime.d.ts +1 -1
  109. package/dist/internal/config-runtime.cjs +4 -4
  110. package/dist/internal/config-runtime.d.mts +2 -2
  111. package/dist/internal/config-runtime.d.ts +2 -2
  112. package/dist/internal/config-runtime.mjs +3 -3
  113. package/dist/internal/form-actions-client.cjs +18 -0
  114. package/dist/internal/form-actions-client.d.mts +5 -0
  115. package/dist/internal/form-actions-client.d.ts +5 -0
  116. package/dist/internal/form-actions-client.mjs +18 -0
  117. package/dist/internal/form-actions.cjs +18 -0
  118. package/dist/internal/form-actions.d.mts +14 -0
  119. package/dist/internal/form-actions.d.ts +14 -0
  120. package/dist/internal/form-actions.mjs +18 -0
  121. package/dist/internal/island-codec.cjs +22 -0
  122. package/dist/internal/island-codec.d.mts +29 -0
  123. package/dist/internal/island-codec.d.ts +29 -0
  124. package/dist/internal/island-codec.mjs +22 -0
  125. package/dist/internal/island-value-store.cjs +13 -0
  126. package/dist/internal/island-value-store.d.mts +6 -0
  127. package/dist/internal/island-value-store.d.ts +6 -0
  128. package/dist/internal/island-value-store.mjs +13 -0
  129. package/dist/internal/islands-runtime.cjs +77 -0
  130. package/dist/internal/islands-runtime.d.mts +57 -0
  131. package/dist/internal/islands-runtime.d.ts +57 -0
  132. package/dist/internal/islands-runtime.mjs +77 -0
  133. package/dist/internal/islands-server.cjs +19 -0
  134. package/dist/internal/islands-server.d.mts +3 -0
  135. package/dist/internal/islands-server.d.ts +3 -0
  136. package/dist/internal/islands-server.mjs +19 -0
  137. package/dist/internal/islx-client.cjs +5 -0
  138. package/dist/internal/islx-client.d.mts +2 -0
  139. package/dist/internal/islx-client.d.ts +2 -0
  140. package/dist/internal/islx-client.mjs +3 -0
  141. package/dist/internal/islx-react.cjs +4 -0
  142. package/dist/internal/islx-react.d.mts +1 -0
  143. package/dist/internal/islx-react.d.ts +1 -0
  144. package/dist/internal/islx-react.mjs +2 -0
  145. package/dist/internal/islx-server.cjs +5 -0
  146. package/dist/internal/islx-server.d.mts +2 -0
  147. package/dist/internal/islx-server.d.ts +2 -0
  148. package/dist/internal/islx-server.mjs +3 -0
  149. package/dist/internal/isolated-boundary.cjs +4 -3
  150. package/dist/internal/isolated-boundary.d.mts +13 -1
  151. package/dist/internal/isolated-boundary.d.ts +13 -1
  152. package/dist/internal/isolated-boundary.mjs +3 -2
  153. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  154. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  155. package/dist/internal/production-runtime.cjs +23 -6
  156. package/dist/internal/production-runtime.d.mts +20 -10
  157. package/dist/internal/production-runtime.d.ts +20 -10
  158. package/dist/internal/production-runtime.mjs +23 -6
  159. package/dist/internal/server-tree.cjs +6 -3
  160. package/dist/internal/server-tree.d.mts +25 -2
  161. package/dist/internal/server-tree.d.ts +25 -2
  162. package/dist/internal/server-tree.mjs +7 -4
  163. package/dist/island-value-protocol-BRayRghM.d.mts +12 -0
  164. package/dist/island-value-protocol-BRayRghM.d.ts +12 -0
  165. package/dist/markdown.d.mts +1 -1
  166. package/dist/markdown.d.ts +1 -1
  167. package/dist/middleware.d.mts +3 -3
  168. package/dist/middleware.d.ts +3 -3
  169. package/dist/navigation.cjs +5 -4
  170. package/dist/navigation.d.mts +4 -4
  171. package/dist/navigation.d.ts +4 -4
  172. package/dist/navigation.mjs +4 -3
  173. package/dist/og.d.mts +5 -0
  174. package/dist/og.d.ts +5 -0
  175. package/dist/plugin.cjs +17 -11
  176. package/dist/plugin.d.mts +3 -3
  177. package/dist/plugin.d.ts +3 -3
  178. package/dist/plugin.mjs +16 -10
  179. package/dist/{production-runtime-bjjWq-DA.d.ts → production-runtime-5nArjFpn.d.ts} +1 -1
  180. package/dist/{production-runtime-CHFKIgpW.d.mts → production-runtime-BzsF2z5F.d.mts} +1 -1
  181. package/dist/query/client.cjs +6 -5
  182. package/dist/query/client.mjs +2 -1
  183. package/dist/{render-plan-DOHg6wdO.d.mts → render-plan-B9yQorV4.d.mts} +4 -2
  184. package/dist/{render-plan-B2UndB4x.d.ts → render-plan-fg6E_HvL.d.ts} +4 -2
  185. package/dist/renderer/react/server.cjs +7 -6
  186. package/dist/renderer/react/server.d.mts +3 -1
  187. package/dist/renderer/react/server.d.ts +3 -1
  188. package/dist/renderer/react/server.mjs +5 -4
  189. package/dist/renderer-client.cjs +5 -4
  190. package/dist/renderer-client.d.mts +3 -3
  191. package/dist/renderer-client.d.ts +3 -3
  192. package/dist/renderer-client.mjs +2 -1
  193. package/dist/renderer.d.mts +3 -1
  194. package/dist/renderer.d.ts +3 -1
  195. package/dist/{request-DQcGfdgQ.d.mts → request-C4j_g-BH.d.mts} +1 -1
  196. package/dist/{request-DVNXRQrI.d.ts → request-gz8vFK0n.d.ts} +1 -1
  197. package/dist/request.d.mts +2 -2
  198. package/dist/request.d.ts +2 -2
  199. package/dist/{route-rendering-B_6fj-GG.d.ts → route-rendering-DamyKVi3.d.ts} +1 -1
  200. package/dist/{route-rendering-CEX4mFn-.d.mts → route-rendering-iTTOwz1f.d.mts} +1 -1
  201. package/dist/{router-CKHPBKXX.d.mts → router-EoSzHlos.d.mts} +1 -1
  202. package/dist/{router-CHEMHm1P.d.ts → router-OVjDqVo8.d.ts} +1 -1
  203. package/dist/routes.d.mts +1 -1
  204. package/dist/routes.d.ts +1 -1
  205. package/dist/rsc-pipeline-LK4K5JFK.mjs +77 -0
  206. package/dist/rsc-pipeline-YCDRJME4.cjs +77 -0
  207. package/dist/{runtime-Br2ZDTAv.d.ts → runtime-CwiuozLd.d.ts} +1 -1
  208. package/dist/{runtime-jj8TKNsy.d.mts → runtime-DDH4tiuF.d.mts} +1 -1
  209. package/dist/{schema-dev-notice-5JPE67AI.cjs → schema-dev-notice-77ZL23PL.cjs} +4 -4
  210. package/dist/{schema-dev-notice-WLPZ6WKU.mjs → schema-dev-notice-BLXOS6U2.mjs} +2 -2
  211. package/dist/server-plugins.d.mts +2 -2
  212. package/dist/server-plugins.d.ts +2 -2
  213. package/dist/server.cjs +55 -37
  214. package/dist/server.d.mts +15 -10
  215. package/dist/server.d.ts +15 -10
  216. package/dist/server.mjs +35 -17
  217. package/dist/{spa-router-BEvS9Erj.d.mts → spa-router-Br4qFCWf.d.mts} +8 -3
  218. package/dist/{spa-router-DmCuH5B7.d.ts → spa-router-BsWUKH73.d.ts} +8 -3
  219. package/dist/{ssg-gT093ETk.d.ts → ssg-Csy2vwpi.d.ts} +2 -2
  220. package/dist/{ssg-57v6cZcW.d.mts → ssg-Donyfcxy.d.mts} +2 -2
  221. package/dist/testing.d.mts +1 -1
  222. package/dist/testing.d.ts +1 -1
  223. package/dist/{utils-CCTKvR-P.d.ts → utils-Luk72LXC.d.ts} +1 -1
  224. package/dist/{utils-raHHQVyL.d.mts → utils-d_k1ZZw0.d.mts} +1 -1
  225. package/dist/version.cjs +2 -2
  226. package/dist/version.mjs +1 -1
  227. package/dist/vite.cjs +17 -11
  228. package/dist/vite.d.mts +6 -4
  229. package/dist/vite.d.ts +6 -4
  230. package/dist/vite.mjs +16 -10
  231. package/package.json +53 -1
  232. package/dist/{chunk-35WS7P2V.mjs → chunk-26CXZR6L.mjs} +3 -3
  233. package/dist/{chunk-QEILRWVV.cjs → chunk-3XEMGDBF.cjs} +2 -2
  234. package/dist/{chunk-BPOTSHDO.cjs → chunk-IOAUK4OI.cjs} +2 -2
  235. package/dist/{chunk-BYR3RQPB.mjs → chunk-T76H22WI.mjs} +4 -4
@@ -1,12 +1,29 @@
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
3
 
4
- var _chunkWWFTAUFGcjs = require('./chunk-WWFTAUFG.cjs');
4
+
5
+ var _chunkSBH2JLLFcjs = require('./chunk-SBH2JLLF.cjs');
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+ var _chunkH7BLEEAEcjs = require('./chunk-H7BLEEAE.cjs');
5
20
 
6
21
 
7
22
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
8
23
 
9
24
  // src/client/isolated-boundary.ts
25
+ var ISLAND_SELECTOR = `${_chunkH7BLEEAEcjs.FARM_ISLAND_ELEMENT}[src]`;
26
+ var runtimeTagged = /* @__PURE__ */ new WeakSet();
10
27
  var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element");
11
28
  var LEGACY_REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
12
29
  var BOUNDARY_GRAPH_CONTEXT = /* @__PURE__ */ Symbol.for("farm.isolated-hydration.client-graph-context");
@@ -23,6 +40,9 @@ function getBoundaryGraphContext(ReactRuntime) {
23
40
  }
24
41
  _chunkS3JO3N4Hcjs.__name.call(void 0, getBoundaryGraphContext, "getBoundaryGraphContext");
25
42
  function serializeBoundaryProps(value, seen = /* @__PURE__ */ new Set()) {
43
+ const codec = _chunkH7BLEEAEcjs.getFarmIslandValuesServer.call(void 0, );
44
+ const leaf = _optionalChain([codec, 'optionalAccess', _ => _.encodeLeaf, 'call', _2 => _2(value)]);
45
+ if (leaf) return leaf;
26
46
  if (value === null || typeof value === "string" || typeof value === "boolean") return value;
27
47
  if (typeof value === "number") {
28
48
  if (!Number.isFinite(value)) throw new TypeError("non-finite numbers are not serializable");
@@ -31,6 +51,10 @@ function serializeBoundaryProps(value, seen = /* @__PURE__ */ new Set()) {
31
51
  if (typeof value === "undefined") {
32
52
  throw new TypeError("undefined values are not serializable");
33
53
  }
54
+ if (typeof value === "function") {
55
+ const actionId = _chunkSBH2JLLFcjs.getFarmActionId.call(void 0, value);
56
+ if (actionId) return { [_chunkH7BLEEAEcjs.FARM_TAG]: _chunkH7BLEEAEcjs.FARM_ACTION_TAG, [_chunkH7BLEEAEcjs.FARM_TAG_VALUE]: actionId };
57
+ }
34
58
  if (typeof value !== "object") {
35
59
  throw new TypeError(`${typeof value} values are not serializable`);
36
60
  }
@@ -41,22 +65,143 @@ function serializeBoundaryProps(value, seen = /* @__PURE__ */ new Set()) {
41
65
  seen.add(value);
42
66
  try {
43
67
  if (Array.isArray(value)) return value.map((entry) => serializeBoundaryProps(entry, seen));
68
+ if (codec && value instanceof Map) {
69
+ return {
70
+ [_chunkH7BLEEAEcjs.FARM_TAG]: "M",
71
+ [_chunkH7BLEEAEcjs.FARM_TAG_VALUE]: Array.from(value, ([key, entry]) => [
72
+ serializeBoundaryProps(key, seen),
73
+ serializeBoundaryProps(entry, seen)
74
+ ])
75
+ };
76
+ }
77
+ if (codec && value instanceof Set) {
78
+ return {
79
+ [_chunkH7BLEEAEcjs.FARM_TAG]: "S",
80
+ [_chunkH7BLEEAEcjs.FARM_TAG_VALUE]: Array.from(value, (entry) => serializeBoundaryProps(entry, seen))
81
+ };
82
+ }
44
83
  const prototype = Object.getPrototypeOf(value);
45
84
  if (prototype !== Object.prototype && prototype !== null) {
46
85
  throw new TypeError("class instances are not serializable");
47
86
  }
48
- return Object.fromEntries(
87
+ const serialized = Object.fromEntries(
49
88
  Object.entries(value).map(([key, entry]) => [key, serializeBoundaryProps(entry, seen)])
50
89
  );
90
+ return codec && !runtimeTagged.has(value) && Object.prototype.hasOwnProperty.call(value, _chunkH7BLEEAEcjs.FARM_TAG) ? { [_chunkH7BLEEAEcjs.FARM_TAG]: _chunkH7BLEEAEcjs.FARM_OBJECT_TAG, [_chunkH7BLEEAEcjs.FARM_TAG_VALUE]: serialized } : serialized;
51
91
  } finally {
52
92
  seen.delete(value);
53
93
  }
54
94
  }
55
95
  _chunkS3JO3N4Hcjs.__name.call(void 0, serializeBoundaryProps, "serializeBoundaryProps");
56
96
  function serializeBoundaryPayload(value) {
57
- return JSON.stringify(serializeBoundaryProps(value)).replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
97
+ return escapeScriptJson(JSON.stringify(serializeBoundaryProps(value)));
58
98
  }
59
99
  _chunkS3JO3N4Hcjs.__name.call(void 0, serializeBoundaryPayload, "serializeBoundaryPayload");
100
+ function escapeScriptJson(json) {
101
+ return json.replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
102
+ }
103
+ _chunkS3JO3N4Hcjs.__name.call(void 0, escapeScriptJson, "escapeScriptJson");
104
+ var SLOT_ELEMENT = _chunkH7BLEEAEcjs.FARM_SLOT_ELEMENT;
105
+ function isReactElementValue(value) {
106
+ const type = _optionalChain([value, 'optionalAccess', _3 => _3.$$typeof]);
107
+ return type === REACT_ELEMENT_TYPE || type === LEGACY_REACT_ELEMENT_TYPE;
108
+ }
109
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isReactElementValue, "isReactElementValue");
110
+ function slotReference(id) {
111
+ const reference = { [_chunkH7BLEEAEcjs.FARM_TAG]: _chunkH7BLEEAEcjs.FARM_SLOT_TAG, [_chunkH7BLEEAEcjs.FARM_TAG_VALUE]: id };
112
+ runtimeTagged.add(reference);
113
+ return reference;
114
+ }
115
+ _chunkS3JO3N4Hcjs.__name.call(void 0, slotReference, "slotReference");
116
+ function splitSlotProps(ReactRuntime, value, slotPrefix, counter) {
117
+ if (isReactElementValue(value)) {
118
+ const id = `${slotPrefix}${counter.next++}`;
119
+ return {
120
+ render: ReactRuntime.createElement(
121
+ SLOT_ELEMENT,
122
+ { key: _nullishCoalesce(value.key, () => ( id)), name: id, style: { display: "contents" } },
123
+ value
124
+ ),
125
+ wire: slotReference(id)
126
+ };
127
+ }
128
+ if (Array.isArray(value)) {
129
+ const parts = value.map((entry) => splitSlotProps(ReactRuntime, entry, slotPrefix, counter));
130
+ return { render: parts.map((part) => part.render), wire: parts.map((part) => part.wire) };
131
+ }
132
+ if (value && typeof value === "object") {
133
+ const prototype = Object.getPrototypeOf(value);
134
+ if (prototype !== Object.prototype && prototype !== null) return { render: value, wire: value };
135
+ const render = {};
136
+ const wire = {};
137
+ for (const [key, entry] of Object.entries(value)) {
138
+ const part = splitSlotProps(ReactRuntime, entry, slotPrefix, counter);
139
+ render[key] = part.render;
140
+ wire[key] = part.wire;
141
+ }
142
+ return { render, wire };
143
+ }
144
+ return { render: value, wire: value };
145
+ }
146
+ _chunkS3JO3N4Hcjs.__name.call(void 0, splitSlotProps, "splitSlotProps");
147
+ var FARM_NOT_A_MARKER = /* @__PURE__ */ Symbol.for("farm.codec.not-a-marker");
148
+ function reviveSlotProps(ReactRuntime, value, container, actions, decode) {
149
+ if (Array.isArray(value)) {
150
+ let changed2 = false;
151
+ const revived2 = value.map((entry) => {
152
+ const next = reviveSlotProps(ReactRuntime, entry, container, actions, decode);
153
+ if (next !== entry) changed2 = true;
154
+ return next;
155
+ });
156
+ return changed2 ? revived2 : value;
157
+ }
158
+ if (!value || typeof value !== "object") return value;
159
+ const tag = decode || actions ? _chunkH7BLEEAEcjs.getFarmTag.call(void 0, value) : void 0;
160
+ const data = tag === void 0 ? void 0 : value[_chunkH7BLEEAEcjs.FARM_TAG_VALUE];
161
+ if (tag === _chunkH7BLEEAEcjs.FARM_ACTION_TAG && typeof data === "string") {
162
+ if (!actions) throw new Error("server action props need islands mode");
163
+ return actions(data);
164
+ }
165
+ if (tag === _chunkH7BLEEAEcjs.FARM_SLOT_TAG && typeof data === "string") {
166
+ let html = "";
167
+ for (const slot of container.querySelectorAll(SLOT_ELEMENT)) {
168
+ if (slot.getAttribute("name") === data) {
169
+ html = slot.innerHTML;
170
+ break;
171
+ }
172
+ }
173
+ return ReactRuntime.createElement(SLOT_ELEMENT, {
174
+ key: data,
175
+ name: data,
176
+ style: { display: "contents" },
177
+ suppressHydrationWarning: true,
178
+ dangerouslySetInnerHTML: { __html: html }
179
+ });
180
+ }
181
+ if (tag === _chunkH7BLEEAEcjs.FARM_REFERENCE_TAG) throw new Error(`island value ${String(data)} was not resolved`);
182
+ if (tag !== void 0) {
183
+ if (!decode) throw new Error("typed props need islands mode");
184
+ const decoded = decode(
185
+ value,
186
+ (child) => reviveSlotProps(ReactRuntime, child, container, actions, decode)
187
+ );
188
+ if (decoded !== FARM_NOT_A_MARKER) return decoded;
189
+ }
190
+ let changed = false;
191
+ const revived = {};
192
+ for (const [key, entry] of Object.entries(value)) {
193
+ const next = reviveSlotProps(ReactRuntime, entry, container, actions, decode);
194
+ Object.defineProperty(revived, key, {
195
+ value: next,
196
+ enumerable: true,
197
+ writable: true,
198
+ configurable: true
199
+ });
200
+ if (next !== entry) changed = true;
201
+ }
202
+ return changed ? revived : value;
203
+ }
204
+ _chunkS3JO3N4Hcjs.__name.call(void 0, reviveSlotProps, "reviveSlotProps");
60
205
  function wrapFarmIsolatedClientGraph(ReactRuntime, element) {
61
206
  const Context = getBoundaryGraphContext(ReactRuntime);
62
207
  return ReactRuntime.createElement(Context.Provider, { value: true }, element);
@@ -68,7 +213,7 @@ function isolateFarmServerPageGraph(ReactRuntime, element) {
68
213
  }
69
214
  _chunkS3JO3N4Hcjs.__name.call(void 0, isolateFarmServerPageGraph, "isolateFarmServerPageGraph");
70
215
  var warnedUnserializableBoundaries = /* @__PURE__ */ new Set();
71
- function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReference, exportName, islandStrategy) {
216
+ function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReference, exportName, islandStrategy, boundaryOptions = {}) {
72
217
  function FarmIsolatedClientBoundary(props) {
73
218
  const Context = getBoundaryGraphContext(ReactRuntime);
74
219
  const belongsToParentClientGraph = ReactRuntime.useContext(Context);
@@ -77,8 +222,30 @@ function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReferen
77
222
  return ReactRuntime.createElement(Component, props);
78
223
  }
79
224
  let serializedProps;
225
+ let renderProps = props;
226
+ let valueScripts = [];
80
227
  try {
81
- serializedProps = serializeBoundaryPayload(props);
228
+ if (boundaryOptions.slots) {
229
+ const { render, wire } = splitSlotProps(ReactRuntime, props, `${boundaryId}s`, { next: 0 });
230
+ renderProps = render;
231
+ const values = boundaryOptions.values ? _chunkH7BLEEAEcjs.getFarmIslandValuesServer.call(void 0, ) : void 0;
232
+ if (values) {
233
+ const addressed = values.address(serializeBoundaryProps(wire));
234
+ serializedProps = escapeScriptJson(addressed.json);
235
+ valueScripts = values.select(addressed, values.held()).map(
236
+ (value) => ReactRuntime.createElement("script", {
237
+ key: value.key,
238
+ type: _chunkH7BLEEAEcjs.FARM_VALUE_SCRIPT_TYPE,
239
+ name: value.key,
240
+ dangerouslySetInnerHTML: { __html: escapeScriptJson(value.json) }
241
+ })
242
+ );
243
+ } else {
244
+ serializedProps = serializeBoundaryPayload(wire);
245
+ }
246
+ } else {
247
+ serializedProps = serializeBoundaryPayload(props);
248
+ }
82
249
  } catch (error) {
83
250
  const message = error instanceof Error ? error.message : String(error);
84
251
  const warningKey = `${moduleReference}#${exportName}:${message}`;
@@ -93,31 +260,32 @@ function createFarmIsolatedClientBoundary(ReactRuntime, Component, moduleReferen
93
260
  return ReactRuntime.createElement(
94
261
  ReactRuntime.Fragment,
95
262
  null,
263
+ ...valueScripts,
96
264
  ReactRuntime.createElement(
97
- "farm-client-boundary",
265
+ _chunkH7BLEEAEcjs.FARM_ISLAND_ELEMENT,
98
266
  {
99
- "data-farm-client-boundary": moduleReference,
100
- "data-farm-client-id": boundaryId,
101
- "data-farm-client-export": exportName,
102
- "data-farm-island-strategy": islandStrategy,
267
+ src: moduleReference,
268
+ export: exportName,
269
+ props: boundaryId,
270
+ strategy: islandStrategy,
103
271
  style: { display: "contents" }
104
272
  },
105
273
  ReactRuntime.createElement(
106
274
  Context.Provider,
107
275
  { value: true },
108
- ReactRuntime.createElement(Component, props)
276
+ ReactRuntime.createElement(Component, renderProps)
109
277
  )
110
278
  ),
111
279
  ReactRuntime.createElement("script", {
112
- type: "application/json",
113
- "data-farm-client-props": boundaryId,
280
+ type: _chunkH7BLEEAEcjs.FARM_PROPS_SCRIPT_TYPE,
281
+ htmlFor: boundaryId,
114
282
  dangerouslySetInnerHTML: { __html: serializedProps }
115
283
  })
116
284
  );
117
285
  }
118
286
  _chunkS3JO3N4Hcjs.__name.call(void 0, FarmIsolatedClientBoundary, "FarmIsolatedClientBoundary");
119
287
  FarmIsolatedClientBoundary.displayName = `FarmIsolated(${Component.displayName || Component.name || exportName})`;
120
- _chunkWWFTAUFGcjs.markFarmClientReference.call(void 0, FarmIsolatedClientBoundary, {
288
+ _chunkSBH2JLLFcjs.markFarmClientReference.call(void 0, FarmIsolatedClientBoundary, {
121
289
  reference: moduleReference,
122
290
  exportName,
123
291
  Component
@@ -131,13 +299,13 @@ function isEarlyHydrationUpdate(error) {
131
299
  _chunkS3JO3N4Hcjs.__name.call(void 0, isEarlyHydrationUpdate, "isEarlyHydrationUpdate");
132
300
  function findBoundaryPayload(container, boundaryId) {
133
301
  const sibling = container.nextElementSibling;
134
- if (sibling instanceof HTMLScriptElement && sibling.type === "application/json" && sibling.getAttribute("data-farm-client-props") === boundaryId) {
302
+ if (sibling instanceof HTMLScriptElement && sibling.type === _chunkH7BLEEAEcjs.FARM_PROPS_SCRIPT_TYPE && sibling.getAttribute("for") === boundaryId) {
135
303
  return sibling;
136
304
  }
137
305
  for (const candidate of container.ownerDocument.querySelectorAll(
138
- 'script[type="application/json"][data-farm-client-props]'
306
+ `script[type="${_chunkH7BLEEAEcjs.FARM_PROPS_SCRIPT_TYPE}"]`
139
307
  )) {
140
- if (candidate.getAttribute("data-farm-client-props") === boundaryId) return candidate;
308
+ if (candidate.getAttribute("for") === boundaryId) return candidate;
141
309
  }
142
310
  return null;
143
311
  }
@@ -153,7 +321,7 @@ function createFarmIsolatedHydrationRuntime(options) {
153
321
  );
154
322
  queueMicrotask(() => {
155
323
  try {
156
- _optionalChain([roots, 'access', _ => _.get, 'call', _2 => _2(container), 'optionalAccess', _3 => _3.root, 'access', _4 => _4.unmount, 'call', _5 => _5()]);
324
+ _optionalChain([roots, 'access', _4 => _4.get, 'call', _5 => _5(container), 'optionalAccess', _6 => _6.root, 'access', _7 => _7.unmount, 'call', _8 => _8()]);
157
325
  } catch (e) {
158
326
  }
159
327
  roots.delete(container);
@@ -191,23 +359,73 @@ function createFarmIsolatedHydrationRuntime(options) {
191
359
  )
192
360
  );
193
361
  }, "createBoundaryGraph");
194
- async function hydrate(scope = document, signal) {
195
- const candidates = Array.from(
196
- scope.querySelectorAll("farm-client-boundary[data-farm-client-boundary]")
362
+ function readBoundaryProps(container, boundaryId) {
363
+ const payload = findBoundaryPayload(container, boundaryId);
364
+ if (!payload) throw new Error(`serialized props ${boundaryId} were not found`);
365
+ const parsedProps = JSON.parse(payload.textContent || "{}");
366
+ if (!parsedProps || typeof parsedProps !== "object" || Array.isArray(parsedProps)) {
367
+ throw new Error("serialized props must be an object");
368
+ }
369
+ let resolvedProps = parsedProps;
370
+ if (_optionalChain([payload, 'access', _9 => _9.textContent, 'optionalAccess', _10 => _10.includes, 'call', _11 => _11(`"${_chunkH7BLEEAEcjs.FARM_TAG}":"${_chunkH7BLEEAEcjs.FARM_REFERENCE_TAG}"`)])) {
371
+ if (!options.values) throw new Error("island values need islands mode");
372
+ options.values.ingest(container.ownerDocument);
373
+ resolvedProps = options.values.resolve(parsedProps);
374
+ }
375
+ return reviveSlotProps(
376
+ options.ReactRuntime,
377
+ resolvedProps,
378
+ container,
379
+ options.actions,
380
+ options.decode
197
381
  );
198
- if (scope instanceof Element && scope.matches("farm-client-boundary[data-farm-client-boundary]")) {
382
+ }
383
+ _chunkS3JO3N4Hcjs.__name.call(void 0, readBoundaryProps, "readBoundaryProps");
384
+ const topLevelBoundaries = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (scope) => Array.from(scope.querySelectorAll(ISLAND_SELECTOR)).filter(
385
+ (container) => !_optionalChain([container, 'access', _12 => _12.parentElement, 'optionalAccess', _13 => _13.closest, 'call', _14 => _14(ISLAND_SELECTOR)])
386
+ ), "topLevelBoundaries");
387
+ const boundaryKey = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (container) => `${container.getAttribute("src")}#${container.getAttribute("export") || "default"}`, "boundaryKey");
388
+ function carryOver(current, next) {
389
+ const live = /* @__PURE__ */ new Map();
390
+ for (const container of topLevelBoundaries(current)) {
391
+ if (!roots.has(container)) continue;
392
+ const key = boundaryKey(container);
393
+ live.set(key, [..._nullishCoalesce(live.get(key), () => ( [])), container]);
394
+ }
395
+ let carried = 0;
396
+ for (const container of topLevelBoundaries(next)) {
397
+ const previous = _optionalChain([live, 'access', _15 => _15.get, 'call', _16 => _16(boundaryKey(container)), 'optionalAccess', _17 => _17.shift, 'call', _18 => _18()]);
398
+ const record = previous && roots.get(previous);
399
+ const boundaryId = container.getAttribute("props");
400
+ if (!previous || !record || !boundaryId) continue;
401
+ try {
402
+ const props = readBoundaryProps(container, boundaryId);
403
+ record.root.render(createBoundaryGraph(record.Component, props, record.restore));
404
+ record.props = props;
405
+ container.replaceWith(previous);
406
+ carried++;
407
+ } catch (error) {
408
+ report(`Could not keep ${boundaryKey(container)} across the refresh.`, error);
409
+ }
410
+ }
411
+ return carried;
412
+ }
413
+ _chunkS3JO3N4Hcjs.__name.call(void 0, carryOver, "carryOver");
414
+ async function hydrate(scope = document, signal) {
415
+ const candidates = Array.from(scope.querySelectorAll(ISLAND_SELECTOR));
416
+ if (scope instanceof Element && scope.matches(ISLAND_SELECTOR)) {
199
417
  candidates.unshift(scope);
200
418
  }
201
419
  const boundaries = candidates.filter((container) => {
202
420
  if (roots.has(container) || pending.has(container)) return false;
203
- return !_optionalChain([container, 'access', _6 => _6.parentElement, 'optionalAccess', _7 => _7.closest, 'call', _8 => _8("farm-client-boundary[data-farm-client-boundary]")]);
421
+ return !_optionalChain([container, 'access', _19 => _19.parentElement, 'optionalAccess', _20 => _20.closest, 'call', _21 => _21(ISLAND_SELECTOR)]);
204
422
  });
205
423
  await Promise.all(
206
424
  boundaries.map(async (container) => {
207
- const reference = container.getAttribute("data-farm-client-boundary");
208
- const boundaryId = container.getAttribute("data-farm-client-id");
209
- const exportName = container.getAttribute("data-farm-client-export") || "default";
210
- const strategy = _nullishCoalesce(container.getAttribute("data-farm-island-strategy"), () => ( "load"));
425
+ const reference = container.getAttribute("src");
426
+ const boundaryId = container.getAttribute("props");
427
+ const exportName = container.getAttribute("export") || "default";
428
+ const strategy = _nullishCoalesce(container.getAttribute("strategy"), () => ( "load"));
211
429
  if (!reference || !boundaryId) {
212
430
  report("An isolated client boundary is missing its module reference or payload ID.");
213
431
  return;
@@ -219,10 +437,10 @@ function createFarmIsolatedHydrationRuntime(options) {
219
437
  }, "releasePending");
220
438
  controller.signal.addEventListener("abort", releasePending, { once: true });
221
439
  const abort = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => controller.abort(), "abort");
222
- if (_optionalChain([signal, 'optionalAccess', _9 => _9.aborted])) abort();
223
- else _optionalChain([signal, 'optionalAccess', _10 => _10.addEventListener, 'call', _11 => _11("abort", abort, { once: true })]);
440
+ if (_optionalChain([signal, 'optionalAccess', _22 => _22.aborted])) abort();
441
+ else _optionalChain([signal, 'optionalAccess', _23 => _23.addEventListener, 'call', _24 => _24("abort", abort, { once: true })]);
224
442
  const cleanup = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
225
- _optionalChain([signal, 'optionalAccess', _12 => _12.removeEventListener, 'call', _13 => _13("abort", abort)]);
443
+ _optionalChain([signal, 'optionalAccess', _25 => _25.removeEventListener, 'call', _26 => _26("abort", abort)]);
226
444
  releasePending();
227
445
  }, "cleanup");
228
446
  let scheduled;
@@ -238,16 +456,11 @@ function createFarmIsolatedHydrationRuntime(options) {
238
456
  const module = await options.load(reference);
239
457
  if (controller.signal.aborted || !container.isConnected) return;
240
458
  const originals = module.__farm_client_boundary_originals__;
241
- const Component = _optionalChain([originals, 'optionalAccess', _14 => _14[exportName]]);
459
+ const Component = _optionalChain([originals, 'optionalAccess', _27 => _27[exportName]]);
242
460
  if (typeof Component !== "function" && typeof Component !== "object") {
243
461
  throw new Error("compiled original export was not found");
244
462
  }
245
- const payload = findBoundaryPayload(container, boundaryId);
246
- if (!payload) throw new Error(`serialized props ${boundaryId} were not found`);
247
- const props = JSON.parse(payload.textContent || "{}");
248
- if (!props || typeof props !== "object" || Array.isArray(props)) {
249
- throw new Error("serialized props must be an object");
250
- }
463
+ const props = readBoundaryProps(container, boundaryId);
251
464
  let rootFailure;
252
465
  const restore = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (error) => {
253
466
  if (rootFailure !== void 0) return;
@@ -271,6 +484,7 @@ function createFarmIsolatedHydrationRuntime(options) {
271
484
  });
272
485
  roots.set(container, {
273
486
  root,
487
+ Component,
274
488
  dispose() {
275
489
  disposing = true;
276
490
  try {
@@ -313,10 +527,10 @@ function createFarmIsolatedHydrationRuntime(options) {
313
527
  _chunkS3JO3N4Hcjs.__name.call(void 0, hydrate, "hydrate");
314
528
  function updateModule(reference, module) {
315
529
  const originals = module.__farm_client_boundary_originals__;
316
- let updated = _chunkWWFTAUFGcjs.updateFarmServerTreeModule.call(void 0, reference, module);
530
+ let updated = _chunkSBH2JLLFcjs.updateFarmServerTreeModule.call(void 0, reference, module);
317
531
  for (const [container, record] of roots) {
318
532
  if (record.reference !== reference) continue;
319
- const Component = _optionalChain([originals, 'optionalAccess', _15 => _15[record.exportName]]);
533
+ const Component = _optionalChain([originals, 'optionalAccess', _28 => _28[record.exportName]]);
320
534
  if (typeof Component !== "function" && typeof Component !== "object") {
321
535
  failRoot(
322
536
  container,
@@ -361,6 +575,7 @@ function createFarmIsolatedHydrationRuntime(options) {
361
575
  _chunkS3JO3N4Hcjs.__name.call(void 0, dispose, "dispose");
362
576
  return {
363
577
  hydrate,
578
+ carryOver,
364
579
  updateModule,
365
580
  dispose,
366
581
  rootCount: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => roots.size, "rootCount")
@@ -374,9 +589,7 @@ function createFarmServerPageBoundary(ReactRuntime, runtime) {
374
589
  ReactRuntime.useLayoutEffect(() => {
375
590
  const page = ref.current;
376
591
  if (!page) return;
377
- const islands = Array.from(
378
- page.querySelectorAll("farm-client-boundary[data-farm-client-boundary]")
379
- );
592
+ const islands = Array.from(page.querySelectorAll(ISLAND_SELECTOR));
380
593
  if (islands.length === 0) return;
381
594
  const controller = new AbortController();
382
595
  runtime.hydrate(page, controller.signal).catch((error) => {
@@ -0,0 +1,57 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-LPEX4YW6.mjs";
4
+
5
+ // src/client/island-value-protocol.ts
6
+ var FARM_ISLAND_ELEMENT = "f-island";
7
+ var FARM_PROPS_SCRIPT_TYPE = "f/props";
8
+ var FARM_VALUE_SCRIPT_TYPE = "f/value";
9
+ var FARM_SLOT_ELEMENT = "f-slot";
10
+ var FARM_TAG = "$";
11
+ var FARM_TAG_VALUE = "v";
12
+ var FARM_REFERENCE_TAG = "r";
13
+ var FARM_SLOT_TAG = "s";
14
+ var FARM_ACTION_TAG = "a";
15
+ var FARM_OBJECT_TAG = "o";
16
+ var FARM_VALUES_HEADER = "F-Values";
17
+ function getFarmTag(value) {
18
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
19
+ const tag = value[FARM_TAG];
20
+ if (typeof tag !== "string") return void 0;
21
+ const keys = Object.keys(value);
22
+ return keys.length === 1 || keys.length === 2 && FARM_TAG_VALUE in value ? tag : void 0;
23
+ }
24
+ __name(getFarmTag, "getFarmTag");
25
+ var FARM_VALUE_KEY_PATTERN = /^[0-9a-z]{14}$/;
26
+ var FARM_MAX_HELD_VALUES = 128;
27
+ var FARM_ISLAND_VALUE_STORE_KEY = /* @__PURE__ */ Symbol.for("islx.values");
28
+ var ISLAND_VALUES_SERVER_KEY = /* @__PURE__ */ Symbol.for("farm.island-values.server");
29
+ function getFarmIslandValuesServer() {
30
+ return globalThis[ISLAND_VALUES_SERVER_KEY];
31
+ }
32
+ __name(getFarmIslandValuesServer, "getFarmIslandValuesServer");
33
+ function getFarmIslandValueHeaders() {
34
+ const scope = globalThis;
35
+ const held = scope[FARM_ISLAND_VALUE_STORE_KEY]?.heldHeader();
36
+ return held ? { [FARM_VALUES_HEADER]: held } : {};
37
+ }
38
+ __name(getFarmIslandValueHeaders, "getFarmIslandValueHeaders");
39
+
40
+ export {
41
+ FARM_ISLAND_ELEMENT,
42
+ FARM_PROPS_SCRIPT_TYPE,
43
+ FARM_VALUE_SCRIPT_TYPE,
44
+ FARM_SLOT_ELEMENT,
45
+ FARM_TAG,
46
+ FARM_TAG_VALUE,
47
+ FARM_REFERENCE_TAG,
48
+ FARM_SLOT_TAG,
49
+ FARM_ACTION_TAG,
50
+ FARM_OBJECT_TAG,
51
+ FARM_VALUES_HEADER,
52
+ getFarmTag,
53
+ FARM_VALUE_KEY_PATTERN,
54
+ FARM_MAX_HELD_VALUES,
55
+ getFarmIslandValuesServer,
56
+ getFarmIslandValueHeaders
57
+ };
@@ -0,0 +1,39 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkP4TYB4SFcjs = require('./chunk-P4TYB4SF.cjs');
4
+
5
+
6
+
7
+ var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
8
+
9
+
10
+ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
11
+
12
+ // src/form-actions.ts
13
+ var _server = require('@farm.js/islx/server');
14
+ var FARM_FORM_ACTION_HEADER = "F-Action";
15
+ function registerFarmFormAction(action, id) {
16
+ return _server.registerServerReference.call(void 0, action, id);
17
+ }
18
+ _chunkS3JO3N4Hcjs.__name.call(void 0, registerFarmFormAction, "registerFarmFormAction");
19
+ function handleFarmFormActionRequest(request, config) {
20
+ return _server.handleAction.call(void 0, request, {
21
+ allowedOrigins: config.allowedOrigins,
22
+ bodySizeLimit: config.bodySizeLimit,
23
+ run: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (actionRequest, action) => _chunkP4TYB4SFcjs.runWithServerActionRequest.call(void 0, actionRequest, action), "run"),
24
+ mapError(error) {
25
+ const redirect = _chunkOX6O6WVAcjs.getFarmRedirectError.call(void 0, error);
26
+ if (redirect) return { redirect: redirect.url };
27
+ if (_chunkOX6O6WVAcjs.isFarmNotFoundError.call(void 0, error)) return { status: 404 };
28
+ return void 0;
29
+ },
30
+ onError: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (error) => console.error("[Farm.js] Server action failed:", error), "onError")
31
+ });
32
+ }
33
+ _chunkS3JO3N4Hcjs.__name.call(void 0, handleFarmFormActionRequest, "handleFarmFormActionRequest");
34
+
35
+
36
+
37
+
38
+
39
+ exports.FARM_FORM_ACTION_HEADER = FARM_FORM_ACTION_HEADER; exports.registerFarmFormAction = registerFarmFormAction; exports.handleFarmFormActionRequest = handleFarmFormActionRequest;
@@ -2,19 +2,20 @@ import {
2
2
  resolveFarmAuthConfig,
3
3
  resolveFarmAuthIntegration,
4
4
  resolveFarmDevIndicatorsConfig,
5
+ resolveFarmServerComponentsMode,
5
6
  setFarmProjectSourceDir
6
- } from "./chunk-HCSVR4YZ.mjs";
7
- import {
8
- normalizeRouteRules,
9
- routeRulesToHeaders,
10
- routeRulesToRedirects
11
- } from "./chunk-GHFS7RUB.mjs";
7
+ } from "./chunk-M3BXTWJM.mjs";
12
8
  import {
13
9
  assertPluginDependencies
14
10
  } from "./chunk-CZS6OACQ.mjs";
15
11
  import {
16
12
  resolveFarmDevtoolsConfig
17
13
  } from "./chunk-JBSVKMC5.mjs";
14
+ import {
15
+ normalizeRouteRules,
16
+ routeRulesToHeaders,
17
+ routeRulesToRedirects
18
+ } from "./chunk-GHFS7RUB.mjs";
18
19
  import {
19
20
  isReactRenderer,
20
21
  resolveFarmRenderer
@@ -680,6 +681,7 @@ function validateConfigRouteSources(routes, field) {
680
681
  }
681
682
  __name(validateConfigRouteSources, "validateConfigRouteSources");
682
683
  async function resolveConfig(userConfig, mode) {
684
+ resolveFarmServerComponentsMode(userConfig.experimental?.serverComponents);
683
685
  const projectRoot = userConfig.root || process.cwd();
684
686
  const layerResolution = await resolveFarmLayers(userConfig, {
685
687
  root: projectRoot,
@@ -794,7 +796,9 @@ async function resolveConfig(userConfig, mode) {
794
796
  experimental: {
795
797
  serverComponents: false,
796
798
  serverActions: false,
797
- isolatedClientHydration: "off",
799
+ // Islands mode hydrates client components as islands (RFC 0003); an app can still pick
800
+ // isolatedClientHydration itself.
801
+ isolatedClientHydration: resolveFarmServerComponentsMode(userConfig.experimental?.serverComponents) === "islands" ? "enabled" : "off",
798
802
  ppr: false,
799
803
  ...userConfig.experimental
800
804
  },