@farm.js/core 0.1.39 → 0.1.41
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-HcTYQmNX.d.ts → agent-mcp-BOqIxJLI.d.mts} +8 -2
- package/dist/{agent-mcp-BhneNPb4.d.mts → agent-mcp-D0eZKfci.d.ts} +8 -2
- package/dist/{agent-mcp-handler-OLRMZONF.mjs → agent-mcp-handler-HVV5LNXF.mjs} +6 -6
- package/dist/{agent-mcp-handler-MRGP3WJ3.cjs → agent-mcp-handler-YKG7KVCY.cjs} +7 -7
- package/dist/agent-runtime.cjs +10 -6
- package/dist/agent-runtime.d.mts +6 -8
- package/dist/agent-runtime.d.ts +6 -8
- package/dist/agent-runtime.mjs +9 -5
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.d.mts +3 -3
- package/dist/api/client.d.ts +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +15 -13
- package/dist/api/route-manager.d.mts +8 -10
- package/dist/api/route-manager.d.ts +8 -10
- package/dist/api/route-manager.mjs +14 -12
- package/dist/api/runtime.cjs +12 -10
- package/dist/api/runtime.d.mts +7 -9
- package/dist/api/runtime.d.ts +7 -9
- package/dist/api/runtime.mjs +11 -9
- package/dist/{api-client-CyFtZFJ4.d.ts → api-client-BJv9mTbO.d.ts} +2 -2
- package/dist/{api-client-BjMmY8OD.d.mts → api-client-Dk9QOLwr.d.mts} +2 -2
- package/dist/api.cjs +17 -15
- package/dist/api.d.mts +10 -12
- package/dist/api.d.ts +10 -12
- package/dist/api.mjs +16 -14
- package/dist/{app-DVzmmbNO.d.mts → app-CzTSMJaf.d.mts} +12 -5
- package/dist/{app-CMkoghtp.d.ts → app-DM8e1z3G.d.ts} +12 -5
- package/dist/app-markdown.cjs +7 -6
- package/dist/app-markdown.d.mts +7 -9
- package/dist/app-markdown.d.ts +7 -9
- package/dist/app-markdown.mjs +6 -5
- package/dist/cache.cjs +6 -3
- package/dist/cache.d.mts +23 -2
- package/dist/cache.d.ts +23 -2
- package/dist/cache.mjs +5 -2
- package/dist/{chunk-EGCTIS5F.mjs → chunk-24SP5TGU.mjs} +1 -1
- package/dist/{chunk-2ZYGC6SS.cjs → chunk-25LPIZSX.cjs} +3 -3
- package/dist/{chunk-ARC7I3O2.mjs → chunk-26RUNDIR.mjs} +1 -1
- package/dist/{chunk-472NCAZ7.cjs → chunk-2FUIT2G2.cjs} +3 -3
- package/dist/{chunk-YFYUYWL7.cjs → chunk-32TZ3QTP.cjs} +723 -454
- package/dist/{chunk-CQMVIOYP.mjs → chunk-35WS7P2V.mjs} +29 -131
- package/dist/{chunk-QTXBII4Z.cjs → chunk-3TB5QGUW.cjs} +5 -5
- package/dist/chunk-45QJHGZM.cjs +1063 -0
- package/dist/{chunk-677THUVP.mjs → chunk-4C7KTKX7.mjs} +1 -1
- package/dist/{chunk-FUZEBRP3.mjs → chunk-4GP3XZ4Z.mjs} +5 -3
- package/dist/{chunk-KTSUBU2E.mjs → chunk-4KQDHTWX.mjs} +2 -2
- package/dist/chunk-4TLUFAIP.cjs +92 -0
- package/dist/chunk-4U5XZDLG.cjs +80 -0
- package/dist/{chunk-P664ZVTV.mjs → chunk-4ZZNPK25.mjs} +2 -2
- package/dist/{chunk-KIIMAWOJ.cjs → chunk-5NAVKJCZ.cjs} +35 -105
- package/dist/{chunk-LSKZMJMP.cjs → chunk-64SBBZDU.cjs} +38 -1
- package/dist/chunk-6BWKJ6QS.cjs +43 -0
- package/dist/{chunk-JSROZYYO.cjs → chunk-6D24SDKO.cjs} +1 -20
- package/dist/chunk-6IZWX6ES.cjs +74 -0
- package/dist/{chunk-QRKIMN7T.mjs → chunk-6LVRDOAW.mjs} +32 -6
- package/dist/{chunk-YWN746US.cjs → chunk-6MVFHNYZ.cjs} +85 -54
- package/dist/{chunk-VWBHM3F6.mjs → chunk-6PKXK4TY.mjs} +3 -3
- package/dist/chunk-6QOLZITB.cjs +22 -0
- package/dist/{chunk-OAHTRMIC.mjs → chunk-724JLMS4.mjs} +11 -11
- package/dist/chunk-7GNWGLWB.mjs +14 -0
- package/dist/{chunk-34UCJRQO.cjs → chunk-7RNAKBWF.cjs} +2 -2
- package/dist/{chunk-U6QLDL3G.mjs → chunk-7UEEHAW7.mjs} +1 -1
- package/dist/{chunk-UPJLHLJU.cjs → chunk-ALPWLT27.cjs} +4 -4
- package/dist/{chunk-ATSDUUFK.mjs → chunk-AX7S67YV.mjs} +33 -40
- package/dist/{chunk-MSSFIQGM.mjs → chunk-B2GSRB3P.mjs} +41 -10
- package/dist/chunk-BGGWKZ2V.mjs +6096 -0
- package/dist/{chunk-H5CLOUZS.cjs → chunk-BMOBTMDR.cjs} +5 -5
- package/dist/{chunk-Q2KB32T4.mjs → chunk-BPNRQ5BA.mjs} +6 -6
- package/dist/{chunk-E2ROOWQC.cjs → chunk-BPOTSHDO.cjs} +24 -87
- package/dist/chunk-BRYPZIMB.mjs +6 -0
- package/dist/{chunk-WFRT7JPX.mjs → chunk-BYQVROIP.mjs} +2 -2
- package/dist/{chunk-HALDNTIV.mjs → chunk-BYR3RQPB.mjs} +10 -73
- package/dist/{chunk-5PWXMJOH.cjs → chunk-C5KVWHIH.cjs} +36 -36
- package/dist/chunk-CALY6QG6.mjs +963 -0
- package/dist/{chunk-WC5UV2HQ.cjs → chunk-CBXBGM72.cjs} +2 -2
- package/dist/{chunk-WW46B6HA.cjs → chunk-CGR525MJ.cjs} +84 -45
- package/dist/{chunk-6V4TDWEC.cjs → chunk-CGVPXIRN.cjs} +18 -1
- package/dist/chunk-COABSY3U.mjs +196 -0
- package/dist/chunk-CZS6OACQ.mjs +63 -0
- package/dist/{chunk-SGBJ247Q.cjs → chunk-D4ROBNTK.cjs} +2 -2
- package/dist/{chunk-WEW2JVA4.cjs → chunk-D5IHNDHI.cjs} +6 -6
- package/dist/{chunk-QG775BRV.cjs → chunk-D64OPY6A.cjs} +72 -54
- package/dist/{chunk-QUCXCDE2.cjs → chunk-EH3464KF.cjs} +1 -1
- package/dist/{chunk-75HN5IZ3.mjs → chunk-ENOBPDKZ.mjs} +21 -19
- package/dist/{chunk-HD5CF3OE.mjs → chunk-ETPEZLS3.mjs} +2 -2
- package/dist/{chunk-HRETEZ2Z.cjs → chunk-EX4MKHXN.cjs} +37 -35
- package/dist/{chunk-TO4GJ56K.cjs → chunk-FEYQCYT7.cjs} +58 -18
- package/dist/chunk-FGH3ZXTP.mjs +1063 -0
- package/dist/{chunk-CUM5NYL5.mjs → chunk-FIAPD365.mjs} +1 -1
- package/dist/{chunk-HYTZYOW2.mjs → chunk-FJGIVDA5.mjs} +1197 -7906
- package/dist/chunk-FVPXT2JR.cjs +63 -0
- package/dist/{chunk-MYIZXDZA.mjs → chunk-FWCGUVVL.mjs} +1 -1
- package/dist/{chunk-D2ULAULS.cjs → chunk-FXFKIJDA.cjs} +9 -7
- package/dist/{chunk-RW63BOV7.cjs → chunk-GB7LDGY5.cjs} +2 -2
- package/dist/chunk-GC3EM6H4.mjs +80 -0
- package/dist/{chunk-E3UK5IIB.cjs → chunk-GS3WR5HX.cjs} +5 -3
- package/dist/{chunk-QFW2IH5E.mjs → chunk-GZTUT75U.mjs} +5 -2
- package/dist/chunk-H3EGVQE5.mjs +22 -0
- package/dist/chunk-HANGSYMB.mjs +67 -0
- package/dist/{chunk-RSOJ7DRT.mjs → chunk-HCSVR4YZ.mjs} +1 -58
- package/dist/{chunk-QYMZOOC5.mjs → chunk-HJ64F4GS.mjs} +12 -44
- package/dist/{chunk-P3PLW4FR.mjs → chunk-HKFBMHCD.mjs} +4 -4
- package/dist/{chunk-BXDJXFQG.cjs → chunk-I5MG3TKE.cjs} +4 -4
- package/dist/{chunk-VNGH5MLF.mjs → chunk-I6UVKUYK.mjs} +1 -1
- package/dist/{chunk-EPYU2EBL.mjs → chunk-IF4NU2NG.mjs} +1 -1
- package/dist/{chunk-WXJLNP33.cjs → chunk-IFWSR7YZ.cjs} +9 -7
- package/dist/{chunk-IVLZZZEI.mjs → chunk-IM7DY3ED.mjs} +1 -1
- package/dist/{chunk-W36M2BQ4.mjs → chunk-IN6RCKLL.mjs} +6 -5
- package/dist/{chunk-F5QO4FNE.mjs → chunk-INQ64HTJ.mjs} +43 -11
- package/dist/{chunk-SDOTRX3V.cjs → chunk-JEIG3EWE.cjs} +8 -8
- package/dist/{chunk-UWPLULNK.mjs → chunk-JGHCKIRI.mjs} +84 -24
- package/dist/{chunk-BFJTHYTN.mjs → chunk-JIYYX7WU.mjs} +10 -8
- package/dist/{chunk-CIOT4HGT.cjs → chunk-JOTUZIM4.cjs} +14 -14
- package/dist/{chunk-SKVTP5PR.mjs → chunk-JOW4HDJO.mjs} +1 -62
- package/dist/{chunk-6MVFL3R5.cjs → chunk-JR4QCLJY.cjs} +1 -58
- package/dist/{chunk-CGBDNNSM.cjs → chunk-KEXK442I.cjs} +44 -12
- package/dist/{chunk-FUCSUGDM.cjs → chunk-KF6VDJH7.cjs} +3 -3
- package/dist/{chunk-EA5K5BKU.mjs → chunk-KNHBTJP6.mjs} +18 -1
- package/dist/{chunk-MVL2RAJW.mjs → chunk-KYN5ODF6.mjs} +1 -1
- package/dist/{chunk-LMPAPBUA.cjs → chunk-L6A26QT5.cjs} +36 -68
- package/dist/{chunk-RVXFINNS.cjs → chunk-L6HYACBE.cjs} +31 -31
- package/dist/chunk-LFHCG2DU.mjs +43 -0
- package/dist/{chunk-5OKBARDN.cjs → chunk-LIZTLA5F.cjs} +12 -11
- package/dist/{chunk-HXRYZWTA.mjs → chunk-LLUA2LSC.mjs} +3 -3
- package/dist/{chunk-B5J2YVG7.cjs → chunk-LYIZHJTK.cjs} +2 -2
- package/dist/{chunk-3UEVPCGW.mjs → chunk-MEASUNVY.mjs} +6 -1
- package/dist/{chunk-FZ6YYU2W.mjs → chunk-MGMF4VP7.mjs} +38 -1
- package/dist/{chunk-CNNOLE4O.mjs → chunk-MHHCLYXU.mjs} +1 -1
- package/dist/{chunk-HRSAQ23K.cjs → chunk-MHN4UR5U.cjs} +4 -4
- package/dist/{chunk-3LOLJTFV.cjs → chunk-MN4TQJ3W.cjs} +11 -11
- package/dist/{chunk-PGZDEPTM.cjs → chunk-MY5PZYAD.cjs} +10 -10
- package/dist/{chunk-ZXH4TS3F.cjs → chunk-NBPNUQYO.cjs} +3 -64
- package/dist/{chunk-VXEEATVD.cjs → chunk-NFG4PUPI.cjs} +2 -2
- package/dist/{chunk-INL3THCU.mjs → chunk-O7USYJ4U.mjs} +1 -1
- package/dist/{chunk-4ZFL5GFN.cjs → chunk-OILHPMFX.cjs} +86 -26
- package/dist/{chunk-AJQTP4OO.mjs → chunk-OJ7JP7RJ.mjs} +1 -1
- package/dist/chunk-OQ4YXWH4.cjs +6097 -0
- package/dist/{chunk-DMEPTZTI.mjs → chunk-P2UJF4SS.mjs} +47 -7
- package/dist/{chunk-T5OJPTVN.cjs → chunk-P4TYB4SF.cjs} +2 -2
- package/dist/chunk-P7XDC7UJ.mjs +92 -0
- package/dist/{chunk-SHLXACIO.cjs → chunk-PJ42JESY.cjs} +1 -9
- package/dist/{chunk-5ULKUBIA.cjs → chunk-PN676AZF.cjs} +6 -6
- package/dist/{chunk-YKZRDB5Z.mjs → chunk-PYHPXPSW.mjs} +2 -2
- package/dist/{chunk-KMTGADN3.mjs → chunk-QCVIRVHE.mjs} +1 -9
- package/dist/{chunk-5D2JIPLH.cjs → chunk-QEILRWVV.cjs} +36 -138
- package/dist/{chunk-XKG2BLFN.cjs → chunk-QIBP5EFA.cjs} +18 -35
- package/dist/{chunk-ZUPXLIGB.mjs → chunk-R65GCA6A.mjs} +647 -378
- package/dist/{chunk-BWIQR4DH.cjs → chunk-RHGK2JEN.cjs} +56 -63
- package/dist/{chunk-AS2VPMEE.cjs → chunk-ROQ4C4LJ.cjs} +1465 -8174
- package/dist/{chunk-QV4VE2OW.mjs → chunk-S6ENKNNG.mjs} +5 -3
- package/dist/{chunk-RWFLWR5J.cjs → chunk-S7MTDRYA.cjs} +17 -15
- package/dist/{chunk-PVZE2JGJ.mjs → chunk-SGB4IW7K.mjs} +43 -25
- package/dist/{chunk-GKBWWRBG.mjs → chunk-SVPGWJZF.mjs} +12 -12
- package/dist/{chunk-EKN7NSZO.cjs → chunk-SZLNU3GJ.cjs} +8 -5
- package/dist/chunk-TI7UANHI.cjs +77 -0
- package/dist/{chunk-6BK3K2GB.mjs → chunk-UIDWEU7M.mjs} +83 -44
- package/dist/{chunk-MLY2RP5R.mjs → chunk-ULQOP5UI.mjs} +6 -2
- package/dist/chunk-UNJZGVPU.cjs +6 -0
- package/dist/{chunk-5BWWFHR2.mjs → chunk-UQUEANTY.mjs} +3 -3
- package/dist/chunk-VDRM36QB.cjs +963 -0
- package/dist/chunk-VHRS3MCW.cjs +196 -0
- package/dist/{chunk-SOP2EAA6.mjs → chunk-VLPII2JJ.mjs} +1 -1
- package/dist/{chunk-RG4A6LB2.cjs → chunk-VNPXKF3G.cjs} +7 -7
- package/dist/chunk-VQDBNVOO.cjs +14 -0
- package/dist/chunk-VQGKD7RV.mjs +25 -0
- package/dist/{chunk-6HB6V3R7.mjs → chunk-VTBXE6QG.mjs} +10 -27
- package/dist/{chunk-ZMSZZXOR.mjs → chunk-WDMIW6Q6.mjs} +0 -19
- package/dist/{chunk-NBBEQLOK.cjs → chunk-WLHA5USH.cjs} +9 -9
- package/dist/{chunk-BZHXGVMA.mjs → chunk-WMBRZI5V.mjs} +5 -3
- package/dist/{chunk-4WVJLURN.mjs → chunk-WMHG64DA.mjs} +1 -1
- package/dist/{chunk-JCYYXBAJ.cjs → chunk-WROEFVNO.cjs} +3 -3
- package/dist/{chunk-A657YSP4.cjs → chunk-WSOBCAYO.cjs} +37 -35
- package/dist/{chunk-IWZKTWHZ.cjs → chunk-WU7ZS3EM.cjs} +7 -2
- package/dist/{chunk-J63ZH5OQ.cjs → chunk-X3GMHKO3.cjs} +2 -2
- package/dist/{chunk-POSPE3IO.mjs → chunk-X3NGFVRF.mjs} +61 -21
- package/dist/{chunk-VT4WFRHA.mjs → chunk-XUC6CFLE.mjs} +1 -1
- package/dist/chunk-Y5RG6B7S.mjs +77 -0
- package/dist/{chunk-EIPC3FDA.cjs → chunk-YWCYV7QC.cjs} +9 -5
- package/dist/{chunk-WLL43JMO.mjs → chunk-YYQVGKO5.mjs} +7 -5
- package/dist/chunk-YZAKIXRL.cjs +67 -0
- package/dist/chunk-ZQRCSUSB.cjs +25 -0
- package/dist/{chunk-6XWDE2P2.cjs → chunk-ZTP3BJG6.cjs} +64 -24
- package/dist/{chunk-ZMMBIVQM.mjs → chunk-ZZGQD7A4.mjs} +16 -86
- package/dist/{client-plugins-CsCuCLBz.d.mts → client-plugins-CkYwvDJ0.d.mts} +2545 -2665
- package/dist/{client-plugins-D0ke-Hc8.d.ts → client-plugins-DfeKd0sD.d.ts} +2545 -2665
- package/dist/client-plugins.d.mts +6 -8
- package/dist/client-plugins.d.ts +6 -8
- package/dist/client.cjs +5 -5
- package/dist/client.d.mts +12 -13
- package/dist/client.d.ts +12 -13
- package/dist/client.mjs +4 -4
- package/dist/client.react-server.mjs +2 -0
- package/dist/config.d.mts +6 -8
- package/dist/config.d.ts +6 -8
- package/dist/{devtools-LW4QQ5J3.cjs → devtools-2YHAJYH6.cjs} +21 -18
- package/dist/{devtools-5AFIPVUJ.mjs → devtools-N3QLRIQU.mjs} +20 -17
- package/dist/docs.cjs +23 -20
- package/dist/docs.d.mts +7 -9
- package/dist/docs.d.ts +7 -9
- package/dist/docs.mjs +22 -19
- package/dist/{endpoint-CA-TNX60.d.ts → endpoint-BOE0IAaG.d.ts} +6 -3
- package/dist/{endpoint-CCHFqyTE.d.mts → endpoint-DGZRZHux.d.mts} +6 -3
- package/dist/environment/vite.cjs +6 -2
- package/dist/environment/vite.d.mts +11 -2
- package/dist/environment/vite.d.ts +11 -2
- package/dist/environment/vite.mjs +5 -1
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/image/server.cjs +7 -3
- package/dist/image/server.d.mts +10 -2
- package/dist/image/server.d.ts +10 -2
- package/dist/image/server.mjs +6 -2
- package/dist/image/sharp.cjs +12 -10
- package/dist/image/sharp.d.mts +1 -1
- package/dist/image/sharp.d.ts +1 -1
- package/dist/image/sharp.mjs +4 -2
- package/dist/{image-config-Duob7wER.d.ts → image-config-BpH1q5R8.d.mts} +4 -1
- package/dist/{image-config-Duob7wER.d.mts → image-config-BpH1q5R8.d.ts} +4 -1
- package/dist/image.d.mts +1 -1
- package/dist/image.d.ts +1 -1
- package/dist/index.cjs +90 -68
- package/dist/index.d.mts +28 -145
- package/dist/index.d.ts +28 -145
- package/dist/index.mjs +103 -81
- package/dist/{integration-api-BPJo5oXb.d.ts → integration-api-BuPHMeKz.d.ts} +2 -2
- package/dist/{integration-api-0y4FXJpC.d.mts → integration-api-DWyMmvrR.d.mts} +2 -2
- package/dist/integration-orm-P2II2EBK.cjs +14 -0
- package/dist/{integration-orm-KV5B3BGZ.mjs → integration-orm-RBKCIQYZ.mjs} +4 -3
- package/dist/integrations.cjs +7 -5
- package/dist/integrations.d.mts +8 -10
- package/dist/integrations.d.ts +8 -10
- package/dist/integrations.mjs +6 -4
- package/dist/internal/app-markdown-runtime.cjs +6 -5
- package/dist/internal/app-markdown-runtime.d.mts +7 -9
- package/dist/internal/app-markdown-runtime.d.ts +7 -9
- package/dist/internal/app-markdown-runtime.mjs +5 -4
- package/dist/internal/build-runtime.cjs +57 -56
- package/dist/internal/build-runtime.d.mts +8 -10
- package/dist/internal/build-runtime.d.ts +8 -10
- package/dist/internal/build-runtime.mjs +56 -55
- package/dist/internal/cli-runtime.cjs +37 -31
- package/dist/internal/cli-runtime.mjs +37 -31
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +6 -8
- package/dist/internal/compression-runtime.d.ts +6 -8
- package/dist/internal/config-runtime.cjs +21 -18
- package/dist/internal/config-runtime.d.mts +7 -9
- package/dist/internal/config-runtime.d.ts +7 -9
- package/dist/internal/config-runtime.mjs +20 -17
- package/dist/internal/docs-precompiled-runtime.cjs +3 -3
- package/dist/internal/docs-precompiled-runtime.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +7 -7
- package/dist/internal/infra-analytics-runtime.mjs +5 -5
- package/dist/internal/metadata-image-runtime.cjs +4 -3
- package/dist/internal/metadata-image-runtime.mjs +3 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-node-env.cjs +2 -2
- package/dist/internal/production-node-env.mjs +1 -1
- package/dist/internal/production-runtime.cjs +53 -28
- package/dist/internal/production-runtime.d.mts +46 -15
- package/dist/internal/production-runtime.d.ts +46 -15
- package/dist/internal/production-runtime.mjs +57 -32
- package/dist/layers-CM5i6T7z.d.mts +55 -0
- package/dist/layers-CM5i6T7z.d.ts +55 -0
- package/dist/markdown.cjs +4 -4
- package/dist/markdown.d.mts +6 -8
- package/dist/markdown.d.ts +6 -8
- package/dist/markdown.mjs +3 -3
- package/dist/middleware.cjs +16 -10
- package/dist/middleware.d.mts +8 -10
- package/dist/middleware.d.ts +8 -10
- package/dist/middleware.mjs +19 -13
- package/dist/navigation.cjs +4 -4
- package/dist/navigation.d.mts +9 -10
- package/dist/navigation.d.ts +9 -10
- package/dist/navigation.mjs +3 -3
- package/dist/{nitro-MPZJGPXK.mjs → nitro-KDACKNHU.mjs} +3 -2
- package/dist/{nitro-7F65EZZS.cjs → nitro-NPGU6VBT.cjs} +4 -3
- package/dist/observability.cjs +2 -2
- package/dist/observability.mjs +1 -1
- package/dist/plugin-DBBZ4JI2.cjs +32 -0
- package/dist/plugin-SYMK7PQ2.mjs +32 -0
- package/dist/plugin.cjs +56 -43
- package/dist/plugin.d.mts +25 -8
- package/dist/plugin.d.ts +25 -8
- package/dist/plugin.mjs +57 -44
- package/dist/{production-runtime-DfRP0cV0.d.mts → production-runtime-BTkXQdYy.d.mts} +17 -3
- package/dist/{production-runtime-BaI3WHnV.d.ts → production-runtime-DFC7pgbp.d.ts} +17 -3
- package/dist/query/client.cjs +2 -2
- package/dist/query/client.mjs +3 -3
- package/dist/{render-plan-Dg8RBYFa.d.mts → render-plan-5rFeWmk7.d.mts} +1 -1
- package/dist/{render-plan-CfIdJKAf.d.ts → render-plan-BoAK9xFC.d.ts} +1 -1
- package/dist/renderer-client.d.mts +8 -9
- package/dist/renderer-client.d.ts +8 -9
- package/dist/{request-DfE02G_A.d.mts → request-BxBWigtl.d.mts} +1 -1
- package/dist/{request-CEbHIIl4.d.ts → request-fciwmd3n.d.ts} +1 -1
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +7 -9
- package/dist/request.d.ts +7 -9
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-C4oHbv6C.d.ts → route-rendering-BCM1QzEf.d.mts} +1 -1
- package/dist/{route-rendering-BHyOfXjD.d.mts → route-rendering-BLZT0IP0.d.ts} +1 -1
- package/dist/{router-uRN_29Em.d.ts → router-CkheNX3-.d.ts} +1 -1
- package/dist/{router-DwhA61SB.d.mts → router-DyZJWc1_.d.mts} +1 -1
- package/dist/routes.cjs +6 -5
- package/dist/routes.d.mts +6 -8
- package/dist/routes.d.ts +6 -8
- package/dist/routes.mjs +5 -4
- package/dist/{runtime-COk03hmx.d.ts → runtime-DfU4sKa5.d.ts} +3 -3
- package/dist/{runtime-BEdHhN4C.d.mts → runtime-wexvUN5J.d.mts} +3 -3
- package/dist/{schema-dev-notice-Y7MQEFGN.cjs → schema-dev-notice-5JPE67AI.cjs} +6 -4
- package/dist/{schema-dev-notice-O67CPXJ6.mjs → schema-dev-notice-WLPZ6WKU.mjs} +4 -2
- package/dist/server-action-security.cjs +4 -3
- package/dist/server-action-security.mjs +3 -2
- package/dist/server-client-bridge-DKWDl5NB.d.mts +7 -0
- package/dist/server-client-bridge-DKWDl5NB.d.ts +7 -0
- package/dist/server-fn-client.d.mts +3 -3
- package/dist/server-fn-client.d.ts +3 -3
- package/dist/server-fn.cjs +8 -7
- package/dist/server-fn.d.mts +1 -1
- package/dist/server-fn.d.ts +1 -1
- package/dist/server-fn.mjs +7 -6
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +7 -9
- package/dist/server-plugins.d.ts +7 -9
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query-client.d.mts +1 -1
- package/dist/server-query-client.d.ts +1 -1
- package/dist/server-query.cjs +9 -8
- package/dist/server-query.d.mts +1 -1
- package/dist/server-query.d.ts +1 -1
- package/dist/server-query.mjs +8 -7
- package/dist/server.cjs +97 -73
- package/dist/server.d.mts +18 -13
- package/dist/server.d.ts +18 -13
- package/dist/server.mjs +82 -58
- package/dist/{spa-router-DrVOBVGg.d.ts → spa-router-CcejECnG.d.ts} +2 -2
- package/dist/{spa-router-w4aFOuyn.d.mts → spa-router-DgsMXqfX.d.mts} +2 -2
- package/dist/ssg-1FGaFISl.d.ts +184 -0
- package/dist/ssg-Bg4bMMhM.d.mts +184 -0
- package/dist/storage.cjs +6 -2
- package/dist/storage.d.mts +9 -1
- package/dist/storage.d.ts +9 -1
- package/dist/storage.mjs +5 -1
- package/dist/testing.cjs +20 -18
- package/dist/testing.d.mts +7 -9
- package/dist/testing.d.ts +7 -9
- package/dist/testing.mjs +16 -14
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-Dhuqwmd2.d.ts → utils-8wtTYiH4.d.mts} +1 -1
- package/dist/{utils-BtYehqeU.d.mts → utils-Dxbh6Hgj.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +75 -46
- package/dist/vite.d.mts +130 -11
- package/dist/vite.d.ts +130 -11
- package/dist/vite.mjs +76 -47
- package/dist/{workflows-jZ4BcdoZ.d.ts → workflows-IWP1ddBm.d.mts} +5 -2
- package/dist/{workflows-jZ4BcdoZ.d.mts → workflows-IWP1ddBm.d.ts} +5 -2
- package/dist/workflows.cjs +4 -3
- package/dist/workflows.d.mts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.mjs +3 -2
- package/package.json +3 -1
- package/dist/chunk-3SDFA7UF.cjs +0 -701
- package/dist/chunk-DAO7JGTS.mjs +0 -73
- package/dist/chunk-E5GNDG5F.mjs +0 -701
- package/dist/chunk-SYQ3MOWW.cjs +0 -73
- package/dist/chunk-ULASELLA.cjs +0 -48
- package/dist/integration-orm-55F7CII5.cjs +0 -13
|
@@ -4,19 +4,20 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
FARM_NODE_ENV_MODULE_FILE,
|
|
6
6
|
FARM_NODE_ENV_MODULE_SOURCE,
|
|
7
|
+
createFarmBunServerEntry,
|
|
7
8
|
createFarmNodeServerEntry,
|
|
8
9
|
withProductionNodeEnv
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UIDWEU7M.mjs";
|
|
10
11
|
import {
|
|
11
12
|
generateNativeMCPPluginSource,
|
|
12
13
|
layoutsCanCoverSamePage
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4C7KTKX7.mjs";
|
|
14
15
|
import {
|
|
15
16
|
assertFarmDocsAdapterServesNoGuardedPages,
|
|
16
17
|
compileFarmDocsAdapterEdgeManifest,
|
|
17
18
|
createFarmDocsAPIHandler,
|
|
18
19
|
hasFarmDocsRuntimeAdapter
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-PYHPXPSW.mjs";
|
|
20
21
|
import {
|
|
21
22
|
FARM_DOCS_LAST_MODIFIED_MANIFEST,
|
|
22
23
|
createFarmDocsHandler,
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
loadFarmDocsPage,
|
|
28
29
|
resolveFarmDocsContentDir,
|
|
29
30
|
toFarmDocsMarkdownPage
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-UQUEANTY.mjs";
|
|
31
32
|
import {
|
|
32
33
|
generateFarmDocsSearchClientRuntime,
|
|
33
34
|
isFarmDocsSearchEnabled,
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
} from "./chunk-UP4CW6WP.mjs";
|
|
36
37
|
import {
|
|
37
38
|
FARM_PRERENDER_ENV
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-WMBRZI5V.mjs";
|
|
39
40
|
import {
|
|
40
41
|
loadFarmDocsEngine
|
|
41
42
|
} from "./chunk-2VQKKQ6D.mjs";
|
|
@@ -44,7 +45,7 @@ import {
|
|
|
44
45
|
getDeployTargetForPreset,
|
|
45
46
|
hasCustomFarmRouteContext,
|
|
46
47
|
resolveDeployOutputPath
|
|
47
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-ENOBPDKZ.mjs";
|
|
48
49
|
import {
|
|
49
50
|
resolveFarmInstrumentationFile
|
|
50
51
|
} from "./chunk-ZZSRYEYU.mjs";
|
|
@@ -54,7 +55,6 @@ import {
|
|
|
54
55
|
import {
|
|
55
56
|
DEFAULT_NOT_FOUND_STYLES,
|
|
56
57
|
FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
|
|
57
|
-
PluginManager,
|
|
58
58
|
SHARP_INSTALL_HINT,
|
|
59
59
|
collectFarmWebMCPTools,
|
|
60
60
|
createFarmApp,
|
|
@@ -65,7 +65,6 @@ import {
|
|
|
65
65
|
enforceFarmIsolatedHydrationRouteBudget,
|
|
66
66
|
farmDocsClientConfigPlugin,
|
|
67
67
|
farmFontImportsPlugin,
|
|
68
|
-
farmPluginMayAffectRuntimePath,
|
|
69
68
|
generateClientCachePersistenceCode,
|
|
70
69
|
generateFarmClientPluginEntryCode,
|
|
71
70
|
generateFarmIntegrationProviderClientCode,
|
|
@@ -80,16 +79,19 @@ import {
|
|
|
80
79
|
resolveFarmAppPackages,
|
|
81
80
|
resolveFarmClientCacheAdapterEntry,
|
|
82
81
|
resolveFarmImageProviderForRuntime,
|
|
82
|
+
resolveFarmImageServerRuntime,
|
|
83
83
|
resolveFarmIsolatedClientHydrationMode,
|
|
84
84
|
resolveFarmNotFoundComponentPath,
|
|
85
85
|
usesFarmServerTree
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-FJGIVDA5.mjs";
|
|
87
|
+
import {
|
|
88
|
+
PluginManager
|
|
89
|
+
} from "./chunk-FGH3ZXTP.mjs";
|
|
87
90
|
import {
|
|
88
|
-
findRequestBoundSourceBlockers,
|
|
89
91
|
generateFarmTypeArtifacts,
|
|
90
|
-
|
|
92
|
+
readRouteRenderingDirectiveFromFile,
|
|
91
93
|
resolveRouteRenderingConfigFromFile
|
|
92
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-35WS7P2V.mjs";
|
|
93
95
|
import {
|
|
94
96
|
FARM_API_CATALOG_PATH,
|
|
95
97
|
FARM_APP_MANIFEST_LEGACY_PATH,
|
|
@@ -105,18 +107,21 @@ import {
|
|
|
105
107
|
resolveFarmAppManifestInput,
|
|
106
108
|
routeBoundaryCoversDirectory,
|
|
107
109
|
stripRouteGroups
|
|
108
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-SVPGWJZF.mjs";
|
|
109
111
|
import {
|
|
110
112
|
FARM_DEFAULT_MCP_PATH,
|
|
111
113
|
createFarmDefaultMCPServer,
|
|
112
114
|
farmConfigMountsMCP
|
|
113
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-4ZZNPK25.mjs";
|
|
116
|
+
import {
|
|
117
|
+
farmPluginMayAffectRuntimePath
|
|
118
|
+
} from "./chunk-Y5RG6B7S.mjs";
|
|
114
119
|
import {
|
|
115
120
|
isFarmPreviewDeploymentEnvironment
|
|
116
121
|
} from "./chunk-BOYNDCZL.mjs";
|
|
117
122
|
import {
|
|
118
123
|
farmEnvironmentFunctionsPlugin
|
|
119
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-CALY6QG6.mjs";
|
|
120
125
|
import {
|
|
121
126
|
generateFarmDocsAdapterClientRuntime,
|
|
122
127
|
getFarmDocsAdapterConfigModule
|
|
@@ -128,9 +133,6 @@ import {
|
|
|
128
133
|
import {
|
|
129
134
|
routeRulesToNitroRouteRules
|
|
130
135
|
} from "./chunk-GHFS7RUB.mjs";
|
|
131
|
-
import {
|
|
132
|
-
getFarmAppDirectories
|
|
133
|
-
} from "./chunk-BUGNQIHC.mjs";
|
|
134
136
|
import {
|
|
135
137
|
REACT_RENDERER,
|
|
136
138
|
getFarmRendererCapabilities,
|
|
@@ -143,7 +145,10 @@ import {
|
|
|
143
145
|
import {
|
|
144
146
|
applyFarmCspHashesToHtml,
|
|
145
147
|
createFarmCspNonce
|
|
146
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-7UEEHAW7.mjs";
|
|
149
|
+
import {
|
|
150
|
+
getFarmAppDirectories
|
|
151
|
+
} from "./chunk-BUGNQIHC.mjs";
|
|
147
152
|
import {
|
|
148
153
|
applyFarmCronVercelCrons,
|
|
149
154
|
createFarmCronCloudflareConfig,
|
|
@@ -155,31 +160,34 @@ import {
|
|
|
155
160
|
} from "./chunk-4OOBRCJX.mjs";
|
|
156
161
|
import {
|
|
157
162
|
isFarmMarkdownPageFile
|
|
158
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-GZTUT75U.mjs";
|
|
159
164
|
import {
|
|
160
165
|
resolveFarmMdxComponentsModulePath,
|
|
161
166
|
resolveMdxConfig
|
|
162
167
|
} from "./chunk-FA2W42OV.mjs";
|
|
163
168
|
import {
|
|
164
169
|
getFarmMarkdownAlternatePath
|
|
165
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-I6UVKUYK.mjs";
|
|
166
171
|
import {
|
|
167
172
|
applyFarmWorkflowVercelCrons,
|
|
168
173
|
prepareFarmWorkflowsForNitro
|
|
169
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-BPNRQ5BA.mjs";
|
|
175
|
+
import {
|
|
176
|
+
_collectFarmStorageModules
|
|
177
|
+
} from "./chunk-JGHCKIRI.mjs";
|
|
170
178
|
import {
|
|
171
179
|
FARM_INTEGRATION_API_BASE_PATH_KEY,
|
|
172
180
|
getFarmIntegrationPluginServerRuntime,
|
|
173
181
|
getIntegrationProviders
|
|
174
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-AX7S67YV.mjs";
|
|
175
183
|
import {
|
|
176
184
|
appendMiddlewareDirectory,
|
|
177
185
|
appendMiddlewareRoutePath,
|
|
178
186
|
compareMiddlewareRouteLocations
|
|
179
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-LFHCG2DU.mjs";
|
|
180
188
|
import {
|
|
181
189
|
APIRouteManager
|
|
182
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-YYQVGKO5.mjs";
|
|
183
191
|
import {
|
|
184
192
|
readFarmI18nCatalogs
|
|
185
193
|
} from "./chunk-QCFBDFRS.mjs";
|
|
@@ -206,13 +214,13 @@ import {
|
|
|
206
214
|
} from "./chunk-BTHHUD7Q.mjs";
|
|
207
215
|
import {
|
|
208
216
|
FARM_VERSION
|
|
209
|
-
} from "./chunk-
|
|
217
|
+
} from "./chunk-VLPII2JJ.mjs";
|
|
210
218
|
import {
|
|
211
219
|
getFarmPresetRuntime
|
|
212
220
|
} from "./chunk-2A3EQHXX.mjs";
|
|
213
221
|
import {
|
|
214
222
|
_runWithFarmCspNonce
|
|
215
|
-
} from "./chunk-
|
|
223
|
+
} from "./chunk-X3NGFVRF.mjs";
|
|
216
224
|
import {
|
|
217
225
|
compareRoutePatternSpecificity
|
|
218
226
|
} from "./chunk-55YI3RRB.mjs";
|
|
@@ -221,7 +229,7 @@ import {
|
|
|
221
229
|
} from "./chunk-LPEX4YW6.mjs";
|
|
222
230
|
|
|
223
231
|
// src/build/index.ts
|
|
224
|
-
import
|
|
232
|
+
import path10 from "path";
|
|
225
233
|
import { existsSync as existsSync3 } from "fs";
|
|
226
234
|
|
|
227
235
|
// src/nitro/client-css-href.ts
|
|
@@ -229,15 +237,15 @@ import path from "path";
|
|
|
229
237
|
var FARM_CLIENT_CSS_HREF_PLACEHOLDER = "/__farm_client_css_href__";
|
|
230
238
|
var FARM_CLIENT_JS_SRC_PLACEHOLDER = "/__farm_client_js_src__";
|
|
231
239
|
async function hashAndCopy(sourcePath, destinationDir, hashedName) {
|
|
232
|
-
const
|
|
240
|
+
const fs4 = await import("fs/promises");
|
|
233
241
|
try {
|
|
234
|
-
const bytes = await
|
|
242
|
+
const bytes = await fs4.readFile(sourcePath);
|
|
235
243
|
if (bytes.length === 0) return null;
|
|
236
244
|
const { createHash } = await import("crypto");
|
|
237
245
|
const hash = createHash("sha256").update(bytes).digest("hex").slice(0, 8);
|
|
238
246
|
const name = hashedName(hash);
|
|
239
|
-
await
|
|
240
|
-
await
|
|
247
|
+
await fs4.mkdir(destinationDir, { recursive: true });
|
|
248
|
+
await fs4.writeFile(path.join(destinationDir, name), bytes);
|
|
241
249
|
return name;
|
|
242
250
|
} catch {
|
|
243
251
|
return null;
|
|
@@ -254,9 +262,9 @@ async function resolveHashedClientCssHref(clientOutputDir) {
|
|
|
254
262
|
}
|
|
255
263
|
__name(resolveHashedClientCssHref, "resolveHashedClientCssHref");
|
|
256
264
|
async function findFingerprintedClientEntry(clientOutputDir) {
|
|
257
|
-
const
|
|
265
|
+
const fs4 = await import("fs/promises");
|
|
258
266
|
try {
|
|
259
|
-
const entries = await
|
|
267
|
+
const entries = await fs4.readdir(clientOutputDir);
|
|
260
268
|
return entries.find((name) => /^farm-client-h[0-9a-f]+\.js$/.test(name)) ?? null;
|
|
261
269
|
} catch {
|
|
262
270
|
return null;
|
|
@@ -266,17 +274,17 @@ __name(findFingerprintedClientEntry, "findFingerprintedClientEntry");
|
|
|
266
274
|
async function resolveHashedClientJsSrc(clientOutputDir) {
|
|
267
275
|
const entryName = await findFingerprintedClientEntry(clientOutputDir);
|
|
268
276
|
if (!entryName) return "/farm-client.js";
|
|
269
|
-
const
|
|
277
|
+
const fs4 = await import("fs/promises");
|
|
270
278
|
const shim = `export * from "./${entryName}";
|
|
271
279
|
`;
|
|
272
|
-
await
|
|
280
|
+
await fs4.writeFile(path.join(clientOutputDir, "farm-client.js"), shim);
|
|
273
281
|
return `/${entryName}`;
|
|
274
282
|
}
|
|
275
283
|
__name(resolveHashedClientJsSrc, "resolveHashedClientJsSrc");
|
|
276
284
|
|
|
277
285
|
// src/nitro/universal-build.ts
|
|
278
286
|
import os from "os";
|
|
279
|
-
import
|
|
287
|
+
import path9 from "path";
|
|
280
288
|
import { constants as fsConstants, existsSync as existsSync2, readFileSync, realpathSync, statSync } from "fs";
|
|
281
289
|
import { fileURLToPath } from "url";
|
|
282
290
|
import { builtinModules, createRequire } from "module";
|
|
@@ -704,10 +712,10 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
704
712
|
}
|
|
705
713
|
__name(createFarmRouteRuntimeManifest, "createFarmRouteRuntimeManifest");
|
|
706
714
|
async function writeFarmRouteRuntimeManifest(directory, manifest) {
|
|
707
|
-
const
|
|
715
|
+
const fs4 = await import("fs/promises");
|
|
708
716
|
const manifestPath = path5.join(directory, FARM_ROUTE_RUNTIME_MANIFEST);
|
|
709
|
-
await
|
|
710
|
-
await
|
|
717
|
+
await fs4.mkdir(directory, { recursive: true });
|
|
718
|
+
await fs4.writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
711
719
|
`);
|
|
712
720
|
return manifestPath;
|
|
713
721
|
}
|
|
@@ -752,7 +760,7 @@ __name(normalizeManifestSource, "normalizeManifestSource");
|
|
|
752
760
|
|
|
753
761
|
// src/nitro/vercel-route-runtime.ts
|
|
754
762
|
import path6 from "path";
|
|
755
|
-
async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest,
|
|
763
|
+
async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs4, basePath = "/") {
|
|
756
764
|
const dynamicRoutes = manifest.routes.filter(
|
|
757
765
|
(route) => route.rendering === "dynamic" && route.runtime !== "edge"
|
|
758
766
|
);
|
|
@@ -783,8 +791,8 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs3, b
|
|
|
783
791
|
groupIndex += 1;
|
|
784
792
|
const functionName = `__farm_runtime_${groupIndex}`;
|
|
785
793
|
const functionDir = path6.join(functionsDir, `${functionName}.func`);
|
|
786
|
-
await
|
|
787
|
-
await configureVercelFunction(functionDir, group.config,
|
|
794
|
+
await fs4.cp(baseFunctionDir, functionDir, { recursive: true, force: true });
|
|
795
|
+
await configureVercelFunction(functionDir, group.config, fs4);
|
|
788
796
|
destinations.set(key, `/${functionName}`);
|
|
789
797
|
}
|
|
790
798
|
const routes = [];
|
|
@@ -798,17 +806,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs3, b
|
|
|
798
806
|
regions: route.regions,
|
|
799
807
|
maxDuration: route.maxDuration
|
|
800
808
|
});
|
|
801
|
-
routes.push({
|
|
802
|
-
src,
|
|
803
|
-
dest: destinations.get(key) || "/__nitro",
|
|
804
|
-
...route.kind === "api" || route.pattern.startsWith("/api/") ? {
|
|
805
|
-
headers: {
|
|
806
|
-
"Access-Control-Allow-Origin": "*",
|
|
807
|
-
"Access-Control-Allow-Methods": "*",
|
|
808
|
-
"Access-Control-Allow-Headers": "*"
|
|
809
|
-
}
|
|
810
|
-
} : {}
|
|
811
|
-
});
|
|
809
|
+
routes.push({ src, dest: destinations.get(key) || "/__nitro" });
|
|
812
810
|
}
|
|
813
811
|
return routes;
|
|
814
812
|
}
|
|
@@ -833,15 +831,15 @@ function farmRoutePatternToVercelSource(pattern, basePath = "/") {
|
|
|
833
831
|
return source === "/" ? normalizedBasePath : `${normalizedBasePath}${source}`;
|
|
834
832
|
}
|
|
835
833
|
__name(farmRoutePatternToVercelSource, "farmRoutePatternToVercelSource");
|
|
836
|
-
async function configureVercelFunction(functionDir, config,
|
|
834
|
+
async function configureVercelFunction(functionDir, config, fs4) {
|
|
837
835
|
const configPath = path6.join(functionDir, ".vc-config.json");
|
|
838
|
-
const current = JSON.parse(await
|
|
836
|
+
const current = JSON.parse(await fs4.readFile(configPath, "utf8"));
|
|
839
837
|
const next = {
|
|
840
838
|
...current,
|
|
841
839
|
...config.regions?.length ? { regions: config.regions } : {},
|
|
842
840
|
...config.maxDuration ? { maxDuration: config.maxDuration } : {}
|
|
843
841
|
};
|
|
844
|
-
await
|
|
842
|
+
await fs4.writeFile(configPath, `${JSON.stringify(next, null, 2)}
|
|
845
843
|
`);
|
|
846
844
|
}
|
|
847
845
|
__name(configureVercelFunction, "configureVercelFunction");
|
|
@@ -974,6 +972,39 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
974
972
|
}
|
|
975
973
|
__name(createFarmNetlifyEntry, "createFarmNetlifyEntry");
|
|
976
974
|
|
|
975
|
+
// src/nitro/client-sourcemaps.ts
|
|
976
|
+
import fs3 from "fs/promises";
|
|
977
|
+
import path8 from "path";
|
|
978
|
+
var FARM_CLIENT_SOURCEMAPS_DIR = "client-sourcemaps";
|
|
979
|
+
function resolveFarmClientSourcemap(sourcemap) {
|
|
980
|
+
return sourcemap ? "hidden" : false;
|
|
981
|
+
}
|
|
982
|
+
__name(resolveFarmClientSourcemap, "resolveFarmClientSourcemap");
|
|
983
|
+
function createFarmPrivateClientSourcemapsPlugin(options) {
|
|
984
|
+
let maps = [];
|
|
985
|
+
return {
|
|
986
|
+
name: "farm-private-client-sourcemaps",
|
|
987
|
+
enforce: "post",
|
|
988
|
+
generateBundle(_output, bundle) {
|
|
989
|
+
maps = [];
|
|
990
|
+
for (const [fileName, output] of Object.entries(bundle)) {
|
|
991
|
+
if (output.type !== "asset" || !fileName.endsWith(".map")) continue;
|
|
992
|
+
maps.push([fileName, output.source ?? ""]);
|
|
993
|
+
delete bundle[fileName];
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
async writeBundle() {
|
|
997
|
+
await fs3.rm(options.outDir, { recursive: true, force: true });
|
|
998
|
+
for (const [fileName, source] of maps) {
|
|
999
|
+
const target = path8.join(options.outDir, fileName);
|
|
1000
|
+
await fs3.mkdir(path8.dirname(target), { recursive: true });
|
|
1001
|
+
await fs3.writeFile(target, source);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
__name(createFarmPrivateClientSourcemapsPlugin, "createFarmPrivateClientSourcemapsPlugin");
|
|
1007
|
+
|
|
977
1008
|
// src/nitro/universal-build.ts
|
|
978
1009
|
function preloadFarmNitroBuilder() {
|
|
979
1010
|
return import("nitro/builder").then(
|
|
@@ -983,18 +1014,18 @@ function preloadFarmNitroBuilder() {
|
|
|
983
1014
|
}
|
|
984
1015
|
__name(preloadFarmNitroBuilder, "preloadFarmNitroBuilder");
|
|
985
1016
|
var _filename = typeof import.meta.url !== "undefined" ? fileURLToPath(import.meta.url) : "";
|
|
986
|
-
var _dirname =
|
|
1017
|
+
var _dirname = path9.dirname(_filename);
|
|
987
1018
|
function findFarmCoreRoot(from) {
|
|
988
|
-
let dir =
|
|
989
|
-
while (dir !==
|
|
990
|
-
const manifest =
|
|
1019
|
+
let dir = path9.dirname(from);
|
|
1020
|
+
while (dir !== path9.dirname(dir)) {
|
|
1021
|
+
const manifest = path9.join(dir, "package.json");
|
|
991
1022
|
if (existsSync2(manifest)) {
|
|
992
1023
|
try {
|
|
993
1024
|
if (JSON.parse(readFileSync(manifest, "utf8")).name === "@farm.js/core") return dir;
|
|
994
1025
|
} catch {
|
|
995
1026
|
}
|
|
996
1027
|
}
|
|
997
|
-
dir =
|
|
1028
|
+
dir = path9.dirname(dir);
|
|
998
1029
|
}
|
|
999
1030
|
return null;
|
|
1000
1031
|
}
|
|
@@ -1006,16 +1037,16 @@ function toModulePath(file) {
|
|
|
1006
1037
|
}
|
|
1007
1038
|
__name(toModulePath, "toModulePath");
|
|
1008
1039
|
function findInstalledPackageDir(name, from) {
|
|
1009
|
-
for (let dir = from; ; dir =
|
|
1010
|
-
const candidate =
|
|
1011
|
-
if (existsSync2(
|
|
1040
|
+
for (let dir = from; ; dir = path9.dirname(dir)) {
|
|
1041
|
+
const candidate = path9.join(dir, "node_modules", name);
|
|
1042
|
+
if (existsSync2(path9.join(candidate, "package.json"))) {
|
|
1012
1043
|
try {
|
|
1013
1044
|
return realpathSync(candidate);
|
|
1014
1045
|
} catch {
|
|
1015
1046
|
return null;
|
|
1016
1047
|
}
|
|
1017
1048
|
}
|
|
1018
|
-
if (dir ===
|
|
1049
|
+
if (dir === path9.dirname(dir)) return null;
|
|
1019
1050
|
}
|
|
1020
1051
|
}
|
|
1021
1052
|
__name(findInstalledPackageDir, "findInstalledPackageDir");
|
|
@@ -1027,7 +1058,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
1027
1058
|
seen.add(dir);
|
|
1028
1059
|
let manifest;
|
|
1029
1060
|
try {
|
|
1030
|
-
manifest = JSON.parse(readFileSync(
|
|
1061
|
+
manifest = JSON.parse(readFileSync(path9.join(dir, "package.json"), "utf8"));
|
|
1031
1062
|
} catch {
|
|
1032
1063
|
return;
|
|
1033
1064
|
}
|
|
@@ -1038,7 +1069,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
1038
1069
|
if (farmCoreRoot) visit(realpathSync(farmCoreRoot));
|
|
1039
1070
|
queue.push({ name: "@farm.js/core", from: root });
|
|
1040
1071
|
try {
|
|
1041
|
-
const manifest = JSON.parse(readFileSync(
|
|
1072
|
+
const manifest = JSON.parse(readFileSync(path9.join(root, "package.json"), "utf8"));
|
|
1042
1073
|
for (const field of ["dependencies", "devDependencies"]) {
|
|
1043
1074
|
for (const name of Object.keys(manifest[field] ?? {})) {
|
|
1044
1075
|
if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
|
|
@@ -1105,17 +1136,30 @@ var FARM_SSR_PACKAGE_IMPORT = "#farm-ssr-entry";
|
|
|
1105
1136
|
var FARM_SSR_OUTPUT_DIR = "farm-ssr";
|
|
1106
1137
|
var FARM_CLIENT_BUILD_TARGET = ["es2020", "edge88", "firefox78", "chrome87", "safari14"];
|
|
1107
1138
|
function resolveNitroRuntimeDependency(root, specifier) {
|
|
1108
|
-
return createRequire(resolveNitroPackageEntry(root)).resolve(specifier).split(
|
|
1139
|
+
return createRequire(resolveNitroPackageEntry(root)).resolve(specifier).split(path9.sep).join("/");
|
|
1109
1140
|
}
|
|
1110
1141
|
__name(resolveNitroRuntimeDependency, "resolveNitroRuntimeDependency");
|
|
1111
1142
|
function resolveNitroInternalRuntimeAliases(root) {
|
|
1112
|
-
const
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1143
|
+
const nitroEntry = resolveNitroPackageEntry(root);
|
|
1144
|
+
const runtimeDir = path9.dirname(nitroEntry);
|
|
1145
|
+
const nitroRequire = createRequire(nitroEntry);
|
|
1146
|
+
return {
|
|
1147
|
+
...Object.fromEntries(
|
|
1148
|
+
["app", "error/hooks", "runtime-config", "shutdown", "task"].map((moduleName) => [
|
|
1149
|
+
`#nitro/runtime/${moduleName}`,
|
|
1150
|
+
path9.join(runtimeDir, "internal", `${moduleName}.mjs`).split(path9.sep).join("/")
|
|
1151
|
+
])
|
|
1152
|
+
),
|
|
1153
|
+
// Farm's generated workflow and cron wrappers live under `.farm/` and
|
|
1154
|
+
// import these. An app that only depends on @farm.js/core (pnpm) cannot
|
|
1155
|
+
// resolve them from there, and an unresolved id ships as a bare import.
|
|
1156
|
+
...Object.fromEntries(
|
|
1157
|
+
["nitro/app", "nitro/h3", "nitro/task"].map((specifier) => [
|
|
1158
|
+
specifier,
|
|
1159
|
+
nitroRequire.resolve(specifier).split(path9.sep).join("/")
|
|
1160
|
+
])
|
|
1161
|
+
)
|
|
1162
|
+
};
|
|
1119
1163
|
}
|
|
1120
1164
|
__name(resolveNitroInternalRuntimeAliases, "resolveNitroInternalRuntimeAliases");
|
|
1121
1165
|
function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveNitroPackageEntry) {
|
|
@@ -1124,7 +1168,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1124
1168
|
name: "farm-prerender-runtime-resolver",
|
|
1125
1169
|
async resolveId(id, _importer, options) {
|
|
1126
1170
|
if (options.custom?.farmPrerenderRuntimeResolve) return null;
|
|
1127
|
-
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") ||
|
|
1171
|
+
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || path9.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
1128
1172
|
return null;
|
|
1129
1173
|
}
|
|
1130
1174
|
if (nitroEntry === void 0) {
|
|
@@ -1144,8 +1188,39 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1144
1188
|
};
|
|
1145
1189
|
}
|
|
1146
1190
|
__name(createPrerenderRuntimeResolverPlugin, "createPrerenderRuntimeResolverPlugin");
|
|
1191
|
+
function createFarmStorageModuleRegistration(config) {
|
|
1192
|
+
const modules = _collectFarmStorageModules(config.storage);
|
|
1193
|
+
if (modules.length === 0) return "";
|
|
1194
|
+
const root = config.root || process.cwd();
|
|
1195
|
+
const projectRequire = createRequire(path9.join(root, "package.json"));
|
|
1196
|
+
let runtimeRequire = projectRequire;
|
|
1197
|
+
try {
|
|
1198
|
+
runtimeRequire = createRequire(projectRequire.resolve("@farm.js/core"));
|
|
1199
|
+
} catch {
|
|
1200
|
+
}
|
|
1201
|
+
const loaders = [];
|
|
1202
|
+
for (const specifier of modules) {
|
|
1203
|
+
let resolved;
|
|
1204
|
+
for (const require2 of [runtimeRequire, projectRequire]) {
|
|
1205
|
+
try {
|
|
1206
|
+
resolved = require2.resolve(specifier);
|
|
1207
|
+
break;
|
|
1208
|
+
} catch {
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
if (resolved) {
|
|
1212
|
+
loaders.push(
|
|
1213
|
+
` ${JSON.stringify(specifier)}: () => import(${toVirtualEntryImportSpecifier(resolved)}),`
|
|
1214
|
+
);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
return loaders.length > 0 ? `_registerFarmStorageModules({
|
|
1218
|
+
${loaders.join("\n")}
|
|
1219
|
+
});` : "";
|
|
1220
|
+
}
|
|
1221
|
+
__name(createFarmStorageModuleRegistration, "createFarmStorageModuleRegistration");
|
|
1147
1222
|
function resolveNitroPackageEntry(root) {
|
|
1148
|
-
const projectRequire = createRequire(
|
|
1223
|
+
const projectRequire = createRequire(path9.join(root, "package.json"));
|
|
1149
1224
|
let runtimeRequire = projectRequire;
|
|
1150
1225
|
try {
|
|
1151
1226
|
runtimeRequire = createRequire(projectRequire.resolve("@farm.js/core"));
|
|
@@ -1220,7 +1295,7 @@ function createFarmReactWebServerAlias(hasEdgeBuild) {
|
|
|
1220
1295
|
__name(createFarmReactWebServerAlias, "createFarmReactWebServerAlias");
|
|
1221
1296
|
function hasReactDomEdgeServerBuild(root) {
|
|
1222
1297
|
try {
|
|
1223
|
-
createRequire(
|
|
1298
|
+
createRequire(path9.join(root, "package.json")).resolve("react-dom/server.edge");
|
|
1224
1299
|
return true;
|
|
1225
1300
|
} catch {
|
|
1226
1301
|
return false;
|
|
@@ -1239,18 +1314,6 @@ function shouldUseExternalMetadataImageRuntime(preset, usesImageRuntime) {
|
|
|
1239
1314
|
return usesImageRuntime && preset !== "vercel-edge" && !isCloudflareImagePreset(preset);
|
|
1240
1315
|
}
|
|
1241
1316
|
__name(shouldUseExternalMetadataImageRuntime, "shouldUseExternalMetadataImageRuntime");
|
|
1242
|
-
function resolveImageRuntime(config, preset) {
|
|
1243
|
-
if (config.images.provider === "none") return "none";
|
|
1244
|
-
const cloudflarePreset = isCloudflareImagePreset(preset);
|
|
1245
|
-
if (config.images.provider === "node" && cloudflarePreset) {
|
|
1246
|
-
throw new Error('images.provider "node" cannot run in a Cloudflare deployment');
|
|
1247
|
-
}
|
|
1248
|
-
if (config.images.provider === "cloudflare" && !cloudflarePreset) {
|
|
1249
|
-
throw new Error('images.provider "cloudflare" requires a Cloudflare deployment preset');
|
|
1250
|
-
}
|
|
1251
|
-
return config.images.provider === "cloudflare" || config.images.provider === "auto" && cloudflarePreset ? "cloudflare" : "node";
|
|
1252
|
-
}
|
|
1253
|
-
__name(resolveImageRuntime, "resolveImageRuntime");
|
|
1254
1317
|
function isNitroRollupExternal(id) {
|
|
1255
1318
|
const normalizedId = id.replace(/\\/g, "/");
|
|
1256
1319
|
return NODE_BUILTIN_MODULES.has(id) || NITRO_EXTERNAL_MODULES.has(id) || normalizedId.startsWith(".prisma/") || normalizedId.includes("/node_modules/@prisma/client/") || normalizedId.includes("/node_modules/.prisma/client/");
|
|
@@ -1270,6 +1333,45 @@ function createReactProductionModePlugin() {
|
|
|
1270
1333
|
};
|
|
1271
1334
|
}
|
|
1272
1335
|
__name(createReactProductionModePlugin, "createReactProductionModePlugin");
|
|
1336
|
+
var FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID = "\0farm-omitted-metadata-image-runtime";
|
|
1337
|
+
function isFarmCoreModule(file) {
|
|
1338
|
+
let dir = path9.dirname(file.split("?", 1)[0]);
|
|
1339
|
+
while (dir !== path9.dirname(dir)) {
|
|
1340
|
+
const manifest = path9.join(dir, "package.json");
|
|
1341
|
+
if (existsSync2(manifest)) {
|
|
1342
|
+
try {
|
|
1343
|
+
return JSON.parse(readFileSync(manifest, "utf8")).name === "@farm.js/core";
|
|
1344
|
+
} catch {
|
|
1345
|
+
return false;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
dir = path9.dirname(dir);
|
|
1349
|
+
}
|
|
1350
|
+
return false;
|
|
1351
|
+
}
|
|
1352
|
+
__name(isFarmCoreModule, "isFarmCoreModule");
|
|
1353
|
+
function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
1354
|
+
return {
|
|
1355
|
+
name: "farm-omitted-metadata-image-runtime",
|
|
1356
|
+
resolveId(source, importer) {
|
|
1357
|
+
if (source !== "@vercel/og") return null;
|
|
1358
|
+
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(path9.basename(importer.split("?", 1)[0]));
|
|
1359
|
+
if (fromCoreRuntime) return FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID;
|
|
1360
|
+
return externalizeOtherImports ? { id: source, external: true } : null;
|
|
1361
|
+
},
|
|
1362
|
+
load(id) {
|
|
1363
|
+
if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
|
|
1364
|
+
return `
|
|
1365
|
+
export class ImageResponse {
|
|
1366
|
+
constructor() {
|
|
1367
|
+
throw new Error("@vercel/og is not in this server build because the app has no generated metadata image route.");
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
`;
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
__name(createOmittedMetadataImageRuntimePlugin, "createOmittedMetadataImageRuntimePlugin");
|
|
1273
1375
|
function createMetadataImageWasmPlugin() {
|
|
1274
1376
|
return {
|
|
1275
1377
|
name: "farm-metadata-image-wasm",
|
|
@@ -1278,7 +1380,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
1278
1380
|
return null;
|
|
1279
1381
|
}
|
|
1280
1382
|
const requestPath = source.slice(0, -"?module".length);
|
|
1281
|
-
const resolvedPath =
|
|
1383
|
+
const resolvedPath = path9.isAbsolute(requestPath) ? requestPath : path9.resolve(path9.dirname(importer.split("?", 1)[0]), requestPath);
|
|
1282
1384
|
return `${FARM_METADATA_IMAGE_WASM_PREFIX}${resolvedPath}`;
|
|
1283
1385
|
},
|
|
1284
1386
|
load(id) {
|
|
@@ -1304,11 +1406,11 @@ function collectSSRExternalPackages(ssrBundle) {
|
|
|
1304
1406
|
for (const importId of [...output.imports, ...output.dynamicImports]) {
|
|
1305
1407
|
const normalizedImportId = importId.replace(/\\/g, "/");
|
|
1306
1408
|
const normalizedId = normalizedImportId.replace(/^\.\//, "");
|
|
1307
|
-
const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ?
|
|
1409
|
+
const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ? path9.posix.normalize(path9.posix.join(path9.posix.dirname(fileName), normalizedImportId)) : null;
|
|
1308
1410
|
if (emittedFiles.has(normalizedId) || resolvedRelativeId !== null && emittedFiles.has(resolvedRelativeId) || NODE_BUILTIN_MODULES.has(importId) || importId.startsWith("node:")) {
|
|
1309
1411
|
continue;
|
|
1310
1412
|
}
|
|
1311
|
-
if (
|
|
1413
|
+
if (path9.isAbsolute(importId) || /^[A-Za-z]:[\\/]/.test(importId) || importId.startsWith("#") || importId.startsWith("\0")) {
|
|
1312
1414
|
externalPackages.add(importId);
|
|
1313
1415
|
continue;
|
|
1314
1416
|
}
|
|
@@ -1321,15 +1423,15 @@ function collectSSRExternalPackages(ssrBundle) {
|
|
|
1321
1423
|
}
|
|
1322
1424
|
__name(collectSSRExternalPackages, "collectSSRExternalPackages");
|
|
1323
1425
|
function createExternalSSRBundlePlugin(nitroEntryPath, ssrOutputDir, ssrEntryFile) {
|
|
1324
|
-
const resolvedNitroEntry =
|
|
1325
|
-
const resolvedSSREntry =
|
|
1426
|
+
const resolvedNitroEntry = path9.resolve(nitroEntryPath);
|
|
1427
|
+
const resolvedSSREntry = path9.resolve(ssrOutputDir, ssrEntryFile);
|
|
1326
1428
|
return {
|
|
1327
1429
|
name: "farm-externalize-prebuilt-ssr",
|
|
1328
1430
|
resolveId(source, importer) {
|
|
1329
|
-
if (!importer ||
|
|
1431
|
+
if (!importer || path9.resolve(importer) !== resolvedNitroEntry) {
|
|
1330
1432
|
return null;
|
|
1331
1433
|
}
|
|
1332
|
-
const resolvedImport =
|
|
1434
|
+
const resolvedImport = path9.resolve(path9.dirname(importer), source);
|
|
1333
1435
|
if (resolvedImport !== resolvedSSREntry) return null;
|
|
1334
1436
|
return { id: FARM_SSR_PACKAGE_IMPORT, external: true };
|
|
1335
1437
|
}
|
|
@@ -1348,6 +1450,10 @@ function hasFarmServerCacheConfig(cache) {
|
|
|
1348
1450
|
return cache.adapter !== void 0 || cache.namespace !== void 0 || cache.maxEntries !== void 0 || cache.lease !== void 0;
|
|
1349
1451
|
}
|
|
1350
1452
|
__name(hasFarmServerCacheConfig, "hasFarmServerCacheConfig");
|
|
1453
|
+
function hasFarmServerStorageConfig(storage) {
|
|
1454
|
+
return !!storage && typeof storage === "object" && Reflect.ownKeys(storage).length > 0;
|
|
1455
|
+
}
|
|
1456
|
+
__name(hasFarmServerStorageConfig, "hasFarmServerStorageConfig");
|
|
1351
1457
|
function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
1352
1458
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
1353
1459
|
}
|
|
@@ -1457,13 +1563,13 @@ function resolveBuildDocsContentDir(config, root) {
|
|
|
1457
1563
|
if (!config.docs?.enabled) return null;
|
|
1458
1564
|
const configuredContentDir = config.docs.contentDir || config.docs.config.contentDir;
|
|
1459
1565
|
if (typeof configuredContentDir === "string" && configuredContentDir.trim()) {
|
|
1460
|
-
const contentDir =
|
|
1566
|
+
const contentDir = path9.isAbsolute(configuredContentDir) ? configuredContentDir : path9.join(root, configuredContentDir);
|
|
1461
1567
|
return existsSync2(contentDir) ? contentDir : null;
|
|
1462
1568
|
}
|
|
1463
1569
|
const entryDir = config.docs.config.entry || trimSlashes(config.docs.entry) || "docs";
|
|
1464
|
-
const appDocsDir =
|
|
1570
|
+
const appDocsDir = path9.join(root, config.srcDir || "src", "app", entryDir);
|
|
1465
1571
|
if (existsSync2(appDocsDir)) return appDocsDir;
|
|
1466
|
-
const rootDocsDir =
|
|
1572
|
+
const rootDocsDir = path9.join(root, entryDir);
|
|
1467
1573
|
return existsSync2(rootDocsDir) ? rootDocsDir : null;
|
|
1468
1574
|
}
|
|
1469
1575
|
__name(resolveBuildDocsContentDir, "resolveBuildDocsContentDir");
|
|
@@ -1481,7 +1587,7 @@ function hasProjectPostcssConfig(root) {
|
|
|
1481
1587
|
".postcssrc.mjs",
|
|
1482
1588
|
".postcssrc.ts"
|
|
1483
1589
|
];
|
|
1484
|
-
const projectRequire = createRequire(
|
|
1590
|
+
const projectRequire = createRequire(path9.join(root, "package.json"));
|
|
1485
1591
|
return candidates.some((file) => {
|
|
1486
1592
|
try {
|
|
1487
1593
|
projectRequire.resolve(`./${file}`);
|
|
@@ -1493,7 +1599,7 @@ function hasProjectPostcssConfig(root) {
|
|
|
1493
1599
|
}
|
|
1494
1600
|
__name(hasProjectPostcssConfig, "hasProjectPostcssConfig");
|
|
1495
1601
|
async function findFarmConfigPath(root) {
|
|
1496
|
-
const
|
|
1602
|
+
const fs4 = await import("fs/promises");
|
|
1497
1603
|
const candidates = [
|
|
1498
1604
|
"farm.config.ts",
|
|
1499
1605
|
"farm.config.mts",
|
|
@@ -1505,9 +1611,9 @@ async function findFarmConfigPath(root) {
|
|
|
1505
1611
|
"config.mjs"
|
|
1506
1612
|
];
|
|
1507
1613
|
for (const candidate of candidates) {
|
|
1508
|
-
const resolvedPath =
|
|
1614
|
+
const resolvedPath = path9.join(root, candidate);
|
|
1509
1615
|
try {
|
|
1510
|
-
await
|
|
1616
|
+
await fs4.access(resolvedPath);
|
|
1511
1617
|
return resolvedPath;
|
|
1512
1618
|
} catch {
|
|
1513
1619
|
}
|
|
@@ -1535,13 +1641,13 @@ function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
|
1535
1641
|
}
|
|
1536
1642
|
__name(farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
|
|
1537
1643
|
async function discoverMiddlewareRoutes(appDir) {
|
|
1538
|
-
const
|
|
1644
|
+
const fs4 = await import("fs/promises");
|
|
1539
1645
|
const appDirs = Array.isArray(appDir) ? [...appDir] : [appDir];
|
|
1540
1646
|
const routes = /* @__PURE__ */ new Map();
|
|
1541
1647
|
async function walk(dir, routePath, directory, discovered) {
|
|
1542
1648
|
let entries;
|
|
1543
1649
|
try {
|
|
1544
|
-
entries = await
|
|
1650
|
+
entries = await fs4.readdir(dir, { withFileTypes: true });
|
|
1545
1651
|
} catch {
|
|
1546
1652
|
return;
|
|
1547
1653
|
}
|
|
@@ -1552,7 +1658,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1552
1658
|
discovered.push({
|
|
1553
1659
|
path: routePath,
|
|
1554
1660
|
directory,
|
|
1555
|
-
filePath:
|
|
1661
|
+
filePath: path9.join(dir, middlewareFile.name)
|
|
1556
1662
|
});
|
|
1557
1663
|
}
|
|
1558
1664
|
for (const entry of entries) {
|
|
@@ -1560,7 +1666,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1560
1666
|
continue;
|
|
1561
1667
|
}
|
|
1562
1668
|
await walk(
|
|
1563
|
-
|
|
1669
|
+
path9.join(dir, entry.name),
|
|
1564
1670
|
appendMiddlewareRoutePath(routePath, entry.name),
|
|
1565
1671
|
appendMiddlewareDirectory(directory, entry.name),
|
|
1566
1672
|
discovered
|
|
@@ -1637,21 +1743,21 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1637
1743
|
})
|
|
1638
1744
|
);
|
|
1639
1745
|
logger.info(`\u{1F4CB} Found ${pageRoutes.length} page routes`);
|
|
1640
|
-
const
|
|
1746
|
+
const fs4 = await import("fs/promises");
|
|
1641
1747
|
const layoutRoutes = [];
|
|
1642
|
-
const appDir =
|
|
1748
|
+
const appDir = path9.join(root, srcDir, "app");
|
|
1643
1749
|
async function findLayoutsForClient(dir, routePrefix = "/") {
|
|
1644
1750
|
try {
|
|
1645
|
-
const entries = await
|
|
1751
|
+
const entries = await fs4.readdir(dir, { withFileTypes: true });
|
|
1646
1752
|
for (const entry of entries) {
|
|
1647
1753
|
if (entry.isFile() && entry.name.match(/^layout\.(tsx?|jsx?|vue|svelte)$/)) {
|
|
1648
1754
|
layoutRoutes.push({
|
|
1649
1755
|
pattern: routePrefix,
|
|
1650
|
-
modulePath:
|
|
1756
|
+
modulePath: path9.join(dir, entry.name)
|
|
1651
1757
|
});
|
|
1652
1758
|
} else if (entry.isDirectory() && !entry.name.startsWith(".") && !entry.name.startsWith("_")) {
|
|
1653
1759
|
const childPrefix = routePrefix === "/" ? `/${entry.name}` : `${routePrefix}/${entry.name}`;
|
|
1654
|
-
await findLayoutsForClient(
|
|
1760
|
+
await findLayoutsForClient(path9.join(dir, entry.name), childPrefix);
|
|
1655
1761
|
}
|
|
1656
1762
|
}
|
|
1657
1763
|
} catch {
|
|
@@ -1668,7 +1774,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1668
1774
|
logger.info(`\u{1F4CB} Found ${pageRoutes.length} page routes and ${layoutRoutes.length} layouts`);
|
|
1669
1775
|
const isolatedClientBoundaryModules = routeManager.getIsolatedClientBoundaryModules(root);
|
|
1670
1776
|
const hydrationPlanCache = /* @__PURE__ */ new Map();
|
|
1671
|
-
const clientOutputDir =
|
|
1777
|
+
const clientOutputDir = path9.join(root, distDir, "client");
|
|
1672
1778
|
const [productionViteResult] = await productionViteResultPromise;
|
|
1673
1779
|
if (productionViteResult.status === "rejected") {
|
|
1674
1780
|
await routeRuntimeManifestResultPromise;
|
|
@@ -1687,7 +1793,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1687
1793
|
routeSlots,
|
|
1688
1794
|
isolatedClientBoundaryModules,
|
|
1689
1795
|
hydrationPlanCache,
|
|
1690
|
-
rendererBuildLifetime
|
|
1796
|
+
rendererBuildLifetime,
|
|
1797
|
+
routeManager.getProgrammaticClientRoutes()
|
|
1691
1798
|
), "buildClientBundle");
|
|
1692
1799
|
const buildSSRBundle = /* @__PURE__ */ __name(() => buildSSRInMemory(
|
|
1693
1800
|
productionVite,
|
|
@@ -1739,7 +1846,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1739
1846
|
routeSlots,
|
|
1740
1847
|
isolatedClientBoundaryModules,
|
|
1741
1848
|
hydrationPlanCache,
|
|
1742
|
-
rendererBuildLifetime
|
|
1849
|
+
rendererBuildLifetime,
|
|
1850
|
+
routeManager.getProgrammaticClientRoutes()
|
|
1743
1851
|
);
|
|
1744
1852
|
} catch (retryError) {
|
|
1745
1853
|
if (!(retryError instanceof IncompleteClientBuildOutputError)) throw retryError;
|
|
@@ -1777,10 +1885,10 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1777
1885
|
lifecyclePluginManager
|
|
1778
1886
|
);
|
|
1779
1887
|
const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
|
|
1780
|
-
|
|
1888
|
+
path9.join(root, distDir),
|
|
1781
1889
|
routeRuntimeManifest
|
|
1782
1890
|
);
|
|
1783
|
-
logger.info(`\u{1F4CB} Route runtime manifest: ${
|
|
1891
|
+
logger.info(`\u{1F4CB} Route runtime manifest: ${path9.relative(root, runtimeManifestPath)}`);
|
|
1784
1892
|
} catch (error) {
|
|
1785
1893
|
if (lifecyclePluginManager) {
|
|
1786
1894
|
await lifecyclePluginManager.runHookParallel("onError", {
|
|
@@ -1800,50 +1908,50 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1800
1908
|
}
|
|
1801
1909
|
__name(buildUniversal, "buildUniversal");
|
|
1802
1910
|
async function writeSSRAssetsToClient(bundle, outputDir) {
|
|
1803
|
-
const
|
|
1911
|
+
const fs4 = await import("fs/promises");
|
|
1804
1912
|
for (const [fileName, output] of Object.entries(bundle)) {
|
|
1805
1913
|
if (output.type !== "asset") continue;
|
|
1806
1914
|
if (fileName === "farm-fonts.css") {
|
|
1807
1915
|
await mergeBuiltFontCss(outputDir, output.source);
|
|
1808
1916
|
continue;
|
|
1809
1917
|
}
|
|
1810
|
-
const filePath =
|
|
1811
|
-
await
|
|
1812
|
-
await
|
|
1918
|
+
const filePath = path9.join(outputDir, fileName);
|
|
1919
|
+
await fs4.mkdir(path9.dirname(filePath), { recursive: true });
|
|
1920
|
+
await fs4.writeFile(filePath, output.source);
|
|
1813
1921
|
}
|
|
1814
1922
|
}
|
|
1815
1923
|
__name(writeSSRAssetsToClient, "writeSSRAssetsToClient");
|
|
1816
1924
|
async function copyFarmDocsFontAssetsToClient(root, outputDir) {
|
|
1817
|
-
const
|
|
1925
|
+
const fs4 = await import("fs/promises");
|
|
1818
1926
|
await Promise.all(
|
|
1819
1927
|
resolveFarmDocsFontAssets(root).map(async ({ sourcePath, url }) => {
|
|
1820
|
-
const targetPath =
|
|
1821
|
-
await
|
|
1822
|
-
await
|
|
1928
|
+
const targetPath = path9.join(outputDir, url.replace(/^\/+/, ""));
|
|
1929
|
+
await fs4.mkdir(path9.dirname(targetPath), { recursive: true });
|
|
1930
|
+
await fs4.copyFile(sourcePath, targetPath);
|
|
1823
1931
|
})
|
|
1824
1932
|
);
|
|
1825
1933
|
}
|
|
1826
1934
|
__name(copyFarmDocsFontAssetsToClient, "copyFarmDocsFontAssetsToClient");
|
|
1827
1935
|
async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
1828
|
-
const
|
|
1829
|
-
const fontCssPath =
|
|
1936
|
+
const fs4 = await import("fs/promises");
|
|
1937
|
+
const fontCssPath = path9.join(outputDir, "farm-fonts.css");
|
|
1830
1938
|
let fontCss = fontCssSource;
|
|
1831
1939
|
if (fontCss === void 0) {
|
|
1832
1940
|
try {
|
|
1833
|
-
fontCss = await
|
|
1941
|
+
fontCss = await fs4.readFile(fontCssPath);
|
|
1834
1942
|
} catch {
|
|
1835
1943
|
return;
|
|
1836
1944
|
}
|
|
1837
1945
|
}
|
|
1838
|
-
const clientCssPath =
|
|
1946
|
+
const clientCssPath = path9.join(outputDir, "farm-client.css");
|
|
1839
1947
|
let clientCss = "";
|
|
1840
1948
|
try {
|
|
1841
|
-
clientCss = await
|
|
1949
|
+
clientCss = await fs4.readFile(clientCssPath, "utf8");
|
|
1842
1950
|
} catch {
|
|
1843
1951
|
}
|
|
1844
1952
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
1845
|
-
await
|
|
1846
|
-
await
|
|
1953
|
+
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
1954
|
+
await fs4.writeFile(clientCssPath, mergeFarmFontCss(clientCss, normalizedFontCss));
|
|
1847
1955
|
}
|
|
1848
1956
|
__name(mergeBuiltFontCss, "mergeBuiltFontCss");
|
|
1849
1957
|
var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
|
|
@@ -1855,28 +1963,28 @@ var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError
|
|
|
1855
1963
|
__name(_IncompleteClientBuildOutputError, "IncompleteClientBuildOutputError");
|
|
1856
1964
|
var IncompleteClientBuildOutputError = _IncompleteClientBuildOutputError;
|
|
1857
1965
|
async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
1858
|
-
const
|
|
1966
|
+
const fs4 = await import("fs/promises");
|
|
1859
1967
|
const fingerprinted = await findFingerprintedClientEntry(outputDir);
|
|
1860
|
-
const clientEntryPath =
|
|
1968
|
+
const clientEntryPath = path9.join(outputDir, fingerprinted ?? "farm-client.js");
|
|
1861
1969
|
let clientEntrySize = 0;
|
|
1862
1970
|
try {
|
|
1863
|
-
const clientEntry = await
|
|
1971
|
+
const clientEntry = await fs4.stat(clientEntryPath);
|
|
1864
1972
|
if (clientEntry.isFile()) clientEntrySize = clientEntry.size;
|
|
1865
1973
|
} catch {
|
|
1866
1974
|
}
|
|
1867
1975
|
if (clientEntrySize === 0) {
|
|
1868
1976
|
throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
|
|
1869
1977
|
}
|
|
1870
|
-
const clientCssPath =
|
|
1871
|
-
const globalsCssPath =
|
|
1978
|
+
const clientCssPath = path9.join(outputDir, "farm-client.css");
|
|
1979
|
+
const globalsCssPath = path9.join(root, srcDir, "app", "globals.css");
|
|
1872
1980
|
let expectsCss = false;
|
|
1873
1981
|
try {
|
|
1874
|
-
const globalsCss = await
|
|
1982
|
+
const globalsCss = await fs4.readFile(globalsCssPath, "utf8");
|
|
1875
1983
|
expectsCss = globalsCss.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
|
|
1876
1984
|
} catch {
|
|
1877
1985
|
}
|
|
1878
1986
|
try {
|
|
1879
|
-
const clientCss = await
|
|
1987
|
+
const clientCss = await fs4.stat(clientCssPath);
|
|
1880
1988
|
if (expectsCss && (!clientCss.isFile() || clientCss.size === 0)) {
|
|
1881
1989
|
throw new IncompleteClientBuildOutputError("farm-client.css is empty");
|
|
1882
1990
|
}
|
|
@@ -1885,12 +1993,12 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
1885
1993
|
if (expectsCss) {
|
|
1886
1994
|
throw new IncompleteClientBuildOutputError("farm-client.css is missing");
|
|
1887
1995
|
}
|
|
1888
|
-
await
|
|
1996
|
+
await fs4.writeFile(clientCssPath, "");
|
|
1889
1997
|
}
|
|
1890
1998
|
}
|
|
1891
1999
|
__name(validateClientBuildOutput, "validateClientBuildOutput");
|
|
1892
2000
|
function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, options = {}) {
|
|
1893
|
-
const key = `${
|
|
2001
|
+
const key = `${path9.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${path9.resolve(modulePath)}`;
|
|
1894
2002
|
let plan = cache.get(key);
|
|
1895
2003
|
if (!plan) {
|
|
1896
2004
|
plan = getClientModuleHydrationPlan(modulePath, root, mode, options);
|
|
@@ -1899,11 +2007,11 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
1899
2007
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
1900
2008
|
}
|
|
1901
2009
|
__name(getCachedClientModuleHydrationPlan, "getCachedClientModuleHydrationPlan");
|
|
1902
|
-
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime) {
|
|
2010
|
+
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes) {
|
|
1903
2011
|
const viteBuild = productionVite.build;
|
|
1904
2012
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
1905
|
-
const { PluginManager: PluginManager2 } = await import("./plugin.mjs");
|
|
1906
|
-
const
|
|
2013
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-SYMK7PQ2.mjs");
|
|
2014
|
+
const fs4 = await import("fs/promises");
|
|
1907
2015
|
const pluginManager = new PluginManager2({
|
|
1908
2016
|
config,
|
|
1909
2017
|
isDev: false,
|
|
@@ -2129,10 +2237,10 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2129
2237
|
logger.info(
|
|
2130
2238
|
`\u{1F4F1} Total hydratable routes detected: ${clientPages.length} pages, ${clientLayouts.filter((layout) => layout.shouldHydrate || layout.hasIsolatedClientBoundaries).length} layouts, and ${clientRouteSlots.length} slots`
|
|
2131
2239
|
);
|
|
2132
|
-
const clientEntryRoot =
|
|
2133
|
-
await
|
|
2134
|
-
const clientEntryDir = await
|
|
2135
|
-
const clientEntryPath =
|
|
2240
|
+
const clientEntryRoot = path9.join(root, ".farm", "tmp");
|
|
2241
|
+
await fs4.mkdir(clientEntryRoot, { recursive: true });
|
|
2242
|
+
const clientEntryDir = await fs4.mkdtemp(path9.join(clientEntryRoot, "client-entry-"));
|
|
2243
|
+
const clientEntryPath = path9.join(clientEntryDir, "farm-client-entry.tsx");
|
|
2136
2244
|
const clientHydrationCode = generateClientHydrationEntry(
|
|
2137
2245
|
clientPages,
|
|
2138
2246
|
clientLayouts,
|
|
@@ -2153,7 +2261,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2153
2261
|
generateClientCachePersistenceCode(resolveFarmClientCacheAdapterEntry(root, config.cache)),
|
|
2154
2262
|
adapterOwnsDocsRuntime ? getFarmDocsAdapterConfigModule(config.docs) : void 0
|
|
2155
2263
|
);
|
|
2156
|
-
await
|
|
2264
|
+
await fs4.writeFile(clientEntryPath, clientHydrationCode);
|
|
2157
2265
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2158
2266
|
let postcssSearchPath;
|
|
2159
2267
|
let tailwindVitePlugin = void 0;
|
|
@@ -2164,8 +2272,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2164
2272
|
if (hasScopedPostcssConfig) {
|
|
2165
2273
|
logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
2166
2274
|
} else {
|
|
2167
|
-
const postcssConfigPath =
|
|
2168
|
-
await
|
|
2275
|
+
const postcssConfigPath = path9.join(clientEntryDir, "postcss.config.cjs");
|
|
2276
|
+
await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2169
2277
|
postcssSearchPath = clientEntryDir;
|
|
2170
2278
|
tailwindVitePlugin = await loadTailwindVitePlugin({
|
|
2171
2279
|
builder: productionVite.builder,
|
|
@@ -2187,6 +2295,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2187
2295
|
target: FARM_CLIENT_BUILD_TARGET,
|
|
2188
2296
|
outDir: outputDir,
|
|
2189
2297
|
emptyOutDir: true,
|
|
2298
|
+
// Never public: see resolveFarmClientSourcemap.
|
|
2299
|
+
sourcemap: resolveFarmClientSourcemap(config.vite?.build?.sourcemap),
|
|
2190
2300
|
assetsInlineLimit: 0,
|
|
2191
2301
|
cssCodeSplit: false,
|
|
2192
2302
|
// Bundle all CSS into one file
|
|
@@ -2237,15 +2347,18 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2237
2347
|
},
|
|
2238
2348
|
plugins: [
|
|
2239
2349
|
createFarmThemeCssPlugin(config.theme, config.basePath),
|
|
2350
|
+
createFarmPrivateClientSourcemapsPlugin({
|
|
2351
|
+
outDir: path9.join(path9.dirname(outputDir), FARM_CLIENT_SOURCEMAPS_DIR)
|
|
2352
|
+
}),
|
|
2240
2353
|
createFarmClientModulePreloadPlugin({
|
|
2241
2354
|
root,
|
|
2242
|
-
buildDir:
|
|
2355
|
+
buildDir: path9.dirname(outputDir),
|
|
2243
2356
|
entryName: "farm-client"
|
|
2244
2357
|
}),
|
|
2245
2358
|
...adapterOwnsDocsRuntime ? [
|
|
2246
2359
|
createFarmDocsModulePreloadPlugin({
|
|
2247
2360
|
root,
|
|
2248
|
-
buildDir:
|
|
2361
|
+
buildDir: path9.dirname(outputDir),
|
|
2249
2362
|
importer: clientEntryPath,
|
|
2250
2363
|
entryName: "farm-client",
|
|
2251
2364
|
modules: [
|
|
@@ -2308,8 +2421,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2308
2421
|
return null;
|
|
2309
2422
|
}
|
|
2310
2423
|
},
|
|
2311
|
-
farmPlugin(
|
|
2312
|
-
|
|
2424
|
+
farmPlugin(
|
|
2425
|
+
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
|
|
2426
|
+
pluginManager
|
|
2427
|
+
),
|
|
2428
|
+
farmEnvironmentFunctionsPlugin(config)
|
|
2313
2429
|
],
|
|
2314
2430
|
mode: "production",
|
|
2315
2431
|
css: postcssSearchPath ? {
|
|
@@ -2335,7 +2451,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2335
2451
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2336
2452
|
} finally {
|
|
2337
2453
|
try {
|
|
2338
|
-
await
|
|
2454
|
+
await fs4.rm(clientEntryDir, { recursive: true, force: true });
|
|
2339
2455
|
} catch {
|
|
2340
2456
|
}
|
|
2341
2457
|
}
|
|
@@ -2343,12 +2459,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2343
2459
|
__name(buildClient, "buildClient");
|
|
2344
2460
|
function toBakedMarkdownSourcePath(root, filePath) {
|
|
2345
2461
|
if (!filePath) return "";
|
|
2346
|
-
if (!
|
|
2347
|
-
const relative =
|
|
2348
|
-
if (!relative || relative.startsWith("..") ||
|
|
2349
|
-
return
|
|
2462
|
+
if (!path9.isAbsolute(filePath)) return filePath.split(path9.sep).join("/");
|
|
2463
|
+
const relative = path9.relative(root, filePath);
|
|
2464
|
+
if (!relative || relative.startsWith("..") || path9.isAbsolute(relative)) {
|
|
2465
|
+
return path9.basename(filePath);
|
|
2350
2466
|
}
|
|
2351
|
-
return relative.split(
|
|
2467
|
+
return relative.split(path9.sep).join("/");
|
|
2352
2468
|
}
|
|
2353
2469
|
__name(toBakedMarkdownSourcePath, "toBakedMarkdownSourcePath");
|
|
2354
2470
|
function generateUniversalRouterStateRuntime() {
|
|
@@ -3105,7 +3221,7 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
|
|
|
3105
3221
|
root,
|
|
3106
3222
|
renderer.componentExtensions ?? []
|
|
3107
3223
|
);
|
|
3108
|
-
const globalsCssPath =
|
|
3224
|
+
const globalsCssPath = path9.join(root, srcDir, "app", "globals.css");
|
|
3109
3225
|
const cssImport = existsSync2(globalsCssPath) ? `import ${JSON.stringify(toImportPath(globalsCssPath))};` : "";
|
|
3110
3226
|
const layoutImportStatements = [];
|
|
3111
3227
|
const layoutRegistrations = [];
|
|
@@ -4578,8 +4694,8 @@ __name(generateClientHydrationEntry, "generateClientHydrationEntry");
|
|
|
4578
4694
|
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
|
|
4579
4695
|
const viteBuild = productionVite.build;
|
|
4580
4696
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
4581
|
-
const { PluginManager: PluginManager2 } = await import("./plugin.mjs");
|
|
4582
|
-
const
|
|
4697
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-SYMK7PQ2.mjs");
|
|
4698
|
+
const fs4 = await import("fs/promises");
|
|
4583
4699
|
const pluginManager = new PluginManager2({
|
|
4584
4700
|
config,
|
|
4585
4701
|
isDev: false,
|
|
@@ -4594,9 +4710,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4594
4710
|
buildLifetime: rendererBuildLifetime
|
|
4595
4711
|
});
|
|
4596
4712
|
if (!hasScopedPostcssConfig) {
|
|
4597
|
-
postcssConfigDir = await
|
|
4598
|
-
await
|
|
4599
|
-
|
|
4713
|
+
postcssConfigDir = await fs4.mkdtemp(path9.join(os.tmpdir(), "farm-postcss-"));
|
|
4714
|
+
await fs4.writeFile(
|
|
4715
|
+
path9.join(postcssConfigDir, "postcss.config.cjs"),
|
|
4600
4716
|
"module.exports = { plugins: [] };\n"
|
|
4601
4717
|
);
|
|
4602
4718
|
tailwindVitePlugin = await loadTailwindVitePlugin({
|
|
@@ -4621,7 +4737,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4621
4737
|
fileName: entry.fileName,
|
|
4622
4738
|
sourceType: "static",
|
|
4623
4739
|
staticInfo: entry.staticInfo,
|
|
4624
|
-
data: (await
|
|
4740
|
+
data: (await fs4.readFile(entry.modulePath)).toString("base64")
|
|
4625
4741
|
});
|
|
4626
4742
|
continue;
|
|
4627
4743
|
}
|
|
@@ -4722,7 +4838,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4722
4838
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
4723
4839
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
4724
4840
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
4725
|
-
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
4841
|
+
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasFarmServerStorageConfig(config.storage) || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
4726
4842
|
const hasRuntimeConfigModule = hasFarmRuntimeConfigModule(config, configModulePath);
|
|
4727
4843
|
const hasRuntimeIntegrationConfig = hasRuntimeConfigModule && hasAnyConfiguredIntegrations;
|
|
4728
4844
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
@@ -4790,6 +4906,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4790
4906
|
);
|
|
4791
4907
|
const virtualEntryId = "\0virtual:farm-ssr-entry";
|
|
4792
4908
|
const useExternalMetadataImageRuntime = shouldUseExternalMetadataImageRuntime(preset, true);
|
|
4909
|
+
const omitCoreMetadataImageRuntime = !metadataImageRoutes.some(
|
|
4910
|
+
(image) => image.sourceType === "module"
|
|
4911
|
+
);
|
|
4912
|
+
const externalMetadataImageRuntime = useExternalMetadataImageRuntime && !omitCoreMetadataImageRuntime ? ["@vercel/og"] : [];
|
|
4793
4913
|
const rendererOptionalExternals = isReactRenderer(config.renderer) ? [] : [
|
|
4794
4914
|
"react",
|
|
4795
4915
|
"react/jsx-runtime",
|
|
@@ -4823,7 +4943,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4823
4943
|
// startup; kept external, Nitro copies the package into the output.
|
|
4824
4944
|
"better-sqlite3",
|
|
4825
4945
|
...rendererOptionalExternals,
|
|
4826
|
-
...
|
|
4946
|
+
...externalMetadataImageRuntime,
|
|
4827
4947
|
"@prisma/client",
|
|
4828
4948
|
"@prisma/client/default",
|
|
4829
4949
|
"@prisma/client/default.js",
|
|
@@ -4855,7 +4975,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4855
4975
|
"fsevents",
|
|
4856
4976
|
"sharp",
|
|
4857
4977
|
...rendererOptionalExternals,
|
|
4858
|
-
...
|
|
4978
|
+
...externalMetadataImageRuntime,
|
|
4859
4979
|
"esbuild",
|
|
4860
4980
|
"lightningcss",
|
|
4861
4981
|
"rolldown",
|
|
@@ -4902,10 +5022,16 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4902
5022
|
...rendererVitePlugins,
|
|
4903
5023
|
...config.vite.plugins || [],
|
|
4904
5024
|
...!useExternalMetadataImageRuntime && metadataImageRoutes.some((image) => image.sourceType === "module") ? [createMetadataImageWasmPlugin()] : [],
|
|
5025
|
+
...omitCoreMetadataImageRuntime ? [
|
|
5026
|
+
{
|
|
5027
|
+
...createOmittedMetadataImageRuntimePlugin(useExternalMetadataImageRuntime),
|
|
5028
|
+
enforce: "pre"
|
|
5029
|
+
}
|
|
5030
|
+
] : [],
|
|
4905
5031
|
{ ...createReactProductionModePlugin(), enforce: "pre" },
|
|
4906
5032
|
farmServerOnlyEntriesPlugin(),
|
|
4907
5033
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
4908
|
-
farmEnvironmentFunctionsPlugin(),
|
|
5034
|
+
farmEnvironmentFunctionsPlugin(config),
|
|
4909
5035
|
{
|
|
4910
5036
|
name: "farm-virtual-ssr-entry",
|
|
4911
5037
|
resolveId(id) {
|
|
@@ -4956,7 +5082,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4956
5082
|
} finally {
|
|
4957
5083
|
if (postcssConfigDir) {
|
|
4958
5084
|
try {
|
|
4959
|
-
await
|
|
5085
|
+
await fs4.rm(postcssConfigDir, { recursive: true, force: true });
|
|
4960
5086
|
} catch {
|
|
4961
5087
|
}
|
|
4962
5088
|
}
|
|
@@ -4970,7 +5096,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4970
5096
|
__name(buildSSRInMemory, "buildSSRInMemory");
|
|
4971
5097
|
function readFarmAppPackageIdentity(root) {
|
|
4972
5098
|
try {
|
|
4973
|
-
return JSON.parse(readFileSync(
|
|
5099
|
+
return JSON.parse(readFileSync(path9.join(root, "package.json"), "utf8"));
|
|
4974
5100
|
} catch {
|
|
4975
5101
|
return {};
|
|
4976
5102
|
}
|
|
@@ -5077,7 +5203,7 @@ function matchLocalIntegrationRequest(request) {
|
|
|
5077
5203
|
});` : "return null;"}
|
|
5078
5204
|
}
|
|
5079
5205
|
|
|
5080
|
-
async function handleIntegrationRequest(request, ranMiddleware) {
|
|
5206
|
+
async function handleIntegrationRequest(request, ranMiddleware, clientAddress) {
|
|
5081
5207
|
${options.hasServerRuntimeIntegrations ? `return dispatchIntegrationRequests(
|
|
5082
5208
|
serverRuntimeIntegrations,
|
|
5083
5209
|
{
|
|
@@ -5086,7 +5212,7 @@ async function handleIntegrationRequest(request, ranMiddleware) {
|
|
|
5086
5212
|
isProd: true,
|
|
5087
5213
|
},
|
|
5088
5214
|
request,
|
|
5089
|
-
{ ranMiddleware },
|
|
5215
|
+
{ ranMiddleware, clientAddress },
|
|
5090
5216
|
);` : `return { response: null, setCookies: [] };`}
|
|
5091
5217
|
}
|
|
5092
5218
|
|
|
@@ -5171,17 +5297,6 @@ function applyConfiguredResponseHeaders(response, pathname) {
|
|
|
5171
5297
|
`.trim();
|
|
5172
5298
|
}
|
|
5173
5299
|
__name(generateConfiguredResponseHeadersRuntimeSource, "generateConfiguredResponseHeadersRuntimeSource");
|
|
5174
|
-
function parseRouteRenderingDirectiveFromDisk(modulePath) {
|
|
5175
|
-
try {
|
|
5176
|
-
const source = readFileSync(modulePath, "utf8");
|
|
5177
|
-
const directive = parseRouteRenderingDirective(source);
|
|
5178
|
-
if (findRequestBoundSourceBlockers(source).length === 0) return directive;
|
|
5179
|
-
return { ...directive ?? { ssg: false, ppr: false, directive: "" }, requestBound: true };
|
|
5180
|
-
} catch {
|
|
5181
|
-
return void 0;
|
|
5182
|
-
}
|
|
5183
|
-
}
|
|
5184
|
-
__name(parseRouteRenderingDirectiveFromDisk, "parseRouteRenderingDirectiveFromDisk");
|
|
5185
5300
|
function generatePreloadResponseRuntimeSource() {
|
|
5186
5301
|
return `
|
|
5187
5302
|
// Farm builds buffered HTML responses from strings it already holds. Remember
|
|
@@ -5545,7 +5660,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5545
5660
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
5546
5661
|
);
|
|
5547
5662
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
5548
|
-
const renderingDirective =
|
|
5663
|
+
const renderingDirective = readRouteRenderingDirectiveFromFile(route.modulePath);
|
|
5549
5664
|
pageRegistrations.push(`
|
|
5550
5665
|
{
|
|
5551
5666
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -5721,6 +5836,8 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5721
5836
|
createFarmProductionLifecycle,
|
|
5722
5837
|
createFarmNodeRequestAbortSignal,
|
|
5723
5838
|
createProductionMiddlewareRunner,
|
|
5839
|
+
_withFarmGuardedResponseCache,
|
|
5840
|
+
_farmPluginsKeepResponsesPrivate,
|
|
5724
5841
|
getTheme as getFarmTheme,
|
|
5725
5842
|
emitFarmEvent,
|
|
5726
5843
|
getFarmDataCache,
|
|
@@ -5758,7 +5875,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5758
5875
|
stripFarmLocaleFromPathname,
|
|
5759
5876
|
withFarmRouteContext,
|
|
5760
5877
|
createLateNotFoundRecovery,
|
|
5761
|
-
createLateRedirectRecovery,
|
|
5878
|
+
createLateRedirectRecovery,${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
|
|
5762
5879
|
} from "@farm.js/core/internal/production-runtime";`;
|
|
5763
5880
|
const productionSiteTelemetryImport = config.telemetry ? `import { createFarmProductionSiteReporter } from "@farm.js/core/internal/product-telemetry-runtime";` : "";
|
|
5764
5881
|
const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse } from "@farm.js/core/internal/metadata-image-runtime";` : "";
|
|
@@ -5784,7 +5901,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
5784
5901
|
const markdownHandlerImport = config.md?.enabled ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
5785
5902
|
const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
|
|
5786
5903
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
5787
|
-
const mdxComponentsPath = typeof config.mdx?.components === "string" ?
|
|
5904
|
+
const mdxComponentsPath = typeof config.mdx?.components === "string" ? path9.isAbsolute(config.mdx.components) ? config.mdx.components : path9.join(config.root, config.mdx.components) : null;
|
|
5788
5905
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
5789
5906
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
5790
5907
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -5810,8 +5927,8 @@ ${integrationRuntimeImport}
|
|
|
5810
5927
|
${nativeAuth.importSource}
|
|
5811
5928
|
${nativeMCP.importSource}
|
|
5812
5929
|
`;
|
|
5813
|
-
const imageRuntime =
|
|
5814
|
-
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
5930
|
+
const imageRuntime = resolveFarmImageServerRuntime(config.images, preset);
|
|
5931
|
+
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
5815
5932
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
5816
5933
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
5817
5934
|
const matchBuiltAPIRoute = createStaticAPIRouteMatcherAtBasePath(apiRoutes, farmLocalAPIBasePath);
|
|
@@ -6105,6 +6222,10 @@ const farmPluginRuntime = ${hasPluginRuntime ? `configuredPlugins.length > 0
|
|
|
6105
6222
|
return manager;
|
|
6106
6223
|
})()
|
|
6107
6224
|
: null` : "null"};
|
|
6225
|
+
// A plugin's runtime.before runs for every request and may be a guard, like middleware.
|
|
6226
|
+
const farmPluginRuntimeKeepsResponsesPrivate = farmPluginRuntime
|
|
6227
|
+
? _farmPluginsKeepResponsesPrivate(configuredPlugins)
|
|
6228
|
+
: false;
|
|
6108
6229
|
const hasFarmPluginHTMLTransforms = configuredPlugins.some(
|
|
6109
6230
|
(plugin) => plugin.render?.html || plugin.afterRender || plugin.transformHTML,
|
|
6110
6231
|
);
|
|
@@ -6138,6 +6259,7 @@ const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringif
|
|
|
6138
6259
|
)};
|
|
6139
6260
|
configureFarmObservability(farmObservabilityConfig);
|
|
6140
6261
|
configureFarmCache(farmResolvedRuntimeConfig.cache);
|
|
6262
|
+
${createFarmStorageModuleRegistration(config)}
|
|
6141
6263
|
const farmI18nConfig = ${JSON.stringify(config.i18n)};
|
|
6142
6264
|
const farmServerConfig = ${JSON.stringify(config.server)};
|
|
6143
6265
|
const farmThemeConfig = ${JSON.stringify(config.theme)};
|
|
@@ -6156,9 +6278,11 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
6156
6278
|
server: farmServerConfig,
|
|
6157
6279
|
start: async () => {
|
|
6158
6280
|
await farmInstrumentationLifecycle.start();
|
|
6159
|
-
try {
|
|
6281
|
+
try {${hasFarmServerStorageConfig(config.storage) ? `
|
|
6282
|
+
// The configured drivers and mounts, as the development server applies them.
|
|
6283
|
+
await initFarmStorage(farmResolvedRuntimeConfig.storage);` : ""}
|
|
6160
6284
|
await farmPluginRuntime?.startRuntime();
|
|
6161
|
-
} catch (error) {
|
|
6285
|
+
} catch (error) {${hasFarmServerStorageConfig(config.storage) ? "\n await disposeFarmStorage();" : ""}
|
|
6162
6286
|
await farmInstrumentationLifecycle.shutdown();
|
|
6163
6287
|
throw error;
|
|
6164
6288
|
}
|
|
@@ -6166,7 +6290,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
6166
6290
|
close: async (reason) => {
|
|
6167
6291
|
try {
|
|
6168
6292
|
await farmPluginRuntime?.closeRuntime(reason);${hasInfraAnalyticsRuntime && !hasPluginRuntime ? "\n await farmInfraAnalytics?.close();" : ""}
|
|
6169
|
-
} finally {
|
|
6293
|
+
} finally {${hasFarmServerStorageConfig(config.storage) ? "\n await disposeFarmStorage();" : ""}
|
|
6170
6294
|
await farmInstrumentationLifecycle.shutdown();
|
|
6171
6295
|
}
|
|
6172
6296
|
},
|
|
@@ -6264,7 +6388,7 @@ const farmDocsAPIHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDo
|
|
|
6264
6388
|
|
|
6265
6389
|
// API routes bundled at build time
|
|
6266
6390
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
6267
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
6391
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path11, methods }) => ({ path: path11, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
|
|
6268
6392
|
// A plugin calling an app endpoint (an MCP tool, say) goes through the whole
|
|
6269
6393
|
// pipeline, so the endpoint's middleware and integration guards run for it.
|
|
6270
6394
|
function dispatchFarmPluginAPIRequest(request) {
|
|
@@ -6764,7 +6888,7 @@ function stripFarmDocumentWrappers(markup) {
|
|
|
6764
6888
|
function peelFarmDocumentPrefix(markup) {
|
|
6765
6889
|
let inner = markup.replace(/^\\s+/, "");
|
|
6766
6890
|
let hoisted = "";
|
|
6767
|
-
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
|
|
6891
|
+
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
6768
6892
|
const hoistable = /${HOISTED_HEAD_ELEMENT.source}/i;
|
|
6769
6893
|
let match;
|
|
6770
6894
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
@@ -7872,7 +7996,8 @@ ${config.docs?.enabled ? `async function wrapFarmDocsResponseWithLayouts(request
|
|
|
7872
7996
|
});
|
|
7873
7997
|
}` : ""}
|
|
7874
7998
|
|
|
7875
|
-
|
|
7999
|
+
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
8000
|
+
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
7876
8001
|
const experimentalPPREnabled = ${JSON.stringify(config.experimental?.ppr === true)};
|
|
7877
8002
|
|
|
7878
8003
|
function resolveRouteRenderingView(route) {
|
|
@@ -8016,6 +8141,10 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
8016
8141
|
return response;
|
|
8017
8142
|
}
|
|
8018
8143
|
|
|
8144
|
+
// Middleware that let a request through may have been a guard: an IP allowlist, an API key
|
|
8145
|
+
// header, a VPN header. A CDN keys its copy by URL and never runs the guard on a hit, so
|
|
8146
|
+
// whatever such a request answers stays out of shared caches. Only middleware declaring
|
|
8147
|
+
// cache: "public" (and plugins declaring runtime.cache: "public") leave the policy alone.
|
|
8019
8148
|
async function handleFarmRequestInContext(
|
|
8020
8149
|
request,
|
|
8021
8150
|
farmLocaleResolution,
|
|
@@ -8023,6 +8152,31 @@ async function handleFarmRequestInContext(
|
|
|
8023
8152
|
requestStartTime = Date.now(),
|
|
8024
8153
|
adapterContext,
|
|
8025
8154
|
requestUrl = new URL(request.url),
|
|
8155
|
+
) {
|
|
8156
|
+
const farmCacheGuard = { guarded: farmPluginRuntimeKeepsResponsesPrivate };
|
|
8157
|
+
const response = await resolveFarmRequestInContext(
|
|
8158
|
+
farmCacheGuard,
|
|
8159
|
+
request,
|
|
8160
|
+
farmLocaleResolution,
|
|
8161
|
+
configuredRewriteApplied,
|
|
8162
|
+
requestStartTime,
|
|
8163
|
+
adapterContext,
|
|
8164
|
+
requestUrl,
|
|
8165
|
+
);
|
|
8166
|
+
if (!farmCacheGuard.guarded) return response;
|
|
8167
|
+
// Tells the Nitro entry, which keeps this policy over a swr rule's public one.
|
|
8168
|
+
adapterContext?.onGuardedResponse?.();
|
|
8169
|
+
return _withFarmGuardedResponseCache(response);
|
|
8170
|
+
}
|
|
8171
|
+
|
|
8172
|
+
async function resolveFarmRequestInContext(
|
|
8173
|
+
farmCacheGuard,
|
|
8174
|
+
request,
|
|
8175
|
+
farmLocaleResolution,
|
|
8176
|
+
configuredRewriteApplied,
|
|
8177
|
+
requestStartTime,
|
|
8178
|
+
adapterContext,
|
|
8179
|
+
requestUrl,
|
|
8026
8180
|
) {
|
|
8027
8181
|
let url = requestUrl;
|
|
8028
8182
|
let pathname = url.pathname;
|
|
@@ -8055,10 +8209,26 @@ async function handleFarmRequestInContext(
|
|
|
8055
8209
|
farmLocaleResolution?.locale,
|
|
8056
8210
|
);
|
|
8057
8211
|
if (rewriteDestination) {
|
|
8058
|
-
|
|
8212
|
+
let rewrittenRequest = createRewrittenRequest(request, rewriteDestination);
|
|
8059
8213
|
if (new URL(rewrittenRequest.url).origin !== url.origin) {
|
|
8060
8214
|
return globalThis.fetch(rewrittenRequest);
|
|
8061
8215
|
}
|
|
8216
|
+
if (farmPluginRuntime) {
|
|
8217
|
+
// Plugin guards ran on the requested URL. Re-run only runtime.before
|
|
8218
|
+
// so they also see the destination, like middleware does on re-entry.
|
|
8219
|
+
const guarded = await farmPluginRuntime.runRuntimeBeforeForRewrite(
|
|
8220
|
+
request,
|
|
8221
|
+
rewrittenRequest,
|
|
8222
|
+
{
|
|
8223
|
+
...getFarmPluginRequestOptions(rewrittenRequest),
|
|
8224
|
+
waitUntil: typeof adapterContext?.waitUntil === "function"
|
|
8225
|
+
? adapterContext.waitUntil.bind(adapterContext)
|
|
8226
|
+
: undefined,
|
|
8227
|
+
},
|
|
8228
|
+
);
|
|
8229
|
+
if (guarded instanceof Response) return guarded;
|
|
8230
|
+
rewrittenRequest = guarded;
|
|
8231
|
+
}
|
|
8062
8232
|
return _runWithCurrentRequest(rewrittenRequest, () =>
|
|
8063
8233
|
handleFarmRequestInContext(
|
|
8064
8234
|
rewrittenRequest,
|
|
@@ -8086,6 +8256,7 @@ async function handleFarmRequestInContext(
|
|
|
8086
8256
|
const integrationDispatch = await handleIntegrationRequest(
|
|
8087
8257
|
cloneFarmRequestWithContext(request),
|
|
8088
8258
|
farmIntegrationRanMiddleware,
|
|
8259
|
+
adapterContext?.clientAddress,
|
|
8089
8260
|
);
|
|
8090
8261
|
if (integrationDispatch.response) {
|
|
8091
8262
|
return integrationDispatch.response;
|
|
@@ -8105,6 +8276,7 @@ async function handleFarmRequestInContext(
|
|
|
8105
8276
|
if (middlewareResult.response) {
|
|
8106
8277
|
return middlewareResult.response;
|
|
8107
8278
|
}
|
|
8279
|
+
if (middlewareResult.guarded) farmCacheGuard.guarded = true;
|
|
8108
8280
|
request = middlewareResult.request;${hasServerRuntimeIntegrations ? `
|
|
8109
8281
|
// A ctx.rewrite() target is guarded as a direct request for it is: integration
|
|
8110
8282
|
// guards (protectedRoutes) and routes see the rewritten URL, as in dev. Guards
|
|
@@ -8113,6 +8285,7 @@ async function handleFarmRequestInContext(
|
|
|
8113
8285
|
const rewrittenDispatch = await handleIntegrationRequest(
|
|
8114
8286
|
cloneFarmRequestWithContext(request),
|
|
8115
8287
|
farmIntegrationRanMiddleware,
|
|
8288
|
+
adapterContext?.clientAddress,
|
|
8116
8289
|
);
|
|
8117
8290
|
farmIntegrationSetCookies = [...farmIntegrationSetCookies, ...rewrittenDispatch.setCookies];
|
|
8118
8291
|
if (rewrittenDispatch.response) {
|
|
@@ -8122,6 +8295,9 @@ async function handleFarmRequestInContext(
|
|
|
8122
8295
|
);
|
|
8123
8296
|
}
|
|
8124
8297
|
}` : ""}
|
|
8298
|
+
${hasServerRuntimeIntegrations ? `
|
|
8299
|
+
// An integration guard (protectedRoutes) that let the request through.
|
|
8300
|
+
if (farmIntegrationRanMiddleware.size > 0) farmCacheGuard.guarded = true;` : ""}
|
|
8125
8301
|
const middlewareData = middlewareResult.data;
|
|
8126
8302
|
const middlewareContext = middlewareResult.context;
|
|
8127
8303
|
const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(middlewareResult.headers, farmIntegrationSetCookies)" : "middlewareResult.headers"};
|
|
@@ -8139,6 +8315,9 @@ async function handleFarmRequestInContext(
|
|
|
8139
8315
|
const runResolvedRequest = async () => {
|
|
8140
8316
|
if (middlewareResult.notFound) return renderFarmNotFoundResponse();
|
|
8141
8317
|
` : `
|
|
8318
|
+
${hasServerRuntimeIntegrations ? `
|
|
8319
|
+
// An integration guard (protectedRoutes) that let the request through.
|
|
8320
|
+
if (farmIntegrationRanMiddleware.size > 0) farmCacheGuard.guarded = true;` : ""}
|
|
8142
8321
|
const middlewareData = undefined;
|
|
8143
8322
|
const middlewareContext = undefined;
|
|
8144
8323
|
const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(undefined, farmIntegrationSetCookies)" : "undefined"};
|
|
@@ -9521,7 +9700,9 @@ async function handleFarmPluginRequest(request, runtimeOptions, adapterContext)
|
|
|
9521
9700
|
${generatePreloadResponseRuntimeSource()}
|
|
9522
9701
|
|
|
9523
9702
|
// Export as Web Standard fetch API
|
|
9524
|
-
export async function fetch(request, context) {
|
|
9703
|
+
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
9704
|
+
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
9705
|
+
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
9525
9706
|
${config.agent?.noindexPreviews ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
9526
9707
|
basePath: farmLocalAPIBasePath,
|
|
9527
9708
|
dispatch: async (localRequest) =>
|
|
@@ -9543,6 +9724,20 @@ async function handleFarmFetch(request, context) {
|
|
|
9543
9724
|
typeof context?.waitUntil === "function" ? context.waitUntil.bind(context) : undefined,
|
|
9544
9725
|
);
|
|
9545
9726
|
|
|
9727
|
+
// headers() config applies after middleware let the request through, so it learns
|
|
9728
|
+
// whether the response was guarded and can't make that response shareable again.
|
|
9729
|
+
let farmGuardedResponse = false;
|
|
9730
|
+
if (configuredHeaderRoutes.length > 0) {
|
|
9731
|
+
const adapterContext = context;
|
|
9732
|
+
context = {
|
|
9733
|
+
...adapterContext,
|
|
9734
|
+
onGuardedResponse() {
|
|
9735
|
+
farmGuardedResponse = true;
|
|
9736
|
+
adapterContext?.onGuardedResponse?.();
|
|
9737
|
+
},
|
|
9738
|
+
};
|
|
9739
|
+
}
|
|
9740
|
+
|
|
9546
9741
|
return farmProductionLifecycle.runRequest(
|
|
9547
9742
|
() =>
|
|
9548
9743
|
runWithFarmRequestSpan(request, async () => {
|
|
@@ -9557,9 +9752,11 @@ async function handleFarmFetch(request, context) {
|
|
|
9557
9752
|
const routePathname = configuredHeaderRoutes.length > 0
|
|
9558
9753
|
? getFarmRoutePathname(new URL(runtimeRequest.url).pathname)
|
|
9559
9754
|
: undefined;
|
|
9755
|
+
const configured = applyConfiguredResponseHeaders(response, routePathname);
|
|
9560
9756
|
return applyFarmPreloadBudget(
|
|
9561
9757
|
applyFarmCspNonceToResponse(
|
|
9562
|
-
|
|
9758
|
+
// Configured headers may edit the response in place, so check it either way.
|
|
9759
|
+
farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured,
|
|
9563
9760
|
farmSecurityConfig,
|
|
9564
9761
|
cspNonce,
|
|
9565
9762
|
),
|
|
@@ -9723,8 +9920,17 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
9723
9920
|
return void 0;
|
|
9724
9921
|
}
|
|
9725
9922
|
__name(getPhysicalPrerenderBypassReason, "getPhysicalPrerenderBypassReason");
|
|
9923
|
+
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
9924
|
+
return Object.values(routeRules || {}).some((rule) => {
|
|
9925
|
+
const swr = rule?.swr;
|
|
9926
|
+
const cache = rule?.cache;
|
|
9927
|
+
const headers = rule?.headers;
|
|
9928
|
+
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
9929
|
+
});
|
|
9930
|
+
}
|
|
9931
|
+
__name(hasFarmNitroCacheRouteRule, "hasFarmNitroCacheRouteRule");
|
|
9726
9932
|
async function buildNitroUniversal(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, ssrBundle, ssrEntryFile, clientOutputDir, routeRuntimeManifest, configuredHeaderRoutes, nitroBuilderResultPromise, pluginManager) {
|
|
9727
|
-
const [
|
|
9933
|
+
const [fs4, nitroBuilderResult] = await Promise.all([
|
|
9728
9934
|
import("fs/promises"),
|
|
9729
9935
|
nitroBuilderResultPromise
|
|
9730
9936
|
]);
|
|
@@ -9733,9 +9939,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9733
9939
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
9734
9940
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
9735
9941
|
const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
|
|
9736
|
-
const runtimeServerOutputDir = isVercel ?
|
|
9737
|
-
const ssrOutputDir =
|
|
9738
|
-
const imageRuntime =
|
|
9942
|
+
const runtimeServerOutputDir = isVercel ? path9.join(outputDir, "functions", "__nitro.func") : path9.join(outputDir, "server");
|
|
9943
|
+
const ssrOutputDir = path9.join(root, distDir, "ssr");
|
|
9944
|
+
const imageRuntime = resolveFarmImageServerRuntime(config.images, preset);
|
|
9739
9945
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
9740
9946
|
(image) => image.sourceType === "module"
|
|
9741
9947
|
);
|
|
@@ -9806,8 +10012,8 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9806
10012
|
const [clientCssHref, clientJsSrc, docsModulePreloads, clientModulePreloads] = await Promise.all([
|
|
9807
10013
|
resolveHashedClientCssHref(clientOutputDir),
|
|
9808
10014
|
resolveHashedClientJsSrc(clientOutputDir),
|
|
9809
|
-
readFarmDocsModulePreloads(
|
|
9810
|
-
readFarmClientModulePreloads(
|
|
10015
|
+
readFarmDocsModulePreloads(path9.join(root, distDir)),
|
|
10016
|
+
readFarmClientModulePreloads(path9.join(root, distDir))
|
|
9811
10017
|
]);
|
|
9812
10018
|
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
9813
10019
|
const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
|
|
@@ -9826,14 +10032,15 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9826
10032
|
output.code = output.code.split(FARM_CLIENT_JS_SRC_PLACEHOLDER).join(clientJsSrc);
|
|
9827
10033
|
}
|
|
9828
10034
|
}
|
|
9829
|
-
await
|
|
10035
|
+
await fs4.mkdir(ssrOutputDir, { recursive: true });
|
|
9830
10036
|
for (const [fileName, output] of Object.entries(ssrBundle)) {
|
|
9831
|
-
const filePath =
|
|
9832
|
-
await
|
|
9833
|
-
await
|
|
10037
|
+
const filePath = path9.join(ssrOutputDir, fileName);
|
|
10038
|
+
await fs4.mkdir(path9.dirname(filePath), { recursive: true });
|
|
10039
|
+
await fs4.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
|
|
9834
10040
|
}
|
|
9835
|
-
const nitroEntryPath =
|
|
10041
|
+
const nitroEntryPath = path9.join(ssrOutputDir, "nitro-entry.mjs");
|
|
9836
10042
|
const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
|
|
10043
|
+
const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
|
|
9837
10044
|
const nitroEntryCode = `
|
|
9838
10045
|
// Farm.js Nitro Entry
|
|
9839
10046
|
// This file adapts Farm's Web fetch handler to Nitro's event handler contract.
|
|
@@ -9854,7 +10061,39 @@ function registerFarmCloseHook() {
|
|
|
9854
10061
|
farmProductionLifecycle.close('production-server-closed')
|
|
9855
10062
|
)
|
|
9856
10063
|
}
|
|
9857
|
-
|
|
10064
|
+
${hasNitroCacheRouteRules ? `
|
|
10065
|
+
// A swr route rule caches through Nitro, which writes its own public Cache-Control on
|
|
10066
|
+
// the event after Farm answered, and a headers route rule sets its headers there too. H3
|
|
10067
|
+
// lets those replace the response's. A response middleware let through keeps Farm's
|
|
10068
|
+
// private policy and no CDN cache header, so no CDN serves it to others.
|
|
10069
|
+
const FARM_PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i
|
|
10070
|
+
const FARM_CDN_CACHE_CONTROL_HEADERS = [
|
|
10071
|
+
'cdn-cache-control',
|
|
10072
|
+
'vercel-cdn-cache-control',
|
|
10073
|
+
'netlify-cdn-cache-control',
|
|
10074
|
+
'cloudflare-cdn-cache-control',
|
|
10075
|
+
]
|
|
10076
|
+
const farmPrivateCacheControlKey = Symbol.for('farm.privateCacheControl')
|
|
10077
|
+
let farmPrivateCacheHookRegistered = false
|
|
10078
|
+
function keepFarmPrivateCacheControl(event, cacheControl) {
|
|
10079
|
+
if (!farmPrivateCacheHookRegistered) {
|
|
10080
|
+
farmPrivateCacheHookRegistered = true
|
|
10081
|
+
useNitroHooks().hook('response', (response, responseEvent) => {
|
|
10082
|
+
const value = responseEvent.context?.[farmPrivateCacheControlKey]
|
|
10083
|
+
if (!value) return
|
|
10084
|
+
try {
|
|
10085
|
+
if (response.headers.get('cache-control') !== value) {
|
|
10086
|
+
response.headers.set('cache-control', value)
|
|
10087
|
+
}
|
|
10088
|
+
for (const name of FARM_CDN_CACHE_CONTROL_HEADERS) response.headers.delete(name)
|
|
10089
|
+
} catch {
|
|
10090
|
+
// Immutable headers belong to a response Nitro passed through untouched.
|
|
10091
|
+
}
|
|
10092
|
+
})
|
|
10093
|
+
}
|
|
10094
|
+
if (event.context) event.context[farmPrivateCacheControlKey] = cacheControl
|
|
10095
|
+
}
|
|
10096
|
+
` : ""}
|
|
9858
10097
|
function mergeVaryHeaders(target, source) {
|
|
9859
10098
|
const values = new Set(
|
|
9860
10099
|
[target.get('Vary'), source]
|
|
@@ -9948,11 +10187,14 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9948
10187
|
const request = !srvxRequest && node?.req && node?.res
|
|
9949
10188
|
? new Request(webRequest, { signal: createFarmNodeRequestAbortSignal(node.req, node.res) })
|
|
9950
10189
|
: webRequest
|
|
9951
|
-
const response = await handler.fetch(request, {
|
|
10190
|
+
${hasNitroCacheRouteRules ? " let farmGuardedResponse = false\n" : ""} const response = await handler.fetch(request, {
|
|
9952
10191
|
waitUntil: (promise) => event.waitUntil(promise),
|
|
9953
10192
|
onResponseFinished: createResponseFinishedHook(event),
|
|
9954
10193
|
trustedLocalOrigin: resolveTrustedLocalOrigin(event, request),
|
|
9955
|
-
clientAddress: resolveFarmClientAddress(event)
|
|
10194
|
+
clientAddress: resolveFarmClientAddress(event),${hasNitroCacheRouteRules ? `
|
|
10195
|
+
onGuardedResponse: () => {
|
|
10196
|
+
farmGuardedResponse = true
|
|
10197
|
+
},` : ""}
|
|
9956
10198
|
})
|
|
9957
10199
|
|
|
9958
10200
|
// Nitro records asset compression negotiation on the event response. Merge
|
|
@@ -9963,7 +10205,15 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9963
10205
|
if (farmVary) {
|
|
9964
10206
|
const nitroHeaders = event.res.headers
|
|
9965
10207
|
if (nitroHeaders.has('Vary')) mergeVaryHeaders(nitroHeaders, farmVary)
|
|
9966
|
-
}
|
|
10208
|
+
}${hasNitroCacheRouteRules ? `
|
|
10209
|
+
const farmCacheControl = response.headers.get('cache-control')
|
|
10210
|
+
if (
|
|
10211
|
+
farmGuardedResponse &&
|
|
10212
|
+
farmCacheControl &&
|
|
10213
|
+
FARM_PRIVATE_CACHE_DIRECTIVE.test(farmCacheControl)
|
|
10214
|
+
) {
|
|
10215
|
+
keepFarmPrivateCacheControl(event, farmCacheControl)
|
|
10216
|
+
}` : ""}
|
|
9967
10217
|
return ${nodeAdapterModule ? "toFarmNodeResponse(request, response)" : "response"}
|
|
9968
10218
|
}${nodeAdapterModule ? `
|
|
9969
10219
|
|
|
@@ -9984,26 +10234,38 @@ function toFarmNodeResponse(request, response) {
|
|
|
9984
10234
|
})
|
|
9985
10235
|
}` : ""}
|
|
9986
10236
|
`.trim();
|
|
9987
|
-
await
|
|
9988
|
-
const farmNodeServerEntryPath = preset === "node-server" ?
|
|
10237
|
+
await fs4.writeFile(nitroEntryPath, nitroEntryCode);
|
|
10238
|
+
const farmNodeServerEntryPath = preset === "node-server" ? path9.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
|
|
9989
10239
|
if (farmNodeServerEntryPath && nodeAdapterModule) {
|
|
9990
|
-
await
|
|
9991
|
-
|
|
10240
|
+
await fs4.writeFile(
|
|
10241
|
+
path9.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
|
|
9992
10242
|
FARM_NODE_ENV_MODULE_SOURCE
|
|
9993
10243
|
);
|
|
9994
|
-
await
|
|
10244
|
+
await fs4.writeFile(
|
|
9995
10245
|
farmNodeServerEntryPath,
|
|
9996
10246
|
createFarmNodeServerEntry({
|
|
9997
|
-
nitroEntryFile:
|
|
10247
|
+
nitroEntryFile: path9.basename(nitroEntryPath),
|
|
9998
10248
|
nodeAdapterModule,
|
|
9999
10249
|
server: config.server,
|
|
10000
10250
|
websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/node")
|
|
10001
10251
|
})
|
|
10002
10252
|
);
|
|
10003
10253
|
}
|
|
10004
|
-
const
|
|
10254
|
+
const farmBunServerEntryPath = preset === "bun" ? path9.join(ssrOutputDir, "farm-bun-server-entry.mjs") : null;
|
|
10255
|
+
if (farmBunServerEntryPath) {
|
|
10256
|
+
await fs4.writeFile(
|
|
10257
|
+
farmBunServerEntryPath,
|
|
10258
|
+
createFarmBunServerEntry({
|
|
10259
|
+
nitroEntryFile: path9.basename(nitroEntryPath),
|
|
10260
|
+
bunAdapterModule: resolveNitroRuntimeDependency(root, "srvx/bun"),
|
|
10261
|
+
server: config.server,
|
|
10262
|
+
websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/bun")
|
|
10263
|
+
})
|
|
10264
|
+
);
|
|
10265
|
+
}
|
|
10266
|
+
const farmNetlifyEntryPath = preset === "netlify" ? path9.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
|
|
10005
10267
|
if (farmNetlifyEntryPath) {
|
|
10006
|
-
await
|
|
10268
|
+
await fs4.writeFile(
|
|
10007
10269
|
farmNetlifyEntryPath,
|
|
10008
10270
|
createFarmNetlifyEntry({
|
|
10009
10271
|
nitroNetlifyEntry: resolveNitroNetlifyEntry(resolveNitroPackageEntry(root))
|
|
@@ -10035,7 +10297,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
10035
10297
|
let nitroConfig = {
|
|
10036
10298
|
preset,
|
|
10037
10299
|
...farmNodeServerEntryPath ? { entry: farmNodeServerEntryPath } : {},
|
|
10300
|
+
...farmBunServerEntryPath ? { entry: farmBunServerEntryPath } : {},
|
|
10038
10301
|
...farmNetlifyEntryPath ? { entry: farmNetlifyEntryPath } : {},
|
|
10302
|
+
// The response hook that keeps a private Cache-Control under a swr or headers rule (nitro-entry).
|
|
10303
|
+
...hasNitroCacheRouteRules ? { features: { runtimeHooks: true } } : {},
|
|
10039
10304
|
rootDir: root,
|
|
10040
10305
|
// Farm registers every handler, task, and plugin explicitly. Scanning the
|
|
10041
10306
|
// project root would bundle an app's own `middleware/`, `api/`, `routes/`,
|
|
@@ -10043,7 +10308,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10043
10308
|
// `src` directory), as Nitro handlers outside Farm's aliases.
|
|
10044
10309
|
serverDir: false,
|
|
10045
10310
|
serverEntry: false,
|
|
10046
|
-
buildDir:
|
|
10311
|
+
buildDir: path9.join(root, distDir, ".nitro"),
|
|
10047
10312
|
alias: resolveNitroInternalRuntimeAliases(root),
|
|
10048
10313
|
compatibilityDate: "2024-12-01",
|
|
10049
10314
|
output: resolveFarmNitroOutputConfig(preset, outputDir),
|
|
@@ -10073,7 +10338,11 @@ function toFarmNodeResponse(request, response) {
|
|
|
10073
10338
|
...farmWorkflows.tasks,
|
|
10074
10339
|
...farmCron.tasks
|
|
10075
10340
|
},
|
|
10076
|
-
|
|
10341
|
+
// Vercel crons call Farm's own secret-checked workflow and cron routes
|
|
10342
|
+
// (postProcessVercelOutput). Nitro's Vercel preset would also turn
|
|
10343
|
+
// scheduledTasks into a `/_vercel/cron` route that runs tasks without a
|
|
10344
|
+
// secret check unless CRON_SECRET is set, and double-schedules them when it is.
|
|
10345
|
+
scheduledTasks: isVercel ? {} : scheduledTasks,
|
|
10077
10346
|
...isCloudflareWorker && cloudflareCronConfig ? {
|
|
10078
10347
|
cloudflare: cloudflareCronConfig
|
|
10079
10348
|
} : {},
|
|
@@ -10119,7 +10388,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10119
10388
|
if (pluginManager) {
|
|
10120
10389
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
10121
10390
|
}
|
|
10122
|
-
const expectedServerDir =
|
|
10391
|
+
const expectedServerDir = path9.join(outputDir, "server");
|
|
10123
10392
|
const customRollupKeys = Object.keys(nitroConfig.rollupConfig || {}).filter(
|
|
10124
10393
|
(key) => key !== "external" && key !== "plugins"
|
|
10125
10394
|
);
|
|
@@ -10132,9 +10401,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
10132
10401
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
10133
10402
|
);
|
|
10134
10403
|
const requestedBuilder = nitroConfig.builder ?? process.env.NITRO_BUILDER;
|
|
10135
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && nitroConfig.rollupConfig?.external === nitroRollupExternal && !hasRollupPlugins(nitroConfig.rollupConfig?.plugins) && customRollupKeys.length === 0 &&
|
|
10404
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && nitroConfig.rollupConfig?.external === nitroRollupExternal && !hasRollupPlugins(nitroConfig.rollupConfig?.plugins) && customRollupKeys.length === 0 && path9.resolve(nitroConfig.output?.serverDir || "") === path9.resolve(expectedServerDir) && Boolean(
|
|
10136
10405
|
nitroConfig.handlers?.some(
|
|
10137
|
-
(handler) =>
|
|
10406
|
+
(handler) => path9.resolve(handler?.handler || "") === nitroEntryPath
|
|
10138
10407
|
)
|
|
10139
10408
|
);
|
|
10140
10409
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
@@ -10195,7 +10464,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10195
10464
|
nitroInstance.routing.sync();
|
|
10196
10465
|
});
|
|
10197
10466
|
}
|
|
10198
|
-
if (farmNodeServerEntryPath || farmNetlifyEntryPath) {
|
|
10467
|
+
if (farmNodeServerEntryPath || farmBunServerEntryPath || farmNetlifyEntryPath) {
|
|
10199
10468
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
10200
10469
|
delete prerendererConfig.entry;
|
|
10201
10470
|
});
|
|
@@ -10221,14 +10490,14 @@ function toFarmNodeResponse(request, response) {
|
|
|
10221
10490
|
});
|
|
10222
10491
|
}
|
|
10223
10492
|
prerenderer.hooks.hook("compiled", async () => {
|
|
10224
|
-
const prerenderServerDir =
|
|
10493
|
+
const prerenderServerDir = path9.join(outputDir, "server");
|
|
10225
10494
|
await copyPrebuiltSSRBundle(
|
|
10226
10495
|
ssrBundle,
|
|
10227
|
-
|
|
10496
|
+
path9.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
|
|
10228
10497
|
null,
|
|
10229
|
-
|
|
10498
|
+
fs4
|
|
10230
10499
|
);
|
|
10231
|
-
await registerPrebuiltSSRPackageImport(prerenderServerDir, ssrEntryFile,
|
|
10500
|
+
await registerPrebuiltSSRPackageImport(prerenderServerDir, ssrEntryFile, fs4);
|
|
10232
10501
|
});
|
|
10233
10502
|
});
|
|
10234
10503
|
}
|
|
@@ -10259,7 +10528,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10259
10528
|
else process.env[FARM_PRERENDER_ENV] = previousPrerender;
|
|
10260
10529
|
}
|
|
10261
10530
|
}
|
|
10262
|
-
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir,
|
|
10531
|
+
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
10263
10532
|
const prebuiltSSRFilesPromise = canReusePrebuiltSSR ? prepareSSRBundleFiles(
|
|
10264
10533
|
ssrBundle,
|
|
10265
10534
|
shouldMinify ? { keepNames: keepServerNames, target: "node18" } : null
|
|
@@ -10272,7 +10541,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10272
10541
|
await nitroInstance.close();
|
|
10273
10542
|
if (nitroBuildResult.status === "rejected") {
|
|
10274
10543
|
if (sharpRuntimeStageResult.status === "fulfilled" && sharpRuntimeStageResult.value) {
|
|
10275
|
-
await
|
|
10544
|
+
await fs4.rm(sharpRuntimeStageResult.value.stageDir, {
|
|
10276
10545
|
recursive: true,
|
|
10277
10546
|
force: true
|
|
10278
10547
|
});
|
|
@@ -10285,20 +10554,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
10285
10554
|
if (prebuiltSSRFilesResult.status === "rejected") {
|
|
10286
10555
|
throw prebuiltSSRFilesResult.reason;
|
|
10287
10556
|
}
|
|
10288
|
-
const stagedSharpRuntime = sharpRuntimeStageResult.value ?? (imageRuntime === "node" ? await stageSharpRuntime(config, root, distDir,
|
|
10557
|
+
const stagedSharpRuntime = sharpRuntimeStageResult.value ?? (imageRuntime === "node" ? await stageSharpRuntime(config, root, distDir, fs4, preset) : null);
|
|
10289
10558
|
const runtimeCopyPromise = (async () => {
|
|
10290
10559
|
if (stagedSharpRuntime) {
|
|
10291
|
-
await installStagedSharpRuntime(stagedSharpRuntime, runtimeServerOutputDir,
|
|
10560
|
+
await installStagedSharpRuntime(stagedSharpRuntime, runtimeServerOutputDir, fs4);
|
|
10292
10561
|
}
|
|
10293
10562
|
if (useExternalMetadataImageRuntime) {
|
|
10294
|
-
await copyMetadataImageRuntime(root, runtimeServerOutputDir,
|
|
10563
|
+
await copyMetadataImageRuntime(root, runtimeServerOutputDir, fs4);
|
|
10295
10564
|
}
|
|
10296
10565
|
})();
|
|
10297
10566
|
const copyResults = await Promise.allSettled([
|
|
10298
10567
|
prebuiltSSRFilesResult.value ? writeSSRBundleFiles(
|
|
10299
10568
|
prebuiltSSRFilesResult.value,
|
|
10300
|
-
|
|
10301
|
-
|
|
10569
|
+
path9.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
|
|
10570
|
+
fs4
|
|
10302
10571
|
) : Promise.resolve(),
|
|
10303
10572
|
runtimeCopyPromise
|
|
10304
10573
|
]);
|
|
@@ -10307,7 +10576,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10307
10576
|
);
|
|
10308
10577
|
if (failedCopy) throw failedCopy.reason;
|
|
10309
10578
|
if (canReusePrebuiltSSR) {
|
|
10310
|
-
await registerPrebuiltSSRPackageImport(
|
|
10579
|
+
await registerPrebuiltSSRPackageImport(path9.join(outputDir, "server"), ssrEntryFile, fs4);
|
|
10311
10580
|
logger.info("\u26A1 Reused Farm's prebuilt SSR bundle for the Node output");
|
|
10312
10581
|
}
|
|
10313
10582
|
if (useRolldownBuilder) {
|
|
@@ -10322,7 +10591,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10322
10591
|
});
|
|
10323
10592
|
}
|
|
10324
10593
|
if (isVercel) {
|
|
10325
|
-
await postProcessVercelOutput(root, outputDir,
|
|
10594
|
+
await postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest);
|
|
10326
10595
|
}
|
|
10327
10596
|
logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
|
|
10328
10597
|
}
|
|
@@ -10332,11 +10601,11 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
|
|
|
10332
10601
|
return {
|
|
10333
10602
|
dir: outputDir,
|
|
10334
10603
|
...preset === "node-server" ? {
|
|
10335
|
-
serverDir:
|
|
10336
|
-
publicDir:
|
|
10604
|
+
serverDir: path9.join(outputDir, "server"),
|
|
10605
|
+
publicDir: path9.join(outputDir, "public")
|
|
10337
10606
|
} : isVercel ? {
|
|
10338
|
-
serverDir:
|
|
10339
|
-
publicDir:
|
|
10607
|
+
serverDir: path9.join(outputDir, "functions", "__nitro.func"),
|
|
10608
|
+
publicDir: path9.join(outputDir, "static")
|
|
10340
10609
|
} : {}
|
|
10341
10610
|
};
|
|
10342
10611
|
}
|
|
@@ -10350,24 +10619,24 @@ function prepareSSRBundleFiles(ssrBundle, minifyOptions) {
|
|
|
10350
10619
|
);
|
|
10351
10620
|
}
|
|
10352
10621
|
__name(prepareSSRBundleFiles, "prepareSSRBundleFiles");
|
|
10353
|
-
async function writeSSRBundleFiles(files, targetDir,
|
|
10354
|
-
await
|
|
10622
|
+
async function writeSSRBundleFiles(files, targetDir, fs4) {
|
|
10623
|
+
await fs4.rm(targetDir, { recursive: true, force: true });
|
|
10355
10624
|
await Promise.all(
|
|
10356
10625
|
files.map(async ({ fileName, contents }) => {
|
|
10357
|
-
const targetPath =
|
|
10358
|
-
await
|
|
10359
|
-
await
|
|
10626
|
+
const targetPath = path9.join(targetDir, fileName);
|
|
10627
|
+
await fs4.mkdir(path9.dirname(targetPath), { recursive: true });
|
|
10628
|
+
await fs4.writeFile(targetPath, contents);
|
|
10360
10629
|
})
|
|
10361
10630
|
);
|
|
10362
10631
|
}
|
|
10363
10632
|
__name(writeSSRBundleFiles, "writeSSRBundleFiles");
|
|
10364
|
-
async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions,
|
|
10365
|
-
await writeSSRBundleFiles(await prepareSSRBundleFiles(ssrBundle, minifyOptions), targetDir,
|
|
10633
|
+
async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs4) {
|
|
10634
|
+
await writeSSRBundleFiles(await prepareSSRBundleFiles(ssrBundle, minifyOptions), targetDir, fs4);
|
|
10366
10635
|
}
|
|
10367
10636
|
__name(copyPrebuiltSSRBundle, "copyPrebuiltSSRBundle");
|
|
10368
|
-
async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile,
|
|
10369
|
-
const packagePath =
|
|
10370
|
-
const packageJSON = await
|
|
10637
|
+
async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs4) {
|
|
10638
|
+
const packagePath = path9.join(serverDir, "package.json");
|
|
10639
|
+
const packageJSON = await fs4.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
|
|
10371
10640
|
if (error.code === "ENOENT") return { type: "module" };
|
|
10372
10641
|
throw error;
|
|
10373
10642
|
});
|
|
@@ -10377,14 +10646,14 @@ async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs3) {
|
|
|
10377
10646
|
...existingImports,
|
|
10378
10647
|
[FARM_SSR_PACKAGE_IMPORT]: `./${outputEntry}`
|
|
10379
10648
|
};
|
|
10380
|
-
await
|
|
10381
|
-
await
|
|
10649
|
+
await fs4.mkdir(serverDir, { recursive: true });
|
|
10650
|
+
await fs4.writeFile(packagePath, `${JSON.stringify(packageJSON, null, 2)}
|
|
10382
10651
|
`);
|
|
10383
10652
|
}
|
|
10384
10653
|
__name(registerPrebuiltSSRPackageImport, "registerPrebuiltSSRPackageImport");
|
|
10385
|
-
async function moveVercelOutputPath(src, dest,
|
|
10654
|
+
async function moveVercelOutputPath(src, dest, fs4) {
|
|
10386
10655
|
try {
|
|
10387
|
-
await
|
|
10656
|
+
await fs4.rename(src, dest);
|
|
10388
10657
|
return;
|
|
10389
10658
|
} catch (error) {
|
|
10390
10659
|
const code = error?.code;
|
|
@@ -10392,39 +10661,39 @@ async function moveVercelOutputPath(src, dest, fs3) {
|
|
|
10392
10661
|
throw error;
|
|
10393
10662
|
}
|
|
10394
10663
|
}
|
|
10395
|
-
await
|
|
10396
|
-
await
|
|
10664
|
+
await fs4.cp(src, dest, { recursive: true, force: true });
|
|
10665
|
+
await fs4.rm(src, { recursive: true, force: true });
|
|
10397
10666
|
}
|
|
10398
10667
|
__name(moveVercelOutputPath, "moveVercelOutputPath");
|
|
10399
|
-
async function postProcessVercelOutput(root, outputDir,
|
|
10400
|
-
const serverDir =
|
|
10401
|
-
const functionsDir =
|
|
10402
|
-
const nitroFuncDir =
|
|
10403
|
-
const staticDir =
|
|
10404
|
-
const publicDir =
|
|
10405
|
-
await
|
|
10406
|
-
const serverContents = await
|
|
10668
|
+
async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest) {
|
|
10669
|
+
const serverDir = path9.join(outputDir, "server");
|
|
10670
|
+
const functionsDir = path9.join(outputDir, "functions");
|
|
10671
|
+
const nitroFuncDir = path9.join(functionsDir, "__nitro.func");
|
|
10672
|
+
const staticDir = path9.join(outputDir, "static");
|
|
10673
|
+
const publicDir = path9.join(outputDir, "public");
|
|
10674
|
+
await fs4.mkdir(nitroFuncDir, { recursive: true });
|
|
10675
|
+
const serverContents = await fs4.readdir(serverDir).catch((error) => {
|
|
10407
10676
|
if (error.code === "ENOENT") return [];
|
|
10408
10677
|
throw error;
|
|
10409
10678
|
});
|
|
10410
10679
|
for (const file of serverContents) {
|
|
10411
|
-
await moveVercelOutputPath(
|
|
10680
|
+
await moveVercelOutputPath(path9.join(serverDir, file), path9.join(nitroFuncDir, file), fs4);
|
|
10412
10681
|
}
|
|
10413
|
-
if (serverContents.length > 0) await
|
|
10682
|
+
if (serverContents.length > 0) await fs4.rm(serverDir, { recursive: true, force: true });
|
|
10414
10683
|
try {
|
|
10415
|
-
await moveVercelOutputPath(publicDir, staticDir,
|
|
10684
|
+
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
10416
10685
|
} catch (error) {
|
|
10417
10686
|
if (error?.code !== "ENOENT") throw error;
|
|
10418
10687
|
}
|
|
10419
|
-
await copyFarmDocsContentForVercel(config, root, nitroFuncDir,
|
|
10420
|
-
await copyPrismaClientForVercel(root, nitroFuncDir,
|
|
10421
|
-
const configPath =
|
|
10422
|
-
const configContent = await
|
|
10688
|
+
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
10689
|
+
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
10690
|
+
const configPath = path9.join(outputDir, "config.json");
|
|
10691
|
+
const configContent = await fs4.readFile(configPath, "utf-8");
|
|
10423
10692
|
const vercelConfig = JSON.parse(configContent);
|
|
10424
10693
|
const runtimeRoutes = await createFarmVercelRouteRuntimeFunctions(
|
|
10425
10694
|
outputDir,
|
|
10426
10695
|
routeRuntimeManifest,
|
|
10427
|
-
|
|
10696
|
+
fs4,
|
|
10428
10697
|
config.basePath
|
|
10429
10698
|
);
|
|
10430
10699
|
vercelConfig.routes = buildFarmVercelRoutes({
|
|
@@ -10439,29 +10708,29 @@ async function postProcessVercelOutput(root, outputDir, fs3, config, farmWorkflo
|
|
|
10439
10708
|
vercelConfigWithWorkflowCrons,
|
|
10440
10709
|
config.cron.jobs
|
|
10441
10710
|
);
|
|
10442
|
-
await
|
|
10711
|
+
await fs4.writeFile(configPath, JSON.stringify(vercelConfigWithCrons, null, 2));
|
|
10443
10712
|
logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
10444
10713
|
}
|
|
10445
10714
|
__name(postProcessVercelOutput, "postProcessVercelOutput");
|
|
10446
|
-
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir,
|
|
10715
|
+
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
10447
10716
|
const docsContentDir = resolveBuildDocsContentDir(config, root);
|
|
10448
10717
|
if (!docsContentDir) return;
|
|
10449
|
-
const bundledContentDir =
|
|
10718
|
+
const bundledContentDir = path9.join(nitroFuncDir, "farm-docs-content");
|
|
10450
10719
|
const lastModifiedManifest = createFarmDocsLastModifiedManifest(docsContentDir, {
|
|
10451
10720
|
fallback: "now"
|
|
10452
10721
|
});
|
|
10453
|
-
await
|
|
10454
|
-
await
|
|
10455
|
-
await
|
|
10722
|
+
await fs4.rm(bundledContentDir, { recursive: true, force: true });
|
|
10723
|
+
await fs4.mkdir(path9.dirname(bundledContentDir), { recursive: true });
|
|
10724
|
+
await fs4.cp(docsContentDir, bundledContentDir, {
|
|
10456
10725
|
recursive: true,
|
|
10457
10726
|
force: true
|
|
10458
10727
|
});
|
|
10459
|
-
await
|
|
10460
|
-
|
|
10728
|
+
await fs4.writeFile(
|
|
10729
|
+
path9.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
10461
10730
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
10462
10731
|
`
|
|
10463
10732
|
);
|
|
10464
|
-
logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${
|
|
10733
|
+
logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${path9.relative(root, docsContentDir)}`);
|
|
10465
10734
|
}
|
|
10466
10735
|
__name(copyFarmDocsContentForVercel, "copyFarmDocsContentForVercel");
|
|
10467
10736
|
function resolveServerFunctionPlatform(preset) {
|
|
@@ -10480,9 +10749,9 @@ function platformFieldAllows(field, value) {
|
|
|
10480
10749
|
return allowed.length === 0 || allowed.includes(value);
|
|
10481
10750
|
}
|
|
10482
10751
|
__name(platformFieldAllows, "platformFieldAllows");
|
|
10483
|
-
async function stageSharpRuntime(config, root, distDir,
|
|
10752
|
+
async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
10484
10753
|
const functionPlatform = resolveServerFunctionPlatform(preset);
|
|
10485
|
-
const projectRequire = createRequire(
|
|
10754
|
+
const projectRequire = createRequire(path9.join(root, "package.json"));
|
|
10486
10755
|
let sharpRequire = projectRequire;
|
|
10487
10756
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
10488
10757
|
try {
|
|
@@ -10492,10 +10761,10 @@ async function stageSharpRuntime(config, root, distDir, fs3, preset) {
|
|
|
10492
10761
|
}
|
|
10493
10762
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
10494
10763
|
const packageCopies = /* @__PURE__ */ new Map();
|
|
10495
|
-
const stageRoot =
|
|
10496
|
-
await
|
|
10497
|
-
const stageDir = await
|
|
10498
|
-
const targetNodeModules =
|
|
10764
|
+
const stageRoot = path9.join(root, distDir, "tmp");
|
|
10765
|
+
await fs4.mkdir(stageRoot, { recursive: true });
|
|
10766
|
+
const stageDir = await fs4.mkdtemp(path9.join(stageRoot, "sharp-runtime-"));
|
|
10767
|
+
const targetNodeModules = path9.join(stageDir, "node_modules");
|
|
10499
10768
|
function copyPackage(packageName, parentRequire) {
|
|
10500
10769
|
const activeCopy = packageCopies.get(packageName);
|
|
10501
10770
|
if (activeCopy) return activeCopy;
|
|
@@ -10507,19 +10776,19 @@ async function stageSharpRuntime(config, root, distDir, fs3, preset) {
|
|
|
10507
10776
|
async function copyPackageOnce(packageName, parentRequire) {
|
|
10508
10777
|
const packageJsonPath = resolvePackageJson(parentRequire, packageName);
|
|
10509
10778
|
if (!packageJsonPath) return;
|
|
10510
|
-
const packageJson = JSON.parse(await
|
|
10779
|
+
const packageJson = JSON.parse(await fs4.readFile(packageJsonPath, "utf8"));
|
|
10511
10780
|
if (functionPlatform && !packageSupportsPlatform(packageJson, functionPlatform)) return;
|
|
10512
|
-
const packageDir =
|
|
10513
|
-
const targetDir =
|
|
10781
|
+
const packageDir = path9.dirname(packageJsonPath);
|
|
10782
|
+
const targetDir = path9.join(targetNodeModules, ...packageName.split("/"));
|
|
10514
10783
|
copiedPackages.set(packageName, String(packageJson.version || "*"));
|
|
10515
|
-
await
|
|
10784
|
+
await fs4.mkdir(path9.dirname(targetDir), { recursive: true });
|
|
10516
10785
|
const packageRequire = createRequire(packageJsonPath);
|
|
10517
10786
|
const dependencies = {
|
|
10518
10787
|
...packageJson.dependencies,
|
|
10519
10788
|
...packageJson.optionalDependencies
|
|
10520
10789
|
};
|
|
10521
10790
|
await settleAllOrThrow([
|
|
10522
|
-
|
|
10791
|
+
fs4.cp(packageDir, targetDir, {
|
|
10523
10792
|
recursive: true,
|
|
10524
10793
|
force: true,
|
|
10525
10794
|
dereference: true,
|
|
@@ -10537,7 +10806,7 @@ async function stageSharpRuntime(config, root, distDir, fs3, preset) {
|
|
|
10537
10806
|
throw new Error(`Farm image optimization requires sharp. ${SHARP_INSTALL_HINT}`);
|
|
10538
10807
|
}
|
|
10539
10808
|
} catch (error) {
|
|
10540
|
-
await
|
|
10809
|
+
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
10541
10810
|
throw error;
|
|
10542
10811
|
}
|
|
10543
10812
|
return {
|
|
@@ -10548,19 +10817,19 @@ async function stageSharpRuntime(config, root, distDir, fs3, preset) {
|
|
|
10548
10817
|
};
|
|
10549
10818
|
}
|
|
10550
10819
|
__name(stageSharpRuntime, "stageSharpRuntime");
|
|
10551
|
-
async function installStagedSharpRuntime(staged, nitroFuncDir,
|
|
10552
|
-
const stagedNodeModules =
|
|
10553
|
-
const targetNodeModules =
|
|
10820
|
+
async function installStagedSharpRuntime(staged, nitroFuncDir, fs4) {
|
|
10821
|
+
const stagedNodeModules = path9.join(staged.stageDir, "node_modules");
|
|
10822
|
+
const targetNodeModules = path9.join(nitroFuncDir, "node_modules");
|
|
10554
10823
|
try {
|
|
10555
|
-
await mergeStagedDirectory(stagedNodeModules, targetNodeModules,
|
|
10556
|
-
const functionPackage = await readNitroOutputPackage(nitroFuncDir,
|
|
10824
|
+
await mergeStagedDirectory(stagedNodeModules, targetNodeModules, fs4);
|
|
10825
|
+
const functionPackage = await readNitroOutputPackage(nitroFuncDir, fs4);
|
|
10557
10826
|
functionPackage.dependencies = {
|
|
10558
10827
|
...functionPackage.dependencies,
|
|
10559
10828
|
...staged.dependencies
|
|
10560
10829
|
};
|
|
10561
|
-
await writeNitroOutputPackage(nitroFuncDir, functionPackage,
|
|
10830
|
+
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs4);
|
|
10562
10831
|
} finally {
|
|
10563
|
-
await
|
|
10832
|
+
await fs4.rm(staged.stageDir, { recursive: true, force: true });
|
|
10564
10833
|
}
|
|
10565
10834
|
logger.info(
|
|
10566
10835
|
`\u{1F5BC}\uFE0F Bundled Sharp image runtime (${Object.keys(staged.dependencies).length} packages)`
|
|
@@ -10575,15 +10844,15 @@ async function settleAllOrThrow(operations) {
|
|
|
10575
10844
|
if (failure) throw failure.reason;
|
|
10576
10845
|
}
|
|
10577
10846
|
__name(settleAllOrThrow, "settleAllOrThrow");
|
|
10578
|
-
async function mergeStagedDirectory(sourceDir, targetDir,
|
|
10579
|
-
await
|
|
10580
|
-
const entries = await
|
|
10847
|
+
async function mergeStagedDirectory(sourceDir, targetDir, fs4) {
|
|
10848
|
+
await fs4.mkdir(targetDir, { recursive: true });
|
|
10849
|
+
const entries = await fs4.readdir(sourceDir, { withFileTypes: true });
|
|
10581
10850
|
await settleAllOrThrow(
|
|
10582
10851
|
entries.map(async (entry) => {
|
|
10583
|
-
const sourcePath =
|
|
10584
|
-
const targetPath =
|
|
10852
|
+
const sourcePath = path9.join(sourceDir, entry.name);
|
|
10853
|
+
const targetPath = path9.join(targetDir, entry.name);
|
|
10585
10854
|
try {
|
|
10586
|
-
await
|
|
10855
|
+
await fs4.rename(sourcePath, targetPath);
|
|
10587
10856
|
return;
|
|
10588
10857
|
} catch (error) {
|
|
10589
10858
|
const code = error.code;
|
|
@@ -10592,16 +10861,16 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs3) {
|
|
|
10592
10861
|
}
|
|
10593
10862
|
}
|
|
10594
10863
|
if (entry.isDirectory()) {
|
|
10595
|
-
await mergeStagedDirectory(sourcePath, targetPath,
|
|
10596
|
-
await
|
|
10864
|
+
await mergeStagedDirectory(sourcePath, targetPath, fs4);
|
|
10865
|
+
await fs4.rm(sourcePath, { recursive: true, force: true });
|
|
10597
10866
|
return;
|
|
10598
10867
|
}
|
|
10599
|
-
await
|
|
10868
|
+
await fs4.cp(sourcePath, targetPath, {
|
|
10600
10869
|
force: true,
|
|
10601
10870
|
dereference: true,
|
|
10602
10871
|
mode: fsConstants.COPYFILE_FICLONE
|
|
10603
10872
|
});
|
|
10604
|
-
await
|
|
10873
|
+
await fs4.rm(sourcePath, { force: true });
|
|
10605
10874
|
})
|
|
10606
10875
|
);
|
|
10607
10876
|
}
|
|
@@ -10609,14 +10878,14 @@ __name(mergeStagedDirectory, "mergeStagedDirectory");
|
|
|
10609
10878
|
function assertMetadataImageRuntimeInstalled(root, metadataImageRoutes) {
|
|
10610
10879
|
const generated = metadataImageRoutes.find((image) => image.sourceType === "module");
|
|
10611
10880
|
if (!generated || resolveMetadataImageRuntimePackageJson(root)) return;
|
|
10612
|
-
const file = generated.modulePath ? toPosixPath(
|
|
10881
|
+
const file = generated.modulePath ? toPosixPath(path9.relative(root, generated.modulePath)) : "";
|
|
10613
10882
|
throw new Error(
|
|
10614
10883
|
`${file || "A generated metadata image"} renders with @vercel/og, which is not installed. ${VERCEL_OG_INSTALL_HINT}`
|
|
10615
10884
|
);
|
|
10616
10885
|
}
|
|
10617
10886
|
__name(assertMetadataImageRuntimeInstalled, "assertMetadataImageRuntimeInstalled");
|
|
10618
10887
|
function resolveMetadataImageRuntimePackageJson(root) {
|
|
10619
|
-
const projectRequire = createRequire(
|
|
10888
|
+
const projectRequire = createRequire(path9.join(root, "package.json"));
|
|
10620
10889
|
const packageJsonPath = resolvePackageJson(projectRequire, "@vercel/og");
|
|
10621
10890
|
if (packageJsonPath) return packageJsonPath;
|
|
10622
10891
|
try {
|
|
@@ -10626,40 +10895,40 @@ function resolveMetadataImageRuntimePackageJson(root) {
|
|
|
10626
10895
|
}
|
|
10627
10896
|
}
|
|
10628
10897
|
__name(resolveMetadataImageRuntimePackageJson, "resolveMetadataImageRuntimePackageJson");
|
|
10629
|
-
async function copyMetadataImageRuntime(root, nitroFuncDir,
|
|
10898
|
+
async function copyMetadataImageRuntime(root, nitroFuncDir, fs4) {
|
|
10630
10899
|
const packageJsonPath = resolveMetadataImageRuntimePackageJson(root);
|
|
10631
10900
|
if (!packageJsonPath) return;
|
|
10632
|
-
const packageJson = JSON.parse(await
|
|
10633
|
-
const packageDir =
|
|
10634
|
-
const targetDir =
|
|
10635
|
-
await
|
|
10636
|
-
await
|
|
10901
|
+
const packageJson = JSON.parse(await fs4.readFile(packageJsonPath, "utf8"));
|
|
10902
|
+
const packageDir = path9.dirname(packageJsonPath);
|
|
10903
|
+
const targetDir = path9.join(nitroFuncDir, "node_modules", "@vercel", "og");
|
|
10904
|
+
await fs4.mkdir(path9.dirname(targetDir), { recursive: true });
|
|
10905
|
+
await fs4.cp(packageDir, targetDir, {
|
|
10637
10906
|
recursive: true,
|
|
10638
10907
|
force: true,
|
|
10639
10908
|
dereference: true,
|
|
10640
10909
|
mode: fsConstants.COPYFILE_FICLONE
|
|
10641
10910
|
});
|
|
10642
|
-
const functionPackage = await readNitroOutputPackage(nitroFuncDir,
|
|
10911
|
+
const functionPackage = await readNitroOutputPackage(nitroFuncDir, fs4);
|
|
10643
10912
|
functionPackage.dependencies = {
|
|
10644
10913
|
...functionPackage.dependencies,
|
|
10645
10914
|
"@vercel/og": String(packageJson.version || "0.11.1")
|
|
10646
10915
|
};
|
|
10647
|
-
await writeNitroOutputPackage(nitroFuncDir, functionPackage,
|
|
10916
|
+
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs4);
|
|
10648
10917
|
logger.info("\u{1F5BC}\uFE0F Bundled generated metadata image runtime");
|
|
10649
10918
|
}
|
|
10650
10919
|
__name(copyMetadataImageRuntime, "copyMetadataImageRuntime");
|
|
10651
|
-
async function readNitroOutputPackage(outputDir,
|
|
10652
|
-
const packagePath =
|
|
10653
|
-
return
|
|
10920
|
+
async function readNitroOutputPackage(outputDir, fs4) {
|
|
10921
|
+
const packagePath = path9.join(outputDir, "package.json");
|
|
10922
|
+
return fs4.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
|
|
10654
10923
|
if (error.code === "ENOENT") return {};
|
|
10655
10924
|
throw error;
|
|
10656
10925
|
});
|
|
10657
10926
|
}
|
|
10658
10927
|
__name(readNitroOutputPackage, "readNitroOutputPackage");
|
|
10659
|
-
async function writeNitroOutputPackage(outputDir, packageJson,
|
|
10660
|
-
await
|
|
10661
|
-
await
|
|
10662
|
-
|
|
10928
|
+
async function writeNitroOutputPackage(outputDir, packageJson, fs4) {
|
|
10929
|
+
await fs4.mkdir(outputDir, { recursive: true });
|
|
10930
|
+
await fs4.writeFile(
|
|
10931
|
+
path9.join(outputDir, "package.json"),
|
|
10663
10932
|
`${JSON.stringify(packageJson, null, 2)}
|
|
10664
10933
|
`
|
|
10665
10934
|
);
|
|
@@ -10676,9 +10945,9 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
10676
10945
|
}
|
|
10677
10946
|
}
|
|
10678
10947
|
try {
|
|
10679
|
-
let directory =
|
|
10680
|
-
while (directory !==
|
|
10681
|
-
const candidate =
|
|
10948
|
+
let directory = path9.dirname(metadataModule ?? parentRequire.resolve(packageName));
|
|
10949
|
+
while (directory !== path9.dirname(directory)) {
|
|
10950
|
+
const candidate = path9.join(directory, "package.json");
|
|
10682
10951
|
if (existsSync2(candidate)) {
|
|
10683
10952
|
try {
|
|
10684
10953
|
const manifest = JSON.parse(readFileSync(candidate, "utf8"));
|
|
@@ -10686,52 +10955,52 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
10686
10955
|
} catch {
|
|
10687
10956
|
}
|
|
10688
10957
|
}
|
|
10689
|
-
if (
|
|
10690
|
-
directory =
|
|
10958
|
+
if (path9.basename(directory) === "node_modules") break;
|
|
10959
|
+
directory = path9.dirname(directory);
|
|
10691
10960
|
}
|
|
10692
10961
|
} catch {
|
|
10693
10962
|
}
|
|
10694
10963
|
return null;
|
|
10695
10964
|
}
|
|
10696
10965
|
__name(resolvePackageJson, "resolvePackageJson");
|
|
10697
|
-
async function copyPrismaClientForVercel(root, nitroFuncDir,
|
|
10698
|
-
const projectRequire = createRequire(
|
|
10966
|
+
async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
|
|
10967
|
+
const projectRequire = createRequire(path9.join(root, "package.json"));
|
|
10699
10968
|
let prismaClientDir;
|
|
10700
10969
|
try {
|
|
10701
|
-
prismaClientDir =
|
|
10970
|
+
prismaClientDir = path9.dirname(projectRequire.resolve("@prisma/client/default.js"));
|
|
10702
10971
|
} catch {
|
|
10703
10972
|
return;
|
|
10704
10973
|
}
|
|
10705
|
-
const generatedClientDir =
|
|
10974
|
+
const generatedClientDir = path9.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
10706
10975
|
try {
|
|
10707
|
-
await
|
|
10976
|
+
await fs4.access(generatedClientDir);
|
|
10708
10977
|
} catch {
|
|
10709
10978
|
return;
|
|
10710
10979
|
}
|
|
10711
|
-
const targetNodeModules =
|
|
10712
|
-
const targetPrismaScopeDir =
|
|
10713
|
-
const targetGeneratedDir =
|
|
10714
|
-
const targetClientDir =
|
|
10715
|
-
await
|
|
10716
|
-
await
|
|
10980
|
+
const targetNodeModules = path9.join(nitroFuncDir, "node_modules");
|
|
10981
|
+
const targetPrismaScopeDir = path9.join(targetNodeModules, "@prisma");
|
|
10982
|
+
const targetGeneratedDir = path9.join(targetNodeModules, ".prisma", "client");
|
|
10983
|
+
const targetClientDir = path9.join(targetPrismaScopeDir, "client");
|
|
10984
|
+
await fs4.mkdir(targetPrismaScopeDir, { recursive: true });
|
|
10985
|
+
await fs4.cp(prismaClientDir, targetClientDir, {
|
|
10717
10986
|
recursive: true,
|
|
10718
10987
|
force: true
|
|
10719
10988
|
});
|
|
10720
|
-
await
|
|
10989
|
+
await fs4.cp(generatedClientDir, targetGeneratedDir, {
|
|
10721
10990
|
recursive: true,
|
|
10722
10991
|
force: true
|
|
10723
10992
|
});
|
|
10724
|
-
const clientPackagePath =
|
|
10993
|
+
const clientPackagePath = path9.join(prismaClientDir, "package.json");
|
|
10725
10994
|
const [functionPackage, clientPackageContent] = await Promise.all([
|
|
10726
|
-
readNitroOutputPackage(nitroFuncDir,
|
|
10727
|
-
|
|
10995
|
+
readNitroOutputPackage(nitroFuncDir, fs4),
|
|
10996
|
+
fs4.readFile(clientPackagePath, "utf-8")
|
|
10728
10997
|
]);
|
|
10729
10998
|
const clientPackage = JSON.parse(clientPackageContent);
|
|
10730
10999
|
functionPackage.dependencies = {
|
|
10731
11000
|
...functionPackage.dependencies,
|
|
10732
11001
|
"@prisma/client": clientPackage.version
|
|
10733
11002
|
};
|
|
10734
|
-
await writeNitroOutputPackage(nitroFuncDir, functionPackage,
|
|
11003
|
+
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs4);
|
|
10735
11004
|
}
|
|
10736
11005
|
__name(copyPrismaClientForVercel, "copyPrismaClientForVercel");
|
|
10737
11006
|
|
|
@@ -10904,9 +11173,9 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10904
11173
|
} else {
|
|
10905
11174
|
const { build: legacyViteBuild } = await import("vite");
|
|
10906
11175
|
logger.info("\u{1F4E6} Building client bundle...");
|
|
10907
|
-
await buildClient2(legacyViteBuild, config, root, srcDir,
|
|
11176
|
+
await buildClient2(legacyViteBuild, config, root, srcDir, path10.join(root, distDir, "client"));
|
|
10908
11177
|
logger.info("\u{1F4E6} Building SSR bundle...");
|
|
10909
|
-
await buildSSR(legacyViteBuild, config, root, srcDir,
|
|
11178
|
+
await buildSSR(legacyViteBuild, config, root, srcDir, path10.join(root, distDir, "server"));
|
|
10910
11179
|
logger.info(`\u{1F680} Building server with Nitro (preset: ${preset})...`);
|
|
10911
11180
|
await buildNitro(
|
|
10912
11181
|
config,
|
|
@@ -11033,7 +11302,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
11033
11302
|
__name(createProjectModuleServer, "createProjectModuleServer");
|
|
11034
11303
|
async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
11035
11304
|
const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
11036
|
-
const { PluginManager: PluginManager2 } = await import("./plugin.mjs");
|
|
11305
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-SYMK7PQ2.mjs");
|
|
11037
11306
|
const pluginManager = new PluginManager2({
|
|
11038
11307
|
config,
|
|
11039
11308
|
isDev: false,
|
|
@@ -11053,7 +11322,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
11053
11322
|
farmI18nClientBridgePlugin(),
|
|
11054
11323
|
farmServerOnlyEntriesPlugin(),
|
|
11055
11324
|
farmPlugin(config, pluginManager),
|
|
11056
|
-
farmEnvironmentFunctionsPlugin()
|
|
11325
|
+
farmEnvironmentFunctionsPlugin(config)
|
|
11057
11326
|
],
|
|
11058
11327
|
mode: "production"
|
|
11059
11328
|
});
|
|
@@ -11061,7 +11330,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
11061
11330
|
__name(buildClient2, "buildClient");
|
|
11062
11331
|
async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
11063
11332
|
const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.mjs");
|
|
11064
|
-
const { PluginManager: PluginManager2 } = await import("./plugin.mjs");
|
|
11333
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-SYMK7PQ2.mjs");
|
|
11065
11334
|
const pluginManager = new PluginManager2({
|
|
11066
11335
|
config,
|
|
11067
11336
|
isDev: false,
|
|
@@ -11087,24 +11356,24 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
11087
11356
|
plugins: [
|
|
11088
11357
|
farmI18nClientBridgePlugin(),
|
|
11089
11358
|
farmPlugin(config, pluginManager),
|
|
11090
|
-
farmEnvironmentFunctionsPlugin()
|
|
11359
|
+
farmEnvironmentFunctionsPlugin(config)
|
|
11091
11360
|
],
|
|
11092
11361
|
mode: "production"
|
|
11093
11362
|
});
|
|
11094
11363
|
}
|
|
11095
11364
|
__name(buildSSR, "buildSSR");
|
|
11096
11365
|
function resolveLegacyPageEntry(config, root, srcDir) {
|
|
11097
|
-
const appDir =
|
|
11366
|
+
const appDir = path10.join(root, srcDir, "app");
|
|
11098
11367
|
for (const extension of getFarmRendererComponentExtensions(config.renderer)) {
|
|
11099
|
-
const candidate =
|
|
11368
|
+
const candidate = path10.join(appDir, `page${extension}`);
|
|
11100
11369
|
if (existsSync3(candidate)) return candidate;
|
|
11101
11370
|
}
|
|
11102
|
-
return
|
|
11371
|
+
return path10.join(appDir, "page.tsx");
|
|
11103
11372
|
}
|
|
11104
11373
|
__name(resolveLegacyPageEntry, "resolveLegacyPageEntry");
|
|
11105
11374
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
11106
11375
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
11107
|
-
import("./nitro-
|
|
11376
|
+
import("./nitro-KDACKNHU.mjs"),
|
|
11108
11377
|
import("nitro/builder")
|
|
11109
11378
|
]);
|
|
11110
11379
|
let nitroConfig = await createNitroConfig(
|
|
@@ -11118,23 +11387,23 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
11118
11387
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
11119
11388
|
}
|
|
11120
11389
|
const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
|
|
11121
|
-
const serverOutputDir =
|
|
11122
|
-
const publicOutputDir =
|
|
11390
|
+
const serverOutputDir = path10.join(outputDir, "server");
|
|
11391
|
+
const publicOutputDir = path10.join(outputDir, "public");
|
|
11123
11392
|
const { mkdir, cp } = await import("fs/promises");
|
|
11124
11393
|
await mkdir(serverOutputDir, { recursive: true });
|
|
11125
11394
|
await mkdir(publicOutputDir, { recursive: true });
|
|
11126
|
-
const clientDir =
|
|
11395
|
+
const clientDir = path10.join(root, distDir, "client");
|
|
11127
11396
|
try {
|
|
11128
11397
|
await mkdir(publicOutputDir, { recursive: true });
|
|
11129
11398
|
await cp(clientDir, publicOutputDir, { recursive: true });
|
|
11130
11399
|
logger.info("\u{1F4E6} Copied client assets to public directory");
|
|
11131
|
-
const manifestPath =
|
|
11132
|
-
const assetsDir =
|
|
11400
|
+
const manifestPath = path10.join(publicOutputDir, "farm-client-manifest.json");
|
|
11401
|
+
const assetsDir = path10.join(publicOutputDir, "assets");
|
|
11133
11402
|
const manifestExists = await import("fs/promises").then(
|
|
11134
|
-
(
|
|
11403
|
+
(fs4) => fs4.access(manifestPath).then(() => true).catch(() => false)
|
|
11135
11404
|
);
|
|
11136
11405
|
const assetsExist = await import("fs/promises").then(
|
|
11137
|
-
(
|
|
11406
|
+
(fs4) => fs4.access(assetsDir).then(() => true).catch(() => false)
|
|
11138
11407
|
);
|
|
11139
11408
|
if (manifestExists && assetsExist) {
|
|
11140
11409
|
logger.info("\u2705 Verified client assets are present");
|
|
@@ -11145,8 +11414,8 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
11145
11414
|
logger.error(`\u274C Failed to copy client assets: ${error}`);
|
|
11146
11415
|
throw error;
|
|
11147
11416
|
}
|
|
11148
|
-
const serverDir =
|
|
11149
|
-
const nitroServerDir =
|
|
11417
|
+
const serverDir = path10.join(root, distDir, "server");
|
|
11418
|
+
const nitroServerDir = path10.join(root, distDir, ".nitro", "server", "farm");
|
|
11150
11419
|
try {
|
|
11151
11420
|
await mkdir(nitroServerDir, { recursive: true });
|
|
11152
11421
|
await cp(serverDir, nitroServerDir, { recursive: true });
|
|
@@ -11155,7 +11424,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
11155
11424
|
logger.warn(`Could not copy SSR bundles: ${error}`);
|
|
11156
11425
|
}
|
|
11157
11426
|
const nitro = await createNitro(nitroConfig);
|
|
11158
|
-
const registryPath =
|
|
11427
|
+
const registryPath = path10.join(root, distDir, ".nitro", "server", "farm-registry.ts");
|
|
11159
11428
|
try {
|
|
11160
11429
|
const { farmRegistry } = await import(
|
|
11161
11430
|
/* @vite-ignore */
|
|
@@ -11172,7 +11441,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
11172
11441
|
}
|
|
11173
11442
|
farmRegistry.routePaths = routePaths;
|
|
11174
11443
|
try {
|
|
11175
|
-
const clientManifestPath =
|
|
11444
|
+
const clientManifestPath = path10.join(root, distDir, "client", "farm-client-manifest.json");
|
|
11176
11445
|
const { readFile } = await import("fs/promises");
|
|
11177
11446
|
const manifestContent = await readFile(clientManifestPath, "utf-8");
|
|
11178
11447
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|