@farm.js/core 0.1.82 → 0.1.83
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.d-C2Su3x4D.d.ts → agent-mcp.d-7uKdOttc.d.ts} +1 -1
- package/dist/{agent-mcp.d-Yak-LqRd.d.mts → agent-mcp.d-LChlR2au.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -1
- package/dist/agent-runtime.d.ts +2 -1
- package/dist/analyzer-WGH6J2HN.cjs +17 -0
- package/dist/{analyzer-RPU2KG4J.mjs → analyzer-Y6IY26HI.mjs} +2 -2
- package/dist/api/node.d.mts +4 -3
- package/dist/api/node.d.ts +4 -3
- package/dist/api/route-manager.d.mts +4 -3
- package/dist/api/route-manager.d.ts +4 -3
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api.d.mts +5 -4
- package/dist/api.d.ts +5 -4
- package/dist/{app-manifest.d-DZyXaICz.d.ts → app-manifest.d-CRp21oAz.d.ts} +1 -1
- package/dist/{app-manifest.d-BcyOFMrg.d.mts → app-manifest.d-QMdmqqCr.d.mts} +1 -1
- package/dist/app-markdown.d.mts +3 -2
- package/dist/app-markdown.d.ts +3 -2
- package/dist/{app.d-CIoXsAbN.d.ts → app.d-CVPu_hoD.d.ts} +34 -4
- package/dist/{app.d-C0ePpuaG.d.mts → app.d-eSm7jgoc.d.mts} +34 -4
- package/dist/{chunk-JK26IMT7.cjs → chunk-3CZ4MJHW.cjs} +1 -1
- package/dist/{chunk-5MUFW5UU.cjs → chunk-3DAJXBSL.cjs} +2 -2
- package/dist/{chunk-XMHERKSE.mjs → chunk-42IBGQTN.mjs} +5 -12
- package/dist/{chunk-4X7LSGM6.mjs → chunk-43N3X6OO.mjs} +1 -1
- package/dist/{chunk-LM2ZDNDD.cjs → chunk-55UJGUBP.cjs} +24 -19
- package/dist/{chunk-TPA2PV5J.mjs → chunk-5V6HSJFG.mjs} +24 -1
- package/dist/chunk-5X5GJU5A.cjs +426 -0
- package/dist/{chunk-Q2VOT3K2.cjs → chunk-7X2CYE66.cjs} +316 -310
- package/dist/{chunk-6BPFIYGY.cjs → chunk-A5BHJHDF.cjs} +3 -3
- package/dist/{chunk-EL2Z6YFZ.mjs → chunk-B5SJYXJK.mjs} +177 -67
- package/dist/chunk-BUQR7KKO.mjs +17 -0
- package/dist/{chunk-724WT3NI.mjs → chunk-CRE642TW.mjs} +1 -1
- package/dist/{chunk-NRCKBDYP.mjs → chunk-DPUZVGXH.mjs} +130 -27
- package/dist/{chunk-N2EFMN2K.cjs → chunk-DZTWUEBB.cjs} +2 -2
- package/dist/{chunk-DRO3NXA3.cjs → chunk-EFI6QWBQ.cjs} +200 -90
- package/dist/chunk-ELNRKD4V.mjs +426 -0
- package/dist/{chunk-63ZE6B6M.mjs → chunk-FFWSER54.mjs} +1 -1
- package/dist/chunk-FZ7OUN5M.cjs +30 -0
- package/dist/{chunk-5MMKNW7Q.cjs → chunk-H7REG7OX.cjs} +15 -8
- package/dist/{chunk-VMBIKDKW.cjs → chunk-HRH7OKBQ.cjs} +6 -4
- package/dist/{chunk-RMPUEH5T.cjs → chunk-IABI62FH.cjs} +2 -2
- package/dist/{chunk-ZIZRIZLP.mjs → chunk-IAIRQAHA.mjs} +3 -1
- package/dist/{chunk-EX6ZSN5P.cjs → chunk-IZYFP7IN.cjs} +17 -24
- package/dist/chunk-J6RFB324.cjs +17 -0
- package/dist/{chunk-ARORZ3MH.cjs → chunk-JHRJ5V2F.cjs} +366 -263
- package/dist/{chunk-OMB7UGVW.mjs → chunk-K3GHY7GY.mjs} +14 -9
- package/dist/{chunk-UVV3I5QA.cjs → chunk-L2GUEYHR.cjs} +29 -6
- package/dist/{chunk-HHQEKLZL.cjs → chunk-LN6FAYNB.cjs} +36 -31
- package/dist/chunk-M6AJZ4XR.mjs +30 -0
- package/dist/{chunk-47I2MYIR.mjs → chunk-NDWI6FDH.mjs} +442 -180
- package/dist/{chunk-BCTHOQPP.cjs → chunk-NGTZHWBG.cjs} +68 -1
- package/dist/{chunk-OP5VI4TP.mjs → chunk-NKVBWPXR.mjs} +1 -1
- package/dist/{chunk-CD5Z7RR5.cjs → chunk-OM6JIIJU.cjs} +4 -4
- package/dist/{chunk-C3VCYOU4.mjs → chunk-ORBBAA7B.mjs} +1 -1
- package/dist/{chunk-I4DR3HCH.mjs → chunk-R3VLM2MW.mjs} +1 -1
- package/dist/{chunk-I4WZRG73.mjs → chunk-RB5IGN3N.mjs} +13 -6
- package/dist/{chunk-RMLR5RMH.mjs → chunk-RGTZAM6Y.mjs} +67 -0
- package/dist/{chunk-GXLNARPO.mjs → chunk-RNJX3MD6.mjs} +1 -1
- package/dist/{chunk-EJCVG25Z.mjs → chunk-S3R4JDRO.mjs} +17 -9
- package/dist/{chunk-AIPZDBP6.cjs → chunk-SLIXHUMS.cjs} +780 -518
- package/dist/{chunk-WFVSAT7Y.cjs → chunk-T7HGXF7D.cjs} +3 -3
- package/dist/{chunk-CJDBTTLB.mjs → chunk-U56Z3755.mjs} +10 -5
- package/dist/{chunk-QSMUMK7Y.mjs → chunk-VQ6IXALL.mjs} +2 -2
- package/dist/{chunk-B2PGVHBG.cjs → chunk-WCSBYQOT.cjs} +4 -4
- package/dist/{chunk-DAXU2NBE.mjs → chunk-WZV2G2A6.mjs} +30 -24
- package/dist/{chunk-SM2SYWAR.cjs → chunk-XJDB564A.cjs} +18 -10
- package/dist/{cli-runtime.d-Hnvvadz7.d.mts → cli-runtime.d-C7aMfoTq.d.mts} +8 -6
- package/dist/{cli-runtime.d-I0MphTbc.d.ts → cli-runtime.d-DaElKjaL.d.ts} +8 -6
- package/dist/{client-component.d-DapRqtSC.d.mts → client-component.d-DLMCzmUx.d.mts} +1 -1
- package/dist/{client-component.d-5QEvtJsg.d.ts → client-component.d-DLknFP8l.d.ts} +1 -1
- package/dist/{client-plugins.d-DcmDzcSC.d.ts → client-plugins.d-BVXjyIkY.d.ts} +14 -0
- package/dist/{client-plugins.d-C1WM3ieD.d.mts → client-plugins.d-BwKwuO_0.d.mts} +14 -0
- package/dist/client-plugins.d.mts +2 -1
- package/dist/client-plugins.d.ts +2 -1
- package/dist/client.cjs +4 -3
- package/dist/client.d.mts +10 -9
- package/dist/client.d.ts +10 -9
- package/dist/client.mjs +3 -2
- package/dist/config.d.mts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/desktop.d.mts +3 -2
- package/dist/desktop.d.ts +3 -2
- package/dist/{devtools-C5GXZZ7E.mjs → devtools-OI52TCSD.mjs} +3 -3
- package/dist/{devtools-5B7NZE6F.cjs → devtools-ZM2AR36W.cjs} +5 -5
- package/dist/docs.cjs +8 -7
- package/dist/docs.d.mts +15 -6
- package/dist/docs.d.ts +15 -6
- package/dist/docs.mjs +7 -6
- package/dist/environment/vite.cjs +4 -4
- package/dist/environment/vite.d.mts +1 -0
- package/dist/environment/vite.d.ts +1 -0
- package/dist/environment/vite.mjs +3 -3
- package/dist/{generate-route-types.d-CaGMIaNI.d.mts → generate-route-types.d-BFOMM8Ef.d.mts} +3 -0
- package/dist/{generate-route-types.d-B76M5R11.d.ts → generate-route-types.d-C2m8myHb.d.ts} +3 -0
- package/dist/{handler.d-B8bPCBzl.d.mts → handler.d-BKTWzzNA.d.mts} +1 -1
- package/dist/{handler.d-Cliwo6Nu.d.ts → handler.d-Dzpyg3-N.d.ts} +1 -1
- package/dist/{headers.d-CVwSpSGX.d.mts → headers.d-5opjyhXw.d.mts} +1 -1
- package/dist/{headers.d-C_btqjV6.d.ts → headers.d-PZyXcDAH.d.ts} +1 -1
- package/dist/index.cjs +25 -23
- package/dist/{index.d-DFuMZk9-.d.mts → index.d-C0Mie66f.d.mts} +1 -1
- package/dist/{index.d-hOEbMcLk.d.ts → index.d-DV2q-0mE.d.ts} +1 -1
- package/dist/index.d.mts +26 -25
- package/dist/index.d.ts +26 -25
- package/dist/index.mjs +25 -23
- package/dist/integrations/orm.d.mts +2 -1
- package/dist/integrations/orm.d.ts +2 -1
- package/dist/integrations.d.mts +2 -1
- package/dist/integrations.d.ts +2 -1
- package/dist/internal/app-markdown-runtime.d.mts +3 -2
- package/dist/internal/app-markdown-runtime.d.ts +3 -2
- package/dist/internal/build-runtime.cjs +21 -21
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +20 -20
- package/dist/internal/cli-runtime.cjs +6 -6
- package/dist/internal/cli-runtime.d.mts +8 -7
- package/dist/internal/cli-runtime.d.ts +8 -7
- package/dist/internal/cli-runtime.mjs +5 -5
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +2 -1
- package/dist/internal/compression-runtime.d.ts +2 -1
- package/dist/internal/config-runtime.cjs +5 -5
- package/dist/internal/config-runtime.d.mts +6 -5
- package/dist/internal/config-runtime.d.ts +6 -5
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-action-client.cjs +18 -0
- package/dist/internal/islands-action-client.d.mts +18 -0
- package/dist/internal/islands-action-client.d.ts +18 -0
- package/dist/internal/islands-action-client.mjs +18 -0
- package/dist/internal/islands-runtime.cjs +3 -8
- package/dist/internal/islands-runtime.mjs +4 -9
- package/dist/internal/islx-actions-client.cjs +4 -3
- package/dist/internal/islx-actions-client.mjs +3 -2
- package/dist/internal/islx-actions-server.d.mts +0 -2
- package/dist/internal/islx-actions-server.d.ts +0 -2
- package/dist/internal/islx-client.cjs +13 -1
- package/dist/internal/islx-client.d.mts +11 -0
- package/dist/internal/islx-client.d.ts +11 -0
- package/dist/internal/islx-client.mjs +14 -0
- package/dist/internal/metadata-image-runtime.d.mts +1 -0
- package/dist/internal/metadata-image-runtime.d.ts +1 -0
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +5 -5
- package/dist/internal/production-runtime.d.mts +11 -11
- package/dist/internal/production-runtime.d.ts +11 -11
- package/dist/internal/production-runtime.mjs +4 -4
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/start-manifest.d.mts +2 -1
- package/dist/internal/start-manifest.d.ts +2 -1
- package/dist/markdown.d.mts +2 -1
- package/dist/markdown.d.ts +2 -1
- package/dist/middleware.d.mts +2 -1
- package/dist/middleware.d.ts +2 -1
- package/dist/mobile.d.mts +6 -3
- package/dist/mobile.d.ts +6 -3
- package/dist/{mount.d-DLeYxeRR.d.mts → mount.d-CZ_qL1iS.d.mts} +1 -1
- package/dist/{mount.d-CAovYKfs.d.ts → mount.d-gWul1GA1.d.ts} +1 -1
- package/dist/{navigation-delegate.d-Chv93QS6.d.mts → navigation-delegate.d-BBTzhJLj.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BLM-8Q3Z.d.ts → navigation-delegate.d-BZsYEAet.d.ts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/plugin.cjs +15 -15
- package/dist/plugin.d.mts +6 -6
- package/dist/plugin.d.ts +6 -6
- package/dist/plugin.mjs +14 -14
- package/dist/{render-plan.d-BSTjTH8h.d.ts → render-plan.d-AaJsYPX-.d.ts} +1 -1
- package/dist/{render-plan.d-CK5Lggyb.d.mts → render-plan.d-bnWxS12w.d.mts} +1 -1
- package/dist/renderer-client.cjs +6 -5
- package/dist/renderer-client.d.mts +8 -7
- package/dist/renderer-client.d.ts +8 -7
- package/dist/renderer-client.mjs +2 -1
- package/dist/renderer.cjs +6 -2
- package/dist/renderer.d.mts +87 -4
- package/dist/renderer.d.ts +87 -4
- package/dist/renderer.mjs +5 -1
- package/dist/{request.d-BhggxQf3.d.mts → request.d-C2HOn3Hi.d.mts} +1 -1
- package/dist/{request.d-CyJS9bjm.d.ts → request.d-CAeitOG1.d.ts} +1 -1
- package/dist/request.d.mts +3 -2
- package/dist/request.d.ts +3 -2
- package/dist/{route-rendering.d-BLPPmI5I.d.ts → route-rendering.d-A1dIkUK5.d.ts} +1 -1
- package/dist/{route-rendering.d-CUpG2mZJ.d.mts → route-rendering.d-CYA-ulnX.d.mts} +1 -1
- package/dist/{router.d-2NQM1Kgw.d.mts → router.d-8lxnzlkr.d.mts} +1 -1
- package/dist/{router.d-0X2Ki6rf.d.ts → router.d-A_Yt6jYz.d.ts} +1 -1
- package/dist/{routes.d-CCccJRrp.d.mts → routes.d-BWvpUoYu.d.mts} +1 -1
- package/dist/{routes.d-b7khoRoU.d.ts → routes.d-D7RWvfqL.d.ts} +1 -1
- package/dist/routes.d.mts +2 -1
- package/dist/routes.d.ts +2 -1
- package/dist/{rsc-pipeline-5AOF64FL.cjs → rsc-pipeline-MFJZGDPE.cjs} +5 -5
- package/dist/{rsc-pipeline-DNRLYOJ7.mjs → rsc-pipeline-TRZVFCBX.mjs} +4 -4
- package/dist/{runtime-ZVHG5SRB.cjs → runtime-MJUG2HGR.cjs} +10 -9
- package/dist/{runtime-EHG2FRXZ.mjs → runtime-O4Y3Z6V3.mjs} +6 -5
- package/dist/{runtime.d-CXuwkUgr.d.ts → runtime.d-BPyvWrgQ.d.ts} +1 -1
- package/dist/{runtime.d-CaFXcu_Q.d.mts → runtime.d-C_rZ9_DD.d.mts} +1 -1
- package/dist/{server-components-status.d-Cp7zvBm5.d.mts → server-components-status.d-BpxiEMQE.d.mts} +1 -1
- package/dist/{server-components-status.d-BdeFD8ZH.d.ts → server-components-status.d-C2UEKJn7.d.ts} +1 -1
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server-query-call.d-rVM_lsYk.d.mts +15 -0
- package/dist/server-query-call.d-rVM_lsYk.d.ts +15 -0
- package/dist/server-query-client.cjs +5 -3
- package/dist/server-query-client.d.mts +3 -2
- package/dist/server-query-client.d.ts +3 -2
- package/dist/server-query-client.mjs +5 -3
- package/dist/{server-query-runtime.d-DXRNhX_3.d.ts → server-query-runtime.d-BlHd90D0.d.ts} +2 -8
- package/dist/{server-query-runtime.d-aP52iuL5.d.mts → server-query-runtime.d-CCLGkQtE.d.mts} +2 -8
- package/dist/server.cjs +39 -39
- package/dist/server.d.mts +12 -12
- package/dist/server.d.ts +12 -12
- package/dist/server.mjs +16 -16
- package/dist/{spa-router.d-l3G38xHa.d.mts → spa-router.d-BD-6WX1R.d.mts} +2 -2
- package/dist/{spa-router.d-Bjgl-Osi.d.ts → spa-router.d-Cw5i_15e.d.ts} +2 -2
- package/dist/{ssg.d-DDca17Lc.d.ts → ssg.d-Bifiq0EL.d.ts} +2 -2
- package/dist/{ssg.d-RnlHOqUL.d.mts → ssg.d-CCE9aob5.d.mts} +2 -2
- package/dist/{store-core.d-BaOUOPf7.d.ts → store-core.d-5tVn5vi1.d.ts} +3 -3
- package/dist/{store-core.d-BZjuC6Zc.d.mts → store-core.d-BN2MxSG9.d.mts} +3 -3
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/{utils.d-D8TWmpWo.d.ts → utils.d-BUjpSNIO.d.ts} +1 -1
- package/dist/{utils.d-tdzw0_zQ.d.mts → utils.d-wGPLeVbq.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +15 -15
- package/dist/vite.d.mts +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.mjs +14 -14
- package/package.json +6 -1
- package/dist/analyzer-LV23T6QN.cjs +0 -17
- package/dist/chunk-AUFEM3FB.mjs +0 -229
- package/dist/chunk-S7WZUK3B.cjs +0 -229
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk3DAJXBSLcjs = require('./chunk-3DAJXBSL.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
|
|
@@ -64,7 +64,7 @@ function findFarmNativeScreenFiles(appDirs) {
|
|
|
64
64
|
}
|
|
65
65
|
function collectFarmNativeServerFns(options) {
|
|
66
66
|
const { root, srcDir } = options;
|
|
67
|
-
const aliases =
|
|
67
|
+
const aliases = _chunk3DAJXBSLcjs.readAliases.call(void 0, root, srcDir);
|
|
68
68
|
const seen = /* @__PURE__ */ new Set();
|
|
69
69
|
const found = /* @__PURE__ */ new Map();
|
|
70
70
|
const queue = [...options.entries];
|
|
@@ -98,7 +98,7 @@ function collectFarmNativeServerFns(options) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
for (const candidate of _nullishCoalesce(candidates, () => ( []))) {
|
|
101
|
-
const resolved =
|
|
101
|
+
const resolved = _chunk3DAJXBSLcjs.resolveFile.call(void 0, candidate);
|
|
102
102
|
if (resolved && SCRIPT.test(resolved) && !resolved.includes(`${_path2.default.sep}node_modules${_path2.default.sep}`)) {
|
|
103
103
|
queue.push(resolved);
|
|
104
104
|
break;
|
|
@@ -13,9 +13,11 @@ import {
|
|
|
13
13
|
getFarmSourceRoots
|
|
14
14
|
} from "./chunk-Z3RM3VA2.mjs";
|
|
15
15
|
import {
|
|
16
|
+
createFarmRendererHookError,
|
|
16
17
|
getFarmRendererComponentExtensions,
|
|
17
|
-
isReactRenderer
|
|
18
|
-
|
|
18
|
+
isReactRenderer,
|
|
19
|
+
readFarmRendererHydration
|
|
20
|
+
} from "./chunk-RGTZAM6Y.mjs";
|
|
19
21
|
import {
|
|
20
22
|
PROGRAMMATIC_ROUTE_FILE_NAMES,
|
|
21
23
|
getProgrammaticRouteDefinitionSource,
|
|
@@ -26,11 +28,11 @@ import {
|
|
|
26
28
|
} from "./chunk-U6GMCDRS.mjs";
|
|
27
29
|
import {
|
|
28
30
|
FARM_VERSION
|
|
29
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-NKVBWPXR.mjs";
|
|
30
32
|
|
|
31
33
|
// src/environment-vite.ts
|
|
32
34
|
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
33
|
-
import
|
|
35
|
+
import path9 from "path";
|
|
34
36
|
|
|
35
37
|
// src/diagnostics.ts
|
|
36
38
|
import { TraceMap, originalPositionFor } from "@jridgewell/trace-mapping";
|
|
@@ -1606,8 +1608,8 @@ function toModuleFile(file) {
|
|
|
1606
1608
|
}
|
|
1607
1609
|
|
|
1608
1610
|
// src/utils/client-component.ts
|
|
1609
|
-
import
|
|
1610
|
-
import
|
|
1611
|
+
import fs7 from "fs";
|
|
1612
|
+
import path8 from "path";
|
|
1611
1613
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1612
1614
|
|
|
1613
1615
|
// src/islands-package-references.ts
|
|
@@ -2330,6 +2332,101 @@ function dropLatestPackageClientBoundaryCache() {
|
|
|
2330
2332
|
latestDevCache = void 0;
|
|
2331
2333
|
}
|
|
2332
2334
|
|
|
2335
|
+
// src/utils/renderer-hydration.ts
|
|
2336
|
+
import fs6 from "fs";
|
|
2337
|
+
import path7 from "path";
|
|
2338
|
+
var scopes = /* @__PURE__ */ new Map();
|
|
2339
|
+
function realPath(file) {
|
|
2340
|
+
try {
|
|
2341
|
+
return fs6.realpathSync(file);
|
|
2342
|
+
} catch {
|
|
2343
|
+
return path7.resolve(file);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
function setFarmRendererHydrationScope(roots, renderer, routeModules) {
|
|
2347
|
+
const keys = roots.map(realPath);
|
|
2348
|
+
const ruleSetsHydration = routeModules.some(
|
|
2349
|
+
(entry) => entry.hydration?.hydrate !== void 0 || entry.hydration?.strategy !== void 0
|
|
2350
|
+
);
|
|
2351
|
+
if (!renderer?.hydration && !ruleSetsHydration) {
|
|
2352
|
+
for (const key of keys) scopes.delete(key);
|
|
2353
|
+
return () => {
|
|
2354
|
+
};
|
|
2355
|
+
}
|
|
2356
|
+
const scope = {
|
|
2357
|
+
renderer,
|
|
2358
|
+
extensions: new Set((renderer.componentExtensions ?? []).map(normalizeExtension)),
|
|
2359
|
+
routeModules: new Map(
|
|
2360
|
+
routeModules.map((entry) => [
|
|
2361
|
+
realPath(entry.modulePath),
|
|
2362
|
+
{ kind: entry.kind, hydration: entry.hydration ?? {} }
|
|
2363
|
+
])
|
|
2364
|
+
)
|
|
2365
|
+
};
|
|
2366
|
+
for (const key of keys) scopes.set(key, scope);
|
|
2367
|
+
return () => {
|
|
2368
|
+
for (const key of keys) if (scopes.get(key) === scope) scopes.delete(key);
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
function normalizeExtension(extension) {
|
|
2372
|
+
const lowered = extension.trim().toLowerCase();
|
|
2373
|
+
return lowered.startsWith(".") ? lowered : `.${lowered}`;
|
|
2374
|
+
}
|
|
2375
|
+
function findScope(file) {
|
|
2376
|
+
if (scopes.size === 0) return null;
|
|
2377
|
+
let match = null;
|
|
2378
|
+
for (const [root, scope] of scopes) {
|
|
2379
|
+
if (file !== root && !file.startsWith(`${root}${path7.sep}`)) continue;
|
|
2380
|
+
if (!match || root.length > match.length) match = { length: root.length, scope };
|
|
2381
|
+
}
|
|
2382
|
+
return match?.scope ?? null;
|
|
2383
|
+
}
|
|
2384
|
+
function resolveFarmRendererModuleHydration(content, sourcePath, readSource) {
|
|
2385
|
+
if (scopes.size === 0) return null;
|
|
2386
|
+
const file = realPath(sourcePath);
|
|
2387
|
+
const scope = findScope(file);
|
|
2388
|
+
if (!scope) return null;
|
|
2389
|
+
const route = scope.routeModules.get(file);
|
|
2390
|
+
const options = scope.renderer.hydration;
|
|
2391
|
+
const own = options?.resolve && scope.extensions.has(path7.extname(file).toLowerCase()) ? readOwnHydration(scope, content, file) : {};
|
|
2392
|
+
if (!route && own.hydrate === void 0 && own.strategy === void 0) return null;
|
|
2393
|
+
const source = readSource();
|
|
2394
|
+
const where = `${file} sets its hydration twice`;
|
|
2395
|
+
if (own.hydrate !== void 0 && source.hydrate !== void 0 && own.hydrate !== source.hydrate) {
|
|
2396
|
+
throw new Error(
|
|
2397
|
+
`${where}: \`export const hydrate = ${source.hydrate}\` and renderer \`${scope.renderer.name}\`'s syntax, which says ${own.hydrate}. Keep one of them.`
|
|
2398
|
+
);
|
|
2399
|
+
}
|
|
2400
|
+
if (own.strategy !== void 0 && source.strategy !== null && own.strategy !== source.strategy) {
|
|
2401
|
+
throw new Error(
|
|
2402
|
+
`${where}: \`export const island = "${source.strategy}"\` and renderer \`${scope.renderer.name}\`'s syntax, which says "${own.strategy}". Keep one of them.`
|
|
2403
|
+
);
|
|
2404
|
+
}
|
|
2405
|
+
const kindDefault = route?.kind === "page" ? options?.pages : route?.kind === "layout" ? options?.layouts : void 0;
|
|
2406
|
+
const hydrate = own.hydrate ?? source.hydrate ?? route?.hydration.hydrate ?? kindDefault ?? false;
|
|
2407
|
+
const strategy = own.strategy ?? source.strategy ?? route?.hydration.strategy ?? ((hydrate || source.clientDirective) && route ? options?.strategy : void 0) ?? null;
|
|
2408
|
+
return { hydrate, strategy };
|
|
2409
|
+
}
|
|
2410
|
+
function readOwnHydration(scope, content, file) {
|
|
2411
|
+
const where = `Renderer \`${scope.renderer.name}\` hydration.resolve() for ${file}`;
|
|
2412
|
+
let value;
|
|
2413
|
+
try {
|
|
2414
|
+
value = scope.renderer.hydration.resolve(content, file);
|
|
2415
|
+
} catch (error) {
|
|
2416
|
+
throw createFarmRendererHookError(
|
|
2417
|
+
`${where} threw: ${error instanceof Error ? error.message : String(error)}`,
|
|
2418
|
+
error
|
|
2419
|
+
);
|
|
2420
|
+
}
|
|
2421
|
+
if (value === null || value === void 0) return {};
|
|
2422
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
2423
|
+
throw new TypeError(
|
|
2424
|
+
`${where} returned ${JSON.stringify(value)}. Return \`{ hydrate?, strategy? }\`, or nothing to leave the file to Farm.`
|
|
2425
|
+
);
|
|
2426
|
+
}
|
|
2427
|
+
return readFarmRendererHydration(value, where);
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2333
2430
|
// src/utils/client-component.ts
|
|
2334
2431
|
function readIfExists(filePath) {
|
|
2335
2432
|
if (filePath.replace(/\\/g, "/").includes(FARM_CLIENT_REFERENCE_DIRECTORY)) {
|
|
@@ -2384,10 +2481,10 @@ function readSourceFile(filePath) {
|
|
|
2384
2481
|
}
|
|
2385
2482
|
function readSourceFileContents(filePath) {
|
|
2386
2483
|
try {
|
|
2387
|
-
if (!filePath || !
|
|
2484
|
+
if (!filePath || !fs7.existsSync(filePath)) {
|
|
2388
2485
|
return null;
|
|
2389
2486
|
}
|
|
2390
|
-
return
|
|
2487
|
+
return fs7.readFileSync(filePath, "utf-8");
|
|
2391
2488
|
} catch {
|
|
2392
2489
|
return null;
|
|
2393
2490
|
}
|
|
@@ -2406,21 +2503,21 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
2406
2503
|
}
|
|
2407
2504
|
if (modulePath.startsWith("/@fs/")) {
|
|
2408
2505
|
const fsPath = withoutQuery.slice("/@fs/".length);
|
|
2409
|
-
candidates.add(
|
|
2506
|
+
candidates.add(path8.normalize(/^[A-Za-z]:/.test(fsPath) ? fsPath : `/${fsPath}`));
|
|
2410
2507
|
}
|
|
2411
2508
|
}
|
|
2412
2509
|
if (root && modulePath) {
|
|
2413
2510
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
2414
|
-
candidates.add(
|
|
2415
|
-
candidates.add(
|
|
2511
|
+
candidates.add(path8.join(root, normalized));
|
|
2512
|
+
candidates.add(path8.resolve(root, normalized));
|
|
2416
2513
|
}
|
|
2417
2514
|
if (withoutQuery?.startsWith("/src/")) {
|
|
2418
2515
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
2419
|
-
candidates.add(
|
|
2420
|
-
candidates.add(
|
|
2516
|
+
candidates.add(path8.join(process.cwd(), normalized));
|
|
2517
|
+
candidates.add(path8.resolve(process.cwd(), normalized));
|
|
2421
2518
|
}
|
|
2422
2519
|
for (const candidate of candidates) {
|
|
2423
|
-
if (
|
|
2520
|
+
if (fs7.existsSync(candidate)) {
|
|
2424
2521
|
return candidate;
|
|
2425
2522
|
}
|
|
2426
2523
|
}
|
|
@@ -2437,8 +2534,8 @@ var FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES = 4;
|
|
|
2437
2534
|
function isolatedHydrationBoundaryLimit() {
|
|
2438
2535
|
const benchmarkRoot = process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_ROOT;
|
|
2439
2536
|
const benchmarkLimit = Number(process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_LIMIT);
|
|
2440
|
-
const resolvedBenchmarkRoot = benchmarkRoot ?
|
|
2441
|
-
const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${
|
|
2537
|
+
const resolvedBenchmarkRoot = benchmarkRoot ? path8.resolve(benchmarkRoot) : null;
|
|
2538
|
+
const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${path8.sep}`));
|
|
2442
2539
|
return isBenchmarkFixture && Number.isSafeInteger(benchmarkLimit) && benchmarkLimit > FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES ? benchmarkLimit : FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES;
|
|
2443
2540
|
}
|
|
2444
2541
|
var RESOLVABLE_SOURCE_EXTENSIONS = [
|
|
@@ -2751,6 +2848,18 @@ function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
|
2751
2848
|
if (inspectIslandExport && hydrate && hydrate.value === null) {
|
|
2752
2849
|
throw new Error(formatFarmHydrateExportError(hydrate, sourcePath));
|
|
2753
2850
|
}
|
|
2851
|
+
const rendererHydration = inspectIslandExport && sourcePath ? resolveFarmRendererModuleHydration(content, sourcePath, () => ({
|
|
2852
|
+
hydrate: typeof hydrate?.value === "boolean" ? hydrate.value : void 0,
|
|
2853
|
+
strategy: getIslandStrategyExport(content),
|
|
2854
|
+
clientDirective: isClientComponent
|
|
2855
|
+
})) : null;
|
|
2856
|
+
if (rendererHydration) {
|
|
2857
|
+
return {
|
|
2858
|
+
isClientComponent,
|
|
2859
|
+
hasHydrateExport: rendererHydration.hydrate,
|
|
2860
|
+
islandStrategy: rendererHydration.strategy
|
|
2861
|
+
};
|
|
2862
|
+
}
|
|
2754
2863
|
const hasHydrate = hydrate?.value === true;
|
|
2755
2864
|
return {
|
|
2756
2865
|
isClientComponent,
|
|
@@ -2781,7 +2890,7 @@ function getFarmClientRenderingBindings(code, file, root) {
|
|
|
2781
2890
|
for (const [specifier, locals] of getStaticImportBindings(code)) {
|
|
2782
2891
|
const imported = resolveImportedModule(file, specifier, root);
|
|
2783
2892
|
if (!imported.path) continue;
|
|
2784
|
-
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([
|
|
2893
|
+
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([path8.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set());
|
|
2785
2894
|
if (metadata.isClientComponent || metadata.shouldHydrate) bindings.push(...locals);
|
|
2786
2895
|
}
|
|
2787
2896
|
return bindings;
|
|
@@ -2826,7 +2935,7 @@ function getClientModuleMetadata(modulePath, root) {
|
|
|
2826
2935
|
return inspectClientModuleMetadata(resolvedPath, root, /* @__PURE__ */ new Set(), true);
|
|
2827
2936
|
}
|
|
2828
2937
|
function getClientModuleHydrationPlanKey(modulePath, root, mode, options = {}) {
|
|
2829
|
-
return `${
|
|
2938
|
+
return `${path8.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${options.packageReferences === true}\0${path8.resolve(modulePath)}`;
|
|
2830
2939
|
}
|
|
2831
2940
|
function getClientModuleHydrationPlan(modulePath, root, mode = "off", options = {}) {
|
|
2832
2941
|
const plan = planClientModuleHydration(modulePath, root, mode, options);
|
|
@@ -3405,7 +3514,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3405
3514
|
let fallbackReason;
|
|
3406
3515
|
let fallbackHint;
|
|
3407
3516
|
let costGuardExceeded = false;
|
|
3408
|
-
const projectRoot = root ?
|
|
3517
|
+
const projectRoot = root ? path8.resolve(root) : void 0;
|
|
3409
3518
|
const visit = (moduleSourcePath) => {
|
|
3410
3519
|
if (fallbackReason) return 0;
|
|
3411
3520
|
const cached = estimates.get(moduleSourcePath);
|
|
@@ -3599,13 +3708,13 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
3599
3708
|
}
|
|
3600
3709
|
function farmWorkspaceServerEntry(entry) {
|
|
3601
3710
|
const real = realpathOrSelf(entry);
|
|
3602
|
-
if (real.split(
|
|
3711
|
+
if (real.split(path8.sep).includes("node_modules")) return null;
|
|
3603
3712
|
if (parseClientModuleMetadata(readIfExists(real), false).isClientComponent) return null;
|
|
3604
3713
|
return real;
|
|
3605
3714
|
}
|
|
3606
3715
|
function realpathOrSelf(file) {
|
|
3607
3716
|
try {
|
|
3608
|
-
return
|
|
3717
|
+
return fs7.realpathSync(file);
|
|
3609
3718
|
} catch {
|
|
3610
3719
|
return file;
|
|
3611
3720
|
}
|
|
@@ -3650,7 +3759,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
|
3650
3759
|
let importsClientBoundary = false;
|
|
3651
3760
|
let importedIslandStrategy = null;
|
|
3652
3761
|
const reexports = getBarePackageReexports(content);
|
|
3653
|
-
const
|
|
3762
|
+
const realPath2 = reexports.length > 0 ? realpathOrSelf(resolvedPath) : resolvedPath;
|
|
3654
3763
|
const followed = [
|
|
3655
3764
|
...getImportSpecifiers(content).filter(
|
|
3656
3765
|
(specifier) => specifier.startsWith(".") || specifier.startsWith("/")
|
|
@@ -3659,7 +3768,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
|
3659
3768
|
];
|
|
3660
3769
|
for (const specifier of followed) {
|
|
3661
3770
|
const importedPath = resolveImportedModuleSourcePath(
|
|
3662
|
-
reexports.includes(specifier) ?
|
|
3771
|
+
reexports.includes(specifier) ? realPath2 : resolvedPath,
|
|
3663
3772
|
specifier,
|
|
3664
3773
|
root
|
|
3665
3774
|
);
|
|
@@ -3792,7 +3901,7 @@ var ALIAS_IMPORT = /^(?:@\/|~\/|#)/;
|
|
|
3792
3901
|
function warnUnresolvedAliasImport(importerPath, specifier, root) {
|
|
3793
3902
|
if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
|
|
3794
3903
|
warnedUnresolvedAliasImports.add(specifier);
|
|
3795
|
-
const importer = root ?
|
|
3904
|
+
const importer = root ? path8.relative(root, importerPath) : importerPath;
|
|
3796
3905
|
logger.warn(
|
|
3797
3906
|
`Could not resolve "${specifier}" (imported by ${importer}) while checking which pages need client JavaScript. If it holds client components, they will not hydrate. Map the alias in tsconfig.json "paths" or package.json "imports".`
|
|
3798
3907
|
);
|
|
@@ -3801,7 +3910,7 @@ var projectImportAliasCache = /* @__PURE__ */ new Map();
|
|
|
3801
3910
|
var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
|
|
3802
3911
|
function resolveProjectAliasSourcePath(specifier, root) {
|
|
3803
3912
|
if (!root) return void 0;
|
|
3804
|
-
const projectRoot =
|
|
3913
|
+
const projectRoot = path8.resolve(root);
|
|
3805
3914
|
let match;
|
|
3806
3915
|
for (const alias of getProjectImportAliases(projectRoot)) {
|
|
3807
3916
|
const captured = matchProjectImportAlias(alias, specifier);
|
|
@@ -3811,7 +3920,7 @@ function resolveProjectAliasSourcePath(specifier, root) {
|
|
|
3811
3920
|
if (!match) return void 0;
|
|
3812
3921
|
const resolved = resolveSourceCandidate(
|
|
3813
3922
|
match.alias.targets.map(
|
|
3814
|
-
(target) =>
|
|
3923
|
+
(target) => path8.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
|
|
3815
3924
|
)
|
|
3816
3925
|
);
|
|
3817
3926
|
return resolved && /\.d\.[cm]?ts$/.test(resolved) ? null : resolved;
|
|
@@ -3826,7 +3935,7 @@ function matchProjectImportAlias(alias, specifier) {
|
|
|
3826
3935
|
function getProjectImportAliases(projectRoot) {
|
|
3827
3936
|
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
3828
3937
|
try {
|
|
3829
|
-
return String(
|
|
3938
|
+
return String(fs7.statSync(path8.join(projectRoot, file)).mtimeMs);
|
|
3830
3939
|
} catch {
|
|
3831
3940
|
return "-";
|
|
3832
3941
|
}
|
|
@@ -3844,7 +3953,7 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3844
3953
|
prefix: "@/",
|
|
3845
3954
|
suffix: "",
|
|
3846
3955
|
wildcard: true,
|
|
3847
|
-
targets: [
|
|
3956
|
+
targets: [path8.join(projectRoot, sourceDir, "*")]
|
|
3848
3957
|
});
|
|
3849
3958
|
}
|
|
3850
3959
|
projectImportAliasCache.set(projectRoot, { stamp: cacheStamp, aliases });
|
|
@@ -3852,8 +3961,8 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3852
3961
|
}
|
|
3853
3962
|
function readTsconfigPathAliases(projectRoot) {
|
|
3854
3963
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
3855
|
-
const configPath =
|
|
3856
|
-
if (!
|
|
3964
|
+
const configPath = path8.join(projectRoot, name);
|
|
3965
|
+
if (!fs7.existsSync(configPath)) continue;
|
|
3857
3966
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
3858
3967
|
if (!resolved?.paths) return [];
|
|
3859
3968
|
const base2 = resolved.baseUrl ?? resolved.pathsDirectory;
|
|
@@ -3865,7 +3974,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
3865
3974
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
3866
3975
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
3867
3976
|
wildcard: wildcardIndex !== -1,
|
|
3868
|
-
targets: targets.filter((target) => typeof target === "string").map((target) =>
|
|
3977
|
+
targets: targets.filter((target) => typeof target === "string").map((target) => path8.resolve(base2, target))
|
|
3869
3978
|
}
|
|
3870
3979
|
];
|
|
3871
3980
|
});
|
|
@@ -3877,27 +3986,27 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
3877
3986
|
visited.add(configPath);
|
|
3878
3987
|
const config = readJsonWithComments(configPath);
|
|
3879
3988
|
if (!config) return null;
|
|
3880
|
-
const directory =
|
|
3989
|
+
const directory = path8.dirname(configPath);
|
|
3881
3990
|
const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
|
|
3882
3991
|
(parent) => typeof parent === "string" && parent.startsWith(".")
|
|
3883
3992
|
);
|
|
3884
3993
|
let inherited = null;
|
|
3885
3994
|
for (const parent of parents) {
|
|
3886
|
-
const parentPath =
|
|
3995
|
+
const parentPath = path8.resolve(
|
|
3887
3996
|
directory,
|
|
3888
3997
|
parent.endsWith(".json") ? parent : `${parent}.json`
|
|
3889
3998
|
);
|
|
3890
3999
|
inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
|
|
3891
4000
|
}
|
|
3892
4001
|
const options = config.compilerOptions ?? {};
|
|
3893
|
-
const baseUrl = typeof options.baseUrl === "string" ?
|
|
4002
|
+
const baseUrl = typeof options.baseUrl === "string" ? path8.resolve(directory, options.baseUrl) : inherited?.baseUrl;
|
|
3894
4003
|
if (options.paths && typeof options.paths === "object") {
|
|
3895
4004
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
3896
4005
|
}
|
|
3897
4006
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
3898
4007
|
}
|
|
3899
4008
|
function readPackageImportAliases(projectRoot) {
|
|
3900
|
-
const imports = readPackageJson(
|
|
4009
|
+
const imports = readPackageJson(path8.join(projectRoot, "package.json"))?.imports;
|
|
3901
4010
|
if (!imports || typeof imports !== "object") return [];
|
|
3902
4011
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
3903
4012
|
const target = resolveConditionalExportTarget(value);
|
|
@@ -3908,7 +4017,7 @@ function readPackageImportAliases(projectRoot) {
|
|
|
3908
4017
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
3909
4018
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
3910
4019
|
wildcard: wildcardIndex !== -1,
|
|
3911
|
-
targets: [
|
|
4020
|
+
targets: [path8.resolve(projectRoot, target)]
|
|
3912
4021
|
}
|
|
3913
4022
|
];
|
|
3914
4023
|
});
|
|
@@ -3916,7 +4025,7 @@ function readPackageImportAliases(projectRoot) {
|
|
|
3916
4025
|
function readJsonWithComments(filePath) {
|
|
3917
4026
|
let source;
|
|
3918
4027
|
try {
|
|
3919
|
-
source =
|
|
4028
|
+
source = fs7.readFileSync(filePath, "utf8");
|
|
3920
4029
|
} catch {
|
|
3921
4030
|
return null;
|
|
3922
4031
|
}
|
|
@@ -3954,7 +4063,7 @@ function resolveImportedModuleSourcePath(importerPath, specifier, root) {
|
|
|
3954
4063
|
return resolvePackageModuleSourcePath(importerPath, specifier, root);
|
|
3955
4064
|
}
|
|
3956
4065
|
const candidates = /* @__PURE__ */ new Set();
|
|
3957
|
-
const basePath = specifier.startsWith(".") ?
|
|
4066
|
+
const basePath = specifier.startsWith(".") ? path8.resolve(path8.dirname(importerPath), specifier) : root ? path8.resolve(root, specifier.replace(/^\/+/, "")) : path8.resolve(specifier);
|
|
3958
4067
|
candidates.add(basePath);
|
|
3959
4068
|
return resolveSourceCandidate(candidates);
|
|
3960
4069
|
}
|
|
@@ -3964,45 +4073,45 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
3964
4073
|
const packageSubpath = packageParts.slice(packageName.startsWith("@") ? 2 : 1).join("/");
|
|
3965
4074
|
const packageDirectory = findPackageDirectory2(importerPath, packageName, root);
|
|
3966
4075
|
if (!packageDirectory) return null;
|
|
3967
|
-
const packageJsonPath =
|
|
4076
|
+
const packageJsonPath = path8.join(packageDirectory, "package.json");
|
|
3968
4077
|
const packageJson = readPackageJson(packageJsonPath);
|
|
3969
4078
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
3970
4079
|
const exportTarget = resolvePackageExport(packageJson?.exports, exportKey);
|
|
3971
4080
|
const candidates = /* @__PURE__ */ new Set();
|
|
3972
4081
|
if (exportTarget?.startsWith("./")) {
|
|
3973
|
-
candidates.add(
|
|
4082
|
+
candidates.add(path8.resolve(packageDirectory, exportTarget));
|
|
3974
4083
|
}
|
|
3975
4084
|
if (packageSubpath) {
|
|
3976
|
-
candidates.add(
|
|
4085
|
+
candidates.add(path8.join(packageDirectory, packageSubpath));
|
|
3977
4086
|
} else {
|
|
3978
4087
|
for (const entry of [packageJson?.browser, packageJson?.module, packageJson?.main]) {
|
|
3979
|
-
if (typeof entry === "string") candidates.add(
|
|
4088
|
+
if (typeof entry === "string") candidates.add(path8.resolve(packageDirectory, entry));
|
|
3980
4089
|
}
|
|
3981
|
-
candidates.add(
|
|
4090
|
+
candidates.add(path8.join(packageDirectory, "index"));
|
|
3982
4091
|
}
|
|
3983
4092
|
return resolveSourceCandidate(candidates);
|
|
3984
4093
|
}
|
|
3985
4094
|
function findPackageDirectory2(importerPath, packageName, root) {
|
|
3986
4095
|
const searchRoots = /* @__PURE__ */ new Set();
|
|
3987
|
-
let current =
|
|
4096
|
+
let current = path8.dirname(importerPath);
|
|
3988
4097
|
while (true) {
|
|
3989
4098
|
searchRoots.add(current);
|
|
3990
|
-
const parent =
|
|
4099
|
+
const parent = path8.dirname(current);
|
|
3991
4100
|
if (parent === current) break;
|
|
3992
4101
|
current = parent;
|
|
3993
4102
|
}
|
|
3994
4103
|
if (root) {
|
|
3995
|
-
current =
|
|
4104
|
+
current = path8.resolve(root);
|
|
3996
4105
|
while (true) {
|
|
3997
4106
|
searchRoots.add(current);
|
|
3998
|
-
const parent =
|
|
4107
|
+
const parent = path8.dirname(current);
|
|
3999
4108
|
if (parent === current) break;
|
|
4000
4109
|
current = parent;
|
|
4001
4110
|
}
|
|
4002
4111
|
}
|
|
4003
4112
|
for (const searchRoot of searchRoots) {
|
|
4004
|
-
const packageDirectory =
|
|
4005
|
-
if (
|
|
4113
|
+
const packageDirectory = path8.join(searchRoot, "node_modules", packageName);
|
|
4114
|
+
if (fs7.existsSync(path8.join(packageDirectory, "package.json"))) {
|
|
4006
4115
|
return packageDirectory;
|
|
4007
4116
|
}
|
|
4008
4117
|
}
|
|
@@ -4010,7 +4119,7 @@ function findPackageDirectory2(importerPath, packageName, root) {
|
|
|
4010
4119
|
}
|
|
4011
4120
|
function readPackageJson(packageJsonPath) {
|
|
4012
4121
|
try {
|
|
4013
|
-
return JSON.parse(
|
|
4122
|
+
return JSON.parse(fs7.readFileSync(packageJsonPath, "utf8"));
|
|
4014
4123
|
} catch {
|
|
4015
4124
|
return null;
|
|
4016
4125
|
}
|
|
@@ -4079,11 +4188,11 @@ function resolveSourceCandidate(candidates) {
|
|
|
4079
4188
|
function resolveSourceCandidatePath(candidate) {
|
|
4080
4189
|
const paths = [candidate];
|
|
4081
4190
|
for (const extension of RESOLVABLE_SOURCE_EXTENSIONS) {
|
|
4082
|
-
paths.push(`${candidate}${extension}`,
|
|
4191
|
+
paths.push(`${candidate}${extension}`, path8.join(candidate, `index${extension}`));
|
|
4083
4192
|
}
|
|
4084
4193
|
for (const sourcePath of paths) {
|
|
4085
4194
|
try {
|
|
4086
|
-
if (
|
|
4195
|
+
if (fs7.statSync(sourcePath, { throwIfNoEntry: false })?.isFile()) return sourcePath;
|
|
4087
4196
|
} catch {
|
|
4088
4197
|
}
|
|
4089
4198
|
}
|
|
@@ -4125,13 +4234,13 @@ function scanFarmPackageImports(directory, root) {
|
|
|
4125
4234
|
const walk2 = (current) => {
|
|
4126
4235
|
let entries;
|
|
4127
4236
|
try {
|
|
4128
|
-
entries =
|
|
4237
|
+
entries = fs7.readdirSync(current, { withFileTypes: true });
|
|
4129
4238
|
} catch {
|
|
4130
4239
|
return;
|
|
4131
4240
|
}
|
|
4132
4241
|
for (const entry of entries) {
|
|
4133
4242
|
if (entry.name.startsWith(".") && entry.isDirectory()) continue;
|
|
4134
|
-
const file =
|
|
4243
|
+
const file = path8.join(current, entry.name);
|
|
4135
4244
|
if (entry.isDirectory()) {
|
|
4136
4245
|
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
4137
4246
|
continue;
|
|
@@ -4158,13 +4267,13 @@ function collectFarmServerBundledPackageInfo(directory) {
|
|
|
4158
4267
|
const walk2 = (current) => {
|
|
4159
4268
|
let entries;
|
|
4160
4269
|
try {
|
|
4161
|
-
entries =
|
|
4270
|
+
entries = fs7.readdirSync(current, { withFileTypes: true });
|
|
4162
4271
|
} catch {
|
|
4163
4272
|
return;
|
|
4164
4273
|
}
|
|
4165
4274
|
for (const entry of entries) {
|
|
4166
4275
|
if (entry.name.startsWith(".") && entry.isDirectory()) continue;
|
|
4167
|
-
const file =
|
|
4276
|
+
const file = path8.join(current, entry.name);
|
|
4168
4277
|
if (entry.isDirectory()) {
|
|
4169
4278
|
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
4170
4279
|
continue;
|
|
@@ -4189,7 +4298,7 @@ function invalidateFarmClientReachableModules() {
|
|
|
4189
4298
|
clientReachableModules.clear();
|
|
4190
4299
|
}
|
|
4191
4300
|
function getFarmClientReachableModules(directory, root) {
|
|
4192
|
-
const key = `${
|
|
4301
|
+
const key = `${path8.resolve(root)}\0${path8.resolve(directory)}`;
|
|
4193
4302
|
const cached = clientReachableModules.get(key);
|
|
4194
4303
|
if (cached) return cached;
|
|
4195
4304
|
const reachable = /* @__PURE__ */ new Set();
|
|
@@ -4197,12 +4306,12 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
4197
4306
|
const walk2 = (current) => {
|
|
4198
4307
|
let entries;
|
|
4199
4308
|
try {
|
|
4200
|
-
entries =
|
|
4309
|
+
entries = fs7.readdirSync(current, { withFileTypes: true });
|
|
4201
4310
|
} catch {
|
|
4202
4311
|
return;
|
|
4203
4312
|
}
|
|
4204
4313
|
for (const entry of entries) {
|
|
4205
|
-
const file =
|
|
4314
|
+
const file = path8.join(current, entry.name);
|
|
4206
4315
|
if (entry.isDirectory()) {
|
|
4207
4316
|
if (!entry.name.startsWith(".") && !CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
4208
4317
|
} else if (isScannedSourceFile(entry.name)) {
|
|
@@ -4213,12 +4322,12 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
4213
4322
|
};
|
|
4214
4323
|
walk2(directory);
|
|
4215
4324
|
while (queue.length > 0) {
|
|
4216
|
-
const file =
|
|
4325
|
+
const file = path8.resolve(queue.pop());
|
|
4217
4326
|
if (reachable.has(file)) continue;
|
|
4218
4327
|
reachable.add(file);
|
|
4219
4328
|
for (const specifier of getImportSpecifiers(readIfExists(file), { dynamic: true })) {
|
|
4220
4329
|
const imported = resolveImportedModule(file, specifier, root);
|
|
4221
|
-
if (imported.local && imported.path && !reachable.has(
|
|
4330
|
+
if (imported.local && imported.path && !reachable.has(path8.resolve(imported.path))) {
|
|
4222
4331
|
queue.push(imported.path);
|
|
4223
4332
|
}
|
|
4224
4333
|
}
|
|
@@ -4227,7 +4336,7 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
4227
4336
|
return reachable;
|
|
4228
4337
|
}
|
|
4229
4338
|
function resolveFarmClientOptimizeDeps(directory, root) {
|
|
4230
|
-
const importer =
|
|
4339
|
+
const importer = path8.join(path8.resolve(root), "package.json");
|
|
4231
4340
|
const include = /* @__PURE__ */ new Set();
|
|
4232
4341
|
const exclude = /* @__PURE__ */ new Set();
|
|
4233
4342
|
const imports = scanFarmPackageImports(directory, root);
|
|
@@ -4316,7 +4425,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4316
4425
|
}
|
|
4317
4426
|
return sources.files;
|
|
4318
4427
|
};
|
|
4319
|
-
const relativeFile = (file) =>
|
|
4428
|
+
const relativeFile = (file) => path9.isAbsolute(file) ? path9.relative(projectRoot, file).replace(/\\/g, "/") || file : file;
|
|
4320
4429
|
const routeSourceError = (file, importers = []) => formatFarmDiagnostic(
|
|
4321
4430
|
createFarmDiagnostic(
|
|
4322
4431
|
"CLIENT_ROUTES_FILE",
|
|
@@ -4336,7 +4445,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4336
4445
|
routesFiles = new Set(
|
|
4337
4446
|
getFarmSourceRoots({ ...options, root: options.root ?? config.root }).flatMap(
|
|
4338
4447
|
(source) => PROGRAMMATIC_ROUTE_FILE_NAMES.map(
|
|
4339
|
-
(name) => resolvedFile(
|
|
4448
|
+
(name) => resolvedFile(path9.resolve(source.root, source.srcDir, name))
|
|
4340
4449
|
)
|
|
4341
4450
|
)
|
|
4342
4451
|
);
|
|
@@ -4360,10 +4469,10 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
4360
4469
|
if (environment === "server" && resolveFarmServerComponentsMode(options.experimental?.serverComponents) === "islands" && isApplicationScript(id)) {
|
|
4361
4470
|
const file = id.split("?", 1)[0];
|
|
4362
4471
|
const root = realpathSync(options.root ?? projectRoot);
|
|
4363
|
-
const clientCode = getFarmClientReachableModules(root, root).has(
|
|
4472
|
+
const clientCode = getFarmClientReachableModules(root, root).has(path9.resolve(file)) || existsSync(file) && hasUseClientDirective(readFileSync(file, "utf8"));
|
|
4364
4473
|
const reached = clientCode ? null : findFarmClientOnlyImport(code, file);
|
|
4365
4474
|
if (reached) {
|
|
4366
|
-
const chain = reached.chain.map((step) =>
|
|
4475
|
+
const chain = reached.chain.map((step) => path9.relative(root, step).replace(/\\/g, "/")).join(" -> ");
|
|
4367
4476
|
const importMatch = new RegExp(
|
|
4368
4477
|
String.raw`\b(?:from|import)\s*["']` + reached.specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + `["']`
|
|
4369
4478
|
).exec(code);
|
|
@@ -4681,7 +4790,7 @@ function isTransformableModule(id, componentExtensions = /* @__PURE__ */ new Set
|
|
|
4681
4790
|
const [cleanId = id, query = ""] = id.split("?", 2);
|
|
4682
4791
|
if (/\.d\.[cm]?ts$/.test(cleanId)) return false;
|
|
4683
4792
|
if (MODULE_EXTENSION_RE2.test(cleanId)) return true;
|
|
4684
|
-
return componentExtensions.has(
|
|
4793
|
+
return componentExtensions.has(path9.extname(cleanId).toLowerCase()) && !/(?:^|&)type=style\b/.test(query);
|
|
4685
4794
|
}
|
|
4686
4795
|
function transformError(id, message) {
|
|
4687
4796
|
return new Error(`[Farm environment functions] ${message} in ${id.split("?", 1)[0]}`);
|
|
@@ -4726,6 +4835,7 @@ export {
|
|
|
4726
4835
|
runWithPackageClientBoundaryCacheFile,
|
|
4727
4836
|
runWithLatestPackageClientBoundaryCache,
|
|
4728
4837
|
dropLatestPackageClientBoundaryCache,
|
|
4838
|
+
setFarmRendererHydrationScope,
|
|
4729
4839
|
resolveModuleSourcePath,
|
|
4730
4840
|
getFarmClientHydrationPlanOptions,
|
|
4731
4841
|
describeSuppressedAsyncHydration,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/server-query-call.ts
|
|
2
|
+
var FARM_SERVER_QUERY_CLIENT_STATE = /* @__PURE__ */ Symbol.for("farm.serverQueryClientState");
|
|
3
|
+
function beginFarmServerQueryAction(actionId, args) {
|
|
4
|
+
const state = globalThis[FARM_SERVER_QUERY_CLIENT_STATE];
|
|
5
|
+
const active = state?.active?.at(-1);
|
|
6
|
+
return {
|
|
7
|
+
actionId,
|
|
8
|
+
args,
|
|
9
|
+
provisionalKey: active?.provisionalKey,
|
|
10
|
+
owner: active?.owner
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
FARM_SERVER_QUERY_CLIENT_STATE,
|
|
16
|
+
beginFarmServerQueryAction
|
|
17
|
+
};
|