@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,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
+ };
@@ -1,13 +1,17 @@
1
1
  import {
2
2
  setFarmPluginIntegrationContext
3
3
  } from "./chunk-H3EGVQE5.mjs";
4
+ import {
5
+ isFarmIntegration,
6
+ matchPathSegments,
7
+ resolveIntegrationMiddlewareParams,
8
+ splitPath
9
+ } from "./chunk-GZWHCWLB.mjs";
4
10
  import {
5
11
  defineSchema
6
12
  } from "./chunk-44SYJEG3.mjs";
7
13
  import {
8
- assertSupportedMiddlewareMatcher,
9
- compileMiddlewareConfig,
10
- matchesCompiledMiddlewareConfig
14
+ assertSupportedMiddlewareMatcher
11
15
  } from "./chunk-HKFBMHCD.mjs";
12
16
  import {
13
17
  toPublicValidationIssues
@@ -16,10 +20,6 @@ import {
16
20
  applyWebResponseHeaders,
17
21
  sendWebResponse
18
22
  } from "./chunk-Z2RZJZIZ.mjs";
19
- import {
20
- createFarmAPIMiddlewarePathnames,
21
- resolveFarmAPIServerBasePath
22
- } from "./chunk-BTHHUD7Q.mjs";
23
23
  import {
24
24
  bufferFarmRequestBody,
25
25
  createFarmRequestBodyErrorResponse,
@@ -43,15 +43,8 @@ import {
43
43
  validateConfigRouteSource
44
44
  } from "./chunk-SAXPH6G5.mjs";
45
45
  import {
46
- canonicalizeRequestPathSegments,
47
- canonicalizeRequestPathname
46
+ canonicalizeRequestPathSegments
48
47
  } from "./chunk-CQ6OSQ3K.mjs";
49
- import {
50
- resolveFarmLocalePath
51
- } from "./chunk-L3KT7IXV.mjs";
52
- import {
53
- stripFarmBasePath
54
- } from "./chunk-4RB44K6Z.mjs";
55
48
  import {
56
49
  assertTerminalCatchAll,
57
50
  assertUniqueRouteParameters,
@@ -268,10 +261,6 @@ function defineIntegration(integration) {
268
261
  };
269
262
  }
270
263
  __name(defineIntegration, "defineIntegration");
271
- function isFarmIntegration(value) {
272
- return !!value && typeof value === "object" && value.kind === "farm-integration";
273
- }
274
- __name(isFarmIntegration, "isFarmIntegration");
275
264
  function resolveIntegrationPlugins(integrations) {
276
265
  if (!integrations) {
277
266
  return [];
@@ -2011,156 +2000,6 @@ function matchesMethod(methods, normalizedMethod) {
2011
2000
  return methods.some((candidate) => candidate === "ALL" || candidate === normalizedMethod);
2012
2001
  }
2013
2002
  __name(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 = compileMiddlewareConfig({
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 = matchesCompiledMiddlewareConfig(candidate, compiled, noMiddlewareContext);
2035
- if (result.matched) return result.params ?? {};
2036
- }
2037
- return null;
2038
- }
2039
- __name(resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
2040
- function integrationMiddlewareMayHandlePath(integrations, pathname, catchAllProbe) {
2041
- if (!integrations) return false;
2042
- const covers = /* @__PURE__ */ __name((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
- __name(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 api2?.baseURL === "string" && typeof api2.basePath === "string" ? resolveFarmAPIServerBasePath(api2) : void 0;
2064
- toPathnames = createFarmAPIMiddlewarePathnames(serverBasePath);
2065
- integrationAPIPathnames.set(config, toPathnames);
2066
- }
2067
- return toPathnames;
2068
- }
2069
- __name(getIntegrationAPIPathnames, "getIntegrationAPIPathnames");
2070
- function resolveIntegrationRoutePathname(pathname, config) {
2071
- const basePath = typeof config?.basePath === "string" ? config.basePath : void 0;
2072
- let routePathname = basePath ? stripFarmBasePath(pathname, basePath) : pathname;
2073
- const i18n = config?.i18n;
2074
- if (i18n && Array.isArray(i18n.locales) && i18n.locales.length > 0) {
2075
- routePathname = resolveFarmLocalePath(routePathname, {
2076
- locales: i18n.locales,
2077
- defaultLocale: i18n.defaultLocale,
2078
- routing: i18n.routing || "prefix-except-default"
2079
- }).pathname;
2080
- }
2081
- return routePathname;
2082
- }
2083
- __name(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
- canonicalPathname ?? (canonicalPathname = canonicalizeRequestPathname(pathname));
2097
- const prefix = item.slice(0, -4);
2098
- if (canonicalPathname === prefix || canonicalPathname.startsWith(`${prefix}/`)) {
2099
- return {};
2100
- }
2101
- continue;
2102
- }
2103
- canonicalSegments ?? (canonicalSegments = canonicalizeRequestPathSegments(pathname));
2104
- const params = matchPathSegments(splitPath(item), canonicalSegments);
2105
- if (params) {
2106
- return params;
2107
- }
2108
- }
2109
- return null;
2110
- }
2111
- __name(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
- __name(matchPathSegments, "matchPathSegments");
2145
- function splitPath(value) {
2146
- return value.split("/").filter(Boolean);
2147
- }
2148
- __name(splitPath, "splitPath");
2149
- function isDynamicSegment(segment) {
2150
- return segment.startsWith("[") && segment.endsWith("]");
2151
- }
2152
- __name(isDynamicSegment, "isDynamicSegment");
2153
- function isCatchAllSegment(segment) {
2154
- return segment.startsWith("[...") && segment.endsWith("]");
2155
- }
2156
- __name(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
- __name(getSegmentParamName, "getSegmentParamName");
2164
2003
  function getRequestId(req) {
2165
2004
  const headerValue = req.headers["x-request-id"];
2166
2005
  if (Array.isArray(headerValue)) {
@@ -2187,7 +2026,6 @@ export {
2187
2026
  createIntegrationRoute,
2188
2027
  integrationRoute,
2189
2028
  defineIntegration,
2190
- isFarmIntegration,
2191
2029
  resolveIntegrationPlugins,
2192
2030
  getIntegrationProviders,
2193
2031
  isFarmIntegrationProviderComponentReference,
@@ -2200,7 +2038,5 @@ export {
2200
2038
  matchRegisteredIntegrationRoute,
2201
2039
  getRegisteredIntegrationAPIManifest,
2202
2040
  dispatchIntegrationRequest,
2203
- dispatchIntegrationRequests,
2204
- integrationMiddlewareMayHandlePath,
2205
- FARM_INTEGRATION_API_BASE_PATH_KEY
2041
+ dispatchIntegrationRequests
2206
2042
  };
@@ -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;
@@ -0,0 +1,186 @@
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
+
3
+
4
+ var _chunkALPWLT27cjs = require('./chunk-ALPWLT27.cjs');
5
+
6
+
7
+
8
+ var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
9
+
10
+
11
+
12
+ var _chunkUS2QVW3Ecjs = require('./chunk-US2QVW3E.cjs');
13
+
14
+
15
+ var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
16
+
17
+
18
+ var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
19
+
20
+
21
+ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
22
+
23
+ // src/integration-middleware-matcher.ts
24
+ function isFarmIntegration(value) {
25
+ return !!value && typeof value === "object" && value.kind === "farm-integration";
26
+ }
27
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isFarmIntegration, "isFarmIntegration");
28
+ var compiledIntegrationGuards = /* @__PURE__ */ new WeakMap();
29
+ var noMiddlewareContext = {};
30
+ function resolveIntegrationMiddlewareParams(entry, pathname, config) {
31
+ const params = resolveMatcherParams(entry.matcher, pathname);
32
+ if (params || !entry.matcher) return params;
33
+ const routePathname = resolveIntegrationRoutePathname(pathname, config);
34
+ const candidates = [.../* @__PURE__ */ new Set([pathname, ...getIntegrationAPIPathnames(config)(routePathname)])];
35
+ for (const candidate of candidates) {
36
+ if (candidate === pathname) continue;
37
+ const routeParams = resolveMatcherParams(entry.matcher, candidate);
38
+ if (routeParams) return routeParams;
39
+ }
40
+ let compiled = compiledIntegrationGuards.get(entry);
41
+ if (!compiled) {
42
+ compiled = _chunkALPWLT27cjs.compileMiddlewareConfig.call(void 0, {
43
+ matcher: typeof entry.matcher === "string" ? entry.matcher : [...entry.matcher]
44
+ });
45
+ compiledIntegrationGuards.set(entry, compiled);
46
+ }
47
+ for (const candidate of candidates) {
48
+ const result = _chunkALPWLT27cjs.matchesCompiledMiddlewareConfig.call(void 0, candidate, compiled, noMiddlewareContext);
49
+ if (result.matched) return _nullishCoalesce(result.params, () => ( {}));
50
+ }
51
+ return null;
52
+ }
53
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
54
+ function integrationMiddlewareMayHandlePath(integrations, pathname, catchAllProbe) {
55
+ if (!integrations) return false;
56
+ const covers = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (entry) => resolveIntegrationMiddlewareParams(entry, pathname, void 0) !== null, "covers");
57
+ return Object.values(integrations).some(
58
+ (integration) => isFarmIntegration(integration) && (integration.middleware || []).some((entry) => {
59
+ if (catchAllProbe === void 0) return covers(entry);
60
+ if (!entry.matcher) return false;
61
+ const specific = (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).filter(
62
+ (matcher) => resolveIntegrationMiddlewareParams({ matcher }, catchAllProbe, void 0) === null
63
+ );
64
+ return specific.length > 0 && covers({ matcher: specific });
65
+ })
66
+ );
67
+ }
68
+ _chunkS3JO3N4Hcjs.__name.call(void 0, integrationMiddlewareMayHandlePath, "integrationMiddlewareMayHandlePath");
69
+ var FARM_INTEGRATION_API_BASE_PATH_KEY = "__farmAPIServerBasePath";
70
+ var integrationAPIPathnames = /* @__PURE__ */ new WeakMap();
71
+ function getIntegrationAPIPathnames(config) {
72
+ if (!config) return (pathname) => [pathname];
73
+ let toPathnames = integrationAPIPathnames.get(config);
74
+ if (!toPathnames) {
75
+ const recorded = config[FARM_INTEGRATION_API_BASE_PATH_KEY];
76
+ const api = config.api;
77
+ const serverBasePath = typeof recorded === "string" ? recorded : typeof _optionalChain([api, 'optionalAccess', _ => _.baseURL]) === "string" && typeof api.basePath === "string" ? _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, api) : void 0;
78
+ toPathnames = _chunkKNBBQHO2cjs.createFarmAPIMiddlewarePathnames.call(void 0, serverBasePath);
79
+ integrationAPIPathnames.set(config, toPathnames);
80
+ }
81
+ return toPathnames;
82
+ }
83
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getIntegrationAPIPathnames, "getIntegrationAPIPathnames");
84
+ function resolveIntegrationRoutePathname(pathname, config) {
85
+ const basePath = typeof _optionalChain([config, 'optionalAccess', _2 => _2.basePath]) === "string" ? config.basePath : void 0;
86
+ let routePathname = basePath ? _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, basePath) : pathname;
87
+ const i18n = _optionalChain([config, 'optionalAccess', _3 => _3.i18n]);
88
+ if (i18n && Array.isArray(i18n.locales) && i18n.locales.length > 0) {
89
+ routePathname = _chunkBIDYX3SLcjs.resolveFarmLocalePath.call(void 0, routePathname, {
90
+ locales: i18n.locales,
91
+ defaultLocale: i18n.defaultLocale,
92
+ routing: i18n.routing || "prefix-except-default"
93
+ }).pathname;
94
+ }
95
+ return routePathname;
96
+ }
97
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationRoutePathname, "resolveIntegrationRoutePathname");
98
+ function resolveMatcherParams(matcher, pathname) {
99
+ if (!matcher) {
100
+ return {};
101
+ }
102
+ const list = Array.isArray(matcher) ? matcher : [matcher];
103
+ let canonicalPathname;
104
+ let canonicalSegments;
105
+ for (const item of list) {
106
+ if (item === "/(.*)" || item === "*") {
107
+ return {};
108
+ }
109
+ if (item.endsWith("(.*)")) {
110
+ _nullishCoalesce(canonicalPathname, () => ( (canonicalPathname = _chunkUS2QVW3Ecjs.canonicalizeRequestPathname.call(void 0, pathname))));
111
+ const prefix = item.slice(0, -4);
112
+ if (canonicalPathname === prefix || canonicalPathname.startsWith(`${prefix}/`)) {
113
+ return {};
114
+ }
115
+ continue;
116
+ }
117
+ _nullishCoalesce(canonicalSegments, () => ( (canonicalSegments = _chunkUS2QVW3Ecjs.canonicalizeRequestPathSegments.call(void 0, pathname))));
118
+ const params = matchPathSegments(splitPath(item), canonicalSegments);
119
+ if (params) {
120
+ return params;
121
+ }
122
+ }
123
+ return null;
124
+ }
125
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveMatcherParams, "resolveMatcherParams");
126
+ function matchPathSegments(routeSegments, pathSegments) {
127
+ const params = {};
128
+ let routeIndex = 0;
129
+ let pathIndex = 0;
130
+ while (routeIndex < routeSegments.length && pathIndex < pathSegments.length) {
131
+ const routeSegment = routeSegments[routeIndex];
132
+ const pathSegment = pathSegments[pathIndex];
133
+ if (isCatchAllSegment(routeSegment)) {
134
+ params[getSegmentParamName(routeSegment)] = pathSegments.slice(pathIndex);
135
+ return params;
136
+ }
137
+ if (isDynamicSegment(routeSegment)) {
138
+ params[getSegmentParamName(routeSegment)] = pathSegment;
139
+ routeIndex += 1;
140
+ pathIndex += 1;
141
+ continue;
142
+ }
143
+ if (routeSegment !== pathSegment) {
144
+ return null;
145
+ }
146
+ routeIndex += 1;
147
+ pathIndex += 1;
148
+ }
149
+ if (routeIndex === routeSegments.length && pathIndex === pathSegments.length) {
150
+ return params;
151
+ }
152
+ if (routeIndex === routeSegments.length - 1 && isCatchAllSegment(routeSegments[routeIndex])) {
153
+ params[getSegmentParamName(routeSegments[routeIndex])] = [];
154
+ return params;
155
+ }
156
+ return null;
157
+ }
158
+ _chunkS3JO3N4Hcjs.__name.call(void 0, matchPathSegments, "matchPathSegments");
159
+ function splitPath(value) {
160
+ return value.split("/").filter(Boolean);
161
+ }
162
+ _chunkS3JO3N4Hcjs.__name.call(void 0, splitPath, "splitPath");
163
+ function isDynamicSegment(segment) {
164
+ return segment.startsWith("[") && segment.endsWith("]");
165
+ }
166
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isDynamicSegment, "isDynamicSegment");
167
+ function isCatchAllSegment(segment) {
168
+ return segment.startsWith("[...") && segment.endsWith("]");
169
+ }
170
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isCatchAllSegment, "isCatchAllSegment");
171
+ function getSegmentParamName(segment) {
172
+ if (isCatchAllSegment(segment)) {
173
+ return segment.slice(4, -1);
174
+ }
175
+ return segment.slice(1, -1);
176
+ }
177
+ _chunkS3JO3N4Hcjs.__name.call(void 0, getSegmentParamName, "getSegmentParamName");
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ exports.isFarmIntegration = isFarmIntegration; exports.resolveIntegrationMiddlewareParams = resolveIntegrationMiddlewareParams; exports.integrationMiddlewareMayHandlePath = integrationMiddlewareMayHandlePath; exports.FARM_INTEGRATION_API_BASE_PATH_KEY = FARM_INTEGRATION_API_BASE_PATH_KEY; exports.matchPathSegments = matchPathSegments; exports.splitPath = splitPath;
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var version = "0.1.42";
2
+ var version = "0.1.44";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -7,7 +7,7 @@ import {
7
7
  notifyHistoryChange,
8
8
  readPageState,
9
9
  subscribeHistoryChange
10
- } from "./chunk-TS4JHGUJ.mjs";
10
+ } from "./chunk-S3ZEMCE6.mjs";
11
11
  import {
12
12
  getFarmI18nClientState
13
13
  } from "./chunk-IHQIOZLC.mjs";