@farm.js/core 0.1.45 → 0.1.47
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-EnzWYv_X.d.ts → agent-mcp-BtK_KZ1m.d.ts} +2 -2
- package/dist/{agent-mcp-CWI-awqd.d.mts → agent-mcp-Cc-ypyNi.d.mts} +2 -2
- package/dist/agent-runtime.d.mts +10 -10
- package/dist/agent-runtime.d.ts +10 -10
- package/dist/api/client.d.mts +3 -3
- package/dist/api/client.d.ts +3 -3
- package/dist/api/route-manager.d.mts +16 -16
- package/dist/api/route-manager.d.ts +16 -16
- package/dist/api/runtime.d.mts +12 -12
- package/dist/api/runtime.d.ts +12 -12
- package/dist/{api-client-Dk9QOLwr.d.mts → api-client-CFdv-Xgh.d.mts} +3 -3
- package/dist/{api-client-BJv9mTbO.d.ts → api-client-CvI5oOBE.d.ts} +3 -3
- package/dist/api.d.mts +17 -17
- package/dist/api.d.ts +17 -17
- package/dist/{app-DG3dE8v5.d.mts → app-2SBLAaNq.d.mts} +8 -8
- package/dist/{app-CAN_2Cqo.d.ts → app-BlXGEpdA.d.ts} +8 -8
- package/dist/{app-manifest-DazjgQya.d.ts → app-manifest-D1Tgp8ya.d.ts} +1 -1
- package/dist/{app-manifest-8x5VjZ0L.d.mts → app-manifest-nZHIvS3a.d.mts} +1 -1
- package/dist/app-markdown.d.mts +11 -11
- package/dist/app-markdown.d.ts +11 -11
- package/dist/{base-path-BU16ETmo.d.mts → base-path-leyrqXbX.d.mts} +1 -1
- package/dist/{base-path-BU16ETmo.d.ts → base-path-leyrqXbX.d.ts} +1 -1
- package/dist/{chunk-I5IO3ASU.cjs → chunk-2DZFF7F7.cjs} +268 -140
- package/dist/{chunk-YAD64RWI.cjs → chunk-2NROIAA6.cjs} +50 -50
- package/dist/{chunk-K5DHVEXC.mjs → chunk-2SLWGLZ7.mjs} +2 -2
- package/dist/{chunk-FHQZJJQR.mjs → chunk-3HEQSCVV.mjs} +1 -1
- package/dist/{chunk-VR64PHNT.mjs → chunk-7P475T2X.mjs} +206 -78
- package/dist/{chunk-2NCY6O6Q.mjs → chunk-FQUKOELE.mjs} +3 -3
- package/dist/{chunk-X6YOWNDZ.mjs → chunk-KQANE4Q4.mjs} +1 -1
- package/dist/{chunk-KVN3YEFF.cjs → chunk-NFME7OKZ.cjs} +6 -6
- package/dist/{chunk-2DZOABRK.cjs → chunk-OF4TXHM4.cjs} +1 -1
- package/dist/{chunk-SIVK2SRR.cjs → chunk-Q5F32A26.cjs} +43 -43
- package/dist/{chunk-FDCV5OCT.mjs → chunk-QSG2IX4A.mjs} +1 -1
- package/dist/{chunk-UN4B2TXC.cjs → chunk-XIZO5VDA.cjs} +2 -2
- package/dist/{client-plugins-nQ0tYt4l.d.mts → client-plugins-DEmIQo5R.d.mts} +1438 -1438
- package/dist/{client-plugins-BGS0wqzc.d.ts → client-plugins-br48Hpmk.d.ts} +1438 -1438
- package/dist/client-plugins.d.mts +10 -10
- package/dist/client-plugins.d.ts +10 -10
- package/dist/client.d.mts +17 -17
- package/dist/client.d.ts +17 -17
- package/dist/config.d.mts +10 -10
- package/dist/config.d.ts +10 -10
- package/dist/docs.d.mts +11 -11
- package/dist/docs.d.ts +11 -11
- package/dist/{endpoint-BOE0IAaG.d.ts → endpoint-BgHn0lhl.d.ts} +1 -1
- package/dist/{endpoint-DGZRZHux.d.mts → endpoint-BkMSCRf6.d.mts} +1 -1
- package/dist/environment/vite.d.mts +1 -1
- package/dist/environment/vite.d.ts +1 -1
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- package/dist/image/server.d.mts +1 -1
- package/dist/image/server.d.ts +1 -1
- package/dist/image/sharp.d.mts +1 -1
- package/dist/image/sharp.d.ts +1 -1
- package/dist/{image-config-BpH1q5R8.d.ts → image-config-CeDgNyX4.d.mts} +1 -1
- package/dist/{image-config-BpH1q5R8.d.mts → image-config-CeDgNyX4.d.ts} +1 -1
- package/dist/image.d.mts +1 -1
- package/dist/image.d.ts +1 -1
- package/dist/{index-BJJfLxJo.d.mts → index-Cl3akY5U.d.mts} +2 -2
- package/dist/{index-Cy26isrh.d.ts → index-CyD9Rfso.d.ts} +2 -2
- package/dist/{index-CwoOP-MW.d.ts → index-MocnSP3a.d.ts} +2 -2
- package/dist/{index-y1jgR74U.d.mts → index-_nhUt_dh.d.mts} +2 -2
- package/dist/index.cjs +6 -6
- package/dist/index.d.mts +32 -32
- package/dist/index.d.ts +32 -32
- package/dist/index.mjs +5 -5
- package/dist/{instrumentation-runtime-CE06JLHZ.d.mts → instrumentation-runtime-CX9Zh-16.d.mts} +1 -1
- package/dist/{instrumentation-runtime-CE06JLHZ.d.ts → instrumentation-runtime-CX9Zh-16.d.ts} +1 -1
- package/dist/instrumentation.d.mts +2 -2
- package/dist/instrumentation.d.ts +2 -2
- package/dist/integrations.d.mts +10 -10
- package/dist/integrations.d.ts +10 -10
- package/dist/internal/app-markdown-runtime.d.mts +11 -11
- package/dist/internal/app-markdown-runtime.d.ts +11 -11
- package/dist/internal/build-runtime.cjs +6 -6
- package/dist/internal/build-runtime.d.mts +12 -12
- package/dist/internal/build-runtime.d.ts +12 -12
- package/dist/internal/build-runtime.mjs +5 -5
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +1 -1
- package/dist/internal/client-runtime.d.ts +1 -1
- package/dist/internal/compression-runtime.d.mts +10 -10
- package/dist/internal/compression-runtime.d.ts +10 -10
- package/dist/internal/config-runtime.d.mts +11 -11
- package/dist/internal/config-runtime.d.ts +11 -11
- package/dist/internal/form-actions.d.mts +1 -1
- package/dist/internal/form-actions.d.ts +1 -1
- package/dist/internal/islx-client.d.mts +4 -0
- package/dist/internal/islx-client.d.ts +4 -0
- 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 +25 -25
- package/dist/internal/production-runtime.d.ts +25 -25
- package/dist/internal/production-runtime.mjs +3 -3
- package/dist/{layers-CM5i6T7z.d.mts → layers-D9fbe-rz.d.mts} +1 -1
- package/dist/{layers-CM5i6T7z.d.ts → layers-D9fbe-rz.d.ts} +1 -1
- package/dist/markdown.d.mts +10 -10
- package/dist/markdown.d.ts +10 -10
- package/dist/middleware.d.mts +12 -12
- package/dist/middleware.d.ts +12 -12
- package/dist/navigation.d.mts +13 -13
- package/dist/navigation.d.ts +13 -13
- package/dist/{observability-CoXunYhS.d.mts → observability-B2363jB6.d.mts} +1 -1
- package/dist/{observability-CoXunYhS.d.ts → observability-B2363jB6.d.ts} +1 -1
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/og.d.mts +0 -5
- package/dist/og.d.ts +0 -5
- package/dist/plugin.cjs +5 -5
- package/dist/plugin.d.mts +12 -12
- package/dist/plugin.d.ts +12 -12
- package/dist/plugin.mjs +4 -4
- package/dist/{production-runtime-ClFA_1KQ.d.mts → production-runtime-BEbIyIUe.d.mts} +4 -4
- package/dist/{production-runtime-BVMDgHrA.d.ts → production-runtime-DsHjccVI.d.ts} +4 -4
- package/dist/{ssg-XnMHCyEc.d.ts → programmatic-routes-client-DlMKstmL.d.ts} +57 -57
- package/dist/{ssg-ByrOVYdM.d.mts → programmatic-routes-client-Dqr6tHND.d.mts} +57 -57
- package/dist/{render-plan-CoSovy_O.d.mts → render-plan-Bu6XOxNg.d.mts} +1 -1
- package/dist/{render-plan-y2DefWf8.d.ts → render-plan-MefW_fLC.d.ts} +1 -1
- package/dist/renderer/react/server.d.mts +1 -1
- package/dist/renderer/react/server.d.ts +1 -1
- package/dist/renderer-client.d.mts +12 -12
- package/dist/renderer-client.d.ts +12 -12
- package/dist/{request-cNM09Q7e.d.mts → request-BBe1B8Bk.d.mts} +1 -1
- package/dist/{request-aG5Wovm5.d.ts → request-CMsRJQK3.d.ts} +1 -1
- package/dist/request.d.mts +11 -11
- package/dist/request.d.ts +11 -11
- package/dist/{resolver-khasx3fU.d.mts → resolver-C2G-3Tm6.d.mts} +1 -1
- package/dist/{resolver-DadfRL6F.d.ts → resolver-DC57A4vz.d.ts} +1 -1
- package/dist/{integration-api-DWyMmvrR.d.mts → route-2_yXC6gv.d.mts} +100 -100
- package/dist/{integration-api-BuPHMeKz.d.ts → route-DFhZj6jN.d.ts} +100 -100
- package/dist/{route-pattern-W-SsJGSp.d.mts → route-pattern-CVsVbq5n.d.mts} +1 -1
- package/dist/{route-pattern-W-SsJGSp.d.ts → route-pattern-CVsVbq5n.d.ts} +1 -1
- package/dist/{route-rendering-EyInfsjI.d.mts → route-rendering-DTLNruPw.d.ts} +1 -1
- package/dist/{route-rendering-B3uQmCWX.d.ts → route-rendering-Do8tuYgh.d.mts} +1 -1
- package/dist/{router-DNUf-Bg1.d.ts → router-BJreOZ-k.d.ts} +2 -2
- package/dist/{router-Devibh4r.d.mts → router-o2mZB9Y4.d.mts} +2 -2
- package/dist/routes.d.mts +11 -11
- package/dist/routes.d.ts +11 -11
- package/dist/{runtime-BgDQzBiu.d.ts → runtime-B9HmxiZc.d.ts} +2 -2
- package/dist/{runtime-CV2UCV-5.d.mts → runtime-CCxTmGuf.d.mts} +2 -2
- package/dist/{runtime-CLr9P5kn.d.ts → runtime-Cp5YZNz4.d.mts} +5 -5
- package/dist/{runtime-9KZb8AI5.d.mts → runtime-Da57KD8F.d.ts} +5 -5
- package/dist/server-action-security.d.mts +1 -1
- package/dist/server-action-security.d.ts +1 -1
- package/dist/server-fn-client.d.mts +4 -4
- package/dist/server-fn-client.d.ts +4 -4
- package/dist/{server-fn-error-DDh14a0V.d.mts → server-fn-error-DrcH9cc1.d.mts} +1 -1
- package/dist/{server-fn-error-DDh14a0V.d.ts → server-fn-error-DrcH9cc1.d.ts} +1 -1
- package/dist/server-fn.d.mts +3 -3
- package/dist/server-fn.d.ts +3 -3
- package/dist/server-plugins.d.mts +11 -11
- package/dist/server-plugins.d.ts +11 -11
- package/dist/server-query-client.d.mts +2 -2
- package/dist/server-query-client.d.ts +2 -2
- package/dist/server-query.d.mts +2 -2
- package/dist/server-query.d.ts +2 -2
- package/dist/server.cjs +14 -14
- package/dist/server.d.mts +20 -20
- package/dist/server.d.ts +20 -20
- package/dist/server.mjs +4 -4
- package/dist/{spa-router-Ds6R_oe-.d.ts → spa-router-CN2vc0GY.d.ts} +4 -4
- package/dist/{spa-router-BIxh4IY-.d.mts → spa-router-COZLIB7k.d.mts} +4 -4
- package/dist/storage.d.mts +3 -3
- package/dist/storage.d.ts +3 -3
- package/dist/testing.d.mts +12 -12
- package/dist/testing.d.ts +12 -12
- package/dist/theme/server.d.mts +1 -1
- package/dist/theme/server.d.ts +1 -1
- package/dist/{types-CnH8DOqo.d.mts → types--Wh02r5_.d.mts} +1 -1
- package/dist/{types-CnH8DOqo.d.ts → types--Wh02r5_.d.ts} +1 -1
- package/dist/{types-Cc8l9IqS.d.ts → types-BnIqOn9w.d.mts} +1 -1
- package/dist/{types-Cc8l9IqS.d.mts → types-BnIqOn9w.d.ts} +1 -1
- package/dist/{utils-BN70ueSN.d.ts → utils-BAtVIHfw.d.mts} +2 -2
- package/dist/{utils-BrjR5xRs.d.mts → utils-Y8MZrj4b.d.ts} +2 -2
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +5 -5
- package/dist/vite.d.mts +14 -14
- package/dist/vite.d.ts +14 -14
- package/dist/vite.mjs +4 -4
- package/dist/{workflows-IWP1ddBm.d.mts → workflows-Df1C_7OG.d.mts} +1 -1
- package/dist/{workflows-IWP1ddBm.d.ts → workflows-Df1C_7OG.d.ts} +1 -1
- package/dist/workflows.d.mts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/package.json +3 -3
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
generateNativeMCPPluginSource,
|
|
13
13
|
layoutsCanCoverSamePage
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QSG2IX4A.mjs";
|
|
15
15
|
import {
|
|
16
16
|
assertFarmDocsAdapterServesNoGuardedPages,
|
|
17
17
|
compileFarmDocsAdapterEdgeManifest,
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
resolveFarmIsolatedClientHydrationMode,
|
|
83
83
|
resolveFarmNotFoundComponentPath,
|
|
84
84
|
usesFarmServerTree
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-2SLWGLZ7.mjs";
|
|
86
86
|
import {
|
|
87
87
|
PluginManager
|
|
88
88
|
} from "./chunk-FGH3ZXTP.mjs";
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
resolveFarmAppManifestInput,
|
|
110
110
|
routeBoundaryCoversDirectory,
|
|
111
111
|
stripRouteGroups
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-KQANE4Q4.mjs";
|
|
113
113
|
import {
|
|
114
114
|
farmPluginMayAffectRuntimePath
|
|
115
115
|
} from "./chunk-Y5RG6B7S.mjs";
|
|
@@ -224,7 +224,7 @@ import {
|
|
|
224
224
|
} from "./chunk-BTHHUD7Q.mjs";
|
|
225
225
|
import {
|
|
226
226
|
FARM_VERSION
|
|
227
|
-
} from "./chunk-
|
|
227
|
+
} from "./chunk-3HEQSCVV.mjs";
|
|
228
228
|
import {
|
|
229
229
|
getFarmPresetRuntime
|
|
230
230
|
} from "./chunk-2A3EQHXX.mjs";
|
|
@@ -3584,7 +3584,7 @@ void farmClientRuntime.start();
|
|
|
3584
3584
|
spaRouter.initializeHistory();
|
|
3585
3585
|
window.__FARM_SPA_ROUTER__ = spaRouter;
|
|
3586
3586
|
|
|
3587
|
-
void hydrateFarmDocsAdapterRuntime();
|
|
3587
|
+
${islandValues ? "void farmDocumentParsed().then(hydrateFarmDocsAdapterRuntime);" : "void hydrateFarmDocsAdapterRuntime();"}
|
|
3588
3588
|
|
|
3589
3589
|
window.addEventListener("beforeunload", function(event) {
|
|
3590
3590
|
if (spaRouter.shouldBlockUnload()) {
|
|
@@ -4122,19 +4122,37 @@ function resetReactRoot() {
|
|
|
4122
4122
|
isHydrated = false;
|
|
4123
4123
|
}
|
|
4124
4124
|
|
|
4125
|
-
|
|
4125
|
+
${islandValues ? `// Islands mode starts the client while the body streams (an async entry): a page of islands
|
|
4126
|
+
// hydrates them as they arrive; anything else waits for the whole document.
|
|
4127
|
+
function farmDocumentParsed() {
|
|
4128
|
+
if (document.readyState !== "loading") return Promise.resolve();
|
|
4129
|
+
return new Promise(function(resolve) {
|
|
4130
|
+
document.addEventListener("DOMContentLoaded", function() { resolve(); }, { once: true });
|
|
4131
|
+
});
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
` : ""}// Hydrate client components
|
|
4126
4135
|
async function hydrate() {
|
|
4127
4136
|
await window.__FARM_PPR_REFRESH_PROMISE__;
|
|
4128
4137
|
// A PPR refresh that is still retrying must not replace DOM once hydration starts.
|
|
4129
4138
|
window.__FARM_PPR_HYDRATING__ = true;
|
|
4130
4139
|
await farmClientRuntime.start();
|
|
4131
4140
|
|
|
4141
|
+
const pathname = window.location.pathname;
|
|
4142
|
+
const matched = matchRoute(pathname);
|
|
4143
|
+
${islandValues ? `if (
|
|
4144
|
+
!matched ||
|
|
4145
|
+
!matched.route.hasIsolatedClientBoundaries ||
|
|
4146
|
+
matched.route.pageShouldHydrate ||
|
|
4147
|
+
hasHydratableLayout(pathname)
|
|
4148
|
+
) {
|
|
4149
|
+
await farmDocumentParsed();
|
|
4150
|
+
}` : ""}
|
|
4151
|
+
|
|
4132
4152
|
if (await hydrateFarmDocsAdapterRuntime()) {
|
|
4133
4153
|
return;
|
|
4134
4154
|
}
|
|
4135
4155
|
|
|
4136
|
-
const pathname = window.location.pathname;
|
|
4137
|
-
const matched = matchRoute(pathname);
|
|
4138
4156
|
hydrateInitialRouteSlots();
|
|
4139
4157
|
|
|
4140
4158
|
if (!matched) {
|
|
@@ -6677,8 +6695,9 @@ function renderFarmRendererHydrationScript() {
|
|
|
6677
6695
|
: "";
|
|
6678
6696
|
}
|
|
6679
6697
|
|
|
6680
|
-
function renderFarmClientEntryScript() {
|
|
6681
|
-
|
|
6698
|
+
function renderFarmClientEntryScript(early) {
|
|
6699
|
+
// An early entry runs as soon as it loads, while the body still streams.
|
|
6700
|
+
return stampFarmCspNonce('<script type="module"' + (early ? ' async' : '') + ' src="/__farm_client_js_src__"></script>');
|
|
6682
6701
|
}
|
|
6683
6702
|
|
|
6684
6703
|
// Renderer options for the response being rendered: its CSP nonce, which the
|
|
@@ -7019,6 +7038,73 @@ function createFarmDocumentStream(contentStream, prefix, suffix, onComplete) {
|
|
|
7019
7038
|
});
|
|
7020
7039
|
}
|
|
7021
7040
|
|
|
7041
|
+
// Streams a layout's own <html> document. React's output is held until the opening <body>, so
|
|
7042
|
+
// Farm's head assets go into the document's head (openDocument); the body then streams through.
|
|
7043
|
+
// The closing </body></html> React writes with its shell is held back: Suspense content React
|
|
7044
|
+
// streams later belongs inside the body, before Farm's footer (closeDocument) and the closing tags.
|
|
7045
|
+
function createFarmFullDocumentStream(contentStream, openDocument, closeDocument, onComplete) {
|
|
7046
|
+
const encoder = new TextEncoder();
|
|
7047
|
+
const decoder = new TextDecoder();
|
|
7048
|
+
const reader = contentStream.getReader();
|
|
7049
|
+
// The footer renders after the handler returned, outside its async scope.
|
|
7050
|
+
const cspNonce = _resolveCurrentCspNonce();
|
|
7051
|
+
let opening = "";
|
|
7052
|
+
let opened = false;
|
|
7053
|
+
let rootOpened = false;
|
|
7054
|
+
let closing = false;
|
|
7055
|
+
return new ReadableStream({
|
|
7056
|
+
async pull(controller) {
|
|
7057
|
+
try {
|
|
7058
|
+
for (;;) {
|
|
7059
|
+
const result = await reader.read();
|
|
7060
|
+
let text = result.done ? decoder.decode() : decoder.decode(result.value, { stream: true });
|
|
7061
|
+
if (!opened) {
|
|
7062
|
+
opening += text;
|
|
7063
|
+
if (!result.done && !/<body\\b[^>]*>/i.test(opening)) continue;
|
|
7064
|
+
opened = true;
|
|
7065
|
+
text = opening;
|
|
7066
|
+
opening = "";
|
|
7067
|
+
const closeAt = text.search(/<\\/body>/i);
|
|
7068
|
+
const head = closeAt >= 0 ? text.slice(0, closeAt) : text;
|
|
7069
|
+
const rest = closeAt >= 0 ? text.slice(closeAt) : "";
|
|
7070
|
+
// ensureFarmDocumentRoot opens #root unless the layout's body already does.
|
|
7071
|
+
rootOpened = !/<body\\b[^>]*>\\s*<div\\b[^>]*\\sid=["']root["']/i.test(head);
|
|
7072
|
+
text = openDocument(head) + rest;
|
|
7073
|
+
}
|
|
7074
|
+
if (!closing) {
|
|
7075
|
+
const closeAt = text.search(/<\\/body>/i);
|
|
7076
|
+
if (closeAt >= 0) {
|
|
7077
|
+
closing = true;
|
|
7078
|
+
// Drop the closing tags and Farm's wrapper divs around the document; keep what React
|
|
7079
|
+
// wrote after them.
|
|
7080
|
+
text = text.slice(0, closeAt) +
|
|
7081
|
+
text.slice(closeAt).replace(/^<\\/body>\\s*(?:<\\/html>)?(?:\\s*<\\/div>)*/i, "");
|
|
7082
|
+
}
|
|
7083
|
+
}
|
|
7084
|
+
if (result.done) {
|
|
7085
|
+
const footer = await _runWithFarmCspNonce(cspNonce, function() {
|
|
7086
|
+
return closeDocument(rootOpened);
|
|
7087
|
+
});
|
|
7088
|
+
controller.enqueue(encoder.encode(text + footer + "</body>\\n</html>"));
|
|
7089
|
+
if (onComplete) onComplete();
|
|
7090
|
+
controller.close();
|
|
7091
|
+
return;
|
|
7092
|
+
}
|
|
7093
|
+
if (text) {
|
|
7094
|
+
controller.enqueue(encoder.encode(text));
|
|
7095
|
+
return;
|
|
7096
|
+
}
|
|
7097
|
+
}
|
|
7098
|
+
} catch (error) {
|
|
7099
|
+
controller.error(error);
|
|
7100
|
+
}
|
|
7101
|
+
},
|
|
7102
|
+
cancel(reason) {
|
|
7103
|
+
return reader.cancel(reason);
|
|
7104
|
+
},
|
|
7105
|
+
});
|
|
7106
|
+
}
|
|
7107
|
+
|
|
7022
7108
|
function stripFarmDocumentWrappers(markup) {
|
|
7023
7109
|
return peelFarmDocumentPrefix(markup).inner;
|
|
7024
7110
|
}
|
|
@@ -9305,15 +9391,60 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9305
9391
|
const initialHtml = html !== undefined ? html : renderedPage.shellHtml || "";
|
|
9306
9392
|
const hasFullDocument = opensFarmFullDocument(initialHtml);
|
|
9307
9393
|
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
//
|
|
9311
|
-
//
|
|
9312
|
-
|
|
9394
|
+
const rendererHead = renderedPage.head || "";
|
|
9395
|
+
const rendererHasTitle = /<title[\\s>]/i.test(rendererHead);
|
|
9396
|
+
// First <title> wins: the fallback framework title yields to a
|
|
9397
|
+
// renderer-emitted one; explicit metadata titles still come first.
|
|
9398
|
+
const suppressDefaultTitle =
|
|
9399
|
+
!renderedMetadata.hasExplicitTitle && rendererHasTitle;
|
|
9400
|
+
// A layout's own <html> document with Farm's head assets merged in and the #root the client
|
|
9401
|
+
// hydrates opening its body: the whole document, or a streamed one's opening.
|
|
9402
|
+
const composeFarmFullDocument = function(markup) {
|
|
9403
|
+
let composed = addFarmFallbackIcon(
|
|
9404
|
+
ensureFarmDocumentRoot(ensureFarmDocumentHead(markup)),
|
|
9405
|
+
hasFavicon,
|
|
9406
|
+
);
|
|
9407
|
+
composed = composed
|
|
9408
|
+
// Inject CSS link after opening head tag or first meta tag
|
|
9409
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(composed, route.clientModule); })
|
|
9410
|
+
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
9411
|
+
// Explicit metadata wins over renderer and layout titles. Without
|
|
9412
|
+
// explicit metadata, a renderer title wins over the layout title.
|
|
9413
|
+
.replace(/<head([^>]*)>([\\s\\S]*?)<\\/head>/i, (match, attrs, headContent) => {
|
|
9414
|
+
const hasAuthoritativeTitle = renderedMetadata.hasExplicitTitle || rendererHasTitle;
|
|
9415
|
+
let nextHeadContent = hasAuthoritativeTitle
|
|
9416
|
+
? headContent.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "")
|
|
9417
|
+
: headContent;
|
|
9418
|
+
if (renderedMetadata.hasExplicitTitle) {
|
|
9419
|
+
nextHeadContent += "\\n <title>" + title + "</title>";
|
|
9420
|
+
}
|
|
9421
|
+
if (metaTags) nextHeadContent += metaTags;
|
|
9422
|
+
// Renderer-emitted head markup (e.g. <svelte:head>). Function
|
|
9423
|
+
// replacement below keeps $-sequences literal.
|
|
9424
|
+
const effectiveRendererHead = renderedMetadata.hasExplicitTitle
|
|
9425
|
+
? rendererHead.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "")
|
|
9426
|
+
: rendererHead;
|
|
9427
|
+
if (effectiveRendererHead) nextHeadContent += "\\n " + effectiveRendererHead;
|
|
9428
|
+
return nextHeadContent === headContent
|
|
9429
|
+
? match
|
|
9430
|
+
: "<head" + attrs + ">" + nextHeadContent + "\\n</head>";
|
|
9431
|
+
});
|
|
9432
|
+
// Last, so the charset (and the viewport, unless the layout wrote one) open the head.
|
|
9433
|
+
composed = ensureFarmDocumentMeta(composed, viewportTags);
|
|
9434
|
+
if (!composed.trim().startsWith('<!DOCTYPE')) {
|
|
9435
|
+
composed = '<!DOCTYPE html>\\n' + composed;
|
|
9436
|
+
}
|
|
9437
|
+
return composed;
|
|
9438
|
+
};
|
|
9439
|
+
|
|
9440
|
+
// Stream a suspended body as soon as React's shell is ready, a layout's own <html> document
|
|
9441
|
+
// included. Localized documents and cacheable PPR shells still use the buffered path
|
|
9442
|
+
// because they require whole-document transformation, and so does the anonymous check
|
|
9443
|
+
// behind a page's Markdown source: there, a redirect() under a loading boundary must still
|
|
9444
|
+
// decide the status.
|
|
9313
9445
|
if (
|
|
9314
9446
|
pageStatus === 200 &&
|
|
9315
9447
|
renderedPage.stream &&
|
|
9316
|
-
!hasFullDocument &&
|
|
9317
9448
|
!farmI18nSnapshot &&
|
|
9318
9449
|
!pprCacheKey &&
|
|
9319
9450
|
!_isFarmMarkdownPageCheck(request.headers.get(FARM_MARKDOWN_PAGE_CHECK_HEADER))
|
|
@@ -9323,6 +9454,18 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9323
9454
|
farmResolvedRuntimeConfig.basePath,
|
|
9324
9455
|
getFarmTheme(request)
|
|
9325
9456
|
);
|
|
9457
|
+
// The page's client data and entry. Islands mode starts the client while the body streams
|
|
9458
|
+
// (an async entry right after <body>), so islands that arrive early hydrate before slow
|
|
9459
|
+
// Suspense content resolves; other modes keep them at the end.
|
|
9460
|
+
const farmClientScripts = function(early) {
|
|
9461
|
+
return ' ' + renderFarmClientBootstrapScript(
|
|
9462
|
+
pageProps.__farmCanonicalPath,
|
|
9463
|
+
routeSlotPayload,
|
|
9464
|
+
clientPageProps
|
|
9465
|
+
) + '\\n' +
|
|
9466
|
+
' ' + renderFarmClientEntryScript(early) + '\\n';
|
|
9467
|
+
};
|
|
9468
|
+
const farmEarlyClientScripts = ${farmIslandsMode ? "farmClientScripts(true)" : '""'};
|
|
9326
9469
|
const streamPrefix = '<!DOCTYPE html>\\n<html lang="en">\\n<head>\\n' +
|
|
9327
9470
|
farmThemeDocument.head + '\\n' +
|
|
9328
9471
|
' <meta charset="utf-8">\\n' +
|
|
@@ -9332,33 +9475,25 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9332
9475
|
' <link rel="stylesheet" href="/__farm_client_css_href__">\\n' +
|
|
9333
9476
|
' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule) + '\\n' +
|
|
9334
9477
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
9335
|
-
'</head>\\n<body>\\n <div id="root">';
|
|
9478
|
+
'</head>\\n<body>\\n' + farmEarlyClientScripts + ' <div id="root">';
|
|
9336
9479
|
const streamSuffix = '</div>\\n' +
|
|
9337
|
-
'
|
|
9338
|
-
pageProps.__farmCanonicalPath,
|
|
9339
|
-
routeSlotPayload,
|
|
9340
|
-
clientPageProps
|
|
9341
|
-
) + '\\n' +
|
|
9342
|
-
' ' + renderFarmClientEntryScript() + '\\n' +
|
|
9480
|
+
(farmEarlyClientScripts ? '' : farmClientScripts()) +
|
|
9343
9481
|
'</body>\\n</html>';
|
|
9344
9482
|
const themedStreamPrefix = streamPrefix.replace(
|
|
9345
9483
|
'<html lang="en">',
|
|
9346
9484
|
() => '<html lang="en"' + farmThemeDocument.attributes + '>'
|
|
9347
9485
|
);
|
|
9348
|
-
const
|
|
9349
|
-
renderedPage.stream,
|
|
9350
|
-
themedStreamPrefix,
|
|
9351
|
-
async function() {
|
|
9486
|
+
const lateNavigationRecovery = async function() {
|
|
9352
9487
|
// A redirect()/notFound() after the 200 shell went out can only
|
|
9353
9488
|
// be recovered in the document.
|
|
9354
9489
|
const lateNavigationError = renderedPage.streamErrors.find(function(error) {
|
|
9355
9490
|
return isFarmRedirectError(error) || isFarmNotFoundError(error);
|
|
9356
9491
|
});
|
|
9357
|
-
if (!lateNavigationError) return
|
|
9492
|
+
if (!lateNavigationError) return "";
|
|
9358
9493
|
if (isFarmRedirectError(lateNavigationError)) {
|
|
9359
9494
|
return createLateRedirectRecovery(
|
|
9360
9495
|
getFarmRedirectError(lateNavigationError).url
|
|
9361
|
-
)
|
|
9496
|
+
);
|
|
9362
9497
|
}
|
|
9363
9498
|
try {
|
|
9364
9499
|
return createLateNotFoundRecovery(
|
|
@@ -9366,7 +9501,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9366
9501
|
wrapWithFarmIntegrationProviders(createFarmNotFoundElement(pathname)),
|
|
9367
9502
|
getFarmRendererRenderOptions()
|
|
9368
9503
|
)
|
|
9369
|
-
)
|
|
9504
|
+
);
|
|
9370
9505
|
} catch (error) {
|
|
9371
9506
|
// The layouts are already in the shell; a not-found page that
|
|
9372
9507
|
// needs their context cannot render alone, so use Farm's.
|
|
@@ -9376,10 +9511,10 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9376
9511
|
React.createElement(FarmDefault404Page),
|
|
9377
9512
|
getFarmRendererRenderOptions()
|
|
9378
9513
|
)
|
|
9379
|
-
)
|
|
9514
|
+
);
|
|
9380
9515
|
}
|
|
9381
|
-
}
|
|
9382
|
-
|
|
9516
|
+
};
|
|
9517
|
+
const onStreamComplete = function() {
|
|
9383
9518
|
if (pprBypassReason === "refresh") {
|
|
9384
9519
|
emitFarmEvent({
|
|
9385
9520
|
type: "ppr.refresh.complete",
|
|
@@ -9394,8 +9529,43 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9394
9529
|
status: pageStatus,
|
|
9395
9530
|
durationMs: Date.now() - requestStartTime,
|
|
9396
9531
|
});
|
|
9397
|
-
}
|
|
9398
|
-
|
|
9532
|
+
};
|
|
9533
|
+
const streamedDocument = hasFullDocument
|
|
9534
|
+
? createFarmFullDocumentStream(
|
|
9535
|
+
renderedPage.stream,
|
|
9536
|
+
function(opening) {
|
|
9537
|
+
// Farm's wrappers and the head elements React hoisted ahead of the layout's <html>.
|
|
9538
|
+
const peeled = peelFarmDocumentPrefix(opening);
|
|
9539
|
+
const start = opening.search(/<!doctype|<html[\\s>]/i);
|
|
9540
|
+
return applyFarmThemeDocument(
|
|
9541
|
+
composeFarmFullDocument(
|
|
9542
|
+
restoreFarmHoistedHead(opening.slice(Math.max(start, 0)), peeled.hoisted)
|
|
9543
|
+
// The client entry arrives last: fetch it while the body streams.
|
|
9544
|
+
).replace(/<\\/head>/i, function() {
|
|
9545
|
+
return ' <link rel="modulepreload" href="/__farm_client_js_src__">\\n</head>';
|
|
9546
|
+
}).replace(/<body\\b[^>]*>/i, function(open) {
|
|
9547
|
+
return open + (farmEarlyClientScripts ? '\\n' + farmEarlyClientScripts : '');
|
|
9548
|
+
}),
|
|
9549
|
+
farmThemeConfig,
|
|
9550
|
+
farmResolvedRuntimeConfig.basePath,
|
|
9551
|
+
getFarmTheme(request)
|
|
9552
|
+
);
|
|
9553
|
+
},
|
|
9554
|
+
async function(rootOpened) {
|
|
9555
|
+
return (await lateNavigationRecovery()) +
|
|
9556
|
+
(rootOpened ? '</div>\\n' : '') +
|
|
9557
|
+
(farmEarlyClientScripts ? '' : farmClientScripts());
|
|
9558
|
+
},
|
|
9559
|
+
onStreamComplete
|
|
9560
|
+
)
|
|
9561
|
+
: createFarmDocumentStream(
|
|
9562
|
+
renderedPage.stream,
|
|
9563
|
+
themedStreamPrefix,
|
|
9564
|
+
async function() {
|
|
9565
|
+
return (await lateNavigationRecovery()) + streamSuffix;
|
|
9566
|
+
},
|
|
9567
|
+
onStreamComplete
|
|
9568
|
+
);
|
|
9399
9569
|
return applyProductionMiddlewareHeaders(farmOwnedResponse(streamedDocument, {
|
|
9400
9570
|
status: pageStatus,
|
|
9401
9571
|
headers: { ...responseHeaders, "x-farm-preload-streaming": "1" },
|
|
@@ -9409,44 +9579,10 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9409
9579
|
}
|
|
9410
9580
|
}
|
|
9411
9581
|
|
|
9412
|
-
const rendererHead = renderedPage.head || "";
|
|
9413
|
-
const rendererHasTitle = /<title[\\s>]/i.test(rendererHead);
|
|
9414
|
-
// First <title> wins: the fallback framework title yields to a
|
|
9415
|
-
// renderer-emitted one; explicit metadata titles still come first.
|
|
9416
|
-
const suppressDefaultTitle =
|
|
9417
|
-
!renderedMetadata.hasExplicitTitle && rendererHasTitle;
|
|
9418
9582
|
let fullHtml;
|
|
9419
9583
|
if (hasFullDocument) {
|
|
9420
9584
|
// Layout provides full HTML structure - inject CSS and client script
|
|
9421
|
-
|
|
9422
|
-
ensureFarmDocumentRoot(ensureFarmDocumentHead(extractFarmFullDocument(html) || html)),
|
|
9423
|
-
hasFavicon,
|
|
9424
|
-
);
|
|
9425
|
-
fullHtml = html
|
|
9426
|
-
// Inject CSS link after opening head tag or first meta tag
|
|
9427
|
-
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(html, route.clientModule); })
|
|
9428
|
-
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
9429
|
-
// Explicit metadata wins over renderer and layout titles. Without
|
|
9430
|
-
// explicit metadata, a renderer title wins over the layout title.
|
|
9431
|
-
.replace(/<head([^>]*)>([\\s\\S]*?)<\\/head>/i, (match, attrs, headContent) => {
|
|
9432
|
-
const hasAuthoritativeTitle = renderedMetadata.hasExplicitTitle || rendererHasTitle;
|
|
9433
|
-
let nextHeadContent = hasAuthoritativeTitle
|
|
9434
|
-
? headContent.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "")
|
|
9435
|
-
: headContent;
|
|
9436
|
-
if (renderedMetadata.hasExplicitTitle) {
|
|
9437
|
-
nextHeadContent += "\\n <title>" + title + "</title>";
|
|
9438
|
-
}
|
|
9439
|
-
if (metaTags) nextHeadContent += metaTags;
|
|
9440
|
-
// Renderer-emitted head markup (e.g. <svelte:head>). Function
|
|
9441
|
-
// replacement below keeps $-sequences literal.
|
|
9442
|
-
const effectiveRendererHead = renderedMetadata.hasExplicitTitle
|
|
9443
|
-
? rendererHead.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "")
|
|
9444
|
-
: rendererHead;
|
|
9445
|
-
if (effectiveRendererHead) nextHeadContent += "\\n " + effectiveRendererHead;
|
|
9446
|
-
return nextHeadContent === headContent
|
|
9447
|
-
? match
|
|
9448
|
-
: "<head" + attrs + ">" + nextHeadContent + "\\n</head>";
|
|
9449
|
-
})
|
|
9585
|
+
fullHtml = composeFarmFullDocument(extractFarmFullDocument(html) || html)
|
|
9450
9586
|
// Inject client script before closing body tag. Function replacement:
|
|
9451
9587
|
// serialized page props may contain $-sequences ($&, $', $$) that a
|
|
9452
9588
|
// string replacement would expand into surrounding document markup,
|
|
@@ -9460,14 +9596,6 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9460
9596
|
) + '\\n' +
|
|
9461
9597
|
' ' + renderFarmClientEntryScript() + '\\n</body>',
|
|
9462
9598
|
);
|
|
9463
|
-
|
|
9464
|
-
// Last, so the charset (and the viewport, unless the layout wrote one) open the head.
|
|
9465
|
-
fullHtml = ensureFarmDocumentMeta(fullHtml, viewportTags);
|
|
9466
|
-
|
|
9467
|
-
// Add DOCTYPE if not present
|
|
9468
|
-
if (!fullHtml.trim().startsWith('<!DOCTYPE')) {
|
|
9469
|
-
fullHtml = '<!DOCTYPE html>\\n' + fullHtml;
|
|
9470
|
-
}
|
|
9471
9599
|
} else {
|
|
9472
9600
|
// No layout with full document - wrap in HTML structure
|
|
9473
9601
|
fullHtml = \`<!DOCTYPE html>
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
resolveFarmIsolatedClientHydrationMode,
|
|
31
31
|
resolveModuleSourcePath,
|
|
32
32
|
stripUseClientDirective
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-2SLWGLZ7.mjs";
|
|
34
34
|
import {
|
|
35
35
|
FARM_NODE_RESPONSE_END_PENDING
|
|
36
36
|
} from "./chunk-FGH3ZXTP.mjs";
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
resolveFarmApiCatalogInput,
|
|
59
59
|
resolveFarmAppManifestInput,
|
|
60
60
|
stripRouteGroups
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-KQANE4Q4.mjs";
|
|
62
62
|
import {
|
|
63
63
|
isFarmPreviewDeploymentEnvironment
|
|
64
64
|
} from "./chunk-BOYNDCZL.mjs";
|
|
@@ -218,7 +218,7 @@ import {
|
|
|
218
218
|
} from "./chunk-ZZGQD7A4.mjs";
|
|
219
219
|
import {
|
|
220
220
|
FARM_VERSION
|
|
221
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-3HEQSCVV.mjs";
|
|
222
222
|
import {
|
|
223
223
|
DEFAULT_FARM_API_BASE_PATH
|
|
224
224
|
} from "./chunk-7LTCDQRS.mjs";
|
|
@@ -7,7 +7,7 @@ var _chunkPCOTGFSMcjs = require('./chunk-PCOTGFSM.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkXIZO5VDAcjs = require('./chunk-XIZO5VDA.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -59,7 +59,7 @@ function createFarmLayoutSelector(layouts, resolveRouteDirectory) {
|
|
|
59
59
|
return {
|
|
60
60
|
layout,
|
|
61
61
|
segments: segments.length === 0 ? null : segments,
|
|
62
|
-
groupScope:
|
|
62
|
+
groupScope: _chunkXIZO5VDAcjs.getRouteGroupScope.call(void 0, layout.pattern)
|
|
63
63
|
};
|
|
64
64
|
});
|
|
65
65
|
return (pathname, routeDirectory) => {
|
|
@@ -73,7 +73,7 @@ function createFarmLayoutSelector(layouts, resolveRouteDirectory) {
|
|
|
73
73
|
}
|
|
74
74
|
if (groupScope !== null) {
|
|
75
75
|
if (directory === void 0) directory = _nullishCoalesce(_optionalChain([resolveRouteDirectory, 'optionalCall', _2 => _2(pathname)]), () => ( null));
|
|
76
|
-
if (!
|
|
76
|
+
if (!_chunkXIZO5VDAcjs.isInRouteGroupScope.call(void 0, directory, groupScope)) continue;
|
|
77
77
|
}
|
|
78
78
|
applicable.push(layout);
|
|
79
79
|
}
|
|
@@ -82,9 +82,9 @@ function createFarmLayoutSelector(layouts, resolveRouteDirectory) {
|
|
|
82
82
|
}
|
|
83
83
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmLayoutSelector, "createFarmLayoutSelector");
|
|
84
84
|
function layoutsCanCoverSamePage(a, b) {
|
|
85
|
-
const scopeA =
|
|
86
|
-
const scopeB =
|
|
87
|
-
if (scopeA !== null && scopeB !== null && !
|
|
85
|
+
const scopeA = _chunkXIZO5VDAcjs.getRouteGroupScope.call(void 0, a);
|
|
86
|
+
const scopeB = _chunkXIZO5VDAcjs.getRouteGroupScope.call(void 0, b);
|
|
87
|
+
if (scopeA !== null && scopeB !== null && !_chunkXIZO5VDAcjs.isInRouteGroupScope.call(void 0, scopeA, scopeB) && !_chunkXIZO5VDAcjs.isInRouteGroupScope.call(void 0, scopeB, scopeA)) {
|
|
88
88
|
return false;
|
|
89
89
|
}
|
|
90
90
|
const segmentsA = a === "/" ? [] : _chunkPCOTGFSMcjs.parseRoutePattern.call(void 0, a);
|