@farm.js/core 0.1.40 → 0.1.42
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.
- package/dist/{agent-mcp-DRlXq3lM.d.ts → agent-mcp-SSD6L3VZ.d.ts} +8 -2
- package/dist/{agent-mcp-XNF4JqHw.d.mts → agent-mcp-ssVy_tea.d.mts} +8 -2
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +8 -8
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/route-manager.mjs +7 -7
- package/dist/api/runtime.cjs +6 -6
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api/runtime.mjs +5 -5
- package/dist/api.cjs +10 -10
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/api.mjs +9 -9
- package/dist/{app-CWjCklhF.d.mts → app-1h3lVT4a.d.mts} +5 -5
- package/dist/{app-CDJHPqZn.d.ts → app-KjFzdCqy.d.ts} +5 -5
- package/dist/app-manifest-D3RkVNuS.d.mts +120 -0
- package/dist/app-manifest-DaW8-tvX.d.ts +120 -0
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/cache.cjs +3 -3
- package/dist/cache.mjs +2 -2
- package/dist/{chunk-UM3ZV5EP.mjs → chunk-24SP5TGU.mjs} +1 -1
- package/dist/{chunk-B6IMBBOS.cjs → chunk-25LPIZSX.cjs} +3 -3
- package/dist/{chunk-WW374SGU.mjs → chunk-26RUNDIR.mjs} +1 -1
- package/dist/{chunk-B77AUCBV.cjs → chunk-2FUIT2G2.cjs} +3 -3
- package/dist/{chunk-IMQO6ZUU.mjs → chunk-2JZHQDUY.mjs} +2 -2
- package/dist/{chunk-BPGO2IEP.mjs → chunk-35WS7P2V.mjs} +24 -126
- package/dist/{chunk-XKIUHXHW.mjs → chunk-375K2ZVU.mjs} +46 -52
- package/dist/{chunk-MNUSIXGS.mjs → chunk-4KQDHTWX.mjs} +1 -1
- package/dist/{chunk-DATEWH3W.cjs → chunk-6IZWX6ES.cjs} +22 -8
- package/dist/{chunk-Y6LRPO2K.mjs → chunk-6LVRDOAW.mjs} +19 -5
- package/dist/{chunk-UMQAK3KP.cjs → chunk-6MVFHNYZ.cjs} +2 -2
- package/dist/{chunk-OLQ73ZO5.mjs → chunk-6PKXK4TY.mjs} +3 -3
- package/dist/{chunk-PYQ3ZG4Z.mjs → chunk-724JLMS4.mjs} +4 -4
- package/dist/{chunk-PNCM5MFD.mjs → chunk-7UEEHAW7.mjs} +1 -1
- package/dist/{chunk-EW4MEVLE.cjs → chunk-7YHSD3Z6.cjs} +82 -118
- package/dist/{chunk-DKU6NXRK.cjs → chunk-AHFRQMRX.cjs} +1 -1
- package/dist/{chunk-7VAJSSPG.mjs → chunk-B2GSRB3P.mjs} +1 -1
- package/dist/{chunk-JXB6DVCO.mjs → chunk-BPNRQ5BA.mjs} +1 -1
- package/dist/{chunk-FLZ4H25A.cjs → chunk-BXJ5HJTJ.cjs} +13 -12
- package/dist/{chunk-GNVEJUT5.cjs → chunk-C5KVWHIH.cjs} +21 -21
- package/dist/chunk-COABSY3U.mjs +196 -0
- package/dist/{chunk-Y2GNNXGV.cjs → chunk-D64OPY6A.cjs} +5 -5
- package/dist/{chunk-BYQVROIP.mjs → chunk-DMRPN25V.mjs} +69 -0
- package/dist/{chunk-I64GEPOB.cjs → chunk-FEYQCYT7.cjs} +3 -3
- package/dist/{chunk-AXB5P7BK.mjs → chunk-FIAPD365.mjs} +1 -1
- package/dist/{chunk-7FHZ3E6D.cjs → chunk-GB7LDGY5.cjs} +2 -2
- package/dist/{chunk-45UZKX2J.mjs → chunk-HJ64F4GS.mjs} +2 -2
- package/dist/{chunk-IRYK4Z5M.cjs → chunk-I5MG3TKE.cjs} +2 -2
- package/dist/{chunk-YR2P74F7.cjs → chunk-IFWSR7YZ.cjs} +2 -2
- package/dist/{chunk-5E65AL7P.mjs → chunk-IN6RCKLL.mjs} +5 -4
- package/dist/{chunk-CKFK3Z2V.mjs → chunk-IVQY6UTY.mjs} +1 -1
- package/dist/{chunk-3TB5QGUW.cjs → chunk-JAXDRRRC.cjs} +70 -1
- package/dist/{chunk-EORXKFLR.cjs → chunk-JEIG3EWE.cjs} +1 -1
- package/dist/{chunk-54QWHSNR.cjs → chunk-JG3MEQUH.cjs} +150 -156
- package/dist/{chunk-TFX4RTH2.mjs → chunk-JOW4HDJO.mjs} +1 -1
- package/dist/{chunk-H44XGLFU.cjs → chunk-L6A26QT5.cjs} +9 -9
- package/dist/{chunk-OZN4XL6L.cjs → chunk-LIZTLA5F.cjs} +7 -6
- package/dist/{chunk-62DY5GKS.mjs → chunk-LLUA2LSC.mjs} +2 -2
- package/dist/{chunk-LDPKAYVS.cjs → chunk-LYIZHJTK.cjs} +2 -2
- package/dist/{chunk-2DMWQWNJ.mjs → chunk-MEASUNVY.mjs} +1 -1
- package/dist/{chunk-T4II4MMW.mjs → chunk-MHHCLYXU.mjs} +1 -1
- package/dist/{chunk-SHFXCE5A.cjs → chunk-MHN4UR5U.cjs} +4 -4
- package/dist/{chunk-5JEC43MQ.cjs → chunk-MN4TQJ3W.cjs} +9 -9
- package/dist/{chunk-5XS5NCVM.cjs → chunk-MY5PZYAD.cjs} +4 -4
- package/dist/{chunk-2JG2LJDI.cjs → chunk-NBPNUQYO.cjs} +2 -2
- package/dist/{chunk-4XO5GSD6.cjs → chunk-NFG4PUPI.cjs} +2 -2
- package/dist/{chunk-Y4QVEU67.mjs → chunk-NU25TRIO.mjs} +5 -4
- package/dist/{chunk-5LL6TKII.mjs → chunk-O7USYJ4U.mjs} +1 -1
- package/dist/{chunk-VBN3UAPQ.mjs → chunk-P2UJF4SS.mjs} +1 -1
- package/dist/{chunk-T6DLMX5V.mjs → chunk-PIZXONIS.mjs} +73 -109
- package/dist/{chunk-KK22JPQM.cjs → chunk-QEILRWVV.cjs} +30 -132
- package/dist/{chunk-UXMIFB44.cjs → chunk-QIBP5EFA.cjs} +5 -5
- package/dist/{chunk-TAKG7ZCD.cjs → chunk-QKZMB7LY.cjs} +14 -14
- package/dist/{chunk-FCOLU5P6.mjs → chunk-QTEJGB5A.mjs} +39 -16
- package/dist/{chunk-QJM7A4CR.cjs → chunk-S7MTDRYA.cjs} +10 -10
- package/dist/{chunk-ACLPN56I.mjs → chunk-SGB4IW7K.mjs} +1 -1
- package/dist/{chunk-GKQL726H.cjs → chunk-TCJ4A4A2.cjs} +78 -82
- package/dist/{chunk-ZKVJYQPO.mjs → chunk-TUL355PH.mjs} +13 -17
- package/dist/{chunk-H56MQYEG.mjs → chunk-U2UC7UGP.mjs} +1 -1
- package/dist/{chunk-I63UCMXW.mjs → chunk-ULQOP5UI.mjs} +2 -2
- package/dist/{chunk-HBEBV7OZ.mjs → chunk-UQUEANTY.mjs} +1 -1
- package/dist/chunk-VHRS3MCW.cjs +196 -0
- package/dist/{chunk-WCWV25PG.mjs → chunk-VTBXE6QG.mjs} +2 -2
- package/dist/{chunk-E55H6UKH.cjs → chunk-WLHA5USH.cjs} +9 -9
- package/dist/{chunk-YJBWB6GF.mjs → chunk-WMBRZI5V.mjs} +1 -1
- package/dist/{chunk-AGR7F3LA.cjs → chunk-WROEFVNO.cjs} +3 -3
- package/dist/{chunk-CA62IQY3.cjs → chunk-WU7ZS3EM.cjs} +2 -2
- package/dist/{chunk-ZOABCQGT.mjs → chunk-X3NGFVRF.mjs} +37 -22
- package/dist/{chunk-XJAEZCT6.mjs → chunk-XUC6CFLE.mjs} +1 -1
- package/dist/{chunk-6ILGLCXF.cjs → chunk-YWCYV7QC.cjs} +8 -8
- package/dist/{chunk-T36UJS3X.mjs → chunk-YYQVGKO5.mjs} +2 -2
- package/dist/{chunk-EGCT3AHF.cjs → chunk-ZATTDMBW.cjs} +127 -104
- package/dist/{chunk-PGW7HZE2.cjs → chunk-ZS6HDNOM.cjs} +6 -6
- package/dist/{chunk-XVIEGKTT.cjs → chunk-ZTP3BJG6.cjs} +41 -26
- package/dist/{client-plugins-B_5QbNrp.d.mts → client-plugins-C9Py_50W.d.mts} +79 -7
- package/dist/{client-plugins-DgSfIWIF.d.ts → client-plugins-DIem0I0W.d.ts} +79 -7
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.cjs +5 -5
- package/dist/client.d.mts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.mjs +4 -4
- package/dist/client.react-server.mjs +2 -0
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/{devtools-ANJ7JAPQ.cjs → devtools-2RY3EKHL.cjs} +6 -6
- package/dist/{devtools-VEQQDVHE.mjs → devtools-Q3LBNUJ7.mjs} +5 -5
- package/dist/docs.cjs +8 -8
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +7 -7
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/image/server.d.mts +1 -1
- package/dist/image/server.d.ts +1 -1
- package/dist/image/sharp.d.mts +1 -1
- package/dist/image/sharp.d.ts +1 -1
- package/dist/{image-config-Duob7wER.d.ts → image-config-BpH1q5R8.d.mts} +4 -1
- package/dist/{image-config-Duob7wER.d.mts → image-config-BpH1q5R8.d.ts} +4 -1
- package/dist/image.d.mts +1 -1
- package/dist/image.d.ts +1 -1
- package/dist/index.cjs +40 -38
- package/dist/index.d.mts +16 -135
- package/dist/index.d.ts +16 -135
- package/dist/index.mjs +39 -37
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.cjs +23 -23
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +22 -22
- package/dist/internal/cli-runtime.cjs +13 -13
- package/dist/internal/cli-runtime.mjs +12 -12
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +2 -2
- package/dist/internal/compression-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/docs-precompiled-runtime.cjs +3 -3
- package/dist/internal/docs-precompiled-runtime.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +21 -13
- package/dist/internal/production-runtime.d.mts +29 -126
- package/dist/internal/production-runtime.d.ts +29 -126
- package/dist/internal/production-runtime.mjs +21 -13
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/middleware.cjs +7 -7
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/middleware.mjs +6 -6
- package/dist/navigation.cjs +4 -4
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/navigation.mjs +3 -3
- package/dist/{nitro-NFG2LBRC.mjs → nitro-KDACKNHU.mjs} +1 -1
- package/dist/{nitro-S2QABUFA.cjs → nitro-NPGU6VBT.cjs} +2 -2
- package/dist/plugin.cjs +21 -21
- package/dist/plugin.d.mts +4 -3
- package/dist/plugin.d.ts +4 -3
- package/dist/plugin.mjs +20 -20
- package/dist/{production-runtime-j_WCfuwB.d.mts → production-runtime-CHFKIgpW.d.mts} +1 -1
- package/dist/{production-runtime-DfknD3g_.d.ts → production-runtime-bjjWq-DA.d.ts} +1 -1
- package/dist/query/client.cjs +2 -2
- package/dist/query/client.mjs +3 -3
- package/dist/{render-plan-CFIhcYYS.d.ts → render-plan-B2UndB4x.d.ts} +1 -1
- package/dist/{render-plan-ChUtsymc.d.mts → render-plan-DOHg6wdO.d.mts} +1 -1
- package/dist/renderer-client.d.mts +4 -4
- package/dist/renderer-client.d.ts +4 -4
- package/dist/{request-F4HRwzSd.d.mts → request-DQcGfdgQ.d.mts} +1 -1
- package/dist/{request-RJvelT8L.d.ts → request-DVNXRQrI.d.ts} +1 -1
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-D4coJ-kw.d.ts → route-rendering-B_6fj-GG.d.ts} +1 -1
- package/dist/{route-rendering-3a4fbNyC.d.mts → route-rendering-CEX4mFn-.d.mts} +1 -1
- package/dist/{router-WLEW3Te1.d.ts → router-CHEMHm1P.d.ts} +1 -1
- package/dist/{router-DqIssGRO.d.mts → router-CKHPBKXX.d.mts} +1 -1
- package/dist/routes.cjs +4 -4
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/routes.mjs +3 -3
- package/dist/{runtime-BrNdLOq9.d.ts → runtime-Br2ZDTAv.d.ts} +1 -1
- package/dist/{runtime-CmE_j-js.d.mts → runtime-jj8TKNsy.d.mts} +1 -1
- package/dist/server-fn.cjs +4 -4
- package/dist/server-fn.mjs +3 -3
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query.cjs +5 -5
- package/dist/server-query.mjs +4 -4
- package/dist/server.cjs +46 -46
- package/dist/server.d.mts +10 -9
- package/dist/server.d.ts +10 -9
- package/dist/server.mjs +25 -25
- package/dist/{spa-router-C41zjnFl.d.mts → spa-router-BEvS9Erj.d.mts} +2 -2
- package/dist/{spa-router-D_0VXqPC.d.ts → spa-router-DmCuH5B7.d.ts} +2 -2
- package/dist/ssg-57v6cZcW.d.mts +184 -0
- package/dist/ssg-gT093ETk.d.ts +184 -0
- package/dist/testing.cjs +11 -11
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.mjs +8 -8
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-YYcWsOJp.d.ts → utils-CCTKvR-P.d.ts} +1 -1
- package/dist/{utils-BKWSe3S7.d.mts → utils-raHHQVyL.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +38 -22
- package/dist/vite.d.mts +41 -4
- package/dist/vite.d.ts +41 -4
- package/dist/vite.mjs +38 -22
- package/dist/workflows.cjs +2 -2
- package/dist/workflows.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-DAO7JGTS.mjs +0 -73
- package/dist/chunk-SYQ3MOWW.cjs +0 -73
- package/dist/programmatic-routes-client-DcoxEaLe.d.mts +0 -55
- package/dist/programmatic-routes-client-DcoxEaLe.d.ts +0 -55
- /package/dist/{chunk-MOSYH4CY.mjs → chunk-FWCGUVVL.mjs} +0 -0
- /package/dist/{chunk-4A3YUB4D.cjs → chunk-KF6VDJH7.cjs} +0 -0
|
@@ -6,10 +6,13 @@ var _chunkBMOBTMDRcjs = require('./chunk-BMOBTMDR.cjs');
|
|
|
6
6
|
var _chunkOWOUTKIJcjs = require('./chunk-OWOUTKIJ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
var _chunkJAXDRRRCcjs = require('./chunk-JAXDRRRC.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
9
12
|
var _chunkD5IHNDHIcjs = require('./chunk-D5IHNDHI.cjs');
|
|
10
13
|
|
|
11
14
|
|
|
12
|
-
var
|
|
15
|
+
var _chunk25LPIZSXcjs = require('./chunk-25LPIZSX.cjs');
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
var _chunkX3GMHKO3cjs = require('./chunk-X3GMHKO3.cjs');
|
|
@@ -42,7 +45,7 @@ var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
|
42
45
|
var _chunk5NAVKJCZcjs = require('./chunk-5NAVKJCZ.cjs');
|
|
43
46
|
|
|
44
47
|
|
|
45
|
-
var
|
|
48
|
+
var _chunkAHFRQMRXcjs = require('./chunk-AHFRQMRX.cjs');
|
|
46
49
|
|
|
47
50
|
|
|
48
51
|
var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
|
|
@@ -112,7 +115,7 @@ function routeBoundaryCoversDirectory(boundaryPattern, directory) {
|
|
|
112
115
|
_chunkS3JO3N4Hcjs.__name.call(void 0, routeBoundaryCoversDirectory, "routeBoundaryCoversDirectory");
|
|
113
116
|
|
|
114
117
|
// src/server/full-document.ts
|
|
115
|
-
var CONTENTS_WRAPPER = /^<div\b[^>]*style="display\s*:\s*contents"[^>]*>/i;
|
|
118
|
+
var CONTENTS_WRAPPER = /^<div\b[^>]*style="display\s*:\s*contents;?\s*"[^>]*>/i;
|
|
116
119
|
var HOISTED_HEAD_ELEMENT = /^(?:<(?:meta|link|base)\b[^>]*>|<title\b[^>]*>[\s\S]*?<\/title>|<script\b[^>]*\basync\b[^>]*><\/script>|<style\b[^>]*\bdata-precedence\b[^>]*>[\s\S]*?<\/style>)/i;
|
|
117
120
|
function peelDocumentPrefix(markup) {
|
|
118
121
|
let inner = markup.replace(/^\s+/, "");
|
|
@@ -348,14 +351,14 @@ function isLateRedirectTarget(url) {
|
|
|
348
351
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isLateRedirectTarget, "isLateRedirectTarget");
|
|
349
352
|
function createLateRedirectRecovery(url, nonce) {
|
|
350
353
|
if (!isLateRedirectTarget(url)) return "";
|
|
351
|
-
return
|
|
354
|
+
return _chunk25LPIZSXcjs.stampFarmCspNonce.call(void 0,
|
|
352
355
|
`<script>window.location.replace(${serializeForInlineScript(url)})</script>`,
|
|
353
356
|
nonce
|
|
354
357
|
);
|
|
355
358
|
}
|
|
356
359
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createLateRedirectRecovery, "createLateRedirectRecovery");
|
|
357
360
|
function createLateNotFoundRecovery(content, nonce) {
|
|
358
|
-
return `<template id="${TEMPLATE_ID}">${content}</template>` +
|
|
361
|
+
return `<template id="${TEMPLATE_ID}">${content}</template>` + _chunk25LPIZSXcjs.stampFarmCspNonce.call(void 0,
|
|
359
362
|
`<script>(function(){var t=document.getElementById("${TEMPLATE_ID}");var p=document.getElementById("${PAGE_CONTAINER_ID}");if(t&&p){p.replaceChildren(t.content.cloneNode(true));}if(t)t.remove();document.documentElement.dataset.farmLateNotFound="true";var m=document.createElement("meta");m.name="robots";m.content="noindex";document.head.appendChild(m);})();</script>`,
|
|
360
363
|
nonce
|
|
361
364
|
);
|
|
@@ -846,7 +849,7 @@ function createFarmThemeDocumentParts(input, basePath = "/", serverTheme) {
|
|
|
846
849
|
const script = createFarmThemeBootstrapScript(config, hydrationTheme);
|
|
847
850
|
return {
|
|
848
851
|
attributes: ` data-theme="${initialTheme}"`,
|
|
849
|
-
head:
|
|
852
|
+
head: _chunk25LPIZSXcjs.stampFarmCspNonce.call(void 0,
|
|
850
853
|
`<style id="${THEME_STYLE_ID}">:root[data-theme="light"]{color-scheme:light}:root[data-theme="dark"]{color-scheme:dark}</style><script id="${THEME_SCRIPT_ID}">${script}</script>`
|
|
851
854
|
)
|
|
852
855
|
};
|
|
@@ -961,30 +964,28 @@ function isFarmAppManifestPath(pathname) {
|
|
|
961
964
|
return pathname === FARM_APP_MANIFEST_PATH || pathname === FARM_APP_MANIFEST_LEGACY_PATH;
|
|
962
965
|
}
|
|
963
966
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmAppManifestPath, "isFarmAppManifestPath");
|
|
964
|
-
var FARM_INFRA_SIGNATURE_HEADER = "farmjs-infra-signature";
|
|
965
|
-
var SIGNED_PURPOSE = "farmjs-manifest-v1";
|
|
966
|
-
var SIGNATURE_WINDOW_SECONDS = 300;
|
|
967
967
|
function resolveFarmAppManifestInput(config, extra) {
|
|
968
968
|
const llms = _optionalChain([config, 'access', _27 => _27.agent, 'optionalAccess', _28 => _28.llmsTxt]);
|
|
969
969
|
const plugins = (_nullishCoalesce(config.plugins, () => ( []))).map(({ name }) => name);
|
|
970
970
|
const webmcp = plugins.includes("farm:webmcp");
|
|
971
|
+
const sections = _chunkJAXDRRRCcjs.resolveFarmAppManifestConfig.call(void 0, _optionalChain([config, 'access', _29 => _29.agent, 'optionalAccess', _30 => _30.manifest]));
|
|
971
972
|
return {
|
|
972
|
-
renderer: _nullishCoalesce(_optionalChain([config, 'access',
|
|
973
|
+
renderer: _nullishCoalesce(_optionalChain([config, 'access', _31 => _31.renderer, 'optionalAccess', _32 => _32.name]), () => ( "react")),
|
|
973
974
|
basePath: config.basePath || "/",
|
|
974
975
|
build: extra.build,
|
|
975
976
|
packages: extra.packages,
|
|
976
977
|
webmcp: { enabled: webmcp, tools: webmcp ? _nullishCoalesce(extra.webmcpTools, () => ( [])) : [] },
|
|
977
978
|
integrations: Object.entries(_nullishCoalesce(config.integrations, () => ( {}))).flatMap(([key, integration]) => {
|
|
978
|
-
const category = _nullishCoalesce(_optionalChain([integration, 'optionalAccess',
|
|
979
|
+
const category = _nullishCoalesce(_optionalChain([integration, 'optionalAccess', _33 => _33.category]), () => ( _optionalChain([integration, 'optionalAccess', _34 => _34.slot])));
|
|
979
980
|
return integration && category && integration.type ? [{ key, category, type: integration.type }] : [];
|
|
980
981
|
}),
|
|
981
982
|
agent: {
|
|
982
|
-
apiCatalog: _optionalChain([config, 'access',
|
|
983
|
+
apiCatalog: _optionalChain([config, 'access', _35 => _35.agent, 'optionalAccess', _36 => _36.apiCatalog]) ? "/.well-known/api-catalog" : null,
|
|
983
984
|
llmsTxt: llms === true || typeof llms === "object" && llms !== null && llms.enabled !== false,
|
|
984
|
-
openapi: _optionalChain([config, 'access',
|
|
985
|
+
openapi: _optionalChain([config, 'access', _37 => _37.openapi, 'optionalAccess', _38 => _38.enabled]) && config.openapi.specRoute ? config.openapi.specRoute : null
|
|
985
986
|
},
|
|
986
987
|
plugins,
|
|
987
|
-
|
|
988
|
+
...sections ? { sections } : {}
|
|
988
989
|
};
|
|
989
990
|
}
|
|
990
991
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAppManifestInput, "resolveFarmAppManifestInput");
|
|
@@ -993,58 +994,73 @@ var SOURCES = {
|
|
|
993
994
|
standalone: "defineTool",
|
|
994
995
|
serverFunction: "serverFunction"
|
|
995
996
|
};
|
|
996
|
-
|
|
997
|
-
|
|
997
|
+
var DEFAULT_SECTIONS = _chunkJAXDRRRCcjs.resolveFarmAppManifestConfig.call(void 0, void 0);
|
|
998
|
+
function createFarmAppManifest(input) {
|
|
999
|
+
const sections = _nullishCoalesce(input.sections, () => ( DEFAULT_SECTIONS));
|
|
1000
|
+
const { app, mcp, webmcp } = sections;
|
|
1001
|
+
return {
|
|
998
1002
|
schemaVersion: 1,
|
|
999
|
-
app: {
|
|
1000
|
-
farm:
|
|
1001
|
-
renderer: input.renderer,
|
|
1003
|
+
app: app ? {
|
|
1004
|
+
...app.version ? { farm: _chunkAHFRQMRXcjs.FARM_VERSION } : {},
|
|
1005
|
+
...app.renderer ? { renderer: input.renderer } : {},
|
|
1002
1006
|
basePath: input.basePath,
|
|
1003
|
-
build: input.build
|
|
1004
|
-
},
|
|
1005
|
-
packages: input.packages,
|
|
1006
|
-
mcp: {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
authorization: open ? "none" : "required",
|
|
1015
|
-
resources: listed ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _40 => _40.resources]), () => ( []))] : [],
|
|
1016
|
-
prompts: listed ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _41 => _41.prompts]), () => ( []))] : [],
|
|
1017
|
-
tools: (listed ? tools : []).map((tool) => {
|
|
1018
|
-
const schemas = _optionalChain([details, 'optionalAccess', _42 => _42.schemas, 'optionalAccess', _43 => _43[tool.name]]);
|
|
1019
|
-
const hints = Object.fromEntries(
|
|
1020
|
-
["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"].filter((hint) => typeof tool[hint] === "boolean").map((hint) => [hint, tool[hint]])
|
|
1021
|
-
);
|
|
1022
|
-
return {
|
|
1023
|
-
name: tool.name,
|
|
1024
|
-
...tool.title ? { title: tool.title } : {},
|
|
1025
|
-
...tool.description ? { description: tool.description } : {},
|
|
1026
|
-
source: SOURCES[tool.kind],
|
|
1027
|
-
// MCP clients never see the route behind a tool; only Infra's view names it.
|
|
1028
|
-
...full && tool.kind === "endpoint" ? { method: tool.method, path: tool.path } : {},
|
|
1029
|
-
...hints,
|
|
1030
|
-
...schemas ? { inputSchema: schemas.input } : {},
|
|
1031
|
-
..._optionalChain([schemas, 'optionalAccess', _44 => _44.output]) ? { outputSchema: schemas.output } : {}
|
|
1032
|
-
};
|
|
1033
|
-
})
|
|
1034
|
-
};
|
|
1035
|
-
})
|
|
1036
|
-
},
|
|
1037
|
-
webmcp: input.webmcp,
|
|
1038
|
-
integrations: input.integrations,
|
|
1039
|
-
agent: input.agent,
|
|
1040
|
-
plugins: input.plugins
|
|
1007
|
+
...app.build ? { build: input.build } : {}
|
|
1008
|
+
} : null,
|
|
1009
|
+
packages: sections.packages === "names" ? Object.fromEntries(Object.keys(input.packages).map((name) => [name, null])) : sections.packages ? input.packages : null,
|
|
1010
|
+
mcp: mcp ? { servers: listServers(input, mcp) } : null,
|
|
1011
|
+
webmcp: webmcp ? {
|
|
1012
|
+
enabled: input.webmcp.enabled,
|
|
1013
|
+
tools: input.webmcp.tools.filter((tool) => !webmcp.hide.includes(tool.name))
|
|
1014
|
+
} : null,
|
|
1015
|
+
integrations: sections.integrations ? input.integrations : null,
|
|
1016
|
+
agent: sections.agent ? input.agent : null,
|
|
1017
|
+
plugins: sections.plugins ? input.plugins : null
|
|
1041
1018
|
};
|
|
1042
|
-
manifest.mcp.servers.push(...listDefaultServer(input));
|
|
1043
|
-
return manifest;
|
|
1044
1019
|
}
|
|
1045
1020
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmAppManifest, "createFarmAppManifest");
|
|
1021
|
+
function listServers(input, mcp) {
|
|
1022
|
+
const servers = _chunk75RZHGLScjs._listFarmMCPCatalogs.call(void 0, ).map(({ server, tools, details }) => {
|
|
1023
|
+
const open = _optionalChain([details, 'optionalAccess', _39 => _39.public]) === true && !_optionalChain([input, 'access', _40 => _40.guardCoversPath, 'optionalCall', _41 => _41(server.path)]);
|
|
1024
|
+
return {
|
|
1025
|
+
name: server.name,
|
|
1026
|
+
version: server.version,
|
|
1027
|
+
path: server.path,
|
|
1028
|
+
authorization: open ? "none" : "required",
|
|
1029
|
+
resources: open ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _42 => _42.resources]), () => ( []))] : [],
|
|
1030
|
+
prompts: open ? [..._nullishCoalesce(_optionalChain([details, 'optionalAccess', _43 => _43.prompts]), () => ( []))] : [],
|
|
1031
|
+
tools: (open ? tools : []).map((tool) => {
|
|
1032
|
+
const schemas = _optionalChain([details, 'optionalAccess', _44 => _44.schemas, 'optionalAccess', _45 => _45[tool.name]]);
|
|
1033
|
+
const hints = Object.fromEntries(
|
|
1034
|
+
["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"].filter((hint) => typeof tool[hint] === "boolean").map((hint) => [hint, tool[hint]])
|
|
1035
|
+
);
|
|
1036
|
+
return {
|
|
1037
|
+
name: tool.name,
|
|
1038
|
+
...tool.title ? { title: tool.title } : {},
|
|
1039
|
+
...tool.description ? { description: tool.description } : {},
|
|
1040
|
+
source: SOURCES[tool.kind],
|
|
1041
|
+
...hints,
|
|
1042
|
+
...schemas ? { inputSchema: schemas.input } : {},
|
|
1043
|
+
..._optionalChain([schemas, 'optionalAccess', _46 => _46.output]) ? { outputSchema: schemas.output } : {}
|
|
1044
|
+
};
|
|
1045
|
+
})
|
|
1046
|
+
};
|
|
1047
|
+
});
|
|
1048
|
+
return [...servers, ...listDefaultServer(input)].filter((server) => !mcp.hide.includes(server.name)).map((server) => ({
|
|
1049
|
+
...server,
|
|
1050
|
+
tools: server.tools.filter((tool) => !mcp.hide.includes(`${server.name}/${tool.name}`)).map((tool) => mcp.schemas ? tool : withoutSchemas(tool))
|
|
1051
|
+
}));
|
|
1052
|
+
}
|
|
1053
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, listServers, "listServers");
|
|
1054
|
+
function withoutSchemas({
|
|
1055
|
+
inputSchema: _input,
|
|
1056
|
+
outputSchema: _output,
|
|
1057
|
+
...tool
|
|
1058
|
+
}) {
|
|
1059
|
+
return tool;
|
|
1060
|
+
}
|
|
1061
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, withoutSchemas, "withoutSchemas");
|
|
1046
1062
|
function listDefaultServer(input) {
|
|
1047
|
-
const server = _optionalChain([input, 'access',
|
|
1063
|
+
const server = _optionalChain([input, 'access', _47 => _47.defaultMCP, 'optionalCall', _48 => _48()]);
|
|
1048
1064
|
if (!server) return [];
|
|
1049
1065
|
return [
|
|
1050
1066
|
{
|
|
@@ -1068,57 +1084,13 @@ function listDefaultServer(input) {
|
|
|
1068
1084
|
];
|
|
1069
1085
|
}
|
|
1070
1086
|
_chunkS3JO3N4Hcjs.__name.call(void 0, listDefaultServer, "listDefaultServer");
|
|
1071
|
-
var encoder = new TextEncoder();
|
|
1072
|
-
var hex = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (bytes) => [...new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join(""), "hex");
|
|
1073
|
-
async function sha256Hex(value) {
|
|
1074
|
-
return hex(await crypto.subtle.digest("SHA-256", encoder.encode(value)));
|
|
1075
|
-
}
|
|
1076
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, sha256Hex, "sha256Hex");
|
|
1077
|
-
async function hmacHex(secret, message) {
|
|
1078
|
-
const key = await crypto.subtle.importKey(
|
|
1079
|
-
"raw",
|
|
1080
|
-
encoder.encode(secret),
|
|
1081
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
1082
|
-
false,
|
|
1083
|
-
["sign"]
|
|
1084
|
-
);
|
|
1085
|
-
return hex(await crypto.subtle.sign("HMAC", key, encoder.encode(message)));
|
|
1086
|
-
}
|
|
1087
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, hmacHex, "hmacHex");
|
|
1088
|
-
function sameHex(a, b) {
|
|
1089
|
-
if (a.length !== b.length) return false;
|
|
1090
|
-
let difference = 0;
|
|
1091
|
-
for (let index = 0; index < a.length; index++)
|
|
1092
|
-
difference |= a.charCodeAt(index) ^ b.charCodeAt(index);
|
|
1093
|
-
return difference === 0;
|
|
1094
|
-
}
|
|
1095
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, sameHex, "sameHex");
|
|
1096
|
-
async function verifyFarmInfraManifestSignature(header, key, now = Date.now()) {
|
|
1097
|
-
if (!header || header.length > 2048) return false;
|
|
1098
|
-
const parts = header.split(",").map((part) => part.trim());
|
|
1099
|
-
const timestamp = Number(
|
|
1100
|
-
_optionalChain([/^t=(\d{1,12})$/, 'access', _47 => _47.exec, 'call', _48 => _48(_nullishCoalesce(parts.find((part) => part.startsWith("t=")), () => ( ""))), 'optionalAccess', _49 => _49[1]])
|
|
1101
|
-
);
|
|
1102
|
-
if (!Number.isSafeInteger(timestamp)) return false;
|
|
1103
|
-
if (Math.abs(now / 1e3 - timestamp) > SIGNATURE_WINDOW_SECONDS) return false;
|
|
1104
|
-
const signatures = parts.filter((part) => part.startsWith("v1=")).map((part) => part.slice(3)).filter((value) => /^[0-9a-f]{64}$/.test(value));
|
|
1105
|
-
if (!signatures.length || signatures.length > 8) return false;
|
|
1106
|
-
const expected = await hmacHex(await sha256Hex(key), `${SIGNED_PURPOSE}
|
|
1107
|
-
${timestamp}`);
|
|
1108
|
-
return signatures.some((signature) => sameHex(signature, expected));
|
|
1109
|
-
}
|
|
1110
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, verifyFarmInfraManifestSignature, "verifyFarmInfraManifestSignature");
|
|
1111
|
-
function processEnv() {
|
|
1112
|
-
return _nullishCoalesce(_optionalChain([globalThis, 'access', _50 => _50.process, 'optionalAccess', _51 => _51.env]), () => ( {}));
|
|
1113
|
-
}
|
|
1114
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, processEnv, "processEnv");
|
|
1115
1087
|
var CORS_HEADERS = {
|
|
1116
1088
|
"access-control-allow-origin": "*",
|
|
1117
1089
|
"access-control-allow-methods": "GET, HEAD, OPTIONS",
|
|
1118
|
-
"access-control-allow-headers":
|
|
1090
|
+
"access-control-allow-headers": "If-None-Match",
|
|
1119
1091
|
"access-control-expose-headers": "ETag"
|
|
1120
1092
|
};
|
|
1121
|
-
async function createFarmAppManifestResponse(request, input
|
|
1093
|
+
async function createFarmAppManifestResponse(request, input) {
|
|
1122
1094
|
const method = request.method.toUpperCase();
|
|
1123
1095
|
if (method === "OPTIONS") return new Response(null, { status: 204, headers: CORS_HEADERS });
|
|
1124
1096
|
if (method !== "GET" && method !== "HEAD") {
|
|
@@ -1127,23 +1099,16 @@ async function createFarmAppManifestResponse(request, input, options = {}) {
|
|
|
1127
1099
|
headers: { ...CORS_HEADERS, allow: "GET, HEAD, OPTIONS", "content-type": "text/plain" }
|
|
1128
1100
|
});
|
|
1129
1101
|
}
|
|
1130
|
-
const
|
|
1131
|
-
const key = input.analytics ? _optionalChain([(_nullishCoalesce(options.env, () => ( processEnv()))), 'access', _52 => _52.FARMJS_API_KEY, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()]) : void 0;
|
|
1132
|
-
const full = Boolean(
|
|
1133
|
-
signature && key && await verifyFarmInfraManifestSignature(signature, key)
|
|
1134
|
-
);
|
|
1135
|
-
const body = JSON.stringify(createFarmAppManifest(input, { full }));
|
|
1102
|
+
const body = JSON.stringify(createFarmAppManifest(input));
|
|
1136
1103
|
const etag = _chunk5NAVKJCZcjs.createFarmWeakETag.call(void 0, body);
|
|
1137
1104
|
const headers = {
|
|
1138
1105
|
...CORS_HEADERS,
|
|
1139
1106
|
"content-type": "application/json; charset=utf-8",
|
|
1140
|
-
|
|
1141
|
-
"cache-control": full ? "private, no-store" : "public, max-age=0, must-revalidate",
|
|
1142
|
-
vary: FARM_INFRA_SIGNATURE_HEADER,
|
|
1107
|
+
"cache-control": "public, max-age=0, must-revalidate",
|
|
1143
1108
|
etag,
|
|
1144
1109
|
"x-content-type-options": "nosniff"
|
|
1145
1110
|
};
|
|
1146
|
-
if (
|
|
1111
|
+
if (_chunk5NAVKJCZcjs.matchesFarmIfNoneMatch.call(void 0, request.headers.get("if-none-match"), etag)) {
|
|
1147
1112
|
return new Response(null, { status: 304, headers });
|
|
1148
1113
|
}
|
|
1149
1114
|
return new Response(method === "HEAD" ? null : body, { status: 200, headers });
|
|
@@ -1188,5 +1153,4 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmAppManifestResponse, "createFarm
|
|
|
1188
1153
|
|
|
1189
1154
|
|
|
1190
1155
|
|
|
1191
|
-
|
|
1192
|
-
exports.formatRouteSegment = formatRouteSegment; exports.createRouteDirectoryPattern = createRouteDirectoryPattern; exports.stripRouteGroups = stripRouteGroups; exports.getRouteGroupScope = getRouteGroupScope; exports.isInRouteGroupScope = isInRouteGroupScope; exports.getRouteDirectoryDepth = getRouteDirectoryDepth; exports.routeBoundaryCoversDirectory = routeBoundaryCoversDirectory; exports.HOISTED_HEAD_ELEMENT = HOISTED_HEAD_ELEMENT; exports.extractFarmFullDocument = extractFarmFullDocument; exports.classifyFarmDocumentPrefix = classifyFarmDocumentPrefix; exports.removeFarmDocumentTitles = removeFarmDocumentTitles; exports.ensureFarmDocumentMeta = ensureFarmDocumentMeta; exports.composeFarmFullDocument = composeFarmFullDocument; exports.hasFarmMiddlewareConfig = hasFarmMiddlewareConfig; exports.configMiddlewareMayHandlePath = configMiddlewareMayHandlePath; exports.appMiddlewareMayHandlePath = appMiddlewareMayHandlePath; exports.farmPathGuardCoversPage = farmPathGuardCoversPage; exports.farmPathGuardCoversEndpoint = farmPathGuardCoversEndpoint; exports.renderFarmLocaleAlternateLinks = renderFarmLocaleAlternateLinks; exports.createLateRedirectRecovery = createLateRedirectRecovery; exports.createLateNotFoundRecovery = createLateNotFoundRecovery; exports.createFarmMetadataRouteResponse = createFarmMetadataRouteResponse; exports.listFarmMCPLlmsTxtLinks = listFarmMCPLlmsTxtLinks; exports.createFarmAiCatalogResponse = createFarmAiCatalogResponse; exports.resolveDefaultErrorStatus = resolveDefaultErrorStatus; exports.getDefaultErrorStatusText = getDefaultErrorStatusText; exports.createDefaultErrorMarkup = createDefaultErrorMarkup; exports.createFarmThemeDocumentParts = createFarmThemeDocumentParts; exports.applyFarmThemeDocument = applyFarmThemeDocument; exports.FARM_API_CATALOG_PATH = FARM_API_CATALOG_PATH; exports.resolveFarmApiCatalogInput = resolveFarmApiCatalogInput; exports.createFarmApiCatalogResponse = createFarmApiCatalogResponse; exports.FARM_APP_MANIFEST_PATH = FARM_APP_MANIFEST_PATH; exports.FARM_APP_MANIFEST_LEGACY_PATH = FARM_APP_MANIFEST_LEGACY_PATH; exports.isFarmAppManifestPath = isFarmAppManifestPath; exports.FARM_INFRA_SIGNATURE_HEADER = FARM_INFRA_SIGNATURE_HEADER; exports.resolveFarmAppManifestInput = resolveFarmAppManifestInput; exports.createFarmAppManifestResponse = createFarmAppManifestResponse;
|
|
1156
|
+
exports.formatRouteSegment = formatRouteSegment; exports.createRouteDirectoryPattern = createRouteDirectoryPattern; exports.stripRouteGroups = stripRouteGroups; exports.getRouteGroupScope = getRouteGroupScope; exports.isInRouteGroupScope = isInRouteGroupScope; exports.getRouteDirectoryDepth = getRouteDirectoryDepth; exports.routeBoundaryCoversDirectory = routeBoundaryCoversDirectory; exports.HOISTED_HEAD_ELEMENT = HOISTED_HEAD_ELEMENT; exports.extractFarmFullDocument = extractFarmFullDocument; exports.classifyFarmDocumentPrefix = classifyFarmDocumentPrefix; exports.removeFarmDocumentTitles = removeFarmDocumentTitles; exports.ensureFarmDocumentMeta = ensureFarmDocumentMeta; exports.composeFarmFullDocument = composeFarmFullDocument; exports.hasFarmMiddlewareConfig = hasFarmMiddlewareConfig; exports.configMiddlewareMayHandlePath = configMiddlewareMayHandlePath; exports.appMiddlewareMayHandlePath = appMiddlewareMayHandlePath; exports.farmPathGuardCoversPage = farmPathGuardCoversPage; exports.farmPathGuardCoversEndpoint = farmPathGuardCoversEndpoint; exports.renderFarmLocaleAlternateLinks = renderFarmLocaleAlternateLinks; exports.createLateRedirectRecovery = createLateRedirectRecovery; exports.createLateNotFoundRecovery = createLateNotFoundRecovery; exports.createFarmMetadataRouteResponse = createFarmMetadataRouteResponse; exports.listFarmMCPLlmsTxtLinks = listFarmMCPLlmsTxtLinks; exports.createFarmAiCatalogResponse = createFarmAiCatalogResponse; exports.resolveDefaultErrorStatus = resolveDefaultErrorStatus; exports.getDefaultErrorStatusText = getDefaultErrorStatusText; exports.createDefaultErrorMarkup = createDefaultErrorMarkup; exports.createFarmThemeDocumentParts = createFarmThemeDocumentParts; exports.applyFarmThemeDocument = applyFarmThemeDocument; exports.FARM_API_CATALOG_PATH = FARM_API_CATALOG_PATH; exports.resolveFarmApiCatalogInput = resolveFarmApiCatalogInput; exports.createFarmApiCatalogResponse = createFarmApiCatalogResponse; exports.FARM_APP_MANIFEST_PATH = FARM_APP_MANIFEST_PATH; exports.FARM_APP_MANIFEST_LEGACY_PATH = FARM_APP_MANIFEST_LEGACY_PATH; exports.isFarmAppManifestPath = isFarmAppManifestPath; exports.resolveFarmAppManifestInput = resolveFarmAppManifestInput; exports.createFarmAppManifestResponse = createFarmAppManifestResponse;
|
|
@@ -446,7 +446,7 @@ export default defineTask({
|
|
|
446
446
|
__name(createNitroTaskWrapper, "createNitroTaskWrapper");
|
|
447
447
|
function createNitroWorkflowHTTPHandler(config, workflows, server) {
|
|
448
448
|
return `
|
|
449
|
-
import { H3 } from "h3";
|
|
449
|
+
import { H3 } from "nitro/h3";
|
|
450
450
|
import { runTask } from "nitro/task";
|
|
451
451
|
import {
|
|
452
452
|
createFarmRequestBodyErrorResponse,
|
|
@@ -24,7 +24,8 @@ var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
var _chunkJAXDRRRCcjs = require('./chunk-JAXDRRRC.cjs');
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
var _chunkD5IHNDHIcjs = require('./chunk-D5IHNDHI.cjs');
|
|
@@ -32,7 +33,7 @@ var _chunkD5IHNDHIcjs = require('./chunk-D5IHNDHI.cjs');
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
var
|
|
36
|
+
var _chunk25LPIZSXcjs = require('./chunk-25LPIZSX.cjs');
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
|
|
@@ -61,7 +62,7 @@ var _chunkD4ROBNTKcjs = require('./chunk-D4ROBNTK.cjs');
|
|
|
61
62
|
var _chunkUYIHRDE4cjs = require('./chunk-UYIHRDE4.cjs');
|
|
62
63
|
|
|
63
64
|
|
|
64
|
-
var
|
|
65
|
+
var _chunkJEIG3EWEcjs = require('./chunk-JEIG3EWE.cjs');
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
|
|
@@ -145,16 +146,16 @@ function resolveFarmAgentConfig(input, context = {}) {
|
|
|
145
146
|
const jsonLd = _optionalChain([input, 'optionalAccess', _ => _.jsonLd]);
|
|
146
147
|
return {
|
|
147
148
|
jsonLd: jsonLd === void 0 ? { ...DEFAULT_JSON_LD } : !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
148
|
-
noindexPreviews:
|
|
149
|
+
noindexPreviews: _chunkJAXDRRRCcjs.resolveFarmNoindexPreviews.call(void 0, _optionalChain([input, 'optionalAccess', _2 => _2.noindexPreviews])),
|
|
149
150
|
// The docs engine answers /llms.txt with its own pages; a default here would replace it.
|
|
150
151
|
// llms-full.txt renders every listed page, so it stays opt-in.
|
|
151
152
|
llmsTxt: _chunkD5IHNDHIcjs.resolveFarmLlmsTxtConfig.call(void 0, _nullishCoalesce(_optionalChain([input, 'optionalAccess', _3 => _3.llmsTxt]), () => ( (context.docs ? false : { full: false })))),
|
|
152
153
|
// Same rule as llms.txt: the docs engine answers /sitemap.xml with its own pages.
|
|
153
|
-
sitemap:
|
|
154
|
-
crawlers:
|
|
154
|
+
sitemap: _chunkJAXDRRRCcjs.resolveFarmAgentSitemap.call(void 0, _nullishCoalesce(_optionalChain([input, 'optionalAccess', _4 => _4.sitemap]), () => ( !context.docs))),
|
|
155
|
+
crawlers: _chunkJAXDRRRCcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([input, 'optionalAccess', _5 => _5.crawlers])),
|
|
155
156
|
apiCatalog: resolveFarmAgentBoolean(_optionalChain([input, 'optionalAccess', _6 => _6.apiCatalog]), "apiCatalog", false),
|
|
156
157
|
aiCatalog: resolveFarmAgentBoolean(_optionalChain([input, 'optionalAccess', _7 => _7.aiCatalog]), "aiCatalog", true),
|
|
157
|
-
manifest:
|
|
158
|
+
manifest: _chunkJAXDRRRCcjs.resolveFarmAppManifestConfig.call(void 0, _optionalChain([input, 'optionalAccess', _8 => _8.manifest])),
|
|
158
159
|
// Same rule as llms.txt: the docs engine serves its own MCP server at /mcp.
|
|
159
160
|
mcp: resolveFarmAgentBoolean(_optionalChain([input, 'optionalAccess', _9 => _9.mcp]), "mcp", !context.docs)
|
|
160
161
|
};
|
|
@@ -711,9 +712,9 @@ async function resolveConfig(userConfig, mode) {
|
|
|
711
712
|
const routeRules = _chunkQ5B3KJBPcjs.normalizeRouteRules.call(void 0, userConfig.routeRules);
|
|
712
713
|
const routeRuleRedirects = _chunkQ5B3KJBPcjs.routeRulesToRedirects.call(void 0, routeRules);
|
|
713
714
|
const routeRuleHeaders = _chunkQ5B3KJBPcjs.routeRulesToHeaders.call(void 0, routeRules);
|
|
714
|
-
const security =
|
|
715
|
-
const securityHeader =
|
|
716
|
-
if (
|
|
715
|
+
const security = _chunk25LPIZSXcjs.resolveFarmSecurityConfig.call(void 0, userConfig.security);
|
|
716
|
+
const securityHeader = _chunk25LPIZSXcjs.getFarmSecurityHeader.call(void 0, security);
|
|
717
|
+
if (_chunk25LPIZSXcjs.farmCspBlocksFrameworkInlineScripts.call(void 0, security)) {
|
|
717
718
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
718
719
|
"security.csp blocks the inline scripts Farm injects for theming and hydration. Set security.csp.nonce to true for managed dynamic nonces and prerendered hashes, or make the governing script directive allow 'unsafe-inline' without a nonce, hash, or 'strict-dynamic' source."
|
|
719
720
|
);
|
|
@@ -778,7 +779,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
778
779
|
mdx,
|
|
779
780
|
migrations: resolveMigrationsConfig(userConfig.migrations),
|
|
780
781
|
cron: _chunk6EXBPJ24cjs.resolveCronConfig.call(void 0, userConfig.cron),
|
|
781
|
-
workflows:
|
|
782
|
+
workflows: _chunkJEIG3EWEcjs.resolveWorkflowsConfig.call(void 0, userConfig.workflows),
|
|
782
783
|
api,
|
|
783
784
|
observability: _nullishCoalesce(userConfig.observability, () => ( false)),
|
|
784
785
|
telemetry: userConfig.telemetry !== false,
|
|
@@ -814,7 +815,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
814
815
|
], "headers"),
|
|
815
816
|
routeRules,
|
|
816
817
|
images: _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, userConfig.images),
|
|
817
|
-
performance:
|
|
818
|
+
performance: _chunkJAXDRRRCcjs.resolveFarmPerformanceConfig.call(void 0, userConfig.performance),
|
|
818
819
|
theme: _chunkOI6CMLWXcjs.resolveFarmThemeConfig.call(void 0, userConfig.theme, basePath),
|
|
819
820
|
publicDir: userConfig.publicDir || "public",
|
|
820
821
|
i18n: _chunkHLJ6MBUZcjs.resolveFarmI18nConfig.call(void 0, userConfig.i18n, { root, mode, basePath }),
|
|
@@ -9,10 +9,10 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
|
|
|
9
9
|
var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkS7MTDRYAcjs = require('./chunk-S7MTDRYA.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkKF6VDJH7cjs = require('./chunk-KF6VDJH7.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
|
|
@@ -23,7 +23,7 @@ var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunkQIBP5EFAcjs = require('./chunk-QIBP5EFA.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
var _chunkCGVPXIRNcjs = require('./chunk-CGVPXIRN.cjs');
|
|
@@ -47,7 +47,7 @@ var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
|
|
|
47
47
|
var _chunk5NAVKJCZcjs = require('./chunk-5NAVKJCZ.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkZTP3BJG6cjs = require('./chunk-ZTP3BJG6.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
@@ -114,7 +114,7 @@ function farmApiPlugin(options = {}) {
|
|
|
114
114
|
const existing = apiRoutesCache.get(routePath);
|
|
115
115
|
const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
|
|
116
116
|
if (existingFile) {
|
|
117
|
-
throw new (0,
|
|
117
|
+
throw new (0, _chunkS7MTDRYAcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
|
|
118
118
|
}
|
|
119
119
|
if (existing) {
|
|
120
120
|
if (!existing.methods.includes(normalizedMethod)) {
|
|
@@ -190,7 +190,7 @@ function farmApiPlugin(options = {}) {
|
|
|
190
190
|
const createRouter = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
191
191
|
const plugins = options.plugins ? await (_nullishCoalesce(routePlugins, () => ( (routePlugins = Promise.resolve(options.plugins({ root: projectRoot })))))) : [];
|
|
192
192
|
pluginMergedRoutes = plugins.length ? new Map(
|
|
193
|
-
|
|
193
|
+
_chunkQIBP5EFAcjs.mergePluginAPIRoutes.call(void 0, [...apiRoutesCache.values()], plugins, void 0, {
|
|
194
194
|
bodySizeLimit,
|
|
195
195
|
// A plugin calling an app endpoint (an MCP tool, say) goes back through this server,
|
|
196
196
|
// so the middleware that guards the endpoint's path runs for it.
|
|
@@ -210,7 +210,7 @@ function farmApiPlugin(options = {}) {
|
|
|
210
210
|
const url = new URL(request.url);
|
|
211
211
|
const method = request.method.toUpperCase();
|
|
212
212
|
const pathname = url.pathname;
|
|
213
|
-
const match =
|
|
213
|
+
const match = _chunkQIBP5EFAcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath);
|
|
214
214
|
if (!match) {
|
|
215
215
|
return new Response(JSON.stringify({ error: "Not Found" }), {
|
|
216
216
|
status: 404,
|
|
@@ -218,18 +218,18 @@ function farmApiPlugin(options = {}) {
|
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
const { route, params } = match;
|
|
221
|
-
const endpoint =
|
|
221
|
+
const endpoint = _chunkQIBP5EFAcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
|
|
222
222
|
if (!endpoint) {
|
|
223
223
|
return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
|
|
224
224
|
status: 405,
|
|
225
225
|
headers: {
|
|
226
|
-
Allow:
|
|
226
|
+
Allow: _chunkQIBP5EFAcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
|
|
227
227
|
"Content-Type": "application/json"
|
|
228
228
|
}
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
try {
|
|
232
|
-
return await
|
|
232
|
+
return await _chunkQIBP5EFAcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, bodySizeLimit);
|
|
233
233
|
} catch (error) {
|
|
234
234
|
return new Response(JSON.stringify({ error: error.message || "Internal Server Error" }), {
|
|
235
235
|
status: 500,
|
|
@@ -278,7 +278,7 @@ function farmApiPlugin(options = {}) {
|
|
|
278
278
|
const routeModule = await _chunkPJ42JESYcjs.loadFarmDevModule.call(void 0, server, filePath);
|
|
279
279
|
const endpoints = {};
|
|
280
280
|
const availableMethods = [];
|
|
281
|
-
for (const method of
|
|
281
|
+
for (const method of _chunkQIBP5EFAcjs.API_ROUTE_METHODS) {
|
|
282
282
|
if (routeModule[method]) {
|
|
283
283
|
availableMethods.push(method);
|
|
284
284
|
endpoints[method] = routeModule[method];
|
|
@@ -291,7 +291,7 @@ function farmApiPlugin(options = {}) {
|
|
|
291
291
|
log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
|
|
292
292
|
}
|
|
293
293
|
} catch (e) {
|
|
294
|
-
if (e instanceof
|
|
294
|
+
if (e instanceof _chunkS7MTDRYAcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
295
295
|
log(`API route load failed at ${filePath}: ${e.message}`);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
@@ -318,7 +318,7 @@ function farmApiPlugin(options = {}) {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
} catch (e) {
|
|
321
|
-
if (e instanceof
|
|
321
|
+
if (e instanceof _chunkS7MTDRYAcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
322
322
|
log(`Root routes.ts load failed: ${e.message}`);
|
|
323
323
|
}
|
|
324
324
|
break;
|
|
@@ -328,7 +328,7 @@ function farmApiPlugin(options = {}) {
|
|
|
328
328
|
const discoverProgrammaticRoutes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
329
329
|
const path = await import("path");
|
|
330
330
|
const srcRoot = path.join(server.config.root, srcDir);
|
|
331
|
-
const routeFiles =
|
|
331
|
+
const routeFiles = _chunkKF6VDJH7cjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot);
|
|
332
332
|
if (routeFiles.length === 0) return;
|
|
333
333
|
const { getProgrammaticRouteManifest } = await import("./routes.cjs");
|
|
334
334
|
for (const routeFile of routeFiles) {
|
|
@@ -349,7 +349,7 @@ function farmApiPlugin(options = {}) {
|
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
} catch (e) {
|
|
352
|
-
if (e instanceof
|
|
352
|
+
if (e instanceof _chunkS7MTDRYAcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
353
353
|
log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
@@ -401,7 +401,7 @@ function farmApiPlugin(options = {}) {
|
|
|
401
401
|
const pathname = url.split("?")[0];
|
|
402
402
|
const method = req.method || "GET";
|
|
403
403
|
if (discoveryPromise) await waitForDiscovery();
|
|
404
|
-
if (!
|
|
404
|
+
if (!_chunkQIBP5EFAcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath)) {
|
|
405
405
|
return next();
|
|
406
406
|
}
|
|
407
407
|
if (!apiRouterHandler) {
|
|
@@ -422,10 +422,10 @@ function farmApiPlugin(options = {}) {
|
|
|
422
422
|
}
|
|
423
423
|
const currentUrl = req.url || url;
|
|
424
424
|
const currentPathname = currentUrl.split("?")[0];
|
|
425
|
-
if (currentPathname !== pathname && !
|
|
425
|
+
if (currentPathname !== pathname && !_chunkQIBP5EFAcjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), currentPathname, basePath)) {
|
|
426
426
|
return next();
|
|
427
427
|
}
|
|
428
|
-
const fullUrl =
|
|
428
|
+
const fullUrl = _chunkZTP3BJG6cjs.resolveFarmRequestURL.call(void 0, req);
|
|
429
429
|
const headers = new Headers();
|
|
430
430
|
for (const [key, value] of Object.entries(req.headers)) {
|
|
431
431
|
if (value) {
|
|
@@ -526,7 +526,7 @@ function farmApiPlugin(options = {}) {
|
|
|
526
526
|
log(`API router recreated`);
|
|
527
527
|
} catch (e) {
|
|
528
528
|
restoreRouteState(previousState);
|
|
529
|
-
if (e instanceof
|
|
529
|
+
if (e instanceof _chunkS7MTDRYAcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
530
530
|
log(`Root routes.ts HMR failed: ${e.message}`);
|
|
531
531
|
}
|
|
532
532
|
return [];
|
|
@@ -554,7 +554,7 @@ function farmApiPlugin(options = {}) {
|
|
|
554
554
|
const routeModule = await _chunkPJ42JESYcjs.loadFarmDevModule.call(void 0, server, file);
|
|
555
555
|
removeEndpointsFromFile(file);
|
|
556
556
|
const availableMethods = [];
|
|
557
|
-
for (const method of
|
|
557
|
+
for (const method of _chunkQIBP5EFAcjs.API_ROUTE_METHODS) {
|
|
558
558
|
if (!routeModule[method]) continue;
|
|
559
559
|
availableMethods.push(method);
|
|
560
560
|
addEndpoint(routePath, file, method, routeModule[method]);
|
|
@@ -564,7 +564,7 @@ function farmApiPlugin(options = {}) {
|
|
|
564
564
|
log(`API router recreated`);
|
|
565
565
|
} catch (e) {
|
|
566
566
|
restoreRouteState(previousState);
|
|
567
|
-
if (e instanceof
|
|
567
|
+
if (e instanceof _chunkS7MTDRYAcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
568
568
|
log(`API route HMR failed: ${e.message}`);
|
|
569
569
|
}
|
|
570
570
|
return [];
|