@farm.js/core 0.1.71 → 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.
Files changed (222) hide show
  1. package/dist/agent-mcp-handler-KE4J3W7S.cjs +1 -1
  2. package/dist/agent-mcp-handler-VIT4GOSR.mjs +1 -1
  3. package/dist/{agent-mcp.d-BzNw6JI8.d.ts → agent-mcp.d-BO3rZXEM.d.ts} +2 -2
  4. package/dist/{agent-mcp.d-CgFen3EH.d.mts → agent-mcp.d-Cwff7lcA.d.mts} +2 -2
  5. package/dist/agent-runtime.d.mts +3 -3
  6. package/dist/agent-runtime.d.ts +3 -3
  7. package/dist/{analyzer-VK3BAOFI.mjs → analyzer-5Q75LTIL.mjs} +2 -2
  8. package/dist/analyzer-UJG4MIZW.cjs +16 -0
  9. package/dist/api/node.d.mts +5 -5
  10. package/dist/api/node.d.ts +5 -5
  11. package/dist/api/route-manager.cjs +7 -6
  12. package/dist/api/route-manager.d.mts +7 -7
  13. package/dist/api/route-manager.d.ts +7 -7
  14. package/dist/api/route-manager.mjs +6 -5
  15. package/dist/api/runtime.d.mts +4 -4
  16. package/dist/api/runtime.d.ts +4 -4
  17. package/dist/api.cjs +8 -7
  18. package/dist/api.d.mts +8 -8
  19. package/dist/api.d.ts +8 -8
  20. package/dist/api.mjs +7 -6
  21. package/dist/{app-manifest.d-DY4JfJxi.d.ts → app-manifest.d-DwjGkYlP.d.ts} +1 -1
  22. package/dist/{app-manifest.d-DpDK_B1k.d.mts → app-manifest.d-USD_IbFd.d.mts} +1 -1
  23. package/dist/app-markdown.d.mts +4 -4
  24. package/dist/app-markdown.d.ts +4 -4
  25. package/dist/{app.d-BeK6bb1c.d.ts → app.d-DAmF2MAk.d.ts} +48 -6
  26. package/dist/{app.d-D-5UNrFd.d.mts → app.d-fW06_h8h.d.mts} +48 -6
  27. package/dist/{chunk-7A3URI2F.mjs → chunk-2EVESLP3.mjs} +8 -1
  28. package/dist/{chunk-X7LGLF33.mjs → chunk-3JN5M3T5.mjs} +259 -61
  29. package/dist/{chunk-KEB7AGS6.cjs → chunk-3WG7GJQL.cjs} +7 -2
  30. package/dist/{chunk-K66JILV3.cjs → chunk-5LOARKDP.cjs} +2 -2
  31. package/dist/{chunk-UISZLYKY.cjs → chunk-5R4Q5FN7.cjs} +2 -2
  32. package/dist/{chunk-3BQ7QHUH.cjs → chunk-5X6OHJEE.cjs} +15 -3
  33. package/dist/{chunk-GUU3IZSM.mjs → chunk-5XFKWHZD.mjs} +234 -47
  34. package/dist/{chunk-MITIAOUQ.mjs → chunk-645ENY7W.mjs} +2 -2
  35. package/dist/{chunk-RJUCNO7R.mjs → chunk-77VNYVVX.mjs} +1 -1
  36. package/dist/{chunk-PLXD2MJV.cjs → chunk-7QCJDYZQ.cjs} +2 -2
  37. package/dist/{chunk-V25GSH43.mjs → chunk-AUAMXI6N.mjs} +1 -1
  38. package/dist/{chunk-2IFT2CSA.cjs → chunk-BE7AQXJB.cjs} +346 -148
  39. package/dist/{chunk-7BUE2GM6.mjs → chunk-BSXKZPFE.mjs} +70 -19
  40. package/dist/{chunk-2MR4MABG.cjs → chunk-C5AM2XDN.cjs} +54 -4
  41. package/dist/{chunk-KWST2O22.cjs → chunk-CBLRSZQL.cjs} +488 -301
  42. package/dist/{chunk-BBPDJGCU.cjs → chunk-CYOTNHDF.cjs} +2 -2
  43. package/dist/{chunk-W2T6NDNP.mjs → chunk-DGNMXL2O.mjs} +1 -1
  44. package/dist/{chunk-QUFENL7Q.mjs → chunk-DS7JGFW5.mjs} +13 -1
  45. package/dist/{chunk-IGXS54GC.mjs → chunk-E2V7RRFL.mjs} +1 -1
  46. package/dist/{chunk-CSQPMV3Q.cjs → chunk-E3LE6EZH.cjs} +4 -4
  47. package/dist/{chunk-JVA4PIYN.cjs → chunk-ET6WW3FY.cjs} +338 -171
  48. package/dist/{chunk-VXB5CMNC.cjs → chunk-EXN4DTVF.cjs} +2 -2
  49. package/dist/{chunk-SXMWVP2L.cjs → chunk-FSSONJRV.cjs} +4 -4
  50. package/dist/{chunk-Y2SZVIVH.cjs → chunk-GPICBTDV.cjs} +8 -1
  51. package/dist/{chunk-7OHJWFLB.cjs → chunk-HLMUWKAP.cjs} +333 -282
  52. package/dist/{chunk-ZPUAOKHV.cjs → chunk-IWCYRDRQ.cjs} +3 -3
  53. package/dist/{chunk-2AM26UGI.cjs → chunk-NLBK37HI.cjs} +5 -4
  54. package/dist/{chunk-NA77GEIU.mjs → chunk-NV26EGMC.mjs} +51 -1
  55. package/dist/{chunk-DPYBVVL3.cjs → chunk-OSEQL34Q.cjs} +2 -2
  56. package/dist/{chunk-IYDJNCR7.mjs → chunk-OSMUE5ST.mjs} +7 -2
  57. package/dist/{chunk-UQUOSNRN.mjs → chunk-QUYAGU65.mjs} +214 -47
  58. package/dist/{chunk-DPIGYXSV.mjs → chunk-RFWWXEIF.mjs} +1 -1
  59. package/dist/{chunk-E77IA5IF.mjs → chunk-RLFGKJQ6.mjs} +1 -1
  60. package/dist/{chunk-3AUINHFG.mjs → chunk-TNYC3TYP.mjs} +3 -2
  61. package/dist/{chunk-4OD2LXF2.mjs → chunk-VAWDGGW3.mjs} +1 -1
  62. package/dist/{chunk-MU5V7XHL.mjs → chunk-VJSXPN3W.mjs} +3 -0
  63. package/dist/{chunk-DU4VHHPJ.mjs → chunk-VO55MMBX.mjs} +1 -1
  64. package/dist/{chunk-LDVJIBGN.mjs → chunk-VT25ERQK.mjs} +1 -1
  65. package/dist/{chunk-2CQC5CMD.mjs → chunk-WIJF3PBM.mjs} +1 -1
  66. package/dist/{chunk-FILXOEWD.cjs → chunk-YXIQYWOK.cjs} +2 -2
  67. package/dist/{chunk-THG2TVDH.mjs → chunk-YZLEOMMA.mjs} +3 -3
  68. package/dist/{chunk-MEJCP2LX.cjs → chunk-ZDZUFD67.cjs} +1 -1
  69. package/dist/{chunk-Q5HMVGR5.cjs → chunk-ZFEJ2SF2.cjs} +13 -13
  70. package/dist/{chunk-LNVGXUL3.cjs → chunk-ZMSVKVI3.cjs} +3 -0
  71. package/dist/{client-component.d-fYupugbZ.d.ts → client-component.d-9J7CkTWW.d.ts} +2 -2
  72. package/dist/{client-component.d-DwpH251K.d.mts → client-component.d-ciHeCxr-.d.mts} +2 -2
  73. package/dist/{client-plugins.d-BxqFfHpM.d.ts → client-plugins.d-CUOhfapO.d.ts} +4 -3
  74. package/dist/{client-plugins.d-k3bOT5gz.d.mts → client-plugins.d-JnRz5a1o.d.mts} +4 -3
  75. package/dist/client-plugins.d.mts +3 -3
  76. package/dist/client-plugins.d.ts +3 -3
  77. package/dist/client.cjs +1 -1
  78. package/dist/client.d.mts +8 -8
  79. package/dist/client.d.ts +8 -8
  80. package/dist/client.mjs +1 -1
  81. package/dist/config.d.mts +3 -3
  82. package/dist/config.d.ts +3 -3
  83. package/dist/desktop.d.mts +4 -4
  84. package/dist/desktop.d.ts +4 -4
  85. package/dist/{devtools-6MXPFPNJ.mjs → devtools-7JPQMSTQ.mjs} +3 -3
  86. package/dist/{devtools-O5625KCK.cjs → devtools-IZFUYWPG.cjs} +4 -4
  87. package/dist/docs.cjs +5 -5
  88. package/dist/docs.d.mts +4 -4
  89. package/dist/docs.d.ts +4 -4
  90. package/dist/docs.mjs +4 -4
  91. package/dist/environment/vite.cjs +3 -3
  92. package/dist/environment/vite.mjs +2 -2
  93. package/dist/{headers.d-DalIGbVO.d.ts → headers.d-CqpTL_fZ.d.ts} +2 -2
  94. package/dist/{headers.d-sNT7ZQiU.d.mts → headers.d-rbbTKGaN.d.mts} +2 -2
  95. package/dist/i18n/client.cjs +3 -2
  96. package/dist/i18n/client.d.mts +2 -2
  97. package/dist/i18n/client.d.ts +2 -2
  98. package/dist/i18n/client.mjs +2 -1
  99. package/dist/i18n/index.cjs +3 -2
  100. package/dist/i18n/index.d.mts +3 -3
  101. package/dist/i18n/index.d.ts +3 -3
  102. package/dist/i18n/index.mjs +2 -1
  103. package/dist/i18n/server.cjs +6 -5
  104. package/dist/i18n/server.d.mts +5 -5
  105. package/dist/i18n/server.d.ts +5 -5
  106. package/dist/i18n/server.mjs +5 -4
  107. package/dist/index.cjs +22 -22
  108. package/dist/{index.d-BcA-secm.d.ts → index.d-CMKvzHLW.d.ts} +1 -1
  109. package/dist/{index.d-DDHHAv7j.d.mts → index.d-D_B2D9Il.d.mts} +1 -1
  110. package/dist/index.d.mts +23 -23
  111. package/dist/index.d.ts +23 -23
  112. package/dist/index.mjs +21 -21
  113. package/dist/integrations/orm.d.mts +3 -3
  114. package/dist/integrations/orm.d.ts +3 -3
  115. package/dist/integrations.d.mts +3 -3
  116. package/dist/integrations.d.ts +3 -3
  117. package/dist/internal/app-markdown-runtime.d.mts +4 -4
  118. package/dist/internal/app-markdown-runtime.d.ts +4 -4
  119. package/dist/internal/build-runtime.cjs +21 -21
  120. package/dist/internal/build-runtime.d.mts +5 -5
  121. package/dist/internal/build-runtime.d.ts +5 -5
  122. package/dist/internal/build-runtime.mjs +20 -20
  123. package/dist/internal/cli-runtime.cjs +6 -6
  124. package/dist/internal/cli-runtime.mjs +5 -5
  125. package/dist/internal/client-error-overlay.cjs +4 -4
  126. package/dist/internal/client-error-overlay.mjs +1 -1
  127. package/dist/internal/client-runtime.cjs +2 -2
  128. package/dist/internal/client-runtime.d.mts +6 -6
  129. package/dist/internal/client-runtime.d.ts +6 -6
  130. package/dist/internal/client-runtime.mjs +3 -3
  131. package/dist/internal/compression-runtime.d.mts +3 -3
  132. package/dist/internal/compression-runtime.d.ts +3 -3
  133. package/dist/internal/config-runtime.cjs +5 -5
  134. package/dist/internal/config-runtime.d.mts +6 -6
  135. package/dist/internal/config-runtime.d.ts +6 -6
  136. package/dist/internal/config-runtime.mjs +4 -4
  137. package/dist/internal/infra-analytics-runtime.cjs +7 -7
  138. package/dist/internal/infra-analytics-runtime.mjs +5 -5
  139. package/dist/internal/native-server-fns.cjs +4 -4
  140. package/dist/internal/native-server-fns.mjs +3 -3
  141. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  142. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  143. package/dist/internal/production-runtime.cjs +13 -13
  144. package/dist/internal/production-runtime.d.mts +36 -24
  145. package/dist/internal/production-runtime.d.ts +36 -24
  146. package/dist/internal/production-runtime.mjs +12 -12
  147. package/dist/internal/vercel-edge-middleware.d.mts +2 -2
  148. package/dist/internal/vercel-edge-middleware.d.ts +2 -2
  149. package/dist/markdown.d.mts +3 -3
  150. package/dist/markdown.d.ts +3 -3
  151. package/dist/middleware.cjs +3 -3
  152. package/dist/middleware.d.mts +4 -4
  153. package/dist/middleware.d.ts +4 -4
  154. package/dist/middleware.mjs +2 -2
  155. package/dist/mobile.d.mts +3 -3
  156. package/dist/mobile.d.ts +3 -3
  157. package/dist/{mount.d-D3JOux2V.d.ts → mount.d-B0XMxDRh.d.ts} +1 -1
  158. package/dist/{mount.d-C1PONsEe.d.mts → mount.d-ImEO7q8a.d.mts} +1 -1
  159. package/dist/{navigation-delegate.d-CJQQHboA.d.mts → navigation-delegate.d-83Q7ksf7.d.mts} +1 -1
  160. package/dist/{navigation-delegate.d-CQQPbdkE.d.ts → navigation-delegate.d-RRx1CSlb.d.ts} +1 -1
  161. package/dist/navigation.d.mts +6 -6
  162. package/dist/navigation.d.ts +6 -6
  163. package/dist/plugin.cjs +15 -15
  164. package/dist/plugin.d.mts +6 -6
  165. package/dist/plugin.d.ts +6 -6
  166. package/dist/plugin.mjs +14 -14
  167. package/dist/{production-runtime.d-B0IeWWyO.d.mts → production-runtime.d-Bcu37SCo.d.mts} +1 -1
  168. package/dist/{production-runtime.d-q3aHIv5Y.d.ts → production-runtime.d-qPj3XRET.d.ts} +1 -1
  169. package/dist/{render-plan.d-DHuJMJRP.d.ts → render-plan.d-Ds2sXJ5m.d.ts} +1 -1
  170. package/dist/{render-plan.d-CiUj0rq5.d.mts → render-plan.d-wP8nTeRV.d.mts} +1 -1
  171. package/dist/renderer-client.cjs +3 -2
  172. package/dist/renderer-client.d.mts +6 -6
  173. package/dist/renderer-client.d.ts +6 -6
  174. package/dist/renderer-client.mjs +2 -1
  175. package/dist/{request.d-D-F7o7tb.d.mts → request.d-F3h7K37m.d.mts} +1 -1
  176. package/dist/{request.d-DRUbOmYD.d.ts → request.d-zpSn6pu_.d.ts} +1 -1
  177. package/dist/request.d.mts +4 -4
  178. package/dist/request.d.ts +4 -4
  179. package/dist/{resolver.d-9iKC79CU.d.mts → resolver.d-DJgzbdsp.d.mts} +1 -1
  180. package/dist/{resolver.d-CY6mEa_F.d.ts → resolver.d-yaHcGCCG.d.ts} +1 -1
  181. package/dist/{route-rendering.d-KwqM_mlK.d.ts → route-rendering.d-BL0_AdKj.d.ts} +1 -1
  182. package/dist/{route-rendering.d-6smgwT2t.d.mts → route-rendering.d-Mw0ZKG2e.d.mts} +1 -1
  183. package/dist/{router.d-B6sesMRD.d.ts → router.d-BwXigemZ.d.ts} +1 -1
  184. package/dist/{router.d-BYmDeDlp.d.mts → router.d-NGVsU11T.d.mts} +1 -1
  185. package/dist/{routes.d-D3aJw1H5.d.mts → routes.d-CCccJRrp.d.mts} +1 -1
  186. package/dist/{routes.d-K-Qg79AA.d.ts → routes.d-b7khoRoU.d.ts} +1 -1
  187. package/dist/routes.d.mts +3 -3
  188. package/dist/routes.d.ts +3 -3
  189. package/dist/{routing.d-DwSUVZbF.d.mts → routing.d-BhPgtN_S.d.ts} +2 -1
  190. package/dist/{routing.d-BxOZ2YWc.d.ts → routing.d-D67HQmnv.d.mts} +2 -1
  191. package/dist/{rsc-pipeline-P4PCWDO2.cjs → rsc-pipeline-BNXYMG4G.cjs} +5 -5
  192. package/dist/{rsc-pipeline-R2GOKIMU.mjs → rsc-pipeline-DHYZLWSF.mjs} +4 -4
  193. package/dist/{runtime-WA2Q4SLG.cjs → runtime-IWOT6ZVC.cjs} +6 -6
  194. package/dist/{runtime-DP5DYGW5.mjs → runtime-XPYKUNL3.mjs} +4 -4
  195. package/dist/{runtime.d-BFSJf-ww.d.mts → runtime.d-BA3MzhXz.d.mts} +1 -1
  196. package/dist/{runtime.d-nUz0HAL4.d.mts → runtime.d-CTAXWZby.d.mts} +2 -2
  197. package/dist/{runtime.d-CbdMI0Oy.d.ts → runtime.d-OBIZWpx1.d.ts} +1 -1
  198. package/dist/{runtime.d-B_uPfMjA.d.ts → runtime.d-PUA5qBnd.d.ts} +2 -2
  199. package/dist/server-plugins.d.mts +5 -5
  200. package/dist/server-plugins.d.ts +5 -5
  201. package/dist/server.cjs +33 -33
  202. package/dist/server.d.mts +14 -14
  203. package/dist/server.d.ts +14 -14
  204. package/dist/server.mjs +17 -17
  205. package/dist/{spa-router.d-D4EDwR20.d.mts → spa-router.d-BG2XzE5p.d.mts} +3 -3
  206. package/dist/{spa-router.d-mC1D5cTN.d.ts → spa-router.d-DrYT944-.d.ts} +3 -3
  207. package/dist/testing.cjs +6 -5
  208. package/dist/testing.d.mts +3 -3
  209. package/dist/testing.d.ts +3 -3
  210. package/dist/testing.mjs +6 -5
  211. package/dist/{types.d-wVRlLtBf.d.ts → types.d-euATAbE4.d.mts} +4 -0
  212. package/dist/{types.d-wVRlLtBf.d.mts → types.d-euATAbE4.d.ts} +4 -0
  213. package/dist/{utils.d-DxMzteqE.d.mts → utils.d-C1k9BJeD.d.mts} +1 -1
  214. package/dist/{utils.d-A2X3a6z_.d.ts → utils.d-DcF4wxey.d.ts} +1 -1
  215. package/dist/version.cjs +2 -2
  216. package/dist/version.mjs +1 -1
  217. package/dist/vite.cjs +15 -15
  218. package/dist/vite.d.mts +7 -7
  219. package/dist/vite.d.ts +7 -7
  220. package/dist/vite.mjs +14 -14
  221. package/package.json +1 -1
  222. package/dist/analyzer-LPIVRSTJ.cjs +0 -16
