@farm.js/core 0.1.29 → 0.1.31
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-markdown.cjs +4 -4
- package/dist/app-markdown.mjs +3 -3
- package/dist/{chunk-Q5JFU33Q.cjs → chunk-2FXWWUE5.cjs} +4 -4
- package/dist/{chunk-6G3ZZ2IE.mjs → chunk-5LJCOSKT.mjs} +1 -1
- package/dist/{chunk-ZYVFAOBT.mjs → chunk-6L6DQR5W.mjs} +7 -7
- package/dist/{chunk-YMUE7L3D.mjs → chunk-6VYZOPOT.mjs} +1 -1
- package/dist/{chunk-BZ3CHOFX.mjs → chunk-7QOCTYBS.mjs} +1 -1
- package/dist/{chunk-PQD2AI3B.mjs → chunk-AHAJGAYD.mjs} +1 -1
- package/dist/{chunk-XLTV4VOG.cjs → chunk-CUMINO7Z.cjs} +4 -4
- package/dist/{chunk-JFHKNFEO.cjs → chunk-DFLLARUK.cjs} +10 -10
- package/dist/{chunk-7CXKSRKL.mjs → chunk-FJZ3DQLK.mjs} +2 -2
- package/dist/{chunk-BZAGKCKB.cjs → chunk-FYRBX5IY.cjs} +2 -2
- package/dist/{chunk-74T3CEA7.cjs → chunk-IFI5FXEZ.cjs} +127 -74
- package/dist/{chunk-X4ZV4QC5.cjs → chunk-IMB4PIAR.cjs} +72 -72
- package/dist/{chunk-ATXI6LGT.mjs → chunk-JBC2FKRW.mjs} +6 -3
- package/dist/{chunk-6CNX6Q3K.cjs → chunk-KJ2TIHZZ.cjs} +6 -3
- package/dist/{chunk-ZDILFMWN.cjs → chunk-MXDTKXO6.cjs} +13 -13
- package/dist/{chunk-D234YWNA.mjs → chunk-TEN4FIZU.mjs} +1 -1
- package/dist/{chunk-2UABTL3Y.mjs → chunk-UAFSBWNT.mjs} +2 -2
- package/dist/{chunk-E7UN576T.mjs → chunk-VA62MHFV.mjs} +1 -1
- package/dist/{chunk-WPPX4G7Q.cjs → chunk-VYZSOYR4.cjs} +1 -1
- package/dist/{chunk-5KDPVSS3.mjs → chunk-WG2KHOMN.mjs} +63 -10
- package/dist/{chunk-NXG66MR7.cjs → chunk-X7KZBF63.cjs} +3 -3
- package/dist/{chunk-NPPL5YDT.cjs → chunk-YVGAEAA5.cjs} +2 -2
- package/dist/{devtools-THVNPI2M.mjs → devtools-BPBCYOU6.mjs} +3 -3
- package/dist/{devtools-GGVPZHJX.cjs → devtools-EWRDHCD5.cjs} +4 -4
- package/dist/docs.cjs +6 -6
- package/dist/docs.mjs +5 -5
- package/dist/index.cjs +12 -12
- package/dist/index.mjs +11 -11
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +12 -12
- package/dist/internal/build-runtime.mjs +11 -11
- package/dist/internal/cli-runtime.cjs +5 -5
- package/dist/internal/cli-runtime.mjs +4 -4
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/config-runtime.cjs +4 -4
- package/dist/internal/config-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 +4 -4
- package/dist/internal/production-runtime.mjs +3 -3
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.mjs +1 -1
- package/dist/plugin.cjs +8 -8
- package/dist/plugin.mjs +7 -7
- package/dist/server.cjs +25 -25
- package/dist/server.mjs +8 -8
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +8 -8
- package/dist/vite.mjs +7 -7
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ var _chunkXD32KALFcjs = require('./chunk-XD32KALF.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkMXDTKXO6cjs = require('./chunk-MXDTKXO6.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ var _chunkZDILFMWNcjs = require('./chunk-ZDILFMWN.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunk2FXWWUE5cjs = require('./chunk-2FXWWUE5.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -37,7 +37,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkDFLLARUKcjs = require('./chunk-DFLLARUK.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
var _chunkKCMTCM6Icjs = require('./chunk-KCMTCM6I.cjs');
|
|
@@ -73,7 +73,7 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
var
|
|
76
|
+
var _chunkIMB4PIARcjs = require('./chunk-IMB4PIAR.cjs');
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
|
|
@@ -83,7 +83,7 @@ var _chunkCTV2TTNPcjs = require('./chunk-CTV2TTNP.cjs');
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
var
|
|
86
|
+
var _chunkYVGAEAA5cjs = require('./chunk-YVGAEAA5.cjs');
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
|
|
@@ -115,7 +115,7 @@ var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
|
|
|
115
115
|
var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
var
|
|
118
|
+
var _chunkCUMINO7Zcjs = require('./chunk-CUMINO7Z.cjs');
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
|
|
@@ -127,14 +127,14 @@ var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
|
|
|
127
127
|
var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
var
|
|
130
|
+
var _chunkX7KZBF63cjs = require('./chunk-X7KZBF63.cjs');
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
var
|
|
137
|
+
var _chunkKJ2TIHZZcjs = require('./chunk-KJ2TIHZZ.cjs');
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
@@ -282,7 +282,7 @@ function getDocsTitle(docs) {
|
|
|
282
282
|
}
|
|
283
283
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsTitle, "getDocsTitle");
|
|
284
284
|
function loadPages(contentDir, docs) {
|
|
285
|
-
return
|
|
285
|
+
return _chunk2FXWWUE5cjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunk2FXWWUE5cjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
286
286
|
}
|
|
287
287
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadPages, "loadPages");
|
|
288
288
|
function findSocialImagePath(html) {
|
|
@@ -303,14 +303,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
303
303
|
}
|
|
304
304
|
_chunkS3JO3N4Hcjs.__name.call(void 0, addHandlerRoute, "addHandlerRoute");
|
|
305
305
|
async function compileFarmDocsManifest(docs, options) {
|
|
306
|
-
const contentDir =
|
|
306
|
+
const contentDir = _chunk2FXWWUE5cjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
307
307
|
const pages = loadPages(contentDir, docs);
|
|
308
308
|
const absolutePaths = [
|
|
309
309
|
_path2.default.resolve(options.root),
|
|
310
310
|
_path2.default.resolve(contentDir),
|
|
311
311
|
docs.configPath || ""
|
|
312
312
|
];
|
|
313
|
-
const handler =
|
|
313
|
+
const handler = _chunk2FXWWUE5cjs.createFarmDocsHandler.call(void 0, docs, {
|
|
314
314
|
root: options.root,
|
|
315
315
|
srcDir: options.srcDir,
|
|
316
316
|
clientEntry: options.clientEntry,
|
|
@@ -318,7 +318,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
318
318
|
fontStylesheetHref: options.fontStylesheetHref,
|
|
319
319
|
globalStylesheetHref: options.globalStylesheetHref
|
|
320
320
|
});
|
|
321
|
-
const apiHandler =
|
|
321
|
+
const apiHandler = _chunkMXDTKXO6cjs.createFarmDocsAPIHandler.call(void 0, {
|
|
322
322
|
rootDir: options.root,
|
|
323
323
|
srcDir: options.srcDir,
|
|
324
324
|
docs
|
|
@@ -410,7 +410,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
410
410
|
post: await compileResponse(postResponse, absolutePaths),
|
|
411
411
|
search: {
|
|
412
412
|
pages: pages.map((page) => ({
|
|
413
|
-
...
|
|
413
|
+
..._chunk2FXWWUE5cjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
414
414
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
415
415
|
})),
|
|
416
416
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -1536,7 +1536,7 @@ function hasFarmPluginRoutes(config) {
|
|
|
1536
1536
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
|
|
1537
1537
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1538
1538
|
return (config.plugins || []).some(
|
|
1539
|
-
(plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false &&
|
|
1539
|
+
(plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkIMB4PIARcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1540
1540
|
);
|
|
1541
1541
|
}
|
|
1542
1542
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
|
|
@@ -1598,7 +1598,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1598
1598
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1599
1599
|
const srcDir = config.srcDir || "src";
|
|
1600
1600
|
const distDir = config.distDir || ".farm";
|
|
1601
|
-
const deployOutputDir =
|
|
1601
|
+
const deployOutputDir = _chunkDFLLARUKcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1602
1602
|
const lifecyclePluginManager = options.pluginManager;
|
|
1603
1603
|
const productionViteResultPromise = Promise.allSettled([
|
|
1604
1604
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -1617,7 +1617,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1617
1617
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
1618
1618
|
const pageRoutes = [];
|
|
1619
1619
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
1620
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
1620
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkX7KZBF63cjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
1621
1621
|
pageRoutes.push({
|
|
1622
1622
|
pattern,
|
|
1623
1623
|
modulePath: entry.modulePath,
|
|
@@ -1846,7 +1846,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
1846
1846
|
}
|
|
1847
1847
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
1848
1848
|
await fs.writeFile(fontCssPath, normalizedFontCss);
|
|
1849
|
-
await fs.writeFile(clientCssPath,
|
|
1849
|
+
await fs.writeFile(clientCssPath, _chunkIMB4PIARcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
1850
1850
|
}
|
|
1851
1851
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
|
|
1852
1852
|
var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
|
|
@@ -1896,7 +1896,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
1896
1896
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
|
|
1897
1897
|
let plan = cache.get(key);
|
|
1898
1898
|
if (!plan) {
|
|
1899
|
-
plan =
|
|
1899
|
+
plan = _chunkIMB4PIARcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
1900
1900
|
cache.set(key, plan);
|
|
1901
1901
|
}
|
|
1902
1902
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -1925,14 +1925,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1925
1925
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
1926
1926
|
);
|
|
1927
1927
|
}
|
|
1928
|
-
const isolatedMode =
|
|
1928
|
+
const isolatedMode = _chunkIMB4PIARcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
1929
1929
|
_optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]),
|
|
1930
1930
|
{
|
|
1931
1931
|
serverComponents: _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents]) === true,
|
|
1932
1932
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
1933
1933
|
}
|
|
1934
1934
|
);
|
|
1935
|
-
const planOptions =
|
|
1935
|
+
const planOptions = _chunkIMB4PIARcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
1936
1936
|
config.renderer,
|
|
1937
1937
|
Boolean(unsupportedIntegrationProvider)
|
|
1938
1938
|
);
|
|
@@ -1989,7 +1989,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1989
1989
|
), "isAdapterDocsRoute");
|
|
1990
1990
|
const syntheticDocsEntry = _optionalChain([config, 'access', _46 => _46.docs, 'optionalAccess', _47 => _47.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
1991
1991
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
1992
|
-
const markdownPagePlan =
|
|
1992
|
+
const markdownPagePlan = _chunkIMB4PIARcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
1993
1993
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
1994
1994
|
root,
|
|
1995
1995
|
isolatedMode,
|
|
@@ -1997,7 +1997,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1997
1997
|
);
|
|
1998
1998
|
const routePlans = pageRoutes.map((route) => ({
|
|
1999
1999
|
route,
|
|
2000
|
-
metadata:
|
|
2000
|
+
metadata: _chunkX7KZBF63cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2001
2001
|
route.modulePath,
|
|
2002
2002
|
root,
|
|
2003
2003
|
isolatedMode,
|
|
@@ -2005,7 +2005,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2005
2005
|
planOptions
|
|
2006
2006
|
)
|
|
2007
2007
|
}));
|
|
2008
|
-
|
|
2008
|
+
_chunkIMB4PIARcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2009
2009
|
clientLayouts.map((layout) => ({
|
|
2010
2010
|
pattern: layout.pattern,
|
|
2011
2011
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2037,7 +2037,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2037
2037
|
for (const layout of clientLayouts) {
|
|
2038
2038
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, route.pattern)) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
|
|
2039
2039
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2040
|
-
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${
|
|
2040
|
+
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkIMB4PIARcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
2043
|
if (isolatedMode === "analyze") {
|
|
@@ -2061,7 +2061,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2061
2061
|
);
|
|
2062
2062
|
if (metadata.suppressedAsyncHydration) {
|
|
2063
2063
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
2064
|
-
`\u26A0\uFE0F ${
|
|
2064
|
+
`\u26A0\uFE0F ${_chunkIMB4PIARcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2065
2065
|
);
|
|
2066
2066
|
}
|
|
2067
2067
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2120,7 +2120,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2120
2120
|
}
|
|
2121
2121
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2122
2122
|
try {
|
|
2123
|
-
return
|
|
2123
|
+
return _chunkIMB4PIARcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2124
2124
|
} catch (error) {
|
|
2125
2125
|
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2126
2126
|
return false;
|
|
@@ -2150,7 +2150,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2150
2150
|
config.trailingSlash,
|
|
2151
2151
|
_chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2152
2152
|
config.basePath,
|
|
2153
|
-
|
|
2153
|
+
_chunkIMB4PIARcjs.generateClientCachePersistenceCode.call(void 0, _chunkIMB4PIARcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2154
2154
|
adapterOwnsDocsRuntime ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2155
2155
|
);
|
|
2156
2156
|
await fs.writeFile(clientEntryPath, clientHydrationCode);
|
|
@@ -2167,7 +2167,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2167
2167
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2168
2168
|
await fs.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2169
2169
|
postcssSearchPath = clientEntryDir;
|
|
2170
|
-
tailwindVitePlugin = await
|
|
2170
|
+
tailwindVitePlugin = await _chunkIMB4PIARcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2171
2171
|
builder: productionVite.builder,
|
|
2172
2172
|
announce: true
|
|
2173
2173
|
});
|
|
@@ -2236,7 +2236,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2236
2236
|
}
|
|
2237
2237
|
},
|
|
2238
2238
|
plugins: [
|
|
2239
|
-
|
|
2239
|
+
_chunkIMB4PIARcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2240
2240
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
2241
2241
|
...rendererVitePlugins,
|
|
2242
2242
|
...config.vite.plugins || [],
|
|
@@ -2297,7 +2297,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2297
2297
|
} : void 0,
|
|
2298
2298
|
// Ensure React is bundled for client
|
|
2299
2299
|
resolve: {
|
|
2300
|
-
alias:
|
|
2300
|
+
alias: _chunkIMB4PIARcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2301
2301
|
dedupe: [...config.renderer.dedupe || []]
|
|
2302
2302
|
},
|
|
2303
2303
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2310,7 +2310,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2310
2310
|
]
|
|
2311
2311
|
}
|
|
2312
2312
|
};
|
|
2313
|
-
await viteBuild(
|
|
2313
|
+
await viteBuild(_chunkIMB4PIARcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2314
2314
|
await mergeBuiltFontCss(outputDir);
|
|
2315
2315
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2316
2316
|
} finally {
|
|
@@ -3069,7 +3069,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3069
3069
|
direction: {}
|
|
3070
3070
|
}, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
3071
3071
|
const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
|
|
3072
|
-
const clientPluginEntry =
|
|
3072
|
+
const clientPluginEntry = _chunkIMB4PIARcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3073
3073
|
plugins,
|
|
3074
3074
|
root,
|
|
3075
3075
|
srcDir,
|
|
@@ -3080,7 +3080,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3080
3080
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3081
3081
|
import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3082
3082
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3083
|
-
const providerClientCode =
|
|
3083
|
+
const providerClientCode = _chunkIMB4PIARcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3084
3084
|
integrationProviders,
|
|
3085
3085
|
root,
|
|
3086
3086
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3565,7 +3565,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3565
3565
|
});
|
|
3566
3566
|
}
|
|
3567
3567
|
|
|
3568
|
-
${
|
|
3568
|
+
${_chunkIMB4PIARcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
3569
3569
|
// Wrap a page element with applicable layouts
|
|
3570
3570
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
3571
3571
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4480,7 +4480,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4480
4480
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
4481
4481
|
"module.exports = { plugins: [] };\n"
|
|
4482
4482
|
);
|
|
4483
|
-
tailwindVitePlugin = await
|
|
4483
|
+
tailwindVitePlugin = await _chunkIMB4PIARcjs.loadTailwindVitePlugin.call(void 0, {
|
|
4484
4484
|
builder: productionVite.builder,
|
|
4485
4485
|
label: "for SSR"
|
|
4486
4486
|
});
|
|
@@ -4576,7 +4576,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4576
4576
|
}
|
|
4577
4577
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
4578
4578
|
const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
4579
|
-
const notFoundPath =
|
|
4579
|
+
const notFoundPath = _chunkIMB4PIARcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
4580
4580
|
if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
4581
4581
|
layoutRoutes.sort((a, b) => {
|
|
4582
4582
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -4599,7 +4599,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4599
4599
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
4600
4600
|
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _56 => _56.mdx, 'optionalAccess', _57 => _57.components]));
|
|
4601
4601
|
const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
|
|
4602
|
-
const hasRouteContextConfig =
|
|
4602
|
+
const hasRouteContextConfig = _chunkDFLLARUKcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
4603
4603
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
4604
4604
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
4605
4605
|
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
@@ -4608,7 +4608,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4608
4608
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
4609
4609
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
4610
4610
|
);
|
|
4611
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await
|
|
4611
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await _chunkMXDTKXO6cjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
4612
4612
|
root,
|
|
4613
4613
|
srcDir: config.srcDir,
|
|
4614
4614
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -4758,7 +4758,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4758
4758
|
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _68 => _68.env, 'optionalAccess', _69 => _69.public]) || {})
|
|
4759
4759
|
},
|
|
4760
4760
|
plugins: [
|
|
4761
|
-
|
|
4761
|
+
_chunkIMB4PIARcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
4762
4762
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
4763
4763
|
...rendererVitePlugins,
|
|
4764
4764
|
...config.vite.plugins || [],
|
|
@@ -4805,7 +4805,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4805
4805
|
resolve: {
|
|
4806
4806
|
alias: [
|
|
4807
4807
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
4808
|
-
...Object.entries(
|
|
4808
|
+
...Object.entries(_chunkIMB4PIARcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
4809
4809
|
([find, replacement]) => ({ find, replacement })
|
|
4810
4810
|
)
|
|
4811
4811
|
],
|
|
@@ -4813,7 +4813,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4813
4813
|
dedupe: [...config.renderer.dedupe || []]
|
|
4814
4814
|
}
|
|
4815
4815
|
};
|
|
4816
|
-
await viteBuild(
|
|
4816
|
+
await viteBuild(_chunkIMB4PIARcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
4817
4817
|
} finally {
|
|
4818
4818
|
if (postcssConfigDir) {
|
|
4819
4819
|
try {
|
|
@@ -5204,6 +5204,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
5204
5204
|
config.renderer,
|
|
5205
5205
|
_chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset)
|
|
5206
5206
|
);
|
|
5207
|
+
const hasReactSyncRender = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer);
|
|
5207
5208
|
const rendererServerImports = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
5208
5209
|
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)}`;
|
|
5209
5210
|
const routeClientGraphServerRuntime = hasIsolatedClientGraphRuntime ? `function wrapFarmRouteClientGraph(element) {
|
|
@@ -5231,7 +5232,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5231
5232
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
5232
5233
|
);
|
|
5233
5234
|
}
|
|
5234
|
-
const providerServerModules =
|
|
5235
|
+
const providerServerModules = _chunkIMB4PIARcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
5235
5236
|
renderedIntegrationProviders,
|
|
5236
5237
|
config.root,
|
|
5237
5238
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
@@ -5251,14 +5252,14 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5251
5252
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
5252
5253
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
5253
5254
|
);
|
|
5254
|
-
const isolatedHydrationMode =
|
|
5255
|
+
const isolatedHydrationMode = _chunkIMB4PIARcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
5255
5256
|
_optionalChain([config, 'access', _88 => _88.experimental, 'optionalAccess', _89 => _89.isolatedClientHydration]),
|
|
5256
5257
|
{
|
|
5257
5258
|
serverComponents: _optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.serverComponents]) === true,
|
|
5258
5259
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
5259
5260
|
}
|
|
5260
5261
|
);
|
|
5261
|
-
const hydrationPlanOptions =
|
|
5262
|
+
const hydrationPlanOptions = _chunkIMB4PIARcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
5262
5263
|
config.renderer,
|
|
5263
5264
|
Boolean(unsupportedIntegrationProvider)
|
|
5264
5265
|
);
|
|
@@ -5273,7 +5274,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5273
5274
|
hydrationPlanOptions
|
|
5274
5275
|
)
|
|
5275
5276
|
}));
|
|
5276
|
-
const markdownPagePlan =
|
|
5277
|
+
const markdownPagePlan = _chunkIMB4PIARcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
5277
5278
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
5278
5279
|
config.root,
|
|
5279
5280
|
isolatedHydrationMode,
|
|
@@ -5282,7 +5283,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5282
5283
|
const pageHydrationPlans = new Map(
|
|
5283
5284
|
pageRoutes.map((route) => [
|
|
5284
5285
|
route.modulePath,
|
|
5285
|
-
|
|
5286
|
+
_chunkX7KZBF63cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
5286
5287
|
route.modulePath,
|
|
5287
5288
|
config.root,
|
|
5288
5289
|
isolatedHydrationMode,
|
|
@@ -5291,7 +5292,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5291
5292
|
)
|
|
5292
5293
|
])
|
|
5293
5294
|
);
|
|
5294
|
-
|
|
5295
|
+
_chunkIMB4PIARcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
5295
5296
|
layoutHydrationPlans.map((layout) => ({
|
|
5296
5297
|
pattern: layout.pattern,
|
|
5297
5298
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -5332,7 +5333,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5332
5333
|
}).map(({ route }) => route);
|
|
5333
5334
|
orderedPageRoutes.forEach((route, index) => {
|
|
5334
5335
|
const varName = `pageRoute${index}`;
|
|
5335
|
-
if (
|
|
5336
|
+
if (_chunkX7KZBF63cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
5336
5337
|
pageRegistrations.push(`
|
|
5337
5338
|
{
|
|
5338
5339
|
pattern: ${JSON.stringify(route.pattern)},
|
|
@@ -5729,6 +5730,7 @@ ${routeClientGraphServerRuntime}
|
|
|
5729
5730
|
|
|
5730
5731
|
const farmRendererStreamingCapabilities = ${JSON.stringify(rendererStreamingCapabilities)};
|
|
5731
5732
|
const farmRendererName = ${JSON.stringify(config.renderer.name)};
|
|
5733
|
+
const farmReactSyncRender = ${JSON.stringify(hasReactSyncRender)};
|
|
5732
5734
|
const farmRendererRuntime = ${JSON.stringify(_chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset))};
|
|
5733
5735
|
const farmRendererRuntimeStreamingCapabilities = ReactDOMServer.capabilities &&
|
|
5734
5736
|
ReactDOMServer.capabilities.streaming;
|
|
@@ -5774,7 +5776,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
5774
5776
|
|
|
5775
5777
|
function FarmDefault404Page() {
|
|
5776
5778
|
return React.createElement(React.Fragment, null,
|
|
5777
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
5779
|
+
React.createElement("style", null, ${JSON.stringify(_chunkIMB4PIARcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
5778
5780
|
React.createElement("main", {
|
|
5779
5781
|
className: "farm-default-not-found",
|
|
5780
5782
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -5985,6 +5987,9 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _117 => _117.docs, '
|
|
|
5985
5987
|
contentDir: farmDocsResolvedConfig.contentDir || farmDocsResolvedConfig.config?.contentDir,
|
|
5986
5988
|
}, {
|
|
5987
5989
|
rootDir: farmDocsRuntimeRoot,
|
|
5990
|
+
// A production build's content cannot change, so the adapter reads its
|
|
5991
|
+
// navigation once instead of scanning the content directory per request.
|
|
5992
|
+
immutableContent: true,
|
|
5988
5993
|
clientEntry: "/__farm_client_js_src__",
|
|
5989
5994
|
// Font CSS is merged into the client stylesheet; farm-fonts.css only exists when the
|
|
5990
5995
|
// app has fonts, so linking it separately 404'd for apps without them.
|
|
@@ -6013,7 +6018,7 @@ const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRe
|
|
|
6013
6018
|
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path7, methods }) => ({ path: path7, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
|
|
6014
6019
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunkWPYFSQKKcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
6015
6020
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
6016
|
-
${_optionalChain([config, 'access', _121 => _121.agent, 'optionalAccess', _122 => _122.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(
|
|
6021
|
+
${_optionalChain([config, 'access', _121 => _121.agent, 'optionalAccess', _122 => _122.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkYVGAEAA5cjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
6017
6022
|
` : ""}
|
|
6018
6023
|
function isFarmLocalAPIPathname(pathname) {
|
|
6019
6024
|
return farmLocalAPIBasePath !== "/" &&
|
|
@@ -6128,8 +6133,10 @@ function escapeFarmHtmlAttribute(value) {
|
|
|
6128
6133
|
.replace(/>/g, ">");
|
|
6129
6134
|
}
|
|
6130
6135
|
|
|
6131
|
-
async function renderFarmElement(ReactDOMServer, element) {
|
|
6136
|
+
async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
6132
6137
|
const streamErrors = [];
|
|
6138
|
+
const syncHtml = renderFarmElementSync(ReactDOMServer, element, routeKey);
|
|
6139
|
+
if (syncHtml !== undefined) return { html: syncHtml, shellHtml: syncHtml, streamErrors };
|
|
6133
6140
|
let encoder;
|
|
6134
6141
|
const normalizeChunk = function(chunk) {
|
|
6135
6142
|
if (typeof chunk === "string") return (encoder ||= new TextEncoder()).encode(chunk);
|
|
@@ -6200,6 +6207,7 @@ async function renderFarmElement(ReactDOMServer, element) {
|
|
|
6200
6207
|
}
|
|
6201
6208
|
throwStreamError();
|
|
6202
6209
|
const html = decodeChunks(chunks);
|
|
6210
|
+
rememberFarmSyncRender(routeKey, html);
|
|
6203
6211
|
return { html, shellHtml: html, streamErrors };
|
|
6204
6212
|
}
|
|
6205
6213
|
|
|
@@ -6331,6 +6339,7 @@ async function renderFarmElement(ReactDOMServer, element) {
|
|
|
6331
6339
|
await complete;
|
|
6332
6340
|
throwStreamError();
|
|
6333
6341
|
const html = decodeChunks(chunks);
|
|
6342
|
+
rememberFarmSyncRender(routeKey, html);
|
|
6334
6343
|
return { html, shellHtml: html, streamErrors };
|
|
6335
6344
|
}
|
|
6336
6345
|
|
|
@@ -6371,6 +6380,45 @@ async function renderFarmElementToString(ReactDOMServer, element) {
|
|
|
6371
6380
|
return html;
|
|
6372
6381
|
}
|
|
6373
6382
|
|
|
6383
|
+
// Most pages render without suspending. React's renderToString renders them in
|
|
6384
|
+
// one synchronous pass with string output, about half the CPU of the streaming
|
|
6385
|
+
// renderer, and the same markup, except that React 19's streaming renderer adds
|
|
6386
|
+
// a doctype before an <html> root. A route uses it only after a streaming render
|
|
6387
|
+
// of that route finished without suspending (remembering whether that render
|
|
6388
|
+
// started with a doctype), so a page that suspends keeps streaming and renders
|
|
6389
|
+
// once. If such a route suspends later (a Suspense boundary left to the
|
|
6390
|
+
// client, marked <!--$!-->, or a throw), that request renders again through the
|
|
6391
|
+
// streaming path and the route streams for the rest of this server process.
|
|
6392
|
+
const farmSyncRenderRoutes = new Map();
|
|
6393
|
+
const farmStreamingRenderRoutes = new Set();
|
|
6394
|
+
const FARM_STREAMED_DOCTYPE = "<!DOCTYPE html>";
|
|
6395
|
+
|
|
6396
|
+
function rememberFarmSyncRender(routeKey, streamedHtml) {
|
|
6397
|
+
if (!farmReactSyncRender || routeKey === undefined) return;
|
|
6398
|
+
if (!farmStreamingRenderRoutes.has(routeKey)) {
|
|
6399
|
+
farmSyncRenderRoutes.set(routeKey, streamedHtml.startsWith(FARM_STREAMED_DOCTYPE));
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
|
|
6403
|
+
function renderFarmElementSync(ReactDOMServer, element, routeKey) {
|
|
6404
|
+
if (!farmReactSyncRender) return undefined;
|
|
6405
|
+
const addsDoctype = routeKey === undefined ? undefined : farmSyncRenderRoutes.get(routeKey);
|
|
6406
|
+
if (addsDoctype === undefined) return undefined;
|
|
6407
|
+
if (typeof ReactDOMServer.renderToString !== "function") return undefined;
|
|
6408
|
+
let html;
|
|
6409
|
+
try {
|
|
6410
|
+
html = ReactDOMServer.renderToString(element);
|
|
6411
|
+
} catch {
|
|
6412
|
+
html = undefined;
|
|
6413
|
+
}
|
|
6414
|
+
if (typeof html !== "string" || html.includes("<!--$!-->")) {
|
|
6415
|
+
farmSyncRenderRoutes.delete(routeKey);
|
|
6416
|
+
farmStreamingRenderRoutes.add(routeKey);
|
|
6417
|
+
return undefined;
|
|
6418
|
+
}
|
|
6419
|
+
return addsDoctype && html.startsWith("<html") ? FARM_STREAMED_DOCTYPE + html : html;
|
|
6420
|
+
}
|
|
6421
|
+
|
|
6374
6422
|
function createFarmDocumentStream(contentStream, prefix, suffix, onComplete) {
|
|
6375
6423
|
const encoder = new TextEncoder();
|
|
6376
6424
|
const reader = contentStream.getReader();
|
|
@@ -6410,7 +6458,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
6410
6458
|
let inner = markup.replace(/^\\s+/, "");
|
|
6411
6459
|
let hoisted = "";
|
|
6412
6460
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
|
|
6413
|
-
const hoistable = /${
|
|
6461
|
+
const hoistable = /${_chunkIMB4PIARcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
6414
6462
|
let match;
|
|
6415
6463
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
6416
6464
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -7730,7 +7778,7 @@ async function handleFarmRequestInContext(
|
|
|
7730
7778
|
` : ""}
|
|
7731
7779
|
${_optionalChain([config, 'access', _137 => _137.agent, 'optionalAccess', _138 => _138.apiCatalog]) ? `
|
|
7732
7780
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
7733
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
7781
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkYVGAEAA5cjs.FARM_API_CATALOG_PATH)}) {
|
|
7734
7782
|
return applyProductionMiddlewareHeaders(
|
|
7735
7783
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
7736
7784
|
middlewareHeaders,
|
|
@@ -8160,7 +8208,7 @@ async function handleFarmRequestInContext(
|
|
|
8160
8208
|
}
|
|
8161
8209
|
|
|
8162
8210
|
wrappedElement = wrapWithFarmIntegrationProviders(wrappedElement);
|
|
8163
|
-
return renderFarmElement(ReactDOMServer, wrappedElement);
|
|
8211
|
+
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern);
|
|
8164
8212
|
};
|
|
8165
8213
|
const renderedPage = ${hasMiddlewareRuntime ? `await _runWithMiddlewareData(middlewareData, () =>
|
|
8166
8214
|
_runWithMiddlewareContext(middlewareContext, renderPageElement)
|
|
@@ -9046,7 +9094,7 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
9046
9094
|
}
|
|
9047
9095
|
if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
|
|
9048
9096
|
if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
|
|
9049
|
-
if (
|
|
9097
|
+
if (_chunkDFLLARUKcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
9050
9098
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
9051
9099
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
9052
9100
|
if (_optionalChain([manifestEntry, 'optionalAccess', _158 => _158.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
@@ -9072,7 +9120,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9072
9120
|
const nitroBuilder = nitroBuilderResult.value;
|
|
9073
9121
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
9074
9122
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
9075
|
-
const outputDir =
|
|
9123
|
+
const outputDir = _chunkDFLLARUKcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
9076
9124
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
9077
9125
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
9078
9126
|
const imageRuntime = resolveImageRuntime(config, preset);
|
|
@@ -9370,6 +9418,11 @@ function toFarmNodeResponse(request, response) {
|
|
|
9370
9418
|
baseURL: "/"
|
|
9371
9419
|
}
|
|
9372
9420
|
],
|
|
9421
|
+
// A self-hosted Node server sends static files itself, so precompress them
|
|
9422
|
+
// with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
|
|
9423
|
+
// fixed top quality cost a docs app ~20 s of build CPU for a small further
|
|
9424
|
+
// saving. Serverless and edge targets sit behind a CDN that compresses.
|
|
9425
|
+
...preset === "node-server" ? { compressPublicAssets: { gzip: true } } : {},
|
|
9373
9426
|
...prerenderRoutes.length > 0 ? {
|
|
9374
9427
|
prerender: {
|
|
9375
9428
|
crawlLinks: false,
|
|
@@ -9470,7 +9523,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
9470
9523
|
if (_optionalChain([config, 'access', _178 => _178.md, 'optionalAccess', _179 => _179.enabled])) {
|
|
9471
9524
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
9472
9525
|
if (!route.contents || !_optionalChain([route, 'access', _180 => _180.contentType, 'optionalAccess', _181 => _181.toLowerCase, 'call', _182 => _182(), 'access', _183 => _183.includes, 'call', _184 => _184("html")])) return;
|
|
9473
|
-
const alternatePath =
|
|
9526
|
+
const alternatePath = _chunkKJ2TIHZZcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
|
|
9474
9527
|
if (!alternatePath) return;
|
|
9475
9528
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
9476
9529
|
const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
@@ -9491,7 +9544,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
9491
9544
|
if (config.security.csp && config.security.csp.nonce) {
|
|
9492
9545
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
9493
9546
|
if (!route.contents || !_optionalChain([route, 'access', _185 => _185.contentType, 'optionalAccess', _186 => _186.toLowerCase, 'call', _187 => _187(), 'access', _188 => _188.includes, 'call', _189 => _189("html")])) return;
|
|
9494
|
-
const staticCsp = await
|
|
9547
|
+
const staticCsp = await _chunkCUMINO7Zcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
9495
9548
|
if (!staticCsp) return;
|
|
9496
9549
|
route.contents = staticCsp.html;
|
|
9497
9550
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
@@ -9758,7 +9811,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
|
|
|
9758
9811
|
const docsContentDir = resolveBuildDocsContentDir(config, root);
|
|
9759
9812
|
if (!docsContentDir) return;
|
|
9760
9813
|
const bundledContentDir = _path2.default.join(nitroFuncDir, "farm-docs-content");
|
|
9761
|
-
const lastModifiedManifest =
|
|
9814
|
+
const lastModifiedManifest = _chunk2FXWWUE5cjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
9762
9815
|
fallback: "now"
|
|
9763
9816
|
});
|
|
9764
9817
|
await fs.rm(bundledContentDir, { recursive: true, force: true });
|
|
@@ -9768,7 +9821,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
|
|
|
9768
9821
|
force: true
|
|
9769
9822
|
});
|
|
9770
9823
|
await fs.writeFile(
|
|
9771
|
-
_path2.default.join(bundledContentDir,
|
|
9824
|
+
_path2.default.join(bundledContentDir, _chunk2FXWWUE5cjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
9772
9825
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
9773
9826
|
`
|
|
9774
9827
|
);
|
|
@@ -9845,7 +9898,7 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
|
|
|
9845
9898
|
try {
|
|
9846
9899
|
await copyPackage("sharp", sharpRequire);
|
|
9847
9900
|
if (!copiedPackages.has("sharp")) {
|
|
9848
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
9901
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkIMB4PIARcjs.SHARP_INSTALL_HINT}`);
|
|
9849
9902
|
}
|
|
9850
9903
|
} catch (error) {
|
|
9851
9904
|
await fs.rm(stageDir, { recursive: true, force: true });
|
|
@@ -10059,7 +10112,7 @@ function createBuildTargetBaseline(config) {
|
|
|
10059
10112
|
preset,
|
|
10060
10113
|
distDir,
|
|
10061
10114
|
outputDir,
|
|
10062
|
-
outputWasDerived: outputDir ===
|
|
10115
|
+
outputWasDerived: outputDir === _chunkDFLLARUKcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
10063
10116
|
};
|
|
10064
10117
|
}
|
|
10065
10118
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
|
|
@@ -10069,8 +10122,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
10069
10122
|
const distDir = config.distDir || ".farm";
|
|
10070
10123
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
10071
10124
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
10072
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
10073
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
10125
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkDFLLARUKcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
10126
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkDFLLARUKcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
10074
10127
|
return {
|
|
10075
10128
|
root,
|
|
10076
10129
|
preset,
|
|
@@ -10078,7 +10131,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
10078
10131
|
distDir,
|
|
10079
10132
|
deployTarget,
|
|
10080
10133
|
outputDir,
|
|
10081
|
-
deployOutputDir:
|
|
10134
|
+
deployOutputDir: _chunkDFLLARUKcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
10082
10135
|
};
|
|
10083
10136
|
}
|
|
10084
10137
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
|
|
@@ -10087,7 +10140,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10087
10140
|
const targetBaseline = createBuildTargetBaseline(config);
|
|
10088
10141
|
let targets;
|
|
10089
10142
|
const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
|
|
10090
|
-
const pluginManager = new (0,
|
|
10143
|
+
const pluginManager = new (0, _chunkIMB4PIARcjs.PluginManager)({
|
|
10091
10144
|
config,
|
|
10092
10145
|
isDev: false,
|
|
10093
10146
|
isProd: true
|
|
@@ -10116,7 +10169,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10116
10169
|
};
|
|
10117
10170
|
config = {
|
|
10118
10171
|
...config,
|
|
10119
|
-
images:
|
|
10172
|
+
images: _chunkIMB4PIARcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
10120
10173
|
root: targets.root,
|
|
10121
10174
|
preset: targets.preset
|
|
10122
10175
|
})
|
|
@@ -10144,7 +10197,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10144
10197
|
root,
|
|
10145
10198
|
rendererBuild.signal
|
|
10146
10199
|
);
|
|
10147
|
-
const farmApp =
|
|
10200
|
+
const farmApp = _chunkIMB4PIARcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
10148
10201
|
await farmApp.initialize();
|
|
10149
10202
|
const routeManager = farmApp.getRouteManager();
|
|
10150
10203
|
const serverRenderer = farmApp.getServerRenderer();
|
|
@@ -10155,7 +10208,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10155
10208
|
plugins: config.plugins,
|
|
10156
10209
|
extraRoutes: [
|
|
10157
10210
|
..._optionalChain([config, 'access', _196 => _196.openapi, 'optionalAccess', _197 => _197.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
10158
|
-
...
|
|
10211
|
+
..._chunk2FXWWUE5cjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
10159
10212
|
],
|
|
10160
10213
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
10161
10214
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -10251,7 +10304,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10251
10304
|
ssr: true,
|
|
10252
10305
|
buildLifetime
|
|
10253
10306
|
});
|
|
10254
|
-
const viteConfig =
|
|
10307
|
+
const viteConfig = _chunkIMB4PIARcjs.mergeFarmViteConfig.call(void 0,
|
|
10255
10308
|
{
|
|
10256
10309
|
root,
|
|
10257
10310
|
appType: "custom",
|
|
@@ -10263,7 +10316,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10263
10316
|
},
|
|
10264
10317
|
plugins: [
|
|
10265
10318
|
...rendererVitePlugins,
|
|
10266
|
-
|
|
10319
|
+
_chunkIMB4PIARcjs.farmFontImportsPlugin.call(void 0, {
|
|
10267
10320
|
root,
|
|
10268
10321
|
basePath: config.basePath,
|
|
10269
10322
|
publicDir: config.publicDir
|
|
@@ -10275,7 +10328,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10275
10328
|
hmr: false
|
|
10276
10329
|
},
|
|
10277
10330
|
resolve: {
|
|
10278
|
-
alias:
|
|
10331
|
+
alias: _chunkIMB4PIARcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
10279
10332
|
dedupe: [...config.renderer.dedupe || []]
|
|
10280
10333
|
},
|
|
10281
10334
|
optimizeDeps: {
|
|
@@ -10396,7 +10449,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10396
10449
|
if (pluginManager) {
|
|
10397
10450
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
10398
10451
|
}
|
|
10399
|
-
const outputDir =
|
|
10452
|
+
const outputDir = _chunkDFLLARUKcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10400
10453
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
10401
10454
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
10402
10455
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -10467,7 +10520,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10467
10520
|
root,
|
|
10468
10521
|
preset,
|
|
10469
10522
|
distDir,
|
|
10470
|
-
outputDir:
|
|
10523
|
+
outputDir: _chunkDFLLARUKcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
10471
10524
|
});
|
|
10472
10525
|
}
|
|
10473
10526
|
}
|