| 1 | import * as Namespace from "../../Namespace.ts"; |
| 2 | import { makeFrameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts"; |
| 3 | |
| 4 | /** Configuration for a Neon Vocs website. */ |
| 5 | export type VocsProps = FrameworkSiteProps & { |
| 6 | /** Production output directory relative to rootDir, matching vocs.config.*. @default "dist" */ |
| 7 | outDir?: string; |
| 8 | }; |
| 9 | |
| 10 | /** |
| 11 | * Vocs documentation and its Waku RSC handler on Neon Functions. Install Vocs and its Waku peers alongside the framework integration. |
| 12 | * |
| 13 | * Native framework development and HMR run without Neon cloud resources. |
| 14 | * Apply `Alchemy.remote()` to use the live Function deployment during dev. |
| 15 | * Packaging requires the optional `@vercel/nft` peer dependency. |
| 16 | * The packaged example passes fresh Neon page, guide, and asset checks, |
| 17 | * plus live desktop/mobile counter interactions and guide navigation. |
| 18 | * Traced sensitive files remain rejected; diagnostics identify sanitized filenames. |
| 19 | * Native dev uses Vocs's own Vite instance in an isolated process. |
| 20 | * |
| 21 | * ### Creating a Website |
| 22 | * **Example:** Vocs application |
| 23 | * ```typescript |
| 24 | * const site = yield* Neon.Website.Vocs("Web", { |
| 25 | * rootDir: "./app", |
| 26 | * }); |
| 27 | * ``` |
| 28 | * |
| 29 | * ### Deployment Configuration |
| 30 | * **Example:** Existing project and custom hostname |
| 31 | * ```typescript |
| 32 | * const site = yield* Neon.Website.Vocs("Web", { |
| 33 | * project, |
| 34 | * domain: "www.example.com", |
| 35 | * env: { API_BASE: "https://api.example.com" }, |
| 36 | * function: { name: "Website" }, |
| 37 | * }); |
| 38 | * ``` |
| 39 | * |
| 40 | * @resource |
| 41 | * @product Website |
| 42 | */ |
| 43 | export const Vocs = (id: string, props: VocsProps = {}) => |
| 44 | makeFrameworkSite(id, props, { |
| 45 | framework: "@alchemy.run/frontend-frameworks/vocs/neon", |
| 46 | target: "@alchemy.run/frontend-frameworks/vocs/neon", |
| 47 | options: { outDir: props.outDir }, |
| 48 | htmlHandling: "drop-trailing-slash", |
| 49 | }).pipe(Namespace.push(id)); |