@farm.js/core 0.1.42 → 0.1.44

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 (243) hide show
  1. package/dist/{agent-mcp-ssVy_tea.d.mts → agent-mcp-CWI-awqd.d.mts} +1 -1
  2. package/dist/{agent-mcp-SSD6L3VZ.d.ts → agent-mcp-EnzWYv_X.d.ts} +1 -1
  3. package/dist/agent-runtime.cjs +3 -2
  4. package/dist/agent-runtime.d.mts +1 -1
  5. package/dist/agent-runtime.d.ts +1 -1
  6. package/dist/agent-runtime.mjs +2 -1
  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.cjs +2 -2
  12. package/dist/api.d.mts +8 -3
  13. package/dist/api.d.ts +8 -3
  14. package/dist/api.mjs +1 -1
  15. package/dist/{app-KjFzdCqy.d.ts → app-CAN_2Cqo.d.ts} +8 -4
  16. package/dist/{app-1h3lVT4a.d.mts → app-DG3dE8v5.d.mts} +8 -4
  17. package/dist/{app-manifest-D3RkVNuS.d.mts → app-manifest-8x5VjZ0L.d.mts} +1 -1
  18. package/dist/{app-manifest-DaW8-tvX.d.ts → app-manifest-DazjgQya.d.ts} +1 -1
  19. package/dist/app-markdown.d.mts +2 -2
  20. package/dist/app-markdown.d.ts +2 -2
  21. package/dist/{chunk-ECKF2BAM.cjs → chunk-2GVF3C2F.cjs} +255 -42
  22. package/dist/{chunk-TUL355PH.mjs → chunk-2MKTHHEU.mjs} +136 -161
  23. package/dist/chunk-2NXO5SBY.mjs +57 -0
  24. package/dist/{chunk-AX7S67YV.mjs → chunk-37VKVISD.mjs} +9 -173
  25. package/dist/chunk-3BROEWFY.cjs +39 -0
  26. package/dist/chunk-3SAWHWDH.cjs +186 -0
  27. package/dist/{chunk-AHFRQMRX.cjs → chunk-3YJMBQ27.cjs} +1 -1
  28. package/dist/{chunk-6PKXK4TY.mjs → chunk-53ZV6K65.mjs} +1 -1
  29. package/dist/{chunk-JG3MEQUH.cjs → chunk-5GBL2LKD.cjs} +430 -217
  30. package/dist/{chunk-LYIZHJTK.cjs → chunk-5LPHJZSI.cjs} +14 -14
  31. package/dist/chunk-5NIWBWDD.mjs +97 -0
  32. package/dist/{chunk-NRDBW4MP.mjs → chunk-7IQQIPRZ.mjs} +10 -0
  33. package/dist/{chunk-TCJ4A4A2.cjs → chunk-AI3WVJNP.cjs} +324 -350
  34. package/dist/chunk-APDGOKKE.cjs +148 -0
  35. package/dist/chunk-AZBSVLRM.cjs +132 -0
  36. package/dist/{chunk-RHGK2JEN.cjs → chunk-B6XAA7V6.cjs} +18 -182
  37. package/dist/chunk-CEDPEDNW.cjs +98 -0
  38. package/dist/{chunk-WSOBCAYO.cjs → chunk-CW6SNEN2.cjs} +25 -25
  39. package/dist/chunk-D5RFPV2H.mjs +148 -0
  40. package/dist/chunk-E22SWCXB.cjs +144 -0
  41. package/dist/{chunk-375K2ZVU.mjs → chunk-ERA5RP3L.mjs} +263 -50
  42. package/dist/{chunk-724JLMS4.mjs → chunk-F646BZ4Y.mjs} +4 -2
  43. package/dist/{chunk-C5KVWHIH.cjs → chunk-G2Z5DGMS.cjs} +5 -3
  44. package/dist/{chunk-ZATTDMBW.cjs → chunk-GA6JM4L6.cjs} +279 -376
  45. package/dist/chunk-GZWHCWLB.mjs +186 -0
  46. package/dist/{chunk-24SP5TGU.mjs → chunk-H4LXPWI2.mjs} +2 -2
  47. package/dist/chunk-H7BLEEAE.cjs +57 -0
  48. package/dist/chunk-IOMVXBLZ.mjs +144 -0
  49. package/dist/{chunk-BD3D7EZV.cjs → chunk-IXFOBGLQ.cjs} +9 -3
  50. package/dist/{chunk-JIYYX7WU.mjs → chunk-JVXW76I7.mjs} +2 -2
  51. package/dist/{chunk-MHN4UR5U.cjs → chunk-KFZZFZ7J.cjs} +7 -7
  52. package/dist/{chunk-BXJ5HJTJ.cjs → chunk-LPE3ED4R.cjs} +17 -13
  53. package/dist/chunk-LRJRXXQZ.cjs +109 -0
  54. package/dist/{chunk-HCSVR4YZ.mjs → chunk-M3BXTWJM.mjs} +18 -0
  55. package/dist/{chunk-2JZHQDUY.mjs → chunk-OYZGFRPA.mjs} +1 -1
  56. package/dist/{chunk-JR4QCLJY.cjs → chunk-PDU4P2IC.cjs} +19 -1
  57. package/dist/chunk-PJEHUSHA.mjs +229 -0
  58. package/dist/{chunk-QTEJGB5A.mjs → chunk-QGFKXYC7.mjs} +80 -177
  59. package/dist/chunk-QGH2RQVF.mjs +132 -0
  60. package/dist/{chunk-YWMZUGIS.mjs → chunk-R3ZFQJEF.mjs} +247 -34
  61. package/dist/{chunk-U2UC7UGP.mjs → chunk-R4J2UOV4.mjs} +1 -1
  62. package/dist/chunk-S34OBRMZ.mjs +109 -0
  63. package/dist/{chunk-TS4JHGUJ.mjs → chunk-S3ZEMCE6.mjs} +9 -3
  64. package/dist/{chunk-WWFTAUFG.cjs → chunk-SBH2JLLF.cjs} +12 -2
  65. package/dist/{chunk-YSLWRWWP.cjs → chunk-SKK6UF5P.cjs} +200 -46
  66. package/dist/{chunk-ZS6HDNOM.cjs → chunk-T44ECMEP.cjs} +6 -6
  67. package/dist/{chunk-OFZUJMCU.mjs → chunk-WPJQN64R.mjs} +195 -41
  68. package/dist/{chunk-NU25TRIO.mjs → chunk-WWYXIECF.mjs} +12 -8
  69. package/dist/{chunk-7YHSD3Z6.cjs → chunk-XPSGGECF.cjs} +85 -31
  70. package/dist/chunk-XUGFRFD2.mjs +39 -0
  71. package/dist/{chunk-IVQY6UTY.mjs → chunk-XUHIRBXY.mjs} +1 -1
  72. package/dist/{chunk-PIZXONIS.mjs → chunk-YFLBG2W3.mjs} +56 -2
  73. package/dist/chunk-YKUEJ3MG.cjs +229 -0
  74. package/dist/{chunk-QKZMB7LY.cjs → chunk-YN2QEMMO.cjs} +2 -2
  75. package/dist/{client-plugins-DIem0I0W.d.ts → client-plugins-BGS0wqzc.d.ts} +36 -16
  76. package/dist/{client-plugins-C9Py_50W.d.mts → client-plugins-nQ0tYt4l.d.mts} +36 -16
  77. package/dist/client-plugins.d.mts +1 -1
  78. package/dist/client-plugins.d.ts +1 -1
  79. package/dist/client.cjs +4 -3
  80. package/dist/client.d.mts +5 -5
  81. package/dist/client.d.ts +5 -5
  82. package/dist/client.mjs +3 -2
  83. package/dist/config.d.mts +1 -1
  84. package/dist/config.d.ts +1 -1
  85. package/dist/{devtools-2RY3EKHL.cjs → devtools-5Q7VRKVH.cjs} +6 -5
  86. package/dist/{devtools-Q3LBNUJ7.mjs → devtools-LJ4IGYGW.mjs} +5 -4
  87. package/dist/docs.cjs +7 -6
  88. package/dist/docs.d.mts +2 -2
  89. package/dist/docs.d.ts +2 -2
  90. package/dist/docs.mjs +6 -5
  91. package/dist/index-Cy26isrh.d.ts +48 -0
  92. package/dist/index-y1jgR74U.d.mts +48 -0
  93. package/dist/index.cjs +44 -25
  94. package/dist/index.d.mts +15 -15
  95. package/dist/index.d.ts +15 -15
  96. package/dist/index.mjs +51 -32
  97. package/dist/integrations.cjs +5 -3
  98. package/dist/integrations.d.mts +1 -1
  99. package/dist/integrations.d.ts +1 -1
  100. package/dist/integrations.mjs +6 -4
  101. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  102. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  103. package/dist/internal/build-runtime.cjs +30 -15
  104. package/dist/internal/build-runtime.d.mts +12 -16
  105. package/dist/internal/build-runtime.d.ts +12 -16
  106. package/dist/internal/build-runtime.mjs +29 -14
  107. package/dist/internal/cli-runtime.cjs +24 -11
  108. package/dist/internal/cli-runtime.mjs +24 -11
  109. package/dist/internal/client-error-overlay.cjs +4 -4
  110. package/dist/internal/client-error-overlay.mjs +1 -1
  111. package/dist/internal/client-runtime.cjs +5 -1
  112. package/dist/internal/client-runtime.d.mts +1 -0
  113. package/dist/internal/client-runtime.d.ts +1 -0
  114. package/dist/internal/client-runtime.mjs +4 -0
  115. package/dist/internal/compression-runtime.d.mts +1 -1
  116. package/dist/internal/compression-runtime.d.ts +1 -1
  117. package/dist/internal/config-runtime.cjs +6 -5
  118. package/dist/internal/config-runtime.d.mts +2 -2
  119. package/dist/internal/config-runtime.d.ts +2 -2
  120. package/dist/internal/config-runtime.mjs +5 -4
  121. package/dist/internal/form-actions-client.cjs +18 -0
  122. package/dist/internal/form-actions-client.d.mts +5 -0
  123. package/dist/internal/form-actions-client.d.ts +5 -0
  124. package/dist/internal/form-actions-client.mjs +18 -0
  125. package/dist/internal/form-actions.cjs +18 -0
  126. package/dist/internal/form-actions.d.mts +14 -0
  127. package/dist/internal/form-actions.d.ts +14 -0
  128. package/dist/internal/form-actions.mjs +18 -0
  129. package/dist/internal/island-codec.cjs +22 -0
  130. package/dist/internal/island-codec.d.mts +29 -0
  131. package/dist/internal/island-codec.d.ts +29 -0
  132. package/dist/internal/island-codec.mjs +22 -0
  133. package/dist/internal/island-value-store.cjs +13 -0
  134. package/dist/internal/island-value-store.d.mts +6 -0
  135. package/dist/internal/island-value-store.d.ts +6 -0
  136. package/dist/internal/island-value-store.mjs +13 -0
  137. package/dist/internal/islands-runtime.cjs +77 -0
  138. package/dist/internal/islands-runtime.d.mts +57 -0
  139. package/dist/internal/islands-runtime.d.ts +57 -0
  140. package/dist/internal/islands-runtime.mjs +77 -0
  141. package/dist/internal/islands-server.cjs +19 -0
  142. package/dist/internal/islands-server.d.mts +3 -0
  143. package/dist/internal/islands-server.d.ts +3 -0
  144. package/dist/internal/islands-server.mjs +19 -0
  145. package/dist/internal/islx-client.cjs +5 -0
  146. package/dist/internal/islx-client.d.mts +2 -0
  147. package/dist/internal/islx-client.d.ts +2 -0
  148. package/dist/internal/islx-client.mjs +3 -0
  149. package/dist/internal/islx-react.cjs +4 -0
  150. package/dist/internal/islx-react.d.mts +1 -0
  151. package/dist/internal/islx-react.d.ts +1 -0
  152. package/dist/internal/islx-react.mjs +2 -0
  153. package/dist/internal/islx-server.cjs +5 -0
  154. package/dist/internal/islx-server.d.mts +2 -0
  155. package/dist/internal/islx-server.d.ts +2 -0
  156. package/dist/internal/islx-server.mjs +3 -0
  157. package/dist/internal/isolated-boundary.cjs +4 -3
  158. package/dist/internal/isolated-boundary.d.mts +13 -1
  159. package/dist/internal/isolated-boundary.d.ts +13 -1
  160. package/dist/internal/isolated-boundary.mjs +3 -2
  161. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  162. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  163. package/dist/internal/production-runtime.cjs +24 -13
  164. package/dist/internal/production-runtime.d.mts +20 -10
  165. package/dist/internal/production-runtime.d.ts +20 -10
  166. package/dist/internal/production-runtime.mjs +24 -13
  167. package/dist/internal/server-tree.cjs +6 -3
  168. package/dist/internal/server-tree.d.mts +25 -2
  169. package/dist/internal/server-tree.d.ts +25 -2
  170. package/dist/internal/server-tree.mjs +7 -4
  171. package/dist/island-value-protocol-BRayRghM.d.mts +12 -0
  172. package/dist/island-value-protocol-BRayRghM.d.ts +12 -0
  173. package/dist/markdown.d.mts +1 -1
  174. package/dist/markdown.d.ts +1 -1
  175. package/dist/middleware.d.mts +3 -3
  176. package/dist/middleware.d.ts +3 -3
  177. package/dist/navigation.cjs +5 -4
  178. package/dist/navigation.d.mts +4 -4
  179. package/dist/navigation.d.ts +4 -4
  180. package/dist/navigation.mjs +4 -3
  181. package/dist/og.d.mts +5 -0
  182. package/dist/og.d.ts +5 -0
  183. package/dist/plugin.cjs +19 -12
  184. package/dist/plugin.d.mts +3 -3
  185. package/dist/plugin.d.ts +3 -3
  186. package/dist/plugin.mjs +18 -11
  187. package/dist/{production-runtime-bjjWq-DA.d.ts → production-runtime-BVMDgHrA.d.ts} +1 -1
  188. package/dist/{production-runtime-CHFKIgpW.d.mts → production-runtime-ClFA_1KQ.d.mts} +1 -1
  189. package/dist/query/client.cjs +6 -5
  190. package/dist/query/client.mjs +2 -1
  191. package/dist/{render-plan-DOHg6wdO.d.mts → render-plan-CoSovy_O.d.mts} +4 -2
  192. package/dist/{render-plan-B2UndB4x.d.ts → render-plan-y2DefWf8.d.ts} +4 -2
  193. package/dist/renderer/react/server.cjs +7 -6
  194. package/dist/renderer/react/server.d.mts +3 -1
  195. package/dist/renderer/react/server.d.ts +3 -1
  196. package/dist/renderer/react/server.mjs +5 -4
  197. package/dist/renderer-client.cjs +5 -4
  198. package/dist/renderer-client.d.mts +3 -3
  199. package/dist/renderer-client.d.ts +3 -3
  200. package/dist/renderer-client.mjs +2 -1
  201. package/dist/renderer.d.mts +3 -1
  202. package/dist/renderer.d.ts +3 -1
  203. package/dist/{request-DVNXRQrI.d.ts → request-aG5Wovm5.d.ts} +1 -1
  204. package/dist/{request-DQcGfdgQ.d.mts → request-cNM09Q7e.d.mts} +1 -1
  205. package/dist/request.d.mts +2 -2
  206. package/dist/request.d.ts +2 -2
  207. package/dist/{route-rendering-B_6fj-GG.d.ts → route-rendering-B3uQmCWX.d.ts} +1 -1
  208. package/dist/{route-rendering-CEX4mFn-.d.mts → route-rendering-EyInfsjI.d.mts} +1 -1
  209. package/dist/{router-CHEMHm1P.d.ts → router-DNUf-Bg1.d.ts} +1 -1
  210. package/dist/{router-CKHPBKXX.d.mts → router-Devibh4r.d.mts} +1 -1
  211. package/dist/routes.d.mts +1 -1
  212. package/dist/routes.d.ts +1 -1
  213. package/dist/rsc-pipeline-4ZJ6GUVQ.cjs +78 -0
  214. package/dist/rsc-pipeline-KK6GFDET.mjs +78 -0
  215. package/dist/{runtime-jj8TKNsy.d.mts → runtime-9KZb8AI5.d.mts} +1 -1
  216. package/dist/{runtime-Br2ZDTAv.d.ts → runtime-CLr9P5kn.d.ts} +1 -1
  217. package/dist/{schema-dev-notice-5JPE67AI.cjs → schema-dev-notice-77ZL23PL.cjs} +4 -4
  218. package/dist/{schema-dev-notice-WLPZ6WKU.mjs → schema-dev-notice-BLXOS6U2.mjs} +2 -2
  219. package/dist/server-plugins.d.mts +2 -2
  220. package/dist/server-plugins.d.ts +2 -2
  221. package/dist/server.cjs +57 -38
  222. package/dist/server.d.mts +15 -10
  223. package/dist/server.d.ts +15 -10
  224. package/dist/server.mjs +37 -18
  225. package/dist/{spa-router-BEvS9Erj.d.mts → spa-router-BIxh4IY-.d.mts} +8 -3
  226. package/dist/{spa-router-DmCuH5B7.d.ts → spa-router-Ds6R_oe-.d.ts} +8 -3
  227. package/dist/{ssg-57v6cZcW.d.mts → ssg-ByrOVYdM.d.mts} +2 -2
  228. package/dist/{ssg-gT093ETk.d.ts → ssg-XnMHCyEc.d.ts} +2 -2
  229. package/dist/testing.d.mts +1 -1
  230. package/dist/testing.d.ts +1 -1
  231. package/dist/{utils-CCTKvR-P.d.ts → utils-BN70ueSN.d.ts} +1 -1
  232. package/dist/{utils-raHHQVyL.d.mts → utils-BrjR5xRs.d.mts} +1 -1
  233. package/dist/version.cjs +2 -2
  234. package/dist/version.mjs +1 -1
  235. package/dist/vite.cjs +19 -12
  236. package/dist/vite.d.mts +6 -4
  237. package/dist/vite.d.ts +6 -4
  238. package/dist/vite.mjs +18 -11
  239. package/package.json +53 -1
  240. package/dist/{chunk-35WS7P2V.mjs → chunk-26CXZR6L.mjs} +3 -3
  241. package/dist/{chunk-QEILRWVV.cjs → chunk-3XEMGDBF.cjs} +2 -2
  242. package/dist/{chunk-BPOTSHDO.cjs → chunk-IOAUK4OI.cjs} +2 -2
  243. package/dist/{chunk-BYR3RQPB.mjs → chunk-T76H22WI.mjs} +4 -4
