@farm.js/core 0.1.35 → 0.1.36
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/{metadata-WGpBYcGn.d.mts → agent-mcp-BVExL8rZ.d.mts} +45 -2
- package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
- package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
- package/dist/{metadata-BnLDsUOS.d.ts → agent-mcp-luzfXK-P.d.ts} +45 -2
- package/dist/agent-runtime.cjs +5 -3
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +4 -2
- package/dist/api/route-manager.cjs +6 -6
- package/dist/api/route-manager.d.mts +10 -4
- package/dist/api/route-manager.d.ts +10 -4
- package/dist/api/route-manager.mjs +5 -5
- package/dist/api/runtime.cjs +4 -4
- package/dist/api/runtime.d.mts +4 -62
- package/dist/api/runtime.d.ts +4 -62
- package/dist/api/runtime.mjs +3 -3
- package/dist/api.cjs +8 -8
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +7 -7
- package/dist/{app-D_j9AAVL.d.mts → app-BukwkFIu.d.mts} +17 -3
- package/dist/{app-BXB3JZYc.d.ts → app-Yfa2dsFy.d.ts} +17 -3
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/app-markdown.mjs +3 -3
- package/dist/{chunk-4KU5Q7C2.mjs → chunk-276VJSM6.mjs} +221 -48
- package/dist/{chunk-PFQKNERH.cjs → chunk-2YTDKNH3.cjs} +364 -197
- package/dist/{chunk-UAORZ7QA.mjs → chunk-35GKZR22.mjs} +2 -2
- package/dist/{chunk-QAU5JD57.mjs → chunk-35WV46VL.mjs} +203 -36
- package/dist/{chunk-EFCQPQMG.cjs → chunk-42NHY7HW.cjs} +54 -4
- package/dist/{chunk-SOMHP6GF.mjs → chunk-4E5AEDKY.mjs} +2 -2
- package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
- package/dist/{chunk-2G2NNLE2.mjs → chunk-4GLOOWKE.mjs} +4 -4
- package/dist/{chunk-62XKI4Z3.cjs → chunk-4NU4GGTC.cjs} +2 -2
- package/dist/{chunk-4JHOT46A.mjs → chunk-4WCZJQUO.mjs} +54 -4
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/{chunk-IPXLADVO.cjs → chunk-ADEA7PN3.cjs} +122 -61
- package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-4MMGO7YW.cjs → chunk-AO6RYU5N.cjs} +31 -28
- package/dist/{chunk-GFHLGIYC.cjs → chunk-BO36SELV.cjs} +6 -6
- package/dist/{chunk-6TJOML4E.mjs → chunk-BPOF5U4N.mjs} +4 -4
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-FTFYRMQQ.cjs → chunk-CBJJH36A.cjs} +50 -25
- package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-X6W5FFH6.cjs → chunk-D2BB47NB.cjs} +8 -8
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-YC6V7PWE.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
- package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
- package/dist/{chunk-Q3VLETLE.mjs → chunk-EWET4D2Y.mjs} +1 -1
- package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-XBML5KMG.cjs → chunk-FO427P6I.cjs} +22 -12
- package/dist/{chunk-SAZVVAJH.mjs → chunk-GQRWBCWK.mjs} +8 -5
- package/dist/{chunk-F6Z3Y5KL.mjs → chunk-HOXTWRGB.mjs} +1 -1
- package/dist/{chunk-3BHT4WMP.cjs → chunk-JNUWCDTF.cjs} +6 -6
- package/dist/{chunk-73MC7ZL6.cjs → chunk-JZVADIOD.cjs} +2 -2
- package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-6ETPZTJI.mjs → chunk-LSZAVSGY.mjs} +116 -55
- package/dist/{chunk-HMIJDL7S.mjs → chunk-MKYBIIAQ.mjs} +30 -5
- package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
- package/dist/{chunk-7L5V3KQO.cjs → chunk-N2NAS2AM.cjs} +2 -2
- package/dist/{chunk-ICUQICNC.cjs → chunk-NMHWYWDR.cjs} +654 -481
- package/dist/{chunk-G5RT7EXW.mjs → chunk-O6I6VWKK.mjs} +20 -5
- package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
- package/dist/{chunk-6DU6UFUE.mjs → chunk-OHLSEQ57.mjs} +16 -8
- package/dist/{chunk-3PXS2MHU.mjs → chunk-OO7GXVSR.mjs} +1 -1
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-XCACDAZZ.cjs → chunk-S6VYG6XU.cjs} +23 -8
- package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-22LTEMGQ.mjs → chunk-T4OGRVNS.mjs} +13 -3
- package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-F7JZENPF.cjs → chunk-UVW64BCB.cjs} +38 -30
- package/dist/{chunk-OKZUAXHF.mjs → chunk-VILIPRS6.mjs} +1 -1
- package/dist/{chunk-3UH7MRCP.cjs → chunk-VQLJWDVW.cjs} +13 -13
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/{chunk-YULD7ICZ.mjs → chunk-WZ77PUAM.mjs} +1 -1
- package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
- package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
- package/dist/{chunk-ULAWS2PA.cjs → chunk-ZWM5KGAA.cjs} +6 -6
- package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-C3mK9Pol.d.mts} +98 -5
- package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-r1mOtSC1.d.ts} +98 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-EE5RIBTH.mjs → devtools-ERIKFEXX.mjs} +9 -8
- package/dist/{devtools-EAUY43BS.cjs → devtools-JZJJY5CK.cjs} +10 -9
- package/dist/docs.cjs +12 -11
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +11 -10
- package/dist/image/server.cjs +3 -3
- package/dist/image/server.mjs +2 -2
- package/dist/image/sharp.cjs +10 -10
- package/dist/image/sharp.mjs +2 -2
- package/dist/index.cjs +39 -35
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.mjs +38 -34
- package/dist/integrations.cjs +7 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +6 -2
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +27 -25
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +26 -24
- package/dist/internal/cli-runtime.cjs +14 -13
- package/dist/internal/cli-runtime.mjs +13 -12
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +10 -9
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +9 -8
- package/dist/internal/isolated-boundary.cjs +2 -2
- package/dist/internal/isolated-boundary.d.mts +0 -1
- package/dist/internal/isolated-boundary.d.ts +0 -1
- package/dist/internal/isolated-boundary.mjs +1 -1
- package/dist/internal/metadata-image-runtime.cjs +3 -3
- package/dist/internal/metadata-image-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +23 -9
- package/dist/internal/production-runtime.d.mts +67 -27
- package/dist/internal/production-runtime.d.ts +67 -27
- package/dist/internal/production-runtime.mjs +26 -12
- package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
- package/dist/layers-VUWIOFEO.cjs +18 -0
- package/dist/markdown.cjs +1 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.cjs +6 -6
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/middleware.mjs +5 -5
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/plugin.cjs +23 -21
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +22 -20
- package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-CCeVZXst.d.mts} +1 -1
- package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-DPnsggY3.d.ts} +1 -1
- package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
- package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
- package/dist/renderer/react/server.cjs +3 -3
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/{request-B5G8rLBH.d.ts → request-Bkg-hERy.d.ts} +1 -1
- package/dist/{request-fkhiynXe.d.mts → request-CsGARcAw.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
- package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
- package/dist/{router-4iuiYnOW.d.ts → router-B8CR9GbD.d.ts} +1 -1
- package/dist/{router-ifU8Dui1.d.mts → router-Cp6yRE8A.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/runtime-CAEv36S_.d.mts +69 -0
- package/dist/runtime-CQVsT330.d.ts +69 -0
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +4 -4
- package/dist/server-fn.mjs +3 -3
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-query.cjs +5 -5
- package/dist/server-query.mjs +4 -4
- package/dist/server.cjs +42 -40
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +25 -23
- package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-BuciWGCZ.d.ts} +2 -2
- package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-DwbqGkGj.d.mts} +2 -2
- package/dist/testing.cjs +8 -8
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +6 -6
- package/dist/{utils-XJn0c9bj.d.mts → utils-B9V0S_yL.d.mts} +1 -1
- package/dist/{utils-BXLmFsVR.d.ts → utils-CaoWKtYM.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +23 -21
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +22 -20
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.mjs +2 -2
- package/package.json +1 -1
- package/dist/layers-4PNE2HOY.cjs +0 -18
- package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
- package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkJNUWCDTFcjs = require('./chunk-JNUWCDTF.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -41,16 +41,25 @@ var _chunkJSROZYYOcjs = require('./chunk-JSROZYYO.cjs');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
var _chunkADEA7PN3cjs = require('./chunk-ADEA7PN3.cjs');
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
var _chunkPTZ2TVNEcjs = require('./chunk-PTZ2TVNE.cjs');
|
|
45
54
|
|
|
46
55
|
|
|
47
56
|
var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
|
|
48
57
|
|
|
49
58
|
|
|
50
|
-
var
|
|
59
|
+
var _chunkWC5UV2HQcjs = require('./chunk-WC5UV2HQ.cjs');
|
|
51
60
|
|
|
52
61
|
|
|
53
|
-
var
|
|
62
|
+
var _chunkCGBDNNSMcjs = require('./chunk-CGBDNNSM.cjs');
|
|
54
63
|
|
|
55
64
|
|
|
56
65
|
|
|
@@ -93,7 +102,7 @@ var _chunkQ5B3KJBPcjs = require('./chunk-Q5B3KJBP.cjs');
|
|
|
93
102
|
|
|
94
103
|
|
|
95
104
|
|
|
96
|
-
var
|
|
105
|
+
var _chunkWBKEZXWEcjs = require('./chunk-WBKEZXWE.cjs');
|
|
97
106
|
|
|
98
107
|
|
|
99
108
|
|
|
@@ -120,10 +129,14 @@ var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
|
120
129
|
|
|
121
130
|
|
|
122
131
|
|
|
132
|
+
var _chunkMRMI32SNcjs = require('./chunk-MRMI32SN.cjs');
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
123
136
|
|
|
124
137
|
|
|
125
138
|
|
|
126
|
-
var
|
|
139
|
+
var _chunk4WQ6PGSJcjs = require('./chunk-4WQ6PGSJ.cjs');
|
|
127
140
|
|
|
128
141
|
|
|
129
142
|
|
|
@@ -133,7 +146,7 @@ var _chunkYFPGHF5Fcjs = require('./chunk-YFPGHF5F.cjs');
|
|
|
133
146
|
var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
|
|
134
147
|
|
|
135
148
|
|
|
136
|
-
var
|
|
149
|
+
var _chunkT5OJPTVNcjs = require('./chunk-T5OJPTVN.cjs');
|
|
137
150
|
|
|
138
151
|
|
|
139
152
|
|
|
@@ -141,12 +154,12 @@ var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
|
|
|
141
154
|
|
|
142
155
|
|
|
143
156
|
|
|
144
|
-
var
|
|
157
|
+
var _chunkJZVADIODcjs = require('./chunk-JZVADIOD.cjs');
|
|
145
158
|
|
|
146
159
|
|
|
147
160
|
|
|
148
161
|
|
|
149
|
-
var
|
|
162
|
+
var _chunk42NHY7HWcjs = require('./chunk-42NHY7HW.cjs');
|
|
150
163
|
|
|
151
164
|
|
|
152
165
|
|
|
@@ -163,7 +176,7 @@ var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
|
|
|
163
176
|
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
164
177
|
|
|
165
178
|
|
|
166
|
-
var
|
|
179
|
+
var _chunkSDOTRX3Vcjs = require('./chunk-SDOTRX3V.cjs');
|
|
167
180
|
|
|
168
181
|
|
|
169
182
|
var _chunk4ZFL5GFNcjs = require('./chunk-4ZFL5GFN.cjs');
|
|
@@ -183,10 +196,10 @@ var _chunk6QQDAAAZcjs = require('./chunk-6QQDAAAZ.cjs');
|
|
|
183
196
|
|
|
184
197
|
|
|
185
198
|
|
|
186
|
-
var
|
|
199
|
+
var _chunkCBJJH36Acjs = require('./chunk-CBJJH36A.cjs');
|
|
187
200
|
|
|
188
201
|
|
|
189
|
-
var
|
|
202
|
+
var _chunkZWM5KGAAcjs = require('./chunk-ZWM5KGAA.cjs');
|
|
190
203
|
|
|
191
204
|
|
|
192
205
|
|
|
@@ -205,7 +218,7 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
|
|
|
205
218
|
var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
|
|
206
219
|
|
|
207
220
|
|
|
208
|
-
var
|
|
221
|
+
var _chunkFO427P6Icjs = require('./chunk-FO427P6I.cjs');
|
|
209
222
|
|
|
210
223
|
|
|
211
224
|
|
|
@@ -224,7 +237,7 @@ var _chunkXJXBIP67cjs = require('./chunk-XJXBIP67.cjs');
|
|
|
224
237
|
var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
|
|
225
238
|
|
|
226
239
|
|
|
227
|
-
var
|
|
240
|
+
var _chunkS6VYG6XUcjs = require('./chunk-S6VYG6XU.cjs');
|
|
228
241
|
|
|
229
242
|
|
|
230
243
|
var _chunk75RZHGLScjs = require('./chunk-75RZHGLS.cjs');
|
|
@@ -262,7 +275,7 @@ var _chunkYWN746UScjs = require('./chunk-YWN746US.cjs');
|
|
|
262
275
|
|
|
263
276
|
|
|
264
277
|
|
|
265
|
-
var
|
|
278
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
266
279
|
|
|
267
280
|
|
|
268
281
|
var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
|
|
@@ -270,7 +283,8 @@ var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
|
|
|
270
283
|
|
|
271
284
|
|
|
272
285
|
|
|
273
|
-
|
|
286
|
+
|
|
287
|
+
var _chunkSHLXACIOcjs = require('./chunk-SHLXACIO.cjs');
|
|
274
288
|
|
|
275
289
|
|
|
276
290
|
|
|
@@ -296,9 +310,6 @@ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
|
296
310
|
var _chunkQNPEUFHQcjs = require('./chunk-QNPEUFHQ.cjs');
|
|
297
311
|
|
|
298
312
|
|
|
299
|
-
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
300
|
-
|
|
301
|
-
|
|
302
313
|
|
|
303
314
|
|
|
304
315
|
var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
|
|
@@ -308,7 +319,10 @@ var _chunkE3UK5IIBcjs = require('./chunk-E3UK5IIB.cjs');
|
|
|
308
319
|
var _chunkUQZ4AYTHcjs = require('./chunk-UQZ4AYTH.cjs');
|
|
309
320
|
|
|
310
321
|
|
|
311
|
-
var
|
|
322
|
+
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
var _chunkDZ5ZVB2Kcjs = require('./chunk-DZ5ZVB2K.cjs');
|
|
312
326
|
|
|
313
327
|
|
|
314
328
|
|
|
@@ -360,6 +374,7 @@ var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
|
|
|
360
374
|
|
|
361
375
|
|
|
362
376
|
|
|
377
|
+
|
|
363
378
|
var _chunkUXFQ3UDAcjs = require('./chunk-UXFQ3UDA.cjs');
|
|
364
379
|
|
|
365
380
|
|
|
@@ -826,6 +841,7 @@ function getClientModuleHydrationPlan(modulePath, root, mode = "off", options =
|
|
|
826
841
|
}
|
|
827
842
|
const inspection = collectIsolatedClientBoundaries(resolvedPath, root, {
|
|
828
843
|
allowDynamicCardinality: asyncOwner,
|
|
844
|
+
allowElementProps: asyncOwner,
|
|
829
845
|
staticPackageBoundaries: asyncOwner
|
|
830
846
|
});
|
|
831
847
|
if (inspection.boundaries.length === 0) {
|
|
@@ -1323,7 +1339,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
1323
1339
|
fallbackReason = `the client boundary imported from ${specifier} renders inside <${container}>, where the HTML parser relocates its hydration marker`;
|
|
1324
1340
|
return 0;
|
|
1325
1341
|
}
|
|
1326
|
-
if (passesElementValuedProps(content, localBindings)) {
|
|
1342
|
+
if (!options.allowElementProps && passesElementValuedProps(content, localBindings)) {
|
|
1327
1343
|
fallbackReason = `the client boundary imported from ${specifier} receives React elements, which cannot cross the boundary as serialized props`;
|
|
1328
1344
|
return 0;
|
|
1329
1345
|
}
|
|
@@ -1372,10 +1388,12 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
1372
1388
|
};
|
|
1373
1389
|
}
|
|
1374
1390
|
let importsClientBoundary = false;
|
|
1391
|
+
let importsAsyncOwner = false;
|
|
1375
1392
|
let importedIslandStrategy = null;
|
|
1376
1393
|
for (const specifier of getImportSpecifiers(content)) {
|
|
1377
1394
|
const imported = resolveImportedModule(resolvedPath, specifier, root);
|
|
1378
1395
|
const importedMetadata = imported.local ? inspectClientModuleMetadata(imported.path, root, visited, false) : inspectPackageClientBoundary(imported.path, root, visited);
|
|
1396
|
+
if (importedMetadata.suppressedAsyncHydration) importsAsyncOwner = true;
|
|
1379
1397
|
if (importedMetadata.isClientComponent || importedMetadata.shouldHydrate) {
|
|
1380
1398
|
importsClientBoundary = true;
|
|
1381
1399
|
if (importedIslandStrategy === null) {
|
|
@@ -1386,7 +1404,7 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
1386
1404
|
}
|
|
1387
1405
|
}
|
|
1388
1406
|
const shouldHydrate = parsed.hasHydrateExport || importsClientBoundary;
|
|
1389
|
-
if (shouldHydrate && hasAsyncDefaultExport(content)) {
|
|
1407
|
+
if (shouldHydrate && hasAsyncDefaultExport(content) || importsAsyncOwner) {
|
|
1390
1408
|
return {
|
|
1391
1409
|
isClientComponent: false,
|
|
1392
1410
|
shouldHydrate: false,
|
|
@@ -2003,7 +2021,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2003
2021
|
this.redirects.clear();
|
|
2004
2022
|
this.programmaticPages.clear();
|
|
2005
2023
|
this.programmaticLayouts.clear();
|
|
2006
|
-
for (const source of
|
|
2024
|
+
for (const source of _chunkWBKEZXWEcjs.getFarmSourceRoots.call(void 0, this.config)) {
|
|
2007
2025
|
await this.discoverFileRoutes(source);
|
|
2008
2026
|
await this.discoverProgrammaticRoutes(source);
|
|
2009
2027
|
}
|
|
@@ -2025,8 +2043,8 @@ var _RouteManager = class _RouteManager {
|
|
|
2025
2043
|
)
|
|
2026
2044
|
);
|
|
2027
2045
|
this.orderedLayouts = Array.from(this.layouts.values()).sort(
|
|
2028
|
-
(left, right) =>
|
|
2029
|
-
).map((entry) => ({ entry, groupScope:
|
|
2046
|
+
(left, right) => _chunkADEA7PN3cjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkADEA7PN3cjs.getRouteDirectoryDepth.call(void 0, right.pattern)
|
|
2047
|
+
).map((entry) => ({ entry, groupScope: _chunkADEA7PN3cjs.getRouteGroupScope.call(void 0, entry.pattern) }));
|
|
2030
2048
|
for (const slot of this.routeSlots.values()) {
|
|
2031
2049
|
if (!this.routeSlotOwnerSegments.has(slot.ownerPattern)) {
|
|
2032
2050
|
this.routeSlotOwnerSegments.set(
|
|
@@ -2268,7 +2286,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2268
2286
|
}
|
|
2269
2287
|
return absolutePath;
|
|
2270
2288
|
}, "toUrlPath");
|
|
2271
|
-
const integrationProviders =
|
|
2289
|
+
const integrationProviders = _chunkCBJJH36Acjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
|
|
2272
2290
|
(provider) => provider.component || provider.type === "clerk"
|
|
2273
2291
|
);
|
|
2274
2292
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
@@ -2307,7 +2325,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2307
2325
|
);
|
|
2308
2326
|
const routeEntries = Array.from(this.routes.values()).map((entry) => ({
|
|
2309
2327
|
entry,
|
|
2310
|
-
metadata:
|
|
2328
|
+
metadata: _chunk42NHY7HWcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(
|
|
2311
2329
|
entry.modulePath,
|
|
2312
2330
|
normalizedProjectRoot,
|
|
2313
2331
|
isolatedMode,
|
|
@@ -2315,7 +2333,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2315
2333
|
)
|
|
2316
2334
|
}));
|
|
2317
2335
|
const markdownFallback = routeEntries.find(
|
|
2318
|
-
({ entry, metadata }) =>
|
|
2336
|
+
({ entry, metadata }) => _chunk42NHY7HWcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
|
|
2319
2337
|
);
|
|
2320
2338
|
if (markdownFallback) {
|
|
2321
2339
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
@@ -2323,7 +2341,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2323
2341
|
);
|
|
2324
2342
|
}
|
|
2325
2343
|
const markdownStaticPackages = _optionalChain([routeEntries, 'access', _121 => _121.find, 'call', _122 => _122(
|
|
2326
|
-
({ entry, metadata }) =>
|
|
2344
|
+
({ entry, metadata }) => _chunk42NHY7HWcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
|
|
2327
2345
|
), 'optionalAccess', _123 => _123.metadata, 'access', _124 => _124.staticPackageBoundaries]);
|
|
2328
2346
|
if (markdownStaticPackages) {
|
|
2329
2347
|
_chunk5QIKR7RRcjs.logger.info(
|
|
@@ -2331,7 +2349,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2331
2349
|
);
|
|
2332
2350
|
}
|
|
2333
2351
|
for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
|
|
2334
|
-
if (
|
|
2352
|
+
if (_chunk42NHY7HWcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
|
|
2335
2353
|
_chunk5QIKR7RRcjs.logger.info(
|
|
2336
2354
|
`[Farm.js] ${entry.pattern} is async, so it renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
|
|
2337
2355
|
);
|
|
@@ -2339,15 +2357,15 @@ var _RouteManager = class _RouteManager {
|
|
|
2339
2357
|
enforceFarmIsolatedHydrationRouteBudget(
|
|
2340
2358
|
layoutEntries.map(({ entry, metadata }) => ({
|
|
2341
2359
|
pattern: entry.pattern,
|
|
2342
|
-
depth:
|
|
2360
|
+
depth: _chunkADEA7PN3cjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
|
|
2343
2361
|
metadata
|
|
2344
2362
|
})),
|
|
2345
2363
|
routeEntries.map(({ entry, metadata }) => ({
|
|
2346
2364
|
pattern: getRouteEntryDirectory(entry),
|
|
2347
|
-
depth:
|
|
2365
|
+
depth: _chunkADEA7PN3cjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
|
|
2348
2366
|
metadata
|
|
2349
2367
|
})),
|
|
2350
|
-
|
|
2368
|
+
_chunkADEA7PN3cjs.routeBoundaryCoversDirectory
|
|
2351
2369
|
);
|
|
2352
2370
|
for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
|
|
2353
2371
|
if (!metadata.costGuardExceeded) continue;
|
|
@@ -2366,7 +2384,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2366
2384
|
const routes = routeEntries.map(({ entry, metadata }) => {
|
|
2367
2385
|
const programmaticPage = this.programmaticPages.get(entry.modulePath);
|
|
2368
2386
|
const layoutShouldHydrate = layoutEntries.some(
|
|
2369
|
-
({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate &&
|
|
2387
|
+
({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkADEA7PN3cjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
|
|
2370
2388
|
);
|
|
2371
2389
|
return {
|
|
2372
2390
|
pattern: entry.pattern,
|
|
@@ -2485,19 +2503,19 @@ var _RouteManager = class _RouteManager {
|
|
|
2485
2503
|
const { createRouteModuleFromProgrammaticPage } = await import("./routes.cjs");
|
|
2486
2504
|
return createRouteModuleFromProgrammaticPage(programmaticPage, this.rendererRuntime);
|
|
2487
2505
|
}
|
|
2488
|
-
if (
|
|
2506
|
+
if (_chunk42NHY7HWcjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
|
|
2489
2507
|
const mdxConfig = _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, this.config.mdx);
|
|
2490
|
-
const components = await
|
|
2508
|
+
const components = await _chunkJZVADIODcjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
|
|
2491
2509
|
root: this.config.root,
|
|
2492
|
-
loadModule: this.viteServer ? (componentModulePath) =>
|
|
2510
|
+
loadModule: this.viteServer ? (componentModulePath) => _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, componentModulePath) : void 0
|
|
2493
2511
|
});
|
|
2494
|
-
return await
|
|
2512
|
+
return await _chunkJZVADIODcjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
|
|
2495
2513
|
components,
|
|
2496
2514
|
config: mdxConfig
|
|
2497
2515
|
});
|
|
2498
2516
|
}
|
|
2499
2517
|
if (this.viteServer) {
|
|
2500
|
-
const module = await
|
|
2518
|
+
const module = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, modulePath);
|
|
2501
2519
|
return module;
|
|
2502
2520
|
} else {
|
|
2503
2521
|
const module = await import(
|
|
@@ -2522,7 +2540,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2522
2540
|
return createLayoutModuleFromProgrammaticLayout(programmaticLayout);
|
|
2523
2541
|
}
|
|
2524
2542
|
if (this.viteServer) {
|
|
2525
|
-
const module = await
|
|
2543
|
+
const module = await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, modulePath);
|
|
2526
2544
|
return module;
|
|
2527
2545
|
} else {
|
|
2528
2546
|
const module = await import(
|
|
@@ -2541,7 +2559,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2541
2559
|
*/
|
|
2542
2560
|
createRoutePattern(route) {
|
|
2543
2561
|
if (route.segments.length === 0) return "/";
|
|
2544
|
-
return "/" + route.segments.map(
|
|
2562
|
+
return "/" + route.segments.map(_chunkADEA7PN3cjs.formatRouteSegment).join("/");
|
|
2545
2563
|
}
|
|
2546
2564
|
registerPageRoute(entry) {
|
|
2547
2565
|
_chunkNO3WWW3Ncjs.assertUniqueRouteParameters.call(void 0, entry.pattern);
|
|
@@ -2592,8 +2610,8 @@ var _RouteManager = class _RouteManager {
|
|
|
2592
2610
|
}
|
|
2593
2611
|
}
|
|
2594
2612
|
for (const [pattern, group] of canonicalPageGroups) {
|
|
2595
|
-
const componentFiles = group.files.filter((file) => !
|
|
2596
|
-
const markdownFiles = group.files.filter(
|
|
2613
|
+
const componentFiles = group.files.filter((file) => !_chunk42NHY7HWcjs.isFarmMarkdownPageFile.call(void 0, file));
|
|
2614
|
+
const markdownFiles = group.files.filter(_chunk42NHY7HWcjs.isFarmMarkdownPageFile);
|
|
2597
2615
|
if (componentFiles.length > 1) {
|
|
2598
2616
|
throw new Error(
|
|
2599
2617
|
`Duplicate page route "${pattern}". Found ${componentFiles.map((file) => path9.default.join(appDir, file)).join(" and ")}.`
|
|
@@ -2635,7 +2653,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2635
2653
|
for (const file of files) {
|
|
2636
2654
|
const route = _chunk5QIKR7RRcjs.parseRoutePath.call(void 0, file);
|
|
2637
2655
|
const modulePath = path9.default.join(appDir, file);
|
|
2638
|
-
const pattern =
|
|
2656
|
+
const pattern = _chunkADEA7PN3cjs.createRouteDirectoryPattern.call(void 0, route);
|
|
2639
2657
|
const existing = target.get(pattern);
|
|
2640
2658
|
if (_optionalChain([existing, 'optionalAccess', _129 => _129.sourceRoot]) === source.root) {
|
|
2641
2659
|
throw new Error(
|
|
@@ -2657,7 +2675,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2657
2675
|
const modulePath = path9.default.join(appDir, file);
|
|
2658
2676
|
const pattern = this.createRoutePattern(slot.route);
|
|
2659
2677
|
const ownerPattern = this.createRoutePattern(slot.ownerRoute);
|
|
2660
|
-
const ownerDirectory =
|
|
2678
|
+
const ownerDirectory = _chunkADEA7PN3cjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
|
|
2661
2679
|
const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
|
|
2662
2680
|
const existing = this.routeSlots.get(key);
|
|
2663
2681
|
if (_optionalChain([existing, 'optionalAccess', _130 => _130.sourceRoot]) === source.root) {
|
|
@@ -2762,7 +2780,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2762
2780
|
}
|
|
2763
2781
|
if (definition.kind === "layout") {
|
|
2764
2782
|
const route = _chunk6V4TDWECcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
|
|
2765
|
-
const pattern =
|
|
2783
|
+
const pattern = _chunkADEA7PN3cjs.createRouteDirectoryPattern.call(void 0, route);
|
|
2766
2784
|
const existing = this.layouts.get(pattern);
|
|
2767
2785
|
if (_optionalChain([existing, 'optionalAccess', _134 => _134.sourceRoot]) === source.root) {
|
|
2768
2786
|
throw new Error(
|
|
@@ -2794,11 +2812,11 @@ var _RouteManager = class _RouteManager {
|
|
|
2794
2812
|
async loadProgrammaticRoutesModule(filePath) {
|
|
2795
2813
|
if (this.viteServer) {
|
|
2796
2814
|
const viteRoot = _optionalChain([this, 'access', _135 => _135.viteServer, 'access', _136 => _136.config, 'optionalAccess', _137 => _137.root]) || this.config.root || process.cwd();
|
|
2797
|
-
return await
|
|
2815
|
+
return await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, filePath, viteRoot));
|
|
2798
2816
|
}
|
|
2799
2817
|
return await import(
|
|
2800
2818
|
/* @vite-ignore */
|
|
2801
|
-
|
|
2819
|
+
_chunkSHLXACIOcjs.toFileModuleUrl.call(void 0, filePath)
|
|
2802
2820
|
);
|
|
2803
2821
|
}
|
|
2804
2822
|
/**
|
|
@@ -2809,7 +2827,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2809
2827
|
const matchingLayouts = [];
|
|
2810
2828
|
for (const { entry, groupScope } of this.orderedLayouts) {
|
|
2811
2829
|
if (!_chunk5QIKR7RRcjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
|
|
2812
|
-
if (groupScope !== null && !
|
|
2830
|
+
if (groupScope !== null && !_chunkADEA7PN3cjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
|
|
2813
2831
|
continue;
|
|
2814
2832
|
}
|
|
2815
2833
|
matchingLayouts.push(entry);
|
|
@@ -2890,14 +2908,14 @@ var _RouteManager = class _RouteManager {
|
|
|
2890
2908
|
let page = route;
|
|
2891
2909
|
for (const boundaryEntry of boundaries.values()) {
|
|
2892
2910
|
if (!_chunk5QIKR7RRcjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
|
|
2893
|
-
const groupScope =
|
|
2911
|
+
const groupScope = _chunkADEA7PN3cjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
|
|
2894
2912
|
if (groupScope !== null) {
|
|
2895
2913
|
if (page === void 0) page = this.matchPageRoute(_chunk5QIKR7RRcjs.splitRoutePath.call(void 0, normalizedPath));
|
|
2896
|
-
if (!
|
|
2914
|
+
if (!_chunkADEA7PN3cjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
|
|
2897
2915
|
}
|
|
2898
2916
|
const depth = boundaryEntry.route.segments.length;
|
|
2899
2917
|
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _138 => _138.route, 'access', _139 => _139.segments, 'access', _140 => _140.length]), () => ( -1));
|
|
2900
|
-
if (!bestMatch || depth > bestDepth || depth === bestDepth &&
|
|
2918
|
+
if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkADEA7PN3cjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkADEA7PN3cjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
|
|
2901
2919
|
bestMatch = boundaryEntry;
|
|
2902
2920
|
}
|
|
2903
2921
|
}
|
|
@@ -2934,7 +2952,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2934
2952
|
pattern: entry.pattern
|
|
2935
2953
|
}));
|
|
2936
2954
|
const i18n = this.getI18nConfig();
|
|
2937
|
-
const result = await
|
|
2955
|
+
const result = await _chunkJNUWCDTFcjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
|
|
2938
2956
|
suggestStaticRendering: shouldSuggestStaticRenderingForI18n(i18n)
|
|
2939
2957
|
});
|
|
2940
2958
|
if (!i18n) {
|
|
@@ -2979,7 +2997,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2979
2997
|
async isRouteSSG(modulePath) {
|
|
2980
2998
|
try {
|
|
2981
2999
|
const mod = await this.loadRouteModule(modulePath);
|
|
2982
|
-
const rendering = await
|
|
3000
|
+
const rendering = await _chunkJNUWCDTFcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
2983
3001
|
return rendering.ssg;
|
|
2984
3002
|
} catch (e10) {
|
|
2985
3003
|
return false;
|
|
@@ -2991,7 +3009,7 @@ var _RouteManager = class _RouteManager {
|
|
|
2991
3009
|
async hasRouteISR(modulePath) {
|
|
2992
3010
|
try {
|
|
2993
3011
|
const mod = await this.loadRouteModule(modulePath);
|
|
2994
|
-
const rendering = await
|
|
3012
|
+
const rendering = await _chunkJNUWCDTFcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
2995
3013
|
return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
|
|
2996
3014
|
} catch (e11) {
|
|
2997
3015
|
return false;
|
|
@@ -3003,7 +3021,7 @@ var _RouteManager = class _RouteManager {
|
|
|
3003
3021
|
async getRouteRevalidateInterval(modulePath) {
|
|
3004
3022
|
try {
|
|
3005
3023
|
const mod = await this.loadRouteModule(modulePath);
|
|
3006
|
-
const rendering = await
|
|
3024
|
+
const rendering = await _chunkJNUWCDTFcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
3007
3025
|
return rendering.revalidate;
|
|
3008
3026
|
} catch (e12) {
|
|
3009
3027
|
return void 0;
|
|
@@ -3013,7 +3031,7 @@ var _RouteManager = class _RouteManager {
|
|
|
3013
3031
|
_chunkS3JO3N4Hcjs.__name.call(void 0, _RouteManager, "RouteManager");
|
|
3014
3032
|
var RouteManager = _RouteManager;
|
|
3015
3033
|
function getPageDirectoryField(route, pattern) {
|
|
3016
|
-
const directory =
|
|
3034
|
+
const directory = _chunkADEA7PN3cjs.createRouteDirectoryPattern.call(void 0, route);
|
|
3017
3035
|
return directory === pattern ? {} : { directory };
|
|
3018
3036
|
}
|
|
3019
3037
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getPageDirectoryField, "getPageDirectoryField");
|
|
@@ -4393,7 +4411,7 @@ function generateFarmIntegrationProviderClientCode(providers, root, rendererComp
|
|
|
4393
4411
|
let hasClerkProvider = false;
|
|
4394
4412
|
renderedProviders.forEach((provider, index) => {
|
|
4395
4413
|
let componentExpression = "null";
|
|
4396
|
-
if (
|
|
4414
|
+
if (_chunkCBJJH36Acjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
|
|
4397
4415
|
const namespace = `FarmIntegrationProviderModule${index}`;
|
|
4398
4416
|
imports.push(
|
|
4399
4417
|
`import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
|
|
@@ -4452,7 +4470,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
|
|
|
4452
4470
|
const entries = [];
|
|
4453
4471
|
let needsMarkHelper = false;
|
|
4454
4472
|
providers.forEach((provider, index) => {
|
|
4455
|
-
if (!
|
|
4473
|
+
if (!_chunkCBJJH36Acjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
|
|
4456
4474
|
const namespace = `FarmServerIntegrationProviderModule${index}`;
|
|
4457
4475
|
imports.push(
|
|
4458
4476
|
`import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
|
|
@@ -4674,7 +4692,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, appendResponseVary, "appendResponseVary");
|
|
|
4674
4692
|
function renderI18nAlternateLinks(requestPath, snapshot, options) {
|
|
4675
4693
|
if (snapshot.routing === "none") return "";
|
|
4676
4694
|
const url = new URL(requestPath, "http://farm.local");
|
|
4677
|
-
return
|
|
4695
|
+
return _chunkADEA7PN3cjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
|
|
4678
4696
|
}
|
|
4679
4697
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderI18nAlternateLinks, "renderI18nAlternateLinks");
|
|
4680
4698
|
var PPR_REFRESH_MAX_ATTEMPTS = 3;
|
|
@@ -4805,6 +4823,16 @@ function createRouteStateProps(input) {
|
|
|
4805
4823
|
};
|
|
4806
4824
|
}
|
|
4807
4825
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createRouteStateProps, "createRouteStateProps");
|
|
4826
|
+
function readAppPackageIdentity(root) {
|
|
4827
|
+
try {
|
|
4828
|
+
return JSON.parse(
|
|
4829
|
+
fs5.readFileSync(path9.join(root || process.cwd(), "package.json"), "utf8")
|
|
4830
|
+
);
|
|
4831
|
+
} catch (e18) {
|
|
4832
|
+
return {};
|
|
4833
|
+
}
|
|
4834
|
+
}
|
|
4835
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, readAppPackageIdentity, "readAppPackageIdentity");
|
|
4808
4836
|
var _ServerRenderer = class _ServerRenderer {
|
|
4809
4837
|
constructor(config, routeManager, i18nRuntime, viteServer) {
|
|
4810
4838
|
this.ssgManifest = [];
|
|
@@ -4813,15 +4841,15 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4813
4841
|
this.routeManager = routeManager;
|
|
4814
4842
|
this.i18nRuntime = i18nRuntime;
|
|
4815
4843
|
this.viteServer = viteServer;
|
|
4816
|
-
this.security =
|
|
4844
|
+
this.security = _chunkMRMI32SNcjs.resolveFarmSecurityConfig.call(void 0, config.security);
|
|
4817
4845
|
this.loadSSGManifest();
|
|
4818
4846
|
}
|
|
4819
4847
|
async initialize() {
|
|
4820
4848
|
if (this.rendererRuntime) return;
|
|
4821
4849
|
if (_optionalChain([this, 'access', _152 => _152.config, 'access', _153 => _153.notFound, 'optionalAccess', _154 => _154.component, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()])) {
|
|
4822
|
-
resolveFarmNotFoundComponentPath(this.config,
|
|
4850
|
+
resolveFarmNotFoundComponentPath(this.config, _chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, this.config));
|
|
4823
4851
|
}
|
|
4824
|
-
const loaded = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : this.viteServer ? await
|
|
4852
|
+
const loaded = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : this.viteServer ? await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
|
|
4825
4853
|
_chunkPSV6XKPOcjs.resolveFarmRendererModule.call(void 0,
|
|
4826
4854
|
this.config.root || process.cwd(),
|
|
4827
4855
|
this.config.renderer.server
|
|
@@ -4863,7 +4891,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4863
4891
|
`Renderer \`${this.config.renderer.name}\` does not support \`appSetup\`: its server module must export configureApp().`
|
|
4864
4892
|
);
|
|
4865
4893
|
}
|
|
4866
|
-
const setupModule = this.viteServer ? await
|
|
4894
|
+
const setupModule = this.viteServer ? await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, appSetupPath) : await import(_url.pathToFileURL.call(void 0, appSetupPath).href);
|
|
4867
4895
|
if (setupModule === this.appliedAppSetupModule) return;
|
|
4868
4896
|
this.appliedAppSetupModule = setupModule;
|
|
4869
4897
|
configureApp(setupModule.default);
|
|
@@ -5080,7 +5108,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5080
5108
|
* Check if a path should be served from SSG cache
|
|
5081
5109
|
*/
|
|
5082
5110
|
async shouldServeSSG(pathname) {
|
|
5083
|
-
const ssgPage =
|
|
5111
|
+
const ssgPage = _chunkJNUWCDTFcjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
|
|
5084
5112
|
if (!ssgPage) return null;
|
|
5085
5113
|
const cached = await this.getCachedSSGPage(pathname);
|
|
5086
5114
|
if (cached && await this.dataCache.isStaleAsync(cached)) {
|
|
@@ -5314,10 +5342,10 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5314
5342
|
if (this.viteServer) await this.applyRendererAppSetup();
|
|
5315
5343
|
_chunkI57LW5VZcjs.setFarmBasePath.call(void 0, this.config.basePath);
|
|
5316
5344
|
_chunkOYEUREB6cjs.setFarmTrailingSlashPreference.call(void 0, this.config.trailingSlash);
|
|
5317
|
-
const cspNonce =
|
|
5345
|
+
const cspNonce = _chunkMRMI32SNcjs.createFarmCspNonce.call(void 0, this.security);
|
|
5318
5346
|
if (cspNonce) {
|
|
5319
5347
|
req.__FARM_CSP_NONCE__ = cspNonce;
|
|
5320
|
-
const header =
|
|
5348
|
+
const header = _chunkMRMI32SNcjs.getFarmSecurityHeader.call(void 0, this.security, cspNonce);
|
|
5321
5349
|
res.setHeader(header.key, header.value);
|
|
5322
5350
|
}
|
|
5323
5351
|
const request2 = _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
@@ -5388,6 +5416,11 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5388
5416
|
completeRender(res.statusCode || 200, pathname);
|
|
5389
5417
|
return;
|
|
5390
5418
|
}
|
|
5419
|
+
if (pathname === "/sitemap.xml" && this.getAgentSitemap().enabled) {
|
|
5420
|
+
await this.renderGeneratedSitemap(req, res);
|
|
5421
|
+
completeRender(res.statusCode || 200, pathname);
|
|
5422
|
+
return;
|
|
5423
|
+
}
|
|
5391
5424
|
const metadataImageMatch = this.routeManager.matchMetadataImage(pathname);
|
|
5392
5425
|
if (metadataImageMatch) {
|
|
5393
5426
|
await this.renderMetadataImage(req, res, {
|
|
@@ -5425,6 +5458,11 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5425
5458
|
layouts = match.layouts;
|
|
5426
5459
|
routeSlots = _nullishCoalesce(match.slots, () => ( []));
|
|
5427
5460
|
if (!route) {
|
|
5461
|
+
if (_chunkPTZ2TVNEcjs.isFarmDefaultMCPPathname.call(void 0, pathname) && this.getDefaultMCPServer()) {
|
|
5462
|
+
await this.renderDefaultMCP(req, res);
|
|
5463
|
+
completeRender(res.statusCode || 200, pathname);
|
|
5464
|
+
return;
|
|
5465
|
+
}
|
|
5428
5466
|
_chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, { type: "route.notFound", pathname });
|
|
5429
5467
|
await this.render404(req, res);
|
|
5430
5468
|
completeRender(404);
|
|
@@ -5440,7 +5478,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5440
5478
|
errorBoundaryEntry = this.routeManager.getMatchingError(pathname, route);
|
|
5441
5479
|
middlewareMap = toMiddlewareMap(req.__FARM_MIDDLEWARE_DATA__);
|
|
5442
5480
|
middlewareContext = toMiddlewareMap(req.__FARM_MIDDLEWARE_CONTEXT__);
|
|
5443
|
-
pluginExposedContext =
|
|
5481
|
+
pluginExposedContext = _chunkKIIMAWOJcjs.getRequestContextSnapshot.call(void 0, req, {
|
|
5444
5482
|
exposedOnly: true
|
|
5445
5483
|
});
|
|
5446
5484
|
const currentRequest = _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
@@ -5498,7 +5536,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5498
5536
|
throw error;
|
|
5499
5537
|
}
|
|
5500
5538
|
}
|
|
5501
|
-
const renderingConfig = await
|
|
5539
|
+
const renderingConfig = await _chunkJNUWCDTFcjs.resolveRouteRenderingConfigFromFile.call(void 0,
|
|
5502
5540
|
routeModule,
|
|
5503
5541
|
route.modulePath,
|
|
5504
5542
|
{ experimentalPPR: _optionalChain([this, 'access', _180 => _180.config, 'access', _181 => _181.experimental, 'optionalAccess', _182 => _182.ppr]) === true }
|
|
@@ -5921,7 +5959,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5921
5959
|
}
|
|
5922
5960
|
}
|
|
5923
5961
|
_chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, { type: "render.error", route: pathname, error });
|
|
5924
|
-
const errorStatus =
|
|
5962
|
+
const errorStatus = _chunkADEA7PN3cjs.resolveDefaultErrorStatus.call(void 0, error);
|
|
5925
5963
|
if (pprRefreshRoute) {
|
|
5926
5964
|
_chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, {
|
|
5927
5965
|
type: "ppr.refresh.error",
|
|
@@ -5957,7 +5995,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5957
5995
|
}
|
|
5958
5996
|
}
|
|
5959
5997
|
async wrapWithIntegrationProviders(element) {
|
|
5960
|
-
const providers =
|
|
5998
|
+
const providers = _chunkCBJJH36Acjs.getIntegrationProviders.call(void 0, this.config.integrations);
|
|
5961
5999
|
let wrapped = element;
|
|
5962
6000
|
for (let i = providers.length - 1; i >= 0; i--) {
|
|
5963
6001
|
const provider = providers[i];
|
|
@@ -5975,13 +6013,13 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5975
6013
|
}
|
|
5976
6014
|
let ProviderComponent;
|
|
5977
6015
|
let providerSourceModule;
|
|
5978
|
-
if (
|
|
6016
|
+
if (_chunkCBJJH36Acjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
|
|
5979
6017
|
providerSourceModule = provider.component.module;
|
|
5980
6018
|
const providerModuleId = provider.component.module.startsWith(".") ? _chunk5QIKR7RRcjs.toViteModuleId.call(void 0,
|
|
5981
6019
|
path9.resolve(this.config.root, provider.component.module),
|
|
5982
6020
|
this.config.root
|
|
5983
6021
|
) : provider.component.module;
|
|
5984
|
-
const providerModule = this.viteServer ? await
|
|
6022
|
+
const providerModule = this.viteServer ? await _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, this.viteServer, providerModuleId) : await importRuntimeModule(
|
|
5985
6023
|
provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0, path9.resolve(this.config.root, provider.component.module)).href : provider.component.module
|
|
5986
6024
|
);
|
|
5987
6025
|
ProviderComponent = providerModule[provider.component.export || "default"];
|
|
@@ -6145,11 +6183,11 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6145
6183
|
path: match.routePath,
|
|
6146
6184
|
...llmsContext
|
|
6147
6185
|
}) : routeModule.default;
|
|
6148
|
-
const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await
|
|
6186
|
+
const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunk4WQ6PGSJcjs.renderFarmLlmsFullTxt.call(void 0, value, {
|
|
6149
6187
|
origin: url.origin,
|
|
6150
6188
|
readMarkdown: llmsContext.markdown
|
|
6151
6189
|
}) : value;
|
|
6152
|
-
const response =
|
|
6190
|
+
const response = _chunkADEA7PN3cjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
|
|
6153
6191
|
method,
|
|
6154
6192
|
request: request2
|
|
6155
6193
|
});
|
|
@@ -6167,7 +6205,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6167
6205
|
}
|
|
6168
6206
|
/** `/llms.txt` and `/llms-full.txt` from `agent.llmsTxt` when no file route owns them. */
|
|
6169
6207
|
getGeneratedLlmsKind(pathname) {
|
|
6170
|
-
const config =
|
|
6208
|
+
const config = _chunk4WQ6PGSJcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _205 => _205.config, 'access', _206 => _206.agent, 'optionalAccess', _207 => _207.llmsTxt]));
|
|
6171
6209
|
if (!config.enabled) return null;
|
|
6172
6210
|
if (pathname === "/llms.txt") return "llms";
|
|
6173
6211
|
return pathname === "/llms-full.txt" && config.full ? "llms-full" : null;
|
|
@@ -6177,15 +6215,15 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6177
6215
|
const request2 = _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6178
6216
|
trustProxy: _optionalChain([this, 'access', _208 => _208.config, 'access', _209 => _209.server, 'optionalAccess', _210 => _210.trustProxy])
|
|
6179
6217
|
});
|
|
6180
|
-
const config =
|
|
6218
|
+
const config = _chunk4WQ6PGSJcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _211 => _211.config, 'access', _212 => _212.agent, 'optionalAccess', _213 => _213.llmsTxt]));
|
|
6181
6219
|
const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
|
|
6182
|
-
const body = kind === "llms-full" ? await
|
|
6220
|
+
const body = kind === "llms-full" ? await _chunk4WQ6PGSJcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
|
|
6183
6221
|
origin: new URL(request2.url).origin,
|
|
6184
6222
|
readMarkdown: context.markdown
|
|
6185
6223
|
}) : context.defaults;
|
|
6186
6224
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
|
|
6187
6225
|
res,
|
|
6188
|
-
|
|
6226
|
+
_chunkADEA7PN3cjs.createFarmMetadataRouteResponse.call(void 0,
|
|
6189
6227
|
kind,
|
|
6190
6228
|
body,
|
|
6191
6229
|
{ revalidate: config.revalidate },
|
|
@@ -6204,15 +6242,15 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6204
6242
|
}
|
|
6205
6243
|
}
|
|
6206
6244
|
getAgentCrawlers() {
|
|
6207
|
-
return
|
|
6245
|
+
return _chunkMRMI32SNcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _214 => _214.config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.crawlers]));
|
|
6208
6246
|
}
|
|
6209
6247
|
/** `/robots.txt` from `agent.crawlers` when no robots.ts owns it. */
|
|
6210
6248
|
async renderGeneratedRobotsTxt(req, res) {
|
|
6211
6249
|
try {
|
|
6212
|
-
const sitemapPath = _optionalChain([this, 'access', _217 => _217.routeManager, 'access', _218 => _218.matchMetadataRoute, 'call', _219 => _219("/sitemap.xml"), 'optionalAccess', _220 => _220.metadata, 'access', _221 => _221.kind]) === "sitemap" ? "/sitemap.xml" : void 0;
|
|
6250
|
+
const sitemapPath = _optionalChain([this, 'access', _217 => _217.routeManager, 'access', _218 => _218.matchMetadataRoute, 'call', _219 => _219("/sitemap.xml"), 'optionalAccess', _220 => _220.metadata, 'access', _221 => _221.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
|
|
6213
6251
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6214
6252
|
const rootMetadata = sitemapPath && rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
6215
|
-
const robots =
|
|
6253
|
+
const robots = _chunkMRMI32SNcjs.createFarmAgentRobots.call(void 0, {
|
|
6216
6254
|
crawlers: this.getAgentCrawlers(),
|
|
6217
6255
|
sitemapPath,
|
|
6218
6256
|
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _222 => _222.metadataBase]),
|
|
@@ -6220,7 +6258,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6220
6258
|
});
|
|
6221
6259
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
|
|
6222
6260
|
res,
|
|
6223
|
-
|
|
6261
|
+
_chunkADEA7PN3cjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
|
|
6224
6262
|
);
|
|
6225
6263
|
} catch (error) {
|
|
6226
6264
|
_chunk5QIKR7RRcjs.logger.error(`Generated robots.txt failed: ${error}`);
|
|
@@ -6233,9 +6271,115 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6233
6271
|
);
|
|
6234
6272
|
}
|
|
6235
6273
|
}
|
|
6274
|
+
getAgentSitemap() {
|
|
6275
|
+
return _chunkMRMI32SNcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _223 => _223.config, 'access', _224 => _224.agent, 'optionalAccess', _225 => _225.sitemap]));
|
|
6276
|
+
}
|
|
6277
|
+
/** `/sitemap.xml` from `agent.sitemap` when no sitemap.ts owns it. */
|
|
6278
|
+
async renderGeneratedSitemap(req, res) {
|
|
6279
|
+
try {
|
|
6280
|
+
const request2 = _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
6281
|
+
trustProxy: _optionalChain([this, 'access', _226 => _226.config, 'access', _227 => _227.server, 'optionalAccess', _228 => _228.trustProxy])
|
|
6282
|
+
});
|
|
6283
|
+
const sources = await Promise.all(
|
|
6284
|
+
[...this.routeManager.getRoutes()].filter(([pattern]) => !pattern.includes("[")).map(async ([pattern, route]) => {
|
|
6285
|
+
const [module, stat] = await Promise.all([
|
|
6286
|
+
this.routeManager.loadRouteModule(route.modulePath).catch((error) => {
|
|
6287
|
+
_chunk5QIKR7RRcjs.logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
|
|
6288
|
+
return void 0;
|
|
6289
|
+
}),
|
|
6290
|
+
fs5.promises.stat(route.modulePath).catch(() => void 0)
|
|
6291
|
+
]);
|
|
6292
|
+
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _229 => _229.mtime, 'access', _230 => _230.toISOString, 'call', _231 => _231()]) };
|
|
6293
|
+
})
|
|
6294
|
+
);
|
|
6295
|
+
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6296
|
+
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
6297
|
+
const sitemap = _chunkMRMI32SNcjs.createFarmDefaultSitemap.call(void 0, sources, {
|
|
6298
|
+
origin: new URL(request2.url).origin,
|
|
6299
|
+
config: this.getAgentSitemap(),
|
|
6300
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _232 => _232.metadataBase]),
|
|
6301
|
+
basePath: this.config.basePath
|
|
6302
|
+
});
|
|
6303
|
+
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
|
|
6304
|
+
res,
|
|
6305
|
+
_chunkADEA7PN3cjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
|
|
6306
|
+
);
|
|
6307
|
+
} catch (error) {
|
|
6308
|
+
_chunk5QIKR7RRcjs.logger.error(`Generated sitemap.xml failed: ${error}`);
|
|
6309
|
+
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
|
|
6310
|
+
res,
|
|
6311
|
+
new Response("Internal Server Error", {
|
|
6312
|
+
status: 500,
|
|
6313
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
6314
|
+
})
|
|
6315
|
+
);
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6318
|
+
/** Lets the default MCP server see the app's API routes, which the dev server owns. */
|
|
6319
|
+
setAPIRouteLookup(exists) {
|
|
6320
|
+
this.apiRouteExists = exists;
|
|
6321
|
+
}
|
|
6322
|
+
/**
|
|
6323
|
+
* The default read-only MCP server (`agent.mcp`), or undefined when the app has an MCP
|
|
6324
|
+
* server of its own: a route that answers /mcp, an API route at /api/mcp, `@farm.js/mcp`,
|
|
6325
|
+
* or a registered server such as the docs engine's. Production applies the same rules.
|
|
6326
|
+
*/
|
|
6327
|
+
getDefaultMCPServer() {
|
|
6328
|
+
if (_optionalChain([this, 'access', _233 => _233.config, 'access', _234 => _234.agent, 'optionalAccess', _235 => _235.mcp]) !== true || _chunkPTZ2TVNEcjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
|
|
6329
|
+
if (_optionalChain([this, 'access', _236 => _236.apiRouteExists, 'optionalCall', _237 => _237("/api/mcp")])) return void 0;
|
|
6330
|
+
if (this.routeManager.matchRoute(_chunkPTZ2TVNEcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
|
|
6331
|
+
_nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkPTZ2TVNEcjs.createFarmDefaultMCPServer.call(void 0,
|
|
6332
|
+
readAppPackageIdentity(this.config.root),
|
|
6333
|
+
_chunkDZ5ZVB2Kcjs.FARM_VERSION
|
|
6334
|
+
))));
|
|
6335
|
+
return _chunkPTZ2TVNEcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
|
|
6336
|
+
}
|
|
6337
|
+
async renderDefaultMCP(req, res) {
|
|
6338
|
+
const server = this.getDefaultMCPServer();
|
|
6339
|
+
const request2 = _nullishCoalesce(_chunkUXFQ3UDAcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkUXFQ3UDAcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _238 => _238.config, 'access', _239 => _239.server, 'optionalAccess', _240 => _240.trustProxy]) })));
|
|
6340
|
+
try {
|
|
6341
|
+
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-SJAHFSPI.cjs");
|
|
6342
|
+
const origin = new URL(request2.url).origin;
|
|
6343
|
+
const response = await handleFarmDefaultMCPRequest(request2, {
|
|
6344
|
+
server,
|
|
6345
|
+
basePath: this.config.basePath,
|
|
6346
|
+
listPages: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
6347
|
+
const sources = await Promise.all(
|
|
6348
|
+
[...this.routeManager.getRoutes()].filter(([pattern]) => !pattern.includes("[")).map(async ([pattern, route]) => ({
|
|
6349
|
+
pattern,
|
|
6350
|
+
// The page itself surfaces a load error. Without its module a guard cannot
|
|
6351
|
+
// be ruled out, so the page is left out.
|
|
6352
|
+
module: await this.routeManager.loadRouteModule(route.modulePath).catch(() => ({ __farmRouteGuard: true }))
|
|
6353
|
+
}))
|
|
6354
|
+
);
|
|
6355
|
+
return _chunkPTZ2TVNEcjs.collectFarmDefaultMCPPages.call(void 0, sources, {
|
|
6356
|
+
origin,
|
|
6357
|
+
basePath: this.config.basePath,
|
|
6358
|
+
markdown: _chunkEUV4YR3Vcjs.resolveMarkdownConfig.call(void 0, this.config.md)
|
|
6359
|
+
});
|
|
6360
|
+
}, "listPages"),
|
|
6361
|
+
// Pages are read through this server's own socket, with no cookies, as llms-full.txt does.
|
|
6362
|
+
readMarkdown: this.createDevMarkdownReader(req)
|
|
6363
|
+
});
|
|
6364
|
+
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, response);
|
|
6365
|
+
} catch (error) {
|
|
6366
|
+
_chunk5QIKR7RRcjs.logger.error(`Default MCP server failed: ${error}`);
|
|
6367
|
+
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
|
|
6368
|
+
res,
|
|
6369
|
+
new Response(
|
|
6370
|
+
JSON.stringify({
|
|
6371
|
+
jsonrpc: "2.0",
|
|
6372
|
+
id: null,
|
|
6373
|
+
error: { code: -32603, message: "Internal error." }
|
|
6374
|
+
}),
|
|
6375
|
+
{ status: 500, headers: { "Content-Type": "application/json" } }
|
|
6376
|
+
)
|
|
6377
|
+
);
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6236
6380
|
/** Same inputs the production server gives llms.txt: static pages and root metadata. */
|
|
6237
6381
|
async createLlmsTxtContext(request2, options = {}) {
|
|
6238
|
-
const config =
|
|
6382
|
+
const config = _chunk4WQ6PGSJcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _241 => _241.config, 'access', _242 => _242.agent, 'optionalAccess', _243 => _243.llmsTxt]));
|
|
6239
6383
|
const origin = new URL(request2.url).origin;
|
|
6240
6384
|
const staticRoutes = [...this.routeManager.getRoutes()].filter(
|
|
6241
6385
|
([pattern]) => !pattern.includes("[")
|
|
@@ -6253,7 +6397,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6253
6397
|
);
|
|
6254
6398
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
6255
6399
|
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
6256
|
-
const pages =
|
|
6400
|
+
const pages = _chunk4WQ6PGSJcjs.collectFarmLlmsTxtPages.call(void 0, sources, {
|
|
6257
6401
|
origin,
|
|
6258
6402
|
basePath: this.config.basePath,
|
|
6259
6403
|
markdown: _chunkEUV4YR3Vcjs.resolveMarkdownConfig.call(void 0, this.config.md),
|
|
@@ -6262,18 +6406,19 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6262
6406
|
});
|
|
6263
6407
|
return {
|
|
6264
6408
|
pages,
|
|
6265
|
-
defaults:
|
|
6409
|
+
defaults: _chunk4WQ6PGSJcjs.createFarmDefaultLlmsTxt.call(void 0, {
|
|
6266
6410
|
origin,
|
|
6267
6411
|
pages,
|
|
6268
6412
|
config,
|
|
6269
6413
|
rootMetadata,
|
|
6270
|
-
mcp: _optionalChain([this, 'access',
|
|
6414
|
+
mcp: _optionalChain([this, 'access', _244 => _244.config, 'access', _245 => _245.agent, 'optionalAccess', _246 => _246.aiCatalog]) === false ? [] : _chunkADEA7PN3cjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
|
|
6271
6415
|
basePath: this.config.basePath,
|
|
6272
6416
|
apiServerBasePath: _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0,
|
|
6273
6417
|
_chunkS3A45T7Fcjs.normalizeFarmAPIConfig.call(void 0,
|
|
6274
6418
|
this.config.api
|
|
6275
6419
|
)
|
|
6276
|
-
)
|
|
6420
|
+
),
|
|
6421
|
+
defaultMCP: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => this.getDefaultMCPServer(), "defaultMCP")
|
|
6277
6422
|
})
|
|
6278
6423
|
}),
|
|
6279
6424
|
...options.full ? { markdown: this.createDevMarkdownReader(options.req) } : {}
|
|
@@ -6289,17 +6434,17 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6289
6434
|
* body is discarded.
|
|
6290
6435
|
*/
|
|
6291
6436
|
createDevMarkdownReader(req) {
|
|
6292
|
-
const socket = _optionalChain([req, 'optionalAccess',
|
|
6293
|
-
if (_optionalChain([req, 'optionalAccess',
|
|
6437
|
+
const socket = _optionalChain([req, 'optionalAccess', _247 => _247.socket]);
|
|
6438
|
+
if (_optionalChain([req, 'optionalAccess', _248 => _248.method, 'optionalAccess', _249 => _249.toUpperCase, 'call', _250 => _250()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _251 => _251.localAddress]) || !socket.localPort) {
|
|
6294
6439
|
return async () => null;
|
|
6295
6440
|
}
|
|
6296
6441
|
if (socket.encrypted) {
|
|
6297
6442
|
const address = { host: socket.localAddress, port: socket.localPort };
|
|
6298
|
-
return
|
|
6443
|
+
return _chunk4WQ6PGSJcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
|
|
6299
6444
|
}
|
|
6300
6445
|
const host = socket.localAddress.includes(":") ? `[${socket.localAddress}]` : socket.localAddress;
|
|
6301
6446
|
const localOrigin = `http://${host}:${socket.localPort}`;
|
|
6302
|
-
const read =
|
|
6447
|
+
const read = _chunk4WQ6PGSJcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
|
|
6303
6448
|
return (url) => {
|
|
6304
6449
|
const target = new URL(url);
|
|
6305
6450
|
return read(`${localOrigin}${target.pathname}${target.search}`);
|
|
@@ -6339,7 +6484,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6339
6484
|
}
|
|
6340
6485
|
async writeMetadataImageResponse(req, res, value, imageModule) {
|
|
6341
6486
|
const ifNoneMatch = req.headers["if-none-match"];
|
|
6342
|
-
const response = await
|
|
6487
|
+
const response = await _chunkWC5UV2HQcjs.createFarmMetadataImageResponse.call(void 0, value, imageModule, {
|
|
6343
6488
|
method: req.method,
|
|
6344
6489
|
ifNoneMatch: Array.isArray(ifNoneMatch) ? ifNoneMatch[0] : ifNoneMatch
|
|
6345
6490
|
});
|
|
@@ -6355,7 +6500,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6355
6500
|
}
|
|
6356
6501
|
const etag = `"${image.staticInfo.hash}"`;
|
|
6357
6502
|
const requestUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
6358
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6503
|
+
trustProxy: _optionalChain([this, 'access', _252 => _252.config, 'access', _253 => _253.server, 'optionalAccess', _254 => _254.trustProxy])
|
|
6359
6504
|
});
|
|
6360
6505
|
const isVersioned = requestUrl.searchParams.get("v") === image.staticInfo.hash;
|
|
6361
6506
|
res.setHeader("Content-Type", image.staticInfo.contentType);
|
|
@@ -6366,7 +6511,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
6366
6511
|
"Cache-Control",
|
|
6367
6512
|
isVersioned ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate"
|
|
6368
6513
|
);
|
|
6369
|
-
if (
|
|
6514
|
+
if (_chunkKIIMAWOJcjs.matchesFarmIfNoneMatch.call(void 0, req.headers["if-none-match"], etag)) {
|
|
6370
6515
|
res.statusCode = 304;
|
|
6371
6516
|
res.end();
|
|
6372
6517
|
return;
|
|
@@ -6527,11 +6672,11 @@ window.__FARM_ISLAND_STRATEGY__ = ${JSON.stringify(req.__FARM_ISLAND_STRATEGY__
|
|
|
6527
6672
|
window.__FARM_PAGE_MODULE__ = ${JSON.stringify(relativePath)};
|
|
6528
6673
|
window.__FARM_LOADING_MODULE__ = ${JSON.stringify(req.__FARM_LOADING_MODULE_PATH__ || null)};
|
|
6529
6674
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
6530
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
6675
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkCBJJH36Acjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
6531
6676
|
window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
|
|
6532
6677
|
</script>`;
|
|
6533
6678
|
const deferredScript = createDeferredHydrationScript(deferredProps.records);
|
|
6534
|
-
const rendererHydrationScript = _optionalChain([this, 'access',
|
|
6679
|
+
const rendererHydrationScript = _optionalChain([this, 'access', _255 => _255.rendererRuntime, 'access', _256 => _256.generateHydrationScript, 'optionalCall', _257 => _257()]) || "";
|
|
6535
6680
|
const { html: content, head: rendererHead } = await this.renderElementToDocumentParts(element);
|
|
6536
6681
|
const {
|
|
6537
6682
|
title,
|
|
@@ -6541,7 +6686,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6541
6686
|
viewport: viewportTags
|
|
6542
6687
|
} = _chunkEK4QAEFZcjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
6543
6688
|
pathname: getFarmMetadataPathname(req),
|
|
6544
|
-
jsonLd: _optionalChain([this, 'access',
|
|
6689
|
+
jsonLd: _optionalChain([this, 'access', _258 => _258.config, 'access', _259 => _259.agent, 'optionalAccess', _260 => _260.jsonLd])
|
|
6545
6690
|
});
|
|
6546
6691
|
const documentTitleTag = !hasExplicitTitle && /<title[\s>]/i.test(rendererHead) ? "" : `<title>${title}</title>`;
|
|
6547
6692
|
const rendererHasTitle = /<title[\s>]/i.test(rendererHead);
|
|
@@ -6551,18 +6696,18 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6551
6696
|
i18nSnapshot,
|
|
6552
6697
|
this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
|
|
6553
6698
|
) : "";
|
|
6554
|
-
const themeDocument =
|
|
6699
|
+
const themeDocument = _chunkADEA7PN3cjs.createFarmThemeDocumentParts.call(void 0,
|
|
6555
6700
|
this.config.theme,
|
|
6556
6701
|
this.config.basePath,
|
|
6557
6702
|
_chunkKXWRO25Scjs.getTheme.call(void 0, )
|
|
6558
6703
|
);
|
|
6559
|
-
const fullDocument =
|
|
6704
|
+
const fullDocument = _chunkADEA7PN3cjs.extractFarmFullDocument.call(void 0, content);
|
|
6560
6705
|
let html;
|
|
6561
6706
|
if (fullDocument) {
|
|
6562
6707
|
const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
|
|
6563
|
-
const documentHtml = shouldReplaceLayoutTitle ?
|
|
6564
|
-
const effectiveRendererHead = hasExplicitTitle ?
|
|
6565
|
-
html =
|
|
6708
|
+
const documentHtml = shouldReplaceLayoutTitle ? _chunkADEA7PN3cjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
|
|
6709
|
+
const effectiveRendererHead = hasExplicitTitle ? _chunkADEA7PN3cjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
|
|
6710
|
+
html = _chunkADEA7PN3cjs.composeFarmFullDocument.call(void 0, documentHtml, {
|
|
6566
6711
|
fallbackIcon: !hasFavicon,
|
|
6567
6712
|
viewport: viewportTags,
|
|
6568
6713
|
htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
|
|
@@ -6588,7 +6733,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6588
6733
|
});
|
|
6589
6734
|
} else {
|
|
6590
6735
|
html = `<!DOCTYPE html>
|
|
6591
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
6736
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _261 => _261.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
6592
6737
|
<head>
|
|
6593
6738
|
${themeDocument.head}
|
|
6594
6739
|
<meta charset="utf-8">
|
|
@@ -6619,7 +6764,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6619
6764
|
const securedHtml = this.secureDocumentHTML(req, html);
|
|
6620
6765
|
if ((req.method || "GET").toUpperCase() !== "HEAD") res.write(securedHtml);
|
|
6621
6766
|
res.end();
|
|
6622
|
-
if (!options.captureStaticShell) await _optionalChain([options, 'access',
|
|
6767
|
+
if (!options.captureStaticShell) await _optionalChain([options, 'access', _262 => _262.onComplete, 'optionalCall', _263 => _263(securedHtml)]);
|
|
6623
6768
|
_chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, {
|
|
6624
6769
|
type: "render.stream.complete",
|
|
6625
6770
|
route,
|
|
@@ -6629,7 +6774,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6629
6774
|
_chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, { type: "render.error", route, error });
|
|
6630
6775
|
throw error;
|
|
6631
6776
|
} finally {
|
|
6632
|
-
_optionalChain([clearMiddlewareData, 'optionalCall',
|
|
6777
|
+
_optionalChain([clearMiddlewareData, 'optionalCall', _264 => _264()]);
|
|
6633
6778
|
}
|
|
6634
6779
|
}
|
|
6635
6780
|
/**
|
|
@@ -6644,7 +6789,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6644
6789
|
if (!rootLayout) return false;
|
|
6645
6790
|
try {
|
|
6646
6791
|
const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
|
|
6647
|
-
if (typeof Layout !== "function" || _optionalChain([Layout, 'access',
|
|
6792
|
+
if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _265 => _265.prototype, 'optionalAccess', _266 => _266.isReactComponent]) || _optionalChain([Layout, 'access', _267 => _267.constructor, 'optionalAccess', _268 => _268.name]) === "AsyncFunction") {
|
|
6648
6793
|
return false;
|
|
6649
6794
|
}
|
|
6650
6795
|
const cached = documentLayouts.get(Layout);
|
|
@@ -6656,12 +6801,12 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6656
6801
|
params: {}
|
|
6657
6802
|
});
|
|
6658
6803
|
rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
|
|
6659
|
-
} catch (
|
|
6804
|
+
} catch (e19) {
|
|
6660
6805
|
rendersDocument = false;
|
|
6661
6806
|
}
|
|
6662
6807
|
documentLayouts.set(Layout, rendersDocument);
|
|
6663
6808
|
return rendersDocument;
|
|
6664
|
-
} catch (
|
|
6809
|
+
} catch (e20) {
|
|
6665
6810
|
return false;
|
|
6666
6811
|
}
|
|
6667
6812
|
}
|
|
@@ -6770,7 +6915,7 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
|
|
|
6770
6915
|
req.__FARM_LOADING_MODULE_PATH__ || null
|
|
6771
6916
|
)};
|
|
6772
6917
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
6773
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
6918
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkCBJJH36Acjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
6774
6919
|
window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
|
|
6775
6920
|
</script>`;
|
|
6776
6921
|
const hydrationClickQueueScript = isClientComponent || req.__FARM_SHOULD_HYDRATE__ === true || req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ === true ? createPreHydrationClickQueueScript() : "";
|
|
@@ -6781,7 +6926,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6781
6926
|
viewport: viewportTags
|
|
6782
6927
|
} = _chunkEK4QAEFZcjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
6783
6928
|
pathname: getFarmMetadataPathname(req),
|
|
6784
|
-
jsonLd: _optionalChain([this, 'access',
|
|
6929
|
+
jsonLd: _optionalChain([this, 'access', _269 => _269.config, 'access', _270 => _270.agent, 'optionalAccess', _271 => _271.jsonLd])
|
|
6785
6930
|
});
|
|
6786
6931
|
const i18nSnapshot = _chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
6787
6932
|
const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(
|
|
@@ -6790,7 +6935,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6790
6935
|
this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
|
|
6791
6936
|
) : "";
|
|
6792
6937
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
6793
|
-
const themeDocument =
|
|
6938
|
+
const themeDocument = _chunkADEA7PN3cjs.createFarmThemeDocumentParts.call(void 0,
|
|
6794
6939
|
this.config.theme,
|
|
6795
6940
|
this.config.basePath,
|
|
6796
6941
|
_chunkKXWRO25Scjs.getTheme.call(void 0, )
|
|
@@ -6799,13 +6944,13 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6799
6944
|
const devStyleLinks = this.collectDevStyleLinks();
|
|
6800
6945
|
const globalStylesheetLink = this.devGlobalStylesheetLink(true);
|
|
6801
6946
|
const cspNonce = this.getCspNonce(req);
|
|
6802
|
-
const secureDocumentHTML = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (html) => cspNonce ?
|
|
6947
|
+
const secureDocumentHTML = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (html) => cspNonce ? _chunkMRMI32SNcjs.addFarmCspNonceToScriptTags.call(void 0, html, cspNonce) : html, "secureDocumentHTML");
|
|
6803
6948
|
const createLateNavigationRecovery = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (navigationError) => this.createLateNavigationRecoveryHTML(req, navigationError), "createLateNavigationRecovery");
|
|
6804
6949
|
const { pipe, abort } = renderToPipeableStream(streamRoot, {
|
|
6805
6950
|
nonce: cspNonce,
|
|
6806
6951
|
onShellReady() {
|
|
6807
6952
|
if (pendingNavigationError) {
|
|
6808
|
-
_optionalChain([abort, 'optionalCall',
|
|
6953
|
+
_optionalChain([abort, 'optionalCall', _272 => _272(pendingNavigationError)]);
|
|
6809
6954
|
if (clearMiddlewareData) {
|
|
6810
6955
|
clearMiddlewareData();
|
|
6811
6956
|
}
|
|
@@ -6823,7 +6968,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6823
6968
|
console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
|
|
6824
6969
|
}
|
|
6825
6970
|
const shell = `<!DOCTYPE html>
|
|
6826
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
6971
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _273 => _273.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
6827
6972
|
<head>
|
|
6828
6973
|
${themeDocument.head}
|
|
6829
6974
|
<meta charset="utf-8">
|
|
@@ -6842,17 +6987,17 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6842
6987
|
<div id="root">`;
|
|
6843
6988
|
const securedShell = secureDocumentHTML(shell);
|
|
6844
6989
|
htmlParts.push(securedShell);
|
|
6845
|
-
_optionalChain([staticShellParts, 'optionalAccess',
|
|
6990
|
+
_optionalChain([staticShellParts, 'optionalAccess', _274 => _274.push, 'call', _275 => _275(securedShell)]);
|
|
6846
6991
|
let firstChunk = true;
|
|
6847
6992
|
let checkedFullDocument = false;
|
|
6848
6993
|
let documentPrefix = "";
|
|
6849
|
-
const cspNonceRewriter = cspNonce ?
|
|
6994
|
+
const cspNonceRewriter = cspNonce ? _chunkMRMI32SNcjs.createFarmCspNonceRewriter.call(void 0, cspNonce) : void 0;
|
|
6850
6995
|
const cspStreamDecoder = cspNonceRewriter ? new TextDecoder() : void 0;
|
|
6851
6996
|
const recordRenderedChunk = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (chunkText) => {
|
|
6852
6997
|
if (!chunkText) return;
|
|
6853
6998
|
if (!checkedFullDocument) {
|
|
6854
6999
|
documentPrefix += chunkText;
|
|
6855
|
-
const prefix =
|
|
7000
|
+
const prefix = _chunkADEA7PN3cjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
|
|
6856
7001
|
if (prefix !== "pending") {
|
|
6857
7002
|
checkedFullDocument = true;
|
|
6858
7003
|
documentPrefix = "";
|
|
@@ -6869,7 +7014,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6869
7014
|
staticShellClosed = true;
|
|
6870
7015
|
if (!suspenseHoleEmitted) {
|
|
6871
7016
|
suspenseHoleEmitted = true;
|
|
6872
|
-
_optionalChain([options, 'access',
|
|
7017
|
+
_optionalChain([options, 'access', _276 => _276.onSuspenseHoleDetected, 'optionalCall', _277 => _277()]);
|
|
6873
7018
|
}
|
|
6874
7019
|
} else {
|
|
6875
7020
|
staticShellParts.push(chunkText);
|
|
@@ -7020,13 +7165,13 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7020
7165
|
async loadNotFoundModule() {
|
|
7021
7166
|
const notFoundPath = resolveFarmNotFoundComponentPath(
|
|
7022
7167
|
this.config,
|
|
7023
|
-
|
|
7168
|
+
_chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, this.config)
|
|
7024
7169
|
);
|
|
7025
7170
|
if (!notFoundPath) return null;
|
|
7026
7171
|
return await this.routeManager.loadRouteModule(notFoundPath);
|
|
7027
7172
|
}
|
|
7028
7173
|
async loadNotFoundComponent() {
|
|
7029
|
-
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async
|
|
7174
|
+
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _278 => _278.default]), async () => ( null));
|
|
7030
7175
|
}
|
|
7031
7176
|
/** The not-found document's head: layout and not-found metadata, as production renders it. */
|
|
7032
7177
|
async notFoundMetadataHead(layoutModule, notFoundModule) {
|
|
@@ -7049,10 +7194,10 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7049
7194
|
*/
|
|
7050
7195
|
async createLateNavigationRecoveryHTML(req, error) {
|
|
7051
7196
|
if (_chunkOX6O6WVAcjs.isFarmRedirectError.call(void 0, error)) {
|
|
7052
|
-
return
|
|
7197
|
+
return _chunkADEA7PN3cjs.createLateRedirectRecovery.call(void 0, this.localizeRedirectUrl(_chunkOX6O6WVAcjs.getFarmRedirectError.call(void 0, error).url));
|
|
7053
7198
|
}
|
|
7054
7199
|
const pathname = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7055
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7200
|
+
trustProxy: _optionalChain([this, 'access', _279 => _279.config, 'access', _280 => _280.server, 'optionalAccess', _281 => _281.trustProxy])
|
|
7056
7201
|
}).pathname;
|
|
7057
7202
|
let content = this.defaultNotFoundContent();
|
|
7058
7203
|
const NotFoundComponent = await this.loadNotFoundComponent();
|
|
@@ -7067,12 +7212,12 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7067
7212
|
_chunk5QIKR7RRcjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
|
|
7068
7213
|
}
|
|
7069
7214
|
}
|
|
7070
|
-
return
|
|
7215
|
+
return _chunkADEA7PN3cjs.createLateNotFoundRecovery.call(void 0, content);
|
|
7071
7216
|
}
|
|
7072
7217
|
async render404(req, res) {
|
|
7073
7218
|
res.statusCode = 404;
|
|
7074
7219
|
const pathname = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7075
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7220
|
+
trustProxy: _optionalChain([this, 'access', _282 => _282.config, 'access', _283 => _283.server, 'optionalAccess', _284 => _284.trustProxy])
|
|
7076
7221
|
}).pathname;
|
|
7077
7222
|
const acceptHeader = req.headers.accept;
|
|
7078
7223
|
const accept = Array.isArray(acceptHeader) ? acceptHeader.join(",") : acceptHeader;
|
|
@@ -7096,13 +7241,13 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7096
7241
|
}
|
|
7097
7242
|
const notFoundPath = resolveFarmNotFoundComponentPath(
|
|
7098
7243
|
this.config,
|
|
7099
|
-
|
|
7244
|
+
_chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, this.config)
|
|
7100
7245
|
);
|
|
7101
7246
|
if (notFoundPath) {
|
|
7102
7247
|
const notFoundModule = await this.loadNotFoundModule();
|
|
7103
|
-
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess',
|
|
7248
|
+
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _285 => _285.default]), () => ( null));
|
|
7104
7249
|
if (NotFoundComponent) {
|
|
7105
|
-
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess',
|
|
7250
|
+
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _286 => _286.default]), () => ( null));
|
|
7106
7251
|
let element = this.rendererRuntime.createElement(NotFoundComponent, { pathname });
|
|
7107
7252
|
if (LayoutComponent) {
|
|
7108
7253
|
element = this.rendererRuntime.createElement(LayoutComponent, {
|
|
@@ -7139,21 +7284,21 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7139
7284
|
res.statusCode = statusCode;
|
|
7140
7285
|
const isDev = process.env.NODE_ENV === "development";
|
|
7141
7286
|
const requestUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
7142
|
-
trustProxy: _optionalChain([this, 'access',
|
|
7287
|
+
trustProxy: _optionalChain([this, 'access', _287 => _287.config, 'access', _288 => _288.server, 'optionalAccess', _289 => _289.trustProxy])
|
|
7143
7288
|
});
|
|
7144
7289
|
const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
|
|
7145
|
-
const statusText =
|
|
7146
|
-
const content =
|
|
7290
|
+
const statusText = _chunkADEA7PN3cjs.getDefaultErrorStatusText.call(void 0, statusCode);
|
|
7291
|
+
const content = _chunkADEA7PN3cjs.createDefaultErrorMarkup.call(void 0, {
|
|
7147
7292
|
statusCode,
|
|
7148
7293
|
statusText,
|
|
7149
7294
|
requestPath: requestUrl.pathname,
|
|
7150
7295
|
method: req.method || "GET",
|
|
7151
|
-
message: _optionalChain([diagnostics, 'optionalAccess',
|
|
7152
|
-
errorName: _optionalChain([diagnostics, 'optionalAccess',
|
|
7153
|
-
stack: _optionalChain([diagnostics, 'optionalAccess',
|
|
7154
|
-
sourceFrame: _optionalChain([diagnostics, 'optionalAccess',
|
|
7296
|
+
message: _optionalChain([diagnostics, 'optionalAccess', _290 => _290.message]),
|
|
7297
|
+
errorName: _optionalChain([diagnostics, 'optionalAccess', _291 => _291.name]),
|
|
7298
|
+
stack: _optionalChain([diagnostics, 'optionalAccess', _292 => _292.stack]),
|
|
7299
|
+
sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _293 => _293.sourceFrame]),
|
|
7155
7300
|
development: isDev,
|
|
7156
|
-
farmVersion:
|
|
7301
|
+
farmVersion: _chunkDZ5ZVB2Kcjs.FARM_VERSION,
|
|
7157
7302
|
nodeVersion: process.version,
|
|
7158
7303
|
mode: isDev ? "development" : "production"
|
|
7159
7304
|
});
|
|
@@ -7178,8 +7323,8 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7178
7323
|
*/
|
|
7179
7324
|
getI18nAlternateOptions(req, metadata) {
|
|
7180
7325
|
return {
|
|
7181
|
-
metadataBase: _optionalChain([metadata, 'optionalAccess',
|
|
7182
|
-
origin: req ? _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
7326
|
+
metadataBase: _optionalChain([metadata, 'optionalAccess', _294 => _294.metadataBase]),
|
|
7327
|
+
origin: req ? _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _295 => _295.config, 'access', _296 => _296.server, 'optionalAccess', _297 => _297.trustProxy]) }).origin : void 0
|
|
7183
7328
|
};
|
|
7184
7329
|
}
|
|
7185
7330
|
createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
|
|
@@ -7187,7 +7332,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
7187
7332
|
const clientScript = isClientComponent ? ` <script type="module" src="/@farm/client.js"></script>` : "";
|
|
7188
7333
|
const integrationManifestScript = `<script>
|
|
7189
7334
|
window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
|
|
7190
|
-
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(
|
|
7335
|
+
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkCBJJH36Acjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
7191
7336
|
${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};` : ""}
|
|
7192
7337
|
</script>`;
|
|
7193
7338
|
const alternateLinks = i18nSnapshot ? renderI18nAlternateLinks(
|
|
@@ -7196,17 +7341,17 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
7196
7341
|
this.getI18nAlternateOptions(alternates.req, alternates.metadata)
|
|
7197
7342
|
) : "";
|
|
7198
7343
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
7199
|
-
const themeDocument =
|
|
7344
|
+
const themeDocument = _chunkADEA7PN3cjs.createFarmThemeDocumentParts.call(void 0,
|
|
7200
7345
|
this.config.theme,
|
|
7201
7346
|
this.config.basePath,
|
|
7202
7347
|
_chunkKXWRO25Scjs.getTheme.call(void 0, )
|
|
7203
7348
|
);
|
|
7204
|
-
const rendererHydrationScript = _optionalChain([this, 'access',
|
|
7205
|
-
const viewportTags = _chunkEK4QAEFZcjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access',
|
|
7206
|
-
const fullDocument =
|
|
7349
|
+
const rendererHydrationScript = _optionalChain([this, 'access', _298 => _298.rendererRuntime, 'access', _299 => _299.generateHydrationScript, 'optionalCall', _300 => _300()]) || "";
|
|
7350
|
+
const viewportTags = _chunkEK4QAEFZcjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _301 => _301.metadata, 'optionalAccess', _302 => _302.viewport]));
|
|
7351
|
+
const fullDocument = _chunkADEA7PN3cjs.extractFarmFullDocument.call(void 0, content);
|
|
7207
7352
|
if (fullDocument) {
|
|
7208
|
-
return
|
|
7209
|
-
metadataHead ?
|
|
7353
|
+
return _chunkADEA7PN3cjs.composeFarmFullDocument.call(void 0,
|
|
7354
|
+
metadataHead ? _chunkADEA7PN3cjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
|
|
7210
7355
|
{
|
|
7211
7356
|
fallbackIcon: !metadataHead,
|
|
7212
7357
|
viewport: viewportTags,
|
|
@@ -7232,7 +7377,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
7232
7377
|
);
|
|
7233
7378
|
}
|
|
7234
7379
|
return `<!DOCTYPE html>
|
|
7235
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
7380
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _303 => _303.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
7236
7381
|
<head>
|
|
7237
7382
|
${themeDocument.head}
|
|
7238
7383
|
<meta charset="utf-8">
|
|
@@ -7258,14 +7403,14 @@ ${clientScript}
|
|
|
7258
7403
|
}
|
|
7259
7404
|
secureDocumentHTML(req, html) {
|
|
7260
7405
|
const nonce = this.getCspNonce(req);
|
|
7261
|
-
return nonce ?
|
|
7406
|
+
return nonce ? _chunkMRMI32SNcjs.addFarmCspNonceToScriptTags.call(void 0, html, nonce) : html;
|
|
7262
7407
|
}
|
|
7263
7408
|
applyDeploymentHeaders(req, res) {
|
|
7264
7409
|
const deploymentId = this.getDeploymentId();
|
|
7265
7410
|
res.setHeader(_chunkC5GUTBZKcjs.FARM_DEPLOYMENT_ID_HEADER, deploymentId);
|
|
7266
7411
|
if ((req.method || "GET").toUpperCase() !== "GET") return;
|
|
7267
7412
|
const forwardedProto = req.headers["x-forwarded-proto"];
|
|
7268
|
-
const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess',
|
|
7413
|
+
const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _304 => _304.split, 'call', _305 => _305(","), 'access', _306 => _306[0], 'optionalAccess', _307 => _307.trim, 'call', _308 => _308()]) === "https" || Boolean(_optionalChain([req, 'access', _309 => _309.socket, 'optionalAccess', _310 => _310.encrypted]));
|
|
7269
7414
|
const cookie = _chunkC5GUTBZKcjs.createFarmDeploymentCookie.call(void 0, deploymentId, this.config.basePath || "/", isSecure);
|
|
7270
7415
|
const existing = res.getHeader("Set-Cookie");
|
|
7271
7416
|
if (Array.isArray(existing)) {
|
|
@@ -7359,16 +7504,16 @@ var _FarmApp = class _FarmApp {
|
|
|
7359
7504
|
plugins: config.plugins || [],
|
|
7360
7505
|
migrations: config.migrations || { commands: [] },
|
|
7361
7506
|
cron: _chunk6EXBPJ24cjs.resolveCronConfig.call(void 0, config.cron),
|
|
7362
|
-
workflows:
|
|
7507
|
+
workflows: _chunkSDOTRX3Vcjs.resolveWorkflowsConfig.call(void 0, config.workflows),
|
|
7363
7508
|
api: normalizeFarmAppAPIConfig(config.api),
|
|
7364
7509
|
middleware: config.middleware || {},
|
|
7365
7510
|
routeRules: _chunkQ5B3KJBPcjs.normalizeRouteRules.call(void 0, config.routeRules),
|
|
7366
7511
|
context: config.context || (() => void 0),
|
|
7367
|
-
server:
|
|
7368
|
-
serverActions:
|
|
7369
|
-
security:
|
|
7512
|
+
server: _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, config.server),
|
|
7513
|
+
serverActions: _chunkT5OJPTVNcjs.resolveServerActionsConfig.call(void 0, config.serverActions),
|
|
7514
|
+
security: _chunkMRMI32SNcjs.resolveFarmSecurityConfig.call(void 0, config.security),
|
|
7370
7515
|
images: _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, config.images),
|
|
7371
|
-
performance:
|
|
7516
|
+
performance: _chunkMRMI32SNcjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
|
|
7372
7517
|
theme: _chunkOI6CMLWXcjs.resolveFarmThemeConfig.call(void 0, config.theme, basePath),
|
|
7373
7518
|
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : _chunkHLJ6MBUZcjs.resolveFarmI18nConfig.call(void 0, config.i18n, {
|
|
7374
7519
|
root,
|
|
@@ -7396,10 +7541,10 @@ var _FarmApp = class _FarmApp {
|
|
|
7396
7541
|
env: config.env || { server: {}, public: {} },
|
|
7397
7542
|
suppressLintOnLink: _nullishCoalesce(config.suppressLintOnLink, () => ( false)),
|
|
7398
7543
|
experimental: {
|
|
7399
|
-
serverComponents: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7400
|
-
serverActions: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7401
|
-
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7402
|
-
ppr: _nullishCoalesce(_optionalChain([config, 'access',
|
|
7544
|
+
serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _311 => _311.experimental, 'optionalAccess', _312 => _312.serverComponents]), () => ( false)),
|
|
7545
|
+
serverActions: _nullishCoalesce(_optionalChain([config, 'access', _313 => _313.experimental, 'optionalAccess', _314 => _314.serverActions]), () => ( false)),
|
|
7546
|
+
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _315 => _315.experimental, 'optionalAccess', _316 => _316.isolatedClientHydration]), () => ( "off")),
|
|
7547
|
+
ppr: _nullishCoalesce(_optionalChain([config, 'access', _317 => _317.experimental, 'optionalAccess', _318 => _318.ppr]), () => ( false)),
|
|
7403
7548
|
...config.experimental
|
|
7404
7549
|
},
|
|
7405
7550
|
agent: _nullishCoalesce(config.agent, () => ( {})),
|
|
@@ -7407,12 +7552,12 @@ var _FarmApp = class _FarmApp {
|
|
|
7407
7552
|
};
|
|
7408
7553
|
}
|
|
7409
7554
|
async verifyAppStructure() {
|
|
7410
|
-
const appDirs =
|
|
7555
|
+
const appDirs = _chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, this.config);
|
|
7411
7556
|
const hasAppDirectory = (await Promise.all(appDirs.map((appDir) => _chunk5QIKR7RRcjs.fileExists.call(void 0, appDir)))).some(
|
|
7412
7557
|
Boolean
|
|
7413
7558
|
);
|
|
7414
7559
|
if (!hasAppDirectory) {
|
|
7415
|
-
const routeFiles =
|
|
7560
|
+
const routeFiles = _chunkWBKEZXWEcjs.getFarmSourceRoots.call(void 0, this.config).flatMap(
|
|
7416
7561
|
(source) => _chunkSJNMVDDFcjs.findProgrammaticRouteFiles.call(void 0, source.root, source.srcDir)
|
|
7417
7562
|
);
|
|
7418
7563
|
if (routeFiles.length > 0) {
|
|
@@ -7450,7 +7595,7 @@ function isResolvedAuthConfig(value) {
|
|
|
7450
7595
|
}
|
|
7451
7596
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isResolvedAuthConfig, "isResolvedAuthConfig");
|
|
7452
7597
|
function normalizeFarmAppAPIConfig(config) {
|
|
7453
|
-
if (typeof _optionalChain([config, 'optionalAccess',
|
|
7598
|
+
if (typeof _optionalChain([config, 'optionalAccess', _319 => _319.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _320 => _320.basePath]) === "function") {
|
|
7454
7599
|
throw new Error(
|
|
7455
7600
|
"Farm API config resolver functions must be processed with resolveConfig() before creating a FarmApp."
|
|
7456
7601
|
);
|
|
@@ -7476,7 +7621,7 @@ function adaptPluginOption(pluginOption) {
|
|
|
7476
7621
|
if (Array.isArray(pluginOption)) return pluginOption.map(adaptPluginOption);
|
|
7477
7622
|
if (!pluginOption || typeof pluginOption !== "object") return pluginOption;
|
|
7478
7623
|
const plugin = pluginOption;
|
|
7479
|
-
if (!_optionalChain([plugin, 'access',
|
|
7624
|
+
if (!_optionalChain([plugin, 'access', _321 => _321.name, 'optionalAccess', _322 => _322.startsWith, 'call', _323 => _323("@tailwindcss/vite:generate:")])) return pluginOption;
|
|
7480
7625
|
if (isVitePluginHook(plugin.transform)) {
|
|
7481
7626
|
return {
|
|
7482
7627
|
...plugin,
|
|
@@ -7562,7 +7707,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, createMissingTailwindPlugin, "createMissin
|
|
|
7562
7707
|
var SHARP_INSTALL_HINT = _chunkLYLEZIG3cjs.formatOptionalPeerInstallHint.call(void 0, "sharp", "optimize images");
|
|
7563
7708
|
var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
|
|
7564
7709
|
function resolveFarmImageProviderForRuntime(images, options) {
|
|
7565
|
-
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess',
|
|
7710
|
+
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _324 => _324.provider]), () => ( "auto"));
|
|
7566
7711
|
if (provider === "none") return images;
|
|
7567
7712
|
const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
|
|
7568
7713
|
if (!usesSharp || _chunkLYLEZIG3cjs.isOptionalPeerInstalled.call(void 0, options.root, "sharp")) return images;
|
|
@@ -7587,7 +7732,7 @@ function validateSchemaSteps(owner, schema, steps) {
|
|
|
7587
7732
|
const models = _chunkJSROZYYOcjs.resolveSchemaModels.call(void 0, owner, schema);
|
|
7588
7733
|
const ids = /* @__PURE__ */ new Set();
|
|
7589
7734
|
for (const step of steps) {
|
|
7590
|
-
const where = `${owner} migration "${_optionalChain([step, 'optionalAccess',
|
|
7735
|
+
const where = `${owner} migration "${_optionalChain([step, 'optionalAccess', _325 => _325.id])}"`;
|
|
7591
7736
|
if (!step || typeof step.id !== "string" || step.id.trim() === "") {
|
|
7592
7737
|
throw new TypeError(`${owner}: every migration step needs a non-empty \`id\`.`);
|
|
7593
7738
|
}
|
|
@@ -7676,7 +7821,7 @@ ${lines.join("\n")}`);
|
|
|
7676
7821
|
_chunkS3JO3N4Hcjs.__name.call(void 0, _FarmPluginOptionsError, "FarmPluginOptionsError");
|
|
7677
7822
|
var FarmPluginOptionsError = _FarmPluginOptionsError;
|
|
7678
7823
|
function formatIssuePath(path22) {
|
|
7679
|
-
if (!_optionalChain([path22, 'optionalAccess',
|
|
7824
|
+
if (!_optionalChain([path22, 'optionalAccess', _326 => _326.length])) return "";
|
|
7680
7825
|
return path22.map((segment) => {
|
|
7681
7826
|
const key = typeof segment === "object" && segment !== null ? segment.key : segment;
|
|
7682
7827
|
return typeof key === "symbol" ? key.toString() : String(key);
|
|
@@ -7690,11 +7835,11 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, isPromiseLike, "isPromiseLike");
|
|
|
7690
7835
|
function isPluginOptionsSchema(value) {
|
|
7691
7836
|
if (typeof value !== "object" && typeof value !== "function" || value === null) return false;
|
|
7692
7837
|
const standard = value["~standard"];
|
|
7693
|
-
return typeof _optionalChain([standard, 'optionalAccess',
|
|
7838
|
+
return typeof _optionalChain([standard, 'optionalAccess', _327 => _327.validate]) === "function";
|
|
7694
7839
|
}
|
|
7695
7840
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isPluginOptionsSchema, "isPluginOptionsSchema");
|
|
7696
7841
|
function parsePluginOptions(schema, options) {
|
|
7697
|
-
const standard = _optionalChain([schema, 'optionalAccess',
|
|
7842
|
+
const standard = _optionalChain([schema, 'optionalAccess', _328 => _328["~standard"]]);
|
|
7698
7843
|
if (!standard || typeof standard.validate !== "function") {
|
|
7699
7844
|
throw new TypeError(
|
|
7700
7845
|
"A plugin's `options` needs a Standard Schema, such as a Zod, Valibot, or ArkType schema."
|
|
@@ -7729,7 +7874,7 @@ function normalizeFarmPluginRuntimeEndpointPath(pathname, label = "Farm plugin r
|
|
|
7729
7874
|
let decoded = segment;
|
|
7730
7875
|
try {
|
|
7731
7876
|
decoded = decodeURIComponent(segment);
|
|
7732
|
-
} catch (
|
|
7877
|
+
} catch (e21) {
|
|
7733
7878
|
throw new TypeError(`${label} path contains a malformed percent escape`);
|
|
7734
7879
|
}
|
|
7735
7880
|
if (decoded.includes("/") || decoded.includes("\\")) {
|
|
@@ -7754,9 +7899,9 @@ function normalizeRuntimeEndpointRequestPath(pathname) {
|
|
|
7754
7899
|
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeRuntimeEndpointRequestPath, "normalizeRuntimeEndpointRequestPath");
|
|
7755
7900
|
function farmPluginMayAffectRuntimePath(plugin, pathname) {
|
|
7756
7901
|
const runtime = plugin.runtime;
|
|
7757
|
-
const endpoints = _optionalChain([runtime, 'optionalAccess',
|
|
7902
|
+
const endpoints = _optionalChain([runtime, 'optionalAccess', _329 => _329.endpoints]);
|
|
7758
7903
|
const hasUnscopedRequestHooks = Boolean(
|
|
7759
|
-
plugin.init || plugin.ready || plugin.shutdown || _optionalChain([runtime, 'optionalAccess',
|
|
7904
|
+
plugin.init || plugin.ready || plugin.shutdown || _optionalChain([runtime, 'optionalAccess', _330 => _330.context]) || _optionalChain([runtime, 'optionalAccess', _331 => _331.before]) || _optionalChain([runtime, 'optionalAccess', _332 => _332.after]) || _optionalChain([runtime, 'optionalAccess', _333 => _333.error]) || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML || plugin.beforeRequest || plugin.afterResponse
|
|
7760
7905
|
);
|
|
7761
7906
|
if (hasUnscopedRequestHooks) return true;
|
|
7762
7907
|
if (Array.isArray(endpoints) && endpoints.length > 0) {
|
|
@@ -7768,7 +7913,7 @@ function farmPluginMayAffectRuntimePath(plugin, pathname) {
|
|
|
7768
7913
|
) === normalizedPathname
|
|
7769
7914
|
);
|
|
7770
7915
|
}
|
|
7771
|
-
return Boolean(plugin.setup || _optionalChain([runtime, 'optionalAccess',
|
|
7916
|
+
return Boolean(plugin.setup || _optionalChain([runtime, 'optionalAccess', _334 => _334.start]) || _optionalChain([runtime, 'optionalAccess', _335 => _335.close]));
|
|
7772
7917
|
}
|
|
7773
7918
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmPluginMayAffectRuntimePath, "farmPluginMayAffectRuntimePath");
|
|
7774
7919
|
|
|
@@ -7827,28 +7972,28 @@ var _PluginManager = class _PluginManager {
|
|
|
7827
7972
|
},
|
|
7828
7973
|
requestContext: {
|
|
7829
7974
|
set(target, key, value, options) {
|
|
7830
|
-
|
|
7975
|
+
_chunkKIIMAWOJcjs.setRequestContext.call(void 0, target, key, value, options);
|
|
7831
7976
|
},
|
|
7832
7977
|
get(target, key) {
|
|
7833
|
-
return
|
|
7978
|
+
return _chunkKIIMAWOJcjs.getRequestContext.call(void 0, target, key);
|
|
7834
7979
|
},
|
|
7835
7980
|
has(target, key) {
|
|
7836
|
-
return
|
|
7981
|
+
return _chunkKIIMAWOJcjs.hasRequestContext.call(void 0, target, key);
|
|
7837
7982
|
},
|
|
7838
7983
|
delete(target, key) {
|
|
7839
|
-
return
|
|
7984
|
+
return _chunkKIIMAWOJcjs.deleteRequestContext.call(void 0, target, key);
|
|
7840
7985
|
},
|
|
7841
7986
|
clear(target) {
|
|
7842
|
-
|
|
7987
|
+
_chunkKIIMAWOJcjs.clearRequestContext.call(void 0, target);
|
|
7843
7988
|
},
|
|
7844
7989
|
getAll(target, options) {
|
|
7845
|
-
return
|
|
7990
|
+
return _chunkKIIMAWOJcjs.getRequestContextSnapshot.call(void 0, target, options);
|
|
7846
7991
|
}
|
|
7847
7992
|
}
|
|
7848
7993
|
};
|
|
7849
7994
|
}
|
|
7850
7995
|
createPluginHookContext(plugin, context = this.context) {
|
|
7851
|
-
const integration =
|
|
7996
|
+
const integration = _chunkCBJJH36Acjs.getFarmPluginIntegrationContext.call(void 0, plugin);
|
|
7852
7997
|
return integration ? { ...context, integration } : context;
|
|
7853
7998
|
}
|
|
7854
7999
|
createRequestHookContext(target, plugin) {
|
|
@@ -7878,7 +8023,7 @@ var _PluginManager = class _PluginManager {
|
|
|
7878
8023
|
};
|
|
7879
8024
|
}
|
|
7880
8025
|
copyRequestStore(source, target) {
|
|
7881
|
-
|
|
8026
|
+
_chunkKIIMAWOJcjs.copyRequestContext.call(void 0, source, target);
|
|
7882
8027
|
}
|
|
7883
8028
|
copyRuntimeRequestContext(source, target) {
|
|
7884
8029
|
const runtimeContext = this.runtimeRequestContexts.get(source);
|
|
@@ -7902,7 +8047,7 @@ var _PluginManager = class _PluginManager {
|
|
|
7902
8047
|
const endpoints = [];
|
|
7903
8048
|
const owners = /* @__PURE__ */ new Map();
|
|
7904
8049
|
for (const plugin of this.getSortedPlugins()) {
|
|
7905
|
-
const configured = _optionalChain([plugin, 'access',
|
|
8050
|
+
const configured = _optionalChain([plugin, 'access', _336 => _336.runtime, 'optionalAccess', _337 => _337.endpoints]);
|
|
7906
8051
|
if (configured === void 0) continue;
|
|
7907
8052
|
if (!Array.isArray(configured)) {
|
|
7908
8053
|
throw new TypeError(`Farm plugin "${plugin.name}" runtime.endpoints must be an array`);
|
|
@@ -7973,7 +8118,7 @@ var _PluginManager = class _PluginManager {
|
|
|
7973
8118
|
const values = {};
|
|
7974
8119
|
const owners = /* @__PURE__ */ new Map();
|
|
7975
8120
|
for (const plugin of this.getSortedPlugins()) {
|
|
7976
|
-
const createContext = _optionalChain([plugin, 'access',
|
|
8121
|
+
const createContext = _optionalChain([plugin, 'access', _338 => _338.runtime, 'optionalAccess', _339 => _339.context]);
|
|
7977
8122
|
if (!createContext) continue;
|
|
7978
8123
|
const result = await createContext(
|
|
7979
8124
|
this.createRuntimeBaseEvent(plugin, request2, options, waitUntil)
|
|
@@ -7999,7 +8144,7 @@ var _PluginManager = class _PluginManager {
|
|
|
7999
8144
|
}
|
|
8000
8145
|
async runRuntimeErrorHooks(request2, error, ctx, durationMs, options, waitUntil) {
|
|
8001
8146
|
for (const plugin of this.getSortedPlugins()) {
|
|
8002
|
-
const onError = _optionalChain([plugin, 'access',
|
|
8147
|
+
const onError = _optionalChain([plugin, 'access', _340 => _340.runtime, 'optionalAccess', _341 => _341.error]);
|
|
8003
8148
|
if (!onError) continue;
|
|
8004
8149
|
try {
|
|
8005
8150
|
await onError({
|
|
@@ -8043,19 +8188,19 @@ var _PluginManager = class _PluginManager {
|
|
|
8043
8188
|
case "config":
|
|
8044
8189
|
if (plugin.configure) {
|
|
8045
8190
|
hooks.push(
|
|
8046
|
-
(config, context) => _optionalChain([plugin, 'access',
|
|
8191
|
+
(config, context) => _optionalChain([plugin, 'access', _342 => _342.configure, 'optionalCall', _343 => _343(config, context)])
|
|
8047
8192
|
);
|
|
8048
8193
|
}
|
|
8049
8194
|
break;
|
|
8050
8195
|
case "ready":
|
|
8051
|
-
if (_optionalChain([plugin, 'access',
|
|
8052
|
-
hooks.push((context) => _optionalChain([plugin, 'access',
|
|
8196
|
+
if (_optionalChain([plugin, 'access', _344 => _344.runtime, 'optionalAccess', _345 => _345.start])) {
|
|
8197
|
+
hooks.push((context) => _optionalChain([plugin, 'access', _346 => _346.runtime, 'optionalAccess', _347 => _347.start, 'optionalCall', _348 => _348(withState(context))]));
|
|
8053
8198
|
}
|
|
8054
8199
|
break;
|
|
8055
8200
|
case "shutdown":
|
|
8056
|
-
if (_optionalChain([plugin, 'access',
|
|
8201
|
+
if (_optionalChain([plugin, 'access', _349 => _349.runtime, 'optionalAccess', _350 => _350.close])) {
|
|
8057
8202
|
hooks.push(
|
|
8058
|
-
(payload, context) => _optionalChain([plugin, 'access',
|
|
8203
|
+
(payload, context) => _optionalChain([plugin, 'access', _351 => _351.runtime, 'optionalAccess', _352 => _352.close, 'optionalCall', _353 => _353({
|
|
8059
8204
|
...withState(context),
|
|
8060
8205
|
reason: payload.reason
|
|
8061
8206
|
})])
|
|
@@ -8063,93 +8208,93 @@ var _PluginManager = class _PluginManager {
|
|
|
8063
8208
|
}
|
|
8064
8209
|
break;
|
|
8065
8210
|
case "routeDiscovered":
|
|
8066
|
-
if (_optionalChain([plugin, 'access',
|
|
8211
|
+
if (_optionalChain([plugin, 'access', _354 => _354.router, 'optionalAccess', _355 => _355.discovered])) {
|
|
8067
8212
|
hooks.push(
|
|
8068
|
-
(route, context) => _optionalChain([plugin, 'access',
|
|
8213
|
+
(route, context) => _optionalChain([plugin, 'access', _356 => _356.router, 'optionalAccess', _357 => _357.discovered, 'optionalCall', _358 => _358(route, withState(context))])
|
|
8069
8214
|
);
|
|
8070
8215
|
}
|
|
8071
8216
|
break;
|
|
8072
8217
|
case "middlewareDiscovered":
|
|
8073
|
-
if (_optionalChain([plugin, 'access',
|
|
8218
|
+
if (_optionalChain([plugin, 'access', _359 => _359.router, 'optionalAccess', _360 => _360.discovered])) {
|
|
8074
8219
|
hooks.push(
|
|
8075
|
-
(route, context) => _optionalChain([plugin, 'access',
|
|
8220
|
+
(route, context) => _optionalChain([plugin, 'access', _361 => _361.router, 'optionalAccess', _362 => _362.discovered, 'optionalCall', _363 => _363({ kind: "middleware", ...route }, withState(context))])
|
|
8076
8221
|
);
|
|
8077
8222
|
}
|
|
8078
8223
|
break;
|
|
8079
8224
|
case "apiRouteDiscovered":
|
|
8080
|
-
if (_optionalChain([plugin, 'access',
|
|
8225
|
+
if (_optionalChain([plugin, 'access', _364 => _364.router, 'optionalAccess', _365 => _365.discovered])) {
|
|
8081
8226
|
hooks.push(
|
|
8082
|
-
(route, context) => _optionalChain([plugin, 'access',
|
|
8227
|
+
(route, context) => _optionalChain([plugin, 'access', _366 => _366.router, 'optionalAccess', _367 => _367.discovered, 'optionalCall', _368 => _368({ kind: "api", ...route }, withState(context))])
|
|
8083
8228
|
);
|
|
8084
8229
|
}
|
|
8085
8230
|
break;
|
|
8086
8231
|
case "routesGenerated":
|
|
8087
|
-
if (_optionalChain([plugin, 'access',
|
|
8232
|
+
if (_optionalChain([plugin, 'access', _369 => _369.router, 'optionalAccess', _370 => _370.generated])) {
|
|
8088
8233
|
hooks.push(
|
|
8089
|
-
(routes, context) => _optionalChain([plugin, 'access',
|
|
8234
|
+
(routes, context) => _optionalChain([plugin, 'access', _371 => _371.router, 'optionalAccess', _372 => _372.generated, 'optionalCall', _373 => _373(routes, withState(context))])
|
|
8090
8235
|
);
|
|
8091
8236
|
}
|
|
8092
8237
|
break;
|
|
8093
8238
|
case "beforeRouteMatch":
|
|
8094
|
-
if (_optionalChain([plugin, 'access',
|
|
8239
|
+
if (_optionalChain([plugin, 'access', _374 => _374.router, 'optionalAccess', _375 => _375.before])) {
|
|
8095
8240
|
hooks.push(
|
|
8096
|
-
(route, context) => _optionalChain([plugin, 'access',
|
|
8241
|
+
(route, context) => _optionalChain([plugin, 'access', _376 => _376.router, 'optionalAccess', _377 => _377.before, 'optionalCall', _378 => _378(route, withState(context))])
|
|
8097
8242
|
);
|
|
8098
8243
|
}
|
|
8099
8244
|
break;
|
|
8100
8245
|
case "afterRouteMatch":
|
|
8101
|
-
if (_optionalChain([plugin, 'access',
|
|
8246
|
+
if (_optionalChain([plugin, 'access', _379 => _379.router, 'optionalAccess', _380 => _380.after])) {
|
|
8102
8247
|
hooks.push(
|
|
8103
|
-
(result, context) => _optionalChain([plugin, 'access',
|
|
8248
|
+
(result, context) => _optionalChain([plugin, 'access', _381 => _381.router, 'optionalAccess', _382 => _382.after, 'optionalCall', _383 => _383(result, withState(context))])
|
|
8104
8249
|
);
|
|
8105
8250
|
}
|
|
8106
8251
|
break;
|
|
8107
8252
|
case "beforeRender":
|
|
8108
|
-
if (_optionalChain([plugin, 'access',
|
|
8253
|
+
if (_optionalChain([plugin, 'access', _384 => _384.render, 'optionalAccess', _385 => _385.before])) {
|
|
8109
8254
|
hooks.push(
|
|
8110
|
-
(render, context) => _optionalChain([plugin, 'access',
|
|
8255
|
+
(render, context) => _optionalChain([plugin, 'access', _386 => _386.render, 'optionalAccess', _387 => _387.before, 'optionalCall', _388 => _388(render, withState(context))])
|
|
8111
8256
|
);
|
|
8112
8257
|
}
|
|
8113
8258
|
break;
|
|
8114
8259
|
case "afterRender":
|
|
8115
|
-
if (_optionalChain([plugin, 'access',
|
|
8260
|
+
if (_optionalChain([plugin, 'access', _389 => _389.render, 'optionalAccess', _390 => _390.html])) {
|
|
8116
8261
|
hooks.push(
|
|
8117
|
-
(html, render, context) => _optionalChain([plugin, 'access',
|
|
8262
|
+
(html, render, context) => _optionalChain([plugin, 'access', _391 => _391.render, 'optionalAccess', _392 => _392.html, 'optionalCall', _393 => _393(html, render, withState(context))])
|
|
8118
8263
|
);
|
|
8119
8264
|
}
|
|
8120
8265
|
break;
|
|
8121
8266
|
case "beforeBundle":
|
|
8122
|
-
if (_optionalChain([plugin, 'access',
|
|
8267
|
+
if (_optionalChain([plugin, 'access', _394 => _394.build, 'optionalAccess', _395 => _395.before])) {
|
|
8123
8268
|
hooks.push(
|
|
8124
|
-
(bundle, context) => _optionalChain([plugin, 'access',
|
|
8269
|
+
(bundle, context) => _optionalChain([plugin, 'access', _396 => _396.build, 'optionalAccess', _397 => _397.before, 'optionalCall', _398 => _398(bundle, withState(context))])
|
|
8125
8270
|
);
|
|
8126
8271
|
}
|
|
8127
8272
|
break;
|
|
8128
8273
|
case "beforeNitroBuild":
|
|
8129
|
-
if (_optionalChain([plugin, 'access',
|
|
8274
|
+
if (_optionalChain([plugin, 'access', _399 => _399.build, 'optionalAccess', _400 => _400.configure])) {
|
|
8130
8275
|
hooks.push(
|
|
8131
|
-
(buildConfig, context) => _optionalChain([plugin, 'access',
|
|
8276
|
+
(buildConfig, context) => _optionalChain([plugin, 'access', _401 => _401.build, 'optionalAccess', _402 => _402.configure, 'optionalCall', _403 => _403(buildConfig, withState(context))])
|
|
8132
8277
|
);
|
|
8133
8278
|
}
|
|
8134
8279
|
break;
|
|
8135
8280
|
case "afterBundle":
|
|
8136
|
-
if (_optionalChain([plugin, 'access',
|
|
8281
|
+
if (_optionalChain([plugin, 'access', _404 => _404.build, 'optionalAccess', _405 => _405.after])) {
|
|
8137
8282
|
hooks.push(
|
|
8138
|
-
(result, context) => _optionalChain([plugin, 'access',
|
|
8283
|
+
(result, context) => _optionalChain([plugin, 'access', _406 => _406.build, 'optionalAccess', _407 => _407.after, 'optionalCall', _408 => _408(result, withState(context))])
|
|
8139
8284
|
);
|
|
8140
8285
|
}
|
|
8141
8286
|
break;
|
|
8142
8287
|
case "devServerCreated":
|
|
8143
|
-
if (_optionalChain([plugin, 'access',
|
|
8288
|
+
if (_optionalChain([plugin, 'access', _409 => _409.dev, 'optionalAccess', _410 => _410.server])) {
|
|
8144
8289
|
hooks.push(
|
|
8145
|
-
(server, context) => _optionalChain([plugin, 'access',
|
|
8290
|
+
(server, context) => _optionalChain([plugin, 'access', _411 => _411.dev, 'optionalAccess', _412 => _412.server, 'optionalCall', _413 => _413(server, withState(context))])
|
|
8146
8291
|
);
|
|
8147
8292
|
}
|
|
8148
8293
|
break;
|
|
8149
8294
|
case "hmrUpdate":
|
|
8150
|
-
if (_optionalChain([plugin, 'access',
|
|
8295
|
+
if (_optionalChain([plugin, 'access', _414 => _414.dev, 'optionalAccess', _415 => _415.update])) {
|
|
8151
8296
|
hooks.push(
|
|
8152
|
-
(update, context) => _optionalChain([plugin, 'access',
|
|
8297
|
+
(update, context) => _optionalChain([plugin, 'access', _416 => _416.dev, 'optionalAccess', _417 => _417.update, 'optionalCall', _418 => _418(update, withState(context))])
|
|
8153
8298
|
);
|
|
8154
8299
|
}
|
|
8155
8300
|
break;
|
|
@@ -8195,7 +8340,7 @@ var _PluginManager = class _PluginManager {
|
|
|
8195
8340
|
hasRuntimeHook(hookName) {
|
|
8196
8341
|
const cached = this.runtimeHookPresence.get(hookName);
|
|
8197
8342
|
if (cached !== void 0) return cached;
|
|
8198
|
-
const present = this.plugins.some((plugin) => typeof _optionalChain([plugin, 'access',
|
|
8343
|
+
const present = this.plugins.some((plugin) => typeof _optionalChain([plugin, 'access', _419 => _419.runtime, 'optionalAccess', _420 => _420[hookName]]) === "function");
|
|
8199
8344
|
this.runtimeHookPresence.set(hookName, present);
|
|
8200
8345
|
return present;
|
|
8201
8346
|
}
|
|
@@ -8274,7 +8419,7 @@ var _PluginManager = class _PluginManager {
|
|
|
8274
8419
|
async beginRuntimeRequest(request2, options = {}) {
|
|
8275
8420
|
await this.startRuntime();
|
|
8276
8421
|
const startedAt = Date.now();
|
|
8277
|
-
const waitUntil = options.waitUntil ? (promise) => _optionalChain([options, 'access',
|
|
8422
|
+
const waitUntil = options.waitUntil ? (promise) => _optionalChain([options, 'access', _421 => _421.waitUntil, 'optionalCall', _422 => _422(Promise.resolve(promise))]) : (promise) => {
|
|
8278
8423
|
void Promise.resolve(promise).catch(() => {
|
|
8279
8424
|
});
|
|
8280
8425
|
};
|
|
@@ -8307,7 +8452,7 @@ var _PluginManager = class _PluginManager {
|
|
|
8307
8452
|
);
|
|
8308
8453
|
let response;
|
|
8309
8454
|
for (const plugin of this.getSortedPlugins()) {
|
|
8310
|
-
const before = _optionalChain([plugin, 'access',
|
|
8455
|
+
const before = _optionalChain([plugin, 'access', _423 => _423.runtime, 'optionalAccess', _424 => _424.before]);
|
|
8311
8456
|
if (!before) continue;
|
|
8312
8457
|
const result = await before({
|
|
8313
8458
|
...this.createRuntimeBaseEvent(plugin, activeRequest, activeOptions, waitUntil),
|
|
@@ -8353,7 +8498,7 @@ var _PluginManager = class _PluginManager {
|
|
|
8353
8498
|
let response = initialResponse;
|
|
8354
8499
|
try {
|
|
8355
8500
|
for (const plugin of this.getSortedPlugins()) {
|
|
8356
|
-
const after = _optionalChain([plugin, 'access',
|
|
8501
|
+
const after = _optionalChain([plugin, 'access', _425 => _425.runtime, 'optionalAccess', _426 => _426.after]);
|
|
8357
8502
|
if (!after) continue;
|
|
8358
8503
|
const result = await after({
|
|
8359
8504
|
...this.createRuntimeBaseEvent(
|
|
@@ -8442,7 +8587,7 @@ var _PluginManager = class _PluginManager {
|
|
|
8442
8587
|
/** @internal Runs hooks for only the plugins selected by the runtime adapter. */
|
|
8443
8588
|
async runHookParallelFiltered(hookName, include, ...args) {
|
|
8444
8589
|
if (hookName === "shutdown" && !this.runtimeShutdownHooksRunning) {
|
|
8445
|
-
await this.closeRuntime(_optionalChain([args, 'access',
|
|
8590
|
+
await this.closeRuntime(_optionalChain([args, 'access', _427 => _427[0], 'optionalAccess', _428 => _428.reason]));
|
|
8446
8591
|
return false;
|
|
8447
8592
|
}
|
|
8448
8593
|
const plugins = this.getSortedPlugins().filter(include);
|
|
@@ -8555,7 +8700,7 @@ function createPluginFactory(definition) {
|
|
|
8555
8700
|
configure: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (config, context) => configure(config, { ...context, options }), "configure")
|
|
8556
8701
|
} : {},
|
|
8557
8702
|
setup(context) {
|
|
8558
|
-
const state = _optionalChain([setup, 'optionalCall',
|
|
8703
|
+
const state = _optionalChain([setup, 'optionalCall', _429 => _429({ ...context, options })]);
|
|
8559
8704
|
return state instanceof Promise ? state.then(resolveState) : resolveState(state);
|
|
8560
8705
|
}
|
|
8561
8706
|
});
|
|
@@ -8596,10 +8741,10 @@ function declarePluginSchema(plugin) {
|
|
|
8596
8741
|
models: Object.keys(models).filter((key) => !models[key].external),
|
|
8597
8742
|
...plugin.dependsOn ? { dependsOn: plugin.dependsOn.map(_chunk6MVFL3R5cjs.pluginShortName) } : {},
|
|
8598
8743
|
...plugin.version ? { version: plugin.version } : {},
|
|
8599
|
-
..._optionalChain([plugin, 'access',
|
|
8600
|
-
dialect: _optionalChain([database, 'optionalAccess',
|
|
8744
|
+
..._optionalChain([plugin, 'access', _430 => _430.migrations, 'optionalAccess', _431 => _431.length]) ? { migrations: plugin.migrations } : {},
|
|
8745
|
+
dialect: _optionalChain([database, 'optionalAccess', _432 => _432.dialect]),
|
|
8601
8746
|
resolveClient: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (config) => {
|
|
8602
|
-
if (_optionalChain([database, 'optionalAccess',
|
|
8747
|
+
if (_optionalChain([database, 'optionalAccess', _433 => _433.client]) !== void 0 && database.client !== null) {
|
|
8603
8748
|
const client2 = typeof database.client === "function" ? await database.client() : database.client;
|
|
8604
8749
|
if (client2 === void 0 || client2 === null) {
|
|
8605
8750
|
throw new Error(`The ${name} plugin's \`database.client\` returned no connection.`);
|
|
@@ -8653,7 +8798,7 @@ function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
|
|
|
8653
8798
|
}
|
|
8654
8799
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAppClientEntry, "resolveFarmAppClientEntry");
|
|
8655
8800
|
function resolveFarmClientPlugins(plugins, _root) {
|
|
8656
|
-
if (!_optionalChain([plugins, 'optionalAccess',
|
|
8801
|
+
if (!_optionalChain([plugins, 'optionalAccess', _434 => _434.length])) return [];
|
|
8657
8802
|
return plugins.flatMap((plugin) => {
|
|
8658
8803
|
if (!plugin.client) return [];
|
|
8659
8804
|
assertClientLifecycle(plugin.client, plugin.name);
|
|
@@ -8733,7 +8878,7 @@ function assertLifecycleObject(value, pluginName, location, allowedKeys) {
|
|
|
8733
8878
|
throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
|
|
8734
8879
|
}
|
|
8735
8880
|
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
8736
|
-
if (!_optionalChain([descriptor, 'optionalAccess',
|
|
8881
|
+
if (!_optionalChain([descriptor, 'optionalAccess', _435 => _435.enumerable])) {
|
|
8737
8882
|
throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
|
|
8738
8883
|
}
|
|
8739
8884
|
if (!("value" in descriptor)) {
|
|
@@ -8857,7 +9002,7 @@ function assertPublicData(value, pluginName) {
|
|
|
8857
9002
|
throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
|
|
8858
9003
|
}
|
|
8859
9004
|
const descriptor = Object.getOwnPropertyDescriptor(current, key);
|
|
8860
|
-
if (!_optionalChain([descriptor, 'optionalAccess',
|
|
9005
|
+
if (!_optionalChain([descriptor, 'optionalAccess', _436 => _436.enumerable])) {
|
|
8861
9006
|
throwPublicDataError(
|
|
8862
9007
|
pluginName,
|
|
8863
9008
|
[...pathSegments, key],
|
|
@@ -8903,8 +9048,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, isArrayIndex, "isArrayIndex");
|
|
|
8903
9048
|
|
|
8904
9049
|
var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
8905
9050
|
function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
8906
|
-
const client = _optionalChain([cache2, 'optionalAccess',
|
|
8907
|
-
const adapter = _optionalChain([client, 'optionalAccess',
|
|
9051
|
+
const client = _optionalChain([cache2, 'optionalAccess', _437 => _437.client]);
|
|
9052
|
+
const adapter = _optionalChain([client, 'optionalAccess', _438 => _438.adapter]);
|
|
8908
9053
|
if (adapter === void 0) return void 0;
|
|
8909
9054
|
if (typeof adapter !== "string" || adapter.trim().length === 0) {
|
|
8910
9055
|
throw new Error(
|
|
@@ -8919,8 +9064,8 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
|
8919
9064
|
);
|
|
8920
9065
|
}
|
|
8921
9066
|
const options = {};
|
|
8922
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
8923
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
9067
|
+
if (_optionalChain([client, 'optionalAccess', _439 => _439.version]) !== void 0) options.version = client.version;
|
|
9068
|
+
if (_optionalChain([client, 'optionalAccess', _440 => _440.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
|
|
8924
9069
|
return { importPath: found.replace(/\\/g, "/"), options };
|
|
8925
9070
|
}
|
|
8926
9071
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmClientCacheAdapterEntry, "resolveFarmClientCacheAdapterEntry");
|
|
@@ -8953,7 +9098,7 @@ function resolveFarmAppPackages(root) {
|
|
|
8953
9098
|
let manifest;
|
|
8954
9099
|
try {
|
|
8955
9100
|
manifest = JSON.parse(fs5.default.readFileSync(path9.default.join(root, "package.json"), "utf8"));
|
|
8956
|
-
} catch (
|
|
9101
|
+
} catch (e22) {
|
|
8957
9102
|
return {};
|
|
8958
9103
|
}
|
|
8959
9104
|
const names = new Set(
|
|
@@ -8972,7 +9117,7 @@ function resolveFarmAppPackages(root) {
|
|
|
8972
9117
|
if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
|
|
8973
9118
|
versions[name] = version;
|
|
8974
9119
|
break;
|
|
8975
|
-
} catch (
|
|
9120
|
+
} catch (e23) {
|
|
8976
9121
|
const parent = path9.default.dirname(dir);
|
|
8977
9122
|
if (parent === dir) break;
|
|
8978
9123
|
dir = parent;
|
|
@@ -9049,9 +9194,9 @@ function staticValue(node) {
|
|
|
9049
9194
|
}
|
|
9050
9195
|
_chunkS3JO3N4Hcjs.__name.call(void 0, staticValue, "staticValue");
|
|
9051
9196
|
function property(object, name) {
|
|
9052
|
-
return _optionalChain([object, 'access',
|
|
9197
|
+
return _optionalChain([object, 'access', _441 => _441.properties, 'access', _442 => _442.find, 'call', _443 => _443(
|
|
9053
9198
|
(entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
|
|
9054
|
-
), 'optionalAccess',
|
|
9199
|
+
), 'optionalAccess', _444 => _444.value]);
|
|
9055
9200
|
}
|
|
9056
9201
|
_chunkS3JO3N4Hcjs.__name.call(void 0, property, "property");
|
|
9057
9202
|
function toolFromObject(object) {
|
|
@@ -9091,7 +9236,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
9091
9236
|
let program;
|
|
9092
9237
|
try {
|
|
9093
9238
|
program = parseAst(code, { lang });
|
|
9094
|
-
} catch (
|
|
9239
|
+
} catch (e24) {
|
|
9095
9240
|
return [];
|
|
9096
9241
|
}
|
|
9097
9242
|
const locals = /* @__PURE__ */ new Map();
|
|
@@ -9099,7 +9244,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
9099
9244
|
if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
|
|
9100
9245
|
continue;
|
|
9101
9246
|
for (const specifier of statement.specifiers) {
|
|
9102
|
-
const imported = _nullishCoalesce(_optionalChain([specifier, 'access',
|
|
9247
|
+
const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _445 => _445.imported, 'optionalAccess', _446 => _446.name]), () => ( _optionalChain([specifier, 'access', _447 => _447.imported, 'optionalAccess', _448 => _448.value])));
|
|
9103
9248
|
if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
|
|
9104
9249
|
locals.set(specifier.local.name, imported);
|
|
9105
9250
|
}
|
|
@@ -9115,7 +9260,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
9115
9260
|
const [argument] = current.arguments;
|
|
9116
9261
|
if (definer && argument) {
|
|
9117
9262
|
const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
|
|
9118
|
-
(element) => _optionalChain([element, 'optionalAccess',
|
|
9263
|
+
(element) => _optionalChain([element, 'optionalAccess', _449 => _449.type]) === "ObjectExpression"
|
|
9119
9264
|
) : [] : argument.type === "ObjectExpression" ? [argument] : [];
|
|
9120
9265
|
for (const object of objects) {
|
|
9121
9266
|
const tool = toolFromObject(object);
|
|
@@ -9140,7 +9285,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
9140
9285
|
absolute: true,
|
|
9141
9286
|
ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
|
|
9142
9287
|
});
|
|
9143
|
-
} catch (
|
|
9288
|
+
} catch (e25) {
|
|
9144
9289
|
return [];
|
|
9145
9290
|
}
|
|
9146
9291
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -9149,7 +9294,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
9149
9294
|
let mtimeMs;
|
|
9150
9295
|
try {
|
|
9151
9296
|
mtimeMs = fs5.default.statSync(file).mtimeMs;
|
|
9152
|
-
} catch (
|
|
9297
|
+
} catch (e26) {
|
|
9153
9298
|
continue;
|
|
9154
9299
|
}
|
|
9155
9300
|
let entry = cache.get(file);
|
|
@@ -9157,7 +9302,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
9157
9302
|
let code = "";
|
|
9158
9303
|
try {
|
|
9159
9304
|
code = fs5.default.readFileSync(file, "utf8");
|
|
9160
|
-
} catch (
|
|
9305
|
+
} catch (e27) {
|
|
9161
9306
|
}
|
|
9162
9307
|
entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
|
|
9163
9308
|
cache.set(file, entry);
|
|
@@ -9269,13 +9414,13 @@ var SOURCE_QUERY_FLAGS = ["raw", "inline", "url"];
|
|
|
9269
9414
|
var MODULE_EXTENSION = /\.(?:[cm]?[jt]sx?|vue|svelte|astro|mdx?|css|scss|sass|less|styl|stylus|pcss|postcss|sss)$/i;
|
|
9270
9415
|
var ASSET_EXTENSION = /\.(?:apng|bmp|png|jpe?g|jfif|pjpeg|pjp|gif|svg|ico|webp|avif|cur|jxl|mp4|webm|ogg|mp3|wav|flac|aac|opus|mov|m4a|vtt|woff2?|eot|ttf|otf|webmanifest|pdf|txt|wasm)$/i;
|
|
9271
9416
|
var INTERNAL_PREFIXES = ["/@vite/", "/@farm/", "/@react-refresh", "/__vite_ping"];
|
|
9272
|
-
var DEVELOPER_ONLY_PREFIXES = ["/__farm/devtools", "/__open-in-editor"];
|
|
9417
|
+
var DEVELOPER_ONLY_PREFIXES = ["/__farm/devtools", "/__open-in-editor", "/__mf_runner__"];
|
|
9273
9418
|
function createFarmDevPreviewGuard(server, options) {
|
|
9274
9419
|
return /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async function farmDevPreviewGuard(req, res, next) {
|
|
9275
9420
|
if (!isFarmPreviewTunnelRequest(req.headers)) return next();
|
|
9276
9421
|
try {
|
|
9277
9422
|
if (await isAllowedPreviewRequest(server, options, req)) return next();
|
|
9278
|
-
} catch (
|
|
9423
|
+
} catch (e28) {
|
|
9279
9424
|
}
|
|
9280
9425
|
res.statusCode = 403;
|
|
9281
9426
|
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
@@ -9301,8 +9446,8 @@ async function isAllowedPreviewRequest(server, options, req) {
|
|
|
9301
9446
|
if (method !== "GET" && method !== "HEAD") return true;
|
|
9302
9447
|
const file = await resolveRequestedFile(server, pathname);
|
|
9303
9448
|
if (!file) return true;
|
|
9304
|
-
const client = _optionalChain([server, 'access',
|
|
9305
|
-
const inClientGraph = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => Boolean(await _optionalChain([client, 'optionalAccess',
|
|
9449
|
+
const client = _optionalChain([server, 'access', _450 => _450.environments, 'optionalAccess', _451 => _451.client]);
|
|
9450
|
+
const inClientGraph = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => Boolean(await _optionalChain([client, 'optionalAccess', _452 => _452.moduleGraph, 'access', _453 => _453.getModuleByUrl, 'call', _454 => _454(url)])), "inClientGraph");
|
|
9306
9451
|
if (SOURCE_QUERY_FLAGS.some((flag) => query.has(flag))) return inClientGraph();
|
|
9307
9452
|
if (await inClientGraph()) return true;
|
|
9308
9453
|
if (file.split(path16.sep).includes("node_modules")) return true;
|
|
@@ -9331,17 +9476,17 @@ async function resolveRequestedFile(server, pathname) {
|
|
|
9331
9476
|
id = id.slice("/@id/".length).replace(/^__x00__/, "\0");
|
|
9332
9477
|
if (id.startsWith("\0")) return void 0;
|
|
9333
9478
|
}
|
|
9334
|
-
const resolved = await _optionalChain([server, 'access',
|
|
9335
|
-
const resolvedId = _optionalChain([resolved, 'optionalAccess',
|
|
9479
|
+
const resolved = await _optionalChain([server, 'access', _455 => _455.environments, 'optionalAccess', _456 => _456.client, 'optionalAccess', _457 => _457.pluginContainer, 'access', _458 => _458.resolveId, 'call', _459 => _459(id, void 0)]);
|
|
9480
|
+
const resolvedId = _optionalChain([resolved, 'optionalAccess', _460 => _460.id, 'access', _461 => _461.replace, 'call', _462 => _462(/[?#].*$/, "")]);
|
|
9336
9481
|
if (resolvedId && path16.isAbsolute(resolvedId)) candidate = resolvedId;
|
|
9337
|
-
else if (_optionalChain([resolvedId, 'optionalAccess',
|
|
9482
|
+
else if (_optionalChain([resolvedId, 'optionalAccess', _463 => _463.startsWith, 'call', _464 => _464("\0")])) return void 0;
|
|
9338
9483
|
else if (id.startsWith("/")) candidate = path16.join(server.config.root, id);
|
|
9339
9484
|
}
|
|
9340
9485
|
if (!candidate) return void 0;
|
|
9341
9486
|
try {
|
|
9342
9487
|
const real = await _fs.promises.realpath(candidate);
|
|
9343
9488
|
return (await _fs.promises.stat(real)).isFile() ? real : void 0;
|
|
9344
|
-
} catch (
|
|
9489
|
+
} catch (e29) {
|
|
9345
9490
|
return void 0;
|
|
9346
9491
|
}
|
|
9347
9492
|
}
|
|
@@ -9349,7 +9494,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveRequestedFile, "resolveRequestedFil
|
|
|
9349
9494
|
async function realpathOr(directory) {
|
|
9350
9495
|
try {
|
|
9351
9496
|
return await _fs.promises.realpath(directory);
|
|
9352
|
-
} catch (
|
|
9497
|
+
} catch (e30) {
|
|
9353
9498
|
return path16.resolve(directory);
|
|
9354
9499
|
}
|
|
9355
9500
|
}
|
|
@@ -9371,7 +9516,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, isInside, "isInside");
|
|
|
9371
9516
|
function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = []) {
|
|
9372
9517
|
if (!pathname.includes(".") || pathname.endsWith(".html")) return false;
|
|
9373
9518
|
const matchesAppRoute = Boolean(
|
|
9374
|
-
_optionalChain([routeManager, 'optionalAccess',
|
|
9519
|
+
_optionalChain([routeManager, 'optionalAccess', _465 => _465.matchRoute, 'call', _466 => _466(pathname), 'optionalAccess', _467 => _467.route]) || _optionalChain([routeManager, 'optionalAccess', _468 => _468.matchMetadataRoute, 'call', _469 => _469(pathname)]) || _optionalChain([routeManager, 'optionalAccess', _470 => _470.matchMetadataImage, 'call', _471 => _471(pathname)]) || generatedPaths.includes(pathname)
|
|
9375
9520
|
);
|
|
9376
9521
|
return !matchesAppRoute || devServableFileExists(pathname, baseDirs);
|
|
9377
9522
|
}
|
|
@@ -9400,14 +9545,14 @@ var DOCS_ENGINE_APP_OWNABLE_PATHS = /* @__PURE__ */ new Set([
|
|
|
9400
9545
|
]);
|
|
9401
9546
|
function farmAppOwnsDocsEnginePath(pathname, options) {
|
|
9402
9547
|
if (!DOCS_ENGINE_APP_OWNABLE_PATHS.has(pathname)) return false;
|
|
9403
|
-
return options.generatedPaths.includes(pathname) || Boolean(_optionalChain([options, 'access',
|
|
9548
|
+
return options.generatedPaths.includes(pathname) || Boolean(_optionalChain([options, 'access', _472 => _472.routeManager, 'optionalAccess', _473 => _473.matchMetadataRoute, 'call', _474 => _474(pathname)])) || devServableFileExists(pathname, [options.publicDir]);
|
|
9404
9549
|
}
|
|
9405
9550
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmAppOwnsDocsEnginePath, "farmAppOwnsDocsEnginePath");
|
|
9406
9551
|
function devServableFileExists(pathname, baseDirs) {
|
|
9407
9552
|
let decodedPathname;
|
|
9408
9553
|
try {
|
|
9409
9554
|
decodedPathname = decodeURIComponent(pathname);
|
|
9410
|
-
} catch (
|
|
9555
|
+
} catch (e31) {
|
|
9411
9556
|
return false;
|
|
9412
9557
|
}
|
|
9413
9558
|
const relativePathname = decodedPathname.replace(/^\/+/, "");
|
|
@@ -9421,7 +9566,7 @@ function devServableFileExists(pathname, baseDirs) {
|
|
|
9421
9566
|
if (fs10.existsSync(candidate) && fs10.statSync(candidate).isFile()) {
|
|
9422
9567
|
return true;
|
|
9423
9568
|
}
|
|
9424
|
-
} catch (
|
|
9569
|
+
} catch (e32) {
|
|
9425
9570
|
}
|
|
9426
9571
|
}
|
|
9427
9572
|
return false;
|
|
@@ -9507,14 +9652,14 @@ function analyzeClientBoundary(program, publicKeys) {
|
|
|
9507
9652
|
_chunkS3JO3N4Hcjs.__name.call(void 0, analyzeClientBoundary, "analyzeClientBoundary");
|
|
9508
9653
|
function readNodeBuiltinSource(node) {
|
|
9509
9654
|
if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ImportExpression") {
|
|
9510
|
-
const value = _optionalChain([node, 'access',
|
|
9655
|
+
const value = _optionalChain([node, 'access', _475 => _475.source, 'optionalAccess', _476 => _476.value]);
|
|
9511
9656
|
return typeof value === "string" && value.startsWith("node:") ? value : void 0;
|
|
9512
9657
|
}
|
|
9513
9658
|
if (node.type === "CallExpression") {
|
|
9514
9659
|
const callee = node.callee;
|
|
9515
|
-
if (_optionalChain([callee, 'optionalAccess',
|
|
9516
|
-
const arg = _optionalChain([node, 'access',
|
|
9517
|
-
const value = _optionalChain([arg, 'optionalAccess',
|
|
9660
|
+
if (_optionalChain([callee, 'optionalAccess', _477 => _477.type]) === "Identifier" && callee.name === "require") {
|
|
9661
|
+
const arg = _optionalChain([node, 'access', _478 => _478.arguments, 'optionalAccess', _479 => _479[0]]);
|
|
9662
|
+
const value = _optionalChain([arg, 'optionalAccess', _480 => _480.type]) === "Literal" ? arg.value : void 0;
|
|
9518
9663
|
return typeof value === "string" && value.startsWith("node:") ? value : void 0;
|
|
9519
9664
|
}
|
|
9520
9665
|
}
|
|
@@ -9524,7 +9669,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, readNodeBuiltinSource, "readNodeBuiltinSou
|
|
|
9524
9669
|
function readProcessEnvKey(node) {
|
|
9525
9670
|
if (node.type !== "MemberExpression") return void 0;
|
|
9526
9671
|
const object = node.object;
|
|
9527
|
-
if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access',
|
|
9672
|
+
if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access', _481 => _481.object, 'optionalAccess', _482 => _482.type]) !== "Identifier" || object.object.name !== "process" || _optionalChain([object, 'access', _483 => _483.property, 'optionalAccess', _484 => _484.name]) !== "env") {
|
|
9528
9673
|
return void 0;
|
|
9529
9674
|
}
|
|
9530
9675
|
const property2 = node.property;
|
|
@@ -9589,7 +9734,7 @@ function farmImageImportsPlugin() {
|
|
|
9589
9734
|
async transform(code, id) {
|
|
9590
9735
|
const filePath = id.split("?", 1)[0];
|
|
9591
9736
|
if (id.includes("?") || !STATIC_IMAGE_RE.test(filePath)) return null;
|
|
9592
|
-
const defaultExport = _optionalChain([code, 'access',
|
|
9737
|
+
const defaultExport = _optionalChain([code, 'access', _485 => _485.match, 'call', _486 => _486(/^\s*export\s+default\s+(.+?);?\s*$/s), 'optionalAccess', _487 => _487[1]]);
|
|
9593
9738
|
if (!defaultExport) return null;
|
|
9594
9739
|
return createStaticImageModule(filePath, `const src = ${defaultExport};`);
|
|
9595
9740
|
}
|
|
@@ -9624,7 +9769,7 @@ async function createBlurDataURL(bytes) {
|
|
|
9624
9769
|
const { default: sharp } = await import("sharp");
|
|
9625
9770
|
const placeholder = await sharp(bytes).rotate().resize({ width: 8, height: 8, fit: "inside", withoutEnlargement: true }).webp({ quality: 35 }).toBuffer();
|
|
9626
9771
|
return `data:image/webp;base64,${placeholder.toString("base64")}`;
|
|
9627
|
-
} catch (
|
|
9772
|
+
} catch (e33) {
|
|
9628
9773
|
return void 0;
|
|
9629
9774
|
}
|
|
9630
9775
|
}
|
|
@@ -9650,7 +9795,7 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
|
9650
9795
|
];
|
|
9651
9796
|
function getFarmClientOptimizeDepsInclude(renderer) {
|
|
9652
9797
|
return Array.from(
|
|
9653
|
-
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess',
|
|
9798
|
+
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _488 => _488.optimizeDeps]) || []])
|
|
9654
9799
|
);
|
|
9655
9800
|
}
|
|
9656
9801
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmClientOptimizeDepsInclude, "getFarmClientOptimizeDepsInclude");
|
|
@@ -9675,7 +9820,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
|
|
|
9675
9820
|
// Farm's HTML boots through a virtual module and imports route UI lazily.
|
|
9676
9821
|
// Explicit entries let Vite finish that crawl before a navigation can
|
|
9677
9822
|
// rotate the optimizer hash underneath a hydrated React runtime.
|
|
9678
|
-
..._optionalChain([entries, 'optionalAccess',
|
|
9823
|
+
..._optionalChain([entries, 'optionalAccess', _489 => _489.length]) ? { entries: [...entries] } : {}
|
|
9679
9824
|
};
|
|
9680
9825
|
}
|
|
9681
9826
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
|
|
@@ -9705,8 +9850,8 @@ function mergeAlias(farmValue, userValue) {
|
|
|
9705
9850
|
}
|
|
9706
9851
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeAlias, "mergeAlias");
|
|
9707
9852
|
function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
9708
|
-
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
9709
|
-
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
9853
|
+
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _490 => _490.optimizeDeps, 'optionalAccess', _491 => _491.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _492 => _492.optimizeDeps, 'optionalAccess', _493 => _493.noDiscovery])));
|
|
9854
|
+
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _494 => _494.optimizeDeps, 'optionalAccess', _495 => _495.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _496 => _496.optimizeDeps, 'optionalAccess', _497 => _497.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _498 => _498.optimizeDeps, 'optionalAccess', _499 => _499.holdUntilCrawlEnd]))));
|
|
9710
9855
|
return {
|
|
9711
9856
|
...farmConfig,
|
|
9712
9857
|
...userConfig,
|
|
@@ -9718,9 +9863,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
9718
9863
|
resolve: {
|
|
9719
9864
|
...farmConfig.resolve,
|
|
9720
9865
|
...userConfig.resolve,
|
|
9721
|
-
alias: mergeAlias(_optionalChain([farmConfig, 'access',
|
|
9866
|
+
alias: mergeAlias(_optionalChain([farmConfig, 'access', _500 => _500.resolve, 'optionalAccess', _501 => _501.alias]), _optionalChain([userConfig, 'access', _502 => _502.resolve, 'optionalAccess', _503 => _503.alias])),
|
|
9722
9867
|
dedupe: Array.from(
|
|
9723
|
-
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access',
|
|
9868
|
+
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _504 => _504.resolve, 'optionalAccess', _505 => _505.dedupe]) || [], ..._optionalChain([userConfig, 'access', _506 => _506.resolve, 'optionalAccess', _507 => _507.dedupe]) || []])
|
|
9724
9869
|
)
|
|
9725
9870
|
},
|
|
9726
9871
|
optimizeDeps: {
|
|
@@ -9730,21 +9875,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
9730
9875
|
holdUntilCrawlEnd,
|
|
9731
9876
|
include: Array.from(
|
|
9732
9877
|
/* @__PURE__ */ new Set([
|
|
9733
|
-
..._optionalChain([farmConfig, 'access',
|
|
9734
|
-
..._optionalChain([userConfig, 'access',
|
|
9878
|
+
..._optionalChain([farmConfig, 'access', _508 => _508.optimizeDeps, 'optionalAccess', _509 => _509.include]) || [],
|
|
9879
|
+
..._optionalChain([userConfig, 'access', _510 => _510.optimizeDeps, 'optionalAccess', _511 => _511.include]) || []
|
|
9735
9880
|
])
|
|
9736
9881
|
),
|
|
9737
9882
|
exclude: Array.from(
|
|
9738
9883
|
/* @__PURE__ */ new Set([
|
|
9739
|
-
..._optionalChain([farmConfig, 'access',
|
|
9740
|
-
..._optionalChain([userConfig, 'access',
|
|
9884
|
+
..._optionalChain([farmConfig, 'access', _512 => _512.optimizeDeps, 'optionalAccess', _513 => _513.exclude]) || [],
|
|
9885
|
+
..._optionalChain([userConfig, 'access', _514 => _514.optimizeDeps, 'optionalAccess', _515 => _515.exclude]) || []
|
|
9741
9886
|
])
|
|
9742
9887
|
)
|
|
9743
9888
|
},
|
|
9744
9889
|
ssr: {
|
|
9745
9890
|
...farmConfig.ssr,
|
|
9746
9891
|
...userConfig.ssr,
|
|
9747
|
-
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access',
|
|
9892
|
+
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _516 => _516.ssr, 'optionalAccess', _517 => _517.noExternal]), _optionalChain([userConfig, 'access', _518 => _518.ssr, 'optionalAccess', _519 => _519.noExternal]))
|
|
9748
9893
|
}
|
|
9749
9894
|
};
|
|
9750
9895
|
}
|
|
@@ -9798,7 +9943,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
|
|
|
9798
9943
|
...farmConfig.build,
|
|
9799
9944
|
rollupOptions: {
|
|
9800
9945
|
...userBundlerOptions,
|
|
9801
|
-
..._optionalChain([farmConfig, 'access',
|
|
9946
|
+
..._optionalChain([farmConfig, 'access', _520 => _520.build, 'optionalAccess', _521 => _521.rollupOptions])
|
|
9802
9947
|
}
|
|
9803
9948
|
},
|
|
9804
9949
|
css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
|
|
@@ -9806,7 +9951,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
|
|
|
9806
9951
|
esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
|
|
9807
9952
|
ssr: {
|
|
9808
9953
|
...merged.ssr,
|
|
9809
|
-
external: mergeExternal(_optionalChain([farmConfig, 'access',
|
|
9954
|
+
external: mergeExternal(_optionalChain([farmConfig, 'access', _522 => _522.ssr, 'optionalAccess', _523 => _523.external]), _optionalChain([userConfig, 'access', _524 => _524.ssr, 'optionalAccess', _525 => _525.external]))
|
|
9810
9955
|
}
|
|
9811
9956
|
};
|
|
9812
9957
|
}
|
|
@@ -9843,7 +9988,7 @@ function redactFarmDocsClientConfig(code, filename) {
|
|
|
9843
9988
|
const current = node;
|
|
9844
9989
|
if (current.type === "Property") {
|
|
9845
9990
|
const name = propertyKeyName(current);
|
|
9846
|
-
const valueType = _optionalChain([current, 'access',
|
|
9991
|
+
const valueType = _optionalChain([current, 'access', _526 => _526.value, 'optionalAccess', _527 => _527.type]);
|
|
9847
9992
|
const credential = name !== void 0 && (name.toLowerCase() === "headers" || _chunkHITLGIAOcjs.isSecretDocsConfigKey.call(void 0, name) && valueType !== "ObjectExpression" && valueType !== "ArrayExpression");
|
|
9848
9993
|
if (name && credential) {
|
|
9849
9994
|
edits.push(
|
|
@@ -9875,7 +10020,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
|
|
|
9875
10020
|
if (file === configModule) return true;
|
|
9876
10021
|
try {
|
|
9877
10022
|
return file === _fs.realpathSync.call(void 0, configModule).replace(/\\/g, "/");
|
|
9878
|
-
} catch (
|
|
10023
|
+
} catch (e34) {
|
|
9879
10024
|
return false;
|
|
9880
10025
|
}
|
|
9881
10026
|
}
|
|
@@ -9885,7 +10030,7 @@ function farmDocsClientConfigPlugin(configModule) {
|
|
|
9885
10030
|
name: "farm:docs-client-config",
|
|
9886
10031
|
enforce: "pre",
|
|
9887
10032
|
transform(code, id, options) {
|
|
9888
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
10033
|
+
if (_optionalChain([options, 'optionalAccess', _528 => _528.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
|
|
9889
10034
|
const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
|
|
9890
10035
|
return redacted === null ? null : { code: redacted, map: null };
|
|
9891
10036
|
}
|
|
@@ -9960,14 +10105,19 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, reportOpenAPIDevGenerationResult, "reportO
|
|
|
9960
10105
|
// src/vite.ts
|
|
9961
10106
|
var SERVER_FN_TRANSFORM_PLUGIN = "@farm.js/plugin/rsc:server-fn-actions";
|
|
9962
10107
|
function farmLlmsTxtGeneratedPaths(config) {
|
|
9963
|
-
const llms =
|
|
10108
|
+
const llms = _chunk4WQ6PGSJcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _529 => _529.agent, 'optionalAccess', _530 => _530.llmsTxt]));
|
|
9964
10109
|
if (!llms.enabled) return [];
|
|
9965
10110
|
return llms.full ? ["/llms.txt", "/llms-full.txt"] : ["/llms.txt"];
|
|
9966
10111
|
}
|
|
9967
10112
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmLlmsTxtGeneratedPaths, "farmLlmsTxtGeneratedPaths");
|
|
9968
10113
|
function farmAgentGeneratedPaths(config) {
|
|
9969
|
-
const crawlers =
|
|
9970
|
-
|
|
10114
|
+
const crawlers = _chunkMRMI32SNcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _531 => _531.agent, 'optionalAccess', _532 => _532.crawlers]));
|
|
10115
|
+
const sitemap = _chunkMRMI32SNcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([config, 'access', _533 => _533.agent, 'optionalAccess', _534 => _534.sitemap]));
|
|
10116
|
+
return [
|
|
10117
|
+
...farmLlmsTxtGeneratedPaths(config),
|
|
10118
|
+
...sitemap.enabled ? ["/sitemap.xml"] : [],
|
|
10119
|
+
...crawlers.enabled ? ["/robots.txt"] : []
|
|
10120
|
+
];
|
|
9971
10121
|
}
|
|
9972
10122
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmAgentGeneratedPaths, "farmAgentGeneratedPaths");
|
|
9973
10123
|
var ALL_TYPE_ARTIFACTS = {
|
|
@@ -10012,7 +10162,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
10012
10162
|
}
|
|
10013
10163
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
10014
10164
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
10015
|
-
return import("./devtools-
|
|
10165
|
+
return import("./devtools-JZJJY5CK.cjs");
|
|
10016
10166
|
}
|
|
10017
10167
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
10018
10168
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -10028,7 +10178,7 @@ function farmI18nClientBridgePlugin() {
|
|
|
10028
10178
|
name: "farm:i18n-client-bridge",
|
|
10029
10179
|
enforce: "pre",
|
|
10030
10180
|
resolveId(id, _importer, options) {
|
|
10031
|
-
if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess',
|
|
10181
|
+
if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess', _535 => _535.ssr])) {
|
|
10032
10182
|
return FARM_I18N_CLIENT_BRIDGE_ID;
|
|
10033
10183
|
}
|
|
10034
10184
|
return null;
|
|
@@ -10053,7 +10203,7 @@ function farmServerOnlyEntriesPlugin() {
|
|
|
10053
10203
|
resolveId(id, importer, options) {
|
|
10054
10204
|
if (!FARM_SERVER_ONLY_ENTRIES.has(id)) return null;
|
|
10055
10205
|
const importedBy = importer ? ` (imported by ${importer})` : "";
|
|
10056
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
10206
|
+
if (!_optionalChain([options, 'optionalAccess', _536 => _536.ssr])) {
|
|
10057
10207
|
this.error(
|
|
10058
10208
|
`${id} is server-only and cannot be imported into client code${importedBy}. Use it from an API route or another server module.`
|
|
10059
10209
|
);
|
|
@@ -10099,11 +10249,11 @@ function renderFarmI18nStaticHead(requestPath, snapshot) {
|
|
|
10099
10249
|
if (!snapshot) return "";
|
|
10100
10250
|
const runtime = `<script>window.__FARM_I18N__ = ${serializeFarmInlineValue(snapshot)};</script>`;
|
|
10101
10251
|
if (snapshot.routing === "none") return runtime;
|
|
10102
|
-
return `${
|
|
10252
|
+
return `${_chunkADEA7PN3cjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
|
|
10103
10253
|
}
|
|
10104
10254
|
_chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmI18nStaticHead, "renderFarmI18nStaticHead");
|
|
10105
10255
|
function getPublicEnvDefine(config) {
|
|
10106
|
-
const publicEnv = _optionalChain([config, 'access',
|
|
10256
|
+
const publicEnv = _optionalChain([config, 'access', _537 => _537.env, 'optionalAccess', _538 => _538.public]);
|
|
10107
10257
|
if (!isResolvedEnvScope(publicEnv)) {
|
|
10108
10258
|
return {};
|
|
10109
10259
|
}
|
|
@@ -10144,7 +10294,7 @@ function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request2
|
|
|
10144
10294
|
return;
|
|
10145
10295
|
}
|
|
10146
10296
|
if (res.headersSent) {
|
|
10147
|
-
_optionalChain([res, 'access',
|
|
10297
|
+
_optionalChain([res, 'access', _539 => _539.destroy, 'optionalCall', _540 => _540(error instanceof Error ? error : new Error(String(error)))]);
|
|
10148
10298
|
return;
|
|
10149
10299
|
}
|
|
10150
10300
|
res.statusCode = 500;
|
|
@@ -10243,7 +10393,7 @@ function interceptFarmDevPageResponse(options) {
|
|
|
10243
10393
|
const originalWrite = res.write.bind(res);
|
|
10244
10394
|
const originalEnd = res.end.bind(res);
|
|
10245
10395
|
const originalWriteHead = res.writeHead.bind(res);
|
|
10246
|
-
const originalFlushHeaders = _optionalChain([res, 'access',
|
|
10396
|
+
const originalFlushHeaders = _optionalChain([res, 'access', _541 => _541.flushHeaders, 'optionalAccess', _542 => _542.bind, 'call', _543 => _543(res)]);
|
|
10247
10397
|
let afterResponseCalled = false;
|
|
10248
10398
|
let interceptedEnd = false;
|
|
10249
10399
|
const htmlChunks = [];
|
|
@@ -10283,7 +10433,7 @@ function interceptFarmDevPageResponse(options) {
|
|
|
10283
10433
|
const shouldBufferResponse = isHtmlResponse ? bufferPluginResponse : Boolean(runtimeSession && hasRuntimeAfterHook);
|
|
10284
10434
|
if (shouldBufferResponse) {
|
|
10285
10435
|
const callback = args.find((arg) => typeof arg === "function");
|
|
10286
|
-
_optionalChain([callback, 'optionalCall',
|
|
10436
|
+
_optionalChain([callback, 'optionalCall', _544 => _544()]);
|
|
10287
10437
|
return true;
|
|
10288
10438
|
}
|
|
10289
10439
|
const writeResult = originalWrite(chunk, ...args);
|
|
@@ -10398,14 +10548,14 @@ function getEnvDefines(config, configEnv) {
|
|
|
10398
10548
|
_chunkYFPGHF5Fcjs.getPublicFarmImageConfig.call(void 0, _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, config.images))
|
|
10399
10549
|
)
|
|
10400
10550
|
};
|
|
10401
|
-
if (_optionalChain([configEnv, 'optionalAccess',
|
|
10551
|
+
if (_optionalChain([configEnv, 'optionalAccess', _545 => _545.isSsrBuild])) {
|
|
10402
10552
|
defines.__FARM_ENV__ = JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, getFullEnvDefine(config)));
|
|
10403
10553
|
}
|
|
10404
10554
|
return defines;
|
|
10405
10555
|
}
|
|
10406
10556
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getEnvDefines, "getEnvDefines");
|
|
10407
10557
|
function getFarmAPIBaseURLDefine(config) {
|
|
10408
|
-
const baseURL = _optionalChain([config, 'access',
|
|
10558
|
+
const baseURL = _optionalChain([config, 'access', _546 => _546.api, 'optionalAccess', _547 => _547.baseURL]);
|
|
10409
10559
|
return typeof baseURL === "string" && baseURL ? baseURL : _chunkS3A45T7Fcjs.DEFAULT_FARM_API_BASE_PATH;
|
|
10410
10560
|
}
|
|
10411
10561
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmAPIBaseURLDefine, "getFarmAPIBaseURLDefine");
|
|
@@ -10428,7 +10578,7 @@ function fileContainsProgrammaticPageRoute(file) {
|
|
|
10428
10578
|
}
|
|
10429
10579
|
try {
|
|
10430
10580
|
return _chunk6V4TDWECcjs.scanProgrammaticPagePaths.call(void 0, fs11.readFileSync(file, "utf8")).length > 0;
|
|
10431
|
-
} catch (
|
|
10581
|
+
} catch (e35) {
|
|
10432
10582
|
return false;
|
|
10433
10583
|
}
|
|
10434
10584
|
}
|
|
@@ -10442,7 +10592,7 @@ function rewriteEarlySsrRelativeImports(options) {
|
|
|
10442
10592
|
let ast;
|
|
10443
10593
|
try {
|
|
10444
10594
|
ast = options.parse(options.code);
|
|
10445
|
-
} catch (
|
|
10595
|
+
} catch (e36) {
|
|
10446
10596
|
return null;
|
|
10447
10597
|
}
|
|
10448
10598
|
walkModuleAst(ast, (node) => {
|
|
@@ -10474,7 +10624,7 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
10474
10624
|
let ast;
|
|
10475
10625
|
try {
|
|
10476
10626
|
ast = options.parse(options.code);
|
|
10477
|
-
} catch (
|
|
10627
|
+
} catch (e37) {
|
|
10478
10628
|
return null;
|
|
10479
10629
|
}
|
|
10480
10630
|
const body = Array.isArray(ast.body) ? ast.body : [];
|
|
@@ -10495,9 +10645,9 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
10495
10645
|
transformedExports++;
|
|
10496
10646
|
}, "addWrapper");
|
|
10497
10647
|
for (const node of body) {
|
|
10498
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
10648
|
+
if (_optionalChain([node, 'optionalAccess', _548 => _548.type]) === "ExportDefaultDeclaration" && node.declaration) {
|
|
10499
10649
|
const declaration2 = node.declaration;
|
|
10500
|
-
if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access',
|
|
10650
|
+
if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access', _549 => _549.id, 'optionalAccess', _550 => _550.name])) {
|
|
10501
10651
|
replacements.push({
|
|
10502
10652
|
start: node.start,
|
|
10503
10653
|
end: node.end,
|
|
@@ -10515,14 +10665,14 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
10515
10665
|
}
|
|
10516
10666
|
continue;
|
|
10517
10667
|
}
|
|
10518
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
10668
|
+
if (_optionalChain([node, 'optionalAccess', _551 => _551.type]) !== "ExportNamedDeclaration" || !node.declaration) continue;
|
|
10519
10669
|
const declaration = node.declaration;
|
|
10520
10670
|
const declaredNames = [];
|
|
10521
|
-
if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access',
|
|
10671
|
+
if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access', _552 => _552.id, 'optionalAccess', _553 => _553.name])) {
|
|
10522
10672
|
declaredNames.push(declaration.id.name);
|
|
10523
10673
|
} else if (declaration.type === "VariableDeclaration") {
|
|
10524
10674
|
for (const declarator of declaration.declarations || []) {
|
|
10525
|
-
if (_optionalChain([declarator, 'access',
|
|
10675
|
+
if (_optionalChain([declarator, 'access', _554 => _554.id, 'optionalAccess', _555 => _555.type]) === "Identifier") declaredNames.push(declarator.id.name);
|
|
10526
10676
|
}
|
|
10527
10677
|
}
|
|
10528
10678
|
const componentNames = declaredNames.filter((name) => /^[A-Z]/.test(name));
|
|
@@ -10583,10 +10733,10 @@ function warnClientBoundaryOnce(context, id, code, config) {
|
|
|
10583
10733
|
let program;
|
|
10584
10734
|
try {
|
|
10585
10735
|
program = context.parse(code);
|
|
10586
|
-
} catch (
|
|
10736
|
+
} catch (e38) {
|
|
10587
10737
|
return;
|
|
10588
10738
|
}
|
|
10589
|
-
const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access',
|
|
10739
|
+
const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access', _556 => _556.env, 'optionalAccess', _557 => _557.public]), () => ( {}))));
|
|
10590
10740
|
const findings = analyzeClientBoundary(program, publicKeys);
|
|
10591
10741
|
if (findings.envKeys.length === 0 && findings.publicEnvKeys.length === 0 && findings.builtinImports.length === 0) {
|
|
10592
10742
|
return;
|
|
@@ -10642,8 +10792,8 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10642
10792
|
name: "farm",
|
|
10643
10793
|
config(userConfig, configEnv) {
|
|
10644
10794
|
isBuild = configEnv.command === "build";
|
|
10645
|
-
const layerAliases =
|
|
10646
|
-
const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access',
|
|
10795
|
+
const layerAliases = _chunkWBKEZXWEcjs.getFarmLayerAliases.call(void 0, options.layers);
|
|
10796
|
+
const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _558 => _558.resolve, 'optionalAccess', _559 => _559.alias]), "@") ? {} : createFarmSourceAlias(options.root || process.cwd(), options.srcDir);
|
|
10647
10797
|
const layerRoots = (_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.root);
|
|
10648
10798
|
return {
|
|
10649
10799
|
// Honor Farm's publicDir so the dev server serves the same static
|
|
@@ -10659,7 +10809,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10659
10809
|
server: {
|
|
10660
10810
|
fs: {
|
|
10661
10811
|
...layerRoots.length ? { allow: [path21.resolve(options.root || process.cwd()), ...layerRoots] } : {},
|
|
10662
|
-
deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access',
|
|
10812
|
+
deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _560 => _560.server, 'optionalAccess', _561 => _561.fs, 'optionalAccess', _562 => _562.deny]), options)
|
|
10663
10813
|
}
|
|
10664
10814
|
}
|
|
10665
10815
|
};
|
|
@@ -10671,7 +10821,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10671
10821
|
serverFnTransformActive = config.plugins.some(
|
|
10672
10822
|
(plugin) => plugin.name === SERVER_FN_TRANSFORM_PLUGIN
|
|
10673
10823
|
);
|
|
10674
|
-
if (_optionalChain([options, 'access',
|
|
10824
|
+
if (_optionalChain([options, 'access', _563 => _563.experimental, 'optionalAccess', _564 => _564.serverActions]) === true && !serverFnTransformActive) {
|
|
10675
10825
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
10676
10826
|
"experimental.serverActions has no effect without @farm.js/plugin/rsc in the Vite plugins. Server functions stay server-only, and importing one from client code is a build error."
|
|
10677
10827
|
);
|
|
@@ -10680,7 +10830,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10680
10830
|
async configureServer(viteServer) {
|
|
10681
10831
|
viteServer.middlewares.use(
|
|
10682
10832
|
createFarmDevPreviewGuard(viteServer, {
|
|
10683
|
-
getSourceRoots: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () =>
|
|
10833
|
+
getSourceRoots: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _chunkWBKEZXWEcjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _565 => _565.getConfig, 'call', _566 => _566()]), () => ( options))), "getSourceRoots")
|
|
10684
10834
|
})
|
|
10685
10835
|
);
|
|
10686
10836
|
if (typeof fontImports.configureServer === "function") {
|
|
@@ -10692,7 +10842,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10692
10842
|
if (!pm) return;
|
|
10693
10843
|
try {
|
|
10694
10844
|
await pm.runHookParallel("onError", { phase, error, meta });
|
|
10695
|
-
} catch (
|
|
10845
|
+
} catch (e39) {
|
|
10696
10846
|
}
|
|
10697
10847
|
}, "emitPluginError");
|
|
10698
10848
|
farmApp = new FarmApp(
|
|
@@ -10705,27 +10855,27 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10705
10855
|
await farmApp.initialize();
|
|
10706
10856
|
const farmConfig = farmApp.getConfig();
|
|
10707
10857
|
let farmAppPackages;
|
|
10708
|
-
if (_optionalChain([farmConfig, 'access',
|
|
10858
|
+
if (_optionalChain([farmConfig, 'access', _567 => _567.agent, 'optionalAccess', _568 => _568.noindexPreviews])) {
|
|
10709
10859
|
server.middlewares.use((_req, res, next) => {
|
|
10710
10860
|
if (_chunkCXP5U3RWcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
|
|
10711
|
-
res.setHeader("X-Robots-Tag",
|
|
10861
|
+
res.setHeader("X-Robots-Tag", _chunkMRMI32SNcjs.FARM_PREVIEW_ROBOTS_TAG);
|
|
10712
10862
|
}
|
|
10713
10863
|
next();
|
|
10714
10864
|
});
|
|
10715
10865
|
}
|
|
10716
10866
|
const apiServerBasePath = _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, farmConfig.api);
|
|
10717
|
-
const serverConfig =
|
|
10867
|
+
const serverConfig = _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, farmConfig.server);
|
|
10718
10868
|
globalThis.__FARM_IMAGE_CONFIG__ = _chunkYFPGHF5Fcjs.getPublicFarmImageConfig.call(void 0, farmConfig.images);
|
|
10719
10869
|
let imageHandler = null;
|
|
10720
10870
|
if (farmConfig.images.provider !== "none") {
|
|
10721
10871
|
const { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } = await import("./image/sharp.cjs");
|
|
10722
|
-
imageHandler =
|
|
10872
|
+
imageHandler = _chunkCGBDNNSMcjs.createFarmImageHandler.call(void 0, farmConfig.images, {
|
|
10723
10873
|
transform: createSharpImageTransformer(),
|
|
10724
10874
|
fetchRemote: createNodeImageFetcher(farmConfig.images),
|
|
10725
10875
|
validateRemoteUrl: createNodeImageUrlValidator(farmConfig.images),
|
|
10726
10876
|
// Vite owns this address. Unlike request.url, it cannot be replaced by
|
|
10727
10877
|
// a caller-controlled Host header.
|
|
10728
|
-
trustedLocalOrigin: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _optionalChain([server, 'access',
|
|
10878
|
+
trustedLocalOrigin: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => _optionalChain([server, 'access', _569 => _569.resolvedUrls, 'optionalAccess', _570 => _570.local, 'access', _571 => _571[0]]), "trustedLocalOrigin"),
|
|
10729
10879
|
onError(error) {
|
|
10730
10880
|
_chunk5QIKR7RRcjs.logger.error(
|
|
10731
10881
|
`Image optimization failed: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -10733,7 +10883,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10733
10883
|
}
|
|
10734
10884
|
});
|
|
10735
10885
|
}
|
|
10736
|
-
const sourceRoots =
|
|
10886
|
+
const sourceRoots = _chunkWBKEZXWEcjs.getFarmSourceRoots.call(void 0, farmConfig);
|
|
10737
10887
|
server.watcher.add(sourceRoots.map((source) => path21.join(source.root, source.srcDir)));
|
|
10738
10888
|
if (farmConfig.i18n.enabled) {
|
|
10739
10889
|
server.watcher.add(
|
|
@@ -10745,15 +10895,15 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10745
10895
|
const workflowConfig = farmConfig.workflows;
|
|
10746
10896
|
const farmDocsDevRuntime = farmConfig.docs.enabled ? await loadFarmDocsDevRuntime() : null;
|
|
10747
10897
|
const getExtraRouteTypes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => [
|
|
10748
|
-
..._optionalChain([options, 'access',
|
|
10749
|
-
..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess',
|
|
10898
|
+
..._optionalChain([options, 'access', _572 => _572.openapi, 'optionalAccess', _573 => _573.enabled]) && options.openapi.route ? [options.openapi.route] : [],
|
|
10899
|
+
..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _574 => _574.getFarmDocsRouteTypeEntries, 'call', _575 => _575(farmConfig.docs)]), () => ( []))
|
|
10750
10900
|
], "getExtraRouteTypes");
|
|
10751
10901
|
const appDirSlugs = sourceRoots.map(
|
|
10752
10902
|
(source) => path21.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
|
|
10753
10903
|
);
|
|
10754
10904
|
const generateTypeArtifacts = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
|
|
10755
10905
|
try {
|
|
10756
|
-
const result = await
|
|
10906
|
+
const result = await _chunkJNUWCDTFcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
10757
10907
|
root: farmConfig.root,
|
|
10758
10908
|
srcDir: farmConfig.srcDir,
|
|
10759
10909
|
layers: farmConfig.layers,
|
|
@@ -10793,7 +10943,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10793
10943
|
(source) => path21.join(source.root, source.srcDir).replace(/\\/g, "/")
|
|
10794
10944
|
);
|
|
10795
10945
|
const layerConfigFiles = new Set(
|
|
10796
|
-
farmConfig.layers.map((layer) => _optionalChain([layer, 'access',
|
|
10946
|
+
farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _576 => _576.configFile, 'optionalAccess', _577 => _577.replace, 'call', _578 => _578(/\\/g, "/")])).filter((file) => Boolean(file))
|
|
10797
10947
|
);
|
|
10798
10948
|
const routeModuleExtensions = /* @__PURE__ */ new Set([
|
|
10799
10949
|
..._chunkPSV6XKPOcjs.resolveFarmComponentExtensions.call(void 0, farmConfig.renderer.componentExtensions),
|
|
@@ -10856,7 +11006,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10856
11006
|
["add", "change", "unlink"].forEach((ev) => {
|
|
10857
11007
|
server.watcher.on(ev, (file) => {
|
|
10858
11008
|
if (ev === "add") {
|
|
10859
|
-
|
|
11009
|
+
_chunkSHLXACIOcjs.invalidateFailedFarmDevModules.call(void 0, server);
|
|
10860
11010
|
}
|
|
10861
11011
|
const normalizedFile = file.replace(/\\/g, "/");
|
|
10862
11012
|
const configChanged = isFarmConfigFile(file, farmConfig.root) || layerConfigFiles.has(normalizedFile);
|
|
@@ -10872,7 +11022,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10872
11022
|
scheduleTypeArtifactGen(file, ev, typeArtifacts);
|
|
10873
11023
|
}
|
|
10874
11024
|
if (isI18nCatalogFile(file)) {
|
|
10875
|
-
_optionalChain([farmApp, 'optionalAccess',
|
|
11025
|
+
_optionalChain([farmApp, 'optionalAccess', _579 => _579.getI18nRuntime, 'call', _580 => _580(), 'access', _581 => _581.reload, 'call', _582 => _582(), 'access', _583 => _583.then, 'call', _584 => _584(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _585 => _585.catch, 'call', _586 => _586((error) => _chunk5QIKR7RRcjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
|
|
10876
11026
|
}
|
|
10877
11027
|
const isRouteRefreshEvent = (ev !== "change" || isStaticMetadataImageFile2(file)) && (isAppRuntimeFile(file) || isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file)));
|
|
10878
11028
|
if (isRouteRefreshEvent) {
|
|
@@ -10885,15 +11035,15 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10885
11035
|
const reloadsMiddleware = pendingRouteRefreshIncludesMiddleware;
|
|
10886
11036
|
pendingRouteRefreshIncludesMiddleware = false;
|
|
10887
11037
|
Promise.all([
|
|
10888
|
-
_optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
10889
|
-
reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess',
|
|
11038
|
+
_optionalChain([refreshRouteDiscovery, 'optionalCall', _587 => _587(`${ev} ${file}`)]),
|
|
11039
|
+
reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _588 => _588.reload, 'call', _589 => _589()]) : void 0
|
|
10890
11040
|
]).then(() => server.ws.send({ type: "full-reload", path: "*" })).catch((error) => _chunk5QIKR7RRcjs.logger.warn(`Route refresh failed: ${error.message}`));
|
|
10891
11041
|
}, 50);
|
|
10892
11042
|
}
|
|
10893
11043
|
}
|
|
10894
11044
|
});
|
|
10895
11045
|
});
|
|
10896
|
-
const appDirs =
|
|
11046
|
+
const appDirs = _chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, farmConfig);
|
|
10897
11047
|
const routeManager = farmApp.getRouteManager();
|
|
10898
11048
|
const discoveredRoutes = [];
|
|
10899
11049
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
@@ -10920,13 +11070,21 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10920
11070
|
layoutCount: discoveredRoutes.filter((r) => r.kind === "layout").length
|
|
10921
11071
|
});
|
|
10922
11072
|
}
|
|
10923
|
-
apiRouteManager = new (0,
|
|
11073
|
+
apiRouteManager = new (0, _chunkFO427P6Icjs.APIRouteManager)(appDirs, server, {
|
|
10924
11074
|
plugins: farmConfig.plugins,
|
|
10925
11075
|
i18n: farmApp.getI18nRuntime(),
|
|
10926
11076
|
bodySizeLimit: serverConfig.bodySizeLimit,
|
|
10927
|
-
basePath: apiServerBasePath
|
|
11077
|
+
basePath: apiServerBasePath,
|
|
11078
|
+
// A plugin calling an app endpoint (an MCP tool, say) goes back through this server,
|
|
11079
|
+
// so the endpoint's middleware and integration guards run for it, as in production.
|
|
11080
|
+
dispatch: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (request2) => {
|
|
11081
|
+
const url = new URL(request2.url);
|
|
11082
|
+
url.pathname = _chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, url.pathname, farmConfig.basePath);
|
|
11083
|
+
return fetch(new Request(url, request2), { redirect: "manual" });
|
|
11084
|
+
}, "dispatch")
|
|
10928
11085
|
});
|
|
10929
11086
|
await apiRouteManager.discoverRoutes();
|
|
11087
|
+
farmApp.getServerRenderer().setAPIRouteLookup((routePath) => apiRouteManager.getRoutes().has(routePath));
|
|
10930
11088
|
let discoveredWorkflows = [];
|
|
10931
11089
|
const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
|
|
10932
11090
|
(dir) => fs11.existsSync(path21.isAbsolute(dir) ? dir : path21.join(farmConfig.root, dir))
|
|
@@ -10936,14 +11094,14 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10936
11094
|
discoveredWorkflows = await discoverFarmWorkflows(
|
|
10937
11095
|
{ ...farmConfig, workflows: workflowConfig },
|
|
10938
11096
|
{
|
|
10939
|
-
loadModule: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (filePath) =>
|
|
11097
|
+
loadModule: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (filePath) => _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, filePath), "loadModule")
|
|
10940
11098
|
}
|
|
10941
11099
|
);
|
|
10942
11100
|
if (discoveredWorkflows.length > 0) {
|
|
10943
11101
|
workflowHandler = createFarmWorkflowRequestHandler({
|
|
10944
11102
|
workflows: discoveredWorkflows,
|
|
10945
11103
|
config: workflowConfig,
|
|
10946
|
-
loadModule: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (workflow) =>
|
|
11104
|
+
loadModule: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (workflow) => _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, workflow.filePath), "loadModule"),
|
|
10947
11105
|
server: farmConfig.server
|
|
10948
11106
|
});
|
|
10949
11107
|
_chunk5QIKR7RRcjs.logger.success(`\u2705 Discovered ${discoveredWorkflows.length} Farm workflow task(s)`);
|
|
@@ -10958,7 +11116,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10958
11116
|
});
|
|
10959
11117
|
}
|
|
10960
11118
|
}
|
|
10961
|
-
middlewareManager = new (0,
|
|
11119
|
+
middlewareManager = new (0, _chunkZWM5KGAAcjs.MiddlewareManager)(
|
|
10962
11120
|
appDirs,
|
|
10963
11121
|
server,
|
|
10964
11122
|
farmConfig.middleware,
|
|
@@ -10976,11 +11134,11 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10976
11134
|
});
|
|
10977
11135
|
}
|
|
10978
11136
|
}
|
|
10979
|
-
if (_optionalChain([options, 'access',
|
|
11137
|
+
if (_optionalChain([options, 'access', _590 => _590.openapi, 'optionalAccess', _591 => _591.enabled])) {
|
|
10980
11138
|
const { OpenAPIManager } = await loadFarmOpenAPIDevRuntime();
|
|
10981
11139
|
openAPIManager = new OpenAPIManager(appDirs, options.openapi, {
|
|
10982
11140
|
mode: "development",
|
|
10983
|
-
apiBaseURL: typeof _optionalChain([options, 'access',
|
|
11141
|
+
apiBaseURL: typeof _optionalChain([options, 'access', _592 => _592.api, 'optionalAccess', _593 => _593.baseURL]) === "string" ? options.api.baseURL : void 0
|
|
10984
11142
|
});
|
|
10985
11143
|
const spec = await openAPIManager.generateSpec();
|
|
10986
11144
|
reportOpenAPIDevGenerationResult(spec);
|
|
@@ -11020,13 +11178,13 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11020
11178
|
),
|
|
11021
11179
|
loadModule: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (specifier) => {
|
|
11022
11180
|
const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
|
|
11023
|
-
if (specifier === _optionalChain([farmConfig, 'access',
|
|
11181
|
+
if (specifier === _optionalChain([farmConfig, 'access', _594 => _594.docs, 'access', _595 => _595.adapter, 'optionalAccess', _596 => _596.server]) && _optionalChain([resolved, 'optionalAccess', _597 => _597.id])) {
|
|
11024
11182
|
return import(
|
|
11025
11183
|
/* @vite-ignore */
|
|
11026
11184
|
_url.pathToFileURL.call(void 0, resolved.id).href
|
|
11027
11185
|
);
|
|
11028
11186
|
}
|
|
11029
|
-
return
|
|
11187
|
+
return _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _598 => _598.id]), () => ( specifier)));
|
|
11030
11188
|
}, "loadModule"),
|
|
11031
11189
|
registerMCPServer: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (mcpServer) => {
|
|
11032
11190
|
const dispose = _chunk75RZHGLScjs.registerFarmMCPServer.call(void 0, mcpServer);
|
|
@@ -11049,7 +11207,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11049
11207
|
)
|
|
11050
11208
|
}) : null;
|
|
11051
11209
|
const wrapFarmDocsResponseWithLayouts = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (request2, response) => {
|
|
11052
|
-
if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access',
|
|
11210
|
+
if (request2.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _599 => _599.headers, 'access', _600 => _600.get, 'call', _601 => _601("content-type"), 'optionalAccess', _602 => _602.toLowerCase, 'call', _603 => _603(), 'access', _604 => _604.includes, 'call', _605 => _605("text/html")])) {
|
|
11053
11211
|
return response;
|
|
11054
11212
|
}
|
|
11055
11213
|
const pathname = new URL(request2.url).pathname;
|
|
@@ -11070,9 +11228,9 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11070
11228
|
headers: response.headers
|
|
11071
11229
|
});
|
|
11072
11230
|
}
|
|
11073
|
-
const docsRenderer = _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
11231
|
+
const docsRenderer = _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _606 => _606.getConfig, 'call', _607 => _607()]), () => ( options))).renderer);
|
|
11074
11232
|
const [rendererRuntime, layoutModules] = await Promise.all([
|
|
11075
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") :
|
|
11233
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkSHLXACIOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
|
|
11076
11234
|
Promise.all(
|
|
11077
11235
|
layoutEntries.map((layout) => routeManager.loadLayoutModule(layout.modulePath))
|
|
11078
11236
|
)
|
|
@@ -11099,7 +11257,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
11099
11257
|
])
|
|
11100
11258
|
);
|
|
11101
11259
|
const inlineValue = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e"), "inlineValue");
|
|
11102
|
-
const pageModulePath = _optionalChain([matchedRoute, 'access',
|
|
11260
|
+
const pageModulePath = _optionalChain([matchedRoute, 'access', _608 => _608.route, 'optionalAccess', _609 => _609.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
|
|
11103
11261
|
const bootstrapScript = `<script>
|
|
11104
11262
|
window.__FARM_PROPS__ = ${inlineValue({ params })};
|
|
11105
11263
|
window.__FARM_ROUTE_SLOTS__ = [];
|
|
@@ -11194,8 +11352,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11194
11352
|
}, "dispatch")
|
|
11195
11353
|
},
|
|
11196
11354
|
(request2) => {
|
|
11197
|
-
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
11198
|
-
const currentServerConfig =
|
|
11355
|
+
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _610 => _610.getConfig, 'call', _611 => _611()]), () => ( options));
|
|
11356
|
+
const currentServerConfig = _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
|
|
11199
11357
|
return _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, request2, {
|
|
11200
11358
|
trustProxy: currentServerConfig.trustProxy
|
|
11201
11359
|
});
|
|
@@ -11205,8 +11363,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11205
11363
|
withAPIRequestTracing(async (req, res, next) => {
|
|
11206
11364
|
const requestUrl = req.url || "/";
|
|
11207
11365
|
const requestMethod = req.method || "GET";
|
|
11208
|
-
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
11209
|
-
const currentServerConfig =
|
|
11366
|
+
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _612 => _612.getConfig, 'call', _613 => _613()]), () => ( options));
|
|
11367
|
+
const currentServerConfig = _chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
|
|
11210
11368
|
const parsedRequestUrl = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
11211
11369
|
trustProxy: currentServerConfig.trustProxy
|
|
11212
11370
|
});
|
|
@@ -11247,7 +11405,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11247
11405
|
if (referrerUrl.origin === parsedRequestUrl.origin && !referrerUrl.pathname.startsWith(_chunkYJRZR7VUcjs.FARM_DEVTOOLS_PATH)) {
|
|
11248
11406
|
launchUrl = referrerUrl;
|
|
11249
11407
|
}
|
|
11250
|
-
} catch (
|
|
11408
|
+
} catch (e40) {
|
|
11251
11409
|
}
|
|
11252
11410
|
}
|
|
11253
11411
|
launchUrl.searchParams.set(_chunkYJRZR7VUcjs.FARM_DEVTOOLS_LAUNCH_PARAM, "1");
|
|
@@ -11273,7 +11431,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11273
11431
|
openapi: options.openapi
|
|
11274
11432
|
},
|
|
11275
11433
|
workflows: discoveredWorkflows,
|
|
11276
|
-
plugins: _optionalChain([pm, 'optionalAccess',
|
|
11434
|
+
plugins: _optionalChain([pm, 'optionalAccess', _614 => _614.getSortedPlugins, 'call', _615 => _615()])
|
|
11277
11435
|
});
|
|
11278
11436
|
res.statusCode = 200;
|
|
11279
11437
|
res.setHeader(
|
|
@@ -11296,7 +11454,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11296
11454
|
return;
|
|
11297
11455
|
}
|
|
11298
11456
|
const runAppMiddlewareForContentRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
11299
|
-
if (!_optionalChain([middlewareManager, 'optionalAccess',
|
|
11457
|
+
if (!_optionalChain([middlewareManager, 'optionalAccess', _616 => _616.hasMiddleware, 'call', _617 => _617()])) return false;
|
|
11300
11458
|
const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
|
|
11301
11459
|
return runFarmMiddlewareWithNavigation(
|
|
11302
11460
|
farmApp.getServerRenderer(),
|
|
@@ -11307,7 +11465,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11307
11465
|
);
|
|
11308
11466
|
}, "runAppMiddlewareForContentRoute");
|
|
11309
11467
|
const openAPIRequestPathname = openAPIManager ? _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) : requestPathname;
|
|
11310
|
-
if (openAPIManager && _optionalChain([options, 'access',
|
|
11468
|
+
if (openAPIManager && _optionalChain([options, 'access', _618 => _618.openapi, 'optionalAccess', _619 => _619.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
|
|
11311
11469
|
if (await runAppMiddlewareForContentRoute()) return;
|
|
11312
11470
|
if (requestMethod !== "GET" && requestMethod !== "HEAD") {
|
|
11313
11471
|
res.statusCode = 405;
|
|
@@ -11324,35 +11482,43 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11324
11482
|
res.end(requestMethod === "HEAD" ? void 0 : body);
|
|
11325
11483
|
return;
|
|
11326
11484
|
}
|
|
11327
|
-
if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access',
|
|
11485
|
+
if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _620 => _620.openapi, 'optionalAccess', _621 => _621.route])) {
|
|
11328
11486
|
if (await runAppMiddlewareForContentRoute()) return;
|
|
11329
11487
|
const docsHandler = openAPIManager.getDocsRouteHandler(parsedRequestUrl.origin);
|
|
11330
11488
|
return docsHandler(req, res);
|
|
11331
11489
|
}
|
|
11332
|
-
if (_chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)
|
|
11490
|
+
if (_optionalChain([options, 'access', _622 => _622.agent, 'optionalAccess', _623 => _623.manifest]) !== false && _chunkADEA7PN3cjs.isFarmAppManifestPath.call(void 0, _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
|
|
11491
|
+
if (await runAppMiddlewareForContentRoute()) return;
|
|
11333
11492
|
_nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = resolveFarmAppPackages(_nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
|
|
11334
|
-
const
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11493
|
+
const header = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (name) => String(_nullishCoalesce(req.headers[name], () => ( ""))), "header");
|
|
11494
|
+
const manifest = await _chunkADEA7PN3cjs.createFarmAppManifestResponse.call(void 0,
|
|
11495
|
+
new Request(parsedRequestUrl, {
|
|
11496
|
+
method: requestMethod,
|
|
11497
|
+
headers: {
|
|
11498
|
+
"if-none-match": header("if-none-match"),
|
|
11499
|
+
[_chunkADEA7PN3cjs.FARM_INFRA_SIGNATURE_HEADER]: header(_chunkADEA7PN3cjs.FARM_INFRA_SIGNATURE_HEADER)
|
|
11500
|
+
}
|
|
11341
11501
|
}),
|
|
11342
|
-
{
|
|
11502
|
+
{
|
|
11503
|
+
..._chunkADEA7PN3cjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
|
|
11504
|
+
build: "development",
|
|
11505
|
+
packages: farmAppPackages,
|
|
11506
|
+
// Read again on each request; unchanged files come from a cache.
|
|
11507
|
+
webmcpTools: _optionalChain([farmConfig, 'access', _624 => _624.plugins, 'optionalAccess', _625 => _625.some, 'call', _626 => _626(({ name }) => name === "farm:webmcp")]) ? collectFarmWebMCPTools(_nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
|
|
11508
|
+
}),
|
|
11509
|
+
defaultMCP: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => farmApp.getServerRenderer().getDefaultMCPServer(), "defaultMCP")
|
|
11510
|
+
}
|
|
11343
11511
|
);
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
return;
|
|
11347
|
-
}
|
|
11512
|
+
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, manifest);
|
|
11513
|
+
return;
|
|
11348
11514
|
}
|
|
11349
|
-
if (_optionalChain([options, 'access',
|
|
11515
|
+
if (_optionalChain([options, 'access', _627 => _627.agent, 'optionalAccess', _628 => _628.apiCatalog]) && _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkADEA7PN3cjs.FARM_API_CATALOG_PATH) {
|
|
11350
11516
|
if (await runAppMiddlewareForContentRoute()) return;
|
|
11351
11517
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
|
|
11352
11518
|
res,
|
|
11353
|
-
|
|
11519
|
+
_chunkADEA7PN3cjs.createFarmApiCatalogResponse.call(void 0,
|
|
11354
11520
|
requestMethod,
|
|
11355
|
-
|
|
11521
|
+
_chunkADEA7PN3cjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
|
|
11356
11522
|
new Request(parsedRequestUrl, {
|
|
11357
11523
|
headers: { "user-agent": String(_nullishCoalesce(req.headers["user-agent"], () => ( ""))) }
|
|
11358
11524
|
})
|
|
@@ -11360,8 +11526,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11360
11526
|
);
|
|
11361
11527
|
return;
|
|
11362
11528
|
}
|
|
11363
|
-
if (_optionalChain([options, 'access',
|
|
11364
|
-
const aiCatalog =
|
|
11529
|
+
if (_optionalChain([options, 'access', _629 => _629.agent, 'optionalAccess', _630 => _630.aiCatalog]) !== false) {
|
|
11530
|
+
const aiCatalog = _chunkADEA7PN3cjs.createFarmAiCatalogResponse.call(void 0,
|
|
11365
11531
|
new Request(parsedRequestUrl, {
|
|
11366
11532
|
method: requestMethod,
|
|
11367
11533
|
headers: {
|
|
@@ -11369,7 +11535,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11369
11535
|
"if-none-match": String(_nullishCoalesce(req.headers["if-none-match"], () => ( "")))
|
|
11370
11536
|
}
|
|
11371
11537
|
}),
|
|
11372
|
-
{
|
|
11538
|
+
{
|
|
11539
|
+
basePath: farmConfig.basePath,
|
|
11540
|
+
apiServerBasePath,
|
|
11541
|
+
defaultMCP: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => farmApp.getServerRenderer().getDefaultMCPServer(), "defaultMCP")
|
|
11542
|
+
}
|
|
11373
11543
|
);
|
|
11374
11544
|
if (aiCatalog) {
|
|
11375
11545
|
if (await runAppMiddlewareForContentRoute()) return;
|
|
@@ -11394,7 +11564,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11394
11564
|
method: requestMethod,
|
|
11395
11565
|
headers: docsHeaders
|
|
11396
11566
|
});
|
|
11397
|
-
const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body:
|
|
11567
|
+
const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body: _chunkKIIMAWOJcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" };
|
|
11398
11568
|
const docsResponse = await farmDocsHandler(new Request(docsRequest, docsBodyInit));
|
|
11399
11569
|
if (docsResponse) {
|
|
11400
11570
|
if (await runAppMiddlewareForContentRoute()) return;
|
|
@@ -11405,7 +11575,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11405
11575
|
return;
|
|
11406
11576
|
}
|
|
11407
11577
|
}
|
|
11408
|
-
const markdownSourceResponse = viteModuleRequest ? null : await
|
|
11578
|
+
const markdownSourceResponse = viteModuleRequest ? null : await _chunk42NHY7HWcjs.createFarmMarkdownSourceResponse.call(void 0, {
|
|
11409
11579
|
request: new Request(fullUrl, {
|
|
11410
11580
|
method: requestMethod,
|
|
11411
11581
|
headers: docsHeaders
|
|
@@ -11413,7 +11583,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11413
11583
|
config: farmApp.getConfig().mdx,
|
|
11414
11584
|
resolveSource: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (pathname2) => {
|
|
11415
11585
|
const match = farmApp.getRouteManager().matchRoute(pathname2);
|
|
11416
|
-
const sourcePath = _optionalChain([match, 'access',
|
|
11586
|
+
const sourcePath = _optionalChain([match, 'access', _631 => _631.route, 'optionalAccess', _632 => _632.markdownSourcePath]) || (match.route && _chunk42NHY7HWcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
|
|
11417
11587
|
if (!sourcePath) {
|
|
11418
11588
|
return null;
|
|
11419
11589
|
}
|
|
@@ -11426,7 +11596,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11426
11596
|
// middleware see the page's own path, as in production.
|
|
11427
11597
|
renderPage: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (request2) => fetch(request2, {
|
|
11428
11598
|
redirect: "manual",
|
|
11429
|
-
signal: res.destroyed ? AbortSignal.abort() :
|
|
11599
|
+
signal: res.destroyed ? AbortSignal.abort() : _chunkKIIMAWOJcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
11430
11600
|
}), "renderPage")
|
|
11431
11601
|
});
|
|
11432
11602
|
if (markdownSourceResponse) {
|
|
@@ -11447,7 +11617,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11447
11617
|
redirect: "manual",
|
|
11448
11618
|
// Only accepted mirrors need disconnect listeners. An earlier
|
|
11449
11619
|
// close (for example while the docs handler ran) must also abort.
|
|
11450
|
-
signal: res.destroyed ? AbortSignal.abort() :
|
|
11620
|
+
signal: res.destroyed ? AbortSignal.abort() : _chunkKIIMAWOJcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
11451
11621
|
}), "renderPage"),
|
|
11452
11622
|
apiServerBasePath
|
|
11453
11623
|
});
|
|
@@ -11457,7 +11627,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11457
11627
|
return;
|
|
11458
11628
|
}
|
|
11459
11629
|
if (!viteModuleRequest && _chunkEUV4YR3Vcjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
|
|
11460
|
-
const markdownRoute = farmApp.getRouteManager().matchRoute(
|
|
11630
|
+
const markdownRoute = farmApp.getRouteManager().matchRoute(_chunk42NHY7HWcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname));
|
|
11461
11631
|
if (!markdownRoute.route) {
|
|
11462
11632
|
if (await runAppMiddlewareForContentRoute()) return;
|
|
11463
11633
|
res.statusCode = 404;
|
|
@@ -11495,13 +11665,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11495
11665
|
let workflowBody;
|
|
11496
11666
|
try {
|
|
11497
11667
|
if (requestMethod !== "GET" && requestMethod !== "HEAD") {
|
|
11498
|
-
workflowBody = await
|
|
11668
|
+
workflowBody = await _chunkKIIMAWOJcjs.readNodeRequestBody.call(void 0,
|
|
11499
11669
|
req,
|
|
11500
11670
|
currentServerConfig.bodySizeLimit
|
|
11501
11671
|
);
|
|
11502
11672
|
}
|
|
11503
11673
|
} catch (error) {
|
|
11504
|
-
const response =
|
|
11674
|
+
const response = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
11505
11675
|
if (!response) throw error;
|
|
11506
11676
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, response);
|
|
11507
11677
|
return;
|
|
@@ -11511,7 +11681,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11511
11681
|
method: requestMethod,
|
|
11512
11682
|
headers: docsHeaders,
|
|
11513
11683
|
body: toRequestBody(workflowBody),
|
|
11514
|
-
signal:
|
|
11684
|
+
signal: _chunkKIIMAWOJcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
11515
11685
|
})
|
|
11516
11686
|
);
|
|
11517
11687
|
if (workflowResponse) {
|
|
@@ -11521,7 +11691,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11521
11691
|
}
|
|
11522
11692
|
const configuredIntegrations = currentConfig.integrations;
|
|
11523
11693
|
const tryConfiguredIntegrationRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
11524
|
-
const matchedRoute =
|
|
11694
|
+
const matchedRoute = _chunkCBJJH36Acjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
|
|
11525
11695
|
pathname: requestPathname,
|
|
11526
11696
|
method: requestMethod
|
|
11527
11697
|
});
|
|
@@ -11534,8 +11704,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11534
11704
|
await pm.runHookParallelFiltered(
|
|
11535
11705
|
"beforeRequest",
|
|
11536
11706
|
(plugin) => {
|
|
11537
|
-
const owner =
|
|
11538
|
-
return plugin.name !== _chunk27ZWSI3Wcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME && (_optionalChain([owner, 'optionalAccess',
|
|
11707
|
+
const owner = _chunkCBJJH36Acjs.getFarmIntegrationPluginOwner.call(void 0, plugin);
|
|
11708
|
+
return plugin.name !== _chunk27ZWSI3Wcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME && (_optionalChain([owner, 'optionalAccess', _633 => _633.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
|
|
11539
11709
|
},
|
|
11540
11710
|
req,
|
|
11541
11711
|
res
|
|
@@ -11554,16 +11724,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11554
11724
|
}
|
|
11555
11725
|
let body;
|
|
11556
11726
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
11557
|
-
body = await
|
|
11727
|
+
body = await _chunkKIIMAWOJcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
|
|
11558
11728
|
}
|
|
11559
11729
|
const integrationRequest = new Request(fullUrl, {
|
|
11560
11730
|
method: req.method,
|
|
11561
11731
|
headers,
|
|
11562
11732
|
body: toRequestBody(body),
|
|
11563
|
-
signal:
|
|
11733
|
+
signal: _chunkKIIMAWOJcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
11564
11734
|
});
|
|
11565
11735
|
const dispatchIntegration = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (request2) => {
|
|
11566
|
-
const result = await
|
|
11736
|
+
const result = await _chunkCBJJH36Acjs.dispatchIntegrationRequest.call(void 0,
|
|
11567
11737
|
{
|
|
11568
11738
|
integration: matchedRoute.integration,
|
|
11569
11739
|
config: currentConfig,
|
|
@@ -11592,7 +11762,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11592
11762
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, response);
|
|
11593
11763
|
return true;
|
|
11594
11764
|
} catch (error) {
|
|
11595
|
-
const bodyErrorResponse =
|
|
11765
|
+
const bodyErrorResponse = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
11596
11766
|
if (bodyErrorResponse) {
|
|
11597
11767
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
|
|
11598
11768
|
return true;
|
|
@@ -11626,7 +11796,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11626
11796
|
}
|
|
11627
11797
|
const matchedApiRoute = apiRouteManager.matchRoute(requestPathname);
|
|
11628
11798
|
const hasMatchedApiRoute = Boolean(matchedApiRoute);
|
|
11629
|
-
if (hasMatchedApiRoute ||
|
|
11799
|
+
if (hasMatchedApiRoute || _chunkS6VYG6XUcjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath)) {
|
|
11630
11800
|
const startTime2 = Date.now();
|
|
11631
11801
|
const method2 = req.method || "GET";
|
|
11632
11802
|
const urlPath2 = req.url || "/";
|
|
@@ -11665,7 +11835,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11665
11835
|
const apiHandler = apiRouteManager.getHandler({ throwOnError: true });
|
|
11666
11836
|
const hasExplicitAPIRoute = hasMatchedApiRoute || Boolean(apiRouteManager.matchRoute(pathname2));
|
|
11667
11837
|
if (apiHandler && hasExplicitAPIRoute) {
|
|
11668
|
-
const apiRoutePattern = _optionalChain([matchedApiRoute, 'optionalAccess',
|
|
11838
|
+
const apiRoutePattern = _optionalChain([matchedApiRoute, 'optionalAccess', _634 => _634.route, 'access', _635 => _635.path]) || _optionalChain([apiRouteManager, 'access', _636 => _636.matchRoute, 'call', _637 => _637(pathname2), 'optionalAccess', _638 => _638.route, 'access', _639 => _639.path]) || urlPath2;
|
|
11669
11839
|
_chunkE3UK5IIBcjs.emitFarmEvent.call(void 0, {
|
|
11670
11840
|
type: "route.matched",
|
|
11671
11841
|
pathname: pathname2,
|
|
@@ -11687,13 +11857,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11687
11857
|
}
|
|
11688
11858
|
let body;
|
|
11689
11859
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
11690
|
-
body = await
|
|
11860
|
+
body = await _chunkKIIMAWOJcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
|
|
11691
11861
|
}
|
|
11692
11862
|
const request2 = new Request(url, {
|
|
11693
11863
|
method: req.method,
|
|
11694
11864
|
headers,
|
|
11695
11865
|
body: toRequestBody(body),
|
|
11696
|
-
signal:
|
|
11866
|
+
signal: _chunkKIIMAWOJcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
11697
11867
|
});
|
|
11698
11868
|
const apiLifecyclePayload = {
|
|
11699
11869
|
pathname: new URL(url).pathname,
|
|
@@ -11738,7 +11908,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11738
11908
|
durationMs: duration2,
|
|
11739
11909
|
error
|
|
11740
11910
|
});
|
|
11741
|
-
const bodyErrorResponse =
|
|
11911
|
+
const bodyErrorResponse = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
11742
11912
|
if (bodyErrorResponse) {
|
|
11743
11913
|
logResponse(method2, urlPath2, bodyErrorResponse.status, duration2, "API");
|
|
11744
11914
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
|
|
@@ -11755,7 +11925,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11755
11925
|
return;
|
|
11756
11926
|
}
|
|
11757
11927
|
}
|
|
11758
|
-
if (farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess',
|
|
11928
|
+
if (farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _640 => _640.isFarmDocsAPIRequest, 'call', _641 => _641(pathname2)])) {
|
|
11759
11929
|
try {
|
|
11760
11930
|
const url = `http://${req.headers.host || "localhost:3000"}${req.url}`;
|
|
11761
11931
|
const headers = new Headers();
|
|
@@ -11766,13 +11936,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11766
11936
|
}
|
|
11767
11937
|
let body;
|
|
11768
11938
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
11769
|
-
body = await
|
|
11939
|
+
body = await _chunkKIIMAWOJcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
|
|
11770
11940
|
}
|
|
11771
11941
|
const request2 = new Request(url, {
|
|
11772
11942
|
method: req.method,
|
|
11773
11943
|
headers,
|
|
11774
11944
|
body: toRequestBody(body),
|
|
11775
|
-
signal:
|
|
11945
|
+
signal: _chunkKIIMAWOJcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
11776
11946
|
});
|
|
11777
11947
|
const apiLifecyclePayload = {
|
|
11778
11948
|
pathname: pathname2,
|
|
@@ -11805,7 +11975,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11805
11975
|
return;
|
|
11806
11976
|
}
|
|
11807
11977
|
} catch (error) {
|
|
11808
|
-
const bodyErrorResponse =
|
|
11978
|
+
const bodyErrorResponse = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
11809
11979
|
if (bodyErrorResponse) {
|
|
11810
11980
|
await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
|
|
11811
11981
|
return;
|
|
@@ -11828,25 +11998,25 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11828
11998
|
res.end(JSON.stringify({ error: "API route not found", pathname: pathname2 }));
|
|
11829
11999
|
return;
|
|
11830
12000
|
}
|
|
11831
|
-
if (_optionalChain([req, 'access',
|
|
12001
|
+
if (_optionalChain([req, 'access', _642 => _642.url, 'optionalAccess', _643 => _643.startsWith, 'call', _644 => _644("/@")]) || _optionalChain([req, 'access', _645 => _645.url, 'optionalAccess', _646 => _646.startsWith, 'call', _647 => _647("/node_modules")])) {
|
|
11832
12002
|
return next();
|
|
11833
12003
|
}
|
|
11834
12004
|
if (shouldBypassFarmRouterForDottedPath(
|
|
11835
12005
|
requestPathname,
|
|
11836
|
-
_optionalChain([farmApp, 'optionalAccess',
|
|
12006
|
+
_optionalChain([farmApp, 'optionalAccess', _648 => _648.getRouteManager, 'call', _649 => _649()]),
|
|
11837
12007
|
[server.config.publicDir, server.config.root],
|
|
11838
12008
|
farmAgentGeneratedPaths(farmConfig)
|
|
11839
12009
|
)) {
|
|
11840
12010
|
return next();
|
|
11841
12011
|
}
|
|
11842
|
-
if (_optionalChain([req, 'access',
|
|
12012
|
+
if (_optionalChain([req, 'access', _650 => _650.url, 'optionalAccess', _651 => _651.startsWith, 'call', _652 => _652("/__farm/page-data")])) {
|
|
11843
12013
|
const urlObj = parsedRequestUrl;
|
|
11844
12014
|
const targetPath = urlObj.searchParams.get("path") || "/";
|
|
11845
12015
|
try {
|
|
11846
12016
|
const request2 = createRequestFromNodeRequest(
|
|
11847
12017
|
req,
|
|
11848
12018
|
urlObj,
|
|
11849
|
-
|
|
12019
|
+
_chunkKIIMAWOJcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
11850
12020
|
);
|
|
11851
12021
|
const deploymentMismatch = _chunkC5GUTBZKcjs.getFarmDeploymentMismatch.call(void 0,
|
|
11852
12022
|
request2,
|
|
@@ -11867,7 +12037,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11867
12037
|
});
|
|
11868
12038
|
let middlewareMap = /* @__PURE__ */ new Map();
|
|
11869
12039
|
let middlewareContext = /* @__PURE__ */ new Map();
|
|
11870
|
-
if (_optionalChain([middlewareManager, 'optionalAccess',
|
|
12040
|
+
if (_optionalChain([middlewareManager, 'optionalAccess', _653 => _653.hasMiddleware, 'call', _654 => _654()])) {
|
|
11871
12041
|
const targetNodeRequest = createPageDataMiddlewareRequest(req, targetRequestUrl);
|
|
11872
12042
|
const handled = await runFarmMiddlewareWithNavigation(
|
|
11873
12043
|
farmApp.getServerRenderer(),
|
|
@@ -11895,10 +12065,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
11895
12065
|
if (pm) {
|
|
11896
12066
|
await pm.runHookParallel("afterRouteMatch", {
|
|
11897
12067
|
pathname: targetPath,
|
|
11898
|
-
matched: !!_optionalChain([match, 'optionalAccess',
|
|
11899
|
-
routePattern: _optionalChain([match, 'optionalAccess',
|
|
11900
|
-
params: _optionalChain([match, 'optionalAccess',
|
|
11901
|
-
layoutPatterns: (_optionalChain([match, 'optionalAccess',
|
|
12068
|
+
matched: !!_optionalChain([match, 'optionalAccess', _655 => _655.route]),
|
|
12069
|
+
routePattern: _optionalChain([match, 'optionalAccess', _656 => _656.route, 'optionalAccess', _657 => _657.pattern]) || null,
|
|
12070
|
+
params: _optionalChain([match, 'optionalAccess', _658 => _658.params]) || {},
|
|
12071
|
+
layoutPatterns: (_optionalChain([match, 'optionalAccess', _659 => _659.layouts]) || []).map((l) => l.pattern)
|
|
11902
12072
|
});
|
|
11903
12073
|
}
|
|
11904
12074
|
if (!match) {
|
|
@@ -12043,7 +12213,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12043
12213
|
pageShouldHydrate: shouldHydrate,
|
|
12044
12214
|
layoutShouldHydrate: shouldHydrateLayout,
|
|
12045
12215
|
islandStrategy: hydrationIslandStrategy,
|
|
12046
|
-
rendering:
|
|
12216
|
+
rendering: _chunkJNUWCDTFcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
|
|
12047
12217
|
});
|
|
12048
12218
|
const destinationLayoutPatterns = layouts.map((layout) => layout.pattern);
|
|
12049
12219
|
const layoutStartIndex = getSharedLayoutPrefixLength(
|
|
@@ -12057,7 +12227,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12057
12227
|
middlewareContext,
|
|
12058
12228
|
() => renderer.renderNavigationFragment({
|
|
12059
12229
|
PageComponent: routeModule.default,
|
|
12060
|
-
LoadingComponent: _optionalChain([loadingModule, 'optionalAccess',
|
|
12230
|
+
LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _660 => _660.default]),
|
|
12061
12231
|
pageProps: routeProps,
|
|
12062
12232
|
params,
|
|
12063
12233
|
layouts: layouts.map((layout, index) => ({
|
|
@@ -12165,14 +12335,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12165
12335
|
trustProxy: currentServerConfig.trustProxy
|
|
12166
12336
|
}).pathname;
|
|
12167
12337
|
const routeManager2 = farmApp.getRouteManager();
|
|
12168
|
-
const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
12169
|
-
const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
12170
|
-
const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
12171
|
-
const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
12172
|
-
const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
12173
|
-
const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
12174
|
-
const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
12175
|
-
const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
12338
|
+
const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _661 => _661.hasHook, 'call', _662 => _662("beforeRouteMatch")]), () => ( false));
|
|
12339
|
+
const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _663 => _663.hasHook, 'call', _664 => _664("afterRouteMatch")]), () => ( false));
|
|
12340
|
+
const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _665 => _665.hasHook, 'call', _666 => _666("beforeRequest")]), () => ( false));
|
|
12341
|
+
const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _667 => _667.hasHook, 'call', _668 => _668("beforeRender")]), () => ( false));
|
|
12342
|
+
const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _669 => _669.hasHook, 'call', _670 => _670("afterResponse")]), () => ( false));
|
|
12343
|
+
const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _671 => _671.hasHook, 'call', _672 => _672("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _673 => _673.hasHook, 'call', _674 => _674("afterRender")]), () => ( false)));
|
|
12344
|
+
const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _675 => _675.hasRuntimeRequestHooks, 'call', _676 => _676()]), () => ( false));
|
|
12345
|
+
const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _677 => _677.hasRuntimeHook, 'call', _678 => _678("after")]), () => ( false));
|
|
12176
12346
|
const requestedMatch = routeManager2.matchRoute(requestedPathname);
|
|
12177
12347
|
let runtimeSession;
|
|
12178
12348
|
if (pm && hasRuntimeRequestHooks) {
|
|
@@ -12183,8 +12353,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12183
12353
|
kind: "page",
|
|
12184
12354
|
route: {
|
|
12185
12355
|
pathname: requestedPathname,
|
|
12186
|
-
pattern: _optionalChain([requestedMatch, 'optionalAccess',
|
|
12187
|
-
params: _optionalChain([requestedMatch, 'optionalAccess',
|
|
12356
|
+
pattern: _optionalChain([requestedMatch, 'optionalAccess', _679 => _679.route, 'optionalAccess', _680 => _680.pattern]) || null,
|
|
12357
|
+
params: _optionalChain([requestedMatch, 'optionalAccess', _681 => _681.params]) || {}
|
|
12188
12358
|
}
|
|
12189
12359
|
}
|
|
12190
12360
|
);
|
|
@@ -12217,17 +12387,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12217
12387
|
if (pm && hasAfterRouteMatchHook) {
|
|
12218
12388
|
await pm.runHookParallel("afterRouteMatch", {
|
|
12219
12389
|
pathname,
|
|
12220
|
-
matched: !!_optionalChain([routeMatch, 'optionalAccess',
|
|
12221
|
-
routePattern: _optionalChain([routeMatch, 'optionalAccess',
|
|
12222
|
-
params: _optionalChain([routeMatch, 'optionalAccess',
|
|
12223
|
-
layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess',
|
|
12390
|
+
matched: !!_optionalChain([routeMatch, 'optionalAccess', _682 => _682.route]),
|
|
12391
|
+
routePattern: _optionalChain([routeMatch, 'optionalAccess', _683 => _683.route, 'optionalAccess', _684 => _684.pattern]) || null,
|
|
12392
|
+
params: _optionalChain([routeMatch, 'optionalAccess', _685 => _685.params]) || {},
|
|
12393
|
+
layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess', _686 => _686.layouts]) || []).map((l) => l.pattern)
|
|
12224
12394
|
});
|
|
12225
12395
|
}
|
|
12226
12396
|
const renderPayload = {
|
|
12227
12397
|
pathname,
|
|
12228
12398
|
method,
|
|
12229
|
-
routePattern: _optionalChain([routeMatch, 'optionalAccess',
|
|
12230
|
-
params: _optionalChain([routeMatch, 'optionalAccess',
|
|
12399
|
+
routePattern: _optionalChain([routeMatch, 'optionalAccess', _687 => _687.route, 'optionalAccess', _688 => _688.pattern]) || null,
|
|
12400
|
+
params: _optionalChain([routeMatch, 'optionalAccess', _689 => _689.params]) || {}
|
|
12231
12401
|
};
|
|
12232
12402
|
const shouldInterceptResponse = Boolean(
|
|
12233
12403
|
pm && (hasAfterResponseHook || hasHTMLTransformHook || runtimeSession && hasRuntimeAfterHook)
|
|
@@ -12249,7 +12419,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12249
12419
|
emitError: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (error) => emitPluginError("response-end", error, { pathname }), "emitError")
|
|
12250
12420
|
}) : void 0;
|
|
12251
12421
|
try {
|
|
12252
|
-
if (_optionalChain([middlewareManager, 'optionalAccess',
|
|
12422
|
+
if (_optionalChain([middlewareManager, 'optionalAccess', _690 => _690.hasMiddleware, 'call', _691 => _691()])) {
|
|
12253
12423
|
const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
|
|
12254
12424
|
const handled = await runFarmMiddlewareWithNavigation(
|
|
12255
12425
|
farmApp.getServerRenderer(),
|
|
@@ -12259,7 +12429,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12259
12429
|
() => middlewareManager.execute(req, res)
|
|
12260
12430
|
);
|
|
12261
12431
|
if (handled) {
|
|
12262
|
-
if (!_optionalChain([responseInterceptor, 'optionalAccess',
|
|
12432
|
+
if (!_optionalChain([responseInterceptor, 'optionalAccess', _692 => _692.isEnded, 'call', _693 => _693()])) {
|
|
12263
12433
|
const duration = Date.now() - startTime;
|
|
12264
12434
|
logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
|
|
12265
12435
|
}
|
|
@@ -12271,7 +12441,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12271
12441
|
req.url || "/",
|
|
12272
12442
|
`http://${req.headers.host || "localhost:3000"}`
|
|
12273
12443
|
).pathname;
|
|
12274
|
-
const hasLocalPageRoute = Boolean(_optionalChain([routeManager2, 'access',
|
|
12444
|
+
const hasLocalPageRoute = Boolean(_optionalChain([routeManager2, 'access', _694 => _694.matchRoute, 'call', _695 => _695(currentPathname), 'optionalAccess', _696 => _696.route]));
|
|
12275
12445
|
await pm.runHookParallelFiltered(
|
|
12276
12446
|
"beforeRequest",
|
|
12277
12447
|
(plugin) => !hasLocalPageRoute || plugin.name !== _chunk27ZWSI3Wcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
|
|
@@ -12279,8 +12449,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12279
12449
|
res
|
|
12280
12450
|
);
|
|
12281
12451
|
}
|
|
12282
|
-
if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess',
|
|
12283
|
-
if (!_optionalChain([responseInterceptor, 'optionalAccess',
|
|
12452
|
+
if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _697 => _697.isEnded, 'call', _698 => _698()])) {
|
|
12453
|
+
if (!_optionalChain([responseInterceptor, 'optionalAccess', _699 => _699.isEnded, 'call', _700 => _700()])) {
|
|
12284
12454
|
const duration = Date.now() - startTime;
|
|
12285
12455
|
logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
|
|
12286
12456
|
}
|
|
@@ -12338,59 +12508,59 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
12338
12508
|
if (imageModule) return imageModule;
|
|
12339
12509
|
}
|
|
12340
12510
|
if (_chunk6V4TDWECcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
|
|
12341
|
-
const renderer = _optionalChain([farmApp, 'optionalAccess',
|
|
12342
|
-
return generateProgrammaticRouteModule(id, _optionalChain([server, 'optionalAccess',
|
|
12511
|
+
const renderer = _optionalChain([farmApp, 'optionalAccess', _701 => _701.getConfig, 'call', _702 => _702(), 'access', _703 => _703.renderer]) || _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, options.renderer);
|
|
12512
|
+
return generateProgrammaticRouteModule(id, _optionalChain([server, 'optionalAccess', _704 => _704.config, 'access', _705 => _705.root]) || options.root, renderer);
|
|
12343
12513
|
}
|
|
12344
12514
|
if (isFarmClientVirtualId(id)) {
|
|
12345
|
-
const resolvedConfig = _optionalChain([farmApp, 'optionalAccess',
|
|
12346
|
-
const renderer = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
12347
|
-
const integrations = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
12348
|
-
const root = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
12349
|
-
const docs = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
12515
|
+
const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _706 => _706.getConfig, 'call', _707 => _707()]);
|
|
12516
|
+
const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _708 => _708.renderer]) || _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, options.renderer);
|
|
12517
|
+
const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _709 => _709.integrations]) || options.integrations;
|
|
12518
|
+
const root = _optionalChain([resolvedConfig, 'optionalAccess', _710 => _710.root]) || _optionalChain([server, 'optionalAccess', _711 => _711.config, 'access', _712 => _712.root]) || process.cwd();
|
|
12519
|
+
const docs = _optionalChain([resolvedConfig, 'optionalAccess', _713 => _713.docs]);
|
|
12350
12520
|
const adapterOwnsDocsRuntime = Boolean(
|
|
12351
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess',
|
|
12521
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _714 => _714.adapter, 'optionalAccess', _715 => _715.server]) && docs.adapter.react
|
|
12352
12522
|
);
|
|
12353
|
-
const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess',
|
|
12523
|
+
const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _716 => _716.devtools]), () => ( _chunkYJRZR7VUcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
|
|
12354
12524
|
const [docsRuntime, docsSearchRuntime, devtoolsClientRuntime] = await Promise.all([
|
|
12355
|
-
_optionalChain([docs, 'optionalAccess',
|
|
12356
|
-
_optionalChain([docs, 'optionalAccess',
|
|
12525
|
+
_optionalChain([docs, 'optionalAccess', _717 => _717.enabled]) ? loadFarmDocsDevRuntime() : null,
|
|
12526
|
+
_optionalChain([docs, 'optionalAccess', _718 => _718.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
|
|
12357
12527
|
devtools.enabled ? loadFarmDevtoolsClientRuntime() : null
|
|
12358
12528
|
]);
|
|
12359
|
-
const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess',
|
|
12529
|
+
const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _719 => _719.isFarmDocsSearchEnabled, 'call', _720 => _720(docs)]), () => ( false));
|
|
12360
12530
|
const generatedDocsSearchRuntime = docsSearchRuntime ? docsSearchRuntime.generateFarmDocsSearchClientRuntime(
|
|
12361
12531
|
docsSearchEnabled,
|
|
12362
12532
|
docsSearchEnabled ? docsSearchRuntime.resolveFarmDocsSearchClientModule(root) : void 0
|
|
12363
12533
|
) : EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME;
|
|
12364
12534
|
const generatedDevtoolsClientRuntime = devtoolsClientRuntime ? devtoolsClientRuntime.generateFarmDevtoolsClientRuntime(devtools) : "";
|
|
12365
12535
|
const generatedDevIndicatorsClientRuntime = farmApp ? _chunk6MVFL3R5cjs.generateFarmDevIndicatorsClientRuntime.call(void 0, farmApp.getConfig().devIndicators) : "";
|
|
12366
|
-
const integrationProviders = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ?
|
|
12536
|
+
const integrationProviders = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _chunkCBJJH36Acjs.getIntegrationProviders.call(void 0, integrations) : [];
|
|
12367
12537
|
const isolatedHydrationMode = resolveFarmIsolatedClientHydrationMode(
|
|
12368
|
-
_optionalChain([resolvedConfig, 'optionalAccess',
|
|
12538
|
+
_optionalChain([resolvedConfig, 'optionalAccess', _721 => _721.experimental, 'optionalAccess', _722 => _722.isolatedClientHydration]),
|
|
12369
12539
|
{
|
|
12370
|
-
serverComponents: _optionalChain([resolvedConfig, 'optionalAccess',
|
|
12540
|
+
serverComponents: _optionalChain([resolvedConfig, 'optionalAccess', _723 => _723.experimental, 'optionalAccess', _724 => _724.serverComponents]) === true,
|
|
12371
12541
|
hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
|
|
12372
12542
|
}
|
|
12373
12543
|
);
|
|
12374
12544
|
return generateClientCode(
|
|
12375
12545
|
integrationProviders,
|
|
12376
12546
|
[
|
|
12377
|
-
...
|
|
12378
|
-
..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess',
|
|
12547
|
+
..._chunkCBJJH36Acjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
|
|
12548
|
+
..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _725 => _725.getFarmDocsDocumentNavigationMatchers, 'call', _726 => _726(docs)]), () => ( []))
|
|
12379
12549
|
],
|
|
12380
12550
|
generatedDocsSearchRuntime,
|
|
12381
12551
|
`${generatedDevtoolsClientRuntime}
|
|
12382
12552
|
${generatedDevIndicatorsClientRuntime}`,
|
|
12383
|
-
_optionalChain([resolvedConfig, 'optionalAccess',
|
|
12553
|
+
_optionalChain([resolvedConfig, 'optionalAccess', _727 => _727.plugins]) || [],
|
|
12384
12554
|
root,
|
|
12385
|
-
_optionalChain([resolvedConfig, 'optionalAccess',
|
|
12386
|
-
_optionalChain([resolvedConfig, 'optionalAccess',
|
|
12387
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess',
|
|
12555
|
+
_optionalChain([resolvedConfig, 'optionalAccess', _728 => _728.srcDir]) || options.srcDir || "src",
|
|
12556
|
+
_optionalChain([resolvedConfig, 'optionalAccess', _729 => _729.publicRuntimeConfig]) || options.publicRuntimeConfig,
|
|
12557
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _730 => _730.adapter, 'optionalAccess', _731 => _731.react]) : void 0,
|
|
12388
12558
|
renderer,
|
|
12389
|
-
isolatedHydrationMode === "enabled" || _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess',
|
|
12390
|
-
_nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess',
|
|
12391
|
-
_nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess',
|
|
12559
|
+
isolatedHydrationMode === "enabled" || _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _732 => _732.getRouteManager, 'call', _733 => _733(), 'access', _734 => _734.getIsolatedClientBoundaryModules, 'call', _735 => _735(root)])))), 'optionalAccess', _736 => _736.size]) > 0,
|
|
12560
|
+
_nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _737 => _737.trailingSlash]), () => ( false)),
|
|
12561
|
+
_nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _738 => _738.basePath]), () => ( "/")),
|
|
12392
12562
|
generateClientCachePersistenceCode(
|
|
12393
|
-
resolveFarmClientCacheAdapterEntry(root, _optionalChain([resolvedConfig, 'optionalAccess',
|
|
12563
|
+
resolveFarmClientCacheAdapterEntry(root, _optionalChain([resolvedConfig, 'optionalAccess', _739 => _739.cache]))
|
|
12394
12564
|
),
|
|
12395
12565
|
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0
|
|
12396
12566
|
);
|
|
@@ -12399,7 +12569,7 @@ ${generatedDevIndicatorsClientRuntime}`,
|
|
|
12399
12569
|
return generateServerCode();
|
|
12400
12570
|
}
|
|
12401
12571
|
if (id === "/@farm/manifest") {
|
|
12402
|
-
const routeManager = _optionalChain([farmApp, 'optionalAccess',
|
|
12572
|
+
const routeManager = _optionalChain([farmApp, 'optionalAccess', _740 => _740.getRouteManager, 'call', _741 => _741()]);
|
|
12403
12573
|
if (!routeManager) {
|
|
12404
12574
|
return `
|
|
12405
12575
|
export const getManifest = () => ({
|
|
@@ -12414,7 +12584,7 @@ export const getManifest = () => ({
|
|
|
12414
12584
|
const manifest = routeManager.generateClientManifest(server.config.root);
|
|
12415
12585
|
const globalStylesheetHref = resolveDevGlobalStylesheetHref(
|
|
12416
12586
|
server.config.root,
|
|
12417
|
-
_optionalChain([farmApp, 'optionalAccess',
|
|
12587
|
+
_optionalChain([farmApp, 'optionalAccess', _742 => _742.getConfig, 'call', _743 => _743(), 'access', _744 => _744.srcDir])
|
|
12418
12588
|
);
|
|
12419
12589
|
const fullManifest = {
|
|
12420
12590
|
clientEntry: "/@farm/client.js",
|
|
@@ -12440,11 +12610,11 @@ export const getManifest = () => ({
|
|
|
12440
12610
|
};
|
|
12441
12611
|
}
|
|
12442
12612
|
for (const layout of manifest.layouts) {
|
|
12443
|
-
const groupScope =
|
|
12613
|
+
const groupScope = _chunkADEA7PN3cjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
12444
12614
|
fullManifest.layouts[layout.pattern] = {
|
|
12445
12615
|
modulePath: layout.modulePath,
|
|
12446
12616
|
pattern: layout.pattern,
|
|
12447
|
-
...groupScope ? { urlPattern:
|
|
12617
|
+
...groupScope ? { urlPattern: _chunkADEA7PN3cjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
|
|
12448
12618
|
shouldHydrate: layout.shouldHydrate,
|
|
12449
12619
|
islandStrategy: layout.islandStrategy,
|
|
12450
12620
|
preloads: [layout.modulePath],
|
|
@@ -12468,24 +12638,24 @@ export const manifest = getManifest();
|
|
|
12468
12638
|
}
|
|
12469
12639
|
},
|
|
12470
12640
|
async transform(code, id, transformOptions) {
|
|
12471
|
-
if (!_optionalChain([transformOptions, 'optionalAccess',
|
|
12472
|
-
const docsConfigModule = _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess',
|
|
12641
|
+
if (!_optionalChain([transformOptions, 'optionalAccess', _745 => _745.ssr])) {
|
|
12642
|
+
const docsConfigModule = _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _746 => _746.getConfig, 'call', _747 => _747(), 'optionalAccess', _748 => _748.docs]));
|
|
12473
12643
|
if (isFarmDocsClientConfigModule(id, docsConfigModule)) {
|
|
12474
12644
|
const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
|
|
12475
12645
|
if (redacted !== null) return { code: redacted, map: null };
|
|
12476
12646
|
}
|
|
12477
12647
|
}
|
|
12478
|
-
if (!_optionalChain([transformOptions, 'optionalAccess',
|
|
12479
|
-
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
12480
|
-
if (_optionalChain([currentConfig, 'access',
|
|
12648
|
+
if (!_optionalChain([transformOptions, 'optionalAccess', _749 => _749.ssr])) {
|
|
12649
|
+
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _750 => _750.getConfig, 'call', _751 => _751()]), () => ( options));
|
|
12650
|
+
if (_optionalChain([currentConfig, 'access', _752 => _752.experimental, 'optionalAccess', _753 => _753.serverActions]) !== true || !serverFnTransformActive) {
|
|
12481
12651
|
const violation = findClientServerFnViolation(code, id);
|
|
12482
12652
|
if (violation) {
|
|
12483
12653
|
this.error(formatServerFnBoundaryError(violation, id));
|
|
12484
12654
|
}
|
|
12485
12655
|
}
|
|
12486
12656
|
}
|
|
12487
|
-
if (!_optionalChain([transformOptions, 'optionalAccess',
|
|
12488
|
-
warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
12657
|
+
if (!_optionalChain([transformOptions, 'optionalAccess', _754 => _754.ssr]) && shouldInspectClientBoundary(id, code)) {
|
|
12658
|
+
warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _755 => _755.getConfig, 'call', _756 => _756()]), () => ( options)));
|
|
12489
12659
|
}
|
|
12490
12660
|
if (typeof imageImports.transform === "function") {
|
|
12491
12661
|
const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
|
|
@@ -12500,13 +12670,13 @@ export const manifest = getManifest();
|
|
|
12500
12670
|
id,
|
|
12501
12671
|
transformOptions
|
|
12502
12672
|
);
|
|
12503
|
-
const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess',
|
|
12673
|
+
const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _757 => _757.code, 'optionalAccess', _758 => _758.toString, 'call', _759 => _759()]);
|
|
12504
12674
|
if (fontCode) {
|
|
12505
12675
|
transformedCode = fontCode;
|
|
12506
12676
|
transformed = true;
|
|
12507
12677
|
}
|
|
12508
12678
|
}
|
|
12509
|
-
if (_optionalChain([transformOptions, 'optionalAccess',
|
|
12679
|
+
if (_optionalChain([transformOptions, 'optionalAccess', _760 => _760.ssr]) && server) {
|
|
12510
12680
|
const rewrittenImports = rewriteEarlySsrRelativeImports({
|
|
12511
12681
|
code: transformedCode,
|
|
12512
12682
|
id,
|
|
@@ -12526,12 +12696,12 @@ export const manifest = getManifest();
|
|
|
12526
12696
|
}
|
|
12527
12697
|
transformedCode = stripUseClientDirective(transformedCode);
|
|
12528
12698
|
transformed = true;
|
|
12529
|
-
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
12699
|
+
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _761 => _761.getConfig, 'call', _762 => _762()]), () => ( options));
|
|
12530
12700
|
let isolatedModuleReference = null;
|
|
12531
|
-
const root = currentConfig.root || _optionalChain([server, 'optionalAccess',
|
|
12701
|
+
const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _763 => _763.config, 'access', _764 => _764.root]) || process.cwd();
|
|
12532
12702
|
const cleanId = id.split("?", 1)[0];
|
|
12533
|
-
const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess',
|
|
12534
|
-
const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess',
|
|
12703
|
+
const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _765 => _765.getRouteManager, 'call', _766 => _766(), 'access', _767 => _767.getIsolatedClientBoundaryModules, 'call', _768 => _768(root)])));
|
|
12704
|
+
const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _769 => _769.has, 'call', _770 => _770(path21.resolve(cleanId))]) === true;
|
|
12535
12705
|
if (_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _chunkPSV6XKPOcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
|
|
12536
12706
|
isolatedModuleReference = _chunk5QIKR7RRcjs.toViteModuleId.call(void 0, cleanId, root);
|
|
12537
12707
|
const transformedBoundary = transformIsolatedClientBoundaryModule({
|
|
@@ -12568,7 +12738,7 @@ export const manifest = getManifest();
|
|
|
12568
12738
|
);
|
|
12569
12739
|
return;
|
|
12570
12740
|
}` : "";
|
|
12571
|
-
const hmrCode = _optionalChain([transformOptions, 'optionalAccess',
|
|
12741
|
+
const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _771 => _771.ssr]) || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
|
|
12572
12742
|
if (import.meta.hot) {
|
|
12573
12743
|
import.meta.hot.accept((newModule) => {
|
|
12574
12744
|
${isolatedHmrUpdate}
|
|
@@ -12623,14 +12793,14 @@ if (import.meta.hot) {
|
|
|
12623
12793
|
}
|
|
12624
12794
|
_chunk5QIKR7RRcjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
|
|
12625
12795
|
_chunk5QIKR7RRcjs.logger.info("Pre-rendering SSG pages...");
|
|
12626
|
-
const outDir = path21.join(_optionalChain([server, 'optionalAccess',
|
|
12796
|
+
const outDir = path21.join(_optionalChain([server, 'optionalAccess', _772 => _772.config, 'access', _773 => _773.root]) || process.cwd(), options.outDir || "dist");
|
|
12627
12797
|
const clientDir = path21.join(outDir, "client");
|
|
12628
12798
|
for (const page of ssgPages) {
|
|
12629
12799
|
try {
|
|
12630
12800
|
const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
|
|
12631
12801
|
await farmApp.getServerRenderer().runWithRequestContext(staticRequest, async () => {
|
|
12632
12802
|
const mod = await routeManager.loadRouteModule(page.filePath);
|
|
12633
|
-
if (!_optionalChain([mod, 'optionalAccess',
|
|
12803
|
+
if (!_optionalChain([mod, 'optionalAccess', _774 => _774.default])) return;
|
|
12634
12804
|
const { layouts } = routeManager.matchRoute(page.urlPath);
|
|
12635
12805
|
const layoutModules = await Promise.all(
|
|
12636
12806
|
layouts.map((l) => routeManager.loadLayoutModule(l.modulePath))
|
|
@@ -12662,7 +12832,7 @@ if (import.meta.hot) {
|
|
|
12662
12832
|
const i18nSnapshot = _chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
12663
12833
|
const i18nHead = renderFarmI18nStaticHead(page.urlPath, i18nSnapshot);
|
|
12664
12834
|
const fullHtml = `<!DOCTYPE html>
|
|
12665
|
-
<html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
12835
|
+
<html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _775 => _775.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
|
|
12666
12836
|
<head>
|
|
12667
12837
|
<meta charset="utf-8">
|
|
12668
12838
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
@@ -12720,23 +12890,23 @@ if (import.meta.hot) {
|
|
|
12720
12890
|
});
|
|
12721
12891
|
}
|
|
12722
12892
|
}
|
|
12723
|
-
const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess',
|
|
12893
|
+
const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _776 => _776.getConfig, 'call', _777 => _777()]);
|
|
12724
12894
|
const normalizedFile = file.replace(/\\/g, "/");
|
|
12725
|
-
if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) &&
|
|
12895
|
+
if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && _chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, currentFarmConfig).some(
|
|
12726
12896
|
(appDir) => normalizedFile.startsWith(`${_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appDir)}/api/`)
|
|
12727
12897
|
)) {
|
|
12728
12898
|
for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
|
|
12729
|
-
await _optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
12899
|
+
await _optionalChain([refreshRouteDiscovery, 'optionalCall', _778 => _778(`updated ${file}`)]);
|
|
12730
12900
|
server2.ws.send({ type: "full-reload", path: "*" });
|
|
12731
12901
|
return [];
|
|
12732
12902
|
}
|
|
12733
|
-
const currentSrcRoot = currentFarmConfig ?
|
|
12903
|
+
const currentSrcRoot = currentFarmConfig ? _chunkWBKEZXWEcjs.getFarmSourceRoots.call(void 0, currentFarmConfig).map((source) => path21.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
|
|
12734
12904
|
if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && _chunk6V4TDWECcjs.isProgrammaticRoutesFileName.call(void 0, normalizedFile)) {
|
|
12735
12905
|
logUpdate("PAGE", `updated ${path21.basename(file)}`);
|
|
12736
12906
|
for (const mod of modules) {
|
|
12737
12907
|
server2.moduleGraph.invalidateModule(mod);
|
|
12738
12908
|
}
|
|
12739
|
-
await _optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
12909
|
+
await _optionalChain([refreshRouteDiscovery, 'optionalCall', _779 => _779(`updated ${file}`)]);
|
|
12740
12910
|
server2.ws.send({
|
|
12741
12911
|
type: "full-reload",
|
|
12742
12912
|
path: "*"
|
|
@@ -12749,17 +12919,20 @@ if (import.meta.hot) {
|
|
|
12749
12919
|
for (const mod of modules) {
|
|
12750
12920
|
server2.moduleGraph.invalidateModule(mod);
|
|
12751
12921
|
}
|
|
12752
|
-
await _optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
12922
|
+
await _optionalChain([refreshRouteDiscovery, 'optionalCall', _780 => _780(`updated ${file}`)]);
|
|
12753
12923
|
server2.ws.send({
|
|
12754
12924
|
type: "full-reload",
|
|
12755
12925
|
path: "*"
|
|
12756
12926
|
});
|
|
12757
12927
|
return [];
|
|
12758
12928
|
}
|
|
12759
|
-
|
|
12760
|
-
|
|
12929
|
+
if (apiRouteManager && _chunkSHLXACIOcjs.invalidateFarmDevDependents.call(void 0, server2, file, apiRouteManager.getSourceFiles()).length > 0) {
|
|
12930
|
+
await _optionalChain([refreshRouteDiscovery, 'optionalCall', _781 => _781(`updated ${file}`)]);
|
|
12931
|
+
}
|
|
12932
|
+
const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _782 => _782.experimental, 'optionalAccess', _783 => _783.isolatedClientHydration]);
|
|
12933
|
+
const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _784 => _784.getRouteManager, 'call', _785 => _785()]);
|
|
12761
12934
|
const isHydrationPlanSource = currentSrcRoot !== null && normalizedFile.startsWith(`${currentSrcRoot}/`) && /\.[cm]?[jt]sx?$/.test(normalizedFile);
|
|
12762
|
-
const tracksAsyncOwnerIslands = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess',
|
|
12935
|
+
const tracksAsyncOwnerIslands = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _786 => _786.renderer])) && planRouteManager !== void 0;
|
|
12763
12936
|
if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
|
|
12764
12937
|
const routeManager = planRouteManager;
|
|
12765
12938
|
if (routeManager) {
|
|
@@ -12819,7 +12992,7 @@ if (import.meta.hot) {
|
|
|
12819
12992
|
}
|
|
12820
12993
|
return [];
|
|
12821
12994
|
}
|
|
12822
|
-
_optionalChain([farmApp, 'optionalAccess',
|
|
12995
|
+
_optionalChain([farmApp, 'optionalAccess', _787 => _787.getRouteManager, 'call', _788 => _788(), 'access', _789 => _789.invalidateClientManifest, 'call', _790 => _790()]);
|
|
12823
12996
|
const manifestModule = server2.moduleGraph.getModuleById("/@farm/manifest");
|
|
12824
12997
|
if (manifestModule) {
|
|
12825
12998
|
server2.moduleGraph.invalidateModule(manifestModule);
|
|
@@ -12868,7 +13041,7 @@ function resolveDevelopmentRoot(farmRoot, viteRoot) {
|
|
|
12868
13041
|
if (fs11.realpathSync(farmRoot) === fs11.realpathSync(viteRoot)) {
|
|
12869
13042
|
return path21.resolve(viteRoot);
|
|
12870
13043
|
}
|
|
12871
|
-
} catch (
|
|
13044
|
+
} catch (e41) {
|
|
12872
13045
|
}
|
|
12873
13046
|
return farmRoot;
|
|
12874
13047
|
}
|
|
@@ -13188,12 +13361,12 @@ async function parseRouteModuleProps2(routeModule, input) {
|
|
|
13188
13361
|
}
|
|
13189
13362
|
const schemas = routeModule.__farmRouteSchemas;
|
|
13190
13363
|
const params = parseRouteModuleSchema2(
|
|
13191
|
-
_optionalChain([schemas, 'optionalAccess',
|
|
13364
|
+
_optionalChain([schemas, 'optionalAccess', _791 => _791.params]),
|
|
13192
13365
|
input.props.params,
|
|
13193
13366
|
"params",
|
|
13194
13367
|
input.routePath
|
|
13195
13368
|
);
|
|
13196
|
-
const search = parseRouteModuleSchema2(_optionalChain([schemas, 'optionalAccess',
|
|
13369
|
+
const search = parseRouteModuleSchema2(_optionalChain([schemas, 'optionalAccess', _792 => _792.search]), input.search, "search", input.routePath);
|
|
13197
13370
|
return {
|
|
13198
13371
|
...input.props,
|
|
13199
13372
|
params,
|
|
@@ -14854,8 +15027,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateClientManifest, "generateClientMan
|
|
|
14854
15027
|
async function defineConfig(config = {}) {
|
|
14855
15028
|
const tailwindVitePlugin = await loadTailwindVitePlugin();
|
|
14856
15029
|
const appRoot = path21.resolve(config.root || process.cwd());
|
|
14857
|
-
if (_optionalChain([config, 'access',
|
|
14858
|
-
const { config: layeredConfig } = await import("./layers-
|
|
15030
|
+
if (_optionalChain([config, 'access', _793 => _793.extends, 'optionalAccess', _794 => _794.length])) {
|
|
15031
|
+
const { config: layeredConfig } = await import("./layers-VUWIOFEO.cjs").then(
|
|
14859
15032
|
({ resolveFarmLayers }) => resolveFarmLayers(config, {
|
|
14860
15033
|
root: appRoot,
|
|
14861
15034
|
mode: process.env.NODE_ENV === "production" ? "production" : "development"
|
|
@@ -14955,13 +15128,13 @@ async function defineConfig(config = {}) {
|
|
|
14955
15128
|
if (!serverStarted) {
|
|
14956
15129
|
serverStarted = true;
|
|
14957
15130
|
const elapsed = Date.now() - startTime;
|
|
14958
|
-
const address = _optionalChain([server, 'access',
|
|
15131
|
+
const address = _optionalChain([server, 'access', _795 => _795.httpServer, 'optionalAccess', _796 => _796.address, 'call', _797 => _797()]);
|
|
14959
15132
|
const resolvedPort = typeof address === "object" && address ? address.port : server.config.server.port || port || 3e3;
|
|
14960
15133
|
const hostConfig = server.config.server.host;
|
|
14961
15134
|
const isExposed = hostConfig === true || hostConfig === "0.0.0.0";
|
|
14962
15135
|
console.log("");
|
|
14963
15136
|
console.log(
|
|
14964
|
-
` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${
|
|
15137
|
+
` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkDZ5ZVB2Kcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
|
|
14965
15138
|
);
|
|
14966
15139
|
console.log("");
|
|
14967
15140
|
console.log(
|
|
@@ -15009,7 +15182,7 @@ async function defineConfig(config = {}) {
|
|
|
15009
15182
|
...createFarmClientOptimizeDepsConfig(
|
|
15010
15183
|
createFarmClientOptimizeDepsEntries(
|
|
15011
15184
|
appRoot,
|
|
15012
|
-
|
|
15185
|
+
_chunkWBKEZXWEcjs.getFarmAppDirectories.call(void 0, { ...config, root: appRoot })
|
|
15013
15186
|
),
|
|
15014
15187
|
config.renderer
|
|
15015
15188
|
),
|
|
@@ -15049,7 +15222,7 @@ async function defineConfig(config = {}) {
|
|
|
15049
15222
|
dedupe: [...config.renderer.dedupe || []],
|
|
15050
15223
|
// Stub out problematic server-only modules during dev mode
|
|
15051
15224
|
alias: {
|
|
15052
|
-
...
|
|
15225
|
+
..._chunkWBKEZXWEcjs.getFarmLayerAliases.call(void 0, config.layers),
|
|
15053
15226
|
...createFarmSourceAlias(appRoot, config.srcDir),
|
|
15054
15227
|
// Nitro internals that should not be resolved in browser
|
|
15055
15228
|
"supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
|