@farm.js/core 0.2.3 → 0.2.4

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 (179) hide show
  1. package/dist/{agent-mcp.d-gI3ahrF6.d.mts → agent-mcp.d-CaJJsAVy.d.mts} +1 -1
  2. package/dist/{agent-mcp.d-DuZjglYX.d.ts → agent-mcp.d-klsG_XKS.d.ts} +1 -1
  3. package/dist/agent-runtime.d.mts +1 -1
  4. package/dist/agent-runtime.d.ts +1 -1
  5. package/dist/{analyzer-7TNBOI3J.mjs → analyzer-CY7BS4GB.mjs} +2 -2
  6. package/dist/analyzer-KHCOL6JF.cjs +17 -0
  7. package/dist/api/node.d.mts +3 -3
  8. package/dist/api/node.d.ts +3 -3
  9. package/dist/api/route-manager.d.mts +3 -3
  10. package/dist/api/route-manager.d.ts +3 -3
  11. package/dist/api/runtime.d.mts +2 -2
  12. package/dist/api/runtime.d.ts +2 -2
  13. package/dist/api.d.mts +4 -4
  14. package/dist/api.d.ts +4 -4
  15. package/dist/{app-manifest.d-bHK9EGPI.d.mts → app-manifest.d-BIdn8Whr.d.mts} +1 -1
  16. package/dist/{app-manifest.d-B3h89j6a.d.ts → app-manifest.d-DkIbmExG.d.ts} +1 -1
  17. package/dist/app-markdown.d.mts +2 -2
  18. package/dist/app-markdown.d.ts +2 -2
  19. package/dist/{app.d-C3uyET_L.d.ts → app.d-DhZ61V9X.d.ts} +8 -5
  20. package/dist/{app.d-Cr7fXGvJ.d.mts → app.d-DnqxbvCI.d.mts} +8 -5
  21. package/dist/{chunk-JJUHUPRB.cjs → chunk-6UBGXEIH.cjs} +2 -2
  22. package/dist/{chunk-TAXZQNFZ.cjs → chunk-76ES7BCO.cjs} +64 -59
  23. package/dist/{chunk-HOBCEE5J.mjs → chunk-7FNKBP3J.mjs} +185 -28
  24. package/dist/{chunk-CIRC2LRP.mjs → chunk-7IM2MKRK.mjs} +1 -1
  25. package/dist/{chunk-YPPAYYSX.cjs → chunk-7Q6KUXH6.cjs} +54 -23
  26. package/dist/{chunk-WFL7CD5C.cjs → chunk-AMSX2U4D.cjs} +304 -7
  27. package/dist/{chunk-CTHQE7DO.mjs → chunk-AOSZIHL7.mjs} +1 -1
  28. package/dist/chunk-APVJJCMB.mjs +547 -0
  29. package/dist/{chunk-IPKL7L6B.mjs → chunk-BCIUG6EQ.mjs} +2 -2
  30. package/dist/{chunk-KJMRW3IP.mjs → chunk-BUIZTM3Q.mjs} +1 -1
  31. package/dist/{chunk-GWFNJLDN.cjs → chunk-BY5VQ57W.cjs} +6 -6
  32. package/dist/{chunk-VZRY3CL5.mjs → chunk-CQ5LVPBL.mjs} +1 -1
  33. package/dist/{chunk-2FKGY2ZS.mjs → chunk-CV7C75LN.mjs} +1 -1
  34. package/dist/{chunk-RS4QZOFK.mjs → chunk-D4DAL7KK.mjs} +34 -3
  35. package/dist/{chunk-XGBDRC5B.mjs → chunk-DR65XXXD.mjs} +1 -1
  36. package/dist/{chunk-C2J5LMH6.cjs → chunk-EZRB5N6S.cjs} +1 -1
  37. package/dist/{chunk-K7RXZ77U.cjs → chunk-JEJXSTYR.cjs} +2 -2
  38. package/dist/{chunk-6QWBZGGP.cjs → chunk-JRPCCBGL.cjs} +447 -289
  39. package/dist/{chunk-A4WDDASS.cjs → chunk-KHTDVXXR.cjs} +2 -2
  40. package/dist/{chunk-XLJ2REOI.cjs → chunk-LJZZDRD5.cjs} +138 -131
  41. package/dist/{chunk-SO4USIKL.cjs → chunk-PVR63WHW.cjs} +4 -4
  42. package/dist/{chunk-H7DAFRYR.cjs → chunk-T2VXOAC3.cjs} +4 -4
  43. package/dist/{chunk-IQQ3SWH6.mjs → chunk-UIBCPZFO.mjs} +16 -9
  44. package/dist/{chunk-ERY4VYUH.mjs → chunk-XEOIZ4QC.mjs} +1 -1
  45. package/dist/{chunk-F6JSVP5C.cjs → chunk-Y7FLPQSL.cjs} +3 -3
  46. package/dist/{chunk-6YOMQ4GX.mjs → chunk-YR7ZI57S.mjs} +14 -9
  47. package/dist/{client-component.d-BavTzqsn.d.ts → client-component.d-BHE9Ns8s.d.ts} +1 -1
  48. package/dist/{client-component.d-X3j9FOZ2.d.mts → client-component.d-uya-qDZu.d.mts} +1 -1
  49. package/dist/{client-plugins.d-DnnAopKG.d.mts → client-plugins.d-CqFAvu-W.d.mts} +38 -1
  50. package/dist/{client-plugins.d-CqTr5IrQ.d.ts → client-plugins.d-Dp89a9Gf.d.ts} +38 -1
  51. package/dist/client-plugins.d.mts +1 -1
  52. package/dist/client-plugins.d.ts +1 -1
  53. package/dist/client.d.mts +7 -7
  54. package/dist/client.d.ts +7 -7
  55. package/dist/config.d.mts +1 -1
  56. package/dist/config.d.ts +1 -1
  57. package/dist/desktop.d.mts +2 -2
  58. package/dist/desktop.d.ts +2 -2
  59. package/dist/{devtools-VPFBH6I2.mjs → devtools-CRZCFRRL.mjs} +1 -1
  60. package/dist/{devtools-YTND2OWT.cjs → devtools-ZHYYPMZ3.cjs} +2 -2
  61. package/dist/docs.cjs +3 -3
  62. package/dist/docs.d.mts +3 -3
  63. package/dist/docs.d.ts +3 -3
  64. package/dist/docs.mjs +2 -2
  65. package/dist/environment/vite.cjs +3 -3
  66. package/dist/environment/vite.mjs +2 -2
  67. package/dist/{handler.d-BSlpYCDB.d.mts → handler.d-BgJGywnq.d.mts} +1 -1
  68. package/dist/{handler.d-DgX7gPO6.d.ts → handler.d-DHxaRQr7.d.ts} +1 -1
  69. package/dist/{headers.d-CmxW42R2.d.ts → headers.d-DVm2BMtR.d.ts} +1 -1
  70. package/dist/{headers.d-Cf8l5LMo.d.mts → headers.d-QrzpChrN.d.mts} +1 -1
  71. package/dist/index.cjs +13 -13
  72. package/dist/{index.d-BZZt7kxO.d.ts → index.d-B8lXhfTs.d.ts} +1 -1
  73. package/dist/{index.d-7xoJqKRZ.d.mts → index.d-Bpu1TV0-.d.mts} +1 -1
  74. package/dist/index.d.mts +22 -22
  75. package/dist/index.d.ts +22 -22
  76. package/dist/index.mjs +12 -12
  77. package/dist/integrations/orm.d.mts +1 -1
  78. package/dist/integrations/orm.d.ts +1 -1
  79. package/dist/integrations.d.mts +1 -1
  80. package/dist/integrations.d.ts +1 -1
  81. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  82. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  83. package/dist/internal/build-runtime.cjs +14 -14
  84. package/dist/internal/build-runtime.d.mts +4 -4
  85. package/dist/internal/build-runtime.d.ts +4 -4
  86. package/dist/internal/build-runtime.mjs +13 -13
  87. package/dist/internal/cli-runtime.cjs +3 -3
  88. package/dist/internal/cli-runtime.d.mts +7 -7
  89. package/dist/internal/cli-runtime.d.ts +7 -7
  90. package/dist/internal/cli-runtime.mjs +2 -2
  91. package/dist/internal/client-error-overlay.cjs +4 -4
  92. package/dist/internal/client-error-overlay.mjs +1 -1
  93. package/dist/internal/client-runtime.d.mts +5 -5
  94. package/dist/internal/client-runtime.d.ts +5 -5
  95. package/dist/internal/compression-runtime.d.mts +1 -1
  96. package/dist/internal/compression-runtime.d.ts +1 -1
  97. package/dist/internal/config-runtime.cjs +3 -3
  98. package/dist/internal/config-runtime.d.mts +3 -3
  99. package/dist/internal/config-runtime.d.ts +3 -3
  100. package/dist/internal/config-runtime.mjs +2 -2
  101. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  102. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  103. package/dist/internal/native-server-fns.cjs +4 -4
  104. package/dist/internal/native-server-fns.mjs +3 -3
  105. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  106. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  107. package/dist/internal/production-runtime.cjs +4 -4
  108. package/dist/internal/production-runtime.d.mts +10 -10
  109. package/dist/internal/production-runtime.d.ts +10 -10
  110. package/dist/internal/production-runtime.mjs +3 -3
  111. package/dist/internal/spa-router.d.mts +3 -3
  112. package/dist/internal/spa-router.d.ts +3 -3
  113. package/dist/internal/start-manifest.d.mts +1 -1
  114. package/dist/internal/start-manifest.d.ts +1 -1
  115. package/dist/markdown.d.mts +1 -1
  116. package/dist/markdown.d.ts +1 -1
  117. package/dist/middleware.d.mts +1 -1
  118. package/dist/middleware.d.ts +1 -1
  119. package/dist/{mount.d-CD-xVBu7.d.ts → mount.d-Cw_75kb9.d.ts} +1 -1
  120. package/dist/{mount.d-Dd0xeRMl.d.mts → mount.d-CyfNKOHK.d.mts} +1 -1
  121. package/dist/{navigation-delegate.d-Bses_F-y.d.ts → navigation-delegate.d--imR0rY7.d.ts} +1 -1
  122. package/dist/{navigation-delegate.d-dBNg976E.d.mts → navigation-delegate.d-DVEtyGYw.d.mts} +1 -1
  123. package/dist/navigation.d.mts +4 -4
  124. package/dist/navigation.d.ts +4 -4
  125. package/dist/plugin.cjs +9 -9
  126. package/dist/plugin.d.mts +5 -5
  127. package/dist/plugin.d.ts +5 -5
  128. package/dist/plugin.mjs +8 -8
  129. package/dist/{render-plan.d-vOdZHHLI.d.mts → render-plan.d-CTehM6y8.d.mts} +1 -1
  130. package/dist/{render-plan.d-DaIwnRK2.d.ts → render-plan.d-DpxLd_1i.d.ts} +1 -1
  131. package/dist/renderer-client.d.mts +5 -5
  132. package/dist/renderer-client.d.ts +5 -5
  133. package/dist/{request.d-CgXp3EEc.d.ts → request.d-BFXzOr32.d.ts} +1 -1
  134. package/dist/{request.d-B8U4pVFP.d.mts → request.d-BmQzlKtT.d.mts} +1 -1
  135. package/dist/request.d.mts +2 -2
  136. package/dist/request.d.ts +2 -2
  137. package/dist/{route-rendering.d-Di0AxFix.d.ts → route-rendering.d-bEil1VkF.d.ts} +1 -1
  138. package/dist/{route-rendering.d-BQvNYQqu.d.mts → route-rendering.d-geg68qd0.d.mts} +1 -1
  139. package/dist/{router.d-BJVGhSAJ.d.ts → router.d-4OCT2ak5.d.ts} +1 -1
  140. package/dist/{router.d-hNedVdoB.d.mts → router.d-CQjEcNih.d.mts} +1 -1
  141. package/dist/routes.d.mts +1 -1
  142. package/dist/routes.d.ts +1 -1
  143. package/dist/{rsc-pipeline-2JSNRVIL.mjs → rsc-pipeline-JISGZS6G.mjs} +2 -2
  144. package/dist/{rsc-pipeline-WTKDMTE2.cjs → rsc-pipeline-R5W3PAAL.cjs} +3 -3
  145. package/dist/{runtime-I4GV4CDP.cjs → runtime-HSTND4FF.cjs} +4 -4
  146. package/dist/{runtime-RNSTQY27.mjs → runtime-I2SBIB2Q.mjs} +2 -2
  147. package/dist/{runtime.d-0R8nHCM6.d.ts → runtime.d-BKoa6J55.d.ts} +1 -1
  148. package/dist/{runtime.d-DpeuF_T-.d.mts → runtime.d-DjYo5E1n.d.mts} +1 -1
  149. package/dist/{schema-dependencies.d-_Wyey4Wv.d.mts → schema-dependencies.d-CGNgsyKS.d.mts} +1 -1
  150. package/dist/{schema-dependencies.d-tkUHREqz.d.ts → schema-dependencies.d-CRoN2Q9N.d.ts} +1 -1
  151. package/dist/{server-components-status.d-sN7ju-ie.d.mts → server-components-status.d-Crl3IonP.d.mts} +1 -1
  152. package/dist/{server-components-status.d-B2Z5WvO5.d.ts → server-components-status.d-CwfcQD6n.d.ts} +1 -1
  153. package/dist/server-plugins.d.mts +3 -3
  154. package/dist/server-plugins.d.ts +3 -3
  155. package/dist/server.cjs +30 -30
  156. package/dist/server.d.mts +11 -11
  157. package/dist/server.d.ts +11 -11
  158. package/dist/server.mjs +10 -10
  159. package/dist/{spa-router.d-MjT6sGb9.d.ts → spa-router.d-Bv-r3AAK.d.ts} +2 -2
  160. package/dist/{spa-router.d-D3AtR2Bc.d.mts → spa-router.d-DhO_PJHP.d.mts} +2 -2
  161. package/dist/{ssg.d-C1SNuPz5.d.ts → ssg.d-CzFOAkqy.d.mts} +13 -2
  162. package/dist/{ssg.d-B32Cp_XW.d.mts → ssg.d-SfEQfMsA.d.ts} +13 -2
  163. package/dist/{store-core.d-BZ3YXs70.d.ts → store-core.d-Ch0N8dni.d.ts} +2 -2
  164. package/dist/{store-core.d-BbVdaoA0.d.mts → store-core.d-pKJCUdTR.d.mts} +2 -2
  165. package/dist/testing.d.mts +1 -1
  166. package/dist/testing.d.ts +1 -1
  167. package/dist/{utils.d-Bjbm44fP.d.ts → utils.d-BaLODLrK.d.ts} +1 -1
  168. package/dist/{utils.d-CoLozp7-.d.mts → utils.d-TPjb_Q7w.d.mts} +1 -1
  169. package/dist/version.cjs +2 -2
  170. package/dist/version.mjs +1 -1
  171. package/dist/vite.cjs +9 -9
  172. package/dist/vite.d.mts +6 -6
  173. package/dist/vite.d.ts +6 -6
  174. package/dist/vite.mjs +8 -8
  175. package/package.json +2 -2
  176. package/dist/analyzer-5RSMYPWD.cjs +0 -17
  177. package/dist/chunk-4WCEWA22.mjs +0 -251
  178. /package/dist/{chunk-MVNIAD6O.mjs → chunk-3QC2XTCN.mjs} +0 -0
  179. /package/dist/{chunk-2LGM5WIK.cjs → chunk-GDKJGL7D.cjs} +0 -0
