@farm.js/core 0.1.42 → 0.1.44
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-ssVy_tea.d.mts → agent-mcp-CWI-awqd.d.mts} +1 -1
- package/dist/{agent-mcp-SSD6L3VZ.d.ts → agent-mcp-EnzWYv_X.d.ts} +1 -1
- package/dist/agent-runtime.cjs +3 -2
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +2 -1
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +2 -2
- package/dist/api.d.mts +8 -3
- package/dist/api.d.ts +8 -3
- package/dist/api.mjs +1 -1
- package/dist/{app-KjFzdCqy.d.ts → app-CAN_2Cqo.d.ts} +8 -4
- package/dist/{app-1h3lVT4a.d.mts → app-DG3dE8v5.d.mts} +8 -4
- package/dist/{app-manifest-D3RkVNuS.d.mts → app-manifest-8x5VjZ0L.d.mts} +1 -1
- package/dist/{app-manifest-DaW8-tvX.d.ts → app-manifest-DazjgQya.d.ts} +1 -1
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{chunk-ECKF2BAM.cjs → chunk-2GVF3C2F.cjs} +255 -42
- package/dist/{chunk-TUL355PH.mjs → chunk-2MKTHHEU.mjs} +136 -161
- package/dist/chunk-2NXO5SBY.mjs +57 -0
- package/dist/{chunk-AX7S67YV.mjs → chunk-37VKVISD.mjs} +9 -173
- package/dist/chunk-3BROEWFY.cjs +39 -0
- package/dist/chunk-3SAWHWDH.cjs +186 -0
- package/dist/{chunk-AHFRQMRX.cjs → chunk-3YJMBQ27.cjs} +1 -1
- package/dist/{chunk-6PKXK4TY.mjs → chunk-53ZV6K65.mjs} +1 -1
- package/dist/{chunk-JG3MEQUH.cjs → chunk-5GBL2LKD.cjs} +430 -217
- package/dist/{chunk-LYIZHJTK.cjs → chunk-5LPHJZSI.cjs} +14 -14
- package/dist/chunk-5NIWBWDD.mjs +97 -0
- package/dist/{chunk-NRDBW4MP.mjs → chunk-7IQQIPRZ.mjs} +10 -0
- package/dist/{chunk-TCJ4A4A2.cjs → chunk-AI3WVJNP.cjs} +324 -350
- package/dist/chunk-APDGOKKE.cjs +148 -0
- package/dist/chunk-AZBSVLRM.cjs +132 -0
- package/dist/{chunk-RHGK2JEN.cjs → chunk-B6XAA7V6.cjs} +18 -182
- package/dist/chunk-CEDPEDNW.cjs +98 -0
- package/dist/{chunk-WSOBCAYO.cjs → chunk-CW6SNEN2.cjs} +25 -25
- package/dist/chunk-D5RFPV2H.mjs +148 -0
- package/dist/chunk-E22SWCXB.cjs +144 -0
- package/dist/{chunk-375K2ZVU.mjs → chunk-ERA5RP3L.mjs} +263 -50
- package/dist/{chunk-724JLMS4.mjs → chunk-F646BZ4Y.mjs} +4 -2
- package/dist/{chunk-C5KVWHIH.cjs → chunk-G2Z5DGMS.cjs} +5 -3
- package/dist/{chunk-ZATTDMBW.cjs → chunk-GA6JM4L6.cjs} +279 -376
- package/dist/chunk-GZWHCWLB.mjs +186 -0
- package/dist/{chunk-24SP5TGU.mjs → chunk-H4LXPWI2.mjs} +2 -2
- package/dist/chunk-H7BLEEAE.cjs +57 -0
- package/dist/chunk-IOMVXBLZ.mjs +144 -0
- package/dist/{chunk-BD3D7EZV.cjs → chunk-IXFOBGLQ.cjs} +9 -3
- package/dist/{chunk-JIYYX7WU.mjs → chunk-JVXW76I7.mjs} +2 -2
- package/dist/{chunk-MHN4UR5U.cjs → chunk-KFZZFZ7J.cjs} +7 -7
- package/dist/{chunk-BXJ5HJTJ.cjs → chunk-LPE3ED4R.cjs} +17 -13
- package/dist/chunk-LRJRXXQZ.cjs +109 -0
- package/dist/{chunk-HCSVR4YZ.mjs → chunk-M3BXTWJM.mjs} +18 -0
- package/dist/{chunk-2JZHQDUY.mjs → chunk-OYZGFRPA.mjs} +1 -1
- package/dist/{chunk-JR4QCLJY.cjs → chunk-PDU4P2IC.cjs} +19 -1
- package/dist/chunk-PJEHUSHA.mjs +229 -0
- package/dist/{chunk-QTEJGB5A.mjs → chunk-QGFKXYC7.mjs} +80 -177
- package/dist/chunk-QGH2RQVF.mjs +132 -0
- package/dist/{chunk-YWMZUGIS.mjs → chunk-R3ZFQJEF.mjs} +247 -34
- package/dist/{chunk-U2UC7UGP.mjs → chunk-R4J2UOV4.mjs} +1 -1
- package/dist/chunk-S34OBRMZ.mjs +109 -0
- package/dist/{chunk-TS4JHGUJ.mjs → chunk-S3ZEMCE6.mjs} +9 -3
- package/dist/{chunk-WWFTAUFG.cjs → chunk-SBH2JLLF.cjs} +12 -2
- package/dist/{chunk-YSLWRWWP.cjs → chunk-SKK6UF5P.cjs} +200 -46
- package/dist/{chunk-ZS6HDNOM.cjs → chunk-T44ECMEP.cjs} +6 -6
- package/dist/{chunk-OFZUJMCU.mjs → chunk-WPJQN64R.mjs} +195 -41
- package/dist/{chunk-NU25TRIO.mjs → chunk-WWYXIECF.mjs} +12 -8
- package/dist/{chunk-7YHSD3Z6.cjs → chunk-XPSGGECF.cjs} +85 -31
- package/dist/chunk-XUGFRFD2.mjs +39 -0
- package/dist/{chunk-IVQY6UTY.mjs → chunk-XUHIRBXY.mjs} +1 -1
- package/dist/{chunk-PIZXONIS.mjs → chunk-YFLBG2W3.mjs} +56 -2
- package/dist/chunk-YKUEJ3MG.cjs +229 -0
- package/dist/{chunk-QKZMB7LY.cjs → chunk-YN2QEMMO.cjs} +2 -2
- package/dist/{client-plugins-DIem0I0W.d.ts → client-plugins-BGS0wqzc.d.ts} +36 -16
- package/dist/{client-plugins-C9Py_50W.d.mts → client-plugins-nQ0tYt4l.d.mts} +36 -16
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +4 -3
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +3 -2
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-2RY3EKHL.cjs → devtools-5Q7VRKVH.cjs} +6 -5
- package/dist/{devtools-Q3LBNUJ7.mjs → devtools-LJ4IGYGW.mjs} +5 -4
- package/dist/docs.cjs +7 -6
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +6 -5
- package/dist/index-Cy26isrh.d.ts +48 -0
- package/dist/index-y1jgR74U.d.mts +48 -0
- package/dist/index.cjs +44 -25
- package/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.mjs +51 -32
- package/dist/integrations.cjs +5 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +6 -4
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +30 -15
- package/dist/internal/build-runtime.d.mts +12 -16
- package/dist/internal/build-runtime.d.ts +12 -16
- package/dist/internal/build-runtime.mjs +29 -14
- package/dist/internal/cli-runtime.cjs +24 -11
- package/dist/internal/cli-runtime.mjs +24 -11
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +5 -1
- package/dist/internal/client-runtime.d.mts +1 -0
- package/dist/internal/client-runtime.d.ts +1 -0
- package/dist/internal/client-runtime.mjs +4 -0
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +6 -5
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/form-actions-client.cjs +18 -0
- package/dist/internal/form-actions-client.d.mts +5 -0
- package/dist/internal/form-actions-client.d.ts +5 -0
- package/dist/internal/form-actions-client.mjs +18 -0
- package/dist/internal/form-actions.cjs +18 -0
- package/dist/internal/form-actions.d.mts +14 -0
- package/dist/internal/form-actions.d.ts +14 -0
- package/dist/internal/form-actions.mjs +18 -0
- package/dist/internal/island-codec.cjs +22 -0
- package/dist/internal/island-codec.d.mts +29 -0
- package/dist/internal/island-codec.d.ts +29 -0
- package/dist/internal/island-codec.mjs +22 -0
- package/dist/internal/island-value-store.cjs +13 -0
- package/dist/internal/island-value-store.d.mts +6 -0
- package/dist/internal/island-value-store.d.ts +6 -0
- package/dist/internal/island-value-store.mjs +13 -0
- package/dist/internal/islands-runtime.cjs +77 -0
- package/dist/internal/islands-runtime.d.mts +57 -0
- package/dist/internal/islands-runtime.d.ts +57 -0
- package/dist/internal/islands-runtime.mjs +77 -0
- package/dist/internal/islands-server.cjs +19 -0
- package/dist/internal/islands-server.d.mts +3 -0
- package/dist/internal/islands-server.d.ts +3 -0
- package/dist/internal/islands-server.mjs +19 -0
- package/dist/internal/islx-client.cjs +5 -0
- package/dist/internal/islx-client.d.mts +2 -0
- package/dist/internal/islx-client.d.ts +2 -0
- package/dist/internal/islx-client.mjs +3 -0
- package/dist/internal/islx-react.cjs +4 -0
- package/dist/internal/islx-react.d.mts +1 -0
- package/dist/internal/islx-react.d.ts +1 -0
- package/dist/internal/islx-react.mjs +2 -0
- package/dist/internal/islx-server.cjs +5 -0
- package/dist/internal/islx-server.d.mts +2 -0
- package/dist/internal/islx-server.d.ts +2 -0
- package/dist/internal/islx-server.mjs +3 -0
- package/dist/internal/isolated-boundary.cjs +4 -3
- package/dist/internal/isolated-boundary.d.mts +13 -1
- package/dist/internal/isolated-boundary.d.ts +13 -1
- package/dist/internal/isolated-boundary.mjs +3 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +24 -13
- package/dist/internal/production-runtime.d.mts +20 -10
- package/dist/internal/production-runtime.d.ts +20 -10
- package/dist/internal/production-runtime.mjs +24 -13
- package/dist/internal/server-tree.cjs +6 -3
- package/dist/internal/server-tree.d.mts +25 -2
- package/dist/internal/server-tree.d.ts +25 -2
- package/dist/internal/server-tree.mjs +7 -4
- package/dist/island-value-protocol-BRayRghM.d.mts +12 -0
- package/dist/island-value-protocol-BRayRghM.d.ts +12 -0
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/navigation.cjs +5 -4
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +4 -3
- package/dist/og.d.mts +5 -0
- package/dist/og.d.ts +5 -0
- package/dist/plugin.cjs +19 -12
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +18 -11
- package/dist/{production-runtime-bjjWq-DA.d.ts → production-runtime-BVMDgHrA.d.ts} +1 -1
- package/dist/{production-runtime-CHFKIgpW.d.mts → production-runtime-ClFA_1KQ.d.mts} +1 -1
- package/dist/query/client.cjs +6 -5
- package/dist/query/client.mjs +2 -1
- package/dist/{render-plan-DOHg6wdO.d.mts → render-plan-CoSovy_O.d.mts} +4 -2
- package/dist/{render-plan-B2UndB4x.d.ts → render-plan-y2DefWf8.d.ts} +4 -2
- package/dist/renderer/react/server.cjs +7 -6
- package/dist/renderer/react/server.d.mts +3 -1
- package/dist/renderer/react/server.d.ts +3 -1
- package/dist/renderer/react/server.mjs +5 -4
- package/dist/renderer-client.cjs +5 -4
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +2 -1
- package/dist/renderer.d.mts +3 -1
- package/dist/renderer.d.ts +3 -1
- package/dist/{request-DVNXRQrI.d.ts → request-aG5Wovm5.d.ts} +1 -1
- package/dist/{request-DQcGfdgQ.d.mts → request-cNM09Q7e.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering-B_6fj-GG.d.ts → route-rendering-B3uQmCWX.d.ts} +1 -1
- package/dist/{route-rendering-CEX4mFn-.d.mts → route-rendering-EyInfsjI.d.mts} +1 -1
- package/dist/{router-CHEMHm1P.d.ts → router-DNUf-Bg1.d.ts} +1 -1
- package/dist/{router-CKHPBKXX.d.mts → router-Devibh4r.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/rsc-pipeline-4ZJ6GUVQ.cjs +78 -0
- package/dist/rsc-pipeline-KK6GFDET.mjs +78 -0
- package/dist/{runtime-jj8TKNsy.d.mts → runtime-9KZb8AI5.d.mts} +1 -1
- package/dist/{runtime-Br2ZDTAv.d.ts → runtime-CLr9P5kn.d.ts} +1 -1
- package/dist/{schema-dev-notice-5JPE67AI.cjs → schema-dev-notice-77ZL23PL.cjs} +4 -4
- package/dist/{schema-dev-notice-WLPZ6WKU.mjs → schema-dev-notice-BLXOS6U2.mjs} +2 -2
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server.cjs +57 -38
- package/dist/server.d.mts +15 -10
- package/dist/server.d.ts +15 -10
- package/dist/server.mjs +37 -18
- package/dist/{spa-router-BEvS9Erj.d.mts → spa-router-BIxh4IY-.d.mts} +8 -3
- package/dist/{spa-router-DmCuH5B7.d.ts → spa-router-Ds6R_oe-.d.ts} +8 -3
- package/dist/{ssg-57v6cZcW.d.mts → ssg-ByrOVYdM.d.mts} +2 -2
- package/dist/{ssg-gT093ETk.d.ts → ssg-XnMHCyEc.d.ts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils-CCTKvR-P.d.ts → utils-BN70ueSN.d.ts} +1 -1
- package/dist/{utils-raHHQVyL.d.mts → utils-BrjR5xRs.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +19 -12
- package/dist/vite.d.mts +6 -4
- package/dist/vite.d.ts +6 -4
- package/dist/vite.mjs +18 -11
- package/package.json +53 -1
- package/dist/{chunk-35WS7P2V.mjs → chunk-26CXZR6L.mjs} +3 -3
- package/dist/{chunk-QEILRWVV.cjs → chunk-3XEMGDBF.cjs} +2 -2
- package/dist/{chunk-BPOTSHDO.cjs → chunk-IOAUK4OI.cjs} +2 -2
- package/dist/{chunk-BYR3RQPB.mjs → chunk-T76H22WI.mjs} +4 -4
|
@@ -11,13 +11,13 @@ var _chunkCGR525MJcjs = require('./chunk-CGR525MJ.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkT44ECMEPcjs = require('./chunk-T44ECMEP.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkYN2QEMMOcjs = require('./chunk-YN2QEMMO.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -45,7 +45,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkLPE3ED4Rcjs = require('./chunk-LPE3ED4R.cjs');
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
var _chunkKCMTCM6Icjs = require('./chunk-KCMTCM6I.cjs');
|
|
@@ -82,18 +82,18 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
var _chunkZATTDMBWcjs = require('./chunk-ZATTDMBW.cjs');
|
|
85
|
+
var _chunkGA6JM4L6cjs = require('./chunk-GA6JM4L6.cjs');
|
|
87
86
|
|
|
88
87
|
|
|
89
88
|
var _chunk45QJHGZMcjs = require('./chunk-45QJHGZM.cjs');
|
|
90
89
|
|
|
91
90
|
|
|
91
|
+
var _chunkLRJRXXQZcjs = require('./chunk-LRJRXXQZ.cjs');
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
var _chunkQEILRWVVcjs = require('./chunk-QEILRWVV.cjs');
|
|
95
94
|
|
|
96
95
|
|
|
96
|
+
var _chunk3XEMGDBFcjs = require('./chunk-3XEMGDBF.cjs');
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
|
|
@@ -107,15 +107,17 @@ var _chunkQEILRWVVcjs = require('./chunk-QEILRWVV.cjs');
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
var _chunk7YHSD3Z6cjs = require('./chunk-7YHSD3Z6.cjs');
|
|
111
110
|
|
|
112
111
|
|
|
112
|
+
var _chunkXPSGGECFcjs = require('./chunk-XPSGGECF.cjs');
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
var
|
|
115
|
+
var _chunkTI7UANHIcjs = require('./chunk-TI7UANHI.cjs');
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
var _chunkBMOBTMDRcjs = require('./chunk-BMOBTMDR.cjs');
|
|
119
121
|
|
|
120
122
|
|
|
121
123
|
var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
|
|
@@ -132,6 +134,9 @@ var _chunkCY2ZQ5C6cjs = require('./chunk-CY2ZQ5C6.cjs');
|
|
|
132
134
|
var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
133
135
|
|
|
134
136
|
|
|
137
|
+
var _chunkPDU4P2ICcjs = require('./chunk-PDU4P2IC.cjs');
|
|
138
|
+
|
|
139
|
+
|
|
135
140
|
var _chunkQ5B3KJBPcjs = require('./chunk-Q5B3KJBP.cjs');
|
|
136
141
|
|
|
137
142
|
|
|
@@ -157,6 +162,9 @@ var _chunkWBKEZXWEcjs = require('./chunk-WBKEZXWE.cjs');
|
|
|
157
162
|
var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
|
|
158
163
|
|
|
159
164
|
|
|
165
|
+
var _chunkP4TYB4SFcjs = require('./chunk-P4TYB4SF.cjs');
|
|
166
|
+
|
|
167
|
+
|
|
160
168
|
var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
|
|
161
169
|
|
|
162
170
|
|
|
@@ -178,8 +186,10 @@ var _chunkOILHPMFXcjs = require('./chunk-OILHPMFX.cjs');
|
|
|
178
186
|
|
|
179
187
|
|
|
180
188
|
|
|
189
|
+
var _chunkB6XAA7V6cjs = require('./chunk-B6XAA7V6.cjs');
|
|
190
|
+
|
|
181
191
|
|
|
182
|
-
var
|
|
192
|
+
var _chunk3SAWHWDHcjs = require('./chunk-3SAWHWDH.cjs');
|
|
183
193
|
|
|
184
194
|
|
|
185
195
|
|
|
@@ -214,7 +224,7 @@ var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
|
214
224
|
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
215
225
|
|
|
216
226
|
|
|
217
|
-
var
|
|
227
|
+
var _chunk3YJMBQ27cjs = require('./chunk-3YJMBQ27.cjs');
|
|
218
228
|
|
|
219
229
|
|
|
220
230
|
var _chunkC5GUTBZKcjs = require('./chunk-C5GUTBZK.cjs');
|
|
@@ -233,6 +243,9 @@ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
|
233
243
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
234
244
|
var _fs = require('fs');
|
|
235
245
|
|
|
246
|
+
// src/nitro/universal-build.ts
|
|
247
|
+
var _crypto = require('crypto');
|
|
248
|
+
|
|
236
249
|
// src/nitro/client-css-href.ts
|
|
237
250
|
|
|
238
251
|
var FARM_CLIENT_CSS_HREF_PLACEHOLDER = "/__farm_client_css_href__";
|
|
@@ -364,7 +377,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
364
377
|
globalStylesheetHref: options.globalStylesheetHref,
|
|
365
378
|
isPathGuarded: options.isPathGuarded
|
|
366
379
|
});
|
|
367
|
-
const apiHandler =
|
|
380
|
+
const apiHandler = _chunkYN2QEMMOcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
368
381
|
rootDir: options.root,
|
|
369
382
|
srcDir: options.srcDir,
|
|
370
383
|
docs,
|
|
@@ -647,7 +660,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
647
660
|
const routes = [];
|
|
648
661
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
649
662
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
650
|
-
const rendering = await
|
|
663
|
+
const rendering = await _chunk3XEMGDBFcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
651
664
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
652
665
|
routes.push({
|
|
653
666
|
kind: "page",
|
|
@@ -1624,7 +1637,7 @@ async function findFarmConfigPath(root) {
|
|
|
1624
1637
|
_chunkS3JO3N4Hcjs.__name.call(void 0, findFarmConfigPath, "findFarmConfigPath");
|
|
1625
1638
|
function hasFarmServerRuntimePlugins(config) {
|
|
1626
1639
|
return (config.plugins || []).some((plugin) => {
|
|
1627
|
-
if (
|
|
1640
|
+
if (_chunkB6XAA7V6cjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
|
|
1628
1641
|
return Boolean(
|
|
1629
1642
|
plugin.setup || plugin.init || plugin.ready || plugin.shutdown || plugin.runtime || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML
|
|
1630
1643
|
);
|
|
@@ -1637,7 +1650,7 @@ function hasFarmPluginRoutes(config) {
|
|
|
1637
1650
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
|
|
1638
1651
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1639
1652
|
return (config.plugins || []).some(
|
|
1640
|
-
(plugin) =>
|
|
1653
|
+
(plugin) => _chunkB6XAA7V6cjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkTI7UANHIcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1641
1654
|
);
|
|
1642
1655
|
}
|
|
1643
1656
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
|
|
@@ -1700,7 +1713,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1700
1713
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1701
1714
|
const srcDir = config.srcDir || "src";
|
|
1702
1715
|
const distDir = config.distDir || ".farm";
|
|
1703
|
-
const deployOutputDir =
|
|
1716
|
+
const deployOutputDir = _chunkLPE3ED4Rcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1704
1717
|
const lifecyclePluginManager = options.pluginManager;
|
|
1705
1718
|
const productionViteResultPromise = Promise.allSettled([
|
|
1706
1719
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -1952,7 +1965,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
1952
1965
|
}
|
|
1953
1966
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
1954
1967
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
1955
|
-
await fs4.writeFile(clientCssPath,
|
|
1968
|
+
await fs4.writeFile(clientCssPath, _chunkGA6JM4L6cjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
1956
1969
|
}
|
|
1957
1970
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
|
|
1958
1971
|
var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
|
|
@@ -1999,10 +2012,10 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
1999
2012
|
}
|
|
2000
2013
|
_chunkS3JO3N4Hcjs.__name.call(void 0, validateClientBuildOutput, "validateClientBuildOutput");
|
|
2001
2014
|
function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, options = {}) {
|
|
2002
|
-
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
|
|
2015
|
+
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${_path2.default.resolve(modulePath)}`;
|
|
2003
2016
|
let plan = cache.get(key);
|
|
2004
2017
|
if (!plan) {
|
|
2005
|
-
plan =
|
|
2018
|
+
plan = _chunkGA6JM4L6cjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2006
2019
|
cache.set(key, plan);
|
|
2007
2020
|
}
|
|
2008
2021
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -2020,28 +2033,32 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2020
2033
|
});
|
|
2021
2034
|
pluginManager.addPlugins(config.plugins || []);
|
|
2022
2035
|
const clientPages = [];
|
|
2023
|
-
const integrationProviders =
|
|
2036
|
+
const integrationProviders = _chunkB6XAA7V6cjs.getIntegrationProviders.call(void 0, config.integrations).filter(
|
|
2024
2037
|
(provider) => provider.component || provider.type === "clerk"
|
|
2025
2038
|
);
|
|
2026
2039
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2027
2040
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2028
2041
|
);
|
|
2029
|
-
if (_optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]) === "enabled" && _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents]) !==
|
|
2042
|
+
if (_optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]) === "enabled" && _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2030
2043
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
2031
2044
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2032
2045
|
);
|
|
2033
2046
|
}
|
|
2034
|
-
const isolatedMode =
|
|
2047
|
+
const isolatedMode = _chunkGA6JM4L6cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2035
2048
|
_optionalChain([config, 'access', _39 => _39.experimental, 'optionalAccess', _40 => _40.isolatedClientHydration]),
|
|
2036
2049
|
{
|
|
2037
|
-
serverComponents: _optionalChain([config, 'access', _41 => _41.experimental, 'optionalAccess', _42 => _42.serverComponents]) ===
|
|
2050
|
+
serverComponents: _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _41 => _41.experimental, 'optionalAccess', _42 => _42.serverComponents])) === "rsc",
|
|
2038
2051
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2039
2052
|
}
|
|
2040
2053
|
);
|
|
2041
|
-
const planOptions =
|
|
2054
|
+
const planOptions = _chunkGA6JM4L6cjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2042
2055
|
config.renderer,
|
|
2043
2056
|
Boolean(unsupportedIntegrationProvider)
|
|
2044
2057
|
);
|
|
2058
|
+
const pagePlanOptions = {
|
|
2059
|
+
...planOptions,
|
|
2060
|
+
serverOwners: _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _43 => _43.experimental, 'optionalAccess', _44 => _44.serverComponents])) === "islands"
|
|
2061
|
+
};
|
|
2045
2062
|
const clientLayouts = layoutRoutes.map((layout) => {
|
|
2046
2063
|
try {
|
|
2047
2064
|
const metadata = getCachedClientModuleHydrationPlan(
|
|
@@ -2085,18 +2102,18 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2085
2102
|
};
|
|
2086
2103
|
}
|
|
2087
2104
|
});
|
|
2088
|
-
const layoutAppliesToRoute =
|
|
2105
|
+
const layoutAppliesToRoute = _chunkXPSGGECFcjs.routeBoundaryCoversDirectory;
|
|
2089
2106
|
const routeDirectory = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (route) => _nullishCoalesce(route.directory, () => ( route.pattern)), "routeDirectory");
|
|
2090
2107
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2091
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
2108
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _45 => _45.docs, 'optionalAccess', _46 => _46.enabled]) && _optionalChain([config, 'access', _47 => _47.docs, 'access', _48 => _48.adapter, 'optionalAccess', _49 => _49.server]) && config.docs.adapter.react
|
|
2092
2109
|
);
|
|
2093
|
-
const adapterDocsEntry = _optionalChain([config, 'access',
|
|
2110
|
+
const adapterDocsEntry = _optionalChain([config, 'access', _50 => _50.docs, 'optionalAccess', _51 => _51.enabled]) ? `/${config.docs.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/" : null;
|
|
2094
2111
|
const isAdapterDocsRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (routePattern) => Boolean(
|
|
2095
2112
|
adapterOwnsDocsRuntime && adapterDocsEntry && (adapterDocsEntry === "/" || routePattern === adapterDocsEntry || routePattern.startsWith(`${adapterDocsEntry}/`))
|
|
2096
2113
|
), "isAdapterDocsRoute");
|
|
2097
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
2114
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _52 => _52.docs, 'optionalAccess', _53 => _53.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2098
2115
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2099
|
-
const markdownPagePlan =
|
|
2116
|
+
const markdownPagePlan = _chunkGA6JM4L6cjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2100
2117
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2101
2118
|
root,
|
|
2102
2119
|
isolatedMode,
|
|
@@ -2109,10 +2126,10 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2109
2126
|
root,
|
|
2110
2127
|
isolatedMode,
|
|
2111
2128
|
hydrationPlanCache,
|
|
2112
|
-
|
|
2129
|
+
pagePlanOptions
|
|
2113
2130
|
)
|
|
2114
2131
|
}));
|
|
2115
|
-
|
|
2132
|
+
_chunkGA6JM4L6cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2116
2133
|
clientLayouts.map((layout) => ({
|
|
2117
2134
|
pattern: layout.pattern,
|
|
2118
2135
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2121,7 +2138,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2121
2138
|
[
|
|
2122
2139
|
...routePlans.map(({ route, metadata }) => ({
|
|
2123
2140
|
pattern: routeDirectory(route),
|
|
2124
|
-
depth:
|
|
2141
|
+
depth: _chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
2125
2142
|
metadata
|
|
2126
2143
|
})),
|
|
2127
2144
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -2144,7 +2161,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2144
2161
|
for (const layout of clientLayouts) {
|
|
2145
2162
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
|
|
2146
2163
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2147
|
-
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${
|
|
2164
|
+
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkGA6JM4L6cjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2148
2165
|
}
|
|
2149
2166
|
}
|
|
2150
2167
|
if (isolatedMode === "analyze") {
|
|
@@ -2168,7 +2185,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2168
2185
|
);
|
|
2169
2186
|
if (metadata.suppressedAsyncHydration) {
|
|
2170
2187
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
2171
|
-
`\u26A0\uFE0F ${
|
|
2188
|
+
`\u26A0\uFE0F ${_chunkGA6JM4L6cjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2172
2189
|
);
|
|
2173
2190
|
}
|
|
2174
2191
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2193,7 +2210,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2193
2210
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries).flatMap((layout) => layout.isolatedBoundaries)
|
|
2194
2211
|
],
|
|
2195
2212
|
// The server renders a server tree only below a hydrating layout.
|
|
2196
|
-
...
|
|
2213
|
+
..._chunkGA6JM4L6cjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2197
2214
|
});
|
|
2198
2215
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2199
2216
|
}
|
|
@@ -2229,7 +2246,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2229
2246
|
}
|
|
2230
2247
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2231
2248
|
try {
|
|
2232
|
-
return
|
|
2249
|
+
return _chunkGA6JM4L6cjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2233
2250
|
} catch (error) {
|
|
2234
2251
|
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2235
2252
|
return false;
|
|
@@ -2250,17 +2267,18 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2250
2267
|
srcDir,
|
|
2251
2268
|
adapterOwnsDocsRuntime ? false : _chunkMWWVKDW3cjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2252
2269
|
adapterOwnsDocsRuntime ? void 0 : _chunkMWWVKDW3cjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2253
|
-
_optionalChain([config, 'access',
|
|
2254
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access',
|
|
2270
|
+
_optionalChain([config, 'access', _54 => _54.docs, 'optionalAccess', _55 => _55.enabled]) ? config.docs.entry : void 0,
|
|
2271
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _56 => _56.docs, 'access', _57 => _57.adapter, 'optionalAccess', _58 => _58.react]) : void 0,
|
|
2255
2272
|
config.i18n,
|
|
2256
2273
|
config.plugins,
|
|
2257
2274
|
config.renderer,
|
|
2258
2275
|
config.publicRuntimeConfig,
|
|
2259
2276
|
config.trailingSlash,
|
|
2260
|
-
|
|
2277
|
+
_chunkB6XAA7V6cjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2261
2278
|
config.basePath,
|
|
2262
|
-
|
|
2263
|
-
adapterOwnsDocsRuntime ? _chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2279
|
+
_chunkGA6JM4L6cjs.generateClientCachePersistenceCode.call(void 0, _chunkGA6JM4L6cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2280
|
+
adapterOwnsDocsRuntime ? _chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2281
|
+
_chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _59 => _59.experimental, 'optionalAccess', _60 => _60.serverComponents])) === "islands"
|
|
2264
2282
|
);
|
|
2265
2283
|
await fs4.writeFile(clientEntryPath, clientHydrationCode);
|
|
2266
2284
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
@@ -2276,7 +2294,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2276
2294
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2277
2295
|
await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2278
2296
|
postcssSearchPath = clientEntryDir;
|
|
2279
|
-
tailwindVitePlugin = await
|
|
2297
|
+
tailwindVitePlugin = await _chunkLRJRXXQZcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2280
2298
|
builder: productionVite.builder,
|
|
2281
2299
|
announce: true
|
|
2282
2300
|
});
|
|
@@ -2297,7 +2315,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2297
2315
|
outDir: outputDir,
|
|
2298
2316
|
emptyOutDir: true,
|
|
2299
2317
|
// Never public: see resolveFarmClientSourcemap.
|
|
2300
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
2318
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _61 => _61.vite, 'optionalAccess', _62 => _62.build, 'optionalAccess', _63 => _63.sourcemap])),
|
|
2301
2319
|
assetsInlineLimit: 0,
|
|
2302
2320
|
cssCodeSplit: false,
|
|
2303
2321
|
// Bundle all CSS into one file
|
|
@@ -2311,7 +2329,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2311
2329
|
hashCharacters: "hex",
|
|
2312
2330
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2313
2331
|
assetFileNames: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (assetInfo) => {
|
|
2314
|
-
if (_optionalChain([assetInfo, 'access',
|
|
2332
|
+
if (_optionalChain([assetInfo, 'access', _64 => _64.name, 'optionalAccess', _65 => _65.endsWith, 'call', _66 => _66(".css")])) {
|
|
2315
2333
|
return "farm-client.css";
|
|
2316
2334
|
}
|
|
2317
2335
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -2347,7 +2365,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2347
2365
|
}
|
|
2348
2366
|
},
|
|
2349
2367
|
plugins: [
|
|
2350
|
-
|
|
2368
|
+
_chunkGA6JM4L6cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2351
2369
|
createFarmPrivateClientSourcemapsPlugin({
|
|
2352
2370
|
outDir: _path2.default.join(_path2.default.dirname(outputDir), FARM_CLIENT_SOURCEMAPS_DIR)
|
|
2353
2371
|
}),
|
|
@@ -2372,7 +2390,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2372
2390
|
...rendererVitePlugins,
|
|
2373
2391
|
...config.vite.plugins || [],
|
|
2374
2392
|
farmServerOnlyEntriesPlugin(),
|
|
2375
|
-
|
|
2393
|
+
_chunkGA6JM4L6cjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2376
2394
|
adapterOwnsDocsRuntime ? _chunkCY2ZQ5C6cjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2377
2395
|
),
|
|
2378
2396
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
@@ -2434,7 +2452,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2434
2452
|
} : void 0,
|
|
2435
2453
|
// Ensure React is bundled for client
|
|
2436
2454
|
resolve: {
|
|
2437
|
-
alias:
|
|
2455
|
+
alias: _chunkGA6JM4L6cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2438
2456
|
dedupe: [...config.renderer.dedupe || []]
|
|
2439
2457
|
},
|
|
2440
2458
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2447,7 +2465,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2447
2465
|
]
|
|
2448
2466
|
}
|
|
2449
2467
|
};
|
|
2450
|
-
await viteBuild(
|
|
2468
|
+
await viteBuild(_chunkGA6JM4L6cjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2451
2469
|
await mergeBuiltFontCss(outputDir);
|
|
2452
2470
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2453
2471
|
} finally {
|
|
@@ -2975,13 +2993,17 @@ function generateUniversalRouterStateProperties() {
|
|
|
2975
2993
|
|
|
2976
2994
|
clearPrefetchedPath: function(url) {
|
|
2977
2995
|
const interceptionPrefix = url + "\\nintercept:";
|
|
2996
|
+
const partialPrefix = url + "\\npartial:";
|
|
2997
|
+
const matches = function(key) {
|
|
2998
|
+
return key === url || key.startsWith(interceptionPrefix) || key.startsWith(partialPrefix);
|
|
2999
|
+
};
|
|
2978
3000
|
for (const key of this.prefetchCache.keys()) {
|
|
2979
|
-
if (key
|
|
3001
|
+
if (matches(key)) {
|
|
2980
3002
|
this.prefetchCache.delete(key);
|
|
2981
3003
|
}
|
|
2982
3004
|
}
|
|
2983
3005
|
for (const [key, pending] of this.pendingPrefetches) {
|
|
2984
|
-
if (key
|
|
3006
|
+
if (matches(key)) {
|
|
2985
3007
|
pending.valid = false;
|
|
2986
3008
|
this.pendingPrefetches.delete(key);
|
|
2987
3009
|
}
|
|
@@ -2995,9 +3017,18 @@ function generateUniversalRouterStateProperties() {
|
|
|
2995
3017
|
this.pendingPrefetches.clear();
|
|
2996
3018
|
},
|
|
2997
3019
|
|
|
2998
|
-
|
|
3020
|
+
// Islands mode: a partial response (layouts kept, or only the page's payload) suits the page
|
|
3021
|
+
// that asked for it, so the cache keys it by what that page told the server.
|
|
3022
|
+
prefetchRequest: function(url, interceptFrom, layoutChain = true) {
|
|
3023
|
+
const base = interceptFrom ? url + "\\nintercept:" + interceptFrom : url;
|
|
3024
|
+
const partial = layoutChain && this.partialNavigationHeaders ? this.partialNavigationHeaders() : {};
|
|
3025
|
+
const identity = Object.keys(partial).length ? JSON.stringify(partial) : "";
|
|
3026
|
+
return { cacheKey: identity ? base + "\\npartial:" + identity : base, headers: partial };
|
|
3027
|
+
},
|
|
3028
|
+
|
|
3029
|
+
fetchPrefetchedDocument: async function(url, interceptFrom, fresh, recover, signal, cacheResult = true, layoutChain = true) {
|
|
2999
3030
|
signal?.throwIfAborted();
|
|
3000
|
-
const cacheKey
|
|
3031
|
+
const { cacheKey, headers: partialHeaders } = this.prefetchRequest(url, interceptFrom, layoutChain);
|
|
3001
3032
|
if (fresh) this.clearPrefetchedPath(url);
|
|
3002
3033
|
const cached = fresh ? undefined : this.readFreshPrefetch(cacheKey);
|
|
3003
3034
|
if (cached !== undefined) return cached;
|
|
@@ -3029,6 +3060,10 @@ function generateUniversalRouterStateProperties() {
|
|
|
3029
3060
|
const response = await fetchFarmNavigationDocument(url, {
|
|
3030
3061
|
"Accept": "text/html",
|
|
3031
3062
|
...(interceptFrom ? { "X-Farm-Intercept-From": interceptFrom } : {}),
|
|
3063
|
+
// Islands mode: the server leaves out island values this browser holds, and the
|
|
3064
|
+
// layouts it shows.
|
|
3065
|
+
...getFarmIslandValueHeaders(),
|
|
3066
|
+
...partialHeaders,
|
|
3032
3067
|
}, recover, signal);
|
|
3033
3068
|
if (!response.ok) throw new Error("Failed to fetch page");
|
|
3034
3069
|
const html = await response.text();
|
|
@@ -3186,6 +3221,25 @@ function generateUniversalRouterStateProperties() {
|
|
|
3186
3221
|
`.trim();
|
|
3187
3222
|
}
|
|
3188
3223
|
_chunkS3JO3N4Hcjs.__name.call(void 0, generateUniversalRouterStateProperties, "generateUniversalRouterStateProperties");
|
|
3224
|
+
var FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME = `
|
|
3225
|
+
function getFarmLayoutKey(pattern, params) {
|
|
3226
|
+
return pattern.replace(/\\[\\[?\\.\\.\\.([^\\]]+)\\]?\\]|\\[([^\\]]+)\\]/g, function(match, rest, name) {
|
|
3227
|
+
const value = params ? params[rest || name] : undefined;
|
|
3228
|
+
if (Array.isArray(value)) return value.map(encodeURIComponent).join("/");
|
|
3229
|
+
return value === undefined ? "" : encodeURIComponent(String(value));
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
function countFarmKeptLayouts(request, layouts, params) {
|
|
3234
|
+
const chain = parseFarmLayoutChainHeader(request.headers.get("f-layouts"));
|
|
3235
|
+
if (chain.length === 0) return 0;
|
|
3236
|
+
const keys = layouts.map(function(layout) { return getFarmLayoutKey(layout.pattern, params); });
|
|
3237
|
+
if (chain[0] === keys[0]) return getSharedLayoutPrefixLength(chain, keys);
|
|
3238
|
+
// A root layout that renders the document itself leaves no boundary in the page, so the
|
|
3239
|
+
// browser's chain starts at the next layout.
|
|
3240
|
+
return keys.length > 1 ? 1 + getSharedLayoutPrefixLength(chain, keys.slice(1)) : 0;
|
|
3241
|
+
}
|
|
3242
|
+
`;
|
|
3189
3243
|
function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlots, root, srcDir, docsSearchEnabled, docsSearchModuleId, docsEntryPath, docsAdapterReact, i18nConfig = {
|
|
3190
3244
|
enabled: false,
|
|
3191
3245
|
basePath: "/",
|
|
@@ -3204,9 +3258,9 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3204
3258
|
secure: false
|
|
3205
3259
|
},
|
|
3206
3260
|
direction: {}
|
|
3207
|
-
}, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
3261
|
+
}, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
|
|
3208
3262
|
const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
|
|
3209
|
-
const clientPluginEntry =
|
|
3263
|
+
const clientPluginEntry = _chunkGA6JM4L6cjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3210
3264
|
plugins,
|
|
3211
3265
|
root,
|
|
3212
3266
|
srcDir,
|
|
@@ -3217,7 +3271,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3217
3271
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3218
3272
|
import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3219
3273
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3220
|
-
const providerClientCode =
|
|
3274
|
+
const providerClientCode = _chunkGA6JM4L6cjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3221
3275
|
integrationProviders,
|
|
3222
3276
|
root,
|
|
3223
3277
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3229,12 +3283,12 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
|
|
|
3229
3283
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
3230
3284
|
layoutRoutes.forEach((layout, index) => {
|
|
3231
3285
|
const relativePath = toImportPath(layout.modulePath);
|
|
3232
|
-
const rendersOnClient = !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some((pattern) =>
|
|
3286
|
+
const rendersOnClient = !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some((pattern) => _chunkT44ECMEPcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern));
|
|
3233
3287
|
if (rendersOnClient) {
|
|
3234
3288
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
3235
3289
|
}
|
|
3236
|
-
const groupScope =
|
|
3237
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
3290
|
+
const groupScope = _chunkXPSGGECFcjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
3291
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkXPSGGECFcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
3238
3292
|
layoutRegistrations.push(
|
|
3239
3293
|
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
|
|
3240
3294
|
);
|
|
@@ -3293,7 +3347,7 @@ function isFarmDocsPath() {
|
|
|
3293
3347
|
// Farm.js Client Runtime (no client components)
|
|
3294
3348
|
${cssImport}
|
|
3295
3349
|
${layoutImports}
|
|
3296
|
-
import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3350
|
+
import { createClientCancellation, createClientPluginManager, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3297
3351
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
3298
3352
|
${clientPluginEntry.imports}
|
|
3299
3353
|
${clientCachePersistence.imports}
|
|
@@ -3592,7 +3646,7 @@ document.addEventListener("click", function(e) {
|
|
|
3592
3646
|
});
|
|
3593
3647
|
const isolatedHydrationEnabled = isolatedBoundaryModules.size > 0;
|
|
3594
3648
|
const serverTreeEnabled = isolatedHydrationEnabled && clientPages.some((page) => page.serverTree);
|
|
3595
|
-
const isolatedHydrationImport = isolatedHydrationEnabled ?
|
|
3649
|
+
const isolatedHydrationImport = isolatedHydrationEnabled ? `${islandValues ? 'import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement } from "@farm.js/core/internal/islands-runtime";' : 'import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";'}${serverTreeEnabled && !islandValues ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
|
|
3596
3650
|
const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedBoundaryLoaders = {
|
|
3597
3651
|
${Array.from(isolatedBoundaryModules.entries()).map(
|
|
3598
3652
|
([reference, modulePath]) => ` ${JSON.stringify(reference)}: () => import(${JSON.stringify(modulePath)}),`
|
|
@@ -3658,7 +3712,7 @@ ${layoutImports}
|
|
|
3658
3712
|
${rendererClientImports}
|
|
3659
3713
|
${isolatedHydrationImport}
|
|
3660
3714
|
${providerClientCode.imports}
|
|
3661
|
-
import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3715
|
+
import { createClientCancellation, createClientPluginManager, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3662
3716
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
3663
3717
|
import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
3664
3718
|
${clientPluginEntry.imports}
|
|
@@ -3737,7 +3791,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3737
3791
|
});
|
|
3738
3792
|
}
|
|
3739
3793
|
|
|
3740
|
-
${
|
|
3794
|
+
${_chunkGA6JM4L6cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
3741
3795
|
// Wrap a page element with applicable layouts
|
|
3742
3796
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
3743
3797
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -3835,6 +3889,10 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, serv
|
|
|
3835
3889
|
const serverPage = document.getElementById("__farm_page__");
|
|
3836
3890
|
const pageSource = typeof serverHtml === "string" ? serverHtml : serverPage;
|
|
3837
3891
|
const serverTree = pageSource ? await createFarmServerTreePageElement(pageSource, pathname) : null;
|
|
3892
|
+
// A payload-only page (islands mode) has no HTML to fall back to: fetch the whole document.
|
|
3893
|
+
if (!serverTree && typeof serverHtml === "string" && serverHtml.includes('<script type="f/tree" partial')) {
|
|
3894
|
+
return null;
|
|
3895
|
+
}
|
|
3838
3896
|
pageElement = serverTree
|
|
3839
3897
|
? createLayoutPageBoundary(matched.route, serverTree)
|
|
3840
3898
|
: createLayoutPageBoundary(
|
|
@@ -4162,7 +4220,7 @@ async function hydrate() {
|
|
|
4162
4220
|
});
|
|
4163
4221
|
${isolatedHydrationEnabled ? `const isolatedHydration =
|
|
4164
4222
|
!hasHydratableLayout(pathname) &&
|
|
4165
|
-
document.querySelector('
|
|
4223
|
+
document.querySelector('f-island[src]')
|
|
4166
4224
|
? hydrateFarmIsolatedClientBoundaries(document, hydrationController.signal)
|
|
4167
4225
|
: Promise.resolve();
|
|
4168
4226
|
await Promise.all([pageHydration, isolatedHydration]);` : "await pageHydration;"}
|
|
@@ -4173,20 +4231,41 @@ async function hydrate() {
|
|
|
4173
4231
|
}
|
|
4174
4232
|
}
|
|
4175
4233
|
|
|
4234
|
+
// A layout boundary is the same layout when its key matches: islands mode keys it by pattern and
|
|
4235
|
+
// params, so a layout whose params change renders again. Other modes compare patterns.
|
|
4236
|
+
function getLayoutIdentity(boundary) {
|
|
4237
|
+
return boundary.getAttribute("data-farm-layout-key") || boundary.getAttribute("data-farm-layout-pattern");
|
|
4238
|
+
}
|
|
4239
|
+
|
|
4176
4240
|
function findLayoutBoundary(root, pattern) {
|
|
4177
4241
|
const boundaries = root?.querySelectorAll?.('[data-farm-layout-boundary="true"]') || [];
|
|
4178
4242
|
for (const boundary of boundaries) {
|
|
4179
|
-
if (boundary
|
|
4243
|
+
if (getLayoutIdentity(boundary) === pattern) return boundary;
|
|
4180
4244
|
}
|
|
4181
4245
|
return null;
|
|
4182
4246
|
}
|
|
4183
4247
|
|
|
4184
4248
|
function getLayoutPatterns(root) {
|
|
4185
4249
|
return Array.from(root?.querySelectorAll?.('[data-farm-layout-boundary="true"]') || [])
|
|
4186
|
-
.map(
|
|
4250
|
+
.map(getLayoutIdentity)
|
|
4187
4251
|
.filter(Boolean);
|
|
4188
4252
|
}
|
|
4189
4253
|
|
|
4254
|
+
${islandValues ? `// A segment response leaves out the layouts the browser said it shows. It fits this page only if
|
|
4255
|
+
// the page still shows each of them, at the same depth.
|
|
4256
|
+
function fitsSegmentResponse(currentRoot, nextRoot) {
|
|
4257
|
+
const nextBoundaries = Array.from(nextRoot.querySelectorAll('[data-farm-layout-boundary="true"]'));
|
|
4258
|
+
const lastKept = nextBoundaries.map(function(boundary) {
|
|
4259
|
+
return boundary.getAttribute("data-farm-layout-kept") === "true";
|
|
4260
|
+
}).lastIndexOf(true);
|
|
4261
|
+
if (lastKept === -1) return true;
|
|
4262
|
+
const current = getLayoutPatterns(currentRoot);
|
|
4263
|
+
for (let index = 0; index <= lastKept; index++) {
|
|
4264
|
+
if (current[index] !== getLayoutIdentity(nextBoundaries[index])) return false;
|
|
4265
|
+
}
|
|
4266
|
+
return true;
|
|
4267
|
+
}` : ""}
|
|
4268
|
+
|
|
4190
4269
|
function activateNavigationScripts(root) {
|
|
4191
4270
|
for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
|
|
4192
4271
|
const freshScript = document.createElement("script");
|
|
@@ -4198,7 +4277,7 @@ function activateNavigationScripts(root) {
|
|
|
4198
4277
|
}
|
|
4199
4278
|
}
|
|
4200
4279
|
|
|
4201
|
-
function replaceSharedLayoutBoundary(currentRoot, nextRoot) {
|
|
4280
|
+
function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
4202
4281
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
4203
4282
|
const nextPatterns = getLayoutPatterns(nextRoot);
|
|
4204
4283
|
let sharedCount = 0;
|
|
@@ -4219,7 +4298,9 @@ function replaceSharedLayoutBoundary(currentRoot, nextRoot) {
|
|
|
4219
4298
|
: nextRoot.querySelector("#__farm_page__");
|
|
4220
4299
|
|
|
4221
4300
|
if (!currentTarget || !nextTarget) return false;
|
|
4222
|
-
${isolatedHydrationEnabled ?
|
|
4301
|
+
${isolatedHydrationEnabled ? `${islandValues ? `// A refresh keeps the islands still on the page, with their state and new props.
|
|
4302
|
+
if (refresh) farmIsolatedHydrationRuntime.carryOver(currentTarget, nextTarget);
|
|
4303
|
+
` : ""}disposeFarmIsolatedClientBoundaries(currentTarget);` : ""}
|
|
4223
4304
|
currentTarget.replaceWith(nextTarget);
|
|
4224
4305
|
activateNavigationScripts(nextTarget);
|
|
4225
4306
|
if (nextTreeRoot && nextTreeRoot !== nextTarget) nextTreeRoot.remove();
|
|
@@ -4240,7 +4321,17 @@ function replaceSharedLayoutBoundary(currentRoot, nextRoot) {
|
|
|
4240
4321
|
const spaRouter = {
|
|
4241
4322
|
${generateUniversalRouterStateProperties()}
|
|
4242
4323
|
prefetchCache: new Map(),
|
|
4243
|
-
|
|
4324
|
+
${islandValues ? ` // Islands mode: navigations name the layouts on screen, and say when this page renders the
|
|
4325
|
+
// next one in its own React root; the server leaves out what the browser keeps or rebuilds.
|
|
4326
|
+
partialNavigationHeaders: function() {
|
|
4327
|
+
const root = document.getElementById("root") || document.body;
|
|
4328
|
+
const layouts = getLayoutPatterns(root);
|
|
4329
|
+
return {
|
|
4330
|
+
...(layouts.length ? { "F-Layouts": JSON.stringify(layouts) } : {}),
|
|
4331
|
+
...(reactRoot && reactRootContainer === root ? { "F-Render": "tree" } : {}),
|
|
4332
|
+
};
|
|
4333
|
+
},
|
|
4334
|
+
` : ""}
|
|
4244
4335
|
navigate: async function(href, options = {}) {
|
|
4245
4336
|
const url = new URL(href, window.location.href);
|
|
4246
4337
|
if (isFarmBlockedNavigationURL(url)) return;
|
|
@@ -4295,6 +4386,8 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4295
4386
|
cancelPendingPageHydration();
|
|
4296
4387
|
this.saveScrollPosition(window.location.pathname + window.location.search);
|
|
4297
4388
|
const navigation = this.startNavigation(from, url, action);
|
|
4389
|
+
// A refresh keeps the islands still on the page (islands mode).
|
|
4390
|
+
navigation.refresh = options.refresh === true;
|
|
4298
4391
|
let clientNavigation;
|
|
4299
4392
|
|
|
4300
4393
|
try {
|
|
@@ -4397,26 +4490,48 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4397
4490
|
this.currentPath = to;
|
|
4398
4491
|
});
|
|
4399
4492
|
} else {
|
|
4493
|
+
// A refresh renders every layout again; other navigations keep the ones on screen.
|
|
4400
4494
|
const html = await this.fetchPage(
|
|
4401
4495
|
url.pathname + url.search,
|
|
4402
4496
|
undefined,
|
|
4403
4497
|
options.refresh === true,
|
|
4404
4498
|
true,
|
|
4405
4499
|
navigation.controller.signal,
|
|
4500
|
+
options.refresh !== true,
|
|
4406
4501
|
);
|
|
4407
4502
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4408
4503
|
await farmClientRuntime.markNavigationLoaded(clientNavigation, html);
|
|
4409
4504
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4410
4505
|
await this.runViewTransition(options.viewTransition, async () => {
|
|
4411
4506
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4412
|
-
|
|
4507
|
+
let swapped = await this.swapContent(
|
|
4413
4508
|
html,
|
|
4414
4509
|
url.pathname + url.search,
|
|
4415
4510
|
navigation,
|
|
4416
4511
|
clientNavigation,
|
|
4417
4512
|
);
|
|
4418
4513
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4419
|
-
if (
|
|
4514
|
+
if (swapped === "segment-mismatch") {
|
|
4515
|
+
// The page changed since this segment was requested (a prefetch, a later
|
|
4516
|
+
// navigation): fetch the whole document instead.
|
|
4517
|
+
const documentHtml = await this.fetchPage(
|
|
4518
|
+
url.pathname + url.search,
|
|
4519
|
+
undefined,
|
|
4520
|
+
true,
|
|
4521
|
+
true,
|
|
4522
|
+
navigation.controller.signal,
|
|
4523
|
+
false,
|
|
4524
|
+
);
|
|
4525
|
+
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4526
|
+
swapped = await this.swapContent(
|
|
4527
|
+
documentHtml,
|
|
4528
|
+
url.pathname + url.search,
|
|
4529
|
+
navigation,
|
|
4530
|
+
clientNavigation,
|
|
4531
|
+
);
|
|
4532
|
+
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4533
|
+
}
|
|
4534
|
+
if (!swapped || swapped === "segment-mismatch") {
|
|
4420
4535
|
throw new Error("Farm could not swap the target document");
|
|
4421
4536
|
}
|
|
4422
4537
|
this.writeHistoryEntry(action, url.pathname + url.search, options.state, url);
|
|
@@ -4466,8 +4581,8 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4466
4581
|
});
|
|
4467
4582
|
},
|
|
4468
4583
|
|
|
4469
|
-
fetchPage: async function(url, interceptFrom, fresh = false, recover = true, signal) {
|
|
4470
|
-
return this.fetchPrefetchedDocument(url, interceptFrom, fresh, recover, signal);
|
|
4584
|
+
fetchPage: async function(url, interceptFrom, fresh = false, recover = true, signal, layoutChain = true) {
|
|
4585
|
+
return this.fetchPrefetchedDocument(url, interceptFrom, fresh, recover, signal, true, layoutChain);
|
|
4471
4586
|
},
|
|
4472
4587
|
|
|
4473
4588
|
swapContent: async function(html, targetPath, navigation, clientNavigation) {
|
|
@@ -4488,6 +4603,14 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4488
4603
|
// whole document (and remounting every isolated client boundary).
|
|
4489
4604
|
const newRoot = doc.getElementById("root") || doc.body;
|
|
4490
4605
|
const currentRoot = document.getElementById("root") || document.body;
|
|
4606
|
+
${islandValues ? `const isSegment = Boolean(newRoot?.querySelector('[data-farm-layout-kept="true"]'));
|
|
4607
|
+
// A segment needs this page's kept layouts in place, outside a React-owned root.
|
|
4608
|
+
if (
|
|
4609
|
+
isSegment &&
|
|
4610
|
+
(!currentRoot || reactRootContainer === currentRoot || !fitsSegmentResponse(currentRoot, newRoot))
|
|
4611
|
+
) {
|
|
4612
|
+
return "segment-mismatch";
|
|
4613
|
+
}` : ""}
|
|
4491
4614
|
if (!newRoot || !currentRoot) {
|
|
4492
4615
|
if (!isNavigationCurrent()) return false;
|
|
4493
4616
|
return this.swapDocument(doc);
|
|
@@ -4518,13 +4641,16 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4518
4641
|
}
|
|
4519
4642
|
}
|
|
4520
4643
|
|
|
4644
|
+
${islandValues ? `// A payload-only page renders only in a React root that rebuilds it.
|
|
4645
|
+
if (nextPage?.querySelector('script[type="f/tree"][partial]')) return "segment-mismatch";` : ""}
|
|
4521
4646
|
const rootWasReactOwned = reactRootContainer === currentRoot;
|
|
4522
4647
|
resetReactRoot();
|
|
4523
4648
|
resetRouteSlotRoots();
|
|
4524
4649
|
const replacedSharedBoundary = rootWasReactOwned
|
|
4525
4650
|
? null
|
|
4526
|
-
: replaceSharedLayoutBoundary(currentRoot, newRoot);
|
|
4651
|
+
: replaceSharedLayoutBoundary(currentRoot, newRoot, navigation?.refresh === true);
|
|
4527
4652
|
let isolatedHydrationScope = replacedSharedBoundary || currentRoot;
|
|
4653
|
+
${islandValues ? 'if (!replacedSharedBoundary && isSegment) return "segment-mismatch";' : ""}
|
|
4528
4654
|
if (!replacedSharedBoundary) {
|
|
4529
4655
|
${isolatedHydrationEnabled ? "disposeFarmIsolatedClientBoundaries(currentRoot);" : ""}
|
|
4530
4656
|
currentRoot.innerHTML = newRoot.innerHTML;
|
|
@@ -4607,7 +4733,7 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4607
4733
|
// navigation (double fetch per prefetched link) and sent
|
|
4608
4734
|
// X-Farm-Intercept-From, which bypasses the shared cache server-side.
|
|
4609
4735
|
const pathname = url.pathname + url.search;
|
|
4610
|
-
if (this.readFreshPrefetch(pathname) !== undefined) return;
|
|
4736
|
+
if (this.readFreshPrefetch(this.prefetchRequest(pathname).cacheKey) !== undefined) return;
|
|
4611
4737
|
|
|
4612
4738
|
return this.fetchPage(pathname, undefined, false, false)
|
|
4613
4739
|
.catch(function(error) {
|
|
@@ -4716,7 +4842,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4716
4842
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
4717
4843
|
"module.exports = { plugins: [] };\n"
|
|
4718
4844
|
);
|
|
4719
|
-
tailwindVitePlugin = await
|
|
4845
|
+
tailwindVitePlugin = await _chunkLRJRXXQZcjs.loadTailwindVitePlugin.call(void 0, {
|
|
4720
4846
|
builder: productionVite.builder,
|
|
4721
4847
|
label: "for SSR"
|
|
4722
4848
|
});
|
|
@@ -4812,7 +4938,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4812
4938
|
}
|
|
4813
4939
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
4814
4940
|
const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
4815
|
-
const notFoundPath =
|
|
4941
|
+
const notFoundPath = _chunkGA6JM4L6cjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
4816
4942
|
if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
4817
4943
|
layoutRoutes.sort((a, b) => {
|
|
4818
4944
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -4829,13 +4955,13 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4829
4955
|
const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
|
|
4830
4956
|
(integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
|
|
4831
4957
|
);
|
|
4832
|
-
const hasIntegrationProviders =
|
|
4958
|
+
const hasIntegrationProviders = _chunkB6XAA7V6cjs.getIntegrationProviders.call(void 0, config.integrations).some(
|
|
4833
4959
|
(provider) => provider.component || provider.type === "clerk"
|
|
4834
4960
|
);
|
|
4835
4961
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
4836
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
4837
|
-
const hasMiddlewareConfig =
|
|
4838
|
-
const hasRouteContextConfig =
|
|
4962
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _67 => _67.mdx, 'optionalAccess', _68 => _68.components]));
|
|
4963
|
+
const hasMiddlewareConfig = _chunkXPSGGECFcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
4964
|
+
const hasRouteContextConfig = _chunkLPE3ED4Rcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
4839
4965
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
4840
4966
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
4841
4967
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -4845,18 +4971,18 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4845
4971
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
4846
4972
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
4847
4973
|
);
|
|
4848
|
-
if (
|
|
4974
|
+
if (_chunkYN2QEMMOcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
4849
4975
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
4850
|
-
|
|
4976
|
+
_chunkYN2QEMMOcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
4851
4977
|
config.docs,
|
|
4852
4978
|
{ root, srcDir: config.srcDir },
|
|
4853
4979
|
(pathname) => adapterGuardedPaths.has(pathname)
|
|
4854
4980
|
);
|
|
4855
4981
|
}
|
|
4856
4982
|
const farmDocsCspNonceMarker = _chunk25LPIZSXcjs.createFarmCspNonce.call(void 0, config.security);
|
|
4857
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
4983
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _69 => _69.docs, 'optionalAccess', _70 => _70.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkZTP3BJG6cjs._runWithFarmCspNonce.call(void 0,
|
|
4858
4984
|
farmDocsCspNonceMarker,
|
|
4859
|
-
async () => _optionalChain([config, 'access',
|
|
4985
|
+
async () => _optionalChain([config, 'access', _71 => _71.docs, 'access', _72 => _72.adapter, 'optionalAccess', _73 => _73.server]) ? await _chunkYN2QEMMOcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
4860
4986
|
root,
|
|
4861
4987
|
srcDir: config.srcDir,
|
|
4862
4988
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -4965,7 +5091,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4965
5091
|
// Adapters can render provider scripts by serializing function source.
|
|
4966
5092
|
// keepNames injects helper calls into those functions; after Nitro
|
|
4967
5093
|
// minifies the server chunk the helper is no longer in script scope.
|
|
4968
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
5094
|
+
keepNames: !(_optionalChain([config, 'access', _74 => _74.docs, 'optionalAccess', _75 => _75.enabled]) && _optionalChain([config, 'access', _76 => _76.docs, 'access', _77 => _77.adapter, 'optionalAccess', _78 => _78.server])),
|
|
4969
5095
|
jsxDev: false
|
|
4970
5096
|
},
|
|
4971
5097
|
// SSR configuration to externalize problematic modules
|
|
@@ -5015,10 +5141,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5015
5141
|
define: {
|
|
5016
5142
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
5017
5143
|
__FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
|
|
5018
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
5144
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _79 => _79.env, 'optionalAccess', _80 => _80.public]) || {})
|
|
5019
5145
|
},
|
|
5020
5146
|
plugins: [
|
|
5021
|
-
|
|
5147
|
+
_chunkGA6JM4L6cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
5022
5148
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
5023
5149
|
...rendererVitePlugins,
|
|
5024
5150
|
...config.vite.plugins || [],
|
|
@@ -5071,7 +5197,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5071
5197
|
resolve: {
|
|
5072
5198
|
alias: [
|
|
5073
5199
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
5074
|
-
...Object.entries(
|
|
5200
|
+
...Object.entries(_chunkGA6JM4L6cjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
5075
5201
|
([find, replacement]) => ({ find, replacement })
|
|
5076
5202
|
)
|
|
5077
5203
|
],
|
|
@@ -5079,7 +5205,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5079
5205
|
dedupe: [...config.renderer.dedupe || []]
|
|
5080
5206
|
}
|
|
5081
5207
|
};
|
|
5082
|
-
await viteBuild(
|
|
5208
|
+
await viteBuild(_chunkGA6JM4L6cjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
5083
5209
|
} finally {
|
|
5084
5210
|
if (postcssConfigDir) {
|
|
5085
5211
|
try {
|
|
@@ -5118,7 +5244,7 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
5118
5244
|
}
|
|
5119
5245
|
_chunkS3JO3N4Hcjs.__name.call(void 0, readFarmPageLastModified, "readFarmPageLastModified");
|
|
5120
5246
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
5121
|
-
if (!_optionalChain([config, 'access',
|
|
5247
|
+
if (!_optionalChain([config, 'access', _81 => _81.docs, 'optionalAccess', _82 => _82.enabled])) return [];
|
|
5122
5248
|
const contentDir = _chunkMY5PZYADcjs.resolveFarmDocsContentDir.call(void 0, config.docs, {
|
|
5123
5249
|
root: config.root,
|
|
5124
5250
|
srcDir: config.srcDir
|
|
@@ -5127,19 +5253,19 @@ function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
|
5127
5253
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
5128
5254
|
middlewareRoutes
|
|
5129
5255
|
};
|
|
5130
|
-
return _chunkMY5PZYADcjs.discoverFarmDocsPages.call(void 0, contentDir, config.docs).flatMap((page) => [page.href, _chunkMY5PZYADcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) =>
|
|
5256
|
+
return _chunkMY5PZYADcjs.discoverFarmDocsPages.call(void 0, contentDir, config.docs).flatMap((page) => [page.href, _chunkMY5PZYADcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkXPSGGECFcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
5131
5257
|
}
|
|
5132
5258
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmDocsGuardedPaths, "getFarmDocsGuardedPaths");
|
|
5133
5259
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
5134
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
5260
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _83 => _83.llmsTxt]);
|
|
5135
5261
|
const ownedByFile = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (kind) => applicationMetadataRoutes.some(
|
|
5136
5262
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
5137
5263
|
), "ownedByFile");
|
|
5138
5264
|
return [
|
|
5139
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5140
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5141
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5142
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5265
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _84 => _84.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
5266
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _85 => _85.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
5267
|
+
..._optionalChain([agent, 'optionalAccess', _86 => _86.sitemap, 'optionalAccess', _87 => _87.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
5268
|
+
..._optionalChain([agent, 'optionalAccess', _88 => _88.crawlers, 'optionalAccess', _89 => _89.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
5143
5269
|
];
|
|
5144
5270
|
}
|
|
5145
5271
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmAppOwnedDocsEnginePaths, "getFarmAppOwnedDocsEnginePaths");
|
|
@@ -5181,7 +5307,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
5181
5307
|
}
|
|
5182
5308
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toVirtualEntryImportSpecifier, "toVirtualEntryImportSpecifier");
|
|
5183
5309
|
function generateNativeAuthIntegrationSource(auth) {
|
|
5184
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
5310
|
+
if (_optionalChain([auth, 'optionalAccess', _90 => _90.enabled]) !== true) {
|
|
5185
5311
|
return { importSource: "", registerSource: "" };
|
|
5186
5312
|
}
|
|
5187
5313
|
return {
|
|
@@ -5479,20 +5605,21 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
|
5479
5605
|
}
|
|
5480
5606
|
_chunkS3JO3N4Hcjs.__name.call(void 0, generateFarmRendererAppSetupServerCode, "generateFarmRendererAppSetupServerCode");
|
|
5481
5607
|
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) {
|
|
5608
|
+
const farmIslandsMode = _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _91 => _91.experimental, 'optionalAccess', _92 => _92.serverComponents])) === "islands";
|
|
5482
5609
|
const hasCompressionRuntime = config.compress && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5483
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
5610
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _93 => _93.agent, 'optionalAccess', _94 => _94.crawlers, 'optionalAccess', _95 => _95.enabled])) && !applicationMetadataRoutes.some(
|
|
5484
5611
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
5485
5612
|
);
|
|
5486
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
5613
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _96 => _96.agent, 'optionalAccess', _97 => _97.sitemap, 'optionalAccess', _98 => _98.enabled])) && !applicationMetadataRoutes.some(
|
|
5487
5614
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
5488
5615
|
);
|
|
5489
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
5490
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
5616
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _99 => _99.agent, 'optionalAccess', _100 => _100.mcp]) === true && !_chunkBMOBTMDRcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
5617
|
+
const servesAiCatalog = _optionalChain([config, 'access', _101 => _101.agent, 'optionalAccess', _102 => _102.aiCatalog]) !== false;
|
|
5491
5618
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
5492
5619
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5493
5620
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
5494
5621
|
const adapterOwnsDocsRuntime = Boolean(
|
|
5495
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
5622
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _103 => _103.docs, 'optionalAccess', _104 => _104.enabled]) && _optionalChain([config, 'access', _105 => _105.docs, 'access', _106 => _106.adapter, 'optionalAccess', _107 => _107.server]) && config.docs.adapter.react
|
|
5496
5623
|
);
|
|
5497
5624
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
5498
5625
|
const hasIsolatedClientGraphRuntime = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
@@ -5502,7 +5629,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
5502
5629
|
);
|
|
5503
5630
|
const hasReactSyncRender = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer);
|
|
5504
5631
|
const rendererServerImports = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
5505
|
-
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
|
|
5632
|
+
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? farmIslandsMode ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph, renderFarmServerTreePage } 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";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
|
|
5506
5633
|
const routeClientGraphServerRuntime = hasIsolatedClientGraphRuntime ? `function wrapFarmRouteClientGraph(element) {
|
|
5507
5634
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
5508
5635
|
}
|
|
@@ -5515,19 +5642,22 @@ function isolateFarmRouteServerPage(element) {
|
|
|
5515
5642
|
|
|
5516
5643
|
// An async page below a hydrating layout renders as a serialized tree the browser rebuilds in
|
|
5517
5644
|
// the layout's React root, so its client components read the layout's context.
|
|
5518
|
-
function renderFarmRouteServerTree(element) {
|
|
5519
|
-
return renderFarmServerTreePage(React, element, {
|
|
5645
|
+
function renderFarmRouteServerTree(element, extra) {
|
|
5646
|
+
return renderFarmServerTreePage(React, element, {
|
|
5647
|
+
isolate: isolateFarmRouteServerPage,${farmIslandsMode ? "\n values: true," : ""}
|
|
5648
|
+
...extra,
|
|
5649
|
+
});
|
|
5520
5650
|
}` : `function wrapFarmRouteClientGraph(element) { return element; }
|
|
5521
5651
|
|
|
5522
5652
|
function isolateFarmRouteServerPage(element) { return element; }
|
|
5523
5653
|
|
|
5524
|
-
function renderFarmRouteServerTree(element) { return element; }`;
|
|
5654
|
+
function renderFarmRouteServerTree(element, extra) { return element; }`;
|
|
5525
5655
|
const hasGeneratedMetadataImages = metadataImageRoutes.some(
|
|
5526
5656
|
(image) => image.sourceType === "module"
|
|
5527
5657
|
);
|
|
5528
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 ||
|
|
5529
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
5530
|
-
const integrationProviders =
|
|
5658
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkXPSGGECFcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5659
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
5660
|
+
const integrationProviders = _chunkB6XAA7V6cjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
5531
5661
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
5532
5662
|
(provider) => provider.component || provider.type === "clerk"
|
|
5533
5663
|
);
|
|
@@ -5536,16 +5666,16 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5536
5666
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
5537
5667
|
);
|
|
5538
5668
|
}
|
|
5539
|
-
const providerServerModules =
|
|
5669
|
+
const providerServerModules = _chunkGA6JM4L6cjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
5540
5670
|
renderedIntegrationProviders,
|
|
5541
5671
|
config.root,
|
|
5542
5672
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
5543
5673
|
);
|
|
5544
5674
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
5545
5675
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
5546
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
5676
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _110 => _110.providers]);
|
|
5547
5677
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
5548
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
5678
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _111 => _111.component]) === "function")) {
|
|
5549
5679
|
throw new Error(
|
|
5550
5680
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
5551
5681
|
);
|
|
@@ -5556,17 +5686,21 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5556
5686
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
5557
5687
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
5558
5688
|
);
|
|
5559
|
-
const isolatedHydrationMode =
|
|
5560
|
-
_optionalChain([config, 'access',
|
|
5689
|
+
const isolatedHydrationMode = _chunkGA6JM4L6cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
5690
|
+
_optionalChain([config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.isolatedClientHydration]),
|
|
5561
5691
|
{
|
|
5562
|
-
serverComponents: _optionalChain([config, 'access',
|
|
5692
|
+
serverComponents: _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _114 => _114.experimental, 'optionalAccess', _115 => _115.serverComponents])) === "rsc",
|
|
5563
5693
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
5564
5694
|
}
|
|
5565
5695
|
);
|
|
5566
|
-
const hydrationPlanOptions =
|
|
5696
|
+
const hydrationPlanOptions = _chunkGA6JM4L6cjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
5567
5697
|
config.renderer,
|
|
5568
5698
|
Boolean(unsupportedIntegrationProvider)
|
|
5569
5699
|
);
|
|
5700
|
+
const pageHydrationPlanOptions = {
|
|
5701
|
+
...hydrationPlanOptions,
|
|
5702
|
+
serverOwners: _chunkPDU4P2ICcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _116 => _116.experimental, 'optionalAccess', _117 => _117.serverComponents])) === "islands"
|
|
5703
|
+
};
|
|
5570
5704
|
const layoutHydrationPlans = layoutRoutes.map((layout) => ({
|
|
5571
5705
|
...layout,
|
|
5572
5706
|
hydration: getCachedClientModuleHydrationPlan(
|
|
@@ -5577,7 +5711,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5577
5711
|
hydrationPlanOptions
|
|
5578
5712
|
)
|
|
5579
5713
|
}));
|
|
5580
|
-
const markdownPagePlan =
|
|
5714
|
+
const markdownPagePlan = _chunkGA6JM4L6cjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
5581
5715
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
5582
5716
|
config.root,
|
|
5583
5717
|
isolatedHydrationMode,
|
|
@@ -5591,11 +5725,11 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5591
5725
|
config.root,
|
|
5592
5726
|
isolatedHydrationMode,
|
|
5593
5727
|
hydrationPlanCache,
|
|
5594
|
-
|
|
5728
|
+
pageHydrationPlanOptions
|
|
5595
5729
|
)
|
|
5596
5730
|
])
|
|
5597
5731
|
);
|
|
5598
|
-
|
|
5732
|
+
_chunkGA6JM4L6cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
5599
5733
|
layoutHydrationPlans.map((layout) => ({
|
|
5600
5734
|
pattern: layout.pattern,
|
|
5601
5735
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -5604,10 +5738,10 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5604
5738
|
pageRoutes.map((route) => ({
|
|
5605
5739
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
5606
5740
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
5607
|
-
depth:
|
|
5741
|
+
depth: _chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
5608
5742
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
5609
5743
|
})),
|
|
5610
|
-
|
|
5744
|
+
_chunkXPSGGECFcjs.routeBoundaryCoversDirectory
|
|
5611
5745
|
);
|
|
5612
5746
|
const providerServerImports = [
|
|
5613
5747
|
providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
|
|
@@ -5624,7 +5758,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5624
5758
|
apiRegistrations.push(`
|
|
5625
5759
|
{
|
|
5626
5760
|
path: ${JSON.stringify(route.path)},
|
|
5627
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
5761
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _118 => _118.pluginMethods, 'optionalAccess', _119 => _119.includes, 'call', _120 => _120(method)])))},
|
|
5628
5762
|
endpoints: ${varName},
|
|
5629
5763
|
}`);
|
|
5630
5764
|
});
|
|
@@ -5661,7 +5795,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5661
5795
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
5662
5796
|
);
|
|
5663
5797
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
5664
|
-
const renderingDirective =
|
|
5798
|
+
const renderingDirective = _chunk3XEMGDBFcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
5665
5799
|
pageRegistrations.push(`
|
|
5666
5800
|
{
|
|
5667
5801
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -5669,7 +5803,7 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5669
5803
|
module: ${varName},
|
|
5670
5804
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
5671
5805
|
clientModule: ${JSON.stringify(_chunk5QIKR7RRcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
5672
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
5806
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkGA6JM4L6cjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
|
|
5673
5807
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
5674
5808
|
${route.source !== void 0 ? `markdownSource: {
|
|
5675
5809
|
source: ${JSON.stringify(route.source)},
|
|
@@ -5726,12 +5860,12 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5726
5860
|
errorImports.push(
|
|
5727
5861
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
5728
5862
|
);
|
|
5729
|
-
const groupScope =
|
|
5863
|
+
const groupScope = _chunkXPSGGECFcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
5730
5864
|
errorRegistrations.push(`
|
|
5731
5865
|
{
|
|
5732
|
-
pattern: ${JSON.stringify(
|
|
5866
|
+
pattern: ${JSON.stringify(_chunkXPSGGECFcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
5733
5867
|
groupScope: ${JSON.stringify(groupScope)},
|
|
5734
|
-
directoryDepth: ${
|
|
5868
|
+
directoryDepth: ${_chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
5735
5869
|
module: ${varName},
|
|
5736
5870
|
}`);
|
|
5737
5871
|
});
|
|
@@ -5877,32 +6011,39 @@ function renderFarmRouteServerTree(element) { return element; }`;
|
|
|
5877
6011
|
withFarmRouteContext,
|
|
5878
6012
|
createLateNotFoundRecovery,
|
|
5879
6013
|
createLateRedirectRecovery,${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
|
|
5880
|
-
} from "@farm.js/core/internal/production-runtime"
|
|
6014
|
+
} from "@farm.js/core/internal/production-runtime";${farmIslandsMode ? `
|
|
6015
|
+
import { getSharedLayoutPrefixLength, handleFarmFormActionRequest, ignoreFarmHeldValues, installFarmIslandValues, parseFarmLayoutChainHeader } from "@farm.js/core/internal/production-runtime";
|
|
6016
|
+
import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server";
|
|
6017
|
+
installFarmIslandsServer();
|
|
6018
|
+
const farmFormActionsConfig = ${JSON.stringify(_chunkP4TYB4SFcjs.resolveServerActionsConfig.call(void 0, config.serverActions))};
|
|
6019
|
+
installFarmIslandValues();
|
|
6020
|
+
${islandsActionKeyCode()}
|
|
6021
|
+
${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : ""}`;
|
|
5881
6022
|
const productionSiteTelemetryImport = config.telemetry ? `import { createFarmProductionSiteReporter } from "@farm.js/core/internal/product-telemetry-runtime";` : "";
|
|
5882
6023
|
const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse } from "@farm.js/core/internal/metadata-image-runtime";` : "";
|
|
5883
6024
|
const pluginRuntimeImport = hasPluginRuntime ? `import { PluginManager } from "@farm.js/core/plugin";` : "";
|
|
5884
6025
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
5885
6026
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
5886
6027
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
5887
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
6028
|
+
const docsHandlerImport = _optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
5888
6029
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
5889
6030
|
const pathname = typeof requestOrPathname === "string"
|
|
5890
6031
|
? requestOrPathname
|
|
5891
6032
|
: new URL(requestOrPathname.url).pathname;
|
|
5892
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
6033
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _123 => _123.apiPath]) || "/api/docs")};
|
|
5893
6034
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
5894
6035
|
};` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
5895
6036
|
import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
|
|
5896
6037
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
5897
6038
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
5898
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
5899
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
6039
|
+
const docsFontImport = _optionalChain([config, 'access', _124 => _124.docs, 'optionalAccess', _125 => _125.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
6040
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _126 => _126.docs, 'optionalAccess', _127 => _127.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
5900
6041
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
5901
6042
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
5902
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
6043
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _128 => _128.md, 'optionalAccess', _129 => _129.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
5903
6044
|
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;";
|
|
5904
6045
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
5905
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
6046
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _130 => _130.mdx, 'optionalAccess', _131 => _131.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
5906
6047
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
5907
6048
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
5908
6049
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -5920,7 +6061,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
5920
6061
|
const integrationRuntimeImport = integrationRuntimeExports.length ? `import { ${integrationRuntimeExports.join(", ")} } from "@farm.js/core/integrations";` : "";
|
|
5921
6062
|
const instrumentationImport = instrumentationPath ? `import * as FarmInstrumentationModule from ${toVirtualEntryImportSpecifier(instrumentationPath)};` : "";
|
|
5922
6063
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
5923
|
-
const nativeMCP =
|
|
6064
|
+
const nativeMCP = _chunkT44ECMEPcjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
5924
6065
|
const integrationImports = `
|
|
5925
6066
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
5926
6067
|
${layerConfigImports}
|
|
@@ -5928,7 +6069,7 @@ ${integrationRuntimeImport}
|
|
|
5928
6069
|
${nativeAuth.importSource}
|
|
5929
6070
|
${nativeMCP.importSource}
|
|
5930
6071
|
`;
|
|
5931
|
-
const imageRuntime =
|
|
6072
|
+
const imageRuntime = _chunkGA6JM4L6cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
5932
6073
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
5933
6074
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
5934
6075
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -6107,7 +6248,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
6107
6248
|
|
|
6108
6249
|
function FarmDefault404Page() {
|
|
6109
6250
|
return React.createElement(React.Fragment, null,
|
|
6110
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
6251
|
+
React.createElement("style", null, ${JSON.stringify(_chunkGA6JM4L6cjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
6111
6252
|
React.createElement("main", {
|
|
6112
6253
|
className: "farm-default-not-found",
|
|
6113
6254
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -6200,7 +6341,7 @@ const serverRuntimeIntegrations = Object.fromEntries(
|
|
|
6200
6341
|
);
|
|
6201
6342
|
const integrationRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs, {
|
|
6202
6343
|
integrations: configuredIntegrations,
|
|
6203
|
-
${JSON.stringify(
|
|
6344
|
+
${JSON.stringify(_chunk3SAWHWDHcjs.FARM_INTEGRATION_API_BASE_PATH_KEY)}: ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
6204
6345
|
});
|
|
6205
6346
|
const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? hasPluginRuntime ? "createFarmInfraAnalyticsPlugin()" : "createFarmInfraAnalyticsRecorder()" : "null"};
|
|
6206
6347
|
const configuredPlugins = [
|
|
@@ -6240,14 +6381,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
6240
6381
|
onError(error) { console.error("[Farm Image]", error); },
|
|
6241
6382
|
})`};
|
|
6242
6383
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
6243
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
6244
|
-
${_optionalChain([config, 'access',
|
|
6384
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _132 => _132.agent, 'optionalAccess', _133 => _133.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
6385
|
+
${_optionalChain([config, 'access', _134 => _134.agent, 'optionalAccess', _135 => _135.llmsTxt, 'optionalAccess', _136 => _136.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
6245
6386
|
const farmMdxConfig = ${JSON.stringify({
|
|
6246
6387
|
...config.mdx,
|
|
6247
|
-
components: typeof _optionalChain([config, 'access',
|
|
6388
|
+
components: typeof _optionalChain([config, 'access', _137 => _137.mdx, 'optionalAccess', _138 => _138.components]) === "string" ? config.mdx.components : void 0
|
|
6248
6389
|
})};
|
|
6249
6390
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
6250
|
-
${_optionalChain([config, 'access',
|
|
6391
|
+
${_optionalChain([config, 'access', _139 => _139.agent, 'optionalAccess', _140 => _140.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
6251
6392
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
6252
6393
|
// to the build.
|
|
6253
6394
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
@@ -6298,7 +6439,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
6298
6439
|
});
|
|
6299
6440
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
6300
6441
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
6301
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
6442
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _141 => _141.docs, 'optionalAccess', _142 => _142.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
6302
6443
|
try {
|
|
6303
6444
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
6304
6445
|
const candidates = [
|
|
@@ -6348,7 +6489,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
6348
6489
|
),
|
|
6349
6490
|
}
|
|
6350
6491
|
: undefined;
|
|
6351
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
6492
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _143 => _143.docs, 'optionalAccess', _144 => _144.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
|
|
6352
6493
|
${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
|
|
6353
6494
|
entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
|
|
6354
6495
|
docsPath: farmDocsResolvedConfig.entry,
|
|
@@ -6385,7 +6526,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _135 => _135.docs, '
|
|
|
6385
6526
|
globalStylesheetHref: "/assets/globals.css",
|
|
6386
6527
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
6387
6528
|
})` : "null"};
|
|
6388
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
6529
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _145 => _145.docs, 'optionalAccess', _146 => _146.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded })` : "null"};
|
|
6389
6530
|
|
|
6390
6531
|
// API routes bundled at build time
|
|
6391
6532
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -6410,12 +6551,12 @@ function fetchFarmInnerRequest(request, context) {
|
|
|
6410
6551
|
}
|
|
6411
6552
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
6412
6553
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
6413
|
-
${_optionalChain([config, 'access',
|
|
6414
|
-
` : ""}${_optionalChain([config, 'access',
|
|
6415
|
-
|
|
6554
|
+
${_optionalChain([config, 'access', _147 => _147.agent, 'optionalAccess', _148 => _148.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkXPSGGECFcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
6555
|
+
` : ""}${_optionalChain([config, 'access', _149 => _149.agent, 'optionalAccess', _150 => _150.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
6556
|
+
_chunkXPSGGECFcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
6416
6557
|
build: config.deploymentId,
|
|
6417
|
-
packages:
|
|
6418
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
6558
|
+
packages: _chunkGA6JM4L6cjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
6559
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkGA6JM4L6cjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
6419
6560
|
})
|
|
6420
6561
|
)};
|
|
6421
6562
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -6890,7 +7031,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
6890
7031
|
let inner = markup.replace(/^\\s+/, "");
|
|
6891
7032
|
let hoisted = "";
|
|
6892
7033
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
6893
|
-
const hoistable = /${
|
|
7034
|
+
const hoistable = /${_chunkXPSGGECFcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
6894
7035
|
let match;
|
|
6895
7036
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
6896
7037
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -7030,7 +7171,7 @@ const farmClientEntryPreloadTags = farmClientModulePreloads
|
|
|
7030
7171
|
: "";
|
|
7031
7172
|
// The client modules a document's markup loads: its islands' boundaries and the
|
|
7032
7173
|
// client references of its server tree.
|
|
7033
|
-
const FARM_CLIENT_MODULE_REFERENCE_PATTERN =
|
|
7174
|
+
const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"|"r":"(\\/[^"]+)"/g;
|
|
7034
7175
|
|
|
7035
7176
|
function renderFarmClientModulePreload(index) {
|
|
7036
7177
|
return '\\n <link rel="modulepreload" href="/' +
|
|
@@ -7421,7 +7562,7 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
7421
7562
|
// a route guard.
|
|
7422
7563
|
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
7423
7564
|
pageRoutes.map((route) => route.pattern).filter(
|
|
7424
|
-
(pattern) => !pattern.includes("[") &&
|
|
7565
|
+
(pattern) => !pattern.includes("[") && _chunkXPSGGECFcjs.farmPathGuardCoversPage.call(void 0,
|
|
7425
7566
|
{
|
|
7426
7567
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
7427
7568
|
middlewareRoutes
|
|
@@ -7468,7 +7609,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
7468
7609
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
7469
7610
|
// registered at runtime, such as the docs engine's.
|
|
7470
7611
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
7471
|
-
_chunkBMOBTMDRcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root),
|
|
7612
|
+
_chunkBMOBTMDRcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunk3YJMBQ27cjs.FARM_VERSION)
|
|
7472
7613
|
)};
|
|
7473
7614
|
let farmDefaultMCPRouteFree;
|
|
7474
7615
|
function getFarmDefaultMCPServer() {
|
|
@@ -7768,7 +7909,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
7768
7909
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
7769
7910
|
return true;
|
|
7770
7911
|
}
|
|
7771
|
-
${_optionalChain([config, 'access',
|
|
7912
|
+
${_optionalChain([config, 'access', _151 => _151.docs, 'optionalAccess', _152 => _152.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
7772
7913
|
if (
|
|
7773
7914
|
isFarmDocsAPIRequest(pathname) ||
|
|
7774
7915
|
docsPath === "/" ||
|
|
@@ -7794,7 +7935,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
7794
7935
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
7795
7936
|
};
|
|
7796
7937
|
}
|
|
7797
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
7938
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _153 => _153.docs, 'optionalAccess', _154 => _154.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
7798
7939
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
7799
7940
|
pathname,
|
|
7800
7941
|
method: request.method,
|
|
@@ -7891,7 +8032,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
7891
8032
|
return applicable;
|
|
7892
8033
|
}
|
|
7893
8034
|
|
|
7894
|
-
${_optionalChain([config, 'access',
|
|
8035
|
+
${_optionalChain([config, 'access', _155 => _155.docs, 'optionalAccess', _156 => _156.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
7895
8036
|
if (request.method === "HEAD") return response;
|
|
7896
8037
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
7897
8038
|
|
|
@@ -7999,7 +8140,7 @@ ${_optionalChain([config, 'access', _147 => _147.docs, 'optionalAccess', _148 =>
|
|
|
7999
8140
|
|
|
8000
8141
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
8001
8142
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
8002
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
8143
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _157 => _157.experimental, 'optionalAccess', _158 => _158.ppr]) === true)};
|
|
8003
8144
|
|
|
8004
8145
|
function resolveRouteRenderingView(route) {
|
|
8005
8146
|
// The same merge development uses: baked directive config under the
|
|
@@ -8131,7 +8272,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
8131
8272
|
},
|
|
8132
8273
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
8133
8274
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
8134
|
-
${_optionalChain([config, 'access',
|
|
8275
|
+
${_optionalChain([config, 'access', _159 => _159.md, 'optionalAccess', _160 => _160.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
8135
8276
|
if (matchPageRoute(pathname)) {
|
|
8136
8277
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
8137
8278
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -8341,7 +8482,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8341
8482
|
}
|
|
8342
8483
|
` : ""}
|
|
8343
8484
|
|
|
8344
|
-
${_optionalChain([config, 'access',
|
|
8485
|
+
${_optionalChain([config, 'access', _161 => _161.docs, 'optionalAccess', _162 => _162.enabled]) ? `
|
|
8345
8486
|
// Docs responses are served after app middleware so route guards and
|
|
8346
8487
|
// middleware headers apply to the docs engine like any other page content.
|
|
8347
8488
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -8402,7 +8543,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8402
8543
|
}
|
|
8403
8544
|
` : ""}
|
|
8404
8545
|
|
|
8405
|
-
${_optionalChain([config, 'access',
|
|
8546
|
+
${_optionalChain([config, 'access', _163 => _163.md, 'optionalAccess', _164 => _164.enabled]) ? `
|
|
8406
8547
|
if (farmMarkdownConfig?.enabled) {
|
|
8407
8548
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
8408
8549
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -8501,11 +8642,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8501
8642
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
8502
8643
|
}
|
|
8503
8644
|
` : ""}
|
|
8504
|
-
${_optionalChain([config, 'access',
|
|
8645
|
+
${_optionalChain([config, 'access', _165 => _165.agent, 'optionalAccess', _166 => _166.manifest]) !== false ? `
|
|
8505
8646
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
8506
8647
|
// public manifest, the same document for every request.
|
|
8507
8648
|
if (
|
|
8508
|
-
[${JSON.stringify(
|
|
8649
|
+
[${JSON.stringify(_chunkXPSGGECFcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkXPSGGECFcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
8509
8650
|
normalizeRuntimePath(routePathname),
|
|
8510
8651
|
)
|
|
8511
8652
|
) {
|
|
@@ -8515,9 +8656,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8515
8656
|
);
|
|
8516
8657
|
}
|
|
8517
8658
|
` : ""}
|
|
8518
|
-
${_optionalChain([config, 'access',
|
|
8659
|
+
${_optionalChain([config, 'access', _167 => _167.agent, 'optionalAccess', _168 => _168.apiCatalog]) ? `
|
|
8519
8660
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
8520
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
8661
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkXPSGGECFcjs.FARM_API_CATALOG_PATH)}) {
|
|
8521
8662
|
return applyProductionMiddlewareHeaders(
|
|
8522
8663
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
8523
8664
|
middlewareHeaders,
|
|
@@ -8542,11 +8683,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8542
8683
|
);
|
|
8543
8684
|
}
|
|
8544
8685
|
` : ""}
|
|
8545
|
-
${_optionalChain([config, 'access',
|
|
8686
|
+
${_optionalChain([config, 'access', _169 => _169.agent, 'optionalAccess', _170 => _170.llmsTxt, 'optionalAccess', _171 => _171.enabled]) ? `
|
|
8546
8687
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
8547
8688
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
8548
8689
|
? "llms"
|
|
8549
|
-
: ${_optionalChain([config, 'access',
|
|
8690
|
+
: ${_optionalChain([config, 'access', _172 => _172.agent, 'optionalAccess', _173 => _173.llmsTxt, 'optionalAccess', _174 => _174.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
8550
8691
|
if (farmGeneratedLlmsKind) {
|
|
8551
8692
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
8552
8693
|
const llmsOrigin = new URL(request.url).origin;
|
|
@@ -8581,7 +8722,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8581
8722
|
}
|
|
8582
8723
|
` : ""}
|
|
8583
8724
|
|
|
8584
|
-
${_optionalChain([config, 'access',
|
|
8725
|
+
${_optionalChain([config, 'access', _175 => _175.docs, 'optionalAccess', _176 => _176.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
8585
8726
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
8586
8727
|
if (docsAPIResponse) {
|
|
8587
8728
|
return applyProductionMiddlewareHeaders(
|
|
@@ -8602,6 +8743,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8602
8743
|
// Handle page routes (SSR)
|
|
8603
8744
|
emitFarmEvent({ type: "render.start", route: pathname, pathname });
|
|
8604
8745
|
const matchedRoute = matchPageRoute(routePathname);
|
|
8746
|
+
${farmIslandsMode ? `// Islands mode: a form or client component posting a server action to this page.
|
|
8747
|
+
if (matchedRoute && request.method === "POST") {
|
|
8748
|
+
const actionResponse = await handleFarmFormActionRequest(request, farmFormActionsConfig);
|
|
8749
|
+
if (actionResponse) return applyProductionMiddlewareHeaders(actionResponse, middlewareHeaders);
|
|
8750
|
+
}` : ""}
|
|
8605
8751
|
if (matchedRoute) {
|
|
8606
8752
|
const trailingSlashLocation = resolveFarmTrailingSlashRedirect(
|
|
8607
8753
|
url,
|
|
@@ -8620,6 +8766,21 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8620
8766
|
emitFarmEvent({ type: "route.matched", pathname, route: route.pattern, params });
|
|
8621
8767
|
|
|
8622
8768
|
try {
|
|
8769
|
+
${farmIslandsMode ? `// Islands mode: the layouts the navigating browser keeps, decided before the shell cache
|
|
8770
|
+
// so a PPR route caches each segment under its own key. A static page, a layout that
|
|
8771
|
+
// hydrates as a root, or a route slot always renders whole.
|
|
8772
|
+
const farmSegmentLayouts = getApplicableLayouts(
|
|
8773
|
+
routePathname,
|
|
8774
|
+
route.directory || route.pattern,
|
|
8775
|
+
);
|
|
8776
|
+
const farmKeptLayoutCount =
|
|
8777
|
+
resolveRouteRenderingView(route).ssg ||
|
|
8778
|
+
farmSegmentLayouts.some((layout) => layout.shouldHydrate === true) ||
|
|
8779
|
+
matchRouteSlots(routePathname, request.headers.get("x-farm-intercept-from")).length > 0
|
|
8780
|
+
? 0
|
|
8781
|
+
: countFarmKeptLayouts(request, farmSegmentLayouts, params);
|
|
8782
|
+
// The root layout always renders, so keeping one layout keeps nothing.
|
|
8783
|
+
const farmKeptLayouts = farmKeptLayoutCount > 1 ? farmKeptLayoutCount : 0;` : `const farmKeptLayouts = 0;`}
|
|
8623
8784
|
const pprConfig = resolvePPRConfig(route);
|
|
8624
8785
|
const pprBypassReason = pprConfig.enabled
|
|
8625
8786
|
? getPPRShellBypassReason(request, middlewareData, middlewareContext)
|
|
@@ -8632,7 +8793,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8632
8793
|
farmLocaleResolution && farmI18nConfig.routing !== "none"
|
|
8633
8794
|
? resolveFarmI18nAlternateOrigin(request)
|
|
8634
8795
|
: ""
|
|
8635
|
-
)
|
|
8796
|
+
) + (farmKeptLayouts ? ":segment:" + farmKeptLayouts : "")
|
|
8636
8797
|
: null;
|
|
8637
8798
|
if (pprConfig.enabled && pprBypassReason) {
|
|
8638
8799
|
emitFarmEvent({ type: "ppr.shell.bypass", route: pathname, reason: pprBypassReason });
|
|
@@ -8659,6 +8820,10 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8659
8820
|
"x-farm-preload-buffered": getFarmBufferedPreloadMarker(cachedPPRShell),
|
|
8660
8821
|
...(farmFontPreloadHeader ? { "Link": farmFontPreloadHeader } : {}),
|
|
8661
8822
|
...getPPRHeaders("hit", pprConfig),
|
|
8823
|
+
// A segment is one navigation's answer, never a CDN entry: some CDNs ignore Vary.
|
|
8824
|
+
...(farmKeptLayouts
|
|
8825
|
+
? { "Cache-Control": "private, no-store", "Vary": "F-Layouts" }
|
|
8826
|
+
: {}),
|
|
8662
8827
|
},
|
|
8663
8828
|
}), middlewareHeaders), cachedPPRShell);
|
|
8664
8829
|
}
|
|
@@ -8885,6 +9050,21 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8885
9050
|
};
|
|
8886
9051
|
});
|
|
8887
9052
|
|
|
9053
|
+
${farmIslandsMode ? `// Islands mode: a route a shared cache may store (a PPR shell, a static page) renders
|
|
9054
|
+
// whole for every request, so a cache hit stays a hit. Other routes leave out what the
|
|
9055
|
+
// navigating browser keeps: the layouts it shows and the values it holds.
|
|
9056
|
+
const farmSharedCacheableRoute = Boolean(getRouteSharedCacheControl(route, pprCanCache));
|
|
9057
|
+
if (farmSharedCacheableRoute) ignoreFarmHeldValues();
|
|
9058
|
+
const farmLayoutKeyOf = getFarmLayoutKey;
|
|
9059
|
+
// A navigation the browser renders in its layout's React root rebuilds a server-tree page
|
|
9060
|
+
// from its payload, so the page's rendered HTML would go unused.
|
|
9061
|
+
const farmPayloadOnlyNavigation =
|
|
9062
|
+
!farmSharedCacheableRoute &&
|
|
9063
|
+
shouldHydrateLayout &&
|
|
9064
|
+
route.serverTree === true &&
|
|
9065
|
+
!route.shouldHydrate &&
|
|
9066
|
+
request.headers.get("f-render") === "tree";` : `const farmLayoutKeyOf = null;
|
|
9067
|
+
const farmPayloadOnlyNavigation = false;`}
|
|
8888
9068
|
const renderPageElement = async () => {
|
|
8889
9069
|
// First, render the page content
|
|
8890
9070
|
let pageElement;
|
|
@@ -8911,7 +9091,10 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8911
9091
|
pageElement = wrapFarmRouteClientGraph(pageElement);
|
|
8912
9092
|
} else if (shouldHydrateLayout && !route.shouldHydrate) {
|
|
8913
9093
|
pageElement = route.serverTree
|
|
8914
|
-
? await renderFarmRouteServerTree(
|
|
9094
|
+
? await renderFarmRouteServerTree(
|
|
9095
|
+
pageElement,
|
|
9096
|
+
farmPayloadOnlyNavigation ? { payloadOnly: true } : undefined,
|
|
9097
|
+
)
|
|
8915
9098
|
: isolateFarmRouteServerPage(pageElement);
|
|
8916
9099
|
}
|
|
8917
9100
|
|
|
@@ -8936,6 +9119,22 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8936
9119
|
for (let i = applicableLayouts.length - 1; i >= 0; i--) {
|
|
8937
9120
|
const layout = applicableLayouts[i];
|
|
8938
9121
|
const LayoutComponent = layout.module.default;
|
|
9122
|
+
// Islands mode: a layout the browser keeps sends only its boundary, so the client
|
|
9123
|
+
// knows where the rest goes. The root layout always renders: it may own the document.
|
|
9124
|
+
if (LayoutComponent && i > 0 && i < farmKeptLayouts) {
|
|
9125
|
+
wrappedElement = React.createElement(
|
|
9126
|
+
"div",
|
|
9127
|
+
{
|
|
9128
|
+
"data-farm-layout-boundary": "true",
|
|
9129
|
+
"data-farm-layout-pattern": layout.pattern,
|
|
9130
|
+
"data-farm-layout-key": farmLayoutKeyOf(layout.pattern, params),
|
|
9131
|
+
"data-farm-layout-kept": "true",
|
|
9132
|
+
style: { display: "contents" },
|
|
9133
|
+
},
|
|
9134
|
+
wrappedElement,
|
|
9135
|
+
);
|
|
9136
|
+
continue;
|
|
9137
|
+
}
|
|
8939
9138
|
if (LayoutComponent) {
|
|
8940
9139
|
const slotProps = {};
|
|
8941
9140
|
for (const slot of renderedRouteSlots) {
|
|
@@ -8962,6 +9161,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8962
9161
|
{
|
|
8963
9162
|
"data-farm-layout-boundary": "true",
|
|
8964
9163
|
"data-farm-layout-pattern": layout.pattern,
|
|
9164
|
+
"data-farm-layout-key": farmLayoutKeyOf
|
|
9165
|
+
? farmLayoutKeyOf(layout.pattern, params)
|
|
9166
|
+
: undefined,
|
|
8965
9167
|
style: { display: "contents" },
|
|
8966
9168
|
},
|
|
8967
9169
|
wrappedElement,
|
|
@@ -9042,7 +9244,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9042
9244
|
);
|
|
9043
9245
|
}
|
|
9044
9246
|
}
|
|
9045
|
-
${_optionalChain([config, 'access',
|
|
9247
|
+
${_optionalChain([config, 'access', _177 => _177.md, 'optionalAccess', _178 => _178.enabled]) ? `
|
|
9046
9248
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
9047
9249
|
// using the public path the .md request will be resolved against.
|
|
9048
9250
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -9061,7 +9263,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9061
9263
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
9062
9264
|
}
|
|
9063
9265
|
|
|
9064
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
9266
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _179 => _179.agent, 'optionalAccess', _180 => _180.jsonLd]), () => ( false)))} });
|
|
9065
9267
|
const title = renderedMetadata.title;
|
|
9066
9268
|
const metaTags = renderedMetadata.tags;
|
|
9067
9269
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -9072,7 +9274,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9072
9274
|
farmLocaleResolution,
|
|
9073
9275
|
);
|
|
9074
9276
|
const hasRequestScopedRender = Boolean(
|
|
9075
|
-
pageStatus >= 400 ||
|
|
9277
|
+
pageStatus >= 400 ||${farmIslandsMode ? "\n farmKeptLayouts > 0 ||\n farmPayloadOnlyNavigation ||" : ""}
|
|
9076
9278
|
renderReadRequest ||
|
|
9077
9279
|
request.headers.get("x-farm-intercept-from") ||
|
|
9078
9280
|
hasPrivateRequestHeaders ||
|
|
@@ -9092,7 +9294,12 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9092
9294
|
if (renderedPage.stream || hasRequestScopedRender || !sharedCacheControl) {
|
|
9093
9295
|
responseHeaders["Cache-Control"] = "private, no-store";
|
|
9094
9296
|
}
|
|
9095
|
-
const farmI18nSnapshot = getFarmI18nSnapshot()
|
|
9297
|
+
const farmI18nSnapshot = getFarmI18nSnapshot();${farmIslandsMode ? `
|
|
9298
|
+
// Islands mode: a navigation that names the values it holds, or the layouts it shows,
|
|
9299
|
+
// gets HTML without them.
|
|
9300
|
+
responseHeaders["Vary"] = farmSharedCacheableRoute
|
|
9301
|
+
? "F-Layouts"
|
|
9302
|
+
: "F-Values, F-Layouts, F-Render";` : ""}
|
|
9096
9303
|
let html = renderedPage.html;
|
|
9097
9304
|
|
|
9098
9305
|
// Check if the layout already rendered a full HTML document
|
|
@@ -9704,11 +9911,11 @@ ${generatePreloadResponseRuntimeSource()}
|
|
|
9704
9911
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
9705
9912
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
9706
9913
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
9707
|
-
${_optionalChain([config, 'access',
|
|
9914
|
+
${_optionalChain([config, 'access', _181 => _181.agent, 'optionalAccess', _182 => _182.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
9708
9915
|
basePath: farmLocalAPIBasePath,
|
|
9709
9916
|
dispatch: async (localRequest) =>
|
|
9710
9917
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
9711
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
9918
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _183 => _183.agent, 'optionalAccess', _184 => _184.noindexPreviews]) ? `
|
|
9712
9919
|
// Keep every response of a preview deployment out of search indexes.
|
|
9713
9920
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
9714
9921
|
}
|
|
@@ -9902,13 +10109,13 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
9902
10109
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
9903
10110
|
return "rewrite";
|
|
9904
10111
|
}
|
|
9905
|
-
if (
|
|
9906
|
-
if (
|
|
9907
|
-
if (
|
|
10112
|
+
if (_chunkXPSGGECFcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
10113
|
+
if (_chunkXPSGGECFcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
10114
|
+
if (_chunkLPE3ED4Rcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
9908
10115
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
9909
10116
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
9910
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
9911
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
10117
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _185 => _185.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
10118
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _186 => _186.regions, 'optionalAccess', _187 => _187.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
9912
10119
|
return "route runtime controls";
|
|
9913
10120
|
}
|
|
9914
10121
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -9923,9 +10130,9 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
9923
10130
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getPhysicalPrerenderBypassReason, "getPhysicalPrerenderBypassReason");
|
|
9924
10131
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
9925
10132
|
return Object.values(routeRules || {}).some((rule) => {
|
|
9926
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
9927
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
9928
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
10133
|
+
const swr = _optionalChain([rule, 'optionalAccess', _188 => _188.swr]);
|
|
10134
|
+
const cache = _optionalChain([rule, 'optionalAccess', _189 => _189.cache]);
|
|
10135
|
+
const headers = _optionalChain([rule, 'optionalAccess', _190 => _190.headers]);
|
|
9929
10136
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
9930
10137
|
});
|
|
9931
10138
|
}
|
|
@@ -9939,10 +10146,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9939
10146
|
const nitroBuilder = nitroBuilderResult.value;
|
|
9940
10147
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
9941
10148
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
9942
|
-
const outputDir =
|
|
10149
|
+
const outputDir = _chunkLPE3ED4Rcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
9943
10150
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
9944
10151
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
9945
|
-
const imageRuntime =
|
|
10152
|
+
const imageRuntime = _chunkGA6JM4L6cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
9946
10153
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
9947
10154
|
(image) => image.sourceType === "module"
|
|
9948
10155
|
);
|
|
@@ -10402,20 +10609,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
10402
10609
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
10403
10610
|
);
|
|
10404
10611
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
10405
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
10406
|
-
_optionalChain([nitroConfig, 'access',
|
|
10407
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
10612
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _191 => _191.rollupConfig, 'optionalAccess', _192 => _192.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _193 => _193.rollupConfig, 'optionalAccess', _194 => _194.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _195 => _195.output, 'optionalAccess', _196 => _196.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
10613
|
+
_optionalChain([nitroConfig, 'access', _197 => _197.handlers, 'optionalAccess', _198 => _198.some, 'call', _199 => _199(
|
|
10614
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _200 => _200.handler]) || "") === nitroEntryPath
|
|
10408
10615
|
)])
|
|
10409
10616
|
);
|
|
10410
10617
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
10411
10618
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
10412
10619
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
10413
10620
|
const shouldMinify = nitroConfig.minify !== false;
|
|
10414
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
10621
|
+
const keepServerNames = !(_optionalChain([config, 'access', _201 => _201.docs, 'optionalAccess', _202 => _202.enabled]) && _optionalChain([config, 'access', _203 => _203.docs, 'access', _204 => _204.adapter, 'optionalAccess', _205 => _205.server]));
|
|
10415
10622
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
10416
10623
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
10417
10624
|
if (canReusePrebuiltSSR) {
|
|
10418
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
10625
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _206 => _206.rollupConfig, 'optionalAccess', _207 => _207.plugins]);
|
|
10419
10626
|
nitroConfig.rollupConfig = {
|
|
10420
10627
|
...nitroConfig.rollupConfig,
|
|
10421
10628
|
plugins: [
|
|
@@ -10426,9 +10633,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
10426
10633
|
}
|
|
10427
10634
|
nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
|
|
10428
10635
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
10429
|
-
if (_optionalChain([config, 'access',
|
|
10636
|
+
if (_optionalChain([config, 'access', _208 => _208.md, 'optionalAccess', _209 => _209.enabled])) {
|
|
10430
10637
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
10431
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
10638
|
+
if (!route.contents || !_optionalChain([route, 'access', _210 => _210.contentType, 'optionalAccess', _211 => _211.toLowerCase, 'call', _212 => _212(), 'access', _213 => _213.includes, 'call', _214 => _214("html")])) return;
|
|
10432
10639
|
const alternatePath = _chunkD4ROBNTKcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
|
|
10433
10640
|
if (!alternatePath) return;
|
|
10434
10641
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
@@ -10449,7 +10656,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
10449
10656
|
}
|
|
10450
10657
|
if (config.security.csp && config.security.csp.nonce) {
|
|
10451
10658
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
10452
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
10659
|
+
if (!route.contents || !_optionalChain([route, 'access', _215 => _215.contentType, 'optionalAccess', _216 => _216.toLowerCase, 'call', _217 => _217(), 'access', _218 => _218.includes, 'call', _219 => _219("html")])) return;
|
|
10453
10660
|
const staticCsp = await _chunk25LPIZSXcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
10454
10661
|
if (!staticCsp) return;
|
|
10455
10662
|
route.contents = staticCsp.html;
|
|
@@ -10657,7 +10864,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
10657
10864
|
await fs4.rename(src, dest);
|
|
10658
10865
|
return;
|
|
10659
10866
|
} catch (error) {
|
|
10660
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
10867
|
+
const code = _optionalChain([error, 'optionalAccess', _220 => _220.code]);
|
|
10661
10868
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
10662
10869
|
throw error;
|
|
10663
10870
|
}
|
|
@@ -10684,7 +10891,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
10684
10891
|
try {
|
|
10685
10892
|
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
10686
10893
|
} catch (error) {
|
|
10687
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
10894
|
+
if (_optionalChain([error, 'optionalAccess', _221 => _221.code]) !== "ENOENT") throw error;
|
|
10688
10895
|
}
|
|
10689
10896
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
10690
10897
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
@@ -10804,7 +11011,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
10804
11011
|
try {
|
|
10805
11012
|
await copyPackage("sharp", sharpRequire);
|
|
10806
11013
|
if (!copiedPackages.has("sharp")) {
|
|
10807
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
11014
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkGA6JM4L6cjs.SHARP_INSTALL_HINT}`);
|
|
10808
11015
|
}
|
|
10809
11016
|
} catch (error) {
|
|
10810
11017
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -11004,6 +11211,12 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
|
|
|
11004
11211
|
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs4);
|
|
11005
11212
|
}
|
|
11006
11213
|
_chunkS3JO3N4Hcjs.__name.call(void 0, copyPrismaClientForVercel, "copyPrismaClientForVercel");
|
|
11214
|
+
function islandsActionKeyCode() {
|
|
11215
|
+
const key = _crypto.randomBytes.call(void 0, 32).toString("base64url");
|
|
11216
|
+
return `import { setBuildDefaults as __farmIslxBuildDefaults } from "@farm.js/core/internal/islx-server";
|
|
11217
|
+
__farmIslxBuildDefaults({ key: ${JSON.stringify(key)} });`;
|
|
11218
|
+
}
|
|
11219
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, islandsActionKeyCode, "islandsActionKeyCode");
|
|
11007
11220
|
|
|
11008
11221
|
// src/build/project-module-runner.ts
|
|
11009
11222
|
async function createFarmProjectModuleSsrEnvironment() {
|
|
@@ -11042,7 +11255,7 @@ function createBuildTargetBaseline(config) {
|
|
|
11042
11255
|
preset,
|
|
11043
11256
|
distDir,
|
|
11044
11257
|
outputDir,
|
|
11045
|
-
outputWasDerived: outputDir ===
|
|
11258
|
+
outputWasDerived: outputDir === _chunkLPE3ED4Rcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
11046
11259
|
};
|
|
11047
11260
|
}
|
|
11048
11261
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
|
|
@@ -11052,8 +11265,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
11052
11265
|
const distDir = config.distDir || ".farm";
|
|
11053
11266
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
11054
11267
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
11055
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
11056
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
11268
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkLPE3ED4Rcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
11269
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkLPE3ED4Rcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
11057
11270
|
return {
|
|
11058
11271
|
root,
|
|
11059
11272
|
preset,
|
|
@@ -11061,7 +11274,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
11061
11274
|
distDir,
|
|
11062
11275
|
deployTarget,
|
|
11063
11276
|
outputDir,
|
|
11064
|
-
deployOutputDir:
|
|
11277
|
+
deployOutputDir: _chunkLPE3ED4Rcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
11065
11278
|
};
|
|
11066
11279
|
}
|
|
11067
11280
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
|
|
@@ -11099,12 +11312,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
11099
11312
|
};
|
|
11100
11313
|
config = {
|
|
11101
11314
|
...config,
|
|
11102
|
-
images:
|
|
11315
|
+
images: _chunkGA6JM4L6cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
11103
11316
|
root: targets.root,
|
|
11104
11317
|
preset: targets.preset
|
|
11105
11318
|
})
|
|
11106
11319
|
};
|
|
11107
|
-
if (_optionalChain([config, 'access',
|
|
11320
|
+
if (_optionalChain([config, 'access', _222 => _222.docs, 'optionalAccess', _223 => _223.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
|
|
11108
11321
|
pluginManager.updateContext({ config });
|
|
11109
11322
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
11110
11323
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
@@ -11118,8 +11331,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
11118
11331
|
});
|
|
11119
11332
|
_chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
11120
11333
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
11121
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
11122
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
11334
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _224 => _224.status]) === "rejected") throw productionViteResult.reason;
|
|
11335
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _225 => _225.value]);
|
|
11123
11336
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
11124
11337
|
projectModuleServer = await createProjectModuleServer(
|
|
11125
11338
|
createViteServer,
|
|
@@ -11127,17 +11340,17 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
11127
11340
|
root,
|
|
11128
11341
|
rendererBuild.signal
|
|
11129
11342
|
);
|
|
11130
|
-
const farmApp =
|
|
11343
|
+
const farmApp = _chunkGA6JM4L6cjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
11131
11344
|
await farmApp.initialize();
|
|
11132
11345
|
const routeManager = farmApp.getRouteManager();
|
|
11133
11346
|
const serverRenderer = farmApp.getServerRenderer();
|
|
11134
|
-
const typeArtifacts =
|
|
11347
|
+
const typeArtifacts = _chunk3XEMGDBFcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
11135
11348
|
root,
|
|
11136
11349
|
srcDir,
|
|
11137
11350
|
layers: config.layers,
|
|
11138
11351
|
plugins: config.plugins,
|
|
11139
11352
|
extraRoutes: [
|
|
11140
|
-
..._optionalChain([config, 'access',
|
|
11353
|
+
..._optionalChain([config, 'access', _226 => _226.openapi, 'optionalAccess', _227 => _227.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
11141
11354
|
..._chunkMY5PZYADcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
11142
11355
|
],
|
|
11143
11356
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
@@ -11222,7 +11435,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
11222
11435
|
throw error;
|
|
11223
11436
|
} finally {
|
|
11224
11437
|
try {
|
|
11225
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
11438
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _228 => _228.close, 'call', _229 => _229()]);
|
|
11226
11439
|
} finally {
|
|
11227
11440
|
rendererBuild.abort();
|
|
11228
11441
|
}
|
|
@@ -11234,7 +11447,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
11234
11447
|
ssr: true,
|
|
11235
11448
|
buildLifetime
|
|
11236
11449
|
});
|
|
11237
|
-
const viteConfig =
|
|
11450
|
+
const viteConfig = _chunkGA6JM4L6cjs.mergeFarmViteConfig.call(void 0,
|
|
11238
11451
|
{
|
|
11239
11452
|
root,
|
|
11240
11453
|
appType: "custom",
|
|
@@ -11246,7 +11459,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
11246
11459
|
},
|
|
11247
11460
|
plugins: [
|
|
11248
11461
|
...rendererVitePlugins,
|
|
11249
|
-
|
|
11462
|
+
_chunkGA6JM4L6cjs.farmFontImportsPlugin.call(void 0, {
|
|
11250
11463
|
root,
|
|
11251
11464
|
basePath: config.basePath,
|
|
11252
11465
|
publicDir: config.publicDir
|
|
@@ -11258,7 +11471,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
11258
11471
|
hmr: false
|
|
11259
11472
|
},
|
|
11260
11473
|
resolve: {
|
|
11261
|
-
alias:
|
|
11474
|
+
alias: _chunkGA6JM4L6cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
11262
11475
|
dedupe: [...config.renderer.dedupe || []]
|
|
11263
11476
|
},
|
|
11264
11477
|
optimizeDeps: {
|
|
@@ -11291,10 +11504,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
11291
11504
|
noDiscovery: true
|
|
11292
11505
|
},
|
|
11293
11506
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
11294
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
11507
|
+
environments: _optionalChain([viteConfig, 'access', _230 => _230.environments, 'optionalAccess', _231 => _231.ssr, 'optionalAccess', _232 => _232.dev, 'optionalAccess', _233 => _233.createEnvironment]) ? viteConfig.environments : {
|
|
11295
11508
|
...viteConfig.environments,
|
|
11296
11509
|
ssr: {
|
|
11297
|
-
..._optionalChain([viteConfig, 'access',
|
|
11510
|
+
..._optionalChain([viteConfig, 'access', _234 => _234.environments, 'optionalAccess', _235 => _235.ssr]),
|
|
11298
11511
|
...await createFarmProjectModuleSsrEnvironment()
|
|
11299
11512
|
}
|
|
11300
11513
|
}
|
|
@@ -11352,7 +11565,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
11352
11565
|
define: {
|
|
11353
11566
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
11354
11567
|
__FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
|
|
11355
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
11568
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _236 => _236.env, 'optionalAccess', _237 => _237.public]) || {})
|
|
11356
11569
|
},
|
|
11357
11570
|
plugins: [
|
|
11358
11571
|
farmI18nClientBridgePlugin(),
|
|
@@ -11387,7 +11600,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
11387
11600
|
if (pluginManager) {
|
|
11388
11601
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
11389
11602
|
}
|
|
11390
|
-
const outputDir =
|
|
11603
|
+
const outputDir = _chunkLPE3ED4Rcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
11391
11604
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
11392
11605
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
11393
11606
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -11458,7 +11671,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
11458
11671
|
root,
|
|
11459
11672
|
preset,
|
|
11460
11673
|
distDir,
|
|
11461
|
-
outputDir:
|
|
11674
|
+
outputDir: _chunkLPE3ED4Rcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
11462
11675
|
});
|
|
11463
11676
|
}
|
|
11464
11677
|
}
|