@farm.js/core 0.1.71 → 0.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-mcp-handler-KE4J3W7S.cjs +1 -1
- package/dist/agent-mcp-handler-VIT4GOSR.mjs +1 -1
- package/dist/{agent-mcp.d-BzNw6JI8.d.ts → agent-mcp.d-BO3rZXEM.d.ts} +2 -2
- package/dist/{agent-mcp.d-CgFen3EH.d.mts → agent-mcp.d-Cwff7lcA.d.mts} +2 -2
- package/dist/agent-runtime.d.mts +3 -3
- package/dist/agent-runtime.d.ts +3 -3
- package/dist/{analyzer-VK3BAOFI.mjs → analyzer-5Q75LTIL.mjs} +2 -2
- package/dist/analyzer-UJG4MIZW.cjs +16 -0
- package/dist/api/node.d.mts +5 -5
- package/dist/api/node.d.ts +5 -5
- package/dist/api/route-manager.cjs +7 -6
- package/dist/api/route-manager.d.mts +7 -7
- package/dist/api/route-manager.d.ts +7 -7
- package/dist/api/route-manager.mjs +6 -5
- package/dist/api/runtime.d.mts +4 -4
- package/dist/api/runtime.d.ts +4 -4
- package/dist/api.cjs +8 -7
- package/dist/api.d.mts +8 -8
- package/dist/api.d.ts +8 -8
- package/dist/api.mjs +7 -6
- package/dist/{app-manifest.d-DY4JfJxi.d.ts → app-manifest.d-DwjGkYlP.d.ts} +1 -1
- package/dist/{app-manifest.d-DpDK_B1k.d.mts → app-manifest.d-USD_IbFd.d.mts} +1 -1
- package/dist/app-markdown.d.mts +4 -4
- package/dist/app-markdown.d.ts +4 -4
- package/dist/{app.d-BeK6bb1c.d.ts → app.d-DAmF2MAk.d.ts} +48 -6
- package/dist/{app.d-D-5UNrFd.d.mts → app.d-fW06_h8h.d.mts} +48 -6
- package/dist/{chunk-7A3URI2F.mjs → chunk-2EVESLP3.mjs} +8 -1
- package/dist/{chunk-X7LGLF33.mjs → chunk-3JN5M3T5.mjs} +259 -61
- package/dist/{chunk-KEB7AGS6.cjs → chunk-3WG7GJQL.cjs} +7 -2
- package/dist/{chunk-K66JILV3.cjs → chunk-5LOARKDP.cjs} +2 -2
- package/dist/{chunk-UISZLYKY.cjs → chunk-5R4Q5FN7.cjs} +2 -2
- package/dist/{chunk-3BQ7QHUH.cjs → chunk-5X6OHJEE.cjs} +15 -3
- package/dist/{chunk-GUU3IZSM.mjs → chunk-5XFKWHZD.mjs} +234 -47
- package/dist/{chunk-MITIAOUQ.mjs → chunk-645ENY7W.mjs} +2 -2
- package/dist/{chunk-RJUCNO7R.mjs → chunk-77VNYVVX.mjs} +1 -1
- package/dist/{chunk-PLXD2MJV.cjs → chunk-7QCJDYZQ.cjs} +2 -2
- package/dist/{chunk-V25GSH43.mjs → chunk-AUAMXI6N.mjs} +1 -1
- package/dist/{chunk-2IFT2CSA.cjs → chunk-BE7AQXJB.cjs} +346 -148
- package/dist/{chunk-7BUE2GM6.mjs → chunk-BSXKZPFE.mjs} +70 -19
- package/dist/{chunk-2MR4MABG.cjs → chunk-C5AM2XDN.cjs} +54 -4
- package/dist/{chunk-KWST2O22.cjs → chunk-CBLRSZQL.cjs} +488 -301
- package/dist/{chunk-BBPDJGCU.cjs → chunk-CYOTNHDF.cjs} +2 -2
- package/dist/{chunk-W2T6NDNP.mjs → chunk-DGNMXL2O.mjs} +1 -1
- package/dist/{chunk-QUFENL7Q.mjs → chunk-DS7JGFW5.mjs} +13 -1
- package/dist/{chunk-IGXS54GC.mjs → chunk-E2V7RRFL.mjs} +1 -1
- package/dist/{chunk-CSQPMV3Q.cjs → chunk-E3LE6EZH.cjs} +4 -4
- package/dist/{chunk-JVA4PIYN.cjs → chunk-ET6WW3FY.cjs} +338 -171
- package/dist/{chunk-VXB5CMNC.cjs → chunk-EXN4DTVF.cjs} +2 -2
- package/dist/{chunk-SXMWVP2L.cjs → chunk-FSSONJRV.cjs} +4 -4
- package/dist/{chunk-Y2SZVIVH.cjs → chunk-GPICBTDV.cjs} +8 -1
- package/dist/{chunk-7OHJWFLB.cjs → chunk-HLMUWKAP.cjs} +333 -282
- package/dist/{chunk-ZPUAOKHV.cjs → chunk-IWCYRDRQ.cjs} +3 -3
- package/dist/{chunk-2AM26UGI.cjs → chunk-NLBK37HI.cjs} +5 -4
- package/dist/{chunk-NA77GEIU.mjs → chunk-NV26EGMC.mjs} +51 -1
- package/dist/{chunk-DPYBVVL3.cjs → chunk-OSEQL34Q.cjs} +2 -2
- package/dist/{chunk-IYDJNCR7.mjs → chunk-OSMUE5ST.mjs} +7 -2
- package/dist/{chunk-UQUOSNRN.mjs → chunk-QUYAGU65.mjs} +214 -47
- package/dist/{chunk-DPIGYXSV.mjs → chunk-RFWWXEIF.mjs} +1 -1
- package/dist/{chunk-E77IA5IF.mjs → chunk-RLFGKJQ6.mjs} +1 -1
- package/dist/{chunk-3AUINHFG.mjs → chunk-TNYC3TYP.mjs} +3 -2
- package/dist/{chunk-4OD2LXF2.mjs → chunk-VAWDGGW3.mjs} +1 -1
- package/dist/{chunk-MU5V7XHL.mjs → chunk-VJSXPN3W.mjs} +3 -0
- package/dist/{chunk-DU4VHHPJ.mjs → chunk-VO55MMBX.mjs} +1 -1
- package/dist/{chunk-LDVJIBGN.mjs → chunk-VT25ERQK.mjs} +1 -1
- package/dist/{chunk-2CQC5CMD.mjs → chunk-WIJF3PBM.mjs} +1 -1
- package/dist/{chunk-FILXOEWD.cjs → chunk-YXIQYWOK.cjs} +2 -2
- package/dist/{chunk-THG2TVDH.mjs → chunk-YZLEOMMA.mjs} +3 -3
- package/dist/{chunk-MEJCP2LX.cjs → chunk-ZDZUFD67.cjs} +1 -1
- package/dist/{chunk-Q5HMVGR5.cjs → chunk-ZFEJ2SF2.cjs} +13 -13
- package/dist/{chunk-LNVGXUL3.cjs → chunk-ZMSVKVI3.cjs} +3 -0
- package/dist/{client-component.d-fYupugbZ.d.ts → client-component.d-9J7CkTWW.d.ts} +2 -2
- package/dist/{client-component.d-DwpH251K.d.mts → client-component.d-ciHeCxr-.d.mts} +2 -2
- package/dist/{client-plugins.d-BxqFfHpM.d.ts → client-plugins.d-CUOhfapO.d.ts} +4 -3
- package/dist/{client-plugins.d-k3bOT5gz.d.mts → client-plugins.d-JnRz5a1o.d.mts} +4 -3
- package/dist/client-plugins.d.mts +3 -3
- package/dist/client-plugins.d.ts +3 -3
- package/dist/client.cjs +1 -1
- package/dist/client.d.mts +8 -8
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +1 -1
- package/dist/config.d.mts +3 -3
- package/dist/config.d.ts +3 -3
- package/dist/desktop.d.mts +4 -4
- package/dist/desktop.d.ts +4 -4
- package/dist/{devtools-6MXPFPNJ.mjs → devtools-7JPQMSTQ.mjs} +3 -3
- package/dist/{devtools-O5625KCK.cjs → devtools-IZFUYWPG.cjs} +4 -4
- package/dist/docs.cjs +5 -5
- package/dist/docs.d.mts +4 -4
- package/dist/docs.d.ts +4 -4
- package/dist/docs.mjs +4 -4
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{headers.d-DalIGbVO.d.ts → headers.d-CqpTL_fZ.d.ts} +2 -2
- package/dist/{headers.d-sNT7ZQiU.d.mts → headers.d-rbbTKGaN.d.mts} +2 -2
- package/dist/i18n/client.cjs +3 -2
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/client.mjs +2 -1
- package/dist/i18n/index.cjs +3 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.mjs +2 -1
- package/dist/i18n/server.cjs +6 -5
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- package/dist/i18n/server.mjs +5 -4
- package/dist/index.cjs +22 -22
- package/dist/{index.d-BcA-secm.d.ts → index.d-CMKvzHLW.d.ts} +1 -1
- package/dist/{index.d-DDHHAv7j.d.mts → index.d-D_B2D9Il.d.mts} +1 -1
- package/dist/index.d.mts +23 -23
- package/dist/index.d.ts +23 -23
- package/dist/index.mjs +21 -21
- package/dist/integrations/orm.d.mts +3 -3
- package/dist/integrations/orm.d.ts +3 -3
- package/dist/integrations.d.mts +3 -3
- package/dist/integrations.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +4 -4
- package/dist/internal/app-markdown-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.cjs +21 -21
- package/dist/internal/build-runtime.d.mts +5 -5
- package/dist/internal/build-runtime.d.ts +5 -5
- package/dist/internal/build-runtime.mjs +20 -20
- package/dist/internal/cli-runtime.cjs +6 -6
- package/dist/internal/cli-runtime.mjs +5 -5
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.d.mts +6 -6
- package/dist/internal/client-runtime.d.ts +6 -6
- package/dist/internal/client-runtime.mjs +3 -3
- package/dist/internal/compression-runtime.d.mts +3 -3
- package/dist/internal/compression-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.cjs +5 -5
- package/dist/internal/config-runtime.d.mts +6 -6
- package/dist/internal/config-runtime.d.ts +6 -6
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/infra-analytics-runtime.cjs +7 -7
- package/dist/internal/infra-analytics-runtime.mjs +5 -5
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +13 -13
- package/dist/internal/production-runtime.d.mts +36 -24
- package/dist/internal/production-runtime.d.ts +36 -24
- package/dist/internal/production-runtime.mjs +12 -12
- package/dist/internal/vercel-edge-middleware.d.mts +2 -2
- package/dist/internal/vercel-edge-middleware.d.ts +2 -2
- package/dist/markdown.d.mts +3 -3
- package/dist/markdown.d.ts +3 -3
- package/dist/middleware.cjs +3 -3
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/middleware.mjs +2 -2
- package/dist/mobile.d.mts +3 -3
- package/dist/mobile.d.ts +3 -3
- package/dist/{mount.d-D3JOux2V.d.ts → mount.d-B0XMxDRh.d.ts} +1 -1
- package/dist/{mount.d-C1PONsEe.d.mts → mount.d-ImEO7q8a.d.mts} +1 -1
- package/dist/{navigation-delegate.d-CJQQHboA.d.mts → navigation-delegate.d-83Q7ksf7.d.mts} +1 -1
- package/dist/{navigation-delegate.d-CQQPbdkE.d.ts → navigation-delegate.d-RRx1CSlb.d.ts} +1 -1
- package/dist/navigation.d.mts +6 -6
- package/dist/navigation.d.ts +6 -6
- package/dist/plugin.cjs +15 -15
- package/dist/plugin.d.mts +6 -6
- package/dist/plugin.d.ts +6 -6
- package/dist/plugin.mjs +14 -14
- package/dist/{production-runtime.d-B0IeWWyO.d.mts → production-runtime.d-Bcu37SCo.d.mts} +1 -1
- package/dist/{production-runtime.d-q3aHIv5Y.d.ts → production-runtime.d-qPj3XRET.d.ts} +1 -1
- package/dist/{render-plan.d-DHuJMJRP.d.ts → render-plan.d-Ds2sXJ5m.d.ts} +1 -1
- package/dist/{render-plan.d-CiUj0rq5.d.mts → render-plan.d-wP8nTeRV.d.mts} +1 -1
- package/dist/renderer-client.cjs +3 -2
- package/dist/renderer-client.d.mts +6 -6
- package/dist/renderer-client.d.ts +6 -6
- package/dist/renderer-client.mjs +2 -1
- package/dist/{request.d-D-F7o7tb.d.mts → request.d-F3h7K37m.d.mts} +1 -1
- package/dist/{request.d-DRUbOmYD.d.ts → request.d-zpSn6pu_.d.ts} +1 -1
- package/dist/request.d.mts +4 -4
- package/dist/request.d.ts +4 -4
- package/dist/{resolver.d-9iKC79CU.d.mts → resolver.d-DJgzbdsp.d.mts} +1 -1
- package/dist/{resolver.d-CY6mEa_F.d.ts → resolver.d-yaHcGCCG.d.ts} +1 -1
- package/dist/{route-rendering.d-KwqM_mlK.d.ts → route-rendering.d-BL0_AdKj.d.ts} +1 -1
- package/dist/{route-rendering.d-6smgwT2t.d.mts → route-rendering.d-Mw0ZKG2e.d.mts} +1 -1
- package/dist/{router.d-B6sesMRD.d.ts → router.d-BwXigemZ.d.ts} +1 -1
- package/dist/{router.d-BYmDeDlp.d.mts → router.d-NGVsU11T.d.mts} +1 -1
- package/dist/{routes.d-D3aJw1H5.d.mts → routes.d-CCccJRrp.d.mts} +1 -1
- package/dist/{routes.d-K-Qg79AA.d.ts → routes.d-b7khoRoU.d.ts} +1 -1
- package/dist/routes.d.mts +3 -3
- package/dist/routes.d.ts +3 -3
- package/dist/{routing.d-DwSUVZbF.d.mts → routing.d-BhPgtN_S.d.ts} +2 -1
- package/dist/{routing.d-BxOZ2YWc.d.ts → routing.d-D67HQmnv.d.mts} +2 -1
- package/dist/{rsc-pipeline-P4PCWDO2.cjs → rsc-pipeline-BNXYMG4G.cjs} +5 -5
- package/dist/{rsc-pipeline-R2GOKIMU.mjs → rsc-pipeline-DHYZLWSF.mjs} +4 -4
- package/dist/{runtime-WA2Q4SLG.cjs → runtime-IWOT6ZVC.cjs} +6 -6
- package/dist/{runtime-DP5DYGW5.mjs → runtime-XPYKUNL3.mjs} +4 -4
- package/dist/{runtime.d-BFSJf-ww.d.mts → runtime.d-BA3MzhXz.d.mts} +1 -1
- package/dist/{runtime.d-nUz0HAL4.d.mts → runtime.d-CTAXWZby.d.mts} +2 -2
- package/dist/{runtime.d-CbdMI0Oy.d.ts → runtime.d-OBIZWpx1.d.ts} +1 -1
- package/dist/{runtime.d-B_uPfMjA.d.ts → runtime.d-PUA5qBnd.d.ts} +2 -2
- package/dist/server-plugins.d.mts +5 -5
- package/dist/server-plugins.d.ts +5 -5
- package/dist/server.cjs +33 -33
- package/dist/server.d.mts +14 -14
- package/dist/server.d.ts +14 -14
- package/dist/server.mjs +17 -17
- package/dist/{spa-router.d-D4EDwR20.d.mts → spa-router.d-BG2XzE5p.d.mts} +3 -3
- package/dist/{spa-router.d-mC1D5cTN.d.ts → spa-router.d-DrYT944-.d.ts} +3 -3
- package/dist/testing.cjs +6 -5
- package/dist/testing.d.mts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.mjs +6 -5
- package/dist/{types.d-wVRlLtBf.d.ts → types.d-euATAbE4.d.mts} +4 -0
- package/dist/{types.d-wVRlLtBf.d.mts → types.d-euATAbE4.d.ts} +4 -0
- package/dist/{utils.d-DxMzteqE.d.mts → utils.d-C1k9BJeD.d.mts} +1 -1
- package/dist/{utils.d-A2X3a6z_.d.ts → utils.d-DcF4wxey.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +15 -15
- package/dist/vite.d.mts +7 -7
- package/dist/vite.d.ts +7 -7
- package/dist/vite.mjs +14 -14
- package/package.json +1 -1
- package/dist/analyzer-LPIVRSTJ.cjs +0 -16
|
@@ -9,7 +9,7 @@ var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkE3LE6EZHcjs = require('./chunk-E3LE6EZH.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunkAXVRUDMBcjs = require('./chunk-AXVRUDMB.cjs');
|
|
@@ -39,10 +39,12 @@ var _chunkAXVRUDMBcjs = require('./chunk-AXVRUDMB.cjs');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var _chunk2MR4MABGcjs = require('./chunk-2MR4MABG.cjs');
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
var
|
|
44
|
+
var _chunkC5AM2XDNcjs = require('./chunk-C5AM2XDN.cjs');
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var _chunkFSSONJRVcjs = require('./chunk-FSSONJRV.cjs');
|
|
46
48
|
|
|
47
49
|
|
|
48
50
|
|
|
@@ -76,7 +78,12 @@ var _chunkXGJVRPYLcjs = require('./chunk-XGJVRPYL.cjs');
|
|
|
76
78
|
|
|
77
79
|
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
var _chunkBE7AQXJBcjs = require('./chunk-BE7AQXJB.cjs');
|
|
80
87
|
|
|
81
88
|
|
|
82
89
|
var _chunk7KJJ4SBScjs = require('./chunk-7KJJ4SBS.cjs');
|
|
@@ -208,7 +215,7 @@ var _chunkQEJWNXRIcjs = require('./chunk-QEJWNXRI.cjs');
|
|
|
208
215
|
|
|
209
216
|
|
|
210
217
|
|
|
211
|
-
var
|
|
218
|
+
var _chunkNLBK37HIcjs = require('./chunk-NLBK37HI.cjs');
|
|
212
219
|
|
|
213
220
|
|
|
214
221
|
|
|
@@ -243,7 +250,7 @@ var _chunkSNP33A33cjs = require('./chunk-SNP33A33.cjs');
|
|
|
243
250
|
var _chunkJYNNIGQOcjs = require('./chunk-JYNNIGQO.cjs');
|
|
244
251
|
|
|
245
252
|
|
|
246
|
-
var
|
|
253
|
+
var _chunkZMSVKVI3cjs = require('./chunk-ZMSVKVI3.cjs');
|
|
247
254
|
|
|
248
255
|
|
|
249
256
|
|
|
@@ -278,18 +285,14 @@ var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
|
|
|
278
285
|
var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
|
|
279
286
|
|
|
280
287
|
|
|
281
|
-
var
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
|
|
288
|
+
var _chunkZDZUFD67cjs = require('./chunk-ZDZUFD67.cjs');
|
|
286
289
|
|
|
287
290
|
|
|
288
291
|
var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
|
|
289
292
|
|
|
290
293
|
|
|
291
294
|
|
|
292
|
-
var
|
|
295
|
+
var _chunkGPICBTDVcjs = require('./chunk-GPICBTDV.cjs');
|
|
293
296
|
|
|
294
297
|
|
|
295
298
|
var _chunkRWR7SMD7cjs = require('./chunk-RWR7SMD7.cjs');
|
|
@@ -315,6 +318,10 @@ var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
|
|
|
315
318
|
var _chunkNLBHLPEOcjs = require('./chunk-NLBHLPEO.cjs');
|
|
316
319
|
|
|
317
320
|
|
|
321
|
+
|
|
322
|
+
var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
|
|
323
|
+
|
|
324
|
+
|
|
318
325
|
var _chunkDXUXQP2Tcjs = require('./chunk-DXUXQP2T.cjs');
|
|
319
326
|
|
|
320
327
|
|
|
@@ -445,6 +452,8 @@ function getRouteSpecificity(entry) {
|
|
|
445
452
|
function compareRouteEntries(left, right) {
|
|
446
453
|
return _chunkYTVSWXEZcjs.compareRouteSpecificity.call(void 0, getRouteSpecificity(left), getRouteSpecificity(right));
|
|
447
454
|
}
|
|
455
|
+
var PLAN_SOURCE = /\.(?:[cm]?[jt]sx?|vue|svelte)$/;
|
|
456
|
+
var NODE_MODULES_SEGMENT = `${path3.default.sep}node_modules${path3.default.sep}`;
|
|
448
457
|
var RouteManager = class _RouteManager {
|
|
449
458
|
constructor(config, viteServer) {
|
|
450
459
|
this.routes = /* @__PURE__ */ new Map();
|
|
@@ -460,9 +469,17 @@ var RouteManager = class _RouteManager {
|
|
|
460
469
|
this.redirects = /* @__PURE__ */ new Map();
|
|
461
470
|
this.programmaticPages = /* @__PURE__ */ new Map();
|
|
462
471
|
this.programmaticLayouts = /* @__PURE__ */ new Map();
|
|
463
|
-
this.programmaticClientRoutes =
|
|
472
|
+
this.programmaticClientRoutes = _chunkBE7AQXJBcjs.mergeProgrammaticClientRoutes.call(void 0, []);
|
|
464
473
|
this.discovery = Promise.resolve();
|
|
465
474
|
this.reportedIslandsErrors = /* @__PURE__ */ new Set();
|
|
475
|
+
// Each route module's hydration plan from the last plan, with the source files it read, so a dev
|
|
476
|
+
// replan recomputes only the modules that read an edited file. Every replan used to read and
|
|
477
|
+
// walk every route's import graph again, seconds on a large app, before an edit could update.
|
|
478
|
+
this.ownerPlans = /* @__PURE__ */ new Map();
|
|
479
|
+
this.sourceChangeTracking = false;
|
|
480
|
+
this.linkedSources = /* @__PURE__ */ new Map();
|
|
481
|
+
// Source files edited since the last plan; null when the next plan must recompute every module.
|
|
482
|
+
this.editedSources = null;
|
|
466
483
|
this.config = config;
|
|
467
484
|
this.viteServer = viteServer;
|
|
468
485
|
if (viteServer) _chunkE7QOEV5Zcjs.trackProgrammaticRouteSources.call(void 0, );
|
|
@@ -509,7 +526,7 @@ var RouteManager = class _RouteManager {
|
|
|
509
526
|
await this.discoverFileRoutes(source);
|
|
510
527
|
await this.discoverProgrammaticRoutes(source, programmaticClientRoutes);
|
|
511
528
|
}
|
|
512
|
-
this.programmaticClientRoutes =
|
|
529
|
+
this.programmaticClientRoutes = _chunkBE7AQXJBcjs.mergeProgrammaticClientRoutes.call(void 0, programmaticClientRoutes);
|
|
513
530
|
for (const slot of this.routeSlots.values()) {
|
|
514
531
|
if (slot.interception && !this.pageRouteShapes.has(_chunkYTVSWXEZcjs.getRoutePatternShape.call(void 0, slot.pattern))) {
|
|
515
532
|
throw new (0, _chunkYTVSWXEZcjs.AmbiguousRouteError)(
|
|
@@ -528,8 +545,8 @@ var RouteManager = class _RouteManager {
|
|
|
528
545
|
)
|
|
529
546
|
);
|
|
530
547
|
this.orderedLayouts = Array.from(this.layouts.values()).sort(
|
|
531
|
-
(left, right) =>
|
|
532
|
-
).map((entry) => ({ entry, groupScope:
|
|
548
|
+
(left, right) => _chunkC5AM2XDNcjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkC5AM2XDNcjs.getRouteDirectoryDepth.call(void 0, right.pattern)
|
|
549
|
+
).map((entry) => ({ entry, groupScope: _chunkC5AM2XDNcjs.getRouteGroupScope.call(void 0, entry.pattern) }));
|
|
533
550
|
for (const slot of this.routeSlots.values()) {
|
|
534
551
|
if (!this.routeSlotOwnerSegments.has(slot.ownerPattern)) {
|
|
535
552
|
this.routeSlotOwnerSegments.set(
|
|
@@ -778,10 +795,88 @@ var RouteManager = class _RouteManager {
|
|
|
778
795
|
return this.clientManifestCache.manifest;
|
|
779
796
|
}
|
|
780
797
|
const cacheFile = this.packageClientBoundaryCacheFile;
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
)
|
|
798
|
+
const compute = () => _chunkBE7AQXJBcjs.withFarmSourceSnapshot.call(void 0,
|
|
799
|
+
() => this.computeClientManifest(normalizedProjectRoot),
|
|
800
|
+
this.sourceSnapshot
|
|
801
|
+
);
|
|
802
|
+
return cacheFile ? _chunkBE7AQXJBcjs.runWithPackageClientBoundaryCacheFile.call(void 0, cacheFile, compute) : compute();
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* @internal The dev server reports every watched change (`noteSourceChange`), so a replan can
|
|
806
|
+
* reuse the plan of each route module that read none of the edited files. Without tracking,
|
|
807
|
+
* every plan recomputes every module.
|
|
808
|
+
*/
|
|
809
|
+
trackSourceChanges() {
|
|
810
|
+
this.sourceChangeTracking = true;
|
|
811
|
+
_nullishCoalesce(this.sourceSnapshot, () => ( (this.sourceSnapshot = new (0, _chunkBE7AQXJBcjs.FarmSourceSnapshotStore)())));
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* @internal A watched file changed. An edit to a script narrows the next replan to the route
|
|
815
|
+
* modules that read it; a script added or removed (where an import may now resolve), or a
|
|
816
|
+
* changed JSON file (a package manifest or tsconfig paths), replans everything. Other files
|
|
817
|
+
* (stylesheets, Markdown, assets) are not read by plans.
|
|
818
|
+
*/
|
|
819
|
+
noteSourceChange(file, event) {
|
|
820
|
+
if (file.endsWith(".d.ts")) return;
|
|
821
|
+
if (PLAN_SOURCE.test(file)) {
|
|
822
|
+
if (event === "update") {
|
|
823
|
+
_optionalChain([this, 'access', _6 => _6.editedSources, 'optionalAccess', _7 => _7.add, 'call', _8 => _8(path3.default.resolve(file))]);
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
} else if (!/\.jsonc?$/.test(file)) {
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
this.editedSources = null;
|
|
830
|
+
_optionalChain([this, 'access', _9 => _9.sourceSnapshot, 'optionalAccess', _10 => _10.clear, 'call', _11 => _11()]);
|
|
831
|
+
this.linkedSources.clear();
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* @internal Whether an edit to `file` leaves the current plan as it is: a client module the
|
|
835
|
+
* last plan read whose directive, island and hydrate exports, export shape and imports the edit
|
|
836
|
+
* kept. The next replan reads it again (the watcher reported it).
|
|
837
|
+
*/
|
|
838
|
+
isEditPlanNeutral(file) {
|
|
839
|
+
if (!this.sourceChangeTracking || !this.editedSources || !this.clientManifestCache) {
|
|
840
|
+
return false;
|
|
841
|
+
}
|
|
842
|
+
const previous = _optionalChain([this, 'access', _12 => _12.sourceSnapshot, 'optionalAccess', _13 => _13.peekSource, 'call', _14 => _14(path3.default.resolve(file))]);
|
|
843
|
+
return previous !== void 0 && _chunkBE7AQXJBcjs.isFarmClientModulePlanUnchanged.call(void 0, file, previous);
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* A route module's plan: the last one when it read none of `edited`, recomputed otherwise.
|
|
847
|
+
* Callers get a copy, since the route budget rewrites a plan's fields in place.
|
|
848
|
+
*/
|
|
849
|
+
planRouteModule(key, edited, compute) {
|
|
850
|
+
const previous = this.ownerPlans.get(key);
|
|
851
|
+
if (previous && edited && ![...edited].some((file) => previous.files.has(file))) {
|
|
852
|
+
return { ...previous.plan };
|
|
853
|
+
}
|
|
854
|
+
const { result, files } = _chunkBE7AQXJBcjs.traceFarmSourceReads.call(void 0, compute);
|
|
855
|
+
const sources = /* @__PURE__ */ new Set();
|
|
856
|
+
for (const file of files) {
|
|
857
|
+
const source = this.planSourcePath(file);
|
|
858
|
+
if (source) sources.add(source);
|
|
859
|
+
}
|
|
860
|
+
this.ownerPlans.set(key, { plan: result, files: sources });
|
|
861
|
+
return { ...result };
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* The path the watcher reports for a file a plan read: itself, or the real path of a workspace
|
|
865
|
+
* package's source read through its `node_modules` link. Null for an installed package's file.
|
|
866
|
+
*/
|
|
867
|
+
planSourcePath(file) {
|
|
868
|
+
if (!file.includes(NODE_MODULES_SEGMENT)) return file;
|
|
869
|
+
let source = this.linkedSources.get(file);
|
|
870
|
+
if (source === void 0) {
|
|
871
|
+
try {
|
|
872
|
+
const real = _fs.realpathSync.call(void 0, file);
|
|
873
|
+
source = real.includes(NODE_MODULES_SEGMENT) ? null : real;
|
|
874
|
+
} catch (e) {
|
|
875
|
+
source = null;
|
|
876
|
+
}
|
|
877
|
+
this.linkedSources.set(file, source);
|
|
878
|
+
}
|
|
879
|
+
return source;
|
|
785
880
|
}
|
|
786
881
|
/**
|
|
787
882
|
* @internal Keep package client-boundary inspections in `file` between plans, as the dev server
|
|
@@ -790,6 +885,15 @@ var RouteManager = class _RouteManager {
|
|
|
790
885
|
usePackageClientBoundaryCacheFile(file) {
|
|
791
886
|
this.packageClientBoundaryCacheFile = file;
|
|
792
887
|
}
|
|
888
|
+
/**
|
|
889
|
+
* @internal Run `operation` (synchronous) with the package inspections of the latest plan, as
|
|
890
|
+
* the dev server's transforms and renders inspect the packages a module imports. Without a cache
|
|
891
|
+
* file (outside the dev server), it runs as it is.
|
|
892
|
+
*/
|
|
893
|
+
inspectPackages(operation) {
|
|
894
|
+
const file = this.packageClientBoundaryCacheFile;
|
|
895
|
+
return file ? _chunkBE7AQXJBcjs.runWithLatestPackageClientBoundaryCache.call(void 0, file, operation) : operation();
|
|
896
|
+
}
|
|
793
897
|
computeClientManifest(normalizedProjectRoot) {
|
|
794
898
|
const toUrlPath = (absolutePath) => {
|
|
795
899
|
const rootRelative = _chunkQMNWKQL4cjs.toRootRelativeUrlPath.call(void 0, absolutePath, normalizedProjectRoot);
|
|
@@ -806,44 +910,67 @@ var RouteManager = class _RouteManager {
|
|
|
806
910
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
807
911
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
808
912
|
);
|
|
809
|
-
if (_optionalChain([this, 'access',
|
|
913
|
+
if (_optionalChain([this, 'access', _15 => _15.config, 'access', _16 => _16.experimental, 'optionalAccess', _17 => _17.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _18 => _18.config, 'access', _19 => _19.experimental, 'optionalAccess', _20 => _20.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
810
914
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
811
915
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
812
916
|
);
|
|
813
917
|
}
|
|
814
|
-
const isolatedMode =
|
|
815
|
-
_optionalChain([this, 'access',
|
|
918
|
+
const isolatedMode = _chunkBE7AQXJBcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
919
|
+
_optionalChain([this, 'access', _21 => _21.config, 'access', _22 => _22.experimental, 'optionalAccess', _23 => _23.isolatedClientHydration]),
|
|
816
920
|
{
|
|
817
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
921
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _24 => _24.config, 'access', _25 => _25.experimental, 'optionalAccess', _26 => _26.serverComponents])) === "rsc",
|
|
818
922
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
819
923
|
}
|
|
820
924
|
);
|
|
821
|
-
const planOptions =
|
|
925
|
+
const planOptions = _chunkBE7AQXJBcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
822
926
|
this.config.renderer,
|
|
823
927
|
Boolean(unsupportedIntegrationProvider)
|
|
824
928
|
);
|
|
825
|
-
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
929
|
+
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _27 => _27.config, 'access', _28 => _28.experimental, 'optionalAccess', _29 => _29.serverComponents])) === "islands";
|
|
930
|
+
const changed = _optionalChain([this, 'access', _30 => _30.sourceSnapshot, 'optionalAccess', _31 => _31.refresh, 'call', _32 => _32(_nullishCoalesce(this.editedSources, () => ( [])))]);
|
|
931
|
+
let edited = null;
|
|
932
|
+
if (this.sourceChangeTracking && this.editedSources && this.ownerPlans.size > 0) {
|
|
933
|
+
edited = /* @__PURE__ */ new Set();
|
|
934
|
+
for (const [file, previous] of _nullishCoalesce(changed, () => ( []))) {
|
|
935
|
+
if (_chunkBE7AQXJBcjs.isFarmClientModulePlanUnchanged.call(void 0, file, previous)) continue;
|
|
936
|
+
const source = this.planSourcePath(file);
|
|
937
|
+
if (source) edited.add(source);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
if (!edited) this.ownerPlans.clear();
|
|
826
941
|
const layoutEntries = Array.from(this.layouts.values()).map((entry) => ({
|
|
827
942
|
entry,
|
|
828
|
-
metadata:
|
|
829
|
-
entry.modulePath
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
943
|
+
metadata: this.planRouteModule(
|
|
944
|
+
`layout:${entry.modulePath}`,
|
|
945
|
+
edited,
|
|
946
|
+
() => _chunkBE7AQXJBcjs.getClientModuleHydrationPlan.call(void 0,
|
|
947
|
+
entry.modulePath,
|
|
948
|
+
normalizedProjectRoot,
|
|
949
|
+
isolatedMode,
|
|
950
|
+
islandsMode ? { ...planOptions, serverTreeLayouts: true } : planOptions
|
|
951
|
+
)
|
|
833
952
|
)
|
|
834
953
|
}));
|
|
835
|
-
const
|
|
954
|
+
const markdownComponentsPlan = _chunkBE7AQXJBcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
836
955
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, this.config.mdx), normalizedProjectRoot),
|
|
837
956
|
normalizedProjectRoot,
|
|
838
957
|
isolatedMode,
|
|
839
958
|
{ ...planOptions, packageReferences: islandsMode }
|
|
840
959
|
);
|
|
960
|
+
let markdownPlan;
|
|
961
|
+
const markdownPagePlan = () => ({
|
|
962
|
+
..._nullishCoalesce(markdownPlan, () => ( (markdownPlan = this.planRouteModule("markdown", edited, markdownComponentsPlan))))
|
|
963
|
+
});
|
|
841
964
|
const routeEntries = Array.from(this.routes.values()).map((entry) => ({
|
|
842
965
|
entry,
|
|
843
|
-
metadata: _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() :
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
966
|
+
metadata: _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : this.planRouteModule(
|
|
967
|
+
`page:${entry.modulePath}`,
|
|
968
|
+
edited,
|
|
969
|
+
() => _chunkBE7AQXJBcjs.getClientModuleHydrationPlan.call(void 0, entry.modulePath, normalizedProjectRoot, isolatedMode, {
|
|
970
|
+
...planOptions,
|
|
971
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _33 => _33.config, 'access', _34 => _34.experimental, 'optionalAccess', _35 => _35.serverComponents])) === "islands"
|
|
972
|
+
})
|
|
973
|
+
)
|
|
847
974
|
}));
|
|
848
975
|
const markdownFallback = routeEntries.find(
|
|
849
976
|
({ entry, metadata }) => _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
|
|
@@ -853,9 +980,9 @@ var RouteManager = class _RouteManager {
|
|
|
853
980
|
`[Farm.js] client components in Markdown pages stay static: ${markdownFallback.metadata.fallbackReason}.`
|
|
854
981
|
);
|
|
855
982
|
}
|
|
856
|
-
const markdownStaticPackages = _optionalChain([routeEntries, 'access',
|
|
983
|
+
const markdownStaticPackages = _optionalChain([routeEntries, 'access', _36 => _36.find, 'call', _37 => _37(
|
|
857
984
|
({ entry, metadata }) => _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
|
|
858
|
-
), 'optionalAccess',
|
|
985
|
+
), 'optionalAccess', _38 => _38.metadata, 'access', _39 => _39.staticPackageBoundaries]);
|
|
859
986
|
if (markdownStaticPackages) {
|
|
860
987
|
_chunkQMNWKQL4cjs.logger.info(
|
|
861
988
|
`[Farm.js] Markdown pages render client components from ${markdownStaticPackages.join(", ")} as static HTML: package client components cannot be isolated yet.`
|
|
@@ -867,18 +994,18 @@ var RouteManager = class _RouteManager {
|
|
|
867
994
|
`[Farm.js] ${entry.pattern} renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
|
|
868
995
|
);
|
|
869
996
|
}
|
|
870
|
-
|
|
997
|
+
_chunkBE7AQXJBcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
871
998
|
layoutEntries.map(({ entry, metadata }) => ({
|
|
872
999
|
pattern: entry.pattern,
|
|
873
|
-
depth:
|
|
1000
|
+
depth: _chunkC5AM2XDNcjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
|
|
874
1001
|
metadata
|
|
875
1002
|
})),
|
|
876
1003
|
routeEntries.map(({ entry, metadata }) => ({
|
|
877
1004
|
pattern: getRouteEntryDirectory(entry),
|
|
878
|
-
depth:
|
|
1005
|
+
depth: _chunkC5AM2XDNcjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
|
|
879
1006
|
metadata
|
|
880
1007
|
})),
|
|
881
|
-
|
|
1008
|
+
_chunkC5AM2XDNcjs.routeBoundaryCoversDirectory,
|
|
882
1009
|
{ serverOwners: islandsMode }
|
|
883
1010
|
);
|
|
884
1011
|
for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
|
|
@@ -898,7 +1025,7 @@ var RouteManager = class _RouteManager {
|
|
|
898
1025
|
const routes = routeEntries.map(({ entry, metadata }) => {
|
|
899
1026
|
const programmaticPage = this.programmaticPages.get(entry.modulePath);
|
|
900
1027
|
const layoutShouldHydrate = layoutEntries.some(
|
|
901
|
-
({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate &&
|
|
1028
|
+
({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkC5AM2XDNcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
|
|
902
1029
|
);
|
|
903
1030
|
return {
|
|
904
1031
|
pattern: entry.pattern,
|
|
@@ -914,15 +1041,15 @@ var RouteManager = class _RouteManager {
|
|
|
914
1041
|
modulePath: toUrlPath(boundary.modulePath)
|
|
915
1042
|
}))
|
|
916
1043
|
} : {},
|
|
917
|
-
...
|
|
918
|
-
renderPlan:
|
|
1044
|
+
..._chunkBE7AQXJBcjs.usesFarmServerTree.call(void 0, metadata) ? { serverTree: true } : {},
|
|
1045
|
+
renderPlan: _chunkC5AM2XDNcjs.createFarmRouteRenderPlan.call(void 0, {
|
|
919
1046
|
pageShouldHydrate: metadata.shouldHydrate,
|
|
920
1047
|
layoutShouldHydrate,
|
|
921
1048
|
islandStrategy: metadata.islandStrategy
|
|
922
1049
|
}),
|
|
923
1050
|
suppressedAsyncHydration: metadata.suppressedAsyncHydration,
|
|
924
1051
|
...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {},
|
|
925
|
-
search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess',
|
|
1052
|
+
search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _40 => _40.search])),
|
|
926
1053
|
segments: entry.route.segments.map((seg) => ({
|
|
927
1054
|
segment: seg.segment,
|
|
928
1055
|
isDynamic: seg.isDynamic,
|
|
@@ -931,7 +1058,7 @@ var RouteManager = class _RouteManager {
|
|
|
931
1058
|
}))
|
|
932
1059
|
};
|
|
933
1060
|
});
|
|
934
|
-
const treeLayoutPatterns = islandsMode ?
|
|
1061
|
+
const treeLayoutPatterns = islandsMode ? _chunkC5AM2XDNcjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
935
1062
|
layoutEntries.map(({ entry, metadata }) => ({
|
|
936
1063
|
pattern: entry.pattern,
|
|
937
1064
|
shouldHydrate: metadata.shouldHydrate,
|
|
@@ -956,7 +1083,7 @@ var RouteManager = class _RouteManager {
|
|
|
956
1083
|
...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {}
|
|
957
1084
|
}));
|
|
958
1085
|
const slots = Array.from(this.routeSlots.values()).map((entry) => {
|
|
959
|
-
const metadata =
|
|
1086
|
+
const metadata = _chunkBE7AQXJBcjs.getClientModuleMetadata.call(void 0, entry.modulePath, normalizedProjectRoot);
|
|
960
1087
|
return {
|
|
961
1088
|
name: entry.name,
|
|
962
1089
|
ownerPattern: entry.ownerPattern,
|
|
@@ -972,7 +1099,7 @@ var RouteManager = class _RouteManager {
|
|
|
972
1099
|
};
|
|
973
1100
|
});
|
|
974
1101
|
const slotPlans = islandsMode ? Array.from(this.routeSlots.values()).map((entry) => ({
|
|
975
|
-
metadata:
|
|
1102
|
+
metadata: _chunkBE7AQXJBcjs.getClientModuleHydrationPlan.call(void 0,
|
|
976
1103
|
entry.modulePath,
|
|
977
1104
|
normalizedProjectRoot,
|
|
978
1105
|
isolatedMode,
|
|
@@ -1000,6 +1127,7 @@ var RouteManager = class _RouteManager {
|
|
|
1000
1127
|
_chunkQMNWKQL4cjs.logger.error(`[Farm.js] islands mode cannot hydrate ${error}`);
|
|
1001
1128
|
}
|
|
1002
1129
|
const manifest = { routes, layouts, slots };
|
|
1130
|
+
this.editedSources = this.sourceChangeTracking ? /* @__PURE__ */ new Set() : null;
|
|
1003
1131
|
this.clientManifestCache = {
|
|
1004
1132
|
projectRoot: normalizedProjectRoot,
|
|
1005
1133
|
manifest,
|
|
@@ -1036,7 +1164,7 @@ var RouteManager = class _RouteManager {
|
|
|
1036
1164
|
getIsolatedClientBoundaryModules(projectRoot = this.config.root) {
|
|
1037
1165
|
const normalizedProjectRoot = path3.default.resolve(projectRoot);
|
|
1038
1166
|
this.generateClientManifest(normalizedProjectRoot);
|
|
1039
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
1167
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _41 => _41.clientManifestCache, 'optionalAccess', _42 => _42.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
|
|
1040
1168
|
}
|
|
1041
1169
|
/**
|
|
1042
1170
|
* @internal Islands-mode pages with a client component that cannot become an island. Hydrating
|
|
@@ -1044,7 +1172,7 @@ var RouteManager = class _RouteManager {
|
|
|
1044
1172
|
*/
|
|
1045
1173
|
getIslandsErrors(projectRoot = this.config.root) {
|
|
1046
1174
|
this.generateClientManifest(path3.default.resolve(projectRoot));
|
|
1047
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
1175
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _43 => _43.clientManifestCache, 'optionalAccess', _44 => _44.islandsErrors]), () => ( []));
|
|
1048
1176
|
}
|
|
1049
1177
|
/**
|
|
1050
1178
|
* Invalidate build-time route metadata after a page or layout changes in dev.
|
|
@@ -1120,7 +1248,7 @@ var RouteManager = class _RouteManager {
|
|
|
1120
1248
|
*/
|
|
1121
1249
|
createRoutePattern(route) {
|
|
1122
1250
|
if (route.segments.length === 0) return "/";
|
|
1123
|
-
return "/" + route.segments.map(
|
|
1251
|
+
return "/" + route.segments.map(_chunkC5AM2XDNcjs.formatRouteSegment).join("/");
|
|
1124
1252
|
}
|
|
1125
1253
|
registerPageRoute(entry) {
|
|
1126
1254
|
_chunkYTVSWXEZcjs.assertUniqueRouteParameters.call(void 0, entry.pattern);
|
|
@@ -1189,7 +1317,7 @@ var RouteManager = class _RouteManager {
|
|
|
1189
1317
|
if (!primaryFile) continue;
|
|
1190
1318
|
const modulePath = path3.default.join(appDir, primaryFile);
|
|
1191
1319
|
const existing = this.routes.get(pattern);
|
|
1192
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1320
|
+
if (_optionalChain([existing, 'optionalAccess', _45 => _45.sourceRoot]) === source.root) {
|
|
1193
1321
|
throw new Error(
|
|
1194
1322
|
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
1195
1323
|
);
|
|
@@ -1214,9 +1342,9 @@ var RouteManager = class _RouteManager {
|
|
|
1214
1342
|
for (const file of files) {
|
|
1215
1343
|
const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
|
|
1216
1344
|
const modulePath = path3.default.join(appDir, file);
|
|
1217
|
-
const pattern =
|
|
1345
|
+
const pattern = _chunkC5AM2XDNcjs.createRouteDirectoryPattern.call(void 0, route);
|
|
1218
1346
|
const existing = target.get(pattern);
|
|
1219
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1347
|
+
if (_optionalChain([existing, 'optionalAccess', _46 => _46.sourceRoot]) === source.root) {
|
|
1220
1348
|
throw new Error(
|
|
1221
1349
|
`Duplicate ${kind} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
1222
1350
|
);
|
|
@@ -1236,10 +1364,10 @@ var RouteManager = class _RouteManager {
|
|
|
1236
1364
|
const modulePath = path3.default.join(appDir, file);
|
|
1237
1365
|
const pattern = this.createRoutePattern(slot.route);
|
|
1238
1366
|
const ownerPattern = this.createRoutePattern(slot.ownerRoute);
|
|
1239
|
-
const ownerDirectory =
|
|
1367
|
+
const ownerDirectory = _chunkC5AM2XDNcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
|
|
1240
1368
|
const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
|
|
1241
1369
|
const existing = this.routeSlots.get(key);
|
|
1242
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1370
|
+
if (_optionalChain([existing, 'optionalAccess', _47 => _47.sourceRoot]) === source.root) {
|
|
1243
1371
|
throw new Error(
|
|
1244
1372
|
`Duplicate route slot "${slot.name}" for "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
1245
1373
|
);
|
|
@@ -1268,7 +1396,7 @@ var RouteManager = class _RouteManager {
|
|
|
1268
1396
|
const key = `${kind}:${pattern}`;
|
|
1269
1397
|
const existing = this.metadataImages.get(key);
|
|
1270
1398
|
const sourceType = isStaticMetadataImageFile(file) ? "static" : "module";
|
|
1271
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1399
|
+
if (_optionalChain([existing, 'optionalAccess', _48 => _48.sourceRoot]) === source.root) {
|
|
1272
1400
|
throw new Error(
|
|
1273
1401
|
`Duplicate ${fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one static image or module per route segment.`
|
|
1274
1402
|
);
|
|
@@ -1296,7 +1424,7 @@ var RouteManager = class _RouteManager {
|
|
|
1296
1424
|
const pattern = this.createRoutePattern(route);
|
|
1297
1425
|
const key = `${descriptor.kind}:${pattern}`;
|
|
1298
1426
|
const existing = this.metadataRoutes.get(key);
|
|
1299
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1427
|
+
if (_optionalChain([existing, 'optionalAccess', _49 => _49.sourceRoot]) === source.root) {
|
|
1300
1428
|
throw new Error(
|
|
1301
1429
|
`Duplicate ${descriptor.fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one .ts or .js metadata route per segment.`
|
|
1302
1430
|
);
|
|
@@ -1318,11 +1446,11 @@ var RouteManager = class _RouteManager {
|
|
|
1318
1446
|
srcDir: source.srcDir,
|
|
1319
1447
|
loadModule: (filePath) => this.loadProgrammaticRoutesModule(filePath)
|
|
1320
1448
|
});
|
|
1321
|
-
const graph = this.viteServer ?
|
|
1449
|
+
const graph = this.viteServer ? _chunkBE7AQXJBcjs.createEvaluatedRouteGraph.call(void 0, this.viteServer) : void 0;
|
|
1322
1450
|
for (const { filePath, manifest } of manifests) {
|
|
1323
1451
|
if (graph) {
|
|
1324
1452
|
clientRoutes.push(
|
|
1325
|
-
|
|
1453
|
+
_chunkBE7AQXJBcjs.resolveProgrammaticClientRoutes.call(void 0, {
|
|
1326
1454
|
graph,
|
|
1327
1455
|
routesFile: toRealPath(filePath),
|
|
1328
1456
|
routes: manifest.routes,
|
|
@@ -1335,7 +1463,7 @@ var RouteManager = class _RouteManager {
|
|
|
1335
1463
|
const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "page");
|
|
1336
1464
|
const pattern = this.createRoutePattern(route);
|
|
1337
1465
|
const existing = this.routes.get(pattern);
|
|
1338
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1466
|
+
if (_optionalChain([existing, 'optionalAccess', _50 => _50.sourceRoot]) === source.root) {
|
|
1339
1467
|
throw new Error(
|
|
1340
1468
|
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
|
|
1341
1469
|
);
|
|
@@ -1353,9 +1481,9 @@ var RouteManager = class _RouteManager {
|
|
|
1353
1481
|
}
|
|
1354
1482
|
if (definition.kind === "layout") {
|
|
1355
1483
|
const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
|
|
1356
|
-
const pattern =
|
|
1484
|
+
const pattern = _chunkC5AM2XDNcjs.createRouteDirectoryPattern.call(void 0, route);
|
|
1357
1485
|
const existing = this.layouts.get(pattern);
|
|
1358
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
1486
|
+
if (_optionalChain([existing, 'optionalAccess', _51 => _51.sourceRoot]) === source.root) {
|
|
1359
1487
|
throw new Error(
|
|
1360
1488
|
`Duplicate layout route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
|
|
1361
1489
|
);
|
|
@@ -1384,7 +1512,7 @@ var RouteManager = class _RouteManager {
|
|
|
1384
1512
|
}
|
|
1385
1513
|
async loadProgrammaticRoutesModule(filePath) {
|
|
1386
1514
|
if (this.viteServer) {
|
|
1387
|
-
const viteRoot = _optionalChain([this, 'access',
|
|
1515
|
+
const viteRoot = _optionalChain([this, 'access', _52 => _52.viteServer, 'access', _53 => _53.config, 'optionalAccess', _54 => _54.root]) || this.config.root || process.cwd();
|
|
1388
1516
|
return await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, filePath, viteRoot));
|
|
1389
1517
|
}
|
|
1390
1518
|
return await import(
|
|
@@ -1400,7 +1528,7 @@ var RouteManager = class _RouteManager {
|
|
|
1400
1528
|
const matchingLayouts = [];
|
|
1401
1529
|
for (const { entry, groupScope } of this.orderedLayouts) {
|
|
1402
1530
|
if (!_chunkQMNWKQL4cjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
|
|
1403
|
-
if (groupScope !== null && !
|
|
1531
|
+
if (groupScope !== null && !_chunkC5AM2XDNcjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
|
|
1404
1532
|
continue;
|
|
1405
1533
|
}
|
|
1406
1534
|
matchingLayouts.push(entry);
|
|
@@ -1481,14 +1609,14 @@ var RouteManager = class _RouteManager {
|
|
|
1481
1609
|
let page = route;
|
|
1482
1610
|
for (const boundaryEntry of boundaries.values()) {
|
|
1483
1611
|
if (!_chunkQMNWKQL4cjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
|
|
1484
|
-
const groupScope =
|
|
1612
|
+
const groupScope = _chunkC5AM2XDNcjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
|
|
1485
1613
|
if (groupScope !== null) {
|
|
1486
1614
|
if (page === void 0) page = this.matchPageRoute(_chunkQMNWKQL4cjs.splitRoutePath.call(void 0, normalizedPath));
|
|
1487
|
-
if (!
|
|
1615
|
+
if (!_chunkC5AM2XDNcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
|
|
1488
1616
|
}
|
|
1489
1617
|
const depth = boundaryEntry.route.segments.length;
|
|
1490
|
-
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess',
|
|
1491
|
-
if (!bestMatch || depth > bestDepth || depth === bestDepth &&
|
|
1618
|
+
const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _55 => _55.route, 'access', _56 => _56.segments, 'access', _57 => _57.length]), () => ( -1));
|
|
1619
|
+
if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkC5AM2XDNcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkC5AM2XDNcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
|
|
1492
1620
|
bestMatch = boundaryEntry;
|
|
1493
1621
|
}
|
|
1494
1622
|
}
|
|
@@ -1538,7 +1666,7 @@ var RouteManager = class _RouteManager {
|
|
|
1538
1666
|
}));
|
|
1539
1667
|
const i18n = this.getI18nConfig();
|
|
1540
1668
|
const docsAdapterRoutes = this.getDocsAdapterRoutes();
|
|
1541
|
-
const result = await
|
|
1669
|
+
const result = await _chunkE3LE6EZHcjs.collectSSGPages.call(void 0, routes, (filePath) => this.loadRouteModule(filePath), {
|
|
1542
1670
|
suggestStaticRendering: shouldSuggestStaticRenderingForI18n(i18n),
|
|
1543
1671
|
...docsAdapterRoutes ? { docsAdapterRoutes } : {}
|
|
1544
1672
|
});
|
|
@@ -1585,9 +1713,9 @@ var RouteManager = class _RouteManager {
|
|
|
1585
1713
|
async isRouteSSG(modulePath) {
|
|
1586
1714
|
try {
|
|
1587
1715
|
const mod = await this.loadRouteModule(modulePath);
|
|
1588
|
-
const rendering = await
|
|
1716
|
+
const rendering = await _chunkE3LE6EZHcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
1589
1717
|
return rendering.ssg;
|
|
1590
|
-
} catch (
|
|
1718
|
+
} catch (e2) {
|
|
1591
1719
|
return false;
|
|
1592
1720
|
}
|
|
1593
1721
|
}
|
|
@@ -1597,9 +1725,9 @@ var RouteManager = class _RouteManager {
|
|
|
1597
1725
|
async hasRouteISR(modulePath) {
|
|
1598
1726
|
try {
|
|
1599
1727
|
const mod = await this.loadRouteModule(modulePath);
|
|
1600
|
-
const rendering = await
|
|
1728
|
+
const rendering = await _chunkE3LE6EZHcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
1601
1729
|
return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
|
|
1602
|
-
} catch (
|
|
1730
|
+
} catch (e3) {
|
|
1603
1731
|
return false;
|
|
1604
1732
|
}
|
|
1605
1733
|
}
|
|
@@ -1609,15 +1737,15 @@ var RouteManager = class _RouteManager {
|
|
|
1609
1737
|
async getRouteRevalidateInterval(modulePath) {
|
|
1610
1738
|
try {
|
|
1611
1739
|
const mod = await this.loadRouteModule(modulePath);
|
|
1612
|
-
const rendering = await
|
|
1740
|
+
const rendering = await _chunkE3LE6EZHcjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
|
|
1613
1741
|
return rendering.revalidate;
|
|
1614
|
-
} catch (
|
|
1742
|
+
} catch (e4) {
|
|
1615
1743
|
return void 0;
|
|
1616
1744
|
}
|
|
1617
1745
|
}
|
|
1618
1746
|
};
|
|
1619
1747
|
function getPageDirectoryField(route, pattern) {
|
|
1620
|
-
const directory =
|
|
1748
|
+
const directory = _chunkC5AM2XDNcjs.createRouteDirectoryPattern.call(void 0, route);
|
|
1621
1749
|
return directory === pattern ? {} : { directory };
|
|
1622
1750
|
}
|
|
1623
1751
|
function interpolateRedirectDestination(destination, params, catchAllSegments = {}) {
|
|
@@ -1697,14 +1825,14 @@ function replaceAll(input, search, replacement) {
|
|
|
1697
1825
|
async function safeGlobFiles(pattern, cwd) {
|
|
1698
1826
|
try {
|
|
1699
1827
|
return await _chunkQMNWKQL4cjs.globFiles.call(void 0, pattern, cwd);
|
|
1700
|
-
} catch (
|
|
1828
|
+
} catch (e5) {
|
|
1701
1829
|
return [];
|
|
1702
1830
|
}
|
|
1703
1831
|
}
|
|
1704
1832
|
function toRealPath(filePath) {
|
|
1705
1833
|
try {
|
|
1706
1834
|
return _fs.realpathSync.call(void 0, filePath);
|
|
1707
|
-
} catch (
|
|
1835
|
+
} catch (e6) {
|
|
1708
1836
|
return filePath;
|
|
1709
1837
|
}
|
|
1710
1838
|
}
|
|
@@ -1796,7 +1924,7 @@ function farmFontImportsPlugin(options = {}) {
|
|
|
1796
1924
|
return;
|
|
1797
1925
|
}
|
|
1798
1926
|
const resource = registry.getDevResource(pathname);
|
|
1799
|
-
if (!_optionalChain([resource, 'optionalAccess',
|
|
1927
|
+
if (!_optionalChain([resource, 'optionalAccess', _58 => _58.bytes])) {
|
|
1800
1928
|
next();
|
|
1801
1929
|
return;
|
|
1802
1930
|
}
|
|
@@ -2078,7 +2206,7 @@ ${FONT_SECTION_END}
|
|
|
2078
2206
|
let url;
|
|
2079
2207
|
try {
|
|
2080
2208
|
url = new URL(input.source);
|
|
2081
|
-
} catch (
|
|
2209
|
+
} catch (e7) {
|
|
2082
2210
|
throw fontError(input.moduleId, `remoteFont() source must be an absolute HTTPS URL`);
|
|
2083
2211
|
}
|
|
2084
2212
|
if (url.protocol !== "https:") {
|
|
@@ -2314,7 +2442,7 @@ function readFontOptions(code, id, call) {
|
|
|
2314
2442
|
const declaration = call.ancestors.at(-2);
|
|
2315
2443
|
const statement = call.ancestors.at(-3);
|
|
2316
2444
|
const statementParent = call.ancestors.at(-4);
|
|
2317
|
-
const isModuleScope = _optionalChain([declaration, 'optionalAccess',
|
|
2445
|
+
const isModuleScope = _optionalChain([declaration, 'optionalAccess', _59 => _59.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _60 => _60.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _61 => _61.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _62 => _62.type]) === "Program");
|
|
2318
2446
|
if (!isModuleScope || call.ancestors.some((ancestor) => isFunctionNode(ancestor))) {
|
|
2319
2447
|
throw fontError(id, `${call.kind}() must be declared directly at module scope`);
|
|
2320
2448
|
}
|
|
@@ -2522,7 +2650,7 @@ function resolveLocalFontPath(source, importer, root) {
|
|
|
2522
2650
|
}
|
|
2523
2651
|
try {
|
|
2524
2652
|
return _module.createRequire.call(void 0, _url.pathToFileURL.call(void 0, importer)).resolve(source);
|
|
2525
|
-
} catch (
|
|
2653
|
+
} catch (e8) {
|
|
2526
2654
|
const segments = source.replace(/\\/g, "/").split("/");
|
|
2527
2655
|
if (segments.includes("..")) return path3.default.resolve(root, source);
|
|
2528
2656
|
let current = path3.default.dirname(importer);
|
|
@@ -2855,7 +2983,7 @@ function parseFarmIslandSource(file, code) {
|
|
|
2855
2983
|
function modifiedAt(file) {
|
|
2856
2984
|
try {
|
|
2857
2985
|
return fs.default.statSync(file).mtimeMs;
|
|
2858
|
-
} catch (
|
|
2986
|
+
} catch (e9) {
|
|
2859
2987
|
return -1;
|
|
2860
2988
|
}
|
|
2861
2989
|
}
|
|
@@ -2869,13 +2997,13 @@ function inferFarmIslandStrategy(filePath, root) {
|
|
|
2869
2997
|
let code;
|
|
2870
2998
|
try {
|
|
2871
2999
|
code = fs.default.readFileSync(file, "utf8");
|
|
2872
|
-
} catch (
|
|
3000
|
+
} catch (e10) {
|
|
2873
3001
|
return { strategy: null, files: [file], reason: `${path3.default.basename(file)} could not be read` };
|
|
2874
3002
|
}
|
|
2875
3003
|
const result = _compiler.inferStrategy.call(void 0, file, code, {
|
|
2876
3004
|
parse: parseFarmIslandSource,
|
|
2877
3005
|
resolve: (specifier, importer) => {
|
|
2878
|
-
const resolved =
|
|
3006
|
+
const resolved = _chunkBE7AQXJBcjs.resolveImportedModule.call(void 0, importer, specifier, root);
|
|
2879
3007
|
return resolved.local ? resolved.path : null;
|
|
2880
3008
|
}
|
|
2881
3009
|
});
|
|
@@ -2885,11 +3013,32 @@ function inferFarmIslandStrategy(filePath, root) {
|
|
|
2885
3013
|
});
|
|
2886
3014
|
return result;
|
|
2887
3015
|
}
|
|
3016
|
+
var routeRootInferences = /* @__PURE__ */ new Map();
|
|
3017
|
+
function invalidateFarmRouteRootInferences() {
|
|
3018
|
+
routeRootInferences.clear();
|
|
3019
|
+
}
|
|
2888
3020
|
function inferFarmRouteRootStrategy(owners, root) {
|
|
3021
|
+
const key = [_nullishCoalesce(root, () => ( "")), ...owners.map((owner) => path3.default.resolve(owner))].join("\n");
|
|
3022
|
+
const cached = routeRootInferences.get(key);
|
|
3023
|
+
if (cached && cached.stamps.every(([read2, stamp]) => modifiedAt(read2) === stamp)) {
|
|
3024
|
+
return cached.result;
|
|
3025
|
+
}
|
|
3026
|
+
const { result, files } = _chunkBE7AQXJBcjs.traceFarmSourceReads.call(void 0, () => inferRouteRoot(owners, root));
|
|
3027
|
+
const read = new Set([...files, ...result.files].filter((file) => !isInstalledPackageFile(file)));
|
|
3028
|
+
routeRootInferences.set(key, {
|
|
3029
|
+
stamps: [...read].map((file) => [file, modifiedAt(file)]),
|
|
3030
|
+
result
|
|
3031
|
+
});
|
|
3032
|
+
return result;
|
|
3033
|
+
}
|
|
3034
|
+
function isInstalledPackageFile(file) {
|
|
3035
|
+
return file.split(path3.default.sep).includes("node_modules");
|
|
3036
|
+
}
|
|
3037
|
+
function inferRouteRoot(owners, root) {
|
|
2889
3038
|
const files = [];
|
|
2890
3039
|
const modules = [];
|
|
2891
3040
|
for (const owner of owners) {
|
|
2892
|
-
const rendered =
|
|
3041
|
+
const rendered = _chunkBE7AQXJBcjs.collectFarmRenderedClientModules.call(void 0, owner, root);
|
|
2893
3042
|
if (!rendered) {
|
|
2894
3043
|
return {
|
|
2895
3044
|
strategy: null,
|
|
@@ -2903,9 +3052,9 @@ function inferFarmRouteRootStrategy(owners, root) {
|
|
|
2903
3052
|
let source = null;
|
|
2904
3053
|
try {
|
|
2905
3054
|
source = fs.default.readFileSync(module, "utf8");
|
|
2906
|
-
} catch (
|
|
3055
|
+
} catch (e11) {
|
|
2907
3056
|
}
|
|
2908
|
-
if (
|
|
3057
|
+
if (_chunkBE7AQXJBcjs.getIslandStrategyExport.call(void 0, source) !== null) return { strategy: null, files, declared: true };
|
|
2909
3058
|
}
|
|
2910
3059
|
for (const module of modules) {
|
|
2911
3060
|
const result = inferFarmIslandStrategy(module, root);
|
|
@@ -2917,7 +3066,7 @@ function inferFarmRouteRootStrategy(owners, root) {
|
|
|
2917
3066
|
function resolveFarmRouteRootStrategy(route, page, layouts, root, islandsMode) {
|
|
2918
3067
|
const directory = _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
2919
3068
|
const onRoute = layouts.filter(
|
|
2920
|
-
(layout) =>
|
|
3069
|
+
(layout) => _chunkC5AM2XDNcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, directory)
|
|
2921
3070
|
);
|
|
2922
3071
|
const declared = [
|
|
2923
3072
|
...page.islandStrategy ? [page.islandStrategy] : [],
|
|
@@ -2950,7 +3099,7 @@ var _stream = require('stream');
|
|
|
2950
3099
|
|
|
2951
3100
|
function resolveFarmNotFoundComponentPath(config, appDirs) {
|
|
2952
3101
|
const extensions = _chunk67MZTLTFcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
|
|
2953
|
-
const configuredPath = _optionalChain([config, 'access',
|
|
3102
|
+
const configuredPath = _optionalChain([config, 'access', _63 => _63.notFound, 'optionalAccess', _64 => _64.component, 'optionalAccess', _65 => _65.trim, 'call', _66 => _66()]);
|
|
2954
3103
|
if (configuredPath) {
|
|
2955
3104
|
const componentPath = path3.default.isAbsolute(configuredPath) ? path3.default.normalize(configuredPath) : path3.default.resolve(config.root, configuredPath);
|
|
2956
3105
|
if (!extensions.some((extension) => componentPath.endsWith(extension))) {
|
|
@@ -2988,11 +3137,11 @@ function getFarmLayoutKey(pattern, params) {
|
|
|
2988
3137
|
);
|
|
2989
3138
|
}
|
|
2990
3139
|
function countFarmKeptLayouts(layoutsHeader, layouts, params) {
|
|
2991
|
-
const chain =
|
|
3140
|
+
const chain = _chunkC5AM2XDNcjs.parseFarmLayoutChainHeader.call(void 0, _nullishCoalesce(layoutsHeader, () => ( null)));
|
|
2992
3141
|
if (chain.length === 0) return 0;
|
|
2993
3142
|
const keys = layouts.map((layout) => getFarmLayoutKey(layout.pattern, params));
|
|
2994
|
-
if (chain[0] === keys[0]) return
|
|
2995
|
-
return keys.length > 1 ? 1 +
|
|
3143
|
+
if (chain[0] === keys[0]) return _chunkC5AM2XDNcjs.getSharedLayoutPrefixLength.call(void 0, chain, keys);
|
|
3144
|
+
return keys.length > 1 ? 1 + _chunkC5AM2XDNcjs.getSharedLayoutPrefixLength.call(void 0, chain, keys.slice(1)) : 0;
|
|
2996
3145
|
}
|
|
2997
3146
|
function createFarmFlushToken() {
|
|
2998
3147
|
const bytes = new Uint8Array(16);
|
|
@@ -3179,7 +3328,7 @@ function normalizeStackPath(value) {
|
|
|
3179
3328
|
const withoutQuery = value.replace(/[?#].*$/, "");
|
|
3180
3329
|
try {
|
|
3181
3330
|
return withoutQuery.startsWith("file://") ? _url.fileURLToPath.call(void 0, withoutQuery) : withoutQuery;
|
|
3182
|
-
} catch (
|
|
3331
|
+
} catch (e12) {
|
|
3183
3332
|
return void 0;
|
|
3184
3333
|
}
|
|
3185
3334
|
}
|
|
@@ -3223,7 +3372,7 @@ function createSourceFrame(location) {
|
|
|
3223
3372
|
column: location.column,
|
|
3224
3373
|
lines
|
|
3225
3374
|
};
|
|
3226
|
-
} catch (
|
|
3375
|
+
} catch (e13) {
|
|
3227
3376
|
return void 0;
|
|
3228
3377
|
}
|
|
3229
3378
|
}
|
|
@@ -3247,7 +3396,7 @@ function createDefaultErrorDiagnostics(error, root) {
|
|
|
3247
3396
|
function canBootFarmIslandsClient(config) {
|
|
3248
3397
|
const docs = config.docs;
|
|
3249
3398
|
const docsEnabled = docs === true || typeof docs === "object" && docs !== null && docs.enabled !== false;
|
|
3250
|
-
return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3399
|
+
return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _67 => _67.experimental, 'optionalAccess', _68 => _68.serverComponents])) === "islands" && !docsEnabled && _chunkDMXMIE2Ccjs.resolveFarmClientPlugins.call(void 0, config.plugins, config.root).length === 0 && !_chunkDMXMIE2Ccjs.resolveFarmAppClientEntry.call(void 0, config.root, config.srcDir || "src");
|
|
3251
3400
|
}
|
|
3252
3401
|
|
|
3253
3402
|
// src/server/renderer.ts
|
|
@@ -3326,7 +3475,7 @@ var warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
|
|
|
3326
3475
|
function warnSuppressedAsyncHydrationOnce(modulePath, reason) {
|
|
3327
3476
|
if (warnedSuppressedAsyncHydrationModules.has(modulePath)) return;
|
|
3328
3477
|
warnedSuppressedAsyncHydrationModules.add(modulePath);
|
|
3329
|
-
_chunkQMNWKQL4cjs.logger.warn(
|
|
3478
|
+
_chunkQMNWKQL4cjs.logger.warn(_chunkBE7AQXJBcjs.describeSuppressedAsyncHydration.call(void 0, modulePath, reason));
|
|
3330
3479
|
}
|
|
3331
3480
|
var fullDocumentRoutes = /* @__PURE__ */ new Set();
|
|
3332
3481
|
var documentLayouts = /* @__PURE__ */ new WeakMap();
|
|
@@ -3363,7 +3512,7 @@ function appendResponseHeader(res, name, value) {
|
|
|
3363
3512
|
}
|
|
3364
3513
|
}
|
|
3365
3514
|
function requestHeader(req, name) {
|
|
3366
|
-
const value = _optionalChain([req, 'access',
|
|
3515
|
+
const value = _optionalChain([req, 'access', _69 => _69.headers, 'optionalAccess', _70 => _70[name]]);
|
|
3367
3516
|
return Array.isArray(value) ? value[0] : value;
|
|
3368
3517
|
}
|
|
3369
3518
|
function appendResponseVary(res, value) {
|
|
@@ -3377,7 +3526,7 @@ function appendResponseVary(res, value) {
|
|
|
3377
3526
|
function renderI18nAlternateLinks(requestPath, snapshot, options) {
|
|
3378
3527
|
if (snapshot.routing === "none") return "";
|
|
3379
3528
|
const url = new URL(requestPath, "http://farm.local");
|
|
3380
|
-
return
|
|
3529
|
+
return _chunkC5AM2XDNcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
|
|
3381
3530
|
}
|
|
3382
3531
|
var PPR_REFRESH_MAX_ATTEMPTS = 3;
|
|
3383
3532
|
function createPPRRefreshScript() {
|
|
@@ -3472,12 +3621,12 @@ async function parseRouteModuleProps(routeModule, input) {
|
|
|
3472
3621
|
}
|
|
3473
3622
|
const schemas = routeModule.__farmRouteSchemas;
|
|
3474
3623
|
const params = parseRouteModuleSchema(
|
|
3475
|
-
_optionalChain([schemas, 'optionalAccess',
|
|
3624
|
+
_optionalChain([schemas, 'optionalAccess', _71 => _71.params]),
|
|
3476
3625
|
input.props.params,
|
|
3477
3626
|
"params",
|
|
3478
3627
|
input.routePath
|
|
3479
3628
|
);
|
|
3480
|
-
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess',
|
|
3629
|
+
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _72 => _72.search]), input.search, "search", input.routePath);
|
|
3481
3630
|
return {
|
|
3482
3631
|
...input.props,
|
|
3483
3632
|
params,
|
|
@@ -3511,7 +3660,7 @@ function readAppPackageIdentity(root) {
|
|
|
3511
3660
|
return JSON.parse(
|
|
3512
3661
|
fs5.readFileSync(path9.join(root || process.cwd(), "package.json"), "utf8")
|
|
3513
3662
|
);
|
|
3514
|
-
} catch (
|
|
3663
|
+
} catch (e14) {
|
|
3515
3664
|
return {};
|
|
3516
3665
|
}
|
|
3517
3666
|
}
|
|
@@ -3535,7 +3684,7 @@ var ServerRenderer = class {
|
|
|
3535
3684
|
} else {
|
|
3536
3685
|
_chunkXGJVRPYLcjs.uninstallFarmIslandValues.call(void 0, );
|
|
3537
3686
|
}
|
|
3538
|
-
if (_optionalChain([this, 'access',
|
|
3687
|
+
if (_optionalChain([this, 'access', _73 => _73.config, 'access', _74 => _74.notFound, 'optionalAccess', _75 => _75.component, 'optionalAccess', _76 => _76.trim, 'call', _77 => _77()])) {
|
|
3539
3688
|
resolveFarmNotFoundComponentPath(this.config, _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, this.config));
|
|
3540
3689
|
}
|
|
3541
3690
|
const loaded = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, this.config.renderer) ? await import("./renderer/none/server.cjs") : this.viteServer ? await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
|
|
@@ -3560,7 +3709,7 @@ var ServerRenderer = class {
|
|
|
3560
3709
|
"node"
|
|
3561
3710
|
);
|
|
3562
3711
|
this.rendererRuntime = islands && this.islandValues() ? withFarmIslandsRenders(runtime, islands) : runtime;
|
|
3563
|
-
_optionalChain([this, 'access',
|
|
3712
|
+
_optionalChain([this, 'access', _78 => _78.routeManager, 'access', _79 => _79.setRendererRuntime, 'optionalCall', _80 => _80(this.rendererRuntime)]);
|
|
3564
3713
|
await this.applyRendererAppSetup();
|
|
3565
3714
|
}
|
|
3566
3715
|
/**
|
|
@@ -3617,7 +3766,7 @@ var ServerRenderer = class {
|
|
|
3617
3766
|
/// Stylesheets the app imported through JS (fontsource packages, component
|
|
3618
3767
|
/// CSS) that the document must link alongside globals.css — see #658.
|
|
3619
3768
|
collectDevStyleHrefs() {
|
|
3620
|
-
const graph = _optionalChain([this, 'access',
|
|
3769
|
+
const graph = _optionalChain([this, 'access', _81 => _81.viteServer, 'optionalAccess', _82 => _82.moduleGraph]);
|
|
3621
3770
|
if (!graph) return [];
|
|
3622
3771
|
return collectDevStylesheetUrls(
|
|
3623
3772
|
graph.idToModuleMap.values(),
|
|
@@ -3642,7 +3791,7 @@ var ServerRenderer = class {
|
|
|
3642
3791
|
"data-farm-layout-boundary": "true",
|
|
3643
3792
|
"data-farm-layout-pattern": pattern,
|
|
3644
3793
|
...segment ? { "data-farm-layout-key": segment.key } : {},
|
|
3645
|
-
..._optionalChain([segment, 'optionalAccess',
|
|
3794
|
+
..._optionalChain([segment, 'optionalAccess', _83 => _83.kept]) ? { "data-farm-layout-kept": "true" } : {},
|
|
3646
3795
|
style: { display: "contents" }
|
|
3647
3796
|
},
|
|
3648
3797
|
layoutElement
|
|
@@ -3658,6 +3807,11 @@ var ServerRenderer = class {
|
|
|
3658
3807
|
return this.rendererRuntime.wrapClientGraph(element);
|
|
3659
3808
|
}
|
|
3660
3809
|
/** The page a hydrating layout keeps as server HTML: islands again, or a server tree. */
|
|
3810
|
+
/** The route root's strategy, inspecting packages with the dev server's latest plan's cache. */
|
|
3811
|
+
resolveRouteRootStrategy(...args) {
|
|
3812
|
+
const resolve3 = () => resolveFarmRouteRootStrategy(...args);
|
|
3813
|
+
return typeof this.routeManager.inspectPackages === "function" ? this.routeManager.inspectPackages(resolve3) : resolve3();
|
|
3814
|
+
}
|
|
3661
3815
|
async isolateServerPage(element, serverTree) {
|
|
3662
3816
|
if (islands && this.islandValues()) {
|
|
3663
3817
|
const runtime = islands;
|
|
@@ -3733,11 +3887,15 @@ var ServerRenderer = class {
|
|
|
3733
3887
|
);
|
|
3734
3888
|
return { html: rendered.html, head: rendered.head || "" };
|
|
3735
3889
|
}
|
|
3736
|
-
|
|
3890
|
+
const { head, body } = _chunkC5AM2XDNcjs.takeFarmHoistedHead.call(void 0,
|
|
3891
|
+
await this.renderElementToCompleteHTML(element, options),
|
|
3892
|
+
true
|
|
3893
|
+
);
|
|
3894
|
+
return { html: body, head };
|
|
3737
3895
|
}
|
|
3738
3896
|
/** Islands mode sends large prop values once, keyed by content (RFC 0003). */
|
|
3739
3897
|
islandValues() {
|
|
3740
|
-
return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
3898
|
+
return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _84 => _84.config, 'access', _85 => _85.experimental, 'optionalAccess', _86 => _86.serverComponents])) === "islands";
|
|
3741
3899
|
}
|
|
3742
3900
|
/**
|
|
3743
3901
|
* Render the route tree used by client navigation without producing a second
|
|
@@ -3814,7 +3972,7 @@ var ServerRenderer = class {
|
|
|
3814
3972
|
async runWithRequestContext(request2, fn) {
|
|
3815
3973
|
return _chunkHDPT6OYEcjs._runWithCurrentRequest.call(void 0,
|
|
3816
3974
|
request2,
|
|
3817
|
-
() => _optionalChain([this, 'access',
|
|
3975
|
+
() => _optionalChain([this, 'access', _87 => _87.i18nRuntime, 'optionalAccess', _88 => _88.config, 'access', _89 => _89.enabled]) ? _chunkNLBK37HIcjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
|
|
3818
3976
|
redirect: false
|
|
3819
3977
|
}) : fn()
|
|
3820
3978
|
);
|
|
@@ -3845,7 +4003,7 @@ var ServerRenderer = class {
|
|
|
3845
4003
|
* Check if a path should be served from SSG cache
|
|
3846
4004
|
*/
|
|
3847
4005
|
async shouldServeSSG(pathname) {
|
|
3848
|
-
const ssgPage =
|
|
4006
|
+
const ssgPage = _chunkE3LE6EZHcjs.matchSSGPage.call(void 0, pathname, this.ssgManifest);
|
|
3849
4007
|
if (!ssgPage) return null;
|
|
3850
4008
|
const cached = await this.getCachedSSGPage(pathname);
|
|
3851
4009
|
if (cached && await this.dataCache.isStaleAsync(cached)) {
|
|
@@ -3893,7 +4051,11 @@ var ServerRenderer = class {
|
|
|
3893
4051
|
key,
|
|
3894
4052
|
{ html },
|
|
3895
4053
|
{
|
|
3896
|
-
|
|
4054
|
+
// revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
|
|
4055
|
+
// answers the public one (`/console/fr/pricing`): either clears it, as in production.
|
|
4056
|
+
paths: [
|
|
4057
|
+
.../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])
|
|
4058
|
+
],
|
|
3897
4059
|
tags: ["ppr"],
|
|
3898
4060
|
revalidate: _nullishCoalesce(options.revalidate, () => ( false))
|
|
3899
4061
|
}
|
|
@@ -3962,7 +4124,7 @@ var ServerRenderer = class {
|
|
|
3962
4124
|
setImmediate(async () => {
|
|
3963
4125
|
try {
|
|
3964
4126
|
const mod = await this.routeManager.loadRouteModule(page.filePath);
|
|
3965
|
-
if (!_optionalChain([mod, 'optionalAccess',
|
|
4127
|
+
if (!_optionalChain([mod, 'optionalAccess', _90 => _90.default])) return;
|
|
3966
4128
|
const { route, layouts } = this.routeManager.matchRoute(page.urlPath);
|
|
3967
4129
|
const layoutModules = await Promise.all(
|
|
3968
4130
|
layouts.map((l) => this.routeManager.loadLayoutModule(l.modulePath))
|
|
@@ -3976,7 +4138,7 @@ var ServerRenderer = class {
|
|
|
3976
4138
|
};
|
|
3977
4139
|
let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
|
|
3978
4140
|
const pageMetadata = _nullishCoalesce(routeManifest.routes.find(
|
|
3979
|
-
(entry) => entry.pattern === _optionalChain([route, 'optionalAccess',
|
|
4141
|
+
(entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _91 => _91.pattern])
|
|
3980
4142
|
), () => ( {
|
|
3981
4143
|
shouldHydrate: false,
|
|
3982
4144
|
islandStrategy: null
|
|
@@ -4086,18 +4248,18 @@ var ServerRenderer = class {
|
|
|
4086
4248
|
res.setHeader(header.key, header.value);
|
|
4087
4249
|
}
|
|
4088
4250
|
const request2 = _chunkHDPT6OYEcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
4089
|
-
trustProxy: _optionalChain([this, 'access',
|
|
4251
|
+
trustProxy: _optionalChain([this, 'access', _92 => _92.config, 'access', _93 => _93.server, 'optionalAccess', _94 => _94.trustProxy])
|
|
4090
4252
|
});
|
|
4091
4253
|
const runtime = this.i18nRuntime;
|
|
4092
|
-
if (_optionalChain([runtime, 'optionalAccess',
|
|
4254
|
+
if (_optionalChain([runtime, 'optionalAccess', _95 => _95.config, 'access', _96 => _96.enabled])) {
|
|
4093
4255
|
const resolution = runtime.resolveRequest(request2);
|
|
4094
|
-
const varyHeaders =
|
|
4256
|
+
const varyHeaders = _chunkGPICBTDVcjs.getFarmLocaleVaryHeaders.call(void 0, runtime.config, resolution);
|
|
4095
4257
|
for (const header of varyHeaders) appendResponseVary(res, header);
|
|
4096
4258
|
if (resolution.persist) {
|
|
4097
4259
|
appendResponseHeader(
|
|
4098
4260
|
res,
|
|
4099
4261
|
"Set-Cookie",
|
|
4100
|
-
|
|
4262
|
+
_chunkGPICBTDVcjs.createFarmLocaleCookie.call(void 0, resolution.locale, runtime.config)
|
|
4101
4263
|
);
|
|
4102
4264
|
}
|
|
4103
4265
|
if (resolution.redirect && (request2.method === "GET" || request2.method === "HEAD")) {
|
|
@@ -4135,7 +4297,7 @@ var ServerRenderer = class {
|
|
|
4135
4297
|
});
|
|
4136
4298
|
};
|
|
4137
4299
|
try {
|
|
4138
|
-
const url = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
4300
|
+
const url = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _97 => _97.config, 'access', _98 => _98.server, 'optionalAccess', _99 => _99.trustProxy]) });
|
|
4139
4301
|
pathname = url.pathname;
|
|
4140
4302
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.start", route: pathname, pathname });
|
|
4141
4303
|
searchParamsObject = _chunkSUCDVKUBcjs.searchParamsToObject.call(void 0, url.searchParams);
|
|
@@ -4222,13 +4384,13 @@ var ServerRenderer = class {
|
|
|
4222
4384
|
params
|
|
4223
4385
|
});
|
|
4224
4386
|
let actionRequest;
|
|
4225
|
-
if (req.method === "POST" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access',
|
|
4387
|
+
if (req.method === "POST" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _100 => _100.config, 'access', _101 => _101.experimental, 'optionalAccess', _102 => _102.serverComponents])) === "islands") {
|
|
4226
4388
|
await Promise.all([
|
|
4227
4389
|
this.routeManager.loadRouteModule(route.modulePath),
|
|
4228
4390
|
...layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
|
|
4229
4391
|
]);
|
|
4230
4392
|
actionRequest = _chunkHDPT6OYEcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
4231
|
-
trustProxy: _optionalChain([this, 'access',
|
|
4393
|
+
trustProxy: _optionalChain([this, 'access', _103 => _103.config, 'access', _104 => _104.server, 'optionalAccess', _105 => _105.trustProxy])
|
|
4232
4394
|
});
|
|
4233
4395
|
const formActionRequest = actionRequest;
|
|
4234
4396
|
const actionResponse = await _chunkYDXLC4DWcjs._runWithMiddlewareData.call(void 0,
|
|
@@ -4260,7 +4422,7 @@ var ServerRenderer = class {
|
|
|
4260
4422
|
exposedOnly: true
|
|
4261
4423
|
});
|
|
4262
4424
|
const currentRequest = _nullishCoalesce(actionRequest, () => ( _chunkHDPT6OYEcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
4263
|
-
trustProxy: _optionalChain([this, 'access',
|
|
4425
|
+
trustProxy: _optionalChain([this, 'access', _106 => _106.config, 'access', _107 => _107.server, 'optionalAccess', _108 => _108.trustProxy])
|
|
4264
4426
|
})));
|
|
4265
4427
|
const routeContext = await this.resolveRouteContext({
|
|
4266
4428
|
request: currentRequest,
|
|
@@ -4302,11 +4464,11 @@ var ServerRenderer = class {
|
|
|
4302
4464
|
searchParams: _chunkSUCDVKUBcjs.createFarmSearchParams.call(void 0, searchParamsObject),
|
|
4303
4465
|
error
|
|
4304
4466
|
};
|
|
4305
|
-
if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess',
|
|
4467
|
+
if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _109 => _109.notFound])) {
|
|
4306
4468
|
res.statusCode = 404;
|
|
4307
4469
|
PageComponent = programmaticRouteComponents.notFound;
|
|
4308
4470
|
pageProps = routeStateProps;
|
|
4309
|
-
} else if (_optionalChain([programmaticRouteComponents, 'optionalAccess',
|
|
4471
|
+
} else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _110 => _110.error])) {
|
|
4310
4472
|
res.statusCode = 500;
|
|
4311
4473
|
PageComponent = programmaticRouteComponents.error;
|
|
4312
4474
|
pageProps = routeStateProps;
|
|
@@ -4314,21 +4476,21 @@ var ServerRenderer = class {
|
|
|
4314
4476
|
throw error;
|
|
4315
4477
|
}
|
|
4316
4478
|
}
|
|
4317
|
-
const renderingConfig = await
|
|
4479
|
+
const renderingConfig = await _chunkE3LE6EZHcjs.resolveRouteRenderingConfigFromFile.call(void 0,
|
|
4318
4480
|
routeModule,
|
|
4319
4481
|
route.modulePath,
|
|
4320
|
-
{ experimentalPPR: _optionalChain([this, 'access',
|
|
4482
|
+
{ experimentalPPR: _optionalChain([this, 'access', _111 => _111.config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.ppr]) === true }
|
|
4321
4483
|
);
|
|
4322
4484
|
const pprBypassReason = renderingConfig.ppr ? this.getPPRShellBypassReason(req, middlewareMap, middlewareContext, pluginExposedContext) : void 0;
|
|
4323
4485
|
const islandsNavigationRequest = Boolean(
|
|
4324
4486
|
islands && this.islandValues() && (requestHeader(req, "f-layouts") || requestHeader(req, "f-stream"))
|
|
4325
4487
|
);
|
|
4326
4488
|
const canCachePPRShell = renderingConfig.ppr && !pprBypassReason && !islandsNavigationRequest;
|
|
4327
|
-
const pprI18nSnapshot = canCachePPRShell ?
|
|
4489
|
+
const pprI18nSnapshot = canCachePPRShell ? _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, ) : void 0;
|
|
4328
4490
|
const pprShellOptions = canCachePPRShell ? {
|
|
4329
4491
|
pathname,
|
|
4330
4492
|
search: url.search,
|
|
4331
|
-
locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess',
|
|
4493
|
+
locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _114 => _114.locale]), () => ( "")),
|
|
4332
4494
|
origin: pprI18nSnapshot && pprI18nSnapshot.routing !== "none" ? url.origin : "",
|
|
4333
4495
|
revalidate: renderingConfig.revalidate
|
|
4334
4496
|
} : void 0;
|
|
@@ -4400,7 +4562,7 @@ var ServerRenderer = class {
|
|
|
4400
4562
|
const routeManifestEntry = routeManifest.routes.find(
|
|
4401
4563
|
(entry) => entry.pattern === route.pattern
|
|
4402
4564
|
);
|
|
4403
|
-
const moduleMetadata = routeManifestEntry ||
|
|
4565
|
+
const moduleMetadata = routeManifestEntry || _chunkBE7AQXJBcjs.getClientModuleMetadata.call(void 0, route.modulePath, this.config.root);
|
|
4404
4566
|
const isClientComponent = moduleMetadata.isClientComponent;
|
|
4405
4567
|
const renderedRouteSlots = await Promise.all(
|
|
4406
4568
|
routeSlots.map(async (slot) => {
|
|
@@ -4451,20 +4613,20 @@ var ServerRenderer = class {
|
|
|
4451
4613
|
if (moduleMetadata.suppressedAsyncHydration) {
|
|
4452
4614
|
warnSuppressedAsyncHydrationOnce(
|
|
4453
4615
|
route.modulePath,
|
|
4454
|
-
_optionalChain([routeManifestEntry, 'optionalAccess',
|
|
4616
|
+
_optionalChain([routeManifestEntry, 'optionalAccess', _115 => _115.suppressedAsyncHydrationReason])
|
|
4455
4617
|
);
|
|
4456
4618
|
}
|
|
4457
4619
|
const layoutHydrationMetadata = layouts.map((layout) => {
|
|
4458
4620
|
const manifestEntry = routeManifest.layouts.find(
|
|
4459
4621
|
(entry) => entry.pattern === layout.pattern
|
|
4460
4622
|
);
|
|
4461
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
4623
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _116 => _116.suppressedAsyncHydration])) {
|
|
4462
4624
|
warnSuppressedAsyncHydrationOnce(
|
|
4463
4625
|
layout.modulePath,
|
|
4464
4626
|
manifestEntry.suppressedAsyncHydrationReason
|
|
4465
4627
|
);
|
|
4466
4628
|
}
|
|
4467
|
-
if (typeof _optionalChain([manifestEntry, 'optionalAccess',
|
|
4629
|
+
if (typeof _optionalChain([manifestEntry, 'optionalAccess', _117 => _117.shouldHydrate]) === "boolean") {
|
|
4468
4630
|
return {
|
|
4469
4631
|
isClientComponent: manifestEntry.isClientComponent === true,
|
|
4470
4632
|
shouldHydrate: manifestEntry.shouldHydrate,
|
|
@@ -4485,11 +4647,11 @@ var ServerRenderer = class {
|
|
|
4485
4647
|
const clientLayouts = layouts.map((layout, index) => ({
|
|
4486
4648
|
pattern: layout.pattern,
|
|
4487
4649
|
modulePath: _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, layout.modulePath, this.config.root),
|
|
4488
|
-
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access',
|
|
4489
|
-
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access',
|
|
4490
|
-
..._optionalChain([layoutHydrationMetadata, 'access',
|
|
4650
|
+
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _118 => _118[index], 'optionalAccess', _119 => _119.shouldHydrate]) === true,
|
|
4651
|
+
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _120 => _120[index], 'optionalAccess', _121 => _121.islandStrategy]), () => ( null)),
|
|
4652
|
+
..._optionalChain([layoutHydrationMetadata, 'access', _122 => _122[index], 'optionalAccess', _123 => _123.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {},
|
|
4491
4653
|
// Islands mode: the browser rebuilds this layout from its tree, not its module.
|
|
4492
|
-
...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access',
|
|
4654
|
+
...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _124 => _124[index], 'optionalAccess', _125 => _125.serverTree]) === true ? { serverTree: true } : {}
|
|
4493
4655
|
}));
|
|
4494
4656
|
const hydrationStrategies = [
|
|
4495
4657
|
...shouldHydrate && moduleMetadata.islandStrategy ? [moduleMetadata.islandStrategy] : [],
|
|
@@ -4497,15 +4659,15 @@ var ServerRenderer = class {
|
|
|
4497
4659
|
(metadata) => metadata.shouldHydrate && metadata.islandStrategy ? [metadata.islandStrategy] : []
|
|
4498
4660
|
)
|
|
4499
4661
|
];
|
|
4500
|
-
const hydrationIslandStrategy = this.islandValues() ?
|
|
4662
|
+
const hydrationIslandStrategy = this.islandValues() ? this.resolveRouteRootStrategy(
|
|
4501
4663
|
route,
|
|
4502
4664
|
{ shouldHydrate, islandStrategy: _nullishCoalesce(moduleMetadata.islandStrategy, () => ( null)) },
|
|
4503
4665
|
layouts.map((layout, index) => ({
|
|
4504
4666
|
pattern: layout.pattern,
|
|
4505
4667
|
modulePath: layout.modulePath,
|
|
4506
|
-
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access',
|
|
4507
|
-
hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access',
|
|
4508
|
-
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access',
|
|
4668
|
+
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _126 => _126[index], 'optionalAccess', _127 => _127.shouldHydrate]) === true,
|
|
4669
|
+
hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _128 => _128[index], 'optionalAccess', _129 => _129.hasIsolatedClientBoundaries]) === true,
|
|
4670
|
+
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _130 => _130[index], 'optionalAccess', _131 => _131.islandStrategy]), () => ( null))
|
|
4509
4671
|
})),
|
|
4510
4672
|
this.config.root || process.cwd(),
|
|
4511
4673
|
true
|
|
@@ -4513,7 +4675,7 @@ var ServerRenderer = class {
|
|
|
4513
4675
|
const hasHydratableRouteSlots = renderedRouteSlots.some(
|
|
4514
4676
|
(slot) => slot.isClientComponent || slot.shouldHydrate
|
|
4515
4677
|
);
|
|
4516
|
-
const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess',
|
|
4678
|
+
const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _132 => _132.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
|
|
4517
4679
|
req.__FARM_PAGE_PATH__ = route.modulePath;
|
|
4518
4680
|
req.__FARM_ROUTE__ = pathname;
|
|
4519
4681
|
req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
|
|
@@ -4526,7 +4688,7 @@ var ServerRenderer = class {
|
|
|
4526
4688
|
req.__FARM_SHOULD_HYDRATE__ = shouldHydrate || shouldHydrateLayout || hasIsolatedClientBoundaries;
|
|
4527
4689
|
req.__FARM_ISLAND_STRATEGY__ = hydrationIslandStrategy;
|
|
4528
4690
|
req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ = hasHydratableRouteSlots;
|
|
4529
|
-
req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess',
|
|
4691
|
+
req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _133 => _133.modulePath]) ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
|
|
4530
4692
|
req.__FARM_ROUTE_SLOTS__ = renderedRouteSlots.map((slot) => ({
|
|
4531
4693
|
name: slot.name,
|
|
4532
4694
|
ownerPattern: slot.ownerPattern,
|
|
@@ -4598,7 +4760,7 @@ var ServerRenderer = class {
|
|
|
4598
4760
|
} else if (shouldHydrateLayout && !(isClientComponent || shouldHydrate) && this.rendererRuntime.isolateServerPageGraph) {
|
|
4599
4761
|
pageElement = await this.isolateServerPage(
|
|
4600
4762
|
pageElement,
|
|
4601
|
-
_optionalChain([routeManifestEntry, 'optionalAccess',
|
|
4763
|
+
_optionalChain([routeManifestEntry, 'optionalAccess', _134 => _134.serverTree]) === true
|
|
4602
4764
|
);
|
|
4603
4765
|
}
|
|
4604
4766
|
pageElement = this.createPageBoundary(pageElement, {
|
|
@@ -4612,7 +4774,7 @@ var ServerRenderer = class {
|
|
|
4612
4774
|
if (keptLayouts > 0) {
|
|
4613
4775
|
let keptElement = null;
|
|
4614
4776
|
for (let i = keptLayouts - 1; i >= 0; i--) {
|
|
4615
|
-
const KeptLayout = _optionalChain([layoutModules, 'access',
|
|
4777
|
+
const KeptLayout = _optionalChain([layoutModules, 'access', _135 => _135[i], 'optionalAccess', _136 => _136.default]);
|
|
4616
4778
|
if (KeptLayout) {
|
|
4617
4779
|
keptElement = this.rendererRuntime.createElement(KeptLayout, {
|
|
4618
4780
|
children: keptElement,
|
|
@@ -4625,7 +4787,7 @@ var ServerRenderer = class {
|
|
|
4625
4787
|
await this.wrapWithIntegrationProviders(keptElement),
|
|
4626
4788
|
{ rejectLateErrors: true }
|
|
4627
4789
|
);
|
|
4628
|
-
} catch (
|
|
4790
|
+
} catch (e15) {
|
|
4629
4791
|
keptLayouts = 0;
|
|
4630
4792
|
}
|
|
4631
4793
|
}
|
|
@@ -4661,7 +4823,7 @@ var ServerRenderer = class {
|
|
|
4661
4823
|
);
|
|
4662
4824
|
slotProps[slot.name] = slotElement;
|
|
4663
4825
|
}
|
|
4664
|
-
wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access',
|
|
4826
|
+
wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _137 => _137[i], 'optionalAccess', _138 => _138.serverTree]) === true && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
|
|
4665
4827
|
LayoutComponent,
|
|
4666
4828
|
{ params },
|
|
4667
4829
|
{ children: wrappedElement, ...slotProps },
|
|
@@ -4759,7 +4921,7 @@ var ServerRenderer = class {
|
|
|
4759
4921
|
}
|
|
4760
4922
|
if (_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error)) {
|
|
4761
4923
|
const redirect = _chunk7JUIK547cjs.getFarmRedirectError.call(void 0, error);
|
|
4762
|
-
const snapshot =
|
|
4924
|
+
const snapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
4763
4925
|
const redirectUrl = snapshot && redirect.url.startsWith("/") && !redirect.url.startsWith("//") ? _chunkOWQV6MLMcjs.localizeFarmHref.call(void 0, redirect.url, snapshot.locale, snapshot) : redirect.url;
|
|
4764
4926
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
4765
4927
|
type: "route.redirect",
|
|
@@ -4796,7 +4958,7 @@ var ServerRenderer = class {
|
|
|
4796
4958
|
}
|
|
4797
4959
|
}
|
|
4798
4960
|
emitFarmRenderError(req, pathname, error);
|
|
4799
|
-
const errorStatus =
|
|
4961
|
+
const errorStatus = _chunkC5AM2XDNcjs.resolveDefaultErrorStatus.call(void 0, error);
|
|
4800
4962
|
if (pprRefreshRoute) {
|
|
4801
4963
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
4802
4964
|
type: "ppr.refresh.error",
|
|
@@ -4840,7 +5002,7 @@ var ServerRenderer = class {
|
|
|
4840
5002
|
const rendererCapabilities = _chunk67MZTLTFcjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
|
|
4841
5003
|
if (!rendererCapabilities.functionComponents) {
|
|
4842
5004
|
throw new Error(
|
|
4843
|
-
`Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access',
|
|
5005
|
+
`Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _139 => _139.config, 'access', _140 => _140.renderer, 'optionalAccess', _141 => _141.name]), () => ( "the configured renderer"))}\` cannot.`
|
|
4844
5006
|
);
|
|
4845
5007
|
}
|
|
4846
5008
|
if (provider.type === "clerk" && !_chunk67MZTLTFcjs.isReactRenderer.call(void 0, this.config.renderer)) {
|
|
@@ -4879,7 +5041,7 @@ var ServerRenderer = class {
|
|
|
4879
5041
|
}
|
|
4880
5042
|
if (provider.type !== "clerk" && typeof this.rendererRuntime.markFunctionComponent === "function" && !isRendererCompiledComponent(
|
|
4881
5043
|
_nullishCoalesce(providerSourceModule, () => ( "")),
|
|
4882
|
-
_chunk67MZTLTFcjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access',
|
|
5044
|
+
_chunk67MZTLTFcjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _142 => _142.config, 'access', _143 => _143.renderer, 'optionalAccess', _144 => _144.componentExtensions]))
|
|
4883
5045
|
)) {
|
|
4884
5046
|
ProviderComponent = this.rendererRuntime.markFunctionComponent(ProviderComponent);
|
|
4885
5047
|
}
|
|
@@ -4930,7 +5092,7 @@ var ServerRenderer = class {
|
|
|
4930
5092
|
manifestMatch.metadata,
|
|
4931
5093
|
manifestMatch.params
|
|
4932
5094
|
);
|
|
4933
|
-
const snapshot2 =
|
|
5095
|
+
const snapshot2 = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
4934
5096
|
const localizedHref = snapshot2 ? _chunkOWQV6MLMcjs.localizeFarmHref.call(void 0, rawHref, snapshot2.locale, snapshot2) : rawHref;
|
|
4935
5097
|
metadata.manifest = _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, localizedHref, this.config.basePath);
|
|
4936
5098
|
}
|
|
@@ -4941,7 +5103,7 @@ var ServerRenderer = class {
|
|
|
4941
5103
|
metadata = _chunk6IOZPJ3Icjs.addMetadataImageReference.call(void 0, metadata, reference);
|
|
4942
5104
|
}
|
|
4943
5105
|
}
|
|
4944
|
-
const snapshot =
|
|
5106
|
+
const snapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
4945
5107
|
const publicPathname = _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0,
|
|
4946
5108
|
snapshot ? _chunkOWQV6MLMcjs.localizeFarmHref.call(void 0, options.pathname, snapshot.locale, snapshot) : options.pathname,
|
|
4947
5109
|
this.config.basePath
|
|
@@ -4958,7 +5120,7 @@ var ServerRenderer = class {
|
|
|
4958
5120
|
const match = this.routeManager.getMatchingMetadataImage(pathname, kind);
|
|
4959
5121
|
if (!match) return null;
|
|
4960
5122
|
const rawHref = this.routeManager.resolveMetadataImagePath(match.image, match.params);
|
|
4961
|
-
const snapshot =
|
|
5123
|
+
const snapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
4962
5124
|
const localizedHref = snapshot ? _chunkOWQV6MLMcjs.localizeFarmHref.call(void 0, rawHref, snapshot.locale, snapshot) : rawHref;
|
|
4963
5125
|
const href = _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, localizedHref, this.config.basePath);
|
|
4964
5126
|
const reference = {
|
|
@@ -5008,7 +5170,7 @@ var ServerRenderer = class {
|
|
|
5008
5170
|
);
|
|
5009
5171
|
}
|
|
5010
5172
|
const request2 = _chunkHDPT6OYEcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5011
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5173
|
+
trustProxy: _optionalChain([this, 'access', _145 => _145.config, 'access', _146 => _146.server, 'optionalAccess', _147 => _147.trustProxy])
|
|
5012
5174
|
});
|
|
5013
5175
|
const url = new URL(request2.url);
|
|
5014
5176
|
const llmsContext = match.metadata.kind === "llms" || match.metadata.kind === "llms-full" ? await this.createLlmsTxtContext(request2, {
|
|
@@ -5026,7 +5188,7 @@ var ServerRenderer = class {
|
|
|
5026
5188
|
origin: await this.getAgentOrigin(request2),
|
|
5027
5189
|
readMarkdown: llmsContext.markdown
|
|
5028
5190
|
}) : value;
|
|
5029
|
-
const response =
|
|
5191
|
+
const response = _chunkC5AM2XDNcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
|
|
5030
5192
|
method,
|
|
5031
5193
|
request: request2
|
|
5032
5194
|
});
|
|
@@ -5044,7 +5206,7 @@ var ServerRenderer = class {
|
|
|
5044
5206
|
}
|
|
5045
5207
|
/** `/llms.txt` and `/llms-full.txt` from `agent.llmsTxt` when no file route owns them. */
|
|
5046
5208
|
getGeneratedLlmsKind(pathname) {
|
|
5047
|
-
const config = _chunkO32QPFVVcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access',
|
|
5209
|
+
const config = _chunkO32QPFVVcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _148 => _148.config, 'access', _149 => _149.agent, 'optionalAccess', _150 => _150.llmsTxt]));
|
|
5048
5210
|
if (!config.enabled) return null;
|
|
5049
5211
|
if (pathname === "/llms.txt") return "llms";
|
|
5050
5212
|
return pathname === "/llms-full.txt" && config.full ? "llms-full" : null;
|
|
@@ -5052,9 +5214,9 @@ var ServerRenderer = class {
|
|
|
5052
5214
|
async renderGeneratedLlmsTxt(req, res, kind) {
|
|
5053
5215
|
try {
|
|
5054
5216
|
const request2 = _chunkHDPT6OYEcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5055
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5217
|
+
trustProxy: _optionalChain([this, 'access', _151 => _151.config, 'access', _152 => _152.server, 'optionalAccess', _153 => _153.trustProxy])
|
|
5056
5218
|
});
|
|
5057
|
-
const config = _chunkO32QPFVVcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access',
|
|
5219
|
+
const config = _chunkO32QPFVVcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _154 => _154.config, 'access', _155 => _155.agent, 'optionalAccess', _156 => _156.llmsTxt]));
|
|
5058
5220
|
const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
|
|
5059
5221
|
const body = kind === "llms-full" ? await _chunkO32QPFVVcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
|
|
5060
5222
|
origin: await this.getAgentOrigin(request2),
|
|
@@ -5062,7 +5224,7 @@ var ServerRenderer = class {
|
|
|
5062
5224
|
}) : context.defaults;
|
|
5063
5225
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5064
5226
|
res,
|
|
5065
|
-
|
|
5227
|
+
_chunkC5AM2XDNcjs.createFarmMetadataRouteResponse.call(void 0,
|
|
5066
5228
|
kind,
|
|
5067
5229
|
body,
|
|
5068
5230
|
{ revalidate: config.revalidate },
|
|
@@ -5081,23 +5243,23 @@ var ServerRenderer = class {
|
|
|
5081
5243
|
}
|
|
5082
5244
|
}
|
|
5083
5245
|
getAgentCrawlers() {
|
|
5084
|
-
return _chunkZUVAGMQ5cjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access',
|
|
5246
|
+
return _chunkZUVAGMQ5cjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _157 => _157.config, 'access', _158 => _158.agent, 'optionalAccess', _159 => _159.crawlers]));
|
|
5085
5247
|
}
|
|
5086
5248
|
/** `/robots.txt` from `agent.crawlers` when no robots.ts owns it. */
|
|
5087
5249
|
async renderGeneratedRobotsTxt(req, res) {
|
|
5088
5250
|
try {
|
|
5089
|
-
const sitemapPath = _optionalChain([this, 'access',
|
|
5251
|
+
const sitemapPath = _optionalChain([this, 'access', _160 => _160.routeManager, 'access', _161 => _161.matchMetadataRoute, 'call', _162 => _162("/sitemap.xml"), 'optionalAccess', _163 => _163.metadata, 'access', _164 => _164.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
|
|
5090
5252
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
5091
5253
|
const rootMetadata = sitemapPath && rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
5092
5254
|
const robots = _chunkZUVAGMQ5cjs.createFarmAgentRobots.call(void 0, {
|
|
5093
5255
|
crawlers: this.getAgentCrawlers(),
|
|
5094
5256
|
sitemapPath,
|
|
5095
|
-
metadataBase: _optionalChain([rootMetadata, 'optionalAccess',
|
|
5257
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _165 => _165.metadataBase]),
|
|
5096
5258
|
basePath: this.config.basePath
|
|
5097
5259
|
});
|
|
5098
5260
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5099
5261
|
res,
|
|
5100
|
-
|
|
5262
|
+
_chunkC5AM2XDNcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
|
|
5101
5263
|
);
|
|
5102
5264
|
} catch (error) {
|
|
5103
5265
|
_chunkQMNWKQL4cjs.logger.error(`Generated robots.txt failed: ${error}`);
|
|
@@ -5111,13 +5273,13 @@ var ServerRenderer = class {
|
|
|
5111
5273
|
}
|
|
5112
5274
|
}
|
|
5113
5275
|
getAgentSitemap() {
|
|
5114
|
-
return _chunkZUVAGMQ5cjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access',
|
|
5276
|
+
return _chunkZUVAGMQ5cjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _166 => _166.config, 'access', _167 => _167.agent, 'optionalAccess', _168 => _168.sitemap]));
|
|
5115
5277
|
}
|
|
5116
5278
|
/** `/sitemap.xml` from `agent.sitemap` when no sitemap.ts owns it. */
|
|
5117
5279
|
async renderGeneratedSitemap(req, res) {
|
|
5118
5280
|
try {
|
|
5119
5281
|
const request2 = _chunkHDPT6OYEcjs.createWebRequestFromFarmRequest.call(void 0, req, {
|
|
5120
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5282
|
+
trustProxy: _optionalChain([this, 'access', _169 => _169.config, 'access', _170 => _170.server, 'optionalAccess', _171 => _171.trustProxy])
|
|
5121
5283
|
});
|
|
5122
5284
|
const sources = await Promise.all(
|
|
5123
5285
|
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
@@ -5128,8 +5290,8 @@ var ServerRenderer = class {
|
|
|
5128
5290
|
}),
|
|
5129
5291
|
fs5.promises.stat(route.modulePath).catch(() => void 0)
|
|
5130
5292
|
]);
|
|
5131
|
-
if (await this.isAgentPageNoIndex(pattern, _optionalChain([module, 'optionalAccess',
|
|
5132
|
-
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess',
|
|
5293
|
+
if (await this.isAgentPageNoIndex(pattern, _optionalChain([module, 'optionalAccess', _172 => _172.metadata]))) return null;
|
|
5294
|
+
return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _173 => _173.mtime, 'access', _174 => _174.toISOString, 'call', _175 => _175()]) };
|
|
5133
5295
|
})
|
|
5134
5296
|
);
|
|
5135
5297
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
@@ -5139,15 +5301,15 @@ var ServerRenderer = class {
|
|
|
5139
5301
|
{
|
|
5140
5302
|
origin: new URL(request2.url).origin,
|
|
5141
5303
|
config: this.getAgentSitemap(),
|
|
5142
|
-
metadataBase: _optionalChain([rootMetadata, 'optionalAccess',
|
|
5304
|
+
metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _176 => _176.metadataBase]),
|
|
5143
5305
|
basePath: this.config.basePath,
|
|
5144
5306
|
trailingSlash: this.config.trailingSlash,
|
|
5145
|
-
i18n: _optionalChain([this, 'access',
|
|
5307
|
+
i18n: _optionalChain([this, 'access', _177 => _177.i18nRuntime, 'optionalAccess', _178 => _178.config])
|
|
5146
5308
|
}
|
|
5147
5309
|
);
|
|
5148
5310
|
await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
|
|
5149
5311
|
res,
|
|
5150
|
-
|
|
5312
|
+
_chunkC5AM2XDNcjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
|
|
5151
5313
|
);
|
|
5152
5314
|
} catch (error) {
|
|
5153
5315
|
_chunkQMNWKQL4cjs.logger.error(`Generated sitemap.xml failed: ${error}`);
|
|
@@ -5174,9 +5336,9 @@ var ServerRenderer = class {
|
|
|
5174
5336
|
* matcher) covers, as the production build decides.
|
|
5175
5337
|
*/
|
|
5176
5338
|
getAgentListedRoutes() {
|
|
5177
|
-
const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access',
|
|
5339
|
+
const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _179 => _179.middlewareRoutes, 'optionalCall', _180 => _180()]), () => ( [])) };
|
|
5178
5340
|
return [...this.routeManager.getRoutes()].filter(
|
|
5179
|
-
([pattern]) => !pattern.includes("[") && !
|
|
5341
|
+
([pattern]) => !pattern.includes("[") && !_chunkC5AM2XDNcjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
|
|
5180
5342
|
);
|
|
5181
5343
|
}
|
|
5182
5344
|
/**
|
|
@@ -5200,22 +5362,22 @@ var ServerRenderer = class {
|
|
|
5200
5362
|
* or a registered server such as the docs engine's. Production applies the same rules.
|
|
5201
5363
|
*/
|
|
5202
5364
|
getDefaultMCPServer() {
|
|
5203
|
-
if (_optionalChain([this, 'access',
|
|
5204
|
-
if (_optionalChain([this, 'access',
|
|
5365
|
+
if (_optionalChain([this, 'access', _181 => _181.config, 'access', _182 => _182.agent, 'optionalAccess', _183 => _183.mcp]) !== true || _chunkTP4RAV7Ycjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
|
|
5366
|
+
if (_optionalChain([this, 'access', _184 => _184.apiRouteExists, 'optionalCall', _185 => _185("/api/mcp")])) return void 0;
|
|
5205
5367
|
if (this.routeManager.matchRoute(_chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
|
|
5206
5368
|
_nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkTP4RAV7Ycjs.createFarmDefaultMCPServer.call(void 0,
|
|
5207
5369
|
readAppPackageIdentity(this.config.root),
|
|
5208
|
-
|
|
5370
|
+
_chunkZDZUFD67cjs.FARM_VERSION
|
|
5209
5371
|
))));
|
|
5210
5372
|
return _chunkTP4RAV7Ycjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
|
|
5211
5373
|
}
|
|
5212
5374
|
async renderDefaultMCP(req, res) {
|
|
5213
5375
|
const server = this.getDefaultMCPServer();
|
|
5214
|
-
const request2 = _nullishCoalesce(_chunkHDPT6OYEcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHDPT6OYEcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
5376
|
+
const request2 = _nullishCoalesce(_chunkHDPT6OYEcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHDPT6OYEcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _186 => _186.config, 'access', _187 => _187.server, 'optionalAccess', _188 => _188.trustProxy]) })));
|
|
5215
5377
|
try {
|
|
5216
5378
|
const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-KE4J3W7S.cjs");
|
|
5217
5379
|
const origin = new URL(request2.url).origin;
|
|
5218
|
-
const i18n = _optionalChain([this, 'access',
|
|
5380
|
+
const i18n = _optionalChain([this, 'access', _189 => _189.i18nRuntime, 'optionalAccess', _190 => _190.config]);
|
|
5219
5381
|
const metadataBase = await this.getRootMetadataBase();
|
|
5220
5382
|
const response = await handleFarmDefaultMCPRequest(request2, {
|
|
5221
5383
|
server,
|
|
@@ -5263,7 +5425,7 @@ var ServerRenderer = class {
|
|
|
5263
5425
|
}
|
|
5264
5426
|
/** Same inputs the production server gives llms.txt: static pages and root metadata. */
|
|
5265
5427
|
async createLlmsTxtContext(request2, options = {}) {
|
|
5266
|
-
const config = _chunkO32QPFVVcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access',
|
|
5428
|
+
const config = _chunkO32QPFVVcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _191 => _191.config, 'access', _192 => _192.agent, 'optionalAccess', _193 => _193.llmsTxt]));
|
|
5267
5429
|
const origin = await this.getAgentOrigin(request2);
|
|
5268
5430
|
const sources = await Promise.all(
|
|
5269
5431
|
this.getAgentListedRoutes().map(async ([pattern, route]) => {
|
|
@@ -5289,7 +5451,7 @@ var ServerRenderer = class {
|
|
|
5289
5451
|
include: config.include,
|
|
5290
5452
|
exclude: config.exclude,
|
|
5291
5453
|
trailingSlash: this.config.trailingSlash,
|
|
5292
|
-
i18n: _optionalChain([this, 'access',
|
|
5454
|
+
i18n: _optionalChain([this, 'access', _194 => _194.i18nRuntime, 'optionalAccess', _195 => _195.config])
|
|
5293
5455
|
}
|
|
5294
5456
|
);
|
|
5295
5457
|
return {
|
|
@@ -5299,7 +5461,7 @@ var ServerRenderer = class {
|
|
|
5299
5461
|
pages,
|
|
5300
5462
|
config,
|
|
5301
5463
|
rootMetadata,
|
|
5302
|
-
mcp: _optionalChain([this, 'access',
|
|
5464
|
+
mcp: _optionalChain([this, 'access', _196 => _196.config, 'access', _197 => _197.agent, 'optionalAccess', _198 => _198.aiCatalog]) === false ? [] : _chunkFSSONJRVcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
|
|
5303
5465
|
basePath: this.config.basePath,
|
|
5304
5466
|
apiServerBasePath: _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0,
|
|
5305
5467
|
_chunkPMJSG4JScjs.normalizeFarmAPIConfig.call(void 0,
|
|
@@ -5329,7 +5491,7 @@ var ServerRenderer = class {
|
|
|
5329
5491
|
async getRootMetadataBase() {
|
|
5330
5492
|
const rootLayout = this.routeManager.getLayouts().get("/");
|
|
5331
5493
|
const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
|
|
5332
|
-
return _optionalChain([rootMetadata, 'optionalAccess',
|
|
5494
|
+
return _optionalChain([rootMetadata, 'optionalAccess', _199 => _199.metadataBase]);
|
|
5333
5495
|
}
|
|
5334
5496
|
/**
|
|
5335
5497
|
* Reads page mirrors back through this dev server, the way its .md handler
|
|
@@ -5341,8 +5503,8 @@ var ServerRenderer = class {
|
|
|
5341
5503
|
* body is discarded.
|
|
5342
5504
|
*/
|
|
5343
5505
|
createDevMarkdownReader(req) {
|
|
5344
|
-
const socket = _optionalChain([req, 'optionalAccess',
|
|
5345
|
-
if (_optionalChain([req, 'optionalAccess',
|
|
5506
|
+
const socket = _optionalChain([req, 'optionalAccess', _200 => _200.socket]);
|
|
5507
|
+
if (_optionalChain([req, 'optionalAccess', _201 => _201.method, 'optionalAccess', _202 => _202.toUpperCase, 'call', _203 => _203()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _204 => _204.localAddress]) || !socket.localPort) {
|
|
5346
5508
|
return async () => null;
|
|
5347
5509
|
}
|
|
5348
5510
|
if (socket.encrypted) {
|
|
@@ -5408,7 +5570,7 @@ var ServerRenderer = class {
|
|
|
5408
5570
|
}
|
|
5409
5571
|
const etag = `"${image.staticInfo.hash}"`;
|
|
5410
5572
|
const requestUrl = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
5411
|
-
trustProxy: _optionalChain([this, 'access',
|
|
5573
|
+
trustProxy: _optionalChain([this, 'access', _205 => _205.config, 'access', _206 => _206.server, 'optionalAccess', _207 => _207.trustProxy])
|
|
5412
5574
|
});
|
|
5413
5575
|
const isVersioned = requestUrl.searchParams.get("v") === image.staticInfo.hash;
|
|
5414
5576
|
res.setHeader("Content-Type", image.staticInfo.contentType);
|
|
@@ -5473,7 +5635,7 @@ var ServerRenderer = class {
|
|
|
5473
5635
|
options.middlewareMap,
|
|
5474
5636
|
() => _chunkYDXLC4DWcjs._runWithMiddlewareContext.call(void 0,
|
|
5475
5637
|
options.middlewareContext,
|
|
5476
|
-
() => this.
|
|
5638
|
+
() => this.renderElementToCompleteHTML(wrapped)
|
|
5477
5639
|
)
|
|
5478
5640
|
);
|
|
5479
5641
|
res.statusCode = options.statusCode;
|
|
@@ -5584,11 +5746,11 @@ window.__FARM_PAGE_MODULE__ = ${JSON.stringify(relativePath)};
|
|
|
5584
5746
|
window.__FARM_LOADING_MODULE__ = ${JSON.stringify(req.__FARM_LOADING_MODULE_PATH__ || null)};
|
|
5585
5747
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
5586
5748
|
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkJX5VOLAVcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
5587
|
-
window.__FARM_I18N__ = ${
|
|
5749
|
+
window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
|
|
5588
5750
|
</script>`);
|
|
5589
5751
|
const deferredScript = farmScripts(createDeferredHydrationScript(deferredProps.records));
|
|
5590
5752
|
const rendererHydrationScript = farmScripts(
|
|
5591
|
-
_optionalChain([this, 'access',
|
|
5753
|
+
_optionalChain([this, 'access', _208 => _208.rendererRuntime, 'access', _209 => _209.generateHydrationScript, 'optionalCall', _210 => _210()]) || ""
|
|
5592
5754
|
);
|
|
5593
5755
|
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
5594
5756
|
const farmClientScript = farmScripts(
|
|
@@ -5598,7 +5760,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5598
5760
|
element,
|
|
5599
5761
|
{
|
|
5600
5762
|
rejectLateNavigation: _chunkC2JOS77Zcjs._isFarmMarkdownPageCheck.call(void 0,
|
|
5601
|
-
_optionalChain([req, 'access',
|
|
5763
|
+
_optionalChain([req, 'access', _211 => _211.headers, 'optionalAccess', _212 => _212[_chunkC2JOS77Zcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])
|
|
5602
5764
|
)
|
|
5603
5765
|
}
|
|
5604
5766
|
);
|
|
@@ -5610,29 +5772,29 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5610
5772
|
viewport: viewportTags
|
|
5611
5773
|
} = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
5612
5774
|
pathname: getFarmMetadataPathname(req),
|
|
5613
|
-
jsonLd: _optionalChain([this, 'access',
|
|
5775
|
+
jsonLd: _optionalChain([this, 'access', _213 => _213.config, 'access', _214 => _214.agent, 'optionalAccess', _215 => _215.jsonLd])
|
|
5614
5776
|
});
|
|
5615
5777
|
const documentTitleTag = !hasExplicitTitle && /<title[\s>]/i.test(rendererHead) ? "" : `<title>${title}</title>`;
|
|
5616
5778
|
const rendererHasTitle = /<title[\s>]/i.test(rendererHead);
|
|
5617
|
-
const i18nSnapshot =
|
|
5779
|
+
const i18nSnapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
5618
5780
|
const alternateTags = i18nSnapshot ? renderI18nAlternateLinks(
|
|
5619
5781
|
req.__FARM_ROUTE__ || req.url || "/",
|
|
5620
5782
|
i18nSnapshot,
|
|
5621
5783
|
this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
|
|
5622
5784
|
) : "";
|
|
5623
|
-
const themeDocument =
|
|
5785
|
+
const themeDocument = _chunkC5AM2XDNcjs.createFarmThemeDocumentParts.call(void 0,
|
|
5624
5786
|
this.config.theme,
|
|
5625
5787
|
this.config.basePath,
|
|
5626
5788
|
_chunkQIXEU2WVcjs.getTheme.call(void 0, )
|
|
5627
5789
|
);
|
|
5628
5790
|
themeDocument.head = farmScripts(themeDocument.head);
|
|
5629
|
-
const fullDocument =
|
|
5791
|
+
const fullDocument = _chunkC5AM2XDNcjs.extractFarmFullDocument.call(void 0, content);
|
|
5630
5792
|
let html;
|
|
5631
5793
|
if (fullDocument) {
|
|
5632
5794
|
const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
|
|
5633
|
-
const documentHtml = shouldReplaceLayoutTitle ?
|
|
5634
|
-
const effectiveRendererHead = hasExplicitTitle ?
|
|
5635
|
-
html =
|
|
5795
|
+
const documentHtml = shouldReplaceLayoutTitle ? _chunkC5AM2XDNcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
|
|
5796
|
+
const effectiveRendererHead = hasExplicitTitle ? _chunkC5AM2XDNcjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
|
|
5797
|
+
html = _chunkC5AM2XDNcjs.composeFarmFullDocument.call(void 0, documentHtml, {
|
|
5636
5798
|
fallbackIcon: !hasFavicon,
|
|
5637
5799
|
viewport: viewportTags,
|
|
5638
5800
|
htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
|
|
@@ -5658,7 +5820,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5658
5820
|
});
|
|
5659
5821
|
} else {
|
|
5660
5822
|
html = `<!DOCTYPE html>
|
|
5661
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
5823
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _216 => _216.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
5662
5824
|
<head>
|
|
5663
5825
|
${themeDocument.head}
|
|
5664
5826
|
<meta charset="utf-8">
|
|
@@ -5689,7 +5851,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5689
5851
|
const securedHtml = this.secureDocumentHTML(req, html);
|
|
5690
5852
|
if ((req.method || "GET").toUpperCase() !== "HEAD") res.write(securedHtml);
|
|
5691
5853
|
res.end();
|
|
5692
|
-
if (!options.captureStaticShell) await _optionalChain([options, 'access',
|
|
5854
|
+
if (!options.captureStaticShell) await _optionalChain([options, 'access', _217 => _217.onComplete, 'optionalCall', _218 => _218(securedHtml)]);
|
|
5693
5855
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
5694
5856
|
type: "render.stream.complete",
|
|
5695
5857
|
route,
|
|
@@ -5699,7 +5861,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5699
5861
|
emitFarmRenderError(req, route, error);
|
|
5700
5862
|
throw error;
|
|
5701
5863
|
} finally {
|
|
5702
|
-
_optionalChain([clearMiddlewareData, 'optionalCall',
|
|
5864
|
+
_optionalChain([clearMiddlewareData, 'optionalCall', _219 => _219()]);
|
|
5703
5865
|
}
|
|
5704
5866
|
}
|
|
5705
5867
|
/**
|
|
@@ -5714,7 +5876,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5714
5876
|
if (!rootLayout) return false;
|
|
5715
5877
|
try {
|
|
5716
5878
|
const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
|
|
5717
|
-
if (typeof Layout !== "function" || _optionalChain([Layout, 'access',
|
|
5879
|
+
if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _220 => _220.prototype, 'optionalAccess', _221 => _221.isReactComponent]) || _optionalChain([Layout, 'access', _222 => _222.constructor, 'optionalAccess', _223 => _223.name]) === "AsyncFunction") {
|
|
5718
5880
|
return false;
|
|
5719
5881
|
}
|
|
5720
5882
|
const cached = documentLayouts.get(Layout);
|
|
@@ -5726,12 +5888,12 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5726
5888
|
params: {}
|
|
5727
5889
|
});
|
|
5728
5890
|
rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
|
|
5729
|
-
} catch (
|
|
5891
|
+
} catch (e16) {
|
|
5730
5892
|
rendersDocument = false;
|
|
5731
5893
|
}
|
|
5732
5894
|
documentLayouts.set(Layout, rendersDocument);
|
|
5733
5895
|
return rendersDocument;
|
|
5734
|
-
} catch (
|
|
5896
|
+
} catch (e17) {
|
|
5735
5897
|
return false;
|
|
5736
5898
|
}
|
|
5737
5899
|
}
|
|
@@ -5739,7 +5901,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5739
5901
|
const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
|
|
5740
5902
|
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
5741
5903
|
const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
|
|
5742
|
-
if (!renderToPipeableStream || _chunkC2JOS77Zcjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access',
|
|
5904
|
+
if (!renderToPipeableStream || _chunkC2JOS77Zcjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access', _224 => _224.headers, 'optionalAccess', _225 => _225[_chunkC2JOS77Zcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])) || streamDocument && (options.captureStaticShell || !_chunk67MZTLTFcjs.isReactRenderer.call(void 0, this.config.renderer))) {
|
|
5743
5905
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
5744
5906
|
}
|
|
5745
5907
|
return new Promise((resolve3, reject) => {
|
|
@@ -5856,7 +6018,7 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
|
|
|
5856
6018
|
)};
|
|
5857
6019
|
window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
|
|
5858
6020
|
window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkJX5VOLAVcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
|
|
5859
|
-
window.__FARM_I18N__ = ${
|
|
6021
|
+
window.__FARM_I18N__ = ${_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
|
|
5860
6022
|
</script>${_chunkW44X6IC2cjs.renderFarmFormStateScript.call(void 0, )}`;
|
|
5861
6023
|
const islandsOnlyPage = this.islandValues() && req.__FARM_PAGE_SHOULD_HYDRATE__ !== true && req.__FARM_LAYOUT_SHOULD_HYDRATE__ !== true && req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ !== true;
|
|
5862
6024
|
const rootStrategy = req.__FARM_ISLAND_STRATEGY__;
|
|
@@ -5871,16 +6033,16 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5871
6033
|
viewport: viewportTags
|
|
5872
6034
|
} = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
|
|
5873
6035
|
pathname: getFarmMetadataPathname(req),
|
|
5874
|
-
jsonLd: _optionalChain([this, 'access',
|
|
6036
|
+
jsonLd: _optionalChain([this, 'access', _226 => _226.config, 'access', _227 => _227.agent, 'optionalAccess', _228 => _228.jsonLd])
|
|
5875
6037
|
});
|
|
5876
|
-
const i18nSnapshot =
|
|
6038
|
+
const i18nSnapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
5877
6039
|
const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(
|
|
5878
6040
|
req.__FARM_ROUTE__ || req.url || "/",
|
|
5879
6041
|
i18nSnapshot,
|
|
5880
6042
|
this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
|
|
5881
6043
|
) : "";
|
|
5882
6044
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
5883
|
-
const themeDocument =
|
|
6045
|
+
const themeDocument = _chunkC5AM2XDNcjs.createFarmThemeDocumentParts.call(void 0,
|
|
5884
6046
|
this.config.theme,
|
|
5885
6047
|
this.config.basePath,
|
|
5886
6048
|
_chunkQIXEU2WVcjs.getTheme.call(void 0, )
|
|
@@ -5899,7 +6061,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5899
6061
|
formState: _chunkW44X6IC2cjs.getFarmFormState.call(void 0, ),
|
|
5900
6062
|
onShellReady() {
|
|
5901
6063
|
if (pendingNavigationError) {
|
|
5902
|
-
_optionalChain([abort, 'optionalCall',
|
|
6064
|
+
_optionalChain([abort, 'optionalCall', _229 => _229(pendingNavigationError)]);
|
|
5903
6065
|
if (clearMiddlewareData) {
|
|
5904
6066
|
clearMiddlewareData();
|
|
5905
6067
|
}
|
|
@@ -5917,7 +6079,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5917
6079
|
console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
|
|
5918
6080
|
}
|
|
5919
6081
|
const shell = `<!DOCTYPE html>
|
|
5920
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
6082
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _230 => _230.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
5921
6083
|
<head>
|
|
5922
6084
|
${themeDocument.head}
|
|
5923
6085
|
<meta charset="utf-8">
|
|
@@ -5935,11 +6097,20 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5935
6097
|
<body class="">${earlyClient ? `
|
|
5936
6098
|
${earlyClientScript}` : ""}
|
|
5937
6099
|
<div id="root">`;
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
6100
|
+
let pendingShell = streamDocument ? "" : stampDocumentHTML(shell);
|
|
6101
|
+
let heldHead = "";
|
|
6102
|
+
const releaseShell = (complete) => {
|
|
6103
|
+
const split = _chunkC5AM2XDNcjs.takeFarmHoistedHead.call(void 0, heldHead, complete);
|
|
6104
|
+
if (!split) return null;
|
|
6105
|
+
const shellHead = !hasExplicitTitle && /<title[\s>]/i.test(split.head) ? _chunkC5AM2XDNcjs.removeFarmDocumentTitles.call(void 0, pendingShell) : pendingShell;
|
|
6106
|
+
const opened = _chunkC5AM2XDNcjs.appendFarmHead.call(void 0, shellHead, split.head);
|
|
6107
|
+
pendingShell = "";
|
|
6108
|
+
heldHead = "";
|
|
6109
|
+
htmlParts.push(opened);
|
|
6110
|
+
_optionalChain([staticShellParts, 'optionalAccess', _231 => _231.push, 'call', _232 => _232(opened)]);
|
|
6111
|
+
res.write(opened);
|
|
6112
|
+
return split.body;
|
|
6113
|
+
};
|
|
5943
6114
|
const withEarlyClient = (document) => earlyClient ? {
|
|
5944
6115
|
...document,
|
|
5945
6116
|
html: document.html.replace(
|
|
@@ -5948,10 +6119,10 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5948
6119
|
${stampDocumentHTML(earlyClientScript)}`
|
|
5949
6120
|
)
|
|
5950
6121
|
} : document;
|
|
5951
|
-
const documentTransform = streamDocument ?
|
|
6122
|
+
const documentTransform = streamDocument ? _chunkC5AM2XDNcjs.createFarmStreamedDocumentTransform.call(void 0,
|
|
5952
6123
|
(opening) => withEarlyClient(
|
|
5953
|
-
|
|
5954
|
-
hasExplicitTitle ?
|
|
6124
|
+
_chunkC5AM2XDNcjs.openFarmStreamedDocument.call(void 0,
|
|
6125
|
+
hasExplicitTitle ? _chunkC5AM2XDNcjs.removeFarmDocumentTitles.call(void 0, opening) : opening,
|
|
5955
6126
|
{
|
|
5956
6127
|
fallbackIcon: !hasFavicon,
|
|
5957
6128
|
viewport: viewportTags,
|
|
@@ -5990,7 +6161,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
5990
6161
|
const recordRenderedChunk = (chunkText, renderedText = chunkText) => {
|
|
5991
6162
|
if (!checkedFullDocument && renderedText) {
|
|
5992
6163
|
documentPrefix += renderedText;
|
|
5993
|
-
const prefix =
|
|
6164
|
+
const prefix = _chunkC5AM2XDNcjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
|
|
5994
6165
|
if (prefix !== "pending") {
|
|
5995
6166
|
checkedFullDocument = true;
|
|
5996
6167
|
documentPrefix = "";
|
|
@@ -6009,7 +6180,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6009
6180
|
staticShellClosed = true;
|
|
6010
6181
|
if (!suspenseHoleEmitted) {
|
|
6011
6182
|
suspenseHoleEmitted = true;
|
|
6012
|
-
_optionalChain([options, 'access',
|
|
6183
|
+
_optionalChain([options, 'access', _233 => _233.onSuspenseHoleDetected, 'optionalCall', _234 => _234()]);
|
|
6013
6184
|
}
|
|
6014
6185
|
} else {
|
|
6015
6186
|
staticShellParts.push(chunkText);
|
|
@@ -6019,6 +6190,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6019
6190
|
const writableStream = new (0, _stream.Writable)({
|
|
6020
6191
|
write(chunk, encoding, callback) {
|
|
6021
6192
|
if (flushMarker && chunk === flushMarker) {
|
|
6193
|
+
if (pendingShell) releaseShell(true);
|
|
6022
6194
|
const marker = documentTransform ? documentTransform.write(flushMarker.toString()) : flushMarker;
|
|
6023
6195
|
res.write(marker, () => {
|
|
6024
6196
|
if (typeof res.flush === "function") res.flush();
|
|
@@ -6031,7 +6203,18 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6031
6203
|
firstChunk = false;
|
|
6032
6204
|
}
|
|
6033
6205
|
const chunkText = Buffer.isBuffer(chunk) ? cspStreamDecoder ? cspStreamDecoder.decode(chunk, { stream: true }) : chunk.toString() : String(chunk);
|
|
6034
|
-
|
|
6206
|
+
let securedChunkText = cspNonceRewriter ? cspNonceRewriter.write(chunkText) : chunkText;
|
|
6207
|
+
let held = false;
|
|
6208
|
+
if (pendingShell) {
|
|
6209
|
+
heldHead += securedChunkText;
|
|
6210
|
+
const body = releaseShell(false);
|
|
6211
|
+
if (body === null) {
|
|
6212
|
+
callback();
|
|
6213
|
+
return;
|
|
6214
|
+
}
|
|
6215
|
+
securedChunkText = body;
|
|
6216
|
+
held = true;
|
|
6217
|
+
}
|
|
6035
6218
|
const outputText = documentTransform ? documentTransform.write(securedChunkText) : securedChunkText;
|
|
6036
6219
|
recordRenderedChunk(outputText, securedChunkText);
|
|
6037
6220
|
const onWrite = () => {
|
|
@@ -6041,10 +6224,18 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6041
6224
|
if (documentTransform) {
|
|
6042
6225
|
if (outputText) res.write(outputText, onWrite);
|
|
6043
6226
|
else callback();
|
|
6044
|
-
} else if (cspNonceRewriter) res.write(securedChunkText, onWrite);
|
|
6227
|
+
} else if (cspNonceRewriter || held) res.write(securedChunkText, onWrite);
|
|
6045
6228
|
else res.write(chunk, encoding, onWrite);
|
|
6046
6229
|
},
|
|
6047
6230
|
final: (callback) => {
|
|
6231
|
+
if (pendingShell) {
|
|
6232
|
+
const body = releaseShell(true);
|
|
6233
|
+
if (body) {
|
|
6234
|
+
htmlParts.push(body);
|
|
6235
|
+
_optionalChain([staticShellParts, 'optionalAccess', _235 => _235.push, 'call', _236 => _236(body)]);
|
|
6236
|
+
res.write(body);
|
|
6237
|
+
}
|
|
6238
|
+
}
|
|
6048
6239
|
if (lateNavigationError) {
|
|
6049
6240
|
const navigationError = lateNavigationError;
|
|
6050
6241
|
lateNavigationError = null;
|
|
@@ -6073,8 +6264,8 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6073
6264
|
recordRenderedChunk(tail, rewritten);
|
|
6074
6265
|
if (tail) res.write(tail);
|
|
6075
6266
|
}
|
|
6076
|
-
const documentEnd = _optionalChain([documentTransform, 'optionalAccess',
|
|
6077
|
-
if (_optionalChain([documentEnd, 'optionalAccess',
|
|
6267
|
+
const documentEnd = _optionalChain([documentTransform, 'optionalAccess', _237 => _237.end, 'call', _238 => _238()]);
|
|
6268
|
+
if (_optionalChain([documentEnd, 'optionalAccess', _239 => _239.text])) {
|
|
6078
6269
|
recordRenderedChunk(documentEnd.text, "");
|
|
6079
6270
|
res.write(documentEnd.text);
|
|
6080
6271
|
}
|
|
@@ -6085,7 +6276,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6085
6276
|
deferredHydrationScript: createDeferredHydrationScript(deferredProps.records),
|
|
6086
6277
|
earlyClient,
|
|
6087
6278
|
// A full document: Farm's #root closes only where Farm opened it.
|
|
6088
|
-
..._optionalChain([documentEnd, 'optionalAccess',
|
|
6279
|
+
..._optionalChain([documentEnd, 'optionalAccess', _240 => _240.document]) ? { closeRoot: documentEnd.rootOpened } : {}
|
|
6089
6280
|
})
|
|
6090
6281
|
);
|
|
6091
6282
|
htmlParts.push(footer);
|
|
@@ -6117,7 +6308,6 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6117
6308
|
});
|
|
6118
6309
|
resolve3();
|
|
6119
6310
|
};
|
|
6120
|
-
res.write(securedShell);
|
|
6121
6311
|
if (typeof res.flush === "function") {
|
|
6122
6312
|
res.flush();
|
|
6123
6313
|
}
|
|
@@ -6185,7 +6375,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6185
6375
|
};
|
|
6186
6376
|
}
|
|
6187
6377
|
localizeRedirectUrl(url) {
|
|
6188
|
-
const snapshot =
|
|
6378
|
+
const snapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
6189
6379
|
return snapshot && url.startsWith("/") && !url.startsWith("//") ? _chunkOWQV6MLMcjs.localizeFarmHref.call(void 0, url, snapshot.locale, snapshot) : url;
|
|
6190
6380
|
}
|
|
6191
6381
|
/** The app's not-found component, or null when it relies on the built-in page. */
|
|
@@ -6198,7 +6388,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6198
6388
|
return await this.routeManager.loadRouteModule(notFoundPath);
|
|
6199
6389
|
}
|
|
6200
6390
|
async loadNotFoundComponent() {
|
|
6201
|
-
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async
|
|
6391
|
+
return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _241 => _241.default]), async () => ( null));
|
|
6202
6392
|
}
|
|
6203
6393
|
/** The not-found document's head: layout and not-found metadata, as production renders it. */
|
|
6204
6394
|
async notFoundMetadataHead(layoutModule, notFoundModule) {
|
|
@@ -6221,34 +6411,33 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6221
6411
|
*/
|
|
6222
6412
|
async createLateNavigationRecoveryHTML(req, error) {
|
|
6223
6413
|
if (_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error)) {
|
|
6224
|
-
return
|
|
6414
|
+
return _chunkC5AM2XDNcjs.createLateRedirectRecovery.call(void 0,
|
|
6225
6415
|
this.localizeRedirectUrl(_chunk7JUIK547cjs.getFarmRedirectError.call(void 0, error).url),
|
|
6226
6416
|
this.getCspNonce(req) || ""
|
|
6227
6417
|
);
|
|
6228
6418
|
}
|
|
6229
6419
|
const pathname = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
6230
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6420
|
+
trustProxy: _optionalChain([this, 'access', _242 => _242.config, 'access', _243 => _243.server, 'optionalAccess', _244 => _244.trustProxy])
|
|
6231
6421
|
}).pathname;
|
|
6232
6422
|
let content = this.defaultNotFoundContent();
|
|
6233
6423
|
const NotFoundComponent = await this.loadNotFoundComponent();
|
|
6234
6424
|
if (NotFoundComponent) {
|
|
6235
6425
|
try {
|
|
6236
|
-
content = await this.
|
|
6426
|
+
content = await this.renderElementToCompleteHTML(
|
|
6237
6427
|
await this.wrapWithIntegrationProviders(
|
|
6238
6428
|
this.rendererRuntime.createElement(NotFoundComponent, { pathname })
|
|
6239
|
-
)
|
|
6240
|
-
rendererRenderOptions()
|
|
6429
|
+
)
|
|
6241
6430
|
);
|
|
6242
6431
|
} catch (error2) {
|
|
6243
6432
|
_chunkQMNWKQL4cjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
|
|
6244
6433
|
}
|
|
6245
6434
|
}
|
|
6246
|
-
return
|
|
6435
|
+
return _chunkC5AM2XDNcjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
|
|
6247
6436
|
}
|
|
6248
6437
|
async render404(req, res) {
|
|
6249
6438
|
res.statusCode = 404;
|
|
6250
6439
|
const pathname = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
6251
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6440
|
+
trustProxy: _optionalChain([this, 'access', _245 => _245.config, 'access', _246 => _246.server, 'optionalAccess', _247 => _247.trustProxy])
|
|
6252
6441
|
}).pathname;
|
|
6253
6442
|
if (_chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, this.config.renderer)) {
|
|
6254
6443
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -6289,9 +6478,9 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6289
6478
|
);
|
|
6290
6479
|
if (notFoundPath) {
|
|
6291
6480
|
const notFoundModule = await this.loadNotFoundModule();
|
|
6292
|
-
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess',
|
|
6481
|
+
const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _248 => _248.default]), () => ( null));
|
|
6293
6482
|
if (NotFoundComponent) {
|
|
6294
|
-
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess',
|
|
6483
|
+
const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _249 => _249.default]), () => ( null));
|
|
6295
6484
|
let element = this.rendererRuntime.createElement(NotFoundComponent, { pathname });
|
|
6296
6485
|
if (LayoutComponent) {
|
|
6297
6486
|
element = this.rendererRuntime.createElement(LayoutComponent, {
|
|
@@ -6299,10 +6488,7 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6299
6488
|
});
|
|
6300
6489
|
}
|
|
6301
6490
|
element = await this.wrapWithIntegrationProviders(element);
|
|
6302
|
-
const content = await this.
|
|
6303
|
-
element,
|
|
6304
|
-
rendererRenderOptions()
|
|
6305
|
-
);
|
|
6491
|
+
const content = await this.renderElementToCompleteHTML(element);
|
|
6306
6492
|
const { head: head2, metadata: metadata2 } = await this.notFoundMetadataHead(layoutModule, notFoundModule);
|
|
6307
6493
|
const html2 = this.createFullHTML(content, false, pathname, head2, { req, metadata: metadata2 });
|
|
6308
6494
|
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
@@ -6331,23 +6517,23 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6331
6517
|
res.statusCode = statusCode;
|
|
6332
6518
|
const isDev = process.env.NODE_ENV === "development";
|
|
6333
6519
|
const requestUrl = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
6334
|
-
trustProxy: _optionalChain([this, 'access',
|
|
6520
|
+
trustProxy: _optionalChain([this, 'access', _250 => _250.config, 'access', _251 => _251.server, 'optionalAccess', _252 => _252.trustProxy])
|
|
6335
6521
|
});
|
|
6336
6522
|
const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
|
|
6337
|
-
const statusText =
|
|
6523
|
+
const statusText = _chunkC5AM2XDNcjs.getDefaultErrorStatusText.call(void 0, statusCode);
|
|
6338
6524
|
const content = this.stampFarmScripts(
|
|
6339
6525
|
req,
|
|
6340
|
-
|
|
6526
|
+
_chunkC5AM2XDNcjs.createDefaultErrorMarkup.call(void 0, {
|
|
6341
6527
|
statusCode,
|
|
6342
6528
|
statusText,
|
|
6343
6529
|
requestPath: requestUrl.pathname,
|
|
6344
6530
|
method: req.method || "GET",
|
|
6345
|
-
message: _optionalChain([diagnostics, 'optionalAccess',
|
|
6346
|
-
errorName: _optionalChain([diagnostics, 'optionalAccess',
|
|
6347
|
-
stack: _optionalChain([diagnostics, 'optionalAccess',
|
|
6348
|
-
sourceFrame: _optionalChain([diagnostics, 'optionalAccess',
|
|
6531
|
+
message: _optionalChain([diagnostics, 'optionalAccess', _253 => _253.message]),
|
|
6532
|
+
errorName: _optionalChain([diagnostics, 'optionalAccess', _254 => _254.name]),
|
|
6533
|
+
stack: _optionalChain([diagnostics, 'optionalAccess', _255 => _255.stack]),
|
|
6534
|
+
sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _256 => _256.sourceFrame]),
|
|
6349
6535
|
development: isDev,
|
|
6350
|
-
farmVersion:
|
|
6536
|
+
farmVersion: _chunkZDZUFD67cjs.FARM_VERSION,
|
|
6351
6537
|
nodeVersion: process.version,
|
|
6352
6538
|
mode: isDev ? "development" : "production"
|
|
6353
6539
|
})
|
|
@@ -6373,12 +6559,12 @@ window.__FARM_I18N__ = ${_chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0
|
|
|
6373
6559
|
*/
|
|
6374
6560
|
getI18nAlternateOptions(req, metadata) {
|
|
6375
6561
|
return {
|
|
6376
|
-
metadataBase: _optionalChain([metadata, 'optionalAccess',
|
|
6377
|
-
origin: req ? _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access',
|
|
6562
|
+
metadataBase: _optionalChain([metadata, 'optionalAccess', _257 => _257.metadataBase]),
|
|
6563
|
+
origin: req ? _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _258 => _258.config, 'access', _259 => _259.server, 'optionalAccess', _260 => _260.trustProxy]) }).origin : void 0
|
|
6378
6564
|
};
|
|
6379
6565
|
}
|
|
6380
6566
|
createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
|
|
6381
|
-
const i18nSnapshot =
|
|
6567
|
+
const i18nSnapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
6382
6568
|
const farmScripts = (html) => this.stampFarmScripts(alternates.req, html);
|
|
6383
6569
|
const clientScript = isClientComponent ? ` ${farmScripts(`<script type="module" src="/@farm/client.js"></script>`)}` : "";
|
|
6384
6570
|
const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
|
|
@@ -6393,20 +6579,20 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
6393
6579
|
this.getI18nAlternateOptions(alternates.req, alternates.metadata)
|
|
6394
6580
|
) : "";
|
|
6395
6581
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
6396
|
-
const themeDocument =
|
|
6582
|
+
const themeDocument = _chunkC5AM2XDNcjs.createFarmThemeDocumentParts.call(void 0,
|
|
6397
6583
|
this.config.theme,
|
|
6398
6584
|
this.config.basePath,
|
|
6399
6585
|
_chunkQIXEU2WVcjs.getTheme.call(void 0, )
|
|
6400
6586
|
);
|
|
6401
6587
|
themeDocument.head = farmScripts(themeDocument.head);
|
|
6402
6588
|
const rendererHydrationScript = farmScripts(
|
|
6403
|
-
_optionalChain([this, 'access',
|
|
6589
|
+
_optionalChain([this, 'access', _261 => _261.rendererRuntime, 'access', _262 => _262.generateHydrationScript, 'optionalCall', _263 => _263()]) || ""
|
|
6404
6590
|
);
|
|
6405
|
-
const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access',
|
|
6406
|
-
const fullDocument =
|
|
6591
|
+
const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _264 => _264.metadata, 'optionalAccess', _265 => _265.viewport]));
|
|
6592
|
+
const fullDocument = _chunkC5AM2XDNcjs.extractFarmFullDocument.call(void 0, content);
|
|
6407
6593
|
if (fullDocument) {
|
|
6408
|
-
return
|
|
6409
|
-
metadataHead ?
|
|
6594
|
+
return _chunkC5AM2XDNcjs.composeFarmFullDocument.call(void 0,
|
|
6595
|
+
metadataHead ? _chunkC5AM2XDNcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
|
|
6410
6596
|
{
|
|
6411
6597
|
fallbackIcon: !metadataHead,
|
|
6412
6598
|
viewport: viewportTags,
|
|
@@ -6432,7 +6618,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
6432
6618
|
);
|
|
6433
6619
|
}
|
|
6434
6620
|
return `<!DOCTYPE html>
|
|
6435
|
-
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
6621
|
+
<html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _266 => _266.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
6436
6622
|
<head>
|
|
6437
6623
|
${themeDocument.head}
|
|
6438
6624
|
<meta charset="utf-8">
|
|
@@ -6474,7 +6660,7 @@ ${clientScript}
|
|
|
6474
6660
|
res.setHeader(_chunkNLBHLPEOcjs.FARM_DEPLOYMENT_ID_HEADER, deploymentId);
|
|
6475
6661
|
if ((req.method || "GET").toUpperCase() !== "GET") return;
|
|
6476
6662
|
const forwardedProto = req.headers["x-forwarded-proto"];
|
|
6477
|
-
const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess',
|
|
6663
|
+
const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _267 => _267.split, 'call', _268 => _268(","), 'access', _269 => _269[0], 'optionalAccess', _270 => _270.trim, 'call', _271 => _271()]) === "https" || Boolean(_optionalChain([req, 'access', _272 => _272.socket, 'optionalAccess', _273 => _273.encrypted]));
|
|
6478
6664
|
const cookie = _chunkNLBHLPEOcjs.createFarmDeploymentCookie.call(void 0, deploymentId, this.config.basePath || "/", isSecure);
|
|
6479
6665
|
const existing = res.getHeader("Set-Cookie");
|
|
6480
6666
|
if (Array.isArray(existing)) {
|
|
@@ -6516,8 +6702,8 @@ var FarmApp = class {
|
|
|
6516
6702
|
this.config = this.normalizeConfig(config);
|
|
6517
6703
|
_chunkEVIWKPJVcjs.configureFarmObservability.call(void 0, this.config.observability);
|
|
6518
6704
|
_chunkQIXEU2WVcjs._setDefaultFarmThemeConfig.call(void 0, this.config.theme);
|
|
6519
|
-
this.i18nRuntime =
|
|
6520
|
-
|
|
6705
|
+
this.i18nRuntime = _chunkNLBK37HIcjs.createFarmI18nRuntime.call(void 0, this.config.i18n);
|
|
6706
|
+
_chunkNLBK37HIcjs._setDefaultFarmI18nRuntime.call(void 0, this.i18nRuntime);
|
|
6521
6707
|
this.viteServer = viteServer;
|
|
6522
6708
|
this.routeManager = new RouteManager(this.config, viteServer);
|
|
6523
6709
|
this.serverRenderer = new ServerRenderer(
|
|
@@ -6591,7 +6777,7 @@ var FarmApp = class {
|
|
|
6591
6777
|
),
|
|
6592
6778
|
performance: _chunkZUVAGMQ5cjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
|
|
6593
6779
|
theme: _chunkWT6RAN2Icjs.resolveFarmThemeConfig.call(void 0, config.theme, basePath),
|
|
6594
|
-
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n :
|
|
6780
|
+
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : _chunkZMSVKVI3cjs.resolveFarmI18nConfig.call(void 0, config.i18n, {
|
|
6595
6781
|
root,
|
|
6596
6782
|
mode: process.env.NODE_ENV === "production" ? "production" : "development",
|
|
6597
6783
|
basePath
|
|
@@ -6617,10 +6803,10 @@ var FarmApp = class {
|
|
|
6617
6803
|
env: config.env || { server: {}, public: {} },
|
|
6618
6804
|
suppressLintOnLink: _nullishCoalesce(config.suppressLintOnLink, () => ( false)),
|
|
6619
6805
|
experimental: {
|
|
6620
|
-
serverComponents: _nullishCoalesce(_optionalChain([config, 'access',
|
|
6621
|
-
serverActions: _nullishCoalesce(_optionalChain([config, 'access',
|
|
6622
|
-
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access',
|
|
6623
|
-
ppr: _nullishCoalesce(_optionalChain([config, 'access',
|
|
6806
|
+
serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _274 => _274.experimental, 'optionalAccess', _275 => _275.serverComponents]), () => ( false)),
|
|
6807
|
+
serverActions: _nullishCoalesce(_optionalChain([config, 'access', _276 => _276.experimental, 'optionalAccess', _277 => _277.serverActions]), () => ( false)),
|
|
6808
|
+
isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _278 => _278.experimental, 'optionalAccess', _279 => _279.isolatedClientHydration]), () => ( "off")),
|
|
6809
|
+
ppr: _nullishCoalesce(_optionalChain([config, 'access', _280 => _280.experimental, 'optionalAccess', _281 => _281.ppr]), () => ( false)),
|
|
6624
6810
|
...config.experimental
|
|
6625
6811
|
},
|
|
6626
6812
|
agent: _nullishCoalesce(config.agent, () => ( {})),
|
|
@@ -6679,7 +6865,7 @@ function isResolvedAuthConfig(value) {
|
|
|
6679
6865
|
);
|
|
6680
6866
|
}
|
|
6681
6867
|
function normalizeFarmAppAPIConfig(config) {
|
|
6682
|
-
if (typeof _optionalChain([config, 'optionalAccess',
|
|
6868
|
+
if (typeof _optionalChain([config, 'optionalAccess', _282 => _282.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _283 => _283.basePath]) === "function") {
|
|
6683
6869
|
throw new Error(
|
|
6684
6870
|
"Farm API config resolver functions must be processed with resolveConfig() before creating a FarmApp."
|
|
6685
6871
|
);
|
|
@@ -6694,7 +6880,7 @@ function createFarmApp(config, viteServer) {
|
|
|
6694
6880
|
var SHARP_INSTALL_HINT = _chunkKORZ6PREcjs.formatOptionalPeerInstallHint.call(void 0, "sharp", "optimize images");
|
|
6695
6881
|
var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
|
|
6696
6882
|
function resolveFarmImageProviderForRuntime(images, options) {
|
|
6697
|
-
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess',
|
|
6883
|
+
const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _284 => _284.provider]), () => ( "auto"));
|
|
6698
6884
|
if (provider === "none") return images;
|
|
6699
6885
|
const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
|
|
6700
6886
|
if (!usesSharp || _chunkKORZ6PREcjs.isOptionalPeerInstalled.call(void 0, options.root, "sharp")) return images;
|
|
@@ -6729,7 +6915,7 @@ function resolveFarmAppPackages(root) {
|
|
|
6729
6915
|
let manifest;
|
|
6730
6916
|
try {
|
|
6731
6917
|
manifest = JSON.parse(fs.default.readFileSync(path3.default.join(root, "package.json"), "utf8"));
|
|
6732
|
-
} catch (
|
|
6918
|
+
} catch (e18) {
|
|
6733
6919
|
return {};
|
|
6734
6920
|
}
|
|
6735
6921
|
const names = new Set(
|
|
@@ -6748,7 +6934,7 @@ function resolveFarmAppPackages(root) {
|
|
|
6748
6934
|
if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
|
|
6749
6935
|
versions[name] = version;
|
|
6750
6936
|
break;
|
|
6751
|
-
} catch (
|
|
6937
|
+
} catch (e19) {
|
|
6752
6938
|
const parent = path3.default.dirname(dir);
|
|
6753
6939
|
if (parent === dir) break;
|
|
6754
6940
|
dir = parent;
|
|
@@ -6823,9 +7009,9 @@ function staticValue(node) {
|
|
|
6823
7009
|
}
|
|
6824
7010
|
}
|
|
6825
7011
|
function property(object, name) {
|
|
6826
|
-
return _optionalChain([object, 'access',
|
|
7012
|
+
return _optionalChain([object, 'access', _285 => _285.properties, 'access', _286 => _286.find, 'call', _287 => _287(
|
|
6827
7013
|
(entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
|
|
6828
|
-
), 'optionalAccess',
|
|
7014
|
+
), 'optionalAccess', _288 => _288.value]);
|
|
6829
7015
|
}
|
|
6830
7016
|
function toolFromObject(object) {
|
|
6831
7017
|
const name = staticValue(property(object, "name"));
|
|
@@ -6863,7 +7049,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
6863
7049
|
let program;
|
|
6864
7050
|
try {
|
|
6865
7051
|
program = parseAst2(code, { lang });
|
|
6866
|
-
} catch (
|
|
7052
|
+
} catch (e20) {
|
|
6867
7053
|
return [];
|
|
6868
7054
|
}
|
|
6869
7055
|
const locals = /* @__PURE__ */ new Map();
|
|
@@ -6871,7 +7057,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
6871
7057
|
if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
|
|
6872
7058
|
continue;
|
|
6873
7059
|
for (const specifier of statement.specifiers) {
|
|
6874
|
-
const imported = _nullishCoalesce(_optionalChain([specifier, 'access',
|
|
7060
|
+
const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _289 => _289.imported, 'optionalAccess', _290 => _290.name]), () => ( _optionalChain([specifier, 'access', _291 => _291.imported, 'optionalAccess', _292 => _292.value])));
|
|
6875
7061
|
if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
|
|
6876
7062
|
locals.set(specifier.local.name, imported);
|
|
6877
7063
|
}
|
|
@@ -6887,7 +7073,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
|
|
|
6887
7073
|
const [argument] = current.arguments;
|
|
6888
7074
|
if (definer && argument) {
|
|
6889
7075
|
const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
|
|
6890
|
-
(element) => _optionalChain([element, 'optionalAccess',
|
|
7076
|
+
(element) => _optionalChain([element, 'optionalAccess', _293 => _293.type]) === "ObjectExpression"
|
|
6891
7077
|
) : [] : argument.type === "ObjectExpression" ? [argument] : [];
|
|
6892
7078
|
for (const object of objects) {
|
|
6893
7079
|
const tool = toolFromObject(object);
|
|
@@ -6912,7 +7098,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
6912
7098
|
expandDirectories: false,
|
|
6913
7099
|
ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
|
|
6914
7100
|
});
|
|
6915
|
-
} catch (
|
|
7101
|
+
} catch (e21) {
|
|
6916
7102
|
return [];
|
|
6917
7103
|
}
|
|
6918
7104
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -6921,7 +7107,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
6921
7107
|
let mtimeMs;
|
|
6922
7108
|
try {
|
|
6923
7109
|
mtimeMs = fs.default.statSync(file).mtimeMs;
|
|
6924
|
-
} catch (
|
|
7110
|
+
} catch (e22) {
|
|
6925
7111
|
continue;
|
|
6926
7112
|
}
|
|
6927
7113
|
let entry = cache.get(file);
|
|
@@ -6929,7 +7115,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
6929
7115
|
let code = "";
|
|
6930
7116
|
try {
|
|
6931
7117
|
code = fs.default.readFileSync(file, "utf8");
|
|
6932
|
-
} catch (
|
|
7118
|
+
} catch (e23) {
|
|
6933
7119
|
}
|
|
6934
7120
|
entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
|
|
6935
7121
|
cache.set(file, entry);
|
|
@@ -6948,8 +7134,8 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
|
|
|
6948
7134
|
|
|
6949
7135
|
var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
6950
7136
|
function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
6951
|
-
const client = _optionalChain([cache2, 'optionalAccess',
|
|
6952
|
-
const adapter = _optionalChain([client, 'optionalAccess',
|
|
7137
|
+
const client = _optionalChain([cache2, 'optionalAccess', _294 => _294.client]);
|
|
7138
|
+
const adapter = _optionalChain([client, 'optionalAccess', _295 => _295.adapter]);
|
|
6953
7139
|
if (adapter === void 0) return void 0;
|
|
6954
7140
|
if (typeof adapter !== "string" || adapter.trim().length === 0) {
|
|
6955
7141
|
throw new Error(
|
|
@@ -6964,8 +7150,8 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
|
|
|
6964
7150
|
);
|
|
6965
7151
|
}
|
|
6966
7152
|
const options = {};
|
|
6967
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
6968
|
-
if (_optionalChain([client, 'optionalAccess',
|
|
7153
|
+
if (_optionalChain([client, 'optionalAccess', _296 => _296.version]) !== void 0) options.version = client.version;
|
|
7154
|
+
if (_optionalChain([client, 'optionalAccess', _297 => _297.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
|
|
6969
7155
|
return { importPath: found.replace(/\\/g, "/"), options };
|
|
6970
7156
|
}
|
|
6971
7157
|
function resolveAdapterFile(resolved) {
|
|
@@ -7335,7 +7521,7 @@ function fileNamePattern(files) {
|
|
|
7335
7521
|
names.add(path3.default.basename(file));
|
|
7336
7522
|
try {
|
|
7337
7523
|
names.add(path3.default.basename(_fs.realpathSync.call(void 0, file)));
|
|
7338
|
-
} catch (
|
|
7524
|
+
} catch (e24) {
|
|
7339
7525
|
}
|
|
7340
7526
|
}
|
|
7341
7527
|
return new RegExp(`(?:^|/)(?:${[...names].map(escapeRegExp).join("|")})(?:\\?.*)?$`);
|
|
@@ -7371,7 +7557,7 @@ function redactFarmDocsClientConfig(code, filename) {
|
|
|
7371
7557
|
const current = node;
|
|
7372
7558
|
if (current.type === "Property") {
|
|
7373
7559
|
const name = propertyKeyName(current);
|
|
7374
|
-
const valueType = _optionalChain([current, 'access',
|
|
7560
|
+
const valueType = _optionalChain([current, 'access', _298 => _298.value, 'optionalAccess', _299 => _299.type]);
|
|
7375
7561
|
const credential = name !== void 0 && (name.toLowerCase() === "headers" || _chunkSM2SYWARcjs.isSecretDocsConfigKey.call(void 0, name) && valueType !== "ObjectExpression" && valueType !== "ArrayExpression");
|
|
7376
7562
|
if (name && credential) {
|
|
7377
7563
|
edits.push(
|
|
@@ -7402,7 +7588,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
|
|
|
7402
7588
|
if (file === configModule) return true;
|
|
7403
7589
|
try {
|
|
7404
7590
|
return file === _fs.realpathSync.call(void 0, configModule).replace(/\\/g, "/");
|
|
7405
|
-
} catch (
|
|
7591
|
+
} catch (e25) {
|
|
7406
7592
|
return false;
|
|
7407
7593
|
}
|
|
7408
7594
|
}
|
|
@@ -7414,7 +7600,7 @@ function farmDocsClientConfigPlugin(configModule) {
|
|
|
7414
7600
|
// Never matches without a docs config module, so the bundler never calls the handler.
|
|
7415
7601
|
filter: { id: configModule ? fileNamePattern([configModule]) : /(?!)/ },
|
|
7416
7602
|
handler(code, id, options) {
|
|
7417
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
7603
|
+
if (_optionalChain([options, 'optionalAccess', _300 => _300.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
|
|
7418
7604
|
const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
|
|
7419
7605
|
return redacted === null ? null : { code: redacted, map: null };
|
|
7420
7606
|
}
|
|
@@ -7446,7 +7632,7 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
|
7446
7632
|
];
|
|
7447
7633
|
function getFarmClientOptimizeDepsInclude(renderer) {
|
|
7448
7634
|
return Array.from(
|
|
7449
|
-
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess',
|
|
7635
|
+
/* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _301 => _301.optimizeDeps]) || []])
|
|
7450
7636
|
);
|
|
7451
7637
|
}
|
|
7452
7638
|
function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
|
|
@@ -7470,7 +7656,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
|
|
|
7470
7656
|
// Farm's HTML boots through a virtual module and imports route UI lazily.
|
|
7471
7657
|
// Explicit entries let Vite finish that crawl before a navigation can
|
|
7472
7658
|
// rotate the optimizer hash underneath a hydrated React runtime.
|
|
7473
|
-
..._optionalChain([entries, 'optionalAccess',
|
|
7659
|
+
..._optionalChain([entries, 'optionalAccess', _302 => _302.length]) ? { entries: [...entries] } : {}
|
|
7474
7660
|
};
|
|
7475
7661
|
}
|
|
7476
7662
|
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
@@ -7502,8 +7688,8 @@ function mergeFarmViteAlias(farmValue, userValue) {
|
|
|
7502
7688
|
return [...userEntries, ...normalize(farmValue).filter((entry) => !userNames.has(entry.find))];
|
|
7503
7689
|
}
|
|
7504
7690
|
function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
7505
|
-
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
7506
|
-
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access',
|
|
7691
|
+
const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _303 => _303.optimizeDeps, 'optionalAccess', _304 => _304.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _305 => _305.optimizeDeps, 'optionalAccess', _306 => _306.noDiscovery])));
|
|
7692
|
+
const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _307 => _307.optimizeDeps, 'optionalAccess', _308 => _308.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _309 => _309.optimizeDeps, 'optionalAccess', _310 => _310.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _311 => _311.optimizeDeps, 'optionalAccess', _312 => _312.holdUntilCrawlEnd]))));
|
|
7507
7693
|
return {
|
|
7508
7694
|
...farmConfig,
|
|
7509
7695
|
...userConfig,
|
|
@@ -7515,9 +7701,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
7515
7701
|
resolve: {
|
|
7516
7702
|
...farmConfig.resolve,
|
|
7517
7703
|
...userConfig.resolve,
|
|
7518
|
-
alias: mergeFarmViteAlias(_optionalChain([farmConfig, 'access',
|
|
7704
|
+
alias: mergeFarmViteAlias(_optionalChain([farmConfig, 'access', _313 => _313.resolve, 'optionalAccess', _314 => _314.alias]), _optionalChain([userConfig, 'access', _315 => _315.resolve, 'optionalAccess', _316 => _316.alias])),
|
|
7519
7705
|
dedupe: Array.from(
|
|
7520
|
-
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access',
|
|
7706
|
+
/* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _317 => _317.resolve, 'optionalAccess', _318 => _318.dedupe]) || [], ..._optionalChain([userConfig, 'access', _319 => _319.resolve, 'optionalAccess', _320 => _320.dedupe]) || []])
|
|
7521
7707
|
)
|
|
7522
7708
|
},
|
|
7523
7709
|
optimizeDeps: {
|
|
@@ -7527,21 +7713,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
7527
7713
|
holdUntilCrawlEnd,
|
|
7528
7714
|
include: Array.from(
|
|
7529
7715
|
/* @__PURE__ */ new Set([
|
|
7530
|
-
..._optionalChain([farmConfig, 'access',
|
|
7531
|
-
..._optionalChain([userConfig, 'access',
|
|
7716
|
+
..._optionalChain([farmConfig, 'access', _321 => _321.optimizeDeps, 'optionalAccess', _322 => _322.include]) || [],
|
|
7717
|
+
..._optionalChain([userConfig, 'access', _323 => _323.optimizeDeps, 'optionalAccess', _324 => _324.include]) || []
|
|
7532
7718
|
])
|
|
7533
7719
|
),
|
|
7534
7720
|
exclude: Array.from(
|
|
7535
7721
|
/* @__PURE__ */ new Set([
|
|
7536
|
-
..._optionalChain([farmConfig, 'access',
|
|
7537
|
-
..._optionalChain([userConfig, 'access',
|
|
7722
|
+
..._optionalChain([farmConfig, 'access', _325 => _325.optimizeDeps, 'optionalAccess', _326 => _326.exclude]) || [],
|
|
7723
|
+
..._optionalChain([userConfig, 'access', _327 => _327.optimizeDeps, 'optionalAccess', _328 => _328.exclude]) || []
|
|
7538
7724
|
])
|
|
7539
7725
|
)
|
|
7540
7726
|
},
|
|
7541
7727
|
ssr: {
|
|
7542
7728
|
...farmConfig.ssr,
|
|
7543
7729
|
...userConfig.ssr,
|
|
7544
|
-
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access',
|
|
7730
|
+
noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _329 => _329.ssr, 'optionalAccess', _330 => _330.noExternal]), _optionalChain([userConfig, 'access', _331 => _331.ssr, 'optionalAccess', _332 => _332.noExternal]))
|
|
7545
7731
|
}
|
|
7546
7732
|
};
|
|
7547
7733
|
}
|
|
@@ -7612,8 +7798,8 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}, options = {}
|
|
|
7612
7798
|
...userRolldownOptions
|
|
7613
7799
|
};
|
|
7614
7800
|
const merged = mergeFarmViteConfig(farmConfig, shared);
|
|
7615
|
-
const farmBundlerOptions = _optionalChain([farmConfig, 'access',
|
|
7616
|
-
const output = options.clientOutput ? mergeFarmClientOutputOptions(_optionalChain([farmBundlerOptions, 'optionalAccess',
|
|
7801
|
+
const farmBundlerOptions = _optionalChain([farmConfig, 'access', _333 => _333.build, 'optionalAccess', _334 => _334.rollupOptions]);
|
|
7802
|
+
const output = options.clientOutput ? mergeFarmClientOutputOptions(_optionalChain([farmBundlerOptions, 'optionalAccess', _335 => _335.output]), userOutput) : _optionalChain([farmBundlerOptions, 'optionalAccess', _336 => _336.output]);
|
|
7617
7803
|
return {
|
|
7618
7804
|
...merged,
|
|
7619
7805
|
build: {
|
|
@@ -7630,7 +7816,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}, options = {}
|
|
|
7630
7816
|
esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
|
|
7631
7817
|
ssr: {
|
|
7632
7818
|
...merged.ssr,
|
|
7633
|
-
external: mergeExternal(_optionalChain([farmConfig, 'access',
|
|
7819
|
+
external: mergeExternal(_optionalChain([farmConfig, 'access', _337 => _337.ssr, 'optionalAccess', _338 => _338.external]), _optionalChain([userConfig, 'access', _339 => _339.ssr, 'optionalAccess', _340 => _340.external]))
|
|
7634
7820
|
}
|
|
7635
7821
|
};
|
|
7636
7822
|
}
|
|
@@ -7701,4 +7887,5 @@ ${FARM_DARK_VARIANT}
|
|
|
7701
7887
|
|
|
7702
7888
|
|
|
7703
7889
|
|
|
7704
|
-
|
|
7890
|
+
|
|
7891
|
+
exports.inspectStaticMetadataImage = inspectStaticMetadataImage; exports.RouteManager = RouteManager; exports.resolveDevGlobalStylesheetHref = resolveDevGlobalStylesheetHref; exports.collectDevStylesheetUrls = collectDevStylesheetUrls; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.inferFarmIslandStrategy = inferFarmIslandStrategy; exports.invalidateFarmRouteRootInferences = invalidateFarmRouteRootInferences; exports.resolveFarmRouteRootStrategy = resolveFarmRouteRootStrategy; exports.canBootFarmIslandsClient = canBootFarmIslandsClient; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.resolveFarmImageServerRuntime = resolveFarmImageServerRuntime; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE = FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE; exports.FARM_NAVIGATION_SCRIPT_SOURCE = FARM_NAVIGATION_SCRIPT_SOURCE; exports.FARM_NAVIGATION_STREAM_READER_SOURCE = FARM_NAVIGATION_STREAM_READER_SOURCE; exports.FARM_REFRESH_FIELDS_SOURCE = FARM_REFRESH_FIELDS_SOURCE; exports.exactIdPattern = exactIdPattern; exports.fileNamePattern = fileNamePattern; exports.redactFarmDocsClientConfig = redactFarmDocsClientConfig; exports.isFarmDocsClientConfigModule = isFarmDocsClientConfigModule; exports.farmDocsClientConfigPlugin = farmDocsClientConfigPlugin; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteAlias = mergeFarmViteAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin;
|