@farm.js/core 0.1.70 → 0.1.71
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-handler-6T2Z7TB6.cjs → agent-mcp-handler-KE4J3W7S.cjs} +3 -3
- package/dist/{agent-mcp-handler-CPU354QQ.mjs → agent-mcp-handler-VIT4GOSR.mjs} +2 -2
- package/dist/{agent-mcp.d-DulgFLBt.d.ts → agent-mcp.d-BzNw6JI8.d.ts} +14 -4
- package/dist/{agent-mcp.d-TAs1ES2F.d.mts → agent-mcp.d-CgFen3EH.d.mts} +14 -4
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/analyzer-LPIVRSTJ.cjs +16 -0
- package/dist/{analyzer-QGRBLETM.mjs → analyzer-VK3BAOFI.mjs} +2 -2
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/{app-manifest.d-C-nf3Vmm.d.ts → app-manifest.d-DY4JfJxi.d.ts} +1 -1
- package/dist/{app-manifest.d-6zXb90o6.d.mts → app-manifest.d-DpDK_B1k.d.mts} +1 -1
- package/dist/app-markdown.cjs +5 -3
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +4 -2
- package/dist/{app.d-C2xeMIYT.d.ts → app.d-BeK6bb1c.d.ts} +8 -6
- package/dist/{app.d-DF0aundc.d.mts → app.d-D-5UNrFd.d.mts} +8 -6
- package/dist/{chunk-HAXFV2CD.mjs → chunk-2CQC5CMD.mjs} +1 -1
- package/dist/{chunk-IEN2EFE5.cjs → chunk-2IFT2CSA.cjs} +4 -4
- package/dist/{chunk-BPUVDCGG.cjs → chunk-3BQ7QHUH.cjs} +3 -3
- package/dist/{chunk-JFVT5ZZV.mjs → chunk-4OD2LXF2.mjs} +1 -1
- package/dist/{chunk-CCHJWJGP.mjs → chunk-7BUE2GM6.mjs} +141 -86
- package/dist/{chunk-FJ5YCERM.cjs → chunk-7OHJWFLB.cjs} +387 -331
- package/dist/{chunk-5R3JQPWD.mjs → chunk-AYVGD3PK.mjs} +1 -1
- package/dist/{chunk-K7JMTAFH.cjs → chunk-CSQPMV3Q.cjs} +16 -6
- package/dist/{chunk-N62IYXYD.mjs → chunk-DPIGYXSV.mjs} +1 -1
- package/dist/{chunk-LECZ5DPZ.cjs → chunk-DPYBVVL3.cjs} +2 -2
- package/dist/{chunk-RMOU3PR4.mjs → chunk-GUU3IZSM.mjs} +63 -23
- package/dist/{chunk-EDZU7YRK.mjs → chunk-IGXS54GC.mjs} +2 -2
- package/dist/{chunk-3WS5AZ3R.mjs → chunk-IYDJNCR7.mjs} +1 -1
- package/dist/{chunk-R7254L3R.mjs → chunk-J5ASGNKF.mjs} +23 -0
- package/dist/{chunk-75E5FDX2.mjs → chunk-JMFTKNBA.mjs} +10 -10
- package/dist/{chunk-DIHBWZDZ.cjs → chunk-JVA4PIYN.cjs} +408 -294
- package/dist/{chunk-XYVPTTUT.cjs → chunk-KEB7AGS6.cjs} +4 -4
- package/dist/{chunk-TLSSIYAL.mjs → chunk-KQAB5LML.mjs} +10 -3
- package/dist/{chunk-M6U6E4F7.cjs → chunk-KWST2O22.cjs} +108 -68
- package/dist/{chunk-NSZY3EWG.cjs → chunk-L6E4SHUB.cjs} +31 -8
- package/dist/{chunk-MZLJFNMH.cjs → chunk-MEJCP2LX.cjs} +1 -1
- package/dist/{chunk-A2TH5MKE.mjs → chunk-MITIAOUQ.mjs} +3 -3
- package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
- package/dist/{chunk-4AC4PXZO.cjs → chunk-N3XO5AL5.cjs} +2 -2
- package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
- package/dist/{chunk-32SYRIQ7.cjs → chunk-PLXD2MJV.cjs} +3 -3
- package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
- package/dist/{chunk-3EXCZJEN.mjs → chunk-QUFENL7Q.mjs} +1 -1
- package/dist/{chunk-NYF7A4UW.mjs → chunk-RJUCNO7R.mjs} +1 -1
- package/dist/{chunk-K4UGCUXX.cjs → chunk-SXMWVP2L.cjs} +7 -7
- package/dist/{chunk-VG6HYT5K.cjs → chunk-TP4RAV7Y.cjs} +9 -9
- package/dist/{chunk-I7NUT24Z.cjs → chunk-UISZLYKY.cjs} +2 -2
- package/dist/{chunk-KPMLDT3B.mjs → chunk-UQUOSNRN.mjs} +378 -264
- package/dist/{chunk-QZHTDVH4.mjs → chunk-V25GSH43.mjs} +1 -1
- package/dist/{chunk-65FPDDT4.cjs → chunk-VXB5CMNC.cjs} +2 -2
- package/dist/{chunk-5IJRJWJS.mjs → chunk-W2T6NDNP.mjs} +10 -0
- package/dist/{chunk-JRF2SKCD.mjs → chunk-X7LGLF33.mjs} +1 -1
- package/dist/{chunk-QEWWKYDL.cjs → chunk-YCNHUIPR.cjs} +17 -10
- package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
- package/dist/{chunk-A7HCBHMC.cjs → chunk-ZPUAOKHV.cjs} +3 -3
- package/dist/{client-component.d-Bk5qKJM-.d.mts → client-component.d-DwpH251K.d.mts} +2 -2
- package/dist/{client-component.d-DNbC4oWI.d.ts → client-component.d-fYupugbZ.d.ts} +2 -2
- package/dist/{client-plugins.d-DwUqh4gp.d.ts → client-plugins.d-BxqFfHpM.d.ts} +8 -5
- package/dist/{client-plugins.d-Pi9nG0W0.d.mts → client-plugins.d-k3bOT5gz.d.mts} +8 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-CB43AHEP.mjs → devtools-6MXPFPNJ.mjs} +2 -2
- package/dist/{devtools-L5DUNDF3.cjs → devtools-O5625KCK.cjs} +3 -3
- package/dist/docs.cjs +4 -4
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +3 -3
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{headers.d-CE6OWB-n.d.ts → headers.d-DalIGbVO.d.ts} +1 -1
- package/dist/{headers.d-DED1hHh4.d.mts → headers.d-sNT7ZQiU.d.mts} +1 -1
- package/dist/index.cjs +20 -18
- package/dist/{index.d-c9UwIqDy.d.ts → index.d-BcA-secm.d.ts} +1 -1
- package/dist/{index.d-CbvOjJcp.d.mts → index.d-DDHHAv7j.d.mts} +1 -1
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.mjs +19 -17
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.cjs +4 -2
- package/dist/internal/app-markdown-runtime.d.mts +11 -3
- package/dist/internal/app-markdown-runtime.d.ts +11 -3
- package/dist/internal/app-markdown-runtime.mjs +3 -1
- package/dist/internal/build-runtime.cjs +19 -19
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +18 -18
- package/dist/internal/cli-runtime.cjs +6 -4
- package/dist/internal/cli-runtime.mjs +5 -3
- 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 +4 -4
- package/dist/internal/client-runtime.d.ts +4 -4
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +4 -4
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +3 -3
- package/dist/internal/infra-analytics-runtime.cjs +7 -7
- package/dist/internal/infra-analytics-runtime.mjs +5 -5
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +6 -6
- package/dist/internal/production-runtime.d.mts +14 -9
- package/dist/internal/production-runtime.d.ts +14 -9
- package/dist/internal/production-runtime.mjs +5 -5
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/{mount.d-BvWxf8ZE.d.mts → mount.d-C1PONsEe.d.mts} +1 -1
- package/dist/{mount.d-DngLY7NL.d.ts → mount.d-D3JOux2V.d.ts} +1 -1
- package/dist/{navigation-delegate.d-CMyl1h2l.d.mts → navigation-delegate.d-CJQQHboA.d.mts} +1 -1
- package/dist/{navigation-delegate.d-zZogiDfa.d.ts → navigation-delegate.d-CQQPbdkE.d.ts} +1 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
- package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
- package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
- package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
- package/dist/plugin.cjs +13 -13
- package/dist/plugin.d.mts +4 -4
- package/dist/plugin.d.ts +4 -4
- package/dist/plugin.mjs +12 -12
- package/dist/{render-plan.d-Di1znBDW.d.mts → render-plan.d-CiUj0rq5.d.mts} +1 -1
- package/dist/{render-plan.d-DQj2bzd2.d.ts → render-plan.d-DHuJMJRP.d.ts} +1 -1
- package/dist/renderer-client.d.mts +4 -4
- package/dist/renderer-client.d.ts +4 -4
- package/dist/{request.d-CJWzfDYJ.d.mts → request.d-D-F7o7tb.d.mts} +1 -1
- package/dist/{request.d-C5vyoYeL.d.ts → request.d-DRUbOmYD.d.ts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-C-et2TZ1.d.mts → route-rendering.d-6smgwT2t.d.mts} +1 -1
- package/dist/{route-rendering.d-DhsY5M2I.d.ts → route-rendering.d-KwqM_mlK.d.ts} +1 -1
- package/dist/{router.d-CJB-Ntni.d.ts → router.d-B6sesMRD.d.ts} +1 -1
- package/dist/{router.d-BMDS5s5X.d.mts → router.d-BYmDeDlp.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-NJKLZ3YE.cjs → rsc-pipeline-P4PCWDO2.cjs} +4 -4
- package/dist/{rsc-pipeline-AXQJCCHI.mjs → rsc-pipeline-R2GOKIMU.mjs} +3 -3
- package/dist/{runtime-JXNEKOSE.mjs → runtime-DP5DYGW5.mjs} +3 -3
- package/dist/{runtime-DMW6DDOI.cjs → runtime-WA2Q4SLG.cjs} +5 -5
- package/dist/{runtime.d-BonodRI9.d.mts → runtime.d-BFSJf-ww.d.mts} +1 -1
- package/dist/{runtime.d-uw4123iI.d.ts → runtime.d-CbdMI0Oy.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +33 -33
- package/dist/server.d.mts +10 -10
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +15 -15
- package/dist/{spa-router.d-rha3M95y.d.mts → spa-router.d-D4EDwR20.d.mts} +2 -2
- package/dist/{spa-router.d-l0d9pPZj.d.ts → spa-router.d-mC1D5cTN.d.ts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils.d-BK-PTOF8.d.ts → utils.d-A2X3a6z_.d.ts} +1 -1
- package/dist/{utils.d-BzuTobEc.d.mts → utils.d-DxMzteqE.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +13 -13
- package/dist/vite.d.mts +7 -5
- package/dist/vite.d.ts +7 -5
- package/dist/vite.mjs +12 -12
- package/package.json +2 -2
- package/dist/analyzer-GUIRJWZH.cjs +0 -16
|
@@ -24,13 +24,14 @@ import {
|
|
|
24
24
|
generateFarmIntegrationProviderClientCode,
|
|
25
25
|
inferFarmIslandStrategy,
|
|
26
26
|
isFarmDocsClientConfigModule,
|
|
27
|
+
mergeFarmViteAlias,
|
|
27
28
|
redactFarmDocsClientConfig,
|
|
28
29
|
resolveDevGlobalStylesheetHref,
|
|
29
30
|
resolveFarmAppPackages,
|
|
30
31
|
resolveFarmClientCacheAdapterEntry,
|
|
31
32
|
resolveFarmImageProviderForRuntime,
|
|
32
33
|
resolveFarmRouteRootStrategy
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-GUU3IZSM.mjs";
|
|
34
35
|
import {
|
|
35
36
|
generateFarmClientPluginEntryCode,
|
|
36
37
|
hasFarmServerRuntimePlugins,
|
|
@@ -38,14 +39,14 @@ import {
|
|
|
38
39
|
} from "./chunk-I4KPA2C6.mjs";
|
|
39
40
|
import {
|
|
40
41
|
FARM_NODE_RESPONSE_END_PENDING
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-Z5ZZAGIH.mjs";
|
|
42
43
|
import {
|
|
43
44
|
resolveFarmPlatform
|
|
44
45
|
} from "./chunk-SMUW7UST.mjs";
|
|
45
46
|
import {
|
|
46
47
|
generateFarmTypeArtifacts,
|
|
47
48
|
resolveRouteRenderingConfig
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-W2T6NDNP.mjs";
|
|
49
50
|
import {
|
|
50
51
|
createFarmServerFnBoundaryModule,
|
|
51
52
|
isFarmServerFnBoundaryId,
|
|
@@ -79,13 +80,13 @@ import {
|
|
|
79
80
|
resolveFarmMCPRouteLabel,
|
|
80
81
|
resolveFarmMarkdownRouteLabel,
|
|
81
82
|
setFarmRouteLabel
|
|
82
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-MITIAOUQ.mjs";
|
|
83
84
|
import {
|
|
84
85
|
FARM_DEFAULT_MCP_PATH
|
|
85
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-JMFTKNBA.mjs";
|
|
86
87
|
import {
|
|
87
88
|
isFarmPreviewDeploymentEnvironment
|
|
88
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-V25GSH43.mjs";
|
|
89
90
|
import {
|
|
90
91
|
resolveFarmLayoutFonts
|
|
91
92
|
} from "./chunk-HZOMT5DY.mjs";
|
|
@@ -120,7 +121,7 @@ import {
|
|
|
120
121
|
rewriteFarmReactServerClientModuleImports,
|
|
121
122
|
rewriteFarmReactServerImports,
|
|
122
123
|
stripUseClientDirective
|
|
123
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-X7LGLF33.mjs";
|
|
124
125
|
import {
|
|
125
126
|
generateFarmDocsAdapterClientRuntime,
|
|
126
127
|
getFarmDocsAdapterConfigModule
|
|
@@ -134,7 +135,7 @@ import {
|
|
|
134
135
|
} from "./chunk-TPA2PV5J.mjs";
|
|
135
136
|
import {
|
|
136
137
|
resolveRouteRuleCorsPreflightHeaders
|
|
137
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-NLRAQXAA.mjs";
|
|
138
139
|
import {
|
|
139
140
|
FARM_DEVTOOLS_LAUNCH_PARAM,
|
|
140
141
|
FARM_DEVTOOLS_PATH,
|
|
@@ -177,7 +178,7 @@ import {
|
|
|
177
178
|
createFarmMarkdownSourceResponse,
|
|
178
179
|
isFarmMarkdownPageFile,
|
|
179
180
|
normalizeFarmMarkdownRoutePath
|
|
180
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-J5ASGNKF.mjs";
|
|
181
182
|
import {
|
|
182
183
|
FARM_MARKDOWN_CONTENT_TYPE,
|
|
183
184
|
createFarmMarkdownErrorBody,
|
|
@@ -278,7 +279,7 @@ import {
|
|
|
278
279
|
} from "./chunk-2DA7CLY7.mjs";
|
|
279
280
|
import {
|
|
280
281
|
FARM_VERSION
|
|
281
|
-
} from "./chunk-
|
|
282
|
+
} from "./chunk-RJUCNO7R.mjs";
|
|
282
283
|
import {
|
|
283
284
|
toFarmTrailingSlashPageRequest
|
|
284
285
|
} from "./chunk-4O26BPUY.mjs";
|
|
@@ -329,6 +330,7 @@ import { createHash } from "crypto";
|
|
|
329
330
|
import { transformActions } from "@farm.js/islx/compiler";
|
|
330
331
|
import path from "path";
|
|
331
332
|
function transformFarmFormActionModule(options) {
|
|
333
|
+
const runtimeModule = options.runtimeModule ?? ((specifier) => specifier);
|
|
332
334
|
const result = transformActions({
|
|
333
335
|
code: options.code,
|
|
334
336
|
id: options.id,
|
|
@@ -336,8 +338,8 @@ function transformFarmFormActionModule(options) {
|
|
|
336
338
|
environment: options.ssr ? "server" : "client",
|
|
337
339
|
parse: options.parse,
|
|
338
340
|
runtime: {
|
|
339
|
-
server: "@farm.js/core/internal/islx-server",
|
|
340
|
-
client: "@farm.js/core/internal/islx-client"
|
|
341
|
+
server: runtimeModule("@farm.js/core/internal/islx-server"),
|
|
342
|
+
client: runtimeModule("@farm.js/core/internal/islx-client")
|
|
341
343
|
}
|
|
342
344
|
});
|
|
343
345
|
return result ? result.code : null;
|
|
@@ -503,7 +505,7 @@ function createFarmDevViteCorsMiddleware() {
|
|
|
503
505
|
// src/vite.ts
|
|
504
506
|
import * as fs2 from "fs";
|
|
505
507
|
import * as path6 from "path";
|
|
506
|
-
import { pathToFileURL } from "url";
|
|
508
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
507
509
|
|
|
508
510
|
// src/dev-static.ts
|
|
509
511
|
import * as fs from "fs";
|
|
@@ -893,7 +895,7 @@ var REACT_CACHE_APIS = {
|
|
|
893
895
|
cache: REACT_CACHE_LOCAL,
|
|
894
896
|
cacheSignal: "__farm_react_cache_signal__"
|
|
895
897
|
};
|
|
896
|
-
function rewriteFarmReactCacheImport(code, file) {
|
|
898
|
+
function rewriteFarmReactCacheImport(code, file, cacheModule = FARM_REACT_CACHE_MODULE) {
|
|
897
899
|
if (!code.includes("cache") || !code.includes("react")) return null;
|
|
898
900
|
const extension = path5.extname(file).slice(1);
|
|
899
901
|
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
|
|
@@ -934,7 +936,7 @@ function rewriteFarmReactCacheImport(code, file) {
|
|
|
934
936
|
].join(", ");
|
|
935
937
|
const lines = [
|
|
936
938
|
...clause ? [`import ${clause} from "react";`] : [],
|
|
937
|
-
`import { ${caches.map((specifier) => `${specifier.imported?.name ?? specifier.imported?.value} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(
|
|
939
|
+
`import { ${caches.map((specifier) => `${specifier.imported?.name ?? specifier.imported?.value} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
|
|
938
940
|
];
|
|
939
941
|
edits.push({ start: node.start, end: node.end, text: lines.join("\n") });
|
|
940
942
|
}
|
|
@@ -966,7 +968,7 @@ function rewriteFarmReactCacheImport(code, file) {
|
|
|
966
968
|
start: memberImportAt,
|
|
967
969
|
end: memberImportAt,
|
|
968
970
|
text: `
|
|
969
|
-
import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(
|
|
971
|
+
import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
|
|
970
972
|
});
|
|
971
973
|
}
|
|
972
974
|
}
|
|
@@ -1071,7 +1073,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
1071
1073
|
return import("./workflows.mjs");
|
|
1072
1074
|
}
|
|
1073
1075
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
1074
|
-
return import("./devtools-
|
|
1076
|
+
return import("./devtools-6MXPFPNJ.mjs");
|
|
1075
1077
|
}
|
|
1076
1078
|
function loadFarmDevtoolsUIRuntime() {
|
|
1077
1079
|
return import("./devtools-ui-CYBVFLPH.mjs");
|
|
@@ -1332,7 +1334,7 @@ async function proxyFarmExternalRewrite(req, res, bodySizeLimit) {
|
|
|
1332
1334
|
let request = createRequestFromNodeRequest(req, new URL(destination));
|
|
1333
1335
|
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
1334
1336
|
const body = await readNodeRequestBody(req, bodySizeLimit);
|
|
1335
|
-
request = new Request(request, { body: toRequestBody(body) });
|
|
1337
|
+
request = new Request(request, { method: request.method, body: toRequestBody(body) });
|
|
1336
1338
|
}
|
|
1337
1339
|
await sendWebResponse(res, await fetchFarmExternalRewrite(request));
|
|
1338
1340
|
return true;
|
|
@@ -1798,13 +1800,18 @@ function rewriteEarlySsrRelativeImports(options) {
|
|
|
1798
1800
|
return output + options.code.slice(copied);
|
|
1799
1801
|
}
|
|
1800
1802
|
function transformIsolatedClientBoundaryModule(options) {
|
|
1803
|
+
const runtimeModule = options.runtimeModule ?? ((specifier) => specifier);
|
|
1804
|
+
const islxReact = JSON.stringify(runtimeModule("@farm.js/core/internal/islx-react"));
|
|
1805
|
+
const isolatedBoundary = JSON.stringify(
|
|
1806
|
+
runtimeModule("@farm.js/core/internal/isolated-boundary")
|
|
1807
|
+
);
|
|
1801
1808
|
if (options.slots) {
|
|
1802
1809
|
try {
|
|
1803
1810
|
const rewritten = rewriteFormStatusImports({
|
|
1804
1811
|
code: options.code,
|
|
1805
1812
|
id: options.moduleReference,
|
|
1806
1813
|
parse: options.parse,
|
|
1807
|
-
from: "@farm.js/core/internal/islx-react"
|
|
1814
|
+
from: runtimeModule("@farm.js/core/internal/islx-react")
|
|
1808
1815
|
});
|
|
1809
1816
|
if (rewritten) options = { ...options, code: rewritten.code };
|
|
1810
1817
|
} catch {
|
|
@@ -1916,10 +1923,10 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1916
1923
|
output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
|
|
1917
1924
|
}
|
|
1918
1925
|
const isComponent = `(value) => typeof value === "function" || (typeof value === "object" && value !== null && [Symbol.for("react.memo"), Symbol.for("react.forward_ref"), Symbol.for("react.lazy")].includes(value.$$typeof))`;
|
|
1919
|
-
const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from
|
|
1926
|
+
const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from ${islxReact};
|
|
1920
1927
|
const __farm_is_component__ = ${isComponent};
|
|
1921
1928
|
const __farm_islx_island__ = (component, ...rest) => __farm_is_component__(component) ? __farm_islx_create_island__(component, ...rest) : component;` : `import * as __farm_isolated_react__ from "react";
|
|
1922
|
-
import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from
|
|
1929
|
+
import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from ${isolatedBoundary};
|
|
1923
1930
|
const __farm_is_component__ = ${isComponent};
|
|
1924
1931
|
const __farm_create_isolated_boundary__ = (react, component, ...rest) => __farm_is_component__(component) ? __farm_create_boundary__(react, component, ...rest) : component;`;
|
|
1925
1932
|
return `${runtimeImport}
|
|
@@ -1975,11 +1982,32 @@ function warnClientBoundaryOnce(context, id, code, config) {
|
|
|
1975
1982
|
function shouldEmitFarmClientRootHmr(renderer) {
|
|
1976
1983
|
return getFarmRendererCapabilities(resolveFarmRenderer(renderer)).reconcilesRerenders;
|
|
1977
1984
|
}
|
|
1978
|
-
|
|
1985
|
+
var FARM_RUNTIME_MODULE_PREFIX = "/@farm/runtime/";
|
|
1986
|
+
function toFarmRuntimeModuleId(specifier) {
|
|
1987
|
+
return FARM_RUNTIME_MODULE_PREFIX + specifier;
|
|
1988
|
+
}
|
|
1989
|
+
function getFarmCoreFile() {
|
|
1990
|
+
return typeof __filename === "string" ? __filename : fileURLToPath(import.meta.url);
|
|
1991
|
+
}
|
|
1992
|
+
var FARM_SOURCE_ALIAS_PROBES = [
|
|
1993
|
+
"@/x",
|
|
1994
|
+
"@/index.ts",
|
|
1995
|
+
"@/components/button",
|
|
1996
|
+
"@/lib/utils/format.ts",
|
|
1997
|
+
"@/__farm__/probe"
|
|
1998
|
+
];
|
|
1999
|
+
function matchesViteAlias(find, specifier) {
|
|
2000
|
+
if (typeof find === "string") return specifier === find || specifier.startsWith(`${find}/`);
|
|
2001
|
+
find.lastIndex = 0;
|
|
2002
|
+
const matched = find.test(specifier);
|
|
2003
|
+
find.lastIndex = 0;
|
|
2004
|
+
return matched;
|
|
2005
|
+
}
|
|
2006
|
+
function hasFarmSourceAliasOverride(alias) {
|
|
1979
2007
|
if (!alias) return false;
|
|
1980
|
-
|
|
1981
|
-
return
|
|
1982
|
-
(
|
|
2008
|
+
const finds = Array.isArray(alias) ? alias.map((entry) => entry.find) : Object.keys(alias);
|
|
2009
|
+
return finds.some(
|
|
2010
|
+
(find) => FARM_SOURCE_ALIAS_PROBES.every((probe) => matchesViteAlias(find, probe))
|
|
1983
2011
|
);
|
|
1984
2012
|
}
|
|
1985
2013
|
function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
|
|
@@ -2024,13 +2052,25 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
|
|
|
2024
2052
|
console.log(log);
|
|
2025
2053
|
};
|
|
2026
2054
|
const getProgrammaticClientRoutes = () => options.programmaticClientRoutes ?? farmApp?.getRouteManager().getProgrammaticClientRoutes();
|
|
2055
|
+
const isOutsideAppRoot = (file) => {
|
|
2056
|
+
const root = farmApp?.getConfig().root || server?.config.root || options.root;
|
|
2057
|
+
if (!root) return false;
|
|
2058
|
+
const relative4 = path6.relative(root, file.split("?", 1)[0]);
|
|
2059
|
+
return relative4.startsWith("..") || path6.isAbsolute(relative4);
|
|
2060
|
+
};
|
|
2027
2061
|
const plugin = {
|
|
2028
2062
|
name: "farm",
|
|
2029
2063
|
api: { getProgrammaticClientRoutes },
|
|
2030
2064
|
config(userConfig, configEnv) {
|
|
2031
2065
|
isBuild = configEnv.command === "build";
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2066
|
+
const farmAliases = {
|
|
2067
|
+
...getFarmLayerAliases(options.layers),
|
|
2068
|
+
...hasFarmSourceAliasOverride(userConfig.resolve?.alias) ? {} : createFarmSourceAlias(options.root || process.cwd(), options.srcDir)
|
|
2069
|
+
};
|
|
2070
|
+
if (Object.keys(farmAliases).length > 0) {
|
|
2071
|
+
userConfig.resolve ?? (userConfig.resolve = {});
|
|
2072
|
+
userConfig.resolve.alias = mergeFarmViteAlias(farmAliases, userConfig.resolve.alias);
|
|
2073
|
+
}
|
|
2034
2074
|
const layerRoots = (options.layers ?? []).map((layer) => layer.root);
|
|
2035
2075
|
farmOwnsDevCors = !isBuild && userConfig.server?.cors === void 0;
|
|
2036
2076
|
return {
|
|
@@ -2041,9 +2081,6 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
|
|
|
2041
2081
|
// Keep development module ownership explicit; the RSC plugin adds its
|
|
2042
2082
|
// environment only when enabled. Production environment setup is unchanged.
|
|
2043
2083
|
...!isBuild ? { environments: { client: {}, ssr: {} } } : {},
|
|
2044
|
-
resolve: {
|
|
2045
|
-
alias: { ...layerAliases, ...sourceAlias }
|
|
2046
|
-
},
|
|
2047
2084
|
server: {
|
|
2048
2085
|
...farmOwnsDevCors ? { cors: false } : {},
|
|
2049
2086
|
fs: {
|
|
@@ -2814,8 +2851,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2814
2851
|
const runtimeHookErrorAnswersJSON = rendererDisabled || isFarmAPIPathname(requestPathname, apiServerBasePath);
|
|
2815
2852
|
const requestedPagePathname = configRewriteSource === void 0 ? requestPathname : new URL(configRewriteSource).pathname;
|
|
2816
2853
|
let pageHookRouteMatch;
|
|
2817
|
-
const pageHookRoute = (
|
|
2818
|
-
if (pageHookRouteMatch
|
|
2854
|
+
const pageHookRoute = () => {
|
|
2855
|
+
if (pageHookRouteMatch) return pageHookRouteMatch;
|
|
2856
|
+
const pathname2 = requestedPagePathname;
|
|
2819
2857
|
const match = farmApp.getRouteManager().matchRoute(pathname2);
|
|
2820
2858
|
pageHookRouteMatch = {
|
|
2821
2859
|
render: {
|
|
@@ -2828,13 +2866,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2828
2866
|
};
|
|
2829
2867
|
return pageHookRouteMatch;
|
|
2830
2868
|
};
|
|
2831
|
-
const
|
|
2869
|
+
const matchAppMetadataRoute = (pathname2) => {
|
|
2870
|
+
const routeManager3 = farmApp.getRouteManager();
|
|
2871
|
+
const image = routeManager3.matchMetadataImage(pathname2);
|
|
2872
|
+
if (image) return { pattern: image.image.pattern, params: image.params };
|
|
2873
|
+
const metadata = routeManager3.matchMetadataRoute(pathname2);
|
|
2874
|
+
return metadata ? { pattern: metadata.metadata.pattern, params: metadata.params } : null;
|
|
2875
|
+
};
|
|
2876
|
+
const runFarmDevPageHooks = async () => {
|
|
2832
2877
|
if (!pm || !pm.hasHook("beforeRouteMatch") && !pm.hasHook("afterRouteMatch") && !pm.hasHook("beforeRender")) {
|
|
2833
2878
|
return;
|
|
2834
2879
|
}
|
|
2835
|
-
const { render, layoutPatterns } = pageHookRoute(
|
|
2836
|
-
|
|
2837
|
-
if (routeManager3.matchMetadataRoute(render.pathname) || routeManager3.matchMetadataImage(render.pathname) || // A path no page route matches is a page only for a GET or HEAD request.
|
|
2880
|
+
const { render, layoutPatterns } = pageHookRoute();
|
|
2881
|
+
if (matchAppMetadataRoute(render.pathname) || // A path no page route matches is a page only for a GET or HEAD request.
|
|
2838
2882
|
!render.routePattern && requestMethod !== "GET" && requestMethod !== "HEAD") {
|
|
2839
2883
|
return;
|
|
2840
2884
|
}
|
|
@@ -2851,15 +2895,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2851
2895
|
});
|
|
2852
2896
|
await pm.runHookParallel("beforeRender", render);
|
|
2853
2897
|
};
|
|
2854
|
-
|
|
2855
|
-
|
|
2898
|
+
const meetsRequestedURLRoutes = configRewriteSource === void 0 && !deferredDottedRequests.has(req);
|
|
2899
|
+
const routeRedirect = meetsRequestedURLRoutes ? farmApp.getRouteManager().matchRedirect(requestPathname, parsedRequestUrl.search) : null;
|
|
2900
|
+
if (meetsRequestedURLRoutes && (routeRedirect || pm && (configRoutePlugins.has(FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0)) && !isViteOwnedRequest()) {
|
|
2901
|
+
let redirect = routeRedirect;
|
|
2856
2902
|
try {
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2903
|
+
if (pm) {
|
|
2904
|
+
await pm.runHookParallelFiltered(
|
|
2905
|
+
"beforeRequest",
|
|
2906
|
+
(plugin2) => plugin2.name === FARM_CONFIG_HEADERS_PLUGIN_NAME,
|
|
2907
|
+
req,
|
|
2908
|
+
res
|
|
2909
|
+
);
|
|
2910
|
+
}
|
|
2863
2911
|
for (const matchRedirect of configRedirectMatchers) {
|
|
2864
2912
|
redirect ?? (redirect = matchRedirect(parsedRequestUrl));
|
|
2865
2913
|
}
|
|
@@ -2877,17 +2925,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2877
2925
|
status: redirect.statusCode,
|
|
2878
2926
|
headers: { Location: redirect.destination }
|
|
2879
2927
|
});
|
|
2880
|
-
if (opensFarmDevRuntimeSession(pm)) {
|
|
2928
|
+
if (pm && opensFarmDevRuntimeSession(pm)) {
|
|
2881
2929
|
const redirectResponse = response;
|
|
2882
2930
|
try {
|
|
2883
|
-
const
|
|
2931
|
+
const metadataRoute = matchAppMetadataRoute(requestPathname);
|
|
2932
|
+
const kind = metadataRoute ? "asset" : isFarmAPIPathname(requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
|
|
2884
2933
|
response = await pm.runRuntimeRequest(
|
|
2885
2934
|
createRequestFromNodeRequest(req, parsedRequestUrl),
|
|
2886
2935
|
async () => {
|
|
2887
2936
|
if (kind === "page") await runFarmDevPageHooks();
|
|
2888
2937
|
return redirectResponse;
|
|
2889
2938
|
},
|
|
2890
|
-
{ kind, route: { pathname: requestPathname } }
|
|
2939
|
+
{ kind, route: { pathname: requestPathname, ...metadataRoute } }
|
|
2891
2940
|
);
|
|
2892
2941
|
} catch {
|
|
2893
2942
|
sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
|
|
@@ -3541,13 +3590,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3541
3590
|
if (await tryConfiguredIntegrationRoute()) {
|
|
3542
3591
|
return;
|
|
3543
3592
|
}
|
|
3544
|
-
const redirectMatch = farmApp.getRouteManager().matchRedirect(requestPathname, parsedRequestUrl.search);
|
|
3545
|
-
if (redirectMatch) {
|
|
3546
|
-
res.statusCode = redirectMatch.statusCode;
|
|
3547
|
-
res.setHeader("Location", redirectMatch.destination);
|
|
3548
|
-
res.end(`Redirecting to ${redirectMatch.destination}`);
|
|
3549
|
-
return;
|
|
3550
|
-
}
|
|
3551
3593
|
const matchedApiRoute = apiRouteManager.matchRoute(requestPathname);
|
|
3552
3594
|
const hasMatchedApiRoute = Boolean(matchedApiRoute);
|
|
3553
3595
|
if (hasMatchedApiRoute || isFarmAPIPathname(requestPathname, apiServerBasePath)) {
|
|
@@ -4218,7 +4260,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
4218
4260
|
const hasHTMLTransformHook = (pm?.hasHook("transformHTML") ?? false) || (pm?.hasHook("afterRender") ?? false);
|
|
4219
4261
|
const opensRuntimeSession = pm ? opensFarmDevRuntimeSession(pm) : false;
|
|
4220
4262
|
const hasRuntimeAfterHook = pm?.hasRuntimeHook("after") ?? false;
|
|
4221
|
-
const requestedMatch = routeManager2.matchRoute(requestedPathname);
|
|
4222
4263
|
const pageBuiltInRouteLabel = (pathname2) => {
|
|
4223
4264
|
const routePathname = stripFarmBasePath(pathname2, farmConfig.basePath);
|
|
4224
4265
|
const mcpLabel = resolveFarmMCPRouteLabel(routePathname, apiServerBasePath);
|
|
@@ -4226,34 +4267,37 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
4226
4267
|
if (farmAgentGeneratedPaths(farmConfig).includes(routePathname)) return routePathname;
|
|
4227
4268
|
return routePathname === FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? FARM_DEFAULT_MCP_PATH : null;
|
|
4228
4269
|
};
|
|
4270
|
+
const pageRuntimeOptions = (pathname2) => {
|
|
4271
|
+
const match = routeManager2.matchRoute(pathname2);
|
|
4272
|
+
return {
|
|
4273
|
+
kind: "page",
|
|
4274
|
+
route: setFarmRouteLabel(
|
|
4275
|
+
{
|
|
4276
|
+
pathname: pathname2,
|
|
4277
|
+
pattern: match?.route?.pattern || null,
|
|
4278
|
+
params: match?.params || {}
|
|
4279
|
+
},
|
|
4280
|
+
match?.route ? null : pageBuiltInRouteLabel(pathname2)
|
|
4281
|
+
)
|
|
4282
|
+
};
|
|
4283
|
+
};
|
|
4229
4284
|
let runtimeSession;
|
|
4230
4285
|
let pathname = requestedPathname;
|
|
4231
|
-
let pageHookPathname = requestedPagePathname;
|
|
4232
4286
|
if (pm && opensRuntimeSession) {
|
|
4233
4287
|
try {
|
|
4234
|
-
const
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
pathname: requestedPathname,
|
|
4239
|
-
pattern: requestedMatch?.route?.pattern || null,
|
|
4240
|
-
params: requestedMatch?.params || {}
|
|
4241
|
-
},
|
|
4242
|
-
requestedMatch?.route ? null : pageBuiltInRouteLabel(requestedPathname)
|
|
4243
|
-
)
|
|
4244
|
-
};
|
|
4288
|
+
const metadataRoute = configRewriteSource === void 0 ? matchAppMetadataRoute(requestedPathname) : null;
|
|
4289
|
+
const sessionOptions = metadataRoute ? { kind: "asset", route: { pathname: requestedPathname, ...metadataRoute } } : pageRuntimeOptions(
|
|
4290
|
+
configRewriteSource === void 0 ? requestedPathname : requestedPagePathname
|
|
4291
|
+
);
|
|
4245
4292
|
runtimeSession = await pm.beginRuntimeRequest(
|
|
4246
4293
|
createRequestFromNodeRequest(req, new URL(configRewriteSource ?? fullUrl)),
|
|
4247
4294
|
sessionOptions
|
|
4248
4295
|
);
|
|
4249
|
-
if (!runtimeSession.response)
|
|
4250
|
-
pageHookPathname = configRewriteSource === void 0 ? new URL(runtimeSession.request.url).pathname : requestedPagePathname;
|
|
4251
|
-
await runFarmDevPageHooks(pageHookPathname);
|
|
4252
|
-
}
|
|
4296
|
+
if (!runtimeSession.response) await runFarmDevPageHooks();
|
|
4253
4297
|
const routedRequest = runtimeSession.response ?? (configRewriteSource === void 0 ? runtimeSession.request : await pm.runRuntimeBeforeForRewrite(
|
|
4254
4298
|
runtimeSession.request,
|
|
4255
4299
|
createRequestFromNodeRequest(req, new URL(fullUrl)),
|
|
4256
|
-
|
|
4300
|
+
pageRuntimeOptions(requestedPathname)
|
|
4257
4301
|
));
|
|
4258
4302
|
if (routedRequest instanceof Response) {
|
|
4259
4303
|
const response = await pm.endRuntimeRequest(runtimeSession, routedRequest);
|
|
@@ -4284,7 +4328,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
4284
4328
|
};
|
|
4285
4329
|
if (!runtimeSession) {
|
|
4286
4330
|
try {
|
|
4287
|
-
await runFarmDevPageHooks(
|
|
4331
|
+
await runFarmDevPageHooks();
|
|
4288
4332
|
} catch (error) {
|
|
4289
4333
|
await failPageHook(error);
|
|
4290
4334
|
return;
|
|
@@ -4302,7 +4346,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
4302
4346
|
hasAfterResponseHook,
|
|
4303
4347
|
hasHTMLTransformHook,
|
|
4304
4348
|
// render.html gets the render info render.before got.
|
|
4305
|
-
renderPayload: pageHookRoute(
|
|
4349
|
+
renderPayload: pageHookRoute().render,
|
|
4306
4350
|
method,
|
|
4307
4351
|
urlPath,
|
|
4308
4352
|
pathname,
|
|
@@ -4401,15 +4445,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
4401
4445
|
};
|
|
4402
4446
|
},
|
|
4403
4447
|
async resolveId(id, importer, resolveOptions) {
|
|
4404
|
-
if (id.startsWith(
|
|
4448
|
+
if (id.startsWith(FARM_RUNTIME_MODULE_PREFIX)) {
|
|
4449
|
+
return this.resolve(id.slice(FARM_RUNTIME_MODULE_PREFIX.length), getFarmCoreFile(), {
|
|
4450
|
+
...resolveOptions,
|
|
4451
|
+
skipSelf: true
|
|
4452
|
+
});
|
|
4453
|
+
}
|
|
4454
|
+
if (id.startsWith("@farm.js/core/internal/") && importer && isOutsideAppRoot(importer)) {
|
|
4405
4455
|
const root = farmApp?.getConfig().root || server?.config.root || options.root;
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
skipSelf: true
|
|
4411
|
-
});
|
|
4412
|
-
}
|
|
4456
|
+
return this.resolve(id, path6.join(root, "package.json"), {
|
|
4457
|
+
...resolveOptions,
|
|
4458
|
+
skipSelf: true
|
|
4459
|
+
});
|
|
4413
4460
|
}
|
|
4414
4461
|
if (typeof fontImports.resolveId === "function") {
|
|
4415
4462
|
const fontId = await fontImports.resolveId.call(this, id, importer, resolveOptions);
|
|
@@ -4600,6 +4647,7 @@ export const manifest = getManifest();
|
|
|
4600
4647
|
if (pendingClientSetup && !transformOptions?.ssr && !farmSetupContext.getStore()) {
|
|
4601
4648
|
await pendingClientSetup;
|
|
4602
4649
|
}
|
|
4650
|
+
const runtimeModule = !isBuild && transformOptions?.ssr === true && isOutsideAppRoot(id) ? toFarmRuntimeModuleId : void 0;
|
|
4603
4651
|
const actionConfig = farmApp?.getConfig() ?? options;
|
|
4604
4652
|
let rewrotePackageImports = false;
|
|
4605
4653
|
if (resolveFarmServerComponentsMode(actionConfig.experimental?.serverComponents) === "islands" && (!id.includes("/node_modules/") || transformOptions?.ssr === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !hasUseClientDirective(code)) {
|
|
@@ -4645,7 +4693,11 @@ export const manifest = getManifest();
|
|
|
4645
4693
|
rewrotePackageImports = true;
|
|
4646
4694
|
}
|
|
4647
4695
|
if (transformOptions?.ssr === true) {
|
|
4648
|
-
const cached = rewriteFarmReactCacheImport(
|
|
4696
|
+
const cached = rewriteFarmReactCacheImport(
|
|
4697
|
+
code,
|
|
4698
|
+
file,
|
|
4699
|
+
runtimeModule?.(FARM_REACT_CACHE_MODULE)
|
|
4700
|
+
);
|
|
4649
4701
|
if (cached !== null) {
|
|
4650
4702
|
code = cached;
|
|
4651
4703
|
rewrotePackageImports = true;
|
|
@@ -4669,7 +4721,8 @@ export const manifest = getManifest();
|
|
|
4669
4721
|
root: actionConfig.root || server?.config.root || process.cwd(),
|
|
4670
4722
|
ssr: transformOptions?.ssr === true,
|
|
4671
4723
|
// Parsed by file type: page components are TSX.
|
|
4672
|
-
parse: (source) => parseSync(file, source).program
|
|
4724
|
+
parse: (source) => parseSync(file, source).program,
|
|
4725
|
+
runtimeModule
|
|
4673
4726
|
});
|
|
4674
4727
|
if (actionModule) return { code: actionModule, map: null };
|
|
4675
4728
|
}
|
|
@@ -4756,7 +4809,8 @@ export const manifest = getManifest();
|
|
|
4756
4809
|
parse: (source) => this.parse(source),
|
|
4757
4810
|
slots: islandsMode,
|
|
4758
4811
|
browser: transformOptions?.ssr !== true,
|
|
4759
|
-
inferredInteraction: inference?.strategy === "interaction"
|
|
4812
|
+
inferredInteraction: inference?.strategy === "interaction",
|
|
4813
|
+
runtimeModule
|
|
4760
4814
|
});
|
|
4761
4815
|
if (!transformedBoundary) {
|
|
4762
4816
|
this.error(
|
|
@@ -5641,7 +5695,8 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
5641
5695
|
return await createFarmServerTreeElement(React, source, {
|
|
5642
5696
|
load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
|
|
5643
5697
|
ServerHtml: FarmServerPage,
|
|
5644
|
-
key:
|
|
5698
|
+
// No key: the next page of the same layout updates this one in place, as React Server
|
|
5699
|
+
// Components do, instead of unmounting it and building every node again.
|
|
5645
5700
|
});
|
|
5646
5701
|
} catch (error) {
|
|
5647
5702
|
console.warn('[Farm.js] Could not rebuild the server tree of ' + pathname + '; its server HTML was kept.', error);
|