@farm.js/core 0.1.27 → 0.1.29
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-runtime.d.mts +3 -2
- package/dist/agent-runtime.d.ts +3 -2
- package/dist/api/client.cjs +4 -6
- package/dist/api/client.d.mts +1 -0
- package/dist/api/client.d.ts +1 -0
- package/dist/api/client.mjs +3 -5
- package/dist/api/route-manager.cjs +9 -8
- package/dist/api/route-manager.d.mts +2 -1
- package/dist/api/route-manager.d.ts +2 -1
- package/dist/api/route-manager.mjs +8 -7
- package/dist/api/runtime.cjs +7 -6
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api/runtime.mjs +6 -5
- package/dist/api.cjs +12 -11
- package/dist/api.d.mts +19 -4
- package/dist/api.d.ts +19 -4
- package/dist/api.mjs +11 -10
- package/dist/{app-BfzZdjgX.d.mts → app-DAuUTIZf.d.mts} +3 -3
- package/dist/app-markdown.cjs +6 -5
- package/dist/app-markdown.d.mts +4 -3
- package/dist/app-markdown.d.ts +4 -3
- package/dist/app-markdown.mjs +5 -4
- package/dist/{app-CXK7Prrt.d.ts → app-sUJ3jnTZ.d.ts} +3 -3
- package/dist/cache-invalidation-BD0z_lfu.d.mts +4 -0
- package/dist/cache-invalidation-BD0z_lfu.d.ts +4 -0
- package/dist/cache.cjs +6 -4
- package/dist/cache.d.mts +11 -6
- package/dist/cache.d.ts +11 -6
- package/dist/cache.mjs +7 -5
- package/dist/{chunk-N6UROPT7.mjs → chunk-2FQHH5SC.mjs} +12 -13
- package/dist/{chunk-UUYF3CHN.mjs → chunk-2N5PX3LS.mjs} +2 -2
- package/dist/{chunk-H6G5INWM.cjs → chunk-2SDO73HK.cjs} +14 -156
- package/dist/{chunk-4FHDV7VM.mjs → chunk-2UABTL3Y.mjs} +2 -2
- package/dist/{chunk-LAHZ7LZA.cjs → chunk-3FCFQP5V.cjs} +32 -20
- package/dist/{chunk-3TQWUUNP.cjs → chunk-3LUF2PE2.cjs} +10 -5
- package/dist/{chunk-SYGGPS4A.mjs → chunk-4IEPYMHF.mjs} +3 -3
- package/dist/{chunk-WD5PNSOB.mjs → chunk-4V7GIE2U.mjs} +6 -4
- package/dist/{chunk-UWTQTZFN.mjs → chunk-5KDPVSS3.mjs} +271 -155
- package/dist/{chunk-I7PUUDGY.cjs → chunk-63H6BKXG.cjs} +2 -2
- package/dist/{chunk-ZSO5GWGD.cjs → chunk-6CNX6Q3K.cjs} +168 -51
- package/dist/{chunk-3PTVHMLD.mjs → chunk-6G3ZZ2IE.mjs} +1 -1
- package/dist/{chunk-QBPXNZGV.cjs → chunk-6MVFL3R5.cjs} +25 -6
- package/dist/{chunk-FG5H2VCJ.mjs → chunk-6ZCMSZ5U.mjs} +2 -2
- package/dist/{chunk-YZBV7733.cjs → chunk-74T3CEA7.cjs} +397 -281
- package/dist/{chunk-ZMN3H73H.cjs → chunk-75DYEVXI.cjs} +13 -11
- package/dist/{chunk-WIVTGKLY.mjs → chunk-7CXKSRKL.mjs} +18 -11
- package/dist/{chunk-POXI72VV.mjs → chunk-ATXI6LGT.mjs} +148 -31
- package/dist/{chunk-NL3ZSMZB.cjs → chunk-BJPBQNIE.cjs} +12 -12
- package/dist/{chunk-Q4BHBO6V.mjs → chunk-BXFWA23T.mjs} +2 -2
- package/dist/{chunk-MBFURXAC.mjs → chunk-BZ3CHOFX.mjs} +1 -1
- package/dist/{chunk-TDWFCC2T.cjs → chunk-BZAGKCKB.cjs} +2 -2
- package/dist/chunk-CNOQY6Z7.mjs +156 -0
- package/dist/{chunk-DW34V5SM.cjs → chunk-CTV2TTNP.cjs} +4 -4
- package/dist/{chunk-HG237IEY.mjs → chunk-D234YWNA.mjs} +1 -1
- package/dist/{chunk-YXM74XOW.cjs → chunk-D4JE5NNV.cjs} +12 -12
- package/dist/{chunk-O2LV5XDG.mjs → chunk-DGXN3L4D.mjs} +20 -8
- package/dist/{chunk-4UNKCNSL.mjs → chunk-E76XC6ZG.mjs} +2 -2
- package/dist/{chunk-QQQNJS2E.mjs → chunk-E7UN576T.mjs} +1 -1
- package/dist/{chunk-G3HRIVEY.cjs → chunk-ES4B2IXW.cjs} +2 -2
- package/dist/{chunk-JQGDQO2I.cjs → chunk-EXLKRR4U.cjs} +10 -10
- package/dist/chunk-FJ3M4CUX.cjs +46 -0
- package/dist/chunk-FXEF4PPL.mjs +47 -0
- package/dist/{chunk-WD4YXVLV.mjs → chunk-GZYH4OER.mjs} +1 -1
- package/dist/{chunk-DX4VKYAJ.cjs → chunk-I26CZYPV.cjs} +6 -4
- package/dist/{chunk-F6SJAKFJ.mjs → chunk-IV6CQY7O.mjs} +12 -154
- package/dist/{chunk-6D242YGO.mjs → chunk-JATSG2ZO.mjs} +1 -1
- package/dist/{chunk-KAERLFD3.cjs → chunk-JFHKNFEO.cjs} +30 -23
- package/dist/{chunk-U74A3P2P.cjs → chunk-JLRDISQL.cjs} +7 -7
- package/dist/{chunk-BYODCJD6.cjs → chunk-K7CELQLK.cjs} +12 -13
- package/dist/{chunk-Y4YWHNKU.cjs → chunk-KH7BN726.cjs} +9 -9
- package/dist/{chunk-3IL5UC5I.cjs → chunk-KZLND3D2.cjs} +2 -2
- package/dist/{chunk-TKDY6AJP.mjs → chunk-MKMBQSNQ.mjs} +1 -1
- package/dist/{chunk-OCE65DDM.mjs → chunk-MNUGPHLN.mjs} +1 -1
- package/dist/{chunk-WJKVTJJR.cjs → chunk-NPPL5YDT.cjs} +2 -2
- package/dist/{chunk-HF5SIACK.cjs → chunk-NXG66MR7.cjs} +3 -3
- package/dist/chunk-NYJMY3JA.cjs +156 -0
- package/dist/{chunk-VVJCWBIE.mjs → chunk-O3DTUAX2.mjs} +2 -2
- package/dist/{chunk-R6AIILII.cjs → chunk-OZVEHHMA.cjs} +15 -14
- package/dist/{chunk-FPW4W3VW.mjs → chunk-PQD2AI3B.mjs} +1 -1
- package/dist/{chunk-C7OUJ6JI.cjs → chunk-PZNCMPJF.cjs} +3 -3
- package/dist/{chunk-QI7WQSMI.cjs → chunk-Q5JFU33Q.cjs} +4 -4
- package/dist/{chunk-52SH7TKB.mjs → chunk-QG5HNS7P.mjs} +2 -2
- package/dist/{chunk-CEYUWDWA.mjs → chunk-QZCT2CQ4.mjs} +10 -5
- package/dist/{chunk-FZC7EEPM.mjs → chunk-RSOJ7DRT.mjs} +26 -7
- package/dist/{chunk-QMV4QELL.mjs → chunk-S5GDHOE4.mjs} +4 -2
- package/dist/{chunk-CRQPYWLK.cjs → chunk-SORB3MAR.cjs} +14 -14
- package/dist/{chunk-I4J452B7.cjs → chunk-VHJGDMCG.cjs} +3 -3
- package/dist/{chunk-B6ZCT36X.cjs → chunk-WNLBF77X.cjs} +4 -4
- package/dist/{chunk-FOT7LZEO.cjs → chunk-WPPX4G7Q.cjs} +1 -1
- package/dist/{chunk-UNSKL6BI.cjs → chunk-X4ZV4QC5.cjs} +266 -228
- package/dist/{chunk-6EG7U4NF.mjs → chunk-X7WVQMIB.mjs} +1 -1
- package/dist/chunk-XD32KALF.cjs +47 -0
- package/dist/{chunk-RDV44SED.mjs → chunk-XJJVLDM6.mjs} +15 -14
- package/dist/{chunk-DQMTHWPI.cjs → chunk-XLTV4VOG.cjs} +21 -16
- package/dist/{chunk-5SPPCN5J.mjs → chunk-XNPDONUH.mjs} +1 -1
- package/dist/{chunk-UOXGA6TO.mjs → chunk-YDQZGSDS.mjs} +1 -1
- package/dist/{chunk-JT25KHDI.mjs → chunk-YMUE7L3D.mjs} +18 -13
- package/dist/chunk-Z3HATSKO.mjs +46 -0
- package/dist/{chunk-C3VRMB6H.cjs → chunk-ZCU4NZ3M.cjs} +6 -6
- package/dist/{chunk-NPFGGBM5.cjs → chunk-ZDILFMWN.cjs} +13 -13
- package/dist/{chunk-OGHTEYXS.mjs → chunk-ZYVFAOBT.mjs} +72 -34
- package/dist/{client-plugins-1GS4zubE.d.mts → client-plugins-BX2ptm4H.d.mts} +42 -34
- package/dist/{client-plugins-B1Za6F5x.d.ts → client-plugins-BmxM5KW_.d.ts} +42 -34
- package/dist/client-plugins.d.mts +3 -2
- package/dist/client-plugins.d.ts +3 -2
- package/dist/client.cjs +11 -12
- package/dist/client.d.mts +6 -5
- package/dist/client.d.ts +6 -5
- package/dist/client.mjs +10 -11
- package/dist/config.d.mts +3 -2
- package/dist/config.d.ts +3 -2
- package/dist/{devtools-CQJ3H6MX.cjs → devtools-GGVPZHJX.cjs} +96 -21
- package/dist/{devtools-6RN6KHTW.mjs → devtools-THVNPI2M.mjs} +80 -5
- package/dist/{devtools-client-4WAPJY5L.cjs → devtools-client-CXQ6PXI6.cjs} +1 -1
- package/dist/{devtools-client-LEUIHHAS.mjs → devtools-client-HJS2T34Y.mjs} +1 -1
- package/dist/docs.cjs +9 -8
- package/dist/docs.mjs +8 -7
- package/dist/index.cjs +61 -57
- package/dist/index.d.mts +26 -15
- package/dist/index.d.ts +26 -15
- package/dist/index.mjs +69 -65
- package/dist/integrations.d.mts +3 -2
- package/dist/integrations.d.ts +3 -2
- package/dist/internal/app-markdown-runtime.cjs +5 -4
- package/dist/internal/app-markdown-runtime.d.mts +4 -3
- package/dist/internal/app-markdown-runtime.d.ts +4 -3
- package/dist/internal/app-markdown-runtime.mjs +4 -3
- package/dist/internal/build-runtime.cjs +26 -23
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +25 -22
- package/dist/internal/cli-runtime.cjs +15 -13
- package/dist/internal/cli-runtime.mjs +14 -12
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +5 -1
- package/dist/internal/client-runtime.d.mts +1 -0
- package/dist/internal/client-runtime.d.ts +1 -0
- package/dist/internal/client-runtime.mjs +4 -0
- package/dist/internal/compression-runtime.cjs +3 -2
- package/dist/internal/compression-runtime.d.mts +6 -3
- package/dist/internal/compression-runtime.d.ts +6 -3
- package/dist/internal/compression-runtime.mjs +2 -1
- package/dist/internal/config-runtime.cjs +7 -6
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +6 -5
- package/dist/internal/product-telemetry-runtime.cjs +10 -6
- package/dist/internal/product-telemetry-runtime.mjs +9 -5
- package/dist/internal/production-runtime.cjs +29 -13
- package/dist/internal/production-runtime.d.mts +36 -8
- package/dist/internal/production-runtime.d.ts +36 -8
- package/dist/internal/production-runtime.mjs +32 -16
- package/dist/markdown.cjs +4 -3
- package/dist/markdown.d.mts +3 -2
- package/dist/markdown.d.ts +3 -2
- package/dist/markdown.mjs +3 -2
- package/dist/{metadata-B9mCxKgp.d.mts → metadata-DsEaK7mQ.d.mts} +1 -1
- package/dist/{metadata-7LKgQEWF.d.ts → metadata-fwZ3gfG6.d.ts} +1 -1
- package/dist/middleware.cjs +6 -5
- package/dist/middleware.d.mts +4 -3
- package/dist/middleware.d.ts +4 -3
- package/dist/middleware.mjs +5 -4
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +5 -4
- package/dist/navigation.d.ts +5 -4
- package/dist/navigation.mjs +4 -4
- package/dist/plugin.cjs +25 -20
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.mjs +25 -20
- package/dist/{production-runtime-DramhI0c.d.mts → production-runtime-Baqgwtvc.d.mts} +1 -1
- package/dist/{production-runtime-B3xnY6fI.d.ts → production-runtime-DNkpFnmg.d.ts} +1 -1
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-CtQB-zHS.d.mts → render-plan-DhwQnmmX.d.mts} +1 -1
- package/dist/{render-plan-CpW32tOL.d.ts → render-plan-rkIK9wd9.d.ts} +1 -1
- package/dist/renderer-client.cjs +13 -14
- package/dist/renderer-client.d.mts +4 -3
- package/dist/renderer-client.d.ts +4 -3
- package/dist/renderer-client.mjs +6 -7
- package/dist/{request-BVGGeQv4.d.ts → request-BcY4RYPC.d.ts} +1 -1
- package/dist/{request-DlLVBKe3.d.mts → request-CFy1BltJ.d.mts} +1 -1
- package/dist/request.d.mts +4 -3
- package/dist/request.d.ts +4 -3
- package/dist/{route-rendering-DChYLNdh.d.mts → route-rendering-BkS0TBlB.d.mts} +1 -1
- package/dist/{route-rendering-BdEldajn.d.ts → route-rendering-D4XpMjam.d.ts} +1 -1
- package/dist/{router-D5htHn_M.d.mts → router-C4zPlC3V.d.mts} +1 -1
- package/dist/{router-D0Az-1Nu.d.ts → router-Cq7BcZxg.d.ts} +1 -1
- package/dist/routes.cjs +6 -5
- package/dist/routes.d.mts +3 -2
- package/dist/routes.d.ts +3 -2
- package/dist/routes.mjs +5 -4
- package/dist/server-fn-client.d.mts +1 -0
- package/dist/server-fn-client.d.ts +1 -0
- package/dist/server-fn.cjs +6 -5
- package/dist/server-fn.d.mts +1 -0
- package/dist/server-fn.d.ts +1 -0
- package/dist/server-fn.mjs +5 -4
- package/dist/server-plugins.cjs +3 -2
- package/dist/server-plugins.d.mts +3 -2
- package/dist/server-plugins.d.ts +3 -2
- package/dist/server-plugins.mjs +2 -1
- package/dist/server-query-client.cjs +5 -7
- package/dist/server-query-client.d.mts +1 -0
- package/dist/server-query-client.d.ts +1 -0
- package/dist/server-query-client.mjs +4 -6
- package/dist/server-query.cjs +7 -6
- package/dist/server-query.d.mts +1 -0
- package/dist/server-query.d.ts +1 -0
- package/dist/server-query.mjs +6 -5
- package/dist/server.cjs +72 -57
- package/dist/server.d.mts +10 -9
- package/dist/server.d.ts +10 -9
- package/dist/server.mjs +56 -41
- package/dist/{spa-router-DmwP_7QL.d.ts → spa-router-B1HI3X9k.d.ts} +2 -2
- package/dist/{spa-router-DVfSJZ5o.d.mts → spa-router-DzPZH-AO.d.mts} +2 -2
- package/dist/testing.cjs +14 -13
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.mjs +11 -10
- package/dist/{utils-B_Rmr0-n.d.mts → utils-CEBktlBG.d.mts} +1 -1
- package/dist/{utils-Dv0OuLtF.d.ts → utils-DMD1Hzta.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +21 -19
- package/dist/vite.d.mts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.mjs +20 -18
- package/package.json +1 -1
- package/dist/{chunk-YOYF2E4U.mjs → chunk-LNZ7JZUS.mjs} +0 -0
- package/dist/{chunk-N4RLRSWW.cjs → chunk-SUIBNSNO.cjs} +0 -0
- package/dist/{chunk-TIKNUAU7.mjs → chunk-VUMAE7NC.mjs} +3 -3
- package/dist/{chunk-WM6HL7E7.cjs → chunk-ZHVYQL3H.cjs} +2 -2
|
@@ -6,10 +6,11 @@ var _chunkA6WIQH5Zcjs = require('./chunk-A6WIQH5Z.cjs');
|
|
|
6
6
|
var _chunkMT763TDWcjs = require('./chunk-MT763TDW.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
var _chunkXD32KALFcjs = require('./chunk-XD32KALF.cjs');
|
|
9
10
|
|
|
10
|
-
var _chunkNPFGGBM5cjs = require('./chunk-NPFGGBM5.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
var _chunkZDILFMWNcjs = require('./chunk-ZDILFMWN.cjs');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
@@ -17,7 +18,9 @@ var _chunkNPFGGBM5cjs = require('./chunk-NPFGGBM5.cjs');
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var _chunkQ5JFU33Qcjs = require('./chunk-Q5JFU33Q.cjs');
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
|
|
@@ -34,7 +37,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
|
|
37
|
-
var
|
|
40
|
+
var _chunkJFHKNFEOcjs = require('./chunk-JFHKNFEO.cjs');
|
|
38
41
|
|
|
39
42
|
|
|
40
43
|
var _chunkKCMTCM6Icjs = require('./chunk-KCMTCM6I.cjs');
|
|
@@ -70,17 +73,17 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
|
|
|
70
73
|
|
|
71
74
|
|
|
72
75
|
|
|
73
|
-
var
|
|
76
|
+
var _chunkX4ZV4QC5cjs = require('./chunk-X4ZV4QC5.cjs');
|
|
74
77
|
|
|
75
78
|
|
|
76
79
|
|
|
77
80
|
|
|
78
81
|
|
|
79
|
-
var
|
|
82
|
+
var _chunkCTV2TTNPcjs = require('./chunk-CTV2TTNP.cjs');
|
|
80
83
|
|
|
81
84
|
|
|
82
85
|
|
|
83
|
-
var
|
|
86
|
+
var _chunkNPPL5YDTcjs = require('./chunk-NPPL5YDT.cjs');
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
|
|
@@ -112,7 +115,7 @@ var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
|
|
|
112
115
|
var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
113
116
|
|
|
114
117
|
|
|
115
|
-
var
|
|
118
|
+
var _chunkXLTV4VOGcjs = require('./chunk-XLTV4VOG.cjs');
|
|
116
119
|
|
|
117
120
|
|
|
118
121
|
|
|
@@ -124,14 +127,14 @@ var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
|
|
|
124
127
|
var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
|
|
125
128
|
|
|
126
129
|
|
|
127
|
-
var
|
|
130
|
+
var _chunkNXG66MR7cjs = require('./chunk-NXG66MR7.cjs');
|
|
128
131
|
|
|
129
132
|
|
|
130
133
|
|
|
131
134
|
var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
|
|
132
135
|
|
|
133
136
|
|
|
134
|
-
var
|
|
137
|
+
var _chunk6CNX6Q3Kcjs = require('./chunk-6CNX6Q3K.cjs');
|
|
135
138
|
|
|
136
139
|
|
|
137
140
|
|
|
@@ -142,10 +145,10 @@ var _chunkMPEYMSCFcjs = require('./chunk-MPEYMSCF.cjs');
|
|
|
142
145
|
var _chunkZ5HIWVDPcjs = require('./chunk-Z5HIWVDP.cjs');
|
|
143
146
|
|
|
144
147
|
|
|
145
|
-
var
|
|
148
|
+
var _chunkZHVYQL3Hcjs = require('./chunk-ZHVYQL3H.cjs');
|
|
146
149
|
|
|
147
150
|
|
|
148
|
-
var
|
|
151
|
+
var _chunkEXLKRR4Ucjs = require('./chunk-EXLKRR4U.cjs');
|
|
149
152
|
|
|
150
153
|
|
|
151
154
|
var _chunkIQXFRNY2cjs = require('./chunk-IQXFRNY2.cjs');
|
|
@@ -279,7 +282,7 @@ function getDocsTitle(docs) {
|
|
|
279
282
|
}
|
|
280
283
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsTitle, "getDocsTitle");
|
|
281
284
|
function loadPages(contentDir, docs) {
|
|
282
|
-
return
|
|
285
|
+
return _chunkQ5JFU33Qcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkQ5JFU33Qcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
283
286
|
}
|
|
284
287
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadPages, "loadPages");
|
|
285
288
|
function findSocialImagePath(html) {
|
|
@@ -300,14 +303,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
300
303
|
}
|
|
301
304
|
_chunkS3JO3N4Hcjs.__name.call(void 0, addHandlerRoute, "addHandlerRoute");
|
|
302
305
|
async function compileFarmDocsManifest(docs, options) {
|
|
303
|
-
const contentDir =
|
|
306
|
+
const contentDir = _chunkQ5JFU33Qcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
304
307
|
const pages = loadPages(contentDir, docs);
|
|
305
308
|
const absolutePaths = [
|
|
306
309
|
_path2.default.resolve(options.root),
|
|
307
310
|
_path2.default.resolve(contentDir),
|
|
308
311
|
docs.configPath || ""
|
|
309
312
|
];
|
|
310
|
-
const handler =
|
|
313
|
+
const handler = _chunkQ5JFU33Qcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
311
314
|
root: options.root,
|
|
312
315
|
srcDir: options.srcDir,
|
|
313
316
|
clientEntry: options.clientEntry,
|
|
@@ -315,7 +318,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
315
318
|
fontStylesheetHref: options.fontStylesheetHref,
|
|
316
319
|
globalStylesheetHref: options.globalStylesheetHref
|
|
317
320
|
});
|
|
318
|
-
const apiHandler =
|
|
321
|
+
const apiHandler = _chunkZDILFMWNcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
319
322
|
rootDir: options.root,
|
|
320
323
|
srcDir: options.srcDir,
|
|
321
324
|
docs
|
|
@@ -407,7 +410,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
407
410
|
post: await compileResponse(postResponse, absolutePaths),
|
|
408
411
|
search: {
|
|
409
412
|
pages: pages.map((page) => ({
|
|
410
|
-
...
|
|
413
|
+
..._chunkQ5JFU33Qcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
411
414
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
412
415
|
})),
|
|
413
416
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -427,7 +430,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
427
430
|
const routes = [];
|
|
428
431
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
429
432
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
430
|
-
const rendering = await
|
|
433
|
+
const rendering = await _chunkCTV2TTNPcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
431
434
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
432
435
|
routes.push({
|
|
433
436
|
kind: "page",
|
|
@@ -1256,6 +1259,19 @@ function isNitroRollupExternal(id) {
|
|
|
1256
1259
|
}
|
|
1257
1260
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isNitroRollupExternal, "isNitroRollupExternal");
|
|
1258
1261
|
var FARM_METADATA_IMAGE_WASM_PREFIX = "\0farm-metadata-image-wasm:";
|
|
1262
|
+
function createReactProductionModePlugin() {
|
|
1263
|
+
const nodeEnvExpression = ["process", "env", "NODE_ENV"].join(".");
|
|
1264
|
+
return {
|
|
1265
|
+
name: "farm-react-production-mode",
|
|
1266
|
+
transform(code, id) {
|
|
1267
|
+
const normalizedId = id.replace(/\\/g, "/");
|
|
1268
|
+
const isReactRuntime = normalizedId.includes("/node_modules/react/") || normalizedId.includes("/node_modules/react-dom/");
|
|
1269
|
+
if (!isReactRuntime || !code.includes(nodeEnvExpression)) return null;
|
|
1270
|
+
return { code: code.split(nodeEnvExpression).join('"production"'), map: null };
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createReactProductionModePlugin, "createReactProductionModePlugin");
|
|
1259
1275
|
function createMetadataImageWasmPlugin() {
|
|
1260
1276
|
return {
|
|
1261
1277
|
name: "farm-metadata-image-wasm",
|
|
@@ -1350,42 +1366,75 @@ async function minifyFarmServerChunk(code, fileName, options) {
|
|
|
1350
1366
|
}
|
|
1351
1367
|
_chunkS3JO3N4Hcjs.__name.call(void 0, minifyFarmServerChunk, "minifyFarmServerChunk");
|
|
1352
1368
|
function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor }) {
|
|
1353
|
-
|
|
1369
|
+
const hasImportTemplate = code.includes("import(`");
|
|
1370
|
+
const hasRequireTemplate = code.includes("require(`");
|
|
1371
|
+
if (!hasImportTemplate && !hasRequireTemplate) return code;
|
|
1354
1372
|
const parsed = parseSync(fileName, code, { lang: "js", sourceType: "module" });
|
|
1355
1373
|
if (parsed.errors.length > 0) {
|
|
1356
1374
|
throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
|
|
1357
1375
|
}
|
|
1358
1376
|
const replacements = [];
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
ImportExpression(node) {
|
|
1372
|
-
restore(node.source);
|
|
1373
|
-
},
|
|
1374
|
-
CallExpression(node) {
|
|
1375
|
-
if (node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments.length === 1) {
|
|
1376
|
-
restore(node.arguments[0]);
|
|
1377
|
+
let needsAst = hasRequireTemplate;
|
|
1378
|
+
if (!needsAst) {
|
|
1379
|
+
const seenStarts = /* @__PURE__ */ new Set();
|
|
1380
|
+
for (const { moduleRequest } of parsed.module.dynamicImports) {
|
|
1381
|
+
if (seenStarts.has(moduleRequest.start)) continue;
|
|
1382
|
+
seenStarts.add(moduleRequest.start);
|
|
1383
|
+
const source = code.slice(moduleRequest.start, moduleRequest.end);
|
|
1384
|
+
if (!source.startsWith("`")) continue;
|
|
1385
|
+
const value = source.slice(1, -1);
|
|
1386
|
+
if (source.length < 2 || !source.endsWith("`") || /[\\\r\n`]|\$\{/.test(value)) {
|
|
1387
|
+
needsAst = true;
|
|
1388
|
+
break;
|
|
1377
1389
|
}
|
|
1390
|
+
replacements.push({
|
|
1391
|
+
start: moduleRequest.start,
|
|
1392
|
+
end: moduleRequest.end,
|
|
1393
|
+
text: toAsciiStringLiteral(value)
|
|
1394
|
+
});
|
|
1378
1395
|
}
|
|
1379
|
-
}
|
|
1396
|
+
}
|
|
1397
|
+
if (needsAst) {
|
|
1398
|
+
replacements.length = 0;
|
|
1399
|
+
const restore = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (node) => {
|
|
1400
|
+
if (_optionalChain([node, 'optionalAccess', _17 => _17.type]) !== "TemplateLiteral") return;
|
|
1401
|
+
const template = node;
|
|
1402
|
+
const value = _optionalChain([template, 'access', _18 => _18.quasis, 'access', _19 => _19[0], 'optionalAccess', _20 => _20.value, 'access', _21 => _21.cooked]);
|
|
1403
|
+
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
1404
|
+
replacements.push({
|
|
1405
|
+
start: template.start,
|
|
1406
|
+
end: template.end,
|
|
1407
|
+
text: toAsciiStringLiteral(value)
|
|
1408
|
+
});
|
|
1409
|
+
}, "restore");
|
|
1410
|
+
new Visitor({
|
|
1411
|
+
ImportExpression(node) {
|
|
1412
|
+
restore(node.source);
|
|
1413
|
+
},
|
|
1414
|
+
CallExpression(node) {
|
|
1415
|
+
if (node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments.length === 1) {
|
|
1416
|
+
restore(node.arguments[0]);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}).visit(parsed.program);
|
|
1420
|
+
}
|
|
1380
1421
|
let restored = "";
|
|
1381
1422
|
let offset = 0;
|
|
1382
1423
|
for (const { start, end, text } of replacements.sort((a, b) => a.start - b.start)) {
|
|
1424
|
+
if (start < offset) continue;
|
|
1383
1425
|
restored += code.slice(offset, start) + text;
|
|
1384
1426
|
offset = end;
|
|
1385
1427
|
}
|
|
1386
1428
|
return restored + code.slice(offset);
|
|
1387
1429
|
}
|
|
1388
1430
|
_chunkS3JO3N4Hcjs.__name.call(void 0, restoreLiteralModuleSpecifiers, "restoreLiteralModuleSpecifiers");
|
|
1431
|
+
function toAsciiStringLiteral(value) {
|
|
1432
|
+
return JSON.stringify(value).replace(
|
|
1433
|
+
/[\u007f-]/g,
|
|
1434
|
+
(character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`
|
|
1435
|
+
);
|
|
1436
|
+
}
|
|
1437
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, toAsciiStringLiteral, "toAsciiStringLiteral");
|
|
1389
1438
|
function createServerChunkMinifyPlugin(options) {
|
|
1390
1439
|
return {
|
|
1391
1440
|
name: "farm-server-chunk-minify",
|
|
@@ -1487,7 +1536,7 @@ function hasFarmPluginRoutes(config) {
|
|
|
1487
1536
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
|
|
1488
1537
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1489
1538
|
return (config.plugins || []).some(
|
|
1490
|
-
(plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false &&
|
|
1539
|
+
(plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkX4ZV4QC5cjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1491
1540
|
);
|
|
1492
1541
|
}
|
|
1493
1542
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
|
|
@@ -1515,7 +1564,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1515
1564
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name.startsWith("_")) {
|
|
1516
1565
|
continue;
|
|
1517
1566
|
}
|
|
1518
|
-
const childRoutePath =
|
|
1567
|
+
const childRoutePath = _chunkZHVYQL3Hcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name);
|
|
1519
1568
|
await walk(_path2.default.join(dir, entry.name), childRoutePath, discovered);
|
|
1520
1569
|
}
|
|
1521
1570
|
}
|
|
@@ -1549,7 +1598,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1549
1598
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1550
1599
|
const srcDir = config.srcDir || "src";
|
|
1551
1600
|
const distDir = config.distDir || ".farm";
|
|
1552
|
-
const deployOutputDir =
|
|
1601
|
+
const deployOutputDir = _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1553
1602
|
const lifecyclePluginManager = options.pluginManager;
|
|
1554
1603
|
const productionViteResultPromise = Promise.allSettled([
|
|
1555
1604
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -1568,7 +1617,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1568
1617
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
1569
1618
|
const pageRoutes = [];
|
|
1570
1619
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
1571
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
1620
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkNXG66MR7cjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
1572
1621
|
pageRoutes.push({
|
|
1573
1622
|
pattern,
|
|
1574
1623
|
modulePath: entry.modulePath,
|
|
@@ -1797,7 +1846,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
1797
1846
|
}
|
|
1798
1847
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
1799
1848
|
await fs.writeFile(fontCssPath, normalizedFontCss);
|
|
1800
|
-
await fs.writeFile(clientCssPath,
|
|
1849
|
+
await fs.writeFile(clientCssPath, _chunkX4ZV4QC5cjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
1801
1850
|
}
|
|
1802
1851
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
|
|
1803
1852
|
var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
|
|
@@ -1847,7 +1896,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
1847
1896
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
|
|
1848
1897
|
let plan = cache.get(key);
|
|
1849
1898
|
if (!plan) {
|
|
1850
|
-
plan =
|
|
1899
|
+
plan = _chunkX4ZV4QC5cjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
1851
1900
|
cache.set(key, plan);
|
|
1852
1901
|
}
|
|
1853
1902
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -1876,14 +1925,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1876
1925
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
1877
1926
|
);
|
|
1878
1927
|
}
|
|
1879
|
-
const isolatedMode =
|
|
1928
|
+
const isolatedMode = _chunkX4ZV4QC5cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
1880
1929
|
_optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]),
|
|
1881
1930
|
{
|
|
1882
1931
|
serverComponents: _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents]) === true,
|
|
1883
1932
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
1884
1933
|
}
|
|
1885
1934
|
);
|
|
1886
|
-
const planOptions =
|
|
1935
|
+
const planOptions = _chunkX4ZV4QC5cjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
1887
1936
|
config.renderer,
|
|
1888
1937
|
Boolean(unsupportedIntegrationProvider)
|
|
1889
1938
|
);
|
|
@@ -1940,7 +1989,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1940
1989
|
), "isAdapterDocsRoute");
|
|
1941
1990
|
const syntheticDocsEntry = _optionalChain([config, 'access', _46 => _46.docs, 'optionalAccess', _47 => _47.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
1942
1991
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
1943
|
-
const markdownPagePlan =
|
|
1992
|
+
const markdownPagePlan = _chunkX4ZV4QC5cjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
1944
1993
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
1945
1994
|
root,
|
|
1946
1995
|
isolatedMode,
|
|
@@ -1948,7 +1997,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1948
1997
|
);
|
|
1949
1998
|
const routePlans = pageRoutes.map((route) => ({
|
|
1950
1999
|
route,
|
|
1951
|
-
metadata:
|
|
2000
|
+
metadata: _chunkNXG66MR7cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
1952
2001
|
route.modulePath,
|
|
1953
2002
|
root,
|
|
1954
2003
|
isolatedMode,
|
|
@@ -1956,7 +2005,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1956
2005
|
planOptions
|
|
1957
2006
|
)
|
|
1958
2007
|
}));
|
|
1959
|
-
|
|
2008
|
+
_chunkX4ZV4QC5cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
1960
2009
|
clientLayouts.map((layout) => ({
|
|
1961
2010
|
pattern: layout.pattern,
|
|
1962
2011
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -1988,7 +2037,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1988
2037
|
for (const layout of clientLayouts) {
|
|
1989
2038
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, route.pattern)) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
|
|
1990
2039
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
1991
|
-
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${
|
|
2040
|
+
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkX4ZV4QC5cjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
1992
2041
|
}
|
|
1993
2042
|
}
|
|
1994
2043
|
if (isolatedMode === "analyze") {
|
|
@@ -2012,7 +2061,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2012
2061
|
);
|
|
2013
2062
|
if (metadata.suppressedAsyncHydration) {
|
|
2014
2063
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
2015
|
-
`\u26A0\uFE0F ${
|
|
2064
|
+
`\u26A0\uFE0F ${_chunkX4ZV4QC5cjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2016
2065
|
);
|
|
2017
2066
|
}
|
|
2018
2067
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2071,7 +2120,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2071
2120
|
}
|
|
2072
2121
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2073
2122
|
try {
|
|
2074
|
-
return
|
|
2123
|
+
return _chunkX4ZV4QC5cjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2075
2124
|
} catch (error) {
|
|
2076
2125
|
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2077
2126
|
return false;
|
|
@@ -2101,7 +2150,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2101
2150
|
config.trailingSlash,
|
|
2102
2151
|
_chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2103
2152
|
config.basePath,
|
|
2104
|
-
|
|
2153
|
+
_chunkX4ZV4QC5cjs.generateClientCachePersistenceCode.call(void 0, _chunkX4ZV4QC5cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2105
2154
|
adapterOwnsDocsRuntime ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2106
2155
|
);
|
|
2107
2156
|
await fs.writeFile(clientEntryPath, clientHydrationCode);
|
|
@@ -2118,7 +2167,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2118
2167
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2119
2168
|
await fs.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2120
2169
|
postcssSearchPath = clientEntryDir;
|
|
2121
|
-
tailwindVitePlugin = await
|
|
2170
|
+
tailwindVitePlugin = await _chunkX4ZV4QC5cjs.loadTailwindVitePlugin.call(void 0, {
|
|
2122
2171
|
builder: productionVite.builder,
|
|
2123
2172
|
announce: true
|
|
2124
2173
|
});
|
|
@@ -2187,7 +2236,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2187
2236
|
}
|
|
2188
2237
|
},
|
|
2189
2238
|
plugins: [
|
|
2190
|
-
|
|
2239
|
+
_chunkX4ZV4QC5cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2191
2240
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
2192
2241
|
...rendererVitePlugins,
|
|
2193
2242
|
...config.vite.plugins || [],
|
|
@@ -2248,7 +2297,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2248
2297
|
} : void 0,
|
|
2249
2298
|
// Ensure React is bundled for client
|
|
2250
2299
|
resolve: {
|
|
2251
|
-
alias:
|
|
2300
|
+
alias: _chunkX4ZV4QC5cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2252
2301
|
dedupe: [...config.renderer.dedupe || []]
|
|
2253
2302
|
},
|
|
2254
2303
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2261,7 +2310,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2261
2310
|
]
|
|
2262
2311
|
}
|
|
2263
2312
|
};
|
|
2264
|
-
await viteBuild(
|
|
2313
|
+
await viteBuild(_chunkX4ZV4QC5cjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2265
2314
|
await mergeBuiltFontCss(outputDir);
|
|
2266
2315
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2267
2316
|
} finally {
|
|
@@ -3020,7 +3069,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3020
3069
|
direction: {}
|
|
3021
3070
|
}, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
3022
3071
|
const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
|
|
3023
|
-
const clientPluginEntry =
|
|
3072
|
+
const clientPluginEntry = _chunkX4ZV4QC5cjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3024
3073
|
plugins,
|
|
3025
3074
|
root,
|
|
3026
3075
|
srcDir,
|
|
@@ -3031,7 +3080,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3031
3080
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3032
3081
|
import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3033
3082
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3034
|
-
const providerClientCode =
|
|
3083
|
+
const providerClientCode = _chunkX4ZV4QC5cjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3035
3084
|
integrationProviders,
|
|
3036
3085
|
root,
|
|
3037
3086
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3516,7 +3565,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3516
3565
|
});
|
|
3517
3566
|
}
|
|
3518
3567
|
|
|
3519
|
-
${
|
|
3568
|
+
${_chunkX4ZV4QC5cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
3520
3569
|
// Wrap a page element with applicable layouts
|
|
3521
3570
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
3522
3571
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4431,7 +4480,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4431
4480
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
4432
4481
|
"module.exports = { plugins: [] };\n"
|
|
4433
4482
|
);
|
|
4434
|
-
tailwindVitePlugin = await
|
|
4483
|
+
tailwindVitePlugin = await _chunkX4ZV4QC5cjs.loadTailwindVitePlugin.call(void 0, {
|
|
4435
4484
|
builder: productionVite.builder,
|
|
4436
4485
|
label: "for SSR"
|
|
4437
4486
|
});
|
|
@@ -4527,7 +4576,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4527
4576
|
}
|
|
4528
4577
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
4529
4578
|
const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
4530
|
-
const notFoundPath =
|
|
4579
|
+
const notFoundPath = _chunkX4ZV4QC5cjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
4531
4580
|
if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
4532
4581
|
layoutRoutes.sort((a, b) => {
|
|
4533
4582
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -4550,7 +4599,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4550
4599
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
4551
4600
|
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _56 => _56.mdx, 'optionalAccess', _57 => _57.components]));
|
|
4552
4601
|
const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
|
|
4553
|
-
const hasRouteContextConfig =
|
|
4602
|
+
const hasRouteContextConfig = _chunkJFHKNFEOcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
4554
4603
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
4555
4604
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
4556
4605
|
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
@@ -4559,7 +4608,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4559
4608
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
4560
4609
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
4561
4610
|
);
|
|
4562
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await
|
|
4611
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await _chunkZDILFMWNcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
4563
4612
|
root,
|
|
4564
4613
|
srcDir: config.srcDir,
|
|
4565
4614
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -4709,25 +4758,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4709
4758
|
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _68 => _68.env, 'optionalAccess', _69 => _69.public]) || {})
|
|
4710
4759
|
},
|
|
4711
4760
|
plugins: [
|
|
4712
|
-
|
|
4761
|
+
_chunkX4ZV4QC5cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
4713
4762
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
4714
4763
|
...rendererVitePlugins,
|
|
4715
4764
|
...config.vite.plugins || [],
|
|
4716
4765
|
...!useExternalMetadataImageRuntime && metadataImageRoutes.some((image) => image.sourceType === "module") ? [createMetadataImageWasmPlugin()] : [],
|
|
4717
|
-
{
|
|
4718
|
-
name: "farm-react-production-mode",
|
|
4719
|
-
enforce: "pre",
|
|
4720
|
-
transform(code, id) {
|
|
4721
|
-
const normalizedId = id.replace(/\\/g, "/");
|
|
4722
|
-
const isReactRuntime = normalizedId.includes("/node_modules/react/") || normalizedId.includes("/node_modules/react-dom/");
|
|
4723
|
-
const nodeEnvExpression = ["process", "env", "NODE_ENV"].join(".");
|
|
4724
|
-
if (!isReactRuntime || !code.includes(nodeEnvExpression)) return null;
|
|
4725
|
-
return {
|
|
4726
|
-
code: code.split(nodeEnvExpression).join('"production"'),
|
|
4727
|
-
map: null
|
|
4728
|
-
};
|
|
4729
|
-
}
|
|
4730
|
-
},
|
|
4766
|
+
{ ...createReactProductionModePlugin(), enforce: "pre" },
|
|
4731
4767
|
farmServerOnlyEntriesPlugin(),
|
|
4732
4768
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
4733
4769
|
_chunk22GUSVNJcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
|
|
@@ -4769,7 +4805,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4769
4805
|
resolve: {
|
|
4770
4806
|
alias: [
|
|
4771
4807
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
4772
|
-
...Object.entries(
|
|
4808
|
+
...Object.entries(_chunkX4ZV4QC5cjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
4773
4809
|
([find, replacement]) => ({ find, replacement })
|
|
4774
4810
|
)
|
|
4775
4811
|
],
|
|
@@ -4777,7 +4813,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4777
4813
|
dedupe: [...config.renderer.dedupe || []]
|
|
4778
4814
|
}
|
|
4779
4815
|
};
|
|
4780
|
-
await viteBuild(
|
|
4816
|
+
await viteBuild(_chunkX4ZV4QC5cjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
4781
4817
|
} finally {
|
|
4782
4818
|
if (postcssConfigDir) {
|
|
4783
4819
|
try {
|
|
@@ -4858,44 +4894,6 @@ function generateNativeAuthIntegrationSource(auth) {
|
|
|
4858
4894
|
};
|
|
4859
4895
|
}
|
|
4860
4896
|
_chunkS3JO3N4Hcjs.__name.call(void 0, generateNativeAuthIntegrationSource, "generateNativeAuthIntegrationSource");
|
|
4861
|
-
function generateNativeMCPPluginSource(mcp) {
|
|
4862
|
-
if (_optionalChain([mcp, 'optionalAccess', _76 => _76.enabled]) !== true) {
|
|
4863
|
-
return { importSource: "", registerSource: "", pluginSource: "" };
|
|
4864
|
-
}
|
|
4865
|
-
return {
|
|
4866
|
-
importSource: `import { createFarmMCPPlugin as __farmCreateMCPPlugin } from "@farm.js/mcp/internal";`,
|
|
4867
|
-
registerSource: `function __farmMCPIsPlainObject(value) {
|
|
4868
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
4869
|
-
const prototype = Object.getPrototypeOf(value);
|
|
4870
|
-
return prototype === Object.prototype || prototype === null;
|
|
4871
|
-
}
|
|
4872
|
-
|
|
4873
|
-
function __farmMergeMCPConfig(base, override) {
|
|
4874
|
-
const output = { ...base };
|
|
4875
|
-
for (const [key, value] of Object.entries(override)) {
|
|
4876
|
-
if (value === undefined) continue;
|
|
4877
|
-
output[key] =
|
|
4878
|
-
__farmMCPIsPlainObject(output[key]) && __farmMCPIsPlainObject(value)
|
|
4879
|
-
? __farmMergeMCPConfig(output[key], value)
|
|
4880
|
-
: value;
|
|
4881
|
-
}
|
|
4882
|
-
return output;
|
|
4883
|
-
}
|
|
4884
|
-
|
|
4885
|
-
const farmNativeMCPConfig = farmRuntimeConfigs.reduce((merged, runtimeConfig) => {
|
|
4886
|
-
const value = runtimeConfig?.mcp;
|
|
4887
|
-
if (value === undefined) return merged;
|
|
4888
|
-
if (value === false) return false;
|
|
4889
|
-
return __farmMergeMCPConfig(merged && merged !== false ? merged : {}, value);
|
|
4890
|
-
}, undefined);
|
|
4891
|
-
const farmNativeMCPPlugin =
|
|
4892
|
-
farmNativeMCPConfig && farmNativeMCPConfig.enabled !== false
|
|
4893
|
-
? __farmCreateMCPPlugin(farmNativeMCPConfig)
|
|
4894
|
-
: null;`,
|
|
4895
|
-
pluginSource: `...(farmNativeMCPPlugin ? [farmNativeMCPPlugin] : []),`
|
|
4896
|
-
};
|
|
4897
|
-
}
|
|
4898
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, generateNativeMCPPluginSource, "generateNativeMCPPluginSource");
|
|
4899
4897
|
function generateIntegrationRequestRuntimeSource(options) {
|
|
4900
4898
|
return `
|
|
4901
4899
|
function matchLocalIntegrationRequest(request) {
|
|
@@ -4946,6 +4944,24 @@ function getConfiguredSetCookieHeaders(headers) {
|
|
|
4946
4944
|
return value ? [value] : [];
|
|
4947
4945
|
}
|
|
4948
4946
|
|
|
4947
|
+
// Owned responses (core's owned-response.ts, RFC 0002) are edited in place.
|
|
4948
|
+
function farmEditableHeaders(response) {
|
|
4949
|
+
return (globalThis[Symbol.for("farm.ownedResponses")] ??= new WeakSet()).has(response)
|
|
4950
|
+
? response.headers
|
|
4951
|
+
: new Headers(response.headers);
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
function farmResponseWithHeaders(response, headers) {
|
|
4955
|
+
if (!headers || headers === response.headers) return response;
|
|
4956
|
+
const output = new Response(response.body, {
|
|
4957
|
+
status: response.status,
|
|
4958
|
+
statusText: response.statusText,
|
|
4959
|
+
headers,
|
|
4960
|
+
});
|
|
4961
|
+
(globalThis[Symbol.for("farm.ownedResponses")] ??= new WeakSet()).add(output);
|
|
4962
|
+
return output;
|
|
4963
|
+
}
|
|
4964
|
+
|
|
4949
4965
|
function applyConfiguredResponseHeaders(response, pathname) {
|
|
4950
4966
|
if (preparedHeaderRoutes.length === 0) return response;
|
|
4951
4967
|
const pathnameSegments = splitRuntimePath(pathname).map(decodeRouteSegment);
|
|
@@ -4960,12 +4976,12 @@ function applyConfiguredResponseHeaders(response, pathname) {
|
|
|
4960
4976
|
const normalizedKey = header.key.toLowerCase();
|
|
4961
4977
|
if (normalizedKey === "set-cookie") {
|
|
4962
4978
|
if (getConfiguredSetCookieHeaders(currentHeaders).includes(header.value)) continue;
|
|
4963
|
-
if (!headers) headers =
|
|
4979
|
+
if (!headers) headers = farmEditableHeaders(response);
|
|
4964
4980
|
headers.append("Set-Cookie", header.value);
|
|
4965
4981
|
} else {
|
|
4966
4982
|
const currentValue = currentHeaders.get(header.key);
|
|
4967
4983
|
if (currentValue === header.value) continue;
|
|
4968
|
-
if (!headers) headers =
|
|
4984
|
+
if (!headers) headers = farmEditableHeaders(response);
|
|
4969
4985
|
if (normalizedKey === "link") {
|
|
4970
4986
|
appendFarmLinkHeader(headers, header.value);
|
|
4971
4987
|
} else {
|
|
@@ -4975,12 +4991,7 @@ function applyConfiguredResponseHeaders(response, pathname) {
|
|
|
4975
4991
|
}
|
|
4976
4992
|
}
|
|
4977
4993
|
|
|
4978
|
-
|
|
4979
|
-
return new Response(response.body, {
|
|
4980
|
-
status: response.status,
|
|
4981
|
-
statusText: response.statusText,
|
|
4982
|
-
headers,
|
|
4983
|
-
});
|
|
4994
|
+
return farmResponseWithHeaders(response, headers);
|
|
4984
4995
|
}
|
|
4985
4996
|
`.trim();
|
|
4986
4997
|
}
|
|
@@ -4988,8 +4999,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateConfiguredResponseHeadersRuntimeSo
|
|
|
4988
4999
|
function parseRouteRenderingDirectiveFromDisk(modulePath) {
|
|
4989
5000
|
try {
|
|
4990
5001
|
const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
|
|
4991
|
-
const directive =
|
|
4992
|
-
if (
|
|
5002
|
+
const directive = _chunkCTV2TTNPcjs.parseRouteRenderingDirective.call(void 0, source);
|
|
5003
|
+
if (_chunkCTV2TTNPcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
|
|
4993
5004
|
return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
|
|
4994
5005
|
} catch (e22) {
|
|
4995
5006
|
return void 0;
|
|
@@ -5007,7 +5018,73 @@ function generatePreloadResponseRuntimeSource() {
|
|
|
5007
5018
|
// reading it, so a changed body is never paired with a stale string.
|
|
5008
5019
|
const farmBufferedHtml = new WeakMap();
|
|
5009
5020
|
|
|
5021
|
+
// A Response Farm creates for this request. Later header steps edit it in place
|
|
5022
|
+
// instead of copying it; responses from app code are never owned. Same registry
|
|
5023
|
+
// as core's owned-response.ts (RFC 0002).
|
|
5024
|
+
function farmOwnedResponse(body, init) {
|
|
5025
|
+
const response = new Response(body, init);
|
|
5026
|
+
(globalThis[Symbol.for("farm.ownedResponses")] ??= new WeakSet()).add(response);
|
|
5027
|
+
return response;
|
|
5028
|
+
}
|
|
5029
|
+
|
|
5030
|
+
// node-server registers srvx's FastResponse here (RFC 0002). A buffered page
|
|
5031
|
+
// built with it keeps its HTML as a string until something reads the body, and
|
|
5032
|
+
// srvx writes that string in one call; other runtimes keep the Web Response.
|
|
5033
|
+
let FarmNodePageResponse;
|
|
5034
|
+
function useFarmNodePageResponse(ResponseClass) {
|
|
5035
|
+
FarmNodePageResponse = ResponseClass;
|
|
5036
|
+
}
|
|
5037
|
+
|
|
5038
|
+
// HTML of buffered pages built as FarmNodePageResponse, keyed by the response:
|
|
5039
|
+
// its body always comes from this string, and looking it up never creates the
|
|
5040
|
+
// Web body the way reading response.body would.
|
|
5041
|
+
const farmLazyBufferedHtml = new WeakMap();
|
|
5042
|
+
|
|
5043
|
+
function hasFarmContentType(headers) {
|
|
5044
|
+
if (!headers) return false;
|
|
5045
|
+
if (typeof headers.has === "function") return headers.has("content-type");
|
|
5046
|
+
for (const key in headers) if (key.toLowerCase() === "content-type") return true;
|
|
5047
|
+
return false;
|
|
5048
|
+
}
|
|
5049
|
+
|
|
5050
|
+
// A complete HTML document Farm built for this request. Same contract as
|
|
5051
|
+
// farmOwnedResponse followed by rememberFarmBufferedHtml.
|
|
5052
|
+
function farmOwnedHtmlResponse(html, init) {
|
|
5053
|
+
if (
|
|
5054
|
+
!FarmNodePageResponse ||
|
|
5055
|
+
typeof html !== "string" ||
|
|
5056
|
+
html.charCodeAt(0) === 0xfeff ||
|
|
5057
|
+
!hasFarmContentType(init?.headers)
|
|
5058
|
+
) {
|
|
5059
|
+
return rememberFarmBufferedHtml(farmOwnedResponse(html, init), html);
|
|
5060
|
+
}
|
|
5061
|
+
const response = new FarmNodePageResponse(html, init);
|
|
5062
|
+
(globalThis[Symbol.for("farm.ownedResponses")] ??= new WeakSet()).add(response);
|
|
5063
|
+
farmLazyBufferedHtml.set(response, html);
|
|
5064
|
+
return response;
|
|
5065
|
+
}
|
|
5066
|
+
|
|
5067
|
+
function isFarmOwnedResponseForPreload(response) {
|
|
5068
|
+
return (globalThis[Symbol.for("farm.ownedResponses")] ??= new WeakSet()).has(response);
|
|
5069
|
+
}
|
|
5070
|
+
|
|
5071
|
+
// Header-only rebuild: in place for an owned response, otherwise a copy Farm owns.
|
|
5072
|
+
function farmPreloadHeadersResponse(response, edit) {
|
|
5073
|
+
if (isFarmOwnedResponseForPreload(response)) {
|
|
5074
|
+
edit(response.headers);
|
|
5075
|
+
return response;
|
|
5076
|
+
}
|
|
5077
|
+
const headers = new Headers(response.headers);
|
|
5078
|
+
edit(headers);
|
|
5079
|
+
return farmOwnedResponse(response.body, {
|
|
5080
|
+
status: response.status,
|
|
5081
|
+
statusText: response.statusText,
|
|
5082
|
+
headers,
|
|
5083
|
+
});
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5010
5086
|
function rememberFarmBufferedHtml(response, html) {
|
|
5087
|
+
if (farmLazyBufferedHtml.has(response)) return response;
|
|
5011
5088
|
// Response.text() strips a leading BOM, so a BOM document keeps reading its
|
|
5012
5089
|
// body to preserve that behavior.
|
|
5013
5090
|
if (typeof html === "string" && html.charCodeAt(0) !== 0xfeff && response.body) {
|
|
@@ -5017,6 +5094,8 @@ function rememberFarmBufferedHtml(response, html) {
|
|
|
5017
5094
|
}
|
|
5018
5095
|
|
|
5019
5096
|
function getFarmOwnedBufferedHtml(response) {
|
|
5097
|
+
const lazyHtml = farmLazyBufferedHtml.get(response);
|
|
5098
|
+
if (lazyHtml !== undefined) return lazyHtml;
|
|
5020
5099
|
const body = response.body;
|
|
5021
5100
|
if (!body || response.bodyUsed || body.locked) return undefined;
|
|
5022
5101
|
return farmBufferedHtml.get(body);
|
|
@@ -5039,17 +5118,14 @@ async function applyFarmPreloadBudget(response, pathname, request) {
|
|
|
5039
5118
|
const isBuffered = bufferedMarker === "1" || hasNoHtmlPreloads;
|
|
5040
5119
|
if (!isHtml) {
|
|
5041
5120
|
if (!isStreaming && !isBuffered) return response;
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
return new Response(response.body, {
|
|
5046
|
-
status: response.status,
|
|
5047
|
-
statusText: response.statusText,
|
|
5048
|
-
headers,
|
|
5121
|
+
return farmPreloadHeadersResponse(response, (editable) => {
|
|
5122
|
+
editable.delete("x-farm-preload-streaming");
|
|
5123
|
+
editable.delete("x-farm-preload-buffered");
|
|
5049
5124
|
});
|
|
5050
5125
|
}
|
|
5051
5126
|
|
|
5052
|
-
|
|
5127
|
+
const isLazyPage = farmLazyBufferedHtml.has(response);
|
|
5128
|
+
if (isStreaming || !isBuffered || (!isLazyPage && response.body === null)) {
|
|
5053
5129
|
const managed = manageFarmLinkHeaderPreloads(linkHeader, farmPreloadConfig);
|
|
5054
5130
|
reportFarmPreloadWarnings(managed.warnings, managed.warnings.length > 0
|
|
5055
5131
|
? "route " + (pathname ?? getFarmRoutePathname(new URL(request.url).pathname))
|
|
@@ -5059,42 +5135,43 @@ async function applyFarmPreloadBudget(response, pathname, request) {
|
|
|
5059
5135
|
if (!headers.has("x-farm-preload-streaming") &&
|
|
5060
5136
|
!headers.has("x-farm-preload-buffered") &&
|
|
5061
5137
|
(managed.value || null) === headers.get("Link")) return response;
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
return new Response(response.body, {
|
|
5068
|
-
status: response.status,
|
|
5069
|
-
statusText: response.statusText,
|
|
5070
|
-
headers,
|
|
5138
|
+
return farmPreloadHeadersResponse(response, (editable) => {
|
|
5139
|
+
editable.delete("x-farm-preload-streaming");
|
|
5140
|
+
editable.delete("x-farm-preload-buffered");
|
|
5141
|
+
if (managed.value) editable.set("Link", managed.value);
|
|
5142
|
+
else editable.delete("Link");
|
|
5071
5143
|
});
|
|
5072
5144
|
}
|
|
5073
5145
|
|
|
5074
5146
|
// Keep the document/header budget semantics (including unchanged Link
|
|
5075
5147
|
// formatting), but do not consume and re-encode a proven preload-free body.
|
|
5076
|
-
headers = new Headers(headers);
|
|
5077
|
-
headers.delete("x-farm-preload-streaming");
|
|
5078
|
-
headers.delete("x-farm-preload-buffered");
|
|
5079
5148
|
const ownedHtml = hasNoHtmlPreloads ? undefined : getFarmOwnedBufferedHtml(response);
|
|
5080
5149
|
const html = hasNoHtmlPreloads ? "" : (ownedHtml ?? await response.text());
|
|
5081
5150
|
const managed = manageFarmDocumentPreloads(html, linkHeader, farmPreloadConfig);
|
|
5082
5151
|
// A remembered document the budget left unchanged keeps its unread body.
|
|
5083
5152
|
const reusesBody = hasNoHtmlPreloads || (ownedHtml !== undefined && managed.html === html);
|
|
5084
|
-
if (ownedHtml !== undefined && !reusesBody
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
if (managed.html !== html) headers.delete("Content-Length");
|
|
5153
|
+
if (ownedHtml !== undefined && !reusesBody && !isLazyPage) {
|
|
5154
|
+
response.body?.cancel().catch(() => {});
|
|
5155
|
+
}
|
|
5088
5156
|
reportFarmPreloadWarnings(managed.warnings, managed.warnings.length > 0
|
|
5089
5157
|
? "route " + (pathname ?? getFarmRoutePathname(new URL(request.url).pathname))
|
|
5090
5158
|
: undefined);
|
|
5091
|
-
const
|
|
5159
|
+
const applyBudgetHeaders = (editable) => {
|
|
5160
|
+
editable.delete("x-farm-preload-streaming");
|
|
5161
|
+
editable.delete("x-farm-preload-buffered");
|
|
5162
|
+
if (managed.linkHeader) editable.set("Link", managed.linkHeader);
|
|
5163
|
+
else editable.delete("Link");
|
|
5164
|
+
if (managed.html !== html) editable.delete("Content-Length");
|
|
5165
|
+
};
|
|
5166
|
+
if (reusesBody) return farmPreloadHeadersResponse(response, applyBudgetHeaders);
|
|
5167
|
+
const rebuiltHeaders = new Headers(headers);
|
|
5168
|
+
applyBudgetHeaders(rebuiltHeaders);
|
|
5169
|
+
// A rebuilt document is still a complete string Farm holds.
|
|
5170
|
+
return farmOwnedHtmlResponse(managed.html, {
|
|
5092
5171
|
status: response.status,
|
|
5093
5172
|
statusText: response.statusText,
|
|
5094
|
-
headers,
|
|
5173
|
+
headers: rebuiltHeaders,
|
|
5095
5174
|
});
|
|
5096
|
-
// A rebuilt document is still a complete string Farm holds.
|
|
5097
|
-
return reusesBody ? output : rememberFarmBufferedHtml(output, managed.html);
|
|
5098
5175
|
}
|
|
5099
5176
|
`.trim();
|
|
5100
5177
|
}
|
|
@@ -5112,14 +5189,14 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
|
5112
5189
|
_chunkS3JO3N4Hcjs.__name.call(void 0, generateFarmRendererAppSetupServerCode, "generateFarmRendererAppSetupServerCode");
|
|
5113
5190
|
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) {
|
|
5114
5191
|
const hasCompressionRuntime = config.compress && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5115
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
5192
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _76 => _76.agent, 'optionalAccess', _77 => _77.crawlers, 'optionalAccess', _78 => _78.enabled])) && !applicationMetadataRoutes.some(
|
|
5116
5193
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
5117
5194
|
);
|
|
5118
5195
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
5119
5196
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5120
5197
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
5121
5198
|
const adapterOwnsDocsRuntime = Boolean(
|
|
5122
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
5199
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _79 => _79.docs, 'optionalAccess', _80 => _80.enabled]) && _optionalChain([config, 'access', _81 => _81.docs, 'access', _82 => _82.adapter, 'optionalAccess', _83 => _83.server]) && config.docs.adapter.react
|
|
5123
5200
|
);
|
|
5124
5201
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
5125
5202
|
const hasIsolatedClientGraphRuntime = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
@@ -5144,7 +5221,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5144
5221
|
(image) => image.sourceType === "module"
|
|
5145
5222
|
);
|
|
5146
5223
|
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || hasFarmMiddlewareConfig(config.middleware);
|
|
5147
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
5224
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _84 => _84.docs, 'optionalAccess', _85 => _85.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
5148
5225
|
const integrationProviders = _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
5149
5226
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
5150
5227
|
(provider) => provider.component || provider.type === "clerk"
|
|
@@ -5154,16 +5231,16 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5154
5231
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
5155
5232
|
);
|
|
5156
5233
|
}
|
|
5157
|
-
const providerServerModules =
|
|
5234
|
+
const providerServerModules = _chunkX4ZV4QC5cjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
5158
5235
|
renderedIntegrationProviders,
|
|
5159
5236
|
config.root,
|
|
5160
5237
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
5161
5238
|
);
|
|
5162
5239
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
5163
5240
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
5164
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
5241
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _86 => _86.providers]);
|
|
5165
5242
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
5166
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
5243
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _87 => _87.component]) === "function")) {
|
|
5167
5244
|
throw new Error(
|
|
5168
5245
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
5169
5246
|
);
|
|
@@ -5174,14 +5251,14 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5174
5251
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
5175
5252
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
5176
5253
|
);
|
|
5177
|
-
const isolatedHydrationMode =
|
|
5178
|
-
_optionalChain([config, 'access',
|
|
5254
|
+
const isolatedHydrationMode = _chunkX4ZV4QC5cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
5255
|
+
_optionalChain([config, 'access', _88 => _88.experimental, 'optionalAccess', _89 => _89.isolatedClientHydration]),
|
|
5179
5256
|
{
|
|
5180
|
-
serverComponents: _optionalChain([config, 'access',
|
|
5257
|
+
serverComponents: _optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.serverComponents]) === true,
|
|
5181
5258
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
5182
5259
|
}
|
|
5183
5260
|
);
|
|
5184
|
-
const hydrationPlanOptions =
|
|
5261
|
+
const hydrationPlanOptions = _chunkX4ZV4QC5cjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
5185
5262
|
config.renderer,
|
|
5186
5263
|
Boolean(unsupportedIntegrationProvider)
|
|
5187
5264
|
);
|
|
@@ -5196,7 +5273,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5196
5273
|
hydrationPlanOptions
|
|
5197
5274
|
)
|
|
5198
5275
|
}));
|
|
5199
|
-
const markdownPagePlan =
|
|
5276
|
+
const markdownPagePlan = _chunkX4ZV4QC5cjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
5200
5277
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
5201
5278
|
config.root,
|
|
5202
5279
|
isolatedHydrationMode,
|
|
@@ -5205,7 +5282,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5205
5282
|
const pageHydrationPlans = new Map(
|
|
5206
5283
|
pageRoutes.map((route) => [
|
|
5207
5284
|
route.modulePath,
|
|
5208
|
-
|
|
5285
|
+
_chunkNXG66MR7cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
5209
5286
|
route.modulePath,
|
|
5210
5287
|
config.root,
|
|
5211
5288
|
isolatedHydrationMode,
|
|
@@ -5214,7 +5291,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5214
5291
|
)
|
|
5215
5292
|
])
|
|
5216
5293
|
);
|
|
5217
|
-
|
|
5294
|
+
_chunkX4ZV4QC5cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
5218
5295
|
layoutHydrationPlans.map((layout) => ({
|
|
5219
5296
|
pattern: layout.pattern,
|
|
5220
5297
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -5242,7 +5319,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5242
5319
|
apiRegistrations.push(`
|
|
5243
5320
|
{
|
|
5244
5321
|
path: ${JSON.stringify(route.path)},
|
|
5245
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
5322
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _92 => _92.pluginMethods, 'optionalAccess', _93 => _93.includes, 'call', _94 => _94(method)])))},
|
|
5246
5323
|
endpoints: ${varName},
|
|
5247
5324
|
}`);
|
|
5248
5325
|
});
|
|
@@ -5255,7 +5332,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5255
5332
|
}).map(({ route }) => route);
|
|
5256
5333
|
orderedPageRoutes.forEach((route, index) => {
|
|
5257
5334
|
const varName = `pageRoute${index}`;
|
|
5258
|
-
if (
|
|
5335
|
+
if (_chunkNXG66MR7cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
5259
5336
|
pageRegistrations.push(`
|
|
5260
5337
|
{
|
|
5261
5338
|
pattern: ${JSON.stringify(route.pattern)},
|
|
@@ -5475,25 +5552,25 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5475
5552
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
5476
5553
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
5477
5554
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
5478
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
5555
|
+
const docsHandlerImport = _optionalChain([config, 'access', _95 => _95.docs, 'optionalAccess', _96 => _96.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
5479
5556
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
5480
5557
|
const pathname = typeof requestOrPathname === "string"
|
|
5481
5558
|
? requestOrPathname
|
|
5482
5559
|
: new URL(requestOrPathname.url).pathname;
|
|
5483
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
5560
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _97 => _97.apiPath]) || "/api/docs")};
|
|
5484
5561
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
5485
5562
|
};` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
5486
5563
|
import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
|
|
5487
5564
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
5488
5565
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
5489
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
5490
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
5566
|
+
const docsFontImport = _optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
5567
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _100 => _100.docs, 'optionalAccess', _101 => _101.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
5491
5568
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
5492
5569
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
5493
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
5570
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _102 => _102.md, 'optionalAccess', _103 => _103.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
5494
5571
|
const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;";
|
|
5495
5572
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
5496
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
5573
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _104 => _104.mdx, 'optionalAccess', _105 => _105.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
5497
5574
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
5498
5575
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
5499
5576
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -5511,7 +5588,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
5511
5588
|
const integrationRuntimeImport = integrationRuntimeExports.length ? `import { ${integrationRuntimeExports.join(", ")} } from "@farm.js/core/integrations";` : "";
|
|
5512
5589
|
const instrumentationImport = instrumentationPath ? `import * as FarmInstrumentationModule from ${toVirtualEntryImportSpecifier(instrumentationPath)};` : "";
|
|
5513
5590
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
5514
|
-
const nativeMCP = generateNativeMCPPluginSource(config.mcp);
|
|
5591
|
+
const nativeMCP = _chunkXD32KALFcjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
5515
5592
|
const integrationImports = `
|
|
5516
5593
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
5517
5594
|
${layerConfigImports}
|
|
@@ -5697,7 +5774,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
5697
5774
|
|
|
5698
5775
|
function FarmDefault404Page() {
|
|
5699
5776
|
return React.createElement(React.Fragment, null,
|
|
5700
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
5777
|
+
React.createElement("style", null, ${JSON.stringify(_chunkX4ZV4QC5cjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
5701
5778
|
React.createElement("main", {
|
|
5702
5779
|
className: "farm-default-not-found",
|
|
5703
5780
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -5825,14 +5902,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
5825
5902
|
onError(error) { console.error("[Farm Image]", error); },
|
|
5826
5903
|
})`};
|
|
5827
5904
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
5828
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
5829
|
-
${_optionalChain([config, 'access',
|
|
5905
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _106 => _106.agent, 'optionalAccess', _107 => _107.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
5906
|
+
${_optionalChain([config, 'access', _108 => _108.agent, 'optionalAccess', _109 => _109.llmsTxt, 'optionalAccess', _110 => _110.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
5830
5907
|
const farmMdxConfig = ${JSON.stringify({
|
|
5831
5908
|
...config.mdx,
|
|
5832
|
-
components: typeof _optionalChain([config, 'access',
|
|
5909
|
+
components: typeof _optionalChain([config, 'access', _111 => _111.mdx, 'optionalAccess', _112 => _112.components]) === "string" ? config.mdx.components : void 0
|
|
5833
5910
|
})};
|
|
5834
5911
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
5835
|
-
${_optionalChain([config, 'access',
|
|
5912
|
+
${_optionalChain([config, 'access', _113 => _113.agent, 'optionalAccess', _114 => _114.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
5836
5913
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
5837
5914
|
// to the build.
|
|
5838
5915
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
@@ -5880,7 +5957,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
5880
5957
|
});
|
|
5881
5958
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
5882
5959
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
5883
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
5960
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _115 => _115.docs, 'optionalAccess', _116 => _116.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
5884
5961
|
try {
|
|
5885
5962
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
5886
5963
|
const candidates = [
|
|
@@ -5901,7 +5978,7 @@ globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
|
|
|
5901
5978
|
docs: farmDocsResolvedConfig,
|
|
5902
5979
|
};
|
|
5903
5980
|
const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
|
|
5904
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
5981
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _117 => _117.docs, 'optionalAccess', _118 => _118.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
|
|
5905
5982
|
${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
|
|
5906
5983
|
entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
|
|
5907
5984
|
docsPath: farmDocsResolvedConfig.entry,
|
|
@@ -5929,14 +6006,14 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _118 => _118.docs, '
|
|
|
5929
6006
|
fontStylesheetHref: "/farm-fonts.css",
|
|
5930
6007
|
globalStylesheetHref: "/assets/globals.css",
|
|
5931
6008
|
})` : "null"};
|
|
5932
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
6009
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _119 => _119.docs, 'optionalAccess', _120 => _120.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
|
|
5933
6010
|
|
|
5934
6011
|
// API routes bundled at build time
|
|
5935
6012
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
5936
6013
|
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path7, methods }) => ({ path: path7, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
|
|
5937
6014
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunkWPYFSQKKcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
5938
6015
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
5939
|
-
${_optionalChain([config, 'access',
|
|
6016
|
+
${_optionalChain([config, 'access', _121 => _121.agent, 'optionalAccess', _122 => _122.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkNPPL5YDTcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
5940
6017
|
` : ""}
|
|
5941
6018
|
function isFarmLocalAPIPathname(pathname) {
|
|
5942
6019
|
return farmLocalAPIBasePath !== "/" &&
|
|
@@ -6333,7 +6410,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
6333
6410
|
let inner = markup.replace(/^\\s+/, "");
|
|
6334
6411
|
let hoisted = "";
|
|
6335
6412
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
|
|
6336
|
-
const hoistable = /${
|
|
6413
|
+
const hoistable = /${_chunkX4ZV4QC5cjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
6337
6414
|
let match;
|
|
6338
6415
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
6339
6416
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -7042,7 +7119,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
7042
7119
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
7043
7120
|
return true;
|
|
7044
7121
|
}
|
|
7045
|
-
${_optionalChain([config, 'access',
|
|
7122
|
+
${_optionalChain([config, 'access', _123 => _123.docs, 'optionalAccess', _124 => _124.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
7046
7123
|
if (
|
|
7047
7124
|
isFarmDocsAPIRequest(pathname) ||
|
|
7048
7125
|
docsPath === "/" ||
|
|
@@ -7068,7 +7145,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
7068
7145
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
7069
7146
|
};
|
|
7070
7147
|
}
|
|
7071
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
7148
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _125 => _125.docs, 'optionalAccess', _126 => _126.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
7072
7149
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
7073
7150
|
pathname,
|
|
7074
7151
|
method: request.method,
|
|
@@ -7158,7 +7235,7 @@ function getApplicableLayouts(pathname) {
|
|
|
7158
7235
|
return applicable;
|
|
7159
7236
|
}
|
|
7160
7237
|
|
|
7161
|
-
${_optionalChain([config, 'access',
|
|
7238
|
+
${_optionalChain([config, 'access', _127 => _127.docs, 'optionalAccess', _128 => _128.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
7162
7239
|
if (request.method === "HEAD") return response;
|
|
7163
7240
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
7164
7241
|
|
|
@@ -7265,7 +7342,7 @@ ${_optionalChain([config, 'access', _128 => _128.docs, 'optionalAccess', _129 =>
|
|
|
7265
7342
|
}` : ""}
|
|
7266
7343
|
|
|
7267
7344
|
const pprShellCache = getFarmDataCache();
|
|
7268
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
7345
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _129 => _129.experimental, 'optionalAccess', _130 => _130.ppr]) === true)};
|
|
7269
7346
|
|
|
7270
7347
|
function resolveRouteRenderingView(route) {
|
|
7271
7348
|
// The same merge development uses: baked directive config under the
|
|
@@ -7388,7 +7465,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
7388
7465
|
},
|
|
7389
7466
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
7390
7467
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
7391
|
-
${_optionalChain([config, 'access',
|
|
7468
|
+
${_optionalChain([config, 'access', _131 => _131.md, 'optionalAccess', _132 => _132.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
7392
7469
|
if (matchPageRoute(pathname)) {
|
|
7393
7470
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
7394
7471
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -7423,7 +7500,7 @@ async function handleFarmRequestInContext(
|
|
|
7423
7500
|
url.search,
|
|
7424
7501
|
);
|
|
7425
7502
|
if (redirectMatch) {
|
|
7426
|
-
return
|
|
7503
|
+
return farmOwnedResponse("Redirecting to " + redirectMatch.destination, {
|
|
7427
7504
|
status: redirectMatch.statusCode,
|
|
7428
7505
|
headers: { Location: redirectMatch.destination },
|
|
7429
7506
|
});
|
|
@@ -7507,7 +7584,7 @@ async function handleFarmRequestInContext(
|
|
|
7507
7584
|
const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(undefined, farmIntegrationSetCookies)" : "undefined"};
|
|
7508
7585
|
`}
|
|
7509
7586
|
|
|
7510
|
-
${_optionalChain([config, 'access',
|
|
7587
|
+
${_optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled]) ? `
|
|
7511
7588
|
// Docs responses are served after app middleware so route guards and
|
|
7512
7589
|
// middleware headers apply to the docs engine like any other page content.
|
|
7513
7590
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -7527,7 +7604,7 @@ async function handleFarmRequestInContext(
|
|
|
7527
7604
|
);
|
|
7528
7605
|
const docsHeaders = new Headers(wrappedDocsResponse.headers);
|
|
7529
7606
|
docsHeaders.set("x-farm-preload-buffered", "1");
|
|
7530
|
-
return applyProductionMiddlewareHeaders(
|
|
7607
|
+
return applyProductionMiddlewareHeaders(farmOwnedResponse(wrappedDocsResponse.body, {
|
|
7531
7608
|
status: wrappedDocsResponse.status,
|
|
7532
7609
|
statusText: wrappedDocsResponse.statusText,
|
|
7533
7610
|
headers: docsHeaders,
|
|
@@ -7552,7 +7629,7 @@ async function handleFarmRequestInContext(
|
|
|
7552
7629
|
}
|
|
7553
7630
|
` : ""}
|
|
7554
7631
|
|
|
7555
|
-
${_optionalChain([config, 'access',
|
|
7632
|
+
${_optionalChain([config, 'access', _135 => _135.md, 'optionalAccess', _136 => _136.enabled]) ? `
|
|
7556
7633
|
if (farmMarkdownConfig?.enabled) {
|
|
7557
7634
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
7558
7635
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -7573,9 +7650,13 @@ async function handleFarmRequestInContext(
|
|
|
7573
7650
|
` : ""}
|
|
7574
7651
|
|
|
7575
7652
|
${apiRoutes.length > 0 ? `
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7653
|
+
// Clone only for an API request: cloning a Request costs more than the match,
|
|
7654
|
+
// and handleAPIRequest returns null without one.
|
|
7655
|
+
if (matchLocalAPIRequest(request)) {
|
|
7656
|
+
const apiResponse = await handleAPIRequest(cloneFarmRequestWithContext(request));
|
|
7657
|
+
if (apiResponse) {
|
|
7658
|
+
return applyProductionMiddlewareHeaders(apiResponse, middlewareHeaders);
|
|
7659
|
+
}
|
|
7579
7660
|
}
|
|
7580
7661
|
` : ""}
|
|
7581
7662
|
|
|
@@ -7586,7 +7667,7 @@ async function handleFarmRequestInContext(
|
|
|
7586
7667
|
) {
|
|
7587
7668
|
const method = request.method.toUpperCase();
|
|
7588
7669
|
const specResponse = method === "GET" || method === "HEAD"
|
|
7589
|
-
?
|
|
7670
|
+
? farmOwnedResponse(method === "HEAD" ? null : JSON.stringify(farmOpenAPIReference.spec), {
|
|
7590
7671
|
status: 200,
|
|
7591
7672
|
headers: {
|
|
7592
7673
|
"Content-Type": "application/json; charset=utf-8",
|
|
@@ -7594,7 +7675,7 @@ async function handleFarmRequestInContext(
|
|
|
7594
7675
|
"X-Content-Type-Options": "nosniff",
|
|
7595
7676
|
},
|
|
7596
7677
|
})
|
|
7597
|
-
:
|
|
7678
|
+
: farmOwnedResponse("Method Not Allowed", {
|
|
7598
7679
|
status: 405,
|
|
7599
7680
|
headers: {
|
|
7600
7681
|
"Allow": "GET, HEAD",
|
|
@@ -7610,7 +7691,7 @@ async function handleFarmRequestInContext(
|
|
|
7610
7691
|
) {
|
|
7611
7692
|
const method = request.method.toUpperCase();
|
|
7612
7693
|
const response = method === "GET" || method === "HEAD"
|
|
7613
|
-
?
|
|
7694
|
+
? farmOwnedResponse(method === "HEAD" ? null : farmOpenAPIReference.html, {
|
|
7614
7695
|
status: 200,
|
|
7615
7696
|
headers: {
|
|
7616
7697
|
"Content-Type": "text/html; charset=utf-8",
|
|
@@ -7618,7 +7699,7 @@ async function handleFarmRequestInContext(
|
|
|
7618
7699
|
"X-Content-Type-Options": "nosniff",
|
|
7619
7700
|
},
|
|
7620
7701
|
})
|
|
7621
|
-
:
|
|
7702
|
+
: farmOwnedResponse("Method Not Allowed", {
|
|
7622
7703
|
status: 405,
|
|
7623
7704
|
headers: {
|
|
7624
7705
|
"Allow": "GET, HEAD",
|
|
@@ -7647,9 +7728,9 @@ async function handleFarmRequestInContext(
|
|
|
7647
7728
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
7648
7729
|
}
|
|
7649
7730
|
` : ""}
|
|
7650
|
-
${_optionalChain([config, 'access',
|
|
7731
|
+
${_optionalChain([config, 'access', _137 => _137.agent, 'optionalAccess', _138 => _138.apiCatalog]) ? `
|
|
7651
7732
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
7652
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
7733
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkNPPL5YDTcjs.FARM_API_CATALOG_PATH)}) {
|
|
7653
7734
|
return applyProductionMiddlewareHeaders(
|
|
7654
7735
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
7655
7736
|
middlewareHeaders,
|
|
@@ -7665,11 +7746,11 @@ async function handleFarmRequestInContext(
|
|
|
7665
7746
|
);
|
|
7666
7747
|
}
|
|
7667
7748
|
` : ""}
|
|
7668
|
-
${_optionalChain([config, 'access',
|
|
7749
|
+
${_optionalChain([config, 'access', _139 => _139.agent, 'optionalAccess', _140 => _140.llmsTxt, 'optionalAccess', _141 => _141.enabled]) ? `
|
|
7669
7750
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
7670
7751
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
7671
7752
|
? "llms"
|
|
7672
|
-
: ${_optionalChain([config, 'access',
|
|
7753
|
+
: ${_optionalChain([config, 'access', _142 => _142.agent, 'optionalAccess', _143 => _143.llmsTxt, 'optionalAccess', _144 => _144.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
7673
7754
|
if (farmGeneratedLlmsKind) {
|
|
7674
7755
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
7675
7756
|
const llmsOrigin = new URL(request.url).origin;
|
|
@@ -7704,7 +7785,7 @@ async function handleFarmRequestInContext(
|
|
|
7704
7785
|
}
|
|
7705
7786
|
` : ""}
|
|
7706
7787
|
|
|
7707
|
-
${_optionalChain([config, 'access',
|
|
7788
|
+
${_optionalChain([config, 'access', _145 => _145.docs, 'optionalAccess', _146 => _146.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
7708
7789
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
7709
7790
|
if (docsAPIResponse) {
|
|
7710
7791
|
return applyProductionMiddlewareHeaders(docsAPIResponse, middlewareHeaders);
|
|
@@ -7713,7 +7794,7 @@ async function handleFarmRequestInContext(
|
|
|
7713
7794
|
|
|
7714
7795
|
// Preserve the explicit JSON 404 for misses below the configured local API path.
|
|
7715
7796
|
if (isFarmLocalAPIPathname(pathname)) {
|
|
7716
|
-
return applyProductionMiddlewareHeaders(
|
|
7797
|
+
return applyProductionMiddlewareHeaders(farmOwnedResponse(
|
|
7717
7798
|
JSON.stringify({ error: "API route not found", pathname }),
|
|
7718
7799
|
{ status: 404, headers: { "Content-Type": "application/json" } }
|
|
7719
7800
|
), middlewareHeaders);
|
|
@@ -7729,7 +7810,7 @@ async function handleFarmRequestInContext(
|
|
|
7729
7810
|
);
|
|
7730
7811
|
if (trailingSlashLocation) {
|
|
7731
7812
|
return applyProductionMiddlewareHeaders(
|
|
7732
|
-
|
|
7813
|
+
farmOwnedResponse(null, {
|
|
7733
7814
|
status: 308,
|
|
7734
7815
|
headers: { Location: trailingSlashLocation },
|
|
7735
7816
|
}),
|
|
@@ -7772,7 +7853,7 @@ async function handleFarmRequestInContext(
|
|
|
7772
7853
|
status: 200,
|
|
7773
7854
|
durationMs: Date.now() - requestStartTime,
|
|
7774
7855
|
});
|
|
7775
|
-
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(
|
|
7856
|
+
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(cachedPPRShell, {
|
|
7776
7857
|
status: 200,
|
|
7777
7858
|
headers: {
|
|
7778
7859
|
"Content-Type": "text/html; charset=utf-8",
|
|
@@ -8139,7 +8220,7 @@ async function handleFarmRequestInContext(
|
|
|
8139
8220
|
);
|
|
8140
8221
|
}
|
|
8141
8222
|
}
|
|
8142
|
-
${_optionalChain([config, 'access',
|
|
8223
|
+
${_optionalChain([config, 'access', _147 => _147.md, 'optionalAccess', _148 => _148.enabled]) ? `
|
|
8143
8224
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
8144
8225
|
// using the public path the .md request will be resolved against.
|
|
8145
8226
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -8147,7 +8228,7 @@ async function handleFarmRequestInContext(
|
|
|
8147
8228
|
getFarmMarkdownAlternatePath(farmMarkdownConfig, pathname),
|
|
8148
8229
|
);` : ""}
|
|
8149
8230
|
|
|
8150
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
8231
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _149 => _149.agent, 'optionalAccess', _150 => _150.jsonLd]), () => ( false)))} });
|
|
8151
8232
|
const title = renderedMetadata.title;
|
|
8152
8233
|
const metaTags = renderedMetadata.tags;
|
|
8153
8234
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -8267,7 +8348,7 @@ async function handleFarmRequestInContext(
|
|
|
8267
8348
|
});
|
|
8268
8349
|
}
|
|
8269
8350
|
);
|
|
8270
|
-
return applyProductionMiddlewareHeaders(
|
|
8351
|
+
return applyProductionMiddlewareHeaders(farmOwnedResponse(streamedDocument, {
|
|
8271
8352
|
status: pageStatus,
|
|
8272
8353
|
headers: { ...responseHeaders, "x-farm-preload-streaming": "1" },
|
|
8273
8354
|
}), middlewareHeaders);
|
|
@@ -8408,7 +8489,7 @@ async function handleFarmRequestInContext(
|
|
|
8408
8489
|
durationMs: Date.now() - requestStartTime,
|
|
8409
8490
|
});
|
|
8410
8491
|
|
|
8411
|
-
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(
|
|
8492
|
+
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(
|
|
8412
8493
|
fullHtml,
|
|
8413
8494
|
{
|
|
8414
8495
|
status: pageStatus,
|
|
@@ -8442,7 +8523,7 @@ async function handleFarmRequestInContext(
|
|
|
8442
8523
|
status: redirect.status,
|
|
8443
8524
|
durationMs: Date.now() - requestStartTime,
|
|
8444
8525
|
});
|
|
8445
|
-
return applyProductionMiddlewareHeaders(
|
|
8526
|
+
return applyProductionMiddlewareHeaders(farmOwnedResponse(null, {
|
|
8446
8527
|
status: redirect.status,
|
|
8447
8528
|
headers: {
|
|
8448
8529
|
Location: redirectUrl,
|
|
@@ -8510,7 +8591,7 @@ async function handleFarmRequestInContext(
|
|
|
8510
8591
|
status: errorStatus,
|
|
8511
8592
|
durationMs: Date.now() - requestStartTime,
|
|
8512
8593
|
});
|
|
8513
|
-
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(
|
|
8594
|
+
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(errorDocument, {
|
|
8514
8595
|
status: errorStatus,
|
|
8515
8596
|
headers: {
|
|
8516
8597
|
"Content-Type": "text/html; charset=utf-8",
|
|
@@ -8545,7 +8626,7 @@ async function handleFarmRequestInContext(
|
|
|
8545
8626
|
farmResolvedRuntimeConfig.basePath,
|
|
8546
8627
|
getFarmTheme(request)
|
|
8547
8628
|
);
|
|
8548
|
-
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(
|
|
8629
|
+
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(
|
|
8549
8630
|
fallbackDocument,
|
|
8550
8631
|
{
|
|
8551
8632
|
status: errorStatus,
|
|
@@ -8576,7 +8657,7 @@ async function handleFarmRequestInContext(
|
|
|
8576
8657
|
status: 404,
|
|
8577
8658
|
durationMs: Date.now() - requestStartTime,
|
|
8578
8659
|
});
|
|
8579
|
-
return applyProductionMiddlewareHeaders(
|
|
8660
|
+
return applyProductionMiddlewareHeaders(farmOwnedResponse(
|
|
8580
8661
|
createFarmMarkdownErrorBody(404, pathname, applyFarmBasePath("/", farmResolvedRuntimeConfig.basePath)),
|
|
8581
8662
|
{
|
|
8582
8663
|
status: 404,
|
|
@@ -8673,7 +8754,7 @@ async function handleFarmRequestInContext(
|
|
|
8673
8754
|
durationMs: Date.now() - requestStartTime,
|
|
8674
8755
|
});
|
|
8675
8756
|
|
|
8676
|
-
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(
|
|
8757
|
+
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(fullHtml, {
|
|
8677
8758
|
status: 404,
|
|
8678
8759
|
headers: {
|
|
8679
8760
|
"Content-Type": "text/html; charset=utf-8",
|
|
@@ -8688,7 +8769,7 @@ async function handleFarmRequestInContext(
|
|
|
8688
8769
|
farmResolvedRuntimeConfig.basePath,
|
|
8689
8770
|
getFarmTheme(request)
|
|
8690
8771
|
);
|
|
8691
|
-
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(
|
|
8772
|
+
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(
|
|
8692
8773
|
fallbackDocument,
|
|
8693
8774
|
{
|
|
8694
8775
|
status: 404,
|
|
@@ -8751,22 +8832,22 @@ async function handleFarmPluginRequest(request, runtimeOptions, adapterContext)
|
|
|
8751
8832
|
headers.delete("content-length");
|
|
8752
8833
|
headers.delete("x-farm-preload-streaming");
|
|
8753
8834
|
headers.set("x-farm-preload-buffered", getFarmBufferedPreloadMarker(html));
|
|
8754
|
-
return
|
|
8835
|
+
return farmOwnedHtmlResponse(html, {
|
|
8755
8836
|
status: response.status,
|
|
8756
8837
|
statusText: response.statusText,
|
|
8757
8838
|
headers,
|
|
8758
|
-
})
|
|
8839
|
+
});
|
|
8759
8840
|
}
|
|
8760
8841
|
|
|
8761
8842
|
${generatePreloadResponseRuntimeSource()}
|
|
8762
8843
|
|
|
8763
8844
|
// Export as Web Standard fetch API
|
|
8764
8845
|
export async function fetch(request, context) {
|
|
8765
|
-
${_optionalChain([config, 'access',
|
|
8846
|
+
${_optionalChain([config, 'access', _151 => _151.agent, 'optionalAccess', _152 => _152.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
8766
8847
|
basePath: farmLocalAPIBasePath,
|
|
8767
8848
|
dispatch: async (localRequest) =>
|
|
8768
8849
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
8769
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
8850
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _153 => _153.agent, 'optionalAccess', _154 => _154.noindexPreviews]) ? `
|
|
8770
8851
|
// Keep every response of a preview deployment out of search indexes.
|
|
8771
8852
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
8772
8853
|
}
|
|
@@ -8832,7 +8913,7 @@ async function handleFarmFetch(request, context) {
|
|
|
8832
8913
|
const response = await _runWithCurrentRequest(request, () =>
|
|
8833
8914
|
_runWithAfterRequest(request, runRequest, context),
|
|
8834
8915
|
);
|
|
8835
|
-
return ${hasCompressionRuntime && !hasPluginRuntime ? "compressFarmResponse(request, response, getFarmOwnedBufferedHtml(response))" : "response"};
|
|
8916
|
+
return ${hasCompressionRuntime && !hasPluginRuntime ? "compressFarmResponse(request, response, getFarmOwnedBufferedHtml(response), farmLazyBufferedHtml.has(response))" : "response"};
|
|
8836
8917
|
}),
|
|
8837
8918
|
{
|
|
8838
8919
|
onResponseFinished: typeof context?.onResponseFinished === "function"
|
|
@@ -8841,7 +8922,7 @@ async function handleFarmFetch(request, context) {
|
|
|
8841
8922
|
},
|
|
8842
8923
|
);
|
|
8843
8924
|
}
|
|
8844
|
-
export { createFarmNodeRequestAbortSignal };
|
|
8925
|
+
export { createFarmNodeRequestAbortSignal, getFarmOwnedBufferedHtml, useFarmNodePageResponse };
|
|
8845
8926
|
export default { fetch, lifecycle: farmProductionLifecycle };
|
|
8846
8927
|
`.trim();
|
|
8847
8928
|
}
|
|
@@ -8909,7 +8990,7 @@ function configMiddlewareMayHandlePath(config, pathname) {
|
|
|
8909
8990
|
if (!hasFarmMiddlewareConfig(config)) return false;
|
|
8910
8991
|
const entries = Array.isArray(config) ? config : [config];
|
|
8911
8992
|
return entries.some((entry) => {
|
|
8912
|
-
if (_optionalChain([entry, 'access',
|
|
8993
|
+
if (_optionalChain([entry, 'access', _155 => _155.exclude, 'optionalAccess', _156 => _156.some, 'call', _157 => _157((pattern) => middlewarePatternMatches(pattern, pathname))])) {
|
|
8913
8994
|
return false;
|
|
8914
8995
|
}
|
|
8915
8996
|
if (!entry.matcher) return true;
|
|
@@ -8965,11 +9046,11 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
8965
9046
|
}
|
|
8966
9047
|
if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
|
|
8967
9048
|
if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
|
|
8968
|
-
if (
|
|
9049
|
+
if (_chunkJFHKNFEOcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
8969
9050
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
8970
9051
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
8971
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
8972
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
9052
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _158 => _158.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
9053
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _159 => _159.regions, 'optionalAccess', _160 => _160.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
8973
9054
|
return "route runtime controls";
|
|
8974
9055
|
}
|
|
8975
9056
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -8991,7 +9072,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
8991
9072
|
const nitroBuilder = nitroBuilderResult.value;
|
|
8992
9073
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
8993
9074
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
8994
|
-
const outputDir =
|
|
9075
|
+
const outputDir = _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
8995
9076
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
8996
9077
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
8997
9078
|
const imageRuntime = resolveImageRuntime(config, preset);
|
|
@@ -9082,12 +9163,16 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9082
9163
|
await fs.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
|
|
9083
9164
|
}
|
|
9084
9165
|
const nitroEntryPath = _path2.default.join(ssrOutputDir, "nitro-entry.mjs");
|
|
9166
|
+
const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
|
|
9085
9167
|
const nitroEntryCode = `
|
|
9086
9168
|
// Farm.js Nitro Entry
|
|
9087
9169
|
// This file adapts Farm's Web fetch handler to Nitro's event handler contract.
|
|
9088
9170
|
|
|
9089
9171
|
import { useNitroHooks } from '#nitro/runtime/app'
|
|
9090
|
-
import handler, { farmProductionLifecycle, createFarmNodeRequestAbortSignal } from './${ssrEntryFile}'
|
|
9172
|
+
import handler, { farmProductionLifecycle, createFarmNodeRequestAbortSignal${nodeAdapterModule ? ", getFarmOwnedBufferedHtml, useFarmNodePageResponse" : ""} } from './${ssrEntryFile}'${nodeAdapterModule ? `
|
|
9173
|
+
import { FastResponse } from ${JSON.stringify(nodeAdapterModule)}
|
|
9174
|
+
|
|
9175
|
+
useFarmNodePageResponse(FastResponse)` : ""}
|
|
9091
9176
|
|
|
9092
9177
|
export { farmProductionLifecycle }
|
|
9093
9178
|
|
|
@@ -9183,11 +9268,14 @@ function resolveTrustedLocalOrigin(event, request) {
|
|
|
9183
9268
|
// Export the event handler for Nitro
|
|
9184
9269
|
export default async function farmNitroEventHandler(event) {
|
|
9185
9270
|
registerFarmCloseHook()
|
|
9186
|
-
//
|
|
9187
|
-
//
|
|
9271
|
+
// Abort only on an actual disconnect, the same events as Farm's development
|
|
9272
|
+
// server. srvx's Request already aborts that way (on a response close before
|
|
9273
|
+
// it ended, never on a normal IncomingMessage close), so use it as is. Other
|
|
9274
|
+
// Node adapters get a copy with Farm's own signal.
|
|
9188
9275
|
const node = event.node
|
|
9189
|
-
const
|
|
9190
|
-
const
|
|
9276
|
+
const srvxRequest = event.req?._request
|
|
9277
|
+
const webRequest = srvxRequest || event.req
|
|
9278
|
+
const request = !srvxRequest && node?.req && node?.res
|
|
9191
9279
|
? new Request(webRequest, { signal: createFarmNodeRequestAbortSignal(node.req, node.res) })
|
|
9192
9280
|
: webRequest
|
|
9193
9281
|
const response = await handler.fetch(request, {
|
|
@@ -9198,20 +9286,42 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9198
9286
|
})
|
|
9199
9287
|
|
|
9200
9288
|
// Nitro records asset compression negotiation on the event response. Merge
|
|
9201
|
-
// Farm's cache signals there so H3 preserves both sets of Vary values.
|
|
9289
|
+
// Farm's cache signals there so H3 preserves both sets of Vary values. Only
|
|
9290
|
+
// merge into a Vary Nitro set: any event header makes H3 rebuild the response
|
|
9291
|
+
// around its body, and without one H3 keeps Farm's Vary as it is.
|
|
9202
9292
|
const farmVary = response.headers.get('Vary')
|
|
9203
|
-
if (farmVary)
|
|
9204
|
-
|
|
9205
|
-
|
|
9293
|
+
if (farmVary) {
|
|
9294
|
+
const nitroHeaders = event.res.headers
|
|
9295
|
+
if (nitroHeaders.has('Vary')) mergeVaryHeaders(nitroHeaders, farmVary)
|
|
9296
|
+
}
|
|
9297
|
+
return ${nodeAdapterModule ? "toFarmNodeResponse(request, response)" : "response"}
|
|
9298
|
+
}${nodeAdapterModule ? `
|
|
9299
|
+
|
|
9300
|
+
// A page Farm still holds as one complete string is sent in a single write with
|
|
9301
|
+
// Content-Length, instead of srvx reading the Web stream chunk by chunk. Any
|
|
9302
|
+
// step that read, cloned or replaced the body made a new stream, so its lookup
|
|
9303
|
+
// misses and that response is sent as it is.
|
|
9304
|
+
function toFarmNodeResponse(request, response) {
|
|
9305
|
+
if (request.method === 'HEAD') return response
|
|
9306
|
+
// Already a FastResponse (a buffered page built as one): srvx sends it as is.
|
|
9307
|
+
if (typeof response._toNodeResponse === 'function') return response
|
|
9308
|
+
const html = getFarmOwnedBufferedHtml(response)
|
|
9309
|
+
if (html === undefined) return response
|
|
9310
|
+
return new FastResponse(html, {
|
|
9311
|
+
status: response.status,
|
|
9312
|
+
statusText: response.statusText,
|
|
9313
|
+
headers: response.headers,
|
|
9314
|
+
})
|
|
9315
|
+
}` : ""}
|
|
9206
9316
|
`.trim();
|
|
9207
9317
|
await fs.writeFile(nitroEntryPath, nitroEntryCode);
|
|
9208
9318
|
const farmNodeServerEntryPath = preset === "node-server" ? _path2.default.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
|
|
9209
|
-
if (farmNodeServerEntryPath) {
|
|
9319
|
+
if (farmNodeServerEntryPath && nodeAdapterModule) {
|
|
9210
9320
|
await fs.writeFile(
|
|
9211
9321
|
farmNodeServerEntryPath,
|
|
9212
9322
|
createFarmNodeServerEntry({
|
|
9213
9323
|
nitroEntryFile: _path2.default.basename(nitroEntryPath),
|
|
9214
|
-
nodeAdapterModule
|
|
9324
|
+
nodeAdapterModule,
|
|
9215
9325
|
server: config.server,
|
|
9216
9326
|
websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/node")
|
|
9217
9327
|
})
|
|
@@ -9302,7 +9412,13 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9302
9412
|
},
|
|
9303
9413
|
rollupConfig: {
|
|
9304
9414
|
external: nitroRollupExternal,
|
|
9305
|
-
plugins:
|
|
9415
|
+
plugins: [
|
|
9416
|
+
...hasGeneratedMetadataImages && !useExternalMetadataImageRuntime ? [createMetadataImageWasmPlugin()] : [],
|
|
9417
|
+
// Workers bundle React here rather than loading it from node_modules.
|
|
9418
|
+
// Unenv rewrites `process` before Nitro's own replacements run, so
|
|
9419
|
+
// React's development builds would otherwise ship next to production.
|
|
9420
|
+
...isCloudflareWorker ? [createReactProductionModePlugin()] : []
|
|
9421
|
+
]
|
|
9306
9422
|
},
|
|
9307
9423
|
// Keep the public Nitro boolean intact for build hooks. Farm replaces
|
|
9308
9424
|
// Nitro's minifier only when no custom OXC transform was requested.
|
|
@@ -9327,20 +9443,20 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9327
9443
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
9328
9444
|
);
|
|
9329
9445
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
9330
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
9331
|
-
_optionalChain([nitroConfig, 'access',
|
|
9332
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
9446
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _161 => _161.rollupConfig, 'optionalAccess', _162 => _162.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _163 => _163.rollupConfig, 'optionalAccess', _164 => _164.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _165 => _165.output, 'optionalAccess', _166 => _166.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
9447
|
+
_optionalChain([nitroConfig, 'access', _167 => _167.handlers, 'optionalAccess', _168 => _168.some, 'call', _169 => _169(
|
|
9448
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _170 => _170.handler]) || "") === nitroEntryPath
|
|
9333
9449
|
)])
|
|
9334
9450
|
);
|
|
9335
9451
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
9336
9452
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
9337
9453
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
9338
9454
|
const shouldMinify = nitroConfig.minify !== false;
|
|
9339
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
9455
|
+
const keepServerNames = !(_optionalChain([config, 'access', _171 => _171.docs, 'optionalAccess', _172 => _172.enabled]) && _optionalChain([config, 'access', _173 => _173.docs, 'access', _174 => _174.adapter, 'optionalAccess', _175 => _175.server]));
|
|
9340
9456
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
9341
9457
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
9342
9458
|
if (canReusePrebuiltSSR) {
|
|
9343
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
9459
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _176 => _176.rollupConfig, 'optionalAccess', _177 => _177.plugins]);
|
|
9344
9460
|
nitroConfig.rollupConfig = {
|
|
9345
9461
|
...nitroConfig.rollupConfig,
|
|
9346
9462
|
plugins: [
|
|
@@ -9351,10 +9467,10 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9351
9467
|
}
|
|
9352
9468
|
nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
|
|
9353
9469
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
9354
|
-
if (_optionalChain([config, 'access',
|
|
9470
|
+
if (_optionalChain([config, 'access', _178 => _178.md, 'optionalAccess', _179 => _179.enabled])) {
|
|
9355
9471
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
9356
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
9357
|
-
const alternatePath =
|
|
9472
|
+
if (!route.contents || !_optionalChain([route, 'access', _180 => _180.contentType, 'optionalAccess', _181 => _181.toLowerCase, 'call', _182 => _182(), 'access', _183 => _183.includes, 'call', _184 => _184("html")])) return;
|
|
9473
|
+
const alternatePath = _chunk6CNX6Q3Kcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
|
|
9358
9474
|
if (!alternatePath) return;
|
|
9359
9475
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
9360
9476
|
const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
@@ -9374,8 +9490,8 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9374
9490
|
}
|
|
9375
9491
|
if (config.security.csp && config.security.csp.nonce) {
|
|
9376
9492
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
9377
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
9378
|
-
const staticCsp = await
|
|
9493
|
+
if (!route.contents || !_optionalChain([route, 'access', _185 => _185.contentType, 'optionalAccess', _186 => _186.toLowerCase, 'call', _187 => _187(), 'access', _188 => _188.includes, 'call', _189 => _189("html")])) return;
|
|
9494
|
+
const staticCsp = await _chunkXLTV4VOGcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
9379
9495
|
if (!staticCsp) return;
|
|
9380
9496
|
route.contents = staticCsp.html;
|
|
9381
9497
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
@@ -9582,7 +9698,7 @@ async function moveVercelOutputPath(src, dest, fs) {
|
|
|
9582
9698
|
await fs.rename(src, dest);
|
|
9583
9699
|
return;
|
|
9584
9700
|
} catch (error) {
|
|
9585
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
9701
|
+
const code = _optionalChain([error, 'optionalAccess', _190 => _190.code]);
|
|
9586
9702
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
9587
9703
|
throw error;
|
|
9588
9704
|
}
|
|
@@ -9609,7 +9725,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
|
|
|
9609
9725
|
try {
|
|
9610
9726
|
await moveVercelOutputPath(publicDir, staticDir, fs);
|
|
9611
9727
|
} catch (error) {
|
|
9612
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
9728
|
+
if (_optionalChain([error, 'optionalAccess', _191 => _191.code]) !== "ENOENT") throw error;
|
|
9613
9729
|
}
|
|
9614
9730
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs);
|
|
9615
9731
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs);
|
|
@@ -9642,7 +9758,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
|
|
|
9642
9758
|
const docsContentDir = resolveBuildDocsContentDir(config, root);
|
|
9643
9759
|
if (!docsContentDir) return;
|
|
9644
9760
|
const bundledContentDir = _path2.default.join(nitroFuncDir, "farm-docs-content");
|
|
9645
|
-
const lastModifiedManifest =
|
|
9761
|
+
const lastModifiedManifest = _chunkQ5JFU33Qcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
9646
9762
|
fallback: "now"
|
|
9647
9763
|
});
|
|
9648
9764
|
await fs.rm(bundledContentDir, { recursive: true, force: true });
|
|
@@ -9652,7 +9768,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
|
|
|
9652
9768
|
force: true
|
|
9653
9769
|
});
|
|
9654
9770
|
await fs.writeFile(
|
|
9655
|
-
_path2.default.join(bundledContentDir,
|
|
9771
|
+
_path2.default.join(bundledContentDir, _chunkQ5JFU33Qcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
9656
9772
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
9657
9773
|
`
|
|
9658
9774
|
);
|
|
@@ -9729,7 +9845,7 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
|
|
|
9729
9845
|
try {
|
|
9730
9846
|
await copyPackage("sharp", sharpRequire);
|
|
9731
9847
|
if (!copiedPackages.has("sharp")) {
|
|
9732
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
9848
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkX4ZV4QC5cjs.SHARP_INSTALL_HINT}`);
|
|
9733
9849
|
}
|
|
9734
9850
|
} catch (error) {
|
|
9735
9851
|
await fs.rm(stageDir, { recursive: true, force: true });
|
|
@@ -9943,7 +10059,7 @@ function createBuildTargetBaseline(config) {
|
|
|
9943
10059
|
preset,
|
|
9944
10060
|
distDir,
|
|
9945
10061
|
outputDir,
|
|
9946
|
-
outputWasDerived: outputDir ===
|
|
10062
|
+
outputWasDerived: outputDir === _chunkJFHKNFEOcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
9947
10063
|
};
|
|
9948
10064
|
}
|
|
9949
10065
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
|
|
@@ -9953,8 +10069,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
9953
10069
|
const distDir = config.distDir || ".farm";
|
|
9954
10070
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
9955
10071
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
9956
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
9957
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
10072
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkJFHKNFEOcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
10073
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkJFHKNFEOcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
9958
10074
|
return {
|
|
9959
10075
|
root,
|
|
9960
10076
|
preset,
|
|
@@ -9962,7 +10078,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
9962
10078
|
distDir,
|
|
9963
10079
|
deployTarget,
|
|
9964
10080
|
outputDir,
|
|
9965
|
-
deployOutputDir:
|
|
10081
|
+
deployOutputDir: _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
9966
10082
|
};
|
|
9967
10083
|
}
|
|
9968
10084
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
|
|
@@ -9971,7 +10087,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
9971
10087
|
const targetBaseline = createBuildTargetBaseline(config);
|
|
9972
10088
|
let targets;
|
|
9973
10089
|
const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
|
|
9974
|
-
const pluginManager = new (0,
|
|
10090
|
+
const pluginManager = new (0, _chunkX4ZV4QC5cjs.PluginManager)({
|
|
9975
10091
|
config,
|
|
9976
10092
|
isDev: false,
|
|
9977
10093
|
isProd: true
|
|
@@ -10000,12 +10116,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10000
10116
|
};
|
|
10001
10117
|
config = {
|
|
10002
10118
|
...config,
|
|
10003
|
-
images:
|
|
10119
|
+
images: _chunkX4ZV4QC5cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
10004
10120
|
root: targets.root,
|
|
10005
10121
|
preset: targets.preset
|
|
10006
10122
|
})
|
|
10007
10123
|
};
|
|
10008
|
-
if (_optionalChain([config, 'access',
|
|
10124
|
+
if (_optionalChain([config, 'access', _192 => _192.docs, 'optionalAccess', _193 => _193.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
|
|
10009
10125
|
pluginManager.updateContext({ config });
|
|
10010
10126
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
10011
10127
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
@@ -10019,8 +10135,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10019
10135
|
});
|
|
10020
10136
|
_chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
10021
10137
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
10022
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
10023
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
10138
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _194 => _194.status]) === "rejected") throw productionViteResult.reason;
|
|
10139
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _195 => _195.value]);
|
|
10024
10140
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
10025
10141
|
projectModuleServer = await createProjectModuleServer(
|
|
10026
10142
|
createViteServer,
|
|
@@ -10028,18 +10144,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10028
10144
|
root,
|
|
10029
10145
|
rendererBuild.signal
|
|
10030
10146
|
);
|
|
10031
|
-
const farmApp =
|
|
10147
|
+
const farmApp = _chunkX4ZV4QC5cjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
10032
10148
|
await farmApp.initialize();
|
|
10033
10149
|
const routeManager = farmApp.getRouteManager();
|
|
10034
10150
|
const serverRenderer = farmApp.getServerRenderer();
|
|
10035
|
-
const typeArtifacts =
|
|
10151
|
+
const typeArtifacts = _chunkCTV2TTNPcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
10036
10152
|
root,
|
|
10037
10153
|
srcDir,
|
|
10038
10154
|
layers: config.layers,
|
|
10039
10155
|
plugins: config.plugins,
|
|
10040
10156
|
extraRoutes: [
|
|
10041
|
-
..._optionalChain([config, 'access',
|
|
10042
|
-
...
|
|
10157
|
+
..._optionalChain([config, 'access', _196 => _196.openapi, 'optionalAccess', _197 => _197.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
10158
|
+
..._chunkQ5JFU33Qcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
10043
10159
|
],
|
|
10044
10160
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
10045
10161
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -10048,7 +10164,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10048
10164
|
const message = error instanceof Error ? error.message : String(error);
|
|
10049
10165
|
_chunk5QIKR7RRcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
|
|
10050
10166
|
});
|
|
10051
|
-
const apiRouteManager = new (0,
|
|
10167
|
+
const apiRouteManager = new (0, _chunkEXLKRR4Ucjs.APIRouteManager)(
|
|
10052
10168
|
_chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config),
|
|
10053
10169
|
projectModuleServer,
|
|
10054
10170
|
{
|
|
@@ -10123,7 +10239,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10123
10239
|
throw error;
|
|
10124
10240
|
} finally {
|
|
10125
10241
|
try {
|
|
10126
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
10242
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _198 => _198.close, 'call', _199 => _199()]);
|
|
10127
10243
|
} finally {
|
|
10128
10244
|
rendererBuild.abort();
|
|
10129
10245
|
}
|
|
@@ -10135,7 +10251,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10135
10251
|
ssr: true,
|
|
10136
10252
|
buildLifetime
|
|
10137
10253
|
});
|
|
10138
|
-
const viteConfig =
|
|
10254
|
+
const viteConfig = _chunkX4ZV4QC5cjs.mergeFarmViteConfig.call(void 0,
|
|
10139
10255
|
{
|
|
10140
10256
|
root,
|
|
10141
10257
|
appType: "custom",
|
|
@@ -10147,7 +10263,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10147
10263
|
},
|
|
10148
10264
|
plugins: [
|
|
10149
10265
|
...rendererVitePlugins,
|
|
10150
|
-
|
|
10266
|
+
_chunkX4ZV4QC5cjs.farmFontImportsPlugin.call(void 0, {
|
|
10151
10267
|
root,
|
|
10152
10268
|
basePath: config.basePath,
|
|
10153
10269
|
publicDir: config.publicDir
|
|
@@ -10159,7 +10275,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10159
10275
|
hmr: false
|
|
10160
10276
|
},
|
|
10161
10277
|
resolve: {
|
|
10162
|
-
alias:
|
|
10278
|
+
alias: _chunkX4ZV4QC5cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
10163
10279
|
dedupe: [...config.renderer.dedupe || []]
|
|
10164
10280
|
},
|
|
10165
10281
|
optimizeDeps: {
|
|
@@ -10245,7 +10361,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
10245
10361
|
define: {
|
|
10246
10362
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
10247
10363
|
__FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
|
|
10248
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
10364
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _200 => _200.env, 'optionalAccess', _201 => _201.public]) || {})
|
|
10249
10365
|
},
|
|
10250
10366
|
plugins: [
|
|
10251
10367
|
farmI18nClientBridgePlugin(),
|
|
@@ -10280,7 +10396,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10280
10396
|
if (pluginManager) {
|
|
10281
10397
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
10282
10398
|
}
|
|
10283
|
-
const outputDir =
|
|
10399
|
+
const outputDir = _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10284
10400
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
10285
10401
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
10286
10402
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -10351,7 +10467,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10351
10467
|
root,
|
|
10352
10468
|
preset,
|
|
10353
10469
|
distDir,
|
|
10354
|
-
outputDir:
|
|
10470
|
+
outputDir: _chunkJFHKNFEOcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
10355
10471
|
});
|
|
10356
10472
|
}
|
|
10357
10473
|
}
|