@farm.js/core 0.1.66 → 0.1.68
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-Uh5xr7aX.d.ts} +1 -1
- package/dist/{agent-mcp.d-CO_ABmNK.d.mts → agent-mcp.d-wkVPK1GA.d.mts} +1 -1
- package/dist/agent-runtime.cjs +6 -5
- package/dist/agent-runtime.d.mts +10 -8
- package/dist/agent-runtime.d.ts +10 -8
- package/dist/agent-runtime.mjs +5 -4
- package/dist/{analyzer-4UFP4HVP.mjs → analyzer-CQDU7E3Y.mjs} +2 -2
- package/dist/analyzer-PPAHM4AW.cjs +16 -0
- 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 +61 -0
- package/dist/api/node.d.ts +61 -0
- package/dist/api/node.mjs +223 -0
- package/dist/api/route-manager.cjs +11 -11
- package/dist/api/route-manager.d.mts +14 -11
- package/dist/api/route-manager.d.ts +14 -11
- package/dist/api/route-manager.mjs +10 -10
- package/dist/api/runtime.cjs +11 -7
- package/dist/api/runtime.d.mts +11 -9
- package/dist/api/runtime.d.ts +11 -9
- 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 +15 -12
- package/dist/api.d.ts +15 -12
- package/dist/api.mjs +16 -12
- package/dist/{app-manifest.d-DDmNkYQQ.d.ts → app-manifest.d-BT5i2F-o.d.ts} +1 -1
- package/dist/{app-manifest.d-BpKxiU_E.d.mts → app-manifest.d-Dd4q5CFx.d.mts} +1 -1
- package/dist/app-markdown.cjs +5 -5
- package/dist/app-markdown.d.mts +15 -15
- package/dist/app-markdown.d.ts +15 -15
- package/dist/app-markdown.mjs +4 -4
- package/dist/{app.d-x68Cwr0_.d.ts → app.d-BVOpL_f2.d.ts} +52 -11
- package/dist/{app.d-kuoVWhWM.d.mts → app.d-BhiDXex_.d.mts} +52 -11
- package/dist/{chunk-RY4ABNPE.cjs → chunk-225APHKC.cjs} +3 -3
- package/dist/{chunk-JGAE5XPL.cjs → chunk-23VJEGKC.cjs} +4 -2
- 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-7XGWBPQQ.cjs → chunk-3EEINK7G.cjs} +24 -10
- package/dist/{chunk-BRWIVOV4.cjs → chunk-3GNHJ3RN.cjs} +10 -8
- package/dist/{chunk-HCGWDRZO.mjs → chunk-3Y52TWYU.mjs} +18 -7
- package/dist/{chunk-CBOEJ5Z4.cjs → chunk-437QZIC2.cjs} +133 -46
- package/dist/{chunk-O6L3YYPM.cjs → chunk-4E57QHPW.cjs} +8 -16
- package/dist/{chunk-WKPBIT5Q.cjs → chunk-4HGLJOXZ.cjs} +6 -6
- package/dist/{chunk-CJNAUEVC.mjs → chunk-4QENVMG7.mjs} +1 -1
- package/dist/{chunk-EMNKZGF4.mjs → chunk-4UAQB5LB.mjs} +556 -462
- package/dist/{chunk-BQWBHWEW.mjs → chunk-4ZXKYCYK.mjs} +1 -1
- package/dist/{chunk-N35YPV4N.mjs → chunk-57QAQU4F.mjs} +9 -7
- package/dist/{chunk-ZEXE4TGY.mjs → chunk-5FBZJJGA.mjs} +247 -110
- package/dist/{chunk-4OSOLDPL.cjs → chunk-5JKDFRTK.cjs} +2 -2
- package/dist/{chunk-OLIGNTWU.cjs → chunk-5NFQ6AZI.cjs} +7 -7
- package/dist/{chunk-6HRAK7I5.mjs → chunk-5OFNUETM.mjs} +8 -2
- package/dist/{chunk-RD623KW4.cjs → chunk-67MZTLTF.cjs} +21 -3
- package/dist/chunk-6I4BFRE7.cjs +51 -0
- package/dist/{chunk-UBMHQVWN.mjs → chunk-6OFOIMNS.mjs} +1 -1
- package/dist/{chunk-K5EW7GUU.mjs → chunk-7BIW7VCW.mjs} +13 -5
- package/dist/{chunk-CHYTADNK.cjs → chunk-7LK5CTUM.cjs} +70 -53
- package/dist/{chunk-HPP2II4Z.mjs → chunk-7PJARAQQ.mjs} +1 -1
- package/dist/{chunk-LEJDW34D.cjs → chunk-7PPLTD3P.cjs} +3 -3
- package/dist/{chunk-BYRZ5VTH.mjs → chunk-A3T445WK.mjs} +47 -34
- 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-NKRZLQUK.mjs → chunk-AQIO3RNL.mjs} +1 -1
- package/dist/chunk-AQIRXBBY.cjs +26 -0
- package/dist/{chunk-DQJ2CIH7.cjs → chunk-ASYOWPSR.cjs} +2 -1
- 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-QGJ4FI2G.mjs → chunk-C6HGUTXB.mjs} +113 -29
- package/dist/{chunk-YN6BHOYY.cjs → chunk-CL52PD6D.cjs} +10 -3
- package/dist/{chunk-VQJHT2ND.mjs → chunk-CRVSYDHV.mjs} +2 -2
- package/dist/{chunk-XURDCXNH.cjs → chunk-CSLHNBPS.cjs} +6 -6
- package/dist/{chunk-XQSYOVCW.cjs → chunk-DBYNZIIQ.cjs} +13 -5
- package/dist/{chunk-AZUUKA66.mjs → chunk-DIXFKAPM.mjs} +1251 -389
- package/dist/{chunk-QTD6EMN2.mjs → chunk-DQ2DI3Y7.mjs} +11 -4
- package/dist/{chunk-NHQM2Q4I.cjs → chunk-DWLNLU55.cjs} +2 -2
- package/dist/chunk-DXZ57EPE.mjs +375 -0
- package/dist/{chunk-SA7MLSP4.mjs → chunk-E3HDJCWF.mjs} +3 -3
- package/dist/{chunk-52Y3C3HG.mjs → chunk-E7VF3LQ5.mjs} +3 -2
- 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-E4UDLFWR.cjs → chunk-F36LS2C7.cjs} +796 -702
- package/dist/{chunk-MPIGW42F.mjs → chunk-F6CMGWAL.mjs} +1 -1
- package/dist/{chunk-GL7N5UHF.cjs → chunk-FJMC24KG.cjs} +21 -10
- package/dist/{chunk-QISW423S.cjs → chunk-FPBOAG6N.cjs} +2 -2
- package/dist/{chunk-3CCAICF7.cjs → chunk-FSODPZRT.cjs} +5 -5
- package/dist/{chunk-2C5L5RPM.cjs → chunk-FT6KJHS3.cjs} +71 -38
- package/dist/{chunk-WMTBBQHY.cjs → chunk-FVYBEMOD.cjs} +288 -151
- package/dist/{chunk-BM2LH2JM.mjs → chunk-G7NBPP7H.mjs} +14 -13
- package/dist/{chunk-ES2LD2YD.mjs → chunk-GCRT6GJG.mjs} +18 -0
- package/dist/{chunk-5OJVKXFV.cjs → chunk-GDM3ZD2O.cjs} +10 -8
- package/dist/{chunk-25T5VXOE.mjs → chunk-GFPS7MNE.mjs} +106 -19
- package/dist/{chunk-EMDGXYUD.mjs → chunk-GJ7QVFAG.mjs} +16 -7
- package/dist/{chunk-TGSEVBPO.mjs → chunk-GJEC5S4V.mjs} +11 -0
- package/dist/{chunk-HNAISJFD.cjs → chunk-HDPT6OYE.cjs} +9 -3
- package/dist/{chunk-RVGSVQWT.mjs → chunk-HEJM46HQ.mjs} +21 -7
- package/dist/chunk-HHLEYA4B.cjs +17 -0
- package/dist/{chunk-ZNH6NR3H.cjs → chunk-HJZZSBVK.cjs} +2 -2
- package/dist/{chunk-E552H232.cjs → chunk-I7J5RLGO.cjs} +16 -2
- package/dist/chunk-ICFPTHXM.mjs +97 -0
- package/dist/{chunk-K7OZAVOI.mjs → chunk-IFR74W6S.mjs} +46 -13
- package/dist/{chunk-MPJEIHW2.cjs → chunk-IGDYL2IA.cjs} +2 -2
- package/dist/{chunk-5A77OEIG.cjs → chunk-IHTDLCDJ.cjs} +5 -5
- package/dist/{chunk-OYZXVBZP.cjs → chunk-IUKBPBM7.cjs} +2 -1
- package/dist/chunk-J6TZRYCO.cjs +22 -0
- package/dist/{chunk-E4RDMG3K.mjs → chunk-JL2YW5KX.mjs} +5 -4
- package/dist/chunk-JSOCDYER.cjs +375 -0
- package/dist/{chunk-UPYIFH2H.cjs → chunk-JWLRBDDC.cjs} +2 -2
- 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-TKK5QHKZ.mjs → chunk-KDO6T6OB.mjs} +3 -3
- package/dist/{chunk-EZ34EHQP.mjs → chunk-KI3MU7B5.mjs} +1 -1
- package/dist/{chunk-GHNW564E.mjs → chunk-KSZK34HU.mjs} +30 -10
- package/dist/{chunk-IT6WRNGB.cjs → chunk-KWCZKJYU.cjs} +1541 -679
- package/dist/{chunk-DVKH2RVN.cjs → chunk-LDEXTX4I.cjs} +70 -57
- package/dist/{chunk-ECKQFEX2.mjs → chunk-LENKRGBV.mjs} +8 -6
- package/dist/{chunk-XBSKPLHF.cjs → chunk-LR4KP3I7.cjs} +2 -2
- package/dist/{chunk-HEPJIKKQ.cjs → chunk-MCSRMEQV.cjs} +2 -2
- package/dist/{chunk-DQF3QLOH.mjs → chunk-ME7RVELR.mjs} +3 -2
- package/dist/{chunk-VFXE6NWR.mjs → chunk-MGKWYPE3.mjs} +2 -1
- package/dist/{chunk-TZVUF5JJ.mjs → chunk-MGZVDX4R.mjs} +5 -5
- package/dist/{chunk-MGKW5XZE.cjs → chunk-MMDKYJ5V.cjs} +7 -7
- package/dist/{chunk-SK7QSNWE.mjs → chunk-MNJDNTGO.mjs} +1 -1
- package/dist/{chunk-5Y2P454O.cjs → chunk-MTBDJ326.cjs} +6 -5
- package/dist/{chunk-FIR62CR3.mjs → chunk-MV7NWU23.mjs} +1 -1
- package/dist/{chunk-7ONGIFYX.cjs → chunk-MZ4CRSY7.cjs} +481 -171
- package/dist/{chunk-O4F3JUST.mjs → chunk-NDDRTFN4.mjs} +4 -0
- package/dist/{chunk-4IHMHFQB.cjs → chunk-NG2EZ6QS.cjs} +28 -1
- package/dist/{chunk-XBSLKXBL.mjs → chunk-NT4W4H52.mjs} +52 -35
- package/dist/{chunk-UAQD67HM.mjs → chunk-NVOMQLI2.mjs} +16 -2
- package/dist/{chunk-R62SF5R4.mjs → chunk-OB45EAQL.mjs} +6 -1
- package/dist/{chunk-V56632LA.cjs → chunk-OCNV4CI2.cjs} +39 -6
- 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-27FPUFWR.mjs → chunk-P2NBQ5JI.mjs} +1 -1
- package/dist/{chunk-HZPKJRYA.cjs → chunk-PDFFYZAT.cjs} +2 -2
- package/dist/{chunk-GSVJ3IIF.cjs → chunk-PHCJJJZV.cjs} +2 -2
- package/dist/{chunk-EVMXPJCB.mjs → chunk-PKMUQ7LM.mjs} +2 -1
- package/dist/{chunk-OAJOQU5J.mjs → chunk-PLJKJJ2H.mjs} +82 -63
- package/dist/{chunk-72KCTHLV.cjs → chunk-PRL7FXG4.cjs} +113 -29
- package/dist/{chunk-6XQSPIN6.cjs → chunk-PWKAX5MS.cjs} +13 -3
- package/dist/{chunk-4ZJ5C7UJ.cjs → chunk-QIXEU2WV.cjs} +19 -10
- package/dist/{chunk-FJWN7RV4.cjs → chunk-QO43L7Z4.cjs} +38 -8
- package/dist/{chunk-X4K7TYN6.cjs → chunk-QOGIZKSO.cjs} +26 -25
- package/dist/{chunk-CNNBFGL5.cjs → chunk-QSUYB3RH.cjs} +14 -14
- package/dist/chunk-QYNZ3CTI.mjs +17 -0
- package/dist/{chunk-X3XUZWRB.mjs → chunk-R2ZHU37O.mjs} +36 -3
- package/dist/{chunk-ZIHWAN55.cjs → chunk-RE5E2G5S.cjs} +1 -1
- package/dist/{chunk-O75GQVUK.mjs → chunk-RLH5AH2M.mjs} +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-BIF5MLTH.cjs → chunk-SQ6IWJ3H.cjs} +1 -1
- package/dist/{chunk-WVYRLP5E.mjs → chunk-T5XFZQCL.mjs} +1 -1
- package/dist/{chunk-WAY6LOQH.mjs → chunk-TEJ67GD2.mjs} +1 -1
- package/dist/{chunk-OP7LHY4Y.cjs → chunk-TNK2TVRS.cjs} +2005 -800
- package/dist/{chunk-IFTGERT3.mjs → chunk-TTXIITYA.mjs} +49 -0
- package/dist/{chunk-ZFWYCVKS.mjs → chunk-TY5KCYDE.mjs} +22 -4
- package/dist/{chunk-WYAXRIYP.cjs → chunk-UKZ6AWKZ.cjs} +10 -9
- package/dist/{chunk-UJ3R2AH2.cjs → chunk-UPOYKX4S.cjs} +5 -5
- package/dist/{chunk-VBCQ5WOI.cjs → chunk-URN7VFO7.cjs} +105 -16
- package/dist/{chunk-2DLGV2ZG.mjs → chunk-UTUS6JUH.mjs} +1 -21
- package/dist/{chunk-435QJNC2.mjs → chunk-VFNAK6A5.mjs} +4 -4
- package/dist/{chunk-WFWFECDW.mjs → chunk-VRGY3X2I.mjs} +100 -11
- package/dist/{chunk-LQNW3ABP.cjs → chunk-VX2HZGC7.cjs} +14 -14
- package/dist/chunk-W44X6IC2.cjs +97 -0
- package/dist/{chunk-A2MN5PQJ.mjs → chunk-WMLSZAKN.mjs} +9 -9
- package/dist/{chunk-672ISQIG.mjs → chunk-WPB67LE5.mjs} +379 -69
- 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-W2ZXMMHA.mjs → chunk-XCAQTCGK.mjs} +1 -1
- package/dist/{chunk-Z7P2BTZ3.cjs → chunk-XGTFLG73.cjs} +30 -12
- package/dist/{chunk-XCXHQBMM.mjs → chunk-Y2LU4LE5.mjs} +1 -1
- package/dist/{chunk-5J45H65F.mjs → chunk-Y5LEPEVH.mjs} +1 -1
- package/dist/{chunk-D4MRNBVF.cjs → chunk-Y6KHPJDB.cjs} +2 -2
- 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-752IHQTD.cjs → chunk-YTNBCXCW.cjs} +12 -12
- package/dist/{chunk-RFKTJTWZ.mjs → chunk-YVPX5PI5.mjs} +3 -1
- package/dist/{chunk-4TVPYN32.cjs → chunk-Z3PW3DIR.cjs} +7 -7
- package/dist/{chunk-OB7VKCUZ.mjs → chunk-Z6SOXHAD.mjs} +1851 -646
- package/dist/{chunk-72KABRWN.mjs → chunk-ZJGFAW5U.mjs} +5 -3
- package/dist/{chunk-TNBJ4LZG.mjs → chunk-ZPKJPM7K.mjs} +4 -4
- package/dist/{chunk-5FE5YT2N.mjs → chunk-ZZGQD3LL.mjs} +28 -1
- 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-BvQOxSqh.d.mts} +2 -2
- package/dist/{client-component.d-D8VcypQA.d.ts → client-component.d-DNVSLEPi.d.ts} +2 -2
- package/dist/client-plugins.cjs +2 -2
- package/dist/{client-plugins.d-D4-6hNx7.d.mts → client-plugins.d-CE1lVK2R.d.mts} +116 -373
- package/dist/{client-plugins.d-CXElzotB.d.ts → client-plugins.d-CNDqcAuf.d.ts} +116 -373
- package/dist/client-plugins.d.mts +10 -8
- package/dist/client-plugins.d.ts +10 -8
- package/dist/client-plugins.mjs +1 -1
- package/dist/client.cjs +11 -9
- package/dist/client.d.mts +17 -15
- package/dist/client.d.ts +17 -15
- 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 +10 -8
- package/dist/config.d.ts +10 -8
- 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 +4 -2
- package/dist/deployment.d.mts +15 -1
- package/dist/deployment.d.ts +15 -1
- package/dist/deployment.mjs +3 -1
- package/dist/desktop.d.mts +11 -9
- package/dist/desktop.d.ts +11 -9
- package/dist/{devtools-NZUVNUP3.mjs → devtools-2A2GPC7B.mjs} +33 -29
- package/dist/{devtools-N2JQCMXB.cjs → devtools-R27T3BRY.cjs} +38 -34
- package/dist/docs.cjs +28 -27
- package/dist/docs.d.mts +24 -10
- package/dist/docs.d.ts +24 -10
- package/dist/docs.mjs +27 -26
- package/dist/env-types.cjs +3 -3
- package/dist/env-types.mjs +2 -2
- package/dist/environment/vite.cjs +7 -7
- package/dist/environment/vite.d.mts +1 -1
- package/dist/environment/vite.d.ts +1 -1
- package/dist/environment/vite.mjs +6 -6
- package/dist/{generate-route-types.d-BL2pq6xC.d.ts → generate-route-types.d-B76M5R11.d.ts} +1 -1
- package/dist/{generate-route-types.d-BoVDU8qX.d.mts → generate-route-types.d-CaGMIaNI.d.mts} +1 -1
- 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 +148 -128
- package/dist/{index.d-SSgYDv4D.d.mts → index.d-Bt3kl19W.d.mts} +1 -1
- package/dist/{index.d-A_x10zGS.d.ts → index.d-Cx_-DaKV.d.ts} +1 -1
- package/dist/index.d.mts +39 -87
- package/dist/index.d.ts +39 -87
- package/dist/index.mjs +224 -204
- package/dist/instrumentation.cjs +3 -3
- package/dist/instrumentation.mjs +2 -2
- package/dist/{integration-orm-52GPGTHO.cjs → integrations/orm.cjs} +5 -5
- package/dist/integrations/orm.d.mts +35 -0
- package/dist/integrations/orm.d.ts +35 -0
- package/dist/{integration-orm-CO23MSFE.mjs → integrations/orm.mjs} +5 -5
- package/dist/integrations.cjs +6 -5
- package/dist/integrations.d.mts +10 -8
- package/dist/integrations.d.ts +10 -8
- package/dist/integrations.mjs +5 -4
- package/dist/internal/app-markdown-runtime.cjs +4 -4
- package/dist/internal/app-markdown-runtime.d.mts +27 -11
- package/dist/internal/app-markdown-runtime.d.ts +27 -11
- package/dist/internal/app-markdown-runtime.mjs +3 -3
- package/dist/internal/build-runtime.cjs +76 -71
- package/dist/internal/build-runtime.d.mts +12 -10
- package/dist/internal/build-runtime.d.ts +12 -10
- package/dist/internal/build-runtime.mjs +75 -70
- package/dist/internal/cli-runtime.cjs +47 -46
- package/dist/internal/cli-runtime.mjs +46 -45
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +85 -36
- package/dist/internal/client-runtime.d.mts +44 -13
- package/dist/internal/client-runtime.d.ts +44 -13
- package/dist/internal/client-runtime.mjs +79 -30
- package/dist/internal/compression-runtime.d.mts +10 -8
- package/dist/internal/compression-runtime.d.ts +10 -8
- package/dist/internal/config-runtime.cjs +27 -26
- package/dist/internal/config-runtime.d.mts +14 -12
- package/dist/internal/config-runtime.d.ts +14 -12
- package/dist/internal/config-runtime.mjs +26 -25
- 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/form-actions.cjs +7 -2
- package/dist/internal/form-actions.d.mts +10 -3
- package/dist/internal/form-actions.d.ts +10 -3
- package/dist/internal/form-actions.mjs +8 -3
- package/dist/internal/infra-analytics-runtime.cjs +11 -11
- package/dist/internal/infra-analytics-runtime.mjs +9 -9
- package/dist/internal/islands-boot.cjs +6 -1
- package/dist/internal/islands-boot.mjs +6 -1
- 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 +5 -5
- package/dist/internal/native-server-fns.mjs +4 -4
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-node-env.cjs +4 -2
- package/dist/internal/production-node-env.d.mts +22 -1
- package/dist/internal/production-node-env.d.ts +22 -1
- package/dist/internal/production-node-env.mjs +3 -1
- package/dist/internal/production-runtime.cjs +57 -39
- package/dist/internal/production-runtime.d.mts +27 -21
- package/dist/internal/production-runtime.d.ts +27 -21
- package/dist/internal/production-runtime.mjs +72 -54
- package/dist/internal/react-cache.cjs +3 -3
- package/dist/internal/react-cache.mjs +1 -1
- package/dist/internal/server-tree.cjs +2 -2
- package/dist/internal/server-tree.d.mts +0 -5
- package/dist/internal/server-tree.d.ts +0 -5
- package/dist/internal/server-tree.mjs +1 -1
- package/dist/internal/vercel-edge-middleware.cjs +87 -0
- package/dist/internal/vercel-edge-middleware.d.mts +39 -0
- package/dist/internal/vercel-edge-middleware.d.ts +39 -0
- package/dist/internal/vercel-edge-middleware.mjs +87 -0
- package/dist/layers-7P4RLKVX.cjs +20 -0
- package/dist/{layers-T55SA47E.mjs → layers-XQ7VFMWO.mjs} +4 -2
- package/dist/{layers.d-CcS42OGR.d.mts → layers.d-CH0bC4QL.d.mts} +2 -1
- package/dist/{layers.d-CcS42OGR.d.ts → layers.d-CH0bC4QL.d.ts} +2 -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 +10 -8
- package/dist/markdown.d.ts +10 -8
- package/dist/markdown.mjs +6 -2
- package/dist/middleware.cjs +11 -11
- package/dist/middleware.d.mts +13 -10
- package/dist/middleware.d.ts +13 -10
- package/dist/middleware.mjs +13 -13
- package/dist/mobile.d.mts +6 -6
- package/dist/mobile.d.ts +6 -6
- package/dist/mount.d-Bki4pOaJ.d.mts +38 -0
- package/dist/mount.d-DjR5aerM.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-7LPH57Z4.cjs → native-tree-W2SSJB3Y.cjs} +4 -4
- package/dist/{native-tree-VV6WN3GX.mjs → native-tree-Y5YQANW7.mjs} +3 -3
- package/dist/{navigation-delegate.d-GghbHJuK.d.ts → navigation-delegate.d-CtghaSP3.d.ts} +1 -1
- package/dist/{navigation-delegate.d-DQVYKoaZ.d.mts → navigation-delegate.d-VDkziXTK.d.mts} +1 -1
- package/dist/navigation.cjs +8 -7
- package/dist/navigation.d.mts +13 -11
- package/dist/navigation.d.ts +13 -11
- package/dist/navigation.mjs +7 -6
- package/dist/{nitro-DD4QCA66.mjs → nitro-NSTXT7LB.mjs} +11 -11
- package/dist/{nitro-VRDX2H4M.cjs → nitro-Y3LGITW3.cjs} +13 -13
- package/dist/node-module-bundle-LIZ2KMVW.cjs +13 -0
- package/dist/node-module-bundle-VR6NV6AI.mjs +13 -0
- package/dist/{plugin-53SY5YBS.mjs → plugin-SAS22JL7.mjs} +4 -3
- package/dist/{plugin-HZIBL3DW.cjs → plugin-WIU4GDD4.cjs} +5 -4
- package/dist/plugin.cjs +65 -63
- package/dist/plugin.d.mts +12 -10
- package/dist/plugin.d.ts +12 -10
- package/dist/plugin.mjs +64 -62
- package/dist/{production-runtime.d-Bzns3NW9.d.ts → production-runtime.d-BMyyLGBB.d.ts} +3 -57
- package/dist/{production-runtime.d-DiFa5vHW.d.mts → production-runtime.d-DMZY3OgV.d.mts} +3 -57
- package/dist/query/client.cjs +9 -7
- package/dist/query/client.mjs +5 -3
- package/dist/{render-plan.d-CcF0MeCf.d.mts → render-plan.d-BSwV8PE4.d.mts} +1 -1
- package/dist/{render-plan.d-CL_Ikfg_.d.ts → render-plan.d-i9sI4tc9.d.ts} +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 +3 -3
- package/dist/renderer/react/server.mjs +3 -3
- package/dist/renderer-client.cjs +8 -6
- package/dist/renderer-client.d.mts +13 -11
- package/dist/renderer-client.d.ts +13 -11
- package/dist/renderer-client.mjs +5 -3
- package/dist/renderer.cjs +6 -2
- package/dist/renderer.d.mts +25 -2
- package/dist/renderer.d.ts +25 -2
- package/dist/renderer.mjs +5 -1
- package/dist/request.cjs +2 -2
- package/dist/{request.d-DarDOCk9.d.mts → request.d-C24FNQ_7.d.mts} +1 -1
- package/dist/{request.d-B1RnTLri.d.ts → request.d-Dgln8tuI.d.ts} +1 -1
- package/dist/request.d.mts +11 -9
- package/dist/request.d.ts +11 -9
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering.d-BTUYCIj4.d.ts → route-rendering.d-CUylZKJA.d.ts} +1 -1
- package/dist/{route-rendering.d-D_2Ual0-.d.mts → route-rendering.d-Ds0BfwQi.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-CMANF6da.d.ts → router.d-B56rMOFm.d.ts} +1 -1
- package/dist/{router.d-Cuv1jntg.d.mts → router.d-CFPcbqzc.d.mts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/{routes.d-B6yFe6jm.d.ts → routes.d-9GFFNioh.d.ts} +2 -2
- package/dist/{routes.d-c2HKfrfL.d.mts → routes.d-CrEy0lJS.d.mts} +2 -2
- package/dist/routes.d.mts +10 -8
- package/dist/routes.d.ts +10 -8
- package/dist/routes.mjs +2 -2
- package/dist/{rsc-pipeline-Z7QBZOIJ.cjs → rsc-pipeline-3T7V6OUT.cjs} +30 -28
- package/dist/{rsc-pipeline-7PNVJSTR.mjs → rsc-pipeline-GA4AQWZI.mjs} +29 -27
- package/dist/{runtime-FKFCUHSK.cjs → runtime-REUTNTI5.cjs} +72 -46
- package/dist/{runtime-QQHX4BP3.mjs → runtime-ZYCKKY7L.mjs} +60 -34
- package/dist/{runtime.d-wvh4ngU0.d.mts → runtime.d-DLRO-ExG.d.mts} +11 -3
- package/dist/{runtime.d-C3RQUj6_.d.ts → runtime.d-H7k9hOQE.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-http.d-rAe7lAQc.d.mts +70 -0
- package/dist/server-http.d-rAe7lAQc.d.ts +70 -0
- package/dist/server-plugins.cjs +7 -7
- package/dist/server-plugins.d.mts +20 -12
- package/dist/server-plugins.d.ts +20 -12
- 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 +168 -126
- package/dist/server.d-C5FFrZAo.d.ts +57 -0
- package/dist/server.d-DgC8xew5.d.mts +57 -0
- package/dist/server.d.mts +24 -16
- package/dist/server.d.ts +24 -16
- package/dist/server.mjs +144 -102
- package/dist/{spa-router.d-m8H_Kl_B.d.ts → spa-router.d-Dr7oanhl.d.ts} +15 -5
- package/dist/{spa-router.d-WU_qS5gJ.d.mts → spa-router.d-g4CzhEH1.d.mts} +15 -5
- package/dist/testing.cjs +17 -17
- package/dist/testing.d.mts +10 -8
- package/dist/testing.d.ts +10 -8
- package/dist/testing.mjs +13 -13
- package/dist/theme/server.cjs +3 -3
- package/dist/theme/server.mjs +2 -2
- package/dist/types.d-xCIhyjOq.d.mts +233 -0
- package/dist/types.d-xCIhyjOq.d.ts +233 -0
- package/dist/{utils.d-C9dQD5Zg.d.ts → utils.d-BxxyDEb8.d.ts} +1 -1
- package/dist/{utils.d-W9IiEqmW.d.mts → utils.d-HIla3pD_.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +65 -63
- package/dist/vite.d.mts +36 -14
- package/dist/vite.d.ts +36 -14
- package/dist/vite.mjs +64 -62
- package/dist/workflows.cjs +4 -4
- package/dist/workflows.d.mts +121 -1
- package/dist/workflows.d.ts +121 -1
- package/dist/workflows.mjs +3 -3
- package/package.json +37 -2
- package/dist/analyzer-H7SIX6BJ.cjs +0 -16
- package/dist/chunk-5YPBFMBN.cjs +0 -19
- package/dist/chunk-CLFEQGET.cjs +0 -60
- package/dist/chunk-MK5E44WP.mjs +0 -60
- 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/layers-DMRXRL7F.cjs +0 -18
- package/dist/manager-2LUKNX2N.cjs +0 -14
- package/dist/node-module-bundle-7JHPPF6B.mjs +0 -11
- package/dist/node-module-bundle-YJGYBOGK.cjs +0 -11
- package/dist/workflows.d-CRMzQZ3k.d.mts +0 -188
- package/dist/workflows.d-CRMzQZ3k.d.ts +0 -188
- /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
|
}
|
|
@@ -209,6 +244,9 @@ function isFarmDocsSocialImageEnabled(page, docs) {
|
|
|
209
244
|
}
|
|
210
245
|
return !isFalse(page.frontmatter.socialImage);
|
|
211
246
|
}
|
|
247
|
+
function farmDocsPageUsesRequestOrigin(page, docs) {
|
|
248
|
+
return isFarmDocsSocialImageEnabled(page, docs) && !getSocialImageConfig(docs)?.baseUrl;
|
|
249
|
+
}
|
|
212
250
|
function getFarmDocsCustomSocialImage(page) {
|
|
213
251
|
const value = page.frontmatter.socialImage || page.frontmatter.openGraphImage || page.frontmatter.ogImage;
|
|
214
252
|
return value && !isFalse(value) && isExternalOrRootPath(value) ? value : void 0;
|
|
@@ -239,7 +277,7 @@ function createHashValue(value) {
|
|
|
239
277
|
function resolveBaseUrl(requestUrl, config) {
|
|
240
278
|
return config?.baseUrl ? new URL(config.baseUrl) : new URL(requestUrl.origin);
|
|
241
279
|
}
|
|
242
|
-
function createFarmDocsSocialImageDescriptor(page, docs, requestUrl) {
|
|
280
|
+
function createFarmDocsSocialImageDescriptor(page, docs, requestUrl, format = "svg", basePath = "") {
|
|
243
281
|
const config = getSocialImageConfig(docs);
|
|
244
282
|
const siteName = config?.siteName || getNavTitle(docs);
|
|
245
283
|
const brand = config?.brand || siteName;
|
|
@@ -249,9 +287,9 @@ function createFarmDocsSocialImageDescriptor(page, docs, requestUrl) {
|
|
|
249
287
|
const illustration = resolveIllustration(page);
|
|
250
288
|
const entry = normalizeEntry(docs.entry);
|
|
251
289
|
const slugPath = encodeSlugPath(page.slug) || "index";
|
|
252
|
-
const imagePath = `${entry}/_social/${slugPath}/opengraph-image
|
|
290
|
+
const imagePath = `${entry}/_social/${slugPath}/opengraph-image.${format}`;
|
|
253
291
|
const baseUrl = resolveBaseUrl(requestUrl, config);
|
|
254
|
-
const pageUrl = new URL(page.href, baseUrl).href;
|
|
292
|
+
const pageUrl = new URL(applyFarmBasePath(page.href, basePath), baseUrl).href;
|
|
255
293
|
const imageAlt = `${title} \u2014 ${siteName} documentation`;
|
|
256
294
|
const hash = createHashValue({
|
|
257
295
|
version: FARM_DOCS_SOCIAL_IMAGE_VERSION,
|
|
@@ -273,32 +311,55 @@ function createFarmDocsSocialImageDescriptor(page, docs, requestUrl) {
|
|
|
273
311
|
pageHref: page.href,
|
|
274
312
|
pageUrl,
|
|
275
313
|
imagePath,
|
|
276
|
-
imageUrl: new URL(`${imagePath}?v=${hash}`, baseUrl).href,
|
|
314
|
+
imageUrl: new URL(`${applyFarmBasePath(imagePath, basePath)}?v=${hash}`, baseUrl).href,
|
|
277
315
|
imageAlt,
|
|
278
316
|
illustration,
|
|
279
317
|
fonts: config?.fonts,
|
|
318
|
+
format,
|
|
280
319
|
hash
|
|
281
320
|
};
|
|
282
321
|
}
|
|
283
322
|
function getFarmDocsSocialImageSlug(docs, requestUrl) {
|
|
284
323
|
const entry = normalizeEntry(docs.entry);
|
|
285
324
|
const prefix = `${entry}/_social/`;
|
|
286
|
-
const
|
|
287
|
-
if (!
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
const rawSlug = requestUrl.pathname.slice(prefix.length, -suffix.length);
|
|
325
|
+
const format = requestUrl.pathname.endsWith("/opengraph-image.png") ? "png" : requestUrl.pathname.endsWith("/opengraph-image.svg") ? "svg" : null;
|
|
326
|
+
if (!format || !requestUrl.pathname.startsWith(prefix)) return null;
|
|
327
|
+
const rawSlug = requestUrl.pathname.slice(prefix.length, -"/opengraph-image.svg".length);
|
|
291
328
|
if (!rawSlug) return null;
|
|
292
329
|
try {
|
|
293
330
|
const slug = rawSlug.split("/").map((segment) => decodeURIComponent(segment)).join("/");
|
|
294
331
|
if (slug.split("/").some((segment) => !segment || segment === ".." || segment === ".")) {
|
|
295
332
|
return null;
|
|
296
333
|
}
|
|
297
|
-
return slug === "index" ? "" : slug;
|
|
334
|
+
return { slug: slug === "index" ? "" : slug, format };
|
|
298
335
|
} catch {
|
|
299
336
|
return null;
|
|
300
337
|
}
|
|
301
338
|
}
|
|
339
|
+
var sharpLoad;
|
|
340
|
+
function loadSharp() {
|
|
341
|
+
sharpLoad ?? (sharpLoad = import("sharp").then(
|
|
342
|
+
(module) => module.default,
|
|
343
|
+
(error) => {
|
|
344
|
+
if (!isMissingPackageError(error, "sharp")) {
|
|
345
|
+
console.warn(
|
|
346
|
+
`[farm] Docs social images fall back to SVG because sharp failed to load: ${error instanceof Error ? error.message : String(error)}`
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
));
|
|
352
|
+
return sharpLoad;
|
|
353
|
+
}
|
|
354
|
+
async function resolveFarmDocsSocialImageFormat() {
|
|
355
|
+
return await loadSharp() ? "png" : "svg";
|
|
356
|
+
}
|
|
357
|
+
async function renderFarmDocsSocialImagePng(descriptor) {
|
|
358
|
+
const sharp = await loadSharp();
|
|
359
|
+
if (!sharp) return null;
|
|
360
|
+
const png = await sharp(Buffer.from(renderFarmDocsSocialImageSvg(descriptor))).png({ compressionLevel: 9, palette: true }).toBuffer();
|
|
361
|
+
return new Uint8Array(png);
|
|
362
|
+
}
|
|
302
363
|
function escapeXml(value) {
|
|
303
364
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
304
365
|
}
|
|
@@ -468,7 +529,11 @@ function renderFarmDocsSocialImageSvg(descriptor) {
|
|
|
468
529
|
const routeY = Math.max(418, descriptionY + descriptionLines.length * 29 + 24);
|
|
469
530
|
const section = truncate(descriptor.section.toUpperCase(), 27);
|
|
470
531
|
const route = truncate(descriptor.pageHref, 42);
|
|
471
|
-
const
|
|
532
|
+
const pageUrl = new URL(descriptor.pageUrl);
|
|
533
|
+
const footerUrl = truncate(
|
|
534
|
+
pageUrl.hostname.endsWith(".invalid") ? pageUrl.pathname : descriptor.pageUrl.replace(/^https?:\/\//, ""),
|
|
535
|
+
70
|
|
536
|
+
);
|
|
472
537
|
const brand = truncate(descriptor.brand.toUpperCase(), 25);
|
|
473
538
|
const titleId = `farm-docs-og-${descriptor.hash}`;
|
|
474
539
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -524,7 +589,7 @@ function renderFarmDocsSocialImageSvg(descriptor) {
|
|
|
524
589
|
function renderFarmDocsSocialMetadata(descriptor, customImage) {
|
|
525
590
|
const imageUrl = customImage ? new URL(customImage, descriptor.pageUrl).href : descriptor.imageUrl;
|
|
526
591
|
const customExtension = customImage?.toLowerCase().split(/[?#]/, 1)[0];
|
|
527
|
-
const imageType = customExtension
|
|
592
|
+
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
593
|
const tag = (property, content, name = false) => `<meta ${name ? "name" : "property"}="${property}" content="${escapeXml(content)}">`;
|
|
529
594
|
return [
|
|
530
595
|
tag("og:type", "article"),
|
|
@@ -860,11 +925,24 @@ function discoverFarmDocsPages(contentDir, docs) {
|
|
|
860
925
|
visit(contentDir);
|
|
861
926
|
return pages.sort((a, b) => a.href.localeCompare(b.href));
|
|
862
927
|
}
|
|
863
|
-
function
|
|
928
|
+
function listFarmDocsBuiltInPrerenderPages(docs, options) {
|
|
929
|
+
const pages = [];
|
|
930
|
+
const originDependent = [];
|
|
931
|
+
for (const root of getFarmDocsRoots(docs)) {
|
|
932
|
+
const contentDir = resolveFarmDocsContentDir(root, options);
|
|
933
|
+
for (const page of discoverFarmDocsPages(contentDir, root)) {
|
|
934
|
+
const loaded = loadFarmDocsPage(contentDir, root, page.slug);
|
|
935
|
+
if (!loaded) continue;
|
|
936
|
+
(farmDocsPageUsesRequestOrigin(loaded, root) ? originDependent : pages).push(loaded.href);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return { pages: [...new Set(pages)], originDependent: [...new Set(originDependent)] };
|
|
940
|
+
}
|
|
941
|
+
function toFarmDocsMarkdownPage(page, basePath = "") {
|
|
864
942
|
const lastModified = page.lastModified || page.frontmatter.lastModified || page.frontmatter.lastmod;
|
|
865
943
|
return {
|
|
866
944
|
slug: page.slug,
|
|
867
|
-
url: page.href,
|
|
945
|
+
url: applyFarmBasePath(page.href, basePath),
|
|
868
946
|
title: page.title,
|
|
869
947
|
description: page.description,
|
|
870
948
|
lastModified,
|
|
@@ -873,6 +951,47 @@ function toFarmDocsMarkdownPage(page) {
|
|
|
873
951
|
rawContent: page.body
|
|
874
952
|
};
|
|
875
953
|
}
|
|
954
|
+
function toFarmDocsRouteRequest(request, basePath) {
|
|
955
|
+
if (!basePath) return request;
|
|
956
|
+
const url = new URL(request.url);
|
|
957
|
+
const routePathname = stripFarmBasePath(url.pathname, basePath);
|
|
958
|
+
if (routePathname === url.pathname) return request;
|
|
959
|
+
url.pathname = routePathname;
|
|
960
|
+
return new Request(url, request);
|
|
961
|
+
}
|
|
962
|
+
function getFarmDocsSiteUrl(request, basePath) {
|
|
963
|
+
return `${new URL(request.url).origin}${basePath}`;
|
|
964
|
+
}
|
|
965
|
+
function getFarmDocsPublicEntry(docs, basePath) {
|
|
966
|
+
return basePath ? applyFarmBasePath(normalizeEntry2(docs.entry), basePath) : docs.entry;
|
|
967
|
+
}
|
|
968
|
+
function toFarmDocsPublicSitemapConfig(sitemap, basePath) {
|
|
969
|
+
if (!basePath || sitemap === false) return sitemap;
|
|
970
|
+
const configured = typeof sitemap === "object" ? sitemap : {};
|
|
971
|
+
return {
|
|
972
|
+
...configured,
|
|
973
|
+
routePrefix: `${basePath}/${trimSlashes(configured.routePrefix ?? "")}`
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function buildFarmDocsSitemapManifest(pages, docs, origin, basePath) {
|
|
977
|
+
return docsEngine().buildDocsSitemapManifest({
|
|
978
|
+
pages: pages.map((page) => ({
|
|
979
|
+
...toFarmDocsMarkdownPage(page, basePath),
|
|
980
|
+
sourcePath: page.sourcePath
|
|
981
|
+
})),
|
|
982
|
+
entry: getFarmDocsPublicEntry(docs, basePath),
|
|
983
|
+
siteTitle: getDocsTitle(docs),
|
|
984
|
+
baseUrl: origin
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
function renderFarmDocsRobotsTxt(docs, origin, basePath) {
|
|
988
|
+
return docsEngine().renderDocsRobotsTxt({
|
|
989
|
+
entry: getFarmDocsPublicEntry(docs, basePath),
|
|
990
|
+
sitemap: toFarmDocsPublicSitemapConfig(docs.config.sitemap ?? true, basePath),
|
|
991
|
+
robots: docs.config.robots ?? true,
|
|
992
|
+
baseUrl: origin
|
|
993
|
+
});
|
|
994
|
+
}
|
|
876
995
|
function getDocsTitle(docs) {
|
|
877
996
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
878
997
|
}
|
|
@@ -885,12 +1004,6 @@ function getLoadedDocsPages(contentDir, docs, isPathGuarded) {
|
|
|
885
1004
|
function toDocsLlmsPage(page) {
|
|
886
1005
|
return toFarmDocsMarkdownPage(page);
|
|
887
1006
|
}
|
|
888
|
-
function toDocsSitemapPage(page) {
|
|
889
|
-
return {
|
|
890
|
-
...toFarmDocsMarkdownPage(page),
|
|
891
|
-
sourcePath: page.sourcePath
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
1007
|
function resolvePageActionsConfig(docs) {
|
|
895
1008
|
return isObjectRecord(docs.config.pageActions) ? docs.config.pageActions : {};
|
|
896
1009
|
}
|
|
@@ -964,10 +1077,10 @@ function renderReadingTimeMeta(page, docs) {
|
|
|
964
1077
|
<span class="fd-page-meta-item">${escapeHtml(label)}</span>
|
|
965
1078
|
</div>`;
|
|
966
1079
|
}
|
|
967
|
-
function renderPixelPageActions(page, docs) {
|
|
1080
|
+
function renderPixelPageActions(page, docs, basePath) {
|
|
968
1081
|
const copyMarkdown = resolveCopyMarkdownActionConfig(docs);
|
|
969
1082
|
if (!copyMarkdown) return "";
|
|
970
|
-
const markdownUrl = `${page.href}.md
|
|
1083
|
+
const markdownUrl = applyFarmBasePath(`${page.href}.md`, basePath);
|
|
971
1084
|
const includeTitle = copyMarkdown.includeTitle ? "true" : "false";
|
|
972
1085
|
return `<div class="fd-page-actions" data-page-actions data-actions-alignment="${resolvePageActionsAlignment(docs)}">
|
|
973
1086
|
<button
|
|
@@ -989,9 +1102,9 @@ function renderPixelPageActions(page, docs) {
|
|
|
989
1102
|
</button>
|
|
990
1103
|
</div>`;
|
|
991
1104
|
}
|
|
992
|
-
function renderBelowTitleMeta(page, docs) {
|
|
1105
|
+
function renderBelowTitleMeta(page, docs, basePath) {
|
|
993
1106
|
const lastUpdated = renderLastUpdatedText(page, docs, "below-title");
|
|
994
|
-
const actions = renderPixelPageActions(page, docs);
|
|
1107
|
+
const actions = renderPixelPageActions(page, docs, basePath);
|
|
995
1108
|
const readingTime = renderReadingTimeMeta(page, docs);
|
|
996
1109
|
if (!lastUpdated && !actions && !readingTime) return "";
|
|
997
1110
|
return `<div class="fd-below-title-block not-prose">
|
|
@@ -1000,8 +1113,8 @@ function renderBelowTitleMeta(page, docs) {
|
|
|
1000
1113
|
${readingTime}
|
|
1001
1114
|
</div>`;
|
|
1002
1115
|
}
|
|
1003
|
-
function renderMarkdownHtmlWithTitleMeta(page, docs, html) {
|
|
1004
|
-
const meta = renderBelowTitleMeta(page, docs);
|
|
1116
|
+
function renderMarkdownHtmlWithTitleMeta(page, docs, html, basePath) {
|
|
1117
|
+
const meta = renderBelowTitleMeta(page, docs, basePath);
|
|
1005
1118
|
if (!meta) return html;
|
|
1006
1119
|
const withTitleMeta = html.replace(/(<h1\b[\s\S]*?<\/h1>)/, `$1
|
|
1007
1120
|
${meta}`);
|
|
@@ -1015,18 +1128,20 @@ function renderPixelPageFooter(page, docs) {
|
|
|
1015
1128
|
<span class="fd-last-updated-footer">${lastUpdated}</span>
|
|
1016
1129
|
</div>`;
|
|
1017
1130
|
}
|
|
1018
|
-
function getDocsLlmsOptions(docs, request) {
|
|
1131
|
+
function getDocsLlmsOptions(docs, request, basePath) {
|
|
1019
1132
|
const configured = typeof docs.config.llmsTxt === "object" && docs.config.llmsTxt !== null ? docs.config.llmsTxt : {};
|
|
1020
1133
|
return {
|
|
1021
1134
|
enabled: true,
|
|
1022
|
-
baseUrl:
|
|
1135
|
+
baseUrl: getFarmDocsSiteUrl(request, basePath),
|
|
1023
1136
|
siteTitle: getDocsTitle(docs),
|
|
1024
1137
|
siteDescription: getDocsDescription(docs),
|
|
1025
1138
|
...configured
|
|
1026
1139
|
};
|
|
1027
1140
|
}
|
|
1028
|
-
function getDocsDiscoveryOptions(docs, request) {
|
|
1141
|
+
function getDocsDiscoveryOptions(docs, request, basePath) {
|
|
1029
1142
|
return {
|
|
1143
|
+
// The discovery files list the docs engine's routes as root-relative paths, which answer at
|
|
1144
|
+
// the origin root too. `llms.baseUrl` gives the site's own URL, below the basePath.
|
|
1030
1145
|
origin: new URL(request.url).origin,
|
|
1031
1146
|
entry: docs.entry,
|
|
1032
1147
|
i18n: null,
|
|
@@ -1048,7 +1163,7 @@ function getDocsDiscoveryOptions(docs, request) {
|
|
|
1048
1163
|
}
|
|
1049
1164
|
},
|
|
1050
1165
|
feedback: void 0,
|
|
1051
|
-
llms: getDocsLlmsOptions(docs, request),
|
|
1166
|
+
llms: getDocsLlmsOptions(docs, request, basePath),
|
|
1052
1167
|
sitemap: docs.config.sitemap ?? true,
|
|
1053
1168
|
robots: docs.config.robots ?? true,
|
|
1054
1169
|
openapi: void 0,
|
|
@@ -1058,16 +1173,11 @@ function getDocsDiscoveryOptions(docs, request) {
|
|
|
1058
1173
|
}
|
|
1059
1174
|
};
|
|
1060
1175
|
}
|
|
1061
|
-
function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded) {
|
|
1176
|
+
function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded, basePath) {
|
|
1062
1177
|
const url = new URL(request.url);
|
|
1063
1178
|
let loadedPages;
|
|
1064
1179
|
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
|
-
});
|
|
1180
|
+
const sitemapManifest = () => buildFarmDocsSitemapManifest(getPages(), docs, url.origin, basePath);
|
|
1071
1181
|
const textHeaders = (contentType) => ({
|
|
1072
1182
|
"Content-Type": contentType,
|
|
1073
1183
|
"Cache-Control": "public, max-age=60"
|
|
@@ -1076,7 +1186,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded)
|
|
|
1076
1186
|
if (llmsFormat) {
|
|
1077
1187
|
const generated = docsEngine().renderDocsLlmsTxt(
|
|
1078
1188
|
getPages().map(toDocsLlmsPage),
|
|
1079
|
-
getDocsLlmsOptions(docs, request)
|
|
1189
|
+
getDocsLlmsOptions(docs, request, basePath)
|
|
1080
1190
|
);
|
|
1081
1191
|
return new Response(llmsFormat === "llms-full" ? generated.llmsFullTxt : generated.llmsTxt, {
|
|
1082
1192
|
status: 200,
|
|
@@ -1108,21 +1218,15 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded)
|
|
|
1108
1218
|
);
|
|
1109
1219
|
}
|
|
1110
1220
|
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
|
-
);
|
|
1221
|
+
return new Response(renderFarmDocsRobotsTxt(docs, url.origin, basePath), {
|
|
1222
|
+
status: 200,
|
|
1223
|
+
headers: textHeaders("text/plain; charset=utf-8")
|
|
1224
|
+
});
|
|
1123
1225
|
}
|
|
1124
1226
|
if (docsEngine().isDocsAgentDiscoveryRequest(url)) {
|
|
1125
|
-
const spec = docsEngine().buildDocsAgentDiscoverySpec(
|
|
1227
|
+
const spec = docsEngine().buildDocsAgentDiscoverySpec(
|
|
1228
|
+
getDocsDiscoveryOptions(docs, request, basePath)
|
|
1229
|
+
);
|
|
1126
1230
|
const title = getDocsTitle(docs);
|
|
1127
1231
|
return new Response(
|
|
1128
1232
|
JSON.stringify({
|
|
@@ -1143,7 +1247,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded)
|
|
|
1143
1247
|
}
|
|
1144
1248
|
if (docsEngine().isDocsAgentsRequest(url)) {
|
|
1145
1249
|
return new Response(
|
|
1146
|
-
`${docsEngine().renderDocsAgentsDocument(getDocsDiscoveryOptions(docs, request)).trim()}
|
|
1250
|
+
`${docsEngine().renderDocsAgentsDocument(getDocsDiscoveryOptions(docs, request, basePath)).trim()}
|
|
1147
1251
|
`,
|
|
1148
1252
|
{
|
|
1149
1253
|
status: 200,
|
|
@@ -1153,7 +1257,7 @@ function createFarmDocsPublicResponse(contentDir, docs, request, isPathGuarded)
|
|
|
1153
1257
|
}
|
|
1154
1258
|
if (docsEngine().isDocsSkillRequest(url)) {
|
|
1155
1259
|
return new Response(
|
|
1156
|
-
`${docsEngine().renderDocsSkillDocument(getDocsDiscoveryOptions(docs, request)).trim()}
|
|
1260
|
+
`${docsEngine().renderDocsSkillDocument(getDocsDiscoveryOptions(docs, request, basePath)).trim()}
|
|
1157
1261
|
`,
|
|
1158
1262
|
{
|
|
1159
1263
|
status: 200,
|
|
@@ -1571,9 +1675,9 @@ function getSidebarPageLabel(item, configured) {
|
|
|
1571
1675
|
}
|
|
1572
1676
|
return item.title;
|
|
1573
1677
|
}
|
|
1574
|
-
function renderSidebarLink(item, activeHref, docs, configured) {
|
|
1678
|
+
function renderSidebarLink(item, activeHref, docs, basePath, configured) {
|
|
1575
1679
|
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>`;
|
|
1680
|
+
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
1681
|
}
|
|
1578
1682
|
function collectConfiguredSidebarPages(items, maps, seen = /* @__PURE__ */ new Set()) {
|
|
1579
1683
|
const ordered = [];
|
|
@@ -1611,24 +1715,24 @@ ${childHtml}
|
|
|
1611
1715
|
</div>
|
|
1612
1716
|
</div>`;
|
|
1613
1717
|
}
|
|
1614
|
-
function renderConfiguredSidebarItems(items, maps, activeHref, docs) {
|
|
1718
|
+
function renderConfiguredSidebarItems(items, maps, activeHref, docs, basePath) {
|
|
1615
1719
|
const renderedItems = [];
|
|
1616
1720
|
for (const item of items) {
|
|
1617
1721
|
const page = resolveConfiguredSidebarPage(item, maps);
|
|
1618
|
-
const childHtml = renderConfiguredSidebarItems(item.children, maps, activeHref, docs);
|
|
1722
|
+
const childHtml = renderConfiguredSidebarItems(item.children, maps, activeHref, docs, basePath);
|
|
1619
1723
|
if (item.children.length > 0) {
|
|
1620
1724
|
renderedItems.push(renderConfiguredSidebarSubgroup(item, childHtml, docs));
|
|
1621
1725
|
continue;
|
|
1622
1726
|
}
|
|
1623
|
-
const linkHtml = page ? renderSidebarLink(page, activeHref, docs, item) : renderExternalSidebarLink(item, activeHref, docs);
|
|
1727
|
+
const linkHtml = page ? renderSidebarLink(page, activeHref, docs, basePath, item) : renderExternalSidebarLink(item, activeHref, docs);
|
|
1624
1728
|
if (linkHtml) renderedItems.push(linkHtml);
|
|
1625
1729
|
}
|
|
1626
1730
|
return renderedItems.join("\n");
|
|
1627
1731
|
}
|
|
1628
|
-
function renderConfiguredSidebarSection(section, maps, activeHref, docs) {
|
|
1732
|
+
function renderConfiguredSidebarSection(section, maps, activeHref, docs, basePath) {
|
|
1629
1733
|
const label = section.label || "Docs";
|
|
1630
1734
|
const id = sidebarIdFor(label);
|
|
1631
|
-
const links = renderConfiguredSidebarItems(section.children, maps, activeHref, docs);
|
|
1735
|
+
const links = renderConfiguredSidebarItems(section.children, maps, activeHref, docs, basePath);
|
|
1632
1736
|
return `<div class="sidebar-folder fd-sidebar-folder" data-state="open">
|
|
1633
1737
|
<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
1738
|
<div id="${escapeAttribute(id)}" class="overflow-hidden sidebar-folder-content fd-sidebar-folder-content" data-state="open">
|
|
@@ -1636,19 +1740,19 @@ ${links}
|
|
|
1636
1740
|
</div>
|
|
1637
1741
|
</div>`;
|
|
1638
1742
|
}
|
|
1639
|
-
function renderAutoSidebarSectionItems(items, activeHref, docs) {
|
|
1640
|
-
return [...items].sort(compareSidebarPages).map((item) => renderSidebarLink(item, activeHref, docs)).join("\n");
|
|
1743
|
+
function renderAutoSidebarSectionItems(items, activeHref, docs, basePath) {
|
|
1744
|
+
return [...items].sort(compareSidebarPages).map((item) => renderSidebarLink(item, activeHref, docs, basePath)).join("\n");
|
|
1641
1745
|
}
|
|
1642
|
-
function renderPixelNavItems(pages, activeHref, docs) {
|
|
1746
|
+
function renderPixelNavItems(pages, activeHref, docs, basePath) {
|
|
1643
1747
|
const configuredSidebar = getSidebarNavigation(docs);
|
|
1644
1748
|
if (configuredSidebar.length > 0) {
|
|
1645
1749
|
const maps = createSidebarPageMaps(pages);
|
|
1646
1750
|
const renderedSections2 = configuredSidebar.map((section) => {
|
|
1647
1751
|
if (section.children.length > 0) {
|
|
1648
|
-
return renderConfiguredSidebarSection(section, maps, activeHref, docs);
|
|
1752
|
+
return renderConfiguredSidebarSection(section, maps, activeHref, docs, basePath);
|
|
1649
1753
|
}
|
|
1650
1754
|
const page = resolveConfiguredSidebarPage(section, maps);
|
|
1651
|
-
return page ? renderSidebarLink(page, activeHref, docs, section) : renderExternalSidebarLink(section, activeHref, docs);
|
|
1755
|
+
return page ? renderSidebarLink(page, activeHref, docs, basePath, section) : renderExternalSidebarLink(section, activeHref, docs);
|
|
1652
1756
|
}).filter(Boolean).join("\n");
|
|
1653
1757
|
return `<div class="sidebar-scroll overscroll-contain fd-sidebar-nav">
|
|
1654
1758
|
<div class="sidebar-tree">
|
|
@@ -1669,7 +1773,7 @@ ${renderedSections2}
|
|
|
1669
1773
|
return (aOrder === -1 ? 100 : aOrder) - (bOrder === -1 ? 100 : bOrder) || a.localeCompare(b);
|
|
1670
1774
|
}).map(([section, items]) => {
|
|
1671
1775
|
const id = sidebarIdFor(section);
|
|
1672
|
-
const links = renderAutoSidebarSectionItems(items, activeHref, docs);
|
|
1776
|
+
const links = renderAutoSidebarSectionItems(items, activeHref, docs, basePath);
|
|
1673
1777
|
return `<div class="sidebar-folder fd-sidebar-folder" data-state="open">
|
|
1674
1778
|
<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
1779
|
<div id="${escapeAttribute(id)}" class="overflow-hidden sidebar-folder-content fd-sidebar-folder-content" data-state="open">
|
|
@@ -1683,7 +1787,7 @@ ${renderedSections}
|
|
|
1683
1787
|
</div>
|
|
1684
1788
|
</div>`;
|
|
1685
1789
|
}
|
|
1686
|
-
function renderPixelPageNav(pages, activeHref, docs) {
|
|
1790
|
+
function renderPixelPageNav(pages, activeHref, docs, basePath) {
|
|
1687
1791
|
const orderedPages = getOrderedSidebarPages(pages, docs);
|
|
1688
1792
|
const activeIndex = orderedPages.findIndex((item) => item.href === activeHref);
|
|
1689
1793
|
if (activeIndex === -1) return "";
|
|
@@ -1691,7 +1795,7 @@ function renderPixelPageNav(pages, activeHref, docs) {
|
|
|
1691
1795
|
const next = orderedPages[activeIndex + 1];
|
|
1692
1796
|
if (!previous && !next) return "";
|
|
1693
1797
|
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)}">
|
|
1798
|
+
const renderCard = (item, direction) => `<a class="fd-page-nav-card fd-page-nav-${direction}" href="${escapeAttribute(applyFarmBasePath(item.href, basePath))}">
|
|
1695
1799
|
<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
1800
|
<span class="fd-page-nav-description">${direction === "prev" ? "Previous Page" : "Next Page"}</span>
|
|
1697
1801
|
</a>`;
|
|
@@ -1711,7 +1815,7 @@ function isBreadcrumbEnabled(docs) {
|
|
|
1711
1815
|
}
|
|
1712
1816
|
return true;
|
|
1713
1817
|
}
|
|
1714
|
-
function renderPixelBreadcrumb(page, docs) {
|
|
1818
|
+
function renderPixelBreadcrumb(page, docs, basePath) {
|
|
1715
1819
|
if (!isBreadcrumbEnabled(docs)) return "";
|
|
1716
1820
|
const segments = trimSlashes(page.slug).split("/").filter(Boolean);
|
|
1717
1821
|
if (segments.length < 2) return "";
|
|
@@ -1720,7 +1824,10 @@ function renderPixelBreadcrumb(page, docs) {
|
|
|
1720
1824
|
const currentSegment = segments[segments.length - 1];
|
|
1721
1825
|
const entry = normalizeEntry2(docs.entry);
|
|
1722
1826
|
const parentPath = parentSegments.join("/");
|
|
1723
|
-
const parentHref =
|
|
1827
|
+
const parentHref = applyFarmBasePath(
|
|
1828
|
+
entry === "/" ? `/${parentPath}` : `${entry}/${parentPath}`,
|
|
1829
|
+
basePath
|
|
1830
|
+
);
|
|
1724
1831
|
return `<nav class="fd-breadcrumb" aria-label="Breadcrumb">
|
|
1725
1832
|
<span class="fd-breadcrumb-item">
|
|
1726
1833
|
<a class="fd-breadcrumb-parent fd-breadcrumb-link" href="${escapeAttribute(parentHref)}">${escapeHtml(titleizePathSegment(parentSegment))}</a>
|
|
@@ -1755,8 +1862,8 @@ ${items.map(
|
|
|
1755
1862
|
</div>
|
|
1756
1863
|
</div>`;
|
|
1757
1864
|
}
|
|
1758
|
-
function renderDocsRuntimeScript(docs) {
|
|
1759
|
-
const docsEntry = JSON.stringify(normalizeEntry2(docs.entry));
|
|
1865
|
+
function renderDocsRuntimeScript(docs, basePath) {
|
|
1866
|
+
const docsEntry = JSON.stringify(applyFarmBasePath(normalizeEntry2(docs.entry), basePath));
|
|
1760
1867
|
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
1868
|
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
1869
|
}
|
|
@@ -1766,8 +1873,8 @@ function renderDocsPageActionsRuntimeScript() {
|
|
|
1766
1873
|
function renderDocsHashRuntimeScript() {
|
|
1767
1874
|
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
1875
|
}
|
|
1769
|
-
function renderDocsRuntimeScripts(docs) {
|
|
1770
|
-
return stampFarmCspNonce(`${renderDocsRuntimeScript(docs)}
|
|
1876
|
+
function renderDocsRuntimeScripts(docs, basePath) {
|
|
1877
|
+
return stampFarmCspNonce(`${renderDocsRuntimeScript(docs, basePath)}
|
|
1771
1878
|
${renderDocsHashRuntimeScript()}
|
|
1772
1879
|
${renderDocsPageActionsRuntimeScript()}`);
|
|
1773
1880
|
}
|
|
@@ -1792,7 +1899,7 @@ function getFarmLayoutFontPreloads(layoutFonts) {
|
|
|
1792
1899
|
function renderFarmLayoutFontPreloadHeader(layoutFonts) {
|
|
1793
1900
|
return getFarmLayoutFontPreloads(layoutFonts).map(({ href, type }) => `<${href}>; rel=preload; as=font; type=${type}; crossorigin`).join(", ");
|
|
1794
1901
|
}
|
|
1795
|
-
function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, requestUrl, fontAssets, fontStylesheetHref, globalStylesheetHref) {
|
|
1902
|
+
function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, requestUrl, fontAssets, basePath, fontStylesheetHref, globalStylesheetHref, socialImageFormat = "svg") {
|
|
1796
1903
|
const navTitle = typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Docs") : "Docs";
|
|
1797
1904
|
const description = page.description || docs.config.metadata?.description || "";
|
|
1798
1905
|
const renderedMarkdown = renderMarkdownDocument(page.body, getThemeTocDepth(docs));
|
|
@@ -1800,9 +1907,10 @@ function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, reques
|
|
|
1800
1907
|
const themeName = getThemeName(docs);
|
|
1801
1908
|
const searchEnabled = isFarmDocsSearchEnabled(docs);
|
|
1802
1909
|
const socialMetadata = isFarmDocsSocialImageEnabled(page, docs) ? renderFarmDocsSocialMetadata(
|
|
1803
|
-
createFarmDocsSocialImageDescriptor(page, docs, requestUrl),
|
|
1910
|
+
createFarmDocsSocialImageDescriptor(page, docs, requestUrl, socialImageFormat, basePath),
|
|
1804
1911
|
getFarmDocsCustomSocialImage(page)
|
|
1805
1912
|
) : "";
|
|
1913
|
+
const homeHref = escapeAttribute(applyFarmBasePath("/", basePath));
|
|
1806
1914
|
return `<!DOCTYPE html>
|
|
1807
1915
|
<html class="dark" lang="en" data-docs-theme="${escapeAttribute(themeName)}">
|
|
1808
1916
|
<head>
|
|
@@ -1824,28 +1932,28 @@ function renderPixelDocsHtml(page, pages, docs, clientEntry, faviconHref, reques
|
|
|
1824
1932
|
<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
1933
|
<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
1934
|
</button>
|
|
1827
|
-
<a class="fd-header-title" href="
|
|
1935
|
+
<a class="fd-header-title" href="${homeHref}">${escapeHtml(navTitle)}</a>
|
|
1828
1936
|
<div class="mobile-topbar-actions">
|
|
1829
1937
|
${searchEnabled ? renderDocsSearchTrigger(true, "fd-search-trigger-mobile") : ""}
|
|
1830
|
-
<a class="mobile-topbar-link" href="/llms.txt">llms.txt</a>
|
|
1938
|
+
<a class="mobile-topbar-link" href="${escapeAttribute(applyFarmBasePath("/llms.txt", basePath))}">llms.txt</a>
|
|
1831
1939
|
</div>
|
|
1832
1940
|
</header>
|
|
1833
1941
|
<aside id="nd-sidebar" class="fd-sidebar">
|
|
1834
1942
|
<div class="sidebar-brand fd-sidebar-header">
|
|
1835
|
-
<a class="fd-sidebar-title" href="
|
|
1943
|
+
<a class="fd-sidebar-title" href="${homeHref}">${renderFarmDocsBrandMark()}${renderFarmDocsBrandTitle(navTitle)}</a>
|
|
1836
1944
|
<span>/ docs</span>
|
|
1837
1945
|
</div>
|
|
1838
1946
|
${searchEnabled ? `<div class="fd-sidebar-search">${renderDocsSearchTrigger(true, "fd-sidebar-search-btn")}</div>` : ""}
|
|
1839
|
-
${renderPixelNavItems(pages, page.href, docs)}
|
|
1947
|
+
${renderPixelNavItems(pages, page.href, docs, basePath)}
|
|
1840
1948
|
</aside>
|
|
1841
1949
|
<div class="sidebar-backdrop fd-sidebar-overlay" data-sidebar-backdrop></div>
|
|
1842
1950
|
<main class="fd-main">
|
|
1843
1951
|
<div class="fd-page">
|
|
1844
1952
|
<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)}
|
|
1953
|
+
${renderPixelBreadcrumb(page, docs, basePath)}
|
|
1954
|
+
${renderMarkdownHtmlWithTitleMeta(page, docs, renderedMarkdown.html, basePath)}
|
|
1847
1955
|
${renderPixelPageFooter(page, docs)}
|
|
1848
|
-
${renderPixelPageNav(pages, page.href, docs)}
|
|
1956
|
+
${renderPixelPageNav(pages, page.href, docs, basePath)}
|
|
1849
1957
|
</article>
|
|
1850
1958
|
<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
1959
|
<div class="fd-toc-inner">
|
|
@@ -1859,7 +1967,7 @@ ${renderMarkdownHtmlWithTitleMeta(page, docs, renderedMarkdown.html)}
|
|
|
1859
1967
|
</main>
|
|
1860
1968
|
</div>
|
|
1861
1969
|
${searchEnabled ? renderDocsSearchMount(clientEntry) : ""}
|
|
1862
|
-
${renderDocsRuntimeScripts(docs)}
|
|
1970
|
+
${renderDocsRuntimeScripts(docs, basePath)}
|
|
1863
1971
|
</body>
|
|
1864
1972
|
</html>`;
|
|
1865
1973
|
}
|
|
@@ -1867,25 +1975,40 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1867
1975
|
const faviconHref = resolveFarmDocsFavicon(docs, options);
|
|
1868
1976
|
const fontAssets = options.fontAssets ?? toFarmDocsPublicFontAssets(resolveFarmDocsFontAssets(options.root));
|
|
1869
1977
|
const fallbackFontPreloadHeader = renderFarmDocsFontPreloadHeader(fontAssets);
|
|
1870
|
-
|
|
1871
|
-
|
|
1978
|
+
const basePath = normalizeFarmBasePath(options.basePath);
|
|
1979
|
+
return async function handleFarmDocsRequest(incomingRequest) {
|
|
1980
|
+
if (!docs?.enabled || incomingRequest.method !== "GET" && incomingRequest.method !== "HEAD") {
|
|
1981
|
+
return null;
|
|
1982
|
+
}
|
|
1872
1983
|
await loadFarmDocsEngine();
|
|
1873
|
-
const
|
|
1984
|
+
const request = toFarmDocsRouteRequest(incomingRequest, basePath);
|
|
1874
1985
|
const requestUrl = new URL(request.url);
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1986
|
+
if (request !== incomingRequest && (requestUrl.pathname === "/api/docs" || requestUrl.pathname.startsWith("/api/docs/"))) {
|
|
1987
|
+
return null;
|
|
1988
|
+
}
|
|
1989
|
+
const contentDir = resolveFarmDocsContentDir(docs, options);
|
|
1990
|
+
const socialImageTarget = getFarmDocsSocialImageSlug(docs, requestUrl);
|
|
1991
|
+
if (socialImageTarget !== null) {
|
|
1992
|
+
const socialImagePage = loadFarmDocsPage(contentDir, docs, socialImageTarget.slug);
|
|
1878
1993
|
if (!socialImagePage || // The image sits outside the page's URL, where its guard does not reach, and
|
|
1879
1994
|
// draws the page's title.
|
|
1880
1995
|
options.isPathGuarded?.(socialImagePage.href) || !isFarmDocsSocialImageEnabled(socialImagePage, docs) || getFarmDocsCustomSocialImage(socialImagePage)) {
|
|
1881
1996
|
return null;
|
|
1882
1997
|
}
|
|
1883
|
-
const descriptor = createFarmDocsSocialImageDescriptor(
|
|
1998
|
+
const descriptor = createFarmDocsSocialImageDescriptor(
|
|
1999
|
+
socialImagePage,
|
|
2000
|
+
docs,
|
|
2001
|
+
requestUrl,
|
|
2002
|
+
socialImageTarget.format,
|
|
2003
|
+
basePath
|
|
2004
|
+
);
|
|
1884
2005
|
if (requestUrl.pathname !== descriptor.imagePath) return null;
|
|
1885
|
-
const
|
|
2006
|
+
const png = descriptor.format === "png";
|
|
2007
|
+
if (png && await resolveFarmDocsSocialImageFormat() !== "png") return null;
|
|
2008
|
+
const etag = `"${descriptor.hash}${png ? "-png" : ""}"`;
|
|
1886
2009
|
const immutable = requestUrl.searchParams.get("v") === descriptor.hash;
|
|
1887
2010
|
const headers = new Headers({
|
|
1888
|
-
"Content-Type": "image/svg+xml; charset=utf-8",
|
|
2011
|
+
"Content-Type": png ? "image/png" : "image/svg+xml; charset=utf-8",
|
|
1889
2012
|
"Cache-Control": immutable ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate",
|
|
1890
2013
|
ETag: etag,
|
|
1891
2014
|
"X-Content-Type-Options": "nosniff"
|
|
@@ -1894,13 +2017,18 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1894
2017
|
return new Response(null, { status: 304, headers });
|
|
1895
2018
|
}
|
|
1896
2019
|
if (request.method === "HEAD") return new Response(null, { status: 200, headers });
|
|
2020
|
+
if (png) {
|
|
2021
|
+
const image = await renderFarmDocsSocialImagePng(descriptor);
|
|
2022
|
+
return image ? new Response(image, { status: 200, headers }) : null;
|
|
2023
|
+
}
|
|
1897
2024
|
return new Response(renderFarmDocsSocialImageSvg(descriptor), { status: 200, headers });
|
|
1898
2025
|
}
|
|
1899
2026
|
const publicResponse = createFarmDocsPublicResponse(
|
|
1900
2027
|
contentDir,
|
|
1901
2028
|
docs,
|
|
1902
2029
|
request,
|
|
1903
|
-
options.isPathGuarded
|
|
2030
|
+
options.isPathGuarded,
|
|
2031
|
+
basePath
|
|
1904
2032
|
);
|
|
1905
2033
|
if (publicResponse) return omitFarmDocsHeadBody(request, publicResponse);
|
|
1906
2034
|
if (!isFarmDocsRequest(docs, request)) return null;
|
|
@@ -1915,10 +2043,10 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1915
2043
|
return omitFarmDocsHeadBody(
|
|
1916
2044
|
request,
|
|
1917
2045
|
new Response(
|
|
1918
|
-
docsEngine().renderDocsMarkdownDocument(toFarmDocsMarkdownPage(page), {
|
|
2046
|
+
docsEngine().renderDocsMarkdownDocument(toFarmDocsMarkdownPage(page, basePath), {
|
|
1919
2047
|
origin,
|
|
1920
2048
|
llms: docs.config.llmsTxt ?? true,
|
|
1921
|
-
sitemap: docs.config.sitemap
|
|
2049
|
+
sitemap: toFarmDocsPublicSitemapConfig(docs.config.sitemap, basePath)
|
|
1922
2050
|
}),
|
|
1923
2051
|
{
|
|
1924
2052
|
status: 200,
|
|
@@ -1932,6 +2060,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1932
2060
|
);
|
|
1933
2061
|
}
|
|
1934
2062
|
const pathname = new URL(request.url).pathname;
|
|
2063
|
+
const socialImageFormat = isFarmDocsSocialImageEnabled(page, docs) && !getFarmDocsCustomSocialImage(page) ? await resolveFarmDocsSocialImageFormat() : "svg";
|
|
1935
2064
|
const layoutFonts = await options.resolveLayoutFonts?.(pathname);
|
|
1936
2065
|
const usesLayoutFonts = Boolean(layoutFonts?.body || layoutFonts?.code);
|
|
1937
2066
|
const activeFontAssets = usesLayoutFonts ? [] : fontAssets;
|
|
@@ -1947,8 +2076,10 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1947
2076
|
faviconHref,
|
|
1948
2077
|
requestUrl,
|
|
1949
2078
|
activeFontAssets,
|
|
2079
|
+
basePath,
|
|
1950
2080
|
usesLayoutFonts ? options.fontStylesheetHref : void 0,
|
|
1951
|
-
options.globalStylesheetHref
|
|
2081
|
+
options.globalStylesheetHref,
|
|
2082
|
+
socialImageFormat
|
|
1952
2083
|
),
|
|
1953
2084
|
{
|
|
1954
2085
|
status: 200,
|
|
@@ -1975,6 +2106,12 @@ export {
|
|
|
1975
2106
|
loadFarmDocsPage,
|
|
1976
2107
|
getFarmDocsMarkdownPath,
|
|
1977
2108
|
discoverFarmDocsPages,
|
|
2109
|
+
listFarmDocsBuiltInPrerenderPages,
|
|
1978
2110
|
toFarmDocsMarkdownPage,
|
|
2111
|
+
getFarmDocsSiteUrl,
|
|
2112
|
+
getFarmDocsPublicEntry,
|
|
2113
|
+
toFarmDocsPublicSitemapConfig,
|
|
2114
|
+
buildFarmDocsSitemapManifest,
|
|
2115
|
+
renderFarmDocsRobotsTxt,
|
|
1979
2116
|
createFarmDocsHandler
|
|
1980
2117
|
};
|