@farm.js/core 0.1.84 → 0.1.85
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/{analyzer-7RNO3XKC.mjs → analyzer-R6KNJ6IO.mjs} +2 -2
- package/dist/analyzer-XVY76XMM.cjs +17 -0
- package/dist/{app.d-eSm7jgoc.d.mts → app.d-Bvpc2eJq.d.mts} +1 -1
- package/dist/{app.d-CVPu_hoD.d.ts → app.d-DEKpJEp4.d.ts} +1 -1
- package/dist/{chunk-INU4K4U4.mjs → chunk-2DMOB6BH.mjs} +1 -1
- package/dist/{chunk-CVZY4TLW.cjs → chunk-3HWNYLQV.cjs} +1 -1
- package/dist/{chunk-XLULEFRW.mjs → chunk-3TCFONUE.mjs} +11 -2
- package/dist/{chunk-HOQ2MYBJ.cjs → chunk-7TPLDPNC.cjs} +2 -2
- package/dist/{chunk-57EEWWUS.cjs → chunk-BZN5HX7Y.cjs} +2 -2
- package/dist/{chunk-BZY3SRRD.mjs → chunk-CDZ55QRD.mjs} +1 -1
- package/dist/{chunk-KXVMWLTC.mjs → chunk-GFVPQ25Z.mjs} +82 -12
- package/dist/{chunk-OFVBMS6I.cjs → chunk-H6C45DCF.cjs} +48 -48
- package/dist/{chunk-USMRAC72.cjs → chunk-HKJIUZS5.cjs} +2 -2
- package/dist/{chunk-MUUDHWQZ.mjs → chunk-J7VIXTPQ.mjs} +1 -1
- package/dist/{chunk-EBSL5TW7.cjs → chunk-OYM6VJEF.cjs} +27 -18
- package/dist/{chunk-IRJSZAJB.mjs → chunk-PQR5A7R2.mjs} +1 -1
- package/dist/{chunk-OP7BIEUW.cjs → chunk-Q7GB3I4O.cjs} +2 -2
- package/dist/{chunk-YU6VL7H5.cjs → chunk-QUHDVJMR.cjs} +3 -3
- package/dist/{chunk-Z37PDUJR.cjs → chunk-RVJQHQCG.cjs} +4 -4
- package/dist/{chunk-22BTYPIX.cjs → chunk-TOUC6BR3.cjs} +4 -4
- package/dist/{chunk-DFDQGHPU.mjs → chunk-U6HUVY5R.mjs} +14 -9
- package/dist/{chunk-DSWSDDP2.cjs → chunk-UEQC4ZLP.cjs} +339 -269
- package/dist/{chunk-5I4ZGKP2.cjs → chunk-WYTK7HQS.cjs} +129 -124
- package/dist/{chunk-BRDGINBB.mjs → chunk-X7RSOEMQ.mjs} +6 -6
- package/dist/{chunk-I5CVJ24H.mjs → chunk-XIXAUXV3.mjs} +1 -1
- package/dist/{chunk-M5XU22PQ.mjs → chunk-YS647ASS.mjs} +1 -1
- package/dist/{chunk-3WM7VBGW.mjs → chunk-YX532KEF.mjs} +2 -2
- package/dist/{chunk-NLHSKKTT.mjs → chunk-Z3LOPHSO.mjs} +1 -1
- package/dist/{client-component.d-DLknFP8l.d.ts → client-component.d-CZG02pIh.d.ts} +2 -1
- package/dist/{client-component.d-DLMCzmUx.d.mts → client-component.d-miqIXyQv.d.mts} +2 -1
- package/dist/{devtools-MWQA5LVN.mjs → devtools-34ZQWX3M.mjs} +1 -1
- package/dist/{devtools-4SVIRV4P.cjs → devtools-SXL5RFE5.cjs} +2 -2
- package/dist/docs.cjs +3 -3
- package/dist/docs.mjs +2 -2
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/index.cjs +15 -15
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +14 -14
- package/dist/internal/build-runtime.cjs +14 -14
- package/dist/internal/build-runtime.mjs +13 -13
- package/dist/internal/cli-runtime.cjs +3 -3
- package/dist/internal/cli-runtime.mjs +2 -2
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/config-runtime.cjs +3 -3
- package/dist/internal/config-runtime.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-runtime.cjs +15 -8
- package/dist/internal/islands-runtime.d.mts +2 -3
- package/dist/internal/islands-runtime.d.ts +2 -3
- package/dist/internal/islands-runtime.mjs +15 -8
- package/dist/internal/islands-server-tree.cjs +8 -0
- package/dist/internal/islands-server-tree.d.mts +5 -0
- package/dist/internal/islands-server-tree.d.ts +5 -0
- package/dist/internal/islands-server-tree.mjs +8 -0
- package/dist/internal/islx-actions-server.d.mts +0 -3
- package/dist/internal/islx-actions-server.d.ts +0 -3
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +7 -7
- package/dist/internal/production-runtime.mjs +8 -8
- package/dist/plugin.cjs +9 -9
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +8 -8
- package/dist/{rsc-pipeline-OWBEZ7HB.cjs → rsc-pipeline-ESPGX4VX.cjs} +3 -3
- package/dist/{rsc-pipeline-UT3Z2GDO.mjs → rsc-pipeline-MW2V3WEE.mjs} +2 -2
- package/dist/{runtime-SRMQ46SK.cjs → runtime-FCMLEBTX.cjs} +4 -4
- package/dist/{runtime-F5I3WY3B.mjs → runtime-KGSOEMLT.mjs} +2 -2
- package/dist/server.cjs +30 -30
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.mjs +10 -10
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +9 -9
- package/dist/vite.d.mts +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.mjs +8 -8
- package/package.json +6 -1
- package/dist/analyzer-PFKA5NI6.cjs +0 -17
- /package/dist/{chunk-EDBIBO67.mjs → chunk-4QCMTIBM.mjs} +0 -0
- /package/dist/{chunk-BOEDYXAX.cjs → chunk-BBX4RPOV.cjs} +0 -0
|
@@ -32,7 +32,7 @@ var _chunkMHKPXX3Jcjs = require('./chunk-MHKPXX3J.cjs');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkQUHDVJMRcjs = require('./chunk-QUHDVJMR.cjs');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@ var _chunkYU6VL7H5cjs = require('./chunk-YU6VL7H5.cjs');
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _chunkHKJIUZS5cjs = require('./chunk-HKJIUZS5.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
@@ -70,7 +70,7 @@ var _chunkNDOE76QCcjs = require('./chunk-NDOE76QC.cjs');
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
var
|
|
73
|
+
var _chunkBBX4RPOVcjs = require('./chunk-BBX4RPOV.cjs');
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
var _chunk3BTN3NP7cjs = require('./chunk-3BTN3NP7.cjs');
|
|
@@ -115,7 +115,7 @@ var _chunkO4JYMU5Ncjs = require('./chunk-O4JYMU5N.cjs');
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
var
|
|
118
|
+
var _chunkH6C45DCFcjs = require('./chunk-H6C45DCF.cjs');
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
|
|
@@ -138,7 +138,7 @@ var _chunkMAPHNGTFcjs = require('./chunk-MAPHNGTF.cjs');
|
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
var
|
|
141
|
+
var _chunkRVJQHQCGcjs = require('./chunk-RVJQHQCG.cjs');
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
|
|
@@ -165,7 +165,7 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
|
165
165
|
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
var
|
|
168
|
+
var _chunkTOUC6BR3cjs = require('./chunk-TOUC6BR3.cjs');
|
|
169
169
|
|
|
170
170
|
|
|
171
171
|
|
|
@@ -173,7 +173,7 @@ var _chunk22BTYPIXcjs = require('./chunk-22BTYPIX.cjs');
|
|
|
173
173
|
var _chunkW53Z4WDIcjs = require('./chunk-W53Z4WDI.cjs');
|
|
174
174
|
|
|
175
175
|
|
|
176
|
-
var
|
|
176
|
+
var _chunkBZN5HX7Ycjs = require('./chunk-BZN5HX7Y.cjs');
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
@@ -194,7 +194,7 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
|
194
194
|
|
|
195
195
|
|
|
196
196
|
|
|
197
|
-
var
|
|
197
|
+
var _chunkOYM6VJEFcjs = require('./chunk-OYM6VJEF.cjs');
|
|
198
198
|
|
|
199
199
|
|
|
200
200
|
|
|
@@ -308,7 +308,7 @@ var _chunk7U4XF76Rcjs = require('./chunk-7U4XF76R.cjs');
|
|
|
308
308
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
309
309
|
|
|
310
310
|
|
|
311
|
-
var
|
|
311
|
+
var _chunk3HWNYLQVcjs = require('./chunk-3HWNYLQV.cjs');
|
|
312
312
|
|
|
313
313
|
|
|
314
314
|
var _chunkY3DO7BIJcjs = require('./chunk-Y3DO7BIJ.cjs');
|
|
@@ -661,7 +661,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
661
661
|
isPathGuarded: options.isPathGuarded,
|
|
662
662
|
basePath
|
|
663
663
|
});
|
|
664
|
-
const apiHandler =
|
|
664
|
+
const apiHandler = _chunkHKJIUZS5cjs.createFarmDocsAPIHandler.call(void 0, {
|
|
665
665
|
rootDir: options.root,
|
|
666
666
|
srcDir: options.srcDir,
|
|
667
667
|
docs,
|
|
@@ -835,6 +835,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
835
835
|
const rendererFiles = dynamicFiles(options.rendererModules);
|
|
836
836
|
const rootFiles = dynamicFiles(options.rootModules);
|
|
837
837
|
const actionFiles = dynamicFiles(options.actionModules, rendererFiles);
|
|
838
|
+
const serverTreeFiles = dynamicFiles(options.serverTreeModules, rendererFiles);
|
|
838
839
|
return {
|
|
839
840
|
files,
|
|
840
841
|
entry: entryFiles.map(index),
|
|
@@ -842,6 +843,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
842
843
|
...rendererFiles.length > 0 ? { renderer: rendererFiles.map(index) } : {},
|
|
843
844
|
...rootFiles.length > 0 ? { root: rootFiles.map(index) } : {},
|
|
844
845
|
...actionFiles.length > 0 ? { actions: actionFiles.map(index) } : {},
|
|
846
|
+
...serverTreeFiles.length > 0 ? { serverTrees: serverTreeFiles.map(index) } : {},
|
|
845
847
|
modules
|
|
846
848
|
};
|
|
847
849
|
}
|
|
@@ -860,11 +862,17 @@ function createFarmClientModulePreloadPlugin(options) {
|
|
|
860
862
|
};
|
|
861
863
|
const rendererModules = await resolve(options.rendererImports);
|
|
862
864
|
const actionModules = await resolve(options.actionImports);
|
|
865
|
+
const serverTreeModules = await resolve(options.serverTreeImports);
|
|
863
866
|
await _promises2.default.mkdir(options.buildDir, { recursive: true });
|
|
864
867
|
await _promises2.default.writeFile(
|
|
865
868
|
_path2.default.join(options.buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE),
|
|
866
869
|
JSON.stringify(
|
|
867
|
-
collectFarmClientModulePreloads(bundle, {
|
|
870
|
+
collectFarmClientModulePreloads(bundle, {
|
|
871
|
+
...options,
|
|
872
|
+
rendererModules,
|
|
873
|
+
actionModules,
|
|
874
|
+
serverTreeModules
|
|
875
|
+
})
|
|
868
876
|
)
|
|
869
877
|
);
|
|
870
878
|
}
|
|
@@ -886,6 +894,50 @@ function encodeFarmBuildJSONPlaceholder(value) {
|
|
|
886
894
|
return JSON.stringify(JSON.stringify(value)).slice(1, -1).replace(/'/g, "\\u0027").replace(/`/g, "\\u0060").replace(/\$/g, "\\u0024").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
887
895
|
}
|
|
888
896
|
|
|
897
|
+
// src/nitro/islands-react-chunk.ts
|
|
898
|
+
var REACT_MODULE = /[\\/]node_modules[\\/](?:react|react-dom|scheduler)[\\/]/;
|
|
899
|
+
function createFarmIslandsReactChunkGroup() {
|
|
900
|
+
let entryImportsReact;
|
|
901
|
+
return {
|
|
902
|
+
debugName: "react",
|
|
903
|
+
name(moduleId, context) {
|
|
904
|
+
if (!REACT_MODULE.test(moduleId)) return null;
|
|
905
|
+
_nullishCoalesce(entryImportsReact, () => ( (entryImportsReact = reactLoadsWithAnEntry(moduleId, context))));
|
|
906
|
+
return entryImportsReact ? null : "react";
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
function reactLoadsWithAnEntry(moduleId, context) {
|
|
911
|
+
const react = /* @__PURE__ */ new Set();
|
|
912
|
+
const pending = [moduleId];
|
|
913
|
+
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
914
|
+
if (react.has(id) || !REACT_MODULE.test(id)) continue;
|
|
915
|
+
react.add(id);
|
|
916
|
+
const info = context.getModuleInfo(id);
|
|
917
|
+
if (info) pending.push(...info.importedIds, ...info.importers);
|
|
918
|
+
}
|
|
919
|
+
const seen = /* @__PURE__ */ new Set();
|
|
920
|
+
pending.push(...react);
|
|
921
|
+
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
922
|
+
if (seen.has(id)) continue;
|
|
923
|
+
seen.add(id);
|
|
924
|
+
const info = context.getModuleInfo(id);
|
|
925
|
+
if (!info) continue;
|
|
926
|
+
if (info.isEntry) return true;
|
|
927
|
+
pending.push(...info.importers);
|
|
928
|
+
}
|
|
929
|
+
return false;
|
|
930
|
+
}
|
|
931
|
+
function configuresFarmClientChunks(vite) {
|
|
932
|
+
const build2 = _optionalChain([vite, 'optionalAccess', _10 => _10.build]);
|
|
933
|
+
const outputs = [_optionalChain([build2, 'optionalAccess', _11 => _11.rollupOptions, 'optionalAccess', _12 => _12.output]), _optionalChain([build2, 'optionalAccess', _13 => _13.rolldownOptions, 'optionalAccess', _14 => _14.output])].flat();
|
|
934
|
+
return outputs.some(
|
|
935
|
+
(output) => !!output && typeof output === "object" && ["manualChunks", "advancedChunks", "codeSplitting", "inlineDynamicImports"].some(
|
|
936
|
+
(key) => output[key] !== void 0
|
|
937
|
+
)
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
|
|
889
941
|
// src/nitro/client-route-table.ts
|
|
890
942
|
|
|
891
943
|
|
|
@@ -1140,7 +1192,7 @@ function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
|
1140
1192
|
`Route "${route.pattern}" requires the ${route.runtime} runtime, but preset "${preset}" emits ${runtime} functions. Choose a compatible preset or change the route runtime.`
|
|
1141
1193
|
);
|
|
1142
1194
|
}
|
|
1143
|
-
if (_optionalChain([route, 'access',
|
|
1195
|
+
if (_optionalChain([route, 'access', _15 => _15.regions, 'optionalAccess', _16 => _16.length]) && preset !== "vercel") {
|
|
1144
1196
|
warnings.add(
|
|
1145
1197
|
`Preset "${preset}" does not map per-route regions; Farm kept them in ${FARM_ROUTE_RUNTIME_MANIFEST} for deployment adapters.`
|
|
1146
1198
|
);
|
|
@@ -1187,7 +1239,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs5, b
|
|
|
1187
1239
|
const destinations = /* @__PURE__ */ new Map();
|
|
1188
1240
|
let groupIndex = 0;
|
|
1189
1241
|
for (const [key, group] of groups) {
|
|
1190
|
-
if (!_optionalChain([group, 'access',
|
|
1242
|
+
if (!_optionalChain([group, 'access', _17 => _17.config, 'access', _18 => _18.regions, 'optionalAccess', _19 => _19.length]) && !group.config.maxDuration) {
|
|
1191
1243
|
destinations.set(key, "/__nitro");
|
|
1192
1244
|
continue;
|
|
1193
1245
|
}
|
|
@@ -1237,14 +1289,14 @@ async function configureVercelFunction(functionDir, config, fs5) {
|
|
|
1237
1289
|
const current = JSON.parse(await fs5.readFile(configPath, "utf8"));
|
|
1238
1290
|
const next = {
|
|
1239
1291
|
...current,
|
|
1240
|
-
..._optionalChain([config, 'access',
|
|
1292
|
+
..._optionalChain([config, 'access', _20 => _20.regions, 'optionalAccess', _21 => _21.length]) ? { regions: config.regions } : {},
|
|
1241
1293
|
...config.maxDuration ? { maxDuration: config.maxDuration } : {}
|
|
1242
1294
|
};
|
|
1243
1295
|
await fs5.writeFile(configPath, `${JSON.stringify(next, null, 2)}
|
|
1244
1296
|
`);
|
|
1245
1297
|
}
|
|
1246
1298
|
function hasVercelFunctionControls(route) {
|
|
1247
|
-
return Boolean(_optionalChain([route, 'access',
|
|
1299
|
+
return Boolean(_optionalChain([route, 'access', _22 => _22.regions, 'optionalAccess', _23 => _23.length]) || route.maxDuration);
|
|
1248
1300
|
}
|
|
1249
1301
|
function compareRuntimeRoutes(left, right) {
|
|
1250
1302
|
const kindOrder = { page: 0, api: 0, metadata: 0, rule: 1 };
|
|
@@ -1289,7 +1341,7 @@ var FARM_HASHED_ASSET_DIRS = ["assets", "chunks"];
|
|
|
1289
1341
|
var LITERAL_ROUTE_PATH = /^\/[\w.~@/-]+$/;
|
|
1290
1342
|
function planFarmImmutableAssets(options) {
|
|
1291
1343
|
const cacheRulePatterns = Object.entries(_nullishCoalesce(options.routeRules, () => ( {}))).filter(
|
|
1292
|
-
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess',
|
|
1344
|
+
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess', _24 => _24.headers]), () => ( {}))).some((name) => name.toLowerCase() === "cache-control")
|
|
1293
1345
|
).map(([pattern]) => pattern);
|
|
1294
1346
|
const isImmutable = (file) => isFarmImmutableAssetPath(file) && !cacheRulePatterns.some((pattern) => _chunkIUKBPBM7cjs.farmRouteRuleMatches.call(void 0, pattern, file));
|
|
1295
1347
|
const routeDirs = new Set(
|
|
@@ -1417,7 +1469,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
|
1417
1469
|
function replaceServerFileReferences(bundle, chunkFileName, code, replace) {
|
|
1418
1470
|
return code.replace(SERVER_FILE_URL_RE, (reference, _quote, relativeUrl) => {
|
|
1419
1471
|
const target = resolveBundleFileName(chunkFileName, relativeUrl);
|
|
1420
|
-
return target && _optionalChain([bundle, 'access',
|
|
1472
|
+
return target && _optionalChain([bundle, 'access', _25 => _25[target], 'optionalAccess', _26 => _26.type]) === "asset" ? replace(target) : reference;
|
|
1421
1473
|
});
|
|
1422
1474
|
}
|
|
1423
1475
|
function collectServerReadSSRAssets(bundle) {
|
|
@@ -1470,7 +1522,7 @@ function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
|
1470
1522
|
if (assets.length === 0) return;
|
|
1471
1523
|
const sources = assets.map((fileName) => {
|
|
1472
1524
|
const output = bundle[fileName];
|
|
1473
|
-
const original = _optionalChain([output, 'optionalAccess',
|
|
1525
|
+
const original = _optionalChain([output, 'optionalAccess', _27 => _27.type]) === "asset" ? _optionalChain([output, 'access', _28 => _28.originalFileNames, 'optionalAccess', _29 => _29[0]]) : void 0;
|
|
1474
1526
|
if (!original) return fileName;
|
|
1475
1527
|
return _path2.default.relative(root, _path2.default.resolve(root, original)).split(_path2.default.sep).join("/");
|
|
1476
1528
|
});
|
|
@@ -1489,7 +1541,7 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
|
|
|
1489
1541
|
transform(code, id) {
|
|
1490
1542
|
if (!code.includes("import.meta.url")) return null;
|
|
1491
1543
|
const chunkFileName = _path2.default.relative(ssrOutputDir, id.split("?", 1)[0]).split(_path2.default.sep).join("/");
|
|
1492
|
-
if (_optionalChain([bundle, 'access',
|
|
1544
|
+
if (_optionalChain([bundle, 'access', _30 => _30[chunkFileName], 'optionalAccess', _31 => _31.type]) !== "chunk") return null;
|
|
1493
1545
|
let changed = false;
|
|
1494
1546
|
const transformed = replaceServerFileReferences(
|
|
1495
1547
|
bundle,
|
|
@@ -1585,7 +1637,7 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
1585
1637
|
var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
|
|
1586
1638
|
var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
|
|
1587
1639
|
function isConfigObject(node) {
|
|
1588
|
-
return _optionalChain([node, 'optionalAccess',
|
|
1640
|
+
return _optionalChain([node, 'optionalAccess', _32 => _32.type]) === "ObjectExpression";
|
|
1589
1641
|
}
|
|
1590
1642
|
function propertyName(property) {
|
|
1591
1643
|
if (property.type !== "Property" || property.computed) return void 0;
|
|
@@ -1606,7 +1658,7 @@ function collectConfigObjects(node, found) {
|
|
|
1606
1658
|
}
|
|
1607
1659
|
if (current.type === "CallExpression") {
|
|
1608
1660
|
const callee = current.callee;
|
|
1609
|
-
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access',
|
|
1661
|
+
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _33 => _33.property, 'optionalAccess', _34 => _34.name]);
|
|
1610
1662
|
const argument = current.arguments[0];
|
|
1611
1663
|
if (name && CONFIG_FACTORIES.has(name) && isConfigObject(argument)) found.push(argument);
|
|
1612
1664
|
}
|
|
@@ -1639,7 +1691,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1639
1691
|
const trailingComma = /^\s*,/.exec(code.slice(properties[last].end));
|
|
1640
1692
|
removals.push([
|
|
1641
1693
|
properties[first].start,
|
|
1642
|
-
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess',
|
|
1694
|
+
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _35 => _35[0], 'access', _36 => _36.length]), () => ( 0)))
|
|
1643
1695
|
]);
|
|
1644
1696
|
}
|
|
1645
1697
|
first = last;
|
|
@@ -1666,7 +1718,7 @@ function farmStripPlatformConfigPlugin(configFiles) {
|
|
|
1666
1718
|
// removed block used (`readFileSync` for a version, say).
|
|
1667
1719
|
enforce: "pre",
|
|
1668
1720
|
transform: {
|
|
1669
|
-
filter: { id:
|
|
1721
|
+
filter: { id: _chunkH6C45DCFcjs.fileNamePattern.call(void 0, configFiles) },
|
|
1670
1722
|
async handler(code, id) {
|
|
1671
1723
|
const file = id.split("?", 1)[0];
|
|
1672
1724
|
if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
|
|
@@ -1719,7 +1771,7 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
|
|
|
1719
1771
|
return;
|
|
1720
1772
|
}
|
|
1721
1773
|
worker.once("message", (entries) => {
|
|
1722
|
-
void _optionalChain([worker, 'optionalAccess',
|
|
1774
|
+
void _optionalChain([worker, 'optionalAccess', _37 => _37.terminate, 'call', _38 => _38()]);
|
|
1723
1775
|
done(entries);
|
|
1724
1776
|
});
|
|
1725
1777
|
worker.once("error", () => done());
|
|
@@ -1728,7 +1780,7 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
|
|
|
1728
1780
|
return {
|
|
1729
1781
|
pages,
|
|
1730
1782
|
dispose() {
|
|
1731
|
-
void _optionalChain([worker, 'optionalAccess',
|
|
1783
|
+
void _optionalChain([worker, 'optionalAccess', _39 => _39.terminate, 'call', _40 => _40()]);
|
|
1732
1784
|
}
|
|
1733
1785
|
};
|
|
1734
1786
|
}
|
|
@@ -1810,7 +1862,7 @@ function literalMatcher(node) {
|
|
|
1810
1862
|
if (node.type === "Literal" && node.regex)
|
|
1811
1863
|
return new RegExp(node.regex.pattern, node.regex.flags);
|
|
1812
1864
|
if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
|
|
1813
|
-
return _nullishCoalesce(_optionalChain([node, 'access',
|
|
1865
|
+
return _nullishCoalesce(_optionalChain([node, 'access', _41 => _41.quasis, 'access', _42 => _42[0], 'optionalAccess', _43 => _43.value, 'optionalAccess', _44 => _44.cooked]), () => ( void 0));
|
|
1814
1866
|
}
|
|
1815
1867
|
return void 0;
|
|
1816
1868
|
}
|
|
@@ -1834,7 +1886,7 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1834
1886
|
let found = null;
|
|
1835
1887
|
for (const statement of program.body) {
|
|
1836
1888
|
if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
|
|
1837
|
-
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access',
|
|
1889
|
+
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _45 => _45.exported, 'optionalAccess', _46 => _46.name]) === "config")) {
|
|
1838
1890
|
return "unknown";
|
|
1839
1891
|
}
|
|
1840
1892
|
continue;
|
|
@@ -1842,14 +1894,14 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1842
1894
|
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
|
|
1843
1895
|
if (!declaration || declaration.type !== "VariableDeclaration") continue;
|
|
1844
1896
|
for (const declarator of declaration.declarations) {
|
|
1845
|
-
if (_optionalChain([declarator, 'access',
|
|
1897
|
+
if (_optionalChain([declarator, 'access', _47 => _47.id, 'optionalAccess', _48 => _48.type]) !== "Identifier" || declarator.id.name !== "config") continue;
|
|
1846
1898
|
if (declaration.kind !== "const" || !declarator.init) return "unknown";
|
|
1847
1899
|
const init = unwrap(declarator.init);
|
|
1848
1900
|
if (init.type !== "ObjectExpression") return "unknown";
|
|
1849
1901
|
const config = {};
|
|
1850
1902
|
for (const property of init.properties) {
|
|
1851
1903
|
if (property.type !== "Property" || property.computed) return "unknown";
|
|
1852
|
-
const key = _nullishCoalesce(_optionalChain([property, 'access',
|
|
1904
|
+
const key = _nullishCoalesce(_optionalChain([property, 'access', _49 => _49.key, 'optionalAccess', _50 => _50.name]), () => ( _optionalChain([property, 'access', _51 => _51.key, 'optionalAccess', _52 => _52.value])));
|
|
1853
1905
|
if (key === "runtime") {
|
|
1854
1906
|
const runtime = literalMatcher(unwrap(property.value));
|
|
1855
1907
|
if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
|
|
@@ -1870,7 +1922,7 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1870
1922
|
try {
|
|
1871
1923
|
const [{ readFile: readFile2 }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1872
1924
|
const parsed = vite.parseSync(filePath, await readFile2(filePath, "utf8"));
|
|
1873
|
-
if (_optionalChain([parsed, 'access',
|
|
1925
|
+
if (_optionalChain([parsed, 'access', _53 => _53.errors, 'optionalAccess', _54 => _54.length])) return "unknown";
|
|
1874
1926
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1875
1927
|
} catch (e14) {
|
|
1876
1928
|
return "unknown";
|
|
@@ -1889,7 +1941,7 @@ function farmTargetRunsEdgeMiddleware(preset) {
|
|
|
1889
1941
|
return preset === "vercel";
|
|
1890
1942
|
}
|
|
1891
1943
|
function isFarmEdgeMiddlewareRoute(route) {
|
|
1892
|
-
return typeof route.config === "object" && _optionalChain([route, 'access',
|
|
1944
|
+
return typeof route.config === "object" && _optionalChain([route, 'access', _55 => _55.config, 'optionalAccess', _56 => _56.runtime]) === "edge";
|
|
1893
1945
|
}
|
|
1894
1946
|
function escapeRegExp3(value) {
|
|
1895
1947
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -1926,7 +1978,7 @@ export default createFarmVercelEdgeMiddleware({
|
|
|
1926
1978
|
${modules.join("\n")}
|
|
1927
1979
|
],
|
|
1928
1980
|
i18n: ${JSON.stringify(config.i18n)},
|
|
1929
|
-
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access',
|
|
1981
|
+
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _57 => _57.server, 'optionalAccess', _58 => _58.trustProxy]) === true })},
|
|
1930
1982
|
apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
1931
1983
|
notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
|
|
1932
1984
|
pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
|
|
@@ -1985,7 +2037,7 @@ async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
|
1985
2037
|
logLevel: "silent",
|
|
1986
2038
|
plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
|
|
1987
2039
|
resolve: {
|
|
1988
|
-
alias:
|
|
2040
|
+
alias: _chunkH6C45DCFcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
1989
2041
|
conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
|
|
1990
2042
|
},
|
|
1991
2043
|
transform: {
|
|
@@ -2217,7 +2269,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
2217
2269
|
return {
|
|
2218
2270
|
name: "farm-prerender-runtime-resolver",
|
|
2219
2271
|
async resolveId(id, _importer, options) {
|
|
2220
|
-
if (_optionalChain([options, 'access',
|
|
2272
|
+
if (_optionalChain([options, 'access', _59 => _59.custom, 'optionalAccess', _60 => _60.farmPrerenderRuntimeResolve])) return null;
|
|
2221
2273
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
2222
2274
|
return null;
|
|
2223
2275
|
}
|
|
@@ -2387,7 +2439,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2387
2439
|
return {
|
|
2388
2440
|
name: "farm-omitted-metadata-image-runtime",
|
|
2389
2441
|
resolveId: {
|
|
2390
|
-
filter: { id:
|
|
2442
|
+
filter: { id: _chunkH6C45DCFcjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
|
|
2391
2443
|
handler(source, importer) {
|
|
2392
2444
|
if (source !== "@vercel/og") return null;
|
|
2393
2445
|
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
|
|
@@ -2396,7 +2448,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2396
2448
|
}
|
|
2397
2449
|
},
|
|
2398
2450
|
load: {
|
|
2399
|
-
filter: { id:
|
|
2451
|
+
filter: { id: _chunkH6C45DCFcjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
|
|
2400
2452
|
handler(id) {
|
|
2401
2453
|
if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
|
|
2402
2454
|
return `
|
|
@@ -2424,8 +2476,8 @@ function readVercelOgManifest(file) {
|
|
|
2424
2476
|
}
|
|
2425
2477
|
function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
2426
2478
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
2427
|
-
const entry = _optionalChain([vercelOg, 'optionalAccess',
|
|
2428
|
-
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess',
|
|
2479
|
+
const entry = _optionalChain([vercelOg, 'optionalAccess', _61 => _61.manifest, 'access', _62 => _62.exports, 'optionalAccess', _63 => _63["."], 'optionalAccess', _64 => _64[condition]]);
|
|
2480
|
+
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _65 => _65.default]);
|
|
2429
2481
|
return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
|
|
2430
2482
|
}
|
|
2431
2483
|
function createEdgeMetadataImageRuntimePlugin({
|
|
@@ -2441,7 +2493,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
2441
2493
|
const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
|
|
2442
2494
|
return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
|
|
2443
2495
|
}
|
|
2444
|
-
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2496
|
+
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _66 => _66.replace, 'call', _67 => _67(/\\/g, "/"), 'access', _68 => _68.includes, 'call', _69 => _69("/@vercel/og/")])) {
|
|
2445
2497
|
return null;
|
|
2446
2498
|
}
|
|
2447
2499
|
const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
|
|
@@ -2463,7 +2515,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
2463
2515
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
2464
2516
|
});
|
|
2465
2517
|
if (inlined !== code) return { code: inlined, map: null };
|
|
2466
|
-
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call',
|
|
2518
|
+
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _70 => _70(file), 'optionalAccess', _71 => _71.manifest, 'access', _72 => _72.version]), () => ( "(unknown version)"));
|
|
2467
2519
|
this.error(
|
|
2468
2520
|
`@vercel/og ${version} cannot be bundled for ${runtime}: ${file} does not load its default font with fetch(new URL("./<font>.ttf", import.meta.url)), the pattern Farm inlines because an edge function cannot fetch it. Install a @vercel/og version whose edge build does, such as 1.0.1.`
|
|
2469
2521
|
);
|
|
@@ -2474,7 +2526,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
2474
2526
|
return {
|
|
2475
2527
|
name: "farm-metadata-image-wasm",
|
|
2476
2528
|
resolveId(source, importer) {
|
|
2477
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2529
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _73 => _73.replace, 'call', _74 => _74(/\\/g, "/"), 'access', _75 => _75.includes, 'call', _76 => _76("/@vercel/og/")])) {
|
|
2478
2530
|
return null;
|
|
2479
2531
|
}
|
|
2480
2532
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -2550,9 +2602,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
2550
2602
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
2551
2603
|
}
|
|
2552
2604
|
function nameCodeSplittingGroups(bundlerConfig) {
|
|
2553
|
-
const outputs = _optionalChain([bundlerConfig, 'optionalAccess',
|
|
2605
|
+
const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _77 => _77.output]);
|
|
2554
2606
|
for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
|
|
2555
|
-
const groups = _optionalChain([output, 'optionalAccess',
|
|
2607
|
+
const groups = _optionalChain([output, 'optionalAccess', _78 => _78.codeSplitting, 'optionalAccess', _79 => _79.groups]);
|
|
2556
2608
|
if (!Array.isArray(groups)) continue;
|
|
2557
2609
|
groups.forEach((group, index) => {
|
|
2558
2610
|
if (group && typeof group.name === "function" && !group.debugName) {
|
|
@@ -2613,9 +2665,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
2613
2665
|
throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
|
|
2614
2666
|
}
|
|
2615
2667
|
const restore = (node) => {
|
|
2616
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
2668
|
+
if (_optionalChain([node, 'optionalAccess', _80 => _80.type]) !== "TemplateLiteral") return;
|
|
2617
2669
|
const template = node;
|
|
2618
|
-
const value = _optionalChain([template, 'access',
|
|
2670
|
+
const value = _optionalChain([template, 'access', _81 => _81.quasis, 'access', _82 => _82[0], 'optionalAccess', _83 => _83.value, 'access', _84 => _84.cooked]);
|
|
2619
2671
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
2620
2672
|
replacements.push({
|
|
2621
2673
|
start: template.start,
|
|
@@ -2773,7 +2825,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2773
2825
|
return Array.from(routes.values()).sort(_chunkSHDCKRP4cjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
2774
2826
|
}
|
|
2775
2827
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
2776
|
-
if (!_optionalChain([config, 'access',
|
|
2828
|
+
if (!_optionalChain([config, 'access', _85 => _85.docs, 'optionalAccess', _86 => _86.enabled]) || !_optionalChain([config, 'access', _87 => _87.docs, 'access', _88 => _88.adapter, 'optionalAccess', _89 => _89.server]) || _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
2777
2829
|
return;
|
|
2778
2830
|
}
|
|
2779
2831
|
throw new Error(
|
|
@@ -2954,7 +3006,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2954
3006
|
);
|
|
2955
3007
|
}
|
|
2956
3008
|
}
|
|
2957
|
-
_optionalChain([sourceSnapshot, 'optionalAccess',
|
|
3009
|
+
_optionalChain([sourceSnapshot, 'optionalAccess', _90 => _90.clear, 'call', _91 => _91()]);
|
|
2958
3010
|
const ssrResult = ssrBuildResult.value;
|
|
2959
3011
|
const routeRuntimeManifest = routeRuntimeManifestResult.value;
|
|
2960
3012
|
const runtimeValidation = validateFarmRouteRuntimeDeployment(routeRuntimeManifest, preset);
|
|
@@ -2986,7 +3038,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2986
3038
|
configuredHeaderRoutes,
|
|
2987
3039
|
nitroBuilderResultPromise,
|
|
2988
3040
|
lifecyclePluginManager,
|
|
2989
|
-
_optionalChain([markdownPrecompile, 'optionalAccess',
|
|
3041
|
+
_optionalChain([markdownPrecompile, 'optionalAccess', _92 => _92.pages])
|
|
2990
3042
|
);
|
|
2991
3043
|
const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
|
|
2992
3044
|
_path2.default.join(root, distDir),
|
|
@@ -3007,8 +3059,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
3007
3059
|
_chunk7U4XF76Rcjs.logger.error(`\u274C Build failed: ${error}`);
|
|
3008
3060
|
throw error;
|
|
3009
3061
|
} finally {
|
|
3010
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
3011
|
-
_optionalChain([markdownPrecompile, 'optionalAccess',
|
|
3062
|
+
_optionalChain([rendererBuild, 'optionalAccess', _93 => _93.abort, 'call', _94 => _94()]);
|
|
3063
|
+
_optionalChain([markdownPrecompile, 'optionalAccess', _95 => _95.dispose, 'call', _96 => _96()]);
|
|
3012
3064
|
}
|
|
3013
3065
|
}
|
|
3014
3066
|
function collectFarmPrerenderedMarkdownBodies(pageRoutes) {
|
|
@@ -3031,7 +3083,7 @@ function varyFarmNitroCacheRules(rules, headerNames) {
|
|
|
3031
3083
|
if (headerNames.length === 0) return rules;
|
|
3032
3084
|
return Object.fromEntries(
|
|
3033
3085
|
Object.entries(rules).map(([source, rule]) => {
|
|
3034
|
-
const cached = _optionalChain([rule, 'optionalAccess',
|
|
3086
|
+
const cached = _optionalChain([rule, 'optionalAccess', _97 => _97.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _98 => _98.cache]) !== void 0 && rule.cache !== false;
|
|
3035
3087
|
if (!cached || rule.cache === false) return [source, rule];
|
|
3036
3088
|
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
3037
3089
|
const varies = [
|
|
@@ -3060,7 +3112,7 @@ async function writeFarmVideoPlayerToClient(outputDir) {
|
|
|
3060
3112
|
const filePath = _path2.default.join(outputDir, _chunkY3DO7BIJcjs.FARM_VIDEO_PLAYER_PATH.slice(1));
|
|
3061
3113
|
await fs5.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
3062
3114
|
try {
|
|
3063
|
-
await fs5.writeFile(filePath,
|
|
3115
|
+
await fs5.writeFile(filePath, _chunkH6C45DCFcjs.FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
|
|
3064
3116
|
} catch (error) {
|
|
3065
3117
|
if (error.code !== "EEXIST") throw error;
|
|
3066
3118
|
}
|
|
@@ -3094,7 +3146,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
3094
3146
|
}
|
|
3095
3147
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
3096
3148
|
await fs5.writeFile(fontCssPath, normalizedFontCss);
|
|
3097
|
-
await fs5.writeFile(clientCssPath,
|
|
3149
|
+
await fs5.writeFile(clientCssPath, _chunkH6C45DCFcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
3098
3150
|
}
|
|
3099
3151
|
function importsFarmClientBlockedPackage(id, packageName) {
|
|
3100
3152
|
return id === packageName || id.startsWith(`${packageName}/`);
|
|
@@ -3144,10 +3196,10 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3144
3196
|
}
|
|
3145
3197
|
}
|
|
3146
3198
|
function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, options = {}) {
|
|
3147
|
-
const key =
|
|
3199
|
+
const key = _chunkOYM6VJEFcjs.getClientModuleHydrationPlanKey.call(void 0, modulePath, root, mode, options);
|
|
3148
3200
|
let plan = cache.get(key);
|
|
3149
3201
|
if (!plan) {
|
|
3150
|
-
plan =
|
|
3202
|
+
plan = _chunkOYM6VJEFcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
3151
3203
|
cache.set(key, plan);
|
|
3152
3204
|
}
|
|
3153
3205
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -3176,25 +3228,25 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3176
3228
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
3177
3229
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
3178
3230
|
);
|
|
3179
|
-
if (_optionalChain([config, 'access',
|
|
3231
|
+
if (_optionalChain([config, 'access', _99 => _99.experimental, 'optionalAccess', _100 => _100.isolatedClientHydration]) === "enabled" && _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _101 => _101.experimental, 'optionalAccess', _102 => _102.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
3180
3232
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3181
3233
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
3182
3234
|
);
|
|
3183
3235
|
}
|
|
3184
|
-
const isolatedMode =
|
|
3185
|
-
_optionalChain([config, 'access',
|
|
3236
|
+
const isolatedMode = _chunkOYM6VJEFcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
3237
|
+
_optionalChain([config, 'access', _103 => _103.experimental, 'optionalAccess', _104 => _104.isolatedClientHydration]),
|
|
3186
3238
|
{
|
|
3187
|
-
serverComponents: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3239
|
+
serverComponents: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _105 => _105.experimental, 'optionalAccess', _106 => _106.serverComponents])) === "rsc",
|
|
3188
3240
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
3189
3241
|
}
|
|
3190
3242
|
);
|
|
3191
|
-
const planOptions =
|
|
3243
|
+
const planOptions = _chunkOYM6VJEFcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
3192
3244
|
config.renderer,
|
|
3193
3245
|
Boolean(unsupportedIntegrationProvider)
|
|
3194
3246
|
);
|
|
3195
3247
|
const pagePlanOptions = {
|
|
3196
3248
|
...planOptions,
|
|
3197
|
-
serverOwners: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3249
|
+
serverOwners: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _107 => _107.experimental, 'optionalAccess', _108 => _108.serverComponents])) === "islands"
|
|
3198
3250
|
};
|
|
3199
3251
|
const layoutPlanOptions = {
|
|
3200
3252
|
...planOptions,
|
|
@@ -3202,18 +3254,18 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3202
3254
|
};
|
|
3203
3255
|
const layoutAppliesToRoute = _chunk4B6YJ5DScjs.routeBoundaryCoversDirectory;
|
|
3204
3256
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
3205
|
-
const islandsMode = _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3257
|
+
const islandsMode = _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _109 => _109.experimental, 'optionalAccess', _110 => _110.serverComponents])) === "islands";
|
|
3206
3258
|
const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
|
|
3207
|
-
const docsEntries = _optionalChain([config, 'access',
|
|
3259
|
+
const docsEntries = _optionalChain([config, 'access', _111 => _111.docs, 'optionalAccess', _112 => _112.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
3208
3260
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
3209
3261
|
) : [];
|
|
3210
3262
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
3211
3263
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
3212
3264
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
3213
3265
|
);
|
|
3214
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
3266
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _113 => _113.docs, 'optionalAccess', _114 => _114.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
3215
3267
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
3216
|
-
const plan = (operation) => sourceSnapshot ?
|
|
3268
|
+
const plan = (operation) => sourceSnapshot ? _chunkOYM6VJEFcjs.withFarmSourceSnapshotOf.call(void 0, sourceSnapshot, operation) : _chunkOYM6VJEFcjs.withFarmSourceSnapshot.call(void 0, operation);
|
|
3217
3269
|
const { clientLayouts, clientRouteSlots } = plan(() => {
|
|
3218
3270
|
const clientLayouts2 = layoutRoutes.map((layout) => {
|
|
3219
3271
|
try {
|
|
@@ -3260,7 +3312,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3260
3312
|
};
|
|
3261
3313
|
}
|
|
3262
3314
|
});
|
|
3263
|
-
const markdownPagePlan =
|
|
3315
|
+
const markdownPagePlan = _chunkOYM6VJEFcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
3264
3316
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
3265
3317
|
root,
|
|
3266
3318
|
isolatedMode,
|
|
@@ -3276,7 +3328,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3276
3328
|
pagePlanOptions
|
|
3277
3329
|
)
|
|
3278
3330
|
}));
|
|
3279
|
-
|
|
3331
|
+
_chunkOYM6VJEFcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
3280
3332
|
clientLayouts2.map((layout) => ({
|
|
3281
3333
|
pattern: layout.pattern,
|
|
3282
3334
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -3310,7 +3362,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3310
3362
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
3311
3363
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
3312
3364
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3313
|
-
`\u26A0\uFE0F ${
|
|
3365
|
+
`\u26A0\uFE0F ${_chunkOYM6VJEFcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`
|
|
3314
3366
|
);
|
|
3315
3367
|
}
|
|
3316
3368
|
}
|
|
@@ -3345,7 +3397,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3345
3397
|
);
|
|
3346
3398
|
if (metadata.suppressedAsyncHydration) {
|
|
3347
3399
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3348
|
-
`\u26A0\uFE0F ${
|
|
3400
|
+
`\u26A0\uFE0F ${_chunkOYM6VJEFcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
3349
3401
|
);
|
|
3350
3402
|
}
|
|
3351
3403
|
const slotBoundaries = serverSlotPlans.filter(
|
|
@@ -3353,7 +3405,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3353
3405
|
).flatMap(({ plan: plan2 }) => plan2.isolatedBoundaries);
|
|
3354
3406
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
|
|
3355
3407
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
3356
|
-
const islandStrategy =
|
|
3408
|
+
const islandStrategy = _chunkH6C45DCFcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
3357
3409
|
route,
|
|
3358
3410
|
metadata,
|
|
3359
3411
|
clientLayouts2,
|
|
@@ -3372,7 +3424,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3372
3424
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
3373
3425
|
],
|
|
3374
3426
|
// The server renders a server tree only below a hydrating layout.
|
|
3375
|
-
...
|
|
3427
|
+
..._chunkOYM6VJEFcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
3376
3428
|
});
|
|
3377
3429
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
3378
3430
|
}
|
|
@@ -3409,7 +3461,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3409
3461
|
}
|
|
3410
3462
|
const clientRouteSlots2 = routeSlots.filter((slot) => {
|
|
3411
3463
|
try {
|
|
3412
|
-
const metadata =
|
|
3464
|
+
const metadata = _chunkOYM6VJEFcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
|
|
3413
3465
|
return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
|
|
3414
3466
|
} catch (error) {
|
|
3415
3467
|
_chunk7U4XF76Rcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
@@ -3453,7 +3505,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3453
3505
|
srcDir,
|
|
3454
3506
|
adapterOwnsDocsRuntime ? false : _chunkN3H7UPBMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
3455
3507
|
adapterOwnsDocsRuntime ? void 0 : _chunkN3H7UPBMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
3456
|
-
_optionalChain([config, 'access',
|
|
3508
|
+
_optionalChain([config, 'access', _115 => _115.docs, 'optionalAccess', _116 => _116.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
3457
3509
|
adapterOwnsDocsRuntime ? _chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter) : void 0,
|
|
3458
3510
|
config.i18n,
|
|
3459
3511
|
config.plugins,
|
|
@@ -3462,11 +3514,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3462
3514
|
config.trailingSlash,
|
|
3463
3515
|
_chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
3464
3516
|
config.basePath,
|
|
3465
|
-
|
|
3517
|
+
_chunkH6C45DCFcjs.generateClientCachePersistenceCode.call(void 0, _chunkH6C45DCFcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
3466
3518
|
adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
3467
|
-
_chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
3519
|
+
_chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _117 => _117.experimental, 'optionalAccess', _118 => _118.serverComponents])) === "islands",
|
|
3468
3520
|
platform,
|
|
3469
|
-
islandsMode ?
|
|
3521
|
+
islandsMode ? _chunkOYM6VJEFcjs.collectFarmServerStylesheets.call(void 0,
|
|
3470
3522
|
[
|
|
3471
3523
|
...layoutRoutes.map((layout) => layout.modulePath),
|
|
3472
3524
|
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
@@ -3490,7 +3542,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3490
3542
|
await fs5.writeFile(_path2.default.join(clientEntryDir, "farm-client-root.tsx"), clientEntry.root);
|
|
3491
3543
|
}
|
|
3492
3544
|
const clientInput = { [entryName]: clientEntryPath };
|
|
3493
|
-
if (platform === "web" &&
|
|
3545
|
+
if (platform === "web" && _chunkH6C45DCFcjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
3494
3546
|
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
3495
3547
|
await fs5.writeFile(
|
|
3496
3548
|
clientBootPath,
|
|
@@ -3532,11 +3584,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3532
3584
|
target: FARM_CLIENT_BUILD_TARGET,
|
|
3533
3585
|
// Tailwind CSS 4 already requires newer browsers than that baseline. An app's own
|
|
3534
3586
|
// `build.target` or `build.cssTarget` still decides, as Vite derives one from the other.
|
|
3535
|
-
..._optionalChain([config, 'access',
|
|
3587
|
+
..._optionalChain([config, 'access', _119 => _119.vite, 'optionalAccess', _120 => _120.build, 'optionalAccess', _121 => _121.target]) === void 0 && _optionalChain([config, 'access', _122 => _122.vite, 'optionalAccess', _123 => _123.build, 'optionalAccess', _124 => _124.cssTarget]) === void 0 && (_chunkDMSXZNQRcjs.includesTailwindVitePlugin.call(void 0, tailwindVitePlugin) || _chunkDMSXZNQRcjs.includesTailwindVitePlugin.call(void 0, _optionalChain([config, 'access', _125 => _125.vite, 'optionalAccess', _126 => _126.plugins]))) ? { cssTarget: _chunkDMSXZNQRcjs.TAILWIND_CSS_BROWSER_TARGET } : {},
|
|
3536
3588
|
outDir: outputDir,
|
|
3537
3589
|
emptyOutDir: platform === "web",
|
|
3538
3590
|
// Never public: see resolveFarmClientSourcemap.
|
|
3539
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
3591
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _127 => _127.vite, 'optionalAccess', _128 => _128.build, 'optionalAccess', _129 => _129.sourcemap])),
|
|
3540
3592
|
assetsInlineLimit: 0,
|
|
3541
3593
|
cssCodeSplit: false,
|
|
3542
3594
|
// Bundle all CSS into one file
|
|
@@ -3546,9 +3598,10 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3546
3598
|
entryFileNames: "[name]-h[hash].js",
|
|
3547
3599
|
chunkFileNames: "chunks/[name]-h[hash].js",
|
|
3548
3600
|
hashCharacters: "hex",
|
|
3601
|
+
...islandsMode && _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) && !configuresFarmClientChunks(config.vite) ? { codeSplitting: { groups: [createFarmIslandsReactChunkGroup()] } } : {},
|
|
3549
3602
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
3550
3603
|
assetFileNames: (assetInfo) => {
|
|
3551
|
-
if (_optionalChain([assetInfo, 'access',
|
|
3604
|
+
if (_optionalChain([assetInfo, 'access', _130 => _130.name, 'optionalAccess', _131 => _131.endsWith, 'call', _132 => _132(".css")])) {
|
|
3552
3605
|
return `${entryName}.css`;
|
|
3553
3606
|
}
|
|
3554
3607
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -3565,7 +3618,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3565
3618
|
}
|
|
3566
3619
|
},
|
|
3567
3620
|
plugins: [
|
|
3568
|
-
|
|
3621
|
+
_chunkH6C45DCFcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
3569
3622
|
createFarmPrivateClientSourcemapsPlugin({
|
|
3570
3623
|
outDir: _path2.default.join(
|
|
3571
3624
|
_path2.default.dirname(outputDir),
|
|
@@ -3594,6 +3647,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3594
3647
|
],
|
|
3595
3648
|
// What a call's result is handled with, imported on the first (RFC 0013).
|
|
3596
3649
|
actionImports: ["@farm.js/core/internal/islands-action-client"],
|
|
3650
|
+
// What a root rebuilds a server tree with, imported with the first (RFC
|
|
3651
|
+
// 0013). A build without server trees has no chunk for it.
|
|
3652
|
+
serverTreeImports: ["@farm.js/core/internal/islands-server-tree"],
|
|
3597
3653
|
rendererImporter: clientEntryPath
|
|
3598
3654
|
} : {}
|
|
3599
3655
|
}),
|
|
@@ -3614,7 +3670,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3614
3670
|
...config.vite.plugins || [],
|
|
3615
3671
|
farmServerOnlyEntriesPlugin({ platform, distDir: config.distDir || ".farm" }),
|
|
3616
3672
|
farmNavigationPlugin(config.renderer),
|
|
3617
|
-
|
|
3673
|
+
_chunkH6C45DCFcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
3618
3674
|
adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
3619
3675
|
),
|
|
3620
3676
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
@@ -3647,7 +3703,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3647
3703
|
},
|
|
3648
3704
|
load: {
|
|
3649
3705
|
filter: {
|
|
3650
|
-
id:
|
|
3706
|
+
id: _chunkH6C45DCFcjs.exactIdPattern.call(void 0, [
|
|
3651
3707
|
"\0empty-module",
|
|
3652
3708
|
"\0empty-api-route",
|
|
3653
3709
|
"\0farm-i18n-client-bridge",
|
|
@@ -3685,7 +3741,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3685
3741
|
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes, sourceSnapshot },
|
|
3686
3742
|
pluginManager
|
|
3687
3743
|
),
|
|
3688
|
-
|
|
3744
|
+
_chunkOYM6VJEFcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
3689
3745
|
],
|
|
3690
3746
|
mode: "production",
|
|
3691
3747
|
css: postcssSearchPath ? {
|
|
@@ -3693,7 +3749,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3693
3749
|
} : void 0,
|
|
3694
3750
|
// Ensure React is bundled for client
|
|
3695
3751
|
resolve: {
|
|
3696
|
-
alias:
|
|
3752
|
+
alias: _chunkH6C45DCFcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
3697
3753
|
dedupe: [...config.renderer.dedupe || []]
|
|
3698
3754
|
},
|
|
3699
3755
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -3707,7 +3763,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3707
3763
|
}
|
|
3708
3764
|
};
|
|
3709
3765
|
await viteBuild(
|
|
3710
|
-
|
|
3766
|
+
_chunkH6C45DCFcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite, { clientOutput: true })
|
|
3711
3767
|
);
|
|
3712
3768
|
if (platform === "mobile") {
|
|
3713
3769
|
await fs5.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
@@ -3801,9 +3857,9 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
3801
3857
|
return response;
|
|
3802
3858
|
}
|
|
3803
3859
|
|
|
3804
|
-
${streamNavigations ? `${
|
|
3860
|
+
${streamNavigations ? `${_chunkH6C45DCFcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
|
|
3805
3861
|
|
|
3806
|
-
${
|
|
3862
|
+
${_chunkH6C45DCFcjs.FARM_EARLY_NAVIGATION_SOURCE}` : ""}
|
|
3807
3863
|
|
|
3808
3864
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
3809
3865
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -4976,7 +5032,7 @@ function readFarmEntryImports(source) {
|
|
|
4976
5032
|
for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
|
|
4977
5033
|
const from = match[2];
|
|
4978
5034
|
const named = /\{([^}]*)\}/.exec(match[1]);
|
|
4979
|
-
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess',
|
|
5035
|
+
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _133 => _133[1], 'optionalAccess', _134 => _134.split, 'call', _135 => _135(",")]), () => ( []))) {
|
|
4980
5036
|
const [imported, local] = specifier.trim().split(/\s+as\s+/);
|
|
4981
5037
|
if (imported)
|
|
4982
5038
|
bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
|
|
@@ -5138,7 +5194,7 @@ import { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};
|
|
|
5138
5194
|
const React = { ...__farmRendererClient };`
|
|
5139
5195
|
);
|
|
5140
5196
|
const hydrateFarmRouteCall = _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);";
|
|
5141
|
-
const providerClientCode =
|
|
5197
|
+
const providerClientCode = _chunkH6C45DCFcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
5142
5198
|
integrationProviders,
|
|
5143
5199
|
root,
|
|
5144
5200
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -5272,7 +5328,7 @@ mountFarmDocsSearch();
|
|
|
5272
5328
|
|
|
5273
5329
|
${generateUniversalRouterStateRuntime()}
|
|
5274
5330
|
|
|
5275
|
-
${
|
|
5331
|
+
${_chunkH6C45DCFcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
5276
5332
|
|
|
5277
5333
|
// SPA Router for server-rendered pages (HTML swap)
|
|
5278
5334
|
const spaRouter = {
|
|
@@ -5812,7 +5868,7 @@ ${layoutRegistrations.join(",\n")}
|
|
|
5812
5868
|
${generateFarmClientRouteMatchSource({ lazyMatcher })}
|
|
5813
5869
|
|
|
5814
5870
|
${layoutComponentsRuntime}/*farm-root-start*/
|
|
5815
|
-
${
|
|
5871
|
+
${_chunkH6C45DCFcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
5816
5872
|
// Wrap a page element with applicable layouts
|
|
5817
5873
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
5818
5874
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -5847,7 +5903,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
5847
5903
|
return React.createElement("div", props, pageElement);
|
|
5848
5904
|
}
|
|
5849
5905
|
let farmLastRouteState = null;
|
|
5850
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
5906
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkH6C45DCFcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
5851
5907
|
function farmTreeLayoutsOf(pathname) {
|
|
5852
5908
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
5853
5909
|
return layout.serverTree === true;
|
|
@@ -6481,7 +6537,7 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
|
|
|
6481
6537
|
return true;
|
|
6482
6538
|
}` : ""}
|
|
6483
6539
|
|
|
6484
|
-
${
|
|
6540
|
+
${_chunkH6C45DCFcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
6485
6541
|
|
|
6486
6542
|
function activateNavigationScripts(root) {
|
|
6487
6543
|
for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
|
|
@@ -6587,7 +6643,7 @@ function getLayoutShell(root, patterns, index) {
|
|
|
6587
6643
|
return shell.innerHTML;
|
|
6588
6644
|
}
|
|
6589
6645
|
|
|
6590
|
-
${islandValues ?
|
|
6646
|
+
${islandValues ? _chunkH6C45DCFcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
6591
6647
|
// A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
|
|
6592
6648
|
if (refresh) revealFarmStreamedContent(nextRoot);
|
|
6593
6649
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
@@ -7394,7 +7450,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7394
7450
|
}))
|
|
7395
7451
|
);
|
|
7396
7452
|
const instrumentationPath = _chunk3BTN3NP7cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
7397
|
-
const notFoundPath =
|
|
7453
|
+
const notFoundPath = _chunkH6C45DCFcjs.resolveFarmNotFoundComponentPath.call(void 0,
|
|
7398
7454
|
config,
|
|
7399
7455
|
appDirs,
|
|
7400
7456
|
routeManager.getRendererNotFoundPath()
|
|
@@ -7419,9 +7475,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7419
7475
|
(provider) => provider.component || provider.type === "clerk"
|
|
7420
7476
|
);
|
|
7421
7477
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
7422
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
7478
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _136 => _136.mdx, 'optionalAccess', _137 => _137.components]));
|
|
7423
7479
|
const hasMiddlewareConfig = _chunk4B6YJ5DScjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
7424
|
-
const hasRouteContextConfig =
|
|
7480
|
+
const hasRouteContextConfig = _chunkBBX4RPOVcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
7425
7481
|
const hasServerRuntimePlugins = _chunkDMSXZNQRcjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
|
|
7426
7482
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
7427
7483
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -7433,7 +7489,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7433
7489
|
);
|
|
7434
7490
|
if (_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
7435
7491
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
7436
|
-
|
|
7492
|
+
_chunkHKJIUZS5cjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
7437
7493
|
config.docs,
|
|
7438
7494
|
{ root, srcDir: config.srcDir },
|
|
7439
7495
|
(pathname) => adapterGuardedPaths.has(pathname),
|
|
@@ -7441,9 +7497,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7441
7497
|
);
|
|
7442
7498
|
}
|
|
7443
7499
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
7444
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
7500
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunk2RSVYJT6cjs._runWithFarmCspNonce.call(void 0,
|
|
7445
7501
|
farmDocsCspNonceMarker,
|
|
7446
|
-
async () => _optionalChain([config, 'access',
|
|
7502
|
+
async () => _optionalChain([config, 'access', _140 => _140.docs, 'access', _141 => _141.adapter, 'optionalAccess', _142 => _142.server]) ? await _chunkHKJIUZS5cjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
7447
7503
|
root,
|
|
7448
7504
|
srcDir: config.srcDir,
|
|
7449
7505
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -7557,7 +7613,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7557
7613
|
// Adapters can render provider scripts by serializing function source.
|
|
7558
7614
|
// keepNames injects helper calls into those functions; after Nitro
|
|
7559
7615
|
// minifies the server chunk the helper is no longer in script scope.
|
|
7560
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
7616
|
+
keepNames: !(_optionalChain([config, 'access', _143 => _143.docs, 'optionalAccess', _144 => _144.enabled]) && _optionalChain([config, 'access', _145 => _145.docs, 'access', _146 => _146.adapter, 'optionalAccess', _147 => _147.server])),
|
|
7561
7617
|
jsxDev: false
|
|
7562
7618
|
},
|
|
7563
7619
|
// SSR configuration to externalize problematic modules
|
|
@@ -7607,10 +7663,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7607
7663
|
define: {
|
|
7608
7664
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
7609
7665
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
7610
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
7666
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _148 => _148.env, 'optionalAccess', _149 => _149.public]) || {})
|
|
7611
7667
|
},
|
|
7612
7668
|
plugins: [
|
|
7613
|
-
|
|
7669
|
+
_chunkH6C45DCFcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
7614
7670
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
7615
7671
|
...rendererVitePlugins,
|
|
7616
7672
|
...config.vite.plugins || [],
|
|
@@ -7642,7 +7698,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7642
7698
|
},
|
|
7643
7699
|
pluginManager
|
|
7644
7700
|
),
|
|
7645
|
-
|
|
7701
|
+
_chunkOYM6VJEFcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
7646
7702
|
...hasRuntimeConfigModule ? [
|
|
7647
7703
|
farmStripPlatformConfigPlugin(
|
|
7648
7704
|
[
|
|
@@ -7654,7 +7710,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7654
7710
|
{
|
|
7655
7711
|
name: "farm-virtual-ssr-entry",
|
|
7656
7712
|
resolveId: {
|
|
7657
|
-
filter: { id:
|
|
7713
|
+
filter: { id: _chunkH6C45DCFcjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
|
|
7658
7714
|
handler(id) {
|
|
7659
7715
|
if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
|
|
7660
7716
|
return virtualEntryId;
|
|
@@ -7663,7 +7719,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7663
7719
|
}
|
|
7664
7720
|
},
|
|
7665
7721
|
load: {
|
|
7666
|
-
filter: { id:
|
|
7722
|
+
filter: { id: _chunkH6C45DCFcjs.exactIdPattern.call(void 0, [virtualEntryId]) },
|
|
7667
7723
|
handler(id) {
|
|
7668
7724
|
if (id === virtualEntryId) {
|
|
7669
7725
|
return virtualEntryCode;
|
|
@@ -7695,7 +7751,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7695
7751
|
resolve: {
|
|
7696
7752
|
alias: [
|
|
7697
7753
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
7698
|
-
...Object.entries(
|
|
7754
|
+
...Object.entries(_chunkH6C45DCFcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
7699
7755
|
([find, replacement]) => ({ find, replacement })
|
|
7700
7756
|
)
|
|
7701
7757
|
],
|
|
@@ -7703,7 +7759,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7703
7759
|
dedupe: [...config.renderer.dedupe || []]
|
|
7704
7760
|
}
|
|
7705
7761
|
};
|
|
7706
|
-
await viteBuild(
|
|
7762
|
+
await viteBuild(_chunkH6C45DCFcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
7707
7763
|
} finally {
|
|
7708
7764
|
if (postcssConfigDir) {
|
|
7709
7765
|
try {
|
|
@@ -7739,7 +7795,7 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
7739
7795
|
return lastModified;
|
|
7740
7796
|
}
|
|
7741
7797
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
7742
|
-
if (!_optionalChain([config, 'access',
|
|
7798
|
+
if (!_optionalChain([config, 'access', _150 => _150.docs, 'optionalAccess', _151 => _151.enabled])) return [];
|
|
7743
7799
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
7744
7800
|
const guards = {
|
|
7745
7801
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
@@ -7750,15 +7806,15 @@ function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
|
7750
7806
|
).flatMap((page) => [page.href, _chunkHR5GU4UUcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunk4B6YJ5DScjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
7751
7807
|
}
|
|
7752
7808
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
7753
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
7809
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _152 => _152.llmsTxt]);
|
|
7754
7810
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
7755
7811
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
7756
7812
|
);
|
|
7757
7813
|
return [
|
|
7758
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
7759
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
7760
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
7761
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
7814
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _153 => _153.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
7815
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _154 => _154.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
7816
|
+
..._optionalChain([agent, 'optionalAccess', _155 => _155.sitemap, 'optionalAccess', _156 => _156.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
7817
|
+
..._optionalChain([agent, 'optionalAccess', _157 => _157.crawlers, 'optionalAccess', _158 => _158.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
7762
7818
|
];
|
|
7763
7819
|
}
|
|
7764
7820
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -7769,7 +7825,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
7769
7825
|
docsPath: ${root}.entry,
|
|
7770
7826
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
7771
7827
|
}`;
|
|
7772
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
7828
|
+
if (_optionalChain([docs, 'optionalAccess', _159 => _159.roots, 'optionalAccess', _160 => _160.length])) {
|
|
7773
7829
|
return {
|
|
7774
7830
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
7775
7831
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -7782,7 +7838,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
7782
7838
|
}
|
|
7783
7839
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
7784
7840
|
if (!docs.enabled) return "null";
|
|
7785
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
7841
|
+
const serializableDocs = _optionalChain([docs, 'access', _161 => _161.roots, 'optionalAccess', _162 => _162.length]) ? {
|
|
7786
7842
|
...docs,
|
|
7787
7843
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
7788
7844
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -7816,7 +7872,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
7816
7872
|
},
|
|
7817
7873
|
}
|
|
7818
7874
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
7819
|
-
if (!_optionalChain([docs, 'access',
|
|
7875
|
+
if (!_optionalChain([docs, 'access', _163 => _163.roots, 'optionalAccess', _164 => _164.length])) return expression;
|
|
7820
7876
|
return `((farmDocs) => ({
|
|
7821
7877
|
...farmDocs,
|
|
7822
7878
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -7833,7 +7889,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
7833
7889
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
7834
7890
|
}
|
|
7835
7891
|
function generateNativeAuthIntegrationSource(auth) {
|
|
7836
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
7892
|
+
if (_optionalChain([auth, 'optionalAccess', _165 => _165.enabled]) !== true) {
|
|
7837
7893
|
return { importSource: "", registerSource: "" };
|
|
7838
7894
|
}
|
|
7839
7895
|
return {
|
|
@@ -8152,26 +8208,26 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
8152
8208
|
(route) => route.searchPreserve ? [route.searchPreserve] : []
|
|
8153
8209
|
);
|
|
8154
8210
|
const searchPreserveRoutesSource = searchPreserveRoutes.length > 0 ? JSON.stringify(searchPreserveRoutes) : "";
|
|
8155
|
-
const farmIslandsMode = _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
8156
|
-
const farmRendererActions =
|
|
8157
|
-
const farmClientBoot =
|
|
8211
|
+
const farmIslandsMode = _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _166 => _166.experimental, 'optionalAccess', _167 => _167.serverComponents])) === "islands";
|
|
8212
|
+
const farmRendererActions = _chunkH6C45DCFcjs.resolveFarmIslxActionsMode.call(void 0, config) === "renderer";
|
|
8213
|
+
const farmClientBoot = _chunkH6C45DCFcjs.canBootFarmIslandsClient.call(void 0, config);
|
|
8158
8214
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
8159
8215
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
8160
8216
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "edge";
|
|
8161
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
8217
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _168 => _168.agent, 'optionalAccess', _169 => _169.crawlers, 'optionalAccess', _170 => _170.enabled])) && !applicationMetadataRoutes.some(
|
|
8162
8218
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
8163
8219
|
);
|
|
8164
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
8220
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _171 => _171.agent, 'optionalAccess', _172 => _172.sitemap, 'optionalAccess', _173 => _173.enabled])) && !applicationMetadataRoutes.some(
|
|
8165
8221
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
8166
8222
|
);
|
|
8167
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
8168
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
8223
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _174 => _174.agent, 'optionalAccess', _175 => _175.mcp]) === true && !_chunkW53Z4WDIcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
8224
|
+
const servesAiCatalog = _optionalChain([config, 'access', _176 => _176.agent, 'optionalAccess', _177 => _177.aiCatalog]) !== false;
|
|
8169
8225
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
8170
8226
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
8171
|
-
const reportsWebMCPCalls = hasInfraAnalyticsRuntime &&
|
|
8227
|
+
const reportsWebMCPCalls = hasInfraAnalyticsRuntime && _chunkRVJQHQCGcjs._farmWebMCPReportsEnabled.call(void 0, config.plugins);
|
|
8172
8228
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
8173
8229
|
const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
|
|
8174
|
-
if (_optionalChain([config, 'access',
|
|
8230
|
+
if (_optionalChain([config, 'access', _178 => _178.docs, 'optionalAccess', _179 => _179.enabled]) && _optionalChain([config, 'access', _180 => _180.docs, 'access', _181 => _181.roots, 'optionalAccess', _182 => _182.length]) && !adapterOwnsDocsRuntime) {
|
|
8175
8231
|
throw new Error(
|
|
8176
8232
|
"Several docs roots need a docs adapter; Farm's built-in docs renderer serves a single docs root."
|
|
8177
8233
|
);
|
|
@@ -8244,7 +8300,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8244
8300
|
);
|
|
8245
8301
|
const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
|
|
8246
8302
|
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunk4B6YJ5DScjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
8247
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
8303
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _183 => _183.docs, 'optionalAccess', _184 => _184.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
8248
8304
|
const integrationProviders = _chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
8249
8305
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
8250
8306
|
(provider) => provider.component || provider.type === "clerk"
|
|
@@ -8254,16 +8310,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8254
8310
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
8255
8311
|
);
|
|
8256
8312
|
}
|
|
8257
|
-
const providerServerModules =
|
|
8313
|
+
const providerServerModules = _chunkH6C45DCFcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
8258
8314
|
renderedIntegrationProviders,
|
|
8259
8315
|
config.root,
|
|
8260
8316
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
8261
8317
|
);
|
|
8262
8318
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
8263
8319
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
8264
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
8320
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _185 => _185.providers]);
|
|
8265
8321
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
8266
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
8322
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _186 => _186.component]) === "function")) {
|
|
8267
8323
|
throw new Error(
|
|
8268
8324
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
8269
8325
|
);
|
|
@@ -8274,22 +8330,22 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8274
8330
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
8275
8331
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
8276
8332
|
);
|
|
8277
|
-
const isolatedHydrationMode =
|
|
8278
|
-
_optionalChain([config, 'access',
|
|
8333
|
+
const isolatedHydrationMode = _chunkOYM6VJEFcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
8334
|
+
_optionalChain([config, 'access', _187 => _187.experimental, 'optionalAccess', _188 => _188.isolatedClientHydration]),
|
|
8279
8335
|
{
|
|
8280
|
-
serverComponents: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
8336
|
+
serverComponents: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _189 => _189.experimental, 'optionalAccess', _190 => _190.serverComponents])) === "rsc",
|
|
8281
8337
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
8282
8338
|
}
|
|
8283
8339
|
);
|
|
8284
|
-
const hydrationPlanOptions =
|
|
8340
|
+
const hydrationPlanOptions = _chunkOYM6VJEFcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
8285
8341
|
config.renderer,
|
|
8286
8342
|
Boolean(unsupportedIntegrationProvider)
|
|
8287
8343
|
);
|
|
8288
8344
|
const pageHydrationPlanOptions = {
|
|
8289
8345
|
...hydrationPlanOptions,
|
|
8290
|
-
serverOwners: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
8346
|
+
serverOwners: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _191 => _191.experimental, 'optionalAccess', _192 => _192.serverComponents])) === "islands"
|
|
8291
8347
|
};
|
|
8292
|
-
const { layoutHydrationPlans, pageHydrationPlans } =
|
|
8348
|
+
const { layoutHydrationPlans, pageHydrationPlans } = _chunkOYM6VJEFcjs.withFarmSourceSnapshot.call(void 0, () => {
|
|
8293
8349
|
const layoutHydrationPlans2 = layoutRoutes.map((layout) => ({
|
|
8294
8350
|
...layout,
|
|
8295
8351
|
hydration: getCachedClientModuleHydrationPlan(
|
|
@@ -8300,7 +8356,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8300
8356
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
8301
8357
|
)
|
|
8302
8358
|
}));
|
|
8303
|
-
const markdownPagePlan =
|
|
8359
|
+
const markdownPagePlan = _chunkOYM6VJEFcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
8304
8360
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
8305
8361
|
config.root,
|
|
8306
8362
|
isolatedHydrationMode,
|
|
@@ -8320,7 +8376,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8320
8376
|
);
|
|
8321
8377
|
return { layoutHydrationPlans: layoutHydrationPlans2, pageHydrationPlans: pageHydrationPlans2 };
|
|
8322
8378
|
});
|
|
8323
|
-
|
|
8379
|
+
_chunkOYM6VJEFcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
8324
8380
|
layoutHydrationPlans.map((layout) => ({
|
|
8325
8381
|
pattern: layout.pattern,
|
|
8326
8382
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -8350,7 +8406,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8350
8406
|
apiRegistrations.push(`
|
|
8351
8407
|
{
|
|
8352
8408
|
path: ${JSON.stringify(route.path)},
|
|
8353
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
8409
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _193 => _193.pluginMethods, 'optionalAccess', _194 => _194.includes, 'call', _195 => _195(method)])))},
|
|
8354
8410
|
endpoints: ${varName},
|
|
8355
8411
|
}`);
|
|
8356
8412
|
});
|
|
@@ -8365,7 +8421,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8365
8421
|
const varName = `pageRoute${index}`;
|
|
8366
8422
|
if (_chunk26WP75W5cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
8367
8423
|
const renderingDirective2 = _chunkL3BSHASBcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
8368
|
-
const markdownServerTree = pageHydrationPlanOptions.serverOwners &&
|
|
8424
|
+
const markdownServerTree = pageHydrationPlanOptions.serverOwners && _chunkOYM6VJEFcjs.usesFarmServerTree.call(void 0, pageHydrationPlans.get(route.modulePath));
|
|
8369
8425
|
pageRegistrations.push(`
|
|
8370
8426
|
{
|
|
8371
8427
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -8373,14 +8429,14 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8373
8429
|
rendering: ${JSON.stringify(renderingDirective2)},` : ""}${markdownServerTree ? "\n serverTree: true," : ""}
|
|
8374
8430
|
module: createFarmMarkdownRouteModule({
|
|
8375
8431
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
8376
|
-
filePath: ${JSON.stringify(
|
|
8432
|
+
filePath: ${JSON.stringify(_chunkH6C45DCFcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.modulePath))},
|
|
8377
8433
|
components: farmMdxComponents,
|
|
8378
8434
|
config: farmMdxConfig,${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: React,"}
|
|
8379
8435
|
}),
|
|
8380
8436
|
markdownSource: {
|
|
8381
8437
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
8382
8438
|
filePath: ${JSON.stringify(
|
|
8383
|
-
|
|
8439
|
+
_chunkH6C45DCFcjs.toBakedMarkdownSourcePath.call(void 0, config.root, _nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath)))
|
|
8384
8440
|
)},
|
|
8385
8441
|
},
|
|
8386
8442
|
}`);
|
|
@@ -8398,8 +8454,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8398
8454
|
module: ${varName},
|
|
8399
8455
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
8400
8456
|
clientModule: ${JSON.stringify(_chunk7U4XF76Rcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
8401
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
8402
|
-
const rootStrategy =
|
|
8457
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkOYM6VJEFcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
8458
|
+
const rootStrategy = _chunkH6C45DCFcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
8403
8459
|
route,
|
|
8404
8460
|
clientMetadata,
|
|
8405
8461
|
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
@@ -8412,7 +8468,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8412
8468
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
8413
8469
|
${route.source !== void 0 ? `markdownSource: {
|
|
8414
8470
|
source: ${JSON.stringify(route.source)},
|
|
8415
|
-
filePath: ${JSON.stringify(
|
|
8471
|
+
filePath: ${JSON.stringify(_chunkH6C45DCFcjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.markdownSourcePath))},
|
|
8416
8472
|
},` : ""}
|
|
8417
8473
|
}`);
|
|
8418
8474
|
});
|
|
@@ -8436,7 +8492,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8436
8492
|
pattern: ${JSON.stringify(layout.pattern)},
|
|
8437
8493
|
module: ${varName},
|
|
8438
8494
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},
|
|
8439
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode &&
|
|
8495
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode && _chunkH6C45DCFcjs.canFarmSkipKeptLayoutRender.call(void 0, layout.modulePath, config.root) ? "\n skipKeptRender: true," : ""}${// A layout whose client components hydrate as islands of their own (islands mode,
|
|
8440
8496
|
// isolatedClientHydration, or an async layout): it wraps a docs page as an app page.
|
|
8441
8497
|
clientMetadata.hasIsolatedClientBoundaries ? "\n islands: true," : ""}
|
|
8442
8498
|
}`);
|
|
@@ -8464,7 +8520,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8464
8520
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
8465
8521
|
interception: ${JSON.stringify(slot.interception)},
|
|
8466
8522
|
fallback: ${JSON.stringify(slot.fallback)},
|
|
8467
|
-
hydrates: ${!farmIslandsMode ||
|
|
8523
|
+
hydrates: ${!farmIslandsMode || _chunkOYM6VJEFcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
|
|
8468
8524
|
module: ${varName},
|
|
8469
8525
|
}`);
|
|
8470
8526
|
});
|
|
@@ -8510,7 +8566,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8510
8566
|
metadataImageImports.push(
|
|
8511
8567
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(image.modulePath)};`
|
|
8512
8568
|
);
|
|
8513
|
-
const component = !_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) &&
|
|
8569
|
+
const component = !_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) && _chunkH6C45DCFcjs.isRendererCompiledComponent.call(void 0, image.modulePath, _nullishCoalesce(_optionalChain([config, 'access', _196 => _196.renderer, 'optionalAccess', _197 => _197.componentExtensions]), () => ( [])));
|
|
8514
8570
|
metadataImageRegistrations.push(`
|
|
8515
8571
|
{
|
|
8516
8572
|
pattern: ${JSON.stringify(image.pattern)},
|
|
@@ -8586,7 +8642,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8586
8642
|
createDefaultErrorMarkup,
|
|
8587
8643
|
createFarmInstrumentationLifecycle,
|
|
8588
8644
|
createFarmLayoutSelector,
|
|
8589
|
-
createFarmLayoutBoundary,${_optionalChain([config, 'access',
|
|
8645
|
+
createFarmLayoutBoundary,${_optionalChain([config, 'access', _198 => _198.docs, 'optionalAccess', _199 => _199.enabled]) ? "\n createFarmDocsLayoutTree,\n farmDocsLayoutsWrapPage,\n placeFarmDocsLayoutRoot," : ""}
|
|
8590
8646
|
isInFarmRouteGroupScope,
|
|
8591
8647
|
routeBoundaryCoversDirectory,
|
|
8592
8648
|
createFarmCacheKey,
|
|
@@ -8670,7 +8726,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8670
8726
|
createFarmDeploymentMismatchResponse,
|
|
8671
8727
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
8672
8728
|
getFarmDeploymentMismatch,
|
|
8673
|
-
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access',
|
|
8729
|
+
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access', _200 => _200.md, 'optionalAccess', _201 => _201.enabled]) || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}${searchPreserveRoutesSource ? "\n _setFarmSearchPreserveRoutes," : ""}
|
|
8674
8730
|
} from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
|
|
8675
8731
|
import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
|
|
8676
8732
|
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
@@ -8742,25 +8798,25 @@ function farmFormStateScript() { return ""; }`}`;
|
|
|
8742
8798
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
8743
8799
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
8744
8800
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
8745
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
8801
|
+
const docsHandlerImport = _optionalChain([config, 'access', _202 => _202.docs, 'optionalAccess', _203 => _203.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
8746
8802
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
8747
8803
|
const pathname = typeof requestOrPathname === "string"
|
|
8748
8804
|
? requestOrPathname
|
|
8749
8805
|
: new URL(requestOrPathname.url).pathname;
|
|
8750
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
8806
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _204 => _204.apiPath]) || "/api/docs")};
|
|
8751
8807
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
8752
8808
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
8753
|
-
import { ${_optionalChain([config, 'access',
|
|
8809
|
+
import { ${_optionalChain([config, 'access', _205 => _205.docs, 'access', _206 => _206.roots, 'optionalAccess', _207 => _207.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
8754
8810
|
import * as FarmDocsAdapterUI from ${JSON.stringify(_chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter))};${docsConfigModulePath ? `
|
|
8755
8811
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
8756
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
8757
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
8812
|
+
const docsFontImport = _optionalChain([config, 'access', _208 => _208.docs, 'optionalAccess', _209 => _209.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
8813
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _210 => _210.docs, 'optionalAccess', _211 => _211.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
8758
8814
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
8759
8815
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
8760
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
8816
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _212 => _212.md, 'optionalAccess', _213 => _213.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
8761
8817
|
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;";
|
|
8762
8818
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
8763
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
8819
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _214 => _214.mdx, 'optionalAccess', _215 => _215.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
8764
8820
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
8765
8821
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
8766
8822
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -8780,14 +8836,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
8780
8836
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
8781
8837
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
8782
8838
|
const mobileSession = (config.plugins || []).some(
|
|
8783
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
8839
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _216 => _216.name]) === _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN
|
|
8784
8840
|
);
|
|
8785
8841
|
const nativeServerFns = (config.plugins || []).some(
|
|
8786
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
8787
|
-
) ?
|
|
8842
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _217 => _217.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
|
|
8843
|
+
) ? _chunkQUHDVJMRcjs.collectFarmNativeServerFns.call(void 0, {
|
|
8788
8844
|
root: config.root,
|
|
8789
8845
|
srcDir: config.srcDir,
|
|
8790
|
-
entries:
|
|
8846
|
+
entries: _chunkQUHDVJMRcjs.findFarmNativeScreenFiles.call(void 0, _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config))
|
|
8791
8847
|
}) : void 0;
|
|
8792
8848
|
const integrationImports = `
|
|
8793
8849
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -8802,7 +8858,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
|
|
|
8802
8858
|
${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
|
|
8803
8859
|
});` : ""}
|
|
8804
8860
|
`;
|
|
8805
|
-
const imageRuntime =
|
|
8861
|
+
const imageRuntime = _chunkH6C45DCFcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
8806
8862
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
8807
8863
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
8808
8864
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -8984,7 +9040,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
8984
9040
|
|
|
8985
9041
|
function renderFarmDefault404Page() {
|
|
8986
9042
|
return React.createElement(React.Fragment, null,
|
|
8987
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
9043
|
+
React.createElement("style", null, ${JSON.stringify(_chunkH6C45DCFcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
8988
9044
|
React.createElement("main", {
|
|
8989
9045
|
className: "farm-default-not-found",
|
|
8990
9046
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -9140,24 +9196,24 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
9140
9196
|
validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
|
|
9141
9197
|
onError(error) { console.error("[Farm Image]", error); },
|
|
9142
9198
|
})`};
|
|
9143
|
-
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access',
|
|
9199
|
+
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access', _218 => _218.md, 'optionalAccess', _219 => _219.enabled]) || hasMarkdownPages ? config.trailingSlash ? `
|
|
9144
9200
|
// A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
|
|
9145
9201
|
// ('/about/'), so the trailing-slash 308 never answers in its place.
|
|
9146
9202
|
const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
|
|
9147
9203
|
const toFarmMarkdownPageRequest = (request) => request;` : ""}
|
|
9148
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
9149
|
-
${_optionalChain([config, 'access',
|
|
9204
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _220 => _220.agent, 'optionalAccess', _221 => _221.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
9205
|
+
${_optionalChain([config, 'access', _222 => _222.agent, 'optionalAccess', _223 => _223.llmsTxt, 'optionalAccess', _224 => _224.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
9150
9206
|
const farmMdxConfig = ${JSON.stringify({
|
|
9151
9207
|
...config.mdx,
|
|
9152
|
-
components: typeof _optionalChain([config, 'access',
|
|
9208
|
+
components: typeof _optionalChain([config, 'access', _225 => _225.mdx, 'optionalAccess', _226 => _226.components]) === "string" ? config.mdx.components : void 0
|
|
9153
9209
|
})};
|
|
9154
9210
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
9155
|
-
${_optionalChain([config, 'access',
|
|
9211
|
+
${_optionalChain([config, 'access', _227 => _227.agent, 'optionalAccess', _228 => _228.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
9156
9212
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
9157
9213
|
// to the build.
|
|
9158
9214
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
9159
9215
|
globalThis.process?.env,
|
|
9160
|
-
${JSON.stringify(
|
|
9216
|
+
${JSON.stringify(_chunkBZN5HX7Ycjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
|
|
9161
9217
|
);` : ""}
|
|
9162
9218
|
const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
|
|
9163
9219
|
const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
|
|
@@ -9203,7 +9259,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
9203
9259
|
});
|
|
9204
9260
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
9205
9261
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
9206
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
9262
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _229 => _229.docs, 'optionalAccess', _230 => _230.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
9207
9263
|
try {
|
|
9208
9264
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
9209
9265
|
const candidates = [
|
|
@@ -9215,7 +9271,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _224 => _2
|
|
|
9215
9271
|
} catch {
|
|
9216
9272
|
return null;
|
|
9217
9273
|
}
|
|
9218
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
9274
|
+
})()` : "null"};${_optionalChain([config, 'access', _231 => _231.docs, 'optionalAccess', _232 => _232.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _233 => _233.docs, 'access', _234 => _234.roots, 'optionalAccess', _235 => _235.length]) ? `
|
|
9219
9275
|
const farmDocsBundledRootsDir = (() => {
|
|
9220
9276
|
try {
|
|
9221
9277
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -9269,7 +9325,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
9269
9325
|
: undefined;
|
|
9270
9326
|
${adapterOwnsDocsRuntime && !hasPrecompiledDocs ? `// The renderer contract's server exports, for a docs UI that builds its pages with them.
|
|
9271
9327
|
const farmDocsAppRenderer = ${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? '{ name: "react", createElement: React.createElement, Fragment: React.Fragment, renderToString: ReactDOMServer.renderToString }' : "__farmRendererServer"};
|
|
9272
|
-
` : ""}const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
9328
|
+
` : ""}const farmDocsHandler = ${_optionalChain([config, 'access', _236 => _236.docs, 'optionalAccess', _237 => _237.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
9273
9329
|
rootDir: farmDocsRuntimeRoot,
|
|
9274
9330
|
// A production build's content cannot change, so the adapter reads its
|
|
9275
9331
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -9293,7 +9349,7 @@ const farmDocsAppRenderer = ${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, con
|
|
|
9293
9349
|
registerMCPServer: registerFarmMCPServer,
|
|
9294
9350
|
// A page built with this keeps its HTML string, so the preload budget and the response
|
|
9295
9351
|
// writer use it instead of reading and re-encoding the body. Older adapters ignore it.
|
|
9296
|
-
createHtmlResponse: farmOwnedHtmlResponse,${
|
|
9352
|
+
createHtmlResponse: farmOwnedHtmlResponse,${_chunkHKJIUZS5cjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
|
|
9297
9353
|
// The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
|
|
9298
9354
|
// asks about any path its own content lists, so the guards decide here, not a page list.
|
|
9299
9355
|
isPathGuarded: (pathname) =>
|
|
@@ -9319,7 +9375,7 @@ const farmDocsAppRenderer = ${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, con
|
|
|
9319
9375
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
9320
9376
|
basePath: ${JSON.stringify(config.basePath)},
|
|
9321
9377
|
})` : "null"};
|
|
9322
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
9378
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _238 => _238.docs, 'optionalAccess', _239 => _239.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
|
|
9323
9379
|
|
|
9324
9380
|
// API routes bundled at build time
|
|
9325
9381
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -9354,12 +9410,12 @@ const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
|
|
|
9354
9410
|
// runtime request.
|
|
9355
9411
|
const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
|
|
9356
9412
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
9357
|
-
${_optionalChain([config, 'access',
|
|
9358
|
-
` : ""}${_optionalChain([config, 'access',
|
|
9359
|
-
|
|
9413
|
+
${_optionalChain([config, 'access', _240 => _240.agent, 'optionalAccess', _241 => _241.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkTOUC6BR3cjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
9414
|
+
` : ""}${_optionalChain([config, 'access', _242 => _242.agent, 'optionalAccess', _243 => _243.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
9415
|
+
_chunkTOUC6BR3cjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
9360
9416
|
build: config.deploymentId,
|
|
9361
|
-
packages:
|
|
9362
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
9417
|
+
packages: _chunkH6C45DCFcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
9418
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkH6C45DCFcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
9363
9419
|
})
|
|
9364
9420
|
)};
|
|
9365
9421
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -9372,7 +9428,7 @@ farmAppManifestInput.guardCoversPath = (path) =>
|
|
|
9372
9428
|
path,
|
|
9373
9429
|
farmLocalAPIBasePath,
|
|
9374
9430
|
);
|
|
9375
|
-
${_optionalChain([config, 'access',
|
|
9431
|
+
${_optionalChain([config, 'access', _244 => _244.docs, 'optionalAccess', _245 => _245.enabled]) ? `// A docs runtime's MCP server lists its tools when asked over MCP, in process. A build
|
|
9376
9432
|
// can't change them, so they are read once.
|
|
9377
9433
|
if (farmDocsHandler) {
|
|
9378
9434
|
farmAppManifestInput.registeredMCP = (request) =>
|
|
@@ -10371,6 +10427,8 @@ const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r
|
|
|
10371
10427
|
// A server action reference in a document's markup: an action in an island's or a client
|
|
10372
10428
|
// component's props (islx's \`{"$":"a",...}\`), or a server form posting one (its \`$F_REF_\` field).
|
|
10373
10429
|
const FARM_ACTION_REFERENCE_PATTERN = /"\\$":"a"|name="\\$F_REF_/;
|
|
10430
|
+
// A server tree in a document's markup: the payload a page or layout root rebuilds from.
|
|
10431
|
+
const FARM_SERVER_TREE_PATTERN = /<script type="f\\/tree"/;
|
|
10374
10432
|
|
|
10375
10433
|
function renderFarmClientModulePreload(index) {
|
|
10376
10434
|
return '\\n <link rel="modulepreload" href="/' +
|
|
@@ -10410,6 +10468,14 @@ function collectFarmClientActionModules(markup, listed) {
|
|
|
10410
10468
|
return actions.filter((index) => !listed.has(index) && listed.add(index));
|
|
10411
10469
|
}
|
|
10412
10470
|
|
|
10471
|
+
// The manifest indexes of islands mode's server trees (RFC 0013), for a document whose markup holds
|
|
10472
|
+
// one, leaving out those already listed. The islands runtime imports them with the first otherwise.
|
|
10473
|
+
function collectFarmClientServerTreeModules(markup, listed) {
|
|
10474
|
+
const trees = farmClientModulePreloads.serverTrees;
|
|
10475
|
+
if (!trees || typeof markup !== "string" || !FARM_SERVER_TREE_PATTERN.test(markup)) return [];
|
|
10476
|
+
return trees.filter((index) => !listed.has(index) && listed.add(index));
|
|
10477
|
+
}
|
|
10478
|
+
|
|
10413
10479
|
// The modulepreload links for a document: the entry's static imports and, unless it answers a
|
|
10414
10480
|
// client navigation, the renderer and, when a page or layout root hydrates in it (\`hydratesRoot\`),
|
|
10415
10481
|
// the code that renders it; then the modules its hydrating page and its markup load.
|
|
@@ -10423,6 +10489,7 @@ function renderFarmClientModulePreloads(markup, pageModule, navigation, hydrates
|
|
|
10423
10489
|
(hydratesRoot && !navigation ? farmClientRootPreloadTags : "") +
|
|
10424
10490
|
collectFarmClientDocumentModules(markup, pageModule, listed)
|
|
10425
10491
|
.concat(collectFarmClientActionModules(markup, listed))
|
|
10492
|
+
.concat(collectFarmClientServerTreeModules(markup, listed))
|
|
10426
10493
|
.map(renderFarmClientModulePreload)
|
|
10427
10494
|
.join("");
|
|
10428
10495
|
}
|
|
@@ -10455,11 +10522,14 @@ function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy, na
|
|
|
10455
10522
|
)
|
|
10456
10523
|
: [];
|
|
10457
10524
|
const waitsForClick = rootStrategy === "interaction";
|
|
10458
|
-
// A call needs a hydrated island, so the action client comes with the renderer
|
|
10525
|
+
// A call needs a hydrated island, so the action client comes with the renderer, as do the server
|
|
10526
|
+
// trees a root rebuilds.
|
|
10527
|
+
const listed = new Set(entry.concat(rootModules));
|
|
10459
10528
|
const renderer = navigation
|
|
10460
10529
|
? []
|
|
10461
10530
|
: (farmClientModulePreloads.renderer || []).concat(
|
|
10462
|
-
collectFarmClientActionModules(markup,
|
|
10531
|
+
collectFarmClientActionModules(markup, listed),
|
|
10532
|
+
collectFarmClientServerTreeModules(markup, listed),
|
|
10463
10533
|
);
|
|
10464
10534
|
return attribute("data-farm-preload", waitsForClick ? entry : entry.concat(rootModules)) +
|
|
10465
10535
|
attribute("data-farm-preload-router", farmClientModulePreloads.router || []) +
|
|
@@ -10853,7 +10923,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
10853
10923
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
10854
10924
|
// registered at runtime, such as the docs engine's.
|
|
10855
10925
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
10856
|
-
_chunkW53Z4WDIcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root),
|
|
10926
|
+
_chunkW53Z4WDIcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunk3HWNYLQVcjs.FARM_VERSION)
|
|
10857
10927
|
)};
|
|
10858
10928
|
let farmDefaultMCPRouteFree;
|
|
10859
10929
|
function getFarmDefaultMCPServer() {
|
|
@@ -11047,7 +11117,7 @@ ${edgeMiddlewareFilePaths.length > 0 ? `
|
|
|
11047
11117
|
// middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
|
|
11048
11118
|
const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
|
|
11049
11119
|
const farmPrerendering =
|
|
11050
|
-
typeof process !== "undefined" && process.env?.${
|
|
11120
|
+
typeof process !== "undefined" && process.env?.${_chunkRVJQHQCGcjs.FARM_PRERENDER_ENV} === "1";
|
|
11051
11121
|
` : ""}
|
|
11052
11122
|
const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
|
|
11053
11123
|
config: farmMiddlewareConfig,
|
|
@@ -11191,7 +11261,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
11191
11261
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
11192
11262
|
return true;
|
|
11193
11263
|
}
|
|
11194
|
-
${_optionalChain([config, 'access',
|
|
11264
|
+
${_optionalChain([config, 'access', _246 => _246.docs, 'optionalAccess', _247 => _247.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
11195
11265
|
// The docs answer below the basePath; their API stays at /api/docs, as API routes do.
|
|
11196
11266
|
const docsRoutePathname = stripFarmBasePath(pathname);
|
|
11197
11267
|
if (
|
|
@@ -11219,7 +11289,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
11219
11289
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
11220
11290
|
};
|
|
11221
11291
|
}
|
|
11222
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
11292
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _248 => _248.docs, 'optionalAccess', _249 => _249.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
11223
11293
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
11224
11294
|
pathname,
|
|
11225
11295
|
method: request.method,
|
|
@@ -11303,7 +11373,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
11303
11373
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
11304
11374
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
11305
11375
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
11306
|
-
|
|
11376
|
+
_chunkTOUC6BR3cjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
11307
11377
|
agent: {
|
|
11308
11378
|
...config.agent,
|
|
11309
11379
|
aiCatalog: servesAiCatalog,
|
|
@@ -11314,9 +11384,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
11314
11384
|
openapi: openAPIReference
|
|
11315
11385
|
})
|
|
11316
11386
|
)});
|
|
11317
|
-
${_optionalChain([config, 'access',
|
|
11387
|
+
${_optionalChain([config, 'access', _250 => _250.docs, 'optionalAccess', _251 => _251.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
11318
11388
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
11319
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
11389
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _252 => _252.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _253 => _253.docs, 'access', _254 => _254.roots, 'optionalAccess', _255 => _255.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
|
|
11320
11390
|
pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
|
|
11321
11391
|
};
|
|
11322
11392
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
@@ -11332,11 +11402,11 @@ function labelFarmRequestOptions(options) {
|
|
|
11332
11402
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
11333
11403
|
return options;
|
|
11334
11404
|
}
|
|
11335
|
-
${_optionalChain([config, 'access',
|
|
11405
|
+
${_optionalChain([config, 'access', _256 => _256.docs, 'optionalAccess', _257 => _257.enabled]) ? `if (options.kind === "docs") {
|
|
11336
11406
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
11337
11407
|
return options;
|
|
11338
11408
|
}` : ""}
|
|
11339
|
-
${_optionalChain([config, 'access',
|
|
11409
|
+
${_optionalChain([config, 'access', _258 => _258.md, 'optionalAccess', _259 => _259.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
11340
11410
|
routePathname,
|
|
11341
11411
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
11342
11412
|
);
|
|
@@ -11371,7 +11441,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
11371
11441
|
return applicable;
|
|
11372
11442
|
}
|
|
11373
11443
|
|
|
11374
|
-
${_optionalChain([config, 'access',
|
|
11444
|
+
${_optionalChain([config, 'access', _260 => _260.docs, 'optionalAccess', _261 => _261.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
11375
11445
|
if (request.method === "HEAD") return response;
|
|
11376
11446
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
11377
11447
|
|
|
@@ -11477,7 +11547,7 @@ ${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 =>
|
|
|
11477
11547
|
|
|
11478
11548
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
11479
11549
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
11480
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
11550
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _262 => _262.experimental, 'optionalAccess', _263 => _263.ppr]) === true)};
|
|
11481
11551
|
|
|
11482
11552
|
function resolveRouteRenderingView(route) {
|
|
11483
11553
|
// The same merge development uses: baked directive config under the
|
|
@@ -11597,7 +11667,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
11597
11667
|
},
|
|
11598
11668
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
11599
11669
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
11600
|
-
${_optionalChain([config, 'access',
|
|
11670
|
+
${_optionalChain([config, 'access', _264 => _264.md, 'optionalAccess', _265 => _265.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
11601
11671
|
if (matchPageRoute(pathname)) {
|
|
11602
11672
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
11603
11673
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -11814,7 +11884,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11814
11884
|
return renderFarmErrorJSONResponse();` : `
|
|
11815
11885
|
if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
|
|
11816
11886
|
// No page was selected, so only the root error boundary and layouts apply.
|
|
11817
|
-
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access',
|
|
11887
|
+
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _266 => _266.md, 'optionalAccess', _267 => _267.enabled]) ? `
|
|
11818
11888
|
// An agent asking for Markdown reads the error document as Markdown, as it
|
|
11819
11889
|
// does when a page throws. The helper answers null when Markdown is off.
|
|
11820
11890
|
const markdownErrorResponse = await createMarkdownMirrorResponse({
|
|
@@ -11856,7 +11926,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11856
11926
|
}
|
|
11857
11927
|
` : ""}
|
|
11858
11928
|
|
|
11859
|
-
${_optionalChain([config, 'access',
|
|
11929
|
+
${_optionalChain([config, 'access', _268 => _268.docs, 'optionalAccess', _269 => _269.enabled]) ? `
|
|
11860
11930
|
// Docs responses are served after app middleware so route guards and
|
|
11861
11931
|
// middleware headers apply to the docs engine like any other page content.
|
|
11862
11932
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -11972,7 +12042,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11972
12042
|
}
|
|
11973
12043
|
` : ""}
|
|
11974
12044
|
|
|
11975
|
-
${_optionalChain([config, 'access',
|
|
12045
|
+
${_optionalChain([config, 'access', _270 => _270.md, 'optionalAccess', _271 => _271.enabled]) ? `
|
|
11976
12046
|
if (farmMarkdownConfig?.enabled) {
|
|
11977
12047
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
11978
12048
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -12076,11 +12146,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12076
12146
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
12077
12147
|
}
|
|
12078
12148
|
` : ""}
|
|
12079
|
-
${_optionalChain([config, 'access',
|
|
12149
|
+
${_optionalChain([config, 'access', _272 => _272.agent, 'optionalAccess', _273 => _273.manifest]) !== false ? `
|
|
12080
12150
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
12081
12151
|
// public manifest, the same document for every request.
|
|
12082
12152
|
if (
|
|
12083
|
-
[${JSON.stringify(
|
|
12153
|
+
[${JSON.stringify(_chunkTOUC6BR3cjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkTOUC6BR3cjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
12084
12154
|
normalizeRuntimePath(routePathname),
|
|
12085
12155
|
)
|
|
12086
12156
|
) {
|
|
@@ -12090,9 +12160,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12090
12160
|
);
|
|
12091
12161
|
}
|
|
12092
12162
|
` : ""}
|
|
12093
|
-
${_optionalChain([config, 'access',
|
|
12163
|
+
${_optionalChain([config, 'access', _274 => _274.agent, 'optionalAccess', _275 => _275.apiCatalog]) ? `
|
|
12094
12164
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
12095
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
12165
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkTOUC6BR3cjs.FARM_API_CATALOG_PATH)}) {
|
|
12096
12166
|
return applyProductionMiddlewareHeaders(
|
|
12097
12167
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
12098
12168
|
middlewareHeaders,
|
|
@@ -12117,11 +12187,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12117
12187
|
);
|
|
12118
12188
|
}
|
|
12119
12189
|
` : ""}
|
|
12120
|
-
${_optionalChain([config, 'access',
|
|
12190
|
+
${_optionalChain([config, 'access', _276 => _276.agent, 'optionalAccess', _277 => _277.llmsTxt, 'optionalAccess', _278 => _278.enabled]) ? `
|
|
12121
12191
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
12122
12192
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
12123
12193
|
? "llms"
|
|
12124
|
-
: ${_optionalChain([config, 'access',
|
|
12194
|
+
: ${_optionalChain([config, 'access', _279 => _279.agent, 'optionalAccess', _280 => _280.llmsTxt, 'optionalAccess', _281 => _281.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
12125
12195
|
if (farmGeneratedLlmsKind) {
|
|
12126
12196
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
12127
12197
|
// Renders are shared per origin the request reached, which is where pages are read.
|
|
@@ -12157,7 +12227,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12157
12227
|
}
|
|
12158
12228
|
` : ""}
|
|
12159
12229
|
|
|
12160
|
-
${_optionalChain([config, 'access',
|
|
12230
|
+
${_optionalChain([config, 'access', _282 => _282.docs, 'optionalAccess', _283 => _283.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
12161
12231
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
12162
12232
|
if (docsAPIResponse) {
|
|
12163
12233
|
return applyProductionMiddlewareHeaders(
|
|
@@ -12797,7 +12867,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12797
12867
|
);
|
|
12798
12868
|
}
|
|
12799
12869
|
}
|
|
12800
|
-
${_optionalChain([config, 'access',
|
|
12870
|
+
${_optionalChain([config, 'access', _284 => _284.md, 'optionalAccess', _285 => _285.enabled]) ? `
|
|
12801
12871
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
12802
12872
|
// using the public path the .md request will be resolved against.
|
|
12803
12873
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -12826,7 +12896,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12826
12896
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "cookie" });
|
|
12827
12897
|
}
|
|
12828
12898
|
|
|
12829
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
12899
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _286 => _286.agent, 'optionalAccess', _287 => _287.jsonLd]), () => ( false)))} });
|
|
12830
12900
|
const title = renderedMetadata.title;
|
|
12831
12901
|
const metaTags = renderedMetadata.tags;
|
|
12832
12902
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -13671,11 +13741,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
|
|
|
13671
13741
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
13672
13742
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
13673
13743
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
13674
|
-
${_optionalChain([config, 'access',
|
|
13744
|
+
${_optionalChain([config, 'access', _288 => _288.agent, 'optionalAccess', _289 => _289.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
13675
13745
|
basePath: farmLocalAPIBasePath,
|
|
13676
13746
|
dispatch: async (localRequest) =>
|
|
13677
13747
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
13678
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
13748
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _290 => _290.agent, 'optionalAccess', _291 => _291.noindexPreviews]) ? `
|
|
13679
13749
|
// Keep every response of a preview deployment out of search indexes.
|
|
13680
13750
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
13681
13751
|
}
|
|
@@ -13885,7 +13955,7 @@ function getManifestPageEntry(manifest, pathname) {
|
|
|
13885
13955
|
})).sort((left, right) => _chunkML4TOUZPcjs.compareRouteSpecificity.call(void 0, left.specificity, right.specificity)).map(({ entry, matches }) => ({ entry, matches }));
|
|
13886
13956
|
manifestPageMatchers.set(manifest.routes, pages);
|
|
13887
13957
|
}
|
|
13888
|
-
return _optionalChain([pages, 'access',
|
|
13958
|
+
return _optionalChain([pages, 'access', _292 => _292.find, 'call', _293 => _293((page) => page.matches(pathname)), 'optionalAccess', _294 => _294.entry]);
|
|
13889
13959
|
}
|
|
13890
13960
|
function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
|
|
13891
13961
|
if (!edgeGuarded) return headers;
|
|
@@ -13924,11 +13994,11 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
13924
13994
|
}
|
|
13925
13995
|
if (_chunk4B6YJ5DScjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
13926
13996
|
if (_chunk4B6YJ5DScjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
13927
|
-
if (
|
|
13997
|
+
if (_chunkBBX4RPOVcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
13928
13998
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
13929
13999
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
13930
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
13931
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
14000
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _295 => _295.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
14001
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _296 => _296.regions, 'optionalAccess', _297 => _297.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
13932
14002
|
return "route runtime controls";
|
|
13933
14003
|
}
|
|
13934
14004
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -13941,7 +14011,7 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
13941
14011
|
return void 0;
|
|
13942
14012
|
}
|
|
13943
14013
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
13944
|
-
if (!_optionalChain([config, 'access',
|
|
14014
|
+
if (!_optionalChain([config, 'access', _298 => _298.docs, 'optionalAccess', _299 => _299.enabled]) || !config.docs.prerender) return [];
|
|
13945
14015
|
if (_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
13946
14016
|
_chunk7U4XF76Rcjs.logger.info(
|
|
13947
14017
|
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
@@ -13960,7 +14030,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
13960
14030
|
}
|
|
13961
14031
|
return pages2;
|
|
13962
14032
|
}
|
|
13963
|
-
const pages = await
|
|
14033
|
+
const pages = await _chunkHKJIUZS5cjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
13964
14034
|
if (!pages) {
|
|
13965
14035
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
13966
14036
|
`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.`
|
|
@@ -13970,11 +14040,11 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
13970
14040
|
return pages;
|
|
13971
14041
|
}
|
|
13972
14042
|
async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
13973
|
-
if (!_optionalChain([config, 'access',
|
|
14043
|
+
if (!_optionalChain([config, 'access', _300 => _300.docs, 'optionalAccess', _301 => _301.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
|
|
13974
14044
|
return [];
|
|
13975
14045
|
}
|
|
13976
14046
|
try {
|
|
13977
|
-
return await
|
|
14047
|
+
return await _chunkHKJIUZS5cjs.listFarmDocsPagePaths.call(void 0, config.docs, {
|
|
13978
14048
|
root,
|
|
13979
14049
|
srcDir: config.srcDir,
|
|
13980
14050
|
adapter: _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
|
|
@@ -13988,9 +14058,9 @@ async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
|
13988
14058
|
}
|
|
13989
14059
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
13990
14060
|
return Object.values(routeRules || {}).some((rule) => {
|
|
13991
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
13992
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
13993
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
14061
|
+
const swr = _optionalChain([rule, 'optionalAccess', _302 => _302.swr]);
|
|
14062
|
+
const cache = _optionalChain([rule, 'optionalAccess', _303 => _303.cache]);
|
|
14063
|
+
const headers = _optionalChain([rule, 'optionalAccess', _304 => _304.headers]);
|
|
13994
14064
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
13995
14065
|
});
|
|
13996
14066
|
}
|
|
@@ -14003,10 +14073,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14003
14073
|
const nitroBuilder = nitroBuilderResult.value;
|
|
14004
14074
|
const isVercel = preset === "vercel";
|
|
14005
14075
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
14006
|
-
const outputDir =
|
|
14076
|
+
const outputDir = _chunkBBX4RPOVcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
14007
14077
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
14008
14078
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
14009
|
-
const imageRuntime =
|
|
14079
|
+
const imageRuntime = _chunkH6C45DCFcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
14010
14080
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
14011
14081
|
(image) => image.sourceType === "module"
|
|
14012
14082
|
);
|
|
@@ -14156,7 +14226,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
14156
14226
|
webEntry: clientJsSrc,
|
|
14157
14227
|
webBoot: clientBootSrc,
|
|
14158
14228
|
stylesheet: clientCssHref,
|
|
14159
|
-
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess',
|
|
14229
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _305 => _305.files]), () => ( []))
|
|
14160
14230
|
})
|
|
14161
14231
|
) : null;
|
|
14162
14232
|
for (const output of Object.values(ssrBundle)) {
|
|
@@ -14482,7 +14552,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14482
14552
|
varyFarmNitroCacheRules(_chunkIIHZ2BEEcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules), [
|
|
14483
14553
|
...config.md.enabled ? ["accept"] : [],
|
|
14484
14554
|
...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : [],
|
|
14485
|
-
..._chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
14555
|
+
..._chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _306 => _306.experimental, 'optionalAccess', _307 => _307.serverComponents])) === "islands" ? ["f-layouts"] : []
|
|
14486
14556
|
]),
|
|
14487
14557
|
config.basePath,
|
|
14488
14558
|
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
@@ -14647,22 +14717,22 @@ function toFarmNodeResponse(request, response) {
|
|
|
14647
14717
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
14648
14718
|
);
|
|
14649
14719
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
14650
|
-
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
14651
|
-
_optionalChain([nitroConfig, 'access',
|
|
14652
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
14720
|
+
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _308 => _308.rollupConfig, 'optionalAccess', _309 => _309.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _310 => _310.rollupConfig, 'optionalAccess', _311 => _311.plugins])) && customRollupKeys.length === 0 && Boolean(
|
|
14721
|
+
_optionalChain([nitroConfig, 'access', _312 => _312.handlers, 'optionalAccess', _313 => _313.some, 'call', _314 => _314(
|
|
14722
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _315 => _315.handler]) || "") === nitroEntryPath
|
|
14653
14723
|
)])
|
|
14654
14724
|
);
|
|
14655
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access',
|
|
14725
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _316 => _316.output, 'optionalAccess', _317 => _317.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
|
|
14656
14726
|
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
14657
14727
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
14658
14728
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
14659
14729
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
14660
14730
|
const shouldMinify = nitroConfig.minify !== false;
|
|
14661
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
14731
|
+
const keepServerNames = !(_optionalChain([config, 'access', _318 => _318.docs, 'optionalAccess', _319 => _319.enabled]) && _optionalChain([config, 'access', _320 => _320.docs, 'access', _321 => _321.adapter, 'optionalAccess', _322 => _322.server]));
|
|
14662
14732
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
14663
14733
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
14664
14734
|
const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
|
|
14665
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
14735
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _323 => _323.rollupConfig, 'optionalAccess', _324 => _324.plugins]);
|
|
14666
14736
|
nitroConfig.rollupConfig = {
|
|
14667
14737
|
...nitroConfig.rollupConfig,
|
|
14668
14738
|
plugins: [
|
|
@@ -14701,7 +14771,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14701
14771
|
let skippedNonHtmlPrerenderRoute = false;
|
|
14702
14772
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
14703
14773
|
if (route.error || !prerenderPagePaths.has(route.route)) return;
|
|
14704
|
-
if (_optionalChain([route, 'access',
|
|
14774
|
+
if (_optionalChain([route, 'access', _325 => _325.contentType, 'optionalAccess', _326 => _326.toLowerCase, 'call', _327 => _327(), 'access', _328 => _328.includes, 'call', _329 => _329("html")])) return;
|
|
14705
14775
|
route.skip = true;
|
|
14706
14776
|
skippedNonHtmlPrerenderRoute = true;
|
|
14707
14777
|
const configuredRule = configuredNitroRouteRules[route.route];
|
|
@@ -14712,9 +14782,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
14712
14782
|
nitroInstance.hooks.hook("prerender:done", () => {
|
|
14713
14783
|
if (skippedNonHtmlPrerenderRoute) nitroInstance.routing.sync();
|
|
14714
14784
|
});
|
|
14715
|
-
if (_optionalChain([config, 'access',
|
|
14785
|
+
if (_optionalChain([config, 'access', _330 => _330.md, 'optionalAccess', _331 => _331.enabled])) {
|
|
14716
14786
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
14717
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
14787
|
+
if (!route.contents || !_optionalChain([route, 'access', _332 => _332.contentType, 'optionalAccess', _333 => _333.toLowerCase, 'call', _334 => _334(), 'access', _335 => _335.includes, 'call', _336 => _336("html")])) return;
|
|
14718
14788
|
const alternatePath = _chunk2NOHVIJ3cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
|
|
14719
14789
|
routePathname: (pathname) => routeManager.toRoutePathname(pathname)
|
|
14720
14790
|
});
|
|
@@ -14737,7 +14807,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14737
14807
|
}
|
|
14738
14808
|
if (config.security.csp && config.security.csp.nonce) {
|
|
14739
14809
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
14740
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
14810
|
+
if (!route.contents || !_optionalChain([route, 'access', _337 => _337.contentType, 'optionalAccess', _338 => _338.toLowerCase, 'call', _339 => _339(), 'access', _340 => _340.includes, 'call', _341 => _341("html")])) return;
|
|
14741
14811
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
14742
14812
|
if (!staticCsp) return;
|
|
14743
14813
|
route.contents = staticCsp.html;
|
|
@@ -14773,7 +14843,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14773
14843
|
await nitroBuilder.copyPublicAssets(nitroInstance);
|
|
14774
14844
|
if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
|
|
14775
14845
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
14776
|
-
const configuredPlugins = _optionalChain([prerendererConfig, 'access',
|
|
14846
|
+
const configuredPlugins = _optionalChain([prerendererConfig, 'access', _342 => _342.rollupConfig, 'optionalAccess', _343 => _343.plugins]);
|
|
14777
14847
|
const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
|
|
14778
14848
|
prerendererConfig.rollupConfig = {
|
|
14779
14849
|
...prerendererConfig.rollupConfig,
|
|
@@ -14830,13 +14900,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
14830
14900
|
}
|
|
14831
14901
|
if (prerenderRoutes.length > 0) {
|
|
14832
14902
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
14833
|
-
const previousPrerender = process.env[
|
|
14834
|
-
process.env[
|
|
14903
|
+
const previousPrerender = process.env[_chunkRVJQHQCGcjs.FARM_PRERENDER_ENV];
|
|
14904
|
+
process.env[_chunkRVJQHQCGcjs.FARM_PRERENDER_ENV] = "1";
|
|
14835
14905
|
try {
|
|
14836
14906
|
await nitroBuilder.prerender(nitroInstance);
|
|
14837
14907
|
} finally {
|
|
14838
|
-
if (previousPrerender === void 0) delete process.env[
|
|
14839
|
-
else process.env[
|
|
14908
|
+
if (previousPrerender === void 0) delete process.env[_chunkRVJQHQCGcjs.FARM_PRERENDER_ENV];
|
|
14909
|
+
else process.env[_chunkRVJQHQCGcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
14840
14910
|
}
|
|
14841
14911
|
}
|
|
14842
14912
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs5, preset) : Promise.resolve(null);
|
|
@@ -15013,7 +15083,7 @@ async function moveVercelOutputPath(src, dest, fs5) {
|
|
|
15013
15083
|
await fs5.rename(src, dest);
|
|
15014
15084
|
return;
|
|
15015
15085
|
} catch (error) {
|
|
15016
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
15086
|
+
const code = _optionalChain([error, 'optionalAccess', _344 => _344.code]);
|
|
15017
15087
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
15018
15088
|
throw error;
|
|
15019
15089
|
}
|
|
@@ -15039,7 +15109,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
15039
15109
|
try {
|
|
15040
15110
|
await moveVercelOutputPath(publicDir, staticDir, fs5);
|
|
15041
15111
|
} catch (error) {
|
|
15042
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
15112
|
+
if (_optionalChain([error, 'optionalAccess', _345 => _345.code]) !== "ENOENT") throw error;
|
|
15043
15113
|
}
|
|
15044
15114
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5);
|
|
15045
15115
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs5);
|
|
@@ -15081,7 +15151,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
15081
15151
|
_chunk7U4XF76Rcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
15082
15152
|
}
|
|
15083
15153
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
|
|
15084
|
-
if (!_optionalChain([config, 'access',
|
|
15154
|
+
if (!_optionalChain([config, 'access', _346 => _346.docs, 'optionalAccess', _347 => _347.enabled])) return;
|
|
15085
15155
|
const [mainRoot, ...extraRoots] = _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
15086
15156
|
await copyFarmDocsRootContent(
|
|
15087
15157
|
mainRoot,
|
|
@@ -15106,7 +15176,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
15106
15176
|
const lastModifiedManifest = _chunkHR5GU4UUcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
15107
15177
|
fallback: "now"
|
|
15108
15178
|
});
|
|
15109
|
-
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access',
|
|
15179
|
+
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _348 => _348.unknown, 'optionalAccess', _349 => _349.length]), () => ( 0));
|
|
15110
15180
|
if (undatedPages > 0) {
|
|
15111
15181
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
15112
15182
|
`${undatedPages} docs page(s) were last changed before this shallow clone's Git history, so they show no "Last updated" date. Build from a full clone (git fetch --unshallow) or set lastModified in the page's frontmatter.`
|
|
@@ -15191,7 +15261,7 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
15191
15261
|
try {
|
|
15192
15262
|
await copyPackage("sharp", sharpRequire);
|
|
15193
15263
|
if (!copiedPackages.has("sharp")) {
|
|
15194
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
15264
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkH6C45DCFcjs.SHARP_INSTALL_HINT}`);
|
|
15195
15265
|
}
|
|
15196
15266
|
} catch (error) {
|
|
15197
15267
|
await fs5.rm(stageDir, { recursive: true, force: true });
|
|
@@ -15424,7 +15494,7 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
15424
15494
|
// src/build/index.ts
|
|
15425
15495
|
async function build(config, options = {}) {
|
|
15426
15496
|
return _chunkNG2EZ6QScjs.withProductionNodeEnv.call(void 0,
|
|
15427
|
-
() =>
|
|
15497
|
+
() => _chunkOYM6VJEFcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
15428
15498
|
);
|
|
15429
15499
|
}
|
|
15430
15500
|
function createBuildTargetBaseline(config) {
|
|
@@ -15435,7 +15505,7 @@ function createBuildTargetBaseline(config) {
|
|
|
15435
15505
|
preset,
|
|
15436
15506
|
distDir,
|
|
15437
15507
|
outputDir,
|
|
15438
|
-
outputWasDerived: outputDir ===
|
|
15508
|
+
outputWasDerived: outputDir === _chunkBBX4RPOVcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
15439
15509
|
};
|
|
15440
15510
|
}
|
|
15441
15511
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -15444,8 +15514,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
15444
15514
|
const distDir = config.distDir || ".farm";
|
|
15445
15515
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
15446
15516
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
15447
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
15448
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
15517
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkBBX4RPOVcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
15518
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkBBX4RPOVcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
15449
15519
|
return {
|
|
15450
15520
|
root,
|
|
15451
15521
|
preset,
|
|
@@ -15453,7 +15523,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
15453
15523
|
distDir,
|
|
15454
15524
|
deployTarget,
|
|
15455
15525
|
outputDir,
|
|
15456
|
-
deployOutputDir:
|
|
15526
|
+
deployOutputDir: _chunkBBX4RPOVcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
15457
15527
|
};
|
|
15458
15528
|
}
|
|
15459
15529
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -15490,15 +15560,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15490
15560
|
};
|
|
15491
15561
|
config = {
|
|
15492
15562
|
...config,
|
|
15493
|
-
images:
|
|
15563
|
+
images: _chunkH6C45DCFcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
15494
15564
|
root: targets.root,
|
|
15495
15565
|
preset: targets.preset
|
|
15496
15566
|
})
|
|
15497
15567
|
};
|
|
15498
|
-
if (_optionalChain([config, 'access',
|
|
15568
|
+
if (_optionalChain([config, 'access', _350 => _350.docs, 'optionalAccess', _351 => _351.enabled])) await _chunkNDOE76QCcjs.loadFarmDocsEngine.call(void 0, );
|
|
15499
15569
|
pluginManager.updateContext({ config });
|
|
15500
15570
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
15501
|
-
|
|
15571
|
+
_chunkOYM6VJEFcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunkOYM6VJEFcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
|
|
15502
15572
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
15503
15573
|
await pluginManager.setupPlugins();
|
|
15504
15574
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -15510,8 +15580,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15510
15580
|
});
|
|
15511
15581
|
_chunk7U4XF76Rcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
15512
15582
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
15513
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
15514
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
15583
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _352 => _352.status]) === "rejected") throw productionViteResult.reason;
|
|
15584
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _353 => _353.value]);
|
|
15515
15585
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
15516
15586
|
projectModuleServer = await createProjectModuleServer(
|
|
15517
15587
|
createViteServer,
|
|
@@ -15519,7 +15589,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15519
15589
|
root,
|
|
15520
15590
|
rendererBuild.signal
|
|
15521
15591
|
);
|
|
15522
|
-
const farmApp =
|
|
15592
|
+
const farmApp = _chunkH6C45DCFcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
15523
15593
|
if (options.universal !== false) farmApp.getRouteManager().keepBuildSourceSnapshot();
|
|
15524
15594
|
await farmApp.initialize();
|
|
15525
15595
|
const routeManager = farmApp.getRouteManager();
|
|
@@ -15531,7 +15601,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15531
15601
|
storage: config.storage,
|
|
15532
15602
|
plugins: config.plugins,
|
|
15533
15603
|
extraRoutes: [
|
|
15534
|
-
..._optionalChain([config, 'access',
|
|
15604
|
+
..._optionalChain([config, 'access', _354 => _354.openapi, 'optionalAccess', _355 => _355.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
15535
15605
|
..._chunkHR5GU4UUcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
15536
15606
|
],
|
|
15537
15607
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
@@ -15617,7 +15687,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15617
15687
|
throw error;
|
|
15618
15688
|
} finally {
|
|
15619
15689
|
try {
|
|
15620
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
15690
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _356 => _356.close, 'call', _357 => _357()]);
|
|
15621
15691
|
} finally {
|
|
15622
15692
|
rendererBuild.abort();
|
|
15623
15693
|
}
|
|
@@ -15629,7 +15699,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15629
15699
|
ssr: true,
|
|
15630
15700
|
buildLifetime
|
|
15631
15701
|
});
|
|
15632
|
-
const viteConfig =
|
|
15702
|
+
const viteConfig = _chunkH6C45DCFcjs.mergeFarmViteConfig.call(void 0,
|
|
15633
15703
|
{
|
|
15634
15704
|
root,
|
|
15635
15705
|
appType: "custom",
|
|
@@ -15641,12 +15711,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15641
15711
|
},
|
|
15642
15712
|
plugins: [
|
|
15643
15713
|
...rendererVitePlugins,
|
|
15644
|
-
|
|
15714
|
+
_chunkH6C45DCFcjs.farmFontImportsPlugin.call(void 0, {
|
|
15645
15715
|
root,
|
|
15646
15716
|
basePath: config.basePath,
|
|
15647
15717
|
publicDir: config.publicDir
|
|
15648
15718
|
}),
|
|
15649
|
-
|
|
15719
|
+
_chunkOYM6VJEFcjs.farmEnvironmentFunctionsPlugin.call(void 0, { renderer: config.renderer }),
|
|
15650
15720
|
// Route modules load here at build time (rendering config, prerendering): `server-only`
|
|
15651
15721
|
// resolves as it does in the server build. Module-entry packages load pre-bundled, as in
|
|
15652
15722
|
// `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
|
|
@@ -15662,7 +15732,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15662
15732
|
hmr: false
|
|
15663
15733
|
},
|
|
15664
15734
|
resolve: {
|
|
15665
|
-
alias:
|
|
15735
|
+
alias: _chunkH6C45DCFcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
15666
15736
|
dedupe: [...config.renderer.dedupe || []]
|
|
15667
15737
|
},
|
|
15668
15738
|
optimizeDeps: {
|
|
@@ -15701,10 +15771,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15701
15771
|
noDiscovery: true
|
|
15702
15772
|
},
|
|
15703
15773
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
15704
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
15774
|
+
environments: _optionalChain([viteConfig, 'access', _358 => _358.environments, 'optionalAccess', _359 => _359.ssr, 'optionalAccess', _360 => _360.dev, 'optionalAccess', _361 => _361.createEnvironment]) ? viteConfig.environments : {
|
|
15705
15775
|
...viteConfig.environments,
|
|
15706
15776
|
ssr: {
|
|
15707
|
-
..._optionalChain([viteConfig, 'access',
|
|
15777
|
+
..._optionalChain([viteConfig, 'access', _362 => _362.environments, 'optionalAccess', _363 => _363.ssr]),
|
|
15708
15778
|
...await createFarmProjectModuleSsrEnvironment()
|
|
15709
15779
|
}
|
|
15710
15780
|
}
|
|
@@ -15740,7 +15810,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15740
15810
|
farmNavigationPlugin(config.renderer),
|
|
15741
15811
|
farmIslandContainersPlugin(config),
|
|
15742
15812
|
farmPlugin(config, pluginManager),
|
|
15743
|
-
|
|
15813
|
+
_chunkOYM6VJEFcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
15744
15814
|
],
|
|
15745
15815
|
mode: "production"
|
|
15746
15816
|
});
|
|
@@ -15768,13 +15838,13 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15768
15838
|
define: {
|
|
15769
15839
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
15770
15840
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
15771
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
15841
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _364 => _364.env, 'optionalAccess', _365 => _365.public]) || {})
|
|
15772
15842
|
},
|
|
15773
15843
|
plugins: [
|
|
15774
15844
|
farmI18nClientBridgePlugin(),
|
|
15775
15845
|
farmIslandContainersPlugin(config),
|
|
15776
15846
|
farmPlugin(config, pluginManager),
|
|
15777
|
-
|
|
15847
|
+
_chunkOYM6VJEFcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
15778
15848
|
],
|
|
15779
15849
|
mode: "production"
|
|
15780
15850
|
});
|
|
@@ -15802,7 +15872,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15802
15872
|
if (pluginManager) {
|
|
15803
15873
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
15804
15874
|
}
|
|
15805
|
-
const outputDir =
|
|
15875
|
+
const outputDir = _chunkBBX4RPOVcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
15806
15876
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
15807
15877
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
15808
15878
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -15873,7 +15943,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15873
15943
|
root,
|
|
15874
15944
|
preset,
|
|
15875
15945
|
distDir,
|
|
15876
|
-
outputDir:
|
|
15946
|
+
outputDir: _chunkBBX4RPOVcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
15877
15947
|
});
|
|
15878
15948
|
}
|
|
15879
15949
|
}
|