@farm.js/core 0.1.17 → 0.1.18
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/after.cjs +12 -225
- package/dist/agent-runtime.cjs +83 -2800
- package/dist/api/client.cjs +17 -4060
- package/dist/api/route-manager.cjs +34 -4354
- package/dist/api/runtime.cjs +29 -2696
- package/dist/api.cjs +88 -8434
- package/dist/app-markdown.cjs +39 -280
- package/dist/cache.cjs +38 -1560
- package/dist/chunk-22GUSVNJ.cjs +351 -0
- package/dist/chunk-2CQ74SP6.cjs +13 -0
- package/dist/chunk-2SJ4RQ6P.cjs +57 -0
- package/dist/chunk-3376ZTRC.cjs +1 -0
- package/dist/{chunk-YD4J4XCI.mjs → chunk-3XG26Z3J.mjs} +1 -1
- package/dist/chunk-4PNUXIVU.cjs +472 -0
- package/dist/chunk-4PPEPOZZ.cjs +21 -0
- package/dist/chunk-4ZFL5GFN.cjs +520 -0
- package/dist/chunk-5OVTOKGH.cjs +65 -0
- package/dist/chunk-5QIKR7RR.cjs +224 -0
- package/dist/chunk-5ZSWG4UX.cjs +127 -0
- package/dist/chunk-62YJ2IEB.cjs +238 -0
- package/dist/chunk-6EODJYCX.cjs +183 -0
- package/dist/chunk-6EXBPJ24.cjs +434 -0
- package/dist/chunk-6QQDAAAZ.cjs +38 -0
- package/dist/chunk-6V4TDWEC.cjs +455 -0
- package/dist/chunk-72ADZ6GQ.cjs +19 -0
- package/dist/chunk-75BRBIFP.cjs +172 -0
- package/dist/chunk-7W3CPVXS.cjs +24 -0
- package/dist/chunk-A6WIQH5Z.cjs +31 -0
- package/dist/chunk-AFOD3LYZ.cjs +377 -0
- package/dist/chunk-AMDMVWMI.cjs +39 -0
- package/dist/chunk-AORPIPNB.cjs +552 -0
- package/dist/chunk-ARJWXNQL.cjs +256 -0
- package/dist/chunk-AWRISO2H.cjs +2199 -0
- package/dist/chunk-AYJR42WX.cjs +711 -0
- package/dist/chunk-B4CH33IG.cjs +644 -0
- package/dist/chunk-BIDYX3SL.cjs +91 -0
- package/dist/chunk-BSTRERPP.cjs +40 -0
- package/dist/chunk-BYODCJD6.cjs +663 -0
- package/dist/chunk-C3VRMB6H.cjs +85 -0
- package/dist/chunk-C5GUTBZK.cjs +173 -0
- package/dist/chunk-CIAGU2X4.cjs +337 -0
- package/dist/chunk-CMGMGHUZ.cjs +27 -0
- package/dist/chunk-CXP5U3RW.cjs +54 -0
- package/dist/chunk-D2ULAULS.cjs +166 -0
- package/dist/chunk-D7JTOLFK.cjs +285 -0
- package/dist/chunk-DVM4FKZL.cjs +169 -0
- package/dist/chunk-DYEJQTDN.cjs +49 -0
- package/dist/chunk-E2BMSZ2W.cjs +151 -0
- package/dist/chunk-E3UK5IIB.cjs +593 -0
- package/dist/chunk-EM6SBQKM.cjs +470 -0
- package/dist/chunk-FJSWYIR7.cjs +482 -0
- package/dist/chunk-FK6GO24V.cjs +54 -0
- package/dist/chunk-FXUUWYAX.cjs +654 -0
- package/dist/chunk-G3HRIVEY.cjs +395 -0
- package/dist/chunk-G643DQCH.cjs +13 -0
- package/dist/chunk-G7HXGLEC.cjs +175 -0
- package/dist/chunk-GDSHDTJ4.cjs +152 -0
- package/dist/chunk-GNEO2XOF.cjs +2040 -0
- package/dist/{chunk-56DAX2BE.mjs → chunk-GYKJCFTS.mjs} +1 -1
- package/dist/chunk-H6G5INWM.cjs +1094 -0
- package/dist/chunk-HBTUGXHS.cjs +180 -0
- package/dist/chunk-HREOKQWT.cjs +45 -0
- package/dist/chunk-I4J452B7.cjs +435 -0
- package/dist/chunk-I57LW5VZ.cjs +94 -0
- package/dist/chunk-I7PUUDGY.cjs +389 -0
- package/dist/chunk-IAMRBF3Z.cjs +86 -0
- package/dist/chunk-IKNRN4VS.cjs +14214 -0
- package/dist/chunk-IQXFRNY2.cjs +169 -0
- package/dist/chunk-IXTFU4PL.cjs +2355 -0
- package/dist/chunk-J2OP5GG3.cjs +725 -0
- package/dist/chunk-J3LOGE4T.cjs +42 -0
- package/dist/chunk-J7FSKED3.cjs +93 -0
- package/dist/chunk-JDNHKPTD.cjs +22 -0
- package/dist/chunk-JSROZYYO.cjs +164 -0
- package/dist/chunk-K6FNHVDR.cjs +696 -0
- package/dist/chunk-KGZIORNL.cjs +43 -0
- package/dist/{chunk-MVIWBEJF.mjs → chunk-KPNVGRBL.mjs} +1 -1
- package/dist/chunk-KR6CKSXT.cjs +15 -0
- package/dist/chunk-KROWKCUH.cjs +185 -0
- package/dist/chunk-KVFPGF2M.cjs +46 -0
- package/dist/chunk-LCCBO7PJ.cjs +46 -0
- package/dist/chunk-LIUGYUX3.cjs +22 -0
- package/dist/chunk-LTNGXMQ6.cjs +55 -0
- package/dist/chunk-M2L4MYDQ.cjs +14 -0
- package/dist/chunk-MCJLA63J.cjs +1 -0
- package/dist/chunk-MKB2EGIR.cjs +148 -0
- package/dist/chunk-MQ3H6LT5.cjs +202 -0
- package/dist/chunk-MT763TDW.cjs +43 -0
- package/dist/chunk-MWSK6C4J.cjs +18 -0
- package/dist/chunk-MWWVKDW3.cjs +169 -0
- package/dist/chunk-NO3WWW3N.cjs +192 -0
- package/dist/chunk-NV3A5DXM.cjs +862 -0
- package/dist/chunk-NWOD6NIT.cjs +9 -0
- package/dist/chunk-NZKJGRB3.cjs +230 -0
- package/dist/chunk-OAVTUMJP.cjs +1496 -0
- package/dist/chunk-OHY2ZWUG.cjs +25 -0
- package/dist/chunk-OI6CMLWX.cjs +47 -0
- package/dist/chunk-OIEOCXKG.cjs +453 -0
- package/dist/chunk-OWOUTKIJ.cjs +558 -0
- package/dist/chunk-OX6O6WVA.cjs +74 -0
- package/dist/chunk-OXSIH4D6.cjs +476 -0
- package/dist/chunk-OYEUREB6.cjs +35 -0
- package/dist/chunk-PCOTGFSM.cjs +139 -0
- package/dist/chunk-PZYCPSCC.cjs +35 -0
- package/dist/chunk-QBK2AA4U.cjs +445 -0
- package/dist/chunk-QBPXNZGV.cjs +487 -0
- package/dist/chunk-QNPEUFHQ.cjs +27 -0
- package/dist/chunk-QZRVZSPN.cjs +236 -0
- package/dist/chunk-R5A5KNVX.cjs +20 -0
- package/dist/chunk-R5JIFR6B.cjs +42 -0
- package/dist/chunk-R6AIILII.cjs +193 -0
- package/dist/chunk-RG3ZOTG5.cjs +34 -0
- package/dist/chunk-ROUTX2E5.cjs +390 -0
- package/dist/chunk-RTHIVJ2G.cjs +54 -0
- package/dist/chunk-S3A45T7F.cjs +166 -0
- package/dist/chunk-S3JO3N4H.cjs +17 -0
- package/dist/chunk-SK35NQKK.cjs +27 -0
- package/dist/chunk-SU7MH53P.cjs +180 -0
- package/dist/chunk-SVRTJOUF.cjs +113 -0
- package/dist/chunk-SWN467MP.cjs +18 -0
- package/dist/chunk-SYQ3MOWW.cjs +73 -0
- package/dist/chunk-T5CERMEH.cjs +417 -0
- package/dist/chunk-TFAXUHWX.cjs +206 -0
- package/dist/chunk-TIWHTW3Q.cjs +24 -0
- package/dist/chunk-TKJZFIML.cjs +20 -0
- package/dist/chunk-TKNSDBBN.cjs +193 -0
- package/dist/chunk-TWGMSEHX.cjs +525 -0
- package/dist/chunk-TYQUSXUG.cjs +1357 -0
- package/dist/chunk-U4KT7QP3.cjs +23 -0
- package/dist/chunk-UJ2C4ICS.cjs +277 -0
- package/dist/chunk-UN5GHC5V.cjs +10244 -0
- package/dist/chunk-UQZ4AYTH.cjs +168 -0
- package/dist/chunk-US2QVW3E.cjs +36 -0
- package/dist/chunk-VB6UCX3V.cjs +421 -0
- package/dist/chunk-VEKFLAQM.cjs +300 -0
- package/dist/chunk-VQDBNVOO.cjs +14 -0
- package/dist/chunk-W4E7WMXE.cjs +71 -0
- package/dist/chunk-WJ3HK3LJ.cjs +1102 -0
- package/dist/chunk-WMAPPDMM.cjs +28 -0
- package/dist/chunk-WMOGFOUJ.cjs +223 -0
- package/dist/chunk-WPYFSQKK.cjs +37 -0
- package/dist/chunk-WZMNW2IW.cjs +1415 -0
- package/dist/chunk-XGC343EY.cjs +443 -0
- package/dist/chunk-XSKZORAS.cjs +727 -0
- package/dist/chunk-XWAWFQFS.cjs +82 -0
- package/dist/chunk-Y4YMF2NQ.cjs +460 -0
- package/dist/chunk-Y4YWHNKU.cjs +250 -0
- package/dist/chunk-Y53ZSFN6.cjs +504 -0
- package/dist/chunk-YA6LLTIJ.cjs +411 -0
- package/dist/chunk-YFPGHF5F.cjs +202 -0
- package/dist/chunk-YJRZR7VU.cjs +28 -0
- package/dist/chunk-YTAABQEV.cjs +1 -0
- package/dist/chunk-YX3DBN4M.cjs +18 -0
- package/dist/chunk-YZTASLPQ.cjs +64 -0
- package/dist/chunk-Z5HIWVDP.cjs +2173 -0
- package/dist/chunk-ZEG3OPIB.cjs +93 -0
- package/dist/chunk-ZMN3H73H.cjs +155 -0
- package/dist/client/lifecycle.cjs +6 -35
- package/dist/client-plugins.cjs +7 -448
- package/dist/client.cjs +171 -9808
- package/dist/config.cjs +8 -36
- package/dist/cron.cjs +24 -491
- package/dist/deferred.cjs +26 -475
- package/dist/deployment.cjs +39 -210
- package/dist/devtools-OUIPHVV6.cjs +388 -0
- package/dist/devtools-client-4WAPJY5L.cjs +254 -0
- package/dist/devtools-ui-5GBDIGMK.cjs +1296 -0
- package/dist/docs.cjs +46 -5657
- package/dist/env-types.cjs +5 -226
- package/dist/env.cjs +21 -338
- package/dist/environment/vite.cjs +8 -372
- package/dist/environment.cjs +12 -94
- package/dist/font.cjs +13 -63
- package/dist/headers.cjs +7 -123
- package/dist/i18n/client.cjs +55 -294
- package/dist/i18n/index.cjs +22 -209
- package/dist/i18n/server.cjs +22 -745
- package/dist/image/server.cjs +13 -729
- package/dist/image/sharp.cjs +33 -171
- package/dist/image.cjs +41 -85
- package/dist/index.cjs +1151 -68080
- package/dist/index.mjs +3 -3
- package/dist/instrumentation.cjs +12 -138
- package/dist/integration-orm-55F7CII5.cjs +13 -0
- package/dist/integrations.cjs +55 -4090
- package/dist/internal/app-markdown-runtime.cjs +27 -224
- package/dist/internal/build-runtime.cjs +120 -52259
- package/dist/internal/build-runtime.mjs +3 -3
- package/dist/internal/cli-runtime.cjs +67 -13811
- package/dist/internal/client-error-overlay.cjs +80 -733
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +81 -913
- package/dist/internal/compression-runtime.cjs +8 -214
- package/dist/internal/config-runtime.cjs +42 -6547
- package/dist/internal/docs-precompiled-runtime.cjs +26 -46
- package/dist/internal/infra-analytics-runtime.cjs +10 -536
- package/dist/internal/isolated-boundary.cjs +14 -414
- package/dist/internal/metadata-image-runtime.cjs +7 -285
- package/dist/internal/product-telemetry-runtime.cjs +42 -97
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-node-env.cjs +6 -63
- package/dist/internal/production-runtime.cjs +418 -7133
- package/dist/internal/request-cookies.cjs +6 -54
- package/dist/json-ld.cjs +24 -50
- package/dist/layers-E4WPJNY5.cjs +17 -0
- package/dist/manager-G4B2IPYE.cjs +14 -0
- package/dist/markdown.cjs +21 -547
- package/dist/middleware.cjs +36 -2995
- package/dist/navigation.cjs +22 -2588
- package/dist/nitro-4I2MYLY2.cjs +652 -0
- package/dist/observability.cjs +22 -614
- package/dist/og.cjs +5 -28
- package/dist/plugin.cjs +106 -37442
- package/dist/plugin.mjs +2 -2
- package/dist/query/client.cjs +113 -449
- package/dist/query/index.cjs +26 -288
- package/dist/query/parsers.cjs +23 -247
- package/dist/query/server.cjs +36 -298
- package/dist/renderer/react/client.cjs +9 -43
- package/dist/renderer/react/server.cjs +40 -103
- package/dist/renderer/react/vite.cjs +7 -29
- package/dist/renderer-client.cjs +126 -4295
- package/dist/renderer.cjs +31 -249
- package/dist/request.cjs +5 -68
- package/dist/router.cjs +11 -474
- package/dist/routes.cjs +42 -2461
- package/dist/schema-dev-notice-MXSZMVDG.cjs +56 -0
- package/dist/schema.cjs +6 -33
- package/dist/search-client-G3RICOFU.cjs +13 -0
- package/dist/server-action-security.cjs +25 -541
- package/dist/server-fn-client.cjs +6 -337
- package/dist/server-fn.cjs +32 -1841
- package/dist/server-plugins.cjs +15 -884
- package/dist/server-query-client.cjs +15 -1883
- package/dist/server-query.cjs +16 -1838
- package/dist/server.cjs +296 -44681
- package/dist/server.mjs +2 -2
- package/dist/storage.cjs +57 -576
- package/dist/testing.cjs +89 -3186
- package/dist/theme/client.cjs +13 -108
- package/dist/theme/index.cjs +6 -68
- package/dist/theme/runtime.cjs +13 -78
- package/dist/theme/server.cjs +10 -179
- package/dist/version.cjs +4 -32
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +119 -37773
- package/dist/vite.mjs +2 -2
- package/dist/workflows.cjs +19 -1040
- package/package.json +1 -1
|
@@ -0,0 +1,862 @@
|
|
|
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(); } } 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
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkQBPXNZGVcjs = require('./chunk-QBPXNZGV.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkYJRZR7VUcjs = require('./chunk-YJRZR7VU.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkGDSHDTJ4cjs = require('./chunk-GDSHDTJ4.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkY4YMF2NQcjs = require('./chunk-Y4YMF2NQ.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkTFAXUHWXcjs = require('./chunk-TFAXUHWX.cjs');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunkTYQUSXUGcjs = require('./chunk-TYQUSXUG.cjs');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunkYFPGHF5Fcjs = require('./chunk-YFPGHF5F.cjs');
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _chunkT5CERMEHcjs = require('./chunk-T5CERMEH.cjs');
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
var _chunkTWGMSEHXcjs = require('./chunk-TWGMSEHX.cjs');
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
var _chunkK6FNHVDRcjs = require('./chunk-K6FNHVDR.cjs');
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
var _chunkZ5HIWVDPcjs = require('./chunk-Z5HIWVDP.cjs');
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
var _chunkHBTUGXHScjs = require('./chunk-HBTUGXHS.cjs');
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var _chunkS3A45T7Fcjs = require('./chunk-S3A45T7F.cjs');
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var _chunkC5GUTBZKcjs = require('./chunk-C5GUTBZK.cjs');
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
var _chunkDVM4FKZLcjs = require('./chunk-DVM4FKZL.cjs');
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
87
|
+
|
|
88
|
+
// src/config.ts
|
|
89
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
90
|
+
|
|
91
|
+
// src/mcp-config.ts
|
|
92
|
+
var _module = require('module');
|
|
93
|
+
|
|
94
|
+
var _url = require('url');
|
|
95
|
+
function resolveFarmMCPConfig(input) {
|
|
96
|
+
if (input === false || input === void 0) return { enabled: false };
|
|
97
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
98
|
+
throw new TypeError("mcp must be a configuration object or false.");
|
|
99
|
+
}
|
|
100
|
+
return { ...input, enabled: input.enabled !== false };
|
|
101
|
+
}
|
|
102
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmMCPConfig, "resolveFarmMCPConfig");
|
|
103
|
+
async function resolveFarmMCPPlugin(config, options) {
|
|
104
|
+
if (!config.enabled) return void 0;
|
|
105
|
+
const root = _path2.default.resolve(options.root);
|
|
106
|
+
let modulePath;
|
|
107
|
+
try {
|
|
108
|
+
const resolveFromApp = _module.createRequire.call(void 0, _path2.default.join(root, "package.json"));
|
|
109
|
+
modulePath = resolveFromApp.resolve("@farm.js/mcp/internal");
|
|
110
|
+
} catch (e) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
"The `mcp` config requires @farm.js/mcp. Install it with `pnpm add @farm.js/mcp` and try again."
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
const runtime = await import(
|
|
116
|
+
/* @vite-ignore */
|
|
117
|
+
_url.pathToFileURL.call(void 0, modulePath).href
|
|
118
|
+
);
|
|
119
|
+
if (typeof runtime.createFarmMCPPlugin !== "function") {
|
|
120
|
+
throw new Error(
|
|
121
|
+
"The installed @farm.js/mcp package is incompatible with this version of @farm.js/core."
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
return runtime.createFarmMCPPlugin(config);
|
|
125
|
+
}
|
|
126
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmMCPPlugin, "resolveFarmMCPPlugin");
|
|
127
|
+
|
|
128
|
+
// src/agent-config.ts
|
|
129
|
+
function resolveFarmAgentConfig(input) {
|
|
130
|
+
const jsonLd = _optionalChain([input, 'optionalAccess', _ => _.jsonLd]);
|
|
131
|
+
return {
|
|
132
|
+
jsonLd: !jsonLd ? false : jsonLd === true ? {} : jsonLd,
|
|
133
|
+
noindexPreviews: _chunkTYQUSXUGcjs.resolveFarmNoindexPreviews.call(void 0, _optionalChain([input, 'optionalAccess', _2 => _2.noindexPreviews])),
|
|
134
|
+
llmsTxt: _chunkTYQUSXUGcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([input, 'optionalAccess', _3 => _3.llmsTxt])),
|
|
135
|
+
crawlers: _chunkTYQUSXUGcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([input, 'optionalAccess', _4 => _4.crawlers]))
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmAgentConfig, "resolveFarmAgentConfig");
|
|
139
|
+
|
|
140
|
+
// src/docs/framework-detect.ts
|
|
141
|
+
var _promises = require('fs/promises');
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
var FRAMEWORK_PACKAGE = "@farming-labs/farmjs";
|
|
146
|
+
var FRAMEWORK_CONFIG_ENTRY = "@farming-labs/farmjs/config";
|
|
147
|
+
var SUPPORTED_ADAPTER_PROTOCOL = 1;
|
|
148
|
+
async function frameworkDeclaredByApp(root) {
|
|
149
|
+
try {
|
|
150
|
+
const raw = await _promises.readFile.call(void 0, _path2.default.join(root, "package.json"), "utf8");
|
|
151
|
+
const manifest = JSON.parse(raw);
|
|
152
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
153
|
+
const section = manifest[field];
|
|
154
|
+
if (section && typeof section === "object" && FRAMEWORK_PACKAGE in section) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
} catch (e2) {
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, frameworkDeclaredByApp, "frameworkDeclaredByApp");
|
|
163
|
+
var emittedNotices = /* @__PURE__ */ new Set();
|
|
164
|
+
function noticeOnce(key, emit, message) {
|
|
165
|
+
if (emittedNotices.has(key)) return;
|
|
166
|
+
emittedNotices.add(key);
|
|
167
|
+
emit(message);
|
|
168
|
+
}
|
|
169
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, noticeOnce, "noticeOnce");
|
|
170
|
+
function docsWantsFrameworkDetection(docs) {
|
|
171
|
+
if (docs === true) return true;
|
|
172
|
+
if (!docs || typeof docs !== "object") return false;
|
|
173
|
+
if (docs.enabled === false) return false;
|
|
174
|
+
if (docs.adapter !== void 0) return false;
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, docsWantsFrameworkDetection, "docsWantsFrameworkDetection");
|
|
178
|
+
function isSupportedAdapterDescriptor(value) {
|
|
179
|
+
if (!value || typeof value !== "object") return false;
|
|
180
|
+
const descriptor = value;
|
|
181
|
+
return descriptor.protocol === SUPPORTED_ADAPTER_PROTOCOL && typeof descriptor.server === "string" && descriptor.server.length > 0 && typeof descriptor.react === "string" && descriptor.react.length > 0;
|
|
182
|
+
}
|
|
183
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isSupportedAdapterDescriptor, "isSupportedAdapterDescriptor");
|
|
184
|
+
async function applyFarmDocsFrameworkAutoDetection(userConfig, options) {
|
|
185
|
+
if (!docsWantsFrameworkDetection(userConfig.docs)) return userConfig;
|
|
186
|
+
const log = _nullishCoalesce(options.log, () => ( ((message) => console.log(message))));
|
|
187
|
+
const warn = _nullishCoalesce(options.warn, () => ( ((message) => console.warn(message))));
|
|
188
|
+
const root = _path2.default.resolve(options.root || process.cwd());
|
|
189
|
+
if (!await frameworkDeclaredByApp(root)) {
|
|
190
|
+
noticeOnce(
|
|
191
|
+
"embedded-fallback",
|
|
192
|
+
warn,
|
|
193
|
+
`[farm] docs is served by the embedded renderer, which is being replaced by the ${FRAMEWORK_PACKAGE} docs framework. Install ${FRAMEWORK_PACKAGE} (with @farming-labs/docs and @farming-labs/theme) to migrate now, or set docs.adapter = false to keep the embedded renderer and silence this notice.`
|
|
194
|
+
);
|
|
195
|
+
return userConfig;
|
|
196
|
+
}
|
|
197
|
+
let configEntryPath;
|
|
198
|
+
try {
|
|
199
|
+
const requireFromApp = _module.createRequire.call(void 0, _path2.default.join(root, "package.json"));
|
|
200
|
+
configEntryPath = requireFromApp.resolve(FRAMEWORK_CONFIG_ENTRY);
|
|
201
|
+
} catch (e3) {
|
|
202
|
+
noticeOnce(
|
|
203
|
+
"declared-not-installed",
|
|
204
|
+
warn,
|
|
205
|
+
`[farm] ${FRAMEWORK_PACKAGE} is declared in package.json but could not be resolved; keeping the embedded docs renderer. Run your package manager's install to enable docs delegation.`
|
|
206
|
+
);
|
|
207
|
+
return userConfig;
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
const frameworkConfig = await import(
|
|
211
|
+
/* @vite-ignore */
|
|
212
|
+
_url.pathToFileURL.call(void 0, configEntryPath).href
|
|
213
|
+
);
|
|
214
|
+
const withDocs = _optionalChain([frameworkConfig, 'optionalAccess', _5 => _5.withDocs]);
|
|
215
|
+
if (typeof withDocs !== "function") {
|
|
216
|
+
noticeOnce(
|
|
217
|
+
"missing-withdocs",
|
|
218
|
+
warn,
|
|
219
|
+
`[farm] ${FRAMEWORK_CONFIG_ENTRY} does not export withDocs(); keeping the embedded docs renderer.`
|
|
220
|
+
);
|
|
221
|
+
return userConfig;
|
|
222
|
+
}
|
|
223
|
+
const applied = withDocs(userConfig);
|
|
224
|
+
const adapter = _optionalChain([applied, 'optionalAccess', _6 => _6.docs, 'optionalAccess', _7 => _7.adapter]);
|
|
225
|
+
if (!isSupportedAdapterDescriptor(adapter)) {
|
|
226
|
+
noticeOnce(
|
|
227
|
+
"unsupported-descriptor",
|
|
228
|
+
warn,
|
|
229
|
+
`[farm] The installed ${FRAMEWORK_PACKAGE} release publishes a docs adapter this Farm version cannot drive (need protocol ${SUPPORTED_ADAPTER_PROTOCOL}); keeping the embedded docs renderer. Upgrading @farm.js/core usually resolves this.`
|
|
230
|
+
);
|
|
231
|
+
return userConfig;
|
|
232
|
+
}
|
|
233
|
+
noticeOnce(
|
|
234
|
+
"delegated",
|
|
235
|
+
log,
|
|
236
|
+
`[farm] docs: delegated to ${FRAMEWORK_PACKAGE} (detected in this app). Set docs.adapter = false to keep the embedded renderer.`
|
|
237
|
+
);
|
|
238
|
+
return applied;
|
|
239
|
+
} catch (error) {
|
|
240
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
241
|
+
noticeOnce(
|
|
242
|
+
"detect-failed",
|
|
243
|
+
warn,
|
|
244
|
+
`[farm] Failed to load ${FRAMEWORK_CONFIG_ENTRY} (${message}); keeping the embedded docs renderer.`
|
|
245
|
+
);
|
|
246
|
+
return userConfig;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmDocsFrameworkAutoDetection, "applyFarmDocsFrameworkAutoDetection");
|
|
250
|
+
|
|
251
|
+
// src/config.ts
|
|
252
|
+
var FARM_RESOLVED_CUSTOM_CONTEXT = /* @__PURE__ */ Symbol.for("farm.resolvedCustomContext");
|
|
253
|
+
function resolveSchemaConfig(config) {
|
|
254
|
+
if (config === void 0) return {};
|
|
255
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
256
|
+
throw new TypeError("`schema` in farm.config must be an object.");
|
|
257
|
+
}
|
|
258
|
+
for (const key of ["allowExtend", "allowForeignKeys"]) {
|
|
259
|
+
const entries = config[key];
|
|
260
|
+
if (entries === void 0) continue;
|
|
261
|
+
if (!entries || typeof entries !== "object" || Array.isArray(entries)) {
|
|
262
|
+
throw new TypeError(
|
|
263
|
+
`\`schema.${key}\` must map a plugin's migrate name to a list of model or table names.`
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
for (const [owner, tables] of Object.entries(entries)) {
|
|
267
|
+
if (!Array.isArray(tables) || tables.some((table) => typeof table !== "string")) {
|
|
268
|
+
throw new TypeError(
|
|
269
|
+
`\`schema.${key}.${owner}\` must be a list of model or table names, such as ["user"].`
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return config;
|
|
275
|
+
}
|
|
276
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveSchemaConfig, "resolveSchemaConfig");
|
|
277
|
+
function hasCustomFarmRouteContext(config) {
|
|
278
|
+
return config[FARM_RESOLVED_CUSTOM_CONTEXT] === true;
|
|
279
|
+
}
|
|
280
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, hasCustomFarmRouteContext, "hasCustomFarmRouteContext");
|
|
281
|
+
function normalizeDeployTarget(target) {
|
|
282
|
+
if (!target) return void 0;
|
|
283
|
+
if (target === "cloudflare-pages" || target === "cloudflare_pages") return "cloudflare";
|
|
284
|
+
if (target === "node-server" || target === "nitro") return "node";
|
|
285
|
+
return target;
|
|
286
|
+
}
|
|
287
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeDeployTarget, "normalizeDeployTarget");
|
|
288
|
+
function getPresetForDeployTarget(target) {
|
|
289
|
+
switch (normalizeDeployTarget(target)) {
|
|
290
|
+
case "vercel":
|
|
291
|
+
return "vercel";
|
|
292
|
+
case "cloudflare":
|
|
293
|
+
return "cloudflare-pages";
|
|
294
|
+
case "netlify":
|
|
295
|
+
return "netlify";
|
|
296
|
+
case "node":
|
|
297
|
+
return "node-server";
|
|
298
|
+
default:
|
|
299
|
+
return void 0;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getPresetForDeployTarget, "getPresetForDeployTarget");
|
|
303
|
+
function getDeployTargetForPreset(preset) {
|
|
304
|
+
if (!preset) return void 0;
|
|
305
|
+
if (preset === "vercel" || preset === "vercel-edge") return "vercel";
|
|
306
|
+
if (preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module") {
|
|
307
|
+
return "cloudflare";
|
|
308
|
+
}
|
|
309
|
+
if (preset === "netlify" || preset === "netlify-edge") return "netlify";
|
|
310
|
+
if (preset === "node-server") return "node";
|
|
311
|
+
return void 0;
|
|
312
|
+
}
|
|
313
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getDeployTargetForPreset, "getDeployTargetForPreset");
|
|
314
|
+
var NETLIFY_INTERNAL_FUNCTIONS_DIR = ".netlify/functions-internal";
|
|
315
|
+
function getDefaultDeployOutputDir(target, preset, distDir) {
|
|
316
|
+
const normalizedTarget = normalizeDeployTarget(target) || getDeployTargetForPreset(preset);
|
|
317
|
+
if (normalizedTarget === "vercel") return ".vercel/output";
|
|
318
|
+
if (normalizedTarget === "netlify" && (!preset || preset === "netlify")) {
|
|
319
|
+
return NETLIFY_INTERNAL_FUNCTIONS_DIR;
|
|
320
|
+
}
|
|
321
|
+
return `${distDir}/.output`;
|
|
322
|
+
}
|
|
323
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getDefaultDeployOutputDir, "getDefaultDeployOutputDir");
|
|
324
|
+
function resolveDeployOutputPath(root, outputDir) {
|
|
325
|
+
return _path2.default.isAbsolute(outputDir) ? outputDir : _path2.default.join(root, outputDir);
|
|
326
|
+
}
|
|
327
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveDeployOutputPath, "resolveDeployOutputPath");
|
|
328
|
+
var PLATFORM_BUILD_ENV_TARGETS = [
|
|
329
|
+
["VERCEL", "vercel"],
|
|
330
|
+
["NETLIFY", "netlify"],
|
|
331
|
+
["CF_PAGES", "cloudflare"]
|
|
332
|
+
];
|
|
333
|
+
function detectPlatformDeployTarget(env = process.env) {
|
|
334
|
+
for (const [key, target] of PLATFORM_BUILD_ENV_TARGETS) {
|
|
335
|
+
const value = _optionalChain([env, 'access', _8 => _8[key], 'optionalAccess', _9 => _9.trim, 'call', _10 => _10(), 'access', _11 => _11.toLowerCase, 'call', _12 => _12()]);
|
|
336
|
+
if (value === "1" || value === "true") return target;
|
|
337
|
+
}
|
|
338
|
+
return void 0;
|
|
339
|
+
}
|
|
340
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, detectPlatformDeployTarget, "detectPlatformDeployTarget");
|
|
341
|
+
var warnedPlatformMismatches = /* @__PURE__ */ new Set();
|
|
342
|
+
function resolveDeployConfig(config, overrides = {}) {
|
|
343
|
+
const deploy = config.deploy || {};
|
|
344
|
+
const distDir = config.distDir || ".farm";
|
|
345
|
+
const overrideTarget = normalizeDeployTarget(overrides.target);
|
|
346
|
+
let target = overrideTarget ? overrideTarget : overrides.preset ? getDeployTargetForPreset(overrides.preset) : normalizeDeployTarget(deploy.target);
|
|
347
|
+
const detectedTarget = detectPlatformDeployTarget(overrides.env);
|
|
348
|
+
if (detectedTarget) {
|
|
349
|
+
const hasExplicitSelection = Boolean(
|
|
350
|
+
target || overrides.preset || deploy.preset || config.preset
|
|
351
|
+
);
|
|
352
|
+
if (!hasExplicitSelection) {
|
|
353
|
+
target = detectedTarget;
|
|
354
|
+
if (!warnedPlatformMismatches.has(`select:${detectedTarget}`)) {
|
|
355
|
+
warnedPlatformMismatches.add(`select:${detectedTarget}`);
|
|
356
|
+
_chunk5QIKR7RRcjs.logger.info(
|
|
357
|
+
`Detected ${detectedTarget} build environment; using the ${detectedTarget} preset. Set deploy.target in farm.config.ts to override.`
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const configuredPreset = deploy.preset || config.preset;
|
|
363
|
+
const overrideTargetPreset = overrideTarget && getDeployTargetForPreset(configuredPreset) !== overrideTarget ? getPresetForDeployTarget(overrideTarget) : void 0;
|
|
364
|
+
const preset = overrides.preset || overrideTargetPreset || configuredPreset || getPresetForDeployTarget(target) || "node-server";
|
|
365
|
+
const resolvedTarget = target || getDeployTargetForPreset(preset);
|
|
366
|
+
if (detectedTarget && resolvedTarget !== detectedTarget) {
|
|
367
|
+
const mismatchKey = `mismatch:${resolvedTarget}:${detectedTarget}`;
|
|
368
|
+
if (!warnedPlatformMismatches.has(mismatchKey)) {
|
|
369
|
+
warnedPlatformMismatches.add(mismatchKey);
|
|
370
|
+
_chunk5QIKR7RRcjs.logger.warn(
|
|
371
|
+
`The configured deploy target "${_nullishCoalesce(resolvedTarget, () => ( preset))}" cannot be served by ${detectedTarget}, but this build is running in a ${detectedTarget} build environment. Set deploy.target: "${detectedTarget}" in farm.config.ts to deploy there.`
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const platformOutput = resolvedTarget === "vercel" ? _optionalChain([deploy, 'access', _13 => _13.vercel, 'optionalAccess', _14 => _14.outputDirectory]) : resolvedTarget === "cloudflare" ? _optionalChain([deploy, 'access', _15 => _15.cloudflare, 'optionalAccess', _16 => _16.outputDir]) : resolvedTarget === "netlify" ? _optionalChain([deploy, 'access', _17 => _17.netlify, 'optionalAccess', _18 => _18.outputDir]) : void 0;
|
|
376
|
+
const outputDir = overrides.outputDir || deploy.outputDir || deploy.output || platformOutput || getDefaultDeployOutputDir(resolvedTarget, preset, distDir);
|
|
377
|
+
return {
|
|
378
|
+
...deploy,
|
|
379
|
+
target: resolvedTarget,
|
|
380
|
+
preset,
|
|
381
|
+
outputDir
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveDeployConfig, "resolveDeployConfig");
|
|
385
|
+
function resolveMigrationsConfig(migrations) {
|
|
386
|
+
if (!migrations) return { commands: [] };
|
|
387
|
+
if (Array.isArray(migrations)) return { commands: migrations };
|
|
388
|
+
return { commands: migrations.commands || [] };
|
|
389
|
+
}
|
|
390
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveMigrationsConfig, "resolveMigrationsConfig");
|
|
391
|
+
var DOCS_CONFIG_FILENAMES = [
|
|
392
|
+
"docs.config.ts",
|
|
393
|
+
"docs.config.tsx",
|
|
394
|
+
"docs.config.mts",
|
|
395
|
+
"docs.config.cts",
|
|
396
|
+
"docs.config.js",
|
|
397
|
+
"docs.config.jsx",
|
|
398
|
+
"docs.config.mjs",
|
|
399
|
+
"docs.config.cjs",
|
|
400
|
+
"docs.json"
|
|
401
|
+
];
|
|
402
|
+
function normalizeDocsRoute(value, fallback = "/docs") {
|
|
403
|
+
const raw = (value || fallback).trim();
|
|
404
|
+
if (!raw || raw === "/") return "/";
|
|
405
|
+
const normalized = raw.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\/?/, "/").replace(/\/+$/, "");
|
|
406
|
+
return normalized || "/";
|
|
407
|
+
}
|
|
408
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeDocsRoute, "normalizeDocsRoute");
|
|
409
|
+
function docsRouteToEntry(route) {
|
|
410
|
+
const entry = route.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
411
|
+
return entry || "docs";
|
|
412
|
+
}
|
|
413
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, docsRouteToEntry, "docsRouteToEntry");
|
|
414
|
+
function normalizeDocsContentDir(value) {
|
|
415
|
+
if (!value) return void 0;
|
|
416
|
+
const normalized = value.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
417
|
+
return normalized || void 0;
|
|
418
|
+
}
|
|
419
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, normalizeDocsContentDir, "normalizeDocsContentDir");
|
|
420
|
+
async function inferDocsContentDir(root, srcDir, entry) {
|
|
421
|
+
const { existsSync } = await import("fs");
|
|
422
|
+
const contentDir = _path2.default.resolve(root, srcDir, "app", entry);
|
|
423
|
+
if (!existsSync(contentDir)) return void 0;
|
|
424
|
+
const relativeContentDir = _path2.default.relative(root, contentDir);
|
|
425
|
+
if (relativeContentDir.startsWith("..") || _path2.default.isAbsolute(relativeContentDir)) return void 0;
|
|
426
|
+
return normalizeDocsContentDir(relativeContentDir);
|
|
427
|
+
}
|
|
428
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, inferDocsContentDir, "inferDocsContentDir");
|
|
429
|
+
function isRecord(value) {
|
|
430
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
431
|
+
}
|
|
432
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isRecord, "isRecord");
|
|
433
|
+
function cloneSerializable(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
434
|
+
if (value === null) return null;
|
|
435
|
+
const valueType = typeof value;
|
|
436
|
+
if (valueType === "string" || valueType === "number" || valueType === "boolean") {
|
|
437
|
+
return value;
|
|
438
|
+
}
|
|
439
|
+
if (valueType === "undefined" || valueType === "function" || valueType === "symbol") {
|
|
440
|
+
return void 0;
|
|
441
|
+
}
|
|
442
|
+
if (Array.isArray(value)) {
|
|
443
|
+
return value.map((item) => cloneSerializable(item, seen)).filter((item) => item !== void 0);
|
|
444
|
+
}
|
|
445
|
+
if (value instanceof Date) {
|
|
446
|
+
return value.toISOString();
|
|
447
|
+
}
|
|
448
|
+
if (isRecord(value)) {
|
|
449
|
+
if (seen.has(value)) return void 0;
|
|
450
|
+
seen.add(value);
|
|
451
|
+
const output = {};
|
|
452
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
453
|
+
const clonedValue = cloneSerializable(nestedValue, seen);
|
|
454
|
+
if (clonedValue !== void 0) {
|
|
455
|
+
output[key] = clonedValue;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return output;
|
|
459
|
+
}
|
|
460
|
+
return void 0;
|
|
461
|
+
}
|
|
462
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, cloneSerializable, "cloneSerializable");
|
|
463
|
+
function sanitizeDocsConfig(config) {
|
|
464
|
+
return cloneSerializable(config) || {};
|
|
465
|
+
}
|
|
466
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, sanitizeDocsConfig, "sanitizeDocsConfig");
|
|
467
|
+
async function findDocsConfigPath(rootDir, configPath) {
|
|
468
|
+
const { existsSync } = await import("fs");
|
|
469
|
+
const root = _path2.default.resolve(rootDir || process.cwd());
|
|
470
|
+
if (configPath) {
|
|
471
|
+
const resolvedPath = _path2.default.isAbsolute(configPath) ? configPath : _path2.default.join(root, configPath);
|
|
472
|
+
if (!existsSync(resolvedPath)) {
|
|
473
|
+
throw new Error(`Could not find docs config at ${configPath}.`);
|
|
474
|
+
}
|
|
475
|
+
return _path2.default.resolve(resolvedPath);
|
|
476
|
+
}
|
|
477
|
+
for (const filename of DOCS_CONFIG_FILENAMES) {
|
|
478
|
+
const resolvedPath = _path2.default.join(root, filename);
|
|
479
|
+
if (existsSync(resolvedPath)) {
|
|
480
|
+
return resolvedPath;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return void 0;
|
|
484
|
+
}
|
|
485
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, findDocsConfigPath, "findDocsConfigPath");
|
|
486
|
+
async function loadDocsConfig(rootDir, configPath) {
|
|
487
|
+
const fs = await import("fs/promises");
|
|
488
|
+
const { pathToFileURL: pathToFileURL3 } = await import("url");
|
|
489
|
+
const root = _path2.default.resolve(rootDir || process.cwd());
|
|
490
|
+
const resolvedPath = await findDocsConfigPath(root, configPath);
|
|
491
|
+
if (!resolvedPath) return void 0;
|
|
492
|
+
try {
|
|
493
|
+
if (resolvedPath.endsWith(".json")) {
|
|
494
|
+
const content = await fs.readFile(resolvedPath, "utf8");
|
|
495
|
+
return { config: JSON.parse(content), configPath: resolvedPath };
|
|
496
|
+
}
|
|
497
|
+
const { build } = await import("esbuild");
|
|
498
|
+
const configCacheDir = _path2.default.join(root, ".farm", ".config-loader");
|
|
499
|
+
await fs.mkdir(configCacheDir, { recursive: true });
|
|
500
|
+
const modulePath = _path2.default.join(
|
|
501
|
+
configCacheDir,
|
|
502
|
+
`docs-config-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
|
|
503
|
+
);
|
|
504
|
+
await build({
|
|
505
|
+
absWorkingDir: root,
|
|
506
|
+
entryPoints: [resolvedPath],
|
|
507
|
+
outfile: modulePath,
|
|
508
|
+
bundle: true,
|
|
509
|
+
format: "esm",
|
|
510
|
+
platform: "node",
|
|
511
|
+
target: `node${process.versions.node.split(".")[0]}`,
|
|
512
|
+
packages: "external",
|
|
513
|
+
jsx: "automatic",
|
|
514
|
+
logLevel: "silent",
|
|
515
|
+
sourcemap: "inline"
|
|
516
|
+
});
|
|
517
|
+
const moduleUrl = pathToFileURL3(modulePath).href + `?t=${Date.now()}`;
|
|
518
|
+
let importedConfig;
|
|
519
|
+
try {
|
|
520
|
+
importedConfig = await import(
|
|
521
|
+
/* @vite-ignore */
|
|
522
|
+
moduleUrl
|
|
523
|
+
);
|
|
524
|
+
} finally {
|
|
525
|
+
await fs.unlink(modulePath).catch(() => void 0);
|
|
526
|
+
}
|
|
527
|
+
return {
|
|
528
|
+
config: importedConfig.default || importedConfig,
|
|
529
|
+
configPath: resolvedPath
|
|
530
|
+
};
|
|
531
|
+
} catch (error) {
|
|
532
|
+
const relativePath = _path2.default.relative(root, resolvedPath) || resolvedPath;
|
|
533
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
534
|
+
throw new Error(`Failed to load docs config from ${relativePath}: ${message}`);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, loadDocsConfig, "loadDocsConfig");
|
|
538
|
+
async function resolveDocsConfig(userDocs, options = {}) {
|
|
539
|
+
const root = options.root || process.cwd();
|
|
540
|
+
if (userDocs === false) {
|
|
541
|
+
return {
|
|
542
|
+
enabled: false,
|
|
543
|
+
entry: "/docs",
|
|
544
|
+
config: { entry: "docs", docsPath: "/docs" }
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
const docsOptions = isRecord(userDocs) ? userDocs : {};
|
|
548
|
+
if (docsOptions.enabled === false) {
|
|
549
|
+
return {
|
|
550
|
+
enabled: false,
|
|
551
|
+
entry: "/docs",
|
|
552
|
+
config: { entry: "docs", docsPath: "/docs" }
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
const loadedConfig = await loadDocsConfig(root, docsOptions.configPath);
|
|
556
|
+
const hasExplicitDocsConfig = userDocs === true || isRecord(userDocs);
|
|
557
|
+
if (!hasExplicitDocsConfig && !loadedConfig) {
|
|
558
|
+
return {
|
|
559
|
+
enabled: false,
|
|
560
|
+
entry: "/docs",
|
|
561
|
+
config: { entry: "docs", docsPath: "/docs" }
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
const inlineDocsConfig = sanitizeDocsConfig(docsOptions.config || {});
|
|
565
|
+
const directDocsConfig = sanitizeDocsConfig({
|
|
566
|
+
...docsOptions,
|
|
567
|
+
adapter: void 0,
|
|
568
|
+
enabled: void 0,
|
|
569
|
+
config: void 0,
|
|
570
|
+
configPath: void 0
|
|
571
|
+
});
|
|
572
|
+
const loadedDocsConfig = sanitizeDocsConfig(_optionalChain([loadedConfig, 'optionalAccess', _19 => _19.config]) || {});
|
|
573
|
+
const mergedDocsConfig = {
|
|
574
|
+
...loadedDocsConfig,
|
|
575
|
+
...inlineDocsConfig,
|
|
576
|
+
...directDocsConfig
|
|
577
|
+
};
|
|
578
|
+
const explicitRoute = typeof docsOptions.entry === "string" ? docsOptions.entry : void 0;
|
|
579
|
+
const configuredDocsPath = typeof mergedDocsConfig.docsPath === "string" ? mergedDocsConfig.docsPath : void 0;
|
|
580
|
+
const configuredEntry = typeof mergedDocsConfig.entry === "string" ? mergedDocsConfig.entry : void 0;
|
|
581
|
+
const entryRoute = normalizeDocsRoute(
|
|
582
|
+
configuredDocsPath || explicitRoute || (configuredEntry ? `/${configuredEntry}` : void 0)
|
|
583
|
+
);
|
|
584
|
+
const docsEntry = explicitRoute && explicitRoute.startsWith("/") ? docsRouteToEntry(explicitRoute) : docsRouteToEntry(configuredEntry || entryRoute);
|
|
585
|
+
const configuredContentDir = normalizeDocsContentDir(
|
|
586
|
+
docsOptions.contentDir || mergedDocsConfig.contentDir
|
|
587
|
+
);
|
|
588
|
+
const contentDir = configuredContentDir || await inferDocsContentDir(root, options.srcDir || "src", docsEntry);
|
|
589
|
+
return {
|
|
590
|
+
enabled: true,
|
|
591
|
+
entry: entryRoute,
|
|
592
|
+
...docsOptions.adapter ? { adapter: docsOptions.adapter } : {},
|
|
593
|
+
contentDir,
|
|
594
|
+
configPath: _optionalChain([loadedConfig, 'optionalAccess', _20 => _20.configPath]),
|
|
595
|
+
config: {
|
|
596
|
+
...mergedDocsConfig,
|
|
597
|
+
entry: docsEntry,
|
|
598
|
+
docsPath: entryRoute,
|
|
599
|
+
...contentDir ? { contentDir } : {}
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveDocsConfig, "resolveDocsConfig");
|
|
604
|
+
function validateRedirectConfigs(redirects, field) {
|
|
605
|
+
for (const [index, redirect] of redirects.entries()) {
|
|
606
|
+
_chunkDVM4FKZLcjs.validateConfigRouteSource.call(void 0, redirect.source, `${field}[${index}].source`);
|
|
607
|
+
if (redirect.statusCode !== void 0 && !_chunkOX6O6WVAcjs.isFarmRedirectStatus.call(void 0, redirect.statusCode)) {
|
|
608
|
+
throw new RangeError(
|
|
609
|
+
`${field}[${index}].statusCode must be one of 301, 302, 303, 307, or 308.`
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return redirects;
|
|
614
|
+
}
|
|
615
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, validateRedirectConfigs, "validateRedirectConfigs");
|
|
616
|
+
function validateConfigRouteSources(routes, field) {
|
|
617
|
+
for (const [index, route] of routes.entries()) {
|
|
618
|
+
_chunkDVM4FKZLcjs.validateConfigRouteSource.call(void 0, route.source, `${field}[${index}].source`);
|
|
619
|
+
}
|
|
620
|
+
return routes;
|
|
621
|
+
}
|
|
622
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, validateConfigRouteSources, "validateConfigRouteSources");
|
|
623
|
+
async function resolveConfig(userConfig, mode) {
|
|
624
|
+
const projectRoot = userConfig.root || process.cwd();
|
|
625
|
+
const layerResolution = await _chunkY4YMF2NQcjs.resolveFarmLayers.call(void 0, userConfig, {
|
|
626
|
+
root: projectRoot,
|
|
627
|
+
mode
|
|
628
|
+
});
|
|
629
|
+
userConfig = layerResolution.config;
|
|
630
|
+
if (userConfig.typescript !== void 0) {
|
|
631
|
+
_chunk5QIKR7RRcjs.logger.warn(
|
|
632
|
+
'The top-level "typescript" option is not supported and has no effect. Configure TypeScript in `tsconfig.json` and run `tsc --noEmit` separately when builds must enforce project type errors.'
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
if (userConfig.output !== void 0) {
|
|
636
|
+
_chunk5QIKR7RRcjs.logger.warn(
|
|
637
|
+
'The top-level "output" option is not supported and has no effect. Configure `deploy.target`, `deploy.preset`, or `deploy.outputDir` for deployment output, and use route rendering configuration for static pages.'
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
if (_chunkTFAXUHWXcjs.isReactRenderer.call(void 0, _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, userConfig.renderer))) {
|
|
641
|
+
userConfig = await applyFarmDocsFrameworkAutoDetection(userConfig, {
|
|
642
|
+
root: userConfig.root || projectRoot
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
const redirects = validateRedirectConfigs(
|
|
646
|
+
typeof userConfig.redirects === "function" ? await userConfig.redirects() : userConfig.redirects || [],
|
|
647
|
+
"redirects"
|
|
648
|
+
);
|
|
649
|
+
const rewrites = typeof userConfig.rewrites === "function" ? await userConfig.rewrites() : userConfig.rewrites || [];
|
|
650
|
+
validateConfigRouteSources(rewrites, "rewrites");
|
|
651
|
+
const headers = typeof userConfig.headers === "function" ? await userConfig.headers() : userConfig.headers || [];
|
|
652
|
+
validateConfigRouteSources(headers, "headers");
|
|
653
|
+
const routeRules = _chunkGDSHDTJ4cjs.normalizeRouteRules.call(void 0, userConfig.routeRules);
|
|
654
|
+
const routeRuleRedirects = _chunkGDSHDTJ4cjs.routeRulesToRedirects.call(void 0, routeRules);
|
|
655
|
+
const routeRuleHeaders = _chunkGDSHDTJ4cjs.routeRulesToHeaders.call(void 0, routeRules);
|
|
656
|
+
const security = _chunkTYQUSXUGcjs.resolveFarmSecurityConfig.call(void 0, userConfig.security);
|
|
657
|
+
const securityHeader = _chunkTYQUSXUGcjs.getFarmSecurityHeader.call(void 0, security);
|
|
658
|
+
if (_chunkTYQUSXUGcjs.farmCspBlocksFrameworkInlineScripts.call(void 0, security)) {
|
|
659
|
+
_chunk5QIKR7RRcjs.logger.warn(
|
|
660
|
+
"security.csp blocks the inline scripts Farm injects for theming and hydration. Set security.csp.nonce to true for managed dynamic nonces and prerendered hashes, or make the governing script directive allow 'unsafe-inline' without a nonce, hash, or 'strict-dynamic' source."
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
const deploy = resolveDeployConfig(userConfig);
|
|
664
|
+
const root = userConfig.root || process.cwd();
|
|
665
|
+
const srcDir = userConfig.srcDir || "src";
|
|
666
|
+
const docs = await resolveDocsConfig(userConfig.docs, { root, srcDir });
|
|
667
|
+
const md = _chunkTWGMSEHXcjs.resolveMarkdownConfig.call(void 0, userConfig.md);
|
|
668
|
+
const mdx = _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, userConfig.mdx);
|
|
669
|
+
const env = _chunkVEKFLAQMcjs.resolveEnv.call(void 0, userConfig.env, process.env);
|
|
670
|
+
_chunkVEKFLAQMcjs.setEnv.call(void 0, env);
|
|
671
|
+
const api = await _chunkS3A45T7Fcjs.resolveFarmAPIConfig.call(void 0, userConfig.api, { root, mode, env });
|
|
672
|
+
const auth = _chunkQBPXNZGVcjs.resolveFarmAuthConfig.call(void 0, userConfig.auth);
|
|
673
|
+
const mcp = resolveFarmMCPConfig(userConfig.mcp);
|
|
674
|
+
if (auth.enabled && _optionalChain([userConfig, 'access', _21 => _21.integrations, 'optionalAccess', _22 => _22.auth])) {
|
|
675
|
+
throw new Error(
|
|
676
|
+
"Choose either the top-level `auth` config or `integrations.auth`; they cannot both own the auth route."
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
const nativeAuthIntegration = await _chunkQBPXNZGVcjs.resolveFarmAuthIntegration.call(void 0, auth, {
|
|
680
|
+
root,
|
|
681
|
+
mode
|
|
682
|
+
});
|
|
683
|
+
const nativeMCPPlugin = await resolveFarmMCPPlugin(mcp, { root });
|
|
684
|
+
if (nativeMCPPlugin && _optionalChain([userConfig, 'access', _23 => _23.plugins, 'optionalAccess', _24 => _24.some, 'call', _25 => _25((plugin) => _optionalChain([plugin, 'optionalAccess', _26 => _26.name]) === "farm:api-mcp")])) {
|
|
685
|
+
throw new Error(
|
|
686
|
+
"Choose either the top-level `mcp` config or `apiMcp()` in `plugins`; they configure the same MCP transport."
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
const integrations = nativeAuthIntegration ? { ...userConfig.integrations, auth: nativeAuthIntegration } : userConfig.integrations || {};
|
|
690
|
+
const generateBuildId = userConfig.generateBuildId || (() => `build-${Date.now()}`);
|
|
691
|
+
const deploymentId = _chunkC5GUTBZKcjs.normalizeFarmDeploymentId.call(void 0,
|
|
692
|
+
userConfig.deploymentId || process.env.FARM_DEPLOYMENT_ID || process.env.VERCEL_GIT_COMMIT_SHA || process.env.CF_PAGES_COMMIT_SHA || (mode === "production" ? await generateBuildId() : "development")
|
|
693
|
+
);
|
|
694
|
+
const basePath = _chunkI57LW5VZcjs.normalizeFarmConfigBasePath.call(void 0, userConfig.basePath);
|
|
695
|
+
const openapi = {
|
|
696
|
+
enabled: false,
|
|
697
|
+
route: "/docs/reference",
|
|
698
|
+
specRoute: "/openapi.json",
|
|
699
|
+
title: "API Documentation",
|
|
700
|
+
description: "Auto-generated API documentation",
|
|
701
|
+
version: "1.0.0",
|
|
702
|
+
...userConfig.openapi
|
|
703
|
+
};
|
|
704
|
+
if (openapi.route !== void 0) _chunkDVM4FKZLcjs.validateConfigRouteSource.call(void 0, openapi.route, "openapi.route");
|
|
705
|
+
if (openapi.specRoute) _chunkDVM4FKZLcjs.validateConfigRouteSource.call(void 0, openapi.specRoute, "openapi.specRoute");
|
|
706
|
+
const resolved = {
|
|
707
|
+
[FARM_RESOLVED_CUSTOM_CONTEXT]: typeof userConfig.context === "function",
|
|
708
|
+
root,
|
|
709
|
+
srcDir,
|
|
710
|
+
extends: userConfig.extends || [],
|
|
711
|
+
layers: layerResolution.layers,
|
|
712
|
+
outDir: userConfig.outDir || "dist",
|
|
713
|
+
basePath,
|
|
714
|
+
renderer: _chunkTFAXUHWXcjs.resolveFarmRenderer.call(void 0, userConfig.renderer),
|
|
715
|
+
preset: deploy.preset || "node-server",
|
|
716
|
+
deploy,
|
|
717
|
+
docs,
|
|
718
|
+
md,
|
|
719
|
+
mdx,
|
|
720
|
+
migrations: resolveMigrationsConfig(userConfig.migrations),
|
|
721
|
+
cron: _chunk6EXBPJ24cjs.resolveCronConfig.call(void 0, userConfig.cron),
|
|
722
|
+
workflows: _chunkK6FNHVDRcjs.resolveWorkflowsConfig.call(void 0, userConfig.workflows),
|
|
723
|
+
api,
|
|
724
|
+
observability: _nullishCoalesce(userConfig.observability, () => ( false)),
|
|
725
|
+
telemetry: userConfig.telemetry !== false,
|
|
726
|
+
analytics: userConfig.analytics !== false,
|
|
727
|
+
devtools: _chunkYJRZR7VUcjs.resolveFarmDevtoolsConfig.call(void 0, userConfig.devtools, mode),
|
|
728
|
+
storage: userConfig.storage || {},
|
|
729
|
+
schema: resolveSchemaConfig(userConfig.schema),
|
|
730
|
+
cache: userConfig.cache || {},
|
|
731
|
+
auth,
|
|
732
|
+
mcp,
|
|
733
|
+
suppressLintOnLink: _nullishCoalesce(userConfig.suppressLintOnLink, () => ( false)),
|
|
734
|
+
experimental: {
|
|
735
|
+
serverComponents: false,
|
|
736
|
+
serverActions: false,
|
|
737
|
+
isolatedClientHydration: "off",
|
|
738
|
+
ppr: false,
|
|
739
|
+
...userConfig.experimental
|
|
740
|
+
},
|
|
741
|
+
agent: resolveFarmAgentConfig(userConfig.agent),
|
|
742
|
+
plugins: [
|
|
743
|
+
..._chunkZ5HIWVDPcjs.resolveIntegrationPlugins.call(void 0, integrations),
|
|
744
|
+
...nativeMCPPlugin ? [nativeMCPPlugin] : [],
|
|
745
|
+
...userConfig.plugins || []
|
|
746
|
+
],
|
|
747
|
+
integrations,
|
|
748
|
+
trailingSlash: _nullishCoalesce(userConfig.trailingSlash, () => ( false)),
|
|
749
|
+
redirects: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => [...redirects, ...routeRuleRedirects], "redirects"),
|
|
750
|
+
rewrites: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => rewrites, "rewrites"),
|
|
751
|
+
headers: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => [
|
|
752
|
+
...headers,
|
|
753
|
+
...routeRuleHeaders,
|
|
754
|
+
...securityHeader ? [{ source: "/*", headers: [securityHeader] }] : []
|
|
755
|
+
], "headers"),
|
|
756
|
+
routeRules,
|
|
757
|
+
images: _chunkYFPGHF5Fcjs.resolveFarmImageConfig.call(void 0, userConfig.images),
|
|
758
|
+
performance: _chunkTYQUSXUGcjs.resolveFarmPerformanceConfig.call(void 0, userConfig.performance),
|
|
759
|
+
theme: _chunkOI6CMLWXcjs.resolveFarmThemeConfig.call(void 0, userConfig.theme, basePath),
|
|
760
|
+
publicDir: userConfig.publicDir || "public",
|
|
761
|
+
i18n: _chunkHBTUGXHScjs.resolveFarmI18nConfig.call(void 0, userConfig.i18n, { root, mode, basePath }),
|
|
762
|
+
openapi,
|
|
763
|
+
middleware: userConfig.middleware || {},
|
|
764
|
+
notFound: userConfig.notFound || {},
|
|
765
|
+
context: userConfig.context || (() => void 0),
|
|
766
|
+
server: _chunkEM6SBQKMcjs.resolveFarmServerConfig.call(void 0, userConfig.server),
|
|
767
|
+
serverActions: _chunkT5CERMEHcjs.resolveServerActionsConfig.call(void 0, userConfig.serverActions),
|
|
768
|
+
security,
|
|
769
|
+
deploymentId,
|
|
770
|
+
distDir: userConfig.distDir || ".farm",
|
|
771
|
+
generateBuildId,
|
|
772
|
+
compress: _nullishCoalesce(userConfig.compress, () => ( true)),
|
|
773
|
+
devIndicators: _chunkQBPXNZGVcjs.resolveFarmDevIndicatorsConfig.call(void 0, userConfig.devIndicators, mode),
|
|
774
|
+
serverRuntimeConfig: userConfig.serverRuntimeConfig || {},
|
|
775
|
+
publicRuntimeConfig: userConfig.publicRuntimeConfig || {},
|
|
776
|
+
env,
|
|
777
|
+
vite: typeof userConfig.vite === "function" ? userConfig.vite({}) : userConfig.vite || {}
|
|
778
|
+
};
|
|
779
|
+
_chunkQBPXNZGVcjs.assertPluginDependencies.call(void 0, resolved.plugins, resolved.integrations);
|
|
780
|
+
return resolved;
|
|
781
|
+
}
|
|
782
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveConfig, "resolveConfig");
|
|
783
|
+
function formatConfigLoadError(error) {
|
|
784
|
+
if (error && (typeof error === "object" || typeof error === "function")) {
|
|
785
|
+
for (const property of ["message", "stack", "name"]) {
|
|
786
|
+
try {
|
|
787
|
+
const value = Reflect.get(error, property);
|
|
788
|
+
if (typeof value === "string" && value) return value;
|
|
789
|
+
} catch (e4) {
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
try {
|
|
794
|
+
return String(error);
|
|
795
|
+
} catch (e5) {
|
|
796
|
+
return "Unknown config loader error";
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, formatConfigLoadError, "formatConfigLoadError");
|
|
800
|
+
async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "production" ? "production" : "development", loadEnvironment) {
|
|
801
|
+
const { existsSync } = await import("fs");
|
|
802
|
+
const loadEnv = loadEnvironment || (await import("vite")).loadEnv;
|
|
803
|
+
const root = rootDir || process.cwd();
|
|
804
|
+
const loadedEnv = loadEnv(mode, root, "");
|
|
805
|
+
for (const [key, value] of Object.entries(loadedEnv)) {
|
|
806
|
+
if (process.env[key] === void 0) {
|
|
807
|
+
process.env[key] = value;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
if (configPath) {
|
|
811
|
+
const explicitPath = _path2.default.resolve(
|
|
812
|
+
_path2.default.isAbsolute(configPath) ? configPath : _path2.default.join(root, configPath)
|
|
813
|
+
);
|
|
814
|
+
if (!existsSync(explicitPath)) {
|
|
815
|
+
throw new Error(`Config file not found at ${configPath} (resolved to ${explicitPath}).`);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
const searchPaths = [
|
|
819
|
+
configPath,
|
|
820
|
+
"farm.config.ts",
|
|
821
|
+
"farm.config.mts",
|
|
822
|
+
"farm.config.js",
|
|
823
|
+
"farm.config.mjs",
|
|
824
|
+
"config.ts",
|
|
825
|
+
"config.mts",
|
|
826
|
+
"config.js",
|
|
827
|
+
"config.mjs"
|
|
828
|
+
].filter(Boolean);
|
|
829
|
+
for (const relativePath of searchPaths) {
|
|
830
|
+
try {
|
|
831
|
+
const absolutePath = _path2.default.isAbsolute(relativePath) ? relativePath : _path2.default.join(root, relativePath);
|
|
832
|
+
const normalizedPath = _path2.default.resolve(absolutePath);
|
|
833
|
+
if (!existsSync(normalizedPath)) {
|
|
834
|
+
continue;
|
|
835
|
+
}
|
|
836
|
+
const loadedConfig = await _chunkY4YMF2NQcjs.loadFarmConfigFile.call(void 0, normalizedPath, { root });
|
|
837
|
+
return loadedConfig.root === void 0 ? { ...loadedConfig, root } : loadedConfig;
|
|
838
|
+
} catch (error) {
|
|
839
|
+
const configError = new Error(
|
|
840
|
+
`Failed to load config from ${relativePath}: ${formatConfigLoadError(error)}`
|
|
841
|
+
);
|
|
842
|
+
configError.cause = error;
|
|
843
|
+
throw configError;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
return void 0;
|
|
847
|
+
}
|
|
848
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, loadConfig, "loadConfig");
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
exports.hasCustomFarmRouteContext = hasCustomFarmRouteContext; exports.normalizeDeployTarget = normalizeDeployTarget; exports.getPresetForDeployTarget = getPresetForDeployTarget; exports.getDeployTargetForPreset = getDeployTargetForPreset; exports.getDefaultDeployOutputDir = getDefaultDeployOutputDir; exports.resolveDeployOutputPath = resolveDeployOutputPath; exports.resolveDeployConfig = resolveDeployConfig; exports.resolveMigrationsConfig = resolveMigrationsConfig; exports.resolveDocsConfig = resolveDocsConfig; exports.resolveConfig = resolveConfig; exports.loadConfig = loadConfig;
|