@farm.js/core 0.1.42 → 0.1.44
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-ssVy_tea.d.mts → agent-mcp-CWI-awqd.d.mts} +1 -1
- package/dist/{agent-mcp-SSD6L3VZ.d.ts → agent-mcp-EnzWYv_X.d.ts} +1 -1
- package/dist/agent-runtime.cjs +3 -2
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +2 -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-KjFzdCqy.d.ts → app-CAN_2Cqo.d.ts} +8 -4
- package/dist/{app-1h3lVT4a.d.mts → app-DG3dE8v5.d.mts} +8 -4
- package/dist/{app-manifest-D3RkVNuS.d.mts → app-manifest-8x5VjZ0L.d.mts} +1 -1
- package/dist/{app-manifest-DaW8-tvX.d.ts → app-manifest-DazjgQya.d.ts} +1 -1
- 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-TUL355PH.mjs → chunk-2MKTHHEU.mjs} +136 -161
- package/dist/chunk-2NXO5SBY.mjs +57 -0
- package/dist/{chunk-AX7S67YV.mjs → chunk-37VKVISD.mjs} +9 -173
- package/dist/chunk-3BROEWFY.cjs +39 -0
- package/dist/chunk-3SAWHWDH.cjs +186 -0
- package/dist/{chunk-AHFRQMRX.cjs → chunk-3YJMBQ27.cjs} +1 -1
- package/dist/{chunk-6PKXK4TY.mjs → chunk-53ZV6K65.mjs} +1 -1
- package/dist/{chunk-JG3MEQUH.cjs → chunk-5GBL2LKD.cjs} +430 -217
- 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-TCJ4A4A2.cjs → chunk-AI3WVJNP.cjs} +324 -350
- package/dist/chunk-APDGOKKE.cjs +148 -0
- package/dist/chunk-AZBSVLRM.cjs +132 -0
- package/dist/{chunk-RHGK2JEN.cjs → chunk-B6XAA7V6.cjs} +18 -182
- package/dist/chunk-CEDPEDNW.cjs +98 -0
- package/dist/{chunk-WSOBCAYO.cjs → chunk-CW6SNEN2.cjs} +25 -25
- package/dist/chunk-D5RFPV2H.mjs +148 -0
- package/dist/chunk-E22SWCXB.cjs +144 -0
- package/dist/{chunk-375K2ZVU.mjs → chunk-ERA5RP3L.mjs} +263 -50
- package/dist/{chunk-724JLMS4.mjs → chunk-F646BZ4Y.mjs} +4 -2
- package/dist/{chunk-C5KVWHIH.cjs → chunk-G2Z5DGMS.cjs} +5 -3
- package/dist/{chunk-ZATTDMBW.cjs → chunk-GA6JM4L6.cjs} +279 -376
- package/dist/chunk-GZWHCWLB.mjs +186 -0
- package/dist/{chunk-24SP5TGU.mjs → chunk-H4LXPWI2.mjs} +2 -2
- package/dist/chunk-H7BLEEAE.cjs +57 -0
- package/dist/chunk-IOMVXBLZ.mjs +144 -0
- package/dist/{chunk-BD3D7EZV.cjs → chunk-IXFOBGLQ.cjs} +9 -3
- package/dist/{chunk-JIYYX7WU.mjs → chunk-JVXW76I7.mjs} +2 -2
- package/dist/{chunk-MHN4UR5U.cjs → chunk-KFZZFZ7J.cjs} +7 -7
- package/dist/{chunk-BXJ5HJTJ.cjs → chunk-LPE3ED4R.cjs} +17 -13
- package/dist/chunk-LRJRXXQZ.cjs +109 -0
- package/dist/{chunk-HCSVR4YZ.mjs → chunk-M3BXTWJM.mjs} +18 -0
- package/dist/{chunk-2JZHQDUY.mjs → chunk-OYZGFRPA.mjs} +1 -1
- package/dist/{chunk-JR4QCLJY.cjs → chunk-PDU4P2IC.cjs} +19 -1
- package/dist/chunk-PJEHUSHA.mjs +229 -0
- package/dist/{chunk-QTEJGB5A.mjs → chunk-QGFKXYC7.mjs} +80 -177
- package/dist/chunk-QGH2RQVF.mjs +132 -0
- package/dist/{chunk-YWMZUGIS.mjs → chunk-R3ZFQJEF.mjs} +247 -34
- package/dist/{chunk-U2UC7UGP.mjs → chunk-R4J2UOV4.mjs} +1 -1
- 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-ZS6HDNOM.cjs → chunk-T44ECMEP.cjs} +6 -6
- package/dist/{chunk-OFZUJMCU.mjs → chunk-WPJQN64R.mjs} +195 -41
- package/dist/{chunk-NU25TRIO.mjs → chunk-WWYXIECF.mjs} +12 -8
- package/dist/{chunk-7YHSD3Z6.cjs → chunk-XPSGGECF.cjs} +85 -31
- package/dist/chunk-XUGFRFD2.mjs +39 -0
- package/dist/{chunk-IVQY6UTY.mjs → chunk-XUHIRBXY.mjs} +1 -1
- package/dist/{chunk-PIZXONIS.mjs → chunk-YFLBG2W3.mjs} +56 -2
- package/dist/chunk-YKUEJ3MG.cjs +229 -0
- package/dist/{chunk-QKZMB7LY.cjs → chunk-YN2QEMMO.cjs} +2 -2
- package/dist/{client-plugins-DIem0I0W.d.ts → client-plugins-BGS0wqzc.d.ts} +36 -16
- package/dist/{client-plugins-C9Py_50W.d.mts → client-plugins-nQ0tYt4l.d.mts} +36 -16
- 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-2RY3EKHL.cjs → devtools-5Q7VRKVH.cjs} +6 -5
- package/dist/{devtools-Q3LBNUJ7.mjs → devtools-LJ4IGYGW.mjs} +5 -4
- package/dist/docs.cjs +7 -6
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +6 -5
- package/dist/index-Cy26isrh.d.ts +48 -0
- package/dist/index-y1jgR74U.d.mts +48 -0
- package/dist/index.cjs +44 -25
- package/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.mjs +51 -32
- package/dist/integrations.cjs +5 -3
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +6 -4
- 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 +30 -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 +29 -14
- package/dist/internal/cli-runtime.cjs +24 -11
- package/dist/internal/cli-runtime.mjs +24 -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 +6 -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 +5 -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 -13
- package/dist/internal/production-runtime.d.mts +20 -10
- package/dist/internal/production-runtime.d.ts +20 -10
- package/dist/internal/production-runtime.mjs +24 -13
- 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 +19 -12
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +18 -11
- package/dist/{production-runtime-bjjWq-DA.d.ts → production-runtime-BVMDgHrA.d.ts} +1 -1
- package/dist/{production-runtime-CHFKIgpW.d.mts → production-runtime-ClFA_1KQ.d.mts} +1 -1
- package/dist/query/client.cjs +6 -5
- package/dist/query/client.mjs +2 -1
- package/dist/{render-plan-DOHg6wdO.d.mts → render-plan-CoSovy_O.d.mts} +4 -2
- package/dist/{render-plan-B2UndB4x.d.ts → render-plan-y2DefWf8.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-DVNXRQrI.d.ts → request-aG5Wovm5.d.ts} +1 -1
- package/dist/{request-DQcGfdgQ.d.mts → request-cNM09Q7e.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering-B_6fj-GG.d.ts → route-rendering-B3uQmCWX.d.ts} +1 -1
- package/dist/{route-rendering-CEX4mFn-.d.mts → route-rendering-EyInfsjI.d.mts} +1 -1
- package/dist/{router-CHEMHm1P.d.ts → router-DNUf-Bg1.d.ts} +1 -1
- package/dist/{router-CKHPBKXX.d.mts → router-Devibh4r.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/rsc-pipeline-4ZJ6GUVQ.cjs +78 -0
- package/dist/rsc-pipeline-KK6GFDET.mjs +78 -0
- package/dist/{runtime-jj8TKNsy.d.mts → runtime-9KZb8AI5.d.mts} +1 -1
- package/dist/{runtime-Br2ZDTAv.d.ts → runtime-CLr9P5kn.d.ts} +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 +57 -38
- package/dist/server.d.mts +15 -10
- package/dist/server.d.ts +15 -10
- package/dist/server.mjs +37 -18
- package/dist/{spa-router-BEvS9Erj.d.mts → spa-router-BIxh4IY-.d.mts} +8 -3
- package/dist/{spa-router-DmCuH5B7.d.ts → spa-router-Ds6R_oe-.d.ts} +8 -3
- package/dist/{ssg-57v6cZcW.d.mts → ssg-ByrOVYdM.d.mts} +2 -2
- package/dist/{ssg-gT093ETk.d.ts → ssg-XnMHCyEc.d.ts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils-CCTKvR-P.d.ts → utils-BN70ueSN.d.ts} +1 -1
- package/dist/{utils-raHHQVyL.d.mts → utils-BrjR5xRs.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +19 -12
- package/dist/vite.d.mts +6 -4
- package/dist/vite.d.ts +6 -4
- package/dist/vite.mjs +18 -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,28 +30,35 @@ import {
|
|
|
31
30
|
resolveFarmIsolatedClientHydrationMode,
|
|
32
31
|
resolveModuleSourcePath,
|
|
33
32
|
stripUseClientDirective
|
|
34
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-QGFKXYC7.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
46
|
createFarmAiCatalogResponse,
|
|
45
47
|
createFarmApiCatalogResponse,
|
|
46
48
|
createFarmAppManifestResponse,
|
|
49
|
+
createFarmRouteRenderPlan,
|
|
47
50
|
farmPathGuardCoversEndpoint,
|
|
48
51
|
farmPathGuardCoversPage,
|
|
52
|
+
getFarmFragmentCacheControl,
|
|
49
53
|
getRouteGroupScope,
|
|
54
|
+
getSharedLayoutPrefixLength,
|
|
50
55
|
isFarmAppManifestPath,
|
|
56
|
+
parseFarmLayoutChainHeader,
|
|
51
57
|
renderFarmLocaleAlternateLinks,
|
|
52
58
|
resolveFarmApiCatalogInput,
|
|
53
59
|
resolveFarmAppManifestInput,
|
|
54
60
|
stripRouteGroups
|
|
55
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-YFLBG2W3.mjs";
|
|
56
62
|
import {
|
|
57
63
|
isFarmPreviewDeploymentEnvironment
|
|
58
64
|
} from "./chunk-BOYNDCZL.mjs";
|
|
@@ -73,8 +79,9 @@ import {
|
|
|
73
79
|
toFarmDocsPublicFontAssets
|
|
74
80
|
} from "./chunk-TVGP4BBZ.mjs";
|
|
75
81
|
import {
|
|
76
|
-
generateFarmDevIndicatorsClientRuntime
|
|
77
|
-
|
|
82
|
+
generateFarmDevIndicatorsClientRuntime,
|
|
83
|
+
resolveFarmServerComponentsMode
|
|
84
|
+
} from "./chunk-M3BXTWJM.mjs";
|
|
78
85
|
import {
|
|
79
86
|
FARM_DEVTOOLS_LAUNCH_PARAM,
|
|
80
87
|
FARM_DEVTOOLS_PATH,
|
|
@@ -133,7 +140,7 @@ import {
|
|
|
133
140
|
getIntegrationDocumentNavigationMatchers,
|
|
134
141
|
getIntegrationProviders,
|
|
135
142
|
matchIntegrationRoute
|
|
136
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-37VKVISD.mjs";
|
|
137
144
|
import {
|
|
138
145
|
MiddlewareManager
|
|
139
146
|
} from "./chunk-HJ64F4GS.mjs";
|
|
@@ -211,7 +218,7 @@ import {
|
|
|
211
218
|
} from "./chunk-ZZGQD7A4.mjs";
|
|
212
219
|
import {
|
|
213
220
|
FARM_VERSION
|
|
214
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-R4J2UOV4.mjs";
|
|
215
222
|
import {
|
|
216
223
|
DEFAULT_FARM_API_BASE_PATH
|
|
217
224
|
} from "./chunk-7LTCDQRS.mjs";
|
|
@@ -246,9 +253,32 @@ import {
|
|
|
246
253
|
__require
|
|
247
254
|
} from "./chunk-LPEX4YW6.mjs";
|
|
248
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
|
+
|
|
249
279
|
// src/dev-preview-guard.ts
|
|
250
280
|
import { promises as fsp } from "fs";
|
|
251
|
-
import * as
|
|
281
|
+
import * as path2 from "path";
|
|
252
282
|
var FARM_PREVIEW_REQUEST_HEADER = "x-farm-preview";
|
|
253
283
|
function isFarmPreviewTunnelRequest(headers) {
|
|
254
284
|
return headers[FARM_PREVIEW_REQUEST_HEADER] !== void 0;
|
|
@@ -264,10 +294,10 @@ var VITE_DEFAULT_FS_DENY = [
|
|
|
264
294
|
];
|
|
265
295
|
function getFarmDevFsDeny(userDeny, options) {
|
|
266
296
|
const deny = ["**/.farm/**"];
|
|
267
|
-
const root =
|
|
268
|
-
const distDir = options.distDir ?
|
|
269
|
-
const relativeDistDir = distDir ?
|
|
270
|
-
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)) {
|
|
271
301
|
deny.push(`${distDir.replace(/\\/g, "/")}/**`);
|
|
272
302
|
}
|
|
273
303
|
return userDeny ? deny : [...VITE_DEFAULT_FS_DENY, ...deny];
|
|
@@ -313,7 +343,7 @@ async function isAllowedPreviewRequest(server, options, req) {
|
|
|
313
343
|
const inClientGraph = /* @__PURE__ */ __name(async () => Boolean(await client?.moduleGraph.getModuleByUrl(url)), "inClientGraph");
|
|
314
344
|
if (SOURCE_QUERY_FLAGS.some((flag) => query.has(flag))) return inClientGraph();
|
|
315
345
|
if (await inClientGraph()) return true;
|
|
316
|
-
if (file.split(
|
|
346
|
+
if (file.split(path2.sep).includes("node_modules")) return true;
|
|
317
347
|
if (server.config.publicDir && isInside(await realpathOr(server.config.publicDir), file)) {
|
|
318
348
|
return true;
|
|
319
349
|
}
|
|
@@ -321,8 +351,8 @@ async function isAllowedPreviewRequest(server, options, req) {
|
|
|
321
351
|
if (!isModuleOrAsset) return false;
|
|
322
352
|
for (const source of options.getSourceRoots()) {
|
|
323
353
|
const sourceRoot = await realpathOr(source.root);
|
|
324
|
-
const sourceDir = await realpathOr(
|
|
325
|
-
if (sourceRoot === sourceDir &&
|
|
354
|
+
const sourceDir = await realpathOr(path2.resolve(source.root, source.srcDir));
|
|
355
|
+
if (sourceRoot === sourceDir && path2.dirname(file) === sourceDir) continue;
|
|
326
356
|
if (isInside(sourceDir, file)) return true;
|
|
327
357
|
}
|
|
328
358
|
return false;
|
|
@@ -341,9 +371,9 @@ async function resolveRequestedFile(server, pathname) {
|
|
|
341
371
|
}
|
|
342
372
|
const resolved = await server.environments?.client?.pluginContainer.resolveId(id, void 0);
|
|
343
373
|
const resolvedId = resolved?.id.replace(/[?#].*$/, "");
|
|
344
|
-
if (resolvedId &&
|
|
374
|
+
if (resolvedId && path2.isAbsolute(resolvedId)) candidate = resolvedId;
|
|
345
375
|
else if (resolvedId?.startsWith("\0")) return void 0;
|
|
346
|
-
else if (id.startsWith("/")) candidate =
|
|
376
|
+
else if (id.startsWith("/")) candidate = path2.join(server.config.root, id);
|
|
347
377
|
}
|
|
348
378
|
if (!candidate) return void 0;
|
|
349
379
|
try {
|
|
@@ -358,24 +388,24 @@ async function realpathOr(directory) {
|
|
|
358
388
|
try {
|
|
359
389
|
return await fsp.realpath(directory);
|
|
360
390
|
} catch {
|
|
361
|
-
return
|
|
391
|
+
return path2.resolve(directory);
|
|
362
392
|
}
|
|
363
393
|
}
|
|
364
394
|
__name(realpathOr, "realpathOr");
|
|
365
395
|
function isInside(directory, file) {
|
|
366
|
-
const relative2 =
|
|
367
|
-
return relative2 !== "" && relative2 !== ".." && !relative2.startsWith(`..${
|
|
396
|
+
const relative2 = path2.relative(directory, file);
|
|
397
|
+
return relative2 !== "" && relative2 !== ".." && !relative2.startsWith(`..${path2.sep}`) && !path2.isAbsolute(relative2);
|
|
368
398
|
}
|
|
369
399
|
__name(isInside, "isInside");
|
|
370
400
|
|
|
371
401
|
// src/vite.ts
|
|
372
402
|
import * as fs2 from "fs";
|
|
373
|
-
import * as
|
|
374
|
-
import { pathToFileURL
|
|
403
|
+
import * as path5 from "path";
|
|
404
|
+
import { pathToFileURL } from "url";
|
|
375
405
|
|
|
376
406
|
// src/dev-static.ts
|
|
377
407
|
import * as fs from "fs";
|
|
378
|
-
import * as
|
|
408
|
+
import * as path3 from "path";
|
|
379
409
|
function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = []) {
|
|
380
410
|
if (!pathname.includes(".") || pathname.endsWith(".html")) return false;
|
|
381
411
|
const matchesAppRoute = Boolean(
|
|
@@ -422,9 +452,9 @@ function devServableFileExists(pathname, baseDirs) {
|
|
|
422
452
|
if (!relativePathname) return false;
|
|
423
453
|
for (const baseDir of baseDirs) {
|
|
424
454
|
if (typeof baseDir !== "string" || baseDir.length === 0) continue;
|
|
425
|
-
const resolvedBase =
|
|
426
|
-
const candidate =
|
|
427
|
-
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;
|
|
428
458
|
try {
|
|
429
459
|
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
|
|
430
460
|
return true;
|
|
@@ -571,7 +601,7 @@ __name(formatClientBoundaryWarning, "formatClientBoundaryWarning");
|
|
|
571
601
|
|
|
572
602
|
// src/image-vite.ts
|
|
573
603
|
import { readFile } from "fs/promises";
|
|
574
|
-
import
|
|
604
|
+
import path4 from "path";
|
|
575
605
|
import { imageSize } from "image-size";
|
|
576
606
|
var FARM_IMAGE_ID_PREFIX = "\0farm:image:";
|
|
577
607
|
var STATIC_IMAGE_RE = /\.(?:avif|gif|jpe?g|png|webp)$/i;
|
|
@@ -638,90 +668,6 @@ async function createBlurDataURL(bytes) {
|
|
|
638
668
|
}
|
|
639
669
|
__name(createBlurDataURL, "createBlurDataURL");
|
|
640
670
|
|
|
641
|
-
// src/react-refresh.ts
|
|
642
|
-
import { createRequire } from "module";
|
|
643
|
-
import { pathToFileURL } from "url";
|
|
644
|
-
var REACT_REFRESH_PLUGIN = "vite:react-refresh";
|
|
645
|
-
var FARM_REACT_REFRESH_PREAMBLE_ID = "/@farm/react-refresh-preamble";
|
|
646
|
-
var FARM_OWNED = /* @__PURE__ */ Symbol.for("farm.react-refresh.owned");
|
|
647
|
-
function isFarmReactRefreshActive(config) {
|
|
648
|
-
return config.command === "serve" && !config.isProduction && config.server.hmr !== false && config.plugins.some((plugin) => plugin.name === REACT_REFRESH_PLUGIN);
|
|
649
|
-
}
|
|
650
|
-
__name(isFarmReactRefreshActive, "isFarmReactRefreshActive");
|
|
651
|
-
function isFarmClientEntryId(id) {
|
|
652
|
-
const pathname = id.split("?", 1)[0];
|
|
653
|
-
return pathname === "/@farm/client" || pathname === "/@farm/client.js";
|
|
654
|
-
}
|
|
655
|
-
__name(isFarmClientEntryId, "isFarmClientEntryId");
|
|
656
|
-
function hasAppReactPlugin(plugins) {
|
|
657
|
-
const pending = [...plugins ?? []];
|
|
658
|
-
while (pending.length > 0) {
|
|
659
|
-
const entry = pending.pop();
|
|
660
|
-
if (Array.isArray(entry)) {
|
|
661
|
-
pending.push(...entry);
|
|
662
|
-
continue;
|
|
663
|
-
}
|
|
664
|
-
if (!entry || typeof entry !== "object" || "then" in entry) continue;
|
|
665
|
-
if (entry.name === REACT_REFRESH_PLUGIN && !(FARM_OWNED in entry)) return true;
|
|
666
|
-
}
|
|
667
|
-
return false;
|
|
668
|
-
}
|
|
669
|
-
__name(hasAppReactPlugin, "hasAppReactPlugin");
|
|
670
|
-
function createFarmReactRefreshPreamblePlugin() {
|
|
671
|
-
let active = false;
|
|
672
|
-
return {
|
|
673
|
-
name: "farm:react-refresh-preamble",
|
|
674
|
-
apply: "serve",
|
|
675
|
-
configResolved(config) {
|
|
676
|
-
active = isFarmReactRefreshActive(config);
|
|
677
|
-
},
|
|
678
|
-
resolveId(id) {
|
|
679
|
-
if (id === FARM_REACT_REFRESH_PREAMBLE_ID) return id;
|
|
680
|
-
},
|
|
681
|
-
load(id) {
|
|
682
|
-
if (id !== FARM_REACT_REFRESH_PREAMBLE_ID) return;
|
|
683
|
-
if (!active) return "";
|
|
684
|
-
return `import RefreshRuntime from "/@react-refresh";
|
|
685
|
-
RefreshRuntime.injectIntoGlobalHook(window);
|
|
686
|
-
window.$RefreshReg$ = () => {};
|
|
687
|
-
window.$RefreshSig$ = () => (type) => type;
|
|
688
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
|
689
|
-
`;
|
|
690
|
-
},
|
|
691
|
-
transform(code, id) {
|
|
692
|
-
if (!active || this.environment?.config.consumer !== "client" || !isFarmClientEntryId(id)) {
|
|
693
|
-
return;
|
|
694
|
-
}
|
|
695
|
-
return {
|
|
696
|
-
code: `import ${JSON.stringify(FARM_REACT_REFRESH_PREAMBLE_ID)};
|
|
697
|
-
${code}`,
|
|
698
|
-
map: null
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
__name(createFarmReactRefreshPreamblePlugin, "createFarmReactRefreshPreamblePlugin");
|
|
704
|
-
async function createFarmReactRefreshPlugins() {
|
|
705
|
-
const entry = createRequire(
|
|
706
|
-
typeof __filename === "string" ? __filename : import.meta.url
|
|
707
|
-
).resolve("@vitejs/plugin-react");
|
|
708
|
-
const { default: react } = await import(
|
|
709
|
-
/* @vite-ignore */
|
|
710
|
-
pathToFileURL(entry).href
|
|
711
|
-
);
|
|
712
|
-
const plugins = react().map(
|
|
713
|
-
(plugin) => Object.assign(
|
|
714
|
-
{
|
|
715
|
-
...plugin,
|
|
716
|
-
apply: /* @__PURE__ */ __name((config, env) => env.command === "serve" && !hasAppReactPlugin(config.plugins), "apply")
|
|
717
|
-
},
|
|
718
|
-
{ [FARM_OWNED]: true }
|
|
719
|
-
)
|
|
720
|
-
);
|
|
721
|
-
return [...plugins, createFarmReactRefreshPreamblePlugin()];
|
|
722
|
-
}
|
|
723
|
-
__name(createFarmReactRefreshPlugins, "createFarmReactRefreshPlugins");
|
|
724
|
-
|
|
725
671
|
// src/navigation/page-data-error.ts
|
|
726
672
|
function resolveFarmPageDataFailure(error) {
|
|
727
673
|
if (isFarmNotFoundError(error)) {
|
|
@@ -823,7 +769,7 @@ function loadFarmWorkflowsDevRuntime() {
|
|
|
823
769
|
}
|
|
824
770
|
__name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
|
|
825
771
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
826
|
-
return import("./devtools-
|
|
772
|
+
return import("./devtools-LJ4IGYGW.mjs");
|
|
827
773
|
}
|
|
828
774
|
__name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
|
|
829
775
|
function loadFarmDevtoolsUIRuntime() {
|
|
@@ -1246,7 +1192,7 @@ function fileContainsProgrammaticPageRoute(file) {
|
|
|
1246
1192
|
__name(fileContainsProgrammaticPageRoute, "fileContainsProgrammaticPageRoute");
|
|
1247
1193
|
function rewriteEarlySsrRelativeImports(options) {
|
|
1248
1194
|
const cleanId = options.id.split("?", 1)[0];
|
|
1249
|
-
if (!
|
|
1195
|
+
if (!path5.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
|
|
1250
1196
|
return null;
|
|
1251
1197
|
}
|
|
1252
1198
|
const replacements = [];
|
|
@@ -1266,7 +1212,7 @@ function rewriteEarlySsrRelativeImports(options) {
|
|
|
1266
1212
|
const suffixIndex = source.value.search(/[?#]/);
|
|
1267
1213
|
const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
|
|
1268
1214
|
const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
|
|
1269
|
-
const resolvedPath =
|
|
1215
|
+
const resolvedPath = path5.resolve(path5.dirname(cleanId), sourcePath);
|
|
1270
1216
|
replacements.push({
|
|
1271
1217
|
start: source.start,
|
|
1272
1218
|
end: source.end,
|
|
@@ -1297,7 +1243,8 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1297
1243
|
const safeName = exportName.replace(/[^A-Za-z0-9_$]/g, "_");
|
|
1298
1244
|
const wrapperName = `__farm_isolated_boundary_${safeName || "default"}__`;
|
|
1299
1245
|
wrapperStatements.push(
|
|
1300
|
-
|
|
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)});`
|
|
1301
1248
|
);
|
|
1302
1249
|
wrapperStatements.push(
|
|
1303
1250
|
isDefault ? `export default ${wrapperName};` : `export { ${wrapperName} as ${exportName} };`
|
|
@@ -1353,8 +1300,9 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1353
1300
|
for (const replacement of replacements.sort((left, right) => right.start - left.start)) {
|
|
1354
1301
|
output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
|
|
1355
1302
|
}
|
|
1356
|
-
|
|
1357
|
-
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}
|
|
1358
1306
|
${output}
|
|
1359
1307
|
${wrapperStatements.join("\n")}
|
|
1360
1308
|
export const __farm_client_boundary_originals__ = Object.freeze({ ${originalEntries.join(", ")} });
|
|
@@ -1472,7 +1420,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1472
1420
|
},
|
|
1473
1421
|
server: {
|
|
1474
1422
|
fs: {
|
|
1475
|
-
...layerRoots.length ? { allow: [
|
|
1423
|
+
...layerRoots.length ? { allow: [path5.resolve(options.root || process.cwd()), ...layerRoots] } : {},
|
|
1476
1424
|
deny: getFarmDevFsDeny(userConfig.server?.fs?.deny, options)
|
|
1477
1425
|
}
|
|
1478
1426
|
}
|
|
@@ -1549,7 +1497,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1549
1497
|
});
|
|
1550
1498
|
}
|
|
1551
1499
|
const sourceRoots = getFarmSourceRoots(farmConfig);
|
|
1552
|
-
server.watcher.add(sourceRoots.map((source) =>
|
|
1500
|
+
server.watcher.add(sourceRoots.map((source) => path5.join(source.root, source.srcDir)));
|
|
1553
1501
|
if (farmConfig.i18n.enabled) {
|
|
1554
1502
|
server.watcher.add(
|
|
1555
1503
|
farmConfig.i18n.locales.map(
|
|
@@ -1564,7 +1512,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1564
1512
|
...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
|
|
1565
1513
|
], "getExtraRouteTypes");
|
|
1566
1514
|
const appDirSlugs = sourceRoots.map(
|
|
1567
|
-
(source) =>
|
|
1515
|
+
(source) => path5.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
|
|
1568
1516
|
);
|
|
1569
1517
|
const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
|
|
1570
1518
|
try {
|
|
@@ -1605,7 +1553,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1605
1553
|
}, "generateTypeArtifacts");
|
|
1606
1554
|
await generateTypeArtifacts("startup");
|
|
1607
1555
|
const srcDirSlugs = sourceRoots.map(
|
|
1608
|
-
(source) =>
|
|
1556
|
+
(source) => path5.join(source.root, source.srcDir).replace(/\\/g, "/")
|
|
1609
1557
|
);
|
|
1610
1558
|
const layerConfigFiles = new Set(
|
|
1611
1559
|
farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
|
|
@@ -1753,7 +1701,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1753
1701
|
farmApp.getServerRenderer().setAPIRouteLookup((routePath) => apiRouteManager.getRoutes().has(routePath));
|
|
1754
1702
|
let discoveredWorkflows = [];
|
|
1755
1703
|
const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
|
|
1756
|
-
(dir) => fs2.existsSync(
|
|
1704
|
+
(dir) => fs2.existsSync(path5.isAbsolute(dir) ? dir : path5.join(farmConfig.root, dir))
|
|
1757
1705
|
);
|
|
1758
1706
|
if (hasWorkflowDirectory) {
|
|
1759
1707
|
const { createFarmWorkflowRequestHandler, discoverFarmWorkflows } = await loadFarmWorkflowsDevRuntime();
|
|
@@ -1858,7 +1806,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1858
1806
|
if (specifier === farmConfig.docs.adapter?.server && resolved?.id) {
|
|
1859
1807
|
return import(
|
|
1860
1808
|
/* @vite-ignore */
|
|
1861
|
-
|
|
1809
|
+
pathToFileURL(resolved.id).href
|
|
1862
1810
|
);
|
|
1863
1811
|
}
|
|
1864
1812
|
return loadFarmDevModule(server, resolved?.id ?? specifier);
|
|
@@ -2246,12 +2194,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2246
2194
|
}),
|
|
2247
2195
|
defaultMCP: /* @__PURE__ */ __name(() => farmApp.getServerRenderer().getDefaultMCPServer(), "defaultMCP"),
|
|
2248
2196
|
// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
2249
|
-
guardCoversPath: /* @__PURE__ */ __name((
|
|
2197
|
+
guardCoversPath: /* @__PURE__ */ __name((path6) => farmPathGuardCoversEndpoint(
|
|
2250
2198
|
{
|
|
2251
2199
|
config: farmConfig,
|
|
2252
2200
|
middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
|
|
2253
2201
|
},
|
|
2254
|
-
|
|
2202
|
+
path6,
|
|
2255
2203
|
apiServerBasePath
|
|
2256
2204
|
), "guardCoversPath")
|
|
2257
2205
|
}
|
|
@@ -3329,7 +3277,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3329
3277
|
const isolatedHydrationMode = resolveFarmIsolatedClientHydrationMode(
|
|
3330
3278
|
resolvedConfig?.experimental?.isolatedClientHydration,
|
|
3331
3279
|
{
|
|
3332
|
-
serverComponents: resolvedConfig?.experimental?.serverComponents ===
|
|
3280
|
+
serverComponents: resolveFarmServerComponentsMode(resolvedConfig?.experimental?.serverComponents) === "rsc",
|
|
3333
3281
|
hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
|
|
3334
3282
|
}
|
|
3335
3283
|
);
|
|
@@ -3354,7 +3302,8 @@ ${generatedDevIndicatorsClientRuntime}`,
|
|
|
3354
3302
|
generateClientCachePersistenceCode(
|
|
3355
3303
|
resolveFarmClientCacheAdapterEntry(root, resolvedConfig?.cache)
|
|
3356
3304
|
),
|
|
3357
|
-
isReactRenderer(renderer) ? getFarmDocsAdapterConfigModule(docs) : void 0
|
|
3305
|
+
isReactRenderer(renderer) ? getFarmDocsAdapterConfigModule(docs) : void 0,
|
|
3306
|
+
resolveFarmServerComponentsMode(resolvedConfig?.experimental?.serverComponents) === "islands"
|
|
3358
3307
|
);
|
|
3359
3308
|
}
|
|
3360
3309
|
if (id === "/@farm/server") {
|
|
@@ -3430,6 +3379,19 @@ export const manifest = getManifest();
|
|
|
3430
3379
|
}
|
|
3431
3380
|
},
|
|
3432
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
|
+
}
|
|
3433
3395
|
if (!transformOptions?.ssr) {
|
|
3434
3396
|
const docsConfigModule = getFarmDocsAdapterConfigModule(farmApp?.getConfig()?.docs);
|
|
3435
3397
|
if (isFarmDocsClientConfigModule(id, docsConfigModule)) {
|
|
@@ -3493,14 +3455,15 @@ export const manifest = getManifest();
|
|
|
3493
3455
|
const root = currentConfig.root || server?.config.root || process.cwd();
|
|
3494
3456
|
const cleanId = id.split("?", 1)[0];
|
|
3495
3457
|
const selectedIsolatedModules = options.isolatedClientBoundaryModules ?? farmApp?.getRouteManager().getIsolatedClientBoundaryModules(root);
|
|
3496
|
-
const selectedForIsolatedHydration = selectedIsolatedModules?.has(
|
|
3458
|
+
const selectedForIsolatedHydration = selectedIsolatedModules?.has(path5.resolve(cleanId)) === true;
|
|
3497
3459
|
if (isReactRenderer(resolveFarmRenderer(currentConfig.renderer)) && selectedForIsolatedHydration && isIsolatableClientBoundarySource(clientBoundarySource)) {
|
|
3498
3460
|
isolatedModuleReference = toViteModuleId(cleanId, root);
|
|
3499
3461
|
const transformedBoundary = transformIsolatedClientBoundaryModule({
|
|
3500
3462
|
code: transformedCode,
|
|
3501
3463
|
moduleReference: isolatedModuleReference,
|
|
3502
3464
|
islandStrategy: getIslandStrategyExport(clientBoundarySource) ?? "load",
|
|
3503
|
-
parse: /* @__PURE__ */ __name((source) => this.parse(source), "parse")
|
|
3465
|
+
parse: /* @__PURE__ */ __name((source) => this.parse(source), "parse"),
|
|
3466
|
+
slots: resolveFarmServerComponentsMode(currentConfig.experimental?.serverComponents) === "islands"
|
|
3504
3467
|
});
|
|
3505
3468
|
if (!transformedBoundary) {
|
|
3506
3469
|
this.error(
|
|
@@ -3585,8 +3548,8 @@ if (import.meta.hot) {
|
|
|
3585
3548
|
}
|
|
3586
3549
|
logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
|
|
3587
3550
|
logger.info("Pre-rendering SSG pages...");
|
|
3588
|
-
const outDir =
|
|
3589
|
-
const clientDir =
|
|
3551
|
+
const outDir = path5.join(server?.config.root || process.cwd(), options.outDir || "dist");
|
|
3552
|
+
const clientDir = path5.join(outDir, "client");
|
|
3590
3553
|
for (const page of ssgPages) {
|
|
3591
3554
|
try {
|
|
3592
3555
|
const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
|
|
@@ -3638,8 +3601,8 @@ if (import.meta.hot) {
|
|
|
3638
3601
|
<script type="module" src="/assets/client.js"></script>
|
|
3639
3602
|
</body>
|
|
3640
3603
|
</html>`;
|
|
3641
|
-
const outputPath = page.urlPath === "/" ?
|
|
3642
|
-
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 });
|
|
3643
3606
|
fs2.writeFileSync(outputPath, fullHtml);
|
|
3644
3607
|
const revalidateInfo = page.revalidate ? ` (revalidate: ${page.revalidate}s)` : "";
|
|
3645
3608
|
logger.success(` \u2713 ${page.urlPath}${revalidateInfo}`);
|
|
@@ -3648,7 +3611,7 @@ if (import.meta.hot) {
|
|
|
3648
3611
|
logger.error(` \u2717 ${page.urlPath}: ${error}`);
|
|
3649
3612
|
}
|
|
3650
3613
|
}
|
|
3651
|
-
const manifestPath =
|
|
3614
|
+
const manifestPath = path5.join(outDir, "__ssg_manifest.json");
|
|
3652
3615
|
fs2.writeFileSync(
|
|
3653
3616
|
manifestPath,
|
|
3654
3617
|
JSON.stringify(
|
|
@@ -3692,9 +3655,9 @@ if (import.meta.hot) {
|
|
|
3692
3655
|
server2.ws.send({ type: "full-reload", path: "*" });
|
|
3693
3656
|
return [];
|
|
3694
3657
|
}
|
|
3695
|
-
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;
|
|
3696
3659
|
if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
|
|
3697
|
-
logUpdate("PAGE", `updated ${
|
|
3660
|
+
logUpdate("PAGE", `updated ${path5.basename(file)}`);
|
|
3698
3661
|
for (const mod of modules) {
|
|
3699
3662
|
server2.moduleGraph.invalidateModule(mod);
|
|
3700
3663
|
}
|
|
@@ -3828,10 +3791,10 @@ function createPageDataMiddlewareRequest(req, target) {
|
|
|
3828
3791
|
__name(createPageDataMiddlewareRequest, "createPageDataMiddlewareRequest");
|
|
3829
3792
|
function resolveDevelopmentRoot(farmRoot, viteRoot) {
|
|
3830
3793
|
if (!farmRoot) return viteRoot;
|
|
3831
|
-
if (
|
|
3794
|
+
if (path5.resolve(farmRoot) === path5.resolve(viteRoot)) return farmRoot;
|
|
3832
3795
|
try {
|
|
3833
3796
|
if (fs2.realpathSync(farmRoot) === fs2.realpathSync(viteRoot)) {
|
|
3834
|
-
return
|
|
3797
|
+
return path5.resolve(viteRoot);
|
|
3835
3798
|
}
|
|
3836
3799
|
} catch {
|
|
3837
3800
|
}
|
|
@@ -4219,7 +4182,7 @@ function parseRouteModuleSchema(schema, value, label, routePath) {
|
|
|
4219
4182
|
}
|
|
4220
4183
|
}
|
|
4221
4184
|
__name(parseRouteModuleSchema, "parseRouteModuleSchema");
|
|
4222
|
-
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) {
|
|
4223
4186
|
const providerClientCode = generateFarmIntegrationProviderClientCode(
|
|
4224
4187
|
integrationProviders,
|
|
4225
4188
|
root,
|
|
@@ -4236,8 +4199,7 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
|
|
|
4236
4199
|
import { hydrateRoot, createRoot } from 'react-dom/client'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
|
|
4237
4200
|
import __farmAppSetup from ${JSON.stringify(toViteModuleId(appSetupPath, root))}
|
|
4238
4201
|
__farmConfigureApp(__farmAppSetup)` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
|
|
4239
|
-
const isolatedHydrationImport = isolatedHydrationEnabled ?
|
|
4240
|
-
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'"}` : "";
|
|
4241
4203
|
const docsAdapterImportBlock = generateFarmDocsAdapterClientRuntime(
|
|
4242
4204
|
docsAdapterReact,
|
|
4243
4205
|
docsConfigModule
|
|
@@ -4245,7 +4207,7 @@ import { createFarmServerTreeElement } from '@farm.js/core/internal/server-tree'
|
|
|
4245
4207
|
const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
|
|
4246
4208
|
ReactRuntime: React,
|
|
4247
4209
|
hydrateRoot,
|
|
4248
|
-
load: (reference) => import(/* @vite-ignore */ reference),
|
|
4210
|
+
load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
|
|
4249
4211
|
schedule: scheduleFarmIslandHydration,
|
|
4250
4212
|
wrap: wrapWithIntegrationProviders,
|
|
4251
4213
|
});
|
|
@@ -4265,7 +4227,7 @@ async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
|
|
|
4265
4227
|
async function createFarmServerTreePageElement(source, pathname) {
|
|
4266
4228
|
try {
|
|
4267
4229
|
return await createFarmServerTreeElement(React, source, {
|
|
4268
|
-
load: (reference) => import(/* @vite-ignore */ reference),
|
|
4230
|
+
load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
|
|
4269
4231
|
ServerHtml: FarmServerPage,
|
|
4270
4232
|
key: pathname,
|
|
4271
4233
|
});
|
|
@@ -4289,6 +4251,18 @@ import {
|
|
|
4289
4251
|
} from '@farm.js/core/deployment'
|
|
4290
4252
|
${providerClientCode.imports}
|
|
4291
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
|
+
}
|
|
4292
4266
|
${clientCachePersistence.imports}
|
|
4293
4267
|
${docsSearchClientRuntime}
|
|
4294
4268
|
${devtoolsClientRuntime}
|
|
@@ -4572,7 +4546,7 @@ class LegacyManifestSPARouter {
|
|
|
4572
4546
|
this.prefetchingUrls.add(pathname);
|
|
4573
4547
|
try {
|
|
4574
4548
|
// Prefetch by importing the module (Vite caches it)
|
|
4575
|
-
const module = await import(/* @vite-ignore */ modulePath);
|
|
4549
|
+
const module = await import(/* @vite-ignore */ farmModuleUrl(modulePath));
|
|
4576
4550
|
this.moduleCache.set(modulePath, module);
|
|
4577
4551
|
pageModuleCache.set(modulePath, module);
|
|
4578
4552
|
} catch (error) {
|
|
@@ -4820,7 +4794,7 @@ async function renderRouteSlot(slot, mode = 'render') {
|
|
|
4820
4794
|
|
|
4821
4795
|
let slotModule = pageModuleCache.get(slot.modulePath);
|
|
4822
4796
|
if (!slotModule) {
|
|
4823
|
-
slotModule = await import(/* @vite-ignore */ slot.modulePath);
|
|
4797
|
+
slotModule = await import(/* @vite-ignore */ farmModuleUrl(slot.modulePath));
|
|
4824
4798
|
pageModuleCache.set(slot.modulePath, slotModule);
|
|
4825
4799
|
}
|
|
4826
4800
|
const SlotComponent = slotModule?.default;
|
|
@@ -4985,7 +4959,7 @@ async function buildClientHydrationElement(
|
|
|
4985
4959
|
|
|
4986
4960
|
if (loadingModulePath) {
|
|
4987
4961
|
try {
|
|
4988
|
-
const loadingModule = await import(/* @vite-ignore */ loadingModulePath);
|
|
4962
|
+
const loadingModule = await import(/* @vite-ignore */ farmModuleUrl(loadingModulePath));
|
|
4989
4963
|
const LoadingComponent = loadingModule?.default;
|
|
4990
4964
|
if (LoadingComponent) {
|
|
4991
4965
|
const loadingFallback = React.createElement(LoadingComponent, {
|
|
@@ -5013,7 +4987,7 @@ async function loadLayoutComponents(layouts = []) {
|
|
|
5013
4987
|
try {
|
|
5014
4988
|
let LayoutComponent = layoutComponentCache.get(layout.modulePath);
|
|
5015
4989
|
if (!LayoutComponent) {
|
|
5016
|
-
const layoutModule = await import(/* @vite-ignore */ layout.modulePath);
|
|
4990
|
+
const layoutModule = await import(/* @vite-ignore */ farmModuleUrl(layout.modulePath));
|
|
5017
4991
|
LayoutComponent = layoutModule.default;
|
|
5018
4992
|
if (LayoutComponent) {
|
|
5019
4993
|
layoutComponentCache.set(layout.modulePath, LayoutComponent);
|
|
@@ -5175,7 +5149,7 @@ async function tryHydrateImportedPage(
|
|
|
5175
5149
|
if (pageShouldHydrate) {
|
|
5176
5150
|
let pageModule = pageModuleCache.get(modulePath);
|
|
5177
5151
|
if (!pageModule) {
|
|
5178
|
-
pageModule = await import(/* @vite-ignore */ modulePath);
|
|
5152
|
+
pageModule = await import(/* @vite-ignore */ farmModuleUrl(modulePath));
|
|
5179
5153
|
pageModuleCache.set(modulePath, pageModule);
|
|
5180
5154
|
}
|
|
5181
5155
|
if (signal?.aborted || !container?.isConnected) return false;
|
|
@@ -5334,7 +5308,7 @@ function parseNavigationFragment(html) {
|
|
|
5334
5308
|
return template.content;
|
|
5335
5309
|
}
|
|
5336
5310
|
|
|
5337
|
-
function replaceNavigationBoundary(container, fragment, currentPatterns, nextPatterns) {
|
|
5311
|
+
function replaceNavigationBoundary(container, fragment, currentPatterns, nextPatterns, refresh = false) {
|
|
5338
5312
|
let sharedCount = 0;
|
|
5339
5313
|
while (
|
|
5340
5314
|
sharedCount < currentPatterns.length &&
|
|
@@ -5361,7 +5335,9 @@ function replaceNavigationBoundary(container, fragment, currentPatterns, nextPat
|
|
|
5361
5335
|
return container;
|
|
5362
5336
|
}
|
|
5363
5337
|
|
|
5364
|
-
${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);` : ""}
|
|
5365
5341
|
currentTarget.replaceWith(nextTarget);
|
|
5366
5342
|
activateFragmentScripts(nextTarget);
|
|
5367
5343
|
if (fragmentTreeRoot && fragmentTreeRoot !== nextTarget) fragmentTreeRoot.remove();
|
|
@@ -5385,7 +5361,7 @@ let activeLayoutShouldHydrate = window.__FARM_LAYOUT_SHOULD_HYDRATE__ === true;
|
|
|
5385
5361
|
|
|
5386
5362
|
// ====== MANIFEST-DRIVEN HTML-FRAGMENT NAVIGATION ======
|
|
5387
5363
|
// One page-data response carries both server HTML and the hydration plan.
|
|
5388
|
-
async function renderPage(pageData) {
|
|
5364
|
+
async function renderPage(pageData, info) {
|
|
5389
5365
|
const container = document.getElementById('root');
|
|
5390
5366
|
if (!container) return;
|
|
5391
5367
|
cancelPendingPageHydration();
|
|
@@ -5478,7 +5454,7 @@ async function renderPage(pageData) {
|
|
|
5478
5454
|
const pageShouldHydrate = route.pageShouldHydrate || route.isClientComponent;
|
|
5479
5455
|
const layoutShouldHydrate = route.layoutShouldHydrate;
|
|
5480
5456
|
${isolatedHydrationEnabled ? `const hasIsolatedClientBoundaries = Boolean(
|
|
5481
|
-
fragment.querySelector('
|
|
5457
|
+
fragment.querySelector('f-island[src]'),
|
|
5482
5458
|
);
|
|
5483
5459
|
const shouldHydrate =
|
|
5484
5460
|
pageShouldHydrate || layoutShouldHydrate || (route.shouldHydrate && !hasIsolatedClientBoundaries);` : "const shouldHydrate = route.shouldHydrate || pageShouldHydrate || layoutShouldHydrate;"}
|
|
@@ -5514,7 +5490,7 @@ async function renderPage(pageData) {
|
|
|
5514
5490
|
if (appRoot) { try { appRoot.unmount(); } catch (error) {} appRoot = null; }
|
|
5515
5491
|
if (reactRoot) { try { reactRoot.unmount(); } catch (error) {} reactRoot = null; }
|
|
5516
5492
|
delete window.__FARM_REACT_ROOT__;
|
|
5517
|
-
${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);"}
|
|
5518
5494
|
}
|
|
5519
5495
|
|
|
5520
5496
|
const hydrationController = new AbortController();
|
|
@@ -5611,7 +5587,7 @@ async function hydrate() {
|
|
|
5611
5587
|
const modulePath = window.__FARM_PAGE_MODULE__;
|
|
5612
5588
|
${isolatedHydrationEnabled ? `const hasIsolatedClientBoundaries =
|
|
5613
5589
|
window.__FARM_HAS_ISOLATED_CLIENT_BOUNDARIES__ === true ||
|
|
5614
|
-
Boolean(rootContainer.querySelector('
|
|
5590
|
+
Boolean(rootContainer.querySelector('f-island[src]'));` : ""}
|
|
5615
5591
|
|
|
5616
5592
|
let pageProps = normalizeServerProps(window.__FARM_PROPS__);
|
|
5617
5593
|
applyCanonicalPathFromProps(pageProps);
|
|
@@ -5858,7 +5834,7 @@ function generateClientManifest(bundle) {
|
|
|
5858
5834
|
__name(generateClientManifest, "generateClientManifest");
|
|
5859
5835
|
async function defineConfig(config = {}) {
|
|
5860
5836
|
const tailwindVitePlugin = await loadTailwindVitePlugin();
|
|
5861
|
-
const appRoot =
|
|
5837
|
+
const appRoot = path5.resolve(config.root || process.cwd());
|
|
5862
5838
|
if (config.extends?.length) {
|
|
5863
5839
|
const { config: layeredConfig } = await import("./layers-UTB43B7A.mjs").then(
|
|
5864
5840
|
({ resolveFarmLayers }) => resolveFarmLayers(config, {
|
|
@@ -6079,7 +6055,6 @@ __name(defineConfig, "defineConfig");
|
|
|
6079
6055
|
|
|
6080
6056
|
export {
|
|
6081
6057
|
farmImageImportsPlugin,
|
|
6082
|
-
createFarmReactRefreshPlugins,
|
|
6083
6058
|
farmI18nClientBridgePlugin,
|
|
6084
6059
|
farmServerOnlyEntriesPlugin,
|
|
6085
6060
|
withFarmRequestTracing,
|