import { Assets } from "./assets.ts"; import type { Bindings } from "./bindings.ts"; import { type AssetsConfig, Worker, type WorkerProps } from "./worker.ts"; import { type WranglerJsonSpec } from "./wrangler.json.ts"; export interface WebsiteProps extends Omit, "assets" | "dev"> { /** * Configuration for the build command * * If not provided, the build is assumed to have already happened. */ build?: string | { /** * The command to run to build the site */ command?: string; /** * Additional environment variables to set when running the build command */ env?: Record; /** * Whether to memoize the command (only re-run if the command changes) * * When set to `true`, the command will only be re-executed if the command string changes. * * When set to an object with `patterns`, the command will be re-executed if either: * 1. The command string changes, or * 2. The contents of any files matching the glob patterns change * * ⚠️ **Important Note**: When using memoization with build commands, the build outputs * will not be produced if the command is memoized. This is because the command is not * actually executed when memoized. Consider disabling memoization in CI environments: * * @example * // Disable memoization in CI to ensure build outputs are always produced * await Website("my-website", { * command: "vite build", * memoize: process.env.CI ? false : { * patterns: ["./src/**"] * } * }); * * @default false */ memoize?: boolean | { patterns: string[]; }; }; /** * Configuration for the dev command */ dev?: string | { /** * The command to run to start the dev server */ command?: string; /** * The local domain to use for the dev server */ domain?: string; /** * Whether to use a Cloudflare Tunnel for the dev server */ tunnel?: boolean; /** * Additional environment variables to set when running the dev command */ env?: Record; }; /** * The directory containing static assets * * @default dist */ assets?: string | ({ directory?: string; } & AssetsConfig); /** * Configures default routing to support client-side routing for Single Page Applications (SPA) * * @default false */ spa?: boolean; /** * Configuration for the wrangler.json file */ wrangler?: { /** * Path to the wrangler.json file * * @default .alchemy/local/wrangler.jsonc */ path?: string; /** * The main entry point for the worker * * @default worker.entrypoint */ main?: string; /** * Hook to modify the wrangler.json object before it's written * * This function receives the generated wrangler.json spec and should return * a modified version. It's applied as the final transformation before the * file is written to disk. * * @param spec - The generated wrangler.json specification * @returns The modified wrangler.json specification */ transform?: (spec: WranglerJsonSpec) => WranglerJsonSpec | Promise; /** * Whether to include secrets in the wrangler.json file * * @default true if no path is specified, false otherwise */ secrets?: boolean; }; /** * The command to run to build the site. * @deprecated Use `build` or `build.command` instead */ command?: string; /** * Additional environment variables to set when running the build command. * @deprecated Use `build.env` instead */ commandEnv?: Record; /** * Whether to memoize the command (only re-run if the command changes) * @deprecated Use `build.memoize` instead */ memoize?: boolean | { patterns: string[]; }; } export type Website = B extends { ASSETS: any; } ? never : Worker; export declare function Website(id: string, props: WebsiteProps): Promise>; export declare const spreadBuildProps: (props: { build?: WebsiteProps["build"]; } | undefined, defaultCommand: string) => WebsiteProps["build"]; export declare const spreadDevProps: (props: { dev?: WebsiteProps["dev"]; } | undefined, defaultCommand: string) => Exclude["dev"], undefined>; //# sourceMappingURL=website.d.ts.map