(
fileName,
commandOptions = {},
watchMode = false
)
| 25 | import type { LoadConfigFile } from './loadConfigFileType'; |
| 26 | |
| 27 | export const loadConfigFile: LoadConfigFile = async ( |
| 28 | fileName, |
| 29 | commandOptions = {}, |
| 30 | watchMode = false |
| 31 | ) => { |
| 32 | const configs = await getConfigList( |
| 33 | getDefaultFromCjs(await getConfigFileExport(fileName, commandOptions, watchMode)), |
| 34 | commandOptions |
| 35 | ); |
| 36 | const warnings = batchWarnings(commandOptions); |
| 37 | try { |
| 38 | const normalizedConfigs: MergedRollupOptions[] = []; |
| 39 | for (const config of configs) { |
| 40 | const options = await mergeOptions(config, watchMode, commandOptions, warnings.log); |
| 41 | await addCommandPluginsToInputOptions(options, commandOptions); |
| 42 | normalizedConfigs.push(options); |
| 43 | } |
| 44 | return { options: normalizedConfigs, warnings }; |
| 45 | } catch (error_) { |
| 46 | warnings.flush(); |
| 47 | throw error_; |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | async function getConfigFileExport( |
| 52 | fileName: string, |
no test coverage detected
searching dependent graphs…