@farm.js/core 0.1.20 → 0.1.22
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/{app-D_6nTit-.d.mts → app-0e-oTC_R.d.mts} +7 -0
- package/dist/{app-DAyPE-gr.d.ts → app-B7qKw8Ny.d.ts} +7 -0
- package/dist/{chunk-A7T6JZNI.cjs → chunk-2HCEC2YO.cjs} +1 -1
- package/dist/{chunk-K6MG3SEG.mjs → chunk-AAWTJW2G.mjs} +215 -53
- package/dist/{chunk-OLYK7EAK.mjs → chunk-DAATZTKJ.mjs} +14 -0
- package/dist/{chunk-GQFSCBKJ.cjs → chunk-EXUMQVY3.cjs} +187 -208
- package/dist/{chunk-NRS46D4L.mjs → chunk-GKT4ONKN.mjs} +1 -1
- package/dist/{chunk-YP5JZ4LF.cjs → chunk-GXXONIAR.cjs} +3 -3
- package/dist/{chunk-W7MZXRXM.mjs → chunk-ONMW3EVV.mjs} +1 -1
- package/dist/{chunk-PZX6I4JW.cjs → chunk-P5HSJCXI.cjs} +441 -279
- package/dist/{chunk-5V37LKBG.mjs → chunk-PC33YKTC.mjs} +53 -74
- package/dist/{chunk-TFAXUHWX.cjs → chunk-PSV6XKPO.cjs} +15 -1
- package/dist/{chunk-ZE6ONQ5R.cjs → chunk-Q3PX2TGL.cjs} +2 -2
- package/dist/{chunk-XFFQSD2F.cjs → chunk-SO7CRMP6.cjs} +2 -2
- package/dist/{chunk-RMIJFZU3.mjs → chunk-SPSQFO3Z.mjs} +1 -1
- package/dist/{chunk-F7E2AZKQ.mjs → chunk-X2ZUD4GI.mjs} +1 -1
- package/dist/{devtools-R6MDDAZK.cjs → devtools-6DQHO7EK.cjs} +3 -3
- package/dist/{devtools-MTB5SA2B.mjs → devtools-EZ5ORGAK.mjs} +2 -2
- package/dist/docs.cjs +4 -4
- package/dist/docs.mjs +3 -3
- package/dist/index.cjs +8 -8
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +7 -7
- package/dist/internal/build-runtime.cjs +8 -8
- package/dist/internal/build-runtime.mjs +7 -7
- package/dist/internal/cli-runtime.cjs +4 -4
- package/dist/internal/cli-runtime.mjs +3 -3
- 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/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/plugin.cjs +5 -5
- package/dist/plugin.mjs +4 -4
- package/dist/renderer.cjs +4 -2
- package/dist/renderer.d.mts +9 -1
- package/dist/renderer.d.ts +9 -1
- package/dist/renderer.mjs +3 -1
- package/dist/server.cjs +22 -28
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.mjs +7 -13
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +5 -5
- package/dist/vite.mjs +4 -4
- package/package.json +7 -3
|
@@ -7,7 +7,7 @@ var _chunkMT763TDWcjs = require('./chunk-MT763TDW.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkQ3PX2TGLcjs = require('./chunk-Q3PX2TGL.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -31,7 +31,7 @@ var _chunkYA6LLTIJcjs = require('./chunk-YA6LLTIJ.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkGXXONIARcjs = require('./chunk-GXXONIAR.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
var _chunkRTHIVJ2Gcjs = require('./chunk-RTHIVJ2G.cjs');
|
|
@@ -63,13 +63,14 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
var _chunkPZX6I4JWcjs = require('./chunk-PZX6I4JW.cjs');
|
|
67
66
|
|
|
67
|
+
var _chunkP5HSJCXIcjs = require('./chunk-P5HSJCXI.cjs');
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
var _chunkSO7CRMP6cjs = require('./chunk-SO7CRMP6.cjs');
|
|
73
74
|
|
|
74
75
|
|
|
75
76
|
var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
|
|
@@ -97,7 +98,8 @@ var _chunkY4YMF2NQcjs = require('./chunk-Y4YMF2NQ.cjs');
|
|
|
97
98
|
|
|
98
99
|
|
|
99
100
|
|
|
100
|
-
|
|
101
|
+
|
|
102
|
+
var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
101
103
|
|
|
102
104
|
|
|
103
105
|
var _chunkISTFC3MZcjs = require('./chunk-ISTFC3MZ.cjs');
|
|
@@ -297,7 +299,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
297
299
|
fontStylesheetHref: options.fontStylesheetHref,
|
|
298
300
|
globalStylesheetHref: options.globalStylesheetHref
|
|
299
301
|
});
|
|
300
|
-
const apiHandler =
|
|
302
|
+
const apiHandler = _chunkQ3PX2TGLcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
301
303
|
rootDir: options.root,
|
|
302
304
|
srcDir: options.srcDir,
|
|
303
305
|
docs
|
|
@@ -409,7 +411,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
409
411
|
const routes = [];
|
|
410
412
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
411
413
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
412
|
-
const rendering = await
|
|
414
|
+
const rendering = await _chunkSO7CRMP6cjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
413
415
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
414
416
|
routes.push({
|
|
415
417
|
kind: "page",
|
|
@@ -955,52 +957,6 @@ export default {};
|
|
|
955
957
|
}
|
|
956
958
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmNodeServerEntry, "createFarmNodeServerEntry");
|
|
957
959
|
|
|
958
|
-
// src/build/vite-plugin-compat.ts
|
|
959
|
-
function adaptTailwindVitePlugin(pluginOption, builder) {
|
|
960
|
-
if (builder !== "rolldown") return pluginOption;
|
|
961
|
-
return adaptPluginOption(pluginOption);
|
|
962
|
-
}
|
|
963
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, adaptTailwindVitePlugin, "adaptTailwindVitePlugin");
|
|
964
|
-
function adaptPluginOption(pluginOption) {
|
|
965
|
-
if (Array.isArray(pluginOption)) return pluginOption.map(adaptPluginOption);
|
|
966
|
-
if (!pluginOption || typeof pluginOption !== "object") return pluginOption;
|
|
967
|
-
const plugin = pluginOption;
|
|
968
|
-
if (!_optionalChain([plugin, 'access', _11 => _11.name, 'optionalAccess', _12 => _12.startsWith, 'call', _13 => _13("@tailwindcss/vite:generate:")])) return pluginOption;
|
|
969
|
-
if (isVitePluginHook(plugin.transform)) {
|
|
970
|
-
return {
|
|
971
|
-
...plugin,
|
|
972
|
-
transform: withVite5TransformContext(plugin.transform)
|
|
973
|
-
};
|
|
974
|
-
}
|
|
975
|
-
if (plugin.transform && typeof plugin.transform === "object" && "handler" in plugin.transform && isVitePluginHook(plugin.transform.handler)) {
|
|
976
|
-
return {
|
|
977
|
-
...plugin,
|
|
978
|
-
transform: {
|
|
979
|
-
...plugin.transform,
|
|
980
|
-
handler: withVite5TransformContext(plugin.transform.handler)
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
}
|
|
984
|
-
return pluginOption;
|
|
985
|
-
}
|
|
986
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, adaptPluginOption, "adaptPluginOption");
|
|
987
|
-
function isVitePluginHook(value) {
|
|
988
|
-
return typeof value === "function";
|
|
989
|
-
}
|
|
990
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, isVitePluginHook, "isVitePluginHook");
|
|
991
|
-
function withVite5TransformContext(handler) {
|
|
992
|
-
return function(...args) {
|
|
993
|
-
const context = new Proxy(this, {
|
|
994
|
-
get(target, property, receiver) {
|
|
995
|
-
if (property === "environment") return void 0;
|
|
996
|
-
return Reflect.get(target, property, receiver);
|
|
997
|
-
}
|
|
998
|
-
});
|
|
999
|
-
return handler.apply(context, args);
|
|
1000
|
-
};
|
|
1001
|
-
}
|
|
1002
|
-
_chunkS3JO3N4Hcjs.__name.call(void 0, withVite5TransformContext, "withVite5TransformContext");
|
|
1003
|
-
|
|
1004
960
|
// src/nitro/universal-build.ts
|
|
1005
961
|
function preloadFarmNitroBuilder() {
|
|
1006
962
|
return import("nitro/builder").then(
|
|
@@ -1147,7 +1103,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1147
1103
|
return {
|
|
1148
1104
|
name: "farm-prerender-runtime-resolver",
|
|
1149
1105
|
async resolveId(id, _importer, options) {
|
|
1150
|
-
if (_optionalChain([options, 'access',
|
|
1106
|
+
if (_optionalChain([options, 'access', _11 => _11.custom, 'optionalAccess', _12 => _12.farmPrerenderRuntimeResolve])) return null;
|
|
1151
1107
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
1152
1108
|
return null;
|
|
1153
1109
|
}
|
|
@@ -1252,7 +1208,7 @@ function hasReactDomEdgeServerBuild(root) {
|
|
|
1252
1208
|
}
|
|
1253
1209
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasReactDomEdgeServerBuild, "hasReactDomEdgeServerBuild");
|
|
1254
1210
|
function shouldAliasReactServerToWebBuild(renderer, preset) {
|
|
1255
|
-
return
|
|
1211
|
+
return _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
|
|
1256
1212
|
}
|
|
1257
1213
|
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldAliasReactServerToWebBuild, "shouldAliasReactServerToWebBuild");
|
|
1258
1214
|
function isCloudflareImagePreset(preset) {
|
|
@@ -1285,7 +1241,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
1285
1241
|
return {
|
|
1286
1242
|
name: "farm-metadata-image-wasm",
|
|
1287
1243
|
resolveId(source, importer) {
|
|
1288
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
1244
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _13 => _13.replace, 'call', _14 => _14(/\\/g, "/"), 'access', _15 => _15.includes, 'call', _16 => _16("/@vercel/og/")])) {
|
|
1289
1245
|
return null;
|
|
1290
1246
|
}
|
|
1291
1247
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -1426,7 +1382,7 @@ function trimSlashes(value) {
|
|
|
1426
1382
|
}
|
|
1427
1383
|
_chunkS3JO3N4Hcjs.__name.call(void 0, trimSlashes, "trimSlashes");
|
|
1428
1384
|
function resolveBuildDocsContentDir(config, root) {
|
|
1429
|
-
if (!_optionalChain([config, 'access',
|
|
1385
|
+
if (!_optionalChain([config, 'access', _17 => _17.docs, 'optionalAccess', _18 => _18.enabled])) return null;
|
|
1430
1386
|
const configuredContentDir = config.docs.contentDir || config.docs.config.contentDir;
|
|
1431
1387
|
if (typeof configuredContentDir === "string" && configuredContentDir.trim()) {
|
|
1432
1388
|
const contentDir = _path2.default.isAbsolute(configuredContentDir) ? configuredContentDir : _path2.default.join(root, configuredContentDir);
|
|
@@ -1511,7 +1467,7 @@ function hasFarmPluginRoutes(config) {
|
|
|
1511
1467
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
|
|
1512
1468
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1513
1469
|
return (config.plugins || []).some(
|
|
1514
|
-
(plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false &&
|
|
1470
|
+
(plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkP5HSJCXIcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1515
1471
|
);
|
|
1516
1472
|
}
|
|
1517
1473
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
|
|
@@ -1559,7 +1515,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1559
1515
|
}
|
|
1560
1516
|
_chunkS3JO3N4Hcjs.__name.call(void 0, discoverMiddlewareRoutes, "discoverMiddlewareRoutes");
|
|
1561
1517
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
1562
|
-
if (!_optionalChain([config, 'access',
|
|
1518
|
+
if (!_optionalChain([config, 'access', _19 => _19.docs, 'optionalAccess', _20 => _20.enabled]) || !_optionalChain([config, 'access', _21 => _21.docs, 'access', _22 => _22.adapter, 'optionalAccess', _23 => _23.server]) || _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
1563
1519
|
return;
|
|
1564
1520
|
}
|
|
1565
1521
|
throw new Error(
|
|
@@ -1573,7 +1529,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1573
1529
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1574
1530
|
const srcDir = config.srcDir || "src";
|
|
1575
1531
|
const distDir = config.distDir || ".farm";
|
|
1576
|
-
const deployOutputDir =
|
|
1532
|
+
const deployOutputDir = _chunkGXXONIARcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1577
1533
|
const lifecyclePluginManager = options.pluginManager;
|
|
1578
1534
|
const productionViteResultPromise = Promise.allSettled([
|
|
1579
1535
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -1773,7 +1729,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1773
1729
|
_chunk5QIKR7RRcjs.logger.error(`\u274C Build failed: ${error}`);
|
|
1774
1730
|
throw error;
|
|
1775
1731
|
} finally {
|
|
1776
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
1732
|
+
_optionalChain([rendererBuild, 'optionalAccess', _24 => _24.abort, 'call', _25 => _25()]);
|
|
1777
1733
|
}
|
|
1778
1734
|
}
|
|
1779
1735
|
_chunkS3JO3N4Hcjs.__name.call(void 0, buildUniversal, "buildUniversal");
|
|
@@ -1821,7 +1777,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
1821
1777
|
}
|
|
1822
1778
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
1823
1779
|
await fs.writeFile(fontCssPath, normalizedFontCss);
|
|
1824
|
-
await fs.writeFile(clientCssPath,
|
|
1780
|
+
await fs.writeFile(clientCssPath, _chunkP5HSJCXIcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
1825
1781
|
}
|
|
1826
1782
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
|
|
1827
1783
|
var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
|
|
@@ -1871,7 +1827,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
1871
1827
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
|
|
1872
1828
|
let plan = cache.get(key);
|
|
1873
1829
|
if (!plan) {
|
|
1874
|
-
plan =
|
|
1830
|
+
plan = _chunkP5HSJCXIcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
1875
1831
|
cache.set(key, plan);
|
|
1876
1832
|
}
|
|
1877
1833
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -1895,19 +1851,19 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1895
1851
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
1896
1852
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
1897
1853
|
);
|
|
1898
|
-
if (_optionalChain([config, 'access',
|
|
1854
|
+
if (_optionalChain([config, 'access', _26 => _26.experimental, 'optionalAccess', _27 => _27.isolatedClientHydration]) === "enabled" && _optionalChain([config, 'access', _28 => _28.experimental, 'optionalAccess', _29 => _29.serverComponents]) !== true && unsupportedIntegrationProvider) {
|
|
1899
1855
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
1900
1856
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
1901
1857
|
);
|
|
1902
1858
|
}
|
|
1903
|
-
const isolatedMode =
|
|
1904
|
-
_optionalChain([config, 'access',
|
|
1859
|
+
const isolatedMode = _chunkP5HSJCXIcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
1860
|
+
_optionalChain([config, 'access', _30 => _30.experimental, 'optionalAccess', _31 => _31.isolatedClientHydration]),
|
|
1905
1861
|
{
|
|
1906
|
-
serverComponents: _optionalChain([config, 'access',
|
|
1862
|
+
serverComponents: _optionalChain([config, 'access', _32 => _32.experimental, 'optionalAccess', _33 => _33.serverComponents]) === true,
|
|
1907
1863
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
1908
1864
|
}
|
|
1909
1865
|
);
|
|
1910
|
-
const planOptions =
|
|
1866
|
+
const planOptions = _chunkP5HSJCXIcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
1911
1867
|
config.renderer,
|
|
1912
1868
|
Boolean(unsupportedIntegrationProvider)
|
|
1913
1869
|
);
|
|
@@ -1956,15 +1912,15 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1956
1912
|
});
|
|
1957
1913
|
const layoutAppliesToRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (layoutPattern, routePattern) => layoutPattern === "/" || routePattern === layoutPattern || routePattern.startsWith(`${layoutPattern}/`), "layoutAppliesToRoute");
|
|
1958
1914
|
const adapterOwnsDocsRuntime = Boolean(
|
|
1959
|
-
|
|
1915
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _34 => _34.docs, 'optionalAccess', _35 => _35.enabled]) && _optionalChain([config, 'access', _36 => _36.docs, 'access', _37 => _37.adapter, 'optionalAccess', _38 => _38.server]) && config.docs.adapter.react
|
|
1960
1916
|
);
|
|
1961
|
-
const adapterDocsEntry = _optionalChain([config, 'access',
|
|
1917
|
+
const adapterDocsEntry = _optionalChain([config, 'access', _39 => _39.docs, 'optionalAccess', _40 => _40.enabled]) ? `/${config.docs.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/" : null;
|
|
1962
1918
|
const isAdapterDocsRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (routePattern) => Boolean(
|
|
1963
1919
|
adapterOwnsDocsRuntime && adapterDocsEntry && (adapterDocsEntry === "/" || routePattern === adapterDocsEntry || routePattern.startsWith(`${adapterDocsEntry}/`))
|
|
1964
1920
|
), "isAdapterDocsRoute");
|
|
1965
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
1921
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _41 => _41.docs, 'optionalAccess', _42 => _42.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
1966
1922
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
1967
|
-
const markdownPagePlan =
|
|
1923
|
+
const markdownPagePlan = _chunkP5HSJCXIcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
1968
1924
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
1969
1925
|
root,
|
|
1970
1926
|
isolatedMode,
|
|
@@ -1980,7 +1936,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1980
1936
|
planOptions
|
|
1981
1937
|
)
|
|
1982
1938
|
}));
|
|
1983
|
-
|
|
1939
|
+
_chunkP5HSJCXIcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
1984
1940
|
clientLayouts.map((layout) => ({
|
|
1985
1941
|
pattern: layout.pattern,
|
|
1986
1942
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2012,7 +1968,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2012
1968
|
for (const layout of clientLayouts) {
|
|
2013
1969
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, route.pattern)) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
|
|
2014
1970
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2015
|
-
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${
|
|
1971
|
+
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkP5HSJCXIcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2016
1972
|
}
|
|
2017
1973
|
}
|
|
2018
1974
|
if (isolatedMode === "analyze") {
|
|
@@ -2036,7 +1992,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2036
1992
|
);
|
|
2037
1993
|
if (metadata.suppressedAsyncHydration) {
|
|
2038
1994
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
2039
|
-
`\u26A0\uFE0F ${
|
|
1995
|
+
`\u26A0\uFE0F ${_chunkP5HSJCXIcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2040
1996
|
);
|
|
2041
1997
|
}
|
|
2042
1998
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2095,7 +2051,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2095
2051
|
}
|
|
2096
2052
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2097
2053
|
try {
|
|
2098
|
-
return
|
|
2054
|
+
return _chunkP5HSJCXIcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2099
2055
|
} catch (error) {
|
|
2100
2056
|
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2101
2057
|
return false;
|
|
@@ -2116,8 +2072,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2116
2072
|
srcDir,
|
|
2117
2073
|
adapterOwnsDocsRuntime ? false : _chunkMWWVKDW3cjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2118
2074
|
adapterOwnsDocsRuntime ? void 0 : _chunkMWWVKDW3cjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2119
|
-
_optionalChain([config, 'access',
|
|
2120
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access',
|
|
2075
|
+
_optionalChain([config, 'access', _43 => _43.docs, 'optionalAccess', _44 => _44.enabled]) ? config.docs.entry : void 0,
|
|
2076
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _45 => _45.docs, 'access', _46 => _46.adapter, 'optionalAccess', _47 => _47.react]) : void 0,
|
|
2121
2077
|
config.i18n,
|
|
2122
2078
|
config.plugins,
|
|
2123
2079
|
config.renderer,
|
|
@@ -2125,14 +2081,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2125
2081
|
config.trailingSlash,
|
|
2126
2082
|
_chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2127
2083
|
config.basePath,
|
|
2128
|
-
|
|
2084
|
+
_chunkP5HSJCXIcjs.generateClientCachePersistenceCode.call(void 0, _chunkP5HSJCXIcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2129
2085
|
adapterOwnsDocsRuntime ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2130
2086
|
);
|
|
2131
2087
|
await fs.writeFile(clientEntryPath, clientHydrationCode);
|
|
2132
2088
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2133
2089
|
let postcssSearchPath;
|
|
2134
2090
|
let tailwindVitePlugin = void 0;
|
|
2135
|
-
const rendererVitePlugins = await
|
|
2091
|
+
const rendererVitePlugins = await _chunkPSV6XKPOcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
2136
2092
|
ssr: false,
|
|
2137
2093
|
buildLifetime: rendererBuildLifetime
|
|
2138
2094
|
});
|
|
@@ -2142,15 +2098,10 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2142
2098
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2143
2099
|
await fs.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2144
2100
|
postcssSearchPath = clientEntryDir;
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
} catch (error) {
|
|
2150
|
-
_chunk5QIKR7RRcjs.logger.warn(
|
|
2151
|
-
`Tailwind plugin auto-enable failed; continuing without it: ${error.message}`
|
|
2152
|
-
);
|
|
2153
|
-
}
|
|
2101
|
+
tailwindVitePlugin = await _chunkP5HSJCXIcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2102
|
+
builder: productionVite.builder,
|
|
2103
|
+
announce: true
|
|
2104
|
+
});
|
|
2154
2105
|
}
|
|
2155
2106
|
try {
|
|
2156
2107
|
const clientViteConfig = {
|
|
@@ -2180,7 +2131,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2180
2131
|
hashCharacters: "hex",
|
|
2181
2132
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2182
2133
|
assetFileNames: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (assetInfo) => {
|
|
2183
|
-
if (_optionalChain([assetInfo, 'access',
|
|
2134
|
+
if (_optionalChain([assetInfo, 'access', _48 => _48.name, 'optionalAccess', _49 => _49.endsWith, 'call', _50 => _50(".css")])) {
|
|
2184
2135
|
return "farm-client.css";
|
|
2185
2136
|
}
|
|
2186
2137
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -2216,7 +2167,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2216
2167
|
}
|
|
2217
2168
|
},
|
|
2218
2169
|
plugins: [
|
|
2219
|
-
|
|
2170
|
+
_chunkP5HSJCXIcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2220
2171
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
2221
2172
|
...rendererVitePlugins,
|
|
2222
2173
|
...config.vite.plugins || [],
|
|
@@ -2277,7 +2228,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2277
2228
|
} : void 0,
|
|
2278
2229
|
// Ensure React is bundled for client
|
|
2279
2230
|
resolve: {
|
|
2280
|
-
alias:
|
|
2231
|
+
alias: _chunkP5HSJCXIcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2281
2232
|
dedupe: [...config.renderer.dedupe || []]
|
|
2282
2233
|
},
|
|
2283
2234
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2290,7 +2241,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2290
2241
|
]
|
|
2291
2242
|
}
|
|
2292
2243
|
};
|
|
2293
|
-
await viteBuild(
|
|
2244
|
+
await viteBuild(_chunkP5HSJCXIcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2294
2245
|
await mergeBuiltFontCss(outputDir);
|
|
2295
2246
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2296
2247
|
} finally {
|
|
@@ -3047,17 +2998,20 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3047
2998
|
secure: false
|
|
3048
2999
|
},
|
|
3049
3000
|
direction: {}
|
|
3050
|
-
}, plugins = [], renderer =
|
|
3001
|
+
}, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
3051
3002
|
const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
|
|
3052
|
-
const clientPluginEntry =
|
|
3003
|
+
const clientPluginEntry = _chunkP5HSJCXIcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3053
3004
|
plugins,
|
|
3054
3005
|
root,
|
|
3055
3006
|
srcDir,
|
|
3056
3007
|
publicRuntimeConfig
|
|
3057
3008
|
);
|
|
3058
|
-
const
|
|
3059
|
-
|
|
3060
|
-
|
|
3009
|
+
const appSetupPath = _chunkPSV6XKPOcjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
|
|
3010
|
+
const rendererClientImports = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
|
|
3011
|
+
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3012
|
+
import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3013
|
+
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3014
|
+
const providerClientCode = _chunkP5HSJCXIcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3061
3015
|
integrationProviders,
|
|
3062
3016
|
root,
|
|
3063
3017
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3542,7 +3496,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3542
3496
|
});
|
|
3543
3497
|
}
|
|
3544
3498
|
|
|
3545
|
-
${
|
|
3499
|
+
${_chunkP5HSJCXIcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
3546
3500
|
// Wrap a page element with applicable layouts
|
|
3547
3501
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
3548
3502
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -3643,7 +3597,7 @@ function createFarmRouteState(page, pathname, params, includeLayouts) {
|
|
|
3643
3597
|
}
|
|
3644
3598
|
|
|
3645
3599
|
function hydrateFarmRoute(container, route) {
|
|
3646
|
-
${
|
|
3600
|
+
${_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);"}
|
|
3647
3601
|
}
|
|
3648
3602
|
|
|
3649
3603
|
function renderFarmRoute(root, route) {
|
|
@@ -4447,7 +4401,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4447
4401
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
4448
4402
|
let postcssConfigDir;
|
|
4449
4403
|
let tailwindVitePlugin = void 0;
|
|
4450
|
-
const rendererVitePlugins = await
|
|
4404
|
+
const rendererVitePlugins = await _chunkPSV6XKPOcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
4451
4405
|
ssr: true,
|
|
4452
4406
|
buildLifetime: rendererBuildLifetime
|
|
4453
4407
|
});
|
|
@@ -4457,14 +4411,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4457
4411
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
4458
4412
|
"module.exports = { plugins: [] };\n"
|
|
4459
4413
|
);
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
}
|
|
4464
|
-
_chunk5QIKR7RRcjs.logger.warn(
|
|
4465
|
-
`Tailwind plugin auto-enable failed for SSR; continuing without it: ${error.message}`
|
|
4466
|
-
);
|
|
4467
|
-
}
|
|
4414
|
+
tailwindVitePlugin = await _chunkP5HSJCXIcjs.loadTailwindVitePlugin.call(void 0, {
|
|
4415
|
+
builder: productionVite.builder,
|
|
4416
|
+
label: "for SSR"
|
|
4417
|
+
});
|
|
4468
4418
|
}
|
|
4469
4419
|
let ssrBundle;
|
|
4470
4420
|
let ssrEntryFile;
|
|
@@ -4556,7 +4506,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4556
4506
|
}
|
|
4557
4507
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
4558
4508
|
const instrumentationPath = _chunkRTHIVJ2Gcjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
4559
|
-
const notFoundPath =
|
|
4509
|
+
const notFoundPath = _chunkP5HSJCXIcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
4560
4510
|
if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
4561
4511
|
layoutRoutes.sort((a, b) => {
|
|
4562
4512
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -4577,9 +4527,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4577
4527
|
(provider) => provider.component || provider.type === "clerk"
|
|
4578
4528
|
);
|
|
4579
4529
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
4580
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
4530
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _51 => _51.mdx, 'optionalAccess', _52 => _52.components]));
|
|
4581
4531
|
const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
|
|
4582
|
-
const hasRouteContextConfig =
|
|
4532
|
+
const hasRouteContextConfig = _chunkGXXONIARcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
4583
4533
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
4584
4534
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
4585
4535
|
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
@@ -4588,7 +4538,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4588
4538
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
4589
4539
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
4590
4540
|
);
|
|
4591
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
4541
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _53 => _53.docs, 'optionalAccess', _54 => _54.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _55 => _55.docs, 'access', _56 => _56.adapter, 'optionalAccess', _57 => _57.server]) ? await _chunkQ3PX2TGLcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
4592
4542
|
root,
|
|
4593
4543
|
srcDir: config.srcDir,
|
|
4594
4544
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -4631,7 +4581,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4631
4581
|
);
|
|
4632
4582
|
const virtualEntryId = "\0virtual:farm-ssr-entry";
|
|
4633
4583
|
const useExternalMetadataImageRuntime = shouldUseExternalMetadataImageRuntime(preset, true);
|
|
4634
|
-
const rendererOptionalExternals =
|
|
4584
|
+
const rendererOptionalExternals = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) ? [] : [
|
|
4635
4585
|
"react",
|
|
4636
4586
|
"react/jsx-runtime",
|
|
4637
4587
|
"react/jsx-dev-runtime",
|
|
@@ -4685,7 +4635,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4685
4635
|
// Adapters can render provider scripts by serializing function source.
|
|
4686
4636
|
// keepNames injects helper calls into those functions; after Nitro
|
|
4687
4637
|
// minifies the server chunk the helper is no longer in script scope.
|
|
4688
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
4638
|
+
keepNames: !(_optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server])),
|
|
4689
4639
|
jsxDev: false
|
|
4690
4640
|
},
|
|
4691
4641
|
// SSR configuration to externalize problematic modules
|
|
@@ -4732,10 +4682,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4732
4682
|
define: {
|
|
4733
4683
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
4734
4684
|
__FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
|
|
4735
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
4685
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _63 => _63.env, 'optionalAccess', _64 => _64.public]) || {})
|
|
4736
4686
|
},
|
|
4737
4687
|
plugins: [
|
|
4738
|
-
|
|
4688
|
+
_chunkP5HSJCXIcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
4739
4689
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
4740
4690
|
...rendererVitePlugins,
|
|
4741
4691
|
...config.vite.plugins || [],
|
|
@@ -4794,7 +4744,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4794
4744
|
resolve: {
|
|
4795
4745
|
alias: [
|
|
4796
4746
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
4797
|
-
...Object.entries(
|
|
4747
|
+
...Object.entries(_chunkP5HSJCXIcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
4798
4748
|
([find, replacement]) => ({ find, replacement })
|
|
4799
4749
|
)
|
|
4800
4750
|
],
|
|
@@ -4802,7 +4752,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4802
4752
|
dedupe: [...config.renderer.dedupe || []]
|
|
4803
4753
|
}
|
|
4804
4754
|
};
|
|
4805
|
-
await viteBuild(
|
|
4755
|
+
await viteBuild(_chunkP5HSJCXIcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
4806
4756
|
} finally {
|
|
4807
4757
|
if (postcssConfigDir) {
|
|
4808
4758
|
try {
|
|
@@ -4819,15 +4769,15 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4819
4769
|
}
|
|
4820
4770
|
_chunkS3JO3N4Hcjs.__name.call(void 0, buildSSRInMemory, "buildSSRInMemory");
|
|
4821
4771
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
4822
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
4772
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _65 => _65.llmsTxt]);
|
|
4823
4773
|
const ownedByFile = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (kind) => applicationMetadataRoutes.some(
|
|
4824
4774
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
4825
4775
|
), "ownedByFile");
|
|
4826
4776
|
return [
|
|
4827
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
4828
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
4777
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _66 => _66.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
4778
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _67 => _67.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
4829
4779
|
...ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
4830
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
4780
|
+
..._optionalChain([agent, 'optionalAccess', _68 => _68.crawlers, 'optionalAccess', _69 => _69.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
4831
4781
|
];
|
|
4832
4782
|
}
|
|
4833
4783
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmAppOwnedDocsEnginePaths, "getFarmAppOwnedDocsEnginePaths");
|
|
@@ -4869,7 +4819,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
4869
4819
|
}
|
|
4870
4820
|
_chunkS3JO3N4Hcjs.__name.call(void 0, toVirtualEntryImportSpecifier, "toVirtualEntryImportSpecifier");
|
|
4871
4821
|
function generateNativeAuthIntegrationSource(auth) {
|
|
4872
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
4822
|
+
if (_optionalChain([auth, 'optionalAccess', _70 => _70.enabled]) !== true) {
|
|
4873
4823
|
return { importSource: "", registerSource: "" };
|
|
4874
4824
|
}
|
|
4875
4825
|
return {
|
|
@@ -4884,7 +4834,7 @@ function generateNativeAuthIntegrationSource(auth) {
|
|
|
4884
4834
|
}
|
|
4885
4835
|
_chunkS3JO3N4Hcjs.__name.call(void 0, generateNativeAuthIntegrationSource, "generateNativeAuthIntegrationSource");
|
|
4886
4836
|
function generateNativeMCPPluginSource(mcp) {
|
|
4887
|
-
if (_optionalChain([mcp, 'optionalAccess',
|
|
4837
|
+
if (_optionalChain([mcp, 'optionalAccess', _71 => _71.enabled]) !== true) {
|
|
4888
4838
|
return { importSource: "", registerSource: "", pluginSource: "" };
|
|
4889
4839
|
}
|
|
4890
4840
|
return {
|
|
@@ -5013,8 +4963,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateConfiguredResponseHeadersRuntimeSo
|
|
|
5013
4963
|
function parseRouteRenderingDirectiveFromDisk(modulePath) {
|
|
5014
4964
|
try {
|
|
5015
4965
|
const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
|
|
5016
|
-
const directive =
|
|
5017
|
-
if (
|
|
4966
|
+
const directive = _chunkSO7CRMP6cjs.parseRouteRenderingDirective.call(void 0, source);
|
|
4967
|
+
if (_chunkSO7CRMP6cjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
|
|
5018
4968
|
return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
|
|
5019
4969
|
} catch (e22) {
|
|
5020
4970
|
return void 0;
|
|
@@ -5124,25 +5074,36 @@ async function applyFarmPreloadBudget(response, pathname, request) {
|
|
|
5124
5074
|
`.trim();
|
|
5125
5075
|
}
|
|
5126
5076
|
_chunkS3JO3N4Hcjs.__name.call(void 0, generatePreloadResponseRuntimeSource, "generatePreloadResponseRuntimeSource");
|
|
5077
|
+
function generateFarmRendererAppSetupServerCode(config) {
|
|
5078
|
+
const appSetupPath = _chunkPSV6XKPOcjs.resolveFarmRendererAppSetup.call(void 0, config.root || process.cwd(), config.renderer);
|
|
5079
|
+
if (!appSetupPath) return "";
|
|
5080
|
+
return `
|
|
5081
|
+
import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
5082
|
+
if (typeof ReactDOMServer.configureApp !== "function") {
|
|
5083
|
+
throw new Error(${JSON.stringify(`Renderer \`${config.renderer.name}\` does not support \`appSetup\`: its server module must export configureApp().`)});
|
|
5084
|
+
}
|
|
5085
|
+
ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
5086
|
+
}
|
|
5087
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, generateFarmRendererAppSetupServerCode, "generateFarmRendererAppSetupServerCode");
|
|
5127
5088
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache) {
|
|
5128
5089
|
const hasCompressionRuntime = config.compress && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5129
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
5090
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _72 => _72.agent, 'optionalAccess', _73 => _73.crawlers, 'optionalAccess', _74 => _74.enabled])) && !applicationMetadataRoutes.some(
|
|
5130
5091
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
5131
5092
|
);
|
|
5132
5093
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
5133
5094
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5134
5095
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
5135
5096
|
const adapterOwnsDocsRuntime = Boolean(
|
|
5136
|
-
|
|
5097
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _75 => _75.docs, 'optionalAccess', _76 => _76.enabled]) && _optionalChain([config, 'access', _77 => _77.docs, 'access', _78 => _78.adapter, 'optionalAccess', _79 => _79.server]) && config.docs.adapter.react
|
|
5137
5098
|
);
|
|
5138
5099
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
5139
|
-
const hasIsolatedClientGraphRuntime =
|
|
5140
|
-
const rendererStreamingCapabilities =
|
|
5100
|
+
const hasIsolatedClientGraphRuntime = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
5101
|
+
const rendererStreamingCapabilities = _chunkPSV6XKPOcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
|
|
5141
5102
|
config.renderer,
|
|
5142
5103
|
_chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset)
|
|
5143
5104
|
);
|
|
5144
|
-
const rendererServerImports =
|
|
5145
|
-
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)}
|
|
5105
|
+
const rendererServerImports = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
5106
|
+
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
|
|
5146
5107
|
const routeClientGraphServerRuntime = hasIsolatedClientGraphRuntime ? `function wrapFarmRouteClientGraph(element) {
|
|
5147
5108
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
5148
5109
|
}
|
|
@@ -5158,26 +5119,26 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5158
5119
|
(image) => image.sourceType === "module"
|
|
5159
5120
|
);
|
|
5160
5121
|
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || hasFarmMiddlewareConfig(config.middleware);
|
|
5161
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
5122
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _80 => _80.docs, 'optionalAccess', _81 => _81.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
5162
5123
|
const integrationProviders = _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
5163
5124
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
5164
5125
|
(provider) => provider.component || provider.type === "clerk"
|
|
5165
5126
|
);
|
|
5166
|
-
if (renderedIntegrationProviders.length > 0 && !
|
|
5127
|
+
if (renderedIntegrationProviders.length > 0 && !_chunkPSV6XKPOcjs.getFarmRendererCapabilities.call(void 0, config.renderer).functionComponents) {
|
|
5167
5128
|
throw new Error(
|
|
5168
5129
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
5169
5130
|
);
|
|
5170
5131
|
}
|
|
5171
|
-
const providerServerModules =
|
|
5132
|
+
const providerServerModules = _chunkP5HSJCXIcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
5172
5133
|
renderedIntegrationProviders,
|
|
5173
5134
|
config.root,
|
|
5174
5135
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
5175
5136
|
);
|
|
5176
5137
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
5177
5138
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
5178
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
5139
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _82 => _82.providers]);
|
|
5179
5140
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
5180
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
5141
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _83 => _83.component]) === "function")) {
|
|
5181
5142
|
throw new Error(
|
|
5182
5143
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
5183
5144
|
);
|
|
@@ -5188,14 +5149,14 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5188
5149
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
5189
5150
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
5190
5151
|
);
|
|
5191
|
-
const isolatedHydrationMode =
|
|
5192
|
-
_optionalChain([config, 'access',
|
|
5152
|
+
const isolatedHydrationMode = _chunkP5HSJCXIcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
5153
|
+
_optionalChain([config, 'access', _84 => _84.experimental, 'optionalAccess', _85 => _85.isolatedClientHydration]),
|
|
5193
5154
|
{
|
|
5194
|
-
serverComponents: _optionalChain([config, 'access',
|
|
5155
|
+
serverComponents: _optionalChain([config, 'access', _86 => _86.experimental, 'optionalAccess', _87 => _87.serverComponents]) === true,
|
|
5195
5156
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
5196
5157
|
}
|
|
5197
5158
|
);
|
|
5198
|
-
const hydrationPlanOptions =
|
|
5159
|
+
const hydrationPlanOptions = _chunkP5HSJCXIcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
5199
5160
|
config.renderer,
|
|
5200
5161
|
Boolean(unsupportedIntegrationProvider)
|
|
5201
5162
|
);
|
|
@@ -5210,7 +5171,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5210
5171
|
hydrationPlanOptions
|
|
5211
5172
|
)
|
|
5212
5173
|
}));
|
|
5213
|
-
const markdownPagePlan =
|
|
5174
|
+
const markdownPagePlan = _chunkP5HSJCXIcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
5214
5175
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
5215
5176
|
config.root,
|
|
5216
5177
|
isolatedHydrationMode,
|
|
@@ -5228,7 +5189,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5228
5189
|
)
|
|
5229
5190
|
])
|
|
5230
5191
|
);
|
|
5231
|
-
|
|
5192
|
+
_chunkP5HSJCXIcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
5232
5193
|
layoutHydrationPlans.map((layout) => ({
|
|
5233
5194
|
pattern: layout.pattern,
|
|
5234
5195
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -5256,7 +5217,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5256
5217
|
apiRegistrations.push(`
|
|
5257
5218
|
{
|
|
5258
5219
|
path: ${JSON.stringify(route.path)},
|
|
5259
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
5220
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _88 => _88.pluginMethods, 'optionalAccess', _89 => _89.includes, 'call', _90 => _90(method)])))},
|
|
5260
5221
|
endpoints: ${varName},
|
|
5261
5222
|
}`);
|
|
5262
5223
|
});
|
|
@@ -5487,25 +5448,25 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5487
5448
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
5488
5449
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
5489
5450
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
5490
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
5451
|
+
const docsHandlerImport = _optionalChain([config, 'access', _91 => _91.docs, 'optionalAccess', _92 => _92.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
5491
5452
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
5492
5453
|
const pathname = typeof requestOrPathname === "string"
|
|
5493
5454
|
? requestOrPathname
|
|
5494
5455
|
: new URL(requestOrPathname.url).pathname;
|
|
5495
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
5456
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _93 => _93.apiPath]) || "/api/docs")};
|
|
5496
5457
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
5497
5458
|
};` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
5498
5459
|
import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
|
|
5499
5460
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
5500
5461
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
5501
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
5502
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
5462
|
+
const docsFontImport = _optionalChain([config, 'access', _94 => _94.docs, 'optionalAccess', _95 => _95.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
5463
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _96 => _96.docs, 'optionalAccess', _97 => _97.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
5503
5464
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
5504
5465
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
5505
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
5466
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _98 => _98.md, 'optionalAccess', _99 => _99.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
5506
5467
|
const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;";
|
|
5507
5468
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
5508
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
5469
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _100 => _100.mdx, 'optionalAccess', _101 => _101.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
5509
5470
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
5510
5471
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
5511
5472
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -5709,7 +5670,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
5709
5670
|
|
|
5710
5671
|
function FarmDefault404Page() {
|
|
5711
5672
|
return React.createElement(React.Fragment, null,
|
|
5712
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
5673
|
+
React.createElement("style", null, ${JSON.stringify(_chunkP5HSJCXIcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
5713
5674
|
React.createElement("main", {
|
|
5714
5675
|
className: "farm-default-not-found",
|
|
5715
5676
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -5837,14 +5798,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
5837
5798
|
onError(error) { console.error("[Farm Image]", error); },
|
|
5838
5799
|
})`};
|
|
5839
5800
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
5840
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
5801
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _102 => _102.agent, 'optionalAccess', _103 => _103.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
5841
5802
|
${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
5842
5803
|
const farmMdxConfig = ${JSON.stringify({
|
|
5843
5804
|
...config.mdx,
|
|
5844
|
-
components: typeof _optionalChain([config, 'access',
|
|
5805
|
+
components: typeof _optionalChain([config, 'access', _104 => _104.mdx, 'optionalAccess', _105 => _105.components]) === "string" ? config.mdx.components : void 0
|
|
5845
5806
|
})};
|
|
5846
5807
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
5847
|
-
${_optionalChain([config, 'access',
|
|
5808
|
+
${_optionalChain([config, 'access', _106 => _106.agent, 'optionalAccess', _107 => _107.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
5848
5809
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
5849
5810
|
// to the build.
|
|
5850
5811
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
@@ -5892,7 +5853,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
5892
5853
|
});
|
|
5893
5854
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
5894
5855
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
5895
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
5856
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
5896
5857
|
try {
|
|
5897
5858
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
5898
5859
|
const candidates = [
|
|
@@ -5913,7 +5874,7 @@ globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
|
|
|
5913
5874
|
docs: farmDocsResolvedConfig,
|
|
5914
5875
|
};
|
|
5915
5876
|
const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
|
|
5916
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
5877
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _110 => _110.docs, 'optionalAccess', _111 => _111.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
|
|
5917
5878
|
${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
|
|
5918
5879
|
entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
|
|
5919
5880
|
docsPath: farmDocsResolvedConfig.entry,
|
|
@@ -5941,7 +5902,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _113 => _113.docs, '
|
|
|
5941
5902
|
fontStylesheetHref: "/farm-fonts.css",
|
|
5942
5903
|
globalStylesheetHref: "/assets/globals.css",
|
|
5943
5904
|
})` : "null"};
|
|
5944
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
5905
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _112 => _112.docs, 'optionalAccess', _113 => _113.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
|
|
5945
5906
|
|
|
5946
5907
|
// API routes bundled at build time
|
|
5947
5908
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -7052,7 +7013,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
7052
7013
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
7053
7014
|
return true;
|
|
7054
7015
|
}
|
|
7055
|
-
${_optionalChain([config, 'access',
|
|
7016
|
+
${_optionalChain([config, 'access', _114 => _114.docs, 'optionalAccess', _115 => _115.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
7056
7017
|
if (
|
|
7057
7018
|
isFarmDocsAPIRequest(pathname) ||
|
|
7058
7019
|
docsPath === "/" ||
|
|
@@ -7078,7 +7039,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
7078
7039
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
7079
7040
|
};
|
|
7080
7041
|
}
|
|
7081
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
7042
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _116 => _116.docs, 'optionalAccess', _117 => _117.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
7082
7043
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
7083
7044
|
pathname,
|
|
7084
7045
|
method: request.method,
|
|
@@ -7168,7 +7129,7 @@ function getApplicableLayouts(pathname) {
|
|
|
7168
7129
|
return applicable;
|
|
7169
7130
|
}
|
|
7170
7131
|
|
|
7171
|
-
${_optionalChain([config, 'access',
|
|
7132
|
+
${_optionalChain([config, 'access', _118 => _118.docs, 'optionalAccess', _119 => _119.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
7172
7133
|
if (request.method === "HEAD") return response;
|
|
7173
7134
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
7174
7135
|
|
|
@@ -7275,7 +7236,7 @@ ${_optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 =>
|
|
|
7275
7236
|
}` : ""}
|
|
7276
7237
|
|
|
7277
7238
|
const pprShellCache = getFarmDataCache();
|
|
7278
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
7239
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _120 => _120.experimental, 'optionalAccess', _121 => _121.ppr]) === true)};
|
|
7279
7240
|
|
|
7280
7241
|
function resolveRouteRenderingView(route) {
|
|
7281
7242
|
// The same merge development uses: baked directive config under the
|
|
@@ -7398,7 +7359,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
7398
7359
|
},
|
|
7399
7360
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
7400
7361
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
7401
|
-
${_optionalChain([config, 'access',
|
|
7362
|
+
${_optionalChain([config, 'access', _122 => _122.md, 'optionalAccess', _123 => _123.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
7402
7363
|
if (matchPageRoute(pathname)) {
|
|
7403
7364
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
7404
7365
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -7517,7 +7478,7 @@ async function handleFarmRequestInContext(
|
|
|
7517
7478
|
const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(undefined, farmIntegrationSetCookies)" : "undefined"};
|
|
7518
7479
|
`}
|
|
7519
7480
|
|
|
7520
|
-
${_optionalChain([config, 'access',
|
|
7481
|
+
${_optionalChain([config, 'access', _124 => _124.docs, 'optionalAccess', _125 => _125.enabled]) ? `
|
|
7521
7482
|
// Docs responses are served after app middleware so route guards and
|
|
7522
7483
|
// middleware headers apply to the docs engine like any other page content.
|
|
7523
7484
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -7562,7 +7523,7 @@ async function handleFarmRequestInContext(
|
|
|
7562
7523
|
}
|
|
7563
7524
|
` : ""}
|
|
7564
7525
|
|
|
7565
|
-
${_optionalChain([config, 'access',
|
|
7526
|
+
${_optionalChain([config, 'access', _126 => _126.md, 'optionalAccess', _127 => _127.enabled]) ? `
|
|
7566
7527
|
if (farmMarkdownConfig?.enabled) {
|
|
7567
7528
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
7568
7529
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -7665,11 +7626,11 @@ async function handleFarmRequestInContext(
|
|
|
7665
7626
|
);
|
|
7666
7627
|
}
|
|
7667
7628
|
` : ""}
|
|
7668
|
-
${_optionalChain([config, 'access',
|
|
7629
|
+
${_optionalChain([config, 'access', _128 => _128.agent, 'optionalAccess', _129 => _129.llmsTxt, 'optionalAccess', _130 => _130.enabled]) ? `
|
|
7669
7630
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
7670
7631
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
7671
7632
|
? "llms"
|
|
7672
|
-
: ${_optionalChain([config, 'access',
|
|
7633
|
+
: ${_optionalChain([config, 'access', _131 => _131.agent, 'optionalAccess', _132 => _132.llmsTxt, 'optionalAccess', _133 => _133.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
7673
7634
|
if (farmGeneratedLlmsKind) {
|
|
7674
7635
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
7675
7636
|
const llmsBody = farmGeneratedLlmsKind === "llms-full"
|
|
@@ -7690,7 +7651,7 @@ async function handleFarmRequestInContext(
|
|
|
7690
7651
|
}
|
|
7691
7652
|
` : ""}
|
|
7692
7653
|
|
|
7693
|
-
${_optionalChain([config, 'access',
|
|
7654
|
+
${_optionalChain([config, 'access', _134 => _134.docs, 'optionalAccess', _135 => _135.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
7694
7655
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
7695
7656
|
if (docsAPIResponse) {
|
|
7696
7657
|
return applyProductionMiddlewareHeaders(docsAPIResponse, middlewareHeaders);
|
|
@@ -8125,7 +8086,7 @@ async function handleFarmRequestInContext(
|
|
|
8125
8086
|
);
|
|
8126
8087
|
}
|
|
8127
8088
|
}
|
|
8128
|
-
${_optionalChain([config, 'access',
|
|
8089
|
+
${_optionalChain([config, 'access', _136 => _136.md, 'optionalAccess', _137 => _137.enabled]) ? `
|
|
8129
8090
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
8130
8091
|
// using the public path the .md request will be resolved against.
|
|
8131
8092
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -8133,7 +8094,7 @@ async function handleFarmRequestInContext(
|
|
|
8133
8094
|
getFarmMarkdownAlternatePath(farmMarkdownConfig, pathname),
|
|
8134
8095
|
);` : ""}
|
|
8135
8096
|
|
|
8136
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
8097
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _138 => _138.agent, 'optionalAccess', _139 => _139.jsonLd]), () => ( false)))} });
|
|
8137
8098
|
const title = renderedMetadata.title;
|
|
8138
8099
|
const metaTags = renderedMetadata.tags;
|
|
8139
8100
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -8748,11 +8709,11 @@ ${generatePreloadResponseRuntimeSource()}
|
|
|
8748
8709
|
|
|
8749
8710
|
// Export as Web Standard fetch API
|
|
8750
8711
|
export async function fetch(request, context) {
|
|
8751
|
-
${_optionalChain([config, 'access',
|
|
8712
|
+
${_optionalChain([config, 'access', _140 => _140.agent, 'optionalAccess', _141 => _141.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
8752
8713
|
basePath: farmLocalAPIBasePath,
|
|
8753
8714
|
dispatch: async (localRequest) =>
|
|
8754
8715
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
8755
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
8716
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _142 => _142.agent, 'optionalAccess', _143 => _143.noindexPreviews]) ? `
|
|
8756
8717
|
// Keep every response of a preview deployment out of search indexes.
|
|
8757
8718
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
8758
8719
|
}
|
|
@@ -8895,7 +8856,7 @@ function configMiddlewareMayHandlePath(config, pathname) {
|
|
|
8895
8856
|
if (!hasFarmMiddlewareConfig(config)) return false;
|
|
8896
8857
|
const entries = Array.isArray(config) ? config : [config];
|
|
8897
8858
|
return entries.some((entry) => {
|
|
8898
|
-
if (_optionalChain([entry, 'access',
|
|
8859
|
+
if (_optionalChain([entry, 'access', _144 => _144.exclude, 'optionalAccess', _145 => _145.some, 'call', _146 => _146((pattern) => middlewarePatternMatches(pattern, pathname))])) {
|
|
8899
8860
|
return false;
|
|
8900
8861
|
}
|
|
8901
8862
|
if (!entry.matcher) return true;
|
|
@@ -8951,11 +8912,11 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
8951
8912
|
}
|
|
8952
8913
|
if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
|
|
8953
8914
|
if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
|
|
8954
|
-
if (
|
|
8915
|
+
if (_chunkGXXONIARcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
8955
8916
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
8956
8917
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
8957
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
8958
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
8918
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _147 => _147.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
8919
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _148 => _148.regions, 'optionalAccess', _149 => _149.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
8959
8920
|
return "route runtime controls";
|
|
8960
8921
|
}
|
|
8961
8922
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -8977,7 +8938,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
8977
8938
|
const nitroBuilder = nitroBuilderResult.value;
|
|
8978
8939
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
8979
8940
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
8980
|
-
const outputDir =
|
|
8941
|
+
const outputDir = _chunkGXXONIARcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
8981
8942
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
8982
8943
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
8983
8944
|
const imageRuntime = resolveImageRuntime(config, preset);
|
|
@@ -9308,9 +9269,9 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9308
9269
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
9309
9270
|
);
|
|
9310
9271
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
9311
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
9312
|
-
_optionalChain([nitroConfig, 'access',
|
|
9313
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
9272
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _150 => _150.rollupConfig, 'optionalAccess', _151 => _151.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _152 => _152.rollupConfig, 'optionalAccess', _153 => _153.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _154 => _154.output, 'optionalAccess', _155 => _155.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
9273
|
+
_optionalChain([nitroConfig, 'access', _156 => _156.handlers, 'optionalAccess', _157 => _157.some, 'call', _158 => _158(
|
|
9274
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _159 => _159.handler]) || "") === nitroEntryPath
|
|
9314
9275
|
)])
|
|
9315
9276
|
);
|
|
9316
9277
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
@@ -9321,14 +9282,14 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9321
9282
|
const resolvedEsbuildOptions = {
|
|
9322
9283
|
// Function-name helpers are unsafe for provider scripts that serialize a
|
|
9323
9284
|
// function with toString(); the helper is outside the emitted script scope.
|
|
9324
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
9285
|
+
keepNames: !(_optionalChain([config, 'access', _160 => _160.docs, 'optionalAccess', _161 => _161.enabled]) && _optionalChain([config, 'access', _162 => _162.docs, 'access', _163 => _163.adapter, 'optionalAccess', _164 => _164.server])),
|
|
9325
9286
|
legalComments: "none"
|
|
9326
9287
|
};
|
|
9327
|
-
const prebuiltSSREsbuildOptions = _optionalChain([config, 'access',
|
|
9288
|
+
const prebuiltSSREsbuildOptions = _optionalChain([config, 'access', _165 => _165.docs, 'optionalAccess', _166 => _166.enabled]) && _optionalChain([config, 'access', _167 => _167.docs, 'access', _168 => _168.adapter, 'optionalAccess', _169 => _169.server]) ? resolvedEsbuildOptions : configuredEsbuildOptions;
|
|
9328
9289
|
const useFarmEsbuildMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
9329
9290
|
const esbuildChunkMinifier = useFarmEsbuildMinifier ? createEsbuildChunkMinifyPlugin(resolvedEsbuildOptions) : null;
|
|
9330
9291
|
if (canReusePrebuiltSSR) {
|
|
9331
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
9292
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _170 => _170.rollupConfig, 'optionalAccess', _171 => _171.plugins]);
|
|
9332
9293
|
nitroConfig.rollupConfig = {
|
|
9333
9294
|
...nitroConfig.rollupConfig,
|
|
9334
9295
|
plugins: [
|
|
@@ -9341,7 +9302,7 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9341
9302
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
9342
9303
|
if (config.security.csp && config.security.csp.nonce) {
|
|
9343
9304
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
9344
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
9305
|
+
if (!route.contents || !_optionalChain([route, 'access', _172 => _172.contentType, 'optionalAccess', _173 => _173.toLowerCase, 'call', _174 => _174(), 'access', _175 => _175.includes, 'call', _176 => _176("html")])) return;
|
|
9345
9306
|
const staticCsp = await _chunkISTFC3MZcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
9346
9307
|
if (!staticCsp) return;
|
|
9347
9308
|
route.contents = staticCsp.html;
|
|
@@ -9422,7 +9383,7 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9422
9383
|
else process.env[_chunkYA6LLTIJcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
9423
9384
|
}
|
|
9424
9385
|
}
|
|
9425
|
-
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs) : Promise.resolve(null);
|
|
9386
|
+
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs, preset) : Promise.resolve(null);
|
|
9426
9387
|
const [nitroBuildResult, sharpRuntimeStageResult] = await Promise.allSettled([
|
|
9427
9388
|
nitroBuilder.build(nitroInstance),
|
|
9428
9389
|
sharpRuntimeStagePromise
|
|
@@ -9440,7 +9401,7 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9440
9401
|
if (sharpRuntimeStageResult.status === "rejected") {
|
|
9441
9402
|
throw sharpRuntimeStageResult.reason;
|
|
9442
9403
|
}
|
|
9443
|
-
const stagedSharpRuntime = await _asyncNullishCoalesce(sharpRuntimeStageResult.value, async () => ( (imageRuntime === "node" ? await stageSharpRuntime(config, root, distDir, fs) : null)));
|
|
9404
|
+
const stagedSharpRuntime = await _asyncNullishCoalesce(sharpRuntimeStageResult.value, async () => ( (imageRuntime === "node" ? await stageSharpRuntime(config, root, distDir, fs, preset) : null)));
|
|
9444
9405
|
const runtimeCopyPromise = (async () => {
|
|
9445
9406
|
if (stagedSharpRuntime) {
|
|
9446
9407
|
await installStagedSharpRuntime(stagedSharpRuntime, runtimeServerOutputDir, fs);
|
|
@@ -9559,7 +9520,7 @@ async function moveVercelOutputPath(src, dest, fs) {
|
|
|
9559
9520
|
await fs.rename(src, dest);
|
|
9560
9521
|
return;
|
|
9561
9522
|
} catch (error) {
|
|
9562
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
9523
|
+
const code = _optionalChain([error, 'optionalAccess', _177 => _177.code]);
|
|
9563
9524
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
9564
9525
|
throw error;
|
|
9565
9526
|
}
|
|
@@ -9586,7 +9547,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
|
|
|
9586
9547
|
try {
|
|
9587
9548
|
await moveVercelOutputPath(publicDir, staticDir, fs);
|
|
9588
9549
|
} catch (error) {
|
|
9589
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
9550
|
+
if (_optionalChain([error, 'optionalAccess', _178 => _178.code]) !== "ENOENT") throw error;
|
|
9590
9551
|
}
|
|
9591
9552
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs);
|
|
9592
9553
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs);
|
|
@@ -9636,7 +9597,24 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
|
|
|
9636
9597
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${_path2.default.relative(root, docsContentDir)}`);
|
|
9637
9598
|
}
|
|
9638
9599
|
_chunkS3JO3N4Hcjs.__name.call(void 0, copyFarmDocsContentForVercel, "copyFarmDocsContentForVercel");
|
|
9639
|
-
|
|
9600
|
+
function resolveServerFunctionPlatform(preset) {
|
|
9601
|
+
return preset === "vercel" || preset === "netlify" ? { os: "linux", cpu: "x64", libc: "glibc" } : null;
|
|
9602
|
+
}
|
|
9603
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveServerFunctionPlatform, "resolveServerFunctionPlatform");
|
|
9604
|
+
function packageSupportsPlatform(packageJson, platform) {
|
|
9605
|
+
return platformFieldAllows(packageJson.os, platform.os) && platformFieldAllows(packageJson.cpu, platform.cpu) && platformFieldAllows(packageJson.libc, platform.libc);
|
|
9606
|
+
}
|
|
9607
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, packageSupportsPlatform, "packageSupportsPlatform");
|
|
9608
|
+
function platformFieldAllows(field, value) {
|
|
9609
|
+
if (!Array.isArray(field)) return true;
|
|
9610
|
+
const entries = field.filter((entry) => typeof entry === "string");
|
|
9611
|
+
if (entries.includes(`!${value}`)) return false;
|
|
9612
|
+
const allowed = entries.filter((entry) => !entry.startsWith("!"));
|
|
9613
|
+
return allowed.length === 0 || allowed.includes(value);
|
|
9614
|
+
}
|
|
9615
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, platformFieldAllows, "platformFieldAllows");
|
|
9616
|
+
async function stageSharpRuntime(config, root, distDir, fs, preset) {
|
|
9617
|
+
const functionPlatform = resolveServerFunctionPlatform(preset);
|
|
9640
9618
|
const projectRequire = _module.createRequire.call(void 0, _path2.default.join(root, "package.json"));
|
|
9641
9619
|
let sharpRequire = projectRequire;
|
|
9642
9620
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
@@ -9663,6 +9641,7 @@ async function stageSharpRuntime(config, root, distDir, fs) {
|
|
|
9663
9641
|
const packageJsonPath = resolvePackageJson(parentRequire, packageName);
|
|
9664
9642
|
if (!packageJsonPath) return;
|
|
9665
9643
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
|
|
9644
|
+
if (functionPlatform && !packageSupportsPlatform(packageJson, functionPlatform)) return;
|
|
9666
9645
|
const packageDir = _path2.default.dirname(packageJsonPath);
|
|
9667
9646
|
const targetDir = _path2.default.join(targetNodeModules, ...packageName.split("/"));
|
|
9668
9647
|
copiedPackages.set(packageName, String(packageJson.version || "*"));
|
|
@@ -9897,7 +9876,7 @@ function createBuildTargetBaseline(config) {
|
|
|
9897
9876
|
preset,
|
|
9898
9877
|
distDir,
|
|
9899
9878
|
outputDir,
|
|
9900
|
-
outputWasDerived: outputDir ===
|
|
9879
|
+
outputWasDerived: outputDir === _chunkGXXONIARcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
9901
9880
|
};
|
|
9902
9881
|
}
|
|
9903
9882
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
|
|
@@ -9907,8 +9886,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
9907
9886
|
const distDir = config.distDir || ".farm";
|
|
9908
9887
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
9909
9888
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
9910
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
9911
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
9889
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkGXXONIARcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
9890
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkGXXONIARcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
9912
9891
|
return {
|
|
9913
9892
|
root,
|
|
9914
9893
|
preset,
|
|
@@ -9916,7 +9895,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
9916
9895
|
distDir,
|
|
9917
9896
|
deployTarget,
|
|
9918
9897
|
outputDir,
|
|
9919
|
-
deployOutputDir:
|
|
9898
|
+
deployOutputDir: _chunkGXXONIARcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
9920
9899
|
};
|
|
9921
9900
|
}
|
|
9922
9901
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
|
|
@@ -9925,7 +9904,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
9925
9904
|
const targetBaseline = createBuildTargetBaseline(config);
|
|
9926
9905
|
let targets;
|
|
9927
9906
|
const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
|
|
9928
|
-
const pluginManager = new (0,
|
|
9907
|
+
const pluginManager = new (0, _chunkP5HSJCXIcjs.PluginManager)({
|
|
9929
9908
|
config,
|
|
9930
9909
|
isDev: false,
|
|
9931
9910
|
isProd: true
|
|
@@ -9965,8 +9944,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
9965
9944
|
});
|
|
9966
9945
|
_chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
9967
9946
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
9968
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
9969
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
9947
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _179 => _179.status]) === "rejected") throw productionViteResult.reason;
|
|
9948
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _180 => _180.value]);
|
|
9970
9949
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
9971
9950
|
projectModuleServer = await createProjectModuleServer(
|
|
9972
9951
|
createViteServer,
|
|
@@ -9974,17 +9953,17 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
9974
9953
|
root,
|
|
9975
9954
|
rendererBuild.signal
|
|
9976
9955
|
);
|
|
9977
|
-
const farmApp =
|
|
9956
|
+
const farmApp = _chunkP5HSJCXIcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
9978
9957
|
await farmApp.initialize();
|
|
9979
9958
|
const routeManager = farmApp.getRouteManager();
|
|
9980
9959
|
const serverRenderer = farmApp.getServerRenderer();
|
|
9981
|
-
const typeArtifacts =
|
|
9960
|
+
const typeArtifacts = _chunkSO7CRMP6cjs.generateFarmTypeArtifacts.call(void 0, {
|
|
9982
9961
|
root,
|
|
9983
9962
|
srcDir,
|
|
9984
9963
|
layers: config.layers,
|
|
9985
9964
|
plugins: config.plugins,
|
|
9986
9965
|
extraRoutes: [
|
|
9987
|
-
..._optionalChain([config, 'access',
|
|
9966
|
+
..._optionalChain([config, 'access', _181 => _181.openapi, 'optionalAccess', _182 => _182.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
9988
9967
|
..._chunkNBAHDVOJcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
9989
9968
|
],
|
|
9990
9969
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
@@ -10069,7 +10048,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10069
10048
|
throw error;
|
|
10070
10049
|
} finally {
|
|
10071
10050
|
try {
|
|
10072
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
10051
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _183 => _183.close, 'call', _184 => _184()]);
|
|
10073
10052
|
} finally {
|
|
10074
10053
|
rendererBuild.abort();
|
|
10075
10054
|
}
|
|
@@ -10077,11 +10056,11 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10077
10056
|
}
|
|
10078
10057
|
_chunkS3JO3N4Hcjs.__name.call(void 0, buildWithProductionNodeEnv, "buildWithProductionNodeEnv");
|
|
10079
10058
|
async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
|
|
10080
|
-
const rendererVitePlugins = await
|
|
10059
|
+
const rendererVitePlugins = await _chunkPSV6XKPOcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
10081
10060
|
ssr: true,
|
|
10082
10061
|
buildLifetime
|
|
10083
10062
|
});
|
|
10084
|
-
const viteConfig =
|
|
10063
|
+
const viteConfig = _chunkP5HSJCXIcjs.mergeFarmViteConfig.call(void 0,
|
|
10085
10064
|
{
|
|
10086
10065
|
root,
|
|
10087
10066
|
appType: "custom",
|
|
@@ -10093,7 +10072,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10093
10072
|
},
|
|
10094
10073
|
plugins: [
|
|
10095
10074
|
...rendererVitePlugins,
|
|
10096
|
-
|
|
10075
|
+
_chunkP5HSJCXIcjs.farmFontImportsPlugin.call(void 0, {
|
|
10097
10076
|
root,
|
|
10098
10077
|
basePath: config.basePath,
|
|
10099
10078
|
publicDir: config.publicDir
|
|
@@ -10105,7 +10084,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10105
10084
|
hmr: false
|
|
10106
10085
|
},
|
|
10107
10086
|
resolve: {
|
|
10108
|
-
alias:
|
|
10087
|
+
alias: _chunkP5HSJCXIcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
10109
10088
|
dedupe: [...config.renderer.dedupe || []]
|
|
10110
10089
|
},
|
|
10111
10090
|
optimizeDeps: {
|
|
@@ -10191,7 +10170,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
10191
10170
|
define: {
|
|
10192
10171
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
10193
10172
|
__FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
|
|
10194
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
10173
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _185 => _185.env, 'optionalAccess', _186 => _186.public]) || {})
|
|
10195
10174
|
},
|
|
10196
10175
|
plugins: [
|
|
10197
10176
|
farmI18nClientBridgePlugin(),
|
|
@@ -10204,7 +10183,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
10204
10183
|
_chunkS3JO3N4Hcjs.__name.call(void 0, buildSSR, "buildSSR");
|
|
10205
10184
|
function resolveLegacyPageEntry(config, root, srcDir) {
|
|
10206
10185
|
const appDir = _path2.default.join(root, srcDir, "app");
|
|
10207
|
-
for (const extension of
|
|
10186
|
+
for (const extension of _chunkPSV6XKPOcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer)) {
|
|
10208
10187
|
const candidate = _path2.default.join(appDir, `page${extension}`);
|
|
10209
10188
|
if (_fs.existsSync.call(void 0, candidate)) return candidate;
|
|
10210
10189
|
}
|
|
@@ -10226,7 +10205,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10226
10205
|
if (pluginManager) {
|
|
10227
10206
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
10228
10207
|
}
|
|
10229
|
-
const outputDir =
|
|
10208
|
+
const outputDir = _chunkGXXONIARcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10230
10209
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
10231
10210
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
10232
10211
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -10297,7 +10276,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10297
10276
|
root,
|
|
10298
10277
|
preset,
|
|
10299
10278
|
distDir,
|
|
10300
|
-
outputDir:
|
|
10279
|
+
outputDir: _chunkGXXONIARcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
10301
10280
|
});
|
|
10302
10281
|
}
|
|
10303
10282
|
}
|