import { A as EnvRuntimeRegistry, b as EnvDeclarations, k as EnvRuntimeConfigOptions, w as EnvOptions } from "./bridge-Cs9YfQWk.js"; import { n as ViteHubCliContributor } from "./cli-BPp7rdcA.js"; import { t as env } from "./declarations-C5XR3aKw.js"; import { n as OperationContributionEntry } from "./operation-definition-nmRu_O3V.js"; import { Plugin, UserConfig } from "vite"; //#region ../internal/src/deployment.d.ts /** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */ type ViteHubHost = "cloudflare" | "deno" | "netlify" | "node" | "vercel"; //#endregion //#region ../internal/src/build/deployment-plan-output.d.ts /** * One set of host variables that the deployed app reads, as `deployment.json` lists it: a Server Env declaration, or * a variable that a primitive reads itself, such as `VITEHUB_SECRET` or `BLOB_READ_WRITE_TOKEN`. * It holds names only, so `vitehub deploy` can check the host without booting Vite. It never holds a value. */ interface DeploymentEnvEntry { /** The declaration path, such as `env.server.github.token`, when it is safe to show. Primitive entries have none. */ path?: string; /** The host variable names, in read order. The first name that is set supplies the value. */ names: readonly string[]; /** Any variable whose name starts with this prefix supplies the value, such as `VITEHUB_CONSOLE_KEY_`. */ prefix?: string; required: boolean; secret: boolean; /** A default supplies the value when no name is set. */ hasDefault: boolean; /** The primitives that read these names, such as `blob`. Server Env declarations have none. */ owners?: readonly string[]; } /** What a primitive needs to know to name the variables it reads in the deployed app. */ interface DeploymentEnvContext { host: ViteHubHost; } /** * The host variables that a primitive reads itself, outside the Server Env registry, for one host and its resolved * config. A Vite plugin exposes it as `api.deploymentEnv`, and the build writes the result to `deployment.json`. * Return names only, never values. */ type DeploymentEnvContribution = (context: DeploymentEnvContext) => readonly DeploymentEnvEntry[]; //#endregion //#region ../internal/src/build/vite.d.ts declare const VITEHUB_ENV_PUBLIC_ID: "#vitehub/env/public"; declare const VITEHUB_ENV_SERVER_ID: "#vitehub/env/server"; //#endregion //#region src/core/resolve.d.ts interface RuntimeRegistryOptions { path?: string; prefix?: string | false; /** Accept `env.schemaFrom()`. Only generated modules that import and bind the schema modules set it. */ schemaModules?: boolean; } declare function createRuntimeRegistry(declarations: EnvRuntimeConfigOptions | undefined, options?: RuntimeRegistryOptions): EnvRuntimeRegistry; //#endregion //#region src/env-schema/importer.d.ts interface EnvSchemaOptions { prefix?: string; /** Exact schema key to output path. Only Server Env supports nested paths. */ paths?: Record; } /** Import a committed env-spec-v1 contract. Reads schema metadata, never developer env files. */ export declare function envSchema(file: string | URL, options?: EnvSchemaOptions): EnvDeclarations; //#endregion //#region src/vite.d.ts export declare const ENV_VITE_PLUGIN_NAME = "@vite-hub/env/vite"; export declare const ENV_PUBLIC_ID: typeof VITEHUB_ENV_PUBLIC_ID; export declare const ENV_SERVER_ID: typeof VITEHUB_ENV_SERVER_ID; export interface EnvVitePluginAPI { createServerEnvRegistry: (declarations: EnvRuntimeConfigOptions | undefined) => EnvRuntimeRegistry; /** `VITEHUB_SECRET`, which `deriveSecret()` and `seal()` read at runtime. Optional here: features that need it say so. */ deploymentEnv: DeploymentEnvContribution; getPublicEnv: () => Record; getServerEnvRegistry: () => EnvRuntimeRegistry; onServerEnvRegistry: (handler: (registry: EnvRuntimeRegistry, config: UserConfig) => void) => void; prepareTypes: (declarations: EnvDeclarations | undefined, viteRoot: string) => Promise; /** The declarations of this plugin's options, with the Server Env that ViteHub features add to this Vite config. */ resolveDeclarations: (config: object) => EnvDeclarations | undefined; resolveProjectRoot: (viteRoot: string) => string; } export type EnvVitePlugin = Plugin & { api: EnvVitePluginAPI; /** Contributes `vitehub env inspect`, `vitehub env check`, and the `env.inspect` operation. */ vitehub: { cli: () => ViteHubCliContributor; operations: readonly OperationContributionEntry[]; }; }; export interface EnvGeneratedPathOptions { projectRoot?: string; relativeTo?: string; } export declare function createEnvImportAliases(options?: EnvGeneratedPathOptions): Record; export declare function createEnvTypeScriptPaths(options?: EnvGeneratedPathOptions): Record; /** * Returns the declarations that the Vite Integration writes to `.vitehub/types/env.d.ts` for an `env` config: the * `PublicEnv` and `ServerEnv` types of `#vitehub/env/public` and `#vitehub/env/server`. A TypeScript host that does * not run Vite, such as a test or a docs check, can write them itself. */ export declare function createEnvTypes(config: EnvDeclarations | undefined, options?: Pick): string; export declare function hubEnv(options?: EnvOptions): EnvVitePlugin; //#endregion export { type EnvSchemaOptions, createRuntimeRegistry as createRuntimeEnvRegistry, env };