(command: Record<string, any>)
| 12 | import loadConfigFromCommand from './loadConfigFromCommand'; |
| 13 | |
| 14 | export default async function runRollup(command: Record<string, any>): Promise<void> { |
| 15 | let inputSource; |
| 16 | if (command._.length > 0) { |
| 17 | if (command.input) { |
| 18 | handleError(logDuplicateImportOptions()); |
| 19 | } |
| 20 | inputSource = command._; |
| 21 | } else if (typeof command.input === 'string') { |
| 22 | inputSource = [command.input]; |
| 23 | } else { |
| 24 | inputSource = command.input; |
| 25 | } |
| 26 | |
| 27 | if (inputSource && inputSource.length > 0) { |
| 28 | if (inputSource.some((input: string) => input.includes('='))) { |
| 29 | command.input = {}; |
| 30 | for (const input of inputSource) { |
| 31 | const equalsIndex = input.indexOf('='); |
| 32 | const value = input.slice(Math.max(0, equalsIndex + 1)); |
| 33 | const key = input.slice(0, Math.max(0, equalsIndex)) || getAliasName(input); |
| 34 | |
| 35 | command.input[key] = value; |
| 36 | } |
| 37 | } else { |
| 38 | command.input = inputSource; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | if (command.environment) { |
| 43 | const environment = Array.isArray(command.environment) |
| 44 | ? command.environment |
| 45 | : [command.environment]; |
| 46 | |
| 47 | for (const argument of environment) { |
| 48 | for (const pair of argument.split(',')) { |
| 49 | const [key, ...value] = pair.split(':'); |
| 50 | env[key] = value.length === 0 ? String(true) : value.join(':'); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | if (isWatchEnabled(command.watch)) { |
| 56 | await loadFsEvents(); |
| 57 | const { watch } = await import('./watch-cli'); |
| 58 | await watch(command); |
| 59 | } else { |
| 60 | try { |
| 61 | const { options, warnings } = await getConfigs(command); |
| 62 | try { |
| 63 | for (const inputOptions of options) { |
| 64 | if (!inputOptions.cache) { |
| 65 | // We explicitly disable the cache when unused as the CLI will not |
| 66 | // use the cache object on the bundle when not in watch mode. This |
| 67 | // improves performance as the cache is not generated. |
| 68 | inputOptions.cache = false; |
| 69 | } |
| 70 | await build(inputOptions, warnings, command.silent); |
| 71 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…