import { BundleLeak } from "./types.js"; import { SourceMapInput } from "@jridgewell/trace-mapping"; //#region src/bundle-scan.d.ts /** * Options accepted by {@link scanOutputChunk} for scanning a single compiled * output chunk for leaked server-only environment variable values. */ type ScanOutputChunkOptions = { /** The compiled source code of the output chunk to scan. */chunkCode: string; /** The file name of the output chunk, used for reporting. */ chunkFileName: string; /** A map of environment variable name to its current string value. */ knownSecrets: Map; /** The source map for the chunk, used to resolve original file and line. */ sourceMap: SourceMapInput | null; }; /** * Scans a compiled output chunk for the literal string values of known * server-only environment variables. For each match, attempts to resolve * the original source file and line number using the chunk's source map. * * The source map is parsed once per chunk, not once per matched secret. * Secrets shorter than {@link MINIMUM_SECRET_LENGTH} characters are skipped * to avoid false positives on common short strings. * * @param options - The chunk code, file name, known secret values, and optional source map. * @returns An array of confirmed bundle leaks found within the chunk. */ declare function scanOutputChunk(options: ScanOutputChunkOptions): BundleLeak[]; /** * Collects the current string values of all environment variables that are * considered server-only: those without a configured env prefix (`VITE_` by * default) and not listed in the explicit allowlist. * * @param allowClientAccess - Variable names explicitly permitted for client use. * @param envPrefixes - Prefixes Vite exposes to the client (resolved `envPrefix`). * Defaults to {@link DEFAULT_ENV_PREFIXES} (`VITE_`). * @returns A Map of environment variable name to its current process value. */ declare function collectServerEnvVarValues(allowClientAccess: string[], envPrefixes?: readonly string[]): Map; //#endregion export { ScanOutputChunkOptions, collectServerEnvVarValues, scanOutputChunk }; //# sourceMappingURL=bundle-scan.d.ts.map