@farm.js/core 0.1.51-beta.1 → 0.1.51-beta.3
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-WWCC4GLG.mjs → agent-mcp-handler-7JSKGSOW.mjs} +4 -4
- package/dist/{agent-mcp-handler-RT3COCEL.cjs → agent-mcp-handler-YE4AGWHN.cjs} +5 -5
- package/dist/{agent-mcp.d-ZuuNgrkQ.d.ts → agent-mcp.d-BAR9njbJ.d.ts} +1 -1
- package/dist/{agent-mcp.d-BPzpKBHQ.d.mts → agent-mcp.d-BJKChOrO.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/{analyzer-V74FTD2F.mjs → analyzer-OTPEWH5W.mjs} +82 -22
- package/dist/{analyzer-AZULAOPL.cjs → analyzer-TSQXZCZN.cjs} +82 -22
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/{app-manifest.d-HWhqbP2X.d.ts → app-manifest.d-BLFbaqx8.d.ts} +1 -1
- package/dist/{app-manifest.d-BJDcZn3W.d.mts → app-manifest.d-DEQNnNhV.d.mts} +1 -1
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +3 -3
- package/dist/{app.d-B5EWdob-.d.ts → app.d-CNPaUYaa.d.ts} +4 -4
- package/dist/{app.d-DOGW1KI8.d.mts → app.d-CT7xDkj2.d.mts} +4 -4
- package/dist/{chunk-YVJV7Q2X.mjs → chunk-3BLEXUGE.mjs} +1 -1
- package/dist/chunk-3HLQTOVU.cjs +6 -0
- package/dist/{chunk-KU7MBLDZ.mjs → chunk-3SMXQNFD.mjs} +2 -2
- package/dist/{chunk-EWC76P5D.mjs → chunk-3TLKUBXG.mjs} +411 -166
- package/dist/{chunk-BSEKNTMS.mjs → chunk-3WSIYBMG.mjs} +41 -19
- package/dist/{chunk-JVBNKWLV.cjs → chunk-3XQ57EFI.cjs} +16 -16
- package/dist/{chunk-GW4YUIHW.mjs → chunk-3Z63X45F.mjs} +1 -1
- package/dist/{chunk-SCRC5AMM.mjs → chunk-4353ZRE5.mjs} +1 -1
- package/dist/{chunk-SBABQKPT.cjs → chunk-46KXZBOG.cjs} +5 -5
- package/dist/{chunk-2756SHCI.cjs → chunk-4CGOMZP3.cjs} +221 -199
- package/dist/{chunk-RMPNYUGT.cjs → chunk-4SEHMBL4.cjs} +10 -10
- package/dist/{chunk-QAIAFCRZ.mjs → chunk-4TKAIO2F.mjs} +3 -3
- package/dist/{chunk-NJLTQR5P.cjs → chunk-53SACYBY.cjs} +7 -7
- package/dist/{chunk-I3EFXUAR.mjs → chunk-5FXPJIOT.mjs} +2 -2
- package/dist/chunk-7FVVQEVL.cjs +541 -0
- package/dist/{chunk-IFBINMI4.cjs → chunk-7MD37P5V.cjs} +5 -5
- package/dist/{chunk-JATTVAHA.cjs → chunk-B3GM5I6N.cjs} +4 -4
- package/dist/chunk-C3BOESDW.mjs +541 -0
- package/dist/{chunk-WJFFPXCV.cjs → chunk-D7UQC4O6.cjs} +10 -8
- package/dist/{chunk-KRRZJ77U.mjs → chunk-E5DXF5GE.mjs} +2 -2
- package/dist/chunk-EFZGB7JC.cjs +114 -0
- package/dist/{chunk-NYQSC4DX.cjs → chunk-FFE2EMF7.cjs} +5 -5
- package/dist/{chunk-KMB5BMFX.mjs → chunk-GAO7MS5O.mjs} +9 -3
- package/dist/{chunk-HIFIG6HL.cjs → chunk-H33PJEXN.cjs} +5 -5
- package/dist/{chunk-TT66CP3P.cjs → chunk-HLWOWZFX.cjs} +2 -2
- package/dist/chunk-JXEPLIXD.cjs +389 -0
- package/dist/{chunk-VITZRYW3.cjs → chunk-KLNFJDFM.cjs} +15 -9
- package/dist/{chunk-KBRZAYI7.mjs → chunk-LDNSSHEG.mjs} +2 -2
- package/dist/chunk-LLZSYFOM.mjs +6 -0
- package/dist/{chunk-N77JBPLC.mjs → chunk-LPDKG6RA.mjs} +9 -7
- package/dist/chunk-MIGFX2FN.mjs +758 -0
- package/dist/{chunk-72D2NX77.mjs → chunk-MRNDAJEV.mjs} +1 -1
- package/dist/{chunk-5A5GAZ75.mjs → chunk-NOTSHVRN.mjs} +406 -234
- package/dist/{chunk-AGR7VJH2.cjs → chunk-OAMUSC7H.cjs} +1 -1
- package/dist/chunk-P6MHI5O2.cjs +758 -0
- package/dist/{chunk-EOSFVNXZ.mjs → chunk-R4PHCZ3G.mjs} +1 -1
- package/dist/{chunk-X2M4XN4V.cjs → chunk-TQMI6BYO.cjs} +675 -430
- package/dist/{chunk-76GHW3WI.cjs → chunk-TSFMFPRU.cjs} +4 -4
- package/dist/{chunk-5N7QAGEA.cjs → chunk-TWHXBMLJ.cjs} +37 -7
- package/dist/{chunk-BOVGCUDZ.cjs → chunk-UJL4JOXV.cjs} +2 -2
- package/dist/chunk-UQF3OJVE.mjs +389 -0
- package/dist/{chunk-XY4DYGSU.cjs → chunk-WGUHDWT5.cjs} +607 -435
- package/dist/{chunk-LAZK6UV7.mjs → chunk-YAJTD3ZG.mjs} +1 -1
- package/dist/{chunk-7UPCJDB5.mjs → chunk-YUEYBL35.mjs} +2 -2
- package/dist/{chunk-EIMK7D2D.mjs → chunk-ZD2VKAUI.mjs} +34 -4
- package/dist/chunk-ZNXTU4YH.mjs +114 -0
- package/dist/{client-plugins.d-C_3CdALC.d.mts → client-plugins.d-DllmH8eM.d.mts} +31 -5
- package/dist/{client-plugins.d-C0n8Yhh-.d.ts → client-plugins.d-n3iWY1EJ.d.ts} +31 -5
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/{config.d-CnhyvvmT.d.ts → config.d-DqKaCr1r.d.mts} +14 -3
- package/dist/{config.d-CnhyvvmT.d.mts → config.d-DqKaCr1r.d.ts} +14 -3
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/desktop.d.mts +3 -3
- package/dist/desktop.d.ts +3 -3
- package/dist/{devtools-KJFUE5FO.cjs → devtools-TO6TAO32.cjs} +5 -5
- package/dist/{devtools-BU5IT2PD.mjs → devtools-UESYARTF.mjs} +4 -4
- package/dist/docs.cjs +7 -7
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +6 -6
- package/dist/index.cjs +23 -18
- package/dist/{index.d-CsGxS-hZ.d.mts → index.d-BL7KKiwa.d.mts} +1 -1
- package/dist/{index.d-B6M_8kmo.d.ts → index.d-BXsAXm1U.d.ts} +1 -1
- package/dist/index.d.mts +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.mjs +23 -18
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +21 -18
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +20 -17
- package/dist/internal/cli-runtime.cjs +7 -7
- package/dist/internal/cli-runtime.mjs +6 -6
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +2 -2
- package/dist/internal/compression-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +41 -80
- package/dist/internal/config-runtime.d.ts +41 -80
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/infra-analytics-runtime.cjs +8 -8
- package/dist/internal/infra-analytics-runtime.mjs +6 -6
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +91 -9
- package/dist/internal/production-runtime.d.mts +67 -12
- package/dist/internal/production-runtime.d.ts +67 -12
- package/dist/internal/production-runtime.mjs +90 -8
- package/dist/markdown.cjs +4 -2
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.mjs +3 -1
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/mobile.d.mts +21 -5
- package/dist/mobile.d.ts +21 -5
- package/dist/native-tree-EBPDFTRW.mjs +25 -0
- package/dist/native-tree-MMZS7S6W.cjs +25 -0
- package/dist/{navigation-delegate.d-C0BbdUgN.d.mts → navigation-delegate.d-C76gXTmO.d.mts} +1 -1
- package/dist/{navigation-delegate.d-jArRF0ZP.d.ts → navigation-delegate.d-DIyDslxt.d.ts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/plugin.cjs +14 -13
- package/dist/plugin.d.mts +5 -4
- package/dist/plugin.d.ts +5 -4
- package/dist/plugin.mjs +13 -12
- package/dist/{production-runtime.d-DFaQ1qaV.d.mts → production-runtime.d-CDHztggO.d.mts} +1 -1
- package/dist/{production-runtime.d-UnXmSS_S.d.ts → production-runtime.d-tyaGdbk6.d.ts} +1 -1
- package/dist/{programmatic-routes-client.d-VZ0qcbH4.d.ts → programmatic-routes-client.d-XfmIrCK1.d.ts} +2 -2
- package/dist/{programmatic-routes-client.d-BIowUXQC.d.mts → programmatic-routes-client.d-aAWiDd64.d.mts} +2 -2
- package/dist/{render-plan.d-BNeqyPyJ.d.mts → render-plan.d-Diwybxo8.d.mts} +1 -1
- package/dist/{render-plan.d-BB6KrYjP.d.ts → render-plan.d-Dr5WRjoV.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-Bxhghm76.d.ts → request.d-D01fRn--.d.ts} +1 -1
- package/dist/{request.d-BV1munmx.d.mts → request.d-Dd3AFR79.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering.d-DShqKlgK.d.mts → route-rendering.d-BQ53lJ_D.d.mts} +1 -1
- package/dist/{route-rendering.d-BIf7zE9d.d.ts → route-rendering.d-Bhx4QoJt.d.ts} +1 -1
- package/dist/{router.d-BE7i84fb.d.mts → router.d-Bi23a6Xc.d.mts} +1 -1
- package/dist/{router.d-Bw3K3b0a.d.ts → router.d-DQ3k7EYn.d.ts} +1 -1
- package/dist/{routes.d-_5tBQexL.d.mts → routes.d-BgTd7vI4.d.mts} +91 -4
- package/dist/{routes.d-DVZQL0-H.d.ts → routes.d-C7jMJFvP.d.ts} +91 -4
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{rsc-pipeline-FBM6NFYY.mjs → rsc-pipeline-K3ER3Q4N.mjs} +5 -5
- package/dist/{rsc-pipeline-IQI5XQLS.cjs → rsc-pipeline-OCZIT5OF.cjs} +6 -6
- package/dist/{runtime-DXEVFYLE.cjs → runtime-DKNSIH7V.cjs} +85 -29
- package/dist/{runtime-2JYIDUON.mjs → runtime-MKYDEUZT.mjs} +75 -19
- package/dist/{runtime.d-CQgoYR0Q.d.mts → runtime.d-B2Js6qZ2.d.mts} +1 -1
- package/dist/{runtime.d-CfhaLPl-.d.ts → runtime.d-BL-CGwoi.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +31 -30
- package/dist/server.d.mts +11 -10
- package/dist/server.d.ts +11 -10
- package/dist/server.mjs +16 -15
- package/dist/session-AAU7RNRO.cjs +23 -0
- package/dist/session-IGEDQ5PY.mjs +23 -0
- package/dist/{spa-router.d-D63jb6nX.d.mts → spa-router.d-B2rIFGs0.d.mts} +2 -2
- package/dist/{spa-router.d-C5opIgXg.d.ts → spa-router.d-DqZ6Lfs0.d.ts} +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/{utils.d-CkpTqTsC.d.ts → utils.d-Bv2MPeLR.d.ts} +1 -1
- package/dist/{utils.d-CO-U4OVZ.d.mts → utils.d-fqXe8lNc.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +14 -13
- package/dist/vite.d.mts +12 -6
- package/dist/vite.d.ts +12 -6
- package/dist/vite.mjs +13 -12
- package/package.json +3 -3
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkEFZGB7JCcjs = require('./chunk-EFZGB7JC.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
3
12
|
var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
4
13
|
|
|
5
14
|
|
|
@@ -15,12 +24,14 @@ var _chunkVZY7MAVScjs = require('./chunk-VZY7MAVS.cjs');
|
|
|
15
24
|
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
16
25
|
|
|
17
26
|
|
|
27
|
+
var _chunk7FVVQEVLcjs = require('./chunk-7FVVQEVL.cjs');
|
|
28
|
+
|
|
18
29
|
|
|
19
30
|
|
|
20
31
|
|
|
21
32
|
|
|
22
|
-
var _chunkJVBNKWLVcjs = require('./chunk-JVBNKWLV.cjs');
|
|
23
33
|
|
|
34
|
+
var _chunk3XQ57EFIcjs = require('./chunk-3XQ57EFI.cjs');
|
|
24
35
|
|
|
25
36
|
|
|
26
37
|
|
|
@@ -31,7 +42,8 @@ var _chunkJVBNKWLVcjs = require('./chunk-JVBNKWLV.cjs');
|
|
|
31
42
|
|
|
32
43
|
|
|
33
44
|
|
|
34
|
-
|
|
45
|
+
|
|
46
|
+
var _chunkTWHXBMLJcjs = require('./chunk-TWHXBMLJ.cjs');
|
|
35
47
|
|
|
36
48
|
|
|
37
49
|
|
|
@@ -39,7 +51,7 @@ var _chunk5N7QAGEAcjs = require('./chunk-5N7QAGEA.cjs');
|
|
|
39
51
|
var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
|
|
40
52
|
|
|
41
53
|
|
|
42
|
-
var
|
|
54
|
+
var _chunk7MD37P5Vcjs = require('./chunk-7MD37P5V.cjs');
|
|
43
55
|
|
|
44
56
|
|
|
45
57
|
var _chunkBRWIVOV4cjs = require('./chunk-BRWIVOV4.cjs');
|
|
@@ -54,7 +66,8 @@ var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
|
54
66
|
|
|
55
67
|
|
|
56
68
|
|
|
57
|
-
var
|
|
69
|
+
var _chunkKLNFJDFMcjs = require('./chunk-KLNFJDFM.cjs');
|
|
70
|
+
|
|
58
71
|
|
|
59
72
|
|
|
60
73
|
|
|
@@ -86,7 +99,8 @@ var _chunkVITZRYW3cjs = require('./chunk-VITZRYW3.cjs');
|
|
|
86
99
|
|
|
87
100
|
|
|
88
101
|
|
|
89
|
-
|
|
102
|
+
|
|
103
|
+
var _chunkTQMI6BYOcjs = require('./chunk-TQMI6BYO.cjs');
|
|
90
104
|
|
|
91
105
|
|
|
92
106
|
var _chunkLNM57D3Hcjs = require('./chunk-LNM57D3H.cjs');
|
|
@@ -110,7 +124,10 @@ var _chunkUQHIWZZ6cjs = require('./chunk-UQHIWZZ6.cjs');
|
|
|
110
124
|
|
|
111
125
|
|
|
112
126
|
|
|
113
|
-
var
|
|
127
|
+
var _chunkTSFMFPRUcjs = require('./chunk-TSFMFPRU.cjs');
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
114
131
|
|
|
115
132
|
|
|
116
133
|
var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
@@ -124,18 +141,18 @@ var _chunkSGBNF56Scjs = require('./chunk-SGBNF56S.cjs');
|
|
|
124
141
|
|
|
125
142
|
|
|
126
143
|
|
|
127
|
-
var
|
|
144
|
+
var _chunk4SEHMBL4cjs = require('./chunk-4SEHMBL4.cjs');
|
|
128
145
|
|
|
129
146
|
|
|
130
147
|
|
|
131
148
|
|
|
132
|
-
var
|
|
149
|
+
var _chunk46KXZBOGcjs = require('./chunk-46KXZBOG.cjs');
|
|
133
150
|
|
|
134
151
|
|
|
135
152
|
var _chunkNK2VWS7Pcjs = require('./chunk-NK2VWS7P.cjs');
|
|
136
153
|
|
|
137
154
|
|
|
138
|
-
var
|
|
155
|
+
var _chunkB3GM5I6Ncjs = require('./chunk-B3GM5I6N.cjs');
|
|
139
156
|
|
|
140
157
|
|
|
141
158
|
|
|
@@ -188,7 +205,7 @@ var _chunkXYL4HSVCcjs = require('./chunk-XYL4HSVC.cjs');
|
|
|
188
205
|
var _chunkFK25QSVCcjs = require('./chunk-FK25QSVC.cjs');
|
|
189
206
|
|
|
190
207
|
|
|
191
|
-
var
|
|
208
|
+
var _chunkD7UQC4O6cjs = require('./chunk-D7UQC4O6.cjs');
|
|
192
209
|
|
|
193
210
|
|
|
194
211
|
var _chunkJMYXO572cjs = require('./chunk-JMYXO572.cjs');
|
|
@@ -233,7 +250,7 @@ var _chunkVQJYGZNXcjs = require('./chunk-VQJYGZNX.cjs');
|
|
|
233
250
|
var _chunkB5BBTPJQcjs = require('./chunk-B5BBTPJQ.cjs');
|
|
234
251
|
|
|
235
252
|
|
|
236
|
-
var
|
|
253
|
+
var _chunkOAMUSC7Hcjs = require('./chunk-OAMUSC7H.cjs');
|
|
237
254
|
|
|
238
255
|
|
|
239
256
|
var _chunkE552H232cjs = require('./chunk-E552H232.cjs');
|
|
@@ -340,7 +357,7 @@ function getDocsTitle(docs) {
|
|
|
340
357
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
341
358
|
}
|
|
342
359
|
function loadPages(contentDir, docs) {
|
|
343
|
-
return
|
|
360
|
+
return _chunkTWHXBMLJcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkTWHXBMLJcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
344
361
|
}
|
|
345
362
|
function findSocialImagePath(html) {
|
|
346
363
|
const match = /<meta\s+property=["']og:image["']\s+content=["']([^"']+)["']/i.exec(html) || /<meta\s+content=["']([^"']+)["']\s+property=["']og:image["']/i.exec(html);
|
|
@@ -358,14 +375,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
358
375
|
return response;
|
|
359
376
|
}
|
|
360
377
|
async function compileFarmDocsManifest(docs, options) {
|
|
361
|
-
const contentDir =
|
|
378
|
+
const contentDir = _chunkTWHXBMLJcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
362
379
|
const pages = loadPages(contentDir, docs);
|
|
363
380
|
const absolutePaths = [
|
|
364
381
|
_path2.default.resolve(options.root),
|
|
365
382
|
_path2.default.resolve(contentDir),
|
|
366
383
|
docs.configPath || ""
|
|
367
384
|
];
|
|
368
|
-
const handler =
|
|
385
|
+
const handler = _chunkTWHXBMLJcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
369
386
|
root: options.root,
|
|
370
387
|
srcDir: options.srcDir,
|
|
371
388
|
clientEntry: options.clientEntry,
|
|
@@ -374,7 +391,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
374
391
|
globalStylesheetHref: options.globalStylesheetHref,
|
|
375
392
|
isPathGuarded: options.isPathGuarded
|
|
376
393
|
});
|
|
377
|
-
const apiHandler =
|
|
394
|
+
const apiHandler = _chunk3XQ57EFIcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
378
395
|
rootDir: options.root,
|
|
379
396
|
srcDir: options.srcDir,
|
|
380
397
|
docs,
|
|
@@ -385,7 +402,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
385
402
|
const apiMarkdown = {};
|
|
386
403
|
for (const page of pages) {
|
|
387
404
|
const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
|
|
388
|
-
const markdownPath =
|
|
405
|
+
const markdownPath = _chunkTWHXBMLJcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
|
|
389
406
|
await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
|
|
390
407
|
if (htmlResponse) {
|
|
391
408
|
const socialImagePath = findSocialImagePath(await htmlResponse.text());
|
|
@@ -469,7 +486,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
469
486
|
post: await compileResponse(postResponse, absolutePaths),
|
|
470
487
|
search: {
|
|
471
488
|
pages: publicPages.map((page) => ({
|
|
472
|
-
...
|
|
489
|
+
..._chunkTWHXBMLJcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
473
490
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
474
491
|
})),
|
|
475
492
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -1615,7 +1632,7 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
1615
1632
|
throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
|
|
1616
1633
|
}
|
|
1617
1634
|
const replacements = [];
|
|
1618
|
-
let needsAst = hasRequireTemplate;
|
|
1635
|
+
let needsAst = hasRequireTemplate && /(?<![\w$])require\(`/.test(code);
|
|
1619
1636
|
if (!needsAst) {
|
|
1620
1637
|
const seenStarts = /* @__PURE__ */ new Set();
|
|
1621
1638
|
for (const { moduleRequest } of parsed.module.dynamicImports) {
|
|
@@ -1758,7 +1775,9 @@ function hasFarmPluginRoutes(config) {
|
|
|
1758
1775
|
}
|
|
1759
1776
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1760
1777
|
return (config.plugins || []).some(
|
|
1761
|
-
(plugin) => _chunkCECUDGXQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false &&
|
|
1778
|
+
(plugin) => _chunkCECUDGXQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && // Mobile session tokens change only bearer requests and cookie-clearing responses, which a
|
|
1779
|
+
// prerendered file never answers or sends; its endpoints live under /__farm/.
|
|
1780
|
+
plugin.name !== _chunk7FVVQEVLcjs.FARM_MOBILE_SESSION_PLUGIN && _chunk47JV57DAcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1762
1781
|
);
|
|
1763
1782
|
}
|
|
1764
1783
|
async function discoverMiddlewareRoutes(appDir) {
|
|
@@ -1817,7 +1836,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1817
1836
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1818
1837
|
const srcDir = config.srcDir || "src";
|
|
1819
1838
|
const distDir = config.distDir || ".farm";
|
|
1820
|
-
const deployOutputDir =
|
|
1839
|
+
const deployOutputDir = _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1821
1840
|
const lifecyclePluginManager = options.pluginManager;
|
|
1822
1841
|
const productionViteResultPromise = Promise.allSettled([
|
|
1823
1842
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -1836,7 +1855,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1836
1855
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
1837
1856
|
const pageRoutes = [];
|
|
1838
1857
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
1839
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
1858
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
1840
1859
|
pageRoutes.push({
|
|
1841
1860
|
pattern,
|
|
1842
1861
|
...entry.directory ? { directory: entry.directory } : {},
|
|
@@ -1907,6 +1926,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1907
1926
|
}
|
|
1908
1927
|
const productionVite = productionViteResult.value;
|
|
1909
1928
|
_chunkVQJYGZNXcjs.logger.info("\u26A1 Building application bundles with Vite Rolldown");
|
|
1929
|
+
const mobileClient = shouldBuildFarmMobileClient(config);
|
|
1910
1930
|
const buildClientBundle = () => buildClient(
|
|
1911
1931
|
productionVite,
|
|
1912
1932
|
config,
|
|
@@ -1919,7 +1939,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1919
1939
|
isolatedClientBoundaryModules,
|
|
1920
1940
|
hydrationPlanCache,
|
|
1921
1941
|
rendererBuildLifetime,
|
|
1922
|
-
routeManager.getProgrammaticClientRoutes()
|
|
1942
|
+
routeManager.getProgrammaticClientRoutes(),
|
|
1943
|
+
mobileClient
|
|
1923
1944
|
);
|
|
1924
1945
|
const buildSSRBundle = () => buildSSRInMemory(
|
|
1925
1946
|
productionVite,
|
|
@@ -1972,7 +1993,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1972
1993
|
isolatedClientBoundaryModules,
|
|
1973
1994
|
hydrationPlanCache,
|
|
1974
1995
|
rendererBuildLifetime,
|
|
1975
|
-
routeManager.getProgrammaticClientRoutes()
|
|
1996
|
+
routeManager.getProgrammaticClientRoutes(),
|
|
1997
|
+
mobileClient
|
|
1976
1998
|
);
|
|
1977
1999
|
} catch (retryError) {
|
|
1978
2000
|
if (!(retryError instanceof IncompleteClientBuildOutputError)) throw retryError;
|
|
@@ -2031,6 +2053,27 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2031
2053
|
_optionalChain([rendererBuild, 'optionalAccess', _53 => _53.abort, 'call', _54 => _54()]);
|
|
2032
2054
|
}
|
|
2033
2055
|
}
|
|
2056
|
+
function shouldBuildFarmMobileClient(config, options = {}) {
|
|
2057
|
+
if (!config.mobileClient || config.desktop) return false;
|
|
2058
|
+
const mode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _55 => _55.experimental, 'optionalAccess', _56 => _56.serverComponents]));
|
|
2059
|
+
if (mode === void 0) return true;
|
|
2060
|
+
if (!options.quiet)
|
|
2061
|
+
_chunkVQJYGZNXcjs.logger.info(
|
|
2062
|
+
`\u{1F4F1} No mobile client for experimental.serverComponents (${mode}) yet; a mobile shell loads the web client.`
|
|
2063
|
+
);
|
|
2064
|
+
return false;
|
|
2065
|
+
}
|
|
2066
|
+
function varyFarmNitroCacheRulesByShell(rules) {
|
|
2067
|
+
return Object.fromEntries(
|
|
2068
|
+
Object.entries(rules).map(([source, rule]) => {
|
|
2069
|
+
const cached = _optionalChain([rule, 'optionalAccess', _57 => _57.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _58 => _58.cache]) !== void 0 && rule.cache !== false;
|
|
2070
|
+
if (!cached || rule.cache === false) return [source, rule];
|
|
2071
|
+
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
2072
|
+
const varies = [...Array.isArray(cache.varies) ? cache.varies : [], "x-farm-shell"];
|
|
2073
|
+
return [source, { ...rule, cache: { ...cache, varies } }];
|
|
2074
|
+
})
|
|
2075
|
+
);
|
|
2076
|
+
}
|
|
2034
2077
|
async function writeSSRAssetsToClient(bundle, outputDir) {
|
|
2035
2078
|
const fs4 = await import("fs/promises");
|
|
2036
2079
|
for (const [fileName, output] of Object.entries(bundle)) {
|
|
@@ -2073,7 +2116,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2073
2116
|
}
|
|
2074
2117
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
2075
2118
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
2076
|
-
await fs4.writeFile(clientCssPath,
|
|
2119
|
+
await fs4.writeFile(clientCssPath, _chunkTQMI6BYOcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
2077
2120
|
}
|
|
2078
2121
|
var IncompleteClientBuildOutputError = class extends Error {
|
|
2079
2122
|
constructor(detail) {
|
|
@@ -2119,12 +2162,13 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
2119
2162
|
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)}`;
|
|
2120
2163
|
let plan = cache.get(key);
|
|
2121
2164
|
if (!plan) {
|
|
2122
|
-
plan =
|
|
2165
|
+
plan = _chunkTQMI6BYOcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2123
2166
|
cache.set(key, plan);
|
|
2124
2167
|
}
|
|
2125
2168
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
2126
2169
|
}
|
|
2127
|
-
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes) {
|
|
2170
|
+
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes, mobile = false) {
|
|
2171
|
+
if (!mobile) await _chunkEFZGB7JCcjs.removeFarmMobileClientManifest.call(void 0, _path2.default.dirname(outputDir));
|
|
2128
2172
|
const viteBuild = productionVite.build;
|
|
2129
2173
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
2130
2174
|
const { PluginManager: PluginManager2 } = await import("./plugin-HZIBL3DW.cjs");
|
|
@@ -2142,25 +2186,25 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2142
2186
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2143
2187
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2144
2188
|
);
|
|
2145
|
-
if (_optionalChain([config, 'access',
|
|
2189
|
+
if (_optionalChain([config, 'access', _59 => _59.experimental, 'optionalAccess', _60 => _60.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _61 => _61.experimental, 'optionalAccess', _62 => _62.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2146
2190
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
2147
2191
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2148
2192
|
);
|
|
2149
2193
|
}
|
|
2150
|
-
const isolatedMode =
|
|
2151
|
-
_optionalChain([config, 'access',
|
|
2194
|
+
const isolatedMode = _chunkTQMI6BYOcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2195
|
+
_optionalChain([config, 'access', _63 => _63.experimental, 'optionalAccess', _64 => _64.isolatedClientHydration]),
|
|
2152
2196
|
{
|
|
2153
|
-
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2197
|
+
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _65 => _65.experimental, 'optionalAccess', _66 => _66.serverComponents])) === "rsc",
|
|
2154
2198
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2155
2199
|
}
|
|
2156
2200
|
);
|
|
2157
|
-
const planOptions =
|
|
2201
|
+
const planOptions = _chunkTQMI6BYOcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2158
2202
|
config.renderer,
|
|
2159
2203
|
Boolean(unsupportedIntegrationProvider)
|
|
2160
2204
|
);
|
|
2161
2205
|
const pagePlanOptions = {
|
|
2162
2206
|
...planOptions,
|
|
2163
|
-
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2207
|
+
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _67 => _67.experimental, 'optionalAccess', _68 => _68.serverComponents])) === "islands"
|
|
2164
2208
|
};
|
|
2165
2209
|
const layoutPlanOptions = {
|
|
2166
2210
|
...planOptions,
|
|
@@ -2211,21 +2255,21 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2211
2255
|
};
|
|
2212
2256
|
}
|
|
2213
2257
|
});
|
|
2214
|
-
const layoutAppliesToRoute =
|
|
2258
|
+
const layoutAppliesToRoute = _chunkTSFMFPRUcjs.routeBoundaryCoversDirectory;
|
|
2215
2259
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
2216
2260
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2217
|
-
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
2261
|
+
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _69 => _69.docs, 'optionalAccess', _70 => _70.enabled]) && _optionalChain([config, 'access', _71 => _71.docs, 'access', _72 => _72.adapter, 'optionalAccess', _73 => _73.server]) && config.docs.adapter.react
|
|
2218
2262
|
);
|
|
2219
|
-
const docsEntries = _optionalChain([config, 'access',
|
|
2263
|
+
const docsEntries = _optionalChain([config, 'access', _74 => _74.docs, 'optionalAccess', _75 => _75.enabled]) ? _chunkTWHXBMLJcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
2220
2264
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
2221
2265
|
) : [];
|
|
2222
2266
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
2223
2267
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
2224
2268
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
2225
2269
|
);
|
|
2226
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
2270
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _76 => _76.docs, 'optionalAccess', _77 => _77.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2227
2271
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2228
|
-
const markdownPagePlan =
|
|
2272
|
+
const markdownPagePlan = _chunkTQMI6BYOcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2229
2273
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2230
2274
|
root,
|
|
2231
2275
|
isolatedMode,
|
|
@@ -2233,7 +2277,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2233
2277
|
);
|
|
2234
2278
|
const routePlans = pageRoutes.map((route) => ({
|
|
2235
2279
|
route,
|
|
2236
|
-
metadata:
|
|
2280
|
+
metadata: _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2237
2281
|
route.modulePath,
|
|
2238
2282
|
root,
|
|
2239
2283
|
isolatedMode,
|
|
@@ -2241,7 +2285,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2241
2285
|
pagePlanOptions
|
|
2242
2286
|
)
|
|
2243
2287
|
}));
|
|
2244
|
-
|
|
2288
|
+
_chunkTQMI6BYOcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2245
2289
|
clientLayouts.map((layout) => ({
|
|
2246
2290
|
pattern: layout.pattern,
|
|
2247
2291
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2250,7 +2294,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2250
2294
|
[
|
|
2251
2295
|
...routePlans.map(({ route, metadata }) => ({
|
|
2252
2296
|
pattern: routeDirectory(route),
|
|
2253
|
-
depth:
|
|
2297
|
+
depth: _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
2254
2298
|
metadata
|
|
2255
2299
|
})),
|
|
2256
2300
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -2273,7 +2317,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2273
2317
|
for (const layout of clientLayouts) {
|
|
2274
2318
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
2275
2319
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2276
|
-
_chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F ${
|
|
2320
|
+
_chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F ${_chunkTQMI6BYOcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2277
2321
|
}
|
|
2278
2322
|
}
|
|
2279
2323
|
if (isolatedMode === "analyze") {
|
|
@@ -2297,7 +2341,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2297
2341
|
);
|
|
2298
2342
|
if (metadata.suppressedAsyncHydration) {
|
|
2299
2343
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
2300
|
-
`\u26A0\uFE0F ${
|
|
2344
|
+
`\u26A0\uFE0F ${_chunkTQMI6BYOcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2301
2345
|
);
|
|
2302
2346
|
}
|
|
2303
2347
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2322,7 +2366,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2322
2366
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
2323
2367
|
],
|
|
2324
2368
|
// The server renders a server tree only below a hydrating layout.
|
|
2325
|
-
...
|
|
2369
|
+
..._chunkTQMI6BYOcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2326
2370
|
});
|
|
2327
2371
|
_chunkVQJYGZNXcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2328
2372
|
}
|
|
@@ -2358,7 +2402,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2358
2402
|
}
|
|
2359
2403
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2360
2404
|
try {
|
|
2361
|
-
return
|
|
2405
|
+
return _chunkTQMI6BYOcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2362
2406
|
} catch (error) {
|
|
2363
2407
|
_chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2364
2408
|
return false;
|
|
@@ -2367,206 +2411,229 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2367
2411
|
_chunkVQJYGZNXcjs.logger.info(
|
|
2368
2412
|
`\u{1F4F1} Total hydratable routes detected: ${clientPages.length} pages, ${clientLayouts.filter((layout) => layout.shouldHydrate || layout.hasIsolatedClientBoundaries).length} layouts, and ${clientRouteSlots.length} slots`
|
|
2369
2413
|
);
|
|
2370
|
-
const
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
srcDir,
|
|
2380
|
-
adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2381
|
-
adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2382
|
-
_optionalChain([config, 'access', _74 => _74.docs, 'optionalAccess', _75 => _75.enabled]) ? _chunk5N7QAGEAcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
2383
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _76 => _76.docs, 'access', _77 => _77.adapter, 'optionalAccess', _78 => _78.react]) : void 0,
|
|
2384
|
-
config.i18n,
|
|
2385
|
-
config.plugins,
|
|
2386
|
-
config.renderer,
|
|
2387
|
-
config.publicRuntimeConfig,
|
|
2388
|
-
config.trailingSlash,
|
|
2389
|
-
_chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2390
|
-
config.basePath,
|
|
2391
|
-
_chunkX2M4XN4Vcjs.generateClientCachePersistenceCode.call(void 0, _chunkX2M4XN4Vcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2392
|
-
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2393
|
-
_chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _79 => _79.experimental, 'optionalAccess', _80 => _80.serverComponents])) === "islands"
|
|
2394
|
-
);
|
|
2395
|
-
await fs4.writeFile(clientEntryPath, clientHydrationCode);
|
|
2396
|
-
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2397
|
-
let postcssSearchPath;
|
|
2398
|
-
let tailwindVitePlugin = void 0;
|
|
2399
|
-
const rendererVitePlugins = await _chunkRD623KW4cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
2400
|
-
ssr: false,
|
|
2401
|
-
buildLifetime: rendererBuildLifetime
|
|
2402
|
-
});
|
|
2403
|
-
if (hasScopedPostcssConfig) {
|
|
2404
|
-
_chunkVQJYGZNXcjs.logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
2405
|
-
} else {
|
|
2406
|
-
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2407
|
-
await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2408
|
-
postcssSearchPath = clientEntryDir;
|
|
2409
|
-
tailwindVitePlugin = await _chunkLNM57D3Hcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2410
|
-
builder: productionVite.builder,
|
|
2411
|
-
announce: true
|
|
2412
|
-
});
|
|
2413
|
-
}
|
|
2414
|
-
try {
|
|
2415
|
-
const clientViteConfig = {
|
|
2414
|
+
const buildTarget = async (platform) => {
|
|
2415
|
+
const clientEntryRoot = _path2.default.join(root, ".farm", "tmp");
|
|
2416
|
+
await fs4.mkdir(clientEntryRoot, { recursive: true });
|
|
2417
|
+
const clientEntryDir = await fs4.mkdtemp(_path2.default.join(clientEntryRoot, "client-entry-"));
|
|
2418
|
+
const clientEntryPath = _path2.default.join(clientEntryDir, "farm-client-entry.tsx");
|
|
2419
|
+
const clientHydrationCode = generateClientHydrationEntry(
|
|
2420
|
+
clientPages,
|
|
2421
|
+
clientLayouts,
|
|
2422
|
+
clientRouteSlots,
|
|
2416
2423
|
root,
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2424
|
+
srcDir,
|
|
2425
|
+
adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2426
|
+
adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2427
|
+
_optionalChain([config, 'access', _78 => _78.docs, 'optionalAccess', _79 => _79.enabled]) ? _chunkTWHXBMLJcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
2428
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _80 => _80.docs, 'access', _81 => _81.adapter, 'optionalAccess', _82 => _82.react]) : void 0,
|
|
2429
|
+
config.i18n,
|
|
2430
|
+
config.plugins,
|
|
2431
|
+
config.renderer,
|
|
2432
|
+
config.publicRuntimeConfig,
|
|
2433
|
+
config.trailingSlash,
|
|
2434
|
+
_chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2435
|
+
config.basePath,
|
|
2436
|
+
_chunkTQMI6BYOcjs.generateClientCachePersistenceCode.call(void 0, _chunkTQMI6BYOcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2437
|
+
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2438
|
+
_chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _83 => _83.experimental, 'optionalAccess', _84 => _84.serverComponents])) === "islands",
|
|
2439
|
+
platform
|
|
2440
|
+
);
|
|
2441
|
+
const entryName = platform === "mobile" ? _chunkEFZGB7JCcjs.FARM_MOBILE_CLIENT_ENTRY_NAME : "farm-client";
|
|
2442
|
+
await fs4.writeFile(clientEntryPath, clientHydrationCode);
|
|
2443
|
+
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2444
|
+
let postcssSearchPath;
|
|
2445
|
+
let tailwindVitePlugin = void 0;
|
|
2446
|
+
const rendererVitePlugins = await _chunkRD623KW4cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
2447
|
+
ssr: false,
|
|
2448
|
+
buildLifetime: rendererBuildLifetime
|
|
2449
|
+
});
|
|
2450
|
+
if (hasScopedPostcssConfig) {
|
|
2451
|
+
_chunkVQJYGZNXcjs.logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
2452
|
+
} else {
|
|
2453
|
+
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2454
|
+
await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2455
|
+
postcssSearchPath = clientEntryDir;
|
|
2456
|
+
tailwindVitePlugin = await _chunkLNM57D3Hcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2457
|
+
builder: productionVite.builder,
|
|
2458
|
+
announce: true
|
|
2459
|
+
});
|
|
2460
|
+
}
|
|
2461
|
+
try {
|
|
2462
|
+
const clientViteConfig = {
|
|
2463
|
+
root,
|
|
2464
|
+
// Vite otherwise falls back to <root>/public, silently dropping every
|
|
2465
|
+
// asset in a custom config.publicDir from the production client output.
|
|
2466
|
+
// The mobile client adds to the web client's output; public files are copied once.
|
|
2467
|
+
publicDir: platform === "mobile" ? false : config.publicDir,
|
|
2468
|
+
esbuild: {
|
|
2469
|
+
jsxDev: false
|
|
2470
|
+
},
|
|
2471
|
+
build: {
|
|
2472
|
+
// Preserve Farm's Vite 5 browser baseline when the production builder
|
|
2473
|
+
// uses Vite 8, whose default target only covers newer browsers.
|
|
2474
|
+
target: FARM_CLIENT_BUILD_TARGET,
|
|
2475
|
+
outDir: outputDir,
|
|
2476
|
+
emptyOutDir: platform === "web",
|
|
2477
|
+
// Never public: see resolveFarmClientSourcemap.
|
|
2478
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _85 => _85.vite, 'optionalAccess', _86 => _86.build, 'optionalAccess', _87 => _87.sourcemap])),
|
|
2479
|
+
assetsInlineLimit: 0,
|
|
2480
|
+
cssCodeSplit: false,
|
|
2481
|
+
// Bundle all CSS into one file
|
|
2482
|
+
rollupOptions: {
|
|
2483
|
+
input: {
|
|
2484
|
+
[entryName]: clientEntryPath
|
|
2485
|
+
},
|
|
2486
|
+
output: {
|
|
2487
|
+
entryFileNames: "[name]-h[hash].js",
|
|
2488
|
+
chunkFileNames: "chunks/[name]-h[hash].js",
|
|
2489
|
+
hashCharacters: "hex",
|
|
2490
|
+
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2491
|
+
assetFileNames: (assetInfo) => {
|
|
2492
|
+
if (_optionalChain([assetInfo, 'access', _88 => _88.name, 'optionalAccess', _89 => _89.endsWith, 'call', _90 => _90(".css")])) {
|
|
2493
|
+
return `${entryName}.css`;
|
|
2494
|
+
}
|
|
2495
|
+
return "assets/[name]-h[hash][extname]";
|
|
2446
2496
|
}
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
return
|
|
2497
|
+
},
|
|
2498
|
+
// A browser cannot load a Node builtin: farmServerOnlyEntriesPlugin
|
|
2499
|
+
// resolves one to Farm's browser module for it instead.
|
|
2500
|
+
external: (id) => {
|
|
2501
|
+
if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node")) {
|
|
2502
|
+
return true;
|
|
2503
|
+
}
|
|
2504
|
+
return false;
|
|
2455
2505
|
}
|
|
2456
|
-
return false;
|
|
2457
2506
|
}
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2507
|
+
},
|
|
2508
|
+
plugins: [
|
|
2509
|
+
_chunkTQMI6BYOcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2510
|
+
createFarmPrivateClientSourcemapsPlugin({
|
|
2511
|
+
outDir: _path2.default.join(
|
|
2512
|
+
_path2.default.dirname(outputDir),
|
|
2513
|
+
platform === "mobile" ? `${FARM_CLIENT_SOURCEMAPS_DIR}-mobile` : FARM_CLIENT_SOURCEMAPS_DIR
|
|
2514
|
+
)
|
|
2515
|
+
}),
|
|
2516
|
+
// The web client's preload manifests; the mobile client records its files instead.
|
|
2517
|
+
platform === "mobile" ? _chunkEFZGB7JCcjs.createFarmMobileClientManifestPlugin.call(void 0, {
|
|
2518
|
+
buildDir: _path2.default.dirname(outputDir),
|
|
2519
|
+
entryName
|
|
2520
|
+
}) : createFarmClientModulePreloadPlugin({
|
|
2472
2521
|
root,
|
|
2473
2522
|
buildDir: _path2.default.dirname(outputDir),
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2523
|
+
entryName: "farm-client"
|
|
2524
|
+
}),
|
|
2525
|
+
...adapterOwnsDocsRuntime && platform === "web" ? [
|
|
2526
|
+
createFarmDocsModulePreloadPlugin({
|
|
2527
|
+
root,
|
|
2528
|
+
buildDir: _path2.default.dirname(outputDir),
|
|
2529
|
+
importer: clientEntryPath,
|
|
2530
|
+
entryName: "farm-client",
|
|
2531
|
+
modules: [
|
|
2532
|
+
config.docs.adapter.react,
|
|
2533
|
+
_chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
|
|
2534
|
+
].filter((specifier) => Boolean(specifier))
|
|
2535
|
+
})
|
|
2536
|
+
] : [],
|
|
2537
|
+
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
2538
|
+
...rendererVitePlugins,
|
|
2539
|
+
...config.vite.plugins || [],
|
|
2540
|
+
farmServerOnlyEntriesPlugin({ platform }),
|
|
2541
|
+
_chunkTQMI6BYOcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2542
|
+
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2543
|
+
),
|
|
2544
|
+
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
2545
|
+
{
|
|
2546
|
+
name: "farm-client-only-imports",
|
|
2547
|
+
enforce: "pre",
|
|
2548
|
+
resolveId(id) {
|
|
2549
|
+
if (id === "@farm.js/core") {
|
|
2550
|
+
return { id: "\0farm-client-exports", external: false };
|
|
2551
|
+
}
|
|
2552
|
+
if (id === "@farm.js/core/i18n/server") {
|
|
2553
|
+
return { id: "\0farm-i18n-client-bridge", external: false };
|
|
2554
|
+
}
|
|
2555
|
+
if (id === "@farm.js/core/server" || id === "@farm.js/core/api" || id === "@farm.js/core/middleware" || id === "@farm.js/core/headers" || id === "@farm.js/core/config" || id.includes("@farm.js/core/middleware") || id.includes("@farm.js/core/query/server")) {
|
|
2556
|
+
return { id: "\0empty-module", external: false };
|
|
2557
|
+
}
|
|
2558
|
+
if (id.includes("/api/") && id.includes("/route")) {
|
|
2559
|
+
return { id: "\0empty-api-route", external: false };
|
|
2560
|
+
}
|
|
2561
|
+
if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rolldown" || id.startsWith("rolldown/") || id === "rollup" || id.startsWith("nitro/") || id.includes("node-pre-gyp") || id.includes("nf3")) {
|
|
2562
|
+
return { id: "\0empty-module", external: false };
|
|
2563
|
+
}
|
|
2564
|
+
return null;
|
|
2565
|
+
},
|
|
2566
|
+
load(id) {
|
|
2567
|
+
if (id === "\0empty-module") {
|
|
2568
|
+
return "const emptyMiddlewareStore = new Map(); export default {}; export const getMiddlewareContext = () => emptyMiddlewareStore; export const getMiddlewareData = () => emptyMiddlewareStore; export const getMiddlewareValue = () => undefined; export const middleware = () => ({});";
|
|
2569
|
+
}
|
|
2570
|
+
if (id === "\0empty-api-route") {
|
|
2571
|
+
return "export const GET = () => {}; export const HEAD = () => {}; export const QUERY = () => {}; export const POST = () => {}; export const PUT = () => {}; export const DELETE = () => {}; export const PATCH = () => {}; export const OPTIONS = () => {}; export default {};";
|
|
2572
|
+
}
|
|
2573
|
+
if (id === "\0farm-i18n-client-bridge") {
|
|
2574
|
+
return 'export { createTranslator, format, getLocale, getLocaleSource, t } from "@farm.js/core/i18n/client";';
|
|
2575
|
+
}
|
|
2576
|
+
if (id === "\0farm-client-exports") {
|
|
2577
|
+
return [
|
|
2578
|
+
"// Farm.js Client Exports - Safe for browser bundling",
|
|
2579
|
+
'export { Link } from "@farm.js/core/client";',
|
|
2580
|
+
'export { useRouter } from "@farm.js/core/client";',
|
|
2581
|
+
'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
|
|
2582
|
+
// A page that hydrates ships to the browser with its notFound()/redirect() calls.
|
|
2583
|
+
'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
|
|
2584
|
+
'export { createAPIClient } from "@farm.js/core/client";',
|
|
2585
|
+
'export { localFont, remoteFont } from "@farm.js/core/font";'
|
|
2586
|
+
].join("\n");
|
|
2587
|
+
}
|
|
2588
|
+
return null;
|
|
2508
2589
|
}
|
|
2509
|
-
return null;
|
|
2510
2590
|
},
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
'export { useRouter } from "@farm.js/core/client";',
|
|
2526
|
-
'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
|
|
2527
|
-
// A page that hydrates ships to the browser with its notFound()/redirect() calls.
|
|
2528
|
-
'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
|
|
2529
|
-
'export { createAPIClient } from "@farm.js/core/client";',
|
|
2530
|
-
'export { localFont, remoteFont } from "@farm.js/core/font";'
|
|
2531
|
-
].join("\n");
|
|
2532
|
-
}
|
|
2533
|
-
return null;
|
|
2534
|
-
}
|
|
2591
|
+
farmPlugin(
|
|
2592
|
+
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
|
|
2593
|
+
pluginManager
|
|
2594
|
+
),
|
|
2595
|
+
_chunkNK2VWS7Pcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
2596
|
+
],
|
|
2597
|
+
mode: "production",
|
|
2598
|
+
css: postcssSearchPath ? {
|
|
2599
|
+
postcss: postcssSearchPath
|
|
2600
|
+
} : void 0,
|
|
2601
|
+
// Ensure React is bundled for client
|
|
2602
|
+
resolve: {
|
|
2603
|
+
alias: _chunkTQMI6BYOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2604
|
+
dedupe: [...config.renderer.dedupe || []]
|
|
2535
2605
|
},
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2606
|
+
// Optimize dependencies - exclude server-side code from client bundle
|
|
2607
|
+
optimizeDeps: {
|
|
2608
|
+
exclude: [
|
|
2609
|
+
"@farm.js/core/server",
|
|
2610
|
+
"@farm.js/core/api",
|
|
2611
|
+
"@farm.js/core/middleware",
|
|
2612
|
+
"@farm.js/core/headers"
|
|
2613
|
+
]
|
|
2614
|
+
}
|
|
2615
|
+
};
|
|
2616
|
+
await viteBuild(_chunkTQMI6BYOcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2617
|
+
if (platform === "mobile") {
|
|
2618
|
+
await fs4.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
2619
|
+
if (!await _chunkEFZGB7JCcjs.hasFarmMobileClientEntry.call(void 0, _path2.default.dirname(outputDir), outputDir)) {
|
|
2620
|
+
throw new IncompleteClientBuildOutputError(
|
|
2621
|
+
`${_chunkEFZGB7JCcjs.FARM_MOBILE_CLIENT_ENTRY_NAME}.js is missing or empty`
|
|
2622
|
+
);
|
|
2623
|
+
}
|
|
2624
|
+
} else {
|
|
2625
|
+
await mergeBuiltFontCss(outputDir);
|
|
2626
|
+
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2627
|
+
}
|
|
2628
|
+
} finally {
|
|
2629
|
+
try {
|
|
2630
|
+
await fs4.rm(clientEntryDir, { recursive: true, force: true });
|
|
2631
|
+
} catch (e27) {
|
|
2559
2632
|
}
|
|
2560
|
-
};
|
|
2561
|
-
await viteBuild(_chunkX2M4XN4Vcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2562
|
-
await mergeBuiltFontCss(outputDir);
|
|
2563
|
-
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2564
|
-
} finally {
|
|
2565
|
-
try {
|
|
2566
|
-
await fs4.rm(clientEntryDir, { recursive: true, force: true });
|
|
2567
|
-
} catch (e27) {
|
|
2568
2633
|
}
|
|
2569
|
-
}
|
|
2634
|
+
};
|
|
2635
|
+
await buildTarget("web");
|
|
2636
|
+
if (mobile) await buildTarget("mobile");
|
|
2570
2637
|
}
|
|
2571
2638
|
function toBakedMarkdownSourcePath(root, filePath) {
|
|
2572
2639
|
if (!filePath) return "";
|
|
@@ -2645,21 +2712,24 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
2645
2712
|
return response;
|
|
2646
2713
|
}
|
|
2647
2714
|
|
|
2648
|
-
${streamNavigations ?
|
|
2649
|
-
|
|
2650
|
-
// Reads a streamed navigation (F-Stream) up to the end of React's shell. \`next\` then resolves
|
|
2715
|
+
${streamNavigations ? `// Reads a streamed navigation (F-Stream) up to the end of React's shell. \`next\` then resolves
|
|
2651
2716
|
// with each later flush as it ends, and null at the end; a document without a marker is all shell.
|
|
2652
|
-
|
|
2717
|
+
// The marker carries the random token the server sent in the F-Flush header, so page content
|
|
2718
|
+
// cannot forge a boundary; a response without a valid token is all shell.
|
|
2719
|
+
async function readFarmNavigationStream(body, flushToken) {
|
|
2653
2720
|
const reader = body.getReader();
|
|
2654
2721
|
const decoder = new TextDecoder();
|
|
2722
|
+
const marker = typeof flushToken === "string" && /^[0-9a-f]{32}$/.test(flushToken)
|
|
2723
|
+
? "<!--farm-flush:" + flushToken + "-->"
|
|
2724
|
+
: "";
|
|
2655
2725
|
let text = "";
|
|
2656
2726
|
let done = false;
|
|
2657
2727
|
const next = async function() {
|
|
2658
2728
|
for (;;) {
|
|
2659
|
-
const at = text.indexOf(
|
|
2729
|
+
const at = marker ? text.indexOf(marker) : -1;
|
|
2660
2730
|
if (at !== -1) {
|
|
2661
2731
|
const flush = text.slice(0, at);
|
|
2662
|
-
text = text.slice(at +
|
|
2732
|
+
text = text.slice(at + marker.length);
|
|
2663
2733
|
return flush;
|
|
2664
2734
|
}
|
|
2665
2735
|
if (done) {
|
|
@@ -3233,7 +3303,7 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
|
|
|
3233
3303
|
}
|
|
3234
3304
|
};
|
|
3235
3305
|
${streamNavigations ? ` if (streamShell && response.body) {
|
|
3236
|
-
const streamed = await readFarmNavigationStream(response.body);
|
|
3306
|
+
const streamed = await readFarmNavigationStream(response.body, response.headers.get("F-Flush"));
|
|
3237
3307
|
if (!streamed.next) {
|
|
3238
3308
|
store(streamed.shell);
|
|
3239
3309
|
return streamed.shell;
|
|
@@ -3439,20 +3509,21 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3439
3509
|
secure: false
|
|
3440
3510
|
},
|
|
3441
3511
|
direction: {}
|
|
3442
|
-
}, plugins = [], renderer = _chunkRD623KW4cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
|
|
3512
|
+
}, plugins = [], renderer = _chunkRD623KW4cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform) {
|
|
3443
3513
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
3444
|
-
const clientPluginEntry =
|
|
3514
|
+
const clientPluginEntry = _chunkTQMI6BYOcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3445
3515
|
plugins,
|
|
3446
3516
|
root,
|
|
3447
3517
|
srcDir,
|
|
3448
|
-
publicRuntimeConfig
|
|
3518
|
+
publicRuntimeConfig,
|
|
3519
|
+
platform
|
|
3449
3520
|
);
|
|
3450
3521
|
const appSetupPath = _chunkRD623KW4cjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
|
|
3451
3522
|
const rendererClientImports = _chunkRD623KW4cjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
|
|
3452
3523
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3453
3524
|
import __farmAppSetup from ${JSON.stringify(_chunkVQJYGZNXcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3454
3525
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3455
|
-
const providerClientCode =
|
|
3526
|
+
const providerClientCode = _chunkTQMI6BYOcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3456
3527
|
integrationProviders,
|
|
3457
3528
|
root,
|
|
3458
3529
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3462,18 +3533,18 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
|
|
|
3462
3533
|
const layoutImportStatements = [];
|
|
3463
3534
|
const layoutRegistrations = [];
|
|
3464
3535
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
3465
|
-
const treeLayoutPatterns = islandValues ?
|
|
3536
|
+
const treeLayoutPatterns = islandValues ? _chunkTSFMFPRUcjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
|
|
3466
3537
|
layoutRoutes.forEach((layout, index) => {
|
|
3467
3538
|
const relativePath = toImportPath(layout.modulePath);
|
|
3468
3539
|
const treeLayout = treeLayoutPatterns.has(layout.pattern);
|
|
3469
3540
|
const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
|
|
3470
|
-
(pattern) =>
|
|
3541
|
+
(pattern) => _chunkTSFMFPRUcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
|
|
3471
3542
|
);
|
|
3472
3543
|
if (rendersOnClient && !treeLayout) {
|
|
3473
3544
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
3474
3545
|
}
|
|
3475
|
-
const groupScope =
|
|
3476
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
3546
|
+
const groupScope = _chunkTSFMFPRUcjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
3547
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkTSFMFPRUcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
3477
3548
|
layoutRegistrations.push(
|
|
3478
3549
|
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
|
|
3479
3550
|
);
|
|
@@ -3996,7 +4067,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3996
4067
|
});
|
|
3997
4068
|
}
|
|
3998
4069
|
|
|
3999
|
-
${
|
|
4070
|
+
${_chunkTQMI6BYOcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
4000
4071
|
// Wrap a page element with applicable layouts
|
|
4001
4072
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
4002
4073
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4031,7 +4102,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
4031
4102
|
return React.createElement("div", props, pageElement);
|
|
4032
4103
|
}
|
|
4033
4104
|
let farmLastRouteState = null;
|
|
4034
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
4105
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkTQMI6BYOcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
4035
4106
|
function farmTreeLayoutsOf(pathname) {
|
|
4036
4107
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
4037
4108
|
return layout.serverTree === true;
|
|
@@ -5257,7 +5328,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5257
5328
|
}
|
|
5258
5329
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
5259
5330
|
const instrumentationPath = _chunkBRWIVOV4cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
5260
|
-
const notFoundPath =
|
|
5331
|
+
const notFoundPath = _chunkTQMI6BYOcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
5261
5332
|
if (notFoundPath) _chunkVQJYGZNXcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
5262
5333
|
layoutRoutes.sort((a, b) => {
|
|
5263
5334
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -5278,9 +5349,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5278
5349
|
(provider) => provider.component || provider.type === "clerk"
|
|
5279
5350
|
);
|
|
5280
5351
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
5281
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
5282
|
-
const hasMiddlewareConfig =
|
|
5283
|
-
const hasRouteContextConfig =
|
|
5352
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _91 => _91.mdx, 'optionalAccess', _92 => _92.components]));
|
|
5353
|
+
const hasMiddlewareConfig = _chunkTSFMFPRUcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5354
|
+
const hasRouteContextConfig = _chunkKLNFJDFMcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
5284
5355
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
5285
5356
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
5286
5357
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -5290,18 +5361,18 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5290
5361
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
5291
5362
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
5292
5363
|
);
|
|
5293
|
-
if (
|
|
5364
|
+
if (_chunk3XQ57EFIcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
5294
5365
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
5295
|
-
|
|
5366
|
+
_chunk3XQ57EFIcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
5296
5367
|
config.docs,
|
|
5297
5368
|
{ root, srcDir: config.srcDir },
|
|
5298
5369
|
(pathname) => adapterGuardedPaths.has(pathname)
|
|
5299
5370
|
);
|
|
5300
5371
|
}
|
|
5301
5372
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
5302
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
5373
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _93 => _93.docs, 'optionalAccess', _94 => _94.enabled]) && _chunkE552H232cjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHNAISJFDcjs._runWithFarmCspNonce.call(void 0,
|
|
5303
5374
|
farmDocsCspNonceMarker,
|
|
5304
|
-
async () => _optionalChain([config, 'access',
|
|
5375
|
+
async () => _optionalChain([config, 'access', _95 => _95.docs, 'access', _96 => _96.adapter, 'optionalAccess', _97 => _97.server]) ? await _chunk3XQ57EFIcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
5305
5376
|
root,
|
|
5306
5377
|
srcDir: config.srcDir,
|
|
5307
5378
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -5410,7 +5481,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5410
5481
|
// Adapters can render provider scripts by serializing function source.
|
|
5411
5482
|
// keepNames injects helper calls into those functions; after Nitro
|
|
5412
5483
|
// minifies the server chunk the helper is no longer in script scope.
|
|
5413
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
5484
|
+
keepNames: !(_optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) && _optionalChain([config, 'access', _100 => _100.docs, 'access', _101 => _101.adapter, 'optionalAccess', _102 => _102.server])),
|
|
5414
5485
|
jsxDev: false
|
|
5415
5486
|
},
|
|
5416
5487
|
// SSR configuration to externalize problematic modules
|
|
@@ -5460,10 +5531,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5460
5531
|
define: {
|
|
5461
5532
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
5462
5533
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
5463
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
5534
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _103 => _103.env, 'optionalAccess', _104 => _104.public]) || {})
|
|
5464
5535
|
},
|
|
5465
5536
|
plugins: [
|
|
5466
|
-
|
|
5537
|
+
_chunkTQMI6BYOcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
5467
5538
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
5468
5539
|
...rendererVitePlugins,
|
|
5469
5540
|
...config.vite.plugins || [],
|
|
@@ -5524,7 +5595,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5524
5595
|
resolve: {
|
|
5525
5596
|
alias: [
|
|
5526
5597
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
5527
|
-
...Object.entries(
|
|
5598
|
+
...Object.entries(_chunkTQMI6BYOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
5528
5599
|
([find, replacement]) => ({ find, replacement })
|
|
5529
5600
|
)
|
|
5530
5601
|
],
|
|
@@ -5532,7 +5603,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5532
5603
|
dedupe: [...config.renderer.dedupe || []]
|
|
5533
5604
|
}
|
|
5534
5605
|
};
|
|
5535
|
-
await viteBuild(
|
|
5606
|
+
await viteBuild(_chunkTQMI6BYOcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
5536
5607
|
} finally {
|
|
5537
5608
|
if (postcssConfigDir) {
|
|
5538
5609
|
try {
|
|
@@ -5568,26 +5639,26 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
5568
5639
|
return lastModified;
|
|
5569
5640
|
}
|
|
5570
5641
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
5571
|
-
if (!_optionalChain([config, 'access',
|
|
5642
|
+
if (!_optionalChain([config, 'access', _105 => _105.docs, 'optionalAccess', _106 => _106.enabled])) return [];
|
|
5572
5643
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
5573
5644
|
const guards = {
|
|
5574
5645
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
5575
5646
|
middlewareRoutes
|
|
5576
5647
|
};
|
|
5577
|
-
return
|
|
5578
|
-
(docsRoot) =>
|
|
5579
|
-
).flatMap((page) => [page.href,
|
|
5648
|
+
return _chunkTWHXBMLJcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
|
|
5649
|
+
(docsRoot) => _chunkTWHXBMLJcjs.discoverFarmDocsPages.call(void 0, _chunkTWHXBMLJcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
|
|
5650
|
+
).flatMap((page) => [page.href, _chunkTWHXBMLJcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkTSFMFPRUcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
5580
5651
|
}
|
|
5581
5652
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
5582
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
5653
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _107 => _107.llmsTxt]);
|
|
5583
5654
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
5584
5655
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
5585
5656
|
);
|
|
5586
5657
|
return [
|
|
5587
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5588
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5589
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5590
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5658
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _108 => _108.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
5659
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _109 => _109.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
5660
|
+
..._optionalChain([agent, 'optionalAccess', _110 => _110.sitemap, 'optionalAccess', _111 => _111.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
5661
|
+
..._optionalChain([agent, 'optionalAccess', _112 => _112.crawlers, 'optionalAccess', _113 => _113.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
5591
5662
|
];
|
|
5592
5663
|
}
|
|
5593
5664
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -5598,7 +5669,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
5598
5669
|
docsPath: ${root}.entry,
|
|
5599
5670
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
5600
5671
|
}`;
|
|
5601
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
5672
|
+
if (_optionalChain([docs, 'optionalAccess', _114 => _114.roots, 'optionalAccess', _115 => _115.length])) {
|
|
5602
5673
|
return {
|
|
5603
5674
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
5604
5675
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -5611,7 +5682,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
5611
5682
|
}
|
|
5612
5683
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
5613
5684
|
if (!docs.enabled) return "null";
|
|
5614
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
5685
|
+
const serializableDocs = _optionalChain([docs, 'access', _116 => _116.roots, 'optionalAccess', _117 => _117.length]) ? {
|
|
5615
5686
|
...docs,
|
|
5616
5687
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
5617
5688
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -5645,7 +5716,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
5645
5716
|
},
|
|
5646
5717
|
}
|
|
5647
5718
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
5648
|
-
if (!_optionalChain([docs, 'access',
|
|
5719
|
+
if (!_optionalChain([docs, 'access', _118 => _118.roots, 'optionalAccess', _119 => _119.length])) return expression;
|
|
5649
5720
|
return `((farmDocs) => ({
|
|
5650
5721
|
...farmDocs,
|
|
5651
5722
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -5662,7 +5733,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
5662
5733
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
5663
5734
|
}
|
|
5664
5735
|
function generateNativeAuthIntegrationSource(auth) {
|
|
5665
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
5736
|
+
if (_optionalChain([auth, 'optionalAccess', _120 => _120.enabled]) !== true) {
|
|
5666
5737
|
return { importSource: "", registerSource: "" };
|
|
5667
5738
|
}
|
|
5668
5739
|
return {
|
|
@@ -5955,23 +6026,24 @@ if (typeof ReactDOMServer.configureApp !== "function") {
|
|
|
5955
6026
|
ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
5956
6027
|
}
|
|
5957
6028
|
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) {
|
|
5958
|
-
const farmIslandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6029
|
+
const farmIslandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _121 => _121.experimental, 'optionalAccess', _122 => _122.serverComponents])) === "islands";
|
|
6030
|
+
const farmMobileClient = shouldBuildFarmMobileClient(config, { quiet: true });
|
|
5959
6031
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5960
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
6032
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _123 => _123.agent, 'optionalAccess', _124 => _124.crawlers, 'optionalAccess', _125 => _125.enabled])) && !applicationMetadataRoutes.some(
|
|
5961
6033
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
5962
6034
|
);
|
|
5963
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
6035
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _126 => _126.agent, 'optionalAccess', _127 => _127.sitemap, 'optionalAccess', _128 => _128.enabled])) && !applicationMetadataRoutes.some(
|
|
5964
6036
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
5965
6037
|
);
|
|
5966
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
5967
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
6038
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _129 => _129.agent, 'optionalAccess', _130 => _130.mcp]) === true && !_chunk46KXZBOGcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
6039
|
+
const servesAiCatalog = _optionalChain([config, 'access', _131 => _131.agent, 'optionalAccess', _132 => _132.aiCatalog]) !== false;
|
|
5968
6040
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
5969
6041
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5970
6042
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
5971
6043
|
const adapterOwnsDocsRuntime = Boolean(
|
|
5972
|
-
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
6044
|
+
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled]) && _optionalChain([config, 'access', _135 => _135.docs, 'access', _136 => _136.adapter, 'optionalAccess', _137 => _137.server]) && config.docs.adapter.react
|
|
5973
6045
|
);
|
|
5974
|
-
if (_optionalChain([config, 'access',
|
|
6046
|
+
if (_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) && _optionalChain([config, 'access', _140 => _140.docs, 'access', _141 => _141.roots, 'optionalAccess', _142 => _142.length]) && !adapterOwnsDocsRuntime) {
|
|
5975
6047
|
throw new Error(
|
|
5976
6048
|
"Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
|
|
5977
6049
|
);
|
|
@@ -6020,8 +6092,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6020
6092
|
const hasGeneratedMetadataImages = metadataImageRoutes.some(
|
|
6021
6093
|
(image) => image.sourceType === "module"
|
|
6022
6094
|
);
|
|
6023
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 ||
|
|
6024
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
6095
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkTSFMFPRUcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
6096
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _143 => _143.docs, 'optionalAccess', _144 => _144.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
6025
6097
|
const integrationProviders = _chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
6026
6098
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
6027
6099
|
(provider) => provider.component || provider.type === "clerk"
|
|
@@ -6031,16 +6103,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6031
6103
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
6032
6104
|
);
|
|
6033
6105
|
}
|
|
6034
|
-
const providerServerModules =
|
|
6106
|
+
const providerServerModules = _chunkTQMI6BYOcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
6035
6107
|
renderedIntegrationProviders,
|
|
6036
6108
|
config.root,
|
|
6037
6109
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
6038
6110
|
);
|
|
6039
6111
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
6040
6112
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
6041
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
6113
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _145 => _145.providers]);
|
|
6042
6114
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
6043
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
6115
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _146 => _146.component]) === "function")) {
|
|
6044
6116
|
throw new Error(
|
|
6045
6117
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
6046
6118
|
);
|
|
@@ -6051,20 +6123,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6051
6123
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
6052
6124
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
6053
6125
|
);
|
|
6054
|
-
const isolatedHydrationMode =
|
|
6055
|
-
_optionalChain([config, 'access',
|
|
6126
|
+
const isolatedHydrationMode = _chunkTQMI6BYOcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
6127
|
+
_optionalChain([config, 'access', _147 => _147.experimental, 'optionalAccess', _148 => _148.isolatedClientHydration]),
|
|
6056
6128
|
{
|
|
6057
|
-
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6129
|
+
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _149 => _149.experimental, 'optionalAccess', _150 => _150.serverComponents])) === "rsc",
|
|
6058
6130
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
6059
6131
|
}
|
|
6060
6132
|
);
|
|
6061
|
-
const hydrationPlanOptions =
|
|
6133
|
+
const hydrationPlanOptions = _chunkTQMI6BYOcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
6062
6134
|
config.renderer,
|
|
6063
6135
|
Boolean(unsupportedIntegrationProvider)
|
|
6064
6136
|
);
|
|
6065
6137
|
const pageHydrationPlanOptions = {
|
|
6066
6138
|
...hydrationPlanOptions,
|
|
6067
|
-
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6139
|
+
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _151 => _151.experimental, 'optionalAccess', _152 => _152.serverComponents])) === "islands"
|
|
6068
6140
|
};
|
|
6069
6141
|
const layoutHydrationPlans = layoutRoutes.map((layout) => ({
|
|
6070
6142
|
...layout,
|
|
@@ -6076,7 +6148,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6076
6148
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
6077
6149
|
)
|
|
6078
6150
|
}));
|
|
6079
|
-
const markdownPagePlan =
|
|
6151
|
+
const markdownPagePlan = _chunkTQMI6BYOcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
6080
6152
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
6081
6153
|
config.root,
|
|
6082
6154
|
isolatedHydrationMode,
|
|
@@ -6085,7 +6157,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6085
6157
|
const pageHydrationPlans = new Map(
|
|
6086
6158
|
pageRoutes.map((route) => [
|
|
6087
6159
|
route.modulePath,
|
|
6088
|
-
|
|
6160
|
+
_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
6089
6161
|
route.modulePath,
|
|
6090
6162
|
config.root,
|
|
6091
6163
|
isolatedHydrationMode,
|
|
@@ -6094,7 +6166,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6094
6166
|
)
|
|
6095
6167
|
])
|
|
6096
6168
|
);
|
|
6097
|
-
|
|
6169
|
+
_chunkTQMI6BYOcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
6098
6170
|
layoutHydrationPlans.map((layout) => ({
|
|
6099
6171
|
pattern: layout.pattern,
|
|
6100
6172
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -6103,10 +6175,10 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6103
6175
|
pageRoutes.map((route) => ({
|
|
6104
6176
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
6105
6177
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
6106
|
-
depth:
|
|
6178
|
+
depth: _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
6107
6179
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
6108
6180
|
})),
|
|
6109
|
-
|
|
6181
|
+
_chunkTSFMFPRUcjs.routeBoundaryCoversDirectory
|
|
6110
6182
|
);
|
|
6111
6183
|
const providerServerImports = [
|
|
6112
6184
|
providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
|
|
@@ -6123,7 +6195,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6123
6195
|
apiRegistrations.push(`
|
|
6124
6196
|
{
|
|
6125
6197
|
path: ${JSON.stringify(route.path)},
|
|
6126
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
6198
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _153 => _153.pluginMethods, 'optionalAccess', _154 => _154.includes, 'call', _155 => _155(method)])))},
|
|
6127
6199
|
endpoints: ${varName},
|
|
6128
6200
|
}`);
|
|
6129
6201
|
});
|
|
@@ -6136,7 +6208,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6136
6208
|
}).map(({ route }) => route);
|
|
6137
6209
|
orderedPageRoutes.forEach((route, index) => {
|
|
6138
6210
|
const varName = `pageRoute${index}`;
|
|
6139
|
-
if (
|
|
6211
|
+
if (_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
6140
6212
|
pageRegistrations.push(`
|
|
6141
6213
|
{
|
|
6142
6214
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -6168,7 +6240,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6168
6240
|
module: ${varName},
|
|
6169
6241
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
6170
6242
|
clientModule: ${JSON.stringify(_chunkVQJYGZNXcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
6171
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
6243
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkTQMI6BYOcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
|
|
6172
6244
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
6173
6245
|
${route.source !== void 0 ? `markdownSource: {
|
|
6174
6246
|
source: ${JSON.stringify(route.source)},
|
|
@@ -6178,7 +6250,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6178
6250
|
});
|
|
6179
6251
|
const layoutImports = [];
|
|
6180
6252
|
const layoutRegistrations = [];
|
|
6181
|
-
const treeLayoutPatterns = farmIslandsMode ?
|
|
6253
|
+
const treeLayoutPatterns = farmIslandsMode ? _chunkTSFMFPRUcjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
6182
6254
|
layoutHydrationPlans.map((layout) => ({
|
|
6183
6255
|
pattern: layout.pattern,
|
|
6184
6256
|
shouldHydrate: layout.hydration.shouldHydrate,
|
|
@@ -6232,12 +6304,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6232
6304
|
errorImports.push(
|
|
6233
6305
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
6234
6306
|
);
|
|
6235
|
-
const groupScope =
|
|
6307
|
+
const groupScope = _chunkTSFMFPRUcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
6236
6308
|
errorRegistrations.push(`
|
|
6237
6309
|
{
|
|
6238
|
-
pattern: ${JSON.stringify(
|
|
6310
|
+
pattern: ${JSON.stringify(_chunkTSFMFPRUcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
6239
6311
|
groupScope: ${JSON.stringify(groupScope)},
|
|
6240
|
-
directoryDepth: ${
|
|
6312
|
+
directoryDepth: ${_chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
6241
6313
|
module: ${varName},
|
|
6242
6314
|
}`);
|
|
6243
6315
|
});
|
|
@@ -6384,8 +6456,22 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6384
6456
|
stripFarmLocaleFromPathname,
|
|
6385
6457
|
withFarmRouteContext,
|
|
6386
6458
|
createLateNotFoundRecovery,
|
|
6387
|
-
createLateRedirectRecovery,${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
|
|
6388
|
-
} from "@farm.js/core/internal/production-runtime";${
|
|
6459
|
+
createLateRedirectRecovery,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
|
|
6460
|
+
} from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
|
|
6461
|
+
import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
|
|
6462
|
+
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
6463
|
+
// once the client build has finished (see buildNitroUniversal). A shell's document stays out of
|
|
6464
|
+
// shared caches, which the adapter learns as it does for a guarded response.
|
|
6465
|
+
const farmMobileShellClient = JSON.parse("${_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER}");
|
|
6466
|
+
function applyFarmMobileShellResponse(request, response, context) {
|
|
6467
|
+
return _applyFarmMobileShellClient(request, response, farmMobileShellClient, () =>
|
|
6468
|
+
context?.onGuardedResponse?.()
|
|
6469
|
+
);
|
|
6470
|
+
}` : `
|
|
6471
|
+
// No mobile block: no mobile client, and documents ignore X-Farm-Shell.
|
|
6472
|
+
function applyFarmMobileShellResponse(request, response) {
|
|
6473
|
+
return response;
|
|
6474
|
+
}`}${farmIslandsMode ? `
|
|
6389
6475
|
import { getSharedLayoutPrefixLength, handleFarmFormActionRequest, ignoreFarmHeldValues, installFarmIslandValues, parseFarmLayoutChainHeader } from "@farm.js/core/internal/production-runtime";
|
|
6390
6476
|
import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server";
|
|
6391
6477
|
installFarmIslandsServer();
|
|
@@ -6399,25 +6485,25 @@ ${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : ""}`;
|
|
|
6399
6485
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
6400
6486
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
6401
6487
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
6402
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
6488
|
+
const docsHandlerImport = _optionalChain([config, 'access', _156 => _156.docs, 'optionalAccess', _157 => _157.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
6403
6489
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
6404
6490
|
const pathname = typeof requestOrPathname === "string"
|
|
6405
6491
|
? requestOrPathname
|
|
6406
6492
|
: new URL(requestOrPathname.url).pathname;
|
|
6407
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
6493
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _158 => _158.apiPath]) || "/api/docs")};
|
|
6408
6494
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
6409
6495
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
6410
|
-
import { ${_optionalChain([config, 'access',
|
|
6496
|
+
import { ${_optionalChain([config, 'access', _159 => _159.docs, 'access', _160 => _160.roots, 'optionalAccess', _161 => _161.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
6411
6497
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
6412
6498
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
6413
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
6414
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
6499
|
+
const docsFontImport = _optionalChain([config, 'access', _162 => _162.docs, 'optionalAccess', _163 => _163.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
6500
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _164 => _164.docs, 'optionalAccess', _165 => _165.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
6415
6501
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
6416
6502
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
6417
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
6503
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _166 => _166.md, 'optionalAccess', _167 => _167.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
6418
6504
|
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;";
|
|
6419
6505
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
6420
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
6506
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _168 => _168.mdx, 'optionalAccess', _169 => _169.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
6421
6507
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
6422
6508
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
6423
6509
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -6436,14 +6522,18 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
6436
6522
|
const instrumentationImport = instrumentationPath ? `import * as FarmInstrumentationModule from ${toVirtualEntryImportSpecifier(instrumentationPath)};` : "";
|
|
6437
6523
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
6438
6524
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
6525
|
+
const mobileSession = (config.plugins || []).some(
|
|
6526
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _170 => _170.name]) === _chunk7FVVQEVLcjs.FARM_MOBILE_SESSION_PLUGIN
|
|
6527
|
+
);
|
|
6439
6528
|
const integrationImports = `
|
|
6440
6529
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
6441
6530
|
${layerConfigImports}
|
|
6442
6531
|
${integrationRuntimeImport}
|
|
6443
6532
|
${nativeAuth.importSource}
|
|
6444
6533
|
${nativeMCP.importSource}
|
|
6534
|
+
${mobileSession ? `import { createFarmMobileSessionPlugin as __farmCreateMobileSessionPlugin } from "@farm.js/core/internal/production-runtime";` : ""}
|
|
6445
6535
|
`;
|
|
6446
|
-
const imageRuntime =
|
|
6536
|
+
const imageRuntime = _chunkTQMI6BYOcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
6447
6537
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
6448
6538
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
6449
6539
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -6622,7 +6712,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
6622
6712
|
|
|
6623
6713
|
function FarmDefault404Page() {
|
|
6624
6714
|
return React.createElement(React.Fragment, null,
|
|
6625
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
6715
|
+
React.createElement("style", null, ${JSON.stringify(_chunkTQMI6BYOcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
6626
6716
|
React.createElement("main", {
|
|
6627
6717
|
className: "farm-default-not-found",
|
|
6628
6718
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -6722,6 +6812,10 @@ const configuredPlugins = [
|
|
|
6722
6812
|
${hasCompressionRuntime && hasPluginRuntime ? "createCompressionPlugin()," : ""}
|
|
6723
6813
|
${hasRuntimeIntegrationConfig ? "...resolveIntegrationPlugins(serverRuntimeIntegrations)," : ""}
|
|
6724
6814
|
${nativeMCP.pluginSource}
|
|
6815
|
+
${mobileSession ? `__farmCreateMobileSessionPlugin({
|
|
6816
|
+
basePath: ${JSON.stringify(config.basePath)},
|
|
6817
|
+
integrations: () => serverRuntimeIntegrations,
|
|
6818
|
+
}),` : ""}
|
|
6725
6819
|
${hasConfiguredRuntimePlugins ? `...farmRuntimeConfigs.flatMap((runtimeConfig) =>
|
|
6726
6820
|
Array.isArray(runtimeConfig.plugins) ? runtimeConfig.plugins : [],
|
|
6727
6821
|
),` : ""}
|
|
@@ -6755,14 +6849,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
6755
6849
|
onError(error) { console.error("[Farm Image]", error); },
|
|
6756
6850
|
})`};
|
|
6757
6851
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
6758
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
6759
|
-
${_optionalChain([config, 'access',
|
|
6852
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _171 => _171.agent, 'optionalAccess', _172 => _172.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
6853
|
+
${_optionalChain([config, 'access', _173 => _173.agent, 'optionalAccess', _174 => _174.llmsTxt, 'optionalAccess', _175 => _175.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
6760
6854
|
const farmMdxConfig = ${JSON.stringify({
|
|
6761
6855
|
...config.mdx,
|
|
6762
|
-
components: typeof _optionalChain([config, 'access',
|
|
6856
|
+
components: typeof _optionalChain([config, 'access', _176 => _176.mdx, 'optionalAccess', _177 => _177.components]) === "string" ? config.mdx.components : void 0
|
|
6763
6857
|
})};
|
|
6764
6858
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
6765
|
-
${_optionalChain([config, 'access',
|
|
6859
|
+
${_optionalChain([config, 'access', _178 => _178.agent, 'optionalAccess', _179 => _179.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
6766
6860
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
6767
6861
|
// to the build.
|
|
6768
6862
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
@@ -6813,7 +6907,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
6813
6907
|
});
|
|
6814
6908
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
6815
6909
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
6816
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
6910
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _180 => _180.docs, 'optionalAccess', _181 => _181.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
6817
6911
|
try {
|
|
6818
6912
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
6819
6913
|
const candidates = [
|
|
@@ -6825,7 +6919,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _175 => _1
|
|
|
6825
6919
|
} catch {
|
|
6826
6920
|
return null;
|
|
6827
6921
|
}
|
|
6828
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
6922
|
+
})()` : "null"};${_optionalChain([config, 'access', _182 => _182.docs, 'optionalAccess', _183 => _183.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _184 => _184.docs, 'access', _185 => _185.roots, 'optionalAccess', _186 => _186.length]) ? `
|
|
6829
6923
|
const farmDocsBundledRootsDir = (() => {
|
|
6830
6924
|
try {
|
|
6831
6925
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -6876,7 +6970,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
6876
6970
|
),
|
|
6877
6971
|
}
|
|
6878
6972
|
: undefined;
|
|
6879
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
6973
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _187 => _187.docs, 'optionalAccess', _188 => _188.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
6880
6974
|
rootDir: farmDocsRuntimeRoot,
|
|
6881
6975
|
// A production build's content cannot change, so the adapter reads its
|
|
6882
6976
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -6909,7 +7003,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _182 => _182.docs, '
|
|
|
6909
7003
|
globalStylesheetHref: ${JSON.stringify(FARM_CLIENT_CSS_HREF_PLACEHOLDER)},
|
|
6910
7004
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
6911
7005
|
})` : "null"};
|
|
6912
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
7006
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _189 => _189.docs, 'optionalAccess', _190 => _190.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded })` : "null"};
|
|
6913
7007
|
|
|
6914
7008
|
// API routes bundled at build time
|
|
6915
7009
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -6934,12 +7028,12 @@ function fetchFarmInnerRequest(request, context) {
|
|
|
6934
7028
|
}
|
|
6935
7029
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunkB5BBTPJQcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
6936
7030
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
6937
|
-
${_optionalChain([config, 'access',
|
|
6938
|
-
` : ""}${_optionalChain([config, 'access',
|
|
6939
|
-
|
|
7031
|
+
${_optionalChain([config, 'access', _191 => _191.agent, 'optionalAccess', _192 => _192.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunk4SEHMBL4cjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
7032
|
+
` : ""}${_optionalChain([config, 'access', _193 => _193.agent, 'optionalAccess', _194 => _194.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
7033
|
+
_chunk4SEHMBL4cjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
6940
7034
|
build: config.deploymentId,
|
|
6941
|
-
packages:
|
|
6942
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
7035
|
+
packages: _chunkTQMI6BYOcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
7036
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkTQMI6BYOcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
6943
7037
|
})
|
|
6944
7038
|
)};
|
|
6945
7039
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -7081,10 +7175,22 @@ function escapeFarmHtmlAttribute(value) {
|
|
|
7081
7175
|
.replace(/>/g, ">");
|
|
7082
7176
|
}
|
|
7083
7177
|
|
|
7084
|
-
|
|
7085
|
-
|
|
7178
|
+
// A streamed navigation's flush marker token: 128 random bits, hex.
|
|
7179
|
+
function createFarmFlushToken() {
|
|
7180
|
+
const bytes = new Uint8Array(16);
|
|
7181
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
7182
|
+
let token = "";
|
|
7183
|
+
for (const byte of bytes) token += byte.toString(16).padStart(2, "0");
|
|
7184
|
+
return token;
|
|
7185
|
+
}
|
|
7186
|
+
|
|
7187
|
+
async function renderFarmElement(ReactDOMServer, element, routeKey, flushToken = "") {
|
|
7188
|
+
// Written after each React flush in a streamed navigation (flushToken): the browser swaps in
|
|
7086
7189
|
// the shell, then adds each Suspense boundary as soon as the flush that completed it ends.
|
|
7087
|
-
|
|
7190
|
+
// The token is random per response and reaches the browser in the F-Flush header, so page
|
|
7191
|
+
// content cannot forge a boundary.
|
|
7192
|
+
const flushMarkers = Boolean(flushToken);
|
|
7193
|
+
const FARM_FLUSH_MARKER = flushMarkers ? "<!--farm-flush:" + flushToken + "-->" : "";
|
|
7088
7194
|
// Islands mode: each render writes its islands' values itself, so a request that renders twice
|
|
7089
7195
|
// (notFound(), or a synchronous attempt that suspends and streams) still sends them.
|
|
7090
7196
|
if (typeof farmIslandsRender === "function") element = farmIslandsRender(element);
|
|
@@ -7527,7 +7633,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
7527
7633
|
let inner = markup.replace(/^\\s+/, "");
|
|
7528
7634
|
let hoisted = "";
|
|
7529
7635
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
7530
|
-
const hoistable = /${
|
|
7636
|
+
const hoistable = /${_chunkTSFMFPRUcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
7531
7637
|
let match;
|
|
7532
7638
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
7533
7639
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -8058,7 +8164,7 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
8058
8164
|
// a route guard.
|
|
8059
8165
|
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
8060
8166
|
pageRoutes.map((route) => route.pattern).filter(
|
|
8061
|
-
(pattern) => !pattern.includes("[") &&
|
|
8167
|
+
(pattern) => !pattern.includes("[") && _chunkTSFMFPRUcjs.farmPathGuardCoversPage.call(void 0,
|
|
8062
8168
|
{
|
|
8063
8169
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
8064
8170
|
middlewareRoutes
|
|
@@ -8105,12 +8211,12 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
8105
8211
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
8106
8212
|
// registered at runtime, such as the docs engine's.
|
|
8107
8213
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
8108
|
-
|
|
8214
|
+
_chunk46KXZBOGcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkOAMUSC7Hcjs.FARM_VERSION)
|
|
8109
8215
|
)};
|
|
8110
8216
|
let farmDefaultMCPRouteFree;
|
|
8111
8217
|
function getFarmDefaultMCPServer() {
|
|
8112
8218
|
if (farmDefaultMCPRouteFree === undefined) {
|
|
8113
|
-
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(
|
|
8219
|
+
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunk46KXZBOGcjs.FARM_DEFAULT_MCP_PATH)});
|
|
8114
8220
|
}
|
|
8115
8221
|
return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
|
|
8116
8222
|
}
|
|
@@ -8405,7 +8511,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
8405
8511
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
8406
8512
|
return true;
|
|
8407
8513
|
}
|
|
8408
|
-
${_optionalChain([config, 'access',
|
|
8514
|
+
${_optionalChain([config, 'access', _195 => _195.docs, 'optionalAccess', _196 => _196.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
8409
8515
|
if (
|
|
8410
8516
|
isFarmDocsAPIRequest(pathname) ||
|
|
8411
8517
|
docsPath === "/" ||
|
|
@@ -8431,7 +8537,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
8431
8537
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
8432
8538
|
};
|
|
8433
8539
|
}
|
|
8434
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
8540
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _197 => _197.docs, 'optionalAccess', _198 => _198.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
8435
8541
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
8436
8542
|
pathname,
|
|
8437
8543
|
method: request.method,
|
|
@@ -8515,7 +8621,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
8515
8621
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
8516
8622
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
8517
8623
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
8518
|
-
|
|
8624
|
+
_chunk4SEHMBL4cjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
8519
8625
|
agent: {
|
|
8520
8626
|
...config.agent,
|
|
8521
8627
|
aiCatalog: servesAiCatalog,
|
|
@@ -8526,9 +8632,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
8526
8632
|
openapi: openAPIReference
|
|
8527
8633
|
})
|
|
8528
8634
|
)});
|
|
8529
|
-
${_optionalChain([config, 'access',
|
|
8635
|
+
${_optionalChain([config, 'access', _199 => _199.docs, 'optionalAccess', _200 => _200.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
8530
8636
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
8531
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
8637
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _201 => _201.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _202 => _202.docs, 'access', _203 => _203.roots, 'optionalAccess', _204 => _204.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
|
|
8532
8638
|
};
|
|
8533
8639
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
8534
8640
|
const farmRouteLabelSlot = Symbol("farm.route.label.slot");
|
|
@@ -8543,11 +8649,11 @@ function labelFarmRequestOptions(options) {
|
|
|
8543
8649
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
8544
8650
|
return options;
|
|
8545
8651
|
}
|
|
8546
|
-
${_optionalChain([config, 'access',
|
|
8652
|
+
${_optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 => _206.enabled]) ? `if (options.kind === "docs") {
|
|
8547
8653
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
8548
8654
|
return options;
|
|
8549
8655
|
}` : ""}
|
|
8550
|
-
${_optionalChain([config, 'access',
|
|
8656
|
+
${_optionalChain([config, 'access', _207 => _207.md, 'optionalAccess', _208 => _208.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
8551
8657
|
routePathname,
|
|
8552
8658
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
8553
8659
|
);
|
|
@@ -8582,7 +8688,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
8582
8688
|
return applicable;
|
|
8583
8689
|
}
|
|
8584
8690
|
|
|
8585
|
-
${_optionalChain([config, 'access',
|
|
8691
|
+
${_optionalChain([config, 'access', _209 => _209.docs, 'optionalAccess', _210 => _210.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
8586
8692
|
if (request.method === "HEAD") return response;
|
|
8587
8693
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
8588
8694
|
|
|
@@ -8690,7 +8796,7 @@ ${_optionalChain([config, 'access', _204 => _204.docs, 'optionalAccess', _205 =>
|
|
|
8690
8796
|
|
|
8691
8797
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
8692
8798
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
8693
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
8799
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _211 => _211.experimental, 'optionalAccess', _212 => _212.ppr]) === true)};
|
|
8694
8800
|
|
|
8695
8801
|
function resolveRouteRenderingView(route) {
|
|
8696
8802
|
// The same merge development uses: baked directive config under the
|
|
@@ -8822,7 +8928,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
8822
8928
|
},
|
|
8823
8929
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
8824
8930
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
8825
|
-
${_optionalChain([config, 'access',
|
|
8931
|
+
${_optionalChain([config, 'access', _213 => _213.md, 'optionalAccess', _214 => _214.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
8826
8932
|
if (matchPageRoute(pathname)) {
|
|
8827
8933
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
8828
8934
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -9032,7 +9138,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9032
9138
|
}
|
|
9033
9139
|
` : ""}
|
|
9034
9140
|
|
|
9035
|
-
${_optionalChain([config, 'access',
|
|
9141
|
+
${_optionalChain([config, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.enabled]) ? `
|
|
9036
9142
|
// Docs responses are served after app middleware so route guards and
|
|
9037
9143
|
// middleware headers apply to the docs engine like any other page content.
|
|
9038
9144
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -9100,7 +9206,22 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9100
9206
|
}
|
|
9101
9207
|
` : ""}
|
|
9102
9208
|
|
|
9103
|
-
${
|
|
9209
|
+
${config.mobileClient ? `
|
|
9210
|
+
// The mobile app's native-tier screens: the page, rendered as for a browser, read into a
|
|
9211
|
+
// tree of native views.
|
|
9212
|
+
if (
|
|
9213
|
+
(request.method === "GET" || request.method === "HEAD") &&
|
|
9214
|
+
request.headers.get("accept")?.includes(${JSON.stringify(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)})
|
|
9215
|
+
) {
|
|
9216
|
+
const treeResponse = await createFarmNativeTreeResponse({
|
|
9217
|
+
request,
|
|
9218
|
+
renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
|
|
9219
|
+
});
|
|
9220
|
+
return applyProductionMiddlewareHeaders(treeResponse, middlewareHeaders);
|
|
9221
|
+
}
|
|
9222
|
+
` : ""}
|
|
9223
|
+
|
|
9224
|
+
${_optionalChain([config, 'access', _217 => _217.md, 'optionalAccess', _218 => _218.enabled]) ? `
|
|
9104
9225
|
if (farmMarkdownConfig?.enabled) {
|
|
9105
9226
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
9106
9227
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -9199,11 +9320,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9199
9320
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
9200
9321
|
}
|
|
9201
9322
|
` : ""}
|
|
9202
|
-
${_optionalChain([config, 'access',
|
|
9323
|
+
${_optionalChain([config, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.manifest]) !== false ? `
|
|
9203
9324
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
9204
9325
|
// public manifest, the same document for every request.
|
|
9205
9326
|
if (
|
|
9206
|
-
[${JSON.stringify(
|
|
9327
|
+
[${JSON.stringify(_chunk4SEHMBL4cjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunk4SEHMBL4cjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
9207
9328
|
normalizeRuntimePath(routePathname),
|
|
9208
9329
|
)
|
|
9209
9330
|
) {
|
|
@@ -9213,9 +9334,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9213
9334
|
);
|
|
9214
9335
|
}
|
|
9215
9336
|
` : ""}
|
|
9216
|
-
${_optionalChain([config, 'access',
|
|
9337
|
+
${_optionalChain([config, 'access', _221 => _221.agent, 'optionalAccess', _222 => _222.apiCatalog]) ? `
|
|
9217
9338
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
9218
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
9339
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunk4SEHMBL4cjs.FARM_API_CATALOG_PATH)}) {
|
|
9219
9340
|
return applyProductionMiddlewareHeaders(
|
|
9220
9341
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
9221
9342
|
middlewareHeaders,
|
|
@@ -9240,11 +9361,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9240
9361
|
);
|
|
9241
9362
|
}
|
|
9242
9363
|
` : ""}
|
|
9243
|
-
${_optionalChain([config, 'access',
|
|
9364
|
+
${_optionalChain([config, 'access', _223 => _223.agent, 'optionalAccess', _224 => _224.llmsTxt, 'optionalAccess', _225 => _225.enabled]) ? `
|
|
9244
9365
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
9245
9366
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
9246
9367
|
? "llms"
|
|
9247
|
-
: ${_optionalChain([config, 'access',
|
|
9368
|
+
: ${_optionalChain([config, 'access', _226 => _226.agent, 'optionalAccess', _227 => _227.llmsTxt, 'optionalAccess', _228 => _228.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
9248
9369
|
if (farmGeneratedLlmsKind) {
|
|
9249
9370
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
9250
9371
|
const llmsOrigin = new URL(request.url).origin;
|
|
@@ -9279,7 +9400,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9279
9400
|
}
|
|
9280
9401
|
` : ""}
|
|
9281
9402
|
|
|
9282
|
-
${_optionalChain([config, 'access',
|
|
9403
|
+
${_optionalChain([config, 'access', _229 => _229.docs, 'optionalAccess', _230 => _230.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
9283
9404
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
9284
9405
|
if (docsAPIResponse) {
|
|
9285
9406
|
return applyProductionMiddlewareHeaders(
|
|
@@ -9622,10 +9743,13 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9622
9743
|
!route.shouldHydrate &&
|
|
9623
9744
|
request.headers.get("f-render") === "tree";
|
|
9624
9745
|
// A navigation the browser streams marks where each React flush ends, so the browser
|
|
9625
|
-
// shows the page before its Suspense content arrives (FARM_FLUSH_MARKER).
|
|
9626
|
-
|
|
9746
|
+
// shows the page before its Suspense content arrives (FARM_FLUSH_MARKER). The marker
|
|
9747
|
+
// carries a random token sent in the F-Flush header: page content cannot forge one.
|
|
9748
|
+
const farmFlushToken = request.headers.get("f-stream") === "flush"
|
|
9749
|
+
? createFarmFlushToken()
|
|
9750
|
+
: "";` : `const farmLayoutKeyOf = null;
|
|
9627
9751
|
const farmPayloadOnlyNavigation = false;
|
|
9628
|
-
const
|
|
9752
|
+
const farmFlushToken = "";`}
|
|
9629
9753
|
const renderPageElement = async () => {
|
|
9630
9754
|
// First, render the page content
|
|
9631
9755
|
let pageElement;
|
|
@@ -9747,7 +9871,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9747
9871
|
}
|
|
9748
9872
|
|
|
9749
9873
|
wrappedElement = wrapWithFarmIntegrationProviders(wrappedElement);
|
|
9750
|
-
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern,
|
|
9874
|
+
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern, farmFlushToken);
|
|
9751
9875
|
};
|
|
9752
9876
|
const renderedPage = ${hasMiddlewareRuntime ? `await _runWithMiddlewareData(middlewareData, () =>
|
|
9753
9877
|
_runWithMiddlewareContext(middlewareContext, renderPageElement)
|
|
@@ -9815,7 +9939,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9815
9939
|
);
|
|
9816
9940
|
}
|
|
9817
9941
|
}
|
|
9818
|
-
${_optionalChain([config, 'access',
|
|
9942
|
+
${_optionalChain([config, 'access', _231 => _231.md, 'optionalAccess', _232 => _232.enabled]) ? `
|
|
9819
9943
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
9820
9944
|
// using the public path the .md request will be resolved against.
|
|
9821
9945
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -9834,7 +9958,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9834
9958
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
9835
9959
|
}
|
|
9836
9960
|
|
|
9837
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
9961
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _233 => _233.agent, 'optionalAccess', _234 => _234.jsonLd]), () => ( false)))} });
|
|
9838
9962
|
const title = renderedMetadata.title;
|
|
9839
9963
|
const metaTags = renderedMetadata.tags;
|
|
9840
9964
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -10054,7 +10178,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10054
10178
|
);
|
|
10055
10179
|
return applyProductionMiddlewareHeaders(farmOwnedResponse(streamedDocument, {
|
|
10056
10180
|
status: pageStatus,
|
|
10057
|
-
headers: {
|
|
10181
|
+
headers: {
|
|
10182
|
+
...responseHeaders,
|
|
10183
|
+
"x-farm-preload-streaming": "1",
|
|
10184
|
+
...(farmFlushToken ? { "F-Flush": farmFlushToken } : {}),
|
|
10185
|
+
},
|
|
10058
10186
|
}), middlewareHeaders);
|
|
10059
10187
|
}
|
|
10060
10188
|
|
|
@@ -10308,7 +10436,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10308
10436
|
${servesDefaultMCP ? `
|
|
10309
10437
|
// agent.mcp: no app route answered /mcp, so the default read-only server may.
|
|
10310
10438
|
if (
|
|
10311
|
-
normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
10439
|
+
normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunk46KXZBOGcjs.FARM_DEFAULT_MCP_PATH)} &&
|
|
10312
10440
|
getFarmDefaultMCPServer()
|
|
10313
10441
|
) {
|
|
10314
10442
|
return applyProductionMiddlewareHeaders(
|
|
@@ -10524,11 +10652,11 @@ ${generatePreloadResponseRuntimeSource()}
|
|
|
10524
10652
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
10525
10653
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
10526
10654
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
10527
|
-
${_optionalChain([config, 'access',
|
|
10655
|
+
${_optionalChain([config, 'access', _235 => _235.agent, 'optionalAccess', _236 => _236.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
10528
10656
|
basePath: farmLocalAPIBasePath,
|
|
10529
10657
|
dispatch: async (localRequest) =>
|
|
10530
10658
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
10531
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
10659
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _237 => _237.agent, 'optionalAccess', _238 => _238.noindexPreviews]) ? `
|
|
10532
10660
|
// Keep every response of a preview deployment out of search indexes.
|
|
10533
10661
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
10534
10662
|
}
|
|
@@ -10579,10 +10707,11 @@ async function handleFarmFetch(request, context) {
|
|
|
10579
10707
|
? getFarmRoutePathname(new URL(runtimeRequest.url).pathname)
|
|
10580
10708
|
: undefined;
|
|
10581
10709
|
const configured = applyConfiguredResponseHeaders(response, routePathname);
|
|
10710
|
+
// Configured headers may edit the response in place, so check it either way.
|
|
10711
|
+
const guarded = farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured;
|
|
10582
10712
|
return applyFarmPreloadBudget(
|
|
10583
10713
|
applyFarmCspNonceToResponse(
|
|
10584
|
-
|
|
10585
|
-
farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured,
|
|
10714
|
+
applyFarmMobileShellResponse(runtimeRequest, guarded, context),
|
|
10586
10715
|
farmSecurityConfig,
|
|
10587
10716
|
cspNonce,
|
|
10588
10717
|
),
|
|
@@ -10719,13 +10848,13 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
10719
10848
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
10720
10849
|
return "rewrite";
|
|
10721
10850
|
}
|
|
10722
|
-
if (
|
|
10723
|
-
if (
|
|
10724
|
-
if (
|
|
10851
|
+
if (_chunkTSFMFPRUcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
10852
|
+
if (_chunkTSFMFPRUcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
10853
|
+
if (_chunkKLNFJDFMcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
10725
10854
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
10726
10855
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
10727
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
10728
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
10856
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _239 => _239.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
10857
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _240 => _240.regions, 'optionalAccess', _241 => _241.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
10729
10858
|
return "route runtime controls";
|
|
10730
10859
|
}
|
|
10731
10860
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -10738,8 +10867,8 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
10738
10867
|
return void 0;
|
|
10739
10868
|
}
|
|
10740
10869
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
10741
|
-
if (!_optionalChain([config, 'access',
|
|
10742
|
-
if (!_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) || !
|
|
10870
|
+
if (!_optionalChain([config, 'access', _242 => _242.docs, 'optionalAccess', _243 => _243.enabled]) || !config.docs.prerender) return [];
|
|
10871
|
+
if (!_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) || !_chunk3XQ57EFIcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
10743
10872
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
10744
10873
|
"docs.prerender needs a docs adapter such as @farming-labs/farmjs; Farm's built-in docs renderer keeps rendering docs pages on request."
|
|
10745
10874
|
);
|
|
@@ -10751,7 +10880,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
10751
10880
|
);
|
|
10752
10881
|
return [];
|
|
10753
10882
|
}
|
|
10754
|
-
const pages = await
|
|
10883
|
+
const pages = await _chunk3XQ57EFIcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
10755
10884
|
if (!pages) {
|
|
10756
10885
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
10757
10886
|
`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.`
|
|
@@ -10762,9 +10891,9 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
10762
10891
|
}
|
|
10763
10892
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
10764
10893
|
return Object.values(routeRules || {}).some((rule) => {
|
|
10765
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
10766
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
10767
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
10894
|
+
const swr = _optionalChain([rule, 'optionalAccess', _244 => _244.swr]);
|
|
10895
|
+
const cache = _optionalChain([rule, 'optionalAccess', _245 => _245.cache]);
|
|
10896
|
+
const headers = _optionalChain([rule, 'optionalAccess', _246 => _246.headers]);
|
|
10768
10897
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
10769
10898
|
});
|
|
10770
10899
|
}
|
|
@@ -10777,10 +10906,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10777
10906
|
const nitroBuilder = nitroBuilderResult.value;
|
|
10778
10907
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
10779
10908
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
10780
|
-
const outputDir =
|
|
10909
|
+
const outputDir = _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10781
10910
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
10782
10911
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
10783
|
-
const imageRuntime =
|
|
10912
|
+
const imageRuntime = _chunkTQMI6BYOcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
10784
10913
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
10785
10914
|
(image) => image.sourceType === "module"
|
|
10786
10915
|
);
|
|
@@ -10889,8 +11018,20 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10889
11018
|
]);
|
|
10890
11019
|
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
10891
11020
|
const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
|
|
11021
|
+
const encodedMobileShellClient = shouldBuildFarmMobileClient(config, { quiet: true }) ? _chunkEFZGB7JCcjs.encodeFarmMobileShellClient.call(void 0,
|
|
11022
|
+
await _chunkEFZGB7JCcjs.finalizeFarmMobileClient.call(void 0, {
|
|
11023
|
+
buildDir: _path2.default.join(root, distDir),
|
|
11024
|
+
clientOutputDir,
|
|
11025
|
+
webEntry: clientJsSrc,
|
|
11026
|
+
stylesheet: clientCssHref,
|
|
11027
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _247 => _247.files]), () => ( []))
|
|
11028
|
+
})
|
|
11029
|
+
) : null;
|
|
10892
11030
|
for (const output of Object.values(ssrBundle)) {
|
|
10893
11031
|
if (output.type !== "chunk") continue;
|
|
11032
|
+
if (encodedMobileShellClient && output.code.includes(_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER)) {
|
|
11033
|
+
output.code = output.code.split(_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER).join(encodedMobileShellClient);
|
|
11034
|
+
}
|
|
10894
11035
|
if (output.code.includes(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER)) {
|
|
10895
11036
|
output.code = output.code.split(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER).join(encodedDocsModulePreloads);
|
|
10896
11037
|
}
|
|
@@ -10905,11 +11046,13 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10905
11046
|
}
|
|
10906
11047
|
}
|
|
10907
11048
|
await fs4.mkdir(ssrOutputDir, { recursive: true });
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
11049
|
+
await Promise.all(
|
|
11050
|
+
Object.entries(ssrBundle).map(async ([fileName, output]) => {
|
|
11051
|
+
const filePath = _path2.default.join(ssrOutputDir, fileName);
|
|
11052
|
+
await fs4.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
11053
|
+
await fs4.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
|
|
11054
|
+
})
|
|
11055
|
+
);
|
|
10913
11056
|
const nitroEntryPath = _path2.default.join(ssrOutputDir, "nitro-entry.mjs");
|
|
10914
11057
|
const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
|
|
10915
11058
|
const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
|
|
@@ -11166,7 +11309,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11166
11309
|
ssrOutputDir,
|
|
11167
11310
|
ssrEntryFile
|
|
11168
11311
|
);
|
|
11169
|
-
const configuredNitroRouteRules = _chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
|
|
11312
|
+
const configuredNitroRouteRules = shouldBuildFarmMobileClient(config, { quiet: true }) ? varyFarmNitroCacheRulesByShell(_chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules)) : _chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
|
|
11170
11313
|
const prerenderNitroRouteRules = Object.fromEntries(
|
|
11171
11314
|
prerenderRoutes.map((route) => {
|
|
11172
11315
|
const configuredRule = configuredNitroRouteRules[route] || {};
|
|
@@ -11213,10 +11356,18 @@ function toFarmNodeResponse(request, response) {
|
|
|
11213
11356
|
// fixed top quality cost a docs app ~20 s of build CPU for a small further
|
|
11214
11357
|
// saving. Serverless and edge targets sit behind a CDN that compresses.
|
|
11215
11358
|
...preset === "node-server" ? { compressPublicAssets: { gzip: true } } : {},
|
|
11359
|
+
// Nitro gzips every server output file at level 9, node_modules included, to
|
|
11360
|
+
// print sizes after the build. A self-hosted server is never shipped compressed,
|
|
11361
|
+
// so list plain sizes; zipped serverless and edge bundles keep the gzip column.
|
|
11362
|
+
...preset === "node-server" || preset === "bun" ? { logging: { compressedSizes: false } } : {},
|
|
11216
11363
|
...prerenderRoutes.length > 0 ? {
|
|
11217
11364
|
prerender: {
|
|
11218
11365
|
crawlLinks: false,
|
|
11219
11366
|
failOnError: true,
|
|
11367
|
+
// Nitro's default renders one route at a time. Each prerender request is
|
|
11368
|
+
// answered independently, as by the production server, so keeping several
|
|
11369
|
+
// in flight overlaps the worker's rendering with this thread's per-route work.
|
|
11370
|
+
concurrency: Math.min(_os2.default.availableParallelism(), 8),
|
|
11220
11371
|
routes: prerenderRoutes
|
|
11221
11372
|
}
|
|
11222
11373
|
} : {},
|
|
@@ -11290,20 +11441,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
11290
11441
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
11291
11442
|
);
|
|
11292
11443
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
11293
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
11294
|
-
_optionalChain([nitroConfig, 'access',
|
|
11295
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
11444
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _248 => _248.rollupConfig, 'optionalAccess', _249 => _249.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _250 => _250.rollupConfig, 'optionalAccess', _251 => _251.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _252 => _252.output, 'optionalAccess', _253 => _253.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
11445
|
+
_optionalChain([nitroConfig, 'access', _254 => _254.handlers, 'optionalAccess', _255 => _255.some, 'call', _256 => _256(
|
|
11446
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _257 => _257.handler]) || "") === nitroEntryPath
|
|
11296
11447
|
)])
|
|
11297
11448
|
);
|
|
11298
11449
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
11299
11450
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
11300
11451
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
11301
11452
|
const shouldMinify = nitroConfig.minify !== false;
|
|
11302
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
11453
|
+
const keepServerNames = !(_optionalChain([config, 'access', _258 => _258.docs, 'optionalAccess', _259 => _259.enabled]) && _optionalChain([config, 'access', _260 => _260.docs, 'access', _261 => _261.adapter, 'optionalAccess', _262 => _262.server]));
|
|
11303
11454
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
11304
11455
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
11305
11456
|
if (canReusePrebuiltSSR) {
|
|
11306
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
11457
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _263 => _263.rollupConfig, 'optionalAccess', _264 => _264.plugins]);
|
|
11307
11458
|
nitroConfig.rollupConfig = {
|
|
11308
11459
|
...nitroConfig.rollupConfig,
|
|
11309
11460
|
plugins: [
|
|
@@ -11314,10 +11465,26 @@ function toFarmNodeResponse(request, response) {
|
|
|
11314
11465
|
}
|
|
11315
11466
|
nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
|
|
11316
11467
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
11317
|
-
|
|
11468
|
+
let prerenderOrder = /* @__PURE__ */ new Map();
|
|
11469
|
+
nitroInstance.hooks.hook("prerender:routes", (routes) => {
|
|
11470
|
+
prerenderOrder = new Map(
|
|
11471
|
+
Array.from(routes, (route, index) => {
|
|
11472
|
+
try {
|
|
11473
|
+
return [decodeURI(route), index];
|
|
11474
|
+
} catch (e31) {
|
|
11475
|
+
return [route, index];
|
|
11476
|
+
}
|
|
11477
|
+
})
|
|
11478
|
+
);
|
|
11479
|
+
});
|
|
11480
|
+
nitroInstance.hooks.hook("prerender:done", ({ prerenderedRoutes }) => {
|
|
11481
|
+
const orderOf = (route) => _nullishCoalesce(prerenderOrder.get(route), () => ( Number.MAX_SAFE_INTEGER));
|
|
11482
|
+
prerenderedRoutes.sort((a, b) => orderOf(a.route) - orderOf(b.route));
|
|
11483
|
+
});
|
|
11484
|
+
if (_optionalChain([config, 'access', _265 => _265.md, 'optionalAccess', _266 => _266.enabled])) {
|
|
11318
11485
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
11319
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
11320
|
-
const alternatePath =
|
|
11486
|
+
if (!route.contents || !_optionalChain([route, 'access', _267 => _267.contentType, 'optionalAccess', _268 => _268.toLowerCase, 'call', _269 => _269(), 'access', _270 => _270.includes, 'call', _271 => _271("html")])) return;
|
|
11487
|
+
const alternatePath = _chunkD7UQC4O6cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
|
|
11321
11488
|
if (!alternatePath) return;
|
|
11322
11489
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
11323
11490
|
const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
@@ -11337,7 +11504,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11337
11504
|
}
|
|
11338
11505
|
if (config.security.csp && config.security.csp.nonce) {
|
|
11339
11506
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
11340
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
11507
|
+
if (!route.contents || !_optionalChain([route, 'access', _272 => _272.contentType, 'optionalAccess', _273 => _273.toLowerCase, 'call', _274 => _274(), 'access', _275 => _275.includes, 'call', _276 => _276("html")])) return;
|
|
11341
11508
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
11342
11509
|
if (!staticCsp) return;
|
|
11343
11510
|
route.contents = staticCsp.html;
|
|
@@ -11412,13 +11579,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
11412
11579
|
}
|
|
11413
11580
|
if (prerenderRoutes.length > 0) {
|
|
11414
11581
|
_chunkVQJYGZNXcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
11415
|
-
const previousPrerender = process.env[
|
|
11416
|
-
process.env[
|
|
11582
|
+
const previousPrerender = process.env[_chunk7MD37P5Vcjs.FARM_PRERENDER_ENV];
|
|
11583
|
+
process.env[_chunk7MD37P5Vcjs.FARM_PRERENDER_ENV] = "1";
|
|
11417
11584
|
try {
|
|
11418
11585
|
await nitroBuilder.prerender(nitroInstance);
|
|
11419
11586
|
} finally {
|
|
11420
|
-
if (previousPrerender === void 0) delete process.env[
|
|
11421
|
-
else process.env[
|
|
11587
|
+
if (previousPrerender === void 0) delete process.env[_chunk7MD37P5Vcjs.FARM_PRERENDER_ENV];
|
|
11588
|
+
else process.env[_chunk7MD37P5Vcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
11422
11589
|
}
|
|
11423
11590
|
}
|
|
11424
11591
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
@@ -11543,7 +11710,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
11543
11710
|
await fs4.rename(src, dest);
|
|
11544
11711
|
return;
|
|
11545
11712
|
} catch (error) {
|
|
11546
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
11713
|
+
const code = _optionalChain([error, 'optionalAccess', _277 => _277.code]);
|
|
11547
11714
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
11548
11715
|
throw error;
|
|
11549
11716
|
}
|
|
@@ -11569,7 +11736,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
11569
11736
|
try {
|
|
11570
11737
|
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
11571
11738
|
} catch (error) {
|
|
11572
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
11739
|
+
if (_optionalChain([error, 'optionalAccess', _278 => _278.code]) !== "ENOENT") throw error;
|
|
11573
11740
|
}
|
|
11574
11741
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
11575
11742
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
@@ -11598,8 +11765,8 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
11598
11765
|
_chunkVQJYGZNXcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
11599
11766
|
}
|
|
11600
11767
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
11601
|
-
if (!_optionalChain([config, 'access',
|
|
11602
|
-
const [mainRoot, ...extraRoots] =
|
|
11768
|
+
if (!_optionalChain([config, 'access', _279 => _279.docs, 'optionalAccess', _280 => _280.enabled])) return;
|
|
11769
|
+
const [mainRoot, ...extraRoots] = _chunkTWHXBMLJcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
11603
11770
|
await copyFarmDocsRootContent(
|
|
11604
11771
|
mainRoot,
|
|
11605
11772
|
root,
|
|
@@ -11620,7 +11787,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
|
11620
11787
|
async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs4) {
|
|
11621
11788
|
const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
|
|
11622
11789
|
if (!docsContentDir) return;
|
|
11623
|
-
const lastModifiedManifest =
|
|
11790
|
+
const lastModifiedManifest = _chunkTWHXBMLJcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
11624
11791
|
fallback: "now"
|
|
11625
11792
|
});
|
|
11626
11793
|
await fs4.rm(bundledContentDir, { recursive: true, force: true });
|
|
@@ -11630,7 +11797,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
11630
11797
|
force: true
|
|
11631
11798
|
});
|
|
11632
11799
|
await fs4.writeFile(
|
|
11633
|
-
_path2.default.join(bundledContentDir,
|
|
11800
|
+
_path2.default.join(bundledContentDir, _chunkTWHXBMLJcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
11634
11801
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
11635
11802
|
`
|
|
11636
11803
|
);
|
|
@@ -11656,7 +11823,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
11656
11823
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
11657
11824
|
try {
|
|
11658
11825
|
sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
11659
|
-
} catch (
|
|
11826
|
+
} catch (e32) {
|
|
11660
11827
|
}
|
|
11661
11828
|
}
|
|
11662
11829
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
@@ -11701,7 +11868,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
11701
11868
|
try {
|
|
11702
11869
|
await copyPackage("sharp", sharpRequire);
|
|
11703
11870
|
if (!copiedPackages.has("sharp")) {
|
|
11704
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
11871
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkTQMI6BYOcjs.SHARP_INSTALL_HINT}`);
|
|
11705
11872
|
}
|
|
11706
11873
|
} catch (error) {
|
|
11707
11874
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -11783,7 +11950,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
|
|
|
11783
11950
|
if (packageJsonPath) return packageJsonPath;
|
|
11784
11951
|
try {
|
|
11785
11952
|
return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
|
|
11786
|
-
} catch (
|
|
11953
|
+
} catch (e33) {
|
|
11787
11954
|
return null;
|
|
11788
11955
|
}
|
|
11789
11956
|
}
|
|
@@ -11830,7 +11997,7 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
11830
11997
|
const resolved = parentRequire.resolve(request);
|
|
11831
11998
|
if (resolved.endsWith(".json")) return resolved;
|
|
11832
11999
|
_nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
|
|
11833
|
-
} catch (
|
|
12000
|
+
} catch (e34) {
|
|
11834
12001
|
}
|
|
11835
12002
|
}
|
|
11836
12003
|
try {
|
|
@@ -11841,13 +12008,13 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
11841
12008
|
try {
|
|
11842
12009
|
const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
|
|
11843
12010
|
if (manifest.name === packageName) return candidate;
|
|
11844
|
-
} catch (
|
|
12011
|
+
} catch (e35) {
|
|
11845
12012
|
}
|
|
11846
12013
|
}
|
|
11847
12014
|
if (_path2.default.basename(directory) === "node_modules") break;
|
|
11848
12015
|
directory = _path2.default.dirname(directory);
|
|
11849
12016
|
}
|
|
11850
|
-
} catch (
|
|
12017
|
+
} catch (e36) {
|
|
11851
12018
|
}
|
|
11852
12019
|
return null;
|
|
11853
12020
|
}
|
|
@@ -11856,13 +12023,13 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
|
|
|
11856
12023
|
let prismaClientDir;
|
|
11857
12024
|
try {
|
|
11858
12025
|
prismaClientDir = _path2.default.dirname(projectRequire.resolve("@prisma/client/default.js"));
|
|
11859
|
-
} catch (
|
|
12026
|
+
} catch (e37) {
|
|
11860
12027
|
return;
|
|
11861
12028
|
}
|
|
11862
12029
|
const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
11863
12030
|
try {
|
|
11864
12031
|
await fs4.access(generatedClientDir);
|
|
11865
|
-
} catch (
|
|
12032
|
+
} catch (e38) {
|
|
11866
12033
|
return;
|
|
11867
12034
|
}
|
|
11868
12035
|
const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
|
|
@@ -11921,7 +12088,9 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
11921
12088
|
|
|
11922
12089
|
// src/build/index.ts
|
|
11923
12090
|
async function build(config, options = {}) {
|
|
11924
|
-
return _chunkVZY7MAVScjs.withProductionNodeEnv.call(void 0,
|
|
12091
|
+
return _chunkVZY7MAVScjs.withProductionNodeEnv.call(void 0,
|
|
12092
|
+
() => _chunkTQMI6BYOcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
12093
|
+
);
|
|
11925
12094
|
}
|
|
11926
12095
|
function createBuildTargetBaseline(config) {
|
|
11927
12096
|
const preset = config.preset || "node-server";
|
|
@@ -11931,7 +12100,7 @@ function createBuildTargetBaseline(config) {
|
|
|
11931
12100
|
preset,
|
|
11932
12101
|
distDir,
|
|
11933
12102
|
outputDir,
|
|
11934
|
-
outputWasDerived: outputDir ===
|
|
12103
|
+
outputWasDerived: outputDir === _chunkKLNFJDFMcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
11935
12104
|
};
|
|
11936
12105
|
}
|
|
11937
12106
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -11940,8 +12109,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
11940
12109
|
const distDir = config.distDir || ".farm";
|
|
11941
12110
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
11942
12111
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
11943
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
11944
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
12112
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkKLNFJDFMcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
12113
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkKLNFJDFMcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
11945
12114
|
return {
|
|
11946
12115
|
root,
|
|
11947
12116
|
preset,
|
|
@@ -11949,7 +12118,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
11949
12118
|
distDir,
|
|
11950
12119
|
deployTarget,
|
|
11951
12120
|
outputDir,
|
|
11952
|
-
deployOutputDir:
|
|
12121
|
+
deployOutputDir: _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
11953
12122
|
};
|
|
11954
12123
|
}
|
|
11955
12124
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -11986,14 +12155,17 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
11986
12155
|
};
|
|
11987
12156
|
config = {
|
|
11988
12157
|
...config,
|
|
11989
|
-
images:
|
|
12158
|
+
images: _chunkTQMI6BYOcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
11990
12159
|
root: targets.root,
|
|
11991
12160
|
preset: targets.preset
|
|
11992
12161
|
})
|
|
11993
12162
|
};
|
|
11994
|
-
if (_optionalChain([config, 'access',
|
|
12163
|
+
if (_optionalChain([config, 'access', _281 => _281.docs, 'optionalAccess', _282 => _282.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
|
|
11995
12164
|
pluginManager.updateContext({ config });
|
|
11996
12165
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
12166
|
+
_chunkTQMI6BYOcjs.usePackageClientBoundaryCacheFile.call(void 0,
|
|
12167
|
+
_path2.default.resolve(root, distDir, "cache", "client-boundaries.json")
|
|
12168
|
+
);
|
|
11997
12169
|
_chunkVQJYGZNXcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
11998
12170
|
await pluginManager.setupPlugins();
|
|
11999
12171
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -12005,8 +12177,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12005
12177
|
});
|
|
12006
12178
|
_chunkVQJYGZNXcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
12007
12179
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
12008
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
12009
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
12180
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _283 => _283.status]) === "rejected") throw productionViteResult.reason;
|
|
12181
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _284 => _284.value]);
|
|
12010
12182
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
12011
12183
|
projectModuleServer = await createProjectModuleServer(
|
|
12012
12184
|
createViteServer,
|
|
@@ -12014,7 +12186,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12014
12186
|
root,
|
|
12015
12187
|
rendererBuild.signal
|
|
12016
12188
|
);
|
|
12017
|
-
const farmApp =
|
|
12189
|
+
const farmApp = _chunkTQMI6BYOcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
12018
12190
|
await farmApp.initialize();
|
|
12019
12191
|
const routeManager = farmApp.getRouteManager();
|
|
12020
12192
|
const serverRenderer = farmApp.getServerRenderer();
|
|
@@ -12024,8 +12196,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12024
12196
|
layers: config.layers,
|
|
12025
12197
|
plugins: config.plugins,
|
|
12026
12198
|
extraRoutes: [
|
|
12027
|
-
..._optionalChain([config, 'access',
|
|
12028
|
-
...
|
|
12199
|
+
..._optionalChain([config, 'access', _285 => _285.openapi, 'optionalAccess', _286 => _286.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
12200
|
+
..._chunkTWHXBMLJcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
12029
12201
|
],
|
|
12030
12202
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
12031
12203
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -12109,7 +12281,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12109
12281
|
throw error;
|
|
12110
12282
|
} finally {
|
|
12111
12283
|
try {
|
|
12112
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
12284
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _287 => _287.close, 'call', _288 => _288()]);
|
|
12113
12285
|
} finally {
|
|
12114
12286
|
rendererBuild.abort();
|
|
12115
12287
|
}
|
|
@@ -12120,7 +12292,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12120
12292
|
ssr: true,
|
|
12121
12293
|
buildLifetime
|
|
12122
12294
|
});
|
|
12123
|
-
const viteConfig =
|
|
12295
|
+
const viteConfig = _chunkTQMI6BYOcjs.mergeFarmViteConfig.call(void 0,
|
|
12124
12296
|
{
|
|
12125
12297
|
root,
|
|
12126
12298
|
appType: "custom",
|
|
@@ -12132,7 +12304,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12132
12304
|
},
|
|
12133
12305
|
plugins: [
|
|
12134
12306
|
...rendererVitePlugins,
|
|
12135
|
-
|
|
12307
|
+
_chunkTQMI6BYOcjs.farmFontImportsPlugin.call(void 0, {
|
|
12136
12308
|
root,
|
|
12137
12309
|
basePath: config.basePath,
|
|
12138
12310
|
publicDir: config.publicDir
|
|
@@ -12144,7 +12316,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12144
12316
|
hmr: false
|
|
12145
12317
|
},
|
|
12146
12318
|
resolve: {
|
|
12147
|
-
alias:
|
|
12319
|
+
alias: _chunkTQMI6BYOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
12148
12320
|
dedupe: [...config.renderer.dedupe || []]
|
|
12149
12321
|
},
|
|
12150
12322
|
optimizeDeps: {
|
|
@@ -12177,10 +12349,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12177
12349
|
noDiscovery: true
|
|
12178
12350
|
},
|
|
12179
12351
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
12180
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
12352
|
+
environments: _optionalChain([viteConfig, 'access', _289 => _289.environments, 'optionalAccess', _290 => _290.ssr, 'optionalAccess', _291 => _291.dev, 'optionalAccess', _292 => _292.createEnvironment]) ? viteConfig.environments : {
|
|
12181
12353
|
...viteConfig.environments,
|
|
12182
12354
|
ssr: {
|
|
12183
|
-
..._optionalChain([viteConfig, 'access',
|
|
12355
|
+
..._optionalChain([viteConfig, 'access', _293 => _293.environments, 'optionalAccess', _294 => _294.ssr]),
|
|
12184
12356
|
...await createFarmProjectModuleSsrEnvironment()
|
|
12185
12357
|
}
|
|
12186
12358
|
}
|
|
@@ -12236,7 +12408,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
12236
12408
|
define: {
|
|
12237
12409
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
12238
12410
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
12239
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
12411
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _295 => _295.env, 'optionalAccess', _296 => _296.public]) || {})
|
|
12240
12412
|
},
|
|
12241
12413
|
plugins: [
|
|
12242
12414
|
farmI18nClientBridgePlugin(),
|
|
@@ -12269,7 +12441,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12269
12441
|
if (pluginManager) {
|
|
12270
12442
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
12271
12443
|
}
|
|
12272
|
-
const outputDir =
|
|
12444
|
+
const outputDir = _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
12273
12445
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
12274
12446
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
12275
12447
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -12328,7 +12500,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12328
12500
|
const { readFile } = await import("fs/promises");
|
|
12329
12501
|
const manifestContent = await readFile(clientManifestPath, "utf-8");
|
|
12330
12502
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
12331
|
-
} catch (
|
|
12503
|
+
} catch (e39) {
|
|
12332
12504
|
farmRegistry.clientManifest = {};
|
|
12333
12505
|
}
|
|
12334
12506
|
} catch (error) {
|
|
@@ -12340,7 +12512,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12340
12512
|
root,
|
|
12341
12513
|
preset,
|
|
12342
12514
|
distDir,
|
|
12343
|
-
outputDir:
|
|
12515
|
+
outputDir: _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
12344
12516
|
});
|
|
12345
12517
|
}
|
|
12346
12518
|
}
|