@farm.js/core 0.1.70 → 0.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp-handler-6T2Z7TB6.cjs → agent-mcp-handler-KE4J3W7S.cjs} +3 -3
- package/dist/{agent-mcp-handler-CPU354QQ.mjs → agent-mcp-handler-VIT4GOSR.mjs} +2 -2
- package/dist/{agent-mcp.d-DulgFLBt.d.ts → agent-mcp.d-BzNw6JI8.d.ts} +14 -4
- package/dist/{agent-mcp.d-TAs1ES2F.d.mts → agent-mcp.d-CgFen3EH.d.mts} +14 -4
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/analyzer-LPIVRSTJ.cjs +16 -0
- package/dist/{analyzer-QGRBLETM.mjs → analyzer-VK3BAOFI.mjs} +2 -2
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- 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.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/{app-manifest.d-C-nf3Vmm.d.ts → app-manifest.d-DY4JfJxi.d.ts} +1 -1
- package/dist/{app-manifest.d-6zXb90o6.d.mts → app-manifest.d-DpDK_B1k.d.mts} +1 -1
- package/dist/app-markdown.cjs +5 -3
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +4 -2
- package/dist/{app.d-C2xeMIYT.d.ts → app.d-BeK6bb1c.d.ts} +8 -6
- package/dist/{app.d-DF0aundc.d.mts → app.d-D-5UNrFd.d.mts} +8 -6
- package/dist/{chunk-HAXFV2CD.mjs → chunk-2CQC5CMD.mjs} +1 -1
- package/dist/{chunk-IEN2EFE5.cjs → chunk-2IFT2CSA.cjs} +4 -4
- package/dist/{chunk-BPUVDCGG.cjs → chunk-3BQ7QHUH.cjs} +3 -3
- package/dist/{chunk-JFVT5ZZV.mjs → chunk-4OD2LXF2.mjs} +1 -1
- package/dist/{chunk-CCHJWJGP.mjs → chunk-7BUE2GM6.mjs} +141 -86
- package/dist/{chunk-FJ5YCERM.cjs → chunk-7OHJWFLB.cjs} +387 -331
- package/dist/{chunk-5R3JQPWD.mjs → chunk-AYVGD3PK.mjs} +1 -1
- package/dist/{chunk-K7JMTAFH.cjs → chunk-CSQPMV3Q.cjs} +16 -6
- package/dist/{chunk-N62IYXYD.mjs → chunk-DPIGYXSV.mjs} +1 -1
- package/dist/{chunk-LECZ5DPZ.cjs → chunk-DPYBVVL3.cjs} +2 -2
- package/dist/{chunk-RMOU3PR4.mjs → chunk-GUU3IZSM.mjs} +63 -23
- package/dist/{chunk-EDZU7YRK.mjs → chunk-IGXS54GC.mjs} +2 -2
- package/dist/{chunk-3WS5AZ3R.mjs → chunk-IYDJNCR7.mjs} +1 -1
- package/dist/{chunk-R7254L3R.mjs → chunk-J5ASGNKF.mjs} +23 -0
- package/dist/{chunk-75E5FDX2.mjs → chunk-JMFTKNBA.mjs} +10 -10
- package/dist/{chunk-DIHBWZDZ.cjs → chunk-JVA4PIYN.cjs} +408 -294
- package/dist/{chunk-XYVPTTUT.cjs → chunk-KEB7AGS6.cjs} +4 -4
- package/dist/{chunk-TLSSIYAL.mjs → chunk-KQAB5LML.mjs} +10 -3
- package/dist/{chunk-M6U6E4F7.cjs → chunk-KWST2O22.cjs} +108 -68
- package/dist/{chunk-NSZY3EWG.cjs → chunk-L6E4SHUB.cjs} +31 -8
- package/dist/{chunk-MZLJFNMH.cjs → chunk-MEJCP2LX.cjs} +1 -1
- package/dist/{chunk-A2TH5MKE.mjs → chunk-MITIAOUQ.mjs} +3 -3
- package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
- package/dist/{chunk-4AC4PXZO.cjs → chunk-N3XO5AL5.cjs} +2 -2
- package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
- package/dist/{chunk-32SYRIQ7.cjs → chunk-PLXD2MJV.cjs} +3 -3
- package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
- package/dist/{chunk-3EXCZJEN.mjs → chunk-QUFENL7Q.mjs} +1 -1
- package/dist/{chunk-NYF7A4UW.mjs → chunk-RJUCNO7R.mjs} +1 -1
- package/dist/{chunk-K4UGCUXX.cjs → chunk-SXMWVP2L.cjs} +7 -7
- package/dist/{chunk-VG6HYT5K.cjs → chunk-TP4RAV7Y.cjs} +9 -9
- package/dist/{chunk-I7NUT24Z.cjs → chunk-UISZLYKY.cjs} +2 -2
- package/dist/{chunk-KPMLDT3B.mjs → chunk-UQUOSNRN.mjs} +378 -264
- package/dist/{chunk-QZHTDVH4.mjs → chunk-V25GSH43.mjs} +1 -1
- package/dist/{chunk-65FPDDT4.cjs → chunk-VXB5CMNC.cjs} +2 -2
- package/dist/{chunk-5IJRJWJS.mjs → chunk-W2T6NDNP.mjs} +10 -0
- package/dist/{chunk-JRF2SKCD.mjs → chunk-X7LGLF33.mjs} +1 -1
- package/dist/{chunk-QEWWKYDL.cjs → chunk-YCNHUIPR.cjs} +17 -10
- package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
- package/dist/{chunk-A7HCBHMC.cjs → chunk-ZPUAOKHV.cjs} +3 -3
- package/dist/{client-component.d-Bk5qKJM-.d.mts → client-component.d-DwpH251K.d.mts} +2 -2
- package/dist/{client-component.d-DNbC4oWI.d.ts → client-component.d-fYupugbZ.d.ts} +2 -2
- package/dist/{client-plugins.d-DwUqh4gp.d.ts → client-plugins.d-BxqFfHpM.d.ts} +8 -5
- package/dist/{client-plugins.d-Pi9nG0W0.d.mts → client-plugins.d-k3bOT5gz.d.mts} +8 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-CB43AHEP.mjs → devtools-6MXPFPNJ.mjs} +2 -2
- package/dist/{devtools-L5DUNDF3.cjs → devtools-O5625KCK.cjs} +3 -3
- package/dist/docs.cjs +4 -4
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +3 -3
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{headers.d-CE6OWB-n.d.ts → headers.d-DalIGbVO.d.ts} +1 -1
- package/dist/{headers.d-DED1hHh4.d.mts → headers.d-sNT7ZQiU.d.mts} +1 -1
- package/dist/index.cjs +20 -18
- package/dist/{index.d-c9UwIqDy.d.ts → index.d-BcA-secm.d.ts} +1 -1
- package/dist/{index.d-CbvOjJcp.d.mts → index.d-DDHHAv7j.d.mts} +1 -1
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.mjs +19 -17
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.cjs +4 -2
- package/dist/internal/app-markdown-runtime.d.mts +11 -3
- package/dist/internal/app-markdown-runtime.d.ts +11 -3
- package/dist/internal/app-markdown-runtime.mjs +3 -1
- package/dist/internal/build-runtime.cjs +19 -19
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +18 -18
- package/dist/internal/cli-runtime.cjs +6 -4
- package/dist/internal/cli-runtime.mjs +5 -3
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +4 -4
- package/dist/internal/client-runtime.d.ts +4 -4
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +4 -4
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +3 -3
- package/dist/internal/infra-analytics-runtime.cjs +7 -7
- package/dist/internal/infra-analytics-runtime.mjs +5 -5
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +6 -6
- package/dist/internal/production-runtime.d.mts +14 -9
- package/dist/internal/production-runtime.d.ts +14 -9
- package/dist/internal/production-runtime.mjs +5 -5
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/{mount.d-BvWxf8ZE.d.mts → mount.d-C1PONsEe.d.mts} +1 -1
- package/dist/{mount.d-DngLY7NL.d.ts → mount.d-D3JOux2V.d.ts} +1 -1
- package/dist/{navigation-delegate.d-CMyl1h2l.d.mts → navigation-delegate.d-CJQQHboA.d.mts} +1 -1
- package/dist/{navigation-delegate.d-zZogiDfa.d.ts → navigation-delegate.d-CQQPbdkE.d.ts} +1 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
- package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
- package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
- package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
- package/dist/plugin.cjs +13 -13
- package/dist/plugin.d.mts +4 -4
- package/dist/plugin.d.ts +4 -4
- package/dist/plugin.mjs +12 -12
- package/dist/{render-plan.d-Di1znBDW.d.mts → render-plan.d-CiUj0rq5.d.mts} +1 -1
- package/dist/{render-plan.d-DQj2bzd2.d.ts → render-plan.d-DHuJMJRP.d.ts} +1 -1
- package/dist/renderer-client.d.mts +4 -4
- package/dist/renderer-client.d.ts +4 -4
- package/dist/{request.d-CJWzfDYJ.d.mts → request.d-D-F7o7tb.d.mts} +1 -1
- package/dist/{request.d-C5vyoYeL.d.ts → request.d-DRUbOmYD.d.ts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-C-et2TZ1.d.mts → route-rendering.d-6smgwT2t.d.mts} +1 -1
- package/dist/{route-rendering.d-DhsY5M2I.d.ts → route-rendering.d-KwqM_mlK.d.ts} +1 -1
- package/dist/{router.d-CJB-Ntni.d.ts → router.d-B6sesMRD.d.ts} +1 -1
- package/dist/{router.d-BMDS5s5X.d.mts → router.d-BYmDeDlp.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-NJKLZ3YE.cjs → rsc-pipeline-P4PCWDO2.cjs} +4 -4
- package/dist/{rsc-pipeline-AXQJCCHI.mjs → rsc-pipeline-R2GOKIMU.mjs} +3 -3
- package/dist/{runtime-JXNEKOSE.mjs → runtime-DP5DYGW5.mjs} +3 -3
- package/dist/{runtime-DMW6DDOI.cjs → runtime-WA2Q4SLG.cjs} +5 -5
- package/dist/{runtime.d-BonodRI9.d.mts → runtime.d-BFSJf-ww.d.mts} +1 -1
- package/dist/{runtime.d-uw4123iI.d.ts → runtime.d-CbdMI0Oy.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +33 -33
- package/dist/server.d.mts +10 -10
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +15 -15
- package/dist/{spa-router.d-rha3M95y.d.mts → spa-router.d-D4EDwR20.d.mts} +2 -2
- package/dist/{spa-router.d-l0d9pPZj.d.ts → spa-router.d-mC1D5cTN.d.ts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils.d-BK-PTOF8.d.ts → utils.d-A2X3a6z_.d.ts} +1 -1
- package/dist/{utils.d-BzuTobEc.d.mts → utils.d-DxMzteqE.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +13 -13
- package/dist/vite.d.mts +7 -5
- package/dist/vite.d.ts +7 -5
- package/dist/vite.mjs +12 -12
- package/package.json +2 -2
- package/dist/analyzer-GUIRJWZH.cjs +0 -16
|
@@ -26,7 +26,7 @@ var _chunkNG2EZ6QScjs = require('./chunk-NG2EZ6QS.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkZPUAOKHVcjs = require('./chunk-ZPUAOKHV.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
@@ -41,7 +41,7 @@ var _chunk4BS3HSY7cjs = require('./chunk-4BS3HSY7.cjs');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunkUISZLYKYcjs = require('./chunk-UISZLYKY.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
@@ -65,7 +65,7 @@ var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
|
|
|
65
65
|
var _chunkJWY66PIDcjs = require('./chunk-JWY66PID.cjs');
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
var
|
|
68
|
+
var _chunk3BQ7QHUHcjs = require('./chunk-3BQ7QHUH.cjs');
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
@@ -74,7 +74,7 @@ var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
var
|
|
77
|
+
var _chunkKEB7AGS6cjs = require('./chunk-KEB7AGS6.cjs');
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
var _chunk3GNHJ3RNcjs = require('./chunk-3GNHJ3RN.cjs');
|
|
@@ -110,7 +110,7 @@ var _chunkOCS3PSYRcjs = require('./chunk-OCS3PSYR.cjs');
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
var
|
|
113
|
+
var _chunkKWST2O22cjs = require('./chunk-KWST2O22.cjs');
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
|
@@ -118,12 +118,12 @@ var _chunkM6U6E4F7cjs = require('./chunk-M6U6E4F7.cjs');
|
|
|
118
118
|
var _chunkDMXMIE2Ccjs = require('./chunk-DMXMIE2C.cjs');
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
var
|
|
121
|
+
var _chunkPMU4U2W2cjs = require('./chunk-PMU4U2W2.cjs');
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
|
-
var
|
|
126
|
+
var _chunkCSQPMV3Qcjs = require('./chunk-CSQPMV3Q.cjs');
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
@@ -150,15 +150,15 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
|
|
153
|
-
var
|
|
153
|
+
var _chunkSXMWVP2Lcjs = require('./chunk-SXMWVP2L.cjs');
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
|
|
158
|
-
var
|
|
158
|
+
var _chunkTP4RAV7Ycjs = require('./chunk-TP4RAV7Y.cjs');
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
var
|
|
161
|
+
var _chunkDPYBVVL3cjs = require('./chunk-DPYBVVL3.cjs');
|
|
162
162
|
|
|
163
163
|
|
|
164
164
|
var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
@@ -176,7 +176,7 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
|
176
176
|
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
var
|
|
179
|
+
var _chunk2IFT2CSAcjs = require('./chunk-2IFT2CSA.cjs');
|
|
180
180
|
|
|
181
181
|
|
|
182
182
|
|
|
@@ -188,7 +188,7 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
|
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
|
|
191
|
-
var
|
|
191
|
+
var _chunkMQ4DYVFScjs = require('./chunk-MQ4DYVFS.cjs');
|
|
192
192
|
|
|
193
193
|
|
|
194
194
|
|
|
@@ -223,7 +223,7 @@ var _chunk4P5634G6cjs = require('./chunk-4P5634G6.cjs');
|
|
|
223
223
|
var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
224
224
|
|
|
225
225
|
|
|
226
|
-
var
|
|
226
|
+
var _chunkL6E4SHUBcjs = require('./chunk-L6E4SHUB.cjs');
|
|
227
227
|
|
|
228
228
|
|
|
229
229
|
|
|
@@ -270,6 +270,7 @@ var _chunkKORZ6PREcjs = require('./chunk-KORZ6PRE.cjs');
|
|
|
270
270
|
|
|
271
271
|
|
|
272
272
|
|
|
273
|
+
|
|
273
274
|
var _chunkIUKBPBM7cjs = require('./chunk-IUKBPBM7.cjs');
|
|
274
275
|
|
|
275
276
|
|
|
@@ -282,7 +283,7 @@ var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
|
282
283
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
283
284
|
|
|
284
285
|
|
|
285
|
-
var
|
|
286
|
+
var _chunkMEJCP2LXcjs = require('./chunk-MEJCP2LX.cjs');
|
|
286
287
|
|
|
287
288
|
|
|
288
289
|
var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
|
|
@@ -455,7 +456,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
455
456
|
isPathGuarded: options.isPathGuarded,
|
|
456
457
|
basePath
|
|
457
458
|
});
|
|
458
|
-
const apiHandler =
|
|
459
|
+
const apiHandler = _chunkUISZLYKYcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
459
460
|
rootDir: options.root,
|
|
460
461
|
srcDir: options.srcDir,
|
|
461
462
|
docs,
|
|
@@ -615,6 +616,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
615
616
|
function createFarmClientModulePreloadPlugin(options) {
|
|
616
617
|
return {
|
|
617
618
|
name: "farm-client-module-preloads",
|
|
619
|
+
enforce: "post",
|
|
618
620
|
async generateBundle(_output, bundle) {
|
|
619
621
|
await _promises2.default.mkdir(options.buildDir, { recursive: true });
|
|
620
622
|
await _promises2.default.writeFile(
|
|
@@ -689,6 +691,8 @@ function createFarmDocsModulePreloadPlugin(options) {
|
|
|
689
691
|
let runtimeModuleIds = [];
|
|
690
692
|
return {
|
|
691
693
|
name: "farm-docs-module-preloads",
|
|
694
|
+
// After Vite's CSS plugin deletes stylesheet-only chunks (see client-module-preloads.ts).
|
|
695
|
+
enforce: "post",
|
|
692
696
|
async buildStart() {
|
|
693
697
|
const resolved = await Promise.all(
|
|
694
698
|
options.modules.map((specifier) => this.resolve(specifier, options.importer))
|
|
@@ -730,7 +734,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
730
734
|
const routes = [];
|
|
731
735
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
732
736
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
733
|
-
const rendering = await
|
|
737
|
+
const rendering = await _chunkCSQPMV3Qcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
734
738
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
735
739
|
routes.push({
|
|
736
740
|
kind: "page",
|
|
@@ -953,12 +957,65 @@ function escapeRegExp(value) {
|
|
|
953
957
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
954
958
|
}
|
|
955
959
|
|
|
956
|
-
// src/nitro/
|
|
960
|
+
// src/nitro/immutable-assets.ts
|
|
961
|
+
|
|
957
962
|
var FARM_IMMUTABLE_ASSET_CACHE_CONTROL = "public, max-age=31536000, immutable";
|
|
963
|
+
var FARM_IMMUTABLE_ASSET_MAX_AGE = 31536e3;
|
|
964
|
+
var FARM_IMMUTABLE_ASSET_PATH_SOURCE = "^/(?:(?:assets|chunks)/(?:.+/)*[^/]+|farm-(?:mobile-)?client(?:-boot)?)-h(?:[a-fA-F0-9]{8}|[a-fA-F0-9]{12}|[a-fA-F0-9]{16})\\.(?!(?:[hH][tT][mM][lL]?)$)[^/]+$";
|
|
965
|
+
var FARM_IMMUTABLE_ASSET_PATH = new RegExp(FARM_IMMUTABLE_ASSET_PATH_SOURCE);
|
|
966
|
+
function isFarmImmutableAssetPath(pathname) {
|
|
967
|
+
return FARM_IMMUTABLE_ASSET_PATH.test(pathname);
|
|
968
|
+
}
|
|
969
|
+
var FARM_HASHED_ASSET_DIRS = ["assets", "chunks"];
|
|
970
|
+
var LITERAL_ROUTE_PATH = /^\/[\w.~@/-]+$/;
|
|
971
|
+
function planFarmImmutableAssets(options) {
|
|
972
|
+
const cacheRulePatterns = Object.entries(_nullishCoalesce(options.routeRules, () => ( {}))).filter(
|
|
973
|
+
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess', _16 => _16.headers]), () => ( {}))).some((name) => name.toLowerCase() === "cache-control")
|
|
974
|
+
).map(([pattern]) => pattern);
|
|
975
|
+
const isImmutable = (file) => isFarmImmutableAssetPath(file) && !cacheRulePatterns.some((pattern) => _chunkIUKBPBM7cjs.farmRouteRuleMatches.call(void 0, pattern, file));
|
|
976
|
+
const routeDirs = new Set(
|
|
977
|
+
(_nullishCoalesce(options.routePaths, () => ( []))).map((routePath) => routePath.split("/").filter(Boolean)[0])
|
|
978
|
+
);
|
|
979
|
+
const plan = { publicAssets: [], routeRules: {} };
|
|
980
|
+
const addRule = (file) => {
|
|
981
|
+
if (!LITERAL_ROUTE_PATH.test(file)) return;
|
|
982
|
+
plan.routeRules[file] = { headers: { "cache-control": FARM_IMMUTABLE_ASSET_CACHE_CONTROL } };
|
|
983
|
+
};
|
|
984
|
+
const dirFiles = /* @__PURE__ */ new Map();
|
|
985
|
+
for (const file of options.files) {
|
|
986
|
+
const dir = file.split("/")[1];
|
|
987
|
+
if (file.split("/").length > 2 && FARM_HASHED_ASSET_DIRS.includes(dir)) {
|
|
988
|
+
dirFiles.set(dir, [..._nullishCoalesce(dirFiles.get(dir), () => ( [])), file]);
|
|
989
|
+
} else if (isImmutable(file)) {
|
|
990
|
+
addRule(file);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
for (const [dir, files] of dirFiles) {
|
|
994
|
+
if (!routeDirs.has(dir) && files.every(isImmutable)) {
|
|
995
|
+
plan.publicAssets.push({
|
|
996
|
+
dir: _path2.default.join(options.clientOutputDir, dir),
|
|
997
|
+
baseURL: `/${dir}`,
|
|
998
|
+
maxAge: FARM_IMMUTABLE_ASSET_MAX_AGE
|
|
999
|
+
});
|
|
1000
|
+
} else {
|
|
1001
|
+
for (const file of files) if (isImmutable(file)) addRule(file);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return plan;
|
|
1005
|
+
}
|
|
1006
|
+
async function listFarmClientOutputFiles(dir) {
|
|
1007
|
+
const fs4 = await import("fs/promises");
|
|
1008
|
+
const entries = await fs4.readdir(dir, { recursive: true, withFileTypes: true }).catch(() => []);
|
|
1009
|
+
return entries.filter((entry) => entry.isFile()).map((entry) => {
|
|
1010
|
+
const relative = _path2.default.relative(dir, _path2.default.join(entry.parentPath, entry.name));
|
|
1011
|
+
return `/${relative.split(_path2.default.sep).join("/")}`;
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// src/nitro/vercel-assets.ts
|
|
958
1016
|
function createFarmVercelImmutableAssetRoute() {
|
|
959
|
-
const fingerprint = "-h(?:[a-fA-F0-9]{8}|[a-fA-F0-9]{12}|[a-fA-F0-9]{16})";
|
|
960
1017
|
return {
|
|
961
|
-
src:
|
|
1018
|
+
src: FARM_IMMUTABLE_ASSET_PATH_SOURCE,
|
|
962
1019
|
headers: {
|
|
963
1020
|
"Cache-Control": FARM_IMMUTABLE_ASSET_CACHE_CONTROL
|
|
964
1021
|
},
|
|
@@ -1015,7 +1072,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
|
1015
1072
|
function replaceServerFileReferences(bundle, chunkFileName, code, replace) {
|
|
1016
1073
|
return code.replace(SERVER_FILE_URL_RE, (reference, _quote, relativeUrl) => {
|
|
1017
1074
|
const target = resolveBundleFileName(chunkFileName, relativeUrl);
|
|
1018
|
-
return target && _optionalChain([bundle, 'access',
|
|
1075
|
+
return target && _optionalChain([bundle, 'access', _17 => _17[target], 'optionalAccess', _18 => _18.type]) === "asset" ? replace(target) : reference;
|
|
1019
1076
|
});
|
|
1020
1077
|
}
|
|
1021
1078
|
function collectServerReadSSRAssets(bundle) {
|
|
@@ -1068,7 +1125,7 @@ function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
|
1068
1125
|
if (assets.length === 0) return;
|
|
1069
1126
|
const sources = assets.map((fileName) => {
|
|
1070
1127
|
const output = bundle[fileName];
|
|
1071
|
-
const original = _optionalChain([output, 'optionalAccess',
|
|
1128
|
+
const original = _optionalChain([output, 'optionalAccess', _19 => _19.type]) === "asset" ? _optionalChain([output, 'access', _20 => _20.originalFileNames, 'optionalAccess', _21 => _21[0]]) : void 0;
|
|
1072
1129
|
if (!original) return fileName;
|
|
1073
1130
|
return _path2.default.relative(root, _path2.default.resolve(root, original)).split(_path2.default.sep).join("/");
|
|
1074
1131
|
});
|
|
@@ -1087,7 +1144,7 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
|
|
|
1087
1144
|
transform(code, id) {
|
|
1088
1145
|
if (!code.includes("import.meta.url")) return null;
|
|
1089
1146
|
const chunkFileName = _path2.default.relative(ssrOutputDir, id.split("?", 1)[0]).split(_path2.default.sep).join("/");
|
|
1090
|
-
if (_optionalChain([bundle, 'access',
|
|
1147
|
+
if (_optionalChain([bundle, 'access', _22 => _22[chunkFileName], 'optionalAccess', _23 => _23.type]) !== "chunk") return null;
|
|
1091
1148
|
let changed = false;
|
|
1092
1149
|
const transformed = replaceServerFileReferences(
|
|
1093
1150
|
bundle,
|
|
@@ -1183,7 +1240,7 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
1183
1240
|
var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
|
|
1184
1241
|
var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
|
|
1185
1242
|
function isConfigObject(node) {
|
|
1186
|
-
return _optionalChain([node, 'optionalAccess',
|
|
1243
|
+
return _optionalChain([node, 'optionalAccess', _24 => _24.type]) === "ObjectExpression";
|
|
1187
1244
|
}
|
|
1188
1245
|
function propertyName(property) {
|
|
1189
1246
|
if (property.type !== "Property" || property.computed) return void 0;
|
|
@@ -1204,7 +1261,7 @@ function collectConfigObjects(node, found) {
|
|
|
1204
1261
|
}
|
|
1205
1262
|
if (current.type === "CallExpression") {
|
|
1206
1263
|
const callee = current.callee;
|
|
1207
|
-
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access',
|
|
1264
|
+
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _25 => _25.property, 'optionalAccess', _26 => _26.name]);
|
|
1208
1265
|
const argument = current.arguments[0];
|
|
1209
1266
|
if (name && CONFIG_FACTORIES.has(name) && isConfigObject(argument)) found.push(argument);
|
|
1210
1267
|
}
|
|
@@ -1237,7 +1294,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1237
1294
|
const trailingComma = /^\s*,/.exec(code.slice(properties[last].end));
|
|
1238
1295
|
removals.push([
|
|
1239
1296
|
properties[first].start,
|
|
1240
|
-
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess',
|
|
1297
|
+
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _27 => _27[0], 'access', _28 => _28.length]), () => ( 0)))
|
|
1241
1298
|
]);
|
|
1242
1299
|
}
|
|
1243
1300
|
first = last;
|
|
@@ -1264,7 +1321,7 @@ function farmStripPlatformConfigPlugin(configFiles) {
|
|
|
1264
1321
|
// removed block used (`readFileSync` for a version, say).
|
|
1265
1322
|
enforce: "pre",
|
|
1266
1323
|
transform: {
|
|
1267
|
-
filter: { id:
|
|
1324
|
+
filter: { id: _chunkKWST2O22cjs.fileNamePattern.call(void 0, configFiles) },
|
|
1268
1325
|
async handler(code, id) {
|
|
1269
1326
|
const file = id.split("?", 1)[0];
|
|
1270
1327
|
if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
|
|
@@ -1316,7 +1373,7 @@ function literalMatcher(node) {
|
|
|
1316
1373
|
if (node.type === "Literal" && node.regex)
|
|
1317
1374
|
return new RegExp(node.regex.pattern, node.regex.flags);
|
|
1318
1375
|
if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
|
|
1319
|
-
return _nullishCoalesce(_optionalChain([node, 'access',
|
|
1376
|
+
return _nullishCoalesce(_optionalChain([node, 'access', _29 => _29.quasis, 'access', _30 => _30[0], 'optionalAccess', _31 => _31.value, 'optionalAccess', _32 => _32.cooked]), () => ( void 0));
|
|
1320
1377
|
}
|
|
1321
1378
|
return void 0;
|
|
1322
1379
|
}
|
|
@@ -1340,7 +1397,7 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1340
1397
|
let found = null;
|
|
1341
1398
|
for (const statement of program.body) {
|
|
1342
1399
|
if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
|
|
1343
|
-
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access',
|
|
1400
|
+
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _33 => _33.exported, 'optionalAccess', _34 => _34.name]) === "config")) {
|
|
1344
1401
|
return "unknown";
|
|
1345
1402
|
}
|
|
1346
1403
|
continue;
|
|
@@ -1348,14 +1405,14 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1348
1405
|
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
|
|
1349
1406
|
if (!declaration || declaration.type !== "VariableDeclaration") continue;
|
|
1350
1407
|
for (const declarator of declaration.declarations) {
|
|
1351
|
-
if (_optionalChain([declarator, 'access',
|
|
1408
|
+
if (_optionalChain([declarator, 'access', _35 => _35.id, 'optionalAccess', _36 => _36.type]) !== "Identifier" || declarator.id.name !== "config") continue;
|
|
1352
1409
|
if (declaration.kind !== "const" || !declarator.init) return "unknown";
|
|
1353
1410
|
const init = unwrap(declarator.init);
|
|
1354
1411
|
if (init.type !== "ObjectExpression") return "unknown";
|
|
1355
1412
|
const config = {};
|
|
1356
1413
|
for (const property of init.properties) {
|
|
1357
1414
|
if (property.type !== "Property" || property.computed) return "unknown";
|
|
1358
|
-
const key = _nullishCoalesce(_optionalChain([property, 'access',
|
|
1415
|
+
const key = _nullishCoalesce(_optionalChain([property, 'access', _37 => _37.key, 'optionalAccess', _38 => _38.name]), () => ( _optionalChain([property, 'access', _39 => _39.key, 'optionalAccess', _40 => _40.value])));
|
|
1359
1416
|
if (key === "runtime") {
|
|
1360
1417
|
const runtime = literalMatcher(unwrap(property.value));
|
|
1361
1418
|
if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
|
|
@@ -1376,7 +1433,7 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1376
1433
|
try {
|
|
1377
1434
|
const [{ readFile }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1378
1435
|
const parsed = vite.parseSync(filePath, await readFile(filePath, "utf8"));
|
|
1379
|
-
if (_optionalChain([parsed, 'access',
|
|
1436
|
+
if (_optionalChain([parsed, 'access', _41 => _41.errors, 'optionalAccess', _42 => _42.length])) return "unknown";
|
|
1380
1437
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1381
1438
|
} catch (e9) {
|
|
1382
1439
|
return "unknown";
|
|
@@ -1395,7 +1452,7 @@ function farmTargetRunsEdgeMiddleware(preset) {
|
|
|
1395
1452
|
return preset === "vercel";
|
|
1396
1453
|
}
|
|
1397
1454
|
function isFarmEdgeMiddlewareRoute(route) {
|
|
1398
|
-
return typeof route.config === "object" && _optionalChain([route, 'access',
|
|
1455
|
+
return typeof route.config === "object" && _optionalChain([route, 'access', _43 => _43.config, 'optionalAccess', _44 => _44.runtime]) === "edge";
|
|
1399
1456
|
}
|
|
1400
1457
|
function escapeRegExp3(value) {
|
|
1401
1458
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -1433,7 +1490,7 @@ export default createFarmVercelEdgeMiddleware({
|
|
|
1433
1490
|
${modules.join("\n")}
|
|
1434
1491
|
],
|
|
1435
1492
|
i18n: ${JSON.stringify(config.i18n)},
|
|
1436
|
-
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access',
|
|
1493
|
+
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _45 => _45.server, 'optionalAccess', _46 => _46.trustProxy]) === true })},
|
|
1437
1494
|
apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
1438
1495
|
notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
|
|
1439
1496
|
pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
|
|
@@ -1492,7 +1549,7 @@ async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
|
1492
1549
|
logLevel: "silent",
|
|
1493
1550
|
plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
|
|
1494
1551
|
resolve: {
|
|
1495
|
-
alias:
|
|
1552
|
+
alias: _chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
1496
1553
|
conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
|
|
1497
1554
|
},
|
|
1498
1555
|
transform: {
|
|
@@ -1711,7 +1768,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1711
1768
|
return {
|
|
1712
1769
|
name: "farm-prerender-runtime-resolver",
|
|
1713
1770
|
async resolveId(id, _importer, options) {
|
|
1714
|
-
if (_optionalChain([options, 'access',
|
|
1771
|
+
if (_optionalChain([options, 'access', _47 => _47.custom, 'optionalAccess', _48 => _48.farmPrerenderRuntimeResolve])) return null;
|
|
1715
1772
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
1716
1773
|
return null;
|
|
1717
1774
|
}
|
|
@@ -1881,7 +1938,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
1881
1938
|
return {
|
|
1882
1939
|
name: "farm-omitted-metadata-image-runtime",
|
|
1883
1940
|
resolveId: {
|
|
1884
|
-
filter: { id:
|
|
1941
|
+
filter: { id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
|
|
1885
1942
|
handler(source, importer) {
|
|
1886
1943
|
if (source !== "@vercel/og") return null;
|
|
1887
1944
|
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
|
|
@@ -1890,7 +1947,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
1890
1947
|
}
|
|
1891
1948
|
},
|
|
1892
1949
|
load: {
|
|
1893
|
-
filter: { id:
|
|
1950
|
+
filter: { id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
|
|
1894
1951
|
handler(id) {
|
|
1895
1952
|
if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
|
|
1896
1953
|
return `
|
|
@@ -1918,8 +1975,8 @@ function readVercelOgManifest(file) {
|
|
|
1918
1975
|
}
|
|
1919
1976
|
function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
1920
1977
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
1921
|
-
const entry = _optionalChain([vercelOg, 'optionalAccess',
|
|
1922
|
-
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess',
|
|
1978
|
+
const entry = _optionalChain([vercelOg, 'optionalAccess', _49 => _49.manifest, 'access', _50 => _50.exports, 'optionalAccess', _51 => _51["."], 'optionalAccess', _52 => _52[condition]]);
|
|
1979
|
+
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _53 => _53.default]);
|
|
1923
1980
|
return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
|
|
1924
1981
|
}
|
|
1925
1982
|
function createEdgeMetadataImageRuntimePlugin({
|
|
@@ -1935,7 +1992,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
1935
1992
|
const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
|
|
1936
1993
|
return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
|
|
1937
1994
|
}
|
|
1938
|
-
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
1995
|
+
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _54 => _54.replace, 'call', _55 => _55(/\\/g, "/"), 'access', _56 => _56.includes, 'call', _57 => _57("/@vercel/og/")])) {
|
|
1939
1996
|
return null;
|
|
1940
1997
|
}
|
|
1941
1998
|
const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
|
|
@@ -1957,7 +2014,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
1957
2014
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
1958
2015
|
});
|
|
1959
2016
|
if (inlined !== code) return { code: inlined, map: null };
|
|
1960
|
-
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call',
|
|
2017
|
+
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _58 => _58(file), 'optionalAccess', _59 => _59.manifest, 'access', _60 => _60.version]), () => ( "(unknown version)"));
|
|
1961
2018
|
this.error(
|
|
1962
2019
|
`@vercel/og ${version} cannot be bundled for ${runtime}: ${file} does not load its default font with fetch(new URL("./<font>.ttf", import.meta.url)), the pattern Farm inlines because an edge function cannot fetch it. Install a @vercel/og version whose edge build does, such as 1.0.1.`
|
|
1963
2020
|
);
|
|
@@ -1968,7 +2025,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
1968
2025
|
return {
|
|
1969
2026
|
name: "farm-metadata-image-wasm",
|
|
1970
2027
|
resolveId(source, importer) {
|
|
1971
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2028
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _61 => _61.replace, 'call', _62 => _62(/\\/g, "/"), 'access', _63 => _63.includes, 'call', _64 => _64("/@vercel/og/")])) {
|
|
1972
2029
|
return null;
|
|
1973
2030
|
}
|
|
1974
2031
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -2044,9 +2101,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
2044
2101
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
2045
2102
|
}
|
|
2046
2103
|
function nameCodeSplittingGroups(bundlerConfig) {
|
|
2047
|
-
const outputs = _optionalChain([bundlerConfig, 'optionalAccess',
|
|
2104
|
+
const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _65 => _65.output]);
|
|
2048
2105
|
for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
|
|
2049
|
-
const groups = _optionalChain([output, 'optionalAccess',
|
|
2106
|
+
const groups = _optionalChain([output, 'optionalAccess', _66 => _66.codeSplitting, 'optionalAccess', _67 => _67.groups]);
|
|
2050
2107
|
if (!Array.isArray(groups)) continue;
|
|
2051
2108
|
groups.forEach((group, index) => {
|
|
2052
2109
|
if (group && typeof group.name === "function" && !group.debugName) {
|
|
@@ -2102,9 +2159,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
2102
2159
|
if (needsAst) {
|
|
2103
2160
|
replacements.length = 0;
|
|
2104
2161
|
const restore = (node) => {
|
|
2105
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
2162
|
+
if (_optionalChain([node, 'optionalAccess', _68 => _68.type]) !== "TemplateLiteral") return;
|
|
2106
2163
|
const template = node;
|
|
2107
|
-
const value = _optionalChain([template, 'access',
|
|
2164
|
+
const value = _optionalChain([template, 'access', _69 => _69.quasis, 'access', _70 => _70[0], 'optionalAccess', _71 => _71.value, 'access', _72 => _72.cooked]);
|
|
2108
2165
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
2109
2166
|
replacements.push({
|
|
2110
2167
|
start: template.start,
|
|
@@ -2262,7 +2319,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2262
2319
|
return Array.from(routes.values()).sort(_chunkMHLNWRCJcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
2263
2320
|
}
|
|
2264
2321
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
2265
|
-
if (!_optionalChain([config, 'access',
|
|
2322
|
+
if (!_optionalChain([config, 'access', _73 => _73.docs, 'optionalAccess', _74 => _74.enabled]) || !_optionalChain([config, 'access', _75 => _75.docs, 'access', _76 => _76.adapter, 'optionalAccess', _77 => _77.server]) || _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
2266
2323
|
return;
|
|
2267
2324
|
}
|
|
2268
2325
|
throw new Error(
|
|
@@ -2275,7 +2332,6 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
2275
2332
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
2276
2333
|
const srcDir = config.srcDir || "src";
|
|
2277
2334
|
const distDir = config.distDir || ".farm";
|
|
2278
|
-
const deployOutputDir = _chunkXYVPTTUTcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
2279
2335
|
const lifecyclePluginManager = options.pluginManager;
|
|
2280
2336
|
const productionViteResultPromise = Promise.allSettled([
|
|
2281
2337
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -2294,7 +2350,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
2294
2350
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
2295
2351
|
const pageRoutes = [];
|
|
2296
2352
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
2297
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
2353
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
2298
2354
|
pageRoutes.push({
|
|
2299
2355
|
pattern,
|
|
2300
2356
|
...entry.directory ? { directory: entry.directory } : {},
|
|
@@ -2500,7 +2556,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2500
2556
|
_chunkQMNWKQL4cjs.logger.error(`\u274C Build failed: ${error}`);
|
|
2501
2557
|
throw error;
|
|
2502
2558
|
} finally {
|
|
2503
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
2559
|
+
_optionalChain([rendererBuild, 'optionalAccess', _78 => _78.abort, 'call', _79 => _79()]);
|
|
2504
2560
|
}
|
|
2505
2561
|
}
|
|
2506
2562
|
function shouldBuildFarmMobileClient(config) {
|
|
@@ -2510,7 +2566,7 @@ function varyFarmNitroCacheRules(rules, headerNames) {
|
|
|
2510
2566
|
if (headerNames.length === 0) return rules;
|
|
2511
2567
|
return Object.fromEntries(
|
|
2512
2568
|
Object.entries(rules).map(([source, rule]) => {
|
|
2513
|
-
const cached = _optionalChain([rule, 'optionalAccess',
|
|
2569
|
+
const cached = _optionalChain([rule, 'optionalAccess', _80 => _80.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _81 => _81.cache]) !== void 0 && rule.cache !== false;
|
|
2514
2570
|
if (!cached || rule.cache === false) return [source, rule];
|
|
2515
2571
|
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
2516
2572
|
const varies = [
|
|
@@ -2563,7 +2619,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2563
2619
|
}
|
|
2564
2620
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
2565
2621
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
2566
|
-
await fs4.writeFile(clientCssPath,
|
|
2622
|
+
await fs4.writeFile(clientCssPath, _chunkKWST2O22cjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
2567
2623
|
}
|
|
2568
2624
|
function importsFarmClientBlockedPackage(id, packageName) {
|
|
2569
2625
|
return id === packageName || id.startsWith(`${packageName}/`);
|
|
@@ -2616,7 +2672,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
2616
2672
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${_path2.default.resolve(modulePath)}`;
|
|
2617
2673
|
let plan = cache.get(key);
|
|
2618
2674
|
if (!plan) {
|
|
2619
|
-
plan =
|
|
2675
|
+
plan = _chunk2IFT2CSAcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2620
2676
|
cache.set(key, plan);
|
|
2621
2677
|
}
|
|
2622
2678
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -2625,7 +2681,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2625
2681
|
if (!mobile) await _chunkE5UN4OWXcjs.removeFarmMobileClientManifest.call(void 0, _path2.default.dirname(outputDir));
|
|
2626
2682
|
const viteBuild = productionVite.build;
|
|
2627
2683
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
2628
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
2684
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-5PIQQVRP.cjs");
|
|
2629
2685
|
const fs4 = await import("fs/promises");
|
|
2630
2686
|
const pluginManager = new PluginManager2({
|
|
2631
2687
|
config,
|
|
@@ -2640,25 +2696,25 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2640
2696
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2641
2697
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2642
2698
|
);
|
|
2643
|
-
if (_optionalChain([config, 'access',
|
|
2699
|
+
if (_optionalChain([config, 'access', _82 => _82.experimental, 'optionalAccess', _83 => _83.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _84 => _84.experimental, 'optionalAccess', _85 => _85.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2644
2700
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2645
2701
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2646
2702
|
);
|
|
2647
2703
|
}
|
|
2648
|
-
const isolatedMode =
|
|
2649
|
-
_optionalChain([config, 'access',
|
|
2704
|
+
const isolatedMode = _chunk2IFT2CSAcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2705
|
+
_optionalChain([config, 'access', _86 => _86.experimental, 'optionalAccess', _87 => _87.isolatedClientHydration]),
|
|
2650
2706
|
{
|
|
2651
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2707
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _88 => _88.experimental, 'optionalAccess', _89 => _89.serverComponents])) === "rsc",
|
|
2652
2708
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2653
2709
|
}
|
|
2654
2710
|
);
|
|
2655
|
-
const planOptions =
|
|
2711
|
+
const planOptions = _chunk2IFT2CSAcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2656
2712
|
config.renderer,
|
|
2657
2713
|
Boolean(unsupportedIntegrationProvider)
|
|
2658
2714
|
);
|
|
2659
2715
|
const pagePlanOptions = {
|
|
2660
2716
|
...planOptions,
|
|
2661
|
-
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2717
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.serverComponents])) === "islands"
|
|
2662
2718
|
};
|
|
2663
2719
|
const layoutPlanOptions = {
|
|
2664
2720
|
...planOptions,
|
|
@@ -2711,20 +2767,20 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2711
2767
|
});
|
|
2712
2768
|
const layoutAppliesToRoute = _chunk2MR4MABGcjs.routeBoundaryCoversDirectory;
|
|
2713
2769
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
2714
|
-
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2770
|
+
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _92 => _92.experimental, 'optionalAccess', _93 => _93.serverComponents])) === "islands";
|
|
2715
2771
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2716
|
-
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
2772
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _94 => _94.docs, 'optionalAccess', _95 => _95.enabled]) && _optionalChain([config, 'access', _96 => _96.docs, 'access', _97 => _97.adapter, 'optionalAccess', _98 => _98.server]) && config.docs.adapter.react
|
|
2717
2773
|
);
|
|
2718
|
-
const docsEntries = _optionalChain([config, 'access',
|
|
2774
|
+
const docsEntries = _optionalChain([config, 'access', _99 => _99.docs, 'optionalAccess', _100 => _100.enabled]) ? _chunkNAXKOTPPcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
2719
2775
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
2720
2776
|
) : [];
|
|
2721
2777
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
2722
2778
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
2723
2779
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
2724
2780
|
);
|
|
2725
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
2781
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _101 => _101.docs, 'optionalAccess', _102 => _102.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2726
2782
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2727
|
-
const markdownPagePlan =
|
|
2783
|
+
const markdownPagePlan = _chunk2IFT2CSAcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2728
2784
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2729
2785
|
root,
|
|
2730
2786
|
isolatedMode,
|
|
@@ -2732,7 +2788,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2732
2788
|
);
|
|
2733
2789
|
const routePlans = pageRoutes.map((route) => ({
|
|
2734
2790
|
route,
|
|
2735
|
-
metadata:
|
|
2791
|
+
metadata: _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2736
2792
|
route.modulePath,
|
|
2737
2793
|
root,
|
|
2738
2794
|
isolatedMode,
|
|
@@ -2740,7 +2796,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2740
2796
|
pagePlanOptions
|
|
2741
2797
|
)
|
|
2742
2798
|
}));
|
|
2743
|
-
|
|
2799
|
+
_chunk2IFT2CSAcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2744
2800
|
clientLayouts.map((layout) => ({
|
|
2745
2801
|
pattern: layout.pattern,
|
|
2746
2802
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2773,7 +2829,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2773
2829
|
for (const layout of clientLayouts) {
|
|
2774
2830
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
2775
2831
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2776
|
-
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${
|
|
2832
|
+
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${_chunk2IFT2CSAcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2777
2833
|
}
|
|
2778
2834
|
}
|
|
2779
2835
|
if (isolatedMode === "analyze") {
|
|
@@ -2807,7 +2863,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2807
2863
|
);
|
|
2808
2864
|
if (metadata.suppressedAsyncHydration) {
|
|
2809
2865
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2810
|
-
`\u26A0\uFE0F ${
|
|
2866
|
+
`\u26A0\uFE0F ${_chunk2IFT2CSAcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2811
2867
|
);
|
|
2812
2868
|
}
|
|
2813
2869
|
const slotBoundaries = serverSlotPlans.filter(
|
|
@@ -2815,7 +2871,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2815
2871
|
).flatMap(({ plan }) => plan.isolatedBoundaries);
|
|
2816
2872
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
|
|
2817
2873
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
2818
|
-
const islandStrategy =
|
|
2874
|
+
const islandStrategy = _chunkKWST2O22cjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
2819
2875
|
route,
|
|
2820
2876
|
metadata,
|
|
2821
2877
|
clientLayouts,
|
|
@@ -2834,7 +2890,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2834
2890
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
2835
2891
|
],
|
|
2836
2892
|
// The server renders a server tree only below a hydrating layout.
|
|
2837
|
-
...
|
|
2893
|
+
..._chunk2IFT2CSAcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2838
2894
|
});
|
|
2839
2895
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2840
2896
|
}
|
|
@@ -2871,7 +2927,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2871
2927
|
}
|
|
2872
2928
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2873
2929
|
try {
|
|
2874
|
-
const metadata =
|
|
2930
|
+
const metadata = _chunk2IFT2CSAcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
|
|
2875
2931
|
return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
|
|
2876
2932
|
} catch (error) {
|
|
2877
2933
|
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
@@ -2894,8 +2950,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2894
2950
|
srcDir,
|
|
2895
2951
|
adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2896
2952
|
adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2897
|
-
_optionalChain([config, 'access',
|
|
2898
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access',
|
|
2953
|
+
_optionalChain([config, 'access', _103 => _103.docs, 'optionalAccess', _104 => _104.enabled]) ? _chunkNAXKOTPPcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
2954
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _105 => _105.docs, 'access', _106 => _106.adapter, 'optionalAccess', _107 => _107.react]) : void 0,
|
|
2899
2955
|
config.i18n,
|
|
2900
2956
|
config.plugins,
|
|
2901
2957
|
config.renderer,
|
|
@@ -2903,11 +2959,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2903
2959
|
config.trailingSlash,
|
|
2904
2960
|
_chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2905
2961
|
config.basePath,
|
|
2906
|
-
|
|
2962
|
+
_chunkKWST2O22cjs.generateClientCachePersistenceCode.call(void 0, _chunkKWST2O22cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2907
2963
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2908
|
-
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2964
|
+
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _108 => _108.experimental, 'optionalAccess', _109 => _109.serverComponents])) === "islands",
|
|
2909
2965
|
platform,
|
|
2910
|
-
islandsMode ?
|
|
2966
|
+
islandsMode ? _chunk2IFT2CSAcjs.collectFarmServerStylesheets.call(void 0,
|
|
2911
2967
|
[
|
|
2912
2968
|
...layoutRoutes.map((layout) => layout.modulePath),
|
|
2913
2969
|
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
@@ -2922,7 +2978,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2922
2978
|
await fs4.writeFile(_path2.default.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
|
|
2923
2979
|
}
|
|
2924
2980
|
const clientInput = { [entryName]: clientEntryPath };
|
|
2925
|
-
if (platform === "web" &&
|
|
2981
|
+
if (platform === "web" && _chunkKWST2O22cjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
2926
2982
|
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
2927
2983
|
await fs4.writeFile(
|
|
2928
2984
|
clientBootPath,
|
|
@@ -2965,7 +3021,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2965
3021
|
outDir: outputDir,
|
|
2966
3022
|
emptyOutDir: platform === "web",
|
|
2967
3023
|
// Never public: see resolveFarmClientSourcemap.
|
|
2968
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
3024
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _110 => _110.vite, 'optionalAccess', _111 => _111.build, 'optionalAccess', _112 => _112.sourcemap])),
|
|
2969
3025
|
assetsInlineLimit: 0,
|
|
2970
3026
|
cssCodeSplit: false,
|
|
2971
3027
|
// Bundle all CSS into one file
|
|
@@ -2977,7 +3033,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2977
3033
|
hashCharacters: "hex",
|
|
2978
3034
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2979
3035
|
assetFileNames: (assetInfo) => {
|
|
2980
|
-
if (_optionalChain([assetInfo, 'access',
|
|
3036
|
+
if (_optionalChain([assetInfo, 'access', _113 => _113.name, 'optionalAccess', _114 => _114.endsWith, 'call', _115 => _115(".css")])) {
|
|
2981
3037
|
return `${entryName}.css`;
|
|
2982
3038
|
}
|
|
2983
3039
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -2994,7 +3050,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2994
3050
|
}
|
|
2995
3051
|
},
|
|
2996
3052
|
plugins: [
|
|
2997
|
-
|
|
3053
|
+
_chunkKWST2O22cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2998
3054
|
createFarmPrivateClientSourcemapsPlugin({
|
|
2999
3055
|
outDir: _path2.default.join(
|
|
3000
3056
|
_path2.default.dirname(outputDir),
|
|
@@ -3026,7 +3082,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3026
3082
|
...rendererVitePlugins,
|
|
3027
3083
|
...config.vite.plugins || [],
|
|
3028
3084
|
farmServerOnlyEntriesPlugin({ platform }),
|
|
3029
|
-
|
|
3085
|
+
_chunkKWST2O22cjs.farmDocsClientConfigPlugin.call(void 0,
|
|
3030
3086
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
3031
3087
|
),
|
|
3032
3088
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
@@ -3059,7 +3115,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3059
3115
|
},
|
|
3060
3116
|
load: {
|
|
3061
3117
|
filter: {
|
|
3062
|
-
id:
|
|
3118
|
+
id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, [
|
|
3063
3119
|
"\0empty-module",
|
|
3064
3120
|
"\0empty-api-route",
|
|
3065
3121
|
"\0farm-i18n-client-bridge",
|
|
@@ -3096,7 +3152,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3096
3152
|
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
|
|
3097
3153
|
pluginManager
|
|
3098
3154
|
),
|
|
3099
|
-
|
|
3155
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
3100
3156
|
],
|
|
3101
3157
|
mode: "production",
|
|
3102
3158
|
css: postcssSearchPath ? {
|
|
@@ -3104,7 +3160,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3104
3160
|
} : void 0,
|
|
3105
3161
|
// Ensure React is bundled for client
|
|
3106
3162
|
resolve: {
|
|
3107
|
-
alias:
|
|
3163
|
+
alias: _chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
3108
3164
|
dedupe: [...config.renderer.dedupe || []]
|
|
3109
3165
|
},
|
|
3110
3166
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -3117,7 +3173,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3117
3173
|
]
|
|
3118
3174
|
}
|
|
3119
3175
|
};
|
|
3120
|
-
await viteBuild(
|
|
3176
|
+
await viteBuild(
|
|
3177
|
+
_chunkKWST2O22cjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite, { clientOutput: true })
|
|
3178
|
+
);
|
|
3121
3179
|
if (platform === "mobile") {
|
|
3122
3180
|
await fs4.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
3123
3181
|
if (!await _chunkE5UN4OWXcjs.hasFarmMobileClientEntry.call(void 0, _path2.default.dirname(outputDir), outputDir)) {
|
|
@@ -3217,7 +3275,7 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
3217
3275
|
return response;
|
|
3218
3276
|
}
|
|
3219
3277
|
|
|
3220
|
-
${streamNavigations ?
|
|
3278
|
+
${streamNavigations ? _chunkKWST2O22cjs.FARM_NAVIGATION_STREAM_READER_SOURCE : ""}
|
|
3221
3279
|
|
|
3222
3280
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
3223
3281
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -4079,7 +4137,7 @@ function readFarmEntryImports(source) {
|
|
|
4079
4137
|
for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
|
|
4080
4138
|
const from = match[2];
|
|
4081
4139
|
const named = /\{([^}]*)\}/.exec(match[1]);
|
|
4082
|
-
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess',
|
|
4140
|
+
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _116 => _116[1], 'optionalAccess', _117 => _117.split, 'call', _118 => _118(",")]), () => ( []))) {
|
|
4083
4141
|
const [imported, local] = specifier.trim().split(/\s+as\s+/);
|
|
4084
4142
|
if (imported)
|
|
4085
4143
|
bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
|
|
@@ -4186,7 +4244,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4186
4244
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
4187
4245
|
import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appSetupPath))};
|
|
4188
4246
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
4189
|
-
const providerClientCode =
|
|
4247
|
+
const providerClientCode = _chunkKWST2O22cjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
4190
4248
|
integrationProviders,
|
|
4191
4249
|
root,
|
|
4192
4250
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -4307,7 +4365,7 @@ mountFarmDocsSearch();
|
|
|
4307
4365
|
|
|
4308
4366
|
${generateUniversalRouterStateRuntime()}
|
|
4309
4367
|
|
|
4310
|
-
${
|
|
4368
|
+
${_chunkKWST2O22cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
4311
4369
|
|
|
4312
4370
|
// SPA Router for server-rendered pages (HTML swap)
|
|
4313
4371
|
const spaRouter = {
|
|
@@ -4631,7 +4689,8 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
4631
4689
|
return await createFarmServerTreeElement(React, source, {
|
|
4632
4690
|
load: loadFarmIsolatedBoundary,
|
|
4633
4691
|
ServerHtml: FarmServerPage,
|
|
4634
|
-
key:
|
|
4692
|
+
// No key: the next page of the same layout updates this one in place, as React Server
|
|
4693
|
+
// Components do, instead of unmounting it and building every node again.
|
|
4635
4694
|
});
|
|
4636
4695
|
} catch (error) {
|
|
4637
4696
|
console.warn("[Farm.js] Could not rebuild the server tree of " + pathname + "; its server HTML was kept.", error);
|
|
@@ -4743,7 +4802,7 @@ function hasHydratableLayout(pathname) {
|
|
|
4743
4802
|
});
|
|
4744
4803
|
}
|
|
4745
4804
|
|
|
4746
|
-
${
|
|
4805
|
+
${_chunkKWST2O22cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
4747
4806
|
// Wrap a page element with applicable layouts
|
|
4748
4807
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
4749
4808
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4778,7 +4837,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
4778
4837
|
return React.createElement("div", props, pageElement);
|
|
4779
4838
|
}
|
|
4780
4839
|
let farmLastRouteState = null;
|
|
4781
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
4840
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkKWST2O22cjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
4782
4841
|
function farmTreeLayoutsOf(pathname) {
|
|
4783
4842
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
4784
4843
|
return layout.serverTree === true;
|
|
@@ -5342,7 +5401,7 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
|
|
|
5342
5401
|
return true;
|
|
5343
5402
|
}` : ""}
|
|
5344
5403
|
|
|
5345
|
-
${
|
|
5404
|
+
${_chunkKWST2O22cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
5346
5405
|
|
|
5347
5406
|
function activateNavigationScripts(root) {
|
|
5348
5407
|
for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
|
|
@@ -5445,7 +5504,7 @@ function getLayoutShell(root, patterns, index) {
|
|
|
5445
5504
|
return shell.innerHTML;
|
|
5446
5505
|
}
|
|
5447
5506
|
|
|
5448
|
-
${islandValues ?
|
|
5507
|
+
${islandValues ? _chunkKWST2O22cjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
5449
5508
|
// A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
|
|
5450
5509
|
if (refresh) revealFarmStreamedContent(nextRoot);
|
|
5451
5510
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
@@ -6027,7 +6086,7 @@ void hydrate();
|
|
|
6027
6086
|
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
|
|
6028
6087
|
const viteBuild = productionVite.build;
|
|
6029
6088
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
6030
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
6089
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-5PIQQVRP.cjs");
|
|
6031
6090
|
const fs4 = await import("fs/promises");
|
|
6032
6091
|
const pluginManager = new PluginManager2({
|
|
6033
6092
|
config,
|
|
@@ -6155,7 +6214,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6155
6214
|
}))
|
|
6156
6215
|
) : discoveredMiddlewareRoutes;
|
|
6157
6216
|
const instrumentationPath = _chunk3GNHJ3RNcjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
6158
|
-
const notFoundPath =
|
|
6217
|
+
const notFoundPath = _chunkKWST2O22cjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
6159
6218
|
if (notFoundPath) _chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
6160
6219
|
layoutRoutes.sort((a, b) => {
|
|
6161
6220
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -6176,9 +6235,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6176
6235
|
(provider) => provider.component || provider.type === "clerk"
|
|
6177
6236
|
);
|
|
6178
6237
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
6179
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
6238
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _119 => _119.mdx, 'optionalAccess', _120 => _120.components]));
|
|
6180
6239
|
const hasMiddlewareConfig = _chunk2MR4MABGcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
6181
|
-
const hasRouteContextConfig =
|
|
6240
|
+
const hasRouteContextConfig = _chunkKEB7AGS6cjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
6182
6241
|
const hasServerRuntimePlugins = _chunkDMXMIE2Ccjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
|
|
6183
6242
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
6184
6243
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -6188,9 +6247,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6188
6247
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
6189
6248
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
6190
6249
|
);
|
|
6191
|
-
if (
|
|
6250
|
+
if (_chunkUISZLYKYcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
6192
6251
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
6193
|
-
|
|
6252
|
+
_chunkUISZLYKYcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
6194
6253
|
config.docs,
|
|
6195
6254
|
{ root, srcDir: config.srcDir },
|
|
6196
6255
|
(pathname) => adapterGuardedPaths.has(pathname),
|
|
@@ -6198,9 +6257,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6198
6257
|
);
|
|
6199
6258
|
}
|
|
6200
6259
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
6201
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
6260
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHDPT6OYEcjs._runWithFarmCspNonce.call(void 0,
|
|
6202
6261
|
farmDocsCspNonceMarker,
|
|
6203
|
-
async () => _optionalChain([config, 'access',
|
|
6262
|
+
async () => _optionalChain([config, 'access', _123 => _123.docs, 'access', _124 => _124.adapter, 'optionalAccess', _125 => _125.server]) ? await _chunkUISZLYKYcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
6204
6263
|
root,
|
|
6205
6264
|
srcDir: config.srcDir,
|
|
6206
6265
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -6314,7 +6373,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6314
6373
|
// Adapters can render provider scripts by serializing function source.
|
|
6315
6374
|
// keepNames injects helper calls into those functions; after Nitro
|
|
6316
6375
|
// minifies the server chunk the helper is no longer in script scope.
|
|
6317
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
6376
|
+
keepNames: !(_optionalChain([config, 'access', _126 => _126.docs, 'optionalAccess', _127 => _127.enabled]) && _optionalChain([config, 'access', _128 => _128.docs, 'access', _129 => _129.adapter, 'optionalAccess', _130 => _130.server])),
|
|
6318
6377
|
jsxDev: false
|
|
6319
6378
|
},
|
|
6320
6379
|
// SSR configuration to externalize problematic modules
|
|
@@ -6364,10 +6423,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6364
6423
|
define: {
|
|
6365
6424
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
6366
6425
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
6367
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
6426
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _131 => _131.env, 'optionalAccess', _132 => _132.public]) || {})
|
|
6368
6427
|
},
|
|
6369
6428
|
plugins: [
|
|
6370
|
-
|
|
6429
|
+
_chunkKWST2O22cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
6371
6430
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
6372
6431
|
...rendererVitePlugins,
|
|
6373
6432
|
...config.vite.plugins || [],
|
|
@@ -6390,7 +6449,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6390
6449
|
{ ..._chunkNG2EZ6QScjs.createReactProductionModePlugin.call(void 0, ), enforce: "pre" },
|
|
6391
6450
|
farmServerOnlyEntriesPlugin(),
|
|
6392
6451
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
6393
|
-
|
|
6452
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
6394
6453
|
...hasRuntimeConfigModule ? [
|
|
6395
6454
|
farmStripPlatformConfigPlugin(
|
|
6396
6455
|
[
|
|
@@ -6402,7 +6461,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6402
6461
|
{
|
|
6403
6462
|
name: "farm-virtual-ssr-entry",
|
|
6404
6463
|
resolveId: {
|
|
6405
|
-
filter: { id:
|
|
6464
|
+
filter: { id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
|
|
6406
6465
|
handler(id) {
|
|
6407
6466
|
if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
|
|
6408
6467
|
return virtualEntryId;
|
|
@@ -6411,7 +6470,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6411
6470
|
}
|
|
6412
6471
|
},
|
|
6413
6472
|
load: {
|
|
6414
|
-
filter: { id:
|
|
6473
|
+
filter: { id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, [virtualEntryId]) },
|
|
6415
6474
|
handler(id) {
|
|
6416
6475
|
if (id === virtualEntryId) {
|
|
6417
6476
|
return virtualEntryCode;
|
|
@@ -6443,7 +6502,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6443
6502
|
resolve: {
|
|
6444
6503
|
alias: [
|
|
6445
6504
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
6446
|
-
...Object.entries(
|
|
6505
|
+
...Object.entries(_chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
6447
6506
|
([find, replacement]) => ({ find, replacement })
|
|
6448
6507
|
)
|
|
6449
6508
|
],
|
|
@@ -6451,7 +6510,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6451
6510
|
dedupe: [...config.renderer.dedupe || []]
|
|
6452
6511
|
}
|
|
6453
6512
|
};
|
|
6454
|
-
await viteBuild(
|
|
6513
|
+
await viteBuild(_chunkKWST2O22cjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
6455
6514
|
} finally {
|
|
6456
6515
|
if (postcssConfigDir) {
|
|
6457
6516
|
try {
|
|
@@ -6487,7 +6546,7 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
6487
6546
|
return lastModified;
|
|
6488
6547
|
}
|
|
6489
6548
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
6490
|
-
if (!_optionalChain([config, 'access',
|
|
6549
|
+
if (!_optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled])) return [];
|
|
6491
6550
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
6492
6551
|
const guards = {
|
|
6493
6552
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
@@ -6498,15 +6557,15 @@ function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
|
6498
6557
|
).flatMap((page) => [page.href, _chunkNAXKOTPPcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunk2MR4MABGcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
6499
6558
|
}
|
|
6500
6559
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
6501
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
6560
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _135 => _135.llmsTxt]);
|
|
6502
6561
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
6503
6562
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
6504
6563
|
);
|
|
6505
6564
|
return [
|
|
6506
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
6507
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
6508
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
6509
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
6565
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _136 => _136.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
6566
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _137 => _137.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
6567
|
+
..._optionalChain([agent, 'optionalAccess', _138 => _138.sitemap, 'optionalAccess', _139 => _139.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
6568
|
+
..._optionalChain([agent, 'optionalAccess', _140 => _140.crawlers, 'optionalAccess', _141 => _141.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
6510
6569
|
];
|
|
6511
6570
|
}
|
|
6512
6571
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -6517,7 +6576,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
6517
6576
|
docsPath: ${root}.entry,
|
|
6518
6577
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
6519
6578
|
}`;
|
|
6520
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
6579
|
+
if (_optionalChain([docs, 'optionalAccess', _142 => _142.roots, 'optionalAccess', _143 => _143.length])) {
|
|
6521
6580
|
return {
|
|
6522
6581
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
6523
6582
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -6530,7 +6589,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
6530
6589
|
}
|
|
6531
6590
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
6532
6591
|
if (!docs.enabled) return "null";
|
|
6533
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
6592
|
+
const serializableDocs = _optionalChain([docs, 'access', _144 => _144.roots, 'optionalAccess', _145 => _145.length]) ? {
|
|
6534
6593
|
...docs,
|
|
6535
6594
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
6536
6595
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -6564,7 +6623,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
6564
6623
|
},
|
|
6565
6624
|
}
|
|
6566
6625
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
6567
|
-
if (!_optionalChain([docs, 'access',
|
|
6626
|
+
if (!_optionalChain([docs, 'access', _146 => _146.roots, 'optionalAccess', _147 => _147.length])) return expression;
|
|
6568
6627
|
return `((farmDocs) => ({
|
|
6569
6628
|
...farmDocs,
|
|
6570
6629
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -6581,7 +6640,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
6581
6640
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
6582
6641
|
}
|
|
6583
6642
|
function generateNativeAuthIntegrationSource(auth) {
|
|
6584
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
6643
|
+
if (_optionalChain([auth, 'optionalAccess', _148 => _148.enabled]) !== true) {
|
|
6585
6644
|
return { importSource: "", registerSource: "" };
|
|
6586
6645
|
}
|
|
6587
6646
|
return {
|
|
@@ -6891,26 +6950,26 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
|
6891
6950
|
}
|
|
6892
6951
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
|
|
6893
6952
|
const farmRendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
6894
|
-
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6895
|
-
const farmClientBoot =
|
|
6953
|
+
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _149 => _149.experimental, 'optionalAccess', _150 => _150.serverComponents])) === "islands";
|
|
6954
|
+
const farmClientBoot = _chunkKWST2O22cjs.canBootFarmIslandsClient.call(void 0, config);
|
|
6896
6955
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
6897
6956
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
6898
6957
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
6899
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
6958
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _151 => _151.agent, 'optionalAccess', _152 => _152.crawlers, 'optionalAccess', _153 => _153.enabled])) && !applicationMetadataRoutes.some(
|
|
6900
6959
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
6901
6960
|
);
|
|
6902
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
6961
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _154 => _154.agent, 'optionalAccess', _155 => _155.sitemap, 'optionalAccess', _156 => _156.enabled])) && !applicationMetadataRoutes.some(
|
|
6903
6962
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
6904
6963
|
);
|
|
6905
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
6906
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
6964
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _157 => _157.agent, 'optionalAccess', _158 => _158.mcp]) === true && !_chunkTP4RAV7Ycjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
6965
|
+
const servesAiCatalog = _optionalChain([config, 'access', _159 => _159.agent, 'optionalAccess', _160 => _160.aiCatalog]) !== false;
|
|
6907
6966
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
6908
6967
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
6909
6968
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
6910
6969
|
const adapterOwnsDocsRuntime = Boolean(
|
|
6911
|
-
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
6970
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _161 => _161.docs, 'optionalAccess', _162 => _162.enabled]) && _optionalChain([config, 'access', _163 => _163.docs, 'access', _164 => _164.adapter, 'optionalAccess', _165 => _165.server]) && config.docs.adapter.react
|
|
6912
6971
|
);
|
|
6913
|
-
if (_optionalChain([config, 'access',
|
|
6972
|
+
if (_optionalChain([config, 'access', _166 => _166.docs, 'optionalAccess', _167 => _167.enabled]) && _optionalChain([config, 'access', _168 => _168.docs, 'access', _169 => _169.roots, 'optionalAccess', _170 => _170.length]) && !adapterOwnsDocsRuntime) {
|
|
6914
6973
|
throw new Error(
|
|
6915
6974
|
"Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
|
|
6916
6975
|
);
|
|
@@ -6961,7 +7020,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6961
7020
|
);
|
|
6962
7021
|
const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
|
|
6963
7022
|
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunk2MR4MABGcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
6964
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
7023
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _171 => _171.docs, 'optionalAccess', _172 => _172.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
6965
7024
|
const integrationProviders = _chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
6966
7025
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
6967
7026
|
(provider) => provider.component || provider.type === "clerk"
|
|
@@ -6971,16 +7030,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6971
7030
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
6972
7031
|
);
|
|
6973
7032
|
}
|
|
6974
|
-
const providerServerModules =
|
|
7033
|
+
const providerServerModules = _chunkKWST2O22cjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
6975
7034
|
renderedIntegrationProviders,
|
|
6976
7035
|
config.root,
|
|
6977
7036
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
6978
7037
|
);
|
|
6979
7038
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
6980
7039
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
6981
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
7040
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _173 => _173.providers]);
|
|
6982
7041
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
6983
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
7042
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _174 => _174.component]) === "function")) {
|
|
6984
7043
|
throw new Error(
|
|
6985
7044
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
6986
7045
|
);
|
|
@@ -6991,20 +7050,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6991
7050
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
6992
7051
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
6993
7052
|
);
|
|
6994
|
-
const isolatedHydrationMode =
|
|
6995
|
-
_optionalChain([config, 'access',
|
|
7053
|
+
const isolatedHydrationMode = _chunk2IFT2CSAcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
7054
|
+
_optionalChain([config, 'access', _175 => _175.experimental, 'optionalAccess', _176 => _176.isolatedClientHydration]),
|
|
6996
7055
|
{
|
|
6997
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
7056
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _177 => _177.experimental, 'optionalAccess', _178 => _178.serverComponents])) === "rsc",
|
|
6998
7057
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
6999
7058
|
}
|
|
7000
7059
|
);
|
|
7001
|
-
const hydrationPlanOptions =
|
|
7060
|
+
const hydrationPlanOptions = _chunk2IFT2CSAcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
7002
7061
|
config.renderer,
|
|
7003
7062
|
Boolean(unsupportedIntegrationProvider)
|
|
7004
7063
|
);
|
|
7005
7064
|
const pageHydrationPlanOptions = {
|
|
7006
7065
|
...hydrationPlanOptions,
|
|
7007
|
-
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
7066
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _179 => _179.experimental, 'optionalAccess', _180 => _180.serverComponents])) === "islands"
|
|
7008
7067
|
};
|
|
7009
7068
|
const layoutHydrationPlans = layoutRoutes.map((layout) => ({
|
|
7010
7069
|
...layout,
|
|
@@ -7016,7 +7075,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7016
7075
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
7017
7076
|
)
|
|
7018
7077
|
}));
|
|
7019
|
-
const markdownPagePlan =
|
|
7078
|
+
const markdownPagePlan = _chunk2IFT2CSAcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
7020
7079
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
7021
7080
|
config.root,
|
|
7022
7081
|
isolatedHydrationMode,
|
|
@@ -7025,7 +7084,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7025
7084
|
const pageHydrationPlans = new Map(
|
|
7026
7085
|
pageRoutes.map((route) => [
|
|
7027
7086
|
route.modulePath,
|
|
7028
|
-
|
|
7087
|
+
_chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
7029
7088
|
route.modulePath,
|
|
7030
7089
|
config.root,
|
|
7031
7090
|
isolatedHydrationMode,
|
|
@@ -7034,7 +7093,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7034
7093
|
)
|
|
7035
7094
|
])
|
|
7036
7095
|
);
|
|
7037
|
-
|
|
7096
|
+
_chunk2IFT2CSAcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
7038
7097
|
layoutHydrationPlans.map((layout) => ({
|
|
7039
7098
|
pattern: layout.pattern,
|
|
7040
7099
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -7064,7 +7123,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7064
7123
|
apiRegistrations.push(`
|
|
7065
7124
|
{
|
|
7066
7125
|
path: ${JSON.stringify(route.path)},
|
|
7067
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
7126
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _181 => _181.pluginMethods, 'optionalAccess', _182 => _182.includes, 'call', _183 => _183(method)])))},
|
|
7068
7127
|
endpoints: ${varName},
|
|
7069
7128
|
}`);
|
|
7070
7129
|
});
|
|
@@ -7077,11 +7136,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7077
7136
|
}).map(({ route }) => route);
|
|
7078
7137
|
orderedPageRoutes.forEach((route, index) => {
|
|
7079
7138
|
const varName = `pageRoute${index}`;
|
|
7080
|
-
if (
|
|
7139
|
+
if (_chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
7140
|
+
const renderingDirective2 = _chunkCSQPMV3Qcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
7081
7141
|
pageRegistrations.push(`
|
|
7082
7142
|
{
|
|
7083
7143
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
7084
|
-
directory: ${JSON.stringify(route.directory)},` : ""}
|
|
7144
|
+
directory: ${JSON.stringify(route.directory)},` : ""}${renderingDirective2 ? `
|
|
7145
|
+
rendering: ${JSON.stringify(renderingDirective2)},` : ""}
|
|
7085
7146
|
module: createFarmMarkdownRouteModule({
|
|
7086
7147
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
7087
7148
|
filePath: ${JSON.stringify(toBakedMarkdownSourcePath(config.root, route.modulePath))},
|
|
@@ -7101,7 +7162,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7101
7162
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
7102
7163
|
);
|
|
7103
7164
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
7104
|
-
const renderingDirective =
|
|
7165
|
+
const renderingDirective = _chunkCSQPMV3Qcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
7105
7166
|
pageRegistrations.push(`
|
|
7106
7167
|
{
|
|
7107
7168
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -7109,8 +7170,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7109
7170
|
module: ${varName},
|
|
7110
7171
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
7111
7172
|
clientModule: ${JSON.stringify(_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
7112
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
7113
|
-
const rootStrategy =
|
|
7173
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunk2IFT2CSAcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
7174
|
+
const rootStrategy = _chunkKWST2O22cjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
7114
7175
|
route,
|
|
7115
7176
|
clientMetadata,
|
|
7116
7177
|
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
@@ -7173,7 +7234,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7173
7234
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
7174
7235
|
interception: ${JSON.stringify(slot.interception)},
|
|
7175
7236
|
fallback: ${JSON.stringify(slot.fallback)},
|
|
7176
|
-
hydrates: ${!farmIslandsMode ||
|
|
7237
|
+
hydrates: ${!farmIslandsMode || _chunk2IFT2CSAcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
|
|
7177
7238
|
module: ${varName},
|
|
7178
7239
|
}`);
|
|
7179
7240
|
});
|
|
@@ -7369,7 +7430,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7369
7430
|
createFarmDeploymentMismatchResponse,
|
|
7370
7431
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
7371
7432
|
getFarmDeploymentMismatch,
|
|
7372
|
-
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access',
|
|
7433
|
+
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access', _184 => _184.md, 'optionalAccess', _185 => _185.enabled]) || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
|
|
7373
7434
|
} from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
|
|
7374
7435
|
import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
|
|
7375
7436
|
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
@@ -7438,25 +7499,25 @@ function farmFormStateScript() { return ""; }`}`;
|
|
|
7438
7499
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
7439
7500
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
7440
7501
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
7441
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
7502
|
+
const docsHandlerImport = _optionalChain([config, 'access', _186 => _186.docs, 'optionalAccess', _187 => _187.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
7442
7503
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
7443
7504
|
const pathname = typeof requestOrPathname === "string"
|
|
7444
7505
|
? requestOrPathname
|
|
7445
7506
|
: new URL(requestOrPathname.url).pathname;
|
|
7446
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
7507
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _188 => _188.apiPath]) || "/api/docs")};
|
|
7447
7508
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
7448
7509
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
7449
|
-
import { ${_optionalChain([config, 'access',
|
|
7510
|
+
import { ${_optionalChain([config, 'access', _189 => _189.docs, 'access', _190 => _190.roots, 'optionalAccess', _191 => _191.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
7450
7511
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
7451
7512
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
7452
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
7453
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
7513
|
+
const docsFontImport = _optionalChain([config, 'access', _192 => _192.docs, 'optionalAccess', _193 => _193.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
7514
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _194 => _194.docs, 'optionalAccess', _195 => _195.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
7454
7515
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
7455
7516
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
7456
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
7517
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _196 => _196.md, 'optionalAccess', _197 => _197.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
7457
7518
|
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;";
|
|
7458
7519
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
7459
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
7520
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _198 => _198.mdx, 'optionalAccess', _199 => _199.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
7460
7521
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
7461
7522
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
7462
7523
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -7476,14 +7537,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
7476
7537
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
7477
7538
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
7478
7539
|
const mobileSession = (config.plugins || []).some(
|
|
7479
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
7540
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _200 => _200.name]) === _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN
|
|
7480
7541
|
);
|
|
7481
7542
|
const nativeServerFns = (config.plugins || []).some(
|
|
7482
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
7483
|
-
) ?
|
|
7543
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _201 => _201.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
|
|
7544
|
+
) ? _chunkZPUAOKHVcjs.collectFarmNativeServerFns.call(void 0, {
|
|
7484
7545
|
root: config.root,
|
|
7485
7546
|
srcDir: config.srcDir,
|
|
7486
|
-
entries:
|
|
7547
|
+
entries: _chunkZPUAOKHVcjs.findFarmNativeScreenFiles.call(void 0, _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config))
|
|
7487
7548
|
}) : void 0;
|
|
7488
7549
|
const integrationImports = `
|
|
7489
7550
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -7498,7 +7559,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
|
|
|
7498
7559
|
${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
|
|
7499
7560
|
});` : ""}
|
|
7500
7561
|
`;
|
|
7501
|
-
const imageRuntime =
|
|
7562
|
+
const imageRuntime = _chunkKWST2O22cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
7502
7563
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
7503
7564
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
7504
7565
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -7680,7 +7741,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
7680
7741
|
|
|
7681
7742
|
function FarmDefault404Page() {
|
|
7682
7743
|
return React.createElement(React.Fragment, null,
|
|
7683
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
7744
|
+
React.createElement("style", null, ${JSON.stringify(_chunkKWST2O22cjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
7684
7745
|
React.createElement("main", {
|
|
7685
7746
|
className: "farm-default-not-found",
|
|
7686
7747
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -7817,24 +7878,24 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
7817
7878
|
validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
|
|
7818
7879
|
onError(error) { console.error("[Farm Image]", error); },
|
|
7819
7880
|
})`};
|
|
7820
|
-
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access',
|
|
7881
|
+
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access', _202 => _202.md, 'optionalAccess', _203 => _203.enabled]) || hasMarkdownPages ? config.trailingSlash ? `
|
|
7821
7882
|
// A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
|
|
7822
7883
|
// ('/about/'), so the trailing-slash 308 never answers in its place.
|
|
7823
7884
|
const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
|
|
7824
7885
|
const toFarmMarkdownPageRequest = (request) => request;` : ""}
|
|
7825
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
7826
|
-
${_optionalChain([config, 'access',
|
|
7886
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _204 => _204.agent, 'optionalAccess', _205 => _205.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
7887
|
+
${_optionalChain([config, 'access', _206 => _206.agent, 'optionalAccess', _207 => _207.llmsTxt, 'optionalAccess', _208 => _208.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
7827
7888
|
const farmMdxConfig = ${JSON.stringify({
|
|
7828
7889
|
...config.mdx,
|
|
7829
|
-
components: typeof _optionalChain([config, 'access',
|
|
7890
|
+
components: typeof _optionalChain([config, 'access', _209 => _209.mdx, 'optionalAccess', _210 => _210.components]) === "string" ? config.mdx.components : void 0
|
|
7830
7891
|
})};
|
|
7831
7892
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
7832
|
-
${_optionalChain([config, 'access',
|
|
7893
|
+
${_optionalChain([config, 'access', _211 => _211.agent, 'optionalAccess', _212 => _212.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
7833
7894
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
7834
7895
|
// to the build.
|
|
7835
7896
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
7836
7897
|
globalThis.process?.env,
|
|
7837
|
-
${JSON.stringify(
|
|
7898
|
+
${JSON.stringify(_chunkDPYBVVL3cjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
|
|
7838
7899
|
);` : ""}
|
|
7839
7900
|
const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
|
|
7840
7901
|
const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
|
|
@@ -7880,7 +7941,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
7880
7941
|
});
|
|
7881
7942
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
7882
7943
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
7883
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
7944
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _213 => _213.docs, 'optionalAccess', _214 => _214.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
7884
7945
|
try {
|
|
7885
7946
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
7886
7947
|
const candidates = [
|
|
@@ -7892,7 +7953,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _212 => _2
|
|
|
7892
7953
|
} catch {
|
|
7893
7954
|
return null;
|
|
7894
7955
|
}
|
|
7895
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
7956
|
+
})()` : "null"};${_optionalChain([config, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _217 => _217.docs, 'access', _218 => _218.roots, 'optionalAccess', _219 => _219.length]) ? `
|
|
7896
7957
|
const farmDocsBundledRootsDir = (() => {
|
|
7897
7958
|
try {
|
|
7898
7959
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -7944,7 +8005,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
7944
8005
|
),
|
|
7945
8006
|
}
|
|
7946
8007
|
: undefined;
|
|
7947
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
8008
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _220 => _220.docs, 'optionalAccess', _221 => _221.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
7948
8009
|
rootDir: farmDocsRuntimeRoot,
|
|
7949
8010
|
// A production build's content cannot change, so the adapter reads its
|
|
7950
8011
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -7965,7 +8026,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _219 => _219.docs, '
|
|
|
7965
8026
|
registerMCPServer: registerFarmMCPServer,
|
|
7966
8027
|
// A page built with this keeps its HTML string, so the preload budget and the response
|
|
7967
8028
|
// writer use it instead of reading and re-encoding the body. Older adapters ignore it.
|
|
7968
|
-
createHtmlResponse: farmOwnedHtmlResponse,${
|
|
8029
|
+
createHtmlResponse: farmOwnedHtmlResponse,${_chunkUISZLYKYcjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
|
|
7969
8030
|
// The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
|
|
7970
8031
|
// asks about any path its own content lists, so the guards decide here, not a page list.
|
|
7971
8032
|
isPathGuarded: (pathname) =>
|
|
@@ -7991,11 +8052,11 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _219 => _219.docs, '
|
|
|
7991
8052
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
7992
8053
|
basePath: ${JSON.stringify(config.basePath)},
|
|
7993
8054
|
})` : "null"};
|
|
7994
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
8055
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _222 => _222.docs, 'optionalAccess', _223 => _223.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
|
|
7995
8056
|
|
|
7996
8057
|
// API routes bundled at build time
|
|
7997
8058
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
7998
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
8059
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path15, methods }) => ({ path: path15, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
|
|
7999
8060
|
// A plugin calling an app endpoint (an MCP tool, say) goes through the whole
|
|
8000
8061
|
// pipeline, so the endpoint's middleware and integration guards run for it.
|
|
8001
8062
|
function dispatchFarmPluginAPIRequest(request) {
|
|
@@ -8023,12 +8084,12 @@ const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
|
|
|
8023
8084
|
// runtime request.
|
|
8024
8085
|
const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
|
|
8025
8086
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
8026
|
-
${_optionalChain([config, 'access',
|
|
8027
|
-
` : ""}${_optionalChain([config, 'access',
|
|
8028
|
-
|
|
8087
|
+
${_optionalChain([config, 'access', _224 => _224.agent, 'optionalAccess', _225 => _225.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkSXMWVP2Lcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
8088
|
+
` : ""}${_optionalChain([config, 'access', _226 => _226.agent, 'optionalAccess', _227 => _227.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
8089
|
+
_chunkSXMWVP2Lcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
8029
8090
|
build: config.deploymentId,
|
|
8030
|
-
packages:
|
|
8031
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
8091
|
+
packages: _chunkKWST2O22cjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
8092
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkKWST2O22cjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
8032
8093
|
})
|
|
8033
8094
|
)};
|
|
8034
8095
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -8834,8 +8895,9 @@ const farmClientEntryPreloadTags = farmClientModulePreloads
|
|
|
8834
8895
|
? farmClientModulePreloads.entry.map(renderFarmClientModulePreload).join("")
|
|
8835
8896
|
: "";
|
|
8836
8897
|
// The client modules a document's markup loads: its islands' boundaries and the
|
|
8837
|
-
// client references of its server tree.
|
|
8838
|
-
|
|
8898
|
+
// client references of its server tree. An island with a deferred strategy loads its
|
|
8899
|
+
// module on its own trigger, so it is not preloaded.
|
|
8900
|
+
const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r":"(\\/[^"]+)"/g;
|
|
8839
8901
|
|
|
8840
8902
|
function renderFarmClientModulePreload(index) {
|
|
8841
8903
|
return '\\n <link rel="modulepreload" href="/' +
|
|
@@ -8863,7 +8925,10 @@ function renderFarmClientModulePreloads(markup, pageModule) {
|
|
|
8863
8925
|
};
|
|
8864
8926
|
add(pageModule);
|
|
8865
8927
|
if (typeof markup === "string") {
|
|
8866
|
-
for (const match of markup.matchAll(FARM_CLIENT_MODULE_REFERENCE_PATTERN))
|
|
8928
|
+
for (const match of markup.matchAll(FARM_CLIENT_MODULE_REFERENCE_PATTERN)) {
|
|
8929
|
+
if (match[1] && FARM_DEFERRED_ISLAND_STRATEGY.test(match[2])) continue;
|
|
8930
|
+
add(match[1] || match[3]);
|
|
8931
|
+
}
|
|
8867
8932
|
}
|
|
8868
8933
|
return tags;
|
|
8869
8934
|
}
|
|
@@ -9255,27 +9320,31 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
9255
9320
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
9256
9321
|
// registered at runtime, such as the docs engine's.
|
|
9257
9322
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
9258
|
-
|
|
9323
|
+
_chunkTP4RAV7Ycjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkMEJCP2LXcjs.FARM_VERSION)
|
|
9259
9324
|
)};
|
|
9260
9325
|
let farmDefaultMCPRouteFree;
|
|
9261
9326
|
function getFarmDefaultMCPServer() {
|
|
9262
9327
|
if (farmDefaultMCPRouteFree === undefined) {
|
|
9263
|
-
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(
|
|
9328
|
+
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH)});
|
|
9264
9329
|
}
|
|
9265
9330
|
return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
|
|
9266
9331
|
}
|
|
9267
9332
|
async function handleFarmDefaultMCP(request) {
|
|
9268
9333
|
const origin = new URL(request.url).origin;
|
|
9334
|
+
// Pages are linked on metadataBase, as sitemap.xml and llms.txt link them.
|
|
9335
|
+
const metadataBase = getFarmRootMetadataBase();
|
|
9269
9336
|
return handleFarmDefaultMCPRequest(request, {
|
|
9270
9337
|
server: getFarmDefaultMCPServer(),
|
|
9271
9338
|
basePath: ${JSON.stringify(config.basePath)},
|
|
9272
9339
|
i18n: farmI18nConfig,
|
|
9340
|
+
metadataBase,
|
|
9273
9341
|
// Each page at the URL it answers at, as in development and as the sitemap lists it.
|
|
9274
9342
|
listPages: () =>
|
|
9275
9343
|
collectFarmDefaultMCPPages(
|
|
9276
9344
|
getFarmAgentListedPageRoutes().map((route) => ({ pattern: route.pattern, module: route.module })),
|
|
9277
9345
|
{
|
|
9278
9346
|
origin,
|
|
9347
|
+
metadataBase,
|
|
9279
9348
|
basePath: ${JSON.stringify(config.basePath)},
|
|
9280
9349
|
markdown: farmMarkdownConfig,${config.trailingSlash ? "\n trailingSlash: true," : ""}
|
|
9281
9350
|
i18n: farmI18nConfig,
|
|
@@ -9291,16 +9360,16 @@ async function handleFarmDefaultMCP(request) {
|
|
|
9291
9360
|
// gets its own request context, as for a direct request.
|
|
9292
9361
|
const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => fetch(page));
|
|
9293
9362
|
` : ""}
|
|
9294
|
-
// The origin llms.txt
|
|
9295
|
-
// request's origin, as for the sitemap and in development.
|
|
9363
|
+
// The origin llms.txt, llms-full.txt and list_pages link to: the root layout's metadataBase,
|
|
9364
|
+
// else the request's origin, as for the sitemap and in development.
|
|
9296
9365
|
function getFarmAgentOrigin(request) {
|
|
9366
|
+
return resolveFarmAgentOrigin(getFarmRootMetadataBase(), new URL(request.url).origin);
|
|
9367
|
+
}
|
|
9368
|
+
function getFarmRootMetadataBase() {
|
|
9297
9369
|
const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
|
|
9298
|
-
return
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
: undefined,
|
|
9302
|
-
new URL(request.url).origin,
|
|
9303
|
-
);
|
|
9370
|
+
return rootLayout && rootLayout.module && rootLayout.module.metadata
|
|
9371
|
+
? rootLayout.module.metadata.metadataBase
|
|
9372
|
+
: undefined;
|
|
9304
9373
|
}
|
|
9305
9374
|
|
|
9306
9375
|
// Static pages and root metadata for llms.txt, built the same way as in development.
|
|
@@ -9445,7 +9514,7 @@ ${edgeMiddlewareFilePaths.length > 0 ? `
|
|
|
9445
9514
|
// middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
|
|
9446
9515
|
const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
|
|
9447
9516
|
const farmPrerendering =
|
|
9448
|
-
typeof process !== "undefined" && process.env?.${
|
|
9517
|
+
typeof process !== "undefined" && process.env?.${_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV} === "1";
|
|
9449
9518
|
` : ""}
|
|
9450
9519
|
const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
|
|
9451
9520
|
config: farmMiddlewareConfig,
|
|
@@ -9589,7 +9658,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
9589
9658
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
9590
9659
|
return true;
|
|
9591
9660
|
}
|
|
9592
|
-
${_optionalChain([config, 'access',
|
|
9661
|
+
${_optionalChain([config, 'access', _228 => _228.docs, 'optionalAccess', _229 => _229.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
9593
9662
|
// The docs answer below the basePath; their API stays at /api/docs, as API routes do.
|
|
9594
9663
|
const docsRoutePathname = stripFarmBasePath(pathname);
|
|
9595
9664
|
if (
|
|
@@ -9617,7 +9686,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
9617
9686
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
9618
9687
|
};
|
|
9619
9688
|
}
|
|
9620
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
9689
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _230 => _230.docs, 'optionalAccess', _231 => _231.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
9621
9690
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
9622
9691
|
pathname,
|
|
9623
9692
|
method: request.method,
|
|
@@ -9701,7 +9770,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
9701
9770
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
9702
9771
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
9703
9772
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
9704
|
-
|
|
9773
|
+
_chunkSXMWVP2Lcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
9705
9774
|
agent: {
|
|
9706
9775
|
...config.agent,
|
|
9707
9776
|
aiCatalog: servesAiCatalog,
|
|
@@ -9712,9 +9781,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
9712
9781
|
openapi: openAPIReference
|
|
9713
9782
|
})
|
|
9714
9783
|
)});
|
|
9715
|
-
${_optionalChain([config, 'access',
|
|
9784
|
+
${_optionalChain([config, 'access', _232 => _232.docs, 'optionalAccess', _233 => _233.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
9716
9785
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
9717
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
9786
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _234 => _234.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _235 => _235.docs, 'access', _236 => _236.roots, 'optionalAccess', _237 => _237.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
|
|
9718
9787
|
pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
|
|
9719
9788
|
};
|
|
9720
9789
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
@@ -9730,11 +9799,11 @@ function labelFarmRequestOptions(options) {
|
|
|
9730
9799
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
9731
9800
|
return options;
|
|
9732
9801
|
}
|
|
9733
|
-
${_optionalChain([config, 'access',
|
|
9802
|
+
${_optionalChain([config, 'access', _238 => _238.docs, 'optionalAccess', _239 => _239.enabled]) ? `if (options.kind === "docs") {
|
|
9734
9803
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
9735
9804
|
return options;
|
|
9736
9805
|
}` : ""}
|
|
9737
|
-
${_optionalChain([config, 'access',
|
|
9806
|
+
${_optionalChain([config, 'access', _240 => _240.md, 'optionalAccess', _241 => _241.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
9738
9807
|
routePathname,
|
|
9739
9808
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
9740
9809
|
);
|
|
@@ -9769,7 +9838,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
9769
9838
|
return applicable;
|
|
9770
9839
|
}
|
|
9771
9840
|
|
|
9772
|
-
${_optionalChain([config, 'access',
|
|
9841
|
+
${_optionalChain([config, 'access', _242 => _242.docs, 'optionalAccess', _243 => _243.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
9773
9842
|
if (request.method === "HEAD") return response;
|
|
9774
9843
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
9775
9844
|
|
|
@@ -9877,7 +9946,7 @@ ${_optionalChain([config, 'access', _241 => _241.docs, 'optionalAccess', _242 =>
|
|
|
9877
9946
|
|
|
9878
9947
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
9879
9948
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
9880
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
9949
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _244 => _244.experimental, 'optionalAccess', _245 => _245.ppr]) === true)};
|
|
9881
9950
|
|
|
9882
9951
|
function resolveRouteRenderingView(route) {
|
|
9883
9952
|
// The same merge development uses: baked directive config under the
|
|
@@ -10005,7 +10074,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
10005
10074
|
},
|
|
10006
10075
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
10007
10076
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
10008
|
-
${_optionalChain([config, 'access',
|
|
10077
|
+
${_optionalChain([config, 'access', _246 => _246.md, 'optionalAccess', _247 => _247.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
10009
10078
|
if (matchPageRoute(pathname)) {
|
|
10010
10079
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
10011
10080
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -10222,7 +10291,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10222
10291
|
return renderFarmErrorJSONResponse();` : `
|
|
10223
10292
|
if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
|
|
10224
10293
|
// No page was selected, so only the root error boundary and layouts apply.
|
|
10225
|
-
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access',
|
|
10294
|
+
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _248 => _248.md, 'optionalAccess', _249 => _249.enabled]) ? `
|
|
10226
10295
|
// An agent asking for Markdown reads the error document as Markdown, as it
|
|
10227
10296
|
// does when a page throws. The helper answers null when Markdown is off.
|
|
10228
10297
|
const markdownErrorResponse = await createMarkdownMirrorResponse({
|
|
@@ -10264,7 +10333,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10264
10333
|
}
|
|
10265
10334
|
` : ""}
|
|
10266
10335
|
|
|
10267
|
-
${_optionalChain([config, 'access',
|
|
10336
|
+
${_optionalChain([config, 'access', _250 => _250.docs, 'optionalAccess', _251 => _251.enabled]) ? `
|
|
10268
10337
|
// Docs responses are served after app middleware so route guards and
|
|
10269
10338
|
// middleware headers apply to the docs engine like any other page content.
|
|
10270
10339
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -10362,7 +10431,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10362
10431
|
}
|
|
10363
10432
|
` : ""}
|
|
10364
10433
|
|
|
10365
|
-
${_optionalChain([config, 'access',
|
|
10434
|
+
${_optionalChain([config, 'access', _252 => _252.md, 'optionalAccess', _253 => _253.enabled]) ? `
|
|
10366
10435
|
if (farmMarkdownConfig?.enabled) {
|
|
10367
10436
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
10368
10437
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -10466,11 +10535,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10466
10535
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
10467
10536
|
}
|
|
10468
10537
|
` : ""}
|
|
10469
|
-
${_optionalChain([config, 'access',
|
|
10538
|
+
${_optionalChain([config, 'access', _254 => _254.agent, 'optionalAccess', _255 => _255.manifest]) !== false ? `
|
|
10470
10539
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
10471
10540
|
// public manifest, the same document for every request.
|
|
10472
10541
|
if (
|
|
10473
|
-
[${JSON.stringify(
|
|
10542
|
+
[${JSON.stringify(_chunkSXMWVP2Lcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkSXMWVP2Lcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
10474
10543
|
normalizeRuntimePath(routePathname),
|
|
10475
10544
|
)
|
|
10476
10545
|
) {
|
|
@@ -10480,9 +10549,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10480
10549
|
);
|
|
10481
10550
|
}
|
|
10482
10551
|
` : ""}
|
|
10483
|
-
${_optionalChain([config, 'access',
|
|
10552
|
+
${_optionalChain([config, 'access', _256 => _256.agent, 'optionalAccess', _257 => _257.apiCatalog]) ? `
|
|
10484
10553
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
10485
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
10554
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkSXMWVP2Lcjs.FARM_API_CATALOG_PATH)}) {
|
|
10486
10555
|
return applyProductionMiddlewareHeaders(
|
|
10487
10556
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
10488
10557
|
middlewareHeaders,
|
|
@@ -10507,11 +10576,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10507
10576
|
);
|
|
10508
10577
|
}
|
|
10509
10578
|
` : ""}
|
|
10510
|
-
${_optionalChain([config, 'access',
|
|
10579
|
+
${_optionalChain([config, 'access', _258 => _258.agent, 'optionalAccess', _259 => _259.llmsTxt, 'optionalAccess', _260 => _260.enabled]) ? `
|
|
10511
10580
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
10512
10581
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
10513
10582
|
? "llms"
|
|
10514
|
-
: ${_optionalChain([config, 'access',
|
|
10583
|
+
: ${_optionalChain([config, 'access', _261 => _261.agent, 'optionalAccess', _262 => _262.llmsTxt, 'optionalAccess', _263 => _263.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
10515
10584
|
if (farmGeneratedLlmsKind) {
|
|
10516
10585
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
10517
10586
|
// Renders are shared per origin the request reached, which is where pages are read.
|
|
@@ -10547,7 +10616,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10547
10616
|
}
|
|
10548
10617
|
` : ""}
|
|
10549
10618
|
|
|
10550
|
-
${_optionalChain([config, 'access',
|
|
10619
|
+
${_optionalChain([config, 'access', _264 => _264.docs, 'optionalAccess', _265 => _265.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
10551
10620
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
10552
10621
|
if (docsAPIResponse) {
|
|
10553
10622
|
return applyProductionMiddlewareHeaders(
|
|
@@ -10685,6 +10754,12 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10685
10754
|
|
|
10686
10755
|
// Reads from here on belong to the page render, not to middleware.
|
|
10687
10756
|
const requestReadsBeforeRender = _getRequestReadCount();
|
|
10757
|
+
// A swr or cache route rule stores this page by URL for every visitor. Nitro hands Farm the
|
|
10758
|
+
// request without its cookies, Authorization, or any header the rule does not key on, so a
|
|
10759
|
+
// render that reads nothing of the request is that shared page, whatever its route config.
|
|
10760
|
+
const farmRouteRuleCached =
|
|
10761
|
+
Boolean(adapterContext?.routeRuleCache) &&
|
|
10762
|
+
(request.method === "GET" || request.method === "HEAD");
|
|
10688
10763
|
|
|
10689
10764
|
// Get the page component and metadata
|
|
10690
10765
|
let PageComponent = route.module.default;
|
|
@@ -10918,7 +10993,8 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10918
10993
|
${farmIslandsMode ? `// Islands mode: a route a shared cache may store (a PPR shell, a static page) renders
|
|
10919
10994
|
// whole for every request, so a cache hit stays a hit. Other routes leave out what the
|
|
10920
10995
|
// navigating browser keeps: the layouts it shows and the values it holds.
|
|
10921
|
-
const farmSharedCacheableRoute =
|
|
10996
|
+
const farmSharedCacheableRoute =
|
|
10997
|
+
farmRouteRuleCached || Boolean(getRouteSharedCacheControl(route, pprCanCache));
|
|
10922
10998
|
if (farmSharedCacheableRoute) ignoreFarmHeldValues();
|
|
10923
10999
|
const farmLayoutKeyOf = getFarmLayoutKey;
|
|
10924
11000
|
// A navigation the browser renders in its layout's React root rebuilds a server-tree page
|
|
@@ -11145,7 +11221,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11145
11221
|
);
|
|
11146
11222
|
}
|
|
11147
11223
|
}
|
|
11148
|
-
${_optionalChain([config, 'access',
|
|
11224
|
+
${_optionalChain([config, 'access', _266 => _266.md, 'optionalAccess', _267 => _267.enabled]) ? `
|
|
11149
11225
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
11150
11226
|
// using the public path the .md request will be resolved against.
|
|
11151
11227
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -11164,7 +11240,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11164
11240
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
11165
11241
|
}
|
|
11166
11242
|
|
|
11167
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
11243
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _268 => _268.agent, 'optionalAccess', _269 => _269.jsonLd]), () => ( false)))} });
|
|
11168
11244
|
const title = renderedMetadata.title;
|
|
11169
11245
|
const metaTags = renderedMetadata.tags;
|
|
11170
11246
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -11183,6 +11259,24 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11183
11259
|
middlewareData?.size ||
|
|
11184
11260
|
middlewareContext?.size
|
|
11185
11261
|
);
|
|
11262
|
+
if (farmRouteRuleCached && (renderedPage.stream || hasRequestScopedRender)) {
|
|
11263
|
+
// The route rule's cache refuses a private page: say why it renders on every request.
|
|
11264
|
+
emitFarmEvent({
|
|
11265
|
+
type: "cache.bypass",
|
|
11266
|
+
route: pathname,
|
|
11267
|
+
reason: pageStatus >= 400
|
|
11268
|
+
? "error-status"
|
|
11269
|
+
: renderReadRequest
|
|
11270
|
+
? "request-read"
|
|
11271
|
+
: middlewareData?.size || middlewareContext?.size
|
|
11272
|
+
? "middleware-data"
|
|
11273
|
+
: hasConfiguredRouteContext
|
|
11274
|
+
? "route-context"
|
|
11275
|
+
: renderedPage.stream
|
|
11276
|
+
? "suspense-stream"
|
|
11277
|
+
: "request-scoped",
|
|
11278
|
+
});
|
|
11279
|
+
}
|
|
11186
11280
|
const sharedCacheControl = getRouteSharedCacheControl(route, pprCanCache);
|
|
11187
11281
|
const responseHeaders = {
|
|
11188
11282
|
"Content-Type": "text/html; charset=utf-8",
|
|
@@ -11192,8 +11286,16 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11192
11286
|
};
|
|
11193
11287
|
// An error status or a request-scoped render is never shareable, even when
|
|
11194
11288
|
// the PPR shell headers would otherwise grant a shared max-age.
|
|
11195
|
-
if (
|
|
11289
|
+
if (
|
|
11290
|
+
renderedPage.stream ||
|
|
11291
|
+
hasRequestScopedRender ||
|
|
11292
|
+
(!sharedCacheControl && !farmRouteRuleCached)
|
|
11293
|
+
) {
|
|
11196
11294
|
responseHeaders["Cache-Control"] = "private, no-store";
|
|
11295
|
+
} else if (responseHeaders["Cache-Control"] == null) {
|
|
11296
|
+
// A page with no policy of its own under a swr or cache route rule: the rule's cache
|
|
11297
|
+
// stores it and sends the rule's Cache-Control.
|
|
11298
|
+
delete responseHeaders["Cache-Control"];
|
|
11197
11299
|
}
|
|
11198
11300
|
const farmI18nSnapshot = getFarmI18nSnapshot();${farmIslandsMode ? `
|
|
11199
11301
|
// Islands mode: a navigation that names the values it holds, or the layouts it shows,
|
|
@@ -11566,7 +11668,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11566
11668
|
${servesDefaultMCP ? `
|
|
11567
11669
|
// agent.mcp: no app route answered /mcp, so the default read-only server may.
|
|
11568
11670
|
if (
|
|
11569
|
-
normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
11671
|
+
normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH)} &&
|
|
11570
11672
|
getFarmDefaultMCPServer()
|
|
11571
11673
|
) {
|
|
11572
11674
|
return applyProductionMiddlewareHeaders(
|
|
@@ -11931,11 +12033,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
|
|
|
11931
12033
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
11932
12034
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
11933
12035
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
11934
|
-
${_optionalChain([config, 'access',
|
|
12036
|
+
${_optionalChain([config, 'access', _270 => _270.agent, 'optionalAccess', _271 => _271.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
11935
12037
|
basePath: farmLocalAPIBasePath,
|
|
11936
12038
|
dispatch: async (localRequest) =>
|
|
11937
12039
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
11938
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
12040
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _272 => _272.agent, 'optionalAccess', _273 => _273.noindexPreviews]) ? `
|
|
11939
12041
|
// Keep every response of a preview deployment out of search indexes.
|
|
11940
12042
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
11941
12043
|
}
|
|
@@ -12165,11 +12267,11 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
12165
12267
|
}
|
|
12166
12268
|
if (_chunk2MR4MABGcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
12167
12269
|
if (_chunk2MR4MABGcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
12168
|
-
if (
|
|
12270
|
+
if (_chunkKEB7AGS6cjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
12169
12271
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
12170
12272
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
12171
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
12172
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
12273
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _274 => _274.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
12274
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _275 => _275.regions, 'optionalAccess', _276 => _276.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
12173
12275
|
return "route runtime controls";
|
|
12174
12276
|
}
|
|
12175
12277
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -12182,14 +12284,14 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
12182
12284
|
return void 0;
|
|
12183
12285
|
}
|
|
12184
12286
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
12185
|
-
if (!_optionalChain([config, 'access',
|
|
12287
|
+
if (!_optionalChain([config, 'access', _277 => _277.docs, 'optionalAccess', _278 => _278.enabled]) || !config.docs.prerender) return [];
|
|
12186
12288
|
if (_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
12187
12289
|
_chunkQMNWKQL4cjs.logger.info(
|
|
12188
12290
|
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
12189
12291
|
);
|
|
12190
12292
|
return [];
|
|
12191
12293
|
}
|
|
12192
|
-
if (!
|
|
12294
|
+
if (!_chunkUISZLYKYcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
12193
12295
|
const { pages: pages2, originDependent } = _chunkNAXKOTPPcjs.listFarmDocsBuiltInPrerenderPages.call(void 0, config.docs, {
|
|
12194
12296
|
root,
|
|
12195
12297
|
srcDir: config.srcDir
|
|
@@ -12207,7 +12309,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
12207
12309
|
);
|
|
12208
12310
|
return [];
|
|
12209
12311
|
}
|
|
12210
|
-
const pages = await
|
|
12312
|
+
const pages = await _chunkUISZLYKYcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
12211
12313
|
if (!pages) {
|
|
12212
12314
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
12213
12315
|
`The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
|
|
@@ -12217,14 +12319,14 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
12217
12319
|
return pages;
|
|
12218
12320
|
}
|
|
12219
12321
|
async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
12220
|
-
if (!_optionalChain([config, 'access',
|
|
12322
|
+
if (!_optionalChain([config, 'access', _279 => _279.docs, 'optionalAccess', _280 => _280.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
|
|
12221
12323
|
return [];
|
|
12222
12324
|
}
|
|
12223
12325
|
try {
|
|
12224
|
-
return await
|
|
12326
|
+
return await _chunkUISZLYKYcjs.listFarmDocsPagePaths.call(void 0, config.docs, {
|
|
12225
12327
|
root,
|
|
12226
12328
|
srcDir: config.srcDir,
|
|
12227
|
-
adapter: _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) &&
|
|
12329
|
+
adapter: _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _chunkUISZLYKYcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
|
|
12228
12330
|
});
|
|
12229
12331
|
} catch (error) {
|
|
12230
12332
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
@@ -12235,9 +12337,9 @@ async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
|
12235
12337
|
}
|
|
12236
12338
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
12237
12339
|
return Object.values(routeRules || {}).some((rule) => {
|
|
12238
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
12239
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
12240
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
12340
|
+
const swr = _optionalChain([rule, 'optionalAccess', _281 => _281.swr]);
|
|
12341
|
+
const cache = _optionalChain([rule, 'optionalAccess', _282 => _282.cache]);
|
|
12342
|
+
const headers = _optionalChain([rule, 'optionalAccess', _283 => _283.headers]);
|
|
12241
12343
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
12242
12344
|
});
|
|
12243
12345
|
}
|
|
@@ -12250,10 +12352,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
12250
12352
|
const nitroBuilder = nitroBuilderResult.value;
|
|
12251
12353
|
const isVercel = preset === "vercel";
|
|
12252
12354
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
12253
|
-
const outputDir =
|
|
12355
|
+
const outputDir = _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
12254
12356
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
12255
12357
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
12256
|
-
const imageRuntime =
|
|
12358
|
+
const imageRuntime = _chunkKWST2O22cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
12257
12359
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
12258
12360
|
(image) => image.sourceType === "module"
|
|
12259
12361
|
);
|
|
@@ -12387,7 +12489,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
12387
12489
|
webEntry: clientJsSrc,
|
|
12388
12490
|
webBoot: clientBootSrc,
|
|
12389
12491
|
stylesheet: clientCssHref,
|
|
12390
|
-
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess',
|
|
12492
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _284 => _284.files]), () => ( []))
|
|
12391
12493
|
})
|
|
12392
12494
|
) : null;
|
|
12393
12495
|
for (const output of Object.values(ssrBundle)) {
|
|
@@ -12604,7 +12706,9 @@ ${hasNitroCacheRouteRules ? " let farmGuardedResponse = false\n" : ""} const r
|
|
|
12604
12706
|
}${hasNitroCacheRouteRules ? `
|
|
12605
12707
|
const farmCacheControl = response.headers.get('cache-control')
|
|
12606
12708
|
if (
|
|
12607
|
-
|
|
12709
|
+
// A guarded response, or any response Farm kept private under a swr or cache rule: the
|
|
12710
|
+
// rule's cache does not store it, and the rule's public Cache-Control must not reach a CDN.
|
|
12711
|
+
(farmGuardedResponse || event.context?.routeRules?.cache) &&
|
|
12608
12712
|
farmCacheControl &&
|
|
12609
12713
|
FARM_PRIVATE_CACHE_DIRECTIVE.test(farmCacheControl)
|
|
12610
12714
|
) {
|
|
@@ -12701,10 +12805,11 @@ function toFarmNodeResponse(request, response) {
|
|
|
12701
12805
|
ssrOutputDir,
|
|
12702
12806
|
ssrEntryFile
|
|
12703
12807
|
);
|
|
12704
|
-
const configuredNitroRouteRules =
|
|
12705
|
-
varyFarmNitroCacheRules(
|
|
12808
|
+
const configuredNitroRouteRules = _chunkMQ4DYVFScjs.nitroRouteRulesBelowBasePath.call(void 0,
|
|
12809
|
+
varyFarmNitroCacheRules(_chunkMQ4DYVFScjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules), [
|
|
12706
12810
|
...config.md.enabled ? ["accept"] : [],
|
|
12707
|
-
...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : []
|
|
12811
|
+
...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : [],
|
|
12812
|
+
..._chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _285 => _285.experimental, 'optionalAccess', _286 => _286.serverComponents])) === "islands" ? ["f-layouts"] : []
|
|
12708
12813
|
]),
|
|
12709
12814
|
config.basePath,
|
|
12710
12815
|
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
@@ -12732,6 +12837,18 @@ function toFarmNodeResponse(request, response) {
|
|
|
12732
12837
|
];
|
|
12733
12838
|
})
|
|
12734
12839
|
);
|
|
12840
|
+
const immutableAssets = isVercel ? { publicAssets: [], routeRules: {} } : planFarmImmutableAssets({
|
|
12841
|
+
clientOutputDir,
|
|
12842
|
+
files: await listFarmClientOutputFiles(clientOutputDir),
|
|
12843
|
+
routeRules: configuredNitroRouteRules,
|
|
12844
|
+
routePaths: [
|
|
12845
|
+
...[...routeManager.getRoutes().keys()].map(
|
|
12846
|
+
(pattern) => _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, pattern, config.basePath)
|
|
12847
|
+
),
|
|
12848
|
+
...apiRouteManager.getRoutes().keys(),
|
|
12849
|
+
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
12850
|
+
]
|
|
12851
|
+
});
|
|
12735
12852
|
let nitroConfig = {
|
|
12736
12853
|
preset,
|
|
12737
12854
|
...farmNodeServerEntryPath ? { entry: farmNodeServerEntryPath } : {},
|
|
@@ -12750,13 +12867,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
12750
12867
|
alias: resolveNitroInternalRuntimeAliases(root),
|
|
12751
12868
|
compatibilityDate: "2024-12-01",
|
|
12752
12869
|
output: resolveFarmNitroOutputConfig(preset, outputDir),
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
maxAge: 31536e3,
|
|
12757
|
-
baseURL: "/"
|
|
12758
|
-
}
|
|
12759
|
-
],
|
|
12870
|
+
// Nitro gives the root directory no Cache-Control on any preset (it falls through to the
|
|
12871
|
+
// app), so public files keep revalidating; the hashed directories carry their own maxAge.
|
|
12872
|
+
publicAssets: [{ dir: clientOutputDir, baseURL: "/" }, ...immutableAssets.publicAssets],
|
|
12760
12873
|
// A self-hosted Node server sends static files itself, so precompress them
|
|
12761
12874
|
// with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
|
|
12762
12875
|
// fixed top quality cost a docs app ~20 s of build CPU for a small further
|
|
@@ -12810,6 +12923,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12810
12923
|
"/**": {
|
|
12811
12924
|
prerender: false
|
|
12812
12925
|
},
|
|
12926
|
+
...immutableAssets.routeRules,
|
|
12813
12927
|
...configuredNitroRouteRules,
|
|
12814
12928
|
// Exact user rules must retain their runtime settings without replacing
|
|
12815
12929
|
// the headers and prerender marker generated for a safe physical page.
|
|
@@ -12851,23 +12965,23 @@ function toFarmNodeResponse(request, response) {
|
|
|
12851
12965
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
12852
12966
|
);
|
|
12853
12967
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
12854
|
-
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
12855
|
-
_optionalChain([nitroConfig, 'access',
|
|
12856
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
12968
|
+
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _287 => _287.rollupConfig, 'optionalAccess', _288 => _288.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _289 => _289.rollupConfig, 'optionalAccess', _290 => _290.plugins])) && customRollupKeys.length === 0 && Boolean(
|
|
12969
|
+
_optionalChain([nitroConfig, 'access', _291 => _291.handlers, 'optionalAccess', _292 => _292.some, 'call', _293 => _293(
|
|
12970
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _294 => _294.handler]) || "") === nitroEntryPath
|
|
12857
12971
|
)])
|
|
12858
12972
|
);
|
|
12859
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access',
|
|
12973
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _295 => _295.output, 'optionalAccess', _296 => _296.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
|
|
12860
12974
|
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
12861
12975
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
12862
12976
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
12863
12977
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
12864
12978
|
const shouldMinify = nitroConfig.minify !== false;
|
|
12865
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
12979
|
+
const keepServerNames = !(_optionalChain([config, 'access', _297 => _297.docs, 'optionalAccess', _298 => _298.enabled]) && _optionalChain([config, 'access', _299 => _299.docs, 'access', _300 => _300.adapter, 'optionalAccess', _301 => _301.server]));
|
|
12866
12980
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
12867
12981
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
12868
12982
|
const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
|
|
12869
12983
|
if (ssrRollupPlugin) {
|
|
12870
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
12984
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _302 => _302.rollupConfig, 'optionalAccess', _303 => _303.plugins]);
|
|
12871
12985
|
nitroConfig.rollupConfig = {
|
|
12872
12986
|
...nitroConfig.rollupConfig,
|
|
12873
12987
|
plugins: [
|
|
@@ -12894,9 +13008,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
12894
13008
|
const orderOf = (route) => _nullishCoalesce(prerenderOrder.get(route), () => ( Number.MAX_SAFE_INTEGER));
|
|
12895
13009
|
prerenderedRoutes.sort((a, b) => orderOf(a.route) - orderOf(b.route));
|
|
12896
13010
|
});
|
|
12897
|
-
if (_optionalChain([config, 'access',
|
|
13011
|
+
if (_optionalChain([config, 'access', _304 => _304.md, 'optionalAccess', _305 => _305.enabled])) {
|
|
12898
13012
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
12899
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
13013
|
+
if (!route.contents || !_optionalChain([route, 'access', _306 => _306.contentType, 'optionalAccess', _307 => _307.toLowerCase, 'call', _308 => _308(), 'access', _309 => _309.includes, 'call', _310 => _310("html")])) return;
|
|
12900
13014
|
const alternatePath = _chunkC2JOS77Zcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
|
|
12901
13015
|
routePathname: (pathname) => routeManager.toRoutePathname(pathname)
|
|
12902
13016
|
});
|
|
@@ -12919,7 +13033,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12919
13033
|
}
|
|
12920
13034
|
if (config.security.csp && config.security.csp.nonce) {
|
|
12921
13035
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
12922
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
13036
|
+
if (!route.contents || !_optionalChain([route, 'access', _311 => _311.contentType, 'optionalAccess', _312 => _312.toLowerCase, 'call', _313 => _313(), 'access', _314 => _314.includes, 'call', _315 => _315("html")])) return;
|
|
12923
13037
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
12924
13038
|
if (!staticCsp) return;
|
|
12925
13039
|
route.contents = staticCsp.html;
|
|
@@ -12954,7 +13068,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12954
13068
|
await nitroBuilder.copyPublicAssets(nitroInstance);
|
|
12955
13069
|
if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
|
|
12956
13070
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
12957
|
-
const configuredPlugins = _optionalChain([prerendererConfig, 'access',
|
|
13071
|
+
const configuredPlugins = _optionalChain([prerendererConfig, 'access', _316 => _316.rollupConfig, 'optionalAccess', _317 => _317.plugins]);
|
|
12958
13072
|
const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
|
|
12959
13073
|
prerendererConfig.rollupConfig = {
|
|
12960
13074
|
...prerendererConfig.rollupConfig,
|
|
@@ -13011,13 +13125,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
13011
13125
|
}
|
|
13012
13126
|
if (prerenderRoutes.length > 0) {
|
|
13013
13127
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
13014
|
-
const previousPrerender = process.env[
|
|
13015
|
-
process.env[
|
|
13128
|
+
const previousPrerender = process.env[_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV];
|
|
13129
|
+
process.env[_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV] = "1";
|
|
13016
13130
|
try {
|
|
13017
13131
|
await nitroBuilder.prerender(nitroInstance);
|
|
13018
13132
|
} finally {
|
|
13019
|
-
if (previousPrerender === void 0) delete process.env[
|
|
13020
|
-
else process.env[
|
|
13133
|
+
if (previousPrerender === void 0) delete process.env[_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV];
|
|
13134
|
+
else process.env[_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
13021
13135
|
}
|
|
13022
13136
|
}
|
|
13023
13137
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
@@ -13193,7 +13307,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
13193
13307
|
await fs4.rename(src, dest);
|
|
13194
13308
|
return;
|
|
13195
13309
|
} catch (error) {
|
|
13196
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
13310
|
+
const code = _optionalChain([error, 'optionalAccess', _318 => _318.code]);
|
|
13197
13311
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
13198
13312
|
throw error;
|
|
13199
13313
|
}
|
|
@@ -13219,7 +13333,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
13219
13333
|
try {
|
|
13220
13334
|
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
13221
13335
|
} catch (error) {
|
|
13222
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
13336
|
+
if (_optionalChain([error, 'optionalAccess', _319 => _319.code]) !== "ENOENT") throw error;
|
|
13223
13337
|
}
|
|
13224
13338
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
13225
13339
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
@@ -13261,7 +13375,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
13261
13375
|
_chunkQMNWKQL4cjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
13262
13376
|
}
|
|
13263
13377
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
13264
|
-
if (!_optionalChain([config, 'access',
|
|
13378
|
+
if (!_optionalChain([config, 'access', _320 => _320.docs, 'optionalAccess', _321 => _321.enabled])) return;
|
|
13265
13379
|
const [mainRoot, ...extraRoots] = _chunkNAXKOTPPcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
13266
13380
|
await copyFarmDocsRootContent(
|
|
13267
13381
|
mainRoot,
|
|
@@ -13286,7 +13400,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
13286
13400
|
const lastModifiedManifest = _chunkNAXKOTPPcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
13287
13401
|
fallback: "now"
|
|
13288
13402
|
});
|
|
13289
|
-
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access',
|
|
13403
|
+
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _322 => _322.unknown, 'optionalAccess', _323 => _323.length]), () => ( 0));
|
|
13290
13404
|
if (undatedPages > 0) {
|
|
13291
13405
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
13292
13406
|
`${undatedPages} docs page(s) were last changed before this shallow clone's Git history, so they show no "Last updated" date. Build from a full clone (git fetch --unshallow) or set lastModified in the page's frontmatter.`
|
|
@@ -13371,7 +13485,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
13371
13485
|
try {
|
|
13372
13486
|
await copyPackage("sharp", sharpRequire);
|
|
13373
13487
|
if (!copiedPackages.has("sharp")) {
|
|
13374
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
13488
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkKWST2O22cjs.SHARP_INSTALL_HINT}`);
|
|
13375
13489
|
}
|
|
13376
13490
|
} catch (error) {
|
|
13377
13491
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -13601,7 +13715,7 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
13601
13715
|
// src/build/index.ts
|
|
13602
13716
|
async function build(config, options = {}) {
|
|
13603
13717
|
return _chunkNG2EZ6QScjs.withProductionNodeEnv.call(void 0,
|
|
13604
|
-
() =>
|
|
13718
|
+
() => _chunk2IFT2CSAcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
13605
13719
|
);
|
|
13606
13720
|
}
|
|
13607
13721
|
function createBuildTargetBaseline(config) {
|
|
@@ -13612,7 +13726,7 @@ function createBuildTargetBaseline(config) {
|
|
|
13612
13726
|
preset,
|
|
13613
13727
|
distDir,
|
|
13614
13728
|
outputDir,
|
|
13615
|
-
outputWasDerived: outputDir ===
|
|
13729
|
+
outputWasDerived: outputDir === _chunkKEB7AGS6cjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
13616
13730
|
};
|
|
13617
13731
|
}
|
|
13618
13732
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -13621,8 +13735,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
13621
13735
|
const distDir = config.distDir || ".farm";
|
|
13622
13736
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
13623
13737
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
13624
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
13625
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
13738
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkKEB7AGS6cjs.getDeployTargetForPreset.call(void 0, preset);
|
|
13739
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkKEB7AGS6cjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
13626
13740
|
return {
|
|
13627
13741
|
root,
|
|
13628
13742
|
preset,
|
|
@@ -13630,7 +13744,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
13630
13744
|
distDir,
|
|
13631
13745
|
deployTarget,
|
|
13632
13746
|
outputDir,
|
|
13633
|
-
deployOutputDir:
|
|
13747
|
+
deployOutputDir: _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
13634
13748
|
};
|
|
13635
13749
|
}
|
|
13636
13750
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -13638,7 +13752,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13638
13752
|
const targetBaseline = createBuildTargetBaseline(config);
|
|
13639
13753
|
let targets;
|
|
13640
13754
|
const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))]);
|
|
13641
|
-
const pluginManager = new (0,
|
|
13755
|
+
const pluginManager = new (0, _chunkPMU4U2W2cjs.PluginManager)({
|
|
13642
13756
|
config,
|
|
13643
13757
|
isDev: false,
|
|
13644
13758
|
isProd: true
|
|
@@ -13667,15 +13781,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13667
13781
|
};
|
|
13668
13782
|
config = {
|
|
13669
13783
|
...config,
|
|
13670
|
-
images:
|
|
13784
|
+
images: _chunkKWST2O22cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
13671
13785
|
root: targets.root,
|
|
13672
13786
|
preset: targets.preset
|
|
13673
13787
|
})
|
|
13674
13788
|
};
|
|
13675
|
-
if (_optionalChain([config, 'access',
|
|
13789
|
+
if (_optionalChain([config, 'access', _324 => _324.docs, 'optionalAccess', _325 => _325.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
|
|
13676
13790
|
pluginManager.updateContext({ config });
|
|
13677
13791
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
13678
|
-
|
|
13792
|
+
_chunk2IFT2CSAcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunk2IFT2CSAcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
|
|
13679
13793
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
13680
13794
|
await pluginManager.setupPlugins();
|
|
13681
13795
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -13687,8 +13801,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13687
13801
|
});
|
|
13688
13802
|
_chunkQMNWKQL4cjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
13689
13803
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
13690
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
13691
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
13804
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _326 => _326.status]) === "rejected") throw productionViteResult.reason;
|
|
13805
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _327 => _327.value]);
|
|
13692
13806
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
13693
13807
|
projectModuleServer = await createProjectModuleServer(
|
|
13694
13808
|
createViteServer,
|
|
@@ -13696,17 +13810,17 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13696
13810
|
root,
|
|
13697
13811
|
rendererBuild.signal
|
|
13698
13812
|
);
|
|
13699
|
-
const farmApp =
|
|
13813
|
+
const farmApp = _chunkKWST2O22cjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
13700
13814
|
await farmApp.initialize();
|
|
13701
13815
|
const routeManager = farmApp.getRouteManager();
|
|
13702
13816
|
const serverRenderer = farmApp.getServerRenderer();
|
|
13703
|
-
const typeArtifacts =
|
|
13817
|
+
const typeArtifacts = _chunkCSQPMV3Qcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
13704
13818
|
root,
|
|
13705
13819
|
srcDir,
|
|
13706
13820
|
layers: config.layers,
|
|
13707
13821
|
plugins: config.plugins,
|
|
13708
13822
|
extraRoutes: [
|
|
13709
|
-
..._optionalChain([config, 'access',
|
|
13823
|
+
..._optionalChain([config, 'access', _328 => _328.openapi, 'optionalAccess', _329 => _329.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
13710
13824
|
..._chunkNAXKOTPPcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
13711
13825
|
],
|
|
13712
13826
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
@@ -13791,7 +13905,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13791
13905
|
throw error;
|
|
13792
13906
|
} finally {
|
|
13793
13907
|
try {
|
|
13794
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
13908
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _330 => _330.close, 'call', _331 => _331()]);
|
|
13795
13909
|
} finally {
|
|
13796
13910
|
rendererBuild.abort();
|
|
13797
13911
|
}
|
|
@@ -13803,7 +13917,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13803
13917
|
ssr: true,
|
|
13804
13918
|
buildLifetime
|
|
13805
13919
|
});
|
|
13806
|
-
const viteConfig =
|
|
13920
|
+
const viteConfig = _chunkKWST2O22cjs.mergeFarmViteConfig.call(void 0,
|
|
13807
13921
|
{
|
|
13808
13922
|
root,
|
|
13809
13923
|
appType: "custom",
|
|
@@ -13815,12 +13929,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13815
13929
|
},
|
|
13816
13930
|
plugins: [
|
|
13817
13931
|
...rendererVitePlugins,
|
|
13818
|
-
|
|
13932
|
+
_chunkKWST2O22cjs.farmFontImportsPlugin.call(void 0, {
|
|
13819
13933
|
root,
|
|
13820
13934
|
basePath: config.basePath,
|
|
13821
13935
|
publicDir: config.publicDir
|
|
13822
13936
|
}),
|
|
13823
|
-
|
|
13937
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
|
|
13824
13938
|
// Route modules load here at build time (rendering config, prerendering): `server-only`
|
|
13825
13939
|
// resolves as it does in the server build. Module-entry packages load pre-bundled, as in
|
|
13826
13940
|
// `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
|
|
@@ -13832,7 +13946,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13832
13946
|
hmr: false
|
|
13833
13947
|
},
|
|
13834
13948
|
resolve: {
|
|
13835
|
-
alias:
|
|
13949
|
+
alias: _chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
13836
13950
|
dedupe: [...config.renderer.dedupe || []]
|
|
13837
13951
|
},
|
|
13838
13952
|
optimizeDeps: {
|
|
@@ -13871,10 +13985,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13871
13985
|
noDiscovery: true
|
|
13872
13986
|
},
|
|
13873
13987
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
13874
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
13988
|
+
environments: _optionalChain([viteConfig, 'access', _332 => _332.environments, 'optionalAccess', _333 => _333.ssr, 'optionalAccess', _334 => _334.dev, 'optionalAccess', _335 => _335.createEnvironment]) ? viteConfig.environments : {
|
|
13875
13989
|
...viteConfig.environments,
|
|
13876
13990
|
ssr: {
|
|
13877
|
-
..._optionalChain([viteConfig, 'access',
|
|
13991
|
+
..._optionalChain([viteConfig, 'access', _336 => _336.environments, 'optionalAccess', _337 => _337.ssr]),
|
|
13878
13992
|
...await createFarmProjectModuleSsrEnvironment()
|
|
13879
13993
|
}
|
|
13880
13994
|
}
|
|
@@ -13882,7 +13996,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13882
13996
|
}
|
|
13883
13997
|
async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
13884
13998
|
const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
13885
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
13999
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-5PIQQVRP.cjs");
|
|
13886
14000
|
const pluginManager = new PluginManager2({
|
|
13887
14001
|
config,
|
|
13888
14002
|
isDev: false,
|
|
@@ -13902,14 +14016,14 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
13902
14016
|
farmI18nClientBridgePlugin(),
|
|
13903
14017
|
farmServerOnlyEntriesPlugin(),
|
|
13904
14018
|
farmPlugin(config, pluginManager),
|
|
13905
|
-
|
|
14019
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
13906
14020
|
],
|
|
13907
14021
|
mode: "production"
|
|
13908
14022
|
});
|
|
13909
14023
|
}
|
|
13910
14024
|
async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
13911
14025
|
const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.cjs");
|
|
13912
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
14026
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-5PIQQVRP.cjs");
|
|
13913
14027
|
const pluginManager = new PluginManager2({
|
|
13914
14028
|
config,
|
|
13915
14029
|
isDev: false,
|
|
@@ -13930,12 +14044,12 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
13930
14044
|
define: {
|
|
13931
14045
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
13932
14046
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
13933
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
14047
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _338 => _338.env, 'optionalAccess', _339 => _339.public]) || {})
|
|
13934
14048
|
},
|
|
13935
14049
|
plugins: [
|
|
13936
14050
|
farmI18nClientBridgePlugin(),
|
|
13937
14051
|
farmPlugin(config, pluginManager),
|
|
13938
|
-
|
|
14052
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
13939
14053
|
],
|
|
13940
14054
|
mode: "production"
|
|
13941
14055
|
});
|
|
@@ -13950,7 +14064,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
|
|
|
13950
14064
|
}
|
|
13951
14065
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
13952
14066
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
13953
|
-
import("./nitro-
|
|
14067
|
+
import("./nitro-2LMOMIST.cjs"),
|
|
13954
14068
|
import("nitro/builder")
|
|
13955
14069
|
]);
|
|
13956
14070
|
let nitroConfig = await createNitroConfig(
|
|
@@ -13963,7 +14077,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
13963
14077
|
if (pluginManager) {
|
|
13964
14078
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
13965
14079
|
}
|
|
13966
|
-
const outputDir =
|
|
14080
|
+
const outputDir = _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
13967
14081
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
13968
14082
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
13969
14083
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -14034,7 +14148,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
14034
14148
|
root,
|
|
14035
14149
|
preset,
|
|
14036
14150
|
distDir,
|
|
14037
|
-
outputDir:
|
|
14151
|
+
outputDir: _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
14038
14152
|
});
|
|
14039
14153
|
}
|
|
14040
14154
|
}
|