@farm.js/core 0.1.36 → 0.1.38
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-BVExL8rZ.d.mts → agent-mcp-BwKlpnc7.d.mts} +1 -1
- package/dist/{agent-mcp-luzfXK-P.d.ts → agent-mcp-De1imoMS.d.ts} +1 -1
- package/dist/{agent-mcp-handler-SJAHFSPI.cjs → agent-mcp-handler-MRGP3WJ3.cjs} +5 -5
- package/dist/{agent-mcp-handler-LPJ2CADR.mjs → agent-mcp-handler-OLRMZONF.mjs} +4 -4
- package/dist/agent-runtime.cjs +3 -3
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +2 -2
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +6 -6
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +5 -5
- package/dist/api/runtime.cjs +4 -4
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api/runtime.mjs +3 -3
- package/dist/api.cjs +9 -8
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +8 -7
- package/dist/{app-BukwkFIu.d.mts → app-CFZt-srr.d.mts} +21 -3
- package/dist/{app-Yfa2dsFy.d.ts → app-kT_QXTdx.d.ts} +21 -3
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +5 -3
- package/dist/{chunk-ADEA7PN3.cjs → chunk-2DD4JMQC.cjs} +113 -22
- package/dist/chunk-2ZYGC6SS.cjs +576 -0
- package/dist/{chunk-JZVADIOD.cjs → chunk-34UCJRQO.cjs} +2 -2
- package/dist/{chunk-D2BB47NB.cjs → chunk-3LOLJTFV.cjs} +6 -6
- package/dist/{chunk-KXWRO25S.cjs → chunk-472NCAZ7.cjs} +3 -3
- package/dist/chunk-4E5QXOCL.cjs +109 -0
- package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
- package/dist/{chunk-VQLJWDVW.cjs → chunk-4IE345DM.cjs} +37 -19
- package/dist/{chunk-O6WAEAX3.mjs → chunk-5BWWFHR2.mjs} +70 -15
- package/dist/{chunk-JNUWCDTF.cjs → chunk-5D2JIPLH.cjs} +2 -2
- package/dist/{chunk-BO36SELV.cjs → chunk-5OKBARDN.cjs} +2 -2
- package/dist/{chunk-AO6RYU5N.cjs → chunk-5PWXMJOH.cjs} +30 -22
- package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
- package/dist/chunk-6BK3K2GB.mjs +318 -0
- package/dist/{chunk-O6I6VWKK.mjs → chunk-6HB6V3R7.mjs} +1 -1
- package/dist/{chunk-UXFQ3UDA.cjs → chunk-6XWDE2P2.cjs} +61 -4
- package/dist/{chunk-VILIPRS6.mjs → chunk-7FPTZLKH.mjs} +1 -1
- package/dist/{chunk-SC2WYWPF.mjs → chunk-7PEP3BUT.mjs} +3 -3
- package/dist/{chunk-4E5AEDKY.mjs → chunk-A3EAIURZ.mjs} +25 -7
- package/dist/{chunk-YDQZGSDS.mjs → chunk-ARC7I3O2.mjs} +1 -1
- package/dist/{chunk-LSZAVSGY.mjs → chunk-B6G5CKMC.mjs} +101 -10
- package/dist/{chunk-3KZS4SUS.mjs → chunk-BZHXGVMA.mjs} +1 -1
- package/dist/{chunk-KN7K4VQN.mjs → chunk-CNNOLE4O.mjs} +1 -1
- package/dist/{chunk-4GLOOWKE.mjs → chunk-CQMVIOYP.mjs} +1 -1
- package/dist/{chunk-2ELDTQRN.mjs → chunk-CUM5NYL5.mjs} +1 -1
- package/dist/{chunk-HITLGIAO.cjs → chunk-CY2ZQ5C6.cjs} +7 -6
- package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
- package/dist/{chunk-QORUJDIV.mjs → chunk-DRLKAXDM.mjs} +2 -2
- package/dist/{chunk-DQQOKWYA.cjs → chunk-EIPC3FDA.cjs} +12 -4
- package/dist/{chunk-HOXTWRGB.mjs → chunk-EKF7KDFD.mjs} +5 -2
- package/dist/{chunk-42NHY7HW.cjs → chunk-EKN7NSZO.cjs} +62 -14
- package/dist/{chunk-YKX5BK66.cjs → chunk-EMO6K4YY.cjs} +7 -7
- package/dist/{chunk-6SJ2KJTA.mjs → chunk-EPYU2EBL.mjs} +1 -1
- package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
- package/dist/{chunk-PTZ2TVNE.cjs → chunk-H5CLOUZS.cjs} +5 -5
- package/dist/{chunk-DTSROJ5J.mjs → chunk-HD5CF3OE.mjs} +1 -1
- package/dist/{chunk-35GKZR22.mjs → chunk-HXRYZWTA.mjs} +1 -1
- package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
- package/dist/{chunk-MKYBIIAQ.mjs → chunk-IBUQWVYA.mjs} +17 -1
- package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
- package/dist/{chunk-W7LF2J2S.mjs → chunk-INL3THCU.mjs} +1 -1
- package/dist/{chunk-WZ77PUAM.mjs → chunk-IVLZZZEI.mjs} +1 -1
- package/dist/{chunk-ENLZ4R3Y.mjs → chunk-J7K2NZD6.mjs} +7 -6
- package/dist/{chunk-BPOF5U4N.mjs → chunk-JCKYH4LG.mjs} +10 -7
- package/dist/{chunk-77GNHH2Z.cjs → chunk-JCYYXBAJ.cjs} +3 -3
- package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
- package/dist/{chunk-ZWM5KGAA.cjs → chunk-KCQBAKIY.cjs} +23 -20
- package/dist/{chunk-OTC5BDGO.mjs → chunk-KHKLMNI5.mjs} +12 -7
- package/dist/{chunk-DZ5ZVB2K.cjs → chunk-KKSTAEMY.cjs} +1 -1
- package/dist/{chunk-N2NAS2AM.cjs → chunk-L4DD7ODZ.cjs} +2 -2
- package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
- package/dist/{chunk-OO7GXVSR.mjs → chunk-LI2F57NI.mjs} +1 -1
- package/dist/{chunk-NRSN7G7E.mjs → chunk-MLY2RP5R.mjs} +10 -2
- package/dist/{chunk-BPMATOP2.cjs → chunk-N32CC42M.cjs} +25 -20
- package/dist/{chunk-FNO7A7CM.cjs → chunk-NBBEQLOK.cjs} +34 -16
- package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
- package/dist/{chunk-GQRWBCWK.mjs → chunk-OAHTRMIC.mjs} +13 -5
- package/dist/{chunk-35WV46VL.mjs → chunk-OCIEZME4.mjs} +876 -685
- package/dist/{chunk-UH6QN5NL.mjs → chunk-P664ZVTV.mjs} +2 -2
- package/dist/{chunk-TE2G5ION.cjs → chunk-PGZDEPTM.cjs} +88 -33
- package/dist/{chunk-FDR64H6B.mjs → chunk-POSPE3IO.mjs} +59 -2
- package/dist/{chunk-UVW64BCB.cjs → chunk-Q3NXS4MU.cjs} +16 -14
- package/dist/{chunk-4WCZJQUO.mjs → chunk-QFW2IH5E.mjs} +57 -9
- package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
- package/dist/chunk-QRKIMN7T.mjs +48 -0
- package/dist/chunk-QTXBII4Z.cjs +632 -0
- package/dist/{chunk-CI6E3UOH.cjs → chunk-RG4A6LB2.cjs} +7 -7
- package/dist/{chunk-BJPBQNIE.cjs → chunk-RW63BOV7.cjs} +2 -2
- package/dist/{chunk-FO427P6I.cjs → chunk-RWFLWR5J.cjs} +10 -10
- package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
- package/dist/{chunk-EUV4YR3V.cjs → chunk-SGBJ247Q.cjs} +18 -2
- package/dist/chunk-SGBZPZUW.mjs +75 -0
- package/dist/{chunk-2NNMOPDN.mjs → chunk-SKVTP5PR.mjs} +4 -1
- package/dist/{chunk-2YTDKNH3.cjs → chunk-TGFQVLLF.cjs} +956 -765
- package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
- package/dist/{chunk-276VJSM6.mjs → chunk-TUBTR2OP.mjs} +250 -118
- package/dist/{chunk-GQ3Z3IZI.cjs → chunk-TYJALEHQ.cjs} +18 -18
- package/dist/chunk-TYMMBFN2.mjs +109 -0
- package/dist/chunk-U6QLDL3G.mjs +576 -0
- package/dist/{chunk-U4KT7QP3.cjs → chunk-ULASELLA.cjs} +26 -1
- package/dist/chunk-UXHS27O6.cjs +75 -0
- package/dist/{chunk-WWIKMBRN.mjs → chunk-VNGH5MLF.mjs} +17 -1
- package/dist/{chunk-EZDQRNQ7.mjs → chunk-VT4WFRHA.mjs} +23 -5
- package/dist/{chunk-CBJJH36A.cjs → chunk-VU6AAZVY.cjs} +20 -4
- package/dist/{chunk-27ZWSI3W.cjs → chunk-VXEEATVD.cjs} +2 -2
- package/dist/{chunk-EWET4D2Y.mjs → chunk-W36M2BQ4.mjs} +3 -3
- package/dist/{chunk-4WQ6PGSJ.cjs → chunk-WEW2JVA4.cjs} +4 -4
- package/dist/{chunk-4E5WBPEG.mjs → chunk-WFRT7JPX.mjs} +8 -533
- package/dist/{chunk-T4OGRVNS.mjs → chunk-WLL43JMO.mjs} +2 -2
- package/dist/chunk-WW46B6HA.cjs +318 -0
- package/dist/{chunk-TKSCR644.cjs → chunk-WXJLNP33.cjs} +2 -2
- package/dist/{chunk-S6VYG6XU.cjs → chunk-XKG2BLFN.cjs} +2 -2
- package/dist/{chunk-4NU4GGTC.cjs → chunk-XKVVMZP5.cjs} +6 -3
- package/dist/{chunk-NMHWYWDR.cjs → chunk-YR2VBEMO.cjs} +658 -526
- package/dist/{chunk-OHLSEQ57.mjs → chunk-ZJD2PN6Z.mjs} +10 -8
- package/dist/{chunk-3BU22U3M.cjs → chunk-ZXH4TS3F.cjs} +5 -2
- package/dist/{client-plugins-r1mOtSC1.d.ts → client-plugins-BvlNhGEB.d.ts} +54 -7
- package/dist/{client-plugins-C3mK9Pol.d.mts → client-plugins-DUrIYX9B.d.mts} +54 -7
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +8 -8
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-ERIKFEXX.mjs → devtools-JYJNOLPQ.mjs} +8 -6
- package/dist/{devtools-JZJJY5CK.cjs → devtools-VQWJANJV.cjs} +9 -7
- package/dist/docs.cjs +12 -10
- package/dist/docs.d.mts +20 -2
- package/dist/docs.d.ts +20 -2
- package/dist/docs.mjs +11 -9
- package/dist/headers.cjs +6 -4
- package/dist/headers.d.mts +11 -1
- package/dist/headers.d.ts +11 -1
- package/dist/headers.mjs +5 -3
- package/dist/i18n/client.cjs +11 -11
- package/dist/i18n/client.mjs +3 -3
- package/dist/index.cjs +62 -46
- package/dist/index.d.mts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.mjs +62 -46
- package/dist/integrations.cjs +5 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +4 -2
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +19 -5
- package/dist/internal/app-markdown-runtime.d.ts +19 -5
- package/dist/internal/app-markdown-runtime.mjs +4 -2
- package/dist/internal/build-runtime.cjs +33 -30
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +32 -29
- package/dist/internal/cli-runtime.cjs +14 -12
- package/dist/internal/cli-runtime.mjs +13 -11
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +9 -7
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +8 -6
- package/dist/internal/docs-precompiled-runtime.cjs +19 -13
- package/dist/internal/docs-precompiled-runtime.d.mts +5 -0
- package/dist/internal/docs-precompiled-runtime.d.ts +5 -0
- package/dist/internal/docs-precompiled-runtime.mjs +14 -8
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- 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 +6 -2
- package/dist/internal/production-node-env.d.mts +10 -1
- package/dist/internal/production-node-env.d.ts +10 -1
- package/dist/internal/production-node-env.mjs +5 -1
- package/dist/internal/production-runtime.cjs +39 -54
- package/dist/internal/production-runtime.d.mts +51 -11
- package/dist/internal/production-runtime.d.ts +51 -11
- package/dist/internal/production-runtime.mjs +39 -54
- package/dist/markdown.cjs +8 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +7 -1
- package/dist/middleware.cjs +10 -8
- package/dist/middleware.d.mts +27 -5
- package/dist/middleware.d.ts +27 -5
- package/dist/middleware.mjs +10 -8
- package/dist/navigation.cjs +7 -7
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +6 -6
- package/dist/plugin.cjs +25 -23
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +24 -22
- package/dist/{production-runtime-CCeVZXst.d.mts → production-runtime-BQ4_WLwQ.d.mts} +1 -1
- package/dist/{production-runtime-DPnsggY3.d.ts → production-runtime-D2aMyzjr.d.ts} +1 -1
- package/dist/query/client.cjs +9 -9
- package/dist/query/client.mjs +4 -4
- package/dist/{render-plan-Cw4f5E_R.d.ts → render-plan-25p4hrj4.d.ts} +1 -1
- package/dist/{render-plan-BuGaPFe6.d.mts → render-plan-DtkXMN8D.d.mts} +1 -1
- package/dist/renderer-client.cjs +12 -12
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +4 -4
- package/dist/renderer.d.mts +13 -4
- package/dist/renderer.d.ts +13 -4
- package/dist/{request-CsGARcAw.d.mts → request-DgCkIdcn.d.mts} +4 -2
- package/dist/{request-Bkg-hERy.d.ts → request-jF4jwx8f.d.ts} +4 -2
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-BUZMH_64.d.ts → route-rendering-Bji6S6a_.d.ts} +1 -1
- package/dist/{route-rendering-f11yh5dp.d.mts → route-rendering-CSBF78Ya.d.mts} +1 -1
- package/dist/{router-Cp6yRE8A.d.mts → router-B09Ui3Qm.d.mts} +1 -1
- package/dist/{router-B8CR9GbD.d.ts → router-CPB9cXtG.d.ts} +1 -1
- package/dist/routes.cjs +2 -2
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +1 -1
- package/dist/{runtime-CAEv36S_.d.mts → runtime-CM6E6yuI.d.mts} +1 -1
- package/dist/{runtime-CQVsT330.d.ts → runtime-EDMwLdjv.d.ts} +1 -1
- package/dist/server-fn.cjs +3 -3
- package/dist/server-fn.mjs +2 -2
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query.cjs +4 -4
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +51 -49
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +29 -27
- package/dist/{spa-router-BuciWGCZ.d.ts → spa-router-B_N8XgVu.d.ts} +2 -2
- package/dist/{spa-router-DwbqGkGj.d.mts → spa-router-Cgimzfbi.d.mts} +2 -2
- package/dist/testing.cjs +8 -8
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +6 -6
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-CaoWKtYM.d.ts → utils-BNxAKAuT.d.ts} +1 -1
- package/dist/{utils-B9V0S_yL.d.mts → utils-DZciYXYl.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +25 -23
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +24 -22
- package/package.json +1 -1
- package/types/middleware.d.ts +5 -1
- package/dist/chunk-655RLQQL.mjs +0 -43
- package/dist/chunk-FXEF4PPL.mjs +0 -47
- package/dist/chunk-IZY3V5XW.mjs +0 -23
- package/dist/chunk-MRMI32SN.cjs +0 -1157
- package/dist/chunk-MT763TDW.cjs +0 -43
- package/dist/chunk-XD32KALF.cjs +0 -47
- /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
- /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
|
@@ -3,24 +3,31 @@
|
|
|
3
3
|
var _chunkA6WIQH5Zcjs = require('./chunk-A6WIQH5Z.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _chunkMT763TDWcjs = require('./chunk-MT763TDW.cjs');
|
|
7
6
|
|
|
8
7
|
|
|
9
|
-
var _chunkXD32KALFcjs = require('./chunk-XD32KALF.cjs');
|
|
10
8
|
|
|
9
|
+
var _chunkWW46B6HAcjs = require('./chunk-WW46B6HA.cjs');
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
var _chunkVQLJWDVWcjs = require('./chunk-VQLJWDVW.cjs');
|
|
14
12
|
|
|
13
|
+
var _chunk4E5QXOCLcjs = require('./chunk-4E5QXOCL.cjs');
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
|
|
19
|
+
var _chunk4IE345DMcjs = require('./chunk-4IE345DM.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _chunkPGZDEPTMcjs = require('./chunk-PGZDEPTM.cjs');
|
|
24
31
|
|
|
25
32
|
|
|
26
33
|
|
|
@@ -28,7 +35,7 @@ var _chunkTE2G5IONcjs = require('./chunk-TE2G5ION.cjs');
|
|
|
28
35
|
var _chunkMWWVKDW3cjs = require('./chunk-MWWVKDW3.cjs');
|
|
29
36
|
|
|
30
37
|
|
|
31
|
-
var
|
|
38
|
+
var _chunkWXJLNP33cjs = require('./chunk-WXJLNP33.cjs');
|
|
32
39
|
|
|
33
40
|
|
|
34
41
|
var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
@@ -37,7 +44,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
37
44
|
|
|
38
45
|
|
|
39
46
|
|
|
40
|
-
var
|
|
47
|
+
var _chunkQ3NXS4MUcjs = require('./chunk-Q3NXS4MU.cjs');
|
|
41
48
|
|
|
42
49
|
|
|
43
50
|
var _chunkKCMTCM6Icjs = require('./chunk-KCMTCM6I.cjs');
|
|
@@ -76,13 +83,14 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
|
|
|
76
83
|
|
|
77
84
|
|
|
78
85
|
|
|
79
|
-
var
|
|
86
|
+
var _chunkYR2VBEMOcjs = require('./chunk-YR2VBEMO.cjs');
|
|
87
|
+
|
|
80
88
|
|
|
81
89
|
|
|
82
90
|
|
|
83
91
|
|
|
92
|
+
var _chunk5D2JIPLHcjs = require('./chunk-5D2JIPLH.cjs');
|
|
84
93
|
|
|
85
|
-
var _chunkJNUWCDTFcjs = require('./chunk-JNUWCDTF.cjs');
|
|
86
94
|
|
|
87
95
|
|
|
88
96
|
|
|
@@ -94,12 +102,15 @@ var _chunkJNUWCDTFcjs = require('./chunk-JNUWCDTF.cjs');
|
|
|
94
102
|
|
|
95
103
|
|
|
96
104
|
|
|
97
|
-
var _chunkADEA7PN3cjs = require('./chunk-ADEA7PN3.cjs');
|
|
98
105
|
|
|
99
106
|
|
|
100
107
|
|
|
108
|
+
var _chunk2DD4JMQCcjs = require('./chunk-2DD4JMQC.cjs');
|
|
101
109
|
|
|
102
|
-
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
var _chunkH5CLOUZScjs = require('./chunk-H5CLOUZS.cjs');
|
|
103
114
|
|
|
104
115
|
|
|
105
116
|
var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
|
|
@@ -109,7 +120,7 @@ var _chunk3SDFA7UFcjs = require('./chunk-3SDFA7UF.cjs');
|
|
|
109
120
|
|
|
110
121
|
|
|
111
122
|
|
|
112
|
-
var
|
|
123
|
+
var _chunkCY2ZQ5C6cjs = require('./chunk-CY2ZQ5C6.cjs');
|
|
113
124
|
|
|
114
125
|
|
|
115
126
|
|
|
@@ -131,7 +142,8 @@ var _chunkWBKEZXWEcjs = require('./chunk-WBKEZXWE.cjs');
|
|
|
131
142
|
var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
132
143
|
|
|
133
144
|
|
|
134
|
-
|
|
145
|
+
|
|
146
|
+
var _chunk2ZYGC6SScjs = require('./chunk-2ZYGC6SS.cjs');
|
|
135
147
|
|
|
136
148
|
|
|
137
149
|
|
|
@@ -143,14 +155,14 @@ var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
|
|
|
143
155
|
var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
|
|
144
156
|
|
|
145
157
|
|
|
146
|
-
var
|
|
158
|
+
var _chunkEKN7NSZOcjs = require('./chunk-EKN7NSZO.cjs');
|
|
147
159
|
|
|
148
160
|
|
|
149
161
|
|
|
150
162
|
var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
|
|
151
163
|
|
|
152
164
|
|
|
153
|
-
var
|
|
165
|
+
var _chunkSGBJ247Qcjs = require('./chunk-SGBJ247Q.cjs');
|
|
154
166
|
|
|
155
167
|
|
|
156
168
|
|
|
@@ -159,20 +171,15 @@ var _chunkSDOTRX3Vcjs = require('./chunk-SDOTRX3V.cjs');
|
|
|
159
171
|
|
|
160
172
|
|
|
161
173
|
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var _chunkZWM5KGAAcjs = require('./chunk-ZWM5KGAA.cjs');
|
|
174
|
+
var _chunkVU6AAZVYcjs = require('./chunk-VU6AAZVY.cjs');
|
|
168
175
|
|
|
169
176
|
|
|
170
177
|
|
|
171
178
|
|
|
172
|
-
var
|
|
179
|
+
var _chunkKCQBAKIYcjs = require('./chunk-KCQBAKIY.cjs');
|
|
173
180
|
|
|
174
181
|
|
|
175
|
-
var
|
|
182
|
+
var _chunkRWFLWR5Jcjs = require('./chunk-RWFLWR5J.cjs');
|
|
176
183
|
|
|
177
184
|
|
|
178
185
|
var _chunkUFDAAQFXcjs = require('./chunk-UFDAAQFX.cjs');
|
|
@@ -199,12 +206,15 @@ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
|
199
206
|
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
200
207
|
|
|
201
208
|
|
|
202
|
-
var
|
|
209
|
+
var _chunkKKSTAEMYcjs = require('./chunk-KKSTAEMY.cjs');
|
|
203
210
|
|
|
204
211
|
|
|
205
212
|
var _chunkC5GUTBZKcjs = require('./chunk-C5GUTBZK.cjs');
|
|
206
213
|
|
|
207
214
|
|
|
215
|
+
var _chunk6XWDE2P2cjs = require('./chunk-6XWDE2P2.cjs');
|
|
216
|
+
|
|
217
|
+
|
|
208
218
|
var _chunkNO3WWW3Ncjs = require('./chunk-NO3WWW3N.cjs');
|
|
209
219
|
|
|
210
220
|
|
|
@@ -220,15 +230,15 @@ var _fs = require('fs');
|
|
|
220
230
|
var FARM_CLIENT_CSS_HREF_PLACEHOLDER = "/__farm_client_css_href__";
|
|
221
231
|
var FARM_CLIENT_JS_SRC_PLACEHOLDER = "/__farm_client_js_src__";
|
|
222
232
|
async function hashAndCopy(sourcePath, destinationDir, hashedName) {
|
|
223
|
-
const
|
|
233
|
+
const fs3 = await import("fs/promises");
|
|
224
234
|
try {
|
|
225
|
-
const bytes = await
|
|
235
|
+
const bytes = await fs3.readFile(sourcePath);
|
|
226
236
|
if (bytes.length === 0) return null;
|
|
227
237
|
const { createHash } = await import("crypto");
|
|
228
238
|
const hash = createHash("sha256").update(bytes).digest("hex").slice(0, 8);
|
|
229
239
|
const name = hashedName(hash);
|
|
230
|
-
await
|
|
231
|
-
await
|
|
240
|
+
await fs3.mkdir(destinationDir, { recursive: true });
|
|
241
|
+
await fs3.writeFile(_path2.default.join(destinationDir, name), bytes);
|
|
232
242
|
return name;
|
|
233
243
|
} catch (e) {
|
|
234
244
|
return null;
|
|
@@ -245,9 +255,9 @@ async function resolveHashedClientCssHref(clientOutputDir) {
|
|
|
245
255
|
}
|
|
246
256
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveHashedClientCssHref, "resolveHashedClientCssHref");
|
|
247
257
|
async function findFingerprintedClientEntry(clientOutputDir) {
|
|
248
|
-
const
|
|
258
|
+
const fs3 = await import("fs/promises");
|
|
249
259
|
try {
|
|
250
|
-
const entries = await
|
|
260
|
+
const entries = await fs3.readdir(clientOutputDir);
|
|
251
261
|
return _nullishCoalesce(entries.find((name) => /^farm-client-h[0-9a-f]+\.js$/.test(name)), () => ( null));
|
|
252
262
|
} catch (e2) {
|
|
253
263
|
return null;
|
|
@@ -257,10 +267,10 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, findFingerprintedClientEntry, "findFingerp
|
|
|
257
267
|
async function resolveHashedClientJsSrc(clientOutputDir) {
|
|
258
268
|
const entryName = await findFingerprintedClientEntry(clientOutputDir);
|
|
259
269
|
if (!entryName) return "/farm-client.js";
|
|
260
|
-
const
|
|
270
|
+
const fs3 = await import("fs/promises");
|
|
261
271
|
const shim = `export * from "./${entryName}";
|
|
262
272
|
`;
|
|
263
|
-
await
|
|
273
|
+
await fs3.writeFile(_path2.default.join(clientOutputDir, "farm-client.js"), shim);
|
|
264
274
|
return `/${entryName}`;
|
|
265
275
|
}
|
|
266
276
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveHashedClientJsSrc, "resolveHashedClientJsSrc");
|
|
@@ -309,7 +319,7 @@ function getDocsTitle(docs) {
|
|
|
309
319
|
}
|
|
310
320
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsTitle, "getDocsTitle");
|
|
311
321
|
function loadPages(contentDir, docs) {
|
|
312
|
-
return
|
|
322
|
+
return _chunkPGZDEPTMcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkPGZDEPTMcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
313
323
|
}
|
|
314
324
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadPages, "loadPages");
|
|
315
325
|
function findSocialImagePath(html) {
|
|
@@ -330,31 +340,34 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
330
340
|
}
|
|
331
341
|
_chunkS3JO3N4Hcjs.__name.call(void 0, addHandlerRoute, "addHandlerRoute");
|
|
332
342
|
async function compileFarmDocsManifest(docs, options) {
|
|
333
|
-
const contentDir =
|
|
343
|
+
const contentDir = _chunkPGZDEPTMcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
334
344
|
const pages = loadPages(contentDir, docs);
|
|
335
345
|
const absolutePaths = [
|
|
336
346
|
_path2.default.resolve(options.root),
|
|
337
347
|
_path2.default.resolve(contentDir),
|
|
338
348
|
docs.configPath || ""
|
|
339
349
|
];
|
|
340
|
-
const handler =
|
|
350
|
+
const handler = _chunkPGZDEPTMcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
341
351
|
root: options.root,
|
|
342
352
|
srcDir: options.srcDir,
|
|
343
353
|
clientEntry: options.clientEntry,
|
|
344
354
|
fontAssets: options.fontAssets,
|
|
345
355
|
fontStylesheetHref: options.fontStylesheetHref,
|
|
346
|
-
globalStylesheetHref: options.globalStylesheetHref
|
|
356
|
+
globalStylesheetHref: options.globalStylesheetHref,
|
|
357
|
+
isPathGuarded: options.isPathGuarded
|
|
347
358
|
});
|
|
348
|
-
const apiHandler =
|
|
359
|
+
const apiHandler = _chunk4IE345DMcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
349
360
|
rootDir: options.root,
|
|
350
361
|
srcDir: options.srcDir,
|
|
351
|
-
docs
|
|
362
|
+
docs,
|
|
363
|
+
isPathGuarded: options.isPathGuarded
|
|
352
364
|
});
|
|
365
|
+
const publicPages = pages.filter((page) => !_optionalChain([options, 'access', _2 => _2.isPathGuarded, 'optionalCall', _3 => _3(page.href)]));
|
|
353
366
|
const routes = {};
|
|
354
367
|
const apiMarkdown = {};
|
|
355
368
|
for (const page of pages) {
|
|
356
369
|
const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
|
|
357
|
-
const markdownPath =
|
|
370
|
+
const markdownPath = _chunkPGZDEPTMcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
|
|
358
371
|
await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
|
|
359
372
|
if (htmlResponse) {
|
|
360
373
|
const socialImagePath = findSocialImagePath(await htmlResponse.text());
|
|
@@ -362,6 +375,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
362
375
|
await addHandlerRoute(routes, socialImagePath, handler, absolutePaths);
|
|
363
376
|
}
|
|
364
377
|
}
|
|
378
|
+
if (_optionalChain([options, 'access', _4 => _4.isPathGuarded, 'optionalCall', _5 => _5(page.href)])) continue;
|
|
365
379
|
const apiResponse = await apiHandler(
|
|
366
380
|
new Request(
|
|
367
381
|
`${FARM_DOCS_COMPILED_ORIGIN}/api/docs?format=markdown&path=${encodeURIComponent(page.slug)}`
|
|
@@ -436,8 +450,8 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
436
450
|
empty: await compileResponse(emptyResponse, absolutePaths),
|
|
437
451
|
post: await compileResponse(postResponse, absolutePaths),
|
|
438
452
|
search: {
|
|
439
|
-
pages:
|
|
440
|
-
...
|
|
453
|
+
pages: publicPages.map((page) => ({
|
|
454
|
+
..._chunkPGZDEPTMcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
441
455
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
442
456
|
})),
|
|
443
457
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -449,6 +463,174 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
449
463
|
}
|
|
450
464
|
_chunkS3JO3N4Hcjs.__name.call(void 0, compileFarmDocsManifest, "compileFarmDocsManifest");
|
|
451
465
|
|
|
466
|
+
// src/nitro/client-module-preloads.ts
|
|
467
|
+
var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
|
|
468
|
+
|
|
469
|
+
var FARM_CLIENT_MODULE_PRELOADS_PLACEHOLDER = "__farm_client_module_preloads__";
|
|
470
|
+
var FARM_CLIENT_MODULE_PRELOADS_FILE = "client-module-preloads.json";
|
|
471
|
+
function collectFarmClientModulePreloads(bundle, options) {
|
|
472
|
+
const chunks = Object.values(bundle).filter(
|
|
473
|
+
(output) => output.type === "chunk"
|
|
474
|
+
);
|
|
475
|
+
const entry = chunks.find((chunk) => chunk.isEntry && chunk.name === options.entryName);
|
|
476
|
+
if (!entry) return null;
|
|
477
|
+
const byFile = new Map(chunks.map((chunk) => [chunk.fileName, chunk]));
|
|
478
|
+
const files = [];
|
|
479
|
+
const indexOf = /* @__PURE__ */ new Map();
|
|
480
|
+
const index = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (fileName) => {
|
|
481
|
+
let value = indexOf.get(fileName);
|
|
482
|
+
if (value === void 0) {
|
|
483
|
+
value = files.push(fileName) - 1;
|
|
484
|
+
indexOf.set(fileName, value);
|
|
485
|
+
}
|
|
486
|
+
return value;
|
|
487
|
+
}, "index");
|
|
488
|
+
const staticImports = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (chunk, loaded, into) => {
|
|
489
|
+
for (const fileName of _nullishCoalesce(chunk.imports, () => ( []))) {
|
|
490
|
+
const imported = byFile.get(fileName);
|
|
491
|
+
if (loaded.has(fileName) || !imported) continue;
|
|
492
|
+
loaded.add(fileName);
|
|
493
|
+
into.push(fileName);
|
|
494
|
+
staticImports(imported, loaded, into);
|
|
495
|
+
}
|
|
496
|
+
return into;
|
|
497
|
+
}, "staticImports");
|
|
498
|
+
const entryFiles = staticImports(entry, /* @__PURE__ */ new Set([entry.fileName]), []);
|
|
499
|
+
const entryLoaded = /* @__PURE__ */ new Set([entry.fileName, ...entryFiles]);
|
|
500
|
+
const modules = {};
|
|
501
|
+
for (const chunk of chunks) {
|
|
502
|
+
if (!chunk.isDynamicEntry || !chunk.facadeModuleId || entryLoaded.has(chunk.fileName)) {
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
const moduleId = chunk.facadeModuleId.split("?")[0];
|
|
506
|
+
if (!_path2.default.isAbsolute(moduleId)) continue;
|
|
507
|
+
const loaded = /* @__PURE__ */ new Set([...entryLoaded, chunk.fileName]);
|
|
508
|
+
modules[_chunk5QIKR7RRcjs.toViteModuleId.call(void 0, moduleId, options.root)] = [
|
|
509
|
+
chunk.fileName,
|
|
510
|
+
...staticImports(chunk, loaded, [])
|
|
511
|
+
].map(index);
|
|
512
|
+
}
|
|
513
|
+
return { files, entry: entryFiles.map(index), modules };
|
|
514
|
+
}
|
|
515
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmClientModulePreloads, "collectFarmClientModulePreloads");
|
|
516
|
+
function createFarmClientModulePreloadPlugin(options) {
|
|
517
|
+
return {
|
|
518
|
+
name: "farm-client-module-preloads",
|
|
519
|
+
async generateBundle(_output, bundle) {
|
|
520
|
+
await _promises2.default.mkdir(options.buildDir, { recursive: true });
|
|
521
|
+
await _promises2.default.writeFile(
|
|
522
|
+
_path2.default.join(options.buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE),
|
|
523
|
+
JSON.stringify(collectFarmClientModulePreloads(bundle, options))
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmClientModulePreloadPlugin, "createFarmClientModulePreloadPlugin");
|
|
529
|
+
async function readFarmClientModulePreloads(buildDir) {
|
|
530
|
+
try {
|
|
531
|
+
return JSON.parse(
|
|
532
|
+
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE), "utf8")
|
|
533
|
+
);
|
|
534
|
+
} catch (e4) {
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, readFarmClientModulePreloads, "readFarmClientModulePreloads");
|
|
539
|
+
function encodeFarmClientModulePreloads(manifest) {
|
|
540
|
+
return JSON.stringify(JSON.stringify(manifest)).slice(1, -1).replace(/'/g, "\\u0027").replace(/`/g, "\\u0060").replace(/\$/g, "\\u0024").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
541
|
+
}
|
|
542
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, encodeFarmClientModulePreloads, "encodeFarmClientModulePreloads");
|
|
543
|
+
|
|
544
|
+
// src/docs/module-preloads.ts
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
var FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER = "__farm_docs_module_preloads__";
|
|
548
|
+
var FARM_DOCS_MODULE_PRELOADS_FILE = "docs-module-preloads.json";
|
|
549
|
+
function normalizeModuleId(id) {
|
|
550
|
+
return id.split("?")[0].replace(/\\/g, "/");
|
|
551
|
+
}
|
|
552
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeModuleId, "normalizeModuleId");
|
|
553
|
+
function collectFarmDocsModulePreloads(bundle, options) {
|
|
554
|
+
const chunks = Object.values(bundle).filter(
|
|
555
|
+
(output) => output.type === "chunk"
|
|
556
|
+
);
|
|
557
|
+
const byFile = new Map(chunks.map((chunk) => [chunk.fileName, chunk]));
|
|
558
|
+
const byModule = new Map(
|
|
559
|
+
chunks.filter((chunk) => chunk.facadeModuleId).map((chunk) => [normalizeModuleId(chunk.facadeModuleId), chunk])
|
|
560
|
+
);
|
|
561
|
+
const withStaticImports = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (fileName, into) => {
|
|
562
|
+
if (into.has(fileName) || !byFile.has(fileName)) return into;
|
|
563
|
+
into.add(fileName);
|
|
564
|
+
for (const imported of _nullishCoalesce(byFile.get(fileName).imports, () => ( []))) withStaticImports(imported, into);
|
|
565
|
+
return into;
|
|
566
|
+
}, "withStaticImports");
|
|
567
|
+
const runtimeChunks = options.runtimeModuleIds.map((id) => byModule.get(normalizeModuleId(id))).filter((chunk) => Boolean(chunk));
|
|
568
|
+
const entry = chunks.find((chunk) => chunk.isEntry && chunk.name === options.entryName);
|
|
569
|
+
if (!entry || runtimeChunks.length === 0) return null;
|
|
570
|
+
const runtime = withStaticImports(entry.fileName, /* @__PURE__ */ new Set());
|
|
571
|
+
for (const chunk of runtimeChunks) withStaticImports(chunk.fileName, runtime);
|
|
572
|
+
const files = [];
|
|
573
|
+
const indexOf = /* @__PURE__ */ new Map();
|
|
574
|
+
const index = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (fileName) => {
|
|
575
|
+
let value = indexOf.get(fileName);
|
|
576
|
+
if (value === void 0) {
|
|
577
|
+
value = files.push(fileName) - 1;
|
|
578
|
+
indexOf.set(fileName, value);
|
|
579
|
+
}
|
|
580
|
+
return value;
|
|
581
|
+
}, "index");
|
|
582
|
+
const pages = {};
|
|
583
|
+
const root = normalizeModuleId(_path2.default.resolve(options.root));
|
|
584
|
+
for (const [moduleId, chunk] of byModule) {
|
|
585
|
+
if (!/\.mdx?$/.test(moduleId) || !moduleId.startsWith(`${root}/`)) continue;
|
|
586
|
+
const own = [...withStaticImports(chunk.fileName, /* @__PURE__ */ new Set())].filter(
|
|
587
|
+
(fileName) => !runtime.has(fileName)
|
|
588
|
+
);
|
|
589
|
+
pages[moduleId.slice(root.length)] = own.map(index);
|
|
590
|
+
}
|
|
591
|
+
return { files, runtime: [...runtime].map(index), pages };
|
|
592
|
+
}
|
|
593
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmDocsModulePreloads, "collectFarmDocsModulePreloads");
|
|
594
|
+
function createFarmDocsModulePreloadPlugin(options) {
|
|
595
|
+
let runtimeModuleIds = [];
|
|
596
|
+
return {
|
|
597
|
+
name: "farm-docs-module-preloads",
|
|
598
|
+
async buildStart() {
|
|
599
|
+
const resolved = await Promise.all(
|
|
600
|
+
options.modules.map((specifier) => this.resolve(specifier, options.importer))
|
|
601
|
+
);
|
|
602
|
+
runtimeModuleIds = resolved.filter((value) => value !== null).map((value) => value.id);
|
|
603
|
+
},
|
|
604
|
+
async generateBundle(_output, bundle) {
|
|
605
|
+
const manifest = collectFarmDocsModulePreloads(bundle, {
|
|
606
|
+
root: options.root,
|
|
607
|
+
entryName: options.entryName,
|
|
608
|
+
runtimeModuleIds
|
|
609
|
+
});
|
|
610
|
+
await _promises2.default.mkdir(options.buildDir, { recursive: true });
|
|
611
|
+
await _promises2.default.writeFile(
|
|
612
|
+
_path2.default.join(options.buildDir, FARM_DOCS_MODULE_PRELOADS_FILE),
|
|
613
|
+
JSON.stringify(manifest)
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDocsModulePreloadPlugin, "createFarmDocsModulePreloadPlugin");
|
|
619
|
+
async function readFarmDocsModulePreloads(buildDir) {
|
|
620
|
+
try {
|
|
621
|
+
return JSON.parse(
|
|
622
|
+
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_DOCS_MODULE_PRELOADS_FILE), "utf8")
|
|
623
|
+
);
|
|
624
|
+
} catch (e5) {
|
|
625
|
+
return null;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, readFarmDocsModulePreloads, "readFarmDocsModulePreloads");
|
|
629
|
+
function encodeFarmDocsModulePreloads(manifest) {
|
|
630
|
+
return JSON.stringify(JSON.stringify(manifest)).slice(1, -1).replace(/'/g, "\\u0027").replace(/`/g, "\\u0060").replace(/\$/g, "\\u0024").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
631
|
+
}
|
|
632
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, encodeFarmDocsModulePreloads, "encodeFarmDocsModulePreloads");
|
|
633
|
+
|
|
452
634
|
// src/route-runtime-manifest.ts
|
|
453
635
|
|
|
454
636
|
var FARM_ROUTE_RUNTIME_MANIFEST = "route-runtime-manifest.json";
|
|
@@ -457,7 +639,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
457
639
|
const routes = [];
|
|
458
640
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
459
641
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
460
|
-
const rendering = await
|
|
642
|
+
const rendering = await _chunk5D2JIPLHcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
461
643
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
462
644
|
routes.push({
|
|
463
645
|
kind: "page",
|
|
@@ -523,10 +705,10 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
523
705
|
}
|
|
524
706
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmRouteRuntimeManifest, "createFarmRouteRuntimeManifest");
|
|
525
707
|
async function writeFarmRouteRuntimeManifest(directory, manifest) {
|
|
526
|
-
const
|
|
708
|
+
const fs3 = await import("fs/promises");
|
|
527
709
|
const manifestPath = _path2.default.join(directory, FARM_ROUTE_RUNTIME_MANIFEST);
|
|
528
|
-
await
|
|
529
|
-
await
|
|
710
|
+
await fs3.mkdir(directory, { recursive: true });
|
|
711
|
+
await fs3.writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
530
712
|
`);
|
|
531
713
|
return manifestPath;
|
|
532
714
|
}
|
|
@@ -546,7 +728,7 @@ function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
|
546
728
|
`Route "${route.pattern}" requires the ${route.runtime} runtime, but preset "${preset}" emits ${runtime} functions. Choose a compatible preset or change the route runtime.`
|
|
547
729
|
);
|
|
548
730
|
}
|
|
549
|
-
if (_optionalChain([route, 'access',
|
|
731
|
+
if (_optionalChain([route, 'access', _6 => _6.regions, 'optionalAccess', _7 => _7.length]) && preset !== "vercel" && preset !== "vercel-edge") {
|
|
550
732
|
warnings.add(
|
|
551
733
|
`Preset "${preset}" does not map per-route regions; Farm kept them in ${FARM_ROUTE_RUNTIME_MANIFEST} for deployment adapters.`
|
|
552
734
|
);
|
|
@@ -571,7 +753,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeManifestSource, "normalizeManifes
|
|
|
571
753
|
|
|
572
754
|
// src/nitro/vercel-route-runtime.ts
|
|
573
755
|
|
|
574
|
-
async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest,
|
|
756
|
+
async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs3, basePath = "/") {
|
|
575
757
|
const dynamicRoutes = manifest.routes.filter(
|
|
576
758
|
(route) => route.rendering === "dynamic" && route.runtime !== "edge"
|
|
577
759
|
);
|
|
@@ -595,15 +777,15 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs, ba
|
|
|
595
777
|
const destinations = /* @__PURE__ */ new Map();
|
|
596
778
|
let groupIndex = 0;
|
|
597
779
|
for (const [key, group] of groups) {
|
|
598
|
-
if (!_optionalChain([group, 'access',
|
|
780
|
+
if (!_optionalChain([group, 'access', _8 => _8.config, 'access', _9 => _9.regions, 'optionalAccess', _10 => _10.length]) && !group.config.maxDuration) {
|
|
599
781
|
destinations.set(key, "/__nitro");
|
|
600
782
|
continue;
|
|
601
783
|
}
|
|
602
784
|
groupIndex += 1;
|
|
603
785
|
const functionName = `__farm_runtime_${groupIndex}`;
|
|
604
786
|
const functionDir = _path2.default.join(functionsDir, `${functionName}.func`);
|
|
605
|
-
await
|
|
606
|
-
await configureVercelFunction(functionDir, group.config,
|
|
787
|
+
await fs3.cp(baseFunctionDir, functionDir, { recursive: true, force: true });
|
|
788
|
+
await configureVercelFunction(functionDir, group.config, fs3);
|
|
607
789
|
destinations.set(key, `/${functionName}`);
|
|
608
790
|
}
|
|
609
791
|
const routes = [];
|
|
@@ -652,20 +834,20 @@ function farmRoutePatternToVercelSource(pattern, basePath = "/") {
|
|
|
652
834
|
return source === "/" ? normalizedBasePath : `${normalizedBasePath}${source}`;
|
|
653
835
|
}
|
|
654
836
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmRoutePatternToVercelSource, "farmRoutePatternToVercelSource");
|
|
655
|
-
async function configureVercelFunction(functionDir, config,
|
|
837
|
+
async function configureVercelFunction(functionDir, config, fs3) {
|
|
656
838
|
const configPath = _path2.default.join(functionDir, ".vc-config.json");
|
|
657
|
-
const current = JSON.parse(await
|
|
839
|
+
const current = JSON.parse(await fs3.readFile(configPath, "utf8"));
|
|
658
840
|
const next = {
|
|
659
841
|
...current,
|
|
660
|
-
..._optionalChain([config, 'access',
|
|
842
|
+
..._optionalChain([config, 'access', _11 => _11.regions, 'optionalAccess', _12 => _12.length]) ? { regions: config.regions } : {},
|
|
661
843
|
...config.maxDuration ? { maxDuration: config.maxDuration } : {}
|
|
662
844
|
};
|
|
663
|
-
await
|
|
845
|
+
await fs3.writeFile(configPath, `${JSON.stringify(next, null, 2)}
|
|
664
846
|
`);
|
|
665
847
|
}
|
|
666
848
|
_chunkS3JO3N4Hcjs.__name.call(void 0, configureVercelFunction, "configureVercelFunction");
|
|
667
849
|
function hasVercelFunctionControls(route) {
|
|
668
|
-
return Boolean(_optionalChain([route, 'access',
|
|
850
|
+
return Boolean(_optionalChain([route, 'access', _13 => _13.regions, 'optionalAccess', _14 => _14.length]) || route.maxDuration);
|
|
669
851
|
}
|
|
670
852
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasVercelFunctionControls, "hasVercelFunctionControls");
|
|
671
853
|
function compareRuntimeRoutes(left, right) {
|
|
@@ -760,15 +942,32 @@ function createFarmNetlifyEntry(options) {
|
|
|
760
942
|
import nitroNetlifyHandler from ${JSON.stringify(options.nitroNetlifyEntry)};
|
|
761
943
|
|
|
762
944
|
const PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i;
|
|
945
|
+
const CREDENTIAL_VARY = /(?:^|,)\\s*(?:\\*|cookie|authorization)\\s*(?:,|$)/i;
|
|
946
|
+
// What Nitro's entry sets when the response has no Cache-Control of its own.
|
|
947
|
+
const NITRO_DEFAULT_CACHE_CONTROL = "public, max-age=0, must-revalidate";
|
|
948
|
+
|
|
949
|
+
function isSharedCacheable(request, response) {
|
|
950
|
+
return (
|
|
951
|
+
response.status === 200 &&
|
|
952
|
+
!request.headers.has("cookie") &&
|
|
953
|
+
!request.headers.has("authorization") &&
|
|
954
|
+
!response.headers.has("set-cookie") &&
|
|
955
|
+
!PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "") &&
|
|
956
|
+
!CREDENTIAL_VARY.test(response.headers.get("vary") || "")
|
|
957
|
+
);
|
|
958
|
+
}
|
|
763
959
|
|
|
764
960
|
export default async function farmNetlifyHandler(request, context) {
|
|
765
961
|
const response = await nitroNetlifyHandler(request, context);
|
|
766
962
|
if (
|
|
767
963
|
response &&
|
|
768
964
|
response.headers.has("netlify-cdn-cache-control") &&
|
|
769
|
-
|
|
965
|
+
!isSharedCacheable(request, response)
|
|
770
966
|
) {
|
|
771
967
|
response.headers.delete("netlify-cdn-cache-control");
|
|
968
|
+
if (response.headers.get("cache-control") === NITRO_DEFAULT_CACHE_CONTROL) {
|
|
969
|
+
response.headers.set("cache-control", "private, no-store");
|
|
970
|
+
}
|
|
772
971
|
}
|
|
773
972
|
return response;
|
|
774
973
|
}
|
|
@@ -776,278 +975,6 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
776
975
|
}
|
|
777
976
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmNetlifyEntry, "createFarmNetlifyEntry");
|
|
778
977
|
|
|
779
|
-
// src/nitro/node-server-entry.ts
|
|
780
|
-
var FARM_NODE_ENV_MODULE_FILE = "farm-node-env.mjs";
|
|
781
|
-
var FARM_NODE_ENV_MODULE_SOURCE = `if (!process.env.NODE_ENV) process.env.NODE_ENV = "production";
|
|
782
|
-
`;
|
|
783
|
-
function createFarmNodeServerEntry(options) {
|
|
784
|
-
const serverConfig = JSON.stringify(options.server);
|
|
785
|
-
const nitroEntryImport = `./${options.nitroEntryFile.replace(/^\.\//, "")}`;
|
|
786
|
-
return `
|
|
787
|
-
import "./${FARM_NODE_ENV_MODULE_FILE}";
|
|
788
|
-
import "#nitro/virtual/polyfills";
|
|
789
|
-
import { NodeRequest, serve } from ${JSON.stringify(options.nodeAdapterModule)};
|
|
790
|
-
import wsAdapter from ${JSON.stringify(options.websocketAdapterModule)};
|
|
791
|
-
import { resolveWebsocketHooks, useNitroApp, useNitroHooks } from "#nitro/runtime/app";
|
|
792
|
-
import { useRuntimeConfig } from "#nitro/runtime/runtime-config";
|
|
793
|
-
import { trapUnhandledErrors } from "#nitro/runtime/error/hooks";
|
|
794
|
-
import { setupCloseHooks } from "#nitro/runtime/shutdown";
|
|
795
|
-
import { startScheduleRunner } from "#nitro/runtime/task";
|
|
796
|
-
import { tracingSrvxPlugins } from "#nitro/virtual/tracing";
|
|
797
|
-
import { farmProductionLifecycle } from ${JSON.stringify(nitroEntryImport)};
|
|
798
|
-
|
|
799
|
-
const farmServerConfig = ${serverConfig};
|
|
800
|
-
if (!process.env.NITRO_SHUTDOWN_TIMEOUT) {
|
|
801
|
-
process.env.NITRO_SHUTDOWN_TIMEOUT = String(farmServerConfig.gracefulShutdownTimeout);
|
|
802
|
-
}
|
|
803
|
-
const shutdownConfig = {
|
|
804
|
-
disabled: Boolean(process.env.NITRO_SHUTDOWN_DISABLED),
|
|
805
|
-
signals: (process.env.NITRO_SHUTDOWN_SIGNALS || "SIGTERM SIGINT")
|
|
806
|
-
.split(" ")
|
|
807
|
-
.map((signal) => signal.trim())
|
|
808
|
-
.filter(Boolean),
|
|
809
|
-
timeout: Number.parseInt(process.env.NITRO_SHUTDOWN_TIMEOUT || "", 10) || 30000,
|
|
810
|
-
forceExit: !process.env.NITRO_SHUTDOWN_NO_FORCE_EXIT,
|
|
811
|
-
};
|
|
812
|
-
|
|
813
|
-
const nitroApp = useNitroApp();
|
|
814
|
-
useNitroHooks().hook("close", async () => {
|
|
815
|
-
try {
|
|
816
|
-
await farmProductionLifecycle.close("production-server-closed");
|
|
817
|
-
} catch (error) {
|
|
818
|
-
process.exitCode = 1;
|
|
819
|
-
throw error;
|
|
820
|
-
}
|
|
821
|
-
});
|
|
822
|
-
|
|
823
|
-
let startupSignal;
|
|
824
|
-
let resolveStartupSignal;
|
|
825
|
-
const startupSignalPromise = new Promise((resolve) => {
|
|
826
|
-
resolveStartupSignal = resolve;
|
|
827
|
-
});
|
|
828
|
-
const startupSignalListeners = new Map();
|
|
829
|
-
if (!shutdownConfig.disabled) {
|
|
830
|
-
for (const signal of shutdownConfig.signals) {
|
|
831
|
-
const listener = (receivedSignal) => {
|
|
832
|
-
if (!startupSignal) {
|
|
833
|
-
startupSignal = receivedSignal;
|
|
834
|
-
resolveStartupSignal(receivedSignal);
|
|
835
|
-
}
|
|
836
|
-
farmProductionLifecycle.beginDrain(receivedSignal);
|
|
837
|
-
};
|
|
838
|
-
startupSignalListeners.set(signal, listener);
|
|
839
|
-
process.once(signal, listener);
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
try {
|
|
844
|
-
await Promise.race([
|
|
845
|
-
Promise.resolve().then(() => farmProductionLifecycle.start()),
|
|
846
|
-
startupSignalPromise,
|
|
847
|
-
]);
|
|
848
|
-
} catch (error) {
|
|
849
|
-
await farmProductionLifecycle.close("production-start-failed").catch((closeError) => {
|
|
850
|
-
console.error("[Farm] Runtime cleanup after startup failure failed:", closeError);
|
|
851
|
-
});
|
|
852
|
-
throw error;
|
|
853
|
-
} finally {
|
|
854
|
-
for (const [signal, listener] of startupSignalListeners) {
|
|
855
|
-
process.removeListener(signal, listener);
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
if (startupSignal) {
|
|
860
|
-
let startupCloseTimer;
|
|
861
|
-
const startupCloseCompleted = await Promise.race([
|
|
862
|
-
Promise.resolve()
|
|
863
|
-
.then(() => farmProductionLifecycle.close(startupSignal))
|
|
864
|
-
.then(
|
|
865
|
-
() => true,
|
|
866
|
-
(error) => {
|
|
867
|
-
console.error("[Farm] Runtime shutdown during startup failed:", error);
|
|
868
|
-
process.exitCode = 1;
|
|
869
|
-
return true;
|
|
870
|
-
},
|
|
871
|
-
),
|
|
872
|
-
new Promise((resolve) => {
|
|
873
|
-
startupCloseTimer = setTimeout(() => resolve(false), farmServerConfig.gracefulShutdownTimeout);
|
|
874
|
-
}),
|
|
875
|
-
]);
|
|
876
|
-
clearTimeout(startupCloseTimer);
|
|
877
|
-
if (!startupCloseCompleted) {
|
|
878
|
-
console.warn("[Farm] Runtime startup did not settle before shutdown; forcing cleanup");
|
|
879
|
-
let forcedCloseTimer;
|
|
880
|
-
const forcedCloseCompleted = await Promise.race([
|
|
881
|
-
Promise.resolve()
|
|
882
|
-
.then(() => farmProductionLifecycle.forceClose(startupSignal))
|
|
883
|
-
.then(
|
|
884
|
-
() => true,
|
|
885
|
-
(error) => {
|
|
886
|
-
console.error("[Farm] Forced runtime shutdown during startup failed:", error);
|
|
887
|
-
process.exitCode = 1;
|
|
888
|
-
return true;
|
|
889
|
-
},
|
|
890
|
-
),
|
|
891
|
-
new Promise((resolve) => {
|
|
892
|
-
forcedCloseTimer = setTimeout(
|
|
893
|
-
() => resolve(false),
|
|
894
|
-
farmServerConfig.gracefulShutdownTimeout,
|
|
895
|
-
);
|
|
896
|
-
}),
|
|
897
|
-
]);
|
|
898
|
-
clearTimeout(forcedCloseTimer);
|
|
899
|
-
if (!forcedCloseCompleted) {
|
|
900
|
-
console.error("[Farm] Forced runtime shutdown during startup timed out");
|
|
901
|
-
process.exitCode = 1;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
process.exit(process.exitCode || 0);
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
const cert = process.env.NITRO_SSL_CERT;
|
|
908
|
-
const key = process.env.NITRO_SSL_KEY;
|
|
909
|
-
const configuredPort = Number(process.env.NITRO_PORT || process.env.PORT);
|
|
910
|
-
const port = Number.isFinite(configuredPort) && configuredPort > 0 ? configuredPort : 3000;
|
|
911
|
-
const host = process.env.NITRO_HOST || process.env.HOST;
|
|
912
|
-
const socketPath = process.env.NITRO_UNIX_SOCKET;
|
|
913
|
-
const server = serve({
|
|
914
|
-
manual: true,
|
|
915
|
-
silent: true,
|
|
916
|
-
gracefulShutdown: false,
|
|
917
|
-
port,
|
|
918
|
-
hostname: host,
|
|
919
|
-
node: socketPath ? { path: socketPath } : undefined,
|
|
920
|
-
tls: cert && key ? { cert, key } : undefined,
|
|
921
|
-
fetch: nitroApp.fetch,
|
|
922
|
-
plugins: [...tracingSrvxPlugins],
|
|
923
|
-
});
|
|
924
|
-
const nodeServer = server.node?.server;
|
|
925
|
-
if (!nodeServer) throw new Error("[Farm] Nitro did not create a Node server");
|
|
926
|
-
|
|
927
|
-
nodeServer.headersTimeout = farmServerConfig.headersTimeout;
|
|
928
|
-
nodeServer.requestTimeout = farmServerConfig.requestTimeout;
|
|
929
|
-
nodeServer.keepAliveTimeout = farmServerConfig.keepAliveTimeout;
|
|
930
|
-
|
|
931
|
-
let isShuttingDown = false;
|
|
932
|
-
nodeServer.on("request", (_request, response) => {
|
|
933
|
-
response.once("finish", () => {
|
|
934
|
-
if (isShuttingDown) nodeServer.closeIdleConnections?.();
|
|
935
|
-
});
|
|
936
|
-
});
|
|
937
|
-
|
|
938
|
-
if (import.meta._websocket) {
|
|
939
|
-
const { handleUpgrade } = wsAdapter({ resolve: resolveWebsocketHooks });
|
|
940
|
-
nodeServer.on("upgrade", (request, socket, head) => {
|
|
941
|
-
handleUpgrade(
|
|
942
|
-
request,
|
|
943
|
-
socket,
|
|
944
|
-
head,
|
|
945
|
-
new NodeRequest({ req: request, upgrade: { socket, head } }),
|
|
946
|
-
);
|
|
947
|
-
});
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
setupCloseHooks(server);
|
|
951
|
-
trapUnhandledErrors();
|
|
952
|
-
|
|
953
|
-
let shutdownPromise;
|
|
954
|
-
async function shutdown(signal) {
|
|
955
|
-
isShuttingDown = true;
|
|
956
|
-
farmProductionLifecycle.beginDrain(signal);
|
|
957
|
-
|
|
958
|
-
const gracefulClose = server.close().then(
|
|
959
|
-
() => true,
|
|
960
|
-
(error) => {
|
|
961
|
-
console.error("[Farm] Runtime shutdown failed:", error);
|
|
962
|
-
process.exitCode = 1;
|
|
963
|
-
return true;
|
|
964
|
-
},
|
|
965
|
-
);
|
|
966
|
-
nodeServer.closeIdleConnections?.();
|
|
967
|
-
let gracefulTimer;
|
|
968
|
-
const gracefullyClosed = await Promise.race([
|
|
969
|
-
gracefulClose,
|
|
970
|
-
new Promise((resolve) => {
|
|
971
|
-
gracefulTimer = setTimeout(() => resolve(false), shutdownConfig.timeout);
|
|
972
|
-
}),
|
|
973
|
-
]);
|
|
974
|
-
clearTimeout(gracefulTimer);
|
|
975
|
-
|
|
976
|
-
if (!gracefullyClosed) {
|
|
977
|
-
console.warn("[Farm] Graceful shutdown timed out; forcing cleanup");
|
|
978
|
-
void server.close(true).catch((error) => {
|
|
979
|
-
console.error("[Farm] Forced server shutdown failed:", error);
|
|
980
|
-
process.exitCode = 1;
|
|
981
|
-
});
|
|
982
|
-
|
|
983
|
-
let forceTimer;
|
|
984
|
-
const forceClosed = await Promise.race([
|
|
985
|
-
Promise.resolve()
|
|
986
|
-
.then(() => farmProductionLifecycle.forceClose("production-server-closed"))
|
|
987
|
-
.then(
|
|
988
|
-
() => true,
|
|
989
|
-
(error) => {
|
|
990
|
-
console.error("[Farm] Forced runtime shutdown failed:", error);
|
|
991
|
-
process.exitCode = 1;
|
|
992
|
-
return true;
|
|
993
|
-
},
|
|
994
|
-
),
|
|
995
|
-
new Promise((resolve) => {
|
|
996
|
-
forceTimer = setTimeout(() => resolve(false), shutdownConfig.timeout);
|
|
997
|
-
}),
|
|
998
|
-
]);
|
|
999
|
-
clearTimeout(forceTimer);
|
|
1000
|
-
if (!forceClosed) {
|
|
1001
|
-
console.error("[Farm] Forced runtime shutdown timed out");
|
|
1002
|
-
process.exitCode = 1;
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
if (shutdownConfig.forceExit) process.exit(process.exitCode || 0);
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
if (!shutdownConfig.disabled) {
|
|
1010
|
-
for (const signal of shutdownConfig.signals) {
|
|
1011
|
-
process.once(signal, (receivedSignal) => {
|
|
1012
|
-
shutdownPromise ||= shutdown(receivedSignal);
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
try {
|
|
1018
|
-
await server.serve();
|
|
1019
|
-
const protocol = cert && key ? "https" : "http";
|
|
1020
|
-
const addressInfo = nodeServer.address();
|
|
1021
|
-
if (typeof addressInfo === "string") {
|
|
1022
|
-
console.log(\`Listening on unix socket \${addressInfo}\`);
|
|
1023
|
-
} else if (addressInfo) {
|
|
1024
|
-
const configuredBaseURL = useRuntimeConfig().app.baseURL || "";
|
|
1025
|
-
const baseURL = configuredBaseURL.endsWith("/")
|
|
1026
|
-
? configuredBaseURL.slice(0, -1)
|
|
1027
|
-
: configuredBaseURL;
|
|
1028
|
-
const address = addressInfo.family === "IPv6"
|
|
1029
|
-
? \`[\${addressInfo.address}]\`
|
|
1030
|
-
: addressInfo.address;
|
|
1031
|
-
console.log(\`Listening on \${protocol}://\${address}:\${addressInfo.port}\${baseURL}\`);
|
|
1032
|
-
}
|
|
1033
|
-
} catch (error) {
|
|
1034
|
-
console.error(error);
|
|
1035
|
-
process.exitCode = 1;
|
|
1036
|
-
await farmProductionLifecycle.close("production-listen-error").catch((closeError) => {
|
|
1037
|
-
console.error("[Farm] Runtime cleanup after listen failure failed:", closeError);
|
|
1038
|
-
});
|
|
1039
|
-
throw error;
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
if (import.meta._tasks) {
|
|
1043
|
-
startScheduleRunner({ waitUntil: server.waitUntil });
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
export default {};
|
|
1047
|
-
`.trim();
|
|
1048
|
-
}
|
|
1049
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmNodeServerEntry, "createFarmNodeServerEntry");
|
|
1050
|
-
|
|
1051
978
|
// src/nitro/universal-build.ts
|
|
1052
979
|
function preloadFarmNitroBuilder() {
|
|
1053
980
|
return import("nitro/builder").then(
|
|
@@ -1065,7 +992,7 @@ function findFarmCoreRoot(from) {
|
|
|
1065
992
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
1066
993
|
try {
|
|
1067
994
|
if (JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core") return dir;
|
|
1068
|
-
} catch (
|
|
995
|
+
} catch (e6) {
|
|
1069
996
|
}
|
|
1070
997
|
}
|
|
1071
998
|
dir = _path2.default.dirname(dir);
|
|
@@ -1085,7 +1012,7 @@ function findInstalledPackageDir(name, from) {
|
|
|
1085
1012
|
if (_fs.existsSync.call(void 0, _path2.default.join(candidate, "package.json"))) {
|
|
1086
1013
|
try {
|
|
1087
1014
|
return _fs.realpathSync.call(void 0, candidate);
|
|
1088
|
-
} catch (
|
|
1015
|
+
} catch (e7) {
|
|
1089
1016
|
return null;
|
|
1090
1017
|
}
|
|
1091
1018
|
}
|
|
@@ -1102,7 +1029,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
1102
1029
|
let manifest;
|
|
1103
1030
|
try {
|
|
1104
1031
|
manifest = JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(dir, "package.json"), "utf8"));
|
|
1105
|
-
} catch (
|
|
1032
|
+
} catch (e8) {
|
|
1106
1033
|
return;
|
|
1107
1034
|
}
|
|
1108
1035
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
@@ -1118,7 +1045,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
1118
1045
|
if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
|
|
1119
1046
|
}
|
|
1120
1047
|
}
|
|
1121
|
-
} catch (
|
|
1048
|
+
} catch (e9) {
|
|
1122
1049
|
}
|
|
1123
1050
|
for (let next = queue.pop(); next; next = queue.pop()) {
|
|
1124
1051
|
const dir = findInstalledPackageDir(next.name, next.from);
|
|
@@ -1197,14 +1124,14 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1197
1124
|
return {
|
|
1198
1125
|
name: "farm-prerender-runtime-resolver",
|
|
1199
1126
|
async resolveId(id, _importer, options) {
|
|
1200
|
-
if (_optionalChain([options, 'access',
|
|
1127
|
+
if (_optionalChain([options, 'access', _15 => _15.custom, 'optionalAccess', _16 => _16.farmPrerenderRuntimeResolve])) return null;
|
|
1201
1128
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
1202
1129
|
return null;
|
|
1203
1130
|
}
|
|
1204
1131
|
if (nitroEntry === void 0) {
|
|
1205
1132
|
try {
|
|
1206
1133
|
nitroEntry = resolveNitroEntry(root);
|
|
1207
|
-
} catch (
|
|
1134
|
+
} catch (e10) {
|
|
1208
1135
|
nitroEntry = null;
|
|
1209
1136
|
}
|
|
1210
1137
|
}
|
|
@@ -1223,7 +1150,7 @@ function resolveNitroPackageEntry(root) {
|
|
|
1223
1150
|
let runtimeRequire = projectRequire;
|
|
1224
1151
|
try {
|
|
1225
1152
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
1226
|
-
} catch (
|
|
1153
|
+
} catch (e11) {
|
|
1227
1154
|
}
|
|
1228
1155
|
return runtimeRequire.resolve("nitro");
|
|
1229
1156
|
}
|
|
@@ -1280,7 +1207,7 @@ async function canUseRolldownBuilder() {
|
|
|
1280
1207
|
try {
|
|
1281
1208
|
await import("rolldown");
|
|
1282
1209
|
return true;
|
|
1283
|
-
} catch (
|
|
1210
|
+
} catch (e12) {
|
|
1284
1211
|
return false;
|
|
1285
1212
|
}
|
|
1286
1213
|
}
|
|
@@ -1296,7 +1223,7 @@ function hasReactDomEdgeServerBuild(root) {
|
|
|
1296
1223
|
try {
|
|
1297
1224
|
_module.createRequire.call(void 0, _path2.default.join(root, "package.json")).resolve("react-dom/server.edge");
|
|
1298
1225
|
return true;
|
|
1299
|
-
} catch (
|
|
1226
|
+
} catch (e13) {
|
|
1300
1227
|
return false;
|
|
1301
1228
|
}
|
|
1302
1229
|
}
|
|
@@ -1348,7 +1275,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
1348
1275
|
return {
|
|
1349
1276
|
name: "farm-metadata-image-wasm",
|
|
1350
1277
|
resolveId(source, importer) {
|
|
1351
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
1278
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _17 => _17.replace, 'call', _18 => _18(/\\/g, "/"), 'access', _19 => _19.includes, 'call', _20 => _20("/@vercel/og/")])) {
|
|
1352
1279
|
return null;
|
|
1353
1280
|
}
|
|
1354
1281
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -1474,9 +1401,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
1474
1401
|
if (needsAst) {
|
|
1475
1402
|
replacements.length = 0;
|
|
1476
1403
|
const restore = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (node) => {
|
|
1477
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
1404
|
+
if (_optionalChain([node, 'optionalAccess', _21 => _21.type]) !== "TemplateLiteral") return;
|
|
1478
1405
|
const template = node;
|
|
1479
|
-
const value = _optionalChain([template, 'access',
|
|
1406
|
+
const value = _optionalChain([template, 'access', _22 => _22.quasis, 'access', _23 => _23[0], 'optionalAccess', _24 => _24.value, 'access', _25 => _25.cooked]);
|
|
1480
1407
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
1481
1408
|
replacements.push({
|
|
1482
1409
|
start: template.start,
|
|
@@ -1528,7 +1455,7 @@ function trimSlashes(value) {
|
|
|
1528
1455
|
}
|
|
1529
1456
|
_chunkS3JO3N4Hcjs.__name.call(void 0, trimSlashes, "trimSlashes");
|
|
1530
1457
|
function resolveBuildDocsContentDir(config, root) {
|
|
1531
|
-
if (!_optionalChain([config, 'access',
|
|
1458
|
+
if (!_optionalChain([config, 'access', _26 => _26.docs, 'optionalAccess', _27 => _27.enabled])) return null;
|
|
1532
1459
|
const configuredContentDir = config.docs.contentDir || config.docs.config.contentDir;
|
|
1533
1460
|
if (typeof configuredContentDir === "string" && configuredContentDir.trim()) {
|
|
1534
1461
|
const contentDir = _path2.default.isAbsolute(configuredContentDir) ? configuredContentDir : _path2.default.join(root, configuredContentDir);
|
|
@@ -1560,14 +1487,14 @@ function hasProjectPostcssConfig(root) {
|
|
|
1560
1487
|
try {
|
|
1561
1488
|
projectRequire.resolve(`./${file}`);
|
|
1562
1489
|
return true;
|
|
1563
|
-
} catch (
|
|
1490
|
+
} catch (e14) {
|
|
1564
1491
|
return false;
|
|
1565
1492
|
}
|
|
1566
1493
|
});
|
|
1567
1494
|
}
|
|
1568
1495
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasProjectPostcssConfig, "hasProjectPostcssConfig");
|
|
1569
1496
|
async function findFarmConfigPath(root) {
|
|
1570
|
-
const
|
|
1497
|
+
const fs3 = await import("fs/promises");
|
|
1571
1498
|
const candidates = [
|
|
1572
1499
|
"farm.config.ts",
|
|
1573
1500
|
"farm.config.mts",
|
|
@@ -1581,26 +1508,17 @@ async function findFarmConfigPath(root) {
|
|
|
1581
1508
|
for (const candidate of candidates) {
|
|
1582
1509
|
const resolvedPath = _path2.default.join(root, candidate);
|
|
1583
1510
|
try {
|
|
1584
|
-
await
|
|
1511
|
+
await fs3.access(resolvedPath);
|
|
1585
1512
|
return resolvedPath;
|
|
1586
|
-
} catch (
|
|
1513
|
+
} catch (e15) {
|
|
1587
1514
|
}
|
|
1588
1515
|
}
|
|
1589
1516
|
return null;
|
|
1590
1517
|
}
|
|
1591
1518
|
_chunkS3JO3N4Hcjs.__name.call(void 0, findFarmConfigPath, "findFarmConfigPath");
|
|
1592
|
-
function hasFarmMiddlewareConfig(config) {
|
|
1593
|
-
if (!config) return false;
|
|
1594
|
-
if (Array.isArray(config)) return config.length > 0;
|
|
1595
|
-
const configRecord = config;
|
|
1596
|
-
return Boolean(
|
|
1597
|
-
configRecord.matcher || configRecord.exclude || configRecord.runtime || configRecord.handler || Array.isArray(configRecord.handlers) && configRecord.handlers.length > 0
|
|
1598
|
-
);
|
|
1599
|
-
}
|
|
1600
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmMiddlewareConfig, "hasFarmMiddlewareConfig");
|
|
1601
1519
|
function hasFarmServerRuntimePlugins(config) {
|
|
1602
1520
|
return (config.plugins || []).some((plugin) => {
|
|
1603
|
-
if (
|
|
1521
|
+
if (_chunkVU6AAZVYcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
|
|
1604
1522
|
return Boolean(
|
|
1605
1523
|
plugin.setup || plugin.init || plugin.ready || plugin.shutdown || plugin.runtime || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML
|
|
1606
1524
|
);
|
|
@@ -1613,19 +1531,19 @@ function hasFarmPluginRoutes(config) {
|
|
|
1613
1531
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
|
|
1614
1532
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1615
1533
|
return (config.plugins || []).some(
|
|
1616
|
-
(plugin) =>
|
|
1534
|
+
(plugin) => _chunkVU6AAZVYcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkYR2VBEMOcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1617
1535
|
);
|
|
1618
1536
|
}
|
|
1619
1537
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
|
|
1620
1538
|
async function discoverMiddlewareRoutes(appDir) {
|
|
1621
|
-
const
|
|
1539
|
+
const fs3 = await import("fs/promises");
|
|
1622
1540
|
const appDirs = Array.isArray(appDir) ? [...appDir] : [appDir];
|
|
1623
1541
|
const routes = /* @__PURE__ */ new Map();
|
|
1624
1542
|
async function walk(dir, routePath, directory, discovered) {
|
|
1625
1543
|
let entries;
|
|
1626
1544
|
try {
|
|
1627
|
-
entries = await
|
|
1628
|
-
} catch (
|
|
1545
|
+
entries = await fs3.readdir(dir, { withFileTypes: true });
|
|
1546
|
+
} catch (e16) {
|
|
1629
1547
|
return;
|
|
1630
1548
|
}
|
|
1631
1549
|
const middlewareFile = entries.find(
|
|
@@ -1644,8 +1562,8 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1644
1562
|
}
|
|
1645
1563
|
await walk(
|
|
1646
1564
|
_path2.default.join(dir, entry.name),
|
|
1647
|
-
|
|
1648
|
-
|
|
1565
|
+
_chunkKCQBAKIYcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name),
|
|
1566
|
+
_chunkKCQBAKIYcjs.appendMiddlewareDirectory.call(void 0, directory, entry.name),
|
|
1649
1567
|
discovered
|
|
1650
1568
|
);
|
|
1651
1569
|
}
|
|
@@ -1658,11 +1576,11 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1658
1576
|
routes.set(route.directory, route);
|
|
1659
1577
|
}
|
|
1660
1578
|
}
|
|
1661
|
-
return Array.from(routes.values()).sort(
|
|
1579
|
+
return Array.from(routes.values()).sort(_chunkKCQBAKIYcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
1662
1580
|
}
|
|
1663
1581
|
_chunkS3JO3N4Hcjs.__name.call(void 0, discoverMiddlewareRoutes, "discoverMiddlewareRoutes");
|
|
1664
1582
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
1665
|
-
if (!_optionalChain([config, 'access',
|
|
1583
|
+
if (!_optionalChain([config, 'access', _28 => _28.docs, 'optionalAccess', _29 => _29.enabled]) || !_optionalChain([config, 'access', _30 => _30.docs, 'access', _31 => _31.adapter, 'optionalAccess', _32 => _32.server]) || _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
1666
1584
|
return;
|
|
1667
1585
|
}
|
|
1668
1586
|
throw new Error(
|
|
@@ -1676,7 +1594,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1676
1594
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1677
1595
|
const srcDir = config.srcDir || "src";
|
|
1678
1596
|
const distDir = config.distDir || ".farm";
|
|
1679
|
-
const deployOutputDir =
|
|
1597
|
+
const deployOutputDir = _chunkQ3NXS4MUcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1680
1598
|
const lifecyclePluginManager = options.pluginManager;
|
|
1681
1599
|
const productionViteResultPromise = Promise.allSettled([
|
|
1682
1600
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -1695,7 +1613,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1695
1613
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
1696
1614
|
const pageRoutes = [];
|
|
1697
1615
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
1698
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
1616
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkEKN7NSZOcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
1699
1617
|
pageRoutes.push({
|
|
1700
1618
|
pattern,
|
|
1701
1619
|
...entry.directory ? { directory: entry.directory } : {},
|
|
@@ -1720,12 +1638,12 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1720
1638
|
})
|
|
1721
1639
|
);
|
|
1722
1640
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found ${pageRoutes.length} page routes`);
|
|
1723
|
-
const
|
|
1641
|
+
const fs3 = await import("fs/promises");
|
|
1724
1642
|
const layoutRoutes = [];
|
|
1725
1643
|
const appDir = _path2.default.join(root, srcDir, "app");
|
|
1726
1644
|
async function findLayoutsForClient(dir, routePrefix = "/") {
|
|
1727
1645
|
try {
|
|
1728
|
-
const entries = await
|
|
1646
|
+
const entries = await fs3.readdir(dir, { withFileTypes: true });
|
|
1729
1647
|
for (const entry of entries) {
|
|
1730
1648
|
if (entry.isFile() && entry.name.match(/^layout\.(tsx?|jsx?|vue|svelte)$/)) {
|
|
1731
1649
|
layoutRoutes.push({
|
|
@@ -1737,7 +1655,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1737
1655
|
await findLayoutsForClient(_path2.default.join(dir, entry.name), childPrefix);
|
|
1738
1656
|
}
|
|
1739
1657
|
}
|
|
1740
|
-
} catch (
|
|
1658
|
+
} catch (e17) {
|
|
1741
1659
|
}
|
|
1742
1660
|
}
|
|
1743
1661
|
_chunkS3JO3N4Hcjs.__name.call(void 0, findLayoutsForClient, "findLayoutsForClient");
|
|
@@ -1878,12 +1796,12 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1878
1796
|
_chunk5QIKR7RRcjs.logger.error(`\u274C Build failed: ${error}`);
|
|
1879
1797
|
throw error;
|
|
1880
1798
|
} finally {
|
|
1881
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
1799
|
+
_optionalChain([rendererBuild, 'optionalAccess', _33 => _33.abort, 'call', _34 => _34()]);
|
|
1882
1800
|
}
|
|
1883
1801
|
}
|
|
1884
1802
|
_chunkS3JO3N4Hcjs.__name.call(void 0, buildUniversal, "buildUniversal");
|
|
1885
1803
|
async function writeSSRAssetsToClient(bundle, outputDir) {
|
|
1886
|
-
const
|
|
1804
|
+
const fs3 = await import("fs/promises");
|
|
1887
1805
|
for (const [fileName, output] of Object.entries(bundle)) {
|
|
1888
1806
|
if (output.type !== "asset") continue;
|
|
1889
1807
|
if (fileName === "farm-fonts.css") {
|
|
@@ -1891,42 +1809,42 @@ async function writeSSRAssetsToClient(bundle, outputDir) {
|
|
|
1891
1809
|
continue;
|
|
1892
1810
|
}
|
|
1893
1811
|
const filePath = _path2.default.join(outputDir, fileName);
|
|
1894
|
-
await
|
|
1895
|
-
await
|
|
1812
|
+
await fs3.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
1813
|
+
await fs3.writeFile(filePath, output.source);
|
|
1896
1814
|
}
|
|
1897
1815
|
}
|
|
1898
1816
|
_chunkS3JO3N4Hcjs.__name.call(void 0, writeSSRAssetsToClient, "writeSSRAssetsToClient");
|
|
1899
1817
|
async function copyFarmDocsFontAssetsToClient(root, outputDir) {
|
|
1900
|
-
const
|
|
1818
|
+
const fs3 = await import("fs/promises");
|
|
1901
1819
|
await Promise.all(
|
|
1902
1820
|
_chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, root).map(async ({ sourcePath, url }) => {
|
|
1903
1821
|
const targetPath = _path2.default.join(outputDir, url.replace(/^\/+/, ""));
|
|
1904
|
-
await
|
|
1905
|
-
await
|
|
1822
|
+
await fs3.mkdir(_path2.default.dirname(targetPath), { recursive: true });
|
|
1823
|
+
await fs3.copyFile(sourcePath, targetPath);
|
|
1906
1824
|
})
|
|
1907
1825
|
);
|
|
1908
1826
|
}
|
|
1909
1827
|
_chunkS3JO3N4Hcjs.__name.call(void 0, copyFarmDocsFontAssetsToClient, "copyFarmDocsFontAssetsToClient");
|
|
1910
1828
|
async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
1911
|
-
const
|
|
1829
|
+
const fs3 = await import("fs/promises");
|
|
1912
1830
|
const fontCssPath = _path2.default.join(outputDir, "farm-fonts.css");
|
|
1913
1831
|
let fontCss = fontCssSource;
|
|
1914
1832
|
if (fontCss === void 0) {
|
|
1915
1833
|
try {
|
|
1916
|
-
fontCss = await
|
|
1917
|
-
} catch (
|
|
1834
|
+
fontCss = await fs3.readFile(fontCssPath);
|
|
1835
|
+
} catch (e18) {
|
|
1918
1836
|
return;
|
|
1919
1837
|
}
|
|
1920
1838
|
}
|
|
1921
1839
|
const clientCssPath = _path2.default.join(outputDir, "farm-client.css");
|
|
1922
1840
|
let clientCss = "";
|
|
1923
1841
|
try {
|
|
1924
|
-
clientCss = await
|
|
1925
|
-
} catch (
|
|
1842
|
+
clientCss = await fs3.readFile(clientCssPath, "utf8");
|
|
1843
|
+
} catch (e19) {
|
|
1926
1844
|
}
|
|
1927
1845
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
1928
|
-
await
|
|
1929
|
-
await
|
|
1846
|
+
await fs3.writeFile(fontCssPath, normalizedFontCss);
|
|
1847
|
+
await fs3.writeFile(clientCssPath, _chunkYR2VBEMOcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
1930
1848
|
}
|
|
1931
1849
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
|
|
1932
1850
|
var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
|
|
@@ -1938,14 +1856,14 @@ var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError
|
|
|
1938
1856
|
_chunkS3JO3N4Hcjs.__name.call(void 0, _IncompleteClientBuildOutputError, "IncompleteClientBuildOutputError");
|
|
1939
1857
|
var IncompleteClientBuildOutputError = _IncompleteClientBuildOutputError;
|
|
1940
1858
|
async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
1941
|
-
const
|
|
1859
|
+
const fs3 = await import("fs/promises");
|
|
1942
1860
|
const fingerprinted = await findFingerprintedClientEntry(outputDir);
|
|
1943
1861
|
const clientEntryPath = _path2.default.join(outputDir, _nullishCoalesce(fingerprinted, () => ( "farm-client.js")));
|
|
1944
1862
|
let clientEntrySize = 0;
|
|
1945
1863
|
try {
|
|
1946
|
-
const clientEntry = await
|
|
1864
|
+
const clientEntry = await fs3.stat(clientEntryPath);
|
|
1947
1865
|
if (clientEntry.isFile()) clientEntrySize = clientEntry.size;
|
|
1948
|
-
} catch (
|
|
1866
|
+
} catch (e20) {
|
|
1949
1867
|
}
|
|
1950
1868
|
if (clientEntrySize === 0) {
|
|
1951
1869
|
throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
|
|
@@ -1954,12 +1872,12 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
1954
1872
|
const globalsCssPath = _path2.default.join(root, srcDir, "app", "globals.css");
|
|
1955
1873
|
let expectsCss = false;
|
|
1956
1874
|
try {
|
|
1957
|
-
const globalsCss = await
|
|
1875
|
+
const globalsCss = await fs3.readFile(globalsCssPath, "utf8");
|
|
1958
1876
|
expectsCss = globalsCss.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
|
|
1959
|
-
} catch (
|
|
1877
|
+
} catch (e21) {
|
|
1960
1878
|
}
|
|
1961
1879
|
try {
|
|
1962
|
-
const clientCss = await
|
|
1880
|
+
const clientCss = await fs3.stat(clientCssPath);
|
|
1963
1881
|
if (expectsCss && (!clientCss.isFile() || clientCss.size === 0)) {
|
|
1964
1882
|
throw new IncompleteClientBuildOutputError("farm-client.css is empty");
|
|
1965
1883
|
}
|
|
@@ -1968,7 +1886,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
1968
1886
|
if (expectsCss) {
|
|
1969
1887
|
throw new IncompleteClientBuildOutputError("farm-client.css is missing");
|
|
1970
1888
|
}
|
|
1971
|
-
await
|
|
1889
|
+
await fs3.writeFile(clientCssPath, "");
|
|
1972
1890
|
}
|
|
1973
1891
|
}
|
|
1974
1892
|
_chunkS3JO3N4Hcjs.__name.call(void 0, validateClientBuildOutput, "validateClientBuildOutput");
|
|
@@ -1976,7 +1894,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
1976
1894
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
|
|
1977
1895
|
let plan = cache.get(key);
|
|
1978
1896
|
if (!plan) {
|
|
1979
|
-
plan =
|
|
1897
|
+
plan = _chunkYR2VBEMOcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
1980
1898
|
cache.set(key, plan);
|
|
1981
1899
|
}
|
|
1982
1900
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -1986,7 +1904,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1986
1904
|
const viteBuild = productionVite.build;
|
|
1987
1905
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
1988
1906
|
const { PluginManager: PluginManager2 } = await import("./plugin.cjs");
|
|
1989
|
-
const
|
|
1907
|
+
const fs3 = await import("fs/promises");
|
|
1990
1908
|
const pluginManager = new PluginManager2({
|
|
1991
1909
|
config,
|
|
1992
1910
|
isDev: false,
|
|
@@ -1994,25 +1912,25 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1994
1912
|
});
|
|
1995
1913
|
pluginManager.addPlugins(config.plugins || []);
|
|
1996
1914
|
const clientPages = [];
|
|
1997
|
-
const integrationProviders =
|
|
1915
|
+
const integrationProviders = _chunkVU6AAZVYcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
|
|
1998
1916
|
(provider) => provider.component || provider.type === "clerk"
|
|
1999
1917
|
);
|
|
2000
1918
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2001
1919
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2002
1920
|
);
|
|
2003
|
-
if (_optionalChain([config, 'access',
|
|
1921
|
+
if (_optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]) === "enabled" && _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents]) !== true && unsupportedIntegrationProvider) {
|
|
2004
1922
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
2005
1923
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2006
1924
|
);
|
|
2007
1925
|
}
|
|
2008
|
-
const isolatedMode =
|
|
2009
|
-
_optionalChain([config, 'access',
|
|
1926
|
+
const isolatedMode = _chunkYR2VBEMOcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
1927
|
+
_optionalChain([config, 'access', _39 => _39.experimental, 'optionalAccess', _40 => _40.isolatedClientHydration]),
|
|
2010
1928
|
{
|
|
2011
|
-
serverComponents: _optionalChain([config, 'access',
|
|
1929
|
+
serverComponents: _optionalChain([config, 'access', _41 => _41.experimental, 'optionalAccess', _42 => _42.serverComponents]) === true,
|
|
2012
1930
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2013
1931
|
}
|
|
2014
1932
|
);
|
|
2015
|
-
const planOptions =
|
|
1933
|
+
const planOptions = _chunkYR2VBEMOcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2016
1934
|
config.renderer,
|
|
2017
1935
|
Boolean(unsupportedIntegrationProvider)
|
|
2018
1936
|
);
|
|
@@ -2059,18 +1977,18 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2059
1977
|
};
|
|
2060
1978
|
}
|
|
2061
1979
|
});
|
|
2062
|
-
const layoutAppliesToRoute =
|
|
1980
|
+
const layoutAppliesToRoute = _chunk2DD4JMQCcjs.routeBoundaryCoversDirectory;
|
|
2063
1981
|
const routeDirectory = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (route) => _nullishCoalesce(route.directory, () => ( route.pattern)), "routeDirectory");
|
|
2064
1982
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2065
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
1983
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _43 => _43.docs, 'optionalAccess', _44 => _44.enabled]) && _optionalChain([config, 'access', _45 => _45.docs, 'access', _46 => _46.adapter, 'optionalAccess', _47 => _47.server]) && config.docs.adapter.react
|
|
2066
1984
|
);
|
|
2067
|
-
const adapterDocsEntry = _optionalChain([config, 'access',
|
|
1985
|
+
const adapterDocsEntry = _optionalChain([config, 'access', _48 => _48.docs, 'optionalAccess', _49 => _49.enabled]) ? `/${config.docs.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/" : null;
|
|
2068
1986
|
const isAdapterDocsRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (routePattern) => Boolean(
|
|
2069
1987
|
adapterOwnsDocsRuntime && adapterDocsEntry && (adapterDocsEntry === "/" || routePattern === adapterDocsEntry || routePattern.startsWith(`${adapterDocsEntry}/`))
|
|
2070
1988
|
), "isAdapterDocsRoute");
|
|
2071
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
1989
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _50 => _50.docs, 'optionalAccess', _51 => _51.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2072
1990
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2073
|
-
const markdownPagePlan =
|
|
1991
|
+
const markdownPagePlan = _chunkYR2VBEMOcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2074
1992
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2075
1993
|
root,
|
|
2076
1994
|
isolatedMode,
|
|
@@ -2078,7 +1996,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2078
1996
|
);
|
|
2079
1997
|
const routePlans = pageRoutes.map((route) => ({
|
|
2080
1998
|
route,
|
|
2081
|
-
metadata:
|
|
1999
|
+
metadata: _chunkEKN7NSZOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2082
2000
|
route.modulePath,
|
|
2083
2001
|
root,
|
|
2084
2002
|
isolatedMode,
|
|
@@ -2086,7 +2004,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2086
2004
|
planOptions
|
|
2087
2005
|
)
|
|
2088
2006
|
}));
|
|
2089
|
-
|
|
2007
|
+
_chunkYR2VBEMOcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2090
2008
|
clientLayouts.map((layout) => ({
|
|
2091
2009
|
pattern: layout.pattern,
|
|
2092
2010
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2095,7 +2013,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2095
2013
|
[
|
|
2096
2014
|
...routePlans.map(({ route, metadata }) => ({
|
|
2097
2015
|
pattern: routeDirectory(route),
|
|
2098
|
-
depth:
|
|
2016
|
+
depth: _chunk2DD4JMQCcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
2099
2017
|
metadata
|
|
2100
2018
|
})),
|
|
2101
2019
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -2118,7 +2036,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2118
2036
|
for (const layout of clientLayouts) {
|
|
2119
2037
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
|
|
2120
2038
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2121
|
-
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${
|
|
2039
|
+
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkYR2VBEMOcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2122
2040
|
}
|
|
2123
2041
|
}
|
|
2124
2042
|
if (isolatedMode === "analyze") {
|
|
@@ -2142,7 +2060,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2142
2060
|
);
|
|
2143
2061
|
if (metadata.suppressedAsyncHydration) {
|
|
2144
2062
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
2145
|
-
`\u26A0\uFE0F ${
|
|
2063
|
+
`\u26A0\uFE0F ${_chunkYR2VBEMOcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2146
2064
|
);
|
|
2147
2065
|
}
|
|
2148
2066
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2167,7 +2085,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2167
2085
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries).flatMap((layout) => layout.isolatedBoundaries)
|
|
2168
2086
|
],
|
|
2169
2087
|
// The server renders a server tree only below a hydrating layout.
|
|
2170
|
-
...
|
|
2088
|
+
..._chunkYR2VBEMOcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2171
2089
|
});
|
|
2172
2090
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2173
2091
|
}
|
|
@@ -2203,7 +2121,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2203
2121
|
}
|
|
2204
2122
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2205
2123
|
try {
|
|
2206
|
-
return
|
|
2124
|
+
return _chunkYR2VBEMOcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2207
2125
|
} catch (error) {
|
|
2208
2126
|
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2209
2127
|
return false;
|
|
@@ -2213,8 +2131,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2213
2131
|
`\u{1F4F1} Total hydratable routes detected: ${clientPages.length} pages, ${clientLayouts.filter((layout) => layout.shouldHydrate || layout.hasIsolatedClientBoundaries).length} layouts, and ${clientRouteSlots.length} slots`
|
|
2214
2132
|
);
|
|
2215
2133
|
const clientEntryRoot = _path2.default.join(root, ".farm", "tmp");
|
|
2216
|
-
await
|
|
2217
|
-
const clientEntryDir = await
|
|
2134
|
+
await fs3.mkdir(clientEntryRoot, { recursive: true });
|
|
2135
|
+
const clientEntryDir = await fs3.mkdtemp(_path2.default.join(clientEntryRoot, "client-entry-"));
|
|
2218
2136
|
const clientEntryPath = _path2.default.join(clientEntryDir, "farm-client-entry.tsx");
|
|
2219
2137
|
const clientHydrationCode = generateClientHydrationEntry(
|
|
2220
2138
|
clientPages,
|
|
@@ -2224,19 +2142,19 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2224
2142
|
srcDir,
|
|
2225
2143
|
adapterOwnsDocsRuntime ? false : _chunkMWWVKDW3cjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2226
2144
|
adapterOwnsDocsRuntime ? void 0 : _chunkMWWVKDW3cjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2227
|
-
_optionalChain([config, 'access',
|
|
2228
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access',
|
|
2145
|
+
_optionalChain([config, 'access', _52 => _52.docs, 'optionalAccess', _53 => _53.enabled]) ? config.docs.entry : void 0,
|
|
2146
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _54 => _54.docs, 'access', _55 => _55.adapter, 'optionalAccess', _56 => _56.react]) : void 0,
|
|
2229
2147
|
config.i18n,
|
|
2230
2148
|
config.plugins,
|
|
2231
2149
|
config.renderer,
|
|
2232
2150
|
config.publicRuntimeConfig,
|
|
2233
2151
|
config.trailingSlash,
|
|
2234
|
-
|
|
2152
|
+
_chunkVU6AAZVYcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2235
2153
|
config.basePath,
|
|
2236
|
-
|
|
2237
|
-
adapterOwnsDocsRuntime ?
|
|
2154
|
+
_chunkYR2VBEMOcjs.generateClientCachePersistenceCode.call(void 0, _chunkYR2VBEMOcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2155
|
+
adapterOwnsDocsRuntime ? _chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2238
2156
|
);
|
|
2239
|
-
await
|
|
2157
|
+
await fs3.writeFile(clientEntryPath, clientHydrationCode);
|
|
2240
2158
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2241
2159
|
let postcssSearchPath;
|
|
2242
2160
|
let tailwindVitePlugin = void 0;
|
|
@@ -2248,9 +2166,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2248
2166
|
_chunk5QIKR7RRcjs.logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
2249
2167
|
} else {
|
|
2250
2168
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2251
|
-
await
|
|
2169
|
+
await fs3.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2252
2170
|
postcssSearchPath = clientEntryDir;
|
|
2253
|
-
tailwindVitePlugin = await
|
|
2171
|
+
tailwindVitePlugin = await _chunkYR2VBEMOcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2254
2172
|
builder: productionVite.builder,
|
|
2255
2173
|
announce: true
|
|
2256
2174
|
});
|
|
@@ -2283,7 +2201,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2283
2201
|
hashCharacters: "hex",
|
|
2284
2202
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2285
2203
|
assetFileNames: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (assetInfo) => {
|
|
2286
|
-
if (_optionalChain([assetInfo, 'access',
|
|
2204
|
+
if (_optionalChain([assetInfo, 'access', _57 => _57.name, 'optionalAccess', _58 => _58.endsWith, 'call', _59 => _59(".css")])) {
|
|
2287
2205
|
return "farm-client.css";
|
|
2288
2206
|
}
|
|
2289
2207
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -2319,13 +2237,30 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2319
2237
|
}
|
|
2320
2238
|
},
|
|
2321
2239
|
plugins: [
|
|
2322
|
-
|
|
2240
|
+
_chunkYR2VBEMOcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2241
|
+
createFarmClientModulePreloadPlugin({
|
|
2242
|
+
root,
|
|
2243
|
+
buildDir: _path2.default.dirname(outputDir),
|
|
2244
|
+
entryName: "farm-client"
|
|
2245
|
+
}),
|
|
2246
|
+
...adapterOwnsDocsRuntime ? [
|
|
2247
|
+
createFarmDocsModulePreloadPlugin({
|
|
2248
|
+
root,
|
|
2249
|
+
buildDir: _path2.default.dirname(outputDir),
|
|
2250
|
+
importer: clientEntryPath,
|
|
2251
|
+
entryName: "farm-client",
|
|
2252
|
+
modules: [
|
|
2253
|
+
config.docs.adapter.react,
|
|
2254
|
+
_chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
|
|
2255
|
+
].filter((specifier) => Boolean(specifier))
|
|
2256
|
+
})
|
|
2257
|
+
] : [],
|
|
2323
2258
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
2324
2259
|
...rendererVitePlugins,
|
|
2325
2260
|
...config.vite.plugins || [],
|
|
2326
2261
|
farmServerOnlyEntriesPlugin(),
|
|
2327
|
-
|
|
2328
|
-
adapterOwnsDocsRuntime ?
|
|
2262
|
+
_chunkYR2VBEMOcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2263
|
+
adapterOwnsDocsRuntime ? _chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2329
2264
|
),
|
|
2330
2265
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
2331
2266
|
{
|
|
@@ -2383,7 +2318,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2383
2318
|
} : void 0,
|
|
2384
2319
|
// Ensure React is bundled for client
|
|
2385
2320
|
resolve: {
|
|
2386
|
-
alias:
|
|
2321
|
+
alias: _chunkYR2VBEMOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2387
2322
|
dedupe: [...config.renderer.dedupe || []]
|
|
2388
2323
|
},
|
|
2389
2324
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2396,13 +2331,13 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2396
2331
|
]
|
|
2397
2332
|
}
|
|
2398
2333
|
};
|
|
2399
|
-
await viteBuild(
|
|
2334
|
+
await viteBuild(_chunkYR2VBEMOcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2400
2335
|
await mergeBuiltFontCss(outputDir);
|
|
2401
2336
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2402
2337
|
} finally {
|
|
2403
2338
|
try {
|
|
2404
|
-
await
|
|
2405
|
-
} catch (
|
|
2339
|
+
await fs3.rm(clientEntryDir, { recursive: true, force: true });
|
|
2340
|
+
} catch (e22) {
|
|
2406
2341
|
}
|
|
2407
2342
|
}
|
|
2408
2343
|
}
|
|
@@ -3155,7 +3090,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3155
3090
|
direction: {}
|
|
3156
3091
|
}, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
3157
3092
|
const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
|
|
3158
|
-
const clientPluginEntry =
|
|
3093
|
+
const clientPluginEntry = _chunkYR2VBEMOcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3159
3094
|
plugins,
|
|
3160
3095
|
root,
|
|
3161
3096
|
srcDir,
|
|
@@ -3166,7 +3101,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3166
3101
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3167
3102
|
import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3168
3103
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3169
|
-
const providerClientCode =
|
|
3104
|
+
const providerClientCode = _chunkYR2VBEMOcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3170
3105
|
integrationProviders,
|
|
3171
3106
|
root,
|
|
3172
3107
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3175,15 +3110,17 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
|
|
|
3175
3110
|
const cssImport = _fs.existsSync.call(void 0, globalsCssPath) ? `import ${JSON.stringify(toImportPath(globalsCssPath))};` : "";
|
|
3176
3111
|
const layoutImportStatements = [];
|
|
3177
3112
|
const layoutRegistrations = [];
|
|
3113
|
+
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
3178
3114
|
layoutRoutes.forEach((layout, index) => {
|
|
3179
3115
|
const relativePath = toImportPath(layout.modulePath);
|
|
3180
|
-
|
|
3116
|
+
const rendersOnClient = !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some((pattern) => _chunk4E5QXOCLcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern));
|
|
3117
|
+
if (rendersOnClient) {
|
|
3181
3118
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
3182
3119
|
}
|
|
3183
|
-
const groupScope =
|
|
3184
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
3120
|
+
const groupScope = _chunk2DD4JMQCcjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
3121
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunk2DD4JMQCcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
3185
3122
|
layoutRegistrations.push(
|
|
3186
|
-
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${
|
|
3123
|
+
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
|
|
3187
3124
|
);
|
|
3188
3125
|
});
|
|
3189
3126
|
const layoutImports = layoutImportStatements.join("\n");
|
|
@@ -3231,7 +3168,7 @@ function isFarmDocsPath() {
|
|
|
3231
3168
|
return false;
|
|
3232
3169
|
}
|
|
3233
3170
|
`;
|
|
3234
|
-
const docsAdapterRuntime =
|
|
3171
|
+
const docsAdapterRuntime = _chunkCY2ZQ5C6cjs.generateFarmDocsAdapterClientRuntime.call(void 0,
|
|
3235
3172
|
docsAdapterReact,
|
|
3236
3173
|
docsConfigModule
|
|
3237
3174
|
);
|
|
@@ -3684,7 +3621,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3684
3621
|
});
|
|
3685
3622
|
}
|
|
3686
3623
|
|
|
3687
|
-
${
|
|
3624
|
+
${_chunkYR2VBEMOcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
3688
3625
|
// Wrap a page element with applicable layouts
|
|
3689
3626
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
3690
3627
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4643,7 +4580,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4643
4580
|
const viteBuild = productionVite.build;
|
|
4644
4581
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
4645
4582
|
const { PluginManager: PluginManager2 } = await import("./plugin.cjs");
|
|
4646
|
-
const
|
|
4583
|
+
const fs3 = await import("fs/promises");
|
|
4647
4584
|
const pluginManager = new PluginManager2({
|
|
4648
4585
|
config,
|
|
4649
4586
|
isDev: false,
|
|
@@ -4658,12 +4595,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4658
4595
|
buildLifetime: rendererBuildLifetime
|
|
4659
4596
|
});
|
|
4660
4597
|
if (!hasScopedPostcssConfig) {
|
|
4661
|
-
postcssConfigDir = await
|
|
4662
|
-
await
|
|
4598
|
+
postcssConfigDir = await fs3.mkdtemp(_path2.default.join(_os2.default.tmpdir(), "farm-postcss-"));
|
|
4599
|
+
await fs3.writeFile(
|
|
4663
4600
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
4664
4601
|
"module.exports = { plugins: [] };\n"
|
|
4665
4602
|
);
|
|
4666
|
-
tailwindVitePlugin = await
|
|
4603
|
+
tailwindVitePlugin = await _chunkYR2VBEMOcjs.loadTailwindVitePlugin.call(void 0, {
|
|
4667
4604
|
builder: productionVite.builder,
|
|
4668
4605
|
label: "for SSR"
|
|
4669
4606
|
});
|
|
@@ -4685,7 +4622,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4685
4622
|
fileName: entry.fileName,
|
|
4686
4623
|
sourceType: "static",
|
|
4687
4624
|
staticInfo: entry.staticInfo,
|
|
4688
|
-
data: (await
|
|
4625
|
+
data: (await fs3.readFile(entry.modulePath)).toString("base64")
|
|
4689
4626
|
});
|
|
4690
4627
|
continue;
|
|
4691
4628
|
}
|
|
@@ -4759,7 +4696,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4759
4696
|
}
|
|
4760
4697
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
4761
4698
|
const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
4762
|
-
const notFoundPath =
|
|
4699
|
+
const notFoundPath = _chunkYR2VBEMOcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
4763
4700
|
if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
4764
4701
|
layoutRoutes.sort((a, b) => {
|
|
4765
4702
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -4776,13 +4713,13 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4776
4713
|
const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
|
|
4777
4714
|
(integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
|
|
4778
4715
|
);
|
|
4779
|
-
const hasIntegrationProviders =
|
|
4716
|
+
const hasIntegrationProviders = _chunkVU6AAZVYcjs.getIntegrationProviders.call(void 0, config.integrations).some(
|
|
4780
4717
|
(provider) => provider.component || provider.type === "clerk"
|
|
4781
4718
|
);
|
|
4782
4719
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
4783
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
4784
|
-
const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
|
|
4785
|
-
const hasRouteContextConfig =
|
|
4720
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _60 => _60.mdx, 'optionalAccess', _61 => _61.components]));
|
|
4721
|
+
const hasMiddlewareConfig = _chunk2DD4JMQCcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
4722
|
+
const hasRouteContextConfig = _chunkQ3NXS4MUcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
4786
4723
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
4787
4724
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
4788
4725
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -4792,20 +4729,39 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4792
4729
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
4793
4730
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
4794
4731
|
);
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4732
|
+
if (_chunk4IE345DMcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
4733
|
+
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
4734
|
+
_chunk4IE345DMcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
4735
|
+
config.docs,
|
|
4736
|
+
{ root, srcDir: config.srcDir },
|
|
4737
|
+
(pathname) => adapterGuardedPaths.has(pathname)
|
|
4738
|
+
);
|
|
4739
|
+
}
|
|
4740
|
+
const farmDocsCspNonceMarker = _chunk2ZYGC6SScjs.createFarmCspNonce.call(void 0, config.security);
|
|
4741
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _62 => _62.docs, 'optionalAccess', _63 => _63.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunk6XWDE2P2cjs._runWithFarmCspNonce.call(void 0,
|
|
4742
|
+
farmDocsCspNonceMarker,
|
|
4743
|
+
async () => _optionalChain([config, 'access', _64 => _64.docs, 'access', _65 => _65.adapter, 'optionalAccess', _66 => _66.server]) ? await _chunk4IE345DMcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
4744
|
+
root,
|
|
4745
|
+
srcDir: config.srcDir,
|
|
4746
|
+
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
4747
|
+
fontStylesheetHref: "/farm-fonts.css",
|
|
4748
|
+
globalStylesheetHref: "/assets/globals.css"
|
|
4749
|
+
}) : await (async () => {
|
|
4750
|
+
const guardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
4751
|
+
return compileFarmDocsManifest(config.docs, {
|
|
4752
|
+
root,
|
|
4753
|
+
srcDir: config.srcDir,
|
|
4754
|
+
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
4755
|
+
fontAssets: _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, root)),
|
|
4756
|
+
fontStylesheetHref: "/farm-fonts.css",
|
|
4757
|
+
globalStylesheetHref: "/assets/globals.css",
|
|
4758
|
+
isPathGuarded: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (pathname) => guardedPaths.has(pathname), "isPathGuarded")
|
|
4759
|
+
});
|
|
4760
|
+
})()
|
|
4761
|
+
) : null;
|
|
4762
|
+
if (farmDocsPrecompiledManifest && farmDocsCspNonceMarker) {
|
|
4763
|
+
farmDocsPrecompiledManifest.cspNonceMarker = farmDocsCspNonceMarker;
|
|
4764
|
+
}
|
|
4809
4765
|
const virtualEntryCode = generateVirtualEntryCode(
|
|
4810
4766
|
apiRoutes,
|
|
4811
4767
|
pageRoutes,
|
|
@@ -4889,7 +4845,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4889
4845
|
// Adapters can render provider scripts by serializing function source.
|
|
4890
4846
|
// keepNames injects helper calls into those functions; after Nitro
|
|
4891
4847
|
// minifies the server chunk the helper is no longer in script scope.
|
|
4892
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
4848
|
+
keepNames: !(_optionalChain([config, 'access', _67 => _67.docs, 'optionalAccess', _68 => _68.enabled]) && _optionalChain([config, 'access', _69 => _69.docs, 'access', _70 => _70.adapter, 'optionalAccess', _71 => _71.server])),
|
|
4893
4849
|
jsxDev: false
|
|
4894
4850
|
},
|
|
4895
4851
|
// SSR configuration to externalize problematic modules
|
|
@@ -4939,10 +4895,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4939
4895
|
define: {
|
|
4940
4896
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
4941
4897
|
__FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
|
|
4942
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
4898
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _72 => _72.env, 'optionalAccess', _73 => _73.public]) || {})
|
|
4943
4899
|
},
|
|
4944
4900
|
plugins: [
|
|
4945
|
-
|
|
4901
|
+
_chunkYR2VBEMOcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
4946
4902
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
4947
4903
|
...rendererVitePlugins,
|
|
4948
4904
|
...config.vite.plugins || [],
|
|
@@ -4989,7 +4945,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4989
4945
|
resolve: {
|
|
4990
4946
|
alias: [
|
|
4991
4947
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
4992
|
-
...Object.entries(
|
|
4948
|
+
...Object.entries(_chunkYR2VBEMOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
4993
4949
|
([find, replacement]) => ({ find, replacement })
|
|
4994
4950
|
)
|
|
4995
4951
|
],
|
|
@@ -4997,12 +4953,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4997
4953
|
dedupe: [...config.renderer.dedupe || []]
|
|
4998
4954
|
}
|
|
4999
4955
|
};
|
|
5000
|
-
await viteBuild(
|
|
4956
|
+
await viteBuild(_chunkYR2VBEMOcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
5001
4957
|
} finally {
|
|
5002
4958
|
if (postcssConfigDir) {
|
|
5003
4959
|
try {
|
|
5004
|
-
await
|
|
5005
|
-
} catch (
|
|
4960
|
+
await fs3.rm(postcssConfigDir, { recursive: true, force: true });
|
|
4961
|
+
} catch (e23) {
|
|
5006
4962
|
}
|
|
5007
4963
|
}
|
|
5008
4964
|
}
|
|
@@ -5016,7 +4972,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, buildSSRInMemory, "buildSSRInMemory");
|
|
|
5016
4972
|
function readFarmAppPackageIdentity(root) {
|
|
5017
4973
|
try {
|
|
5018
4974
|
return JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(root, "package.json"), "utf8"));
|
|
5019
|
-
} catch (
|
|
4975
|
+
} catch (e24) {
|
|
5020
4976
|
return {};
|
|
5021
4977
|
}
|
|
5022
4978
|
}
|
|
@@ -5029,22 +4985,35 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
5029
4985
|
lastModified[route.pattern] = _fs.statSync.call(void 0,
|
|
5030
4986
|
_nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath))
|
|
5031
4987
|
).mtime.toISOString();
|
|
5032
|
-
} catch (
|
|
4988
|
+
} catch (e25) {
|
|
5033
4989
|
}
|
|
5034
4990
|
}
|
|
5035
4991
|
return lastModified;
|
|
5036
4992
|
}
|
|
5037
4993
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readFarmPageLastModified, "readFarmPageLastModified");
|
|
4994
|
+
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
4995
|
+
if (!_optionalChain([config, 'access', _74 => _74.docs, 'optionalAccess', _75 => _75.enabled])) return [];
|
|
4996
|
+
const contentDir = _chunkPGZDEPTMcjs.resolveFarmDocsContentDir.call(void 0, config.docs, {
|
|
4997
|
+
root: config.root,
|
|
4998
|
+
srcDir: config.srcDir
|
|
4999
|
+
});
|
|
5000
|
+
const guards = {
|
|
5001
|
+
config: { middleware: config.middleware, integrations: config.integrations },
|
|
5002
|
+
middlewareRoutes
|
|
5003
|
+
};
|
|
5004
|
+
return _chunkPGZDEPTMcjs.discoverFarmDocsPages.call(void 0, contentDir, config.docs).flatMap((page) => [page.href, _chunkPGZDEPTMcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunk2DD4JMQCcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
5005
|
+
}
|
|
5006
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmDocsGuardedPaths, "getFarmDocsGuardedPaths");
|
|
5038
5007
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
5039
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
5008
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _76 => _76.llmsTxt]);
|
|
5040
5009
|
const ownedByFile = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (kind) => applicationMetadataRoutes.some(
|
|
5041
5010
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
5042
5011
|
), "ownedByFile");
|
|
5043
5012
|
return [
|
|
5044
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5045
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5046
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5047
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5013
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _77 => _77.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
5014
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _78 => _78.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
5015
|
+
..._optionalChain([agent, 'optionalAccess', _79 => _79.sitemap, 'optionalAccess', _80 => _80.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
5016
|
+
..._optionalChain([agent, 'optionalAccess', _81 => _81.crawlers, 'optionalAccess', _82 => _82.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
5048
5017
|
];
|
|
5049
5018
|
}
|
|
5050
5019
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmAppOwnedDocsEnginePaths, "getFarmAppOwnedDocsEnginePaths");
|
|
@@ -5086,7 +5055,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
5086
5055
|
}
|
|
5087
5056
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toVirtualEntryImportSpecifier, "toVirtualEntryImportSpecifier");
|
|
5088
5057
|
function generateNativeAuthIntegrationSource(auth) {
|
|
5089
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
5058
|
+
if (_optionalChain([auth, 'optionalAccess', _83 => _83.enabled]) !== true) {
|
|
5090
5059
|
return { importSource: "", registerSource: "" };
|
|
5091
5060
|
}
|
|
5092
5061
|
return {
|
|
@@ -5206,10 +5175,10 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateConfiguredResponseHeadersRuntimeSo
|
|
|
5206
5175
|
function parseRouteRenderingDirectiveFromDisk(modulePath) {
|
|
5207
5176
|
try {
|
|
5208
5177
|
const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
|
|
5209
|
-
const directive =
|
|
5210
|
-
if (
|
|
5178
|
+
const directive = _chunk5D2JIPLHcjs.parseRouteRenderingDirective.call(void 0, source);
|
|
5179
|
+
if (_chunk5D2JIPLHcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
|
|
5211
5180
|
return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
|
|
5212
|
-
} catch (
|
|
5181
|
+
} catch (e26) {
|
|
5213
5182
|
return void 0;
|
|
5214
5183
|
}
|
|
5215
5184
|
}
|
|
@@ -5396,19 +5365,19 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
|
5396
5365
|
_chunkS3JO3N4Hcjs.__name.call(void 0, generateFarmRendererAppSetupServerCode, "generateFarmRendererAppSetupServerCode");
|
|
5397
5366
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache) {
|
|
5398
5367
|
const hasCompressionRuntime = config.compress && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5399
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
5368
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _84 => _84.agent, 'optionalAccess', _85 => _85.crawlers, 'optionalAccess', _86 => _86.enabled])) && !applicationMetadataRoutes.some(
|
|
5400
5369
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
5401
5370
|
);
|
|
5402
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
5371
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _87 => _87.agent, 'optionalAccess', _88 => _88.sitemap, 'optionalAccess', _89 => _89.enabled])) && !applicationMetadataRoutes.some(
|
|
5403
5372
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
5404
5373
|
);
|
|
5405
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
5406
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
5374
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _90 => _90.agent, 'optionalAccess', _91 => _91.mcp]) === true && !_chunkH5CLOUZScjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
5375
|
+
const servesAiCatalog = _optionalChain([config, 'access', _92 => _92.agent, 'optionalAccess', _93 => _93.aiCatalog]) !== false;
|
|
5407
5376
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
5408
5377
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5409
5378
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
5410
5379
|
const adapterOwnsDocsRuntime = Boolean(
|
|
5411
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
5380
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _94 => _94.docs, 'optionalAccess', _95 => _95.enabled]) && _optionalChain([config, 'access', _96 => _96.docs, 'access', _97 => _97.adapter, 'optionalAccess', _98 => _98.server]) && config.docs.adapter.react
|
|
5412
5381
|
);
|
|
5413
5382
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
5414
5383
|
const hasIsolatedClientGraphRuntime = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
@@ -5441,9 +5410,9 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5441
5410
|
const hasGeneratedMetadataImages = metadataImageRoutes.some(
|
|
5442
5411
|
(image) => image.sourceType === "module"
|
|
5443
5412
|
);
|
|
5444
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || hasFarmMiddlewareConfig(config.middleware);
|
|
5445
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
5446
|
-
const integrationProviders =
|
|
5413
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunk2DD4JMQCcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5414
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _99 => _99.docs, 'optionalAccess', _100 => _100.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
5415
|
+
const integrationProviders = _chunkVU6AAZVYcjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
5447
5416
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
5448
5417
|
(provider) => provider.component || provider.type === "clerk"
|
|
5449
5418
|
);
|
|
@@ -5452,16 +5421,16 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5452
5421
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
5453
5422
|
);
|
|
5454
5423
|
}
|
|
5455
|
-
const providerServerModules =
|
|
5424
|
+
const providerServerModules = _chunkYR2VBEMOcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
5456
5425
|
renderedIntegrationProviders,
|
|
5457
5426
|
config.root,
|
|
5458
5427
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
5459
5428
|
);
|
|
5460
5429
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
5461
5430
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
5462
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
5431
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _101 => _101.providers]);
|
|
5463
5432
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
5464
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
5433
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _102 => _102.component]) === "function")) {
|
|
5465
5434
|
throw new Error(
|
|
5466
5435
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
5467
5436
|
);
|
|
@@ -5472,14 +5441,14 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5472
5441
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
5473
5442
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
5474
5443
|
);
|
|
5475
|
-
const isolatedHydrationMode =
|
|
5476
|
-
_optionalChain([config, 'access',
|
|
5444
|
+
const isolatedHydrationMode = _chunkYR2VBEMOcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
5445
|
+
_optionalChain([config, 'access', _103 => _103.experimental, 'optionalAccess', _104 => _104.isolatedClientHydration]),
|
|
5477
5446
|
{
|
|
5478
|
-
serverComponents: _optionalChain([config, 'access',
|
|
5447
|
+
serverComponents: _optionalChain([config, 'access', _105 => _105.experimental, 'optionalAccess', _106 => _106.serverComponents]) === true,
|
|
5479
5448
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
5480
5449
|
}
|
|
5481
5450
|
);
|
|
5482
|
-
const hydrationPlanOptions =
|
|
5451
|
+
const hydrationPlanOptions = _chunkYR2VBEMOcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
5483
5452
|
config.renderer,
|
|
5484
5453
|
Boolean(unsupportedIntegrationProvider)
|
|
5485
5454
|
);
|
|
@@ -5493,7 +5462,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5493
5462
|
hydrationPlanOptions
|
|
5494
5463
|
)
|
|
5495
5464
|
}));
|
|
5496
|
-
const markdownPagePlan =
|
|
5465
|
+
const markdownPagePlan = _chunkYR2VBEMOcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
5497
5466
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
5498
5467
|
config.root,
|
|
5499
5468
|
isolatedHydrationMode,
|
|
@@ -5502,7 +5471,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5502
5471
|
const pageHydrationPlans = new Map(
|
|
5503
5472
|
pageRoutes.map((route) => [
|
|
5504
5473
|
route.modulePath,
|
|
5505
|
-
|
|
5474
|
+
_chunkEKN7NSZOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
5506
5475
|
route.modulePath,
|
|
5507
5476
|
config.root,
|
|
5508
5477
|
isolatedHydrationMode,
|
|
@@ -5511,7 +5480,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5511
5480
|
)
|
|
5512
5481
|
])
|
|
5513
5482
|
);
|
|
5514
|
-
|
|
5483
|
+
_chunkYR2VBEMOcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
5515
5484
|
layoutHydrationPlans.map((layout) => ({
|
|
5516
5485
|
pattern: layout.pattern,
|
|
5517
5486
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -5520,10 +5489,10 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5520
5489
|
pageRoutes.map((route) => ({
|
|
5521
5490
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
5522
5491
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
5523
|
-
depth:
|
|
5492
|
+
depth: _chunk2DD4JMQCcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
5524
5493
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
5525
5494
|
})),
|
|
5526
|
-
|
|
5495
|
+
_chunk2DD4JMQCcjs.routeBoundaryCoversDirectory
|
|
5527
5496
|
);
|
|
5528
5497
|
const providerServerImports = [
|
|
5529
5498
|
providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
|
|
@@ -5540,7 +5509,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5540
5509
|
apiRegistrations.push(`
|
|
5541
5510
|
{
|
|
5542
5511
|
path: ${JSON.stringify(route.path)},
|
|
5543
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
5512
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _107 => _107.pluginMethods, 'optionalAccess', _108 => _108.includes, 'call', _109 => _109(method)])))},
|
|
5544
5513
|
endpoints: ${varName},
|
|
5545
5514
|
}`);
|
|
5546
5515
|
});
|
|
@@ -5553,7 +5522,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5553
5522
|
}).map(({ route }) => route);
|
|
5554
5523
|
orderedPageRoutes.forEach((route, index) => {
|
|
5555
5524
|
const varName = `pageRoute${index}`;
|
|
5556
|
-
if (
|
|
5525
|
+
if (_chunkEKN7NSZOcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
5557
5526
|
pageRegistrations.push(`
|
|
5558
5527
|
{
|
|
5559
5528
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -5583,8 +5552,9 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5583
5552
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
5584
5553
|
directory: ${JSON.stringify(route.directory)},` : ""}
|
|
5585
5554
|
module: ${varName},
|
|
5586
|
-
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)}
|
|
5587
|
-
|
|
5555
|
+
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
5556
|
+
clientModule: ${JSON.stringify(_chunk5QIKR7RRcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
5557
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkYR2VBEMOcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
|
|
5588
5558
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
5589
5559
|
${route.source !== void 0 ? `markdownSource: {
|
|
5590
5560
|
source: ${JSON.stringify(route.source)},
|
|
@@ -5641,12 +5611,12 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5641
5611
|
errorImports.push(
|
|
5642
5612
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
5643
5613
|
);
|
|
5644
|
-
const groupScope =
|
|
5614
|
+
const groupScope = _chunk2DD4JMQCcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
5645
5615
|
errorRegistrations.push(`
|
|
5646
5616
|
{
|
|
5647
|
-
pattern: ${JSON.stringify(
|
|
5617
|
+
pattern: ${JSON.stringify(_chunk2DD4JMQCcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
5648
5618
|
groupScope: ${JSON.stringify(groupScope)},
|
|
5649
|
-
directoryDepth: ${
|
|
5619
|
+
directoryDepth: ${_chunk2DD4JMQCcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
5650
5620
|
module: ${varName},
|
|
5651
5621
|
}`);
|
|
5652
5622
|
});
|
|
@@ -5704,7 +5674,9 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5704
5674
|
const productionRuntimeImport = `import {
|
|
5705
5675
|
_getRequestReadCount,
|
|
5706
5676
|
_runWithAfterRequest,
|
|
5677
|
+
_resolveCurrentCspNonce,
|
|
5707
5678
|
_runWithCurrentRequest,
|
|
5679
|
+
_runWithFarmCspNonce,
|
|
5708
5680
|
_runWithAPIRequestRuntime,
|
|
5709
5681
|
_runWithMiddlewareContext,
|
|
5710
5682
|
_runWithMiddlewareData,
|
|
@@ -5714,6 +5686,8 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5714
5686
|
appendFarmRedirectQuery,
|
|
5715
5687
|
applyFarmBasePath,
|
|
5716
5688
|
applyFarmCspNonceToResponse,
|
|
5689
|
+
createFarmCspNonce,
|
|
5690
|
+
stampFarmCspNonce,
|
|
5717
5691
|
applyFarmPreviewRobotsTag,
|
|
5718
5692
|
applyFarmThemeDocument,
|
|
5719
5693
|
appendFarmLinkHeader,
|
|
@@ -5735,6 +5709,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5735
5709
|
createFarmAiCatalogResponse,
|
|
5736
5710
|
createFarmApiCatalogResponse,
|
|
5737
5711
|
createFarmAppManifestResponse,
|
|
5712
|
+
farmPathGuardCoversEndpoint,
|
|
5738
5713
|
collectFarmLlmsTxtPages,
|
|
5739
5714
|
createFarmDefaultLlmsTxt,
|
|
5740
5715
|
createFarmLlmsMarkdownReader,
|
|
@@ -5792,25 +5767,25 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5792
5767
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
5793
5768
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
5794
5769
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
5795
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
5770
|
+
const docsHandlerImport = _optionalChain([config, 'access', _110 => _110.docs, 'optionalAccess', _111 => _111.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
5796
5771
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
5797
5772
|
const pathname = typeof requestOrPathname === "string"
|
|
5798
5773
|
? requestOrPathname
|
|
5799
5774
|
: new URL(requestOrPathname.url).pathname;
|
|
5800
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
5775
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _112 => _112.apiPath]) || "/api/docs")};
|
|
5801
5776
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
5802
5777
|
};` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
5803
5778
|
import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
|
|
5804
5779
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
5805
5780
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
5806
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
5807
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
5781
|
+
const docsFontImport = _optionalChain([config, 'access', _113 => _113.docs, 'optionalAccess', _114 => _114.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
5782
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _115 => _115.docs, 'optionalAccess', _116 => _116.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
5808
5783
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
5809
5784
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
5810
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
5811
|
-
const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
|
|
5812
|
-
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
5813
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
5785
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _117 => _117.md, 'optionalAccess', _118 => _118.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
5786
|
+
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;";
|
|
5787
|
+
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
5788
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _119 => _119.mdx, 'optionalAccess', _120 => _120.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
5814
5789
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
5815
5790
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
5816
5791
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -5828,7 +5803,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
5828
5803
|
const integrationRuntimeImport = integrationRuntimeExports.length ? `import { ${integrationRuntimeExports.join(", ")} } from "@farm.js/core/integrations";` : "";
|
|
5829
5804
|
const instrumentationImport = instrumentationPath ? `import * as FarmInstrumentationModule from ${toVirtualEntryImportSpecifier(instrumentationPath)};` : "";
|
|
5830
5805
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
5831
|
-
const nativeMCP =
|
|
5806
|
+
const nativeMCP = _chunk4E5QXOCLcjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
5832
5807
|
const integrationImports = `
|
|
5833
5808
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
5834
5809
|
${layerConfigImports}
|
|
@@ -6015,7 +5990,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
6015
5990
|
|
|
6016
5991
|
function FarmDefault404Page() {
|
|
6017
5992
|
return React.createElement(React.Fragment, null,
|
|
6018
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
5993
|
+
React.createElement("style", null, ${JSON.stringify(_chunkYR2VBEMOcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
6019
5994
|
React.createElement("main", {
|
|
6020
5995
|
className: "farm-default-not-found",
|
|
6021
5996
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -6108,7 +6083,7 @@ const serverRuntimeIntegrations = Object.fromEntries(
|
|
|
6108
6083
|
);
|
|
6109
6084
|
const integrationRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs, {
|
|
6110
6085
|
integrations: configuredIntegrations,
|
|
6111
|
-
${JSON.stringify(
|
|
6086
|
+
${JSON.stringify(_chunkVU6AAZVYcjs.FARM_INTEGRATION_API_BASE_PATH_KEY)}: ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
6112
6087
|
});
|
|
6113
6088
|
const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? hasPluginRuntime ? "createFarmInfraAnalyticsPlugin()" : "createFarmInfraAnalyticsRecorder()" : "null"};
|
|
6114
6089
|
const configuredPlugins = [
|
|
@@ -6144,14 +6119,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
6144
6119
|
onError(error) { console.error("[Farm Image]", error); },
|
|
6145
6120
|
})`};
|
|
6146
6121
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
6147
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
6148
|
-
${_optionalChain([config, 'access',
|
|
6122
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _121 => _121.agent, 'optionalAccess', _122 => _122.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
6123
|
+
${_optionalChain([config, 'access', _123 => _123.agent, 'optionalAccess', _124 => _124.llmsTxt, 'optionalAccess', _125 => _125.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
6149
6124
|
const farmMdxConfig = ${JSON.stringify({
|
|
6150
6125
|
...config.mdx,
|
|
6151
|
-
components: typeof _optionalChain([config, 'access',
|
|
6126
|
+
components: typeof _optionalChain([config, 'access', _126 => _126.mdx, 'optionalAccess', _127 => _127.components]) === "string" ? config.mdx.components : void 0
|
|
6152
6127
|
})};
|
|
6153
6128
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
6154
|
-
${_optionalChain([config, 'access',
|
|
6129
|
+
${_optionalChain([config, 'access', _128 => _128.agent, 'optionalAccess', _129 => _129.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
6155
6130
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
6156
6131
|
// to the build.
|
|
6157
6132
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
@@ -6199,7 +6174,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
6199
6174
|
});
|
|
6200
6175
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
6201
6176
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
6202
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
6177
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _130 => _130.docs, 'optionalAccess', _131 => _131.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
6203
6178
|
try {
|
|
6204
6179
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
6205
6180
|
const candidates = [
|
|
@@ -6214,13 +6189,42 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _124 => _1
|
|
|
6214
6189
|
})()` : "null"};
|
|
6215
6190
|
const farmDocsResolvedConfig = ${generateFarmDocsRuntimeConfigExpression(config.docs, hasPrecompiledDocs)};
|
|
6216
6191
|
const farmDocsRuntimeRoot = ${hasPrecompiledDocs ? '"."' : `farmDocsBundledContentDir || ${JSON.stringify(config.root)}`};
|
|
6192
|
+
// Docs pages a path-specific guard covers, decided at build time. The docs API and the
|
|
6193
|
+
// root llms/sitemap files answer anyone, so they leave these pages out.
|
|
6194
|
+
const farmDocsGuardedPaths = ${JSON.stringify(
|
|
6195
|
+
hasPrecompiledDocs ? [] : getFarmDocsGuardedPaths(config, middlewareRoutes)
|
|
6196
|
+
)};
|
|
6197
|
+
const farmDocsGuardedPathSet = new Set(farmDocsGuardedPaths);
|
|
6198
|
+
const isFarmDocsPathGuarded = (pathname) => farmDocsGuardedPathSet.has(pathname);
|
|
6217
6199
|
globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
|
|
6218
6200
|
root: farmDocsRuntimeRoot,
|
|
6219
6201
|
srcDir: ${JSON.stringify(config.srcDir)},
|
|
6220
6202
|
docs: farmDocsResolvedConfig,
|
|
6203
|
+
guardedPaths: farmDocsGuardedPaths,
|
|
6221
6204
|
};
|
|
6222
6205
|
const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
|
|
6223
|
-
|
|
6206
|
+
// Filled in from the client build once it has finished (see buildNitroUniversal).
|
|
6207
|
+
const farmDocsModulePreloads = (() => {
|
|
6208
|
+
try {
|
|
6209
|
+
return JSON.parse("${FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER}");
|
|
6210
|
+
} catch {
|
|
6211
|
+
return null;
|
|
6212
|
+
}
|
|
6213
|
+
})();
|
|
6214
|
+
// Paths the adapter matches against a page's source path the way the browser
|
|
6215
|
+
// finds the page's module.
|
|
6216
|
+
const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
6217
|
+
? {
|
|
6218
|
+
runtime: farmDocsModulePreloads.runtime.map((index) => "/" + farmDocsModulePreloads.files[index]),
|
|
6219
|
+
pages: Object.fromEntries(
|
|
6220
|
+
Object.entries(farmDocsModulePreloads.pages).map(([sourcePath, indexes]) => [
|
|
6221
|
+
sourcePath,
|
|
6222
|
+
indexes.map((index) => "/" + farmDocsModulePreloads.files[index]),
|
|
6223
|
+
]),
|
|
6224
|
+
),
|
|
6225
|
+
}
|
|
6226
|
+
: undefined;
|
|
6227
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _132 => _132.docs, 'optionalAccess', _133 => _133.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
|
|
6224
6228
|
${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
|
|
6225
6229
|
entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
|
|
6226
6230
|
docsPath: farmDocsResolvedConfig.entry,
|
|
@@ -6230,6 +6234,9 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _126 => _126.docs, '
|
|
|
6230
6234
|
// A production build's content cannot change, so the adapter reads its
|
|
6231
6235
|
// navigation once instead of scanning the content directory per request.
|
|
6232
6236
|
immutableContent: true,
|
|
6237
|
+
// List the chunks a page needs, so the browser fetches them alongside the
|
|
6238
|
+
// client entry instead of discovering them one import at a time.
|
|
6239
|
+
modulePreloads: farmDocsModulePreloadPaths,
|
|
6233
6240
|
clientEntry: "/__farm_client_js_src__",
|
|
6234
6241
|
// Font CSS is merged into the client stylesheet; farm-fonts.css only exists when the
|
|
6235
6242
|
// app has fonts, so linking it separately 404'd for apps without them.
|
|
@@ -6252,30 +6259,52 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _126 => _126.docs, '
|
|
|
6252
6259
|
),
|
|
6253
6260
|
fontStylesheetHref: "/farm-fonts.css",
|
|
6254
6261
|
globalStylesheetHref: "/assets/globals.css",
|
|
6262
|
+
isPathGuarded: isFarmDocsPathGuarded,
|
|
6255
6263
|
})` : "null"};
|
|
6256
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
6264
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _134 => _134.docs, 'optionalAccess', _135 => _135.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded })` : "null"};
|
|
6257
6265
|
|
|
6258
6266
|
// API routes bundled at build time
|
|
6259
6267
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
6260
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
6268
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path10, methods }) => ({ path: path10, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
|
|
6261
6269
|
// A plugin calling an app endpoint (an MCP tool, say) goes through the whole
|
|
6262
6270
|
// pipeline, so the endpoint's middleware and integration guards run for it.
|
|
6263
6271
|
function dispatchFarmPluginAPIRequest(request) {
|
|
6264
6272
|
const url = new URL(request.url);
|
|
6265
6273
|
url.pathname = applyFarmBasePath(url.pathname);
|
|
6266
|
-
return
|
|
6274
|
+
return fetchFarmInnerRequest(url.href === request.url ? request : new Request(url, request));
|
|
6275
|
+
}
|
|
6276
|
+
// A request the app makes to itself (a Markdown page check, a plugin's endpoint call) enters
|
|
6277
|
+
// through this module's outer \`fetch\`, as a direct request does: plugin runtime hooks run and
|
|
6278
|
+
// it gets its own request context, so \`cookies()\` and \`headers()\` are its own, never the
|
|
6279
|
+
// caller's. It asks for an identity body: the caller reads it, and the outer response is
|
|
6280
|
+
// compressed once.
|
|
6281
|
+
function fetchFarmInnerRequest(request, context) {
|
|
6282
|
+
if (!request.headers.has("accept-encoding")) return fetch(request, context);
|
|
6283
|
+
const headers = new Headers(request.headers);
|
|
6284
|
+
headers.delete("accept-encoding");
|
|
6285
|
+
return fetch(new Request(request, { headers }), context);
|
|
6267
6286
|
}
|
|
6268
6287
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
6269
6288
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
6270
|
-
${_optionalChain([config, 'access',
|
|
6271
|
-
` : ""}${_optionalChain([config, 'access',
|
|
6272
|
-
|
|
6289
|
+
${_optionalChain([config, 'access', _136 => _136.agent, 'optionalAccess', _137 => _137.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunk2DD4JMQCcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
6290
|
+
` : ""}${_optionalChain([config, 'access', _138 => _138.agent, 'optionalAccess', _139 => _139.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
6291
|
+
_chunk2DD4JMQCcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
6273
6292
|
build: config.deploymentId,
|
|
6274
|
-
packages:
|
|
6275
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
6293
|
+
packages: _chunkYR2VBEMOcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
6294
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkYR2VBEMOcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
6276
6295
|
})
|
|
6277
6296
|
)};
|
|
6278
|
-
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}
|
|
6297
|
+
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
6298
|
+
farmAppManifestInput.guardCoversPath = (path) =>
|
|
6299
|
+
farmPathGuardCoversEndpoint(
|
|
6300
|
+
{
|
|
6301
|
+
config: { middleware: farmMiddlewareConfig, integrations: serverRuntimeIntegrations },
|
|
6302
|
+
middlewareRoutes: fileMiddlewareModules,
|
|
6303
|
+
},
|
|
6304
|
+
path,
|
|
6305
|
+
farmLocalAPIBasePath,
|
|
6306
|
+
);
|
|
6307
|
+
` : ""}
|
|
6279
6308
|
function isFarmLocalAPIPathname(pathname) {
|
|
6280
6309
|
return farmLocalAPIBasePath !== "/" &&
|
|
6281
6310
|
(pathname === farmLocalAPIBasePath ||
|
|
@@ -6375,15 +6404,26 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
|
|
|
6375
6404
|
}
|
|
6376
6405
|
return '<script id="__farm_route_slots_data__" type="application/json">' +
|
|
6377
6406
|
serializedRouteSlots +
|
|
6378
|
-
'</script
|
|
6407
|
+
'</script>' + stampFarmCspNonce('<script>' + source + '</script>');
|
|
6379
6408
|
}
|
|
6380
6409
|
|
|
6381
6410
|
function renderFarmRendererHydrationScript() {
|
|
6382
6411
|
return typeof ReactDOMServer.generateHydrationScript === "function"
|
|
6383
|
-
? ReactDOMServer.generateHydrationScript()
|
|
6412
|
+
? stampFarmCspNonce(ReactDOMServer.generateHydrationScript())
|
|
6384
6413
|
: "";
|
|
6385
6414
|
}
|
|
6386
6415
|
|
|
6416
|
+
function renderFarmClientEntryScript() {
|
|
6417
|
+
return stampFarmCspNonce('<script type="module" src="/__farm_client_js_src__"></script>');
|
|
6418
|
+
}
|
|
6419
|
+
|
|
6420
|
+
// Renderer options for the response being rendered: its CSP nonce, which the
|
|
6421
|
+
// renderer puts on the inline scripts it emits.
|
|
6422
|
+
function getFarmRendererRenderOptions() {
|
|
6423
|
+
const nonce = _resolveCurrentCspNonce();
|
|
6424
|
+
return nonce ? { nonce } : undefined;
|
|
6425
|
+
}
|
|
6426
|
+
|
|
6387
6427
|
function escapeFarmHtmlAttribute(value) {
|
|
6388
6428
|
return String(value)
|
|
6389
6429
|
.replace(/&/g, "&")
|
|
@@ -6425,6 +6465,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6425
6465
|
if (farmRendererStreamingCapabilities.web &&
|
|
6426
6466
|
typeof ReactDOMServer.renderToReadableStream === "function") {
|
|
6427
6467
|
const stream = await ReactDOMServer.renderToReadableStream(element, {
|
|
6468
|
+
nonce: _resolveCurrentCspNonce(),
|
|
6428
6469
|
onError(error) {
|
|
6429
6470
|
// redirect()/notFound() are control flow, not render failures: the
|
|
6430
6471
|
// request handler must still receive them to map the response status,
|
|
@@ -6557,6 +6598,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6557
6598
|
},
|
|
6558
6599
|
};
|
|
6559
6600
|
pipeableStream = ReactDOMServer.renderToPipeableStream(element, {
|
|
6601
|
+
nonce: _resolveCurrentCspNonce(),
|
|
6560
6602
|
onShellReady() {
|
|
6561
6603
|
try {
|
|
6562
6604
|
pipeableStream.pipe(destination);
|
|
@@ -6619,7 +6661,10 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6619
6661
|
}
|
|
6620
6662
|
|
|
6621
6663
|
if (ReactDOMServer.renderToStringWithHead) {
|
|
6622
|
-
const rendered = await ReactDOMServer.renderToStringWithHead(
|
|
6664
|
+
const rendered = await ReactDOMServer.renderToStringWithHead(
|
|
6665
|
+
element,
|
|
6666
|
+
getFarmRendererRenderOptions(),
|
|
6667
|
+
);
|
|
6623
6668
|
return {
|
|
6624
6669
|
html: rendered.html,
|
|
6625
6670
|
head: rendered.head || "",
|
|
@@ -6627,7 +6672,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6627
6672
|
streamErrors,
|
|
6628
6673
|
};
|
|
6629
6674
|
}
|
|
6630
|
-
const html = await ReactDOMServer.renderToString(element);
|
|
6675
|
+
const html = await ReactDOMServer.renderToString(element, getFarmRendererRenderOptions());
|
|
6631
6676
|
return { html, head: "", shellHtml: html, streamErrors };
|
|
6632
6677
|
}
|
|
6633
6678
|
|
|
@@ -6666,7 +6711,7 @@ function renderFarmElementSync(ReactDOMServer, element, routeKey) {
|
|
|
6666
6711
|
if (typeof ReactDOMServer.renderToString !== "function") return undefined;
|
|
6667
6712
|
let html;
|
|
6668
6713
|
try {
|
|
6669
|
-
html = ReactDOMServer.renderToString(element);
|
|
6714
|
+
html = ReactDOMServer.renderToString(element, getFarmRendererRenderOptions());
|
|
6670
6715
|
} catch {
|
|
6671
6716
|
html = undefined;
|
|
6672
6717
|
}
|
|
@@ -6681,6 +6726,8 @@ function renderFarmElementSync(ReactDOMServer, element, routeKey) {
|
|
|
6681
6726
|
function createFarmDocumentStream(contentStream, prefix, suffix, onComplete) {
|
|
6682
6727
|
const encoder = new TextEncoder();
|
|
6683
6728
|
const reader = contentStream.getReader();
|
|
6729
|
+
// The suffix renders after the handler returned, outside its async scope.
|
|
6730
|
+
const cspNonce = _resolveCurrentCspNonce();
|
|
6684
6731
|
return new ReadableStream({
|
|
6685
6732
|
start(controller) {
|
|
6686
6733
|
controller.enqueue(encoder.encode(prefix));
|
|
@@ -6689,7 +6736,9 @@ function createFarmDocumentStream(contentStream, prefix, suffix, onComplete) {
|
|
|
6689
6736
|
try {
|
|
6690
6737
|
const result = await reader.read();
|
|
6691
6738
|
if (result.done) {
|
|
6692
|
-
const tail = typeof suffix === "function"
|
|
6739
|
+
const tail = typeof suffix === "function"
|
|
6740
|
+
? await _runWithFarmCspNonce(cspNonce, suffix)
|
|
6741
|
+
: suffix;
|
|
6693
6742
|
controller.enqueue(encoder.encode(tail));
|
|
6694
6743
|
if (onComplete) onComplete();
|
|
6695
6744
|
controller.close();
|
|
@@ -6717,7 +6766,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
6717
6766
|
let inner = markup.replace(/^\\s+/, "");
|
|
6718
6767
|
let hoisted = "";
|
|
6719
6768
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
|
|
6720
|
-
const hoistable = /${
|
|
6769
|
+
const hoistable = /${_chunk2DD4JMQCcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
6721
6770
|
let match;
|
|
6722
6771
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
6723
6772
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -6811,18 +6860,18 @@ function createFarmErrorDocument(html, title) {
|
|
|
6811
6860
|
' <meta name="viewport" content="width=device-width, initial-scale=1">\\n' +
|
|
6812
6861
|
' <link rel="icon" href="data:,">\\n' +
|
|
6813
6862
|
' <title>' + escapedTitle + '</title>\\n' +
|
|
6814
|
-
' <link rel="stylesheet" href="/__farm_client_css_href__"
|
|
6863
|
+
' <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(html) + '\\n' +
|
|
6815
6864
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
6816
6865
|
'</head>\\n<body>\\n' +
|
|
6817
6866
|
' <div id="root">' + html + '</div>\\n' +
|
|
6818
6867
|
' ' + renderFarmClientBootstrapScript() + '\\n' +
|
|
6819
|
-
'
|
|
6868
|
+
' ' + renderFarmClientEntryScript() + '\\n' +
|
|
6820
6869
|
'</body>\\n</html>';
|
|
6821
6870
|
}
|
|
6822
6871
|
|
|
6823
6872
|
let fullHtml = ensureFarmDocumentRoot(ensureFarmDocumentHead(fullDocument));
|
|
6824
6873
|
fullHtml = fullHtml
|
|
6825
|
-
.replace(/<head([^>]*)>/i, '<head
|
|
6874
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(fullDocument); })
|
|
6826
6875
|
// Function replacements: dynamic markup may contain $-sequences ($&, $', $$)
|
|
6827
6876
|
// that a string replacement would expand, corrupting the document.
|
|
6828
6877
|
.replace(/<\\/head>/i, function() { return renderFarmRendererHydrationScript() + '\\n</head>'; })
|
|
@@ -6835,7 +6884,7 @@ function createFarmErrorDocument(html, title) {
|
|
|
6835
6884
|
/<\\/body>/i,
|
|
6836
6885
|
function() {
|
|
6837
6886
|
return ' ' + renderFarmClientBootstrapScript() + '\\n' +
|
|
6838
|
-
'
|
|
6887
|
+
' ' + renderFarmClientEntryScript() + '\\n</body>';
|
|
6839
6888
|
},
|
|
6840
6889
|
);
|
|
6841
6890
|
return fullHtml.trim().startsWith("<!DOCTYPE")
|
|
@@ -6843,6 +6892,53 @@ function createFarmErrorDocument(html, title) {
|
|
|
6843
6892
|
: "<!DOCTYPE html>\\n" + fullHtml;
|
|
6844
6893
|
}
|
|
6845
6894
|
|
|
6895
|
+
// The client modules a page needs before it hydrates, filled in from the client
|
|
6896
|
+
// build once it has finished (see buildNitroUniversal).
|
|
6897
|
+
const farmClientModulePreloads = (() => {
|
|
6898
|
+
try {
|
|
6899
|
+
return JSON.parse("${FARM_CLIENT_MODULE_PRELOADS_PLACEHOLDER}");
|
|
6900
|
+
} catch {
|
|
6901
|
+
return null;
|
|
6902
|
+
}
|
|
6903
|
+
})();
|
|
6904
|
+
const farmClientEntryPreloadTags = farmClientModulePreloads
|
|
6905
|
+
? farmClientModulePreloads.entry.map(renderFarmClientModulePreload).join("")
|
|
6906
|
+
: "";
|
|
6907
|
+
// The client modules a document's markup loads: its islands' boundaries and the
|
|
6908
|
+
// client references of its server tree.
|
|
6909
|
+
const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /data-farm-client-boundary="([^"]+)"|"r":"(\\/[^"]+)"/g;
|
|
6910
|
+
|
|
6911
|
+
function renderFarmClientModulePreload(index) {
|
|
6912
|
+
return '\\n <link rel="modulepreload" href="/' +
|
|
6913
|
+
escapeFarmHtmlAttribute(farmClientModulePreloads.files[index]) +
|
|
6914
|
+
'" fetchpriority="low">';
|
|
6915
|
+
}
|
|
6916
|
+
|
|
6917
|
+
// The modulepreload links for a document: the entry's static imports, then the
|
|
6918
|
+
// modules its hydrating page and its markup load.
|
|
6919
|
+
function renderFarmClientModulePreloads(markup, pageModule) {
|
|
6920
|
+
// A nonce policy blocks parser-inserted links without the nonce, and the
|
|
6921
|
+
// response filter manages nonces on script elements only, so CSP nonce mode
|
|
6922
|
+
// keeps the documents it had.
|
|
6923
|
+
if (!farmClientModulePreloads || (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce)) return "";
|
|
6924
|
+
const modules = farmClientModulePreloads.modules;
|
|
6925
|
+
const listed = new Set();
|
|
6926
|
+
let tags = farmClientEntryPreloadTags;
|
|
6927
|
+
const add = (moduleId) => {
|
|
6928
|
+
if (!moduleId || !Object.prototype.hasOwnProperty.call(modules, moduleId)) return;
|
|
6929
|
+
for (const index of modules[moduleId]) {
|
|
6930
|
+
if (listed.has(index)) continue;
|
|
6931
|
+
listed.add(index);
|
|
6932
|
+
tags += renderFarmClientModulePreload(index);
|
|
6933
|
+
}
|
|
6934
|
+
};
|
|
6935
|
+
add(pageModule);
|
|
6936
|
+
if (typeof markup === "string") {
|
|
6937
|
+
for (const match of markup.matchAll(FARM_CLIENT_MODULE_REFERENCE_PATTERN)) add(match[1] || match[2]);
|
|
6938
|
+
}
|
|
6939
|
+
return tags;
|
|
6940
|
+
}
|
|
6941
|
+
|
|
6846
6942
|
// The origin hreflang alternates resolve against when the route sets no
|
|
6847
6943
|
// metadataBase. Forwarded authority counts only under server.trustProxy, the
|
|
6848
6944
|
// same rule the development server applies.
|
|
@@ -6875,7 +6971,7 @@ function applyFarmI18nDocument(html, requestPath, snapshot, request, metadata) {
|
|
|
6875
6971
|
});
|
|
6876
6972
|
const runtimeMarkup =
|
|
6877
6973
|
renderFarmI18nAlternateLinks(requestPath, snapshot, request, metadata) +
|
|
6878
|
-
'<script>window.__FARM_I18N__ = ' + serializeFarmInlineValue(snapshot) + ';</script>';
|
|
6974
|
+
stampFarmCspNonce('<script>window.__FARM_I18N__ = ' + serializeFarmInlineValue(snapshot) + ';</script>');
|
|
6879
6975
|
nextHtml = nextHtml.replace(/<head([^>]*)>/i, function(_match, attributes) {
|
|
6880
6976
|
// Function replacement: runtimeMarkup may contain $-sequences ($&, $', $$).
|
|
6881
6977
|
return '<head' + attributes + '>' + runtimeMarkup;
|
|
@@ -6945,6 +7041,26 @@ function hasPrivateFarmRequestHeaders(request, farmLocaleResolution) {
|
|
|
6945
7041
|
);
|
|
6946
7042
|
}
|
|
6947
7043
|
|
|
7044
|
+
// A docs response a guard let this visitor read is theirs, as for pages: one for a
|
|
7045
|
+
// request with credentials, or with middleware request data, never fills a shared cache.
|
|
7046
|
+
// Middleware headers cannot do this, since they never replace a response's own.
|
|
7047
|
+
function withFarmDocsRequestCache(response, request, farmLocaleResolution, middlewareData, middlewareContext) {
|
|
7048
|
+
if (
|
|
7049
|
+
!hasPrivateFarmRequestHeaders(request, farmLocaleResolution) &&
|
|
7050
|
+
!middlewareData?.size &&
|
|
7051
|
+
!middlewareContext?.size
|
|
7052
|
+
) {
|
|
7053
|
+
return response;
|
|
7054
|
+
}
|
|
7055
|
+
const headers = new Headers(response.headers);
|
|
7056
|
+
headers.set("Cache-Control", "private, no-store");
|
|
7057
|
+
return farmOwnedResponse(response.body, {
|
|
7058
|
+
status: response.status,
|
|
7059
|
+
statusText: response.statusText,
|
|
7060
|
+
headers,
|
|
7061
|
+
});
|
|
7062
|
+
}
|
|
7063
|
+
|
|
6948
7064
|
${generateRuntimePathMatcherSource()}
|
|
6949
7065
|
|
|
6950
7066
|
function getMatchingErrorBoundary(pathname) {
|
|
@@ -7175,6 +7291,27 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
7175
7291
|
);
|
|
7176
7292
|
}
|
|
7177
7293
|
` : ""}
|
|
7294
|
+
// Static pages a path-specific guard covers (non-root middleware.ts, a config or
|
|
7295
|
+
// integration middleware matcher naming the path), decided at build time.
|
|
7296
|
+
// sitemap.xml, llms.txt and the default MCP server never list them, nor a page behind
|
|
7297
|
+
// a route guard.
|
|
7298
|
+
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
7299
|
+
pageRoutes.map((route) => route.pattern).filter(
|
|
7300
|
+
(pattern) => !pattern.includes("[") && _chunk2DD4JMQCcjs.farmPathGuardCoversPage.call(void 0,
|
|
7301
|
+
{
|
|
7302
|
+
config: { middleware: config.middleware, integrations: config.integrations },
|
|
7303
|
+
middlewareRoutes
|
|
7304
|
+
},
|
|
7305
|
+
pattern
|
|
7306
|
+
)
|
|
7307
|
+
)
|
|
7308
|
+
)});
|
|
7309
|
+
function getFarmAgentListedPageRoutes() {
|
|
7310
|
+
return pageRoutes.filter(
|
|
7311
|
+
(route) =>
|
|
7312
|
+
!farmAgentGuardedPages.has(route.pattern) && !(route.module && route.module.__farmRouteGuard),
|
|
7313
|
+
);
|
|
7314
|
+
}
|
|
7178
7315
|
${servesAgentSitemap ? `// sitemap.xml from agent.sitemap, built the same way as in development. Each page's
|
|
7179
7316
|
// lastmod is its file's modification time, read at build time.
|
|
7180
7317
|
const farmAgentSitemapConfig = ${JSON.stringify(config.agent.sitemap)};
|
|
@@ -7184,7 +7321,7 @@ function createFarmAgentSitemapResponse(request) {
|
|
|
7184
7321
|
return createFarmMetadataRouteResponse(
|
|
7185
7322
|
"sitemap",
|
|
7186
7323
|
createFarmDefaultSitemap(
|
|
7187
|
-
|
|
7324
|
+
getFarmAgentListedPageRoutes().map((route) => ({
|
|
7188
7325
|
pattern: route.pattern,
|
|
7189
7326
|
module: route.module,
|
|
7190
7327
|
lastModified: farmAgentSitemapLastModified[route.pattern],
|
|
@@ -7207,12 +7344,12 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
7207
7344
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
7208
7345
|
// registered at runtime, such as the docs engine's.
|
|
7209
7346
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
7210
|
-
|
|
7347
|
+
_chunkH5CLOUZScjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkKKSTAEMYcjs.FARM_VERSION)
|
|
7211
7348
|
)};
|
|
7212
7349
|
let farmDefaultMCPRouteFree;
|
|
7213
7350
|
function getFarmDefaultMCPServer() {
|
|
7214
7351
|
if (farmDefaultMCPRouteFree === undefined) {
|
|
7215
|
-
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(
|
|
7352
|
+
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunkH5CLOUZScjs.FARM_DEFAULT_MCP_PATH)});
|
|
7216
7353
|
}
|
|
7217
7354
|
return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
|
|
7218
7355
|
}
|
|
@@ -7223,7 +7360,7 @@ async function handleFarmDefaultMCP(request) {
|
|
|
7223
7360
|
basePath: ${JSON.stringify(config.basePath)},
|
|
7224
7361
|
listPages: () =>
|
|
7225
7362
|
collectFarmDefaultMCPPages(
|
|
7226
|
-
|
|
7363
|
+
getFarmAgentListedPageRoutes().map((route) => ({ pattern: route.pattern, module: route.module })),
|
|
7227
7364
|
{ origin, basePath: ${JSON.stringify(config.basePath)}, markdown: farmMarkdownConfig },
|
|
7228
7365
|
),
|
|
7229
7366
|
// A fresh request through this handler, so the caller's cookies never shape a page.
|
|
@@ -7235,13 +7372,15 @@ async function handleFarmDefaultMCP(request) {
|
|
|
7235
7372
|
},
|
|
7236
7373
|
});
|
|
7237
7374
|
}
|
|
7238
|
-
|
|
7375
|
+
// \`fetch\` is this module's outer request entry: plugin runtime hooks run and the page
|
|
7376
|
+
// gets its own request context, as for a direct request.
|
|
7377
|
+
const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => fetch(page));
|
|
7239
7378
|
` : ""}
|
|
7240
7379
|
// Static pages and root metadata for llms.txt, built the same way as in development.
|
|
7241
7380
|
function createFarmLlmsTxtContext(request, full) {
|
|
7242
7381
|
const origin = new URL(request.url).origin;
|
|
7243
7382
|
const pages = collectFarmLlmsTxtPages(
|
|
7244
|
-
|
|
7383
|
+
getFarmAgentListedPageRoutes().map((route) => ({ pattern: route.pattern, metadata: route.module && route.module.metadata })),
|
|
7245
7384
|
{
|
|
7246
7385
|
origin,
|
|
7247
7386
|
markdown: farmMarkdownConfig,
|
|
@@ -7262,14 +7401,15 @@ function createFarmLlmsTxtContext(request, full) {
|
|
|
7262
7401
|
apiServerBasePath: farmLocalAPIBasePath,${servesDefaultMCP ? "\n defaultMCP: getFarmDefaultMCPServer," : ""}
|
|
7263
7402
|
}),` : ""}
|
|
7264
7403
|
}),
|
|
7265
|
-
// llms-full.txt reads each page's .md mirror through this
|
|
7266
|
-
//
|
|
7267
|
-
//
|
|
7404
|
+
// llms-full.txt reads each page's .md mirror through this module's outer
|
|
7405
|
+
// request entry, so plugin runtime hooks run and each read has a fresh request
|
|
7406
|
+
// context: the caller's cookies never shape its content. HEAD discards the
|
|
7407
|
+
// body, so it reads nothing.
|
|
7268
7408
|
...(full
|
|
7269
7409
|
? {
|
|
7270
7410
|
markdown: request.method.toUpperCase() === "HEAD"
|
|
7271
7411
|
? async () => null
|
|
7272
|
-
: createFarmLlmsMarkdownReader((page) =>
|
|
7412
|
+
: createFarmLlmsMarkdownReader((page) => fetch(page)),
|
|
7273
7413
|
}
|
|
7274
7414
|
: {}),
|
|
7275
7415
|
};
|
|
@@ -7504,7 +7644,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
7504
7644
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
7505
7645
|
return true;
|
|
7506
7646
|
}
|
|
7507
|
-
${_optionalChain([config, 'access',
|
|
7647
|
+
${_optionalChain([config, 'access', _140 => _140.docs, 'optionalAccess', _141 => _141.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
7508
7648
|
if (
|
|
7509
7649
|
isFarmDocsAPIRequest(pathname) ||
|
|
7510
7650
|
docsPath === "/" ||
|
|
@@ -7530,7 +7670,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
7530
7670
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
7531
7671
|
};
|
|
7532
7672
|
}
|
|
7533
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
7673
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _142 => _142.docs, 'optionalAccess', _143 => _143.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
7534
7674
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
7535
7675
|
pathname,
|
|
7536
7676
|
method: request.method,
|
|
@@ -7627,7 +7767,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
7627
7767
|
return applicable;
|
|
7628
7768
|
}
|
|
7629
7769
|
|
|
7630
|
-
${_optionalChain([config, 'access',
|
|
7770
|
+
${_optionalChain([config, 'access', _144 => _144.docs, 'optionalAccess', _145 => _145.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
7631
7771
|
if (request.method === "HEAD") return response;
|
|
7632
7772
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
7633
7773
|
|
|
@@ -7717,7 +7857,7 @@ ${_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 =>
|
|
|
7717
7857
|
if (!html.includes('src="/__farm_client_js_src__"')) {
|
|
7718
7858
|
html = html.replace(
|
|
7719
7859
|
/<[/]body>/i,
|
|
7720
|
-
'
|
|
7860
|
+
function() { return ' ' + renderFarmClientEntryScript() + '\\n</body>'; },
|
|
7721
7861
|
);
|
|
7722
7862
|
}
|
|
7723
7863
|
if (!html.includes('window._$HY')) {
|
|
@@ -7734,7 +7874,7 @@ ${_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 =>
|
|
|
7734
7874
|
}` : ""}
|
|
7735
7875
|
|
|
7736
7876
|
const pprShellCache = getFarmDataCache();
|
|
7737
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
7877
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _146 => _146.experimental, 'optionalAccess', _147 => _147.ppr]) === true)};
|
|
7738
7878
|
|
|
7739
7879
|
function resolveRouteRenderingView(route) {
|
|
7740
7880
|
// The same merge development uses: baked directive config under the
|
|
@@ -7754,6 +7894,9 @@ function resolvePPRConfig(route) {
|
|
|
7754
7894
|
}
|
|
7755
7895
|
|
|
7756
7896
|
function getPPRShellBypassReason(request, middlewareData, middlewareContext) {
|
|
7897
|
+
// A shared shell would carry one response's nonce to every visitor, where
|
|
7898
|
+
// the nonce filter strips it and Farm's scripts stop running.
|
|
7899
|
+
if (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce) return "csp-nonce";
|
|
7757
7900
|
const method = request.method.toUpperCase();
|
|
7758
7901
|
if (method !== "GET" && method !== "HEAD") return "method";
|
|
7759
7902
|
if (request.headers.get("cookie")) return "cookie";
|
|
@@ -7863,7 +8006,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
7863
8006
|
},
|
|
7864
8007
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
7865
8008
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
7866
|
-
${_optionalChain([config, 'access',
|
|
8009
|
+
${_optionalChain([config, 'access', _148 => _148.md, 'optionalAccess', _149 => _149.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
7867
8010
|
if (matchPageRoute(pathname)) {
|
|
7868
8011
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
7869
8012
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -8019,7 +8162,7 @@ async function handleFarmRequestInContext(
|
|
|
8019
8162
|
}
|
|
8020
8163
|
` : ""}
|
|
8021
8164
|
|
|
8022
|
-
${_optionalChain([config, 'access',
|
|
8165
|
+
${_optionalChain([config, 'access', _150 => _150.docs, 'optionalAccess', _151 => _151.enabled]) ? `
|
|
8023
8166
|
// Docs responses are served after app middleware so route guards and
|
|
8024
8167
|
// middleware headers apply to the docs engine like any other page content.
|
|
8025
8168
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -8031,11 +8174,17 @@ async function handleFarmRequestInContext(
|
|
|
8031
8174
|
const docsResponse = await farmDocsHandler(cloneFarmRequestWithContext(request));
|
|
8032
8175
|
if (docsResponse) {
|
|
8033
8176
|
if (!docsResponse.headers.get("content-type")?.toLowerCase().includes("text/html")) {
|
|
8034
|
-
return applyProductionMiddlewareHeaders(
|
|
8177
|
+
return applyProductionMiddlewareHeaders(
|
|
8178
|
+
withFarmDocsRequestCache(docsResponse, request, farmLocaleResolution, middlewareData, middlewareContext),
|
|
8179
|
+
middlewareHeaders,
|
|
8180
|
+
);
|
|
8035
8181
|
}
|
|
8036
|
-
const wrappedDocsResponse =
|
|
8182
|
+
const wrappedDocsResponse = withFarmDocsRequestCache(
|
|
8183
|
+
await wrapFarmDocsResponseWithLayouts(request, docsResponse),
|
|
8037
8184
|
request,
|
|
8038
|
-
|
|
8185
|
+
farmLocaleResolution,
|
|
8186
|
+
middlewareData,
|
|
8187
|
+
middlewareContext,
|
|
8039
8188
|
);
|
|
8040
8189
|
const docsHeaders = new Headers(wrappedDocsResponse.headers);
|
|
8041
8190
|
docsHeaders.set("x-farm-preload-buffered", "1");
|
|
@@ -8059,7 +8208,13 @@ async function handleFarmRequestInContext(
|
|
|
8059
8208
|
const match = matchPageRoute(getFarmRoutePathname(targetPathname));
|
|
8060
8209
|
return match?.route?.markdownSource || null;
|
|
8061
8210
|
},
|
|
8062
|
-
|
|
8211
|
+
clientAddress: adapterContext?.clientAddress,
|
|
8212
|
+
// An anonymous visitor's request: guards never see the caller's address.
|
|
8213
|
+
renderPage: (targetRequest) =>
|
|
8214
|
+
fetchFarmInnerRequest(targetRequest, {
|
|
8215
|
+
...adapterContext,
|
|
8216
|
+
clientAddress: FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
|
|
8217
|
+
}),
|
|
8063
8218
|
});
|
|
8064
8219
|
if (markdownSourceResponse) {
|
|
8065
8220
|
return isFarmMarkdownPublicSourceResponse(markdownSourceResponse)
|
|
@@ -8068,7 +8223,7 @@ async function handleFarmRequestInContext(
|
|
|
8068
8223
|
}
|
|
8069
8224
|
` : ""}
|
|
8070
8225
|
|
|
8071
|
-
${_optionalChain([config, 'access',
|
|
8226
|
+
${_optionalChain([config, 'access', _152 => _152.md, 'optionalAccess', _153 => _153.enabled]) ? `
|
|
8072
8227
|
if (farmMarkdownConfig?.enabled) {
|
|
8073
8228
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
8074
8229
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -8079,7 +8234,7 @@ async function handleFarmRequestInContext(
|
|
|
8079
8234
|
config: farmMarkdownConfig,
|
|
8080
8235
|
routeExists: (targetPathname) =>
|
|
8081
8236
|
Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
|
|
8082
|
-
renderPage: (targetRequest) =>
|
|
8237
|
+
renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
|
|
8083
8238
|
apiServerBasePath: farmLocalAPIBasePath,
|
|
8084
8239
|
});
|
|
8085
8240
|
if (markdownResponse) {
|
|
@@ -8130,7 +8285,7 @@ async function handleFarmRequestInContext(
|
|
|
8130
8285
|
) {
|
|
8131
8286
|
const method = request.method.toUpperCase();
|
|
8132
8287
|
const response = method === "GET" || method === "HEAD"
|
|
8133
|
-
? farmOwnedResponse(method === "HEAD" ? null : farmOpenAPIReference.html, {
|
|
8288
|
+
? farmOwnedResponse(method === "HEAD" ? null : stampFarmCspNonce(farmOpenAPIReference.html), {
|
|
8134
8289
|
status: 200,
|
|
8135
8290
|
headers: {
|
|
8136
8291
|
"Content-Type": "text/html; charset=utf-8",
|
|
@@ -8167,11 +8322,11 @@ async function handleFarmRequestInContext(
|
|
|
8167
8322
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
8168
8323
|
}
|
|
8169
8324
|
` : ""}
|
|
8170
|
-
${_optionalChain([config, 'access',
|
|
8325
|
+
${_optionalChain([config, 'access', _154 => _154.agent, 'optionalAccess', _155 => _155.manifest]) !== false ? `
|
|
8171
8326
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
8172
8327
|
// public manifest; Farm Infra's signed request gets the full view.
|
|
8173
8328
|
if (
|
|
8174
|
-
[${JSON.stringify(
|
|
8329
|
+
[${JSON.stringify(_chunk2DD4JMQCcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunk2DD4JMQCcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
8175
8330
|
normalizeRuntimePath(routePathname),
|
|
8176
8331
|
)
|
|
8177
8332
|
) {
|
|
@@ -8181,9 +8336,9 @@ async function handleFarmRequestInContext(
|
|
|
8181
8336
|
);
|
|
8182
8337
|
}
|
|
8183
8338
|
` : ""}
|
|
8184
|
-
${_optionalChain([config, 'access',
|
|
8339
|
+
${_optionalChain([config, 'access', _156 => _156.agent, 'optionalAccess', _157 => _157.apiCatalog]) ? `
|
|
8185
8340
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
8186
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
8341
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunk2DD4JMQCcjs.FARM_API_CATALOG_PATH)}) {
|
|
8187
8342
|
return applyProductionMiddlewareHeaders(
|
|
8188
8343
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
8189
8344
|
middlewareHeaders,
|
|
@@ -8208,11 +8363,11 @@ async function handleFarmRequestInContext(
|
|
|
8208
8363
|
);
|
|
8209
8364
|
}
|
|
8210
8365
|
` : ""}
|
|
8211
|
-
${_optionalChain([config, 'access',
|
|
8366
|
+
${_optionalChain([config, 'access', _158 => _158.agent, 'optionalAccess', _159 => _159.llmsTxt, 'optionalAccess', _160 => _160.enabled]) ? `
|
|
8212
8367
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
8213
8368
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
8214
8369
|
? "llms"
|
|
8215
|
-
: ${_optionalChain([config, 'access',
|
|
8370
|
+
: ${_optionalChain([config, 'access', _161 => _161.agent, 'optionalAccess', _162 => _162.llmsTxt, 'optionalAccess', _163 => _163.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
8216
8371
|
if (farmGeneratedLlmsKind) {
|
|
8217
8372
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
8218
8373
|
const llmsOrigin = new URL(request.url).origin;
|
|
@@ -8247,10 +8402,13 @@ async function handleFarmRequestInContext(
|
|
|
8247
8402
|
}
|
|
8248
8403
|
` : ""}
|
|
8249
8404
|
|
|
8250
|
-
${_optionalChain([config, 'access',
|
|
8405
|
+
${_optionalChain([config, 'access', _164 => _164.docs, 'optionalAccess', _165 => _165.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
8251
8406
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
8252
8407
|
if (docsAPIResponse) {
|
|
8253
|
-
return applyProductionMiddlewareHeaders(
|
|
8408
|
+
return applyProductionMiddlewareHeaders(
|
|
8409
|
+
withFarmDocsRequestCache(docsAPIResponse, request, farmLocaleResolution, middlewareData, middlewareContext),
|
|
8410
|
+
middlewareHeaders,
|
|
8411
|
+
);
|
|
8254
8412
|
}
|
|
8255
8413
|
}` : ""}
|
|
8256
8414
|
|
|
@@ -8705,7 +8863,7 @@ async function handleFarmRequestInContext(
|
|
|
8705
8863
|
);
|
|
8706
8864
|
}
|
|
8707
8865
|
}
|
|
8708
|
-
${_optionalChain([config, 'access',
|
|
8866
|
+
${_optionalChain([config, 'access', _166 => _166.md, 'optionalAccess', _167 => _167.enabled]) ? `
|
|
8709
8867
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
8710
8868
|
// using the public path the .md request will be resolved against.
|
|
8711
8869
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -8724,7 +8882,7 @@ async function handleFarmRequestInContext(
|
|
|
8724
8882
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
8725
8883
|
}
|
|
8726
8884
|
|
|
8727
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
8885
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _168 => _168.agent, 'optionalAccess', _169 => _169.jsonLd]), () => ( false)))} });
|
|
8728
8886
|
const title = renderedMetadata.title;
|
|
8729
8887
|
const metaTags = renderedMetadata.tags;
|
|
8730
8888
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -8764,13 +8922,16 @@ async function handleFarmRequestInContext(
|
|
|
8764
8922
|
|
|
8765
8923
|
// Stream a suspended body as soon as React's shell is ready. Full-document
|
|
8766
8924
|
// layouts, localized documents, and cacheable PPR shells still use the
|
|
8767
|
-
// buffered path because they require whole-document transformation
|
|
8925
|
+
// buffered path because they require whole-document transformation, and so
|
|
8926
|
+
// does the anonymous check behind a page's Markdown source: there, a
|
|
8927
|
+
// redirect() under a loading boundary must still decide the status.
|
|
8768
8928
|
if (
|
|
8769
8929
|
pageStatus === 200 &&
|
|
8770
8930
|
renderedPage.stream &&
|
|
8771
8931
|
!hasFullDocument &&
|
|
8772
8932
|
!farmI18nSnapshot &&
|
|
8773
|
-
!pprCacheKey
|
|
8933
|
+
!pprCacheKey &&
|
|
8934
|
+
!_isFarmMarkdownPageCheck(request.headers.get(FARM_MARKDOWN_PAGE_CHECK_HEADER))
|
|
8774
8935
|
) {
|
|
8775
8936
|
const farmThemeDocument = createFarmThemeDocumentParts(
|
|
8776
8937
|
farmThemeConfig,
|
|
@@ -8784,7 +8945,7 @@ async function handleFarmRequestInContext(
|
|
|
8784
8945
|
(hasFavicon ? '' : ' <link rel="icon" href="data:,">\\n') +
|
|
8785
8946
|
' <title>' + title + '</title>' + metaTags + '\\n' +
|
|
8786
8947
|
' <link rel="stylesheet" href="/__farm_client_css_href__">\\n' +
|
|
8787
|
-
' <link rel="modulepreload" href="/__farm_client_js_src__"
|
|
8948
|
+
' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule) + '\\n' +
|
|
8788
8949
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
8789
8950
|
'</head>\\n<body>\\n <div id="root">';
|
|
8790
8951
|
const streamSuffix = '</div>\\n' +
|
|
@@ -8793,7 +8954,7 @@ async function handleFarmRequestInContext(
|
|
|
8793
8954
|
routeSlotPayload,
|
|
8794
8955
|
clientPageProps
|
|
8795
8956
|
) + '\\n' +
|
|
8796
|
-
'
|
|
8957
|
+
' ' + renderFarmClientEntryScript() + '\\n' +
|
|
8797
8958
|
'</body>\\n</html>';
|
|
8798
8959
|
const themedStreamPrefix = streamPrefix.replace(
|
|
8799
8960
|
'<html lang="en">',
|
|
@@ -8817,7 +8978,8 @@ async function handleFarmRequestInContext(
|
|
|
8817
8978
|
try {
|
|
8818
8979
|
return createLateNotFoundRecovery(
|
|
8819
8980
|
await ReactDOMServer.renderToString(
|
|
8820
|
-
wrapWithFarmIntegrationProviders(createFarmNotFoundElement(pathname))
|
|
8981
|
+
wrapWithFarmIntegrationProviders(createFarmNotFoundElement(pathname)),
|
|
8982
|
+
getFarmRendererRenderOptions()
|
|
8821
8983
|
)
|
|
8822
8984
|
) + streamSuffix;
|
|
8823
8985
|
} catch (error) {
|
|
@@ -8825,7 +8987,10 @@ async function handleFarmRequestInContext(
|
|
|
8825
8987
|
// needs their context cannot render alone, so use Farm's.
|
|
8826
8988
|
console.warn("not-found page could not render outside its layout, using Farm's:", error);
|
|
8827
8989
|
return createLateNotFoundRecovery(
|
|
8828
|
-
await ReactDOMServer.renderToString(
|
|
8990
|
+
await ReactDOMServer.renderToString(
|
|
8991
|
+
React.createElement(FarmDefault404Page),
|
|
8992
|
+
getFarmRendererRenderOptions()
|
|
8993
|
+
)
|
|
8829
8994
|
) + streamSuffix;
|
|
8830
8995
|
}
|
|
8831
8996
|
},
|
|
@@ -8874,7 +9039,7 @@ async function handleFarmRequestInContext(
|
|
|
8874
9039
|
);
|
|
8875
9040
|
fullHtml = html
|
|
8876
9041
|
// Inject CSS link after opening head tag or first meta tag
|
|
8877
|
-
.replace(/<head([^>]*)>/i, '<head
|
|
9042
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(html, route.clientModule); })
|
|
8878
9043
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
8879
9044
|
// Explicit metadata wins over renderer and layout titles. Without
|
|
8880
9045
|
// explicit metadata, a renderer title wins over the layout title.
|
|
@@ -8908,7 +9073,7 @@ async function handleFarmRequestInContext(
|
|
|
8908
9073
|
routeSlotPayload,
|
|
8909
9074
|
clientPageProps
|
|
8910
9075
|
) + '\\n' +
|
|
8911
|
-
'
|
|
9076
|
+
' ' + renderFarmClientEntryScript() + '\\n</body>',
|
|
8912
9077
|
);
|
|
8913
9078
|
|
|
8914
9079
|
// Last, so the charset (and the viewport, unless the layout wrote one) open the head.
|
|
@@ -8927,13 +9092,13 @@ async function handleFarmRequestInContext(
|
|
|
8927
9092
|
\${viewportTags}
|
|
8928
9093
|
\${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
8929
9094
|
\${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
|
|
8930
|
-
<link rel="stylesheet" href="/__farm_client_css_href__"
|
|
9095
|
+
<link rel="stylesheet" href="/__farm_client_css_href__">\${renderFarmClientModulePreloads(html, route.clientModule)}
|
|
8931
9096
|
\${renderFarmRendererHydrationScript()}
|
|
8932
9097
|
</head>
|
|
8933
9098
|
<body>
|
|
8934
9099
|
<div id="root">\${html}</div>
|
|
8935
9100
|
\${renderFarmClientBootstrapScript(pageProps.__farmCanonicalPath, routeSlotPayload, clientPageProps)}
|
|
8936
|
-
|
|
9101
|
+
\${renderFarmClientEntryScript()}
|
|
8937
9102
|
</body>
|
|
8938
9103
|
</html>\`;
|
|
8939
9104
|
}
|
|
@@ -9105,14 +9270,14 @@ async function handleFarmRequestInContext(
|
|
|
9105
9270
|
}
|
|
9106
9271
|
}
|
|
9107
9272
|
|
|
9108
|
-
const fallbackHtml = createDefaultErrorMarkup({
|
|
9273
|
+
const fallbackHtml = stampFarmCspNonce(createDefaultErrorMarkup({
|
|
9109
9274
|
statusCode: errorStatus,
|
|
9110
9275
|
statusText: errorStatusText,
|
|
9111
9276
|
requestPath: pathname,
|
|
9112
9277
|
method: request.method,
|
|
9113
9278
|
development: false,
|
|
9114
9279
|
mode: "production",
|
|
9115
|
-
});
|
|
9280
|
+
}));
|
|
9116
9281
|
const fallbackDocument = applyFarmThemeDocument(
|
|
9117
9282
|
applyFarmI18nDocument(
|
|
9118
9283
|
createFarmErrorDocument(
|
|
@@ -9144,7 +9309,7 @@ async function handleFarmRequestInContext(
|
|
|
9144
9309
|
${servesDefaultMCP ? `
|
|
9145
9310
|
// agent.mcp: no app route answered /mcp, so the default read-only server may.
|
|
9146
9311
|
if (
|
|
9147
|
-
normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
9312
|
+
normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkH5CLOUZScjs.FARM_DEFAULT_MCP_PATH)} &&
|
|
9148
9313
|
getFarmDefaultMCPServer()
|
|
9149
9314
|
) {
|
|
9150
9315
|
return applyProductionMiddlewareHeaders(
|
|
@@ -9199,7 +9364,7 @@ ${servesDefaultMCP ? `
|
|
|
9199
9364
|
}
|
|
9200
9365
|
notFoundElement = wrapWithFarmIntegrationProviders(notFoundElement);
|
|
9201
9366
|
|
|
9202
|
-
const html = await ReactDOMServer.renderToString(notFoundElement);
|
|
9367
|
+
const html = await ReactDOMServer.renderToString(notFoundElement, getFarmRendererRenderOptions());
|
|
9203
9368
|
// The layouts' and the not-found page's metadata, as the development renderer uses it.
|
|
9204
9369
|
const notFoundMetadata = renderMetadataHead(
|
|
9205
9370
|
await resolveFarmNotFoundMetadata(
|
|
@@ -9224,12 +9389,12 @@ ${servesDefaultMCP ? `
|
|
|
9224
9389
|
"<head" + attrs + ">" +
|
|
9225
9390
|
headContent.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "") +
|
|
9226
9391
|
"\\n <title>" + notFoundMetadata.title + "</title>" + notFoundMetadata.tags + "\\n</head>")
|
|
9227
|
-
.replace(/<head([^>]*)>/i, '<head
|
|
9392
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(fullDocument); })
|
|
9228
9393
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
9229
9394
|
.replace(
|
|
9230
9395
|
/<\\/body>/i,
|
|
9231
9396
|
() => ' ' + renderFarmClientBootstrapScript() + '\\n' +
|
|
9232
|
-
'
|
|
9397
|
+
' ' + renderFarmClientEntryScript() + '\\n</body>',
|
|
9233
9398
|
);
|
|
9234
9399
|
fullHtml = ensureFarmDocumentMeta(fullHtml, notFoundMetadata.viewport);
|
|
9235
9400
|
if (!fullHtml.trim().startsWith('<!DOCTYPE')) {
|
|
@@ -9242,14 +9407,14 @@ ${servesDefaultMCP ? `
|
|
|
9242
9407
|
<meta charset="UTF-8">
|
|
9243
9408
|
\${notFoundMetadata.viewport}
|
|
9244
9409
|
\${notFoundMetadata.hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
9245
|
-
<link rel="stylesheet" href="/__farm_client_css_href__"
|
|
9410
|
+
<link rel="stylesheet" href="/__farm_client_css_href__">\${renderFarmClientModulePreloads(html)}
|
|
9246
9411
|
<title>\${notFoundMetadata.title}</title>\${notFoundMetadata.tags}
|
|
9247
9412
|
\${renderFarmRendererHydrationScript()}
|
|
9248
9413
|
</head>
|
|
9249
9414
|
<body>
|
|
9250
9415
|
<div id="root">\${html}</div>
|
|
9251
9416
|
\${renderFarmClientBootstrapScript()}
|
|
9252
|
-
|
|
9417
|
+
\${renderFarmClientEntryScript()}
|
|
9253
9418
|
</body>
|
|
9254
9419
|
</html>\`;
|
|
9255
9420
|
}
|
|
@@ -9358,11 +9523,11 @@ ${generatePreloadResponseRuntimeSource()}
|
|
|
9358
9523
|
|
|
9359
9524
|
// Export as Web Standard fetch API
|
|
9360
9525
|
export async function fetch(request, context) {
|
|
9361
|
-
${_optionalChain([config, 'access',
|
|
9526
|
+
${_optionalChain([config, 'access', _170 => _170.agent, 'optionalAccess', _171 => _171.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
9362
9527
|
basePath: farmLocalAPIBasePath,
|
|
9363
9528
|
dispatch: async (localRequest) =>
|
|
9364
9529
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
9365
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
9530
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _172 => _172.agent, 'optionalAccess', _173 => _173.noindexPreviews]) ? `
|
|
9366
9531
|
// Keep every response of a preview deployment out of search indexes.
|
|
9367
9532
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
9368
9533
|
}
|
|
@@ -9383,6 +9548,9 @@ async function handleFarmFetch(request, context) {
|
|
|
9383
9548
|
() =>
|
|
9384
9549
|
runWithFarmRequestSpan(request, async () => {
|
|
9385
9550
|
const runtimeOptions = farmPluginRuntime ? getFarmPluginRequestOptions(request) : null;
|
|
9551
|
+
// Created before rendering so only scripts Farm, the renderer, or the
|
|
9552
|
+
// app (through getCspNonce()) give it carry the response nonce.
|
|
9553
|
+
const cspNonce = createFarmCspNonce(farmSecurityConfig);
|
|
9386
9554
|
const prepareResponse = async (runtimeRequest, responsePromise) => {
|
|
9387
9555
|
const response = await responsePromise;
|
|
9388
9556
|
// Headers need the path eagerly; preload reporting needs it only for
|
|
@@ -9394,6 +9562,7 @@ async function handleFarmFetch(request, context) {
|
|
|
9394
9562
|
applyFarmCspNonceToResponse(
|
|
9395
9563
|
applyConfiguredResponseHeaders(response, routePathname),
|
|
9396
9564
|
farmSecurityConfig,
|
|
9565
|
+
cspNonce,
|
|
9397
9566
|
),
|
|
9398
9567
|
routePathname,
|
|
9399
9568
|
runtimeRequest,
|
|
@@ -9426,7 +9595,7 @@ async function handleFarmFetch(request, context) {
|
|
|
9426
9595
|
: ` : ""}prepareResponse(request, handleFarmRequest(request, context));
|
|
9427
9596
|
|
|
9428
9597
|
const response = await _runWithCurrentRequest(request, () =>
|
|
9429
|
-
_runWithAfterRequest(request, runRequest, context),
|
|
9598
|
+
_runWithFarmCspNonce(cspNonce, () => _runWithAfterRequest(request, runRequest, context)),
|
|
9430
9599
|
);
|
|
9431
9600
|
return ${hasCompressionRuntime && !hasPluginRuntime ? "compressFarmResponse(request, response, getFarmOwnedBufferedHtml(response), farmLazyBufferedHtml.has(response))" : "response"};
|
|
9432
9601
|
}),
|
|
@@ -9501,26 +9670,6 @@ function middlewarePatternMatches(pattern, pathname) {
|
|
|
9501
9670
|
return new RegExp(`^${expression}/?$`).test(pathname);
|
|
9502
9671
|
}
|
|
9503
9672
|
_chunkS3JO3N4Hcjs.__name.call(void 0, middlewarePatternMatches, "middlewarePatternMatches");
|
|
9504
|
-
function configMiddlewareMayHandlePath(config, pathname) {
|
|
9505
|
-
if (!hasFarmMiddlewareConfig(config)) return false;
|
|
9506
|
-
const entries = Array.isArray(config) ? config : [config];
|
|
9507
|
-
return entries.some((entry) => {
|
|
9508
|
-
if (!entry.matcher && !entry.exclude) return true;
|
|
9509
|
-
const matchers = entry.matcher ? (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).map(
|
|
9510
|
-
(matcher) => (
|
|
9511
|
-
// A request-aware matcher cannot be proven safe at build time.
|
|
9512
|
-
typeof matcher === "function" ? () => true : matcher
|
|
9513
|
-
)
|
|
9514
|
-
) : void 0;
|
|
9515
|
-
const compiled = _chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, { matcher: matchers, exclude: entry.exclude });
|
|
9516
|
-
return _chunkZ2HLU4IXcjs.matchesCompiledMiddlewareConfig.call(void 0, pathname, compiled, {}).matched;
|
|
9517
|
-
});
|
|
9518
|
-
}
|
|
9519
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, configMiddlewareMayHandlePath, "configMiddlewareMayHandlePath");
|
|
9520
|
-
function appMiddlewareMayHandlePath(middlewareRoutes, pathname) {
|
|
9521
|
-
return middlewareRoutes.some((route) => _chunkZ2HLU4IXcjs.matchesMiddlewareRoute.call(void 0, pathname, route).matched);
|
|
9522
|
-
}
|
|
9523
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, appMiddlewareMayHandlePath, "appMiddlewareMayHandlePath");
|
|
9524
9673
|
function routePatternSpecificity(pattern) {
|
|
9525
9674
|
return pattern.split("/").filter(Boolean).reduce((score, segment) => {
|
|
9526
9675
|
if (segment === "**" || segment.startsWith("[[...")) return score + 1;
|
|
@@ -9556,13 +9705,13 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
9556
9705
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
9557
9706
|
return "rewrite";
|
|
9558
9707
|
}
|
|
9559
|
-
if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
|
|
9560
|
-
if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
|
|
9561
|
-
if (
|
|
9708
|
+
if (_chunk2DD4JMQCcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
9709
|
+
if (_chunk2DD4JMQCcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
9710
|
+
if (_chunkQ3NXS4MUcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
9562
9711
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
9563
9712
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
9564
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
9565
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
9713
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _174 => _174.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
9714
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _175 => _175.regions, 'optionalAccess', _176 => _176.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
9566
9715
|
return "route runtime controls";
|
|
9567
9716
|
}
|
|
9568
9717
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -9576,7 +9725,7 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
9576
9725
|
}
|
|
9577
9726
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getPhysicalPrerenderBypassReason, "getPhysicalPrerenderBypassReason");
|
|
9578
9727
|
async function buildNitroUniversal(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, ssrBundle, ssrEntryFile, clientOutputDir, routeRuntimeManifest, configuredHeaderRoutes, nitroBuilderResultPromise, pluginManager) {
|
|
9579
|
-
const [
|
|
9728
|
+
const [fs3, nitroBuilderResult] = await Promise.all([
|
|
9580
9729
|
import("fs/promises"),
|
|
9581
9730
|
nitroBuilderResultPromise
|
|
9582
9731
|
]);
|
|
@@ -9584,7 +9733,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9584
9733
|
const nitroBuilder = nitroBuilderResult.value;
|
|
9585
9734
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
9586
9735
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
9587
|
-
const outputDir =
|
|
9736
|
+
const outputDir = _chunkQ3NXS4MUcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
9588
9737
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
9589
9738
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
9590
9739
|
const imageRuntime = resolveImageRuntime(config, preset);
|
|
@@ -9655,12 +9804,22 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9655
9804
|
}
|
|
9656
9805
|
const scheduledTasks = _chunk6EXBPJ24cjs.mergeScheduledTasks.call(void 0, farmWorkflows.scheduledTasks, farmCron.scheduledTasks);
|
|
9657
9806
|
const cloudflareCronConfig = _chunk6EXBPJ24cjs.createFarmCronCloudflareConfig.call(void 0, farmCron.jobs);
|
|
9658
|
-
const [clientCssHref, clientJsSrc] = await Promise.all([
|
|
9807
|
+
const [clientCssHref, clientJsSrc, docsModulePreloads, clientModulePreloads] = await Promise.all([
|
|
9659
9808
|
resolveHashedClientCssHref(clientOutputDir),
|
|
9660
|
-
resolveHashedClientJsSrc(clientOutputDir)
|
|
9809
|
+
resolveHashedClientJsSrc(clientOutputDir),
|
|
9810
|
+
readFarmDocsModulePreloads(_path2.default.join(root, distDir)),
|
|
9811
|
+
readFarmClientModulePreloads(_path2.default.join(root, distDir))
|
|
9661
9812
|
]);
|
|
9813
|
+
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
9814
|
+
const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
|
|
9662
9815
|
for (const output of Object.values(ssrBundle)) {
|
|
9663
9816
|
if (output.type !== "chunk") continue;
|
|
9817
|
+
if (output.code.includes(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER)) {
|
|
9818
|
+
output.code = output.code.split(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER).join(encodedDocsModulePreloads);
|
|
9819
|
+
}
|
|
9820
|
+
if (output.code.includes(FARM_CLIENT_MODULE_PRELOADS_PLACEHOLDER)) {
|
|
9821
|
+
output.code = output.code.split(FARM_CLIENT_MODULE_PRELOADS_PLACEHOLDER).join(encodedClientModulePreloads);
|
|
9822
|
+
}
|
|
9664
9823
|
if (output.code.includes(FARM_CLIENT_CSS_HREF_PLACEHOLDER)) {
|
|
9665
9824
|
output.code = output.code.split(FARM_CLIENT_CSS_HREF_PLACEHOLDER).join(clientCssHref);
|
|
9666
9825
|
}
|
|
@@ -9668,11 +9827,11 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9668
9827
|
output.code = output.code.split(FARM_CLIENT_JS_SRC_PLACEHOLDER).join(clientJsSrc);
|
|
9669
9828
|
}
|
|
9670
9829
|
}
|
|
9671
|
-
await
|
|
9830
|
+
await fs3.mkdir(ssrOutputDir, { recursive: true });
|
|
9672
9831
|
for (const [fileName, output] of Object.entries(ssrBundle)) {
|
|
9673
9832
|
const filePath = _path2.default.join(ssrOutputDir, fileName);
|
|
9674
|
-
await
|
|
9675
|
-
await
|
|
9833
|
+
await fs3.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
9834
|
+
await fs3.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
|
|
9676
9835
|
}
|
|
9677
9836
|
const nitroEntryPath = _path2.default.join(ssrOutputDir, "nitro-entry.mjs");
|
|
9678
9837
|
const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
|
|
@@ -9826,16 +9985,16 @@ function toFarmNodeResponse(request, response) {
|
|
|
9826
9985
|
})
|
|
9827
9986
|
}` : ""}
|
|
9828
9987
|
`.trim();
|
|
9829
|
-
await
|
|
9988
|
+
await fs3.writeFile(nitroEntryPath, nitroEntryCode);
|
|
9830
9989
|
const farmNodeServerEntryPath = preset === "node-server" ? _path2.default.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
|
|
9831
9990
|
if (farmNodeServerEntryPath && nodeAdapterModule) {
|
|
9832
|
-
await
|
|
9833
|
-
_path2.default.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
|
|
9834
|
-
FARM_NODE_ENV_MODULE_SOURCE
|
|
9991
|
+
await fs3.writeFile(
|
|
9992
|
+
_path2.default.join(ssrOutputDir, _chunkWW46B6HAcjs.FARM_NODE_ENV_MODULE_FILE),
|
|
9993
|
+
_chunkWW46B6HAcjs.FARM_NODE_ENV_MODULE_SOURCE
|
|
9835
9994
|
);
|
|
9836
|
-
await
|
|
9995
|
+
await fs3.writeFile(
|
|
9837
9996
|
farmNodeServerEntryPath,
|
|
9838
|
-
createFarmNodeServerEntry({
|
|
9997
|
+
_chunkWW46B6HAcjs.createFarmNodeServerEntry.call(void 0, {
|
|
9839
9998
|
nitroEntryFile: _path2.default.basename(nitroEntryPath),
|
|
9840
9999
|
nodeAdapterModule,
|
|
9841
10000
|
server: config.server,
|
|
@@ -9845,7 +10004,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
9845
10004
|
}
|
|
9846
10005
|
const farmNetlifyEntryPath = preset === "netlify" ? _path2.default.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
|
|
9847
10006
|
if (farmNetlifyEntryPath) {
|
|
9848
|
-
await
|
|
10007
|
+
await fs3.writeFile(
|
|
9849
10008
|
farmNetlifyEntryPath,
|
|
9850
10009
|
createFarmNetlifyEntry({
|
|
9851
10010
|
nitroNetlifyEntry: resolveNitroNetlifyEntry(resolveNitroPackageEntry(root))
|
|
@@ -9974,20 +10133,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
9974
10133
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
9975
10134
|
);
|
|
9976
10135
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
9977
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
9978
|
-
_optionalChain([nitroConfig, 'access',
|
|
9979
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
10136
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _177 => _177.rollupConfig, 'optionalAccess', _178 => _178.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _179 => _179.rollupConfig, 'optionalAccess', _180 => _180.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _181 => _181.output, 'optionalAccess', _182 => _182.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
10137
|
+
_optionalChain([nitroConfig, 'access', _183 => _183.handlers, 'optionalAccess', _184 => _184.some, 'call', _185 => _185(
|
|
10138
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _186 => _186.handler]) || "") === nitroEntryPath
|
|
9980
10139
|
)])
|
|
9981
10140
|
);
|
|
9982
10141
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
9983
10142
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
9984
10143
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
9985
10144
|
const shouldMinify = nitroConfig.minify !== false;
|
|
9986
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
10145
|
+
const keepServerNames = !(_optionalChain([config, 'access', _187 => _187.docs, 'optionalAccess', _188 => _188.enabled]) && _optionalChain([config, 'access', _189 => _189.docs, 'access', _190 => _190.adapter, 'optionalAccess', _191 => _191.server]));
|
|
9987
10146
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
9988
10147
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
9989
10148
|
if (canReusePrebuiltSSR) {
|
|
9990
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
10149
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _192 => _192.rollupConfig, 'optionalAccess', _193 => _193.plugins]);
|
|
9991
10150
|
nitroConfig.rollupConfig = {
|
|
9992
10151
|
...nitroConfig.rollupConfig,
|
|
9993
10152
|
plugins: [
|
|
@@ -9998,10 +10157,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
9998
10157
|
}
|
|
9999
10158
|
nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
|
|
10000
10159
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
10001
|
-
if (_optionalChain([config, 'access',
|
|
10160
|
+
if (_optionalChain([config, 'access', _194 => _194.md, 'optionalAccess', _195 => _195.enabled])) {
|
|
10002
10161
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
10003
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
10004
|
-
const alternatePath =
|
|
10162
|
+
if (!route.contents || !_optionalChain([route, 'access', _196 => _196.contentType, 'optionalAccess', _197 => _197.toLowerCase, 'call', _198 => _198(), 'access', _199 => _199.includes, 'call', _200 => _200("html")])) return;
|
|
10163
|
+
const alternatePath = _chunkSGBJ247Qcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
|
|
10005
10164
|
if (!alternatePath) return;
|
|
10006
10165
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
10007
10166
|
const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
@@ -10021,8 +10180,8 @@ function toFarmNodeResponse(request, response) {
|
|
|
10021
10180
|
}
|
|
10022
10181
|
if (config.security.csp && config.security.csp.nonce) {
|
|
10023
10182
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
10024
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
10025
|
-
const staticCsp = await
|
|
10183
|
+
if (!route.contents || !_optionalChain([route, 'access', _201 => _201.contentType, 'optionalAccess', _202 => _202.toLowerCase, 'call', _203 => _203(), 'access', _204 => _204.includes, 'call', _205 => _205("html")])) return;
|
|
10184
|
+
const staticCsp = await _chunk2ZYGC6SScjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
10026
10185
|
if (!staticCsp) return;
|
|
10027
10186
|
route.contents = staticCsp.html;
|
|
10028
10187
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
@@ -10068,9 +10227,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
10068
10227
|
ssrBundle,
|
|
10069
10228
|
_path2.default.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
|
|
10070
10229
|
null,
|
|
10071
|
-
|
|
10230
|
+
fs3
|
|
10072
10231
|
);
|
|
10073
|
-
await registerPrebuiltSSRPackageImport(prerenderServerDir, ssrEntryFile,
|
|
10232
|
+
await registerPrebuiltSSRPackageImport(prerenderServerDir, ssrEntryFile, fs3);
|
|
10074
10233
|
});
|
|
10075
10234
|
});
|
|
10076
10235
|
}
|
|
@@ -10092,16 +10251,16 @@ function toFarmNodeResponse(request, response) {
|
|
|
10092
10251
|
}
|
|
10093
10252
|
if (prerenderRoutes.length > 0) {
|
|
10094
10253
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
10095
|
-
const previousPrerender = process.env[
|
|
10096
|
-
process.env[
|
|
10254
|
+
const previousPrerender = process.env[_chunkWXJLNP33cjs.FARM_PRERENDER_ENV];
|
|
10255
|
+
process.env[_chunkWXJLNP33cjs.FARM_PRERENDER_ENV] = "1";
|
|
10097
10256
|
try {
|
|
10098
10257
|
await nitroBuilder.prerender(nitroInstance);
|
|
10099
10258
|
} finally {
|
|
10100
|
-
if (previousPrerender === void 0) delete process.env[
|
|
10101
|
-
else process.env[
|
|
10259
|
+
if (previousPrerender === void 0) delete process.env[_chunkWXJLNP33cjs.FARM_PRERENDER_ENV];
|
|
10260
|
+
else process.env[_chunkWXJLNP33cjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
10102
10261
|
}
|
|
10103
10262
|
}
|
|
10104
|
-
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir,
|
|
10263
|
+
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs3, preset) : Promise.resolve(null);
|
|
10105
10264
|
const prebuiltSSRFilesPromise = canReusePrebuiltSSR ? prepareSSRBundleFiles(
|
|
10106
10265
|
ssrBundle,
|
|
10107
10266
|
shouldMinify ? { keepNames: keepServerNames, target: "node18" } : null
|
|
@@ -10114,7 +10273,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10114
10273
|
await nitroInstance.close();
|
|
10115
10274
|
if (nitroBuildResult.status === "rejected") {
|
|
10116
10275
|
if (sharpRuntimeStageResult.status === "fulfilled" && sharpRuntimeStageResult.value) {
|
|
10117
|
-
await
|
|
10276
|
+
await fs3.rm(sharpRuntimeStageResult.value.stageDir, {
|
|
10118
10277
|
recursive: true,
|
|
10119
10278
|
force: true
|
|
10120
10279
|
});
|
|
@@ -10127,20 +10286,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
10127
10286
|
if (prebuiltSSRFilesResult.status === "rejected") {
|
|
10128
10287
|
throw prebuiltSSRFilesResult.reason;
|
|
10129
10288
|
}
|
|
10130
|
-
const stagedSharpRuntime = await _asyncNullishCoalesce(sharpRuntimeStageResult.value, async () => ( (imageRuntime === "node" ? await stageSharpRuntime(config, root, distDir,
|
|
10289
|
+
const stagedSharpRuntime = await _asyncNullishCoalesce(sharpRuntimeStageResult.value, async () => ( (imageRuntime === "node" ? await stageSharpRuntime(config, root, distDir, fs3, preset) : null)));
|
|
10131
10290
|
const runtimeCopyPromise = (async () => {
|
|
10132
10291
|
if (stagedSharpRuntime) {
|
|
10133
|
-
await installStagedSharpRuntime(stagedSharpRuntime, runtimeServerOutputDir,
|
|
10292
|
+
await installStagedSharpRuntime(stagedSharpRuntime, runtimeServerOutputDir, fs3);
|
|
10134
10293
|
}
|
|
10135
10294
|
if (useExternalMetadataImageRuntime) {
|
|
10136
|
-
await copyMetadataImageRuntime(root, runtimeServerOutputDir,
|
|
10295
|
+
await copyMetadataImageRuntime(root, runtimeServerOutputDir, fs3);
|
|
10137
10296
|
}
|
|
10138
10297
|
})();
|
|
10139
10298
|
const copyResults = await Promise.allSettled([
|
|
10140
10299
|
prebuiltSSRFilesResult.value ? writeSSRBundleFiles(
|
|
10141
10300
|
prebuiltSSRFilesResult.value,
|
|
10142
10301
|
_path2.default.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
|
|
10143
|
-
|
|
10302
|
+
fs3
|
|
10144
10303
|
) : Promise.resolve(),
|
|
10145
10304
|
runtimeCopyPromise
|
|
10146
10305
|
]);
|
|
@@ -10149,7 +10308,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10149
10308
|
);
|
|
10150
10309
|
if (failedCopy) throw failedCopy.reason;
|
|
10151
10310
|
if (canReusePrebuiltSSR) {
|
|
10152
|
-
await registerPrebuiltSSRPackageImport(_path2.default.join(outputDir, "server"), ssrEntryFile,
|
|
10311
|
+
await registerPrebuiltSSRPackageImport(_path2.default.join(outputDir, "server"), ssrEntryFile, fs3);
|
|
10153
10312
|
_chunk5QIKR7RRcjs.logger.info("\u26A1 Reused Farm's prebuilt SSR bundle for the Node output");
|
|
10154
10313
|
}
|
|
10155
10314
|
if (useRolldownBuilder) {
|
|
@@ -10164,7 +10323,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10164
10323
|
});
|
|
10165
10324
|
}
|
|
10166
10325
|
if (isVercel) {
|
|
10167
|
-
await postProcessVercelOutput(root, outputDir,
|
|
10326
|
+
await postProcessVercelOutput(root, outputDir, fs3, config, farmWorkflows, routeRuntimeManifest);
|
|
10168
10327
|
}
|
|
10169
10328
|
_chunk5QIKR7RRcjs.logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
|
|
10170
10329
|
}
|
|
@@ -10192,24 +10351,24 @@ function prepareSSRBundleFiles(ssrBundle, minifyOptions) {
|
|
|
10192
10351
|
);
|
|
10193
10352
|
}
|
|
10194
10353
|
_chunkS3JO3N4Hcjs.__name.call(void 0, prepareSSRBundleFiles, "prepareSSRBundleFiles");
|
|
10195
|
-
async function writeSSRBundleFiles(files, targetDir,
|
|
10196
|
-
await
|
|
10354
|
+
async function writeSSRBundleFiles(files, targetDir, fs3) {
|
|
10355
|
+
await fs3.rm(targetDir, { recursive: true, force: true });
|
|
10197
10356
|
await Promise.all(
|
|
10198
10357
|
files.map(async ({ fileName, contents }) => {
|
|
10199
10358
|
const targetPath = _path2.default.join(targetDir, fileName);
|
|
10200
|
-
await
|
|
10201
|
-
await
|
|
10359
|
+
await fs3.mkdir(_path2.default.dirname(targetPath), { recursive: true });
|
|
10360
|
+
await fs3.writeFile(targetPath, contents);
|
|
10202
10361
|
})
|
|
10203
10362
|
);
|
|
10204
10363
|
}
|
|
10205
10364
|
_chunkS3JO3N4Hcjs.__name.call(void 0, writeSSRBundleFiles, "writeSSRBundleFiles");
|
|
10206
|
-
async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions,
|
|
10207
|
-
await writeSSRBundleFiles(await prepareSSRBundleFiles(ssrBundle, minifyOptions), targetDir,
|
|
10365
|
+
async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs3) {
|
|
10366
|
+
await writeSSRBundleFiles(await prepareSSRBundleFiles(ssrBundle, minifyOptions), targetDir, fs3);
|
|
10208
10367
|
}
|
|
10209
10368
|
_chunkS3JO3N4Hcjs.__name.call(void 0, copyPrebuiltSSRBundle, "copyPrebuiltSSRBundle");
|
|
10210
|
-
async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile,
|
|
10369
|
+
async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs3) {
|
|
10211
10370
|
const packagePath = _path2.default.join(serverDir, "package.json");
|
|
10212
|
-
const packageJSON = await
|
|
10371
|
+
const packageJSON = await fs3.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
|
|
10213
10372
|
if (error.code === "ENOENT") return { type: "module" };
|
|
10214
10373
|
throw error;
|
|
10215
10374
|
});
|
|
@@ -10219,54 +10378,54 @@ async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs) {
|
|
|
10219
10378
|
...existingImports,
|
|
10220
10379
|
[FARM_SSR_PACKAGE_IMPORT]: `./${outputEntry}`
|
|
10221
10380
|
};
|
|
10222
|
-
await
|
|
10223
|
-
await
|
|
10381
|
+
await fs3.mkdir(serverDir, { recursive: true });
|
|
10382
|
+
await fs3.writeFile(packagePath, `${JSON.stringify(packageJSON, null, 2)}
|
|
10224
10383
|
`);
|
|
10225
10384
|
}
|
|
10226
10385
|
_chunkS3JO3N4Hcjs.__name.call(void 0, registerPrebuiltSSRPackageImport, "registerPrebuiltSSRPackageImport");
|
|
10227
|
-
async function moveVercelOutputPath(src, dest,
|
|
10386
|
+
async function moveVercelOutputPath(src, dest, fs3) {
|
|
10228
10387
|
try {
|
|
10229
|
-
await
|
|
10388
|
+
await fs3.rename(src, dest);
|
|
10230
10389
|
return;
|
|
10231
10390
|
} catch (error) {
|
|
10232
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
10391
|
+
const code = _optionalChain([error, 'optionalAccess', _206 => _206.code]);
|
|
10233
10392
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
10234
10393
|
throw error;
|
|
10235
10394
|
}
|
|
10236
10395
|
}
|
|
10237
|
-
await
|
|
10238
|
-
await
|
|
10396
|
+
await fs3.cp(src, dest, { recursive: true, force: true });
|
|
10397
|
+
await fs3.rm(src, { recursive: true, force: true });
|
|
10239
10398
|
}
|
|
10240
10399
|
_chunkS3JO3N4Hcjs.__name.call(void 0, moveVercelOutputPath, "moveVercelOutputPath");
|
|
10241
|
-
async function postProcessVercelOutput(root, outputDir,
|
|
10400
|
+
async function postProcessVercelOutput(root, outputDir, fs3, config, farmWorkflows, routeRuntimeManifest) {
|
|
10242
10401
|
const serverDir = _path2.default.join(outputDir, "server");
|
|
10243
10402
|
const functionsDir = _path2.default.join(outputDir, "functions");
|
|
10244
10403
|
const nitroFuncDir = _path2.default.join(functionsDir, "__nitro.func");
|
|
10245
10404
|
const staticDir = _path2.default.join(outputDir, "static");
|
|
10246
10405
|
const publicDir = _path2.default.join(outputDir, "public");
|
|
10247
|
-
await
|
|
10248
|
-
const serverContents = await
|
|
10406
|
+
await fs3.mkdir(nitroFuncDir, { recursive: true });
|
|
10407
|
+
const serverContents = await fs3.readdir(serverDir).catch((error) => {
|
|
10249
10408
|
if (error.code === "ENOENT") return [];
|
|
10250
10409
|
throw error;
|
|
10251
10410
|
});
|
|
10252
10411
|
for (const file of serverContents) {
|
|
10253
|
-
await moveVercelOutputPath(_path2.default.join(serverDir, file), _path2.default.join(nitroFuncDir, file),
|
|
10412
|
+
await moveVercelOutputPath(_path2.default.join(serverDir, file), _path2.default.join(nitroFuncDir, file), fs3);
|
|
10254
10413
|
}
|
|
10255
|
-
if (serverContents.length > 0) await
|
|
10414
|
+
if (serverContents.length > 0) await fs3.rm(serverDir, { recursive: true, force: true });
|
|
10256
10415
|
try {
|
|
10257
|
-
await moveVercelOutputPath(publicDir, staticDir,
|
|
10416
|
+
await moveVercelOutputPath(publicDir, staticDir, fs3);
|
|
10258
10417
|
} catch (error) {
|
|
10259
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
10418
|
+
if (_optionalChain([error, 'optionalAccess', _207 => _207.code]) !== "ENOENT") throw error;
|
|
10260
10419
|
}
|
|
10261
|
-
await copyFarmDocsContentForVercel(config, root, nitroFuncDir,
|
|
10262
|
-
await copyPrismaClientForVercel(root, nitroFuncDir,
|
|
10420
|
+
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs3);
|
|
10421
|
+
await copyPrismaClientForVercel(root, nitroFuncDir, fs3);
|
|
10263
10422
|
const configPath = _path2.default.join(outputDir, "config.json");
|
|
10264
|
-
const configContent = await
|
|
10423
|
+
const configContent = await fs3.readFile(configPath, "utf-8");
|
|
10265
10424
|
const vercelConfig = JSON.parse(configContent);
|
|
10266
10425
|
const runtimeRoutes = await createFarmVercelRouteRuntimeFunctions(
|
|
10267
10426
|
outputDir,
|
|
10268
10427
|
routeRuntimeManifest,
|
|
10269
|
-
|
|
10428
|
+
fs3,
|
|
10270
10429
|
config.basePath
|
|
10271
10430
|
);
|
|
10272
10431
|
vercelConfig.routes = buildFarmVercelRoutes({
|
|
@@ -10281,25 +10440,25 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
|
|
|
10281
10440
|
vercelConfigWithWorkflowCrons,
|
|
10282
10441
|
config.cron.jobs
|
|
10283
10442
|
);
|
|
10284
|
-
await
|
|
10443
|
+
await fs3.writeFile(configPath, JSON.stringify(vercelConfigWithCrons, null, 2));
|
|
10285
10444
|
_chunk5QIKR7RRcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
10286
10445
|
}
|
|
10287
10446
|
_chunkS3JO3N4Hcjs.__name.call(void 0, postProcessVercelOutput, "postProcessVercelOutput");
|
|
10288
|
-
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir,
|
|
10447
|
+
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs3) {
|
|
10289
10448
|
const docsContentDir = resolveBuildDocsContentDir(config, root);
|
|
10290
10449
|
if (!docsContentDir) return;
|
|
10291
10450
|
const bundledContentDir = _path2.default.join(nitroFuncDir, "farm-docs-content");
|
|
10292
|
-
const lastModifiedManifest =
|
|
10451
|
+
const lastModifiedManifest = _chunkPGZDEPTMcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
10293
10452
|
fallback: "now"
|
|
10294
10453
|
});
|
|
10295
|
-
await
|
|
10296
|
-
await
|
|
10297
|
-
await
|
|
10454
|
+
await fs3.rm(bundledContentDir, { recursive: true, force: true });
|
|
10455
|
+
await fs3.mkdir(_path2.default.dirname(bundledContentDir), { recursive: true });
|
|
10456
|
+
await fs3.cp(docsContentDir, bundledContentDir, {
|
|
10298
10457
|
recursive: true,
|
|
10299
10458
|
force: true
|
|
10300
10459
|
});
|
|
10301
|
-
await
|
|
10302
|
-
_path2.default.join(bundledContentDir,
|
|
10460
|
+
await fs3.writeFile(
|
|
10461
|
+
_path2.default.join(bundledContentDir, _chunkPGZDEPTMcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
10303
10462
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
10304
10463
|
`
|
|
10305
10464
|
);
|
|
@@ -10322,21 +10481,21 @@ function platformFieldAllows(field, value) {
|
|
|
10322
10481
|
return allowed.length === 0 || allowed.includes(value);
|
|
10323
10482
|
}
|
|
10324
10483
|
_chunkS3JO3N4Hcjs.__name.call(void 0, platformFieldAllows, "platformFieldAllows");
|
|
10325
|
-
async function stageSharpRuntime(config, root, distDir,
|
|
10484
|
+
async function stageSharpRuntime(config, root, distDir, fs3, preset) {
|
|
10326
10485
|
const functionPlatform = resolveServerFunctionPlatform(preset);
|
|
10327
10486
|
const projectRequire = _module.createRequire.call(void 0, _path2.default.join(root, "package.json"));
|
|
10328
10487
|
let sharpRequire = projectRequire;
|
|
10329
10488
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
10330
10489
|
try {
|
|
10331
10490
|
sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
10332
|
-
} catch (
|
|
10491
|
+
} catch (e27) {
|
|
10333
10492
|
}
|
|
10334
10493
|
}
|
|
10335
10494
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
10336
10495
|
const packageCopies = /* @__PURE__ */ new Map();
|
|
10337
10496
|
const stageRoot = _path2.default.join(root, distDir, "tmp");
|
|
10338
|
-
await
|
|
10339
|
-
const stageDir = await
|
|
10497
|
+
await fs3.mkdir(stageRoot, { recursive: true });
|
|
10498
|
+
const stageDir = await fs3.mkdtemp(_path2.default.join(stageRoot, "sharp-runtime-"));
|
|
10340
10499
|
const targetNodeModules = _path2.default.join(stageDir, "node_modules");
|
|
10341
10500
|
function copyPackage(packageName, parentRequire) {
|
|
10342
10501
|
const activeCopy = packageCopies.get(packageName);
|
|
@@ -10349,19 +10508,19 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
|
|
|
10349
10508
|
async function copyPackageOnce(packageName, parentRequire) {
|
|
10350
10509
|
const packageJsonPath = resolvePackageJson(parentRequire, packageName);
|
|
10351
10510
|
if (!packageJsonPath) return;
|
|
10352
|
-
const packageJson = JSON.parse(await
|
|
10511
|
+
const packageJson = JSON.parse(await fs3.readFile(packageJsonPath, "utf8"));
|
|
10353
10512
|
if (functionPlatform && !packageSupportsPlatform(packageJson, functionPlatform)) return;
|
|
10354
10513
|
const packageDir = _path2.default.dirname(packageJsonPath);
|
|
10355
10514
|
const targetDir = _path2.default.join(targetNodeModules, ...packageName.split("/"));
|
|
10356
10515
|
copiedPackages.set(packageName, String(packageJson.version || "*"));
|
|
10357
|
-
await
|
|
10516
|
+
await fs3.mkdir(_path2.default.dirname(targetDir), { recursive: true });
|
|
10358
10517
|
const packageRequire = _module.createRequire.call(void 0, packageJsonPath);
|
|
10359
10518
|
const dependencies = {
|
|
10360
10519
|
...packageJson.dependencies,
|
|
10361
10520
|
...packageJson.optionalDependencies
|
|
10362
10521
|
};
|
|
10363
10522
|
await settleAllOrThrow([
|
|
10364
|
-
|
|
10523
|
+
fs3.cp(packageDir, targetDir, {
|
|
10365
10524
|
recursive: true,
|
|
10366
10525
|
force: true,
|
|
10367
10526
|
dereference: true,
|
|
@@ -10376,10 +10535,10 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
|
|
|
10376
10535
|
try {
|
|
10377
10536
|
await copyPackage("sharp", sharpRequire);
|
|
10378
10537
|
if (!copiedPackages.has("sharp")) {
|
|
10379
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
10538
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkYR2VBEMOcjs.SHARP_INSTALL_HINT}`);
|
|
10380
10539
|
}
|
|
10381
10540
|
} catch (error) {
|
|
10382
|
-
await
|
|
10541
|
+
await fs3.rm(stageDir, { recursive: true, force: true });
|
|
10383
10542
|
throw error;
|
|
10384
10543
|
}
|
|
10385
10544
|
return {
|
|
@@ -10390,19 +10549,19 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
|
|
|
10390
10549
|
};
|
|
10391
10550
|
}
|
|
10392
10551
|
_chunkS3JO3N4Hcjs.__name.call(void 0, stageSharpRuntime, "stageSharpRuntime");
|
|
10393
|
-
async function installStagedSharpRuntime(staged, nitroFuncDir,
|
|
10552
|
+
async function installStagedSharpRuntime(staged, nitroFuncDir, fs3) {
|
|
10394
10553
|
const stagedNodeModules = _path2.default.join(staged.stageDir, "node_modules");
|
|
10395
10554
|
const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
|
|
10396
10555
|
try {
|
|
10397
|
-
await mergeStagedDirectory(stagedNodeModules, targetNodeModules,
|
|
10398
|
-
const functionPackage = await readNitroOutputPackage(nitroFuncDir,
|
|
10556
|
+
await mergeStagedDirectory(stagedNodeModules, targetNodeModules, fs3);
|
|
10557
|
+
const functionPackage = await readNitroOutputPackage(nitroFuncDir, fs3);
|
|
10399
10558
|
functionPackage.dependencies = {
|
|
10400
10559
|
...functionPackage.dependencies,
|
|
10401
10560
|
...staged.dependencies
|
|
10402
10561
|
};
|
|
10403
|
-
await writeNitroOutputPackage(nitroFuncDir, functionPackage,
|
|
10562
|
+
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs3);
|
|
10404
10563
|
} finally {
|
|
10405
|
-
await
|
|
10564
|
+
await fs3.rm(staged.stageDir, { recursive: true, force: true });
|
|
10406
10565
|
}
|
|
10407
10566
|
_chunk5QIKR7RRcjs.logger.info(
|
|
10408
10567
|
`\u{1F5BC}\uFE0F Bundled Sharp image runtime (${Object.keys(staged.dependencies).length} packages)`
|
|
@@ -10417,15 +10576,15 @@ async function settleAllOrThrow(operations) {
|
|
|
10417
10576
|
if (failure) throw failure.reason;
|
|
10418
10577
|
}
|
|
10419
10578
|
_chunkS3JO3N4Hcjs.__name.call(void 0, settleAllOrThrow, "settleAllOrThrow");
|
|
10420
|
-
async function mergeStagedDirectory(sourceDir, targetDir,
|
|
10421
|
-
await
|
|
10422
|
-
const entries = await
|
|
10579
|
+
async function mergeStagedDirectory(sourceDir, targetDir, fs3) {
|
|
10580
|
+
await fs3.mkdir(targetDir, { recursive: true });
|
|
10581
|
+
const entries = await fs3.readdir(sourceDir, { withFileTypes: true });
|
|
10423
10582
|
await settleAllOrThrow(
|
|
10424
10583
|
entries.map(async (entry) => {
|
|
10425
10584
|
const sourcePath = _path2.default.join(sourceDir, entry.name);
|
|
10426
10585
|
const targetPath = _path2.default.join(targetDir, entry.name);
|
|
10427
10586
|
try {
|
|
10428
|
-
await
|
|
10587
|
+
await fs3.rename(sourcePath, targetPath);
|
|
10429
10588
|
return;
|
|
10430
10589
|
} catch (error) {
|
|
10431
10590
|
const code = error.code;
|
|
@@ -10434,16 +10593,16 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs) {
|
|
|
10434
10593
|
}
|
|
10435
10594
|
}
|
|
10436
10595
|
if (entry.isDirectory()) {
|
|
10437
|
-
await mergeStagedDirectory(sourcePath, targetPath,
|
|
10438
|
-
await
|
|
10596
|
+
await mergeStagedDirectory(sourcePath, targetPath, fs3);
|
|
10597
|
+
await fs3.rm(sourcePath, { recursive: true, force: true });
|
|
10439
10598
|
return;
|
|
10440
10599
|
}
|
|
10441
|
-
await
|
|
10600
|
+
await fs3.cp(sourcePath, targetPath, {
|
|
10442
10601
|
force: true,
|
|
10443
10602
|
dereference: true,
|
|
10444
10603
|
mode: _fs.constants.COPYFILE_FICLONE
|
|
10445
10604
|
});
|
|
10446
|
-
await
|
|
10605
|
+
await fs3.rm(sourcePath, { force: true });
|
|
10447
10606
|
})
|
|
10448
10607
|
);
|
|
10449
10608
|
}
|
|
@@ -10463,44 +10622,44 @@ function resolveMetadataImageRuntimePackageJson(root) {
|
|
|
10463
10622
|
if (packageJsonPath) return packageJsonPath;
|
|
10464
10623
|
try {
|
|
10465
10624
|
return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
|
|
10466
|
-
} catch (
|
|
10625
|
+
} catch (e28) {
|
|
10467
10626
|
return null;
|
|
10468
10627
|
}
|
|
10469
10628
|
}
|
|
10470
10629
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveMetadataImageRuntimePackageJson, "resolveMetadataImageRuntimePackageJson");
|
|
10471
|
-
async function copyMetadataImageRuntime(root, nitroFuncDir,
|
|
10630
|
+
async function copyMetadataImageRuntime(root, nitroFuncDir, fs3) {
|
|
10472
10631
|
const packageJsonPath = resolveMetadataImageRuntimePackageJson(root);
|
|
10473
10632
|
if (!packageJsonPath) return;
|
|
10474
|
-
const packageJson = JSON.parse(await
|
|
10633
|
+
const packageJson = JSON.parse(await fs3.readFile(packageJsonPath, "utf8"));
|
|
10475
10634
|
const packageDir = _path2.default.dirname(packageJsonPath);
|
|
10476
10635
|
const targetDir = _path2.default.join(nitroFuncDir, "node_modules", "@vercel", "og");
|
|
10477
|
-
await
|
|
10478
|
-
await
|
|
10636
|
+
await fs3.mkdir(_path2.default.dirname(targetDir), { recursive: true });
|
|
10637
|
+
await fs3.cp(packageDir, targetDir, {
|
|
10479
10638
|
recursive: true,
|
|
10480
10639
|
force: true,
|
|
10481
10640
|
dereference: true,
|
|
10482
10641
|
mode: _fs.constants.COPYFILE_FICLONE
|
|
10483
10642
|
});
|
|
10484
|
-
const functionPackage = await readNitroOutputPackage(nitroFuncDir,
|
|
10643
|
+
const functionPackage = await readNitroOutputPackage(nitroFuncDir, fs3);
|
|
10485
10644
|
functionPackage.dependencies = {
|
|
10486
10645
|
...functionPackage.dependencies,
|
|
10487
10646
|
"@vercel/og": String(packageJson.version || "0.11.1")
|
|
10488
10647
|
};
|
|
10489
|
-
await writeNitroOutputPackage(nitroFuncDir, functionPackage,
|
|
10648
|
+
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs3);
|
|
10490
10649
|
_chunk5QIKR7RRcjs.logger.info("\u{1F5BC}\uFE0F Bundled generated metadata image runtime");
|
|
10491
10650
|
}
|
|
10492
10651
|
_chunkS3JO3N4Hcjs.__name.call(void 0, copyMetadataImageRuntime, "copyMetadataImageRuntime");
|
|
10493
|
-
async function readNitroOutputPackage(outputDir,
|
|
10652
|
+
async function readNitroOutputPackage(outputDir, fs3) {
|
|
10494
10653
|
const packagePath = _path2.default.join(outputDir, "package.json");
|
|
10495
|
-
return
|
|
10654
|
+
return fs3.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
|
|
10496
10655
|
if (error.code === "ENOENT") return {};
|
|
10497
10656
|
throw error;
|
|
10498
10657
|
});
|
|
10499
10658
|
}
|
|
10500
10659
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readNitroOutputPackage, "readNitroOutputPackage");
|
|
10501
|
-
async function writeNitroOutputPackage(outputDir, packageJson,
|
|
10502
|
-
await
|
|
10503
|
-
await
|
|
10660
|
+
async function writeNitroOutputPackage(outputDir, packageJson, fs3) {
|
|
10661
|
+
await fs3.mkdir(outputDir, { recursive: true });
|
|
10662
|
+
await fs3.writeFile(
|
|
10504
10663
|
_path2.default.join(outputDir, "package.json"),
|
|
10505
10664
|
`${JSON.stringify(packageJson, null, 2)}
|
|
10506
10665
|
`
|
|
@@ -10514,7 +10673,7 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
10514
10673
|
const resolved = parentRequire.resolve(request);
|
|
10515
10674
|
if (resolved.endsWith(".json")) return resolved;
|
|
10516
10675
|
_nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
|
|
10517
|
-
} catch (
|
|
10676
|
+
} catch (e29) {
|
|
10518
10677
|
}
|
|
10519
10678
|
}
|
|
10520
10679
|
try {
|
|
@@ -10525,61 +10684,85 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
10525
10684
|
try {
|
|
10526
10685
|
const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
|
|
10527
10686
|
if (manifest.name === packageName) return candidate;
|
|
10528
|
-
} catch (
|
|
10687
|
+
} catch (e30) {
|
|
10529
10688
|
}
|
|
10530
10689
|
}
|
|
10531
10690
|
if (_path2.default.basename(directory) === "node_modules") break;
|
|
10532
10691
|
directory = _path2.default.dirname(directory);
|
|
10533
10692
|
}
|
|
10534
|
-
} catch (
|
|
10693
|
+
} catch (e31) {
|
|
10535
10694
|
}
|
|
10536
10695
|
return null;
|
|
10537
10696
|
}
|
|
10538
10697
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolvePackageJson, "resolvePackageJson");
|
|
10539
|
-
async function copyPrismaClientForVercel(root, nitroFuncDir,
|
|
10698
|
+
async function copyPrismaClientForVercel(root, nitroFuncDir, fs3) {
|
|
10540
10699
|
const projectRequire = _module.createRequire.call(void 0, _path2.default.join(root, "package.json"));
|
|
10541
10700
|
let prismaClientDir;
|
|
10542
10701
|
try {
|
|
10543
10702
|
prismaClientDir = _path2.default.dirname(projectRequire.resolve("@prisma/client/default.js"));
|
|
10544
|
-
} catch (
|
|
10703
|
+
} catch (e32) {
|
|
10545
10704
|
return;
|
|
10546
10705
|
}
|
|
10547
10706
|
const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
10548
10707
|
try {
|
|
10549
|
-
await
|
|
10550
|
-
} catch (
|
|
10708
|
+
await fs3.access(generatedClientDir);
|
|
10709
|
+
} catch (e33) {
|
|
10551
10710
|
return;
|
|
10552
10711
|
}
|
|
10553
10712
|
const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
|
|
10554
10713
|
const targetPrismaScopeDir = _path2.default.join(targetNodeModules, "@prisma");
|
|
10555
10714
|
const targetGeneratedDir = _path2.default.join(targetNodeModules, ".prisma", "client");
|
|
10556
10715
|
const targetClientDir = _path2.default.join(targetPrismaScopeDir, "client");
|
|
10557
|
-
await
|
|
10558
|
-
await
|
|
10716
|
+
await fs3.mkdir(targetPrismaScopeDir, { recursive: true });
|
|
10717
|
+
await fs3.cp(prismaClientDir, targetClientDir, {
|
|
10559
10718
|
recursive: true,
|
|
10560
10719
|
force: true
|
|
10561
10720
|
});
|
|
10562
|
-
await
|
|
10721
|
+
await fs3.cp(generatedClientDir, targetGeneratedDir, {
|
|
10563
10722
|
recursive: true,
|
|
10564
10723
|
force: true
|
|
10565
10724
|
});
|
|
10566
10725
|
const clientPackagePath = _path2.default.join(prismaClientDir, "package.json");
|
|
10567
10726
|
const [functionPackage, clientPackageContent] = await Promise.all([
|
|
10568
|
-
readNitroOutputPackage(nitroFuncDir,
|
|
10569
|
-
|
|
10727
|
+
readNitroOutputPackage(nitroFuncDir, fs3),
|
|
10728
|
+
fs3.readFile(clientPackagePath, "utf-8")
|
|
10570
10729
|
]);
|
|
10571
10730
|
const clientPackage = JSON.parse(clientPackageContent);
|
|
10572
10731
|
functionPackage.dependencies = {
|
|
10573
10732
|
...functionPackage.dependencies,
|
|
10574
10733
|
"@prisma/client": clientPackage.version
|
|
10575
10734
|
};
|
|
10576
|
-
await writeNitroOutputPackage(nitroFuncDir, functionPackage,
|
|
10735
|
+
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs3);
|
|
10577
10736
|
}
|
|
10578
10737
|
_chunkS3JO3N4Hcjs.__name.call(void 0, copyPrismaClientForVercel, "copyPrismaClientForVercel");
|
|
10579
10738
|
|
|
10739
|
+
// src/build/project-module-runner.ts
|
|
10740
|
+
async function createFarmProjectModuleSsrEnvironment() {
|
|
10741
|
+
const vite = await import("vite");
|
|
10742
|
+
const { ModuleRunner, createNodeImportMeta } = await import("vite/module-runner");
|
|
10743
|
+
return {
|
|
10744
|
+
dev: {
|
|
10745
|
+
createEnvironment(name, config) {
|
|
10746
|
+
return vite.createRunnableDevEnvironment(name, config, {
|
|
10747
|
+
runner: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (environment) => new ModuleRunner({
|
|
10748
|
+
transport: {
|
|
10749
|
+
...vite.createServerModuleRunnerTransport({ channel: environment.hot }),
|
|
10750
|
+
timeout: 0
|
|
10751
|
+
},
|
|
10752
|
+
hmr: false,
|
|
10753
|
+
createImportMeta: createNodeImportMeta,
|
|
10754
|
+
sourcemapInterceptor: "node"
|
|
10755
|
+
}), "runner")
|
|
10756
|
+
});
|
|
10757
|
+
}
|
|
10758
|
+
}
|
|
10759
|
+
};
|
|
10760
|
+
}
|
|
10761
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmProjectModuleSsrEnvironment, "createFarmProjectModuleSsrEnvironment");
|
|
10762
|
+
|
|
10580
10763
|
// src/build/index.ts
|
|
10581
10764
|
async function build(config, options = {}) {
|
|
10582
|
-
return
|
|
10765
|
+
return _chunkWW46B6HAcjs.withProductionNodeEnv.call(void 0, () => buildWithProductionNodeEnv(config, options));
|
|
10583
10766
|
}
|
|
10584
10767
|
_chunkS3JO3N4Hcjs.__name.call(void 0, build, "build");
|
|
10585
10768
|
function createBuildTargetBaseline(config) {
|
|
@@ -10590,7 +10773,7 @@ function createBuildTargetBaseline(config) {
|
|
|
10590
10773
|
preset,
|
|
10591
10774
|
distDir,
|
|
10592
10775
|
outputDir,
|
|
10593
|
-
outputWasDerived: outputDir ===
|
|
10776
|
+
outputWasDerived: outputDir === _chunkQ3NXS4MUcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
10594
10777
|
};
|
|
10595
10778
|
}
|
|
10596
10779
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
|
|
@@ -10600,8 +10783,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
10600
10783
|
const distDir = config.distDir || ".farm";
|
|
10601
10784
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
10602
10785
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
10603
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
10604
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
10786
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkQ3NXS4MUcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
10787
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkQ3NXS4MUcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
10605
10788
|
return {
|
|
10606
10789
|
root,
|
|
10607
10790
|
preset,
|
|
@@ -10609,7 +10792,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
10609
10792
|
distDir,
|
|
10610
10793
|
deployTarget,
|
|
10611
10794
|
outputDir,
|
|
10612
|
-
deployOutputDir:
|
|
10795
|
+
deployOutputDir: _chunkQ3NXS4MUcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
10613
10796
|
};
|
|
10614
10797
|
}
|
|
10615
10798
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
|
|
@@ -10618,7 +10801,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10618
10801
|
const targetBaseline = createBuildTargetBaseline(config);
|
|
10619
10802
|
let targets;
|
|
10620
10803
|
const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
|
|
10621
|
-
const pluginManager = new (0,
|
|
10804
|
+
const pluginManager = new (0, _chunkYR2VBEMOcjs.PluginManager)({
|
|
10622
10805
|
config,
|
|
10623
10806
|
isDev: false,
|
|
10624
10807
|
isProd: true
|
|
@@ -10647,12 +10830,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10647
10830
|
};
|
|
10648
10831
|
config = {
|
|
10649
10832
|
...config,
|
|
10650
|
-
images:
|
|
10833
|
+
images: _chunkYR2VBEMOcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
10651
10834
|
root: targets.root,
|
|
10652
10835
|
preset: targets.preset
|
|
10653
10836
|
})
|
|
10654
10837
|
};
|
|
10655
|
-
if (_optionalChain([config, 'access',
|
|
10838
|
+
if (_optionalChain([config, 'access', _208 => _208.docs, 'optionalAccess', _209 => _209.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
|
|
10656
10839
|
pluginManager.updateContext({ config });
|
|
10657
10840
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
10658
10841
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
@@ -10666,8 +10849,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10666
10849
|
});
|
|
10667
10850
|
_chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
10668
10851
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
10669
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
10670
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
10852
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _210 => _210.status]) === "rejected") throw productionViteResult.reason;
|
|
10853
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _211 => _211.value]);
|
|
10671
10854
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
10672
10855
|
projectModuleServer = await createProjectModuleServer(
|
|
10673
10856
|
createViteServer,
|
|
@@ -10675,18 +10858,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10675
10858
|
root,
|
|
10676
10859
|
rendererBuild.signal
|
|
10677
10860
|
);
|
|
10678
|
-
const farmApp =
|
|
10861
|
+
const farmApp = _chunkYR2VBEMOcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
10679
10862
|
await farmApp.initialize();
|
|
10680
10863
|
const routeManager = farmApp.getRouteManager();
|
|
10681
10864
|
const serverRenderer = farmApp.getServerRenderer();
|
|
10682
|
-
const typeArtifacts =
|
|
10865
|
+
const typeArtifacts = _chunk5D2JIPLHcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
10683
10866
|
root,
|
|
10684
10867
|
srcDir,
|
|
10685
10868
|
layers: config.layers,
|
|
10686
10869
|
plugins: config.plugins,
|
|
10687
10870
|
extraRoutes: [
|
|
10688
|
-
..._optionalChain([config, 'access',
|
|
10689
|
-
...
|
|
10871
|
+
..._optionalChain([config, 'access', _212 => _212.openapi, 'optionalAccess', _213 => _213.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
10872
|
+
..._chunkPGZDEPTMcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
10690
10873
|
],
|
|
10691
10874
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
10692
10875
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -10695,7 +10878,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10695
10878
|
const message = error instanceof Error ? error.message : String(error);
|
|
10696
10879
|
_chunk5QIKR7RRcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
|
|
10697
10880
|
});
|
|
10698
|
-
const apiRouteManager = new (0,
|
|
10881
|
+
const apiRouteManager = new (0, _chunkRWFLWR5Jcjs.APIRouteManager)(
|
|
10699
10882
|
_chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, config),
|
|
10700
10883
|
projectModuleServer,
|
|
10701
10884
|
{
|
|
@@ -10770,7 +10953,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10770
10953
|
throw error;
|
|
10771
10954
|
} finally {
|
|
10772
10955
|
try {
|
|
10773
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
10956
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _214 => _214.close, 'call', _215 => _215()]);
|
|
10774
10957
|
} finally {
|
|
10775
10958
|
rendererBuild.abort();
|
|
10776
10959
|
}
|
|
@@ -10782,7 +10965,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10782
10965
|
ssr: true,
|
|
10783
10966
|
buildLifetime
|
|
10784
10967
|
});
|
|
10785
|
-
const viteConfig =
|
|
10968
|
+
const viteConfig = _chunkYR2VBEMOcjs.mergeFarmViteConfig.call(void 0,
|
|
10786
10969
|
{
|
|
10787
10970
|
root,
|
|
10788
10971
|
appType: "custom",
|
|
@@ -10794,7 +10977,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10794
10977
|
},
|
|
10795
10978
|
plugins: [
|
|
10796
10979
|
...rendererVitePlugins,
|
|
10797
|
-
|
|
10980
|
+
_chunkYR2VBEMOcjs.farmFontImportsPlugin.call(void 0, {
|
|
10798
10981
|
root,
|
|
10799
10982
|
basePath: config.basePath,
|
|
10800
10983
|
publicDir: config.publicDir
|
|
@@ -10806,7 +10989,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10806
10989
|
hmr: false
|
|
10807
10990
|
},
|
|
10808
10991
|
resolve: {
|
|
10809
|
-
alias:
|
|
10992
|
+
alias: _chunkYR2VBEMOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
10810
10993
|
dedupe: [...config.renderer.dedupe || []]
|
|
10811
10994
|
},
|
|
10812
10995
|
optimizeDeps: {
|
|
@@ -10837,6 +11020,14 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10837
11020
|
optimizeDeps: {
|
|
10838
11021
|
...viteConfig.optimizeDeps,
|
|
10839
11022
|
noDiscovery: true
|
|
11023
|
+
},
|
|
11024
|
+
// An app or plugin that brings its own SSR environment keeps it.
|
|
11025
|
+
environments: _optionalChain([viteConfig, 'access', _216 => _216.environments, 'optionalAccess', _217 => _217.ssr, 'optionalAccess', _218 => _218.dev, 'optionalAccess', _219 => _219.createEnvironment]) ? viteConfig.environments : {
|
|
11026
|
+
...viteConfig.environments,
|
|
11027
|
+
ssr: {
|
|
11028
|
+
..._optionalChain([viteConfig, 'access', _220 => _220.environments, 'optionalAccess', _221 => _221.ssr]),
|
|
11029
|
+
...await createFarmProjectModuleSsrEnvironment()
|
|
11030
|
+
}
|
|
10840
11031
|
}
|
|
10841
11032
|
});
|
|
10842
11033
|
}
|
|
@@ -10892,7 +11083,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
10892
11083
|
define: {
|
|
10893
11084
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
10894
11085
|
__FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
|
|
10895
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
11086
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _222 => _222.env, 'optionalAccess', _223 => _223.public]) || {})
|
|
10896
11087
|
},
|
|
10897
11088
|
plugins: [
|
|
10898
11089
|
farmI18nClientBridgePlugin(),
|
|
@@ -10927,7 +11118,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10927
11118
|
if (pluginManager) {
|
|
10928
11119
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
10929
11120
|
}
|
|
10930
|
-
const outputDir =
|
|
11121
|
+
const outputDir = _chunkQ3NXS4MUcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10931
11122
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
10932
11123
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
10933
11124
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -10941,10 +11132,10 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10941
11132
|
const manifestPath = _path2.default.join(publicOutputDir, "farm-client-manifest.json");
|
|
10942
11133
|
const assetsDir = _path2.default.join(publicOutputDir, "assets");
|
|
10943
11134
|
const manifestExists = await import("fs/promises").then(
|
|
10944
|
-
(
|
|
11135
|
+
(fs3) => fs3.access(manifestPath).then(() => true).catch(() => false)
|
|
10945
11136
|
);
|
|
10946
11137
|
const assetsExist = await import("fs/promises").then(
|
|
10947
|
-
(
|
|
11138
|
+
(fs3) => fs3.access(assetsDir).then(() => true).catch(() => false)
|
|
10948
11139
|
);
|
|
10949
11140
|
if (manifestExists && assetsExist) {
|
|
10950
11141
|
_chunk5QIKR7RRcjs.logger.info("\u2705 Verified client assets are present");
|
|
@@ -10986,7 +11177,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10986
11177
|
const { readFile } = await import("fs/promises");
|
|
10987
11178
|
const manifestContent = await readFile(clientManifestPath, "utf-8");
|
|
10988
11179
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
10989
|
-
} catch (
|
|
11180
|
+
} catch (e34) {
|
|
10990
11181
|
farmRegistry.clientManifest = {};
|
|
10991
11182
|
}
|
|
10992
11183
|
} catch (error) {
|
|
@@ -10998,7 +11189,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10998
11189
|
root,
|
|
10999
11190
|
preset,
|
|
11000
11191
|
distDir,
|
|
11001
|
-
outputDir:
|
|
11192
|
+
outputDir: _chunkQ3NXS4MUcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
11002
11193
|
});
|
|
11003
11194
|
}
|
|
11004
11195
|
}
|