@@ -0,0 +1,148 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkYKUEJ3MGcjs = require('./chunk-YKUEJ3MG.cjs');
5
+
6
+
7
+
8
+
9
+
10
+ var _chunkH7BLEEAEcjs = require('./chunk-H7BLEEAE.cjs');
11
+
12
+
13
+
14
+ var _chunk6IZWX6EScjs = require('./chunk-6IZWX6ES.cjs');
15
+
16
+
17
+ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
18
+
19
+ // src/client/island-values.ts
20
+ var FARM_VALUE_MIN_LENGTH = 512;
21
+ function hashFarmValue(json) {
22
+ let h1 = 3735928559 ^ json.length;
23
+ let h2 = 1103547991 ^ json.length;
24
+ for (let index = 0; index < json.length; index++) {
25
+ const code = json.charCodeAt(index);
26
+ h1 = Math.imul(h1 ^ code, 2654435761);
27
+ h2 = Math.imul(h2 ^ code, 1597334677);
28
+ }
29
+ h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
30
+ h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
31
+ return (h2 >>> 0).toString(36).padStart(7, "0") + (h1 >>> 0).toString(36).padStart(7, "0");
32
+ }
33
+ _chunkS3JO3N4Hcjs.__name.call(void 0, hashFarmValue, "hashFarmValue");
34
+ function addressFarmValues(props, minLength = FARM_VALUE_MIN_LENGTH) {
35
+ const values = /* @__PURE__ */ new Map();
36
+ const reference = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (json2, children, parent) => {
37
+ const key = hashFarmValue(json2);
38
+ if (!values.has(key)) values.set(key, { key, json: json2, children });
39
+ parent.push(key);
40
+ return `{"$":"${_chunkH7BLEEAEcjs.FARM_REFERENCE_TAG}","v":"${key}"}`;
41
+ }, "reference");
42
+ const encode = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (value, parent) => {
43
+ if (value === null || typeof value !== "object") {
44
+ const json3 = JSON.stringify(value);
45
+ return [
46
+ typeof value === "string" && json3.length >= minLength ? reference(json3, [], parent) : json3,
47
+ json3.length
48
+ ];
49
+ }
50
+ const own = [];
51
+ let length = 2;
52
+ const parts = [];
53
+ if (Array.isArray(value)) {
54
+ for (const entry of value) {
55
+ const [json3, entryLength] = encode(entry, own);
56
+ parts.push(json3);
57
+ length += entryLength + 1;
58
+ }
59
+ } else {
60
+ for (const [key, entry] of Object.entries(value)) {
61
+ const [json3, entryLength] = encode(entry, own);
62
+ const name = JSON.stringify(key);
63
+ parts.push(`${name}:${json3}`);
64
+ length += name.length + entryLength + 2;
65
+ }
66
+ }
67
+ const json2 = Array.isArray(value) ? `[${parts.join(",")}]` : `{${parts.join(",")}}`;
68
+ const wrapper = own.length === 1 && json2.length < minLength / 4;
69
+ if (length >= minLength && !wrapper) return [reference(json2, own, parent), length];
70
+ parent.push(...own);
71
+ return [json2, length];
72
+ }, "encode");
73
+ const roots = [];
74
+ const json = `{${Object.entries(props).map(([key, entry]) => `${JSON.stringify(key)}:${encode(entry, roots)[0]}`).join(",")}}`;
75
+ return { json, values, roots };
76
+ }
77
+ _chunkS3JO3N4Hcjs.__name.call(void 0, addressFarmValues, "addressFarmValues");
78
+ function selectFarmValuesToSend(addressed, held) {
79
+ const send = [];
80
+ const seen = /* @__PURE__ */ new Set();
81
+ const visit = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (key) => {
82
+ if (seen.has(key)) return;
83
+ seen.add(key);
84
+ if (_optionalChain([held, 'optionalAccess', _ => _.has, 'call', _2 => _2(key)])) return;
85
+ const value = addressed.values.get(key);
86
+ send.push(value);
87
+ value.children.forEach(visit);
88
+ }, "visit");
89
+ addressed.roots.forEach(visit);
90
+ return send;
91
+ }
92
+ _chunkS3JO3N4Hcjs.__name.call(void 0, selectFarmValuesToSend, "selectFarmValuesToSend");
93
+ function parseFarmHeldValues(header) {
94
+ const held = /* @__PURE__ */ new Set();
95
+ if (!header) return held;
96
+ for (const key of header.split(",", _chunkH7BLEEAEcjs.FARM_MAX_HELD_VALUES * 2)) {
97
+ const trimmed = key.trim();
98
+ if (_chunkH7BLEEAEcjs.FARM_VALUE_KEY_PATTERN.test(trimmed)) held.add(trimmed);
99
+ if (held.size === _chunkH7BLEEAEcjs.FARM_MAX_HELD_VALUES) break;
100
+ }
101
+ return held;
102
+ }
103
+ _chunkS3JO3N4Hcjs.__name.call(void 0, parseFarmHeldValues, "parseFarmHeldValues");
104
+ var heldByRequest = /* @__PURE__ */ new WeakMap();
105
+ var ignoredRequests = /* @__PURE__ */ new WeakSet();
106
+ function ignoreFarmHeldValues() {
107
+ const request = _chunk6IZWX6EScjs._resolveCurrentRequest.call(void 0, );
108
+ if (request) ignoredRequests.add(request);
109
+ }
110
+ _chunkS3JO3N4Hcjs.__name.call(void 0, ignoreFarmHeldValues, "ignoreFarmHeldValues");
111
+ function readFarmHeldValues() {
112
+ const request = _chunk6IZWX6EScjs._resolveCurrentRequest.call(void 0, );
113
+ if (!request || ignoredRequests.has(request)) return null;
114
+ let held = heldByRequest.get(request);
115
+ if (!held) {
116
+ held = parseFarmHeldValues(request.headers.get(_chunkH7BLEEAEcjs.FARM_VALUES_HEADER));
117
+ heldByRequest.set(request, held);
118
+ if (held.size > 0) void _optionalChain([_chunk6IZWX6EScjs._resolveCurrentRequestForApp.call(void 0, ), 'optionalAccess', _3 => _3.headers]);
119
+ }
120
+ return held.size > 0 ? held : null;
121
+ }
122
+ _chunkS3JO3N4Hcjs.__name.call(void 0, readFarmHeldValues, "readFarmHeldValues");
123
+ var SERVER_KEY = /* @__PURE__ */ Symbol.for("farm.island-values.server");
124
+ var sentByRequest = /* @__PURE__ */ new WeakMap();
125
+ function resolveFarmIslandRenderState() {
126
+ const request = _chunk6IZWX6EScjs._resolveCurrentRequest.call(void 0, );
127
+ if (!request) return null;
128
+ let sent = sentByRequest.get(request);
129
+ if (!sent) sentByRequest.set(request, sent = /* @__PURE__ */ new Set());
130
+ return { held: readFarmHeldValues(), sent };
131
+ }
132
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmIslandRenderState, "resolveFarmIslandRenderState");
133
+ function installFarmIslandValues() {
134
+ globalThis[SERVER_KEY] = {
135
+ address: addressFarmValues,
136
+ select: selectFarmValuesToSend,
137
+ held: readFarmHeldValues,
138
+ encodeLeaf: _chunkYKUEJ3MGcjs.encodeFarmLeaf,
139
+ decode: _chunkYKUEJ3MGcjs.decodeFarmTagged
140
+ };
141
+ }
142
+ _chunkS3JO3N4Hcjs.__name.call(void 0, installFarmIslandValues, "installFarmIslandValues");
143
+
144
+
145
+
146
+
147
+
148
+ exports.ignoreFarmHeldValues = ignoreFarmHeldValues; exports.resolveFarmIslandRenderState = resolveFarmIslandRenderState; exports.installFarmIslandValues = installFarmIslandValues;
@@ -0,0 +1,132 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkPDU4P2ICcjs = require('./chunk-PDU4P2IC.cjs');
5
+
6
+
7
+ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
8
+
9
+
10
+ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
11
+
12
+ // src/server-components-status.ts
13
+ var _fs = require('fs');
14
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
15
+ var FARM_RSC_PACKAGES = [
16
+ "@farm.js/plugin",
17
+ "@vitejs/plugin-rsc",
18
+ "react-server-dom-webpack"
19
+ ];
20
+ var FARM_RSC_INSTALL_HINT = `pnpm add ${FARM_RSC_PACKAGES.join(" ")}`;
21
+ var FARM_RSC_BLOCKING_KEYS = [
22
+ "auth",
23
+ "integrations",
24
+ "headers",
25
+ "redirects",
26
+ "rewrites",
27
+ "routeRules",
28
+ "context"
29
+ ];
30
+ var FARM_RSC_IGNORED_KEYS = [
31
+ "plugins",
32
+ "storage",
33
+ "schema",
34
+ "cron",
35
+ "workflows",
36
+ "docs",
37
+ "theme",
38
+ "observability"
39
+ ];
40
+ function farmConfigUsesServerComponents(config) {
41
+ return _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'optionalAccess', _ => _.experimental, 'optionalAccess', _2 => _2.serverComponents])) === "rsc";
42
+ }
43
+ _chunkS3JO3N4Hcjs.__name.call(void 0, farmConfigUsesServerComponents, "farmConfigUsesServerComponents");
44
+ function findFarmAppPackageDir(root, packageName) {
45
+ for (let dir = _path2.default.resolve(root); ; dir = _path2.default.dirname(dir)) {
46
+ const candidate = _path2.default.join(dir, "node_modules", packageName);
47
+ if (_fs.existsSync.call(void 0, _path2.default.join(candidate, "package.json"))) return _fs.realpathSync.call(void 0, candidate);
48
+ if (_path2.default.dirname(dir) === dir) return void 0;
49
+ }
50
+ }
51
+ _chunkS3JO3N4Hcjs.__name.call(void 0, findFarmAppPackageDir, "findFarmAppPackageDir");
52
+ function isSet(value) {
53
+ if (value === void 0 || value === false || value === null) return false;
54
+ if (Array.isArray(value)) return value.length > 0;
55
+ return typeof value !== "object" || Object.keys(value).length > 0;
56
+ }
57
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isSet, "isSet");
58
+ function inspectFarmServerComponents(config, root) {
59
+ const value = _optionalChain([config, 'optionalAccess', _3 => _3.experimental, 'optionalAccess', _4 => _4.serverComponents]);
60
+ const mode = _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, value);
61
+ const enabled = mode === "rsc";
62
+ const explicit = enabled && _chunkPDU4P2ICcjs.isExplicitFarmServerComponentsMode.call(void 0, value);
63
+ const missingPackages = enabled ? FARM_RSC_PACKAGES.filter((name) => !findFarmAppPackageDir(root, name)) : [];
64
+ return {
65
+ mode,
66
+ enabled,
67
+ explicit,
68
+ missingPackages,
69
+ // `true` predates the pipeline; `{ mode: "rsc" }` is new and fails with the install command.
70
+ fallback: enabled && !explicit && missingPackages.length > 0,
71
+ blockingKeys: enabled ? FARM_RSC_BLOCKING_KEYS.filter((key) => isSet(_optionalChain([config, 'optionalAccess', _5 => _5[key]]))) : [],
72
+ ignoredKeys: enabled ? FARM_RSC_IGNORED_KEYS.filter((key) => isSet(_optionalChain([config, 'optionalAccess', _6 => _6[key]]))) : []
73
+ };
74
+ }
75
+ _chunkS3JO3N4Hcjs.__name.call(void 0, inspectFarmServerComponents, "inspectFarmServerComponents");
76
+ function formatKeys(keys) {
77
+ return keys.map((key) => `\`${key}\``).join(", ");
78
+ }
79
+ _chunkS3JO3N4Hcjs.__name.call(void 0, formatKeys, "formatKeys");
80
+ function formatFarmRscFallbackMessage(missingPackages, blockingKeys = []) {
81
+ if (blockingKeys.length > 0) {
82
+ return `experimental.serverComponents is true, but this app uses ${formatKeys(
83
+ blockingKeys
84
+ )}, which the RSC pipeline does not run yet, so it runs without React Server Components. Remove the flag, or move ${blockingKeys.length === 1 ? "that feature" : "those features"} out of farm.config to turn RSC on.`;
85
+ }
86
+ return `experimental.serverComponents is true, but ${missingPackages.join(", ")} ${missingPackages.length === 1 ? "is" : "are"} not installed, so the app runs without React Server Components. \`farm dev\` and \`farm build\` install them outside CI; in CI or with another tool, run ${FARM_RSC_INSTALL_HINT}.`;
87
+ }
88
+ _chunkS3JO3N4Hcjs.__name.call(void 0, formatFarmRscFallbackMessage, "formatFarmRscFallbackMessage");
89
+ function formatFarmRscBlockingMessage(blockingKeys) {
90
+ return `experimental.serverComponents runs on the RSC pipeline, which does not run ${formatKeys(
91
+ blockingKeys
92
+ )} yet. Serving the app without ${blockingKeys.length === 1 ? "it" : "them"} could expose what ${blockingKeys.length === 1 ? "it protects" : "they protect"}, so RSC does not start. Remove experimental.serverComponents to keep ${blockingKeys.length === 1 ? "it" : "them"}.`;
93
+ }
94
+ _chunkS3JO3N4Hcjs.__name.call(void 0, formatFarmRscBlockingMessage, "formatFarmRscBlockingMessage");
95
+ var warnedFallback = false;
96
+ function farmAppUsesRscPipeline(config, root) {
97
+ const status = inspectFarmServerComponents(config, root);
98
+ if (status.mode === "islands") return false;
99
+ if (!status.enabled) return false;
100
+ if (status.fallback) {
101
+ if (!warnedFallback) {
102
+ warnedFallback = true;
103
+ _chunk5QIKR7RRcjs.logger.warn(
104
+ `[Farm.js] ${formatFarmRscFallbackMessage(status.missingPackages, status.blockingKeys)}`
105
+ );
106
+ }
107
+ return false;
108
+ }
109
+ if (status.blockingKeys.length > 0) {
110
+ throw new Error(`[Farm.js] ${formatFarmRscBlockingMessage(status.blockingKeys)}`);
111
+ }
112
+ if (status.ignoredKeys.length > 0) {
113
+ _chunk5QIKR7RRcjs.logger.warn(
114
+ `[Farm.js] experimental.serverComponents runs on the RSC pipeline, which does not run ${formatKeys(
115
+ status.ignoredKeys
116
+ )} yet. ${status.ignoredKeys.length === 1 ? "It is" : "They are"} ignored.`
117
+ );
118
+ }
119
+ return true;
120
+ }
121
+ _chunkS3JO3N4Hcjs.__name.call(void 0, farmAppUsesRscPipeline, "farmAppUsesRscPipeline");
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+ exports.FARM_RSC_PACKAGES = FARM_RSC_PACKAGES; exports.FARM_RSC_INSTALL_HINT = FARM_RSC_INSTALL_HINT; exports.farmConfigUsesServerComponents = farmConfigUsesServerComponents; exports.findFarmAppPackageDir = findFarmAppPackageDir; exports.inspectFarmServerComponents = inspectFarmServerComponents; exports.formatFarmRscFallbackMessage = formatFarmRscFallbackMessage; exports.formatFarmRscBlockingMessage = formatFarmRscBlockingMessage; exports.farmAppUsesRscPipeline = farmAppUsesRscPipeline;
@@ -3,23 +3,23 @@
3
3
  var _chunk6QOLZITBcjs = require('./chunk-6QOLZITB.cjs');
