@farm.js/core 0.1.73 → 0.1.75
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-VBCA3WZ6.cjs → agent-mcp-handler-73SGWVZT.cjs} +9 -9
- package/dist/{agent-mcp-handler-RK7LDYEL.mjs → agent-mcp-handler-PJKZHYSA.mjs} +8 -8
- package/dist/{agent-mcp.d-D_gHjCAE.d.ts → agent-mcp.d-Djvao5eV.d.ts} +24 -2
- package/dist/{agent-mcp.d-PvEf-1mi.d.mts → agent-mcp.d-wA13pwmS.d.mts} +24 -2
- package/dist/agent-runtime.cjs +9 -9
- package/dist/agent-runtime.d.mts +4 -4
- package/dist/agent-runtime.d.ts +4 -4
- package/dist/agent-runtime.mjs +8 -8
- package/dist/analyzer-23GCBYFI.cjs +16 -0
- package/dist/{analyzer-MFYCJT75.mjs → analyzer-LJHMFCDW.mjs} +2 -2
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.d.mts +3 -3
- package/dist/api/client.d.ts +3 -3
- package/dist/api/client.mjs +3 -3
- package/dist/api/client.native.cjs +6 -6
- package/dist/api/client.native.d.mts +4 -4
- package/dist/api/client.native.d.ts +4 -4
- package/dist/api/client.native.mjs +3 -3
- package/dist/api/node.cjs +14 -13
- package/dist/api/node.d.mts +6 -6
- package/dist/api/node.d.ts +6 -6
- package/dist/api/node.mjs +13 -12
- package/dist/api/route-manager.cjs +23 -21
- package/dist/api/route-manager.d.mts +9 -7
- package/dist/api/route-manager.d.ts +9 -7
- package/dist/api/route-manager.mjs +22 -20
- package/dist/api/runtime.cjs +13 -12
- package/dist/api/runtime.d.mts +5 -5
- package/dist/api/runtime.d.ts +5 -5
- package/dist/api/runtime.mjs +12 -11
- package/dist/{api-client.d-Bp35zMqR.d.mts → api-client.d-CyVmI4Di.d.mts} +2 -2
- package/dist/{api-client.d-CFI_xL0V.d.ts → api-client.d-DrTM7BdH.d.ts} +2 -2
- package/dist/api.cjs +26 -24
- package/dist/api.d.mts +9 -9
- package/dist/api.d.ts +9 -9
- package/dist/api.mjs +25 -23
- package/dist/{app-manifest.d-BpVTg43i.d.ts → app-manifest.d-BukcP_EV.d.ts} +10 -1
- package/dist/{app-manifest.d-CN7cEWHX.d.mts → app-manifest.d-DIuqSi9k.d.mts} +10 -1
- package/dist/app-markdown.cjs +11 -7
- package/dist/app-markdown.d.mts +6 -6
- package/dist/app-markdown.d.ts +6 -6
- package/dist/app-markdown.mjs +10 -6
- package/dist/{app.d-DO4PTCWm.d.ts → app.d-BQqmM6Gy.d.ts} +55 -4
- package/dist/{app.d-BFWzAdTe.d.mts → app.d-YVuFb10p.d.mts} +55 -4
- package/dist/{base-path.d-BJ3SYpB8.d.mts → base-path.d-m7wvRMnG.d.mts} +15 -1
- package/dist/{base-path.d-BJ3SYpB8.d.ts → base-path.d-m7wvRMnG.d.ts} +15 -1
- package/dist/cache.cjs +2 -2
- package/dist/cache.d.mts +22 -1
- package/dist/cache.d.ts +22 -1
- package/dist/cache.mjs +1 -1
- package/dist/{chunk-JYNNIGQO.cjs → chunk-25JGHAGH.cjs} +11 -1
- package/dist/{chunk-GWXZS7K5.mjs → chunk-2LKUR5QJ.mjs} +1 -1
- package/dist/{chunk-Z3IN6GEX.mjs → chunk-2NQ3S2SJ.mjs} +69 -12
- package/dist/chunk-2PJVEL56.cjs +90 -0
- package/dist/{chunk-HDPT6OYE.cjs → chunk-2RSVYJT6.cjs} +28 -4
- package/dist/{chunk-HGB4PM2C.cjs → chunk-2YJ4DHTD.cjs} +104 -32
- package/dist/{chunk-MGZVDX4R.mjs → chunk-3AJQFVWW.mjs} +3 -3
- package/dist/{chunk-E3HDJCWF.mjs → chunk-3GMD2E4Q.mjs} +3 -3
- package/dist/{chunk-JWY66PID.cjs → chunk-42EUEYW6.cjs} +21 -13
- package/dist/{chunk-255J7K4X.mjs → chunk-47R7CX4A.mjs} +6 -6
- package/dist/chunk-4PWGLPL6.mjs +284 -0
- package/dist/{chunk-7S7AAK2D.mjs → chunk-4QBFYEDC.mjs} +2 -1
- package/dist/{chunk-6O6PAZZR.mjs → chunk-4T2RB4JA.mjs} +5 -5
- package/dist/{chunk-XGTFLG73.cjs → chunk-4VLXQ55O.cjs} +37 -25
- package/dist/{chunk-KTDG4THT.cjs → chunk-4ZSZI6XL.cjs} +17 -17
- package/dist/{chunk-XGJVRPYL.cjs → chunk-52LTENRE.cjs} +3 -3
- package/dist/{chunk-QIXEU2WV.cjs → chunk-5AMH6AFA.cjs} +5 -3
- package/dist/{chunk-AYP2YFVN.mjs → chunk-5KAEGBIL.mjs} +75 -42
- package/dist/{chunk-WW3LRNQV.mjs → chunk-5O3SK3ZC.mjs} +5 -5
- package/dist/{chunk-GPO3LJDJ.cjs → chunk-5QZT2EQN.cjs} +2 -2
- package/dist/{chunk-RLFGKJQ6.mjs → chunk-5WFPZG7K.mjs} +20 -8
- package/dist/chunk-5XD2ULJG.mjs +114 -0
- package/dist/{chunk-4HGLJOXZ.cjs → chunk-62DZHPDK.cjs} +16 -11
- package/dist/{chunk-YXIQYWOK.cjs → chunk-63EFR2WF.cjs} +27 -8
- package/dist/{chunk-2RCCFB2Y.cjs → chunk-6B44ZU5P.cjs} +11 -11
- package/dist/{chunk-HFUOLILA.cjs → chunk-6D3CJFNU.cjs} +37 -21
- package/dist/{chunk-JX5VOLAV.cjs → chunk-6DBBMQWT.cjs} +38 -38
- package/dist/{chunk-FRO4BB2T.mjs → chunk-6MATGOEF.mjs} +1 -1
- package/dist/{chunk-CLEWORVY.cjs → chunk-7564NP5Z.cjs} +40 -43
- package/dist/{chunk-7H45IJWO.mjs → chunk-7DBJ2SWK.mjs} +1 -1
- package/dist/chunk-7E4FDO5X.mjs +265 -0
- package/dist/{chunk-FPBOAG6N.cjs → chunk-7EOSFIPN.cjs} +3 -3
- package/dist/{chunk-ICFPTHXM.mjs → chunk-7FQFK3OA.mjs} +7 -3
- package/dist/{chunk-TUOO6IK3.mjs → chunk-7H2TXT2K.mjs} +11 -1
- package/dist/{chunk-A4PWGL46.mjs → chunk-7KDCVSTR.mjs} +4 -4
- package/dist/{chunk-GPICBTDV.cjs → chunk-7Q2YWZF7.cjs} +6 -6
- package/dist/{chunk-CFG4QERR.cjs → chunk-7Q7UB4TL.cjs} +2 -2
- package/dist/{chunk-GJEC5S4V.mjs → chunk-7VCLTNED.mjs} +1 -1
- package/dist/chunk-A3LNXQJJ.cjs +265 -0
- package/dist/{chunk-IBVN7SW5.mjs → chunk-A5F55ZFA.mjs} +472 -143
- package/dist/{chunk-S6O2L47H.mjs → chunk-AG27TI6Q.mjs} +67 -5
- package/dist/{chunk-DC2AXGNZ.mjs → chunk-AM2M56SL.mjs} +1 -1
- package/dist/{chunk-JRHGJVJH.mjs → chunk-B5QRNCIE.mjs} +1 -1
- package/dist/{chunk-OIP62QEL.mjs → chunk-BGUTIQII.mjs} +24 -9
- package/dist/{chunk-DMAP4RND.cjs → chunk-BNCKXPCU.cjs} +98 -16
- package/dist/{chunk-TDCP3Z4T.cjs → chunk-BNTRXJL4.cjs} +3 -3
- package/dist/{chunk-BPAXGCKX.mjs → chunk-BRNPLD22.mjs} +30 -17
- package/dist/{chunk-JZGL2PIH.mjs → chunk-CDT7CGQT.mjs} +2 -2
- package/dist/{chunk-FEFCISOX.cjs → chunk-CEVXKJKF.cjs} +2 -2
- package/dist/{chunk-YZLEOMMA.mjs → chunk-CF74ABRI.mjs} +10 -10
- package/dist/chunk-CIY74JLV.cjs +134 -0
- package/dist/{chunk-FETMUBIA.mjs → chunk-CLM73YYD.mjs} +2 -2
- package/dist/{chunk-ME7RVELR.mjs → chunk-CSAIIMY3.mjs} +21 -2
- package/dist/{chunk-YAEN3L2F.cjs → chunk-CYNQPKA4.cjs} +23 -4
- package/dist/{chunk-M53MIIXY.mjs → chunk-CZOXZ6WQ.mjs} +1 -1
- package/dist/{chunk-Y2LU4LE5.mjs → chunk-DASQJ5UD.mjs} +2 -2
- package/dist/{chunk-WVQNXXNE.cjs → chunk-DD22NQFX.cjs} +2 -2
- package/dist/{chunk-OBYM5S5G.mjs → chunk-DUSTJ6A5.mjs} +20 -17
- package/dist/{chunk-ZFEJ2SF2.cjs → chunk-DZ3AZ7UK.cjs} +52 -52
- package/dist/{chunk-6YFC3ZFX.mjs → chunk-DZXD6CYJ.mjs} +1 -1
- package/dist/{chunk-AZ6IW6SF.mjs → chunk-EMTN5ABC.mjs} +1 -1
- package/dist/{chunk-AQIO3RNL.mjs → chunk-ERT6HQAI.mjs} +8 -3
- package/dist/{chunk-JDO346NV.mjs → chunk-F35C3TJZ.mjs} +1 -1
- package/dist/{chunk-ODBM54RT.cjs → chunk-F4ID7BGO.cjs} +33 -30
- package/dist/{chunk-C7GJDVN4.mjs → chunk-F7MJWW6A.mjs} +1 -1
- package/dist/{chunk-5OFNUETM.mjs → chunk-FCAYYLAE.mjs} +27 -3
- package/dist/{chunk-PWKAX5MS.cjs → chunk-FDZZ6K3N.cjs} +6 -6
- package/dist/{chunk-MHLNWRCJ.cjs → chunk-FE6KYDHC.cjs} +3 -3
- package/dist/{chunk-PTLXHRJZ.mjs → chunk-FLMALEY2.mjs} +37 -4
- package/dist/{chunk-IHTDLCDJ.cjs → chunk-G7B6NU4X.cjs} +23 -10
- package/dist/{chunk-JZQS3ZOI.mjs → chunk-GAAK3HDZ.mjs} +36 -7
- package/dist/{chunk-QMNWKQL4.cjs → chunk-GC5ROI3A.cjs} +4 -4
- package/dist/{chunk-JXIYH2NO.cjs → chunk-GCJ4GNMC.cjs} +4 -4
- package/dist/{chunk-WX63N6C5.mjs → chunk-GFXKO4UW.mjs} +106 -37
- package/dist/{chunk-CYRIIVD4.mjs → chunk-GLF44JKY.mjs} +3 -3
- package/dist/{chunk-GUZC226X.mjs → chunk-GLVDXRG2.mjs} +1 -1
- package/dist/{chunk-GZOKWJIW.mjs → chunk-GNY7BO7R.mjs} +18 -11
- package/dist/{chunk-OWQV6MLM.cjs → chunk-GYJT2U7J.cjs} +2 -1
- package/dist/{chunk-MBCRWU3P.cjs → chunk-H7OFZJCV.cjs} +8 -8
- package/dist/{chunk-JMOCMXTQ.mjs → chunk-H7QY7ZE4.mjs} +1 -1
- package/dist/{chunk-5LOARKDP.cjs → chunk-HFJLMALC.cjs} +42 -30
- package/dist/{chunk-CROAFCMW.mjs → chunk-HONTCUK6.mjs} +1 -1
- package/dist/{chunk-7PJARAQQ.mjs → chunk-HQ2VAJLW.mjs} +1 -1
- package/dist/{chunk-SVQX5HYW.mjs → chunk-HT2SZKXG.mjs} +92 -10
- package/dist/{chunk-7GMBETHM.mjs → chunk-HV2WZFUW.mjs} +1 -1
- package/dist/{chunk-DMXMIE2C.cjs → chunk-HVJ7IACB.cjs} +15 -7
- package/dist/{chunk-S7MWSFFP.cjs → chunk-IBEHVSU4.cjs} +2 -2
- package/dist/{chunk-QGCSUC5O.mjs → chunk-IDOUCM2X.mjs} +521 -296
- package/dist/{chunk-FN5UEC7I.mjs → chunk-IG2JE6WJ.mjs} +1 -1
- package/dist/{chunk-MQ4DYVFS.cjs → chunk-IIHZ2BEE.cjs} +3 -3
- package/dist/{chunk-TAU3OF5B.cjs → chunk-IK33N2AN.cjs} +1373 -694
- package/dist/{chunk-UVQRMUAR.cjs → chunk-IVBDRAOR.cjs} +1 -1
- package/dist/{chunk-2AFW7673.cjs → chunk-IXO6O2EL.cjs} +8 -7
- package/dist/{chunk-U7VH3Q5E.cjs → chunk-IYFBLWXU.cjs} +56 -25
- package/dist/{chunk-NDDRTFN4.mjs → chunk-J7EUGGTY.mjs} +2 -2
- package/dist/{chunk-UVZMSRHF.mjs → chunk-JA6RML7C.mjs} +3 -3
- package/dist/{chunk-CL52PD6D.cjs → chunk-JHZ6HULQ.cjs} +12 -9
- package/dist/{chunk-HTXKSREF.cjs → chunk-JNZDTE75.cjs} +532 -203
- package/dist/{chunk-VT25ERQK.mjs → chunk-JRBWBMP2.mjs} +24 -5
- package/dist/{chunk-4CTCSKAF.mjs → chunk-K6DXKHFE.mjs} +1 -1
- package/dist/{chunk-AXVRUDMB.cjs → chunk-K6PGK7DC.cjs} +2 -2
- package/dist/{chunk-TY5KCYDE.mjs → chunk-KHS3T3E5.mjs} +20 -8
- package/dist/{chunk-ILQ5DKYF.cjs → chunk-KPYQ32BA.cjs} +2 -2
- package/dist/{chunk-CSLHNBPS.cjs → chunk-KQS27YN7.cjs} +6 -6
- package/dist/{chunk-XI3OXOMK.mjs → chunk-KUXEII7V.mjs} +1 -1
- package/dist/{chunk-CA7DNRHO.cjs → chunk-L6E5BSNU.cjs} +3 -3
- package/dist/{chunk-VNBDN5W2.cjs → chunk-L7Y65BQU.cjs} +128 -59
- package/dist/{chunk-73K53YPP.mjs → chunk-LPXJEZJK.mjs} +30 -14
- package/dist/{chunk-B67CW2LM.mjs → chunk-LQBV2Y37.mjs} +34 -37
- package/dist/chunk-LQWIIBI2.cjs +86 -0
- package/dist/chunk-LXTYJ2HW.mjs +139 -0
- package/dist/{chunk-I4KPA2C6.mjs → chunk-MFU7SXAB.mjs} +10 -2
- package/dist/{chunk-YTVSWXEZ.cjs → chunk-ML4TOUZP.cjs} +76 -43
- package/dist/{chunk-E46NXBNJ.mjs → chunk-NLATR3T3.mjs} +12 -7
- package/dist/{chunk-OXNZUCHN.cjs → chunk-NPGXX7HN.cjs} +37 -37
- package/dist/chunk-NRWEY2CM.mjs +25 -0
- package/dist/{chunk-VPETSSWN.cjs → chunk-NSNQLBHR.cjs} +2 -2
- package/dist/chunk-NU5XLYRN.cjs +139 -0
- package/dist/chunk-NUWUEXUD.mjs +55 -0
- package/dist/{chunk-53EHWHT2.cjs → chunk-O4JYMU5N.cjs} +35 -22
- package/dist/{chunk-TNYC3TYP.mjs → chunk-O7JEFGUV.mjs} +2 -2
- package/dist/{chunk-62ZRA7XU.mjs → chunk-OCLCA3X3.mjs} +1 -1
- package/dist/{chunk-MJEKMT6B.mjs → chunk-OFIFRB62.mjs} +917 -238
- package/dist/{chunk-OB45EAQL.mjs → chunk-OVUU2RCQ.mjs} +4 -3
- package/dist/{chunk-YZK64PZT.cjs → chunk-OZARLCYQ.cjs} +1742 -898
- package/dist/{chunk-W44X6IC2.cjs → chunk-PBJ7MEOV.cjs} +13 -9
- package/dist/{chunk-2W4GNXGX.cjs → chunk-PBQGIA27.cjs} +2 -2
- package/dist/{chunk-B6RBJJ5G.mjs → chunk-PDACTAVX.mjs} +16 -3
- package/dist/{chunk-DQ2DI3Y7.mjs → chunk-PE2LEWXA.mjs} +6 -3
- package/dist/{chunk-LGR7565L.cjs → chunk-PG7J7XYT.cjs} +39 -24
- package/dist/{chunk-MMK4MZUN.mjs → chunk-PKXGFQZS.mjs} +1 -1
- package/dist/{chunk-YBY34UHB.mjs → chunk-PL7MCYYD.mjs} +47 -16
- package/dist/chunk-PWHF2C6A.mjs +134 -0
- package/dist/{chunk-DZHTNSQ5.cjs → chunk-Q2EKSSEG.cjs} +21 -21
- package/dist/{chunk-SPP3EZTJ.cjs → chunk-QDHR54S6.cjs} +139 -69
- package/dist/{chunk-REK6HZSU.mjs → chunk-QGYHE6VJ.mjs} +1565 -721
- package/dist/{chunk-ZOYKJBP5.cjs → chunk-QKW6DLDT.cjs} +2 -2
- package/dist/{chunk-Y5LEPEVH.mjs → chunk-QSLGE2ZC.mjs} +1 -1
- package/dist/{chunk-FSODPZRT.cjs → chunk-QUEYL2WM.cjs} +10 -10
- package/dist/{chunk-ZDAEHG2O.cjs → chunk-QYOAGT3E.cjs} +3 -3
- package/dist/{chunk-CPMME66W.mjs → chunk-R5X7FDOG.mjs} +73 -1
- package/dist/{chunk-O47W53D3.cjs → chunk-RDADQG5S.cjs} +7 -77
- package/dist/chunk-RDSHEHBA.mjs +82 -0
- package/dist/{chunk-C6CUUBY5.cjs → chunk-RHI67C2V.cjs} +5 -5
- package/dist/chunk-RK3YYUX6.cjs +114 -0
- package/dist/{chunk-K3RU5MOR.mjs → chunk-RK4MGL6Q.mjs} +1 -1
- package/dist/{chunk-LRB5OVRT.cjs → chunk-RKQOMG2X.cjs} +2 -2
- package/dist/chunk-RQRTH57V.cjs +82 -0
- package/dist/{chunk-HY6IVQ54.mjs → chunk-S7QEQCVV.mjs} +2 -2
- package/dist/{chunk-EGIY4A7V.cjs → chunk-SFSTZ7TB.cjs} +8 -8
- package/dist/{chunk-4Z3YLMSW.cjs → chunk-SX535SU5.cjs} +12 -12
- package/dist/{chunk-NLBK37HI.cjs → chunk-SXXSQVKK.cjs} +4 -4
- package/dist/{chunk-JZBU7V4D.mjs → chunk-SYPEMXW2.mjs} +126 -56
- package/dist/{chunk-5CFHQ7HM.mjs → chunk-TFEODQLG.mjs} +1 -1
- package/dist/{chunk-3GNVIYPO.cjs → chunk-TZ2YPXLB.cjs} +7 -7
- package/dist/{chunk-OEL5EPOJ.mjs → chunk-UD6KTSJS.mjs} +6 -76
- package/dist/{chunk-2EVESLP3.mjs → chunk-UJIBSFUE.mjs} +4 -4
- package/dist/{chunk-QSTRBKHZ.mjs → chunk-UJWRXBVP.mjs} +2 -2
- package/dist/chunk-UNOXV37V.cjs +55 -0
- package/dist/{chunk-TXE4SAMV.mjs → chunk-UOE6ZZZP.mjs} +1 -1
- package/dist/{chunk-OAEDVXVE.mjs → chunk-URQW27KO.mjs} +14 -6
- package/dist/chunk-VDQZV6BX.mjs +17 -0
- package/dist/chunk-VJ6L7TII.cjs +284 -0
- package/dist/{chunk-TPYAYFMF.cjs → chunk-VJI2LWTL.cjs} +2 -2
- package/dist/chunk-VWIW47FW.cjs +25 -0
- package/dist/{chunk-CKQAQFF6.mjs → chunk-WGNGM6MJ.mjs} +2 -2
- package/dist/{chunk-ROCF6UQD.cjs → chunk-WHCNJVYU.cjs} +74 -17
- package/dist/{chunk-4YHGQDTT.cjs → chunk-WJ5CCQBM.cjs} +35 -28
- package/dist/chunk-WKVYF2B5.cjs +17 -0
- package/dist/{chunk-5PDMBWAF.cjs → chunk-WRWJ7IWT.cjs} +7 -7
- package/dist/{chunk-ACGBXN3U.cjs → chunk-WW62HKA2.cjs} +55 -26
- package/dist/{chunk-XVSBALOY.cjs → chunk-X3Y6JWJG.cjs} +3 -3
- package/dist/{chunk-PXAHSCR6.cjs → chunk-XGDI4OUB.cjs} +103 -21
- package/dist/{chunk-4P5634G6.cjs → chunk-XRFGOYXG.cjs} +16 -11
- package/dist/{chunk-42KMUIWZ.cjs → chunk-XX6ZA2IO.cjs} +3 -3
- package/dist/{chunk-6IOZPJ3I.cjs → chunk-Y3DO7BIJ.cjs} +69 -7
- package/dist/{chunk-L5JDKFMQ.cjs → chunk-YBXIVQCE.cjs} +4 -4
- package/dist/{chunk-462MUII7.mjs → chunk-YCNKS6SD.mjs} +12 -12
- package/dist/{chunk-XUSJVHHD.cjs → chunk-YL7BKHYE.cjs} +935 -710
- package/dist/{chunk-7PPLTD3P.cjs → chunk-YN7G22MP.cjs} +6 -6
- package/dist/{chunk-TU6VAH4V.cjs → chunk-YRXPDKMM.cjs} +10 -10
- package/dist/{chunk-IXZSBO76.mjs → chunk-YSTKSZD2.mjs} +1 -1
- package/dist/{chunk-QDWMCFTH.mjs → chunk-YT2ZMLXK.mjs} +1 -1
- package/dist/{chunk-QEJWNXRI.cjs → chunk-YTNE4KGC.cjs} +3 -3
- package/dist/{chunk-E7QOEV5Z.cjs → chunk-YUCU6XB4.cjs} +4 -4
- package/dist/{chunk-NLRAQXAA.mjs → chunk-YVVY276M.mjs} +1 -1
- package/dist/{chunk-SUQACHER.mjs → chunk-Z2FFLTF5.mjs} +3 -3
- package/dist/{chunk-JSDV2NUN.mjs → chunk-Z3QXQN4U.mjs} +1 -1
- package/dist/{chunk-EYPSKXO4.mjs → chunk-Z4IRG4RG.mjs} +96 -9
- package/dist/{chunk-GJ7QVFAG.mjs → chunk-ZEWWZJPZ.mjs} +3 -1
- package/dist/chunk-ZIAWO6BC.mjs +86 -0
- package/dist/{chunk-JWLRBDDC.cjs → chunk-ZIOFRBIU.cjs} +100 -13
- package/dist/{chunk-3OJNNCDL.cjs → chunk-ZNXU4E6A.cjs} +8 -8
- package/dist/{chunk-RLEALQEN.mjs → chunk-ZO6TOLHL.mjs} +87 -5
- package/dist/{chunk-KDOZORJD.cjs → chunk-ZPCZWEU3.cjs} +24 -24
- package/dist/{chunk-QKEZLYON.cjs → chunk-ZV76IQG7.cjs} +2 -2
- package/dist/client/lifecycle.d.mts +1 -1
- package/dist/client/lifecycle.d.ts +1 -1
- package/dist/{client-component.d-C71rMuHF.d.mts → client-component.d-BeqVuqy2.d.mts} +80 -3
- package/dist/{client-component.d-sF-Znk0j.d.ts → client-component.d-CZ1NpHAY.d.ts} +80 -3
- package/dist/{client-plugins.d-B-Gd9mWR.d.mts → client-plugins.d-ChceYO9t.d.mts} +42 -8
- package/dist/{client-plugins.d-MFibjgBg.d.ts → client-plugins.d-D9kWC0QB.d.ts} +42 -8
- package/dist/client-plugins.d.mts +4 -4
- package/dist/client-plugins.d.ts +4 -4
- package/dist/client.cjs +17 -14
- package/dist/client.d.mts +11 -11
- package/dist/client.d.ts +11 -11
- package/dist/client.mjs +16 -13
- package/dist/config.d.mts +4 -4
- package/dist/config.d.ts +4 -4
- package/dist/cron.cjs +8 -4
- package/dist/cron.d.mts +11 -2
- package/dist/cron.d.ts +11 -2
- package/dist/cron.mjs +9 -5
- package/dist/desktop.d.mts +5 -5
- package/dist/desktop.d.ts +5 -5
- package/dist/{devtools-TDIJ6HVC.mjs → devtools-B3W3DLPG.mjs} +20 -19
- package/dist/{devtools-6K4QXFRL.cjs → devtools-T5I2WHRX.cjs} +22 -21
- package/dist/docs.cjs +29 -22
- package/dist/docs.d.mts +20 -6
- package/dist/docs.d.ts +20 -6
- package/dist/docs.mjs +28 -21
- package/dist/{endpoint.d-BkMSCRf6.d.mts → endpoint.d-BXbBpKoh.d.mts} +42 -1
- package/dist/{endpoint.d-BgHn0lhl.d.ts → endpoint.d-Dx_1k6Du.d.ts} +42 -1
- package/dist/environment/vite.cjs +6 -6
- package/dist/environment/vite.mjs +5 -5
- package/dist/headers.cjs +3 -3
- package/dist/{headers.d-uQ6BR59u.d.ts → headers.d-Aux4JVnm.d.ts} +1 -1
- package/dist/{headers.d-BUxGJTsj.d.mts → headers.d-BawakaPv.d.mts} +1 -1
- package/dist/headers.mjs +2 -2
- package/dist/i18n/client.cjs +15 -16
- package/dist/i18n/client.mjs +5 -6
- package/dist/i18n/index.cjs +4 -4
- package/dist/i18n/index.mjs +3 -3
- package/dist/i18n/server.cjs +5 -5
- package/dist/i18n/server.mjs +4 -4
- package/dist/image/server.cjs +5 -4
- package/dist/image/server.d.mts +5 -1
- package/dist/image/server.d.ts +5 -1
- package/dist/image/server.mjs +4 -3
- package/dist/image/sharp.cjs +53 -89
- package/dist/image/sharp.d.mts +2 -1
- package/dist/image/sharp.d.ts +2 -1
- package/dist/image/sharp.mjs +50 -86
- package/dist/index.cjs +113 -96
- package/dist/{index.d-CuWOJ-un.d.mts → index.d-Ccq42CPU.d.mts} +1 -1
- package/dist/{index.d-BCGfxCXY.d.ts → index.d-r1MLpgeE.d.ts} +1 -1
- package/dist/index.d.mts +64 -30
- package/dist/index.d.ts +64 -30
- package/dist/index.mjs +111 -94
- package/dist/integrations/orm.d.mts +4 -4
- package/dist/integrations/orm.d.ts +4 -4
- package/dist/integrations.cjs +9 -9
- package/dist/integrations.d.mts +4 -4
- package/dist/integrations.d.ts +4 -4
- package/dist/integrations.mjs +8 -8
- package/dist/internal/app-markdown-runtime.cjs +10 -6
- package/dist/internal/app-markdown-runtime.d.mts +17 -6
- package/dist/internal/app-markdown-runtime.d.ts +17 -6
- package/dist/internal/app-markdown-runtime.mjs +9 -5
- package/dist/internal/build-runtime.cjs +71 -67
- package/dist/internal/build-runtime.d.mts +6 -6
- package/dist/internal/build-runtime.d.ts +6 -6
- package/dist/internal/build-runtime.mjs +70 -66
- package/dist/internal/cli-runtime.cjs +35 -34
- package/dist/internal/cli-runtime.mjs +34 -33
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +28 -3
- package/dist/internal/client-runtime.d.mts +45 -12
- package/dist/internal/client-runtime.d.ts +45 -12
- package/dist/internal/client-runtime.mjs +28 -3
- package/dist/internal/compression-runtime.d.mts +4 -4
- package/dist/internal/compression-runtime.d.ts +4 -4
- package/dist/internal/config-runtime.cjs +22 -21
- package/dist/internal/config-runtime.d.mts +6 -6
- package/dist/internal/config-runtime.d.ts +6 -6
- package/dist/internal/config-runtime.mjs +21 -20
- package/dist/internal/form-actions.cjs +7 -6
- package/dist/internal/form-actions.d.mts +2 -2
- package/dist/internal/form-actions.d.ts +2 -2
- package/dist/internal/form-actions.mjs +6 -5
- package/dist/internal/infra-analytics-runtime.cjs +15 -15
- package/dist/internal/infra-analytics-runtime.mjs +13 -13
- package/dist/internal/islands-server.cjs +2 -2
- package/dist/internal/islands-server.mjs +1 -1
- package/dist/internal/metadata-image-runtime.cjs +4 -4
- package/dist/internal/metadata-image-runtime.mjs +3 -3
- 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-runtime.cjs +73 -40
- package/dist/internal/production-runtime.d.mts +133 -15
- package/dist/internal/production-runtime.d.ts +133 -15
- package/dist/internal/production-runtime.mjs +76 -43
- package/dist/internal/react-cache.cjs +3 -3
- package/dist/internal/react-cache.mjs +1 -1
- package/dist/internal/start-manifest.cjs +54 -0
- package/dist/internal/start-manifest.d.mts +43 -0
- package/dist/internal/start-manifest.d.ts +43 -0
- package/dist/internal/start-manifest.mjs +54 -0
- package/dist/internal/vercel-edge-middleware.cjs +8 -8
- package/dist/internal/vercel-edge-middleware.mjs +7 -7
- package/dist/{lifecycle.d-keQs5Swc.d.mts → lifecycle.d-OtGWAvJT.d.mts} +4 -0
- package/dist/{lifecycle.d-keQs5Swc.d.ts → lifecycle.d-OtGWAvJT.d.ts} +4 -0
- package/dist/manager-R7FV4A56.cjs +18 -0
- package/dist/{manager-JIA66YJ2.mjs → manager-YO2RHDYU.mjs} +7 -4
- package/dist/markdown.cjs +5 -5
- package/dist/markdown.d.mts +4 -4
- package/dist/markdown.d.ts +4 -4
- package/dist/markdown.mjs +4 -4
- package/dist/middleware.cjs +14 -14
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/middleware.mjs +13 -13
- package/dist/{mount.d-BIYmcGGg.d.mts → mount.d-BomEt2kV.d.mts} +1 -1
- package/dist/{mount.d-q8k0cJV0.d.ts → mount.d-Ca8eb9GB.d.ts} +1 -1
- package/dist/{native-server-fn-handler-QRTXGZA4.cjs → native-server-fn-handler-IWNKQEXK.cjs} +10 -8
- package/dist/{native-server-fn-handler-EP5AFJYE.mjs → native-server-fn-handler-LII4MDRR.mjs} +9 -7
- package/dist/native-tree-D3PW64ZL.cjs +28 -0
- package/dist/{native-tree-OYGKP2NZ.mjs → native-tree-G6ZWS7IR.mjs} +5 -5
- package/dist/{navigation-delegate.d-CYBUupsv.d.mts → navigation-delegate.d-B1ujRkYo.d.mts} +1 -1
- package/dist/{navigation-delegate.d-Btfs6Uoa.d.ts → navigation-delegate.d-DJCC2jXF.d.ts} +1 -1
- package/dist/navigation.cjs +13 -11
- package/dist/navigation.d.mts +7 -7
- package/dist/navigation.d.ts +7 -7
- package/dist/navigation.mjs +12 -10
- package/dist/{nitro-2LMOMIST.cjs → nitro-HKMVYIXY.cjs} +13 -13
- package/dist/{nitro-72TFIGGO.mjs → nitro-RHLKLYXH.mjs} +8 -8
- package/dist/{plugin-5PIQQVRP.cjs → plugin-5BNPYCER.cjs} +2 -2
- package/dist/{plugin-QZT747YW.mjs → plugin-FD4S2QEJ.mjs} +1 -1
- package/dist/plugin.cjs +65 -60
- package/dist/plugin.d.mts +7 -7
- package/dist/plugin.d.ts +7 -7
- package/dist/plugin.mjs +64 -59
- package/dist/query/client.cjs +20 -9
- package/dist/query/client.mjs +16 -5
- package/dist/{render-plan.d-0FHusf1D.d.ts → render-plan.d-BxRbaxYA.d.ts} +1 -1
- package/dist/{render-plan.d-BlyxqKMu.d.mts → render-plan.d-CFod_Zf-.d.mts} +1 -1
- package/dist/renderer/react/server.cjs +9 -1
- package/dist/renderer/react/server.d.mts +9 -1
- package/dist/renderer/react/server.d.ts +9 -1
- package/dist/renderer/react/server.mjs +8 -0
- package/dist/renderer-client.cjs +25 -26
- package/dist/renderer-client.d.mts +7 -7
- package/dist/renderer-client.d.ts +7 -7
- package/dist/renderer-client.mjs +15 -16
- package/dist/request.cjs +2 -2
- package/dist/{request.d-CPdVjssg.d.ts → request.d-DG4TeXMM.d.mts} +14 -2
- package/dist/{request.d-CX-gks1l.d.mts → request.d-DRQgaXGG.d.ts} +14 -2
- package/dist/request.d.mts +5 -5
- package/dist/request.d.ts +5 -5
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering.d-CcvZ_4N2.d.mts → route-rendering.d-BXtZKgqu.d.mts} +1 -1
- package/dist/{route-rendering.d-DcOoSNoG.d.ts → route-rendering.d-Db07UNVG.d.ts} +1 -1
- package/dist/{route.d-DrXkpvcg.d.mts → route.d-Cd4Fi6BA.d.ts} +3 -1
- package/dist/{route.d-hs-_cyHn.d.ts → route.d-ShmtqqVQ.d.mts} +3 -1
- package/dist/router.cjs +4 -4
- package/dist/{router.d-C8RHma4A.d.mts → router.d-B61kXqxJ.d.mts} +1 -1
- package/dist/{router.d-D2QnK8cM.d.ts → router.d-BC3hyjf0.d.ts} +1 -1
- package/dist/router.mjs +3 -3
- package/dist/routes.cjs +7 -5
- package/dist/routes.d.mts +4 -4
- package/dist/routes.d.ts +4 -4
- package/dist/routes.mjs +6 -4
- package/dist/{rsc-pipeline-LC2FBZAR.mjs → rsc-pipeline-LJ7YCGY6.mjs} +24 -23
- package/dist/{rsc-pipeline-NTAM65NT.cjs → rsc-pipeline-VENBFYXW.cjs} +25 -24
- package/dist/{runtime-MWAC7NWR.mjs → runtime-4DWUXZHS.mjs} +29 -29
- package/dist/{runtime-U4PAMTVH.cjs → runtime-UNDTYGQS.cjs} +40 -40
- package/dist/{runtime.d-BQUHHq8M.d.mts → runtime.d-Cl6EBGmC.d.mts} +3 -3
- package/dist/{runtime.d-1l_1bLrL.d.ts → runtime.d-SC95yDzr.d.ts} +3 -3
- package/dist/safe-fetch.cjs +15 -0
- package/dist/safe-fetch.d.mts +61 -0
- package/dist/safe-fetch.d.ts +61 -0
- package/dist/safe-fetch.mjs +15 -0
- package/dist/{schema-dev-notice-C2JINRZI.mjs → schema-dev-notice-CA55V57L.mjs} +2 -2
- package/dist/{schema-dev-notice-X7GG7QVB.cjs → schema-dev-notice-RWA2UTR6.cjs} +3 -3
- package/dist/server-action-security.cjs +7 -5
- package/dist/server-action-security.d.mts +11 -3
- package/dist/server-action-security.d.ts +11 -3
- package/dist/server-action-security.mjs +6 -4
- package/dist/server-fn-client.d.mts +3 -3
- package/dist/server-fn-client.d.ts +3 -3
- package/dist/server-fn.cjs +9 -7
- package/dist/server-fn.d.mts +1 -1
- package/dist/server-fn.d.ts +1 -1
- package/dist/server-fn.mjs +8 -6
- package/dist/server-plugins.cjs +8 -8
- package/dist/server-plugins.d.mts +53 -9
- package/dist/server-plugins.d.ts +53 -9
- package/dist/server-plugins.mjs +7 -7
- package/dist/server-query-client.d.mts +1 -1
- package/dist/server-query-client.d.ts +1 -1
- package/dist/server-query.cjs +10 -8
- package/dist/server-query.d.mts +1 -1
- package/dist/server-query.d.ts +1 -1
- package/dist/server-query.mjs +9 -7
- package/dist/server.cjs +105 -103
- package/dist/server.d.mts +17 -17
- package/dist/server.d.ts +17 -17
- package/dist/server.mjs +78 -76
- package/dist/{spa-router.d-BzPdi48R.d.mts → spa-router.d-DrlXgDqY.d.mts} +13 -6
- package/dist/{spa-router.d-BJtXNeqo.d.ts → spa-router.d-DwM02Mwd.d.ts} +13 -6
- package/dist/testing.cjs +34 -32
- package/dist/testing.d.mts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.mjs +26 -24
- package/dist/theme/server.cjs +3 -3
- package/dist/theme/server.mjs +2 -2
- package/dist/{utils.d-DquC6qxy.d.ts → utils.d-C6KXz3uB.d.ts} +1 -1
- package/dist/{utils.d-B4ZW-6z6.d.mts → utils.d-CHzxAshz.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +65 -60
- package/dist/vite.d.mts +18 -8
- package/dist/vite.d.ts +18 -8
- package/dist/vite.mjs +64 -59
- package/dist/workflows.cjs +7 -7
- package/dist/workflows.mjs +6 -6
- package/package.json +18 -1
- package/dist/analyzer-V5ZMRIIY.cjs +0 -16
- package/dist/chunk-6I4BFRE7.cjs +0 -51
- package/dist/chunk-D4XGKF67.cjs +0 -127
- package/dist/chunk-EIVGPQN5.mjs +0 -51
- package/dist/chunk-MFQGU5CC.mjs +0 -127
- package/dist/chunk-NCIAP562.mjs +0 -27
- package/dist/chunk-QQ44FYRO.cjs +0 -27
- package/dist/chunk-RI3EVPKD.cjs +0 -57
- package/dist/manager-JOHU6BQI.cjs +0 -15
- package/dist/native-tree-R6CQMDTI.cjs +0 -28
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveFarmAppClientEntry,
|
|
3
3
|
resolveFarmClientPlugins
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MFU7SXAB.mjs";
|
|
5
5
|
import {
|
|
6
6
|
resolveFarmPlatform
|
|
7
7
|
} from "./chunk-SMUW7UST.mjs";
|
|
@@ -9,15 +9,13 @@ import {
|
|
|
9
9
|
collectSSGPages,
|
|
10
10
|
matchSSGPage,
|
|
11
11
|
resolveRouteRenderingConfigFromFile
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
createFarmMetadataImageResponse
|
|
15
|
-
} from "./chunk-CROAFCMW.mjs";
|
|
12
|
+
} from "./chunk-LQBV2Y37.mjs";
|
|
16
13
|
import {
|
|
17
14
|
appendFarmHead,
|
|
18
15
|
classifyFarmDocumentPrefix,
|
|
19
16
|
composeFarmFullDocument,
|
|
20
17
|
createDefaultErrorMarkup,
|
|
18
|
+
createFarmDocsLayoutTree,
|
|
21
19
|
createFarmMetadataRouteResponse,
|
|
22
20
|
createFarmRouteRenderPlan,
|
|
23
21
|
createFarmStreamedDocumentTransform,
|
|
@@ -26,6 +24,7 @@ import {
|
|
|
26
24
|
createLateRedirectRecovery,
|
|
27
25
|
createRouteDirectoryPattern,
|
|
28
26
|
extractFarmFullDocument,
|
|
27
|
+
farmDocsLayoutsWrapPage,
|
|
29
28
|
farmPathGuardCoversPage,
|
|
30
29
|
formatRouteSegment,
|
|
31
30
|
getDefaultErrorStatusText,
|
|
@@ -34,18 +33,21 @@ import {
|
|
|
34
33
|
getRouteGroupScope,
|
|
35
34
|
getSharedLayoutPrefixLength,
|
|
36
35
|
isInRouteGroupScope,
|
|
36
|
+
markFarmDocumentLayouts,
|
|
37
37
|
openFarmStreamedDocument,
|
|
38
38
|
parseFarmLayoutChainHeader,
|
|
39
|
+
placeFarmDocsLayoutRoot,
|
|
39
40
|
removeFarmDocumentTitles,
|
|
40
41
|
renderFarmLocaleAlternateLinks,
|
|
41
42
|
resolveDefaultErrorStatus,
|
|
43
|
+
resolveFarmDocsLayoutIslandStrategy,
|
|
42
44
|
routeBoundaryCoversDirectory,
|
|
43
45
|
stripRouteGroups,
|
|
44
46
|
takeFarmHoistedHead
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-HT2SZKXG.mjs";
|
|
46
48
|
import {
|
|
47
49
|
listFarmMCPLlmsTxtLinks
|
|
48
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-GNY7BO7R.mjs";
|
|
49
51
|
import {
|
|
50
52
|
FARM_DEFAULT_MCP_PATH,
|
|
51
53
|
collectFarmDefaultMCPPages,
|
|
@@ -53,16 +55,19 @@ import {
|
|
|
53
55
|
farmConfigMountsMCP,
|
|
54
56
|
isFarmDefaultMCPPathname,
|
|
55
57
|
resolveFarmDefaultMCPServer
|
|
56
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-JA6RML7C.mjs";
|
|
59
|
+
import {
|
|
60
|
+
createFarmMetadataImageResponse
|
|
61
|
+
} from "./chunk-HONTCUK6.mjs";
|
|
57
62
|
import {
|
|
58
63
|
getFarmFormState,
|
|
59
64
|
handleFarmFormActionRequest,
|
|
60
65
|
renderFarmFormStateScript
|
|
61
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-7FQFK3OA.mjs";
|
|
62
67
|
import {
|
|
63
68
|
installFarmIslandValues,
|
|
64
69
|
uninstallFarmIslandValues
|
|
65
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-7KDCVSTR.mjs";
|
|
66
71
|
import {
|
|
67
72
|
FarmSourceSnapshotStore,
|
|
68
73
|
collectFarmRenderedClientModules,
|
|
@@ -71,27 +76,32 @@ import {
|
|
|
71
76
|
describeSuppressedAsyncHydration,
|
|
72
77
|
enforceFarmIsolatedHydrationRouteBudget,
|
|
73
78
|
getClientModuleHydrationPlan,
|
|
79
|
+
getClientModuleHydrationPlanKey,
|
|
74
80
|
getClientModuleMetadata,
|
|
75
81
|
getFarmClientHydrationPlanOptions,
|
|
82
|
+
getFarmSourceStamp,
|
|
76
83
|
getIslandStrategyExport,
|
|
77
84
|
isFarmClientModulePlanUnchanged,
|
|
85
|
+
memoizeInFarmSourceSnapshot,
|
|
78
86
|
mergeProgrammaticClientRoutes,
|
|
87
|
+
noteFarmSourceRead,
|
|
79
88
|
resolveFarmIsolatedClientHydrationMode,
|
|
80
89
|
resolveImportedModule,
|
|
90
|
+
resolveModuleSourcePath,
|
|
81
91
|
resolveProgrammaticClientRoutes,
|
|
82
92
|
runWithLatestPackageClientBoundaryCache,
|
|
83
93
|
runWithPackageClientBoundaryCacheFile,
|
|
84
94
|
traceFarmSourceReads,
|
|
85
95
|
usesFarmServerTree,
|
|
86
96
|
withFarmSourceSnapshot
|
|
87
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-A5F55ZFA.mjs";
|
|
88
98
|
import {
|
|
89
99
|
FARM_ISLAND_REPLAYABLE_SELECTOR
|
|
90
100
|
} from "./chunk-S32PDOLO.mjs";
|
|
91
101
|
import {
|
|
92
102
|
_setDefaultFarmThemeConfig,
|
|
93
103
|
getTheme
|
|
94
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-ZEWWZJPZ.mjs";
|
|
95
105
|
import {
|
|
96
106
|
isSecretDocsConfigKey
|
|
97
107
|
} from "./chunk-EJCVG25Z.mjs";
|
|
@@ -101,7 +111,7 @@ import {
|
|
|
101
111
|
} from "./chunk-TPA2PV5J.mjs";
|
|
102
112
|
import {
|
|
103
113
|
normalizeRouteRules
|
|
104
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-YVVY276M.mjs";
|
|
105
115
|
import {
|
|
106
116
|
resolveFarmDevtoolsConfig
|
|
107
117
|
} from "./chunk-CU5SYTJG.mjs";
|
|
@@ -111,7 +121,7 @@ import {
|
|
|
111
121
|
resolveFarmAgentCrawlers,
|
|
112
122
|
resolveFarmAgentSitemap,
|
|
113
123
|
resolveFarmPerformanceConfig
|
|
114
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-DUSTJ6A5.mjs";
|
|
115
125
|
import {
|
|
116
126
|
collectFarmLlmsTxtPages,
|
|
117
127
|
createFarmDefaultLlmsTxt,
|
|
@@ -121,7 +131,7 @@ import {
|
|
|
121
131
|
renderFarmLlmsFullTxt,
|
|
122
132
|
resolveFarmAgentOrigin,
|
|
123
133
|
resolveFarmLlmsTxtConfig
|
|
124
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-S7QEQCVV.mjs";
|
|
125
135
|
import {
|
|
126
136
|
createFarmCspNonce,
|
|
127
137
|
createFarmCspNonceRewriter,
|
|
@@ -155,17 +165,17 @@ import {
|
|
|
155
165
|
} from "./chunk-AOIUYHPH.mjs";
|
|
156
166
|
import {
|
|
157
167
|
resolveCronConfig
|
|
158
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-CSAIIMY3.mjs";
|
|
159
169
|
import {
|
|
160
170
|
resolveServerActionsConfig
|
|
161
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-NLATR3T3.mjs";
|
|
162
172
|
import {
|
|
163
173
|
createFarmMarkdownRouteModuleFromFile,
|
|
164
174
|
loadFarmMdxComponents
|
|
165
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-KUXEII7V.mjs";
|
|
166
176
|
import {
|
|
167
177
|
isFarmMarkdownPageFile
|
|
168
|
-
} from "./chunk-
|
|
178
|
+
} from "./chunk-BGUTIQII.mjs";
|
|
169
179
|
import {
|
|
170
180
|
resolveFarmMdxComponentsModulePath,
|
|
171
181
|
resolveMdxConfig
|
|
@@ -178,10 +188,10 @@ import {
|
|
|
178
188
|
farmRequestWantsMarkdown,
|
|
179
189
|
getFarmMarkdownAlternatePath,
|
|
180
190
|
resolveMarkdownConfig
|
|
181
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-R5X7FDOG.mjs";
|
|
182
192
|
import {
|
|
183
193
|
resolveWorkflowsConfig
|
|
184
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-3AJQFVWW.mjs";
|
|
185
195
|
import {
|
|
186
196
|
resolveFarmThemeConfig
|
|
187
197
|
} from "./chunk-YWPNIYUP.mjs";
|
|
@@ -189,7 +199,7 @@ import {
|
|
|
189
199
|
getIntegrationProviders,
|
|
190
200
|
getRegisteredIntegrationAPIManifest,
|
|
191
201
|
isFarmIntegrationProviderComponentReference
|
|
192
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-5O3SK3ZC.mjs";
|
|
193
203
|
import {
|
|
194
204
|
initStorage
|
|
195
205
|
} from "./chunk-TJVUTGED.mjs";
|
|
@@ -200,7 +210,7 @@ import {
|
|
|
200
210
|
import {
|
|
201
211
|
createRouteSlotContainerId,
|
|
202
212
|
parseRouteSlotFile
|
|
203
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-RK4MGL6Q.mjs";
|
|
204
214
|
import {
|
|
205
215
|
_clearCurrentMiddlewareContext,
|
|
206
216
|
_clearCurrentMiddlewareData,
|
|
@@ -210,13 +220,13 @@ import {
|
|
|
210
220
|
import {
|
|
211
221
|
findProgrammaticRouteFiles,
|
|
212
222
|
loadProgrammaticRouteManifests
|
|
213
|
-
} from "./chunk-
|
|
223
|
+
} from "./chunk-UOE6ZZZP.mjs";
|
|
214
224
|
import {
|
|
215
225
|
_runWithFarmI18nRequest,
|
|
216
226
|
_setDefaultFarmI18nRuntime,
|
|
217
227
|
createFarmI18nRuntime,
|
|
218
228
|
getFarmI18nClientSnapshot
|
|
219
|
-
} from "./chunk-
|
|
229
|
+
} from "./chunk-O7JEFGUV.mjs";
|
|
220
230
|
import {
|
|
221
231
|
formatOptionalPeerInstallHint,
|
|
222
232
|
isOptionalPeerInstalled
|
|
@@ -227,7 +237,7 @@ import {
|
|
|
227
237
|
normalizeProgrammaticRoutePath,
|
|
228
238
|
parseProgrammaticRoutePath,
|
|
229
239
|
trackProgrammaticRouteSources
|
|
230
|
-
} from "./chunk-
|
|
240
|
+
} from "./chunk-DZXD6CYJ.mjs";
|
|
231
241
|
import {
|
|
232
242
|
getFarmRouteRuntimeConfig,
|
|
233
243
|
mergeFarmRouteRuntimeConfigs,
|
|
@@ -239,7 +249,7 @@ import {
|
|
|
239
249
|
configureFarmCache,
|
|
240
250
|
getFarmDataCache,
|
|
241
251
|
normalizeRevalidatePath
|
|
242
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-ZO6TOLHL.mjs";
|
|
243
253
|
import {
|
|
244
254
|
sendWebResponse
|
|
245
255
|
} from "./chunk-O5QUJEWT.mjs";
|
|
@@ -248,7 +258,7 @@ import {
|
|
|
248
258
|
} from "./chunk-VHIXGZYH.mjs";
|
|
249
259
|
import {
|
|
250
260
|
loadFarmDevModule
|
|
251
|
-
} from "./chunk-
|
|
261
|
+
} from "./chunk-7H2TXT2K.mjs";
|
|
252
262
|
import {
|
|
253
263
|
resolveFarmI18nConfig
|
|
254
264
|
} from "./chunk-VJSXPN3W.mjs";
|
|
@@ -265,14 +275,15 @@ import {
|
|
|
265
275
|
splitRoutePath,
|
|
266
276
|
toRootRelativeUrlPath,
|
|
267
277
|
toViteModuleId
|
|
268
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-Z3QXQN4U.mjs";
|
|
269
279
|
import {
|
|
270
280
|
resolveFarmAPIServerBasePath
|
|
271
281
|
} from "./chunk-2I6PUKWJ.mjs";
|
|
272
282
|
import {
|
|
283
|
+
createFarmNodeRequestAbortSignal,
|
|
273
284
|
matchesFarmIfNoneMatch,
|
|
274
285
|
resolveFarmServerConfig
|
|
275
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-YT2ZMLXK.mjs";
|
|
276
287
|
import {
|
|
277
288
|
getRequestContextSnapshot
|
|
278
289
|
} from "./chunk-D2LCAV6L.mjs";
|
|
@@ -286,14 +297,13 @@ import {
|
|
|
286
297
|
} from "./chunk-2DA7CLY7.mjs";
|
|
287
298
|
import {
|
|
288
299
|
FARM_VERSION
|
|
289
|
-
} from "./chunk-
|
|
300
|
+
} from "./chunk-H7QY7ZE4.mjs";
|
|
301
|
+
import {
|
|
302
|
+
_setFarmSearchPreserveRoutes
|
|
303
|
+
} from "./chunk-VDQZV6BX.mjs";
|
|
290
304
|
import {
|
|
291
305
|
normalizeFarmAPIConfig
|
|
292
306
|
} from "./chunk-W6QLRQ3V.mjs";
|
|
293
|
-
import {
|
|
294
|
-
createFarmLocaleCookie,
|
|
295
|
-
getFarmLocaleVaryHeaders
|
|
296
|
-
} from "./chunk-2EVESLP3.mjs";
|
|
297
307
|
import {
|
|
298
308
|
getFarmPageDataRedirect
|
|
299
309
|
} from "./chunk-SD6JGJOM.mjs";
|
|
@@ -305,7 +315,7 @@ import {
|
|
|
305
315
|
renderMetadataHead,
|
|
306
316
|
renderViewportHead,
|
|
307
317
|
resolveFarmNotFoundMetadata
|
|
308
|
-
} from "./chunk-
|
|
318
|
+
} from "./chunk-AG27TI6Q.mjs";
|
|
309
319
|
import {
|
|
310
320
|
prepareDeferredData,
|
|
311
321
|
snapshotDeferredData
|
|
@@ -317,6 +327,10 @@ import {
|
|
|
317
327
|
getFarmDeploymentMismatch,
|
|
318
328
|
withoutFarmDeploymentCookie
|
|
319
329
|
} from "./chunk-IWJONXPF.mjs";
|
|
330
|
+
import {
|
|
331
|
+
createFarmLocaleCookie,
|
|
332
|
+
getFarmLocaleVaryHeaders
|
|
333
|
+
} from "./chunk-UJIBSFUE.mjs";
|
|
320
334
|
import {
|
|
321
335
|
resolveFarmTrailingSlashRedirect,
|
|
322
336
|
setFarmTrailingSlashPreference
|
|
@@ -329,15 +343,16 @@ import {
|
|
|
329
343
|
} from "./chunk-XQ4DPO4G.mjs";
|
|
330
344
|
import {
|
|
331
345
|
encodeConfigRouteSegment
|
|
332
|
-
} from "./chunk-
|
|
346
|
+
} from "./chunk-CDT7CGQT.mjs";
|
|
333
347
|
import {
|
|
348
|
+
_getRequestCookieReadCount,
|
|
334
349
|
_getRequestReadCount,
|
|
335
350
|
_runWithCurrentRequest,
|
|
336
351
|
_runWithFarmCspNonce,
|
|
337
352
|
createWebRequestFromFarmRequest,
|
|
338
353
|
getCurrentRequestOrNull,
|
|
339
354
|
resolveFarmRequestURL
|
|
340
|
-
} from "./chunk-
|
|
355
|
+
} from "./chunk-FCAYYLAE.mjs";
|
|
341
356
|
import {
|
|
342
357
|
_peekCurrentRequest,
|
|
343
358
|
_resolveCurrentCspNonce
|
|
@@ -352,7 +367,7 @@ import {
|
|
|
352
367
|
localizeFarmPathname,
|
|
353
368
|
resolveFarmLocalePath,
|
|
354
369
|
stripFarmLocaleFromPathname
|
|
355
|
-
} from "./chunk-
|
|
370
|
+
} from "./chunk-4QBFYEDC.mjs";
|
|
356
371
|
import {
|
|
357
372
|
applyFarmBasePath,
|
|
358
373
|
normalizeFarmConfigBasePath,
|
|
@@ -364,7 +379,7 @@ import {
|
|
|
364
379
|
assertUniqueRouteParameters,
|
|
365
380
|
compareRouteSpecificity,
|
|
366
381
|
getRoutePatternShape
|
|
367
|
-
} from "./chunk-
|
|
382
|
+
} from "./chunk-5KAEGBIL.mjs";
|
|
368
383
|
|
|
369
384
|
// src/static-metadata-image.ts
|
|
370
385
|
import { createHash } from "crypto";
|
|
@@ -432,7 +447,7 @@ async function readAltText(filePath) {
|
|
|
432
447
|
}
|
|
433
448
|
|
|
434
449
|
// src/routing/route-manager.ts
|
|
435
|
-
import
|
|
450
|
+
import fs from "fs";
|
|
436
451
|
import path2 from "path";
|
|
437
452
|
function getRouteEntryDirectory(entry) {
|
|
438
453
|
return entry.directory ?? entry.pattern;
|
|
@@ -452,6 +467,19 @@ function compareRouteEntries(left, right) {
|
|
|
452
467
|
}
|
|
453
468
|
var PLAN_SOURCE = /\.(?:[cm]?[jt]sx?|vue|svelte)$/;
|
|
454
469
|
var NODE_MODULES_SEGMENT = `${path2.sep}node_modules${path2.sep}`;
|
|
470
|
+
function getInstalledPackageDirectory(file, start) {
|
|
471
|
+
let end = file.indexOf(path2.sep, start);
|
|
472
|
+
if (end !== -1 && file[start] === "@") end = file.indexOf(path2.sep, end + 1);
|
|
473
|
+
return end === -1 ? file : file.slice(0, end);
|
|
474
|
+
}
|
|
475
|
+
function realPathOutsideNodeModules(target) {
|
|
476
|
+
try {
|
|
477
|
+
const real = fs.realpathSync(target);
|
|
478
|
+
return real.includes(NODE_MODULES_SEGMENT) ? null : real;
|
|
479
|
+
} catch {
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
455
483
|
var RouteManager = class _RouteManager {
|
|
456
484
|
constructor(config, viteServer) {
|
|
457
485
|
this.routes = /* @__PURE__ */ new Map();
|
|
@@ -474,8 +502,13 @@ var RouteManager = class _RouteManager {
|
|
|
474
502
|
// replan recomputes only the modules that read an edited file. Every replan used to read and
|
|
475
503
|
// walk every route's import graph again, seconds on a large app, before an edit could update.
|
|
476
504
|
this.ownerPlans = /* @__PURE__ */ new Map();
|
|
505
|
+
// Outside the dev server: the size and mtime each source file the last plan read had when it was
|
|
506
|
+
// read, so a production build can tell whether a route module's plan still holds.
|
|
507
|
+
this.planStamps = /* @__PURE__ */ new Map();
|
|
477
508
|
this.sourceChangeTracking = false;
|
|
478
509
|
this.linkedSources = /* @__PURE__ */ new Map();
|
|
510
|
+
// Whether each package directory under `node_modules` a plan read from links to a workspace.
|
|
511
|
+
this.linkedPackages = /* @__PURE__ */ new Map();
|
|
479
512
|
// Source files edited since the last plan; null when the next plan must recompute every module.
|
|
480
513
|
this.editedSources = null;
|
|
481
514
|
this.config = config;
|
|
@@ -599,6 +632,30 @@ var RouteManager = class _RouteManager {
|
|
|
599
632
|
getRoutes() {
|
|
600
633
|
return new Map(this.routes);
|
|
601
634
|
}
|
|
635
|
+
/**
|
|
636
|
+
* The pages whose programmatic definition declares `search.preserve`, for Farm links to carry
|
|
637
|
+
* those params from the current URL. Read from the evaluated routes files, without planning.
|
|
638
|
+
*/
|
|
639
|
+
getSearchPreserveRoutes() {
|
|
640
|
+
const routes = [];
|
|
641
|
+
for (const entry of this.routes.values()) {
|
|
642
|
+
const preserve = getProgrammaticRouteSearchClientOptions(
|
|
643
|
+
this.programmaticPages.get(entry.modulePath)?.search
|
|
644
|
+
)?.preserve;
|
|
645
|
+
if (!preserve?.length) continue;
|
|
646
|
+
routes.push({
|
|
647
|
+
pattern: entry.pattern,
|
|
648
|
+
segments: entry.route.segments.map((seg) => ({
|
|
649
|
+
segment: seg.segment,
|
|
650
|
+
isDynamic: seg.isDynamic,
|
|
651
|
+
isCatchAll: seg.isCatchAll,
|
|
652
|
+
isOptional: seg.isOptional
|
|
653
|
+
})),
|
|
654
|
+
search: { preserve: [...preserve] }
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
return routes;
|
|
658
|
+
}
|
|
602
659
|
/**
|
|
603
660
|
* Get all registered layouts
|
|
604
661
|
*/
|
|
@@ -808,6 +865,25 @@ var RouteManager = class _RouteManager {
|
|
|
808
865
|
this.sourceChangeTracking = true;
|
|
809
866
|
this.sourceSnapshot ?? (this.sourceSnapshot = new FarmSourceSnapshotStore());
|
|
810
867
|
}
|
|
868
|
+
/**
|
|
869
|
+
* @internal A production build edits no source while it runs, so what the plan reads, parses and
|
|
870
|
+
* resolves as the app initializes stays valid for the build's later analyses of the same modules:
|
|
871
|
+
* the route tables' plans and the bundles' package import rewrites (takeBuildSourceSnapshot).
|
|
872
|
+
*/
|
|
873
|
+
keepBuildSourceSnapshot() {
|
|
874
|
+
if (this.sourceChangeTracking) return;
|
|
875
|
+
this.sourceSnapshot ?? (this.sourceSnapshot = new FarmSourceSnapshotStore(false));
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* @internal Hands the snapshot keepBuildSourceSnapshot kept to the build, which clears it once
|
|
879
|
+
* its bundles are written; later plans start without one. Undefined on the dev server.
|
|
880
|
+
*/
|
|
881
|
+
takeBuildSourceSnapshot() {
|
|
882
|
+
if (this.sourceChangeTracking) return void 0;
|
|
883
|
+
const store = this.sourceSnapshot;
|
|
884
|
+
this.sourceSnapshot = void 0;
|
|
885
|
+
return store;
|
|
886
|
+
}
|
|
811
887
|
/**
|
|
812
888
|
* @internal A watched file changed. An edit to a script narrows the next replan to the route
|
|
813
889
|
* modules that read it; a script added or removed (where an import may now resolve), or a
|
|
@@ -827,6 +903,7 @@ var RouteManager = class _RouteManager {
|
|
|
827
903
|
this.editedSources = null;
|
|
828
904
|
this.sourceSnapshot?.clear();
|
|
829
905
|
this.linkedSources.clear();
|
|
906
|
+
this.linkedPackages.clear();
|
|
830
907
|
}
|
|
831
908
|
/**
|
|
832
909
|
* @internal Whether an edit to `file` leaves the current plan as it is: a client module the
|
|
@@ -844,7 +921,7 @@ var RouteManager = class _RouteManager {
|
|
|
844
921
|
* A route module's plan: the last one when it read none of `edited`, recomputed otherwise.
|
|
845
922
|
* Callers get a copy, since the route budget rewrites a plan's fields in place.
|
|
846
923
|
*/
|
|
847
|
-
planRouteModule(key, edited, compute) {
|
|
924
|
+
planRouteModule(key, edited, compute, planKey) {
|
|
848
925
|
const previous = this.ownerPlans.get(key);
|
|
849
926
|
if (previous && edited && ![...edited].some((file) => previous.files.has(file))) {
|
|
850
927
|
return { ...previous.plan };
|
|
@@ -855,23 +932,57 @@ var RouteManager = class _RouteManager {
|
|
|
855
932
|
const source = this.planSourcePath(file);
|
|
856
933
|
if (source) sources.add(source);
|
|
857
934
|
}
|
|
858
|
-
this.
|
|
935
|
+
if (!this.sourceChangeTracking) {
|
|
936
|
+
for (const source of sources) {
|
|
937
|
+
if (!this.planStamps.has(source)) this.planStamps.set(source, getFarmSourceStamp(source));
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
this.ownerPlans.set(key, { plan: result, files: sources, planKey });
|
|
859
941
|
return { ...result };
|
|
860
942
|
}
|
|
943
|
+
/**
|
|
944
|
+
* @internal The plans of the pages and layouts the last client manifest planned, by
|
|
945
|
+
* getClientModuleHydrationPlanKey, so a production build plans each route module once. A plan
|
|
946
|
+
* that read a source file changed since then is left out, as is every plan of the dev server,
|
|
947
|
+
* which replans after edits. Installed packages are not compared: they do not change during a
|
|
948
|
+
* build.
|
|
949
|
+
*/
|
|
950
|
+
getRouteModuleHydrationPlans() {
|
|
951
|
+
const plans = /* @__PURE__ */ new Map();
|
|
952
|
+
if (this.sourceChangeTracking || !this.clientManifestCache) return plans;
|
|
953
|
+
const unchanged = /* @__PURE__ */ new Map();
|
|
954
|
+
const isUnchanged = (file) => {
|
|
955
|
+
let result = unchanged.get(file);
|
|
956
|
+
if (result === void 0) {
|
|
957
|
+
result = this.planStamps.get(file) === getFarmSourceStamp(file);
|
|
958
|
+
unchanged.set(file, result);
|
|
959
|
+
}
|
|
960
|
+
return result;
|
|
961
|
+
};
|
|
962
|
+
for (const { plan, files, planKey } of this.ownerPlans.values()) {
|
|
963
|
+
if (planKey && [...files].every(isUnchanged)) plans.set(planKey, plan);
|
|
964
|
+
}
|
|
965
|
+
return plans;
|
|
966
|
+
}
|
|
861
967
|
/**
|
|
862
968
|
* The path the watcher reports for a file a plan read: itself, or the real path of a workspace
|
|
863
969
|
* package's source read through its `node_modules` link. Null for an installed package's file.
|
|
970
|
+
* Package managers link whole package directories, so one realpath of the directory rules out an
|
|
971
|
+
* installed package; a plan reads thousands of files of an icon package.
|
|
864
972
|
*/
|
|
865
973
|
planSourcePath(file) {
|
|
866
|
-
|
|
974
|
+
const index = file.lastIndexOf(NODE_MODULES_SEGMENT);
|
|
975
|
+
if (index === -1) return file;
|
|
976
|
+
const directory = getInstalledPackageDirectory(file, index + NODE_MODULES_SEGMENT.length);
|
|
977
|
+
let linked = this.linkedPackages.get(directory);
|
|
978
|
+
if (linked === void 0) {
|
|
979
|
+
linked = realPathOutsideNodeModules(directory) !== null;
|
|
980
|
+
this.linkedPackages.set(directory, linked);
|
|
981
|
+
}
|
|
982
|
+
if (!linked) return null;
|
|
867
983
|
let source = this.linkedSources.get(file);
|
|
868
984
|
if (source === void 0) {
|
|
869
|
-
|
|
870
|
-
const real = realpathSync(file);
|
|
871
|
-
source = real.includes(NODE_MODULES_SEGMENT) ? null : real;
|
|
872
|
-
} catch {
|
|
873
|
-
source = null;
|
|
874
|
-
}
|
|
985
|
+
source = realPathOutsideNodeModules(file);
|
|
875
986
|
this.linkedSources.set(file, source);
|
|
876
987
|
}
|
|
877
988
|
return source;
|
|
@@ -935,7 +1046,11 @@ var RouteManager = class _RouteManager {
|
|
|
935
1046
|
if (source) edited.add(source);
|
|
936
1047
|
}
|
|
937
1048
|
}
|
|
938
|
-
if (!edited)
|
|
1049
|
+
if (!edited) {
|
|
1050
|
+
this.ownerPlans.clear();
|
|
1051
|
+
this.planStamps.clear();
|
|
1052
|
+
}
|
|
1053
|
+
const layoutPlanOptions = islandsMode ? { ...planOptions, serverTreeLayouts: true } : planOptions;
|
|
939
1054
|
const layoutEntries = Array.from(this.layouts.values()).map((entry) => ({
|
|
940
1055
|
entry,
|
|
941
1056
|
metadata: this.planRouteModule(
|
|
@@ -945,7 +1060,13 @@ var RouteManager = class _RouteManager {
|
|
|
945
1060
|
entry.modulePath,
|
|
946
1061
|
normalizedProjectRoot,
|
|
947
1062
|
isolatedMode,
|
|
948
|
-
|
|
1063
|
+
layoutPlanOptions
|
|
1064
|
+
),
|
|
1065
|
+
getClientModuleHydrationPlanKey(
|
|
1066
|
+
entry.modulePath,
|
|
1067
|
+
normalizedProjectRoot,
|
|
1068
|
+
isolatedMode,
|
|
1069
|
+
layoutPlanOptions
|
|
949
1070
|
)
|
|
950
1071
|
)
|
|
951
1072
|
}));
|
|
@@ -959,15 +1080,24 @@ var RouteManager = class _RouteManager {
|
|
|
959
1080
|
const markdownPagePlan = () => ({
|
|
960
1081
|
...markdownPlan ?? (markdownPlan = this.planRouteModule("markdown", edited, markdownComponentsPlan))
|
|
961
1082
|
});
|
|
1083
|
+
const pagePlanOptions = { ...planOptions, serverOwners: islandsMode };
|
|
962
1084
|
const routeEntries = Array.from(this.routes.values()).map((entry) => ({
|
|
963
1085
|
entry,
|
|
964
1086
|
metadata: isFarmMarkdownPageFile(entry.modulePath) ? markdownPagePlan() : this.planRouteModule(
|
|
965
1087
|
`page:${entry.modulePath}`,
|
|
966
1088
|
edited,
|
|
967
|
-
() => getClientModuleHydrationPlan(
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1089
|
+
() => getClientModuleHydrationPlan(
|
|
1090
|
+
entry.modulePath,
|
|
1091
|
+
normalizedProjectRoot,
|
|
1092
|
+
isolatedMode,
|
|
1093
|
+
pagePlanOptions
|
|
1094
|
+
),
|
|
1095
|
+
getClientModuleHydrationPlanKey(
|
|
1096
|
+
entry.modulePath,
|
|
1097
|
+
normalizedProjectRoot,
|
|
1098
|
+
isolatedMode,
|
|
1099
|
+
pagePlanOptions
|
|
1100
|
+
)
|
|
971
1101
|
)
|
|
972
1102
|
}));
|
|
973
1103
|
const markdownFallback = routeEntries.find(
|
|
@@ -1829,7 +1959,7 @@ async function safeGlobFiles(pattern, cwd) {
|
|
|
1829
1959
|
}
|
|
1830
1960
|
function toRealPath(filePath) {
|
|
1831
1961
|
try {
|
|
1832
|
-
return realpathSync(filePath);
|
|
1962
|
+
return fs.realpathSync(filePath);
|
|
1833
1963
|
} catch {
|
|
1834
1964
|
return filePath;
|
|
1835
1965
|
}
|
|
@@ -1887,40 +2017,15 @@ function createFarmDevClientManifest(manifest, options) {
|
|
|
1887
2017
|
return clientManifest;
|
|
1888
2018
|
}
|
|
1889
2019
|
|
|
1890
|
-
// src/server/dev-styles.ts
|
|
1891
|
-
import * as fs from "fs";
|
|
1892
|
-
import * as path3 from "path";
|
|
1893
|
-
function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
|
|
1894
|
-
const file = path3.join(root, srcDir, "app", "globals.css");
|
|
1895
|
-
if (!fs.existsSync(file)) return void 0;
|
|
1896
|
-
return `/${path3.relative(root, file).split(path3.sep).join("/")}`;
|
|
1897
|
-
}
|
|
1898
|
-
var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
|
|
1899
|
-
var ALREADY_LINKED = "/src/app/globals.css";
|
|
1900
|
-
function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, options = {}) {
|
|
1901
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1902
|
-
for (const mod of modules) {
|
|
1903
|
-
const id = mod.id ?? mod.file ?? "";
|
|
1904
|
-
if (!STYLE_EXTENSIONS.test(id)) continue;
|
|
1905
|
-
const cssModule = id.includes(".module.");
|
|
1906
|
-
if (cssModule && !options.cssModules) continue;
|
|
1907
|
-
const url = mod.url;
|
|
1908
|
-
if (!url || !url.startsWith("/")) continue;
|
|
1909
|
-
const bare = url.split("?")[0];
|
|
1910
|
-
if (bare === alreadyLinked) continue;
|
|
1911
|
-
seen.add(cssModule ? `${bare}?direct` : bare);
|
|
1912
|
-
}
|
|
1913
|
-
return [...seen].sort();
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
2020
|
// src/font-vite.ts
|
|
1917
2021
|
import { createHash as createHash2, timingSafeEqual } from "crypto";
|
|
1918
|
-
import { existsSync
|
|
2022
|
+
import { existsSync } from "fs";
|
|
1919
2023
|
import { readFile as readFile2 } from "fs/promises";
|
|
1920
|
-
import
|
|
2024
|
+
import path3 from "path";
|
|
1921
2025
|
import { createRequire } from "module";
|
|
1922
|
-
import { pathToFileURL } from "url";
|
|
2026
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
1923
2027
|
var FONT_IMPORTS = /* @__PURE__ */ new Set(["@farm.js/core", "@farm.js/core/font"]);
|
|
2028
|
+
var FARM_CORE_DIRECTORY = `${path3.dirname(typeof __filename === "string" ? __filename : fileURLToPath(import.meta.url)).replace(/\\/g, "/")}/`;
|
|
1924
2029
|
var FONT_FUNCTIONS = /* @__PURE__ */ new Set(["localFont", "remoteFont"]);
|
|
1925
2030
|
var FONT_CSS_PREFIX = "\0farm:font-css:";
|
|
1926
2031
|
var FONT_RUNTIME_ID = "\0farm:font-runtime";
|
|
@@ -2023,7 +2128,7 @@ function farmFontImportsPlugin(options = {}) {
|
|
|
2023
2128
|
}
|
|
2024
2129
|
async function transformFarmFontCalls(options) {
|
|
2025
2130
|
const cleanId = options.id.split("?", 1)[0];
|
|
2026
|
-
if (!MODULE_EXTENSION_RE.test(cleanId) || /\.d\.[cm]?ts$/.test(cleanId) || !containsFontFunction(options.code)) {
|
|
2131
|
+
if (!MODULE_EXTENSION_RE.test(cleanId) || /\.d\.[cm]?ts$/.test(cleanId) || !containsFontFunction(options.code) || cleanId.replace(/\\/g, "/").startsWith(FARM_CORE_DIRECTORY)) {
|
|
2027
2132
|
return null;
|
|
2028
2133
|
}
|
|
2029
2134
|
const ast = options.parse(options.code);
|
|
@@ -2275,7 +2380,7 @@ ${FONT_SECTION_END}
|
|
|
2275
2380
|
return resource;
|
|
2276
2381
|
}
|
|
2277
2382
|
const bytes2 = await fetchRemoteFont(url, input.integrity);
|
|
2278
|
-
return this.createSelfHostedResource(bytes2, extension,
|
|
2383
|
+
return this.createSelfHostedResource(bytes2, extension, path3.basename(url.pathname));
|
|
2279
2384
|
}
|
|
2280
2385
|
if (input.source.startsWith("/")) {
|
|
2281
2386
|
return this.createPublicResource(input.moduleId, input.source);
|
|
@@ -2298,8 +2403,8 @@ ${FONT_SECTION_END}
|
|
|
2298
2403
|
}
|
|
2299
2404
|
return this.createSelfHostedResource(
|
|
2300
2405
|
bytes,
|
|
2301
|
-
|
|
2302
|
-
|
|
2406
|
+
path3.extname(resolvedPath),
|
|
2407
|
+
path3.basename(resolvedPath)
|
|
2303
2408
|
);
|
|
2304
2409
|
}
|
|
2305
2410
|
async createPublicResource(moduleId, source) {
|
|
@@ -2310,7 +2415,7 @@ ${FONT_SECTION_END}
|
|
|
2310
2415
|
);
|
|
2311
2416
|
}
|
|
2312
2417
|
const publicPath = normalizePublicFontPath(source, moduleId);
|
|
2313
|
-
const resolvedPath =
|
|
2418
|
+
const resolvedPath = path3.resolve(this.publicDir, `.${publicPath}`);
|
|
2314
2419
|
if (!isPathInside(this.publicDir, resolvedPath)) {
|
|
2315
2420
|
throw fontError(moduleId, `public font path must stay inside publicDir`);
|
|
2316
2421
|
}
|
|
@@ -2326,7 +2431,7 @@ ${FONT_SECTION_END}
|
|
|
2326
2431
|
`could not read ${JSON.stringify(source)} from publicDir: ${error.message}`
|
|
2327
2432
|
);
|
|
2328
2433
|
}
|
|
2329
|
-
const extension =
|
|
2434
|
+
const extension = path3.extname(resolvedPath).toLowerCase();
|
|
2330
2435
|
const hash = createHash2("sha256").update(bytes).digest("hex").slice(0, 12);
|
|
2331
2436
|
const resource = {
|
|
2332
2437
|
extension,
|
|
@@ -2341,7 +2446,7 @@ ${FONT_SECTION_END}
|
|
|
2341
2446
|
createSelfHostedResource(bytes, extension, fileName) {
|
|
2342
2447
|
const normalizedExtension = extension.toLowerCase();
|
|
2343
2448
|
const hash = createHash2("sha256").update(bytes).digest("hex").slice(0, 12);
|
|
2344
|
-
const baseName = sanitizeFileName(
|
|
2449
|
+
const baseName = sanitizeFileName(path3.basename(fileName, extension)) || "font";
|
|
2345
2450
|
const outputFileName = `assets/fonts/${baseName}-h${hash}${normalizedExtension}`;
|
|
2346
2451
|
const key = `${hash}${normalizedExtension}`;
|
|
2347
2452
|
const existing = this.resources.get(key);
|
|
@@ -2694,24 +2799,24 @@ function verifyIntegrity(bytes, integrity) {
|
|
|
2694
2799
|
if (!matches) throw new Error("downloaded font did not match its integrity value");
|
|
2695
2800
|
}
|
|
2696
2801
|
function resolveLocalFontPath(source, importer, root) {
|
|
2697
|
-
if (source.startsWith(".")) return
|
|
2698
|
-
if (
|
|
2802
|
+
if (source.startsWith(".")) return path3.resolve(path3.dirname(importer), source);
|
|
2803
|
+
if (path3.isAbsolute(source)) {
|
|
2699
2804
|
return source;
|
|
2700
2805
|
}
|
|
2701
2806
|
try {
|
|
2702
2807
|
return createRequire(pathToFileURL(importer)).resolve(source);
|
|
2703
2808
|
} catch {
|
|
2704
2809
|
const segments = source.replace(/\\/g, "/").split("/");
|
|
2705
|
-
if (segments.includes("..")) return
|
|
2706
|
-
let current =
|
|
2707
|
-
const filesystemRoot =
|
|
2810
|
+
if (segments.includes("..")) return path3.resolve(root, source);
|
|
2811
|
+
let current = path3.dirname(importer);
|
|
2812
|
+
const filesystemRoot = path3.parse(current).root;
|
|
2708
2813
|
while (true) {
|
|
2709
|
-
const candidate =
|
|
2710
|
-
if (
|
|
2814
|
+
const candidate = path3.join(current, "node_modules", ...segments);
|
|
2815
|
+
if (existsSync(candidate)) return candidate;
|
|
2711
2816
|
if (current === filesystemRoot) break;
|
|
2712
|
-
current =
|
|
2817
|
+
current = path3.dirname(current);
|
|
2713
2818
|
}
|
|
2714
|
-
return
|
|
2819
|
+
return path3.resolve(root, "node_modules", ...segments);
|
|
2715
2820
|
}
|
|
2716
2821
|
}
|
|
2717
2822
|
function replaceFontSection(css, section) {
|
|
@@ -2744,11 +2849,11 @@ function getGlobalMap(key) {
|
|
|
2744
2849
|
return created;
|
|
2745
2850
|
}
|
|
2746
2851
|
function normalizeRoot(root) {
|
|
2747
|
-
return
|
|
2852
|
+
return path3.resolve(root).replace(/\\/g, "/");
|
|
2748
2853
|
}
|
|
2749
2854
|
function normalizePublicDir(root, publicDir) {
|
|
2750
2855
|
if (publicDir === false || publicDir === "") return false;
|
|
2751
|
-
return
|
|
2856
|
+
return path3.resolve(root, publicDir || "public");
|
|
2752
2857
|
}
|
|
2753
2858
|
function normalizePublicFontPath(source, moduleId) {
|
|
2754
2859
|
if (source.includes("?") || source.includes("#")) {
|
|
@@ -2757,8 +2862,8 @@ function normalizePublicFontPath(source, moduleId) {
|
|
|
2757
2862
|
return `/${source.replace(/\\/g, "/").replace(/^\/+/, "")}`;
|
|
2758
2863
|
}
|
|
2759
2864
|
function isPathInside(parent, child) {
|
|
2760
|
-
const relative3 =
|
|
2761
|
-
return relative3 === "" || !relative3.startsWith("..") && !
|
|
2865
|
+
const relative3 = path3.relative(parent, child);
|
|
2866
|
+
return relative3 === "" || !relative3.startsWith("..") && !path3.isAbsolute(relative3);
|
|
2762
2867
|
}
|
|
2763
2868
|
function normalizeBasePath(value) {
|
|
2764
2869
|
if (!value || value === "/") return "/";
|
|
@@ -2768,7 +2873,7 @@ function joinBasePath(basePath, value) {
|
|
|
2768
2873
|
return basePath === "/" ? value : `${basePath.replace(/\/$/, "")}${value}`;
|
|
2769
2874
|
}
|
|
2770
2875
|
function extensionFromPath(pathname) {
|
|
2771
|
-
const extension =
|
|
2876
|
+
const extension = path3.extname(pathname).toLowerCase();
|
|
2772
2877
|
if (!FONT_EXTENSION_RE.test(extension)) {
|
|
2773
2878
|
throw new Error(`[Farm fonts] Remote font URL must end in .woff2, .woff, .ttf, or .otf`);
|
|
2774
2879
|
}
|
|
@@ -2907,6 +3012,49 @@ function fontError(id, message) {
|
|
|
2907
3012
|
return new Error(`[Farm fonts] ${message} in ${id.split("?", 1)[0]}`);
|
|
2908
3013
|
}
|
|
2909
3014
|
|
|
3015
|
+
// src/server/dev-styles.ts
|
|
3016
|
+
import * as fs2 from "fs";
|
|
3017
|
+
import * as path4 from "path";
|
|
3018
|
+
function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
|
|
3019
|
+
const file = path4.join(root, srcDir, "app", "globals.css");
|
|
3020
|
+
if (!fs2.existsSync(file)) return void 0;
|
|
3021
|
+
return `/${path4.relative(root, file).split(path4.sep).join("/")}`;
|
|
3022
|
+
}
|
|
3023
|
+
var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
|
|
3024
|
+
var ALREADY_LINKED = "/src/app/globals.css";
|
|
3025
|
+
function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, options = {}) {
|
|
3026
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3027
|
+
for (const mod of modules) {
|
|
3028
|
+
const id = mod.id ?? mod.file ?? "";
|
|
3029
|
+
if (!STYLE_EXTENSIONS.test(id)) continue;
|
|
3030
|
+
const cssModule = id.includes(".module.");
|
|
3031
|
+
if (cssModule && !options.cssModules) continue;
|
|
3032
|
+
const url = mod.url;
|
|
3033
|
+
if (!url || !url.startsWith("/")) continue;
|
|
3034
|
+
const bare = url.split("?")[0];
|
|
3035
|
+
if (bare === alreadyLinked) continue;
|
|
3036
|
+
seen.add(cssModule ? `${bare}?direct` : bare);
|
|
3037
|
+
}
|
|
3038
|
+
return [...seen].sort();
|
|
3039
|
+
}
|
|
3040
|
+
var SERVER_STYLESHEET_FILE = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/;
|
|
3041
|
+
function farmDevServerStylesheetsPlugin() {
|
|
3042
|
+
return {
|
|
3043
|
+
name: "farm:dev-server-stylesheets",
|
|
3044
|
+
apply: "serve",
|
|
3045
|
+
enforce: "pre",
|
|
3046
|
+
applyToEnvironment: (environment) => environment.config.consumer === "server",
|
|
3047
|
+
load: {
|
|
3048
|
+
filter: { id: SERVER_STYLESHEET_FILE },
|
|
3049
|
+
handler(id) {
|
|
3050
|
+
if (id.startsWith("\0") && !id.startsWith(FONT_CSS_PREFIX)) return null;
|
|
3051
|
+
if (/\.module\.[^./]+$/.test(id)) return null;
|
|
3052
|
+
return "";
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
|
|
2910
3058
|
// src/integration-provider-build.ts
|
|
2911
3059
|
import path5 from "path";
|
|
2912
3060
|
function isRendererCompiledComponent(moduleId, rendererComponentExtensions) {
|
|
@@ -3014,7 +3162,7 @@ function resolveProviderModule(moduleId, root) {
|
|
|
3014
3162
|
}
|
|
3015
3163
|
|
|
3016
3164
|
// src/island-inference.ts
|
|
3017
|
-
import
|
|
3165
|
+
import fs3 from "fs";
|
|
3018
3166
|
import path6 from "path";
|
|
3019
3167
|
import { inferStrategy } from "@farm.js/islx/compiler";
|
|
3020
3168
|
import { parseAst } from "rolldown/parseAst";
|
|
@@ -3032,7 +3180,7 @@ function parseFarmIslandSource(file, code) {
|
|
|
3032
3180
|
}
|
|
3033
3181
|
function modifiedAt(file) {
|
|
3034
3182
|
try {
|
|
3035
|
-
return
|
|
3183
|
+
return fs3.statSync(file).mtimeMs;
|
|
3036
3184
|
} catch {
|
|
3037
3185
|
return -1;
|
|
3038
3186
|
}
|
|
@@ -3046,7 +3194,7 @@ function inferFarmIslandStrategy(filePath, root) {
|
|
|
3046
3194
|
}
|
|
3047
3195
|
let code;
|
|
3048
3196
|
try {
|
|
3049
|
-
code =
|
|
3197
|
+
code = fs3.readFileSync(file, "utf8");
|
|
3050
3198
|
} catch {
|
|
3051
3199
|
return { strategy: null, files: [file], reason: `${path6.basename(file)} could not be read` };
|
|
3052
3200
|
}
|
|
@@ -3081,8 +3229,10 @@ function inferFarmRouteRootStrategy(owners, root) {
|
|
|
3081
3229
|
});
|
|
3082
3230
|
return result;
|
|
3083
3231
|
}
|
|
3232
|
+
var NODE_MODULES = "node_modules";
|
|
3233
|
+
var NODE_MODULES_SEGMENT2 = `${path6.sep}${NODE_MODULES}${path6.sep}`;
|
|
3084
3234
|
function isInstalledPackageFile(file) {
|
|
3085
|
-
return file.
|
|
3235
|
+
return file.includes(NODE_MODULES_SEGMENT2) || file.startsWith(`${NODE_MODULES}${path6.sep}`) || file.endsWith(`${path6.sep}${NODE_MODULES}`) || file === NODE_MODULES;
|
|
3086
3236
|
}
|
|
3087
3237
|
function inferRouteRoot(owners, root) {
|
|
3088
3238
|
const files = [];
|
|
@@ -3101,7 +3251,7 @@ function inferRouteRoot(owners, root) {
|
|
|
3101
3251
|
for (const module of modules) {
|
|
3102
3252
|
let source = null;
|
|
3103
3253
|
try {
|
|
3104
|
-
source =
|
|
3254
|
+
source = fs3.readFileSync(module, "utf8");
|
|
3105
3255
|
} catch {
|
|
3106
3256
|
}
|
|
3107
3257
|
if (getIslandStrategyExport(source) !== null) return { strategy: null, files, declared: true };
|
|
@@ -3137,15 +3287,15 @@ function resolveFarmRouteRootStrategy(route, page, layouts, root, islandsMode) {
|
|
|
3137
3287
|
}
|
|
3138
3288
|
|
|
3139
3289
|
// src/server/renderer.ts
|
|
3140
|
-
import * as
|
|
3290
|
+
import * as fs7 from "fs";
|
|
3141
3291
|
import * as https from "https";
|
|
3142
3292
|
import { isIP } from "net";
|
|
3143
|
-
import * as
|
|
3293
|
+
import * as path10 from "path";
|
|
3144
3294
|
import * as tls from "tls";
|
|
3145
3295
|
import { Readable, Writable } from "stream";
|
|
3146
3296
|
|
|
3147
3297
|
// src/not-found.ts
|
|
3148
|
-
import
|
|
3298
|
+
import fs4 from "fs";
|
|
3149
3299
|
import path7 from "path";
|
|
3150
3300
|
function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
3151
3301
|
const extensions = getFarmRendererComponentExtensions(config.renderer);
|
|
@@ -3157,7 +3307,7 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
|
3157
3307
|
`notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
|
|
3158
3308
|
);
|
|
3159
3309
|
}
|
|
3160
|
-
if (!
|
|
3310
|
+
if (!fs4.existsSync(componentPath) || !fs4.statSync(componentPath).isFile()) {
|
|
3161
3311
|
throw new Error(`notFound.component was not found: ${componentPath}`);
|
|
3162
3312
|
}
|
|
3163
3313
|
return componentPath;
|
|
@@ -3166,7 +3316,7 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
|
3166
3316
|
for (const appDir of appDirs) {
|
|
3167
3317
|
for (const extension of extensions) {
|
|
3168
3318
|
const candidate = path7.join(appDir, `not-found${extension}`);
|
|
3169
|
-
if (
|
|
3319
|
+
if (fs4.existsSync(candidate) && fs4.statSync(candidate).isFile()) {
|
|
3170
3320
|
discoveredPath = candidate;
|
|
3171
3321
|
break;
|
|
3172
3322
|
}
|
|
@@ -3362,9 +3512,9 @@ body {
|
|
|
3362
3512
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
3363
3513
|
|
|
3364
3514
|
// src/server/error-diagnostics.ts
|
|
3365
|
-
import * as
|
|
3515
|
+
import * as fs5 from "fs";
|
|
3366
3516
|
import * as path8 from "path";
|
|
3367
|
-
import { fileURLToPath } from "url";
|
|
3517
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3368
3518
|
var SECRET_VALUE_PATTERN = /\b(api[_-]?key|access[_-]?token|auth[_-]?token|client[_-]?secret|secret[_-]?key|token|password|secret)\s*[:=]\s*([^\s,;]+)/gi;
|
|
3369
3519
|
var BEARER_PATTERN = /\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi;
|
|
3370
3520
|
function redactErrorText(value) {
|
|
@@ -3377,7 +3527,7 @@ function isPathInsideRoot(root, filePath) {
|
|
|
3377
3527
|
function normalizeStackPath(value) {
|
|
3378
3528
|
const withoutQuery = value.replace(/[?#].*$/, "");
|
|
3379
3529
|
try {
|
|
3380
|
-
return withoutQuery.startsWith("file://") ?
|
|
3530
|
+
return withoutQuery.startsWith("file://") ? fileURLToPath2(withoutQuery) : withoutQuery;
|
|
3381
3531
|
} catch {
|
|
3382
3532
|
return void 0;
|
|
3383
3533
|
}
|
|
@@ -3391,7 +3541,7 @@ function findStackLocation(stack, root) {
|
|
|
3391
3541
|
const candidate = normalizeStackPath(match[1]);
|
|
3392
3542
|
if (!candidate || candidate.includes(`${path8.sep}node_modules${path8.sep}`)) continue;
|
|
3393
3543
|
const absolutePath = path8.resolve(candidate);
|
|
3394
|
-
if (!isPathInsideRoot(root, absolutePath) || !
|
|
3544
|
+
if (!isPathInsideRoot(root, absolutePath) || !fs5.existsSync(absolutePath)) continue;
|
|
3395
3545
|
const relativePath = path8.relative(root, absolutePath).split(path8.sep).join("/");
|
|
3396
3546
|
return {
|
|
3397
3547
|
absolutePath,
|
|
@@ -3404,7 +3554,7 @@ function findStackLocation(stack, root) {
|
|
|
3404
3554
|
}
|
|
3405
3555
|
function createSourceFrame(location) {
|
|
3406
3556
|
try {
|
|
3407
|
-
const sourceLines =
|
|
3557
|
+
const sourceLines = fs5.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
|
|
3408
3558
|
if (location.line < 1 || location.line > sourceLines.length) return void 0;
|
|
3409
3559
|
const start = Math.max(1, location.line - 2);
|
|
3410
3560
|
const end = Math.min(sourceLines.length, location.line + 2);
|
|
@@ -3449,6 +3599,244 @@ function canBootFarmIslandsClient(config) {
|
|
|
3449
3599
|
return resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands" && !docsEnabled && resolveFarmClientPlugins(config.plugins, config.root).length === 0 && !resolveFarmAppClientEntry(config.root, config.srcDir || "src");
|
|
3450
3600
|
}
|
|
3451
3601
|
|
|
3602
|
+
// src/islands-kept-layouts.ts
|
|
3603
|
+
import fs6 from "fs";
|
|
3604
|
+
import path9 from "path";
|
|
3605
|
+
import { parseAst as parseAst2 } from "rolldown/parseAst";
|
|
3606
|
+
var SCRIPT_SOURCE = /\.[cm]?[jt]sx?$/;
|
|
3607
|
+
var ASSET_SOURCE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss|svg|png|jpe?g|gif|webp|avif|ico|woff2?|ttf|otf)$/;
|
|
3608
|
+
var PURE_PACKAGE_IMPORTS = /* @__PURE__ */ new Map([
|
|
3609
|
+
["react", "*"],
|
|
3610
|
+
["react/jsx-runtime", "*"],
|
|
3611
|
+
["react/jsx-dev-runtime", "*"],
|
|
3612
|
+
["@farm.js/core/client", /* @__PURE__ */ new Set(["Link"])]
|
|
3613
|
+
]);
|
|
3614
|
+
var IMPURE_GLOBALS = /* @__PURE__ */ new Set([
|
|
3615
|
+
"process",
|
|
3616
|
+
"globalThis",
|
|
3617
|
+
"global",
|
|
3618
|
+
"window",
|
|
3619
|
+
"self",
|
|
3620
|
+
"Date",
|
|
3621
|
+
"crypto",
|
|
3622
|
+
"fetch",
|
|
3623
|
+
"require",
|
|
3624
|
+
"eval",
|
|
3625
|
+
"Function",
|
|
3626
|
+
"performance",
|
|
3627
|
+
"setTimeout",
|
|
3628
|
+
"setInterval",
|
|
3629
|
+
"queueMicrotask",
|
|
3630
|
+
"AsyncLocalStorage"
|
|
3631
|
+
]);
|
|
3632
|
+
var DECLARATION_STATEMENTS = /* @__PURE__ */ new Set([
|
|
3633
|
+
"ImportDeclaration",
|
|
3634
|
+
"FunctionDeclaration",
|
|
3635
|
+
"VariableDeclaration",
|
|
3636
|
+
"ClassDeclaration",
|
|
3637
|
+
"TSTypeAliasDeclaration",
|
|
3638
|
+
"TSInterfaceDeclaration",
|
|
3639
|
+
"TSEnumDeclaration",
|
|
3640
|
+
"TSModuleDeclaration",
|
|
3641
|
+
"TSDeclareFunction",
|
|
3642
|
+
"EmptyStatement"
|
|
3643
|
+
]);
|
|
3644
|
+
function parse(code, file) {
|
|
3645
|
+
const extension = path9.extname(file).slice(1);
|
|
3646
|
+
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : extension === "js" || extension === "mjs" || extension === "cjs" || extension === "jsx" ? "jsx" : "tsx";
|
|
3647
|
+
return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
|
|
3648
|
+
try {
|
|
3649
|
+
return parseAst2(code, { lang });
|
|
3650
|
+
} catch {
|
|
3651
|
+
return null;
|
|
3652
|
+
}
|
|
3653
|
+
});
|
|
3654
|
+
}
|
|
3655
|
+
function findFarmRequestDecidingConstruct(code, file) {
|
|
3656
|
+
const program = parse(code, file);
|
|
3657
|
+
if (!program) return { reason: "the module does not parse", imports: [] };
|
|
3658
|
+
const imports = [];
|
|
3659
|
+
let reason = null;
|
|
3660
|
+
for (const statement of program.body) {
|
|
3661
|
+
if (statement.type === "ImportDeclaration") {
|
|
3662
|
+
if (statement.importKind === "type") continue;
|
|
3663
|
+
const names = [];
|
|
3664
|
+
for (const specifier of statement.specifiers ?? []) {
|
|
3665
|
+
if (specifier.importKind === "type") continue;
|
|
3666
|
+
if (specifier.type === "ImportSpecifier") {
|
|
3667
|
+
names.push(specifier.imported.name ?? specifier.imported.value);
|
|
3668
|
+
} else if (specifier.type === "ImportDefaultSpecifier") names.push("default");
|
|
3669
|
+
else names.push("*");
|
|
3670
|
+
}
|
|
3671
|
+
if ((statement.specifiers ?? []).length === 0 || names.length > 0) {
|
|
3672
|
+
imports.push({ source: statement.source.value, names });
|
|
3673
|
+
}
|
|
3674
|
+
continue;
|
|
3675
|
+
}
|
|
3676
|
+
if (statement.type === "ExportAllDeclaration") {
|
|
3677
|
+
if (statement.exportKind !== "type")
|
|
3678
|
+
imports.push({ source: statement.source.value, names: ["*"] });
|
|
3679
|
+
continue;
|
|
3680
|
+
}
|
|
3681
|
+
if (statement.type === "ExportNamedDeclaration") {
|
|
3682
|
+
if (statement.source && statement.exportKind !== "type") {
|
|
3683
|
+
imports.push({
|
|
3684
|
+
source: statement.source.value,
|
|
3685
|
+
names: (statement.specifiers ?? []).filter((specifier) => specifier.exportKind !== "type").map((specifier) => specifier.local.name ?? specifier.local.value)
|
|
3686
|
+
});
|
|
3687
|
+
}
|
|
3688
|
+
continue;
|
|
3689
|
+
}
|
|
3690
|
+
if (statement.type === "ExportDefaultDeclaration") continue;
|
|
3691
|
+
if (statement.type === "ExpressionStatement" && typeof statement.directive === "string") {
|
|
3692
|
+
continue;
|
|
3693
|
+
}
|
|
3694
|
+
if (!DECLARATION_STATEMENTS.has(statement.type)) {
|
|
3695
|
+
reason ?? (reason = `a top-level ${statement.type}`);
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
const visit = (node, parent, key) => {
|
|
3699
|
+
if (reason || !node || typeof node !== "object") return;
|
|
3700
|
+
if (Array.isArray(node)) {
|
|
3701
|
+
for (const child of node) visit(child, parent, key);
|
|
3702
|
+
return;
|
|
3703
|
+
}
|
|
3704
|
+
const current = node;
|
|
3705
|
+
if (typeof current.type !== "string") return;
|
|
3706
|
+
switch (current.type) {
|
|
3707
|
+
case "ThrowStatement":
|
|
3708
|
+
reason = "a throw statement";
|
|
3709
|
+
return;
|
|
3710
|
+
case "AwaitExpression":
|
|
3711
|
+
reason = "an await expression";
|
|
3712
|
+
return;
|
|
3713
|
+
case "YieldExpression":
|
|
3714
|
+
reason = "a generator";
|
|
3715
|
+
return;
|
|
3716
|
+
case "ImportExpression":
|
|
3717
|
+
reason = "a dynamic import()";
|
|
3718
|
+
return;
|
|
3719
|
+
case "ForOfStatement":
|
|
3720
|
+
if (current.await) {
|
|
3721
|
+
reason = "a for await loop";
|
|
3722
|
+
return;
|
|
3723
|
+
}
|
|
3724
|
+
break;
|
|
3725
|
+
case "FunctionDeclaration":
|
|
3726
|
+
case "FunctionExpression":
|
|
3727
|
+
case "ArrowFunctionExpression":
|
|
3728
|
+
if (current.async || current.generator) {
|
|
3729
|
+
reason = current.async ? "an async function" : "a generator";
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
break;
|
|
3733
|
+
case "MetaProperty":
|
|
3734
|
+
reason = "import.meta";
|
|
3735
|
+
return;
|
|
3736
|
+
case "CallExpression":
|
|
3737
|
+
if (current.callee?.type === "Identifier" && current.callee.name === "use") {
|
|
3738
|
+
reason = "a use() call";
|
|
3739
|
+
return;
|
|
3740
|
+
}
|
|
3741
|
+
if (current.callee?.type === "MemberExpression" && !current.callee.computed && current.callee.object?.type === "Identifier" && current.callee.object.name === "Math" && current.callee.property?.name === "random") {
|
|
3742
|
+
reason = "Math.random()";
|
|
3743
|
+
return;
|
|
3744
|
+
}
|
|
3745
|
+
break;
|
|
3746
|
+
case "Identifier":
|
|
3747
|
+
if (IMPURE_GLOBALS.has(current.name) && isReference(current, parent, key)) {
|
|
3748
|
+
reason = `the global ${current.name}`;
|
|
3749
|
+
return;
|
|
3750
|
+
}
|
|
3751
|
+
break;
|
|
3752
|
+
}
|
|
3753
|
+
for (const [childKey, value] of Object.entries(current)) {
|
|
3754
|
+
if (childKey === "start" || childKey === "end" || childKey === "loc" || childKey === "range") {
|
|
3755
|
+
continue;
|
|
3756
|
+
}
|
|
3757
|
+
if (value && typeof value === "object") visit(value, current, childKey);
|
|
3758
|
+
}
|
|
3759
|
+
};
|
|
3760
|
+
for (const statement of program.body) {
|
|
3761
|
+
if (statement.type === "ImportDeclaration") continue;
|
|
3762
|
+
visit(statement, program, "body");
|
|
3763
|
+
if (reason) break;
|
|
3764
|
+
}
|
|
3765
|
+
return { reason, imports };
|
|
3766
|
+
}
|
|
3767
|
+
function isReference(node, parent, key) {
|
|
3768
|
+
if (!parent) return true;
|
|
3769
|
+
if (parent.type === "MemberExpression" && key === "property" && !parent.computed) return false;
|
|
3770
|
+
if ((parent.type === "Property" || parent.type === "MethodDefinition") && key === "key") {
|
|
3771
|
+
return Boolean(parent.computed);
|
|
3772
|
+
}
|
|
3773
|
+
if (parent.type === "PropertyDefinition" && key === "key") return Boolean(parent.computed);
|
|
3774
|
+
if (parent.type.startsWith("TS")) return false;
|
|
3775
|
+
if (parent.type === "JSXAttribute" || parent.type.startsWith("JSX")) return false;
|
|
3776
|
+
if (parent.type === "LabeledStatement" || parent.type === "BreakStatement") return false;
|
|
3777
|
+
if (parent.type === "ContinueStatement") return false;
|
|
3778
|
+
return true;
|
|
3779
|
+
}
|
|
3780
|
+
function readSource(file) {
|
|
3781
|
+
try {
|
|
3782
|
+
noteFarmSourceRead(file);
|
|
3783
|
+
return fs6.readFileSync(file, "utf8");
|
|
3784
|
+
} catch {
|
|
3785
|
+
return null;
|
|
3786
|
+
}
|
|
3787
|
+
}
|
|
3788
|
+
function explainFarmKeptLayoutRender(modulePath, root) {
|
|
3789
|
+
const entry = resolveModuleSourcePath(modulePath, root);
|
|
3790
|
+
if (!entry) return `${modulePath} does not resolve`;
|
|
3791
|
+
const visited = /* @__PURE__ */ new Set();
|
|
3792
|
+
const check = (file) => {
|
|
3793
|
+
if (visited.has(file)) return null;
|
|
3794
|
+
visited.add(file);
|
|
3795
|
+
if (ASSET_SOURCE.test(file)) return null;
|
|
3796
|
+
if (!SCRIPT_SOURCE.test(file)) return `${path9.relative(root, file)} is not a script`;
|
|
3797
|
+
const code = readSource(file);
|
|
3798
|
+
if (code === null) return `${path9.relative(root, file)} cannot be read`;
|
|
3799
|
+
const { reason, imports } = memoizeInFarmSourceSnapshot(
|
|
3800
|
+
"kept-layout-module",
|
|
3801
|
+
code,
|
|
3802
|
+
() => findFarmRequestDecidingConstruct(code, file)
|
|
3803
|
+
);
|
|
3804
|
+
if (reason) return `${path9.relative(root, file)} has ${reason}`;
|
|
3805
|
+
for (const imported of imports) {
|
|
3806
|
+
const allowed = PURE_PACKAGE_IMPORTS.get(imported.source);
|
|
3807
|
+
if (allowed) {
|
|
3808
|
+
if (allowed === "*" || imported.names.every((name) => allowed.has(name))) continue;
|
|
3809
|
+
return `${path9.relative(root, file)} imports ${imported.names.join(", ")} from ${imported.source}`;
|
|
3810
|
+
}
|
|
3811
|
+
if (ASSET_SOURCE.test(imported.source.split("?")[0])) continue;
|
|
3812
|
+
const resolved = resolveImportedModule(file, imported.source, root);
|
|
3813
|
+
if (!resolved.path || !resolved.local) {
|
|
3814
|
+
return `${path9.relative(root, file)} imports ${imported.source}`;
|
|
3815
|
+
}
|
|
3816
|
+
const nested = check(resolved.path);
|
|
3817
|
+
if (nested) return nested;
|
|
3818
|
+
}
|
|
3819
|
+
return null;
|
|
3820
|
+
};
|
|
3821
|
+
return check(entry);
|
|
3822
|
+
}
|
|
3823
|
+
var answers = /* @__PURE__ */ new Map();
|
|
3824
|
+
function canFarmSkipKeptLayoutRender(modulePath, root) {
|
|
3825
|
+
const key = `${root}\0${modulePath}`;
|
|
3826
|
+
const known = answers.get(key);
|
|
3827
|
+
if (known && known.stamps.every(([file, stamp]) => getFarmSourceStamp(file) === stamp)) {
|
|
3828
|
+
return known.skip;
|
|
3829
|
+
}
|
|
3830
|
+
const { result, files } = traceFarmSourceReads(
|
|
3831
|
+
() => explainFarmKeptLayoutRender(modulePath, root) === null
|
|
3832
|
+
);
|
|
3833
|
+
answers.set(key, {
|
|
3834
|
+
skip: result,
|
|
3835
|
+
stamps: files.map((file) => [file, getFarmSourceStamp(file)])
|
|
3836
|
+
});
|
|
3837
|
+
return result;
|
|
3838
|
+
}
|
|
3839
|
+
|
|
3452
3840
|
// src/server/renderer.ts
|
|
3453
3841
|
var islands;
|
|
3454
3842
|
function withFarmIslandsRenders(runtime, islandsRuntime) {
|
|
@@ -3708,12 +4096,13 @@ function createRouteStateProps(input) {
|
|
|
3708
4096
|
function readAppPackageIdentity(root) {
|
|
3709
4097
|
try {
|
|
3710
4098
|
return JSON.parse(
|
|
3711
|
-
|
|
4099
|
+
fs7.readFileSync(path10.join(root || process.cwd(), "package.json"), "utf8")
|
|
3712
4100
|
);
|
|
3713
4101
|
} catch {
|
|
3714
4102
|
return {};
|
|
3715
4103
|
}
|
|
3716
4104
|
}
|
|
4105
|
+
var pageRequests = /* @__PURE__ */ new WeakMap();
|
|
3717
4106
|
var ServerRenderer = class {
|
|
3718
4107
|
constructor(config, routeManager, i18nRuntime, viteServer) {
|
|
3719
4108
|
this.ssgManifest = [];
|
|
@@ -3737,7 +4126,7 @@ var ServerRenderer = class {
|
|
|
3737
4126
|
if (this.config.notFound?.component?.trim()) {
|
|
3738
4127
|
resolveFarmNotFoundComponentPath(this.config, getFarmAppDirectories(this.config));
|
|
3739
4128
|
}
|
|
3740
|
-
const loaded = isReactRenderer(this.config.renderer) ? await import("./renderer/react/server.mjs") : isFarmRendererDisabled(this.config.renderer) ? await import("./renderer/none/server.mjs") : this.viteServer ? await loadFarmDevModule(this.viteServer, this.config.renderer.server) : await import(pathToFileURL2(
|
|
4129
|
+
const loaded = isReactRenderer(this.config.renderer) ? this.reactRenderer = await import("./renderer/react/server.mjs") : isFarmRendererDisabled(this.config.renderer) ? await import("./renderer/none/server.mjs") : this.viteServer ? await loadFarmDevModule(this.viteServer, this.config.renderer.server) : await import(pathToFileURL2(
|
|
3741
4130
|
resolveFarmRendererModule(
|
|
3742
4131
|
this.config.root || process.cwd(),
|
|
3743
4132
|
this.config.renderer.server
|
|
@@ -3785,7 +4174,7 @@ var ServerRenderer = class {
|
|
|
3785
4174
|
configureApp(setupModule.default);
|
|
3786
4175
|
}
|
|
3787
4176
|
createPageBoundary(pageElement, options) {
|
|
3788
|
-
|
|
4177
|
+
const boundary = this.rendererRuntime.createElement(
|
|
3789
4178
|
"div",
|
|
3790
4179
|
{
|
|
3791
4180
|
id: "__farm_page__",
|
|
@@ -3797,6 +4186,7 @@ var ServerRenderer = class {
|
|
|
3797
4186
|
},
|
|
3798
4187
|
pageElement
|
|
3799
4188
|
);
|
|
4189
|
+
return options.pageShouldHydrate && !options.layoutShouldHydrate && this.reactRenderer ? this.reactRenderer.markPagePosition(boundary) : boundary;
|
|
3800
4190
|
}
|
|
3801
4191
|
/// The app's `<srcDir>/app/globals.css`, linked only when it exists, as the
|
|
3802
4192
|
/// production build imports it only when it exists. An app without one gets
|
|
@@ -3982,6 +4372,7 @@ var ServerRenderer = class {
|
|
|
3982
4372
|
await this.initialize();
|
|
3983
4373
|
if (this.viteServer) await this.applyRendererAppSetup();
|
|
3984
4374
|
setFarmBasePath(this.config.basePath);
|
|
4375
|
+
this.publishSearchPreserveRoutes();
|
|
3985
4376
|
setFarmTrailingSlashPreference(this.config.trailingSlash);
|
|
3986
4377
|
let element = this.rendererRuntime.createElement(input.PageComponent, input.pageProps);
|
|
3987
4378
|
if (input.LoadingComponent) {
|
|
@@ -4038,6 +4429,9 @@ var ServerRenderer = class {
|
|
|
4038
4429
|
});
|
|
4039
4430
|
element = this.createLayoutBoundary(layout.pattern, element);
|
|
4040
4431
|
}
|
|
4432
|
+
if (input.pageShouldHydrate && !input.layoutShouldHydrate && this.reactRenderer) {
|
|
4433
|
+
element = this.reactRenderer.markLayoutPosition(element);
|
|
4434
|
+
}
|
|
4041
4435
|
if (input.layoutShouldHydrate) {
|
|
4042
4436
|
element = this.wrapClientGraph(element);
|
|
4043
4437
|
}
|
|
@@ -4045,6 +4439,137 @@ var ServerRenderer = class {
|
|
|
4045
4439
|
rejectLateRedirects: true
|
|
4046
4440
|
});
|
|
4047
4441
|
}
|
|
4442
|
+
/**
|
|
4443
|
+
* A built-in docs runtime page (`docs.entry`, no adapter) under layouts that hydrate, or whose
|
|
4444
|
+
* client components are islands: the docs runtime's document with the layout chain
|
|
4445
|
+
* rendered around its body, and the client that hydrates it with the boot data an app page has. Production renders the same tree
|
|
4446
|
+
* (wrapFarmDocsResponseWithLayouts in nitro/universal-build.ts, with docs-layout-tree.ts).
|
|
4447
|
+
* Any other docs response is sent as it is.
|
|
4448
|
+
*/
|
|
4449
|
+
async wrapDocsResponseWithLayouts(request2, response) {
|
|
4450
|
+
if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !response.headers.get("content-type")?.toLowerCase().includes("text/html")) {
|
|
4451
|
+
return response;
|
|
4452
|
+
}
|
|
4453
|
+
await this.initialize();
|
|
4454
|
+
if (this.viteServer) await this.applyRendererAppSetup();
|
|
4455
|
+
const pathname = new URL(request2.url).pathname;
|
|
4456
|
+
const root = this.config.root || process.cwd();
|
|
4457
|
+
const matched = this.routeManager.matchRoute(pathname);
|
|
4458
|
+
const routeManifest = this.routeManager.generateClientManifest(this.config.root);
|
|
4459
|
+
const islandsMode = Boolean(islands && this.islandValues());
|
|
4460
|
+
const layouts = matched.layouts.map((layout) => {
|
|
4461
|
+
const entry = routeManifest.layouts.find((candidate) => candidate.pattern === layout.pattern);
|
|
4462
|
+
return {
|
|
4463
|
+
pattern: layout.pattern,
|
|
4464
|
+
modulePath: layout.modulePath,
|
|
4465
|
+
shouldHydrate: entry?.shouldHydrate === true,
|
|
4466
|
+
islandStrategy: entry?.islandStrategy ?? null,
|
|
4467
|
+
hasIsolatedClientBoundaries: entry?.hasIsolatedClientBoundaries === true,
|
|
4468
|
+
serverTree: entry?.serverTree === true,
|
|
4469
|
+
islands: entry?.hasIsolatedClientBoundaries === true
|
|
4470
|
+
};
|
|
4471
|
+
});
|
|
4472
|
+
if (!farmDocsLayoutsWrapPage(layouts)) return response;
|
|
4473
|
+
const shouldHydrateLayout = layouts.some((layout) => layout.shouldHydrate);
|
|
4474
|
+
const hasIsolatedClientBoundaries = layouts.some(
|
|
4475
|
+
(layout) => layout.hasIsolatedClientBoundaries
|
|
4476
|
+
);
|
|
4477
|
+
const source = await response.text();
|
|
4478
|
+
const bodyMatch = /<body([^>]*)>([\s\S]*?)<\/body>/i.exec(source);
|
|
4479
|
+
if (!bodyMatch) {
|
|
4480
|
+
return new Response(source, {
|
|
4481
|
+
status: response.status,
|
|
4482
|
+
statusText: response.statusText,
|
|
4483
|
+
headers: response.headers
|
|
4484
|
+
});
|
|
4485
|
+
}
|
|
4486
|
+
const modules = await Promise.all(
|
|
4487
|
+
layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
4488
|
+
);
|
|
4489
|
+
const treeLayouts = layouts.map((layout, index) => ({
|
|
4490
|
+
...layout,
|
|
4491
|
+
Component: modules[index]?.default
|
|
4492
|
+
}));
|
|
4493
|
+
const islandStrategy = resolveFarmDocsLayoutIslandStrategy(treeLayouts);
|
|
4494
|
+
const tree = await createFarmDocsLayoutTree(this.rendererRuntime, {
|
|
4495
|
+
pageHtml: bodyMatch[2],
|
|
4496
|
+
layouts: treeLayouts,
|
|
4497
|
+
params: matched.params,
|
|
4498
|
+
renderServerTreeLayout: islandsMode ? (Layout, props, outlets, pattern) => islands.renderFarmServerTreeLayout(
|
|
4499
|
+
Layout,
|
|
4500
|
+
props,
|
|
4501
|
+
outlets,
|
|
4502
|
+
pattern
|
|
4503
|
+
) : void 0,
|
|
4504
|
+
layoutKey: islandsMode ? (pattern) => getFarmLayoutKey(pattern, matched.params) : void 0
|
|
4505
|
+
});
|
|
4506
|
+
const rendered = await this.renderElementToDocumentParts(
|
|
4507
|
+
this.rendererRuntime.createElement(
|
|
4508
|
+
"div",
|
|
4509
|
+
{ id: "root" },
|
|
4510
|
+
await this.wrapWithIntegrationProviders(
|
|
4511
|
+
shouldHydrateLayout ? this.wrapClientGraph(tree) : tree
|
|
4512
|
+
)
|
|
4513
|
+
)
|
|
4514
|
+
);
|
|
4515
|
+
const rootMarkup = placeFarmDocsLayoutRoot(rendered.html);
|
|
4516
|
+
const clientLayouts = layouts.map((layout) => ({
|
|
4517
|
+
pattern: layout.pattern,
|
|
4518
|
+
modulePath: toViteModuleId(layout.modulePath, root),
|
|
4519
|
+
shouldHydrate: layout.shouldHydrate,
|
|
4520
|
+
islandStrategy: layout.islandStrategy,
|
|
4521
|
+
...layout.hasIsolatedClientBoundaries ? { hasIsolatedClientBoundaries: true } : {},
|
|
4522
|
+
// Islands mode: the browser rebuilds this layout from its tree, not its module.
|
|
4523
|
+
...shouldHydrateLayout && layout.serverTree ? { serverTree: true } : {}
|
|
4524
|
+
}));
|
|
4525
|
+
const clientManifest = createFarmDevClientManifest(routeManifest, {
|
|
4526
|
+
sharedAssets: [
|
|
4527
|
+
...this.devGlobalStylesheetAssets(),
|
|
4528
|
+
...this.collectDevStyleHrefs().map((href) => ({
|
|
4529
|
+
tag: "link",
|
|
4530
|
+
attrs: { rel: "stylesheet", href }
|
|
4531
|
+
}))
|
|
4532
|
+
],
|
|
4533
|
+
boot: { layoutPatterns: layouts.map((layout) => layout.pattern) }
|
|
4534
|
+
});
|
|
4535
|
+
const i18nSnapshot = getFarmI18nClientSnapshot();
|
|
4536
|
+
const bootstrapScript = `<script>
|
|
4537
|
+
window.__FARM_PROPS__ = ${serializeInlineValue({ params: matched.params })};
|
|
4538
|
+
window.__FARM_ROUTE_SLOTS__ = [];
|
|
4539
|
+
window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
|
|
4540
|
+
window.__FARM_PATH__ = ${serializeInlineValue(pathname)};
|
|
4541
|
+
window.__FARM_IS_CLIENT__ = false;
|
|
4542
|
+
window.__FARM_PAGE_SHOULD_HYDRATE__ = false;
|
|
4543
|
+
window.__FARM_LAYOUT_SHOULD_HYDRATE__ = ${JSON.stringify(shouldHydrateLayout)};
|
|
4544
|
+
window.__FARM_LAYOUTS__ = ${serializeInlineValue(clientLayouts)};
|
|
4545
|
+
window.__FARM_SHOULD_HYDRATE__ = ${JSON.stringify(shouldHydrateLayout || hasIsolatedClientBoundaries)};
|
|
4546
|
+
window.__FARM_HAS_ISOLATED_CLIENT_BOUNDARIES__ = ${JSON.stringify(hasIsolatedClientBoundaries)};
|
|
4547
|
+
window.__FARM_ISLAND_STRATEGY__ = ${serializeInlineValue(islandStrategy)};
|
|
4548
|
+
window.__FARM_PAGE_MODULE__ = "";
|
|
4549
|
+
window.__FARM_LOADING_MODULE__ = null;
|
|
4550
|
+
window.__FARM_MANIFEST__ = ${serializeInlineValue(clientManifest)};
|
|
4551
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${serializeInlineValue(getRegisteredIntegrationAPIManifest())};
|
|
4552
|
+
window.__FARM_I18N__ = ${i18nSnapshot ? serializeInlineValue(i18nSnapshot) : "null"};
|
|
4553
|
+
</script>`;
|
|
4554
|
+
const head = [
|
|
4555
|
+
...this.collectDevStyleLinks(),
|
|
4556
|
+
`<script type="module" src="/@vite/client"></script>`,
|
|
4557
|
+
source.includes("window._$HY") ? "" : this.rendererRuntime.generateHydrationScript?.(),
|
|
4558
|
+
bootstrapScript
|
|
4559
|
+
].filter(Boolean).map((markup) => stampFarmCspNonce(markup)).concat(rendered.head || []).join("\n ");
|
|
4560
|
+
const clientScript = source.includes('src="/@farm/client.js"') ? "" : `
|
|
4561
|
+
${stampFarmCspNonce(`<script type="module" src="/@farm/client.js"></script>`)}`;
|
|
4562
|
+
const html = source.replace(bodyMatch[0], () => `<body${bodyMatch[1]}>${rootMarkup}${clientScript}</body>`).replace(/<\/head>/i, () => ` ${head}
|
|
4563
|
+
</head>`);
|
|
4564
|
+
const headers = new Headers(response.headers);
|
|
4565
|
+
headers.delete("content-length");
|
|
4566
|
+
headers.delete("etag");
|
|
4567
|
+
return new Response(html, {
|
|
4568
|
+
status: response.status,
|
|
4569
|
+
statusText: response.statusText,
|
|
4570
|
+
headers
|
|
4571
|
+
});
|
|
4572
|
+
}
|
|
4048
4573
|
async runWithRequestContext(request2, fn) {
|
|
4049
4574
|
return _runWithCurrentRequest(
|
|
4050
4575
|
request2,
|
|
@@ -4060,10 +4585,10 @@ var ServerRenderer = class {
|
|
|
4060
4585
|
* Load SSG manifest from build output
|
|
4061
4586
|
*/
|
|
4062
4587
|
loadSSGManifest() {
|
|
4063
|
-
const manifestPath =
|
|
4588
|
+
const manifestPath = path10.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
|
|
4064
4589
|
let content;
|
|
4065
4590
|
try {
|
|
4066
|
-
content =
|
|
4591
|
+
content = fs7.readFileSync(manifestPath, "utf-8");
|
|
4067
4592
|
} catch (error) {
|
|
4068
4593
|
if (error.code === "ENOENT") {
|
|
4069
4594
|
return;
|
|
@@ -4116,26 +4641,23 @@ var ServerRenderer = class {
|
|
|
4116
4641
|
this.getPPRCacheKey(pathname, search, locale, origin)
|
|
4117
4642
|
);
|
|
4118
4643
|
}
|
|
4119
|
-
|
|
4644
|
+
getPPRShellWriteOptions(options) {
|
|
4645
|
+
return {
|
|
4646
|
+
// revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
|
|
4647
|
+
// answers the public one (`/console/fr/pricing`): either clears it, as in production.
|
|
4648
|
+
paths: [.../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])],
|
|
4649
|
+
tags: ["ppr"],
|
|
4650
|
+
revalidate: options.revalidate ?? false
|
|
4651
|
+
};
|
|
4652
|
+
}
|
|
4653
|
+
async cachePPRShell(options, html, write, cookieIndependent = false) {
|
|
4120
4654
|
const key = this.getPPRCacheKey(
|
|
4121
4655
|
options.pathname,
|
|
4122
4656
|
options.search,
|
|
4123
4657
|
options.locale,
|
|
4124
4658
|
options.origin
|
|
4125
4659
|
);
|
|
4126
|
-
await this.dataCache.pprShellCache.
|
|
4127
|
-
key,
|
|
4128
|
-
{ html },
|
|
4129
|
-
{
|
|
4130
|
-
// revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
|
|
4131
|
-
// answers the public one (`/console/fr/pricing`): either clears it, as in production.
|
|
4132
|
-
paths: [
|
|
4133
|
-
.../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])
|
|
4134
|
-
],
|
|
4135
|
-
tags: ["ppr"],
|
|
4136
|
-
revalidate: options.revalidate ?? false
|
|
4137
|
-
}
|
|
4138
|
-
);
|
|
4660
|
+
await (write ?? await this.dataCache.pprShellCache.startWriteAsync(this.getPPRShellWriteOptions(options))).commit(key, { html, ...cookieIndependent ? { cookieIndependent: true } : {} });
|
|
4139
4661
|
emitFarmEvent({
|
|
4140
4662
|
type: "ppr.shell.cached",
|
|
4141
4663
|
route: options.pathname,
|
|
@@ -4151,9 +4673,6 @@ var ServerRenderer = class {
|
|
|
4151
4673
|
if (method !== "GET" && method !== "HEAD") {
|
|
4152
4674
|
return "method";
|
|
4153
4675
|
}
|
|
4154
|
-
if (withoutFarmDeploymentCookie(req.headers.cookie)) {
|
|
4155
|
-
return "cookie";
|
|
4156
|
-
}
|
|
4157
4676
|
if (req.headers.authorization) {
|
|
4158
4677
|
return "authorization";
|
|
4159
4678
|
}
|
|
@@ -4184,11 +4703,14 @@ var ServerRenderer = class {
|
|
|
4184
4703
|
}
|
|
4185
4704
|
return headers;
|
|
4186
4705
|
}
|
|
4187
|
-
serveCachedPPRShell(res, shell, revalidate) {
|
|
4706
|
+
serveCachedPPRShell(req, res, shell, revalidate) {
|
|
4188
4707
|
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
4189
4708
|
for (const [key, value] of Object.entries(this.getPPRHeaders("hit", revalidate))) {
|
|
4190
4709
|
res.setHeader(key, value);
|
|
4191
4710
|
}
|
|
4711
|
+
if (withoutFarmDeploymentCookie(req.headers.cookie)) {
|
|
4712
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
4713
|
+
}
|
|
4192
4714
|
res.write(shell.html);
|
|
4193
4715
|
res.end();
|
|
4194
4716
|
}
|
|
@@ -4240,6 +4762,9 @@ var ServerRenderer = class {
|
|
|
4240
4762
|
});
|
|
4241
4763
|
pageElement = this.createLayoutBoundary(layouts[i].pattern, pageElement);
|
|
4242
4764
|
}
|
|
4765
|
+
if (pageMetadata.shouldHydrate && !layoutShouldHydrate && this.reactRenderer) {
|
|
4766
|
+
pageElement = this.reactRenderer.markLayoutPosition(pageElement);
|
|
4767
|
+
}
|
|
4243
4768
|
const html = await this.rendererRuntime.renderToString(
|
|
4244
4769
|
await this.wrapWithIntegrationProviders(pageElement)
|
|
4245
4770
|
);
|
|
@@ -4286,10 +4811,10 @@ var ServerRenderer = class {
|
|
|
4286
4811
|
return true;
|
|
4287
4812
|
}
|
|
4288
4813
|
try {
|
|
4289
|
-
const htmlPath = page.urlPath === "/" ?
|
|
4290
|
-
if (
|
|
4291
|
-
const stat =
|
|
4292
|
-
const html =
|
|
4814
|
+
const htmlPath = page.urlPath === "/" ? path10.join(this.config.root, this.config.outDir, "client", "index.html") : path10.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
|
|
4815
|
+
if (fs7.existsSync(htmlPath)) {
|
|
4816
|
+
const stat = fs7.statSync(htmlPath);
|
|
4817
|
+
const html = fs7.readFileSync(htmlPath, "utf-8");
|
|
4293
4818
|
await this.cacheSSGPage(page, html, {
|
|
4294
4819
|
document: true,
|
|
4295
4820
|
createdAt: stat.mtimeMs
|
|
@@ -4312,10 +4837,19 @@ var ServerRenderer = class {
|
|
|
4312
4837
|
}
|
|
4313
4838
|
return false;
|
|
4314
4839
|
}
|
|
4840
|
+
/**
|
|
4841
|
+
* The pages with `search.preserve`, for the links this render draws (set per render, like the
|
|
4842
|
+
* base path, so a routes-file edit applies to the next one). A route manager without the list,
|
|
4843
|
+
* such as a partial test double, has none.
|
|
4844
|
+
*/
|
|
4845
|
+
publishSearchPreserveRoutes() {
|
|
4846
|
+
_setFarmSearchPreserveRoutes(this.routeManager.getSearchPreserveRoutes?.() ?? []);
|
|
4847
|
+
}
|
|
4315
4848
|
async renderPage(req, res) {
|
|
4316
4849
|
await this.initialize();
|
|
4317
4850
|
if (this.viteServer) await this.applyRendererAppSetup();
|
|
4318
4851
|
setFarmBasePath(this.config.basePath);
|
|
4852
|
+
this.publishSearchPreserveRoutes();
|
|
4319
4853
|
setFarmTrailingSlashPreference(this.config.trailingSlash);
|
|
4320
4854
|
const cspNonce = createFarmCspNonce(this.security);
|
|
4321
4855
|
if (cspNonce) {
|
|
@@ -4323,9 +4857,7 @@ var ServerRenderer = class {
|
|
|
4323
4857
|
const header = getFarmSecurityHeader(this.security, cspNonce);
|
|
4324
4858
|
res.setHeader(header.key, header.value);
|
|
4325
4859
|
}
|
|
4326
|
-
const request2 =
|
|
4327
|
-
trustProxy: this.config.server?.trustProxy
|
|
4328
|
-
});
|
|
4860
|
+
const request2 = this.createPageRequest(req, res);
|
|
4329
4861
|
const runtime = this.i18nRuntime;
|
|
4330
4862
|
if (runtime?.config.enabled) {
|
|
4331
4863
|
const resolution = runtime.resolveRequest(request2);
|
|
@@ -4351,6 +4883,28 @@ var ServerRenderer = class {
|
|
|
4351
4883
|
() => this.runWithRequestContext(request2, () => this.renderPageInContext(req, res))
|
|
4352
4884
|
);
|
|
4353
4885
|
}
|
|
4886
|
+
/**
|
|
4887
|
+
* The Request a page, its layouts, and its server functions read. Its signal aborts when the
|
|
4888
|
+
* client goes away before the response finishes, as in production, so rendering that observes
|
|
4889
|
+
* it can stop.
|
|
4890
|
+
*/
|
|
4891
|
+
createPageRequest(req, res) {
|
|
4892
|
+
const existing = pageRequests.get(req);
|
|
4893
|
+
if (existing) return existing;
|
|
4894
|
+
const request2 = this.createPageRequestOnce(req, res);
|
|
4895
|
+
pageRequests.set(req, request2);
|
|
4896
|
+
return request2;
|
|
4897
|
+
}
|
|
4898
|
+
createPageRequestOnce(req, res) {
|
|
4899
|
+
const observable = typeof req.once === "function" && typeof res.once === "function";
|
|
4900
|
+
return createWebRequestFromFarmRequest(req, {
|
|
4901
|
+
trustProxy: this.config.server?.trustProxy,
|
|
4902
|
+
signal: observable ? createFarmNodeRequestAbortSignal(
|
|
4903
|
+
req,
|
|
4904
|
+
res
|
|
4905
|
+
) : void 0
|
|
4906
|
+
});
|
|
4907
|
+
}
|
|
4354
4908
|
async renderPageInContext(req, res) {
|
|
4355
4909
|
const renderStartTime = Date.now();
|
|
4356
4910
|
let pathname = "/";
|
|
@@ -4372,6 +4926,7 @@ var ServerRenderer = class {
|
|
|
4372
4926
|
durationMs: Date.now() - renderStartTime
|
|
4373
4927
|
});
|
|
4374
4928
|
};
|
|
4929
|
+
let pprShellWrite;
|
|
4375
4930
|
try {
|
|
4376
4931
|
const url = resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy });
|
|
4377
4932
|
pathname = url.pathname;
|
|
@@ -4465,9 +5020,7 @@ var ServerRenderer = class {
|
|
|
4465
5020
|
this.routeManager.loadRouteModule(route.modulePath),
|
|
4466
5021
|
...layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
4467
5022
|
]);
|
|
4468
|
-
actionRequest =
|
|
4469
|
-
trustProxy: this.config.server?.trustProxy
|
|
4470
|
-
});
|
|
5023
|
+
actionRequest = this.createPageRequest(req, res);
|
|
4471
5024
|
const formActionRequest = actionRequest;
|
|
4472
5025
|
const actionResponse = await _runWithMiddlewareData(
|
|
4473
5026
|
toMiddlewareMap(req.__FARM_MIDDLEWARE_DATA__),
|
|
@@ -4497,9 +5050,7 @@ var ServerRenderer = class {
|
|
|
4497
5050
|
pluginExposedContext = getRequestContextSnapshot(req, {
|
|
4498
5051
|
exposedOnly: true
|
|
4499
5052
|
});
|
|
4500
|
-
const currentRequest = actionRequest ??
|
|
4501
|
-
trustProxy: this.config.server?.trustProxy
|
|
4502
|
-
});
|
|
5053
|
+
const currentRequest = actionRequest ?? this.createPageRequest(req, res);
|
|
4503
5054
|
const routeContext = await this.resolveRouteContext({
|
|
4504
5055
|
request: currentRequest,
|
|
4505
5056
|
rawRequest: req,
|
|
@@ -4563,7 +5114,7 @@ var ServerRenderer = class {
|
|
|
4563
5114
|
);
|
|
4564
5115
|
const canCachePPRShell = renderingConfig.ppr && !pprBypassReason && !islandsNavigationRequest;
|
|
4565
5116
|
const pprI18nSnapshot = canCachePPRShell ? getFarmI18nClientSnapshot() : void 0;
|
|
4566
|
-
|
|
5117
|
+
let pprShellOptions = canCachePPRShell ? {
|
|
4567
5118
|
pathname,
|
|
4568
5119
|
search: url.search,
|
|
4569
5120
|
locale: pprI18nSnapshot?.locale ?? "",
|
|
@@ -4586,6 +5137,7 @@ var ServerRenderer = class {
|
|
|
4586
5137
|
emitFarmEvent({ type: "ppr.refresh.start", route: pathname });
|
|
4587
5138
|
}
|
|
4588
5139
|
}
|
|
5140
|
+
const pprVisitorCookies = Boolean(withoutFarmDeploymentCookie(req.headers.cookie));
|
|
4589
5141
|
if (pprShellOptions) {
|
|
4590
5142
|
const pprCacheKey = this.getPPRCacheKey(
|
|
4591
5143
|
pathname,
|
|
@@ -4599,25 +5151,37 @@ var ServerRenderer = class {
|
|
|
4599
5151
|
pprShellOptions.locale,
|
|
4600
5152
|
pprShellOptions.origin
|
|
4601
5153
|
);
|
|
4602
|
-
if (cachedPPRShell) {
|
|
5154
|
+
if (cachedPPRShell && pprVisitorCookies && !cachedPPRShell.value.cookieIndependent) {
|
|
5155
|
+
pprShellOptions = void 0;
|
|
5156
|
+
emitFarmEvent({ type: "ppr.shell.bypass", route: pathname, reason: "cookie" });
|
|
5157
|
+
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "cookie" });
|
|
5158
|
+
} else if (cachedPPRShell) {
|
|
4603
5159
|
emitFarmEvent({
|
|
4604
5160
|
type: "ppr.shell.hit",
|
|
4605
5161
|
route: pathname,
|
|
4606
5162
|
key: pprCacheKey
|
|
4607
5163
|
});
|
|
4608
|
-
this.serveCachedPPRShell(res, cachedPPRShell.value, renderingConfig.revalidate);
|
|
5164
|
+
this.serveCachedPPRShell(req, res, cachedPPRShell.value, renderingConfig.revalidate);
|
|
4609
5165
|
completeRender(res.statusCode || 200, pathname);
|
|
4610
5166
|
return;
|
|
5167
|
+
} else {
|
|
5168
|
+
emitFarmEvent({
|
|
5169
|
+
type: "ppr.shell.miss",
|
|
5170
|
+
route: pathname,
|
|
5171
|
+
key: pprCacheKey
|
|
5172
|
+
});
|
|
5173
|
+
if (req.method !== "HEAD") {
|
|
5174
|
+
pprShellWrite = await this.dataCache.pprShellCache.startWriteAsync(
|
|
5175
|
+
this.getPPRShellWriteOptions(pprShellOptions)
|
|
5176
|
+
);
|
|
5177
|
+
}
|
|
4611
5178
|
}
|
|
4612
|
-
emitFarmEvent({
|
|
4613
|
-
type: "ppr.shell.miss",
|
|
4614
|
-
route: pathname,
|
|
4615
|
-
key: pprCacheKey
|
|
4616
|
-
});
|
|
4617
5179
|
}
|
|
4618
5180
|
const outerRequest = _peekCurrentRequest();
|
|
4619
5181
|
const countRequestReads = () => (outerRequest ? _getRequestReadCount(outerRequest) : 0) + _getRequestReadCount(currentRequest);
|
|
4620
5182
|
const requestReadsBeforeRender = countRequestReads();
|
|
5183
|
+
const countRequestCookieReads = () => (outerRequest ? _getRequestCookieReadCount(outerRequest) : 0) + _getRequestCookieReadCount(currentRequest);
|
|
5184
|
+
const requestCookieReadsBeforeRender = countRequestCookieReads();
|
|
4621
5185
|
let LoadingFallbackComponent = null;
|
|
4622
5186
|
if (loadingBoundaryEntry) {
|
|
4623
5187
|
const loadingModule = await this.routeManager.loadRouteModule(
|
|
@@ -4754,6 +5318,7 @@ var ServerRenderer = class {
|
|
|
4754
5318
|
const hasIsolatedClientBoundaries = routeManifestEntry?.hasIsolatedClientBoundaries === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
|
|
4755
5319
|
req.__FARM_PAGE_PATH__ = route.modulePath;
|
|
4756
5320
|
req.__FARM_ROUTE__ = pathname;
|
|
5321
|
+
req.__FARM_ROOT_LAYOUT_PATH__ = layouts[0]?.modulePath;
|
|
4757
5322
|
req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
|
|
4758
5323
|
req.__FARM_PAGE_SHOULD_HYDRATE__ = shouldHydrate;
|
|
4759
5324
|
req.__FARM_LAYOUT_SHOULD_HYDRATE__ = shouldHydrateLayout;
|
|
@@ -4847,7 +5412,8 @@ var ServerRenderer = class {
|
|
|
4847
5412
|
const islandsSegments = Boolean(islands && this.islandValues());
|
|
4848
5413
|
const keptLayoutCount = islandsSegments && !renderingConfig.ssg && !shouldHydrateLayout && renderedRouteSlots.length === 0 ? countFarmKeptLayouts(requestHeader(req, "f-layouts"), layouts, params) : 0;
|
|
4849
5414
|
let keptLayouts = keptLayoutCount > 1 ? keptLayoutCount : 0;
|
|
4850
|
-
|
|
5415
|
+
const keptRoot = this.config.root || process.cwd();
|
|
5416
|
+
if (keptLayouts > 0 && !layouts.slice(0, keptLayouts).every((layout) => canFarmSkipKeptLayoutRender(layout.modulePath, keptRoot))) {
|
|
4851
5417
|
let keptElement = null;
|
|
4852
5418
|
for (let i = keptLayouts - 1; i >= 0; i--) {
|
|
4853
5419
|
const KeptLayout = layoutModules[i]?.default;
|
|
@@ -4860,7 +5426,7 @@ var ServerRenderer = class {
|
|
|
4860
5426
|
}
|
|
4861
5427
|
try {
|
|
4862
5428
|
await this.renderElementToCompleteHTML(
|
|
4863
|
-
await this.wrapWithIntegrationProviders(keptElement),
|
|
5429
|
+
await this.wrapWithIntegrationProviders(this.wrapClientGraph(keptElement)),
|
|
4864
5430
|
{ rejectLateErrors: true }
|
|
4865
5431
|
);
|
|
4866
5432
|
} catch {
|
|
@@ -4936,8 +5502,14 @@ var ServerRenderer = class {
|
|
|
4936
5502
|
wrappedElement
|
|
4937
5503
|
);
|
|
4938
5504
|
}
|
|
5505
|
+
if ((isClientComponent || shouldHydrate) && !shouldHydrateLayout && this.reactRenderer) {
|
|
5506
|
+
wrappedElement = this.reactRenderer.markLayoutPosition(wrappedElement);
|
|
5507
|
+
}
|
|
4939
5508
|
const integratedElement = await this.wrapWithIntegrationProviders(wrappedElement);
|
|
4940
5509
|
const pprHeaders = renderingConfig.ppr ? this.getPPRHeaders(pprShellOptions ? "miss" : "bypass", renderingConfig.revalidate) : void 0;
|
|
5510
|
+
if (pprHeaders && pprShellOptions && pprVisitorCookies) {
|
|
5511
|
+
pprHeaders["Cache-Control"] = "private, no-store";
|
|
5512
|
+
}
|
|
4941
5513
|
await this.renderWithSSR(
|
|
4942
5514
|
integratedElement,
|
|
4943
5515
|
req,
|
|
@@ -4970,7 +5542,26 @@ var ServerRenderer = class {
|
|
|
4970
5542
|
});
|
|
4971
5543
|
return;
|
|
4972
5544
|
}
|
|
4973
|
-
|
|
5545
|
+
const renderReadCookies = countRequestCookieReads() !== requestCookieReadsBeforeRender;
|
|
5546
|
+
if (renderReadCookies && pprVisitorCookies) {
|
|
5547
|
+
emitFarmEvent({
|
|
5548
|
+
type: "ppr.shell.bypass",
|
|
5549
|
+
route: pathname,
|
|
5550
|
+
reason: "cookie"
|
|
5551
|
+
});
|
|
5552
|
+
emitFarmEvent({
|
|
5553
|
+
type: "cache.bypass",
|
|
5554
|
+
route: pathname,
|
|
5555
|
+
reason: "cookie"
|
|
5556
|
+
});
|
|
5557
|
+
return;
|
|
5558
|
+
}
|
|
5559
|
+
return this.cachePPRShell(
|
|
5560
|
+
pprShellOptions,
|
|
5561
|
+
html,
|
|
5562
|
+
pprShellWrite,
|
|
5563
|
+
!renderReadCookies
|
|
5564
|
+
);
|
|
4974
5565
|
} : void 0
|
|
4975
5566
|
}
|
|
4976
5567
|
);
|
|
@@ -5061,13 +5652,16 @@ var ServerRenderer = class {
|
|
|
5061
5652
|
pluginExposedContext,
|
|
5062
5653
|
error,
|
|
5063
5654
|
statusCode: errorStatus,
|
|
5064
|
-
errorModulePath: errorBoundaryEntry.modulePath
|
|
5655
|
+
errorModulePath: errorBoundaryEntry.modulePath,
|
|
5656
|
+
errorPattern: errorBoundaryEntry.pattern
|
|
5065
5657
|
});
|
|
5066
5658
|
if (rendered) {
|
|
5067
5659
|
return;
|
|
5068
5660
|
}
|
|
5069
5661
|
}
|
|
5070
5662
|
await this.renderError(req, res, error, errorStatus);
|
|
5663
|
+
} finally {
|
|
5664
|
+
pprShellWrite?.release();
|
|
5071
5665
|
}
|
|
5072
5666
|
}
|
|
5073
5667
|
async wrapWithIntegrationProviders(element) {
|
|
@@ -5092,11 +5686,11 @@ var ServerRenderer = class {
|
|
|
5092
5686
|
if (isFarmIntegrationProviderComponentReference(provider.component)) {
|
|
5093
5687
|
providerSourceModule = provider.component.module;
|
|
5094
5688
|
const providerModuleId = provider.component.module.startsWith(".") ? toViteModuleId(
|
|
5095
|
-
|
|
5689
|
+
path10.resolve(this.config.root, provider.component.module),
|
|
5096
5690
|
this.config.root
|
|
5097
5691
|
) : provider.component.module;
|
|
5098
5692
|
const providerModule = this.viteServer ? await loadFarmDevModule(this.viteServer, providerModuleId) : await importRuntimeModule(
|
|
5099
|
-
provider.component.module.startsWith(".") ? pathToFileURL2(
|
|
5693
|
+
provider.component.module.startsWith(".") ? pathToFileURL2(path10.resolve(this.config.root, provider.component.module)).href : provider.component.module
|
|
5100
5694
|
);
|
|
5101
5695
|
ProviderComponent = providerModule[provider.component.export || "default"];
|
|
5102
5696
|
} else if (typeof provider.component === "function") {
|
|
@@ -5365,7 +5959,7 @@ var ServerRenderer = class {
|
|
|
5365
5959
|
logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
|
|
5366
5960
|
return void 0;
|
|
5367
5961
|
}),
|
|
5368
|
-
|
|
5962
|
+
fs7.promises.stat(route.modulePath).catch(() => void 0)
|
|
5369
5963
|
]);
|
|
5370
5964
|
if (await this.isAgentPageNoIndex(pattern, module?.metadata)) return null;
|
|
5371
5965
|
return { pattern, module, lastModified: stat?.mtime.toISOString() };
|
|
@@ -5452,7 +6046,7 @@ var ServerRenderer = class {
|
|
|
5452
6046
|
const server = this.getDefaultMCPServer();
|
|
5453
6047
|
const request2 = getCurrentRequestOrNull() ?? createWebRequestFromFarmRequest(req, { trustProxy: this.config.server?.trustProxy });
|
|
5454
6048
|
try {
|
|
5455
|
-
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-
|
|
6049
|
+
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-PJKZHYSA.mjs");
|
|
5456
6050
|
const origin = new URL(request2.url).origin;
|
|
5457
6051
|
const i18n = this.i18nRuntime?.config;
|
|
5458
6052
|
const metadataBase = await this.getRootMetadataBase();
|
|
@@ -5668,7 +6262,7 @@ var ServerRenderer = class {
|
|
|
5668
6262
|
res.end();
|
|
5669
6263
|
return;
|
|
5670
6264
|
}
|
|
5671
|
-
res.write(await
|
|
6265
|
+
res.write(await fs7.promises.readFile(image.modulePath));
|
|
5672
6266
|
res.end();
|
|
5673
6267
|
}
|
|
5674
6268
|
async renderRouteErrorBoundary(req, res, options) {
|
|
@@ -5697,8 +6291,14 @@ var ServerRenderer = class {
|
|
|
5697
6291
|
}
|
|
5698
6292
|
});
|
|
5699
6293
|
let wrapped = errorElement;
|
|
6294
|
+
const boundaryLayouts = options.errorPattern === void 0 ? options.layouts : options.layouts.filter(
|
|
6295
|
+
(layout) => !("pattern" in layout) || routeBoundaryCoversDirectory(
|
|
6296
|
+
layout.pattern,
|
|
6297
|
+
options.errorPattern
|
|
6298
|
+
)
|
|
6299
|
+
);
|
|
5700
6300
|
const layoutModules = await Promise.all(
|
|
5701
|
-
|
|
6301
|
+
boundaryLayouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
5702
6302
|
);
|
|
5703
6303
|
for (let i = layoutModules.length - 1; i >= 0; i--) {
|
|
5704
6304
|
const LayoutComponent = layoutModules[i].default;
|
|
@@ -5819,7 +6419,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
5819
6419
|
getTheme()
|
|
5820
6420
|
);
|
|
5821
6421
|
themeDocument.head = farmScripts(themeDocument.head);
|
|
5822
|
-
const fullDocument = extractFarmFullDocument(content);
|
|
6422
|
+
const fullDocument = extractFarmFullDocument(markFarmDocumentLayouts(content));
|
|
5823
6423
|
let html;
|
|
5824
6424
|
if (fullDocument) {
|
|
5825
6425
|
const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
|
|
@@ -5901,12 +6501,11 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
5901
6501
|
* this up front keeps a route's first request on the buffered path too; a layout this cannot
|
|
5902
6502
|
* call (async, a class, or one using hooks) falls back to detection from the stream.
|
|
5903
6503
|
*/
|
|
5904
|
-
async rootLayoutRendersDocument() {
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
if (!rootLayout) return false;
|
|
6504
|
+
async rootLayoutRendersDocument(req) {
|
|
6505
|
+
const modulePath = req.__FARM_ROOT_LAYOUT_PATH__ ?? (typeof this.routeManager.getLayouts === "function" ? this.routeManager.getLayouts().get("/")?.modulePath : void 0);
|
|
6506
|
+
if (!modulePath) return false;
|
|
5908
6507
|
try {
|
|
5909
|
-
const Layout = (await this.routeManager.loadLayoutModule(
|
|
6508
|
+
const Layout = (await this.routeManager.loadLayoutModule(modulePath)).default;
|
|
5910
6509
|
if (typeof Layout !== "function" || Layout.prototype?.isReactComponent || Layout.constructor?.name === "AsyncFunction") {
|
|
5911
6510
|
return false;
|
|
5912
6511
|
}
|
|
@@ -5931,7 +6530,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
5931
6530
|
async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
|
|
5932
6531
|
const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
|
|
5933
6532
|
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
5934
|
-
const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
|
|
6533
|
+
const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument(req);
|
|
5935
6534
|
if (!renderToPipeableStream || _isFarmMarkdownPageCheck(req.headers?.[FARM_MARKDOWN_PAGE_CHECK_HEADER]) || streamDocument && (options.captureStaticShell || !isReactRenderer(this.config.renderer))) {
|
|
5936
6535
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
5937
6536
|
}
|
|
@@ -6107,7 +6706,9 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6107
6706
|
const documentTransform = streamDocument ? createFarmStreamedDocumentTransform(
|
|
6108
6707
|
(opening) => withEarlyClient(
|
|
6109
6708
|
openFarmStreamedDocument(
|
|
6110
|
-
|
|
6709
|
+
markFarmDocumentLayouts(
|
|
6710
|
+
hasExplicitTitle ? removeFarmDocumentTitles(opening) : opening
|
|
6711
|
+
),
|
|
6111
6712
|
{
|
|
6112
6713
|
fallbackIcon: !hasFavicon,
|
|
6113
6714
|
viewport: viewportTags,
|
|
@@ -6446,13 +7047,13 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6446
7047
|
res.end(createFarmMarkdownErrorBody(404, pathname, this.config.basePath || "/"));
|
|
6447
7048
|
return;
|
|
6448
7049
|
}
|
|
6449
|
-
const appDir =
|
|
7050
|
+
const appDir = path10.join(this.config.root, this.config.srcDir, "app");
|
|
6450
7051
|
const notFoundExtensions = getFarmRendererComponentExtensions(this.config.renderer);
|
|
6451
7052
|
let layoutModule = null;
|
|
6452
7053
|
try {
|
|
6453
7054
|
for (const ext of notFoundExtensions) {
|
|
6454
|
-
const layoutPath =
|
|
6455
|
-
if (
|
|
7055
|
+
const layoutPath = path10.join(appDir, `layout${ext}`);
|
|
7056
|
+
if (fs7.existsSync(layoutPath)) {
|
|
6456
7057
|
layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
|
|
6457
7058
|
break;
|
|
6458
7059
|
}
|
|
@@ -6545,7 +7146,8 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
|
|
|
6545
7146
|
getI18nAlternateOptions(req, metadata) {
|
|
6546
7147
|
return {
|
|
6547
7148
|
metadataBase: metadata?.metadataBase,
|
|
6548
|
-
origin: req ? resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy }).origin : void 0
|
|
7149
|
+
origin: req ? resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy }).origin : void 0,
|
|
7150
|
+
languages: metadata?.alternates?.languages
|
|
6549
7151
|
};
|
|
6550
7152
|
}
|
|
6551
7153
|
createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
|
|
@@ -6574,7 +7176,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
6574
7176
|
this.rendererRuntime.generateHydrationScript?.() || ""
|
|
6575
7177
|
);
|
|
6576
7178
|
const viewportTags = renderViewportHead(alternates.metadata?.viewport);
|
|
6577
|
-
const fullDocument = extractFarmFullDocument(content);
|
|
7179
|
+
const fullDocument = extractFarmFullDocument(markFarmDocumentLayouts(content));
|
|
6578
7180
|
if (fullDocument) {
|
|
6579
7181
|
return composeFarmFullDocument(
|
|
6580
7182
|
metadataHead ? removeFarmDocumentTitles(fullDocument) : fullDocument,
|
|
@@ -6644,8 +7246,7 @@ ${clientScript}
|
|
|
6644
7246
|
const deploymentId = this.getDeploymentId();
|
|
6645
7247
|
res.setHeader(FARM_DEPLOYMENT_ID_HEADER, deploymentId);
|
|
6646
7248
|
if ((req.method || "GET").toUpperCase() !== "GET") return;
|
|
6647
|
-
const
|
|
6648
|
-
const isSecure = (Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto)?.split(",")[0]?.trim() === "https" || Boolean(req.socket?.encrypted);
|
|
7249
|
+
const isSecure = resolveFarmRequestURL(req, { trustProxy: this.config.server?.trustProxy }).protocol === "https:";
|
|
6649
7250
|
const cookie = createFarmDeploymentCookie(deploymentId, this.config.basePath || "/", isSecure);
|
|
6650
7251
|
const existing = res.getHeader("Set-Cookie");
|
|
6651
7252
|
if (Array.isArray(existing)) {
|
|
@@ -6673,7 +7274,7 @@ ${clientScript}
|
|
|
6673
7274
|
};
|
|
6674
7275
|
|
|
6675
7276
|
// src/app.ts
|
|
6676
|
-
import
|
|
7277
|
+
import path11 from "path";
|
|
6677
7278
|
var defaultDocsConfig = {
|
|
6678
7279
|
enabled: false,
|
|
6679
7280
|
entry: "/docs",
|
|
@@ -6803,7 +7404,7 @@ var FarmApp = class {
|
|
|
6803
7404
|
const files = [
|
|
6804
7405
|
...this.routeManager.getRoutes().values(),
|
|
6805
7406
|
...this.routeManager.getLayouts().values()
|
|
6806
|
-
].map((entry) =>
|
|
7407
|
+
].map((entry) => path11.relative(this.config.root, entry.modulePath).split(path11.sep).join("/"));
|
|
6807
7408
|
if (files.length === 0) return;
|
|
6808
7409
|
throw new Error(
|
|
6809
7410
|
`This app sets \`renderer: false\`, which serves API routes only, but it has pages or layouts:
|
|
@@ -6829,7 +7430,7 @@ var FarmApp = class {
|
|
|
6829
7430
|
}
|
|
6830
7431
|
const componentExtensions = getFarmRendererComponentExtensions(this.config.renderer);
|
|
6831
7432
|
const rootLayoutPaths = appDirs.flatMap(
|
|
6832
|
-
(appDir) => componentExtensions.map((extension) =>
|
|
7433
|
+
(appDir) => componentExtensions.map((extension) => path11.join(appDir, `layout${extension}`))
|
|
6833
7434
|
);
|
|
6834
7435
|
const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => fileExists(p))).then(
|
|
6835
7436
|
(results) => results.some(Boolean)
|
|
@@ -6892,14 +7493,26 @@ function resolveFarmImageServerRuntime(images, preset) {
|
|
|
6892
7493
|
return provider === "cloudflare" || provider === "auto" && cloudflarePreset ? "cloudflare" : "node";
|
|
6893
7494
|
}
|
|
6894
7495
|
|
|
7496
|
+
// src/markdown-source-path.ts
|
|
7497
|
+
import path12 from "path";
|
|
7498
|
+
function toBakedMarkdownSourcePath(root, filePath) {
|
|
7499
|
+
if (!filePath) return "";
|
|
7500
|
+
if (!path12.isAbsolute(filePath)) return filePath.split(path12.sep).join("/");
|
|
7501
|
+
const relative3 = path12.relative(root, filePath);
|
|
7502
|
+
if (!relative3 || relative3.startsWith("..") || path12.isAbsolute(relative3)) {
|
|
7503
|
+
return path12.basename(filePath);
|
|
7504
|
+
}
|
|
7505
|
+
return relative3.split(path12.sep).join("/");
|
|
7506
|
+
}
|
|
7507
|
+
|
|
6895
7508
|
// src/app-manifest-packages.ts
|
|
6896
|
-
import
|
|
6897
|
-
import
|
|
7509
|
+
import fs8 from "fs";
|
|
7510
|
+
import path13 from "path";
|
|
6898
7511
|
var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
|
|
6899
7512
|
function resolveFarmAppPackages(root) {
|
|
6900
7513
|
let manifest;
|
|
6901
7514
|
try {
|
|
6902
|
-
manifest = JSON.parse(
|
|
7515
|
+
manifest = JSON.parse(fs8.readFileSync(path13.join(root, "package.json"), "utf8"));
|
|
6903
7516
|
} catch {
|
|
6904
7517
|
return {};
|
|
6905
7518
|
}
|
|
@@ -6914,13 +7527,13 @@ function resolveFarmAppPackages(root) {
|
|
|
6914
7527
|
for (let dir = root; ; ) {
|
|
6915
7528
|
try {
|
|
6916
7529
|
const { version } = JSON.parse(
|
|
6917
|
-
|
|
7530
|
+
fs8.readFileSync(path13.join(dir, "node_modules", name, "package.json"), "utf8")
|
|
6918
7531
|
);
|
|
6919
7532
|
if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
|
|
6920
7533
|
versions[name] = version;
|
|
6921
7534
|
break;
|
|
6922
7535
|
} catch {
|
|
6923
|
-
const parent =
|
|
7536
|
+
const parent = path13.dirname(dir);
|
|
6924
7537
|
if (parent === dir) break;
|
|
6925
7538
|
dir = parent;
|
|
6926
7539
|
}
|
|
@@ -6930,9 +7543,9 @@ function resolveFarmAppPackages(root) {
|
|
|
6930
7543
|
}
|
|
6931
7544
|
|
|
6932
7545
|
// src/app-manifest-webmcp.ts
|
|
6933
|
-
import
|
|
7546
|
+
import fs9 from "fs";
|
|
6934
7547
|
import { createRequire as createRequire2 } from "module";
|
|
6935
|
-
import
|
|
7548
|
+
import path14 from "path";
|
|
6936
7549
|
import { globSync } from "tinyglobby";
|
|
6937
7550
|
var WEBMCP_CLIENT = "@farm.js/webmcp/client";
|
|
6938
7551
|
var DEFINERS = /* @__PURE__ */ new Set(["defineWebMCPTool", "registerWebMCPTool", "registerWebMCPTools"]);
|
|
@@ -6950,7 +7563,7 @@ var LANGS = {
|
|
|
6950
7563
|
cjs: "jsx",
|
|
6951
7564
|
jsx: "jsx"
|
|
6952
7565
|
};
|
|
6953
|
-
var
|
|
7566
|
+
var parseAst3;
|
|
6954
7567
|
function staticValue(node) {
|
|
6955
7568
|
if (!node) return NOT_STATIC;
|
|
6956
7569
|
switch (node.type) {
|
|
@@ -7027,13 +7640,13 @@ function toolFromObject(object) {
|
|
|
7027
7640
|
}
|
|
7028
7641
|
function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
7029
7642
|
if (!code.includes(WEBMCP_CLIENT)) return [];
|
|
7030
|
-
const lang = LANGS[
|
|
7031
|
-
|
|
7643
|
+
const lang = LANGS[path14.extname(filename).slice(1)] ?? "tsx";
|
|
7644
|
+
parseAst3 ?? (parseAst3 = createRequire2(typeof __filename === "string" ? __filename : import.meta.url)(
|
|
7032
7645
|
"rolldown/parseAst"
|
|
7033
7646
|
).parseAst);
|
|
7034
7647
|
let program;
|
|
7035
7648
|
try {
|
|
7036
|
-
program =
|
|
7649
|
+
program = parseAst3(code, { lang });
|
|
7037
7650
|
} catch {
|
|
7038
7651
|
return [];
|
|
7039
7652
|
}
|
|
@@ -7074,7 +7687,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
7074
7687
|
}
|
|
7075
7688
|
var cache = /* @__PURE__ */ new Map();
|
|
7076
7689
|
function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
7077
|
-
const base =
|
|
7690
|
+
const base = path14.resolve(root, srcDir);
|
|
7078
7691
|
let files;
|
|
7079
7692
|
try {
|
|
7080
7693
|
files = globSync("**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
|
|
@@ -7091,7 +7704,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
7091
7704
|
for (const file of files.sort()) {
|
|
7092
7705
|
let mtimeMs;
|
|
7093
7706
|
try {
|
|
7094
|
-
mtimeMs =
|
|
7707
|
+
mtimeMs = fs9.statSync(file).mtimeMs;
|
|
7095
7708
|
} catch {
|
|
7096
7709
|
continue;
|
|
7097
7710
|
}
|
|
@@ -7099,7 +7712,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
7099
7712
|
if (!entry || entry.mtimeMs !== mtimeMs) {
|
|
7100
7713
|
let code = "";
|
|
7101
7714
|
try {
|
|
7102
|
-
code =
|
|
7715
|
+
code = fs9.readFileSync(file, "utf8");
|
|
7103
7716
|
} catch {
|
|
7104
7717
|
}
|
|
7105
7718
|
entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
|
|
@@ -7115,8 +7728,8 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
7115
7728
|
}
|
|
7116
7729
|
|
|
7117
7730
|
// src/client-cache-persistence-build.ts
|
|
7118
|
-
import
|
|
7119
|
-
import
|
|
7731
|
+
import fs10 from "fs";
|
|
7732
|
+
import path15 from "path";
|
|
7120
7733
|
var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
7121
7734
|
function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
7122
7735
|
const client = cache2?.client;
|
|
@@ -7127,7 +7740,7 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
|
7127
7740
|
'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
|
|
7128
7741
|
);
|
|
7129
7742
|
}
|
|
7130
|
-
const resolved =
|
|
7743
|
+
const resolved = path15.resolve(root, adapter);
|
|
7131
7744
|
const found = resolveAdapterFile(resolved);
|
|
7132
7745
|
if (!found) {
|
|
7133
7746
|
throw new Error(
|
|
@@ -7140,10 +7753,10 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
|
7140
7753
|
return { importPath: found.replace(/\\/g, "/"), options };
|
|
7141
7754
|
}
|
|
7142
7755
|
function resolveAdapterFile(resolved) {
|
|
7143
|
-
if (
|
|
7756
|
+
if (fs10.existsSync(resolved) && fs10.statSync(resolved).isFile()) return resolved;
|
|
7144
7757
|
for (const extension of ADAPTER_EXTENSIONS) {
|
|
7145
7758
|
const candidate = `${resolved}.${extension}`;
|
|
7146
|
-
if (
|
|
7759
|
+
if (fs10.existsSync(candidate) && fs10.statSync(candidate).isFile()) return candidate;
|
|
7147
7760
|
}
|
|
7148
7761
|
return void 0;
|
|
7149
7762
|
}
|
|
@@ -7186,14 +7799,27 @@ function farmChildrenToArray(children) {
|
|
|
7186
7799
|
|
|
7187
7800
|
function unwrapFarmDocumentElement(node) {
|
|
7188
7801
|
if (!React.isValidElement(node) || node.type !== "html") return undefined;
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7802
|
+
let body;
|
|
7803
|
+
function documentChild(child) {
|
|
7804
|
+
if (React.isValidElement(child)) {
|
|
7805
|
+
if (child.type === "body" && !body) body = child;
|
|
7806
|
+
return child.type === "head" ? null : child;
|
|
7807
|
+
}
|
|
7808
|
+
if (child && typeof child === "object" && typeof child[Symbol.iterator] === "function") {
|
|
7809
|
+
return Array.from(child, documentChild);
|
|
7810
|
+
}
|
|
7811
|
+
return child;
|
|
7812
|
+
}
|
|
7813
|
+
const children = documentChild(node.props.children);
|
|
7814
|
+
if (!body) return farmChildrenToArray(children);
|
|
7815
|
+
|
|
7816
|
+
// React derives useId from the size and index of each sibling array. Keep
|
|
7817
|
+
// the body's original slot, including empty siblings and nested arrays.
|
|
7818
|
+
function bodySlot(child) {
|
|
7819
|
+
if (Array.isArray(child)) return child.map(bodySlot);
|
|
7820
|
+
return child === body ? (body.props.children ?? null) : null;
|
|
7821
|
+
}
|
|
7822
|
+
return bodySlot(children);
|
|
7197
7823
|
}
|
|
7198
7824
|
|
|
7199
7825
|
function farmLayoutBoundaryElement(pattern, content) {
|
|
@@ -7492,8 +8118,8 @@ function restoreFarmServerFields(captured, root) {
|
|
|
7492
8118
|
`;
|
|
7493
8119
|
|
|
7494
8120
|
// src/utils/hook-filters.ts
|
|
7495
|
-
import { realpathSync
|
|
7496
|
-
import
|
|
8121
|
+
import { realpathSync } from "fs";
|
|
8122
|
+
import path16 from "path";
|
|
7497
8123
|
function escapeRegExp(value) {
|
|
7498
8124
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7499
8125
|
}
|
|
@@ -7503,9 +8129,9 @@ function exactIdPattern(ids) {
|
|
|
7503
8129
|
function fileNamePattern(files) {
|
|
7504
8130
|
const names = /* @__PURE__ */ new Set();
|
|
7505
8131
|
for (const file of files) {
|
|
7506
|
-
names.add(
|
|
8132
|
+
names.add(path16.basename(file));
|
|
7507
8133
|
try {
|
|
7508
|
-
names.add(
|
|
8134
|
+
names.add(path16.basename(realpathSync(file)));
|
|
7509
8135
|
} catch {
|
|
7510
8136
|
}
|
|
7511
8137
|
}
|
|
@@ -7513,10 +8139,10 @@ function fileNamePattern(files) {
|
|
|
7513
8139
|
}
|
|
7514
8140
|
|
|
7515
8141
|
// src/docs/client-config.ts
|
|
7516
|
-
import { realpathSync as
|
|
8142
|
+
import { realpathSync as realpathSync2 } from "fs";
|
|
7517
8143
|
import { createRequire as createRequire3 } from "module";
|
|
7518
|
-
import
|
|
7519
|
-
var
|
|
8144
|
+
import path17 from "path";
|
|
8145
|
+
var parseAst4;
|
|
7520
8146
|
function propertyKeyName(property2) {
|
|
7521
8147
|
if (property2.computed) return void 0;
|
|
7522
8148
|
const key = property2.key;
|
|
@@ -7525,11 +8151,11 @@ function propertyKeyName(property2) {
|
|
|
7525
8151
|
return void 0;
|
|
7526
8152
|
}
|
|
7527
8153
|
function redactFarmDocsClientConfig(code, filename) {
|
|
7528
|
-
|
|
8154
|
+
parseAst4 ?? (parseAst4 = createRequire3(typeof __filename === "string" ? __filename : import.meta.url)(
|
|
7529
8155
|
"rolldown/parseAst"
|
|
7530
8156
|
).parseAst);
|
|
7531
|
-
const extension =
|
|
7532
|
-
const program =
|
|
8157
|
+
const extension = path17.extname(filename);
|
|
8158
|
+
const program = parseAst4(code, {
|
|
7533
8159
|
lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
|
|
7534
8160
|
});
|
|
7535
8161
|
const edits = [];
|
|
@@ -7572,7 +8198,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
|
|
|
7572
8198
|
const file = id.split("?")[0].replace(/\\/g, "/");
|
|
7573
8199
|
if (file === configModule) return true;
|
|
7574
8200
|
try {
|
|
7575
|
-
return file ===
|
|
8201
|
+
return file === realpathSync2(configModule).replace(/\\/g, "/");
|
|
7576
8202
|
} catch {
|
|
7577
8203
|
return false;
|
|
7578
8204
|
}
|
|
@@ -7593,8 +8219,57 @@ function farmDocsClientConfigPlugin(configModule) {
|
|
|
7593
8219
|
};
|
|
7594
8220
|
}
|
|
7595
8221
|
|
|
8222
|
+
// src/video-player.ts
|
|
8223
|
+
var FARM_VIDEO_PLAYER_HTML = `<!doctype html>
|
|
8224
|
+
<html lang="en">
|
|
8225
|
+
<head>
|
|
8226
|
+
<meta charset="utf-8">
|
|
8227
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8228
|
+
<meta name="robots" content="noindex">
|
|
8229
|
+
<title>Video</title>
|
|
8230
|
+
<style>
|
|
8231
|
+
html, body { height: 100%; margin: 0; background: #000; }
|
|
8232
|
+
video { display: block; width: 100%; height: 100%; object-fit: contain; }
|
|
8233
|
+
</style>
|
|
8234
|
+
</head>
|
|
8235
|
+
<body>
|
|
8236
|
+
<video controls muted playsinline preload="metadata"></video>
|
|
8237
|
+
<script>
|
|
8238
|
+
(() => {
|
|
8239
|
+
const params = new URLSearchParams(location.search);
|
|
8240
|
+
const sameOrigin = (value) => {
|
|
8241
|
+
if (!value) return null;
|
|
8242
|
+
try {
|
|
8243
|
+
const url = new URL(value, location.href);
|
|
8244
|
+
return url.origin === location.origin ? url.href : null;
|
|
8245
|
+
} catch {
|
|
8246
|
+
return null;
|
|
8247
|
+
}
|
|
8248
|
+
};
|
|
8249
|
+
const src = sameOrigin(params.get("src"));
|
|
8250
|
+
if (!src) return;
|
|
8251
|
+
const video = document.querySelector("video");
|
|
8252
|
+
const poster = sameOrigin(params.get("poster"));
|
|
8253
|
+
if (poster) video.poster = poster;
|
|
8254
|
+
video.addEventListener(
|
|
8255
|
+
"loadedmetadata",
|
|
8256
|
+
() => {
|
|
8257
|
+
if (video.duration > 10) return;
|
|
8258
|
+
video.loop = true;
|
|
8259
|
+
// A browser may refuse autoplay; the controls still play it.
|
|
8260
|
+
video.play().catch(() => {});
|
|
8261
|
+
},
|
|
8262
|
+
{ once: true },
|
|
8263
|
+
);
|
|
8264
|
+
video.src = src;
|
|
8265
|
+
})();
|
|
8266
|
+
</script>
|
|
8267
|
+
</body>
|
|
8268
|
+
</html>
|
|
8269
|
+
`;
|
|
8270
|
+
|
|
7596
8271
|
// src/server/vite-config.ts
|
|
7597
|
-
import
|
|
8272
|
+
import path18 from "path";
|
|
7598
8273
|
var FARM_CLIENT_ENTRY_PATTERN = "**/{page,layout,loading,error,not-found,default}.{js,jsx,ts,tsx}";
|
|
7599
8274
|
var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
7600
8275
|
"react",
|
|
@@ -7621,9 +8296,9 @@ function getFarmClientOptimizeDepsInclude(renderer) {
|
|
|
7621
8296
|
);
|
|
7622
8297
|
}
|
|
7623
8298
|
function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
|
|
7624
|
-
const resolvedProjectRoot =
|
|
8299
|
+
const resolvedProjectRoot = path18.resolve(projectRoot);
|
|
7625
8300
|
return appDirectories.map((appDirectory) => {
|
|
7626
|
-
const relativeAppDirectory =
|
|
8301
|
+
const relativeAppDirectory = path18.relative(resolvedProjectRoot, path18.resolve(appDirectory)).replace(/\\/g, "/");
|
|
7627
8302
|
const prefix = relativeAppDirectory || ".";
|
|
7628
8303
|
return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
|
|
7629
8304
|
});
|
|
@@ -7646,7 +8321,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
|
|
|
7646
8321
|
}
|
|
7647
8322
|
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
7648
8323
|
return {
|
|
7649
|
-
"@":
|
|
8324
|
+
"@": path18.resolve(projectRoot, srcDir)
|
|
7650
8325
|
};
|
|
7651
8326
|
}
|
|
7652
8327
|
function mergeNoExternal(farmValue, userValue) {
|
|
@@ -7835,11 +8510,12 @@ export {
|
|
|
7835
8510
|
inspectStaticMetadataImage,
|
|
7836
8511
|
RouteManager,
|
|
7837
8512
|
createFarmDevClientManifest,
|
|
8513
|
+
farmFontImportsPlugin,
|
|
8514
|
+
mergeFarmFontCss,
|
|
7838
8515
|
resolveDevGlobalStylesheetHref,
|
|
7839
8516
|
collectDevStylesheetUrls,
|
|
8517
|
+
farmDevServerStylesheetsPlugin,
|
|
7840
8518
|
resolveFarmNotFoundComponentPath,
|
|
7841
|
-
farmFontImportsPlugin,
|
|
7842
|
-
mergeFarmFontCss,
|
|
7843
8519
|
DEFAULT_NOT_FOUND_STYLES,
|
|
7844
8520
|
generateFarmIntegrationProviderClientCode,
|
|
7845
8521
|
generateFarmIntegrationProviderServerModules,
|
|
@@ -7847,12 +8523,14 @@ export {
|
|
|
7847
8523
|
invalidateFarmRouteRootInferences,
|
|
7848
8524
|
resolveFarmRouteRootStrategy,
|
|
7849
8525
|
canBootFarmIslandsClient,
|
|
8526
|
+
canFarmSkipKeptLayoutRender,
|
|
7850
8527
|
ServerRenderer,
|
|
7851
8528
|
FarmApp,
|
|
7852
8529
|
createFarmApp,
|
|
7853
8530
|
SHARP_INSTALL_HINT,
|
|
7854
8531
|
resolveFarmImageProviderForRuntime,
|
|
7855
8532
|
resolveFarmImageServerRuntime,
|
|
8533
|
+
toBakedMarkdownSourcePath,
|
|
7856
8534
|
resolveFarmAppPackages,
|
|
7857
8535
|
collectFarmWebMCPTools,
|
|
7858
8536
|
resolveFarmClientCacheAdapterEntry,
|
|
@@ -7867,6 +8545,7 @@ export {
|
|
|
7867
8545
|
redactFarmDocsClientConfig,
|
|
7868
8546
|
isFarmDocsClientConfigModule,
|
|
7869
8547
|
farmDocsClientConfigPlugin,
|
|
8548
|
+
FARM_VIDEO_PLAYER_HTML,
|
|
7870
8549
|
createFarmClientOptimizeDepsEntries,
|
|
7871
8550
|
createFarmClientOptimizeDepsConfig,
|
|
7872
8551
|
createFarmSourceAlias,
|