/** * Shared environment variable filtering logic for webpack and rspack plugins. * * SECURITY: This module ensures only allowlisted environment variables are * exposed to client-side JavaScript bundles, preventing accidental leakage * of secrets like DATABASE_URL, API keys, etc. */ /** * Allowlist of environment variables that are safe to expose to client-side JavaScript. * * SECURITY: Never add sensitive variables like DATABASE_URL, API keys, or secrets. * These values are embedded directly into the JavaScript bundle and are publicly visible. * * Users can extend this list via: * 1. SHAKAPACKER_PUBLIC_* prefix (auto-exposed, similar to Next.js/Vite conventions) * 2. SHAKAPACKER_ENV_VARS environment variable (comma-separated list) * 3. Customizing their webpack/rspack config */ export declare const DEFAULT_ALLOWED_ENV_VARS: readonly ["NODE_ENV", "RAILS_ENV", "WEBPACK_SERVE"]; /** * Prefix for environment variables that are automatically exposed to client-side code. * Similar to Next.js's NEXT_PUBLIC_ and Vite's VITE_ prefixes. * * Example: SHAKAPACKER_PUBLIC_API_URL will be available as process.env.SHAKAPACKER_PUBLIC_API_URL */ export declare const PUBLIC_ENV_PREFIX = "SHAKAPACKER_PUBLIC_"; /** * Gets the list of environment variables to expose to client-side code. * Combines: * 1. Default allowed vars (NODE_ENV, RAILS_ENV, WEBPACK_SERVE) * 2. Any vars with SHAKAPACKER_PUBLIC_ prefix (auto-exposed) * 3. Any user-specified vars from SHAKAPACKER_ENV_VARS */ export declare const getAllowedEnvVars: () => string[]; /** * Builds a filtered environment object containing only allowed variables. * Returns an object with variable names as keys and their values. * Uses null as default for missing variables (webpack/rspack treat null as optional). */ export declare const getFilteredEnv: () => Record; //# sourceMappingURL=envFilter.d.ts.map