4
4
 
5
5
 
6
- var _chunkG643DQCHcjs = require('./chunk-G643DQCH.cjs');
7
6
 
8
7
 
9
8
 
9
+ var _chunk3SAWHWDHcjs = require('./chunk-3SAWHWDH.cjs');
10
10
 
11
- var _chunkALPWLT27cjs = require('./chunk-ALPWLT27.cjs');
12
11
 
12
+ var _chunkG643DQCHcjs = require('./chunk-G643DQCH.cjs');
13
13
 
14
- var _chunk64SBBZDUcjs = require('./chunk-64SBBZDU.cjs');
15
14
 
15
+ var _chunkALPWLT27cjs = require('./chunk-ALPWLT27.cjs');
16
16
 
17
17
 
18
- var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
18
+ var _chunk64SBBZDUcjs = require('./chunk-64SBBZDU.cjs');
19
19
 
20
20
 
21
21
 
22
- var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
22
+ var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
23
23
 
24
24
 
25
25
 
@@ -44,16 +44,9 @@ var _chunkNZKJGRB3cjs = require('./chunk-NZKJGRB3.cjs');
44
44
  var _chunkDVM4FKZLcjs = require('./chunk-DVM4FKZL.cjs');
45
45
 
46
46
 
47
-
48
47
  var _chunkUS2QVW3Ecjs = require('./chunk-US2QVW3E.cjs');
