1import * as AWS from "alchemy/AWS";
2import * as Effect from "effect/Effect";
3import { MicrovmBuildRole } from "./build-role.ts";
4import { effectfulImpl } from "./effectful-impl.ts";
5
6/**
7 * Effectful MicroVM image on **bun** — a bundled Effect program exposing a raw
8 * `fetch` handler and a typed RPC `hello` method. Pairs with the bun baseline
9 * ({@link import("./bun-image.ts")}): same runtime + ARM_64 arch, the only
10 * difference being the bundled Effect runtime / alchemy bootstrap. Compare to
11 * {@link import("./effectful-node.ts").EffectfulNode} for the node-vs-bun delta.
12 */
13export class EffectfulBun extends AWS.Lambda.MicrovmImage<
14 EffectfulBun,
15 {
16 hello: (message: string) => Effect.Effect<string>;
17 }
18>()("MicrovmEffectfulBun") {}
19
20export default EffectfulBun.make(
21 MicrovmBuildRole.pipe(
22 Effect.map((buildRole) => ({
23 main: import.meta.filename,
24 buildRole,
25 runtime: "bun" as const,
26 resources: [{ minimumMemoryInMiB: 512 }],
27 cpuConfigurations: [{ architecture: "ARM_64" }],
28 })),
29 ),
30 effectfulImpl,
31);