@farm.js/core 0.1.71 → 0.1.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp-handler-VIT4GOSR.mjs → agent-mcp-handler-RK7LDYEL.mjs} +5 -5
- package/dist/{agent-mcp-handler-KE4J3W7S.cjs → agent-mcp-handler-VBCA3WZ6.cjs} +6 -6
- package/dist/{agent-mcp.d-BzNw6JI8.d.ts → agent-mcp.d-D_gHjCAE.d.ts} +2 -2
- package/dist/{agent-mcp.d-CgFen3EH.d.mts → agent-mcp.d-PvEf-1mi.d.mts} +2 -2
- package/dist/agent-runtime.d.mts +4 -4
- package/dist/agent-runtime.d.ts +4 -4
- package/dist/{analyzer-VK3BAOFI.mjs → analyzer-MFYCJT75.mjs} +2 -2
- package/dist/analyzer-V5ZMRIIY.cjs +16 -0
- package/dist/api/node.d.mts +6 -6
- package/dist/api/node.d.ts +6 -6
- package/dist/api/route-manager.cjs +7 -6
- package/dist/api/route-manager.d.mts +8 -8
- package/dist/api/route-manager.d.ts +8 -8
- package/dist/api/route-manager.mjs +6 -5
- package/dist/api/runtime.d.mts +5 -5
- package/dist/api/runtime.d.ts +5 -5
- package/dist/api.cjs +8 -7
- package/dist/api.d.mts +9 -9
- package/dist/api.d.ts +9 -9
- package/dist/api.mjs +7 -6
- package/dist/{app-manifest.d-DY4JfJxi.d.ts → app-manifest.d-BpVTg43i.d.ts} +1 -1
- package/dist/{app-manifest.d-DpDK_B1k.d.mts → app-manifest.d-CN7cEWHX.d.mts} +1 -1
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +5 -5
- package/dist/app-markdown.d.ts +5 -5
- package/dist/app-markdown.mjs +3 -3
- package/dist/{app.d-D-5UNrFd.d.mts → app.d-BFWzAdTe.d.mts} +54 -6
- package/dist/{app.d-BeK6bb1c.d.ts → app.d-DO4PTCWm.d.ts} +54 -6
- package/dist/{chunk-7A3URI2F.mjs → chunk-2EVESLP3.mjs} +8 -1
- package/dist/{chunk-IYDJNCR7.mjs → chunk-462MUII7.mjs} +10 -5
- package/dist/{chunk-MWUDEYBI.mjs → chunk-4CTCSKAF.mjs} +1 -1
- package/dist/{chunk-SXMWVP2L.cjs → chunk-4YHGQDTT.cjs} +12 -12
- package/dist/{chunk-YCNHUIPR.cjs → chunk-4Z3YLMSW.cjs} +10 -10
- package/dist/{chunk-K66JILV3.cjs → chunk-5LOARKDP.cjs} +2 -2
- package/dist/{chunk-O32QPFVV.cjs → chunk-5PDMBWAF.cjs} +5 -5
- package/dist/{chunk-IGXS54GC.mjs → chunk-6O6PAZZR.mjs} +1 -1
- package/dist/{chunk-LXEJNWF5.mjs → chunk-73K53YPP.mjs} +2 -2
- package/dist/{chunk-2CQC5CMD.mjs → chunk-7GMBETHM.mjs} +1 -1
- package/dist/{chunk-W2T6NDNP.mjs → chunk-B67CW2LM.mjs} +2 -2
- package/dist/{chunk-CSQPMV3Q.cjs → chunk-CLEWORVY.cjs} +6 -6
- package/dist/{chunk-KPJYBSHL.mjs → chunk-CPMME66W.mjs} +149 -22
- package/dist/{chunk-BBPDJGCU.cjs → chunk-CYOTNHDF.cjs} +2 -2
- package/dist/{chunk-4OD2LXF2.mjs → chunk-CYRIIVD4.mjs} +26 -15
- package/dist/{chunk-DPIGYXSV.mjs → chunk-FRO4BB2T.mjs} +1 -1
- package/dist/{chunk-Y2SZVIVH.cjs → chunk-GPICBTDV.cjs} +8 -1
- package/dist/{chunk-N3XO5AL5.cjs → chunk-GPO3LJDJ.cjs} +2 -2
- package/dist/{chunk-MITIAOUQ.mjs → chunk-GZOKWJIW.mjs} +4 -4
- package/dist/{chunk-NAXKOTPP.cjs → chunk-HFUOLILA.cjs} +21 -21
- package/dist/{chunk-C2JOS77Z.cjs → chunk-HGB4PM2C.cjs} +178 -51
- package/dist/{chunk-2IFT2CSA.cjs → chunk-HTXKSREF.cjs} +515 -151
- package/dist/{chunk-Z3GPAFIA.mjs → chunk-HY6IVQ54.mjs} +1 -1
- package/dist/{chunk-X7LGLF33.mjs → chunk-IBVN7SW5.mjs} +480 -116
- package/dist/{chunk-DPYBVVL3.cjs → chunk-ILQ5DKYF.cjs} +2 -2
- package/dist/{chunk-V25GSH43.mjs → chunk-IXZSBO76.mjs} +1 -1
- package/dist/{chunk-RJUCNO7R.mjs → chunk-JMOCMXTQ.mjs} +1 -1
- package/dist/{chunk-UISZLYKY.cjs → chunk-KDOZORJD.cjs} +52 -41
- package/dist/{chunk-PLXD2MJV.cjs → chunk-KTDG4THT.cjs} +2 -2
- package/dist/{chunk-L6E4SHUB.cjs → chunk-LGR7565L.cjs} +6 -6
- package/dist/chunk-LRPPXKCX.mjs +58 -0
- package/dist/{chunk-GUU3IZSM.mjs → chunk-MJEKMT6B.mjs} +324 -148
- package/dist/chunk-NDOE76QC.cjs +58 -0
- package/dist/{chunk-2AM26UGI.cjs → chunk-NLBK37HI.cjs} +5 -4
- package/dist/{chunk-REP6HWJN.mjs → chunk-OBYM5S5G.mjs} +2 -2
- package/dist/{chunk-ZUVAGMQ5.cjs → chunk-ODBM54RT.cjs} +7 -7
- package/dist/{chunk-J5ASGNKF.mjs → chunk-OIP62QEL.mjs} +1 -1
- package/dist/{chunk-KEB7AGS6.cjs → chunk-OXNZUCHN.cjs} +16 -11
- package/dist/{chunk-2MR4MABG.cjs → chunk-PXAHSCR6.cjs} +58 -8
- package/dist/{chunk-7BUE2GM6.mjs → chunk-QGCSUC5O.mjs} +174 -81
- package/dist/{chunk-VXB5CMNC.cjs → chunk-QKEZLYON.cjs} +2 -2
- package/dist/{chunk-UQUOSNRN.mjs → chunk-REK6HZSU.mjs} +470 -267
- package/dist/{chunk-E77IA5IF.mjs → chunk-RLFGKJQ6.mjs} +1 -1
- package/dist/{chunk-3BQ7QHUH.cjs → chunk-ROCF6UQD.cjs} +17 -8
- package/dist/{chunk-KQAB5LML.mjs → chunk-SUQACHER.mjs} +2 -2
- package/dist/{chunk-NA77GEIU.mjs → chunk-SVQX5HYW.mjs} +53 -3
- package/dist/{chunk-KWST2O22.cjs → chunk-TAU3OF5B.cjs} +611 -435
- package/dist/{chunk-ZPUAOKHV.cjs → chunk-TDCP3Z4T.cjs} +3 -3
- package/dist/{chunk-3AUINHFG.mjs → chunk-TNYC3TYP.mjs} +3 -2
- package/dist/{chunk-TP4RAV7Y.cjs → chunk-TU6VAH4V.cjs} +8 -8
- package/dist/{chunk-MEJCP2LX.cjs → chunk-UVQRMUAR.cjs} +1 -1
- package/dist/{chunk-JMFTKNBA.mjs → chunk-UVZMSRHF.mjs} +2 -2
- package/dist/{chunk-MU5V7XHL.mjs → chunk-VJSXPN3W.mjs} +3 -0
- package/dist/{chunk-DU4VHHPJ.mjs → chunk-VO55MMBX.mjs} +1 -1
- package/dist/{chunk-GF22VGMS.cjs → chunk-VPETSSWN.cjs} +2 -2
- package/dist/{chunk-LDVJIBGN.mjs → chunk-VT25ERQK.mjs} +1 -1
- package/dist/{chunk-AYVGD3PK.mjs → chunk-XI3OXOMK.mjs} +1 -1
- package/dist/{chunk-7OHJWFLB.cjs → chunk-XUSJVHHD.cjs} +466 -373
- package/dist/{chunk-FILXOEWD.cjs → chunk-YXIQYWOK.cjs} +2 -2
- package/dist/{chunk-JVA4PIYN.cjs → chunk-YZK64PZT.cjs} +635 -432
- package/dist/{chunk-THG2TVDH.mjs → chunk-YZLEOMMA.mjs} +3 -3
- package/dist/{chunk-QUFENL7Q.mjs → chunk-Z3IN6GEX.mjs} +16 -7
- package/dist/{chunk-Q5HMVGR5.cjs → chunk-ZFEJ2SF2.cjs} +13 -13
- package/dist/{chunk-LNVGXUL3.cjs → chunk-ZMSVKVI3.cjs} +3 -0
- package/dist/{client-component.d-DwpH251K.d.mts → client-component.d-C71rMuHF.d.mts} +2 -2
- package/dist/{client-component.d-fYupugbZ.d.ts → client-component.d-sF-Znk0j.d.ts} +2 -2
- package/dist/{client-plugins.d-k3bOT5gz.d.mts → client-plugins.d-B-Gd9mWR.d.mts} +5 -4
- package/dist/{client-plugins.d-BxqFfHpM.d.ts → client-plugins.d-MFibjgBg.d.ts} +5 -4
- package/dist/client-plugins.d.mts +4 -4
- package/dist/client-plugins.d.ts +4 -4
- package/dist/client.cjs +1 -1
- package/dist/client.d.mts +9 -9
- package/dist/client.d.ts +9 -9
- package/dist/client.mjs +1 -1
- package/dist/config.d.mts +4 -4
- package/dist/config.d.ts +4 -4
- package/dist/desktop.d.mts +5 -5
- package/dist/desktop.d.ts +5 -5
- package/dist/{devtools-O5625KCK.cjs → devtools-6K4QXFRL.cjs} +7 -7
- package/dist/{devtools-6MXPFPNJ.mjs → devtools-TDIJ6HVC.mjs} +6 -6
- package/dist/docs.cjs +10 -10
- package/dist/docs.d.mts +5 -5
- package/dist/docs.d.ts +5 -5
- package/dist/docs.mjs +9 -9
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{headers.d-sNT7ZQiU.d.mts → headers.d-BUxGJTsj.d.mts} +2 -2
- package/dist/{headers.d-DalIGbVO.d.ts → headers.d-uQ6BR59u.d.ts} +2 -2
- package/dist/i18n/client.cjs +3 -2
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/client.mjs +2 -1
- package/dist/i18n/index.cjs +3 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.mjs +2 -1
- package/dist/i18n/server.cjs +6 -5
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- package/dist/i18n/server.mjs +5 -4
- package/dist/index.cjs +32 -30
- package/dist/{index.d-BcA-secm.d.ts → index.d-BCGfxCXY.d.ts} +1 -1
- package/dist/{index.d-DDHHAv7j.d.mts → index.d-CuWOJ-un.d.mts} +1 -1
- package/dist/index.d.mts +24 -24
- package/dist/index.d.ts +24 -24
- package/dist/index.mjs +31 -29
- package/dist/integrations/orm.d.mts +4 -4
- package/dist/integrations/orm.d.ts +4 -4
- package/dist/integrations.d.mts +4 -4
- package/dist/integrations.d.ts +4 -4
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +5 -5
- package/dist/internal/app-markdown-runtime.d.ts +5 -5
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +29 -29
- package/dist/internal/build-runtime.d.mts +6 -6
- package/dist/internal/build-runtime.d.ts +6 -6
- package/dist/internal/build-runtime.mjs +28 -28
- package/dist/internal/cli-runtime.cjs +12 -12
- package/dist/internal/cli-runtime.mjs +11 -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 +2 -2
- package/dist/internal/client-runtime.d.mts +7 -7
- package/dist/internal/client-runtime.d.ts +7 -7
- package/dist/internal/client-runtime.mjs +3 -3
- package/dist/internal/compression-runtime.d.mts +4 -4
- package/dist/internal/compression-runtime.d.ts +4 -4
- package/dist/internal/config-runtime.cjs +8 -8
- package/dist/internal/config-runtime.d.mts +7 -7
- package/dist/internal/config-runtime.d.ts +7 -7
- package/dist/internal/config-runtime.mjs +7 -7
- package/dist/internal/infra-analytics-runtime.cjs +10 -10
- package/dist/internal/infra-analytics-runtime.mjs +8 -8
- 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 +19 -19
- package/dist/internal/production-runtime.d.mts +37 -25
- package/dist/internal/production-runtime.d.ts +37 -25
- package/dist/internal/production-runtime.mjs +18 -18
- package/dist/internal/vercel-edge-middleware.d.mts +2 -2
- package/dist/internal/vercel-edge-middleware.d.ts +2 -2
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +4 -4
- package/dist/markdown.d.ts +4 -4
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.cjs +3 -3
- package/dist/middleware.d.mts +5 -5
- package/dist/middleware.d.ts +5 -5
- package/dist/middleware.mjs +2 -2
- package/dist/mobile.d.mts +3 -3
- package/dist/mobile.d.ts +3 -3
- package/dist/{mount.d-C1PONsEe.d.mts → mount.d-BIYmcGGg.d.mts} +1 -1
- package/dist/{mount.d-D3JOux2V.d.ts → mount.d-q8k0cJV0.d.ts} +1 -1
- package/dist/{native-tree-L2IIEBXH.mjs → native-tree-OYGKP2NZ.mjs} +2 -2
- package/dist/{native-tree-GF4BH33L.cjs → native-tree-R6CQMDTI.cjs} +3 -3
- package/dist/{navigation-delegate.d-CQQPbdkE.d.ts → navigation-delegate.d-Btfs6Uoa.d.ts} +1 -1
- package/dist/{navigation-delegate.d-CJQQHboA.d.mts → navigation-delegate.d-CYBUupsv.d.mts} +1 -1
- package/dist/navigation.d.mts +7 -7
- package/dist/navigation.d.ts +7 -7
- package/dist/{observability.d-B2363jB6.d.mts → observability.d-DdJRiaIX.d.mts} +27 -3
- package/dist/{observability.d-B2363jB6.d.ts → observability.d-DdJRiaIX.d.ts} +27 -3
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/plugin.cjs +21 -21
- package/dist/plugin.d.mts +7 -7
- package/dist/plugin.d.ts +7 -7
- package/dist/plugin.mjs +20 -20
- package/dist/{production-runtime.d-B0IeWWyO.d.mts → production-runtime.d-Bcu37SCo.d.mts} +1 -1
- package/dist/{production-runtime.d-q3aHIv5Y.d.ts → production-runtime.d-qPj3XRET.d.ts} +1 -1
- package/dist/{render-plan.d-DHuJMJRP.d.ts → render-plan.d-0FHusf1D.d.ts} +1 -1
- package/dist/{render-plan.d-CiUj0rq5.d.mts → render-plan.d-BlyxqKMu.d.mts} +1 -1
- package/dist/renderer-client.cjs +3 -2
- package/dist/renderer-client.d.mts +7 -7
- package/dist/renderer-client.d.ts +7 -7
- package/dist/renderer-client.mjs +2 -1
- package/dist/{request.d-DRUbOmYD.d.ts → request.d-CPdVjssg.d.ts} +1 -1
- package/dist/{request.d-D-F7o7tb.d.mts → request.d-CX-gks1l.d.mts} +1 -1
- package/dist/request.d.mts +5 -5
- package/dist/request.d.ts +5 -5
- package/dist/{resolver.d-9iKC79CU.d.mts → resolver.d-DJgzbdsp.d.mts} +1 -1
- package/dist/{resolver.d-CY6mEa_F.d.ts → resolver.d-yaHcGCCG.d.ts} +1 -1
- package/dist/{route-rendering.d-6smgwT2t.d.mts → route-rendering.d-CcvZ_4N2.d.mts} +1 -1
- package/dist/{route-rendering.d-KwqM_mlK.d.ts → route-rendering.d-DcOoSNoG.d.ts} +1 -1
- package/dist/{router.d-BYmDeDlp.d.mts → router.d-C8RHma4A.d.mts} +1 -1
- package/dist/{router.d-B6sesMRD.d.ts → router.d-D2QnK8cM.d.ts} +1 -1
- package/dist/{routes.d-D3aJw1H5.d.mts → routes.d-CCccJRrp.d.mts} +1 -1
- package/dist/{routes.d-K-Qg79AA.d.ts → routes.d-b7khoRoU.d.ts} +1 -1
- package/dist/routes.d.mts +4 -4
- package/dist/routes.d.ts +4 -4
- package/dist/{routing.d-DwSUVZbF.d.mts → routing.d-BhPgtN_S.d.ts} +2 -1
- package/dist/{routing.d-BxOZ2YWc.d.ts → routing.d-D67HQmnv.d.mts} +2 -1
- package/dist/{rsc-pipeline-R2GOKIMU.mjs → rsc-pipeline-LC2FBZAR.mjs} +7 -7
- package/dist/{rsc-pipeline-P4PCWDO2.cjs → rsc-pipeline-NTAM65NT.cjs} +8 -8
- package/dist/{runtime-DP5DYGW5.mjs → runtime-MWAC7NWR.mjs} +7 -7
- package/dist/{runtime-WA2Q4SLG.cjs → runtime-U4PAMTVH.cjs} +9 -9
- package/dist/{runtime.d-CbdMI0Oy.d.ts → runtime.d-1l_1bLrL.d.ts} +1 -1
- package/dist/{runtime.d-BFSJf-ww.d.mts → runtime.d-BQUHHq8M.d.mts} +1 -1
- package/dist/{runtime.d-nUz0HAL4.d.mts → runtime.d-CTAXWZby.d.mts} +2 -2
- package/dist/{runtime.d-B_uPfMjA.d.ts → runtime.d-PUA5qBnd.d.ts} +2 -2
- package/dist/server-plugins.d.mts +6 -6
- package/dist/server-plugins.d.ts +6 -6
- package/dist/server.cjs +43 -41
- package/dist/server.d.mts +15 -15
- package/dist/server.d.ts +15 -15
- package/dist/server.mjs +26 -24
- package/dist/{spa-router.d-mC1D5cTN.d.ts → spa-router.d-BJtXNeqo.d.ts} +3 -3
- package/dist/{spa-router.d-D4EDwR20.d.mts → spa-router.d-BzPdi48R.d.mts} +3 -3
- package/dist/testing.cjs +6 -5
- package/dist/testing.d.mts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.mjs +6 -5
- package/dist/{types.d-wVRlLtBf.d.ts → types.d-euATAbE4.d.mts} +4 -0
- package/dist/{types.d-wVRlLtBf.d.mts → types.d-euATAbE4.d.ts} +4 -0
- package/dist/{utils.d-DxMzteqE.d.mts → utils.d-B4ZW-6z6.d.mts} +1 -1
- package/dist/{utils.d-A2X3a6z_.d.ts → utils.d-DquC6qxy.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +23 -21
- package/dist/vite.d.mts +18 -9
- package/dist/vite.d.ts +18 -9
- package/dist/vite.mjs +22 -20
- package/package.json +1 -1
- package/dist/analyzer-LPIVRSTJ.cjs +0 -16
- package/dist/chunk-V3UOEWCB.cjs +0 -46
- package/dist/chunk-VE3FWJBO.mjs +0 -46
|
@@ -21,16 +21,127 @@ import {
|
|
|
21
21
|
} from "./chunk-JSDV2NUN.mjs";
|
|
22
22
|
import {
|
|
23
23
|
FARM_VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JMOCMXTQ.mjs";
|
|
25
25
|
|
|
26
26
|
// src/environment-vite.ts
|
|
27
27
|
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
28
|
-
import
|
|
28
|
+
import path6 from "path";
|
|
29
29
|
|
|
30
30
|
// src/islands-react-server-exports.ts
|
|
31
|
-
import
|
|
31
|
+
import fs2 from "fs";
|
|
32
32
|
import path from "path";
|
|
33
33
|
import { parseAst } from "rolldown/parseAst";
|
|
34
|
+
|
|
35
|
+
// src/utils/source-snapshot.ts
|
|
36
|
+
import fs from "fs";
|
|
37
|
+
var snapshot;
|
|
38
|
+
var volatile;
|
|
39
|
+
var trace;
|
|
40
|
+
function stampOf(file) {
|
|
41
|
+
try {
|
|
42
|
+
const stat = fs.statSync(file);
|
|
43
|
+
return `${stat.mtimeMs}:${stat.size}`;
|
|
44
|
+
} catch {
|
|
45
|
+
return "missing";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
var FarmSourceSnapshotStore = class {
|
|
49
|
+
constructor() {
|
|
50
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
51
|
+
this.stamps = /* @__PURE__ */ new Map();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Drops the entries that read a file changed on disk since the last plan, or one of `edited`
|
|
55
|
+
* (edits the watcher reported, which a coarse mtime can miss). Returns each such file with the
|
|
56
|
+
* source text the snapshot held for it, if any.
|
|
57
|
+
*/
|
|
58
|
+
refresh(edited = []) {
|
|
59
|
+
const changed = /* @__PURE__ */ new Map();
|
|
60
|
+
for (const file of edited) changed.set(file, void 0);
|
|
61
|
+
for (const [file, stamp] of this.stamps) {
|
|
62
|
+
if (stampOf(file) !== stamp) changed.set(file, void 0);
|
|
63
|
+
}
|
|
64
|
+
if (changed.size === 0) return changed;
|
|
65
|
+
const replaced = /* @__PURE__ */ new Set();
|
|
66
|
+
for (const [scope, entries] of this.entries) {
|
|
67
|
+
for (const [key, entry] of entries) {
|
|
68
|
+
if (!entry.files.some((file) => changed.has(file))) continue;
|
|
69
|
+
entries.delete(key);
|
|
70
|
+
if (scope !== "source" || typeof entry.value !== "string") continue;
|
|
71
|
+
replaced.add(entry.value);
|
|
72
|
+
if (changed.has(key)) changed.set(key, entry.value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
for (const entries of this.entries.values()) {
|
|
76
|
+
for (const source of replaced) entries.delete(source);
|
|
77
|
+
}
|
|
78
|
+
for (const file of changed.keys()) this.stamps.delete(file);
|
|
79
|
+
return changed;
|
|
80
|
+
}
|
|
81
|
+
/** The source text the last plan read for `file`, if it read it. */
|
|
82
|
+
peekSource(file) {
|
|
83
|
+
const value = this.entries.get("source")?.get(file)?.value;
|
|
84
|
+
return typeof value === "string" ? value : void 0;
|
|
85
|
+
}
|
|
86
|
+
/** Records the stamp of every file an entry read that has none yet. */
|
|
87
|
+
stamp() {
|
|
88
|
+
for (const entries of this.entries.values()) {
|
|
89
|
+
for (const entry of entries.values()) {
|
|
90
|
+
for (const file of entry.files) {
|
|
91
|
+
if (!this.stamps.has(file)) this.stamps.set(file, stampOf(file));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
clear() {
|
|
97
|
+
this.entries.clear();
|
|
98
|
+
this.stamps.clear();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
function withFarmSourceSnapshot(operation, store) {
|
|
102
|
+
if (snapshot) return operation();
|
|
103
|
+
const entries = store?.entries ?? /* @__PURE__ */ new Map();
|
|
104
|
+
snapshot = entries;
|
|
105
|
+
volatile = [];
|
|
106
|
+
try {
|
|
107
|
+
return operation();
|
|
108
|
+
} finally {
|
|
109
|
+
for (const [scope, key] of volatile) entries.get(scope)?.delete(key);
|
|
110
|
+
snapshot = void 0;
|
|
111
|
+
volatile = void 0;
|
|
112
|
+
store?.stamp();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function memoizeInFarmSourceSnapshot(scope, key, compute, lasting) {
|
|
116
|
+
if (!snapshot) return compute();
|
|
117
|
+
let entries = snapshot.get(scope);
|
|
118
|
+
if (!entries) snapshot.set(scope, entries = /* @__PURE__ */ new Map());
|
|
119
|
+
const memoized = entries.get(key);
|
|
120
|
+
if (memoized) {
|
|
121
|
+
if (trace) for (const file of memoized.files) trace.add(file);
|
|
122
|
+
return memoized.value;
|
|
123
|
+
}
|
|
124
|
+
const { result, files } = traceFarmSourceReads(compute);
|
|
125
|
+
entries.set(key, { value: result, files });
|
|
126
|
+
if (lasting && !lasting(result)) volatile?.push([scope, key]);
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
function noteFarmSourceRead(file) {
|
|
130
|
+
trace?.add(file);
|
|
131
|
+
}
|
|
132
|
+
function traceFarmSourceReads(operation) {
|
|
133
|
+
const outer = trace;
|
|
134
|
+
const files = /* @__PURE__ */ new Set();
|
|
135
|
+
trace = files;
|
|
136
|
+
try {
|
|
137
|
+
return { result: operation(), files: [...files] };
|
|
138
|
+
} finally {
|
|
139
|
+
trace = outer;
|
|
140
|
+
if (outer) for (const file of files) outer.add(file);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// src/islands-react-server-exports.ts
|
|
34
145
|
var REACT_PACKAGES = /* @__PURE__ */ new Set([
|
|
35
146
|
"react",
|
|
36
147
|
"react-dom",
|
|
@@ -56,7 +167,7 @@ function packageNameOf(specifier) {
|
|
|
56
167
|
function findPackageDirectory(importer, name) {
|
|
57
168
|
for (let current = path.dirname(importer); ; current = path.dirname(current)) {
|
|
58
169
|
const directory = path.join(current, "node_modules", name);
|
|
59
|
-
if (
|
|
170
|
+
if (fs2.existsSync(path.join(directory, "package.json"))) return fs2.realpathSync(directory);
|
|
60
171
|
if (path.dirname(current) === current) return null;
|
|
61
172
|
}
|
|
62
173
|
}
|
|
@@ -114,13 +225,13 @@ function resolveFarmReactServerExport(importer, specifier) {
|
|
|
114
225
|
if (cache.has(key)) return cache.get(key);
|
|
115
226
|
let resolved = null;
|
|
116
227
|
try {
|
|
117
|
-
const manifest = JSON.parse(
|
|
228
|
+
const manifest = JSON.parse(fs2.readFileSync(path.join(directory, "package.json"), "utf8"));
|
|
118
229
|
const entry = exportEntry(manifest.exports, parsed.subpath);
|
|
119
230
|
const server = pickTarget(entry, SERVER_CONDITIONS);
|
|
120
231
|
const fallback = pickTarget(entry, DEFAULT_CONDITIONS);
|
|
121
232
|
if (server && server !== fallback && server.startsWith("./")) {
|
|
122
233
|
const file = path.resolve(directory, server);
|
|
123
|
-
if (
|
|
234
|
+
if (fs2.existsSync(file)) resolved = file;
|
|
124
235
|
}
|
|
125
236
|
} catch {
|
|
126
237
|
resolved = null;
|
|
@@ -132,15 +243,16 @@ var parsedModules = /* @__PURE__ */ new Map();
|
|
|
132
243
|
function readModule(file) {
|
|
133
244
|
let stat;
|
|
134
245
|
try {
|
|
135
|
-
stat =
|
|
246
|
+
stat = fs2.statSync(file);
|
|
136
247
|
} catch {
|
|
137
248
|
return null;
|
|
138
249
|
}
|
|
250
|
+
noteFarmSourceRead(file);
|
|
139
251
|
const cached = parsedModules.get(file);
|
|
140
252
|
if (cached && cached.size === stat.size && cached.mtimeMs === stat.mtimeMs) return cached.program;
|
|
141
253
|
let program = null;
|
|
142
254
|
try {
|
|
143
|
-
const code =
|
|
255
|
+
const code = fs2.readFileSync(file, "utf8");
|
|
144
256
|
const extension = path.extname(file).slice(1);
|
|
145
257
|
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
|
|
146
258
|
program = parseAst(code, { lang });
|
|
@@ -161,11 +273,11 @@ function resolveRelative(from, specifier) {
|
|
|
161
273
|
const base = path.resolve(path.dirname(from), specifier);
|
|
162
274
|
for (const extension of SCRIPT_EXTENSIONS) {
|
|
163
275
|
const file = `${base}${extension}`;
|
|
164
|
-
if (
|
|
276
|
+
if (fs2.existsSync(file) && fs2.statSync(file).isFile()) return file;
|
|
165
277
|
}
|
|
166
278
|
for (const index of INDEX_FILES) {
|
|
167
279
|
const file = path.join(base, index);
|
|
168
|
-
if (
|
|
280
|
+
if (fs2.existsSync(file)) return file;
|
|
169
281
|
}
|
|
170
282
|
return null;
|
|
171
283
|
}
|
|
@@ -178,7 +290,7 @@ function resolveFarmPackageDefaultEntry(importer, specifier, conditions = ["brow
|
|
|
178
290
|
const directory = findPackageDirectory(importer, parsed.name);
|
|
179
291
|
if (!directory) return null;
|
|
180
292
|
try {
|
|
181
|
-
const manifest = JSON.parse(
|
|
293
|
+
const manifest = JSON.parse(fs2.readFileSync(path.join(directory, "package.json"), "utf8"));
|
|
182
294
|
const target = pickTarget(exportEntry(manifest.exports, parsed.subpath), conditions) ?? (!parsed.subpath ? manifest.module ?? manifest.main ?? "index.js" : parsed.subpath);
|
|
183
295
|
return resolveRelative(
|
|
184
296
|
path.join(directory, "package.json"),
|
|
@@ -258,8 +370,14 @@ function isFarmClientExport(file, name) {
|
|
|
258
370
|
return traceFarmExport(file, name) === "client";
|
|
259
371
|
}
|
|
260
372
|
function isFarmPackageClientExport(importer, specifier, name) {
|
|
261
|
-
|
|
262
|
-
|
|
373
|
+
return memoizeInFarmSourceSnapshot(
|
|
374
|
+
"package-client-export",
|
|
375
|
+
`${path.dirname(importer)}\0${specifier}\0${name}`,
|
|
376
|
+
() => {
|
|
377
|
+
const entry = resolveFarmPackageDefaultEntry(importer, specifier);
|
|
378
|
+
return !entry || traceFarmExport(entry, name) !== "server";
|
|
379
|
+
}
|
|
380
|
+
);
|
|
263
381
|
}
|
|
264
382
|
function parseCode(code, file) {
|
|
265
383
|
const extension = path.extname(file).slice(1);
|
|
@@ -548,7 +666,7 @@ function scanPackage(directory) {
|
|
|
548
666
|
const current = pending.pop();
|
|
549
667
|
let entries;
|
|
550
668
|
try {
|
|
551
|
-
entries =
|
|
669
|
+
entries = fs2.readdirSync(current, { withFileTypes: true });
|
|
552
670
|
} catch {
|
|
553
671
|
continue;
|
|
554
672
|
}
|
|
@@ -559,7 +677,7 @@ function scanPackage(directory) {
|
|
|
559
677
|
else if (/\.(?:[cm]?js|jsx)$/.test(entry.name) && scanned++ < MAX_SCANNED_FILES) {
|
|
560
678
|
let code;
|
|
561
679
|
try {
|
|
562
|
-
code =
|
|
680
|
+
code = fs2.readFileSync(file, "utf8");
|
|
563
681
|
} catch {
|
|
564
682
|
continue;
|
|
565
683
|
}
|
|
@@ -579,7 +697,7 @@ function findFarmServerBundledPackage(importer, specifier) {
|
|
|
579
697
|
const directory = findPackageDirectory(importer, parsed.name);
|
|
580
698
|
if (!directory) return null;
|
|
581
699
|
try {
|
|
582
|
-
const manifest = JSON.parse(
|
|
700
|
+
const manifest = JSON.parse(fs2.readFileSync(path.join(directory, "package.json"), "utf8"));
|
|
583
701
|
if (manifest.exports === void 0 && manifest.type !== "module" && typeof manifest.module === "string" && typeof manifest.main === "string" && path.resolve(directory, manifest.main) !== path.resolve(directory, manifest.module)) {
|
|
584
702
|
return { name: parsed.name, prebundle: isSelfContainedPackage(manifest, importer) };
|
|
585
703
|
}
|
|
@@ -601,7 +719,7 @@ function findFarmPackageManifest(importer, specifier) {
|
|
|
601
719
|
if (!directory) return null;
|
|
602
720
|
let names;
|
|
603
721
|
try {
|
|
604
|
-
const manifest = JSON.parse(
|
|
722
|
+
const manifest = JSON.parse(fs2.readFileSync(path.join(directory, "package.json"), "utf8"));
|
|
605
723
|
names = new Set(Object.keys(manifest.dependencies ?? {}));
|
|
606
724
|
} catch {
|
|
607
725
|
return null;
|
|
@@ -1207,13 +1325,13 @@ function toModuleFile(file) {
|
|
|
1207
1325
|
}
|
|
1208
1326
|
|
|
1209
1327
|
// src/utils/client-component.ts
|
|
1210
|
-
import
|
|
1211
|
-
import
|
|
1328
|
+
import fs6 from "fs";
|
|
1329
|
+
import path5 from "path";
|
|
1212
1330
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1213
1331
|
|
|
1214
1332
|
// src/islands-package-references.ts
|
|
1215
1333
|
import { createHash } from "crypto";
|
|
1216
|
-
import
|
|
1334
|
+
import fs3 from "fs";
|
|
1217
1335
|
import path2 from "path";
|
|
1218
1336
|
import { parseAst as parseAst2 } from "rolldown/parseAst";
|
|
1219
1337
|
var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
@@ -1224,6 +1342,9 @@ var moduleName = (node) => {
|
|
|
1224
1342
|
function parse(code, file) {
|
|
1225
1343
|
const extension = path2.extname(file).slice(1);
|
|
1226
1344
|
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
|
|
1345
|
+
return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => parseAs(code, lang));
|
|
1346
|
+
}
|
|
1347
|
+
function parseAs(code, lang) {
|
|
1227
1348
|
try {
|
|
1228
1349
|
return parseAst2(code, { lang });
|
|
1229
1350
|
} catch {
|
|
@@ -1365,7 +1486,7 @@ function packageLookup(directory, packageName) {
|
|
|
1365
1486
|
if (path2.basename(current) !== "node_modules") {
|
|
1366
1487
|
const candidate = path2.join(current, "node_modules", packageName);
|
|
1367
1488
|
try {
|
|
1368
|
-
return { from: current, real:
|
|
1489
|
+
return { from: current, real: fs3.realpathSync(candidate) };
|
|
1369
1490
|
} catch {
|
|
1370
1491
|
}
|
|
1371
1492
|
}
|
|
@@ -1379,7 +1500,7 @@ function referenceResolveFrom(root, specifier, importer) {
|
|
|
1379
1500
|
const app = packageLookup(path2.join(root, ".farm", "client-references"), packageName);
|
|
1380
1501
|
if (app?.real === own.real) return null;
|
|
1381
1502
|
try {
|
|
1382
|
-
return
|
|
1503
|
+
return fs3.realpathSync(own.from);
|
|
1383
1504
|
} catch {
|
|
1384
1505
|
return own.from;
|
|
1385
1506
|
}
|
|
@@ -1405,30 +1526,30 @@ function ensureFarmPackageClientReference(root, specifier, exportName, importer)
|
|
|
1405
1526
|
].join("\n");
|
|
1406
1527
|
let current = null;
|
|
1407
1528
|
try {
|
|
1408
|
-
current =
|
|
1529
|
+
current = fs3.readFileSync(file, "utf8");
|
|
1409
1530
|
} catch {
|
|
1410
1531
|
}
|
|
1411
1532
|
if (current !== source) {
|
|
1412
|
-
|
|
1413
|
-
|
|
1533
|
+
fs3.mkdirSync(path2.dirname(file), { recursive: true });
|
|
1534
|
+
fs3.writeFileSync(file, source);
|
|
1414
1535
|
}
|
|
1415
1536
|
return file;
|
|
1416
1537
|
}
|
|
1417
1538
|
function writeIfChanged(file, source) {
|
|
1418
1539
|
let current = null;
|
|
1419
1540
|
try {
|
|
1420
|
-
current =
|
|
1541
|
+
current = fs3.readFileSync(file, "utf8");
|
|
1421
1542
|
} catch {
|
|
1422
1543
|
}
|
|
1423
1544
|
if (current !== source) {
|
|
1424
|
-
|
|
1425
|
-
|
|
1545
|
+
fs3.mkdirSync(path2.dirname(file), { recursive: true });
|
|
1546
|
+
fs3.writeFileSync(file, source);
|
|
1426
1547
|
}
|
|
1427
1548
|
}
|
|
1428
1549
|
function owningPackage(file) {
|
|
1429
1550
|
for (let current = path2.dirname(file); ; current = path2.dirname(current)) {
|
|
1430
1551
|
try {
|
|
1431
|
-
const manifest = JSON.parse(
|
|
1552
|
+
const manifest = JSON.parse(fs3.readFileSync(path2.join(current, "package.json"), "utf8"));
|
|
1432
1553
|
if (typeof manifest.name === "string") return { directory: current, name: manifest.name };
|
|
1433
1554
|
} catch {
|
|
1434
1555
|
}
|
|
@@ -1513,12 +1634,155 @@ function rewriteFarmPackageClientImports(options) {
|
|
|
1513
1634
|
return changed ? output : null;
|
|
1514
1635
|
}
|
|
1515
1636
|
|
|
1637
|
+
// src/islands-containers.ts
|
|
1638
|
+
import fs4 from "fs";
|
|
1639
|
+
import path3 from "path";
|
|
1640
|
+
import { parseAst as parseAst3 } from "rolldown/parseAst";
|
|
1641
|
+
var FARM_ISLAND_CONTAINER_EXPORT = "FarmIslandContainer";
|
|
1642
|
+
var CONTAINER_LOCAL = "__FarmIslandContainer__";
|
|
1643
|
+
var ISLAND_CONTAINER_TAGS = /* @__PURE__ */ new Set([
|
|
1644
|
+
"table",
|
|
1645
|
+
"thead",
|
|
1646
|
+
"tbody",
|
|
1647
|
+
"tfoot",
|
|
1648
|
+
"tr",
|
|
1649
|
+
"select",
|
|
1650
|
+
"optgroup",
|
|
1651
|
+
"datalist",
|
|
1652
|
+
"svg",
|
|
1653
|
+
"ul",
|
|
1654
|
+
"ol"
|
|
1655
|
+
]);
|
|
1656
|
+
var FLOW_CONTENT_TAGS = /* @__PURE__ */ new Set(["td", "th", "caption", "foreignObject", "li"]);
|
|
1657
|
+
function farmIslandContainerReferencePath(root) {
|
|
1658
|
+
return path3.join(root, ".farm", "client-references", "farm.js+core", "__island-container.tsx");
|
|
1659
|
+
}
|
|
1660
|
+
function ensureFarmIslandContainerReference(root) {
|
|
1661
|
+
const file = farmIslandContainerReferencePath(root);
|
|
1662
|
+
const source = [
|
|
1663
|
+
"// Generated by Farm: the island around an element whose children are client components (RFC 0006).",
|
|
1664
|
+
FARM_CLIENT_REFERENCE_PRAGMA,
|
|
1665
|
+
'"use client";',
|
|
1666
|
+
`export function ${FARM_ISLAND_CONTAINER_EXPORT}({ children }: { children?: unknown }) {`,
|
|
1667
|
+
" return children as never;",
|
|
1668
|
+
"}",
|
|
1669
|
+
""
|
|
1670
|
+
].join("\n");
|
|
1671
|
+
let current = null;
|
|
1672
|
+
try {
|
|
1673
|
+
current = fs4.readFileSync(file, "utf8");
|
|
1674
|
+
} catch {
|
|
1675
|
+
}
|
|
1676
|
+
if (current !== source) {
|
|
1677
|
+
fs4.mkdirSync(path3.dirname(file), { recursive: true });
|
|
1678
|
+
fs4.writeFileSync(file, source);
|
|
1679
|
+
}
|
|
1680
|
+
return file;
|
|
1681
|
+
}
|
|
1682
|
+
function parse2(code, file) {
|
|
1683
|
+
const extension = path3.extname(file).slice(1);
|
|
1684
|
+
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : extension === "js" || extension === "mjs" || extension === "cjs" || extension === "jsx" ? "jsx" : "tsx";
|
|
1685
|
+
return memoizeInFarmSourceSnapshot(`ast:${lang}`, code, () => {
|
|
1686
|
+
try {
|
|
1687
|
+
return parseAst3(code, { lang });
|
|
1688
|
+
} catch {
|
|
1689
|
+
return null;
|
|
1690
|
+
}
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
function jsxName(node) {
|
|
1694
|
+
if (!node) return null;
|
|
1695
|
+
if (node.type === "JSXIdentifier") return node.name;
|
|
1696
|
+
if (node.type === "JSXMemberExpression") {
|
|
1697
|
+
let object = node.object;
|
|
1698
|
+
while (object.type === "JSXMemberExpression") object = object.object;
|
|
1699
|
+
return object.type === "JSXIdentifier" ? object.name : null;
|
|
1700
|
+
}
|
|
1701
|
+
return null;
|
|
1702
|
+
}
|
|
1703
|
+
function findFarmIslandContainers(code, file, bindings) {
|
|
1704
|
+
if (bindings.length === 0) return [];
|
|
1705
|
+
if (!/<(?:table|thead|tbody|tfoot|tr|select|optgroup|datalist|svg|ul|ol)[\s>/]/.test(code)) {
|
|
1706
|
+
return [];
|
|
1707
|
+
}
|
|
1708
|
+
const program = parse2(code, file);
|
|
1709
|
+
if (!program) return null;
|
|
1710
|
+
const names = new Set(bindings);
|
|
1711
|
+
const found = /* @__PURE__ */ new Map();
|
|
1712
|
+
const open = [];
|
|
1713
|
+
const visit = (node) => {
|
|
1714
|
+
if (!node || typeof node !== "object") return;
|
|
1715
|
+
if (Array.isArray(node)) {
|
|
1716
|
+
for (const child of node) visit(child);
|
|
1717
|
+
return;
|
|
1718
|
+
}
|
|
1719
|
+
const current = node;
|
|
1720
|
+
if (typeof current.type !== "string") return;
|
|
1721
|
+
if (current.type === "JSXElement") {
|
|
1722
|
+
const name = jsxName(current.openingElement?.name);
|
|
1723
|
+
if (name && names.has(name)) {
|
|
1724
|
+
let container;
|
|
1725
|
+
for (let depth = open.length - 1; depth >= 0; depth--) {
|
|
1726
|
+
const tag = jsxName(open[depth].openingElement.name);
|
|
1727
|
+
if (FLOW_CONTENT_TAGS.has(tag)) break;
|
|
1728
|
+
if (ISLAND_CONTAINER_TAGS.has(tag)) container = open[depth];
|
|
1729
|
+
}
|
|
1730
|
+
if (container && !found.has(container.start)) {
|
|
1731
|
+
found.set(container.start, {
|
|
1732
|
+
tag: jsxName(container.openingElement.name),
|
|
1733
|
+
start: container.start,
|
|
1734
|
+
end: container.end
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
const host = current.openingElement?.name?.type === "JSXIdentifier" && (ISLAND_CONTAINER_TAGS.has(name) || FLOW_CONTENT_TAGS.has(name));
|
|
1739
|
+
if (host) open.push(current);
|
|
1740
|
+
visit(current.openingElement?.attributes);
|
|
1741
|
+
visit(current.children);
|
|
1742
|
+
if (host) open.pop();
|
|
1743
|
+
return;
|
|
1744
|
+
}
|
|
1745
|
+
for (const [key, value] of Object.entries(current)) {
|
|
1746
|
+
if (key === "start" || key === "end" || key === "loc" || key === "range") continue;
|
|
1747
|
+
if (value && typeof value === "object") visit(value);
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
visit(program);
|
|
1751
|
+
const sorted = [...found.values()].sort((a, b) => a.start - b.start);
|
|
1752
|
+
const outermost = [];
|
|
1753
|
+
for (const container of sorted) {
|
|
1754
|
+
const last = outermost[outermost.length - 1];
|
|
1755
|
+
if (last && container.start >= last.start && container.end <= last.end) continue;
|
|
1756
|
+
outermost.push(container);
|
|
1757
|
+
}
|
|
1758
|
+
return outermost;
|
|
1759
|
+
}
|
|
1760
|
+
function wrapFarmIslandContainers(options) {
|
|
1761
|
+
const containers = findFarmIslandContainers(options.code, options.file, options.bindings);
|
|
1762
|
+
if (!containers || containers.length === 0) return null;
|
|
1763
|
+
let code = options.code;
|
|
1764
|
+
for (const container of [...containers].reverse()) {
|
|
1765
|
+
code = code.slice(0, container.start) + `<${CONTAINER_LOCAL}>` + code.slice(container.start, container.end) + `</${CONTAINER_LOCAL}>` + code.slice(container.end);
|
|
1766
|
+
}
|
|
1767
|
+
const specifier = JSON.stringify(options.reference.split(path3.sep).join("/"));
|
|
1768
|
+
const declaration = `import { ${FARM_ISLAND_CONTAINER_EXPORT} as ${CONTAINER_LOCAL} } from ${specifier};
|
|
1769
|
+
`;
|
|
1770
|
+
let prologueEnd = 0;
|
|
1771
|
+
for (const statement of parse2(options.code, options.file)?.body ?? []) {
|
|
1772
|
+
if (statement.type !== "ExpressionStatement" || typeof statement.directive !== "string") break;
|
|
1773
|
+
prologueEnd = statement.end;
|
|
1774
|
+
}
|
|
1775
|
+
if (prologueEnd === 0) return declaration + code;
|
|
1776
|
+
return `${code.slice(0, prologueEnd)}
|
|
1777
|
+
${declaration}${code.slice(prologueEnd)}`;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1516
1780
|
// src/utils/package-client-boundary-cache.ts
|
|
1517
1781
|
import { AsyncLocalStorage } from "async_hooks";
|
|
1518
|
-
import
|
|
1519
|
-
import
|
|
1782
|
+
import fs5 from "fs";
|
|
1783
|
+
import path4 from "path";
|
|
1520
1784
|
var SCHEMA_VERSION = 2;
|
|
1521
|
-
var NODE_MODULES_SEGMENT = `${
|
|
1785
|
+
var NODE_MODULES_SEGMENT = `${path4.sep}node_modules${path4.sep}`;
|
|
1522
1786
|
var PackageInspectionTrace = class {
|
|
1523
1787
|
constructor() {
|
|
1524
1788
|
this.files = /* @__PURE__ */ new Set();
|
|
@@ -1528,7 +1792,7 @@ var PackageInspectionTrace = class {
|
|
|
1528
1792
|
}
|
|
1529
1793
|
visit(file) {
|
|
1530
1794
|
this.files.add(file);
|
|
1531
|
-
const directory =
|
|
1795
|
+
const directory = path4.dirname(file);
|
|
1532
1796
|
if (!this.directoryStamps.has(directory)) {
|
|
1533
1797
|
this.directoryStamps.set(directory, stampPackagePath(directory, "directory"));
|
|
1534
1798
|
}
|
|
@@ -1555,9 +1819,9 @@ var PackageInspectionTrace = class {
|
|
|
1555
1819
|
}
|
|
1556
1820
|
};
|
|
1557
1821
|
function stampPackagePath(target, kind) {
|
|
1558
|
-
if (!`${target}${
|
|
1822
|
+
if (!`${target}${path4.sep}`.includes(NODE_MODULES_SEGMENT)) return void 0;
|
|
1559
1823
|
try {
|
|
1560
|
-
const stat =
|
|
1824
|
+
const stat = fs5.statSync(target, { throwIfNoEntry: false });
|
|
1561
1825
|
if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
|
|
1562
1826
|
return [target, stat.size, stat.mtimeMs, stat.ctimeMs];
|
|
1563
1827
|
} catch {
|
|
@@ -1612,11 +1876,11 @@ var PackageClientBoundaryCache = class {
|
|
|
1612
1876
|
const { file, contents } = pending;
|
|
1613
1877
|
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
1614
1878
|
try {
|
|
1615
|
-
await
|
|
1616
|
-
await
|
|
1617
|
-
await
|
|
1879
|
+
await fs5.promises.mkdir(path4.dirname(file), { recursive: true });
|
|
1880
|
+
await fs5.promises.writeFile(temporary, contents);
|
|
1881
|
+
await fs5.promises.rename(temporary, file);
|
|
1618
1882
|
} catch {
|
|
1619
|
-
await
|
|
1883
|
+
await fs5.promises.rm(temporary, { force: true }).catch(() => {
|
|
1620
1884
|
});
|
|
1621
1885
|
}
|
|
1622
1886
|
}
|
|
@@ -1627,12 +1891,12 @@ var PackageClientBoundaryCache = class {
|
|
|
1627
1891
|
const { file, contents } = pending;
|
|
1628
1892
|
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
1629
1893
|
try {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1894
|
+
fs5.mkdirSync(path4.dirname(file), { recursive: true });
|
|
1895
|
+
fs5.writeFileSync(temporary, contents);
|
|
1896
|
+
fs5.renameSync(temporary, file);
|
|
1633
1897
|
} catch {
|
|
1634
1898
|
try {
|
|
1635
|
-
|
|
1899
|
+
fs5.rmSync(temporary, { force: true });
|
|
1636
1900
|
} catch {
|
|
1637
1901
|
}
|
|
1638
1902
|
}
|
|
@@ -1703,7 +1967,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1703
1967
|
function readStoredCache(file) {
|
|
1704
1968
|
let value;
|
|
1705
1969
|
try {
|
|
1706
|
-
value = JSON.parse(
|
|
1970
|
+
value = JSON.parse(fs5.readFileSync(file, "utf8"));
|
|
1707
1971
|
} catch {
|
|
1708
1972
|
return null;
|
|
1709
1973
|
}
|
|
@@ -1724,7 +1988,7 @@ function isRecord(value) {
|
|
|
1724
1988
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1725
1989
|
}
|
|
1726
1990
|
function isPathStamp(value) {
|
|
1727
|
-
return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" &&
|
|
1991
|
+
return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" && path4.isAbsolute(value[0]) && value.slice(1).every((part) => typeof part === "number" && Number.isFinite(part));
|
|
1728
1992
|
}
|
|
1729
1993
|
function isPathIndexList(value, pathCount) {
|
|
1730
1994
|
return Array.isArray(value) && value.length > 0 && value.every((index) => Number.isSafeInteger(index) && index >= 0 && index < pathCount);
|
|
@@ -1732,7 +1996,7 @@ function isPathIndexList(value, pathCount) {
|
|
|
1732
1996
|
function isStoredEntry(value, pathCount) {
|
|
1733
1997
|
if (!isRecord(value) || !isRecord(value.result)) return false;
|
|
1734
1998
|
const { isClientComponent, shouldHydrate, islandStrategy } = value.result;
|
|
1735
|
-
return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" &&
|
|
1999
|
+
return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" && path4.isAbsolute(file)) && typeof isClientComponent === "boolean" && typeof shouldHydrate === "boolean" && (islandStrategy === null || isFarmIslandStrategy(islandStrategy)) && Object.keys(value.result).length === 3;
|
|
1736
2000
|
}
|
|
1737
2001
|
var STORAGE_KEY = /* @__PURE__ */ Symbol.for("@farm.js/core/package-client-boundary-cache");
|
|
1738
2002
|
function getStorage() {
|
|
@@ -1760,7 +2024,7 @@ function usePackageClientBoundaryCacheFile(file) {
|
|
|
1760
2024
|
getPackageClientBoundaryCache()?.load(file);
|
|
1761
2025
|
}
|
|
1762
2026
|
function resolvePackageClientBoundaryCacheFile(root, distDir) {
|
|
1763
|
-
return
|
|
2027
|
+
return path4.resolve(root, distDir, "cache", "client-boundaries.json");
|
|
1764
2028
|
}
|
|
1765
2029
|
function runWithPackageClientBoundaryCacheFile(file, operation) {
|
|
1766
2030
|
if (getPackageClientBoundaryCache()) return operation();
|
|
@@ -1768,16 +2032,46 @@ function runWithPackageClientBoundaryCacheFile(file, operation) {
|
|
|
1768
2032
|
cache2.load(file);
|
|
1769
2033
|
const result = getStorage().run(cache2, operation);
|
|
1770
2034
|
cache2.persistSync();
|
|
2035
|
+
latestDevCache = { file, cache: cache2 };
|
|
1771
2036
|
return result;
|
|
1772
2037
|
}
|
|
2038
|
+
var latestDevCache;
|
|
2039
|
+
function runWithLatestPackageClientBoundaryCache(file, operation) {
|
|
2040
|
+
if (getPackageClientBoundaryCache()) return operation();
|
|
2041
|
+
if (latestDevCache?.file !== file) {
|
|
2042
|
+
const cache2 = new PackageClientBoundaryCache();
|
|
2043
|
+
cache2.load(file);
|
|
2044
|
+
latestDevCache = { file, cache: cache2 };
|
|
2045
|
+
}
|
|
2046
|
+
return getStorage().run(latestDevCache.cache, operation);
|
|
2047
|
+
}
|
|
2048
|
+
function dropLatestPackageClientBoundaryCache() {
|
|
2049
|
+
latestDevCache = void 0;
|
|
2050
|
+
}
|
|
1773
2051
|
|
|
1774
2052
|
// src/utils/client-component.ts
|
|
1775
2053
|
function readIfExists(filePath) {
|
|
2054
|
+
if (filePath.replace(/\\/g, "/").includes(FARM_CLIENT_REFERENCE_DIRECTORY)) {
|
|
2055
|
+
return readSourceFile(filePath);
|
|
2056
|
+
}
|
|
2057
|
+
return memoizeInFarmSourceSnapshot(
|
|
2058
|
+
"source",
|
|
2059
|
+
filePath,
|
|
2060
|
+
() => readSourceFile(filePath),
|
|
2061
|
+
(content) => content !== null
|
|
2062
|
+
);
|
|
2063
|
+
}
|
|
2064
|
+
function readSourceFile(filePath) {
|
|
2065
|
+
const content = readSourceFileContents(filePath);
|
|
2066
|
+
if (content !== null) noteFarmSourceRead(filePath);
|
|
2067
|
+
return content;
|
|
2068
|
+
}
|
|
2069
|
+
function readSourceFileContents(filePath) {
|
|
1776
2070
|
try {
|
|
1777
|
-
if (!filePath || !
|
|
2071
|
+
if (!filePath || !fs6.existsSync(filePath)) {
|
|
1778
2072
|
return null;
|
|
1779
2073
|
}
|
|
1780
|
-
return
|
|
2074
|
+
return fs6.readFileSync(filePath, "utf-8");
|
|
1781
2075
|
} catch {
|
|
1782
2076
|
return null;
|
|
1783
2077
|
}
|
|
@@ -1796,21 +2090,21 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
1796
2090
|
}
|
|
1797
2091
|
if (modulePath.startsWith("/@fs/")) {
|
|
1798
2092
|
const fsPath = withoutQuery.slice("/@fs/".length);
|
|
1799
|
-
candidates.add(
|
|
2093
|
+
candidates.add(path5.normalize(/^[A-Za-z]:/.test(fsPath) ? fsPath : `/${fsPath}`));
|
|
1800
2094
|
}
|
|
1801
2095
|
}
|
|
1802
2096
|
if (root && modulePath) {
|
|
1803
2097
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
1804
|
-
candidates.add(
|
|
1805
|
-
candidates.add(
|
|
2098
|
+
candidates.add(path5.join(root, normalized));
|
|
2099
|
+
candidates.add(path5.resolve(root, normalized));
|
|
1806
2100
|
}
|
|
1807
2101
|
if (withoutQuery?.startsWith("/src/")) {
|
|
1808
2102
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
1809
|
-
candidates.add(
|
|
1810
|
-
candidates.add(
|
|
2103
|
+
candidates.add(path5.join(process.cwd(), normalized));
|
|
2104
|
+
candidates.add(path5.resolve(process.cwd(), normalized));
|
|
1811
2105
|
}
|
|
1812
2106
|
for (const candidate of candidates) {
|
|
1813
|
-
if (
|
|
2107
|
+
if (fs6.existsSync(candidate)) {
|
|
1814
2108
|
return candidate;
|
|
1815
2109
|
}
|
|
1816
2110
|
}
|
|
@@ -1827,8 +2121,8 @@ var FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES = 4;
|
|
|
1827
2121
|
function isolatedHydrationBoundaryLimit() {
|
|
1828
2122
|
const benchmarkRoot = process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_ROOT;
|
|
1829
2123
|
const benchmarkLimit = Number(process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_LIMIT);
|
|
1830
|
-
const resolvedBenchmarkRoot = benchmarkRoot ?
|
|
1831
|
-
const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${
|
|
2124
|
+
const resolvedBenchmarkRoot = benchmarkRoot ? path5.resolve(benchmarkRoot) : null;
|
|
2125
|
+
const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${path5.sep}`));
|
|
1832
2126
|
return isBenchmarkFixture && Number.isSafeInteger(benchmarkLimit) && benchmarkLimit > FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES ? benchmarkLimit : FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES;
|
|
1833
2127
|
}
|
|
1834
2128
|
var RESOLVABLE_SOURCE_EXTENSIONS = [
|
|
@@ -1963,6 +2257,9 @@ function skipRegularExpression(content, startIndex) {
|
|
|
1963
2257
|
var tokenizedModules = /* @__PURE__ */ new Map();
|
|
1964
2258
|
var TOKENIZED_MODULE_CACHE_SIZE = 32;
|
|
1965
2259
|
function tokenizeModuleSource(content) {
|
|
2260
|
+
return memoizeInFarmSourceSnapshot("tokens", content, () => tokenizeRecentModuleSource(content));
|
|
2261
|
+
}
|
|
2262
|
+
function tokenizeRecentModuleSource(content) {
|
|
1966
2263
|
const cached = tokenizedModules.get(content);
|
|
1967
2264
|
if (cached) return cached;
|
|
1968
2265
|
const tokens = scanModuleSourceTokens(content);
|
|
@@ -2172,6 +2469,16 @@ function resolveOwnerSourcePath(resolvedPath, root) {
|
|
|
2172
2469
|
}
|
|
2173
2470
|
return current;
|
|
2174
2471
|
}
|
|
2472
|
+
function getFarmClientRenderingBindings(code, file, root) {
|
|
2473
|
+
const bindings = [];
|
|
2474
|
+
for (const [specifier, locals] of getStaticImportBindings(code)) {
|
|
2475
|
+
const imported = resolveImportedModule(file, specifier, root);
|
|
2476
|
+
if (!imported.path) continue;
|
|
2477
|
+
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([path5.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set());
|
|
2478
|
+
if (metadata.isClientComponent || metadata.shouldHydrate) bindings.push(...locals);
|
|
2479
|
+
}
|
|
2480
|
+
return bindings;
|
|
2481
|
+
}
|
|
2175
2482
|
function collectFarmRenderedClientModules(modulePath, root) {
|
|
2176
2483
|
const resolvedPath = resolveOwnerSourcePath(resolveModuleSourcePath(modulePath, root), root);
|
|
2177
2484
|
if (!resolvedPath) return null;
|
|
@@ -2333,7 +2640,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
2333
2640
|
return plan;
|
|
2334
2641
|
}
|
|
2335
2642
|
function usesFarmServerTree(plan) {
|
|
2336
|
-
return plan?.asyncOwnerIslands === true && plan.isolatedBoundaries.length > 0
|
|
2643
|
+
return plan?.asyncOwnerIslands === true && plan.isolatedBoundaries.length > 0;
|
|
2337
2644
|
}
|
|
2338
2645
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
2339
2646
|
const plan = {
|
|
@@ -2437,6 +2744,13 @@ function enforceFarmIsolatedHydrationRouteBudget(layouts, routes, layoutAppliesT
|
|
|
2437
2744
|
(ancestor) => ancestor !== layout && ancestor.depth < layout.depth && ancestor.metadata.shouldHydrate && layoutAppliesToRoute(ancestor.pattern, layout.pattern)
|
|
2438
2745
|
);
|
|
2439
2746
|
if (hasRouteWideAncestor && layout.metadata.hasIsolatedClientBoundaries) {
|
|
2747
|
+
if (options.serverOwners && !layout.metadata.asyncOwnerIslands) {
|
|
2748
|
+
layout.metadata.shouldHydrate = layout.metadata.legacyShouldHydrate;
|
|
2749
|
+
layout.metadata.islandStrategy = layout.metadata.legacyIslandStrategy;
|
|
2750
|
+
layout.metadata.hasIsolatedClientBoundaries = false;
|
|
2751
|
+
layout.metadata.serverTreeLayout = true;
|
|
2752
|
+
continue;
|
|
2753
|
+
}
|
|
2440
2754
|
restoreRouteWideHydration(layout.metadata);
|
|
2441
2755
|
}
|
|
2442
2756
|
}
|
|
@@ -2447,6 +2761,23 @@ function isIsolatableClientBoundarySource(content) {
|
|
|
2447
2761
|
if (/\bexport\s*\*/.test(content)) return false;
|
|
2448
2762
|
return /\bexport\s+default\s+(?!(?:type|interface)\b)/.test(content) || /\bexport\s+(?:async\s+)?function\s+[A-Z][$\w]*/.test(content) || /\bexport\s+(?:const|let|var|class)\s+[A-Z][$\w]*/.test(content) || exportListNames(content).some((name) => name === "default" || /^[A-Z]/.test(name));
|
|
2449
2763
|
}
|
|
2764
|
+
function clientModulePlanSignature(content) {
|
|
2765
|
+
if (!content || !hasUseClientDirective(content)) return null;
|
|
2766
|
+
try {
|
|
2767
|
+
return JSON.stringify([
|
|
2768
|
+
getIslandStrategyExport(content),
|
|
2769
|
+
hasHydrateExport(content),
|
|
2770
|
+
isIsolatableClientBoundarySource(content),
|
|
2771
|
+
getImportSpecifiers(content).sort()
|
|
2772
|
+
]);
|
|
2773
|
+
} catch {
|
|
2774
|
+
return null;
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
function isFarmClientModulePlanUnchanged(file, previous) {
|
|
2778
|
+
const signature = clientModulePlanSignature(previous);
|
|
2779
|
+
return signature !== null && signature === clientModulePlanSignature(readSourceFileContents(file));
|
|
2780
|
+
}
|
|
2450
2781
|
function exportListNames(content) {
|
|
2451
2782
|
const names = [];
|
|
2452
2783
|
for (const match of content.matchAll(/\bexport\s*(type\s*)?\{([^}]*)\}/g)) {
|
|
@@ -2759,7 +3090,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
2759
3090
|
let fallbackReason;
|
|
2760
3091
|
let fallbackHint;
|
|
2761
3092
|
let costGuardExceeded = false;
|
|
2762
|
-
const projectRoot = root ?
|
|
3093
|
+
const projectRoot = root ? path5.resolve(root) : void 0;
|
|
2763
3094
|
const visit = (moduleSourcePath) => {
|
|
2764
3095
|
if (fallbackReason) return 0;
|
|
2765
3096
|
const cached = estimates.get(moduleSourcePath);
|
|
@@ -2857,7 +3188,9 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
2857
3188
|
const localBindings = importedBindings.get(specifier) ?? [];
|
|
2858
3189
|
const staticUses = countStaticJsxUses(content, localBindings);
|
|
2859
3190
|
if (staticUses > 0) {
|
|
2860
|
-
const
|
|
3191
|
+
const grows = options.packageReferences === true && projectRoot !== void 0 && (findFarmIslandContainers(content ?? "", moduleSourcePath, localBindings)?.length ?? 0) > 0;
|
|
3192
|
+
if (grows) visit(ensureFarmIslandContainerReference(projectRoot));
|
|
3193
|
+
const container = grows ? void 0 : findParserSensitiveJsxContainer(content, localBindings);
|
|
2861
3194
|
if (container) {
|
|
2862
3195
|
fallbackReason = `the client boundary imported from ${specifier} renders inside <${container}>, where the HTML parser relocates its hydration marker`;
|
|
2863
3196
|
fallbackHint = `Move "use client" up to a component that renders the whole <${container}>${PARSER_SENSITIVE_FLOW_HINTS[container] ?? ""}`;
|
|
@@ -2944,13 +3277,13 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
2944
3277
|
}
|
|
2945
3278
|
function farmWorkspaceServerEntry(entry) {
|
|
2946
3279
|
const real = realpathOrSelf(entry);
|
|
2947
|
-
if (real.split(
|
|
3280
|
+
if (real.split(path5.sep).includes("node_modules")) return null;
|
|
2948
3281
|
if (parseClientModuleMetadata(readIfExists(real), false).isClientComponent) return null;
|
|
2949
3282
|
return real;
|
|
2950
3283
|
}
|
|
2951
3284
|
function realpathOrSelf(file) {
|
|
2952
3285
|
try {
|
|
2953
|
-
return
|
|
3286
|
+
return fs6.realpathSync(file);
|
|
2954
3287
|
} catch {
|
|
2955
3288
|
return file;
|
|
2956
3289
|
}
|
|
@@ -2968,17 +3301,20 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
2968
3301
|
const key = `${root ?? ""}\0${resolvedPath}`;
|
|
2969
3302
|
const cached = cache2.find(key, visited);
|
|
2970
3303
|
if (cached) {
|
|
2971
|
-
for (const file of cached.files)
|
|
3304
|
+
for (const file of cached.files) {
|
|
3305
|
+
visited.add(file);
|
|
3306
|
+
noteFarmSourceRead(file);
|
|
3307
|
+
}
|
|
2972
3308
|
return { ...cached.result };
|
|
2973
3309
|
}
|
|
2974
|
-
const
|
|
2975
|
-
const result = traversePackageClientBoundary(resolvedPath, root, visited,
|
|
2976
|
-
cache2.add(key,
|
|
3310
|
+
const trace2 = new PackageInspectionTrace();
|
|
3311
|
+
const result = traversePackageClientBoundary(resolvedPath, root, visited, trace2);
|
|
3312
|
+
cache2.add(key, trace2.toEntry(result));
|
|
2977
3313
|
return result;
|
|
2978
3314
|
}
|
|
2979
|
-
function traversePackageClientBoundary(resolvedPath, root, visited,
|
|
3315
|
+
function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
2980
3316
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
2981
|
-
if (resolvedPath)
|
|
3317
|
+
if (resolvedPath) trace2?.stop(resolvedPath);
|
|
2982
3318
|
return {
|
|
2983
3319
|
isClientComponent: false,
|
|
2984
3320
|
shouldHydrate: false,
|
|
@@ -2986,7 +3322,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
|
2986
3322
|
};
|
|
2987
3323
|
}
|
|
2988
3324
|
visited.add(resolvedPath);
|
|
2989
|
-
|
|
3325
|
+
trace2?.visit(resolvedPath);
|
|
2990
3326
|
const content = readIfExists(resolvedPath);
|
|
2991
3327
|
const parsed = parseClientModuleMetadata(content, false);
|
|
2992
3328
|
let importsClientBoundary = false;
|
|
@@ -3005,7 +3341,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
|
3005
3341
|
specifier,
|
|
3006
3342
|
root
|
|
3007
3343
|
);
|
|
3008
|
-
const importedMetadata = traversePackageClientBoundary(importedPath, root, visited,
|
|
3344
|
+
const importedMetadata = traversePackageClientBoundary(importedPath, root, visited, trace2);
|
|
3009
3345
|
if (!importedMetadata.shouldHydrate) continue;
|
|
3010
3346
|
importsClientBoundary = true;
|
|
3011
3347
|
if (importedIslandStrategy === null) {
|
|
@@ -3021,8 +3357,16 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
|
3021
3357
|
islandStrategy: shouldHydrate ? parsed.islandStrategy ?? importedIslandStrategy ?? "load" : null
|
|
3022
3358
|
};
|
|
3023
3359
|
}
|
|
3024
|
-
function getImportSpecifiers(content,
|
|
3360
|
+
function getImportSpecifiers(content, options = {}) {
|
|
3025
3361
|
if (!content) return [];
|
|
3362
|
+
const specifiers = memoizeInFarmSourceSnapshot(
|
|
3363
|
+
`specifiers:${options.reexportsOnly === true}:${options.dynamic === true}`,
|
|
3364
|
+
content,
|
|
3365
|
+
() => scanImportSpecifiers(content, options)
|
|
3366
|
+
);
|
|
3367
|
+
return [...specifiers];
|
|
3368
|
+
}
|
|
3369
|
+
function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false }) {
|
|
3026
3370
|
const tokens = tokenizeModuleSource(content);
|
|
3027
3371
|
const matches = /* @__PURE__ */ new Set();
|
|
3028
3372
|
let braceDepth = 0;
|
|
@@ -3095,6 +3439,16 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
|
3095
3439
|
return true;
|
|
3096
3440
|
}
|
|
3097
3441
|
function resolveImportedModule(importerPath, specifier, root) {
|
|
3442
|
+
const resolved = memoizeInFarmSourceSnapshot(
|
|
3443
|
+
"resolution",
|
|
3444
|
+
`${root ?? ""}\0${importerPath}\0${specifier}`,
|
|
3445
|
+
() => resolveImportedModuleUncached(importerPath, specifier, root),
|
|
3446
|
+
// A file added later may resolve an import that does not resolve now.
|
|
3447
|
+
(result) => result.path !== null
|
|
3448
|
+
);
|
|
3449
|
+
return { ...resolved };
|
|
3450
|
+
}
|
|
3451
|
+
function resolveImportedModuleUncached(importerPath, specifier, root) {
|
|
3098
3452
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
3099
3453
|
return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
|
|
3100
3454
|
}
|
|
@@ -3116,7 +3470,7 @@ var ALIAS_IMPORT = /^(?:@\/|~\/|#)/;
|
|
|
3116
3470
|
function warnUnresolvedAliasImport(importerPath, specifier, root) {
|
|
3117
3471
|
if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
|
|
3118
3472
|
warnedUnresolvedAliasImports.add(specifier);
|
|
3119
|
-
const importer = root ?
|
|
3473
|
+
const importer = root ? path5.relative(root, importerPath) : importerPath;
|
|
3120
3474
|
logger.warn(
|
|
3121
3475
|
`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".`
|
|
3122
3476
|
);
|
|
@@ -3125,7 +3479,7 @@ var projectImportAliasCache = /* @__PURE__ */ new Map();
|
|
|
3125
3479
|
var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
|
|
3126
3480
|
function resolveProjectAliasSourcePath(specifier, root) {
|
|
3127
3481
|
if (!root) return void 0;
|
|
3128
|
-
const projectRoot =
|
|
3482
|
+
const projectRoot = path5.resolve(root);
|
|
3129
3483
|
let match;
|
|
3130
3484
|
for (const alias of getProjectImportAliases(projectRoot)) {
|
|
3131
3485
|
const captured = matchProjectImportAlias(alias, specifier);
|
|
@@ -3135,7 +3489,7 @@ function resolveProjectAliasSourcePath(specifier, root) {
|
|
|
3135
3489
|
if (!match) return void 0;
|
|
3136
3490
|
const resolved = resolveSourceCandidate(
|
|
3137
3491
|
match.alias.targets.map(
|
|
3138
|
-
(target) =>
|
|
3492
|
+
(target) => path5.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
|
|
3139
3493
|
)
|
|
3140
3494
|
);
|
|
3141
3495
|
return resolved && /\.d\.[cm]?ts$/.test(resolved) ? null : resolved;
|
|
@@ -3150,7 +3504,7 @@ function matchProjectImportAlias(alias, specifier) {
|
|
|
3150
3504
|
function getProjectImportAliases(projectRoot) {
|
|
3151
3505
|
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
3152
3506
|
try {
|
|
3153
|
-
return String(
|
|
3507
|
+
return String(fs6.statSync(path5.join(projectRoot, file)).mtimeMs);
|
|
3154
3508
|
} catch {
|
|
3155
3509
|
return "-";
|
|
3156
3510
|
}
|
|
@@ -3168,7 +3522,7 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3168
3522
|
prefix: "@/",
|
|
3169
3523
|
suffix: "",
|
|
3170
3524
|
wildcard: true,
|
|
3171
|
-
targets: [
|
|
3525
|
+
targets: [path5.join(projectRoot, sourceDir, "*")]
|
|
3172
3526
|
});
|
|
3173
3527
|
}
|
|
3174
3528
|
projectImportAliasCache.set(projectRoot, { stamp: cacheStamp, aliases });
|
|
@@ -3176,8 +3530,8 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3176
3530
|
}
|
|
3177
3531
|
function readTsconfigPathAliases(projectRoot) {
|
|
3178
3532
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
3179
|
-
const configPath =
|
|
3180
|
-
if (!
|
|
3533
|
+
const configPath = path5.join(projectRoot, name);
|
|
3534
|
+
if (!fs6.existsSync(configPath)) continue;
|
|
3181
3535
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
3182
3536
|
if (!resolved?.paths) return [];
|
|
3183
3537
|
const base = resolved.baseUrl ?? resolved.pathsDirectory;
|
|
@@ -3189,7 +3543,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
3189
3543
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
3190
3544
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
3191
3545
|
wildcard: wildcardIndex !== -1,
|
|
3192
|
-
targets: targets.filter((target) => typeof target === "string").map((target) =>
|
|
3546
|
+
targets: targets.filter((target) => typeof target === "string").map((target) => path5.resolve(base, target))
|
|
3193
3547
|
}
|
|
3194
3548
|
];
|
|
3195
3549
|
});
|
|
@@ -3201,27 +3555,27 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
3201
3555
|
visited.add(configPath);
|
|
3202
3556
|
const config = readJsonWithComments(configPath);
|
|
3203
3557
|
if (!config) return null;
|
|
3204
|
-
const directory =
|
|
3558
|
+
const directory = path5.dirname(configPath);
|
|
3205
3559
|
const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
|
|
3206
3560
|
(parent) => typeof parent === "string" && parent.startsWith(".")
|
|
3207
3561
|
);
|
|
3208
3562
|
let inherited = null;
|
|
3209
3563
|
for (const parent of parents) {
|
|
3210
|
-
const parentPath =
|
|
3564
|
+
const parentPath = path5.resolve(
|
|
3211
3565
|
directory,
|
|
3212
3566
|
parent.endsWith(".json") ? parent : `${parent}.json`
|
|
3213
3567
|
);
|
|
3214
3568
|
inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
|
|
3215
3569
|
}
|
|
3216
3570
|
const options = config.compilerOptions ?? {};
|
|
3217
|
-
const baseUrl = typeof options.baseUrl === "string" ?
|
|
3571
|
+
const baseUrl = typeof options.baseUrl === "string" ? path5.resolve(directory, options.baseUrl) : inherited?.baseUrl;
|
|
3218
3572
|
if (options.paths && typeof options.paths === "object") {
|
|
3219
3573
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
3220
3574
|
}
|
|
3221
3575
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
3222
3576
|
}
|
|
3223
3577
|
function readPackageImportAliases(projectRoot) {
|
|
3224
|
-
const imports = readPackageJson(
|
|
3578
|
+
const imports = readPackageJson(path5.join(projectRoot, "package.json"))?.imports;
|
|
3225
3579
|
if (!imports || typeof imports !== "object") return [];
|
|
3226
3580
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
3227
3581
|
const target = resolveConditionalExportTarget(value);
|
|
@@ -3232,7 +3586,7 @@ function readPackageImportAliases(projectRoot) {
|
|
|
3232
3586
|
prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
|
|
3233
3587
|
suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
|
|
3234
3588
|
wildcard: wildcardIndex !== -1,
|
|
3235
|
-
targets: [
|
|
3589
|
+
targets: [path5.resolve(projectRoot, target)]
|
|
3236
3590
|
}
|
|
3237
3591
|
];
|
|
3238
3592
|
});
|
|
@@ -3240,7 +3594,7 @@ function readPackageImportAliases(projectRoot) {
|
|
|
3240
3594
|
function readJsonWithComments(filePath) {
|
|
3241
3595
|
let source;
|
|
3242
3596
|
try {
|
|
3243
|
-
source =
|
|
3597
|
+
source = fs6.readFileSync(filePath, "utf8");
|
|
3244
3598
|
} catch {
|
|
3245
3599
|
return null;
|
|
3246
3600
|
}
|
|
@@ -3278,7 +3632,7 @@ function resolveImportedModuleSourcePath(importerPath, specifier, root) {
|
|
|
3278
3632
|
return resolvePackageModuleSourcePath(importerPath, specifier, root);
|
|
3279
3633
|
}
|
|
3280
3634
|
const candidates = /* @__PURE__ */ new Set();
|
|
3281
|
-
const basePath = specifier.startsWith(".") ?
|
|
3635
|
+
const basePath = specifier.startsWith(".") ? path5.resolve(path5.dirname(importerPath), specifier) : root ? path5.resolve(root, specifier.replace(/^\/+/, "")) : path5.resolve(specifier);
|
|
3282
3636
|
candidates.add(basePath);
|
|
3283
3637
|
return resolveSourceCandidate(candidates);
|
|
3284
3638
|
}
|
|
@@ -3288,45 +3642,45 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
3288
3642
|
const packageSubpath = packageParts.slice(packageName.startsWith("@") ? 2 : 1).join("/");
|
|
3289
3643
|
const packageDirectory = findPackageDirectory2(importerPath, packageName, root);
|
|
3290
3644
|
if (!packageDirectory) return null;
|
|
3291
|
-
const packageJsonPath =
|
|
3645
|
+
const packageJsonPath = path5.join(packageDirectory, "package.json");
|
|
3292
3646
|
const packageJson = readPackageJson(packageJsonPath);
|
|
3293
3647
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
3294
3648
|
const exportTarget = resolvePackageExport(packageJson?.exports, exportKey);
|
|
3295
3649
|
const candidates = /* @__PURE__ */ new Set();
|
|
3296
3650
|
if (exportTarget?.startsWith("./")) {
|
|
3297
|
-
candidates.add(
|
|
3651
|
+
candidates.add(path5.resolve(packageDirectory, exportTarget));
|
|
3298
3652
|
}
|
|
3299
3653
|
if (packageSubpath) {
|
|
3300
|
-
candidates.add(
|
|
3654
|
+
candidates.add(path5.join(packageDirectory, packageSubpath));
|
|
3301
3655
|
} else {
|
|
3302
3656
|
for (const entry of [packageJson?.browser, packageJson?.module, packageJson?.main]) {
|
|
3303
|
-
if (typeof entry === "string") candidates.add(
|
|
3657
|
+
if (typeof entry === "string") candidates.add(path5.resolve(packageDirectory, entry));
|
|
3304
3658
|
}
|
|
3305
|
-
candidates.add(
|
|
3659
|
+
candidates.add(path5.join(packageDirectory, "index"));
|
|
3306
3660
|
}
|
|
3307
3661
|
return resolveSourceCandidate(candidates);
|
|
3308
3662
|
}
|
|
3309
3663
|
function findPackageDirectory2(importerPath, packageName, root) {
|
|
3310
3664
|
const searchRoots = /* @__PURE__ */ new Set();
|
|
3311
|
-
let current =
|
|
3665
|
+
let current = path5.dirname(importerPath);
|
|
3312
3666
|
while (true) {
|
|
3313
3667
|
searchRoots.add(current);
|
|
3314
|
-
const parent =
|
|
3668
|
+
const parent = path5.dirname(current);
|
|
3315
3669
|
if (parent === current) break;
|
|
3316
3670
|
current = parent;
|
|
3317
3671
|
}
|
|
3318
3672
|
if (root) {
|
|
3319
|
-
current =
|
|
3673
|
+
current = path5.resolve(root);
|
|
3320
3674
|
while (true) {
|
|
3321
3675
|
searchRoots.add(current);
|
|
3322
|
-
const parent =
|
|
3676
|
+
const parent = path5.dirname(current);
|
|
3323
3677
|
if (parent === current) break;
|
|
3324
3678
|
current = parent;
|
|
3325
3679
|
}
|
|
3326
3680
|
}
|
|
3327
3681
|
for (const searchRoot of searchRoots) {
|
|
3328
|
-
const packageDirectory =
|
|
3329
|
-
if (
|
|
3682
|
+
const packageDirectory = path5.join(searchRoot, "node_modules", packageName);
|
|
3683
|
+
if (fs6.existsSync(path5.join(packageDirectory, "package.json"))) {
|
|
3330
3684
|
return packageDirectory;
|
|
3331
3685
|
}
|
|
3332
3686
|
}
|
|
@@ -3334,7 +3688,7 @@ function findPackageDirectory2(importerPath, packageName, root) {
|
|
|
3334
3688
|
}
|
|
3335
3689
|
function readPackageJson(packageJsonPath) {
|
|
3336
3690
|
try {
|
|
3337
|
-
return JSON.parse(
|
|
3691
|
+
return JSON.parse(fs6.readFileSync(packageJsonPath, "utf8"));
|
|
3338
3692
|
} catch {
|
|
3339
3693
|
return null;
|
|
3340
3694
|
}
|
|
@@ -3392,11 +3746,11 @@ function resolveSourceCandidate(candidates) {
|
|
|
3392
3746
|
for (const candidate of candidates) {
|
|
3393
3747
|
const paths = [candidate];
|
|
3394
3748
|
for (const extension of RESOLVABLE_SOURCE_EXTENSIONS) {
|
|
3395
|
-
paths.push(`${candidate}${extension}`,
|
|
3749
|
+
paths.push(`${candidate}${extension}`, path5.join(candidate, `index${extension}`));
|
|
3396
3750
|
}
|
|
3397
3751
|
for (const sourcePath of paths) {
|
|
3398
3752
|
try {
|
|
3399
|
-
if (
|
|
3753
|
+
if (fs6.statSync(sourcePath).isFile()) return sourcePath;
|
|
3400
3754
|
} catch {
|
|
3401
3755
|
}
|
|
3402
3756
|
}
|
|
@@ -3439,13 +3793,13 @@ function scanFarmPackageImports(directory, root) {
|
|
|
3439
3793
|
const walk2 = (current) => {
|
|
3440
3794
|
let entries;
|
|
3441
3795
|
try {
|
|
3442
|
-
entries =
|
|
3796
|
+
entries = fs6.readdirSync(current, { withFileTypes: true });
|
|
3443
3797
|
} catch {
|
|
3444
3798
|
return;
|
|
3445
3799
|
}
|
|
3446
3800
|
for (const entry of entries) {
|
|
3447
3801
|
if (entry.name.startsWith(".") && entry.isDirectory()) continue;
|
|
3448
|
-
const file =
|
|
3802
|
+
const file = path5.join(current, entry.name);
|
|
3449
3803
|
if (entry.isDirectory()) {
|
|
3450
3804
|
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3451
3805
|
continue;
|
|
@@ -3472,13 +3826,13 @@ function collectFarmServerBundledPackageInfo(directory) {
|
|
|
3472
3826
|
const walk2 = (current) => {
|
|
3473
3827
|
let entries;
|
|
3474
3828
|
try {
|
|
3475
|
-
entries =
|
|
3829
|
+
entries = fs6.readdirSync(current, { withFileTypes: true });
|
|
3476
3830
|
} catch {
|
|
3477
3831
|
return;
|
|
3478
3832
|
}
|
|
3479
3833
|
for (const entry of entries) {
|
|
3480
3834
|
if (entry.name.startsWith(".") && entry.isDirectory()) continue;
|
|
3481
|
-
const file =
|
|
3835
|
+
const file = path5.join(current, entry.name);
|
|
3482
3836
|
if (entry.isDirectory()) {
|
|
3483
3837
|
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3484
3838
|
continue;
|
|
@@ -3503,7 +3857,7 @@ function invalidateFarmClientReachableModules() {
|
|
|
3503
3857
|
clientReachableModules.clear();
|
|
3504
3858
|
}
|
|
3505
3859
|
function getFarmClientReachableModules(directory, root) {
|
|
3506
|
-
const key = `${
|
|
3860
|
+
const key = `${path5.resolve(root)}\0${path5.resolve(directory)}`;
|
|
3507
3861
|
const cached = clientReachableModules.get(key);
|
|
3508
3862
|
if (cached) return cached;
|
|
3509
3863
|
const reachable = /* @__PURE__ */ new Set();
|
|
@@ -3511,12 +3865,12 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
3511
3865
|
const walk2 = (current) => {
|
|
3512
3866
|
let entries;
|
|
3513
3867
|
try {
|
|
3514
|
-
entries =
|
|
3868
|
+
entries = fs6.readdirSync(current, { withFileTypes: true });
|
|
3515
3869
|
} catch {
|
|
3516
3870
|
return;
|
|
3517
3871
|
}
|
|
3518
3872
|
for (const entry of entries) {
|
|
3519
|
-
const file =
|
|
3873
|
+
const file = path5.join(current, entry.name);
|
|
3520
3874
|
if (entry.isDirectory()) {
|
|
3521
3875
|
if (!entry.name.startsWith(".") && !CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3522
3876
|
} else if (isScannedSourceFile(entry.name)) {
|
|
@@ -3527,12 +3881,12 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
3527
3881
|
};
|
|
3528
3882
|
walk2(directory);
|
|
3529
3883
|
while (queue.length > 0) {
|
|
3530
|
-
const file =
|
|
3884
|
+
const file = path5.resolve(queue.pop());
|
|
3531
3885
|
if (reachable.has(file)) continue;
|
|
3532
3886
|
reachable.add(file);
|
|
3533
3887
|
for (const specifier of getImportSpecifiers(readIfExists(file), { dynamic: true })) {
|
|
3534
3888
|
const imported = resolveImportedModule(file, specifier, root);
|
|
3535
|
-
if (imported.local && imported.path && !reachable.has(
|
|
3889
|
+
if (imported.local && imported.path && !reachable.has(path5.resolve(imported.path))) {
|
|
3536
3890
|
queue.push(imported.path);
|
|
3537
3891
|
}
|
|
3538
3892
|
}
|
|
@@ -3541,7 +3895,7 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
3541
3895
|
return reachable;
|
|
3542
3896
|
}
|
|
3543
3897
|
function resolveFarmClientOptimizeDeps(directory, root) {
|
|
3544
|
-
const importer =
|
|
3898
|
+
const importer = path5.join(path5.resolve(root), "package.json");
|
|
3545
3899
|
const include = /* @__PURE__ */ new Set();
|
|
3546
3900
|
const exclude = /* @__PURE__ */ new Set();
|
|
3547
3901
|
const imports = scanFarmPackageImports(directory, root);
|
|
@@ -3639,7 +3993,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3639
3993
|
routesFiles = new Set(
|
|
3640
3994
|
getFarmSourceRoots({ ...options, root: options.root ?? config.root }).flatMap(
|
|
3641
3995
|
(source) => PROGRAMMATIC_ROUTE_FILE_NAMES.map(
|
|
3642
|
-
(name) => resolvedFile(
|
|
3996
|
+
(name) => resolvedFile(path6.resolve(source.root, source.srcDir, name))
|
|
3643
3997
|
)
|
|
3644
3998
|
)
|
|
3645
3999
|
);
|
|
@@ -3649,20 +4003,20 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3649
4003
|
this,
|
|
3650
4004
|
transformOptions?.ssr
|
|
3651
4005
|
);
|
|
3652
|
-
const
|
|
3653
|
-
const result = transformEnvironmentFunctions({ code, id, environment, parse:
|
|
4006
|
+
const parse3 = (source) => this.parse(source);
|
|
4007
|
+
const result = transformEnvironmentFunctions({ code, id, environment, parse: parse3 });
|
|
3654
4008
|
if (environment === "client" && !isBuild && !parseProgrammaticRouteModuleId(id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
|
|
3655
4009
|
this.error(routeSourceError(moduleFile(id)));
|
|
3656
4010
|
}
|
|
3657
4011
|
if (environment === "server" && resolveFarmServerComponentsMode(options.experimental?.serverComponents) === "islands" && isApplicationScript(id)) {
|
|
3658
4012
|
const file = id.split("?", 1)[0];
|
|
3659
4013
|
const root = realpathSync(options.root ?? projectRoot);
|
|
3660
|
-
const clientCode = getFarmClientReachableModules(root, root).has(
|
|
4014
|
+
const clientCode = getFarmClientReachableModules(root, root).has(path6.resolve(file)) || existsSync(file) && hasUseClientDirective(readFileSync(file, "utf8"));
|
|
3661
4015
|
const reached = clientCode ? null : findFarmClientOnlyImport(code, file);
|
|
3662
4016
|
if (reached) {
|
|
3663
|
-
const chain = reached.chain.map((step) =>
|
|
4017
|
+
const chain = reached.chain.map((step) => path6.relative(root, step)).join(" -> ");
|
|
3664
4018
|
this.error(
|
|
3665
|
-
`[Farm.js] ${
|
|
4019
|
+
`[Farm.js] ${path6.relative(root, file)} is server code, but its import of "${reached.specifier}" reaches "client-only" (${chain}), so that package can only run in the browser. Add "use client" to this module, or import the package from a "use client" module.`
|
|
3666
4020
|
);
|
|
3667
4021
|
}
|
|
3668
4022
|
}
|
|
@@ -3972,6 +4326,9 @@ export {
|
|
|
3972
4326
|
createEvaluatedRouteGraph,
|
|
3973
4327
|
mergeProgrammaticClientRoutes,
|
|
3974
4328
|
generateProgrammaticClientRouteModule,
|
|
4329
|
+
FarmSourceSnapshotStore,
|
|
4330
|
+
withFarmSourceSnapshot,
|
|
4331
|
+
traceFarmSourceReads,
|
|
3975
4332
|
rewriteFarmReactServerClientModuleImports,
|
|
3976
4333
|
rewriteFarmReactServerImports,
|
|
3977
4334
|
invalidateFarmClientOnlyScan,
|
|
@@ -3983,10 +4340,15 @@ export {
|
|
|
3983
4340
|
ensureFarmPackageClientReference,
|
|
3984
4341
|
ensureFarmInternalClientReference,
|
|
3985
4342
|
rewriteFarmPackageClientImports,
|
|
4343
|
+
farmIslandContainerReferencePath,
|
|
4344
|
+
ensureFarmIslandContainerReference,
|
|
4345
|
+
wrapFarmIslandContainers,
|
|
3986
4346
|
withPackageClientBoundaryCache,
|
|
3987
4347
|
usePackageClientBoundaryCacheFile,
|
|
3988
4348
|
resolvePackageClientBoundaryCacheFile,
|
|
3989
4349
|
runWithPackageClientBoundaryCacheFile,
|
|
4350
|
+
runWithLatestPackageClientBoundaryCache,
|
|
4351
|
+
dropLatestPackageClientBoundaryCache,
|
|
3990
4352
|
resolveModuleSourcePath,
|
|
3991
4353
|
getFarmClientHydrationPlanOptions,
|
|
3992
4354
|
describeSuppressedAsyncHydration,
|
|
@@ -3994,6 +4356,7 @@ export {
|
|
|
3994
4356
|
hasUseClientDirective,
|
|
3995
4357
|
getIslandStrategyExport,
|
|
3996
4358
|
stripUseClientDirective,
|
|
4359
|
+
getFarmClientRenderingBindings,
|
|
3997
4360
|
collectFarmRenderedClientModules,
|
|
3998
4361
|
collectFarmServerStylesheets,
|
|
3999
4362
|
getClientModuleMetadata,
|
|
@@ -4002,6 +4365,7 @@ export {
|
|
|
4002
4365
|
createMarkdownPageHydrationPlanner,
|
|
4003
4366
|
enforceFarmIsolatedHydrationRouteBudget,
|
|
4004
4367
|
isIsolatableClientBoundarySource,
|
|
4368
|
+
isFarmClientModulePlanUnchanged,
|
|
4005
4369
|
resolveImportedModule,
|
|
4006
4370
|
isFarmPackageClientBoundary,
|
|
4007
4371
|
collectFarmClientPackageImports,
|