* Get list of env files to load based on mode and template * Similar to Vite's getEnvFilesForMode * @private * @param {InputFileSystem} inputFileSystem the input file system * @param {string | false} dir the directory containing .env files * @param {string | undefined} mode the mode (e.g.,
(inputFileSystem, dir, mode)
| 296 | * @returns {string[]} array of file paths to load |
| 297 | */ |
| 298 | _getEnvFilesForMode(inputFileSystem, dir, mode) { |
| 299 | if (!dir) { |
| 300 | return []; |
| 301 | } |
| 302 | |
| 303 | const templates = this.options.template || DEFAULT_TEMPLATE; |
| 304 | |
| 305 | return templates |
| 306 | .map((pattern) => pattern.replace(/\[mode\]/g, mode || "development")) |
| 307 | .map((file) => join(inputFileSystem, dir, file)); |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * Get parsed env variables from `.env` files |
no test coverage detected