@farm.js/core 0.2.2 → 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.
- package/dist/{agent-mcp.d-gI3ahrF6.d.mts → agent-mcp.d-CaJJsAVy.d.mts} +1 -1
- package/dist/{agent-mcp.d-DuZjglYX.d.ts → agent-mcp.d-klsG_XKS.d.ts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/{analyzer-UXWYUTBK.mjs → analyzer-CY7BS4GB.mjs} +2 -2
- package/dist/analyzer-KHCOL6JF.cjs +17 -0
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- package/dist/api/route-manager.cjs +4 -4
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +5 -5
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/api.mjs +4 -4
- package/dist/{app-manifest.d-bHK9EGPI.d.mts → app-manifest.d-BIdn8Whr.d.mts} +1 -1
- package/dist/{app-manifest.d-B3h89j6a.d.ts → app-manifest.d-DkIbmExG.d.ts} +1 -1
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/{app.d-C3uyET_L.d.ts → app.d-DhZ61V9X.d.ts} +8 -5
- package/dist/{app.d-Cr7fXGvJ.d.mts → app.d-DnqxbvCI.d.mts} +8 -5
- package/dist/{chunk-YOVSWY2E.mjs → chunk-2XDRRAAD.mjs} +1 -1
- package/dist/{chunk-2T4GGCQT.cjs → chunk-6UBGXEIH.cjs} +2 -2
- package/dist/{chunk-BEAQVRMQ.cjs → chunk-76ES7BCO.cjs} +80 -75
- package/dist/{chunk-TK2JJCP5.mjs → chunk-7FNKBP3J.mjs} +186 -29
- package/dist/{chunk-ST3U7XVO.mjs → chunk-7IM2MKRK.mjs} +1 -1
- package/dist/{chunk-GL4SPJTE.cjs → chunk-7Q6KUXH6.cjs} +58 -27
- package/dist/{chunk-5CG2UD6B.cjs → chunk-AMSX2U4D.cjs} +304 -7
- package/dist/{chunk-NPR6SCEV.mjs → chunk-AOSZIHL7.mjs} +1 -1
- package/dist/chunk-APVJJCMB.mjs +547 -0
- package/dist/{chunk-LQZXCSYG.mjs → chunk-B6K2ZM3C.mjs} +5 -3
- package/dist/{chunk-IEXZMDF4.mjs → chunk-BCIUG6EQ.mjs} +2 -2
- package/dist/{chunk-JCERO6YF.mjs → chunk-BUIZTM3Q.mjs} +1 -1
- package/dist/{chunk-SJQ24IB5.cjs → chunk-BY5VQ57W.cjs} +11 -11
- package/dist/{chunk-GKDOKES3.mjs → chunk-CQ5LVPBL.mjs} +1 -1
- package/dist/{chunk-Q4FHYBFT.cjs → chunk-CSCORWIQ.cjs} +11 -11
- package/dist/{chunk-6VMBLDWY.mjs → chunk-CV7C75LN.mjs} +1 -1
- package/dist/{chunk-CZMMU3FP.mjs → chunk-D4DAL7KK.mjs} +35 -4
- package/dist/{chunk-ZVT2F3JU.mjs → chunk-DR65XXXD.mjs} +2 -2
- package/dist/{chunk-PRKFECGT.cjs → chunk-DZWX7FDX.cjs} +6 -4
- package/dist/{chunk-A4AYTO2E.cjs → chunk-EZRB5N6S.cjs} +1 -1
- package/dist/{chunk-B7CZ7T2I.cjs → chunk-JEJXSTYR.cjs} +2 -2
- package/dist/{chunk-56F4CDKE.cjs → chunk-JRPCCBGL.cjs} +449 -291
- package/dist/{chunk-JM5VSEYC.cjs → chunk-KHTDVXXR.cjs} +2 -2
- package/dist/{chunk-PYPHM7AS.cjs → chunk-LH7S7FI3.cjs} +5 -1
- package/dist/{chunk-ZND5D4IC.cjs → chunk-LJZZDRD5.cjs} +363 -326
- package/dist/{chunk-WXPY5FRF.cjs → chunk-P2PF5FUW.cjs} +2 -2
- package/dist/{chunk-CPL7WIMP.mjs → chunk-P3UT3OLV.mjs} +2 -2
- package/dist/{chunk-PZ5ZJAAO.mjs → chunk-POCWXRXW.mjs} +1 -1
- package/dist/{chunk-L7Z6OAE2.cjs → chunk-PVR63WHW.cjs} +4 -4
- package/dist/{chunk-Z23OCU33.cjs → chunk-RF3VCNV7.cjs} +6 -6
- package/dist/{chunk-5AOARZJT.cjs → chunk-T2VXOAC3.cjs} +4 -4
- package/dist/{chunk-FEWGKBMM.mjs → chunk-UIBCPZFO.mjs} +85 -48
- package/dist/{chunk-MYJPW4XN.mjs → chunk-UKGAP2OK.mjs} +3 -3
- package/dist/{chunk-DZXD6CYJ.mjs → chunk-V2RXBDV6.mjs} +4 -0
- package/dist/{chunk-ALGAGXWB.mjs → chunk-XEOIZ4QC.mjs} +1 -1
- package/dist/{chunk-D2VLHRBN.cjs → chunk-Y3MTKPLN.cjs} +4 -4
- package/dist/{chunk-FDS6U2NT.cjs → chunk-Y7FLPQSL.cjs} +3 -3
- package/dist/{chunk-MEXGQE4T.mjs → chunk-YR7ZI57S.mjs} +17 -12
- package/dist/{client-component.d-BavTzqsn.d.ts → client-component.d-BHE9Ns8s.d.ts} +1 -1
- package/dist/{client-component.d-X3j9FOZ2.d.mts → client-component.d-uya-qDZu.d.mts} +1 -1
- package/dist/{client-plugins.d-DnnAopKG.d.mts → client-plugins.d-CqFAvu-W.d.mts} +38 -1
- package/dist/{client-plugins.d-CqTr5IrQ.d.ts → client-plugins.d-Dp89a9Gf.d.ts} +38 -1
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-RFVGDHXH.mjs → devtools-CRZCFRRL.mjs} +1 -1
- package/dist/{devtools-4LMM3DDJ.cjs → devtools-ZHYYPMZ3.cjs} +2 -2
- package/dist/docs.cjs +3 -3
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +2 -2
- package/dist/environment/vite.cjs +4 -4
- package/dist/environment/vite.mjs +3 -3
- package/dist/{handler.d-BSlpYCDB.d.mts → handler.d-BgJGywnq.d.mts} +1 -1
- package/dist/{handler.d-DgX7gPO6.d.ts → handler.d-DHxaRQr7.d.ts} +1 -1
- package/dist/{headers.d-CmxW42R2.d.ts → headers.d-DVm2BMtR.d.ts} +1 -1
- package/dist/{headers.d-Cf8l5LMo.d.mts → headers.d-QrzpChrN.d.mts} +1 -1
- package/dist/index.cjs +19 -19
- package/dist/{index.d-BZZt7kxO.d.ts → index.d-B8lXhfTs.d.ts} +1 -1
- package/dist/{index.d-7xoJqKRZ.d.mts → index.d-Bpu1TV0-.d.mts} +1 -1
- package/dist/index.d.mts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.mjs +18 -18
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +18 -18
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +17 -17
- package/dist/internal/cli-runtime.cjs +7 -7
- package/dist/internal/cli-runtime.d.mts +7 -7
- package/dist/internal/cli-runtime.d.ts +7 -7
- package/dist/internal/cli-runtime.mjs +6 -6
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +3 -3
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- 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 +4 -4
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +3 -3
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/start-manifest.d.mts +1 -1
- package/dist/internal/start-manifest.d.ts +1 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/{mount.d-CD-xVBu7.d.ts → mount.d-Cw_75kb9.d.ts} +1 -1
- package/dist/{mount.d-Dd0xeRMl.d.mts → mount.d-CyfNKOHK.d.mts} +1 -1
- package/dist/{navigation-delegate.d-Bses_F-y.d.ts → navigation-delegate.d--imR0rY7.d.ts} +1 -1
- package/dist/{navigation-delegate.d-dBNg976E.d.mts → navigation-delegate.d-DVEtyGYw.d.mts} +1 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/plugin.cjs +13 -13
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +12 -12
- package/dist/{render-plan.d-vOdZHHLI.d.mts → render-plan.d-CTehM6y8.d.mts} +1 -1
- package/dist/{render-plan.d-DaIwnRK2.d.ts → render-plan.d-DpxLd_1i.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-CgXp3EEc.d.ts → request.d-BFXzOr32.d.ts} +1 -1
- package/dist/{request.d-B8U4pVFP.d.mts → request.d-BmQzlKtT.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-Di0AxFix.d.ts → route-rendering.d-bEil1VkF.d.ts} +1 -1
- package/dist/{route-rendering.d-BQvNYQqu.d.mts → route-rendering.d-geg68qd0.d.mts} +1 -1
- package/dist/{router.d-BJVGhSAJ.d.ts → router.d-4OCT2ak5.d.ts} +1 -1
- package/dist/{router.d-hNedVdoB.d.mts → router.d-CQjEcNih.d.mts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +2 -2
- package/dist/{rsc-pipeline-NCJ3NIE5.mjs → rsc-pipeline-JISGZS6G.mjs} +2 -2
- package/dist/{rsc-pipeline-HT4G3QGT.cjs → rsc-pipeline-R5W3PAAL.cjs} +3 -3
- package/dist/{runtime-6UF5XKUP.cjs → runtime-HSTND4FF.cjs} +8 -8
- package/dist/{runtime-VHXIEXL7.mjs → runtime-I2SBIB2Q.mjs} +5 -5
- package/dist/{runtime.d-0R8nHCM6.d.ts → runtime.d-BKoa6J55.d.ts} +1 -1
- package/dist/{runtime.d-DpeuF_T-.d.mts → runtime.d-DjYo5E1n.d.mts} +1 -1
- package/dist/{schema-dependencies.d-_Wyey4Wv.d.mts → schema-dependencies.d-CGNgsyKS.d.mts} +1 -1
- package/dist/{schema-dependencies.d-tkUHREqz.d.ts → schema-dependencies.d-CRoN2Q9N.d.ts} +1 -1
- package/dist/{server-components-status.d-sN7ju-ie.d.mts → server-components-status.d-Crl3IonP.d.mts} +1 -1
- package/dist/{server-components-status.d-B2Z5WvO5.d.ts → server-components-status.d-CwfcQD6n.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +34 -34
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +14 -14
- package/dist/{spa-router.d-MjT6sGb9.d.ts → spa-router.d-Bv-r3AAK.d.ts} +2 -2
- package/dist/{spa-router.d-D3AtR2Bc.d.mts → spa-router.d-DhO_PJHP.d.mts} +2 -2
- package/dist/{ssg.d-C1SNuPz5.d.ts → ssg.d-CzFOAkqy.d.mts} +13 -2
- package/dist/{ssg.d-B32Cp_XW.d.mts → ssg.d-SfEQfMsA.d.ts} +13 -2
- package/dist/{store-core.d-BZ3YXs70.d.ts → store-core.d-Ch0N8dni.d.ts} +2 -2
- package/dist/{store-core.d-BbVdaoA0.d.mts → store-core.d-pKJCUdTR.d.mts} +2 -2
- package/dist/testing.cjs +5 -5
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +4 -4
- package/dist/{utils.d-Bjbm44fP.d.ts → utils.d-BaLODLrK.d.ts} +1 -1
- package/dist/{utils.d-CoLozp7-.d.mts → utils.d-TPjb_Q7w.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +13 -13
- package/dist/vite.d.mts +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.mjs +12 -12
- package/package.json +2 -2
- package/dist/analyzer-ENHO4SA5.cjs +0 -17
- package/dist/chunk-Q4CPBKPT.mjs +0 -251
- /package/dist/{chunk-JL2HNLMC.mjs → chunk-3QC2XTCN.mjs} +0 -0
- /package/dist/{chunk-COXMHCIV.cjs → chunk-GDKJGL7D.cjs} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkYV47TSSBcjs = require('./chunk-YV47TSSB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
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',
|
|
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',
|
|
116
|
-
publicRuntimeConfig: _nullishCoalesce(_optionalChain([layered, 'optionalAccess',
|
|
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
|
|
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',
|
|
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 &&
|
|
467
|
+
outputDir: options.outputDir && _chunkGDKJGL7Dcjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
|
|
171
468
|
}
|
|
172
469
|
})
|
|
173
470
|
]
|