| 1 | import { Vite, type ViteProps } from "./Vite.ts"; |
| 2 | |
| 3 | /** Configuration for a client-only Foldkit website. */ |
| 4 | export interface FoldkitProps extends ViteProps {} |
| 5 | |
| 6 | /** |
| 7 | * Deploy a Foldkit Vite application to Prisma Compute with SPA routing. |
| 8 | * The project's Foldkit Vite plugin drives the build; native Vite HMR runs |
| 9 | * during development without creating cloud resources. |
| 10 | * |
| 11 | * ### Creating a Website |
| 12 | * **Example:** Foldkit application |
| 13 | * ```typescript |
| 14 | * const site = yield* Prisma.Website.Foldkit("Web", { |
| 15 | * rootDir: "./app", |
| 16 | * }); |
| 17 | * ``` |
| 18 | * |
| 19 | * ### Multi-Page Routing |
| 20 | * **Example:** Override the default SPA fallback |
| 21 | * ```typescript |
| 22 | * const site = yield* Prisma.Website.Foldkit("Web", { |
| 23 | * assets: { notFoundHandling: "404-page" }, |
| 24 | * }); |
| 25 | * ``` |
| 26 | * |
| 27 | * @resource |
| 28 | * @product Website |
| 29 | */ |
| 30 | export const Foldkit = (id: string, props: FoldkitProps = {}) => |
| 31 | Vite(id, { |
| 32 | ...props, |
| 33 | assets: { notFoundHandling: "single-page-application", ...props.assets }, |
| 34 | }); |