@farm.js/core 0.1.82 → 0.1.83
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.d-C2Su3x4D.d.ts → agent-mcp.d-7uKdOttc.d.ts} +1 -1
- package/dist/{agent-mcp.d-Yak-LqRd.d.mts → agent-mcp.d-LChlR2au.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -1
- package/dist/agent-runtime.d.ts +2 -1
- package/dist/analyzer-WGH6J2HN.cjs +17 -0
- package/dist/{analyzer-RPU2KG4J.mjs → analyzer-Y6IY26HI.mjs} +2 -2
- package/dist/api/node.d.mts +4 -3
- package/dist/api/node.d.ts +4 -3
- package/dist/api/route-manager.d.mts +4 -3
- package/dist/api/route-manager.d.ts +4 -3
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api.d.mts +5 -4
- package/dist/api.d.ts +5 -4
- package/dist/{app-manifest.d-DZyXaICz.d.ts → app-manifest.d-CRp21oAz.d.ts} +1 -1
- package/dist/{app-manifest.d-BcyOFMrg.d.mts → app-manifest.d-QMdmqqCr.d.mts} +1 -1
- package/dist/app-markdown.d.mts +3 -2
- package/dist/app-markdown.d.ts +3 -2
- package/dist/{app.d-CIoXsAbN.d.ts → app.d-CVPu_hoD.d.ts} +34 -4
- package/dist/{app.d-C0ePpuaG.d.mts → app.d-eSm7jgoc.d.mts} +34 -4
- package/dist/{chunk-JK26IMT7.cjs → chunk-3CZ4MJHW.cjs} +1 -1
- package/dist/{chunk-5MUFW5UU.cjs → chunk-3DAJXBSL.cjs} +2 -2
- package/dist/{chunk-XMHERKSE.mjs → chunk-42IBGQTN.mjs} +5 -12
- package/dist/{chunk-4X7LSGM6.mjs → chunk-43N3X6OO.mjs} +1 -1
- package/dist/{chunk-LM2ZDNDD.cjs → chunk-55UJGUBP.cjs} +24 -19
- package/dist/{chunk-TPA2PV5J.mjs → chunk-5V6HSJFG.mjs} +24 -1
- package/dist/chunk-5X5GJU5A.cjs +426 -0
- package/dist/{chunk-Q2VOT3K2.cjs → chunk-7X2CYE66.cjs} +316 -310
- package/dist/{chunk-6BPFIYGY.cjs → chunk-A5BHJHDF.cjs} +3 -3
- package/dist/{chunk-EL2Z6YFZ.mjs → chunk-B5SJYXJK.mjs} +177 -67
- package/dist/chunk-BUQR7KKO.mjs +17 -0
- package/dist/{chunk-724WT3NI.mjs → chunk-CRE642TW.mjs} +1 -1
- package/dist/{chunk-NRCKBDYP.mjs → chunk-DPUZVGXH.mjs} +130 -27
- package/dist/{chunk-N2EFMN2K.cjs → chunk-DZTWUEBB.cjs} +2 -2
- package/dist/{chunk-DRO3NXA3.cjs → chunk-EFI6QWBQ.cjs} +200 -90
- package/dist/chunk-ELNRKD4V.mjs +426 -0
- package/dist/{chunk-63ZE6B6M.mjs → chunk-FFWSER54.mjs} +1 -1
- package/dist/chunk-FZ7OUN5M.cjs +30 -0
- package/dist/{chunk-5MMKNW7Q.cjs → chunk-H7REG7OX.cjs} +15 -8
- package/dist/{chunk-VMBIKDKW.cjs → chunk-HRH7OKBQ.cjs} +6 -4
- package/dist/{chunk-RMPUEH5T.cjs → chunk-IABI62FH.cjs} +2 -2
- package/dist/{chunk-ZIZRIZLP.mjs → chunk-IAIRQAHA.mjs} +3 -1
- package/dist/{chunk-EX6ZSN5P.cjs → chunk-IZYFP7IN.cjs} +17 -24
- package/dist/chunk-J6RFB324.cjs +17 -0
- package/dist/{chunk-ARORZ3MH.cjs → chunk-JHRJ5V2F.cjs} +366 -263
- package/dist/{chunk-OMB7UGVW.mjs → chunk-K3GHY7GY.mjs} +14 -9
- package/dist/{chunk-UVV3I5QA.cjs → chunk-L2GUEYHR.cjs} +29 -6
- package/dist/{chunk-HHQEKLZL.cjs → chunk-LN6FAYNB.cjs} +36 -31
- package/dist/chunk-M6AJZ4XR.mjs +30 -0
- package/dist/{chunk-47I2MYIR.mjs → chunk-NDWI6FDH.mjs} +442 -180
- package/dist/{chunk-BCTHOQPP.cjs → chunk-NGTZHWBG.cjs} +68 -1
- package/dist/{chunk-OP5VI4TP.mjs → chunk-NKVBWPXR.mjs} +1 -1
- package/dist/{chunk-CD5Z7RR5.cjs → chunk-OM6JIIJU.cjs} +4 -4
- package/dist/{chunk-C3VCYOU4.mjs → chunk-ORBBAA7B.mjs} +1 -1
- package/dist/{chunk-I4DR3HCH.mjs → chunk-R3VLM2MW.mjs} +1 -1
- package/dist/{chunk-I4WZRG73.mjs → chunk-RB5IGN3N.mjs} +13 -6
- package/dist/{chunk-RMLR5RMH.mjs → chunk-RGTZAM6Y.mjs} +67 -0
- package/dist/{chunk-GXLNARPO.mjs → chunk-RNJX3MD6.mjs} +1 -1
- package/dist/{chunk-EJCVG25Z.mjs → chunk-S3R4JDRO.mjs} +17 -9
- package/dist/{chunk-AIPZDBP6.cjs → chunk-SLIXHUMS.cjs} +780 -518
- package/dist/{chunk-WFVSAT7Y.cjs → chunk-T7HGXF7D.cjs} +3 -3
- package/dist/{chunk-CJDBTTLB.mjs → chunk-U56Z3755.mjs} +10 -5
- package/dist/{chunk-QSMUMK7Y.mjs → chunk-VQ6IXALL.mjs} +2 -2
- package/dist/{chunk-B2PGVHBG.cjs → chunk-WCSBYQOT.cjs} +4 -4
- package/dist/{chunk-DAXU2NBE.mjs → chunk-WZV2G2A6.mjs} +30 -24
- package/dist/{chunk-SM2SYWAR.cjs → chunk-XJDB564A.cjs} +18 -10
- package/dist/{cli-runtime.d-Hnvvadz7.d.mts → cli-runtime.d-C7aMfoTq.d.mts} +8 -6
- package/dist/{cli-runtime.d-I0MphTbc.d.ts → cli-runtime.d-DaElKjaL.d.ts} +8 -6
- package/dist/{client-component.d-DapRqtSC.d.mts → client-component.d-DLMCzmUx.d.mts} +1 -1
- package/dist/{client-component.d-5QEvtJsg.d.ts → client-component.d-DLknFP8l.d.ts} +1 -1
- package/dist/{client-plugins.d-DcmDzcSC.d.ts → client-plugins.d-BVXjyIkY.d.ts} +14 -0
- package/dist/{client-plugins.d-C1WM3ieD.d.mts → client-plugins.d-BwKwuO_0.d.mts} +14 -0
- package/dist/client-plugins.d.mts +2 -1
- package/dist/client-plugins.d.ts +2 -1
- package/dist/client.cjs +4 -3
- package/dist/client.d.mts +10 -9
- package/dist/client.d.ts +10 -9
- package/dist/client.mjs +3 -2
- package/dist/config.d.mts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/desktop.d.mts +3 -2
- package/dist/desktop.d.ts +3 -2
- package/dist/{devtools-C5GXZZ7E.mjs → devtools-OI52TCSD.mjs} +3 -3
- package/dist/{devtools-5B7NZE6F.cjs → devtools-ZM2AR36W.cjs} +5 -5
- package/dist/docs.cjs +8 -7
- package/dist/docs.d.mts +15 -6
- package/dist/docs.d.ts +15 -6
- package/dist/docs.mjs +7 -6
- package/dist/environment/vite.cjs +4 -4
- package/dist/environment/vite.d.mts +1 -0
- package/dist/environment/vite.d.ts +1 -0
- package/dist/environment/vite.mjs +3 -3
- package/dist/{generate-route-types.d-CaGMIaNI.d.mts → generate-route-types.d-BFOMM8Ef.d.mts} +3 -0
- package/dist/{generate-route-types.d-B76M5R11.d.ts → generate-route-types.d-C2m8myHb.d.ts} +3 -0
- package/dist/{handler.d-B8bPCBzl.d.mts → handler.d-BKTWzzNA.d.mts} +1 -1
- package/dist/{handler.d-Cliwo6Nu.d.ts → handler.d-Dzpyg3-N.d.ts} +1 -1
- package/dist/{headers.d-CVwSpSGX.d.mts → headers.d-5opjyhXw.d.mts} +1 -1
- package/dist/{headers.d-C_btqjV6.d.ts → headers.d-PZyXcDAH.d.ts} +1 -1
- package/dist/index.cjs +25 -23
- package/dist/{index.d-DFuMZk9-.d.mts → index.d-C0Mie66f.d.mts} +1 -1
- package/dist/{index.d-hOEbMcLk.d.ts → index.d-DV2q-0mE.d.ts} +1 -1
- package/dist/index.d.mts +26 -25
- package/dist/index.d.ts +26 -25
- package/dist/index.mjs +25 -23
- package/dist/integrations/orm.d.mts +2 -1
- package/dist/integrations/orm.d.ts +2 -1
- package/dist/integrations.d.mts +2 -1
- package/dist/integrations.d.ts +2 -1
- package/dist/internal/app-markdown-runtime.d.mts +3 -2
- package/dist/internal/app-markdown-runtime.d.ts +3 -2
- package/dist/internal/build-runtime.cjs +21 -21
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +20 -20
- package/dist/internal/cli-runtime.cjs +6 -6
- package/dist/internal/cli-runtime.d.mts +8 -7
- package/dist/internal/cli-runtime.d.ts +8 -7
- 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.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +2 -1
- package/dist/internal/compression-runtime.d.ts +2 -1
- package/dist/internal/config-runtime.cjs +5 -5
- package/dist/internal/config-runtime.d.mts +6 -5
- package/dist/internal/config-runtime.d.ts +6 -5
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-action-client.cjs +18 -0
- package/dist/internal/islands-action-client.d.mts +18 -0
- package/dist/internal/islands-action-client.d.ts +18 -0
- package/dist/internal/islands-action-client.mjs +18 -0
- package/dist/internal/islands-runtime.cjs +3 -8
- package/dist/internal/islands-runtime.mjs +4 -9
- package/dist/internal/islx-actions-client.cjs +4 -3
- package/dist/internal/islx-actions-client.mjs +3 -2
- package/dist/internal/islx-actions-server.d.mts +0 -2
- package/dist/internal/islx-actions-server.d.ts +0 -2
- package/dist/internal/islx-client.cjs +13 -1
- package/dist/internal/islx-client.d.mts +11 -0
- package/dist/internal/islx-client.d.ts +11 -0
- package/dist/internal/islx-client.mjs +14 -0
- package/dist/internal/metadata-image-runtime.d.mts +1 -0
- package/dist/internal/metadata-image-runtime.d.ts +1 -0
- 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 +5 -5
- package/dist/internal/production-runtime.d.mts +11 -11
- package/dist/internal/production-runtime.d.ts +11 -11
- package/dist/internal/production-runtime.mjs +4 -4
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/start-manifest.d.mts +2 -1
- package/dist/internal/start-manifest.d.ts +2 -1
- package/dist/markdown.d.mts +2 -1
- package/dist/markdown.d.ts +2 -1
- package/dist/middleware.d.mts +2 -1
- package/dist/middleware.d.ts +2 -1
- package/dist/mobile.d.mts +6 -3
- package/dist/mobile.d.ts +6 -3
- package/dist/{mount.d-DLeYxeRR.d.mts → mount.d-CZ_qL1iS.d.mts} +1 -1
- package/dist/{mount.d-CAovYKfs.d.ts → mount.d-gWul1GA1.d.ts} +1 -1
- package/dist/{navigation-delegate.d-Chv93QS6.d.mts → navigation-delegate.d-BBTzhJLj.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BLM-8Q3Z.d.ts → navigation-delegate.d-BZsYEAet.d.ts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- 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/{render-plan.d-BSTjTH8h.d.ts → render-plan.d-AaJsYPX-.d.ts} +1 -1
- package/dist/{render-plan.d-CK5Lggyb.d.mts → render-plan.d-bnWxS12w.d.mts} +1 -1
- package/dist/renderer-client.cjs +6 -5
- package/dist/renderer-client.d.mts +8 -7
- package/dist/renderer-client.d.ts +8 -7
- package/dist/renderer-client.mjs +2 -1
- package/dist/renderer.cjs +6 -2
- package/dist/renderer.d.mts +87 -4
- package/dist/renderer.d.ts +87 -4
- package/dist/renderer.mjs +5 -1
- package/dist/{request.d-BhggxQf3.d.mts → request.d-C2HOn3Hi.d.mts} +1 -1
- package/dist/{request.d-CyJS9bjm.d.ts → request.d-CAeitOG1.d.ts} +1 -1
- package/dist/request.d.mts +3 -2
- package/dist/request.d.ts +3 -2
- package/dist/{route-rendering.d-BLPPmI5I.d.ts → route-rendering.d-A1dIkUK5.d.ts} +1 -1
- package/dist/{route-rendering.d-CUpG2mZJ.d.mts → route-rendering.d-CYA-ulnX.d.mts} +1 -1
- package/dist/{router.d-2NQM1Kgw.d.mts → router.d-8lxnzlkr.d.mts} +1 -1
- package/dist/{router.d-0X2Ki6rf.d.ts → router.d-A_Yt6jYz.d.ts} +1 -1
- package/dist/{routes.d-CCccJRrp.d.mts → routes.d-BWvpUoYu.d.mts} +1 -1
- package/dist/{routes.d-b7khoRoU.d.ts → routes.d-D7RWvfqL.d.ts} +1 -1
- package/dist/routes.d.mts +2 -1
- package/dist/routes.d.ts +2 -1
- package/dist/{rsc-pipeline-5AOF64FL.cjs → rsc-pipeline-MFJZGDPE.cjs} +5 -5
- package/dist/{rsc-pipeline-DNRLYOJ7.mjs → rsc-pipeline-TRZVFCBX.mjs} +4 -4
- package/dist/{runtime-ZVHG5SRB.cjs → runtime-MJUG2HGR.cjs} +10 -9
- package/dist/{runtime-EHG2FRXZ.mjs → runtime-O4Y3Z6V3.mjs} +6 -5
- package/dist/{runtime.d-CXuwkUgr.d.ts → runtime.d-BPyvWrgQ.d.ts} +1 -1
- package/dist/{runtime.d-CaFXcu_Q.d.mts → runtime.d-C_rZ9_DD.d.mts} +1 -1
- package/dist/{server-components-status.d-Cp7zvBm5.d.mts → server-components-status.d-BpxiEMQE.d.mts} +1 -1
- package/dist/{server-components-status.d-BdeFD8ZH.d.ts → server-components-status.d-C2UEKJn7.d.ts} +1 -1
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server-query-call.d-rVM_lsYk.d.mts +15 -0
- package/dist/server-query-call.d-rVM_lsYk.d.ts +15 -0
- package/dist/server-query-client.cjs +5 -3
- package/dist/server-query-client.d.mts +3 -2
- package/dist/server-query-client.d.ts +3 -2
- package/dist/server-query-client.mjs +5 -3
- package/dist/{server-query-runtime.d-DXRNhX_3.d.ts → server-query-runtime.d-BlHd90D0.d.ts} +2 -8
- package/dist/{server-query-runtime.d-aP52iuL5.d.mts → server-query-runtime.d-CCLGkQtE.d.mts} +2 -8
- package/dist/server.cjs +39 -39
- package/dist/server.d.mts +12 -12
- package/dist/server.d.ts +12 -12
- package/dist/server.mjs +16 -16
- package/dist/{spa-router.d-l3G38xHa.d.mts → spa-router.d-BD-6WX1R.d.mts} +2 -2
- package/dist/{spa-router.d-Bjgl-Osi.d.ts → spa-router.d-Cw5i_15e.d.ts} +2 -2
- package/dist/{ssg.d-DDca17Lc.d.ts → ssg.d-Bifiq0EL.d.ts} +2 -2
- package/dist/{ssg.d-RnlHOqUL.d.mts → ssg.d-CCE9aob5.d.mts} +2 -2
- package/dist/{store-core.d-BaOUOPf7.d.ts → store-core.d-5tVn5vi1.d.ts} +3 -3
- package/dist/{store-core.d-BZjuC6Zc.d.mts → store-core.d-BN2MxSG9.d.mts} +3 -3
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/{utils.d-D8TWmpWo.d.ts → utils.d-BUjpSNIO.d.ts} +1 -1
- package/dist/{utils.d-tdzw0_zQ.d.mts → utils.d-wGPLeVbq.d.mts} +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 +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.mjs +14 -14
- package/package.json +6 -1
- package/dist/analyzer-LV23T6QN.cjs +0 -17
- package/dist/chunk-AUFEM3FB.mjs +0 -229
- package/dist/chunk-S7WZUK3B.cjs +0 -229
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
var _chunkE5UN4OWXcjs = require('./chunk-E5UN4OWX.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
|
|
@@ -20,9 +19,10 @@ var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
|
|
22
|
+
var _chunkNG2EZ6QScjs = require('./chunk-NG2EZ6QS.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
@@ -32,7 +32,7 @@ var _chunkMHKPXX3Jcjs = require('./chunk-MHKPXX3J.cjs');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkA5BHJHDFcjs = require('./chunk-A5BHJHDF.cjs');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
@@ -40,8 +40,7 @@ var _chunk6BPFIYGYcjs = require('./chunk-6BPFIYGY.cjs');
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
var _chunkHHQEKLZLcjs = require('./chunk-HHQEKLZL.cjs');
|
|
43
|
+
var _chunkLN6FAYNBcjs = require('./chunk-LN6FAYNB.cjs');
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
|
|
@@ -71,7 +70,7 @@ var _chunkNDOE76QCcjs = require('./chunk-NDOE76QC.cjs');
|
|
|
71
70
|
|
|
72
71
|
|
|
73
72
|
|
|
74
|
-
var
|
|
73
|
+
var _chunk55UJGUBPcjs = require('./chunk-55UJGUBP.cjs');
|
|
75
74
|
|
|
76
75
|
|
|
77
76
|
var _chunk3BTN3NP7cjs = require('./chunk-3BTN3NP7.cjs');
|
|
@@ -116,7 +115,7 @@ var _chunkO4JYMU5Ncjs = require('./chunk-O4JYMU5N.cjs');
|
|
|
116
115
|
|
|
117
116
|
|
|
118
117
|
|
|
119
|
-
var
|
|
118
|
+
var _chunkJHRJ5V2Fcjs = require('./chunk-JHRJ5V2F.cjs');
|
|
120
119
|
|
|
121
120
|
|
|
122
121
|
|
|
@@ -132,7 +131,7 @@ var _chunkVACYUMXWcjs = require('./chunk-VACYUMXW.cjs');
|
|
|
132
131
|
|
|
133
132
|
|
|
134
133
|
|
|
135
|
-
var
|
|
134
|
+
var _chunkHRH7OKBQcjs = require('./chunk-HRH7OKBQ.cjs');
|
|
136
135
|
|
|
137
136
|
|
|
138
137
|
|
|
@@ -155,7 +154,7 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
|
155
154
|
|
|
156
155
|
|
|
157
156
|
|
|
158
|
-
var
|
|
157
|
+
var _chunkOM6JIIJUcjs = require('./chunk-OM6JIIJU.cjs');
|
|
159
158
|
|
|
160
159
|
|
|
161
160
|
|
|
@@ -163,7 +162,7 @@ var _chunkCD5Z7RR5cjs = require('./chunk-CD5Z7RR5.cjs');
|
|
|
163
162
|
|
|
164
163
|
|
|
165
164
|
|
|
166
|
-
var
|
|
165
|
+
var _chunkWCSBYQOTcjs = require('./chunk-WCSBYQOT.cjs');
|
|
167
166
|
|
|
168
167
|
|
|
169
168
|
|
|
@@ -171,7 +170,7 @@ var _chunkB2PGVHBGcjs = require('./chunk-B2PGVHBG.cjs');
|
|
|
171
170
|
var _chunkW53Z4WDIcjs = require('./chunk-W53Z4WDI.cjs');
|
|
172
171
|
|
|
173
172
|
|
|
174
|
-
var
|
|
173
|
+
var _chunkIABI62FHcjs = require('./chunk-IABI62FH.cjs');
|
|
175
174
|
|
|
176
175
|
|
|
177
176
|
var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
@@ -192,11 +191,11 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
|
192
191
|
|
|
193
192
|
|
|
194
193
|
|
|
195
|
-
var
|
|
194
|
+
var _chunkEFI6QWBQcjs = require('./chunk-EFI6QWBQ.cjs');
|
|
196
195
|
|
|
197
196
|
|
|
198
197
|
|
|
199
|
-
var
|
|
198
|
+
var _chunkXJDB564Acjs = require('./chunk-XJDB564A.cjs');
|
|
200
199
|
|
|
201
200
|
|
|
202
201
|
|
|
@@ -204,6 +203,11 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
|
|
|
204
203
|
|
|
205
204
|
|
|
206
205
|
|
|
206
|
+
|
|
207
|
+
var _chunkL2GUEYHRcjs = require('./chunk-L2GUEYHR.cjs');
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
207
211
|
var _chunkIIHZ2BEEcjs = require('./chunk-IIHZ2BEE.cjs');
|
|
208
212
|
|
|
209
213
|
|
|
@@ -224,7 +228,7 @@ var _chunk52Q4OB4Acjs = require('./chunk-52Q4OB4A.cjs');
|
|
|
224
228
|
|
|
225
229
|
|
|
226
230
|
|
|
227
|
-
var
|
|
231
|
+
var _chunkNGTZHWBGcjs = require('./chunk-NGTZHWBG.cjs');
|
|
228
232
|
|
|
229
233
|
|
|
230
234
|
|
|
@@ -303,7 +307,7 @@ var _chunk7U4XF76Rcjs = require('./chunk-7U4XF76R.cjs');
|
|
|
303
307
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
304
308
|
|
|
305
309
|
|
|
306
|
-
var
|
|
310
|
+
var _chunk3CZ4MJHWcjs = require('./chunk-3CZ4MJHW.cjs');
|
|
307
311
|
|
|
308
312
|
|
|
309
313
|
var _chunkY3DO7BIJcjs = require('./chunk-Y3DO7BIJ.cjs');
|
|
@@ -507,6 +511,7 @@ function toPosix(file) {
|
|
|
507
511
|
var FARM_CLIENT_CSS_HREF_PLACEHOLDER = "/__farm_client_css_href__";
|
|
508
512
|
var FARM_CLIENT_JS_SRC_PLACEHOLDER = "/__farm_client_js_src__";
|
|
509
513
|
var FARM_CLIENT_BOOT_SRC_PLACEHOLDER = "/__farm_client_boot_src__";
|
|
514
|
+
var FARM_CLIENT_STYLESHEET_PLACEHOLDER = "__farm_client_stylesheet__";
|
|
510
515
|
async function hashAndCopy(sourcePath, destinationDir, hashedName) {
|
|
511
516
|
const fs5 = await import("fs/promises");
|
|
512
517
|
try {
|
|
@@ -530,12 +535,21 @@ async function resolveHashedClientCssHref(clientOutputDir) {
|
|
|
530
535
|
);
|
|
531
536
|
return name ? `/assets/${name}` : "/farm-client.css";
|
|
532
537
|
}
|
|
538
|
+
async function resolveClientStylesheetLinkHref(clientOutputDir, clientCssHref) {
|
|
539
|
+
const fs5 = await import("fs/promises");
|
|
540
|
+
try {
|
|
541
|
+
const stylesheet = await fs5.stat(_path2.default.join(clientOutputDir, "farm-client.css"));
|
|
542
|
+
return stylesheet.size > 0 ? clientCssHref : null;
|
|
543
|
+
} catch (e4) {
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
533
547
|
async function findFingerprintedClientEntry(clientOutputDir) {
|
|
534
548
|
const fs5 = await import("fs/promises");
|
|
535
549
|
try {
|
|
536
550
|
const entries = await fs5.readdir(clientOutputDir);
|
|
537
551
|
return _nullishCoalesce(entries.find((name) => /^farm-client-h[0-9a-f]+\.js$/.test(name)), () => ( null));
|
|
538
|
-
} catch (
|
|
552
|
+
} catch (e5) {
|
|
539
553
|
return null;
|
|
540
554
|
}
|
|
541
555
|
}
|
|
@@ -545,7 +559,7 @@ async function resolveClientBootSrc(clientOutputDir) {
|
|
|
545
559
|
const entries = await fs5.readdir(clientOutputDir);
|
|
546
560
|
const name = entries.find((entry) => /^farm-client-boot-h[0-9a-f]+\.js$/.test(entry));
|
|
547
561
|
return name ? `/${name}` : null;
|
|
548
|
-
} catch (
|
|
562
|
+
} catch (e6) {
|
|
549
563
|
return null;
|
|
550
564
|
}
|
|
551
565
|
}
|
|
@@ -617,7 +631,7 @@ function findSocialImagePath(html, basePath) {
|
|
|
617
631
|
if (!_optionalChain([match, 'optionalAccess', _2 => _2[1]])) return null;
|
|
618
632
|
try {
|
|
619
633
|
return _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, new URL(match[1], FARM_DOCS_COMPILED_ORIGIN).pathname, basePath);
|
|
620
|
-
} catch (
|
|
634
|
+
} catch (e7) {
|
|
621
635
|
return null;
|
|
622
636
|
}
|
|
623
637
|
}
|
|
@@ -646,7 +660,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
646
660
|
isPathGuarded: options.isPathGuarded,
|
|
647
661
|
basePath
|
|
648
662
|
});
|
|
649
|
-
const apiHandler =
|
|
663
|
+
const apiHandler = _chunkLN6FAYNBcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
650
664
|
rootDir: options.root,
|
|
651
665
|
srcDir: options.srcDir,
|
|
652
666
|
docs,
|
|
@@ -801,13 +815,15 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
801
815
|
...staticImports(chunk, loaded, [])
|
|
802
816
|
].map(index);
|
|
803
817
|
}
|
|
804
|
-
const dynamicFiles = (moduleIds) => {
|
|
818
|
+
const dynamicFiles = (moduleIds, before = []) => {
|
|
805
819
|
const into = [];
|
|
806
|
-
const loaded = new Set(entryLoaded);
|
|
820
|
+
const loaded = /* @__PURE__ */ new Set([...entryLoaded, ...before]);
|
|
807
821
|
for (const moduleId of _nullishCoalesce(moduleIds, () => ( []))) {
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
|
|
822
|
+
const is = (id) => _path2.default.resolve(id.split("?")[0]) === _path2.default.resolve(moduleId);
|
|
823
|
+
const chunk = _nullishCoalesce(chunks.find(
|
|
824
|
+
(candidate) => candidate.isDynamicEntry && candidate.facadeModuleId && is(candidate.facadeModuleId)
|
|
825
|
+
), () => ( // A module another dynamic import shares can land in a common chunk without a facade.
|
|
826
|
+
chunks.find((candidate) => !candidate.isEntry && _optionalChain([candidate, 'access', _7 => _7.moduleIds, 'optionalAccess', _8 => _8.some, 'call', _9 => _9(is)]))));
|
|
811
827
|
if (!chunk || loaded.has(chunk.fileName)) continue;
|
|
812
828
|
loaded.add(chunk.fileName);
|
|
813
829
|
into.push(chunk.fileName);
|
|
@@ -816,11 +832,15 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
816
832
|
return into;
|
|
817
833
|
};
|
|
818
834
|
const rendererFiles = dynamicFiles(options.rendererModules);
|
|
835
|
+
const rootFiles = dynamicFiles(options.rootModules);
|
|
836
|
+
const actionFiles = dynamicFiles(options.actionModules, rendererFiles);
|
|
819
837
|
return {
|
|
820
838
|
files,
|
|
821
839
|
entry: entryFiles.map(index),
|
|
822
840
|
router: dynamicFiles(options.routerModules).map(index),
|
|
823
841
|
...rendererFiles.length > 0 ? { renderer: rendererFiles.map(index) } : {},
|
|
842
|
+
...rootFiles.length > 0 ? { root: rootFiles.map(index) } : {},
|
|
843
|
+
...actionFiles.length > 0 ? { actions: actionFiles.map(index) } : {},
|
|
824
844
|
modules
|
|
825
845
|
};
|
|
826
846
|
}
|
|
@@ -829,15 +849,22 @@ function createFarmClientModulePreloadPlugin(options) {
|
|
|
829
849
|
name: "farm-client-module-preloads",
|
|
830
850
|
enforce: "post",
|
|
831
851
|
async generateBundle(_output, bundle) {
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
852
|
+
const resolve = async (specifiers) => {
|
|
853
|
+
const ids = [];
|
|
854
|
+
for (const specifier of _nullishCoalesce(specifiers, () => ( []))) {
|
|
855
|
+
const resolved = await this.resolve(specifier, options.rendererImporter);
|
|
856
|
+
if (resolved) ids.push(resolved.id);
|
|
857
|
+
}
|
|
858
|
+
return ids;
|
|
859
|
+
};
|
|
860
|
+
const rendererModules = await resolve(options.rendererImports);
|
|
861
|
+
const actionModules = await resolve(options.actionImports);
|
|
837
862
|
await _promises2.default.mkdir(options.buildDir, { recursive: true });
|
|
838
863
|
await _promises2.default.writeFile(
|
|
839
864
|
_path2.default.join(options.buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE),
|
|
840
|
-
JSON.stringify(
|
|
865
|
+
JSON.stringify(
|
|
866
|
+
collectFarmClientModulePreloads(bundle, { ...options, rendererModules, actionModules })
|
|
867
|
+
)
|
|
841
868
|
);
|
|
842
869
|
}
|
|
843
870
|
};
|
|
@@ -847,7 +874,7 @@ async function readFarmClientModulePreloads(buildDir) {
|
|
|
847
874
|
return JSON.parse(
|
|
848
875
|
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE), "utf8")
|
|
849
876
|
);
|
|
850
|
-
} catch (
|
|
877
|
+
} catch (e8) {
|
|
851
878
|
return null;
|
|
852
879
|
}
|
|
853
880
|
}
|
|
@@ -910,8 +937,10 @@ function resolveFarmDocsClientRoutes(pages, docsPagePaths) {
|
|
|
910
937
|
function isStatic(segment) {
|
|
911
938
|
return segment === "static";
|
|
912
939
|
}
|
|
913
|
-
function generateFarmClientRouteTableModule(table) {
|
|
914
|
-
|
|
940
|
+
function generateFarmClientRouteTableModule(table, options = {}) {
|
|
941
|
+
const matcher = options.matcher ? `export { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
942
|
+
` : "";
|
|
943
|
+
return `${matcher}export default JSON.parse(${JSON.stringify(JSON.stringify(table))});
|
|
915
944
|
`;
|
|
916
945
|
}
|
|
917
946
|
async function writeFarmClientRouteTable(buildDir, table) {
|
|
@@ -923,7 +952,7 @@ async function readFarmClientRouteTable(buildDir) {
|
|
|
923
952
|
return JSON.parse(
|
|
924
953
|
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_CLIENT_ROUTE_TABLE_FILE), "utf8")
|
|
925
954
|
);
|
|
926
|
-
} catch (
|
|
955
|
+
} catch (e9) {
|
|
927
956
|
return null;
|
|
928
957
|
}
|
|
929
958
|
}
|
|
@@ -1007,7 +1036,7 @@ async function readFarmDocsModulePreloads(buildDir) {
|
|
|
1007
1036
|
return JSON.parse(
|
|
1008
1037
|
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_DOCS_MODULE_PRELOADS_FILE), "utf8")
|
|
1009
1038
|
);
|
|
1010
|
-
} catch (
|
|
1039
|
+
} catch (e10) {
|
|
1011
1040
|
return null;
|
|
1012
1041
|
}
|
|
1013
1042
|
}
|
|
@@ -1023,7 +1052,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
1023
1052
|
const routes = [];
|
|
1024
1053
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
1025
1054
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
1026
|
-
const rendering = await
|
|
1055
|
+
const rendering = await _chunkHRH7OKBQcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
1027
1056
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
1028
1057
|
routes.push({
|
|
1029
1058
|
kind: "page",
|
|
@@ -1110,7 +1139,7 @@ function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
|
1110
1139
|
`Route "${route.pattern}" requires the ${route.runtime} runtime, but preset "${preset}" emits ${runtime} functions. Choose a compatible preset or change the route runtime.`
|
|
1111
1140
|
);
|
|
1112
1141
|
}
|
|
1113
|
-
if (_optionalChain([route, 'access',
|
|
1142
|
+
if (_optionalChain([route, 'access', _10 => _10.regions, 'optionalAccess', _11 => _11.length]) && preset !== "vercel") {
|
|
1114
1143
|
warnings.add(
|
|
1115
1144
|
`Preset "${preset}" does not map per-route regions; Farm kept them in ${FARM_ROUTE_RUNTIME_MANIFEST} for deployment adapters.`
|
|
1116
1145
|
);
|
|
@@ -1157,7 +1186,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs5, b
|
|
|
1157
1186
|
const destinations = /* @__PURE__ */ new Map();
|
|
1158
1187
|
let groupIndex = 0;
|
|
1159
1188
|
for (const [key, group] of groups) {
|
|
1160
|
-
if (!_optionalChain([group, 'access',
|
|
1189
|
+
if (!_optionalChain([group, 'access', _12 => _12.config, 'access', _13 => _13.regions, 'optionalAccess', _14 => _14.length]) && !group.config.maxDuration) {
|
|
1161
1190
|
destinations.set(key, "/__nitro");
|
|
1162
1191
|
continue;
|
|
1163
1192
|
}
|
|
@@ -1207,14 +1236,14 @@ async function configureVercelFunction(functionDir, config, fs5) {
|
|
|
1207
1236
|
const current = JSON.parse(await fs5.readFile(configPath, "utf8"));
|
|
1208
1237
|
const next = {
|
|
1209
1238
|
...current,
|
|
1210
|
-
..._optionalChain([config, 'access',
|
|
1239
|
+
..._optionalChain([config, 'access', _15 => _15.regions, 'optionalAccess', _16 => _16.length]) ? { regions: config.regions } : {},
|
|
1211
1240
|
...config.maxDuration ? { maxDuration: config.maxDuration } : {}
|
|
1212
1241
|
};
|
|
1213
1242
|
await fs5.writeFile(configPath, `${JSON.stringify(next, null, 2)}
|
|
1214
1243
|
`);
|
|
1215
1244
|
}
|
|
1216
1245
|
function hasVercelFunctionControls(route) {
|
|
1217
|
-
return Boolean(_optionalChain([route, 'access',
|
|
1246
|
+
return Boolean(_optionalChain([route, 'access', _17 => _17.regions, 'optionalAccess', _18 => _18.length]) || route.maxDuration);
|
|
1218
1247
|
}
|
|
1219
1248
|
function compareRuntimeRoutes(left, right) {
|
|
1220
1249
|
const kindOrder = { page: 0, api: 0, metadata: 0, rule: 1 };
|
|
@@ -1259,7 +1288,7 @@ var FARM_HASHED_ASSET_DIRS = ["assets", "chunks"];
|
|
|
1259
1288
|
var LITERAL_ROUTE_PATH = /^\/[\w.~@/-]+$/;
|
|
1260
1289
|
function planFarmImmutableAssets(options) {
|
|
1261
1290
|
const cacheRulePatterns = Object.entries(_nullishCoalesce(options.routeRules, () => ( {}))).filter(
|
|
1262
|
-
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess',
|
|
1291
|
+
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess', _19 => _19.headers]), () => ( {}))).some((name) => name.toLowerCase() === "cache-control")
|
|
1263
1292
|
).map(([pattern]) => pattern);
|
|
1264
1293
|
const isImmutable = (file) => isFarmImmutableAssetPath(file) && !cacheRulePatterns.some((pattern) => _chunkIUKBPBM7cjs.farmRouteRuleMatches.call(void 0, pattern, file));
|
|
1265
1294
|
const routeDirs = new Set(
|
|
@@ -1377,7 +1406,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
|
1377
1406
|
let relativePath = relativeUrl.replace(/[?#].*$/, "");
|
|
1378
1407
|
try {
|
|
1379
1408
|
relativePath = decodeURI(relativePath);
|
|
1380
|
-
} catch (
|
|
1409
|
+
} catch (e11) {
|
|
1381
1410
|
}
|
|
1382
1411
|
const fileName = _path2.default.posix.normalize(
|
|
1383
1412
|
_path2.default.posix.join(_path2.default.posix.dirname(chunkFileName), relativePath)
|
|
@@ -1387,7 +1416,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
|
1387
1416
|
function replaceServerFileReferences(bundle, chunkFileName, code, replace) {
|
|
1388
1417
|
return code.replace(SERVER_FILE_URL_RE, (reference, _quote, relativeUrl) => {
|
|
1389
1418
|
const target = resolveBundleFileName(chunkFileName, relativeUrl);
|
|
1390
|
-
return target && _optionalChain([bundle, 'access',
|
|
1419
|
+
return target && _optionalChain([bundle, 'access', _20 => _20[target], 'optionalAccess', _21 => _21.type]) === "asset" ? replace(target) : reference;
|
|
1391
1420
|
});
|
|
1392
1421
|
}
|
|
1393
1422
|
function collectServerReadSSRAssets(bundle) {
|
|
@@ -1440,7 +1469,7 @@ function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
|
1440
1469
|
if (assets.length === 0) return;
|
|
1441
1470
|
const sources = assets.map((fileName) => {
|
|
1442
1471
|
const output = bundle[fileName];
|
|
1443
|
-
const original = _optionalChain([output, 'optionalAccess',
|
|
1472
|
+
const original = _optionalChain([output, 'optionalAccess', _22 => _22.type]) === "asset" ? _optionalChain([output, 'access', _23 => _23.originalFileNames, 'optionalAccess', _24 => _24[0]]) : void 0;
|
|
1444
1473
|
if (!original) return fileName;
|
|
1445
1474
|
return _path2.default.relative(root, _path2.default.resolve(root, original)).split(_path2.default.sep).join("/");
|
|
1446
1475
|
});
|
|
@@ -1459,7 +1488,7 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
|
|
|
1459
1488
|
transform(code, id) {
|
|
1460
1489
|
if (!code.includes("import.meta.url")) return null;
|
|
1461
1490
|
const chunkFileName = _path2.default.relative(ssrOutputDir, id.split("?", 1)[0]).split(_path2.default.sep).join("/");
|
|
1462
|
-
if (_optionalChain([bundle, 'access',
|
|
1491
|
+
if (_optionalChain([bundle, 'access', _25 => _25[chunkFileName], 'optionalAccess', _26 => _26.type]) !== "chunk") return null;
|
|
1463
1492
|
let changed = false;
|
|
1464
1493
|
const transformed = replaceServerFileReferences(
|
|
1465
1494
|
bundle,
|
|
@@ -1555,7 +1584,7 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
1555
1584
|
var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
|
|
1556
1585
|
var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
|
|
1557
1586
|
function isConfigObject(node) {
|
|
1558
|
-
return _optionalChain([node, 'optionalAccess',
|
|
1587
|
+
return _optionalChain([node, 'optionalAccess', _27 => _27.type]) === "ObjectExpression";
|
|
1559
1588
|
}
|
|
1560
1589
|
function propertyName(property) {
|
|
1561
1590
|
if (property.type !== "Property" || property.computed) return void 0;
|
|
@@ -1576,7 +1605,7 @@ function collectConfigObjects(node, found) {
|
|
|
1576
1605
|
}
|
|
1577
1606
|
if (current.type === "CallExpression") {
|
|
1578
1607
|
const callee = current.callee;
|
|
1579
|
-
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access',
|
|
1608
|
+
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _28 => _28.property, 'optionalAccess', _29 => _29.name]);
|
|
1580
1609
|
const argument = current.arguments[0];
|
|
1581
1610
|
if (name && CONFIG_FACTORIES.has(name) && isConfigObject(argument)) found.push(argument);
|
|
1582
1611
|
}
|
|
@@ -1609,7 +1638,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1609
1638
|
const trailingComma = /^\s*,/.exec(code.slice(properties[last].end));
|
|
1610
1639
|
removals.push([
|
|
1611
1640
|
properties[first].start,
|
|
1612
|
-
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess',
|
|
1641
|
+
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _30 => _30[0], 'access', _31 => _31.length]), () => ( 0)))
|
|
1613
1642
|
]);
|
|
1614
1643
|
}
|
|
1615
1644
|
first = last;
|
|
@@ -1624,7 +1653,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1624
1653
|
function realPath(file) {
|
|
1625
1654
|
try {
|
|
1626
1655
|
return _fs.realpathSync.call(void 0, file);
|
|
1627
|
-
} catch (
|
|
1656
|
+
} catch (e12) {
|
|
1628
1657
|
return _path2.default.resolve(file);
|
|
1629
1658
|
}
|
|
1630
1659
|
}
|
|
@@ -1636,7 +1665,7 @@ function farmStripPlatformConfigPlugin(configFiles) {
|
|
|
1636
1665
|
// removed block used (`readFileSync` for a version, say).
|
|
1637
1666
|
enforce: "pre",
|
|
1638
1667
|
transform: {
|
|
1639
|
-
filter: { id:
|
|
1668
|
+
filter: { id: _chunkJHRJ5V2Fcjs.fileNamePattern.call(void 0, configFiles) },
|
|
1640
1669
|
async handler(code, id) {
|
|
1641
1670
|
const file = id.split("?", 1)[0];
|
|
1642
1671
|
if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
|
|
@@ -1684,12 +1713,12 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
|
|
|
1684
1713
|
eval: true,
|
|
1685
1714
|
workerData: { runtime: _url.pathToFileURL.call(void 0, runtime).href, bodies: [...new Set(bodies)] }
|
|
1686
1715
|
});
|
|
1687
|
-
} catch (
|
|
1716
|
+
} catch (e13) {
|
|
1688
1717
|
done();
|
|
1689
1718
|
return;
|
|
1690
1719
|
}
|
|
1691
1720
|
worker.once("message", (entries) => {
|
|
1692
|
-
void _optionalChain([worker, 'optionalAccess',
|
|
1721
|
+
void _optionalChain([worker, 'optionalAccess', _32 => _32.terminate, 'call', _33 => _33()]);
|
|
1693
1722
|
done(entries);
|
|
1694
1723
|
});
|
|
1695
1724
|
worker.once("error", () => done());
|
|
@@ -1698,7 +1727,7 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
|
|
|
1698
1727
|
return {
|
|
1699
1728
|
pages,
|
|
1700
1729
|
dispose() {
|
|
1701
|
-
void _optionalChain([worker, 'optionalAccess',
|
|
1730
|
+
void _optionalChain([worker, 'optionalAccess', _34 => _34.terminate, 'call', _35 => _35()]);
|
|
1702
1731
|
}
|
|
1703
1732
|
};
|
|
1704
1733
|
}
|
|
@@ -1780,7 +1809,7 @@ function literalMatcher(node) {
|
|
|
1780
1809
|
if (node.type === "Literal" && node.regex)
|
|
1781
1810
|
return new RegExp(node.regex.pattern, node.regex.flags);
|
|
1782
1811
|
if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
|
|
1783
|
-
return _nullishCoalesce(_optionalChain([node, 'access',
|
|
1812
|
+
return _nullishCoalesce(_optionalChain([node, 'access', _36 => _36.quasis, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.value, 'optionalAccess', _39 => _39.cooked]), () => ( void 0));
|
|
1784
1813
|
}
|
|
1785
1814
|
return void 0;
|
|
1786
1815
|
}
|
|
@@ -1804,7 +1833,7 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1804
1833
|
let found = null;
|
|
1805
1834
|
for (const statement of program.body) {
|
|
1806
1835
|
if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
|
|
1807
|
-
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access',
|
|
1836
|
+
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _40 => _40.exported, 'optionalAccess', _41 => _41.name]) === "config")) {
|
|
1808
1837
|
return "unknown";
|
|
1809
1838
|
}
|
|
1810
1839
|
continue;
|
|
@@ -1812,14 +1841,14 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1812
1841
|
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
|
|
1813
1842
|
if (!declaration || declaration.type !== "VariableDeclaration") continue;
|
|
1814
1843
|
for (const declarator of declaration.declarations) {
|
|
1815
|
-
if (_optionalChain([declarator, 'access',
|
|
1844
|
+
if (_optionalChain([declarator, 'access', _42 => _42.id, 'optionalAccess', _43 => _43.type]) !== "Identifier" || declarator.id.name !== "config") continue;
|
|
1816
1845
|
if (declaration.kind !== "const" || !declarator.init) return "unknown";
|
|
1817
1846
|
const init = unwrap(declarator.init);
|
|
1818
1847
|
if (init.type !== "ObjectExpression") return "unknown";
|
|
1819
1848
|
const config = {};
|
|
1820
1849
|
for (const property of init.properties) {
|
|
1821
1850
|
if (property.type !== "Property" || property.computed) return "unknown";
|
|
1822
|
-
const key = _nullishCoalesce(_optionalChain([property, 'access',
|
|
1851
|
+
const key = _nullishCoalesce(_optionalChain([property, 'access', _44 => _44.key, 'optionalAccess', _45 => _45.name]), () => ( _optionalChain([property, 'access', _46 => _46.key, 'optionalAccess', _47 => _47.value])));
|
|
1823
1852
|
if (key === "runtime") {
|
|
1824
1853
|
const runtime = literalMatcher(unwrap(property.value));
|
|
1825
1854
|
if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
|
|
@@ -1840,9 +1869,9 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1840
1869
|
try {
|
|
1841
1870
|
const [{ readFile: readFile2 }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1842
1871
|
const parsed = vite.parseSync(filePath, await readFile2(filePath, "utf8"));
|
|
1843
|
-
if (_optionalChain([parsed, 'access',
|
|
1872
|
+
if (_optionalChain([parsed, 'access', _48 => _48.errors, 'optionalAccess', _49 => _49.length])) return "unknown";
|
|
1844
1873
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1845
|
-
} catch (
|
|
1874
|
+
} catch (e14) {
|
|
1846
1875
|
return "unknown";
|
|
1847
1876
|
}
|
|
1848
1877
|
}
|
|
@@ -1859,7 +1888,7 @@ function farmTargetRunsEdgeMiddleware(preset) {
|
|
|
1859
1888
|
return preset === "vercel";
|
|
1860
1889
|
}
|
|
1861
1890
|
function isFarmEdgeMiddlewareRoute(route) {
|
|
1862
|
-
return typeof route.config === "object" && _optionalChain([route, 'access',
|
|
1891
|
+
return typeof route.config === "object" && _optionalChain([route, 'access', _50 => _50.config, 'optionalAccess', _51 => _51.runtime]) === "edge";
|
|
1863
1892
|
}
|
|
1864
1893
|
function escapeRegExp3(value) {
|
|
1865
1894
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -1896,7 +1925,7 @@ export default createFarmVercelEdgeMiddleware({
|
|
|
1896
1925
|
${modules.join("\n")}
|
|
1897
1926
|
],
|
|
1898
1927
|
i18n: ${JSON.stringify(config.i18n)},
|
|
1899
|
-
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access',
|
|
1928
|
+
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _52 => _52.server, 'optionalAccess', _53 => _53.trustProxy]) === true })},
|
|
1900
1929
|
apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
1901
1930
|
notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
|
|
1902
1931
|
pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
|
|
@@ -1955,7 +1984,7 @@ async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
|
1955
1984
|
logLevel: "silent",
|
|
1956
1985
|
plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
|
|
1957
1986
|
resolve: {
|
|
1958
|
-
alias:
|
|
1987
|
+
alias: _chunkJHRJ5V2Fcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
1959
1988
|
conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
|
|
1960
1989
|
},
|
|
1961
1990
|
transform: {
|
|
@@ -2015,7 +2044,7 @@ async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
|
|
|
2015
2044
|
"utf8"
|
|
2016
2045
|
)
|
|
2017
2046
|
};
|
|
2018
|
-
} catch (
|
|
2047
|
+
} catch (e15) {
|
|
2019
2048
|
return {};
|
|
2020
2049
|
}
|
|
2021
2050
|
}
|
|
@@ -2034,7 +2063,7 @@ function findFarmCoreRoot(from) {
|
|
|
2034
2063
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
2035
2064
|
try {
|
|
2036
2065
|
if (JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core") return dir;
|
|
2037
|
-
} catch (
|
|
2066
|
+
} catch (e16) {
|
|
2038
2067
|
}
|
|
2039
2068
|
}
|
|
2040
2069
|
dir = _path2.default.dirname(dir);
|
|
@@ -2052,7 +2081,7 @@ function findInstalledPackageDir(name, from) {
|
|
|
2052
2081
|
if (_fs.existsSync.call(void 0, _path2.default.join(candidate, "package.json"))) {
|
|
2053
2082
|
try {
|
|
2054
2083
|
return _fs.realpathSync.call(void 0, candidate);
|
|
2055
|
-
} catch (
|
|
2084
|
+
} catch (e17) {
|
|
2056
2085
|
return null;
|
|
2057
2086
|
}
|
|
2058
2087
|
}
|
|
@@ -2068,7 +2097,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
2068
2097
|
let manifest;
|
|
2069
2098
|
try {
|
|
2070
2099
|
manifest = JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(dir, "package.json"), "utf8"));
|
|
2071
|
-
} catch (
|
|
2100
|
+
} catch (e18) {
|
|
2072
2101
|
return;
|
|
2073
2102
|
}
|
|
2074
2103
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
@@ -2084,7 +2113,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
2084
2113
|
if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
|
|
2085
2114
|
}
|
|
2086
2115
|
}
|
|
2087
|
-
} catch (
|
|
2116
|
+
} catch (e19) {
|
|
2088
2117
|
}
|
|
2089
2118
|
for (let next = queue.pop(); next; next = queue.pop()) {
|
|
2090
2119
|
const dir = findInstalledPackageDir(next.name, next.from);
|
|
@@ -2187,14 +2216,14 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
2187
2216
|
return {
|
|
2188
2217
|
name: "farm-prerender-runtime-resolver",
|
|
2189
2218
|
async resolveId(id, _importer, options) {
|
|
2190
|
-
if (_optionalChain([options, 'access',
|
|
2219
|
+
if (_optionalChain([options, 'access', _54 => _54.custom, 'optionalAccess', _55 => _55.farmPrerenderRuntimeResolve])) return null;
|
|
2191
2220
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
2192
2221
|
return null;
|
|
2193
2222
|
}
|
|
2194
2223
|
if (nitroEntry === void 0) {
|
|
2195
2224
|
try {
|
|
2196
2225
|
nitroEntry = resolveNitroEntry(root);
|
|
2197
|
-
} catch (
|
|
2226
|
+
} catch (e20) {
|
|
2198
2227
|
nitroEntry = null;
|
|
2199
2228
|
}
|
|
2200
2229
|
}
|
|
@@ -2215,7 +2244,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
2215
2244
|
let runtimeRequire = projectRequire;
|
|
2216
2245
|
try {
|
|
2217
2246
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
2218
|
-
} catch (
|
|
2247
|
+
} catch (e21) {
|
|
2219
2248
|
}
|
|
2220
2249
|
const loaders = [];
|
|
2221
2250
|
for (const specifier of modules) {
|
|
@@ -2224,7 +2253,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
2224
2253
|
try {
|
|
2225
2254
|
resolved = require2.resolve(specifier);
|
|
2226
2255
|
break;
|
|
2227
|
-
} catch (
|
|
2256
|
+
} catch (e22) {
|
|
2228
2257
|
}
|
|
2229
2258
|
}
|
|
2230
2259
|
if (resolved) {
|
|
@@ -2242,7 +2271,7 @@ function resolveNitroPackageEntry(root) {
|
|
|
2242
2271
|
let runtimeRequire = projectRequire;
|
|
2243
2272
|
try {
|
|
2244
2273
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
2245
|
-
} catch (
|
|
2274
|
+
} catch (e23) {
|
|
2246
2275
|
}
|
|
2247
2276
|
return runtimeRequire.resolve("nitro");
|
|
2248
2277
|
}
|
|
@@ -2296,7 +2325,7 @@ async function canUseRolldownBuilder() {
|
|
|
2296
2325
|
try {
|
|
2297
2326
|
await import("rolldown");
|
|
2298
2327
|
return true;
|
|
2299
|
-
} catch (
|
|
2328
|
+
} catch (e24) {
|
|
2300
2329
|
return false;
|
|
2301
2330
|
}
|
|
2302
2331
|
}
|
|
@@ -2310,12 +2339,12 @@ function hasReactDomEdgeServerBuild(root) {
|
|
|
2310
2339
|
try {
|
|
2311
2340
|
_module.createRequire.call(void 0, _path2.default.join(root, "package.json")).resolve("react-dom/server.edge");
|
|
2312
2341
|
return true;
|
|
2313
|
-
} catch (
|
|
2342
|
+
} catch (e25) {
|
|
2314
2343
|
return false;
|
|
2315
2344
|
}
|
|
2316
2345
|
}
|
|
2317
2346
|
function shouldAliasReactServerToWebBuild(renderer, preset) {
|
|
2318
|
-
return
|
|
2347
|
+
return _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
|
|
2319
2348
|
}
|
|
2320
2349
|
function isCloudflareImagePreset(preset) {
|
|
2321
2350
|
return preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module";
|
|
@@ -2345,7 +2374,7 @@ function isFarmCoreModule(file) {
|
|
|
2345
2374
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
2346
2375
|
try {
|
|
2347
2376
|
return JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core";
|
|
2348
|
-
} catch (
|
|
2377
|
+
} catch (e26) {
|
|
2349
2378
|
return false;
|
|
2350
2379
|
}
|
|
2351
2380
|
}
|
|
@@ -2357,7 +2386,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2357
2386
|
return {
|
|
2358
2387
|
name: "farm-omitted-metadata-image-runtime",
|
|
2359
2388
|
resolveId: {
|
|
2360
|
-
filter: { id:
|
|
2389
|
+
filter: { id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
|
|
2361
2390
|
handler(source, importer) {
|
|
2362
2391
|
if (source !== "@vercel/og") return null;
|
|
2363
2392
|
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
|
|
@@ -2366,7 +2395,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2366
2395
|
}
|
|
2367
2396
|
},
|
|
2368
2397
|
load: {
|
|
2369
|
-
filter: { id:
|
|
2398
|
+
filter: { id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
|
|
2370
2399
|
handler(id) {
|
|
2371
2400
|
if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
|
|
2372
2401
|
return `
|
|
@@ -2394,8 +2423,8 @@ function readVercelOgManifest(file) {
|
|
|
2394
2423
|
}
|
|
2395
2424
|
function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
2396
2425
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
2397
|
-
const entry = _optionalChain([vercelOg, 'optionalAccess',
|
|
2398
|
-
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess',
|
|
2426
|
+
const entry = _optionalChain([vercelOg, 'optionalAccess', _56 => _56.manifest, 'access', _57 => _57.exports, 'optionalAccess', _58 => _58["."], 'optionalAccess', _59 => _59[condition]]);
|
|
2427
|
+
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _60 => _60.default]);
|
|
2399
2428
|
return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
|
|
2400
2429
|
}
|
|
2401
2430
|
function createEdgeMetadataImageRuntimePlugin({
|
|
@@ -2411,7 +2440,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
2411
2440
|
const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
|
|
2412
2441
|
return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
|
|
2413
2442
|
}
|
|
2414
|
-
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2443
|
+
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _61 => _61.replace, 'call', _62 => _62(/\\/g, "/"), 'access', _63 => _63.includes, 'call', _64 => _64("/@vercel/og/")])) {
|
|
2415
2444
|
return null;
|
|
2416
2445
|
}
|
|
2417
2446
|
const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
|
|
@@ -2433,7 +2462,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
2433
2462
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
2434
2463
|
});
|
|
2435
2464
|
if (inlined !== code) return { code: inlined, map: null };
|
|
2436
|
-
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call',
|
|
2465
|
+
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _65 => _65(file), 'optionalAccess', _66 => _66.manifest, 'access', _67 => _67.version]), () => ( "(unknown version)"));
|
|
2437
2466
|
this.error(
|
|
2438
2467
|
`@vercel/og ${version} cannot be bundled for ${runtime}: ${file} does not load its default font with fetch(new URL("./<font>.ttf", import.meta.url)), the pattern Farm inlines because an edge function cannot fetch it. Install a @vercel/og version whose edge build does, such as 1.0.1.`
|
|
2439
2468
|
);
|
|
@@ -2444,7 +2473,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
2444
2473
|
return {
|
|
2445
2474
|
name: "farm-metadata-image-wasm",
|
|
2446
2475
|
resolveId(source, importer) {
|
|
2447
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2476
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _68 => _68.replace, 'call', _69 => _69(/\\/g, "/"), 'access', _70 => _70.includes, 'call', _71 => _71("/@vercel/og/")])) {
|
|
2448
2477
|
return null;
|
|
2449
2478
|
}
|
|
2450
2479
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -2520,9 +2549,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
2520
2549
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
2521
2550
|
}
|
|
2522
2551
|
function nameCodeSplittingGroups(bundlerConfig) {
|
|
2523
|
-
const outputs = _optionalChain([bundlerConfig, 'optionalAccess',
|
|
2552
|
+
const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _72 => _72.output]);
|
|
2524
2553
|
for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
|
|
2525
|
-
const groups = _optionalChain([output, 'optionalAccess',
|
|
2554
|
+
const groups = _optionalChain([output, 'optionalAccess', _73 => _73.codeSplitting, 'optionalAccess', _74 => _74.groups]);
|
|
2526
2555
|
if (!Array.isArray(groups)) continue;
|
|
2527
2556
|
groups.forEach((group, index) => {
|
|
2528
2557
|
if (group && typeof group.name === "function" && !group.debugName) {
|
|
@@ -2554,7 +2583,7 @@ function lexDynamicImportArguments(code) {
|
|
|
2554
2583
|
}
|
|
2555
2584
|
try {
|
|
2556
2585
|
return _esmodulelexer.parse.call(void 0, code)[0].filter((entry) => entry.d > -1).map((entry) => ({ start: entry.s, end: entry.e }));
|
|
2557
|
-
} catch (
|
|
2586
|
+
} catch (e27) {
|
|
2558
2587
|
return null;
|
|
2559
2588
|
}
|
|
2560
2589
|
}
|
|
@@ -2583,9 +2612,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
2583
2612
|
throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
|
|
2584
2613
|
}
|
|
2585
2614
|
const restore = (node) => {
|
|
2586
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
2615
|
+
if (_optionalChain([node, 'optionalAccess', _75 => _75.type]) !== "TemplateLiteral") return;
|
|
2587
2616
|
const template = node;
|
|
2588
|
-
const value = _optionalChain([template, 'access',
|
|
2617
|
+
const value = _optionalChain([template, 'access', _76 => _76.quasis, 'access', _77 => _77[0], 'optionalAccess', _78 => _78.value, 'access', _79 => _79.cooked]);
|
|
2589
2618
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
2590
2619
|
replacements.push({
|
|
2591
2620
|
start: template.start,
|
|
@@ -2663,7 +2692,7 @@ function hasProjectPostcssConfig(root) {
|
|
|
2663
2692
|
try {
|
|
2664
2693
|
projectRequire.resolve(`./${file}`);
|
|
2665
2694
|
return true;
|
|
2666
|
-
} catch (
|
|
2695
|
+
} catch (e28) {
|
|
2667
2696
|
return false;
|
|
2668
2697
|
}
|
|
2669
2698
|
});
|
|
@@ -2685,7 +2714,7 @@ async function findFarmConfigPath(root) {
|
|
|
2685
2714
|
try {
|
|
2686
2715
|
await fs5.access(resolvedPath);
|
|
2687
2716
|
return resolvedPath;
|
|
2688
|
-
} catch (
|
|
2717
|
+
} catch (e29) {
|
|
2689
2718
|
}
|
|
2690
2719
|
}
|
|
2691
2720
|
return null;
|
|
@@ -2708,7 +2737,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2708
2737
|
let entries;
|
|
2709
2738
|
try {
|
|
2710
2739
|
entries = await fs5.readdir(dir, { withFileTypes: true });
|
|
2711
|
-
} catch (
|
|
2740
|
+
} catch (e30) {
|
|
2712
2741
|
return;
|
|
2713
2742
|
}
|
|
2714
2743
|
const middlewareFile = entries.find(
|
|
@@ -2743,7 +2772,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2743
2772
|
return Array.from(routes.values()).sort(_chunkSHDCKRP4cjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
2744
2773
|
}
|
|
2745
2774
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
2746
|
-
if (!_optionalChain([config, 'access',
|
|
2775
|
+
if (!_optionalChain([config, 'access', _80 => _80.docs, 'optionalAccess', _81 => _81.enabled]) || !_optionalChain([config, 'access', _82 => _82.docs, 'access', _83 => _83.adapter, 'optionalAccess', _84 => _84.server]) || _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
2747
2776
|
return;
|
|
2748
2777
|
}
|
|
2749
2778
|
throw new Error(
|
|
@@ -2835,7 +2864,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2835
2864
|
const productionVite = productionViteResult.value;
|
|
2836
2865
|
_chunk7U4XF76Rcjs.logger.info("\u26A1 Building application bundles with Vite Rolldown");
|
|
2837
2866
|
const mobileClient = shouldBuildFarmMobileClient(config);
|
|
2838
|
-
const rendererDisabled =
|
|
2867
|
+
const rendererDisabled = _chunkNGTZHWBGcjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
2839
2868
|
const buildClientBundle = async () => {
|
|
2840
2869
|
if (rendererDisabled) {
|
|
2841
2870
|
await fs5.rm(clientOutputDir, { recursive: true, force: true });
|
|
@@ -2924,7 +2953,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2924
2953
|
);
|
|
2925
2954
|
}
|
|
2926
2955
|
}
|
|
2927
|
-
_optionalChain([sourceSnapshot, 'optionalAccess',
|
|
2956
|
+
_optionalChain([sourceSnapshot, 'optionalAccess', _85 => _85.clear, 'call', _86 => _86()]);
|
|
2928
2957
|
const ssrResult = ssrBuildResult.value;
|
|
2929
2958
|
const routeRuntimeManifest = routeRuntimeManifestResult.value;
|
|
2930
2959
|
const runtimeValidation = validateFarmRouteRuntimeDeployment(routeRuntimeManifest, preset);
|
|
@@ -2956,7 +2985,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2956
2985
|
configuredHeaderRoutes,
|
|
2957
2986
|
nitroBuilderResultPromise,
|
|
2958
2987
|
lifecyclePluginManager,
|
|
2959
|
-
_optionalChain([markdownPrecompile, 'optionalAccess',
|
|
2988
|
+
_optionalChain([markdownPrecompile, 'optionalAccess', _87 => _87.pages])
|
|
2960
2989
|
);
|
|
2961
2990
|
const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
|
|
2962
2991
|
_path2.default.join(root, distDir),
|
|
@@ -2977,8 +3006,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2977
3006
|
_chunk7U4XF76Rcjs.logger.error(`\u274C Build failed: ${error}`);
|
|
2978
3007
|
throw error;
|
|
2979
3008
|
} finally {
|
|
2980
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
2981
|
-
_optionalChain([markdownPrecompile, 'optionalAccess',
|
|
3009
|
+
_optionalChain([rendererBuild, 'optionalAccess', _88 => _88.abort, 'call', _89 => _89()]);
|
|
3010
|
+
_optionalChain([markdownPrecompile, 'optionalAccess', _90 => _90.dispose, 'call', _91 => _91()]);
|
|
2982
3011
|
}
|
|
2983
3012
|
}
|
|
2984
3013
|
function collectFarmPrerenderedMarkdownBodies(pageRoutes) {
|
|
@@ -2986,7 +3015,7 @@ function collectFarmPrerenderedMarkdownBodies(pageRoutes) {
|
|
|
2986
3015
|
for (const route of pageRoutes) {
|
|
2987
3016
|
if (route.source === void 0 || !_chunk26WP75W5cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) continue;
|
|
2988
3017
|
const { body } = _chunk26WP75W5cjs.parseMarkdownFrontmatter.call(void 0, route.source);
|
|
2989
|
-
const rendering =
|
|
3018
|
+
const rendering = _chunkHRH7OKBQcjs.resolveRouteRenderingConfig.call(void 0,
|
|
2990
3019
|
_chunk26WP75W5cjs.readFarmMarkdownRouteConfig.call(void 0, body),
|
|
2991
3020
|
route.source
|
|
2992
3021
|
);
|
|
@@ -3001,7 +3030,7 @@ function varyFarmNitroCacheRules(rules, headerNames) {
|
|
|
3001
3030
|
if (headerNames.length === 0) return rules;
|
|
3002
3031
|
return Object.fromEntries(
|
|
3003
3032
|
Object.entries(rules).map(([source, rule]) => {
|
|
3004
|
-
const cached = _optionalChain([rule, 'optionalAccess',
|
|
3033
|
+
const cached = _optionalChain([rule, 'optionalAccess', _92 => _92.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _93 => _93.cache]) !== void 0 && rule.cache !== false;
|
|
3005
3034
|
if (!cached || rule.cache === false) return [source, rule];
|
|
3006
3035
|
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
3007
3036
|
const varies = [
|
|
@@ -3030,7 +3059,7 @@ async function writeFarmVideoPlayerToClient(outputDir) {
|
|
|
3030
3059
|
const filePath = _path2.default.join(outputDir, _chunkY3DO7BIJcjs.FARM_VIDEO_PLAYER_PATH.slice(1));
|
|
3031
3060
|
await fs5.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
3032
3061
|
try {
|
|
3033
|
-
await fs5.writeFile(filePath,
|
|
3062
|
+
await fs5.writeFile(filePath, _chunkJHRJ5V2Fcjs.FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
|
|
3034
3063
|
} catch (error) {
|
|
3035
3064
|
if (error.code !== "EEXIST") throw error;
|
|
3036
3065
|
}
|
|
@@ -3052,7 +3081,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
3052
3081
|
if (fontCss === void 0) {
|
|
3053
3082
|
try {
|
|
3054
3083
|
fontCss = await fs5.readFile(fontCssPath);
|
|
3055
|
-
} catch (
|
|
3084
|
+
} catch (e31) {
|
|
3056
3085
|
return;
|
|
3057
3086
|
}
|
|
3058
3087
|
}
|
|
@@ -3060,11 +3089,11 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
3060
3089
|
let clientCss = "";
|
|
3061
3090
|
try {
|
|
3062
3091
|
clientCss = await fs5.readFile(clientCssPath, "utf8");
|
|
3063
|
-
} catch (
|
|
3092
|
+
} catch (e32) {
|
|
3064
3093
|
}
|
|
3065
3094
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
3066
3095
|
await fs5.writeFile(fontCssPath, normalizedFontCss);
|
|
3067
|
-
await fs5.writeFile(clientCssPath,
|
|
3096
|
+
await fs5.writeFile(clientCssPath, _chunkJHRJ5V2Fcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
3068
3097
|
}
|
|
3069
3098
|
function importsFarmClientBlockedPackage(id, packageName) {
|
|
3070
3099
|
return id === packageName || id.startsWith(`${packageName}/`);
|
|
@@ -3087,7 +3116,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3087
3116
|
try {
|
|
3088
3117
|
const clientEntry = await fs5.stat(clientEntryPath);
|
|
3089
3118
|
if (clientEntry.isFile()) clientEntrySize = clientEntry.size;
|
|
3090
|
-
} catch (
|
|
3119
|
+
} catch (e33) {
|
|
3091
3120
|
}
|
|
3092
3121
|
if (clientEntrySize === 0) {
|
|
3093
3122
|
throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
|
|
@@ -3098,7 +3127,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3098
3127
|
try {
|
|
3099
3128
|
const globalsCss = await fs5.readFile(globalsCssPath, "utf8");
|
|
3100
3129
|
expectsCss = globalsCss.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
|
|
3101
|
-
} catch (
|
|
3130
|
+
} catch (e34) {
|
|
3102
3131
|
}
|
|
3103
3132
|
try {
|
|
3104
3133
|
const clientCss = await fs5.stat(clientCssPath);
|
|
@@ -3114,10 +3143,10 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3114
3143
|
}
|
|
3115
3144
|
}
|
|
3116
3145
|
function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, options = {}) {
|
|
3117
|
-
const key =
|
|
3146
|
+
const key = _chunkEFI6QWBQcjs.getClientModuleHydrationPlanKey.call(void 0, modulePath, root, mode, options);
|
|
3118
3147
|
let plan = cache.get(key);
|
|
3119
3148
|
if (!plan) {
|
|
3120
|
-
plan =
|
|
3149
|
+
plan = _chunkEFI6QWBQcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
3121
3150
|
cache.set(key, plan);
|
|
3122
3151
|
}
|
|
3123
3152
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -3146,25 +3175,25 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3146
3175
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
3147
3176
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
3148
3177
|
);
|
|
3149
|
-
if (_optionalChain([config, 'access',
|
|
3178
|
+
if (_optionalChain([config, 'access', _94 => _94.experimental, 'optionalAccess', _95 => _95.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _96 => _96.experimental, 'optionalAccess', _97 => _97.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
3150
3179
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3151
3180
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
3152
3181
|
);
|
|
3153
3182
|
}
|
|
3154
|
-
const isolatedMode =
|
|
3155
|
-
_optionalChain([config, 'access',
|
|
3183
|
+
const isolatedMode = _chunkEFI6QWBQcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
3184
|
+
_optionalChain([config, 'access', _98 => _98.experimental, 'optionalAccess', _99 => _99.isolatedClientHydration]),
|
|
3156
3185
|
{
|
|
3157
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3186
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _100 => _100.experimental, 'optionalAccess', _101 => _101.serverComponents])) === "rsc",
|
|
3158
3187
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
3159
3188
|
}
|
|
3160
3189
|
);
|
|
3161
|
-
const planOptions =
|
|
3190
|
+
const planOptions = _chunkEFI6QWBQcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
3162
3191
|
config.renderer,
|
|
3163
3192
|
Boolean(unsupportedIntegrationProvider)
|
|
3164
3193
|
);
|
|
3165
3194
|
const pagePlanOptions = {
|
|
3166
3195
|
...planOptions,
|
|
3167
|
-
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3196
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _102 => _102.experimental, 'optionalAccess', _103 => _103.serverComponents])) === "islands"
|
|
3168
3197
|
};
|
|
3169
3198
|
const layoutPlanOptions = {
|
|
3170
3199
|
...planOptions,
|
|
@@ -3172,20 +3201,18 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3172
3201
|
};
|
|
3173
3202
|
const layoutAppliesToRoute = _chunkNEKO3HM2cjs.routeBoundaryCoversDirectory;
|
|
3174
3203
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
3175
|
-
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3176
|
-
const adapterOwnsDocsRuntime =
|
|
3177
|
-
|
|
3178
|
-
);
|
|
3179
|
-
const docsEntries = _optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
3204
|
+
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _104 => _104.experimental, 'optionalAccess', _105 => _105.serverComponents])) === "islands";
|
|
3205
|
+
const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
|
|
3206
|
+
const docsEntries = _optionalChain([config, 'access', _106 => _106.docs, 'optionalAccess', _107 => _107.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
3180
3207
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
3181
3208
|
) : [];
|
|
3182
3209
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
3183
3210
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
3184
3211
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
3185
3212
|
);
|
|
3186
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
3213
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
3187
3214
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
3188
|
-
const plan = (operation) => sourceSnapshot ?
|
|
3215
|
+
const plan = (operation) => sourceSnapshot ? _chunkEFI6QWBQcjs.withFarmSourceSnapshotOf.call(void 0, sourceSnapshot, operation) : _chunkEFI6QWBQcjs.withFarmSourceSnapshot.call(void 0, operation);
|
|
3189
3216
|
const { clientLayouts, clientRouteSlots } = plan(() => {
|
|
3190
3217
|
const clientLayouts2 = layoutRoutes.map((layout) => {
|
|
3191
3218
|
try {
|
|
@@ -3232,7 +3259,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3232
3259
|
};
|
|
3233
3260
|
}
|
|
3234
3261
|
});
|
|
3235
|
-
const markdownPagePlan =
|
|
3262
|
+
const markdownPagePlan = _chunkEFI6QWBQcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
3236
3263
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
3237
3264
|
root,
|
|
3238
3265
|
isolatedMode,
|
|
@@ -3248,7 +3275,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3248
3275
|
pagePlanOptions
|
|
3249
3276
|
)
|
|
3250
3277
|
}));
|
|
3251
|
-
|
|
3278
|
+
_chunkEFI6QWBQcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
3252
3279
|
clientLayouts2.map((layout) => ({
|
|
3253
3280
|
pattern: layout.pattern,
|
|
3254
3281
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -3282,7 +3309,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3282
3309
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
3283
3310
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
3284
3311
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3285
|
-
`\u26A0\uFE0F ${
|
|
3312
|
+
`\u26A0\uFE0F ${_chunkEFI6QWBQcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`
|
|
3286
3313
|
);
|
|
3287
3314
|
}
|
|
3288
3315
|
}
|
|
@@ -3317,7 +3344,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3317
3344
|
);
|
|
3318
3345
|
if (metadata.suppressedAsyncHydration) {
|
|
3319
3346
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3320
|
-
`\u26A0\uFE0F ${
|
|
3347
|
+
`\u26A0\uFE0F ${_chunkEFI6QWBQcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
3321
3348
|
);
|
|
3322
3349
|
}
|
|
3323
3350
|
const slotBoundaries = serverSlotPlans.filter(
|
|
@@ -3325,7 +3352,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3325
3352
|
).flatMap(({ plan: plan2 }) => plan2.isolatedBoundaries);
|
|
3326
3353
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
|
|
3327
3354
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
3328
|
-
const islandStrategy =
|
|
3355
|
+
const islandStrategy = _chunkJHRJ5V2Fcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
3329
3356
|
route,
|
|
3330
3357
|
metadata,
|
|
3331
3358
|
clientLayouts2,
|
|
@@ -3344,7 +3371,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3344
3371
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
3345
3372
|
],
|
|
3346
3373
|
// The server renders a server tree only below a hydrating layout.
|
|
3347
|
-
...
|
|
3374
|
+
..._chunkEFI6QWBQcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
3348
3375
|
});
|
|
3349
3376
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
3350
3377
|
}
|
|
@@ -3381,7 +3408,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3381
3408
|
}
|
|
3382
3409
|
const clientRouteSlots2 = routeSlots.filter((slot) => {
|
|
3383
3410
|
try {
|
|
3384
|
-
const metadata =
|
|
3411
|
+
const metadata = _chunkEFI6QWBQcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
|
|
3385
3412
|
return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
|
|
3386
3413
|
} catch (error) {
|
|
3387
3414
|
_chunk7U4XF76Rcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
@@ -3425,8 +3452,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3425
3452
|
srcDir,
|
|
3426
3453
|
adapterOwnsDocsRuntime ? false : _chunkN3H7UPBMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
3427
3454
|
adapterOwnsDocsRuntime ? void 0 : _chunkN3H7UPBMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
3428
|
-
_optionalChain([config, 'access',
|
|
3429
|
-
adapterOwnsDocsRuntime ?
|
|
3455
|
+
_optionalChain([config, 'access', _110 => _110.docs, 'optionalAccess', _111 => _111.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
3456
|
+
adapterOwnsDocsRuntime ? _chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter) : void 0,
|
|
3430
3457
|
config.i18n,
|
|
3431
3458
|
config.plugins,
|
|
3432
3459
|
config.renderer,
|
|
@@ -3434,11 +3461,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3434
3461
|
config.trailingSlash,
|
|
3435
3462
|
_chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
3436
3463
|
config.basePath,
|
|
3437
|
-
|
|
3438
|
-
adapterOwnsDocsRuntime ?
|
|
3439
|
-
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3464
|
+
_chunkJHRJ5V2Fcjs.generateClientCachePersistenceCode.call(void 0, _chunkJHRJ5V2Fcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
3465
|
+
adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
3466
|
+
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverComponents])) === "islands",
|
|
3440
3467
|
platform,
|
|
3441
|
-
islandsMode ?
|
|
3468
|
+
islandsMode ? _chunkEFI6QWBQcjs.collectFarmServerStylesheets.call(void 0,
|
|
3442
3469
|
[
|
|
3443
3470
|
...layoutRoutes.map((layout) => layout.modulePath),
|
|
3444
3471
|
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
@@ -3447,17 +3474,22 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3447
3474
|
) : []
|
|
3448
3475
|
);
|
|
3449
3476
|
const entryName = platform === "mobile" ? _chunkE5UN4OWXcjs.FARM_MOBILE_CLIENT_ENTRY_NAME : "farm-client";
|
|
3450
|
-
const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ?
|
|
3477
|
+
const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientEntry(clientHydrationCode) : { entry: clientHydrationCode, router: void 0, root: void 0 };
|
|
3451
3478
|
await fs5.writeFile(clientEntryPath, clientEntry.entry);
|
|
3452
3479
|
await fs5.writeFile(
|
|
3453
3480
|
_path2.default.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`),
|
|
3454
|
-
generateFarmClientRouteTableModule(clientRouteTable
|
|
3481
|
+
generateFarmClientRouteTableModule(clientRouteTable, {
|
|
3482
|
+
matcher: islandsMode && platform !== "mobile"
|
|
3483
|
+
})
|
|
3455
3484
|
);
|
|
3456
3485
|
if (clientEntry.router !== void 0) {
|
|
3457
3486
|
await fs5.writeFile(_path2.default.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
|
|
3458
3487
|
}
|
|
3488
|
+
if (clientEntry.root !== void 0) {
|
|
3489
|
+
await fs5.writeFile(_path2.default.join(clientEntryDir, "farm-client-root.tsx"), clientEntry.root);
|
|
3490
|
+
}
|
|
3459
3491
|
const clientInput = { [entryName]: clientEntryPath };
|
|
3460
|
-
if (platform === "web" &&
|
|
3492
|
+
if (platform === "web" && _chunkJHRJ5V2Fcjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
3461
3493
|
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
3462
3494
|
await fs5.writeFile(
|
|
3463
3495
|
clientBootPath,
|
|
@@ -3468,7 +3500,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3468
3500
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
3469
3501
|
let postcssSearchPath;
|
|
3470
3502
|
let tailwindVitePlugin = void 0;
|
|
3471
|
-
const rendererVitePlugins = await
|
|
3503
|
+
const rendererVitePlugins = await _chunkNGTZHWBGcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
3472
3504
|
ssr: false,
|
|
3473
3505
|
buildLifetime: rendererBuildLifetime
|
|
3474
3506
|
});
|
|
@@ -3499,11 +3531,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3499
3531
|
target: FARM_CLIENT_BUILD_TARGET,
|
|
3500
3532
|
// Tailwind CSS 4 already requires newer browsers than that baseline. An app's own
|
|
3501
3533
|
// `build.target` or `build.cssTarget` still decides, as Vite derives one from the other.
|
|
3502
|
-
..._optionalChain([config, 'access',
|
|
3534
|
+
..._optionalChain([config, 'access', _114 => _114.vite, 'optionalAccess', _115 => _115.build, 'optionalAccess', _116 => _116.target]) === void 0 && _optionalChain([config, 'access', _117 => _117.vite, 'optionalAccess', _118 => _118.build, 'optionalAccess', _119 => _119.cssTarget]) === void 0 && (_chunkDMSXZNQRcjs.includesTailwindVitePlugin.call(void 0, tailwindVitePlugin) || _chunkDMSXZNQRcjs.includesTailwindVitePlugin.call(void 0, _optionalChain([config, 'access', _120 => _120.vite, 'optionalAccess', _121 => _121.plugins]))) ? { cssTarget: _chunkDMSXZNQRcjs.TAILWIND_CSS_BROWSER_TARGET } : {},
|
|
3503
3535
|
outDir: outputDir,
|
|
3504
3536
|
emptyOutDir: platform === "web",
|
|
3505
3537
|
// Never public: see resolveFarmClientSourcemap.
|
|
3506
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
3538
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _122 => _122.vite, 'optionalAccess', _123 => _123.build, 'optionalAccess', _124 => _124.sourcemap])),
|
|
3507
3539
|
assetsInlineLimit: 0,
|
|
3508
3540
|
cssCodeSplit: false,
|
|
3509
3541
|
// Bundle all CSS into one file
|
|
@@ -3515,7 +3547,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3515
3547
|
hashCharacters: "hex",
|
|
3516
3548
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
3517
3549
|
assetFileNames: (assetInfo) => {
|
|
3518
|
-
if (_optionalChain([assetInfo, 'access',
|
|
3550
|
+
if (_optionalChain([assetInfo, 'access', _125 => _125.name, 'optionalAccess', _126 => _126.endsWith, 'call', _127 => _127(".css")])) {
|
|
3519
3551
|
return `${entryName}.css`;
|
|
3520
3552
|
}
|
|
3521
3553
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -3532,7 +3564,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3532
3564
|
}
|
|
3533
3565
|
},
|
|
3534
3566
|
plugins: [
|
|
3535
|
-
|
|
3567
|
+
_chunkJHRJ5V2Fcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
3536
3568
|
createFarmPrivateClientSourcemapsPlugin({
|
|
3537
3569
|
outDir: _path2.default.join(
|
|
3538
3570
|
_path2.default.dirname(outputDir),
|
|
@@ -3551,13 +3583,16 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3551
3583
|
_path2.default.join(clientEntryDir, "farm-client-router.tsx"),
|
|
3552
3584
|
_path2.default.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`)
|
|
3553
3585
|
],
|
|
3586
|
+
rootModules: [_path2.default.join(clientEntryDir, "farm-client-root.tsx")],
|
|
3554
3587
|
// What the islands entry loads with its first render or hydration (RFC 0010).
|
|
3555
|
-
...islandsMode &&
|
|
3588
|
+
...islandsMode && _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? {
|
|
3556
3589
|
rendererImports: [
|
|
3557
3590
|
"react",
|
|
3558
3591
|
"react-dom/client",
|
|
3559
3592
|
"@farm.js/core/internal/islands-runtime"
|
|
3560
3593
|
],
|
|
3594
|
+
// What a call's result is handled with, imported on the first (RFC 0013).
|
|
3595
|
+
actionImports: ["@farm.js/core/internal/islands-action-client"],
|
|
3561
3596
|
rendererImporter: clientEntryPath
|
|
3562
3597
|
} : {}
|
|
3563
3598
|
}),
|
|
@@ -3568,8 +3603,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3568
3603
|
importer: clientEntryPath,
|
|
3569
3604
|
entryName: "farm-client",
|
|
3570
3605
|
modules: [
|
|
3571
|
-
config.docs.adapter
|
|
3572
|
-
|
|
3606
|
+
_chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter),
|
|
3607
|
+
_chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
|
|
3573
3608
|
].filter((specifier) => Boolean(specifier))
|
|
3574
3609
|
})
|
|
3575
3610
|
] : [],
|
|
@@ -3578,8 +3613,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3578
3613
|
...config.vite.plugins || [],
|
|
3579
3614
|
farmServerOnlyEntriesPlugin({ platform, distDir: config.distDir || ".farm" }),
|
|
3580
3615
|
farmNavigationPlugin(config.renderer),
|
|
3581
|
-
|
|
3582
|
-
adapterOwnsDocsRuntime ?
|
|
3616
|
+
_chunkJHRJ5V2Fcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
3617
|
+
adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
3583
3618
|
),
|
|
3584
3619
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
3585
3620
|
{
|
|
@@ -3611,7 +3646,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3611
3646
|
},
|
|
3612
3647
|
load: {
|
|
3613
3648
|
filter: {
|
|
3614
|
-
id:
|
|
3649
|
+
id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, [
|
|
3615
3650
|
"\0empty-module",
|
|
3616
3651
|
"\0empty-api-route",
|
|
3617
3652
|
"\0farm-i18n-client-bridge",
|
|
@@ -3649,7 +3684,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3649
3684
|
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes, sourceSnapshot },
|
|
3650
3685
|
pluginManager
|
|
3651
3686
|
),
|
|
3652
|
-
|
|
3687
|
+
_chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
3653
3688
|
],
|
|
3654
3689
|
mode: "production",
|
|
3655
3690
|
css: postcssSearchPath ? {
|
|
@@ -3657,7 +3692,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3657
3692
|
} : void 0,
|
|
3658
3693
|
// Ensure React is bundled for client
|
|
3659
3694
|
resolve: {
|
|
3660
|
-
alias:
|
|
3695
|
+
alias: _chunkJHRJ5V2Fcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
3661
3696
|
dedupe: [...config.renderer.dedupe || []]
|
|
3662
3697
|
},
|
|
3663
3698
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -3671,7 +3706,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3671
3706
|
}
|
|
3672
3707
|
};
|
|
3673
3708
|
await viteBuild(
|
|
3674
|
-
|
|
3709
|
+
_chunkJHRJ5V2Fcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite, { clientOutput: true })
|
|
3675
3710
|
);
|
|
3676
3711
|
if (platform === "mobile") {
|
|
3677
3712
|
await fs5.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
@@ -3687,7 +3722,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3687
3722
|
} finally {
|
|
3688
3723
|
try {
|
|
3689
3724
|
await fs5.rm(clientEntryDir, { recursive: true, force: true });
|
|
3690
|
-
} catch (
|
|
3725
|
+
} catch (e35) {
|
|
3691
3726
|
}
|
|
3692
3727
|
}
|
|
3693
3728
|
};
|
|
@@ -3765,9 +3800,9 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
3765
3800
|
return response;
|
|
3766
3801
|
}
|
|
3767
3802
|
|
|
3768
|
-
${streamNavigations ? `${
|
|
3803
|
+
${streamNavigations ? `${_chunkJHRJ5V2Fcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
|
|
3769
3804
|
|
|
3770
|
-
${
|
|
3805
|
+
${_chunkJHRJ5V2Fcjs.FARM_EARLY_NAVIGATION_SOURCE}` : ""}
|
|
3771
3806
|
|
|
3772
3807
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
3773
3808
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -3844,18 +3879,27 @@ function loadFarmClientRouteTable() { return null; }
|
|
|
3844
3879
|
function prefetchFarmClientRouteTable() {}
|
|
3845
3880
|
const farmClientRoutesBoot = null;`;
|
|
3846
3881
|
}
|
|
3882
|
+
const lazy = options.lazyMatcher === true;
|
|
3883
|
+
const toClientRoute = `function(route) {
|
|
3884
|
+
const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
|
|
3885
|
+
return { ...route, navigation: "html-fragment", load: load || null };
|
|
3886
|
+
}`;
|
|
3847
3887
|
return `${prefetch}
|
|
3848
3888
|
let clientRoutes = [];
|
|
3849
|
-
|
|
3850
|
-
|
|
3889
|
+
${lazy ? `// The matcher, which loads with the table. Until then the entry matches only the document's own
|
|
3890
|
+
// path (readFarmClientBootRoute).
|
|
3891
|
+
let createFarmRouter = null;
|
|
3892
|
+
let isFarmRouteActive = null;
|
|
3893
|
+
let matchFarmRoute = null;
|
|
3894
|
+
let clientRouteMatcher = null;
|
|
3895
|
+
let clientPageRouteMatcher = null;
|
|
3896
|
+
let farmClientBootRoute = null;` : `let clientRouteMatcher = createFarmRouter([]);
|
|
3897
|
+
let clientPageRouteMatcher = clientRouteMatcher;`}
|
|
3851
3898
|
let farmClientRouteTableLoad = null;
|
|
3852
3899
|
let farmClientRouteTableLoaded = false;
|
|
3853
3900
|
|
|
3854
3901
|
function setFarmClientRoutes(routes) {
|
|
3855
|
-
clientRoutes = routes.map(
|
|
3856
|
-
const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
|
|
3857
|
-
return { ...route, navigation: "html-fragment", load: load || null };
|
|
3858
|
-
});
|
|
3902
|
+
clientRoutes = routes.map(${lazy ? "toFarmClientRoute" : toClientRoute});
|
|
3859
3903
|
clientRouteMatcher = createFarmRouter(clientRoutes.map(function(route) {
|
|
3860
3904
|
return { path: route.pattern, meta: route };
|
|
3861
3905
|
}));
|
|
@@ -3865,12 +3909,27 @@ function setFarmClientRoutes(routes) {
|
|
|
3865
3909
|
return { path: route.pattern, meta: route };
|
|
3866
3910
|
}))` : "clientRouteMatcher"};
|
|
3867
3911
|
}
|
|
3912
|
+
${lazy ? `
|
|
3913
|
+
function toFarmClientRoute(route) {
|
|
3914
|
+
const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
|
|
3915
|
+
return { ...route, navigation: "html-fragment", load: load || null };
|
|
3916
|
+
}
|
|
3868
3917
|
|
|
3918
|
+
// The document's own route, which it names with its params and layouts, until the table loads. A
|
|
3919
|
+
// match for another path waits for the table: the router loads it before it matches.
|
|
3920
|
+
function readFarmClientBootRoute(path) {
|
|
3921
|
+
if (farmClientBootRoute && farmClientBootRoute.path === path) return farmClientBootRoute;
|
|
3922
|
+
throw new Error("[Farm.js] " + path + " cannot be matched before the client route table loads.");
|
|
3923
|
+
}
|
|
3924
|
+
` : ""}
|
|
3869
3925
|
// Null once the whole table is in place, else a promise that settles when it is.
|
|
3870
3926
|
function loadFarmClientRouteTable() {
|
|
3871
3927
|
if (farmClientRouteTableLoaded) return null;
|
|
3872
3928
|
return farmClientRouteTableLoad || (farmClientRouteTableLoad = import("./${FARM_CLIENT_ROUTE_TABLE_MODULE}").then(function(module) {
|
|
3873
|
-
|
|
3929
|
+
${lazy ? ` createFarmRouter = module.createFarmRouter;
|
|
3930
|
+
isFarmRouteActive = module.isFarmRouteActive;
|
|
3931
|
+
matchFarmRoute = module.matchFarmRoute;
|
|
3932
|
+
` : ""} setFarmClientRoutes(module.default);
|
|
3874
3933
|
farmClientRouteTableLoaded = true;
|
|
3875
3934
|
}, function(error) {
|
|
3876
3935
|
farmClientRouteTableLoad = null;
|
|
@@ -3886,8 +3945,9 @@ function prefetchFarmClientRouteTable() {
|
|
|
3886
3945
|
|
|
3887
3946
|
const farmClientRoutesBoot = (function() {
|
|
3888
3947
|
const boot = window.__FARM_CLIENT_ROUTES__;
|
|
3889
|
-
if (boot && Array.isArray(boot.routes) && boot.path === getFarmRoutePathname(window.location.pathname)) {
|
|
3890
|
-
|
|
3948
|
+
if (boot && Array.isArray(boot.routes) && boot.path === getFarmRoutePathname(window.location.pathname)${lazy ? " &&\n boot.params && Array.isArray(boot.layouts)" : ""}) {
|
|
3949
|
+
${lazy ? ` clientRoutes = boot.routes.map(toFarmClientRoute);
|
|
3950
|
+
farmClientBootRoute = boot;` : " setFarmClientRoutes(boot.routes);"}
|
|
3891
3951
|
return null;
|
|
3892
3952
|
}
|
|
3893
3953
|
return loadFarmClientRouteTable().catch(function(error) {
|
|
@@ -3910,7 +3970,75 @@ for (const type of FARM_ROUTE_TABLE_INTENT_EVENTS) {
|
|
|
3910
3970
|
document.addEventListener(type, warmFarmClientRouteTable, { capture: true, passive: true });
|
|
3911
3971
|
}`;
|
|
3912
3972
|
}
|
|
3913
|
-
function
|
|
3973
|
+
function getFarmClientLayoutMatch(pattern) {
|
|
3974
|
+
const groupScope = _chunkNEKO3HM2cjs.getRouteGroupScope.call(void 0, pattern);
|
|
3975
|
+
return groupScope ? { pattern, urlPattern: _chunkNEKO3HM2cjs.stripRouteGroups.call(void 0, pattern), groupScope } : { pattern };
|
|
3976
|
+
}
|
|
3977
|
+
function generateFarmClientLayoutSelectionSource() {
|
|
3978
|
+
return `function selectFarmClientLayouts(layouts, routePathname, readDirectory) {
|
|
3979
|
+
const normalizedPath = routePathname.replace(/\\/$/, '') || '/';
|
|
3980
|
+
let directory;
|
|
3981
|
+
return layouts.filter(function(layout) {
|
|
3982
|
+
// Route groups add no URL segment: match the layout's URL, then keep a
|
|
3983
|
+
// grouped layout to the pages inside its group directory.
|
|
3984
|
+
const urlPattern = layout.urlPattern || layout.pattern;
|
|
3985
|
+
if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) return false;
|
|
3986
|
+
if (!layout.groupScope) return true;
|
|
3987
|
+
if (directory === undefined) directory = readDirectory();
|
|
3988
|
+
return typeof directory === 'string' &&
|
|
3989
|
+
(directory === layout.groupScope || directory.startsWith(layout.groupScope + '/'));
|
|
3990
|
+
});
|
|
3991
|
+
}`;
|
|
3992
|
+
}
|
|
3993
|
+
function generateFarmClientRouteMatchSource(options = {}) {
|
|
3994
|
+
const select = "selectFarmClientLayouts(layoutRoutes, path, function() { return getFarmPageDirectory(pathname); })";
|
|
3995
|
+
return `${generateFarmClientLayoutSelectionSource()}
|
|
3996
|
+
${options.lazyMatcher ? `
|
|
3997
|
+
// The document's own layouts, which it names, until the table loads (readFarmClientBootRoute).
|
|
3998
|
+
function readFarmClientBootLayouts(path) {
|
|
3999
|
+
const names = readFarmClientBootRoute(path).layouts;
|
|
4000
|
+
return layoutRoutes.filter(function(layout) { return names.includes(layout.pattern); });
|
|
4001
|
+
}
|
|
4002
|
+
` : ""}
|
|
4003
|
+
// Get applicable layouts for a pathname (sorted by depth, root first)
|
|
4004
|
+
function getApplicableLayouts(pathname) {
|
|
4005
|
+
const path = getFarmRoutePathname(pathname);
|
|
4006
|
+
const applicable = ${options.lazyMatcher ? `clientRouteMatcher
|
|
4007
|
+
? ${select}
|
|
4008
|
+
: readFarmClientBootLayouts(path)` : select};
|
|
4009
|
+
|
|
4010
|
+
// Sort by depth (root first)
|
|
4011
|
+
applicable.sort(function(a, b) {
|
|
4012
|
+
const depthA = a.pattern.split('/').filter(Boolean).length;
|
|
4013
|
+
const depthB = b.pattern.split('/').filter(Boolean).length;
|
|
4014
|
+
return depthA - depthB;
|
|
4015
|
+
});
|
|
4016
|
+
|
|
4017
|
+
return applicable;
|
|
4018
|
+
}
|
|
4019
|
+
|
|
4020
|
+
function hasHydratableLayout(pathname) {
|
|
4021
|
+
return getApplicableLayouts(pathname).some(function(layout) {
|
|
4022
|
+
return layout.shouldHydrate === true;
|
|
4023
|
+
});
|
|
4024
|
+
}
|
|
4025
|
+
|
|
4026
|
+
// Match pathname to client route
|
|
4027
|
+
function matchRoute(pathname) {
|
|
4028
|
+
const path = getFarmRoutePathname(pathname);
|
|
4029
|
+
${options.lazyMatcher ? ` if (!clientRouteMatcher) {
|
|
4030
|
+
// Without the document's route either (the table did not load), nothing matches, as with no table.
|
|
4031
|
+
if (!farmClientBootRoute) return null;
|
|
4032
|
+
const boot = readFarmClientBootRoute(path);
|
|
4033
|
+
return clientRoutes.length > 0 ? { route: clientRoutes[0], params: boot.params } : null;
|
|
4034
|
+
}
|
|
4035
|
+
` : ""} const matched = clientRouteMatcher.match(path);
|
|
4036
|
+
return matched
|
|
4037
|
+
? { route: matched.route.meta, params: matched.params }
|
|
4038
|
+
: null;
|
|
4039
|
+
}`;
|
|
4040
|
+
}
|
|
4041
|
+
function generateFarmClientBootRoutesServerSource(tableSource, layouts) {
|
|
3914
4042
|
return `// The client route table (client-route-table.ts), filled in from the client build. The client
|
|
3915
4043
|
// loads it on its first navigation; a document names the entries its page boots with, found
|
|
3916
4044
|
// with the client's own matcher, so its page hydrates without the table.
|
|
@@ -3930,18 +4058,40 @@ const farmClientRouteTable = (() => {
|
|
|
3930
4058
|
return null;
|
|
3931
4059
|
}
|
|
3932
4060
|
})();
|
|
3933
|
-
|
|
4061
|
+
${layouts ? `
|
|
4062
|
+
// The client's layouts (layoutRoutes in the client entry), of which a document names those that
|
|
4063
|
+
// apply at its path.
|
|
4064
|
+
const farmClientLayoutTable = ${JSON.stringify(layouts)};
|
|
4065
|
+
${generateFarmClientLayoutSelectionSource()}
|
|
4066
|
+
|
|
4067
|
+
// The layouts that apply at a route path, with the page directory the client's
|
|
4068
|
+
// getFarmPageDirectory reads from the route matched there.
|
|
4069
|
+
function getFarmClientBootLayouts(routePathname, matched, page) {
|
|
4070
|
+
const directory = !matched
|
|
4071
|
+
? null
|
|
4072
|
+
: matched.route.meta.docs && !matched.route.meta.directory
|
|
4073
|
+
? page ? page.route.meta.directory || page.route.meta.pattern : null
|
|
4074
|
+
: matched.route.meta.directory || matched.route.meta.pattern;
|
|
4075
|
+
return selectFarmClientLayouts(farmClientLayoutTable, routePathname, function() { return directory; })
|
|
4076
|
+
.map(function(layout) { return layout.pattern; });
|
|
4077
|
+
}
|
|
4078
|
+
` : ""}
|
|
3934
4079
|
// The entries the client's matchRoute and getFarmPageDirectory read for this route path.
|
|
3935
4080
|
function getFarmClientBootRoutes(routePathname) {
|
|
3936
4081
|
if (!farmClientRouteTable || typeof routePathname !== "string") return undefined;
|
|
3937
4082
|
const routes = [];
|
|
3938
4083
|
const matched = farmClientRouteTable.routes.match(routePathname);
|
|
4084
|
+
const page = matched && matched.route.meta.docs ? farmClientRouteTable.pages.match(routePathname) : null;
|
|
3939
4085
|
if (matched) {
|
|
3940
4086
|
routes.push(matched.route.meta);
|
|
3941
|
-
const page = matched.route.meta.docs ? farmClientRouteTable.pages.match(routePathname) : null;
|
|
3942
4087
|
if (page) routes.push(page.route.meta);
|
|
3943
4088
|
}
|
|
3944
|
-
return { path: routePathname, routes: routes };
|
|
4089
|
+
return { path: routePathname, routes: routes${layouts ? ", params: matched ? matched.params : {}, layouts: getFarmClientBootLayouts(routePathname, matched, page)" : ""} };
|
|
4090
|
+
}
|
|
4091
|
+
|
|
4092
|
+
// A status document's: no route matches at its path.
|
|
4093
|
+
function getFarmClientStatusBootRoutes(routePathname) {
|
|
4094
|
+
return { path: routePathname, routes: []${layouts ? ", params: {}, layouts: getFarmClientBootLayouts(routePathname, null, null)" : ""} };
|
|
3945
4095
|
}`;
|
|
3946
4096
|
}
|
|
3947
4097
|
function generateClientPageDirectorySource() {
|
|
@@ -4825,7 +4975,7 @@ function readFarmEntryImports(source) {
|
|
|
4825
4975
|
for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
|
|
4826
4976
|
const from = match[2];
|
|
4827
4977
|
const named = /\{([^}]*)\}/.exec(match[1]);
|
|
4828
|
-
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess',
|
|
4978
|
+
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _128 => _128[1], 'optionalAccess', _129 => _129.split, 'call', _130 => _130(",")]), () => ( []))) {
|
|
4829
4979
|
const [imported, local] = specifier.trim().split(/\s+as\s+/);
|
|
4830
4980
|
if (imported)
|
|
4831
4981
|
bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
|
|
@@ -4837,40 +4987,82 @@ function readFarmEntryImports(source) {
|
|
|
4837
4987
|
}
|
|
4838
4988
|
return bindings;
|
|
4839
4989
|
}
|
|
4840
|
-
|
|
4990
|
+
var FARM_LAZY_ROOT_STUB = `let farmRootLoading = null;
|
|
4991
|
+
function loadFarmRoot() {
|
|
4992
|
+
return farmRootLoading || (farmRootLoading = import("./farm-client-root").catch(function(error) {
|
|
4993
|
+
farmRootLoading = null;
|
|
4994
|
+
throw error;
|
|
4995
|
+
}));
|
|
4996
|
+
}
|
|
4997
|
+
`;
|
|
4998
|
+
var FARM_ROOT_MODULE_EXPORTS = [
|
|
4999
|
+
"createMatchedHydrationRoute",
|
|
5000
|
+
"hydrateFarmRoute",
|
|
5001
|
+
"renderFarmRoute",
|
|
5002
|
+
"farmTreeLayoutsReady",
|
|
5003
|
+
"loadRouteComponent",
|
|
5004
|
+
"createLayoutPageBoundary",
|
|
5005
|
+
"createFarmRouteState"
|
|
5006
|
+
];
|
|
5007
|
+
function takeFarmEntryRegions(code, kind) {
|
|
4841
5008
|
const regions = [];
|
|
4842
|
-
const
|
|
4843
|
-
|
|
4844
|
-
(_,
|
|
4845
|
-
regions.push(
|
|
5009
|
+
const rest = code.replace(
|
|
5010
|
+
new RegExp(`/\\*farm-${kind}-start\\*/([\\s\\S]*?)/\\*farm-${kind}-end\\*/\\n?`, "g"),
|
|
5011
|
+
(_, body) => {
|
|
5012
|
+
regions.push(body);
|
|
4846
5013
|
return "";
|
|
4847
5014
|
}
|
|
4848
5015
|
);
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
5016
|
+
return { rest, body: regions.join("\n") };
|
|
5017
|
+
}
|
|
5018
|
+
function splitFarmClientEntry(code) {
|
|
5019
|
+
const router = takeFarmEntryRegions(code, "router");
|
|
5020
|
+
const root = takeFarmEntryRegions(router.rest, "root");
|
|
5021
|
+
const splitsRoot = root.body !== "";
|
|
5022
|
+
const eager = splitsRoot ? root.rest.replace(
|
|
5023
|
+
/\/\*farm-root-stub-start\*\/[\s\S]*?\/\*farm-root-stub-end\*\/\n?/,
|
|
5024
|
+
() => FARM_LAZY_ROOT_STUB
|
|
5025
|
+
) : root.rest;
|
|
5026
|
+
const declared = {
|
|
5027
|
+
router: readFarmEntryDeclarations(router.body),
|
|
5028
|
+
root: readFarmEntryDeclarations(root.body),
|
|
5029
|
+
entry: readFarmEntryDeclarations(eager)
|
|
5030
|
+
};
|
|
4852
5031
|
const eagerCode = eager.replace(/^import\s[^;]*;/gm, "");
|
|
4853
5032
|
const usedByEntry = (name) => bindingPattern(name).test(eagerCode);
|
|
4854
|
-
const
|
|
4855
|
-
const
|
|
4856
|
-
const
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
5033
|
+
const eagerImports = readFarmEntryImports(eager);
|
|
5034
|
+
const fromEntry = /* @__PURE__ */ new Set();
|
|
5035
|
+
const link = (body, own) => {
|
|
5036
|
+
const uses = (name) => !own.has(name) && bindingPattern(name).test(body);
|
|
5037
|
+
const lines = [];
|
|
5038
|
+
const shared = [];
|
|
5039
|
+
for (const binding of eagerImports.filter((candidate) => uses(candidate.local))) {
|
|
5040
|
+
if (usedByEntry(binding.local)) shared.push(binding.local);
|
|
5041
|
+
else lines.push(`import ${binding.clause} from ${binding.from};`);
|
|
5042
|
+
}
|
|
5043
|
+
for (const name of declared.entry) if (uses(name)) shared.push(name);
|
|
5044
|
+
const names = [...new Set(shared)];
|
|
5045
|
+
for (const name of names) fromEntry.add(name);
|
|
5046
|
+
if (names.length > 0) lines.push(`import { ${names.join(", ")} } from "./farm-client-entry";`);
|
|
5047
|
+
return lines;
|
|
5048
|
+
};
|
|
5049
|
+
const routerImports = link(router.body, declared.router);
|
|
5050
|
+
const rootImports = splitsRoot ? link(root.body, declared.root) : [];
|
|
5051
|
+
const crossing = (body, names) => [...names].filter((name) => !declared.entry.has(name) && bindingPattern(name).test(body));
|
|
5052
|
+
const crossed = splitsRoot ? [...crossing(root.body, declared.router), ...crossing(router.body, declared.root)] : [];
|
|
5053
|
+
if (crossed.length > 0) {
|
|
5054
|
+
throw new Error(
|
|
5055
|
+
`The client entry's router and root code use ${crossed.join(", ")} from each other. Keep what both use outside the \`farm-router\` and \`farm-root\` regions.`
|
|
5056
|
+
);
|
|
5057
|
+
}
|
|
4863
5058
|
return {
|
|
4864
5059
|
entry: `${eager.replace("/*farm-router-stub*/", FARM_LAZY_ROUTER_STUB)}
|
|
4865
|
-
export { ${
|
|
5060
|
+
export { ${[...fromEntry].join(", ")} };
|
|
4866
5061
|
`,
|
|
4867
|
-
router: [
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
"export { spaRouter };",
|
|
4872
|
-
""
|
|
4873
|
-
].join("\n")
|
|
5062
|
+
router: [...routerImports, router.body, "export { spaRouter };", ""].join("\n"),
|
|
5063
|
+
root: splitsRoot ? [...rootImports, root.body, `export { ${FARM_ROOT_MODULE_EXPORTS.join(", ")} };`, ""].join(
|
|
5064
|
+
"\n"
|
|
5065
|
+
) : void 0
|
|
4874
5066
|
};
|
|
4875
5067
|
}
|
|
4876
5068
|
var FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME = `
|
|
@@ -4900,7 +5092,7 @@ var FARM_DOCUMENT_PARSED_RUNTIME = `function farmDocumentParsed() {
|
|
|
4900
5092
|
}
|
|
4901
5093
|
|
|
4902
5094
|
`;
|
|
4903
|
-
function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlots, root, srcDir, docsSearchEnabled, docsSearchModuleId, docsEntryPath,
|
|
5095
|
+
function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlots, root, srcDir, docsSearchEnabled, docsSearchModuleId, docsEntryPath, docsAdapterUI, i18nConfig = {
|
|
4904
5096
|
enabled: false,
|
|
4905
5097
|
basePath: "/",
|
|
4906
5098
|
locales: ["en"],
|
|
@@ -4918,7 +5110,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4918
5110
|
secure: false
|
|
4919
5111
|
},
|
|
4920
5112
|
direction: {}
|
|
4921
|
-
}, plugins = [], renderer =
|
|
5113
|
+
}, plugins = [], renderer = _chunkNGTZHWBGcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
|
|
4922
5114
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
4923
5115
|
const clientPluginEntry = _chunkDMSXZNQRcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
4924
5116
|
plugins,
|
|
@@ -4927,9 +5119,11 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4927
5119
|
publicRuntimeConfig,
|
|
4928
5120
|
platform
|
|
4929
5121
|
);
|
|
4930
|
-
const appSetupPath =
|
|
4931
|
-
const lazyRenderer = islandValues && platform !== "mobile" &&
|
|
4932
|
-
const
|
|
5122
|
+
const appSetupPath = _chunkNGTZHWBGcjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
|
|
5123
|
+
const lazyRenderer = islandValues && platform !== "mobile" && _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) && clientRouteSlots.length === 0;
|
|
5124
|
+
const lazyRoot = islandValues && platform !== "mobile";
|
|
5125
|
+
const lazyMatcher = lazyRoot && clientPages.length > 0;
|
|
5126
|
+
const rendererClientImports = lazyRenderer ? `import { holdFarmIslandInteractions, restorePagePosition, watchFarmIslandTriggers } from "@farm.js/core/internal/client-runtime";` : _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
|
|
4933
5127
|
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
4934
5128
|
import { restorePagePosition } from "@farm.js/core/internal/client-runtime";` : (
|
|
4935
5129
|
// Named exports only, as the server entry and the development client read them. A copy
|
|
@@ -4942,8 +5136,8 @@ __farmConfigureApp(__farmAppSetup);` : `import * as __farmRendererClient from ${
|
|
|
4942
5136
|
import { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};
|
|
4943
5137
|
const React = { ...__farmRendererClient };`
|
|
4944
5138
|
);
|
|
4945
|
-
const hydrateFarmRouteCall =
|
|
4946
|
-
const providerClientCode =
|
|
5139
|
+
const hydrateFarmRouteCall = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);";
|
|
5140
|
+
const providerClientCode = _chunkJHRJ5V2Fcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
4947
5141
|
integrationProviders,
|
|
4948
5142
|
root,
|
|
4949
5143
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -4965,6 +5159,7 @@ const React = { ...__farmRendererClient };`
|
|
|
4965
5159
|
).join("\n");
|
|
4966
5160
|
const layoutImportStatements = [];
|
|
4967
5161
|
const layoutRegistrations = [];
|
|
5162
|
+
const layoutComponents = [];
|
|
4968
5163
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
4969
5164
|
const treeLayoutPatterns = islandValues ? _chunkNEKO3HM2cjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
|
|
4970
5165
|
layoutRoutes.forEach((layout, index) => {
|
|
@@ -4976,13 +5171,23 @@ const React = { ...__farmRendererClient };`
|
|
|
4976
5171
|
if (rendersOnClient && !treeLayout) {
|
|
4977
5172
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
4978
5173
|
}
|
|
4979
|
-
const groupScope =
|
|
4980
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
5174
|
+
const { urlPattern, groupScope } = getFarmClientLayoutMatch(layout.pattern);
|
|
5175
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(urlPattern)}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
5176
|
+
const component = rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null";
|
|
5177
|
+
layoutComponents.push(component);
|
|
4981
5178
|
layoutRegistrations.push(
|
|
4982
|
-
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${
|
|
5179
|
+
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${lazyRoot ? "null" : component}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
|
|
4983
5180
|
);
|
|
4984
5181
|
});
|
|
4985
5182
|
const layoutImports = layoutImportStatements.join("\n");
|
|
5183
|
+
const layoutComponentsRuntime = lazyRoot && layoutComponents.some((component) => component !== "null") ? `/*farm-root-start*/
|
|
5184
|
+
${layoutImports}
|
|
5185
|
+
// The layouts' components, which only a page or layout root renders.
|
|
5186
|
+
[${layoutComponents.join(", ")}].forEach(function(Component, index) {
|
|
5187
|
+
layoutRoutes[index].Component = Component;
|
|
5188
|
+
});
|
|
5189
|
+
/*farm-root-end*/
|
|
5190
|
+
` : "";
|
|
4986
5191
|
const hasServerTreeLayouts = treeLayoutPatterns.size > 0;
|
|
4987
5192
|
const i18nRoutingConfig = {
|
|
4988
5193
|
locales: i18nConfig.locales,
|
|
@@ -5038,9 +5243,11 @@ function isFarmDocsPath() {
|
|
|
5038
5243
|
return false;
|
|
5039
5244
|
}
|
|
5040
5245
|
`;
|
|
5041
|
-
const docsAdapterRuntime =
|
|
5042
|
-
|
|
5043
|
-
docsConfigModule
|
|
5246
|
+
const docsAdapterRuntime = _chunkXJDB564Acjs.generateFarmDocsAdapterClientRuntime.call(void 0,
|
|
5247
|
+
docsAdapterUI,
|
|
5248
|
+
docsConfigModule,
|
|
5249
|
+
// Config resolution keeps an adapter to its UI's renderer, so this is the UI's renderer too.
|
|
5250
|
+
_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) ? void 0 : renderer.client
|
|
5044
5251
|
);
|
|
5045
5252
|
if (clientPages.length === 0 && clientRouteSlots.length === 0 && !providerClientCode.hasProviders) {
|
|
5046
5253
|
return `
|
|
@@ -5064,7 +5271,7 @@ mountFarmDocsSearch();
|
|
|
5064
5271
|
|
|
5065
5272
|
${generateUniversalRouterStateRuntime()}
|
|
5066
5273
|
|
|
5067
|
-
${
|
|
5274
|
+
${_chunkJHRJ5V2Fcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
5068
5275
|
|
|
5069
5276
|
// SPA Router for server-rendered pages (HTML swap)
|
|
5070
5277
|
const spaRouter = {
|
|
@@ -5501,6 +5708,7 @@ async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
|
|
|
5501
5708
|
await farmIsolatedHydrationRuntime.hydrate(scope, signal);
|
|
5502
5709
|
}
|
|
5503
5710
|
${serverTreeEnabled ? `
|
|
5711
|
+
/*farm-root-start*/
|
|
5504
5712
|
// A server-tree page (an async page below a hydrating layout) rebuilds in the layout's root.
|
|
5505
5713
|
async function createFarmServerTreePageElement(source, pathname) {
|
|
5506
5714
|
try {
|
|
@@ -5514,7 +5722,10 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
5514
5722
|
console.warn("[Farm.js] Could not rebuild the server tree of " + pathname + "; its server HTML was kept.", error);
|
|
5515
5723
|
return null;
|
|
5516
5724
|
}
|
|
5517
|
-
}
|
|
5725
|
+
}
|
|
5726
|
+
/*farm-root-end*/` : "\n/*farm-root-start*/\nasync function createFarmServerTreePageElement() { return null; }\n/*farm-root-end*/"}` : `/*farm-root-start*/
|
|
5727
|
+
async function createFarmServerTreePageElement() { return null; }
|
|
5728
|
+
/*farm-root-end*/`;
|
|
5518
5729
|
const routeClientGraphRuntime = isolatedHydrationEnabled ? `function wrapFarmRouteClientGraph(element) {
|
|
5519
5730
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
5520
5731
|
}` : `function wrapFarmRouteClientGraph(element) { return element; }`;
|
|
@@ -5534,13 +5745,13 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
5534
5745
|
return `
|
|
5535
5746
|
// Farm.js Client Runtime - SPA with Hydration
|
|
5536
5747
|
${cssImport}
|
|
5537
|
-
${layoutImports}
|
|
5748
|
+
${lazyRoot ? "" : layoutImports}
|
|
5538
5749
|
${rendererClientImports}
|
|
5539
5750
|
${isolatedHydrationImport}
|
|
5540
5751
|
${providerClientCode.imports}
|
|
5541
5752
|
import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, replayFarmQueuedInteraction, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
5542
5753
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
5543
|
-
import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
5754
|
+
${lazyMatcher ? "" : 'import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";'}
|
|
5544
5755
|
${clientPluginEntry.imports}
|
|
5545
5756
|
${clientCachePersistence.imports}
|
|
5546
5757
|
${i18nClientRuntime}
|
|
@@ -5564,7 +5775,8 @@ ${routeLoaders.join("\n")}
|
|
|
5564
5775
|
${generateFarmClientRouteTableRuntime({
|
|
5565
5776
|
table: clientPages.length > 0,
|
|
5566
5777
|
docs: clientPages.some((page) => page.docs),
|
|
5567
|
-
streamNavigations: islandValues
|
|
5778
|
+
streamNavigations: islandValues,
|
|
5779
|
+
lazyMatcher
|
|
5568
5780
|
})}
|
|
5569
5781
|
${generateClientPageDirectorySource()}
|
|
5570
5782
|
|
|
@@ -5580,44 +5792,10 @@ const layoutRoutes = [
|
|
|
5580
5792
|
${layoutRegistrations.join(",\n")}
|
|
5581
5793
|
];
|
|
5582
5794
|
|
|
5583
|
-
|
|
5584
|
-
function getApplicableLayouts(pathname) {
|
|
5585
|
-
const applicable = [];
|
|
5586
|
-
const normalizedPath = getFarmRoutePathname(pathname).replace(/\\/$/, '') || '/';
|
|
5587
|
-
let directory;
|
|
5588
|
-
|
|
5589
|
-
for (const layout of layoutRoutes) {
|
|
5590
|
-
// Route groups add no URL segment: match the layout's URL, then keep a
|
|
5591
|
-
// grouped layout to the pages inside its group directory.
|
|
5592
|
-
const urlPattern = layout.urlPattern || layout.pattern;
|
|
5593
|
-
if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) continue;
|
|
5594
|
-
if (layout.groupScope) {
|
|
5595
|
-
if (directory === undefined) directory = getFarmPageDirectory(pathname);
|
|
5596
|
-
if (
|
|
5597
|
-
typeof directory !== 'string' ||
|
|
5598
|
-
(directory !== layout.groupScope && !directory.startsWith(layout.groupScope + '/'))
|
|
5599
|
-
) continue;
|
|
5600
|
-
}
|
|
5601
|
-
applicable.push(layout);
|
|
5602
|
-
}
|
|
5603
|
-
|
|
5604
|
-
// Sort by depth (root first)
|
|
5605
|
-
applicable.sort(function(a, b) {
|
|
5606
|
-
const depthA = a.pattern.split('/').filter(Boolean).length;
|
|
5607
|
-
const depthB = b.pattern.split('/').filter(Boolean).length;
|
|
5608
|
-
return depthA - depthB;
|
|
5609
|
-
});
|
|
5610
|
-
|
|
5611
|
-
return applicable;
|
|
5612
|
-
}
|
|
5613
|
-
|
|
5614
|
-
function hasHydratableLayout(pathname) {
|
|
5615
|
-
return getApplicableLayouts(pathname).some(function(layout) {
|
|
5616
|
-
return layout.shouldHydrate === true;
|
|
5617
|
-
});
|
|
5618
|
-
}
|
|
5795
|
+
${generateFarmClientRouteMatchSource({ lazyMatcher })}
|
|
5619
5796
|
|
|
5620
|
-
${
|
|
5797
|
+
${layoutComponentsRuntime}/*farm-root-start*/
|
|
5798
|
+
${_chunkJHRJ5V2Fcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
5621
5799
|
// Wrap a page element with applicable layouts
|
|
5622
5800
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
5623
5801
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -5652,7 +5830,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
5652
5830
|
return React.createElement("div", props, pageElement);
|
|
5653
5831
|
}
|
|
5654
5832
|
let farmLastRouteState = null;
|
|
5655
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
5833
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkJHRJ5V2Fcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
5656
5834
|
function farmTreeLayoutsOf(pathname) {
|
|
5657
5835
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
5658
5836
|
return layout.serverTree === true;
|
|
@@ -5682,15 +5860,9 @@ function prepareFarmTreeLayouts(pathname, params, source) {
|
|
|
5682
5860
|
);
|
|
5683
5861
|
}` : `function farmTreeLayoutsReady() { return true; }
|
|
5684
5862
|
async function prepareFarmTreeLayouts() { return true; }`}
|
|
5863
|
+
/*farm-root-end*/
|
|
5685
5864
|
|
|
5686
|
-
|
|
5687
|
-
function matchRoute(pathname) {
|
|
5688
|
-
const matched = clientRouteMatcher.match(getFarmRoutePathname(pathname));
|
|
5689
|
-
return matched
|
|
5690
|
-
? { route: matched.route.meta, params: matched.params }
|
|
5691
|
-
: null;
|
|
5692
|
-
}
|
|
5693
|
-
|
|
5865
|
+
/*farm-root-start*/
|
|
5694
5866
|
async function loadRouteComponent(route) {
|
|
5695
5867
|
if (!route.load) return null;${lazyRenderer ? `
|
|
5696
5868
|
// A page component renders with React DOM, which loads beside it (RFC 0010).
|
|
@@ -5773,7 +5945,7 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, navi
|
|
|
5773
5945
|
|
|
5774
5946
|
if (!pageElement) return null;
|
|
5775
5947
|
if (!hydrateLayouts) {
|
|
5776
|
-
${
|
|
5948
|
+
${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, renderer) ? "if (hydrationContainer) pageElement = restorePagePosition(React, hydrationContainer, pageElement);" : ""}
|
|
5777
5949
|
return createFarmRouteState(pageElement, pathname, params, false);
|
|
5778
5950
|
}
|
|
5779
5951
|
if (matched.route.pageShouldHydrate) {
|
|
@@ -5802,7 +5974,7 @@ function createFarmRouteState(page, pathname, params, includeLayouts) {
|
|
|
5802
5974
|
|
|
5803
5975
|
function hydrateFarmRoute(container, route) {
|
|
5804
5976
|
farmLastRouteState = route;
|
|
5805
|
-
${
|
|
5977
|
+
${_chunkNGTZHWBGcjs.getFarmRendererCapabilities.call(void 0, renderer).hydrationFallback ? `try {
|
|
5806
5978
|
${hydrateFarmRouteCall}
|
|
5807
5979
|
} catch (error) {
|
|
5808
5980
|
// The renderer opted in with capabilities.hydrationFallback, as development always does. The
|
|
@@ -5819,6 +5991,7 @@ function renderFarmRoute(root, route) {
|
|
|
5819
5991
|
if (route.layouts.length > 0 && typeof root.renderRoute === "function") root.renderRoute(route);
|
|
5820
5992
|
else root.render(route.element);
|
|
5821
5993
|
}
|
|
5994
|
+
/*farm-root-end*/
|
|
5822
5995
|
|
|
5823
5996
|
/*farm-router-start*/
|
|
5824
5997
|
function matchesRoutePrefix(pathname, pattern) {
|
|
@@ -6202,7 +6375,10 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
|
|
|
6202
6375
|
}
|
|
6203
6376
|
const searchParams = searchParamsToObject(new URLSearchParams(window.location.search));
|
|
6204
6377
|
const shouldHydrate = !isHydrated && Boolean(container.innerHTML.trim());
|
|
6205
|
-
|
|
6378
|
+
// The code that renders the root loads when its strategy is due (RFC 0013).
|
|
6379
|
+
const farmRoot = await loadFarmRoot();
|
|
6380
|
+
if (hydrationController.signal.aborted || !container.isConnected) return;
|
|
6381
|
+
const routeState = await farmRoot.createMatchedHydrationRoute(
|
|
6206
6382
|
matched,
|
|
6207
6383
|
pathname,
|
|
6208
6384
|
searchParams,
|
|
@@ -6222,7 +6398,7 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
|
|
|
6222
6398
|
// navigation, that is not a failure, so error hooks never see it.
|
|
6223
6399
|
if (hydrationController.signal.aborted || !container.isConnected) return;
|
|
6224
6400
|
if (shouldHydrate) {
|
|
6225
|
-
reactRoot = hydrateFarmRoute(container, routeState);
|
|
6401
|
+
reactRoot = farmRoot.hydrateFarmRoute(container, routeState);
|
|
6226
6402
|
reactRootContainer = container;
|
|
6227
6403
|
isHydrated = true;
|
|
6228
6404
|
} else {
|
|
@@ -6230,7 +6406,7 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
|
|
|
6230
6406
|
reactRoot = createRoot(container);
|
|
6231
6407
|
reactRootContainer = container;
|
|
6232
6408
|
}
|
|
6233
|
-
renderFarmRoute(reactRoot, routeState);
|
|
6409
|
+
farmRoot.renderFarmRoute(reactRoot, routeState);
|
|
6234
6410
|
}
|
|
6235
6411
|
await farmClientRuntime.completeHydration(hydrationSession);
|
|
6236
6412
|
} catch (error) {
|
|
@@ -6245,6 +6421,14 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
|
|
|
6245
6421
|
});
|
|
6246
6422
|
}
|
|
6247
6423
|
|
|
6424
|
+
// The code that renders a page or layout root, which islands mode's web build loads on demand
|
|
6425
|
+
// (RFC 0013) and every other client has here.
|
|
6426
|
+
/*farm-root-stub-start*/
|
|
6427
|
+
function loadFarmRoot() {
|
|
6428
|
+
return Promise.resolve({ ${FARM_ROOT_MODULE_EXPORTS.join(", ")} });
|
|
6429
|
+
}
|
|
6430
|
+
/*farm-root-stub-end*/
|
|
6431
|
+
|
|
6248
6432
|
/*farm-router-start*/
|
|
6249
6433
|
// A layout boundary is the same layout when its key matches: islands mode keys it by pattern and
|
|
6250
6434
|
// params, so a layout whose params change renders again. Other modes compare patterns.
|
|
@@ -6281,7 +6465,7 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
|
|
|
6281
6465
|
return true;
|
|
6282
6466
|
}` : ""}
|
|
6283
6467
|
|
|
6284
|
-
${
|
|
6468
|
+
${_chunkJHRJ5V2Fcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
6285
6469
|
|
|
6286
6470
|
function activateNavigationScripts(root) {
|
|
6287
6471
|
for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
|
|
@@ -6387,7 +6571,7 @@ function getLayoutShell(root, patterns, index) {
|
|
|
6387
6571
|
return shell.innerHTML;
|
|
6388
6572
|
}
|
|
6389
6573
|
|
|
6390
|
-
${islandValues ?
|
|
6574
|
+
${islandValues ? _chunkJHRJ5V2Fcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
6391
6575
|
// A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
|
|
6392
6576
|
if (refresh) revealFarmStreamedContent(nextRoot);
|
|
6393
6577
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
@@ -6520,6 +6704,14 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6520
6704
|
}
|
|
6521
6705
|
const pathname = url.pathname;
|
|
6522
6706
|
const matched = matchRoute(pathname);
|
|
6707
|
+
// A root that hydrates on load renders with code that loads beside its page (RFC 0013).
|
|
6708
|
+
if (
|
|
6709
|
+
matched &&
|
|
6710
|
+
(matched.route.pageShouldHydrate || hasHydratableLayout(pathname)) &&
|
|
6711
|
+
(matched.route.islandStrategy || "load") === "load"
|
|
6712
|
+
) {
|
|
6713
|
+
void loadFarmRoot().catch(function() {});
|
|
6714
|
+
}
|
|
6523
6715
|
const from = this.currentPath;
|
|
6524
6716
|
if (await this.shouldBlockNavigation({ from, to, action })) {
|
|
6525
6717
|
if (action === "pop") this.revertBlockedPopState(from);
|
|
@@ -6609,23 +6801,22 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6609
6801
|
}
|
|
6610
6802
|
}
|
|
6611
6803
|
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
matched?.route.navigation === "client-render"
|
|
6615
|
-
|
|
6616
|
-
) {
|
|
6804
|
+
// The code that renders a page loads with the navigation to one (RFC 0013).
|
|
6805
|
+
const farmRoot =
|
|
6806
|
+
!options.refresh && matched?.route.navigation === "client-render" ? await loadFarmRoot() : null;
|
|
6807
|
+
if (farmRoot && farmRoot.farmTreeLayoutsReady(pathname, matched.params)) {
|
|
6617
6808
|
// Navigation itself signals intent, so destination routes load eagerly even
|
|
6618
6809
|
// when their initial document hydration strategy is deferred.
|
|
6619
|
-
const Component = await loadRouteComponent(matched.route);
|
|
6810
|
+
const Component = await farmRoot.loadRouteComponent(matched.route);
|
|
6620
6811
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
6621
6812
|
const params = matched.params;
|
|
6622
6813
|
const searchParams = searchParamsToObject(url.searchParams);
|
|
6623
6814
|
const props = { params: params, searchParams: createFarmSearchParams(searchParams) };
|
|
6624
6815
|
let pageElement = React.createElement(Component, props);
|
|
6625
6816
|
if (hasHydratableLayout(pathname)) {
|
|
6626
|
-
pageElement = createLayoutPageBoundary(matched.route, pageElement);
|
|
6817
|
+
pageElement = farmRoot.createLayoutPageBoundary(matched.route, pageElement);
|
|
6627
6818
|
}
|
|
6628
|
-
const routeState = createFarmRouteState(
|
|
6819
|
+
const routeState = farmRoot.createFarmRouteState(
|
|
6629
6820
|
pageElement,
|
|
6630
6821
|
pathname,
|
|
6631
6822
|
params,
|
|
@@ -6648,7 +6839,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6648
6839
|
if (!reactRoot) {
|
|
6649
6840
|
setFarmReactRoot(createRoot(container), container);
|
|
6650
6841
|
}
|
|
6651
|
-
renderFarmRoute(reactRoot, routeState);
|
|
6842
|
+
farmRoot.renderFarmRoute(reactRoot, routeState);
|
|
6652
6843
|
}
|
|
6653
6844
|
this.currentPath = to;
|
|
6654
6845
|
});
|
|
@@ -6796,12 +6987,22 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6796
6987
|
const matched = matchRoute(newPathname);
|
|
6797
6988
|
const hydrateLayouts = hasHydratableLayout(newPathname);
|
|
6798
6989
|
const nextPage = newRoot.querySelector("#__farm_page__");
|
|
6990
|
+
// A root that hydrates on load, or one React already renders, renders with code that loads
|
|
6991
|
+
// with the navigation to it (RFC 0013). One that waits for its trigger loads it then.
|
|
6992
|
+
const farmRoot =
|
|
6993
|
+
matched &&
|
|
6994
|
+
(hydrateLayouts || matched.route.pageShouldHydrate) &&
|
|
6995
|
+
((matched.route.islandStrategy || "load") === "load" ||
|
|
6996
|
+
(hydrateLayouts && reactRoot && reactRootContainer === currentRoot))
|
|
6997
|
+
? await loadFarmRoot()
|
|
6998
|
+
: null;
|
|
6999
|
+
if (!isNavigationCurrent()) return false;
|
|
6799
7000
|
|
|
6800
7001
|
// If React already owns the shared layout, update that root. React keeps
|
|
6801
7002
|
// matching layout component instances and their state mounted.
|
|
6802
|
-
if (matched && hydrateLayouts && reactRoot && reactRootContainer === currentRoot) {
|
|
7003
|
+
if (matched && hydrateLayouts && reactRoot && reactRootContainer === currentRoot && farmRoot) {
|
|
6803
7004
|
const searchParams = searchParamsToObject(targetUrl.searchParams);
|
|
6804
|
-
const routeState = await createMatchedHydrationRoute(
|
|
7005
|
+
const routeState = await farmRoot.createMatchedHydrationRoute(
|
|
6805
7006
|
matched,
|
|
6806
7007
|
newPathname,
|
|
6807
7008
|
searchParams,
|
|
@@ -6811,7 +7012,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6811
7012
|
);
|
|
6812
7013
|
if (!isNavigationCurrent()) return false;
|
|
6813
7014
|
if (routeState) {
|
|
6814
|
-
renderFarmRoute(reactRoot, routeState);
|
|
7015
|
+
farmRoot.renderFarmRoute(reactRoot, routeState);
|
|
6815
7016
|
window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
|
|
6816
7017
|
setFarmHydrated();
|
|
6817
7018
|
return true;
|
|
@@ -6860,7 +7061,8 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6860
7061
|
);
|
|
6861
7062
|
} else {
|
|
6862
7063
|
const searchParams = searchParamsToObject(targetUrl.searchParams);
|
|
6863
|
-
|
|
7064
|
+
// Without a page or layout root to hydrate, there is no route state.
|
|
7065
|
+
const routeState = farmRoot && await farmRoot.createMatchedHydrationRoute(
|
|
6864
7066
|
matched,
|
|
6865
7067
|
newPathname,
|
|
6866
7068
|
searchParams,
|
|
@@ -6871,7 +7073,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6871
7073
|
);
|
|
6872
7074
|
if (!isNavigationCurrent()) return false;
|
|
6873
7075
|
if (routeState) {
|
|
6874
|
-
setFarmReactRoot(hydrateFarmRoute(pageContainer, routeState), pageContainer);
|
|
7076
|
+
setFarmReactRoot(farmRoot.hydrateFarmRoute(pageContainer, routeState), pageContainer);
|
|
6875
7077
|
setFarmHydrated();
|
|
6876
7078
|
}
|
|
6877
7079
|
}
|
|
@@ -7059,7 +7261,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7059
7261
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
7060
7262
|
let postcssConfigDir;
|
|
7061
7263
|
let tailwindVitePlugin = void 0;
|
|
7062
|
-
const rendererVitePlugins = await
|
|
7264
|
+
const rendererVitePlugins = await _chunkNGTZHWBGcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
7063
7265
|
ssr: true,
|
|
7064
7266
|
buildLifetime: rendererBuildLifetime
|
|
7065
7267
|
});
|
|
@@ -7176,7 +7378,11 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7176
7378
|
}))
|
|
7177
7379
|
);
|
|
7178
7380
|
const instrumentationPath = _chunk3BTN3NP7cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
7179
|
-
const notFoundPath =
|
|
7381
|
+
const notFoundPath = _chunkJHRJ5V2Fcjs.resolveFarmNotFoundComponentPath.call(void 0,
|
|
7382
|
+
config,
|
|
7383
|
+
appDirs,
|
|
7384
|
+
routeManager.getRendererNotFoundPath()
|
|
7385
|
+
);
|
|
7180
7386
|
if (notFoundPath) _chunk7U4XF76Rcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
7181
7387
|
layoutRoutes.sort((a, b) => {
|
|
7182
7388
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -7197,9 +7403,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7197
7403
|
(provider) => provider.component || provider.type === "clerk"
|
|
7198
7404
|
);
|
|
7199
7405
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
7200
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
7406
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _131 => _131.mdx, 'optionalAccess', _132 => _132.components]));
|
|
7201
7407
|
const hasMiddlewareConfig = _chunkNEKO3HM2cjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
7202
|
-
const hasRouteContextConfig =
|
|
7408
|
+
const hasRouteContextConfig = _chunk55UJGUBPcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
7203
7409
|
const hasServerRuntimePlugins = _chunkDMSXZNQRcjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
|
|
7204
7410
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
7205
7411
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -7209,9 +7415,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7209
7415
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
7210
7416
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
7211
7417
|
);
|
|
7212
|
-
if (
|
|
7418
|
+
if (_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
7213
7419
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
7214
|
-
|
|
7420
|
+
_chunkLN6FAYNBcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
7215
7421
|
config.docs,
|
|
7216
7422
|
{ root, srcDir: config.srcDir },
|
|
7217
7423
|
(pathname) => adapterGuardedPaths.has(pathname),
|
|
@@ -7219,9 +7425,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7219
7425
|
);
|
|
7220
7426
|
}
|
|
7221
7427
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
7222
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
7428
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled]) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunk2RSVYJT6cjs._runWithFarmCspNonce.call(void 0,
|
|
7223
7429
|
farmDocsCspNonceMarker,
|
|
7224
|
-
async () => _optionalChain([config, 'access',
|
|
7430
|
+
async () => _optionalChain([config, 'access', _135 => _135.docs, 'access', _136 => _136.adapter, 'optionalAccess', _137 => _137.server]) ? await _chunkLN6FAYNBcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
7225
7431
|
root,
|
|
7226
7432
|
srcDir: config.srcDir,
|
|
7227
7433
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -7281,7 +7487,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7281
7487
|
(image) => image.sourceType === "module"
|
|
7282
7488
|
);
|
|
7283
7489
|
const externalMetadataImageRuntime = useExternalMetadataImageRuntime && !omitCoreMetadataImageRuntime ? ["@vercel/og"] : [];
|
|
7284
|
-
const rendererOptionalExternals =
|
|
7490
|
+
const rendererOptionalExternals = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? [] : [
|
|
7285
7491
|
"react",
|
|
7286
7492
|
"react/jsx-runtime",
|
|
7287
7493
|
"react/jsx-dev-runtime",
|
|
@@ -7335,7 +7541,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7335
7541
|
// Adapters can render provider scripts by serializing function source.
|
|
7336
7542
|
// keepNames injects helper calls into those functions; after Nitro
|
|
7337
7543
|
// minifies the server chunk the helper is no longer in script scope.
|
|
7338
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
7544
|
+
keepNames: !(_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) && _optionalChain([config, 'access', _140 => _140.docs, 'access', _141 => _141.adapter, 'optionalAccess', _142 => _142.server])),
|
|
7339
7545
|
jsxDev: false
|
|
7340
7546
|
},
|
|
7341
7547
|
// SSR configuration to externalize problematic modules
|
|
@@ -7385,10 +7591,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7385
7591
|
define: {
|
|
7386
7592
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
7387
7593
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
7388
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
7594
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _143 => _143.env, 'optionalAccess', _144 => _144.public]) || {})
|
|
7389
7595
|
},
|
|
7390
7596
|
plugins: [
|
|
7391
|
-
|
|
7597
|
+
_chunkJHRJ5V2Fcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
7392
7598
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
7393
7599
|
...rendererVitePlugins,
|
|
7394
7600
|
...config.vite.plugins || [],
|
|
@@ -7420,7 +7626,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7420
7626
|
},
|
|
7421
7627
|
pluginManager
|
|
7422
7628
|
),
|
|
7423
|
-
|
|
7629
|
+
_chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
7424
7630
|
...hasRuntimeConfigModule ? [
|
|
7425
7631
|
farmStripPlatformConfigPlugin(
|
|
7426
7632
|
[
|
|
@@ -7432,7 +7638,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7432
7638
|
{
|
|
7433
7639
|
name: "farm-virtual-ssr-entry",
|
|
7434
7640
|
resolveId: {
|
|
7435
|
-
filter: { id:
|
|
7641
|
+
filter: { id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
|
|
7436
7642
|
handler(id) {
|
|
7437
7643
|
if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
|
|
7438
7644
|
return virtualEntryId;
|
|
@@ -7441,7 +7647,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7441
7647
|
}
|
|
7442
7648
|
},
|
|
7443
7649
|
load: {
|
|
7444
|
-
filter: { id:
|
|
7650
|
+
filter: { id: _chunkJHRJ5V2Fcjs.exactIdPattern.call(void 0, [virtualEntryId]) },
|
|
7445
7651
|
handler(id) {
|
|
7446
7652
|
if (id === virtualEntryId) {
|
|
7447
7653
|
return virtualEntryCode;
|
|
@@ -7473,7 +7679,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7473
7679
|
resolve: {
|
|
7474
7680
|
alias: [
|
|
7475
7681
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
7476
|
-
...Object.entries(
|
|
7682
|
+
...Object.entries(_chunkJHRJ5V2Fcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
7477
7683
|
([find, replacement]) => ({ find, replacement })
|
|
7478
7684
|
)
|
|
7479
7685
|
],
|
|
@@ -7481,12 +7687,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7481
7687
|
dedupe: [...config.renderer.dedupe || []]
|
|
7482
7688
|
}
|
|
7483
7689
|
};
|
|
7484
|
-
await viteBuild(
|
|
7690
|
+
await viteBuild(_chunkJHRJ5V2Fcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
7485
7691
|
} finally {
|
|
7486
7692
|
if (postcssConfigDir) {
|
|
7487
7693
|
try {
|
|
7488
7694
|
await fs5.rm(postcssConfigDir, { recursive: true, force: true });
|
|
7489
|
-
} catch (
|
|
7695
|
+
} catch (e36) {
|
|
7490
7696
|
}
|
|
7491
7697
|
}
|
|
7492
7698
|
}
|
|
@@ -7499,7 +7705,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7499
7705
|
function readFarmAppPackageIdentity(root) {
|
|
7500
7706
|
try {
|
|
7501
7707
|
return JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(root, "package.json"), "utf8"));
|
|
7502
|
-
} catch (
|
|
7708
|
+
} catch (e37) {
|
|
7503
7709
|
return {};
|
|
7504
7710
|
}
|
|
7505
7711
|
}
|
|
@@ -7511,13 +7717,13 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
7511
7717
|
lastModified[route.pattern] = _fs.statSync.call(void 0,
|
|
7512
7718
|
_nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath))
|
|
7513
7719
|
).mtime.toISOString();
|
|
7514
|
-
} catch (
|
|
7720
|
+
} catch (e38) {
|
|
7515
7721
|
}
|
|
7516
7722
|
}
|
|
7517
7723
|
return lastModified;
|
|
7518
7724
|
}
|
|
7519
7725
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
7520
|
-
if (!_optionalChain([config, 'access',
|
|
7726
|
+
if (!_optionalChain([config, 'access', _145 => _145.docs, 'optionalAccess', _146 => _146.enabled])) return [];
|
|
7521
7727
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
7522
7728
|
const guards = {
|
|
7523
7729
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
@@ -7528,15 +7734,15 @@ function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
|
7528
7734
|
).flatMap((page) => [page.href, _chunkHR5GU4UUcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkNEKO3HM2cjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
7529
7735
|
}
|
|
7530
7736
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
7531
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
7737
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _147 => _147.llmsTxt]);
|
|
7532
7738
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
7533
7739
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
7534
7740
|
);
|
|
7535
7741
|
return [
|
|
7536
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
7537
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
7538
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
7539
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
7742
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _148 => _148.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
7743
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _149 => _149.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
7744
|
+
..._optionalChain([agent, 'optionalAccess', _150 => _150.sitemap, 'optionalAccess', _151 => _151.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
7745
|
+
..._optionalChain([agent, 'optionalAccess', _152 => _152.crawlers, 'optionalAccess', _153 => _153.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
7540
7746
|
];
|
|
7541
7747
|
}
|
|
7542
7748
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -7547,7 +7753,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
7547
7753
|
docsPath: ${root}.entry,
|
|
7548
7754
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
7549
7755
|
}`;
|
|
7550
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
7756
|
+
if (_optionalChain([docs, 'optionalAccess', _154 => _154.roots, 'optionalAccess', _155 => _155.length])) {
|
|
7551
7757
|
return {
|
|
7552
7758
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
7553
7759
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -7560,7 +7766,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
7560
7766
|
}
|
|
7561
7767
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
7562
7768
|
if (!docs.enabled) return "null";
|
|
7563
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
7769
|
+
const serializableDocs = _optionalChain([docs, 'access', _156 => _156.roots, 'optionalAccess', _157 => _157.length]) ? {
|
|
7564
7770
|
...docs,
|
|
7565
7771
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
7566
7772
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -7594,7 +7800,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
7594
7800
|
},
|
|
7595
7801
|
}
|
|
7596
7802
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
7597
|
-
if (!_optionalChain([docs, 'access',
|
|
7803
|
+
if (!_optionalChain([docs, 'access', _158 => _158.roots, 'optionalAccess', _159 => _159.length])) return expression;
|
|
7598
7804
|
return `((farmDocs) => ({
|
|
7599
7805
|
...farmDocs,
|
|
7600
7806
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -7611,7 +7817,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
7611
7817
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
7612
7818
|
}
|
|
7613
7819
|
function generateNativeAuthIntegrationSource(auth) {
|
|
7614
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
7820
|
+
if (_optionalChain([auth, 'optionalAccess', _160 => _160.enabled]) !== true) {
|
|
7615
7821
|
return { importSource: "", registerSource: "" };
|
|
7616
7822
|
}
|
|
7617
7823
|
return {
|
|
@@ -7915,7 +8121,7 @@ async function applyFarmPreloadBudget(response, pathname, request) {
|
|
|
7915
8121
|
`.trim();
|
|
7916
8122
|
}
|
|
7917
8123
|
function generateFarmRendererAppSetupServerCode(config) {
|
|
7918
|
-
const appSetupPath =
|
|
8124
|
+
const appSetupPath = _chunkNGTZHWBGcjs.resolveFarmRendererAppSetup.call(void 0, config.root || process.cwd(), config.renderer);
|
|
7919
8125
|
if (!appSetupPath) return "";
|
|
7920
8126
|
return `
|
|
7921
8127
|
import __farmAppSetup from ${JSON.stringify(_chunk7U4XF76Rcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
@@ -7925,46 +8131,44 @@ if (typeof ReactDOMServer.configureApp !== "function") {
|
|
|
7925
8131
|
ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
7926
8132
|
}
|
|
7927
8133
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
|
|
7928
|
-
const farmRendererDisabled =
|
|
8134
|
+
const farmRendererDisabled = _chunkNGTZHWBGcjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
7929
8135
|
const searchPreserveRoutes = pageRoutes.flatMap(
|
|
7930
8136
|
(route) => route.searchPreserve ? [route.searchPreserve] : []
|
|
7931
8137
|
);
|
|
7932
8138
|
const searchPreserveRoutesSource = searchPreserveRoutes.length > 0 ? JSON.stringify(searchPreserveRoutes) : "";
|
|
7933
|
-
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
7934
|
-
const farmRendererActions =
|
|
7935
|
-
const farmClientBoot =
|
|
8139
|
+
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _161 => _161.experimental, 'optionalAccess', _162 => _162.serverComponents])) === "islands";
|
|
8140
|
+
const farmRendererActions = _chunkJHRJ5V2Fcjs.resolveFarmIslxActionsMode.call(void 0, config) === "renderer";
|
|
8141
|
+
const farmClientBoot = _chunkJHRJ5V2Fcjs.canBootFarmIslandsClient.call(void 0, config);
|
|
7936
8142
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
7937
8143
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
7938
8144
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "edge";
|
|
7939
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
8145
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _163 => _163.agent, 'optionalAccess', _164 => _164.crawlers, 'optionalAccess', _165 => _165.enabled])) && !applicationMetadataRoutes.some(
|
|
7940
8146
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
7941
8147
|
);
|
|
7942
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
8148
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _166 => _166.agent, 'optionalAccess', _167 => _167.sitemap, 'optionalAccess', _168 => _168.enabled])) && !applicationMetadataRoutes.some(
|
|
7943
8149
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
7944
8150
|
);
|
|
7945
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
7946
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
8151
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _169 => _169.agent, 'optionalAccess', _170 => _170.mcp]) === true && !_chunkW53Z4WDIcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
8152
|
+
const servesAiCatalog = _optionalChain([config, 'access', _171 => _171.agent, 'optionalAccess', _172 => _172.aiCatalog]) !== false;
|
|
7947
8153
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
7948
8154
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
7949
|
-
const reportsWebMCPCalls = hasInfraAnalyticsRuntime &&
|
|
8155
|
+
const reportsWebMCPCalls = hasInfraAnalyticsRuntime && _chunkOM6JIIJUcjs._farmWebMCPReportsEnabled.call(void 0, config.plugins);
|
|
7950
8156
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
7951
|
-
const adapterOwnsDocsRuntime =
|
|
7952
|
-
|
|
7953
|
-
);
|
|
7954
|
-
if (_optionalChain([config, 'access', _183 => _183.docs, 'optionalAccess', _184 => _184.enabled]) && _optionalChain([config, 'access', _185 => _185.docs, 'access', _186 => _186.roots, 'optionalAccess', _187 => _187.length]) && !adapterOwnsDocsRuntime) {
|
|
8157
|
+
const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
|
|
8158
|
+
if (_optionalChain([config, 'access', _173 => _173.docs, 'optionalAccess', _174 => _174.enabled]) && _optionalChain([config, 'access', _175 => _175.docs, 'access', _176 => _176.roots, 'optionalAccess', _177 => _177.length]) && !adapterOwnsDocsRuntime) {
|
|
7955
8159
|
throw new Error(
|
|
7956
|
-
"Several docs roots need
|
|
8160
|
+
"Several docs roots need a docs adapter; Farm's built-in docs renderer serves a single docs root."
|
|
7957
8161
|
);
|
|
7958
8162
|
}
|
|
7959
8163
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
7960
8164
|
const adapterHandler = generateFarmDocsAdapterHandlerArguments(config.docs, docsConfigModulePath);
|
|
7961
|
-
const hasIsolatedClientGraphRuntime =
|
|
7962
|
-
const rendererStreamingCapabilities =
|
|
8165
|
+
const hasIsolatedClientGraphRuntime = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
8166
|
+
const rendererStreamingCapabilities = _chunkNGTZHWBGcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
|
|
7963
8167
|
config.renderer,
|
|
7964
8168
|
_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset)
|
|
7965
8169
|
);
|
|
7966
|
-
const hasReactSyncRender =
|
|
7967
|
-
const rendererServerImports =
|
|
8170
|
+
const hasReactSyncRender = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer);
|
|
8171
|
+
const rendererServerImports = _chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
7968
8172
|
import * as ReactDOMServer from "react-dom/server";
|
|
7969
8173
|
import { markPagePosition, markLayoutPosition } from "@farm.js/core/internal/production-runtime";${hasIsolatedClientGraphRuntime ? farmIslandsMode ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph, renderFarmServerTreePage, renderFarmServerTreeLayout, withFarmIslandsRender } from "@farm.js/core/internal/islands-runtime";' : '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : (
|
|
7970
8174
|
// The renderer contract is the server module's named exports, which the development
|
|
@@ -8011,26 +8215,26 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8011
8215
|
);
|
|
8012
8216
|
const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
|
|
8013
8217
|
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkNEKO3HM2cjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
8014
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
8218
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _178 => _178.docs, 'optionalAccess', _179 => _179.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
8015
8219
|
const integrationProviders = _chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
8016
8220
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
8017
8221
|
(provider) => provider.component || provider.type === "clerk"
|
|
8018
8222
|
);
|
|
8019
|
-
if (renderedIntegrationProviders.length > 0 && !
|
|
8223
|
+
if (renderedIntegrationProviders.length > 0 && !_chunkNGTZHWBGcjs.getFarmRendererCapabilities.call(void 0, config.renderer).functionComponents) {
|
|
8020
8224
|
throw new Error(
|
|
8021
8225
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
8022
8226
|
);
|
|
8023
8227
|
}
|
|
8024
|
-
const providerServerModules =
|
|
8228
|
+
const providerServerModules = _chunkJHRJ5V2Fcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
8025
8229
|
renderedIntegrationProviders,
|
|
8026
8230
|
config.root,
|
|
8027
8231
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
8028
8232
|
);
|
|
8029
8233
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
8030
8234
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
8031
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
8235
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _180 => _180.providers]);
|
|
8032
8236
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
8033
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
8237
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _181 => _181.component]) === "function")) {
|
|
8034
8238
|
throw new Error(
|
|
8035
8239
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
8036
8240
|
);
|
|
@@ -8041,22 +8245,22 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8041
8245
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
8042
8246
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
8043
8247
|
);
|
|
8044
|
-
const isolatedHydrationMode =
|
|
8045
|
-
_optionalChain([config, 'access',
|
|
8248
|
+
const isolatedHydrationMode = _chunkEFI6QWBQcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
8249
|
+
_optionalChain([config, 'access', _182 => _182.experimental, 'optionalAccess', _183 => _183.isolatedClientHydration]),
|
|
8046
8250
|
{
|
|
8047
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
8251
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _184 => _184.experimental, 'optionalAccess', _185 => _185.serverComponents])) === "rsc",
|
|
8048
8252
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
8049
8253
|
}
|
|
8050
8254
|
);
|
|
8051
|
-
const hydrationPlanOptions =
|
|
8255
|
+
const hydrationPlanOptions = _chunkEFI6QWBQcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
8052
8256
|
config.renderer,
|
|
8053
8257
|
Boolean(unsupportedIntegrationProvider)
|
|
8054
8258
|
);
|
|
8055
8259
|
const pageHydrationPlanOptions = {
|
|
8056
8260
|
...hydrationPlanOptions,
|
|
8057
|
-
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
8261
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _186 => _186.experimental, 'optionalAccess', _187 => _187.serverComponents])) === "islands"
|
|
8058
8262
|
};
|
|
8059
|
-
const { layoutHydrationPlans, pageHydrationPlans } =
|
|
8263
|
+
const { layoutHydrationPlans, pageHydrationPlans } = _chunkEFI6QWBQcjs.withFarmSourceSnapshot.call(void 0, () => {
|
|
8060
8264
|
const layoutHydrationPlans2 = layoutRoutes.map((layout) => ({
|
|
8061
8265
|
...layout,
|
|
8062
8266
|
hydration: getCachedClientModuleHydrationPlan(
|
|
@@ -8067,7 +8271,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8067
8271
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
8068
8272
|
)
|
|
8069
8273
|
}));
|
|
8070
|
-
const markdownPagePlan =
|
|
8274
|
+
const markdownPagePlan = _chunkEFI6QWBQcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
8071
8275
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
8072
8276
|
config.root,
|
|
8073
8277
|
isolatedHydrationMode,
|
|
@@ -8087,7 +8291,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8087
8291
|
);
|
|
8088
8292
|
return { layoutHydrationPlans: layoutHydrationPlans2, pageHydrationPlans: pageHydrationPlans2 };
|
|
8089
8293
|
});
|
|
8090
|
-
|
|
8294
|
+
_chunkEFI6QWBQcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
8091
8295
|
layoutHydrationPlans.map((layout) => ({
|
|
8092
8296
|
pattern: layout.pattern,
|
|
8093
8297
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -8117,7 +8321,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8117
8321
|
apiRegistrations.push(`
|
|
8118
8322
|
{
|
|
8119
8323
|
path: ${JSON.stringify(route.path)},
|
|
8120
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
8324
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _188 => _188.pluginMethods, 'optionalAccess', _189 => _189.includes, 'call', _190 => _190(method)])))},
|
|
8121
8325
|
endpoints: ${varName},
|
|
8122
8326
|
}`);
|
|
8123
8327
|
});
|
|
@@ -8131,8 +8335,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8131
8335
|
orderedPageRoutes.forEach((route, index) => {
|
|
8132
8336
|
const varName = `pageRoute${index}`;
|
|
8133
8337
|
if (_chunk26WP75W5cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
8134
|
-
const renderingDirective2 =
|
|
8135
|
-
const markdownServerTree = pageHydrationPlanOptions.serverOwners &&
|
|
8338
|
+
const renderingDirective2 = _chunkHRH7OKBQcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
8339
|
+
const markdownServerTree = pageHydrationPlanOptions.serverOwners && _chunkEFI6QWBQcjs.usesFarmServerTree.call(void 0, pageHydrationPlans.get(route.modulePath));
|
|
8136
8340
|
pageRegistrations.push(`
|
|
8137
8341
|
{
|
|
8138
8342
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -8140,14 +8344,14 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8140
8344
|
rendering: ${JSON.stringify(renderingDirective2)},` : ""}${markdownServerTree ? "\n serverTree: true," : ""}
|
|
8141
8345
|
module: createFarmMarkdownRouteModule({
|
|
8142
8346
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
8143
|
-
filePath: ${JSON.stringify(
|
|
8347
|
+
filePath: ${JSON.stringify(_chunkJHRJ5V2Fcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.modulePath))},
|
|
8144
8348
|
components: farmMdxComponents,
|
|
8145
|
-
config: farmMdxConfig,${
|
|
8349
|
+
config: farmMdxConfig,${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: React,"}
|
|
8146
8350
|
}),
|
|
8147
8351
|
markdownSource: {
|
|
8148
8352
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
8149
8353
|
filePath: ${JSON.stringify(
|
|
8150
|
-
|
|
8354
|
+
_chunkJHRJ5V2Fcjs.toBakedMarkdownSourcePath.call(void 0, config.root, _nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath)))
|
|
8151
8355
|
)},
|
|
8152
8356
|
},
|
|
8153
8357
|
}`);
|
|
@@ -8157,7 +8361,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8157
8361
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
8158
8362
|
);
|
|
8159
8363
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
8160
|
-
const renderingDirective =
|
|
8364
|
+
const renderingDirective = _chunkHRH7OKBQcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
8161
8365
|
pageRegistrations.push(`
|
|
8162
8366
|
{
|
|
8163
8367
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -8165,8 +8369,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8165
8369
|
module: ${varName},
|
|
8166
8370
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
8167
8371
|
clientModule: ${JSON.stringify(_chunk7U4XF76Rcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
8168
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
8169
|
-
const rootStrategy =
|
|
8372
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkEFI6QWBQcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
8373
|
+
const rootStrategy = _chunkJHRJ5V2Fcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
8170
8374
|
route,
|
|
8171
8375
|
clientMetadata,
|
|
8172
8376
|
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
@@ -8179,7 +8383,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8179
8383
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
8180
8384
|
${route.source !== void 0 ? `markdownSource: {
|
|
8181
8385
|
source: ${JSON.stringify(route.source)},
|
|
8182
|
-
filePath: ${JSON.stringify(
|
|
8386
|
+
filePath: ${JSON.stringify(_chunkJHRJ5V2Fcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.markdownSourcePath))},
|
|
8183
8387
|
},` : ""}
|
|
8184
8388
|
}`);
|
|
8185
8389
|
});
|
|
@@ -8203,7 +8407,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8203
8407
|
pattern: ${JSON.stringify(layout.pattern)},
|
|
8204
8408
|
module: ${varName},
|
|
8205
8409
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},
|
|
8206
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode &&
|
|
8410
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode && _chunkJHRJ5V2Fcjs.canFarmSkipKeptLayoutRender.call(void 0, layout.modulePath, config.root) ? "\n skipKeptRender: true," : ""}${// A layout whose client components hydrate as islands of their own (islands mode,
|
|
8207
8411
|
// isolatedClientHydration, or an async layout): it wraps a docs page as an app page.
|
|
8208
8412
|
clientMetadata.hasIsolatedClientBoundaries ? "\n islands: true," : ""}
|
|
8209
8413
|
}`);
|
|
@@ -8231,7 +8435,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8231
8435
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
8232
8436
|
interception: ${JSON.stringify(slot.interception)},
|
|
8233
8437
|
fallback: ${JSON.stringify(slot.fallback)},
|
|
8234
|
-
hydrates: ${!farmIslandsMode ||
|
|
8438
|
+
hydrates: ${!farmIslandsMode || _chunkEFI6QWBQcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
|
|
8235
8439
|
module: ${varName},
|
|
8236
8440
|
}`);
|
|
8237
8441
|
});
|
|
@@ -8277,7 +8481,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8277
8481
|
metadataImageImports.push(
|
|
8278
8482
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(image.modulePath)};`
|
|
8279
8483
|
);
|
|
8280
|
-
const component = !
|
|
8484
|
+
const component = !_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) && _chunkJHRJ5V2Fcjs.isRendererCompiledComponent.call(void 0, image.modulePath, _nullishCoalesce(_optionalChain([config, 'access', _191 => _191.renderer, 'optionalAccess', _192 => _192.componentExtensions]), () => ( [])));
|
|
8281
8485
|
metadataImageRegistrations.push(`
|
|
8282
8486
|
{
|
|
8283
8487
|
pattern: ${JSON.stringify(image.pattern)},
|
|
@@ -8353,7 +8557,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8353
8557
|
createDefaultErrorMarkup,
|
|
8354
8558
|
createFarmInstrumentationLifecycle,
|
|
8355
8559
|
createFarmLayoutSelector,
|
|
8356
|
-
createFarmLayoutBoundary,${_optionalChain([config, 'access',
|
|
8560
|
+
createFarmLayoutBoundary,${_optionalChain([config, 'access', _193 => _193.docs, 'optionalAccess', _194 => _194.enabled]) ? "\n createFarmDocsLayoutTree,\n farmDocsLayoutsWrapPage,\n placeFarmDocsLayoutRoot," : ""}
|
|
8357
8561
|
isInFarmRouteGroupScope,
|
|
8358
8562
|
routeBoundaryCoversDirectory,
|
|
8359
8563
|
createFarmCacheKey,
|
|
@@ -8437,7 +8641,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8437
8641
|
createFarmDeploymentMismatchResponse,
|
|
8438
8642
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
8439
8643
|
getFarmDeploymentMismatch,
|
|
8440
|
-
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access',
|
|
8644
|
+
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access', _195 => _195.md, 'optionalAccess', _196 => _196.enabled]) || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}${searchPreserveRoutesSource ? "\n _setFarmSearchPreserveRoutes," : ""}
|
|
8441
8645
|
} from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
|
|
8442
8646
|
import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
|
|
8443
8647
|
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
@@ -8509,25 +8713,25 @@ function farmFormStateScript() { return ""; }`}`;
|
|
|
8509
8713
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
8510
8714
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
8511
8715
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
8512
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
8716
|
+
const docsHandlerImport = _optionalChain([config, 'access', _197 => _197.docs, 'optionalAccess', _198 => _198.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
8513
8717
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
8514
8718
|
const pathname = typeof requestOrPathname === "string"
|
|
8515
8719
|
? requestOrPathname
|
|
8516
8720
|
: new URL(requestOrPathname.url).pathname;
|
|
8517
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
8721
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _199 => _199.apiPath]) || "/api/docs")};
|
|
8518
8722
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
8519
8723
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
8520
|
-
import { ${_optionalChain([config, 'access',
|
|
8521
|
-
import * as
|
|
8724
|
+
import { ${_optionalChain([config, 'access', _200 => _200.docs, 'access', _201 => _201.roots, 'optionalAccess', _202 => _202.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
8725
|
+
import * as FarmDocsAdapterUI from ${JSON.stringify(_chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter))};${docsConfigModulePath ? `
|
|
8522
8726
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
8523
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
8524
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
8727
|
+
const docsFontImport = _optionalChain([config, 'access', _203 => _203.docs, 'optionalAccess', _204 => _204.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
8728
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 => _206.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
8525
8729
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
8526
8730
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
8527
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
8731
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _207 => _207.md, 'optionalAccess', _208 => _208.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
8528
8732
|
const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
|
|
8529
8733
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
8530
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
8734
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _209 => _209.mdx, 'optionalAccess', _210 => _210.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
8531
8735
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
8532
8736
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
8533
8737
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -8547,14 +8751,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
8547
8751
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
8548
8752
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
8549
8753
|
const mobileSession = (config.plugins || []).some(
|
|
8550
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
8754
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _211 => _211.name]) === _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN
|
|
8551
8755
|
);
|
|
8552
8756
|
const nativeServerFns = (config.plugins || []).some(
|
|
8553
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
8554
|
-
) ?
|
|
8757
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _212 => _212.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
|
|
8758
|
+
) ? _chunkA5BHJHDFcjs.collectFarmNativeServerFns.call(void 0, {
|
|
8555
8759
|
root: config.root,
|
|
8556
8760
|
srcDir: config.srcDir,
|
|
8557
|
-
entries:
|
|
8761
|
+
entries: _chunkA5BHJHDFcjs.findFarmNativeScreenFiles.call(void 0, _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config))
|
|
8558
8762
|
}) : void 0;
|
|
8559
8763
|
const integrationImports = `
|
|
8560
8764
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -8569,7 +8773,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
|
|
|
8569
8773
|
${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
|
|
8570
8774
|
});` : ""}
|
|
8571
8775
|
`;
|
|
8572
|
-
const imageRuntime =
|
|
8776
|
+
const imageRuntime = _chunkJHRJ5V2Fcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
8573
8777
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
8574
8778
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
8575
8779
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -8751,7 +8955,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
8751
8955
|
|
|
8752
8956
|
function renderFarmDefault404Page() {
|
|
8753
8957
|
return React.createElement(React.Fragment, null,
|
|
8754
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
8958
|
+
React.createElement("style", null, ${JSON.stringify(_chunkJHRJ5V2Fcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
8755
8959
|
React.createElement("main", {
|
|
8756
8960
|
className: "farm-default-not-found",
|
|
8757
8961
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -8847,7 +9051,7 @@ function wrapWithFarmIntegrationProviders(element) {
|
|
|
8847
9051
|
// providers, so the server renders them inside it too. React lines an island up with its tree
|
|
8848
9052
|
// position instead, and its providers render no markup.
|
|
8849
9053
|
function wrapFarmIslandIntegrationProviders(element) {
|
|
8850
|
-
return ${
|
|
9054
|
+
return ${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "element" : "wrapWithFarmIntegrationProviders(element)"};
|
|
8851
9055
|
}
|
|
8852
9056
|
const serverRuntimeIntegrations = Object.fromEntries(
|
|
8853
9057
|
Object.entries(configuredIntegrations).filter(([, integration]) =>
|
|
@@ -8907,24 +9111,24 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
8907
9111
|
validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
|
|
8908
9112
|
onError(error) { console.error("[Farm Image]", error); },
|
|
8909
9113
|
})`};
|
|
8910
|
-
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access',
|
|
9114
|
+
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access', _213 => _213.md, 'optionalAccess', _214 => _214.enabled]) || hasMarkdownPages ? config.trailingSlash ? `
|
|
8911
9115
|
// A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
|
|
8912
9116
|
// ('/about/'), so the trailing-slash 308 never answers in its place.
|
|
8913
9117
|
const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
|
|
8914
9118
|
const toFarmMarkdownPageRequest = (request) => request;` : ""}
|
|
8915
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
8916
|
-
${_optionalChain([config, 'access',
|
|
9119
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
9120
|
+
${_optionalChain([config, 'access', _217 => _217.agent, 'optionalAccess', _218 => _218.llmsTxt, 'optionalAccess', _219 => _219.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
8917
9121
|
const farmMdxConfig = ${JSON.stringify({
|
|
8918
9122
|
...config.mdx,
|
|
8919
|
-
components: typeof _optionalChain([config, 'access',
|
|
9123
|
+
components: typeof _optionalChain([config, 'access', _220 => _220.mdx, 'optionalAccess', _221 => _221.components]) === "string" ? config.mdx.components : void 0
|
|
8920
9124
|
})};
|
|
8921
9125
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
8922
|
-
${_optionalChain([config, 'access',
|
|
9126
|
+
${_optionalChain([config, 'access', _222 => _222.agent, 'optionalAccess', _223 => _223.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
8923
9127
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
8924
9128
|
// to the build.
|
|
8925
9129
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
8926
9130
|
globalThis.process?.env,
|
|
8927
|
-
${JSON.stringify(
|
|
9131
|
+
${JSON.stringify(_chunkIABI62FHcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
|
|
8928
9132
|
);` : ""}
|
|
8929
9133
|
const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
|
|
8930
9134
|
const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
|
|
@@ -8970,7 +9174,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
8970
9174
|
});
|
|
8971
9175
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
8972
9176
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
8973
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
9177
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _224 => _224.docs, 'optionalAccess', _225 => _225.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
8974
9178
|
try {
|
|
8975
9179
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
8976
9180
|
const candidates = [
|
|
@@ -8982,7 +9186,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _234 => _2
|
|
|
8982
9186
|
} catch {
|
|
8983
9187
|
return null;
|
|
8984
9188
|
}
|
|
8985
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
9189
|
+
})()` : "null"};${_optionalChain([config, 'access', _226 => _226.docs, 'optionalAccess', _227 => _227.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _228 => _228.docs, 'access', _229 => _229.roots, 'optionalAccess', _230 => _230.length]) ? `
|
|
8986
9190
|
const farmDocsBundledRootsDir = (() => {
|
|
8987
9191
|
try {
|
|
8988
9192
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -9034,7 +9238,9 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
9034
9238
|
),
|
|
9035
9239
|
}
|
|
9036
9240
|
: undefined;
|
|
9037
|
-
|
|
9241
|
+
${adapterOwnsDocsRuntime && !hasPrecompiledDocs ? `// The renderer contract's server exports, for a docs UI that builds its pages with them.
|
|
9242
|
+
const farmDocsAppRenderer = ${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? '{ name: "react", createElement: React.createElement, Fragment: React.Fragment, renderToString: ReactDOMServer.renderToString }' : "__farmRendererServer"};
|
|
9243
|
+
` : ""}const farmDocsHandler = ${_optionalChain([config, 'access', _231 => _231.docs, 'optionalAccess', _232 => _232.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
9038
9244
|
rootDir: farmDocsRuntimeRoot,
|
|
9039
9245
|
// A production build's content cannot change, so the adapter reads its
|
|
9040
9246
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -9050,12 +9256,15 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _241 => _241.docs, '
|
|
|
9050
9256
|
resolveFarmLayoutFonts(
|
|
9051
9257
|
getApplicableLayouts(getFarmRoutePathname(pathname)).map((layout) => layout.module),
|
|
9052
9258
|
),
|
|
9053
|
-
|
|
9259
|
+
loadUIModule: async () => FarmDocsAdapterUI,
|
|
9260
|
+
// The app's renderer, for a UI that builds its pages with it.
|
|
9261
|
+
loadRenderer: async () => farmDocsAppRenderer,${_chunkL2GUEYHRcjs.getFarmDocsAdapterRenderer.call(void 0, config.docs.adapter) === "react" ? `
|
|
9262
|
+
loadReactModule: async () => FarmDocsAdapterUI,` : ""}
|
|
9054
9263
|
// Lists the docs MCP endpoint in /.well-known/ai-catalog.json for the server's lifetime.
|
|
9055
9264
|
registerMCPServer: registerFarmMCPServer,
|
|
9056
9265
|
// A page built with this keeps its HTML string, so the preload budget and the response
|
|
9057
9266
|
// writer use it instead of reading and re-encoding the body. Older adapters ignore it.
|
|
9058
|
-
createHtmlResponse: farmOwnedHtmlResponse,${
|
|
9267
|
+
createHtmlResponse: farmOwnedHtmlResponse,${_chunkLN6FAYNBcjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
|
|
9059
9268
|
// The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
|
|
9060
9269
|
// asks about any path its own content lists, so the guards decide here, not a page list.
|
|
9061
9270
|
isPathGuarded: (pathname) =>
|
|
@@ -9081,7 +9290,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _241 => _241.docs, '
|
|
|
9081
9290
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
9082
9291
|
basePath: ${JSON.stringify(config.basePath)},
|
|
9083
9292
|
})` : "null"};
|
|
9084
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
9293
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
|
|
9085
9294
|
|
|
9086
9295
|
// API routes bundled at build time
|
|
9087
9296
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -9116,12 +9325,12 @@ const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
|
|
|
9116
9325
|
// runtime request.
|
|
9117
9326
|
const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
|
|
9118
9327
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
9119
|
-
${_optionalChain([config, 'access',
|
|
9120
|
-
` : ""}${_optionalChain([config, 'access',
|
|
9121
|
-
|
|
9328
|
+
${_optionalChain([config, 'access', _235 => _235.agent, 'optionalAccess', _236 => _236.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkWCSBYQOTcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
9329
|
+
` : ""}${_optionalChain([config, 'access', _237 => _237.agent, 'optionalAccess', _238 => _238.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
9330
|
+
_chunkWCSBYQOTcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
9122
9331
|
build: config.deploymentId,
|
|
9123
|
-
packages:
|
|
9124
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
9332
|
+
packages: _chunkJHRJ5V2Fcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
9333
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkJHRJ5V2Fcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
9125
9334
|
})
|
|
9126
9335
|
)};
|
|
9127
9336
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -9134,7 +9343,7 @@ farmAppManifestInput.guardCoversPath = (path) =>
|
|
|
9134
9343
|
path,
|
|
9135
9344
|
farmLocalAPIBasePath,
|
|
9136
9345
|
);
|
|
9137
|
-
${_optionalChain([config, 'access',
|
|
9346
|
+
${_optionalChain([config, 'access', _239 => _239.docs, 'optionalAccess', _240 => _240.enabled]) ? `// A docs runtime's MCP server lists its tools when asked over MCP, in process. A build
|
|
9138
9347
|
// can't change them, so they are read once.
|
|
9139
9348
|
if (farmDocsHandler) {
|
|
9140
9349
|
farmAppManifestInput.registeredMCP = (request) =>
|
|
@@ -9243,7 +9452,7 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
|
|
|
9243
9452
|
'window[Symbol.for("farm.searchPreserveRoutes")]=' + serializeFarmInlineValue(farmSearchPreserveRoutes) + ';'` : ""};
|
|
9244
9453
|
// The client boots at the canonical path when the script below moves it there.
|
|
9245
9454
|
const bootRoutes = statusDocument
|
|
9246
|
-
? typeof routePathname === "string" ?
|
|
9455
|
+
? typeof routePathname === "string" ? getFarmClientStatusBootRoutes(routePathname) : undefined
|
|
9247
9456
|
: getFarmClientBootRoutes(
|
|
9248
9457
|
typeof canonicalPath === "string" && canonicalPath.startsWith("/")
|
|
9249
9458
|
? getFarmRoutePathname(canonicalPath.split(/[?#]/)[0])
|
|
@@ -10047,7 +10256,7 @@ function createFarmErrorDocument(html, title, routePathname) {
|
|
|
10047
10256
|
' <meta name="viewport" content="width=device-width, initial-scale=1">\\n' +
|
|
10048
10257
|
' <link rel="icon" href="data:,">\\n' +
|
|
10049
10258
|
' <title>' + escapedTitle + '</title>\\n' +
|
|
10050
|
-
'
|
|
10259
|
+
' ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(html) + '\\n' +
|
|
10051
10260
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
10052
10261
|
'</head>\\n<body>\\n' +
|
|
10053
10262
|
' <div id="root">' + html + '</div>\\n' +
|
|
@@ -10058,7 +10267,7 @@ function createFarmErrorDocument(html, title, routePathname) {
|
|
|
10058
10267
|
|
|
10059
10268
|
let fullHtml = ensureFarmDocumentRoot(ensureFarmDocumentHead(fullDocument));
|
|
10060
10269
|
fullHtml = fullHtml
|
|
10061
|
-
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n
|
|
10270
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(fullDocument); })
|
|
10062
10271
|
// Function replacements: dynamic markup may contain $-sequences ($&, $', $$)
|
|
10063
10272
|
// that a string replacement would expand, corrupting the document.
|
|
10064
10273
|
.replace(/<\\/head>/i, function() { return renderFarmRendererHydrationScript() + '\\n</head>'; })
|
|
@@ -10082,6 +10291,23 @@ function createFarmErrorDocument(html, title, routePathname) {
|
|
|
10082
10291
|
: "<!DOCTYPE html>\\n" + fullHtml;
|
|
10083
10292
|
}
|
|
10084
10293
|
|
|
10294
|
+
// The client stylesheet a document links, filled in from the client build once it has finished
|
|
10295
|
+
// (see buildNitroUniversal): null for an app without CSS, whose empty stylesheet would still hold
|
|
10296
|
+
// the first paint for a round trip. Parsed at runtime, so the bundler cannot fold the stand-in.
|
|
10297
|
+
const farmClientStylesheetHref = (() => {
|
|
10298
|
+
try {
|
|
10299
|
+
return JSON.parse("${FARM_CLIENT_STYLESHEET_PLACEHOLDER}");
|
|
10300
|
+
} catch {
|
|
10301
|
+
return "${FARM_CLIENT_CSS_HREF_PLACEHOLDER}";
|
|
10302
|
+
}
|
|
10303
|
+
})();
|
|
10304
|
+
|
|
10305
|
+
function renderFarmClientStylesheet() {
|
|
10306
|
+
return farmClientStylesheetHref
|
|
10307
|
+
? '<link rel="stylesheet" href="' + farmClientStylesheetHref + '">'
|
|
10308
|
+
: "";
|
|
10309
|
+
}
|
|
10310
|
+
|
|
10085
10311
|
// The client modules a page needs before it hydrates, filled in from the client
|
|
10086
10312
|
// build once it has finished (see buildNitroUniversal).
|
|
10087
10313
|
const farmClientModulePreloads = (() => {
|
|
@@ -10091,7 +10317,10 @@ const farmClientModulePreloads = (() => {
|
|
|
10091
10317
|
return null;
|
|
10092
10318
|
}
|
|
10093
10319
|
})();
|
|
10094
|
-
${generateFarmClientBootRoutesServerSource(
|
|
10320
|
+
${generateFarmClientBootRoutesServerSource(
|
|
10321
|
+
`"${FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER}"`,
|
|
10322
|
+
farmIslandsMode ? layoutRoutes.map((layout) => getFarmClientLayoutMatch(layout.pattern)) : void 0
|
|
10323
|
+
)}
|
|
10095
10324
|
|
|
10096
10325
|
const farmClientEntryPreloadTags = farmClientModulePreloads
|
|
10097
10326
|
? farmClientModulePreloads.entry.map(renderFarmClientModulePreload).join("")
|
|
@@ -10101,10 +10330,18 @@ const farmClientEntryPreloadTags = farmClientModulePreloads
|
|
|
10101
10330
|
const farmClientRendererPreloadTags = farmClientModulePreloads
|
|
10102
10331
|
? (farmClientModulePreloads.renderer || []).map(renderFarmClientModulePreload).join("")
|
|
10103
10332
|
: "";
|
|
10333
|
+
// Islands mode's entry imports the code that renders a page or layout root when one hydrates (RFC
|
|
10334
|
+
// 0013), so a document that has one lists that code.
|
|
10335
|
+
const farmClientRootPreloadTags = farmClientModulePreloads
|
|
10336
|
+
? (farmClientModulePreloads.root || []).map(renderFarmClientModulePreload).join("")
|
|
10337
|
+
: "";
|
|
10104
10338
|
// The client modules a document's markup loads: its islands' boundaries and the
|
|
10105
10339
|
// client references of its server tree. An island with a deferred strategy loads its
|
|
10106
10340
|
// module on its own trigger, so it is not preloaded.
|
|
10107
10341
|
const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r":"(\\/[^"]+)"/g;
|
|
10342
|
+
// A server action reference in a document's markup: an action in an island's or a client
|
|
10343
|
+
// component's props (islx's \`{"$":"a",...}\`), or a server form posting one (its \`$F_REF_\` field).
|
|
10344
|
+
const FARM_ACTION_REFERENCE_PATTERN = /"\\$":"a"|name="\\$F_REF_/;
|
|
10108
10345
|
|
|
10109
10346
|
function renderFarmClientModulePreload(index) {
|
|
10110
10347
|
return '\\n <link rel="modulepreload" href="/' +
|
|
@@ -10135,15 +10372,28 @@ function collectFarmClientDocumentModules(markup, pageModule, listed) {
|
|
|
10135
10372
|
return indexes;
|
|
10136
10373
|
}
|
|
10137
10374
|
|
|
10375
|
+
// The manifest indexes of islands mode's action client, which handles a call's result (RFC 0013),
|
|
10376
|
+
// for a document whose markup holds an action reference, leaving out those already listed. Its
|
|
10377
|
+
// islands import it on their first call otherwise.
|
|
10378
|
+
function collectFarmClientActionModules(markup, listed) {
|
|
10379
|
+
const actions = farmClientModulePreloads.actions;
|
|
10380
|
+
if (!actions || typeof markup !== "string" || !FARM_ACTION_REFERENCE_PATTERN.test(markup)) return [];
|
|
10381
|
+
return actions.filter((index) => !listed.has(index) && listed.add(index));
|
|
10382
|
+
}
|
|
10383
|
+
|
|
10138
10384
|
// The modulepreload links for a document: the entry's static imports and, unless it answers a
|
|
10139
|
-
// client navigation, the renderer,
|
|
10140
|
-
|
|
10385
|
+
// client navigation, the renderer and, when a page or layout root hydrates in it (\`hydratesRoot\`),
|
|
10386
|
+
// the code that renders it; then the modules its hydrating page and its markup load.
|
|
10387
|
+
function renderFarmClientModulePreloads(markup, pageModule, navigation, hydratesRoot) {
|
|
10141
10388
|
// A nonce policy blocks parser-inserted links without the nonce, and the
|
|
10142
10389
|
// response filter manages nonces on script elements only, so CSP nonce mode
|
|
10143
10390
|
// keeps the documents it had.
|
|
10144
10391
|
if (!farmClientModulePreloads || (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce)) return "";
|
|
10392
|
+
const listed = new Set();
|
|
10145
10393
|
return farmClientEntryPreloadTags + (navigation ? "" : farmClientRendererPreloadTags) +
|
|
10146
|
-
|
|
10394
|
+
(hydratesRoot && !navigation ? farmClientRootPreloadTags : "") +
|
|
10395
|
+
collectFarmClientDocumentModules(markup, pageModule, listed)
|
|
10396
|
+
.concat(collectFarmClientActionModules(markup, listed))
|
|
10147
10397
|
.map(renderFarmClientModulePreload)
|
|
10148
10398
|
.join("");
|
|
10149
10399
|
}
|
|
@@ -10165,13 +10415,26 @@ function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy, na
|
|
|
10165
10415
|
) + '"';
|
|
10166
10416
|
};
|
|
10167
10417
|
const entry = farmClientModulePreloads.entry;
|
|
10418
|
+
// The root hydrates with the code that hydrates roots (RFC 0013) and its page's modules.
|
|
10168
10419
|
const rootModules = root
|
|
10169
|
-
?
|
|
10420
|
+
? (farmClientModulePreloads.root || []).concat(
|
|
10421
|
+
collectFarmClientDocumentModules(
|
|
10422
|
+
markup,
|
|
10423
|
+
pageModule,
|
|
10424
|
+
new Set(entry.concat(farmClientModulePreloads.root || [])),
|
|
10425
|
+
),
|
|
10426
|
+
)
|
|
10170
10427
|
: [];
|
|
10171
10428
|
const waitsForClick = rootStrategy === "interaction";
|
|
10429
|
+
// A call needs a hydrated island, so the action client comes with the renderer.
|
|
10430
|
+
const renderer = navigation
|
|
10431
|
+
? []
|
|
10432
|
+
: (farmClientModulePreloads.renderer || []).concat(
|
|
10433
|
+
collectFarmClientActionModules(markup, new Set(entry.concat(rootModules))),
|
|
10434
|
+
);
|
|
10172
10435
|
return attribute("data-farm-preload", waitsForClick ? entry : entry.concat(rootModules)) +
|
|
10173
10436
|
attribute("data-farm-preload-router", farmClientModulePreloads.router || []) +
|
|
10174
|
-
attribute("data-farm-preload-renderer",
|
|
10437
|
+
attribute("data-farm-preload-renderer", renderer) +
|
|
10175
10438
|
(waitsForClick ? attribute("data-farm-preload-root", rootModules) : "");
|
|
10176
10439
|
}
|
|
10177
10440
|
|
|
@@ -10424,10 +10687,10 @@ async function handleMetadataImageRequest(request, routePathname) {
|
|
|
10424
10687
|
path: match.pagePath,
|
|
10425
10688
|
};
|
|
10426
10689
|
|
|
10427
|
-
${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${
|
|
10690
|
+
${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "" : ", {\n renderer: ReactDOMServer,\n component: image.component === true,\n }"});
|
|
10428
10691
|
return createFarmMetadataImageResponse(value, imageModule, {
|
|
10429
10692
|
method,
|
|
10430
|
-
ifNoneMatch: request.headers.get("if-none-match"),${
|
|
10693
|
+
ifNoneMatch: request.headers.get("if-none-match"),${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: ReactDOMServer,"}
|
|
10431
10694
|
});` : 'throw new Error("Generated metadata image runtime is unavailable");'}
|
|
10432
10695
|
} catch (error) {
|
|
10433
10696
|
console.error("Metadata image render failed:", error);
|
|
@@ -10561,7 +10824,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
10561
10824
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
10562
10825
|
// registered at runtime, such as the docs engine's.
|
|
10563
10826
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
10564
|
-
_chunkW53Z4WDIcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root),
|
|
10827
|
+
_chunkW53Z4WDIcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunk3CZ4MJHWcjs.FARM_VERSION)
|
|
10565
10828
|
)};
|
|
10566
10829
|
let farmDefaultMCPRouteFree;
|
|
10567
10830
|
function getFarmDefaultMCPServer() {
|
|
@@ -10755,7 +11018,7 @@ ${edgeMiddlewareFilePaths.length > 0 ? `
|
|
|
10755
11018
|
// middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
|
|
10756
11019
|
const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
|
|
10757
11020
|
const farmPrerendering =
|
|
10758
|
-
typeof process !== "undefined" && process.env?.${
|
|
11021
|
+
typeof process !== "undefined" && process.env?.${_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV} === "1";
|
|
10759
11022
|
` : ""}
|
|
10760
11023
|
const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
|
|
10761
11024
|
config: farmMiddlewareConfig,
|
|
@@ -10899,7 +11162,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
10899
11162
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
10900
11163
|
return true;
|
|
10901
11164
|
}
|
|
10902
|
-
${_optionalChain([config, 'access',
|
|
11165
|
+
${_optionalChain([config, 'access', _241 => _241.docs, 'optionalAccess', _242 => _242.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
10903
11166
|
// The docs answer below the basePath; their API stays at /api/docs, as API routes do.
|
|
10904
11167
|
const docsRoutePathname = stripFarmBasePath(pathname);
|
|
10905
11168
|
if (
|
|
@@ -10927,7 +11190,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
10927
11190
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
10928
11191
|
};
|
|
10929
11192
|
}
|
|
10930
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
11193
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _243 => _243.docs, 'optionalAccess', _244 => _244.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
10931
11194
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
10932
11195
|
pathname,
|
|
10933
11196
|
method: request.method,
|
|
@@ -11011,7 +11274,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
11011
11274
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
11012
11275
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
11013
11276
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
11014
|
-
|
|
11277
|
+
_chunkWCSBYQOTcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
11015
11278
|
agent: {
|
|
11016
11279
|
...config.agent,
|
|
11017
11280
|
aiCatalog: servesAiCatalog,
|
|
@@ -11022,9 +11285,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
11022
11285
|
openapi: openAPIReference
|
|
11023
11286
|
})
|
|
11024
11287
|
)});
|
|
11025
|
-
${_optionalChain([config, 'access',
|
|
11288
|
+
${_optionalChain([config, 'access', _245 => _245.docs, 'optionalAccess', _246 => _246.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
11026
11289
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
11027
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
11290
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _247 => _247.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _248 => _248.docs, 'access', _249 => _249.roots, 'optionalAccess', _250 => _250.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
|
|
11028
11291
|
pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
|
|
11029
11292
|
};
|
|
11030
11293
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
@@ -11040,11 +11303,11 @@ function labelFarmRequestOptions(options) {
|
|
|
11040
11303
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
11041
11304
|
return options;
|
|
11042
11305
|
}
|
|
11043
|
-
${_optionalChain([config, 'access',
|
|
11306
|
+
${_optionalChain([config, 'access', _251 => _251.docs, 'optionalAccess', _252 => _252.enabled]) ? `if (options.kind === "docs") {
|
|
11044
11307
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
11045
11308
|
return options;
|
|
11046
11309
|
}` : ""}
|
|
11047
|
-
${_optionalChain([config, 'access',
|
|
11310
|
+
${_optionalChain([config, 'access', _253 => _253.md, 'optionalAccess', _254 => _254.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
11048
11311
|
routePathname,
|
|
11049
11312
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
11050
11313
|
);
|
|
@@ -11079,7 +11342,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
11079
11342
|
return applicable;
|
|
11080
11343
|
}
|
|
11081
11344
|
|
|
11082
|
-
${_optionalChain([config, 'access',
|
|
11345
|
+
${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 => _256.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
11083
11346
|
if (request.method === "HEAD") return response;
|
|
11084
11347
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
11085
11348
|
|
|
@@ -11153,8 +11416,8 @@ ${_optionalChain([config, 'access', _265 => _265.docs, 'optionalAccess', _266 =>
|
|
|
11153
11416
|
}
|
|
11154
11417
|
html = html.replace(/<[/]head>/i, function() { return renderedRoot.head + "\\n</head>"; });
|
|
11155
11418
|
}
|
|
11156
|
-
if (!html.includes('href="
|
|
11157
|
-
const clientStylesheet = '
|
|
11419
|
+
if (farmClientStylesheetHref && !html.includes('href="' + farmClientStylesheetHref + '"')) {
|
|
11420
|
+
const clientStylesheet = ' ' + renderFarmClientStylesheet() + '\\n';
|
|
11158
11421
|
const firstStyleIndex = html.search(/<style(?:\\s|>)/i);
|
|
11159
11422
|
html =
|
|
11160
11423
|
firstStyleIndex >= 0
|
|
@@ -11185,7 +11448,7 @@ ${_optionalChain([config, 'access', _265 => _265.docs, 'optionalAccess', _266 =>
|
|
|
11185
11448
|
|
|
11186
11449
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
11187
11450
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
11188
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
11451
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _257 => _257.experimental, 'optionalAccess', _258 => _258.ppr]) === true)};
|
|
11189
11452
|
|
|
11190
11453
|
function resolveRouteRenderingView(route) {
|
|
11191
11454
|
// The same merge development uses: baked directive config under the
|
|
@@ -11305,7 +11568,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
11305
11568
|
},
|
|
11306
11569
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
11307
11570
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
11308
|
-
${_optionalChain([config, 'access',
|
|
11571
|
+
${_optionalChain([config, 'access', _259 => _259.md, 'optionalAccess', _260 => _260.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
11309
11572
|
if (matchPageRoute(pathname)) {
|
|
11310
11573
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
11311
11574
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -11522,7 +11785,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11522
11785
|
return renderFarmErrorJSONResponse();` : `
|
|
11523
11786
|
if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
|
|
11524
11787
|
// No page was selected, so only the root error boundary and layouts apply.
|
|
11525
|
-
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access',
|
|
11788
|
+
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _261 => _261.md, 'optionalAccess', _262 => _262.enabled]) ? `
|
|
11526
11789
|
// An agent asking for Markdown reads the error document as Markdown, as it
|
|
11527
11790
|
// does when a page throws. The helper answers null when Markdown is off.
|
|
11528
11791
|
const markdownErrorResponse = await createMarkdownMirrorResponse({
|
|
@@ -11564,7 +11827,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11564
11827
|
}
|
|
11565
11828
|
` : ""}
|
|
11566
11829
|
|
|
11567
|
-
${_optionalChain([config, 'access',
|
|
11830
|
+
${_optionalChain([config, 'access', _263 => _263.docs, 'optionalAccess', _264 => _264.enabled]) ? `
|
|
11568
11831
|
// Docs responses are served after app middleware so route guards and
|
|
11569
11832
|
// middleware headers apply to the docs engine like any other page content.
|
|
11570
11833
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -11680,7 +11943,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11680
11943
|
}
|
|
11681
11944
|
` : ""}
|
|
11682
11945
|
|
|
11683
|
-
${_optionalChain([config, 'access',
|
|
11946
|
+
${_optionalChain([config, 'access', _265 => _265.md, 'optionalAccess', _266 => _266.enabled]) ? `
|
|
11684
11947
|
if (farmMarkdownConfig?.enabled) {
|
|
11685
11948
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
11686
11949
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -11784,11 +12047,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11784
12047
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
11785
12048
|
}
|
|
11786
12049
|
` : ""}
|
|
11787
|
-
${_optionalChain([config, 'access',
|
|
12050
|
+
${_optionalChain([config, 'access', _267 => _267.agent, 'optionalAccess', _268 => _268.manifest]) !== false ? `
|
|
11788
12051
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
11789
12052
|
// public manifest, the same document for every request.
|
|
11790
12053
|
if (
|
|
11791
|
-
[${JSON.stringify(
|
|
12054
|
+
[${JSON.stringify(_chunkWCSBYQOTcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkWCSBYQOTcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
11792
12055
|
normalizeRuntimePath(routePathname),
|
|
11793
12056
|
)
|
|
11794
12057
|
) {
|
|
@@ -11798,9 +12061,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11798
12061
|
);
|
|
11799
12062
|
}
|
|
11800
12063
|
` : ""}
|
|
11801
|
-
${_optionalChain([config, 'access',
|
|
12064
|
+
${_optionalChain([config, 'access', _269 => _269.agent, 'optionalAccess', _270 => _270.apiCatalog]) ? `
|
|
11802
12065
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
11803
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
12066
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkWCSBYQOTcjs.FARM_API_CATALOG_PATH)}) {
|
|
11804
12067
|
return applyProductionMiddlewareHeaders(
|
|
11805
12068
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
11806
12069
|
middlewareHeaders,
|
|
@@ -11825,11 +12088,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11825
12088
|
);
|
|
11826
12089
|
}
|
|
11827
12090
|
` : ""}
|
|
11828
|
-
${_optionalChain([config, 'access',
|
|
12091
|
+
${_optionalChain([config, 'access', _271 => _271.agent, 'optionalAccess', _272 => _272.llmsTxt, 'optionalAccess', _273 => _273.enabled]) ? `
|
|
11829
12092
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
11830
12093
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
11831
12094
|
? "llms"
|
|
11832
|
-
: ${_optionalChain([config, 'access',
|
|
12095
|
+
: ${_optionalChain([config, 'access', _274 => _274.agent, 'optionalAccess', _275 => _275.llmsTxt, 'optionalAccess', _276 => _276.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
11833
12096
|
if (farmGeneratedLlmsKind) {
|
|
11834
12097
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
11835
12098
|
// Renders are shared per origin the request reached, which is where pages are read.
|
|
@@ -11865,7 +12128,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11865
12128
|
}
|
|
11866
12129
|
` : ""}
|
|
11867
12130
|
|
|
11868
|
-
${_optionalChain([config, 'access',
|
|
12131
|
+
${_optionalChain([config, 'access', _277 => _277.docs, 'optionalAccess', _278 => _278.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
11869
12132
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
11870
12133
|
if (docsAPIResponse) {
|
|
11871
12134
|
return applyProductionMiddlewareHeaders(
|
|
@@ -12360,7 +12623,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12360
12623
|
pageElement,
|
|
12361
12624
|
);
|
|
12362
12625
|
|
|
12363
|
-
${
|
|
12626
|
+
${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "if (route.shouldHydrate && !shouldHydrateLayout) pageElement = markPagePosition(React, pageElement);" : ""}
|
|
12364
12627
|
// Wrap with layouts (from innermost to outermost)
|
|
12365
12628
|
// Layouts are sorted by depth (root first), so we process in reverse
|
|
12366
12629
|
let wrappedElement = pageElement;
|
|
@@ -12434,7 +12697,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12434
12697
|
wrappedElement = wrapFarmRouteClientGraph(wrappedElement);
|
|
12435
12698
|
}
|
|
12436
12699
|
|
|
12437
|
-
${
|
|
12700
|
+
${_chunkNGTZHWBGcjs.isReactRenderer.call(void 0, config.renderer) ? "if (route.shouldHydrate && !shouldHydrateLayout) wrappedElement = markLayoutPosition(React, wrappedElement);" : ""}
|
|
12438
12701
|
wrappedElement = wrapWithFarmIntegrationProviders(wrappedElement);
|
|
12439
12702
|
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern, farmFlushToken);
|
|
12440
12703
|
};
|
|
@@ -12505,7 +12768,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12505
12768
|
);
|
|
12506
12769
|
}
|
|
12507
12770
|
}
|
|
12508
|
-
${_optionalChain([config, 'access',
|
|
12771
|
+
${_optionalChain([config, 'access', _279 => _279.md, 'optionalAccess', _280 => _280.enabled]) ? `
|
|
12509
12772
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
12510
12773
|
// using the public path the .md request will be resolved against.
|
|
12511
12774
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -12534,7 +12797,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12534
12797
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "cookie" });
|
|
12535
12798
|
}
|
|
12536
12799
|
|
|
12537
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
12800
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _281 => _281.agent, 'optionalAccess', _282 => _282.jsonLd]), () => ( false)))} });
|
|
12538
12801
|
const title = renderedMetadata.title;
|
|
12539
12802
|
const metaTags = renderedMetadata.tags;
|
|
12540
12803
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -12615,10 +12878,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12615
12878
|
// A document something hydrates over holds the clicks and submits made before it hydrates,
|
|
12616
12879
|
// for the client entry to replay, as development does. One that starts with the boot entry
|
|
12617
12880
|
// holds its own.
|
|
12881
|
+
const farmHydratesRoot = route.shouldHydrate || shouldHydrateLayout;
|
|
12618
12882
|
const farmHoldsInteractions =
|
|
12619
|
-
|
|
12620
|
-
shouldHydrateLayout ||
|
|
12621
|
-
renderedRouteSlots.some(function(slot) { return slot.hydrates; });
|
|
12883
|
+
farmHydratesRoot || renderedRouteSlots.some(function(slot) { return slot.hydrates; });
|
|
12622
12884
|
const renderFarmPreHydrationHoldScript = function() {
|
|
12623
12885
|
return farmHoldsInteractions && !farmBootsClient
|
|
12624
12886
|
? stampFarmCspNonce(createPreHydrationClickQueueScript()) + '\\n'
|
|
@@ -12637,7 +12899,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12637
12899
|
);
|
|
12638
12900
|
composed = composed
|
|
12639
12901
|
// Inject CSS link after opening head tag or first meta tag
|
|
12640
|
-
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n
|
|
12902
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + (farmBootsClient ? "" : renderFarmClientModulePreloads(composed, route.clientModule, farmNavigationRequest, farmHydratesRoot)); })
|
|
12641
12903
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n' + renderFarmPreHydrationHoldScript() + '</head>')
|
|
12642
12904
|
// Explicit metadata wins over renderer and layout titles. Without
|
|
12643
12905
|
// explicit metadata, a renderer title wins over the layout title.
|
|
@@ -12710,8 +12972,8 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12710
12972
|
(hasFavicon ? '' : ' <link rel="icon" href="data:,">\\n') +
|
|
12711
12973
|
(suppressDefaultTitle ? '' : ' <title>' + title + '</title>') + metaTags +
|
|
12712
12974
|
(rendererHead ? '\\n ' + rendererHead : '') + '\\n' +
|
|
12713
|
-
'
|
|
12714
|
-
' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule) + '\\n' +
|
|
12975
|
+
' ' + renderFarmClientStylesheet() + '\\n' +
|
|
12976
|
+
' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule, false, farmHydratesRoot) + '\\n' +
|
|
12715
12977
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
12716
12978
|
renderFarmPreHydrationHoldScript() +
|
|
12717
12979
|
'</head>\\n<body>\\n' + farmEarlyClientScripts + ' <div id="root">';
|
|
@@ -12825,7 +13087,6 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12825
13087
|
}
|
|
12826
13088
|
}
|
|
12827
13089
|
// A route that hydrates as one root starts with the boot entry only when that root waits.
|
|
12828
|
-
const farmHydratesRoot = route.shouldHydrate || shouldHydrateLayout;
|
|
12829
13090
|
farmBootsClient = farmDocumentBootsClient(
|
|
12830
13091
|
html,
|
|
12831
13092
|
(farmHydratesRoot && !route.rootStrategy) || Boolean(pprCacheKey),
|
|
@@ -12868,7 +13129,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12868
13129
|
\${viewportTags}
|
|
12869
13130
|
\${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
12870
13131
|
\${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
|
|
12871
|
-
|
|
13132
|
+
\${renderFarmClientStylesheet()}\${farmBootsClient ? "" : renderFarmClientModulePreloads(html, route.clientModule, farmNavigationRequest, farmHydratesRoot)}
|
|
12872
13133
|
\${renderFarmRendererHydrationScript()}
|
|
12873
13134
|
\${renderFarmPreHydrationHoldScript()}</head>
|
|
12874
13135
|
<body>
|
|
@@ -13229,7 +13490,7 @@ ${farmRendererDisabled ? `
|
|
|
13229
13490
|
"<head" + attrs + ">" +
|
|
13230
13491
|
headContent.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "") +
|
|
13231
13492
|
"\\n <title>" + notFoundMetadata.title + "</title>" + notFoundMetadata.tags + "\\n</head>")
|
|
13232
|
-
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n
|
|
13493
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(fullDocument); })
|
|
13233
13494
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
13234
13495
|
.replace(
|
|
13235
13496
|
/<\\/body>/i,
|
|
@@ -13247,7 +13508,7 @@ ${farmRendererDisabled ? `
|
|
|
13247
13508
|
<meta charset="UTF-8">
|
|
13248
13509
|
\${notFoundMetadata.viewport}
|
|
13249
13510
|
\${notFoundMetadata.hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
13250
|
-
|
|
13511
|
+
\${renderFarmClientStylesheet()}\${renderFarmClientModulePreloads(html)}
|
|
13251
13512
|
<title>\${notFoundMetadata.title}</title>\${notFoundMetadata.tags}
|
|
13252
13513
|
\${renderFarmRendererHydrationScript()}
|
|
13253
13514
|
</head>
|
|
@@ -13381,11 +13642,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
|
|
|
13381
13642
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
13382
13643
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
13383
13644
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
13384
|
-
${_optionalChain([config, 'access',
|
|
13645
|
+
${_optionalChain([config, 'access', _283 => _283.agent, 'optionalAccess', _284 => _284.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
13385
13646
|
basePath: farmLocalAPIBasePath,
|
|
13386
13647
|
dispatch: async (localRequest) =>
|
|
13387
13648
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
13388
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
13649
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _285 => _285.agent, 'optionalAccess', _286 => _286.noindexPreviews]) ? `
|
|
13389
13650
|
// Keep every response of a preview deployment out of search indexes.
|
|
13390
13651
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
13391
13652
|
}
|
|
@@ -13595,7 +13856,7 @@ function getManifestPageEntry(manifest, pathname) {
|
|
|
13595
13856
|
})).sort((left, right) => _chunkML4TOUZPcjs.compareRouteSpecificity.call(void 0, left.specificity, right.specificity)).map(({ entry, matches }) => ({ entry, matches }));
|
|
13596
13857
|
manifestPageMatchers.set(manifest.routes, pages);
|
|
13597
13858
|
}
|
|
13598
|
-
return _optionalChain([pages, 'access',
|
|
13859
|
+
return _optionalChain([pages, 'access', _287 => _287.find, 'call', _288 => _288((page) => page.matches(pathname)), 'optionalAccess', _289 => _289.entry]);
|
|
13599
13860
|
}
|
|
13600
13861
|
function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
|
|
13601
13862
|
if (!edgeGuarded) return headers;
|
|
@@ -13611,7 +13872,7 @@ function prerenderWouldChangePageUrl(pathname) {
|
|
|
13611
13872
|
if (/%(?:23|25|2F|3F)/i.test(pathname)) return true;
|
|
13612
13873
|
try {
|
|
13613
13874
|
return decodeURI(pathname) !== pathname;
|
|
13614
|
-
} catch (
|
|
13875
|
+
} catch (e39) {
|
|
13615
13876
|
return true;
|
|
13616
13877
|
}
|
|
13617
13878
|
}
|
|
@@ -13634,11 +13895,11 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
13634
13895
|
}
|
|
13635
13896
|
if (_chunkNEKO3HM2cjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
13636
13897
|
if (_chunkNEKO3HM2cjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
13637
|
-
if (
|
|
13898
|
+
if (_chunk55UJGUBPcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
13638
13899
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
13639
13900
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
13640
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
13641
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
13901
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _290 => _290.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
13902
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _291 => _291.regions, 'optionalAccess', _292 => _292.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
13642
13903
|
return "route runtime controls";
|
|
13643
13904
|
}
|
|
13644
13905
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -13651,14 +13912,14 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
13651
13912
|
return void 0;
|
|
13652
13913
|
}
|
|
13653
13914
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
13654
|
-
if (!_optionalChain([config, 'access',
|
|
13915
|
+
if (!_optionalChain([config, 'access', _293 => _293.docs, 'optionalAccess', _294 => _294.enabled]) || !config.docs.prerender) return [];
|
|
13655
13916
|
if (_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
13656
13917
|
_chunk7U4XF76Rcjs.logger.info(
|
|
13657
13918
|
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
13658
13919
|
);
|
|
13659
13920
|
return [];
|
|
13660
13921
|
}
|
|
13661
|
-
if (!
|
|
13922
|
+
if (!_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
13662
13923
|
const { pages: pages2, originDependent } = _chunkHR5GU4UUcjs.listFarmDocsBuiltInPrerenderPages.call(void 0, config.docs, {
|
|
13663
13924
|
root,
|
|
13664
13925
|
srcDir: config.srcDir
|
|
@@ -13670,13 +13931,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
13670
13931
|
}
|
|
13671
13932
|
return pages2;
|
|
13672
13933
|
}
|
|
13673
|
-
|
|
13674
|
-
_chunk7U4XF76Rcjs.logger.warn(
|
|
13675
|
-
`The docs adapter ${JSON.stringify(config.docs.adapter.id)} renders with React; docs.prerender keeps its pages rendering on request with the "${config.renderer.name}" renderer.`
|
|
13676
|
-
);
|
|
13677
|
-
return [];
|
|
13678
|
-
}
|
|
13679
|
-
const pages = await _chunkHHQEKLZLcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
13934
|
+
const pages = await _chunkLN6FAYNBcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
13680
13935
|
if (!pages) {
|
|
13681
13936
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
13682
13937
|
`The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
|
|
@@ -13686,14 +13941,14 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
13686
13941
|
return pages;
|
|
13687
13942
|
}
|
|
13688
13943
|
async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
13689
|
-
if (!_optionalChain([config, 'access',
|
|
13944
|
+
if (!_optionalChain([config, 'access', _295 => _295.docs, 'optionalAccess', _296 => _296.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
|
|
13690
13945
|
return [];
|
|
13691
13946
|
}
|
|
13692
13947
|
try {
|
|
13693
|
-
return await
|
|
13948
|
+
return await _chunkLN6FAYNBcjs.listFarmDocsPagePaths.call(void 0, config.docs, {
|
|
13694
13949
|
root,
|
|
13695
13950
|
srcDir: config.srcDir,
|
|
13696
|
-
adapter:
|
|
13951
|
+
adapter: _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
|
|
13697
13952
|
});
|
|
13698
13953
|
} catch (error) {
|
|
13699
13954
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
@@ -13704,9 +13959,9 @@ async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
|
13704
13959
|
}
|
|
13705
13960
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
13706
13961
|
return Object.values(routeRules || {}).some((rule) => {
|
|
13707
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
13708
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
13709
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
13962
|
+
const swr = _optionalChain([rule, 'optionalAccess', _297 => _297.swr]);
|
|
13963
|
+
const cache = _optionalChain([rule, 'optionalAccess', _298 => _298.cache]);
|
|
13964
|
+
const headers = _optionalChain([rule, 'optionalAccess', _299 => _299.headers]);
|
|
13710
13965
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
13711
13966
|
});
|
|
13712
13967
|
}
|
|
@@ -13719,10 +13974,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13719
13974
|
const nitroBuilder = nitroBuilderResult.value;
|
|
13720
13975
|
const isVercel = preset === "vercel";
|
|
13721
13976
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
13722
|
-
const outputDir =
|
|
13977
|
+
const outputDir = _chunk55UJGUBPcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
13723
13978
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
13724
13979
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
13725
|
-
const imageRuntime =
|
|
13980
|
+
const imageRuntime = _chunkJHRJ5V2Fcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
13726
13981
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
13727
13982
|
(image) => image.sourceType === "module"
|
|
13728
13983
|
);
|
|
@@ -13862,6 +14117,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13862
14117
|
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
13863
14118
|
const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
|
|
13864
14119
|
const encodedClientRouteTable = encodeFarmBuildJSONPlaceholder(clientRouteTable);
|
|
14120
|
+
const encodedClientStylesheet = encodeFarmBuildJSONPlaceholder(
|
|
14121
|
+
await resolveClientStylesheetLinkHref(clientOutputDir, clientCssHref)
|
|
14122
|
+
);
|
|
13865
14123
|
const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? _chunkE5UN4OWXcjs.encodeFarmMobileShellClient.call(void 0,
|
|
13866
14124
|
await _chunkE5UN4OWXcjs.finalizeFarmMobileClient.call(void 0, {
|
|
13867
14125
|
buildDir: _path2.default.join(root, distDir),
|
|
@@ -13869,7 +14127,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13869
14127
|
webEntry: clientJsSrc,
|
|
13870
14128
|
webBoot: clientBootSrc,
|
|
13871
14129
|
stylesheet: clientCssHref,
|
|
13872
|
-
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess',
|
|
14130
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _300 => _300.files]), () => ( []))
|
|
13873
14131
|
})
|
|
13874
14132
|
) : null;
|
|
13875
14133
|
for (const output of Object.values(ssrBundle)) {
|
|
@@ -13886,6 +14144,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13886
14144
|
if (output.code.includes(FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER)) {
|
|
13887
14145
|
output.code = output.code.split(FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER).join(encodedClientRouteTable);
|
|
13888
14146
|
}
|
|
14147
|
+
if (output.code.includes(FARM_CLIENT_STYLESHEET_PLACEHOLDER)) {
|
|
14148
|
+
output.code = output.code.split(FARM_CLIENT_STYLESHEET_PLACEHOLDER).join(encodedClientStylesheet);
|
|
14149
|
+
}
|
|
13889
14150
|
if (output.code.includes(FARM_CLIENT_CSS_HREF_PLACEHOLDER)) {
|
|
13890
14151
|
output.code = output.code.split(FARM_CLIENT_CSS_HREF_PLACEHOLDER).join(clientCssHref);
|
|
13891
14152
|
}
|
|
@@ -14192,7 +14453,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14192
14453
|
varyFarmNitroCacheRules(_chunkIIHZ2BEEcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules), [
|
|
14193
14454
|
...config.md.enabled ? ["accept"] : [],
|
|
14194
14455
|
...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : [],
|
|
14195
|
-
..._chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
14456
|
+
..._chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _301 => _301.experimental, 'optionalAccess', _302 => _302.serverComponents])) === "islands" ? ["f-layouts"] : []
|
|
14196
14457
|
]),
|
|
14197
14458
|
config.basePath,
|
|
14198
14459
|
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
@@ -14357,22 +14618,22 @@ function toFarmNodeResponse(request, response) {
|
|
|
14357
14618
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
14358
14619
|
);
|
|
14359
14620
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
14360
|
-
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
14361
|
-
_optionalChain([nitroConfig, 'access',
|
|
14362
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
14621
|
+
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _303 => _303.rollupConfig, 'optionalAccess', _304 => _304.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _305 => _305.rollupConfig, 'optionalAccess', _306 => _306.plugins])) && customRollupKeys.length === 0 && Boolean(
|
|
14622
|
+
_optionalChain([nitroConfig, 'access', _307 => _307.handlers, 'optionalAccess', _308 => _308.some, 'call', _309 => _309(
|
|
14623
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _310 => _310.handler]) || "") === nitroEntryPath
|
|
14363
14624
|
)])
|
|
14364
14625
|
);
|
|
14365
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access',
|
|
14626
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _311 => _311.output, 'optionalAccess', _312 => _312.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
|
|
14366
14627
|
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
14367
14628
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
14368
14629
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
14369
14630
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
14370
14631
|
const shouldMinify = nitroConfig.minify !== false;
|
|
14371
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
14632
|
+
const keepServerNames = !(_optionalChain([config, 'access', _313 => _313.docs, 'optionalAccess', _314 => _314.enabled]) && _optionalChain([config, 'access', _315 => _315.docs, 'access', _316 => _316.adapter, 'optionalAccess', _317 => _317.server]));
|
|
14372
14633
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
14373
14634
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
14374
14635
|
const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
|
|
14375
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
14636
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _318 => _318.rollupConfig, 'optionalAccess', _319 => _319.plugins]);
|
|
14376
14637
|
nitroConfig.rollupConfig = {
|
|
14377
14638
|
...nitroConfig.rollupConfig,
|
|
14378
14639
|
plugins: [
|
|
@@ -14397,7 +14658,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14397
14658
|
Array.from(routes, (route, index) => {
|
|
14398
14659
|
try {
|
|
14399
14660
|
return [decodeURI(route), index];
|
|
14400
|
-
} catch (
|
|
14661
|
+
} catch (e40) {
|
|
14401
14662
|
return [route, index];
|
|
14402
14663
|
}
|
|
14403
14664
|
})
|
|
@@ -14411,7 +14672,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14411
14672
|
let skippedNonHtmlPrerenderRoute = false;
|
|
14412
14673
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
14413
14674
|
if (route.error || !prerenderPagePaths.has(route.route)) return;
|
|
14414
|
-
if (_optionalChain([route, 'access',
|
|
14675
|
+
if (_optionalChain([route, 'access', _320 => _320.contentType, 'optionalAccess', _321 => _321.toLowerCase, 'call', _322 => _322(), 'access', _323 => _323.includes, 'call', _324 => _324("html")])) return;
|
|
14415
14676
|
route.skip = true;
|
|
14416
14677
|
skippedNonHtmlPrerenderRoute = true;
|
|
14417
14678
|
const configuredRule = configuredNitroRouteRules[route.route];
|
|
@@ -14422,9 +14683,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
14422
14683
|
nitroInstance.hooks.hook("prerender:done", () => {
|
|
14423
14684
|
if (skippedNonHtmlPrerenderRoute) nitroInstance.routing.sync();
|
|
14424
14685
|
});
|
|
14425
|
-
if (_optionalChain([config, 'access',
|
|
14686
|
+
if (_optionalChain([config, 'access', _325 => _325.md, 'optionalAccess', _326 => _326.enabled])) {
|
|
14426
14687
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
14427
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
14688
|
+
if (!route.contents || !_optionalChain([route, 'access', _327 => _327.contentType, 'optionalAccess', _328 => _328.toLowerCase, 'call', _329 => _329(), 'access', _330 => _330.includes, 'call', _331 => _331("html")])) return;
|
|
14428
14689
|
const alternatePath = _chunk2NOHVIJ3cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
|
|
14429
14690
|
routePathname: (pathname) => routeManager.toRoutePathname(pathname)
|
|
14430
14691
|
});
|
|
@@ -14447,7 +14708,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14447
14708
|
}
|
|
14448
14709
|
if (config.security.csp && config.security.csp.nonce) {
|
|
14449
14710
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
14450
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
14711
|
+
if (!route.contents || !_optionalChain([route, 'access', _332 => _332.contentType, 'optionalAccess', _333 => _333.toLowerCase, 'call', _334 => _334(), 'access', _335 => _335.includes, 'call', _336 => _336("html")])) return;
|
|
14451
14712
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
14452
14713
|
if (!staticCsp) return;
|
|
14453
14714
|
route.contents = staticCsp.html;
|
|
@@ -14483,7 +14744,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14483
14744
|
await nitroBuilder.copyPublicAssets(nitroInstance);
|
|
14484
14745
|
if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
|
|
14485
14746
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
14486
|
-
const configuredPlugins = _optionalChain([prerendererConfig, 'access',
|
|
14747
|
+
const configuredPlugins = _optionalChain([prerendererConfig, 'access', _337 => _337.rollupConfig, 'optionalAccess', _338 => _338.plugins]);
|
|
14487
14748
|
const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
|
|
14488
14749
|
prerendererConfig.rollupConfig = {
|
|
14489
14750
|
...prerendererConfig.rollupConfig,
|
|
@@ -14540,13 +14801,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
14540
14801
|
}
|
|
14541
14802
|
if (prerenderRoutes.length > 0) {
|
|
14542
14803
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
14543
|
-
const previousPrerender = process.env[
|
|
14544
|
-
process.env[
|
|
14804
|
+
const previousPrerender = process.env[_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV];
|
|
14805
|
+
process.env[_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV] = "1";
|
|
14545
14806
|
try {
|
|
14546
14807
|
await nitroBuilder.prerender(nitroInstance);
|
|
14547
14808
|
} finally {
|
|
14548
|
-
if (previousPrerender === void 0) delete process.env[
|
|
14549
|
-
else process.env[
|
|
14809
|
+
if (previousPrerender === void 0) delete process.env[_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV];
|
|
14810
|
+
else process.env[_chunkOM6JIIJUcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
14550
14811
|
}
|
|
14551
14812
|
}
|
|
14552
14813
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs5, preset) : Promise.resolve(null);
|
|
@@ -14723,7 +14984,7 @@ async function moveVercelOutputPath(src, dest, fs5) {
|
|
|
14723
14984
|
await fs5.rename(src, dest);
|
|
14724
14985
|
return;
|
|
14725
14986
|
} catch (error) {
|
|
14726
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
14987
|
+
const code = _optionalChain([error, 'optionalAccess', _339 => _339.code]);
|
|
14727
14988
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
14728
14989
|
throw error;
|
|
14729
14990
|
}
|
|
@@ -14749,7 +15010,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
14749
15010
|
try {
|
|
14750
15011
|
await moveVercelOutputPath(publicDir, staticDir, fs5);
|
|
14751
15012
|
} catch (error) {
|
|
14752
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
15013
|
+
if (_optionalChain([error, 'optionalAccess', _340 => _340.code]) !== "ENOENT") throw error;
|
|
14753
15014
|
}
|
|
14754
15015
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5);
|
|
14755
15016
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs5);
|
|
@@ -14791,7 +15052,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
14791
15052
|
_chunk7U4XF76Rcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
14792
15053
|
}
|
|
14793
15054
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
|
|
14794
|
-
if (!_optionalChain([config, 'access',
|
|
15055
|
+
if (!_optionalChain([config, 'access', _341 => _341.docs, 'optionalAccess', _342 => _342.enabled])) return;
|
|
14795
15056
|
const [mainRoot, ...extraRoots] = _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
14796
15057
|
await copyFarmDocsRootContent(
|
|
14797
15058
|
mainRoot,
|
|
@@ -14816,7 +15077,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
14816
15077
|
const lastModifiedManifest = _chunkHR5GU4UUcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
14817
15078
|
fallback: "now"
|
|
14818
15079
|
});
|
|
14819
|
-
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access',
|
|
15080
|
+
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _343 => _343.unknown, 'optionalAccess', _344 => _344.length]), () => ( 0));
|
|
14820
15081
|
if (undatedPages > 0) {
|
|
14821
15082
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
14822
15083
|
`${undatedPages} docs page(s) were last changed before this shallow clone's Git history, so they show no "Last updated" date. Build from a full clone (git fetch --unshallow) or set lastModified in the page's frontmatter.`
|
|
@@ -14856,7 +15117,7 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14856
15117
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
14857
15118
|
try {
|
|
14858
15119
|
sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
14859
|
-
} catch (
|
|
15120
|
+
} catch (e41) {
|
|
14860
15121
|
}
|
|
14861
15122
|
}
|
|
14862
15123
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
@@ -14901,7 +15162,7 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14901
15162
|
try {
|
|
14902
15163
|
await copyPackage("sharp", sharpRequire);
|
|
14903
15164
|
if (!copiedPackages.has("sharp")) {
|
|
14904
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
15165
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkJHRJ5V2Fcjs.SHARP_INSTALL_HINT}`);
|
|
14905
15166
|
}
|
|
14906
15167
|
} catch (error) {
|
|
14907
15168
|
await fs5.rm(stageDir, { recursive: true, force: true });
|
|
@@ -14983,7 +15244,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
|
|
|
14983
15244
|
if (packageJsonPath) return packageJsonPath;
|
|
14984
15245
|
try {
|
|
14985
15246
|
return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
|
|
14986
|
-
} catch (
|
|
15247
|
+
} catch (e42) {
|
|
14987
15248
|
return null;
|
|
14988
15249
|
}
|
|
14989
15250
|
}
|
|
@@ -15030,7 +15291,7 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
15030
15291
|
const resolved = parentRequire.resolve(request);
|
|
15031
15292
|
if (resolved.endsWith(".json")) return resolved;
|
|
15032
15293
|
_nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
|
|
15033
|
-
} catch (
|
|
15294
|
+
} catch (e43) {
|
|
15034
15295
|
}
|
|
15035
15296
|
}
|
|
15036
15297
|
try {
|
|
@@ -15041,13 +15302,13 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
15041
15302
|
try {
|
|
15042
15303
|
const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
|
|
15043
15304
|
if (manifest.name === packageName) return candidate;
|
|
15044
|
-
} catch (
|
|
15305
|
+
} catch (e44) {
|
|
15045
15306
|
}
|
|
15046
15307
|
}
|
|
15047
15308
|
if (_path2.default.basename(directory) === "node_modules") break;
|
|
15048
15309
|
directory = _path2.default.dirname(directory);
|
|
15049
15310
|
}
|
|
15050
|
-
} catch (
|
|
15311
|
+
} catch (e45) {
|
|
15051
15312
|
}
|
|
15052
15313
|
return null;
|
|
15053
15314
|
}
|
|
@@ -15058,7 +15319,7 @@ async function resolveProjectInstalledPackageDir(root, packageName, fs5) {
|
|
|
15058
15319
|
try {
|
|
15059
15320
|
const packageDir = await fs5.realpath(candidate);
|
|
15060
15321
|
if ((await fs5.stat(_path2.default.join(packageDir, "package.json"))).isFile()) return packageDir;
|
|
15061
|
-
} catch (
|
|
15322
|
+
} catch (e46) {
|
|
15062
15323
|
}
|
|
15063
15324
|
const parent = _path2.default.dirname(directory);
|
|
15064
15325
|
if (parent === directory) return null;
|
|
@@ -15072,7 +15333,7 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
|
|
|
15072
15333
|
const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
15073
15334
|
try {
|
|
15074
15335
|
await fs5.access(generatedClientDir);
|
|
15075
|
-
} catch (
|
|
15336
|
+
} catch (e47) {
|
|
15076
15337
|
return;
|
|
15077
15338
|
}
|
|
15078
15339
|
const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
|
|
@@ -15134,7 +15395,7 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
15134
15395
|
// src/build/index.ts
|
|
15135
15396
|
async function build(config, options = {}) {
|
|
15136
15397
|
return _chunkNG2EZ6QScjs.withProductionNodeEnv.call(void 0,
|
|
15137
|
-
() =>
|
|
15398
|
+
() => _chunkEFI6QWBQcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
15138
15399
|
);
|
|
15139
15400
|
}
|
|
15140
15401
|
function createBuildTargetBaseline(config) {
|
|
@@ -15145,7 +15406,7 @@ function createBuildTargetBaseline(config) {
|
|
|
15145
15406
|
preset,
|
|
15146
15407
|
distDir,
|
|
15147
15408
|
outputDir,
|
|
15148
|
-
outputWasDerived: outputDir ===
|
|
15409
|
+
outputWasDerived: outputDir === _chunk55UJGUBPcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
15149
15410
|
};
|
|
15150
15411
|
}
|
|
15151
15412
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -15154,8 +15415,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
15154
15415
|
const distDir = config.distDir || ".farm";
|
|
15155
15416
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
15156
15417
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
15157
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
15158
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
15418
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunk55UJGUBPcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
15419
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunk55UJGUBPcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
15159
15420
|
return {
|
|
15160
15421
|
root,
|
|
15161
15422
|
preset,
|
|
@@ -15163,7 +15424,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
15163
15424
|
distDir,
|
|
15164
15425
|
deployTarget,
|
|
15165
15426
|
outputDir,
|
|
15166
|
-
deployOutputDir:
|
|
15427
|
+
deployOutputDir: _chunk55UJGUBPcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
15167
15428
|
};
|
|
15168
15429
|
}
|
|
15169
15430
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -15200,15 +15461,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15200
15461
|
};
|
|
15201
15462
|
config = {
|
|
15202
15463
|
...config,
|
|
15203
|
-
images:
|
|
15464
|
+
images: _chunkJHRJ5V2Fcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
15204
15465
|
root: targets.root,
|
|
15205
15466
|
preset: targets.preset
|
|
15206
15467
|
})
|
|
15207
15468
|
};
|
|
15208
|
-
if (_optionalChain([config, 'access',
|
|
15469
|
+
if (_optionalChain([config, 'access', _345 => _345.docs, 'optionalAccess', _346 => _346.enabled])) await _chunkNDOE76QCcjs.loadFarmDocsEngine.call(void 0, );
|
|
15209
15470
|
pluginManager.updateContext({ config });
|
|
15210
15471
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
15211
|
-
|
|
15472
|
+
_chunkEFI6QWBQcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunkEFI6QWBQcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
|
|
15212
15473
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
15213
15474
|
await pluginManager.setupPlugins();
|
|
15214
15475
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -15220,8 +15481,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15220
15481
|
});
|
|
15221
15482
|
_chunk7U4XF76Rcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
15222
15483
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
15223
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
15224
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
15484
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _347 => _347.status]) === "rejected") throw productionViteResult.reason;
|
|
15485
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _348 => _348.value]);
|
|
15225
15486
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
15226
15487
|
projectModuleServer = await createProjectModuleServer(
|
|
15227
15488
|
createViteServer,
|
|
@@ -15229,23 +15490,24 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15229
15490
|
root,
|
|
15230
15491
|
rendererBuild.signal
|
|
15231
15492
|
);
|
|
15232
|
-
const farmApp =
|
|
15493
|
+
const farmApp = _chunkJHRJ5V2Fcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
15233
15494
|
if (options.universal !== false) farmApp.getRouteManager().keepBuildSourceSnapshot();
|
|
15234
15495
|
await farmApp.initialize();
|
|
15235
15496
|
const routeManager = farmApp.getRouteManager();
|
|
15236
15497
|
const serverRenderer = farmApp.getServerRenderer();
|
|
15237
|
-
const typeArtifacts =
|
|
15498
|
+
const typeArtifacts = _chunkHRH7OKBQcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
15238
15499
|
root,
|
|
15239
15500
|
srcDir,
|
|
15240
15501
|
layers: config.layers,
|
|
15241
15502
|
storage: config.storage,
|
|
15242
15503
|
plugins: config.plugins,
|
|
15243
15504
|
extraRoutes: [
|
|
15244
|
-
..._optionalChain([config, 'access',
|
|
15505
|
+
..._optionalChain([config, 'access', _349 => _349.openapi, 'optionalAccess', _350 => _350.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
15245
15506
|
..._chunkHR5GU4UUcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
15246
15507
|
],
|
|
15247
15508
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
15248
15509
|
componentExtensions: config.renderer.componentExtensions,
|
|
15510
|
+
renderer: config.renderer,
|
|
15249
15511
|
i18nConfig: config.i18n
|
|
15250
15512
|
}).catch((error) => {
|
|
15251
15513
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -15326,7 +15588,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15326
15588
|
throw error;
|
|
15327
15589
|
} finally {
|
|
15328
15590
|
try {
|
|
15329
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
15591
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _351 => _351.close, 'call', _352 => _352()]);
|
|
15330
15592
|
} finally {
|
|
15331
15593
|
rendererBuild.abort();
|
|
15332
15594
|
}
|
|
@@ -15334,11 +15596,11 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15334
15596
|
}
|
|
15335
15597
|
async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
|
|
15336
15598
|
const { farmNavigationPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
15337
|
-
const rendererVitePlugins = await
|
|
15599
|
+
const rendererVitePlugins = await _chunkNGTZHWBGcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
15338
15600
|
ssr: true,
|
|
15339
15601
|
buildLifetime
|
|
15340
15602
|
});
|
|
15341
|
-
const viteConfig =
|
|
15603
|
+
const viteConfig = _chunkJHRJ5V2Fcjs.mergeFarmViteConfig.call(void 0,
|
|
15342
15604
|
{
|
|
15343
15605
|
root,
|
|
15344
15606
|
appType: "custom",
|
|
@@ -15350,12 +15612,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15350
15612
|
},
|
|
15351
15613
|
plugins: [
|
|
15352
15614
|
...rendererVitePlugins,
|
|
15353
|
-
|
|
15615
|
+
_chunkJHRJ5V2Fcjs.farmFontImportsPlugin.call(void 0, {
|
|
15354
15616
|
root,
|
|
15355
15617
|
basePath: config.basePath,
|
|
15356
15618
|
publicDir: config.publicDir
|
|
15357
15619
|
}),
|
|
15358
|
-
|
|
15620
|
+
_chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, { renderer: config.renderer }),
|
|
15359
15621
|
// Route modules load here at build time (rendering config, prerendering): `server-only`
|
|
15360
15622
|
// resolves as it does in the server build. Module-entry packages load pre-bundled, as in
|
|
15361
15623
|
// `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
|
|
@@ -15371,7 +15633,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15371
15633
|
hmr: false
|
|
15372
15634
|
},
|
|
15373
15635
|
resolve: {
|
|
15374
|
-
alias:
|
|
15636
|
+
alias: _chunkJHRJ5V2Fcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
15375
15637
|
dedupe: [...config.renderer.dedupe || []]
|
|
15376
15638
|
},
|
|
15377
15639
|
optimizeDeps: {
|
|
@@ -15410,10 +15672,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15410
15672
|
noDiscovery: true
|
|
15411
15673
|
},
|
|
15412
15674
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
15413
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
15675
|
+
environments: _optionalChain([viteConfig, 'access', _353 => _353.environments, 'optionalAccess', _354 => _354.ssr, 'optionalAccess', _355 => _355.dev, 'optionalAccess', _356 => _356.createEnvironment]) ? viteConfig.environments : {
|
|
15414
15676
|
...viteConfig.environments,
|
|
15415
15677
|
ssr: {
|
|
15416
|
-
..._optionalChain([viteConfig, 'access',
|
|
15678
|
+
..._optionalChain([viteConfig, 'access', _357 => _357.environments, 'optionalAccess', _358 => _358.ssr]),
|
|
15417
15679
|
...await createFarmProjectModuleSsrEnvironment()
|
|
15418
15680
|
}
|
|
15419
15681
|
}
|
|
@@ -15449,7 +15711,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15449
15711
|
farmNavigationPlugin(config.renderer),
|
|
15450
15712
|
farmIslandContainersPlugin(config),
|
|
15451
15713
|
farmPlugin(config, pluginManager),
|
|
15452
|
-
|
|
15714
|
+
_chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
15453
15715
|
],
|
|
15454
15716
|
mode: "production"
|
|
15455
15717
|
});
|
|
@@ -15477,20 +15739,20 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15477
15739
|
define: {
|
|
15478
15740
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
15479
15741
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
15480
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
15742
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _359 => _359.env, 'optionalAccess', _360 => _360.public]) || {})
|
|
15481
15743
|
},
|
|
15482
15744
|
plugins: [
|
|
15483
15745
|
farmI18nClientBridgePlugin(),
|
|
15484
15746
|
farmIslandContainersPlugin(config),
|
|
15485
15747
|
farmPlugin(config, pluginManager),
|
|
15486
|
-
|
|
15748
|
+
_chunkEFI6QWBQcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
15487
15749
|
],
|
|
15488
15750
|
mode: "production"
|
|
15489
15751
|
});
|
|
15490
15752
|
}
|
|
15491
15753
|
function resolveLegacyPageEntry(config, root, srcDir) {
|
|
15492
15754
|
const appDir = _path2.default.join(root, srcDir, "app");
|
|
15493
|
-
for (const extension of
|
|
15755
|
+
for (const extension of _chunkNGTZHWBGcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer)) {
|
|
15494
15756
|
const candidate = _path2.default.join(appDir, `page${extension}`);
|
|
15495
15757
|
if (_fs.existsSync.call(void 0, candidate)) return candidate;
|
|
15496
15758
|
}
|
|
@@ -15511,7 +15773,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15511
15773
|
if (pluginManager) {
|
|
15512
15774
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
15513
15775
|
}
|
|
15514
|
-
const outputDir =
|
|
15776
|
+
const outputDir = _chunk55UJGUBPcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
15515
15777
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
15516
15778
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
15517
15779
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -15570,7 +15832,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15570
15832
|
const { readFile: readFile2 } = await import("fs/promises");
|
|
15571
15833
|
const manifestContent = await readFile2(clientManifestPath, "utf-8");
|
|
15572
15834
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
15573
|
-
} catch (
|
|
15835
|
+
} catch (e48) {
|
|
15574
15836
|
farmRegistry.clientManifest = {};
|
|
15575
15837
|
}
|
|
15576
15838
|
} catch (error) {
|
|
@@ -15582,7 +15844,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15582
15844
|
root,
|
|
15583
15845
|
preset,
|
|
15584
15846
|
distDir,
|
|
15585
|
-
outputDir:
|
|
15847
|
+
outputDir: _chunk55UJGUBPcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
15586
15848
|
});
|
|
15587
15849
|
}
|
|
15588
15850
|
}
|