@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
@@ -1,251 +0,0 @@
1
- import {
2
- createFarmDevLoopbackPlugin
3
- } from "./chunk-RLEAVG6G.mjs";
4
- import {
5
- resolveDeployOutputPath
6
- } from "./chunk-MVNIAD6O.mjs";
7
- import {
8
- farmDesktopDevGuardPlugin,
9
- loadFarmReactPlugin
10
- } from "./chunk-6XABTMXR.mjs";
11
- import {
12
- generateFarmClientPluginEntryCode,
13
- hasFarmServerRuntimePlugins,
14
- loadTailwindVitePlugin
15
- } from "./chunk-ADKPJZPP.mjs";
16
- import {
17
- resolveFarmPlatform
18
- } from "./chunk-W5T3ZAFU.mjs";
19
- import {
20
- FARM_RSC_INSTALL_HINT,
21
- findFarmAppPackageDir,
22
- formatFarmRscBlockingMessage,
23
- inspectFarmServerComponents,
24
- resolveFarmRscCheckConfig
25
- } from "./chunk-KQXYBJES.mjs";
26
-
27
- // src/rsc-pipeline.ts
28
- import { readFileSync } from "fs";
29
- import path from "path";
30
- import { pathToFileURL } from "url";
31
- var FARM_RSC_ENTRIES = {
32
- rsc: "./.farm/rsc-entries/entry.rsc.tsx",
33
- ssr: "./.farm/rsc-entries/entry.ssr.tsx",
34
- client: "./.farm/rsc-entries/entry.browser.tsx"
35
- };
36
- var FARM_RSC_CONFIG_KEYS = [
37
- "srcDir",
38
- "extends",
39
- "basePath",
40
- "trailingSlash",
41
- "api",
42
- "server",
43
- "middleware",
44
- "images",
45
- "serverActions",
46
- "deploymentId",
47
- "generateBuildId",
48
- "md",
49
- "agent",
50
- "mcp"
51
- ];
52
- var FARM_RSC_PASSTHROUGH_KEYS = [
53
- "i18n",
54
- "cache",
55
- "redirects",
56
- "rewrites",
57
- "headers",
58
- "compress"
59
- ];
60
- function pickImportTarget(entry) {
61
- if (typeof entry === "string") return entry;
62
- if (!entry || typeof entry !== "object") return void 0;
63
- for (const condition of ["import", "node", "default"]) {
64
- const target = pickImportTarget(entry[condition]);
65
- if (target) return target;
66
- }
67
- return void 0;
68
- }
69
- async function importFromApp(root, packageName, subpath = ".") {
70
- const packageDir = findFarmAppPackageDir(root, packageName);
71
- if (!packageDir) return void 0;
72
- const manifest = JSON.parse(readFileSync(path.join(packageDir, "package.json"), "utf8"));
73
- const exportsMap = manifest.exports;
74
- const entry = exportsMap && typeof exportsMap === "object" && !Array.isArray(exportsMap) && subpath in exportsMap ? exportsMap[subpath] : subpath === "." ? exportsMap ?? manifest.module ?? manifest.main ?? "index.js" : void 0;
75
- const target = pickImportTarget(entry);
76
- if (!target) return void 0;
77
- return import(pathToFileURL(path.join(packageDir, target)).href);
78
- }
79
- function hasPluginNamed(plugins, prefix) {
80
- if (Array.isArray(plugins)) return plugins.some((plugin) => hasPluginNamed(plugin, prefix));
81
- const name = plugins?.name;
82
- return typeof name === "string" && name.startsWith(prefix);
83
- }
84
- async function createFarmRscViteConfig(userConfig, options) {
85
- const root = path.resolve(options.root);
86
- const renderer = userConfig.renderer;
87
- if (renderer && typeof renderer === "object" && renderer.name && renderer.name !== "react") {
88
- throw new Error(
89
- `[Farm.js] serverComponents needs the React renderer; this app uses "${renderer.name}".`
90
- );
91
- }
92
- const [pluginRsc, viteRsc, viteReact] = await Promise.all([
93
- importFromApp(root, "@farm.js/plugin", "./rsc"),
94
- importFromApp(root, "@vitejs/plugin-rsc"),
95
- importFromApp(root, "@vitejs/plugin-react")
96
- ]);
97
- if (!pluginRsc || !viteRsc || !findFarmAppPackageDir(root, "react-server-dom-webpack")) {
98
- throw new Error(
99
- `[Farm.js] serverComponents runs on @farm.js/plugin and the official @vitejs/plugin-rsc. Install them: ${FARM_RSC_INSTALL_HINT}`
100
- );
101
- }
102
- const layered = await resolveFarmRscCheckConfig(
103
- userConfig,
104
- root,
105
- options.command === "build" ? "production" : "development"
106
- );
107
- const config = await configureFarmRscPlugins(
108
- {
109
- ...userConfig,
110
- vite: typeof userConfig.vite === "function" ? userConfig.vite({}) : userConfig.vite,
111
- plugins: layered?.plugins ?? [],
112
- publicRuntimeConfig: layered?.publicRuntimeConfig ?? {}
113
- },
114
- options.command
115
- );
116
- const blockingKeys = inspectFarmServerComponents(config, root).blockingKeys;
117
- if (blockingKeys.length > 0) {
118
- throw new Error(`[Farm.js] ${formatFarmRscBlockingMessage(blockingKeys)}`);
119
- }
120
- const { plugins: vitePlugins = [], ...viteOptions } = config.vite ?? {};
121
- const rscConfig = {};
122
- for (const key of FARM_RSC_CONFIG_KEYS) {
123
- if (config[key] !== void 0) rscConfig[key] = config[key];
124
- }
125
- const createReactPlugin = hasPluginNamed(vitePlugins, "vite:react") ? void 0 : viteReact?.default ?? (options.command === "serve" ? (await loadFarmReactPlugin()).default : void 0);
126
- const tailwind = hasPluginNamed(vitePlugins, "@tailwindcss/vite") ? void 0 : await loadTailwindVitePlugin();
127
- const platform = resolveFarmPlatform();
128
- const mobileClient = config.mobile === void 0 || platform === "desktop" ? void 0 : options.command === "build" ? "entry" : platform === "mobile" ? "inline" : void 0;
129
- const clientPluginEntry = generateFarmClientPluginEntryCode(
130
- config.plugins,
131
- root,
132
- typeof config.srcDir === "string" ? config.srcDir : "src",
133
- config.publicRuntimeConfig ?? {},
134
- // The RSC entry hands navigations to a mobile shell itself.
135
- "web"
136
- );
137
- const serverPlugins = options.command === "build" ? await resolveFarmRscServerPlugins(userConfig, config, root) : void 0;
138
- const farmConfig = pluginRsc.defineConfig({
139
- ...rscConfig,
140
- ...mobileClient ? { mobileClient } : {},
141
- clientPlugins: {
142
- empty: clientPluginEntry.empty,
143
- imports: clientPluginEntry.imports,
144
- registrations: clientPluginEntry.registrations
145
- },
146
- // Plugins with server hooks load in the production server, as in Farm's other servers, so
147
- // factories such as `bot()` run there. Dev loaded them with the config already.
148
- ...serverPlugins ? { serverPlugins } : {},
149
- ...options.preset ? { preset: options.preset } : {},
150
- experimental: { ...config.experimental, serverComponents: { mode: "rsc" } },
151
- port: options.port ?? config.server?.port,
152
- plugins: [
153
- ...options.command === "serve" && platform === "desktop" ? [
154
- farmDesktopDevGuardPlugin(
155
- typeof config.basePath === "string" ? config.basePath : void 0
156
- )
157
- ] : [],
158
- ...tailwind ? [tailwind] : [],
159
- ...vitePlugins,
160
- viteRsc.default({ serverHandler: false, entries: FARM_RSC_ENTRIES }),
161
- ...typeof createReactPlugin === "function" ? [createReactPlugin()] : [],
162
- pluginRsc.nitro({
163
- server: { environmentName: "rsc" },
164
- config: {
165
- preset: options.preset,
166
- outputDir: options.outputDir && resolveDeployOutputPath(root, options.outputDir)
167
- }
168
- })
169
- ]
170
- });
171
- for (const key of FARM_RSC_PASSTHROUGH_KEYS) {
172
- if (config[key] !== void 0) farmConfig[key] = config[key];
173
- }
174
- const { mergeConfig } = await import("vite");
175
- return {
176
- ...mergeConfig(farmConfig, viteOptions),
177
- root,
178
- // The Farm config is the app's config; a stray vite.config must not add a second pipeline.
179
- configFile: false,
180
- mode: options.command === "build" ? "production" : "development"
181
- };
182
- }
183
- async function resolveFarmRscServerPlugins(userConfig, config, root) {
184
- const kept = config.plugins ?? [];
185
- const names = new Set(
186
- kept.filter((plugin) => hasFarmServerRuntimePlugins([plugin])).map((plugin) => plugin.name)
187
- );
188
- if (names.size === 0) return void 0;
189
- const loads = (plugin) => {
190
- const candidate = plugin;
191
- return !!candidate && names.has(candidate.name) && hasFarmServerRuntimePlugins([candidate]);
192
- };
193
- const { findFarmConfigFile, loadFarmConfigFile, resolveFarmLayers } = await import("./layers-O6GUR6LT.mjs");
194
- const files = [];
195
- if (userConfig.extends) {
196
- const { layers } = await resolveFarmLayers(userConfig, { root, mode: "production" });
197
- for (const layer of layers) {
198
- if (!layer.configFile) continue;
199
- const layerConfig = await loadFarmConfigFile(layer.configFile, {
200
- root: layer.root,
201
- cacheRoot: root
202
- });
203
- files.push([layer.configFile, layerConfig.plugins]);
204
- }
205
- }
206
- const configFile = findFarmConfigFile(root);
207
- if (configFile) files.push([configFile, userConfig.plugins]);
208
- const selections = {};
209
- for (const [file, plugins] of files) {
210
- const entries = Array.isArray(plugins) ? plugins : [plugins];
211
- const indexes = entries.flatMap(
212
- (entry, index) => [entry].flat(Infinity).some(loads) ? [index] : []
213
- );
214
- if (indexes.length > 0) selections[path.resolve(file)] = { indexes, count: entries.length };
215
- }
216
- return Object.keys(selections).length > 0 ? selections : void 0;
217
- }
218
- async function configureFarmRscPlugins(config, command) {
219
- if (config.plugins.length === 0) return config;
220
- const { PluginManager } = await import("./plugin-B7I5QVBE.mjs");
221
- const manager = new PluginManager({
222
- config,
223
- isDev: command === "serve",
224
- isProd: command === "build"
225
- });
226
- manager.addPlugins(config.plugins);
227
- return await manager.runHookSerial("config", config);
228
- }
229
- async function createFarmRscDevServer(userConfig, options) {
230
- const { createServer } = await import("vite");
231
- const { host, ...configOptions } = options;
232
- const config = await createFarmRscViteConfig(userConfig, { ...configOptions, command: "serve" });
233
- return createServer({
234
- ...config,
235
- plugins: [...config.plugins ?? [], createFarmDevLoopbackPlugin()],
236
- ...host === void 0 ? {} : { server: { ...config.server, host } }
237
- });
238
- }
239
- async function buildFarmRsc(userConfig, options) {
240
- const { createBuilder } = await import("vite");
241
- const builder = await createBuilder(
242
- await createFarmRscViteConfig(userConfig, { ...options, command: "build" })
243
- );
244
- await builder.buildApp();
245
- }
246
-
247
- export {
248
- createFarmRscViteConfig,
249
- createFarmRscDevServer,
250
- buildFarmRsc
251
- };
File without changes
File without changes