@farm.js/core 0.1.51-beta.1 → 0.1.51-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp.d-ZuuNgrkQ.d.ts → agent-mcp.d-CR5Ov83o.d.ts} +1 -1
- package/dist/{agent-mcp.d-BPzpKBHQ.d.mts → agent-mcp.d-Z5DuwrqW.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/{analyzer-AZULAOPL.cjs → analyzer-T76CN3S7.cjs} +70 -21
- package/dist/{analyzer-V74FTD2F.mjs → analyzer-Z6TNEAET.mjs} +70 -21
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/{app-manifest.d-BJDcZn3W.d.mts → app-manifest.d-CAHkOBFa.d.mts} +1 -1
- package/dist/{app-manifest.d-HWhqbP2X.d.ts → app-manifest.d-DiWr_Jfx.d.ts} +1 -1
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/{app.d-DOGW1KI8.d.mts → app.d-BfgJCsTQ.d.mts} +4 -4
- package/dist/{app.d-B5EWdob-.d.ts → app.d-DmapqkbV.d.ts} +4 -4
- package/dist/{chunk-5A5GAZ75.mjs → chunk-4SSRBCBR.mjs} +57 -22
- package/dist/{chunk-EOSFVNXZ.mjs → chunk-6CYQQQGR.mjs} +1 -1
- package/dist/{chunk-BSEKNTMS.mjs → chunk-74Z5KX4A.mjs} +4 -4
- package/dist/chunk-7FVVQEVL.cjs +541 -0
- package/dist/chunk-C3BOESDW.mjs +541 -0
- package/dist/{chunk-KMB5BMFX.mjs → chunk-CTM4SPB3.mjs} +5 -0
- package/dist/{chunk-XY4DYGSU.cjs → chunk-DTU4PX7V.cjs} +177 -142
- package/dist/{chunk-KU7MBLDZ.mjs → chunk-E6LTONL4.mjs} +1 -1
- package/dist/{chunk-QAIAFCRZ.mjs → chunk-E73PGHSR.mjs} +1 -1
- package/dist/{chunk-I3EFXUAR.mjs → chunk-FM2UEKS2.mjs} +1 -1
- package/dist/{chunk-JVBNKWLV.cjs → chunk-GNJIYJMS.cjs} +2 -2
- package/dist/{chunk-AGR7VJH2.cjs → chunk-GUJTVM36.cjs} +1 -1
- package/dist/{chunk-SCRC5AMM.mjs → chunk-IBSAYAWB.mjs} +1 -1
- package/dist/{chunk-RMPNYUGT.cjs → chunk-J3LBO2O4.cjs} +2 -2
- package/dist/{chunk-VITZRYW3.cjs → chunk-NPQLMP7M.cjs} +5 -0
- package/dist/{chunk-TT66CP3P.cjs → chunk-NXBHYO7S.cjs} +2 -2
- package/dist/{chunk-EWC76P5D.mjs → chunk-PMKUU273.mjs} +2 -2
- package/dist/{chunk-IFBINMI4.cjs → chunk-QXPSWMUD.cjs} +3 -3
- package/dist/{chunk-X2M4XN4V.cjs → chunk-WZW6LEHM.cjs} +5 -5
- package/dist/{chunk-2756SHCI.cjs → chunk-YU42A5MA.cjs} +52 -52
- package/dist/{client-plugins.d-C_3CdALC.d.mts → client-plugins.d-Bx3FXpqm.d.mts} +18 -5
- package/dist/{client-plugins.d-C0n8Yhh-.d.ts → client-plugins.d-TiLbS5j4.d.ts} +18 -5
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/{config.d-CnhyvvmT.d.mts → config.d-iRPI16ku.d.mts} +6 -2
- package/dist/{config.d-CnhyvvmT.d.ts → config.d-iRPI16ku.d.ts} +6 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/desktop.d.mts +3 -3
- package/dist/desktop.d.ts +3 -3
- package/dist/{devtools-KJFUE5FO.cjs → devtools-6XWCZIGO.cjs} +2 -2
- package/dist/{devtools-BU5IT2PD.mjs → devtools-UQLDAOEI.mjs} +1 -1
- package/dist/docs.cjs +3 -3
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +2 -2
- package/dist/index.cjs +9 -8
- package/dist/{index.d-CsGxS-hZ.d.mts → index.d-YxJ2AiDF.d.mts} +1 -1
- package/dist/{index.d-B6M_8kmo.d.ts → index.d-yueUNipJ.d.ts} +1 -1
- package/dist/index.d.mts +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.mjs +8 -7
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.cjs +10 -9
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +9 -8
- package/dist/internal/cli-runtime.cjs +2 -2
- package/dist/internal/cli-runtime.mjs +1 -1
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +2 -2
- package/dist/internal/compression-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.cjs +3 -3
- package/dist/internal/config-runtime.d.mts +16 -79
- package/dist/internal/config-runtime.d.ts +16 -79
- package/dist/internal/config-runtime.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +7 -3
- package/dist/internal/production-runtime.d.mts +35 -12
- package/dist/internal/production-runtime.d.ts +35 -12
- package/dist/internal/production-runtime.mjs +6 -2
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/mobile.d.mts +4 -4
- package/dist/mobile.d.ts +4 -4
- package/dist/{navigation-delegate.d-jArRF0ZP.d.ts → navigation-delegate.d-BY1e_Xrh.d.ts} +1 -1
- package/dist/{navigation-delegate.d-C0BbdUgN.d.mts → navigation-delegate.d-HnDXhlyP.d.mts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/plugin.cjs +5 -5
- package/dist/plugin.d.mts +4 -4
- package/dist/plugin.d.ts +4 -4
- package/dist/plugin.mjs +4 -4
- package/dist/{production-runtime.d-DFaQ1qaV.d.mts → production-runtime.d-BpJUDzP8.d.mts} +1 -1
- package/dist/{production-runtime.d-UnXmSS_S.d.ts → production-runtime.d-lMjvE9cf.d.ts} +1 -1
- package/dist/{programmatic-routes-client.d-BIowUXQC.d.mts → programmatic-routes-client.d-6CGQ3TCk.d.mts} +2 -2
- package/dist/{programmatic-routes-client.d-VZ0qcbH4.d.ts → programmatic-routes-client.d-BlFp5hv4.d.ts} +2 -2
- package/dist/{render-plan.d-BNeqyPyJ.d.mts → render-plan.d-BH9edqKs.d.mts} +1 -1
- package/dist/{render-plan.d-BB6KrYjP.d.ts → render-plan.d-DhP0mTHF.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-Bxhghm76.d.ts → request.d-BVZrsR1v.d.ts} +1 -1
- package/dist/{request.d-BV1munmx.d.mts → request.d-DJFRdKi8.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering.d-BIf7zE9d.d.ts → route-rendering.d-B00JtK_-.d.ts} +1 -1
- package/dist/{route-rendering.d-DShqKlgK.d.mts → route-rendering.d-Bpmw7PED.d.mts} +1 -1
- package/dist/{router.d-Bw3K3b0a.d.ts → router.d-Bd1x9XxQ.d.ts} +1 -1
- package/dist/{router.d-BE7i84fb.d.mts → router.d-e0jQ3jQ-.d.mts} +1 -1
- package/dist/{routes.d-_5tBQexL.d.mts → routes.d-Cmv8TgVq.d.mts} +89 -2
- package/dist/{routes.d-DVZQL0-H.d.ts → routes.d-D96Dq9lz.d.ts} +89 -2
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{rsc-pipeline-IQI5XQLS.cjs → rsc-pipeline-DX4OC5FN.cjs} +3 -3
- package/dist/{rsc-pipeline-FBM6NFYY.mjs → rsc-pipeline-ZQ4CTVEG.mjs} +2 -2
- package/dist/{runtime-2JYIDUON.mjs → runtime-NPDRDV6R.mjs} +64 -15
- package/dist/{runtime-DXEVFYLE.cjs → runtime-NQ3EDSA7.cjs} +73 -24
- package/dist/{runtime.d-CQgoYR0Q.d.mts → runtime.d-CgB3IJDq.d.mts} +1 -1
- package/dist/{runtime.d-CfhaLPl-.d.ts → runtime.d-D-td-RR3.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +22 -22
- package/dist/server.d.mts +10 -10
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +7 -7
- package/dist/session-AAU7RNRO.cjs +23 -0
- package/dist/session-IGEDQ5PY.mjs +23 -0
- package/dist/{spa-router.d-D63jb6nX.d.mts → spa-router.d-BWDhS0FK.d.mts} +2 -2
- package/dist/{spa-router.d-C5opIgXg.d.ts → spa-router.d-CO01mVOM.d.ts} +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/{utils.d-CkpTqTsC.d.ts → utils.d-B77__yh8.d.ts} +1 -1
- package/dist/{utils.d-CO-U4OVZ.d.mts → utils.d-DRDazhCA.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +5 -5
- package/dist/vite.d.mts +5 -5
- package/dist/vite.d.ts +5 -5
- package/dist/vite.mjs +4 -4
- package/package.json +3 -3
|
@@ -15,11 +15,14 @@ var _chunkVZY7MAVScjs = require('./chunk-VZY7MAVS.cjs');
|
|
|
15
15
|
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
var _chunk7FVVQEVLcjs = require('./chunk-7FVVQEVL.cjs');
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkGNJIYJMScjs = require('./chunk-GNJIYJMS.cjs');
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
|
|
@@ -39,7 +42,7 @@ var _chunk5N7QAGEAcjs = require('./chunk-5N7QAGEA.cjs');
|
|
|
39
42
|
var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
|
|
40
43
|
|
|
41
44
|
|
|
42
|
-
var
|
|
45
|
+
var _chunkQXPSWMUDcjs = require('./chunk-QXPSWMUD.cjs');
|
|
43
46
|
|
|
44
47
|
|
|
45
48
|
var _chunkBRWIVOV4cjs = require('./chunk-BRWIVOV4.cjs');
|
|
@@ -54,7 +57,7 @@ var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
|
|
57
|
-
var
|
|
60
|
+
var _chunkNPQLMP7Mcjs = require('./chunk-NPQLMP7M.cjs');
|
|
58
61
|
|
|
59
62
|
|
|
60
63
|
|
|
@@ -86,7 +89,7 @@ var _chunkVITZRYW3cjs = require('./chunk-VITZRYW3.cjs');
|
|
|
86
89
|
|
|
87
90
|
|
|
88
91
|
|
|
89
|
-
var
|
|
92
|
+
var _chunkWZW6LEHMcjs = require('./chunk-WZW6LEHM.cjs');
|
|
90
93
|
|
|
91
94
|
|
|
92
95
|
var _chunkLNM57D3Hcjs = require('./chunk-LNM57D3H.cjs');
|
|
@@ -124,7 +127,7 @@ var _chunkSGBNF56Scjs = require('./chunk-SGBNF56S.cjs');
|
|
|
124
127
|
|
|
125
128
|
|
|
126
129
|
|
|
127
|
-
var
|
|
130
|
+
var _chunkJ3LBO2O4cjs = require('./chunk-J3LBO2O4.cjs');
|
|
128
131
|
|
|
129
132
|
|
|
130
133
|
|
|
@@ -233,7 +236,7 @@ var _chunkVQJYGZNXcjs = require('./chunk-VQJYGZNX.cjs');
|
|
|
233
236
|
var _chunkB5BBTPJQcjs = require('./chunk-B5BBTPJQ.cjs');
|
|
234
237
|
|
|
235
238
|
|
|
236
|
-
var
|
|
239
|
+
var _chunkGUJTVM36cjs = require('./chunk-GUJTVM36.cjs');
|
|
237
240
|
|
|
238
241
|
|
|
239
242
|
var _chunkE552H232cjs = require('./chunk-E552H232.cjs');
|
|
@@ -374,7 +377,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
374
377
|
globalStylesheetHref: options.globalStylesheetHref,
|
|
375
378
|
isPathGuarded: options.isPathGuarded
|
|
376
379
|
});
|
|
377
|
-
const apiHandler =
|
|
380
|
+
const apiHandler = _chunkGNJIYJMScjs.createFarmDocsAPIHandler.call(void 0, {
|
|
378
381
|
rootDir: options.root,
|
|
379
382
|
srcDir: options.srcDir,
|
|
380
383
|
docs,
|
|
@@ -1758,7 +1761,9 @@ function hasFarmPluginRoutes(config) {
|
|
|
1758
1761
|
}
|
|
1759
1762
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1760
1763
|
return (config.plugins || []).some(
|
|
1761
|
-
(plugin) => _chunkCECUDGXQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false &&
|
|
1764
|
+
(plugin) => _chunkCECUDGXQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && // Mobile session tokens change only bearer requests and cookie-clearing responses, which a
|
|
1765
|
+
// prerendered file never answers or sends; its endpoints live under /__farm/.
|
|
1766
|
+
plugin.name !== _chunk7FVVQEVLcjs.FARM_MOBILE_SESSION_PLUGIN && _chunk47JV57DAcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1762
1767
|
);
|
|
1763
1768
|
}
|
|
1764
1769
|
async function discoverMiddlewareRoutes(appDir) {
|
|
@@ -1817,7 +1822,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1817
1822
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1818
1823
|
const srcDir = config.srcDir || "src";
|
|
1819
1824
|
const distDir = config.distDir || ".farm";
|
|
1820
|
-
const deployOutputDir =
|
|
1825
|
+
const deployOutputDir = _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1821
1826
|
const lifecyclePluginManager = options.pluginManager;
|
|
1822
1827
|
const productionViteResultPromise = Promise.allSettled([
|
|
1823
1828
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -2073,7 +2078,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2073
2078
|
}
|
|
2074
2079
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
2075
2080
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
2076
|
-
await fs4.writeFile(clientCssPath,
|
|
2081
|
+
await fs4.writeFile(clientCssPath, _chunkWZW6LEHMcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
2077
2082
|
}
|
|
2078
2083
|
var IncompleteClientBuildOutputError = class extends Error {
|
|
2079
2084
|
constructor(detail) {
|
|
@@ -2119,7 +2124,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
2119
2124
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${_path2.default.resolve(modulePath)}`;
|
|
2120
2125
|
let plan = cache.get(key);
|
|
2121
2126
|
if (!plan) {
|
|
2122
|
-
plan =
|
|
2127
|
+
plan = _chunkWZW6LEHMcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2123
2128
|
cache.set(key, plan);
|
|
2124
2129
|
}
|
|
2125
2130
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -2147,14 +2152,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2147
2152
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2148
2153
|
);
|
|
2149
2154
|
}
|
|
2150
|
-
const isolatedMode =
|
|
2155
|
+
const isolatedMode = _chunkWZW6LEHMcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2151
2156
|
_optionalChain([config, 'access', _59 => _59.experimental, 'optionalAccess', _60 => _60.isolatedClientHydration]),
|
|
2152
2157
|
{
|
|
2153
2158
|
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _61 => _61.experimental, 'optionalAccess', _62 => _62.serverComponents])) === "rsc",
|
|
2154
2159
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2155
2160
|
}
|
|
2156
2161
|
);
|
|
2157
|
-
const planOptions =
|
|
2162
|
+
const planOptions = _chunkWZW6LEHMcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2158
2163
|
config.renderer,
|
|
2159
2164
|
Boolean(unsupportedIntegrationProvider)
|
|
2160
2165
|
);
|
|
@@ -2225,7 +2230,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2225
2230
|
);
|
|
2226
2231
|
const syntheticDocsEntry = _optionalChain([config, 'access', _72 => _72.docs, 'optionalAccess', _73 => _73.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2227
2232
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2228
|
-
const markdownPagePlan =
|
|
2233
|
+
const markdownPagePlan = _chunkWZW6LEHMcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2229
2234
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2230
2235
|
root,
|
|
2231
2236
|
isolatedMode,
|
|
@@ -2241,7 +2246,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2241
2246
|
pagePlanOptions
|
|
2242
2247
|
)
|
|
2243
2248
|
}));
|
|
2244
|
-
|
|
2249
|
+
_chunkWZW6LEHMcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2245
2250
|
clientLayouts.map((layout) => ({
|
|
2246
2251
|
pattern: layout.pattern,
|
|
2247
2252
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2273,7 +2278,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2273
2278
|
for (const layout of clientLayouts) {
|
|
2274
2279
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
2275
2280
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2276
|
-
_chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F ${
|
|
2281
|
+
_chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F ${_chunkWZW6LEHMcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2277
2282
|
}
|
|
2278
2283
|
}
|
|
2279
2284
|
if (isolatedMode === "analyze") {
|
|
@@ -2297,7 +2302,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2297
2302
|
);
|
|
2298
2303
|
if (metadata.suppressedAsyncHydration) {
|
|
2299
2304
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
2300
|
-
`\u26A0\uFE0F ${
|
|
2305
|
+
`\u26A0\uFE0F ${_chunkWZW6LEHMcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2301
2306
|
);
|
|
2302
2307
|
}
|
|
2303
2308
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2322,7 +2327,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2322
2327
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
2323
2328
|
],
|
|
2324
2329
|
// The server renders a server tree only below a hydrating layout.
|
|
2325
|
-
...
|
|
2330
|
+
..._chunkWZW6LEHMcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2326
2331
|
});
|
|
2327
2332
|
_chunkVQJYGZNXcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2328
2333
|
}
|
|
@@ -2358,7 +2363,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2358
2363
|
}
|
|
2359
2364
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2360
2365
|
try {
|
|
2361
|
-
return
|
|
2366
|
+
return _chunkWZW6LEHMcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2362
2367
|
} catch (error) {
|
|
2363
2368
|
_chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2364
2369
|
return false;
|
|
@@ -2388,7 +2393,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2388
2393
|
config.trailingSlash,
|
|
2389
2394
|
_chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2390
2395
|
config.basePath,
|
|
2391
|
-
|
|
2396
|
+
_chunkWZW6LEHMcjs.generateClientCachePersistenceCode.call(void 0, _chunkWZW6LEHMcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2392
2397
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2393
2398
|
_chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _79 => _79.experimental, 'optionalAccess', _80 => _80.serverComponents])) === "islands"
|
|
2394
2399
|
);
|
|
@@ -2458,7 +2463,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2458
2463
|
}
|
|
2459
2464
|
},
|
|
2460
2465
|
plugins: [
|
|
2461
|
-
|
|
2466
|
+
_chunkWZW6LEHMcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2462
2467
|
createFarmPrivateClientSourcemapsPlugin({
|
|
2463
2468
|
outDir: _path2.default.join(_path2.default.dirname(outputDir), FARM_CLIENT_SOURCEMAPS_DIR)
|
|
2464
2469
|
}),
|
|
@@ -2483,7 +2488,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2483
2488
|
...rendererVitePlugins,
|
|
2484
2489
|
...config.vite.plugins || [],
|
|
2485
2490
|
farmServerOnlyEntriesPlugin(),
|
|
2486
|
-
|
|
2491
|
+
_chunkWZW6LEHMcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2487
2492
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2488
2493
|
),
|
|
2489
2494
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
@@ -2545,7 +2550,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2545
2550
|
} : void 0,
|
|
2546
2551
|
// Ensure React is bundled for client
|
|
2547
2552
|
resolve: {
|
|
2548
|
-
alias:
|
|
2553
|
+
alias: _chunkWZW6LEHMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2549
2554
|
dedupe: [...config.renderer.dedupe || []]
|
|
2550
2555
|
},
|
|
2551
2556
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2558,7 +2563,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2558
2563
|
]
|
|
2559
2564
|
}
|
|
2560
2565
|
};
|
|
2561
|
-
await viteBuild(
|
|
2566
|
+
await viteBuild(_chunkWZW6LEHMcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2562
2567
|
await mergeBuiltFontCss(outputDir);
|
|
2563
2568
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2564
2569
|
} finally {
|
|
@@ -2645,21 +2650,24 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
2645
2650
|
return response;
|
|
2646
2651
|
}
|
|
2647
2652
|
|
|
2648
|
-
${streamNavigations ?
|
|
2649
|
-
|
|
2650
|
-
// Reads a streamed navigation (F-Stream) up to the end of React's shell. \`next\` then resolves
|
|
2653
|
+
${streamNavigations ? `// Reads a streamed navigation (F-Stream) up to the end of React's shell. \`next\` then resolves
|
|
2651
2654
|
// with each later flush as it ends, and null at the end; a document without a marker is all shell.
|
|
2652
|
-
|
|
2655
|
+
// The marker carries the random token the server sent in the F-Flush header, so page content
|
|
2656
|
+
// cannot forge a boundary; a response without a valid token is all shell.
|
|
2657
|
+
async function readFarmNavigationStream(body, flushToken) {
|
|
2653
2658
|
const reader = body.getReader();
|
|
2654
2659
|
const decoder = new TextDecoder();
|
|
2660
|
+
const marker = typeof flushToken === "string" && /^[0-9a-f]{32}$/.test(flushToken)
|
|
2661
|
+
? "<!--farm-flush:" + flushToken + "-->"
|
|
2662
|
+
: "";
|
|
2655
2663
|
let text = "";
|
|
2656
2664
|
let done = false;
|
|
2657
2665
|
const next = async function() {
|
|
2658
2666
|
for (;;) {
|
|
2659
|
-
const at = text.indexOf(
|
|
2667
|
+
const at = marker ? text.indexOf(marker) : -1;
|
|
2660
2668
|
if (at !== -1) {
|
|
2661
2669
|
const flush = text.slice(0, at);
|
|
2662
|
-
text = text.slice(at +
|
|
2670
|
+
text = text.slice(at + marker.length);
|
|
2663
2671
|
return flush;
|
|
2664
2672
|
}
|
|
2665
2673
|
if (done) {
|
|
@@ -3233,7 +3241,7 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
|
|
|
3233
3241
|
}
|
|
3234
3242
|
};
|
|
3235
3243
|
${streamNavigations ? ` if (streamShell && response.body) {
|
|
3236
|
-
const streamed = await readFarmNavigationStream(response.body);
|
|
3244
|
+
const streamed = await readFarmNavigationStream(response.body, response.headers.get("F-Flush"));
|
|
3237
3245
|
if (!streamed.next) {
|
|
3238
3246
|
store(streamed.shell);
|
|
3239
3247
|
return streamed.shell;
|
|
@@ -3441,7 +3449,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3441
3449
|
direction: {}
|
|
3442
3450
|
}, plugins = [], renderer = _chunkRD623KW4cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
|
|
3443
3451
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
3444
|
-
const clientPluginEntry =
|
|
3452
|
+
const clientPluginEntry = _chunkWZW6LEHMcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3445
3453
|
plugins,
|
|
3446
3454
|
root,
|
|
3447
3455
|
srcDir,
|
|
@@ -3452,7 +3460,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3452
3460
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3453
3461
|
import __farmAppSetup from ${JSON.stringify(_chunkVQJYGZNXcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3454
3462
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3455
|
-
const providerClientCode =
|
|
3463
|
+
const providerClientCode = _chunkWZW6LEHMcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3456
3464
|
integrationProviders,
|
|
3457
3465
|
root,
|
|
3458
3466
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3996,7 +4004,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3996
4004
|
});
|
|
3997
4005
|
}
|
|
3998
4006
|
|
|
3999
|
-
${
|
|
4007
|
+
${_chunkWZW6LEHMcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
4000
4008
|
// Wrap a page element with applicable layouts
|
|
4001
4009
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
4002
4010
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4031,7 +4039,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
4031
4039
|
return React.createElement("div", props, pageElement);
|
|
4032
4040
|
}
|
|
4033
4041
|
let farmLastRouteState = null;
|
|
4034
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
4042
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkWZW6LEHMcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
4035
4043
|
function farmTreeLayoutsOf(pathname) {
|
|
4036
4044
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
4037
4045
|
return layout.serverTree === true;
|
|
@@ -5257,7 +5265,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5257
5265
|
}
|
|
5258
5266
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
5259
5267
|
const instrumentationPath = _chunkBRWIVOV4cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
5260
|
-
const notFoundPath =
|
|
5268
|
+
const notFoundPath = _chunkWZW6LEHMcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
5261
5269
|
if (notFoundPath) _chunkVQJYGZNXcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
5262
5270
|
layoutRoutes.sort((a, b) => {
|
|
5263
5271
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -5280,7 +5288,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5280
5288
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
5281
5289
|
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _87 => _87.mdx, 'optionalAccess', _88 => _88.components]));
|
|
5282
5290
|
const hasMiddlewareConfig = _chunk76GHW3WIcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5283
|
-
const hasRouteContextConfig =
|
|
5291
|
+
const hasRouteContextConfig = _chunkNPQLMP7Mcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
5284
5292
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
5285
5293
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
5286
5294
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -5290,9 +5298,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5290
5298
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
5291
5299
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
5292
5300
|
);
|
|
5293
|
-
if (
|
|
5301
|
+
if (_chunkGNJIYJMScjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
5294
5302
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
5295
|
-
|
|
5303
|
+
_chunkGNJIYJMScjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
5296
5304
|
config.docs,
|
|
5297
5305
|
{ root, srcDir: config.srcDir },
|
|
5298
5306
|
(pathname) => adapterGuardedPaths.has(pathname)
|
|
@@ -5301,7 +5309,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5301
5309
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
5302
5310
|
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _89 => _89.docs, 'optionalAccess', _90 => _90.enabled]) && _chunkE552H232cjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHNAISJFDcjs._runWithFarmCspNonce.call(void 0,
|
|
5303
5311
|
farmDocsCspNonceMarker,
|
|
5304
|
-
async () => _optionalChain([config, 'access', _91 => _91.docs, 'access', _92 => _92.adapter, 'optionalAccess', _93 => _93.server]) ? await
|
|
5312
|
+
async () => _optionalChain([config, 'access', _91 => _91.docs, 'access', _92 => _92.adapter, 'optionalAccess', _93 => _93.server]) ? await _chunkGNJIYJMScjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
5305
5313
|
root,
|
|
5306
5314
|
srcDir: config.srcDir,
|
|
5307
5315
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -5463,7 +5471,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5463
5471
|
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _99 => _99.env, 'optionalAccess', _100 => _100.public]) || {})
|
|
5464
5472
|
},
|
|
5465
5473
|
plugins: [
|
|
5466
|
-
|
|
5474
|
+
_chunkWZW6LEHMcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
5467
5475
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
5468
5476
|
...rendererVitePlugins,
|
|
5469
5477
|
...config.vite.plugins || [],
|
|
@@ -5524,7 +5532,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5524
5532
|
resolve: {
|
|
5525
5533
|
alias: [
|
|
5526
5534
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
5527
|
-
...Object.entries(
|
|
5535
|
+
...Object.entries(_chunkWZW6LEHMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
5528
5536
|
([find, replacement]) => ({ find, replacement })
|
|
5529
5537
|
)
|
|
5530
5538
|
],
|
|
@@ -5532,7 +5540,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5532
5540
|
dedupe: [...config.renderer.dedupe || []]
|
|
5533
5541
|
}
|
|
5534
5542
|
};
|
|
5535
|
-
await viteBuild(
|
|
5543
|
+
await viteBuild(_chunkWZW6LEHMcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
5536
5544
|
} finally {
|
|
5537
5545
|
if (postcssConfigDir) {
|
|
5538
5546
|
try {
|
|
@@ -6031,7 +6039,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6031
6039
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
6032
6040
|
);
|
|
6033
6041
|
}
|
|
6034
|
-
const providerServerModules =
|
|
6042
|
+
const providerServerModules = _chunkWZW6LEHMcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
6035
6043
|
renderedIntegrationProviders,
|
|
6036
6044
|
config.root,
|
|
6037
6045
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
@@ -6051,14 +6059,14 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6051
6059
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
6052
6060
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
6053
6061
|
);
|
|
6054
|
-
const isolatedHydrationMode =
|
|
6062
|
+
const isolatedHydrationMode = _chunkWZW6LEHMcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
6055
6063
|
_optionalChain([config, 'access', _143 => _143.experimental, 'optionalAccess', _144 => _144.isolatedClientHydration]),
|
|
6056
6064
|
{
|
|
6057
6065
|
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _145 => _145.experimental, 'optionalAccess', _146 => _146.serverComponents])) === "rsc",
|
|
6058
6066
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
6059
6067
|
}
|
|
6060
6068
|
);
|
|
6061
|
-
const hydrationPlanOptions =
|
|
6069
|
+
const hydrationPlanOptions = _chunkWZW6LEHMcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
6062
6070
|
config.renderer,
|
|
6063
6071
|
Boolean(unsupportedIntegrationProvider)
|
|
6064
6072
|
);
|
|
@@ -6076,7 +6084,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6076
6084
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
6077
6085
|
)
|
|
6078
6086
|
}));
|
|
6079
|
-
const markdownPagePlan =
|
|
6087
|
+
const markdownPagePlan = _chunkWZW6LEHMcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
6080
6088
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
6081
6089
|
config.root,
|
|
6082
6090
|
isolatedHydrationMode,
|
|
@@ -6094,7 +6102,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6094
6102
|
)
|
|
6095
6103
|
])
|
|
6096
6104
|
);
|
|
6097
|
-
|
|
6105
|
+
_chunkWZW6LEHMcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
6098
6106
|
layoutHydrationPlans.map((layout) => ({
|
|
6099
6107
|
pattern: layout.pattern,
|
|
6100
6108
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -6168,7 +6176,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6168
6176
|
module: ${varName},
|
|
6169
6177
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
6170
6178
|
clientModule: ${JSON.stringify(_chunkVQJYGZNXcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
6171
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
6179
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkWZW6LEHMcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
|
|
6172
6180
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
6173
6181
|
${route.source !== void 0 ? `markdownSource: {
|
|
6174
6182
|
source: ${JSON.stringify(route.source)},
|
|
@@ -6436,14 +6444,18 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
6436
6444
|
const instrumentationImport = instrumentationPath ? `import * as FarmInstrumentationModule from ${toVirtualEntryImportSpecifier(instrumentationPath)};` : "";
|
|
6437
6445
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
6438
6446
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
6447
|
+
const mobileSession = (config.plugins || []).some(
|
|
6448
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _166 => _166.name]) === _chunk7FVVQEVLcjs.FARM_MOBILE_SESSION_PLUGIN
|
|
6449
|
+
);
|
|
6439
6450
|
const integrationImports = `
|
|
6440
6451
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
6441
6452
|
${layerConfigImports}
|
|
6442
6453
|
${integrationRuntimeImport}
|
|
6443
6454
|
${nativeAuth.importSource}
|
|
6444
6455
|
${nativeMCP.importSource}
|
|
6456
|
+
${mobileSession ? `import { createFarmMobileSessionPlugin as __farmCreateMobileSessionPlugin } from "@farm.js/core/internal/production-runtime";` : ""}
|
|
6445
6457
|
`;
|
|
6446
|
-
const imageRuntime =
|
|
6458
|
+
const imageRuntime = _chunkWZW6LEHMcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
6447
6459
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
6448
6460
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
6449
6461
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -6622,7 +6634,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
6622
6634
|
|
|
6623
6635
|
function FarmDefault404Page() {
|
|
6624
6636
|
return React.createElement(React.Fragment, null,
|
|
6625
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
6637
|
+
React.createElement("style", null, ${JSON.stringify(_chunkWZW6LEHMcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
6626
6638
|
React.createElement("main", {
|
|
6627
6639
|
className: "farm-default-not-found",
|
|
6628
6640
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -6722,6 +6734,10 @@ const configuredPlugins = [
|
|
|
6722
6734
|
${hasCompressionRuntime && hasPluginRuntime ? "createCompressionPlugin()," : ""}
|
|
6723
6735
|
${hasRuntimeIntegrationConfig ? "...resolveIntegrationPlugins(serverRuntimeIntegrations)," : ""}
|
|
6724
6736
|
${nativeMCP.pluginSource}
|
|
6737
|
+
${mobileSession ? `__farmCreateMobileSessionPlugin({
|
|
6738
|
+
basePath: ${JSON.stringify(config.basePath)},
|
|
6739
|
+
integrations: () => serverRuntimeIntegrations,
|
|
6740
|
+
}),` : ""}
|
|
6725
6741
|
${hasConfiguredRuntimePlugins ? `...farmRuntimeConfigs.flatMap((runtimeConfig) =>
|
|
6726
6742
|
Array.isArray(runtimeConfig.plugins) ? runtimeConfig.plugins : [],
|
|
6727
6743
|
),` : ""}
|
|
@@ -6755,14 +6771,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
6755
6771
|
onError(error) { console.error("[Farm Image]", error); },
|
|
6756
6772
|
})`};
|
|
6757
6773
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
6758
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
6759
|
-
${_optionalChain([config, 'access',
|
|
6774
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _167 => _167.agent, 'optionalAccess', _168 => _168.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
6775
|
+
${_optionalChain([config, 'access', _169 => _169.agent, 'optionalAccess', _170 => _170.llmsTxt, 'optionalAccess', _171 => _171.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
6760
6776
|
const farmMdxConfig = ${JSON.stringify({
|
|
6761
6777
|
...config.mdx,
|
|
6762
|
-
components: typeof _optionalChain([config, 'access',
|
|
6778
|
+
components: typeof _optionalChain([config, 'access', _172 => _172.mdx, 'optionalAccess', _173 => _173.components]) === "string" ? config.mdx.components : void 0
|
|
6763
6779
|
})};
|
|
6764
6780
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
6765
|
-
${_optionalChain([config, 'access',
|
|
6781
|
+
${_optionalChain([config, 'access', _174 => _174.agent, 'optionalAccess', _175 => _175.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
6766
6782
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
6767
6783
|
// to the build.
|
|
6768
6784
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
@@ -6813,7 +6829,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
6813
6829
|
});
|
|
6814
6830
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
6815
6831
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
6816
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
6832
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _176 => _176.docs, 'optionalAccess', _177 => _177.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
6817
6833
|
try {
|
|
6818
6834
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
6819
6835
|
const candidates = [
|
|
@@ -6825,7 +6841,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _175 => _1
|
|
|
6825
6841
|
} catch {
|
|
6826
6842
|
return null;
|
|
6827
6843
|
}
|
|
6828
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
6844
|
+
})()` : "null"};${_optionalChain([config, 'access', _178 => _178.docs, 'optionalAccess', _179 => _179.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _180 => _180.docs, 'access', _181 => _181.roots, 'optionalAccess', _182 => _182.length]) ? `
|
|
6829
6845
|
const farmDocsBundledRootsDir = (() => {
|
|
6830
6846
|
try {
|
|
6831
6847
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -6876,7 +6892,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
6876
6892
|
),
|
|
6877
6893
|
}
|
|
6878
6894
|
: undefined;
|
|
6879
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
6895
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _183 => _183.docs, 'optionalAccess', _184 => _184.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
6880
6896
|
rootDir: farmDocsRuntimeRoot,
|
|
6881
6897
|
// A production build's content cannot change, so the adapter reads its
|
|
6882
6898
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -6909,7 +6925,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _182 => _182.docs, '
|
|
|
6909
6925
|
globalStylesheetHref: ${JSON.stringify(FARM_CLIENT_CSS_HREF_PLACEHOLDER)},
|
|
6910
6926
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
6911
6927
|
})` : "null"};
|
|
6912
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
6928
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _185 => _185.docs, 'optionalAccess', _186 => _186.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded })` : "null"};
|
|
6913
6929
|
|
|
6914
6930
|
// API routes bundled at build time
|
|
6915
6931
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -6934,12 +6950,12 @@ function fetchFarmInnerRequest(request, context) {
|
|
|
6934
6950
|
}
|
|
6935
6951
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunkB5BBTPJQcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
6936
6952
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
6937
|
-
${_optionalChain([config, 'access',
|
|
6938
|
-
` : ""}${_optionalChain([config, 'access',
|
|
6939
|
-
|
|
6953
|
+
${_optionalChain([config, 'access', _187 => _187.agent, 'optionalAccess', _188 => _188.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkJ3LBO2O4cjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
6954
|
+
` : ""}${_optionalChain([config, 'access', _189 => _189.agent, 'optionalAccess', _190 => _190.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
6955
|
+
_chunkJ3LBO2O4cjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
6940
6956
|
build: config.deploymentId,
|
|
6941
|
-
packages:
|
|
6942
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
6957
|
+
packages: _chunkWZW6LEHMcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
6958
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkWZW6LEHMcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
6943
6959
|
})
|
|
6944
6960
|
)};
|
|
6945
6961
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -7081,10 +7097,22 @@ function escapeFarmHtmlAttribute(value) {
|
|
|
7081
7097
|
.replace(/>/g, ">");
|
|
7082
7098
|
}
|
|
7083
7099
|
|
|
7084
|
-
|
|
7085
|
-
|
|
7100
|
+
// A streamed navigation's flush marker token: 128 random bits, hex.
|
|
7101
|
+
function createFarmFlushToken() {
|
|
7102
|
+
const bytes = new Uint8Array(16);
|
|
7103
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
7104
|
+
let token = "";
|
|
7105
|
+
for (const byte of bytes) token += byte.toString(16).padStart(2, "0");
|
|
7106
|
+
return token;
|
|
7107
|
+
}
|
|
7108
|
+
|
|
7109
|
+
async function renderFarmElement(ReactDOMServer, element, routeKey, flushToken = "") {
|
|
7110
|
+
// Written after each React flush in a streamed navigation (flushToken): the browser swaps in
|
|
7086
7111
|
// the shell, then adds each Suspense boundary as soon as the flush that completed it ends.
|
|
7087
|
-
|
|
7112
|
+
// The token is random per response and reaches the browser in the F-Flush header, so page
|
|
7113
|
+
// content cannot forge a boundary.
|
|
7114
|
+
const flushMarkers = Boolean(flushToken);
|
|
7115
|
+
const FARM_FLUSH_MARKER = flushMarkers ? "<!--farm-flush:" + flushToken + "-->" : "";
|
|
7088
7116
|
// Islands mode: each render writes its islands' values itself, so a request that renders twice
|
|
7089
7117
|
// (notFound(), or a synchronous attempt that suspends and streams) still sends them.
|
|
7090
7118
|
if (typeof farmIslandsRender === "function") element = farmIslandsRender(element);
|
|
@@ -8105,7 +8133,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
8105
8133
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
8106
8134
|
// registered at runtime, such as the docs engine's.
|
|
8107
8135
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
8108
|
-
_chunkSBABQKPTcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root),
|
|
8136
|
+
_chunkSBABQKPTcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkGUJTVM36cjs.FARM_VERSION)
|
|
8109
8137
|
)};
|
|
8110
8138
|
let farmDefaultMCPRouteFree;
|
|
8111
8139
|
function getFarmDefaultMCPServer() {
|
|
@@ -8405,7 +8433,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
8405
8433
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
8406
8434
|
return true;
|
|
8407
8435
|
}
|
|
8408
|
-
${_optionalChain([config, 'access',
|
|
8436
|
+
${_optionalChain([config, 'access', _191 => _191.docs, 'optionalAccess', _192 => _192.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
8409
8437
|
if (
|
|
8410
8438
|
isFarmDocsAPIRequest(pathname) ||
|
|
8411
8439
|
docsPath === "/" ||
|
|
@@ -8431,7 +8459,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
8431
8459
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
8432
8460
|
};
|
|
8433
8461
|
}
|
|
8434
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
8462
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _193 => _193.docs, 'optionalAccess', _194 => _194.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
8435
8463
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
8436
8464
|
pathname,
|
|
8437
8465
|
method: request.method,
|
|
@@ -8515,7 +8543,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
8515
8543
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
8516
8544
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
8517
8545
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
8518
|
-
|
|
8546
|
+
_chunkJ3LBO2O4cjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
8519
8547
|
agent: {
|
|
8520
8548
|
...config.agent,
|
|
8521
8549
|
aiCatalog: servesAiCatalog,
|
|
@@ -8526,9 +8554,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
8526
8554
|
openapi: openAPIReference
|
|
8527
8555
|
})
|
|
8528
8556
|
)});
|
|
8529
|
-
${_optionalChain([config, 'access',
|
|
8557
|
+
${_optionalChain([config, 'access', _195 => _195.docs, 'optionalAccess', _196 => _196.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
8530
8558
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
8531
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
8559
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _197 => _197.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _198 => _198.docs, 'access', _199 => _199.roots, 'optionalAccess', _200 => _200.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
|
|
8532
8560
|
};
|
|
8533
8561
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
8534
8562
|
const farmRouteLabelSlot = Symbol("farm.route.label.slot");
|
|
@@ -8543,11 +8571,11 @@ function labelFarmRequestOptions(options) {
|
|
|
8543
8571
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
8544
8572
|
return options;
|
|
8545
8573
|
}
|
|
8546
|
-
${_optionalChain([config, 'access',
|
|
8574
|
+
${_optionalChain([config, 'access', _201 => _201.docs, 'optionalAccess', _202 => _202.enabled]) ? `if (options.kind === "docs") {
|
|
8547
8575
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
8548
8576
|
return options;
|
|
8549
8577
|
}` : ""}
|
|
8550
|
-
${_optionalChain([config, 'access',
|
|
8578
|
+
${_optionalChain([config, 'access', _203 => _203.md, 'optionalAccess', _204 => _204.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
8551
8579
|
routePathname,
|
|
8552
8580
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
8553
8581
|
);
|
|
@@ -8582,7 +8610,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
8582
8610
|
return applicable;
|
|
8583
8611
|
}
|
|
8584
8612
|
|
|
8585
|
-
${_optionalChain([config, 'access',
|
|
8613
|
+
${_optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 => _206.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
8586
8614
|
if (request.method === "HEAD") return response;
|
|
8587
8615
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
8588
8616
|
|
|
@@ -8690,7 +8718,7 @@ ${_optionalChain([config, 'access', _204 => _204.docs, 'optionalAccess', _205 =>
|
|
|
8690
8718
|
|
|
8691
8719
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
8692
8720
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
8693
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
8721
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _207 => _207.experimental, 'optionalAccess', _208 => _208.ppr]) === true)};
|
|
8694
8722
|
|
|
8695
8723
|
function resolveRouteRenderingView(route) {
|
|
8696
8724
|
// The same merge development uses: baked directive config under the
|
|
@@ -8822,7 +8850,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
8822
8850
|
},
|
|
8823
8851
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
8824
8852
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
8825
|
-
${_optionalChain([config, 'access',
|
|
8853
|
+
${_optionalChain([config, 'access', _209 => _209.md, 'optionalAccess', _210 => _210.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
8826
8854
|
if (matchPageRoute(pathname)) {
|
|
8827
8855
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
8828
8856
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -9032,7 +9060,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9032
9060
|
}
|
|
9033
9061
|
` : ""}
|
|
9034
9062
|
|
|
9035
|
-
${_optionalChain([config, 'access',
|
|
9063
|
+
${_optionalChain([config, 'access', _211 => _211.docs, 'optionalAccess', _212 => _212.enabled]) ? `
|
|
9036
9064
|
// Docs responses are served after app middleware so route guards and
|
|
9037
9065
|
// middleware headers apply to the docs engine like any other page content.
|
|
9038
9066
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -9100,7 +9128,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9100
9128
|
}
|
|
9101
9129
|
` : ""}
|
|
9102
9130
|
|
|
9103
|
-
${_optionalChain([config, 'access',
|
|
9131
|
+
${_optionalChain([config, 'access', _213 => _213.md, 'optionalAccess', _214 => _214.enabled]) ? `
|
|
9104
9132
|
if (farmMarkdownConfig?.enabled) {
|
|
9105
9133
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
9106
9134
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -9199,11 +9227,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9199
9227
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
9200
9228
|
}
|
|
9201
9229
|
` : ""}
|
|
9202
|
-
${_optionalChain([config, 'access',
|
|
9230
|
+
${_optionalChain([config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.manifest]) !== false ? `
|
|
9203
9231
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
9204
9232
|
// public manifest, the same document for every request.
|
|
9205
9233
|
if (
|
|
9206
|
-
[${JSON.stringify(
|
|
9234
|
+
[${JSON.stringify(_chunkJ3LBO2O4cjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkJ3LBO2O4cjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
9207
9235
|
normalizeRuntimePath(routePathname),
|
|
9208
9236
|
)
|
|
9209
9237
|
) {
|
|
@@ -9213,9 +9241,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9213
9241
|
);
|
|
9214
9242
|
}
|
|
9215
9243
|
` : ""}
|
|
9216
|
-
${_optionalChain([config, 'access',
|
|
9244
|
+
${_optionalChain([config, 'access', _217 => _217.agent, 'optionalAccess', _218 => _218.apiCatalog]) ? `
|
|
9217
9245
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
9218
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
9246
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkJ3LBO2O4cjs.FARM_API_CATALOG_PATH)}) {
|
|
9219
9247
|
return applyProductionMiddlewareHeaders(
|
|
9220
9248
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
9221
9249
|
middlewareHeaders,
|
|
@@ -9240,11 +9268,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9240
9268
|
);
|
|
9241
9269
|
}
|
|
9242
9270
|
` : ""}
|
|
9243
|
-
${_optionalChain([config, 'access',
|
|
9271
|
+
${_optionalChain([config, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.llmsTxt, 'optionalAccess', _221 => _221.enabled]) ? `
|
|
9244
9272
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
9245
9273
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
9246
9274
|
? "llms"
|
|
9247
|
-
: ${_optionalChain([config, 'access',
|
|
9275
|
+
: ${_optionalChain([config, 'access', _222 => _222.agent, 'optionalAccess', _223 => _223.llmsTxt, 'optionalAccess', _224 => _224.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
9248
9276
|
if (farmGeneratedLlmsKind) {
|
|
9249
9277
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
9250
9278
|
const llmsOrigin = new URL(request.url).origin;
|
|
@@ -9279,7 +9307,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9279
9307
|
}
|
|
9280
9308
|
` : ""}
|
|
9281
9309
|
|
|
9282
|
-
${_optionalChain([config, 'access',
|
|
9310
|
+
${_optionalChain([config, 'access', _225 => _225.docs, 'optionalAccess', _226 => _226.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
9283
9311
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
9284
9312
|
if (docsAPIResponse) {
|
|
9285
9313
|
return applyProductionMiddlewareHeaders(
|
|
@@ -9622,10 +9650,13 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9622
9650
|
!route.shouldHydrate &&
|
|
9623
9651
|
request.headers.get("f-render") === "tree";
|
|
9624
9652
|
// A navigation the browser streams marks where each React flush ends, so the browser
|
|
9625
|
-
// shows the page before its Suspense content arrives (FARM_FLUSH_MARKER).
|
|
9626
|
-
|
|
9653
|
+
// shows the page before its Suspense content arrives (FARM_FLUSH_MARKER). The marker
|
|
9654
|
+
// carries a random token sent in the F-Flush header: page content cannot forge one.
|
|
9655
|
+
const farmFlushToken = request.headers.get("f-stream") === "flush"
|
|
9656
|
+
? createFarmFlushToken()
|
|
9657
|
+
: "";` : `const farmLayoutKeyOf = null;
|
|
9627
9658
|
const farmPayloadOnlyNavigation = false;
|
|
9628
|
-
const
|
|
9659
|
+
const farmFlushToken = "";`}
|
|
9629
9660
|
const renderPageElement = async () => {
|
|
9630
9661
|
// First, render the page content
|
|
9631
9662
|
let pageElement;
|
|
@@ -9747,7 +9778,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9747
9778
|
}
|
|
9748
9779
|
|
|
9749
9780
|
wrappedElement = wrapWithFarmIntegrationProviders(wrappedElement);
|
|
9750
|
-
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern,
|
|
9781
|
+
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern, farmFlushToken);
|
|
9751
9782
|
};
|
|
9752
9783
|
const renderedPage = ${hasMiddlewareRuntime ? `await _runWithMiddlewareData(middlewareData, () =>
|
|
9753
9784
|
_runWithMiddlewareContext(middlewareContext, renderPageElement)
|
|
@@ -9815,7 +9846,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9815
9846
|
);
|
|
9816
9847
|
}
|
|
9817
9848
|
}
|
|
9818
|
-
${_optionalChain([config, 'access',
|
|
9849
|
+
${_optionalChain([config, 'access', _227 => _227.md, 'optionalAccess', _228 => _228.enabled]) ? `
|
|
9819
9850
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
9820
9851
|
// using the public path the .md request will be resolved against.
|
|
9821
9852
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -9834,7 +9865,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9834
9865
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
9835
9866
|
}
|
|
9836
9867
|
|
|
9837
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
9868
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _229 => _229.agent, 'optionalAccess', _230 => _230.jsonLd]), () => ( false)))} });
|
|
9838
9869
|
const title = renderedMetadata.title;
|
|
9839
9870
|
const metaTags = renderedMetadata.tags;
|
|
9840
9871
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -10054,7 +10085,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10054
10085
|
);
|
|
10055
10086
|
return applyProductionMiddlewareHeaders(farmOwnedResponse(streamedDocument, {
|
|
10056
10087
|
status: pageStatus,
|
|
10057
|
-
headers: {
|
|
10088
|
+
headers: {
|
|
10089
|
+
...responseHeaders,
|
|
10090
|
+
"x-farm-preload-streaming": "1",
|
|
10091
|
+
...(farmFlushToken ? { "F-Flush": farmFlushToken } : {}),
|
|
10092
|
+
},
|
|
10058
10093
|
}), middlewareHeaders);
|
|
10059
10094
|
}
|
|
10060
10095
|
|
|
@@ -10524,11 +10559,11 @@ ${generatePreloadResponseRuntimeSource()}
|
|
|
10524
10559
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
10525
10560
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
10526
10561
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
10527
|
-
${_optionalChain([config, 'access',
|
|
10562
|
+
${_optionalChain([config, 'access', _231 => _231.agent, 'optionalAccess', _232 => _232.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
10528
10563
|
basePath: farmLocalAPIBasePath,
|
|
10529
10564
|
dispatch: async (localRequest) =>
|
|
10530
10565
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
10531
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
10566
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _233 => _233.agent, 'optionalAccess', _234 => _234.noindexPreviews]) ? `
|
|
10532
10567
|
// Keep every response of a preview deployment out of search indexes.
|
|
10533
10568
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
10534
10569
|
}
|
|
@@ -10721,11 +10756,11 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
10721
10756
|
}
|
|
10722
10757
|
if (_chunk76GHW3WIcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
10723
10758
|
if (_chunk76GHW3WIcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
10724
|
-
if (
|
|
10759
|
+
if (_chunkNPQLMP7Mcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
10725
10760
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
10726
10761
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
10727
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
10728
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
10762
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _235 => _235.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
10763
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _236 => _236.regions, 'optionalAccess', _237 => _237.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
10729
10764
|
return "route runtime controls";
|
|
10730
10765
|
}
|
|
10731
10766
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -10738,8 +10773,8 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
10738
10773
|
return void 0;
|
|
10739
10774
|
}
|
|
10740
10775
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
10741
|
-
if (!_optionalChain([config, 'access',
|
|
10742
|
-
if (!_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) || !
|
|
10776
|
+
if (!_optionalChain([config, 'access', _238 => _238.docs, 'optionalAccess', _239 => _239.enabled]) || !config.docs.prerender) return [];
|
|
10777
|
+
if (!_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) || !_chunkGNJIYJMScjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
10743
10778
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
10744
10779
|
"docs.prerender needs a docs adapter such as @farming-labs/farmjs; Farm's built-in docs renderer keeps rendering docs pages on request."
|
|
10745
10780
|
);
|
|
@@ -10751,7 +10786,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
10751
10786
|
);
|
|
10752
10787
|
return [];
|
|
10753
10788
|
}
|
|
10754
|
-
const pages = await
|
|
10789
|
+
const pages = await _chunkGNJIYJMScjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
10755
10790
|
if (!pages) {
|
|
10756
10791
|
_chunkVQJYGZNXcjs.logger.warn(
|
|
10757
10792
|
`The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
|
|
@@ -10762,9 +10797,9 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
10762
10797
|
}
|
|
10763
10798
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
10764
10799
|
return Object.values(routeRules || {}).some((rule) => {
|
|
10765
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
10766
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
10767
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
10800
|
+
const swr = _optionalChain([rule, 'optionalAccess', _240 => _240.swr]);
|
|
10801
|
+
const cache = _optionalChain([rule, 'optionalAccess', _241 => _241.cache]);
|
|
10802
|
+
const headers = _optionalChain([rule, 'optionalAccess', _242 => _242.headers]);
|
|
10768
10803
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
10769
10804
|
});
|
|
10770
10805
|
}
|
|
@@ -10777,10 +10812,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10777
10812
|
const nitroBuilder = nitroBuilderResult.value;
|
|
10778
10813
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
10779
10814
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
10780
|
-
const outputDir =
|
|
10815
|
+
const outputDir = _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10781
10816
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
10782
10817
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
10783
|
-
const imageRuntime =
|
|
10818
|
+
const imageRuntime = _chunkWZW6LEHMcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
10784
10819
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
10785
10820
|
(image) => image.sourceType === "module"
|
|
10786
10821
|
);
|
|
@@ -11290,20 +11325,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
11290
11325
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
11291
11326
|
);
|
|
11292
11327
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
11293
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
11294
|
-
_optionalChain([nitroConfig, 'access',
|
|
11295
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
11328
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _243 => _243.rollupConfig, 'optionalAccess', _244 => _244.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _245 => _245.rollupConfig, 'optionalAccess', _246 => _246.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _247 => _247.output, 'optionalAccess', _248 => _248.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
11329
|
+
_optionalChain([nitroConfig, 'access', _249 => _249.handlers, 'optionalAccess', _250 => _250.some, 'call', _251 => _251(
|
|
11330
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _252 => _252.handler]) || "") === nitroEntryPath
|
|
11296
11331
|
)])
|
|
11297
11332
|
);
|
|
11298
11333
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
11299
11334
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
11300
11335
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
11301
11336
|
const shouldMinify = nitroConfig.minify !== false;
|
|
11302
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
11337
|
+
const keepServerNames = !(_optionalChain([config, 'access', _253 => _253.docs, 'optionalAccess', _254 => _254.enabled]) && _optionalChain([config, 'access', _255 => _255.docs, 'access', _256 => _256.adapter, 'optionalAccess', _257 => _257.server]));
|
|
11303
11338
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
11304
11339
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
11305
11340
|
if (canReusePrebuiltSSR) {
|
|
11306
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
11341
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _258 => _258.rollupConfig, 'optionalAccess', _259 => _259.plugins]);
|
|
11307
11342
|
nitroConfig.rollupConfig = {
|
|
11308
11343
|
...nitroConfig.rollupConfig,
|
|
11309
11344
|
plugins: [
|
|
@@ -11314,9 +11349,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
11314
11349
|
}
|
|
11315
11350
|
nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
|
|
11316
11351
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
11317
|
-
if (_optionalChain([config, 'access',
|
|
11352
|
+
if (_optionalChain([config, 'access', _260 => _260.md, 'optionalAccess', _261 => _261.enabled])) {
|
|
11318
11353
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
11319
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
11354
|
+
if (!route.contents || !_optionalChain([route, 'access', _262 => _262.contentType, 'optionalAccess', _263 => _263.toLowerCase, 'call', _264 => _264(), 'access', _265 => _265.includes, 'call', _266 => _266("html")])) return;
|
|
11320
11355
|
const alternatePath = _chunkWJFFPXCVcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
|
|
11321
11356
|
if (!alternatePath) return;
|
|
11322
11357
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
@@ -11337,7 +11372,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11337
11372
|
}
|
|
11338
11373
|
if (config.security.csp && config.security.csp.nonce) {
|
|
11339
11374
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
11340
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
11375
|
+
if (!route.contents || !_optionalChain([route, 'access', _267 => _267.contentType, 'optionalAccess', _268 => _268.toLowerCase, 'call', _269 => _269(), 'access', _270 => _270.includes, 'call', _271 => _271("html")])) return;
|
|
11341
11376
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
11342
11377
|
if (!staticCsp) return;
|
|
11343
11378
|
route.contents = staticCsp.html;
|
|
@@ -11412,13 +11447,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
11412
11447
|
}
|
|
11413
11448
|
if (prerenderRoutes.length > 0) {
|
|
11414
11449
|
_chunkVQJYGZNXcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
11415
|
-
const previousPrerender = process.env[
|
|
11416
|
-
process.env[
|
|
11450
|
+
const previousPrerender = process.env[_chunkQXPSWMUDcjs.FARM_PRERENDER_ENV];
|
|
11451
|
+
process.env[_chunkQXPSWMUDcjs.FARM_PRERENDER_ENV] = "1";
|
|
11417
11452
|
try {
|
|
11418
11453
|
await nitroBuilder.prerender(nitroInstance);
|
|
11419
11454
|
} finally {
|
|
11420
|
-
if (previousPrerender === void 0) delete process.env[
|
|
11421
|
-
else process.env[
|
|
11455
|
+
if (previousPrerender === void 0) delete process.env[_chunkQXPSWMUDcjs.FARM_PRERENDER_ENV];
|
|
11456
|
+
else process.env[_chunkQXPSWMUDcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
11422
11457
|
}
|
|
11423
11458
|
}
|
|
11424
11459
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
@@ -11543,7 +11578,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
11543
11578
|
await fs4.rename(src, dest);
|
|
11544
11579
|
return;
|
|
11545
11580
|
} catch (error) {
|
|
11546
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
11581
|
+
const code = _optionalChain([error, 'optionalAccess', _272 => _272.code]);
|
|
11547
11582
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
11548
11583
|
throw error;
|
|
11549
11584
|
}
|
|
@@ -11569,7 +11604,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
11569
11604
|
try {
|
|
11570
11605
|
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
11571
11606
|
} catch (error) {
|
|
11572
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
11607
|
+
if (_optionalChain([error, 'optionalAccess', _273 => _273.code]) !== "ENOENT") throw error;
|
|
11573
11608
|
}
|
|
11574
11609
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
11575
11610
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
@@ -11598,7 +11633,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
11598
11633
|
_chunkVQJYGZNXcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
11599
11634
|
}
|
|
11600
11635
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
11601
|
-
if (!_optionalChain([config, 'access',
|
|
11636
|
+
if (!_optionalChain([config, 'access', _274 => _274.docs, 'optionalAccess', _275 => _275.enabled])) return;
|
|
11602
11637
|
const [mainRoot, ...extraRoots] = _chunk5N7QAGEAcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
11603
11638
|
await copyFarmDocsRootContent(
|
|
11604
11639
|
mainRoot,
|
|
@@ -11701,7 +11736,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
11701
11736
|
try {
|
|
11702
11737
|
await copyPackage("sharp", sharpRequire);
|
|
11703
11738
|
if (!copiedPackages.has("sharp")) {
|
|
11704
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
11739
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkWZW6LEHMcjs.SHARP_INSTALL_HINT}`);
|
|
11705
11740
|
}
|
|
11706
11741
|
} catch (error) {
|
|
11707
11742
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -11931,7 +11966,7 @@ function createBuildTargetBaseline(config) {
|
|
|
11931
11966
|
preset,
|
|
11932
11967
|
distDir,
|
|
11933
11968
|
outputDir,
|
|
11934
|
-
outputWasDerived: outputDir ===
|
|
11969
|
+
outputWasDerived: outputDir === _chunkNPQLMP7Mcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
11935
11970
|
};
|
|
11936
11971
|
}
|
|
11937
11972
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -11940,8 +11975,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
11940
11975
|
const distDir = config.distDir || ".farm";
|
|
11941
11976
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
11942
11977
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
11943
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
11944
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
11978
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkNPQLMP7Mcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
11979
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkNPQLMP7Mcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
11945
11980
|
return {
|
|
11946
11981
|
root,
|
|
11947
11982
|
preset,
|
|
@@ -11949,7 +11984,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
11949
11984
|
distDir,
|
|
11950
11985
|
deployTarget,
|
|
11951
11986
|
outputDir,
|
|
11952
|
-
deployOutputDir:
|
|
11987
|
+
deployOutputDir: _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
11953
11988
|
};
|
|
11954
11989
|
}
|
|
11955
11990
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -11986,12 +12021,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
11986
12021
|
};
|
|
11987
12022
|
config = {
|
|
11988
12023
|
...config,
|
|
11989
|
-
images:
|
|
12024
|
+
images: _chunkWZW6LEHMcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
11990
12025
|
root: targets.root,
|
|
11991
12026
|
preset: targets.preset
|
|
11992
12027
|
})
|
|
11993
12028
|
};
|
|
11994
|
-
if (_optionalChain([config, 'access',
|
|
12029
|
+
if (_optionalChain([config, 'access', _276 => _276.docs, 'optionalAccess', _277 => _277.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
|
|
11995
12030
|
pluginManager.updateContext({ config });
|
|
11996
12031
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
11997
12032
|
_chunkVQJYGZNXcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
@@ -12005,8 +12040,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12005
12040
|
});
|
|
12006
12041
|
_chunkVQJYGZNXcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
12007
12042
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
12008
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
12009
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
12043
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _278 => _278.status]) === "rejected") throw productionViteResult.reason;
|
|
12044
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _279 => _279.value]);
|
|
12010
12045
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
12011
12046
|
projectModuleServer = await createProjectModuleServer(
|
|
12012
12047
|
createViteServer,
|
|
@@ -12014,7 +12049,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12014
12049
|
root,
|
|
12015
12050
|
rendererBuild.signal
|
|
12016
12051
|
);
|
|
12017
|
-
const farmApp =
|
|
12052
|
+
const farmApp = _chunkWZW6LEHMcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
12018
12053
|
await farmApp.initialize();
|
|
12019
12054
|
const routeManager = farmApp.getRouteManager();
|
|
12020
12055
|
const serverRenderer = farmApp.getServerRenderer();
|
|
@@ -12024,7 +12059,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12024
12059
|
layers: config.layers,
|
|
12025
12060
|
plugins: config.plugins,
|
|
12026
12061
|
extraRoutes: [
|
|
12027
|
-
..._optionalChain([config, 'access',
|
|
12062
|
+
..._optionalChain([config, 'access', _280 => _280.openapi, 'optionalAccess', _281 => _281.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
12028
12063
|
..._chunk5N7QAGEAcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
12029
12064
|
],
|
|
12030
12065
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
@@ -12109,7 +12144,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12109
12144
|
throw error;
|
|
12110
12145
|
} finally {
|
|
12111
12146
|
try {
|
|
12112
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
12147
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _282 => _282.close, 'call', _283 => _283()]);
|
|
12113
12148
|
} finally {
|
|
12114
12149
|
rendererBuild.abort();
|
|
12115
12150
|
}
|
|
@@ -12120,7 +12155,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12120
12155
|
ssr: true,
|
|
12121
12156
|
buildLifetime
|
|
12122
12157
|
});
|
|
12123
|
-
const viteConfig =
|
|
12158
|
+
const viteConfig = _chunkWZW6LEHMcjs.mergeFarmViteConfig.call(void 0,
|
|
12124
12159
|
{
|
|
12125
12160
|
root,
|
|
12126
12161
|
appType: "custom",
|
|
@@ -12132,7 +12167,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12132
12167
|
},
|
|
12133
12168
|
plugins: [
|
|
12134
12169
|
...rendererVitePlugins,
|
|
12135
|
-
|
|
12170
|
+
_chunkWZW6LEHMcjs.farmFontImportsPlugin.call(void 0, {
|
|
12136
12171
|
root,
|
|
12137
12172
|
basePath: config.basePath,
|
|
12138
12173
|
publicDir: config.publicDir
|
|
@@ -12144,7 +12179,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12144
12179
|
hmr: false
|
|
12145
12180
|
},
|
|
12146
12181
|
resolve: {
|
|
12147
|
-
alias:
|
|
12182
|
+
alias: _chunkWZW6LEHMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
12148
12183
|
dedupe: [...config.renderer.dedupe || []]
|
|
12149
12184
|
},
|
|
12150
12185
|
optimizeDeps: {
|
|
@@ -12177,10 +12212,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12177
12212
|
noDiscovery: true
|
|
12178
12213
|
},
|
|
12179
12214
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
12180
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
12215
|
+
environments: _optionalChain([viteConfig, 'access', _284 => _284.environments, 'optionalAccess', _285 => _285.ssr, 'optionalAccess', _286 => _286.dev, 'optionalAccess', _287 => _287.createEnvironment]) ? viteConfig.environments : {
|
|
12181
12216
|
...viteConfig.environments,
|
|
12182
12217
|
ssr: {
|
|
12183
|
-
..._optionalChain([viteConfig, 'access',
|
|
12218
|
+
..._optionalChain([viteConfig, 'access', _288 => _288.environments, 'optionalAccess', _289 => _289.ssr]),
|
|
12184
12219
|
...await createFarmProjectModuleSsrEnvironment()
|
|
12185
12220
|
}
|
|
12186
12221
|
}
|
|
@@ -12236,7 +12271,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
12236
12271
|
define: {
|
|
12237
12272
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
12238
12273
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
12239
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
12274
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _290 => _290.env, 'optionalAccess', _291 => _291.public]) || {})
|
|
12240
12275
|
},
|
|
12241
12276
|
plugins: [
|
|
12242
12277
|
farmI18nClientBridgePlugin(),
|
|
@@ -12269,7 +12304,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12269
12304
|
if (pluginManager) {
|
|
12270
12305
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
12271
12306
|
}
|
|
12272
|
-
const outputDir =
|
|
12307
|
+
const outputDir = _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
12273
12308
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
12274
12309
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
12275
12310
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -12340,7 +12375,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12340
12375
|
root,
|
|
12341
12376
|
preset,
|
|
12342
12377
|
distDir,
|
|
12343
|
-
outputDir:
|
|
12378
|
+
outputDir: _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
12344
12379
|
});
|
|
12345
12380
|
}
|
|
12346
12381
|
}
|