refactor(preset-rollup): normalize config in functional way
This commit is contained in:
parent
2a87e456b0
commit
4e671b7289
|
@ -180,22 +180,17 @@ function transformConfigValue(key: string, value: unknown): unknown {
|
|||
function objectifyPlugins(
|
||||
plugins: PluginManifest,
|
||||
): IntermediateRollupConfig['plugins'] {
|
||||
const normalizedPlugin: PluginObject = {};
|
||||
|
||||
const pluginList: PluginConfiguration[] = Array.isArray(plugins)
|
||||
? arrayToPluginConfiguration(plugins)
|
||||
: objectToPluginConfiguration(plugins);
|
||||
|
||||
for (const [name, options] of pluginList) {
|
||||
Object.assign(
|
||||
normalizedPlugin,
|
||||
return pluginList.reduce(
|
||||
(normalizedPlugin, [name, options]) =>
|
||||
merge(normalizedPlugin, { [name]: options }),
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
return normalizedPlugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* normalize rollup plugin config in array form
|
||||
* @param plugins rollup plugin config in array form
|
||||
|
|
Loading…
Reference in New Issue