MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / bundleInnerRenderer

Function bundleInnerRenderer

packages/hosts/mcp-apps-shell/src/vite.ts:56–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54 * plugin serves without standing up Vite.
55 */
56export const bundleInnerRenderer = async (): Promise<string> => {
57 const { build } = await import("esbuild");
58 const result = await build({
59 entryPoints: [innerRendererEntry()],
60 absWorkingDir: packageRoot,
61 bundle: true,
62 write: false,
63 format: "iife",
64 platform: "browser",
65 target: "es2022",
66 jsx: "automatic",
67 define: {
68 "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV ?? "development"),
69 },
70 });
71
72 const js = result.outputFiles[0];
73 if (!js) {
74 // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: Vite plugin hooks report build failures by throwing
75 throw new Error("Failed to bundle the MCP-Apps inner renderer.");
76 }
77 return js.text;
78};
79
80export const smokeHarnessEntry = (): string =>
81 path.resolve(packageRoot, "src/shell/smoke-harness.tsx");

Callers 1

innerRendererPluginFunction · 0.85

Calls 1

innerRendererEntryFunction · 0.85

Tested by

no test coverage detected