@farm.js/core 0.1.0-beta.22 → 0.1.0-beta.24
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-runtime.d.mts +2 -1
- package/dist/agent-runtime.d.ts +2 -1
- package/dist/{app-DwsTpyNZ.d.mts → app-DrFCUMHY.d.mts} +6 -3
- package/dist/app-markdown.d.mts +2 -1
- package/dist/app-markdown.d.ts +2 -1
- package/dist/{app-BB8GCH1g.d.ts → app-pwvKG2B1.d.ts} +6 -3
- package/dist/chunk-4IVNW5QD.mjs +82 -0
- package/dist/chunk-4IVNW5QD.mjs.map +1 -0
- package/dist/chunk-D42BNPZH.mjs +79 -0
- package/dist/chunk-D42BNPZH.mjs.map +1 -0
- package/dist/{chunk-LLPN5SEZ.mjs → chunk-DVPRBMU2.mjs} +2 -2
- package/dist/chunk-GQVQESLY.mjs +25 -0
- package/dist/chunk-GQVQESLY.mjs.map +1 -0
- package/dist/chunk-H53KVQUU.mjs +48 -0
- package/dist/chunk-H53KVQUU.mjs.map +1 -0
- package/dist/chunk-HCGQYYHI.mjs +1 -0
- package/dist/chunk-HCGQYYHI.mjs.map +1 -0
- package/dist/{chunk-XBKXKJX5.mjs → chunk-HVJHNKSP.mjs} +220 -63
- package/dist/chunk-HVJHNKSP.mjs.map +1 -0
- package/dist/{chunk-ZP73P4VR.mjs → chunk-HXE4VGH2.mjs} +79 -20
- package/dist/chunk-HXE4VGH2.mjs.map +1 -0
- package/dist/{chunk-UCYWGN2P.mjs → chunk-OHNSROHS.mjs} +1 -1
- package/dist/{chunk-FRPWCMMG.mjs → chunk-SBWOTAX4.mjs} +63 -2
- package/dist/chunk-SBWOTAX4.mjs.map +1 -0
- package/dist/{chunk-DAUR3WUZ.mjs → chunk-WO466YX5.mjs} +2 -2
- package/dist/chunk-WO466YX5.mjs.map +1 -0
- package/dist/{chunk-CEVMYGDL.mjs → chunk-YD5IRKVS.mjs} +13 -9
- package/dist/chunk-YD5IRKVS.mjs.map +1 -0
- package/dist/{client-plugins-QQntVkrv.d.mts → client-plugins-CCilIb_G.d.mts} +6 -2
- package/dist/{client-plugins-CbRum1fj.d.ts → client-plugins-DuuleQKk.d.ts} +6 -2
- package/dist/client-plugins.d.mts +2 -1
- package/dist/client-plugins.d.ts +2 -1
- package/dist/client.cjs +122 -35
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.mts +2 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.mjs +13 -2
- package/dist/config.d.mts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/{devtools-52FYXIEK.mjs → devtools-326RBQCN.mjs} +7 -6
- package/dist/{devtools-52FYXIEK.mjs.map → devtools-326RBQCN.mjs.map} +1 -1
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.mjs +6 -5
- package/dist/index.cjs +910 -414
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.mjs +66 -49
- package/dist/index.mjs.map +1 -1
- package/dist/integrations.d.mts +2 -1
- package/dist/integrations.d.ts +2 -1
- package/dist/internal/build-runtime.cjs +720 -297
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +4 -3
- package/dist/internal/build-runtime.d.ts +4 -3
- package/dist/internal/build-runtime.mjs +15 -12
- package/dist/internal/config-runtime.cjs +41 -0
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +3 -2
- package/dist/internal/config-runtime.d.ts +3 -2
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/production-runtime.cjs +178 -0
- package/dist/internal/production-runtime.cjs.map +1 -1
- package/dist/internal/production-runtime.d.mts +20 -6
- package/dist/internal/production-runtime.d.ts +20 -6
- package/dist/internal/production-runtime.mjs +13 -1
- package/dist/internal/production-runtime.mjs.map +1 -1
- package/dist/{metadata-B5jBJHq1.d.ts → metadata-DyPRG0wX.d.ts} +1 -1
- package/dist/{metadata-BxOJ4FJl.d.mts → metadata-_GHcAySx.d.mts} +1 -1
- package/dist/middleware.d.mts +4 -3
- package/dist/middleware.d.ts +4 -3
- package/dist/plugin.cjs +461 -155
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +2 -1
- package/dist/plugin.d.ts +2 -1
- package/dist/plugin.mjs +11 -8
- package/dist/{production-runtime-Bxua86uR.d.mts → production-runtime-C4cO3esK.d.mts} +1 -1
- package/dist/{production-runtime-CZqXjRVi.d.ts → production-runtime-DrEy8kBO.d.ts} +1 -1
- package/dist/{request-7V0GaZK_.d.mts → request-B2PpOxYK.d.mts} +1 -1
- package/dist/{request-B5XYBv5a.d.ts → request-D40lt6aN.d.ts} +1 -1
- package/dist/request.d.mts +3 -2
- package/dist/request.d.ts +3 -2
- package/dist/routes.d.mts +2 -1
- package/dist/routes.d.ts +2 -1
- package/dist/server-plugins.d.mts +3 -2
- package/dist/server-plugins.d.ts +3 -2
- package/dist/server.cjs +490 -167
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +8 -6
- package/dist/server.d.ts +8 -6
- package/dist/server.mjs +20 -11
- package/dist/server.mjs.map +1 -1
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/theme/client.cjs +115 -0
- package/dist/theme/client.cjs.map +1 -0
- package/dist/theme/client.d.mts +17 -0
- package/dist/theme/client.d.ts +17 -0
- package/dist/theme/client.mjs +16 -0
- package/dist/theme/client.mjs.map +1 -0
- package/dist/theme/index.cjs +71 -0
- package/dist/theme/index.cjs.map +1 -0
- package/dist/theme/index.d.mts +6 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/index.mjs +9 -0
- package/dist/theme/index.mjs.map +1 -0
- package/dist/theme/server.cjs +191 -0
- package/dist/theme/server.cjs.map +1 -0
- package/dist/theme/server.d.mts +8 -0
- package/dist/theme/server.d.ts +8 -0
- package/dist/theme/server.mjs +18 -0
- package/dist/theme/server.mjs.map +1 -0
- package/dist/types-CsR8fpgF.d.mts +30 -0
- package/dist/types-CsR8fpgF.d.ts +30 -0
- package/dist/{utils-xTFxzu47.d.ts → utils-3sQgfkya.d.ts} +1 -1
- package/dist/{utils-s9pN0Yep.d.mts → utils-Bop7bly-.d.mts} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +485 -157
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +2 -1
- package/dist/vite.d.ts +2 -1
- package/dist/vite.mjs +11 -8
- package/package.json +25 -1
- package/dist/chunk-CEVMYGDL.mjs.map +0 -1
- package/dist/chunk-DAUR3WUZ.mjs.map +0 -1
- package/dist/chunk-FRPWCMMG.mjs.map +0 -1
- package/dist/chunk-XBKXKJX5.mjs.map +0 -1
- package/dist/chunk-ZP73P4VR.mjs.map +0 -1
- /package/dist/{chunk-LLPN5SEZ.mjs.map → chunk-DVPRBMU2.mjs.map} +0 -0
- /package/dist/{chunk-UCYWGN2P.mjs.map → chunk-OHNSROHS.mjs.map} +0 -0
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
APITypeGenerator
|
|
3
3
|
} from "./chunk-LGHEOHBU.mjs";
|
|
4
|
-
import {
|
|
5
|
-
addMetadataImageReference,
|
|
6
|
-
mergeMetadata,
|
|
7
|
-
renderMetadataHead
|
|
8
|
-
} from "./chunk-FRPWCMMG.mjs";
|
|
9
4
|
import {
|
|
10
5
|
createFarmMetadataImageResponse
|
|
11
6
|
} from "./chunk-53MVSX3R.mjs";
|
|
12
|
-
import {
|
|
13
|
-
resolveFarmLayoutFonts
|
|
14
|
-
} from "./chunk-6ZXIQSXE.mjs";
|
|
15
|
-
import {
|
|
16
|
-
farmEnvironmentFunctionsPlugin
|
|
17
|
-
} from "./chunk-V6WE6JSZ.mjs";
|
|
18
7
|
import {
|
|
19
8
|
createFarmImageHandler
|
|
20
9
|
} from "./chunk-3XNTL3FQ.mjs";
|
|
10
|
+
import {
|
|
11
|
+
addMetadataImageReference,
|
|
12
|
+
createFarmThemeDocumentParts,
|
|
13
|
+
mergeMetadata,
|
|
14
|
+
renderMetadataHead
|
|
15
|
+
} from "./chunk-SBWOTAX4.mjs";
|
|
21
16
|
import {
|
|
22
17
|
createEnvTypeDeclarations,
|
|
23
18
|
generateEnvTypes
|
|
@@ -25,11 +20,21 @@ import {
|
|
|
25
20
|
import {
|
|
26
21
|
writeFileIfChanged
|
|
27
22
|
} from "./chunk-USWZZUEH.mjs";
|
|
23
|
+
import {
|
|
24
|
+
resolveFarmLayoutFonts
|
|
25
|
+
} from "./chunk-6ZXIQSXE.mjs";
|
|
26
|
+
import {
|
|
27
|
+
farmEnvironmentFunctionsPlugin
|
|
28
|
+
} from "./chunk-V6WE6JSZ.mjs";
|
|
28
29
|
import {
|
|
29
30
|
getFarmRedirectError,
|
|
30
31
|
isFarmNotFoundError,
|
|
31
32
|
isFarmRedirectError
|
|
32
33
|
} from "./chunk-7HO6AEOP.mjs";
|
|
34
|
+
import {
|
|
35
|
+
_setDefaultFarmThemeConfig,
|
|
36
|
+
getTheme
|
|
37
|
+
} from "./chunk-4IVNW5QD.mjs";
|
|
33
38
|
import {
|
|
34
39
|
resolveFarmDocsFontAssets,
|
|
35
40
|
toFarmDocsPublicFontAssets
|
|
@@ -51,16 +56,25 @@ import {
|
|
|
51
56
|
getFarmLayerAliases,
|
|
52
57
|
getFarmSourceRoots
|
|
53
58
|
} from "./chunk-74YTBPTY.mjs";
|
|
54
|
-
import {
|
|
55
|
-
resolveFarmPerformanceConfig
|
|
56
|
-
} from "./chunk-7ZVN3YZI.mjs";
|
|
57
59
|
import {
|
|
58
60
|
getPublicFarmImageConfig,
|
|
59
61
|
resolveFarmImageConfig
|
|
60
62
|
} from "./chunk-GY2STC2S.mjs";
|
|
63
|
+
import {
|
|
64
|
+
resolveFarmPerformanceConfig
|
|
65
|
+
} from "./chunk-7ZVN3YZI.mjs";
|
|
66
|
+
import {
|
|
67
|
+
resolveWorkflowsConfig
|
|
68
|
+
} from "./chunk-4E6VRJ6P.mjs";
|
|
69
|
+
import {
|
|
70
|
+
resolveCronConfig
|
|
71
|
+
} from "./chunk-GXASWWJU.mjs";
|
|
61
72
|
import {
|
|
62
73
|
resolveServerActionsConfig
|
|
63
74
|
} from "./chunk-WORFTBLU.mjs";
|
|
75
|
+
import {
|
|
76
|
+
resolveFarmThemeConfig
|
|
77
|
+
} from "./chunk-H53KVQUU.mjs";
|
|
64
78
|
import {
|
|
65
79
|
createFarmMarkdownRouteModuleFromFile,
|
|
66
80
|
createFarmMarkdownSourceResponse,
|
|
@@ -73,12 +87,6 @@ import {
|
|
|
73
87
|
resolveMarkdownConfig,
|
|
74
88
|
resolveMarkdownMirrorTarget
|
|
75
89
|
} from "./chunk-7FBJLMQH.mjs";
|
|
76
|
-
import {
|
|
77
|
-
resolveWorkflowsConfig
|
|
78
|
-
} from "./chunk-4E6VRJ6P.mjs";
|
|
79
|
-
import {
|
|
80
|
-
resolveCronConfig
|
|
81
|
-
} from "./chunk-GXASWWJU.mjs";
|
|
82
90
|
import {
|
|
83
91
|
dispatchIntegrationRequest,
|
|
84
92
|
getFarmIntegrationPluginOwner,
|
|
@@ -170,7 +178,7 @@ import {
|
|
|
170
178
|
} from "./chunk-RHIFZZUI.mjs";
|
|
171
179
|
import {
|
|
172
180
|
FARM_VERSION
|
|
173
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-WO466YX5.mjs";
|
|
174
182
|
import {
|
|
175
183
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
176
184
|
createFarmDeploymentCookie,
|
|
@@ -1106,6 +1114,37 @@ function stripUseClientDirective(content) {
|
|
|
1106
1114
|
return content.replace(/^\s*(["'])use client\1\s*;?\s*/, "");
|
|
1107
1115
|
}
|
|
1108
1116
|
__name(stripUseClientDirective, "stripUseClientDirective");
|
|
1117
|
+
function hasAsyncDefaultExport(content) {
|
|
1118
|
+
if (!content) return false;
|
|
1119
|
+
const tokens = tokenizeModuleSource(content);
|
|
1120
|
+
for (let index = 0; index < tokens.length - 2; index++) {
|
|
1121
|
+
const token = tokens[index];
|
|
1122
|
+
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
1123
|
+
if (tokens[index - 1]?.value === ".") continue;
|
|
1124
|
+
if (tokens[index + 1]?.value !== "default") continue;
|
|
1125
|
+
const exported = tokens[index + 2];
|
|
1126
|
+
if (exported.kind === "identifier" && exported.value === "async") {
|
|
1127
|
+
return true;
|
|
1128
|
+
}
|
|
1129
|
+
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && tokens[index + 3]?.value !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
|
|
1130
|
+
return true;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
__name(hasAsyncDefaultExport, "hasAsyncDefaultExport");
|
|
1136
|
+
function isAsyncLocalDeclaration(tokens, name) {
|
|
1137
|
+
for (let index = 0; index < tokens.length - 2; index++) {
|
|
1138
|
+
if (tokens[index].value === "async" && tokens[index + 1]?.value === "function" && tokens[index + 2]?.value === name) {
|
|
1139
|
+
return true;
|
|
1140
|
+
}
|
|
1141
|
+
if (tokens[index].value === name && tokens[index + 1]?.value === "=" && tokens[index + 2]?.value === "async") {
|
|
1142
|
+
return true;
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
return false;
|
|
1146
|
+
}
|
|
1147
|
+
__name(isAsyncLocalDeclaration, "isAsyncLocalDeclaration");
|
|
1109
1148
|
function parseClientModuleMetadata(content, inspectIslandExport) {
|
|
1110
1149
|
if (!content) {
|
|
1111
1150
|
return {
|
|
@@ -1161,6 +1200,14 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
1161
1200
|
}
|
|
1162
1201
|
}
|
|
1163
1202
|
const shouldHydrate = parsed.hasHydrateExport || importsClientBoundary;
|
|
1203
|
+
if (shouldHydrate && hasAsyncDefaultExport(content)) {
|
|
1204
|
+
return {
|
|
1205
|
+
isClientComponent: false,
|
|
1206
|
+
shouldHydrate: false,
|
|
1207
|
+
islandStrategy: null,
|
|
1208
|
+
suppressedAsyncHydration: true
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1164
1211
|
return {
|
|
1165
1212
|
isClientComponent: false,
|
|
1166
1213
|
shouldHydrate,
|
|
@@ -1798,6 +1845,7 @@ var _RouteManager = class _RouteManager {
|
|
|
1798
1845
|
shouldHydrate: metadata.shouldHydrate,
|
|
1799
1846
|
isClientComponent: metadata.isClientComponent,
|
|
1800
1847
|
islandStrategy: metadata.islandStrategy,
|
|
1848
|
+
suppressedAsyncHydration: metadata.suppressedAsyncHydration,
|
|
1801
1849
|
search: getProgrammaticRouteSearchClientOptions(programmaticPage?.search),
|
|
1802
1850
|
segments: entry.route.segments.map((seg) => ({
|
|
1803
1851
|
segment: seg.segment,
|
|
@@ -3631,6 +3679,15 @@ __name(DefaultNotFoundPage, "DefaultNotFoundPage");
|
|
|
3631
3679
|
// src/server/renderer.ts
|
|
3632
3680
|
var cachedClerkProvider = null;
|
|
3633
3681
|
var importRuntimeModule = new Function("specifier", "return import(specifier);");
|
|
3682
|
+
var warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
|
|
3683
|
+
function warnSuppressedAsyncHydrationOnce(modulePath) {
|
|
3684
|
+
if (warnedSuppressedAsyncHydrationModules.has(modulePath)) return;
|
|
3685
|
+
warnedSuppressedAsyncHydrationModules.add(modulePath);
|
|
3686
|
+
logger.warn(
|
|
3687
|
+
`${modulePath} is an async server component that imports client components. React cannot hydrate async components in the browser, so this route stays server-rendered and its client imports are not interactive. Move the interactive UI into a "use client" child rendered by a synchronous page, or enable experimental server components support.`
|
|
3688
|
+
);
|
|
3689
|
+
}
|
|
3690
|
+
__name(warnSuppressedAsyncHydrationOnce, "warnSuppressedAsyncHydrationOnce");
|
|
3634
3691
|
function hasRequestHeader(req, name) {
|
|
3635
3692
|
const value = req.headers[name.toLowerCase()];
|
|
3636
3693
|
return Array.isArray(value) ? value.length > 0 : Boolean(value);
|
|
@@ -4305,6 +4362,9 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4305
4362
|
})
|
|
4306
4363
|
);
|
|
4307
4364
|
const shouldHydrate = moduleMetadata.shouldHydrate;
|
|
4365
|
+
if (moduleMetadata.suppressedAsyncHydration) {
|
|
4366
|
+
warnSuppressedAsyncHydrationOnce(route.modulePath);
|
|
4367
|
+
}
|
|
4308
4368
|
const layoutHydrationMetadata = layouts.map((layout) => {
|
|
4309
4369
|
const manifestEntry = routeManifest.layouts.find(
|
|
4310
4370
|
(entry) => entry.pattern === layout.pattern
|
|
@@ -4802,7 +4862,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4802
4862
|
}
|
|
4803
4863
|
}
|
|
4804
4864
|
async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
|
|
4805
|
-
return new Promise((
|
|
4865
|
+
return new Promise((resolve6, reject) => {
|
|
4806
4866
|
const streamStartTime = Date.now();
|
|
4807
4867
|
const observabilityRoute = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
4808
4868
|
const deploymentId = this.getDeploymentId();
|
|
@@ -4905,6 +4965,11 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
|
|
|
4905
4965
|
const i18nSnapshot = getFarmI18nClientSnapshot();
|
|
4906
4966
|
const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(req.__FARM_ROUTE__ || req.url || "/", i18nSnapshot) : "";
|
|
4907
4967
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
4968
|
+
const themeDocument = createFarmThemeDocumentParts(
|
|
4969
|
+
this.config.theme,
|
|
4970
|
+
this.config.basePath,
|
|
4971
|
+
getTheme()
|
|
4972
|
+
);
|
|
4908
4973
|
const streamRoot = React.createElement("div", { style: { display: "contents" } }, element);
|
|
4909
4974
|
const { pipe } = renderToPipeableStream(streamRoot, {
|
|
4910
4975
|
onShellReady() {
|
|
@@ -4918,8 +4983,9 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
|
|
|
4918
4983
|
console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
|
|
4919
4984
|
}
|
|
4920
4985
|
const shell = `<!DOCTYPE html>
|
|
4921
|
-
<html lang="${escapeHtmlAttribute2(i18nSnapshot?.locale || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
|
|
4986
|
+
<html lang="${escapeHtmlAttribute2(i18nSnapshot?.locale || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
4922
4987
|
<head>
|
|
4988
|
+
${themeDocument.head}
|
|
4923
4989
|
<meta charset="utf-8">
|
|
4924
4990
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
4925
4991
|
<meta name="farm-deployment-id" content="${escapeHtmlAttribute2(deploymentId)}">
|
|
@@ -4996,7 +5062,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
|
|
|
4996
5062
|
route: observabilityRoute,
|
|
4997
5063
|
durationMs: Date.now() - streamStartTime
|
|
4998
5064
|
});
|
|
4999
|
-
|
|
5065
|
+
resolve6();
|
|
5000
5066
|
}
|
|
5001
5067
|
});
|
|
5002
5068
|
res.write(shell);
|
|
@@ -5127,9 +5193,15 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
|
|
|
5127
5193
|
</script>`;
|
|
5128
5194
|
const alternateLinks = i18nSnapshot ? renderI18nAlternateLinks(requestPath, i18nSnapshot) : "";
|
|
5129
5195
|
const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
|
|
5196
|
+
const themeDocument = createFarmThemeDocumentParts(
|
|
5197
|
+
this.config.theme,
|
|
5198
|
+
this.config.basePath,
|
|
5199
|
+
getTheme()
|
|
5200
|
+
);
|
|
5130
5201
|
return `<!DOCTYPE html>
|
|
5131
|
-
<html lang="${escapeHtmlAttribute2(i18nSnapshot?.locale || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
|
|
5202
|
+
<html lang="${escapeHtmlAttribute2(i18nSnapshot?.locale || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
5132
5203
|
<head>
|
|
5204
|
+
${themeDocument.head}
|
|
5133
5205
|
<meta charset="utf-8">
|
|
5134
5206
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5135
5207
|
<meta name="farm-deployment-id" content="${escapeHtmlAttribute2(this.getDeploymentId())}">
|
|
@@ -5184,6 +5256,7 @@ var _FarmApp = class _FarmApp {
|
|
|
5184
5256
|
constructor(config = {}, viteServer) {
|
|
5185
5257
|
this.config = this.normalizeConfig(config);
|
|
5186
5258
|
configureFarmObservability(this.config.observability);
|
|
5259
|
+
_setDefaultFarmThemeConfig(this.config.theme);
|
|
5187
5260
|
this.i18nRuntime = createFarmI18nRuntime(this.config.i18n);
|
|
5188
5261
|
_setDefaultFarmI18nRuntime(this.i18nRuntime);
|
|
5189
5262
|
this.viteServer = viteServer;
|
|
@@ -5242,6 +5315,7 @@ var _FarmApp = class _FarmApp {
|
|
|
5242
5315
|
security: resolveFarmSecurityConfig(config.security),
|
|
5243
5316
|
images: resolveFarmImageConfig(config.images),
|
|
5244
5317
|
performance: resolveFarmPerformanceConfig(config.performance),
|
|
5318
|
+
theme: resolveFarmThemeConfig(config.theme, config.basePath || "/"),
|
|
5245
5319
|
i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : resolveFarmI18nConfig(config.i18n, {
|
|
5246
5320
|
root,
|
|
5247
5321
|
mode: process.env.NODE_ENV === "production" ? "production" : "development"
|
|
@@ -6007,12 +6081,40 @@ function collectLegacyTypeArtifacts(root, srcDir, stalePaths) {
|
|
|
6007
6081
|
__name(collectLegacyTypeArtifacts, "collectLegacyTypeArtifacts");
|
|
6008
6082
|
|
|
6009
6083
|
// src/vite.ts
|
|
6084
|
+
import * as fs5 from "fs";
|
|
6085
|
+
import * as path12 from "path";
|
|
6086
|
+
|
|
6087
|
+
// src/dev-static.ts
|
|
6010
6088
|
import * as fs4 from "fs";
|
|
6011
|
-
import * as
|
|
6089
|
+
import * as path9 from "path";
|
|
6090
|
+
function devServableFileExists(pathname, baseDirs) {
|
|
6091
|
+
let decodedPathname;
|
|
6092
|
+
try {
|
|
6093
|
+
decodedPathname = decodeURIComponent(pathname);
|
|
6094
|
+
} catch {
|
|
6095
|
+
return false;
|
|
6096
|
+
}
|
|
6097
|
+
const relativePathname = decodedPathname.replace(/^\/+/, "");
|
|
6098
|
+
if (!relativePathname) return false;
|
|
6099
|
+
for (const baseDir of baseDirs) {
|
|
6100
|
+
if (typeof baseDir !== "string" || baseDir.length === 0) continue;
|
|
6101
|
+
const resolvedBase = path9.resolve(baseDir);
|
|
6102
|
+
const candidate = path9.resolve(resolvedBase, relativePathname);
|
|
6103
|
+
if (!candidate.startsWith(resolvedBase + path9.sep)) continue;
|
|
6104
|
+
try {
|
|
6105
|
+
if (fs4.existsSync(candidate) && fs4.statSync(candidate).isFile()) {
|
|
6106
|
+
return true;
|
|
6107
|
+
}
|
|
6108
|
+
} catch {
|
|
6109
|
+
}
|
|
6110
|
+
}
|
|
6111
|
+
return false;
|
|
6112
|
+
}
|
|
6113
|
+
__name(devServableFileExists, "devServableFileExists");
|
|
6012
6114
|
|
|
6013
6115
|
// src/image-vite.ts
|
|
6014
6116
|
import { readFile as readFile4 } from "fs/promises";
|
|
6015
|
-
import
|
|
6117
|
+
import path10 from "path";
|
|
6016
6118
|
import { imageSize as imageSize2 } from "image-size";
|
|
6017
6119
|
var FARM_IMAGE_ID_PREFIX = "\0farm:image:";
|
|
6018
6120
|
var STATIC_IMAGE_RE = /\.(?:avif|gif|jpe?g|png|webp)$/i;
|
|
@@ -6080,7 +6182,7 @@ async function createBlurDataURL(bytes) {
|
|
|
6080
6182
|
__name(createBlurDataURL, "createBlurDataURL");
|
|
6081
6183
|
|
|
6082
6184
|
// src/server/vite-config.ts
|
|
6083
|
-
import
|
|
6185
|
+
import path11 from "path";
|
|
6084
6186
|
var FARM_CLIENT_ENTRY_PATTERN = "**/{page,layout,loading,error,not-found,default}.{js,jsx,ts,tsx}";
|
|
6085
6187
|
var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
6086
6188
|
"react",
|
|
@@ -6098,9 +6200,9 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
|
6098
6200
|
"@farm.js/core/server-query/client"
|
|
6099
6201
|
];
|
|
6100
6202
|
function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
|
|
6101
|
-
const resolvedProjectRoot =
|
|
6203
|
+
const resolvedProjectRoot = path11.resolve(projectRoot);
|
|
6102
6204
|
return appDirectories.map((appDirectory) => {
|
|
6103
|
-
const relativeAppDirectory =
|
|
6205
|
+
const relativeAppDirectory = path11.relative(resolvedProjectRoot, path11.resolve(appDirectory)).replace(/\\/g, "/");
|
|
6104
6206
|
const prefix = relativeAppDirectory || ".";
|
|
6105
6207
|
return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
|
|
6106
6208
|
});
|
|
@@ -6124,7 +6226,7 @@ function createFarmClientOptimizeDepsConfig(entries) {
|
|
|
6124
6226
|
__name(createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
|
|
6125
6227
|
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
6126
6228
|
return {
|
|
6127
|
-
"@":
|
|
6229
|
+
"@": path11.resolve(projectRoot, srcDir)
|
|
6128
6230
|
};
|
|
6129
6231
|
}
|
|
6130
6232
|
__name(createFarmSourceAlias, "createFarmSourceAlias");
|
|
@@ -6193,6 +6295,29 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
|
|
|
6193
6295
|
}
|
|
6194
6296
|
__name(mergeFarmViteConfig, "mergeFarmViteConfig");
|
|
6195
6297
|
|
|
6298
|
+
// src/theme/vite.ts
|
|
6299
|
+
var FARM_DARK_VARIANT = '@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));';
|
|
6300
|
+
function createFarmThemeCssPlugin(input, basePath = "/") {
|
|
6301
|
+
const config = resolveFarmThemeConfig(input, basePath);
|
|
6302
|
+
return {
|
|
6303
|
+
name: "farm:theme-css",
|
|
6304
|
+
enforce: "pre",
|
|
6305
|
+
transform(code, id) {
|
|
6306
|
+
if (!config.enabled || !/\.css(?:\?.*)?$/.test(id) || !/@import\s+["']tailwindcss["']/.test(code) || /@custom-variant\s+dark\b/.test(code)) {
|
|
6307
|
+
return null;
|
|
6308
|
+
}
|
|
6309
|
+
return {
|
|
6310
|
+
code: `${code.trimEnd()}
|
|
6311
|
+
|
|
6312
|
+
${FARM_DARK_VARIANT}
|
|
6313
|
+
`,
|
|
6314
|
+
map: null
|
|
6315
|
+
};
|
|
6316
|
+
}
|
|
6317
|
+
};
|
|
6318
|
+
}
|
|
6319
|
+
__name(createFarmThemeCssPlugin, "createFarmThemeCssPlugin");
|
|
6320
|
+
|
|
6196
6321
|
// src/vite.ts
|
|
6197
6322
|
var ALL_TYPE_ARTIFACTS = {
|
|
6198
6323
|
routes: true,
|
|
@@ -6235,7 +6360,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
6235
6360
|
}
|
|
6236
6361
|
__name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
6237
6362
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
6238
|
-
return import("./devtools-
|
|
6363
|
+
return import("./devtools-326RBQCN.mjs");
|
|
6239
6364
|
}
|
|
6240
6365
|
__name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
6241
6366
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -6409,11 +6534,11 @@ function isPotentialProgrammaticRouteSourceFile(normalizedFile, srcDirSlug) {
|
|
|
6409
6534
|
}
|
|
6410
6535
|
__name(isPotentialProgrammaticRouteSourceFile, "isPotentialProgrammaticRouteSourceFile");
|
|
6411
6536
|
function fileContainsProgrammaticPageRoute(file) {
|
|
6412
|
-
if (!
|
|
6537
|
+
if (!fs5.existsSync(file)) {
|
|
6413
6538
|
return false;
|
|
6414
6539
|
}
|
|
6415
6540
|
try {
|
|
6416
|
-
return scanProgrammaticPagePaths(
|
|
6541
|
+
return scanProgrammaticPagePaths(fs5.readFileSync(file, "utf8")).length > 0;
|
|
6417
6542
|
} catch {
|
|
6418
6543
|
return false;
|
|
6419
6544
|
}
|
|
@@ -6421,7 +6546,7 @@ function fileContainsProgrammaticPageRoute(file) {
|
|
|
6421
6546
|
__name(fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
|
|
6422
6547
|
function rewriteEarlySsrRelativeImports(options) {
|
|
6423
6548
|
const cleanId = options.id.split("?", 1)[0];
|
|
6424
|
-
if (!
|
|
6549
|
+
if (!path12.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
|
|
6425
6550
|
return null;
|
|
6426
6551
|
}
|
|
6427
6552
|
const replacements = [];
|
|
@@ -6441,7 +6566,7 @@ function rewriteEarlySsrRelativeImports(options) {
|
|
|
6441
6566
|
const suffixIndex = source.value.search(/[?#]/);
|
|
6442
6567
|
const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
|
|
6443
6568
|
const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
|
|
6444
|
-
const resolvedPath =
|
|
6569
|
+
const resolvedPath = path12.resolve(path12.dirname(cleanId), sourcePath);
|
|
6445
6570
|
replacements.push({
|
|
6446
6571
|
start: source.start,
|
|
6447
6572
|
end: source.end,
|
|
@@ -6520,7 +6645,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
6520
6645
|
...layerRoots.length ? {
|
|
6521
6646
|
server: {
|
|
6522
6647
|
fs: {
|
|
6523
|
-
allow: [
|
|
6648
|
+
allow: [path12.resolve(options.root || process.cwd()), ...layerRoots]
|
|
6524
6649
|
}
|
|
6525
6650
|
}
|
|
6526
6651
|
} : {}
|
|
@@ -6551,13 +6676,13 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
6551
6676
|
},
|
|
6552
6677
|
server
|
|
6553
6678
|
);
|
|
6554
|
-
const globalsCSSPath =
|
|
6555
|
-
if (!
|
|
6556
|
-
const appDir =
|
|
6557
|
-
if (!
|
|
6558
|
-
|
|
6679
|
+
const globalsCSSPath = path12.join(server.config.root, "src/app/globals.css");
|
|
6680
|
+
if (!fs5.existsSync(globalsCSSPath)) {
|
|
6681
|
+
const appDir = path12.join(server.config.root, "src/app");
|
|
6682
|
+
if (!fs5.existsSync(appDir)) {
|
|
6683
|
+
fs5.mkdirSync(appDir, { recursive: true });
|
|
6559
6684
|
}
|
|
6560
|
-
|
|
6685
|
+
fs5.writeFileSync(globalsCSSPath, defaultGlobalCSS);
|
|
6561
6686
|
}
|
|
6562
6687
|
await farmApp.initialize();
|
|
6563
6688
|
const farmConfig = farmApp.getConfig();
|
|
@@ -6576,10 +6701,10 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
6576
6701
|
});
|
|
6577
6702
|
}
|
|
6578
6703
|
const sourceRoots = getFarmSourceRoots(farmConfig);
|
|
6579
|
-
server.watcher.add(sourceRoots.map((source) =>
|
|
6704
|
+
server.watcher.add(sourceRoots.map((source) => path12.join(source.root, source.srcDir)));
|
|
6580
6705
|
if (farmConfig.i18n.enabled) {
|
|
6581
6706
|
server.watcher.add(
|
|
6582
|
-
farmConfig.i18n.messages.includes("{locale}") ?
|
|
6707
|
+
farmConfig.i18n.messages.includes("{locale}") ? path12.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
|
|
6583
6708
|
);
|
|
6584
6709
|
}
|
|
6585
6710
|
const workflowConfig = farmConfig.workflows;
|
|
@@ -6589,7 +6714,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
6589
6714
|
...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
|
|
6590
6715
|
], "getExtraRouteTypes");
|
|
6591
6716
|
const appDirSlugs = sourceRoots.map(
|
|
6592
|
-
(source) =>
|
|
6717
|
+
(source) => path12.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
|
|
6593
6718
|
);
|
|
6594
6719
|
const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
|
|
6595
6720
|
try {
|
|
@@ -6629,7 +6754,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
6629
6754
|
}, "generateTypeArtifacts");
|
|
6630
6755
|
await generateTypeArtifacts("startup");
|
|
6631
6756
|
const srcDirSlugs = sourceRoots.map(
|
|
6632
|
-
(source) =>
|
|
6757
|
+
(source) => path12.join(source.root, source.srcDir).replace(/\\/g, "/")
|
|
6633
6758
|
);
|
|
6634
6759
|
const layerConfigFiles = new Set(
|
|
6635
6760
|
farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
|
|
@@ -6747,7 +6872,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
6747
6872
|
await apiRouteManager.discoverRoutes();
|
|
6748
6873
|
let discoveredWorkflows = [];
|
|
6749
6874
|
const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
|
|
6750
|
-
(dir) =>
|
|
6875
|
+
(dir) => fs5.existsSync(path12.isAbsolute(dir) ? dir : path12.join(farmConfig.root, dir))
|
|
6751
6876
|
);
|
|
6752
6877
|
if (hasWorkflowDirectory) {
|
|
6753
6878
|
const { createFarmWorkflowRequestHandler, discoverFarmWorkflows } = await loadFarmWorkflowsDevRuntime();
|
|
@@ -6981,12 +7106,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
6981
7106
|
}
|
|
6982
7107
|
}
|
|
6983
7108
|
const farmDocsFontPath = farmDocsFontAssets.get(requestPathname);
|
|
6984
|
-
if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath &&
|
|
7109
|
+
if ((requestMethod === "GET" || requestMethod === "HEAD") && farmDocsFontPath && fs5.existsSync(farmDocsFontPath)) {
|
|
6985
7110
|
res.statusCode = 200;
|
|
6986
7111
|
res.setHeader("Content-Type", "font/woff2");
|
|
6987
7112
|
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
|
|
6988
7113
|
if (requestMethod === "HEAD") res.end();
|
|
6989
|
-
else
|
|
7114
|
+
else fs5.createReadStream(farmDocsFontPath).pipe(res);
|
|
6990
7115
|
return;
|
|
6991
7116
|
}
|
|
6992
7117
|
if (requestMethod === "GET" && (requestPathname === FARM_DEVTOOLS_PATH || requestPathname === `${FARM_DEVTOOLS_PATH}.json`)) {
|
|
@@ -7084,7 +7209,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
7084
7209
|
return null;
|
|
7085
7210
|
}
|
|
7086
7211
|
return {
|
|
7087
|
-
source: await
|
|
7212
|
+
source: await fs5.promises.readFile(sourcePath, "utf8"),
|
|
7088
7213
|
filePath: sourcePath
|
|
7089
7214
|
};
|
|
7090
7215
|
}, "resolveSource")
|
|
@@ -7419,9 +7544,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
7419
7544
|
res.end(JSON.stringify({ error: "API route not found", pathname: pathname2 }));
|
|
7420
7545
|
return;
|
|
7421
7546
|
}
|
|
7422
|
-
if (req.url?.startsWith("/@") || req.url?.startsWith("/node_modules")
|
|
7547
|
+
if (req.url?.startsWith("/@") || req.url?.startsWith("/node_modules")) {
|
|
7423
7548
|
return next();
|
|
7424
7549
|
}
|
|
7550
|
+
if (requestPathname.includes(".") && !requestPathname.endsWith(".html")) {
|
|
7551
|
+
const matchesAppRoute = Boolean(
|
|
7552
|
+
farmApp?.getRouteManager()?.matchRoute(requestPathname)?.route
|
|
7553
|
+
);
|
|
7554
|
+
if (!matchesAppRoute || devServableFileExists(requestPathname, [server.config.publicDir, server.config.root])) {
|
|
7555
|
+
return next();
|
|
7556
|
+
}
|
|
7557
|
+
}
|
|
7425
7558
|
if (req.url?.startsWith("/__farm/page-data")) {
|
|
7426
7559
|
const urlObj = new URL(req.url, `http://${req.headers.host || "localhost:3000"}`);
|
|
7427
7560
|
const targetPath = urlObj.searchParams.get("path") || "/";
|
|
@@ -8127,8 +8260,8 @@ if (import.meta.hot) {
|
|
|
8127
8260
|
}
|
|
8128
8261
|
logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
|
|
8129
8262
|
logger.info("Pre-rendering SSG pages...");
|
|
8130
|
-
const outDir =
|
|
8131
|
-
const clientDir =
|
|
8263
|
+
const outDir = path12.join(server?.config.root || process.cwd(), options.outDir || "dist");
|
|
8264
|
+
const clientDir = path12.join(outDir, "client");
|
|
8132
8265
|
for (const page of ssgPages) {
|
|
8133
8266
|
try {
|
|
8134
8267
|
const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
|
|
@@ -8180,9 +8313,9 @@ if (import.meta.hot) {
|
|
|
8180
8313
|
<script type="module" src="/assets/client.js"></script>
|
|
8181
8314
|
</body>
|
|
8182
8315
|
</html>`;
|
|
8183
|
-
const outputPath = page.urlPath === "/" ?
|
|
8184
|
-
|
|
8185
|
-
|
|
8316
|
+
const outputPath = page.urlPath === "/" ? path12.join(clientDir, "index.html") : path12.join(clientDir, page.urlPath + ".html");
|
|
8317
|
+
fs5.mkdirSync(path12.dirname(outputPath), { recursive: true });
|
|
8318
|
+
fs5.writeFileSync(outputPath, fullHtml);
|
|
8186
8319
|
const revalidateInfo = page.revalidate ? ` (revalidate: ${page.revalidate}s)` : "";
|
|
8187
8320
|
logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
|
|
8188
8321
|
});
|
|
@@ -8190,8 +8323,8 @@ if (import.meta.hot) {
|
|
|
8190
8323
|
logger.error(` \u2717 ${page.urlPath}: ${error}`);
|
|
8191
8324
|
}
|
|
8192
8325
|
}
|
|
8193
|
-
const manifestPath =
|
|
8194
|
-
|
|
8326
|
+
const manifestPath = path12.join(outDir, "__ssg_manifest.json");
|
|
8327
|
+
fs5.writeFileSync(
|
|
8195
8328
|
manifestPath,
|
|
8196
8329
|
JSON.stringify(
|
|
8197
8330
|
ssgPages.map((p) => ({
|
|
@@ -8226,9 +8359,9 @@ if (import.meta.hot) {
|
|
|
8226
8359
|
}
|
|
8227
8360
|
const currentFarmConfig = farmApp?.getConfig();
|
|
8228
8361
|
const normalizedFile = file.replace(/\\/g, "/");
|
|
8229
|
-
const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) =>
|
|
8362
|
+
const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path12.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
|
|
8230
8363
|
if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
|
|
8231
|
-
logUpdate("PAGE", `updated ${
|
|
8364
|
+
logUpdate("PAGE", `updated ${path12.basename(file)}`);
|
|
8232
8365
|
for (const mod of modules) {
|
|
8233
8366
|
server2.moduleGraph.invalidateModule(mod);
|
|
8234
8367
|
}
|
|
@@ -9414,6 +9547,19 @@ async function tryHydrateImportedPage(
|
|
|
9414
9547
|
const PageComponent = pageModule?.default;
|
|
9415
9548
|
if (!PageComponent) return false;
|
|
9416
9549
|
|
|
9550
|
+
if (
|
|
9551
|
+
typeof PageComponent === 'function' &&
|
|
9552
|
+
PageComponent.constructor &&
|
|
9553
|
+
PageComponent.constructor.name === 'AsyncFunction'
|
|
9554
|
+
) {
|
|
9555
|
+
console.warn(
|
|
9556
|
+
'[Farm.js] Skipping hydration for ' + modulePath +
|
|
9557
|
+
': async server components cannot run in the browser. ' +
|
|
9558
|
+
'Server-rendered HTML is preserved; move interactive UI into a "use client" child of a synchronous page.'
|
|
9559
|
+
);
|
|
9560
|
+
return false;
|
|
9561
|
+
}
|
|
9562
|
+
|
|
9417
9563
|
currentPageComponent = PageComponent;
|
|
9418
9564
|
currentPageProps = await buildRouteComponentProps(
|
|
9419
9565
|
pageModule,
|
|
@@ -9580,14 +9726,22 @@ async function renderPage(pageData) {
|
|
|
9580
9726
|
if (!doc.documentElement || !doc.body) return false;
|
|
9581
9727
|
|
|
9582
9728
|
resetReactRoots();
|
|
9729
|
+
const activeFarmTheme =
|
|
9730
|
+
window.__FARM_THEME__?.snapshot?.resolvedTheme ||
|
|
9731
|
+
document.documentElement.getAttribute('data-theme');
|
|
9583
9732
|
Array.from(document.documentElement.attributes).forEach(function(attr) {
|
|
9733
|
+
if (attr.name === 'data-theme') return;
|
|
9584
9734
|
if (!doc.documentElement.hasAttribute(attr.name)) {
|
|
9585
9735
|
document.documentElement.removeAttribute(attr.name);
|
|
9586
9736
|
}
|
|
9587
9737
|
});
|
|
9588
9738
|
Array.from(doc.documentElement.attributes).forEach(function(attr) {
|
|
9739
|
+
if (attr.name === 'data-theme') return;
|
|
9589
9740
|
document.documentElement.setAttribute(attr.name, attr.value);
|
|
9590
9741
|
});
|
|
9742
|
+
if (activeFarmTheme) {
|
|
9743
|
+
document.documentElement.setAttribute('data-theme', activeFarmTheme);
|
|
9744
|
+
}
|
|
9591
9745
|
|
|
9592
9746
|
document.head.innerHTML = doc.head ? doc.head.innerHTML : '';
|
|
9593
9747
|
document.body.innerHTML = doc.body.innerHTML;
|
|
@@ -9596,6 +9750,7 @@ async function renderPage(pageData) {
|
|
|
9596
9750
|
|
|
9597
9751
|
setTimeout(function() {
|
|
9598
9752
|
Array.from(document.querySelectorAll('script')).forEach(function(script) {
|
|
9753
|
+
if (script.id === 'farm-theme-script') return;
|
|
9599
9754
|
const freshScript = document.createElement('script');
|
|
9600
9755
|
Array.from(script.attributes).forEach(function(attr) {
|
|
9601
9756
|
freshScript.setAttribute(attr.name, attr.value);
|
|
@@ -9958,7 +10113,7 @@ function generateClientManifest(bundle) {
|
|
|
9958
10113
|
__name(generateClientManifest, "generateClientManifest");
|
|
9959
10114
|
async function defineConfig(config = {}) {
|
|
9960
10115
|
const tailwindcss = (await import("@tailwindcss/vite")).default;
|
|
9961
|
-
const appRoot =
|
|
10116
|
+
const appRoot = path12.resolve(config.root || process.cwd());
|
|
9962
10117
|
if (config.extends?.length) {
|
|
9963
10118
|
const { config: layeredConfig } = await import("./layers-VWVDTPUZ.mjs").then(
|
|
9964
10119
|
({ resolveFarmLayers }) => resolveFarmLayers(config, {
|
|
@@ -10093,6 +10248,7 @@ async function defineConfig(config = {}) {
|
|
|
10093
10248
|
};
|
|
10094
10249
|
return {
|
|
10095
10250
|
plugins: [
|
|
10251
|
+
createFarmThemeCssPlugin(config.theme, config.basePath),
|
|
10096
10252
|
tailwindcss(),
|
|
10097
10253
|
viteBrowserExternalPlugin,
|
|
10098
10254
|
farmI18nClientBridgePlugin(),
|
|
@@ -10196,9 +10352,10 @@ export {
|
|
|
10196
10352
|
createFarmClientOptimizeDepsConfig,
|
|
10197
10353
|
createFarmSourceAlias,
|
|
10198
10354
|
mergeFarmViteConfig,
|
|
10355
|
+
createFarmThemeCssPlugin,
|
|
10199
10356
|
farmI18nClientBridgePlugin,
|
|
10200
10357
|
rewriteEarlySsrRelativeImports,
|
|
10201
10358
|
farmPlugin,
|
|
10202
10359
|
defineConfig
|
|
10203
10360
|
};
|
|
10204
|
-
//# sourceMappingURL=chunk-
|
|
10361
|
+
//# sourceMappingURL=chunk-HVJHNKSP.mjs.map
|