@farm.js/core 0.1.74 → 0.1.76
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-NRIL4JBC.cjs → agent-mcp-handler-73SGWVZT.cjs} +9 -9
- package/dist/{agent-mcp-handler-HX4F4VKN.mjs → agent-mcp-handler-PJKZHYSA.mjs} +8 -8
- package/dist/{agent-mcp.d-CX8_oOT_.d.ts → agent-mcp.d-Cftp2kFv.d.ts} +24 -2
- package/dist/{agent-mcp.d-BEhDfdWc.d.mts → agent-mcp.d-D0FMmqi0.d.mts} +24 -2
- package/dist/agent-runtime.cjs +7 -7
- package/dist/agent-runtime.d.mts +7 -5
- package/dist/agent-runtime.d.ts +7 -5
- package/dist/agent-runtime.mjs +6 -6
- package/dist/analyzer-KFJGYJS7.cjs +16 -0
- package/dist/{analyzer-2K35LIQZ.mjs → analyzer-NLQKPN74.mjs} +2 -2
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.mjs +3 -3
- package/dist/api/client.native.cjs +6 -6
- package/dist/api/client.native.mjs +3 -3
- package/dist/api/node.cjs +12 -12
- package/dist/api/node.d.mts +9 -7
- package/dist/api/node.d.ts +9 -7
- package/dist/api/node.mjs +11 -11
- package/dist/api/route-manager.cjs +20 -20
- package/dist/api/route-manager.d.mts +9 -7
- package/dist/api/route-manager.d.ts +9 -7
- package/dist/api/route-manager.mjs +19 -19
- package/dist/api/runtime.cjs +11 -11
- package/dist/api/runtime.d.mts +8 -6
- package/dist/api/runtime.d.ts +8 -6
- package/dist/api/runtime.mjs +10 -10
- package/dist/api.cjs +23 -23
- package/dist/api.d.mts +10 -8
- package/dist/api.d.ts +10 -8
- package/dist/api.mjs +22 -22
- package/dist/{app-manifest.d-CVEx1CFB.d.ts → app-manifest.d-7PmA_9hm.d.ts} +1 -1
- package/dist/{app-manifest.d-BcXt2yCx.d.mts → app-manifest.d-cpOw_sV5.d.mts} +1 -1
- package/dist/app-markdown.cjs +7 -7
- package/dist/app-markdown.d.mts +8 -6
- package/dist/app-markdown.d.ts +8 -6
- package/dist/app-markdown.mjs +6 -6
- package/dist/{app.d-DowzSmT5.d.mts → app.d-DUZvwnFF.d.mts} +30 -4
- package/dist/{app.d-B6i8CSrx.d.ts → app.d-wOkxXre8.d.ts} +30 -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 +14 -1
- package/dist/cache.d.ts +14 -1
- package/dist/cache.mjs +1 -1
- package/dist/{chunk-JYNNIGQO.cjs → chunk-25JGHAGH.cjs} +11 -1
- package/dist/{chunk-BFOMCSZ2.mjs → chunk-2GZZVIXY.mjs} +184 -27
- package/dist/{chunk-4BS3HSY7.cjs → chunk-2JEXQAIR.cjs} +2 -2
- package/dist/{chunk-GWXZS7K5.mjs → chunk-2LKUR5QJ.mjs} +1 -1
- package/dist/chunk-2PJVEL56.cjs +90 -0
- package/dist/{chunk-4M5ESTJ2.cjs → chunk-2RSVYJT6.cjs} +19 -3
- package/dist/{chunk-Q3MVNRAO.cjs → chunk-2WKGQCAV.cjs} +1010 -587
- package/dist/{chunk-PG6ZIHKE.cjs → chunk-2YJ4DHTD.cjs} +2 -2
- package/dist/{chunk-MGZVDX4R.mjs → chunk-3AJQFVWW.mjs} +3 -3
- package/dist/{chunk-DRHHTHA3.mjs → chunk-3GMD2E4Q.mjs} +3 -3
- package/dist/{chunk-B4CWYGCG.mjs → chunk-3OYFMOBY.mjs} +1 -1
- package/dist/{chunk-S3D6SL2V.cjs → chunk-42EUEYW6.cjs} +17 -12
- package/dist/{chunk-D2IAYGYA.mjs → chunk-47R7CX4A.mjs} +6 -6
- package/dist/{chunk-YQWRBBAA.mjs → chunk-4PWGLPL6.mjs} +1 -1
- package/dist/{chunk-7S7AAK2D.mjs → chunk-4QBFYEDC.mjs} +2 -1
- package/dist/{chunk-KMYOKQPP.cjs → chunk-4VLXQ55O.cjs} +27 -22
- package/dist/{chunk-XGJVRPYL.cjs → chunk-52LTENRE.cjs} +3 -3
- package/dist/{chunk-RQ4UZJPR.cjs → chunk-5AMH6AFA.cjs} +5 -3
- package/dist/{chunk-FEQ72ZHD.mjs → chunk-5EEQNZLU.mjs} +6 -6
- package/dist/{chunk-AYP2YFVN.mjs → chunk-5KAEGBIL.mjs} +75 -42
- package/dist/{chunk-IJFNXP3D.cjs → chunk-5QZT2EQN.cjs} +2 -2
- package/dist/{chunk-X2KNHD4B.mjs → chunk-5WFPZG7K.mjs} +8 -8
- package/dist/{chunk-TPDKFRQX.cjs → chunk-62DZHPDK.cjs} +16 -11
- package/dist/{chunk-DTBRSRTR.cjs → chunk-63EFR2WF.cjs} +6 -5
- package/dist/{chunk-2RCCFB2Y.cjs → chunk-6B44ZU5P.cjs} +11 -11
- package/dist/{chunk-ZRCGPSUM.cjs → chunk-6D3CJFNU.cjs} +37 -21
- package/dist/{chunk-FCBUNILW.mjs → chunk-6MNDFNZW.mjs} +4 -4
- package/dist/{chunk-O2A6HE76.cjs → chunk-6ZFGWB75.cjs} +115 -21
- package/dist/{chunk-ACAEFEOH.cjs → chunk-7564NP5Z.cjs} +10 -10
- 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-DRBXYJZ6.mjs → chunk-7FQFK3OA.mjs} +2 -2
- 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-IP2R2TAE.mjs → chunk-A2VFKOQL.mjs} +1 -1
- package/dist/chunk-A3LNXQJJ.cjs +265 -0
- 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-FYV6DTAG.cjs → chunk-BBRSPKFI.cjs} +585 -601
- package/dist/{chunk-R6Q6VSGU.mjs → chunk-BGUTIQII.mjs} +1 -1
- package/dist/{chunk-3OMLZLDE.cjs → chunk-BNCKXPCU.cjs} +44 -0
- package/dist/{chunk-BPAXGCKX.mjs → chunk-BRNPLD22.mjs} +30 -17
- package/dist/{chunk-35GBGSQZ.cjs → chunk-BYJPBJ4E.cjs} +3 -3
- package/dist/{chunk-V6T3UJAH.cjs → chunk-CCQZDOQR.cjs} +17 -17
- package/dist/{chunk-JZGL2PIH.mjs → chunk-CDT7CGQT.mjs} +2 -2
- package/dist/{chunk-BNXV3PRM.mjs → chunk-CF74ABRI.mjs} +10 -10
- package/dist/chunk-CIY74JLV.cjs +134 -0
- package/dist/{chunk-JI6N4W2I.mjs → chunk-CKBBKRBO.mjs} +840 -228
- package/dist/{chunk-IZ5WOTQP.mjs → chunk-CLM73YYD.mjs} +2 -2
- package/dist/{chunk-FGXSWRWA.mjs → chunk-CSAIIMY3.mjs} +1 -1
- package/dist/{chunk-EF5AP4CV.cjs → chunk-CYNQPKA4.cjs} +2 -2
- package/dist/{chunk-M53MIIXY.mjs → chunk-CZOXZ6WQ.mjs} +1 -1
- package/dist/{chunk-ROPMQNCG.mjs → chunk-DASQJ5UD.mjs} +2 -2
- package/dist/{chunk-BWFBTTJ5.cjs → chunk-DD22NQFX.cjs} +2 -2
- package/dist/{chunk-56HHUSR5.cjs → chunk-DTNWLRRF.cjs} +1308 -696
- package/dist/{chunk-AL6E63FZ.mjs → chunk-DUSTJ6A5.mjs} +20 -17
- package/dist/{chunk-BUC3FDYC.cjs → chunk-DVW6SKHA.cjs} +2 -2
- package/dist/{chunk-EWIEJQP6.cjs → chunk-DZ3AZ7UK.cjs} +52 -52
- package/dist/{chunk-6YFC3ZFX.mjs → chunk-DZXD6CYJ.mjs} +1 -1
- package/dist/{chunk-BIX46FTI.mjs → chunk-E77ZKNPN.mjs} +10 -2
- package/dist/{chunk-Q4G52OSW.mjs → chunk-EMTN5ABC.mjs} +1 -1
- package/dist/{chunk-GK2GBIXD.mjs → chunk-ERT6HQAI.mjs} +8 -3
- package/dist/{chunk-ZLRWO5GK.mjs → chunk-F35C3TJZ.mjs} +1 -1
- package/dist/{chunk-F244KE2D.cjs → chunk-F4ID7BGO.cjs} +33 -30
- package/dist/{chunk-C7GJDVN4.mjs → chunk-F7MJWW6A.mjs} +1 -1
- package/dist/{chunk-WTTJ2YS2.mjs → chunk-FCAYYLAE.mjs} +18 -2
- 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-GRHSQYD4.cjs → chunk-G7B6NU4X.cjs} +11 -11
- package/dist/{chunk-E4T7WJJN.mjs → chunk-GAAK3HDZ.mjs} +28 -7
- package/dist/{chunk-QMNWKQL4.cjs → chunk-GC5ROI3A.cjs} +4 -4
- package/dist/{chunk-JXIYH2NO.cjs → chunk-GCJ4GNMC.cjs} +4 -4
- package/dist/{chunk-KNEYWPZV.mjs → chunk-GFXKO4UW.mjs} +42 -10
- package/dist/{chunk-GUZC226X.mjs → chunk-GLVDXRG2.mjs} +1 -1
- package/dist/{chunk-JZ43UD6S.mjs → chunk-GP5BWTO7.mjs} +13 -13
- package/dist/{chunk-OWQV6MLM.cjs → chunk-GYJT2U7J.cjs} +2 -1
- package/dist/{chunk-LHFGTR7F.mjs → chunk-H76C5AOU.mjs} +104 -10
- package/dist/{chunk-XZPI44Q7.cjs → chunk-H7OFZJCV.cjs} +8 -8
- package/dist/{chunk-2TZ3F6TN.cjs → chunk-HFJLMALC.cjs} +25 -25
- package/dist/{chunk-NET6PBUH.cjs → chunk-HKGU2X4I.cjs} +2 -2
- package/dist/{chunk-CROAFCMW.mjs → chunk-HONTCUK6.mjs} +1 -1
- package/dist/{chunk-7PJARAQQ.mjs → chunk-HQ2VAJLW.mjs} +1 -1
- package/dist/{chunk-FN5UEC7I.mjs → chunk-IG2JE6WJ.mjs} +1 -1
- package/dist/{chunk-MQ4DYVFS.cjs → chunk-IIHZ2BEE.cjs} +3 -3
- package/dist/{chunk-FNWL5DMG.cjs → chunk-IXO6O2EL.cjs} +6 -6
- package/dist/{chunk-B5WZP3T3.cjs → chunk-IYFBLWXU.cjs} +41 -23
- package/dist/{chunk-R4BWNP73.mjs → chunk-JA6RML7C.mjs} +3 -3
- package/dist/{chunk-JSUVQ5HG.cjs → chunk-JHZ6HULQ.cjs} +12 -9
- package/dist/{chunk-UHAARKF3.mjs → chunk-JL6XHQZF.mjs} +5 -5
- package/dist/{chunk-KWUZJZ23.mjs → chunk-JRBWBMP2.mjs} +4 -3
- package/dist/{chunk-YH33PZ3K.mjs → chunk-K6DXKHFE.mjs} +1 -1
- package/dist/{chunk-AXVRUDMB.cjs → chunk-K6PGK7DC.cjs} +2 -2
- package/dist/{chunk-72NTEYCX.mjs → chunk-KHS3T3E5.mjs} +15 -10
- package/dist/{chunk-J42QN7OC.cjs → chunk-KQS27YN7.cjs} +6 -6
- package/dist/{chunk-KUMKBBYP.mjs → chunk-KUXEII7V.mjs} +1 -1
- package/dist/{chunk-CA7DNRHO.cjs → chunk-L6E5BSNU.cjs} +3 -3
- package/dist/{chunk-47ZDUDN5.cjs → chunk-L7Y65BQU.cjs} +64 -32
- package/dist/{chunk-OSKIG4OP.mjs → chunk-LPXJEZJK.mjs} +30 -14
- package/dist/{chunk-CF77L6RL.mjs → chunk-LQBV2Y37.mjs} +4 -4
- package/dist/{chunk-HK4VJI27.cjs → chunk-LQWIIBI2.cjs} +11 -1
- package/dist/{chunk-YTVSWXEZ.cjs → chunk-ML4TOUZP.cjs} +76 -43
- package/dist/{chunk-6JEXH7N6.mjs → chunk-MOS2N377.mjs} +1 -1
- package/dist/{chunk-ZD7JUTBY.mjs → chunk-NLATR3T3.mjs} +2 -2
- package/dist/{chunk-3BUJIPKE.cjs → chunk-NSNQLBHR.cjs} +2 -2
- package/dist/chunk-NUWUEXUD.mjs +55 -0
- package/dist/{chunk-WS4SLJW5.mjs → chunk-O225GNEU.mjs} +186 -202
- 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-CXQZQK6R.mjs → chunk-OVUU2RCQ.mjs} +2 -2
- package/dist/{chunk-65OS2TOT.cjs → chunk-OWO7KDZ3.cjs} +34 -34
- package/dist/{chunk-HBLYSWIJ.cjs → chunk-PBJ7MEOV.cjs} +9 -9
- package/dist/{chunk-RBRIKT6B.mjs → chunk-PDACTAVX.mjs} +3 -3
- package/dist/{chunk-AO5IRA2N.mjs → chunk-PE2LEWXA.mjs} +6 -3
- package/dist/{chunk-VZKCGHWC.cjs → chunk-PG7J7XYT.cjs} +6 -6
- package/dist/{chunk-MMK4MZUN.mjs → chunk-PKXGFQZS.mjs} +1 -1
- package/dist/{chunk-NKETXVKP.mjs → chunk-PL7MCYYD.mjs} +32 -14
- package/dist/{chunk-P3EZKU6L.cjs → chunk-PSNYVBWC.cjs} +38 -38
- package/dist/chunk-PWHF2C6A.mjs +134 -0
- package/dist/{chunk-77SVUQM5.cjs → chunk-PXXG5BID.cjs} +10 -10
- package/dist/{chunk-JWHRVBCZ.cjs → chunk-Q2EKSSEG.cjs} +21 -21
- package/dist/{chunk-TJVUTGED.mjs → chunk-Q4X3MX4J.mjs} +201 -3
- package/dist/{chunk-XXKMAHYE.mjs → chunk-Q7JMHO5U.mjs} +2 -2
- package/dist/{chunk-EHJOSIXM.cjs → chunk-QDHR54S6.cjs} +11 -11
- package/dist/{chunk-ZOYKJBP5.cjs → chunk-QKW6DLDT.cjs} +2 -2
- package/dist/{chunk-NXGQIXR7.cjs → chunk-QP4GYVRR.cjs} +313 -156
- package/dist/{chunk-3ODLJRA6.mjs → chunk-QSLGE2ZC.mjs} +1 -1
- package/dist/{chunk-ENYBDM4U.cjs → chunk-QTDIOZV6.cjs} +15 -7
- package/dist/{chunk-FSODPZRT.cjs → chunk-QUEYL2WM.cjs} +10 -10
- package/dist/{chunk-ZDAEHG2O.cjs → chunk-QYOAGT3E.cjs} +3 -3
- package/dist/{chunk-VKLV7GF4.mjs → chunk-R5X7FDOG.mjs} +1 -1
- package/dist/{chunk-O47W53D3.cjs → chunk-RDADQG5S.cjs} +7 -77
- package/dist/chunk-RDSHEHBA.mjs +82 -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-MUITBU5Z.mjs → chunk-S7QEQCVV.mjs} +2 -2
- package/dist/{chunk-HKZVC5GP.cjs → chunk-SFSTZ7TB.cjs} +8 -8
- package/dist/{chunk-VFPFXMTF.mjs → chunk-SGQXJVFX.mjs} +1 -1
- package/dist/{chunk-ZZGANFQH.cjs → chunk-SX535SU5.cjs} +12 -12
- package/dist/{chunk-NLBK37HI.cjs → chunk-SXXSQVKK.cjs} +4 -4
- package/dist/{chunk-ELJQWUAR.mjs → chunk-SYPEMXW2.mjs} +2 -2
- package/dist/{chunk-D4TYE6MY.cjs → chunk-TMVVBK5S.cjs} +2 -2
- package/dist/{chunk-BSJMWCWM.cjs → chunk-TZ2YPXLB.cjs} +7 -7
- package/dist/{chunk-JMYXO572.cjs → chunk-UBXNTZCY.cjs} +205 -7
- package/dist/{chunk-OEL5EPOJ.mjs → chunk-UD6KTSJS.mjs} +6 -76
- package/dist/{chunk-2EVESLP3.mjs → chunk-UJIBSFUE.mjs} +4 -4
- package/dist/chunk-UNOXV37V.cjs +55 -0
- package/dist/{chunk-H2ZJ35NW.mjs → chunk-UOE6ZZZP.mjs} +1 -1
- package/dist/{chunk-O6K4G7YA.mjs → chunk-URQW27KO.mjs} +10 -5
- package/dist/{chunk-B3XY6FMC.mjs → chunk-VDJ3CLBR.mjs} +3 -3
- package/dist/chunk-VDQZV6BX.mjs +17 -0
- package/dist/{chunk-2DOI6HLJ.cjs → chunk-VJ6L7TII.cjs} +3 -3
- package/dist/{chunk-QL3YZTGZ.cjs → chunk-VJI2LWTL.cjs} +2 -2
- package/dist/{chunk-7RKHXF4P.mjs → chunk-WGNGM6MJ.mjs} +2 -2
- package/dist/{chunk-DM2YGTRH.cjs → chunk-WILPJVQE.cjs} +23 -23
- package/dist/{chunk-4AB62NMW.cjs → chunk-WJDMH3E7.cjs} +4 -4
- package/dist/chunk-WKVYF2B5.cjs +17 -0
- package/dist/{chunk-737MIVX3.cjs → chunk-WMJQNVKX.cjs} +24 -24
- package/dist/{chunk-MKQ27TGW.cjs → chunk-WRWJ7IWT.cjs} +7 -7
- package/dist/{chunk-Y4FEQBKY.cjs → chunk-WW62HKA2.cjs} +47 -26
- package/dist/{chunk-IG4IQMIW.mjs → chunk-X3HUT4JU.mjs} +1 -1
- package/dist/{chunk-XVSBALOY.cjs → chunk-X3Y6JWJG.cjs} +3 -3
- package/dist/{chunk-RSL3YFJG.cjs → chunk-XLOORES5.cjs} +1 -1
- package/dist/{chunk-LIQJYEQP.cjs → chunk-XRFGOYXG.cjs} +4 -4
- 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-YWDRWG4L.mjs → chunk-YHE7HH2I.mjs} +875 -452
- package/dist/{chunk-G7S6XG6X.cjs → chunk-YN7G22MP.cjs} +6 -6
- package/dist/{chunk-4MU4QCX4.mjs → chunk-YONTMPZ6.mjs} +1 -1
- package/dist/{chunk-AU5UPNOD.mjs → chunk-YQXJY7E7.mjs} +3 -3
- package/dist/{chunk-VKRMO3EZ.cjs → chunk-YRXPDKMM.cjs} +10 -10
- package/dist/{chunk-QDWMCFTH.mjs → chunk-YT2ZMLXK.mjs} +1 -1
- package/dist/{chunk-EMRYJG4U.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-MQ5HA7H2.mjs → chunk-Z2FFLTF5.mjs} +3 -3
- package/dist/{chunk-JSDV2NUN.mjs → chunk-Z3QXQN4U.mjs} +1 -1
- package/dist/{chunk-HRQV5Q3J.mjs → chunk-Z4IRG4RG.mjs} +96 -9
- package/dist/{chunk-JOECBGY7.mjs → chunk-ZEWWZJPZ.mjs} +3 -1
- package/dist/{chunk-2GQBBOFH.mjs → chunk-ZIAWO6BC.mjs} +11 -1
- package/dist/{chunk-WH3PBJS7.cjs → chunk-ZIOFRBIU.cjs} +100 -13
- package/dist/{chunk-3OJNNCDL.cjs → chunk-ZNXU4E6A.cjs} +8 -8
- package/dist/{chunk-KIRIFO6T.mjs → chunk-ZO6TOLHL.mjs} +44 -0
- package/dist/cli-runtime.d-D84CwyPI.d.ts +535 -0
- package/dist/cli-runtime.d-OQY2pgwK.d.mts +535 -0
- package/dist/client/lifecycle.d.mts +1 -1
- package/dist/client/lifecycle.d.ts +1 -1
- package/dist/{client-component.d-DYOwmq0c.d.ts → client-component.d-Bf8jZqW7.d.ts} +2 -137
- package/dist/{client-component.d-edV76QvU.d.mts → client-component.d-Bh6CfC5z.d.mts} +2 -137
- package/dist/{client-plugins.d-BmJYW2FY.d.ts → client-plugins.d-DuujrC8d.d.ts} +27 -6
- package/dist/{client-plugins.d-DwvqqGsU.d.mts → client-plugins.d-r3K2oQ6w.d.mts} +27 -6
- package/dist/client-plugins.d.mts +7 -5
- package/dist/client-plugins.d.ts +7 -5
- package/dist/client.cjs +15 -13
- package/dist/client.d.mts +12 -10
- package/dist/client.d.ts +12 -10
- package/dist/client.mjs +14 -12
- package/dist/config.d.mts +7 -5
- package/dist/config.d.ts +7 -5
- package/dist/cron.cjs +4 -4
- package/dist/cron.mjs +3 -3
- package/dist/desktop.d.mts +8 -6
- package/dist/desktop.d.ts +8 -6
- package/dist/{devtools-YMDS7PUA.cjs → devtools-3WZIZ7KK.cjs} +20 -20
- package/dist/{devtools-WPX62NG2.mjs → devtools-MBZPUH3U.mjs} +18 -18
- package/dist/docs.cjs +27 -21
- package/dist/docs.d.mts +15 -56
- package/dist/docs.d.ts +15 -56
- package/dist/docs.mjs +26 -20
- package/dist/environment/vite.cjs +6 -6
- package/dist/environment/vite.mjs +5 -5
- package/dist/handler.d-Bd5lRSvb.d.ts +62 -0
- package/dist/handler.d-SRH-AKzf.d.mts +62 -0
- package/dist/headers.cjs +3 -3
- package/dist/{headers.d-BtNxFc2s.d.mts → headers.d-CHHvyaIG.d.mts} +1 -1
- package/dist/{headers.d-BIbQyAxJ.d.ts → headers.d-D-OvGikv.d.ts} +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 +105 -97
- package/dist/index.d-BOPsgMlI.d.mts +16 -0
- package/dist/index.d-BiUtYJUG.d.ts +16 -0
- package/dist/index.d.mts +40 -557
- package/dist/index.d.ts +40 -557
- package/dist/index.mjs +102 -94
- package/dist/integrations/orm.cjs +3 -3
- package/dist/integrations/orm.d.mts +6 -4
- package/dist/integrations/orm.d.ts +6 -4
- package/dist/integrations/orm.mjs +2 -2
- package/dist/integrations.cjs +7 -7
- package/dist/integrations.d.mts +7 -5
- package/dist/integrations.d.ts +7 -5
- package/dist/integrations.mjs +6 -6
- package/dist/internal/app-markdown-runtime.cjs +6 -6
- package/dist/internal/app-markdown-runtime.d.mts +8 -6
- package/dist/internal/app-markdown-runtime.d.ts +8 -6
- package/dist/internal/app-markdown-runtime.mjs +5 -5
- package/dist/internal/build-runtime.cjs +71 -69
- package/dist/internal/build-runtime.d.mts +10 -7
- package/dist/internal/build-runtime.d.ts +10 -7
- package/dist/internal/build-runtime.mjs +70 -68
- package/dist/internal/cli-runtime.cjs +40 -35
- package/dist/internal/cli-runtime.d.mts +45 -0
- package/dist/internal/cli-runtime.d.ts +45 -0
- package/dist/internal/cli-runtime.mjs +39 -34
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +23 -2
- package/dist/internal/client-runtime.d.mts +36 -13
- package/dist/internal/client-runtime.d.ts +36 -13
- package/dist/internal/client-runtime.mjs +23 -2
- package/dist/internal/compression-runtime.d.mts +7 -5
- package/dist/internal/compression-runtime.d.ts +7 -5
- package/dist/internal/config-runtime.cjs +20 -20
- package/dist/internal/config-runtime.d.mts +9 -7
- package/dist/internal/config-runtime.d.ts +9 -7
- package/dist/internal/config-runtime.mjs +19 -19
- package/dist/internal/form-actions.cjs +6 -6
- package/dist/internal/form-actions.mjs +5 -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 +65 -42
- package/dist/internal/production-runtime.d.mts +86 -17
- package/dist/internal/production-runtime.d.ts +86 -17
- package/dist/internal/production-runtime.mjs +68 -45
- 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 +45 -0
- package/dist/internal/start-manifest.d.ts +45 -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-OtGWAvJT.d.mts → lifecycle.d-VzcXyEyn.d.mts} +1 -1
- package/dist/{lifecycle.d-OtGWAvJT.d.ts → lifecycle.d-VzcXyEyn.d.ts} +1 -1
- package/dist/manager-R7FV4A56.cjs +18 -0
- package/dist/{manager-RHB2P35B.mjs → manager-YO2RHDYU.mjs} +5 -5
- package/dist/markdown.cjs +5 -5
- package/dist/markdown.d.mts +7 -5
- package/dist/markdown.d.ts +7 -5
- package/dist/markdown.mjs +4 -4
- package/dist/middleware.cjs +14 -14
- package/dist/middleware.d.mts +7 -5
- package/dist/middleware.d.ts +7 -5
- package/dist/middleware.mjs +13 -13
- package/dist/{mount.d-C-u7rFkM.d.ts → mount.d-C2yq0Zzz.d.ts} +1 -1
- package/dist/{mount.d-6bhpBQQB.d.mts → mount.d-vq1HTq5u.d.mts} +1 -1
- package/dist/{native-server-fn-handler-W4FSD76W.cjs → native-server-fn-handler-IWNKQEXK.cjs} +9 -8
- package/dist/{native-server-fn-handler-I66X4E5S.mjs → native-server-fn-handler-LII4MDRR.mjs} +8 -7
- package/dist/native-tree-D3PW64ZL.cjs +28 -0
- package/dist/{native-tree-3X23BT3N.mjs → native-tree-G6ZWS7IR.mjs} +5 -5
- package/dist/{navigation-delegate.d-xsG4T1x-.d.ts → navigation-delegate.d-D7xIin3i.d.ts} +1 -1
- package/dist/{navigation-delegate.d-nx6gtsY4.d.mts → navigation-delegate.d-DS2Sqm7E.d.mts} +1 -1
- package/dist/navigation.cjs +13 -11
- package/dist/navigation.d.mts +10 -8
- package/dist/navigation.d.ts +10 -8
- package/dist/navigation.mjs +12 -10
- package/dist/{nitro-SSFTPZMW.cjs → nitro-HKMVYIXY.cjs} +13 -13
- package/dist/{nitro-XTQ2HKDL.mjs → nitro-RHLKLYXH.mjs} +8 -8
- package/dist/{plugin-QZT747YW.mjs → plugin-6CHZBFJD.mjs} +2 -2
- package/dist/{plugin-5PIQQVRP.cjs → plugin-YXPIS3XX.cjs} +3 -3
- package/dist/plugin.cjs +64 -62
- package/dist/plugin.d.mts +11 -8
- package/dist/plugin.d.ts +11 -8
- package/dist/plugin.mjs +63 -61
- package/dist/query/client.cjs +20 -9
- package/dist/query/client.mjs +16 -5
- package/dist/{render-plan.d-gW0fwKz2.d.ts → render-plan.d-BCq0nfdw.d.ts} +1 -1
- package/dist/{render-plan.d-B5y3h97B.d.mts → render-plan.d-X6KqerAM.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 +10 -8
- package/dist/renderer-client.d.ts +10 -8
- package/dist/renderer-client.mjs +15 -16
- package/dist/request.cjs +2 -2
- package/dist/{request.d-B0ugAadD.d.ts → request.d-Be9rWboC.d.mts} +7 -2
- package/dist/{request.d-DLq33nYo.d.mts → request.d-CPdq2_kC.d.ts} +7 -2
- package/dist/request.d.mts +8 -6
- package/dist/request.d.ts +8 -6
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering.d-DSeIV7yV.d.mts → route-rendering.d-CIPli7Ve.d.mts} +1 -1
- package/dist/{route-rendering.d-ytaqDQD6.d.ts → route-rendering.d-CKB5GhQr.d.ts} +1 -1
- package/dist/router.cjs +4 -4
- package/dist/{router.d-BaEAEGPg.d.ts → router.d-CvrbOXzF.d.ts} +1 -1
- package/dist/{router.d-Chd5cpe3.d.mts → router.d-VxTgLGxN.d.mts} +1 -1
- package/dist/router.mjs +3 -3
- package/dist/routes.cjs +6 -6
- package/dist/routes.d.mts +7 -5
- package/dist/routes.d.ts +7 -5
- package/dist/routes.mjs +5 -5
- package/dist/{rsc-pipeline-DPMYONEV.mjs → rsc-pipeline-FPE4OL57.mjs} +22 -22
- package/dist/{rsc-pipeline-XIUUMMG5.cjs → rsc-pipeline-TPHK74VE.cjs} +23 -23
- package/dist/{runtime-XIUJZTZ3.mjs → runtime-45BD33OJ.mjs} +27 -27
- package/dist/{runtime-WD77S3C5.cjs → runtime-UBG657UC.cjs} +38 -38
- package/dist/{runtime.d-DpCs0eAO.d.mts → runtime.d-Cn1jiDNI.d.mts} +1 -1
- package/dist/{runtime.d-h2USyQsz.d.ts → runtime.d-Ps54JWpo.d.ts} +1 -1
- 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/{schema.d-Dny9pnrm.d.mts → schema.d-BM-uVGpx.d.mts} +1 -1
- package/dist/{schema.d-Dny9pnrm.d.ts → schema.d-BM-uVGpx.d.ts} +1 -1
- package/dist/schema.d.mts +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/server-action-security.cjs +5 -5
- package/dist/server-action-security.mjs +4 -4
- package/dist/{index.d-CQ_wUzOV.d.ts → server-components-status.d-Dhtbs5lC.d.ts} +2 -15
- package/dist/{index.d-CQdDRXd1.d.mts → server-components-status.d-DnmipSb3.d.mts} +2 -15
- package/dist/server-fn.cjs +8 -7
- package/dist/server-fn.mjs +7 -6
- package/dist/server-plugins.cjs +7 -7
- package/dist/server-plugins.d.mts +9 -7
- package/dist/server-plugins.d.ts +9 -7
- package/dist/server-plugins.mjs +6 -6
- package/dist/server-query.cjs +9 -8
- package/dist/server-query.mjs +8 -7
- package/dist/server.cjs +107 -98
- package/dist/server.d.mts +20 -17
- package/dist/server.d.ts +20 -17
- package/dist/server.mjs +78 -69
- package/dist/session-ACVUJ5XV.cjs +23 -0
- package/dist/{session-QZXZOPR2.mjs → session-ASQTJNBK.mjs} +2 -2
- package/dist/{spa-router.d-DCQVtEaE.d.mts → spa-router.d-DXm5J9rM.d.mts} +4 -3
- package/dist/{spa-router.d-DpdJHs1q.d.ts → spa-router.d-cppVufl2.d.ts} +4 -3
- package/dist/ssg.d-CI5OFl8H.d.ts +138 -0
- package/dist/ssg.d-Duzy1wQc.d.mts +138 -0
- package/dist/storage.cjs +4 -2
- package/dist/storage.d.mts +14 -4
- package/dist/storage.d.ts +14 -4
- package/dist/storage.mjs +3 -1
- package/dist/testing.cjs +31 -31
- package/dist/testing.d.mts +7 -5
- package/dist/testing.d.ts +7 -5
- package/dist/testing.mjs +23 -23
- package/dist/theme/server.cjs +3 -3
- package/dist/theme/server.mjs +2 -2
- package/dist/{types.d-BnIqOn9w.d.ts → types.d-D5cY6XjK.d.mts} +43 -2
- package/dist/{types.d-BnIqOn9w.d.mts → types.d-D5cY6XjK.d.ts} +43 -2
- package/dist/{utils.d-DKDZtAY5.d.mts → utils.d-CNI-I8ZV.d.mts} +1 -1
- package/dist/{utils.d-DmicwMvS.d.ts → utils.d-D3dfy8zh.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +64 -62
- package/dist/vite.d.mts +17 -9
- package/dist/vite.d.ts +17 -9
- package/dist/vite.mjs +63 -61
- package/dist/workflows.cjs +7 -7
- package/dist/workflows.mjs +6 -6
- package/package.json +27 -3
- package/dist/analyzer-6EOYURMV.cjs +0 -16
- package/dist/chunk-D4XGKF67.cjs +0 -127
- 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-S77ZARTC.cjs +0 -18
- package/dist/native-tree-TAPKR7QJ.cjs +0 -28
- package/dist/session-2Q72D4QV.cjs +0 -23
- /package/dist/{chunk-PMU4U2W2.cjs → chunk-22T75EML.cjs} +0 -0
- /package/dist/{chunk-Z5ZZAGIH.mjs → chunk-LSHUCNIF.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQTDIOZV6cjs = require('./chunk-QTDIOZV6.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
|
|
@@ -9,10 +9,9 @@ var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk7564NP5Zcjs = require('./chunk-7564NP5Z.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var _chunkAXVRUDMBcjs = require('./chunk-AXVRUDMB.cjs');
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
|
|
@@ -42,33 +41,34 @@ var _chunkAXVRUDMBcjs = require('./chunk-AXVRUDMB.cjs');
|
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
var _chunkO2A6HE76cjs = require('./chunk-O2A6HE76.cjs');
|
|
46
44
|
|
|
47
45
|
|
|
48
|
-
var _chunkDM2YGTRHcjs = require('./chunk-DM2YGTRH.cjs');
|
|
49
46
|
|
|
50
47
|
|
|
48
|
+
var _chunk6ZFGWB75cjs = require('./chunk-6ZFGWB75.cjs');
|
|
51
49
|
|
|
52
50
|
|
|
51
|
+
var _chunkWILPJVQEcjs = require('./chunk-WILPJVQE.cjs');
|
|
53
52
|
|
|
54
53
|
|
|
55
54
|
|
|
56
|
-
var _chunkVKRMO3EZcjs = require('./chunk-VKRMO3EZ.cjs');
|
|
57
55
|
|
|
58
56
|
|
|
59
57
|
|
|
60
58
|
|
|
61
|
-
var
|
|
59
|
+
var _chunkYRXPDKMMcjs = require('./chunk-YRXPDKMM.cjs');
|
|
62
60
|
|
|
63
61
|
|
|
62
|
+
var _chunkK6PGK7DCcjs = require('./chunk-K6PGK7DC.cjs');
|
|
64
63
|
|
|
65
|
-
var _chunkXGJVRPYLcjs = require('./chunk-XGJVRPYL.cjs');
|
|
66
64
|
|
|
67
65
|
|
|
68
66
|
|
|
67
|
+
var _chunkPBJ7MEOVcjs = require('./chunk-PBJ7MEOV.cjs');
|
|
69
68
|
|
|
70
69
|
|
|
71
70
|
|
|
71
|
+
var _chunk52LTENREcjs = require('./chunk-52LTENRE.cjs');
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
|
|
@@ -86,14 +86,23 @@ var _chunkXGJVRPYLcjs = require('./chunk-XGJVRPYL.cjs');
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
var _chunkQP4GYVRRcjs = require('./chunk-QP4GYVRR.cjs');
|
|
90
99
|
|
|
91
100
|
|
|
92
101
|
var _chunk7KJJ4SBScjs = require('./chunk-7KJJ4SBS.cjs');
|
|
93
102
|
|
|
94
103
|
|
|
95
104
|
|
|
96
|
-
var
|
|
105
|
+
var _chunk5AMH6AFAcjs = require('./chunk-5AMH6AFA.cjs');
|
|
97
106
|
|
|
98
107
|
|
|
99
108
|
var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
|
|
@@ -103,7 +112,7 @@ var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
|
|
|
103
112
|
var _chunkUVV3I5QAcjs = require('./chunk-UVV3I5QA.cjs');
|
|
104
113
|
|
|
105
114
|
|
|
106
|
-
var
|
|
115
|
+
var _chunkIIHZ2BEEcjs = require('./chunk-IIHZ2BEE.cjs');
|
|
107
116
|
|
|
108
117
|
|
|
109
118
|
var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
|
|
@@ -113,7 +122,7 @@ var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
|
|
|
113
122
|
|
|
114
123
|
|
|
115
124
|
|
|
116
|
-
var
|
|
125
|
+
var _chunkF4ID7BGOcjs = require('./chunk-F4ID7BGO.cjs');
|
|
117
126
|
|
|
118
127
|
|
|
119
128
|
|
|
@@ -123,7 +132,7 @@ var _chunkF244KE2Dcjs = require('./chunk-F244KE2D.cjs');
|
|
|
123
132
|
|
|
124
133
|
|
|
125
134
|
|
|
126
|
-
var
|
|
135
|
+
var _chunkWRWJ7IWTcjs = require('./chunk-WRWJ7IWT.cjs');
|
|
127
136
|
|
|
128
137
|
|
|
129
138
|
|
|
@@ -157,17 +166,17 @@ var _chunk67MZTLTFcjs = require('./chunk-67MZTLTF.cjs');
|
|
|
157
166
|
var _chunkMCSRMEQVcjs = require('./chunk-MCSRMEQV.cjs');
|
|
158
167
|
|
|
159
168
|
|
|
160
|
-
var
|
|
169
|
+
var _chunkCYNQPKA4cjs = require('./chunk-CYNQPKA4.cjs');
|
|
161
170
|
|
|
162
171
|
|
|
163
|
-
var
|
|
172
|
+
var _chunkXRFGOYXGcjs = require('./chunk-XRFGOYXG.cjs');
|
|
164
173
|
|
|
165
174
|
|
|
166
175
|
|
|
167
|
-
var
|
|
176
|
+
var _chunk5QZT2EQNcjs = require('./chunk-5QZT2EQN.cjs');
|
|
168
177
|
|
|
169
178
|
|
|
170
|
-
var
|
|
179
|
+
var _chunkPG7J7XYTcjs = require('./chunk-PG7J7XYT.cjs');
|
|
171
180
|
|
|
172
181
|
|
|
173
182
|
|
|
@@ -180,10 +189,10 @@ var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
|
|
|
180
189
|
|
|
181
190
|
|
|
182
191
|
|
|
183
|
-
var
|
|
192
|
+
var _chunk2YJ4DHTDcjs = require('./chunk-2YJ4DHTD.cjs');
|
|
184
193
|
|
|
185
194
|
|
|
186
|
-
var
|
|
195
|
+
var _chunkQUEYL2WMcjs = require('./chunk-QUEYL2WM.cjs');
|
|
187
196
|
|
|
188
197
|
|
|
189
198
|
var _chunkWT6RAN2Icjs = require('./chunk-WT6RAN2I.cjs');
|
|
@@ -191,10 +200,10 @@ var _chunkWT6RAN2Icjs = require('./chunk-WT6RAN2I.cjs');
|
|
|
191
200
|
|
|
192
201
|
|
|
193
202
|
|
|
194
|
-
var
|
|
203
|
+
var _chunkOWO7KDZ3cjs = require('./chunk-OWO7KDZ3.cjs');
|
|
195
204
|
|
|
196
205
|
|
|
197
|
-
var
|
|
206
|
+
var _chunkUBXNTZCYcjs = require('./chunk-UBXNTZCY.cjs');
|
|
198
207
|
|
|
199
208
|
|
|
200
209
|
|
|
@@ -202,7 +211,7 @@ var _chunkX333W5KVcjs = require('./chunk-X333W5KV.cjs');
|
|
|
202
211
|
|
|
203
212
|
|
|
204
213
|
|
|
205
|
-
var
|
|
214
|
+
var _chunkQYOAGT3Ecjs = require('./chunk-QYOAGT3E.cjs');
|
|
206
215
|
|
|
207
216
|
|
|
208
217
|
|
|
@@ -212,13 +221,13 @@ var _chunkYDXLC4DWcjs = require('./chunk-YDXLC4DW.cjs');
|
|
|
212
221
|
|
|
213
222
|
|
|
214
223
|
|
|
215
|
-
var
|
|
224
|
+
var _chunkYTNE4KGCcjs = require('./chunk-YTNE4KGC.cjs');
|
|
216
225
|
|
|
217
226
|
|
|
218
227
|
|
|
219
228
|
|
|
220
229
|
|
|
221
|
-
var
|
|
230
|
+
var _chunkSXXSQVKKcjs = require('./chunk-SXXSQVKK.cjs');
|
|
222
231
|
|
|
223
232
|
|
|
224
233
|
|
|
@@ -229,7 +238,7 @@ var _chunkKORZ6PREcjs = require('./chunk-KORZ6PRE.cjs');
|
|
|
229
238
|
|
|
230
239
|
|
|
231
240
|
|
|
232
|
-
var
|
|
241
|
+
var _chunkYUCU6XB4cjs = require('./chunk-YUCU6XB4.cjs');
|
|
233
242
|
|
|
234
243
|
|
|
235
244
|
|
|
@@ -241,7 +250,7 @@ var _chunkIUKBPBM7cjs = require('./chunk-IUKBPBM7.cjs');
|
|
|
241
250
|
|
|
242
251
|
|
|
243
252
|
|
|
244
|
-
var
|
|
253
|
+
var _chunkBNCKXPCUcjs = require('./chunk-BNCKXPCU.cjs');
|
|
245
254
|
|
|
246
255
|
|
|
247
256
|
var _chunkJRGR5Z4Kcjs = require('./chunk-JRGR5Z4K.cjs');
|
|
@@ -250,7 +259,7 @@ var _chunkJRGR5Z4Kcjs = require('./chunk-JRGR5Z4K.cjs');
|
|
|
250
259
|
var _chunkSNP33A33cjs = require('./chunk-SNP33A33.cjs');
|
|
251
260
|
|
|
252
261
|
|
|
253
|
-
var
|
|
262
|
+
var _chunk25JGHAGHcjs = require('./chunk-25JGHAGH.cjs');
|
|
254
263
|
|
|
255
264
|
|
|
256
265
|
var _chunkZMSVKVI3cjs = require('./chunk-ZMSVKVI3.cjs');
|
|
@@ -267,7 +276,7 @@ var _chunkZMSVKVI3cjs = require('./chunk-ZMSVKVI3.cjs');
|
|
|
267
276
|
|
|
268
277
|
|
|
269
278
|
|
|
270
|
-
var
|
|
279
|
+
var _chunkGC5ROI3Acjs = require('./chunk-GC5ROI3A.cjs');
|
|
271
280
|
|
|
272
281
|
|
|
273
282
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
@@ -275,7 +284,7 @@ var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
|
275
284
|
|
|
276
285
|
|
|
277
286
|
|
|
278
|
-
var
|
|
287
|
+
var _chunk7Q7UB4TLcjs = require('./chunk-7Q7UB4TL.cjs');
|
|
279
288
|
|
|
280
289
|
|
|
281
290
|
var _chunkJYT7AN37cjs = require('./chunk-JYT7AN37.cjs');
|
|
@@ -289,14 +298,13 @@ var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
|
|
|
289
298
|
var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
|
|
290
299
|
|
|
291
300
|
|
|
292
|
-
var
|
|
301
|
+
var _chunkXLOORES5cjs = require('./chunk-XLOORES5.cjs');
|
|
293
302
|
|
|
294
303
|
|
|
295
|
-
var
|
|
296
|
-
|
|
304
|
+
var _chunkWKVYF2B5cjs = require('./chunk-WKVYF2B5.cjs');
|
|
297
305
|
|
|
298
306
|
|
|
299
|
-
var
|
|
307
|
+
var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
|
|
300
308
|
|
|
301
309
|
|
|
302
310
|
var _chunkRWR7SMD7cjs = require('./chunk-RWR7SMD7.cjs');
|
|
@@ -308,7 +316,7 @@ var _chunkRWR7SMD7cjs = require('./chunk-RWR7SMD7.cjs');
|
|
|
308
316
|
|
|
309
317
|
|
|
310
318
|
|
|
311
|
-
var
|
|
319
|
+
var _chunkY3DO7BIJcjs = require('./chunk-Y3DO7BIJ.cjs');
|
|
312
320
|
|
|
313
321
|
|
|
314
322
|
|
|
@@ -323,6 +331,10 @@ var _chunkNLBHLPEOcjs = require('./chunk-NLBHLPEO.cjs');
|
|
|
323
331
|
|
|
324
332
|
|
|
325
333
|
|
|
334
|
+
var _chunk7Q2YWZF7cjs = require('./chunk-7Q2YWZF7.cjs');
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
326
338
|
var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
|
|
327
339
|
|
|
328
340
|
|
|
@@ -332,7 +344,7 @@ var _chunkDXUXQP2Tcjs = require('./chunk-DXUXQP2T.cjs');
|
|
|
332
344
|
var _chunkHXNLKCWHcjs = require('./chunk-HXNLKCWH.cjs');
|
|
333
345
|
|
|
334
346
|
|
|
335
|
-
var
|
|
347
|
+
var _chunkFDZZ6K3Ncjs = require('./chunk-FDZZ6K3N.cjs');
|
|
336
348
|
|
|
337
349
|
|
|
338
350
|
|
|
@@ -340,7 +352,8 @@ var _chunkPWKAX5MScjs = require('./chunk-PWKAX5MS.cjs');
|
|
|
340
352
|
|
|
341
353
|
|
|
342
354
|
|
|
343
|
-
|
|
355
|
+
|
|
356
|
+
var _chunk2RSVYJT6cjs = require('./chunk-2RSVYJT6.cjs');
|
|
344
357
|
|
|
345
358
|
|
|
346
359
|
|
|
@@ -355,7 +368,7 @@ var _chunk7JUIK547cjs = require('./chunk-7JUIK547.cjs');
|
|
|
355
368
|
|
|
356
369
|
|
|
357
370
|
|
|
358
|
-
var
|
|
371
|
+
var _chunkGYJT2U7Jcjs = require('./chunk-GYJT2U7J.cjs');
|
|
359
372
|
|
|
360
373
|
|
|
361
374
|
|
|
@@ -367,7 +380,7 @@ var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
|
|
|
367
380
|
|
|
368
381
|
|
|
369
382
|
|
|
370
|
-
var
|
|
383
|
+
var _chunkML4TOUZPcjs = require('./chunk-ML4TOUZP.cjs');
|
|
371
384
|
|
|
372
385
|
|
|
373
386
|
var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
|
|
@@ -375,7 +388,7 @@ var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
|
|
|
375
388
|
// src/static-metadata-image.ts
|
|
376
389
|
var _crypto = require('crypto');
|
|
377
390
|
var _promises = require('fs/promises');
|
|
378
|
-
var _path = require('path'); var
|
|
391
|
+
var _path = require('path'); var path4 = _interopRequireWildcard(_path); var path10 = _interopRequireWildcard(_path); var path8 = _interopRequireWildcard(_path);
|
|
379
392
|
var _imagesize = require('image-size');
|
|
380
393
|
var STATIC_METADATA_IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp"];
|
|
381
394
|
var CONTENT_TYPES = {
|
|
@@ -416,13 +429,13 @@ async function inspectStaticMetadataImage(filePath) {
|
|
|
416
429
|
};
|
|
417
430
|
}
|
|
418
431
|
function getStaticMetadataImageAltPath(filePath) {
|
|
419
|
-
return
|
|
420
|
-
|
|
421
|
-
`${
|
|
432
|
+
return path4.default.join(
|
|
433
|
+
path4.default.dirname(filePath),
|
|
434
|
+
`${path4.default.basename(filePath, path4.default.extname(filePath))}.alt.txt`
|
|
422
435
|
);
|
|
423
436
|
}
|
|
424
437
|
function getStaticMetadataImageExtension(filePath) {
|
|
425
|
-
const extension =
|
|
438
|
+
const extension = path4.default.extname(filePath).slice(1).toLowerCase();
|
|
426
439
|
return STATIC_METADATA_IMAGE_EXTENSIONS.includes(extension) ? extension : null;
|
|
427
440
|
}
|
|
428
441
|
async function readAltText(filePath) {
|
|
@@ -438,7 +451,7 @@ async function readAltText(filePath) {
|
|
|
438
451
|
}
|
|
439
452
|
|
|
440
453
|
// src/routing/route-manager.ts
|
|
441
|
-
var _fs = require('fs'); var
|
|
454
|
+
var _fs = require('fs'); var fs2 = _interopRequireWildcard(_fs); var fs7 = _interopRequireWildcard(_fs); var fs5 = _interopRequireWildcard(_fs);
|
|
442
455
|
|
|
443
456
|
function getRouteEntryDirectory(entry) {
|
|
444
457
|
return _nullishCoalesce(entry.directory, () => ( entry.pattern));
|
|
@@ -454,10 +467,23 @@ function getRouteSpecificity(entry) {
|
|
|
454
467
|
});
|
|
455
468
|
}
|
|
456
469
|
function compareRouteEntries(left, right) {
|
|
457
|
-
return
|
|
470
|
+
return _chunkML4TOUZPcjs.compareRouteSpecificity.call(void 0, getRouteSpecificity(left), getRouteSpecificity(right));
|
|
458
471
|
}
|
|
459
472
|
var PLAN_SOURCE = /\.(?:[cm]?[jt]sx?|vue|svelte)$/;
|
|
460
|
-
var NODE_MODULES_SEGMENT = `${
|
|
473
|
+
var NODE_MODULES_SEGMENT = `${path4.default.sep}node_modules${path4.default.sep}`;
|
|
474
|
+
function getInstalledPackageDirectory(file, start) {
|
|
475
|
+
let end = file.indexOf(path4.default.sep, start);
|
|
476
|
+
if (end !== -1 && file[start] === "@") end = file.indexOf(path4.default.sep, end + 1);
|
|
477
|
+
return end === -1 ? file : file.slice(0, end);
|
|
478
|
+
}
|
|
479
|
+
function realPathOutsideNodeModules(target) {
|
|
480
|
+
try {
|
|
481
|
+
const real = fs2.default.realpathSync(target);
|
|
482
|
+
return real.includes(NODE_MODULES_SEGMENT) ? null : real;
|
|
483
|
+
} catch (e) {
|
|
484
|
+
return null;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
461
487
|
var RouteManager = class _RouteManager {
|
|
462
488
|
constructor(config, viteServer) {
|
|
463
489
|
this.routes = /* @__PURE__ */ new Map();
|
|
@@ -473,7 +499,7 @@ var RouteManager = class _RouteManager {
|
|
|
473
499
|
this.redirects = /* @__PURE__ */ new Map();
|
|
474
500
|
this.programmaticPages = /* @__PURE__ */ new Map();
|
|
475
501
|
this.programmaticLayouts = /* @__PURE__ */ new Map();
|
|
476
|
-
this.programmaticClientRoutes =
|
|
502
|
+
this.programmaticClientRoutes = _chunkQP4GYVRRcjs.mergeProgrammaticClientRoutes.call(void 0, []);
|
|
477
503
|
this.discovery = Promise.resolve();
|
|
478
504
|
this.reportedIslandsErrors = /* @__PURE__ */ new Set();
|
|
479
505
|
// Each route module's hydration plan from the last plan, with the source files it read, so a dev
|
|
@@ -485,11 +511,13 @@ var RouteManager = class _RouteManager {
|
|
|
485
511
|
this.planStamps = /* @__PURE__ */ new Map();
|
|
486
512
|
this.sourceChangeTracking = false;
|
|
487
513
|
this.linkedSources = /* @__PURE__ */ new Map();
|
|
514
|
+
// Whether each package directory under `node_modules` a plan read from links to a workspace.
|
|
515
|
+
this.linkedPackages = /* @__PURE__ */ new Map();
|
|
488
516
|
// Source files edited since the last plan; null when the next plan must recompute every module.
|
|
489
517
|
this.editedSources = null;
|
|
490
518
|
this.config = config;
|
|
491
519
|
this.viteServer = viteServer;
|
|
492
|
-
if (viteServer)
|
|
520
|
+
if (viteServer) _chunkYUCU6XB4cjs.trackProgrammaticRouteSources.call(void 0, );
|
|
493
521
|
}
|
|
494
522
|
setRendererRuntime(rendererRuntime) {
|
|
495
523
|
this.rendererRuntime = rendererRuntime;
|
|
@@ -533,10 +561,10 @@ var RouteManager = class _RouteManager {
|
|
|
533
561
|
await this.discoverFileRoutes(source);
|
|
534
562
|
await this.discoverProgrammaticRoutes(source, programmaticClientRoutes);
|
|
535
563
|
}
|
|
536
|
-
this.programmaticClientRoutes =
|
|
564
|
+
this.programmaticClientRoutes = _chunkQP4GYVRRcjs.mergeProgrammaticClientRoutes.call(void 0, programmaticClientRoutes);
|
|
537
565
|
for (const slot of this.routeSlots.values()) {
|
|
538
|
-
if (slot.interception && !this.pageRouteShapes.has(
|
|
539
|
-
throw new (0,
|
|
566
|
+
if (slot.interception && !this.pageRouteShapes.has(_chunkML4TOUZPcjs.getRoutePatternShape.call(void 0, slot.pattern))) {
|
|
567
|
+
throw new (0, _chunkML4TOUZPcjs.AmbiguousRouteError)(
|
|
540
568
|
`Intercepting route slot "${slot.name}" targets "${slot.pattern}", but no canonical page exists for that URL`
|
|
541
569
|
);
|
|
542
570
|
}
|
|
@@ -552,18 +580,18 @@ var RouteManager = class _RouteManager {
|
|
|
552
580
|
)
|
|
553
581
|
);
|
|
554
582
|
this.orderedLayouts = Array.from(this.layouts.values()).sort(
|
|
555
|
-
(left, right) =>
|
|
556
|
-
).map((entry) => ({ entry, groupScope:
|
|
583
|
+
(left, right) => _chunk6ZFGWB75cjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunk6ZFGWB75cjs.getRouteDirectoryDepth.call(void 0, right.pattern)
|
|
584
|
+
).map((entry) => ({ entry, groupScope: _chunk6ZFGWB75cjs.getRouteGroupScope.call(void 0, entry.pattern) }));
|
|
557
585
|
for (const slot of this.routeSlots.values()) {
|
|
558
586
|
if (!this.routeSlotOwnerSegments.has(slot.ownerPattern)) {
|
|
559
587
|
this.routeSlotOwnerSegments.set(
|
|
560
588
|
slot.ownerPattern,
|
|
561
|
-
|
|
589
|
+
_chunkGC5ROI3Acjs.parseRoutePath.call(void 0, `${slot.ownerPattern}/page.tsx`).segments
|
|
562
590
|
);
|
|
563
591
|
}
|
|
564
592
|
}
|
|
565
593
|
if (process.env.FARM_VERBOSE) {
|
|
566
|
-
|
|
594
|
+
_chunkGC5ROI3Acjs.logger.info(
|
|
567
595
|
`Discovered ${this.routes.size} pages, ${this.layouts.size} layouts, and ${this.metadataRoutes.size} metadata routes`
|
|
568
596
|
);
|
|
569
597
|
}
|
|
@@ -577,7 +605,7 @@ var RouteManager = class _RouteManager {
|
|
|
577
605
|
matchRoute(pathname, options = {}) {
|
|
578
606
|
const routePathname = this.toRoutePathname(pathname);
|
|
579
607
|
const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
|
|
580
|
-
const pathParts =
|
|
608
|
+
const pathParts = _chunkGC5ROI3Acjs.splitRoutePath.call(void 0, normalizedPath);
|
|
581
609
|
const trimmedPathname = routePathname.replace(/\/+$/, "");
|
|
582
610
|
const hasEmptySegment = trimmedPathname.includes("//") || trimmedPathname === "" && routePathname.length > 1;
|
|
583
611
|
let matchedRoute = null;
|
|
@@ -586,7 +614,7 @@ var RouteManager = class _RouteManager {
|
|
|
586
614
|
if (hasEmptySegment && !routeEntry.route.segments.some((segment) => segment.isDynamic)) {
|
|
587
615
|
continue;
|
|
588
616
|
}
|
|
589
|
-
const match =
|
|
617
|
+
const match = _chunkGC5ROI3Acjs.matchRouteParts.call(void 0, pathParts, routeEntry.route.segments);
|
|
590
618
|
if (match.matches) {
|
|
591
619
|
matchedRoute = routeEntry;
|
|
592
620
|
params = match.params;
|
|
@@ -608,6 +636,30 @@ var RouteManager = class _RouteManager {
|
|
|
608
636
|
getRoutes() {
|
|
609
637
|
return new Map(this.routes);
|
|
610
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* The pages whose programmatic definition declares `search.preserve`, for Farm links to carry
|
|
641
|
+
* those params from the current URL. Read from the evaluated routes files, without planning.
|
|
642
|
+
*/
|
|
643
|
+
getSearchPreserveRoutes() {
|
|
644
|
+
const routes = [];
|
|
645
|
+
for (const entry of this.routes.values()) {
|
|
646
|
+
const preserve = _optionalChain([_chunkYUCU6XB4cjs.getProgrammaticRouteSearchClientOptions.call(void 0,
|
|
647
|
+
_optionalChain([this, 'access', _2 => _2.programmaticPages, 'access', _3 => _3.get, 'call', _4 => _4(entry.modulePath), 'optionalAccess', _5 => _5.search])
|
|
648
|
+
), 'optionalAccess', _6 => _6.preserve]);
|
|
649
|
+
if (!_optionalChain([preserve, 'optionalAccess', _7 => _7.length])) continue;
|
|
650
|
+
routes.push({
|
|
651
|
+
pattern: entry.pattern,
|
|
652
|
+
segments: entry.route.segments.map((seg) => ({
|
|
653
|
+
segment: seg.segment,
|
|
654
|
+
isDynamic: seg.isDynamic,
|
|
655
|
+
isCatchAll: seg.isCatchAll,
|
|
656
|
+
isOptional: seg.isOptional
|
|
657
|
+
})),
|
|
658
|
+
search: { preserve: [...preserve] }
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
return routes;
|
|
662
|
+
}
|
|
611
663
|
/**
|
|
612
664
|
* Get all registered layouts
|
|
613
665
|
*/
|
|
@@ -620,7 +672,7 @@ var RouteManager = class _RouteManager {
|
|
|
620
672
|
/** The layouts that wrap a registered page, root first. */
|
|
621
673
|
getRouteLayouts(pattern) {
|
|
622
674
|
const routeEntry = this.routes.get(pattern);
|
|
623
|
-
return routeEntry ? this.findMatchingLayouts(
|
|
675
|
+
return routeEntry ? this.findMatchingLayouts(_chunkGC5ROI3Acjs.splitRoutePath.call(void 0, pattern), routeEntry) : [];
|
|
624
676
|
}
|
|
625
677
|
/** Resolve route rules, inherited layouts, and the page export in precedence order. */
|
|
626
678
|
async resolveRouteRuntimeConfig(pattern) {
|
|
@@ -629,7 +681,7 @@ var RouteManager = class _RouteManager {
|
|
|
629
681
|
throw new Error(`Cannot resolve runtime configuration for unknown route "${pattern}"`);
|
|
630
682
|
}
|
|
631
683
|
const inherited = _chunkIUKBPBM7cjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, pattern, this.config.routeRules);
|
|
632
|
-
const layouts = this.findMatchingLayouts(
|
|
684
|
+
const layouts = this.findMatchingLayouts(_chunkGC5ROI3Acjs.splitRoutePath.call(void 0, pattern), routeEntry);
|
|
633
685
|
const layoutConfigs = [];
|
|
634
686
|
for (const layout of layouts) {
|
|
635
687
|
const layoutModule = await this.loadLayoutModule(layout.modulePath);
|
|
@@ -673,12 +725,12 @@ var RouteManager = class _RouteManager {
|
|
|
673
725
|
}
|
|
674
726
|
matchRedirect(pathname, search = "") {
|
|
675
727
|
const i18n = this.getI18nConfig();
|
|
676
|
-
const localeMatch = i18n ?
|
|
677
|
-
const routePathname = _optionalChain([localeMatch, 'optionalAccess',
|
|
728
|
+
const localeMatch = i18n ? _chunkGYJT2U7Jcjs.resolveFarmLocalePath.call(void 0, pathname, i18n) : void 0;
|
|
729
|
+
const routePathname = _optionalChain([localeMatch, 'optionalAccess', _8 => _8.pathname]) || this.toRoutePathname(pathname);
|
|
678
730
|
const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
|
|
679
|
-
const urlParts =
|
|
731
|
+
const urlParts = _chunkGC5ROI3Acjs.splitRoutePath.call(void 0, normalizedPath);
|
|
680
732
|
for (const redirectEntry of this.redirects.values()) {
|
|
681
|
-
const match =
|
|
733
|
+
const match = _chunkGC5ROI3Acjs.matchRouteParts.call(void 0, urlParts, redirectEntry.route.segments);
|
|
682
734
|
if (!match.matches) continue;
|
|
683
735
|
const statusCode = redirectEntry.definition.statusCode || (redirectEntry.definition.permanent ? 308 : 307);
|
|
684
736
|
return {
|
|
@@ -690,7 +742,7 @@ var RouteManager = class _RouteManager {
|
|
|
690
742
|
match.params,
|
|
691
743
|
getCatchAllParamSegments(redirectEntry.route.segments, urlParts)
|
|
692
744
|
),
|
|
693
|
-
_optionalChain([localeMatch, 'optionalAccess',
|
|
745
|
+
_optionalChain([localeMatch, 'optionalAccess', _9 => _9.locale])
|
|
694
746
|
),
|
|
695
747
|
search
|
|
696
748
|
),
|
|
@@ -723,7 +775,7 @@ var RouteManager = class _RouteManager {
|
|
|
723
775
|
const pagePath = normalizedPath.slice(0, -suffix.fileName.length - 1) || "/";
|
|
724
776
|
for (const imageEntry of this.metadataImages.values()) {
|
|
725
777
|
if (imageEntry.kind !== suffix.kind) continue;
|
|
726
|
-
const match =
|
|
778
|
+
const match = _chunkGC5ROI3Acjs.matchRoute.call(void 0, pagePath, imageEntry.route.segments);
|
|
727
779
|
if (!match.matches) continue;
|
|
728
780
|
return {
|
|
729
781
|
image: imageEntry,
|
|
@@ -741,7 +793,7 @@ var RouteManager = class _RouteManager {
|
|
|
741
793
|
const routePath = normalizedPath.slice(0, -suffix.outputName.length - 1) || "/";
|
|
742
794
|
for (const metadata of this.metadataRoutes.values()) {
|
|
743
795
|
if (metadata.kind !== suffix.kind) continue;
|
|
744
|
-
const match =
|
|
796
|
+
const match = _chunkGC5ROI3Acjs.matchRoute.call(void 0, routePath, metadata.route.segments);
|
|
745
797
|
if (!match.matches) continue;
|
|
746
798
|
return { metadata, params: match.params, routePath };
|
|
747
799
|
}
|
|
@@ -755,7 +807,7 @@ var RouteManager = class _RouteManager {
|
|
|
755
807
|
for (const metadata of this.metadataRoutes.values()) {
|
|
756
808
|
if (metadata.kind !== kind || metadata.route.segments.length > pathSegments.length) continue;
|
|
757
809
|
const routePath = metadata.route.segments.length === 0 ? "/" : `/${pathSegments.slice(0, metadata.route.segments.length).join("/")}`;
|
|
758
|
-
const match =
|
|
810
|
+
const match = _chunkGC5ROI3Acjs.matchRoute.call(void 0, routePath, metadata.route.segments);
|
|
759
811
|
if (!match.matches) continue;
|
|
760
812
|
if (!bestMatch || metadata.route.segments.length > bestMatch.metadata.route.segments.length) {
|
|
761
813
|
bestMatch = { metadata, params: match.params, routePath };
|
|
@@ -776,7 +828,7 @@ var RouteManager = class _RouteManager {
|
|
|
776
828
|
if (imageEntry.kind !== kind) continue;
|
|
777
829
|
if (imageEntry.route.segments.length > pathSegments.length) continue;
|
|
778
830
|
const candidatePath = imageEntry.route.segments.length === 0 ? "/" : `/${pathSegments.slice(0, imageEntry.route.segments.length).join("/")}`;
|
|
779
|
-
const match =
|
|
831
|
+
const match = _chunkGC5ROI3Acjs.matchRoute.call(void 0, candidatePath, imageEntry.route.segments);
|
|
780
832
|
if (!match.matches) continue;
|
|
781
833
|
if (!bestMatch || imageEntry.route.segments.length > bestMatch.image.route.segments.length) {
|
|
782
834
|
bestMatch = {
|
|
@@ -797,16 +849,16 @@ var RouteManager = class _RouteManager {
|
|
|
797
849
|
* Requests still fetch route data, but never inspect component source.
|
|
798
850
|
*/
|
|
799
851
|
generateClientManifest(projectRoot = this.config.root) {
|
|
800
|
-
const normalizedProjectRoot =
|
|
801
|
-
if (_optionalChain([this, 'access',
|
|
852
|
+
const normalizedProjectRoot = path4.default.resolve(projectRoot);
|
|
853
|
+
if (_optionalChain([this, 'access', _10 => _10.clientManifestCache, 'optionalAccess', _11 => _11.projectRoot]) === normalizedProjectRoot) {
|
|
802
854
|
return this.clientManifestCache.manifest;
|
|
803
855
|
}
|
|
804
856
|
const cacheFile = this.packageClientBoundaryCacheFile;
|
|
805
|
-
const compute = () =>
|
|
857
|
+
const compute = () => _chunkQP4GYVRRcjs.withFarmSourceSnapshot.call(void 0,
|
|
806
858
|
() => this.computeClientManifest(normalizedProjectRoot),
|
|
807
859
|
this.sourceSnapshot
|
|
808
860
|
);
|
|
809
|
-
return cacheFile ?
|
|
861
|
+
return cacheFile ? _chunkQP4GYVRRcjs.runWithPackageClientBoundaryCacheFile.call(void 0, cacheFile, compute) : compute();
|
|
810
862
|
}
|
|
811
863
|
/**
|
|
812
864
|
* @internal The dev server reports every watched change (`noteSourceChange`), so a replan can
|
|
@@ -815,7 +867,7 @@ var RouteManager = class _RouteManager {
|
|
|
815
867
|
*/
|
|
816
868
|
trackSourceChanges() {
|
|
817
869
|
this.sourceChangeTracking = true;
|
|
818
|
-
_nullishCoalesce(this.sourceSnapshot, () => ( (this.sourceSnapshot = new (0,
|
|
870
|
+
_nullishCoalesce(this.sourceSnapshot, () => ( (this.sourceSnapshot = new (0, _chunkQP4GYVRRcjs.FarmSourceSnapshotStore)())));
|
|
819
871
|
}
|
|
820
872
|
/**
|
|
821
873
|
* @internal A production build edits no source while it runs, so what the plan reads, parses and
|
|
@@ -824,7 +876,7 @@ var RouteManager = class _RouteManager {
|
|
|
824
876
|
*/
|
|
825
877
|
keepBuildSourceSnapshot() {
|
|
826
878
|
if (this.sourceChangeTracking) return;
|
|
827
|
-
_nullishCoalesce(this.sourceSnapshot, () => ( (this.sourceSnapshot = new (0,
|
|
879
|
+
_nullishCoalesce(this.sourceSnapshot, () => ( (this.sourceSnapshot = new (0, _chunkQP4GYVRRcjs.FarmSourceSnapshotStore)(false))));
|
|
828
880
|
}
|
|
829
881
|
/**
|
|
830
882
|
* @internal Hands the snapshot keepBuildSourceSnapshot kept to the build, which clears it once
|
|
@@ -846,15 +898,16 @@ var RouteManager = class _RouteManager {
|
|
|
846
898
|
if (file.endsWith(".d.ts")) return;
|
|
847
899
|
if (PLAN_SOURCE.test(file)) {
|
|
848
900
|
if (event === "update") {
|
|
849
|
-
_optionalChain([this, 'access',
|
|
901
|
+
_optionalChain([this, 'access', _12 => _12.editedSources, 'optionalAccess', _13 => _13.add, 'call', _14 => _14(path4.default.resolve(file))]);
|
|
850
902
|
return;
|
|
851
903
|
}
|
|
852
904
|
} else if (!/\.jsonc?$/.test(file)) {
|
|
853
905
|
return;
|
|
854
906
|
}
|
|
855
907
|
this.editedSources = null;
|
|
856
|
-
_optionalChain([this, 'access',
|
|
908
|
+
_optionalChain([this, 'access', _15 => _15.sourceSnapshot, 'optionalAccess', _16 => _16.clear, 'call', _17 => _17()]);
|
|
857
909
|
this.linkedSources.clear();
|
|
910
|
+
this.linkedPackages.clear();
|
|
858
911
|
}
|
|
859
912
|
/**
|
|
860
913
|
* @internal Whether an edit to `file` leaves the current plan as it is: a client module the
|
|
@@ -865,8 +918,8 @@ var RouteManager = class _RouteManager {
|
|
|
865
918
|
if (!this.sourceChangeTracking || !this.editedSources || !this.clientManifestCache) {
|
|
866
919
|
return false;
|
|
867
920
|
}
|
|
868
|
-
const previous = _optionalChain([this, 'access',
|
|
869
|
-
return previous !== void 0 &&
|
|
921
|
+
const previous = _optionalChain([this, 'access', _18 => _18.sourceSnapshot, 'optionalAccess', _19 => _19.peekSource, 'call', _20 => _20(path4.default.resolve(file))]);
|
|
922
|
+
return previous !== void 0 && _chunkQP4GYVRRcjs.isFarmClientModulePlanUnchanged.call(void 0, file, previous);
|
|
870
923
|
}
|
|
871
924
|
/**
|
|
872
925
|
* A route module's plan: the last one when it read none of `edited`, recomputed otherwise.
|
|
@@ -877,7 +930,7 @@ var RouteManager = class _RouteManager {
|
|
|
877
930
|
if (previous && edited && ![...edited].some((file) => previous.files.has(file))) {
|
|
878
931
|
return { ...previous.plan };
|
|
879
932
|
}
|
|
880
|
-
const { result, files } =
|
|
933
|
+
const { result, files } = _chunkQP4GYVRRcjs.traceFarmSourceReads.call(void 0, compute);
|
|
881
934
|
const sources = /* @__PURE__ */ new Set();
|
|
882
935
|
for (const file of files) {
|
|
883
936
|
const source = this.planSourcePath(file);
|
|
@@ -885,7 +938,7 @@ var RouteManager = class _RouteManager {
|
|
|
885
938
|
}
|
|
886
939
|
if (!this.sourceChangeTracking) {
|
|
887
940
|
for (const source of sources) {
|
|
888
|
-
if (!this.planStamps.has(source)) this.planStamps.set(source,
|
|
941
|
+
if (!this.planStamps.has(source)) this.planStamps.set(source, _chunkQP4GYVRRcjs.getFarmSourceStamp.call(void 0, source));
|
|
889
942
|
}
|
|
890
943
|
}
|
|
891
944
|
this.ownerPlans.set(key, { plan: result, files: sources, planKey });
|
|
@@ -905,7 +958,7 @@ var RouteManager = class _RouteManager {
|
|
|
905
958
|
const isUnchanged = (file) => {
|
|
906
959
|
let result = unchanged.get(file);
|
|
907
960
|
if (result === void 0) {
|
|
908
|
-
result = this.planStamps.get(file) ===
|
|
961
|
+
result = this.planStamps.get(file) === _chunkQP4GYVRRcjs.getFarmSourceStamp.call(void 0, file);
|
|
909
962
|
unchanged.set(file, result);
|
|
910
963
|
}
|
|
911
964
|
return result;
|
|
@@ -918,17 +971,22 @@ var RouteManager = class _RouteManager {
|
|
|
918
971
|
/**
|
|
919
972
|
* The path the watcher reports for a file a plan read: itself, or the real path of a workspace
|
|
920
973
|
* package's source read through its `node_modules` link. Null for an installed package's file.
|
|
974
|
+
* Package managers link whole package directories, so one realpath of the directory rules out an
|
|
975
|
+
* installed package; a plan reads thousands of files of an icon package.
|
|
921
976
|
*/
|
|
922
977
|
planSourcePath(file) {
|
|
923
|
-
|
|
978
|
+
const index = file.lastIndexOf(NODE_MODULES_SEGMENT);
|
|
979
|
+
if (index === -1) return file;
|
|
980
|
+
const directory = getInstalledPackageDirectory(file, index + NODE_MODULES_SEGMENT.length);
|
|
981
|
+
let linked = this.linkedPackages.get(directory);
|
|
982
|
+
if (linked === void 0) {
|
|
983
|
+
linked = realPathOutsideNodeModules(directory) !== null;
|
|
984
|
+
this.linkedPackages.set(directory, linked);
|
|
985
|
+
}
|
|
986
|
+
if (!linked) return null;
|
|
924
987
|
let source = this.linkedSources.get(file);
|
|
925
988
|
if (source === void 0) {
|
|
926
|
-
|
|
927
|
-
const real = _fs.realpathSync.call(void 0, file);
|
|
928
|
-
source = real.includes(NODE_MODULES_SEGMENT) ? null : real;
|
|
929
|
-
} catch (e) {
|
|
930
|
-
source = null;
|
|
931
|
-
}
|
|
989
|
+
source = realPathOutsideNodeModules(file);
|
|
932
990
|
this.linkedSources.set(file, source);
|
|
933
991
|
}
|
|
934
992
|
return source;
|
|
@@ -947,47 +1005,47 @@ var RouteManager = class _RouteManager {
|
|
|
947
1005
|
*/
|
|
948
1006
|
inspectPackages(operation) {
|
|
949
1007
|
const file = this.packageClientBoundaryCacheFile;
|
|
950
|
-
return file ?
|
|
1008
|
+
return file ? _chunkQP4GYVRRcjs.runWithLatestPackageClientBoundaryCache.call(void 0, file, operation) : operation();
|
|
951
1009
|
}
|
|
952
1010
|
computeClientManifest(normalizedProjectRoot) {
|
|
953
1011
|
const toUrlPath = (absolutePath) => {
|
|
954
|
-
const rootRelative =
|
|
1012
|
+
const rootRelative = _chunkGC5ROI3Acjs.toRootRelativeUrlPath.call(void 0, absolutePath, normalizedProjectRoot);
|
|
955
1013
|
if (rootRelative !== void 0) return rootRelative;
|
|
956
|
-
if (
|
|
1014
|
+
if (path4.default.isAbsolute(absolutePath)) {
|
|
957
1015
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
958
1016
|
return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
|
|
959
1017
|
}
|
|
960
1018
|
return absolutePath;
|
|
961
1019
|
};
|
|
962
|
-
const integrationProviders =
|
|
1020
|
+
const integrationProviders = _chunkOWO7KDZ3cjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
|
|
963
1021
|
(provider) => provider.component || provider.type === "clerk"
|
|
964
1022
|
);
|
|
965
1023
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
966
1024
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
967
1025
|
);
|
|
968
|
-
if (_optionalChain([this, 'access',
|
|
969
|
-
|
|
1026
|
+
if (_optionalChain([this, 'access', _21 => _21.config, 'access', _22 => _22.experimental, 'optionalAccess', _23 => _23.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _24 => _24.config, 'access', _25 => _25.experimental, 'optionalAccess', _26 => _26.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
1027
|
+
_chunkGC5ROI3Acjs.logger.warn(
|
|
970
1028
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
971
1029
|
);
|
|
972
1030
|
}
|
|
973
|
-
const isolatedMode =
|
|
974
|
-
_optionalChain([this, 'access',
|
|
1031
|
+
const isolatedMode = _chunkQP4GYVRRcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
1032
|
+
_optionalChain([this, 'access', _27 => _27.config, 'access', _28 => _28.experimental, 'optionalAccess', _29 => _29.isolatedClientHydration]),
|
|
975
1033
|
{
|
|
976
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
1034
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _30 => _30.config, 'access', _31 => _31.experimental, 'optionalAccess', _32 => _32.serverComponents])) === "rsc",
|
|
977
1035
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
978
1036
|
}
|
|
979
1037
|
);
|
|
980
|
-
const planOptions =
|
|
1038
|
+
const planOptions = _chunkQP4GYVRRcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
981
1039
|
this.config.renderer,
|
|
982
1040
|
Boolean(unsupportedIntegrationProvider)
|
|
983
1041
|
);
|
|
984
|
-
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
985
|
-
const changed = _optionalChain([this, 'access',
|
|
1042
|
+
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _33 => _33.config, 'access', _34 => _34.experimental, 'optionalAccess', _35 => _35.serverComponents])) === "islands";
|
|
1043
|
+
const changed = _optionalChain([this, 'access', _36 => _36.sourceSnapshot, 'optionalAccess', _37 => _37.refresh, 'call', _38 => _38(_nullishCoalesce(this.editedSources, () => ( [])))]);
|
|
986
1044
|
let edited = null;
|
|
987
1045
|
if (this.sourceChangeTracking && this.editedSources && this.ownerPlans.size > 0) {
|
|
988
1046
|
edited = /* @__PURE__ */ new Set();
|
|
989
1047
|
for (const [file, previous] of _nullishCoalesce(changed, () => ( []))) {
|
|
990
|
-
if (
|
|
1048
|
+
if (_chunkQP4GYVRRcjs.isFarmClientModulePlanUnchanged.call(void 0, file, previous)) continue;
|
|
991
1049
|
const source = this.planSourcePath(file);
|
|
992
1050
|
if (source) edited.add(source);
|
|
993
1051
|
}
|
|
@@ -1002,13 +1060,13 @@ var RouteManager = class _RouteManager {
|
|
|
1002
1060
|
metadata: this.planRouteModule(
|
|
1003
1061
|
`layout:${entry.modulePath}`,
|
|
1004
1062
|
edited,
|
|
1005
|
-
() =>
|
|
1063
|
+
() => _chunkQP4GYVRRcjs.getClientModuleHydrationPlan.call(void 0,
|
|
1006
1064
|
entry.modulePath,
|
|
1007
1065
|
normalizedProjectRoot,
|
|
1008
1066
|
isolatedMode,
|
|
1009
1067
|
layoutPlanOptions
|
|
1010
1068
|
),
|
|
1011
|
-
|
|
1069
|
+
_chunkQP4GYVRRcjs.getClientModuleHydrationPlanKey.call(void 0,
|
|
1012
1070
|
entry.modulePath,
|
|
1013
1071
|
normalizedProjectRoot,
|
|
1014
1072
|
isolatedMode,
|
|
@@ -1016,7 +1074,7 @@ var RouteManager = class _RouteManager {
|
|
|
1016
1074
|
)
|
|
1017
1075
|
)
|
|
1018
1076
|
}));
|
|
1019
|
-
const markdownComponentsPlan =
|
|
1077
|
+
const markdownComponentsPlan = _chunkQP4GYVRRcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
1020
1078
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, this.config.mdx), normalizedProjectRoot),
|
|
1021
1079
|
normalizedProjectRoot,
|
|
1022
1080
|
isolatedMode,
|
|
@@ -1029,16 +1087,16 @@ var RouteManager = class _RouteManager {
|
|
|
1029
1087
|
const pagePlanOptions = { ...planOptions, serverOwners: islandsMode };
|
|
1030
1088
|
const routeEntries = Array.from(this.routes.values()).map((entry) => ({
|
|
1031
1089
|
entry,
|
|
1032
|
-
metadata:
|
|
1090
|
+
metadata: _chunkPG7J7XYTcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : this.planRouteModule(
|
|
1033
1091
|
`page:${entry.modulePath}`,
|
|
1034
1092
|
edited,
|
|
1035
|
-
() =>
|
|
1093
|
+
() => _chunkQP4GYVRRcjs.getClientModuleHydrationPlan.call(void 0,
|
|
1036
1094
|
entry.modulePath,
|
|
1037
1095
|
normalizedProjectRoot,
|
|
1038
1096
|
isolatedMode,
|
|
1039
1097
|
pagePlanOptions
|
|
1040
1098
|
),
|
|
1041
|
-
|
|
1099
|
+
_chunkQP4GYVRRcjs.getClientModuleHydrationPlanKey.call(void 0,
|
|
1042
1100
|
entry.modulePath,
|
|
1043
1101
|
normalizedProjectRoot,
|
|
1044
1102
|
isolatedMode,
|
|
@@ -1047,51 +1105,51 @@ var RouteManager = class _RouteManager {
|
|
|
1047
1105
|
)
|
|
1048
1106
|
}));
|
|
1049
1107
|
const markdownFallback = routeEntries.find(
|
|
1050
|
-
({ entry, metadata }) =>
|
|
1108
|
+
({ entry, metadata }) => _chunkPG7J7XYTcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
|
|
1051
1109
|
);
|
|
1052
1110
|
if (markdownFallback) {
|
|
1053
|
-
|
|
1111
|
+
_chunkGC5ROI3Acjs.logger.warn(
|
|
1054
1112
|
`[Farm.js] client components in Markdown pages stay static: ${markdownFallback.metadata.fallbackReason}.`
|
|
1055
1113
|
);
|
|
1056
1114
|
}
|
|
1057
|
-
const markdownStaticPackages = _optionalChain([routeEntries, 'access',
|
|
1058
|
-
({ entry, metadata }) =>
|
|
1059
|
-
), 'optionalAccess',
|
|
1115
|
+
const markdownStaticPackages = _optionalChain([routeEntries, 'access', _39 => _39.find, 'call', _40 => _40(
|
|
1116
|
+
({ entry, metadata }) => _chunkPG7J7XYTcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
|
|
1117
|
+
), 'optionalAccess', _41 => _41.metadata, 'access', _42 => _42.staticPackageBoundaries]);
|
|
1060
1118
|
if (markdownStaticPackages) {
|
|
1061
|
-
|
|
1119
|
+
_chunkGC5ROI3Acjs.logger.info(
|
|
1062
1120
|
`[Farm.js] Markdown pages render client components from ${markdownStaticPackages.join(", ")} as static HTML: package client components cannot be isolated yet.`
|
|
1063
1121
|
);
|
|
1064
1122
|
}
|
|
1065
1123
|
for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
|
|
1066
|
-
if (
|
|
1067
|
-
|
|
1124
|
+
if (_chunkPG7J7XYTcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
|
|
1125
|
+
_chunkGC5ROI3Acjs.logger.info(
|
|
1068
1126
|
`[Farm.js] ${entry.pattern} renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
|
|
1069
1127
|
);
|
|
1070
1128
|
}
|
|
1071
|
-
|
|
1129
|
+
_chunkQP4GYVRRcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
1072
1130
|
layoutEntries.map(({ entry, metadata }) => ({
|
|
1073
1131
|
pattern: entry.pattern,
|
|
1074
|
-
depth:
|
|
1132
|
+
depth: _chunk6ZFGWB75cjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
|
|
1075
1133
|
metadata
|
|
1076
1134
|
})),
|
|
1077
1135
|
routeEntries.map(({ entry, metadata }) => ({
|
|
1078
1136
|
pattern: getRouteEntryDirectory(entry),
|
|
1079
|
-
depth:
|
|
1137
|
+
depth: _chunk6ZFGWB75cjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
|
|
1080
1138
|
metadata
|
|
1081
1139
|
})),
|
|
1082
|
-
|
|
1140
|
+
_chunk6ZFGWB75cjs.routeBoundaryCoversDirectory,
|
|
1083
1141
|
{ serverOwners: islandsMode }
|
|
1084
1142
|
);
|
|
1085
1143
|
for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
|
|
1086
1144
|
if (!metadata.costGuardExceeded) continue;
|
|
1087
|
-
|
|
1145
|
+
_chunkGC5ROI3Acjs.logger.warn(
|
|
1088
1146
|
`[Farm.js] isolated hydration kept route-wide for ${entry.modulePath}: ${metadata.fallbackReason}.`
|
|
1089
1147
|
);
|
|
1090
1148
|
}
|
|
1091
1149
|
if (isolatedMode === "analyze") {
|
|
1092
1150
|
for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
|
|
1093
1151
|
if (!metadata.isolatedHydrationEligible) continue;
|
|
1094
|
-
|
|
1152
|
+
_chunkGC5ROI3Acjs.logger.info(
|
|
1095
1153
|
`[Farm.js] isolated hydration analysis: ${entry.modulePath} can keep ${metadata.isolatedBoundaries.length} client ${metadata.isolatedBoundaries.length === 1 ? "boundary" : "boundaries"} while excluding its server owner from the browser graph.`
|
|
1096
1154
|
);
|
|
1097
1155
|
}
|
|
@@ -1099,7 +1157,7 @@ var RouteManager = class _RouteManager {
|
|
|
1099
1157
|
const routes = routeEntries.map(({ entry, metadata }) => {
|
|
1100
1158
|
const programmaticPage = this.programmaticPages.get(entry.modulePath);
|
|
1101
1159
|
const layoutShouldHydrate = layoutEntries.some(
|
|
1102
|
-
({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate &&
|
|
1160
|
+
({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunk6ZFGWB75cjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
|
|
1103
1161
|
);
|
|
1104
1162
|
return {
|
|
1105
1163
|
pattern: entry.pattern,
|
|
@@ -1115,15 +1173,15 @@ var RouteManager = class _RouteManager {
|
|
|
1115
1173
|
modulePath: toUrlPath(boundary.modulePath)
|
|
1116
1174
|
}))
|
|
1117
1175
|
} : {},
|
|
1118
|
-
...
|
|
1119
|
-
renderPlan:
|
|
1176
|
+
..._chunkQP4GYVRRcjs.usesFarmServerTree.call(void 0, metadata) ? { serverTree: true } : {},
|
|
1177
|
+
renderPlan: _chunk6ZFGWB75cjs.createFarmRouteRenderPlan.call(void 0, {
|
|
1120
1178
|
pageShouldHydrate: metadata.shouldHydrate,
|
|
1121
1179
|
layoutShouldHydrate,
|
|
1122
1180
|
islandStrategy: metadata.islandStrategy
|
|
1123
1181
|
}),
|
|
1124
1182
|
suppressedAsyncHydration: metadata.suppressedAsyncHydration,
|
|
1125
1183
|
...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {},
|
|
1126
|
-
search:
|
|
1184
|
+
search: _chunkYUCU6XB4cjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _43 => _43.search])),
|
|
1127
1185
|
segments: entry.route.segments.map((seg) => ({
|
|
1128
1186
|
segment: seg.segment,
|
|
1129
1187
|
isDynamic: seg.isDynamic,
|
|
@@ -1132,7 +1190,7 @@ var RouteManager = class _RouteManager {
|
|
|
1132
1190
|
}))
|
|
1133
1191
|
};
|
|
1134
1192
|
});
|
|
1135
|
-
const treeLayoutPatterns = islandsMode ?
|
|
1193
|
+
const treeLayoutPatterns = islandsMode ? _chunk6ZFGWB75cjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
1136
1194
|
layoutEntries.map(({ entry, metadata }) => ({
|
|
1137
1195
|
pattern: entry.pattern,
|
|
1138
1196
|
shouldHydrate: metadata.shouldHydrate,
|
|
@@ -1157,7 +1215,7 @@ var RouteManager = class _RouteManager {
|
|
|
1157
1215
|
...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {}
|
|
1158
1216
|
}));
|
|
1159
1217
|
const slots = Array.from(this.routeSlots.values()).map((entry) => {
|
|
1160
|
-
const metadata =
|
|
1218
|
+
const metadata = _chunkQP4GYVRRcjs.getClientModuleMetadata.call(void 0, entry.modulePath, normalizedProjectRoot);
|
|
1161
1219
|
return {
|
|
1162
1220
|
name: entry.name,
|
|
1163
1221
|
ownerPattern: entry.ownerPattern,
|
|
@@ -1173,7 +1231,7 @@ var RouteManager = class _RouteManager {
|
|
|
1173
1231
|
};
|
|
1174
1232
|
});
|
|
1175
1233
|
const slotPlans = islandsMode ? Array.from(this.routeSlots.values()).map((entry) => ({
|
|
1176
|
-
metadata:
|
|
1234
|
+
metadata: _chunkQP4GYVRRcjs.getClientModuleHydrationPlan.call(void 0,
|
|
1177
1235
|
entry.modulePath,
|
|
1178
1236
|
normalizedProjectRoot,
|
|
1179
1237
|
isolatedMode,
|
|
@@ -1184,7 +1242,7 @@ var RouteManager = class _RouteManager {
|
|
|
1184
1242
|
for (const { metadata } of [...layoutEntries, ...routeEntries, ...slotPlans]) {
|
|
1185
1243
|
if (!metadata.hasIsolatedClientBoundaries && !metadata.serverTreeLayout) continue;
|
|
1186
1244
|
for (const boundary of metadata.isolatedBoundaries) {
|
|
1187
|
-
isolatedClientBoundaryModules.add(
|
|
1245
|
+
isolatedClientBoundaryModules.add(path4.default.resolve(boundary.modulePath));
|
|
1188
1246
|
}
|
|
1189
1247
|
}
|
|
1190
1248
|
const islandsErrors = [
|
|
@@ -1198,7 +1256,7 @@ var RouteManager = class _RouteManager {
|
|
|
1198
1256
|
for (const error of islandsErrors) {
|
|
1199
1257
|
if (this.reportedIslandsErrors.has(error)) continue;
|
|
1200
1258
|
this.reportedIslandsErrors.add(error);
|
|
1201
|
-
|
|
1259
|
+
_chunkGC5ROI3Acjs.logger.error(`[Farm.js] islands mode cannot hydrate ${error}`);
|
|
1202
1260
|
}
|
|
1203
1261
|
const manifest = { routes, layouts, slots };
|
|
1204
1262
|
this.editedSources = this.sourceChangeTracking ? /* @__PURE__ */ new Set() : null;
|
|
@@ -1236,17 +1294,17 @@ var RouteManager = class _RouteManager {
|
|
|
1236
1294
|
}
|
|
1237
1295
|
/** @internal Client modules selected by the compiled hydration ownership plan. */
|
|
1238
1296
|
getIsolatedClientBoundaryModules(projectRoot = this.config.root) {
|
|
1239
|
-
const normalizedProjectRoot =
|
|
1297
|
+
const normalizedProjectRoot = path4.default.resolve(projectRoot);
|
|
1240
1298
|
this.generateClientManifest(normalizedProjectRoot);
|
|
1241
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
1299
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _44 => _44.clientManifestCache, 'optionalAccess', _45 => _45.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
|
|
1242
1300
|
}
|
|
1243
1301
|
/**
|
|
1244
1302
|
* @internal Islands-mode pages with a client component that cannot become an island. Hydrating
|
|
1245
1303
|
* such a page whole would ship its server code to the browser, so it stays static instead.
|
|
1246
1304
|
*/
|
|
1247
1305
|
getIslandsErrors(projectRoot = this.config.root) {
|
|
1248
|
-
this.generateClientManifest(
|
|
1249
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
1306
|
+
this.generateClientManifest(path4.default.resolve(projectRoot));
|
|
1307
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _46 => _46.clientManifestCache, 'optionalAccess', _47 => _47.islandsErrors]), () => ( []));
|
|
1250
1308
|
}
|
|
1251
1309
|
/**
|
|
1252
1310
|
* Invalidate build-time route metadata after a page or layout changes in dev.
|
|
@@ -1265,20 +1323,20 @@ var RouteManager = class _RouteManager {
|
|
|
1265
1323
|
const { createRouteModuleFromProgrammaticPage } = await import("./routes.cjs");
|
|
1266
1324
|
return createRouteModuleFromProgrammaticPage(programmaticPage, this.rendererRuntime);
|
|
1267
1325
|
}
|
|
1268
|
-
if (
|
|
1326
|
+
if (_chunkPG7J7XYTcjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
|
|
1269
1327
|
const mdxConfig = _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, this.config.mdx);
|
|
1270
1328
|
const viteServer = this.viteServer;
|
|
1271
|
-
return await
|
|
1329
|
+
return await _chunk5QZT2EQNcjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
|
|
1272
1330
|
// Loaded on render: the route runtime manifest only reads metadata and rendering config.
|
|
1273
|
-
components: () =>
|
|
1331
|
+
components: () => _chunk5QZT2EQNcjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
|
|
1274
1332
|
root: this.config.root,
|
|
1275
|
-
loadModule: viteServer ? (componentModulePath) =>
|
|
1333
|
+
loadModule: viteServer ? (componentModulePath) => _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, viteServer, componentModulePath) : void 0
|
|
1276
1334
|
}),
|
|
1277
1335
|
config: mdxConfig
|
|
1278
1336
|
});
|
|
1279
1337
|
}
|
|
1280
1338
|
if (this.viteServer) {
|
|
1281
|
-
const module = await
|
|
1339
|
+
const module = await _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, this.viteServer, modulePath);
|
|
1282
1340
|
return module;
|
|
1283
1341
|
} else {
|
|
1284
1342
|
const module = await import(
|
|
@@ -1288,7 +1346,7 @@ var RouteManager = class _RouteManager {
|
|
|
1288
1346
|
return module;
|
|
1289
1347
|
}
|
|
1290
1348
|
} catch (error) {
|
|
1291
|
-
|
|
1349
|
+
_chunkGC5ROI3Acjs.logger.error(`Failed to load route module: ${modulePath}`);
|
|
1292
1350
|
throw error;
|
|
1293
1351
|
}
|
|
1294
1352
|
}
|
|
@@ -1303,7 +1361,7 @@ var RouteManager = class _RouteManager {
|
|
|
1303
1361
|
return createLayoutModuleFromProgrammaticLayout(programmaticLayout);
|
|
1304
1362
|
}
|
|
1305
1363
|
if (this.viteServer) {
|
|
1306
|
-
const module = await
|
|
1364
|
+
const module = await _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, this.viteServer, modulePath);
|
|
1307
1365
|
return module;
|
|
1308
1366
|
} else {
|
|
1309
1367
|
const module = await import(
|
|
@@ -1313,7 +1371,7 @@ var RouteManager = class _RouteManager {
|
|
|
1313
1371
|
return module;
|
|
1314
1372
|
}
|
|
1315
1373
|
} catch (error) {
|
|
1316
|
-
|
|
1374
|
+
_chunkGC5ROI3Acjs.logger.error(`Failed to load layout module: ${modulePath}`);
|
|
1317
1375
|
throw error;
|
|
1318
1376
|
}
|
|
1319
1377
|
}
|
|
@@ -1322,11 +1380,11 @@ var RouteManager = class _RouteManager {
|
|
|
1322
1380
|
*/
|
|
1323
1381
|
createRoutePattern(route) {
|
|
1324
1382
|
if (route.segments.length === 0) return "/";
|
|
1325
|
-
return "/" + route.segments.map(
|
|
1383
|
+
return "/" + route.segments.map(_chunk6ZFGWB75cjs.formatRouteSegment).join("/");
|
|
1326
1384
|
}
|
|
1327
1385
|
registerPageRoute(entry) {
|
|
1328
|
-
|
|
1329
|
-
const shape =
|
|
1386
|
+
_chunkML4TOUZPcjs.assertUniqueRouteParameters.call(void 0, entry.pattern);
|
|
1387
|
+
const shape = _chunkML4TOUZPcjs.getRoutePatternShape.call(void 0, entry.pattern);
|
|
1330
1388
|
const existing = this.pageRouteShapes.get(shape);
|
|
1331
1389
|
if (existing && existing.pattern !== entry.pattern) {
|
|
1332
1390
|
if (existing.sourceRoot === entry.sourceRoot) {
|
|
@@ -1340,7 +1398,7 @@ var RouteManager = class _RouteManager {
|
|
|
1340
1398
|
this.pageRouteShapes.set(shape, entry);
|
|
1341
1399
|
}
|
|
1342
1400
|
async discoverFileRoutes(source) {
|
|
1343
|
-
const appDir =
|
|
1401
|
+
const appDir = _chunkGC5ROI3Acjs.resolveAppPath.call(void 0, source.root, source.srcDir, "app");
|
|
1344
1402
|
const componentExtensions = _chunk67MZTLTFcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer).map(
|
|
1345
1403
|
(extension) => extension.slice(1)
|
|
1346
1404
|
);
|
|
@@ -1359,8 +1417,8 @@ var RouteManager = class _RouteManager {
|
|
|
1359
1417
|
appDir
|
|
1360
1418
|
);
|
|
1361
1419
|
const canonicalPageGroups = /* @__PURE__ */ new Map();
|
|
1362
|
-
for (const file of pageFiles.filter((candidate) =>
|
|
1363
|
-
const route =
|
|
1420
|
+
for (const file of pageFiles.filter((candidate) => _chunkQYOAGT3Ecjs.parseRouteSlotFile.call(void 0, candidate) === null)) {
|
|
1421
|
+
const route = _chunkGC5ROI3Acjs.parseRoutePath.call(void 0, file);
|
|
1364
1422
|
const pattern = this.createRoutePattern(route);
|
|
1365
1423
|
const group = canonicalPageGroups.get(pattern);
|
|
1366
1424
|
if (group) {
|
|
@@ -1373,25 +1431,25 @@ var RouteManager = class _RouteManager {
|
|
|
1373
1431
|
}
|
|
1374
1432
|
}
|
|
1375
1433
|
for (const [pattern, group] of canonicalPageGroups) {
|
|
1376
|
-
const componentFiles = group.files.filter((file) => !
|
|
1377
|
-
const markdownFiles = group.files.filter(
|
|
1434
|
+
const componentFiles = group.files.filter((file) => !_chunkPG7J7XYTcjs.isFarmMarkdownPageFile.call(void 0, file));
|
|
1435
|
+
const markdownFiles = group.files.filter(_chunkPG7J7XYTcjs.isFarmMarkdownPageFile);
|
|
1378
1436
|
if (componentFiles.length > 1) {
|
|
1379
1437
|
throw new Error(
|
|
1380
|
-
`Duplicate page route "${pattern}". Found ${componentFiles.map((file) =>
|
|
1438
|
+
`Duplicate page route "${pattern}". Found ${componentFiles.map((file) => path4.default.join(appDir, file)).join(" and ")}.`
|
|
1381
1439
|
);
|
|
1382
1440
|
}
|
|
1383
1441
|
if (markdownFiles.length > 1) {
|
|
1384
1442
|
throw new Error(
|
|
1385
|
-
`Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) =>
|
|
1443
|
+
`Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) => path4.default.join(appDir, file)).join(" and ")}.`
|
|
1386
1444
|
);
|
|
1387
1445
|
}
|
|
1388
1446
|
const componentFile = componentFiles[0];
|
|
1389
1447
|
const markdownFile = markdownFiles[0];
|
|
1390
1448
|
const primaryFile = componentFile || markdownFile;
|
|
1391
1449
|
if (!primaryFile) continue;
|
|
1392
|
-
const modulePath =
|
|
1450
|
+
const modulePath = path4.default.join(appDir, primaryFile);
|
|
1393
1451
|
const existing = this.routes.get(pattern);
|
|
1394
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1452
|
+
if (_optionalChain([existing, 'optionalAccess', _48 => _48.sourceRoot]) === source.root) {
|
|
1395
1453
|
throw new Error(
|
|
1396
1454
|
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
1397
1455
|
);
|
|
@@ -1400,7 +1458,7 @@ var RouteManager = class _RouteManager {
|
|
|
1400
1458
|
route: group.route,
|
|
1401
1459
|
modulePath,
|
|
1402
1460
|
...markdownFile ? {
|
|
1403
|
-
markdownSourcePath:
|
|
1461
|
+
markdownSourcePath: path4.default.join(appDir, markdownFile)
|
|
1404
1462
|
} : {},
|
|
1405
1463
|
pattern,
|
|
1406
1464
|
...getPageDirectoryField(group.route, pattern),
|
|
@@ -1414,11 +1472,11 @@ var RouteManager = class _RouteManager {
|
|
|
1414
1472
|
["error", errorFiles, this.errors]
|
|
1415
1473
|
]) {
|
|
1416
1474
|
for (const file of files) {
|
|
1417
|
-
const route =
|
|
1418
|
-
const modulePath =
|
|
1419
|
-
const pattern =
|
|
1475
|
+
const route = _chunkGC5ROI3Acjs.parseRoutePath.call(void 0, file);
|
|
1476
|
+
const modulePath = path4.default.join(appDir, file);
|
|
1477
|
+
const pattern = _chunk6ZFGWB75cjs.createRouteDirectoryPattern.call(void 0, route);
|
|
1420
1478
|
const existing = target.get(pattern);
|
|
1421
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1479
|
+
if (_optionalChain([existing, 'optionalAccess', _49 => _49.sourceRoot]) === source.root) {
|
|
1422
1480
|
throw new Error(
|
|
1423
1481
|
`Duplicate ${kind} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
1424
1482
|
);
|
|
@@ -1433,15 +1491,15 @@ var RouteManager = class _RouteManager {
|
|
|
1433
1491
|
}
|
|
1434
1492
|
}
|
|
1435
1493
|
for (const file of [...pageFiles, ...slotDefaultFiles]) {
|
|
1436
|
-
const slot =
|
|
1494
|
+
const slot = _chunkQYOAGT3Ecjs.parseRouteSlotFile.call(void 0, file);
|
|
1437
1495
|
if (!slot) continue;
|
|
1438
|
-
const modulePath =
|
|
1496
|
+
const modulePath = path4.default.join(appDir, file);
|
|
1439
1497
|
const pattern = this.createRoutePattern(slot.route);
|
|
1440
1498
|
const ownerPattern = this.createRoutePattern(slot.ownerRoute);
|
|
1441
|
-
const ownerDirectory =
|
|
1499
|
+
const ownerDirectory = _chunk6ZFGWB75cjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
|
|
1442
1500
|
const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
|
|
1443
1501
|
const existing = this.routeSlots.get(key);
|
|
1444
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1502
|
+
if (_optionalChain([existing, 'optionalAccess', _50 => _50.sourceRoot]) === source.root) {
|
|
1445
1503
|
throw new Error(
|
|
1446
1504
|
`Duplicate route slot "${slot.name}" for "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
1447
1505
|
);
|
|
@@ -1457,20 +1515,20 @@ var RouteManager = class _RouteManager {
|
|
|
1457
1515
|
...ownerDirectory === ownerPattern ? {} : { ownerDirectory },
|
|
1458
1516
|
interception: slot.interception,
|
|
1459
1517
|
fallback: slot.fallback,
|
|
1460
|
-
containerId:
|
|
1518
|
+
containerId: _chunkQYOAGT3Ecjs.createRouteSlotContainerId.call(void 0, slot.name, ownerPattern)
|
|
1461
1519
|
});
|
|
1462
1520
|
}
|
|
1463
1521
|
for (const file of metadataImageFiles) {
|
|
1464
|
-
const fileBase =
|
|
1522
|
+
const fileBase = path4.default.basename(file, path4.default.extname(file));
|
|
1465
1523
|
const kind = fileBase === "twitter-image" ? "twitter" : "opengraph";
|
|
1466
1524
|
const fileName = kind === "twitter" ? "twitter-image" : "opengraph-image";
|
|
1467
|
-
const route =
|
|
1468
|
-
const modulePath =
|
|
1525
|
+
const route = _chunkGC5ROI3Acjs.parseRoutePath.call(void 0, file);
|
|
1526
|
+
const modulePath = path4.default.join(appDir, file);
|
|
1469
1527
|
const pattern = this.createRoutePattern(route);
|
|
1470
1528
|
const key = `${kind}:${pattern}`;
|
|
1471
1529
|
const existing = this.metadataImages.get(key);
|
|
1472
1530
|
const sourceType = isStaticMetadataImageFile(file) ? "static" : "module";
|
|
1473
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1531
|
+
if (_optionalChain([existing, 'optionalAccess', _51 => _51.sourceRoot]) === source.root) {
|
|
1474
1532
|
throw new Error(
|
|
1475
1533
|
`Duplicate ${fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one static image or module per route segment.`
|
|
1476
1534
|
);
|
|
@@ -1490,15 +1548,15 @@ var RouteManager = class _RouteManager {
|
|
|
1490
1548
|
}
|
|
1491
1549
|
for (const file of metadataRouteFiles) {
|
|
1492
1550
|
const descriptor = getApplicationMetadataRouteDescriptor(
|
|
1493
|
-
|
|
1551
|
+
path4.default.basename(file, path4.default.extname(file))
|
|
1494
1552
|
);
|
|
1495
1553
|
if (!descriptor) continue;
|
|
1496
|
-
const route =
|
|
1497
|
-
const modulePath =
|
|
1554
|
+
const route = _chunkGC5ROI3Acjs.parseRoutePath.call(void 0, file);
|
|
1555
|
+
const modulePath = path4.default.join(appDir, file);
|
|
1498
1556
|
const pattern = this.createRoutePattern(route);
|
|
1499
1557
|
const key = `${descriptor.kind}:${pattern}`;
|
|
1500
1558
|
const existing = this.metadataRoutes.get(key);
|
|
1501
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1559
|
+
if (_optionalChain([existing, 'optionalAccess', _52 => _52.sourceRoot]) === source.root) {
|
|
1502
1560
|
throw new Error(
|
|
1503
1561
|
`Duplicate ${descriptor.fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one .ts or .js metadata route per segment.`
|
|
1504
1562
|
);
|
|
@@ -1514,35 +1572,35 @@ var RouteManager = class _RouteManager {
|
|
|
1514
1572
|
}
|
|
1515
1573
|
}
|
|
1516
1574
|
async discoverProgrammaticRoutes(source, clientRoutes) {
|
|
1517
|
-
if (this.viteServer)
|
|
1518
|
-
const manifests = await
|
|
1575
|
+
if (this.viteServer) _chunkYUCU6XB4cjs.trackProgrammaticRouteSources.call(void 0, );
|
|
1576
|
+
const manifests = await _chunkYTNE4KGCcjs.loadProgrammaticRouteManifests.call(void 0, {
|
|
1519
1577
|
root: source.root,
|
|
1520
1578
|
srcDir: source.srcDir,
|
|
1521
1579
|
loadModule: (filePath) => this.loadProgrammaticRoutesModule(filePath)
|
|
1522
1580
|
});
|
|
1523
|
-
const graph = this.viteServer ?
|
|
1581
|
+
const graph = this.viteServer ? _chunkQP4GYVRRcjs.createEvaluatedRouteGraph.call(void 0, this.viteServer) : void 0;
|
|
1524
1582
|
for (const { filePath, manifest } of manifests) {
|
|
1525
1583
|
if (graph) {
|
|
1526
1584
|
clientRoutes.push(
|
|
1527
|
-
|
|
1585
|
+
_chunkQP4GYVRRcjs.resolveProgrammaticClientRoutes.call(void 0, {
|
|
1528
1586
|
graph,
|
|
1529
1587
|
routesFile: toRealPath(filePath),
|
|
1530
1588
|
routes: manifest.routes,
|
|
1531
|
-
normalizeRoutePath:
|
|
1589
|
+
normalizeRoutePath: _chunkYUCU6XB4cjs.normalizeProgrammaticRoutePath
|
|
1532
1590
|
})
|
|
1533
1591
|
);
|
|
1534
1592
|
}
|
|
1535
1593
|
for (const definition of manifest.routes) {
|
|
1536
1594
|
if (definition.kind === "page") {
|
|
1537
|
-
const route =
|
|
1595
|
+
const route = _chunkYUCU6XB4cjs.parseProgrammaticRoutePath.call(void 0, definition.path, "page");
|
|
1538
1596
|
const pattern = this.createRoutePattern(route);
|
|
1539
1597
|
const existing = this.routes.get(pattern);
|
|
1540
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1598
|
+
if (_optionalChain([existing, 'optionalAccess', _53 => _53.sourceRoot]) === source.root) {
|
|
1541
1599
|
throw new Error(
|
|
1542
1600
|
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
|
|
1543
1601
|
);
|
|
1544
1602
|
}
|
|
1545
|
-
const modulePath =
|
|
1603
|
+
const modulePath = _chunkYUCU6XB4cjs.createProgrammaticRouteModuleId.call(void 0, filePath, "page", definition.path);
|
|
1546
1604
|
this.programmaticPages.set(modulePath, definition);
|
|
1547
1605
|
this.registerPageRoute({
|
|
1548
1606
|
route,
|
|
@@ -1554,15 +1612,15 @@ var RouteManager = class _RouteManager {
|
|
|
1554
1612
|
});
|
|
1555
1613
|
}
|
|
1556
1614
|
if (definition.kind === "layout") {
|
|
1557
|
-
const route =
|
|
1558
|
-
const pattern =
|
|
1615
|
+
const route = _chunkYUCU6XB4cjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
|
|
1616
|
+
const pattern = _chunk6ZFGWB75cjs.createRouteDirectoryPattern.call(void 0, route);
|
|
1559
1617
|
const existing = this.layouts.get(pattern);
|
|
1560
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1618
|
+
if (_optionalChain([existing, 'optionalAccess', _54 => _54.sourceRoot]) === source.root) {
|
|
1561
1619
|
throw new Error(
|
|
1562
1620
|
`Duplicate layout route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
|
|
1563
1621
|
);
|
|
1564
1622
|
}
|
|
1565
|
-
const modulePath =
|
|
1623
|
+
const modulePath = _chunkYUCU6XB4cjs.createProgrammaticRouteModuleId.call(void 0, filePath, "layout", definition.path);
|
|
1566
1624
|
this.programmaticLayouts.set(modulePath, definition);
|
|
1567
1625
|
this.layouts.set(pattern, {
|
|
1568
1626
|
route,
|
|
@@ -1573,7 +1631,7 @@ var RouteManager = class _RouteManager {
|
|
|
1573
1631
|
});
|
|
1574
1632
|
}
|
|
1575
1633
|
if (definition.kind === "redirect") {
|
|
1576
|
-
const route =
|
|
1634
|
+
const route = _chunkYUCU6XB4cjs.parseProgrammaticRoutePath.call(void 0, definition.source, "page");
|
|
1577
1635
|
const pattern = this.createRoutePattern(route);
|
|
1578
1636
|
this.redirects.set(pattern, {
|
|
1579
1637
|
route,
|
|
@@ -1586,8 +1644,8 @@ var RouteManager = class _RouteManager {
|
|
|
1586
1644
|
}
|
|
1587
1645
|
async loadProgrammaticRoutesModule(filePath) {
|
|
1588
1646
|
if (this.viteServer) {
|
|
1589
|
-
const viteRoot = _optionalChain([this, 'access',
|
|
1590
|
-
return await
|
|
1647
|
+
const viteRoot = _optionalChain([this, 'access', _55 => _55.viteServer, 'access', _56 => _56.config, 'optionalAccess', _57 => _57.root]) || this.config.root || process.cwd();
|
|
1648
|
+
return await _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, filePath, viteRoot));
|
|
1591
1649
|
}
|
|
1592
1650
|
return await import(
|
|
1593
1651
|
/* @vite-ignore */
|
|
@@ -1601,8 +1659,8 @@ var RouteManager = class _RouteManager {
|
|
|
1601
1659
|
findMatchingLayouts(pathnameParts, route) {
|
|
1602
1660
|
const matchingLayouts = [];
|
|
1603
1661
|
for (const { entry, groupScope } of this.orderedLayouts) {
|
|
1604
|
-
if (!
|
|
1605
|
-
if (groupScope !== null && !
|
|
1662
|
+
if (!_chunkGC5ROI3Acjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
|
|
1663
|
+
if (groupScope !== null && !_chunk6ZFGWB75cjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
|
|
1606
1664
|
continue;
|
|
1607
1665
|
}
|
|
1608
1666
|
matchingLayouts.push(entry);
|
|
@@ -1611,7 +1669,7 @@ var RouteManager = class _RouteManager {
|
|
|
1611
1669
|
}
|
|
1612
1670
|
matchPageRoute(pathnameParts) {
|
|
1613
1671
|
for (const routeEntry of this.routes.values()) {
|
|
1614
|
-
if (
|
|
1672
|
+
if (_chunkGC5ROI3Acjs.matchRouteParts.call(void 0, pathnameParts, routeEntry.route.segments).matches) return routeEntry;
|
|
1615
1673
|
}
|
|
1616
1674
|
return null;
|
|
1617
1675
|
}
|
|
@@ -1625,14 +1683,14 @@ var RouteManager = class _RouteManager {
|
|
|
1625
1683
|
groups.set(key, entries);
|
|
1626
1684
|
}
|
|
1627
1685
|
const normalizedFrom = interceptFrom ? this.toRoutePathname(new URL(interceptFrom, "http://farm.local").pathname) : void 0;
|
|
1628
|
-
const normalizedFromParts = normalizedFrom ?
|
|
1686
|
+
const normalizedFromParts = normalizedFrom ? _chunkGC5ROI3Acjs.splitRoutePath.call(void 0, normalizedFrom) : void 0;
|
|
1629
1687
|
const matches = [];
|
|
1630
1688
|
for (const entries of groups.values()) {
|
|
1631
1689
|
const candidates = entries.filter((entry) => !entry.fallback).filter(
|
|
1632
1690
|
(entry) => !entry.interception || normalizedFrom !== void 0 && this.matchesRoutePrefix(normalizedFrom, entry.ownerPattern, normalizedFromParts)
|
|
1633
1691
|
).map((entry) => ({
|
|
1634
1692
|
entry,
|
|
1635
|
-
match:
|
|
1693
|
+
match: _chunkGC5ROI3Acjs.matchRouteParts.call(void 0, pathnameParts, entry.route.segments)
|
|
1636
1694
|
})).filter((candidate) => candidate.match.matches).sort((left, right) => {
|
|
1637
1695
|
if (left.entry.interception !== right.entry.interception) {
|
|
1638
1696
|
return left.entry.interception ? -1 : 1;
|
|
@@ -1672,25 +1730,25 @@ var RouteManager = class _RouteManager {
|
|
|
1672
1730
|
return ownerDifference || left.name.localeCompare(right.name);
|
|
1673
1731
|
});
|
|
1674
1732
|
}
|
|
1675
|
-
matchesRoutePrefix(pathname, pattern, pathnameParts =
|
|
1733
|
+
matchesRoutePrefix(pathname, pattern, pathnameParts = _chunkGC5ROI3Acjs.splitRoutePath.call(void 0, pathname)) {
|
|
1676
1734
|
if (pattern === "/") return true;
|
|
1677
|
-
const patternSegments = _nullishCoalesce(this.routeSlotOwnerSegments.get(pattern), () => (
|
|
1678
|
-
return
|
|
1735
|
+
const patternSegments = _nullishCoalesce(this.routeSlotOwnerSegments.get(pattern), () => ( _chunkGC5ROI3Acjs.parseRoutePath.call(void 0, `${pattern}/page.tsx`).segments));
|
|
1736
|
+
return _chunkGC5ROI3Acjs.matchRoutePrefixParts.call(void 0, pathnameParts, patternSegments);
|
|
1679
1737
|
}
|
|
1680
1738
|
findNearestBoundary(pathname, boundaries, route) {
|
|
1681
1739
|
const normalizedPath = pathname === "/" ? "/" : pathname.replace(/\/$/, "");
|
|
1682
1740
|
let bestMatch = null;
|
|
1683
1741
|
let page = route;
|
|
1684
1742
|
for (const boundaryEntry of boundaries.values()) {
|
|
1685
|
-
if (!
|
|
1686
|
-
const groupScope =
|
|
1743
|
+
if (!_chunkGC5ROI3Acjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
|
|
1744
|
+
const groupScope = _chunk6ZFGWB75cjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
|
|
1687
1745
|
if (groupScope !== null) {
|
|
1688
|
-
if (page === void 0) page = this.matchPageRoute(
|
|
1689
|
-
if (!
|
|
1746
|
+
if (page === void 0) page = this.matchPageRoute(_chunkGC5ROI3Acjs.splitRoutePath.call(void 0, normalizedPath));
|
|
1747
|
+
if (!_chunk6ZFGWB75cjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
|
|
1690
1748
|
}
|
|
1691
1749
|
const depth = boundaryEntry.route.segments.length;
|
|
1692
|
-
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess',
|
|
1693
|
-
if (!bestMatch || depth > bestDepth || depth === bestDepth &&
|
|
1750
|
+
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _58 => _58.route, 'access', _59 => _59.segments, 'access', _60 => _60.length]), () => ( -1));
|
|
1751
|
+
if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunk6ZFGWB75cjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunk6ZFGWB75cjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
|
|
1694
1752
|
bestMatch = boundaryEntry;
|
|
1695
1753
|
}
|
|
1696
1754
|
}
|
|
@@ -1701,13 +1759,13 @@ var RouteManager = class _RouteManager {
|
|
|
1701
1759
|
*/
|
|
1702
1760
|
logRoutes() {
|
|
1703
1761
|
if (this.routes.size > 0) {
|
|
1704
|
-
|
|
1762
|
+
_chunkGC5ROI3Acjs.logger.info("Registered routes:");
|
|
1705
1763
|
for (const [pattern, entry] of this.routes) {
|
|
1706
1764
|
console.log(` ${pattern} -> ${entry.modulePath}`);
|
|
1707
1765
|
}
|
|
1708
1766
|
}
|
|
1709
1767
|
if (this.layouts.size > 0) {
|
|
1710
|
-
|
|
1768
|
+
_chunkGC5ROI3Acjs.logger.info("Registered layouts:");
|
|
1711
1769
|
for (const [pattern, entry] of this.layouts) {
|
|
1712
1770
|
console.log(` ${pattern} -> ${entry.modulePath}`);
|
|
1713
1771
|
}
|
|
@@ -1740,7 +1798,7 @@ var RouteManager = class _RouteManager {
|
|
|
1740
1798
|
}));
|
|
1741
1799
|
const i18n = this.getI18nConfig();
|
|
1742
1800
|
const docsAdapterRoutes = this.getDocsAdapterRoutes();
|
|
1743
|
-
const result = await
|
|
1801
|
+
const result = await _chunk7564NP5Zcjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
|
|
1744
1802
|
suggestStaticRendering: shouldSuggestStaticRenderingForI18n(i18n),
|
|
1745
1803
|
...docsAdapterRoutes ? { docsAdapterRoutes } : {}
|
|
1746
1804
|
});
|
|
@@ -1757,25 +1815,25 @@ var RouteManager = class _RouteManager {
|
|
|
1757
1815
|
ssg: result.ssg.flatMap(
|
|
1758
1816
|
(page) => i18n.locales.map((locale) => ({
|
|
1759
1817
|
...page,
|
|
1760
|
-
urlPath:
|
|
1818
|
+
urlPath: _chunkGYJT2U7Jcjs.localizeFarmPathname.call(void 0, page.urlPath, locale, i18n)
|
|
1761
1819
|
}))
|
|
1762
1820
|
),
|
|
1763
1821
|
ssr: result.ssr.flatMap(
|
|
1764
|
-
(routePath) => i18n.locales.map((locale) =>
|
|
1822
|
+
(routePath) => i18n.locales.map((locale) => _chunkGYJT2U7Jcjs.localizeFarmPathname.call(void 0, routePath, locale, i18n))
|
|
1765
1823
|
)
|
|
1766
1824
|
};
|
|
1767
1825
|
}
|
|
1768
1826
|
/** A request pathname as routes see it: without the basePath and, with i18n, the locale. */
|
|
1769
1827
|
toRoutePathname(pathname) {
|
|
1770
1828
|
const i18n = this.getI18nConfig();
|
|
1771
|
-
return i18n ?
|
|
1829
|
+
return i18n ? _chunkGYJT2U7Jcjs.stripFarmLocaleFromPathname.call(void 0, pathname, i18n) : _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, pathname, this.config.basePath);
|
|
1772
1830
|
}
|
|
1773
1831
|
localizeRedirectDestination(destination, locale) {
|
|
1774
1832
|
if (!destination.startsWith("/") || destination.startsWith("//")) {
|
|
1775
1833
|
return destination;
|
|
1776
1834
|
}
|
|
1777
1835
|
const i18n = this.getI18nConfig();
|
|
1778
|
-
return locale && i18n ?
|
|
1836
|
+
return locale && i18n ? _chunkGYJT2U7Jcjs.localizeFarmHref.call(void 0, destination, locale, i18n) : this.config.basePath ? _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, destination, this.config.basePath) : destination;
|
|
1779
1837
|
}
|
|
1780
1838
|
getI18nConfig() {
|
|
1781
1839
|
const i18n = this.config.i18n;
|
|
@@ -1787,7 +1845,7 @@ var RouteManager = class _RouteManager {
|
|
|
1787
1845
|
async isRouteSSG(modulePath) {
|
|
1788
1846
|
try {
|
|
1789
1847
|
const mod = await this.loadRouteModule(modulePath);
|
|
1790
|
-
const rendering = await
|
|
1848
|
+
const rendering = await _chunk7564NP5Zcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
1791
1849
|
return rendering.ssg;
|
|
1792
1850
|
} catch (e2) {
|
|
1793
1851
|
return false;
|
|
@@ -1799,7 +1857,7 @@ var RouteManager = class _RouteManager {
|
|
|
1799
1857
|
async hasRouteISR(modulePath) {
|
|
1800
1858
|
try {
|
|
1801
1859
|
const mod = await this.loadRouteModule(modulePath);
|
|
1802
|
-
const rendering = await
|
|
1860
|
+
const rendering = await _chunk7564NP5Zcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
1803
1861
|
return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
|
|
1804
1862
|
} catch (e3) {
|
|
1805
1863
|
return false;
|
|
@@ -1811,7 +1869,7 @@ var RouteManager = class _RouteManager {
|
|
|
1811
1869
|
async getRouteRevalidateInterval(modulePath) {
|
|
1812
1870
|
try {
|
|
1813
1871
|
const mod = await this.loadRouteModule(modulePath);
|
|
1814
|
-
const rendering = await
|
|
1872
|
+
const rendering = await _chunk7564NP5Zcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
1815
1873
|
return rendering.revalidate;
|
|
1816
1874
|
} catch (e4) {
|
|
1817
1875
|
return void 0;
|
|
@@ -1819,14 +1877,14 @@ var RouteManager = class _RouteManager {
|
|
|
1819
1877
|
}
|
|
1820
1878
|
};
|
|
1821
1879
|
function getPageDirectoryField(route, pattern) {
|
|
1822
|
-
const directory =
|
|
1880
|
+
const directory = _chunk6ZFGWB75cjs.createRouteDirectoryPattern.call(void 0, route);
|
|
1823
1881
|
return directory === pattern ? {} : { directory };
|
|
1824
1882
|
}
|
|
1825
1883
|
function interpolateRedirectDestination(destination, params, catchAllSegments = {}) {
|
|
1826
1884
|
let result = destination;
|
|
1827
1885
|
for (const [key, rawValue] of Object.entries(params)) {
|
|
1828
1886
|
const segments = catchAllSegments[key];
|
|
1829
|
-
const value = segments ? segments.map(
|
|
1887
|
+
const value = segments ? segments.map(_chunkFDZZ6K3Ncjs.encodeConfigRouteSegment).join("/") : _chunkFDZZ6K3Ncjs.encodeConfigRouteSegment.call(void 0, rawValue);
|
|
1830
1888
|
result = replaceAll(result, `[[...${key}]]`, value);
|
|
1831
1889
|
result = replaceAll(result, `[...${key}]`, value);
|
|
1832
1890
|
result = replaceAll(result, `[${key}]`, value);
|
|
@@ -1898,14 +1956,14 @@ function replaceAll(input, search, replacement) {
|
|
|
1898
1956
|
}
|
|
1899
1957
|
async function safeGlobFiles(pattern, cwd) {
|
|
1900
1958
|
try {
|
|
1901
|
-
return await
|
|
1959
|
+
return await _chunkGC5ROI3Acjs.globFiles.call(void 0, pattern, cwd);
|
|
1902
1960
|
} catch (e5) {
|
|
1903
1961
|
return [];
|
|
1904
1962
|
}
|
|
1905
1963
|
}
|
|
1906
1964
|
function toRealPath(filePath) {
|
|
1907
1965
|
try {
|
|
1908
|
-
return
|
|
1966
|
+
return fs2.default.realpathSync(filePath);
|
|
1909
1967
|
} catch (e6) {
|
|
1910
1968
|
return filePath;
|
|
1911
1969
|
}
|
|
@@ -1943,11 +2001,11 @@ function createFarmDevClientManifest(manifest, options) {
|
|
|
1943
2001
|
}
|
|
1944
2002
|
for (const layout of manifest.layouts) {
|
|
1945
2003
|
if (layoutPatterns && !layoutPatterns.has(layout.pattern)) continue;
|
|
1946
|
-
const groupScope =
|
|
2004
|
+
const groupScope = _chunk6ZFGWB75cjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
1947
2005
|
clientManifest.layouts[layout.pattern] = {
|
|
1948
2006
|
modulePath: layout.modulePath,
|
|
1949
2007
|
pattern: layout.pattern,
|
|
1950
|
-
...groupScope ? { urlPattern:
|
|
2008
|
+
...groupScope ? { urlPattern: _chunk6ZFGWB75cjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
|
|
1951
2009
|
shouldHydrate: layout.shouldHydrate,
|
|
1952
2010
|
islandStrategy: layout.islandStrategy,
|
|
1953
2011
|
// Islands mode: rebuilt from its server tree, so its module is never preloaded.
|
|
@@ -1963,32 +2021,6 @@ function createFarmDevClientManifest(manifest, options) {
|
|
|
1963
2021
|
return clientManifest;
|
|
1964
2022
|
}
|
|
1965
2023
|
|
|
1966
|
-
// src/server/dev-styles.ts
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
|
|
1970
|
-
const file = path3.join(root, srcDir, "app", "globals.css");
|
|
1971
|
-
if (!fs.existsSync(file)) return void 0;
|
|
1972
|
-
return `/${path3.relative(root, file).split(path3.sep).join("/")}`;
|
|
1973
|
-
}
|
|
1974
|
-
var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
|
|
1975
|
-
var ALREADY_LINKED = "/src/app/globals.css";
|
|
1976
|
-
function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, options = {}) {
|
|
1977
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1978
|
-
for (const mod of modules) {
|
|
1979
|
-
const id = _nullishCoalesce(_nullishCoalesce(mod.id, () => ( mod.file)), () => ( ""));
|
|
1980
|
-
if (!STYLE_EXTENSIONS.test(id)) continue;
|
|
1981
|
-
const cssModule = id.includes(".module.");
|
|
1982
|
-
if (cssModule && !options.cssModules) continue;
|
|
1983
|
-
const url = mod.url;
|
|
1984
|
-
if (!url || !url.startsWith("/")) continue;
|
|
1985
|
-
const bare = url.split("?")[0];
|
|
1986
|
-
if (bare === alreadyLinked) continue;
|
|
1987
|
-
seen.add(cssModule ? `${bare}?direct` : bare);
|
|
1988
|
-
}
|
|
1989
|
-
return [...seen].sort();
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
2024
|
// src/font-vite.ts
|
|
1993
2025
|
|
|
1994
2026
|
|
|
@@ -1997,6 +2029,7 @@ function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, optio
|
|
|
1997
2029
|
var _module = require('module');
|
|
1998
2030
|
var _url = require('url');
|
|
1999
2031
|
var FONT_IMPORTS = /* @__PURE__ */ new Set(["@farm.js/core", "@farm.js/core/font"]);
|
|
2032
|
+
var FARM_CORE_DIRECTORY = `${path4.default.dirname(typeof __filename === "string" ? __filename : _url.fileURLToPath.call(void 0, _chunkBTZ5O6VMcjs.define_import_meta_default.url)).replace(/\\/g, "/")}/`;
|
|
2000
2033
|
var FONT_FUNCTIONS = /* @__PURE__ */ new Set(["localFont", "remoteFont"]);
|
|
2001
2034
|
var FONT_CSS_PREFIX = "\0farm:font-css:";
|
|
2002
2035
|
var FONT_RUNTIME_ID = "\0farm:font-runtime";
|
|
@@ -2050,7 +2083,7 @@ function farmFontImportsPlugin(options = {}) {
|
|
|
2050
2083
|
return;
|
|
2051
2084
|
}
|
|
2052
2085
|
const resource = registry.getDevResource(pathname);
|
|
2053
|
-
if (!_optionalChain([resource, 'optionalAccess',
|
|
2086
|
+
if (!_optionalChain([resource, 'optionalAccess', _61 => _61.bytes])) {
|
|
2054
2087
|
next();
|
|
2055
2088
|
return;
|
|
2056
2089
|
}
|
|
@@ -2099,7 +2132,7 @@ function farmFontImportsPlugin(options = {}) {
|
|
|
2099
2132
|
}
|
|
2100
2133
|
async function transformFarmFontCalls(options) {
|
|
2101
2134
|
const cleanId = options.id.split("?", 1)[0];
|
|
2102
|
-
if (!MODULE_EXTENSION_RE.test(cleanId) || /\.d\.[cm]?ts$/.test(cleanId) || !containsFontFunction(options.code)) {
|
|
2135
|
+
if (!MODULE_EXTENSION_RE.test(cleanId) || /\.d\.[cm]?ts$/.test(cleanId) || !containsFontFunction(options.code) || cleanId.replace(/\\/g, "/").startsWith(FARM_CORE_DIRECTORY)) {
|
|
2103
2136
|
return null;
|
|
2104
2137
|
}
|
|
2105
2138
|
const ast = options.parse(options.code);
|
|
@@ -2351,7 +2384,7 @@ ${FONT_SECTION_END}
|
|
|
2351
2384
|
return resource;
|
|
2352
2385
|
}
|
|
2353
2386
|
const bytes2 = await fetchRemoteFont(url, input.integrity);
|
|
2354
|
-
return this.createSelfHostedResource(bytes2, extension,
|
|
2387
|
+
return this.createSelfHostedResource(bytes2, extension, path4.default.basename(url.pathname));
|
|
2355
2388
|
}
|
|
2356
2389
|
if (input.source.startsWith("/")) {
|
|
2357
2390
|
return this.createPublicResource(input.moduleId, input.source);
|
|
@@ -2374,8 +2407,8 @@ ${FONT_SECTION_END}
|
|
|
2374
2407
|
}
|
|
2375
2408
|
return this.createSelfHostedResource(
|
|
2376
2409
|
bytes,
|
|
2377
|
-
|
|
2378
|
-
|
|
2410
|
+
path4.default.extname(resolvedPath),
|
|
2411
|
+
path4.default.basename(resolvedPath)
|
|
2379
2412
|
);
|
|
2380
2413
|
}
|
|
2381
2414
|
async createPublicResource(moduleId, source) {
|
|
@@ -2386,7 +2419,7 @@ ${FONT_SECTION_END}
|
|
|
2386
2419
|
);
|
|
2387
2420
|
}
|
|
2388
2421
|
const publicPath = normalizePublicFontPath(source, moduleId);
|
|
2389
|
-
const resolvedPath =
|
|
2422
|
+
const resolvedPath = path4.default.resolve(this.publicDir, `.${publicPath}`);
|
|
2390
2423
|
if (!isPathInside(this.publicDir, resolvedPath)) {
|
|
2391
2424
|
throw fontError(moduleId, `public font path must stay inside publicDir`);
|
|
2392
2425
|
}
|
|
@@ -2402,7 +2435,7 @@ ${FONT_SECTION_END}
|
|
|
2402
2435
|
`could not read ${JSON.stringify(source)} from publicDir: ${error.message}`
|
|
2403
2436
|
);
|
|
2404
2437
|
}
|
|
2405
|
-
const extension =
|
|
2438
|
+
const extension = path4.default.extname(resolvedPath).toLowerCase();
|
|
2406
2439
|
const hash = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex").slice(0, 12);
|
|
2407
2440
|
const resource = {
|
|
2408
2441
|
extension,
|
|
@@ -2417,7 +2450,7 @@ ${FONT_SECTION_END}
|
|
|
2417
2450
|
createSelfHostedResource(bytes, extension, fileName) {
|
|
2418
2451
|
const normalizedExtension = extension.toLowerCase();
|
|
2419
2452
|
const hash = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex").slice(0, 12);
|
|
2420
|
-
const baseName = sanitizeFileName(
|
|
2453
|
+
const baseName = sanitizeFileName(path4.default.basename(fileName, extension)) || "font";
|
|
2421
2454
|
const outputFileName = `assets/fonts/${baseName}-h${hash}${normalizedExtension}`;
|
|
2422
2455
|
const key = `${hash}${normalizedExtension}`;
|
|
2423
2456
|
const existing = this.resources.get(key);
|
|
@@ -2568,7 +2601,7 @@ function readFontOptions(code, id, call) {
|
|
|
2568
2601
|
const declaration = call.ancestors.at(-2);
|
|
2569
2602
|
const statement = call.ancestors.at(-3);
|
|
2570
2603
|
const statementParent = call.ancestors.at(-4);
|
|
2571
|
-
const isModuleScope = _optionalChain([declaration, 'optionalAccess',
|
|
2604
|
+
const isModuleScope = _optionalChain([declaration, 'optionalAccess', _62 => _62.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _63 => _63.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _64 => _64.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _65 => _65.type]) === "Program");
|
|
2572
2605
|
if (!isModuleScope || call.ancestors.some((ancestor) => isFunctionNode(ancestor))) {
|
|
2573
2606
|
throw fontError(id, `${call.kind}() must be declared directly at module scope`);
|
|
2574
2607
|
}
|
|
@@ -2770,24 +2803,24 @@ function verifyIntegrity(bytes, integrity) {
|
|
|
2770
2803
|
if (!matches) throw new Error("downloaded font did not match its integrity value");
|
|
2771
2804
|
}
|
|
2772
2805
|
function resolveLocalFontPath(source, importer, root) {
|
|
2773
|
-
if (source.startsWith(".")) return
|
|
2774
|
-
if (
|
|
2806
|
+
if (source.startsWith(".")) return path4.default.resolve(path4.default.dirname(importer), source);
|
|
2807
|
+
if (path4.default.isAbsolute(source)) {
|
|
2775
2808
|
return source;
|
|
2776
2809
|
}
|
|
2777
2810
|
try {
|
|
2778
2811
|
return _module.createRequire.call(void 0, _url.pathToFileURL.call(void 0, importer)).resolve(source);
|
|
2779
2812
|
} catch (e8) {
|
|
2780
2813
|
const segments = source.replace(/\\/g, "/").split("/");
|
|
2781
|
-
if (segments.includes("..")) return
|
|
2782
|
-
let current =
|
|
2783
|
-
const filesystemRoot =
|
|
2814
|
+
if (segments.includes("..")) return path4.default.resolve(root, source);
|
|
2815
|
+
let current = path4.default.dirname(importer);
|
|
2816
|
+
const filesystemRoot = path4.default.parse(current).root;
|
|
2784
2817
|
while (true) {
|
|
2785
|
-
const candidate =
|
|
2818
|
+
const candidate = path4.default.join(current, "node_modules", ...segments);
|
|
2786
2819
|
if (_fs.existsSync.call(void 0, candidate)) return candidate;
|
|
2787
2820
|
if (current === filesystemRoot) break;
|
|
2788
|
-
current =
|
|
2821
|
+
current = path4.default.dirname(current);
|
|
2789
2822
|
}
|
|
2790
|
-
return
|
|
2823
|
+
return path4.default.resolve(root, "node_modules", ...segments);
|
|
2791
2824
|
}
|
|
2792
2825
|
}
|
|
2793
2826
|
function replaceFontSection(css, section) {
|
|
@@ -2820,11 +2853,11 @@ function getGlobalMap(key) {
|
|
|
2820
2853
|
return created;
|
|
2821
2854
|
}
|
|
2822
2855
|
function normalizeRoot(root) {
|
|
2823
|
-
return
|
|
2856
|
+
return path4.default.resolve(root).replace(/\\/g, "/");
|
|
2824
2857
|
}
|
|
2825
2858
|
function normalizePublicDir(root, publicDir) {
|
|
2826
2859
|
if (publicDir === false || publicDir === "") return false;
|
|
2827
|
-
return
|
|
2860
|
+
return path4.default.resolve(root, publicDir || "public");
|
|
2828
2861
|
}
|
|
2829
2862
|
function normalizePublicFontPath(source, moduleId) {
|
|
2830
2863
|
if (source.includes("?") || source.includes("#")) {
|
|
@@ -2833,8 +2866,8 @@ function normalizePublicFontPath(source, moduleId) {
|
|
|
2833
2866
|
return `/${source.replace(/\\/g, "/").replace(/^\/+/, "")}`;
|
|
2834
2867
|
}
|
|
2835
2868
|
function isPathInside(parent, child) {
|
|
2836
|
-
const relative3 =
|
|
2837
|
-
return relative3 === "" || !relative3.startsWith("..") && !
|
|
2869
|
+
const relative3 = path4.default.relative(parent, child);
|
|
2870
|
+
return relative3 === "" || !relative3.startsWith("..") && !path4.default.isAbsolute(relative3);
|
|
2838
2871
|
}
|
|
2839
2872
|
function normalizeBasePath(value) {
|
|
2840
2873
|
if (!value || value === "/") return "/";
|
|
@@ -2844,7 +2877,7 @@ function joinBasePath(basePath, value) {
|
|
|
2844
2877
|
return basePath === "/" ? value : `${basePath.replace(/\/$/, "")}${value}`;
|
|
2845
2878
|
}
|
|
2846
2879
|
function extensionFromPath(pathname) {
|
|
2847
|
-
const extension =
|
|
2880
|
+
const extension = path4.default.extname(pathname).toLowerCase();
|
|
2848
2881
|
if (!FONT_EXTENSION_RE.test(extension)) {
|
|
2849
2882
|
throw new Error(`[Farm fonts] Remote font URL must end in .woff2, .woff, .ttf, or .otf`);
|
|
2850
2883
|
}
|
|
@@ -2983,6 +3016,49 @@ function fontError(id, message) {
|
|
|
2983
3016
|
return new Error(`[Farm fonts] ${message} in ${id.split("?", 1)[0]}`);
|
|
2984
3017
|
}
|
|
2985
3018
|
|
|
3019
|
+
// src/server/dev-styles.ts
|
|
3020
|
+
|
|
3021
|
+
|
|
3022
|
+
function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
|
|
3023
|
+
const file = path4.join(root, srcDir, "app", "globals.css");
|
|
3024
|
+
if (!fs2.existsSync(file)) return void 0;
|
|
3025
|
+
return `/${path4.relative(root, file).split(path4.sep).join("/")}`;
|
|
3026
|
+
}
|
|
3027
|
+
var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
|
|
3028
|
+
var ALREADY_LINKED = "/src/app/globals.css";
|
|
3029
|
+
function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED, options = {}) {
|
|
3030
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3031
|
+
for (const mod of modules) {
|
|
3032
|
+
const id = _nullishCoalesce(_nullishCoalesce(mod.id, () => ( mod.file)), () => ( ""));
|
|
3033
|
+
if (!STYLE_EXTENSIONS.test(id)) continue;
|
|
3034
|
+
const cssModule = id.includes(".module.");
|
|
3035
|
+
if (cssModule && !options.cssModules) continue;
|
|
3036
|
+
const url = mod.url;
|
|
3037
|
+
if (!url || !url.startsWith("/")) continue;
|
|
3038
|
+
const bare = url.split("?")[0];
|
|
3039
|
+
if (bare === alreadyLinked) continue;
|
|
3040
|
+
seen.add(cssModule ? `${bare}?direct` : bare);
|
|
3041
|
+
}
|
|
3042
|
+
return [...seen].sort();
|
|
3043
|
+
}
|
|
3044
|
+
var SERVER_STYLESHEET_FILE = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/;
|
|
3045
|
+
function farmDevServerStylesheetsPlugin() {
|
|
3046
|
+
return {
|
|
3047
|
+
name: "farm:dev-server-stylesheets",
|
|
3048
|
+
apply: "serve",
|
|
3049
|
+
enforce: "pre",
|
|
3050
|
+
applyToEnvironment: (environment) => environment.config.consumer === "server",
|
|
3051
|
+
load: {
|
|
3052
|
+
filter: { id: SERVER_STYLESHEET_FILE },
|
|
3053
|
+
handler(id) {
|
|
3054
|
+
if (id.startsWith("\0") && !id.startsWith(FONT_CSS_PREFIX)) return null;
|
|
3055
|
+
if (/\.module\.[^./]+$/.test(id)) return null;
|
|
3056
|
+
return "";
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
};
|
|
3060
|
+
}
|
|
3061
|
+
|
|
2986
3062
|
// src/integration-provider-build.ts
|
|
2987
3063
|
|
|
2988
3064
|
function isRendererCompiledComponent(moduleId, rendererComponentExtensions) {
|
|
@@ -3004,7 +3080,7 @@ function generateFarmIntegrationProviderClientCode(providers, root, rendererComp
|
|
|
3004
3080
|
let hasClerkProvider = false;
|
|
3005
3081
|
renderedProviders.forEach((provider, index) => {
|
|
3006
3082
|
let componentExpression = "null";
|
|
3007
|
-
if (
|
|
3083
|
+
if (_chunkOWO7KDZ3cjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
|
|
3008
3084
|
const namespace = `FarmIntegrationProviderModule${index}`;
|
|
3009
3085
|
imports.push(
|
|
3010
3086
|
`import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
|
|
@@ -3061,7 +3137,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
|
|
|
3061
3137
|
const entries = [];
|
|
3062
3138
|
let needsMarkHelper = false;
|
|
3063
3139
|
providers.forEach((provider, index) => {
|
|
3064
|
-
if (!
|
|
3140
|
+
if (!_chunkOWO7KDZ3cjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
|
|
3065
3141
|
const namespace = `FarmServerIntegrationProviderModule${index}`;
|
|
3066
3142
|
imports.push(
|
|
3067
3143
|
`import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
|
|
@@ -3086,7 +3162,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
|
|
|
3086
3162
|
}
|
|
3087
3163
|
function resolveProviderModule(moduleId, root) {
|
|
3088
3164
|
if (!moduleId.startsWith(".")) return moduleId;
|
|
3089
|
-
return
|
|
3165
|
+
return _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, path4.default.resolve(root, moduleId), root);
|
|
3090
3166
|
}
|
|
3091
3167
|
|
|
3092
3168
|
// src/island-inference.ts
|
|
@@ -3102,34 +3178,34 @@ var PARSE_LANGS = /* @__PURE__ */ new Map([
|
|
|
3102
3178
|
[".mjs", "js"]
|
|
3103
3179
|
]);
|
|
3104
3180
|
function parseFarmIslandSource(file, code) {
|
|
3105
|
-
const lang = PARSE_LANGS.get(
|
|
3106
|
-
if (!lang) throw new Error(`${
|
|
3181
|
+
const lang = PARSE_LANGS.get(path4.default.extname(file));
|
|
3182
|
+
if (!lang) throw new Error(`${path4.default.basename(file)} is not a script module`);
|
|
3107
3183
|
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
3108
3184
|
}
|
|
3109
3185
|
function modifiedAt(file) {
|
|
3110
3186
|
try {
|
|
3111
|
-
return
|
|
3187
|
+
return fs2.default.statSync(file).mtimeMs;
|
|
3112
3188
|
} catch (e9) {
|
|
3113
3189
|
return -1;
|
|
3114
3190
|
}
|
|
3115
3191
|
}
|
|
3116
3192
|
var inferences = /* @__PURE__ */ new Map();
|
|
3117
3193
|
function inferFarmIslandStrategy(filePath, root) {
|
|
3118
|
-
const file =
|
|
3194
|
+
const file = path4.default.resolve(filePath);
|
|
3119
3195
|
const cached = inferences.get(file);
|
|
3120
3196
|
if (cached && cached.stamps.every(([read, stamp]) => modifiedAt(read) === stamp)) {
|
|
3121
3197
|
return cached.result;
|
|
3122
3198
|
}
|
|
3123
3199
|
let code;
|
|
3124
3200
|
try {
|
|
3125
|
-
code =
|
|
3201
|
+
code = fs2.default.readFileSync(file, "utf8");
|
|
3126
3202
|
} catch (e10) {
|
|
3127
|
-
return { strategy: null, files: [file], reason: `${
|
|
3203
|
+
return { strategy: null, files: [file], reason: `${path4.default.basename(file)} could not be read` };
|
|
3128
3204
|
}
|
|
3129
3205
|
const result = _compiler.inferStrategy.call(void 0, file, code, {
|
|
3130
3206
|
parse: parseFarmIslandSource,
|
|
3131
3207
|
resolve: (specifier, importer) => {
|
|
3132
|
-
const resolved =
|
|
3208
|
+
const resolved = _chunkQP4GYVRRcjs.resolveImportedModule.call(void 0, importer, specifier, root);
|
|
3133
3209
|
return resolved.local ? resolved.path : null;
|
|
3134
3210
|
}
|
|
3135
3211
|
});
|
|
@@ -3144,12 +3220,12 @@ function invalidateFarmRouteRootInferences() {
|
|
|
3144
3220
|
routeRootInferences.clear();
|
|
3145
3221
|
}
|
|
3146
3222
|
function inferFarmRouteRootStrategy(owners, root) {
|
|
3147
|
-
const key = [_nullishCoalesce(root, () => ( "")), ...owners.map((owner) =>
|
|
3223
|
+
const key = [_nullishCoalesce(root, () => ( "")), ...owners.map((owner) => path4.default.resolve(owner))].join("\n");
|
|
3148
3224
|
const cached = routeRootInferences.get(key);
|
|
3149
3225
|
if (cached && cached.stamps.every(([read2, stamp]) => modifiedAt(read2) === stamp)) {
|
|
3150
3226
|
return cached.result;
|
|
3151
3227
|
}
|
|
3152
|
-
const { result, files } =
|
|
3228
|
+
const { result, files } = _chunkQP4GYVRRcjs.traceFarmSourceReads.call(void 0, () => inferRouteRoot(owners, root));
|
|
3153
3229
|
const read = new Set([...files, ...result.files].filter((file) => !isInstalledPackageFile(file)));
|
|
3154
3230
|
routeRootInferences.set(key, {
|
|
3155
3231
|
stamps: [...read].map((file) => [file, modifiedAt(file)]),
|
|
@@ -3158,20 +3234,20 @@ function inferFarmRouteRootStrategy(owners, root) {
|
|
|
3158
3234
|
return result;
|
|
3159
3235
|
}
|
|
3160
3236
|
var NODE_MODULES = "node_modules";
|
|
3161
|
-
var NODE_MODULES_SEGMENT2 = `${
|
|
3237
|
+
var NODE_MODULES_SEGMENT2 = `${path4.default.sep}${NODE_MODULES}${path4.default.sep}`;
|
|
3162
3238
|
function isInstalledPackageFile(file) {
|
|
3163
|
-
return file.includes(NODE_MODULES_SEGMENT2) || file.startsWith(`${NODE_MODULES}${
|
|
3239
|
+
return file.includes(NODE_MODULES_SEGMENT2) || file.startsWith(`${NODE_MODULES}${path4.default.sep}`) || file.endsWith(`${path4.default.sep}${NODE_MODULES}`) || file === NODE_MODULES;
|
|
3164
3240
|
}
|
|
3165
3241
|
function inferRouteRoot(owners, root) {
|
|
3166
3242
|
const files = [];
|
|
3167
3243
|
const modules = [];
|
|
3168
3244
|
for (const owner of owners) {
|
|
3169
|
-
const rendered =
|
|
3245
|
+
const rendered = _chunkQP4GYVRRcjs.collectFarmRenderedClientModules.call(void 0, owner, root);
|
|
3170
3246
|
if (!rendered) {
|
|
3171
3247
|
return {
|
|
3172
3248
|
strategy: null,
|
|
3173
3249
|
files,
|
|
3174
|
-
reason: `${
|
|
3250
|
+
reason: `${path4.default.basename(owner)}: its client components could not be listed`
|
|
3175
3251
|
};
|
|
3176
3252
|
}
|
|
3177
3253
|
modules.push(...rendered);
|
|
@@ -3179,10 +3255,10 @@ function inferRouteRoot(owners, root) {
|
|
|
3179
3255
|
for (const module of modules) {
|
|
3180
3256
|
let source = null;
|
|
3181
3257
|
try {
|
|
3182
|
-
source =
|
|
3258
|
+
source = fs2.default.readFileSync(module, "utf8");
|
|
3183
3259
|
} catch (e11) {
|
|
3184
3260
|
}
|
|
3185
|
-
if (
|
|
3261
|
+
if (_chunkQP4GYVRRcjs.getIslandStrategyExport.call(void 0, source) !== null) return { strategy: null, files, declared: true };
|
|
3186
3262
|
}
|
|
3187
3263
|
for (const module of modules) {
|
|
3188
3264
|
const result = inferFarmIslandStrategy(module, root);
|
|
@@ -3194,7 +3270,7 @@ function inferRouteRoot(owners, root) {
|
|
|
3194
3270
|
function resolveFarmRouteRootStrategy(route, page, layouts, root, islandsMode) {
|
|
3195
3271
|
const directory = _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
3196
3272
|
const onRoute = layouts.filter(
|
|
3197
|
-
(layout) =>
|
|
3273
|
+
(layout) => _chunk6ZFGWB75cjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, directory)
|
|
3198
3274
|
);
|
|
3199
3275
|
const declared = [
|
|
3200
3276
|
...page.islandStrategy ? [page.islandStrategy] : [],
|
|
@@ -3227,15 +3303,15 @@ var _stream = require('stream');
|
|
|
3227
3303
|
|
|
3228
3304
|
function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
3229
3305
|
const extensions = _chunk67MZTLTFcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
|
|
3230
|
-
const configuredPath = _optionalChain([config, 'access',
|
|
3306
|
+
const configuredPath = _optionalChain([config, 'access', _66 => _66.notFound, 'optionalAccess', _67 => _67.component, 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]);
|
|
3231
3307
|
if (configuredPath) {
|
|
3232
|
-
const componentPath =
|
|
3308
|
+
const componentPath = path4.default.isAbsolute(configuredPath) ? path4.default.normalize(configuredPath) : path4.default.resolve(config.root, configuredPath);
|
|
3233
3309
|
if (!extensions.some((extension) => componentPath.endsWith(extension))) {
|
|
3234
3310
|
throw new Error(
|
|
3235
3311
|
`notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
|
|
3236
3312
|
);
|
|
3237
3313
|
}
|
|
3238
|
-
if (!
|
|
3314
|
+
if (!fs2.default.existsSync(componentPath) || !fs2.default.statSync(componentPath).isFile()) {
|
|
3239
3315
|
throw new Error(`notFound.component was not found: ${componentPath}`);
|
|
3240
3316
|
}
|
|
3241
3317
|
return componentPath;
|
|
@@ -3243,8 +3319,8 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
|
3243
3319
|
let discoveredPath = null;
|
|
3244
3320
|
for (const appDir of appDirs) {
|
|
3245
3321
|
for (const extension of extensions) {
|
|
3246
|
-
const candidate =
|
|
3247
|
-
if (
|
|
3322
|
+
const candidate = path4.default.join(appDir, `not-found${extension}`);
|
|
3323
|
+
if (fs2.default.existsSync(candidate) && fs2.default.statSync(candidate).isFile()) {
|
|
3248
3324
|
discoveredPath = candidate;
|
|
3249
3325
|
break;
|
|
3250
3326
|
}
|
|
@@ -3265,11 +3341,11 @@ function getFarmLayoutKey(pattern, params) {
|
|
|
3265
3341
|
);
|
|
3266
3342
|
}
|
|
3267
3343
|
function countFarmKeptLayouts(layoutsHeader, layouts, params) {
|
|
3268
|
-
const chain =
|
|
3344
|
+
const chain = _chunk6ZFGWB75cjs.parseFarmLayoutChainHeader.call(void 0, _nullishCoalesce(layoutsHeader, () => ( null)));
|
|
3269
3345
|
if (chain.length === 0) return 0;
|
|
3270
3346
|
const keys = layouts.map((layout) => getFarmLayoutKey(layout.pattern, params));
|
|
3271
|
-
if (chain[0] === keys[0]) return
|
|
3272
|
-
return keys.length > 1 ? 1 +
|
|
3347
|
+
if (chain[0] === keys[0]) return _chunk6ZFGWB75cjs.getSharedLayoutPrefixLength.call(void 0, chain, keys);
|
|
3348
|
+
return keys.length > 1 ? 1 + _chunk6ZFGWB75cjs.getSharedLayoutPrefixLength.call(void 0, chain, keys.slice(1)) : 0;
|
|
3273
3349
|
}
|
|
3274
3350
|
function createFarmFlushToken() {
|
|
3275
3351
|
const bytes = new Uint8Array(16);
|
|
@@ -3469,7 +3545,7 @@ function findStackLocation(stack, root) {
|
|
|
3469
3545
|
const candidate = normalizeStackPath(match[1]);
|
|
3470
3546
|
if (!candidate || candidate.includes(`${path8.sep}node_modules${path8.sep}`)) continue;
|
|
3471
3547
|
const absolutePath = path8.resolve(candidate);
|
|
3472
|
-
if (!isPathInsideRoot(root, absolutePath) || !
|
|
3548
|
+
if (!isPathInsideRoot(root, absolutePath) || !fs5.existsSync(absolutePath)) continue;
|
|
3473
3549
|
const relativePath = path8.relative(root, absolutePath).split(path8.sep).join("/");
|
|
3474
3550
|
return {
|
|
3475
3551
|
absolutePath,
|
|
@@ -3482,7 +3558,7 @@ function findStackLocation(stack, root) {
|
|
|
3482
3558
|
}
|
|
3483
3559
|
function createSourceFrame(location) {
|
|
3484
3560
|
try {
|
|
3485
|
-
const sourceLines =
|
|
3561
|
+
const sourceLines = fs5.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
|
|
3486
3562
|
if (location.line < 1 || location.line > sourceLines.length) return void 0;
|
|
3487
3563
|
const start = Math.max(1, location.line - 2);
|
|
3488
3564
|
const end = Math.min(sourceLines.length, location.line + 2);
|
|
@@ -3524,7 +3600,245 @@ function createDefaultErrorDiagnostics(error, root) {
|
|
|
3524
3600
|
function canBootFarmIslandsClient(config) {
|
|
3525
3601
|
const docs = config.docs;
|
|
3526
3602
|
const docsEnabled = docs === true || typeof docs === "object" && docs !== null && docs.enabled !== false;
|
|
3527
|
-
return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3603
|
+
return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _70 => _70.experimental, 'optionalAccess', _71 => _71.serverComponents])) === "islands" && !docsEnabled && _chunkQTDIOZV6cjs.resolveFarmClientPlugins.call(void 0, config.plugins, config.root).length === 0 && !_chunkQTDIOZV6cjs.resolveFarmAppClientEntry.call(void 0, config.root, config.srcDir || "src");
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
// src/islands-kept-layouts.ts
|
|
3607
|
+
|
|
3608
|
+
|
|
3609
|
+
|
|
3610
|
+
var SCRIPT_SOURCE = /\.[cm]?[jt]sx?$/;
|
|
3611
|
+
var ASSET_SOURCE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss|svg|png|jpe?g|gif|webp|avif|ico|woff2?|ttf|otf)$/;
|
|
3612
|
+
var PURE_PACKAGE_IMPORTS = /* @__PURE__ */ new Map([
|
|
3613
|
+
["react", "*"],
|
|
3614
|
+
["react/jsx-runtime", "*"],
|
|
3615
|
+
["react/jsx-dev-runtime", "*"],
|
|
3616
|
+
["@farm.js/core/client", /* @__PURE__ */ new Set(["Link"])]
|
|
3617
|
+
]);
|
|
3618
|
+
var IMPURE_GLOBALS = /* @__PURE__ */ new Set([
|
|
3619
|
+
"process",
|
|
3620
|
+
"globalThis",
|
|
3621
|
+
"global",
|
|
3622
|
+
"window",
|
|
3623
|
+
"self",
|
|
3624
|
+
"Date",
|
|
3625
|
+
"crypto",
|
|
3626
|
+
"fetch",
|
|
3627
|
+
"require",
|
|
3628
|
+
"eval",
|
|
3629
|
+
"Function",
|
|
3630
|
+
"performance",
|
|
3631
|
+
"setTimeout",
|
|
3632
|
+
"setInterval",
|
|
3633
|
+
"queueMicrotask",
|
|
3634
|
+
"AsyncLocalStorage"
|
|
3635
|
+
]);
|
|
3636
|
+
var DECLARATION_STATEMENTS = /* @__PURE__ */ new Set([
|
|
3637
|
+
"ImportDeclaration",
|
|
3638
|
+
"FunctionDeclaration",
|
|
3639
|
+
"VariableDeclaration",
|
|
3640
|
+
"ClassDeclaration",
|
|
3641
|
+
"TSTypeAliasDeclaration",
|
|
3642
|
+
"TSInterfaceDeclaration",
|
|
3643
|
+
"TSEnumDeclaration",
|
|
3644
|
+
"TSModuleDeclaration",
|
|
3645
|
+
"TSDeclareFunction",
|
|
3646
|
+
"EmptyStatement"
|
|
3647
|
+
]);
|
|
3648
|
+
function parse(code, file) {
|
|
3649
|
+
const extension = path4.default.extname(file).slice(1);
|
|
3650
|
+
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : extension === "js" || extension === "mjs" || extension === "cjs" || extension === "jsx" ? "jsx" : "tsx";
|
|
3651
|
+
return _chunkQP4GYVRRcjs.memoizeInFarmSourceSnapshot.call(void 0, `ast:${lang}`, code, () => {
|
|
3652
|
+
try {
|
|
3653
|
+
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
3654
|
+
} catch (e14) {
|
|
3655
|
+
return null;
|
|
3656
|
+
}
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
3659
|
+
function findFarmRequestDecidingConstruct(code, file) {
|
|
3660
|
+
const program = parse(code, file);
|
|
3661
|
+
if (!program) return { reason: "the module does not parse", imports: [] };
|
|
3662
|
+
const imports = [];
|
|
3663
|
+
let reason = null;
|
|
3664
|
+
for (const statement of program.body) {
|
|
3665
|
+
if (statement.type === "ImportDeclaration") {
|
|
3666
|
+
if (statement.importKind === "type") continue;
|
|
3667
|
+
const names = [];
|
|
3668
|
+
for (const specifier of _nullishCoalesce(statement.specifiers, () => ( []))) {
|
|
3669
|
+
if (specifier.importKind === "type") continue;
|
|
3670
|
+
if (specifier.type === "ImportSpecifier") {
|
|
3671
|
+
names.push(_nullishCoalesce(specifier.imported.name, () => ( specifier.imported.value)));
|
|
3672
|
+
} else if (specifier.type === "ImportDefaultSpecifier") names.push("default");
|
|
3673
|
+
else names.push("*");
|
|
3674
|
+
}
|
|
3675
|
+
if ((_nullishCoalesce(statement.specifiers, () => ( []))).length === 0 || names.length > 0) {
|
|
3676
|
+
imports.push({ source: statement.source.value, names });
|
|
3677
|
+
}
|
|
3678
|
+
continue;
|
|
3679
|
+
}
|
|
3680
|
+
if (statement.type === "ExportAllDeclaration") {
|
|
3681
|
+
if (statement.exportKind !== "type")
|
|
3682
|
+
imports.push({ source: statement.source.value, names: ["*"] });
|
|
3683
|
+
continue;
|
|
3684
|
+
}
|
|
3685
|
+
if (statement.type === "ExportNamedDeclaration") {
|
|
3686
|
+
if (statement.source && statement.exportKind !== "type") {
|
|
3687
|
+
imports.push({
|
|
3688
|
+
source: statement.source.value,
|
|
3689
|
+
names: (_nullishCoalesce(statement.specifiers, () => ( []))).filter((specifier) => specifier.exportKind !== "type").map((specifier) => _nullishCoalesce(specifier.local.name, () => ( specifier.local.value)))
|
|
3690
|
+
});
|
|
3691
|
+
}
|
|
3692
|
+
continue;
|
|
3693
|
+
}
|
|
3694
|
+
if (statement.type === "ExportDefaultDeclaration") continue;
|
|
3695
|
+
if (statement.type === "ExpressionStatement" && typeof statement.directive === "string") {
|
|
3696
|
+
continue;
|
|
3697
|
+
}
|
|
3698
|
+
if (!DECLARATION_STATEMENTS.has(statement.type)) {
|
|
3699
|
+
_nullishCoalesce(reason, () => ( (reason = `a top-level ${statement.type}`)));
|
|
3700
|
+
}
|
|
3701
|
+
}
|
|
3702
|
+
const visit = (node, parent, key) => {
|
|
3703
|
+
if (reason || !node || typeof node !== "object") return;
|
|
3704
|
+
if (Array.isArray(node)) {
|
|
3705
|
+
for (const child of node) visit(child, parent, key);
|
|
3706
|
+
return;
|
|
3707
|
+
}
|
|
3708
|
+
const current = node;
|
|
3709
|
+
if (typeof current.type !== "string") return;
|
|
3710
|
+
switch (current.type) {
|
|
3711
|
+
case "ThrowStatement":
|
|
3712
|
+
reason = "a throw statement";
|
|
3713
|
+
return;
|
|
3714
|
+
case "AwaitExpression":
|
|
3715
|
+
reason = "an await expression";
|
|
3716
|
+
return;
|
|
3717
|
+
case "YieldExpression":
|
|
3718
|
+
reason = "a generator";
|
|
3719
|
+
return;
|
|
3720
|
+
case "ImportExpression":
|
|
3721
|
+
reason = "a dynamic import()";
|
|
3722
|
+
return;
|
|
3723
|
+
case "ForOfStatement":
|
|
3724
|
+
if (current.await) {
|
|
3725
|
+
reason = "a for await loop";
|
|
3726
|
+
return;
|
|
3727
|
+
}
|
|
3728
|
+
break;
|
|
3729
|
+
case "FunctionDeclaration":
|
|
3730
|
+
case "FunctionExpression":
|
|
3731
|
+
case "ArrowFunctionExpression":
|
|
3732
|
+
if (current.async || current.generator) {
|
|
3733
|
+
reason = current.async ? "an async function" : "a generator";
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
break;
|
|
3737
|
+
case "MetaProperty":
|
|
3738
|
+
reason = "import.meta";
|
|
3739
|
+
return;
|
|
3740
|
+
case "CallExpression":
|
|
3741
|
+
if (_optionalChain([current, 'access', _72 => _72.callee, 'optionalAccess', _73 => _73.type]) === "Identifier" && current.callee.name === "use") {
|
|
3742
|
+
reason = "a use() call";
|
|
3743
|
+
return;
|
|
3744
|
+
}
|
|
3745
|
+
if (_optionalChain([current, 'access', _74 => _74.callee, 'optionalAccess', _75 => _75.type]) === "MemberExpression" && !current.callee.computed && _optionalChain([current, 'access', _76 => _76.callee, 'access', _77 => _77.object, 'optionalAccess', _78 => _78.type]) === "Identifier" && current.callee.object.name === "Math" && _optionalChain([current, 'access', _79 => _79.callee, 'access', _80 => _80.property, 'optionalAccess', _81 => _81.name]) === "random") {
|
|
3746
|
+
reason = "Math.random()";
|
|
3747
|
+
return;
|
|
3748
|
+
}
|
|
3749
|
+
break;
|
|
3750
|
+
case "Identifier":
|
|
3751
|
+
if (IMPURE_GLOBALS.has(current.name) && isReference(current, parent, key)) {
|
|
3752
|
+
reason = `the global ${current.name}`;
|
|
3753
|
+
return;
|
|
3754
|
+
}
|
|
3755
|
+
break;
|
|
3756
|
+
}
|
|
3757
|
+
for (const [childKey, value] of Object.entries(current)) {
|
|
3758
|
+
if (childKey === "start" || childKey === "end" || childKey === "loc" || childKey === "range") {
|
|
3759
|
+
continue;
|
|
3760
|
+
}
|
|
3761
|
+
if (value && typeof value === "object") visit(value, current, childKey);
|
|
3762
|
+
}
|
|
3763
|
+
};
|
|
3764
|
+
for (const statement of program.body) {
|
|
3765
|
+
if (statement.type === "ImportDeclaration") continue;
|
|
3766
|
+
visit(statement, program, "body");
|
|
3767
|
+
if (reason) break;
|
|
3768
|
+
}
|
|
3769
|
+
return { reason, imports };
|
|
3770
|
+
}
|
|
3771
|
+
function isReference(node, parent, key) {
|
|
3772
|
+
if (!parent) return true;
|
|
3773
|
+
if (parent.type === "MemberExpression" && key === "property" && !parent.computed) return false;
|
|
3774
|
+
if ((parent.type === "Property" || parent.type === "MethodDefinition") && key === "key") {
|
|
3775
|
+
return Boolean(parent.computed);
|
|
3776
|
+
}
|
|
3777
|
+
if (parent.type === "PropertyDefinition" && key === "key") return Boolean(parent.computed);
|
|
3778
|
+
if (parent.type.startsWith("TS")) return false;
|
|
3779
|
+
if (parent.type === "JSXAttribute" || parent.type.startsWith("JSX")) return false;
|
|
3780
|
+
if (parent.type === "LabeledStatement" || parent.type === "BreakStatement") return false;
|
|
3781
|
+
if (parent.type === "ContinueStatement") return false;
|
|
3782
|
+
return true;
|
|
3783
|
+
}
|
|
3784
|
+
function readSource(file) {
|
|
3785
|
+
try {
|
|
3786
|
+
_chunkQP4GYVRRcjs.noteFarmSourceRead.call(void 0, file);
|
|
3787
|
+
return fs2.default.readFileSync(file, "utf8");
|
|
3788
|
+
} catch (e15) {
|
|
3789
|
+
return null;
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
function explainFarmKeptLayoutRender(modulePath, root) {
|
|
3793
|
+
const entry = _chunkQP4GYVRRcjs.resolveModuleSourcePath.call(void 0, modulePath, root);
|
|
3794
|
+
if (!entry) return `${modulePath} does not resolve`;
|
|
3795
|
+
const visited = /* @__PURE__ */ new Set();
|
|
3796
|
+
const check = (file) => {
|
|
3797
|
+
if (visited.has(file)) return null;
|
|
3798
|
+
visited.add(file);
|
|
3799
|
+
if (ASSET_SOURCE.test(file)) return null;
|
|
3800
|
+
if (!SCRIPT_SOURCE.test(file)) return `${path4.default.relative(root, file)} is not a script`;
|
|
3801
|
+
const code = readSource(file);
|
|
3802
|
+
if (code === null) return `${path4.default.relative(root, file)} cannot be read`;
|
|
3803
|
+
const { reason, imports } = _chunkQP4GYVRRcjs.memoizeInFarmSourceSnapshot.call(void 0,
|
|
3804
|
+
"kept-layout-module",
|
|
3805
|
+
code,
|
|
3806
|
+
() => findFarmRequestDecidingConstruct(code, file)
|
|
3807
|
+
);
|
|
3808
|
+
if (reason) return `${path4.default.relative(root, file)} has ${reason}`;
|
|
3809
|
+
for (const imported of imports) {
|
|
3810
|
+
const allowed = PURE_PACKAGE_IMPORTS.get(imported.source);
|
|
3811
|
+
if (allowed) {
|
|
3812
|
+
if (allowed === "*" || imported.names.every((name) => allowed.has(name))) continue;
|
|
3813
|
+
return `${path4.default.relative(root, file)} imports ${imported.names.join(", ")} from ${imported.source}`;
|
|
3814
|
+
}
|
|
3815
|
+
if (ASSET_SOURCE.test(imported.source.split("?")[0])) continue;
|
|
3816
|
+
const resolved = _chunkQP4GYVRRcjs.resolveImportedModule.call(void 0, file, imported.source, root);
|
|
3817
|
+
if (!resolved.path || !resolved.local) {
|
|
3818
|
+
return `${path4.default.relative(root, file)} imports ${imported.source}`;
|
|
3819
|
+
}
|
|
3820
|
+
const nested = check(resolved.path);
|
|
3821
|
+
if (nested) return nested;
|
|
3822
|
+
}
|
|
3823
|
+
return null;
|
|
3824
|
+
};
|
|
3825
|
+
return check(entry);
|
|
3826
|
+
}
|
|
3827
|
+
var answers = /* @__PURE__ */ new Map();
|
|
3828
|
+
function canFarmSkipKeptLayoutRender(modulePath, root) {
|
|
3829
|
+
const key = `${root}\0${modulePath}`;
|
|
3830
|
+
const known = answers.get(key);
|
|
3831
|
+
if (known && known.stamps.every(([file, stamp]) => _chunkQP4GYVRRcjs.getFarmSourceStamp.call(void 0, file) === stamp)) {
|
|
3832
|
+
return known.skip;
|
|
3833
|
+
}
|
|
3834
|
+
const { result, files } = _chunkQP4GYVRRcjs.traceFarmSourceReads.call(void 0,
|
|
3835
|
+
() => explainFarmKeptLayoutRender(modulePath, root) === null
|
|
3836
|
+
);
|
|
3837
|
+
answers.set(key, {
|
|
3838
|
+
skip: result,
|
|
3839
|
+
stamps: files.map((file) => [file, _chunkQP4GYVRRcjs.getFarmSourceStamp.call(void 0, file)])
|
|
3840
|
+
});
|
|
3841
|
+
return result;
|
|
3528
3842
|
}
|
|
3529
3843
|
|
|
3530
3844
|
// src/server/renderer.ts
|
|
@@ -3603,7 +3917,7 @@ var warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
|
|
|
3603
3917
|
function warnSuppressedAsyncHydrationOnce(modulePath, reason) {
|
|
3604
3918
|
if (warnedSuppressedAsyncHydrationModules.has(modulePath)) return;
|
|
3605
3919
|
warnedSuppressedAsyncHydrationModules.add(modulePath);
|
|
3606
|
-
|
|
3920
|
+
_chunkGC5ROI3Acjs.logger.warn(_chunkQP4GYVRRcjs.describeSuppressedAsyncHydration.call(void 0, modulePath, reason));
|
|
3607
3921
|
}
|
|
3608
3922
|
var fullDocumentRoutes = /* @__PURE__ */ new Set();
|
|
3609
3923
|
var documentLayouts = /* @__PURE__ */ new WeakMap();
|
|
@@ -3640,7 +3954,7 @@ function appendResponseHeader(res, name, value) {
|
|
|
3640
3954
|
}
|
|
3641
3955
|
}
|
|
3642
3956
|
function requestHeader(req, name) {
|
|
3643
|
-
const value = _optionalChain([req, 'access',
|
|
3957
|
+
const value = _optionalChain([req, 'access', _82 => _82.headers, 'optionalAccess', _83 => _83[name]]);
|
|
3644
3958
|
return Array.isArray(value) ? value[0] : value;
|
|
3645
3959
|
}
|
|
3646
3960
|
function appendResponseVary(res, value) {
|
|
@@ -3654,7 +3968,7 @@ function appendResponseVary(res, value) {
|
|
|
3654
3968
|
function renderI18nAlternateLinks(requestPath, snapshot, options) {
|
|
3655
3969
|
if (snapshot.routing === "none") return "";
|
|
3656
3970
|
const url = new URL(requestPath, "http://farm.local");
|
|
3657
|
-
return
|
|
3971
|
+
return _chunk6ZFGWB75cjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
|
|
3658
3972
|
}
|
|
3659
3973
|
var PPR_REFRESH_MAX_ATTEMPTS = 3;
|
|
3660
3974
|
function createPPRRefreshScript() {
|
|
@@ -3749,12 +4063,12 @@ async function parseRouteModuleProps(routeModule, input) {
|
|
|
3749
4063
|
}
|
|
3750
4064
|
const schemas = routeModule.__farmRouteSchemas;
|
|
3751
4065
|
const params = parseRouteModuleSchema(
|
|
3752
|
-
_optionalChain([schemas, 'optionalAccess',
|
|
4066
|
+
_optionalChain([schemas, 'optionalAccess', _84 => _84.params]),
|
|
3753
4067
|
input.props.params,
|
|
3754
4068
|
"params",
|
|
3755
4069
|
input.routePath
|
|
3756
4070
|
);
|
|
3757
|
-
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess',
|
|
4071
|
+
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _85 => _85.search]), input.search, "search", input.routePath);
|
|
3758
4072
|
return {
|
|
3759
4073
|
...input.props,
|
|
3760
4074
|
params,
|
|
@@ -3786,16 +4100,17 @@ function createRouteStateProps(input) {
|
|
|
3786
4100
|
function readAppPackageIdentity(root) {
|
|
3787
4101
|
try {
|
|
3788
4102
|
return JSON.parse(
|
|
3789
|
-
|
|
4103
|
+
fs7.readFileSync(path10.join(root || process.cwd(), "package.json"), "utf8")
|
|
3790
4104
|
);
|
|
3791
|
-
} catch (
|
|
4105
|
+
} catch (e16) {
|
|
3792
4106
|
return {};
|
|
3793
4107
|
}
|
|
3794
4108
|
}
|
|
4109
|
+
var pageRequests = /* @__PURE__ */ new WeakMap();
|
|
3795
4110
|
var ServerRenderer = class {
|
|
3796
4111
|
constructor(config, routeManager, i18nRuntime, viteServer) {
|
|
3797
4112
|
this.ssgManifest = [];
|
|
3798
|
-
this.dataCache =
|
|
4113
|
+
this.dataCache = _chunkBNCKXPCUcjs.getFarmDataCache.call(void 0, );
|
|
3799
4114
|
this.config = config;
|
|
3800
4115
|
this.routeManager = routeManager;
|
|
3801
4116
|
this.i18nRuntime = i18nRuntime;
|
|
@@ -3806,16 +4121,16 @@ var ServerRenderer = class {
|
|
|
3806
4121
|
async initialize() {
|
|
3807
4122
|
if (this.rendererRuntime) return;
|
|
3808
4123
|
if (this.islandValues()) {
|
|
3809
|
-
|
|
4124
|
+
_chunk52LTENREcjs.installFarmIslandValues.call(void 0, );
|
|
3810
4125
|
(await import("./internal/islands-server.cjs")).installFarmIslandsServer();
|
|
3811
4126
|
await _asyncNullishCoalesce(islands, async () => ( (islands = await import("./internal/islands-runtime.cjs"))));
|
|
3812
4127
|
} else {
|
|
3813
|
-
|
|
4128
|
+
_chunk52LTENREcjs.uninstallFarmIslandValues.call(void 0, );
|
|
3814
4129
|
}
|
|
3815
|
-
if (_optionalChain([this, 'access',
|
|
4130
|
+
if (_optionalChain([this, 'access', _86 => _86.config, 'access', _87 => _87.notFound, 'optionalAccess', _88 => _88.component, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()])) {
|
|
3816
4131
|
resolveFarmNotFoundComponentPath(this.config, _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, this.config));
|
|
3817
4132
|
}
|
|
3818
|
-
const loaded = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, this.config.renderer) ? await import("./renderer/none/server.cjs") : this.viteServer ? await
|
|
4133
|
+
const loaded = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, this.config.renderer) ? this.reactRenderer = await import("./renderer/react/server.cjs") : _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, this.config.renderer) ? await import("./renderer/none/server.cjs") : this.viteServer ? await _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
|
|
3819
4134
|
_chunk67MZTLTFcjs.resolveFarmRendererModule.call(void 0,
|
|
3820
4135
|
this.config.root || process.cwd(),
|
|
3821
4136
|
this.config.renderer.server
|
|
@@ -3837,7 +4152,7 @@ var ServerRenderer = class {
|
|
|
3837
4152
|
"node"
|
|
3838
4153
|
);
|
|
3839
4154
|
this.rendererRuntime = islands && this.islandValues() ? withFarmIslandsRenders(runtime, islands) : runtime;
|
|
3840
|
-
_optionalChain([this, 'access',
|
|
4155
|
+
_optionalChain([this, 'access', _91 => _91.routeManager, 'access', _92 => _92.setRendererRuntime, 'optionalCall', _93 => _93(this.rendererRuntime)]);
|
|
3841
4156
|
await this.applyRendererAppSetup();
|
|
3842
4157
|
}
|
|
3843
4158
|
/**
|
|
@@ -3857,13 +4172,13 @@ var ServerRenderer = class {
|
|
|
3857
4172
|
`Renderer \`${this.config.renderer.name}\` does not support \`appSetup\`: its server module must export configureApp().`
|
|
3858
4173
|
);
|
|
3859
4174
|
}
|
|
3860
|
-
const setupModule = this.viteServer ? await
|
|
4175
|
+
const setupModule = this.viteServer ? await _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, this.viteServer, appSetupPath) : await import(_url.pathToFileURL.call(void 0, appSetupPath).href);
|
|
3861
4176
|
if (setupModule === this.appliedAppSetupModule) return;
|
|
3862
4177
|
this.appliedAppSetupModule = setupModule;
|
|
3863
4178
|
configureApp(setupModule.default);
|
|
3864
4179
|
}
|
|
3865
4180
|
createPageBoundary(pageElement, options) {
|
|
3866
|
-
|
|
4181
|
+
const boundary = this.rendererRuntime.createElement(
|
|
3867
4182
|
"div",
|
|
3868
4183
|
{
|
|
3869
4184
|
id: "__farm_page__",
|
|
@@ -3875,6 +4190,7 @@ var ServerRenderer = class {
|
|
|
3875
4190
|
},
|
|
3876
4191
|
pageElement
|
|
3877
4192
|
);
|
|
4193
|
+
return options.pageShouldHydrate && !options.layoutShouldHydrate && this.reactRenderer ? this.reactRenderer.markPagePosition(boundary) : boundary;
|
|
3878
4194
|
}
|
|
3879
4195
|
/// The app's `<srcDir>/app/globals.css`, linked only when it exists, as the
|
|
3880
4196
|
/// production build imports it only when it exists. An app without one gets
|
|
@@ -3894,7 +4210,7 @@ var ServerRenderer = class {
|
|
|
3894
4210
|
/// Stylesheets the app imported through JS (fontsource packages, component
|
|
3895
4211
|
/// CSS) that the document must link alongside globals.css — see #658.
|
|
3896
4212
|
collectDevStyleHrefs() {
|
|
3897
|
-
const graph = _optionalChain([this, 'access',
|
|
4213
|
+
const graph = _optionalChain([this, 'access', _94 => _94.viteServer, 'optionalAccess', _95 => _95.moduleGraph]);
|
|
3898
4214
|
if (!graph) return [];
|
|
3899
4215
|
return collectDevStylesheetUrls(
|
|
3900
4216
|
graph.idToModuleMap.values(),
|
|
@@ -3945,7 +4261,7 @@ var ServerRenderer = class {
|
|
|
3945
4261
|
"data-farm-layout-boundary": "true",
|
|
3946
4262
|
"data-farm-layout-pattern": pattern,
|
|
3947
4263
|
...segment ? { "data-farm-layout-key": segment.key } : {},
|
|
3948
|
-
..._optionalChain([segment, 'optionalAccess',
|
|
4264
|
+
..._optionalChain([segment, 'optionalAccess', _96 => _96.kept]) ? { "data-farm-layout-kept": "true" } : {},
|
|
3949
4265
|
style: { display: "contents" }
|
|
3950
4266
|
},
|
|
3951
4267
|
layoutElement
|
|
@@ -3997,7 +4313,7 @@ var ServerRenderer = class {
|
|
|
3997
4313
|
writable.once("error", reject);
|
|
3998
4314
|
const stream = renderToPipeableStream(element, {
|
|
3999
4315
|
nonce: _chunk3BIASUGRcjs._resolveCurrentCspNonce.call(void 0, ),
|
|
4000
|
-
formState:
|
|
4316
|
+
formState: _chunkPBJ7MEOVcjs.getFarmFormState.call(void 0, ),
|
|
4001
4317
|
...inlineBoundaries ? {
|
|
4002
4318
|
progressiveChunkSize: Number.MAX_SAFE_INTEGER,
|
|
4003
4319
|
onAllReady() {
|
|
@@ -4041,7 +4357,7 @@ var ServerRenderer = class {
|
|
|
4041
4357
|
);
|
|
4042
4358
|
return { html: rendered.html, head: rendered.head || "" };
|
|
4043
4359
|
}
|
|
4044
|
-
const { head, body } =
|
|
4360
|
+
const { head, body } = _chunk6ZFGWB75cjs.takeFarmHoistedHead.call(void 0,
|
|
4045
4361
|
await this.renderElementToCompleteHTML(element, options),
|
|
4046
4362
|
true
|
|
4047
4363
|
);
|
|
@@ -4049,7 +4365,7 @@ var ServerRenderer = class {
|
|
|
4049
4365
|
}
|
|
4050
4366
|
/** Islands mode sends large prop values once, keyed by content (RFC 0003). */
|
|
4051
4367
|
islandValues() {
|
|
4052
|
-
return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
4368
|
+
return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _97 => _97.config, 'access', _98 => _98.experimental, 'optionalAccess', _99 => _99.serverComponents])) === "islands";
|
|
4053
4369
|
}
|
|
4054
4370
|
/**
|
|
4055
4371
|
* Render the route tree used by client navigation without producing a second
|
|
@@ -4060,6 +4376,7 @@ var ServerRenderer = class {
|
|
|
4060
4376
|
await this.initialize();
|
|
4061
4377
|
if (this.viteServer) await this.applyRendererAppSetup();
|
|
4062
4378
|
_chunkD22BUQKWcjs.setFarmBasePath.call(void 0, this.config.basePath);
|
|
4379
|
+
this.publishSearchPreserveRoutes();
|
|
4063
4380
|
_chunkDVJM55D2cjs.setFarmTrailingSlashPreference.call(void 0, this.config.trailingSlash);
|
|
4064
4381
|
let element = this.rendererRuntime.createElement(input.PageComponent, input.pageProps);
|
|
4065
4382
|
if (input.LoadingComponent) {
|
|
@@ -4084,11 +4401,17 @@ var ServerRenderer = class {
|
|
|
4084
4401
|
layoutShouldHydrate: input.layoutShouldHydrate,
|
|
4085
4402
|
islandStrategy: input.islandStrategy
|
|
4086
4403
|
});
|
|
4087
|
-
const
|
|
4088
|
-
|
|
4089
|
-
|
|
4404
|
+
const sharedCount = Math.max(0, Math.min(_nullishCoalesce(input.layoutStartIndex, () => ( 0)), input.layouts.length));
|
|
4405
|
+
const dynamicTreeIndex = input.layouts.findIndex(
|
|
4406
|
+
(layout, index) => index < sharedCount && layout.serverTree && layout.pattern.includes("[")
|
|
4090
4407
|
);
|
|
4091
|
-
|
|
4408
|
+
const layoutStartIndex = dynamicTreeIndex === -1 ? sharedCount : dynamicTreeIndex;
|
|
4409
|
+
const fragmentTag = this.reactRenderer && layoutStartIndex > 0 ? "farm-fragment-" + createFarmFlushToken() : null;
|
|
4410
|
+
const renderFrom = this.reactRenderer ? 0 : sharedCount;
|
|
4411
|
+
for (let index = input.layouts.length - 1; index >= renderFrom; index--) {
|
|
4412
|
+
if (fragmentTag && index === layoutStartIndex - 1) {
|
|
4413
|
+
element = this.rendererRuntime.createElement(fragmentTag, null, element);
|
|
4414
|
+
}
|
|
4092
4415
|
const layout = input.layouts[index];
|
|
4093
4416
|
const LayoutComponent = layout.module.default;
|
|
4094
4417
|
if (!LayoutComponent) continue;
|
|
@@ -4109,24 +4432,167 @@ var ServerRenderer = class {
|
|
|
4109
4432
|
slotElement
|
|
4110
4433
|
);
|
|
4111
4434
|
}
|
|
4112
|
-
|
|
4113
|
-
|
|
4435
|
+
const outlets = { children: element, ...slotProps };
|
|
4436
|
+
element = index >= layoutStartIndex && input.layoutShouldHydrate && layout.serverTree && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
|
|
4437
|
+
LayoutComponent,
|
|
4438
|
+
{ params: input.params },
|
|
4439
|
+
outlets,
|
|
4440
|
+
layout.pattern
|
|
4441
|
+
) : this.rendererRuntime.createElement(LayoutComponent, {
|
|
4114
4442
|
params: input.params,
|
|
4115
|
-
...
|
|
4443
|
+
...outlets
|
|
4116
4444
|
});
|
|
4117
4445
|
element = this.createLayoutBoundary(layout.pattern, element);
|
|
4118
4446
|
}
|
|
4447
|
+
if (input.pageShouldHydrate && !input.layoutShouldHydrate && this.reactRenderer) {
|
|
4448
|
+
element = this.reactRenderer.markLayoutPosition(element);
|
|
4449
|
+
}
|
|
4119
4450
|
if (input.layoutShouldHydrate) {
|
|
4120
4451
|
element = this.wrapClientGraph(element);
|
|
4121
4452
|
}
|
|
4122
|
-
|
|
4123
|
-
|
|
4453
|
+
const html = await this.renderElementToCompleteHTML(
|
|
4454
|
+
await this.wrapWithIntegrationProviders(element),
|
|
4455
|
+
{
|
|
4456
|
+
rejectLateRedirects: true
|
|
4457
|
+
}
|
|
4458
|
+
);
|
|
4459
|
+
return fragmentTag ? _chunk6ZFGWB75cjs.takeFarmNavigationOutlet.call(void 0, html, fragmentTag) : html;
|
|
4460
|
+
}
|
|
4461
|
+
/**
|
|
4462
|
+
* A built-in docs runtime page (`docs.entry`, no adapter) under layouts that hydrate, or whose
|
|
4463
|
+
* client components are islands: the docs runtime's document with the layout chain
|
|
4464
|
+
* rendered around its body, and the client that hydrates it with the boot data an app page has. Production renders the same tree
|
|
4465
|
+
* (wrapFarmDocsResponseWithLayouts in nitro/universal-build.ts, with docs-layout-tree.ts).
|
|
4466
|
+
* Any other docs response is sent as it is.
|
|
4467
|
+
*/
|
|
4468
|
+
async wrapDocsResponseWithLayouts(request2, response) {
|
|
4469
|
+
if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _100 => _100.headers, 'access', _101 => _101.get, 'call', _102 => _102("content-type"), 'optionalAccess', _103 => _103.toLowerCase, 'call', _104 => _104(), 'access', _105 => _105.includes, 'call', _106 => _106("text/html")])) {
|
|
4470
|
+
return response;
|
|
4471
|
+
}
|
|
4472
|
+
await this.initialize();
|
|
4473
|
+
if (this.viteServer) await this.applyRendererAppSetup();
|
|
4474
|
+
const pathname = new URL(request2.url).pathname;
|
|
4475
|
+
const root = this.config.root || process.cwd();
|
|
4476
|
+
const matched = this.routeManager.matchRoute(pathname);
|
|
4477
|
+
const routeManifest = this.routeManager.generateClientManifest(this.config.root);
|
|
4478
|
+
const islandsMode = Boolean(islands && this.islandValues());
|
|
4479
|
+
const layouts = matched.layouts.map((layout) => {
|
|
4480
|
+
const entry = routeManifest.layouts.find((candidate) => candidate.pattern === layout.pattern);
|
|
4481
|
+
return {
|
|
4482
|
+
pattern: layout.pattern,
|
|
4483
|
+
modulePath: layout.modulePath,
|
|
4484
|
+
shouldHydrate: _optionalChain([entry, 'optionalAccess', _107 => _107.shouldHydrate]) === true,
|
|
4485
|
+
islandStrategy: _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _108 => _108.islandStrategy]), () => ( null)),
|
|
4486
|
+
hasIsolatedClientBoundaries: _optionalChain([entry, 'optionalAccess', _109 => _109.hasIsolatedClientBoundaries]) === true,
|
|
4487
|
+
serverTree: _optionalChain([entry, 'optionalAccess', _110 => _110.serverTree]) === true,
|
|
4488
|
+
islands: _optionalChain([entry, 'optionalAccess', _111 => _111.hasIsolatedClientBoundaries]) === true
|
|
4489
|
+
};
|
|
4490
|
+
});
|
|
4491
|
+
if (!_chunk6ZFGWB75cjs.farmDocsLayoutsWrapPage.call(void 0, layouts)) return response;
|
|
4492
|
+
const shouldHydrateLayout = layouts.some((layout) => layout.shouldHydrate);
|
|
4493
|
+
const hasIsolatedClientBoundaries = layouts.some(
|
|
4494
|
+
(layout) => layout.hasIsolatedClientBoundaries
|
|
4495
|
+
);
|
|
4496
|
+
const source = await response.text();
|
|
4497
|
+
const bodyMatch = /<body([^>]*)>([\s\S]*?)<\/body>/i.exec(source);
|
|
4498
|
+
if (!bodyMatch) {
|
|
4499
|
+
return new Response(source, {
|
|
4500
|
+
status: response.status,
|
|
4501
|
+
statusText: response.statusText,
|
|
4502
|
+
headers: response.headers
|
|
4503
|
+
});
|
|
4504
|
+
}
|
|
4505
|
+
const modules = await Promise.all(
|
|
4506
|
+
layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
4507
|
+
);
|
|
4508
|
+
const treeLayouts = layouts.map((layout, index) => ({
|
|
4509
|
+
...layout,
|
|
4510
|
+
Component: _optionalChain([modules, 'access', _112 => _112[index], 'optionalAccess', _113 => _113.default])
|
|
4511
|
+
}));
|
|
4512
|
+
const islandStrategy = _chunk6ZFGWB75cjs.resolveFarmDocsLayoutIslandStrategy.call(void 0, treeLayouts);
|
|
4513
|
+
const tree = await _chunk6ZFGWB75cjs.createFarmDocsLayoutTree.call(void 0, this.rendererRuntime, {
|
|
4514
|
+
pageHtml: bodyMatch[2],
|
|
4515
|
+
layouts: treeLayouts,
|
|
4516
|
+
params: matched.params,
|
|
4517
|
+
renderServerTreeLayout: islandsMode ? (Layout, props, outlets, pattern) => islands.renderFarmServerTreeLayout(
|
|
4518
|
+
Layout,
|
|
4519
|
+
props,
|
|
4520
|
+
outlets,
|
|
4521
|
+
pattern
|
|
4522
|
+
) : void 0,
|
|
4523
|
+
layoutKey: islandsMode ? (pattern) => getFarmLayoutKey(pattern, matched.params) : void 0
|
|
4524
|
+
});
|
|
4525
|
+
const rendered = await this.renderElementToDocumentParts(
|
|
4526
|
+
this.rendererRuntime.createElement(
|
|
4527
|
+
"div",
|
|
4528
|
+
{ id: "root" },
|
|
4529
|
+
await this.wrapWithIntegrationProviders(
|
|
4530
|
+
shouldHydrateLayout ? this.wrapClientGraph(tree) : tree
|
|
4531
|
+
)
|
|
4532
|
+
)
|
|
4533
|
+
);
|
|
4534
|
+
const rootMarkup = _chunk6ZFGWB75cjs.placeFarmDocsLayoutRoot.call(void 0, rendered.html);
|
|
4535
|
+
const clientLayouts = layouts.map((layout) => ({
|
|
4536
|
+
pattern: layout.pattern,
|
|
4537
|
+
modulePath: _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, layout.modulePath, root),
|
|
4538
|
+
shouldHydrate: layout.shouldHydrate,
|
|
4539
|
+
islandStrategy: layout.islandStrategy,
|
|
4540
|
+
...layout.hasIsolatedClientBoundaries ? { hasIsolatedClientBoundaries: true } : {},
|
|
4541
|
+
// Islands mode: the browser rebuilds this layout from its tree, not its module.
|
|
4542
|
+
...shouldHydrateLayout && layout.serverTree ? { serverTree: true } : {}
|
|
4543
|
+
}));
|
|
4544
|
+
const clientManifest = createFarmDevClientManifest(routeManifest, {
|
|
4545
|
+
sharedAssets: [
|
|
4546
|
+
...this.devGlobalStylesheetAssets(),
|
|
4547
|
+
...this.collectDevStyleHrefs().map((href) => ({
|
|
4548
|
+
tag: "link",
|
|
4549
|
+
attrs: { rel: "stylesheet", href }
|
|
4550
|
+
}))
|
|
4551
|
+
],
|
|
4552
|
+
boot: { layoutPatterns: layouts.map((layout) => layout.pattern) }
|
|
4553
|
+
});
|
|
4554
|
+
const i18nSnapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
4555
|
+
const bootstrapScript = `<script>
|
|
4556
|
+
window.__FARM_PROPS__ = ${serializeInlineValue({ params: matched.params })};
|
|
4557
|
+
window.__FARM_ROUTE_SLOTS__ = [];
|
|
4558
|
+
window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
|
|
4559
|
+
window.__FARM_PATH__ = ${serializeInlineValue(pathname)};
|
|
4560
|
+
window.__FARM_IS_CLIENT__ = false;
|
|
4561
|
+
window.__FARM_PAGE_SHOULD_HYDRATE__ = false;
|
|
4562
|
+
window.__FARM_LAYOUT_SHOULD_HYDRATE__ = ${JSON.stringify(shouldHydrateLayout)};
|
|
4563
|
+
window.__FARM_LAYOUTS__ = ${serializeInlineValue(clientLayouts)};
|
|
4564
|
+
window.__FARM_SHOULD_HYDRATE__ = ${JSON.stringify(shouldHydrateLayout || hasIsolatedClientBoundaries)};
|
|
4565
|
+
window.__FARM_HAS_ISOLATED_CLIENT_BOUNDARIES__ = ${JSON.stringify(hasIsolatedClientBoundaries)};
|
|
4566
|
+
window.__FARM_ISLAND_STRATEGY__ = ${serializeInlineValue(islandStrategy)};
|
|
4567
|
+
window.__FARM_PAGE_MODULE__ = "";
|
|
4568
|
+
window.__FARM_LOADING_MODULE__ = null;
|
|
4569
|
+
window.__FARM_MANIFEST__ = ${serializeInlineValue(clientManifest)};
|
|
4570
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${serializeInlineValue(_chunkOWO7KDZ3cjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
4571
|
+
window.__FARM_I18N__ = ${i18nSnapshot ? serializeInlineValue(i18nSnapshot) : "null"};
|
|
4572
|
+
</script>`;
|
|
4573
|
+
const head = [
|
|
4574
|
+
...this.collectDevStyleLinks(),
|
|
4575
|
+
`<script type="module" src="/@vite/client"></script>`,
|
|
4576
|
+
source.includes("window._$HY") ? "" : _optionalChain([this, 'access', _114 => _114.rendererRuntime, 'access', _115 => _115.generateHydrationScript, 'optionalCall', _116 => _116()]),
|
|
4577
|
+
bootstrapScript
|
|
4578
|
+
].filter(Boolean).map((markup) => _chunk6JHZPB52cjs.stampFarmCspNonce.call(void 0, markup)).concat(rendered.head || []).join("\n ");
|
|
4579
|
+
const clientScript = source.includes('src="/@farm/client.js"') ? "" : `
|
|
4580
|
+
${_chunk6JHZPB52cjs.stampFarmCspNonce.call(void 0, `<script type="module" src="/@farm/client.js"></script>`)}`;
|
|
4581
|
+
const html = source.replace(bodyMatch[0], () => `<body${bodyMatch[1]}>${rootMarkup}${clientScript}</body>`).replace(/<\/head>/i, () => ` ${head}
|
|
4582
|
+
</head>`);
|
|
4583
|
+
const headers = new Headers(response.headers);
|
|
4584
|
+
headers.delete("content-length");
|
|
4585
|
+
headers.delete("etag");
|
|
4586
|
+
return new Response(html, {
|
|
4587
|
+
status: response.status,
|
|
4588
|
+
statusText: response.statusText,
|
|
4589
|
+
headers
|
|
4124
4590
|
});
|
|
4125
4591
|
}
|
|
4126
4592
|
async runWithRequestContext(request2, fn) {
|
|
4127
|
-
return
|
|
4593
|
+
return _chunk2RSVYJT6cjs._runWithCurrentRequest.call(void 0,
|
|
4128
4594
|
request2,
|
|
4129
|
-
() => _optionalChain([this, 'access',
|
|
4595
|
+
() => _optionalChain([this, 'access', _117 => _117.i18nRuntime, 'optionalAccess', _118 => _118.config, 'access', _119 => _119.enabled]) ? _chunkSXXSQVKKcjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
|
|
4130
4596
|
redirect: false
|
|
4131
4597
|
}) : fn()
|
|
4132
4598
|
);
|
|
@@ -4138,10 +4604,10 @@ var ServerRenderer = class {
|
|
|
4138
4604
|
* Load SSG manifest from build output
|
|
4139
4605
|
*/
|
|
4140
4606
|
loadSSGManifest() {
|
|
4141
|
-
const manifestPath =
|
|
4607
|
+
const manifestPath = path10.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
|
|
4142
4608
|
let content;
|
|
4143
4609
|
try {
|
|
4144
|
-
content =
|
|
4610
|
+
content = fs7.readFileSync(manifestPath, "utf-8");
|
|
4145
4611
|
} catch (error) {
|
|
4146
4612
|
if (error.code === "ENOENT") {
|
|
4147
4613
|
return;
|
|
@@ -4151,13 +4617,13 @@ var ServerRenderer = class {
|
|
|
4151
4617
|
);
|
|
4152
4618
|
}
|
|
4153
4619
|
this.ssgManifest = parseSSGManifest(content, manifestPath);
|
|
4154
|
-
|
|
4620
|
+
_chunkGC5ROI3Acjs.logger.info(`Loaded SSG manifest: ${this.ssgManifest.length} pages`);
|
|
4155
4621
|
}
|
|
4156
4622
|
/**
|
|
4157
4623
|
* Check if a path should be served from SSG cache
|
|
4158
4624
|
*/
|
|
4159
4625
|
async shouldServeSSG(pathname) {
|
|
4160
|
-
const ssgPage =
|
|
4626
|
+
const ssgPage = _chunk7564NP5Zcjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
|
|
4161
4627
|
if (!ssgPage) return null;
|
|
4162
4628
|
const cached = await this.getCachedSSGPage(pathname);
|
|
4163
4629
|
if (cached && await this.dataCache.isStaleAsync(cached)) {
|
|
@@ -4166,10 +4632,10 @@ var ServerRenderer = class {
|
|
|
4166
4632
|
return ssgPage;
|
|
4167
4633
|
}
|
|
4168
4634
|
getSSGCacheKey(urlPath) {
|
|
4169
|
-
return _chunkDXUXQP2Tcjs.createFarmCacheKey.call(void 0, ["ssg",
|
|
4635
|
+
return _chunkDXUXQP2Tcjs.createFarmCacheKey.call(void 0, ["ssg", _chunkBNCKXPCUcjs.normalizeRevalidatePath.call(void 0, urlPath)]);
|
|
4170
4636
|
}
|
|
4171
4637
|
getPPRCacheKey(pathname, search = "", locale = "", origin = "") {
|
|
4172
|
-
const key = ["ppr", locale,
|
|
4638
|
+
const key = ["ppr", locale, _chunkBNCKXPCUcjs.normalizeRevalidatePath.call(void 0, pathname), search, this.getDeploymentId()];
|
|
4173
4639
|
return _chunkDXUXQP2Tcjs.createFarmCacheKey.call(void 0, origin ? [...key, origin] : key);
|
|
4174
4640
|
}
|
|
4175
4641
|
getCachedSSGPage(urlPath) {
|
|
@@ -4194,26 +4660,23 @@ var ServerRenderer = class {
|
|
|
4194
4660
|
this.getPPRCacheKey(pathname, search, locale, origin)
|
|
4195
4661
|
);
|
|
4196
4662
|
}
|
|
4197
|
-
|
|
4663
|
+
getPPRShellWriteOptions(options) {
|
|
4664
|
+
return {
|
|
4665
|
+
// revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
|
|
4666
|
+
// answers the public one (`/console/fr/pricing`): either clears it, as in production.
|
|
4667
|
+
paths: [.../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])],
|
|
4668
|
+
tags: ["ppr"],
|
|
4669
|
+
revalidate: _nullishCoalesce(options.revalidate, () => ( false))
|
|
4670
|
+
};
|
|
4671
|
+
}
|
|
4672
|
+
async cachePPRShell(options, html, write, cookieIndependent = false) {
|
|
4198
4673
|
const key = this.getPPRCacheKey(
|
|
4199
4674
|
options.pathname,
|
|
4200
4675
|
options.search,
|
|
4201
4676
|
options.locale,
|
|
4202
4677
|
options.origin
|
|
4203
4678
|
);
|
|
4204
|
-
await this.dataCache.pprShellCache.
|
|
4205
|
-
key,
|
|
4206
|
-
{ html },
|
|
4207
|
-
{
|
|
4208
|
-
// revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
|
|
4209
|
-
// answers the public one (`/console/fr/pricing`): either clears it, as in production.
|
|
4210
|
-
paths: [
|
|
4211
|
-
.../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])
|
|
4212
|
-
],
|
|
4213
|
-
tags: ["ppr"],
|
|
4214
|
-
revalidate: _nullishCoalesce(options.revalidate, () => ( false))
|
|
4215
|
-
}
|
|
4216
|
-
);
|
|
4679
|
+
await (await _asyncNullishCoalesce(write, async () => ( await this.dataCache.pprShellCache.startWriteAsync(this.getPPRShellWriteOptions(options))))).commit(key, { html, ...cookieIndependent ? { cookieIndependent: true } : {} });
|
|
4217
4680
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
4218
4681
|
type: "ppr.shell.cached",
|
|
4219
4682
|
route: options.pathname,
|
|
@@ -4229,9 +4692,6 @@ var ServerRenderer = class {
|
|
|
4229
4692
|
if (method !== "GET" && method !== "HEAD") {
|
|
4230
4693
|
return "method";
|
|
4231
4694
|
}
|
|
4232
|
-
if (_chunkNLBHLPEOcjs.withoutFarmDeploymentCookie.call(void 0, req.headers.cookie)) {
|
|
4233
|
-
return "cookie";
|
|
4234
|
-
}
|
|
4235
4695
|
if (req.headers.authorization) {
|
|
4236
4696
|
return "authorization";
|
|
4237
4697
|
}
|
|
@@ -4262,11 +4722,14 @@ var ServerRenderer = class {
|
|
|
4262
4722
|
}
|
|
4263
4723
|
return headers;
|
|
4264
4724
|
}
|
|
4265
|
-
serveCachedPPRShell(res, shell, revalidate) {
|
|
4725
|
+
serveCachedPPRShell(req, res, shell, revalidate) {
|
|
4266
4726
|
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
4267
4727
|
for (const [key, value] of Object.entries(this.getPPRHeaders("hit", revalidate))) {
|
|
4268
4728
|
res.setHeader(key, value);
|
|
4269
4729
|
}
|
|
4730
|
+
if (_chunkNLBHLPEOcjs.withoutFarmDeploymentCookie.call(void 0, req.headers.cookie)) {
|
|
4731
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
4732
|
+
}
|
|
4270
4733
|
res.write(shell.html);
|
|
4271
4734
|
res.end();
|
|
4272
4735
|
}
|
|
@@ -4278,7 +4741,7 @@ var ServerRenderer = class {
|
|
|
4278
4741
|
setImmediate(async () => {
|
|
4279
4742
|
try {
|
|
4280
4743
|
const mod = await this.routeManager.loadRouteModule(page.filePath);
|
|
4281
|
-
if (!_optionalChain([mod, 'optionalAccess',
|
|
4744
|
+
if (!_optionalChain([mod, 'optionalAccess', _120 => _120.default])) return;
|
|
4282
4745
|
const { route, layouts } = this.routeManager.matchRoute(page.urlPath);
|
|
4283
4746
|
const layoutModules = await Promise.all(
|
|
4284
4747
|
layouts.map((l) => this.routeManager.loadLayoutModule(l.modulePath))
|
|
@@ -4292,7 +4755,7 @@ var ServerRenderer = class {
|
|
|
4292
4755
|
};
|
|
4293
4756
|
let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
|
|
4294
4757
|
const pageMetadata = _nullishCoalesce(routeManifest.routes.find(
|
|
4295
|
-
(entry) => entry.pattern === _optionalChain([route, 'optionalAccess',
|
|
4758
|
+
(entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _121 => _121.pattern])
|
|
4296
4759
|
), () => ( {
|
|
4297
4760
|
shouldHydrate: false,
|
|
4298
4761
|
islandStrategy: null
|
|
@@ -4318,6 +4781,9 @@ var ServerRenderer = class {
|
|
|
4318
4781
|
});
|
|
4319
4782
|
pageElement = this.createLayoutBoundary(layouts[i].pattern, pageElement);
|
|
4320
4783
|
}
|
|
4784
|
+
if (pageMetadata.shouldHydrate && !layoutShouldHydrate && this.reactRenderer) {
|
|
4785
|
+
pageElement = this.reactRenderer.markLayoutPosition(pageElement);
|
|
4786
|
+
}
|
|
4321
4787
|
const html = await this.rendererRuntime.renderToString(
|
|
4322
4788
|
await this.wrapWithIntegrationProviders(pageElement)
|
|
4323
4789
|
);
|
|
@@ -4327,7 +4793,7 @@ var ServerRenderer = class {
|
|
|
4327
4793
|
pageProps,
|
|
4328
4794
|
pathname: page.urlPath
|
|
4329
4795
|
});
|
|
4330
|
-
const { title, tags, hasFavicon } =
|
|
4796
|
+
const { title, tags, hasFavicon } = _chunkY3DO7BIJcjs.renderMetadataHead.call(void 0, mergedMetadata);
|
|
4331
4797
|
const metadataHead = `${hasFavicon ? "" : '<link rel="icon" href="data:,">\n '}<title>${title}</title>${tags}`;
|
|
4332
4798
|
const fullDocument = this.createFullHTML(
|
|
4333
4799
|
html,
|
|
@@ -4337,13 +4803,13 @@ var ServerRenderer = class {
|
|
|
4337
4803
|
{ metadata: mergedMetadata }
|
|
4338
4804
|
);
|
|
4339
4805
|
await this.cacheSSGPage(page, fullDocument, { document: true });
|
|
4340
|
-
|
|
4806
|
+
_chunkGC5ROI3Acjs.logger.info(`ISR: Regenerated ${page.urlPath}`);
|
|
4341
4807
|
} catch (error) {
|
|
4342
|
-
|
|
4808
|
+
_chunkGC5ROI3Acjs.logger.error(`ISR regeneration failed for ${page.urlPath}: ${error}`);
|
|
4343
4809
|
}
|
|
4344
4810
|
});
|
|
4345
4811
|
} catch (error) {
|
|
4346
|
-
|
|
4812
|
+
_chunkGC5ROI3Acjs.logger.error(`ISR trigger failed: ${error}`);
|
|
4347
4813
|
}
|
|
4348
4814
|
}
|
|
4349
4815
|
/**
|
|
@@ -4364,10 +4830,10 @@ var ServerRenderer = class {
|
|
|
4364
4830
|
return true;
|
|
4365
4831
|
}
|
|
4366
4832
|
try {
|
|
4367
|
-
const htmlPath = page.urlPath === "/" ?
|
|
4368
|
-
if (
|
|
4369
|
-
const stat =
|
|
4370
|
-
const html =
|
|
4833
|
+
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");
|
|
4834
|
+
if (fs7.existsSync(htmlPath)) {
|
|
4835
|
+
const stat = fs7.statSync(htmlPath);
|
|
4836
|
+
const html = fs7.readFileSync(htmlPath, "utf-8");
|
|
4371
4837
|
await this.cacheSSGPage(page, html, {
|
|
4372
4838
|
document: true,
|
|
4373
4839
|
createdAt: stat.mtimeMs
|
|
@@ -4386,14 +4852,23 @@ var ServerRenderer = class {
|
|
|
4386
4852
|
return true;
|
|
4387
4853
|
}
|
|
4388
4854
|
} catch (error) {
|
|
4389
|
-
|
|
4855
|
+
_chunkGC5ROI3Acjs.logger.error(`Failed to serve SSG page ${page.urlPath}: ${error}`);
|
|
4390
4856
|
}
|
|
4391
4857
|
return false;
|
|
4392
4858
|
}
|
|
4859
|
+
/**
|
|
4860
|
+
* The pages with `search.preserve`, for the links this render draws (set per render, like the
|
|
4861
|
+
* base path, so a routes-file edit applies to the next one). A route manager without the list,
|
|
4862
|
+
* such as a partial test double, has none.
|
|
4863
|
+
*/
|
|
4864
|
+
publishSearchPreserveRoutes() {
|
|
4865
|
+
_chunkWKVYF2B5cjs._setFarmSearchPreserveRoutes.call(void 0, _nullishCoalesce(_optionalChain([this, 'access', _122 => _122.routeManager, 'access', _123 => _123.getSearchPreserveRoutes, 'optionalCall', _124 => _124()]), () => ( [])));
|
|
4866
|
+
}
|
|
4393
4867
|
async renderPage(req, res) {
|
|
4394
4868
|
await this.initialize();
|
|
4395
4869
|
if (this.viteServer) await this.applyRendererAppSetup();
|
|
4396
4870
|
_chunkD22BUQKWcjs.setFarmBasePath.call(void 0, this.config.basePath);
|
|
4871
|
+
this.publishSearchPreserveRoutes();
|
|
4397
4872
|
_chunkDVJM55D2cjs.setFarmTrailingSlashPreference.call(void 0, this.config.trailingSlash);
|
|
4398
4873
|
const cspNonce = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, this.security);
|
|
4399
4874
|
if (cspNonce) {
|
|
@@ -4403,15 +4878,15 @@ var ServerRenderer = class {
|
|
|
4403
4878
|
}
|
|
4404
4879
|
const request2 = this.createPageRequest(req, res);
|
|
4405
4880
|
const runtime = this.i18nRuntime;
|
|
4406
|
-
if (_optionalChain([runtime, 'optionalAccess',
|
|
4881
|
+
if (_optionalChain([runtime, 'optionalAccess', _125 => _125.config, 'access', _126 => _126.enabled])) {
|
|
4407
4882
|
const resolution = runtime.resolveRequest(request2);
|
|
4408
|
-
const varyHeaders =
|
|
4883
|
+
const varyHeaders = _chunk7Q2YWZF7cjs.getFarmLocaleVaryHeaders.call(void 0, runtime.config, resolution);
|
|
4409
4884
|
for (const header of varyHeaders) appendResponseVary(res, header);
|
|
4410
4885
|
if (resolution.persist) {
|
|
4411
4886
|
appendResponseHeader(
|
|
4412
4887
|
res,
|
|
4413
4888
|
"Set-Cookie",
|
|
4414
|
-
|
|
4889
|
+
_chunk7Q2YWZF7cjs.createFarmLocaleCookie.call(void 0, resolution.locale, runtime.config)
|
|
4415
4890
|
);
|
|
4416
4891
|
}
|
|
4417
4892
|
if (resolution.redirect && (request2.method === "GET" || request2.method === "HEAD")) {
|
|
@@ -4422,7 +4897,7 @@ var ServerRenderer = class {
|
|
|
4422
4897
|
return;
|
|
4423
4898
|
}
|
|
4424
4899
|
}
|
|
4425
|
-
return
|
|
4900
|
+
return _chunk2RSVYJT6cjs._runWithFarmCspNonce.call(void 0,
|
|
4426
4901
|
cspNonce,
|
|
4427
4902
|
() => this.runWithRequestContext(request2, () => this.renderPageInContext(req, res))
|
|
4428
4903
|
);
|
|
@@ -4433,10 +4908,17 @@ var ServerRenderer = class {
|
|
|
4433
4908
|
* it can stop.
|
|
4434
4909
|
*/
|
|
4435
4910
|
createPageRequest(req, res) {
|
|
4911
|
+
const existing = pageRequests.get(req);
|
|
4912
|
+
if (existing) return existing;
|
|
4913
|
+
const request2 = this.createPageRequestOnce(req, res);
|
|
4914
|
+
pageRequests.set(req, request2);
|
|
4915
|
+
return request2;
|
|
4916
|
+
}
|
|
4917
|
+
createPageRequestOnce(req, res) {
|
|
4436
4918
|
const observable = typeof req.once === "function" && typeof res.once === "function";
|
|
4437
|
-
return
|
|
4438
|
-
trustProxy: _optionalChain([this, 'access',
|
|
4439
|
-
signal: observable ?
|
|
4919
|
+
return _chunk2RSVYJT6cjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
4920
|
+
trustProxy: _optionalChain([this, 'access', _127 => _127.config, 'access', _128 => _128.server, 'optionalAccess', _129 => _129.trustProxy]),
|
|
4921
|
+
signal: observable ? _chunk7Q7UB4TLcjs.createFarmNodeRequestAbortSignal.call(void 0,
|
|
4440
4922
|
req,
|
|
4441
4923
|
res
|
|
4442
4924
|
) : void 0
|
|
@@ -4463,8 +4945,9 @@ var ServerRenderer = class {
|
|
|
4463
4945
|
durationMs: Date.now() - renderStartTime
|
|
4464
4946
|
});
|
|
4465
4947
|
};
|
|
4948
|
+
let pprShellWrite;
|
|
4466
4949
|
try {
|
|
4467
|
-
const url =
|
|
4950
|
+
const url = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _130 => _130.config, 'access', _131 => _131.server, 'optionalAccess', _132 => _132.trustProxy]) });
|
|
4468
4951
|
pathname = url.pathname;
|
|
4469
4952
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.start", route: pathname, pathname });
|
|
4470
4953
|
searchParamsObject = _chunkSUCDVKUBcjs.searchParamsToObject.call(void 0, url.searchParams);
|
|
@@ -4534,7 +5017,7 @@ var ServerRenderer = class {
|
|
|
4534
5017
|
layouts = match.layouts;
|
|
4535
5018
|
routeSlots = _nullishCoalesce(match.slots, () => ( []));
|
|
4536
5019
|
if (!route) {
|
|
4537
|
-
if (
|
|
5020
|
+
if (_chunkYRXPDKMMcjs.isFarmDefaultMCPPathname.call(void 0, pathname) && this.getDefaultMCPServer()) {
|
|
4538
5021
|
await this.renderDefaultMCP(req, res);
|
|
4539
5022
|
completeRender(res.statusCode || 200, pathname);
|
|
4540
5023
|
return;
|
|
@@ -4551,7 +5034,7 @@ var ServerRenderer = class {
|
|
|
4551
5034
|
params
|
|
4552
5035
|
});
|
|
4553
5036
|
let actionRequest;
|
|
4554
|
-
if (req.method === "POST" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
5037
|
+
if (req.method === "POST" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _133 => _133.config, 'access', _134 => _134.experimental, 'optionalAccess', _135 => _135.serverComponents])) === "islands") {
|
|
4555
5038
|
await Promise.all([
|
|
4556
5039
|
this.routeManager.loadRouteModule(route.modulePath),
|
|
4557
5040
|
...layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
@@ -4562,9 +5045,9 @@ var ServerRenderer = class {
|
|
|
4562
5045
|
toMiddlewareMap(req.__FARM_MIDDLEWARE_DATA__),
|
|
4563
5046
|
() => _chunkYDXLC4DWcjs._runWithMiddlewareContext.call(void 0,
|
|
4564
5047
|
toMiddlewareMap(req.__FARM_MIDDLEWARE_CONTEXT__),
|
|
4565
|
-
() =>
|
|
5048
|
+
() => _chunkPBJ7MEOVcjs.handleFarmFormActionRequest.call(void 0,
|
|
4566
5049
|
formActionRequest,
|
|
4567
|
-
|
|
5050
|
+
_chunkXRFGOYXGcjs.resolveServerActionsConfig.call(void 0, this.config.serverActions),
|
|
4568
5051
|
// Before a rewrite, the URL the browser posted to.
|
|
4569
5052
|
new URL(
|
|
4570
5053
|
_nullishCoalesce(_nullishCoalesce(req.originalUrl, () => ( req.url)), () => ( "/")),
|
|
@@ -4627,11 +5110,11 @@ var ServerRenderer = class {
|
|
|
4627
5110
|
searchParams: _chunkSUCDVKUBcjs.createFarmSearchParams.call(void 0, searchParamsObject),
|
|
4628
5111
|
error
|
|
4629
5112
|
};
|
|
4630
|
-
if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess',
|
|
5113
|
+
if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _136 => _136.notFound])) {
|
|
4631
5114
|
res.statusCode = 404;
|
|
4632
5115
|
PageComponent = programmaticRouteComponents.notFound;
|
|
4633
5116
|
pageProps = routeStateProps;
|
|
4634
|
-
} else if (_optionalChain([programmaticRouteComponents, 'optionalAccess',
|
|
5117
|
+
} else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _137 => _137.error])) {
|
|
4635
5118
|
res.statusCode = 500;
|
|
4636
5119
|
PageComponent = programmaticRouteComponents.error;
|
|
4637
5120
|
pageProps = routeStateProps;
|
|
@@ -4639,21 +5122,21 @@ var ServerRenderer = class {
|
|
|
4639
5122
|
throw error;
|
|
4640
5123
|
}
|
|
4641
5124
|
}
|
|
4642
|
-
const renderingConfig = await
|
|
5125
|
+
const renderingConfig = await _chunk7564NP5Zcjs.resolveRouteRenderingConfigFromFile.call(void 0,
|
|
4643
5126
|
routeModule,
|
|
4644
5127
|
route.modulePath,
|
|
4645
|
-
{ experimentalPPR: _optionalChain([this, 'access',
|
|
5128
|
+
{ experimentalPPR: _optionalChain([this, 'access', _138 => _138.config, 'access', _139 => _139.experimental, 'optionalAccess', _140 => _140.ppr]) === true }
|
|
4646
5129
|
);
|
|
4647
5130
|
const pprBypassReason = renderingConfig.ppr ? this.getPPRShellBypassReason(req, middlewareMap, middlewareContext, pluginExposedContext) : void 0;
|
|
4648
5131
|
const islandsNavigationRequest = Boolean(
|
|
4649
5132
|
islands && this.islandValues() && (requestHeader(req, "f-layouts") || requestHeader(req, "f-stream"))
|
|
4650
5133
|
);
|
|
4651
5134
|
const canCachePPRShell = renderingConfig.ppr && !pprBypassReason && !islandsNavigationRequest;
|
|
4652
|
-
const pprI18nSnapshot = canCachePPRShell ?
|
|
4653
|
-
|
|
5135
|
+
const pprI18nSnapshot = canCachePPRShell ? _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, ) : void 0;
|
|
5136
|
+
let pprShellOptions = canCachePPRShell ? {
|
|
4654
5137
|
pathname,
|
|
4655
5138
|
search: url.search,
|
|
4656
|
-
locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess',
|
|
5139
|
+
locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _141 => _141.locale]), () => ( "")),
|
|
4657
5140
|
origin: pprI18nSnapshot && pprI18nSnapshot.routing !== "none" ? url.origin : "",
|
|
4658
5141
|
revalidate: renderingConfig.revalidate
|
|
4659
5142
|
} : void 0;
|
|
@@ -4673,6 +5156,7 @@ var ServerRenderer = class {
|
|
|
4673
5156
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "ppr.refresh.start", route: pathname });
|
|
4674
5157
|
}
|
|
4675
5158
|
}
|
|
5159
|
+
const pprVisitorCookies = Boolean(_chunkNLBHLPEOcjs.withoutFarmDeploymentCookie.call(void 0, req.headers.cookie));
|
|
4676
5160
|
if (pprShellOptions) {
|
|
4677
5161
|
const pprCacheKey = this.getPPRCacheKey(
|
|
4678
5162
|
pathname,
|
|
@@ -4686,25 +5170,37 @@ var ServerRenderer = class {
|
|
|
4686
5170
|
pprShellOptions.locale,
|
|
4687
5171
|
pprShellOptions.origin
|
|
4688
5172
|
);
|
|
4689
|
-
if (cachedPPRShell) {
|
|
5173
|
+
if (cachedPPRShell && pprVisitorCookies && !cachedPPRShell.value.cookieIndependent) {
|
|
5174
|
+
pprShellOptions = void 0;
|
|
5175
|
+
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "ppr.shell.bypass", route: pathname, reason: "cookie" });
|
|
5176
|
+
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "cache.bypass", route: pathname, reason: "cookie" });
|
|
5177
|
+
} else if (cachedPPRShell) {
|
|
4690
5178
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
4691
5179
|
type: "ppr.shell.hit",
|
|
4692
5180
|
route: pathname,
|
|
4693
5181
|
key: pprCacheKey
|
|
4694
5182
|
});
|
|
4695
|
-
this.serveCachedPPRShell(res, cachedPPRShell.value, renderingConfig.revalidate);
|
|
5183
|
+
this.serveCachedPPRShell(req, res, cachedPPRShell.value, renderingConfig.revalidate);
|
|
4696
5184
|
completeRender(res.statusCode || 200, pathname);
|
|
4697
5185
|
return;
|
|
5186
|
+
} else {
|
|
5187
|
+
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
5188
|
+
type: "ppr.shell.miss",
|
|
5189
|
+
route: pathname,
|
|
5190
|
+
key: pprCacheKey
|
|
5191
|
+
});
|
|
5192
|
+
if (req.method !== "HEAD") {
|
|
5193
|
+
pprShellWrite = await this.dataCache.pprShellCache.startWriteAsync(
|
|
5194
|
+
this.getPPRShellWriteOptions(pprShellOptions)
|
|
5195
|
+
);
|
|
5196
|
+
}
|
|
4698
5197
|
}
|
|
4699
|
-
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
4700
|
-
type: "ppr.shell.miss",
|
|
4701
|
-
route: pathname,
|
|
4702
|
-
key: pprCacheKey
|
|
4703
|
-
});
|
|
4704
5198
|
}
|
|
4705
5199
|
const outerRequest = _chunk3BIASUGRcjs._peekCurrentRequest.call(void 0, );
|
|
4706
|
-
const countRequestReads = () => (outerRequest ?
|
|
5200
|
+
const countRequestReads = () => (outerRequest ? _chunk2RSVYJT6cjs._getRequestReadCount.call(void 0, outerRequest) : 0) + _chunk2RSVYJT6cjs._getRequestReadCount.call(void 0, currentRequest);
|
|
4707
5201
|
const requestReadsBeforeRender = countRequestReads();
|
|
5202
|
+
const countRequestCookieReads = () => (outerRequest ? _chunk2RSVYJT6cjs._getRequestCookieReadCount.call(void 0, outerRequest) : 0) + _chunk2RSVYJT6cjs._getRequestCookieReadCount.call(void 0, currentRequest);
|
|
5203
|
+
const requestCookieReadsBeforeRender = countRequestCookieReads();
|
|
4708
5204
|
let LoadingFallbackComponent = null;
|
|
4709
5205
|
if (loadingBoundaryEntry) {
|
|
4710
5206
|
const loadingModule = await this.routeManager.loadRouteModule(
|
|
@@ -4725,7 +5221,7 @@ var ServerRenderer = class {
|
|
|
4725
5221
|
const routeManifestEntry = routeManifest.routes.find(
|
|
4726
5222
|
(entry) => entry.pattern === route.pattern
|
|
4727
5223
|
);
|
|
4728
|
-
const moduleMetadata = routeManifestEntry ||
|
|
5224
|
+
const moduleMetadata = routeManifestEntry || _chunkQP4GYVRRcjs.getClientModuleMetadata.call(void 0, route.modulePath, this.config.root);
|
|
4729
5225
|
const isClientComponent = moduleMetadata.isClientComponent;
|
|
4730
5226
|
const renderedRouteSlots = await Promise.all(
|
|
4731
5227
|
routeSlots.map(async (slot) => {
|
|
@@ -4776,20 +5272,20 @@ var ServerRenderer = class {
|
|
|
4776
5272
|
if (moduleMetadata.suppressedAsyncHydration) {
|
|
4777
5273
|
warnSuppressedAsyncHydrationOnce(
|
|
4778
5274
|
route.modulePath,
|
|
4779
|
-
_optionalChain([routeManifestEntry, 'optionalAccess',
|
|
5275
|
+
_optionalChain([routeManifestEntry, 'optionalAccess', _142 => _142.suppressedAsyncHydrationReason])
|
|
4780
5276
|
);
|
|
4781
5277
|
}
|
|
4782
5278
|
const layoutHydrationMetadata = layouts.map((layout) => {
|
|
4783
5279
|
const manifestEntry = routeManifest.layouts.find(
|
|
4784
5280
|
(entry) => entry.pattern === layout.pattern
|
|
4785
5281
|
);
|
|
4786
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
5282
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _143 => _143.suppressedAsyncHydration])) {
|
|
4787
5283
|
warnSuppressedAsyncHydrationOnce(
|
|
4788
5284
|
layout.modulePath,
|
|
4789
5285
|
manifestEntry.suppressedAsyncHydrationReason
|
|
4790
5286
|
);
|
|
4791
5287
|
}
|
|
4792
|
-
if (typeof _optionalChain([manifestEntry, 'optionalAccess',
|
|
5288
|
+
if (typeof _optionalChain([manifestEntry, 'optionalAccess', _144 => _144.shouldHydrate]) === "boolean") {
|
|
4793
5289
|
return {
|
|
4794
5290
|
isClientComponent: manifestEntry.isClientComponent === true,
|
|
4795
5291
|
shouldHydrate: manifestEntry.shouldHydrate,
|
|
@@ -4809,12 +5305,12 @@ var ServerRenderer = class {
|
|
|
4809
5305
|
);
|
|
4810
5306
|
const clientLayouts = layouts.map((layout, index) => ({
|
|
4811
5307
|
pattern: layout.pattern,
|
|
4812
|
-
modulePath:
|
|
4813
|
-
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access',
|
|
4814
|
-
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access',
|
|
4815
|
-
..._optionalChain([layoutHydrationMetadata, 'access',
|
|
5308
|
+
modulePath: _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, layout.modulePath, this.config.root),
|
|
5309
|
+
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _145 => _145[index], 'optionalAccess', _146 => _146.shouldHydrate]) === true,
|
|
5310
|
+
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _147 => _147[index], 'optionalAccess', _148 => _148.islandStrategy]), () => ( null)),
|
|
5311
|
+
..._optionalChain([layoutHydrationMetadata, 'access', _149 => _149[index], 'optionalAccess', _150 => _150.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {},
|
|
4816
5312
|
// Islands mode: the browser rebuilds this layout from its tree, not its module.
|
|
4817
|
-
...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access',
|
|
5313
|
+
...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _151 => _151[index], 'optionalAccess', _152 => _152.serverTree]) === true ? { serverTree: true } : {}
|
|
4818
5314
|
}));
|
|
4819
5315
|
const hydrationStrategies = [
|
|
4820
5316
|
...shouldHydrate && moduleMetadata.islandStrategy ? [moduleMetadata.islandStrategy] : [],
|
|
@@ -4828,9 +5324,9 @@ var ServerRenderer = class {
|
|
|
4828
5324
|
layouts.map((layout, index) => ({
|
|
4829
5325
|
pattern: layout.pattern,
|
|
4830
5326
|
modulePath: layout.modulePath,
|
|
4831
|
-
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access',
|
|
4832
|
-
hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access',
|
|
4833
|
-
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access',
|
|
5327
|
+
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _153 => _153[index], 'optionalAccess', _154 => _154.shouldHydrate]) === true,
|
|
5328
|
+
hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _155 => _155[index], 'optionalAccess', _156 => _156.hasIsolatedClientBoundaries]) === true,
|
|
5329
|
+
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _157 => _157[index], 'optionalAccess', _158 => _158.islandStrategy]), () => ( null))
|
|
4834
5330
|
})),
|
|
4835
5331
|
this.config.root || process.cwd(),
|
|
4836
5332
|
true
|
|
@@ -4838,9 +5334,10 @@ var ServerRenderer = class {
|
|
|
4838
5334
|
const hasHydratableRouteSlots = renderedRouteSlots.some(
|
|
4839
5335
|
(slot) => slot.isClientComponent || slot.shouldHydrate
|
|
4840
5336
|
);
|
|
4841
|
-
const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess',
|
|
5337
|
+
const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _159 => _159.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
|
|
4842
5338
|
req.__FARM_PAGE_PATH__ = route.modulePath;
|
|
4843
5339
|
req.__FARM_ROUTE__ = pathname;
|
|
5340
|
+
req.__FARM_ROOT_LAYOUT_PATH__ = _optionalChain([layouts, 'access', _160 => _160[0], 'optionalAccess', _161 => _161.modulePath]);
|
|
4844
5341
|
req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
|
|
4845
5342
|
req.__FARM_PAGE_SHOULD_HYDRATE__ = shouldHydrate;
|
|
4846
5343
|
req.__FARM_LAYOUT_SHOULD_HYDRATE__ = shouldHydrateLayout;
|
|
@@ -4851,7 +5348,7 @@ var ServerRenderer = class {
|
|
|
4851
5348
|
req.__FARM_SHOULD_HYDRATE__ = shouldHydrate || shouldHydrateLayout || hasIsolatedClientBoundaries;
|
|
4852
5349
|
req.__FARM_ISLAND_STRATEGY__ = hydrationIslandStrategy;
|
|
4853
5350
|
req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ = hasHydratableRouteSlots;
|
|
4854
|
-
req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess',
|
|
5351
|
+
req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _162 => _162.modulePath]) ? _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
|
|
4855
5352
|
req.__FARM_ROUTE_SLOTS__ = renderedRouteSlots.map((slot) => ({
|
|
4856
5353
|
name: slot.name,
|
|
4857
5354
|
ownerPattern: slot.ownerPattern,
|
|
@@ -4900,7 +5397,7 @@ var ServerRenderer = class {
|
|
|
4900
5397
|
const middlewareDataForContext = middlewareMap;
|
|
4901
5398
|
await _chunkYDXLC4DWcjs._runWithMiddlewareData.call(void 0, middlewareDataForContext, async () => {
|
|
4902
5399
|
await _chunkYDXLC4DWcjs._runWithMiddlewareContext.call(void 0, middlewareContext, async () => {
|
|
4903
|
-
await
|
|
5400
|
+
await _chunk2RSVYJT6cjs._runWithCurrentRequest.call(void 0, currentRequest, async () => {
|
|
4904
5401
|
let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
|
|
4905
5402
|
if (LoadingFallbackComponent && !islandsNavigationRequest) {
|
|
4906
5403
|
const loadingFallback = this.rendererRuntime.createElement(LoadingFallbackComponent, {
|
|
@@ -4923,7 +5420,7 @@ var ServerRenderer = class {
|
|
|
4923
5420
|
} else if (shouldHydrateLayout && !(isClientComponent || shouldHydrate) && this.rendererRuntime.isolateServerPageGraph) {
|
|
4924
5421
|
pageElement = await this.isolateServerPage(
|
|
4925
5422
|
pageElement,
|
|
4926
|
-
_optionalChain([routeManifestEntry, 'optionalAccess',
|
|
5423
|
+
_optionalChain([routeManifestEntry, 'optionalAccess', _163 => _163.serverTree]) === true
|
|
4927
5424
|
);
|
|
4928
5425
|
}
|
|
4929
5426
|
pageElement = this.createPageBoundary(pageElement, {
|
|
@@ -4934,10 +5431,11 @@ var ServerRenderer = class {
|
|
|
4934
5431
|
const islandsSegments = Boolean(islands && this.islandValues());
|
|
4935
5432
|
const keptLayoutCount = islandsSegments && !renderingConfig.ssg && !shouldHydrateLayout && renderedRouteSlots.length === 0 ? countFarmKeptLayouts(requestHeader(req, "f-layouts"), layouts, params) : 0;
|
|
4936
5433
|
let keptLayouts = keptLayoutCount > 1 ? keptLayoutCount : 0;
|
|
4937
|
-
|
|
5434
|
+
const keptRoot = this.config.root || process.cwd();
|
|
5435
|
+
if (keptLayouts > 0 && !layouts.slice(0, keptLayouts).every((layout) => canFarmSkipKeptLayoutRender(layout.modulePath, keptRoot))) {
|
|
4938
5436
|
let keptElement = null;
|
|
4939
5437
|
for (let i = keptLayouts - 1; i >= 0; i--) {
|
|
4940
|
-
const KeptLayout = _optionalChain([layoutModules, 'access',
|
|
5438
|
+
const KeptLayout = _optionalChain([layoutModules, 'access', _164 => _164[i], 'optionalAccess', _165 => _165.default]);
|
|
4941
5439
|
if (KeptLayout) {
|
|
4942
5440
|
keptElement = this.rendererRuntime.createElement(KeptLayout, {
|
|
4943
5441
|
children: keptElement,
|
|
@@ -4950,7 +5448,7 @@ var ServerRenderer = class {
|
|
|
4950
5448
|
await this.wrapWithIntegrationProviders(this.wrapClientGraph(keptElement)),
|
|
4951
5449
|
{ rejectLateErrors: true }
|
|
4952
5450
|
);
|
|
4953
|
-
} catch (
|
|
5451
|
+
} catch (e17) {
|
|
4954
5452
|
keptLayouts = 0;
|
|
4955
5453
|
}
|
|
4956
5454
|
}
|
|
@@ -4986,7 +5484,7 @@ var ServerRenderer = class {
|
|
|
4986
5484
|
);
|
|
4987
5485
|
slotProps[slot.name] = slotElement;
|
|
4988
5486
|
}
|
|
4989
|
-
wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access',
|
|
5487
|
+
wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _166 => _166[i], 'optionalAccess', _167 => _167.serverTree]) === true && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
|
|
4990
5488
|
LayoutComponent,
|
|
4991
5489
|
{ params },
|
|
4992
5490
|
{ children: wrappedElement, ...slotProps },
|
|
@@ -5023,8 +5521,14 @@ var ServerRenderer = class {
|
|
|
5023
5521
|
wrappedElement
|
|
5024
5522
|
);
|
|
5025
5523
|
}
|
|
5524
|
+
if ((isClientComponent || shouldHydrate) && !shouldHydrateLayout && this.reactRenderer) {
|
|
5525
|
+
wrappedElement = this.reactRenderer.markLayoutPosition(wrappedElement);
|
|
5526
|
+
}
|
|
5026
5527
|
const integratedElement = await this.wrapWithIntegrationProviders(wrappedElement);
|
|
5027
5528
|
const pprHeaders = renderingConfig.ppr ? this.getPPRHeaders(pprShellOptions ? "miss" : "bypass", renderingConfig.revalidate) : void 0;
|
|
5529
|
+
if (pprHeaders && pprShellOptions && pprVisitorCookies) {
|
|
5530
|
+
pprHeaders["Cache-Control"] = "private, no-store";
|
|
5531
|
+
}
|
|
5028
5532
|
await this.renderWithSSR(
|
|
5029
5533
|
integratedElement,
|
|
5030
5534
|
req,
|
|
@@ -5057,7 +5561,26 @@ var ServerRenderer = class {
|
|
|
5057
5561
|
});
|
|
5058
5562
|
return;
|
|
5059
5563
|
}
|
|
5060
|
-
|
|
5564
|
+
const renderReadCookies = countRequestCookieReads() !== requestCookieReadsBeforeRender;
|
|
5565
|
+
if (renderReadCookies && pprVisitorCookies) {
|
|
5566
|
+
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
5567
|
+
type: "ppr.shell.bypass",
|
|
5568
|
+
route: pathname,
|
|
5569
|
+
reason: "cookie"
|
|
5570
|
+
});
|
|
5571
|
+
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
5572
|
+
type: "cache.bypass",
|
|
5573
|
+
route: pathname,
|
|
5574
|
+
reason: "cookie"
|
|
5575
|
+
});
|
|
5576
|
+
return;
|
|
5577
|
+
}
|
|
5578
|
+
return this.cachePPRShell(
|
|
5579
|
+
pprShellOptions,
|
|
5580
|
+
html,
|
|
5581
|
+
pprShellWrite,
|
|
5582
|
+
!renderReadCookies
|
|
5583
|
+
);
|
|
5061
5584
|
} : void 0
|
|
5062
5585
|
}
|
|
5063
5586
|
);
|
|
@@ -5085,8 +5608,8 @@ var ServerRenderer = class {
|
|
|
5085
5608
|
}
|
|
5086
5609
|
if (_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error)) {
|
|
5087
5610
|
const redirect = _chunk7JUIK547cjs.getFarmRedirectError.call(void 0, error);
|
|
5088
|
-
const snapshot =
|
|
5089
|
-
const redirectUrl = snapshot && redirect.url.startsWith("/") && !redirect.url.startsWith("//") ?
|
|
5611
|
+
const snapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
5612
|
+
const redirectUrl = snapshot && redirect.url.startsWith("/") && !redirect.url.startsWith("//") ? _chunkGYJT2U7Jcjs.localizeFarmHref.call(void 0, redirect.url, snapshot.locale, snapshot) : redirect.url;
|
|
5090
5613
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
5091
5614
|
type: "route.redirect",
|
|
5092
5615
|
from: pathname,
|
|
@@ -5122,7 +5645,7 @@ var ServerRenderer = class {
|
|
|
5122
5645
|
}
|
|
5123
5646
|
}
|
|
5124
5647
|
emitFarmRenderError(req, pathname, error);
|
|
5125
|
-
const errorStatus =
|
|
5648
|
+
const errorStatus = _chunk6ZFGWB75cjs.resolveDefaultErrorStatus.call(void 0, error);
|
|
5126
5649
|
if (pprRefreshRoute) {
|
|
5127
5650
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
5128
5651
|
type: "ppr.refresh.error",
|
|
@@ -5130,7 +5653,7 @@ var ServerRenderer = class {
|
|
|
5130
5653
|
error
|
|
5131
5654
|
});
|
|
5132
5655
|
}
|
|
5133
|
-
|
|
5656
|
+
_chunkGC5ROI3Acjs.logger.error(`Error rendering page: ${error}`);
|
|
5134
5657
|
if (res.headersSent || res.writableEnded) {
|
|
5135
5658
|
if (!res.writableEnded) {
|
|
5136
5659
|
res.end();
|
|
@@ -5148,17 +5671,20 @@ var ServerRenderer = class {
|
|
|
5148
5671
|
pluginExposedContext,
|
|
5149
5672
|
error,
|
|
5150
5673
|
statusCode: errorStatus,
|
|
5151
|
-
errorModulePath: errorBoundaryEntry.modulePath
|
|
5674
|
+
errorModulePath: errorBoundaryEntry.modulePath,
|
|
5675
|
+
errorPattern: errorBoundaryEntry.pattern
|
|
5152
5676
|
});
|
|
5153
5677
|
if (rendered) {
|
|
5154
5678
|
return;
|
|
5155
5679
|
}
|
|
5156
5680
|
}
|
|
5157
5681
|
await this.renderError(req, res, error, errorStatus);
|
|
5682
|
+
} finally {
|
|
5683
|
+
_optionalChain([pprShellWrite, 'optionalAccess', _168 => _168.release, 'call', _169 => _169()]);
|
|
5158
5684
|
}
|
|
5159
5685
|
}
|
|
5160
5686
|
async wrapWithIntegrationProviders(element) {
|
|
5161
|
-
const providers =
|
|
5687
|
+
const providers = _chunkOWO7KDZ3cjs.getIntegrationProviders.call(void 0, this.config.integrations);
|
|
5162
5688
|
let wrapped = element;
|
|
5163
5689
|
for (let i = providers.length - 1; i >= 0; i--) {
|
|
5164
5690
|
const provider = providers[i];
|
|
@@ -5166,7 +5692,7 @@ var ServerRenderer = class {
|
|
|
5166
5692
|
const rendererCapabilities = _chunk67MZTLTFcjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
|
|
5167
5693
|
if (!rendererCapabilities.functionComponents) {
|
|
5168
5694
|
throw new Error(
|
|
5169
|
-
`Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access',
|
|
5695
|
+
`Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _170 => _170.config, 'access', _171 => _171.renderer, 'optionalAccess', _172 => _172.name]), () => ( "the configured renderer"))}\` cannot.`
|
|
5170
5696
|
);
|
|
5171
5697
|
}
|
|
5172
5698
|
if (provider.type === "clerk" && !_chunk67MZTLTFcjs.isReactRenderer.call(void 0, this.config.renderer)) {
|
|
@@ -5176,14 +5702,14 @@ var ServerRenderer = class {
|
|
|
5176
5702
|
}
|
|
5177
5703
|
let ProviderComponent;
|
|
5178
5704
|
let providerSourceModule;
|
|
5179
|
-
if (
|
|
5705
|
+
if (_chunkOWO7KDZ3cjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
|
|
5180
5706
|
providerSourceModule = provider.component.module;
|
|
5181
|
-
const providerModuleId = provider.component.module.startsWith(".") ?
|
|
5182
|
-
|
|
5707
|
+
const providerModuleId = provider.component.module.startsWith(".") ? _chunkGC5ROI3Acjs.toViteModuleId.call(void 0,
|
|
5708
|
+
path10.resolve(this.config.root, provider.component.module),
|
|
5183
5709
|
this.config.root
|
|
5184
5710
|
) : provider.component.module;
|
|
5185
|
-
const providerModule = this.viteServer ? await
|
|
5186
|
-
provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0,
|
|
5711
|
+
const providerModule = this.viteServer ? await _chunk25JGHAGHcjs.loadFarmDevModule.call(void 0, this.viteServer, providerModuleId) : await importRuntimeModule(
|
|
5712
|
+
provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0, path10.resolve(this.config.root, provider.component.module)).href : provider.component.module
|
|
5187
5713
|
);
|
|
5188
5714
|
ProviderComponent = providerModule[provider.component.export || "default"];
|
|
5189
5715
|
} else if (typeof provider.component === "function") {
|
|
@@ -5205,7 +5731,7 @@ var ServerRenderer = class {
|
|
|
5205
5731
|
}
|
|
5206
5732
|
if (provider.type !== "clerk" && typeof this.rendererRuntime.markFunctionComponent === "function" && !isRendererCompiledComponent(
|
|
5207
5733
|
_nullishCoalesce(providerSourceModule, () => ( "")),
|
|
5208
|
-
_chunk67MZTLTFcjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access',
|
|
5734
|
+
_chunk67MZTLTFcjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _173 => _173.config, 'access', _174 => _174.renderer, 'optionalAccess', _175 => _175.componentExtensions]))
|
|
5209
5735
|
)) {
|
|
5210
5736
|
ProviderComponent = this.rendererRuntime.markFunctionComponent(ProviderComponent);
|
|
5211
5737
|
}
|
|
@@ -5221,27 +5747,27 @@ var ServerRenderer = class {
|
|
|
5221
5747
|
async resolveRouteMetadata(options) {
|
|
5222
5748
|
let metadata = {};
|
|
5223
5749
|
for (const layoutModule of options.layoutModules) {
|
|
5224
|
-
metadata =
|
|
5750
|
+
metadata = _chunkY3DO7BIJcjs.mergeMetadata.call(void 0, metadata, layoutModule.metadata);
|
|
5225
5751
|
if (typeof layoutModule.generateMetadata === "function") {
|
|
5226
|
-
metadata =
|
|
5752
|
+
metadata = _chunkY3DO7BIJcjs.mergeMetadata.call(void 0,
|
|
5227
5753
|
metadata,
|
|
5228
5754
|
await layoutModule.generateMetadata({
|
|
5229
5755
|
params: options.pageProps.params
|
|
5230
5756
|
})
|
|
5231
5757
|
);
|
|
5232
5758
|
}
|
|
5233
|
-
metadata = await
|
|
5759
|
+
metadata = await _chunkY3DO7BIJcjs.mergeModuleViewport.call(void 0, metadata, layoutModule, {
|
|
5234
5760
|
params: options.pageProps.params
|
|
5235
5761
|
});
|
|
5236
5762
|
}
|
|
5237
|
-
metadata =
|
|
5763
|
+
metadata = _chunkY3DO7BIJcjs.mergeMetadata.call(void 0, metadata, options.routeModule.metadata);
|
|
5238
5764
|
if (!options.skipGeneratedRouteMetadata && typeof options.routeModule.generateMetadata === "function") {
|
|
5239
|
-
metadata =
|
|
5765
|
+
metadata = _chunkY3DO7BIJcjs.mergeMetadata.call(void 0,
|
|
5240
5766
|
metadata,
|
|
5241
5767
|
await options.routeModule.generateMetadata(options.pageProps)
|
|
5242
5768
|
);
|
|
5243
5769
|
}
|
|
5244
|
-
metadata = await
|
|
5770
|
+
metadata = await _chunkY3DO7BIJcjs.mergeModuleViewport.call(void 0,
|
|
5245
5771
|
metadata,
|
|
5246
5772
|
options.skipGeneratedRouteMetadata ? { viewport: options.routeModule.viewport } : options.routeModule,
|
|
5247
5773
|
options.pageProps
|
|
@@ -5256,25 +5782,25 @@ var ServerRenderer = class {
|
|
|
5256
5782
|
manifestMatch.metadata,
|
|
5257
5783
|
manifestMatch.params
|
|
5258
5784
|
);
|
|
5259
|
-
const snapshot2 =
|
|
5260
|
-
const localizedHref = snapshot2 ?
|
|
5785
|
+
const snapshot2 = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
5786
|
+
const localizedHref = snapshot2 ? _chunkGYJT2U7Jcjs.localizeFarmHref.call(void 0, rawHref, snapshot2.locale, snapshot2) : rawHref;
|
|
5261
5787
|
metadata.manifest = _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, localizedHref, this.config.basePath);
|
|
5262
5788
|
}
|
|
5263
5789
|
}
|
|
5264
5790
|
for (const kind of ["opengraph", "twitter"]) {
|
|
5265
5791
|
const reference = await this.resolveMetadataImageReference(kind, options.pathname);
|
|
5266
5792
|
if (reference) {
|
|
5267
|
-
metadata =
|
|
5793
|
+
metadata = _chunkY3DO7BIJcjs.addMetadataImageReference.call(void 0, metadata, reference);
|
|
5268
5794
|
}
|
|
5269
5795
|
}
|
|
5270
|
-
const snapshot =
|
|
5796
|
+
const snapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
5271
5797
|
const publicPathname = _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0,
|
|
5272
|
-
snapshot ?
|
|
5798
|
+
snapshot ? _chunkGYJT2U7Jcjs.localizeFarmHref.call(void 0, options.pathname, snapshot.locale, snapshot) : options.pathname,
|
|
5273
5799
|
this.config.basePath
|
|
5274
5800
|
);
|
|
5275
|
-
metadata =
|
|
5801
|
+
metadata = _chunkY3DO7BIJcjs.addMetadataMarkdownAlternate.call(void 0,
|
|
5276
5802
|
metadata,
|
|
5277
|
-
|
|
5803
|
+
_chunk2YJ4DHTDcjs.getFarmMarkdownAlternatePath.call(void 0, _chunk2YJ4DHTDcjs.resolveMarkdownConfig.call(void 0, this.config.md), publicPathname, {
|
|
5278
5804
|
routePathname: (pathname) => this.routeManager.toRoutePathname(pathname)
|
|
5279
5805
|
})
|
|
5280
5806
|
);
|
|
@@ -5284,8 +5810,8 @@ var ServerRenderer = class {
|
|
|
5284
5810
|
const match = this.routeManager.getMatchingMetadataImage(pathname, kind);
|
|
5285
5811
|
if (!match) return null;
|
|
5286
5812
|
const rawHref = this.routeManager.resolveMetadataImagePath(match.image, match.params);
|
|
5287
|
-
const snapshot =
|
|
5288
|
-
const localizedHref = snapshot ?
|
|
5813
|
+
const snapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
5814
|
+
const localizedHref = snapshot ? _chunkGYJT2U7Jcjs.localizeFarmHref.call(void 0, rawHref, snapshot.locale, snapshot) : rawHref;
|
|
5289
5815
|
const href = _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, localizedHref, this.config.basePath);
|
|
5290
5816
|
const reference = {
|
|
5291
5817
|
kind,
|
|
@@ -5314,7 +5840,7 @@ var ServerRenderer = class {
|
|
|
5314
5840
|
reference.contentType = imageModule.contentType;
|
|
5315
5841
|
}
|
|
5316
5842
|
} catch (error) {
|
|
5317
|
-
|
|
5843
|
+
_chunkGC5ROI3Acjs.logger.warn(`Failed to read ${kind} image metadata for ${pathname}: ${error}`);
|
|
5318
5844
|
}
|
|
5319
5845
|
return reference;
|
|
5320
5846
|
}
|
|
@@ -5333,8 +5859,8 @@ var ServerRenderer = class {
|
|
|
5333
5859
|
`Metadata route module ${match.metadata.modulePath} does not export a default value or handler`
|
|
5334
5860
|
);
|
|
5335
5861
|
}
|
|
5336
|
-
const request2 =
|
|
5337
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5862
|
+
const request2 = _chunk2RSVYJT6cjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5863
|
+
trustProxy: _optionalChain([this, 'access', _176 => _176.config, 'access', _177 => _177.server, 'optionalAccess', _178 => _178.trustProxy])
|
|
5338
5864
|
});
|
|
5339
5865
|
const url = new URL(request2.url);
|
|
5340
5866
|
const llmsContext = match.metadata.kind === "llms" || match.metadata.kind === "llms-full" ? await this.createLlmsTxtContext(request2, {
|
|
@@ -5348,17 +5874,17 @@ var ServerRenderer = class {
|
|
|
5348
5874
|
path: match.routePath,
|
|
5349
5875
|
...llmsContext
|
|
5350
5876
|
}) : routeModule.default;
|
|
5351
|
-
const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await
|
|
5877
|
+
const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunkWRWJ7IWTcjs.renderFarmLlmsFullTxt.call(void 0, value, {
|
|
5352
5878
|
origin: await this.getAgentOrigin(request2),
|
|
5353
5879
|
readMarkdown: llmsContext.markdown
|
|
5354
5880
|
}) : value;
|
|
5355
|
-
const response =
|
|
5881
|
+
const response = _chunk6ZFGWB75cjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
|
|
5356
5882
|
method,
|
|
5357
5883
|
request: request2
|
|
5358
5884
|
});
|
|
5359
5885
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
|
|
5360
5886
|
} catch (error) {
|
|
5361
|
-
|
|
5887
|
+
_chunkGC5ROI3Acjs.logger.error(`Metadata route render failed for ${match.metadata.modulePath}: ${error}`);
|
|
5362
5888
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5363
5889
|
res,
|
|
5364
5890
|
new Response("Internal Server Error", {
|
|
@@ -5370,25 +5896,25 @@ var ServerRenderer = class {
|
|
|
5370
5896
|
}
|
|
5371
5897
|
/** `/llms.txt` and `/llms-full.txt` from `agent.llmsTxt` when no file route owns them. */
|
|
5372
5898
|
getGeneratedLlmsKind(pathname) {
|
|
5373
|
-
const config =
|
|
5899
|
+
const config = _chunkWRWJ7IWTcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _179 => _179.config, 'access', _180 => _180.agent, 'optionalAccess', _181 => _181.llmsTxt]));
|
|
5374
5900
|
if (!config.enabled) return null;
|
|
5375
5901
|
if (pathname === "/llms.txt") return "llms";
|
|
5376
5902
|
return pathname === "/llms-full.txt" && config.full ? "llms-full" : null;
|
|
5377
5903
|
}
|
|
5378
5904
|
async renderGeneratedLlmsTxt(req, res, kind) {
|
|
5379
5905
|
try {
|
|
5380
|
-
const request2 =
|
|
5381
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5906
|
+
const request2 = _chunk2RSVYJT6cjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5907
|
+
trustProxy: _optionalChain([this, 'access', _182 => _182.config, 'access', _183 => _183.server, 'optionalAccess', _184 => _184.trustProxy])
|
|
5382
5908
|
});
|
|
5383
|
-
const config =
|
|
5909
|
+
const config = _chunkWRWJ7IWTcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _185 => _185.config, 'access', _186 => _186.agent, 'optionalAccess', _187 => _187.llmsTxt]));
|
|
5384
5910
|
const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
|
|
5385
|
-
const body = kind === "llms-full" ? await
|
|
5911
|
+
const body = kind === "llms-full" ? await _chunkWRWJ7IWTcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
|
|
5386
5912
|
origin: await this.getAgentOrigin(request2),
|
|
5387
5913
|
readMarkdown: context.markdown
|
|
5388
5914
|
}) : context.defaults;
|
|
5389
5915
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5390
5916
|
res,
|
|
5391
|
-
|
|
5917
|
+
_chunk6ZFGWB75cjs.createFarmMetadataRouteResponse.call(void 0,
|
|
5392
5918
|
kind,
|
|
5393
5919
|
body,
|
|
5394
5920
|
{ revalidate: config.revalidate },
|
|
@@ -5396,7 +5922,7 @@ var ServerRenderer = class {
|
|
|
5396
5922
|
)
|
|
5397
5923
|
);
|
|
5398
5924
|
} catch (error) {
|
|
5399
|
-
|
|
5925
|
+
_chunkGC5ROI3Acjs.logger.error(`Generated ${kind}.txt failed: ${error}`);
|
|
5400
5926
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5401
5927
|
res,
|
|
5402
5928
|
new Response("Internal Server Error", {
|
|
@@ -5407,26 +5933,26 @@ var ServerRenderer = class {
|
|
|
5407
5933
|
}
|
|
5408
5934
|
}
|
|
5409
5935
|
getAgentCrawlers() {
|
|
5410
|
-
return
|
|
5936
|
+
return _chunkF4ID7BGOcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _188 => _188.config, 'access', _189 => _189.agent, 'optionalAccess', _190 => _190.crawlers]));
|
|
5411
5937
|
}
|
|
5412
5938
|
/** `/robots.txt` from `agent.crawlers` when no robots.ts owns it. */
|
|
5413
5939
|
async renderGeneratedRobotsTxt(req, res) {
|
|
5414
5940
|
try {
|
|
5415
|
-
const sitemapPath = _optionalChain([this, 'access',
|
|
5941
|
+
const sitemapPath = _optionalChain([this, 'access', _191 => _191.routeManager, 'access', _192 => _192.matchMetadataRoute, 'call', _193 => _193("/sitemap.xml"), 'optionalAccess', _194 => _194.metadata, 'access', _195 => _195.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
|
|
5416
5942
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
5417
5943
|
const rootMetadata = sitemapPath && rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
5418
|
-
const robots =
|
|
5944
|
+
const robots = _chunkF4ID7BGOcjs.createFarmAgentRobots.call(void 0, {
|
|
5419
5945
|
crawlers: this.getAgentCrawlers(),
|
|
5420
5946
|
sitemapPath,
|
|
5421
|
-
metadataBase: _optionalChain([rootMetadata, 'optionalAccess',
|
|
5947
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _196 => _196.metadataBase]),
|
|
5422
5948
|
basePath: this.config.basePath
|
|
5423
5949
|
});
|
|
5424
5950
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5425
5951
|
res,
|
|
5426
|
-
|
|
5952
|
+
_chunk6ZFGWB75cjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
|
|
5427
5953
|
);
|
|
5428
5954
|
} catch (error) {
|
|
5429
|
-
|
|
5955
|
+
_chunkGC5ROI3Acjs.logger.error(`Generated robots.txt failed: ${error}`);
|
|
5430
5956
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5431
5957
|
res,
|
|
5432
5958
|
new Response("Internal Server Error", {
|
|
@@ -5437,46 +5963,46 @@ var ServerRenderer = class {
|
|
|
5437
5963
|
}
|
|
5438
5964
|
}
|
|
5439
5965
|
getAgentSitemap() {
|
|
5440
|
-
return
|
|
5966
|
+
return _chunkF4ID7BGOcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _197 => _197.config, 'access', _198 => _198.agent, 'optionalAccess', _199 => _199.sitemap]));
|
|
5441
5967
|
}
|
|
5442
5968
|
/** `/sitemap.xml` from `agent.sitemap` when no sitemap.ts owns it. */
|
|
5443
5969
|
async renderGeneratedSitemap(req, res) {
|
|
5444
5970
|
try {
|
|
5445
|
-
const request2 =
|
|
5446
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5971
|
+
const request2 = _chunk2RSVYJT6cjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5972
|
+
trustProxy: _optionalChain([this, 'access', _200 => _200.config, 'access', _201 => _201.server, 'optionalAccess', _202 => _202.trustProxy])
|
|
5447
5973
|
});
|
|
5448
5974
|
const sources = await Promise.all(
|
|
5449
5975
|
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
5450
5976
|
const [module, stat] = await Promise.all([
|
|
5451
5977
|
this.routeManager.loadRouteModule(route.modulePath).catch((error) => {
|
|
5452
|
-
|
|
5978
|
+
_chunkGC5ROI3Acjs.logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
|
|
5453
5979
|
return void 0;
|
|
5454
5980
|
}),
|
|
5455
|
-
|
|
5981
|
+
fs7.promises.stat(route.modulePath).catch(() => void 0)
|
|
5456
5982
|
]);
|
|
5457
|
-
if (await this.isAgentPageNoIndex(pattern, _optionalChain([module, 'optionalAccess',
|
|
5458
|
-
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess',
|
|
5983
|
+
if (await this.isAgentPageNoIndex(pattern, _optionalChain([module, 'optionalAccess', _203 => _203.metadata]))) return null;
|
|
5984
|
+
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _204 => _204.mtime, 'access', _205 => _205.toISOString, 'call', _206 => _206()]) };
|
|
5459
5985
|
})
|
|
5460
5986
|
);
|
|
5461
5987
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
5462
5988
|
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
5463
|
-
const sitemap =
|
|
5989
|
+
const sitemap = _chunkF4ID7BGOcjs.createFarmDefaultSitemap.call(void 0,
|
|
5464
5990
|
sources.filter((source) => source !== null),
|
|
5465
5991
|
{
|
|
5466
5992
|
origin: new URL(request2.url).origin,
|
|
5467
5993
|
config: this.getAgentSitemap(),
|
|
5468
|
-
metadataBase: _optionalChain([rootMetadata, 'optionalAccess',
|
|
5994
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _207 => _207.metadataBase]),
|
|
5469
5995
|
basePath: this.config.basePath,
|
|
5470
5996
|
trailingSlash: this.config.trailingSlash,
|
|
5471
|
-
i18n: _optionalChain([this, 'access',
|
|
5997
|
+
i18n: _optionalChain([this, 'access', _208 => _208.i18nRuntime, 'optionalAccess', _209 => _209.config])
|
|
5472
5998
|
}
|
|
5473
5999
|
);
|
|
5474
6000
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5475
6001
|
res,
|
|
5476
|
-
|
|
6002
|
+
_chunk6ZFGWB75cjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
|
|
5477
6003
|
);
|
|
5478
6004
|
} catch (error) {
|
|
5479
|
-
|
|
6005
|
+
_chunkGC5ROI3Acjs.logger.error(`Generated sitemap.xml failed: ${error}`);
|
|
5480
6006
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5481
6007
|
res,
|
|
5482
6008
|
new Response("Internal Server Error", {
|
|
@@ -5500,9 +6026,9 @@ var ServerRenderer = class {
|
|
|
5500
6026
|
* matcher) covers, as the production build decides.
|
|
5501
6027
|
*/
|
|
5502
6028
|
getAgentListedRoutes() {
|
|
5503
|
-
const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access',
|
|
6029
|
+
const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _210 => _210.middlewareRoutes, 'optionalCall', _211 => _211()]), () => ( [])) };
|
|
5504
6030
|
return [...this.routeManager.getRoutes()].filter(
|
|
5505
|
-
([pattern]) => !pattern.includes("[") && !
|
|
6031
|
+
([pattern]) => !pattern.includes("[") && !_chunk6ZFGWB75cjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
|
|
5506
6032
|
);
|
|
5507
6033
|
}
|
|
5508
6034
|
/**
|
|
@@ -5518,7 +6044,7 @@ var ServerRenderer = class {
|
|
|
5518
6044
|
)
|
|
5519
6045
|
)
|
|
5520
6046
|
);
|
|
5521
|
-
return
|
|
6047
|
+
return _chunkWRWJ7IWTcjs.isFarmPageNoIndex.call(void 0, metadata, layoutMetadata);
|
|
5522
6048
|
}
|
|
5523
6049
|
/**
|
|
5524
6050
|
* The default read-only MCP server (`agent.mcp`), or undefined when the app has an MCP
|
|
@@ -5526,22 +6052,22 @@ var ServerRenderer = class {
|
|
|
5526
6052
|
* or a registered server such as the docs engine's. Production applies the same rules.
|
|
5527
6053
|
*/
|
|
5528
6054
|
getDefaultMCPServer() {
|
|
5529
|
-
if (_optionalChain([this, 'access',
|
|
5530
|
-
if (_optionalChain([this, 'access',
|
|
5531
|
-
if (this.routeManager.matchRoute(
|
|
5532
|
-
_nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer =
|
|
6055
|
+
if (_optionalChain([this, 'access', _212 => _212.config, 'access', _213 => _213.agent, 'optionalAccess', _214 => _214.mcp]) !== true || _chunkYRXPDKMMcjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
|
|
6056
|
+
if (_optionalChain([this, 'access', _215 => _215.apiRouteExists, 'optionalCall', _216 => _216("/api/mcp")])) return void 0;
|
|
6057
|
+
if (this.routeManager.matchRoute(_chunkYRXPDKMMcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
|
|
6058
|
+
_nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkYRXPDKMMcjs.createFarmDefaultMCPServer.call(void 0,
|
|
5533
6059
|
readAppPackageIdentity(this.config.root),
|
|
5534
|
-
|
|
6060
|
+
_chunkXLOORES5cjs.FARM_VERSION
|
|
5535
6061
|
))));
|
|
5536
|
-
return
|
|
6062
|
+
return _chunkYRXPDKMMcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
|
|
5537
6063
|
}
|
|
5538
6064
|
async renderDefaultMCP(req, res) {
|
|
5539
6065
|
const server = this.getDefaultMCPServer();
|
|
5540
|
-
const request2 = _nullishCoalesce(
|
|
6066
|
+
const request2 = _nullishCoalesce(_chunk2RSVYJT6cjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunk2RSVYJT6cjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _217 => _217.config, 'access', _218 => _218.server, 'optionalAccess', _219 => _219.trustProxy]) })));
|
|
5541
6067
|
try {
|
|
5542
|
-
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-
|
|
6068
|
+
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-73SGWVZT.cjs");
|
|
5543
6069
|
const origin = new URL(request2.url).origin;
|
|
5544
|
-
const i18n = _optionalChain([this, 'access',
|
|
6070
|
+
const i18n = _optionalChain([this, 'access', _220 => _220.i18nRuntime, 'optionalAccess', _221 => _221.config]);
|
|
5545
6071
|
const metadataBase = await this.getRootMetadataBase();
|
|
5546
6072
|
const response = await handleFarmDefaultMCPRequest(request2, {
|
|
5547
6073
|
server,
|
|
@@ -5556,13 +6082,13 @@ var ServerRenderer = class {
|
|
|
5556
6082
|
return await this.isAgentPageNoIndex(pattern, metadata) ? null : { pattern, module };
|
|
5557
6083
|
})
|
|
5558
6084
|
);
|
|
5559
|
-
return
|
|
6085
|
+
return _chunkYRXPDKMMcjs.collectFarmDefaultMCPPages.call(void 0,
|
|
5560
6086
|
sources.filter((source) => source !== null),
|
|
5561
6087
|
{
|
|
5562
6088
|
origin,
|
|
5563
6089
|
metadataBase,
|
|
5564
6090
|
basePath: this.config.basePath,
|
|
5565
|
-
markdown:
|
|
6091
|
+
markdown: _chunk2YJ4DHTDcjs.resolveMarkdownConfig.call(void 0, this.config.md),
|
|
5566
6092
|
trailingSlash: this.config.trailingSlash,
|
|
5567
6093
|
i18n
|
|
5568
6094
|
}
|
|
@@ -5573,7 +6099,7 @@ var ServerRenderer = class {
|
|
|
5573
6099
|
});
|
|
5574
6100
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
|
|
5575
6101
|
} catch (error) {
|
|
5576
|
-
|
|
6102
|
+
_chunkGC5ROI3Acjs.logger.error(`Default MCP server failed: ${error}`);
|
|
5577
6103
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5578
6104
|
res,
|
|
5579
6105
|
new Response(
|
|
@@ -5589,7 +6115,7 @@ var ServerRenderer = class {
|
|
|
5589
6115
|
}
|
|
5590
6116
|
/** Same inputs the production server gives llms.txt: static pages and root metadata. */
|
|
5591
6117
|
async createLlmsTxtContext(request2, options = {}) {
|
|
5592
|
-
const config =
|
|
6118
|
+
const config = _chunkWRWJ7IWTcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _222 => _222.config, 'access', _223 => _223.agent, 'optionalAccess', _224 => _224.llmsTxt]));
|
|
5593
6119
|
const origin = await this.getAgentOrigin(request2);
|
|
5594
6120
|
const sources = await Promise.all(
|
|
5595
6121
|
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
@@ -5599,33 +6125,33 @@ var ServerRenderer = class {
|
|
|
5599
6125
|
if (await this.isAgentPageNoIndex(pattern, module.metadata)) return null;
|
|
5600
6126
|
return { pattern, metadata: module.metadata };
|
|
5601
6127
|
} catch (error) {
|
|
5602
|
-
|
|
6128
|
+
_chunkGC5ROI3Acjs.logger.warn(`Could not read metadata for ${pattern} in llms.txt: ${error}`);
|
|
5603
6129
|
return { pattern };
|
|
5604
6130
|
}
|
|
5605
6131
|
})
|
|
5606
6132
|
);
|
|
5607
6133
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
5608
6134
|
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
5609
|
-
const pages =
|
|
6135
|
+
const pages = _chunkWRWJ7IWTcjs.collectFarmLlmsTxtPages.call(void 0,
|
|
5610
6136
|
sources.filter((source) => source !== null),
|
|
5611
6137
|
{
|
|
5612
6138
|
origin,
|
|
5613
6139
|
basePath: this.config.basePath,
|
|
5614
|
-
markdown:
|
|
6140
|
+
markdown: _chunk2YJ4DHTDcjs.resolveMarkdownConfig.call(void 0, this.config.md),
|
|
5615
6141
|
include: config.include,
|
|
5616
6142
|
exclude: config.exclude,
|
|
5617
6143
|
trailingSlash: this.config.trailingSlash,
|
|
5618
|
-
i18n: _optionalChain([this, 'access',
|
|
6144
|
+
i18n: _optionalChain([this, 'access', _225 => _225.i18nRuntime, 'optionalAccess', _226 => _226.config])
|
|
5619
6145
|
}
|
|
5620
6146
|
);
|
|
5621
6147
|
return {
|
|
5622
6148
|
pages,
|
|
5623
|
-
defaults:
|
|
6149
|
+
defaults: _chunkWRWJ7IWTcjs.createFarmDefaultLlmsTxt.call(void 0, {
|
|
5624
6150
|
origin,
|
|
5625
6151
|
pages,
|
|
5626
6152
|
config,
|
|
5627
6153
|
rootMetadata,
|
|
5628
|
-
mcp: _optionalChain([this, 'access',
|
|
6154
|
+
mcp: _optionalChain([this, 'access', _227 => _227.config, 'access', _228 => _228.agent, 'optionalAccess', _229 => _229.aiCatalog]) === false ? [] : _chunkWILPJVQEcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
|
|
5629
6155
|
basePath: this.config.basePath,
|
|
5630
6156
|
apiServerBasePath: _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0,
|
|
5631
6157
|
_chunkPMJSG4JScjs.normalizeFarmAPIConfig.call(void 0,
|
|
@@ -5636,7 +6162,7 @@ var ServerRenderer = class {
|
|
|
5636
6162
|
})
|
|
5637
6163
|
}),
|
|
5638
6164
|
...options.full ? {
|
|
5639
|
-
markdown:
|
|
6165
|
+
markdown: _chunkWRWJ7IWTcjs.readFarmLlmsMarkdownFrom.call(void 0,
|
|
5640
6166
|
new URL(request2.url).origin,
|
|
5641
6167
|
origin,
|
|
5642
6168
|
this.createDevMarkdownReader(options.req)
|
|
@@ -5649,13 +6175,13 @@ var ServerRenderer = class {
|
|
|
5649
6175
|
* `metadataBase`, else the request's origin, as for the sitemap and the production server.
|
|
5650
6176
|
*/
|
|
5651
6177
|
async getAgentOrigin(request2) {
|
|
5652
|
-
return
|
|
6178
|
+
return _chunkWRWJ7IWTcjs.resolveFarmAgentOrigin.call(void 0, await this.getRootMetadataBase(), new URL(request2.url).origin);
|
|
5653
6179
|
}
|
|
5654
6180
|
/** The root layout's `metadataBase`, which generated agent files and list_pages link to. */
|
|
5655
6181
|
async getRootMetadataBase() {
|
|
5656
6182
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
5657
6183
|
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
5658
|
-
return _optionalChain([rootMetadata, 'optionalAccess',
|
|
6184
|
+
return _optionalChain([rootMetadata, 'optionalAccess', _230 => _230.metadataBase]);
|
|
5659
6185
|
}
|
|
5660
6186
|
/**
|
|
5661
6187
|
* Reads page mirrors back through this dev server, the way its .md handler
|
|
@@ -5667,17 +6193,17 @@ var ServerRenderer = class {
|
|
|
5667
6193
|
* body is discarded.
|
|
5668
6194
|
*/
|
|
5669
6195
|
createDevMarkdownReader(req) {
|
|
5670
|
-
const socket = _optionalChain([req, 'optionalAccess',
|
|
5671
|
-
if (_optionalChain([req, 'optionalAccess',
|
|
6196
|
+
const socket = _optionalChain([req, 'optionalAccess', _231 => _231.socket]);
|
|
6197
|
+
if (_optionalChain([req, 'optionalAccess', _232 => _232.method, 'optionalAccess', _233 => _233.toUpperCase, 'call', _234 => _234()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _235 => _235.localAddress]) || !socket.localPort) {
|
|
5672
6198
|
return async () => null;
|
|
5673
6199
|
}
|
|
5674
6200
|
if (socket.encrypted) {
|
|
5675
6201
|
const address = { host: socket.localAddress, port: socket.localPort };
|
|
5676
|
-
return
|
|
6202
|
+
return _chunkWRWJ7IWTcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
|
|
5677
6203
|
}
|
|
5678
6204
|
const host = socket.localAddress.includes(":") ? `[${socket.localAddress}]` : socket.localAddress;
|
|
5679
6205
|
const localOrigin = `http://${host}:${socket.localPort}`;
|
|
5680
|
-
const read =
|
|
6206
|
+
const read = _chunkWRWJ7IWTcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
|
|
5681
6207
|
return (url) => {
|
|
5682
6208
|
const target = new URL(url);
|
|
5683
6209
|
return read(`${localOrigin}${target.pathname}${target.search}`);
|
|
@@ -5717,7 +6243,7 @@ var ServerRenderer = class {
|
|
|
5717
6243
|
}
|
|
5718
6244
|
async writeMetadataImageResponse(req, res, value, imageModule) {
|
|
5719
6245
|
const ifNoneMatch = req.headers["if-none-match"];
|
|
5720
|
-
const response = await
|
|
6246
|
+
const response = await _chunkK6PGK7DCcjs.createFarmMetadataImageResponse.call(void 0, value, imageModule, {
|
|
5721
6247
|
method: req.method,
|
|
5722
6248
|
ifNoneMatch: Array.isArray(ifNoneMatch) ? ifNoneMatch[0] : ifNoneMatch,
|
|
5723
6249
|
renderer: _chunk67MZTLTFcjs.isReactRenderer.call(void 0, this.config.renderer) ? void 0 : this.rendererRuntime
|
|
@@ -5733,8 +6259,8 @@ var ServerRenderer = class {
|
|
|
5733
6259
|
return;
|
|
5734
6260
|
}
|
|
5735
6261
|
const etag = `"${image.staticInfo.hash}"`;
|
|
5736
|
-
const requestUrl =
|
|
5737
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6262
|
+
const requestUrl = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
|
|
6263
|
+
trustProxy: _optionalChain([this, 'access', _236 => _236.config, 'access', _237 => _237.server, 'optionalAccess', _238 => _238.trustProxy])
|
|
5738
6264
|
});
|
|
5739
6265
|
const isVersioned = requestUrl.searchParams.get("v") === image.staticInfo.hash;
|
|
5740
6266
|
res.setHeader("Content-Type", image.staticInfo.contentType);
|
|
@@ -5745,7 +6271,7 @@ var ServerRenderer = class {
|
|
|
5745
6271
|
"Cache-Control",
|
|
5746
6272
|
isVersioned ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate"
|
|
5747
6273
|
);
|
|
5748
|
-
if (
|
|
6274
|
+
if (_chunk7Q7UB4TLcjs.matchesFarmIfNoneMatch.call(void 0, req.headers["if-none-match"], etag)) {
|
|
5749
6275
|
res.statusCode = 304;
|
|
5750
6276
|
res.end();
|
|
5751
6277
|
return;
|
|
@@ -5755,7 +6281,7 @@ var ServerRenderer = class {
|
|
|
5755
6281
|
res.end();
|
|
5756
6282
|
return;
|
|
5757
6283
|
}
|
|
5758
|
-
res.write(await
|
|
6284
|
+
res.write(await fs7.promises.readFile(image.modulePath));
|
|
5759
6285
|
res.end();
|
|
5760
6286
|
}
|
|
5761
6287
|
async renderRouteErrorBoundary(req, res, options) {
|
|
@@ -5784,8 +6310,14 @@ var ServerRenderer = class {
|
|
|
5784
6310
|
}
|
|
5785
6311
|
});
|
|
5786
6312
|
let wrapped = errorElement;
|
|
6313
|
+
const boundaryLayouts = options.errorPattern === void 0 ? options.layouts : options.layouts.filter(
|
|
6314
|
+
(layout) => !("pattern" in layout) || _chunk6ZFGWB75cjs.routeBoundaryCoversDirectory.call(void 0,
|
|
6315
|
+
layout.pattern,
|
|
6316
|
+
options.errorPattern
|
|
6317
|
+
)
|
|
6318
|
+
);
|
|
5787
6319
|
const layoutModules = await Promise.all(
|
|
5788
|
-
|
|
6320
|
+
boundaryLayouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
5789
6321
|
);
|
|
5790
6322
|
for (let i = layoutModules.length - 1; i >= 0; i--) {
|
|
5791
6323
|
const LayoutComponent = layoutModules[i].default;
|
|
@@ -5818,7 +6350,7 @@ var ServerRenderer = class {
|
|
|
5818
6350
|
res.end();
|
|
5819
6351
|
return true;
|
|
5820
6352
|
} catch (renderError) {
|
|
5821
|
-
|
|
6353
|
+
_chunkGC5ROI3Acjs.logger.warn(`Failed to render route-level error boundary: ${renderError}`);
|
|
5822
6354
|
return false;
|
|
5823
6355
|
}
|
|
5824
6356
|
}
|
|
@@ -5835,7 +6367,7 @@ var ServerRenderer = class {
|
|
|
5835
6367
|
const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
|
|
5836
6368
|
(slot) => ({
|
|
5837
6369
|
...slot,
|
|
5838
|
-
modulePath: typeof slot.modulePath === "string" ?
|
|
6370
|
+
modulePath: typeof slot.modulePath === "string" ? _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, slot.modulePath, this.config.root) : slot.modulePath
|
|
5839
6371
|
})
|
|
5840
6372
|
);
|
|
5841
6373
|
const deferredProps = _chunkDBYNZIIQcjs.prepareDeferredData.call(void 0, {
|
|
@@ -5843,7 +6375,7 @@ var ServerRenderer = class {
|
|
|
5843
6375
|
slots: routeSlots
|
|
5844
6376
|
});
|
|
5845
6377
|
const pagePath = req.__FARM_PAGE_PATH__;
|
|
5846
|
-
const relativePath = pagePath ?
|
|
6378
|
+
const relativePath = pagePath ? _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, pagePath, this.config.root) : "/src/app/page.tsx";
|
|
5847
6379
|
const deploymentId = this.getDeploymentId();
|
|
5848
6380
|
const farmScripts = (markup) => this.stampFarmScripts(req, markup);
|
|
5849
6381
|
const bootstrapScript = farmScripts(`<script data-farm-refresh-state>
|
|
@@ -5863,12 +6395,12 @@ window.__FARM_ISLAND_STRATEGY__ = ${JSON.stringify(req.__FARM_ISLAND_STRATEGY__
|
|
|
5863
6395
|
window.__FARM_PAGE_MODULE__ = ${JSON.stringify(relativePath)};
|
|
5864
6396
|
window.__FARM_LOADING_MODULE__ = ${JSON.stringify(req.__FARM_LOADING_MODULE_PATH__ || null)};
|
|
5865
6397
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
5866
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
5867
|
-
window.__FARM_I18N__ = ${
|
|
6398
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkOWO7KDZ3cjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
6399
|
+
window.__FARM_I18N__ = ${_chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
|
|
5868
6400
|
</script>`);
|
|
5869
6401
|
const deferredScript = farmScripts(createDeferredHydrationScript(deferredProps.records));
|
|
5870
6402
|
const rendererHydrationScript = farmScripts(
|
|
5871
|
-
_optionalChain([this, 'access',
|
|
6403
|
+
_optionalChain([this, 'access', _239 => _239.rendererRuntime, 'access', _240 => _240.generateHydrationScript, 'optionalCall', _241 => _241()]) || ""
|
|
5872
6404
|
);
|
|
5873
6405
|
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
5874
6406
|
const farmClientScript = farmScripts(
|
|
@@ -5877,8 +6409,8 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5877
6409
|
const { html: content, head: rendererHead } = await this.renderElementToDocumentParts(
|
|
5878
6410
|
element,
|
|
5879
6411
|
{
|
|
5880
|
-
rejectLateNavigation:
|
|
5881
|
-
_optionalChain([req, 'access',
|
|
6412
|
+
rejectLateNavigation: _chunk2YJ4DHTDcjs._isFarmMarkdownPageCheck.call(void 0,
|
|
6413
|
+
_optionalChain([req, 'access', _242 => _242.headers, 'optionalAccess', _243 => _243[_chunk2YJ4DHTDcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])
|
|
5882
6414
|
)
|
|
5883
6415
|
}
|
|
5884
6416
|
);
|
|
@@ -5888,31 +6420,31 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5888
6420
|
hasFavicon,
|
|
5889
6421
|
hasExplicitTitle,
|
|
5890
6422
|
viewport: viewportTags
|
|
5891
|
-
} =
|
|
6423
|
+
} = _chunkY3DO7BIJcjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
5892
6424
|
pathname: getFarmMetadataPathname(req),
|
|
5893
|
-
jsonLd: _optionalChain([this, 'access',
|
|
6425
|
+
jsonLd: _optionalChain([this, 'access', _244 => _244.config, 'access', _245 => _245.agent, 'optionalAccess', _246 => _246.jsonLd])
|
|
5894
6426
|
});
|
|
5895
6427
|
const documentTitleTag = !hasExplicitTitle && /<title[\s>]/i.test(rendererHead) ? "" : `<title>${title}</title>`;
|
|
5896
6428
|
const rendererHasTitle = /<title[\s>]/i.test(rendererHead);
|
|
5897
|
-
const i18nSnapshot =
|
|
6429
|
+
const i18nSnapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
5898
6430
|
const alternateTags = i18nSnapshot ? renderI18nAlternateLinks(
|
|
5899
6431
|
req.__FARM_ROUTE__ || req.url || "/",
|
|
5900
6432
|
i18nSnapshot,
|
|
5901
6433
|
this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
|
|
5902
6434
|
) : "";
|
|
5903
|
-
const themeDocument =
|
|
6435
|
+
const themeDocument = _chunk6ZFGWB75cjs.createFarmThemeDocumentParts.call(void 0,
|
|
5904
6436
|
this.config.theme,
|
|
5905
6437
|
this.config.basePath,
|
|
5906
|
-
|
|
6438
|
+
_chunk5AMH6AFAcjs.getTheme.call(void 0, )
|
|
5907
6439
|
);
|
|
5908
6440
|
themeDocument.head = farmScripts(themeDocument.head);
|
|
5909
|
-
const fullDocument =
|
|
6441
|
+
const fullDocument = _chunk6ZFGWB75cjs.extractFarmFullDocument.call(void 0, _chunk6ZFGWB75cjs.markFarmDocumentLayouts.call(void 0, content));
|
|
5910
6442
|
let html;
|
|
5911
6443
|
if (fullDocument) {
|
|
5912
6444
|
const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
|
|
5913
|
-
const documentHtml = shouldReplaceLayoutTitle ?
|
|
5914
|
-
const effectiveRendererHead = hasExplicitTitle ?
|
|
5915
|
-
html =
|
|
6445
|
+
const documentHtml = shouldReplaceLayoutTitle ? _chunk6ZFGWB75cjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
|
|
6446
|
+
const effectiveRendererHead = hasExplicitTitle ? _chunk6ZFGWB75cjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
|
|
6447
|
+
html = _chunk6ZFGWB75cjs.composeFarmFullDocument.call(void 0, documentHtml, {
|
|
5916
6448
|
fallbackIcon: !hasFavicon,
|
|
5917
6449
|
viewport: viewportTags,
|
|
5918
6450
|
htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
|
|
@@ -5938,7 +6470,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5938
6470
|
});
|
|
5939
6471
|
} else {
|
|
5940
6472
|
html = `<!DOCTYPE html>
|
|
5941
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
6473
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _247 => _247.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
5942
6474
|
<head>
|
|
5943
6475
|
${themeDocument.head}
|
|
5944
6476
|
<meta charset="utf-8">
|
|
@@ -5969,7 +6501,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5969
6501
|
const securedHtml = this.secureDocumentHTML(req, html);
|
|
5970
6502
|
if ((req.method || "GET").toUpperCase() !== "HEAD") res.write(securedHtml);
|
|
5971
6503
|
res.end();
|
|
5972
|
-
if (!options.captureStaticShell) await _optionalChain([options, 'access',
|
|
6504
|
+
if (!options.captureStaticShell) await _optionalChain([options, 'access', _248 => _248.onComplete, 'optionalCall', _249 => _249(securedHtml)]);
|
|
5973
6505
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
5974
6506
|
type: "render.stream.complete",
|
|
5975
6507
|
route,
|
|
@@ -5979,7 +6511,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5979
6511
|
emitFarmRenderError(req, route, error);
|
|
5980
6512
|
throw error;
|
|
5981
6513
|
} finally {
|
|
5982
|
-
_optionalChain([clearMiddlewareData, 'optionalCall',
|
|
6514
|
+
_optionalChain([clearMiddlewareData, 'optionalCall', _250 => _250()]);
|
|
5983
6515
|
}
|
|
5984
6516
|
}
|
|
5985
6517
|
/**
|
|
@@ -5988,13 +6520,12 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5988
6520
|
* this up front keeps a route's first request on the buffered path too; a layout this cannot
|
|
5989
6521
|
* call (async, a class, or one using hooks) falls back to detection from the stream.
|
|
5990
6522
|
*/
|
|
5991
|
-
async rootLayoutRendersDocument() {
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
if (!rootLayout) return false;
|
|
6523
|
+
async rootLayoutRendersDocument(req) {
|
|
6524
|
+
const modulePath = _nullishCoalesce(req.__FARM_ROOT_LAYOUT_PATH__, () => ( (typeof this.routeManager.getLayouts === "function" ? _optionalChain([this, 'access', _251 => _251.routeManager, 'access', _252 => _252.getLayouts, 'call', _253 => _253(), 'access', _254 => _254.get, 'call', _255 => _255("/"), 'optionalAccess', _256 => _256.modulePath]) : void 0)));
|
|
6525
|
+
if (!modulePath) return false;
|
|
5995
6526
|
try {
|
|
5996
|
-
const Layout = (await this.routeManager.loadLayoutModule(
|
|
5997
|
-
if (typeof Layout !== "function" || _optionalChain([Layout, 'access',
|
|
6527
|
+
const Layout = (await this.routeManager.loadLayoutModule(modulePath)).default;
|
|
6528
|
+
if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _257 => _257.prototype, 'optionalAccess', _258 => _258.isReactComponent]) || _optionalChain([Layout, 'access', _259 => _259.constructor, 'optionalAccess', _260 => _260.name]) === "AsyncFunction") {
|
|
5998
6529
|
return false;
|
|
5999
6530
|
}
|
|
6000
6531
|
const cached = documentLayouts.get(Layout);
|
|
@@ -6006,20 +6537,20 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6006
6537
|
params: {}
|
|
6007
6538
|
});
|
|
6008
6539
|
rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
|
|
6009
|
-
} catch (
|
|
6540
|
+
} catch (e18) {
|
|
6010
6541
|
rendersDocument = false;
|
|
6011
6542
|
}
|
|
6012
6543
|
documentLayouts.set(Layout, rendersDocument);
|
|
6013
6544
|
return rendersDocument;
|
|
6014
|
-
} catch (
|
|
6545
|
+
} catch (e19) {
|
|
6015
6546
|
return false;
|
|
6016
6547
|
}
|
|
6017
6548
|
}
|
|
6018
6549
|
async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
|
|
6019
6550
|
const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
|
|
6020
6551
|
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
6021
|
-
const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
|
|
6022
|
-
if (!renderToPipeableStream ||
|
|
6552
|
+
const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument(req);
|
|
6553
|
+
if (!renderToPipeableStream || _chunk2YJ4DHTDcjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access', _261 => _261.headers, 'optionalAccess', _262 => _262[_chunk2YJ4DHTDcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])) || streamDocument && (options.captureStaticShell || !_chunk67MZTLTFcjs.isReactRenderer.call(void 0, this.config.renderer))) {
|
|
6023
6554
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
6024
6555
|
}
|
|
6025
6556
|
return new Promise((resolve3, reject) => {
|
|
@@ -6054,12 +6585,12 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6054
6585
|
let lateNavigationError = null;
|
|
6055
6586
|
const pagePath = req.__FARM_PAGE_PATH__;
|
|
6056
6587
|
const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
|
|
6057
|
-
const relativePath = pagePath ?
|
|
6588
|
+
const relativePath = pagePath ? _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, pagePath, this.config.root) : "/src/app/page.tsx";
|
|
6058
6589
|
const clientManifest = this.createDevBootClientManifest(req, options);
|
|
6059
6590
|
const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
|
|
6060
6591
|
(slot) => ({
|
|
6061
6592
|
...slot,
|
|
6062
|
-
modulePath: typeof slot.modulePath === "string" ?
|
|
6593
|
+
modulePath: typeof slot.modulePath === "string" ? _chunkGC5ROI3Acjs.toViteModuleId.call(void 0, slot.modulePath, this.config.root) : slot.modulePath
|
|
6063
6594
|
})
|
|
6064
6595
|
);
|
|
6065
6596
|
const deferredProps = _chunkDBYNZIIQcjs.prepareDeferredData.call(void 0, {
|
|
@@ -6089,9 +6620,9 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
|
|
|
6089
6620
|
req.__FARM_LOADING_MODULE_PATH__ || null
|
|
6090
6621
|
)};
|
|
6091
6622
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
6092
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
6093
|
-
window.__FARM_I18N__ = ${
|
|
6094
|
-
</script>${
|
|
6623
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkOWO7KDZ3cjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
6624
|
+
window.__FARM_I18N__ = ${_chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
|
|
6625
|
+
</script>${_chunkPBJ7MEOVcjs.renderFarmFormStateScript.call(void 0, )}`;
|
|
6095
6626
|
const islandsOnlyPage = this.islandValues() && req.__FARM_PAGE_SHOULD_HYDRATE__ !== true && req.__FARM_LAYOUT_SHOULD_HYDRATE__ !== true && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true;
|
|
6096
6627
|
const rootStrategy = req.__FARM_ISLAND_STRATEGY__;
|
|
6097
6628
|
const waitingRoot = this.islandValues() && !islandsOnlyPage && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true && rootStrategy !== void 0 && rootStrategy !== "load" ? req.__FARM_LAYOUT_SHOULD_HYDRATE__ === true ? "root" : "__farm_page__" : null;
|
|
@@ -6103,21 +6634,21 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6103
6634
|
hasFavicon,
|
|
6104
6635
|
hasExplicitTitle,
|
|
6105
6636
|
viewport: viewportTags
|
|
6106
|
-
} =
|
|
6637
|
+
} = _chunkY3DO7BIJcjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
6107
6638
|
pathname: getFarmMetadataPathname(req),
|
|
6108
|
-
jsonLd: _optionalChain([this, 'access',
|
|
6639
|
+
jsonLd: _optionalChain([this, 'access', _263 => _263.config, 'access', _264 => _264.agent, 'optionalAccess', _265 => _265.jsonLd])
|
|
6109
6640
|
});
|
|
6110
|
-
const i18nSnapshot =
|
|
6641
|
+
const i18nSnapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
6111
6642
|
const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(
|
|
6112
6643
|
req.__FARM_ROUTE__ || req.url || "/",
|
|
6113
6644
|
i18nSnapshot,
|
|
6114
6645
|
this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
|
|
6115
6646
|
) : "";
|
|
6116
6647
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
6117
|
-
const themeDocument =
|
|
6648
|
+
const themeDocument = _chunk6ZFGWB75cjs.createFarmThemeDocumentParts.call(void 0,
|
|
6118
6649
|
this.config.theme,
|
|
6119
6650
|
this.config.basePath,
|
|
6120
|
-
|
|
6651
|
+
_chunk5AMH6AFAcjs.getTheme.call(void 0, )
|
|
6121
6652
|
);
|
|
6122
6653
|
const streamRoot = req.__FARM_LAYOUT_SHOULD_HYDRATE__ === true ? element : this.rendererRuntime.createElement("div", { style: { display: "contents" } }, element);
|
|
6123
6654
|
const devStyleLinks = this.collectDevStyleLinks();
|
|
@@ -6130,10 +6661,10 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6130
6661
|
const earlyClientScript = bootClient ? createFarmDevBootScript(waitingRoot, rootStrategy) : FARM_DEV_EARLY_CLIENT_SCRIPT;
|
|
6131
6662
|
const { pipe, abort } = renderToPipeableStream(streamRoot, {
|
|
6132
6663
|
nonce: cspNonce,
|
|
6133
|
-
formState:
|
|
6664
|
+
formState: _chunkPBJ7MEOVcjs.getFarmFormState.call(void 0, ),
|
|
6134
6665
|
onShellReady() {
|
|
6135
6666
|
if (pendingNavigationError) {
|
|
6136
|
-
_optionalChain([abort, 'optionalCall',
|
|
6667
|
+
_optionalChain([abort, 'optionalCall', _266 => _266(pendingNavigationError)]);
|
|
6137
6668
|
if (clearMiddlewareData) {
|
|
6138
6669
|
clearMiddlewareData();
|
|
6139
6670
|
}
|
|
@@ -6151,7 +6682,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6151
6682
|
console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
|
|
6152
6683
|
}
|
|
6153
6684
|
const shell = `<!DOCTYPE html>
|
|
6154
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
6685
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _267 => _267.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
6155
6686
|
<head>
|
|
6156
6687
|
${themeDocument.head}
|
|
6157
6688
|
<meta charset="utf-8">
|
|
@@ -6172,14 +6703,14 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6172
6703
|
let pendingShell = streamDocument ? "" : stampDocumentHTML(shell);
|
|
6173
6704
|
let heldHead = "";
|
|
6174
6705
|
const releaseShell = (complete) => {
|
|
6175
|
-
const split =
|
|
6706
|
+
const split = _chunk6ZFGWB75cjs.takeFarmHoistedHead.call(void 0, heldHead, complete);
|
|
6176
6707
|
if (!split) return null;
|
|
6177
|
-
const shellHead = !hasExplicitTitle && /<title[\s>]/i.test(split.head) ?
|
|
6178
|
-
const opened =
|
|
6708
|
+
const shellHead = !hasExplicitTitle && /<title[\s>]/i.test(split.head) ? _chunk6ZFGWB75cjs.removeFarmDocumentTitles.call(void 0, pendingShell) : pendingShell;
|
|
6709
|
+
const opened = _chunk6ZFGWB75cjs.appendFarmHead.call(void 0, shellHead, split.head);
|
|
6179
6710
|
pendingShell = "";
|
|
6180
6711
|
heldHead = "";
|
|
6181
6712
|
htmlParts.push(opened);
|
|
6182
|
-
_optionalChain([staticShellParts, 'optionalAccess',
|
|
6713
|
+
_optionalChain([staticShellParts, 'optionalAccess', _268 => _268.push, 'call', _269 => _269(opened)]);
|
|
6183
6714
|
res.write(opened);
|
|
6184
6715
|
return split.body;
|
|
6185
6716
|
};
|
|
@@ -6191,10 +6722,12 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6191
6722
|
${stampDocumentHTML(earlyClientScript)}`
|
|
6192
6723
|
)
|
|
6193
6724
|
} : document;
|
|
6194
|
-
const documentTransform = streamDocument ?
|
|
6725
|
+
const documentTransform = streamDocument ? _chunk6ZFGWB75cjs.createFarmStreamedDocumentTransform.call(void 0,
|
|
6195
6726
|
(opening) => withEarlyClient(
|
|
6196
|
-
|
|
6197
|
-
|
|
6727
|
+
_chunk6ZFGWB75cjs.openFarmStreamedDocument.call(void 0,
|
|
6728
|
+
_chunk6ZFGWB75cjs.markFarmDocumentLayouts.call(void 0,
|
|
6729
|
+
hasExplicitTitle ? _chunk6ZFGWB75cjs.removeFarmDocumentTitles.call(void 0, opening) : opening
|
|
6730
|
+
),
|
|
6198
6731
|
{
|
|
6199
6732
|
fallbackIcon: !hasFavicon,
|
|
6200
6733
|
viewport: viewportTags,
|
|
@@ -6233,7 +6766,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6233
6766
|
const recordRenderedChunk = (chunkText, renderedText = chunkText) => {
|
|
6234
6767
|
if (!checkedFullDocument && renderedText) {
|
|
6235
6768
|
documentPrefix += renderedText;
|
|
6236
|
-
const prefix =
|
|
6769
|
+
const prefix = _chunk6ZFGWB75cjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
|
|
6237
6770
|
if (prefix !== "pending") {
|
|
6238
6771
|
checkedFullDocument = true;
|
|
6239
6772
|
documentPrefix = "";
|
|
@@ -6252,7 +6785,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6252
6785
|
staticShellClosed = true;
|
|
6253
6786
|
if (!suspenseHoleEmitted) {
|
|
6254
6787
|
suspenseHoleEmitted = true;
|
|
6255
|
-
_optionalChain([options, 'access',
|
|
6788
|
+
_optionalChain([options, 'access', _270 => _270.onSuspenseHoleDetected, 'optionalCall', _271 => _271()]);
|
|
6256
6789
|
}
|
|
6257
6790
|
} else {
|
|
6258
6791
|
staticShellParts.push(chunkText);
|
|
@@ -6304,7 +6837,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6304
6837
|
const body = releaseShell(true);
|
|
6305
6838
|
if (body) {
|
|
6306
6839
|
htmlParts.push(body);
|
|
6307
|
-
_optionalChain([staticShellParts, 'optionalAccess',
|
|
6840
|
+
_optionalChain([staticShellParts, 'optionalAccess', _272 => _272.push, 'call', _273 => _273(body)]);
|
|
6308
6841
|
res.write(body);
|
|
6309
6842
|
}
|
|
6310
6843
|
}
|
|
@@ -6320,7 +6853,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6320
6853
|
finishStream(callback);
|
|
6321
6854
|
},
|
|
6322
6855
|
(error) => {
|
|
6323
|
-
|
|
6856
|
+
_chunkGC5ROI3Acjs.logger.error(`Could not recover from a late navigation error: ${error}`);
|
|
6324
6857
|
finishStream(callback);
|
|
6325
6858
|
}
|
|
6326
6859
|
);
|
|
@@ -6336,8 +6869,8 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6336
6869
|
recordRenderedChunk(tail, rewritten);
|
|
6337
6870
|
if (tail) res.write(tail);
|
|
6338
6871
|
}
|
|
6339
|
-
const documentEnd = _optionalChain([documentTransform, 'optionalAccess',
|
|
6340
|
-
if (_optionalChain([documentEnd, 'optionalAccess',
|
|
6872
|
+
const documentEnd = _optionalChain([documentTransform, 'optionalAccess', _274 => _274.end, 'call', _275 => _275()]);
|
|
6873
|
+
if (_optionalChain([documentEnd, 'optionalAccess', _276 => _276.text])) {
|
|
6341
6874
|
recordRenderedChunk(documentEnd.text, "");
|
|
6342
6875
|
res.write(documentEnd.text);
|
|
6343
6876
|
}
|
|
@@ -6348,7 +6881,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6348
6881
|
deferredHydrationScript: createDeferredHydrationScript(deferredProps.records),
|
|
6349
6882
|
earlyClient,
|
|
6350
6883
|
// A full document: Farm's #root closes only where Farm opened it.
|
|
6351
|
-
..._optionalChain([documentEnd, 'optionalAccess',
|
|
6884
|
+
..._optionalChain([documentEnd, 'optionalAccess', _277 => _277.document]) ? { closeRoot: documentEnd.rootOpened } : {}
|
|
6352
6885
|
})
|
|
6353
6886
|
);
|
|
6354
6887
|
htmlParts.push(footer);
|
|
@@ -6370,7 +6903,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6370
6903
|
}
|
|
6371
6904
|
const cachedHtml = staticShellParts ? staticShellParts.join("") : htmlParts.join("");
|
|
6372
6905
|
Promise.resolve(options.onComplete(cachedHtml)).catch((error) => {
|
|
6373
|
-
|
|
6906
|
+
_chunkGC5ROI3Acjs.logger.warn(`Failed to cache PPR shell: ${error}`);
|
|
6374
6907
|
});
|
|
6375
6908
|
}
|
|
6376
6909
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
@@ -6389,7 +6922,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6389
6922
|
onShellError(error) {
|
|
6390
6923
|
didError = true;
|
|
6391
6924
|
if (!isWebResponse(error) && !_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error) && !_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error)) {
|
|
6392
|
-
|
|
6925
|
+
_chunkGC5ROI3Acjs.logger.error(`SSR shell error: ${error}`);
|
|
6393
6926
|
emitFarmRenderError(req, observabilityRoute, error);
|
|
6394
6927
|
}
|
|
6395
6928
|
if (clearMiddlewareData) {
|
|
@@ -6405,7 +6938,7 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6405
6938
|
return;
|
|
6406
6939
|
}
|
|
6407
6940
|
if (!isWebResponse(error)) {
|
|
6408
|
-
|
|
6941
|
+
_chunkGC5ROI3Acjs.logger.error(`SSR streaming error: ${error}`);
|
|
6409
6942
|
emitFarmRenderError(req, observabilityRoute, error);
|
|
6410
6943
|
}
|
|
6411
6944
|
}
|
|
@@ -6447,8 +6980,8 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6447
6980
|
};
|
|
6448
6981
|
}
|
|
6449
6982
|
localizeRedirectUrl(url) {
|
|
6450
|
-
const snapshot =
|
|
6451
|
-
return snapshot && url.startsWith("/") && !url.startsWith("//") ?
|
|
6983
|
+
const snapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
6984
|
+
return snapshot && url.startsWith("/") && !url.startsWith("//") ? _chunkGYJT2U7Jcjs.localizeFarmHref.call(void 0, url, snapshot.locale, snapshot) : url;
|
|
6452
6985
|
}
|
|
6453
6986
|
/** The app's not-found component, or null when it relies on the built-in page. */
|
|
6454
6987
|
async loadNotFoundModule() {
|
|
@@ -6460,12 +6993,12 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6460
6993
|
return await this.routeManager.loadRouteModule(notFoundPath);
|
|
6461
6994
|
}
|
|
6462
6995
|
async loadNotFoundComponent() {
|
|
6463
|
-
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async
|
|
6996
|
+
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _278 => _278.default]), async () => ( null));
|
|
6464
6997
|
}
|
|
6465
6998
|
/** The not-found document's head: layout and not-found metadata, as production renders it. */
|
|
6466
6999
|
async notFoundMetadataHead(layoutModule, notFoundModule) {
|
|
6467
|
-
const metadata = await
|
|
6468
|
-
const { title, tags, hasFavicon } =
|
|
7000
|
+
const metadata = await _chunkY3DO7BIJcjs.resolveFarmNotFoundMetadata.call(void 0, [layoutModule], notFoundModule);
|
|
7001
|
+
const { title, tags, hasFavicon } = _chunkY3DO7BIJcjs.renderMetadataHead.call(void 0, metadata);
|
|
6469
7002
|
return {
|
|
6470
7003
|
head: `${hasFavicon ? "" : '<link rel="icon" href="data:,">\n '}<title>${title}</title>${tags}`,
|
|
6471
7004
|
metadata
|
|
@@ -6483,13 +7016,13 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6483
7016
|
*/
|
|
6484
7017
|
async createLateNavigationRecoveryHTML(req, error) {
|
|
6485
7018
|
if (_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error)) {
|
|
6486
|
-
return
|
|
7019
|
+
return _chunk6ZFGWB75cjs.createLateRedirectRecovery.call(void 0,
|
|
6487
7020
|
this.localizeRedirectUrl(_chunk7JUIK547cjs.getFarmRedirectError.call(void 0, error).url),
|
|
6488
7021
|
this.getCspNonce(req) || ""
|
|
6489
7022
|
);
|
|
6490
7023
|
}
|
|
6491
|
-
const pathname =
|
|
6492
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7024
|
+
const pathname = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7025
|
+
trustProxy: _optionalChain([this, 'access', _279 => _279.config, 'access', _280 => _280.server, 'optionalAccess', _281 => _281.trustProxy])
|
|
6493
7026
|
}).pathname;
|
|
6494
7027
|
let content = this.defaultNotFoundContent();
|
|
6495
7028
|
const NotFoundComponent = await this.loadNotFoundComponent();
|
|
@@ -6501,15 +7034,15 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6501
7034
|
)
|
|
6502
7035
|
);
|
|
6503
7036
|
} catch (error2) {
|
|
6504
|
-
|
|
7037
|
+
_chunkGC5ROI3Acjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
|
|
6505
7038
|
}
|
|
6506
7039
|
}
|
|
6507
|
-
return
|
|
7040
|
+
return _chunk6ZFGWB75cjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
|
|
6508
7041
|
}
|
|
6509
7042
|
async render404(req, res) {
|
|
6510
7043
|
res.statusCode = 404;
|
|
6511
|
-
const pathname =
|
|
6512
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7044
|
+
const pathname = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7045
|
+
trustProxy: _optionalChain([this, 'access', _282 => _282.config, 'access', _283 => _283.server, 'optionalAccess', _284 => _284.trustProxy])
|
|
6513
7046
|
}).pathname;
|
|
6514
7047
|
if (_chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, this.config.renderer)) {
|
|
6515
7048
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -6526,20 +7059,20 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6526
7059
|
}
|
|
6527
7060
|
const acceptHeader = req.headers.accept;
|
|
6528
7061
|
const accept = Array.isArray(acceptHeader) ? acceptHeader.join(",") : acceptHeader;
|
|
6529
|
-
if (
|
|
6530
|
-
res.setHeader("Content-Type",
|
|
7062
|
+
if (_chunk2YJ4DHTDcjs.farmRequestWantsMarkdown.call(void 0, pathname, accept)) {
|
|
7063
|
+
res.setHeader("Content-Type", _chunk2YJ4DHTDcjs.FARM_MARKDOWN_CONTENT_TYPE);
|
|
6531
7064
|
res.setHeader("X-Farm-Markdown-Error", "404");
|
|
6532
7065
|
res.setHeader("Cache-Control", "no-store");
|
|
6533
|
-
res.end(
|
|
7066
|
+
res.end(_chunk2YJ4DHTDcjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
|
|
6534
7067
|
return;
|
|
6535
7068
|
}
|
|
6536
|
-
const appDir =
|
|
7069
|
+
const appDir = path10.join(this.config.root, this.config.srcDir, "app");
|
|
6537
7070
|
const notFoundExtensions = _chunk67MZTLTFcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
|
|
6538
7071
|
let layoutModule = null;
|
|
6539
7072
|
try {
|
|
6540
7073
|
for (const ext of notFoundExtensions) {
|
|
6541
|
-
const layoutPath =
|
|
6542
|
-
if (
|
|
7074
|
+
const layoutPath = path10.join(appDir, `layout${ext}`);
|
|
7075
|
+
if (fs7.existsSync(layoutPath)) {
|
|
6543
7076
|
layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
|
|
6544
7077
|
break;
|
|
6545
7078
|
}
|
|
@@ -6550,9 +7083,9 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6550
7083
|
);
|
|
6551
7084
|
if (notFoundPath) {
|
|
6552
7085
|
const notFoundModule = await this.loadNotFoundModule();
|
|
6553
|
-
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess',
|
|
7086
|
+
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _285 => _285.default]), () => ( null));
|
|
6554
7087
|
if (NotFoundComponent) {
|
|
6555
|
-
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess',
|
|
7088
|
+
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _286 => _286.default]), () => ( null));
|
|
6556
7089
|
let element = this.rendererRuntime.createElement(NotFoundComponent, { pathname });
|
|
6557
7090
|
if (LayoutComponent) {
|
|
6558
7091
|
element = this.rendererRuntime.createElement(LayoutComponent, {
|
|
@@ -6588,24 +7121,24 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6588
7121
|
}
|
|
6589
7122
|
res.statusCode = statusCode;
|
|
6590
7123
|
const isDev = process.env.NODE_ENV === "development";
|
|
6591
|
-
const requestUrl =
|
|
6592
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7124
|
+
const requestUrl = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7125
|
+
trustProxy: _optionalChain([this, 'access', _287 => _287.config, 'access', _288 => _288.server, 'optionalAccess', _289 => _289.trustProxy])
|
|
6593
7126
|
});
|
|
6594
7127
|
const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
|
|
6595
|
-
const statusText =
|
|
7128
|
+
const statusText = _chunk6ZFGWB75cjs.getDefaultErrorStatusText.call(void 0, statusCode);
|
|
6596
7129
|
const content = this.stampFarmScripts(
|
|
6597
7130
|
req,
|
|
6598
|
-
|
|
7131
|
+
_chunk6ZFGWB75cjs.createDefaultErrorMarkup.call(void 0, {
|
|
6599
7132
|
statusCode,
|
|
6600
7133
|
statusText,
|
|
6601
7134
|
requestPath: requestUrl.pathname,
|
|
6602
7135
|
method: req.method || "GET",
|
|
6603
|
-
message: _optionalChain([diagnostics, 'optionalAccess',
|
|
6604
|
-
errorName: _optionalChain([diagnostics, 'optionalAccess',
|
|
6605
|
-
stack: _optionalChain([diagnostics, 'optionalAccess',
|
|
6606
|
-
sourceFrame: _optionalChain([diagnostics, 'optionalAccess',
|
|
7136
|
+
message: _optionalChain([diagnostics, 'optionalAccess', _290 => _290.message]),
|
|
7137
|
+
errorName: _optionalChain([diagnostics, 'optionalAccess', _291 => _291.name]),
|
|
7138
|
+
stack: _optionalChain([diagnostics, 'optionalAccess', _292 => _292.stack]),
|
|
7139
|
+
sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _293 => _293.sourceFrame]),
|
|
6607
7140
|
development: isDev,
|
|
6608
|
-
farmVersion:
|
|
7141
|
+
farmVersion: _chunkXLOORES5cjs.FARM_VERSION,
|
|
6609
7142
|
nodeVersion: process.version,
|
|
6610
7143
|
mode: isDev ? "development" : "production"
|
|
6611
7144
|
})
|
|
@@ -6631,18 +7164,19 @@ window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6631
7164
|
*/
|
|
6632
7165
|
getI18nAlternateOptions(req, metadata) {
|
|
6633
7166
|
return {
|
|
6634
|
-
metadataBase: _optionalChain([metadata, 'optionalAccess',
|
|
6635
|
-
origin: req ?
|
|
7167
|
+
metadataBase: _optionalChain([metadata, 'optionalAccess', _294 => _294.metadataBase]),
|
|
7168
|
+
origin: req ? _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _295 => _295.config, 'access', _296 => _296.server, 'optionalAccess', _297 => _297.trustProxy]) }).origin : void 0,
|
|
7169
|
+
languages: _optionalChain([metadata, 'optionalAccess', _298 => _298.alternates, 'optionalAccess', _299 => _299.languages])
|
|
6636
7170
|
};
|
|
6637
7171
|
}
|
|
6638
7172
|
createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
|
|
6639
|
-
const i18nSnapshot =
|
|
7173
|
+
const i18nSnapshot = _chunkSXXSQVKKcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
6640
7174
|
const farmScripts = (html) => this.stampFarmScripts(alternates.req, html);
|
|
6641
7175
|
const clientScript = isClientComponent ? ` ${farmScripts(`<script type="module" src="/@farm/client.js"></script>`)}` : "";
|
|
6642
7176
|
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
6643
7177
|
const integrationManifestScript = farmScripts(`<script>
|
|
6644
7178
|
window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
|
|
6645
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
7179
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkOWO7KDZ3cjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
6646
7180
|
${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};` : ""}
|
|
6647
7181
|
</script>`);
|
|
6648
7182
|
const alternateLinks = i18nSnapshot ? renderI18nAlternateLinks(
|
|
@@ -6651,20 +7185,20 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
6651
7185
|
this.getI18nAlternateOptions(alternates.req, alternates.metadata)
|
|
6652
7186
|
) : "";
|
|
6653
7187
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
6654
|
-
const themeDocument =
|
|
7188
|
+
const themeDocument = _chunk6ZFGWB75cjs.createFarmThemeDocumentParts.call(void 0,
|
|
6655
7189
|
this.config.theme,
|
|
6656
7190
|
this.config.basePath,
|
|
6657
|
-
|
|
7191
|
+
_chunk5AMH6AFAcjs.getTheme.call(void 0, )
|
|
6658
7192
|
);
|
|
6659
7193
|
themeDocument.head = farmScripts(themeDocument.head);
|
|
6660
7194
|
const rendererHydrationScript = farmScripts(
|
|
6661
|
-
_optionalChain([this, 'access',
|
|
7195
|
+
_optionalChain([this, 'access', _300 => _300.rendererRuntime, 'access', _301 => _301.generateHydrationScript, 'optionalCall', _302 => _302()]) || ""
|
|
6662
7196
|
);
|
|
6663
|
-
const viewportTags =
|
|
6664
|
-
const fullDocument =
|
|
7197
|
+
const viewportTags = _chunkY3DO7BIJcjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _303 => _303.metadata, 'optionalAccess', _304 => _304.viewport]));
|
|
7198
|
+
const fullDocument = _chunk6ZFGWB75cjs.extractFarmFullDocument.call(void 0, _chunk6ZFGWB75cjs.markFarmDocumentLayouts.call(void 0, content));
|
|
6665
7199
|
if (fullDocument) {
|
|
6666
|
-
return
|
|
6667
|
-
metadataHead ?
|
|
7200
|
+
return _chunk6ZFGWB75cjs.composeFarmFullDocument.call(void 0,
|
|
7201
|
+
metadataHead ? _chunk6ZFGWB75cjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
|
|
6668
7202
|
{
|
|
6669
7203
|
fallbackIcon: !metadataHead,
|
|
6670
7204
|
viewport: viewportTags,
|
|
@@ -6690,7 +7224,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
6690
7224
|
);
|
|
6691
7225
|
}
|
|
6692
7226
|
return `<!DOCTYPE html>
|
|
6693
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
7227
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _305 => _305.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
6694
7228
|
<head>
|
|
6695
7229
|
${themeDocument.head}
|
|
6696
7230
|
<meta charset="utf-8">
|
|
@@ -6731,7 +7265,7 @@ ${clientScript}
|
|
|
6731
7265
|
const deploymentId = this.getDeploymentId();
|
|
6732
7266
|
res.setHeader(_chunkNLBHLPEOcjs.FARM_DEPLOYMENT_ID_HEADER, deploymentId);
|
|
6733
7267
|
if ((req.method || "GET").toUpperCase() !== "GET") return;
|
|
6734
|
-
const isSecure =
|
|
7268
|
+
const isSecure = _chunk2RSVYJT6cjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _306 => _306.config, 'access', _307 => _307.server, 'optionalAccess', _308 => _308.trustProxy]) }).protocol === "https:";
|
|
6735
7269
|
const cookie = _chunkNLBHLPEOcjs.createFarmDeploymentCookie.call(void 0, deploymentId, this.config.basePath || "/", isSecure);
|
|
6736
7270
|
const existing = res.getHeader("Set-Cookie");
|
|
6737
7271
|
if (Array.isArray(existing)) {
|
|
@@ -6772,9 +7306,9 @@ var FarmApp = class {
|
|
|
6772
7306
|
constructor(config = {}, viteServer) {
|
|
6773
7307
|
this.config = this.normalizeConfig(config);
|
|
6774
7308
|
_chunkEVIWKPJVcjs.configureFarmObservability.call(void 0, this.config.observability);
|
|
6775
|
-
|
|
6776
|
-
this.i18nRuntime =
|
|
6777
|
-
|
|
7309
|
+
_chunk5AMH6AFAcjs._setDefaultFarmThemeConfig.call(void 0, this.config.theme);
|
|
7310
|
+
this.i18nRuntime = _chunkSXXSQVKKcjs.createFarmI18nRuntime.call(void 0, this.config.i18n);
|
|
7311
|
+
_chunkSXXSQVKKcjs._setDefaultFarmI18nRuntime.call(void 0, this.i18nRuntime);
|
|
6778
7312
|
this.viteServer = viteServer;
|
|
6779
7313
|
this.routeManager = new RouteManager(this.config, viteServer);
|
|
6780
7314
|
this.serverRenderer = new ServerRenderer(
|
|
@@ -6786,10 +7320,10 @@ var FarmApp = class {
|
|
|
6786
7320
|
}
|
|
6787
7321
|
async initialize() {
|
|
6788
7322
|
if (process.env.FARM_VERBOSE) {
|
|
6789
|
-
|
|
7323
|
+
_chunkGC5ROI3Acjs.logger.info("Initializing Farm.js application...");
|
|
6790
7324
|
}
|
|
6791
|
-
await
|
|
6792
|
-
await
|
|
7325
|
+
await _chunkUBXNTZCYcjs.initStorage.call(void 0, this.config.storage);
|
|
7326
|
+
await _chunkBNCKXPCUcjs.configureFarmCache.call(void 0, this.config.cache);
|
|
6793
7327
|
await this.i18nRuntime.initialize();
|
|
6794
7328
|
await this.serverRenderer.initialize();
|
|
6795
7329
|
await this.verifyAppStructure();
|
|
@@ -6797,7 +7331,7 @@ var FarmApp = class {
|
|
|
6797
7331
|
if (_chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, this.config.renderer)) this.assertNoPageRoutes();
|
|
6798
7332
|
this.routeManager.generateClientManifest(this.config.root);
|
|
6799
7333
|
if (process.env.FARM_VERBOSE) {
|
|
6800
|
-
|
|
7334
|
+
_chunkGC5ROI3Acjs.logger.success("Farm.js application initialized successfully!");
|
|
6801
7335
|
}
|
|
6802
7336
|
}
|
|
6803
7337
|
getRouteManager() {
|
|
@@ -6833,20 +7367,20 @@ var FarmApp = class {
|
|
|
6833
7367
|
integrations: config.integrations || {},
|
|
6834
7368
|
plugins: config.plugins || [],
|
|
6835
7369
|
migrations: config.migrations || { commands: [] },
|
|
6836
|
-
cron:
|
|
6837
|
-
workflows:
|
|
7370
|
+
cron: _chunkCYNQPKA4cjs.resolveCronConfig.call(void 0, config.cron),
|
|
7371
|
+
workflows: _chunkQUEYL2WMcjs.resolveWorkflowsConfig.call(void 0, config.workflows),
|
|
6838
7372
|
api: normalizeFarmAppAPIConfig(config.api),
|
|
6839
7373
|
middleware: config.middleware || {},
|
|
6840
|
-
routeRules:
|
|
7374
|
+
routeRules: _chunkIIHZ2BEEcjs.normalizeRouteRules.call(void 0, config.routeRules),
|
|
6841
7375
|
context: config.context || (() => void 0),
|
|
6842
|
-
server:
|
|
6843
|
-
serverActions:
|
|
7376
|
+
server: _chunk7Q7UB4TLcjs.resolveFarmServerConfig.call(void 0, config.server),
|
|
7377
|
+
serverActions: _chunkXRFGOYXGcjs.resolveServerActionsConfig.call(void 0, config.serverActions),
|
|
6844
7378
|
security: _chunk6JHZPB52cjs.resolveFarmSecurityConfig.call(void 0, config.security),
|
|
6845
7379
|
images: _chunkMCSRMEQVcjs.resolveFarmImageConfig.call(void 0,
|
|
6846
7380
|
config.images,
|
|
6847
7381
|
_chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, config.renderer) ? "none" : void 0
|
|
6848
7382
|
),
|
|
6849
|
-
performance:
|
|
7383
|
+
performance: _chunkF4ID7BGOcjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
|
|
6850
7384
|
theme: _chunkWT6RAN2Icjs.resolveFarmThemeConfig.call(void 0, config.theme, basePath),
|
|
6851
7385
|
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : _chunkZMSVKVI3cjs.resolveFarmI18nConfig.call(void 0, config.i18n, {
|
|
6852
7386
|
root,
|
|
@@ -6858,7 +7392,7 @@ var FarmApp = class {
|
|
|
6858
7392
|
serverRuntimeConfig: config.serverRuntimeConfig || {},
|
|
6859
7393
|
publicRuntimeConfig: config.publicRuntimeConfig || {},
|
|
6860
7394
|
docs: isResolvedDocsConfig(config.docs) ? config.docs : defaultDocsConfig,
|
|
6861
|
-
md:
|
|
7395
|
+
md: _chunk2YJ4DHTDcjs.resolveMarkdownConfig.call(void 0, config.md),
|
|
6862
7396
|
mdx: _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx),
|
|
6863
7397
|
observability: _nullishCoalesce(config.observability, () => ( false)),
|
|
6864
7398
|
telemetry: config.telemetry !== false,
|
|
@@ -6874,10 +7408,10 @@ var FarmApp = class {
|
|
|
6874
7408
|
env: config.env || { server: {}, public: {} },
|
|
6875
7409
|
suppressLintOnLink: _nullishCoalesce(config.suppressLintOnLink, () => ( false)),
|
|
6876
7410
|
experimental: {
|
|
6877
|
-
serverComponents: _nullishCoalesce(_optionalChain([config, 'access',
|
|
6878
|
-
serverActions: _nullishCoalesce(_optionalChain([config, 'access',
|
|
6879
|
-
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access',
|
|
6880
|
-
ppr: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7411
|
+
serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _309 => _309.experimental, 'optionalAccess', _310 => _310.serverComponents]), () => ( false)),
|
|
7412
|
+
serverActions: _nullishCoalesce(_optionalChain([config, 'access', _311 => _311.experimental, 'optionalAccess', _312 => _312.serverActions]), () => ( false)),
|
|
7413
|
+
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _313 => _313.experimental, 'optionalAccess', _314 => _314.isolatedClientHydration]), () => ( "off")),
|
|
7414
|
+
ppr: _nullishCoalesce(_optionalChain([config, 'access', _315 => _315.experimental, 'optionalAccess', _316 => _316.ppr]), () => ( false)),
|
|
6881
7415
|
...config.experimental
|
|
6882
7416
|
},
|
|
6883
7417
|
agent: _nullishCoalesce(config.agent, () => ( {})),
|
|
@@ -6889,7 +7423,7 @@ var FarmApp = class {
|
|
|
6889
7423
|
const files = [
|
|
6890
7424
|
...this.routeManager.getRoutes().values(),
|
|
6891
7425
|
...this.routeManager.getLayouts().values()
|
|
6892
|
-
].map((entry) =>
|
|
7426
|
+
].map((entry) => path4.default.relative(this.config.root, entry.modulePath).split(path4.default.sep).join("/"));
|
|
6893
7427
|
if (files.length === 0) return;
|
|
6894
7428
|
throw new Error(
|
|
6895
7429
|
`This app sets \`renderer: false\`, which serves API routes only, but it has pages or layouts:
|
|
@@ -6898,30 +7432,30 @@ var FarmApp = class {
|
|
|
6898
7432
|
}
|
|
6899
7433
|
async verifyAppStructure() {
|
|
6900
7434
|
const appDirs = _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, this.config);
|
|
6901
|
-
const hasAppDirectory = (await Promise.all(appDirs.map((appDir) =>
|
|
7435
|
+
const hasAppDirectory = (await Promise.all(appDirs.map((appDir) => _chunkGC5ROI3Acjs.fileExists.call(void 0, appDir)))).some(
|
|
6902
7436
|
Boolean
|
|
6903
7437
|
);
|
|
6904
7438
|
if (!hasAppDirectory) {
|
|
6905
7439
|
const routeFiles = _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, this.config).flatMap(
|
|
6906
|
-
(source) =>
|
|
7440
|
+
(source) => _chunkYTNE4KGCcjs.findProgrammaticRouteFiles.call(void 0, source.root, source.srcDir)
|
|
6907
7441
|
);
|
|
6908
7442
|
if (routeFiles.length > 0) {
|
|
6909
7443
|
return;
|
|
6910
7444
|
}
|
|
6911
|
-
const appDir =
|
|
7445
|
+
const appDir = _chunkGC5ROI3Acjs.resolveAppPath.call(void 0, this.config.root, this.config.srcDir, "app");
|
|
6912
7446
|
throw new Error(
|
|
6913
7447
|
`App directory not found at ${appDir}. Please create a src/app directory or extend a Farm layer containing routes.`
|
|
6914
7448
|
);
|
|
6915
7449
|
}
|
|
6916
7450
|
const componentExtensions = _chunk67MZTLTFcjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
|
|
6917
7451
|
const rootLayoutPaths = appDirs.flatMap(
|
|
6918
|
-
(appDir) => componentExtensions.map((extension) =>
|
|
7452
|
+
(appDir) => componentExtensions.map((extension) => path4.default.join(appDir, `layout${extension}`))
|
|
6919
7453
|
);
|
|
6920
|
-
const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) =>
|
|
7454
|
+
const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => _chunkGC5ROI3Acjs.fileExists.call(void 0, p))).then(
|
|
6921
7455
|
(results) => results.some(Boolean)
|
|
6922
7456
|
);
|
|
6923
7457
|
if (!hasRootLayout && !_chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, this.config.renderer)) {
|
|
6924
|
-
|
|
7458
|
+
_chunkGC5ROI3Acjs.logger.warn(
|
|
6925
7459
|
`No root layout found. Consider creating src/app/layout${componentExtensions[0]} for consistent page structure.`
|
|
6926
7460
|
);
|
|
6927
7461
|
}
|
|
@@ -6936,7 +7470,7 @@ function isResolvedAuthConfig(value) {
|
|
|
6936
7470
|
);
|
|
6937
7471
|
}
|
|
6938
7472
|
function normalizeFarmAppAPIConfig(config) {
|
|
6939
|
-
if (typeof _optionalChain([config, 'optionalAccess',
|
|
7473
|
+
if (typeof _optionalChain([config, 'optionalAccess', _317 => _317.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _318 => _318.basePath]) === "function") {
|
|
6940
7474
|
throw new Error(
|
|
6941
7475
|
"Farm API config resolver functions must be processed with resolveConfig() before creating a FarmApp."
|
|
6942
7476
|
);
|
|
@@ -6951,7 +7485,7 @@ function createFarmApp(config, viteServer) {
|
|
|
6951
7485
|
var SHARP_INSTALL_HINT = _chunkKORZ6PREcjs.formatOptionalPeerInstallHint.call(void 0, "sharp", "optimize images");
|
|
6952
7486
|
var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
|
|
6953
7487
|
function resolveFarmImageProviderForRuntime(images, options) {
|
|
6954
|
-
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess',
|
|
7488
|
+
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _319 => _319.provider]), () => ( "auto"));
|
|
6955
7489
|
if (provider === "none") return images;
|
|
6956
7490
|
const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
|
|
6957
7491
|
if (!usesSharp || _chunkKORZ6PREcjs.isOptionalPeerInstalled.call(void 0, options.root, "sharp")) return images;
|
|
@@ -6960,7 +7494,7 @@ function resolveFarmImageProviderForRuntime(images, options) {
|
|
|
6960
7494
|
`images.provider "node" optimizes images with sharp, which is not installed. ${SHARP_INSTALL_HINT}`
|
|
6961
7495
|
);
|
|
6962
7496
|
}
|
|
6963
|
-
|
|
7497
|
+
_chunkGC5ROI3Acjs.logger.info(
|
|
6964
7498
|
`Image optimization is off because sharp is not installed; images use their original URLs. ${SHARP_INSTALL_HINT}, or set images.provider to "none".`
|
|
6965
7499
|
);
|
|
6966
7500
|
return Object.freeze({ ...images, provider: "none" });
|
|
@@ -6978,6 +7512,18 @@ function resolveFarmImageServerRuntime(images, preset) {
|
|
|
6978
7512
|
return provider === "cloudflare" || provider === "auto" && cloudflarePreset ? "cloudflare" : "node";
|
|
6979
7513
|
}
|
|
6980
7514
|
|
|
7515
|
+
// src/markdown-source-path.ts
|
|
7516
|
+
|
|
7517
|
+
function toBakedMarkdownSourcePath(root, filePath) {
|
|
7518
|
+
if (!filePath) return "";
|
|
7519
|
+
if (!path4.default.isAbsolute(filePath)) return filePath.split(path4.default.sep).join("/");
|
|
7520
|
+
const relative3 = path4.default.relative(root, filePath);
|
|
7521
|
+
if (!relative3 || relative3.startsWith("..") || path4.default.isAbsolute(relative3)) {
|
|
7522
|
+
return path4.default.basename(filePath);
|
|
7523
|
+
}
|
|
7524
|
+
return relative3.split(path4.default.sep).join("/");
|
|
7525
|
+
}
|
|
7526
|
+
|
|
6981
7527
|
// src/app-manifest-packages.ts
|
|
6982
7528
|
|
|
6983
7529
|
|
|
@@ -6985,8 +7531,8 @@ var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
|
|
|
6985
7531
|
function resolveFarmAppPackages(root) {
|
|
6986
7532
|
let manifest;
|
|
6987
7533
|
try {
|
|
6988
|
-
manifest = JSON.parse(
|
|
6989
|
-
} catch (
|
|
7534
|
+
manifest = JSON.parse(fs2.default.readFileSync(path4.default.join(root, "package.json"), "utf8"));
|
|
7535
|
+
} catch (e20) {
|
|
6990
7536
|
return {};
|
|
6991
7537
|
}
|
|
6992
7538
|
const names = new Set(
|
|
@@ -7000,13 +7546,13 @@ function resolveFarmAppPackages(root) {
|
|
|
7000
7546
|
for (let dir = root; ; ) {
|
|
7001
7547
|
try {
|
|
7002
7548
|
const { version } = JSON.parse(
|
|
7003
|
-
|
|
7549
|
+
fs2.default.readFileSync(path4.default.join(dir, "node_modules", name, "package.json"), "utf8")
|
|
7004
7550
|
);
|
|
7005
7551
|
if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
|
|
7006
7552
|
versions[name] = version;
|
|
7007
7553
|
break;
|
|
7008
|
-
} catch (
|
|
7009
|
-
const parent =
|
|
7554
|
+
} catch (e21) {
|
|
7555
|
+
const parent = path4.default.dirname(dir);
|
|
7010
7556
|
if (parent === dir) break;
|
|
7011
7557
|
dir = parent;
|
|
7012
7558
|
}
|
|
@@ -7036,7 +7582,7 @@ var LANGS = {
|
|
|
7036
7582
|
cjs: "jsx",
|
|
7037
7583
|
jsx: "jsx"
|
|
7038
7584
|
};
|
|
7039
|
-
var
|
|
7585
|
+
var parseAst3;
|
|
7040
7586
|
function staticValue(node) {
|
|
7041
7587
|
if (!node) return NOT_STATIC;
|
|
7042
7588
|
switch (node.type) {
|
|
@@ -7080,9 +7626,9 @@ function staticValue(node) {
|
|
|
7080
7626
|
}
|
|
7081
7627
|
}
|
|
7082
7628
|
function property(object, name) {
|
|
7083
|
-
return _optionalChain([object, 'access',
|
|
7629
|
+
return _optionalChain([object, 'access', _320 => _320.properties, 'access', _321 => _321.find, 'call', _322 => _322(
|
|
7084
7630
|
(entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
|
|
7085
|
-
), 'optionalAccess',
|
|
7631
|
+
), 'optionalAccess', _323 => _323.value]);
|
|
7086
7632
|
}
|
|
7087
7633
|
function toolFromObject(object) {
|
|
7088
7634
|
const name = staticValue(property(object, "name"));
|
|
@@ -7113,14 +7659,14 @@ function toolFromObject(object) {
|
|
|
7113
7659
|
}
|
|
7114
7660
|
function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
7115
7661
|
if (!code.includes(WEBMCP_CLIENT)) return [];
|
|
7116
|
-
const lang = _nullishCoalesce(LANGS[
|
|
7117
|
-
_nullishCoalesce(
|
|
7662
|
+
const lang = _nullishCoalesce(LANGS[path4.default.extname(filename).slice(1)], () => ( "tsx"));
|
|
7663
|
+
_nullishCoalesce(parseAst3, () => ( (parseAst3 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
|
|
7118
7664
|
"rolldown/parseAst"
|
|
7119
7665
|
).parseAst)));
|
|
7120
7666
|
let program;
|
|
7121
7667
|
try {
|
|
7122
|
-
program =
|
|
7123
|
-
} catch (
|
|
7668
|
+
program = parseAst3(code, { lang });
|
|
7669
|
+
} catch (e22) {
|
|
7124
7670
|
return [];
|
|
7125
7671
|
}
|
|
7126
7672
|
const locals = /* @__PURE__ */ new Map();
|
|
@@ -7128,7 +7674,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
7128
7674
|
if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
|
|
7129
7675
|
continue;
|
|
7130
7676
|
for (const specifier of statement.specifiers) {
|
|
7131
|
-
const imported = _nullishCoalesce(_optionalChain([specifier, 'access',
|
|
7677
|
+
const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _324 => _324.imported, 'optionalAccess', _325 => _325.name]), () => ( _optionalChain([specifier, 'access', _326 => _326.imported, 'optionalAccess', _327 => _327.value])));
|
|
7132
7678
|
if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
|
|
7133
7679
|
locals.set(specifier.local.name, imported);
|
|
7134
7680
|
}
|
|
@@ -7144,7 +7690,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
7144
7690
|
const [argument] = current.arguments;
|
|
7145
7691
|
if (definer && argument) {
|
|
7146
7692
|
const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
|
|
7147
|
-
(element) => _optionalChain([element, 'optionalAccess',
|
|
7693
|
+
(element) => _optionalChain([element, 'optionalAccess', _328 => _328.type]) === "ObjectExpression"
|
|
7148
7694
|
) : [] : argument.type === "ObjectExpression" ? [argument] : [];
|
|
7149
7695
|
for (const object of objects) {
|
|
7150
7696
|
const tool = toolFromObject(object);
|
|
@@ -7160,7 +7706,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
7160
7706
|
}
|
|
7161
7707
|
var cache = /* @__PURE__ */ new Map();
|
|
7162
7708
|
function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
7163
|
-
const base =
|
|
7709
|
+
const base = path4.default.resolve(root, srcDir);
|
|
7164
7710
|
let files;
|
|
7165
7711
|
try {
|
|
7166
7712
|
files = _tinyglobby.globSync.call(void 0, "**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
|
|
@@ -7169,7 +7715,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
7169
7715
|
expandDirectories: false,
|
|
7170
7716
|
ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
|
|
7171
7717
|
});
|
|
7172
|
-
} catch (
|
|
7718
|
+
} catch (e23) {
|
|
7173
7719
|
return [];
|
|
7174
7720
|
}
|
|
7175
7721
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -7177,16 +7723,16 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
7177
7723
|
for (const file of files.sort()) {
|
|
7178
7724
|
let mtimeMs;
|
|
7179
7725
|
try {
|
|
7180
|
-
mtimeMs =
|
|
7181
|
-
} catch (
|
|
7726
|
+
mtimeMs = fs2.default.statSync(file).mtimeMs;
|
|
7727
|
+
} catch (e24) {
|
|
7182
7728
|
continue;
|
|
7183
7729
|
}
|
|
7184
7730
|
let entry = cache.get(file);
|
|
7185
7731
|
if (!entry || entry.mtimeMs !== mtimeMs) {
|
|
7186
7732
|
let code = "";
|
|
7187
7733
|
try {
|
|
7188
|
-
code =
|
|
7189
|
-
} catch (
|
|
7734
|
+
code = fs2.default.readFileSync(file, "utf8");
|
|
7735
|
+
} catch (e25) {
|
|
7190
7736
|
}
|
|
7191
7737
|
entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
|
|
7192
7738
|
cache.set(file, entry);
|
|
@@ -7205,15 +7751,15 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
7205
7751
|
|
|
7206
7752
|
var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
7207
7753
|
function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
7208
|
-
const client = _optionalChain([cache2, 'optionalAccess',
|
|
7209
|
-
const adapter = _optionalChain([client, 'optionalAccess',
|
|
7754
|
+
const client = _optionalChain([cache2, 'optionalAccess', _329 => _329.client]);
|
|
7755
|
+
const adapter = _optionalChain([client, 'optionalAccess', _330 => _330.adapter]);
|
|
7210
7756
|
if (adapter === void 0) return void 0;
|
|
7211
7757
|
if (typeof adapter !== "string" || adapter.trim().length === 0) {
|
|
7212
7758
|
throw new Error(
|
|
7213
7759
|
'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
|
|
7214
7760
|
);
|
|
7215
7761
|
}
|
|
7216
|
-
const resolved =
|
|
7762
|
+
const resolved = path4.default.resolve(root, adapter);
|
|
7217
7763
|
const found = resolveAdapterFile(resolved);
|
|
7218
7764
|
if (!found) {
|
|
7219
7765
|
throw new Error(
|
|
@@ -7221,15 +7767,15 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
|
7221
7767
|
);
|
|
7222
7768
|
}
|
|
7223
7769
|
const options = {};
|
|
7224
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
7225
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
7770
|
+
if (_optionalChain([client, 'optionalAccess', _331 => _331.version]) !== void 0) options.version = client.version;
|
|
7771
|
+
if (_optionalChain([client, 'optionalAccess', _332 => _332.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
|
|
7226
7772
|
return { importPath: found.replace(/\\/g, "/"), options };
|
|
7227
7773
|
}
|
|
7228
7774
|
function resolveAdapterFile(resolved) {
|
|
7229
|
-
if (
|
|
7775
|
+
if (fs2.default.existsSync(resolved) && fs2.default.statSync(resolved).isFile()) return resolved;
|
|
7230
7776
|
for (const extension of ADAPTER_EXTENSIONS) {
|
|
7231
7777
|
const candidate = `${resolved}.${extension}`;
|
|
7232
|
-
if (
|
|
7778
|
+
if (fs2.default.existsSync(candidate) && fs2.default.statSync(candidate).isFile()) return candidate;
|
|
7233
7779
|
}
|
|
7234
7780
|
return void 0;
|
|
7235
7781
|
}
|
|
@@ -7272,14 +7818,27 @@ function farmChildrenToArray(children) {
|
|
|
7272
7818
|
|
|
7273
7819
|
function unwrapFarmDocumentElement(node) {
|
|
7274
7820
|
if (!React.isValidElement(node) || node.type !== "html") return undefined;
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7821
|
+
let body;
|
|
7822
|
+
function documentChild(child) {
|
|
7823
|
+
if (React.isValidElement(child)) {
|
|
7824
|
+
if (child.type === "body" && !body) body = child;
|
|
7825
|
+
return child.type === "head" ? null : child;
|
|
7826
|
+
}
|
|
7827
|
+
if (child && typeof child === "object" && typeof child[Symbol.iterator] === "function") {
|
|
7828
|
+
return Array.from(child, documentChild);
|
|
7829
|
+
}
|
|
7830
|
+
return child;
|
|
7831
|
+
}
|
|
7832
|
+
const children = documentChild(node.props.children);
|
|
7833
|
+
if (!body) return farmChildrenToArray(children);
|
|
7834
|
+
|
|
7835
|
+
// React derives useId from the size and index of each sibling array. Keep
|
|
7836
|
+
// the body's original slot, including empty siblings and nested arrays.
|
|
7837
|
+
function bodySlot(child) {
|
|
7838
|
+
if (Array.isArray(child)) return child.map(bodySlot);
|
|
7839
|
+
return child === body ? (body.props.children ?? null) : null;
|
|
7840
|
+
}
|
|
7841
|
+
return bodySlot(children);
|
|
7283
7842
|
}
|
|
7284
7843
|
|
|
7285
7844
|
function farmLayoutBoundaryElement(pattern, content) {
|
|
@@ -7589,10 +8148,10 @@ function exactIdPattern(ids) {
|
|
|
7589
8148
|
function fileNamePattern(files) {
|
|
7590
8149
|
const names = /* @__PURE__ */ new Set();
|
|
7591
8150
|
for (const file of files) {
|
|
7592
|
-
names.add(
|
|
8151
|
+
names.add(path4.default.basename(file));
|
|
7593
8152
|
try {
|
|
7594
|
-
names.add(
|
|
7595
|
-
} catch (
|
|
8153
|
+
names.add(path4.default.basename(_fs.realpathSync.call(void 0, file)));
|
|
8154
|
+
} catch (e26) {
|
|
7596
8155
|
}
|
|
7597
8156
|
}
|
|
7598
8157
|
return new RegExp(`(?:^|/)(?:${[...names].map(escapeRegExp).join("|")})(?:\\?.*)?$`);
|
|
@@ -7602,7 +8161,7 @@ function fileNamePattern(files) {
|
|
|
7602
8161
|
|
|
7603
8162
|
|
|
7604
8163
|
|
|
7605
|
-
var
|
|
8164
|
+
var parseAst4;
|
|
7606
8165
|
function propertyKeyName(property2) {
|
|
7607
8166
|
if (property2.computed) return void 0;
|
|
7608
8167
|
const key = property2.key;
|
|
@@ -7611,11 +8170,11 @@ function propertyKeyName(property2) {
|
|
|
7611
8170
|
return void 0;
|
|
7612
8171
|
}
|
|
7613
8172
|
function redactFarmDocsClientConfig(code, filename) {
|
|
7614
|
-
_nullishCoalesce(
|
|
8173
|
+
_nullishCoalesce(parseAst4, () => ( (parseAst4 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
|
|
7615
8174
|
"rolldown/parseAst"
|
|
7616
8175
|
).parseAst)));
|
|
7617
|
-
const extension =
|
|
7618
|
-
const program =
|
|
8176
|
+
const extension = path4.default.extname(filename);
|
|
8177
|
+
const program = parseAst4(code, {
|
|
7619
8178
|
lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
|
|
7620
8179
|
});
|
|
7621
8180
|
const edits = [];
|
|
@@ -7628,7 +8187,7 @@ function redactFarmDocsClientConfig(code, filename) {
|
|
|
7628
8187
|
const current = node;
|
|
7629
8188
|
if (current.type === "Property") {
|
|
7630
8189
|
const name = propertyKeyName(current);
|
|
7631
|
-
const valueType = _optionalChain([current, 'access',
|
|
8190
|
+
const valueType = _optionalChain([current, 'access', _333 => _333.value, 'optionalAccess', _334 => _334.type]);
|
|
7632
8191
|
const credential = name !== void 0 && (name.toLowerCase() === "headers" || _chunkSM2SYWARcjs.isSecretDocsConfigKey.call(void 0, name) && valueType !== "ObjectExpression" && valueType !== "ArrayExpression");
|
|
7633
8192
|
if (name && credential) {
|
|
7634
8193
|
edits.push(
|
|
@@ -7659,7 +8218,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
|
|
|
7659
8218
|
if (file === configModule) return true;
|
|
7660
8219
|
try {
|
|
7661
8220
|
return file === _fs.realpathSync.call(void 0, configModule).replace(/\\/g, "/");
|
|
7662
|
-
} catch (
|
|
8221
|
+
} catch (e27) {
|
|
7663
8222
|
return false;
|
|
7664
8223
|
}
|
|
7665
8224
|
}
|
|
@@ -7671,7 +8230,7 @@ function farmDocsClientConfigPlugin(configModule) {
|
|
|
7671
8230
|
// Never matches without a docs config module, so the bundler never calls the handler.
|
|
7672
8231
|
filter: { id: configModule ? fileNamePattern([configModule]) : /(?!)/ },
|
|
7673
8232
|
handler(code, id, options) {
|
|
7674
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
8233
|
+
if (_optionalChain([options, 'optionalAccess', _335 => _335.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
|
|
7675
8234
|
const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
|
|
7676
8235
|
return redacted === null ? null : { code: redacted, map: null };
|
|
7677
8236
|
}
|
|
@@ -7679,6 +8238,55 @@ function farmDocsClientConfigPlugin(configModule) {
|
|
|
7679
8238
|
};
|
|
7680
8239
|
}
|
|
7681
8240
|
|
|
8241
|
+
// src/video-player.ts
|
|
8242
|
+
var FARM_VIDEO_PLAYER_HTML = `<!doctype html>
|
|
8243
|
+
<html lang="en">
|
|
8244
|
+
<head>
|
|
8245
|
+
<meta charset="utf-8">
|
|
8246
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8247
|
+
<meta name="robots" content="noindex">
|
|
8248
|
+
<title>Video</title>
|
|
8249
|
+
<style>
|
|
8250
|
+
html, body { height: 100%; margin: 0; background: #000; }
|
|
8251
|
+
video { display: block; width: 100%; height: 100%; object-fit: contain; }
|
|
8252
|
+
</style>
|
|
8253
|
+
</head>
|
|
8254
|
+
<body>
|
|
8255
|
+
<video controls muted playsinline preload="metadata"></video>
|
|
8256
|
+
<script>
|
|
8257
|
+
(() => {
|
|
8258
|
+
const params = new URLSearchParams(location.search);
|
|
8259
|
+
const sameOrigin = (value) => {
|
|
8260
|
+
if (!value) return null;
|
|
8261
|
+
try {
|
|
8262
|
+
const url = new URL(value, location.href);
|
|
8263
|
+
return url.origin === location.origin ? url.href : null;
|
|
8264
|
+
} catch {
|
|
8265
|
+
return null;
|
|
8266
|
+
}
|
|
8267
|
+
};
|
|
8268
|
+
const src = sameOrigin(params.get("src"));
|
|
8269
|
+
if (!src) return;
|
|
8270
|
+
const video = document.querySelector("video");
|
|
8271
|
+
const poster = sameOrigin(params.get("poster"));
|
|
8272
|
+
if (poster) video.poster = poster;
|
|
8273
|
+
video.addEventListener(
|
|
8274
|
+
"loadedmetadata",
|
|
8275
|
+
() => {
|
|
8276
|
+
if (video.duration > 10) return;
|
|
8277
|
+
video.loop = true;
|
|
8278
|
+
// A browser may refuse autoplay; the controls still play it.
|
|
8279
|
+
video.play().catch(() => {});
|
|
8280
|
+
},
|
|
8281
|
+
{ once: true },
|
|
8282
|
+
);
|
|
8283
|
+
video.src = src;
|
|
8284
|
+
})();
|
|
8285
|
+
</script>
|
|
8286
|
+
</body>
|
|
8287
|
+
</html>
|
|
8288
|
+
`;
|
|
8289
|
+
|
|
7682
8290
|
// src/server/vite-config.ts
|
|
7683
8291
|
|
|
7684
8292
|
var FARM_CLIENT_ENTRY_PATTERN = "**/{page,layout,loading,error,not-found,default}.{js,jsx,ts,tsx}";
|
|
@@ -7703,13 +8311,13 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
|
7703
8311
|
];
|
|
7704
8312
|
function getFarmClientOptimizeDepsInclude(renderer) {
|
|
7705
8313
|
return Array.from(
|
|
7706
|
-
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess',
|
|
8314
|
+
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _336 => _336.optimizeDeps]) || []])
|
|
7707
8315
|
);
|
|
7708
8316
|
}
|
|
7709
8317
|
function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
|
|
7710
|
-
const resolvedProjectRoot =
|
|
8318
|
+
const resolvedProjectRoot = path4.default.resolve(projectRoot);
|
|
7711
8319
|
return appDirectories.map((appDirectory) => {
|
|
7712
|
-
const relativeAppDirectory =
|
|
8320
|
+
const relativeAppDirectory = path4.default.relative(resolvedProjectRoot, path4.default.resolve(appDirectory)).replace(/\\/g, "/");
|
|
7713
8321
|
const prefix = relativeAppDirectory || ".";
|
|
7714
8322
|
return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
|
|
7715
8323
|
});
|
|
@@ -7727,12 +8335,12 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
|
|
|
7727
8335
|
// Farm's HTML boots through a virtual module and imports route UI lazily.
|
|
7728
8336
|
// Explicit entries let Vite finish that crawl before a navigation can
|
|
7729
8337
|
// rotate the optimizer hash underneath a hydrated React runtime.
|
|
7730
|
-
..._optionalChain([entries, 'optionalAccess',
|
|
8338
|
+
..._optionalChain([entries, 'optionalAccess', _337 => _337.length]) ? { entries: [...entries] } : {}
|
|
7731
8339
|
};
|
|
7732
8340
|
}
|
|
7733
8341
|
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
7734
8342
|
return {
|
|
7735
|
-
"@":
|
|
8343
|
+
"@": path4.default.resolve(projectRoot, srcDir)
|
|
7736
8344
|
};
|
|
7737
8345
|
}
|
|
7738
8346
|
function mergeNoExternal(farmValue, userValue) {
|
|
@@ -7759,8 +8367,8 @@ function mergeFarmViteAlias(farmValue, userValue) {
|
|
|
7759
8367
|
return [...userEntries, ...normalize(farmValue).filter((entry) => !userNames.has(entry.find))];
|
|
7760
8368
|
}
|
|
7761
8369
|
function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
7762
|
-
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
7763
|
-
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
8370
|
+
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _338 => _338.optimizeDeps, 'optionalAccess', _339 => _339.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _340 => _340.optimizeDeps, 'optionalAccess', _341 => _341.noDiscovery])));
|
|
8371
|
+
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _342 => _342.optimizeDeps, 'optionalAccess', _343 => _343.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _344 => _344.optimizeDeps, 'optionalAccess', _345 => _345.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _346 => _346.optimizeDeps, 'optionalAccess', _347 => _347.holdUntilCrawlEnd]))));
|
|
7764
8372
|
return {
|
|
7765
8373
|
...farmConfig,
|
|
7766
8374
|
...userConfig,
|
|
@@ -7772,9 +8380,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
7772
8380
|
resolve: {
|
|
7773
8381
|
...farmConfig.resolve,
|
|
7774
8382
|
...userConfig.resolve,
|
|
7775
|
-
alias: mergeFarmViteAlias(_optionalChain([farmConfig, 'access',
|
|
8383
|
+
alias: mergeFarmViteAlias(_optionalChain([farmConfig, 'access', _348 => _348.resolve, 'optionalAccess', _349 => _349.alias]), _optionalChain([userConfig, 'access', _350 => _350.resolve, 'optionalAccess', _351 => _351.alias])),
|
|
7776
8384
|
dedupe: Array.from(
|
|
7777
|
-
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access',
|
|
8385
|
+
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _352 => _352.resolve, 'optionalAccess', _353 => _353.dedupe]) || [], ..._optionalChain([userConfig, 'access', _354 => _354.resolve, 'optionalAccess', _355 => _355.dedupe]) || []])
|
|
7778
8386
|
)
|
|
7779
8387
|
},
|
|
7780
8388
|
optimizeDeps: {
|
|
@@ -7784,21 +8392,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
7784
8392
|
holdUntilCrawlEnd,
|
|
7785
8393
|
include: Array.from(
|
|
7786
8394
|
/* @__PURE__ */ new Set([
|
|
7787
|
-
..._optionalChain([farmConfig, 'access',
|
|
7788
|
-
..._optionalChain([userConfig, 'access',
|
|
8395
|
+
..._optionalChain([farmConfig, 'access', _356 => _356.optimizeDeps, 'optionalAccess', _357 => _357.include]) || [],
|
|
8396
|
+
..._optionalChain([userConfig, 'access', _358 => _358.optimizeDeps, 'optionalAccess', _359 => _359.include]) || []
|
|
7789
8397
|
])
|
|
7790
8398
|
),
|
|
7791
8399
|
exclude: Array.from(
|
|
7792
8400
|
/* @__PURE__ */ new Set([
|
|
7793
|
-
..._optionalChain([farmConfig, 'access',
|
|
7794
|
-
..._optionalChain([userConfig, 'access',
|
|
8401
|
+
..._optionalChain([farmConfig, 'access', _360 => _360.optimizeDeps, 'optionalAccess', _361 => _361.exclude]) || [],
|
|
8402
|
+
..._optionalChain([userConfig, 'access', _362 => _362.optimizeDeps, 'optionalAccess', _363 => _363.exclude]) || []
|
|
7795
8403
|
])
|
|
7796
8404
|
)
|
|
7797
8405
|
},
|
|
7798
8406
|
ssr: {
|
|
7799
8407
|
...farmConfig.ssr,
|
|
7800
8408
|
...userConfig.ssr,
|
|
7801
|
-
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access',
|
|
8409
|
+
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _364 => _364.ssr, 'optionalAccess', _365 => _365.noExternal]), _optionalChain([userConfig, 'access', _366 => _366.ssr, 'optionalAccess', _367 => _367.noExternal]))
|
|
7802
8410
|
}
|
|
7803
8411
|
};
|
|
7804
8412
|
}
|
|
@@ -7869,8 +8477,8 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}, options = {}
|
|
|
7869
8477
|
...userRolldownOptions
|
|
7870
8478
|
};
|
|
7871
8479
|
const merged = mergeFarmViteConfig(farmConfig, shared);
|
|
7872
|
-
const farmBundlerOptions = _optionalChain([farmConfig, 'access',
|
|
7873
|
-
const output = options.clientOutput ? mergeFarmClientOutputOptions(_optionalChain([farmBundlerOptions, 'optionalAccess',
|
|
8480
|
+
const farmBundlerOptions = _optionalChain([farmConfig, 'access', _368 => _368.build, 'optionalAccess', _369 => _369.rollupOptions]);
|
|
8481
|
+
const output = options.clientOutput ? mergeFarmClientOutputOptions(_optionalChain([farmBundlerOptions, 'optionalAccess', _370 => _370.output]), userOutput) : _optionalChain([farmBundlerOptions, 'optionalAccess', _371 => _371.output]);
|
|
7874
8482
|
return {
|
|
7875
8483
|
...merged,
|
|
7876
8484
|
build: {
|
|
@@ -7887,7 +8495,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}, options = {}
|
|
|
7887
8495
|
esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
|
|
7888
8496
|
ssr: {
|
|
7889
8497
|
...merged.ssr,
|
|
7890
|
-
external: mergeExternal(_optionalChain([farmConfig, 'access',
|
|
8498
|
+
external: mergeExternal(_optionalChain([farmConfig, 'access', _372 => _372.ssr, 'optionalAccess', _373 => _373.external]), _optionalChain([userConfig, 'access', _374 => _374.ssr, 'optionalAccess', _375 => _375.external]))
|
|
7891
8499
|
}
|
|
7892
8500
|
};
|
|
7893
8501
|
}
|
|
@@ -7960,4 +8568,8 @@ ${FARM_DARK_VARIANT}
|
|
|
7960
8568
|
|
|
7961
8569
|
|
|
7962
8570
|
|
|
7963
|
-
|
|
8571
|
+
|
|
8572
|
+
|
|
8573
|
+
|
|
8574
|
+
|
|
8575
|
+
exports.inspectStaticMetadataImage = inspectStaticMetadataImage; exports.RouteManager = RouteManager; exports.createFarmDevClientManifest = createFarmDevClientManifest; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.resolveDevGlobalStylesheetHref = resolveDevGlobalStylesheetHref; exports.collectDevStylesheetUrls = collectDevStylesheetUrls; exports.farmDevServerStylesheetsPlugin = farmDevServerStylesheetsPlugin; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.inferFarmIslandStrategy = inferFarmIslandStrategy; exports.invalidateFarmRouteRootInferences = invalidateFarmRouteRootInferences; exports.resolveFarmRouteRootStrategy = resolveFarmRouteRootStrategy; exports.canBootFarmIslandsClient = canBootFarmIslandsClient; exports.canFarmSkipKeptLayoutRender = canFarmSkipKeptLayoutRender; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.resolveFarmImageServerRuntime = resolveFarmImageServerRuntime; exports.toBakedMarkdownSourcePath = toBakedMarkdownSourcePath; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE = FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE; exports.FARM_NAVIGATION_SCRIPT_SOURCE = FARM_NAVIGATION_SCRIPT_SOURCE; exports.FARM_NAVIGATION_STREAM_READER_SOURCE = FARM_NAVIGATION_STREAM_READER_SOURCE; exports.FARM_REFRESH_FIELDS_SOURCE = FARM_REFRESH_FIELDS_SOURCE; exports.exactIdPattern = exactIdPattern; exports.fileNamePattern = fileNamePattern; exports.redactFarmDocsClientConfig = redactFarmDocsClientConfig; exports.isFarmDocsClientConfigModule = isFarmDocsClientConfigModule; exports.farmDocsClientConfigPlugin = farmDocsClientConfigPlugin; exports.FARM_VIDEO_PLAYER_HTML = FARM_VIDEO_PLAYER_HTML; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteAlias = mergeFarmViteAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin;
|