@farm.js/core 0.1.70 → 0.1.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/dist/{agent-mcp-handler-6T2Z7TB6.cjs → agent-mcp-handler-KE4J3W7S.cjs} +3 -3
  2. package/dist/{agent-mcp-handler-CPU354QQ.mjs → agent-mcp-handler-VIT4GOSR.mjs} +2 -2
  3. package/dist/{agent-mcp.d-DulgFLBt.d.ts → agent-mcp.d-BzNw6JI8.d.ts} +14 -4
  4. package/dist/{agent-mcp.d-TAs1ES2F.d.mts → agent-mcp.d-CgFen3EH.d.mts} +14 -4
  5. package/dist/agent-runtime.d.mts +1 -1
  6. package/dist/agent-runtime.d.ts +1 -1
  7. package/dist/analyzer-LPIVRSTJ.cjs +16 -0
  8. package/dist/{analyzer-QGRBLETM.mjs → analyzer-VK3BAOFI.mjs} +2 -2
  9. package/dist/api/node.d.mts +3 -3
  10. package/dist/api/node.d.ts +3 -3
  11. package/dist/api/route-manager.d.mts +3 -3
  12. package/dist/api/route-manager.d.ts +3 -3
  13. package/dist/api/runtime.d.mts +2 -2
  14. package/dist/api/runtime.d.ts +2 -2
  15. package/dist/api.d.mts +4 -4
  16. package/dist/api.d.ts +4 -4
  17. package/dist/{app-manifest.d-C-nf3Vmm.d.ts → app-manifest.d-DY4JfJxi.d.ts} +1 -1
  18. package/dist/{app-manifest.d-6zXb90o6.d.mts → app-manifest.d-DpDK_B1k.d.mts} +1 -1
  19. package/dist/app-markdown.cjs +5 -3
  20. package/dist/app-markdown.d.mts +3 -3
  21. package/dist/app-markdown.d.ts +3 -3
  22. package/dist/app-markdown.mjs +4 -2
  23. package/dist/{app.d-C2xeMIYT.d.ts → app.d-BeK6bb1c.d.ts} +8 -6
  24. package/dist/{app.d-DF0aundc.d.mts → app.d-D-5UNrFd.d.mts} +8 -6
  25. package/dist/{chunk-HAXFV2CD.mjs → chunk-2CQC5CMD.mjs} +1 -1
  26. package/dist/{chunk-IEN2EFE5.cjs → chunk-2IFT2CSA.cjs} +4 -4
  27. package/dist/{chunk-BPUVDCGG.cjs → chunk-3BQ7QHUH.cjs} +3 -3
  28. package/dist/{chunk-JFVT5ZZV.mjs → chunk-4OD2LXF2.mjs} +1 -1
  29. package/dist/{chunk-CCHJWJGP.mjs → chunk-7BUE2GM6.mjs} +141 -86
  30. package/dist/{chunk-FJ5YCERM.cjs → chunk-7OHJWFLB.cjs} +387 -331
  31. package/dist/{chunk-5R3JQPWD.mjs → chunk-AYVGD3PK.mjs} +1 -1
  32. package/dist/{chunk-K7JMTAFH.cjs → chunk-CSQPMV3Q.cjs} +16 -6
  33. package/dist/{chunk-N62IYXYD.mjs → chunk-DPIGYXSV.mjs} +1 -1
  34. package/dist/{chunk-LECZ5DPZ.cjs → chunk-DPYBVVL3.cjs} +2 -2
  35. package/dist/{chunk-RMOU3PR4.mjs → chunk-GUU3IZSM.mjs} +63 -23
  36. package/dist/{chunk-EDZU7YRK.mjs → chunk-IGXS54GC.mjs} +2 -2
  37. package/dist/{chunk-3WS5AZ3R.mjs → chunk-IYDJNCR7.mjs} +1 -1
  38. package/dist/{chunk-R7254L3R.mjs → chunk-J5ASGNKF.mjs} +23 -0
  39. package/dist/{chunk-75E5FDX2.mjs → chunk-JMFTKNBA.mjs} +10 -10
  40. package/dist/{chunk-DIHBWZDZ.cjs → chunk-JVA4PIYN.cjs} +408 -294
  41. package/dist/{chunk-XYVPTTUT.cjs → chunk-KEB7AGS6.cjs} +4 -4
  42. package/dist/{chunk-TLSSIYAL.mjs → chunk-KQAB5LML.mjs} +10 -3
  43. package/dist/{chunk-M6U6E4F7.cjs → chunk-KWST2O22.cjs} +108 -68
  44. package/dist/{chunk-NSZY3EWG.cjs → chunk-L6E4SHUB.cjs} +31 -8
  45. package/dist/{chunk-MZLJFNMH.cjs → chunk-MEJCP2LX.cjs} +1 -1
  46. package/dist/{chunk-A2TH5MKE.mjs → chunk-MITIAOUQ.mjs} +3 -3
  47. package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
  48. package/dist/{chunk-4AC4PXZO.cjs → chunk-N3XO5AL5.cjs} +2 -2
  49. package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
  50. package/dist/{chunk-32SYRIQ7.cjs → chunk-PLXD2MJV.cjs} +3 -3
  51. package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
  52. package/dist/{chunk-3EXCZJEN.mjs → chunk-QUFENL7Q.mjs} +1 -1
  53. package/dist/{chunk-NYF7A4UW.mjs → chunk-RJUCNO7R.mjs} +1 -1
  54. package/dist/{chunk-K4UGCUXX.cjs → chunk-SXMWVP2L.cjs} +7 -7
  55. package/dist/{chunk-VG6HYT5K.cjs → chunk-TP4RAV7Y.cjs} +9 -9
  56. package/dist/{chunk-I7NUT24Z.cjs → chunk-UISZLYKY.cjs} +2 -2
  57. package/dist/{chunk-KPMLDT3B.mjs → chunk-UQUOSNRN.mjs} +378 -264
  58. package/dist/{chunk-QZHTDVH4.mjs → chunk-V25GSH43.mjs} +1 -1
  59. package/dist/{chunk-65FPDDT4.cjs → chunk-VXB5CMNC.cjs} +2 -2
  60. package/dist/{chunk-5IJRJWJS.mjs → chunk-W2T6NDNP.mjs} +10 -0
  61. package/dist/{chunk-JRF2SKCD.mjs → chunk-X7LGLF33.mjs} +1 -1
  62. package/dist/{chunk-QEWWKYDL.cjs → chunk-YCNHUIPR.cjs} +17 -10
  63. package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
  64. package/dist/{chunk-A7HCBHMC.cjs → chunk-ZPUAOKHV.cjs} +3 -3
  65. package/dist/{client-component.d-Bk5qKJM-.d.mts → client-component.d-DwpH251K.d.mts} +2 -2
  66. package/dist/{client-component.d-DNbC4oWI.d.ts → client-component.d-fYupugbZ.d.ts} +2 -2
  67. package/dist/{client-plugins.d-DwUqh4gp.d.ts → client-plugins.d-BxqFfHpM.d.ts} +8 -5
  68. package/dist/{client-plugins.d-Pi9nG0W0.d.mts → client-plugins.d-k3bOT5gz.d.mts} +8 -5
  69. package/dist/client-plugins.d.mts +1 -1
  70. package/dist/client-plugins.d.ts +1 -1
  71. package/dist/client.d.mts +6 -6
  72. package/dist/client.d.ts +6 -6
  73. package/dist/config.d.mts +1 -1
  74. package/dist/config.d.ts +1 -1
  75. package/dist/desktop.d.mts +2 -2
  76. package/dist/desktop.d.ts +2 -2
  77. package/dist/{devtools-CB43AHEP.mjs → devtools-6MXPFPNJ.mjs} +2 -2
  78. package/dist/{devtools-L5DUNDF3.cjs → devtools-O5625KCK.cjs} +3 -3
  79. package/dist/docs.cjs +4 -4
  80. package/dist/docs.d.mts +2 -2
  81. package/dist/docs.d.ts +2 -2
  82. package/dist/docs.mjs +3 -3
  83. package/dist/environment/vite.cjs +3 -3
  84. package/dist/environment/vite.mjs +2 -2
  85. package/dist/{headers.d-CE6OWB-n.d.ts → headers.d-DalIGbVO.d.ts} +1 -1
  86. package/dist/{headers.d-DED1hHh4.d.mts → headers.d-sNT7ZQiU.d.mts} +1 -1
  87. package/dist/index.cjs +20 -18
  88. package/dist/{index.d-c9UwIqDy.d.ts → index.d-BcA-secm.d.ts} +1 -1
  89. package/dist/{index.d-CbvOjJcp.d.mts → index.d-DDHHAv7j.d.mts} +1 -1
  90. package/dist/index.d.mts +18 -18
  91. package/dist/index.d.ts +18 -18
  92. package/dist/index.mjs +19 -17
  93. package/dist/integrations/orm.d.mts +1 -1
  94. package/dist/integrations/orm.d.ts +1 -1
  95. package/dist/integrations.d.mts +1 -1
  96. package/dist/integrations.d.ts +1 -1
  97. package/dist/internal/app-markdown-runtime.cjs +4 -2
  98. package/dist/internal/app-markdown-runtime.d.mts +11 -3
  99. package/dist/internal/app-markdown-runtime.d.ts +11 -3
  100. package/dist/internal/app-markdown-runtime.mjs +3 -1
  101. package/dist/internal/build-runtime.cjs +19 -19
  102. package/dist/internal/build-runtime.d.mts +3 -3
  103. package/dist/internal/build-runtime.d.ts +3 -3
  104. package/dist/internal/build-runtime.mjs +18 -18
  105. package/dist/internal/cli-runtime.cjs +6 -4
  106. package/dist/internal/cli-runtime.mjs +5 -3
  107. package/dist/internal/client-error-overlay.cjs +4 -4
  108. package/dist/internal/client-error-overlay.mjs +1 -1
  109. package/dist/internal/client-runtime.d.mts +4 -4
  110. package/dist/internal/client-runtime.d.ts +4 -4
  111. package/dist/internal/compression-runtime.d.mts +1 -1
  112. package/dist/internal/compression-runtime.d.ts +1 -1
  113. package/dist/internal/config-runtime.cjs +4 -4
  114. package/dist/internal/config-runtime.d.mts +3 -3
  115. package/dist/internal/config-runtime.d.ts +3 -3
  116. package/dist/internal/config-runtime.mjs +3 -3
  117. package/dist/internal/infra-analytics-runtime.cjs +7 -7
  118. package/dist/internal/infra-analytics-runtime.mjs +5 -5
  119. package/dist/internal/native-server-fns.cjs +4 -4
  120. package/dist/internal/native-server-fns.mjs +3 -3
  121. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  122. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  123. package/dist/internal/production-runtime.cjs +6 -6
  124. package/dist/internal/production-runtime.d.mts +14 -9
  125. package/dist/internal/production-runtime.d.ts +14 -9
  126. package/dist/internal/production-runtime.mjs +5 -5
  127. package/dist/markdown.d.mts +1 -1
  128. package/dist/markdown.d.ts +1 -1
  129. package/dist/middleware.d.mts +1 -1
  130. package/dist/middleware.d.ts +1 -1
  131. package/dist/{mount.d-BvWxf8ZE.d.mts → mount.d-C1PONsEe.d.mts} +1 -1
  132. package/dist/{mount.d-DngLY7NL.d.ts → mount.d-D3JOux2V.d.ts} +1 -1
  133. package/dist/{navigation-delegate.d-CMyl1h2l.d.mts → navigation-delegate.d-CJQQHboA.d.mts} +1 -1
  134. package/dist/{navigation-delegate.d-zZogiDfa.d.ts → navigation-delegate.d-CQQPbdkE.d.ts} +1 -1
  135. package/dist/navigation.d.mts +4 -4
  136. package/dist/navigation.d.ts +4 -4
  137. package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
  138. package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
  139. package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
  140. package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
  141. package/dist/plugin.cjs +13 -13
  142. package/dist/plugin.d.mts +4 -4
  143. package/dist/plugin.d.ts +4 -4
  144. package/dist/plugin.mjs +12 -12
  145. package/dist/{render-plan.d-Di1znBDW.d.mts → render-plan.d-CiUj0rq5.d.mts} +1 -1
  146. package/dist/{render-plan.d-DQj2bzd2.d.ts → render-plan.d-DHuJMJRP.d.ts} +1 -1
  147. package/dist/renderer-client.d.mts +4 -4
  148. package/dist/renderer-client.d.ts +4 -4
  149. package/dist/{request.d-CJWzfDYJ.d.mts → request.d-D-F7o7tb.d.mts} +1 -1
  150. package/dist/{request.d-C5vyoYeL.d.ts → request.d-DRUbOmYD.d.ts} +1 -1
  151. package/dist/request.d.mts +2 -2
  152. package/dist/request.d.ts +2 -2
  153. package/dist/{route-rendering.d-C-et2TZ1.d.mts → route-rendering.d-6smgwT2t.d.mts} +1 -1
  154. package/dist/{route-rendering.d-DhsY5M2I.d.ts → route-rendering.d-KwqM_mlK.d.ts} +1 -1
  155. package/dist/{router.d-CJB-Ntni.d.ts → router.d-B6sesMRD.d.ts} +1 -1
  156. package/dist/{router.d-BMDS5s5X.d.mts → router.d-BYmDeDlp.d.mts} +1 -1
  157. package/dist/routes.d.mts +1 -1
  158. package/dist/routes.d.ts +1 -1
  159. package/dist/{rsc-pipeline-NJKLZ3YE.cjs → rsc-pipeline-P4PCWDO2.cjs} +4 -4
  160. package/dist/{rsc-pipeline-AXQJCCHI.mjs → rsc-pipeline-R2GOKIMU.mjs} +3 -3
  161. package/dist/{runtime-JXNEKOSE.mjs → runtime-DP5DYGW5.mjs} +3 -3
  162. package/dist/{runtime-DMW6DDOI.cjs → runtime-WA2Q4SLG.cjs} +5 -5
  163. package/dist/{runtime.d-BonodRI9.d.mts → runtime.d-BFSJf-ww.d.mts} +1 -1
  164. package/dist/{runtime.d-uw4123iI.d.ts → runtime.d-CbdMI0Oy.d.ts} +1 -1
  165. package/dist/server-plugins.d.mts +3 -3
  166. package/dist/server-plugins.d.ts +3 -3
  167. package/dist/server.cjs +33 -33
  168. package/dist/server.d.mts +10 -10
  169. package/dist/server.d.ts +10 -10
  170. package/dist/server.mjs +15 -15
  171. package/dist/{spa-router.d-rha3M95y.d.mts → spa-router.d-D4EDwR20.d.mts} +2 -2
  172. package/dist/{spa-router.d-l0d9pPZj.d.ts → spa-router.d-mC1D5cTN.d.ts} +2 -2
  173. package/dist/testing.d.mts +1 -1
  174. package/dist/testing.d.ts +1 -1
  175. package/dist/{utils.d-BK-PTOF8.d.ts → utils.d-A2X3a6z_.d.ts} +1 -1
  176. package/dist/{utils.d-BzuTobEc.d.mts → utils.d-DxMzteqE.d.mts} +1 -1
  177. package/dist/version.cjs +2 -2
  178. package/dist/version.mjs +1 -1
  179. package/dist/vite.cjs +13 -13
  180. package/dist/vite.d.mts +7 -5
  181. package/dist/vite.d.ts +7 -5
  182. package/dist/vite.mjs +12 -12
  183. package/package.json +2 -2
  184. package/dist/analyzer-GUIRJWZH.cjs +0 -16
