/** * `deploy` — bind a worker-safe `DomainDefinition` to a deployment adapter, * producing the value `astrale.config.ts` default-exports for the CLI. * * The split exists to keep the worker bundle clean: `defineDomain` (in the * author's `domain.ts`) carries only worker-safe modules and is what the * generated worker imports; the adapter (`cloudflare(...)` / `astrale(...)`) is * node-only code that the worker must never pull in. `deploy(domain, adapter)` * is authored in `astrale.config.ts` — a Node-only module the CLI loads but the * worker never imports — so the adapter stays out of the bundle. * * export const domain = defineDomain({ schema, methods, deps, views }) * * import { domain } from './domain' * export default deploy(domain, cloudflare({ dev, prod })) * * The returned shape is just the definition with `adapter` attached — exactly * what the CLI already reads (`def.adapter`, `def.origin`, `def.schema`, …), so * the loader is unchanged. */ import type { DomainAdapter } from './adapter.js' import type { DomainDefinition } from './define-domain.js' /** A domain definition bound to its deployment adapter — the CLI's input. */ export interface DeployConfig extends DomainDefinition { adapter: DomainAdapter } export function deploy( domain: DomainDefinition, adapter: DomainAdapter, ): DeployConfig { return { ...domain, adapter } }