@farm.js/core 0.1.70 → 0.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp-handler-6T2Z7TB6.cjs → agent-mcp-handler-KE4J3W7S.cjs} +4 -4
- package/dist/{agent-mcp-handler-CPU354QQ.mjs → agent-mcp-handler-VIT4GOSR.mjs} +3 -3
- package/dist/{agent-mcp.d-DulgFLBt.d.ts → agent-mcp.d-BO3rZXEM.d.ts} +15 -5
- package/dist/{agent-mcp.d-TAs1ES2F.d.mts → agent-mcp.d-Cwff7lcA.d.mts} +15 -5
- package/dist/agent-runtime.d.mts +3 -3
- package/dist/agent-runtime.d.ts +3 -3
- package/dist/{analyzer-QGRBLETM.mjs → analyzer-5Q75LTIL.mjs} +2 -2
- package/dist/analyzer-UJG4MIZW.cjs +16 -0
- package/dist/api/node.d.mts +5 -5
- package/dist/api/node.d.ts +5 -5
- package/dist/api/route-manager.cjs +7 -6
- package/dist/api/route-manager.d.mts +7 -7
- package/dist/api/route-manager.d.ts +7 -7
- package/dist/api/route-manager.mjs +6 -5
- package/dist/api/runtime.d.mts +4 -4
- package/dist/api/runtime.d.ts +4 -4
- package/dist/api.cjs +8 -7
- package/dist/api.d.mts +8 -8
- package/dist/api.d.ts +8 -8
- package/dist/api.mjs +7 -6
- package/dist/{app-manifest.d-C-nf3Vmm.d.ts → app-manifest.d-DwjGkYlP.d.ts} +1 -1
- package/dist/{app-manifest.d-6zXb90o6.d.mts → app-manifest.d-USD_IbFd.d.mts} +1 -1
- package/dist/app-markdown.cjs +5 -3
- package/dist/app-markdown.d.mts +5 -5
- package/dist/app-markdown.d.ts +5 -5
- package/dist/app-markdown.mjs +4 -2
- package/dist/{app.d-C2xeMIYT.d.ts → app.d-DAmF2MAk.d.ts} +52 -8
- package/dist/{app.d-DF0aundc.d.mts → app.d-fW06_h8h.d.mts} +52 -8
- package/dist/{chunk-7A3URI2F.mjs → chunk-2EVESLP3.mjs} +8 -1
- package/dist/{chunk-JRF2SKCD.mjs → chunk-3JN5M3T5.mjs} +259 -61
- package/dist/{chunk-XYVPTTUT.cjs → chunk-3WG7GJQL.cjs} +11 -6
- package/dist/{chunk-K66JILV3.cjs → chunk-5LOARKDP.cjs} +2 -2
- package/dist/{chunk-I7NUT24Z.cjs → chunk-5R4Q5FN7.cjs} +2 -2
- package/dist/{chunk-BPUVDCGG.cjs → chunk-5X6OHJEE.cjs} +15 -3
- package/dist/{chunk-RMOU3PR4.mjs → chunk-5XFKWHZD.mjs} +293 -66
- package/dist/{chunk-A2TH5MKE.mjs → chunk-645ENY7W.mjs} +3 -3
- package/dist/{chunk-NYF7A4UW.mjs → chunk-77VNYVVX.mjs} +1 -1
- package/dist/{chunk-32SYRIQ7.cjs → chunk-7QCJDYZQ.cjs} +3 -3
- package/dist/{chunk-QZHTDVH4.mjs → chunk-AUAMXI6N.mjs} +1 -1
- package/dist/{chunk-5R3JQPWD.mjs → chunk-AYVGD3PK.mjs} +1 -1
- package/dist/{chunk-IEN2EFE5.cjs → chunk-BE7AQXJB.cjs} +346 -148
- package/dist/{chunk-CCHJWJGP.mjs → chunk-BSXKZPFE.mjs} +204 -98
- package/dist/{chunk-2MR4MABG.cjs → chunk-C5AM2XDN.cjs} +54 -4
- package/dist/{chunk-M6U6E4F7.cjs → chunk-CBLRSZQL.cjs} +557 -330
- package/dist/{chunk-BBPDJGCU.cjs → chunk-CYOTNHDF.cjs} +2 -2
- package/dist/{chunk-5IJRJWJS.mjs → chunk-DGNMXL2O.mjs} +11 -1
- package/dist/{chunk-3EXCZJEN.mjs → chunk-DS7JGFW5.mjs} +13 -1
- package/dist/{chunk-EDZU7YRK.mjs → chunk-E2V7RRFL.mjs} +2 -2
- package/dist/{chunk-K7JMTAFH.cjs → chunk-E3LE6EZH.cjs} +20 -10
- package/dist/{chunk-DIHBWZDZ.cjs → chunk-ET6WW3FY.cjs} +636 -355
- package/dist/{chunk-65FPDDT4.cjs → chunk-EXN4DTVF.cjs} +2 -2
- package/dist/{chunk-K4UGCUXX.cjs → chunk-FSSONJRV.cjs} +7 -7
- package/dist/{chunk-Y2SZVIVH.cjs → chunk-GPICBTDV.cjs} +8 -1
- package/dist/{chunk-FJ5YCERM.cjs → chunk-HLMUWKAP.cjs} +466 -359
- package/dist/{chunk-A7HCBHMC.cjs → chunk-IWCYRDRQ.cjs} +3 -3
- package/dist/{chunk-R7254L3R.mjs → chunk-J5ASGNKF.mjs} +23 -0
- package/dist/{chunk-75E5FDX2.mjs → chunk-JMFTKNBA.mjs} +10 -10
- package/dist/{chunk-TLSSIYAL.mjs → chunk-KQAB5LML.mjs} +10 -3
- package/dist/{chunk-NSZY3EWG.cjs → chunk-L6E4SHUB.cjs} +31 -8
- package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
- package/dist/{chunk-4AC4PXZO.cjs → chunk-N3XO5AL5.cjs} +2 -2
- package/dist/{chunk-2AM26UGI.cjs → chunk-NLBK37HI.cjs} +5 -4
- package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
- package/dist/{chunk-NA77GEIU.mjs → chunk-NV26EGMC.mjs} +51 -1
- package/dist/{chunk-LECZ5DPZ.cjs → chunk-OSEQL34Q.cjs} +2 -2
- package/dist/{chunk-3WS5AZ3R.mjs → chunk-OSMUE5ST.mjs} +8 -3
- package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
- package/dist/{chunk-KPMLDT3B.mjs → chunk-QUYAGU65.mjs} +581 -300
- package/dist/{chunk-N62IYXYD.mjs → chunk-RFWWXEIF.mjs} +1 -1
- package/dist/{chunk-E77IA5IF.mjs → chunk-RLFGKJQ6.mjs} +1 -1
- package/dist/{chunk-3AUINHFG.mjs → chunk-TNYC3TYP.mjs} +3 -2
- package/dist/{chunk-VG6HYT5K.cjs → chunk-TP4RAV7Y.cjs} +9 -9
- package/dist/{chunk-JFVT5ZZV.mjs → chunk-VAWDGGW3.mjs} +1 -1
- package/dist/{chunk-MU5V7XHL.mjs → chunk-VJSXPN3W.mjs} +3 -0
- package/dist/{chunk-DU4VHHPJ.mjs → chunk-VO55MMBX.mjs} +1 -1
- package/dist/{chunk-LDVJIBGN.mjs → chunk-VT25ERQK.mjs} +1 -1
- package/dist/{chunk-HAXFV2CD.mjs → chunk-WIJF3PBM.mjs} +1 -1
- package/dist/{chunk-QEWWKYDL.cjs → chunk-YCNHUIPR.cjs} +17 -10
- package/dist/{chunk-FILXOEWD.cjs → chunk-YXIQYWOK.cjs} +2 -2
- package/dist/{chunk-THG2TVDH.mjs → chunk-YZLEOMMA.mjs} +3 -3
- package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
- package/dist/{chunk-MZLJFNMH.cjs → chunk-ZDZUFD67.cjs} +1 -1
- 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-DNbC4oWI.d.ts → client-component.d-9J7CkTWW.d.ts} +2 -2
- package/dist/{client-component.d-Bk5qKJM-.d.mts → client-component.d-ciHeCxr-.d.mts} +2 -2
- package/dist/{client-plugins.d-DwUqh4gp.d.ts → client-plugins.d-CUOhfapO.d.ts} +12 -8
- package/dist/{client-plugins.d-Pi9nG0W0.d.mts → client-plugins.d-JnRz5a1o.d.mts} +12 -8
- package/dist/client-plugins.d.mts +3 -3
- package/dist/client-plugins.d.ts +3 -3
- package/dist/client.cjs +1 -1
- package/dist/client.d.mts +8 -8
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +1 -1
- package/dist/config.d.mts +3 -3
- package/dist/config.d.ts +3 -3
- package/dist/desktop.d.mts +4 -4
- package/dist/desktop.d.ts +4 -4
- package/dist/{devtools-CB43AHEP.mjs → devtools-7JPQMSTQ.mjs} +4 -4
- package/dist/{devtools-L5DUNDF3.cjs → devtools-IZFUYWPG.cjs} +5 -5
- package/dist/docs.cjs +6 -6
- package/dist/docs.d.mts +4 -4
- package/dist/docs.d.ts +4 -4
- package/dist/docs.mjs +5 -5
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{headers.d-CE6OWB-n.d.ts → headers.d-CqpTL_fZ.d.ts} +2 -2
- package/dist/{headers.d-DED1hHh4.d.mts → headers.d-rbbTKGaN.d.mts} +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 +29 -27
- package/dist/{index.d-c9UwIqDy.d.ts → index.d-CMKvzHLW.d.ts} +1 -1
- package/dist/{index.d-CbvOjJcp.d.mts → index.d-D_B2D9Il.d.mts} +1 -1
- package/dist/index.d.mts +24 -24
- package/dist/index.d.ts +24 -24
- package/dist/index.mjs +28 -26
- package/dist/integrations/orm.d.mts +3 -3
- package/dist/integrations/orm.d.ts +3 -3
- package/dist/integrations.d.mts +3 -3
- package/dist/integrations.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.cjs +4 -2
- package/dist/internal/app-markdown-runtime.d.mts +13 -5
- package/dist/internal/app-markdown-runtime.d.ts +13 -5
- package/dist/internal/app-markdown-runtime.mjs +3 -1
- package/dist/internal/build-runtime.cjs +26 -26
- package/dist/internal/build-runtime.d.mts +5 -5
- package/dist/internal/build-runtime.d.ts +5 -5
- package/dist/internal/build-runtime.mjs +25 -25
- package/dist/internal/cli-runtime.cjs +9 -7
- package/dist/internal/cli-runtime.mjs +8 -6
- 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 +6 -6
- package/dist/internal/client-runtime.d.ts +6 -6
- package/dist/internal/client-runtime.mjs +3 -3
- package/dist/internal/compression-runtime.d.mts +3 -3
- package/dist/internal/compression-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +6 -6
- package/dist/internal/config-runtime.d.ts +6 -6
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/infra-analytics-runtime.cjs +8 -8
- package/dist/internal/infra-analytics-runtime.mjs +6 -6
- 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 +15 -15
- package/dist/internal/production-runtime.d.mts +41 -24
- package/dist/internal/production-runtime.d.ts +41 -24
- package/dist/internal/production-runtime.mjs +14 -14
- package/dist/internal/vercel-edge-middleware.d.mts +2 -2
- package/dist/internal/vercel-edge-middleware.d.ts +2 -2
- package/dist/markdown.d.mts +3 -3
- package/dist/markdown.d.ts +3 -3
- package/dist/middleware.cjs +3 -3
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/middleware.mjs +2 -2
- package/dist/mobile.d.mts +3 -3
- package/dist/mobile.d.ts +3 -3
- package/dist/{mount.d-DngLY7NL.d.ts → mount.d-B0XMxDRh.d.ts} +1 -1
- package/dist/{mount.d-BvWxf8ZE.d.mts → mount.d-ImEO7q8a.d.mts} +1 -1
- package/dist/{navigation-delegate.d-CMyl1h2l.d.mts → navigation-delegate.d-83Q7ksf7.d.mts} +1 -1
- package/dist/{navigation-delegate.d-zZogiDfa.d.ts → navigation-delegate.d-RRx1CSlb.d.ts} +1 -1
- package/dist/navigation.d.mts +6 -6
- package/dist/navigation.d.ts +6 -6
- package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
- package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
- package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
- package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
- package/dist/plugin.cjs +20 -20
- package/dist/plugin.d.mts +6 -6
- package/dist/plugin.d.ts +6 -6
- package/dist/plugin.mjs +19 -19
- 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-DQj2bzd2.d.ts → render-plan.d-Ds2sXJ5m.d.ts} +1 -1
- package/dist/{render-plan.d-Di1znBDW.d.mts → render-plan.d-wP8nTeRV.d.mts} +1 -1
- package/dist/renderer-client.cjs +3 -2
- package/dist/renderer-client.d.mts +6 -6
- package/dist/renderer-client.d.ts +6 -6
- package/dist/renderer-client.mjs +2 -1
- package/dist/{request.d-CJWzfDYJ.d.mts → request.d-F3h7K37m.d.mts} +1 -1
- package/dist/{request.d-C5vyoYeL.d.ts → request.d-zpSn6pu_.d.ts} +1 -1
- package/dist/request.d.mts +4 -4
- package/dist/request.d.ts +4 -4
- 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-DhsY5M2I.d.ts → route-rendering.d-BL0_AdKj.d.ts} +1 -1
- package/dist/{route-rendering.d-C-et2TZ1.d.mts → route-rendering.d-Mw0ZKG2e.d.mts} +1 -1
- package/dist/{router.d-CJB-Ntni.d.ts → router.d-BwXigemZ.d.ts} +1 -1
- package/dist/{router.d-BMDS5s5X.d.mts → router.d-NGVsU11T.d.mts} +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 +3 -3
- package/dist/routes.d.ts +3 -3
- package/dist/{routing.d-BxOZ2YWc.d.ts → routing.d-BhPgtN_S.d.ts} +2 -1
- package/dist/{routing.d-DwSUVZbF.d.mts → routing.d-D67HQmnv.d.mts} +2 -1
- package/dist/{rsc-pipeline-NJKLZ3YE.cjs → rsc-pipeline-BNXYMG4G.cjs} +6 -6
- package/dist/{rsc-pipeline-AXQJCCHI.mjs → rsc-pipeline-DHYZLWSF.mjs} +5 -5
- package/dist/{runtime-DMW6DDOI.cjs → runtime-IWOT6ZVC.cjs} +7 -7
- package/dist/{runtime-JXNEKOSE.mjs → runtime-XPYKUNL3.mjs} +5 -5
- package/dist/{runtime.d-BonodRI9.d.mts → runtime.d-BA3MzhXz.d.mts} +1 -1
- package/dist/{runtime.d-nUz0HAL4.d.mts → runtime.d-CTAXWZby.d.mts} +2 -2
- package/dist/{runtime.d-uw4123iI.d.ts → runtime.d-OBIZWpx1.d.ts} +1 -1
- package/dist/{runtime.d-B_uPfMjA.d.ts → runtime.d-PUA5qBnd.d.ts} +2 -2
- package/dist/server-plugins.d.mts +5 -5
- package/dist/server-plugins.d.ts +5 -5
- package/dist/server.cjs +40 -40
- package/dist/server.d.mts +14 -14
- package/dist/server.d.ts +14 -14
- package/dist/server.mjs +22 -22
- package/dist/{spa-router.d-rha3M95y.d.mts → spa-router.d-BG2XzE5p.d.mts} +3 -3
- package/dist/{spa-router.d-l0d9pPZj.d.ts → spa-router.d-DrYT944-.d.ts} +3 -3
- package/dist/testing.cjs +6 -5
- package/dist/testing.d.mts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.mjs +6 -5
- package/dist/{types.d-wVRlLtBf.d.mts → types.d-euATAbE4.d.mts} +4 -0
- package/dist/{types.d-wVRlLtBf.d.ts → types.d-euATAbE4.d.ts} +4 -0
- package/dist/{utils.d-BzuTobEc.d.mts → utils.d-C1k9BJeD.d.mts} +1 -1
- package/dist/{utils.d-BK-PTOF8.d.ts → utils.d-DcF4wxey.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +20 -20
- package/dist/vite.d.mts +9 -7
- package/dist/vite.d.ts +9 -7
- package/dist/vite.mjs +19 -19
- package/package.json +2 -2
- package/dist/analyzer-GUIRJWZH.cjs +0 -16
|
@@ -21,16 +21,127 @@ import {
|
|
|
21
21
|
} from "./chunk-JSDV2NUN.mjs";
|
|
22
22
|
import {
|
|
23
23
|
FARM_VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-77VNYVVX.mjs";
|
|
25
25
|
|
|
26
26
|
// src/environment-vite.ts
|
|
27
27
|
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
28
28
|
import path5 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
|
|
1328
|
+
import fs5 from "fs";
|
|
1211
1329
|
import path4 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
|
}
|
|
@@ -1515,7 +1636,7 @@ function rewriteFarmPackageClientImports(options) {
|
|
|
1515
1636
|
|
|
1516
1637
|
// src/utils/package-client-boundary-cache.ts
|
|
1517
1638
|
import { AsyncLocalStorage } from "async_hooks";
|
|
1518
|
-
import
|
|
1639
|
+
import fs4 from "fs";
|
|
1519
1640
|
import path3 from "path";
|
|
1520
1641
|
var SCHEMA_VERSION = 2;
|
|
1521
1642
|
var NODE_MODULES_SEGMENT = `${path3.sep}node_modules${path3.sep}`;
|
|
@@ -1557,7 +1678,7 @@ var PackageInspectionTrace = class {
|
|
|
1557
1678
|
function stampPackagePath(target, kind) {
|
|
1558
1679
|
if (!`${target}${path3.sep}`.includes(NODE_MODULES_SEGMENT)) return void 0;
|
|
1559
1680
|
try {
|
|
1560
|
-
const stat =
|
|
1681
|
+
const stat = fs4.statSync(target, { throwIfNoEntry: false });
|
|
1561
1682
|
if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
|
|
1562
1683
|
return [target, stat.size, stat.mtimeMs, stat.ctimeMs];
|
|
1563
1684
|
} catch {
|
|
@@ -1612,11 +1733,11 @@ var PackageClientBoundaryCache = class {
|
|
|
1612
1733
|
const { file, contents } = pending;
|
|
1613
1734
|
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
1614
1735
|
try {
|
|
1615
|
-
await
|
|
1616
|
-
await
|
|
1617
|
-
await
|
|
1736
|
+
await fs4.promises.mkdir(path3.dirname(file), { recursive: true });
|
|
1737
|
+
await fs4.promises.writeFile(temporary, contents);
|
|
1738
|
+
await fs4.promises.rename(temporary, file);
|
|
1618
1739
|
} catch {
|
|
1619
|
-
await
|
|
1740
|
+
await fs4.promises.rm(temporary, { force: true }).catch(() => {
|
|
1620
1741
|
});
|
|
1621
1742
|
}
|
|
1622
1743
|
}
|
|
@@ -1627,12 +1748,12 @@ var PackageClientBoundaryCache = class {
|
|
|
1627
1748
|
const { file, contents } = pending;
|
|
1628
1749
|
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
1629
1750
|
try {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1751
|
+
fs4.mkdirSync(path3.dirname(file), { recursive: true });
|
|
1752
|
+
fs4.writeFileSync(temporary, contents);
|
|
1753
|
+
fs4.renameSync(temporary, file);
|
|
1633
1754
|
} catch {
|
|
1634
1755
|
try {
|
|
1635
|
-
|
|
1756
|
+
fs4.rmSync(temporary, { force: true });
|
|
1636
1757
|
} catch {
|
|
1637
1758
|
}
|
|
1638
1759
|
}
|
|
@@ -1703,7 +1824,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1703
1824
|
function readStoredCache(file) {
|
|
1704
1825
|
let value;
|
|
1705
1826
|
try {
|
|
1706
|
-
value = JSON.parse(
|
|
1827
|
+
value = JSON.parse(fs4.readFileSync(file, "utf8"));
|
|
1707
1828
|
} catch {
|
|
1708
1829
|
return null;
|
|
1709
1830
|
}
|
|
@@ -1768,16 +1889,46 @@ function runWithPackageClientBoundaryCacheFile(file, operation) {
|
|
|
1768
1889
|
cache2.load(file);
|
|
1769
1890
|
const result = getStorage().run(cache2, operation);
|
|
1770
1891
|
cache2.persistSync();
|
|
1892
|
+
latestDevCache = { file, cache: cache2 };
|
|
1771
1893
|
return result;
|
|
1772
1894
|
}
|
|
1895
|
+
var latestDevCache;
|
|
1896
|
+
function runWithLatestPackageClientBoundaryCache(file, operation) {
|
|
1897
|
+
if (getPackageClientBoundaryCache()) return operation();
|
|
1898
|
+
if (latestDevCache?.file !== file) {
|
|
1899
|
+
const cache2 = new PackageClientBoundaryCache();
|
|
1900
|
+
cache2.load(file);
|
|
1901
|
+
latestDevCache = { file, cache: cache2 };
|
|
1902
|
+
}
|
|
1903
|
+
return getStorage().run(latestDevCache.cache, operation);
|
|
1904
|
+
}
|
|
1905
|
+
function dropLatestPackageClientBoundaryCache() {
|
|
1906
|
+
latestDevCache = void 0;
|
|
1907
|
+
}
|
|
1773
1908
|
|
|
1774
1909
|
// src/utils/client-component.ts
|
|
1775
1910
|
function readIfExists(filePath) {
|
|
1911
|
+
if (filePath.replace(/\\/g, "/").includes(FARM_CLIENT_REFERENCE_DIRECTORY)) {
|
|
1912
|
+
return readSourceFile(filePath);
|
|
1913
|
+
}
|
|
1914
|
+
return memoizeInFarmSourceSnapshot(
|
|
1915
|
+
"source",
|
|
1916
|
+
filePath,
|
|
1917
|
+
() => readSourceFile(filePath),
|
|
1918
|
+
(content) => content !== null
|
|
1919
|
+
);
|
|
1920
|
+
}
|
|
1921
|
+
function readSourceFile(filePath) {
|
|
1922
|
+
const content = readSourceFileContents(filePath);
|
|
1923
|
+
if (content !== null) noteFarmSourceRead(filePath);
|
|
1924
|
+
return content;
|
|
1925
|
+
}
|
|
1926
|
+
function readSourceFileContents(filePath) {
|
|
1776
1927
|
try {
|
|
1777
|
-
if (!filePath || !
|
|
1928
|
+
if (!filePath || !fs5.existsSync(filePath)) {
|
|
1778
1929
|
return null;
|
|
1779
1930
|
}
|
|
1780
|
-
return
|
|
1931
|
+
return fs5.readFileSync(filePath, "utf-8");
|
|
1781
1932
|
} catch {
|
|
1782
1933
|
return null;
|
|
1783
1934
|
}
|
|
@@ -1810,7 +1961,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
1810
1961
|
candidates.add(path4.resolve(process.cwd(), normalized));
|
|
1811
1962
|
}
|
|
1812
1963
|
for (const candidate of candidates) {
|
|
1813
|
-
if (
|
|
1964
|
+
if (fs5.existsSync(candidate)) {
|
|
1814
1965
|
return candidate;
|
|
1815
1966
|
}
|
|
1816
1967
|
}
|
|
@@ -1963,6 +2114,9 @@ function skipRegularExpression(content, startIndex) {
|
|
|
1963
2114
|
var tokenizedModules = /* @__PURE__ */ new Map();
|
|
1964
2115
|
var TOKENIZED_MODULE_CACHE_SIZE = 32;
|
|
1965
2116
|
function tokenizeModuleSource(content) {
|
|
2117
|
+
return memoizeInFarmSourceSnapshot("tokens", content, () => tokenizeRecentModuleSource(content));
|
|
2118
|
+
}
|
|
2119
|
+
function tokenizeRecentModuleSource(content) {
|
|
1966
2120
|
const cached = tokenizedModules.get(content);
|
|
1967
2121
|
if (cached) return cached;
|
|
1968
2122
|
const tokens = scanModuleSourceTokens(content);
|
|
@@ -2333,7 +2487,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
2333
2487
|
return plan;
|
|
2334
2488
|
}
|
|
2335
2489
|
function usesFarmServerTree(plan) {
|
|
2336
|
-
return plan?.asyncOwnerIslands === true && plan.isolatedBoundaries.length > 0
|
|
2490
|
+
return plan?.asyncOwnerIslands === true && plan.isolatedBoundaries.length > 0;
|
|
2337
2491
|
}
|
|
2338
2492
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
2339
2493
|
const plan = {
|
|
@@ -2447,6 +2601,23 @@ function isIsolatableClientBoundarySource(content) {
|
|
|
2447
2601
|
if (/\bexport\s*\*/.test(content)) return false;
|
|
2448
2602
|
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
2603
|
}
|
|
2604
|
+
function clientModulePlanSignature(content) {
|
|
2605
|
+
if (!content || !hasUseClientDirective(content)) return null;
|
|
2606
|
+
try {
|
|
2607
|
+
return JSON.stringify([
|
|
2608
|
+
getIslandStrategyExport(content),
|
|
2609
|
+
hasHydrateExport(content),
|
|
2610
|
+
isIsolatableClientBoundarySource(content),
|
|
2611
|
+
getImportSpecifiers(content).sort()
|
|
2612
|
+
]);
|
|
2613
|
+
} catch {
|
|
2614
|
+
return null;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
function isFarmClientModulePlanUnchanged(file, previous) {
|
|
2618
|
+
const signature = clientModulePlanSignature(previous);
|
|
2619
|
+
return signature !== null && signature === clientModulePlanSignature(readSourceFileContents(file));
|
|
2620
|
+
}
|
|
2450
2621
|
function exportListNames(content) {
|
|
2451
2622
|
const names = [];
|
|
2452
2623
|
for (const match of content.matchAll(/\bexport\s*(type\s*)?\{([^}]*)\}/g)) {
|
|
@@ -2950,7 +3121,7 @@ function farmWorkspaceServerEntry(entry) {
|
|
|
2950
3121
|
}
|
|
2951
3122
|
function realpathOrSelf(file) {
|
|
2952
3123
|
try {
|
|
2953
|
-
return
|
|
3124
|
+
return fs5.realpathSync(file);
|
|
2954
3125
|
} catch {
|
|
2955
3126
|
return file;
|
|
2956
3127
|
}
|
|
@@ -2968,17 +3139,20 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
2968
3139
|
const key = `${root ?? ""}\0${resolvedPath}`;
|
|
2969
3140
|
const cached = cache2.find(key, visited);
|
|
2970
3141
|
if (cached) {
|
|
2971
|
-
for (const file of cached.files)
|
|
3142
|
+
for (const file of cached.files) {
|
|
3143
|
+
visited.add(file);
|
|
3144
|
+
noteFarmSourceRead(file);
|
|
3145
|
+
}
|
|
2972
3146
|
return { ...cached.result };
|
|
2973
3147
|
}
|
|
2974
|
-
const
|
|
2975
|
-
const result = traversePackageClientBoundary(resolvedPath, root, visited,
|
|
2976
|
-
cache2.add(key,
|
|
3148
|
+
const trace2 = new PackageInspectionTrace();
|
|
3149
|
+
const result = traversePackageClientBoundary(resolvedPath, root, visited, trace2);
|
|
3150
|
+
cache2.add(key, trace2.toEntry(result));
|
|
2977
3151
|
return result;
|
|
2978
3152
|
}
|
|
2979
|
-
function traversePackageClientBoundary(resolvedPath, root, visited,
|
|
3153
|
+
function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
2980
3154
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
2981
|
-
if (resolvedPath)
|
|
3155
|
+
if (resolvedPath) trace2?.stop(resolvedPath);
|
|
2982
3156
|
return {
|
|
2983
3157
|
isClientComponent: false,
|
|
2984
3158
|
shouldHydrate: false,
|
|
@@ -2986,7 +3160,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
|
2986
3160
|
};
|
|
2987
3161
|
}
|
|
2988
3162
|
visited.add(resolvedPath);
|
|
2989
|
-
|
|
3163
|
+
trace2?.visit(resolvedPath);
|
|
2990
3164
|
const content = readIfExists(resolvedPath);
|
|
2991
3165
|
const parsed = parseClientModuleMetadata(content, false);
|
|
2992
3166
|
let importsClientBoundary = false;
|
|
@@ -3005,7 +3179,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
|
3005
3179
|
specifier,
|
|
3006
3180
|
root
|
|
3007
3181
|
);
|
|
3008
|
-
const importedMetadata = traversePackageClientBoundary(importedPath, root, visited,
|
|
3182
|
+
const importedMetadata = traversePackageClientBoundary(importedPath, root, visited, trace2);
|
|
3009
3183
|
if (!importedMetadata.shouldHydrate) continue;
|
|
3010
3184
|
importsClientBoundary = true;
|
|
3011
3185
|
if (importedIslandStrategy === null) {
|
|
@@ -3021,8 +3195,16 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
|
3021
3195
|
islandStrategy: shouldHydrate ? parsed.islandStrategy ?? importedIslandStrategy ?? "load" : null
|
|
3022
3196
|
};
|
|
3023
3197
|
}
|
|
3024
|
-
function getImportSpecifiers(content,
|
|
3198
|
+
function getImportSpecifiers(content, options = {}) {
|
|
3025
3199
|
if (!content) return [];
|
|
3200
|
+
const specifiers = memoizeInFarmSourceSnapshot(
|
|
3201
|
+
`specifiers:${options.reexportsOnly === true}:${options.dynamic === true}`,
|
|
3202
|
+
content,
|
|
3203
|
+
() => scanImportSpecifiers(content, options)
|
|
3204
|
+
);
|
|
3205
|
+
return [...specifiers];
|
|
3206
|
+
}
|
|
3207
|
+
function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false }) {
|
|
3026
3208
|
const tokens = tokenizeModuleSource(content);
|
|
3027
3209
|
const matches = /* @__PURE__ */ new Set();
|
|
3028
3210
|
let braceDepth = 0;
|
|
@@ -3095,6 +3277,16 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
|
3095
3277
|
return true;
|
|
3096
3278
|
}
|
|
3097
3279
|
function resolveImportedModule(importerPath, specifier, root) {
|
|
3280
|
+
const resolved = memoizeInFarmSourceSnapshot(
|
|
3281
|
+
"resolution",
|
|
3282
|
+
`${root ?? ""}\0${importerPath}\0${specifier}`,
|
|
3283
|
+
() => resolveImportedModuleUncached(importerPath, specifier, root),
|
|
3284
|
+
// A file added later may resolve an import that does not resolve now.
|
|
3285
|
+
(result) => result.path !== null
|
|
3286
|
+
);
|
|
3287
|
+
return { ...resolved };
|
|
3288
|
+
}
|
|
3289
|
+
function resolveImportedModuleUncached(importerPath, specifier, root) {
|
|
3098
3290
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
3099
3291
|
return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
|
|
3100
3292
|
}
|
|
@@ -3150,7 +3342,7 @@ function matchProjectImportAlias(alias, specifier) {
|
|
|
3150
3342
|
function getProjectImportAliases(projectRoot) {
|
|
3151
3343
|
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
3152
3344
|
try {
|
|
3153
|
-
return String(
|
|
3345
|
+
return String(fs5.statSync(path4.join(projectRoot, file)).mtimeMs);
|
|
3154
3346
|
} catch {
|
|
3155
3347
|
return "-";
|
|
3156
3348
|
}
|
|
@@ -3177,7 +3369,7 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3177
3369
|
function readTsconfigPathAliases(projectRoot) {
|
|
3178
3370
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
3179
3371
|
const configPath = path4.join(projectRoot, name);
|
|
3180
|
-
if (!
|
|
3372
|
+
if (!fs5.existsSync(configPath)) continue;
|
|
3181
3373
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
3182
3374
|
if (!resolved?.paths) return [];
|
|
3183
3375
|
const base = resolved.baseUrl ?? resolved.pathsDirectory;
|
|
@@ -3240,7 +3432,7 @@ function readPackageImportAliases(projectRoot) {
|
|
|
3240
3432
|
function readJsonWithComments(filePath) {
|
|
3241
3433
|
let source;
|
|
3242
3434
|
try {
|
|
3243
|
-
source =
|
|
3435
|
+
source = fs5.readFileSync(filePath, "utf8");
|
|
3244
3436
|
} catch {
|
|
3245
3437
|
return null;
|
|
3246
3438
|
}
|
|
@@ -3326,7 +3518,7 @@ function findPackageDirectory2(importerPath, packageName, root) {
|
|
|
3326
3518
|
}
|
|
3327
3519
|
for (const searchRoot of searchRoots) {
|
|
3328
3520
|
const packageDirectory = path4.join(searchRoot, "node_modules", packageName);
|
|
3329
|
-
if (
|
|
3521
|
+
if (fs5.existsSync(path4.join(packageDirectory, "package.json"))) {
|
|
3330
3522
|
return packageDirectory;
|
|
3331
3523
|
}
|
|
3332
3524
|
}
|
|
@@ -3334,7 +3526,7 @@ function findPackageDirectory2(importerPath, packageName, root) {
|
|
|
3334
3526
|
}
|
|
3335
3527
|
function readPackageJson(packageJsonPath) {
|
|
3336
3528
|
try {
|
|
3337
|
-
return JSON.parse(
|
|
3529
|
+
return JSON.parse(fs5.readFileSync(packageJsonPath, "utf8"));
|
|
3338
3530
|
} catch {
|
|
3339
3531
|
return null;
|
|
3340
3532
|
}
|
|
@@ -3396,7 +3588,7 @@ function resolveSourceCandidate(candidates) {
|
|
|
3396
3588
|
}
|
|
3397
3589
|
for (const sourcePath of paths) {
|
|
3398
3590
|
try {
|
|
3399
|
-
if (
|
|
3591
|
+
if (fs5.statSync(sourcePath).isFile()) return sourcePath;
|
|
3400
3592
|
} catch {
|
|
3401
3593
|
}
|
|
3402
3594
|
}
|
|
@@ -3439,7 +3631,7 @@ function scanFarmPackageImports(directory, root) {
|
|
|
3439
3631
|
const walk2 = (current) => {
|
|
3440
3632
|
let entries;
|
|
3441
3633
|
try {
|
|
3442
|
-
entries =
|
|
3634
|
+
entries = fs5.readdirSync(current, { withFileTypes: true });
|
|
3443
3635
|
} catch {
|
|
3444
3636
|
return;
|
|
3445
3637
|
}
|
|
@@ -3472,7 +3664,7 @@ function collectFarmServerBundledPackageInfo(directory) {
|
|
|
3472
3664
|
const walk2 = (current) => {
|
|
3473
3665
|
let entries;
|
|
3474
3666
|
try {
|
|
3475
|
-
entries =
|
|
3667
|
+
entries = fs5.readdirSync(current, { withFileTypes: true });
|
|
3476
3668
|
} catch {
|
|
3477
3669
|
return;
|
|
3478
3670
|
}
|
|
@@ -3511,7 +3703,7 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
3511
3703
|
const walk2 = (current) => {
|
|
3512
3704
|
let entries;
|
|
3513
3705
|
try {
|
|
3514
|
-
entries =
|
|
3706
|
+
entries = fs5.readdirSync(current, { withFileTypes: true });
|
|
3515
3707
|
} catch {
|
|
3516
3708
|
return;
|
|
3517
3709
|
}
|
|
@@ -3972,6 +4164,9 @@ export {
|
|
|
3972
4164
|
createEvaluatedRouteGraph,
|
|
3973
4165
|
mergeProgrammaticClientRoutes,
|
|
3974
4166
|
generateProgrammaticClientRouteModule,
|
|
4167
|
+
FarmSourceSnapshotStore,
|
|
4168
|
+
withFarmSourceSnapshot,
|
|
4169
|
+
traceFarmSourceReads,
|
|
3975
4170
|
rewriteFarmReactServerClientModuleImports,
|
|
3976
4171
|
rewriteFarmReactServerImports,
|
|
3977
4172
|
invalidateFarmClientOnlyScan,
|
|
@@ -3987,6 +4182,8 @@ export {
|
|
|
3987
4182
|
usePackageClientBoundaryCacheFile,
|
|
3988
4183
|
resolvePackageClientBoundaryCacheFile,
|
|
3989
4184
|
runWithPackageClientBoundaryCacheFile,
|
|
4185
|
+
runWithLatestPackageClientBoundaryCache,
|
|
4186
|
+
dropLatestPackageClientBoundaryCache,
|
|
3990
4187
|
resolveModuleSourcePath,
|
|
3991
4188
|
getFarmClientHydrationPlanOptions,
|
|
3992
4189
|
describeSuppressedAsyncHydration,
|
|
@@ -4002,6 +4199,7 @@ export {
|
|
|
4002
4199
|
createMarkdownPageHydrationPlanner,
|
|
4003
4200
|
enforceFarmIsolatedHydrationRouteBudget,
|
|
4004
4201
|
isIsolatableClientBoundarySource,
|
|
4202
|
+
isFarmClientModulePlanUnchanged,
|
|
4005
4203
|
resolveImportedModule,
|
|
4006
4204
|
isFarmPackageClientBoundary,
|
|
4007
4205
|
collectFarmClientPackageImports,
|