mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 10:51:05 +08:00
17 lines
428 B
TypeScript
17 lines
428 B
TypeScript
import { PluginOption } from 'vite';
|
|
|
|
function checkName(plugin: PluginOption, name: string) {
|
|
return typeof plugin === 'object' && 'name' in plugin && plugin.name === name;
|
|
}
|
|
|
|
export function hasPlugin(plugins: PluginOption[], name: string) {
|
|
return Boolean(
|
|
plugins.find((p): boolean => {
|
|
if (Array.isArray(p)) {
|
|
return Boolean(hasPlugin(p, name));
|
|
}
|
|
return checkName(p, name);
|
|
})
|
|
);
|
|
}
|