| 1 | import * as Effect from "effect/Effect"; |
| 2 | import { FrameworkServerError } from "./Server.ts"; |
| 3 | |
| 4 | /** |
| 5 | * Loads `@alchemy.run/frontend-frameworks/core` when a website is built or |
| 6 | * served. The package is an optional peer dependency, so provider entrypoints |
| 7 | * that re-export their `Website` namespace (e.g. `alchemy/Prisma`) must not |
| 8 | * import it statically — that would break every consumer that never deploys a |
| 9 | * website and so never installed it. |
| 10 | */ |
| 11 | export const loadFrontendCore = Effect.tryPromise({ |
| 12 | try: () => import("@alchemy.run/frontend-frameworks/core"), |
| 13 | catch: (cause) => |
| 14 | new FrameworkServerError({ |
| 15 | framework: "@alchemy.run/frontend-frameworks/core", |
| 16 | message: |
| 17 | 'Failed to import "@alchemy.run/frontend-frameworks/core". ' + |
| 18 | "Install @alchemy.run/frontend-frameworks in your project to deploy a website.", |
| 19 | cause, |
| 20 | }), |
| 21 | }).pipe(Effect.orDie); |