@@ -21,16 +21,127 @@ import {
21
21
  } from "./chunk-JSDV2NUN.mjs";
22
22
  import {
23
23
  FARM_VERSION
24
- } from "./chunk-RJUCNO7R.mjs";
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 fs from "fs";
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 (fs.existsSync(path.join(directory, "package.json"))) return fs.realpathSync(directory);
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(fs.readFileSync(path.join(directory, "package.json"), "utf8"));
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 (fs.existsSync(file)) resolved = file;
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 = fs.statSync(file);
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 = fs.readFileSync(file, "utf8");
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 (fs.existsSync(file) && fs.statSync(file).isFile()) return file;
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 (fs.existsSync(file)) return file;
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(fs.readFileSync(path.join(directory, "package.json"), "utf8"));
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
- const entry = resolveFarmPackageDefaultEntry(importer, specifier);
262
- return !entry || traceFarmExport(entry, name) !== "server";
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 = fs.readdirSync(current, { withFileTypes: true });
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 = fs.readFileSync(file, "utf8");
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(fs.readFileSync(path.join(directory, "package.json"), "utf8"));
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(fs.readFileSync(path.join(directory, "package.json"), "utf8"));
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 fs4 from "fs";
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 fs2 from "fs";
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: fs2.realpathSync(candidate) };
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 fs2.realpathSync(own.from);
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 = fs2.readFileSync(file, "utf8");
1529
+ current = fs3.readFileSync(file, "utf8");
1409
1530
  } catch {
1410
1531
  }
