@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
|
@@ -4,12 +4,15 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_ERROR_STYLES
|
|
6
6
|
} from "./chunk-XAXTTBUT.mjs";
|
|
7
|
+
import {
|
|
8
|
+
resolveFarmAppManifestConfig
|
|
9
|
+
} from "./chunk-DMRPN25V.mjs";
|
|
7
10
|
import {
|
|
8
11
|
serializeFarmLlmsTxt
|
|
9
12
|
} from "./chunk-ETPEZLS3.mjs";
|
|
10
13
|
import {
|
|
11
14
|
stampFarmCspNonce
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7UEEHAW7.mjs";
|
|
13
16
|
import {
|
|
14
17
|
emitFarmAgentRead
|
|
15
18
|
} from "./chunk-KYN5ODF6.mjs";
|
|
@@ -42,7 +45,7 @@ import {
|
|
|
42
45
|
} from "./chunk-ZZGQD7A4.mjs";
|
|
43
46
|
import {
|
|
44
47
|
FARM_VERSION
|
|
45
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-U2UC7UGP.mjs";
|
|
46
49
|
import {
|
|
47
50
|
localizeFarmPathname
|
|
48
51
|
} from "./chunk-L3KT7IXV.mjs";
|
|
@@ -112,7 +115,7 @@ function routeBoundaryCoversDirectory(boundaryPattern, directory) {
|
|
|
112
115
|
__name(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+/, "");
|
|
@@ -961,13 +964,11 @@ function isFarmAppManifestPath(pathname) {
|
|
|
961
964
|
return pathname === FARM_APP_MANIFEST_PATH || pathname === FARM_APP_MANIFEST_LEGACY_PATH;
|
|
962
965
|
}
|
|
963
966
|
__name(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 = config.agent?.llmsTxt;
|
|
969
969
|
const plugins = (config.plugins ?? []).map(({ name }) => name);
|
|
970
970
|
const webmcp = plugins.includes("farm:webmcp");
|
|
971
|
+
const sections = resolveFarmAppManifestConfig(config.agent?.manifest);
|
|
971
972
|
return {
|
|
972
973
|
renderer: config.renderer?.name ?? "react",
|
|
973
974
|
basePath: config.basePath || "/",
|
|
@@ -984,7 +985,7 @@ function resolveFarmAppManifestInput(config, extra) {
|
|
|
984
985
|
openapi: config.openapi?.enabled && config.openapi.specRoute ? config.openapi.specRoute : null
|
|
985
986
|
},
|
|
986
987
|
plugins,
|
|
987
|
-
|
|
988
|
+
...sections ? { sections } : {}
|
|
988
989
|
};
|
|
989
990
|
}
|
|
990
991
|
__name(resolveFarmAppManifestInput, "resolveFarmAppManifestInput");
|
|
@@ -993,56 +994,71 @@ var SOURCES = {
|
|
|
993
994
|
standalone: "defineTool",
|
|
994
995
|
serverFunction: "serverFunction"
|
|
995
996
|
};
|
|
996
|
-
|
|
997
|
-
|
|
997
|
+
var DEFAULT_SECTIONS = resolveFarmAppManifestConfig(void 0);
|
|
998
|
+
function createFarmAppManifest(input) {
|
|
999
|
+
const sections = input.sections ?? DEFAULT_SECTIONS;
|
|
1000
|
+
const { app, mcp, webmcp } = sections;
|
|
1001
|
+
return {
|
|
998
1002
|
schemaVersion: 1,
|
|
999
|
-
app: {
|
|
1000
|
-
farm: FARM_VERSION,
|
|
1001
|
-
renderer: input.renderer,
|
|
1003
|
+
app: app ? {
|
|
1004
|
+
...app.version ? { farm: 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 ? [...details?.resources ?? []] : [],
|
|
1016
|
-
prompts: listed ? [...details?.prompts ?? []] : [],
|
|
1017
|
-
tools: (listed ? tools : []).map((tool) => {
|
|
1018
|
-
const schemas = details?.schemas?.[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
|
-
...schemas?.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
|
__name(createFarmAppManifest, "createFarmAppManifest");
|
|
1021
|
+
function listServers(input, mcp) {
|
|
1022
|
+
const servers = _listFarmMCPCatalogs().map(({ server, tools, details }) => {
|
|
1023
|
+
const open = details?.public === true && !input.guardCoversPath?.(server.path);
|
|
1024
|
+
return {
|
|
1025
|
+
name: server.name,
|
|
1026
|
+
version: server.version,
|
|
1027
|
+
path: server.path,
|
|
1028
|
+
authorization: open ? "none" : "required",
|
|
1029
|
+
resources: open ? [...details?.resources ?? []] : [],
|
|
1030
|
+
prompts: open ? [...details?.prompts ?? []] : [],
|
|
1031
|
+
tools: (open ? tools : []).map((tool) => {
|
|
1032
|
+
const schemas = details?.schemas?.[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
|
+
...schemas?.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
|
+
__name(listServers, "listServers");
|
|
1054
|
+
function withoutSchemas({
|
|
1055
|
+
inputSchema: _input,
|
|
1056
|
+
outputSchema: _output,
|
|
1057
|
+
...tool
|
|
1058
|
+
}) {
|
|
1059
|
+
return tool;
|
|
1060
|
+
}
|
|
1061
|
+
__name(withoutSchemas, "withoutSchemas");
|
|
1046
1062
|
function listDefaultServer(input) {
|
|
1047
1063
|
const server = input.defaultMCP?.();
|
|
1048
1064
|
if (!server) return [];
|
|
@@ -1068,57 +1084,13 @@ function listDefaultServer(input) {
|
|
|
1068
1084
|
];
|
|
1069
1085
|
}
|
|
1070
1086
|
__name(listDefaultServer, "listDefaultServer");
|
|
1071
|
-
var encoder = new TextEncoder();
|
|
1072
|
-
var hex = /* @__PURE__ */ __name((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
|
-
__name(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
|
-
__name(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
|
-
__name(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
|
-
/^t=(\d{1,12})$/.exec(parts.find((part) => part.startsWith("t=")) ?? "")?.[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
|
-
__name(verifyFarmInfraManifestSignature, "verifyFarmInfraManifestSignature");
|
|
1111
|
-
function processEnv() {
|
|
1112
|
-
return globalThis.process?.env ?? {};
|
|
1113
|
-
}
|
|
1114
|
-
__name(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 ? (options.env ?? processEnv()).FARMJS_API_KEY?.trim() : 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 = createFarmWeakETag(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 (matchesFarmIfNoneMatch(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 });
|
|
@@ -1186,7 +1151,6 @@ export {
|
|
|
1186
1151
|
FARM_APP_MANIFEST_PATH,
|
|
1187
1152
|
FARM_APP_MANIFEST_LEGACY_PATH,
|
|
1188
1153
|
isFarmAppManifestPath,
|
|
1189
|
-
FARM_INFRA_SIGNATURE_HEADER,
|
|
1190
1154
|
resolveFarmAppManifestInput,
|
|
1191
1155
|
createFarmAppManifestResponse
|
|
1192
1156
|
};
|
|
@@ -9,7 +9,10 @@ var _chunk4U5XZDLGcjs = require('./chunk-4U5XZDLG.cjs');
|
|
|
9
9
|
var _chunk6D24SDKOcjs = require('./chunk-6D24SDKO.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkVHRS3MCWcjs = require('./chunk-VHRS3MCW.cjs');
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
|
|
@@ -29,13 +32,13 @@ var _chunkWBKEZXWEcjs = require('./chunk-WBKEZXWE.cjs');
|
|
|
29
32
|
var _chunkM7MKQXAFcjs = require('./chunk-M7MKQXAF.cjs');
|
|
30
33
|
|
|
31
34
|
|
|
32
|
-
var
|
|
35
|
+
var _chunkKF6VDJH7cjs = require('./chunk-KF6VDJH7.cjs');
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
var _chunkUFDAAQFXcjs = require('./chunk-UFDAAQFX.cjs');
|
|
36
39
|
|
|
37
40
|
|
|
38
|
-
var
|
|
41
|
+
var _chunkWU7ZS3EMcjs = require('./chunk-WU7ZS3EM.cjs');
|
|
39
42
|
|
|
40
43
|
|
|
41
44
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
@@ -44,10 +47,8 @@ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
|
44
47
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
45
48
|
|
|
46
49
|
// src/ssg.ts
|
|
50
|
+
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs); var fs2 = _interopRequireWildcard(_fs);
|
|
47
51
|
var _promises = require('fs/promises');
|
|
48
|
-
var OPTIONAL_CATCH_ALL_SEGMENT = /^\[\[\.\.\.([^\]]+)\]\]$/;
|
|
49
|
-
var REQUIRED_CATCH_ALL_SEGMENT = /^\[\.\.\.([^\]]+)\]$/;
|
|
50
|
-
var REQUIRED_DYNAMIC_SEGMENT = /^\[([^\]]+)\]$/;
|
|
51
52
|
var REQUEST_API_LABELS = /* @__PURE__ */ new Map([
|
|
52
53
|
["cookies", "request cookies"],
|
|
53
54
|
["headers", "request headers"],
|
|
@@ -65,7 +66,7 @@ var ROUTE_PROP_LABELS = /* @__PURE__ */ new Map([
|
|
|
65
66
|
["context", "request context"]
|
|
66
67
|
]);
|
|
67
68
|
function resolveConfiguredRouteRenderingConfig(mod, source, options) {
|
|
68
|
-
return
|
|
69
|
+
return _chunkVHRS3MCWcjs.mergeRouteRenderingDirectiveConfig.call(void 0, parseRouteRenderingDirective(source), mod, options);
|
|
69
70
|
}
|
|
70
71
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveConfiguredRouteRenderingConfig, "resolveConfiguredRouteRenderingConfig");
|
|
71
72
|
function resolveRouteRenderingConfig(mod, source, options) {
|
|
@@ -317,6 +318,17 @@ function parseRouteRenderingDirective(source) {
|
|
|
317
318
|
return void 0;
|
|
318
319
|
}
|
|
319
320
|
_chunkS3JO3N4Hcjs.__name.call(void 0, parseRouteRenderingDirective, "parseRouteRenderingDirective");
|
|
321
|
+
function readRouteRenderingDirectiveFromFile(modulePath) {
|
|
322
|
+
try {
|
|
323
|
+
const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
|
|
324
|
+
const directive = parseRouteRenderingDirective(source);
|
|
325
|
+
if (findRequestBoundSourceBlockers(source).length === 0) return directive;
|
|
326
|
+
return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
|
|
327
|
+
} catch (e) {
|
|
328
|
+
return void 0;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, readRouteRenderingDirectiveFromFile, "readRouteRenderingDirectiveFromFile");
|
|
320
332
|
function parseKnownRenderingDirective(directive) {
|
|
321
333
|
const normalized = directive.trim().toLowerCase();
|
|
322
334
|
const match = normalized.match(
|
|
@@ -454,11 +466,11 @@ async function collectSSGPages(routes, loadModule, options = {}) {
|
|
|
454
466
|
);
|
|
455
467
|
}
|
|
456
468
|
const paths = await getStaticPaths();
|
|
457
|
-
const optionalCatchAllParams = getOptionalCatchAllParameterNames(route.path);
|
|
469
|
+
const optionalCatchAllParams = _chunkVHRS3MCWcjs.getOptionalCatchAllParameterNames.call(void 0, route.path);
|
|
458
470
|
const materializedPages = paths.map((params) => ({
|
|
459
|
-
urlPath: materializeSSGRoutePath(route.path, params),
|
|
471
|
+
urlPath: _chunkVHRS3MCWcjs.materializeSSGRoutePath.call(void 0, route.path, params),
|
|
460
472
|
filePath: route.filePath,
|
|
461
|
-
params: normalizeStaticPathParams(params, optionalCatchAllParams),
|
|
473
|
+
params: _chunkVHRS3MCWcjs.normalizeStaticPathParams.call(void 0, params, optionalCatchAllParams),
|
|
462
474
|
revalidate: rendering.revalidate
|
|
463
475
|
}));
|
|
464
476
|
ssgPages.push(...materializedPages);
|
|
@@ -495,121 +507,6 @@ Add \`export const dynamic = "force-static";\` after verifying that imported cod
|
|
|
495
507
|
return { ssg: ssgPages, ssr: ssrRoutes };
|
|
496
508
|
}
|
|
497
509
|
_chunkS3JO3N4Hcjs.__name.call(void 0, collectSSGPages, "collectSSGPages");
|
|
498
|
-
function materializeSSGRoutePath(routePattern, params) {
|
|
499
|
-
const outputSegments = [];
|
|
500
|
-
for (const segment of routePattern.split("/")) {
|
|
501
|
-
if (!segment) {
|
|
502
|
-
continue;
|
|
503
|
-
}
|
|
504
|
-
const optionalCatchAll = segment.match(OPTIONAL_CATCH_ALL_SEGMENT);
|
|
505
|
-
if (optionalCatchAll) {
|
|
506
|
-
const parameterName = optionalCatchAll[1];
|
|
507
|
-
const value = params[parameterName];
|
|
508
|
-
const values = readCatchAllSegments(value, {
|
|
509
|
-
optional: true,
|
|
510
|
-
parameterName,
|
|
511
|
-
routePattern
|
|
512
|
-
});
|
|
513
|
-
outputSegments.push(...values.map(encodePathSegment));
|
|
514
|
-
continue;
|
|
515
|
-
}
|
|
516
|
-
const requiredCatchAll = segment.match(REQUIRED_CATCH_ALL_SEGMENT);
|
|
517
|
-
if (requiredCatchAll) {
|
|
518
|
-
const parameterName = requiredCatchAll[1];
|
|
519
|
-
const value = params[parameterName];
|
|
520
|
-
const values = readCatchAllSegments(value, {
|
|
521
|
-
optional: false,
|
|
522
|
-
parameterName,
|
|
523
|
-
routePattern
|
|
524
|
-
});
|
|
525
|
-
outputSegments.push(...values.map(encodePathSegment));
|
|
526
|
-
continue;
|
|
527
|
-
}
|
|
528
|
-
const requiredDynamic = segment.match(REQUIRED_DYNAMIC_SEGMENT);
|
|
529
|
-
if (requiredDynamic) {
|
|
530
|
-
const parameterName = requiredDynamic[1];
|
|
531
|
-
const value = params[parameterName];
|
|
532
|
-
if (isStaticPathArray(value)) {
|
|
533
|
-
throw new Error(
|
|
534
|
-
`Cannot materialize SSG route "${routePattern}": parameter "${parameterName}" must be a scalar value; arrays are only supported for catch-all segments.`
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
if (isMissingPathValue(value)) {
|
|
538
|
-
throw missingRequiredParameterError(routePattern, parameterName);
|
|
539
|
-
}
|
|
540
|
-
outputSegments.push(encodePathSegment(value));
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
outputSegments.push(segment);
|
|
544
|
-
}
|
|
545
|
-
return outputSegments.length > 0 ? `/${outputSegments.join("/")}` : "/";
|
|
546
|
-
}
|
|
547
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, materializeSSGRoutePath, "materializeSSGRoutePath");
|
|
548
|
-
function readCatchAllSegments(value, options) {
|
|
549
|
-
if (isMissingPathValue(value) || isStaticPathArray(value) && value.length === 0) {
|
|
550
|
-
if (options.optional) {
|
|
551
|
-
return [];
|
|
552
|
-
}
|
|
553
|
-
throw missingRequiredParameterError(options.routePattern, options.parameterName);
|
|
554
|
-
}
|
|
555
|
-
const segments = isStaticPathArray(value) ? [...value] : [value];
|
|
556
|
-
if (segments.some(isMissingPathValue)) {
|
|
557
|
-
throw new Error(
|
|
558
|
-
`Cannot materialize SSG route "${options.routePattern}": catch-all parameter "${options.parameterName}" contains an empty path segment.`
|
|
559
|
-
);
|
|
560
|
-
}
|
|
561
|
-
return segments;
|
|
562
|
-
}
|
|
563
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, readCatchAllSegments, "readCatchAllSegments");
|
|
564
|
-
function getOptionalCatchAllParameterNames(routePattern) {
|
|
565
|
-
return new Set(
|
|
566
|
-
routePattern.split("/").map((segment) => _optionalChain([segment, 'access', _41 => _41.match, 'call', _42 => _42(OPTIONAL_CATCH_ALL_SEGMENT), 'optionalAccess', _43 => _43[1]])).filter((name) => Boolean(name))
|
|
567
|
-
);
|
|
568
|
-
}
|
|
569
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, getOptionalCatchAllParameterNames, "getOptionalCatchAllParameterNames");
|
|
570
|
-
function normalizeStaticPathParams(params, optionalCatchAllParams) {
|
|
571
|
-
const entries = Object.entries(params).map(([key, value]) => {
|
|
572
|
-
const emptyOptionalCatchAll = optionalCatchAllParams.has(key) && (isMissingPathValue(value) || isStaticPathArray(value) && value.length === 0);
|
|
573
|
-
return [
|
|
574
|
-
key,
|
|
575
|
-
emptyOptionalCatchAll ? "" : isStaticPathArray(value) ? value.map(String).join("/") : String(value)
|
|
576
|
-
];
|
|
577
|
-
});
|
|
578
|
-
for (const name of optionalCatchAllParams) {
|
|
579
|
-
if (!Object.prototype.hasOwnProperty.call(params, name)) {
|
|
580
|
-
entries.push([name, ""]);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
return Object.fromEntries(entries);
|
|
584
|
-
}
|
|
585
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeStaticPathParams, "normalizeStaticPathParams");
|
|
586
|
-
function isMissingPathValue(value) {
|
|
587
|
-
return value === "" || value === null || typeof value === "undefined";
|
|
588
|
-
}
|
|
589
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isMissingPathValue, "isMissingPathValue");
|
|
590
|
-
function isStaticPathArray(value) {
|
|
591
|
-
return Array.isArray(value);
|
|
592
|
-
}
|
|
593
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isStaticPathArray, "isStaticPathArray");
|
|
594
|
-
function missingRequiredParameterError(routePattern, parameterName) {
|
|
595
|
-
return new Error(
|
|
596
|
-
`Cannot materialize SSG route "${routePattern}": required parameter "${parameterName}" is missing or empty.`
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, missingRequiredParameterError, "missingRequiredParameterError");
|
|
600
|
-
function encodePathSegment(value) {
|
|
601
|
-
const encoded = encodeURIComponent(String(value)).replace(
|
|
602
|
-
/[!'()*]/g,
|
|
603
|
-
(character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`
|
|
604
|
-
);
|
|
605
|
-
if (encoded === "." || encoded === "..") {
|
|
606
|
-
throw new Error(
|
|
607
|
-
`Cannot materialize SSG path segment "${encoded}": dot-only segments are unsafe to prerender.`
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
return encoded;
|
|
611
|
-
}
|
|
612
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, encodePathSegment, "encodePathSegment");
|
|
613
510
|
function isSSGModule(mod) {
|
|
614
511
|
return resolveRouteRenderingConfig(mod).ssg;
|
|
615
512
|
}
|
|
@@ -647,7 +544,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, matchSSGPage, "matchSSGPage");
|
|
|
647
544
|
|
|
648
545
|
// src/routing/generate-route-types.ts
|
|
649
546
|
var _path = require('path'); var path = _interopRequireWildcard(_path); var path3 = _interopRequireWildcard(_path);
|
|
650
|
-
|
|
547
|
+
|
|
651
548
|
function routeSegmentsToTsTypeLiteral(segments) {
|
|
652
549
|
if (segments.length === 0) return '"/"';
|
|
653
550
|
const hasDynamic = segments.some((s) => s.startsWith("["));
|
|
@@ -736,7 +633,7 @@ async function createRouteTypeDeclarations(options, outPath) {
|
|
|
736
633
|
}
|
|
737
634
|
}
|
|
738
635
|
}
|
|
739
|
-
for (const route of await
|
|
636
|
+
for (const route of await _chunkKF6VDJH7cjs.discoverProgrammaticRoutePaths.call(void 0, source.root, source.srcDir)) {
|
|
740
637
|
patterns.add(route);
|
|
741
638
|
routeModulePatterns.add(route);
|
|
742
639
|
}
|
|
@@ -1061,7 +958,7 @@ function fieldTsType(field) {
|
|
|
1061
958
|
case "json":
|
|
1062
959
|
return "unknown";
|
|
1063
960
|
case "enum":
|
|
1064
|
-
return _optionalChain([field, 'access',
|
|
961
|
+
return _optionalChain([field, 'access', _41 => _41.values, 'optionalAccess', _42 => _42.length]) ? field.values.map((value) => JSON.stringify(value)).join(" | ") : "string";
|
|
1065
962
|
// id, uuid, string, text, datetime all travel as strings over JSON.
|
|
1066
963
|
default:
|
|
1067
964
|
return "string";
|
|
@@ -1088,7 +985,7 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
1088
985
|
const shouldGenerateApi = options.api !== false;
|
|
1089
986
|
const shouldGenerateEnv = options.env !== false;
|
|
1090
987
|
const shouldGenerateImages = options.images !== false;
|
|
1091
|
-
const shouldGenerateI18n = options.i18n !== false && _optionalChain([options, 'access',
|
|
988
|
+
const shouldGenerateI18n = options.i18n !== false && _optionalChain([options, 'access', _43 => _43.i18nConfig, 'optionalAccess', _44 => _44.enabled]);
|
|
1092
989
|
const sourceRoots = _chunkWBKEZXWEcjs.getFarmSourceRoots.call(void 0, { root, srcDir, layers: options.layers });
|
|
1093
990
|
const appDirs = _chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, { root, srcDir, layers: options.layers });
|
|
1094
991
|
const result = {
|
|
@@ -1132,7 +1029,7 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
1132
1029
|
const generator = new (0, _chunkXSIRSMAScjs.APITypeGenerator)(appDirs);
|
|
1133
1030
|
const apiRoutes = generator.scanAPIRoutes();
|
|
1134
1031
|
const apiTypesPath = options.apiTypesOutFile ? _path.resolve.call(void 0, root, options.apiTypesOutFile) : _path.join.call(void 0, root, srcDir, "lib", "api.generated.ts");
|
|
1135
|
-
const pluginRoutes =
|
|
1032
|
+
const pluginRoutes = _chunkWU7ZS3EMcjs.resolvePluginRoutes.call(void 0, options.plugins);
|
|
1136
1033
|
const configFiles = [
|
|
1137
1034
|
...(_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.configFile).filter((file) => Boolean(file)),
|
|
1138
1035
|
options.configPath ? _path.resolve.call(void 0, root, options.configPath) : [
|
|
@@ -1208,7 +1105,7 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
1208
1105
|
});
|
|
1209
1106
|
}
|
|
1210
1107
|
}
|
|
1211
|
-
if (shouldRefreshUnifiedTypes && _optionalChain([options, 'access',
|
|
1108
|
+
if (shouldRefreshUnifiedTypes && _optionalChain([options, 'access', _45 => _45.i18nConfig, 'optionalAccess', _46 => _46.enabled]) && !options.i18nTypesOutFile) {
|
|
1212
1109
|
const { signatures } = await _chunkUFDAAQFXcjs.readFarmI18nCatalogs.call(void 0, options.i18nConfig);
|
|
1213
1110
|
unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
|
|
1214
1111
|
result.i18nTypesPath = unifiedTypesPath;
|
|
@@ -1341,4 +1238,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, collectLegacyTypeArtifacts, "collectLegacy
|
|
|
1341
1238
|
|
|
1342
1239
|
|
|
1343
1240
|
|
|
1344
|
-
|
|
1241
|
+
|
|
1242
|
+
exports.resolveRouteRenderingConfig = resolveRouteRenderingConfig; exports.resolveRouteRenderingConfigFromFile = resolveRouteRenderingConfigFromFile; exports.analyzeStaticRouteCandidate = analyzeStaticRouteCandidate; exports.findRequestBoundSourceBlockers = findRequestBoundSourceBlockers; exports.parseRouteRenderingDirective = parseRouteRenderingDirective; exports.readRouteRenderingDirectiveFromFile = readRouteRenderingDirectiveFromFile; exports.collectSSGPages = collectSSGPages; exports.isSSGModule = isSSGModule; exports.hasISR = hasISR; exports.getRevalidateInterval = getRevalidateInterval; exports.hasPPR = hasPPR; exports.generateSSGManifest = generateSSGManifest; exports.matchSSGPage = matchSSGPage; exports.generateRouteTypes = generateRouteTypes; exports.generateFarmImageTypes = generateFarmImageTypes; exports.createFarmImageTypeDeclarations = createFarmImageTypeDeclarations; exports.generateFarmI18nTypes = generateFarmI18nTypes; exports.generateFarmTypeArtifacts = generateFarmTypeArtifacts;
|
|
@@ -1,7 +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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkWU7ZS3EMcjs = require('./chunk-WU7ZS3EM.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkWMAPPDMMcjs = require('./chunk-WMAPPDMM.cjs');
|
|
@@ -36,7 +36,7 @@ var _chunkS3A45T7Fcjs = require('./chunk-S3A45T7F.cjs');
|
|
|
36
36
|
var _chunkZEG3OPIBcjs = require('./chunk-ZEG3OPIB.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var _chunkZTP3BJG6cjs = require('./chunk-ZTP3BJG6.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -55,7 +55,7 @@ function mergePluginAPIRoutes(existing, plugins, expected, options = {}) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
const api = createPluginLocalAPI(existing, options.bodySizeLimit, options.dispatch);
|
|
58
|
-
for (const definition of
|
|
58
|
+
for (const definition of _chunkWU7ZS3EMcjs.resolvePluginRoutes.call(void 0, plugins, { api })) {
|
|
59
59
|
_chunkWMAPPDMMcjs.registerAPIRouteShape.call(void 0, shapes, definition.path, `plugin:${definition.path}`, "app");
|
|
60
60
|
let route = routes.get(definition.path);
|
|
61
61
|
if (_optionalChain([route, 'optionalAccess', _ => _.methods, 'access', _2 => _2.includes, 'call', _3 => _3(definition.method)])) {
|
|
@@ -197,7 +197,7 @@ async function invokeAPIRouteEndpoint(endpoint, request, params = {}, bodySizeLi
|
|
|
197
197
|
if (response2) return response2;
|
|
198
198
|
throw error;
|
|
199
199
|
}
|
|
200
|
-
const response = await
|
|
200
|
+
const response = await _chunkZTP3BJG6cjs._runWithCurrentRequest.call(void 0,
|
|
201
201
|
request,
|
|
202
202
|
() => invokeAPIRouteEndpointInContext(endpoint, request, params)
|
|
203
203
|
);
|
|
@@ -262,7 +262,7 @@ async function invokeAPIRouteEndpointInContext(endpoint, request, params) {
|
|
|
262
262
|
invalidations: []
|
|
263
263
|
};
|
|
264
264
|
} catch (error) {
|
|
265
|
-
if (
|
|
265
|
+
if (_chunkWU7ZS3EMcjs.isEndpointFailure.call(void 0, error)) {
|
|
266
266
|
return createEndpointFailureResponse(error);
|
|
267
267
|
}
|
|
268
268
|
throw error;
|