@farm.js/core 0.1.36 → 0.1.38
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-BVExL8rZ.d.mts → agent-mcp-BwKlpnc7.d.mts} +1 -1
- package/dist/{agent-mcp-luzfXK-P.d.ts → agent-mcp-De1imoMS.d.ts} +1 -1
- package/dist/{agent-mcp-handler-SJAHFSPI.cjs → agent-mcp-handler-MRGP3WJ3.cjs} +5 -5
- package/dist/{agent-mcp-handler-LPJ2CADR.mjs → agent-mcp-handler-OLRMZONF.mjs} +4 -4
- package/dist/agent-runtime.cjs +3 -3
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +2 -2
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +6 -6
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +5 -5
- package/dist/api/runtime.cjs +4 -4
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api/runtime.mjs +3 -3
- package/dist/api.cjs +9 -8
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +8 -7
- package/dist/{app-BukwkFIu.d.mts → app-CFZt-srr.d.mts} +21 -3
- package/dist/{app-Yfa2dsFy.d.ts → app-kT_QXTdx.d.ts} +21 -3
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +5 -3
- package/dist/{chunk-ADEA7PN3.cjs → chunk-2DD4JMQC.cjs} +113 -22
- package/dist/chunk-2ZYGC6SS.cjs +576 -0
- package/dist/{chunk-JZVADIOD.cjs → chunk-34UCJRQO.cjs} +2 -2
- package/dist/{chunk-D2BB47NB.cjs → chunk-3LOLJTFV.cjs} +6 -6
- package/dist/{chunk-KXWRO25S.cjs → chunk-472NCAZ7.cjs} +3 -3
- package/dist/chunk-4E5QXOCL.cjs +109 -0
- package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
- package/dist/{chunk-VQLJWDVW.cjs → chunk-4IE345DM.cjs} +37 -19
- package/dist/{chunk-O6WAEAX3.mjs → chunk-5BWWFHR2.mjs} +70 -15
- package/dist/{chunk-JNUWCDTF.cjs → chunk-5D2JIPLH.cjs} +2 -2
- package/dist/{chunk-BO36SELV.cjs → chunk-5OKBARDN.cjs} +2 -2
- package/dist/{chunk-AO6RYU5N.cjs → chunk-5PWXMJOH.cjs} +30 -22
- package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
- package/dist/chunk-6BK3K2GB.mjs +318 -0
- package/dist/{chunk-O6I6VWKK.mjs → chunk-6HB6V3R7.mjs} +1 -1
- package/dist/{chunk-UXFQ3UDA.cjs → chunk-6XWDE2P2.cjs} +61 -4
- package/dist/{chunk-VILIPRS6.mjs → chunk-7FPTZLKH.mjs} +1 -1
- package/dist/{chunk-SC2WYWPF.mjs → chunk-7PEP3BUT.mjs} +3 -3
- package/dist/{chunk-4E5AEDKY.mjs → chunk-A3EAIURZ.mjs} +25 -7
- package/dist/{chunk-YDQZGSDS.mjs → chunk-ARC7I3O2.mjs} +1 -1
- package/dist/{chunk-LSZAVSGY.mjs → chunk-B6G5CKMC.mjs} +101 -10
- package/dist/{chunk-3KZS4SUS.mjs → chunk-BZHXGVMA.mjs} +1 -1
- package/dist/{chunk-KN7K4VQN.mjs → chunk-CNNOLE4O.mjs} +1 -1
- package/dist/{chunk-4GLOOWKE.mjs → chunk-CQMVIOYP.mjs} +1 -1
- package/dist/{chunk-2ELDTQRN.mjs → chunk-CUM5NYL5.mjs} +1 -1
- package/dist/{chunk-HITLGIAO.cjs → chunk-CY2ZQ5C6.cjs} +7 -6
- package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
- package/dist/{chunk-QORUJDIV.mjs → chunk-DRLKAXDM.mjs} +2 -2
- package/dist/{chunk-DQQOKWYA.cjs → chunk-EIPC3FDA.cjs} +12 -4
- package/dist/{chunk-HOXTWRGB.mjs → chunk-EKF7KDFD.mjs} +5 -2
- package/dist/{chunk-42NHY7HW.cjs → chunk-EKN7NSZO.cjs} +62 -14
- package/dist/{chunk-YKX5BK66.cjs → chunk-EMO6K4YY.cjs} +7 -7
- package/dist/{chunk-6SJ2KJTA.mjs → chunk-EPYU2EBL.mjs} +1 -1
- package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
- package/dist/{chunk-PTZ2TVNE.cjs → chunk-H5CLOUZS.cjs} +5 -5
- package/dist/{chunk-DTSROJ5J.mjs → chunk-HD5CF3OE.mjs} +1 -1
- package/dist/{chunk-35GKZR22.mjs → chunk-HXRYZWTA.mjs} +1 -1
- package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
- package/dist/{chunk-MKYBIIAQ.mjs → chunk-IBUQWVYA.mjs} +17 -1
- package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
- package/dist/{chunk-W7LF2J2S.mjs → chunk-INL3THCU.mjs} +1 -1
- package/dist/{chunk-WZ77PUAM.mjs → chunk-IVLZZZEI.mjs} +1 -1
- package/dist/{chunk-ENLZ4R3Y.mjs → chunk-J7K2NZD6.mjs} +7 -6
- package/dist/{chunk-BPOF5U4N.mjs → chunk-JCKYH4LG.mjs} +10 -7
- package/dist/{chunk-77GNHH2Z.cjs → chunk-JCYYXBAJ.cjs} +3 -3
- package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
- package/dist/{chunk-ZWM5KGAA.cjs → chunk-KCQBAKIY.cjs} +23 -20
- package/dist/{chunk-OTC5BDGO.mjs → chunk-KHKLMNI5.mjs} +12 -7
- package/dist/{chunk-DZ5ZVB2K.cjs → chunk-KKSTAEMY.cjs} +1 -1
- package/dist/{chunk-N2NAS2AM.cjs → chunk-L4DD7ODZ.cjs} +2 -2
- package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
- package/dist/{chunk-OO7GXVSR.mjs → chunk-LI2F57NI.mjs} +1 -1
- package/dist/{chunk-NRSN7G7E.mjs → chunk-MLY2RP5R.mjs} +10 -2
- package/dist/{chunk-BPMATOP2.cjs → chunk-N32CC42M.cjs} +25 -20
- package/dist/{chunk-FNO7A7CM.cjs → chunk-NBBEQLOK.cjs} +34 -16
- package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
- package/dist/{chunk-GQRWBCWK.mjs → chunk-OAHTRMIC.mjs} +13 -5
- package/dist/{chunk-35WV46VL.mjs → chunk-OCIEZME4.mjs} +876 -685
- package/dist/{chunk-UH6QN5NL.mjs → chunk-P664ZVTV.mjs} +2 -2
- package/dist/{chunk-TE2G5ION.cjs → chunk-PGZDEPTM.cjs} +88 -33
- package/dist/{chunk-FDR64H6B.mjs → chunk-POSPE3IO.mjs} +59 -2
- package/dist/{chunk-UVW64BCB.cjs → chunk-Q3NXS4MU.cjs} +16 -14
- package/dist/{chunk-4WCZJQUO.mjs → chunk-QFW2IH5E.mjs} +57 -9
- package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
- package/dist/chunk-QRKIMN7T.mjs +48 -0
- package/dist/chunk-QTXBII4Z.cjs +632 -0
- package/dist/{chunk-CI6E3UOH.cjs → chunk-RG4A6LB2.cjs} +7 -7
- package/dist/{chunk-BJPBQNIE.cjs → chunk-RW63BOV7.cjs} +2 -2
- package/dist/{chunk-FO427P6I.cjs → chunk-RWFLWR5J.cjs} +10 -10
- package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
- package/dist/{chunk-EUV4YR3V.cjs → chunk-SGBJ247Q.cjs} +18 -2
- package/dist/chunk-SGBZPZUW.mjs +75 -0
- package/dist/{chunk-2NNMOPDN.mjs → chunk-SKVTP5PR.mjs} +4 -1
- package/dist/{chunk-2YTDKNH3.cjs → chunk-TGFQVLLF.cjs} +956 -765
- package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
- package/dist/{chunk-276VJSM6.mjs → chunk-TUBTR2OP.mjs} +250 -118
- package/dist/{chunk-GQ3Z3IZI.cjs → chunk-TYJALEHQ.cjs} +18 -18
- package/dist/chunk-TYMMBFN2.mjs +109 -0
- package/dist/chunk-U6QLDL3G.mjs +576 -0
- package/dist/{chunk-U4KT7QP3.cjs → chunk-ULASELLA.cjs} +26 -1
- package/dist/chunk-UXHS27O6.cjs +75 -0
- package/dist/{chunk-WWIKMBRN.mjs → chunk-VNGH5MLF.mjs} +17 -1
- package/dist/{chunk-EZDQRNQ7.mjs → chunk-VT4WFRHA.mjs} +23 -5
- package/dist/{chunk-CBJJH36A.cjs → chunk-VU6AAZVY.cjs} +20 -4
- package/dist/{chunk-27ZWSI3W.cjs → chunk-VXEEATVD.cjs} +2 -2
- package/dist/{chunk-EWET4D2Y.mjs → chunk-W36M2BQ4.mjs} +3 -3
- package/dist/{chunk-4WQ6PGSJ.cjs → chunk-WEW2JVA4.cjs} +4 -4
- package/dist/{chunk-4E5WBPEG.mjs → chunk-WFRT7JPX.mjs} +8 -533
- package/dist/{chunk-T4OGRVNS.mjs → chunk-WLL43JMO.mjs} +2 -2
- package/dist/chunk-WW46B6HA.cjs +318 -0
- package/dist/{chunk-TKSCR644.cjs → chunk-WXJLNP33.cjs} +2 -2
- package/dist/{chunk-S6VYG6XU.cjs → chunk-XKG2BLFN.cjs} +2 -2
- package/dist/{chunk-4NU4GGTC.cjs → chunk-XKVVMZP5.cjs} +6 -3
- package/dist/{chunk-NMHWYWDR.cjs → chunk-YR2VBEMO.cjs} +658 -526
- package/dist/{chunk-OHLSEQ57.mjs → chunk-ZJD2PN6Z.mjs} +10 -8
- package/dist/{chunk-3BU22U3M.cjs → chunk-ZXH4TS3F.cjs} +5 -2
- package/dist/{client-plugins-r1mOtSC1.d.ts → client-plugins-BvlNhGEB.d.ts} +54 -7
- package/dist/{client-plugins-C3mK9Pol.d.mts → client-plugins-DUrIYX9B.d.mts} +54 -7
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +8 -8
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-ERIKFEXX.mjs → devtools-JYJNOLPQ.mjs} +8 -6
- package/dist/{devtools-JZJJY5CK.cjs → devtools-VQWJANJV.cjs} +9 -7
- package/dist/docs.cjs +12 -10
- package/dist/docs.d.mts +20 -2
- package/dist/docs.d.ts +20 -2
- package/dist/docs.mjs +11 -9
- package/dist/headers.cjs +6 -4
- package/dist/headers.d.mts +11 -1
- package/dist/headers.d.ts +11 -1
- package/dist/headers.mjs +5 -3
- package/dist/i18n/client.cjs +11 -11
- package/dist/i18n/client.mjs +3 -3
- package/dist/index.cjs +62 -46
- package/dist/index.d.mts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.mjs +62 -46
- package/dist/integrations.cjs +5 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +4 -2
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +19 -5
- package/dist/internal/app-markdown-runtime.d.ts +19 -5
- package/dist/internal/app-markdown-runtime.mjs +4 -2
- package/dist/internal/build-runtime.cjs +33 -30
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +32 -29
- package/dist/internal/cli-runtime.cjs +14 -12
- package/dist/internal/cli-runtime.mjs +13 -11
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +9 -7
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +8 -6
- package/dist/internal/docs-precompiled-runtime.cjs +19 -13
- package/dist/internal/docs-precompiled-runtime.d.mts +5 -0
- package/dist/internal/docs-precompiled-runtime.d.ts +5 -0
- package/dist/internal/docs-precompiled-runtime.mjs +14 -8
- 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-node-env.cjs +6 -2
- package/dist/internal/production-node-env.d.mts +10 -1
- package/dist/internal/production-node-env.d.ts +10 -1
- package/dist/internal/production-node-env.mjs +5 -1
- package/dist/internal/production-runtime.cjs +39 -54
- package/dist/internal/production-runtime.d.mts +51 -11
- package/dist/internal/production-runtime.d.ts +51 -11
- package/dist/internal/production-runtime.mjs +39 -54
- package/dist/markdown.cjs +8 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +7 -1
- package/dist/middleware.cjs +10 -8
- package/dist/middleware.d.mts +27 -5
- package/dist/middleware.d.ts +27 -5
- package/dist/middleware.mjs +10 -8
- package/dist/navigation.cjs +7 -7
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +6 -6
- package/dist/plugin.cjs +25 -23
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +24 -22
- package/dist/{production-runtime-CCeVZXst.d.mts → production-runtime-BQ4_WLwQ.d.mts} +1 -1
- package/dist/{production-runtime-DPnsggY3.d.ts → production-runtime-D2aMyzjr.d.ts} +1 -1
- package/dist/query/client.cjs +9 -9
- package/dist/query/client.mjs +4 -4
- package/dist/{render-plan-Cw4f5E_R.d.ts → render-plan-25p4hrj4.d.ts} +1 -1
- package/dist/{render-plan-BuGaPFe6.d.mts → render-plan-DtkXMN8D.d.mts} +1 -1
- package/dist/renderer-client.cjs +12 -12
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +4 -4
- package/dist/renderer.d.mts +13 -4
- package/dist/renderer.d.ts +13 -4
- package/dist/{request-CsGARcAw.d.mts → request-DgCkIdcn.d.mts} +4 -2
- package/dist/{request-Bkg-hERy.d.ts → request-jF4jwx8f.d.ts} +4 -2
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-BUZMH_64.d.ts → route-rendering-Bji6S6a_.d.ts} +1 -1
- package/dist/{route-rendering-f11yh5dp.d.mts → route-rendering-CSBF78Ya.d.mts} +1 -1
- package/dist/{router-Cp6yRE8A.d.mts → router-B09Ui3Qm.d.mts} +1 -1
- package/dist/{router-B8CR9GbD.d.ts → router-CPB9cXtG.d.ts} +1 -1
- package/dist/routes.cjs +2 -2
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +1 -1
- package/dist/{runtime-CAEv36S_.d.mts → runtime-CM6E6yuI.d.mts} +1 -1
- package/dist/{runtime-CQVsT330.d.ts → runtime-EDMwLdjv.d.ts} +1 -1
- package/dist/server-fn.cjs +3 -3
- package/dist/server-fn.mjs +2 -2
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query.cjs +4 -4
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +51 -49
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +29 -27
- package/dist/{spa-router-BuciWGCZ.d.ts → spa-router-B_N8XgVu.d.ts} +2 -2
- package/dist/{spa-router-DwbqGkGj.d.mts → spa-router-Cgimzfbi.d.mts} +2 -2
- package/dist/testing.cjs +8 -8
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +6 -6
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-CaoWKtYM.d.ts → utils-BNxAKAuT.d.ts} +1 -1
- package/dist/{utils-B9V0S_yL.d.mts → utils-DZciYXYl.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +25 -23
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +24 -22
- package/package.json +1 -1
- package/types/middleware.d.ts +5 -1
- package/dist/chunk-655RLQQL.mjs +0 -43
- package/dist/chunk-FXEF4PPL.mjs +0 -47
- package/dist/chunk-IZY3V5XW.mjs +0 -23
- package/dist/chunk-MRMI32SN.cjs +0 -1157
- package/dist/chunk-MT763TDW.cjs +0 -43
- package/dist/chunk-XD32KALF.cjs +0 -47
- /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
- /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
matchSSGPage,
|
|
5
5
|
resolveRouteRenderingConfig,
|
|
6
6
|
resolveRouteRenderingConfigFromFile
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CQMVIOYP.mjs";
|
|
8
8
|
import {
|
|
9
9
|
collectSchemaExtensions,
|
|
10
10
|
declareSchemaTables,
|
|
@@ -28,6 +28,8 @@ import {
|
|
|
28
28
|
createLateRedirectRecovery,
|
|
29
29
|
createRouteDirectoryPattern,
|
|
30
30
|
extractFarmFullDocument,
|
|
31
|
+
farmPathGuardCoversEndpoint,
|
|
32
|
+
farmPathGuardCoversPage,
|
|
31
33
|
formatRouteSegment,
|
|
32
34
|
getDefaultErrorStatusText,
|
|
33
35
|
getRouteDirectoryDepth,
|
|
@@ -42,7 +44,7 @@ import {
|
|
|
42
44
|
resolveFarmAppManifestInput,
|
|
43
45
|
routeBoundaryCoversDirectory,
|
|
44
46
|
stripRouteGroups
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-B6G5CKMC.mjs";
|
|
46
48
|
import {
|
|
47
49
|
FARM_DEFAULT_MCP_PATH,
|
|
48
50
|
collectFarmDefaultMCPPages,
|
|
@@ -50,7 +52,7 @@ import {
|
|
|
50
52
|
farmConfigMountsMCP,
|
|
51
53
|
isFarmDefaultMCPPathname,
|
|
52
54
|
resolveFarmDefaultMCPServer
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-P664ZVTV.mjs";
|
|
54
56
|
import {
|
|
55
57
|
isFarmPreviewDeploymentEnvironment
|
|
56
58
|
} from "./chunk-BOYNDCZL.mjs";
|
|
@@ -73,12 +75,12 @@ import {
|
|
|
73
75
|
import {
|
|
74
76
|
_setDefaultFarmThemeConfig,
|
|
75
77
|
getTheme
|
|
76
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-CUM5NYL5.mjs";
|
|
77
79
|
import {
|
|
78
80
|
generateFarmDocsAdapterClientRuntime,
|
|
79
81
|
getFarmDocsAdapterConfigModule,
|
|
80
82
|
isSecretDocsConfigKey
|
|
81
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-J7K2NZD6.mjs";
|
|
82
84
|
import {
|
|
83
85
|
resolveFarmDocsFontAssets,
|
|
84
86
|
toFarmDocsPublicFontAssets
|
|
@@ -119,24 +121,27 @@ import {
|
|
|
119
121
|
} from "./chunk-DAATZTKJ.mjs";
|
|
120
122
|
import {
|
|
121
123
|
FARM_PREVIEW_ROBOTS_TAG,
|
|
122
|
-
addFarmCspNonceToScriptTags,
|
|
123
124
|
createFarmAgentRobots,
|
|
124
|
-
createFarmCspNonce,
|
|
125
|
-
createFarmCspNonceRewriter,
|
|
126
125
|
createFarmDefaultSitemap,
|
|
127
|
-
getFarmSecurityHeader,
|
|
128
126
|
resolveFarmAgentCrawlers,
|
|
129
127
|
resolveFarmAgentSitemap,
|
|
130
|
-
resolveFarmPerformanceConfig
|
|
131
|
-
|
|
132
|
-
} from "./chunk-4E5WBPEG.mjs";
|
|
128
|
+
resolveFarmPerformanceConfig
|
|
129
|
+
} from "./chunk-WFRT7JPX.mjs";
|
|
133
130
|
import {
|
|
134
131
|
collectFarmLlmsTxtPages,
|
|
135
132
|
createFarmDefaultLlmsTxt,
|
|
136
133
|
createFarmLlmsMarkdownReader,
|
|
137
134
|
renderFarmLlmsFullTxt,
|
|
138
135
|
resolveFarmLlmsTxtConfig
|
|
139
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-HD5CF3OE.mjs";
|
|
137
|
+
import {
|
|
138
|
+
createFarmCspNonce,
|
|
139
|
+
createFarmCspNonceRewriter,
|
|
140
|
+
filterFarmCspNonces,
|
|
141
|
+
getFarmSecurityHeader,
|
|
142
|
+
resolveFarmSecurityConfig,
|
|
143
|
+
stampFarmCspNonce
|
|
144
|
+
} from "./chunk-U6QLDL3G.mjs";
|
|
140
145
|
import {
|
|
141
146
|
getPublicFarmImageConfig,
|
|
142
147
|
resolveFarmImageConfig
|
|
@@ -154,18 +159,20 @@ import {
|
|
|
154
159
|
import {
|
|
155
160
|
createFarmMarkdownRouteModuleFromFile,
|
|
156
161
|
loadFarmMdxComponents
|
|
157
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-IVLZZZEI.mjs";
|
|
158
163
|
import {
|
|
159
164
|
createFarmMarkdownSourceResponse,
|
|
160
165
|
isFarmMarkdownPageFile,
|
|
161
166
|
normalizeFarmMarkdownRoutePath
|
|
162
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-QFW2IH5E.mjs";
|
|
163
168
|
import {
|
|
164
169
|
resolveFarmMdxComponentsModulePath,
|
|
165
170
|
resolveMdxConfig
|
|
166
171
|
} from "./chunk-FA2W42OV.mjs";
|
|
167
172
|
import {
|
|
168
173
|
FARM_MARKDOWN_CONTENT_TYPE,
|
|
174
|
+
FARM_MARKDOWN_PAGE_CHECK_HEADER,
|
|
175
|
+
_isFarmMarkdownPageCheck,
|
|
169
176
|
createFarmMarkdownErrorBody,
|
|
170
177
|
createMarkdownMirrorResponse,
|
|
171
178
|
farmRequestWantsMarkdown,
|
|
@@ -173,7 +180,7 @@ import {
|
|
|
173
180
|
getFarmMarkdownMirrorPath,
|
|
174
181
|
resolveMarkdownConfig,
|
|
175
182
|
resolveMarkdownMirrorTarget
|
|
176
|
-
} from "./chunk-
|
|
183
|
+
} from "./chunk-VNGH5MLF.mjs";
|
|
177
184
|
import {
|
|
178
185
|
resolveWorkflowsConfig
|
|
179
186
|
} from "./chunk-Q2KB32T4.mjs";
|
|
@@ -196,10 +203,10 @@ import {
|
|
|
196
203
|
getRegisteredIntegrationAPIManifest,
|
|
197
204
|
isFarmIntegrationProviderComponentReference,
|
|
198
205
|
matchIntegrationRoute
|
|
199
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-IBUQWVYA.mjs";
|
|
200
207
|
import {
|
|
201
208
|
MiddlewareManager
|
|
202
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-JCKYH4LG.mjs";
|
|
203
210
|
import {
|
|
204
211
|
createRouteSlotContainerId,
|
|
205
212
|
parseRouteSlotFile
|
|
@@ -209,7 +216,10 @@ import {
|
|
|
209
216
|
_clearCurrentMiddlewareData,
|
|
210
217
|
_runWithMiddlewareContext,
|
|
211
218
|
_runWithMiddlewareData
|
|
212
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-SKVTP5PR.mjs";
|
|
220
|
+
import {
|
|
221
|
+
createFarmDevServerDispatch
|
|
222
|
+
} from "./chunk-SGBZPZUW.mjs";
|
|
213
223
|
import {
|
|
214
224
|
_runWithAPIRequestRuntime
|
|
215
225
|
} from "./chunk-R3DS7A2T.mjs";
|
|
@@ -218,11 +228,11 @@ import {
|
|
|
218
228
|
} from "./chunk-IOEH4VWN.mjs";
|
|
219
229
|
import {
|
|
220
230
|
APIRouteManager
|
|
221
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-WLL43JMO.mjs";
|
|
222
232
|
import {
|
|
223
233
|
findProgrammaticRouteFiles,
|
|
224
234
|
loadProgrammaticRouteManifests
|
|
225
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-MYIZXDZA.mjs";
|
|
226
236
|
import {
|
|
227
237
|
_runWithFarmI18nRequest,
|
|
228
238
|
_setDefaultFarmI18nRuntime,
|
|
@@ -237,7 +247,7 @@ import {
|
|
|
237
247
|
} from "./chunk-YOZYCI6Z.mjs";
|
|
238
248
|
import {
|
|
239
249
|
isFarmAPIPathname
|
|
240
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-6HB6V3R7.mjs";
|
|
241
251
|
import {
|
|
242
252
|
registerFarmMCPServer
|
|
243
253
|
} from "./chunk-ZLAT2CWY.mjs";
|
|
@@ -322,7 +332,7 @@ import {
|
|
|
322
332
|
} from "./chunk-BTHHUD7Q.mjs";
|
|
323
333
|
import {
|
|
324
334
|
FARM_VERSION
|
|
325
|
-
} from "./chunk-
|
|
335
|
+
} from "./chunk-LI2F57NI.mjs";
|
|
326
336
|
import {
|
|
327
337
|
resolveFarmTrailingSlashRedirect,
|
|
328
338
|
setFarmTrailingSlashPreference
|
|
@@ -360,7 +370,7 @@ import {
|
|
|
360
370
|
} from "./chunk-CNOQY6Z7.mjs";
|
|
361
371
|
import {
|
|
362
372
|
FARM_CONFIG_REWRITES_PLUGIN_NAME
|
|
363
|
-
} from "./chunk-
|
|
373
|
+
} from "./chunk-INL3THCU.mjs";
|
|
364
374
|
import {
|
|
365
375
|
appendFarmRedirectQuery
|
|
366
376
|
} from "./chunk-BRYHOB4X.mjs";
|
|
@@ -372,13 +382,15 @@ import {
|
|
|
372
382
|
import {
|
|
373
383
|
_getRequestReadCount,
|
|
374
384
|
_runWithCurrentRequest,
|
|
385
|
+
_runWithFarmCspNonce,
|
|
375
386
|
createWebRequestFromFarmRequest,
|
|
376
387
|
getCurrentRequestOrNull,
|
|
377
388
|
resolveFarmRequestURL
|
|
378
|
-
} from "./chunk-
|
|
389
|
+
} from "./chunk-POSPE3IO.mjs";
|
|
379
390
|
import {
|
|
391
|
+
_resolveCurrentCspNonce,
|
|
380
392
|
_resolveCurrentRequest
|
|
381
|
-
} from "./chunk-
|
|
393
|
+
} from "./chunk-QRKIMN7T.mjs";
|
|
382
394
|
import {
|
|
383
395
|
localizeFarmHref,
|
|
384
396
|
localizeFarmPathname,
|
|
@@ -4704,6 +4716,11 @@ function createPreHydrationClickQueueScript() {
|
|
|
4704
4716
|
return `<script>(function(){if(window.__FARM_PREHYDRATION_CLICK_QUEUE__)return;var queue=[];window.__FARM_PREHYDRATION_CLICK_QUEUE__=queue;window.__FARM_HYDRATED__=false;document.documentElement.dataset.farmHydrated="false";function isModified(event){return !!(event.metaKey||event.altKey||event.ctrlKey||event.shiftKey)}function inHydrated(node){return !!(node&&node.closest&&node.closest('[data-farm-island-hydrated="true"]'))}function closestQueuedTarget(target){while(target&&target!==document.documentElement){if(target.matches&&target.matches(${selector}))return target;target=target.parentElement}return null}function announce(target,kind){document.dispatchEvent(new CustomEvent("farm:island-interaction",{detail:{target:target,kind:kind||null}}))}function hold(event,target,kind){if(!queue.some(function(item){return item.target===target})){queue.push({target:target,kind:kind,createdAt:Date.now()});announce(target,kind)}event.preventDefault();event.stopImmediatePropagation()}document.addEventListener("click",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented||event.button!==0||isModified(event))return;var target=closestQueuedTarget(event.target);if(!target||target.closest&&target.closest("a[href]")||inHydrated(target))return;hold(event,target,"click")},true);document.addEventListener("submit",function(event){if(window.__FARM_HYDRATED__)return;if(event.defaultPrevented)return;var form=event.target;if(!form||form.nodeName!=="FORM"||inHydrated(form))return;hold(event,form,"submit")},true);function observe(event){if(window.__FARM_HYDRATED__)return;var target=event.target;if(!(target&&target.closest)||inHydrated(target))return;announce(target,null)}document.addEventListener("pointerdown",observe,true);document.addEventListener("focusin",observe,true);})();</script>`;
|
|
4705
4717
|
}
|
|
4706
4718
|
__name(createPreHydrationClickQueueScript, "createPreHydrationClickQueueScript");
|
|
4719
|
+
function rendererRenderOptions() {
|
|
4720
|
+
const nonce = _resolveCurrentCspNonce();
|
|
4721
|
+
return nonce ? { nonce } : void 0;
|
|
4722
|
+
}
|
|
4723
|
+
__name(rendererRenderOptions, "rendererRenderOptions");
|
|
4707
4724
|
function createDocumentFooter(options) {
|
|
4708
4725
|
return `</div>
|
|
4709
4726
|
${options.suspenseRevealFallback}
|
|
@@ -4957,22 +4974,27 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4957
4974
|
}
|
|
4958
4975
|
return this.rendererRuntime.wrapClientGraph(element);
|
|
4959
4976
|
}
|
|
4960
|
-
async renderElementToCompleteHTML(element) {
|
|
4977
|
+
async renderElementToCompleteHTML(element, options = {}) {
|
|
4961
4978
|
const streaming = getFarmRendererStreamingCapabilitiesForRuntime(this.config.renderer, "node");
|
|
4962
4979
|
const renderToPipeableStream = streaming.node ? this.rendererRuntime.renderToPipeableStream : void 0;
|
|
4963
4980
|
if (renderToPipeableStream) {
|
|
4964
4981
|
return await new Promise((resolve6, reject) => {
|
|
4965
4982
|
const chunks = [];
|
|
4966
4983
|
let started = false;
|
|
4984
|
+
let lateNavigation;
|
|
4967
4985
|
const writable = new Writable({
|
|
4968
4986
|
write(chunk, _encoding, callback) {
|
|
4969
4987
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
4970
4988
|
callback();
|
|
4971
4989
|
}
|
|
4972
4990
|
});
|
|
4973
|
-
writable.once(
|
|
4991
|
+
writable.once(
|
|
4992
|
+
"finish",
|
|
4993
|
+
() => lateNavigation === void 0 ? resolve6(Buffer.concat(chunks).toString("utf8")) : reject(lateNavigation)
|
|
4994
|
+
);
|
|
4974
4995
|
writable.once("error", reject);
|
|
4975
4996
|
const stream = renderToPipeableStream(element, {
|
|
4997
|
+
nonce: _resolveCurrentCspNonce(),
|
|
4976
4998
|
onShellReady() {
|
|
4977
4999
|
started = true;
|
|
4978
5000
|
stream.pipe(writable);
|
|
@@ -4982,26 +5004,35 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4982
5004
|
},
|
|
4983
5005
|
onError(error) {
|
|
4984
5006
|
if (!started) reject(error);
|
|
5007
|
+
else if (options.rejectLateNavigation && lateNavigation === void 0 && (isFarmRedirectError(error) || isFarmNotFoundError(error))) {
|
|
5008
|
+
lateNavigation = error;
|
|
5009
|
+
}
|
|
4985
5010
|
}
|
|
4986
5011
|
});
|
|
4987
5012
|
});
|
|
4988
5013
|
}
|
|
4989
5014
|
if (streaming.web && this.rendererRuntime.renderToReadableStream) {
|
|
4990
|
-
const stream = await this.rendererRuntime.renderToReadableStream(
|
|
5015
|
+
const stream = await this.rendererRuntime.renderToReadableStream(
|
|
5016
|
+
element,
|
|
5017
|
+
rendererRenderOptions()
|
|
5018
|
+
);
|
|
4991
5019
|
return await readFarmRendererWebStream(stream);
|
|
4992
5020
|
}
|
|
4993
|
-
return await this.rendererRuntime.renderToString(element);
|
|
5021
|
+
return await this.rendererRuntime.renderToString(element, rendererRenderOptions());
|
|
4994
5022
|
}
|
|
4995
5023
|
/**
|
|
4996
5024
|
* Buffered render carrying document-head markup for renderers that emit it
|
|
4997
5025
|
* during render (e.g. <svelte:head>). Other renderers return an empty head.
|
|
4998
5026
|
*/
|
|
4999
|
-
async renderElementToDocumentParts(element) {
|
|
5027
|
+
async renderElementToDocumentParts(element, options = {}) {
|
|
5000
5028
|
if (this.rendererRuntime.renderToStringWithHead) {
|
|
5001
|
-
const rendered = await this.rendererRuntime.renderToStringWithHead(
|
|
5029
|
+
const rendered = await this.rendererRuntime.renderToStringWithHead(
|
|
5030
|
+
element,
|
|
5031
|
+
rendererRenderOptions()
|
|
5032
|
+
);
|
|
5002
5033
|
return { html: rendered.html, head: rendered.head || "" };
|
|
5003
5034
|
}
|
|
5004
|
-
return { html: await this.renderElementToCompleteHTML(element), head: "" };
|
|
5035
|
+
return { html: await this.renderElementToCompleteHTML(element, options), head: "" };
|
|
5005
5036
|
}
|
|
5006
5037
|
/**
|
|
5007
5038
|
* Render the route tree used by client navigation without producing a second
|
|
@@ -5370,7 +5401,10 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5370
5401
|
return;
|
|
5371
5402
|
}
|
|
5372
5403
|
}
|
|
5373
|
-
return
|
|
5404
|
+
return _runWithFarmCspNonce(
|
|
5405
|
+
cspNonce,
|
|
5406
|
+
() => this.runWithRequestContext(request2, () => this.renderPageInContext(req, res))
|
|
5407
|
+
);
|
|
5374
5408
|
}
|
|
5375
5409
|
async renderPageInContext(req, res) {
|
|
5376
5410
|
const renderStartTime = Date.now();
|
|
@@ -6280,7 +6314,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6280
6314
|
trustProxy: this.config.server?.trustProxy
|
|
6281
6315
|
});
|
|
6282
6316
|
const sources = await Promise.all(
|
|
6283
|
-
|
|
6317
|
+
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
6284
6318
|
const [module, stat] = await Promise.all([
|
|
6285
6319
|
this.routeManager.loadRouteModule(route.modulePath).catch((error) => {
|
|
6286
6320
|
logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
|
|
@@ -6318,6 +6352,21 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6318
6352
|
setAPIRouteLookup(exists) {
|
|
6319
6353
|
this.apiRouteExists = exists;
|
|
6320
6354
|
}
|
|
6355
|
+
/** The dev server's file middleware, so public page listings can leave guarded pages out. */
|
|
6356
|
+
setMiddlewareRouteLookup(routes) {
|
|
6357
|
+
this.middlewareRoutes = routes;
|
|
6358
|
+
}
|
|
6359
|
+
/**
|
|
6360
|
+
* The static pages sitemap.xml, llms.txt and the default MCP server may list: not one a
|
|
6361
|
+
* path-specific guard (non-root middleware.ts, a config or integration middleware
|
|
6362
|
+
* matcher) covers, as the production build decides.
|
|
6363
|
+
*/
|
|
6364
|
+
getAgentListedRoutes() {
|
|
6365
|
+
const guards = { config: this.config, middlewareRoutes: this.middlewareRoutes?.() ?? [] };
|
|
6366
|
+
return [...this.routeManager.getRoutes()].filter(
|
|
6367
|
+
([pattern]) => !pattern.includes("[") && !farmPathGuardCoversPage(guards, pattern)
|
|
6368
|
+
);
|
|
6369
|
+
}
|
|
6321
6370
|
/**
|
|
6322
6371
|
* The default read-only MCP server (`agent.mcp`), or undefined when the app has an MCP
|
|
6323
6372
|
* server of its own: a route that answers /mcp, an API route at /api/mcp, `@farm.js/mcp`,
|
|
@@ -6337,14 +6386,14 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6337
6386
|
const server = this.getDefaultMCPServer();
|
|
6338
6387
|
const request2 = getCurrentRequestOrNull() ?? createWebRequestFromFarmRequest(req, { trustProxy: this.config.server?.trustProxy });
|
|
6339
6388
|
try {
|
|
6340
|
-
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-
|
|
6389
|
+
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-OLRMZONF.mjs");
|
|
6341
6390
|
const origin = new URL(request2.url).origin;
|
|
6342
6391
|
const response = await handleFarmDefaultMCPRequest(request2, {
|
|
6343
6392
|
server,
|
|
6344
6393
|
basePath: this.config.basePath,
|
|
6345
6394
|
listPages: /* @__PURE__ */ __name(async () => {
|
|
6346
6395
|
const sources = await Promise.all(
|
|
6347
|
-
|
|
6396
|
+
this.getAgentListedRoutes().map(async ([pattern, route]) => ({
|
|
6348
6397
|
pattern,
|
|
6349
6398
|
// The page itself surfaces a load error. Without its module a guard cannot
|
|
6350
6399
|
// be ruled out, so the page is left out.
|
|
@@ -6380,14 +6429,12 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6380
6429
|
async createLlmsTxtContext(request2, options = {}) {
|
|
6381
6430
|
const config = resolveFarmLlmsTxtConfig(this.config.agent?.llmsTxt);
|
|
6382
6431
|
const origin = new URL(request2.url).origin;
|
|
6383
|
-
const staticRoutes = [...this.routeManager.getRoutes()].filter(
|
|
6384
|
-
([pattern]) => !pattern.includes("[")
|
|
6385
|
-
);
|
|
6386
6432
|
const sources = await Promise.all(
|
|
6387
|
-
|
|
6433
|
+
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
6388
6434
|
try {
|
|
6389
|
-
const
|
|
6390
|
-
|
|
6435
|
+
const module = await this.routeManager.loadRouteModule(route.modulePath);
|
|
6436
|
+
if (module.__farmRouteGuard) return null;
|
|
6437
|
+
return { pattern, metadata: module.metadata };
|
|
6391
6438
|
} catch (error) {
|
|
6392
6439
|
logger.warn(`Could not read metadata for ${pattern} in llms.txt: ${error}`);
|
|
6393
6440
|
return { pattern };
|
|
@@ -6396,13 +6443,16 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6396
6443
|
);
|
|
6397
6444
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6398
6445
|
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
6399
|
-
const pages = collectFarmLlmsTxtPages(
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6446
|
+
const pages = collectFarmLlmsTxtPages(
|
|
6447
|
+
sources.filter((source) => source !== null),
|
|
6448
|
+
{
|
|
6449
|
+
origin,
|
|
6450
|
+
basePath: this.config.basePath,
|
|
6451
|
+
markdown: resolveMarkdownConfig(this.config.md),
|
|
6452
|
+
include: config.include,
|
|
6453
|
+
exclude: config.exclude
|
|
6454
|
+
}
|
|
6455
|
+
);
|
|
6406
6456
|
return {
|
|
6407
6457
|
pages,
|
|
6408
6458
|
defaults: createFarmDefaultLlmsTxt({
|
|
@@ -6564,7 +6614,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6564
6614
|
options.middlewareMap,
|
|
6565
6615
|
() => _runWithMiddlewareContext(
|
|
6566
6616
|
options.middlewareContext,
|
|
6567
|
-
() => this.rendererRuntime.renderToString(wrapped)
|
|
6617
|
+
() => this.rendererRuntime.renderToString(wrapped, rendererRenderOptions())
|
|
6568
6618
|
)
|
|
6569
6619
|
);
|
|
6570
6620
|
res.statusCode = options.statusCode;
|
|
@@ -6654,7 +6704,8 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6654
6704
|
const pagePath = req.__FARM_PAGE_PATH__;
|
|
6655
6705
|
const relativePath = pagePath ? toViteModuleId(pagePath, this.config.root) : "/src/app/page.tsx";
|
|
6656
6706
|
const deploymentId = this.getDeploymentId();
|
|
6657
|
-
const
|
|
6707
|
+
const farmScripts = /* @__PURE__ */ __name((markup) => this.stampFarmScripts(req, markup), "farmScripts");
|
|
6708
|
+
const bootstrapScript = farmScripts(`<script data-farm-refresh-state>
|
|
6658
6709
|
window.__FARM_PROPS__ = ${serializeInlineValue(deferredProps.data.page)};
|
|
6659
6710
|
window.__FARM_ROUTE_SLOTS__ = ${serializeInlineValue(deferredProps.data.slots)};
|
|
6660
6711
|
window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(deploymentId)};
|
|
@@ -6673,10 +6724,23 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(req.__FARM_LOADING_MODULE_PATH
|
|
|
6673
6724
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
6674
6725
|
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(getRegisteredIntegrationAPIManifest())};
|
|
6675
6726
|
window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getFarmI18nClientSnapshot()) : "null"};
|
|
6676
|
-
</script
|
|
6677
|
-
const deferredScript = createDeferredHydrationScript(deferredProps.records);
|
|
6678
|
-
const rendererHydrationScript =
|
|
6679
|
-
|
|
6727
|
+
</script>`);
|
|
6728
|
+
const deferredScript = farmScripts(createDeferredHydrationScript(deferredProps.records));
|
|
6729
|
+
const rendererHydrationScript = farmScripts(
|
|
6730
|
+
this.rendererRuntime.generateHydrationScript?.() || ""
|
|
6731
|
+
);
|
|
6732
|
+
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
6733
|
+
const farmClientScript = farmScripts(
|
|
6734
|
+
`<script type="module" src="/@farm/client.js"></script>`
|
|
6735
|
+
);
|
|
6736
|
+
const { html: content, head: rendererHead } = await this.renderElementToDocumentParts(
|
|
6737
|
+
element,
|
|
6738
|
+
{
|
|
6739
|
+
rejectLateNavigation: _isFarmMarkdownPageCheck(
|
|
6740
|
+
req.headers?.[FARM_MARKDOWN_PAGE_CHECK_HEADER]
|
|
6741
|
+
)
|
|
6742
|
+
}
|
|
6743
|
+
);
|
|
6680
6744
|
const {
|
|
6681
6745
|
title,
|
|
6682
6746
|
tags: metaTags,
|
|
@@ -6700,6 +6764,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6700
6764
|
this.config.basePath,
|
|
6701
6765
|
getTheme()
|
|
6702
6766
|
);
|
|
6767
|
+
themeDocument.head = farmScripts(themeDocument.head);
|
|
6703
6768
|
const fullDocument = extractFarmFullDocument(content);
|
|
6704
6769
|
let html;
|
|
6705
6770
|
if (fullDocument) {
|
|
@@ -6724,11 +6789,11 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6724
6789
|
renderFarmFontDevHead(this.config.root || process.cwd()),
|
|
6725
6790
|
this.devGlobalStylesheetLink(),
|
|
6726
6791
|
...this.collectDevStyleLinks(),
|
|
6727
|
-
|
|
6792
|
+
viteClientScript,
|
|
6728
6793
|
rendererHydrationScript,
|
|
6729
6794
|
bootstrapScript
|
|
6730
6795
|
].filter(Boolean).join("\n "),
|
|
6731
|
-
bodyFooter: [deferredScript,
|
|
6796
|
+
bodyFooter: [deferredScript, farmClientScript].filter(Boolean).join("\n ")
|
|
6732
6797
|
});
|
|
6733
6798
|
} else {
|
|
6734
6799
|
html = `<!DOCTYPE html>
|
|
@@ -6744,14 +6809,14 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6744
6809
|
${renderFarmFontDevHead(this.config.root || process.cwd())}
|
|
6745
6810
|
${this.devGlobalStylesheetLink()}${this.collectDevStyleLinks().map((l) => `
|
|
6746
6811
|
${l}`).join("")}
|
|
6747
|
-
|
|
6812
|
+
${viteClientScript}
|
|
6748
6813
|
${rendererHydrationScript}
|
|
6749
6814
|
${bootstrapScript}
|
|
6750
6815
|
</head>
|
|
6751
6816
|
<body class="">
|
|
6752
6817
|
<div id="root">${content}</div>
|
|
6753
6818
|
${deferredScript}
|
|
6754
|
-
|
|
6819
|
+
${farmClientScript}
|
|
6755
6820
|
</body>
|
|
6756
6821
|
</html>`;
|
|
6757
6822
|
}
|
|
@@ -6812,7 +6877,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6812
6877
|
async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
|
|
6813
6878
|
const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
|
|
6814
6879
|
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
6815
|
-
if (!renderToPipeableStream || fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument()) {
|
|
6880
|
+
if (!renderToPipeableStream || _isFarmMarkdownPageCheck(req.headers?.[FARM_MARKDOWN_PAGE_CHECK_HEADER]) || fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument()) {
|
|
6816
6881
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
6817
6882
|
}
|
|
6818
6883
|
return new Promise((resolve6, reject) => {
|
|
@@ -6943,7 +7008,8 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6943
7008
|
const devStyleLinks = this.collectDevStyleLinks();
|
|
6944
7009
|
const globalStylesheetLink = this.devGlobalStylesheetLink(true);
|
|
6945
7010
|
const cspNonce = this.getCspNonce(req);
|
|
6946
|
-
const
|
|
7011
|
+
const stampDocumentHTML = /* @__PURE__ */ __name((html) => stampFarmCspNonce(html, cspNonce || ""), "stampDocumentHTML");
|
|
7012
|
+
const filterDocumentHTML = /* @__PURE__ */ __name((html) => cspNonce ? filterFarmCspNonces(html, cspNonce) : html, "filterDocumentHTML");
|
|
6947
7013
|
const createLateNavigationRecovery = /* @__PURE__ */ __name((navigationError) => this.createLateNavigationRecoveryHTML(req, navigationError), "createLateNavigationRecovery");
|
|
6948
7014
|
const { pipe, abort } = renderToPipeableStream(streamRoot, {
|
|
6949
7015
|
nonce: cspNonce,
|
|
@@ -6984,7 +7050,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6984
7050
|
</head>
|
|
6985
7051
|
<body class="">
|
|
6986
7052
|
<div id="root">`;
|
|
6987
|
-
const securedShell =
|
|
7053
|
+
const securedShell = stampDocumentHTML(shell);
|
|
6988
7054
|
htmlParts.push(securedShell);
|
|
6989
7055
|
staticShellParts?.push(securedShell);
|
|
6990
7056
|
let firstChunk = true;
|
|
@@ -7042,7 +7108,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
7042
7108
|
lateNavigationError = null;
|
|
7043
7109
|
createLateNavigationRecovery(navigationError).then(
|
|
7044
7110
|
(recovery) => {
|
|
7045
|
-
const secured =
|
|
7111
|
+
const secured = filterDocumentHTML(recovery);
|
|
7046
7112
|
htmlParts.push(secured);
|
|
7047
7113
|
res.write(secured);
|
|
7048
7114
|
finishStream(callback);
|
|
@@ -7064,7 +7130,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
7064
7130
|
if (tail) res.write(tail);
|
|
7065
7131
|
}
|
|
7066
7132
|
const suspenseRevealFallback = `<script>(function(){function moveFragment(srcId,placeholderId){var src=document.getElementById(srcId),ph=document.getElementById(placeholderId);if(!src||!ph||!ph.parentNode)return false;while(src.firstChild)ph.parentNode.insertBefore(src.firstChild,ph);ph.parentNode.removeChild(ph);if(src.parentNode)src.parentNode.removeChild(src);return true}function revealBoundary(boundaryId,sectionId){var boundary=document.getElementById(boundaryId),section=document.getElementById(sectionId);if(!boundary||!section||!boundary.parentNode)return false;var start=boundary.previousSibling;if(!start||start.nodeType!==8)return false;var parent=boundary.parentNode;var node=boundary;var depth=0;while(node){if(node.nodeType===8){var data=node.data;if(data==="/$"||data==="/&"){if(depth===0)break;depth--;}else if(data==="$"||data==="$?"||data==="$~"||data==="$!"||data==="&"){depth++;}}var next=node.nextSibling;parent.removeChild(node);node=next;}while(section.firstChild)parent.insertBefore(section.firstChild,node);if(section.parentNode)section.parentNode.removeChild(section);start.data="$";return true}var tries=0;var timer=setInterval(function(){var changed=false;document.querySelectorAll('div[id^="S:"]').forEach(function(section){var suffix=section.id.slice(2);changed=moveFragment('S:'+suffix,'P:'+suffix)||changed;});document.querySelectorAll('template[id^="B:"]').forEach(function(boundary){var suffix=boundary.id.slice(2);changed=revealBoundary('B:'+suffix,'S:'+suffix)||changed;});tries++;if(tries>80||(!document.querySelector('template[id^="B:"]')&&!document.querySelector('template[id^="P:"]'))){clearInterval(timer);}},50);})();</script>`;
|
|
7067
|
-
const footer =
|
|
7133
|
+
const footer = stampDocumentHTML(
|
|
7068
7134
|
createDocumentFooter({
|
|
7069
7135
|
suspenseRevealFallback,
|
|
7070
7136
|
deferredHydrationScript: createDeferredHydrationScript(deferredProps.records)
|
|
@@ -7193,7 +7259,10 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
7193
7259
|
*/
|
|
7194
7260
|
async createLateNavigationRecoveryHTML(req, error) {
|
|
7195
7261
|
if (isFarmRedirectError(error)) {
|
|
7196
|
-
return createLateRedirectRecovery(
|
|
7262
|
+
return createLateRedirectRecovery(
|
|
7263
|
+
this.localizeRedirectUrl(getFarmRedirectError(error).url),
|
|
7264
|
+
this.getCspNonce(req) || ""
|
|
7265
|
+
);
|
|
7197
7266
|
}
|
|
7198
7267
|
const pathname = resolveFarmRequestURL(req, {
|
|
7199
7268
|
trustProxy: this.config.server?.trustProxy
|
|
@@ -7205,13 +7274,14 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
7205
7274
|
content = await this.rendererRuntime.renderToString(
|
|
7206
7275
|
await this.wrapWithIntegrationProviders(
|
|
7207
7276
|
this.rendererRuntime.createElement(NotFoundComponent, { pathname })
|
|
7208
|
-
)
|
|
7277
|
+
),
|
|
7278
|
+
rendererRenderOptions()
|
|
7209
7279
|
);
|
|
7210
7280
|
} catch (error2) {
|
|
7211
7281
|
logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
|
|
7212
7282
|
}
|
|
7213
7283
|
}
|
|
7214
|
-
return createLateNotFoundRecovery(content);
|
|
7284
|
+
return createLateNotFoundRecovery(content, this.getCspNonce(req) || "");
|
|
7215
7285
|
}
|
|
7216
7286
|
async render404(req, res) {
|
|
7217
7287
|
res.statusCode = 404;
|
|
@@ -7254,7 +7324,10 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
7254
7324
|
});
|
|
7255
7325
|
}
|
|
7256
7326
|
element = await this.wrapWithIntegrationProviders(element);
|
|
7257
|
-
const content = await this.rendererRuntime.renderToString(
|
|
7327
|
+
const content = await this.rendererRuntime.renderToString(
|
|
7328
|
+
element,
|
|
7329
|
+
rendererRenderOptions()
|
|
7330
|
+
);
|
|
7258
7331
|
const { head: head2, metadata: metadata2 } = await this.notFoundMetadataHead(layoutModule, notFoundModule);
|
|
7259
7332
|
const html2 = this.createFullHTML(content, false, pathname, head2, { req, metadata: metadata2 });
|
|
7260
7333
|
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
@@ -7287,20 +7360,23 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
7287
7360
|
});
|
|
7288
7361
|
const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
|
|
7289
7362
|
const statusText = getDefaultErrorStatusText(statusCode);
|
|
7290
|
-
const content =
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7363
|
+
const content = this.stampFarmScripts(
|
|
7364
|
+
req,
|
|
7365
|
+
createDefaultErrorMarkup({
|
|
7366
|
+
statusCode,
|
|
7367
|
+
statusText,
|
|
7368
|
+
requestPath: requestUrl.pathname,
|
|
7369
|
+
method: req.method || "GET",
|
|
7370
|
+
message: diagnostics?.message,
|
|
7371
|
+
errorName: diagnostics?.name,
|
|
7372
|
+
stack: diagnostics?.stack,
|
|
7373
|
+
sourceFrame: diagnostics?.sourceFrame,
|
|
7374
|
+
development: isDev,
|
|
7375
|
+
farmVersion: FARM_VERSION,
|
|
7376
|
+
nodeVersion: process.version,
|
|
7377
|
+
mode: isDev ? "development" : "production"
|
|
7378
|
+
})
|
|
7379
|
+
);
|
|
7304
7380
|
const html = this.createFullHTML(
|
|
7305
7381
|
content,
|
|
7306
7382
|
false,
|
|
@@ -7328,12 +7404,14 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
7328
7404
|
}
|
|
7329
7405
|
createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
|
|
7330
7406
|
const i18nSnapshot = getFarmI18nClientSnapshot();
|
|
7331
|
-
const
|
|
7332
|
-
const
|
|
7407
|
+
const farmScripts = /* @__PURE__ */ __name((html) => this.stampFarmScripts(alternates.req, html), "farmScripts");
|
|
7408
|
+
const clientScript = isClientComponent ? ` ${farmScripts(`<script type="module" src="/@farm/client.js"></script>`)}` : "";
|
|
7409
|
+
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
7410
|
+
const integrationManifestScript = farmScripts(`<script>
|
|
7333
7411
|
window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
|
|
7334
7412
|
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(getRegisteredIntegrationAPIManifest())};
|
|
7335
7413
|
${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};` : ""}
|
|
7336
|
-
</script
|
|
7414
|
+
</script>`);
|
|
7337
7415
|
const alternateLinks = i18nSnapshot ? renderI18nAlternateLinks(
|
|
7338
7416
|
requestPath,
|
|
7339
7417
|
i18nSnapshot,
|
|
@@ -7345,7 +7423,10 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
7345
7423
|
this.config.basePath,
|
|
7346
7424
|
getTheme()
|
|
7347
7425
|
);
|
|
7348
|
-
|
|
7426
|
+
themeDocument.head = farmScripts(themeDocument.head);
|
|
7427
|
+
const rendererHydrationScript = farmScripts(
|
|
7428
|
+
this.rendererRuntime.generateHydrationScript?.() || ""
|
|
7429
|
+
);
|
|
7349
7430
|
const viewportTags = renderViewportHead(alternates.metadata?.viewport);
|
|
7350
7431
|
const fullDocument = extractFarmFullDocument(content);
|
|
7351
7432
|
if (fullDocument) {
|
|
@@ -7367,7 +7448,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
7367
7448
|
fontHead,
|
|
7368
7449
|
this.devGlobalStylesheetLink(true),
|
|
7369
7450
|
...this.collectDevStyleLinks(),
|
|
7370
|
-
|
|
7451
|
+
viteClientScript,
|
|
7371
7452
|
rendererHydrationScript,
|
|
7372
7453
|
integrationManifestScript
|
|
7373
7454
|
].filter(Boolean).join("\n "),
|
|
@@ -7386,7 +7467,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
7386
7467
|
${fontHead}
|
|
7387
7468
|
${this.devGlobalStylesheetLink(true)}${this.collectDevStyleLinks().map((l) => `
|
|
7388
7469
|
${l}`).join("")}
|
|
7389
|
-
|
|
7470
|
+
${viteClientScript}
|
|
7390
7471
|
${rendererHydrationScript}
|
|
7391
7472
|
${integrationManifestScript}
|
|
7392
7473
|
</head>
|
|
@@ -7400,9 +7481,18 @@ ${clientScript}
|
|
|
7400
7481
|
const value = req.__FARM_CSP_NONCE__;
|
|
7401
7482
|
return typeof value === "string" ? value : void 0;
|
|
7402
7483
|
}
|
|
7484
|
+
/** Stamp the response nonce on markup Farm generates (never on rendered app output). */
|
|
7485
|
+
stampFarmScripts(req, html) {
|
|
7486
|
+
return stampFarmCspNonce(html, req && this.getCspNonce(req) || "");
|
|
7487
|
+
}
|
|
7488
|
+
/**
|
|
7489
|
+
* The last pass over a document that holds rendered app output: scripts
|
|
7490
|
+
* keep the response nonce only when Farm or the app (through getCspNonce())
|
|
7491
|
+
* gave it to them.
|
|
7492
|
+
*/
|
|
7403
7493
|
secureDocumentHTML(req, html) {
|
|
7404
7494
|
const nonce = this.getCspNonce(req);
|
|
7405
|
-
return nonce ?
|
|
7495
|
+
return nonce ? filterFarmCspNonces(html, nonce) : html;
|
|
7406
7496
|
}
|
|
7407
7497
|
applyDeploymentHeaders(req, res) {
|
|
7408
7498
|
const deploymentId = this.getDeploymentId();
|
|
@@ -9346,19 +9436,23 @@ function unwrapFarmDocumentElement(node) {
|
|
|
9346
9436
|
});
|
|
9347
9437
|
}
|
|
9348
9438
|
|
|
9439
|
+
function farmLayoutBoundaryElement(pattern, content) {
|
|
9440
|
+
return React.createElement(
|
|
9441
|
+
"div",
|
|
9442
|
+
{
|
|
9443
|
+
"data-farm-layout-boundary": "true",
|
|
9444
|
+
"data-farm-layout-pattern": pattern,
|
|
9445
|
+
style: { display: "contents" },
|
|
9446
|
+
},
|
|
9447
|
+
content,
|
|
9448
|
+
);
|
|
9449
|
+
}
|
|
9450
|
+
|
|
9349
9451
|
function FarmLayoutBoundary(props) {
|
|
9350
9452
|
const Component = props.component;
|
|
9351
9453
|
const layoutProps = { children: props.children, params: props.params };
|
|
9352
9454
|
const boundary = function (content) {
|
|
9353
|
-
return
|
|
9354
|
-
"div",
|
|
9355
|
-
{
|
|
9356
|
-
"data-farm-layout-boundary": "true",
|
|
9357
|
-
"data-farm-layout-pattern": props.pattern,
|
|
9358
|
-
style: { display: "contents" },
|
|
9359
|
-
},
|
|
9360
|
-
content,
|
|
9361
|
-
);
|
|
9455
|
+
return farmLayoutBoundaryElement(props.pattern, content);
|
|
9362
9456
|
};
|
|
9363
9457
|
const isPlainFunction =
|
|
9364
9458
|
typeof Component === "function" &&
|
|
@@ -9374,6 +9468,12 @@ function FarmLayoutBoundary(props) {
|
|
|
9374
9468
|
}
|
|
9375
9469
|
|
|
9376
9470
|
function createFarmLayoutElement(Component, pattern, children, params) {
|
|
9471
|
+
if (typeof React.markFunctionComponent === "function") {
|
|
9472
|
+
return farmLayoutBoundaryElement(
|
|
9473
|
+
pattern,
|
|
9474
|
+
React.createElement(Component, { children: children, params: params }),
|
|
9475
|
+
);
|
|
9476
|
+
}
|
|
9377
9477
|
return React.createElement(
|
|
9378
9478
|
FarmLayoutBoundary,
|
|
9379
9479
|
{ key: farmLayoutComponentKey(Component), component: Component, pattern: pattern, params: params },
|
|
@@ -10161,7 +10261,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
10161
10261
|
}
|
|
10162
10262
|
__name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
10163
10263
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
10164
|
-
return import("./devtools-
|
|
10264
|
+
return import("./devtools-JYJNOLPQ.mjs");
|
|
10165
10265
|
}
|
|
10166
10266
|
__name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
10167
10267
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -11069,6 +11169,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11069
11169
|
layoutCount: discoveredRoutes.filter((r) => r.kind === "layout").length
|
|
11070
11170
|
});
|
|
11071
11171
|
}
|
|
11172
|
+
const dispatchToDevServer = createFarmDevServerDispatch(server);
|
|
11072
11173
|
apiRouteManager = new APIRouteManager(appDirs, server, {
|
|
11073
11174
|
plugins: farmConfig.plugins,
|
|
11074
11175
|
i18n: farmApp.getI18nRuntime(),
|
|
@@ -11079,7 +11180,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11079
11180
|
dispatch: /* @__PURE__ */ __name((request2) => {
|
|
11080
11181
|
const url = new URL(request2.url);
|
|
11081
11182
|
url.pathname = applyFarmBasePath(url.pathname, farmConfig.basePath);
|
|
11082
|
-
return
|
|
11183
|
+
return dispatchToDevServer(new Request(url, request2));
|
|
11083
11184
|
}, "dispatch")
|
|
11084
11185
|
});
|
|
11085
11186
|
await apiRouteManager.discoverRoutes();
|
|
@@ -11124,6 +11225,9 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11124
11225
|
apiServerBasePath
|
|
11125
11226
|
);
|
|
11126
11227
|
await middlewareManager.discover();
|
|
11228
|
+
farmApp.getServerRenderer().setMiddlewareRouteLookup(
|
|
11229
|
+
() => middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
|
|
11230
|
+
);
|
|
11127
11231
|
if (pm) {
|
|
11128
11232
|
for (const middleware of middlewareManager.getMiddlewares()) {
|
|
11129
11233
|
await pm.runHookParallel("middlewareDiscovered", {
|
|
@@ -11165,6 +11269,13 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11165
11269
|
return resolveFarmLayoutFonts(layoutModules);
|
|
11166
11270
|
}, "resolveDocsLayoutFonts");
|
|
11167
11271
|
releaseDocsMCPServers();
|
|
11272
|
+
const isFarmDocsPathGuarded = /* @__PURE__ */ __name((href) => farmPathGuardCoversPage(
|
|
11273
|
+
{
|
|
11274
|
+
config: farmConfig,
|
|
11275
|
+
middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
|
|
11276
|
+
},
|
|
11277
|
+
href
|
|
11278
|
+
), "isFarmDocsPathGuarded");
|
|
11168
11279
|
const farmDocsHandler = farmDocsDevRuntime ? farmDocsDevRuntime.hasFarmDocsRuntimeAdapter(farmConfig.docs) ? await farmDocsDevRuntime.createFarmDocsAdapterHandler(farmConfig.docs, {
|
|
11169
11280
|
root: farmConfig.root,
|
|
11170
11281
|
srcDir: farmConfig.srcDir,
|
|
@@ -11192,7 +11303,8 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11192
11303
|
docsMCPServerDisposers.delete(dispose);
|
|
11193
11304
|
dispose();
|
|
11194
11305
|
};
|
|
11195
|
-
}, "registerMCPServer")
|
|
11306
|
+
}, "registerMCPServer"),
|
|
11307
|
+
isPathGuarded: isFarmDocsPathGuarded
|
|
11196
11308
|
}) : farmDocsDevRuntime.createFarmDocsHandler(farmConfig.docs, {
|
|
11197
11309
|
root: farmConfig.root,
|
|
11198
11310
|
srcDir: farmConfig.srcDir,
|
|
@@ -11203,7 +11315,8 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11203
11315
|
globalStylesheetHref: resolveDevGlobalStylesheetHref(
|
|
11204
11316
|
farmConfig.root,
|
|
11205
11317
|
farmConfig.srcDir
|
|
11206
|
-
)
|
|
11318
|
+
),
|
|
11319
|
+
isPathGuarded: isFarmDocsPathGuarded
|
|
11207
11320
|
}) : null;
|
|
11208
11321
|
const wrapFarmDocsResponseWithLayouts = /* @__PURE__ */ __name(async (request2, response) => {
|
|
11209
11322
|
if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !response.headers.get("content-type")?.toLowerCase().includes("text/html")) {
|
|
@@ -11311,7 +11424,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11311
11424
|
rootDir: farmConfig.root,
|
|
11312
11425
|
srcDir: farmConfig.srcDir,
|
|
11313
11426
|
docs: farmConfig.docs,
|
|
11314
|
-
diagnostics: true
|
|
11427
|
+
diagnostics: true,
|
|
11428
|
+
isPathGuarded: isFarmDocsPathGuarded
|
|
11315
11429
|
}) : null;
|
|
11316
11430
|
const farmDocsFontAssets = new Map(
|
|
11317
11431
|
farmDocsFontAssetList.map(({ url, sourcePath }) => [url, sourcePath])
|
|
@@ -11505,7 +11619,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11505
11619
|
// Read again on each request; unchanged files come from a cache.
|
|
11506
11620
|
webmcpTools: farmConfig.plugins?.some(({ name }) => name === "farm:webmcp") ? collectFarmWebMCPTools(farmConfig.root ?? process.cwd(), farmConfig.srcDir) : []
|
|
11507
11621
|
}),
|
|
11508
|
-
defaultMCP: /* @__PURE__ */ __name(() => farmApp.getServerRenderer().getDefaultMCPServer(), "defaultMCP")
|
|
11622
|
+
defaultMCP: /* @__PURE__ */ __name(() => farmApp.getServerRenderer().getDefaultMCPServer(), "defaultMCP"),
|
|
11623
|
+
// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
11624
|
+
guardCoversPath: /* @__PURE__ */ __name((path22) => farmPathGuardCoversEndpoint(
|
|
11625
|
+
{
|
|
11626
|
+
config: farmConfig,
|
|
11627
|
+
middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
|
|
11628
|
+
},
|
|
11629
|
+
path22,
|
|
11630
|
+
apiServerBasePath
|
|
11631
|
+
), "guardCoversPath")
|
|
11509
11632
|
}
|
|
11510
11633
|
);
|
|
11511
11634
|
await sendWebResponse(res, manifest);
|
|
@@ -11592,11 +11715,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11592
11715
|
};
|
|
11593
11716
|
}, "resolveSource"),
|
|
11594
11717
|
// The anonymous check goes through this server, so its guards and
|
|
11595
|
-
// middleware see the page's own path, as in production.
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11718
|
+
// middleware see the page's own path, as in production. It connects to
|
|
11719
|
+
// this server's own listener, never the host the caller's Host names.
|
|
11720
|
+
renderPage: /* @__PURE__ */ __name(async (request2) => createFarmDevServerDispatch(server)(
|
|
11721
|
+
new Request(request2, {
|
|
11722
|
+
signal: res.destroyed ? AbortSignal.abort() : createFarmNodeRequestAbortSignal(req, res)
|
|
11723
|
+
})
|
|
11724
|
+
), "renderPage")
|
|
11600
11725
|
});
|
|
11601
11726
|
if (markdownSourceResponse) {
|
|
11602
11727
|
if (await runAppMiddlewareForContentRoute()) return;
|
|
@@ -11610,14 +11735,21 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11610
11735
|
}),
|
|
11611
11736
|
config: farmApp.getConfig().md,
|
|
11612
11737
|
routeExists: /* @__PURE__ */ __name((pathname2) => Boolean(farmApp.getRouteManager().matchRoute(pathname2).route), "routeExists"),
|
|
11613
|
-
//
|
|
11614
|
-
//
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11738
|
+
// The page is rendered by this server's own listener, never the host the
|
|
11739
|
+
// caller's Host names. Redirects are not followed, so the mirror answers with
|
|
11740
|
+
// the page's own (a sign-in gate, say), as production does.
|
|
11741
|
+
renderPage: /* @__PURE__ */ __name(async (request2) => {
|
|
11742
|
+
const headers = new Headers(request2.headers);
|
|
11743
|
+
headers.delete("accept-encoding");
|
|
11744
|
+
return createFarmDevServerDispatch(server)(
|
|
11745
|
+
new Request(request2, {
|
|
11746
|
+
headers,
|
|
11747
|
+
// Only accepted mirrors need disconnect listeners. An earlier
|
|
11748
|
+
// close (for example while the docs handler ran) must also abort.
|
|
11749
|
+
signal: res.destroyed ? AbortSignal.abort() : createFarmNodeRequestAbortSignal(req, res)
|
|
11750
|
+
})
|
|
11751
|
+
);
|
|
11752
|
+
}, "renderPage"),
|
|
11621
11753
|
apiServerBasePath
|
|
11622
11754
|
});
|
|
11623
11755
|
if (markdownResponse) {
|