1411
1532
  if (current !== source) {
1412
- fs2.mkdirSync(path2.dirname(file), { recursive: true });
1413
- fs2.writeFileSync(file, source);
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 = fs2.readFileSync(file, "utf8");
1541
+ current = fs3.readFileSync(file, "utf8");
1421
1542
  } catch {
1422
1543
  }
1423
1544
  if (current !== source) {
1424
- fs2.mkdirSync(path2.dirname(file), { recursive: true });
1425
- fs2.writeFileSync(file, source);
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(fs2.readFileSync(path2.join(current, "package.json"), "utf8"));
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 fs3 from "fs";
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 = fs3.statSync(target, { throwIfNoEntry: false });
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 fs3.promises.mkdir(path3.dirname(file), { recursive: true });
1616
- await fs3.promises.writeFile(temporary, contents);
1617
- await fs3.promises.rename(temporary, file);
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 fs3.promises.rm(temporary, { force: true }).catch(() => {
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
- fs3.mkdirSync(path3.dirname(file), { recursive: true });
1631
- fs3.writeFileSync(temporary, contents);
1632
- fs3.renameSync(temporary, file);
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
- fs3.rmSync(temporary, { force: true });
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(fs3.readFileSync(file, "utf8"));
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 || !fs4.existsSync(filePath)) {
1928
+ if (!filePath || !fs5.existsSync(filePath)) {
1778
1929
  return null;
1779
1930
  }
1780
- return fs4.readFileSync(filePath, "utf-8");
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 (fs4.existsSync(candidate)) {
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 && plan.isolatedBoundaries.every((boundary) => boundary.islandStrategy === "load");
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 fs4.realpathSync(file);
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) visited.add(file);
3142
+ for (const file of cached.files) {
3143
+ visited.add(file);
3144
+ noteFarmSourceRead(file);
3145
+ }
2972
3146
  return { ...cached.result };
2973
3147
  }
2974
- const trace = new PackageInspectionTrace();
2975
- const result = traversePackageClientBoundary(resolvedPath, root, visited, trace);
2976
- cache2.add(key, trace.toEntry(result));
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, trace) {
3153
+ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
2980
3154
  if (!resolvedPath || visited.has(resolvedPath)) {
2981
- if (resolvedPath) trace?.stop(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
- trace?.visit(resolvedPath);
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, trace);
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, { reexportsOnly = false, dynamic = false } = {}) {
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(fs4.statSync(path4.join(projectRoot, file)).mtimeMs);
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 (!fs4.existsSync(configPath)) continue;
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 = fs4.readFileSync(filePath, "utf8");
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 (fs4.existsSync(path4.join(packageDirectory, "package.json"))) {
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(fs4.readFileSync(packageJsonPath, "utf8"));
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 (fs4.statSync(sourcePath).isFile()) return sourcePath;
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 = fs4.readdirSync(current, { withFileTypes: true });
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 = fs4.readdirSync(current, { withFileTypes: true });
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 = fs4.readdirSync(current, { withFileTypes: true });
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,