( commandPlugin: unknown, inputOptions: InputOptionsWithPlugins )
| 19 | } |
| 20 | |
| 21 | export async function addPluginsFromCommandOption( |
| 22 | commandPlugin: unknown, |
| 23 | inputOptions: InputOptionsWithPlugins |
| 24 | ): Promise<void> { |
| 25 | if (commandPlugin) { |
| 26 | const plugins = await normalizePluginOption(commandPlugin); |
| 27 | for (const plugin of plugins) { |
| 28 | if (/[={}]/.test(plugin)) { |
| 29 | // -p plugin=value |
| 30 | // -p "{transform(c,i){...}}" |
| 31 | await loadAndRegisterPlugin(inputOptions, plugin); |
| 32 | } else { |
| 33 | // split out plugins joined by commas |
| 34 | // -p node-resolve,commonjs,buble |
| 35 | for (const p of plugin.split(',')) { |
| 36 | await loadAndRegisterPlugin(inputOptions, p); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | async function loadAndRegisterPlugin( |
| 44 | inputOptions: InputOptionsWithPlugins, |
no test coverage detected
searching dependent graphs…