@@ -3,7 +3,7 @@
3
3
  var _chunkYV47TSSBcjs = require('./chunk-YV47TSSB.cjs');
4
4
 
5
5
 
6
- var _chunk2LGM5WIKcjs = require('./chunk-2LGM5WIK.cjs');
6
+ var _chunkGDKJGL7Dcjs = require('./chunk-GDKJGL7D.cjs');
7
7
 
8
8
 
9
9
 
@@ -32,6 +32,295 @@ _chunkUGL4BDNBcjs.init_define_import_meta.call(void 0, );
32
32
  var _fs = require('fs');
33
33
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
34
34
  var _url = require('url');
35
+
36
+ // src/package-imports.ts
37
+ _chunkUGL4BDNBcjs.init_define_import_meta.call(void 0, );
38
+
39
+
40
+ var FARM_OPTIMIZED_PACKAGE_IMPORTS = [
41
+ "lucide-react",
42
+ "date-fns",
43
+ "lodash-es",
44
+ "ramda",
45
+ "antd",
46
+ "react-bootstrap",
47
+ "ahooks",
48
+ "@ant-design/icons",
49
+ "@headlessui/react",
50
+ "@headlessui-float/react",
51
+ "@heroicons/react/20/solid",
52
+ "@heroicons/react/24/solid",
53
+ "@heroicons/react/24/outline",
54
+ "@visx/visx",
55
+ "@tremor/react",
56
+ "rxjs",
57
+ "@mui/material",
58
+ "@mui/icons-material",
59
+ "recharts",
60
+ "react-use",
61
+ "effect",
62
+ "@effect/schema",
63
+ "@effect/platform",
64
+ "@effect/platform-node",
65
+ "@effect/platform-browser",
66
+ "@effect/platform-bun",
67
+ "@effect/sql",
68
+ "@effect/rpc",
69
+ "@effect/typeclass",
70
+ "@effect/experimental",
71
+ "@effect/opentelemetry",
72
+ "@material-ui/core",
73
+ "@material-ui/icons",
74
+ "@tabler/icons-react",
75
+ "mui-core",
76
+ ...[
77
+ "ai",
78
+ "bi",
79
+ "bs",
80
+ "cg",
81
+ "ci",
82
+ "di",
83
+ "fa",
84
+ "fa6",
85
+ "fc",
86
+ "fi",
87
+ "gi",
88
+ "go",
89
+ "gr",
90
+ "hi",
91
+ "hi2",
92
+ "im",
93
+ "io",
94
+ "io5",
95
+ "lia",
96
+ "lib",
97
+ "lu",
98
+ "md",
99
+ "pi",
100
+ "ri",
101
+ "rx",
102
+ "si",
103
+ "sl",
104
+ "tb",
105
+ "tfi",
106
+ "ti",
107
+ "vsc",
108
+ "wi"
109
+ ].map((set) => `react-icons/${set}`)
110
+ ];
111
+ var AMBIGUOUS_CONDITIONS = /* @__PURE__ */ new Set([
112
+ "node",
113
+ "browser",
114
+ "react-server",
115
+ "react-native",
116
+ "workerd",
117
+ "worker",
118
+ "edge-light",
119
+ "deno",
120
+ "bun"
121
+ ]);
122
+ var ENTRY_CONDITIONS = /* @__PURE__ */ new Set(["module", "import", "default"]);
123
+ var RESOLVE_EXTENSIONS = [".mjs", ".js", ".cjs"];
124
+ function pickEntry(value) {
125
+ if (typeof value === "string") return value;
126
+ if (Array.isArray(value)) return pickEntry(value[0]);
127
+ if (!value || typeof value !== "object") return void 0;
128
+ for (const [key, target] of Object.entries(value)) {
129
+ if (ENTRY_CONDITIONS.has(key)) return pickEntry(target);
130
+ if (AMBIGUOUS_CONDITIONS.has(key)) return null;
131
+ }
132
+ return void 0;
133
+ }
134
+ function resolveFarmPackageEntry(packageDir, manifest) {
135
+ let entry;
136
+ const { exports } = manifest;
137
+ if (exports !== void 0) {
138
+ const isSubpathMap = exports && typeof exports === "object" && !Array.isArray(exports) && Object.keys(exports).every((key) => key.startsWith("."));
139
+ entry = pickEntry(isSubpathMap ? exports["."] : exports);
140
+ }
141
+ if (entry === null) return null;
142
+ if (entry === void 0) {
143
+ entry = typeof manifest.module === "string" ? manifest.module : typeof manifest.main === "string" ? manifest.main : void 0;
144
+ }
145
+ if (!entry) return null;
146
+ const file = resolveRelative(_path2.default.resolve(packageDir, entry));
147
+ if (!file) return null;
148
+ const esm = file.endsWith(".mjs") || file.endsWith(".js") && (manifest.type === "module" || typeof manifest.module === "string");
149
+ return esm ? file : null;
150
+ }
151
+ function resolveRelative(target) {
152
+ const candidates = [
153
+ target,
154
+ ...RESOLVE_EXTENSIONS.map((ext) => target + ext),
155
+ ...RESOLVE_EXTENSIONS.map((ext) => _path2.default.join(target, `index${ext}`))
156
+ ];
157
+ for (const candidate of candidates) {
158
+ try {
159
+ if (_fs.statSync.call(void 0, candidate).isFile()) return candidate;
160
+ } catch (e) {
161
+ }
162
+ }
163
+ return null;
164
+ }
165
+ var stripComments = (code) => code.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^[ \t]*\/\/.*$/gm, "");
166
+ var IMPORT_RE = /\bimport\s+(?:(\*\s+as\s+(\w+))|(\w+)|\{([^}]*)\})?\s*(?:,\s*\{([^}]*)\})?\s*from\s*["']([^"']+)["']/g;
167
+ var EXPORT_FROM_RE = /\bexport\s+(?:(\*)(?:\s+as\s+(\w+))?|\{([^}]*)\})\s*from\s*["']([^"']+)["']/g;
168
+ var EXPORT_LOCAL_RE = /\bexport\s+\{([^}]*)\}\s*(?!from)/g;
169
+ var MODULE_DIRECTIVE_RE = /^\s*(["'])use (?:client|server)\1/;
170
+ var EXPORT_DECLARATION_RE = /\bexport\s+(?:default\b|(?:async\s+)?function\b|class\b|const\b|let\b|var\b|enum\b)/;
171
+ function specifiers(list) {
172
+ return list.split(",").map((s) => s.trim()).filter((s) => s && !s.startsWith("type ")).map((s) => {
173
+ const [imported, local] = s.split(/\s+as\s+/).map((p) => p.trim());
174
+ return { imported, local: _nullishCoalesce(local, () => ( imported)) };
175
+ });
176
+ }
177
+ function readFarmBarrel(file, depth = 0, seen = /* @__PURE__ */ new Set()) {
178
+ const map = /* @__PURE__ */ new Map();
179
+ let pure = true;
180
+ let directive = false;
181
+ if (seen.has(file) || depth > 4) return { map, pure, directive };
182
+ seen.add(file);
183
+ let code;
184
+ try {
185
+ code = stripComments(_fs.readFileSync.call(void 0, file, "utf8"));
186
+ } catch (e2) {
187
+ return { map, pure: false, directive };
188
+ }
189
+ if (MODULE_DIRECTIVE_RE.test(code)) directive = true;
190
+ const dir = _path2.default.dirname(file);
191
+ const resolve = (spec) => spec.startsWith(".") ? resolveRelative(_path2.default.resolve(dir, spec)) : null;
192
+ const locals = /* @__PURE__ */ new Map();
193
+ for (const m of code.matchAll(IMPORT_RE)) {
194
+ const target = resolve(m[6]);
195
+ if (!target) continue;
196
+ if (m[2]) locals.set(m[2], { file: target, name: "*" });
197
+ if (m[3]) locals.set(m[3], { file: target, name: "default" });
198
+ for (const list of [m[4], m[5]]) {
199
+ if (list)
200
+ for (const s of specifiers(list)) locals.set(s.local, { file: target, name: s.imported });
201
+ }
202
+ }
203
+ for (const m of code.matchAll(EXPORT_FROM_RE)) {
204
+ const target = resolve(m[4]);
205
+ if (!target) {
206
+ pure = false;
207
+ continue;
208
+ }
209
+ if (m[1] && m[2]) {
210
+ map.set(m[2], { file: target, name: "*" });
211
+ } else if (m[1]) {
212
+ const nested = readFarmBarrel(target, depth + 1, seen);
213
+ if (!nested.pure) pure = false;
214
+ if (nested.directive) directive = true;
215
+ for (const [name, binding] of nested.map) if (!map.has(name)) map.set(name, binding);
216
+ } else {
217
+ for (const s of specifiers(m[3])) map.set(s.local, { file: target, name: s.imported });
218
+ }
219
+ }
220
+ for (const m of code.matchAll(EXPORT_LOCAL_RE)) {
221
+ for (const s of specifiers(m[1])) {
222
+ const binding = locals.get(s.imported);
223
+ if (binding) map.set(s.local, binding);
224
+ else pure = false;
225
+ }
226
+ }
227
+ if (EXPORT_DECLARATION_RE.test(code)) pure = false;
228
+ return { map, pure, directive };
229
+ }
230
+ function findPackageDir(root, packageName) {
231
+ for (let dir = _path2.default.resolve(root); ; dir = _path2.default.dirname(dir)) {
232
+ const candidate = _path2.default.join(dir, "node_modules", packageName);
233
+ if (_fs.existsSync.call(void 0, _path2.default.join(candidate, "package.json"))) return _fs.realpathSync.call(void 0, candidate);
234
+ if (_path2.default.dirname(dir) === dir) return void 0;
235
+ }
236
+ }
237
+ function readFarmPackageBarrel(root, packageName) {
238
+ const dir = findPackageDir(root, packageName);
239
+ if (!dir) return null;
240
+ let manifest;
241
+ try {
242
+ manifest = JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(dir, "package.json"), "utf8"));
243
+ } catch (e3) {
244
+ return null;
245
+ }
246
+ const entry = resolveFarmPackageEntry(dir, manifest);
247
+ if (!entry) return null;
248
+ const { map, pure, directive } = readFarmBarrel(entry);
249
+ if (map.size === 0 || directive) return null;
250
+ if (!pure && manifest.sideEffects !== false) return null;
251
+ return map;
252
+ }
253
+ var NAMED_IMPORT_RE = /\bimport\s*\{([^}]*)\}\s*from\s*(["'])([^"']+)\2\s*;?/g;
254
+ var toImportPath = (file) => file.split(_path2.default.sep).join("/");
255
+ function importStatement(binding, local) {
256
+ const from = JSON.stringify(toImportPath(binding.file));
257
+ if (binding.name === "default") return `import ${local} from ${from};`;
258
+ if (binding.name === "*") return `import * as ${local} from ${from};`;
259
+ return `import { ${binding.name === local ? local : `${binding.name} as ${local}`} } from ${from};`;
260
+ }
261
+ function rewriteFarmPackageImports(code, packages, barrel) {
262
+ let changed = false;
263
+ const out = code.replace(
264
+ NAMED_IMPORT_RE,
265
+ (statement, list, _quote, specifier) => {
266
+ if (!packages.has(specifier)) return statement;
267
+ const map = barrel(specifier);
268
+ if (!map) return statement;
269
+ const kept = [];
270
+ const deep = [];
271
+ for (const s of specifiers(list)) {
272
+ const binding = map.get(s.imported);
273
+ if (binding) deep.push(importStatement(binding, s.local));
274
+ else kept.push(s.imported === s.local ? s.imported : `${s.imported} as ${s.local}`);
275
+ }
276
+ if (deep.length === 0) return statement;
277
+ changed = true;
278
+ return [
279
+ ...deep,
280
+ ...kept.length ? [`import { ${kept.join(", ")} } from ${JSON.stringify(specifier)};`] : []
281
+ ].join(" ");
282
+ }
283
+ );
284
+ return changed ? out : null;
285
+ }
286
+ function resolveFarmOptimizedPackageImports(option) {
287
+ if (option === false) return /* @__PURE__ */ new Set();
288
+ return /* @__PURE__ */ new Set([...FARM_OPTIMIZED_PACKAGE_IMPORTS, ..._nullishCoalesce(option, () => ( []))]);
289
+ }
290
+ var SOURCE_RE = /\.(?:[cm]?[jt]sx?)$/;
291
+ function farmPackageImportsPlugin(options) {
292
+ const barrels = /* @__PURE__ */ new Map();
293
+ const barrel = (packageName) => {
294
+ let entry = barrels.get(packageName);
295
+ if (entry === void 0) {
296
+ entry = readFarmPackageBarrel(options.root, packageName);
297
+ barrels.set(packageName, entry);
298
+ }
299
+ return entry;
300
+ };
301
+ return {
302
+ name: "farm:package-imports",
303
+ transform(code, id) {
304
+ if (options.packages.size === 0) return;
305
+ if (_optionalChain([this, 'access', _ => _.environment, 'optionalAccess', _2 => _2.name]) === "client") return;
306
+ const file = id.split("?")[0];
307
+ if (file.includes("/node_modules/") || !SOURCE_RE.test(file)) return;
308
+ if (!code.includes("import")) return;
309
+ let mentions = false;
310
+ for (const name of options.packages) {
311
+ if (code.includes(name)) {
312
+ mentions = true;
313
+ break;
314
+ }
315
+ }
316
+ if (!mentions) return;
317
+ const rewritten = rewriteFarmPackageImports(code, options.packages, barrel);
318
+ return rewritten === null ? void 0 : { code: rewritten, map: null };
319
+ }
320
+ };
321
+ }
322
+
323
+ // src/rsc-pipeline.ts
35
324
  var FARM_RSC_ENTRIES = {
36
325
  rsc: "./.farm/rsc-entries/entry.rsc.tsx",
37
326
  ssr: "./.farm/rsc-entries/entry.ssr.tsx",
@@ -82,7 +371,7 @@ async function importFromApp(root, packageName, subpath = ".") {
82
371
  }
83
372
  function hasPluginNamed(plugins, prefix) {
84
373
  if (Array.isArray(plugins)) return plugins.some((plugin) => hasPluginNamed(plugin, prefix));
85
- const name = _optionalChain([plugins, 'optionalAccess', _ => _.name]);
374
+ const name = _optionalChain([plugins, 'optionalAccess', _3 => _3.name]);
86
375
  return typeof name === "string" && name.startsWith(prefix);
87
376
  }
88
377
  async function createFarmRscViteConfig(userConfig, options) {
@@ -112,8 +401,8 @@ async function createFarmRscViteConfig(userConfig, options) {
112
401
  {
113
402
  ...userConfig,
114
403
  vite: typeof userConfig.vite === "function" ? userConfig.vite({}) : userConfig.vite,
115
- plugins: _nullishCoalesce(_optionalChain([layered, 'optionalAccess', _2 => _2.plugins]), () => ( [])),
116
- publicRuntimeConfig: _nullishCoalesce(_optionalChain([layered, 'optionalAccess', _3 => _3.publicRuntimeConfig]), () => ( {}))
404
+ plugins: _nullishCoalesce(_optionalChain([layered, 'optionalAccess', _4 => _4.plugins]), () => ( [])),
405
+ publicRuntimeConfig: _nullishCoalesce(_optionalChain([layered, 'optionalAccess', _5 => _5.publicRuntimeConfig]), () => ( {}))
117
406
  },
118
407
  options.command
119
408
  );
@@ -126,7 +415,7 @@ async function createFarmRscViteConfig(userConfig, options) {
126
415
  for (const key of FARM_RSC_CONFIG_KEYS) {
127
416
  if (config[key] !== void 0) rscConfig[key] = config[key];
128
417
  }
129
- const createReactPlugin = hasPluginNamed(vitePlugins, "vite:react") ? void 0 : await _asyncNullishCoalesce(await _asyncOptionalChain([viteReact, 'optionalAccess', async _4 => _4.default]), async () => ( (options.command === "serve" ? (await _chunk5RYBQKBYcjs.loadFarmReactPlugin.call(void 0, )).default : void 0)));
418
+ const createReactPlugin = hasPluginNamed(vitePlugins, "vite:react") ? void 0 : await _asyncNullishCoalesce(await _asyncOptionalChain([viteReact, 'optionalAccess', async _6 => _6.default]), async () => ( (options.command === "serve" ? (await _chunk5RYBQKBYcjs.loadFarmReactPlugin.call(void 0, )).default : void 0)));
130
419
  const tailwind = hasPluginNamed(vitePlugins, "@tailwindcss/vite") ? void 0 : await _chunkWAQIO2VDcjs.loadTailwindVitePlugin.call(void 0, );
131
420
  const platform = _chunk5B2Y4EVScjs.resolveFarmPlatform.call(void 0, );
132
421
  const mobileClient = config.mobile === void 0 || platform === "desktop" ? void 0 : options.command === "build" ? "entry" : platform === "mobile" ? "inline" : void 0;
@@ -152,7 +441,7 @@ async function createFarmRscViteConfig(userConfig, options) {
152
441
  ...serverPlugins ? { serverPlugins } : {},
153
442
  ...options.preset ? { preset: options.preset } : {},
154
443
  experimental: { ...config.experimental, serverComponents: { mode: "rsc" } },
155
- port: _nullishCoalesce(options.port, () => ( _optionalChain([config, 'access', _5 => _5.server, 'optionalAccess', _6 => _6.port]))),
444
+ port: _nullishCoalesce(options.port, () => ( _optionalChain([config, 'access', _7 => _7.server, 'optionalAccess', _8 => _8.port]))),
156
445
  plugins: [
157
446
  ...options.command === "serve" && platform === "desktop" ? [
158
447
  _chunk5RYBQKBYcjs.farmDesktopDevGuardPlugin.call(void 0,
@@ -160,6 +449,14 @@ async function createFarmRscViteConfig(userConfig, options) {
160
449
  )
161
450
  ] : [],
162
451
  ...tailwind ? [tailwind] : [],
452
+ // Before the RSC plugin reads an app module. Only this pipeline has it: plugin-rsc runs every
453
+ // package that depends on React through Vite, so the deep module is the one the barrel would
454
+ // have loaded. Farm's own pipeline lets Node load such packages (lucide-react's `node`
455
+ // condition is CommonJS), where a deep ES module import would load a second copy.
456
+ farmPackageImportsPlugin({
457
+ root,
458
+ packages: resolveFarmOptimizedPackageImports(_optionalChain([config, 'access', _9 => _9.experimental, 'optionalAccess', _10 => _10.optimizePackageImports]))
459
+ }),
163
460
  ...vitePlugins,
164
461
  viteRsc.default({ serverHandler: false, entries: FARM_RSC_ENTRIES }),
165
462
  ...typeof createReactPlugin === "function" ? [createReactPlugin()] : [],
@@ -167,7 +464,7 @@ async function createFarmRscViteConfig(userConfig, options) {
167
464
  server: { environmentName: "rsc" },
168
465
  config: {
169
466
  preset: options.preset,
170
- outputDir: options.outputDir && _chunk2LGM5WIKcjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
467
+ outputDir: options.outputDir && _chunkGDKJGL7Dcjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
171
468
  }
172
469
  })
173
470
  ]
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FARM_VERSION
3
- } from "./chunk-2FKGY2ZS.mjs";
3
+ } from "./chunk-CV7C75LN.mjs";
4
4
 
5
5
  // src/deployment-environment.ts
6
6
  function isFarmProductionDeploymentEnvironment(env = process.env) {