@farm.js/core 0.1.48 → 0.1.49
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-DAjB8Eyu.d.ts → agent-mcp-Bb8hnnqd.d.ts} +1 -1
- package/dist/{agent-mcp-CXN3g0eX.d.mts → agent-mcp-ir3v4fHf.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/{app-DytgRPjJ.d.mts → app-DLzz02du.d.mts} +4 -4
- package/dist/{app-manifest-DPgW5ke5.d.mts → app-manifest-Crn8Qd3U.d.mts} +1 -1
- package/dist/{app-manifest-BUu7YGAx.d.ts → app-manifest-DNeTKMRL.d.ts} +1 -1
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{app-VK9sHDn5.d.ts → app-y649szYm.d.ts} +4 -4
- package/dist/{chunk-Q2ZKQ6GD.cjs → chunk-4HM5B5RR.cjs} +62 -62
- package/dist/{chunk-MZZA6ZQV.mjs → chunk-7PZVXMWG.mjs} +4 -4
- package/dist/{chunk-HRLYO2XJ.mjs → chunk-ACI52TCN.mjs} +1 -1
- package/dist/{chunk-VDLF2DJA.cjs → chunk-AIHD6VME.cjs} +276 -91
- package/dist/{chunk-YSPMY4B7.cjs → chunk-C5S457CK.cjs} +170 -108
- package/dist/{chunk-NRFUVDTH.mjs → chunk-DGVVVYKD.mjs} +1 -1
- package/dist/{chunk-WUEDTW6E.cjs → chunk-FR4HJDI6.cjs} +21 -0
- package/dist/{chunk-HUL4LTC6.cjs → chunk-HTLCLOXQ.cjs} +63 -20
- package/dist/{chunk-N7SPZJLY.mjs → chunk-IVHPRF4W.mjs} +5 -5
- package/dist/{chunk-6M3HXUBQ.mjs → chunk-J27BZO67.mjs} +21 -0
- package/dist/{chunk-JLS6ZLFM.cjs → chunk-J5VCA45K.cjs} +1 -1
- package/dist/{chunk-ZGS3ZDF7.cjs → chunk-NPPT4RWF.cjs} +2 -2
- package/dist/{chunk-TFA6BUAE.cjs → chunk-OY5XDG24.cjs} +4 -4
- package/dist/{chunk-N6SIQJEJ.mjs → chunk-RYDDUCNJ.mjs} +54 -11
- package/dist/{chunk-C2R5RVLA.cjs → chunk-VCKGOXFI.cjs} +73 -1
- package/dist/{chunk-TQWGOQ7O.mjs → chunk-Z3BXMMFF.mjs} +80 -18
- package/dist/{chunk-NE33FRQ5.mjs → chunk-Z4LTSH7D.mjs} +207 -22
- package/dist/{chunk-NIPKC4DA.mjs → chunk-ZIBIE7AH.mjs} +72 -0
- package/dist/{client-plugins-BlEzV5FO.d.mts → client-plugins-BNBeyLMi.d.mts} +4 -2
- package/dist/{client-plugins-DqjCsKMN.d.ts → client-plugins-DFDQUI9Q.d.ts} +4 -2
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{dev-guard-4NQ3LFO5.cjs → dev-guard-PLHL6OTJ.cjs} +3 -2
- package/dist/{dev-guard-MPZUJFIV.mjs → dev-guard-YO6KPIOQ.mjs} +2 -1
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/{index-CMigAr9f.d.mts → index-CeJ9_s9p.d.mts} +1 -1
- package/dist/{index-n3hjOvVC.d.ts → index-DBdiTkNc.d.ts} +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.mjs +6 -6
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +9 -8
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +8 -7
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/desktop-guard.cjs +2 -2
- package/dist/internal/desktop-guard.d.mts +7 -0
- package/dist/internal/desktop-guard.d.ts +7 -0
- package/dist/internal/desktop-guard.mjs +1 -1
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/islands-runtime.cjs +4 -1
- package/dist/internal/islands-runtime.d.mts +9 -12
- package/dist/internal/islands-runtime.d.ts +9 -12
- package/dist/internal/islands-runtime.mjs +5 -2
- 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.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +3 -3
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/plugin.cjs +6 -6
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +5 -5
- package/dist/{production-runtime-YVDGYWBG.d.ts → production-runtime-B3qFFtKF.d.ts} +1 -1
- package/dist/{production-runtime-bWZJMcQb.d.mts → production-runtime-DcD-GRAv.d.mts} +1 -1
- package/dist/{programmatic-routes-client-BFKOTEXN.d.mts → programmatic-routes-client-DzbYGiZQ.d.mts} +2 -2
- package/dist/{programmatic-routes-client-DviwGeAv.d.ts → programmatic-routes-client-fD9f4XqU.d.ts} +2 -2
- package/dist/{render-plan-DqWXo3-B.d.ts → render-plan-B6cfssrr.d.ts} +1 -1
- package/dist/{render-plan-CS8l0zaK.d.mts → render-plan-DqJ51ufr.d.mts} +1 -1
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/{request-D4XqmnJF.d.mts → request-UuAxHn8h.d.mts} +1 -1
- package/dist/{request-CBrHpaCC.d.ts → request-jhvUMXRx.d.ts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering-3pRPtyO2.d.mts → route-rendering-Cou00t1X.d.mts} +1 -1
- package/dist/{route-rendering-Bltnu8a3.d.ts → route-rendering-Sn50cYZf.d.ts} +1 -1
- package/dist/{router-BFSmKGtI.d.mts → router-0X9DCTcm.d.mts} +1 -1
- package/dist/{router-DDT7bkg7.d.ts → router-xwLvi48p.d.ts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-ULFIB3UT.mjs → rsc-pipeline-F6ZPH5MU.mjs} +2 -1
- package/dist/{rsc-pipeline-4KOITP64.cjs → rsc-pipeline-VKHMABDJ.cjs} +3 -2
- package/dist/{runtime-Cpylaypt.d.mts → runtime-CMrsyChI.d.mts} +1 -1
- package/dist/{runtime-C6yG64je.d.ts → runtime-tkSXZiqO.d.ts} +1 -1
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server.cjs +18 -18
- package/dist/server.d.mts +9 -9
- package/dist/server.d.ts +9 -9
- package/dist/server.mjs +7 -7
- package/dist/{spa-router-CKuS81mi.d.ts → spa-router-B06APnGK.d.ts} +2 -2
- package/dist/{spa-router-CkTPnA4L.d.mts → spa-router-B48EjsS1.d.mts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils-C0ORLYXc.d.ts → utils-C5fyK2tE.d.ts} +1 -1
- package/dist/{utils-IA9wVkef.d.mts → utils-hyAwmcN6.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +6 -6
- package/dist/vite.d.mts +4 -4
- package/dist/vite.d.ts +4 -4
- package/dist/vite.mjs +5 -5
- package/package.json +2 -2
|
@@ -37,7 +37,7 @@ var _chunkEVCQX243cjs = require('./chunk-EVCQX243.cjs');
|
|
|
37
37
|
var _chunkEQMTJBB7cjs = require('./chunk-EQMTJBB7.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkHTLCLOXQcjs = require('./chunk-HTLCLOXQ.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
var _chunkBRWIVOV4cjs = require('./chunk-BRWIVOV4.cjs');
|
|
@@ -84,7 +84,7 @@ var _chunkKZT2VHRQcjs = require('./chunk-KZT2VHRQ.cjs');
|
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
var
|
|
87
|
+
var _chunkC5S457CKcjs = require('./chunk-C5S457CK.cjs');
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
var _chunkIXSMFKZ2cjs = require('./chunk-IXSMFKZ2.cjs');
|
|
@@ -108,7 +108,7 @@ var _chunkZSIGEHSEcjs = require('./chunk-ZSIGEHSE.cjs');
|
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
var
|
|
111
|
+
var _chunkVCKGOXFIcjs = require('./chunk-VCKGOXFI.cjs');
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
@@ -119,7 +119,7 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
var
|
|
122
|
+
var _chunkNPPT4RWFcjs = require('./chunk-NPPT4RWF.cjs');
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
@@ -231,7 +231,7 @@ var _chunkXN2MB4QZcjs = require('./chunk-XN2MB4QZ.cjs');
|
|
|
231
231
|
var _chunkB5BBTPJQcjs = require('./chunk-B5BBTPJQ.cjs');
|
|
232
232
|
|
|
233
233
|
|
|
234
|
-
var
|
|
234
|
+
var _chunkJ5VCA45Kcjs = require('./chunk-J5VCA45K.cjs');
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
var _chunkE552H232cjs = require('./chunk-E552H232.cjs');
|
|
@@ -1993,7 +1993,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
1993
1993
|
}
|
|
1994
1994
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
1995
1995
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
1996
|
-
await fs4.writeFile(clientCssPath,
|
|
1996
|
+
await fs4.writeFile(clientCssPath, _chunkC5S457CKcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
1997
1997
|
}
|
|
1998
1998
|
var IncompleteClientBuildOutputError = class extends Error {
|
|
1999
1999
|
constructor(detail) {
|
|
@@ -2039,7 +2039,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
2039
2039
|
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)}`;
|
|
2040
2040
|
let plan = cache.get(key);
|
|
2041
2041
|
if (!plan) {
|
|
2042
|
-
plan =
|
|
2042
|
+
plan = _chunkC5S457CKcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2043
2043
|
cache.set(key, plan);
|
|
2044
2044
|
}
|
|
2045
2045
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -2067,14 +2067,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2067
2067
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2068
2068
|
);
|
|
2069
2069
|
}
|
|
2070
|
-
const isolatedMode =
|
|
2070
|
+
const isolatedMode = _chunkC5S457CKcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2071
2071
|
_optionalChain([config, 'access', _47 => _47.experimental, 'optionalAccess', _48 => _48.isolatedClientHydration]),
|
|
2072
2072
|
{
|
|
2073
2073
|
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _49 => _49.experimental, 'optionalAccess', _50 => _50.serverComponents])) === "rsc",
|
|
2074
2074
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2075
2075
|
}
|
|
2076
2076
|
);
|
|
2077
|
-
const planOptions =
|
|
2077
|
+
const planOptions = _chunkC5S457CKcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2078
2078
|
config.renderer,
|
|
2079
2079
|
Boolean(unsupportedIntegrationProvider)
|
|
2080
2080
|
);
|
|
@@ -2131,7 +2131,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2131
2131
|
};
|
|
2132
2132
|
}
|
|
2133
2133
|
});
|
|
2134
|
-
const layoutAppliesToRoute =
|
|
2134
|
+
const layoutAppliesToRoute = _chunkVCKGOXFIcjs.routeBoundaryCoversDirectory;
|
|
2135
2135
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
2136
2136
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2137
2137
|
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _53 => _53.docs, 'optionalAccess', _54 => _54.enabled]) && _optionalChain([config, 'access', _55 => _55.docs, 'access', _56 => _56.adapter, 'optionalAccess', _57 => _57.server]) && config.docs.adapter.react
|
|
@@ -2142,7 +2142,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2142
2142
|
);
|
|
2143
2143
|
const syntheticDocsEntry = _optionalChain([config, 'access', _60 => _60.docs, 'optionalAccess', _61 => _61.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2144
2144
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2145
|
-
const markdownPagePlan =
|
|
2145
|
+
const markdownPagePlan = _chunkC5S457CKcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2146
2146
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2147
2147
|
root,
|
|
2148
2148
|
isolatedMode,
|
|
@@ -2158,7 +2158,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2158
2158
|
pagePlanOptions
|
|
2159
2159
|
)
|
|
2160
2160
|
}));
|
|
2161
|
-
|
|
2161
|
+
_chunkC5S457CKcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2162
2162
|
clientLayouts.map((layout) => ({
|
|
2163
2163
|
pattern: layout.pattern,
|
|
2164
2164
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2167,7 +2167,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2167
2167
|
[
|
|
2168
2168
|
...routePlans.map(({ route, metadata }) => ({
|
|
2169
2169
|
pattern: routeDirectory(route),
|
|
2170
|
-
depth:
|
|
2170
|
+
depth: _chunkVCKGOXFIcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
2171
2171
|
metadata
|
|
2172
2172
|
})),
|
|
2173
2173
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -2190,7 +2190,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2190
2190
|
for (const layout of clientLayouts) {
|
|
2191
2191
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
|
|
2192
2192
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2193
|
-
_chunkXN2MB4QZcjs.logger.warn(`\u26A0\uFE0F ${
|
|
2193
|
+
_chunkXN2MB4QZcjs.logger.warn(`\u26A0\uFE0F ${_chunkC5S457CKcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2194
2194
|
}
|
|
2195
2195
|
}
|
|
2196
2196
|
if (isolatedMode === "analyze") {
|
|
@@ -2214,7 +2214,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2214
2214
|
);
|
|
2215
2215
|
if (metadata.suppressedAsyncHydration) {
|
|
2216
2216
|
_chunkXN2MB4QZcjs.logger.warn(
|
|
2217
|
-
`\u26A0\uFE0F ${
|
|
2217
|
+
`\u26A0\uFE0F ${_chunkC5S457CKcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2218
2218
|
);
|
|
2219
2219
|
}
|
|
2220
2220
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2239,7 +2239,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2239
2239
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
2240
2240
|
],
|
|
2241
2241
|
// The server renders a server tree only below a hydrating layout.
|
|
2242
|
-
...
|
|
2242
|
+
..._chunkC5S457CKcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2243
2243
|
});
|
|
2244
2244
|
_chunkXN2MB4QZcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2245
2245
|
}
|
|
@@ -2275,7 +2275,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2275
2275
|
}
|
|
2276
2276
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2277
2277
|
try {
|
|
2278
|
-
return
|
|
2278
|
+
return _chunkC5S457CKcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2279
2279
|
} catch (error) {
|
|
2280
2280
|
_chunkXN2MB4QZcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2281
2281
|
return false;
|
|
@@ -2305,7 +2305,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2305
2305
|
config.trailingSlash,
|
|
2306
2306
|
_chunkN25RPPO5cjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2307
2307
|
config.basePath,
|
|
2308
|
-
|
|
2308
|
+
_chunkC5S457CKcjs.generateClientCachePersistenceCode.call(void 0, _chunkC5S457CKcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2309
2309
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2310
2310
|
_chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _67 => _67.experimental, 'optionalAccess', _68 => _68.serverComponents])) === "islands"
|
|
2311
2311
|
);
|
|
@@ -2394,7 +2394,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2394
2394
|
}
|
|
2395
2395
|
},
|
|
2396
2396
|
plugins: [
|
|
2397
|
-
|
|
2397
|
+
_chunkC5S457CKcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2398
2398
|
createFarmPrivateClientSourcemapsPlugin({
|
|
2399
2399
|
outDir: _path2.default.join(_path2.default.dirname(outputDir), FARM_CLIENT_SOURCEMAPS_DIR)
|
|
2400
2400
|
}),
|
|
@@ -2419,7 +2419,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2419
2419
|
...rendererVitePlugins,
|
|
2420
2420
|
...config.vite.plugins || [],
|
|
2421
2421
|
farmServerOnlyEntriesPlugin(),
|
|
2422
|
-
|
|
2422
|
+
_chunkC5S457CKcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2423
2423
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2424
2424
|
),
|
|
2425
2425
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
@@ -2481,7 +2481,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2481
2481
|
} : void 0,
|
|
2482
2482
|
// Ensure React is bundled for client
|
|
2483
2483
|
resolve: {
|
|
2484
|
-
alias:
|
|
2484
|
+
alias: _chunkC5S457CKcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2485
2485
|
dedupe: [...config.renderer.dedupe || []]
|
|
2486
2486
|
},
|
|
2487
2487
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2494,7 +2494,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2494
2494
|
]
|
|
2495
2495
|
}
|
|
2496
2496
|
};
|
|
2497
|
-
await viteBuild(
|
|
2497
|
+
await viteBuild(_chunkC5S457CKcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2498
2498
|
await mergeBuiltFontCss(outputDir);
|
|
2499
2499
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2500
2500
|
} finally {
|
|
@@ -2513,7 +2513,7 @@ function toBakedMarkdownSourcePath(root, filePath) {
|
|
|
2513
2513
|
}
|
|
2514
2514
|
return relative.split(_path2.default.sep).join("/");
|
|
2515
2515
|
}
|
|
2516
|
-
function generateUniversalRouterStateRuntime() {
|
|
2516
|
+
function generateUniversalRouterStateRuntime(streamNavigations = false) {
|
|
2517
2517
|
return `
|
|
2518
2518
|
const FARM_PAGE_STATE_KEY = "__farmPageState";
|
|
2519
2519
|
const FARM_HISTORY_INDEX_KEY = "__farmHistoryIndex";
|
|
@@ -2581,6 +2581,46 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
2581
2581
|
return response;
|
|
2582
2582
|
}
|
|
2583
2583
|
|
|
2584
|
+
${streamNavigations ? `const FARM_FLUSH_MARKER = "<!--farm-flush-->";
|
|
2585
|
+
|
|
2586
|
+
// Reads a streamed navigation (F-Stream) up to the end of React's shell. \`next\` then resolves
|
|
2587
|
+
// with each later flush as it ends, and null at the end; a document without a marker is all shell.
|
|
2588
|
+
async function readFarmNavigationStream(body) {
|
|
2589
|
+
const reader = body.getReader();
|
|
2590
|
+
const decoder = new TextDecoder();
|
|
2591
|
+
let text = "";
|
|
2592
|
+
let done = false;
|
|
2593
|
+
const next = async function() {
|
|
2594
|
+
for (;;) {
|
|
2595
|
+
const at = text.indexOf(FARM_FLUSH_MARKER);
|
|
2596
|
+
if (at !== -1) {
|
|
2597
|
+
const flush = text.slice(0, at);
|
|
2598
|
+
text = text.slice(at + FARM_FLUSH_MARKER.length);
|
|
2599
|
+
return flush;
|
|
2600
|
+
}
|
|
2601
|
+
if (done) {
|
|
2602
|
+
const flush = text;
|
|
2603
|
+
text = "";
|
|
2604
|
+
return flush ? flush : null;
|
|
2605
|
+
}
|
|
2606
|
+
const result = await reader.read();
|
|
2607
|
+
if (result.done) {
|
|
2608
|
+
done = true;
|
|
2609
|
+
text += decoder.decode();
|
|
2610
|
+
} else {
|
|
2611
|
+
text += decoder.decode(result.value, { stream: true });
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
const shell = await next();
|
|
2616
|
+
if (done && !text) return { shell: shell || "" };
|
|
2617
|
+
return {
|
|
2618
|
+
shell: shell,
|
|
2619
|
+
next: next,
|
|
2620
|
+
cancel: function() { reader.cancel().catch(function() {}); },
|
|
2621
|
+
};
|
|
2622
|
+
}` : ""}
|
|
2623
|
+
|
|
2584
2624
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
2585
2625
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
2586
2626
|
router.clearCache();
|
|
@@ -2784,9 +2824,35 @@ function interpolateRedirectDestination(destination, params) {
|
|
|
2784
2824
|
}
|
|
2785
2825
|
`.trim();
|
|
2786
2826
|
}
|
|
2787
|
-
function generateUniversalRouterStateProperties() {
|
|
2827
|
+
function generateUniversalRouterStateProperties(streamNavigations = false) {
|
|
2788
2828
|
return `
|
|
2789
|
-
|
|
2829
|
+
${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its Suspense content follows flush by flush.
|
|
2830
|
+
navigationStream: null,
|
|
2831
|
+
streamingNavigation: null,
|
|
2832
|
+
takeNavigationStream: function(html) {
|
|
2833
|
+
const stream = this.navigationStream;
|
|
2834
|
+
this.navigationStream = null;
|
|
2835
|
+
if (!stream) return;
|
|
2836
|
+
if (stream.html !== html) {
|
|
2837
|
+
stream.cancel();
|
|
2838
|
+
return;
|
|
2839
|
+
}
|
|
2840
|
+
this.streamingNavigation = stream;
|
|
2841
|
+
void streamFarmNavigation(
|
|
2842
|
+
stream,
|
|
2843
|
+
document.getElementById("root") || document.body,
|
|
2844
|
+
() => this.streamingNavigation === stream,
|
|
2845
|
+
);
|
|
2846
|
+
},
|
|
2847
|
+
stopNavigationStream: function() {
|
|
2848
|
+
this.navigationStream?.cancel();
|
|
2849
|
+
this.streamingNavigation?.cancel();
|
|
2850
|
+
this.navigationStream = null;
|
|
2851
|
+
this.streamingNavigation = null;
|
|
2852
|
+
},
|
|
2853
|
+
` : ` takeNavigationStream: function() {},
|
|
2854
|
+
stopNavigationStream: function() {},
|
|
2855
|
+
`} blockers: new Set(),
|
|
2790
2856
|
unloadBlockers: new Map(),
|
|
2791
2857
|
navigationListeners: new Set(),
|
|
2792
2858
|
navigationState: IDLE_NAVIGATION_STATE,
|
|
@@ -3080,6 +3146,11 @@ function generateUniversalRouterStateProperties() {
|
|
|
3080
3146
|
// Only speculative requests have shared ownership. Ordinary navigations
|
|
3081
3147
|
// keep their own abort signal and cannot cancel another caller's work.
|
|
3082
3148
|
const record = recover ? null : { valid: true, deploymentId, promise: null };
|
|
3149
|
+
// A navigation (not a prefetch) streams when the router supports it: the page goes in as
|
|
3150
|
+
// soon as its shell arrives, and its Suspense content follows (takeNavigationStream). A page
|
|
3151
|
+
// whose layouts hydrate, or one rendered in this page's React root, arrives whole.
|
|
3152
|
+
const streamShell = ${streamNavigations ? `recover && !interceptFrom && !partialHeaders["F-Render"] &&
|
|
3153
|
+
!hasHydratableLayout(new URL(url, window.location.href).pathname)` : "false"};
|
|
3083
3154
|
const request = async () => {
|
|
3084
3155
|
const response = await fetchFarmNavigationDocument(url, {
|
|
3085
3156
|
"Accept": "text/html",
|
|
@@ -3088,13 +3159,28 @@ function generateUniversalRouterStateProperties() {
|
|
|
3088
3159
|
// layouts it shows.
|
|
3089
3160
|
...getFarmIslandValueHeaders(),
|
|
3090
3161
|
...partialHeaders,
|
|
3162
|
+
...(streamShell ? { "F-Stream": "flush" } : {}),
|
|
3091
3163
|
}, recover, signal);
|
|
3092
3164
|
if (!response.ok) throw new Error("Failed to fetch page");
|
|
3093
|
-
const
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3165
|
+
const store = (html) => {
|
|
3166
|
+
if (cacheResult && !signal?.aborted && generation === this.prefetchGeneration &&
|
|
3167
|
+
deploymentId === window.__FARM_DEPLOYMENT_ID__ && (!record || record.valid)) {
|
|
3168
|
+
this.storePrefetchedHtml(cacheKey, html);
|
|
3169
|
+
}
|
|
3170
|
+
};
|
|
3171
|
+
${streamNavigations ? ` if (streamShell && response.body) {
|
|
3172
|
+
const streamed = await readFarmNavigationStream(response.body);
|
|
3173
|
+
if (!streamed.next) {
|
|
3174
|
+
store(streamed.shell);
|
|
3175
|
+
return streamed.shell;
|
|
3176
|
+
}
|
|
3177
|
+
this.stopNavigationStream();
|
|
3178
|
+
this.navigationStream = { html: streamed.shell, next: streamed.next, cancel: streamed.cancel, store };
|
|
3179
|
+
return streamed.shell;
|
|
3097
3180
|
}
|
|
3181
|
+
` : ""}
|
|
3182
|
+
const html = await response.text();
|
|
3183
|
+
store(html);
|
|
3098
3184
|
return html;
|
|
3099
3185
|
};
|
|
3100
3186
|
if (!record) return request();
|
|
@@ -3283,7 +3369,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3283
3369
|
direction: {}
|
|
3284
3370
|
}, plugins = [], renderer = _chunkRD623KW4cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
|
|
3285
3371
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
3286
|
-
const clientPluginEntry =
|
|
3372
|
+
const clientPluginEntry = _chunkC5S457CKcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3287
3373
|
plugins,
|
|
3288
3374
|
root,
|
|
3289
3375
|
srcDir,
|
|
@@ -3294,7 +3380,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3294
3380
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3295
3381
|
import __farmAppSetup from ${JSON.stringify(_chunkXN2MB4QZcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3296
3382
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3297
|
-
const providerClientCode =
|
|
3383
|
+
const providerClientCode = _chunkC5S457CKcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3298
3384
|
integrationProviders,
|
|
3299
3385
|
root,
|
|
3300
3386
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3304,18 +3390,18 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
|
|
|
3304
3390
|
const layoutImportStatements = [];
|
|
3305
3391
|
const layoutRegistrations = [];
|
|
3306
3392
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
3307
|
-
const treeLayoutPatterns = islandValues ?
|
|
3393
|
+
const treeLayoutPatterns = islandValues ? _chunkVCKGOXFIcjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
|
|
3308
3394
|
layoutRoutes.forEach((layout, index) => {
|
|
3309
3395
|
const relativePath = toImportPath(layout.modulePath);
|
|
3310
3396
|
const treeLayout = treeLayoutPatterns.has(layout.pattern);
|
|
3311
3397
|
const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
|
|
3312
|
-
(pattern) =>
|
|
3398
|
+
(pattern) => _chunkVCKGOXFIcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
|
|
3313
3399
|
);
|
|
3314
3400
|
if (rendersOnClient && !treeLayout) {
|
|
3315
3401
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
3316
3402
|
}
|
|
3317
|
-
const groupScope =
|
|
3318
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
3403
|
+
const groupScope = _chunkVCKGOXFIcjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
3404
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkVCKGOXFIcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
3319
3405
|
layoutRegistrations.push(
|
|
3320
3406
|
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
|
|
3321
3407
|
);
|
|
@@ -3819,7 +3905,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3819
3905
|
});
|
|
3820
3906
|
}
|
|
3821
3907
|
|
|
3822
|
-
${
|
|
3908
|
+
${_chunkC5S457CKcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
3823
3909
|
// Wrap a page element with applicable layouts
|
|
3824
3910
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
3825
3911
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -3854,7 +3940,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
3854
3940
|
return React.createElement("div", props, pageElement);
|
|
3855
3941
|
}
|
|
3856
3942
|
let farmLastRouteState = null;
|
|
3857
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
3943
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkC5S457CKcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
3858
3944
|
function farmTreeLayoutsOf(pathname) {
|
|
3859
3945
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
3860
3946
|
return layout.serverTree === true;
|
|
@@ -4172,7 +4258,7 @@ let currentPathname = null;
|
|
|
4172
4258
|
let isHydrated = false;
|
|
4173
4259
|
let pendingPageHydrationController = null;
|
|
4174
4260
|
|
|
4175
|
-
${generateUniversalRouterStateRuntime()}
|
|
4261
|
+
${generateUniversalRouterStateRuntime(islandValues)}
|
|
4176
4262
|
|
|
4177
4263
|
function cancelPendingPageHydration() {
|
|
4178
4264
|
pendingPageHydrationController?.abort();
|
|
@@ -4360,6 +4446,55 @@ function activateNavigationScripts(root) {
|
|
|
4360
4446
|
}
|
|
4361
4447
|
}
|
|
4362
4448
|
|
|
4449
|
+
${islandValues ? `// Adds the flushes after a streamed navigation's shell: React's staged Suspense content and the
|
|
4450
|
+
// scripts that reveal it. In islands mode, the islands React reveals hydrate as they appear, and
|
|
4451
|
+
// the ones it removes (a replaced fallback) are released.
|
|
4452
|
+
async function streamFarmNavigation(stream, root, isCurrent) {
|
|
4453
|
+
let html = stream.html;
|
|
4454
|
+
let streaming = true;
|
|
4455
|
+
${isolatedHydrationEnabled ? `const removed = new Set();
|
|
4456
|
+
let queued = false;
|
|
4457
|
+
const run = function() {
|
|
4458
|
+
queued = false;
|
|
4459
|
+
if (!isCurrent()) return observer.disconnect();
|
|
4460
|
+
for (const node of removed) if (!node.isConnected) disposeFarmIsolatedClientBoundaries(node);
|
|
4461
|
+
removed.clear();
|
|
4462
|
+
if (!streaming && !root.querySelector('div[hidden][id^="S:"]')) observer.disconnect();
|
|
4463
|
+
hydrateFarmIsolatedClientBoundaries(root).catch(function(error) {
|
|
4464
|
+
console.error("[Farm.js] Hydrating streamed islands failed:", error);
|
|
4465
|
+
});
|
|
4466
|
+
};
|
|
4467
|
+
const observer = new MutationObserver(function(records) {
|
|
4468
|
+
for (const record of records) for (const node of record.removedNodes) removed.add(node);
|
|
4469
|
+
if (queued) return;
|
|
4470
|
+
queued = true;
|
|
4471
|
+
queueMicrotask(run);
|
|
4472
|
+
});
|
|
4473
|
+
observer.observe(root, { childList: true, subtree: true });` : "const observer = { disconnect: function() {} };"}
|
|
4474
|
+
try {
|
|
4475
|
+
for (let flush = await stream.next(); flush !== null; flush = await stream.next()) {
|
|
4476
|
+
if (!isCurrent()) return stream.cancel();
|
|
4477
|
+
html += flush;
|
|
4478
|
+
const parsed = new DOMParser().parseFromString('<div id="root">' + flush, "text/html");
|
|
4479
|
+
const fragment = document.createDocumentFragment();
|
|
4480
|
+
for (const node of Array.from(parsed.getElementById("root").childNodes)) fragment.appendChild(node);
|
|
4481
|
+
activateNavigationScripts(fragment);
|
|
4482
|
+
root.appendChild(fragment);
|
|
4483
|
+
}
|
|
4484
|
+
} catch (error) {
|
|
4485
|
+
streaming = false;
|
|
4486
|
+
if (!isCurrent()) return observer.disconnect();
|
|
4487
|
+
console.error("[Farm.js] A streamed navigation failed:", error);
|
|
4488
|
+
${isolatedHydrationEnabled ? "farmIsolatedHydrationRuntime.endStream?.(root);\n if (!queued) run();" : ""}
|
|
4489
|
+
return;
|
|
4490
|
+
}
|
|
4491
|
+
// A cancelled stream ends early: keep its partial document out of the cache.
|
|
4492
|
+
if (!isCurrent()) return observer.disconnect();
|
|
4493
|
+
streaming = false;
|
|
4494
|
+
stream.store(html);
|
|
4495
|
+
${isolatedHydrationEnabled ? "farmIsolatedHydrationRuntime.endStream?.(root);\n if (!queued) run();" : ""}
|
|
4496
|
+
}` : ""}
|
|
4497
|
+
|
|
4363
4498
|
function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
4364
4499
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
4365
4500
|
const nextPatterns = getLayoutPatterns(nextRoot);
|
|
@@ -4402,7 +4537,7 @@ function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
|
4402
4537
|
|
|
4403
4538
|
// SPA Router
|
|
4404
4539
|
const spaRouter = {
|
|
4405
|
-
${generateUniversalRouterStateProperties()}
|
|
4540
|
+
${generateUniversalRouterStateProperties(islandValues)}
|
|
4406
4541
|
prefetchCache: new Map(),
|
|
4407
4542
|
${islandValues ? ` // Islands mode: navigations name the layouts on screen, and say when this page renders the
|
|
4408
4543
|
// next one in its own React root; the server leaves out what the browser keeps or rebuilds.
|
|
@@ -4414,7 +4549,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4414
4549
|
...(reactRoot && reactRootContainer === root ? { "F-Render": "tree" } : {}),
|
|
4415
4550
|
};
|
|
4416
4551
|
},
|
|
4417
|
-
` : ""}
|
|
4552
|
+
` : ""}
|
|
4418
4553
|
navigate: async function(href, options = {}) {
|
|
4419
4554
|
const url = new URL(href, window.location.href);
|
|
4420
4555
|
if (isFarmBlockedNavigationURL(url)) return;
|
|
@@ -4467,6 +4602,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4467
4602
|
|
|
4468
4603
|
// A route transition invalidates any trigger waiting on the previous DOM boundary.
|
|
4469
4604
|
cancelPendingPageHydration();
|
|
4605
|
+
this.stopNavigationStream();
|
|
4470
4606
|
this.saveScrollPosition(window.location.pathname + window.location.search);
|
|
4471
4607
|
const navigation = this.startNavigation(from, url, action);
|
|
4472
4608
|
// A refresh keeps the islands still on the page (islands mode).
|
|
@@ -4591,6 +4727,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4591
4727
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4592
4728
|
await this.runViewTransition(options.viewTransition, async () => {
|
|
4593
4729
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4730
|
+
let swappedHtml = html;
|
|
4594
4731
|
let swapped = await this.swapContent(
|
|
4595
4732
|
html,
|
|
4596
4733
|
url.pathname + url.search,
|
|
@@ -4610,6 +4747,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4610
4747
|
false,
|
|
4611
4748
|
);
|
|
4612
4749
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4750
|
+
swappedHtml = documentHtml;
|
|
4613
4751
|
swapped = await this.swapContent(
|
|
4614
4752
|
documentHtml,
|
|
4615
4753
|
url.pathname + url.search,
|
|
@@ -4621,6 +4759,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4621
4759
|
if (!swapped || swapped === "segment-mismatch") {
|
|
4622
4760
|
throw new Error("Farm could not swap the target document");
|
|
4623
4761
|
}
|
|
4762
|
+
this.takeNavigationStream(swappedHtml);
|
|
4624
4763
|
this.writeHistoryEntry(action, url.pathname + url.search, options.state, url);
|
|
4625
4764
|
currentPathname = pathname;
|
|
4626
4765
|
this.currentPath = to;
|
|
@@ -5027,7 +5166,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5027
5166
|
}
|
|
5028
5167
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
5029
5168
|
const instrumentationPath = _chunkBRWIVOV4cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
5030
|
-
const notFoundPath =
|
|
5169
|
+
const notFoundPath = _chunkC5S457CKcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
5031
5170
|
if (notFoundPath) _chunkXN2MB4QZcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
5032
5171
|
layoutRoutes.sort((a, b) => {
|
|
5033
5172
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -5049,7 +5188,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5049
5188
|
);
|
|
5050
5189
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
5051
5190
|
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _75 => _75.mdx, 'optionalAccess', _76 => _76.components]));
|
|
5052
|
-
const hasMiddlewareConfig =
|
|
5191
|
+
const hasMiddlewareConfig = _chunkVCKGOXFIcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5053
5192
|
const hasRouteContextConfig = _chunkKZT2VHRQcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
5054
5193
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
5055
5194
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
@@ -5233,7 +5372,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5233
5372
|
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _87 => _87.env, 'optionalAccess', _88 => _88.public]) || {})
|
|
5234
5373
|
},
|
|
5235
5374
|
plugins: [
|
|
5236
|
-
|
|
5375
|
+
_chunkC5S457CKcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
5237
5376
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
5238
5377
|
...rendererVitePlugins,
|
|
5239
5378
|
...config.vite.plugins || [],
|
|
@@ -5294,7 +5433,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5294
5433
|
resolve: {
|
|
5295
5434
|
alias: [
|
|
5296
5435
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
5297
|
-
...Object.entries(
|
|
5436
|
+
...Object.entries(_chunkC5S457CKcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
5298
5437
|
([find, replacement]) => ({ find, replacement })
|
|
5299
5438
|
)
|
|
5300
5439
|
],
|
|
@@ -5302,7 +5441,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5302
5441
|
dedupe: [...config.renderer.dedupe || []]
|
|
5303
5442
|
}
|
|
5304
5443
|
};
|
|
5305
|
-
await viteBuild(
|
|
5444
|
+
await viteBuild(_chunkC5S457CKcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
5306
5445
|
} finally {
|
|
5307
5446
|
if (postcssConfigDir) {
|
|
5308
5447
|
try {
|
|
@@ -5347,7 +5486,7 @@ function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
|
5347
5486
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
5348
5487
|
middlewareRoutes
|
|
5349
5488
|
};
|
|
5350
|
-
return _chunkEVCQX243cjs.discoverFarmDocsPages.call(void 0, contentDir, config.docs).flatMap((page) => [page.href, _chunkEVCQX243cjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) =>
|
|
5489
|
+
return _chunkEVCQX243cjs.discoverFarmDocsPages.call(void 0, contentDir, config.docs).flatMap((page) => [page.href, _chunkEVCQX243cjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkVCKGOXFIcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
5351
5490
|
}
|
|
5352
5491
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
5353
5492
|
const llmsTxt = _optionalChain([agent, 'optionalAccess', _91 => _91.llmsTxt]);
|
|
@@ -5749,7 +5888,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5749
5888
|
const hasGeneratedMetadataImages = metadataImageRoutes.some(
|
|
5750
5889
|
(image) => image.sourceType === "module"
|
|
5751
5890
|
);
|
|
5752
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 ||
|
|
5891
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkVCKGOXFIcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5753
5892
|
const farmDocsFontAssets = _optionalChain([config, 'access', _116 => _116.docs, 'optionalAccess', _117 => _117.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
5754
5893
|
const integrationProviders = _chunkN25RPPO5cjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
5755
5894
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
@@ -5760,7 +5899,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5760
5899
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
5761
5900
|
);
|
|
5762
5901
|
}
|
|
5763
|
-
const providerServerModules =
|
|
5902
|
+
const providerServerModules = _chunkC5S457CKcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
5764
5903
|
renderedIntegrationProviders,
|
|
5765
5904
|
config.root,
|
|
5766
5905
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
@@ -5780,14 +5919,14 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5780
5919
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
5781
5920
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
5782
5921
|
);
|
|
5783
|
-
const isolatedHydrationMode =
|
|
5922
|
+
const isolatedHydrationMode = _chunkC5S457CKcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
5784
5923
|
_optionalChain([config, 'access', _120 => _120.experimental, 'optionalAccess', _121 => _121.isolatedClientHydration]),
|
|
5785
5924
|
{
|
|
5786
5925
|
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _122 => _122.experimental, 'optionalAccess', _123 => _123.serverComponents])) === "rsc",
|
|
5787
5926
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
5788
5927
|
}
|
|
5789
5928
|
);
|
|
5790
|
-
const hydrationPlanOptions =
|
|
5929
|
+
const hydrationPlanOptions = _chunkC5S457CKcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
5791
5930
|
config.renderer,
|
|
5792
5931
|
Boolean(unsupportedIntegrationProvider)
|
|
5793
5932
|
);
|
|
@@ -5805,7 +5944,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5805
5944
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
5806
5945
|
)
|
|
5807
5946
|
}));
|
|
5808
|
-
const markdownPagePlan =
|
|
5947
|
+
const markdownPagePlan = _chunkC5S457CKcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
5809
5948
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
5810
5949
|
config.root,
|
|
5811
5950
|
isolatedHydrationMode,
|
|
@@ -5823,7 +5962,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5823
5962
|
)
|
|
5824
5963
|
])
|
|
5825
5964
|
);
|
|
5826
|
-
|
|
5965
|
+
_chunkC5S457CKcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
5827
5966
|
layoutHydrationPlans.map((layout) => ({
|
|
5828
5967
|
pattern: layout.pattern,
|
|
5829
5968
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -5832,10 +5971,10 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5832
5971
|
pageRoutes.map((route) => ({
|
|
5833
5972
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
5834
5973
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
5835
|
-
depth:
|
|
5974
|
+
depth: _chunkVCKGOXFIcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
5836
5975
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
5837
5976
|
})),
|
|
5838
|
-
|
|
5977
|
+
_chunkVCKGOXFIcjs.routeBoundaryCoversDirectory
|
|
5839
5978
|
);
|
|
5840
5979
|
const providerServerImports = [
|
|
5841
5980
|
providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
|
|
@@ -5897,7 +6036,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5897
6036
|
module: ${varName},
|
|
5898
6037
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
5899
6038
|
clientModule: ${JSON.stringify(_chunkXN2MB4QZcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
5900
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
6039
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkC5S457CKcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
|
|
5901
6040
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
5902
6041
|
${route.source !== void 0 ? `markdownSource: {
|
|
5903
6042
|
source: ${JSON.stringify(route.source)},
|
|
@@ -5907,7 +6046,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5907
6046
|
});
|
|
5908
6047
|
const layoutImports = [];
|
|
5909
6048
|
const layoutRegistrations = [];
|
|
5910
|
-
const treeLayoutPatterns = farmIslandsMode ?
|
|
6049
|
+
const treeLayoutPatterns = farmIslandsMode ? _chunkVCKGOXFIcjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
5911
6050
|
layoutHydrationPlans.map((layout) => ({
|
|
5912
6051
|
pattern: layout.pattern,
|
|
5913
6052
|
shouldHydrate: layout.hydration.shouldHydrate,
|
|
@@ -5961,12 +6100,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
5961
6100
|
errorImports.push(
|
|
5962
6101
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
5963
6102
|
);
|
|
5964
|
-
const groupScope =
|
|
6103
|
+
const groupScope = _chunkVCKGOXFIcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
5965
6104
|
errorRegistrations.push(`
|
|
5966
6105
|
{
|
|
5967
|
-
pattern: ${JSON.stringify(
|
|
6106
|
+
pattern: ${JSON.stringify(_chunkVCKGOXFIcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
5968
6107
|
groupScope: ${JSON.stringify(groupScope)},
|
|
5969
|
-
directoryDepth: ${
|
|
6108
|
+
directoryDepth: ${_chunkVCKGOXFIcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
5970
6109
|
module: ${varName},
|
|
5971
6110
|
}`);
|
|
5972
6111
|
});
|
|
@@ -6170,7 +6309,7 @@ ${integrationRuntimeImport}
|
|
|
6170
6309
|
${nativeAuth.importSource}
|
|
6171
6310
|
${nativeMCP.importSource}
|
|
6172
6311
|
`;
|
|
6173
|
-
const imageRuntime =
|
|
6312
|
+
const imageRuntime = _chunkC5S457CKcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
6174
6313
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
6175
6314
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
6176
6315
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -6349,7 +6488,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
6349
6488
|
|
|
6350
6489
|
function FarmDefault404Page() {
|
|
6351
6490
|
return React.createElement(React.Fragment, null,
|
|
6352
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
6491
|
+
React.createElement("style", null, ${JSON.stringify(_chunkC5S457CKcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
6353
6492
|
React.createElement("main", {
|
|
6354
6493
|
className: "farm-default-not-found",
|
|
6355
6494
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -6652,12 +6791,12 @@ function fetchFarmInnerRequest(request, context) {
|
|
|
6652
6791
|
}
|
|
6653
6792
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunkB5BBTPJQcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
6654
6793
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
6655
|
-
${_optionalChain([config, 'access', _155 => _155.agent, 'optionalAccess', _156 => _156.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(
|
|
6794
|
+
${_optionalChain([config, 'access', _155 => _155.agent, 'optionalAccess', _156 => _156.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkNPPT4RWFcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
6656
6795
|
` : ""}${_optionalChain([config, 'access', _157 => _157.agent, 'optionalAccess', _158 => _158.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
6657
|
-
|
|
6796
|
+
_chunkNPPT4RWFcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
6658
6797
|
build: config.deploymentId,
|
|
6659
|
-
packages:
|
|
6660
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
6798
|
+
packages: _chunkC5S457CKcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
6799
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkC5S457CKcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
6661
6800
|
})
|
|
6662
6801
|
)};
|
|
6663
6802
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -6799,11 +6938,16 @@ function escapeFarmHtmlAttribute(value) {
|
|
|
6799
6938
|
.replace(/>/g, ">");
|
|
6800
6939
|
}
|
|
6801
6940
|
|
|
6802
|
-
async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
6941
|
+
async function renderFarmElement(ReactDOMServer, element, routeKey, flushMarkers = false) {
|
|
6942
|
+
// Written after each React flush in a streamed navigation (flushMarkers): the browser swaps in
|
|
6943
|
+
// the shell, then adds each Suspense boundary as soon as the flush that completed it ends.
|
|
6944
|
+
const FARM_FLUSH_MARKER = "<!--farm-flush-->";
|
|
6803
6945
|
// Islands mode: each render writes its islands' values itself, so a request that renders twice
|
|
6804
6946
|
// (notFound(), or a synchronous attempt that suspends and streams) still sends them.
|
|
6805
6947
|
if (typeof farmIslandsRender === "function") element = farmIslandsRender(element);
|
|
6806
6948
|
const streamErrors = [];
|
|
6949
|
+
// A browser that leaves the page cancels the stream: React's abort errors are not failures.
|
|
6950
|
+
let cancelled = false;
|
|
6807
6951
|
const syncHtml = renderFarmElementSync(ReactDOMServer, element, routeKey);
|
|
6808
6952
|
if (syncHtml !== undefined) return { html: syncHtml, shellHtml: syncHtml, streamErrors };
|
|
6809
6953
|
let encoder;
|
|
@@ -6841,7 +6985,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6841
6985
|
// request handler must still receive them to map the response status,
|
|
6842
6986
|
// but they should not produce a misleading SSR failure log.
|
|
6843
6987
|
streamErrors.push(error);
|
|
6844
|
-
if (isFarmRedirectError(error) || isFarmNotFoundError(error)) return;
|
|
6988
|
+
if (cancelled || isFarmRedirectError(error) || isFarmNotFoundError(error)) return;
|
|
6845
6989
|
console.error("[Farm SSR stream]", error);
|
|
6846
6990
|
},
|
|
6847
6991
|
});
|
|
@@ -6888,13 +7032,33 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6888
7032
|
}
|
|
6889
7033
|
|
|
6890
7034
|
let replayFirstChunk = true;
|
|
7035
|
+
let pendingRead = null;
|
|
7036
|
+
// A flush is the chunks React has queued when a task boundary passes.
|
|
7037
|
+
const drainFlush = async function(controller, waitForFirst) {
|
|
7038
|
+
for (let first = waitForFirst; ; first = false) {
|
|
7039
|
+
const read = pendingRead || (pendingRead = reader.read());
|
|
7040
|
+
const result = first
|
|
7041
|
+
? await read
|
|
7042
|
+
: await Promise.race([read, new Promise(function(resolve) { setTimeout(resolve, 0); })]);
|
|
7043
|
+
if (!result) break;
|
|
7044
|
+
pendingRead = null;
|
|
7045
|
+
if (result.done) {
|
|
7046
|
+
controller.close();
|
|
7047
|
+
return;
|
|
7048
|
+
}
|
|
7049
|
+
controller.enqueue(normalizeChunk(result.value));
|
|
7050
|
+
}
|
|
7051
|
+
controller.enqueue(normalizeChunk(FARM_FLUSH_MARKER));
|
|
7052
|
+
};
|
|
6891
7053
|
const replayStream = new ReadableStream({
|
|
6892
7054
|
pull(controller) {
|
|
6893
7055
|
if (replayFirstChunk) {
|
|
6894
7056
|
replayFirstChunk = false;
|
|
6895
7057
|
controller.enqueue(firstChunk);
|
|
7058
|
+
if (flushMarkers) return drainFlush(controller, false);
|
|
6896
7059
|
return;
|
|
6897
7060
|
}
|
|
7061
|
+
if (flushMarkers) return drainFlush(controller, true);
|
|
6898
7062
|
return reader.read().then(
|
|
6899
7063
|
function(result) {
|
|
6900
7064
|
if (result.done) controller.close();
|
|
@@ -6906,6 +7070,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6906
7070
|
);
|
|
6907
7071
|
},
|
|
6908
7072
|
cancel(reason) {
|
|
7073
|
+
cancelled = true;
|
|
6909
7074
|
return reader.cancel(reason);
|
|
6910
7075
|
},
|
|
6911
7076
|
});
|
|
@@ -6930,6 +7095,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6930
7095
|
let settleComplete;
|
|
6931
7096
|
let rejectComplete;
|
|
6932
7097
|
const chunks = [];
|
|
7098
|
+
let unflushed = false;
|
|
6933
7099
|
const decision = new Promise(function(resolve, reject) {
|
|
6934
7100
|
settleDecision = resolve;
|
|
6935
7101
|
rejectDecision = reject;
|
|
@@ -6952,8 +7118,15 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6952
7118
|
const normalized = normalizeChunk(chunk);
|
|
6953
7119
|
if (streamStarted) streamController.enqueue(normalized);
|
|
6954
7120
|
else chunks.push(normalized);
|
|
7121
|
+
unflushed = true;
|
|
6955
7122
|
return true;
|
|
6956
7123
|
},
|
|
7124
|
+
// React calls this after each flush.
|
|
7125
|
+
flush() {
|
|
7126
|
+
if (!flushMarkers || !streamStarted || streamClosed || !unflushed) return;
|
|
7127
|
+
unflushed = false;
|
|
7128
|
+
streamController.enqueue(normalizeChunk(FARM_FLUSH_MARKER));
|
|
7129
|
+
},
|
|
6957
7130
|
end() {
|
|
6958
7131
|
if (streamClosed) return;
|
|
6959
7132
|
streamClosed = true;
|
|
@@ -6982,6 +7155,9 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
6982
7155
|
streamController = controller;
|
|
6983
7156
|
},
|
|
6984
7157
|
cancel(reason) {
|
|
7158
|
+
// React writes its abort instructions: the stream no longer takes them.
|
|
7159
|
+
cancelled = true;
|
|
7160
|
+
streamClosed = true;
|
|
6985
7161
|
if (pipeableStream && typeof pipeableStream.abort === "function") {
|
|
6986
7162
|
pipeableStream.abort(reason);
|
|
6987
7163
|
}
|
|
@@ -7001,7 +7177,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
7001
7177
|
onError(error) {
|
|
7002
7178
|
// Same control-flow guard as the readable-stream path above.
|
|
7003
7179
|
streamErrors.push(error);
|
|
7004
|
-
if (isFarmRedirectError(error) || isFarmNotFoundError(error)) return;
|
|
7180
|
+
if (cancelled || isFarmRedirectError(error) || isFarmNotFoundError(error)) return;
|
|
7005
7181
|
console.error("[Farm SSR stream]", error);
|
|
7006
7182
|
},
|
|
7007
7183
|
});
|
|
@@ -7022,6 +7198,11 @@ async function renderFarmElement(ReactDOMServer, element, routeKey) {
|
|
|
7022
7198
|
|
|
7023
7199
|
streamStarted = true;
|
|
7024
7200
|
for (const chunk of chunks) streamController.enqueue(chunk);
|
|
7201
|
+
// What React wrote while its shell was ready is the shell; Suspense content follows.
|
|
7202
|
+
if (flushMarkers && unflushed) {
|
|
7203
|
+
unflushed = false;
|
|
7204
|
+
streamController.enqueue(normalizeChunk(FARM_FLUSH_MARKER));
|
|
7205
|
+
}
|
|
7025
7206
|
if (streamClosed) streamController.close();
|
|
7026
7207
|
return {
|
|
7027
7208
|
stream,
|
|
@@ -7203,7 +7384,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
7203
7384
|
let inner = markup.replace(/^\\s+/, "");
|
|
7204
7385
|
let hoisted = "";
|
|
7205
7386
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
7206
|
-
const hoistable = /${
|
|
7387
|
+
const hoistable = /${_chunkVCKGOXFIcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
7207
7388
|
let match;
|
|
7208
7389
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
7209
7390
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -7734,7 +7915,7 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
7734
7915
|
// a route guard.
|
|
7735
7916
|
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
7736
7917
|
pageRoutes.map((route) => route.pattern).filter(
|
|
7737
|
-
(pattern) => !pattern.includes("[") &&
|
|
7918
|
+
(pattern) => !pattern.includes("[") && _chunkVCKGOXFIcjs.farmPathGuardCoversPage.call(void 0,
|
|
7738
7919
|
{
|
|
7739
7920
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
7740
7921
|
middlewareRoutes
|
|
@@ -7781,7 +7962,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
7781
7962
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
7782
7963
|
// registered at runtime, such as the docs engine's.
|
|
7783
7964
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
7784
|
-
_chunkSBABQKPTcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root),
|
|
7965
|
+
_chunkSBABQKPTcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkJ5VCA45Kcjs.FARM_VERSION)
|
|
7785
7966
|
)};
|
|
7786
7967
|
let farmDefaultMCPRouteFree;
|
|
7787
7968
|
function getFarmDefaultMCPServer() {
|
|
@@ -8191,7 +8372,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
8191
8372
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
8192
8373
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
8193
8374
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
8194
|
-
|
|
8375
|
+
_chunkNPPT4RWFcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
8195
8376
|
agent: {
|
|
8196
8377
|
...config.agent,
|
|
8197
8378
|
aiCatalog: servesAiCatalog,
|
|
@@ -8879,7 +9060,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8879
9060
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
8880
9061
|
// public manifest, the same document for every request.
|
|
8881
9062
|
if (
|
|
8882
|
-
[${JSON.stringify(
|
|
9063
|
+
[${JSON.stringify(_chunkNPPT4RWFcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkNPPT4RWFcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
8883
9064
|
normalizeRuntimePath(routePathname),
|
|
8884
9065
|
)
|
|
8885
9066
|
) {
|
|
@@ -8891,7 +9072,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
8891
9072
|
` : ""}
|
|
8892
9073
|
${_optionalChain([config, 'access', _182 => _182.agent, 'optionalAccess', _183 => _183.apiCatalog]) ? `
|
|
8893
9074
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
8894
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
9075
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkNPPT4RWFcjs.FARM_API_CATALOG_PATH)}) {
|
|
8895
9076
|
return applyProductionMiddlewareHeaders(
|
|
8896
9077
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
8897
9078
|
middlewareHeaders,
|
|
@@ -9296,8 +9477,12 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9296
9477
|
shouldHydrateLayout &&
|
|
9297
9478
|
route.serverTree === true &&
|
|
9298
9479
|
!route.shouldHydrate &&
|
|
9299
|
-
request.headers.get("f-render") === "tree"
|
|
9300
|
-
|
|
9480
|
+
request.headers.get("f-render") === "tree";
|
|
9481
|
+
// A navigation the browser streams marks where each React flush ends, so the browser
|
|
9482
|
+
// shows the page before its Suspense content arrives (FARM_FLUSH_MARKER).
|
|
9483
|
+
const farmFlushMarkers = request.headers.get("f-stream") === "flush";` : `const farmLayoutKeyOf = null;
|
|
9484
|
+
const farmPayloadOnlyNavigation = false;
|
|
9485
|
+
const farmFlushMarkers = false;`}
|
|
9301
9486
|
const renderPageElement = async () => {
|
|
9302
9487
|
// First, render the page content
|
|
9303
9488
|
let pageElement;
|
|
@@ -9419,7 +9604,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9419
9604
|
}
|
|
9420
9605
|
|
|
9421
9606
|
wrappedElement = wrapWithFarmIntegrationProviders(wrappedElement);
|
|
9422
|
-
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern);
|
|
9607
|
+
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern, farmFlushMarkers);
|
|
9423
9608
|
};
|
|
9424
9609
|
const renderedPage = ${hasMiddlewareRuntime ? `await _runWithMiddlewareData(middlewareData, () =>
|
|
9425
9610
|
_runWithMiddlewareContext(middlewareContext, renderPageElement)
|
|
@@ -9542,7 +9727,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9542
9727
|
// gets HTML without them.
|
|
9543
9728
|
responseHeaders["Vary"] = farmSharedCacheableRoute
|
|
9544
9729
|
? "F-Layouts"
|
|
9545
|
-
: "F-Values, F-Layouts, F-Render";` : ""}
|
|
9730
|
+
: "F-Values, F-Layouts, F-Render, F-Stream";` : ""}
|
|
9546
9731
|
let html = renderedPage.html;
|
|
9547
9732
|
|
|
9548
9733
|
// Check if the layout already rendered a full HTML document
|
|
@@ -10391,8 +10576,8 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
10391
10576
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
10392
10577
|
return "rewrite";
|
|
10393
10578
|
}
|
|
10394
|
-
if (
|
|
10395
|
-
if (
|
|
10579
|
+
if (_chunkVCKGOXFIcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
10580
|
+
if (_chunkVCKGOXFIcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
10396
10581
|
if (_chunkKZT2VHRQcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
10397
10582
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
10398
10583
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
@@ -10429,7 +10614,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10429
10614
|
const outputDir = _chunkKZT2VHRQcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10430
10615
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
10431
10616
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
10432
|
-
const imageRuntime =
|
|
10617
|
+
const imageRuntime = _chunkC5S457CKcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
10433
10618
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
10434
10619
|
(image) => image.sourceType === "module"
|
|
10435
10620
|
);
|
|
@@ -11028,13 +11213,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
11028
11213
|
}
|
|
11029
11214
|
if (prerenderRoutes.length > 0) {
|
|
11030
11215
|
_chunkXN2MB4QZcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
11031
|
-
const previousPrerender = process.env[
|
|
11032
|
-
process.env[
|
|
11216
|
+
const previousPrerender = process.env[_chunkHTLCLOXQcjs.FARM_PRERENDER_ENV];
|
|
11217
|
+
process.env[_chunkHTLCLOXQcjs.FARM_PRERENDER_ENV] = "1";
|
|
11033
11218
|
try {
|
|
11034
11219
|
await nitroBuilder.prerender(nitroInstance);
|
|
11035
11220
|
} finally {
|
|
11036
|
-
if (previousPrerender === void 0) delete process.env[
|
|
11037
|
-
else process.env[
|
|
11221
|
+
if (previousPrerender === void 0) delete process.env[_chunkHTLCLOXQcjs.FARM_PRERENDER_ENV];
|
|
11222
|
+
else process.env[_chunkHTLCLOXQcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
11038
11223
|
}
|
|
11039
11224
|
}
|
|
11040
11225
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
@@ -11298,7 +11483,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
11298
11483
|
try {
|
|
11299
11484
|
await copyPackage("sharp", sharpRequire);
|
|
11300
11485
|
if (!copiedPackages.has("sharp")) {
|
|
11301
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
11486
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkC5S457CKcjs.SHARP_INSTALL_HINT}`);
|
|
11302
11487
|
}
|
|
11303
11488
|
} catch (error) {
|
|
11304
11489
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -11583,7 +11768,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
11583
11768
|
};
|
|
11584
11769
|
config = {
|
|
11585
11770
|
...config,
|
|
11586
|
-
images:
|
|
11771
|
+
images: _chunkC5S457CKcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
11587
11772
|
root: targets.root,
|
|
11588
11773
|
preset: targets.preset
|
|
11589
11774
|
})
|
|
@@ -11611,7 +11796,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
11611
11796
|
root,
|
|
11612
11797
|
rendererBuild.signal
|
|
11613
11798
|
);
|
|
11614
|
-
const farmApp =
|
|
11799
|
+
const farmApp = _chunkC5S457CKcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
11615
11800
|
await farmApp.initialize();
|
|
11616
11801
|
const routeManager = farmApp.getRouteManager();
|
|
11617
11802
|
const serverRenderer = farmApp.getServerRenderer();
|
|
@@ -11717,7 +11902,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
11717
11902
|
ssr: true,
|
|
11718
11903
|
buildLifetime
|
|
11719
11904
|
});
|
|
11720
|
-
const viteConfig =
|
|
11905
|
+
const viteConfig = _chunkC5S457CKcjs.mergeFarmViteConfig.call(void 0,
|
|
11721
11906
|
{
|
|
11722
11907
|
root,
|
|
11723
11908
|
appType: "custom",
|
|
@@ -11729,7 +11914,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
11729
11914
|
},
|
|
11730
11915
|
plugins: [
|
|
11731
11916
|
...rendererVitePlugins,
|
|
11732
|
-
|
|
11917
|
+
_chunkC5S457CKcjs.farmFontImportsPlugin.call(void 0, {
|
|
11733
11918
|
root,
|
|
11734
11919
|
basePath: config.basePath,
|
|
11735
11920
|
publicDir: config.publicDir
|
|
@@ -11741,7 +11926,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
11741
11926
|
hmr: false
|
|
11742
11927
|
},
|
|
11743
11928
|
resolve: {
|
|
11744
|
-
alias:
|
|
11929
|
+
alias: _chunkC5S457CKcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
11745
11930
|
dedupe: [...config.renderer.dedupe || []]
|
|
11746
11931
|
},
|
|
11747
11932
|
optimizeDeps: {
|