import type { BoilerplateOptions } from './types.ts'; /** The public env var each framework's build integration reads. */ export declare const BACKEND_URL_ENV: { readonly astro: 'PUBLIC_C15T_BACKEND_URL'; readonly next: 'NEXT_PUBLIC_C15T_BACKEND_URL'; readonly nuxt: 'NUXT_PUBLIC_C15T_BACKEND_URL'; readonly sveltekit: 'PUBLIC_C15T_BACKEND_URL'; readonly vite: 'VITE_C15T_BACKEND_URL'; }; /** * Join import statements in module-specifier order, the order the examples * use, so a vendor import lands where a reader expects it. * @param statements One-line or multi-line import statements. * @returns The statements, sorted and joined with newlines. */ export declare const sortImports: (statements: string[]) => string; /** * One import statement per selected vendor integration. * @param scripts Integration subpaths, such as `posthog`. * @returns Import statements from `@c15t/integrations/`. */ export declare const scriptImports: (scripts: string[]) => string[]; /** * A `scripts: [...]` property line, or nothing without vendors. * @param scripts Integration subpaths. * @param indentation Indentation of the property itself. * @returns The property with its trailing comma and newline, or ''. */ export declare const scriptsProperty: (scripts: string[], indentation: string) => string; /** * A `const scripts = [...]` declaration, or nothing without vendors. * @param scripts Integration subpaths. * @param indentation Indentation of the declaration. * @returns The declaration with a trailing newline, or ''. */ export declare const scriptsConstant: (scripts: string[], indentation?: string) => string; /** * An opening tag in the repository's format: one line with a single * attribute, one attribute per line with more. * @param tag Element name. * @param attributes Attributes, such as `state={consent}`. * @param indentation Indentation of the tag itself. * @returns The opening tag, without leading indentation. */ export declare const openingTag: (tag: string, attributes: string[], indentation: string) => string; /** * The `.env` file holding the backend URL. Hosts merge it into an existing * `.env` with {@link mergeEnvFile} instead of replacing that file. * @param name The framework's public env var. * @param options Generation options with a validated backend URL. * @returns A file map entry, or no file in offline mode. */ export declare const envFile: (name: string, options: BoilerplateOptions) => Record; /** The instruction every local-mode template adds. */ export declare const offlineInstruction: (options: BoilerplateOptions) => string[]; /** * Options for a build integration. Offline mode has no backend to fetch the * policy from, so the build skips the fetch instead of failing. * @param options Generation options. * @returns `''` in hosted mode, `{ onBuildError: 'runtime' }` offline. */ export declare const buildOptions: (options: BoilerplateOptions) => string; /** * Options for `consentManifest()` in a client-rendered Vite app. Offline * mode also turns off the inline `/init` script, which would otherwise * call a backend URL left in the environment. * @param options Generation options. * @returns `''` in hosted mode, `{ initPrefetch: false, onBuildError: 'runtime' }` offline. */ export declare const spaBuildOptions: (options: BoilerplateOptions) => string; /** Dependencies shared by every template that uses vendor integrations. */ export declare const integrationDependencies: (options: BoilerplateOptions) => string[]; /** The instruction every template with vendor placeholders adds. */ export declare const vendorInstruction: (options: BoilerplateOptions, file: string) => string[]; /** * Merge generated `KEY=value` lines into an existing `.env`. A key that is * already set takes the generated value in place; other lines, comments * and keys stay as they are. New keys are appended. * * A backend URL variable such as `VITE_C15T_BACKEND_URL` is not added to a * file that already sets the matching `VITE_INTH_PROJECT_URL`: the build * integrations read either, and the c15t name would win over the project * URL the file already names. * @param existing Current `.env` contents, or `null` when there is none. * @param generated Generated `KEY=value` lines. * @returns The merged file contents. * @example * mergeEnvFile('SECRET=1\n', 'VITE_C15T_BACKEND_URL=https://x.inth.app\n'); * // 'SECRET=1\nVITE_C15T_BACKEND_URL=https://x.inth.app\n' */ export declare const mergeEnvFile: (existing: string | null, generated: string) => string;