49
48
 
50
49
 
51
- var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
52
-
53
-
54
- var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
55
-
56
-
57
50
 
58
51
 
59
52
 
@@ -268,17 +261,13 @@ function defineIntegration(integration) {
268
261
  };
269
262
  }
270
263
  _chunkS3JO3N4Hcjs.__name.call(void 0, defineIntegration, "defineIntegration");
271
- function isFarmIntegration(value) {
272
- return !!value && typeof value === "object" && value.kind === "farm-integration";
273
- }
274
- _chunkS3JO3N4Hcjs.__name.call(void 0, isFarmIntegration, "isFarmIntegration");
275
264
  function resolveIntegrationPlugins(integrations) {
276
265
  if (!integrations) {
277
266
  return [];
278
267
  }
279
268
  const plugins = [];
280
269
  for (const [key, integration] of Object.entries(integrations)) {
281
- if (!integration || !isFarmIntegration(integration)) {
270
+ if (!integration || !_chunk3SAWHWDHcjs.isFarmIntegration.call(void 0, integration)) {
282
271
  continue;
283
272
  }
284
273
  for (const entry of integration.middleware || []) {
@@ -365,7 +354,7 @@ function getIntegrationProviders(integrations) {
365
354
  }
366
355
  const providers = [];
367
356
  for (const integration of Object.values(integrations)) {
368
- if (!integration || !isFarmIntegration(integration) || !_optionalChain([integration, 'access', _3 => _3.providers, 'optionalAccess', _4 => _4.length])) {
357
+ if (!integration || !_chunk3SAWHWDHcjs.isFarmIntegration.call(void 0, integration) || !_optionalChain([integration, 'access', _3 => _3.providers, 'optionalAccess', _4 => _4.length])) {
369
358
  continue;
370
359
  }
371
360
  for (const provider of integration.providers) {
@@ -393,7 +382,7 @@ function getIntegrationDocumentNavigationMatchers(integrations) {
393
382
  }
394
383
  const matchers = [];
395
384
  for (const integration of Object.values(integrations)) {
396
- if (!integration || !isFarmIntegration(integration) || !_optionalChain([integration, 'access', _5 => _5.documentNavigations, 'optionalAccess', _6 => _6.length])) {
385
+ if (!integration || !_chunk3SAWHWDHcjs.isFarmIntegration.call(void 0, integration) || !_optionalChain([integration, 'access', _5 => _5.documentNavigations, 'optionalAccess', _6 => _6.length])) {
397
386
  continue;
398
387
  }
399
388
  for (const navigation of integration.documentNavigations) {
@@ -411,7 +400,7 @@ function getIntegrationSchemas(integrations) {
411
400
  return {};
412
401
  }
413
402
  const schemaEntries = Object.entries(integrations).map(([key, integration]) => {
414
- const schema = integration && isFarmIntegration(integration) ? integration.schema : void 0;
403
+ const schema = integration && _chunk3SAWHWDHcjs.isFarmIntegration.call(void 0, integration) ? integration.schema : void 0;
415
404
  return schema ? [key, schema] : null;
416
405
  }).filter((value) => value !== null);
417
406
  return Object.fromEntries(schemaEntries);
@@ -444,7 +433,7 @@ function matchIntegrationRoute(integrations, input) {
444
433
  }
445
434
  const pathSegments = _chunkUS2QVW3Ecjs.canonicalizeRequestPathSegments.call(void 0, input.pathname);
446
435
  for (const [key, integration] of Object.entries(integrations)) {
447
- if (!integration || !isFarmIntegration(integration)) {
436
+ if (!integration || !_chunk3SAWHWDHcjs.isFarmIntegration.call(void 0, integration)) {
448
437
  continue;
449
438
  }
450
439
  const routes = normalizeIntegrationRoutes(integration.routes || []);
@@ -452,7 +441,7 @@ function matchIntegrationRoute(integrations, input) {
452
441
  if (!matchesMethod(route.methods, method)) {
453
442
  continue;
454
443
  }
455
- const params = matchPathSegments(route[INTEGRATION_ROUTE_SEGMENTS], pathSegments);
444
+ const params = _chunk3SAWHWDHcjs.matchPathSegments.call(void 0, route[INTEGRATION_ROUTE_SEGMENTS], pathSegments);
456
445
  if (!params) {
457
446
  continue;
458
447
  }
@@ -871,7 +860,7 @@ function createIntegrationPlugin(integrationKey, integration) {
871
860
  }
872
861
  }, "createHandlerRequest");
873
862
  for (const entry of middleware) {
874
- const params = resolveIntegrationMiddlewareParams(entry, pathname, context.config);
863
+ const params = _chunk3SAWHWDHcjs.resolveIntegrationMiddlewareParams.call(void 0, entry, pathname, context.config);
875
864
  if (!params) {
876
865
  continue;
877
866
  }
@@ -972,7 +961,7 @@ function createIntegrationPlugin(integrationKey, integration) {
972
961
  }
973
962
  }
974
963
  for (const route of routes) {
975
- const params = method && matchesMethod(route.methods, method) ? matchPathSegments(route[INTEGRATION_ROUTE_SEGMENTS], pathSegments) : null;
964
+ const params = method && matchesMethod(route.methods, method) ? _chunk3SAWHWDHcjs.matchPathSegments.call(void 0, route[INTEGRATION_ROUTE_SEGMENTS], pathSegments) : null;
976
965
  if (!params) {
977
966
  continue;
978
967
  }
@@ -1190,7 +1179,7 @@ function normalizeIntegrationRoutes(routes) {
1190
1179
  ...route,
1191
1180
  methods: normalizeIntegrationRouteMethods(route),
1192
1181
  input: normalizeIntegrationRouteInputSchemas(route),
1193
- [INTEGRATION_ROUTE_SEGMENTS]: splitPath(route.path)
1182
+ [INTEGRATION_ROUTE_SEGMENTS]: _chunk3SAWHWDHcjs.splitPath.call(void 0, route.path)
1194
1183
  },
1195
1184
  specificity: _chunkNO3WWW3Ncjs.getRoutePatternSpecificity.call(void 0, route.path, "api")
1196
1185
  };
@@ -1585,7 +1574,7 @@ async function dispatchIntegrationRequest(runtime, request, options = {}) {
1585
1574
  const forwardedSetCookies = [];
1586
1575
  for (const entry of middleware) {
1587
1576
  if (_optionalChain([options, 'access', _26 => _26.ranMiddleware, 'optionalAccess', _27 => _27.has, 'call', _28 => _28(entry)])) continue;
1588
- const params = resolveIntegrationMiddlewareParams(entry, pathname, runtime.config);
1577
+ const params = _chunk3SAWHWDHcjs.resolveIntegrationMiddlewareParams.call(void 0, entry, pathname, runtime.config);
1589
1578
  if (!params) {
1590
1579
  continue;
1591
1580
  }
@@ -1678,7 +1667,7 @@ async function dispatchIntegrationRequest(runtime, request, options = {}) {
1678
1667
  }
1679
1668
  }
1680
1669
  for (const route of routes) {
1681
- const params = method && matchesMethod(route.methods, method) ? matchPathSegments(route[INTEGRATION_ROUTE_SEGMENTS], pathSegments) : null;
1670
+ const params = method && matchesMethod(route.methods, method) ? _chunk3SAWHWDHcjs.matchPathSegments.call(void 0, route[INTEGRATION_ROUTE_SEGMENTS], pathSegments) : null;
1682
1671
  if (!params) {
1683
1672
  continue;
1684
1673
  }
@@ -1839,7 +1828,7 @@ async function dispatchIntegrationRequests(integrations, runtime, request, optio
1839
1828
  return { response: null, setCookies };
1840
1829
  }
1841
1830
  for (const integration of Object.values(integrations)) {
1842
- if (!integration || !isFarmIntegration(integration)) {
1831
+ if (!integration || !_chunk3SAWHWDHcjs.isFarmIntegration.call(void 0, integration)) {
1843
1832
  continue;
1844
1833
  }
1845
1834
  const hasMiddleware = (integration.middleware || []).length > 0;
@@ -2011,156 +2000,6 @@ function matchesMethod(methods, normalizedMethod) {
2011
2000
  return methods.some((candidate) => candidate === "ALL" || candidate === normalizedMethod);
2012
2001
  }
2013
2002
  _chunkS3JO3N4Hcjs.__name.call(void 0, matchesMethod, "matchesMethod");
2014
- var compiledIntegrationGuards = /* @__PURE__ */ new WeakMap();
2015
- var noMiddlewareContext = {};
2016
- function resolveIntegrationMiddlewareParams(entry, pathname, config) {
2017
- const params = resolveMatcherParams(entry.matcher, pathname);
2018
- if (params || !entry.matcher) return params;
2019
- const routePathname = resolveIntegrationRoutePathname(pathname, config);
2020
- const candidates = [.../* @__PURE__ */ new Set([pathname, ...getIntegrationAPIPathnames(config)(routePathname)])];
2021
- for (const candidate of candidates) {
2022
- if (candidate === pathname) continue;
2023
- const routeParams = resolveMatcherParams(entry.matcher, candidate);
2024
- if (routeParams) return routeParams;
2025
- }
2026
- let compiled = compiledIntegrationGuards.get(entry);
2027
- if (!compiled) {
2028
- compiled = _chunkALPWLT27cjs.compileMiddlewareConfig.call(void 0, {
2029
- matcher: typeof entry.matcher === "string" ? entry.matcher : [...entry.matcher]
2030
- });
2031
- compiledIntegrationGuards.set(entry, compiled);
2032
- }
2033
- for (const candidate of candidates) {
2034
- const result = _chunkALPWLT27cjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
2035
- if (result.matched) return _nullishCoalesce(result.params, () => ( {}));
2036
- }
2037
- return null;
2038
- }
2039
- _chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
2040
- function integrationMiddlewareMayHandlePath(integrations, pathname, catchAllProbe) {
2041
- if (!integrations) return false;
2042
- const covers = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (entry) => resolveIntegrationMiddlewareParams(entry, pathname, void 0) !== null, "covers");
2043
- return Object.values(integrations).some(
2044
- (integration) => isFarmIntegration(integration) && (integration.middleware || []).some((entry) => {
2045
- if (catchAllProbe === void 0) return covers(entry);
2046
- if (!entry.matcher) return false;
2047
- const specific = (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).filter(
2048
- (matcher) => resolveIntegrationMiddlewareParams({ matcher }, catchAllProbe, void 0) === null
2049
- );
2050
- return specific.length > 0 && covers({ matcher: specific });
2051
- })
2052
- );
2053
- }
2054
- _chunkS3JO3N4Hcjs.__name.call(void 0, integrationMiddlewareMayHandlePath, "integrationMiddlewareMayHandlePath");
2055
- var FARM_INTEGRATION_API_BASE_PATH_KEY = "__farmAPIServerBasePath";
2056
- var integrationAPIPathnames = /* @__PURE__ */ new WeakMap();
2057
- function getIntegrationAPIPathnames(config) {
2058
- if (!config) return (pathname) => [pathname];
2059
- let toPathnames = integrationAPIPathnames.get(config);
2060
- if (!toPathnames) {
2061
- const recorded = config[FARM_INTEGRATION_API_BASE_PATH_KEY];
2062
- const api2 = config.api;
2063
- const serverBasePath = typeof recorded === "string" ? recorded : typeof _optionalChain([api2, 'optionalAccess', _34 => _34.baseURL]) === "string" && typeof api2.basePath === "string" ? _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, api2) : void 0;
2064
- toPathnames = _chunkKNBBQHO2cjs.createFarmAPIMiddlewarePathnames.call(void 0, serverBasePath);
2065
- integrationAPIPathnames.set(config, toPathnames);
2066
- }
2067
- return toPathnames;
2068
- }
2069
- _chunkS3JO3N4Hcjs.__name.call(void 0, getIntegrationAPIPathnames, "getIntegrationAPIPathnames");
2070
- function resolveIntegrationRoutePathname(pathname, config) {
2071
- const basePath = typeof _optionalChain([config, 'optionalAccess', _35 => _35.basePath]) === "string" ? config.basePath : void 0;
2072
- let routePathname = basePath ? _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, basePath) : pathname;
2073
- const i18n = _optionalChain([config, 'optionalAccess', _36 => _36.i18n]);
2074
- if (i18n && Array.isArray(i18n.locales) && i18n.locales.length > 0) {
2075
- routePathname = _chunkBIDYX3SLcjs.resolveFarmLocalePath.call(void 0, routePathname, {
2076
- locales: i18n.locales,
2077
- defaultLocale: i18n.defaultLocale,
2078
- routing: i18n.routing || "prefix-except-default"
2079
- }).pathname;
2080
- }
2081
- return routePathname;
2082
- }
2083
- _chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationRoutePathname, "resolveIntegrationRoutePathname");
2084
- function resolveMatcherParams(matcher, pathname) {
2085
- if (!matcher) {
2086
- return {};
2087
- }
2088
- const list = Array.isArray(matcher) ? matcher : [matcher];
2089
- let canonicalPathname;
2090
- let canonicalSegments;
2091
- for (const item of list) {
2092
- if (item === "/(.*)" || item === "*") {
2093
- return {};
2094
- }
2095
- if (item.endsWith("(.*)")) {
2096
- _nullishCoalesce(canonicalPathname, () => ( (canonicalPathname = _chunkUS2QVW3Ecjs.canonicalizeRequestPathname.call(void 0, pathname))));
2097
- const prefix = item.slice(0, -4);
2098
- if (canonicalPathname === prefix || canonicalPathname.startsWith(`${prefix}/`)) {
2099
- return {};
2100
- }
2101
- continue;
2102
- }
2103
- _nullishCoalesce(canonicalSegments, () => ( (canonicalSegments = _chunkUS2QVW3Ecjs.canonicalizeRequestPathSegments.call(void 0, pathname))));
2104
- const params = matchPathSegments(splitPath(item), canonicalSegments);
2105
- if (params) {
2106
- return params;
2107
- }
2108
- }
2109
- return null;
2110
- }
2111
- _chunkS3JO3N4Hcjs.__name.call(void 0, resolveMatcherParams, "resolveMatcherParams");
2112
- function matchPathSegments(routeSegments, pathSegments) {
2113
- const params = {};
2114
- let routeIndex = 0;
2115
- let pathIndex = 0;
2116
- while (routeIndex < routeSegments.length && pathIndex < pathSegments.length) {
2117
- const routeSegment = routeSegments[routeIndex];
2118
- const pathSegment = pathSegments[pathIndex];
2119
- if (isCatchAllSegment(routeSegment)) {
2120
- params[getSegmentParamName(routeSegment)] = pathSegments.slice(pathIndex);
2121
- return params;
2122
- }
2123
- if (isDynamicSegment(routeSegment)) {
2124
- params[getSegmentParamName(routeSegment)] = pathSegment;
2125
- routeIndex += 1;
2126
- pathIndex += 1;
2127
- continue;
2128
- }
2129
- if (routeSegment !== pathSegment) {
2130
- return null;
2131
- }
2132
- routeIndex += 1;
2133
- pathIndex += 1;
2134
- }
2135
- if (routeIndex === routeSegments.length && pathIndex === pathSegments.length) {
2136
- return params;
2137
- }
2138
- if (routeIndex === routeSegments.length - 1 && isCatchAllSegment(routeSegments[routeIndex])) {
2139
- params[getSegmentParamName(routeSegments[routeIndex])] = [];
2140
- return params;
2141
- }
2142
- return null;
2143
- }
2144
- _chunkS3JO3N4Hcjs.__name.call(void 0, matchPathSegments, "matchPathSegments");
2145
- function splitPath(value) {
2146
- return value.split("/").filter(Boolean);
2147
- }
2148
- _chunkS3JO3N4Hcjs.__name.call(void 0, splitPath, "splitPath");
2149
- function isDynamicSegment(segment) {
2150
- return segment.startsWith("[") && segment.endsWith("]");
2151
- }
2152
- _chunkS3JO3N4Hcjs.__name.call(void 0, isDynamicSegment, "isDynamicSegment");
2153
- function isCatchAllSegment(segment) {
2154
- return segment.startsWith("[...") && segment.endsWith("]");
2155
- }
2156
- _chunkS3JO3N4Hcjs.__name.call(void 0, isCatchAllSegment, "isCatchAllSegment");
2157
- function getSegmentParamName(segment) {
2158
- if (isCatchAllSegment(segment)) {
2159
- return segment.slice(4, -1);
2160
- }
2161
- return segment.slice(1, -1);
2162
- }
2163
- _chunkS3JO3N4Hcjs.__name.call(void 0, getSegmentParamName, "getSegmentParamName");
2164
2003
  function getRequestId(req) {
2165
2004
  const headerValue = req.headers["x-request-id"];
2166
2005
  if (Array.isArray(headerValue)) {
@@ -2200,7 +2039,4 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeMatcher, "normalizeMatcher");
2200
2039
 
2201
2040
 
2202
2041
 
2203
-
2204
-
2205
-
2206
- exports.FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY; exports.FARM_INTEGRATION_SET_COOKIES_KEY = FARM_INTEGRATION_SET_COOKIES_KEY; exports.forwardIntegrationSetCookies = forwardIntegrationSetCookies; exports.defineIntegrationSchema = defineIntegrationSchema; exports.getFarmIntegrationPluginServerRuntime = getFarmIntegrationPluginServerRuntime; exports.getFarmIntegrationPluginOwner = getFarmIntegrationPluginOwner; exports.createIntegrationRoute = createIntegrationRoute; exports.integrationRoute = integrationRoute; exports.defineIntegration = defineIntegration; exports.isFarmIntegration = isFarmIntegration; exports.resolveIntegrationPlugins = resolveIntegrationPlugins; exports.getIntegrationProviders = getIntegrationProviders; exports.isFarmIntegrationProviderComponentReference = isFarmIntegrationProviderComponentReference; exports.getIntegrationDocumentNavigationMatchers = getIntegrationDocumentNavigationMatchers; exports.getIntegrationSchemas = getIntegrationSchemas; exports.getRegisteredIntegrationRuntime = getRegisteredIntegrationRuntime; exports.getRegisteredIntegrations = getRegisteredIntegrations; exports.getRegisteredIntegrationSchemas = getRegisteredIntegrationSchemas; exports.matchIntegrationRoute = matchIntegrationRoute; exports.matchRegisteredIntegrationRoute = matchRegisteredIntegrationRoute; exports.getRegisteredIntegrationAPIManifest = getRegisteredIntegrationAPIManifest; exports.dispatchIntegrationRequest = dispatchIntegrationRequest; exports.dispatchIntegrationRequests = dispatchIntegrationRequests; exports.integrationMiddlewareMayHandlePath = integrationMiddlewareMayHandlePath; exports.FARM_INTEGRATION_API_BASE_PATH_KEY = FARM_INTEGRATION_API_BASE_PATH_KEY;
2042
+ exports.FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY; exports.FARM_INTEGRATION_SET_COOKIES_KEY = FARM_INTEGRATION_SET_COOKIES_KEY; exports.forwardIntegrationSetCookies = forwardIntegrationSetCookies; exports.defineIntegrationSchema = defineIntegrationSchema; exports.getFarmIntegrationPluginServerRuntime = getFarmIntegrationPluginServerRuntime; exports.getFarmIntegrationPluginOwner = getFarmIntegrationPluginOwner; exports.createIntegrationRoute = createIntegrationRoute; exports.integrationRoute = integrationRoute; exports.defineIntegration = defineIntegration; exports.resolveIntegrationPlugins = resolveIntegrationPlugins; exports.getIntegrationProviders = getIntegrationProviders; exports.isFarmIntegrationProviderComponentReference = isFarmIntegrationProviderComponentReference; exports.getIntegrationDocumentNavigationMatchers = getIntegrationDocumentNavigationMatchers; exports.getIntegrationSchemas = getIntegrationSchemas; exports.getRegisteredIntegrationRuntime = getRegisteredIntegrationRuntime; exports.getRegisteredIntegrations = getRegisteredIntegrations; exports.getRegisteredIntegrationSchemas = getRegisteredIntegrationSchemas; exports.matchIntegrationRoute = matchIntegrationRoute; exports.matchRegisteredIntegrationRoute = matchRegisteredIntegrationRoute; exports.getRegisteredIntegrationAPIManifest = getRegisteredIntegrationAPIManifest; exports.dispatchIntegrationRequest = dispatchIntegrationRequest; exports.dispatchIntegrationRequests = dispatchIntegrationRequests;