@farm.js/core 0.1.66 → 0.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp-handler-QLFDDTYN.mjs → agent-mcp-handler-AZ7QW4UP.mjs} +5 -5
- package/dist/{agent-mcp-handler-OXT73ZBY.cjs → agent-mcp-handler-FER4MQDF.cjs} +6 -6
- package/dist/{agent-mcp.d-QD2WZ9BS.d.ts → agent-mcp.d-Uh5xr7aX.d.ts} +1 -1
- package/dist/{agent-mcp.d-CO_ABmNK.d.mts → agent-mcp.d-wkVPK1GA.d.mts} +1 -1
- package/dist/agent-runtime.cjs +6 -5
- package/dist/agent-runtime.d.mts +10 -8
- package/dist/agent-runtime.d.ts +10 -8
- package/dist/agent-runtime.mjs +5 -4
- package/dist/{analyzer-4UFP4HVP.mjs → analyzer-CQDU7E3Y.mjs} +2 -2
- package/dist/analyzer-PPAHM4AW.cjs +16 -0
- package/dist/api/client.cjs +12 -2
- package/dist/api/client.d.mts +4 -4
- package/dist/api/client.d.ts +4 -4
- package/dist/api/client.mjs +12 -2
- package/dist/api/client.native.cjs +12 -2
- package/dist/api/client.native.d.mts +5 -5
- package/dist/api/client.native.d.ts +5 -5
- package/dist/api/client.native.mjs +12 -2
- package/dist/api/node.cjs +223 -0
- package/dist/api/node.d.mts +61 -0
- package/dist/api/node.d.ts +61 -0
- package/dist/api/node.mjs +223 -0
- package/dist/api/route-manager.cjs +11 -11
- package/dist/api/route-manager.d.mts +14 -11
- package/dist/api/route-manager.d.ts +14 -11
- package/dist/api/route-manager.mjs +10 -10
- package/dist/api/runtime.cjs +11 -7
- package/dist/api/runtime.d.mts +11 -9
- package/dist/api/runtime.d.ts +11 -9
- package/dist/api/runtime.mjs +10 -6
- package/dist/{api-client.d-BNLXNCXJ.d.mts → api-client.d-Bp35zMqR.d.mts} +1 -1
- package/dist/{api-client.d-ddQBNGtu.d.ts → api-client.d-CFI_xL0V.d.ts} +1 -1
- package/dist/api.cjs +17 -13
- package/dist/api.d.mts +15 -12
- package/dist/api.d.ts +15 -12
- package/dist/api.mjs +16 -12
- package/dist/{app-manifest.d-DDmNkYQQ.d.ts → app-manifest.d-BT5i2F-o.d.ts} +1 -1
- package/dist/{app-manifest.d-BpKxiU_E.d.mts → app-manifest.d-Dd4q5CFx.d.mts} +1 -1
- package/dist/app-markdown.cjs +5 -5
- package/dist/app-markdown.d.mts +15 -15
- package/dist/app-markdown.d.ts +15 -15
- package/dist/app-markdown.mjs +4 -4
- package/dist/{app.d-x68Cwr0_.d.ts → app.d-BVOpL_f2.d.ts} +52 -11
- package/dist/{app.d-kuoVWhWM.d.mts → app.d-BhiDXex_.d.mts} +52 -11
- package/dist/{chunk-RY4ABNPE.cjs → chunk-225APHKC.cjs} +3 -3
- package/dist/{chunk-JGAE5XPL.cjs → chunk-23VJEGKC.cjs} +4 -2
- package/dist/{chunk-5C7XMKQ4.cjs → chunk-2AFW7673.cjs} +6 -1
- package/dist/{chunk-SYW346ZN.cjs → chunk-2LHZD3OP.cjs} +1 -21
- package/dist/{chunk-ZZI56IUY.mjs → chunk-2ZOYOYEE.mjs} +13 -13
- package/dist/{chunk-7XGWBPQQ.cjs → chunk-3EEINK7G.cjs} +24 -10
- package/dist/{chunk-BRWIVOV4.cjs → chunk-3GNHJ3RN.cjs} +10 -8
- package/dist/{chunk-HCGWDRZO.mjs → chunk-3Y52TWYU.mjs} +18 -7
- package/dist/{chunk-CBOEJ5Z4.cjs → chunk-437QZIC2.cjs} +133 -46
- package/dist/{chunk-O6L3YYPM.cjs → chunk-4E57QHPW.cjs} +8 -16
- package/dist/{chunk-WKPBIT5Q.cjs → chunk-4HGLJOXZ.cjs} +6 -6
- package/dist/{chunk-CJNAUEVC.mjs → chunk-4QENVMG7.mjs} +1 -1
- package/dist/{chunk-EMNKZGF4.mjs → chunk-4UAQB5LB.mjs} +556 -462
- package/dist/{chunk-BQWBHWEW.mjs → chunk-4ZXKYCYK.mjs} +1 -1
- package/dist/{chunk-N35YPV4N.mjs → chunk-57QAQU4F.mjs} +9 -7
- package/dist/{chunk-ZEXE4TGY.mjs → chunk-5FBZJJGA.mjs} +247 -110
- package/dist/{chunk-4OSOLDPL.cjs → chunk-5JKDFRTK.cjs} +2 -2
- package/dist/{chunk-OLIGNTWU.cjs → chunk-5NFQ6AZI.cjs} +7 -7
- package/dist/{chunk-6HRAK7I5.mjs → chunk-5OFNUETM.mjs} +8 -2
- package/dist/{chunk-RD623KW4.cjs → chunk-67MZTLTF.cjs} +21 -3
- package/dist/chunk-6I4BFRE7.cjs +51 -0
- package/dist/{chunk-UBMHQVWN.mjs → chunk-6OFOIMNS.mjs} +1 -1
- package/dist/{chunk-K5EW7GUU.mjs → chunk-7BIW7VCW.mjs} +13 -5
- package/dist/{chunk-CHYTADNK.cjs → chunk-7LK5CTUM.cjs} +70 -53
- package/dist/{chunk-HPP2II4Z.mjs → chunk-7PJARAQQ.mjs} +1 -1
- package/dist/{chunk-LEJDW34D.cjs → chunk-7PPLTD3P.cjs} +3 -3
- package/dist/{chunk-BYRZ5VTH.mjs → chunk-A3T445WK.mjs} +47 -34
- package/dist/{chunk-TGULJSHD.mjs → chunk-AJNBTOVQ.mjs} +20 -9
- package/dist/{chunk-FBEBSAVI.cjs → chunk-AKIQ54FK.cjs} +82 -63
- package/dist/{chunk-2NGZFOKG.mjs → chunk-AOIUYHPH.mjs} +2 -2
- package/dist/{chunk-NKRZLQUK.mjs → chunk-AQIO3RNL.mjs} +1 -1
- package/dist/chunk-AQIRXBBY.cjs +26 -0
- package/dist/{chunk-DQJ2CIH7.cjs → chunk-ASYOWPSR.cjs} +2 -1
- package/dist/chunk-AZ6IW6SF.mjs +28 -0
- package/dist/{chunk-QMDU6QHN.mjs → chunk-B6RBJJ5G.mjs} +1 -1
- package/dist/{chunk-I32V5CZL.cjs → chunk-BDYM2TN3.cjs} +28 -17
- package/dist/{chunk-JLDNXURZ.cjs → chunk-BZWTBELF.cjs} +32 -32
- package/dist/{chunk-ITV4QQL2.cjs → chunk-C6CUUBY5.cjs} +14 -3
- package/dist/{chunk-QGJ4FI2G.mjs → chunk-C6HGUTXB.mjs} +113 -29
- package/dist/{chunk-YN6BHOYY.cjs → chunk-CL52PD6D.cjs} +10 -3
- package/dist/{chunk-VQJHT2ND.mjs → chunk-CRVSYDHV.mjs} +2 -2
- package/dist/{chunk-XURDCXNH.cjs → chunk-CSLHNBPS.cjs} +6 -6
- package/dist/{chunk-XQSYOVCW.cjs → chunk-DBYNZIIQ.cjs} +13 -5
- package/dist/{chunk-AZUUKA66.mjs → chunk-DIXFKAPM.mjs} +1251 -389
- package/dist/{chunk-QTD6EMN2.mjs → chunk-DQ2DI3Y7.mjs} +11 -4
- package/dist/{chunk-NHQM2Q4I.cjs → chunk-DWLNLU55.cjs} +2 -2
- package/dist/chunk-DXZ57EPE.mjs +375 -0
- package/dist/{chunk-SA7MLSP4.mjs → chunk-E3HDJCWF.mjs} +3 -3
- package/dist/{chunk-52Y3C3HG.mjs → chunk-E7VF3LQ5.mjs} +3 -2
- package/dist/{chunk-752XUZIM.cjs → chunk-EGIY4A7V.cjs} +6 -6
- package/dist/chunk-EIVGPQN5.mjs +51 -0
- package/dist/{chunk-KPAJWD3N.mjs → chunk-EYPSKXO4.mjs} +1 -1
- package/dist/{chunk-E4UDLFWR.cjs → chunk-F36LS2C7.cjs} +796 -702
- package/dist/{chunk-MPIGW42F.mjs → chunk-F6CMGWAL.mjs} +1 -1
- package/dist/{chunk-GL7N5UHF.cjs → chunk-FJMC24KG.cjs} +21 -10
- package/dist/{chunk-QISW423S.cjs → chunk-FPBOAG6N.cjs} +2 -2
- package/dist/{chunk-3CCAICF7.cjs → chunk-FSODPZRT.cjs} +5 -5
- package/dist/{chunk-2C5L5RPM.cjs → chunk-FT6KJHS3.cjs} +71 -38
- package/dist/{chunk-WMTBBQHY.cjs → chunk-FVYBEMOD.cjs} +288 -151
- package/dist/{chunk-BM2LH2JM.mjs → chunk-G7NBPP7H.mjs} +14 -13
- package/dist/{chunk-ES2LD2YD.mjs → chunk-GCRT6GJG.mjs} +18 -0
- package/dist/{chunk-5OJVKXFV.cjs → chunk-GDM3ZD2O.cjs} +10 -8
- package/dist/{chunk-25T5VXOE.mjs → chunk-GFPS7MNE.mjs} +106 -19
- package/dist/{chunk-EMDGXYUD.mjs → chunk-GJ7QVFAG.mjs} +16 -7
- package/dist/{chunk-TGSEVBPO.mjs → chunk-GJEC5S4V.mjs} +11 -0
- package/dist/{chunk-HNAISJFD.cjs → chunk-HDPT6OYE.cjs} +9 -3
- package/dist/{chunk-RVGSVQWT.mjs → chunk-HEJM46HQ.mjs} +21 -7
- package/dist/chunk-HHLEYA4B.cjs +17 -0
- package/dist/{chunk-ZNH6NR3H.cjs → chunk-HJZZSBVK.cjs} +2 -2
- package/dist/{chunk-E552H232.cjs → chunk-I7J5RLGO.cjs} +16 -2
- package/dist/chunk-ICFPTHXM.mjs +97 -0
- package/dist/{chunk-K7OZAVOI.mjs → chunk-IFR74W6S.mjs} +46 -13
- package/dist/{chunk-MPJEIHW2.cjs → chunk-IGDYL2IA.cjs} +2 -2
- package/dist/{chunk-5A77OEIG.cjs → chunk-IHTDLCDJ.cjs} +5 -5
- package/dist/{chunk-OYZXVBZP.cjs → chunk-IUKBPBM7.cjs} +2 -1
- package/dist/chunk-J6TZRYCO.cjs +22 -0
- package/dist/{chunk-E4RDMG3K.mjs → chunk-JL2YW5KX.mjs} +5 -4
- package/dist/chunk-JSOCDYER.cjs +375 -0
- package/dist/{chunk-UPYIFH2H.cjs → chunk-JWLRBDDC.cjs} +2 -2
- package/dist/{chunk-OLGQZRW6.mjs → chunk-JZBU7V4D.mjs} +37 -17
- package/dist/{chunk-ONG4RDW3.mjs → chunk-JZGL2PIH.mjs} +13 -3
- package/dist/chunk-K63OWRY2.mjs +22 -0
- package/dist/{chunk-TUPKMMXT.mjs → chunk-K6HIIWUB.mjs} +1 -1
- package/dist/{chunk-MESQF2JC.mjs → chunk-K6SXMVXO.mjs} +2 -2
- package/dist/{chunk-L2JG337G.cjs → chunk-K6VFYFOY.cjs} +33 -31
- package/dist/{chunk-TKK5QHKZ.mjs → chunk-KDO6T6OB.mjs} +3 -3
- package/dist/{chunk-EZ34EHQP.mjs → chunk-KI3MU7B5.mjs} +1 -1
- package/dist/{chunk-GHNW564E.mjs → chunk-KSZK34HU.mjs} +30 -10
- package/dist/{chunk-IT6WRNGB.cjs → chunk-KWCZKJYU.cjs} +1541 -679
- package/dist/{chunk-DVKH2RVN.cjs → chunk-LDEXTX4I.cjs} +70 -57
- package/dist/{chunk-ECKQFEX2.mjs → chunk-LENKRGBV.mjs} +8 -6
- package/dist/{chunk-XBSKPLHF.cjs → chunk-LR4KP3I7.cjs} +2 -2
- package/dist/{chunk-HEPJIKKQ.cjs → chunk-MCSRMEQV.cjs} +2 -2
- package/dist/{chunk-DQF3QLOH.mjs → chunk-ME7RVELR.mjs} +3 -2
- package/dist/{chunk-VFXE6NWR.mjs → chunk-MGKWYPE3.mjs} +2 -1
- package/dist/{chunk-TZVUF5JJ.mjs → chunk-MGZVDX4R.mjs} +5 -5
- package/dist/{chunk-MGKW5XZE.cjs → chunk-MMDKYJ5V.cjs} +7 -7
- package/dist/{chunk-SK7QSNWE.mjs → chunk-MNJDNTGO.mjs} +1 -1
- package/dist/{chunk-5Y2P454O.cjs → chunk-MTBDJ326.cjs} +6 -5
- package/dist/{chunk-FIR62CR3.mjs → chunk-MV7NWU23.mjs} +1 -1
- package/dist/{chunk-7ONGIFYX.cjs → chunk-MZ4CRSY7.cjs} +481 -171
- package/dist/{chunk-O4F3JUST.mjs → chunk-NDDRTFN4.mjs} +4 -0
- package/dist/{chunk-4IHMHFQB.cjs → chunk-NG2EZ6QS.cjs} +28 -1
- package/dist/{chunk-XBSLKXBL.mjs → chunk-NT4W4H52.mjs} +52 -35
- package/dist/{chunk-UAQD67HM.mjs → chunk-NVOMQLI2.mjs} +16 -2
- package/dist/{chunk-R62SF5R4.mjs → chunk-OB45EAQL.mjs} +6 -1
- package/dist/{chunk-V56632LA.cjs → chunk-OCNV4CI2.cjs} +39 -6
- package/dist/{chunk-SYXPWJ7N.cjs → chunk-OFBLGH6V.cjs} +17 -18
- package/dist/{chunk-VQ4NWOWO.mjs → chunk-OGVTUGMU.mjs} +5 -13
- package/dist/{chunk-3UZVPO72.mjs → chunk-OIOPQ25L.mjs} +6 -7
- package/dist/{chunk-2XGBJSDV.cjs → chunk-OO7DYIJD.cjs} +73 -24
- package/dist/{chunk-27FPUFWR.mjs → chunk-P2NBQ5JI.mjs} +1 -1
- package/dist/{chunk-HZPKJRYA.cjs → chunk-PDFFYZAT.cjs} +2 -2
- package/dist/{chunk-GSVJ3IIF.cjs → chunk-PHCJJJZV.cjs} +2 -2
- package/dist/{chunk-EVMXPJCB.mjs → chunk-PKMUQ7LM.mjs} +2 -1
- package/dist/{chunk-OAJOQU5J.mjs → chunk-PLJKJJ2H.mjs} +82 -63
- package/dist/{chunk-72KCTHLV.cjs → chunk-PRL7FXG4.cjs} +113 -29
- package/dist/{chunk-6XQSPIN6.cjs → chunk-PWKAX5MS.cjs} +13 -3
- package/dist/{chunk-4ZJ5C7UJ.cjs → chunk-QIXEU2WV.cjs} +19 -10
- package/dist/{chunk-FJWN7RV4.cjs → chunk-QO43L7Z4.cjs} +38 -8
- package/dist/{chunk-X4K7TYN6.cjs → chunk-QOGIZKSO.cjs} +26 -25
- package/dist/{chunk-CNNBFGL5.cjs → chunk-QSUYB3RH.cjs} +14 -14
- package/dist/chunk-QYNZ3CTI.mjs +17 -0
- package/dist/{chunk-X3XUZWRB.mjs → chunk-R2ZHU37O.mjs} +36 -3
- package/dist/{chunk-ZIHWAN55.cjs → chunk-RE5E2G5S.cjs} +1 -1
- package/dist/{chunk-O75GQVUK.mjs → chunk-RLH5AH2M.mjs} +1 -1
- package/dist/chunk-RWR7SMD7.cjs +50 -0
- package/dist/{chunk-7PTISZSQ.cjs → chunk-S7MWSFFP.cjs} +4 -0
- package/dist/chunk-SD6JGJOM.mjs +50 -0
- package/dist/{chunk-7H4SVNC4.cjs → chunk-SPP3EZTJ.cjs} +46 -26
- package/dist/{chunk-BIF5MLTH.cjs → chunk-SQ6IWJ3H.cjs} +1 -1
- package/dist/{chunk-WVYRLP5E.mjs → chunk-T5XFZQCL.mjs} +1 -1
- package/dist/{chunk-WAY6LOQH.mjs → chunk-TEJ67GD2.mjs} +1 -1
- package/dist/{chunk-OP7LHY4Y.cjs → chunk-TNK2TVRS.cjs} +2005 -800
- package/dist/{chunk-IFTGERT3.mjs → chunk-TTXIITYA.mjs} +49 -0
- package/dist/{chunk-ZFWYCVKS.mjs → chunk-TY5KCYDE.mjs} +22 -4
- package/dist/{chunk-WYAXRIYP.cjs → chunk-UKZ6AWKZ.cjs} +10 -9
- package/dist/{chunk-UJ3R2AH2.cjs → chunk-UPOYKX4S.cjs} +5 -5
- package/dist/{chunk-VBCQ5WOI.cjs → chunk-URN7VFO7.cjs} +105 -16
- package/dist/{chunk-2DLGV2ZG.mjs → chunk-UTUS6JUH.mjs} +1 -21
- package/dist/{chunk-435QJNC2.mjs → chunk-VFNAK6A5.mjs} +4 -4
- package/dist/{chunk-WFWFECDW.mjs → chunk-VRGY3X2I.mjs} +100 -11
- package/dist/{chunk-LQNW3ABP.cjs → chunk-VX2HZGC7.cjs} +14 -14
- package/dist/chunk-W44X6IC2.cjs +97 -0
- package/dist/{chunk-A2MN5PQJ.mjs → chunk-WMLSZAKN.mjs} +9 -9
- package/dist/{chunk-672ISQIG.mjs → chunk-WPB67LE5.mjs} +379 -69
- package/dist/{chunk-3EEET2Q5.cjs → chunk-WUTFJOV7.cjs} +32 -12
- package/dist/chunk-WVQNXXNE.cjs +28 -0
- package/dist/{chunk-Y5TOT5F6.cjs → chunk-X3MHKLCO.cjs} +5 -5
- package/dist/{chunk-W2ZXMMHA.mjs → chunk-XCAQTCGK.mjs} +1 -1
- package/dist/{chunk-Z7P2BTZ3.cjs → chunk-XGTFLG73.cjs} +30 -12
- package/dist/{chunk-XCXHQBMM.mjs → chunk-Y2LU4LE5.mjs} +1 -1
- package/dist/{chunk-5J45H65F.mjs → chunk-Y5LEPEVH.mjs} +1 -1
- package/dist/{chunk-D4MRNBVF.cjs → chunk-Y6KHPJDB.cjs} +2 -2
- package/dist/{chunk-BT4SEFLC.cjs → chunk-YAEN3L2F.cjs} +3 -2
- package/dist/chunk-YFTGIHNC.mjs +26 -0
- package/dist/{chunk-KL7SHLQB.mjs → chunk-YGJ5P3TJ.mjs} +31 -1
- package/dist/{chunk-752IHQTD.cjs → chunk-YTNBCXCW.cjs} +12 -12
- package/dist/{chunk-RFKTJTWZ.mjs → chunk-YVPX5PI5.mjs} +3 -1
- package/dist/{chunk-4TVPYN32.cjs → chunk-Z3PW3DIR.cjs} +7 -7
- package/dist/{chunk-OB7VKCUZ.mjs → chunk-Z6SOXHAD.mjs} +1851 -646
- package/dist/{chunk-72KABRWN.mjs → chunk-ZJGFAW5U.mjs} +5 -3
- package/dist/{chunk-TNBJ4LZG.mjs → chunk-ZPKJPM7K.mjs} +4 -4
- package/dist/{chunk-5FE5YT2N.mjs → chunk-ZZGQD3LL.mjs} +28 -1
- package/dist/client/lifecycle.cjs +2 -2
- package/dist/client/lifecycle.d.mts +1 -1
- package/dist/client/lifecycle.d.ts +1 -1
- package/dist/client/lifecycle.mjs +1 -1
- package/dist/{client-component.d-D74pqdea.d.mts → client-component.d-BvQOxSqh.d.mts} +2 -2
- package/dist/{client-component.d-D8VcypQA.d.ts → client-component.d-DNVSLEPi.d.ts} +2 -2
- package/dist/client-plugins.cjs +2 -2
- package/dist/{client-plugins.d-D4-6hNx7.d.mts → client-plugins.d-CE1lVK2R.d.mts} +116 -373
- package/dist/{client-plugins.d-CXElzotB.d.ts → client-plugins.d-CNDqcAuf.d.ts} +116 -373
- package/dist/client-plugins.d.mts +10 -8
- package/dist/client-plugins.d.ts +10 -8
- package/dist/client-plugins.mjs +1 -1
- package/dist/client.cjs +11 -9
- package/dist/client.d.mts +17 -15
- package/dist/client.d.ts +17 -15
- package/dist/client.mjs +10 -8
- package/dist/{config.d-qt-mE8O5.d.mts → config.d-BKIhJtmr.d.mts} +7 -2
- package/dist/{config.d-qt-mE8O5.d.ts → config.d-BKIhJtmr.d.ts} +7 -2
- package/dist/config.d.mts +10 -8
- package/dist/config.d.ts +10 -8
- package/dist/cron.cjs +2 -2
- package/dist/cron.mjs +1 -1
- package/dist/deferred.cjs +2 -2
- package/dist/deferred.mjs +1 -1
- package/dist/deployment.cjs +4 -2
- package/dist/deployment.d.mts +15 -1
- package/dist/deployment.d.ts +15 -1
- package/dist/deployment.mjs +3 -1
- package/dist/desktop.d.mts +11 -9
- package/dist/desktop.d.ts +11 -9
- package/dist/{devtools-NZUVNUP3.mjs → devtools-2A2GPC7B.mjs} +33 -29
- package/dist/{devtools-N2JQCMXB.cjs → devtools-R27T3BRY.cjs} +38 -34
- package/dist/docs.cjs +28 -27
- package/dist/docs.d.mts +24 -10
- package/dist/docs.d.ts +24 -10
- package/dist/docs.mjs +27 -26
- package/dist/env-types.cjs +3 -3
- package/dist/env-types.mjs +2 -2
- package/dist/environment/vite.cjs +7 -7
- package/dist/environment/vite.d.mts +1 -1
- package/dist/environment/vite.d.ts +1 -1
- package/dist/environment/vite.mjs +6 -6
- package/dist/{generate-route-types.d-BL2pq6xC.d.ts → generate-route-types.d-B76M5R11.d.ts} +1 -1
- package/dist/{generate-route-types.d-BoVDU8qX.d.mts → generate-route-types.d-CaGMIaNI.d.mts} +1 -1
- package/dist/headers.cjs +3 -3
- package/dist/headers.mjs +2 -2
- package/dist/image/server.d.mts +1 -1
- package/dist/image/server.d.ts +1 -1
- package/dist/image/sharp.d.mts +1 -1
- package/dist/image/sharp.d.ts +1 -1
- package/dist/{image-config.d-CeDgNyX4.d.mts → image-config.d-ByhQ0TT7.d.mts} +3 -1
- package/dist/{image-config.d-CeDgNyX4.d.ts → image-config.d-ByhQ0TT7.d.ts} +3 -1
- package/dist/image.cjs +6 -6
- package/dist/image.d.mts +1 -1
- package/dist/image.d.ts +1 -1
- package/dist/image.mjs +1 -1
- package/dist/index.cjs +148 -128
- package/dist/{index.d-SSgYDv4D.d.mts → index.d-Bt3kl19W.d.mts} +1 -1
- package/dist/{index.d-A_x10zGS.d.ts → index.d-Cx_-DaKV.d.ts} +1 -1
- package/dist/index.d.mts +39 -87
- package/dist/index.d.ts +39 -87
- package/dist/index.mjs +224 -204
- package/dist/instrumentation.cjs +3 -3
- package/dist/instrumentation.mjs +2 -2
- package/dist/{integration-orm-52GPGTHO.cjs → integrations/orm.cjs} +5 -5
- package/dist/integrations/orm.d.mts +35 -0
- package/dist/integrations/orm.d.ts +35 -0
- package/dist/{integration-orm-CO23MSFE.mjs → integrations/orm.mjs} +5 -5
- package/dist/integrations.cjs +6 -5
- package/dist/integrations.d.mts +10 -8
- package/dist/integrations.d.ts +10 -8
- package/dist/integrations.mjs +5 -4
- package/dist/internal/app-markdown-runtime.cjs +4 -4
- package/dist/internal/app-markdown-runtime.d.mts +27 -11
- package/dist/internal/app-markdown-runtime.d.ts +27 -11
- package/dist/internal/app-markdown-runtime.mjs +3 -3
- package/dist/internal/build-runtime.cjs +76 -71
- package/dist/internal/build-runtime.d.mts +12 -10
- package/dist/internal/build-runtime.d.ts +12 -10
- package/dist/internal/build-runtime.mjs +75 -70
- package/dist/internal/cli-runtime.cjs +47 -46
- package/dist/internal/cli-runtime.mjs +46 -45
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +85 -36
- package/dist/internal/client-runtime.d.mts +44 -13
- package/dist/internal/client-runtime.d.ts +44 -13
- package/dist/internal/client-runtime.mjs +79 -30
- package/dist/internal/compression-runtime.d.mts +10 -8
- package/dist/internal/compression-runtime.d.ts +10 -8
- package/dist/internal/config-runtime.cjs +27 -26
- package/dist/internal/config-runtime.d.mts +14 -12
- package/dist/internal/config-runtime.d.ts +14 -12
- package/dist/internal/config-runtime.mjs +26 -25
- package/dist/internal/docs-precompiled-runtime.cjs +16 -5
- package/dist/internal/docs-precompiled-runtime.d.mts +7 -0
- package/dist/internal/docs-precompiled-runtime.d.ts +7 -0
- package/dist/internal/docs-precompiled-runtime.mjs +15 -4
- package/dist/internal/form-actions.cjs +7 -2
- package/dist/internal/form-actions.d.mts +10 -3
- package/dist/internal/form-actions.d.ts +10 -3
- package/dist/internal/form-actions.mjs +8 -3
- package/dist/internal/infra-analytics-runtime.cjs +11 -11
- package/dist/internal/infra-analytics-runtime.mjs +9 -9
- package/dist/internal/islands-boot.cjs +6 -1
- package/dist/internal/islands-boot.mjs +6 -1
- package/dist/internal/islands-runtime.cjs +33 -4
- package/dist/internal/islands-runtime.d.mts +1 -1
- package/dist/internal/islands-runtime.d.ts +1 -1
- package/dist/internal/islands-runtime.mjs +31 -2
- package/dist/internal/native-server-fns.cjs +5 -5
- package/dist/internal/native-server-fns.mjs +4 -4
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-node-env.cjs +4 -2
- package/dist/internal/production-node-env.d.mts +22 -1
- package/dist/internal/production-node-env.d.ts +22 -1
- package/dist/internal/production-node-env.mjs +3 -1
- package/dist/internal/production-runtime.cjs +57 -39
- package/dist/internal/production-runtime.d.mts +27 -21
- package/dist/internal/production-runtime.d.ts +27 -21
- package/dist/internal/production-runtime.mjs +72 -54
- package/dist/internal/react-cache.cjs +3 -3
- package/dist/internal/react-cache.mjs +1 -1
- package/dist/internal/server-tree.cjs +2 -2
- package/dist/internal/server-tree.d.mts +0 -5
- package/dist/internal/server-tree.d.ts +0 -5
- package/dist/internal/server-tree.mjs +1 -1
- package/dist/internal/vercel-edge-middleware.cjs +87 -0
- package/dist/internal/vercel-edge-middleware.d.mts +39 -0
- package/dist/internal/vercel-edge-middleware.d.ts +39 -0
- package/dist/internal/vercel-edge-middleware.mjs +87 -0
- package/dist/layers-7P4RLKVX.cjs +20 -0
- package/dist/{layers-T55SA47E.mjs → layers-XQ7VFMWO.mjs} +4 -2
- package/dist/{layers.d-CcS42OGR.d.mts → layers.d-CH0bC4QL.d.mts} +2 -1
- package/dist/{layers.d-CcS42OGR.d.ts → layers.d-CH0bC4QL.d.ts} +2 -1
- package/dist/{lifecycle.d-C2aLBOwu.d.ts → lifecycle.d-keQs5Swc.d.mts} +7 -1
- package/dist/{lifecycle.d-C2aLBOwu.d.mts → lifecycle.d-keQs5Swc.d.ts} +7 -1
- package/dist/{manager-H5ZM3HAM.mjs → manager-JIA66YJ2.mjs} +4 -3
- package/dist/manager-JOHU6BQI.cjs +15 -0
- package/dist/markdown.cjs +7 -3
- package/dist/markdown.d.mts +10 -8
- package/dist/markdown.d.ts +10 -8
- package/dist/markdown.mjs +6 -2
- package/dist/middleware.cjs +11 -11
- package/dist/middleware.d.mts +13 -10
- package/dist/middleware.d.ts +13 -10
- package/dist/middleware.mjs +13 -13
- package/dist/mobile.d.mts +6 -6
- package/dist/mobile.d.ts +6 -6
- package/dist/mount.d-Bki4pOaJ.d.mts +38 -0
- package/dist/mount.d-DjR5aerM.d.ts +38 -0
- package/dist/{native-server-fn-handler-GLRHAYWV.mjs → native-server-fn-handler-EP5AFJYE.mjs} +5 -5
- package/dist/{native-server-fn-handler-J5MYRXN6.cjs → native-server-fn-handler-QRTXGZA4.cjs} +6 -6
- package/dist/{native-tree-7LPH57Z4.cjs → native-tree-W2SSJB3Y.cjs} +4 -4
- package/dist/{native-tree-VV6WN3GX.mjs → native-tree-Y5YQANW7.mjs} +3 -3
- package/dist/{navigation-delegate.d-GghbHJuK.d.ts → navigation-delegate.d-CtghaSP3.d.ts} +1 -1
- package/dist/{navigation-delegate.d-DQVYKoaZ.d.mts → navigation-delegate.d-VDkziXTK.d.mts} +1 -1
- package/dist/navigation.cjs +8 -7
- package/dist/navigation.d.mts +13 -11
- package/dist/navigation.d.ts +13 -11
- package/dist/navigation.mjs +7 -6
- package/dist/{nitro-DD4QCA66.mjs → nitro-NSTXT7LB.mjs} +11 -11
- package/dist/{nitro-VRDX2H4M.cjs → nitro-Y3LGITW3.cjs} +13 -13
- package/dist/node-module-bundle-LIZ2KMVW.cjs +13 -0
- package/dist/node-module-bundle-VR6NV6AI.mjs +13 -0
- package/dist/{plugin-53SY5YBS.mjs → plugin-SAS22JL7.mjs} +4 -3
- package/dist/{plugin-HZIBL3DW.cjs → plugin-WIU4GDD4.cjs} +5 -4
- package/dist/plugin.cjs +65 -63
- package/dist/plugin.d.mts +12 -10
- package/dist/plugin.d.ts +12 -10
- package/dist/plugin.mjs +64 -62
- package/dist/{production-runtime.d-Bzns3NW9.d.ts → production-runtime.d-BMyyLGBB.d.ts} +3 -57
- package/dist/{production-runtime.d-DiFa5vHW.d.mts → production-runtime.d-DMZY3OgV.d.mts} +3 -57
- package/dist/query/client.cjs +9 -7
- package/dist/query/client.mjs +5 -3
- package/dist/{render-plan.d-CcF0MeCf.d.mts → render-plan.d-BSwV8PE4.d.mts} +1 -1
- package/dist/{render-plan.d-CL_Ikfg_.d.ts → render-plan.d-i9sI4tc9.d.ts} +1 -1
- package/dist/renderer/none/server.cjs +35 -0
- package/dist/renderer/none/server.d.mts +21 -0
- package/dist/renderer/none/server.d.ts +21 -0
- package/dist/renderer/none/server.mjs +35 -0
- package/dist/renderer/react/server.cjs +3 -3
- package/dist/renderer/react/server.mjs +3 -3
- package/dist/renderer-client.cjs +8 -6
- package/dist/renderer-client.d.mts +13 -11
- package/dist/renderer-client.d.ts +13 -11
- package/dist/renderer-client.mjs +5 -3
- package/dist/renderer.cjs +6 -2
- package/dist/renderer.d.mts +25 -2
- package/dist/renderer.d.ts +25 -2
- package/dist/renderer.mjs +5 -1
- package/dist/request.cjs +2 -2
- package/dist/{request.d-DarDOCk9.d.mts → request.d-C24FNQ_7.d.mts} +1 -1
- package/dist/{request.d-B1RnTLri.d.ts → request.d-Dgln8tuI.d.ts} +1 -1
- package/dist/request.d.mts +11 -9
- package/dist/request.d.ts +11 -9
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering.d-BTUYCIj4.d.ts → route-rendering.d-CUylZKJA.d.ts} +1 -1
- package/dist/{route-rendering.d-D_2Ual0-.d.mts → route-rendering.d-Ds0BfwQi.d.mts} +1 -1
- package/dist/{route.d-BaVH3V0w.d.mts → route.d-DrXkpvcg.d.mts} +1 -1
- package/dist/{route.d-DBTEqifW.d.ts → route.d-hs-_cyHn.d.ts} +1 -1
- package/dist/{router.d-CMANF6da.d.ts → router.d-B56rMOFm.d.ts} +1 -1
- package/dist/{router.d-Cuv1jntg.d.mts → router.d-CFPcbqzc.d.mts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/{routes.d-B6yFe6jm.d.ts → routes.d-9GFFNioh.d.ts} +2 -2
- package/dist/{routes.d-c2HKfrfL.d.mts → routes.d-CrEy0lJS.d.mts} +2 -2
- package/dist/routes.d.mts +10 -8
- package/dist/routes.d.ts +10 -8
- package/dist/routes.mjs +2 -2
- package/dist/{rsc-pipeline-Z7QBZOIJ.cjs → rsc-pipeline-3T7V6OUT.cjs} +30 -28
- package/dist/{rsc-pipeline-7PNVJSTR.mjs → rsc-pipeline-GA4AQWZI.mjs} +29 -27
- package/dist/{runtime-FKFCUHSK.cjs → runtime-REUTNTI5.cjs} +72 -46
- package/dist/{runtime-QQHX4BP3.mjs → runtime-ZYCKKY7L.mjs} +60 -34
- package/dist/{runtime.d-wvh4ngU0.d.mts → runtime.d-DLRO-ExG.d.mts} +11 -3
- package/dist/{runtime.d-C3RQUj6_.d.ts → runtime.d-H7k9hOQE.d.ts} +11 -3
- package/dist/{schema-dev-notice-JMXEQWIQ.mjs → schema-dev-notice-C2JINRZI.mjs} +3 -2
- package/dist/{schema-dev-notice-PLBFDTOF.cjs → schema-dev-notice-X7GG7QVB.cjs} +5 -4
- package/dist/schema.cjs +6 -2
- package/dist/schema.d-Dny9pnrm.d.mts +298 -0
- package/dist/schema.d-Dny9pnrm.d.ts +298 -0
- package/dist/schema.d.mts +1 -115
- package/dist/schema.d.ts +1 -115
- package/dist/schema.mjs +5 -1
- package/dist/server-fn-client.d.mts +2 -2
- package/dist/server-fn-client.d.ts +2 -2
- package/dist/server-fn.cjs +5 -5
- package/dist/server-fn.mjs +4 -4
- package/dist/server-http.d-rAe7lAQc.d.mts +70 -0
- package/dist/server-http.d-rAe7lAQc.d.ts +70 -0
- package/dist/server-plugins.cjs +7 -7
- package/dist/server-plugins.d.mts +20 -12
- package/dist/server-plugins.d.ts +20 -12
- package/dist/server-plugins.mjs +8 -8
- package/dist/server-query.cjs +6 -6
- package/dist/server-query.mjs +5 -5
- package/dist/server.cjs +168 -126
- package/dist/server.d-C5FFrZAo.d.ts +57 -0
- package/dist/server.d-DgC8xew5.d.mts +57 -0
- package/dist/server.d.mts +24 -16
- package/dist/server.d.ts +24 -16
- package/dist/server.mjs +144 -102
- package/dist/{spa-router.d-m8H_Kl_B.d.ts → spa-router.d-Dr7oanhl.d.ts} +15 -5
- package/dist/{spa-router.d-WU_qS5gJ.d.mts → spa-router.d-g4CzhEH1.d.mts} +15 -5
- package/dist/testing.cjs +17 -17
- package/dist/testing.d.mts +10 -8
- package/dist/testing.d.ts +10 -8
- package/dist/testing.mjs +13 -13
- package/dist/theme/server.cjs +3 -3
- package/dist/theme/server.mjs +2 -2
- package/dist/types.d-xCIhyjOq.d.mts +233 -0
- package/dist/types.d-xCIhyjOq.d.ts +233 -0
- package/dist/{utils.d-C9dQD5Zg.d.ts → utils.d-BxxyDEb8.d.ts} +1 -1
- package/dist/{utils.d-W9IiEqmW.d.mts → utils.d-HIla3pD_.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +65 -63
- package/dist/vite.d.mts +36 -14
- package/dist/vite.d.ts +36 -14
- package/dist/vite.mjs +64 -62
- package/dist/workflows.cjs +4 -4
- package/dist/workflows.d.mts +121 -1
- package/dist/workflows.d.ts +121 -1
- package/dist/workflows.mjs +3 -3
- package/package.json +37 -2
- package/dist/analyzer-H7SIX6BJ.cjs +0 -16
- package/dist/chunk-5YPBFMBN.cjs +0 -19
- package/dist/chunk-CLFEQGET.cjs +0 -60
- package/dist/chunk-MK5E44WP.mjs +0 -60
- package/dist/chunk-OM7WILES.mjs +0 -100
- package/dist/chunk-Q5B4LNON.mjs +0 -19
- package/dist/chunk-QPJ4MZTO.mjs +0 -60
- package/dist/chunk-R53QDV6T.cjs +0 -100
- package/dist/chunk-UYTAP4FQ.cjs +0 -60
- package/dist/layers-DMRXRL7F.cjs +0 -18
- package/dist/manager-2LUKNX2N.cjs +0 -14
- package/dist/node-module-bundle-7JHPPF6B.mjs +0 -11
- package/dist/node-module-bundle-YJGYBOGK.cjs +0 -11
- package/dist/workflows.d-CRMzQZ3k.d.mts +0 -188
- package/dist/workflows.d-CRMzQZ3k.d.ts +0 -188
- /package/dist/{chunk-QGOZLGVP.mjs → chunk-I6FIAWNT.mjs} +0 -0
- /package/dist/{chunk-XPIPMWY3.cjs → chunk-K5NI5YQR.cjs} +0 -0
- /package/dist/{chunk-NWUHS6GV.cjs → chunk-QEJWNXRI.cjs} +0 -0
- /package/dist/{chunk-FSXSQQTV.mjs → chunk-TXE4SAMV.mjs} +0 -0
- /package/dist/{chunk-ZXK2EYQW.cjs → chunk-UUQNJDGH.cjs} +0 -0
- /package/dist/{chunk-46P5KNTE.mjs → chunk-VZBAW44S.mjs} +0 -0
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getFarmProjectSourceDir,
|
|
6
6
|
resolveFarmServerComponentsMode
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4QENVMG7.mjs";
|
|
8
8
|
import {
|
|
9
9
|
getFarmSourceRoots
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-E7VF3LQ5.mjs";
|
|
11
11
|
import {
|
|
12
12
|
isReactRenderer
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GCRT6GJG.mjs";
|
|
14
14
|
import {
|
|
15
15
|
PROGRAMMATIC_ROUTE_FILE_NAMES,
|
|
16
16
|
getProgrammaticRouteDefinitionSource,
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
} from "./chunk-JSDV2NUN.mjs";
|
|
22
22
|
import {
|
|
23
23
|
FARM_VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-F6CMGWAL.mjs";
|
|
25
25
|
|
|
26
26
|
// src/environment-vite.ts
|
|
27
|
-
import { realpathSync } from "fs";
|
|
27
|
+
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
28
28
|
import path5 from "path";
|
|
29
29
|
|
|
30
30
|
// src/islands-react-server-exports.ts
|
|
@@ -192,14 +192,18 @@ function resolveSource(file, source) {
|
|
|
192
192
|
if (source.startsWith(".")) return resolveRelative(file, source);
|
|
193
193
|
return resolveFarmPackageDefaultEntry(file, source);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function traceExport(file, name, depth) {
|
|
196
196
|
if (depth > 8) return void 0;
|
|
197
197
|
const program = readModule(file);
|
|
198
198
|
if (!program) return void 0;
|
|
199
|
-
|
|
199
|
+
const client = isClientModule(program);
|
|
200
|
+
const here = (kind) => ({ kind, file });
|
|
201
|
+
if (client && !(program.body ?? []).some((node) => (node.type ?? "").startsWith("Export"))) {
|
|
202
|
+
return here("client");
|
|
203
|
+
}
|
|
200
204
|
const follow = (source, imported) => {
|
|
201
205
|
const target = resolveSource(file, source);
|
|
202
|
-
return target ?
|
|
206
|
+
return target ? traceExport(target, imported, depth + 1) : void 0;
|
|
203
207
|
};
|
|
204
208
|
const imports = /* @__PURE__ */ new Map();
|
|
205
209
|
for (const node of program.body ?? []) {
|
|
@@ -212,38 +216,44 @@ function traceFarmExport(file, name, depth = 0) {
|
|
|
212
216
|
}
|
|
213
217
|
const local = (localName) => {
|
|
214
218
|
const binding = imports.get(localName);
|
|
215
|
-
return binding ? follow(binding.source, binding.imported) : "server";
|
|
219
|
+
return binding ? follow(binding.source, binding.imported) : here("server");
|
|
216
220
|
};
|
|
221
|
+
const own = (traced) => client ? here("client") : traced();
|
|
217
222
|
const stars = [];
|
|
218
223
|
for (const node of program.body ?? []) {
|
|
219
224
|
if (node.type === "ExportNamedDeclaration" && node.source) {
|
|
220
225
|
for (const specifier of node.specifiers ?? []) {
|
|
221
226
|
if (exportedName(specifier.exported) !== name) continue;
|
|
222
|
-
return follow(node.source.value, exportedName(specifier.local) ?? name);
|
|
227
|
+
return own(() => follow(node.source.value, exportedName(specifier.local) ?? name));
|
|
223
228
|
}
|
|
224
229
|
} else if (node.type === "ExportAllDeclaration" && node.source && !node.exported) {
|
|
225
230
|
stars.push(node.source.value);
|
|
226
231
|
} else if (node.type === "ExportNamedDeclaration" && !node.source) {
|
|
227
232
|
for (const specifier of node.specifiers ?? []) {
|
|
228
233
|
if (exportedName(specifier.exported) === name) {
|
|
229
|
-
return local(exportedName(specifier.local) ?? name);
|
|
234
|
+
return own(() => local(exportedName(specifier.local) ?? name));
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
237
|
const declared = [
|
|
233
238
|
...node.declaration?.id ? [node.declaration.id.name] : [],
|
|
234
239
|
...(node.declaration?.declarations ?? []).map((declarator) => declarator.id?.name)
|
|
235
240
|
];
|
|
236
|
-
if (declared.includes(name)) return "server";
|
|
241
|
+
if (declared.includes(name)) return here(client ? "client" : "server");
|
|
237
242
|
} else if (node.type === "ExportDefaultDeclaration" && name === "default") {
|
|
238
|
-
return
|
|
243
|
+
return own(
|
|
244
|
+
() => node.declaration?.type === "Identifier" ? local(node.declaration.name) : here("server")
|
|
245
|
+
);
|
|
239
246
|
}
|
|
240
247
|
}
|
|
241
248
|
for (const source of stars) {
|
|
242
249
|
const traced = follow(source, name);
|
|
243
|
-
if (traced) return traced;
|
|
250
|
+
if (traced) return own(() => traced);
|
|
244
251
|
}
|
|
245
252
|
return void 0;
|
|
246
253
|
}
|
|
254
|
+
function traceFarmExport(file, name) {
|
|
255
|
+
return traceExport(file, name, 0)?.kind;
|
|
256
|
+
}
|
|
247
257
|
function isFarmClientExport(file, name) {
|
|
248
258
|
return traceFarmExport(file, name) === "client";
|
|
249
259
|
}
|
|
@@ -334,6 +344,70 @@ function findFarmReactServerClientNames(code, file, specifier) {
|
|
|
334
344
|
}
|
|
335
345
|
return [...names];
|
|
336
346
|
}
|
|
347
|
+
function clientModuleSource(node) {
|
|
348
|
+
if (node.importKind === "type" || node.exportKind === "type") return null;
|
|
349
|
+
const source = (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" && node.source) && node.source?.value;
|
|
350
|
+
return typeof source === "string" && source.startsWith(".") ? source : null;
|
|
351
|
+
}
|
|
352
|
+
function isClientModuleFile(file) {
|
|
353
|
+
const program = readModule(file);
|
|
354
|
+
return program !== null && isClientModule(program);
|
|
355
|
+
}
|
|
356
|
+
function findFarmReactServerClientModules(code, file, specifier) {
|
|
357
|
+
const target = resolveFarmReactServerExport(file, specifier);
|
|
358
|
+
if (!target) return null;
|
|
359
|
+
const program = parseCode(code, file);
|
|
360
|
+
if (!program) return null;
|
|
361
|
+
const found = /* @__PURE__ */ new Set();
|
|
362
|
+
const seen = /* @__PURE__ */ new Set();
|
|
363
|
+
const walk2 = (current, depth) => {
|
|
364
|
+
if (depth > 8 || seen.has(current)) return;
|
|
365
|
+
seen.add(current);
|
|
366
|
+
const module = readModule(current);
|
|
367
|
+
if (!module || isClientModule(module)) return;
|
|
368
|
+
for (const node of module.body ?? []) {
|
|
369
|
+
const source = clientModuleSource(node) ?? (node.type === "ExportAllDeclaration" && typeof node.source?.value === "string" ? node.source.value : null);
|
|
370
|
+
if (!source?.startsWith(".")) continue;
|
|
371
|
+
const child = resolveRelative(current, source);
|
|
372
|
+
if (!child) continue;
|
|
373
|
+
if (isClientModuleFile(child)) {
|
|
374
|
+
if (clientModuleSource(node)) found.add(child);
|
|
375
|
+
} else walk2(child, depth + 1);
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
for (const entry of findPackageImports(program, (candidate) => candidate === specifier)) {
|
|
379
|
+
const wanted = [
|
|
380
|
+
...entry.defaultLocal ? ["default"] : [],
|
|
381
|
+
...entry.named.map((binding) => binding.imported),
|
|
382
|
+
...entry.namespace?.members ?? []
|
|
383
|
+
];
|
|
384
|
+
for (const name of wanted) {
|
|
385
|
+
const traced = traceExport(target, name, 0);
|
|
386
|
+
if (traced?.kind === "server") walk2(traced.file, 0);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return [...found].sort();
|
|
390
|
+
}
|
|
391
|
+
function rewriteFarmReactServerClientModuleImports(options) {
|
|
392
|
+
if (!options.code.includes("import") && !options.code.includes("export")) return null;
|
|
393
|
+
const program = parseCode(options.code, options.file);
|
|
394
|
+
if (!program) return null;
|
|
395
|
+
const sources = [];
|
|
396
|
+
for (const node of program.body ?? []) {
|
|
397
|
+
const source = clientModuleSource(node);
|
|
398
|
+
if (!source) continue;
|
|
399
|
+
const child = resolveRelative(options.file, source);
|
|
400
|
+
if (!child || !isClientModuleFile(child)) continue;
|
|
401
|
+
const reference = options.reference(child);
|
|
402
|
+
if (reference) sources.push({ start: node.source.start, end: node.source.end, reference });
|
|
403
|
+
}
|
|
404
|
+
if (sources.length === 0) return null;
|
|
405
|
+
let output = options.code;
|
|
406
|
+
for (const entry of sources.sort((left, right) => right.start - left.start)) {
|
|
407
|
+
output = output.slice(0, entry.start) + JSON.stringify(entry.reference) + output.slice(entry.end);
|
|
408
|
+
}
|
|
409
|
+
return output;
|
|
410
|
+
}
|
|
337
411
|
function rewriteFarmReactServerImports(options) {
|
|
338
412
|
if (!options.code.includes("import")) return null;
|
|
339
413
|
const program = parseCode(options.code, options.file);
|
|
@@ -507,12 +581,18 @@ function findFarmServerBundledPackage(importer, specifier) {
|
|
|
507
581
|
try {
|
|
508
582
|
const manifest = JSON.parse(fs.readFileSync(path.join(directory, "package.json"), "utf8"));
|
|
509
583
|
if (manifest.exports === void 0 && manifest.type !== "module" && typeof manifest.module === "string" && typeof manifest.main === "string" && path.resolve(directory, manifest.main) !== path.resolve(directory, manifest.module)) {
|
|
510
|
-
return parsed.name;
|
|
584
|
+
return { name: parsed.name, prebundle: isSelfContainedPackage(manifest, importer) };
|
|
511
585
|
}
|
|
512
586
|
} catch {
|
|
513
587
|
return null;
|
|
514
588
|
}
|
|
515
|
-
return scanPackage(directory).stylesheets ? parsed.name : null;
|
|
589
|
+
return scanPackage(directory).stylesheets ? { name: parsed.name, prebundle: false } : null;
|
|
590
|
+
}
|
|
591
|
+
function isSelfContainedPackage(manifest, importer) {
|
|
592
|
+
if (Object.keys(manifest.dependencies ?? {}).length > 0) return false;
|
|
593
|
+
return Object.keys(manifest.peerDependencies ?? {}).every(
|
|
594
|
+
(peer) => manifest.peerDependenciesMeta?.[peer]?.optional === true || findPackageDirectory(importer, peer) !== null
|
|
595
|
+
);
|
|
516
596
|
}
|
|
517
597
|
function findFarmPackageManifest(importer, specifier) {
|
|
518
598
|
const parsed = packageNameOf(specifier);
|
|
@@ -534,7 +614,9 @@ function findFarmPackageManifest(importer, specifier) {
|
|
|
534
614
|
}
|
|
535
615
|
function listFarmPackageExports(importer, specifier) {
|
|
536
616
|
const entry = resolveFarmPackageDefaultEntry(importer, specifier);
|
|
537
|
-
|
|
617
|
+
return entry ? listFarmModuleExports(entry) : null;
|
|
618
|
+
}
|
|
619
|
+
function listFarmModuleExports(entry) {
|
|
538
620
|
const names = /* @__PURE__ */ new Set();
|
|
539
621
|
const seen = /* @__PURE__ */ new Set();
|
|
540
622
|
const collect = (file, depth) => {
|
|
@@ -554,8 +636,8 @@ function listFarmPackageExports(importer, specifier) {
|
|
|
554
636
|
if (name) names.add(name);
|
|
555
637
|
} else if (node.type === "ExportNamedDeclaration") {
|
|
556
638
|
esm = true;
|
|
557
|
-
for (const
|
|
558
|
-
const name = exportedName(
|
|
639
|
+
for (const specifier of node.specifiers ?? []) {
|
|
640
|
+
const name = exportedName(specifier.exported);
|
|
559
641
|
if (name) names.add(name);
|
|
560
642
|
}
|
|
561
643
|
if (node.declaration?.id?.name) names.add(node.declaration.id.name);
|
|
@@ -1130,10 +1212,15 @@ import path4 from "path";
|
|
|
1130
1212
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1131
1213
|
|
|
1132
1214
|
// src/islands-package-references.ts
|
|
1215
|
+
import { createHash } from "crypto";
|
|
1133
1216
|
import fs2 from "fs";
|
|
1134
1217
|
import path2 from "path";
|
|
1135
1218
|
import { parseAst as parseAst2 } from "rolldown/parseAst";
|
|
1136
1219
|
var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
1220
|
+
var moduleName = (node) => {
|
|
1221
|
+
const name = node?.type === "Identifier" ? node.name : node?.value;
|
|
1222
|
+
return typeof name === "string" ? name : null;
|
|
1223
|
+
};
|
|
1137
1224
|
function parse(code, file) {
|
|
1138
1225
|
const extension = path2.extname(file).slice(1);
|
|
1139
1226
|
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
|
|
@@ -1173,17 +1260,19 @@ function namespaceMembers2(program, local, declaration) {
|
|
|
1173
1260
|
return opaque ? null : [...members];
|
|
1174
1261
|
}
|
|
1175
1262
|
function findFarmPackageClientImports(code, file, isClientPackage) {
|
|
1176
|
-
if (!code.includes("import")) return [];
|
|
1263
|
+
if (!code.includes("import") && !code.includes("export")) return [];
|
|
1177
1264
|
const program = parse(code, file);
|
|
1178
1265
|
if (!program) return [];
|
|
1179
1266
|
const found = [];
|
|
1180
1267
|
for (const node of program.body ?? []) {
|
|
1181
|
-
|
|
1268
|
+
const reexport = node.type === "ExportNamedDeclaration" && node.source != null;
|
|
1269
|
+
if (node.type !== "ImportDeclaration" && !reexport) continue;
|
|
1270
|
+
if (node.importKind === "type" || node.exportKind === "type") continue;
|
|
1182
1271
|
const specifier = node.source?.value;
|
|
1183
1272
|
if (typeof specifier !== "string" || specifier.startsWith(".") || specifier.startsWith("/"))
|
|
1184
1273
|
continue;
|
|
1185
1274
|
const specifiers = (node.specifiers ?? []).filter(
|
|
1186
|
-
(entry2) => entry2.importKind !== "type"
|
|
1275
|
+
(entry2) => entry2.importKind !== "type" && entry2.exportKind !== "type"
|
|
1187
1276
|
);
|
|
1188
1277
|
if (specifiers.length === 0 || !isClientPackage(specifier)) continue;
|
|
1189
1278
|
const entry = {
|
|
@@ -1191,12 +1280,20 @@ function findFarmPackageClientImports(code, file, isClientPackage) {
|
|
|
1191
1280
|
end: node.end,
|
|
1192
1281
|
specifier,
|
|
1193
1282
|
named: [],
|
|
1194
|
-
kept: []
|
|
1283
|
+
kept: [],
|
|
1284
|
+
...reexport ? { reexport: true } : {}
|
|
1195
1285
|
};
|
|
1196
1286
|
const client = (name) => isFarmPackageClientExport(file, specifier, name);
|
|
1197
1287
|
let supported = true;
|
|
1198
1288
|
for (const binding of specifiers) {
|
|
1199
|
-
if (binding.type === "
|
|
1289
|
+
if (binding.type === "ExportSpecifier") {
|
|
1290
|
+
const imported = moduleName(binding.local);
|
|
1291
|
+
const exported = moduleName(binding.exported);
|
|
1292
|
+
if (!imported || !exported || !IDENTIFIER.test(imported) || !IDENTIFIER.test(exported))
|
|
1293
|
+
supported = false;
|
|
1294
|
+
else if (client(imported)) entry.named.push({ imported, local: exported });
|
|
1295
|
+
else entry.kept.push({ imported, local: exported });
|
|
1296
|
+
} else if (binding.type === "ImportDefaultSpecifier") {
|
|
1200
1297
|
if (client("default")) entry.defaultLocal = binding.local.name;
|
|
1201
1298
|
else entry.kept.push({ imported: "default", local: binding.local.name });
|
|
1202
1299
|
} else if (binding.type === "ImportNamespaceSpecifier") {
|
|
@@ -1214,8 +1311,8 @@ function findFarmPackageClientImports(code, file, isClientPackage) {
|
|
|
1214
1311
|
...values.length > 0 ? { values } : {}
|
|
1215
1312
|
};
|
|
1216
1313
|
} else {
|
|
1217
|
-
const imported = binding.imported
|
|
1218
|
-
if (
|
|
1314
|
+
const imported = moduleName(binding.imported);
|
|
1315
|
+
if (!imported || !IDENTIFIER.test(imported)) supported = false;
|
|
1219
1316
|
else if (client(imported)) entry.named.push({ imported, local: binding.local.name });
|
|
1220
1317
|
else entry.kept.push({ imported, local: binding.local.name });
|
|
1221
1318
|
}
|
|
@@ -1233,19 +1330,76 @@ function farmPackageClientImportExports(entry) {
|
|
|
1233
1330
|
}
|
|
1234
1331
|
var FARM_CLIENT_REFERENCE_PRAGMA = "// @farm-client-reference";
|
|
1235
1332
|
var FARM_CLIENT_REFERENCE_DIRECTORY = "/.farm/client-references/";
|
|
1236
|
-
|
|
1333
|
+
var FARM_RESOLVE_FROM_PREFIX = "farm:resolve-from:";
|
|
1334
|
+
function parseFarmResolveFrom(id, importer) {
|
|
1335
|
+
if (!id.startsWith(FARM_RESOLVE_FROM_PREFIX)) return null;
|
|
1336
|
+
const rest = id.slice(FARM_RESOLVE_FROM_PREFIX.length);
|
|
1337
|
+
const separator = rest.indexOf(":");
|
|
1338
|
+
if (separator <= 0) return null;
|
|
1339
|
+
const directory = path2.resolve(
|
|
1340
|
+
path2.dirname(importer),
|
|
1341
|
+
decodeURIComponent(rest.slice(0, separator))
|
|
1342
|
+
);
|
|
1343
|
+
return {
|
|
1344
|
+
specifier: rest.slice(separator + 1),
|
|
1345
|
+
importer: path2.join(directory, "__farm_client_reference__.js")
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
function farmPackageClientReferencePath(root, specifier, exportName, scope) {
|
|
1237
1349
|
const directory = specifier.replace(/^@/, "").replace(/[^A-Za-z0-9._-]/g, "+");
|
|
1238
|
-
return path2.join(
|
|
1350
|
+
return path2.join(
|
|
1351
|
+
root,
|
|
1352
|
+
".farm",
|
|
1353
|
+
"client-references",
|
|
1354
|
+
directory,
|
|
1355
|
+
...scope ? [scope] : [],
|
|
1356
|
+
`${exportName}.tsx`
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
function specifierPackage(specifier) {
|
|
1360
|
+
const parts = specifier.split("/");
|
|
1361
|
+
return specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
|
|
1239
1362
|
}
|
|
1240
|
-
function
|
|
1241
|
-
|
|
1363
|
+
function packageLookup(directory, packageName) {
|
|
1364
|
+
for (let current = directory; ; current = path2.dirname(current)) {
|
|
1365
|
+
if (path2.basename(current) !== "node_modules") {
|
|
1366
|
+
const candidate = path2.join(current, "node_modules", packageName);
|
|
1367
|
+
try {
|
|
1368
|
+
return { from: current, real: fs2.realpathSync(candidate) };
|
|
1369
|
+
} catch {
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
if (path2.dirname(current) === current) return null;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
function referenceResolveFrom(root, specifier, importer) {
|
|
1376
|
+
const packageName = specifierPackage(specifier);
|
|
1377
|
+
const own = packageLookup(path2.dirname(importer), packageName);
|
|
1378
|
+
if (!own) return null;
|
|
1379
|
+
const app = packageLookup(path2.join(root, ".farm", "client-references"), packageName);
|
|
1380
|
+
if (app?.real === own.real) return null;
|
|
1381
|
+
try {
|
|
1382
|
+
return fs2.realpathSync(own.from);
|
|
1383
|
+
} catch {
|
|
1384
|
+
return own.from;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
function ensureFarmPackageClientReference(root, specifier, exportName, importer) {
|
|
1388
|
+
const resolveFrom = importer ? referenceResolveFrom(root, specifier, importer) : null;
|
|
1389
|
+
const scope = resolveFrom ? `__from__${createHash("sha256").update(path2.relative(root, resolveFrom).split(path2.sep).join("/")).digest("hex").slice(0, 8)}` : void 0;
|
|
1390
|
+
const file = farmPackageClientReferencePath(root, specifier, exportName, scope);
|
|
1391
|
+
const target = JSON.stringify(
|
|
1392
|
+
resolveFrom ? `${FARM_RESOLVE_FROM_PREFIX}${encodeURIComponent(
|
|
1393
|
+
path2.relative(path2.dirname(file), resolveFrom).split(path2.sep).join("/")
|
|
1394
|
+
)}:${specifier}` : specifier
|
|
1395
|
+
);
|
|
1242
1396
|
const source = [
|
|
1243
1397
|
`// Generated by Farm: ${specifier}'s ${exportName} export, as a client reference for server components.`,
|
|
1244
1398
|
FARM_CLIENT_REFERENCE_PRAGMA,
|
|
1245
1399
|
'"use client";',
|
|
1246
1400
|
// An import, not `export { name } from`: a server graph applies CommonJS interop to imports
|
|
1247
1401
|
// (react-wrap-balancer's `main` is CommonJS), not to re-exports.
|
|
1248
|
-
exportName === "default" ? `import __farm_reference__ from ${
|
|
1402
|
+
exportName === "default" ? `import __farm_reference__ from ${target};` : `import { ${exportName} as __farm_reference__ } from ${target};`,
|
|
1249
1403
|
`export { __farm_reference__ as ${exportName} };`,
|
|
1250
1404
|
""
|
|
1251
1405
|
].join("\n");
|
|
@@ -1260,27 +1414,84 @@ function ensureFarmPackageClientReference(root, specifier, exportName) {
|
|
|
1260
1414
|
}
|
|
1261
1415
|
return file;
|
|
1262
1416
|
}
|
|
1417
|
+
function writeIfChanged(file, source) {
|
|
1418
|
+
let current = null;
|
|
1419
|
+
try {
|
|
1420
|
+
current = fs2.readFileSync(file, "utf8");
|
|
1421
|
+
} catch {
|
|
1422
|
+
}
|
|
1423
|
+
if (current !== source) {
|
|
1424
|
+
fs2.mkdirSync(path2.dirname(file), { recursive: true });
|
|
1425
|
+
fs2.writeFileSync(file, source);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
function owningPackage(file) {
|
|
1429
|
+
for (let current = path2.dirname(file); ; current = path2.dirname(current)) {
|
|
1430
|
+
try {
|
|
1431
|
+
const manifest = JSON.parse(fs2.readFileSync(path2.join(current, "package.json"), "utf8"));
|
|
1432
|
+
if (typeof manifest.name === "string") return { directory: current, name: manifest.name };
|
|
1433
|
+
} catch {
|
|
1434
|
+
}
|
|
1435
|
+
if (path2.dirname(current) === current) return null;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
function ensureFarmInternalClientReference(root, clientFile) {
|
|
1439
|
+
const owner = owningPackage(clientFile);
|
|
1440
|
+
const names = listFarmModuleExports(clientFile);
|
|
1441
|
+
if (!owner || !names || names.length === 0) return null;
|
|
1442
|
+
const directory = owner.name.replace(/^@/, "").replace(/[^A-Za-z0-9._-]/g, "+");
|
|
1443
|
+
const hash = createHash("sha256").update(owner.directory).digest("hex").slice(0, 8);
|
|
1444
|
+
const relative = path2.relative(owner.directory, clientFile).split(path2.sep).join("+").replace(/[^A-Za-z0-9._+-]/g, "_");
|
|
1445
|
+
const file = path2.join(
|
|
1446
|
+
root,
|
|
1447
|
+
".farm",
|
|
1448
|
+
"client-references",
|
|
1449
|
+
directory,
|
|
1450
|
+
`__internal__${hash}`,
|
|
1451
|
+
`${relative}.tsx`
|
|
1452
|
+
);
|
|
1453
|
+
const target = JSON.stringify(clientFile);
|
|
1454
|
+
const lines = [
|
|
1455
|
+
`// Generated by Farm: ${owner.name}'s ${path2.relative(owner.directory, clientFile).split(path2.sep).join("/")}, as a client reference for server components.`,
|
|
1456
|
+
FARM_CLIENT_REFERENCE_PRAGMA,
|
|
1457
|
+
'"use client";'
|
|
1458
|
+
];
|
|
1459
|
+
const exported = [];
|
|
1460
|
+
names.forEach((name, index) => {
|
|
1461
|
+
const local = `__farm_reference_${index}__`;
|
|
1462
|
+
lines.push(
|
|
1463
|
+
name === "default" ? `import ${local} from ${target};` : `import { ${name} as ${local} } from ${target};`
|
|
1464
|
+
);
|
|
1465
|
+
exported.push(`${local} as ${name}`);
|
|
1466
|
+
});
|
|
1467
|
+
lines.push(`export { ${exported.join(", ")} };`, "");
|
|
1468
|
+
writeIfChanged(file, lines.join("\n"));
|
|
1469
|
+
return file;
|
|
1470
|
+
}
|
|
1263
1471
|
function rewriteFarmPackageClientImports(options) {
|
|
1264
1472
|
const imports = findFarmPackageClientImports(options.code, options.file, options.isClientPackage);
|
|
1265
1473
|
if (imports.length === 0) return null;
|
|
1266
|
-
const reference = (specifier, exportName) => JSON.stringify(
|
|
1474
|
+
const reference = (specifier, exportName) => JSON.stringify(
|
|
1475
|
+
ensureFarmPackageClientReference(options.root, specifier, exportName, options.file)
|
|
1476
|
+
);
|
|
1267
1477
|
let output = options.code;
|
|
1268
1478
|
let next = 0;
|
|
1269
1479
|
let changed = false;
|
|
1270
1480
|
for (const entry of [...imports].sort((left, right) => right.start - left.start)) {
|
|
1271
1481
|
if (farmPackageClientImportExports(entry).length === 0) continue;
|
|
1272
1482
|
changed = true;
|
|
1483
|
+
const keyword = entry.reexport ? "export" : "import";
|
|
1273
1484
|
const lines = [];
|
|
1274
1485
|
if (entry.kept.length > 0) {
|
|
1275
1486
|
const bindings = entry.kept.map((binding) => `${binding.imported} as ${binding.local}`);
|
|
1276
|
-
lines.push(
|
|
1487
|
+
lines.push(`${keyword} { ${bindings.join(", ")} } from ${JSON.stringify(entry.specifier)};`);
|
|
1277
1488
|
}
|
|
1278
1489
|
if (entry.defaultLocal) {
|
|
1279
1490
|
lines.push(`import ${entry.defaultLocal} from ${reference(entry.specifier, "default")};`);
|
|
1280
1491
|
}
|
|
1281
1492
|
for (const binding of entry.named) {
|
|
1282
1493
|
lines.push(
|
|
1283
|
-
|
|
1494
|
+
`${keyword} { ${binding.imported} as ${binding.local} } from ${reference(entry.specifier, binding.imported)};`
|
|
1284
1495
|
);
|
|
1285
1496
|
}
|
|
1286
1497
|
if (entry.namespace) {
|
|
@@ -1396,8 +1607,40 @@ var PackageClientBoundaryCache = class {
|
|
|
1396
1607
|
if (entry.stamps) this.dirty = true;
|
|
1397
1608
|
}
|
|
1398
1609
|
async persist() {
|
|
1610
|
+
const pending = this.serialize();
|
|
1611
|
+
if (!pending) return;
|
|
1612
|
+
const { file, contents } = pending;
|
|
1613
|
+
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
1614
|
+
try {
|
|
1615
|
+
await fs3.promises.mkdir(path3.dirname(file), { recursive: true });
|
|
1616
|
+
await fs3.promises.writeFile(temporary, contents);
|
|
1617
|
+
await fs3.promises.rename(temporary, file);
|
|
1618
|
+
} catch {
|
|
1619
|
+
await fs3.promises.rm(temporary, { force: true }).catch(() => {
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
/** As `persist`, for a plan that runs synchronously (the dev server's). */
|
|
1624
|
+
persistSync() {
|
|
1625
|
+
const pending = this.serialize();
|
|
1626
|
+
if (!pending) return;
|
|
1627
|
+
const { file, contents } = pending;
|
|
1628
|
+
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
1629
|
+
try {
|
|
1630
|
+
fs3.mkdirSync(path3.dirname(file), { recursive: true });
|
|
1631
|
+
fs3.writeFileSync(temporary, contents);
|
|
1632
|
+
fs3.renameSync(temporary, file);
|
|
1633
|
+
} catch {
|
|
1634
|
+
try {
|
|
1635
|
+
fs3.rmSync(temporary, { force: true });
|
|
1636
|
+
} catch {
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
/** The file and its new contents, or `null` when it already holds what this scope learned. */
|
|
1641
|
+
serialize() {
|
|
1399
1642
|
const file = this.file;
|
|
1400
|
-
if (!file || !this.dirty && this.stored.size === 0) return;
|
|
1643
|
+
if (!file || !this.dirty && this.stored.size === 0) return null;
|
|
1401
1644
|
const paths = [];
|
|
1402
1645
|
const pathIndexes = /* @__PURE__ */ new Map();
|
|
1403
1646
|
const indexOf = (stamp) => {
|
|
@@ -1428,15 +1671,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1428
1671
|
paths,
|
|
1429
1672
|
entries
|
|
1430
1673
|
});
|
|
1431
|
-
|
|
1432
|
-
try {
|
|
1433
|
-
await fs3.promises.mkdir(path3.dirname(file), { recursive: true });
|
|
1434
|
-
await fs3.promises.writeFile(temporary, contents);
|
|
1435
|
-
await fs3.promises.rename(temporary, file);
|
|
1436
|
-
} catch {
|
|
1437
|
-
await fs3.promises.rm(temporary, { force: true }).catch(() => {
|
|
1438
|
-
});
|
|
1439
|
-
}
|
|
1674
|
+
return { file, contents };
|
|
1440
1675
|
}
|
|
1441
1676
|
restore(entry) {
|
|
1442
1677
|
const files = this.restoreStamps(entry.files, "file");
|
|
@@ -1524,6 +1759,17 @@ async function withPackageClientBoundaryCache(operation) {
|
|
|
1524
1759
|
function usePackageClientBoundaryCacheFile(file) {
|
|
1525
1760
|
getPackageClientBoundaryCache()?.load(file);
|
|
1526
1761
|
}
|
|
1762
|
+
function resolvePackageClientBoundaryCacheFile(root, distDir) {
|
|
1763
|
+
return path3.resolve(root, distDir, "cache", "client-boundaries.json");
|
|
1764
|
+
}
|
|
1765
|
+
function runWithPackageClientBoundaryCacheFile(file, operation) {
|
|
1766
|
+
if (getPackageClientBoundaryCache()) return operation();
|
|
1767
|
+
const cache2 = new PackageClientBoundaryCache();
|
|
1768
|
+
cache2.load(file);
|
|
1769
|
+
const result = getStorage().run(cache2, operation);
|
|
1770
|
+
cache2.persistSync();
|
|
1771
|
+
return result;
|
|
1772
|
+
}
|
|
1527
1773
|
|
|
1528
1774
|
// src/utils/client-component.ts
|
|
1529
1775
|
function readIfExists(filePath) {
|
|
@@ -1714,13 +1960,35 @@ function skipRegularExpression(content, startIndex) {
|
|
|
1714
1960
|
}
|
|
1715
1961
|
return null;
|
|
1716
1962
|
}
|
|
1963
|
+
var tokenizedModules = /* @__PURE__ */ new Map();
|
|
1964
|
+
var TOKENIZED_MODULE_CACHE_SIZE = 32;
|
|
1717
1965
|
function tokenizeModuleSource(content) {
|
|
1966
|
+
const cached = tokenizedModules.get(content);
|
|
1967
|
+
if (cached) return cached;
|
|
1968
|
+
const tokens = scanModuleSourceTokens(content);
|
|
1969
|
+
if (tokenizedModules.size >= TOKENIZED_MODULE_CACHE_SIZE) {
|
|
1970
|
+
tokenizedModules.delete(tokenizedModules.keys().next().value);
|
|
1971
|
+
}
|
|
1972
|
+
tokenizedModules.set(content, tokens);
|
|
1973
|
+
return tokens;
|
|
1974
|
+
}
|
|
1975
|
+
function isWhitespaceCode(code) {
|
|
1976
|
+
if (code < 128) return code === 32 || code >= 9 && code <= 13;
|
|
1977
|
+
return /\s/.test(String.fromCharCode(code));
|
|
1978
|
+
}
|
|
1979
|
+
function isIdentifierStartCode(code) {
|
|
1980
|
+
return code >= 97 && code <= 122 || code >= 65 && code <= 90 || code === 95 || code === 36;
|
|
1981
|
+
}
|
|
1982
|
+
function isIdentifierPartCode(code) {
|
|
1983
|
+
return isIdentifierStartCode(code) || code >= 48 && code <= 57;
|
|
1984
|
+
}
|
|
1985
|
+
function scanModuleSourceTokens(content) {
|
|
1718
1986
|
const tokens = [];
|
|
1719
1987
|
let index = 0;
|
|
1720
1988
|
let line = 1;
|
|
1721
1989
|
while (index < content.length) {
|
|
1722
1990
|
const character = content[index];
|
|
1723
|
-
if (
|
|
1991
|
+
if (isWhitespaceCode(content.charCodeAt(index))) {
|
|
1724
1992
|
if (character === "\n") line++;
|
|
1725
1993
|
index++;
|
|
1726
1994
|
continue;
|
|
@@ -1790,9 +2058,9 @@ function tokenizeModuleSource(content) {
|
|
|
1790
2058
|
}
|
|
1791
2059
|
continue;
|
|
1792
2060
|
}
|
|
1793
|
-
if (
|
|
2061
|
+
if (isIdentifierStartCode(content.charCodeAt(index))) {
|
|
1794
2062
|
const start = index++;
|
|
1795
|
-
while (index < content.length &&
|
|
2063
|
+
while (index < content.length && isIdentifierPartCode(content.charCodeAt(index))) index++;
|
|
1796
2064
|
tokens.push({ kind: "identifier", value: content.slice(start, index), line });
|
|
1797
2065
|
continue;
|
|
1798
2066
|
}
|
|
@@ -2501,11 +2769,6 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
2501
2769
|
const content = readIfExists(moduleSourcePath);
|
|
2502
2770
|
const parsed = parseClientModuleMetadata(content, false);
|
|
2503
2771
|
if (parsed.isClientComponent) {
|
|
2504
|
-
if (projectRoot && !path4.resolve(moduleSourcePath).startsWith(`${projectRoot}${path4.sep}`)) {
|
|
2505
|
-
fallbackReason = `client boundary ${moduleSourcePath} is outside the application root`;
|
|
2506
|
-
fallbackHint = "Move the component into the application, or publish it as a package (package client components render as static HTML)";
|
|
2507
|
-
return 0;
|
|
2508
|
-
}
|
|
2509
2772
|
if (!isIsolatableClientBoundarySource(content)) {
|
|
2510
2773
|
fallbackReason = `client boundary ${moduleSourcePath} uses an unsupported export shape`;
|
|
2511
2774
|
fallbackHint = "Export each component by name (`export function Name`, `export { Name }`, or `export default`) instead of `export *`";
|
|
@@ -2531,17 +2794,33 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
2531
2794
|
const importedPath = imported.path;
|
|
2532
2795
|
if (!importedPath) continue;
|
|
2533
2796
|
let importedBoundaryCount;
|
|
2797
|
+
const workspaceEntry = !imported.local && options.packageReferences ? farmWorkspaceServerEntry(importedPath) : null;
|
|
2534
2798
|
if (imported.local) {
|
|
2535
2799
|
importedBoundaryCount = visit(importedPath);
|
|
2800
|
+
} else if (workspaceEntry) {
|
|
2801
|
+
importedBoundaryCount = visit(workspaceEntry);
|
|
2536
2802
|
} else {
|
|
2537
2803
|
const reactServerClientNames = options.packageReferences && projectRoot ? findFarmReactServerClientNames(content ?? "", moduleSourcePath, specifier) : null;
|
|
2538
2804
|
if (reactServerClientNames) {
|
|
2539
2805
|
importedBoundaryCount = 0;
|
|
2540
2806
|
for (const exportName of reactServerClientNames) {
|
|
2541
2807
|
importedBoundaryCount += visit(
|
|
2542
|
-
ensureFarmPackageClientReference(
|
|
2808
|
+
ensureFarmPackageClientReference(
|
|
2809
|
+
projectRoot,
|
|
2810
|
+
specifier,
|
|
2811
|
+
exportName,
|
|
2812
|
+
moduleSourcePath
|
|
2813
|
+
)
|
|
2543
2814
|
);
|
|
2544
2815
|
}
|
|
2816
|
+
for (const clientFile of findFarmReactServerClientModules(
|
|
2817
|
+
content ?? "",
|
|
2818
|
+
moduleSourcePath,
|
|
2819
|
+
specifier
|
|
2820
|
+
) ?? []) {
|
|
2821
|
+
const reference = ensureFarmInternalClientReference(projectRoot, clientFile);
|
|
2822
|
+
if (reference) importedBoundaryCount += visit(reference);
|
|
2823
|
+
}
|
|
2545
2824
|
} else {
|
|
2546
2825
|
const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
|
|
2547
2826
|
if (!packageMetadata.shouldHydrate) continue;
|
|
@@ -2555,7 +2834,12 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
2555
2834
|
for (const reference of references) {
|
|
2556
2835
|
for (const exportName of farmPackageClientImportExports(reference)) {
|
|
2557
2836
|
importedBoundaryCount += visit(
|
|
2558
|
-
ensureFarmPackageClientReference(
|
|
2837
|
+
ensureFarmPackageClientReference(
|
|
2838
|
+
projectRoot,
|
|
2839
|
+
specifier,
|
|
2840
|
+
exportName,
|
|
2841
|
+
moduleSourcePath
|
|
2842
|
+
)
|
|
2559
2843
|
);
|
|
2560
2844
|
}
|
|
2561
2845
|
}
|
|
@@ -2658,6 +2942,12 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
2658
2942
|
islandStrategy: shouldHydrate ? parsed.islandStrategy ?? importedIslandStrategy ?? "load" : null
|
|
2659
2943
|
};
|
|
2660
2944
|
}
|
|
2945
|
+
function farmWorkspaceServerEntry(entry) {
|
|
2946
|
+
const real = realpathOrSelf(entry);
|
|
2947
|
+
if (real.split(path4.sep).includes("node_modules")) return null;
|
|
2948
|
+
if (parseClientModuleMetadata(readIfExists(real), false).isClientComponent) return null;
|
|
2949
|
+
return real;
|
|
2950
|
+
}
|
|
2661
2951
|
function realpathOrSelf(file) {
|
|
2662
2952
|
try {
|
|
2663
2953
|
return fs4.realpathSync(file);
|
|
@@ -2808,6 +3098,13 @@ function resolveImportedModule(importerPath, specifier, root) {
|
|
|
2808
3098
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
2809
3099
|
return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
|
|
2810
3100
|
}
|
|
3101
|
+
const resolveFrom = parseFarmResolveFrom(specifier, importerPath);
|
|
3102
|
+
if (resolveFrom) {
|
|
3103
|
+
return {
|
|
3104
|
+
path: resolvePackageModuleSourcePath(resolveFrom.importer, resolveFrom.specifier),
|
|
3105
|
+
local: false
|
|
3106
|
+
};
|
|
3107
|
+
}
|
|
2811
3108
|
const aliased = resolveProjectAliasSourcePath(specifier, root);
|
|
2812
3109
|
if (aliased) return { path: aliased, local: true };
|
|
2813
3110
|
const packagePath = resolvePackageModuleSourcePath(importerPath, specifier, root);
|
|
@@ -3112,7 +3409,18 @@ function isFarmPackageClientBoundary(importerPath, specifier, root) {
|
|
|
3112
3409
|
return inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set()).shouldHydrate;
|
|
3113
3410
|
}
|
|
3114
3411
|
var CLIENT_PACKAGE_SCAN_EXTENSIONS = /\.(?:[cm]?[jt]sx?)$/;
|
|
3115
|
-
var CLIENT_PACKAGE_SCAN_SKIP = /* @__PURE__ */ new Set([
|
|
3412
|
+
var CLIENT_PACKAGE_SCAN_SKIP = /* @__PURE__ */ new Set([
|
|
3413
|
+
"node_modules",
|
|
3414
|
+
".farm",
|
|
3415
|
+
".git",
|
|
3416
|
+
"dist",
|
|
3417
|
+
".output",
|
|
3418
|
+
"__tests__"
|
|
3419
|
+
]);
|
|
3420
|
+
var TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$/;
|
|
3421
|
+
function isScannedSourceFile(name) {
|
|
3422
|
+
return CLIENT_PACKAGE_SCAN_EXTENSIONS.test(name) && !name.endsWith(".d.ts") && !TEST_FILE.test(name);
|
|
3423
|
+
}
|
|
3116
3424
|
function bareSpecifierPackage(specifier) {
|
|
3117
3425
|
if (specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.startsWith("node:") || specifier.startsWith("virtual:") || specifier.includes("\0") || // A package's stylesheet or asset is not a module for the optimizer.
|
|
3118
3426
|
/\.(?:css|scss|sass|less|styl|svg|png|jpe?g|gif|webp|avif|ico|woff2?|ttf|json|wasm)$/.test(
|
|
@@ -3142,8 +3450,7 @@ function scanFarmPackageImports(directory, root) {
|
|
|
3142
3450
|
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3143
3451
|
continue;
|
|
3144
3452
|
}
|
|
3145
|
-
if (!
|
|
3146
|
-
continue;
|
|
3453
|
+
if (!isScannedSourceFile(entry.name)) continue;
|
|
3147
3454
|
const content = readIfExists(file);
|
|
3148
3455
|
if (!content) continue;
|
|
3149
3456
|
const client = hasUseClientDirective(content);
|
|
@@ -3159,8 +3466,8 @@ function scanFarmPackageImports(directory, root) {
|
|
|
3159
3466
|
walk2(directory);
|
|
3160
3467
|
return { client: [...found].sort(), server };
|
|
3161
3468
|
}
|
|
3162
|
-
function
|
|
3163
|
-
const found = /* @__PURE__ */ new
|
|
3469
|
+
function collectFarmServerBundledPackageInfo(directory) {
|
|
3470
|
+
const found = /* @__PURE__ */ new Map();
|
|
3164
3471
|
const checked = /* @__PURE__ */ new Set();
|
|
3165
3472
|
const walk2 = (current) => {
|
|
3166
3473
|
let entries;
|
|
@@ -3176,8 +3483,7 @@ function collectFarmServerBundledPackages(directory) {
|
|
|
3176
3483
|
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3177
3484
|
continue;
|
|
3178
3485
|
}
|
|
3179
|
-
if (!
|
|
3180
|
-
continue;
|
|
3486
|
+
if (!isScannedSourceFile(entry.name)) continue;
|
|
3181
3487
|
const content = readIfExists(file);
|
|
3182
3488
|
if (!content) continue;
|
|
3183
3489
|
for (const specifier of new Set(getImportSpecifiers(content))) {
|
|
@@ -3185,12 +3491,12 @@ function collectFarmServerBundledPackages(directory) {
|
|
|
3185
3491
|
if (!name || checked.has(name)) continue;
|
|
3186
3492
|
checked.add(name);
|
|
3187
3493
|
const bundled = findFarmServerBundledPackage(file, name);
|
|
3188
|
-
if (bundled) found.
|
|
3494
|
+
if (bundled) found.set(bundled.name, bundled);
|
|
3189
3495
|
}
|
|
3190
3496
|
}
|
|
3191
3497
|
};
|
|
3192
3498
|
walk2(directory);
|
|
3193
|
-
return [...found].sort();
|
|
3499
|
+
return [...found.values()].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
3194
3500
|
}
|
|
3195
3501
|
var clientReachableModules = /* @__PURE__ */ new Map();
|
|
3196
3502
|
function invalidateFarmClientReachableModules() {
|
|
@@ -3213,7 +3519,7 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
3213
3519
|
const file = path4.join(current, entry.name);
|
|
3214
3520
|
if (entry.isDirectory()) {
|
|
3215
3521
|
if (!entry.name.startsWith(".") && !CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3216
|
-
} else if (
|
|
3522
|
+
} else if (isScannedSourceFile(entry.name)) {
|
|
3217
3523
|
const content = readIfExists(file);
|
|
3218
3524
|
if (hasUseClientDirective(content) || hasHydrateExport(content)) queue.push(file);
|
|
3219
3525
|
}
|
|
@@ -3351,10 +3657,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3351
3657
|
if (environment === "server" && resolveFarmServerComponentsMode(options.experimental?.serverComponents) === "islands" && isApplicationScript(id)) {
|
|
3352
3658
|
const file = id.split("?", 1)[0];
|
|
3353
3659
|
const root = realpathSync(options.root ?? projectRoot);
|
|
3354
|
-
const clientCode = getFarmClientReachableModules(
|
|
3355
|
-
path5.resolve(root, options.srcDir || "src"),
|
|
3356
|
-
root
|
|
3357
|
-
).has(path5.resolve(file));
|
|
3660
|
+
const clientCode = getFarmClientReachableModules(root, root).has(path5.resolve(file)) || existsSync(file) && hasUseClientDirective(readFileSync(file, "utf8"));
|
|
3358
3661
|
const reached = clientCode ? null : findFarmClientOnlyImport(code, file);
|
|
3359
3662
|
if (reached) {
|
|
3360
3663
|
const chain = reached.chain.map((step) => path5.relative(root, step)).join(" -> ");
|
|
@@ -3660,6 +3963,7 @@ function transformError(id, message) {
|
|
|
3660
3963
|
}
|
|
3661
3964
|
|
|
3662
3965
|
export {
|
|
3966
|
+
FARM_BROWSER_BUILTIN_PREFIX,
|
|
3663
3967
|
resolveFarmBrowserBuiltin,
|
|
3664
3968
|
loadFarmBrowserBuiltin,
|
|
3665
3969
|
farmBrowserBuiltinsOptimizerPlugin,
|
|
@@ -3668,15 +3972,21 @@ export {
|
|
|
3668
3972
|
createEvaluatedRouteGraph,
|
|
3669
3973
|
mergeProgrammaticClientRoutes,
|
|
3670
3974
|
generateProgrammaticClientRouteModule,
|
|
3975
|
+
rewriteFarmReactServerClientModuleImports,
|
|
3671
3976
|
rewriteFarmReactServerImports,
|
|
3672
3977
|
invalidateFarmClientOnlyScan,
|
|
3673
3978
|
farmRelativeImportFiles,
|
|
3674
3979
|
FARM_CLIENT_REFERENCE_PRAGMA,
|
|
3675
3980
|
FARM_CLIENT_REFERENCE_DIRECTORY,
|
|
3981
|
+
FARM_RESOLVE_FROM_PREFIX,
|
|
3982
|
+
parseFarmResolveFrom,
|
|
3676
3983
|
ensureFarmPackageClientReference,
|
|
3984
|
+
ensureFarmInternalClientReference,
|
|
3677
3985
|
rewriteFarmPackageClientImports,
|
|
3678
3986
|
withPackageClientBoundaryCache,
|
|
3679
3987
|
usePackageClientBoundaryCacheFile,
|
|
3988
|
+
resolvePackageClientBoundaryCacheFile,
|
|
3989
|
+
runWithPackageClientBoundaryCacheFile,
|
|
3680
3990
|
resolveModuleSourcePath,
|
|
3681
3991
|
getFarmClientHydrationPlanOptions,
|
|
3682
3992
|
describeSuppressedAsyncHydration,
|
|
@@ -3695,7 +4005,7 @@ export {
|
|
|
3695
4005
|
resolveImportedModule,
|
|
3696
4006
|
isFarmPackageClientBoundary,
|
|
3697
4007
|
collectFarmClientPackageImports,
|
|
3698
|
-
|
|
4008
|
+
collectFarmServerBundledPackageInfo,
|
|
3699
4009
|
invalidateFarmClientReachableModules,
|
|
3700
4010
|
getFarmClientReachableModules,
|
|
3701
4011
|
resolveFarmClientOptimizeDeps,
|