1import { frameworkSite, type FrameworkSiteProps } from "./FrameworkSite.ts";
2
3/** The framework-integration package that drives the Nuxt build. */
4export const NUXT_FRAMEWORK_SPECIFIER = "@alchemy.run/frontend-frameworks/nuxt";
5
6/** The Node container deploy target for the Nuxt build. */
7export const NUXT_NODE_TARGET_SPECIFIER =
8 "@alchemy.run/frontend-frameworks/nuxt/node";
9
10export interface NuxtProps extends FrameworkSiteProps {
11 /**
12 * Nuxt config overrides merged over the project's own `nuxt.config.ts`
13 * (highest-priority layer). `nitro.preset` is owned by the Node deploy
14 * target and may not be set here.
15 */
16 nuxt?: Record<string, unknown>;
17}
18
19/**
20 * Deploy a Nuxt application to Fly: the nitro Node server on a Machine,
21 * static assets (prerendered pages included) baked into the image.
22 *
23 *
24 * ### Creating Nuxt Sites
25 * **Example:** Basic Nuxt App
26 * ```typescript
27 * const site = yield* Fly.Website.Nuxt("Web", {
28 * rootDir: "./app",
29 * });
30 * ```
31 *
32 * **Example:** Custom Domain
33 * ```typescript
34 * const site = yield* Fly.Website.Nuxt("Web", {
35 * rootDir: "./app",
36 * domain: "app.example.com",
37 * });
38 * ```
39 *
40 * @resource
41 * @product Website
42 */
43export const Nuxt = (id: string, props: NuxtProps = {}) =>
44 frameworkSite(id, props, {
45 name: "Nuxt",
46 framework: NUXT_FRAMEWORK_SPECIFIER,
47 target: NUXT_NODE_TARGET_SPECIFIER,
48 options: props.nuxt ? { nuxt: props.nuxt } : undefined,
49 });