import { SerializedEnvGraph } from "varlock"; //#region src/ansi-to-html.d.ts /** * Convert a string with ANSI escape codes to HTML with inline styles. * Uses a "close all, re-open with active styles" approach so that * nested/overlapping ANSI sequences render correctly. */ declare function ansiToHtml(str: string): string; //#endregion //#region src/index.d.ts declare function buildErrorPageHtml(ansiError?: string): string; declare let varlockLoadedEnv: SerializedEnvGraph; /** Stderr output from the last failed varlock load (ANSI-colored) */ declare let varlockLastError: string | undefined; interface VarlockVitePluginOptions { /** controls if/how varlock init code is injected into the built SSR application code */ ssrInjectMode?: 'auto-load' | 'init-only' | 'resolved-env'; /** extra code lines to inject at the SSR entry point, before varlock init calls */ ssrEntryCode?: Array; /** set to true for edge runtimes that don't have node:http (skips patchGlobalServerResponse) */ ssrEdgeRuntime?: boolean; /** additional virtual module IDs to treat as entry points (e.g., '\0virtual:cloudflare/worker-entry') */ ssrEntryModuleIds?: Array; /** override integration identity for CLI telemetry (used by composed integrations like Astro) */ integrationTelemetry?: { name: string; version: string; }; /** * set by composed integrations (e.g. `@varlock/cloudflare-integration`, the * Astro Cloudflare adapter branch) when the CF runtime env loader has been * injected via `ssrEntryCode`. Used to reject `ssrInjectMode: 'resolved-env'` * as redundant — the loader already hydrates env from Cloudflare bindings. */ isCloudflareTarget?: boolean; /** * directory varlock should load `.env` files from. Defaults to vite's `root`. * Set by integrations whose framework points vite's `root` at a source * subdirectory rather than the project root — e.g. Nuxt 4, where `root` is * the `app/` srcDir but the env files live one level up. */ rootDir?: string; } /** options for {@link buildVarlockSsrInitCode} */ /** * The currently loaded env graph, for integrations that need to inspect the * config outside vite's hooks (e.g. the Nuxt module checks for public+dynamic * items to decide whether to inject the public-env endpoint). Reloads the * config first if `rootDir` differs from the directory the module-level load * used. */ declare function getVarlockLoadedEnv(rootDir?: string): SerializedEnvGraph | undefined; /** * Force a fresh env resolution and refresh the shared runtime store (ENV proxy * values, process.env injection, the auto-load global). Used by the Nuxt module * on dev restarts: it runs before the new nuxt instance evaluates nuxt.config, * so config-time `ENV` reads see fresh values even though the config's cached * `varlock/auto-load` import does not re-run. */ declare function refreshVarlockEnv(rootDir?: string): void; /** * Absolute paths of the env files the current config was loaded from, for * integrations that manage their own file watching (e.g. the Nuxt module * pushes these into `nuxt.options.watch` so a schema edit restarts the dev * server). Reloads the config first if `rootDir` differs from the directory * the module-level load used. Non-regular files (FIFOs, e.g. 1Password * Environments) are excluded since watching them is meaningless. */ declare function getVarlockEnvSourcePaths(rootDir?: string): Array; interface VarlockSsrInitCodeOptions { ssrInjectMode?: VarlockVitePluginOptions['ssrInjectMode']; ssrEntryCode?: VarlockVitePluginOptions['ssrEntryCode']; ssrEdgeRuntime?: VarlockVitePluginOptions['ssrEdgeRuntime']; isCloudflareTarget?: VarlockVitePluginOptions['isCloudflareTarget']; /** vite environment name — only used to detect Cloudflare's prerender worker */ environmentName?: string; /** overrides the dev/build detection, for callers that run outside vite's `config` hook */ isDev?: boolean; /** * directory to load `.env` files from. Callers that run before vite's * `config` hook must pass this — until that hook runs, the config is * whatever the module-level load found in `process.cwd()`, which is not the * project root when a framework CLI is pointed elsewhere (`nuxt build --cwd`). */ rootDir?: string; /** * emit side-effect-only imports in a form that cannot be tree-shaken. Set by * integrations targeting a bundler that treats external modules as * side-effect free — Nitro's rollup pass drops a bare `import 'x'` of an * external, which would silently disable `ssrInjectMode: 'auto-load'`. */ preserveSideEffectImports?: boolean; } /** * Builds the varlock init module source — the code that initializes `ENV` and * patches the global console/response objects before any user code runs. * * Exported so integrations can inject the same init sequence into build * pipelines that vite does not own. `@varlock/nuxt-integration` uses it for the Nitro * server bundle, which rollup builds separately from vite's SSR output. */ declare function buildVarlockSsrInitCode(opts?: VarlockSsrInitCodeOptions): string; declare function varlockVitePlugin(vitePluginOptions?: VarlockVitePluginOptions): any; //#endregion export { VarlockSsrInitCodeOptions, VarlockVitePluginOptions, ansiToHtml, buildErrorPageHtml, buildVarlockSsrInitCode, getVarlockEnvSourcePaths, getVarlockLoadedEnv, refreshVarlockEnv, varlockLastError, varlockLoadedEnv, varlockVitePlugin }; //# sourceMappingURL=index.d.mts.map