@farm.js/core 0.1.41 → 0.1.43
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-BOqIxJLI.d.mts → agent-mcp-3KDz4hr9.d.mts} +1 -1
- package/dist/{agent-mcp-D0eZKfci.d.ts → agent-mcp-6yRebHk7.d.ts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +2 -2
- package/dist/api.d.mts +8 -3
- package/dist/api.d.ts +8 -3
- package/dist/api.mjs +1 -1
- package/dist/{app-DM8e1z3G.d.ts → app-8Db1zR-2.d.ts} +8 -4
- package/dist/{app-CzTSMJaf.d.mts → app-DlTWv4cn.d.mts} +8 -4
- package/dist/app-manifest-TRzS7ZZ9.d.mts +120 -0
- package/dist/app-manifest-cO2jkG1F.d.ts +120 -0
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{chunk-ECKF2BAM.cjs → chunk-2GVF3C2F.cjs} +255 -42
- package/dist/chunk-2NXO5SBY.mjs +57 -0
- package/dist/chunk-3BROEWFY.cjs +39 -0
- package/dist/{chunk-ENOBPDKZ.mjs → chunk-4MRQ5OKQ.mjs} +14 -9
- package/dist/{chunk-R65GCA6A.mjs → chunk-4OCEMK72.mjs} +260 -49
- package/dist/{chunk-6PKXK4TY.mjs → chunk-53ZV6K65.mjs} +1 -1
- package/dist/{chunk-LYIZHJTK.cjs → chunk-5LPHJZSI.cjs} +14 -14
- package/dist/chunk-5NIWBWDD.mjs +97 -0
- package/dist/{chunk-NRDBW4MP.mjs → chunk-7IQQIPRZ.mjs} +10 -0
- package/dist/{chunk-FJGIVDA5.mjs → chunk-7SCCY6SI.mjs} +80 -177
- package/dist/chunk-APDGOKKE.cjs +148 -0
- package/dist/chunk-AZBSVLRM.cjs +132 -0
- package/dist/{chunk-PN676AZF.cjs → chunk-BKPXWRTT.cjs} +6 -6
- package/dist/chunk-CEDPEDNW.cjs +98 -0
- package/dist/chunk-D5RFPV2H.mjs +148 -0
- package/dist/{chunk-BYQVROIP.mjs → chunk-DMRPN25V.mjs} +69 -0
- package/dist/{chunk-724JLMS4.mjs → chunk-F646BZ4Y.mjs} +4 -2
- package/dist/{chunk-C5KVWHIH.cjs → chunk-G2Z5DGMS.cjs} +5 -3
- package/dist/{chunk-L6HYACBE.cjs → chunk-GVNCWSQV.cjs} +145 -127
- package/dist/{chunk-24SP5TGU.mjs → chunk-H4LXPWI2.mjs} +2 -2
- package/dist/chunk-H7BLEEAE.cjs +57 -0
- package/dist/{chunk-JOTUZIM4.cjs → chunk-HUMEHX24.cjs} +2 -2
- package/dist/{chunk-BD3D7EZV.cjs → chunk-IXFOBGLQ.cjs} +9 -3
- package/dist/{chunk-3TB5QGUW.cjs → chunk-JAXDRRRC.cjs} +70 -1
- package/dist/{chunk-32TZ3QTP.cjs → chunk-JDJAPCR2.cjs} +421 -210
- package/dist/{chunk-MHN4UR5U.cjs → chunk-KFZZFZ7J.cjs} +7 -7
- package/dist/chunk-LRJRXXQZ.cjs +109 -0
- package/dist/{chunk-EX4MKHXN.cjs → chunk-LVABUXLA.cjs} +22 -17
- package/dist/{chunk-HCSVR4YZ.mjs → chunk-M3BXTWJM.mjs} +18 -0
- package/dist/{chunk-PYHPXPSW.mjs → chunk-NXO75WY4.mjs} +1 -1
- package/dist/{chunk-BGGWKZ2V.mjs → chunk-OYSGGV6O.mjs} +137 -167
- package/dist/{chunk-JR4QCLJY.cjs → chunk-PDU4P2IC.cjs} +19 -1
- package/dist/chunk-PJEHUSHA.mjs +229 -0
- package/dist/chunk-QGH2RQVF.mjs +132 -0
- package/dist/{chunk-YWMZUGIS.mjs → chunk-R3ZFQJEF.mjs} +247 -34
- package/dist/{chunk-ROQ4C4LJ.cjs → chunk-RACQTC7K.cjs} +274 -371
- package/dist/{chunk-WSOBCAYO.cjs → chunk-RQYTOFQM.cjs} +23 -23
- package/dist/chunk-S34OBRMZ.mjs +109 -0
- package/dist/{chunk-TS4JHGUJ.mjs → chunk-S3ZEMCE6.mjs} +9 -3
- package/dist/{chunk-WWFTAUFG.cjs → chunk-SBH2JLLF.cjs} +12 -2
- package/dist/{chunk-YSLWRWWP.cjs → chunk-SKK6UF5P.cjs} +200 -46
- package/dist/chunk-T7J7E63D.cjs +144 -0
- package/dist/{chunk-SVPGWJZF.mjs → chunk-TESO7EFU.mjs} +125 -107
- package/dist/{chunk-OQ4YXWH4.cjs → chunk-VIVQERJ5.cjs} +320 -351
- package/dist/{chunk-JIYYX7WU.mjs → chunk-VLXNGUKO.mjs} +1 -1
- package/dist/{chunk-OFZUJMCU.mjs → chunk-WPJQN64R.mjs} +195 -41
- package/dist/chunk-XARSG2TG.mjs +144 -0
- package/dist/chunk-XUGFRFD2.mjs +39 -0
- package/dist/{chunk-EH3464KF.cjs → chunk-YBDSTNMH.cjs} +1 -1
- package/dist/{chunk-VLPII2JJ.mjs → chunk-YGZH4T2X.mjs} +1 -1
- package/dist/chunk-YKUEJ3MG.cjs +229 -0
- package/dist/{chunk-4C7KTKX7.mjs → chunk-ZYWJIPKQ.mjs} +1 -1
- package/dist/{client-plugins-CkYwvDJ0.d.mts → client-plugins-Cv0OJtnM.d.mts} +98 -7
- package/dist/{client-plugins-DfeKd0sD.d.ts → client-plugins-kwQuZcWq.d.ts} +98 -7
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +4 -3
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +3 -2
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-N3QLRIQU.mjs → devtools-M22FEFPK.mjs} +4 -4
- package/dist/{devtools-2YHAJYH6.cjs → devtools-MLB3JJMC.cjs} +5 -5
- package/dist/docs.cjs +6 -6
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +5 -5
- package/dist/index-CQOp8EmB.d.mts +48 -0
- package/dist/index-DAl0QTZS.d.ts +48 -0
- package/dist/index.cjs +41 -24
- package/dist/index.d.mts +15 -14
- package/dist/index.d.ts +15 -14
- package/dist/index.mjs +46 -29
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +29 -15
- package/dist/internal/build-runtime.d.mts +12 -16
- package/dist/internal/build-runtime.d.ts +12 -16
- package/dist/internal/build-runtime.mjs +28 -14
- package/dist/internal/cli-runtime.cjs +23 -11
- package/dist/internal/cli-runtime.mjs +23 -11
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +5 -1
- package/dist/internal/client-runtime.d.mts +1 -0
- package/dist/internal/client-runtime.d.ts +1 -0
- package/dist/internal/client-runtime.mjs +4 -0
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +5 -5
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/form-actions-client.cjs +18 -0
- package/dist/internal/form-actions-client.d.mts +5 -0
- package/dist/internal/form-actions-client.d.ts +5 -0
- package/dist/internal/form-actions-client.mjs +18 -0
- package/dist/internal/form-actions.cjs +18 -0
- package/dist/internal/form-actions.d.mts +14 -0
- package/dist/internal/form-actions.d.ts +14 -0
- package/dist/internal/form-actions.mjs +18 -0
- package/dist/internal/island-codec.cjs +22 -0
- package/dist/internal/island-codec.d.mts +29 -0
- package/dist/internal/island-codec.d.ts +29 -0
- package/dist/internal/island-codec.mjs +22 -0
- package/dist/internal/island-value-store.cjs +13 -0
- package/dist/internal/island-value-store.d.mts +6 -0
- package/dist/internal/island-value-store.d.ts +6 -0
- package/dist/internal/island-value-store.mjs +13 -0
- package/dist/internal/islands-runtime.cjs +77 -0
- package/dist/internal/islands-runtime.d.mts +57 -0
- package/dist/internal/islands-runtime.d.ts +57 -0
- package/dist/internal/islands-runtime.mjs +77 -0
- package/dist/internal/islands-server.cjs +19 -0
- package/dist/internal/islands-server.d.mts +3 -0
- package/dist/internal/islands-server.d.ts +3 -0
- package/dist/internal/islands-server.mjs +19 -0
- package/dist/internal/islx-client.cjs +5 -0
- package/dist/internal/islx-client.d.mts +2 -0
- package/dist/internal/islx-client.d.ts +2 -0
- package/dist/internal/islx-client.mjs +3 -0
- package/dist/internal/islx-react.cjs +4 -0
- package/dist/internal/islx-react.d.mts +1 -0
- package/dist/internal/islx-react.d.ts +1 -0
- package/dist/internal/islx-react.mjs +2 -0
- package/dist/internal/islx-server.cjs +5 -0
- package/dist/internal/islx-server.d.mts +2 -0
- package/dist/internal/islx-server.d.ts +2 -0
- package/dist/internal/islx-server.mjs +3 -0
- package/dist/internal/isolated-boundary.cjs +4 -3
- package/dist/internal/isolated-boundary.d.mts +13 -1
- package/dist/internal/isolated-boundary.d.ts +13 -1
- package/dist/internal/isolated-boundary.mjs +3 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +24 -7
- package/dist/internal/production-runtime.d.mts +20 -127
- package/dist/internal/production-runtime.d.ts +20 -127
- package/dist/internal/production-runtime.mjs +24 -7
- package/dist/internal/server-tree.cjs +6 -3
- package/dist/internal/server-tree.d.mts +25 -2
- package/dist/internal/server-tree.d.ts +25 -2
- package/dist/internal/server-tree.mjs +7 -4
- package/dist/island-value-protocol-BRayRghM.d.mts +12 -0
- package/dist/island-value-protocol-BRayRghM.d.ts +12 -0
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/navigation.cjs +5 -4
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +4 -3
- package/dist/og.d.mts +5 -0
- package/dist/og.d.ts +5 -0
- package/dist/plugin.cjs +18 -12
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +17 -11
- package/dist/{production-runtime-DFC7pgbp.d.ts → production-runtime-5nArjFpn.d.ts} +1 -1
- package/dist/{production-runtime-BTkXQdYy.d.mts → production-runtime-BzsF2z5F.d.mts} +1 -1
- package/dist/query/client.cjs +6 -5
- package/dist/query/client.mjs +2 -1
- package/dist/{render-plan-5rFeWmk7.d.mts → render-plan-B9yQorV4.d.mts} +4 -2
- package/dist/{render-plan-BoAK9xFC.d.ts → render-plan-fg6E_HvL.d.ts} +4 -2
- package/dist/renderer/react/server.cjs +7 -6
- package/dist/renderer/react/server.d.mts +3 -1
- package/dist/renderer/react/server.d.ts +3 -1
- package/dist/renderer/react/server.mjs +5 -4
- package/dist/renderer-client.cjs +5 -4
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +2 -1
- package/dist/renderer.d.mts +3 -1
- package/dist/renderer.d.ts +3 -1
- package/dist/{request-BxBWigtl.d.mts → request-C4j_g-BH.d.mts} +1 -1
- package/dist/{request-fciwmd3n.d.ts → request-gz8vFK0n.d.ts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering-BLZT0IP0.d.ts → route-rendering-DamyKVi3.d.ts} +1 -1
- package/dist/{route-rendering-BCM1QzEf.d.mts → route-rendering-iTTOwz1f.d.mts} +1 -1
- package/dist/{router-DyZJWc1_.d.mts → router-EoSzHlos.d.mts} +1 -1
- package/dist/{router-CkheNX3-.d.ts → router-OVjDqVo8.d.ts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/rsc-pipeline-LK4K5JFK.mjs +77 -0
- package/dist/rsc-pipeline-YCDRJME4.cjs +77 -0
- package/dist/{runtime-DfU4sKa5.d.ts → runtime-CwiuozLd.d.ts} +1 -1
- package/dist/{runtime-wexvUN5J.d.mts → runtime-DDH4tiuF.d.mts} +1 -1
- package/dist/{schema-dev-notice-5JPE67AI.cjs → schema-dev-notice-77ZL23PL.cjs} +4 -4
- package/dist/{schema-dev-notice-WLPZ6WKU.mjs → schema-dev-notice-BLXOS6U2.mjs} +2 -2
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server.cjs +56 -38
- package/dist/server.d.mts +15 -10
- package/dist/server.d.ts +15 -10
- package/dist/server.mjs +36 -18
- package/dist/{spa-router-DgsMXqfX.d.mts → spa-router-Br4qFCWf.d.mts} +8 -3
- package/dist/{spa-router-CcejECnG.d.ts → spa-router-BsWUKH73.d.ts} +8 -3
- package/dist/{ssg-1FGaFISl.d.ts → ssg-Csy2vwpi.d.ts} +2 -2
- package/dist/{ssg-Bg4bMMhM.d.mts → ssg-Donyfcxy.d.mts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils-Dxbh6Hgj.d.ts → utils-Luk72LXC.d.ts} +1 -1
- package/dist/{utils-8wtTYiH4.d.mts → utils-d_k1ZZw0.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +18 -12
- package/dist/vite.d.mts +6 -4
- package/dist/vite.d.ts +6 -4
- package/dist/vite.mjs +17 -11
- package/package.json +53 -1
- package/dist/{chunk-35WS7P2V.mjs → chunk-26CXZR6L.mjs} +3 -3
- package/dist/{chunk-QEILRWVV.cjs → chunk-3XEMGDBF.cjs} +2 -2
- package/dist/{chunk-BPOTSHDO.cjs → chunk-IOAUK4OI.cjs} +2 -2
- package/dist/{chunk-BYR3RQPB.mjs → chunk-T76H22WI.mjs} +4 -4
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFarmReactRefreshPlugins,
|
|
3
|
+
isFarmReactRefreshActive
|
|
4
|
+
} from "./chunk-5NIWBWDD.mjs";
|
|
1
5
|
import {
|
|
2
6
|
createFarmImageHandler
|
|
3
7
|
} from "./chunk-INQ64HTJ.mjs";
|
|
@@ -7,7 +11,6 @@ import {
|
|
|
7
11
|
collectFarmWebMCPTools,
|
|
8
12
|
createFarmClientOptimizeDepsConfig,
|
|
9
13
|
createFarmClientOptimizeDepsEntries,
|
|
10
|
-
createFarmRouteRenderPlan,
|
|
11
14
|
createFarmSourceAlias,
|
|
12
15
|
createFarmThemeCssPlugin,
|
|
13
16
|
farmFontImportsPlugin,
|
|
@@ -15,14 +18,10 @@ import {
|
|
|
15
18
|
generateFarmClientPluginEntryCode,
|
|
16
19
|
generateFarmIntegrationProviderClientCode,
|
|
17
20
|
getClientModuleMetadata,
|
|
18
|
-
getFarmFragmentCacheControl,
|
|
19
21
|
getIslandStrategyExport,
|
|
20
|
-
getSharedLayoutPrefixLength,
|
|
21
22
|
hasUseClientDirective,
|
|
22
23
|
isFarmDocsClientConfigModule,
|
|
23
24
|
isIsolatableClientBoundarySource,
|
|
24
|
-
loadTailwindVitePlugin,
|
|
25
|
-
parseFarmLayoutChainHeader,
|
|
26
25
|
redactFarmDocsClientConfig,
|
|
27
26
|
resolveDevGlobalStylesheetHref,
|
|
28
27
|
resolveFarmAppPackages,
|
|
@@ -31,29 +30,35 @@ import {
|
|
|
31
30
|
resolveFarmIsolatedClientHydrationMode,
|
|
32
31
|
resolveModuleSourcePath,
|
|
33
32
|
stripUseClientDirective
|
|
34
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-7SCCY6SI.mjs";
|
|
35
34
|
import {
|
|
36
35
|
FARM_NODE_RESPONSE_END_PENDING
|
|
37
36
|
} from "./chunk-FGH3ZXTP.mjs";
|
|
37
|
+
import {
|
|
38
|
+
loadTailwindVitePlugin
|
|
39
|
+
} from "./chunk-S34OBRMZ.mjs";
|
|
38
40
|
import {
|
|
39
41
|
generateFarmTypeArtifacts,
|
|
40
42
|
resolveRouteRenderingConfig
|
|
41
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-26CXZR6L.mjs";
|
|
42
44
|
import {
|
|
43
45
|
FARM_API_CATALOG_PATH,
|
|
44
|
-
FARM_INFRA_SIGNATURE_HEADER,
|
|
45
46
|
createFarmAiCatalogResponse,
|
|
46
47
|
createFarmApiCatalogResponse,
|
|
47
48
|
createFarmAppManifestResponse,
|
|
49
|
+
createFarmRouteRenderPlan,
|
|
48
50
|
farmPathGuardCoversEndpoint,
|
|
49
51
|
farmPathGuardCoversPage,
|
|
52
|
+
getFarmFragmentCacheControl,
|
|
50
53
|
getRouteGroupScope,
|
|
54
|
+
getSharedLayoutPrefixLength,
|
|
51
55
|
isFarmAppManifestPath,
|
|
56
|
+
parseFarmLayoutChainHeader,
|
|
52
57
|
renderFarmLocaleAlternateLinks,
|
|
53
58
|
resolveFarmApiCatalogInput,
|
|
54
59
|
resolveFarmAppManifestInput,
|
|
55
60
|
stripRouteGroups
|
|
56
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-TESO7EFU.mjs";
|
|
57
62
|
import {
|
|
58
63
|
isFarmPreviewDeploymentEnvironment
|
|
59
64
|
} from "./chunk-BOYNDCZL.mjs";
|
|
@@ -74,8 +79,9 @@ import {
|
|
|
74
79
|
toFarmDocsPublicFontAssets
|
|
75
80
|
} from "./chunk-TVGP4BBZ.mjs";
|
|
76
81
|
import {
|
|
77
|
-
generateFarmDevIndicatorsClientRuntime
|
|
78
|
-
|
|
82
|
+
generateFarmDevIndicatorsClientRuntime,
|
|
83
|
+
resolveFarmServerComponentsMode
|
|
84
|
+
} from "./chunk-M3BXTWJM.mjs";
|
|
79
85
|
import {
|
|
80
86
|
FARM_DEVTOOLS_LAUNCH_PARAM,
|
|
81
87
|
FARM_DEVTOOLS_PATH,
|
|
@@ -94,7 +100,7 @@ import {
|
|
|
94
100
|
FARM_PREVIEW_ROBOTS_TAG,
|
|
95
101
|
resolveFarmAgentCrawlers,
|
|
96
102
|
resolveFarmAgentSitemap
|
|
97
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-DMRPN25V.mjs";
|
|
98
104
|
import {
|
|
99
105
|
resolveFarmLlmsTxtConfig
|
|
100
106
|
} from "./chunk-ETPEZLS3.mjs";
|
|
@@ -212,7 +218,7 @@ import {
|
|
|
212
218
|
} from "./chunk-ZZGQD7A4.mjs";
|
|
213
219
|
import {
|
|
214
220
|
FARM_VERSION
|
|
215
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-YGZH4T2X.mjs";
|
|
216
222
|
import {
|
|
217
223
|
DEFAULT_FARM_API_BASE_PATH
|
|
218
224
|
} from "./chunk-7LTCDQRS.mjs";
|
|
@@ -247,9 +253,32 @@ import {
|
|
|
247
253
|
__require
|
|
248
254
|
} from "./chunk-LPEX4YW6.mjs";
|
|
249
255
|
|
|
256
|
+
// src/form-actions-transform.ts
|
|
257
|
+
import { createHash } from "crypto";
|
|
258
|
+
import { transformActions } from "@farm.js/islx/compiler";
|
|
259
|
+
import path from "path";
|
|
260
|
+
function transformFarmFormActionModule(options) {
|
|
261
|
+
const result = transformActions({
|
|
262
|
+
code: options.code,
|
|
263
|
+
id: options.id,
|
|
264
|
+
root: options.root,
|
|
265
|
+
environment: options.ssr ? "server" : "client",
|
|
266
|
+
parse: options.parse,
|
|
267
|
+
runtime: {
|
|
268
|
+
server: "@farm.js/core/internal/islx-server",
|
|
269
|
+
client: "@farm.js/core/internal/islx-client"
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
return result ? result.code : null;
|
|
273
|
+
}
|
|
274
|
+
__name(transformFarmFormActionModule, "transformFarmFormActionModule");
|
|
275
|
+
|
|
276
|
+
// src/vite.ts
|
|
277
|
+
import { parseSync } from "vite";
|
|
278
|
+
|
|
250
279
|
// src/dev-preview-guard.ts
|
|
251
280
|
import { promises as fsp } from "fs";
|
|
252
|
-
import * as
|
|
281
|
+
import * as path2 from "path";
|
|
253
282
|
var FARM_PREVIEW_REQUEST_HEADER = "x-farm-preview";
|
|
254
283
|
function isFarmPreviewTunnelRequest(headers) {
|
|
255
284
|
return headers[FARM_PREVIEW_REQUEST_HEADER] !== void 0;
|
|
@@ -265,10 +294,10 @@ var VITE_DEFAULT_FS_DENY = [
|
|
|
265
294
|
];
|
|
266
295
|
function getFarmDevFsDeny(userDeny, options) {
|
|
267
296
|
const deny = ["**/.farm/**"];
|
|
268
|
-
const root =
|
|
269
|
-
const distDir = options.distDir ?
|
|
270
|
-
const relativeDistDir = distDir ?
|
|
271
|
-
if (distDir && relativeDistDir && relativeDistDir !== ".farm" && relativeDistDir !== ".." && !relativeDistDir.startsWith(`..${
|
|
297
|
+
const root = path2.resolve(options.root || process.cwd());
|
|
298
|
+
const distDir = options.distDir ? path2.resolve(root, options.distDir) : void 0;
|
|
299
|
+
const relativeDistDir = distDir ? path2.relative(root, distDir) : "";
|
|
300
|
+
if (distDir && relativeDistDir && relativeDistDir !== ".farm" && relativeDistDir !== ".." && !relativeDistDir.startsWith(`..${path2.sep}`) && !/[*?[\]{}()!+@]/.test(distDir)) {
|
|
272
301
|
deny.push(`${distDir.replace(/\\/g, "/")}/**`);
|
|
273
302
|
}
|
|
274
303
|
return userDeny ? deny : [...VITE_DEFAULT_FS_DENY, ...deny];
|
|
@@ -314,7 +343,7 @@ async function isAllowedPreviewRequest(server, options, req) {
|
|
|
314
343
|
const inClientGraph = /* @__PURE__ */ __name(async () => Boolean(await client?.moduleGraph.getModuleByUrl(url)), "inClientGraph");
|
|
315
344
|
if (SOURCE_QUERY_FLAGS.some((flag) => query.has(flag))) return inClientGraph();
|
|
316
345
|
if (await inClientGraph()) return true;
|
|
317
|
-
if (file.split(
|
|
346
|
+
if (file.split(path2.sep).includes("node_modules")) return true;
|
|
318
347
|
if (server.config.publicDir && isInside(await realpathOr(server.config.publicDir), file)) {
|
|
319
348
|
return true;
|
|
320
349
|
}
|
|
@@ -322,8 +351,8 @@ async function isAllowedPreviewRequest(server, options, req) {
|
|
|
322
351
|
if (!isModuleOrAsset) return false;
|
|
323
352
|
for (const source of options.getSourceRoots()) {
|
|
324
353
|
const sourceRoot = await realpathOr(source.root);
|
|
325
|
-
const sourceDir = await realpathOr(
|
|
326
|
-
if (sourceRoot === sourceDir &&
|
|
354
|
+
const sourceDir = await realpathOr(path2.resolve(source.root, source.srcDir));
|
|
355
|
+
if (sourceRoot === sourceDir && path2.dirname(file) === sourceDir) continue;
|
|
327
356
|
if (isInside(sourceDir, file)) return true;
|
|
328
357
|
}
|
|
329
358
|
return false;
|
|
@@ -342,9 +371,9 @@ async function resolveRequestedFile(server, pathname) {
|
|
|
342
371
|
}
|
|
343
372
|
const resolved = await server.environments?.client?.pluginContainer.resolveId(id, void 0);
|
|
344
373
|
const resolvedId = resolved?.id.replace(/[?#].*$/, "");
|
|
345
|
-
if (resolvedId &&
|
|
374
|
+
if (resolvedId && path2.isAbsolute(resolvedId)) candidate = resolvedId;
|
|
346
375
|
else if (resolvedId?.startsWith("\0")) return void 0;
|
|
347
|
-
else if (id.startsWith("/")) candidate =
|
|
376
|
+
else if (id.startsWith("/")) candidate = path2.join(server.config.root, id);
|
|
348
377
|
}
|
|
349
378
|
if (!candidate) return void 0;
|
|
350
379
|
try {
|
|
@@ -359,24 +388,24 @@ async function realpathOr(directory) {
|
|
|
359
388
|
try {
|
|
360
389
|
return await fsp.realpath(directory);
|
|
361
390
|
} catch {
|
|
362
|
-
return
|
|
391
|
+
return path2.resolve(directory);
|
|
363
392
|
}
|
|
364
393
|
}
|
|
365
394
|
__name(realpathOr, "realpathOr");
|
|
366
395
|
function isInside(directory, file) {
|
|
367
|
-
const relative2 =
|
|
368
|
-
return relative2 !== "" && relative2 !== ".." && !relative2.startsWith(`..${
|
|
396
|
+
const relative2 = path2.relative(directory, file);
|
|
397
|
+
return relative2 !== "" && relative2 !== ".." && !relative2.startsWith(`..${path2.sep}`) && !path2.isAbsolute(relative2);
|
|
369
398
|
}
|
|
370
399
|
__name(isInside, "isInside");
|
|
371
400
|
|
|
372
401
|
// src/vite.ts
|
|
373
402
|
import * as fs2 from "fs";
|
|
374
|
-
import * as
|
|
375
|
-
import { pathToFileURL
|
|
403
|
+
import * as path5 from "path";
|
|
404
|
+
import { pathToFileURL } from "url";
|
|
376
405
|
|
|
377
406
|
// src/dev-static.ts
|
|
378
407
|
import * as fs from "fs";
|
|
379
|
-
import * as
|
|
408
|
+
import * as path3 from "path";
|
|
380
409
|
function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = []) {
|
|
381
410
|
if (!pathname.includes(".") || pathname.endsWith(".html")) return false;
|
|
382
411
|
const matchesAppRoute = Boolean(
|
|
@@ -423,9 +452,9 @@ function devServableFileExists(pathname, baseDirs) {
|
|
|
423
452
|
if (!relativePathname) return false;
|
|
424
453
|
for (const baseDir of baseDirs) {
|
|
425
454
|
if (typeof baseDir !== "string" || baseDir.length === 0) continue;
|
|
426
|
-
const resolvedBase =
|
|
427
|
-
const candidate =
|
|
428
|
-
if (!candidate.startsWith(resolvedBase +
|
|
455
|
+
const resolvedBase = path3.resolve(baseDir);
|
|
456
|
+
const candidate = path3.resolve(resolvedBase, relativePathname);
|
|
457
|
+
if (!candidate.startsWith(resolvedBase + path3.sep)) continue;
|
|
429
458
|
try {
|
|
430
459
|
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
|
|
431
460
|
return true;
|
|
@@ -572,7 +601,7 @@ __name(formatClientBoundaryWarning, "formatClientBoundaryWarning");
|
|
|
572
601
|
|
|
573
602
|
// src/image-vite.ts
|
|
574
603
|
import { readFile } from "fs/promises";
|
|
575
|
-
import
|
|
604
|
+
import path4 from "path";
|
|
576
605
|
import { imageSize } from "image-size";
|
|
577
606
|
var FARM_IMAGE_ID_PREFIX = "\0farm:image:";
|
|
578
607
|
var STATIC_IMAGE_RE = /\.(?:avif|gif|jpe?g|png|webp)$/i;
|
|
@@ -639,90 +668,6 @@ async function createBlurDataURL(bytes) {
|
|
|
639
668
|
}
|
|
640
669
|
__name(createBlurDataURL, "createBlurDataURL");
|
|
641
670
|
|
|
642
|
-
// src/react-refresh.ts
|
|
643
|
-
import { createRequire } from "module";
|
|
644
|
-
import { pathToFileURL } from "url";
|
|
645
|
-
var REACT_REFRESH_PLUGIN = "vite:react-refresh";
|
|
646
|
-
var FARM_REACT_REFRESH_PREAMBLE_ID = "/@farm/react-refresh-preamble";
|
|
647
|
-
var FARM_OWNED = /* @__PURE__ */ Symbol.for("farm.react-refresh.owned");
|
|
648
|
-
function isFarmReactRefreshActive(config) {
|
|
649
|
-
return config.command === "serve" && !config.isProduction && config.server.hmr !== false && config.plugins.some((plugin) => plugin.name === REACT_REFRESH_PLUGIN);
|
|
650
|
-
}
|
|
651
|
-
__name(isFarmReactRefreshActive, "isFarmReactRefreshActive");
|
|
652
|
-
function isFarmClientEntryId(id) {
|
|
653
|
-
const pathname = id.split("?", 1)[0];
|
|
654
|
-
return pathname === "/@farm/client" || pathname === "/@farm/client.js";
|
|
655
|
-
}
|
|
656
|
-
__name(isFarmClientEntryId, "isFarmClientEntryId");
|
|
657
|
-
function hasAppReactPlugin(plugins) {
|
|
658
|
-
const pending = [...plugins ?? []];
|
|
659
|
-
while (pending.length > 0) {
|
|
660
|
-
const entry = pending.pop();
|
|
661
|
-
if (Array.isArray(entry)) {
|
|
662
|
-
pending.push(...entry);
|
|
663
|
-
continue;
|
|
664
|
-
}
|
|
665
|
-
if (!entry || typeof entry !== "object" || "then" in entry) continue;
|
|
666
|
-
if (entry.name === REACT_REFRESH_PLUGIN && !(FARM_OWNED in entry)) return true;
|
|
667
|
-
}
|
|
668
|
-
return false;
|
|
669
|
-
}
|
|
670
|
-
__name(hasAppReactPlugin, "hasAppReactPlugin");
|
|
671
|
-
function createFarmReactRefreshPreamblePlugin() {
|
|
672
|
-
let active = false;
|
|
673
|
-
return {
|
|
674
|
-
name: "farm:react-refresh-preamble",
|
|
675
|
-
apply: "serve",
|
|
676
|
-
configResolved(config) {
|
|
677
|
-
active = isFarmReactRefreshActive(config);
|
|
678
|
-
},
|
|
679
|
-
resolveId(id) {
|
|
680
|
-
if (id === FARM_REACT_REFRESH_PREAMBLE_ID) return id;
|
|
681
|
-
},
|
|
682
|
-
load(id) {
|
|
683
|
-
if (id !== FARM_REACT_REFRESH_PREAMBLE_ID) return;
|
|
684
|
-
if (!active) return "";
|
|
685
|
-
return `import RefreshRuntime from "/@react-refresh";
|
|
686
|
-
RefreshRuntime.injectIntoGlobalHook(window);
|
|
687
|
-
window.$RefreshReg$ = () => {};
|
|
688
|
-
window.$RefreshSig$ = () => (type) => type;
|
|
689
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
|
690
|
-
`;
|
|
691
|
-
},
|
|
692
|
-
transform(code, id) {
|
|
693
|
-
if (!active || this.environment?.config.consumer !== "client" || !isFarmClientEntryId(id)) {
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
return {
|
|
697
|
-
code: `import ${JSON.stringify(FARM_REACT_REFRESH_PREAMBLE_ID)};
|
|
698
|
-
${code}`,
|
|
699
|
-
map: null
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
|
-
__name(createFarmReactRefreshPreamblePlugin, "createFarmReactRefreshPreamblePlugin");
|
|
705
|
-
async function createFarmReactRefreshPlugins() {
|
|
706
|
-
const entry = createRequire(
|
|
707
|
-
typeof __filename === "string" ? __filename : import.meta.url
|
|
708
|
-
).resolve("@vitejs/plugin-react");
|
|
709
|
-
const { default: react } = await import(
|
|
710
|
-
/* @vite-ignore */
|
|
711
|
-
pathToFileURL(entry).href
|
|
712
|
-
);
|
|
713
|
-
const plugins = react().map(
|
|
714
|
-
(plugin) => Object.assign(
|
|
715
|
-
{
|
|
716
|
-
...plugin,
|
|
717
|
-
apply: /* @__PURE__ */ __name((config, env) => env.command === "serve" && !hasAppReactPlugin(config.plugins), "apply")
|
|
718
|
-
},
|
|
719
|
-
{ [FARM_OWNED]: true }
|
|
720
|
-
)
|
|
721
|
-
);
|
|
722
|
-
return [...plugins, createFarmReactRefreshPreamblePlugin()];
|
|
723
|
-
}
|
|
724
|
-
__name(createFarmReactRefreshPlugins, "createFarmReactRefreshPlugins");
|
|
725
|
-
|
|
726
671
|
// src/navigation/page-data-error.ts
|
|
727
672
|
function resolveFarmPageDataFailure(error) {
|
|
728
673
|
if (isFarmNotFoundError(error)) {
|
|
@@ -824,7 +769,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
824
769
|
}
|
|
825
770
|
__name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
826
771
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
827
|
-
return import("./devtools-
|
|
772
|
+
return import("./devtools-M22FEFPK.mjs");
|
|
828
773
|
}
|
|
829
774
|
__name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
830
775
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -1247,7 +1192,7 @@ function fileContainsProgrammaticPageRoute(file) {
|
|
|
1247
1192
|
__name(fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
|
|
1248
1193
|
function rewriteEarlySsrRelativeImports(options) {
|
|
1249
1194
|
const cleanId = options.id.split("?", 1)[0];
|
|
1250
|
-
if (!
|
|
1195
|
+
if (!path5.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
|
|
1251
1196
|
return null;
|
|
1252
1197
|
}
|
|
1253
1198
|
const replacements = [];
|
|
@@ -1267,7 +1212,7 @@ function rewriteEarlySsrRelativeImports(options) {
|
|
|
1267
1212
|
const suffixIndex = source.value.search(/[?#]/);
|
|
1268
1213
|
const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
|
|
1269
1214
|
const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
|
|
1270
|
-
const resolvedPath =
|
|
1215
|
+
const resolvedPath = path5.resolve(path5.dirname(cleanId), sourcePath);
|
|
1271
1216
|
replacements.push({
|
|
1272
1217
|
start: source.start,
|
|
1273
1218
|
end: source.end,
|
|
@@ -1298,7 +1243,8 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1298
1243
|
const safeName = exportName.replace(/[^A-Za-z0-9_$]/g, "_");
|
|
1299
1244
|
const wrapperName = `__farm_isolated_boundary_${safeName || "default"}__`;
|
|
1300
1245
|
wrapperStatements.push(
|
|
1301
|
-
|
|
1246
|
+
// Islands mode renders through islx; the older isolated hydration keeps Farm's boundary.
|
|
1247
|
+
options.slots ? `const ${wrapperName} = __farm_islx_island__(${localName}, ${JSON.stringify(options.moduleReference)}, ${JSON.stringify(exportName)}, ${JSON.stringify(options.islandStrategy)});` : `const ${wrapperName} = __farm_create_isolated_boundary__(__farm_isolated_react__, ${localName}, ${JSON.stringify(options.moduleReference)}, ${JSON.stringify(exportName)}, ${JSON.stringify(options.islandStrategy)});`
|
|
1302
1248
|
);
|
|
1303
1249
|
wrapperStatements.push(
|
|
1304
1250
|
isDefault ? `export default ${wrapperName};` : `export { ${wrapperName} as ${exportName} };`
|
|
@@ -1354,8 +1300,9 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1354
1300
|
for (const replacement of replacements.sort((left, right) => right.start - left.start)) {
|
|
1355
1301
|
output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
|
|
1356
1302
|
}
|
|
1357
|
-
|
|
1358
|
-
import { createFarmIsolatedClientBoundary as __farm_create_isolated_boundary__ } from "@farm.js/core/internal/isolated-boundary"
|
|
1303
|
+
const runtimeImport = options.slots ? `import { createIsland as __farm_islx_island__ } from "@farm.js/core/internal/islx-react";` : `import * as __farm_isolated_react__ from "react";
|
|
1304
|
+
import { createFarmIsolatedClientBoundary as __farm_create_isolated_boundary__ } from "@farm.js/core/internal/isolated-boundary";`;
|
|
1305
|
+
return `${runtimeImport}
|
|
1359
1306
|
${output}
|
|
1360
1307
|
${wrapperStatements.join("\n")}
|
|
1361
1308
|
export const __farm_client_boundary_originals__ = Object.freeze({ ${originalEntries.join(", ")} });
|
|
@@ -1473,7 +1420,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1473
1420
|
},
|
|
1474
1421
|
server: {
|
|
1475
1422
|
fs: {
|
|
1476
|
-
...layerRoots.length ? { allow: [
|
|
1423
|
+
...layerRoots.length ? { allow: [path5.resolve(options.root || process.cwd()), ...layerRoots] } : {},
|
|
1477
1424
|
deny: getFarmDevFsDeny(userConfig.server?.fs?.deny, options)
|
|
1478
1425
|
}
|
|
1479
1426
|
}
|
|
@@ -1550,7 +1497,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1550
1497
|
});
|
|
1551
1498
|
}
|
|
1552
1499
|
const sourceRoots = getFarmSourceRoots(farmConfig);
|
|
1553
|
-
server.watcher.add(sourceRoots.map((source) =>
|
|
1500
|
+
server.watcher.add(sourceRoots.map((source) => path5.join(source.root, source.srcDir)));
|
|
1554
1501
|
if (farmConfig.i18n.enabled) {
|
|
1555
1502
|
server.watcher.add(
|
|
1556
1503
|
farmConfig.i18n.locales.map(
|
|
@@ -1565,7 +1512,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1565
1512
|
...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
|
|
1566
1513
|
], "getExtraRouteTypes");
|
|
1567
1514
|
const appDirSlugs = sourceRoots.map(
|
|
1568
|
-
(source) =>
|
|
1515
|
+
(source) => path5.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
|
|
1569
1516
|
);
|
|
1570
1517
|
const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
|
|
1571
1518
|
try {
|
|
@@ -1606,7 +1553,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1606
1553
|
}, "generateTypeArtifacts");
|
|
1607
1554
|
await generateTypeArtifacts("startup");
|
|
1608
1555
|
const srcDirSlugs = sourceRoots.map(
|
|
1609
|
-
(source) =>
|
|
1556
|
+
(source) => path5.join(source.root, source.srcDir).replace(/\\/g, "/")
|
|
1610
1557
|
);
|
|
1611
1558
|
const layerConfigFiles = new Set(
|
|
1612
1559
|
farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
|
|
@@ -1754,7 +1701,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1754
1701
|
farmApp.getServerRenderer().setAPIRouteLookup((routePath) => apiRouteManager.getRoutes().has(routePath));
|
|
1755
1702
|
let discoveredWorkflows = [];
|
|
1756
1703
|
const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
|
|
1757
|
-
(dir) => fs2.existsSync(
|
|
1704
|
+
(dir) => fs2.existsSync(path5.isAbsolute(dir) ? dir : path5.join(farmConfig.root, dir))
|
|
1758
1705
|
);
|
|
1759
1706
|
if (hasWorkflowDirectory) {
|
|
1760
1707
|
const { createFarmWorkflowRequestHandler, discoverFarmWorkflows } = await loadFarmWorkflowsDevRuntime();
|
|
@@ -1859,7 +1806,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1859
1806
|
if (specifier === farmConfig.docs.adapter?.server && resolved?.id) {
|
|
1860
1807
|
return import(
|
|
1861
1808
|
/* @vite-ignore */
|
|
1862
|
-
|
|
1809
|
+
pathToFileURL(resolved.id).href
|
|
1863
1810
|
);
|
|
1864
1811
|
}
|
|
1865
1812
|
return loadFarmDevModule(server, resolved?.id ?? specifier);
|
|
@@ -2233,14 +2180,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2233
2180
|
if (options.agent?.manifest !== false && isFarmAppManifestPath(stripFarmBasePath(requestPathname, farmConfig.basePath))) {
|
|
2234
2181
|
await serveBuiltInRoute(async () => {
|
|
2235
2182
|
farmAppPackages ?? (farmAppPackages = resolveFarmAppPackages(farmConfig.root ?? process.cwd()));
|
|
2236
|
-
const header = /* @__PURE__ */ __name((name) => String(req.headers[name] ?? ""), "header");
|
|
2237
2183
|
const manifest = await createFarmAppManifestResponse(
|
|
2238
2184
|
new Request(parsedRequestUrl, {
|
|
2239
2185
|
method: requestMethod,
|
|
2240
|
-
headers: {
|
|
2241
|
-
"if-none-match": header("if-none-match"),
|
|
2242
|
-
[FARM_INFRA_SIGNATURE_HEADER]: header(FARM_INFRA_SIGNATURE_HEADER)
|
|
2243
|
-
}
|
|
2186
|
+
headers: { "if-none-match": String(req.headers["if-none-match"] ?? "") }
|
|
2244
2187
|
}),
|
|
2245
2188
|
{
|
|
2246
2189
|
...resolveFarmAppManifestInput(farmConfig, {
|
|
@@ -2251,12 +2194,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2251
2194
|
}),
|
|
2252
2195
|
defaultMCP: /* @__PURE__ */ __name(() => farmApp.getServerRenderer().getDefaultMCPServer(), "defaultMCP"),
|
|
2253
2196
|
// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
2254
|
-
guardCoversPath: /* @__PURE__ */ __name((
|
|
2197
|
+
guardCoversPath: /* @__PURE__ */ __name((path6) => farmPathGuardCoversEndpoint(
|
|
2255
2198
|
{
|
|
2256
2199
|
config: farmConfig,
|
|
2257
2200
|
middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
|
|
2258
2201
|
},
|
|
2259
|
-
|
|
2202
|
+
path6,
|
|
2260
2203
|
apiServerBasePath
|
|
2261
2204
|
), "guardCoversPath")
|
|
2262
2205
|
}
|
|
@@ -3334,7 +3277,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3334
3277
|
const isolatedHydrationMode = resolveFarmIsolatedClientHydrationMode(
|
|
3335
3278
|
resolvedConfig?.experimental?.isolatedClientHydration,
|
|
3336
3279
|
{
|
|
3337
|
-
serverComponents: resolvedConfig?.experimental?.serverComponents ===
|
|
3280
|
+
serverComponents: resolveFarmServerComponentsMode(resolvedConfig?.experimental?.serverComponents) === "rsc",
|
|
3338
3281
|
hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
|
|
3339
3282
|
}
|
|
3340
3283
|
);
|
|
@@ -3359,7 +3302,8 @@ ${generatedDevIndicatorsClientRuntime}`,
|
|
|
3359
3302
|
generateClientCachePersistenceCode(
|
|
3360
3303
|
resolveFarmClientCacheAdapterEntry(root, resolvedConfig?.cache)
|
|
3361
3304
|
),
|
|
3362
|
-
isReactRenderer(renderer) ? getFarmDocsAdapterConfigModule(docs) : void 0
|
|
3305
|
+
isReactRenderer(renderer) ? getFarmDocsAdapterConfigModule(docs) : void 0,
|
|
3306
|
+
resolveFarmServerComponentsMode(resolvedConfig?.experimental?.serverComponents) === "islands"
|
|
3363
3307
|
);
|
|
3364
3308
|
}
|
|
3365
3309
|
if (id === "/@farm/server") {
|
|
@@ -3435,6 +3379,19 @@ export const manifest = getManifest();
|
|
|
3435
3379
|
}
|
|
3436
3380
|
},
|
|
3437
3381
|
async transform(code, id, transformOptions) {
|
|
3382
|
+
const actionConfig = farmApp?.getConfig() ?? options;
|
|
3383
|
+
if (resolveFarmServerComponentsMode(actionConfig.experimental?.serverComponents) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
|
|
3384
|
+
const file = id.split("?", 1)[0];
|
|
3385
|
+
const actionModule = transformFarmFormActionModule({
|
|
3386
|
+
code,
|
|
3387
|
+
id,
|
|
3388
|
+
root: actionConfig.root || server?.config.root || process.cwd(),
|
|
3389
|
+
ssr: transformOptions?.ssr === true,
|
|
3390
|
+
// Parsed by file type: page components are TSX.
|
|
3391
|
+
parse: /* @__PURE__ */ __name((source) => parseSync(file, source).program, "parse")
|
|
3392
|
+
});
|
|
3393
|
+
if (actionModule) return { code: actionModule, map: null };
|
|
3394
|
+
}
|
|
3438
3395
|
if (!transformOptions?.ssr) {
|
|
3439
3396
|
const docsConfigModule = getFarmDocsAdapterConfigModule(farmApp?.getConfig()?.docs);
|
|
3440
3397
|
if (isFarmDocsClientConfigModule(id, docsConfigModule)) {
|
|
@@ -3498,14 +3455,15 @@ export const manifest = getManifest();
|
|
|
3498
3455
|
const root = currentConfig.root || server?.config.root || process.cwd();
|
|
3499
3456
|
const cleanId = id.split("?", 1)[0];
|
|
3500
3457
|
const selectedIsolatedModules = options.isolatedClientBoundaryModules ?? farmApp?.getRouteManager().getIsolatedClientBoundaryModules(root);
|
|
3501
|
-
const selectedForIsolatedHydration = selectedIsolatedModules?.has(
|
|
3458
|
+
const selectedForIsolatedHydration = selectedIsolatedModules?.has(path5.resolve(cleanId)) === true;
|
|
3502
3459
|
if (isReactRenderer(resolveFarmRenderer(currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
|
|
3503
3460
|
isolatedModuleReference = toViteModuleId(cleanId, root);
|
|
3504
3461
|
const transformedBoundary = transformIsolatedClientBoundaryModule({
|
|
3505
3462
|
code: transformedCode,
|
|
3506
3463
|
moduleReference: isolatedModuleReference,
|
|
3507
3464
|
islandStrategy: getIslandStrategyExport(clientBoundarySource) ?? "load",
|
|
3508
|
-
parse: /* @__PURE__ */ __name((source) => this.parse(source), "parse")
|
|
3465
|
+
parse: /* @__PURE__ */ __name((source) => this.parse(source), "parse"),
|
|
3466
|
+
slots: resolveFarmServerComponentsMode(currentConfig.experimental?.serverComponents) === "islands"
|
|
3509
3467
|
});
|
|
3510
3468
|
if (!transformedBoundary) {
|
|
3511
3469
|
this.error(
|
|
@@ -3590,8 +3548,8 @@ if (import.meta.hot) {
|
|
|
3590
3548
|
}
|
|
3591
3549
|
logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
|
|
3592
3550
|
logger.info("Pre-rendering SSG pages...");
|
|
3593
|
-
const outDir =
|
|
3594
|
-
const clientDir =
|
|
3551
|
+
const outDir = path5.join(server?.config.root || process.cwd(), options.outDir || "dist");
|
|
3552
|
+
const clientDir = path5.join(outDir, "client");
|
|
3595
3553
|
for (const page of ssgPages) {
|
|
3596
3554
|
try {
|
|
3597
3555
|
const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
|
|
@@ -3643,8 +3601,8 @@ if (import.meta.hot) {
|
|
|
3643
3601
|
<script type="module" src="/assets/client.js"></script>
|
|
3644
3602
|
</body>
|
|
3645
3603
|
</html>`;
|
|
3646
|
-
const outputPath = page.urlPath === "/" ?
|
|
3647
|
-
fs2.mkdirSync(
|
|
3604
|
+
const outputPath = page.urlPath === "/" ? path5.join(clientDir, "index.html") : path5.join(clientDir, page.urlPath + ".html");
|
|
3605
|
+
fs2.mkdirSync(path5.dirname(outputPath), { recursive: true });
|
|
3648
3606
|
fs2.writeFileSync(outputPath, fullHtml);
|
|
3649
3607
|
const revalidateInfo = page.revalidate ? ` (revalidate: ${page.revalidate}s)` : "";
|
|
3650
3608
|
logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
|
|
@@ -3653,7 +3611,7 @@ if (import.meta.hot) {
|
|
|
3653
3611
|
logger.error(` \u2717 ${page.urlPath}: ${error}`);
|
|
3654
3612
|
}
|
|
3655
3613
|
}
|
|
3656
|
-
const manifestPath =
|
|
3614
|
+
const manifestPath = path5.join(outDir, "__ssg_manifest.json");
|
|
3657
3615
|
fs2.writeFileSync(
|
|
3658
3616
|
manifestPath,
|
|
3659
3617
|
JSON.stringify(
|
|
@@ -3697,9 +3655,9 @@ if (import.meta.hot) {
|
|
|
3697
3655
|
server2.ws.send({ type: "full-reload", path: "*" });
|
|
3698
3656
|
return [];
|
|
3699
3657
|
}
|
|
3700
|
-
const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) =>
|
|
3658
|
+
const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path5.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
|
|
3701
3659
|
if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
|
|
3702
|
-
logUpdate("PAGE", `updated ${
|
|
3660
|
+
logUpdate("PAGE", `updated ${path5.basename(file)}`);
|
|
3703
3661
|
for (const mod of modules) {
|
|
3704
3662
|
server2.moduleGraph.invalidateModule(mod);
|
|
3705
3663
|
}
|
|
@@ -3833,10 +3791,10 @@ function createPageDataMiddlewareRequest(req, target) {
|
|
|
3833
3791
|
__name(createPageDataMiddlewareRequest, "createPageDataMiddlewareRequest");
|
|
3834
3792
|
function resolveDevelopmentRoot(farmRoot, viteRoot) {
|
|
3835
3793
|
if (!farmRoot) return viteRoot;
|
|
3836
|
-
if (
|
|
3794
|
+
if (path5.resolve(farmRoot) === path5.resolve(viteRoot)) return farmRoot;
|
|
3837
3795
|
try {
|
|
3838
3796
|
if (fs2.realpathSync(farmRoot) === fs2.realpathSync(viteRoot)) {
|
|
3839
|
-
return
|
|
3797
|
+
return path5.resolve(viteRoot);
|
|
3840
3798
|
}
|
|
3841
3799
|
} catch {
|
|
3842
3800
|
}
|
|
@@ -4224,7 +4182,7 @@ function parseRouteModuleSchema(schema, value, label, routePath) {
|
|
|
4224
4182
|
}
|
|
4225
4183
|
}
|
|
4226
4184
|
__name(parseRouteModuleSchema, "parseRouteModuleSchema");
|
|
4227
|
-
function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
4185
|
+
function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
|
|
4228
4186
|
const providerClientCode = generateFarmIntegrationProviderClientCode(
|
|
4229
4187
|
integrationProviders,
|
|
4230
4188
|
root,
|
|
@@ -4241,8 +4199,7 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
|
|
|
4241
4199
|
import { hydrateRoot, createRoot } from 'react-dom/client'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
|
|
4242
4200
|
import __farmAppSetup from ${JSON.stringify(toViteModuleId(appSetupPath, root))}
|
|
4243
4201
|
__farmConfigureApp(__farmAppSetup)` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
|
|
4244
|
-
const isolatedHydrationImport = isolatedHydrationEnabled ?
|
|
4245
|
-
import { createFarmServerTreeElement } from '@farm.js/core/internal/server-tree'` : "";
|
|
4202
|
+
const isolatedHydrationImport = isolatedHydrationEnabled ? `${islandValues ? "import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement } from '@farm.js/core/internal/islands-runtime'" : "import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'\nimport { createFarmServerTreeElement } from '@farm.js/core/internal/server-tree'"}` : "";
|
|
4246
4203
|
const docsAdapterImportBlock = generateFarmDocsAdapterClientRuntime(
|
|
4247
4204
|
docsAdapterReact,
|
|
4248
4205
|
docsConfigModule
|
|
@@ -4250,7 +4207,7 @@ import { createFarmServerTreeElement } from '@farm.js/core/internal/server-tree'
|
|
|
4250
4207
|
const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
|
|
4251
4208
|
ReactRuntime: React,
|
|
4252
4209
|
hydrateRoot,
|
|
4253
|
-
load: (reference) => import(/* @vite-ignore */ reference),
|
|
4210
|
+
load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
|
|
4254
4211
|
schedule: scheduleFarmIslandHydration,
|
|
4255
4212
|
wrap: wrapWithIntegrationProviders,
|
|
4256
4213
|
});
|
|
@@ -4270,7 +4227,7 @@ async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
|
|
|
4270
4227
|
async function createFarmServerTreePageElement(source, pathname) {
|
|
4271
4228
|
try {
|
|
4272
4229
|
return await createFarmServerTreeElement(React, source, {
|
|
4273
|
-
load: (reference) => import(/* @vite-ignore */ reference),
|
|
4230
|
+
load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
|
|
4274
4231
|
ServerHtml: FarmServerPage,
|
|
4275
4232
|
key: pathname,
|
|
4276
4233
|
});
|
|
@@ -4294,6 +4251,18 @@ import {
|
|
|
4294
4251
|
} from '@farm.js/core/deployment'
|
|
4295
4252
|
${providerClientCode.imports}
|
|
4296
4253
|
${clientPluginEntry.imports}
|
|
4254
|
+
|
|
4255
|
+
// Vite appends ?import to a dynamic import of a variable, and the browser keys that URL as a second
|
|
4256
|
+
// copy of a module other modules import statically: two React contexts, two stores. Vite leaves an
|
|
4257
|
+
// absolute URL alone. Other files (Markdown pages) need ?import to be served as JavaScript.
|
|
4258
|
+
function farmModuleUrl(reference) {
|
|
4259
|
+
return typeof reference === "string" &&
|
|
4260
|
+
reference[0] === "/" &&
|
|
4261
|
+
reference[1] !== "/" &&
|
|
4262
|
+
/\\.(?:[cm]?[jt]sx?|vue|svelte)(?:$|\\?)/.test(reference)
|
|
4263
|
+
? new URL(reference, location.origin).href
|
|
4264
|
+
: reference;
|
|
4265
|
+
}
|
|
4297
4266
|
${clientCachePersistence.imports}
|
|
4298
4267
|
${docsSearchClientRuntime}
|
|
4299
4268
|
${devtoolsClientRuntime}
|
|
@@ -4577,7 +4546,7 @@ class LegacyManifestSPARouter {
|
|
|
4577
4546
|
this.prefetchingUrls.add(pathname);
|
|
4578
4547
|
try {
|
|
4579
4548
|
// Prefetch by importing the module (Vite caches it)
|
|
4580
|
-
const module = await import(/* @vite-ignore */ modulePath);
|
|
4549
|
+
const module = await import(/* @vite-ignore */ farmModuleUrl(modulePath));
|
|
4581
4550
|
this.moduleCache.set(modulePath, module);
|
|
4582
4551
|
pageModuleCache.set(modulePath, module);
|
|
4583
4552
|
} catch (error) {
|
|
@@ -4825,7 +4794,7 @@ async function renderRouteSlot(slot, mode = 'render') {
|
|
|
4825
4794
|
|
|
4826
4795
|
let slotModule = pageModuleCache.get(slot.modulePath);
|
|
4827
4796
|
if (!slotModule) {
|
|
4828
|
-
slotModule = await import(/* @vite-ignore */ slot.modulePath);
|
|
4797
|
+
slotModule = await import(/* @vite-ignore */ farmModuleUrl(slot.modulePath));
|
|
4829
4798
|
pageModuleCache.set(slot.modulePath, slotModule);
|
|
4830
4799
|
}
|
|
4831
4800
|
const SlotComponent = slotModule?.default;
|
|
@@ -4990,7 +4959,7 @@ async function buildClientHydrationElement(
|
|
|
4990
4959
|
|
|
4991
4960
|
if (loadingModulePath) {
|
|
4992
4961
|
try {
|
|
4993
|
-
const loadingModule = await import(/* @vite-ignore */ loadingModulePath);
|
|
4962
|
+
const loadingModule = await import(/* @vite-ignore */ farmModuleUrl(loadingModulePath));
|
|
4994
4963
|
const LoadingComponent = loadingModule?.default;
|
|
4995
4964
|
if (LoadingComponent) {
|
|
4996
4965
|
const loadingFallback = React.createElement(LoadingComponent, {
|
|
@@ -5018,7 +4987,7 @@ async function loadLayoutComponents(layouts = []) {
|
|
|
5018
4987
|
try {
|
|
5019
4988
|
let LayoutComponent = layoutComponentCache.get(layout.modulePath);
|
|
5020
4989
|
if (!LayoutComponent) {
|
|
5021
|
-
const layoutModule = await import(/* @vite-ignore */ layout.modulePath);
|
|
4990
|
+
const layoutModule = await import(/* @vite-ignore */ farmModuleUrl(layout.modulePath));
|
|
5022
4991
|
LayoutComponent = layoutModule.default;
|
|
5023
4992
|
if (LayoutComponent) {
|
|
5024
4993
|
layoutComponentCache.set(layout.modulePath, LayoutComponent);
|
|
@@ -5180,7 +5149,7 @@ async function tryHydrateImportedPage(
|
|
|
5180
5149
|
if (pageShouldHydrate) {
|
|
5181
5150
|
let pageModule = pageModuleCache.get(modulePath);
|
|
5182
5151
|
if (!pageModule) {
|
|
5183
|
-
pageModule = await import(/* @vite-ignore */ modulePath);
|
|
5152
|
+
pageModule = await import(/* @vite-ignore */ farmModuleUrl(modulePath));
|
|
5184
5153
|
pageModuleCache.set(modulePath, pageModule);
|
|
5185
5154
|
}
|
|
5186
5155
|
if (signal?.aborted || !container?.isConnected) return false;
|
|
@@ -5339,7 +5308,7 @@ function parseNavigationFragment(html) {
|
|
|
5339
5308
|
return template.content;
|
|
5340
5309
|
}
|
|
5341
5310
|
|
|
5342
|
-
function replaceNavigationBoundary(container, fragment, currentPatterns, nextPatterns) {
|
|
5311
|
+
function replaceNavigationBoundary(container, fragment, currentPatterns, nextPatterns, refresh = false) {
|
|
5343
5312
|
let sharedCount = 0;
|
|
5344
5313
|
while (
|
|
5345
5314
|
sharedCount < currentPatterns.length &&
|
|
@@ -5366,7 +5335,9 @@ function replaceNavigationBoundary(container, fragment, currentPatterns, nextPat
|
|
|
5366
5335
|
return container;
|
|
5367
5336
|
}
|
|
5368
5337
|
|
|
5369
|
-
${isolatedHydrationEnabled ?
|
|
5338
|
+
${isolatedHydrationEnabled ? `${islandValues ? `// A refresh keeps the islands still on the page, with their state and new props.
|
|
5339
|
+
if (refresh) farmIsolatedHydrationRuntime.carryOver(currentTarget, nextTarget);
|
|
5340
|
+
` : ""}disposeFarmIsolatedClientBoundaries(currentTarget);` : ""}
|
|
5370
5341
|
currentTarget.replaceWith(nextTarget);
|
|
5371
5342
|
activateFragmentScripts(nextTarget);
|
|
5372
5343
|
if (fragmentTreeRoot && fragmentTreeRoot !== nextTarget) fragmentTreeRoot.remove();
|
|
@@ -5390,7 +5361,7 @@ let activeLayoutShouldHydrate = window.__FARM_LAYOUT_SHOULD_HYDRATE__ === true;
|
|
|
5390
5361
|
|
|
5391
5362
|
// ====== MANIFEST-DRIVEN HTML-FRAGMENT NAVIGATION ======
|
|
5392
5363
|
// One page-data response carries both server HTML and the hydration plan.
|
|
5393
|
-
async function renderPage(pageData) {
|
|
5364
|
+
async function renderPage(pageData, info) {
|
|
5394
5365
|
const container = document.getElementById('root');
|
|
5395
5366
|
if (!container) return;
|
|
5396
5367
|
cancelPendingPageHydration();
|
|
@@ -5483,7 +5454,7 @@ async function renderPage(pageData) {
|
|
|
5483
5454
|
const pageShouldHydrate = route.pageShouldHydrate || route.isClientComponent;
|
|
5484
5455
|
const layoutShouldHydrate = route.layoutShouldHydrate;
|
|
5485
5456
|
${isolatedHydrationEnabled ? `const hasIsolatedClientBoundaries = Boolean(
|
|
5486
|
-
fragment.querySelector('
|
|
5457
|
+
fragment.querySelector('f-island[src]'),
|
|
5487
5458
|
);
|
|
5488
5459
|
const shouldHydrate =
|
|
5489
5460
|
pageShouldHydrate || layoutShouldHydrate || (route.shouldHydrate && !hasIsolatedClientBoundaries);` : "const shouldHydrate = route.shouldHydrate || pageShouldHydrate || layoutShouldHydrate;"}
|
|
@@ -5519,7 +5490,7 @@ async function renderPage(pageData) {
|
|
|
5519
5490
|
if (appRoot) { try { appRoot.unmount(); } catch (error) {} appRoot = null; }
|
|
5520
5491
|
if (reactRoot) { try { reactRoot.unmount(); } catch (error) {} reactRoot = null; }
|
|
5521
5492
|
delete window.__FARM_REACT_ROOT__;
|
|
5522
|
-
${isolatedHydrationEnabled ? "isolatedHydrationScope = replaceNavigationBoundary(container, fragment, activeLayoutPatterns, layoutPatterns) || container;" : "replaceNavigationBoundary(container, fragment, activeLayoutPatterns, layoutPatterns);"}
|
|
5493
|
+
${isolatedHydrationEnabled ? "isolatedHydrationScope = replaceNavigationBoundary(container, fragment, activeLayoutPatterns, layoutPatterns, info?.refresh === true) || container;" : "replaceNavigationBoundary(container, fragment, activeLayoutPatterns, layoutPatterns);"}
|
|
5523
5494
|
}
|
|
5524
5495
|
|
|
5525
5496
|
const hydrationController = new AbortController();
|
|
@@ -5616,7 +5587,7 @@ async function hydrate() {
|
|
|
5616
5587
|
const modulePath = window.__FARM_PAGE_MODULE__;
|
|
5617
5588
|
${isolatedHydrationEnabled ? `const hasIsolatedClientBoundaries =
|
|
5618
5589
|
window.__FARM_HAS_ISOLATED_CLIENT_BOUNDARIES__ === true ||
|
|
5619
|
-
Boolean(rootContainer.querySelector('
|
|
5590
|
+
Boolean(rootContainer.querySelector('f-island[src]'));` : ""}
|
|
5620
5591
|
|
|
5621
5592
|
let pageProps = normalizeServerProps(window.__FARM_PROPS__);
|
|
5622
5593
|
applyCanonicalPathFromProps(pageProps);
|
|
@@ -5863,7 +5834,7 @@ function generateClientManifest(bundle) {
|
|
|
5863
5834
|
__name(generateClientManifest, "generateClientManifest");
|
|
5864
5835
|
async function defineConfig(config = {}) {
|
|
5865
5836
|
const tailwindVitePlugin = await loadTailwindVitePlugin();
|
|
5866
|
-
const appRoot =
|
|
5837
|
+
const appRoot = path5.resolve(config.root || process.cwd());
|
|
5867
5838
|
if (config.extends?.length) {
|
|
5868
5839
|
const { config: layeredConfig } = await import("./layers-UTB43B7A.mjs").then(
|
|
5869
5840
|
({ resolveFarmLayers }) => resolveFarmLayers(config, {
|
|
@@ -6084,7 +6055,6 @@ __name(defineConfig, "defineConfig");
|
|
|
6084
6055
|
|
|
6085
6056
|
export {
|
|
6086
6057
|
farmImageImportsPlugin,
|
|
6087
|
-
createFarmReactRefreshPlugins,
|
|
6088
6058
|
farmI18nClientBridgePlugin,
|
|
6089
6059
|
farmServerOnlyEntriesPlugin,
|
|
6090
6060
|
withFarmRequestTracing,
|