@farm.js/core 0.1.65 → 0.1.67
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-handler-QLFDDTYN.mjs → agent-mcp-handler-AZ7QW4UP.mjs} +5 -5
- package/dist/{agent-mcp-handler-OXT73ZBY.cjs → agent-mcp-handler-FER4MQDF.cjs} +6 -6
- package/dist/{agent-mcp.d-QD2WZ9BS.d.ts → agent-mcp.d-BFu9xHAi.d.ts} +1 -1
- package/dist/{agent-mcp.d-CO_ABmNK.d.mts → agent-mcp.d-DWyWkTSy.d.mts} +1 -1
- package/dist/agent-runtime.cjs +6 -5
- package/dist/agent-runtime.d.mts +6 -6
- package/dist/agent-runtime.d.ts +6 -6
- package/dist/agent-runtime.mjs +5 -4
- package/dist/analyzer-KVZGVY5Q.cjs +16 -0
- package/dist/{analyzer-PE33SK5W.mjs → analyzer-TTIIXXMQ.mjs} +3 -3
- package/dist/api/client.cjs +12 -2
- package/dist/api/client.d.mts +4 -4
- package/dist/api/client.d.ts +4 -4
- package/dist/api/client.mjs +12 -2
- package/dist/api/client.native.cjs +12 -2
- package/dist/api/client.native.d.mts +5 -5
- package/dist/api/client.native.d.ts +5 -5
- package/dist/api/client.native.mjs +12 -2
- package/dist/api/node.cjs +223 -0
- package/dist/api/node.d.mts +59 -0
- package/dist/api/node.d.ts +59 -0
- package/dist/api/node.mjs +223 -0
- package/dist/api/route-manager.cjs +11 -11
- package/dist/api/route-manager.d.mts +10 -9
- package/dist/api/route-manager.d.ts +10 -9
- package/dist/api/route-manager.mjs +10 -10
- package/dist/api/runtime.cjs +11 -7
- package/dist/api/runtime.d.mts +7 -7
- package/dist/api/runtime.d.ts +7 -7
- package/dist/api/runtime.mjs +10 -6
- package/dist/{api-client.d-BNLXNCXJ.d.mts → api-client.d-Bp35zMqR.d.mts} +1 -1
- package/dist/{api-client.d-ddQBNGtu.d.ts → api-client.d-CFI_xL0V.d.ts} +1 -1
- package/dist/api.cjs +17 -13
- package/dist/api.d.mts +11 -10
- package/dist/api.d.ts +11 -10
- package/dist/api.mjs +16 -12
- package/dist/{app-manifest.d-BpKxiU_E.d.mts → app-manifest.d-CRmjN5j9.d.mts} +1 -1
- package/dist/{app-manifest.d-DDmNkYQQ.d.ts → app-manifest.d-CwfhGrVR.d.ts} +1 -1
- package/dist/app-markdown.cjs +5 -5
- package/dist/app-markdown.d.mts +7 -7
- package/dist/app-markdown.d.ts +7 -7
- package/dist/app-markdown.mjs +4 -4
- package/dist/{app.d-x68Cwr0_.d.ts → app.d-BX9LVTiP.d.ts} +50 -9
- package/dist/{app.d-kuoVWhWM.d.mts → app.d-uBBUxwyV.d.mts} +50 -9
- package/dist/{chunk-V56632LA.cjs → chunk-22IWL4YD.cjs} +19 -5
- package/dist/{chunk-CZF4XIRZ.cjs → chunk-23PVOIPT.cjs} +3 -3
- package/dist/{chunk-5C7XMKQ4.cjs → chunk-2AFW7673.cjs} +6 -1
- package/dist/{chunk-SYW346ZN.cjs → chunk-2LHZD3OP.cjs} +1 -21
- package/dist/{chunk-ZZI56IUY.mjs → chunk-2ZOYOYEE.mjs} +13 -13
- package/dist/{chunk-RVGSVQWT.mjs → chunk-3T5TLFCQ.mjs} +10 -5
- package/dist/{chunk-XBSKPLHF.cjs → chunk-3T7ALZJF.cjs} +2 -2
- package/dist/{chunk-JCEFKP5M.mjs → chunk-423SSBYQ.mjs} +6 -0
- package/dist/{chunk-7QVRWGBL.cjs → chunk-4DRINDGN.cjs} +319 -138
- package/dist/{chunk-O6L3YYPM.cjs → chunk-4E57QHPW.cjs} +8 -16
- package/dist/{chunk-WKPBIT5Q.cjs → chunk-4HGLJOXZ.cjs} +6 -6
- package/dist/{chunk-JGAE5XPL.cjs → chunk-4JX3M4C6.cjs} +2 -1
- package/dist/{chunk-CJNAUEVC.mjs → chunk-4QENVMG7.mjs} +1 -1
- package/dist/{chunk-IMK32ERL.cjs → chunk-556H7JCE.cjs} +65 -48
- package/dist/{chunk-OLIGNTWU.cjs → chunk-5NFQ6AZI.cjs} +7 -7
- package/dist/{chunk-6HRAK7I5.mjs → chunk-5OFNUETM.mjs} +8 -2
- package/dist/{chunk-TZVUF5JJ.mjs → chunk-5TA63JD3.mjs} +4 -4
- package/dist/{chunk-RD623KW4.cjs → chunk-67MZTLTF.cjs} +21 -3
- package/dist/chunk-6I4BFRE7.cjs +51 -0
- package/dist/{chunk-OSFIUSYK.cjs → chunk-6R53ZWX2.cjs} +7 -7
- package/dist/{chunk-MGKW5XZE.cjs → chunk-6SQZXRJ2.cjs} +7 -7
- package/dist/{chunk-WNXVWXG3.cjs → chunk-6V5YWI4W.cjs} +2 -2
- package/dist/{chunk-BM2LH2JM.mjs → chunk-6YBYX4K4.mjs} +13 -12
- package/dist/{chunk-X3XUZWRB.mjs → chunk-724MGMIL.mjs} +17 -3
- package/dist/{chunk-K5EW7GUU.mjs → chunk-7BIW7VCW.mjs} +13 -5
- package/dist/{chunk-HPP2II4Z.mjs → chunk-7PJARAQQ.mjs} +1 -1
- package/dist/{chunk-LEJDW34D.cjs → chunk-7PPLTD3P.cjs} +3 -3
- package/dist/{chunk-TGULJSHD.mjs → chunk-AJNBTOVQ.mjs} +20 -9
- package/dist/{chunk-FBEBSAVI.cjs → chunk-AKIQ54FK.cjs} +82 -63
- package/dist/{chunk-2NGZFOKG.mjs → chunk-AOIUYHPH.mjs} +2 -2
- package/dist/{chunk-ZEXE4TGY.mjs → chunk-AQDLVHNF.mjs} +230 -110
- package/dist/{chunk-NKRZLQUK.mjs → chunk-AQIO3RNL.mjs} +1 -1
- package/dist/chunk-AQIRXBBY.cjs +26 -0
- package/dist/chunk-AZ6IW6SF.mjs +28 -0
- package/dist/{chunk-QMDU6QHN.mjs → chunk-B6RBJJ5G.mjs} +1 -1
- package/dist/{chunk-I32V5CZL.cjs → chunk-BDYM2TN3.cjs} +28 -17
- package/dist/{chunk-JLDNXURZ.cjs → chunk-BZWTBELF.cjs} +32 -32
- package/dist/{chunk-ITV4QQL2.cjs → chunk-C6CUUBY5.cjs} +14 -3
- package/dist/{chunk-V727H3RI.cjs → chunk-CCAUIBIS.cjs} +6 -0
- package/dist/{chunk-YN6BHOYY.cjs → chunk-CL52PD6D.cjs} +10 -3
- package/dist/{chunk-ZX2JHEWW.mjs → chunk-CO3YMZFD.mjs} +20 -9
- package/dist/{chunk-XURDCXNH.cjs → chunk-CSLHNBPS.cjs} +6 -6
- package/dist/{chunk-CNNBFGL5.cjs → chunk-DB2HSHQA.cjs} +14 -14
- package/dist/{chunk-XQSYOVCW.cjs → chunk-DBYNZIIQ.cjs} +13 -5
- package/dist/{chunk-32RPJAAS.cjs → chunk-DCXSIEFE.cjs} +40 -41
- package/dist/{chunk-D4MRNBVF.cjs → chunk-DGOFR7D5.cjs} +2 -2
- package/dist/{chunk-QTD6EMN2.mjs → chunk-DQ2DI3Y7.mjs} +11 -4
- package/dist/chunk-DXZ57EPE.mjs +375 -0
- package/dist/{chunk-SA7MLSP4.mjs → chunk-E3HDJCWF.mjs} +3 -3
- package/dist/{chunk-EFZGB7JC.cjs → chunk-E5UN4OWX.cjs} +1 -0
- package/dist/{chunk-HKNYNSOK.mjs → chunk-E6CD45JK.mjs} +30 -31
- package/dist/{chunk-752XUZIM.cjs → chunk-EGIY4A7V.cjs} +6 -6
- package/dist/chunk-EIVGPQN5.mjs +51 -0
- package/dist/{chunk-KPAJWD3N.mjs → chunk-EYPSKXO4.mjs} +1 -1
- package/dist/{chunk-E552H232.cjs → chunk-F43OG25P.cjs} +1 -1
- package/dist/{chunk-UAQD67HM.mjs → chunk-F7JKVHU2.mjs} +1 -1
- package/dist/{chunk-QISW423S.cjs → chunk-FPBOAG6N.cjs} +2 -2
- package/dist/{chunk-2C5L5RPM.cjs → chunk-FT6KJHS3.cjs} +71 -38
- package/dist/{chunk-ES2LD2YD.mjs → chunk-GCRT6GJG.mjs} +18 -0
- package/dist/{chunk-5OJVKXFV.cjs → chunk-GDM3ZD2O.cjs} +10 -8
- package/dist/{chunk-EMDGXYUD.mjs → chunk-GJ7QVFAG.mjs} +16 -7
- package/dist/{chunk-TGSEVBPO.mjs → chunk-GJEC5S4V.mjs} +11 -0
- package/dist/{chunk-ZAUOOGER.mjs → chunk-GTV2ABO7.mjs} +218 -37
- package/dist/{chunk-72JSHQQQ.mjs → chunk-H37MDCPR.mjs} +1 -1
- package/dist/{chunk-HNAISJFD.cjs → chunk-HDPT6OYE.cjs} +9 -3
- package/dist/{chunk-25T5VXOE.mjs → chunk-HFHJJXSV.mjs} +106 -19
- package/dist/{chunk-ZNH6NR3H.cjs → chunk-HJZZSBVK.cjs} +2 -2
- package/dist/{chunk-A3G5IY2W.cjs → chunk-HM7AGSKU.cjs} +1 -1
- package/dist/{chunk-GL7N5UHF.cjs → chunk-HNVAZGQD.cjs} +20 -9
- package/dist/{chunk-GRBJ7VKH.mjs → chunk-HP2DQGQH.mjs} +1 -1
- package/dist/{chunk-E2TSYUHV.mjs → chunk-HRPTMX5C.mjs} +4 -4
- package/dist/{chunk-K7OZAVOI.mjs → chunk-IFR74W6S.mjs} +46 -13
- package/dist/{chunk-5A77OEIG.cjs → chunk-IHTDLCDJ.cjs} +5 -5
- package/dist/{chunk-VQJHT2ND.mjs → chunk-IRA2CZAY.mjs} +2 -2
- package/dist/{chunk-OYZXVBZP.cjs → chunk-IUKBPBM7.cjs} +2 -1
- package/dist/chunk-J6TZRYCO.cjs +22 -0
- package/dist/{chunk-WYAXRIYP.cjs → chunk-J7JHVCWA.cjs} +8 -8
- package/dist/chunk-JSOCDYER.cjs +375 -0
- package/dist/{chunk-YUW7F6SK.mjs → chunk-JVM3DKZE.mjs} +3 -3
- package/dist/{chunk-UPYIFH2H.cjs → chunk-JWLRBDDC.cjs} +2 -2
- package/dist/{chunk-BQWBHWEW.mjs → chunk-JWSI5WO4.mjs} +1 -1
- package/dist/{chunk-OLGQZRW6.mjs → chunk-JZBU7V4D.mjs} +37 -17
- package/dist/{chunk-ONG4RDW3.mjs → chunk-JZGL2PIH.mjs} +13 -3
- package/dist/chunk-K63OWRY2.mjs +22 -0
- package/dist/{chunk-TUPKMMXT.mjs → chunk-K6HIIWUB.mjs} +1 -1
- package/dist/{chunk-MESQF2JC.mjs → chunk-K6SXMVXO.mjs} +2 -2
- package/dist/{chunk-L2JG337G.cjs → chunk-K6VFYFOY.cjs} +33 -31
- package/dist/{chunk-3CCAICF7.cjs → chunk-KCY52OUQ.cjs} +4 -4
- package/dist/{chunk-EZ34EHQP.mjs → chunk-KI3MU7B5.mjs} +1 -1
- package/dist/{chunk-GHNW564E.mjs → chunk-KSZK34HU.mjs} +30 -10
- package/dist/{chunk-RFKTJTWZ.mjs → chunk-KWFNUODD.mjs} +2 -1
- package/dist/{chunk-ECKQFEX2.mjs → chunk-LENKRGBV.mjs} +8 -6
- package/dist/{chunk-C7DCMGC4.cjs → chunk-LPIZMU7D.cjs} +12 -12
- package/dist/{chunk-HEPJIKKQ.cjs → chunk-MCSRMEQV.cjs} +2 -2
- package/dist/{chunk-DQF3QLOH.mjs → chunk-ME7RVELR.mjs} +3 -2
- package/dist/{chunk-3KJPIO5D.cjs → chunk-N5DQMOAG.cjs} +589 -678
- package/dist/{chunk-O4F3JUST.mjs → chunk-NDDRTFN4.mjs} +4 -0
- package/dist/{chunk-CBOEJ5Z4.cjs → chunk-OB3IFUK6.cjs} +133 -46
- package/dist/{chunk-R62SF5R4.mjs → chunk-OB45EAQL.mjs} +6 -1
- package/dist/{chunk-SYXPWJ7N.cjs → chunk-OFBLGH6V.cjs} +17 -18
- package/dist/{chunk-VQ4NWOWO.mjs → chunk-OGVTUGMU.mjs} +5 -13
- package/dist/{chunk-3UZVPO72.mjs → chunk-OIOPQ25L.mjs} +6 -7
- package/dist/{chunk-2XGBJSDV.cjs → chunk-OO7DYIJD.cjs} +73 -24
- package/dist/{chunk-IP2KHSGF.mjs → chunk-P2NBQ5JI.mjs} +57 -4
- package/dist/{chunk-ZQQK4U66.cjs → chunk-PDFFYZAT.cjs} +72 -19
- package/dist/{chunk-GSVJ3IIF.cjs → chunk-PHCJJJZV.cjs} +2 -2
- package/dist/{chunk-EVMXPJCB.mjs → chunk-PKMUQ7LM.mjs} +2 -1
- package/dist/{chunk-YD4J37RN.cjs → chunk-PL6RTBDE.cjs} +30 -19
- package/dist/{chunk-OAJOQU5J.mjs → chunk-PLJKJJ2H.mjs} +82 -63
- package/dist/{chunk-WMTBBQHY.cjs → chunk-PPX7UOFY.cjs} +271 -151
- package/dist/{chunk-6XQSPIN6.cjs → chunk-PWKAX5MS.cjs} +13 -3
- package/dist/{chunk-7XGWBPQQ.cjs → chunk-Q37INCXG.cjs} +13 -8
- package/dist/{chunk-T4M52BA5.cjs → chunk-Q5UX55YA.cjs} +1457 -612
- package/dist/{chunk-53ZCZ46B.cjs → chunk-QGQP6QKO.cjs} +4 -3
- package/dist/{chunk-TZOGZKI7.cjs → chunk-QITSS4TD.cjs} +1381 -626
- package/dist/{chunk-4ZJ5C7UJ.cjs → chunk-QIXEU2WV.cjs} +19 -10
- package/dist/{chunk-HCGWDRZO.mjs → chunk-QJVW76JG.mjs} +17 -6
- package/dist/{chunk-FJWN7RV4.cjs → chunk-QO43L7Z4.cjs} +38 -8
- package/dist/{chunk-ZIHWAN55.cjs → chunk-RE5E2G5S.cjs} +1 -1
- package/dist/chunk-RWR7SMD7.cjs +50 -0
- package/dist/{chunk-7PTISZSQ.cjs → chunk-S7MWSFFP.cjs} +4 -0
- package/dist/chunk-SD6JGJOM.mjs +50 -0
- package/dist/{chunk-7H4SVNC4.cjs → chunk-SPP3EZTJ.cjs} +46 -26
- package/dist/{chunk-E4RDMG3K.mjs → chunk-TEG6HJVF.mjs} +4 -4
- package/dist/{chunk-WAY6LOQH.mjs → chunk-TEJ67GD2.mjs} +1 -1
- package/dist/{chunk-ZNXTU4YH.mjs → chunk-TM2E623I.mjs} +1 -0
- package/dist/{chunk-IFTGERT3.mjs → chunk-TTXIITYA.mjs} +49 -0
- package/dist/{chunk-ZFWYCVKS.mjs → chunk-TY5KCYDE.mjs} +22 -4
- package/dist/{chunk-W2ZXMMHA.mjs → chunk-UHE5JUKB.mjs} +1 -1
- package/dist/{chunk-6X5NKNBE.mjs → chunk-UHNSY2PQ.mjs} +1304 -459
- package/dist/{chunk-UJ3R2AH2.cjs → chunk-UPOYKX4S.cjs} +5 -5
- package/dist/{chunk-2DLGV2ZG.mjs → chunk-UTUS6JUH.mjs} +1 -21
- package/dist/{chunk-Q75QPLBA.mjs → chunk-V5MQMQ2P.mjs} +1 -1
- package/dist/{chunk-TRIDJQ6A.cjs → chunk-V5RTHYJB.cjs} +30 -10
- package/dist/{chunk-QHRCR44V.mjs → chunk-VK54PDQ6.mjs} +25 -5
- package/dist/{chunk-LQNW3ABP.cjs → chunk-VX2HZGC7.cjs} +14 -14
- package/dist/{chunk-2L54YV25.mjs → chunk-WDD5CTZW.mjs} +49 -32
- package/dist/{chunk-7GYCZRTH.mjs → chunk-WGHY3OL5.mjs} +355 -444
- package/dist/{chunk-A2MN5PQJ.mjs → chunk-WMLSZAKN.mjs} +9 -9
- package/dist/{chunk-3EEET2Q5.cjs → chunk-WUTFJOV7.cjs} +32 -12
- package/dist/chunk-WVQNXXNE.cjs +28 -0
- package/dist/{chunk-Y5TOT5F6.cjs → chunk-X3MHKLCO.cjs} +5 -5
- package/dist/{chunk-Z7P2BTZ3.cjs → chunk-XGTFLG73.cjs} +30 -12
- package/dist/{chunk-VHHLKIDZ.mjs → chunk-XNZWMXCF.mjs} +1090 -335
- package/dist/{chunk-FIR62CR3.mjs → chunk-XUES6OET.mjs} +1 -1
- package/dist/{chunk-XCXHQBMM.mjs → chunk-Y2LU4LE5.mjs} +1 -1
- package/dist/{chunk-5J45H65F.mjs → chunk-Y5LEPEVH.mjs} +1 -1
- package/dist/{chunk-BT4SEFLC.cjs → chunk-YAEN3L2F.cjs} +3 -2
- package/dist/chunk-YFTGIHNC.mjs +26 -0
- package/dist/{chunk-KL7SHLQB.mjs → chunk-YGJ5P3TJ.mjs} +31 -1
- package/dist/{chunk-UYRI6U3P.mjs → chunk-YQYTQJZN.mjs} +3 -2
- package/dist/{chunk-X4K7TYN6.cjs → chunk-YVTS3S3F.cjs} +24 -23
- package/dist/{chunk-72KABRWN.mjs → chunk-ZJGFAW5U.mjs} +5 -3
- package/dist/{chunk-TNBJ4LZG.mjs → chunk-ZPKJPM7K.mjs} +4 -4
- package/dist/client/lifecycle.cjs +2 -2
- package/dist/client/lifecycle.d.mts +1 -1
- package/dist/client/lifecycle.d.ts +1 -1
- package/dist/client/lifecycle.mjs +1 -1
- package/dist/{client-component.d-D74pqdea.d.mts → client-component.d-CDRvRmbU.d.mts} +2 -2
- package/dist/{client-component.d-D8VcypQA.d.ts → client-component.d-DWRKyAp5.d.ts} +2 -2
- package/dist/client-plugins.cjs +2 -2
- package/dist/{client-plugins.d-D4-6hNx7.d.mts → client-plugins.d-BNILjfX3.d.mts} +94 -140
- package/dist/{client-plugins.d-CXElzotB.d.ts → client-plugins.d-CrKZiNSN.d.ts} +94 -140
- package/dist/client-plugins.d.mts +6 -6
- package/dist/client-plugins.d.ts +6 -6
- package/dist/client-plugins.mjs +1 -1
- package/dist/client.cjs +11 -9
- package/dist/client.d.mts +13 -13
- package/dist/client.d.ts +13 -13
- package/dist/client.mjs +10 -8
- package/dist/{config.d-qt-mE8O5.d.mts → config.d-BKIhJtmr.d.mts} +7 -2
- package/dist/{config.d-qt-mE8O5.d.ts → config.d-BKIhJtmr.d.ts} +7 -2
- package/dist/config.d.mts +6 -6
- package/dist/config.d.ts +6 -6
- package/dist/cron.cjs +2 -2
- package/dist/cron.mjs +1 -1
- package/dist/deferred.cjs +2 -2
- package/dist/deferred.mjs +1 -1
- package/dist/deployment.cjs +2 -2
- package/dist/deployment.mjs +1 -1
- package/dist/desktop.d.mts +7 -7
- package/dist/desktop.d.ts +7 -7
- package/dist/{devtools-SGYOG36E.cjs → devtools-RZVT4JVN.cjs} +36 -32
- package/dist/{devtools-PUVZB3F2.mjs → devtools-UFQYT3VA.mjs} +31 -27
- package/dist/docs.cjs +26 -25
- package/dist/docs.d.mts +20 -8
- package/dist/docs.d.ts +20 -8
- package/dist/docs.mjs +25 -24
- package/dist/env-types.cjs +3 -3
- package/dist/env-types.mjs +2 -2
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.mjs +4 -4
- package/dist/headers.cjs +3 -3
- package/dist/headers.mjs +2 -2
- 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.d-CeDgNyX4.d.mts → image-config.d-ByhQ0TT7.d.mts} +3 -1
- package/dist/{image-config.d-CeDgNyX4.d.ts → image-config.d-ByhQ0TT7.d.ts} +3 -1
- package/dist/image.cjs +6 -6
- package/dist/image.d.mts +1 -1
- package/dist/image.d.ts +1 -1
- package/dist/image.mjs +1 -1
- package/dist/index.cjs +143 -128
- package/dist/{index.d-SSgYDv4D.d.mts → index.d-Bdm6866n.d.mts} +1 -1
- package/dist/{index.d-A_x10zGS.d.ts → index.d-Dey5T14f.d.ts} +1 -1
- package/dist/index.d.mts +31 -82
- package/dist/index.d.ts +31 -82
- package/dist/index.mjs +214 -199
- package/dist/{integration-orm-52GPGTHO.cjs → integrations/orm.cjs} +5 -5
- package/dist/integrations/orm.d.mts +33 -0
- package/dist/integrations/orm.d.ts +33 -0
- package/dist/{integration-orm-CO23MSFE.mjs → integrations/orm.mjs} +5 -5
- package/dist/integrations.cjs +6 -5
- package/dist/integrations.d.mts +6 -6
- package/dist/integrations.d.ts +6 -6
- package/dist/integrations.mjs +5 -4
- package/dist/internal/app-markdown-runtime.cjs +4 -4
- package/dist/internal/app-markdown-runtime.d.mts +17 -8
- package/dist/internal/app-markdown-runtime.d.ts +17 -8
- package/dist/internal/app-markdown-runtime.mjs +3 -3
- package/dist/internal/build-runtime.cjs +70 -68
- package/dist/internal/build-runtime.d.mts +8 -8
- package/dist/internal/build-runtime.d.ts +8 -8
- package/dist/internal/build-runtime.mjs +69 -67
- package/dist/internal/cli-runtime.cjs +45 -44
- package/dist/internal/cli-runtime.mjs +44 -43
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +60 -6
- package/dist/internal/client-runtime.d.mts +40 -11
- package/dist/internal/client-runtime.d.ts +40 -11
- package/dist/internal/client-runtime.mjs +58 -4
- package/dist/internal/compression-runtime.d.mts +6 -6
- package/dist/internal/compression-runtime.d.ts +6 -6
- package/dist/internal/config-runtime.cjs +25 -24
- package/dist/internal/config-runtime.d.mts +9 -9
- package/dist/internal/config-runtime.d.ts +9 -9
- package/dist/internal/config-runtime.mjs +24 -23
- package/dist/internal/docs-precompiled-runtime.cjs +16 -5
- package/dist/internal/docs-precompiled-runtime.d.mts +7 -0
- package/dist/internal/docs-precompiled-runtime.d.ts +7 -0
- package/dist/internal/docs-precompiled-runtime.mjs +15 -4
- package/dist/internal/infra-analytics-runtime.cjs +11 -11
- package/dist/internal/infra-analytics-runtime.mjs +9 -9
- package/dist/internal/islands-runtime.cjs +33 -4
- package/dist/internal/islands-runtime.d.mts +1 -1
- package/dist/internal/islands-runtime.d.ts +1 -1
- package/dist/internal/islands-runtime.mjs +31 -2
- package/dist/internal/native-server-fns.cjs +6 -6
- package/dist/internal/native-server-fns.mjs +5 -5
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +54 -40
- package/dist/internal/production-runtime.d.mts +23 -15
- package/dist/internal/production-runtime.d.ts +23 -15
- package/dist/internal/production-runtime.mjs +69 -55
- package/dist/internal/react-cache.cjs +3 -3
- package/dist/internal/react-cache.mjs +1 -1
- package/dist/{lifecycle.d-C2aLBOwu.d.ts → lifecycle.d-keQs5Swc.d.mts} +7 -1
- package/dist/{lifecycle.d-C2aLBOwu.d.mts → lifecycle.d-keQs5Swc.d.ts} +7 -1
- package/dist/{manager-H5ZM3HAM.mjs → manager-JIA66YJ2.mjs} +4 -3
- package/dist/manager-JOHU6BQI.cjs +15 -0
- package/dist/markdown.cjs +7 -3
- package/dist/markdown.d.mts +6 -6
- package/dist/markdown.d.ts +6 -6
- package/dist/markdown.mjs +6 -2
- package/dist/middleware.cjs +10 -10
- package/dist/middleware.d.mts +8 -8
- package/dist/middleware.d.ts +8 -8
- package/dist/middleware.mjs +9 -9
- package/dist/mobile.d.mts +4 -4
- package/dist/mobile.d.ts +4 -4
- package/dist/mount.d-BP0nLYQO.d.mts +38 -0
- package/dist/mount.d-CkiPky_F.d.ts +38 -0
- package/dist/{native-server-fn-handler-GLRHAYWV.mjs → native-server-fn-handler-EP5AFJYE.mjs} +5 -5
- package/dist/{native-server-fn-handler-J5MYRXN6.cjs → native-server-fn-handler-QRTXGZA4.cjs} +6 -6
- package/dist/{native-tree-HE2FLS72.cjs → native-tree-W2SSJB3Y.cjs} +5 -5
- package/dist/{native-tree-YF2DSPKM.mjs → native-tree-Y5YQANW7.mjs} +4 -4
- package/dist/{navigation-delegate.d-DQVYKoaZ.d.mts → navigation-delegate.d-CdBP-hkZ.d.mts} +1 -1
- package/dist/{navigation-delegate.d-GghbHJuK.d.ts → navigation-delegate.d-DchcGzAQ.d.ts} +1 -1
- package/dist/navigation.cjs +8 -7
- package/dist/navigation.d.mts +9 -9
- package/dist/navigation.d.ts +9 -9
- package/dist/navigation.mjs +7 -6
- package/dist/{nitro-DD4QCA66.mjs → nitro-55YOZWRA.mjs} +11 -11
- package/dist/{nitro-VRDX2H4M.cjs → nitro-EEX2J3KB.cjs} +13 -13
- package/dist/{plugin-53SY5YBS.mjs → plugin-SAS22JL7.mjs} +4 -3
- package/dist/{plugin-HZIBL3DW.cjs → plugin-WIU4GDD4.cjs} +5 -4
- package/dist/plugin.cjs +61 -59
- package/dist/plugin.d.mts +8 -8
- package/dist/plugin.d.ts +8 -8
- package/dist/plugin.mjs +60 -58
- package/dist/{port-UFUZL6RI.mjs → port-CLL4BC4O.mjs} +1 -1
- package/dist/{port-VTLHPZOI.cjs → port-HASZTQGY.cjs} +9 -9
- package/dist/{production-runtime.d-Bzns3NW9.d.ts → production-runtime.d-Dou_Htas.d.ts} +1 -1
- package/dist/{production-runtime.d-DiFa5vHW.d.mts → production-runtime.d-VwsBzIee.d.mts} +1 -1
- package/dist/query/client.cjs +9 -7
- package/dist/query/client.mjs +5 -3
- package/dist/{render-plan.d-CL_Ikfg_.d.ts → render-plan.d-D8UakAIk.d.ts} +1 -1
- package/dist/{render-plan.d-CcF0MeCf.d.mts → render-plan.d-LKymStDJ.d.mts} +1 -1
- package/dist/renderer/none/server.cjs +35 -0
- package/dist/renderer/none/server.d.mts +21 -0
- package/dist/renderer/none/server.d.ts +21 -0
- package/dist/renderer/none/server.mjs +35 -0
- package/dist/renderer/react/server.cjs +2 -2
- package/dist/renderer/react/server.mjs +3 -3
- package/dist/renderer-client.cjs +8 -6
- package/dist/renderer-client.d.mts +9 -9
- package/dist/renderer-client.d.ts +9 -9
- package/dist/renderer-client.mjs +5 -3
- package/dist/renderer.cjs +6 -2
- package/dist/renderer.d.mts +20 -2
- package/dist/renderer.d.ts +20 -2
- package/dist/renderer.mjs +5 -1
- package/dist/request.cjs +2 -2
- package/dist/{request.d-B1RnTLri.d.ts → request.d-B928QjWy.d.ts} +1 -1
- package/dist/{request.d-DarDOCk9.d.mts → request.d-KG-4d2eG.d.mts} +1 -1
- package/dist/request.d.mts +7 -7
- package/dist/request.d.ts +7 -7
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering.d-BTUYCIj4.d.ts → route-rendering.d-DoEe_w9t.d.ts} +1 -1
- package/dist/{route-rendering.d-D_2Ual0-.d.mts → route-rendering.d-NIHQeb4m.d.mts} +1 -1
- package/dist/{route.d-BaVH3V0w.d.mts → route.d-DrXkpvcg.d.mts} +1 -1
- package/dist/{route.d-DBTEqifW.d.ts → route.d-hs-_cyHn.d.ts} +1 -1
- package/dist/{router.d-Cuv1jntg.d.mts → router.d-B8PkJSGp.d.mts} +1 -1
- package/dist/{router.d-CMANF6da.d.ts → router.d-DYnRHQwz.d.ts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/{routes.d-c2HKfrfL.d.mts → routes.d-DgZ_jgGG.d.mts} +1 -1
- package/dist/{routes.d-B6yFe6jm.d.ts → routes.d-uUBZyWoK.d.ts} +1 -1
- package/dist/routes.d.mts +6 -6
- package/dist/routes.d.ts +6 -6
- package/dist/routes.mjs +2 -2
- package/dist/{rsc-pipeline-T3PWURLJ.mjs → rsc-pipeline-4OJ5ZQNZ.mjs} +26 -25
- package/dist/{rsc-pipeline-V4ANLRAA.cjs → rsc-pipeline-7K5H2RPH.cjs} +27 -26
- package/dist/{runtime-LRIQ3XH7.mjs → runtime-U7O3HZOZ.mjs} +62 -36
- package/dist/{runtime-5AROV2C3.cjs → runtime-X52Q7JFR.cjs} +72 -46
- package/dist/{runtime.d-wvh4ngU0.d.mts → runtime.d-BxQIzwfy.d.mts} +11 -3
- package/dist/{runtime.d-C3RQUj6_.d.ts → runtime.d-DP7mEkEF.d.ts} +11 -3
- package/dist/{schema-dev-notice-JMXEQWIQ.mjs → schema-dev-notice-C2JINRZI.mjs} +3 -2
- package/dist/{schema-dev-notice-PLBFDTOF.cjs → schema-dev-notice-X7GG7QVB.cjs} +5 -4
- package/dist/schema.cjs +6 -2
- package/dist/schema.d-Dny9pnrm.d.mts +298 -0
- package/dist/schema.d-Dny9pnrm.d.ts +298 -0
- package/dist/schema.d.mts +1 -115
- package/dist/schema.d.ts +1 -115
- package/dist/schema.mjs +5 -1
- package/dist/server-fn-client.d.mts +2 -2
- package/dist/server-fn-client.d.ts +2 -2
- package/dist/server-fn.cjs +5 -5
- package/dist/server-fn.mjs +4 -4
- package/dist/server-plugins.cjs +7 -7
- package/dist/server-plugins.d.mts +16 -10
- package/dist/server-plugins.d.ts +16 -10
- package/dist/server-plugins.mjs +8 -8
- package/dist/server-query.cjs +6 -6
- package/dist/server-query.mjs +5 -5
- package/dist/server.cjs +160 -120
- package/dist/server.d.mts +20 -14
- package/dist/server.d.ts +20 -14
- package/dist/server.mjs +138 -98
- package/dist/{spa-router.d-WU_qS5gJ.d.mts → spa-router.d-BgHPVMhz.d.mts} +15 -5
- package/dist/{spa-router.d-m8H_Kl_B.d.ts → spa-router.d-DsFDHTsv.d.ts} +15 -5
- package/dist/testing.cjs +17 -17
- package/dist/testing.d.mts +6 -6
- package/dist/testing.d.ts +6 -6
- package/dist/testing.mjs +13 -13
- package/dist/theme/server.cjs +3 -3
- package/dist/theme/server.mjs +2 -2
- package/dist/{utils.d-W9IiEqmW.d.mts → utils.d-BKyKDBR1.d.mts} +1 -1
- package/dist/{utils.d-C9dQD5Zg.d.ts → utils.d-zxAVcf_V.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +63 -61
- package/dist/vite.d.mts +32 -12
- package/dist/vite.d.ts +32 -12
- package/dist/vite.mjs +62 -60
- package/dist/workflows.cjs +4 -4
- package/dist/workflows.mjs +3 -3
- package/package.json +31 -1
- package/dist/analyzer-GHWK46LX.cjs +0 -16
- package/dist/chunk-5YPBFMBN.cjs +0 -19
- package/dist/chunk-OM7WILES.mjs +0 -100
- package/dist/chunk-Q5B4LNON.mjs +0 -19
- package/dist/chunk-QPJ4MZTO.mjs +0 -60
- package/dist/chunk-R53QDV6T.cjs +0 -100
- package/dist/chunk-UYTAP4FQ.cjs +0 -60
- package/dist/manager-2LUKNX2N.cjs +0 -14
- /package/dist/{chunk-QGOZLGVP.mjs → chunk-I6FIAWNT.mjs} +0 -0
- /package/dist/{chunk-XPIPMWY3.cjs → chunk-K5NI5YQR.cjs} +0 -0
- /package/dist/{chunk-NWUHS6GV.cjs → chunk-QEJWNXRI.cjs} +0 -0
- /package/dist/{chunk-FSXSQQTV.mjs → chunk-TXE4SAMV.mjs} +0 -0
- /package/dist/{chunk-ZXK2EYQW.cjs → chunk-UUQNJDGH.cjs} +0 -0
- /package/dist/{chunk-46P5KNTE.mjs → chunk-VZBAW44S.mjs} +0 -0
|
@@ -18,10 +18,18 @@ import {
|
|
|
18
18
|
} from "./chunk-22W4FNTG.mjs";
|
|
19
19
|
import {
|
|
20
20
|
farmAcceptQuality
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-IFR74W6S.mjs";
|
|
22
|
+
import {
|
|
23
|
+
isMissingPackageError
|
|
24
|
+
} from "./chunk-NR63PD3P.mjs";
|
|
22
25
|
import {
|
|
23
26
|
matchesFarmIfNoneMatch
|
|
24
27
|
} from "./chunk-QDWMCFTH.mjs";
|
|
28
|
+
import {
|
|
29
|
+
applyFarmBasePath,
|
|
30
|
+
normalizeFarmBasePath,
|
|
31
|
+
stripFarmBasePath
|
|
32
|
+
} from "./chunk-SF3JB56B.mjs";
|
|
25
33
|
|
|
26
34
|
// src/docs/handler.ts
|
|
27
35
|
import {
|
|
@@ -74,13 +82,25 @@ function discoverDocsSourceFiles(contentDir) {
|
|
|
74
82
|
if (existsSync(contentDir)) visit(contentDir);
|
|
75
83
|
return files;
|
|
76
84
|
}
|
|
85
|
+
function readShallowBoundaryCommits(gitRoot) {
|
|
86
|
+
const shallowFile = execFileSync("git", ["-C", gitRoot, "rev-parse", "--git-path", "shallow"], {
|
|
87
|
+
encoding: "utf8",
|
|
88
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
89
|
+
}).trim();
|
|
90
|
+
const shallowPath = path.resolve(gitRoot, shallowFile);
|
|
91
|
+
if (!existsSync(shallowPath)) return /* @__PURE__ */ new Set();
|
|
92
|
+
return new Set(
|
|
93
|
+
readFileSync(shallowPath, "utf8").split(/\r?\n/).map((line) => line.trim()).filter(Boolean)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
77
96
|
function getGitLastModifiedDates(contentDir) {
|
|
78
97
|
try {
|
|
79
98
|
const gitRoot = execFileSync("git", ["-C", contentDir, "rev-parse", "--show-toplevel"], {
|
|
80
99
|
encoding: "utf8",
|
|
81
100
|
stdio: ["ignore", "pipe", "ignore"]
|
|
82
101
|
}).trim();
|
|
83
|
-
if (!gitRoot) return {};
|
|
102
|
+
if (!gitRoot) return { pages: {}, unknown: /* @__PURE__ */ new Set() };
|
|
103
|
+
const boundaryCommits = readShallowBoundaryCommits(gitRoot);
|
|
84
104
|
const contentPathspec = normalizeRelativePath(path.relative(gitRoot, contentDir)) || ".";
|
|
85
105
|
const contentPrefix = contentPathspec === "." ? "" : `${contentPathspec}/`;
|
|
86
106
|
const history = execFileSync(
|
|
@@ -91,7 +111,7 @@ function getGitLastModifiedDates(contentDir) {
|
|
|
91
111
|
"-c",
|
|
92
112
|
"core.quotePath=false",
|
|
93
113
|
"log",
|
|
94
|
-
`--format=${COMMIT_MARKER}%cI`,
|
|
114
|
+
`--format=${COMMIT_MARKER}%H %cI`,
|
|
95
115
|
"--name-only",
|
|
96
116
|
"--",
|
|
97
117
|
contentPathspec
|
|
@@ -103,23 +123,28 @@ function getGitLastModifiedDates(contentDir) {
|
|
|
103
123
|
}
|
|
104
124
|
);
|
|
105
125
|
const pages = {};
|
|
126
|
+
const unknown = /* @__PURE__ */ new Set();
|
|
106
127
|
let commitDate;
|
|
128
|
+
let isBoundaryCommit = false;
|
|
107
129
|
for (const rawLine of history.split(/\r?\n/)) {
|
|
108
130
|
const line = normalizeRelativePath(rawLine.trim());
|
|
109
131
|
if (!line) continue;
|
|
110
132
|
if (line.startsWith(COMMIT_MARKER)) {
|
|
111
|
-
|
|
133
|
+
const [hash, date] = line.slice(COMMIT_MARKER.length).split(" ");
|
|
134
|
+
commitDate = date;
|
|
135
|
+
isBoundaryCommit = boundaryCommits.has(hash);
|
|
112
136
|
continue;
|
|
113
137
|
}
|
|
114
138
|
if (!commitDate || contentPrefix && !line.startsWith(contentPrefix)) continue;
|
|
115
139
|
const relativePath = contentPrefix ? line.slice(contentPrefix.length) : line;
|
|
116
|
-
if (isDocsSourceFile(relativePath)
|
|
117
|
-
|
|
118
|
-
|
|
140
|
+
if (!isDocsSourceFile(relativePath) || pages[relativePath]) continue;
|
|
141
|
+
if (isBoundaryCommit) unknown.add(relativePath);
|
|
142
|
+
else pages[relativePath] = commitDate;
|
|
119
143
|
}
|
|
120
|
-
|
|
144
|
+
for (const relativePath of Object.keys(pages)) unknown.delete(relativePath);
|
|
145
|
+
return { pages, unknown };
|
|
121
146
|
} catch {
|
|
122
|
-
return {};
|
|
147
|
+
return { pages: {}, unknown: /* @__PURE__ */ new Set() };
|
|
123
148
|
}
|
|
124
149
|
}
|
|
125
150
|
function readManifest(contentDir) {
|
|
@@ -135,7 +160,8 @@ function readManifest(contentDir) {
|
|
|
135
160
|
(entry) => typeof entry[1] === "string" && entry[1].length > 0
|
|
136
161
|
)
|
|
137
162
|
);
|
|
138
|
-
|
|
163
|
+
const unknown = Array.isArray(parsed.unknown) ? parsed.unknown.filter((page) => typeof page === "string") : [];
|
|
164
|
+
return { version: 1, pages, ...unknown.length > 0 ? { unknown } : {} };
|
|
139
165
|
} catch {
|
|
140
166
|
return null;
|
|
141
167
|
}
|
|
@@ -145,11 +171,18 @@ function createFarmDocsLastModifiedManifest(contentDir, options = {}) {
|
|
|
145
171
|
const gitDates = getGitLastModifiedDates(resolvedContentDir);
|
|
146
172
|
const fallbackDate = (options.now ?? /* @__PURE__ */ new Date()).toISOString();
|
|
147
173
|
const pages = {};
|
|
174
|
+
const unknown = [];
|
|
148
175
|
for (const sourcePath of discoverDocsSourceFiles(resolvedContentDir)) {
|
|
149
176
|
const relativePath = normalizeRelativePath(path.relative(resolvedContentDir, sourcePath));
|
|
150
|
-
|
|
177
|
+
if (gitDates.pages[relativePath]) {
|
|
178
|
+
pages[relativePath] = gitDates.pages[relativePath];
|
|
179
|
+
} else if (gitDates.unknown.has(relativePath)) {
|
|
180
|
+
unknown.push(relativePath);
|
|
181
|
+
} else {
|
|
182
|
+
pages[relativePath] = options.fallback === "now" ? fallbackDate : statSync(sourcePath).mtime.toISOString();
|
|
183
|
+
}
|
|
151
184
|
}
|
|
152
|
-
return { version: 1, pages };
|
|
185
|
+
return { version: 1, pages, ...unknown.length > 0 ? { unknown } : {} };
|
|
153
186
|
}
|
|
154
187
|
function getLastModifiedManifest(contentDir) {
|
|
155
188
|
const resolvedContentDir = resolveExistingPath(contentDir);
|
|
@@ -170,8 +203,10 @@ function resolveFarmDocsPageLastModified(contentDir, sourcePath, frontmatter) {
|
|
|
170
203
|
const relativePath = normalizeRelativePath(path.relative(resolvedContentDir, resolvedSourcePath));
|
|
171
204
|
const isInsideContentDir = relativePath !== ".." && !relativePath.startsWith("../") && !path.isAbsolute(relativePath);
|
|
172
205
|
if (isInsideContentDir) {
|
|
173
|
-
const
|
|
206
|
+
const manifest = getLastModifiedManifest(resolvedContentDir);
|
|
207
|
+
const generated = manifest.pages[relativePath];
|
|
174
208
|
if (generated) return generated;
|
|
209
|
+
if (manifest.unknown?.includes(relativePath)) return void 0;
|
|
175
210
|
}
|
|
176
211
|
return statSync(resolvedSourcePath).mtime.toISOString();
|
|
177
212
|
}
|
|
@@ -239,7 +274,7 @@ function createHashValue(value) {
|
|
|
239
274
|
function resolveBaseUrl(requestUrl, config) {
|
|
240
275
|
return config?.baseUrl ? new URL(config.baseUrl) : new URL(requestUrl.origin);
|
|
241
276
|
}
|
|
242
|
-
function createFarmDocsSocialImageDescriptor(page, docs, requestUrl) {
|
|
277
|
+
function createFarmDocsSocialImageDescriptor(page, docs, requestUrl, format = "svg", basePath = "") {
|
|
243
278
|
const config = getSocialImageConfig(docs);
|
|
244
279
|
const siteName = config?.siteName || getNavTitle(docs);
|
|
245
280
|
const brand = config?.brand || siteName;
|
|
@@ -249,9 +284,9 @@ function createFarmDocsSocialImageDescriptor(page, docs, requestUrl) {
|
|
|
249
284
|
const illustration = resolveIllustration(page);
|
|
250
285
|
const entry = normalizeEntry(docs.entry);
|
|
251
286
|
const slugPath = encodeSlugPath(page.slug) || "index";
|
|
252
|
-
const imagePath = `${entry}/_social/${slugPath}/opengraph-image
|
|
287
|
+
const imagePath = `${entry}/_social/${slugPath}/opengraph-image.${format}`;
|
|
253
288
|
const baseUrl = resolveBaseUrl(requestUrl, config);
|
|
254
|
-
const pageUrl = new URL(page.href, baseUrl).href;
|
|
289
|
+
const pageUrl = new URL(applyFarmBasePath(page.href, basePath), baseUrl).href;
|
|
255
290
|
const imageAlt = `${title} \u2014 ${siteName} documentation`;
|
|
256
291
|
const hash = createHashValue({
|
|
257
292
|
version: FARM_DOCS_SOCIAL_IMAGE_VERSION,
|
|
@@ -273,32 +308,55 @@ function createFarmDocsSocialImageDescriptor(page, docs, requestUrl) {
|
|
|
273
308
|
pageHref: page.href,
|
|
274
309
|
pageUrl,
|
|
275
310
|
imagePath,
|
|
276
|
-
imageUrl: new URL(`${imagePath}?v=${hash}`, baseUrl).href,
|
|
311
|
+
imageUrl: new URL(`${applyFarmBasePath(imagePath, basePath)}?v=${hash}`, baseUrl).href,
|
|
277
312
|
imageAlt,
|
|
278
313
|
illustration,
|
|
279
314
|
fonts: config?.fonts,
|
|
315
|
+
format,
|
|
280
316
|
hash
|
|
281
317
|
};
|
|
282
318
|
}
|
|
283
319
|
function getFarmDocsSocialImageSlug(docs, requestUrl) {
|
|
284
320
|
const entry = normalizeEntry(docs.entry);
|
|
285
321
|
const prefix = `${entry}/_social/`;
|
|
286
|
-
const
|
|
287
|
-
if (!
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
const rawSlug = requestUrl.pathname.slice(prefix.length, -suffix.length);
|
|
322
|
+
const format = requestUrl.pathname.endsWith("/opengraph-image.png") ? "png" : requestUrl.pathname.endsWith("/opengraph-image.svg") ? "svg" : null;
|
|
323
|
+
if (!format || !requestUrl.pathname.startsWith(prefix)) return null;
|
|
324
|
+
const rawSlug = requestUrl.pathname.slice(prefix.length, -"/opengraph-image.svg".length);
|
|
291
325
|
if (!rawSlug) return null;
|
|
292
326
|
try {
|
|
293
327
|
const slug = rawSlug.split("/").map((segment) => decodeURIComponent(segment)).join("/");
|
|
294
328
|
if (slug.split("/").some((segment) => !segment || segment === ".." || segment === ".")) {
|
|
295
329
|
return null;
|
|
296
330
|
}
|
|
297
|
-
return slug === "index" ? "" : slug;
|
|
331
|
+
return { slug: slug === "index" ? "" : slug, format };
|
|
298
332
|
} catch {
|
|
299
333
|
return null;
|
|
300
334
|
}
|
|
301
335
|
}
|
|
336
|
+
var sharpLoad;
|
|
337
|
+
function loadSharp() {
|
|
338
|
+
sharpLoad ?? (sharpLoad = import("sharp").then(
|
|
339
|
+
(module) => module.default,
|
|
340
|
+
(error) => {
|
|
341
|
+
if (!isMissingPackageError(error, "sharp")) {
|
|
342
|
+
console.warn(
|
|
343
|
+
`[farm] Docs social images fall back to SVG because sharp failed to load: ${error instanceof Error ? error.message : String(error)}`
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
));
|
|
349
|
+
return sharpLoad;
|
|
350
|
+
}
|
|
351
|
+
async function resolveFarmDocsSocialImageFormat() {
|
|
352
|
+
return await loadSharp() ? "png" : "svg";
|
|
353
|
+
}
|
|
354
|
+
async function renderFarmDocsSocialImagePng(descriptor) {
|
|
355
|
+
const sharp = await loadSharp();
|
|
356
|
+
if (!sharp) return null;
|
|
357
|
+
const png = await sharp(Buffer.from(renderFarmDocsSocialImageSvg(descriptor))).png({ compressionLevel: 9, palette: true }).toBuffer();
|
|
358
|
+
return new Uint8Array(png);
|
|
359
|
+
}
|
|
302
360
|
function escapeXml(value) {
|
|
303
361
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
304
362
|
}
|
|
@@ -468,7 +526,11 @@ function renderFarmDocsSocialImageSvg(descriptor) {
|
|
|
468
526
|
const routeY = Math.max(418, descriptionY + descriptionLines.length * 29 + 24);
|
|
469
527
|
const section = truncate(descriptor.section.toUpperCase(), 27);
|
|
470
528
|
const route = truncate(descriptor.pageHref, 42);
|
|
471
|
-
const
|
|
529
|
+
const pageUrl = new URL(descriptor.pageUrl);
|
|
530
|
+
const footerUrl = truncate(
|
|
531
|
+
pageUrl.hostname.endsWith(".invalid") ? pageUrl.pathname : descriptor.pageUrl.replace(/^https?:\/\//, ""),
|
|
532
|
+
70
|
|
533
|
+
);
|
|
472
534
|
const brand = truncate(descriptor.brand.toUpperCase(), 25);
|
|
473
535
|
const titleId = `farm-docs-og-${descriptor.hash}`;
|
|
474
536
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -524,7 +586,7 @@ function renderFarmDocsSocialImageSvg(descriptor) {
|
|
|
524
586
|
function renderFarmDocsSocialMetadata(descriptor, customImage) {
|
|
525
587
|
const imageUrl = customImage ? new URL(customImage, descriptor.pageUrl).href : descriptor.imageUrl;
|
|
526
588
|
const customExtension = customImage?.toLowerCase().split(/[?#]/, 1)[0];
|
|
527
|
-
const imageType = customExtension
|
|
589
|
+
const imageType = !customExtension ? descriptor.format === "png" ? "image/png" : "image/svg+xml" : customExtension.endsWith(".webp") ? "image/webp" : customExtension.endsWith(".png") ? "image/png" : customExtension.match(/\.jpe?g$/) ? "image/jpeg" : "image/svg+xml";
|
|
528
590
|
const tag = (property, content, name = false) => `<meta ${name ? "name" : "property"}="${property}" content="${escapeXml(content)}">`;
|
|
529
591
|
return [
|
|
530
592
|
tag("og:type", "article"),
|
|
@@ -860,11 +922,11 @@ function discoverFarmDocsPages(contentDir, docs) {
|
|
|
860
922
|
visit(contentDir);
|
|
861
923
|
return pages.sort((a, b) => a.href.localeCompare(b.href));
|
|
862
924
|
}
|
|
863
|
-
function toFarmDocsMarkdownPage(page) {
|
|
925
|
+
function toFarmDocsMarkdownPage(page, basePath = "") {
|
|
864
926
|
const lastModified = page.lastModified || page.frontmatter.lastModified || page.frontmatter.lastmod;
|
|
865
927
|
return {
|
|
866
928
|
slug: page.slug,
|
|
867
|
-
url: page.href,
|
|
929
|
+
url: applyFarmBasePath(page.href, basePath),
|
|
868
930
|
title: page.title,
|
|
869
931
|
description: page.description,
|
|
870
932
|
lastModified,
|
|
@@ -873,6 +935,47 @@ function toFarmDocsMarkdownPage(page) {
|
|
|
873
935
|
rawContent: page.body
|
|
874
936
|
};
|
|
875
937
|
}
|
|
938
|
+
function toFarmDocsRouteRequest(request, basePath) {
|
|
939
|
+
if (!basePath) return request;
|
|
940
|
+
const url = new URL(request.url);
|
|
941
|
+
const routePathname = stripFarmBasePath(url.pathname, basePath);
|
|
942
|
+
if (routePathname === url.pathname) return request;
|
|
943
|
+
url.pathname = routePathname;
|
|
944
|
+
return new Request(url, request);
|
|
945
|
+
}
|
|
946
|
+
function getFarmDocsSiteUrl(request, basePath) {
|
|
947
|
+
return `${new URL(request.url).origin}${basePath}`;
|
|
948
|
+
}
|
|
949
|
+
function getFarmDocsPublicEntry(docs, basePath) {
|
|
950
|
+
return basePath ? applyFarmBasePath(normalizeEntry2(docs.entry), basePath) : docs.entry;
|
|
951
|
+
}
|
|
952
|
+
function toFarmDocsPublicSitemapConfig(sitemap, basePath) {
|
|
953
|
+
if (!basePath || sitemap === false) return sitemap;
|
|
954
|
+
const configured = typeof sitemap === "object" ? sitemap : {};
|
|
955
|
+
return {
|
|
956
|
+
...configured,
|
|
957
|
+
routePrefix: `${basePath}/${trimSlashes(configured.routePrefix ?? "")}`
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
function buildFarmDocsSitemapManifest(pages, docs, origin, basePath) {
|
|
961
|
+
return docsEngine().buildDocsSitemapManifest({
|
|
962
|
+
pages: pages.map((page) => ({
|
|
963
|
+
...toFarmDocsMarkdownPage(page, basePath),
|
|
964
|
+
sourcePath: page.sourcePath
|
|
965
|
+
})),
|
|
966
|
+
entry: getFarmDocsPublicEntry(docs, basePath),
|
|
967
|
+
siteTitle: getDocsTitle(docs),
|
|
968
|
+
baseUrl: origin
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
function renderFarmDocsRobotsTxt(docs, origin, basePath) {
|
|
972
|
+
return docsEngine().renderDocsRobotsTxt({
|
|
973
|
+
entry: getFarmDocsPublicEntry(docs, basePath),
|
|
974
|
+
sitemap: toFarmDocsPublicSitemapConfig(docs.config.sitemap ?? true, basePath),
|
|
975
|
+
robots: docs.config.robots ?? true,
|
|
976
|
+
baseUrl: origin
|
|
977
|
+
});
|
|
978
|
+
}
|
|
876
979
|
function getDocsTitle(docs) {
|
|
877
980
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
878
981
|
}
|
|
@@ -885,12 +988,6 @@ function getLoadedDocsPages(contentDir, docs, isPathGuarded) {
|
|
|
885
988
|
function toDocsLlmsPage(page) {
|
|
886
989
|
return toFarmDocsMarkdownPage(page);
|
|
887
990
|
}
|
|
888
|
-
function toDocsSitemapPage(page) {
|
|
889
|
-
return {
|
|
890
|
-
...toFarmDocsMarkdownPage(page),
|
|
891
|
-
sourcePath: page.sourcePath
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
991
|
function resolvePageActionsConfig(docs) {
|
|
895
992
|
return isObjectRecord(docs.config.pageActions) ? docs.config.pageActions : {};
|
|
896
993
|
}
|
|
@@ -964,10 +1061,10 @@ function renderReadingTimeMeta(page, docs) {
|
|
|
964
1061
|
<span class="fd-page-meta-item">${escapeHtml(label)}</span>
|
|
965
1062
|
</div>`;
|
|
966
1063
|
}
|
|
967
|
-
function renderPixelPageActions(page, docs) {
|
|
1064
|
+
function renderPixelPageActions(page, docs, basePath) {
|
|
968
1065
|
const copyMarkdown = resolveCopyMarkdownActionConfig(docs);
|
|
969
1066
|
if (!copyMarkdown) return "";
|
|
970
|
-
const markdownUrl = `${page.href}.md
|
|
1067
|
+
const markdownUrl = applyFarmBasePath(`${page.href}.md`, basePath);
|
|
971
1068
|
const includeTitle = copyMarkdown.includeTitle ? "true" : "false";
|
|
972
1069
|
return `<div class="fd-page-actions" data-page-actions data-actions-alignment="${resolvePageActionsAlignment(docs)}">
|
|
973
1070
|
<button
|
|
@@ -989,9 +1086,9 @@ function renderPixelPageActions(page, docs) {
|
|
|
989
1086
|
</button>
|
|
990
1087
|
</div>`;
|
|
991
1088
|
}
|
|
992
|
-
function renderBelowTitleMeta(page, docs) {
|
|
1089
|
+
function renderBelowTitleMeta(page, docs, basePath) {
|
|
993
1090
|
const lastUpdated = renderLastUpdatedText(page, docs, "below-title");
|
|
994
|
-
const actions = renderPixelPageActions(page, docs);
|
|
1091
|
+
const actions = renderPixelPageActions(page, docs, basePath);
|
|
995
1092
|
const readingTime = renderReadingTimeMeta(page, docs);
|
|
996
1093
|
if (!lastUpdated && !actions && !readingTime) return "";
|
|
997
1094
|
return `<div class="fd-below-title-block not-prose">
|
|
@@ -1000,8 +1097,8 @@ function renderBelowTitleMeta(page, docs) {
|
|
|
1000
1097
|
${readingTime}
|
|
1001
1098
|
</div>`;
|
|
1002
1099
|
}
|
|
1003
|
-
function renderMarkdownHtmlWithTitleMeta(page, docs, html) {
|
|
1004
|
-
const meta = renderBelowTitleMeta(page, docs);
|
|
1100
|
+
function renderMarkdownHtmlWithTitleMeta(page, docs, html, basePath) {
|
|
1101
|
+
const meta = renderBelowTitleMeta(page, docs, basePath);
|
|
1005
1102
|
if (!meta) return html;
|
|
1006
1103
|
const withTitleMeta = html.replace(/(<h1\b[\s\S]*?<\/h1>)/, `$1
|
|
1007
1104
|
${meta}`);
|
|
@@ -1015,18 +1112,20 @@ function renderPixelPageFooter(page, docs) {
|
|
|
1015
1112
|
<span class="fd-last-updated-footer">${lastUpdated}</span>
|
|
1016
1113
|
</div>`;
|
|
1017
1114
|
}
|
|
1018
|
-
function getDocsLlmsOptions(docs, request) {
|
|
1115
|
+
function getDocsLlmsOptions(docs, request, basePath) {
|
|
1019
1116
|
const configured = typeof docs.config.llmsTxt === "object" && docs.config.llmsTxt !== null ? docs.config.llmsTxt : {};
|
|
1020
1117
|
return {
|
|
1021
1118
|
enabled: true,
|
|
1022
|
-
baseUrl:
|
|
1119
|
+
baseUrl: getFarmDocsSiteUrl(request, basePath),
|
|
1023
1120
|
siteTitle: getDocsTitle(docs),
|
|
1024
1121
|
siteDescription: getDocsDescription(docs),
|
|
1025
1122
|
...configured
|
|
1026
1123
|
};
|
|
1027
1124
|
}
|
|
1028
|
-
function getDocsDiscoveryOptions(docs, request) {
|
|
1125
|
+
function getDocsDiscoveryOptions(docs, request, basePath) {
|
|
1029
1126
|
return {
|
|
1127
|
+
// The discovery files list the docs engine's routes as root-relative paths, which answer at
|
|
1128
|
+
// the origin root too. `llms.baseUrl` gives the site's own URL, below the basePath.
|
|
1030
1129
|
origin: new URL(request.url).origin,
|
|
1031
1130
|
entry: docs.entry,
|
|
1032
1131
|
i18n: null,
|
|
@@ -1048,7 +1147,7 @@ function getDocsDiscoveryOptions(docs, request) {
|
|
|
1048
1147
|
}
|
|
1049
1148
|
},
|
|
1050
1149
|
feedback: void 0,
|
|
1051
|
-
llms: getDocsLlmsOptions(docs, request),
|
|
1150
|
+
llms: getDocsLlmsOptions(docs, request, basePath),
|
|
1052
1151
|
sitemap: docs.config.sitemap ?? true,
|
|
1053
1152
|
robots: docs.config.robots ?? true,
|
|
1054
1153
|
openapi: void 0,
|
|
@@ -1058,16 +1157,11 @@ function getDocsDiscoveryOptions(docs, request) {
|
|
|
1058
1157
|
}
|
|
1059
1158
|
};
|
|
1060
1159
|
}
|
|
1061
|
-
function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded) {
|
|
1160
|
+
function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded, basePath) {
|
|
1062
1161
|
const url = new URL(request.url);
|
|
1063
1162
|
let loadedPages;
|
|
1064
1163
|
const getPages = () => loadedPages ?? (loadedPages = getLoadedDocsPages(contentDir, docs, isPathGuarded));
|
|
1065
|
-
const sitemapManifest = () =>
|
|
1066
|
-
pages: getPages().map(toDocsSitemapPage),
|
|
1067
|
-
entry: docs.entry,
|
|
1068
|
-
siteTitle: getDocsTitle(docs),
|
|
1069
|
-
baseUrl: url.origin
|
|
1070
|
-
});
|
|
1164
|
+
const sitemapManifest = () => buildFarmDocsSitemapManifest(getPages(), docs, url.origin, basePath);
|
|
1071
1165
|
const textHeaders = (contentType) => ({
|
|
1072
1166
|
"Content-Type": contentType,
|
|
1073
1167
|
"Cache-Control": "public, max-age=60"
|
|
@@ -1076,7 +1170,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded)
|
|
|
1076
1170
|
if (llmsFormat) {
|
|
1077
1171
|
const generated = docsEngine().renderDocsLlmsTxt(
|
|
1078
1172
|
getPages().map(toDocsLlmsPage),
|
|
1079
|
-
getDocsLlmsOptions(docs, request)
|
|
1173
|
+
getDocsLlmsOptions(docs, request, basePath)
|
|
1080
1174
|
);
|
|
1081
1175
|
return new Response(llmsFormat === "llms-full" ? generated.llmsFullTxt : generated.llmsTxt, {
|
|
1082
1176
|
status: 200,
|
|
@@ -1108,21 +1202,15 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded)
|
|
|
1108
1202
|
);
|
|
1109
1203
|
}
|
|
1110
1204
|
if (docsEngine().resolveDocsRobotsRequest(url, docs.config.robots ?? true)) {
|
|
1111
|
-
return new Response(
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
robots: docs.config.robots ?? true,
|
|
1116
|
-
baseUrl: url.origin
|
|
1117
|
-
}),
|
|
1118
|
-
{
|
|
1119
|
-
status: 200,
|
|
1120
|
-
headers: textHeaders("text/plain; charset=utf-8")
|
|
1121
|
-
}
|
|
1122
|
-
);
|
|
1205
|
+
return new Response(renderFarmDocsRobotsTxt(docs, url.origin, basePath), {
|
|
1206
|
+
status: 200,
|
|
1207
|
+
headers: textHeaders("text/plain; charset=utf-8")
|
|
1208
|
+
});
|
|
1123
1209
|
}
|
|
1124
1210
|
if (docsEngine().isDocsAgentDiscoveryRequest(url)) {
|
|
1125
|
-
const spec = docsEngine().buildDocsAgentDiscoverySpec(
|
|
1211
|
+
const spec = docsEngine().buildDocsAgentDiscoverySpec(
|
|
1212
|
+
getDocsDiscoveryOptions(docs, request, basePath)
|
|
1213
|
+
);
|
|
1126
1214
|
const title = getDocsTitle(docs);
|
|
1127
1215
|
return new Response(
|
|
1128
1216
|
JSON.stringify({
|
|
@@ -1143,7 +1231,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded)
|
|
|
1143
1231
|
}
|
|
1144
1232
|
if (docsEngine().isDocsAgentsRequest(url)) {
|
|
1145
1233
|
return new Response(
|
|
1146
|
-
`${docsEngine().renderDocsAgentsDocument(getDocsDiscoveryOptions(docs, request)).trim()}
|
|
1234
|
+
`${docsEngine().renderDocsAgentsDocument(getDocsDiscoveryOptions(docs, request, basePath)).trim()}
|
|
1147
1235
|
`,
|
|
1148
1236
|
{
|
|
1149
1237
|
status: 200,
|
|
@@ -1153,7 +1241,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded)
|
|
|
1153
1241
|
}
|
|
1154
1242
|
if (docsEngine().isDocsSkillRequest(url)) {
|
|
1155
1243
|
return new Response(
|
|
1156
|
-
`${docsEngine().renderDocsSkillDocument(getDocsDiscoveryOptions(docs, request)).trim()}
|
|
1244
|
+
`${docsEngine().renderDocsSkillDocument(getDocsDiscoveryOptions(docs, request, basePath)).trim()}
|
|
1157
1245
|
`,
|
|
1158
1246
|
{
|
|
1159
1247
|
status: 200,
|
|
@@ -1571,9 +1659,9 @@ function getSidebarPageLabel(item, configured) {
|
|
|
1571
1659
|
}
|
|
1572
1660
|
return item.title;
|
|
1573
1661
|
}
|
|
1574
|
-
function renderSidebarLink(item, activeHref, docs, configured) {
|
|
1662
|
+
function renderSidebarLink(item, activeHref, docs, basePath, configured) {
|
|
1575
1663
|
const active = item.href === activeHref;
|
|
1576
|
-
return `<a class="fd-sidebar-link${active ? " fd-sidebar-link-active" : ""}" data-active="${active ? "true" : "false"}" href="${escapeAttribute(item.href)}">${renderSidebarLabel(docs, configured?.icon, getSidebarPageLabel(item, configured), "sidebar-link-label fd-sidebar-link-label")}</a>`;
|
|
1664
|
+
return `<a class="fd-sidebar-link${active ? " fd-sidebar-link-active" : ""}" data-active="${active ? "true" : "false"}" href="${escapeAttribute(applyFarmBasePath(item.href, basePath))}">${renderSidebarLabel(docs, configured?.icon, getSidebarPageLabel(item, configured), "sidebar-link-label fd-sidebar-link-label")}</a>`;
|
|
1577
1665
|
}
|
|
1578
1666
|
function collectConfiguredSidebarPages(items, maps, seen = /* @__PURE__ */ new Set()) {
|
|
1579
1667
|
const ordered = [];
|
|
@@ -1611,24 +1699,24 @@ ${childHtml}
|
|
|
1611
1699
|
</div>
|
|
1612
1700
|
</div>`;
|
|
1613
1701
|
}
|
|
1614
|
-
function renderConfiguredSidebarItems(items, maps, activeHref, docs) {
|
|
1702
|
+
function renderConfiguredSidebarItems(items, maps, activeHref, docs, basePath) {
|
|
1615
1703
|
const renderedItems = [];
|
|
1616
1704
|
for (const item of items) {
|
|
1617
1705
|
const page = resolveConfiguredSidebarPage(item, maps);
|
|
1618
|
-
const childHtml = renderConfiguredSidebarItems(item.children, maps, activeHref, docs);
|
|
1706
|
+
const childHtml = renderConfiguredSidebarItems(item.children, maps, activeHref, docs, basePath);
|
|
1619
1707
|
if (item.children.length > 0) {
|
|
1620
1708
|
renderedItems.push(renderConfiguredSidebarSubgroup(item, childHtml, docs));
|
|
1621
1709
|
continue;
|
|
1622
1710
|
}
|
|
1623
|
-
const linkHtml = page ? renderSidebarLink(page, activeHref, docs, item) : renderExternalSidebarLink(item, activeHref, docs);
|
|
1711
|
+
const linkHtml = page ? renderSidebarLink(page, activeHref, docs, basePath, item) : renderExternalSidebarLink(item, activeHref, docs);
|
|
1624
1712
|
if (linkHtml) renderedItems.push(linkHtml);
|
|
1625
1713
|
}
|
|
1626
1714
|
return renderedItems.join("\n");
|
|
1627
1715
|
}
|
|
1628
|
-
function renderConfiguredSidebarSection(section, maps, activeHref, docs) {
|
|
1716
|
+
function renderConfiguredSidebarSection(section, maps, activeHref, docs, basePath) {
|
|
1629
1717
|
const label = section.label || "Docs";
|
|
1630
1718
|
const id = sidebarIdFor(label);
|
|
1631
|
-
const links = renderConfiguredSidebarItems(section.children, maps, activeHref, docs);
|
|
1719
|
+
const links = renderConfiguredSidebarItems(section.children, maps, activeHref, docs, basePath);
|
|
1632
1720
|
return `<div class="sidebar-folder fd-sidebar-folder" data-state="open">
|
|
1633
1721
|
<button class="text-fd-muted-foreground sidebar-folder-trigger fd-sidebar-folder-trigger" type="button" aria-controls="${escapeAttribute(id)}" aria-expanded="true">${renderSidebarLabel(docs, section.icon, label, "sidebar-folder-label")}</button>
|
|
1634
1722
|
<div id="${escapeAttribute(id)}" class="overflow-hidden sidebar-folder-content fd-sidebar-folder-content" data-state="open">
|
|
@@ -1636,19 +1724,19 @@ ${links}
|
|
|
1636
1724
|
</div>
|
|
1637
1725
|
</div>`;
|
|
1638
1726
|
}
|
|
1639
|
-
function renderAutoSidebarSectionItems(items, activeHref, docs) {
|
|
1640
|
-
return [...items].sort(compareSidebarPages).map((item) => renderSidebarLink(item, activeHref, docs)).join("\n");
|
|
1727
|
+
function renderAutoSidebarSectionItems(items, activeHref, docs, basePath) {
|
|
1728
|
+
return [...items].sort(compareSidebarPages).map((item) => renderSidebarLink(item, activeHref, docs, basePath)).join("\n");
|
|
1641
1729
|
}
|
|
1642
|
-
function renderPixelNavItems(pages, activeHref, docs) {
|
|
1730
|
+
function renderPixelNavItems(pages, activeHref, docs, basePath) {
|
|
1643
1731
|
const configuredSidebar = getSidebarNavigation(docs);
|
|
1644
1732
|
if (configuredSidebar.length > 0) {
|
|
1645
1733
|
const maps = createSidebarPageMaps(pages);
|
|
1646
1734
|
const renderedSections2 = configuredSidebar.map((section) => {
|
|
1647
1735
|
if (section.children.length > 0) {
|
|
1648
|
-
return renderConfiguredSidebarSection(section, maps, activeHref, docs);
|
|
1736
|
+
return renderConfiguredSidebarSection(section, maps, activeHref, docs, basePath);
|
|
1649
1737
|
}
|
|
1650
1738
|
const page = resolveConfiguredSidebarPage(section, maps);
|
|
1651
|
-
return page ? renderSidebarLink(page, activeHref, docs, section) : renderExternalSidebarLink(section, activeHref, docs);
|
|
1739
|
+
return page ? renderSidebarLink(page, activeHref, docs, basePath, section) : renderExternalSidebarLink(section, activeHref, docs);
|
|
1652
1740
|
}).filter(Boolean).join("\n");
|
|
1653
1741
|
return `<div class="sidebar-scroll overscroll-contain fd-sidebar-nav">
|
|
1654
1742
|
<div class="sidebar-tree">
|
|
@@ -1669,7 +1757,7 @@ ${renderedSections2}
|
|
|
1669
1757
|
return (aOrder === -1 ? 100 : aOrder) - (bOrder === -1 ? 100 : bOrder) || a.localeCompare(b);
|
|
1670
1758
|
}).map(([section, items]) => {
|
|
1671
1759
|
const id = sidebarIdFor(section);
|
|
1672
|
-
const links = renderAutoSidebarSectionItems(items, activeHref, docs);
|
|
1760
|
+
const links = renderAutoSidebarSectionItems(items, activeHref, docs, basePath);
|
|
1673
1761
|
return `<div class="sidebar-folder fd-sidebar-folder" data-state="open">
|
|
1674
1762
|
<button class="text-fd-muted-foreground sidebar-folder-trigger fd-sidebar-folder-trigger" type="button" aria-controls="${escapeAttribute(id)}" aria-expanded="true">${renderSidebarLabel(docs, void 0, section, "sidebar-folder-label")}</button>
|
|
1675
1763
|
<div id="${escapeAttribute(id)}" class="overflow-hidden sidebar-folder-content fd-sidebar-folder-content" data-state="open">
|
|
@@ -1683,7 +1771,7 @@ ${renderedSections}
|
|
|
1683
1771
|
</div>
|
|
1684
1772
|
</div>`;
|
|
1685
1773
|
}
|
|
1686
|
-
function renderPixelPageNav(pages, activeHref, docs) {
|
|
1774
|
+
function renderPixelPageNav(pages, activeHref, docs, basePath) {
|
|
1687
1775
|
const orderedPages = getOrderedSidebarPages(pages, docs);
|
|
1688
1776
|
const activeIndex = orderedPages.findIndex((item) => item.href === activeHref);
|
|
1689
1777
|
if (activeIndex === -1) return "";
|
|
@@ -1691,7 +1779,7 @@ function renderPixelPageNav(pages, activeHref, docs) {
|
|
|
1691
1779
|
const next = orderedPages[activeIndex + 1];
|
|
1692
1780
|
if (!previous && !next) return "";
|
|
1693
1781
|
const renderChevron = (direction) => `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="${direction === "prev" ? "15 18 9 12 15 6" : "9 18 15 12 9 6"}" /></svg>`;
|
|
1694
|
-
const renderCard = (item, direction) => `<a class="fd-page-nav-card fd-page-nav-${direction}" href="${escapeAttribute(item.href)}">
|
|
1782
|
+
const renderCard = (item, direction) => `<a class="fd-page-nav-card fd-page-nav-${direction}" href="${escapeAttribute(applyFarmBasePath(item.href, basePath))}">
|
|
1695
1783
|
<span class="fd-page-nav-title fd-page-nav-title-${direction}">${direction === "prev" ? `${renderChevron(direction)}${escapeHtml(item.title)}` : `${escapeHtml(item.title)}${renderChevron(direction)}`}</span>
|
|
1696
1784
|
<span class="fd-page-nav-description">${direction === "prev" ? "Previous Page" : "Next Page"}</span>
|
|
1697
1785
|
</a>`;
|
|
@@ -1711,7 +1799,7 @@ function isBreadcrumbEnabled(docs) {
|
|
|
1711
1799
|
}
|
|
1712
1800
|
return true;
|
|
1713
1801
|
}
|
|
1714
|
-
function renderPixelBreadcrumb(page, docs) {
|
|
1802
|
+
function renderPixelBreadcrumb(page, docs, basePath) {
|
|
1715
1803
|
if (!isBreadcrumbEnabled(docs)) return "";
|
|
1716
1804
|
const segments = trimSlashes(page.slug).split("/").filter(Boolean);
|
|
1717
1805
|
if (segments.length < 2) return "";
|
|
@@ -1720,7 +1808,10 @@ function renderPixelBreadcrumb(page, docs) {
|
|
|
1720
1808
|
const currentSegment = segments[segments.length - 1];
|
|
1721
1809
|
const entry = normalizeEntry2(docs.entry);
|
|
1722
1810
|
const parentPath = parentSegments.join("/");
|
|
1723
|
-
const parentHref =
|
|
1811
|
+
const parentHref = applyFarmBasePath(
|
|
1812
|
+
entry === "/" ? `/${parentPath}` : `${entry}/${parentPath}`,
|
|
1813
|
+
basePath
|
|
1814
|
+
);
|
|
1724
1815
|
return `<nav class="fd-breadcrumb" aria-label="Breadcrumb">
|
|
1725
1816
|
<span class="fd-breadcrumb-item">
|
|
1726
1817
|
<a class="fd-breadcrumb-parent fd-breadcrumb-link" href="${escapeAttribute(parentHref)}">${escapeHtml(titleizePathSegment(parentSegment))}</a>
|
|
@@ -1755,8 +1846,8 @@ ${items.map(
|
|
|
1755
1846
|
</div>
|
|
1756
1847
|
</div>`;
|
|
1757
1848
|
}
|
|
1758
|
-
function renderDocsRuntimeScript(docs) {
|
|
1759
|
-
const docsEntry = JSON.stringify(normalizeEntry2(docs.entry));
|
|
1849
|
+
function renderDocsRuntimeScript(docs, basePath) {
|
|
1850
|
+
const docsEntry = JSON.stringify(applyFarmBasePath(normalizeEntry2(docs.entry), basePath));
|
|
1760
1851
|
const reconcileHeadRuntime = `const farmNavigationHeadSelector=${JSON.stringify(FARM_NAVIGATION_HEAD_SELECTOR)};const reconcileDocsHead=(nextDoc)=>{const nextTitle=nextDoc.querySelector("title");document.title=nextTitle?.textContent||"";document.head.querySelectorAll(farmNavigationHeadSelector).forEach((node)=>node.remove());nextDoc.head.querySelectorAll(farmNavigationHeadSelector).forEach((node)=>document.head.appendChild(document.importNode(node,true)))}`;
|
|
1761
1852
|
return `<script>(()=>{if(window.__farmDocsRuntime)return;window.__farmDocsRuntime=true;document.documentElement.dataset.farmDocsRuntime="true";document.documentElement.dataset.farmDocsRuntimeId=Math.random().toString(36).slice(2);${reconcileHeadRuntime};const docsEntry=${docsEntry};let cleanupToc=()=>{};let closeMobileSidebar=()=>{};const normalizePath=(path)=>path.length>1?path.replace(/\\/+$/,""):path;const isDocsPath=(path)=>{const next=normalizePath(path);const entry=normalizePath(docsEntry);if(next.endsWith(".md"))return false;if(entry==="/")return true;return next===entry||next.startsWith(entry+"/")};const initToc=()=>{cleanupToc();const toc=document.getElementById("nd-toc");if(!toc){cleanupToc=()=>{};return}const links=Array.from(toc.querySelectorAll("[data-toc-item]"));const thumb=toc.querySelector("[data-toc-thumb]");const pairs=links.map((link)=>{let id=link.hash.slice(1);try{id=decodeURIComponent(id)}catch{}return{link,heading:document.getElementById(id)}}).filter((item)=>item.heading);const setActive=(active)=>{for(const {link} of pairs){const selected=link===active.link;link.dataset.active=selected?"true":"false";link.classList.toggle("fd-toc-link-active",selected)}if(!thumb)return;const styles=getComputedStyle(active.link);const top=active.link.offsetTop+parseFloat(styles.paddingTop||"0");const bottom=active.link.offsetTop+active.link.clientHeight-parseFloat(styles.paddingBottom||"0");thumb.style.clipPath="polygon(0 "+top+"px,100% "+top+"px,100% "+bottom+"px,0 "+bottom+"px)"};const update=()=>{if(pairs.length===0)return;const offset=Math.min(window.innerHeight*0.3,160);let active=pairs[0];for(const pair of pairs){if(pair.heading.getBoundingClientRect().top<=offset)active=pair;else break}setActive(active)};let frame=0;const schedule=()=>{if(frame)return;frame=requestAnimationFrame(()=>{frame=0;update()})};const onHashChange=()=>setTimeout(schedule,0);window.addEventListener("scroll",schedule,{passive:true});window.addEventListener("resize",schedule);window.addEventListener("hashchange",onHashChange);cleanupToc=()=>{window.removeEventListener("scroll",schedule);window.removeEventListener("resize",schedule);window.removeEventListener("hashchange",onHashChange);if(frame)cancelAnimationFrame(frame);frame=0};update()};const getSidebar=()=>document.getElementById("nd-sidebar");const ensureActiveVisible=()=>{const sidebar=getSidebar();if(!sidebar)return;const active=sidebar.querySelector('a[data-active="true"]');if(!(active instanceof HTMLElement))return;const activeRect=active.getBoundingClientRect();const sidebarRect=sidebar.getBoundingClientRect();if(activeRect.top<sidebarRect.top||activeRect.bottom>sidebarRect.bottom)sidebar.scrollTop+=activeRect.top-sidebarRect.top-(sidebar.clientHeight-activeRect.height)/2};const setSidebarActive=(path)=>{const sidebar=getSidebar();if(!sidebar)return;const current=normalizePath(path);for(const link of Array.from(sidebar.querySelectorAll("a[href]"))){try{link.dataset.active=normalizePath(new URL(link.href,location.href).pathname)===current?"true":"false"}catch{}}ensureActiveVisible()};const initMobileSidebar=()=>{const layout=document.getElementById("nd-docs-layout");const sidebar=getSidebar();const toggle=document.querySelector("[data-sidebar-toggle]");const backdrop=document.querySelector("[data-sidebar-backdrop]");if(!layout||!sidebar||!(toggle instanceof HTMLButtonElement))return;const setOpen=(open)=>{layout.dataset.sidebarOpen=open?"true":"false";sidebar.classList.toggle("fd-sidebar-open",open);document.documentElement.dataset.farmDocsSidebar=open?"open":"closed";toggle.setAttribute("aria-expanded",open?"true":"false");toggle.setAttribute("aria-label",open?"Close menu":"Open menu")};const toggleOpen=()=>setOpen(layout.dataset.sidebarOpen!=="true");closeMobileSidebar=()=>setOpen(false);toggle.addEventListener("click",(event)=>{event.preventDefault();toggleOpen()});backdrop?.addEventListener("click",()=>closeMobileSidebar());document.addEventListener("keydown",(event)=>{if(event.key==="Escape")closeMobileSidebar()});sidebar.addEventListener("click",(event)=>{const target=event.target instanceof Element?event.target.closest("a[href]"):null;if(target)closeMobileSidebar()});closeMobileSidebar()};const initSidebarScroll=()=>{const sidebar=getSidebar();if(!sidebar)return;const key="farmdocs:sidebar-scroll:"+location.origin;const getStorage=()=>{try{return window.sessionStorage}catch{return null}};const readSaved=()=>{try{const raw=getStorage()?.getItem(key);if(!raw)return null;const parsed=JSON.parse(raw);return parsed&&typeof parsed==="object"?parsed:null}catch{return null}};const save=(path=location.pathname)=>{try{getStorage()?.setItem(key,JSON.stringify({path,scrollTop:sidebar.scrollTop}))}catch{}};const saved=readSaved();if(saved?.path===location.pathname&&Number.isFinite(Number(saved.scrollTop)))sidebar.scrollTop=Number(saved.scrollTop);ensureActiveVisible();save();sidebar.addEventListener("scroll",()=>save(),{passive:true});sidebar.addEventListener("click",(event)=>{const target=event.target instanceof Element?event.target.closest("a[href]"):null;if(!target)return;try{save(new URL(target.href,location.href).pathname)}catch{save()}});window.addEventListener("beforeunload",()=>save())};let navigateController=null;const getPageKey=(root)=>{const article=root.getElementById("nd-page");if(!article)return"";return article.querySelector("h1")?.textContent?.trim()||article.textContent?.replace(/\\s+/g," ").trim().slice(0,160)||""};const swapDocsPage=(html,url)=>{const nextDoc=new DOMParser().parseFromString(html,"text/html");const nextArticle=nextDoc.getElementById("nd-page");const currentArticle=document.getElementById("nd-page");if(!nextArticle||!currentArticle)return false;const nextKey=getPageKey(nextDoc);const importedArticle=document.importNode(nextArticle,true);currentArticle.replaceWith(importedArticle);const renderedArticle=document.getElementById("nd-page");if(!renderedArticle||renderedArticle===currentArticle||(nextKey&&getPageKey(document)!==nextKey))return false;const nextToc=nextDoc.getElementById("nd-toc");const currentToc=document.getElementById("nd-toc");if(nextToc&¤tToc)currentToc.replaceWith(document.importNode(nextToc,true));reconcileDocsHead(nextDoc);setSidebarActive(url.pathname);initToc();closeMobileSidebar();return true};const navigateDocs=async(url,{replace=false,scroll=true}={})=>{if(!isDocsPath(url.pathname))return false;if(navigateController)navigateController.abort();const controller=new AbortController();navigateController=controller;document.documentElement.dataset.farmDocsNavigating="true";try{const response=await fetch(url.href,{cache:"no-store",headers:{accept:"text/html","x-farm-docs-navigate":"1"},signal:controller.signal});if(!response.ok||!((response.headers.get("content-type")||"").includes("text/html")))return false;const html=await response.text();if(!swapDocsPage(html,url))return false;if(replace)history.replaceState({farmDocs:true},"",url.href);else history.pushState({farmDocs:true},"",url.href);if(scroll){if(url.hash){let id=url.hash.slice(1);try{id=decodeURIComponent(id)}catch{}document.getElementById(id)?.scrollIntoView({block:"start"})}else window.scrollTo({top:0,left:0})}return true}catch(error){if(error?.name==="AbortError")return true;return false}finally{if(navigateController===controller){delete document.documentElement.dataset.farmDocsNavigating;navigateController=null}}};const initClientNavigation=()=>{document.addEventListener("click",(event)=>{if(event.defaultPrevented||event.button!==0||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey)return;const target=event.target instanceof Element?event.target.closest("a[href]"):null;if(!target||target.target||target.hasAttribute("download"))return;let url;try{url=new URL(target.href,location.href)}catch{return}if(url.origin!==location.origin||!isDocsPath(url.pathname))return;if(normalizePath(url.pathname)===normalizePath(location.pathname)&&url.hash)return;event.preventDefault();navigateDocs(url).then((handled)=>{if(!handled)location.href=url.href})});window.addEventListener("popstate",()=>{navigateDocs(new URL(location.href),{replace:true,scroll:false}).then((handled)=>{if(!handled)location.reload()})})};const init=()=>{initToc();initMobileSidebar();initSidebarScroll();initClientNavigation()};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",init,{once:true});else init()})();</script>`;
|
|
1762
1853
|
}
|
|
@@ -1766,8 +1857,8 @@ function renderDocsPageActionsRuntimeScript() {
|
|
|
1766
1857
|
function renderDocsHashRuntimeScript() {
|
|
1767
1858
|
return `<script>(()=>{if(window.__farmDocsHashRuntime)return;window.__farmDocsHashRuntime=true;const scrollToHash=()=>{if(!location.hash)return;let id=location.hash.slice(1);try{id=decodeURIComponent(id)}catch{}document.getElementById(id)?.scrollIntoView({block:"start"})};const schedule=()=>requestAnimationFrame(()=>requestAnimationFrame(scrollToHash));if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",schedule,{once:true});else schedule();window.addEventListener("load",schedule,{once:true});window.addEventListener("hashchange",schedule)})();</script>`;
|
|
1768
1859
|
}
|
|
1769
|
-
function renderDocsRuntimeScripts(docs) {
|
|
1770
|
-
return stampFarmCspNonce(`${renderDocsRuntimeScript(docs)}
|
|
1860
|
+
function renderDocsRuntimeScripts(docs, basePath) {
|
|
1861
|
+
return stampFarmCspNonce(`${renderDocsRuntimeScript(docs, basePath)}
|
|
1771
1862
|
${renderDocsHashRuntimeScript()}
|
|
1772
1863
|
${renderDocsPageActionsRuntimeScript()}`);
|
|
1773
1864
|
}
|
|
@@ -1792,7 +1883,7 @@ function getFarmLayoutFontPreloads(layoutFonts) {
|
|
|
1792
1883
|
function renderFarmLayoutFontPreloadHeader(layoutFonts) {
|
|
1793
1884
|
return getFarmLayoutFontPreloads(layoutFonts).map(({ href, type }) => `<${href}>; rel=preload; as=font; type=${type}; crossorigin`).join(", ");
|
|
1794
1885
|
}
|
|
1795
|
-
function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, requestUrl, fontAssets, fontStylesheetHref, globalStylesheetHref) {
|
|
1886
|
+
function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, requestUrl, fontAssets, basePath, fontStylesheetHref, globalStylesheetHref, socialImageFormat = "svg") {
|
|
1796
1887
|
const navTitle = typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Docs") : "Docs";
|
|
1797
1888
|
const description = page.description || docs.config.metadata?.description || "";
|
|
1798
1889
|
const renderedMarkdown = renderMarkdownDocument(page.body, getThemeTocDepth(docs));
|
|
@@ -1800,9 +1891,10 @@ function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, reques
|
|
|
1800
1891
|
const themeName = getThemeName(docs);
|
|
1801
1892
|
const searchEnabled = isFarmDocsSearchEnabled(docs);
|
|
1802
1893
|
const socialMetadata = isFarmDocsSocialImageEnabled(page, docs) ? renderFarmDocsSocialMetadata(
|
|
1803
|
-
createFarmDocsSocialImageDescriptor(page, docs, requestUrl),
|
|
1894
|
+
createFarmDocsSocialImageDescriptor(page, docs, requestUrl, socialImageFormat, basePath),
|
|
1804
1895
|
getFarmDocsCustomSocialImage(page)
|
|
1805
1896
|
) : "";
|
|
1897
|
+
const homeHref = escapeAttribute(applyFarmBasePath("/", basePath));
|
|
1806
1898
|
return `<!DOCTYPE html>
|
|
1807
1899
|
<html class="dark" lang="en" data-docs-theme="${escapeAttribute(themeName)}">
|
|
1808
1900
|
<head>
|
|
@@ -1824,28 +1916,28 @@ function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, reques
|
|
|
1824
1916
|
<button class="fd-mobile-nav-btn fd-menu-btn" type="button" data-sidebar-toggle aria-controls="nd-sidebar" aria-expanded="false" aria-label="Open menu">
|
|
1825
1917
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
|
|
1826
1918
|
</button>
|
|
1827
|
-
<a class="fd-header-title" href="
|
|
1919
|
+
<a class="fd-header-title" href="${homeHref}">${escapeHtml(navTitle)}</a>
|
|
1828
1920
|
<div class="mobile-topbar-actions">
|
|
1829
1921
|
${searchEnabled ? renderDocsSearchTrigger(true, "fd-search-trigger-mobile") : ""}
|
|
1830
|
-
<a class="mobile-topbar-link" href="/llms.txt">llms.txt</a>
|
|
1922
|
+
<a class="mobile-topbar-link" href="${escapeAttribute(applyFarmBasePath("/llms.txt", basePath))}">llms.txt</a>
|
|
1831
1923
|
</div>
|
|
1832
1924
|
</header>
|
|
1833
1925
|
<aside id="nd-sidebar" class="fd-sidebar">
|
|
1834
1926
|
<div class="sidebar-brand fd-sidebar-header">
|
|
1835
|
-
<a class="fd-sidebar-title" href="
|
|
1927
|
+
<a class="fd-sidebar-title" href="${homeHref}">${renderFarmDocsBrandMark()}${renderFarmDocsBrandTitle(navTitle)}</a>
|
|
1836
1928
|
<span>/ docs</span>
|
|
1837
1929
|
</div>
|
|
1838
1930
|
${searchEnabled ? `<div class="fd-sidebar-search">${renderDocsSearchTrigger(true, "fd-sidebar-search-btn")}</div>` : ""}
|
|
1839
|
-
${renderPixelNavItems(pages, page.href, docs)}
|
|
1931
|
+
${renderPixelNavItems(pages, page.href, docs, basePath)}
|
|
1840
1932
|
</aside>
|
|
1841
1933
|
<div class="sidebar-backdrop fd-sidebar-overlay" data-sidebar-backdrop></div>
|
|
1842
1934
|
<main class="fd-main">
|
|
1843
1935
|
<div class="fd-page">
|
|
1844
1936
|
<article id="nd-page" class="prose fd-page-article fd-page-body fd-docs-content">
|
|
1845
|
-
${renderPixelBreadcrumb(page, docs)}
|
|
1846
|
-
${renderMarkdownHtmlWithTitleMeta(page, docs, renderedMarkdown.html)}
|
|
1937
|
+
${renderPixelBreadcrumb(page, docs, basePath)}
|
|
1938
|
+
${renderMarkdownHtmlWithTitleMeta(page, docs, renderedMarkdown.html, basePath)}
|
|
1847
1939
|
${renderPixelPageFooter(page, docs)}
|
|
1848
|
-
${renderPixelPageNav(pages, page.href, docs)}
|
|
1940
|
+
${renderPixelPageNav(pages, page.href, docs, basePath)}
|
|
1849
1941
|
</article>
|
|
1850
1942
|
<nav id="nd-toc" class="fd-toc sticky top-(--fd-docs-row-1) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] flex flex-col [grid-area:toc] w-(--fd-toc-width) pt-12 pe-4 pb-2 max-xl:hidden" data-toc aria-labelledby="toc-title">
|
|
1851
1943
|
<div class="fd-toc-inner">
|
|
@@ -1859,7 +1951,7 @@ ${renderMarkdownHtmlWithTitleMeta(page, docs, renderedMarkdown.html)}
|
|
|
1859
1951
|
</main>
|
|
1860
1952
|
</div>
|
|
1861
1953
|
${searchEnabled ? renderDocsSearchMount(clientEntry) : ""}
|
|
1862
|
-
${renderDocsRuntimeScripts(docs)}
|
|
1954
|
+
${renderDocsRuntimeScripts(docs, basePath)}
|
|
1863
1955
|
</body>
|
|
1864
1956
|
</html>`;
|
|
1865
1957
|
}
|
|
@@ -1867,25 +1959,40 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1867
1959
|
const faviconHref = resolveFarmDocsFavicon(docs, options);
|
|
1868
1960
|
const fontAssets = options.fontAssets ?? toFarmDocsPublicFontAssets(resolveFarmDocsFontAssets(options.root));
|
|
1869
1961
|
const fallbackFontPreloadHeader = renderFarmDocsFontPreloadHeader(fontAssets);
|
|
1870
|
-
|
|
1871
|
-
|
|
1962
|
+
const basePath = normalizeFarmBasePath(options.basePath);
|
|
1963
|
+
return async function handleFarmDocsRequest(incomingRequest) {
|
|
1964
|
+
if (!docs?.enabled || incomingRequest.method !== "GET" && incomingRequest.method !== "HEAD") {
|
|
1965
|
+
return null;
|
|
1966
|
+
}
|
|
1872
1967
|
await loadFarmDocsEngine();
|
|
1873
|
-
const
|
|
1968
|
+
const request = toFarmDocsRouteRequest(incomingRequest, basePath);
|
|
1874
1969
|
const requestUrl = new URL(request.url);
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1970
|
+
if (request !== incomingRequest && (requestUrl.pathname === "/api/docs" || requestUrl.pathname.startsWith("/api/docs/"))) {
|
|
1971
|
+
return null;
|
|
1972
|
+
}
|
|
1973
|
+
const contentDir = resolveFarmDocsContentDir(docs, options);
|
|
1974
|
+
const socialImageTarget = getFarmDocsSocialImageSlug(docs, requestUrl);
|
|
1975
|
+
if (socialImageTarget !== null) {
|
|
1976
|
+
const socialImagePage = loadFarmDocsPage(contentDir, docs, socialImageTarget.slug);
|
|
1878
1977
|
if (!socialImagePage || // The image sits outside the page's URL, where its guard does not reach, and
|
|
1879
1978
|
// draws the page's title.
|
|
1880
1979
|
options.isPathGuarded?.(socialImagePage.href) || !isFarmDocsSocialImageEnabled(socialImagePage, docs) || getFarmDocsCustomSocialImage(socialImagePage)) {
|
|
1881
1980
|
return null;
|
|
1882
1981
|
}
|
|
1883
|
-
const descriptor = createFarmDocsSocialImageDescriptor(
|
|
1982
|
+
const descriptor = createFarmDocsSocialImageDescriptor(
|
|
1983
|
+
socialImagePage,
|
|
1984
|
+
docs,
|
|
1985
|
+
requestUrl,
|
|
1986
|
+
socialImageTarget.format,
|
|
1987
|
+
basePath
|
|
1988
|
+
);
|
|
1884
1989
|
if (requestUrl.pathname !== descriptor.imagePath) return null;
|
|
1885
|
-
const
|
|
1990
|
+
const png = descriptor.format === "png";
|
|
1991
|
+
if (png && await resolveFarmDocsSocialImageFormat() !== "png") return null;
|
|
1992
|
+
const etag = `"${descriptor.hash}${png ? "-png" : ""}"`;
|
|
1886
1993
|
const immutable = requestUrl.searchParams.get("v") === descriptor.hash;
|
|
1887
1994
|
const headers = new Headers({
|
|
1888
|
-
"Content-Type": "image/svg+xml; charset=utf-8",
|
|
1995
|
+
"Content-Type": png ? "image/png" : "image/svg+xml; charset=utf-8",
|
|
1889
1996
|
"Cache-Control": immutable ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate",
|
|
1890
1997
|
ETag: etag,
|
|
1891
1998
|
"X-Content-Type-Options": "nosniff"
|
|
@@ -1894,13 +2001,18 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1894
2001
|
return new Response(null, { status: 304, headers });
|
|
1895
2002
|
}
|
|
1896
2003
|
if (request.method === "HEAD") return new Response(null, { status: 200, headers });
|
|
2004
|
+
if (png) {
|
|
2005
|
+
const image = await renderFarmDocsSocialImagePng(descriptor);
|
|
2006
|
+
return image ? new Response(image, { status: 200, headers }) : null;
|
|
2007
|
+
}
|
|
1897
2008
|
return new Response(renderFarmDocsSocialImageSvg(descriptor), { status: 200, headers });
|
|
1898
2009
|
}
|
|
1899
2010
|
const publicResponse = createFarmDocsPublicResponse(
|
|
1900
2011
|
contentDir,
|
|
1901
2012
|
docs,
|
|
1902
2013
|
request,
|
|
1903
|
-
options.isPathGuarded
|
|
2014
|
+
options.isPathGuarded,
|
|
2015
|
+
basePath
|
|
1904
2016
|
);
|
|
1905
2017
|
if (publicResponse) return omitFarmDocsHeadBody(request, publicResponse);
|
|
1906
2018
|
if (!isFarmDocsRequest(docs, request)) return null;
|
|
@@ -1915,10 +2027,10 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1915
2027
|
return omitFarmDocsHeadBody(
|
|
1916
2028
|
request,
|
|
1917
2029
|
new Response(
|
|
1918
|
-
docsEngine().renderDocsMarkdownDocument(toFarmDocsMarkdownPage(page), {
|
|
2030
|
+
docsEngine().renderDocsMarkdownDocument(toFarmDocsMarkdownPage(page, basePath), {
|
|
1919
2031
|
origin,
|
|
1920
2032
|
llms: docs.config.llmsTxt ?? true,
|
|
1921
|
-
sitemap: docs.config.sitemap
|
|
2033
|
+
sitemap: toFarmDocsPublicSitemapConfig(docs.config.sitemap, basePath)
|
|
1922
2034
|
}),
|
|
1923
2035
|
{
|
|
1924
2036
|
status: 200,
|
|
@@ -1932,6 +2044,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1932
2044
|
);
|
|
1933
2045
|
}
|
|
1934
2046
|
const pathname = new URL(request.url).pathname;
|
|
2047
|
+
const socialImageFormat = isFarmDocsSocialImageEnabled(page, docs) && !getFarmDocsCustomSocialImage(page) ? await resolveFarmDocsSocialImageFormat() : "svg";
|
|
1935
2048
|
const layoutFonts = await options.resolveLayoutFonts?.(pathname);
|
|
1936
2049
|
const usesLayoutFonts = Boolean(layoutFonts?.body || layoutFonts?.code);
|
|
1937
2050
|
const activeFontAssets = usesLayoutFonts ? [] : fontAssets;
|
|
@@ -1947,8 +2060,10 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1947
2060
|
faviconHref,
|
|
1948
2061
|
requestUrl,
|
|
1949
2062
|
activeFontAssets,
|
|
2063
|
+
basePath,
|
|
1950
2064
|
usesLayoutFonts ? options.fontStylesheetHref : void 0,
|
|
1951
|
-
options.globalStylesheetHref
|
|
2065
|
+
options.globalStylesheetHref,
|
|
2066
|
+
socialImageFormat
|
|
1952
2067
|
),
|
|
1953
2068
|
{
|
|
1954
2069
|
status: 200,
|
|
@@ -1976,5 +2091,10 @@ export {
|
|
|
1976
2091
|
getFarmDocsMarkdownPath,
|
|
1977
2092
|
discoverFarmDocsPages,
|
|
1978
2093
|
toFarmDocsMarkdownPage,
|
|
2094
|
+
getFarmDocsSiteUrl,
|
|
2095
|
+
getFarmDocsPublicEntry,
|
|
2096
|
+
toFarmDocsPublicSitemapConfig,
|
|
2097
|
+
buildFarmDocsSitemapManifest,
|
|
2098
|
+
renderFarmDocsRobotsTxt,
|
|
1979
2099
|
createFarmDocsHandler
|
|
1980
2100
|
};
|