(commandConfig: string | true)
| 7 | const DEFAULT_CONFIG_BASE = 'rollup.config'; |
| 8 | |
| 9 | export async function getConfigPath(commandConfig: string | true): Promise<string> { |
| 10 | if (commandConfig === true) { |
| 11 | return path.resolve(await findConfigFileNameInCwd()); |
| 12 | } |
| 13 | if (commandConfig.slice(0, 5) === 'node:') { |
| 14 | const packageName = commandConfig.slice(5); |
| 15 | try { |
| 16 | return require.resolve(`rollup-config-${packageName}`, { paths: [cwd()] }); |
| 17 | } catch { |
| 18 | try { |
| 19 | return require.resolve(packageName, { paths: [cwd()] }); |
| 20 | } catch (error: any) { |
| 21 | if (error.code === 'MODULE_NOT_FOUND') { |
| 22 | handleError(logMissingExternalConfig(commandConfig)); |
| 23 | } |
| 24 | throw error; |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | return path.resolve(commandConfig); |
| 29 | } |
| 30 | |
| 31 | async function findConfigFileNameInCwd(): Promise<string> { |
| 32 | const filesInWorkingDirectory = new Set(await readdir(cwd())); |
no test coverage detected
searching dependent graphs…