@farm.js/core 0.1.21 → 0.1.23
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 +3 -2
- package/dist/agent-runtime.d.ts +3 -2
- package/dist/api/route-manager.cjs +3 -2
- package/dist/api/route-manager.d.mts +3 -2
- package/dist/api/route-manager.d.ts +3 -2
- package/dist/api/route-manager.mjs +2 -1
- package/dist/api.cjs +4 -3
- package/dist/api.d.mts +4 -3
- package/dist/api.d.ts +4 -3
- package/dist/api.mjs +3 -2
- package/dist/{app-DAyPE-gr.d.ts → app-BV-7wV5q.d.ts} +10 -3
- package/dist/{app-D_6nTit-.d.mts → app-BZDWwwFa.d.mts} +10 -3
- package/dist/app-markdown.d.mts +4 -3
- package/dist/app-markdown.d.ts +4 -3
- package/dist/chunk-2VQKKQ6D.mjs +51 -0
- package/dist/{chunk-EGJDUF4Q.mjs → chunk-3ATMYLLJ.mjs} +6 -12
- package/dist/{chunk-HSDL2AUR.mjs → chunk-47H7VENP.mjs} +20 -32
- package/dist/{chunk-RWXZKZXB.cjs → chunk-4DKZ6JR3.cjs} +302 -339
- package/dist/{chunk-PUCUVI7K.mjs → chunk-72VJRKJD.mjs} +1 -1
- package/dist/{chunk-5L6NBNHI.mjs → chunk-7LU4IOXQ.mjs} +156 -193
- package/dist/{chunk-RMIJFZU3.mjs → chunk-BDJNP7AQ.mjs} +10 -14
- package/dist/{chunk-OLYK7EAK.mjs → chunk-DAATZTKJ.mjs} +14 -0
- package/dist/{chunk-YP5JZ4LF.cjs → chunk-DNLQMFER.cjs} +15 -19
- package/dist/{chunk-XFFQSD2F.cjs → chunk-DW34V5SM.cjs} +7 -7
- package/dist/{chunk-PKO4FCTL.mjs → chunk-EHUZ2MKO.mjs} +1 -1
- package/dist/{chunk-3NM6SRI6.mjs → chunk-F3VB7ONA.mjs} +10 -8
- package/dist/{chunk-L7ARWZYT.cjs → chunk-III667SJ.cjs} +496 -303
- package/dist/chunk-IK6LVLKC.cjs +51 -0
- package/dist/{chunk-B3WK4DTX.cjs → chunk-IMBMOEWT.cjs} +5 -1
- package/dist/{chunk-IILNZK5G.mjs → chunk-JHWOVJ3M.mjs} +46 -62
- package/dist/{chunk-TKNSDBBN.cjs → chunk-K3F2E6GS.cjs} +20 -1
- package/dist/{chunk-RTHIVJ2G.cjs → chunk-KCMTCM6I.cjs} +7 -8
- package/dist/{chunk-ZE6ONQ5R.cjs → chunk-LQIRVSBY.cjs} +30 -40
- package/dist/chunk-LYLEZIG3.cjs +73 -0
- package/dist/{chunk-NBAHDVOJ.cjs → chunk-LYM7HY34.cjs} +20 -32
- package/dist/{chunk-K6FNHVDR.cjs → chunk-MPEYMSCF.cjs} +6 -12
- package/dist/{chunk-TFAXUHWX.cjs → chunk-PSV6XKPO.cjs} +15 -1
- package/dist/{chunk-BHJUZ64B.cjs → chunk-QTBEAKCJ.cjs} +7 -7
- package/dist/{chunk-J6JRB2ER.mjs → chunk-S67OYZU7.mjs} +1 -1
- package/dist/chunk-SFGWNC43.mjs +97 -0
- package/dist/{chunk-AYJR42WX.cjs → chunk-UFDV5N3C.cjs} +2 -2
- package/dist/chunk-UYIHRDE4.cjs +97 -0
- package/dist/{chunk-Y4YMF2NQ.cjs → chunk-VPTDD5XF.cjs} +46 -62
- package/dist/{chunk-53G3OLTA.mjs → chunk-VPY755R2.mjs} +256 -63
- package/dist/{chunk-NRS46D4L.mjs → chunk-VVJCWBIE.mjs} +3 -3
- package/dist/{chunk-Q2TUENW2.cjs → chunk-VXCA7RZP.cjs} +1 -1
- package/dist/{chunk-CQHFU55R.mjs → chunk-WNUBR4CA.mjs} +5 -1
- package/dist/{chunk-CIAGU2X4.cjs → chunk-XSIRSMAS.cjs} +10 -8
- package/dist/{chunk-W7MZXRXM.mjs → chunk-YGMK6ESJ.mjs} +20 -30
- package/dist/chunk-YOZYCI6Z.mjs +73 -0
- package/dist/{chunk-HLCDYJY7.mjs → chunk-YQVSHTMR.mjs} +20 -1
- package/dist/{chunk-F5D4XEAS.mjs → chunk-ZZSRYEYU.mjs} +7 -8
- package/dist/{client-plugins-CWrhb1ir.d.mts → client-plugins-B_XzCegf.d.mts} +11 -9
- package/dist/{client-plugins-DPf0qZey.d.ts → client-plugins-CKsXQfXY.d.ts} +11 -9
- package/dist/client-plugins.d.mts +3 -2
- package/dist/client-plugins.d.ts +3 -2
- package/dist/client.d.mts +7 -6
- package/dist/client.d.ts +7 -6
- package/dist/config.d.mts +3 -2
- package/dist/config.d.ts +3 -2
- package/dist/{devtools-MTB5SA2B.mjs → devtools-OY4SNU3P.mjs} +5 -4
- package/dist/{devtools-R6MDDAZK.cjs → devtools-UHRSZ7VA.cjs} +6 -5
- package/dist/docs.cjs +10 -7
- package/dist/docs.mjs +9 -6
- package/dist/index.cjs +24 -21
- package/dist/index.d.mts +14 -13
- package/dist/index.d.ts +14 -13
- package/dist/index.mjs +19 -16
- package/dist/instrumentation.cjs +3 -2
- package/dist/instrumentation.mjs +2 -1
- package/dist/integrations.d.mts +3 -2
- package/dist/integrations.d.ts +3 -2
- package/dist/internal/app-markdown-runtime.d.mts +3 -2
- package/dist/internal/app-markdown-runtime.d.ts +3 -2
- package/dist/internal/build-runtime.cjs +18 -15
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +17 -14
- package/dist/internal/cli-runtime.cjs +11 -8
- package/dist/internal/cli-runtime.mjs +10 -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 +3 -2
- package/dist/internal/compression-runtime.d.ts +3 -2
- package/dist/internal/config-runtime.cjs +6 -5
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/metadata-image-runtime.cjs +3 -2
- package/dist/internal/metadata-image-runtime.mjs +2 -1
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.d.mts +9 -8
- package/dist/internal/production-runtime.d.ts +9 -8
- package/dist/layers-4PNE2HOY.cjs +18 -0
- package/dist/{layers-CJKSJGLN.mjs → layers-BRQF5ETU.mjs} +2 -1
- package/dist/{manager-NPG43N46.mjs → manager-RT733VRK.mjs} +2 -2
- package/dist/{manager-G4B2IPYE.cjs → manager-XZ5TX7AO.cjs} +3 -3
- package/dist/{metadata-CO9fRyyJ.d.mts → metadata-B08w4EYV.d.mts} +1 -1
- package/dist/{metadata-zY9wltwH.d.ts → metadata-IQEblkZp.d.ts} +1 -1
- package/dist/middleware.d.mts +5 -4
- package/dist/middleware.d.ts +5 -4
- package/dist/navigation.d.mts +6 -5
- package/dist/navigation.d.ts +6 -5
- package/dist/{nitro-TSGDUJMN.cjs → nitro-KQDU7CFE.cjs} +2 -2
- package/dist/{nitro-4LFVTT24.mjs → nitro-ZKLGOTVY.mjs} +1 -1
- package/dist/node-module-bundle-L5L7JCZ4.mjs +11 -0
- package/dist/node-module-bundle-VAFZOXMJ.cjs +11 -0
- package/dist/plugin.cjs +12 -10
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.mjs +11 -9
- package/dist/{production-runtime-CywsHwnG.d.mts → production-runtime-C3bGFEaM.d.mts} +1 -1
- package/dist/{production-runtime-lkfwujwK.d.ts → production-runtime-DRSOkc-d.d.ts} +1 -1
- package/dist/{render-plan-LVy6sGQe.d.mts → render-plan-B6CKNl4e.d.mts} +1 -1
- package/dist/{render-plan-DHF0GeWo.d.ts → render-plan-CCFuMLNS.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -4
- package/dist/renderer-client.d.ts +5 -4
- package/dist/renderer.cjs +4 -2
- package/dist/renderer.d.mts +9 -1
- package/dist/renderer.d.ts +9 -1
- package/dist/renderer.mjs +3 -1
- package/dist/{request-6AkmhEYE.d.mts → request-DgD1XsTx.d.mts} +1 -1
- package/dist/{request-BYxlRqA9.d.ts → request-Dn6VURbE.d.ts} +1 -1
- package/dist/request.d.mts +4 -3
- package/dist/request.d.ts +4 -3
- package/dist/{route-rendering-Dd8Jmml7.d.mts → route-rendering-76A5I_kE.d.mts} +1 -1
- package/dist/{route-rendering-CWaKiUbS.d.ts → route-rendering-LAmQEdyG.d.ts} +1 -1
- package/dist/{router-B2m4fvve.d.ts → router-BSOOGya2.d.ts} +1 -1
- package/dist/{router-xwEE112q.d.mts → router-CnrRSa9d.d.mts} +1 -1
- package/dist/routes.d.mts +3 -2
- package/dist/routes.d.ts +3 -2
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server.cjs +43 -36
- package/dist/server.d.mts +9 -8
- package/dist/server.d.ts +9 -8
- package/dist/server.mjs +27 -20
- package/dist/{spa-router-Y8rrXTVK.d.ts → spa-router-BMrSsG5b.d.ts} +2 -2
- package/dist/{spa-router-DVEHQnWo.d.mts → spa-router-DnYhWCvI.d.mts} +2 -2
- package/dist/testing.cjs +2 -1
- package/dist/testing.d.mts +3 -2
- package/dist/testing.d.ts +3 -2
- package/dist/testing.mjs +2 -1
- package/dist/{utils-DSPx34-A.d.mts → utils-ABkktwku.d.mts} +1 -1
- package/dist/{utils-Dvuny_08.d.ts → utils-C3GguS-Q.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +12 -10
- package/dist/vite.d.mts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.mjs +11 -9
- package/dist/workflows.cjs +2 -2
- package/dist/workflows.mjs +1 -1
- package/package.json +27 -13
- package/dist/layers-E4WPJNY5.cjs +0 -17
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
parseRouteSlotFile,
|
|
7
7
|
resolveRouteRenderingConfig,
|
|
8
8
|
resolveRouteRenderingConfigFromFile
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VVJCWBIE.mjs";
|
|
10
10
|
import {
|
|
11
11
|
collectSchemaExtensions,
|
|
12
12
|
declareSchemaTables,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from "./chunk-BOYNDCZL.mjs";
|
|
31
31
|
import {
|
|
32
32
|
createFarmMetadataImageResponse
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-YQVSHTMR.mjs";
|
|
34
34
|
import {
|
|
35
35
|
createFarmImageHandler
|
|
36
36
|
} from "./chunk-F6XEGFHO.mjs";
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
getFarmAppDirectories,
|
|
75
75
|
getFarmLayerAliases,
|
|
76
76
|
getFarmSourceRoots
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-JHWOVJ3M.mjs";
|
|
78
78
|
import {
|
|
79
79
|
REACT_RENDERER,
|
|
80
80
|
assertFarmRendererStreamingRuntime,
|
|
@@ -86,8 +86,9 @@ import {
|
|
|
86
86
|
readFarmRendererWebStream,
|
|
87
87
|
resolveFarmComponentExtensions,
|
|
88
88
|
resolveFarmRenderer,
|
|
89
|
+
resolveFarmRendererAppSetup,
|
|
89
90
|
resolveFarmRendererModule
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-DAATZTKJ.mjs";
|
|
91
92
|
import {
|
|
92
93
|
FARM_PREVIEW_ROBOTS_TAG,
|
|
93
94
|
addFarmCspNonceToScriptTags,
|
|
@@ -143,7 +144,7 @@ import {
|
|
|
143
144
|
} from "./chunk-OFEY6KHO.mjs";
|
|
144
145
|
import {
|
|
145
146
|
resolveWorkflowsConfig
|
|
146
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-3ATMYLLJ.mjs";
|
|
147
148
|
import {
|
|
148
149
|
initStorage
|
|
149
150
|
} from "./chunk-UWPLULNK.mjs";
|
|
@@ -181,7 +182,7 @@ import {
|
|
|
181
182
|
} from "./chunk-IOEH4VWN.mjs";
|
|
182
183
|
import {
|
|
183
184
|
APIRouteManager
|
|
184
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-WNUBR4CA.mjs";
|
|
185
186
|
import {
|
|
186
187
|
findProgrammaticRouteFiles,
|
|
187
188
|
loadProgrammaticRouteManifests
|
|
@@ -192,6 +193,12 @@ import {
|
|
|
192
193
|
createFarmI18nRuntime,
|
|
193
194
|
getFarmI18nClientSnapshot
|
|
194
195
|
} from "./chunk-JNGIWIY6.mjs";
|
|
196
|
+
import {
|
|
197
|
+
VERCEL_OG_INSTALL_HINT,
|
|
198
|
+
formatOptionalPeerInstallHint,
|
|
199
|
+
isMissingPackageError,
|
|
200
|
+
isOptionalPeerInstalled
|
|
201
|
+
} from "./chunk-YOZYCI6Z.mjs";
|
|
195
202
|
import {
|
|
196
203
|
isFarmAPIPathname
|
|
197
204
|
} from "./chunk-XP777LRD.mjs";
|
|
@@ -264,7 +271,7 @@ import {
|
|
|
264
271
|
} from "./chunk-Z2RZJZIZ.mjs";
|
|
265
272
|
import {
|
|
266
273
|
FARM_VERSION
|
|
267
|
-
} from "./chunk-
|
|
274
|
+
} from "./chunk-EHUZ2MKO.mjs";
|
|
268
275
|
import {
|
|
269
276
|
resolveFarmTrailingSlashRedirect,
|
|
270
277
|
setFarmTrailingSlashPreference
|
|
@@ -1439,9 +1446,22 @@ function resolveImportedModule(importerPath, specifier, root) {
|
|
|
1439
1446
|
}
|
|
1440
1447
|
const aliased = resolveProjectAliasSourcePath(specifier, root);
|
|
1441
1448
|
if (aliased) return { path: aliased, local: true };
|
|
1442
|
-
|
|
1449
|
+
const packagePath = resolvePackageModuleSourcePath(importerPath, specifier, root);
|
|
1450
|
+
if (!packagePath) warnUnresolvedAliasImport(importerPath, specifier, root);
|
|
1451
|
+
return { path: packagePath, local: false };
|
|
1443
1452
|
}
|
|
1444
1453
|
__name(resolveImportedModule, "resolveImportedModule");
|
|
1454
|
+
var warnedUnresolvedAliasImports = /* @__PURE__ */ new Set();
|
|
1455
|
+
var ALIAS_IMPORT = /^(?:@\/|~\/|#)/;
|
|
1456
|
+
function warnUnresolvedAliasImport(importerPath, specifier, root) {
|
|
1457
|
+
if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
|
|
1458
|
+
warnedUnresolvedAliasImports.add(specifier);
|
|
1459
|
+
const importer = root ? path.relative(root, importerPath) : importerPath;
|
|
1460
|
+
logger.warn(
|
|
1461
|
+
`Could not resolve "${specifier}" (imported by ${importer}) while checking which pages need client JavaScript. If it holds client components, they will not hydrate. Map the alias in tsconfig.json "paths" or package.json "imports".`
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
__name(warnUnresolvedAliasImport, "warnUnresolvedAliasImport");
|
|
1445
1465
|
var projectImportAliasCache = /* @__PURE__ */ new Map();
|
|
1446
1466
|
var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
|
|
1447
1467
|
function resolveProjectAliasSourcePath(specifier, root) {
|
|
@@ -4833,6 +4853,29 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4833
4853
|
);
|
|
4834
4854
|
this.rendererRuntime = runtime;
|
|
4835
4855
|
this.routeManager.setRendererRuntime?.(this.rendererRuntime);
|
|
4856
|
+
await this.applyRendererAppSetup();
|
|
4857
|
+
}
|
|
4858
|
+
/**
|
|
4859
|
+
* Pass the app's renderer setup module (`renderer.appSetup`) to the renderer. In development
|
|
4860
|
+
* the module runner returns the cached module until the file changes, so an edit is
|
|
4861
|
+
* re-applied on the next request without restarting.
|
|
4862
|
+
*/
|
|
4863
|
+
async applyRendererAppSetup() {
|
|
4864
|
+
const appSetupPath = resolveFarmRendererAppSetup(
|
|
4865
|
+
this.config.root || process.cwd(),
|
|
4866
|
+
this.config.renderer
|
|
4867
|
+
);
|
|
4868
|
+
if (!appSetupPath) return;
|
|
4869
|
+
const configureApp = this.rendererRuntime.configureApp;
|
|
4870
|
+
if (typeof configureApp !== "function") {
|
|
4871
|
+
throw new Error(
|
|
4872
|
+
`Renderer \`${this.config.renderer.name}\` does not support \`appSetup\`: its server module must export configureApp().`
|
|
4873
|
+
);
|
|
4874
|
+
}
|
|
4875
|
+
const setupModule = this.viteServer ? await loadFarmDevModule(this.viteServer, appSetupPath) : await import(pathToFileURL2(appSetupPath).href);
|
|
4876
|
+
if (setupModule === this.appliedAppSetupModule) return;
|
|
4877
|
+
this.appliedAppSetupModule = setupModule;
|
|
4878
|
+
configureApp(setupModule.default);
|
|
4836
4879
|
}
|
|
4837
4880
|
createPageBoundary(pageElement, options) {
|
|
4838
4881
|
return this.rendererRuntime.createElement(
|
|
@@ -4949,6 +4992,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
4949
4992
|
*/
|
|
4950
4993
|
async renderNavigationFragment(input) {
|
|
4951
4994
|
await this.initialize();
|
|
4995
|
+
if (this.viteServer) await this.applyRendererAppSetup();
|
|
4952
4996
|
setFarmBasePath(this.config.basePath);
|
|
4953
4997
|
setFarmTrailingSlashPreference(this.config.trailingSlash);
|
|
4954
4998
|
let element = this.rendererRuntime.createElement(input.PageComponent, input.pageProps);
|
|
@@ -5274,6 +5318,7 @@ var _ServerRenderer = class _ServerRenderer {
|
|
|
5274
5318
|
}
|
|
5275
5319
|
async renderPage(req, res) {
|
|
5276
5320
|
await this.initialize();
|
|
5321
|
+
if (this.viteServer) await this.applyRendererAppSetup();
|
|
5277
5322
|
setFarmBasePath(this.config.basePath);
|
|
5278
5323
|
setFarmTrailingSlashPreference(this.config.trailingSlash);
|
|
5279
5324
|
const cspNonce = createFarmCspNonce(this.security);
|
|
@@ -7377,6 +7422,121 @@ function createFarmApp(config, viteServer) {
|
|
|
7377
7422
|
}
|
|
7378
7423
|
__name(createFarmApp, "createFarmApp");
|
|
7379
7424
|
|
|
7425
|
+
// src/build/tailwind.ts
|
|
7426
|
+
import path11 from "path";
|
|
7427
|
+
|
|
7428
|
+
// src/build/vite-plugin-compat.ts
|
|
7429
|
+
function adaptTailwindVitePlugin(pluginOption, builder) {
|
|
7430
|
+
if (builder !== "rolldown") return pluginOption;
|
|
7431
|
+
return adaptPluginOption(pluginOption);
|
|
7432
|
+
}
|
|
7433
|
+
__name(adaptTailwindVitePlugin, "adaptTailwindVitePlugin");
|
|
7434
|
+
function adaptPluginOption(pluginOption) {
|
|
7435
|
+
if (Array.isArray(pluginOption)) return pluginOption.map(adaptPluginOption);
|
|
7436
|
+
if (!pluginOption || typeof pluginOption !== "object") return pluginOption;
|
|
7437
|
+
const plugin = pluginOption;
|
|
7438
|
+
if (!plugin.name?.startsWith("@tailwindcss/vite:generate:")) return pluginOption;
|
|
7439
|
+
if (isVitePluginHook(plugin.transform)) {
|
|
7440
|
+
return {
|
|
7441
|
+
...plugin,
|
|
7442
|
+
transform: withVite5TransformContext(plugin.transform)
|
|
7443
|
+
};
|
|
7444
|
+
}
|
|
7445
|
+
if (plugin.transform && typeof plugin.transform === "object" && "handler" in plugin.transform && isVitePluginHook(plugin.transform.handler)) {
|
|
7446
|
+
return {
|
|
7447
|
+
...plugin,
|
|
7448
|
+
transform: {
|
|
7449
|
+
...plugin.transform,
|
|
7450
|
+
handler: withVite5TransformContext(plugin.transform.handler)
|
|
7451
|
+
}
|
|
7452
|
+
};
|
|
7453
|
+
}
|
|
7454
|
+
return pluginOption;
|
|
7455
|
+
}
|
|
7456
|
+
__name(adaptPluginOption, "adaptPluginOption");
|
|
7457
|
+
function isVitePluginHook(value) {
|
|
7458
|
+
return typeof value === "function";
|
|
7459
|
+
}
|
|
7460
|
+
__name(isVitePluginHook, "isVitePluginHook");
|
|
7461
|
+
function withVite5TransformContext(handler) {
|
|
7462
|
+
return function(...args) {
|
|
7463
|
+
const context = new Proxy(this, {
|
|
7464
|
+
get(target, property, receiver) {
|
|
7465
|
+
if (property === "environment") return void 0;
|
|
7466
|
+
return Reflect.get(target, property, receiver);
|
|
7467
|
+
}
|
|
7468
|
+
});
|
|
7469
|
+
return handler.apply(context, args);
|
|
7470
|
+
};
|
|
7471
|
+
}
|
|
7472
|
+
__name(withVite5TransformContext, "withVite5TransformContext");
|
|
7473
|
+
|
|
7474
|
+
// src/build/tailwind.ts
|
|
7475
|
+
var TAILWIND_CSS_IMPORT = /@import\s+["']tailwindcss["']/;
|
|
7476
|
+
var TAILWIND_VITE_INSTALL_HINT = formatOptionalPeerInstallHint(
|
|
7477
|
+
"@tailwindcss/vite",
|
|
7478
|
+
"enable built-in Tailwind CSS support",
|
|
7479
|
+
{ dev: true }
|
|
7480
|
+
);
|
|
7481
|
+
var warnedMissingTailwind = false;
|
|
7482
|
+
async function loadTailwindVitePlugin(options = {}, importTailwind = () => import("@tailwindcss/vite")) {
|
|
7483
|
+
try {
|
|
7484
|
+
const tailwindVite = (await importTailwind()).default;
|
|
7485
|
+
const plugin = options.builder ? adaptTailwindVitePlugin(tailwindVite(), options.builder) : tailwindVite();
|
|
7486
|
+
if (options.announce) logger.info("\u{1F4E6} Enabled built-in Tailwind support (@tailwindcss/vite)");
|
|
7487
|
+
return plugin;
|
|
7488
|
+
} catch (error) {
|
|
7489
|
+
if (isMissingPackageError(error, "@tailwindcss/vite")) return createMissingTailwindPlugin();
|
|
7490
|
+
logger.warn(
|
|
7491
|
+
`Tailwind plugin auto-enable failed${options.label ? ` ${options.label}` : ""}; continuing without it: ${error.message}`
|
|
7492
|
+
);
|
|
7493
|
+
return void 0;
|
|
7494
|
+
}
|
|
7495
|
+
}
|
|
7496
|
+
__name(loadTailwindVitePlugin, "loadTailwindVitePlugin");
|
|
7497
|
+
function createMissingTailwindPlugin() {
|
|
7498
|
+
let root = process.cwd();
|
|
7499
|
+
return {
|
|
7500
|
+
name: "farm:tailwind-missing",
|
|
7501
|
+
enforce: "pre",
|
|
7502
|
+
configResolved(config) {
|
|
7503
|
+
root = config.root;
|
|
7504
|
+
},
|
|
7505
|
+
transform(code, id) {
|
|
7506
|
+
if (warnedMissingTailwind || !/\.css(?:\?.*)?$/.test(id) || !TAILWIND_CSS_IMPORT.test(code)) {
|
|
7507
|
+
return null;
|
|
7508
|
+
}
|
|
7509
|
+
warnedMissingTailwind = true;
|
|
7510
|
+
const file = path11.relative(root, id.split("?", 1)[0]).replace(/\\/g, "/");
|
|
7511
|
+
logger.warn(
|
|
7512
|
+
`${file} imports Tailwind CSS, but @tailwindcss/vite is not installed; continuing without Tailwind. ${TAILWIND_VITE_INSTALL_HINT}`
|
|
7513
|
+
);
|
|
7514
|
+
return null;
|
|
7515
|
+
}
|
|
7516
|
+
};
|
|
7517
|
+
}
|
|
7518
|
+
__name(createMissingTailwindPlugin, "createMissingTailwindPlugin");
|
|
7519
|
+
|
|
7520
|
+
// src/image-runtime.ts
|
|
7521
|
+
var SHARP_INSTALL_HINT = formatOptionalPeerInstallHint("sharp", "optimize images");
|
|
7522
|
+
var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
|
|
7523
|
+
function resolveFarmImageProviderForRuntime(images, options) {
|
|
7524
|
+
const provider = images?.provider ?? "auto";
|
|
7525
|
+
if (provider === "none") return images;
|
|
7526
|
+
const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
|
|
7527
|
+
if (!usesSharp || isOptionalPeerInstalled(options.root, "sharp")) return images;
|
|
7528
|
+
if (provider === "node") {
|
|
7529
|
+
throw new Error(
|
|
7530
|
+
`images.provider "node" optimizes images with sharp, which is not installed. ${SHARP_INSTALL_HINT}`
|
|
7531
|
+
);
|
|
7532
|
+
}
|
|
7533
|
+
logger.info(
|
|
7534
|
+
`Image optimization is off because sharp is not installed; images use their original URLs. ${SHARP_INSTALL_HINT}, or set images.provider to "none".`
|
|
7535
|
+
);
|
|
7536
|
+
return Object.freeze({ ...images, provider: "none" });
|
|
7537
|
+
}
|
|
7538
|
+
__name(resolveFarmImageProviderForRuntime, "resolveFarmImageProviderForRuntime");
|
|
7539
|
+
|
|
7380
7540
|
// src/schema-step-types.ts
|
|
7381
7541
|
function validateSchemaSteps(owner, schema, steps) {
|
|
7382
7542
|
if (steps === void 0) return;
|
|
@@ -7463,8 +7623,8 @@ __name(validateSchemaSteps, "validateSchemaSteps");
|
|
|
7463
7623
|
var _FarmPluginOptionsError = class _FarmPluginOptionsError extends TypeError {
|
|
7464
7624
|
constructor(issues) {
|
|
7465
7625
|
const lines = issues.map((issue) => {
|
|
7466
|
-
const
|
|
7467
|
-
return ` - ${
|
|
7626
|
+
const path18 = formatIssuePath(issue.path);
|
|
7627
|
+
return ` - ${path18 ? `${path18}: ` : ""}${issue.message}`;
|
|
7468
7628
|
});
|
|
7469
7629
|
super(`Invalid plugin options:
|
|
7470
7630
|
${lines.join("\n")}`);
|
|
@@ -7474,9 +7634,9 @@ ${lines.join("\n")}`);
|
|
|
7474
7634
|
};
|
|
7475
7635
|
__name(_FarmPluginOptionsError, "FarmPluginOptionsError");
|
|
7476
7636
|
var FarmPluginOptionsError = _FarmPluginOptionsError;
|
|
7477
|
-
function formatIssuePath(
|
|
7478
|
-
if (!
|
|
7479
|
-
return
|
|
7637
|
+
function formatIssuePath(path18) {
|
|
7638
|
+
if (!path18?.length) return "";
|
|
7639
|
+
return path18.map((segment) => {
|
|
7480
7640
|
const key = typeof segment === "object" && segment !== null ? segment.key : segment;
|
|
7481
7641
|
return typeof key === "symbol" ? key.toString() : String(key);
|
|
7482
7642
|
}).join(".");
|
|
@@ -7712,23 +7872,23 @@ var _PluginManager = class _PluginManager {
|
|
|
7712
7872
|
`Farm plugin "${plugin.name}" runtime.endpoints must contain endpoint objects`
|
|
7713
7873
|
);
|
|
7714
7874
|
}
|
|
7715
|
-
const
|
|
7875
|
+
const path18 = normalizeFarmPluginRuntimeEndpointPath(
|
|
7716
7876
|
endpoint.path,
|
|
7717
7877
|
`Farm plugin "${plugin.name}" runtime endpoint`
|
|
7718
7878
|
);
|
|
7719
7879
|
if (typeof endpoint.handler !== "function") {
|
|
7720
7880
|
throw new TypeError(
|
|
7721
|
-
`Farm plugin "${plugin.name}" runtime endpoint ${
|
|
7881
|
+
`Farm plugin "${plugin.name}" runtime endpoint ${path18} requires a handler`
|
|
7722
7882
|
);
|
|
7723
7883
|
}
|
|
7724
|
-
const owner = owners.get(
|
|
7884
|
+
const owner = owners.get(path18);
|
|
7725
7885
|
if (owner) {
|
|
7726
7886
|
throw new Error(
|
|
7727
|
-
`Farm plugin runtime endpoint ${
|
|
7887
|
+
`Farm plugin runtime endpoint ${path18} from "${plugin.name}" conflicts with "${owner}"`
|
|
7728
7888
|
);
|
|
7729
7889
|
}
|
|
7730
|
-
owners.set(
|
|
7731
|
-
endpoints.push({ plugin, endpoint, path:
|
|
7890
|
+
owners.set(path18, plugin.name);
|
|
7891
|
+
endpoints.push({ plugin, endpoint, path: path18 });
|
|
7732
7892
|
}
|
|
7733
7893
|
}
|
|
7734
7894
|
this.runtimeEndpoints = endpoints;
|
|
@@ -8402,7 +8562,7 @@ __name(declarePluginSchema, "declarePluginSchema");
|
|
|
8402
8562
|
|
|
8403
8563
|
// src/client-plugin-build.ts
|
|
8404
8564
|
import fs6 from "fs";
|
|
8405
|
-
import
|
|
8565
|
+
import path12 from "path";
|
|
8406
8566
|
var CLIENT_KEYS = [
|
|
8407
8567
|
"public",
|
|
8408
8568
|
"setup",
|
|
@@ -8416,9 +8576,9 @@ var HYDRATION_KEYS = ["before", "after"];
|
|
|
8416
8576
|
var NAVIGATION_KEYS = ["before", "loaded", "resolved", "rendered", "error"];
|
|
8417
8577
|
var APP_CLIENT_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
8418
8578
|
function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
|
|
8419
|
-
const sourceRoot =
|
|
8579
|
+
const sourceRoot = path12.resolve(root, srcDir);
|
|
8420
8580
|
for (const extension of APP_CLIENT_EXTENSIONS) {
|
|
8421
|
-
const candidate =
|
|
8581
|
+
const candidate = path12.join(sourceRoot, `client.${extension}`);
|
|
8422
8582
|
if (fs6.existsSync(candidate) && fs6.statSync(candidate).isFile()) return candidate;
|
|
8423
8583
|
}
|
|
8424
8584
|
return void 0;
|
|
@@ -8672,7 +8832,7 @@ __name(isArrayIndex, "isArrayIndex");
|
|
|
8672
8832
|
|
|
8673
8833
|
// src/client-cache-persistence-build.ts
|
|
8674
8834
|
import fs7 from "fs";
|
|
8675
|
-
import
|
|
8835
|
+
import path13 from "path";
|
|
8676
8836
|
var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
|
|
8677
8837
|
function resolveFarmClientCacheAdapterEntry(root, cache) {
|
|
8678
8838
|
const client = cache?.client;
|
|
@@ -8683,7 +8843,7 @@ function resolveFarmClientCacheAdapterEntry(root, cache) {
|
|
|
8683
8843
|
'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
|
|
8684
8844
|
);
|
|
8685
8845
|
}
|
|
8686
|
-
const resolved =
|
|
8846
|
+
const resolved = path13.resolve(root, adapter);
|
|
8687
8847
|
const found = resolveAdapterFile(resolved);
|
|
8688
8848
|
if (!found) {
|
|
8689
8849
|
throw new Error(
|
|
@@ -8785,12 +8945,12 @@ function createFarmLayoutElement(Component, pattern, children, params) {
|
|
|
8785
8945
|
|
|
8786
8946
|
// src/vite.ts
|
|
8787
8947
|
import * as fs9 from "fs";
|
|
8788
|
-
import * as
|
|
8948
|
+
import * as path17 from "path";
|
|
8789
8949
|
import { pathToFileURL as pathToFileURL3 } from "url";
|
|
8790
8950
|
|
|
8791
8951
|
// src/dev-static.ts
|
|
8792
8952
|
import * as fs8 from "fs";
|
|
8793
|
-
import * as
|
|
8953
|
+
import * as path14 from "path";
|
|
8794
8954
|
function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = []) {
|
|
8795
8955
|
if (!pathname.includes(".") || pathname.endsWith(".html")) return false;
|
|
8796
8956
|
const matchesAppRoute = Boolean(
|
|
@@ -8837,9 +8997,9 @@ function devServableFileExists(pathname, baseDirs) {
|
|
|
8837
8997
|
if (!relativePathname) return false;
|
|
8838
8998
|
for (const baseDir of baseDirs) {
|
|
8839
8999
|
if (typeof baseDir !== "string" || baseDir.length === 0) continue;
|
|
8840
|
-
const resolvedBase =
|
|
8841
|
-
const candidate =
|
|
8842
|
-
if (!candidate.startsWith(resolvedBase +
|
|
9000
|
+
const resolvedBase = path14.resolve(baseDir);
|
|
9001
|
+
const candidate = path14.resolve(resolvedBase, relativePathname);
|
|
9002
|
+
if (!candidate.startsWith(resolvedBase + path14.sep)) continue;
|
|
8843
9003
|
try {
|
|
8844
9004
|
if (fs8.existsSync(candidate) && fs8.statSync(candidate).isFile()) {
|
|
8845
9005
|
return true;
|
|
@@ -8986,7 +9146,7 @@ __name(formatClientBoundaryWarning, "formatClientBoundaryWarning");
|
|
|
8986
9146
|
|
|
8987
9147
|
// src/image-vite.ts
|
|
8988
9148
|
import { readFile as readFile3 } from "fs/promises";
|
|
8989
|
-
import
|
|
9149
|
+
import path15 from "path";
|
|
8990
9150
|
import { imageSize as imageSize2 } from "image-size";
|
|
8991
9151
|
var FARM_IMAGE_ID_PREFIX = "\0farm:image:";
|
|
8992
9152
|
var STATIC_IMAGE_RE = /\.(?:avif|gif|jpe?g|png|webp)$/i;
|
|
@@ -9054,7 +9214,7 @@ async function createBlurDataURL(bytes) {
|
|
|
9054
9214
|
__name(createBlurDataURL, "createBlurDataURL");
|
|
9055
9215
|
|
|
9056
9216
|
// src/server/vite-config.ts
|
|
9057
|
-
import
|
|
9217
|
+
import path16 from "path";
|
|
9058
9218
|
var FARM_CLIENT_ENTRY_PATTERN = "**/{page,layout,loading,error,not-found,default}.{js,jsx,ts,tsx}";
|
|
9059
9219
|
var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
|
|
9060
9220
|
"react",
|
|
@@ -9078,9 +9238,9 @@ function getFarmClientOptimizeDepsInclude(renderer) {
|
|
|
9078
9238
|
}
|
|
9079
9239
|
__name(getFarmClientOptimizeDepsInclude, "getFarmClientOptimizeDepsInclude");
|
|
9080
9240
|
function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
|
|
9081
|
-
const resolvedProjectRoot =
|
|
9241
|
+
const resolvedProjectRoot = path16.resolve(projectRoot);
|
|
9082
9242
|
return appDirectories.map((appDirectory) => {
|
|
9083
|
-
const relativeAppDirectory =
|
|
9243
|
+
const relativeAppDirectory = path16.relative(resolvedProjectRoot, path16.resolve(appDirectory)).replace(/\\/g, "/");
|
|
9084
9244
|
const prefix = relativeAppDirectory || ".";
|
|
9085
9245
|
return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
|
|
9086
9246
|
});
|
|
@@ -9104,7 +9264,7 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
|
|
|
9104
9264
|
__name(createFarmClientOptimizeDepsConfig, "createFarmClientOptimizeDepsConfig");
|
|
9105
9265
|
function createFarmSourceAlias(projectRoot, srcDir = "src") {
|
|
9106
9266
|
return {
|
|
9107
|
-
"@":
|
|
9267
|
+
"@": path16.resolve(projectRoot, srcDir)
|
|
9108
9268
|
};
|
|
9109
9269
|
}
|
|
9110
9270
|
__name(createFarmSourceAlias, "createFarmSourceAlias");
|
|
@@ -9300,6 +9460,7 @@ function reportOpenAPIDevGenerationResult(spec, output = logger) {
|
|
|
9300
9460
|
__name(reportOpenAPIDevGenerationResult, "reportOpenAPIDevGenerationResult");
|
|
9301
9461
|
|
|
9302
9462
|
// src/vite.ts
|
|
9463
|
+
var SERVER_FN_TRANSFORM_PLUGIN = "@farm.js/plugin/rsc:server-fn-actions";
|
|
9303
9464
|
function farmLlmsTxtGeneratedPaths(config) {
|
|
9304
9465
|
const llms = resolveFarmLlmsTxtConfig(config.agent?.llmsTxt);
|
|
9305
9466
|
if (!llms.enabled) return [];
|
|
@@ -9345,7 +9506,7 @@ function loadFarmDocsSearchDevRuntime() {
|
|
|
9345
9506
|
}
|
|
9346
9507
|
__name(loadFarmDocsSearchDevRuntime, "loadFarmDocsSearchDevRuntime");
|
|
9347
9508
|
function loadFarmOpenAPIDevRuntime() {
|
|
9348
|
-
return import("./manager-
|
|
9509
|
+
return import("./manager-RT733VRK.mjs");
|
|
9349
9510
|
}
|
|
9350
9511
|
__name(loadFarmOpenAPIDevRuntime, "loadFarmOpenAPIDevRuntime");
|
|
9351
9512
|
function loadFarmWorkflowsDevRuntime() {
|
|
@@ -9353,7 +9514,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
9353
9514
|
}
|
|
9354
9515
|
__name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
9355
9516
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
9356
|
-
return import("./devtools-
|
|
9517
|
+
return import("./devtools-OY4SNU3P.mjs");
|
|
9357
9518
|
}
|
|
9358
9519
|
__name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
9359
9520
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -9383,14 +9544,29 @@ function farmI18nClientBridgePlugin() {
|
|
|
9383
9544
|
__name(farmI18nClientBridgePlugin, "farmI18nClientBridgePlugin");
|
|
9384
9545
|
var FARM_SERVER_ONLY_ENTRIES = /* @__PURE__ */ new Set(["@farm.js/core/og"]);
|
|
9385
9546
|
function farmServerOnlyEntriesPlugin() {
|
|
9547
|
+
let root = process.cwd();
|
|
9548
|
+
let vercelOgInstalled = false;
|
|
9386
9549
|
return {
|
|
9387
9550
|
name: "farm:server-only-entries",
|
|
9388
9551
|
enforce: "pre",
|
|
9552
|
+
configResolved(config) {
|
|
9553
|
+
root = config.root;
|
|
9554
|
+
},
|
|
9389
9555
|
resolveId(id, importer, options) {
|
|
9390
|
-
if (
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9556
|
+
if (!FARM_SERVER_ONLY_ENTRIES.has(id)) return null;
|
|
9557
|
+
const importedBy = importer ? ` (imported by ${importer})` : "";
|
|
9558
|
+
if (!options?.ssr) {
|
|
9559
|
+
this.error(
|
|
9560
|
+
`${id} is server-only and cannot be imported into client code${importedBy}. Use it from an API route or another server module.`
|
|
9561
|
+
);
|
|
9562
|
+
}
|
|
9563
|
+
vercelOgInstalled || (vercelOgInstalled = isOptionalPeerInstalled(root, "@vercel/og"));
|
|
9564
|
+
if (!vercelOgInstalled) {
|
|
9565
|
+
this.error(
|
|
9566
|
+
`${id} needs @vercel/og, which is not installed${importedBy}. ${VERCEL_OG_INSTALL_HINT}`
|
|
9567
|
+
);
|
|
9568
|
+
}
|
|
9569
|
+
return null;
|
|
9394
9570
|
}
|
|
9395
9571
|
};
|
|
9396
9572
|
}
|
|
@@ -9761,7 +9937,7 @@ function fileContainsProgrammaticPageRoute(file) {
|
|
|
9761
9937
|
__name(fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
|
|
9762
9938
|
function rewriteEarlySsrRelativeImports(options) {
|
|
9763
9939
|
const cleanId = options.id.split("?", 1)[0];
|
|
9764
|
-
if (!
|
|
9940
|
+
if (!path17.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
|
|
9765
9941
|
return null;
|
|
9766
9942
|
}
|
|
9767
9943
|
const replacements = [];
|
|
@@ -9781,7 +9957,7 @@ function rewriteEarlySsrRelativeImports(options) {
|
|
|
9781
9957
|
const suffixIndex = source.value.search(/[?#]/);
|
|
9782
9958
|
const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
|
|
9783
9959
|
const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
|
|
9784
|
-
const resolvedPath =
|
|
9960
|
+
const resolvedPath = path17.resolve(path17.dirname(cleanId), sourcePath);
|
|
9785
9961
|
replacements.push({
|
|
9786
9962
|
start: source.start,
|
|
9787
9963
|
end: source.end,
|
|
@@ -9941,6 +10117,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
9941
10117
|
publicDir: options.publicDir
|
|
9942
10118
|
});
|
|
9943
10119
|
let farmApp;
|
|
10120
|
+
let serverFnTransformActive = false;
|
|
9944
10121
|
let server;
|
|
9945
10122
|
let apiRouteManager;
|
|
9946
10123
|
let openAPIManager = null;
|
|
@@ -9979,7 +10156,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
9979
10156
|
...layerRoots.length ? {
|
|
9980
10157
|
server: {
|
|
9981
10158
|
fs: {
|
|
9982
|
-
allow: [
|
|
10159
|
+
allow: [path17.resolve(options.root || process.cwd()), ...layerRoots]
|
|
9983
10160
|
}
|
|
9984
10161
|
}
|
|
9985
10162
|
} : {}
|
|
@@ -9989,6 +10166,14 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
9989
10166
|
if (typeof fontImports.configResolved === "function") {
|
|
9990
10167
|
await fontImports.configResolved.call(this, config);
|
|
9991
10168
|
}
|
|
10169
|
+
serverFnTransformActive = config.plugins.some(
|
|
10170
|
+
(plugin) => plugin.name === SERVER_FN_TRANSFORM_PLUGIN
|
|
10171
|
+
);
|
|
10172
|
+
if (options.experimental?.serverActions === true && !serverFnTransformActive) {
|
|
10173
|
+
logger.warn(
|
|
10174
|
+
"experimental.serverActions has no effect without @farm.js/plugin/rsc in the Vite plugins. Server functions stay server-only, and importing one from client code is a build error."
|
|
10175
|
+
);
|
|
10176
|
+
}
|
|
9992
10177
|
},
|
|
9993
10178
|
async configureServer(viteServer) {
|
|
9994
10179
|
if (typeof fontImports.configureServer === "function") {
|
|
@@ -10022,6 +10207,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10022
10207
|
}
|
|
10023
10208
|
const apiServerBasePath = resolveFarmAPIServerBasePath(farmConfig.api);
|
|
10024
10209
|
const serverConfig = resolveFarmServerConfig(farmConfig.server);
|
|
10210
|
+
globalThis.__FARM_IMAGE_CONFIG__ = getPublicFarmImageConfig(farmConfig.images);
|
|
10025
10211
|
let imageHandler = null;
|
|
10026
10212
|
if (farmConfig.images.provider !== "none") {
|
|
10027
10213
|
const { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } = await import("./image/sharp.mjs");
|
|
@@ -10040,7 +10226,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10040
10226
|
});
|
|
10041
10227
|
}
|
|
10042
10228
|
const sourceRoots = getFarmSourceRoots(farmConfig);
|
|
10043
|
-
server.watcher.add(sourceRoots.map((source) =>
|
|
10229
|
+
server.watcher.add(sourceRoots.map((source) => path17.join(source.root, source.srcDir)));
|
|
10044
10230
|
if (farmConfig.i18n.enabled) {
|
|
10045
10231
|
server.watcher.add(
|
|
10046
10232
|
farmConfig.i18n.locales.map(
|
|
@@ -10055,7 +10241,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10055
10241
|
...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
|
|
10056
10242
|
], "getExtraRouteTypes");
|
|
10057
10243
|
const appDirSlugs = sourceRoots.map(
|
|
10058
|
-
(source) =>
|
|
10244
|
+
(source) => path17.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
|
|
10059
10245
|
);
|
|
10060
10246
|
const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
|
|
10061
10247
|
try {
|
|
@@ -10096,7 +10282,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10096
10282
|
}, "generateTypeArtifacts");
|
|
10097
10283
|
await generateTypeArtifacts("startup");
|
|
10098
10284
|
const srcDirSlugs = sourceRoots.map(
|
|
10099
|
-
(source) =>
|
|
10285
|
+
(source) => path17.join(source.root, source.srcDir).replace(/\\/g, "/")
|
|
10100
10286
|
);
|
|
10101
10287
|
const layerConfigFiles = new Set(
|
|
10102
10288
|
farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
|
|
@@ -10235,7 +10421,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
10235
10421
|
await apiRouteManager.discoverRoutes();
|
|
10236
10422
|
let discoveredWorkflows = [];
|
|
10237
10423
|
const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
|
|
10238
|
-
(dir) => fs9.existsSync(
|
|
10424
|
+
(dir) => fs9.existsSync(path17.isAbsolute(dir) ? dir : path17.join(farmConfig.root, dir))
|
|
10239
10425
|
);
|
|
10240
10426
|
if (hasWorkflowDirectory) {
|
|
10241
10427
|
const { createFarmWorkflowRequestHandler, discoverFarmWorkflows } = await loadFarmWorkflowsDevRuntime();
|
|
@@ -11688,7 +11874,7 @@ export const manifest = getManifest();
|
|
|
11688
11874
|
async transform(code, id, transformOptions) {
|
|
11689
11875
|
if (!transformOptions?.ssr) {
|
|
11690
11876
|
const currentConfig = farmApp?.getConfig() ?? options;
|
|
11691
|
-
if (currentConfig.experimental?.serverActions !== true) {
|
|
11877
|
+
if (currentConfig.experimental?.serverActions !== true || !serverFnTransformActive) {
|
|
11692
11878
|
const violation = findClientServerFnViolation(code, id);
|
|
11693
11879
|
if (violation) {
|
|
11694
11880
|
this.error(formatServerFnBoundaryError(violation, id));
|
|
@@ -11742,7 +11928,7 @@ export const manifest = getManifest();
|
|
|
11742
11928
|
const root = currentConfig.root || server?.config.root || process.cwd();
|
|
11743
11929
|
const cleanId = id.split("?", 1)[0];
|
|
11744
11930
|
const selectedIsolatedModules = options.isolatedClientBoundaryModules ?? farmApp?.getRouteManager().getIsolatedClientBoundaryModules(root);
|
|
11745
|
-
const selectedForIsolatedHydration = selectedIsolatedModules?.has(
|
|
11931
|
+
const selectedForIsolatedHydration = selectedIsolatedModules?.has(path17.resolve(cleanId)) === true;
|
|
11746
11932
|
if (isReactRenderer(resolveFarmRenderer(currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
|
|
11747
11933
|
isolatedModuleReference = toViteModuleId(cleanId, root);
|
|
11748
11934
|
const transformedBoundary = transformIsolatedClientBoundaryModule({
|
|
@@ -11833,8 +12019,8 @@ if (import.meta.hot) {
|
|
|
11833
12019
|
}
|
|
11834
12020
|
logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
|
|
11835
12021
|
logger.info("Pre-rendering SSG pages...");
|
|
11836
|
-
const outDir =
|
|
11837
|
-
const clientDir =
|
|
12022
|
+
const outDir = path17.join(server?.config.root || process.cwd(), options.outDir || "dist");
|
|
12023
|
+
const clientDir = path17.join(outDir, "client");
|
|
11838
12024
|
for (const page of ssgPages) {
|
|
11839
12025
|
try {
|
|
11840
12026
|
const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
|
|
@@ -11886,8 +12072,8 @@ if (import.meta.hot) {
|
|
|
11886
12072
|
<script type="module" src="/assets/client.js"></script>
|
|
11887
12073
|
</body>
|
|
11888
12074
|
</html>`;
|
|
11889
|
-
const outputPath = page.urlPath === "/" ?
|
|
11890
|
-
fs9.mkdirSync(
|
|
12075
|
+
const outputPath = page.urlPath === "/" ? path17.join(clientDir, "index.html") : path17.join(clientDir, page.urlPath + ".html");
|
|
12076
|
+
fs9.mkdirSync(path17.dirname(outputPath), { recursive: true });
|
|
11891
12077
|
fs9.writeFileSync(outputPath, fullHtml);
|
|
11892
12078
|
const revalidateInfo = page.revalidate ? ` (revalidate: ${page.revalidate}s)` : "";
|
|
11893
12079
|
logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
|
|
@@ -11896,7 +12082,7 @@ if (import.meta.hot) {
|
|
|
11896
12082
|
logger.error(` \u2717 ${page.urlPath}: ${error}`);
|
|
11897
12083
|
}
|
|
11898
12084
|
}
|
|
11899
|
-
const manifestPath =
|
|
12085
|
+
const manifestPath = path17.join(outDir, "__ssg_manifest.json");
|
|
11900
12086
|
fs9.writeFileSync(
|
|
11901
12087
|
manifestPath,
|
|
11902
12088
|
JSON.stringify(
|
|
@@ -11940,9 +12126,9 @@ if (import.meta.hot) {
|
|
|
11940
12126
|
server2.ws.send({ type: "full-reload", path: "*" });
|
|
11941
12127
|
return [];
|
|
11942
12128
|
}
|
|
11943
|
-
const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) =>
|
|
12129
|
+
const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path17.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
|
|
11944
12130
|
if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
|
|
11945
|
-
logUpdate("PAGE", `updated ${
|
|
12131
|
+
logUpdate("PAGE", `updated ${path17.basename(file)}`);
|
|
11946
12132
|
for (const mod of modules) {
|
|
11947
12133
|
server2.moduleGraph.invalidateModule(mod);
|
|
11948
12134
|
}
|
|
@@ -12073,10 +12259,10 @@ function createPageDataMiddlewareRequest(req, target) {
|
|
|
12073
12259
|
__name(createPageDataMiddlewareRequest, "createPageDataMiddlewareRequest");
|
|
12074
12260
|
function resolveDevelopmentRoot(farmRoot, viteRoot) {
|
|
12075
12261
|
if (!farmRoot) return viteRoot;
|
|
12076
|
-
if (
|
|
12262
|
+
if (path17.resolve(farmRoot) === path17.resolve(viteRoot)) return farmRoot;
|
|
12077
12263
|
try {
|
|
12078
12264
|
if (fs9.realpathSync(farmRoot) === fs9.realpathSync(viteRoot)) {
|
|
12079
|
-
return
|
|
12265
|
+
return path17.resolve(viteRoot);
|
|
12080
12266
|
}
|
|
12081
12267
|
} catch {
|
|
12082
12268
|
}
|
|
@@ -12436,8 +12622,11 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
|
|
|
12436
12622
|
srcDir,
|
|
12437
12623
|
publicRuntimeConfig
|
|
12438
12624
|
);
|
|
12625
|
+
const appSetupPath = resolveFarmRendererAppSetup(root, renderer);
|
|
12439
12626
|
const rendererClientImports = isReactRenderer(renderer) ? `import React from 'react'
|
|
12440
|
-
import { hydrateRoot, createRoot } from 'react-dom/client'` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}
|
|
12627
|
+
import { hydrateRoot, createRoot } from 'react-dom/client'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
|
|
12628
|
+
import __farmAppSetup from ${JSON.stringify(toViteModuleId(appSetupPath, root))}
|
|
12629
|
+
__farmConfigureApp(__farmAppSetup)` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
|
|
12441
12630
|
const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'` : "";
|
|
12442
12631
|
const docsAdapterImportBlock = generateFarmDocsAdapterClientRuntime(
|
|
12443
12632
|
docsAdapterReact,
|
|
@@ -13994,10 +14183,10 @@ function generateClientManifest(bundle) {
|
|
|
13994
14183
|
}
|
|
13995
14184
|
__name(generateClientManifest, "generateClientManifest");
|
|
13996
14185
|
async function defineConfig(config = {}) {
|
|
13997
|
-
const
|
|
13998
|
-
const appRoot =
|
|
14186
|
+
const tailwindVitePlugin = await loadTailwindVitePlugin();
|
|
14187
|
+
const appRoot = path17.resolve(config.root || process.cwd());
|
|
13999
14188
|
if (config.extends?.length) {
|
|
14000
|
-
const { config: layeredConfig } = await import("./layers-
|
|
14189
|
+
const { config: layeredConfig } = await import("./layers-BRQF5ETU.mjs").then(
|
|
14001
14190
|
({ resolveFarmLayers }) => resolveFarmLayers(config, {
|
|
14002
14191
|
root: appRoot,
|
|
14003
14192
|
mode: process.env.NODE_ENV === "production" ? "production" : "development"
|
|
@@ -14006,6 +14195,7 @@ async function defineConfig(config = {}) {
|
|
|
14006
14195
|
config = layeredConfig;
|
|
14007
14196
|
}
|
|
14008
14197
|
config.renderer = resolveFarmRenderer(config.renderer);
|
|
14198
|
+
config.images = resolveFarmImageProviderForRuntime(config.images, { root: appRoot, dev: true });
|
|
14009
14199
|
const rendererVitePlugins = await loadFarmRendererVitePlugins(config.renderer, appRoot, {
|
|
14010
14200
|
ssr: true
|
|
14011
14201
|
});
|
|
@@ -14135,7 +14325,7 @@ async function defineConfig(config = {}) {
|
|
|
14135
14325
|
return {
|
|
14136
14326
|
plugins: [
|
|
14137
14327
|
createFarmThemeCssPlugin(config.theme, config.basePath),
|
|
14138
|
-
|
|
14328
|
+
tailwindVitePlugin,
|
|
14139
14329
|
...rendererVitePlugins,
|
|
14140
14330
|
viteBrowserExternalPlugin,
|
|
14141
14331
|
farmI18nClientBridgePlugin(),
|
|
@@ -14231,6 +14421,9 @@ export {
|
|
|
14231
14421
|
createFarmApp,
|
|
14232
14422
|
FarmPluginOptionsError,
|
|
14233
14423
|
farmPluginMayAffectRuntimePath,
|
|
14424
|
+
loadTailwindVitePlugin,
|
|
14425
|
+
SHARP_INSTALL_HINT,
|
|
14426
|
+
resolveFarmImageProviderForRuntime,
|
|
14234
14427
|
generateFarmClientPluginEntryCode,
|
|
14235
14428
|
resolveFarmClientCacheAdapterEntry,
|
|
14236
14429
|
generateClientCachePersistenceCode,
|