@@ -75,9 +75,30 @@ async function evaluateMdxSource(source, filePath) {
75
75
  remarkPlugins: [remarkGfm]
76
76
  });
77
77
  }
78
+ var MARKDOWN_ROUTE_CONFIG_EXPORT = /^export\s+const\s+(dynamic|revalidate|ssg)\s*=\s*("[^"\\]*"|'[^'\\]*'|\d+(?:\.\d+)?|true|false)\s*;?\s*$/;
79
+ function readFarmMarkdownRouteConfig(body) {
80
+ const config = {};
81
+ let fence;
82
+ for (const line of body.split(/\r?\n/)) {
83
+ const marker = _optionalChain([line, 'access', _6 => _6.match, 'call', _7 => _7(/^ {0,3}(`{3,}|~{3,})/), 'optionalAccess', _8 => _8[1]]);
84
+ if (fence) {
85
+ if (marker && marker[0] === fence[0] && marker.length >= fence.length) fence = void 0;
86
+ continue;
87
+ }
88
+ if (marker) {
89
+ fence = marker;
90
+ continue;
91
+ }
92
+ const match = line.match(MARKDOWN_ROUTE_CONFIG_EXPORT);
93
+ if (!match) continue;
94
+ const literal = match[2];
95
+ config[match[1]] = literal === "true" ? true : literal === "false" ? false : /^\d/.test(literal) ? Number(literal) : literal.slice(1, -1);
96
+ }
97
+ return config;
98
+ }
78
99
  function createFarmMarkdownRouteModule(input) {
79
100
  const { body } = parseMarkdownFrontmatter(input.source);
80
- const className = _optionalChain([input, 'access', _6 => _6.config, 'optionalAccess', _7 => _7.className]) || "farm-markdown";
101
+ const className = _optionalChain([input, 'access', _9 => _9.config, 'optionalAccess', _10 => _10.className]) || "farm-markdown";
81
102
  let evaluatedPromise;
82
103
  let componentsPromise;
83
104
  const loadContent = async () => {
@@ -104,12 +125,13 @@ function createFarmMarkdownRouteModule(input) {
104
125
  ...props,
105
126
  components: {
106
127
  ...components,
107
- ..._optionalChain([props, 'optionalAccess', _8 => _8.components])
128
+ ..._optionalChain([props, 'optionalAccess', _11 => _11.components])
108
129
  }
109
130
  })
110
131
  );
111
132
  }
112
133
  return {
134
+ ...readFarmMarkdownRouteConfig(body),
113
135
  default: FarmMarkdownPage,
114
136
  metadata: createMarkdownMetadata(input.source, input.filePath),
115
137
  source: input.source
@@ -183,8 +205,8 @@ async function anonymousVisitorOpensPage(options, url, targetPathname) {
183
205
  signal: options.request.signal
184
206
  })
185
207
  );
186
- if (response.status < 200 || response.status >= 300 || !_optionalChain([response, 'access', _9 => _9.headers, 'access', _10 => _10.get, 'call', _11 => _11("content-type"), 'optionalAccess', _12 => _12.toLowerCase, 'call', _13 => _13(), 'access', _14 => _14.includes, 'call', _15 => _15("text/html")])) {
187
- void _optionalChain([response, 'access', _16 => _16.body, 'optionalAccess', _17 => _17.cancel, 'call', _18 => _18(), 'access', _19 => _19.catch, 'call', _20 => _20(() => {
208
+ if (response.status < 200 || response.status >= 300 || !_optionalChain([response, 'access', _12 => _12.headers, 'access', _13 => _13.get, 'call', _14 => _14("content-type"), 'optionalAccess', _15 => _15.toLowerCase, 'call', _16 => _16(), 'access', _17 => _17.includes, 'call', _18 => _18("text/html")])) {
209
+ void _optionalChain([response, 'access', _19 => _19.body, 'optionalAccess', _20 => _20.cancel, 'call', _21 => _21(), 'access', _22 => _22.catch, 'call', _23 => _23(() => {
188
210
  })]);
189
211
  return false;
190
212
  }
@@ -201,7 +223,7 @@ async function createFarmMarkdownSourceResponse(options) {
201
223
  if (options.request.method !== "GET" && options.request.method !== "HEAD") {
202
224
  return null;
203
225
  }
204
- if (_optionalChain([options, 'access', _21 => _21.config, 'optionalAccess', _22 => _22.markdownRoutes]) === false) {
226
+ if (_optionalChain([options, 'access', _24 => _24.config, 'optionalAccess', _25 => _25.markdownRoutes]) === false) {
205
227
  return null;
206
228
  }
207
229
  const url = new URL(options.request.url);
@@ -244,7 +266,7 @@ async function createFarmMarkdownSourceResponse(options) {
244
266
  publicSourceResponses.add(response);
245
267
  return response;
246
268
  }
247
- await _optionalChain([publicResponse, 'access', _23 => _23.body, 'optionalAccess', _24 => _24.cancel, 'call', _25 => _25()]);
269
+ await _optionalChain([publicResponse, 'access', _26 => _26.body, 'optionalAccess', _27 => _27.cancel, 'call', _28 => _28()]);
248
270
  if (!hasMarkdownExtension) return null;
249
271
  return new Response(`No public Markdown version of ${targetPathname}.
250
272
  `, {
@@ -262,7 +284,7 @@ async function createFarmMarkdownSourceResponse(options) {
262
284
  "Content-Type": "text/markdown; charset=utf-8",
263
285
  "Content-Location": _chunkC2JOS77Zcjs._getFarmMarkdownPath.call(void 0,
264
286
  targetPathname,
265
- _optionalChain([options, 'access', _26 => _26.routePathname, 'optionalCall', _27 => _27(targetPathname)])
287
+ _optionalChain([options, 'access', _29 => _29.routePathname, 'optionalCall', _30 => _30(targetPathname)])
266
288
  ),
267
289
  "Cache-Control": "public, s-maxage=60, stale-while-revalidate=300",
268
290
  "X-Farm-Markdown-Route": targetPathname,
@@ -291,4 +313,5 @@ async function createFarmMarkdownSourceResponse(options) {
291
313
 
292
314
 
293
315
 
294
- exports.isFarmMarkdownPageFile = isFarmMarkdownPageFile; exports.normalizeFarmMarkdownRoutePath = normalizeFarmMarkdownRoutePath; exports.parseMarkdownFrontmatter = parseMarkdownFrontmatter; exports.titleFromMarkdown = titleFromMarkdown; exports.createMarkdownMetadata = createMarkdownMetadata; exports.createFarmMarkdownRouteModule = createFarmMarkdownRouteModule; exports.isFarmMarkdownPublicSourceResponse = isFarmMarkdownPublicSourceResponse; exports.FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS = FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS; exports.createFarmMarkdownSourceResponse = createFarmMarkdownSourceResponse;
316
+
317
+ exports.isFarmMarkdownPageFile = isFarmMarkdownPageFile; exports.normalizeFarmMarkdownRoutePath = normalizeFarmMarkdownRoutePath; exports.parseMarkdownFrontmatter = parseMarkdownFrontmatter; exports.titleFromMarkdown = titleFromMarkdown; exports.createMarkdownMetadata = createMarkdownMetadata; exports.readFarmMarkdownRouteConfig = readFarmMarkdownRouteConfig; exports.createFarmMarkdownRouteModule = createFarmMarkdownRouteModule; exports.isFarmMarkdownPublicSourceResponse = isFarmMarkdownPublicSourceResponse; exports.FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS = FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS; exports.createFarmMarkdownSourceResponse = createFarmMarkdownSourceResponse;
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var version = "0.1.70";
2
+ var version = "0.1.71";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  FARM_DEFAULT_MCP_PATH,
3
3
  FARM_DEFAULT_MCP_TOOLS
4
- } from "./chunk-75E5FDX2.mjs";
4
+ } from "./chunk-JMFTKNBA.mjs";
5
5
  import {
6
6
  normalizeFarmProductionSiteOrigin
7
- } from "./chunk-QZHTDVH4.mjs";
7
+ } from "./chunk-V25GSH43.mjs";
8
8
  import {
9
9
  resolveFarmAppManifestConfig
10
10
  } from "./chunk-SQ5O7I3L.mjs";
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-QDWMCFTH.mjs";
30
30
  import {
31
31
  FARM_VERSION
32
- } from "./chunk-NYF7A4UW.mjs";
32
+ } from "./chunk-RJUCNO7R.mjs";
33
33
  import {
34
34
  applyFarmBasePath
35
35
  } from "./chunk-SF3JB56B.mjs";
@@ -23,6 +23,7 @@ function normalizeRouteRules(routeRules) {
23
23
  if (!rule) continue;
24
24
  const normalizedSource = normalizeRuleSource(source);
25
25
  _chunkPWKAX5MScjs.validateConfigRouteSource.call(void 0, normalizedSource, `Route rule "${source}" source`);
26
+ assertSingleCatchAll(normalizedSource);
26
27
  const existingSource = normalizedSources.get(normalizedSource);
27
28
  if (existingSource !== void 0) {
28
29
  throw new Error(
@@ -150,6 +151,31 @@ function normalizeList(value) {
150
151
  if (!value || typeof value === "string") return value;
151
152
  return value.join(", ");
152
153
  }
154
+ function assertSingleCatchAll(source) {
155
+ let catchAlls = 0;
156
+ for (const segment of source.split("/")) {
157
+ if (/^:[A-Za-z_]\w*[*+]$/.test(segment)) {
158
+ catchAlls += 1;
159
+ continue;
160
+ }
161
+ const withoutDoubleStars = segment.replace(/\*\*/g, () => {
162
+ catchAlls += 1;
163
+ return "";
164
+ });
165
+ catchAlls += withoutDoubleStars.split("*").length - 1;
166
+ }
167
+ if (catchAlls <= 1) return;
168
+ const segments = source.split("/");
169
+ let last = segments.length - 1;
170
+ while (last > 0 && !segments[last].includes("*")) last -= 1;
171
+ let names = 0;
172
+ const suggestion = segments.map(
173
+ (segment, index) => segment === "*" && index !== last ? `:segment${++names === 1 ? "" : names}` : segment
174
+ ).join("/");
175
+ throw new Error(
176
+ `Route rule "${source}" has more than one catch-all. A route rule may use one "*", "**", ":name*" or ":name+", and "*" matches any number of segments, as "**" does. Match one segment with a named parameter instead` + (suggestion !== source ? `: "${suggestion}".` : `, as in "/:locale/docs/**".`)
177
+ );
178
+ }
153
179
  function normalizeRuleSource(source) {
154
180
  const trimmed = source.trim();
155
181
  if (!trimmed) {
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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
2
 
3
- var _chunkNSZY3EWGcjs = require('./chunk-NSZY3EWG.cjs');
3
+ var _chunkL6E4SHUBcjs = require('./chunk-L6E4SHUB.cjs');
4
4
 
5
5
  // src/app-markdown.ts
6
6
  var _promises = require('fs/promises');
@@ -8,7 +8,7 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
8
8
  var _url = require('url');
9
9
  async function createFarmMarkdownRouteModuleFromFile(filePath, options = {}) {
10
10
  const source = await _promises.readFile.call(void 0, filePath, "utf8");
11
- return _chunkNSZY3EWGcjs.createFarmMarkdownRouteModule.call(void 0, {
11
+ return _chunkL6E4SHUBcjs.createFarmMarkdownRouteModule.call(void 0, {
12
12
  source,
13
13
  filePath,
14
14
  components: options.components,
@@ -23,6 +23,7 @@ function normalizeRouteRules(routeRules) {
23
23
  if (!rule) continue;
24
24
  const normalizedSource = normalizeRuleSource(source);
25
25
  validateConfigRouteSource(normalizedSource, `Route rule "${source}" source`);
26
+ assertSingleCatchAll(normalizedSource);
26
27
  const existingSource = normalizedSources.get(normalizedSource);
27
28
  if (existingSource !== void 0) {
28
29
  throw new Error(
@@ -150,6 +151,31 @@ function normalizeList(value) {
150
151
  if (!value || typeof value === "string") return value;
151
152
  return value.join(", ");
152
153
  }
154
+ function assertSingleCatchAll(source) {
155
+ let catchAlls = 0;
156
+ for (const segment of source.split("/")) {
157
+ if (/^:[A-Za-z_]\w*[*+]$/.test(segment)) {
158
+ catchAlls += 1;
159
+ continue;
160
+ }
161
+ const withoutDoubleStars = segment.replace(/\*\*/g, () => {
162
+ catchAlls += 1;
163
+ return "";
164
+ });
165
+ catchAlls += withoutDoubleStars.split("*").length - 1;
166
+ }
167
+ if (catchAlls <= 1) return;
168
+ const segments = source.split("/");
169
+ let last = segments.length - 1;
170
+ while (last > 0 && !segments[last].includes("*")) last -= 1;
171
+ let names = 0;
172
+ const suggestion = segments.map(
173
+ (segment, index) => segment === "*" && index !== last ? `:segment${++names === 1 ? "" : names}` : segment
174
+ ).join("/");
175
+ throw new Error(
176
+ `Route rule "${source}" has more than one catch-all. A route rule may use one "*", "**", ":name*" or ":name+", and "*" matches any number of segments, as "**" does. Match one segment with a named parameter instead` + (suggestion !== source ? `: "${suggestion}".` : `, as in "/:locale/docs/**".`)
177
+ );
178
+ }
153
179
  function normalizeRuleSource(source) {
154
180
  const trimmed = source.trim();
155
181
  if (!trimmed) {
@@ -10,7 +10,7 @@ var _chunk42KMUIWZcjs = require('./chunk-42KMUIWZ.cjs');
10
10
  var _chunkXVSBALOYcjs = require('./chunk-XVSBALOY.cjs');
11
11
 
12
12
 
13
- var _chunkXYVPTTUTcjs = require('./chunk-XYVPTTUT.cjs');
13
+ var _chunkKEB7AGS6cjs = require('./chunk-KEB7AGS6.cjs');
14
14
 
15
15
 
16
16
 
@@ -156,7 +156,7 @@ async function createFarmRscViteConfig(userConfig, options) {
156
156
  server: { environmentName: "rsc" },
157
157
  config: {
158
158
  preset: options.preset,
159
- outputDir: options.outputDir && _chunkXYVPTTUTcjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
159
+ outputDir: options.outputDir && _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
160
160
  }
161
161
  })
162
162
  ]
@@ -210,7 +210,7 @@ async function resolveFarmRscServerPlugins(userConfig, config, root) {
210
210
  }
211
211
  async function configureFarmRscPlugins(config, command) {
212
212
  if (config.plugins.length === 0) return config;
213
- const { PluginManager } = await import("./plugin-F2O4BFTK.cjs");
213
+ const { PluginManager } = await import("./plugin-5PIQQVRP.cjs");
214
214
  const manager = new PluginManager({
215
215
  config,
216
216
  isDev: command === "serve",
@@ -688,6 +688,7 @@ var PluginManager = class {
688
688
  * Runs only `runtime.before` for a request Farm re-routed internally, such as
689
689
  * a configured rewrite, so guards also see the destination URL. The session
690
690
  * opened for `source` keeps its context; context and after hooks don't rerun.
691
+ * `options` describe the destination; the session keeps the source's route.
691
692
  */
692
693
  async runRuntimeBeforeForRewrite(source, request, options = {}) {
693
694
  if (!this.hasRuntimeHook("before")) return request;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getFarmRouteLabel
3
- } from "./chunk-A2TH5MKE.mjs";
3
+ } from "./chunk-MITIAOUQ.mjs";
4
4
  import {
5
5
  classifyFarmAgent
6
6
  } from "./chunk-KPJYBSHL.mjs";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.1.70";
2
+ var version = "0.1.71";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;
@@ -1,10 +1,10 @@
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 _chunkVG6HYT5Kcjs = require('./chunk-VG6HYT5K.cjs');
4
+ var _chunkTP4RAV7Ycjs = require('./chunk-TP4RAV7Y.cjs');
5
5
 
6
6
 
7
- var _chunkLECZ5DPZcjs = require('./chunk-LECZ5DPZ.cjs');
7
+ var _chunkDPYBVVL3cjs = require('./chunk-DPYBVVL3.cjs');
8
8
 
9
9
 
10
10
  var _chunkBTVDYS4Bcjs = require('./chunk-BTVDYS4B.cjs');
@@ -29,7 +29,7 @@ var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
29
29
  var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
30
30
 
31
31
 
32
- var _chunkMZLJFNMHcjs = require('./chunk-MZLJFNMH.cjs');
32
+ var _chunkMEJCP2LXcjs = require('./chunk-MEJCP2LX.cjs');
33
33
 
34
34
 
35
35
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
@@ -288,7 +288,7 @@ function createFarmAppManifest(input) {
288
288
  return {
289
289
  schemaVersion: 1,
290
290
  app: app ? {
291
- ...app.version ? { farm: _chunkMZLJFNMHcjs.FARM_VERSION } : {},
291
+ ...app.version ? { farm: _chunkMEJCP2LXcjs.FARM_VERSION } : {},
292
292
  ...app.renderer ? { renderer: input.renderer } : {},
293
293
  basePath: input.basePath,
294
294
  ...app.build ? { build: input.build } : {}
@@ -319,7 +319,7 @@ function resolveFarmSiteUrl() {
319
319
  asUrl(read("RAILWAY_PUBLIC_DOMAIN"))
320
320
  ];
321
321
  for (const candidate of candidates) {
322
- const origin = candidate ? _chunkLECZ5DPZcjs.normalizeFarmProductionSiteOrigin.call(void 0, candidate) : void 0;
322
+ const origin = candidate ? _chunkDPYBVVL3cjs.normalizeFarmProductionSiteOrigin.call(void 0, candidate) : void 0;
323
323
  if (origin) return origin;
324
324
  }
325
325
  return null;
@@ -374,7 +374,7 @@ function listDefaultServer(input) {
374
374
  authorization: "none",
375
375
  resources: [],
376
376
  prompts: [],
377
- tools: _chunkVG6HYT5Kcjs.FARM_DEFAULT_MCP_TOOLS.map((tool) => ({
377
+ tools: _chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_TOOLS.map((tool) => ({
378
378
  name: tool.name,
379
379
  title: tool.title,
380
380
  description: tool.description,
@@ -434,7 +434,7 @@ function listFarmBuiltInRoutePaths(input) {
434
434
  ...agent.manifest !== false ? [FARM_APP_MANIFEST_PATH, FARM_APP_MANIFEST_LEGACY_PATH] : [],
435
435
  ...agent.apiCatalog ? [FARM_API_CATALOG_PATH] : [],
436
436
  ...agent.aiCatalog !== false ? [FARM_AI_CATALOG_PATH, FARM_ARD_PATH] : [],
437
- ...agent.mcp === true ? [_chunkVG6HYT5Kcjs.FARM_DEFAULT_MCP_PATH, `${_chunkVG6HYT5Kcjs.FARM_DEFAULT_MCP_PATH}${FARM_MCP_SERVER_CARD_SUFFIX}`] : [],
437
+ ...agent.mcp === true ? [_chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH, `${_chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH}${FARM_MCP_SERVER_CARD_SUFFIX}`] : [],
438
438
  ..._optionalChain([agent, 'access', _43 => _43.llmsTxt, 'optionalAccess', _44 => _44.enabled]) ? ["/llms.txt"] : [],
439
439
  ..._optionalChain([agent, 'access', _45 => _45.llmsTxt, 'optionalAccess', _46 => _46.enabled]) && agent.llmsTxt.full ? ["/llms-full.txt"] : [],
440
440
  ..._optionalChain([agent, 'access', _47 => _47.sitemap, 'optionalAccess', _48 => _48.enabled]) ? ["/sitemap.xml"] : [],
@@ -1,5 +1,7 @@
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
+
4
+
3
5
  var _chunkO32QPFVVcjs = require('./chunk-O32QPFVV.cjs');
4
6
 
5
7
 
@@ -14,10 +16,6 @@ var _chunkLRB5OVRTcjs = require('./chunk-LRB5OVRT.cjs');
14
16
  var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
15
17
 
16
18
 
17
- var _chunkOWQV6MLMcjs = require('./chunk-OWQV6MLM.cjs');
18
-
19
-
20
-
21
19
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
22
20
 
23
21
  // src/agent-mcp.ts
@@ -114,8 +112,7 @@ function collectFarmDefaultMCPPages(sources, options) {
114
112
  if (!_chunkC2JOS77Zcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, source.pattern)) continue;
115
113
  readable.push({ pattern: source.pattern, metadata: _optionalChain([module, 'optionalAccess', _2 => _2.metadata]) });
116
114
  }
117
- const i18n = resolveFarmDefaultMCPI18n(options.i18n, options.basePath);
118
- const toPublicPath = (pathname) => i18n ? _chunkOWQV6MLMcjs.localizeFarmPathname.call(void 0, pathname, i18n.defaultLocale, i18n) : _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, pathname, options.basePath);
115
+ const base = _chunkO32QPFVVcjs.resolveFarmAgentOrigin.call(void 0, options.metadataBase, options.origin);
119
116
  return _chunkO32QPFVVcjs.collectFarmLlmsTxtPages.call(void 0, readable, {
120
117
  origin: options.origin,
121
118
  basePath: options.basePath,
@@ -124,13 +121,16 @@ function collectFarmDefaultMCPPages(sources, options) {
124
121
  path: page.path,
125
122
  title: page.title,
126
123
  // As the sitemap lists it: '/base' without trailingSlash ('/base/' redirects there).
127
- url: `${options.origin}${_chunkDVJM55D2cjs.normalizeFarmTrailingSlashPathname.call(void 0,
128
- toPublicPath(page.path),
124
+ url: `${base}${_chunkDVJM55D2cjs.normalizeFarmTrailingSlashPathname.call(void 0,
125
+ _chunkO32QPFVVcjs.getFarmAgentPagePublicPath.call(void 0, page.path, options),
129
126
  options.trailingSlash === true
130
127
  )}`,
131
128
  ...page.description ? { description: page.description } : {},
132
129
  // A mirror keeps its .md URL whatever trailingSlash says, as llms.txt links it.
133
- markdownUrl: `${options.origin}${toPublicPath(_chunkC2JOS77Zcjs.getFarmMarkdownMirrorPath.call(void 0, page.path))}`
130
+ markdownUrl: `${options.origin}${_chunkO32QPFVVcjs.getFarmAgentPagePublicPath.call(void 0,
131
+ _chunkC2JOS77Zcjs.getFarmMarkdownMirrorPath.call(void 0, page.path),
132
+ options
133
+ )}`
134
134
  }));
135
135
  }
136
136
  function resolveFarmDefaultMCPI18n(i18n, basePath) {
@@ -17,7 +17,7 @@ var _chunkNAXKOTPPcjs = require('./chunk-NAXKOTPP.cjs');
17
17
  var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
18
18
 
19
19
 
20
- var _chunkXYVPTTUTcjs = require('./chunk-XYVPTTUT.cjs');
20
+ var _chunkKEB7AGS6cjs = require('./chunk-KEB7AGS6.cjs');
21
21
 
22
22
 
23
23
 
@@ -590,7 +590,7 @@ async function resolveAPIContext(options) {
590
590
  config: options.config,
591
591
  configPath: options.configPath
592
592
  }));
593
- const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkXYVPTTUTcjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
593
+ const docs = isResolvedDocsConfig(docsInput) ? docsInput : await _chunkKEB7AGS6cjs.resolveDocsConfig.call(void 0, docsInput, { root, srcDir });
594
594
  const guardedPaths = new Set(_nullishCoalesce(_optionalChain([runtimeConfig, 'optionalAccess', _28 => _28.guardedPaths]), () => ( [])));
595
595
  return {
596
596
  root,