@farm.js/core 0.1.72 → 0.1.74
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-VIT4GOSR.mjs → agent-mcp-handler-HX4F4VKN.mjs} +4 -4
- package/dist/{agent-mcp-handler-KE4J3W7S.cjs → agent-mcp-handler-NRIL4JBC.cjs} +5 -5
- package/dist/{agent-mcp.d-Cwff7lcA.d.mts → agent-mcp.d-BEhDfdWc.d.mts} +1 -1
- package/dist/{agent-mcp.d-BO3rZXEM.d.ts → agent-mcp.d-CX8_oOT_.d.ts} +1 -1
- package/dist/agent-runtime.cjs +4 -4
- package/dist/agent-runtime.d.mts +5 -5
- package/dist/agent-runtime.d.ts +5 -5
- package/dist/agent-runtime.mjs +3 -3
- package/dist/{analyzer-5Q75LTIL.mjs → analyzer-2K35LIQZ.mjs} +2 -2
- package/dist/analyzer-6EOYURMV.cjs +16 -0
- package/dist/api/client.d.mts +3 -3
- package/dist/api/client.d.ts +3 -3
- package/dist/api/client.native.d.mts +4 -4
- package/dist/api/client.native.d.ts +4 -4
- package/dist/api/node.cjs +9 -8
- package/dist/api/node.d.mts +7 -7
- package/dist/api/node.d.ts +7 -7
- package/dist/api/node.mjs +8 -7
- package/dist/api/route-manager.cjs +11 -9
- package/dist/api/route-manager.d.mts +10 -8
- package/dist/api/route-manager.d.ts +10 -8
- package/dist/api/route-manager.mjs +10 -8
- package/dist/api/runtime.cjs +8 -7
- package/dist/api/runtime.d.mts +6 -6
- package/dist/api/runtime.d.ts +6 -6
- package/dist/api/runtime.mjs +7 -6
- package/dist/{api-client.d-Bp35zMqR.d.mts → api-client.d-CyVmI4Di.d.mts} +2 -2
- package/dist/{api-client.d-CFI_xL0V.d.ts → api-client.d-DrTM7BdH.d.ts} +2 -2
- package/dist/api.cjs +13 -11
- package/dist/api.d.mts +10 -10
- package/dist/api.d.ts +10 -10
- package/dist/api.mjs +12 -10
- package/dist/{app-manifest.d-USD_IbFd.d.mts → app-manifest.d-BcXt2yCx.d.mts} +10 -1
- package/dist/{app-manifest.d-DwjGkYlP.d.ts → app-manifest.d-CVEx1CFB.d.ts} +10 -1
- package/dist/app-markdown.cjs +8 -4
- package/dist/app-markdown.d.mts +7 -7
- package/dist/app-markdown.d.ts +7 -7
- package/dist/app-markdown.mjs +7 -3
- package/dist/{app.d-DAmF2MAk.d.ts → app.d-B6i8CSrx.d.ts} +36 -4
- package/dist/{app.d-fW06_h8h.d.mts → app.d-DowzSmT5.d.mts} +36 -4
- package/dist/cache.cjs +2 -2
- package/dist/cache.d.mts +8 -0
- package/dist/cache.d.ts +8 -0
- package/dist/cache.mjs +1 -1
- package/dist/chunk-2DOI6HLJ.cjs +284 -0
- package/dist/chunk-2GQBBOFH.mjs +76 -0
- package/dist/{chunk-5LOARKDP.cjs → chunk-2TZ3F6TN.cjs} +29 -17
- package/dist/{chunk-IWCYRDRQ.cjs → chunk-35GBGSQZ.cjs} +3 -3
- package/dist/{chunk-GF22VGMS.cjs → chunk-3BUJIPKE.cjs} +2 -2
- package/dist/{chunk-Y5LEPEVH.mjs → chunk-3ODLJRA6.mjs} +1 -1
- package/dist/{chunk-DMAP4RND.cjs → chunk-3OMLZLDE.cjs} +54 -16
- package/dist/{chunk-VNBDN5W2.cjs → chunk-47ZDUDN5.cjs} +64 -27
- package/dist/{chunk-2W4GNXGX.cjs → chunk-4AB62NMW.cjs} +2 -2
- package/dist/{chunk-HDPT6OYE.cjs → chunk-4M5ESTJ2.cjs} +10 -2
- package/dist/{chunk-CBLRSZQL.cjs → chunk-56HHUSR5.cjs} +502 -430
- package/dist/chunk-5XD2ULJG.mjs +114 -0
- package/dist/{chunk-JX5VOLAV.cjs → chunk-65OS2TOT.cjs} +4 -4
- package/dist/{chunk-WIJF3PBM.mjs → chunk-6JEXH7N6.mjs} +1 -1
- package/dist/{chunk-TY5KCYDE.mjs → chunk-72NTEYCX.mjs} +10 -3
- package/dist/{chunk-5R4Q5FN7.cjs → chunk-737MIVX3.cjs} +52 -41
- package/dist/{chunk-5X6OHJEE.cjs → chunk-77SVUQM5.cjs} +74 -20
- package/dist/{chunk-CKQAQFF6.mjs → chunk-7RKHXF4P.mjs} +2 -2
- package/dist/{chunk-GJEC5S4V.mjs → chunk-7VCLTNED.mjs} +1 -1
- package/dist/{chunk-E3LE6EZH.cjs → chunk-ACAEFEOH.cjs} +38 -41
- package/dist/{chunk-REP6HWJN.mjs → chunk-AL6E63FZ.mjs} +2 -2
- package/dist/{chunk-DQ2DI3Y7.mjs → chunk-AO5IRA2N.mjs} +2 -2
- package/dist/{chunk-VAWDGGW3.mjs → chunk-AU5UPNOD.mjs} +26 -15
- package/dist/{chunk-DS7JGFW5.mjs → chunk-B3XY6FMC.mjs} +71 -17
- package/dist/{chunk-U7VH3Q5E.cjs → chunk-B5WZP3T3.cjs} +15 -2
- package/dist/{chunk-3JN5M3T5.mjs → chunk-BFOMCSZ2.mjs} +476 -138
- package/dist/{chunk-I4KPA2C6.mjs → chunk-BIX46FTI.mjs} +1 -1
- package/dist/{chunk-YZLEOMMA.mjs → chunk-BNXV3PRM.mjs} +4 -4
- package/dist/{chunk-3GNVIYPO.cjs → chunk-BSJMWCWM.cjs} +7 -7
- package/dist/{chunk-WVQNXXNE.cjs → chunk-BWFBTTJ5.cjs} +2 -2
- package/dist/{chunk-FEFCISOX.cjs → chunk-CEVXKJKF.cjs} +2 -2
- package/dist/{chunk-DGNMXL2O.mjs → chunk-CF77L6RL.mjs} +33 -36
- package/dist/{chunk-OB45EAQL.mjs → chunk-CXQZQK6R.mjs} +3 -2
- package/dist/{chunk-255J7K4X.mjs → chunk-D2IAYGYA.mjs} +1 -1
- package/dist/{chunk-OSEQL34Q.cjs → chunk-D4TYE6MY.cjs} +2 -2
- package/dist/{chunk-FSSONJRV.cjs → chunk-DM2YGTRH.cjs} +24 -17
- package/dist/{chunk-ICFPTHXM.mjs → chunk-DRBXYJZ6.mjs} +7 -3
- package/dist/{chunk-E3HDJCWF.mjs → chunk-DRHHTHA3.mjs} +1 -1
- package/dist/{chunk-YXIQYWOK.cjs → chunk-DTBRSRTR.cjs} +23 -5
- package/dist/{chunk-JZQS3ZOI.mjs → chunk-E4T7WJJN.mjs} +10 -2
- package/dist/{chunk-YAEN3L2F.cjs → chunk-EF5AP4CV.cjs} +21 -2
- package/dist/{chunk-SPP3EZTJ.cjs → chunk-EHJOSIXM.cjs} +137 -67
- package/dist/{chunk-JZBU7V4D.mjs → chunk-ELJQWUAR.mjs} +125 -55
- package/dist/{chunk-DMXMIE2C.cjs → chunk-ENYBDM4U.cjs} +2 -2
- package/dist/{chunk-ZFEJ2SF2.cjs → chunk-EWIEJQP6.cjs} +28 -28
- package/dist/{chunk-ZUVAGMQ5.cjs → chunk-F244KE2D.cjs} +7 -7
- package/dist/{chunk-WW3LRNQV.mjs → chunk-FCBUNILW.mjs} +1 -1
- package/dist/{chunk-645ENY7W.mjs → chunk-FEQ72ZHD.mjs} +16 -9
- package/dist/{chunk-ME7RVELR.mjs → chunk-FGXSWRWA.mjs} +20 -1
- package/dist/{chunk-2AFW7673.cjs → chunk-FNWL5DMG.cjs} +4 -3
- package/dist/{chunk-HLMUWKAP.cjs → chunk-FYV6DTAG.cjs} +826 -531
- package/dist/{chunk-7PPLTD3P.cjs → chunk-G7S6XG6X.cjs} +6 -6
- package/dist/{chunk-AQIO3RNL.mjs → chunk-GK2GBIXD.mjs} +3 -3
- package/dist/{chunk-IHTDLCDJ.cjs → chunk-GRHSQYD4.cjs} +17 -4
- package/dist/{chunk-W44X6IC2.cjs → chunk-HBLYSWIJ.cjs} +13 -9
- package/dist/chunk-HK4VJI27.cjs +76 -0
- package/dist/{chunk-EGIY4A7V.cjs → chunk-HKZVC5GP.cjs} +2 -2
- package/dist/{chunk-EYPSKXO4.mjs → chunk-HRQV5Q3J.mjs} +1 -1
- package/dist/{chunk-S7MWSFFP.cjs → chunk-IBEHVSU4.cjs} +2 -2
- package/dist/{chunk-77VNYVVX.mjs → chunk-IG4IQMIW.mjs} +1 -1
- package/dist/{chunk-N3XO5AL5.cjs → chunk-IJFNXP3D.cjs} +2 -2
- package/dist/{chunk-RFWWXEIF.mjs → chunk-IP2R2TAE.mjs} +1 -1
- package/dist/{chunk-FETMUBIA.mjs → chunk-IZ5WOTQP.mjs} +1 -1
- package/dist/{chunk-CSLHNBPS.cjs → chunk-J42QN7OC.cjs} +6 -6
- package/dist/{chunk-NDDRTFN4.mjs → chunk-J7EUGGTY.mjs} +2 -2
- package/dist/{chunk-5XFKWHZD.mjs → chunk-JI6N4W2I.mjs} +208 -136
- package/dist/{chunk-GJ7QVFAG.mjs → chunk-JOECBGY7.mjs} +1 -1
- package/dist/{chunk-CL52PD6D.cjs → chunk-JSUVQ5HG.cjs} +8 -8
- package/dist/{chunk-DZHTNSQ5.cjs → chunk-JWHRVBCZ.cjs} +14 -14
- package/dist/{chunk-OSMUE5ST.mjs → chunk-JZ43UD6S.mjs} +7 -7
- package/dist/{chunk-RLEALQEN.mjs → chunk-KIRIFO6T.mjs} +43 -5
- package/dist/{chunk-XGTFLG73.cjs → chunk-KMYOKQPP.cjs} +18 -11
- package/dist/{chunk-WX63N6C5.mjs → chunk-KNEYWPZV.mjs} +64 -27
- package/dist/{chunk-AYVGD3PK.mjs → chunk-KUMKBBYP.mjs} +1 -1
- package/dist/{chunk-VT25ERQK.mjs → chunk-KWUZJZ23.mjs} +21 -3
- package/dist/{chunk-NV26EGMC.mjs → chunk-LHFGTR7F.mjs} +2 -2
- package/dist/{chunk-4P5634G6.cjs → chunk-LIQJYEQP.cjs} +14 -9
- package/dist/chunk-LRPPXKCX.mjs +58 -0
- package/dist/chunk-LXTYJ2HW.mjs +139 -0
- package/dist/{chunk-O32QPFVV.cjs → chunk-MKQ27TGW.cjs} +5 -5
- package/dist/{chunk-KQAB5LML.mjs → chunk-MQ5HA7H2.mjs} +2 -2
- package/dist/{chunk-Z3GPAFIA.mjs → chunk-MUITBU5Z.mjs} +1 -1
- package/dist/chunk-NDOE76QC.cjs +58 -0
- package/dist/{chunk-EXN4DTVF.cjs → chunk-NET6PBUH.cjs} +2 -2
- package/dist/{chunk-YBY34UHB.mjs → chunk-NKETXVKP.mjs} +15 -2
- package/dist/chunk-NRWEY2CM.mjs +25 -0
- package/dist/chunk-NU5XLYRN.cjs +139 -0
- package/dist/{chunk-BE7AQXJB.cjs → chunk-NXGQIXR7.cjs} +507 -169
- package/dist/{chunk-C5AM2XDN.cjs → chunk-O2A6HE76.cjs} +4 -4
- package/dist/{chunk-OAEDVXVE.mjs → chunk-O6K4G7YA.mjs} +5 -2
- package/dist/{chunk-LXEJNWF5.mjs → chunk-OSKIG4OP.mjs} +2 -2
- package/dist/{chunk-3WG7GJQL.cjs → chunk-P3EZKU6L.cjs} +18 -18
- package/dist/{chunk-C2JOS77Z.cjs → chunk-PG6ZIHKE.cjs} +250 -51
- package/dist/{chunk-ET6WW3FY.cjs → chunk-Q3MVNRAO.cjs} +1305 -848
- package/dist/{chunk-AZ6IW6SF.mjs → chunk-Q4G52OSW.mjs} +1 -1
- package/dist/{chunk-TPYAYFMF.cjs → chunk-QL3YZTGZ.cjs} +2 -2
- package/dist/{chunk-JMFTKNBA.mjs → chunk-R4BWNP73.mjs} +2 -2
- package/dist/{chunk-J5ASGNKF.mjs → chunk-R6Q6VSGU.mjs} +24 -9
- package/dist/{chunk-B6RBJJ5G.mjs → chunk-RBRIKT6B.mjs} +15 -2
- package/dist/{chunk-C6CUUBY5.cjs → chunk-RHI67C2V.cjs} +5 -5
- package/dist/chunk-RK3YYUX6.cjs +114 -0
- package/dist/{chunk-Y2LU4LE5.mjs → chunk-ROPMQNCG.mjs} +2 -2
- package/dist/{chunk-QIXEU2WV.cjs → chunk-RQ4UZJPR.cjs} +3 -3
- package/dist/{chunk-ZDZUFD67.cjs → chunk-RSL3YFJG.cjs} +1 -1
- package/dist/{chunk-JWY66PID.cjs → chunk-S3D6SL2V.cjs} +9 -6
- package/dist/{chunk-4HGLJOXZ.cjs → chunk-TPDKFRQX.cjs} +11 -11
- package/dist/{chunk-E2V7RRFL.mjs → chunk-UHAARKF3.mjs} +2 -2
- package/dist/{chunk-QSTRBKHZ.mjs → chunk-UJWRXBVP.mjs} +2 -2
- package/dist/{chunk-7QCJDYZQ.cjs → chunk-V6T3UJAH.cjs} +7 -7
- package/dist/{chunk-AUAMXI6N.mjs → chunk-VFPFXMTF.mjs} +1 -1
- package/dist/{chunk-KPJYBSHL.mjs → chunk-VKLV7GF4.mjs} +221 -22
- package/dist/{chunk-TP4RAV7Y.cjs → chunk-VKRMO3EZ.cjs} +8 -8
- package/dist/chunk-VWIW47FW.cjs +25 -0
- package/dist/{chunk-L6E4SHUB.cjs → chunk-VZKCGHWC.cjs} +39 -24
- package/dist/{chunk-JWLRBDDC.cjs → chunk-WH3PBJS7.cjs} +2 -2
- package/dist/{chunk-BSXKZPFE.mjs → chunk-WS4SLJW5.mjs} +501 -206
- package/dist/{chunk-5OFNUETM.mjs → chunk-WTTJ2YS2.mjs} +9 -1
- package/dist/{chunk-RLFGKJQ6.mjs → chunk-X2KNHD4B.mjs} +14 -2
- package/dist/{chunk-5CFHQ7HM.mjs → chunk-XXKMAHYE.mjs} +1 -1
- package/dist/{chunk-MBCRWU3P.cjs → chunk-XZPI44Q7.cjs} +4 -4
- package/dist/{chunk-ACGBXN3U.cjs → chunk-Y4FEQBKY.cjs} +17 -9
- package/dist/{chunk-MWUDEYBI.mjs → chunk-YH33PZ3K.mjs} +1 -1
- package/dist/chunk-YQWRBBAA.mjs +284 -0
- package/dist/{chunk-QUYAGU65.mjs → chunk-YWDRWG4L.mjs} +1210 -753
- package/dist/{chunk-E46NXBNJ.mjs → chunk-ZD7JUTBY.mjs} +11 -6
- package/dist/{chunk-JDO346NV.mjs → chunk-ZLRWO5GK.mjs} +1 -1
- package/dist/{chunk-NAXKOTPP.cjs → chunk-ZRCGPSUM.cjs} +21 -21
- package/dist/{chunk-YCNHUIPR.cjs → chunk-ZZGANFQH.cjs} +10 -10
- package/dist/client/lifecycle.d.mts +1 -1
- package/dist/client/lifecycle.d.ts +1 -1
- package/dist/{client-component.d-9J7CkTWW.d.ts → client-component.d-DYOwmq0c.d.ts} +80 -3
- package/dist/{client-component.d-ciHeCxr-.d.mts → client-component.d-edV76QvU.d.mts} +80 -3
- package/dist/{client-plugins.d-CUOhfapO.d.ts → client-plugins.d-BmJYW2FY.d.ts} +20 -7
- package/dist/{client-plugins.d-JnRz5a1o.d.mts → client-plugins.d-DwvqqGsU.d.mts} +20 -7
- package/dist/client-plugins.d.mts +5 -5
- package/dist/client-plugins.d.ts +5 -5
- package/dist/client.cjs +6 -5
- package/dist/client.d.mts +12 -12
- package/dist/client.d.ts +12 -12
- package/dist/client.mjs +5 -4
- package/dist/config.d.mts +5 -5
- package/dist/config.d.ts +5 -5
- package/dist/cron.cjs +6 -2
- package/dist/cron.d.mts +11 -2
- package/dist/cron.d.ts +11 -2
- package/dist/cron.mjs +7 -3
- package/dist/desktop.d.mts +6 -6
- package/dist/desktop.d.ts +6 -6
- package/dist/{devtools-7JPQMSTQ.mjs → devtools-WPX62NG2.mjs} +10 -9
- package/dist/{devtools-IZFUYWPG.cjs → devtools-YMDS7PUA.cjs} +12 -11
- package/dist/docs.cjs +14 -13
- package/dist/docs.d.mts +6 -6
- package/dist/docs.d.ts +6 -6
- package/dist/docs.mjs +13 -12
- package/dist/{endpoint.d-BkMSCRf6.d.mts → endpoint.d-BXbBpKoh.d.mts} +42 -1
- package/dist/{endpoint.d-BgHn0lhl.d.ts → endpoint.d-Dx_1k6Du.d.ts} +42 -1
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/headers.cjs +3 -3
- package/dist/{headers.d-CqpTL_fZ.d.ts → headers.d-BIbQyAxJ.d.ts} +1 -1
- package/dist/{headers.d-rbbTKGaN.d.mts → headers.d-BtNxFc2s.d.mts} +1 -1
- package/dist/headers.mjs +2 -2
- package/dist/index.cjs +73 -60
- package/dist/{index.d-CMKvzHLW.d.ts → index.d-CQ_wUzOV.d.ts} +1 -1
- package/dist/{index.d-D_B2D9Il.d.mts → index.d-CQdDRXd1.d.mts} +1 -1
- package/dist/index.d.mts +63 -29
- package/dist/index.d.ts +63 -29
- package/dist/index.mjs +69 -56
- package/dist/integrations/orm.d.mts +5 -5
- package/dist/integrations/orm.d.ts +5 -5
- package/dist/integrations.cjs +4 -4
- package/dist/integrations.d.mts +5 -5
- package/dist/integrations.d.ts +5 -5
- package/dist/integrations.mjs +3 -3
- package/dist/internal/app-markdown-runtime.cjs +7 -3
- package/dist/internal/app-markdown-runtime.d.mts +18 -7
- package/dist/internal/app-markdown-runtime.d.ts +18 -7
- package/dist/internal/app-markdown-runtime.mjs +6 -2
- package/dist/internal/build-runtime.cjs +42 -40
- package/dist/internal/build-runtime.d.mts +7 -7
- package/dist/internal/build-runtime.d.ts +7 -7
- package/dist/internal/build-runtime.mjs +41 -39
- package/dist/internal/cli-runtime.cjs +21 -20
- package/dist/internal/cli-runtime.mjs +20 -19
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +6 -2
- package/dist/internal/client-runtime.d.mts +22 -10
- package/dist/internal/client-runtime.d.ts +22 -10
- package/dist/internal/client-runtime.mjs +5 -1
- package/dist/internal/compression-runtime.d.mts +5 -5
- package/dist/internal/compression-runtime.d.ts +5 -5
- package/dist/internal/config-runtime.cjs +12 -11
- package/dist/internal/config-runtime.d.mts +7 -7
- package/dist/internal/config-runtime.d.ts +7 -7
- package/dist/internal/config-runtime.mjs +11 -10
- package/dist/internal/form-actions.cjs +5 -4
- package/dist/internal/form-actions.d.mts +2 -2
- package/dist/internal/form-actions.d.ts +2 -2
- package/dist/internal/form-actions.mjs +4 -3
- package/dist/internal/infra-analytics-runtime.cjs +10 -10
- package/dist/internal/infra-analytics-runtime.mjs +8 -8
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +32 -22
- package/dist/internal/production-runtime.d.mts +65 -14
- package/dist/internal/production-runtime.d.ts +65 -14
- package/dist/internal/production-runtime.mjs +31 -21
- package/dist/internal/react-cache.cjs +3 -3
- package/dist/internal/react-cache.mjs +1 -1
- package/dist/internal/vercel-edge-middleware.cjs +4 -4
- package/dist/internal/vercel-edge-middleware.mjs +3 -3
- package/dist/{lifecycle.d-keQs5Swc.d.mts → lifecycle.d-OtGWAvJT.d.mts} +4 -0
- package/dist/{lifecycle.d-keQs5Swc.d.ts → lifecycle.d-OtGWAvJT.d.ts} +4 -0
- package/dist/{manager-JIA66YJ2.mjs → manager-RHB2P35B.mjs} +4 -1
- package/dist/{manager-JOHU6BQI.cjs → manager-S77ZARTC.cjs} +5 -2
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +5 -5
- package/dist/markdown.d.ts +5 -5
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.cjs +6 -6
- package/dist/middleware.d.mts +5 -5
- package/dist/middleware.d.ts +5 -5
- package/dist/middleware.mjs +5 -5
- package/dist/{mount.d-ImEO7q8a.d.mts → mount.d-6bhpBQQB.d.mts} +1 -1
- package/dist/{mount.d-B0XMxDRh.d.ts → mount.d-C-u7rFkM.d.ts} +1 -1
- package/dist/{native-server-fn-handler-EP5AFJYE.mjs → native-server-fn-handler-I66X4E5S.mjs} +6 -5
- package/dist/{native-server-fn-handler-QRTXGZA4.cjs → native-server-fn-handler-W4FSD76W.cjs} +7 -6
- package/dist/{native-tree-L2IIEBXH.mjs → native-tree-3X23BT3N.mjs} +2 -2
- package/dist/{native-tree-GF4BH33L.cjs → native-tree-TAPKR7QJ.cjs} +3 -3
- package/dist/{navigation-delegate.d-83Q7ksf7.d.mts → navigation-delegate.d-nx6gtsY4.d.mts} +1 -1
- package/dist/{navigation-delegate.d-RRx1CSlb.d.ts → navigation-delegate.d-xsG4T1x-.d.ts} +1 -1
- package/dist/navigation.cjs +4 -4
- package/dist/navigation.d.mts +8 -8
- package/dist/navigation.d.ts +8 -8
- package/dist/navigation.mjs +3 -3
- package/dist/{nitro-2LMOMIST.cjs → nitro-SSFTPZMW.cjs} +4 -4
- package/dist/{nitro-72TFIGGO.mjs → nitro-XTQ2HKDL.mjs} +1 -1
- package/dist/{observability.d-B2363jB6.d.ts → observability.d-DdJRiaIX.d.mts} +27 -3
- package/dist/{observability.d-B2363jB6.d.mts → observability.d-DdJRiaIX.d.ts} +27 -3
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/plugin.cjs +36 -33
- package/dist/plugin.d.mts +8 -8
- package/dist/plugin.d.ts +8 -8
- package/dist/plugin.mjs +35 -32
- package/dist/query/client.cjs +5 -5
- package/dist/query/client.mjs +1 -1
- package/dist/{render-plan.d-wP8nTeRV.d.mts → render-plan.d-B5y3h97B.d.mts} +1 -1
- package/dist/{render-plan.d-Ds2sXJ5m.d.ts → render-plan.d-gW0fwKz2.d.ts} +1 -1
- package/dist/renderer-client.cjs +4 -4
- package/dist/renderer-client.d.mts +8 -8
- package/dist/renderer-client.d.ts +8 -8
- package/dist/renderer-client.mjs +1 -1
- package/dist/request.cjs +2 -2
- package/dist/{request.d-zpSn6pu_.d.ts → request.d-B0ugAadD.d.ts} +9 -2
- package/dist/{request.d-F3h7K37m.d.mts → request.d-DLq33nYo.d.mts} +9 -2
- package/dist/request.d.mts +6 -6
- package/dist/request.d.ts +6 -6
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering.d-Mw0ZKG2e.d.mts → route-rendering.d-DSeIV7yV.d.mts} +1 -1
- package/dist/{route-rendering.d-BL0_AdKj.d.ts → route-rendering.d-ytaqDQD6.d.ts} +1 -1
- package/dist/{route.d-DrXkpvcg.d.mts → route.d-Cd4Fi6BA.d.ts} +3 -1
- package/dist/{route.d-hs-_cyHn.d.ts → route.d-ShmtqqVQ.d.mts} +3 -1
- package/dist/{router.d-BwXigemZ.d.ts → router.d-BaEAEGPg.d.ts} +1 -1
- package/dist/{router.d-NGVsU11T.d.mts → router.d-Chd5cpe3.d.mts} +1 -1
- package/dist/routes.cjs +5 -3
- package/dist/routes.d.mts +5 -5
- package/dist/routes.d.ts +5 -5
- package/dist/routes.mjs +4 -2
- package/dist/{rsc-pipeline-DHYZLWSF.mjs → rsc-pipeline-DPMYONEV.mjs} +12 -11
- package/dist/{rsc-pipeline-BNXYMG4G.cjs → rsc-pipeline-XIUUMMG5.cjs} +13 -12
- package/dist/{runtime-IWOT6ZVC.cjs → runtime-WD77S3C5.cjs} +25 -25
- package/dist/{runtime-XPYKUNL3.mjs → runtime-XIUJZTZ3.mjs} +16 -16
- package/dist/{runtime.d-BA3MzhXz.d.mts → runtime.d-DpCs0eAO.d.mts} +3 -3
- package/dist/{runtime.d-OBIZWpx1.d.ts → runtime.d-h2USyQsz.d.ts} +3 -3
- package/dist/server-action-security.cjs +5 -3
- package/dist/server-action-security.d.mts +11 -3
- package/dist/server-action-security.d.ts +11 -3
- package/dist/server-action-security.mjs +4 -2
- package/dist/server-fn-client.d.mts +3 -3
- package/dist/server-fn-client.d.ts +3 -3
- package/dist/server-fn.cjs +6 -5
- package/dist/server-fn.d.mts +1 -1
- package/dist/server-fn.d.ts +1 -1
- package/dist/server-fn.mjs +5 -4
- package/dist/server-plugins.cjs +4 -4
- package/dist/server-plugins.d.mts +54 -10
- package/dist/server-plugins.d.ts +54 -10
- package/dist/server-plugins.mjs +3 -3
- package/dist/server-query-client.d.mts +1 -1
- package/dist/server-query-client.d.ts +1 -1
- package/dist/server-query.cjs +7 -6
- package/dist/server-query.d.mts +1 -1
- package/dist/server-query.d.ts +1 -1
- package/dist/server-query.mjs +6 -5
- package/dist/server.cjs +65 -68
- package/dist/server.d.mts +15 -15
- package/dist/server.d.ts +15 -15
- package/dist/server.mjs +44 -47
- package/dist/{spa-router.d-BG2XzE5p.d.mts → spa-router.d-DCQVtEaE.d.mts} +11 -5
- package/dist/{spa-router.d-DrYT944-.d.ts → spa-router.d-DpdJHs1q.d.ts} +11 -5
- package/dist/testing.cjs +16 -14
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.mjs +12 -10
- package/dist/theme/server.cjs +3 -3
- package/dist/theme/server.mjs +2 -2
- package/dist/{utils.d-C1k9BJeD.d.mts → utils.d-DKDZtAY5.d.mts} +1 -1
- package/dist/{utils.d-DcF4wxey.d.ts → utils.d-DmicwMvS.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +38 -33
- package/dist/vite.d.mts +24 -10
- package/dist/vite.d.ts +24 -10
- package/dist/vite.mjs +37 -32
- package/package.json +1 -1
- package/dist/analyzer-UJG4MIZW.cjs +0 -16
- package/dist/chunk-6I4BFRE7.cjs +0 -51
- package/dist/chunk-EIVGPQN5.mjs +0 -51
- package/dist/chunk-V3UOEWCB.cjs +0 -46
- package/dist/chunk-VE3FWJBO.mjs +0 -46
- /package/dist/{chunk-QEJWNXRI.cjs → chunk-EMRYJG4U.cjs} +0 -0
- /package/dist/{chunk-TXE4SAMV.mjs → chunk-H2ZJ35NW.mjs} +0 -0
|
@@ -21,12 +21,123 @@ var _chunkE7QOEV5Zcjs = require('./chunk-E7QOEV5Z.cjs');
|
|
|
21
21
|
var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkRSL3YFJGcjs = require('./chunk-RSL3YFJG.cjs');
|
|
25
25
|
|
|
26
26
|
// src/environment-vite.ts
|
|
27
27
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
28
28
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
29
29
|
|
|
30
|
+
// src/diagnostics.ts
|
|
31
|
+
var _tracemapping = require('@jridgewell/trace-mapping');
|
|
32
|
+
|
|
33
|
+
var BOUNDARY_DOCS = "/docs/environment-functions#boundary-diagnostics";
|
|
34
|
+
var FARM_DIAGNOSTIC_RULES = {
|
|
35
|
+
CLIENT_SERVER_ENV: {
|
|
36
|
+
severity: "warning",
|
|
37
|
+
fix: "Read it on the server (a server function, API route, or server component), or declare it in env.public in farm.config.ts and read it through publicEnv.",
|
|
38
|
+
docs: BOUNDARY_DOCS
|
|
39
|
+
},
|
|
40
|
+
CLIENT_PROCESS_ENV_PUBLIC: {
|
|
41
|
+
severity: "warning",
|
|
42
|
+
fix: 'Read it through publicEnv from "@farm.js/core/env".',
|
|
43
|
+
docs: BOUNDARY_DOCS
|
|
44
|
+
},
|
|
45
|
+
CLIENT_NODE_BUILTIN: {
|
|
46
|
+
severity: "warning",
|
|
47
|
+
fix: "Move the import into server-only code, or import it lazily inside a function that runs only on the server.",
|
|
48
|
+
docs: BOUNDARY_DOCS
|
|
49
|
+
},
|
|
50
|
+
CLIENT_SERVER_FUNCTION: {
|
|
51
|
+
severity: "error",
|
|
52
|
+
fix: "Add @farm.js/plugin/rsc and set experimental.serverActions: true so client imports become server references, or call it from server code, or expose an API route and call it with createAPIClient.",
|
|
53
|
+
docs: BOUNDARY_DOCS
|
|
54
|
+
},
|
|
55
|
+
CLIENT_SERVER_ONLY_IMPORT: {
|
|
56
|
+
severity: "error",
|
|
57
|
+
fix: "Move what the client needs out of that module, or call it from a server component, server function, or API route.",
|
|
58
|
+
docs: BOUNDARY_DOCS
|
|
59
|
+
},
|
|
60
|
+
CLIENT_SERVER_ONLY_ENTRY: {
|
|
61
|
+
severity: "error",
|
|
62
|
+
fix: "Use it from an API route or another server module.",
|
|
63
|
+
docs: BOUNDARY_DOCS
|
|
64
|
+
},
|
|
65
|
+
CLIENT_ROUTES_FILE: {
|
|
66
|
+
severity: "error",
|
|
67
|
+
fix: "Import the component, server function, or helper from its own module instead of from the module that defines routes.",
|
|
68
|
+
docs: BOUNDARY_DOCS
|
|
69
|
+
},
|
|
70
|
+
CLIENT_ROUTE_SERVER_IMPORT: {
|
|
71
|
+
severity: "error",
|
|
72
|
+
fix: "Keep server-only imports in the routes file, or in modules only its guard, data, and API handlers use.",
|
|
73
|
+
docs: BOUNDARY_DOCS
|
|
74
|
+
},
|
|
75
|
+
SERVER_CLIENT_ONLY_IMPORT: {
|
|
76
|
+
severity: "error",
|
|
77
|
+
fix: 'Add "use client" to this module, or import the package from a "use client" module.',
|
|
78
|
+
docs: BOUNDARY_DOCS
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var FARM_DOCS_ORIGIN = "https://farmjs.dev";
|
|
82
|
+
function createFarmDiagnostic(code, file, message, location) {
|
|
83
|
+
const rule = FARM_DIAGNOSTIC_RULES[code];
|
|
84
|
+
return {
|
|
85
|
+
code,
|
|
86
|
+
severity: rule.severity,
|
|
87
|
+
file: file.split("?", 1)[0].replace(/\\/g, "/"),
|
|
88
|
+
...location,
|
|
89
|
+
message,
|
|
90
|
+
fix: rule.fix,
|
|
91
|
+
docs: FARM_DOCS_ORIGIN + rule.docs
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function formatFarmDiagnostic(diagnostic, root) {
|
|
95
|
+
let file = diagnostic.file;
|
|
96
|
+
if (root) {
|
|
97
|
+
const relative = _path2.default.relative(root, file).replace(/\\/g, "/");
|
|
98
|
+
if (relative && !relative.startsWith("../") && !_path2.default.isAbsolute(relative)) file = relative;
|
|
99
|
+
}
|
|
100
|
+
const position = diagnostic.line === void 0 ? "" : `:${diagnostic.line}:${_nullishCoalesce(diagnostic.column, () => ( 1))}`;
|
|
101
|
+
return [
|
|
102
|
+
`${file}${position} - ${diagnostic.severity} ${diagnostic.code}: ${diagnostic.message}`,
|
|
103
|
+
` fix: ${diagnostic.fix}`,
|
|
104
|
+
` docs: ${diagnostic.docs}`
|
|
105
|
+
].join("\n");
|
|
106
|
+
}
|
|
107
|
+
function createFarmSourceLocator(code, getCombinedSourcemap) {
|
|
108
|
+
let trace2;
|
|
109
|
+
let lineStarts;
|
|
110
|
+
return (offset) => {
|
|
111
|
+
if (trace2 === void 0) {
|
|
112
|
+
try {
|
|
113
|
+
const map = getCombinedSourcemap();
|
|
114
|
+
trace2 = map ? new (0, _tracemapping.TraceMap)(map) : null;
|
|
115
|
+
} catch (e) {
|
|
116
|
+
trace2 = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (!trace2) return void 0;
|
|
120
|
+
if (!lineStarts) {
|
|
121
|
+
lineStarts = [0];
|
|
122
|
+
for (let index = code.indexOf("\n"); index !== -1; index = code.indexOf("\n", index + 1)) {
|
|
123
|
+
lineStarts.push(index + 1);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
let low = 0;
|
|
127
|
+
let high = lineStarts.length - 1;
|
|
128
|
+
while (low < high) {
|
|
129
|
+
const middle = low + high + 1 >> 1;
|
|
130
|
+
if (lineStarts[middle] <= offset) low = middle;
|
|
131
|
+
else high = middle - 1;
|
|
132
|
+
}
|
|
133
|
+
const original = _tracemapping.originalPositionFor.call(void 0, trace2, {
|
|
134
|
+
line: low + 1,
|
|
135
|
+
column: offset - lineStarts[low]
|
|
136
|
+
});
|
|
137
|
+
return original.line === null ? void 0 : { line: original.line, column: (_nullishCoalesce(original.column, () => ( 0))) + 1 };
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
30
141
|
// src/islands-react-server-exports.ts
|
|
31
142
|
|
|
32
143
|
|
|
@@ -34,19 +145,29 @@ var _parseAst = require('rolldown/parseAst');
|
|
|
34
145
|
|
|
35
146
|
// src/utils/source-snapshot.ts
|
|
36
147
|
|
|
148
|
+
|
|
37
149
|
var snapshot;
|
|
150
|
+
var base;
|
|
38
151
|
var volatile;
|
|
39
152
|
var trace;
|
|
40
|
-
function
|
|
153
|
+
function farmSourceSnapshotPathKey(file, paths = _path2.default) {
|
|
154
|
+
return paths.resolve(file);
|
|
155
|
+
}
|
|
156
|
+
function getFarmSourceStamp(file) {
|
|
41
157
|
try {
|
|
42
158
|
const stat = _fs2.default.statSync(file);
|
|
43
159
|
return `${stat.mtimeMs}:${stat.size}`;
|
|
44
|
-
} catch (
|
|
160
|
+
} catch (e2) {
|
|
45
161
|
return "missing";
|
|
46
162
|
}
|
|
47
163
|
}
|
|
48
164
|
var FarmSourceSnapshotStore = class {
|
|
49
|
-
|
|
165
|
+
/**
|
|
166
|
+
* `tracked: false` keeps entries for a process that edits no sources while it runs, a production
|
|
167
|
+
* build: nothing is stamped, so each plan does not stat every file the snapshot holds.
|
|
168
|
+
*/
|
|
169
|
+
constructor(tracked = true) {
|
|
170
|
+
this.tracked = tracked;
|
|
50
171
|
this.entries = /* @__PURE__ */ new Map();
|
|
51
172
|
this.stamps = /* @__PURE__ */ new Map();
|
|
52
173
|
}
|
|
@@ -59,7 +180,7 @@ var FarmSourceSnapshotStore = class {
|
|
|
59
180
|
const changed = /* @__PURE__ */ new Map();
|
|
60
181
|
for (const file of edited) changed.set(file, void 0);
|
|
61
182
|
for (const [file, stamp] of this.stamps) {
|
|
62
|
-
if (
|
|
183
|
+
if (getFarmSourceStamp(file) !== stamp) changed.set(file, void 0);
|
|
63
184
|
}
|
|
64
185
|
if (changed.size === 0) return changed;
|
|
65
186
|
const replaced = /* @__PURE__ */ new Set();
|
|
@@ -85,10 +206,11 @@ var FarmSourceSnapshotStore = class {
|
|
|
85
206
|
}
|
|
86
207
|
/** Records the stamp of every file an entry read that has none yet. */
|
|
87
208
|
stamp() {
|
|
209
|
+
if (!this.tracked) return;
|
|
88
210
|
for (const entries of this.entries.values()) {
|
|
89
211
|
for (const entry of entries.values()) {
|
|
90
212
|
for (const file of entry.files) {
|
|
91
|
-
if (!this.stamps.has(file)) this.stamps.set(file,
|
|
213
|
+
if (!this.stamps.has(file)) this.stamps.set(file, getFarmSourceStamp(file));
|
|
92
214
|
}
|
|
93
215
|
}
|
|
94
216
|
}
|
|
@@ -112,22 +234,31 @@ function withFarmSourceSnapshot(operation, store) {
|
|
|
112
234
|
_optionalChain([store, 'optionalAccess', _12 => _12.stamp, 'call', _13 => _13()]);
|
|
113
235
|
}
|
|
114
236
|
}
|
|
237
|
+
function withFarmSourceSnapshotOf(store, operation) {
|
|
238
|
+
if (snapshot) return operation();
|
|
239
|
+
base = store.entries;
|
|
240
|
+
try {
|
|
241
|
+
return withFarmSourceSnapshot(operation);
|
|
242
|
+
} finally {
|
|
243
|
+
base = void 0;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
115
246
|
function memoizeInFarmSourceSnapshot(scope, key, compute, lasting) {
|
|
116
247
|
if (!snapshot) return compute();
|
|
117
248
|
let entries = snapshot.get(scope);
|
|
118
249
|
if (!entries) snapshot.set(scope, entries = /* @__PURE__ */ new Map());
|
|
119
|
-
const memoized = entries.get(key);
|
|
250
|
+
const memoized = _nullishCoalesce(entries.get(key), () => ( _optionalChain([base, 'optionalAccess', _14 => _14.get, 'call', _15 => _15(scope), 'optionalAccess', _16 => _16.get, 'call', _17 => _17(key)])));
|
|
120
251
|
if (memoized) {
|
|
121
252
|
if (trace) for (const file of memoized.files) trace.add(file);
|
|
122
253
|
return memoized.value;
|
|
123
254
|
}
|
|
124
255
|
const { result, files } = traceFarmSourceReads(compute);
|
|
125
256
|
entries.set(key, { value: result, files });
|
|
126
|
-
if (lasting && !lasting(result)) _optionalChain([volatile, 'optionalAccess',
|
|
257
|
+
if (lasting && !lasting(result)) _optionalChain([volatile, 'optionalAccess', _18 => _18.push, 'call', _19 => _19([scope, key])]);
|
|
127
258
|
return result;
|
|
128
259
|
}
|
|
129
260
|
function noteFarmSourceRead(file) {
|
|
130
|
-
_optionalChain([trace, 'optionalAccess',
|
|
261
|
+
_optionalChain([trace, 'optionalAccess', _20 => _20.add, 'call', _21 => _21(file)]);
|
|
131
262
|
}
|
|
132
263
|
function traceFarmSourceReads(operation) {
|
|
133
264
|
const outer = trace;
|
|
@@ -233,7 +364,7 @@ function resolveFarmReactServerExport(importer, specifier) {
|
|
|
233
364
|
const file = _path2.default.resolve(directory, server);
|
|
234
365
|
if (_fs2.default.existsSync(file)) resolved = file;
|
|
235
366
|
}
|
|
236
|
-
} catch (
|
|
367
|
+
} catch (e3) {
|
|
237
368
|
resolved = null;
|
|
238
369
|
}
|
|
239
370
|
cache.set(key, resolved);
|
|
@@ -244,7 +375,7 @@ function readModule(file) {
|
|
|
244
375
|
let stat;
|
|
245
376
|
try {
|
|
246
377
|
stat = _fs2.default.statSync(file);
|
|
247
|
-
} catch (
|
|
378
|
+
} catch (e4) {
|
|
248
379
|
return null;
|
|
249
380
|
}
|
|
250
381
|
noteFarmSourceRead(file);
|
|
@@ -256,7 +387,7 @@ function readModule(file) {
|
|
|
256
387
|
const extension = _path2.default.extname(file).slice(1);
|
|
257
388
|
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
|
|
258
389
|
program = _parseAst.parseAst.call(void 0, code, { lang });
|
|
259
|
-
} catch (
|
|
390
|
+
} catch (e5) {
|
|
260
391
|
program = null;
|
|
261
392
|
}
|
|
262
393
|
parsedModules.set(file, { size: stat.size, mtimeMs: stat.mtimeMs, program });
|
|
@@ -270,19 +401,19 @@ function isClientModule(program) {
|
|
|
270
401
|
return false;
|
|
271
402
|
}
|
|
272
403
|
function resolveRelative(from, specifier) {
|
|
273
|
-
const
|
|
404
|
+
const base2 = _path2.default.resolve(_path2.default.dirname(from), specifier);
|
|
274
405
|
for (const extension of SCRIPT_EXTENSIONS) {
|
|
275
|
-
const file = `${
|
|
406
|
+
const file = `${base2}${extension}`;
|
|
276
407
|
if (_fs2.default.existsSync(file) && _fs2.default.statSync(file).isFile()) return file;
|
|
277
408
|
}
|
|
278
409
|
for (const index of INDEX_FILES) {
|
|
279
|
-
const file = _path2.default.join(
|
|
410
|
+
const file = _path2.default.join(base2, index);
|
|
280
411
|
if (_fs2.default.existsSync(file)) return file;
|
|
281
412
|
}
|
|
282
413
|
return null;
|
|
283
414
|
}
|
|
284
415
|
function exportedName(node) {
|
|
285
|
-
return _optionalChain([node, 'optionalAccess',
|
|
416
|
+
return _optionalChain([node, 'optionalAccess', _22 => _22.type]) === "Identifier" ? node.name : _optionalChain([node, 'optionalAccess', _23 => _23.value]);
|
|
286
417
|
}
|
|
287
418
|
function resolveFarmPackageDefaultEntry(importer, specifier, conditions = ["browser", ...DEFAULT_CONDITIONS]) {
|
|
288
419
|
const parsed = packageNameOf(specifier);
|
|
@@ -296,7 +427,7 @@ function resolveFarmPackageDefaultEntry(importer, specifier, conditions = ["brow
|
|
|
296
427
|
_path2.default.join(directory, "package.json"),
|
|
297
428
|
`./${String(target).replace(/^\.\//, "")}`
|
|
298
429
|
);
|
|
299
|
-
} catch (
|
|
430
|
+
} catch (e6) {
|
|
300
431
|
return null;
|
|
301
432
|
}
|
|
302
433
|
}
|
|
@@ -319,7 +450,7 @@ function traceExport(file, name, depth) {
|
|
|
319
450
|
};
|
|
320
451
|
const imports = /* @__PURE__ */ new Map();
|
|
321
452
|
for (const node of _nullishCoalesce(program.body, () => ( []))) {
|
|
322
|
-
if (node.type !== "ImportDeclaration" || typeof _optionalChain([node, 'access',
|
|
453
|
+
if (node.type !== "ImportDeclaration" || typeof _optionalChain([node, 'access', _24 => _24.source, 'optionalAccess', _25 => _25.value]) !== "string") continue;
|
|
323
454
|
for (const specifier of _nullishCoalesce(node.specifiers, () => ( []))) {
|
|
324
455
|
if (specifier.type === "ImportNamespaceSpecifier") continue;
|
|
325
456
|
const imported = specifier.type === "ImportDefaultSpecifier" ? "default" : _nullishCoalesce(exportedName(specifier.imported), () => ( specifier.local.name));
|
|
@@ -347,13 +478,13 @@ function traceExport(file, name, depth) {
|
|
|
347
478
|
}
|
|
348
479
|
}
|
|
349
480
|
const declared = [
|
|
350
|
-
..._optionalChain([node, 'access',
|
|
351
|
-
...(_nullishCoalesce(_optionalChain([node, 'access',
|
|
481
|
+
..._optionalChain([node, 'access', _26 => _26.declaration, 'optionalAccess', _27 => _27.id]) ? [node.declaration.id.name] : [],
|
|
482
|
+
...(_nullishCoalesce(_optionalChain([node, 'access', _28 => _28.declaration, 'optionalAccess', _29 => _29.declarations]), () => ( []))).map((declarator) => _optionalChain([declarator, 'access', _30 => _30.id, 'optionalAccess', _31 => _31.name]))
|
|
352
483
|
];
|
|
353
484
|
if (declared.includes(name)) return here(client ? "client" : "server");
|
|
354
485
|
} else if (node.type === "ExportDefaultDeclaration" && name === "default") {
|
|
355
486
|
return own(
|
|
356
|
-
() => _optionalChain([node, 'access',
|
|
487
|
+
() => _optionalChain([node, 'access', _32 => _32.declaration, 'optionalAccess', _33 => _33.type]) === "Identifier" ? local(node.declaration.name) : here("server")
|
|
357
488
|
);
|
|
358
489
|
}
|
|
359
490
|
}
|
|
@@ -364,7 +495,7 @@ function traceExport(file, name, depth) {
|
|
|
364
495
|
return void 0;
|
|
365
496
|
}
|
|
366
497
|
function traceFarmExport(file, name) {
|
|
367
|
-
return _optionalChain([traceExport, 'call',
|
|
498
|
+
return _optionalChain([traceExport, 'call', _34 => _34(file, name, 0), 'optionalAccess', _35 => _35.kind]);
|
|
368
499
|
}
|
|
369
500
|
function isFarmClientExport(file, name) {
|
|
370
501
|
return traceFarmExport(file, name) === "client";
|
|
@@ -372,7 +503,7 @@ function isFarmClientExport(file, name) {
|
|
|
372
503
|
function isFarmPackageClientExport(importer, specifier, name) {
|
|
373
504
|
return memoizeInFarmSourceSnapshot(
|
|
374
505
|
"package-client-export",
|
|
375
|
-
`${_path2.default.dirname(importer)}\0${specifier}\0${name}`,
|
|
506
|
+
`${farmSourceSnapshotPathKey(_path2.default.dirname(importer))}\0${specifier}\0${name}`,
|
|
376
507
|
() => {
|
|
377
508
|
const entry = resolveFarmPackageDefaultEntry(importer, specifier);
|
|
378
509
|
return !entry || traceFarmExport(entry, name) !== "server";
|
|
@@ -382,11 +513,13 @@ function isFarmPackageClientExport(importer, specifier, name) {
|
|
|
382
513
|
function parseCode(code, file) {
|
|
383
514
|
const extension = _path2.default.extname(file).slice(1);
|
|
384
515
|
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
516
|
+
return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
|
|
517
|
+
try {
|
|
518
|
+
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
519
|
+
} catch (e7) {
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
});
|
|
390
523
|
}
|
|
391
524
|
function namespaceMembers(program, local) {
|
|
392
525
|
const members = /* @__PURE__ */ new Set();
|
|
@@ -399,8 +532,8 @@ function namespaceMembers(program, local) {
|
|
|
399
532
|
}
|
|
400
533
|
const current = node;
|
|
401
534
|
if (typeof current.type !== "string") return;
|
|
402
|
-
if ((current.type === "Identifier" || current.type === "JSXIdentifier") && current.name === local && _optionalChain([parent, 'optionalAccess',
|
|
403
|
-
const property = (_optionalChain([parent, 'optionalAccess',
|
|
535
|
+
if ((current.type === "Identifier" || current.type === "JSXIdentifier") && current.name === local && _optionalChain([parent, 'optionalAccess', _36 => _36.type]) !== "ImportNamespaceSpecifier") {
|
|
536
|
+
const property = (_optionalChain([parent, 'optionalAccess', _37 => _37.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _38 => _38.type]) === "JSXMemberExpression") && parent.object === current && !parent.computed ? _optionalChain([parent, 'access', _39 => _39.property, 'optionalAccess', _40 => _40.name]) : void 0;
|
|
404
537
|
if (property) members.add(property);
|
|
405
538
|
else opaque = true;
|
|
406
539
|
return;
|
|
@@ -417,7 +550,7 @@ function findPackageImports(program, accept) {
|
|
|
417
550
|
const found = [];
|
|
418
551
|
for (const node of _nullishCoalesce(program.body, () => ( []))) {
|
|
419
552
|
if (node.type !== "ImportDeclaration" || node.importKind === "type") continue;
|
|
420
|
-
const specifier = _optionalChain([node, 'access',
|
|
553
|
+
const specifier = _optionalChain([node, 'access', _41 => _41.source, 'optionalAccess', _42 => _42.value]);
|
|
421
554
|
if (typeof specifier !== "string" || !accept(specifier)) continue;
|
|
422
555
|
const specifiers = (_nullishCoalesce(node.specifiers, () => ( []))).filter(
|
|
423
556
|
(entry2) => entry2.importKind !== "type"
|
|
@@ -456,7 +589,7 @@ function findFarmReactServerClientNames(code, file, specifier) {
|
|
|
456
589
|
const wanted = [
|
|
457
590
|
...entry.defaultLocal ? ["default"] : [],
|
|
458
591
|
...entry.named.map((binding) => binding.imported),
|
|
459
|
-
..._nullishCoalesce(_optionalChain([entry, 'access',
|
|
592
|
+
..._nullishCoalesce(_optionalChain([entry, 'access', _43 => _43.namespace, 'optionalAccess', _44 => _44.members]), () => ( []))
|
|
460
593
|
];
|
|
461
594
|
for (const name of wanted) if (isFarmClientExport(target, name)) names.add(name);
|
|
462
595
|
}
|
|
@@ -464,7 +597,7 @@ function findFarmReactServerClientNames(code, file, specifier) {
|
|
|
464
597
|
}
|
|
465
598
|
function clientModuleSource(node) {
|
|
466
599
|
if (node.importKind === "type" || node.exportKind === "type") return null;
|
|
467
|
-
const source = (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" && node.source) && _optionalChain([node, 'access',
|
|
600
|
+
const source = (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" && node.source) && _optionalChain([node, 'access', _45 => _45.source, 'optionalAccess', _46 => _46.value]);
|
|
468
601
|
return typeof source === "string" && source.startsWith(".") ? source : null;
|
|
469
602
|
}
|
|
470
603
|
function isClientModuleFile(file) {
|
|
@@ -484,8 +617,8 @@ function findFarmReactServerClientModules(code, file, specifier) {
|
|
|
484
617
|
const module = readModule(current);
|
|
485
618
|
if (!module || isClientModule(module)) return;
|
|
486
619
|
for (const node of _nullishCoalesce(module.body, () => ( []))) {
|
|
487
|
-
const source = _nullishCoalesce(clientModuleSource(node), () => ( (node.type === "ExportAllDeclaration" && typeof _optionalChain([node, 'access',
|
|
488
|
-
if (!_optionalChain([source, 'optionalAccess',
|
|
620
|
+
const source = _nullishCoalesce(clientModuleSource(node), () => ( (node.type === "ExportAllDeclaration" && typeof _optionalChain([node, 'access', _47 => _47.source, 'optionalAccess', _48 => _48.value]) === "string" ? node.source.value : null)));
|
|
621
|
+
if (!_optionalChain([source, 'optionalAccess', _49 => _49.startsWith, 'call', _50 => _50(".")])) continue;
|
|
489
622
|
const child = resolveRelative(current, source);
|
|
490
623
|
if (!child) continue;
|
|
491
624
|
if (isClientModuleFile(child)) {
|
|
@@ -497,11 +630,11 @@ function findFarmReactServerClientModules(code, file, specifier) {
|
|
|
497
630
|
const wanted = [
|
|
498
631
|
...entry.defaultLocal ? ["default"] : [],
|
|
499
632
|
...entry.named.map((binding) => binding.imported),
|
|
500
|
-
..._nullishCoalesce(_optionalChain([entry, 'access',
|
|
633
|
+
..._nullishCoalesce(_optionalChain([entry, 'access', _51 => _51.namespace, 'optionalAccess', _52 => _52.members]), () => ( []))
|
|
501
634
|
];
|
|
502
635
|
for (const name of wanted) {
|
|
503
636
|
const traced = traceExport(target, name, 0);
|
|
504
|
-
if (_optionalChain([traced, 'optionalAccess',
|
|
637
|
+
if (_optionalChain([traced, 'optionalAccess', _53 => _53.kind]) === "server") walk2(traced.file, 0);
|
|
505
638
|
}
|
|
506
639
|
}
|
|
507
640
|
return [...found].sort();
|
|
@@ -541,7 +674,7 @@ function rewriteFarmReactServerImports(options) {
|
|
|
541
674
|
let next = 0;
|
|
542
675
|
for (const entry of [...imports].sort((left, right) => right.start - left.start)) {
|
|
543
676
|
const target = targets.get(entry.specifier);
|
|
544
|
-
_optionalChain([options, 'access',
|
|
677
|
+
_optionalChain([options, 'access', _54 => _54.onServerFile, 'optionalCall', _55 => _55(target)]);
|
|
545
678
|
const server = JSON.stringify(target);
|
|
546
679
|
const lines = [];
|
|
547
680
|
const bind = (name, local) => {
|
|
@@ -578,7 +711,7 @@ function staticImportSources(program) {
|
|
|
578
711
|
continue;
|
|
579
712
|
}
|
|
580
713
|
if (node.importKind === "type" || node.exportKind === "type") continue;
|
|
581
|
-
if (typeof _optionalChain([node, 'access',
|
|
714
|
+
if (typeof _optionalChain([node, 'access', _56 => _56.source, 'optionalAccess', _57 => _57.value]) === "string") sources.push(node.source.value);
|
|
582
715
|
}
|
|
583
716
|
return sources;
|
|
584
717
|
}
|
|
@@ -625,7 +758,7 @@ function farmRelativeImportFiles(code, file) {
|
|
|
625
758
|
if (!program) return [];
|
|
626
759
|
const files = [];
|
|
627
760
|
for (const node of _nullishCoalesce(program.body, () => ( []))) {
|
|
628
|
-
const source = (node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration" && node.source) && _optionalChain([node, 'access',
|
|
761
|
+
const source = (node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration" && node.source) && _optionalChain([node, 'access', _58 => _58.source, 'optionalAccess', _59 => _59.value]);
|
|
629
762
|
if (typeof source !== "string" || !source.startsWith(".")) continue;
|
|
630
763
|
const resolved = resolveRelative(file, source);
|
|
631
764
|
if (resolved) files.push(resolved);
|
|
@@ -643,7 +776,7 @@ function farmReactServerBuildReachesClientModules(importer, specifier, serverImp
|
|
|
643
776
|
if (!program) return false;
|
|
644
777
|
if (depth > 0 && isClientModule(program)) return true;
|
|
645
778
|
for (const node of _nullishCoalesce(program.body, () => ( []))) {
|
|
646
|
-
const source = (node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration" && node.source || node.type === "ImportDeclaration") && _optionalChain([node, 'access',
|
|
779
|
+
const source = (node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration" && node.source || node.type === "ImportDeclaration") && _optionalChain([node, 'access', _60 => _60.source, 'optionalAccess', _61 => _61.value]);
|
|
647
780
|
if (typeof source !== "string" || !source.startsWith(".")) continue;
|
|
648
781
|
const child = resolveRelative(file, source);
|
|
649
782
|
if (child && reaches(child, depth + 1)) return true;
|
|
@@ -667,7 +800,7 @@ function scanPackage(directory) {
|
|
|
667
800
|
let entries;
|
|
668
801
|
try {
|
|
669
802
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
670
|
-
} catch (
|
|
803
|
+
} catch (e8) {
|
|
671
804
|
continue;
|
|
672
805
|
}
|
|
673
806
|
for (const entry of entries) {
|
|
@@ -678,7 +811,7 @@ function scanPackage(directory) {
|
|
|
678
811
|
let code;
|
|
679
812
|
try {
|
|
680
813
|
code = _fs2.default.readFileSync(file, "utf8");
|
|
681
|
-
} catch (
|
|
814
|
+
} catch (e9) {
|
|
682
815
|
continue;
|
|
683
816
|
}
|
|
684
817
|
for (const match of code.matchAll(IMPORT_SPECIFIER)) scan.imports.add(match[1]);
|
|
@@ -701,7 +834,7 @@ function findFarmServerBundledPackage(importer, specifier) {
|
|
|
701
834
|
if (manifest.exports === void 0 && manifest.type !== "module" && typeof manifest.module === "string" && typeof manifest.main === "string" && _path2.default.resolve(directory, manifest.main) !== _path2.default.resolve(directory, manifest.module)) {
|
|
702
835
|
return { name: parsed.name, prebundle: isSelfContainedPackage(manifest, importer) };
|
|
703
836
|
}
|
|
704
|
-
} catch (
|
|
837
|
+
} catch (e10) {
|
|
705
838
|
return null;
|
|
706
839
|
}
|
|
707
840
|
return scanPackage(directory).stylesheets ? { name: parsed.name, prebundle: false } : null;
|
|
@@ -709,7 +842,7 @@ function findFarmServerBundledPackage(importer, specifier) {
|
|
|
709
842
|
function isSelfContainedPackage(manifest, importer) {
|
|
710
843
|
if (Object.keys(_nullishCoalesce(manifest.dependencies, () => ( {}))).length > 0) return false;
|
|
711
844
|
return Object.keys(_nullishCoalesce(manifest.peerDependencies, () => ( {}))).every(
|
|
712
|
-
(peer) => _optionalChain([manifest, 'access',
|
|
845
|
+
(peer) => _optionalChain([manifest, 'access', _62 => _62.peerDependenciesMeta, 'optionalAccess', _63 => _63[peer], 'optionalAccess', _64 => _64.optional]) === true || findPackageDirectory(importer, peer) !== null
|
|
713
846
|
);
|
|
714
847
|
}
|
|
715
848
|
function findFarmPackageManifest(importer, specifier) {
|
|
@@ -721,11 +854,11 @@ function findFarmPackageManifest(importer, specifier) {
|
|
|
721
854
|
try {
|
|
722
855
|
const manifest = JSON.parse(_fs2.default.readFileSync(_path2.default.join(directory, "package.json"), "utf8"));
|
|
723
856
|
names = new Set(Object.keys(_nullishCoalesce(manifest.dependencies, () => ( {}))));
|
|
724
|
-
} catch (
|
|
857
|
+
} catch (e11) {
|
|
725
858
|
return null;
|
|
726
859
|
}
|
|
727
860
|
const dependencies = [...scanPackage(directory).imports].filter((imported) => {
|
|
728
|
-
const name = _optionalChain([packageNameOf, 'call',
|
|
861
|
+
const name = _optionalChain([packageNameOf, 'call', _65 => _65(imported), 'optionalAccess', _66 => _66.name]);
|
|
729
862
|
return name !== void 0 && names.has(name);
|
|
730
863
|
});
|
|
731
864
|
return { name: parsed.name, dependencies: dependencies.sort() };
|
|
@@ -758,9 +891,9 @@ function listFarmModuleExports(entry) {
|
|
|
758
891
|
const name = exportedName(specifier.exported);
|
|
759
892
|
if (name) names.add(name);
|
|
760
893
|
}
|
|
761
|
-
if (_optionalChain([node, 'access',
|
|
762
|
-
for (const declarator of _nullishCoalesce(_optionalChain([node, 'access',
|
|
763
|
-
if (_optionalChain([declarator, 'access',
|
|
894
|
+
if (_optionalChain([node, 'access', _67 => _67.declaration, 'optionalAccess', _68 => _68.id, 'optionalAccess', _69 => _69.name])) names.add(node.declaration.id.name);
|
|
895
|
+
for (const declarator of _nullishCoalesce(_optionalChain([node, 'access', _70 => _70.declaration, 'optionalAccess', _71 => _71.declarations]), () => ( []))) {
|
|
896
|
+
if (_optionalChain([declarator, 'access', _72 => _72.id, 'optionalAccess', _73 => _73.type]) === "Identifier") names.add(declarator.id.name);
|
|
764
897
|
}
|
|
765
898
|
} else if (node.type === "ExportDefaultDeclaration") {
|
|
766
899
|
esm = true;
|
|
@@ -852,7 +985,7 @@ function resolveProgrammaticClientRoutes(options) {
|
|
|
852
985
|
const definedIn = /* @__PURE__ */ new Map();
|
|
853
986
|
for (const route of definitions) {
|
|
854
987
|
const source = _chunkE7QOEV5Zcjs.getProgrammaticRouteDefinitionSource.call(void 0, route);
|
|
855
|
-
const callers = (_nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
988
|
+
const callers = (_nullishCoalesce(_optionalChain([source, 'optionalAccess', _74 => _74.stacks]), () => ( []))).map((stack) => findRouteCallers(stack, modulesByFile));
|
|
856
989
|
for (const caller of callers.flat()) caller.routeSource = true;
|
|
857
990
|
definedIn.set(route, callers.flat());
|
|
858
991
|
if (!source || source.raw || (_nullishCoalesce(callers[0], () => ( []))).length === 0) untraced = true;
|
|
@@ -949,7 +1082,7 @@ function resolveProgrammaticClientRoutes(options) {
|
|
|
949
1082
|
return { routes, routeSourceFiles };
|
|
950
1083
|
}
|
|
951
1084
|
function createEvaluatedRouteGraph(server) {
|
|
952
|
-
const evaluated = _optionalChain([server, 'access',
|
|
1085
|
+
const evaluated = _optionalChain([server, 'access', _75 => _75.environments, 'optionalAccess', _76 => _76.ssr, 'optionalAccess', _77 => _77.runner, 'optionalAccess', _78 => _78.evaluatedModules]);
|
|
953
1086
|
if (!evaluated) return void 0;
|
|
954
1087
|
const toGraphModule = (node) => ({
|
|
955
1088
|
id: node.id,
|
|
@@ -1073,7 +1206,7 @@ function isNodeBuiltinId(id) {
|
|
|
1073
1206
|
return bare.startsWith("node:") || NODE_BUILTINS.has(bare);
|
|
1074
1207
|
}
|
|
1075
1208
|
function isProgrammaticRouteActionProxy(code) {
|
|
1076
|
-
return Boolean(_optionalChain([code, 'optionalAccess',
|
|
1209
|
+
return Boolean(_optionalChain([code, 'optionalAccess', _79 => _79.includes, 'call', _80 => _80("__farmRouteActionTarget: true")]));
|
|
1077
1210
|
}
|
|
1078
1211
|
function collectGraph(graph, routesFile) {
|
|
1079
1212
|
const modules = /* @__PURE__ */ new Map();
|
|
@@ -1167,7 +1300,7 @@ function holdsRouteDefinition(value, definitions) {
|
|
|
1167
1300
|
if (descriptor && "value" in descriptor) next(descriptor.value);
|
|
1168
1301
|
}
|
|
1169
1302
|
}
|
|
1170
|
-
} catch (
|
|
1303
|
+
} catch (e12) {
|
|
1171
1304
|
}
|
|
1172
1305
|
}
|
|
1173
1306
|
return false;
|
|
@@ -1260,7 +1393,7 @@ function readJsonString(text) {
|
|
|
1260
1393
|
try {
|
|
1261
1394
|
const value = JSON.parse(text);
|
|
1262
1395
|
return typeof value === "string" ? value : void 0;
|
|
1263
|
-
} catch (
|
|
1396
|
+
} catch (e13) {
|
|
1264
1397
|
return void 0;
|
|
1265
1398
|
}
|
|
1266
1399
|
}
|
|
@@ -1268,7 +1401,7 @@ function readJsonArray(text) {
|
|
|
1268
1401
|
try {
|
|
1269
1402
|
const value = JSON.parse(text);
|
|
1270
1403
|
return Array.isArray(value) ? value : void 0;
|
|
1271
|
-
} catch (
|
|
1404
|
+
} catch (e14) {
|
|
1272
1405
|
return void 0;
|
|
1273
1406
|
}
|
|
1274
1407
|
}
|
|
@@ -1278,13 +1411,13 @@ function readExports(namespace) {
|
|
|
1278
1411
|
let keys;
|
|
1279
1412
|
try {
|
|
1280
1413
|
keys = Object.keys(namespace);
|
|
1281
|
-
} catch (
|
|
1414
|
+
} catch (e15) {
|
|
1282
1415
|
return [];
|
|
1283
1416
|
}
|
|
1284
1417
|
for (const key of keys) {
|
|
1285
1418
|
try {
|
|
1286
1419
|
entries.push([key, namespace[key]]);
|
|
1287
|
-
} catch (
|
|
1420
|
+
} catch (e16) {
|
|
1288
1421
|
}
|
|
1289
1422
|
}
|
|
1290
1423
|
return entries;
|
|
@@ -1317,7 +1450,7 @@ function toModuleFile(file) {
|
|
|
1317
1450
|
if (file.startsWith("file://")) {
|
|
1318
1451
|
try {
|
|
1319
1452
|
return toPosixPath(_url.fileURLToPath.call(void 0, file));
|
|
1320
|
-
} catch (
|
|
1453
|
+
} catch (e17) {
|
|
1321
1454
|
return toPosixPath(file);
|
|
1322
1455
|
}
|
|
1323
1456
|
}
|
|
@@ -1336,7 +1469,7 @@ var _crypto = require('crypto');
|
|
|
1336
1469
|
|
|
1337
1470
|
var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
1338
1471
|
var moduleName = (node) => {
|
|
1339
|
-
const name = _optionalChain([node, 'optionalAccess',
|
|
1472
|
+
const name = _optionalChain([node, 'optionalAccess', _81 => _81.type]) === "Identifier" ? node.name : _optionalChain([node, 'optionalAccess', _82 => _82.value]);
|
|
1340
1473
|
return typeof name === "string" ? name : null;
|
|
1341
1474
|
};
|
|
1342
1475
|
function parse(code, file) {
|
|
@@ -1347,7 +1480,7 @@ function parse(code, file) {
|
|
|
1347
1480
|
function parseAs(code, lang) {
|
|
1348
1481
|
try {
|
|
1349
1482
|
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
1350
|
-
} catch (
|
|
1483
|
+
} catch (e18) {
|
|
1351
1484
|
return null;
|
|
1352
1485
|
}
|
|
1353
1486
|
}
|
|
@@ -1372,8 +1505,8 @@ function namespaceMembers2(program, local, declaration) {
|
|
|
1372
1505
|
if (opaque || node === declaration) return;
|
|
1373
1506
|
const name = node.type === "Identifier" || node.type === "JSXIdentifier" ? node.name : null;
|
|
1374
1507
|
if (name !== local) return;
|
|
1375
|
-
if (_optionalChain([parent, 'optionalAccess',
|
|
1376
|
-
const member = (_optionalChain([parent, 'optionalAccess',
|
|
1508
|
+
if (_optionalChain([parent, 'optionalAccess', _83 => _83.type]) === "ImportNamespaceSpecifier") return;
|
|
1509
|
+
const member = (_optionalChain([parent, 'optionalAccess', _84 => _84.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _85 => _85.type]) === "JSXMemberExpression") && parent.object === node ? parent.property : null;
|
|
1377
1510
|
const property = member && !parent.computed && (member.type === "Identifier" || member.type === "JSXIdentifier") ? member.name : null;
|
|
1378
1511
|
if (property) members.add(property);
|
|
1379
1512
|
else opaque = true;
|
|
@@ -1389,7 +1522,7 @@ function findFarmPackageClientImports(code, file, isClientPackage) {
|
|
|
1389
1522
|
const reexport = node.type === "ExportNamedDeclaration" && node.source != null;
|
|
1390
1523
|
if (node.type !== "ImportDeclaration" && !reexport) continue;
|
|
1391
1524
|
if (node.importKind === "type" || node.exportKind === "type") continue;
|
|
1392
|
-
const specifier = _optionalChain([node, 'access',
|
|
1525
|
+
const specifier = _optionalChain([node, 'access', _86 => _86.source, 'optionalAccess', _87 => _87.value]);
|
|
1393
1526
|
if (typeof specifier !== "string" || specifier.startsWith(".") || specifier.startsWith("/"))
|
|
1394
1527
|
continue;
|
|
1395
1528
|
const specifiers = (_nullishCoalesce(node.specifiers, () => ( []))).filter(
|
|
@@ -1446,7 +1579,7 @@ function farmPackageClientImportExports(entry) {
|
|
|
1446
1579
|
return [
|
|
1447
1580
|
...entry.defaultLocal ? ["default"] : [],
|
|
1448
1581
|
...entry.named.map((binding) => binding.imported),
|
|
1449
|
-
..._nullishCoalesce(_optionalChain([entry, 'access',
|
|
1582
|
+
..._nullishCoalesce(_optionalChain([entry, 'access', _88 => _88.namespace, 'optionalAccess', _89 => _89.members]), () => ( []))
|
|
1450
1583
|
];
|
|
1451
1584
|
}
|
|
1452
1585
|
var FARM_CLIENT_REFERENCE_PRAGMA = "// @farm-client-reference";
|
|
@@ -1487,7 +1620,7 @@ function packageLookup(directory, packageName) {
|
|
|
1487
1620
|
const candidate = _path2.default.join(current, "node_modules", packageName);
|
|
1488
1621
|
try {
|
|
1489
1622
|
return { from: current, real: _fs2.default.realpathSync(candidate) };
|
|
1490
|
-
} catch (
|
|
1623
|
+
} catch (e19) {
|
|
1491
1624
|
}
|
|
1492
1625
|
}
|
|
1493
1626
|
if (_path2.default.dirname(current) === current) return null;
|
|
@@ -1498,10 +1631,10 @@ function referenceResolveFrom(root, specifier, importer) {
|
|
|
1498
1631
|
const own = packageLookup(_path2.default.dirname(importer), packageName);
|
|
1499
1632
|
if (!own) return null;
|
|
1500
1633
|
const app = packageLookup(_path2.default.join(root, ".farm", "client-references"), packageName);
|
|
1501
|
-
if (_optionalChain([app, 'optionalAccess',
|
|
1634
|
+
if (_optionalChain([app, 'optionalAccess', _90 => _90.real]) === own.real) return null;
|
|
1502
1635
|
try {
|
|
1503
1636
|
return _fs2.default.realpathSync(own.from);
|
|
1504
|
-
} catch (
|
|
1637
|
+
} catch (e20) {
|
|
1505
1638
|
return own.from;
|
|
1506
1639
|
}
|
|
1507
1640
|
}
|
|
@@ -1527,7 +1660,7 @@ function ensureFarmPackageClientReference(root, specifier, exportName, importer)
|
|
|
1527
1660
|
let current = null;
|
|
1528
1661
|
try {
|
|
1529
1662
|
current = _fs2.default.readFileSync(file, "utf8");
|
|
1530
|
-
} catch (
|
|
1663
|
+
} catch (e21) {
|
|
1531
1664
|
}
|
|
1532
1665
|
if (current !== source) {
|
|
1533
1666
|
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
@@ -1539,7 +1672,7 @@ function writeIfChanged(file, source) {
|
|
|
1539
1672
|
let current = null;
|
|
1540
1673
|
try {
|
|
1541
1674
|
current = _fs2.default.readFileSync(file, "utf8");
|
|
1542
|
-
} catch (
|
|
1675
|
+
} catch (e22) {
|
|
1543
1676
|
}
|
|
1544
1677
|
if (current !== source) {
|
|
1545
1678
|
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
@@ -1551,7 +1684,7 @@ function owningPackage(file) {
|
|
|
1551
1684
|
try {
|
|
1552
1685
|
const manifest = JSON.parse(_fs2.default.readFileSync(_path2.default.join(current, "package.json"), "utf8"));
|
|
1553
1686
|
if (typeof manifest.name === "string") return { directory: current, name: manifest.name };
|
|
1554
|
-
} catch (
|
|
1687
|
+
} catch (e23) {
|
|
1555
1688
|
}
|
|
1556
1689
|
if (_path2.default.dirname(current) === current) return null;
|
|
1557
1690
|
}
|
|
@@ -1622,7 +1755,7 @@ function rewriteFarmPackageClientImports(options) {
|
|
|
1622
1755
|
lines.push(`import { ${member} as ${local} } from ${reference(entry.specifier, member)};`);
|
|
1623
1756
|
fields.push(`${member}: ${local}`);
|
|
1624
1757
|
}
|
|
1625
|
-
if (_optionalChain([entry, 'access',
|
|
1758
|
+
if (_optionalChain([entry, 'access', _91 => _91.namespace, 'access', _92 => _92.values, 'optionalAccess', _93 => _93.length])) {
|
|
1626
1759
|
const local = `__farm_package_values_${next++}__`;
|
|
1627
1760
|
lines.push(`import * as ${local} from ${JSON.stringify(entry.specifier)};`);
|
|
1628
1761
|
for (const value of entry.namespace.values) fields.push(`${value}: ${local}.${value}`);
|
|
@@ -1634,6 +1767,149 @@ function rewriteFarmPackageClientImports(options) {
|
|
|
1634
1767
|
return changed ? output : null;
|
|
1635
1768
|
}
|
|
1636
1769
|
|
|
1770
|
+
// src/islands-containers.ts
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
var FARM_ISLAND_CONTAINER_EXPORT = "FarmIslandContainer";
|
|
1775
|
+
var CONTAINER_LOCAL = "__FarmIslandContainer__";
|
|
1776
|
+
var ISLAND_CONTAINER_TAGS = /* @__PURE__ */ new Set([
|
|
1777
|
+
"table",
|
|
1778
|
+
"thead",
|
|
1779
|
+
"tbody",
|
|
1780
|
+
"tfoot",
|
|
1781
|
+
"tr",
|
|
1782
|
+
"select",
|
|
1783
|
+
"optgroup",
|
|
1784
|
+
"datalist",
|
|
1785
|
+
"svg",
|
|
1786
|
+
"ul",
|
|
1787
|
+
"ol"
|
|
1788
|
+
]);
|
|
1789
|
+
var FLOW_CONTENT_TAGS = /* @__PURE__ */ new Set(["td", "th", "caption", "foreignObject", "li"]);
|
|
1790
|
+
function farmIslandContainerReferencePath(root) {
|
|
1791
|
+
return _path2.default.join(root, ".farm", "client-references", "farm.js+core", "__island-container.tsx");
|
|
1792
|
+
}
|
|
1793
|
+
function ensureFarmIslandContainerReference(root) {
|
|
1794
|
+
const file = farmIslandContainerReferencePath(root);
|
|
1795
|
+
const source = [
|
|
1796
|
+
"// Generated by Farm: the island around an element whose children are client components (RFC 0006).",
|
|
1797
|
+
FARM_CLIENT_REFERENCE_PRAGMA,
|
|
1798
|
+
'"use client";',
|
|
1799
|
+
`export function ${FARM_ISLAND_CONTAINER_EXPORT}({ children }: { children?: unknown }) {`,
|
|
1800
|
+
" return children as never;",
|
|
1801
|
+
"}",
|
|
1802
|
+
""
|
|
1803
|
+
].join("\n");
|
|
1804
|
+
let current = null;
|
|
1805
|
+
try {
|
|
1806
|
+
current = _fs2.default.readFileSync(file, "utf8");
|
|
1807
|
+
} catch (e24) {
|
|
1808
|
+
}
|
|
1809
|
+
if (current !== source) {
|
|
1810
|
+
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
1811
|
+
_fs2.default.writeFileSync(file, source);
|
|
1812
|
+
}
|
|
1813
|
+
return file;
|
|
1814
|
+
}
|
|
1815
|
+
function parse2(code, file) {
|
|
1816
|
+
const extension = _path2.default.extname(file).slice(1);
|
|
1817
|
+
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : extension === "js" || extension === "mjs" || extension === "cjs" || extension === "jsx" ? "jsx" : "tsx";
|
|
1818
|
+
return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
|
|
1819
|
+
try {
|
|
1820
|
+
return _parseAst.parseAst.call(void 0, code, { lang });
|
|
1821
|
+
} catch (e25) {
|
|
1822
|
+
return null;
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
function jsxName(node) {
|
|
1827
|
+
if (!node) return null;
|
|
1828
|
+
if (node.type === "JSXIdentifier") return node.name;
|
|
1829
|
+
if (node.type === "JSXMemberExpression") {
|
|
1830
|
+
let object = node.object;
|
|
1831
|
+
while (object.type === "JSXMemberExpression") object = object.object;
|
|
1832
|
+
return object.type === "JSXIdentifier" ? object.name : null;
|
|
1833
|
+
}
|
|
1834
|
+
return null;
|
|
1835
|
+
}
|
|
1836
|
+
function findFarmIslandContainers(code, file, bindings) {
|
|
1837
|
+
if (bindings.length === 0) return [];
|
|
1838
|
+
if (!/<(?:table|thead|tbody|tfoot|tr|select|optgroup|datalist|svg|ul|ol)[\s>/]/.test(code)) {
|
|
1839
|
+
return [];
|
|
1840
|
+
}
|
|
1841
|
+
const program = parse2(code, file);
|
|
1842
|
+
if (!program) return null;
|
|
1843
|
+
const names = new Set(bindings);
|
|
1844
|
+
const found = /* @__PURE__ */ new Map();
|
|
1845
|
+
const open = [];
|
|
1846
|
+
const visit = (node) => {
|
|
1847
|
+
if (!node || typeof node !== "object") return;
|
|
1848
|
+
if (Array.isArray(node)) {
|
|
1849
|
+
for (const child of node) visit(child);
|
|
1850
|
+
return;
|
|
1851
|
+
}
|
|
1852
|
+
const current = node;
|
|
1853
|
+
if (typeof current.type !== "string") return;
|
|
1854
|
+
if (current.type === "JSXElement") {
|
|
1855
|
+
const name = jsxName(_optionalChain([current, 'access', _94 => _94.openingElement, 'optionalAccess', _95 => _95.name]));
|
|
1856
|
+
if (name && names.has(name)) {
|
|
1857
|
+
let container;
|
|
1858
|
+
for (let depth = open.length - 1; depth >= 0; depth--) {
|
|
1859
|
+
const tag = jsxName(open[depth].openingElement.name);
|
|
1860
|
+
if (FLOW_CONTENT_TAGS.has(tag)) break;
|
|
1861
|
+
if (ISLAND_CONTAINER_TAGS.has(tag)) container = open[depth];
|
|
1862
|
+
}
|
|
1863
|
+
if (container && !found.has(container.start)) {
|
|
1864
|
+
found.set(container.start, {
|
|
1865
|
+
tag: jsxName(container.openingElement.name),
|
|
1866
|
+
start: container.start,
|
|
1867
|
+
end: container.end
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
const host = _optionalChain([current, 'access', _96 => _96.openingElement, 'optionalAccess', _97 => _97.name, 'optionalAccess', _98 => _98.type]) === "JSXIdentifier" && (ISLAND_CONTAINER_TAGS.has(name) || FLOW_CONTENT_TAGS.has(name));
|
|
1872
|
+
if (host) open.push(current);
|
|
1873
|
+
visit(_optionalChain([current, 'access', _99 => _99.openingElement, 'optionalAccess', _100 => _100.attributes]));
|
|
1874
|
+
visit(current.children);
|
|
1875
|
+
if (host) open.pop();
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
for (const [key, value] of Object.entries(current)) {
|
|
1879
|
+
if (key === "start" || key === "end" || key === "loc" || key === "range") continue;
|
|
1880
|
+
if (value && typeof value === "object") visit(value);
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
visit(program);
|
|
1884
|
+
const sorted = [...found.values()].sort((a, b) => a.start - b.start);
|
|
1885
|
+
const outermost = [];
|
|
1886
|
+
for (const container of sorted) {
|
|
1887
|
+
const last = outermost[outermost.length - 1];
|
|
1888
|
+
if (last && container.start >= last.start && container.end <= last.end) continue;
|
|
1889
|
+
outermost.push(container);
|
|
1890
|
+
}
|
|
1891
|
+
return outermost;
|
|
1892
|
+
}
|
|
1893
|
+
function wrapFarmIslandContainers(options) {
|
|
1894
|
+
const containers = findFarmIslandContainers(options.code, options.file, options.bindings);
|
|
1895
|
+
if (!containers || containers.length === 0) return null;
|
|
1896
|
+
let code = options.code;
|
|
1897
|
+
for (const container of [...containers].reverse()) {
|
|
1898
|
+
code = code.slice(0, container.start) + `<${CONTAINER_LOCAL}>` + code.slice(container.start, container.end) + `</${CONTAINER_LOCAL}>` + code.slice(container.end);
|
|
1899
|
+
}
|
|
1900
|
+
const specifier = JSON.stringify(options.reference.split(_path2.default.sep).join("/"));
|
|
1901
|
+
const declaration = `import { ${FARM_ISLAND_CONTAINER_EXPORT} as ${CONTAINER_LOCAL} } from ${specifier};
|
|
1902
|
+
`;
|
|
1903
|
+
let prologueEnd = 0;
|
|
1904
|
+
for (const statement of _nullishCoalesce(_optionalChain([parse2, 'call', _101 => _101(options.code, options.file), 'optionalAccess', _102 => _102.body]), () => ( []))) {
|
|
1905
|
+
if (statement.type !== "ExpressionStatement" || typeof statement.directive !== "string") break;
|
|
1906
|
+
prologueEnd = statement.end;
|
|
1907
|
+
}
|
|
1908
|
+
if (prologueEnd === 0) return declaration + code;
|
|
1909
|
+
return `${code.slice(0, prologueEnd)}
|
|
1910
|
+
${declaration}${code.slice(prologueEnd)}`;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1637
1913
|
// src/utils/package-client-boundary-cache.ts
|
|
1638
1914
|
var _async_hooks = require('async_hooks');
|
|
1639
1915
|
|
|
@@ -1681,7 +1957,7 @@ function stampPackagePath(target, kind) {
|
|
|
1681
1957
|
const stat = _fs2.default.statSync(target, { throwIfNoEntry: false });
|
|
1682
1958
|
if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
|
|
1683
1959
|
return [target, stat.size, stat.mtimeMs, stat.ctimeMs];
|
|
1684
|
-
} catch (
|
|
1960
|
+
} catch (e26) {
|
|
1685
1961
|
return void 0;
|
|
1686
1962
|
}
|
|
1687
1963
|
}
|
|
@@ -1717,7 +1993,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1717
1993
|
else this.dirty = true;
|
|
1718
1994
|
}
|
|
1719
1995
|
}
|
|
1720
|
-
return _optionalChain([entries, 'optionalAccess',
|
|
1996
|
+
return _optionalChain([entries, 'optionalAccess', _103 => _103.find, 'call', _104 => _104(
|
|
1721
1997
|
(entry) => entry.stops.every((file) => visited.has(file)) && !entry.files.some((file) => visited.has(file))
|
|
1722
1998
|
)]);
|
|
1723
1999
|
}
|
|
@@ -1736,7 +2012,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1736
2012
|
await _fs2.default.promises.mkdir(_path2.default.dirname(file), { recursive: true });
|
|
1737
2013
|
await _fs2.default.promises.writeFile(temporary, contents);
|
|
1738
2014
|
await _fs2.default.promises.rename(temporary, file);
|
|
1739
|
-
} catch (
|
|
2015
|
+
} catch (e27) {
|
|
1740
2016
|
await _fs2.default.promises.rm(temporary, { force: true }).catch(() => {
|
|
1741
2017
|
});
|
|
1742
2018
|
}
|
|
@@ -1751,10 +2027,10 @@ var PackageClientBoundaryCache = class {
|
|
|
1751
2027
|
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
1752
2028
|
_fs2.default.writeFileSync(temporary, contents);
|
|
1753
2029
|
_fs2.default.renameSync(temporary, file);
|
|
1754
|
-
} catch (
|
|
2030
|
+
} catch (e28) {
|
|
1755
2031
|
try {
|
|
1756
2032
|
_fs2.default.rmSync(temporary, { force: true });
|
|
1757
|
-
} catch (
|
|
2033
|
+
} catch (e29) {
|
|
1758
2034
|
}
|
|
1759
2035
|
}
|
|
1760
2036
|
}
|
|
@@ -1788,7 +2064,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1788
2064
|
}
|
|
1789
2065
|
const contents = JSON.stringify({
|
|
1790
2066
|
schema: SCHEMA_VERSION,
|
|
1791
|
-
farm:
|
|
2067
|
+
farm: _chunkRSL3YFJGcjs.FARM_VERSION,
|
|
1792
2068
|
paths,
|
|
1793
2069
|
entries
|
|
1794
2070
|
});
|
|
@@ -1825,10 +2101,10 @@ function readStoredCache(file) {
|
|
|
1825
2101
|
let value;
|
|
1826
2102
|
try {
|
|
1827
2103
|
value = JSON.parse(_fs2.default.readFileSync(file, "utf8"));
|
|
1828
|
-
} catch (
|
|
2104
|
+
} catch (e30) {
|
|
1829
2105
|
return null;
|
|
1830
2106
|
}
|
|
1831
|
-
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !==
|
|
2107
|
+
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkRSL3YFJGcjs.FARM_VERSION) {
|
|
1832
2108
|
return null;
|
|
1833
2109
|
}
|
|
1834
2110
|
const { paths, entries } = value;
|
|
@@ -1839,7 +2115,7 @@ function readStoredCache(file) {
|
|
|
1839
2115
|
const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
|
|
1840
2116
|
if (usable.length > 0) valid[key] = usable;
|
|
1841
2117
|
}
|
|
1842
|
-
return { schema: SCHEMA_VERSION, farm:
|
|
2118
|
+
return { schema: SCHEMA_VERSION, farm: _chunkRSL3YFJGcjs.FARM_VERSION, paths, entries: valid };
|
|
1843
2119
|
}
|
|
1844
2120
|
function isRecord(value) {
|
|
1845
2121
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1878,7 +2154,7 @@ async function withPackageClientBoundaryCache(operation) {
|
|
|
1878
2154
|
}
|
|
1879
2155
|
}
|
|
1880
2156
|
function usePackageClientBoundaryCacheFile(file) {
|
|
1881
|
-
_optionalChain([getPackageClientBoundaryCache, 'call',
|
|
2157
|
+
_optionalChain([getPackageClientBoundaryCache, 'call', _105 => _105(), 'optionalAccess', _106 => _106.load, 'call', _107 => _107(file)]);
|
|
1882
2158
|
}
|
|
1883
2159
|
function resolvePackageClientBoundaryCacheFile(root, distDir) {
|
|
1884
2160
|
return _path2.default.resolve(root, distDir, "cache", "client-boundaries.json");
|
|
@@ -1895,7 +2171,7 @@ function runWithPackageClientBoundaryCacheFile(file, operation) {
|
|
|
1895
2171
|
var latestDevCache;
|
|
1896
2172
|
function runWithLatestPackageClientBoundaryCache(file, operation) {
|
|
1897
2173
|
if (getPackageClientBoundaryCache()) return operation();
|
|
1898
|
-
if (_optionalChain([latestDevCache, 'optionalAccess',
|
|
2174
|
+
if (_optionalChain([latestDevCache, 'optionalAccess', _108 => _108.file]) !== file) {
|
|
1899
2175
|
const cache2 = new PackageClientBoundaryCache();
|
|
1900
2176
|
cache2.load(file);
|
|
1901
2177
|
latestDevCache = { file, cache: cache2 };
|
|
@@ -1929,7 +2205,7 @@ function readSourceFileContents(filePath) {
|
|
|
1929
2205
|
return null;
|
|
1930
2206
|
}
|
|
1931
2207
|
return _fs2.default.readFileSync(filePath, "utf-8");
|
|
1932
|
-
} catch (
|
|
2208
|
+
} catch (e31) {
|
|
1933
2209
|
return null;
|
|
1934
2210
|
}
|
|
1935
2211
|
}
|
|
@@ -1942,7 +2218,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
1942
2218
|
if (modulePath.startsWith("file://")) {
|
|
1943
2219
|
try {
|
|
1944
2220
|
candidates.add(_url.fileURLToPath.call(void 0, modulePath));
|
|
1945
|
-
} catch (
|
|
2221
|
+
} catch (e32) {
|
|
1946
2222
|
}
|
|
1947
2223
|
}
|
|
1948
2224
|
if (modulePath.startsWith("/@fs/")) {
|
|
@@ -1955,7 +2231,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
1955
2231
|
candidates.add(_path2.default.join(root, normalized));
|
|
1956
2232
|
candidates.add(_path2.default.resolve(root, normalized));
|
|
1957
2233
|
}
|
|
1958
|
-
if (_optionalChain([withoutQuery, 'optionalAccess',
|
|
2234
|
+
if (_optionalChain([withoutQuery, 'optionalAccess', _109 => _109.startsWith, 'call', _110 => _110("/src/")])) {
|
|
1959
2235
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
1960
2236
|
candidates.add(_path2.default.join(process.cwd(), normalized));
|
|
1961
2237
|
candidates.add(_path2.default.resolve(process.cwd(), normalized));
|
|
@@ -2010,7 +2286,7 @@ function hasUseClientDirective(content) {
|
|
|
2010
2286
|
if (!normalized.includes("use client")) {
|
|
2011
2287
|
return false;
|
|
2012
2288
|
}
|
|
2013
|
-
for (const token of
|
|
2289
|
+
for (const token of scanModuleSourceTokens(content, true)) {
|
|
2014
2290
|
if (token.kind === "string") {
|
|
2015
2291
|
if (token.value === "use client") {
|
|
2016
2292
|
return true;
|
|
@@ -2034,7 +2310,7 @@ function hasHydrateExport(content) {
|
|
|
2034
2310
|
for (const match of content.matchAll(/\bexport\s*\{([^}]*)\}/g)) {
|
|
2035
2311
|
for (const specifier of match[1].split(",")) {
|
|
2036
2312
|
const parts = specifier.trim().split(/\s+as\s+/);
|
|
2037
|
-
const exportedName2 = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess',
|
|
2313
|
+
const exportedName2 = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess', _111 => _111.trim, 'call', _112 => _112()]);
|
|
2038
2314
|
if (exportedName2 === "hydrate") {
|
|
2039
2315
|
return true;
|
|
2040
2316
|
}
|
|
@@ -2136,7 +2412,7 @@ function isIdentifierStartCode(code) {
|
|
|
2136
2412
|
function isIdentifierPartCode(code) {
|
|
2137
2413
|
return isIdentifierStartCode(code) || code >= 48 && code <= 57;
|
|
2138
2414
|
}
|
|
2139
|
-
function scanModuleSourceTokens(content) {
|
|
2415
|
+
function scanModuleSourceTokens(content, prologueOnly = false) {
|
|
2140
2416
|
const tokens = [];
|
|
2141
2417
|
let index = 0;
|
|
2142
2418
|
let line = 1;
|
|
@@ -2216,9 +2492,11 @@ function scanModuleSourceTokens(content) {
|
|
|
2216
2492
|
const start = index++;
|
|
2217
2493
|
while (index < content.length && isIdentifierPartCode(content.charCodeAt(index))) index++;
|
|
2218
2494
|
tokens.push({ kind: "identifier", value: content.slice(start, index), line });
|
|
2495
|
+
if (prologueOnly) return tokens;
|
|
2219
2496
|
continue;
|
|
2220
2497
|
}
|
|
2221
2498
|
tokens.push({ kind: "punctuation", value: character, line });
|
|
2499
|
+
if (prologueOnly && character !== ";") return tokens;
|
|
2222
2500
|
index++;
|
|
2223
2501
|
}
|
|
2224
2502
|
return tokens;
|
|
@@ -2227,7 +2505,7 @@ function isIslandExportStart(tokens, index) {
|
|
|
2227
2505
|
const token = tokens[index];
|
|
2228
2506
|
const previous = tokens[index - 1];
|
|
2229
2507
|
const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
|
|
2230
|
-
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access',
|
|
2508
|
+
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _113 => _113[index + 1], 'optionalAccess', _114 => _114.value]) === "const" && _optionalChain([tokens, 'access', _115 => _115[index + 2], 'optionalAccess', _116 => _116.value]) === "island";
|
|
2231
2509
|
}
|
|
2232
2510
|
function getIslandStrategyExport(content) {
|
|
2233
2511
|
if (!content) return null;
|
|
@@ -2235,15 +2513,15 @@ function getIslandStrategyExport(content) {
|
|
|
2235
2513
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2236
2514
|
if (!isIslandExportStart(tokens, index)) continue;
|
|
2237
2515
|
let valueIndex = index + 3;
|
|
2238
|
-
if (_optionalChain([tokens, 'access',
|
|
2516
|
+
if (_optionalChain([tokens, 'access', _117 => _117[valueIndex], 'optionalAccess', _118 => _118.value]) === ":") {
|
|
2239
2517
|
while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
|
|
2240
2518
|
}
|
|
2241
|
-
if (_optionalChain([tokens, 'access',
|
|
2519
|
+
if (_optionalChain([tokens, 'access', _119 => _119[valueIndex], 'optionalAccess', _120 => _120.value]) !== "=") break;
|
|
2242
2520
|
valueIndex++;
|
|
2243
2521
|
const literal = tokens[valueIndex];
|
|
2244
2522
|
if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
|
|
2245
2523
|
let trailingIndex = valueIndex + 1;
|
|
2246
|
-
if (_optionalChain([tokens, 'access',
|
|
2524
|
+
if (_optionalChain([tokens, 'access', _121 => _121[trailingIndex], 'optionalAccess', _122 => _122.value]) === "as" && _optionalChain([tokens, 'access', _123 => _123[trailingIndex + 1], 'optionalAccess', _124 => _124.value]) === "const") {
|
|
2247
2525
|
trailingIndex += 2;
|
|
2248
2526
|
}
|
|
2249
2527
|
const trailing = tokens[trailingIndex];
|
|
@@ -2269,13 +2547,13 @@ function hasAsyncDefaultExport(content) {
|
|
|
2269
2547
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2270
2548
|
const token = tokens[index];
|
|
2271
2549
|
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
2272
|
-
if (_optionalChain([tokens, 'access',
|
|
2273
|
-
if (_optionalChain([tokens, 'access',
|
|
2550
|
+
if (_optionalChain([tokens, 'access', _125 => _125[index - 1], 'optionalAccess', _126 => _126.value]) === ".") continue;
|
|
2551
|
+
if (_optionalChain([tokens, 'access', _127 => _127[index + 1], 'optionalAccess', _128 => _128.value]) !== "default") continue;
|
|
2274
2552
|
const exported = tokens[index + 2];
|
|
2275
2553
|
if (exported.kind === "identifier" && exported.value === "async") {
|
|
2276
2554
|
return true;
|
|
2277
2555
|
}
|
|
2278
|
-
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access',
|
|
2556
|
+
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _129 => _129[index + 3], 'optionalAccess', _130 => _130.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
|
|
2279
2557
|
return true;
|
|
2280
2558
|
}
|
|
2281
2559
|
}
|
|
@@ -2283,10 +2561,10 @@ function hasAsyncDefaultExport(content) {
|
|
|
2283
2561
|
}
|
|
2284
2562
|
function isAsyncLocalDeclaration(tokens, name) {
|
|
2285
2563
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2286
|
-
if (tokens[index].value === "async" && _optionalChain([tokens, 'access',
|
|
2564
|
+
if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _131 => _131[index + 1], 'optionalAccess', _132 => _132.value]) === "function" && _optionalChain([tokens, 'access', _133 => _133[index + 2], 'optionalAccess', _134 => _134.value]) === name) {
|
|
2287
2565
|
return true;
|
|
2288
2566
|
}
|
|
2289
|
-
if (tokens[index].value === name && _optionalChain([tokens, 'access',
|
|
2567
|
+
if (tokens[index].value === name && _optionalChain([tokens, 'access', _135 => _135[index + 1], 'optionalAccess', _136 => _136.value]) === "=" && _optionalChain([tokens, 'access', _137 => _137[index + 2], 'optionalAccess', _138 => _138.value]) === "async") {
|
|
2290
2568
|
return true;
|
|
2291
2569
|
}
|
|
2292
2570
|
}
|
|
@@ -2326,6 +2604,16 @@ function resolveOwnerSourcePath(resolvedPath, root) {
|
|
|
2326
2604
|
}
|
|
2327
2605
|
return current;
|
|
2328
2606
|
}
|
|
2607
|
+
function getFarmClientRenderingBindings(code, file, root) {
|
|
2608
|
+
const bindings = [];
|
|
2609
|
+
for (const [specifier, locals] of getStaticImportBindings(code)) {
|
|
2610
|
+
const imported = resolveImportedModule(file, specifier, root);
|
|
2611
|
+
if (!imported.path) continue;
|
|
2612
|
+
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([_path2.default.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set());
|
|
2613
|
+
if (metadata.isClientComponent || metadata.shouldHydrate) bindings.push(...locals);
|
|
2614
|
+
}
|
|
2615
|
+
return bindings;
|
|
2616
|
+
}
|
|
2329
2617
|
function collectFarmRenderedClientModules(modulePath, root) {
|
|
2330
2618
|
const resolvedPath = resolveOwnerSourcePath(resolveModuleSourcePath(modulePath, root), root);
|
|
2331
2619
|
if (!resolvedPath) return null;
|
|
@@ -2365,6 +2653,9 @@ function getClientModuleMetadata(modulePath, root) {
|
|
|
2365
2653
|
const resolvedPath = resolveModuleSourcePath(modulePath, root);
|
|
2366
2654
|
return inspectClientModuleMetadata(resolvedPath, root, /* @__PURE__ */ new Set(), true);
|
|
2367
2655
|
}
|
|
2656
|
+
function getClientModuleHydrationPlanKey(modulePath, root, mode, options = {}) {
|
|
2657
|
+
return `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${options.packageReferences === true}\0${_path2.default.resolve(modulePath)}`;
|
|
2658
|
+
}
|
|
2368
2659
|
function getClientModuleHydrationPlan(modulePath, root, mode = "off", options = {}) {
|
|
2369
2660
|
const plan = planClientModuleHydration(modulePath, root, mode, options);
|
|
2370
2661
|
if (options.serverTreeLayouts !== true || options.asyncOwnerIslands !== true || !plan.shouldHydrate || plan.isClientComponent || plan.asyncOwnerIslands) {
|
|
@@ -2487,7 +2778,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
2487
2778
|
return plan;
|
|
2488
2779
|
}
|
|
2489
2780
|
function usesFarmServerTree(plan) {
|
|
2490
|
-
return _optionalChain([plan, 'optionalAccess',
|
|
2781
|
+
return _optionalChain([plan, 'optionalAccess', _139 => _139.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0;
|
|
2491
2782
|
}
|
|
2492
2783
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
2493
2784
|
const plan = {
|
|
@@ -2591,6 +2882,13 @@ function enforceFarmIsolatedHydrationRouteBudget(layouts, routes, layoutAppliesT
|
|
|
2591
2882
|
(ancestor) => ancestor !== layout && ancestor.depth < layout.depth && ancestor.metadata.shouldHydrate && layoutAppliesToRoute(ancestor.pattern, layout.pattern)
|
|
2592
2883
|
);
|
|
2593
2884
|
if (hasRouteWideAncestor && layout.metadata.hasIsolatedClientBoundaries) {
|
|
2885
|
+
if (options.serverOwners && !layout.metadata.asyncOwnerIslands) {
|
|
2886
|
+
layout.metadata.shouldHydrate = layout.metadata.legacyShouldHydrate;
|
|
2887
|
+
layout.metadata.islandStrategy = layout.metadata.legacyIslandStrategy;
|
|
2888
|
+
layout.metadata.hasIsolatedClientBoundaries = false;
|
|
2889
|
+
layout.metadata.serverTreeLayout = true;
|
|
2890
|
+
continue;
|
|
2891
|
+
}
|
|
2594
2892
|
restoreRouteWideHydration(layout.metadata);
|
|
2595
2893
|
}
|
|
2596
2894
|
}
|
|
@@ -2610,7 +2908,7 @@ function clientModulePlanSignature(content) {
|
|
|
2610
2908
|
isIsolatableClientBoundarySource(content),
|
|
2611
2909
|
getImportSpecifiers(content).sort()
|
|
2612
2910
|
]);
|
|
2613
|
-
} catch (
|
|
2911
|
+
} catch (e33) {
|
|
2614
2912
|
return null;
|
|
2615
2913
|
}
|
|
2616
2914
|
}
|
|
@@ -2635,7 +2933,7 @@ function getStaticImportBindings(content) {
|
|
|
2635
2933
|
if (!content) return bindings;
|
|
2636
2934
|
const tokens = tokenizeModuleSource(content);
|
|
2637
2935
|
for (let index = 0; index < tokens.length; index++) {
|
|
2638
|
-
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access',
|
|
2936
|
+
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _140 => _140[index - 1], 'optionalAccess', _141 => _141.value]) === ".") continue;
|
|
2639
2937
|
const first = tokens[index + 1];
|
|
2640
2938
|
if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
|
|
2641
2939
|
continue;
|
|
@@ -2643,7 +2941,7 @@ function getStaticImportBindings(content) {
|
|
|
2643
2941
|
let fromIndex = -1;
|
|
2644
2942
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
2645
2943
|
if (tokens[cursor].value === ";") break;
|
|
2646
|
-
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access',
|
|
2944
|
+
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _142 => _142[cursor + 1], 'optionalAccess', _143 => _143.kind]) === "string") {
|
|
2647
2945
|
fromIndex = cursor;
|
|
2648
2946
|
break;
|
|
2649
2947
|
}
|
|
@@ -2652,13 +2950,13 @@ function getStaticImportBindings(content) {
|
|
|
2652
2950
|
const specifier = tokens[fromIndex + 1].value;
|
|
2653
2951
|
const clause = tokens.slice(index + 1, fromIndex);
|
|
2654
2952
|
const localNames = [];
|
|
2655
|
-
if (_optionalChain([clause, 'access',
|
|
2953
|
+
if (_optionalChain([clause, 'access', _144 => _144[0], 'optionalAccess', _145 => _145.kind]) === "identifier" && clause[0].value !== "type") {
|
|
2656
2954
|
localNames.push(clause[0].value);
|
|
2657
2955
|
}
|
|
2658
2956
|
const namespaceAs = clause.findIndex(
|
|
2659
|
-
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access',
|
|
2957
|
+
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _146 => _146[clauseIndex + 1], 'optionalAccess', _147 => _147.value]) === "as"
|
|
2660
2958
|
);
|
|
2661
|
-
if (namespaceAs !== -1 && _optionalChain([clause, 'access',
|
|
2959
|
+
if (namespaceAs !== -1 && _optionalChain([clause, 'access', _148 => _148[namespaceAs + 2], 'optionalAccess', _149 => _149.kind]) === "identifier") {
|
|
2662
2960
|
localNames.push(clause[namespaceAs + 2].value);
|
|
2663
2961
|
}
|
|
2664
2962
|
const openingBrace = clause.findIndex((token) => token.value === "{");
|
|
@@ -2668,11 +2966,11 @@ function getStaticImportBindings(content) {
|
|
|
2668
2966
|
if (openingBrace !== -1 && closingBrace !== -1) {
|
|
2669
2967
|
let entryStart = openingBrace + 1;
|
|
2670
2968
|
for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
|
|
2671
|
-
if (cursor !== closingBrace && _optionalChain([clause, 'access',
|
|
2969
|
+
if (cursor !== closingBrace && _optionalChain([clause, 'access', _150 => _150[cursor], 'optionalAccess', _151 => _151.value]) !== ",") continue;
|
|
2672
2970
|
const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
|
|
2673
2971
|
const asIndex = entry.findIndex((token) => token.value === "as");
|
|
2674
2972
|
const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
|
|
2675
|
-
if (_optionalChain([local, 'optionalAccess',
|
|
2973
|
+
if (_optionalChain([local, 'optionalAccess', _152 => _152.kind]) === "identifier") localNames.push(local.value);
|
|
2676
2974
|
entryStart = cursor + 1;
|
|
2677
2975
|
}
|
|
2678
2976
|
}
|
|
@@ -2709,14 +3007,14 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
2709
3007
|
const open = [];
|
|
2710
3008
|
const isSelfClosing = (openingIndex) => {
|
|
2711
3009
|
for (let index = openingIndex; index < tokens.length; index++) {
|
|
2712
|
-
if (tokens[index].value === ">") return _optionalChain([tokens, 'access',
|
|
3010
|
+
if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _153 => _153[index - 1], 'optionalAccess', _154 => _154.value]) === "/";
|
|
2713
3011
|
}
|
|
2714
3012
|
return false;
|
|
2715
3013
|
};
|
|
2716
3014
|
for (let index = 0; index < tokens.length - 1; index++) {
|
|
2717
3015
|
if (tokens[index].value !== "<") continue;
|
|
2718
3016
|
if (tokens[index + 1].value === "/") {
|
|
2719
|
-
const closing = _optionalChain([tokens, 'access',
|
|
3017
|
+
const closing = _optionalChain([tokens, 'access', _155 => _155[index + 2], 'optionalAccess', _156 => _156.value]);
|
|
2720
3018
|
const at = closing ? open.lastIndexOf(closing) : -1;
|
|
2721
3019
|
if (at !== -1) open.length = at;
|
|
2722
3020
|
continue;
|
|
@@ -2759,7 +3057,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
|
|
|
2759
3057
|
}
|
|
2760
3058
|
function containsClientJsx(tokens, start, end, clientBindings) {
|
|
2761
3059
|
for (let index = start; index < end; index++) {
|
|
2762
|
-
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access',
|
|
3060
|
+
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _157 => _157[index + 1], 'optionalAccess', _158 => _158.value]))) return true;
|
|
2763
3061
|
}
|
|
2764
3062
|
return false;
|
|
2765
3063
|
}
|
|
@@ -2797,7 +3095,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
2797
3095
|
let helperName;
|
|
2798
3096
|
let bodyStart = -1;
|
|
2799
3097
|
let bodyEnd = -1;
|
|
2800
|
-
if (tokens[index].value === "function" && _optionalChain([tokens, 'access',
|
|
3098
|
+
if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _159 => _159[index + 1], 'optionalAccess', _160 => _160.kind]) === "identifier") {
|
|
2801
3099
|
helperName = tokens[index + 1].value;
|
|
2802
3100
|
const parametersStart = tokens.findIndex(
|
|
2803
3101
|
(token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
|
|
@@ -2807,21 +3105,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
2807
3105
|
(token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
|
|
2808
3106
|
);
|
|
2809
3107
|
if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
|
|
2810
|
-
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access',
|
|
3108
|
+
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _161 => _161[index + 1], 'optionalAccess', _162 => _162.kind]) === "identifier") {
|
|
2811
3109
|
helperName = tokens[index + 1].value;
|
|
2812
3110
|
let assignmentIndex = -1;
|
|
2813
3111
|
let arrowIndex = -1;
|
|
2814
3112
|
for (let cursor = index + 2; cursor < tokens.length; cursor++) {
|
|
2815
3113
|
if (tokens[cursor].value === ";") break;
|
|
2816
3114
|
if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
|
|
2817
|
-
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access',
|
|
3115
|
+
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _163 => _163[cursor + 1], 'optionalAccess', _164 => _164.value]) === ">") {
|
|
2818
3116
|
arrowIndex = cursor;
|
|
2819
3117
|
break;
|
|
2820
3118
|
}
|
|
2821
3119
|
}
|
|
2822
3120
|
if (arrowIndex !== -1) {
|
|
2823
3121
|
bodyStart = arrowIndex + 2;
|
|
2824
|
-
bodyEnd = _optionalChain([tokens, 'access',
|
|
3122
|
+
bodyEnd = _optionalChain([tokens, 'access', _165 => _165[bodyStart], 'optionalAccess', _166 => _166.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
|
|
2825
3123
|
} else if (assignmentIndex !== -1) {
|
|
2826
3124
|
bodyStart = assignmentIndex + 1;
|
|
2827
3125
|
bodyEnd = findStatementEnd(tokens, bodyStart);
|
|
@@ -2861,14 +3159,14 @@ function passesElementValuedProps(content, localBindings) {
|
|
|
2861
3159
|
else if (value === "}") braceDepth--;
|
|
2862
3160
|
else if (value === "<" && braceDepth > 0) return true;
|
|
2863
3161
|
else if (value === ">" && braceDepth === 0) {
|
|
2864
|
-
selfClosing = _optionalChain([tokens, 'access',
|
|
3162
|
+
selfClosing = _optionalChain([tokens, 'access', _167 => _167[cursor - 1], 'optionalAccess', _168 => _168.value]) === "/";
|
|
2865
3163
|
break;
|
|
2866
3164
|
}
|
|
2867
3165
|
}
|
|
2868
3166
|
if (selfClosing || cursor >= tokens.length) continue;
|
|
2869
3167
|
for (let child = cursor + 1; child < tokens.length; child++) {
|
|
2870
3168
|
if (tokens[child].value !== "<") continue;
|
|
2871
|
-
const closesBoundary = _optionalChain([tokens, 'access',
|
|
3169
|
+
const closesBoundary = _optionalChain([tokens, 'access', _169 => _169[child + 1], 'optionalAccess', _170 => _170.value]) === "/" && _optionalChain([tokens, 'access', _171 => _171[child + 2], 'optionalAccess', _172 => _172.value]) === name;
|
|
2872
3170
|
if (!closesBoundary) return true;
|
|
2873
3171
|
break;
|
|
2874
3172
|
}
|
|
@@ -2890,7 +3188,7 @@ function rendersOnlyLeafElements(content, localBindings) {
|
|
|
2890
3188
|
else if (value === "<" && braceDepth > 0) return false;
|
|
2891
3189
|
else if (value === ">" && braceDepth === 0) break;
|
|
2892
3190
|
}
|
|
2893
|
-
if (cursor >= tokens.length || _optionalChain([tokens, 'access',
|
|
3191
|
+
if (cursor >= tokens.length || _optionalChain([tokens, 'access', _173 => _173[cursor - 1], 'optionalAccess', _174 => _174.value]) !== "/") return false;
|
|
2894
3192
|
}
|
|
2895
3193
|
return true;
|
|
2896
3194
|
}
|
|
@@ -2902,9 +3200,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
2902
3200
|
const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
|
|
2903
3201
|
for (let index = 0; index < tokens.length; index++) {
|
|
2904
3202
|
let callStart = -1;
|
|
2905
|
-
if (tokens[index].value === "." && (_optionalChain([tokens, 'access',
|
|
3203
|
+
if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _175 => _175[index + 1], 'optionalAccess', _176 => _176.value]) === "map" || _optionalChain([tokens, 'access', _177 => _177[index + 1], 'optionalAccess', _178 => _178.value]) === "flatMap") && _optionalChain([tokens, 'access', _179 => _179[index + 2], 'optionalAccess', _180 => _180.value]) === "(") {
|
|
2906
3204
|
callStart = index + 2;
|
|
2907
|
-
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access',
|
|
3205
|
+
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _181 => _181[index + 1], 'optionalAccess', _182 => _182.value]) === "." && _optionalChain([tokens, 'access', _183 => _183[index + 2], 'optionalAccess', _184 => _184.value]) === "from" && _optionalChain([tokens, 'access', _185 => _185[index + 3], 'optionalAccess', _186 => _186.value]) === "(") {
|
|
2908
3206
|
callStart = index + 3;
|
|
2909
3207
|
}
|
|
2910
3208
|
if (callStart !== -1) {
|
|
@@ -2913,10 +3211,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
2913
3211
|
index = callEnd;
|
|
2914
3212
|
continue;
|
|
2915
3213
|
}
|
|
2916
|
-
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access',
|
|
3214
|
+
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _187 => _187[index + 1], 'optionalAccess', _188 => _188.value]) === "(") {
|
|
2917
3215
|
const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
|
|
2918
3216
|
const bodyStart = conditionEnd + 1;
|
|
2919
|
-
const bodyEnd = _optionalChain([tokens, 'access',
|
|
3217
|
+
const bodyEnd = _optionalChain([tokens, 'access', _189 => _189[bodyStart], 'optionalAccess', _190 => _190.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
|
|
2920
3218
|
if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
|
|
2921
3219
|
}
|
|
2922
3220
|
}
|
|
@@ -3028,7 +3326,9 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3028
3326
|
const localBindings = _nullishCoalesce(importedBindings.get(specifier), () => ( []));
|
|
3029
3327
|
const staticUses = countStaticJsxUses(content, localBindings);
|
|
3030
3328
|
if (staticUses > 0) {
|
|
3031
|
-
const
|
|
3329
|
+
const grows = options.packageReferences === true && projectRoot !== void 0 && (_nullishCoalesce(_optionalChain([findFarmIslandContainers, 'call', _191 => _191(_nullishCoalesce(content, () => ( "")), moduleSourcePath, localBindings), 'optionalAccess', _192 => _192.length]), () => ( 0))) > 0;
|
|
3330
|
+
if (grows) visit(ensureFarmIslandContainerReference(projectRoot));
|
|
3331
|
+
const container = grows ? void 0 : findParserSensitiveJsxContainer(content, localBindings);
|
|
3032
3332
|
if (container) {
|
|
3033
3333
|
fallbackReason = `the client boundary imported from ${specifier} renders inside <${container}>, where the HTML parser relocates its hydration marker`;
|
|
3034
3334
|
fallbackHint = `Move "use client" up to a component that renders the whole <${container}>${_nullishCoalesce(PARSER_SENSITIVE_FLOW_HINTS[container], () => ( ""))}`;
|
|
@@ -3122,7 +3422,7 @@ function farmWorkspaceServerEntry(entry) {
|
|
|
3122
3422
|
function realpathOrSelf(file) {
|
|
3123
3423
|
try {
|
|
3124
3424
|
return _fs2.default.realpathSync(file);
|
|
3125
|
-
} catch (
|
|
3425
|
+
} catch (e34) {
|
|
3126
3426
|
return file;
|
|
3127
3427
|
}
|
|
3128
3428
|
}
|
|
@@ -3152,7 +3452,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
3152
3452
|
}
|
|
3153
3453
|
function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
3154
3454
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
3155
|
-
if (resolvedPath) _optionalChain([trace2, 'optionalAccess',
|
|
3455
|
+
if (resolvedPath) _optionalChain([trace2, 'optionalAccess', _193 => _193.stop, 'call', _194 => _194(resolvedPath)]);
|
|
3156
3456
|
return {
|
|
3157
3457
|
isClientComponent: false,
|
|
3158
3458
|
shouldHydrate: false,
|
|
@@ -3160,7 +3460,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
|
3160
3460
|
};
|
|
3161
3461
|
}
|
|
3162
3462
|
visited.add(resolvedPath);
|
|
3163
|
-
_optionalChain([trace2, 'optionalAccess',
|
|
3463
|
+
_optionalChain([trace2, 'optionalAccess', _195 => _195.visit, 'call', _196 => _196(resolvedPath)]);
|
|
3164
3464
|
const content = readIfExists(resolvedPath);
|
|
3165
3465
|
const parsed = parseClientModuleMetadata(content, false);
|
|
3166
3466
|
let importsClientBoundary = false;
|
|
@@ -3218,7 +3518,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3218
3518
|
braceDepth = Math.max(0, braceDepth - 1);
|
|
3219
3519
|
continue;
|
|
3220
3520
|
}
|
|
3221
|
-
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access',
|
|
3521
|
+
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access', _197 => _197[index - 1], 'optionalAccess', _198 => _198.value]) !== "." && _optionalChain([tokens, 'access', _199 => _199[index + 1], 'optionalAccess', _200 => _200.value]) === "(" && _optionalChain([tokens, 'access', _201 => _201[index + 2], 'optionalAccess', _202 => _202.kind]) === "string") {
|
|
3222
3522
|
matches.add(tokens[index + 2].value);
|
|
3223
3523
|
continue;
|
|
3224
3524
|
}
|
|
@@ -3228,7 +3528,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3228
3528
|
}
|
|
3229
3529
|
if (reexportsOnly && keyword.value !== "export") continue;
|
|
3230
3530
|
const previous = tokens[index - 1];
|
|
3231
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
3531
|
+
if (_optionalChain([previous, 'optionalAccess', _203 => _203.value]) === ".") continue;
|
|
3232
3532
|
const first = tokens[index + 1];
|
|
3233
3533
|
if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
|
|
3234
3534
|
continue;
|
|
@@ -3244,7 +3544,7 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3244
3544
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
3245
3545
|
const token = tokens[cursor];
|
|
3246
3546
|
if (token.value === ";") break;
|
|
3247
|
-
if (token.value === "from" && _optionalChain([tokens, 'access',
|
|
3547
|
+
if (token.value === "from" && _optionalChain([tokens, 'access', _204 => _204[cursor + 1], 'optionalAccess', _205 => _205.kind]) === "string") {
|
|
3248
3548
|
fromIndex = cursor;
|
|
3249
3549
|
break;
|
|
3250
3550
|
}
|
|
@@ -3262,14 +3562,14 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3262
3562
|
return Array.from(matches);
|
|
3263
3563
|
}
|
|
3264
3564
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
3265
|
-
if (_optionalChain([tokens, 'access',
|
|
3565
|
+
if (_optionalChain([tokens, 'access', _206 => _206[startIndex], 'optionalAccess', _207 => _207.value]) !== "{") return false;
|
|
3266
3566
|
const closingBraceIndex = tokens.findIndex(
|
|
3267
3567
|
(token, index) => index > startIndex && index < endIndex && token.value === "}"
|
|
3268
3568
|
);
|
|
3269
3569
|
if (closingBraceIndex === -1) return false;
|
|
3270
3570
|
let entryStartsAt = startIndex + 1;
|
|
3271
3571
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
3272
|
-
if (index !== closingBraceIndex && _optionalChain([tokens, 'access',
|
|
3572
|
+
if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _208 => _208[index], 'optionalAccess', _209 => _209.value]) !== ",") continue;
|
|
3273
3573
|
const entry = tokens.slice(entryStartsAt, index);
|
|
3274
3574
|
if (entry.length > 0 && entry[0].value !== "type") return false;
|
|
3275
3575
|
entryStartsAt = index + 1;
|
|
@@ -3279,7 +3579,7 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
|
3279
3579
|
function resolveImportedModule(importerPath, specifier, root) {
|
|
3280
3580
|
const resolved = memoizeInFarmSourceSnapshot(
|
|
3281
3581
|
"resolution",
|
|
3282
|
-
`${
|
|
3582
|
+
`${root ? farmSourceSnapshotPathKey(root) : ""}\0${farmSourceSnapshotPathKey(importerPath)}\0${specifier}`,
|
|
3283
3583
|
() => resolveImportedModuleUncached(importerPath, specifier, root),
|
|
3284
3584
|
// A file added later may resolve an import that does not resolve now.
|
|
3285
3585
|
(result) => result.path !== null
|
|
@@ -3343,14 +3643,14 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3343
3643
|
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
3344
3644
|
try {
|
|
3345
3645
|
return String(_fs2.default.statSync(_path2.default.join(projectRoot, file)).mtimeMs);
|
|
3346
|
-
} catch (
|
|
3646
|
+
} catch (e35) {
|
|
3347
3647
|
return "-";
|
|
3348
3648
|
}
|
|
3349
3649
|
}).join(":");
|
|
3350
3650
|
const sourceDir = _chunkRE5E2G5Scjs.getFarmProjectSourceDir.call(void 0, projectRoot);
|
|
3351
3651
|
const cacheStamp = `${stamp}:${sourceDir}`;
|
|
3352
3652
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
3353
|
-
if (_optionalChain([cached, 'optionalAccess',
|
|
3653
|
+
if (_optionalChain([cached, 'optionalAccess', _210 => _210.stamp]) === cacheStamp) return cached.aliases;
|
|
3354
3654
|
const aliases = [
|
|
3355
3655
|
...readTsconfigPathAliases(projectRoot),
|
|
3356
3656
|
...readPackageImportAliases(projectRoot)
|
|
@@ -3371,8 +3671,8 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
3371
3671
|
const configPath = _path2.default.join(projectRoot, name);
|
|
3372
3672
|
if (!_fs2.default.existsSync(configPath)) continue;
|
|
3373
3673
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
3374
|
-
if (!_optionalChain([resolved, 'optionalAccess',
|
|
3375
|
-
const
|
|
3674
|
+
if (!_optionalChain([resolved, 'optionalAccess', _211 => _211.paths])) return [];
|
|
3675
|
+
const base2 = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
|
|
3376
3676
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
3377
3677
|
if (!Array.isArray(targets)) return [];
|
|
3378
3678
|
const wildcardIndex = pattern.indexOf("*");
|
|
@@ -3381,7 +3681,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
3381
3681
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
3382
3682
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
3383
3683
|
wildcard: wildcardIndex !== -1,
|
|
3384
|
-
targets: targets.filter((target) => typeof target === "string").map((target) => _path2.default.resolve(
|
|
3684
|
+
targets: targets.filter((target) => typeof target === "string").map((target) => _path2.default.resolve(base2, target))
|
|
3385
3685
|
}
|
|
3386
3686
|
];
|
|
3387
3687
|
});
|
|
@@ -3406,18 +3706,18 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
3406
3706
|
inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
|
|
3407
3707
|
}
|
|
3408
3708
|
const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
|
|
3409
|
-
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess',
|
|
3709
|
+
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _212 => _212.baseUrl]);
|
|
3410
3710
|
if (options.paths && typeof options.paths === "object") {
|
|
3411
3711
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
3412
3712
|
}
|
|
3413
3713
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
3414
3714
|
}
|
|
3415
3715
|
function readPackageImportAliases(projectRoot) {
|
|
3416
|
-
const imports = _optionalChain([readPackageJson, 'call',
|
|
3716
|
+
const imports = _optionalChain([readPackageJson, 'call', _213 => _213(_path2.default.join(projectRoot, "package.json")), 'optionalAccess', _214 => _214.imports]);
|
|
3417
3717
|
if (!imports || typeof imports !== "object") return [];
|
|
3418
3718
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
3419
3719
|
const target = resolveConditionalExportTarget(value);
|
|
3420
|
-
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess',
|
|
3720
|
+
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _215 => _215.startsWith, 'call', _216 => _216("./")])) return [];
|
|
3421
3721
|
const wildcardIndex = pattern.indexOf("*");
|
|
3422
3722
|
return [
|
|
3423
3723
|
{
|
|
@@ -3433,7 +3733,7 @@ function readJsonWithComments(filePath) {
|
|
|
3433
3733
|
let source;
|
|
3434
3734
|
try {
|
|
3435
3735
|
source = _fs2.default.readFileSync(filePath, "utf8");
|
|
3436
|
-
} catch (
|
|
3736
|
+
} catch (e36) {
|
|
3437
3737
|
return null;
|
|
3438
3738
|
}
|
|
3439
3739
|
let output = "";
|
|
@@ -3461,7 +3761,7 @@ function readJsonWithComments(filePath) {
|
|
|
3461
3761
|
}
|
|
3462
3762
|
try {
|
|
3463
3763
|
return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
|
|
3464
|
-
} catch (
|
|
3764
|
+
} catch (e37) {
|
|
3465
3765
|
return null;
|
|
3466
3766
|
}
|
|
3467
3767
|
}
|
|
@@ -3483,15 +3783,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
3483
3783
|
const packageJsonPath = _path2.default.join(packageDirectory, "package.json");
|
|
3484
3784
|
const packageJson = readPackageJson(packageJsonPath);
|
|
3485
3785
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
3486
|
-
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess',
|
|
3786
|
+
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _217 => _217.exports]), exportKey);
|
|
3487
3787
|
const candidates = /* @__PURE__ */ new Set();
|
|
3488
|
-
if (_optionalChain([exportTarget, 'optionalAccess',
|
|
3788
|
+
if (_optionalChain([exportTarget, 'optionalAccess', _218 => _218.startsWith, 'call', _219 => _219("./")])) {
|
|
3489
3789
|
candidates.add(_path2.default.resolve(packageDirectory, exportTarget));
|
|
3490
3790
|
}
|
|
3491
3791
|
if (packageSubpath) {
|
|
3492
3792
|
candidates.add(_path2.default.join(packageDirectory, packageSubpath));
|
|
3493
3793
|
} else {
|
|
3494
|
-
for (const entry of [_optionalChain([packageJson, 'optionalAccess',
|
|
3794
|
+
for (const entry of [_optionalChain([packageJson, 'optionalAccess', _220 => _220.browser]), _optionalChain([packageJson, 'optionalAccess', _221 => _221.module]), _optionalChain([packageJson, 'optionalAccess', _222 => _222.main])]) {
|
|
3495
3795
|
if (typeof entry === "string") candidates.add(_path2.default.resolve(packageDirectory, entry));
|
|
3496
3796
|
}
|
|
3497
3797
|
candidates.add(_path2.default.join(packageDirectory, "index"));
|
|
@@ -3527,7 +3827,7 @@ function findPackageDirectory2(importerPath, packageName, root) {
|
|
|
3527
3827
|
function readPackageJson(packageJsonPath) {
|
|
3528
3828
|
try {
|
|
3529
3829
|
return JSON.parse(_fs2.default.readFileSync(packageJsonPath, "utf8"));
|
|
3530
|
-
} catch (
|
|
3830
|
+
} catch (e38) {
|
|
3531
3831
|
return null;
|
|
3532
3832
|
}
|
|
3533
3833
|
}
|
|
@@ -3556,7 +3856,7 @@ function resolvePackageExport(exportsField, exportKey) {
|
|
|
3556
3856
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
|
|
3557
3857
|
const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
3558
3858
|
const target = resolveConditionalExportTarget(value);
|
|
3559
|
-
return _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
3859
|
+
return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _223 => _223.replace, 'call', _224 => _224("*", wildcard)]), () => ( null));
|
|
3560
3860
|
}
|
|
3561
3861
|
return null;
|
|
3562
3862
|
}
|
|
@@ -3589,7 +3889,7 @@ function resolveSourceCandidate(candidates) {
|
|
|
3589
3889
|
for (const sourcePath of paths) {
|
|
3590
3890
|
try {
|
|
3591
3891
|
if (_fs2.default.statSync(sourcePath).isFile()) return sourcePath;
|
|
3592
|
-
} catch (
|
|
3892
|
+
} catch (e39) {
|
|
3593
3893
|
}
|
|
3594
3894
|
}
|
|
3595
3895
|
}
|
|
@@ -3632,7 +3932,7 @@ function scanFarmPackageImports(directory, root) {
|
|
|
3632
3932
|
let entries;
|
|
3633
3933
|
try {
|
|
3634
3934
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3635
|
-
} catch (
|
|
3935
|
+
} catch (e40) {
|
|
3636
3936
|
return;
|
|
3637
3937
|
}
|
|
3638
3938
|
for (const entry of entries) {
|
|
@@ -3665,7 +3965,7 @@ function collectFarmServerBundledPackageInfo(directory) {
|
|
|
3665
3965
|
let entries;
|
|
3666
3966
|
try {
|
|
3667
3967
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3668
|
-
} catch (
|
|
3968
|
+
} catch (e41) {
|
|
3669
3969
|
return;
|
|
3670
3970
|
}
|
|
3671
3971
|
for (const entry of entries) {
|
|
@@ -3704,7 +4004,7 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
3704
4004
|
let entries;
|
|
3705
4005
|
try {
|
|
3706
4006
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3707
|
-
} catch (
|
|
4007
|
+
} catch (e42) {
|
|
3708
4008
|
return;
|
|
3709
4009
|
}
|
|
3710
4010
|
for (const entry of entries) {
|
|
@@ -3807,26 +4107,34 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3807
4107
|
let projectRoot = process.cwd();
|
|
3808
4108
|
let sources;
|
|
3809
4109
|
const routeSourceFiles = () => {
|
|
3810
|
-
const clientRoutes = _optionalChain([farmApi, 'optionalAccess',
|
|
3811
|
-
if (_optionalChain([sources, 'optionalAccess',
|
|
4110
|
+
const clientRoutes = _optionalChain([farmApi, 'optionalAccess', _225 => _225.getProgrammaticClientRoutes, 'call', _226 => _226()]);
|
|
4111
|
+
if (_optionalChain([sources, 'optionalAccess', _227 => _227.for]) !== clientRoutes || !sources) {
|
|
3812
4112
|
sources = {
|
|
3813
4113
|
for: clientRoutes,
|
|
3814
4114
|
files: /* @__PURE__ */ new Set([
|
|
3815
4115
|
...routesFiles,
|
|
3816
|
-
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess',
|
|
4116
|
+
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess', _228 => _228.routeSourceFiles]), () => ( []))].map(resolvedFile)
|
|
3817
4117
|
])
|
|
3818
4118
|
};
|
|
3819
4119
|
}
|
|
3820
4120
|
return sources.files;
|
|
3821
4121
|
};
|
|
3822
|
-
const
|
|
4122
|
+
const relativeFile = (file) => _path2.default.isAbsolute(file) ? _path2.default.relative(projectRoot, file).replace(/\\/g, "/") || file : file;
|
|
4123
|
+
const routeSourceError = (file, importers = []) => formatFarmDiagnostic(
|
|
4124
|
+
createFarmDiagnostic(
|
|
4125
|
+
"CLIENT_ROUTES_FILE",
|
|
4126
|
+
file,
|
|
4127
|
+
"This module defines programmatic routes, but the browser bundle imports it" + (importers.length > 0 ? ` (from ${importers.map(relativeFile).join(", ")})` : "") + ". Routes files and the modules that define routes carry server-only guards, data hooks, and API handlers, so they never reach the browser."
|
|
4128
|
+
),
|
|
4129
|
+
projectRoot
|
|
4130
|
+
);
|
|
3823
4131
|
return {
|
|
3824
4132
|
name: "farm:environment-functions",
|
|
3825
4133
|
enforce: "post",
|
|
3826
4134
|
configResolved(config) {
|
|
3827
4135
|
isBuild = config.command === "build";
|
|
3828
4136
|
projectRoot = config.root;
|
|
3829
|
-
farmApi = _optionalChain([config, 'access',
|
|
4137
|
+
farmApi = _optionalChain([config, 'access', _229 => _229.plugins, 'access', _230 => _230.find, 'call', _231 => _231((plugin) => plugin.name === "farm"), 'optionalAccess', _232 => _232.api]);
|
|
3830
4138
|
sources = void 0;
|
|
3831
4139
|
routesFiles = new Set(
|
|
3832
4140
|
_chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
|
|
@@ -3839,22 +4147,35 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3839
4147
|
transform(code, id, transformOptions) {
|
|
3840
4148
|
const environment = resolveBuildEnvironment(
|
|
3841
4149
|
this,
|
|
3842
|
-
_optionalChain([transformOptions, 'optionalAccess',
|
|
4150
|
+
_optionalChain([transformOptions, 'optionalAccess', _233 => _233.ssr])
|
|
3843
4151
|
);
|
|
3844
|
-
const
|
|
3845
|
-
const result = transformEnvironmentFunctions({ code, id, environment, parse:
|
|
4152
|
+
const parse3 = (source) => this.parse(source);
|
|
4153
|
+
const result = transformEnvironmentFunctions({ code, id, environment, parse: parse3 });
|
|
3846
4154
|
if (environment === "client" && !isBuild && !_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
|
|
3847
4155
|
this.error(routeSourceError(moduleFile(id)));
|
|
3848
4156
|
}
|
|
3849
|
-
if (environment === "server" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access',
|
|
4157
|
+
if (environment === "server" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access', _234 => _234.experimental, 'optionalAccess', _235 => _235.serverComponents])) === "islands" && isApplicationScript(id)) {
|
|
3850
4158
|
const file = id.split("?", 1)[0];
|
|
3851
4159
|
const root = _fs.realpathSync.call(void 0, _nullishCoalesce(options.root, () => ( projectRoot)));
|
|
3852
4160
|
const clientCode = getFarmClientReachableModules(root, root).has(_path2.default.resolve(file)) || _fs.existsSync.call(void 0, file) && hasUseClientDirective(_fs.readFileSync.call(void 0, file, "utf8"));
|
|
3853
4161
|
const reached = clientCode ? null : findFarmClientOnlyImport(code, file);
|
|
3854
4162
|
if (reached) {
|
|
3855
|
-
const chain = reached.chain.map((step) => _path2.default.relative(root, step)).join(" -> ");
|
|
4163
|
+
const chain = reached.chain.map((step) => _path2.default.relative(root, step).replace(/\\/g, "/")).join(" -> ");
|
|
4164
|
+
const importMatch = new RegExp(
|
|
4165
|
+
String.raw`\b(?:from|import)\s*["']` + reached.specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + `["']`
|
|
4166
|
+
).exec(code);
|
|
4167
|
+
const importAt = importMatch ? importMatch.index + importMatch[0].search(/["']/) : void 0;
|
|
4168
|
+
const locate = createFarmSourceLocator(code, () => this.getCombinedSourcemap());
|
|
3856
4169
|
this.error(
|
|
3857
|
-
|
|
4170
|
+
formatFarmDiagnostic(
|
|
4171
|
+
createFarmDiagnostic(
|
|
4172
|
+
"SERVER_CLIENT_ONLY_IMPORT",
|
|
4173
|
+
file,
|
|
4174
|
+
`This module is server code, but its import of "${reached.specifier}" reaches "client-only" (${chain}), so that package can only run in the browser.`,
|
|
4175
|
+
importAt === void 0 ? void 0 : locate(importAt)
|
|
4176
|
+
),
|
|
4177
|
+
root
|
|
4178
|
+
)
|
|
3858
4179
|
);
|
|
3859
4180
|
}
|
|
3860
4181
|
}
|
|
@@ -3867,19 +4188,26 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3867
4188
|
for (const id of this.getModuleIds()) {
|
|
3868
4189
|
if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
|
|
3869
4190
|
const chain = findClientNodeBuiltinChain(id, (moduleId) => {
|
|
3870
|
-
return _optionalChain([this, 'access',
|
|
4191
|
+
return _optionalChain([this, 'access', _236 => _236.getModuleInfo, 'call', _237 => _237(moduleId), 'optionalAccess', _238 => _238.importedIds]);
|
|
3871
4192
|
});
|
|
3872
4193
|
if (chain) {
|
|
3873
4194
|
this.error(
|
|
3874
|
-
|
|
4195
|
+
formatFarmDiagnostic(
|
|
4196
|
+
createFarmDiagnostic(
|
|
4197
|
+
"CLIENT_ROUTE_SERVER_IMPORT",
|
|
4198
|
+
moduleFile(id),
|
|
4199
|
+
`The browser bundle reaches the server-only module "${chain.at(-1)}" through this programmatic route module: ${chain.map((step) => relativeFile(moduleFile(step))).join(" -> ")}.`
|
|
4200
|
+
),
|
|
4201
|
+
projectRoot
|
|
4202
|
+
)
|
|
3875
4203
|
);
|
|
3876
4204
|
}
|
|
3877
4205
|
continue;
|
|
3878
4206
|
}
|
|
3879
4207
|
if (!forbidden.has(moduleFile(id))) continue;
|
|
3880
4208
|
const info = this.getModuleInfo(id);
|
|
3881
|
-
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess',
|
|
3882
|
-
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess',
|
|
4209
|
+
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _239 => _239.code]))) continue;
|
|
4210
|
+
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _240 => _240.importers, 'access', _241 => _241.map, 'call', _242 => _242(moduleFile)])));
|
|
3883
4211
|
}
|
|
3884
4212
|
}
|
|
3885
4213
|
};
|
|
@@ -3893,13 +4221,13 @@ function moduleFile(id) {
|
|
|
3893
4221
|
function resolvedFile(filePath) {
|
|
3894
4222
|
try {
|
|
3895
4223
|
return moduleFile(_fs.realpathSync.call(void 0, filePath));
|
|
3896
|
-
} catch (
|
|
4224
|
+
} catch (e43) {
|
|
3897
4225
|
return moduleFile(filePath);
|
|
3898
4226
|
}
|
|
3899
4227
|
}
|
|
3900
4228
|
function resolveBuildEnvironment(context, ssr) {
|
|
3901
|
-
if (_optionalChain([context, 'access',
|
|
3902
|
-
if (_optionalChain([context, 'access',
|
|
4229
|
+
if (_optionalChain([context, 'access', _243 => _243.environment, 'optionalAccess', _244 => _244.name]) === "client") return "client";
|
|
4230
|
+
if (_optionalChain([context, 'access', _245 => _245.environment, 'optionalAccess', _246 => _246.name]) === "rsc" || _optionalChain([context, 'access', _247 => _247.environment, 'optionalAccess', _248 => _248.name]) === "ssr") {
|
|
3903
4231
|
return "server";
|
|
3904
4232
|
}
|
|
3905
4233
|
return ssr ? "server" : "client";
|
|
@@ -4209,4 +4537,14 @@ function transformError(id, message) {
|
|
|
4209
4537
|
|
|
4210
4538
|
|
|
4211
4539
|
|
|
4212
|
-
|
|
4540
|
+
|
|
4541
|
+
|
|
4542
|
+
|
|
4543
|
+
|
|
4544
|
+
|
|
4545
|
+
|
|
4546
|
+
|
|
4547
|
+
|
|
4548
|
+
|
|
4549
|
+
|
|
4550
|
+
exports.FARM_BROWSER_BUILTIN_PREFIX = FARM_BROWSER_BUILTIN_PREFIX; exports.resolveFarmBrowserBuiltin = resolveFarmBrowserBuiltin; exports.loadFarmBrowserBuiltin = loadFarmBrowserBuiltin; exports.farmBrowserBuiltinsOptimizerPlugin = farmBrowserBuiltinsOptimizerPlugin; exports.programmaticClientRouteKey = programmaticClientRouteKey; exports.resolveProgrammaticClientRoutes = resolveProgrammaticClientRoutes; exports.createEvaluatedRouteGraph = createEvaluatedRouteGraph; exports.mergeProgrammaticClientRoutes = mergeProgrammaticClientRoutes; exports.generateProgrammaticClientRouteModule = generateProgrammaticClientRouteModule; exports.getFarmSourceStamp = getFarmSourceStamp; exports.FarmSourceSnapshotStore = FarmSourceSnapshotStore; exports.withFarmSourceSnapshot = withFarmSourceSnapshot; exports.withFarmSourceSnapshotOf = withFarmSourceSnapshotOf; exports.traceFarmSourceReads = traceFarmSourceReads; exports.rewriteFarmReactServerClientModuleImports = rewriteFarmReactServerClientModuleImports; exports.rewriteFarmReactServerImports = rewriteFarmReactServerImports; exports.invalidateFarmClientOnlyScan = invalidateFarmClientOnlyScan; exports.farmRelativeImportFiles = farmRelativeImportFiles; exports.FARM_CLIENT_REFERENCE_PRAGMA = FARM_CLIENT_REFERENCE_PRAGMA; exports.FARM_CLIENT_REFERENCE_DIRECTORY = FARM_CLIENT_REFERENCE_DIRECTORY; exports.FARM_RESOLVE_FROM_PREFIX = FARM_RESOLVE_FROM_PREFIX; exports.parseFarmResolveFrom = parseFarmResolveFrom; exports.ensureFarmPackageClientReference = ensureFarmPackageClientReference; exports.ensureFarmInternalClientReference = ensureFarmInternalClientReference; exports.rewriteFarmPackageClientImports = rewriteFarmPackageClientImports; exports.farmIslandContainerReferencePath = farmIslandContainerReferencePath; exports.ensureFarmIslandContainerReference = ensureFarmIslandContainerReference; exports.wrapFarmIslandContainers = wrapFarmIslandContainers; exports.withPackageClientBoundaryCache = withPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolvePackageClientBoundaryCacheFile = resolvePackageClientBoundaryCacheFile; exports.runWithPackageClientBoundaryCacheFile = runWithPackageClientBoundaryCacheFile; exports.runWithLatestPackageClientBoundaryCache = runWithLatestPackageClientBoundaryCache; exports.dropLatestPackageClientBoundaryCache = dropLatestPackageClientBoundaryCache; exports.resolveModuleSourcePath = resolveModuleSourcePath; exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.hasUseClientDirective = hasUseClientDirective; exports.getIslandStrategyExport = getIslandStrategyExport; exports.stripUseClientDirective = stripUseClientDirective; exports.getFarmClientRenderingBindings = getFarmClientRenderingBindings; exports.collectFarmRenderedClientModules = collectFarmRenderedClientModules; exports.collectFarmServerStylesheets = collectFarmServerStylesheets; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlanKey = getClientModuleHydrationPlanKey; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.isFarmClientModulePlanUnchanged = isFarmClientModulePlanUnchanged; exports.resolveImportedModule = resolveImportedModule; exports.isFarmPackageClientBoundary = isFarmPackageClientBoundary; exports.collectFarmClientPackageImports = collectFarmClientPackageImports; exports.collectFarmServerBundledPackageInfo = collectFarmServerBundledPackageInfo; exports.invalidateFarmClientReachableModules = invalidateFarmClientReachableModules; exports.getFarmClientReachableModules = getFarmClientReachableModules; exports.resolveFarmClientOptimizeDeps = resolveFarmClientOptimizeDeps; exports.createFarmDiagnostic = createFarmDiagnostic; exports.formatFarmDiagnostic = formatFarmDiagnostic; exports.createFarmSourceLocator = createFarmSourceLocator; exports.transformEnvironmentFunctions = transformEnvironmentFunctions; exports.farmEnvironmentFunctionsPlugin = farmEnvironmentFunctionsPlugin;
|