diff --git a/code/frameworks/vue-vite/src/types.ts b/code/frameworks/vue-vite/src/types.ts index e5ba544f554c..02412b374d85 100644 --- a/code/frameworks/vue-vite/src/types.ts +++ b/code/frameworks/vue-vite/src/types.ts @@ -1,11 +1,13 @@ import type { StorybookConfig as StorybookConfigBase } from '@storybook/types'; import type { StorybookConfigVite, BuilderOptions } from '@storybook/builder-vite'; +import type { DocGenOptions } from 'vue-docgen-api'; type FrameworkName = '@storybook/vue-vite'; type BuilderName = '@storybook/builder-vite'; export type FrameworkOptions = { builder?: BuilderOptions; + docgenOptions?: DocGenOptions; }; type StorybookConfigFramework = { diff --git a/code/frameworks/vue3-vite/src/plugins/vue-docgen.ts b/code/frameworks/vue3-vite/src/plugins/vue-docgen.ts index b233d92a60cf..0b83ae75116d 100644 --- a/code/frameworks/vue3-vite/src/plugins/vue-docgen.ts +++ b/code/frameworks/vue3-vite/src/plugins/vue-docgen.ts @@ -1,9 +1,9 @@ -import { parse } from 'vue-docgen-api'; +import { DocGenOptions, parse } from 'vue-docgen-api'; import type { PluginOption } from 'vite'; import { createFilter } from 'vite'; import MagicString from 'magic-string'; -export function vueDocgen(options): PluginOption { +export function vueDocgen(options?: DocGenOptions): PluginOption { const include = /\.(vue)$/; const filter = createFilter(include); diff --git a/code/frameworks/vue3-vite/src/preset.ts b/code/frameworks/vue3-vite/src/preset.ts index b987f0381c0b..2c2d9be5f184 100644 --- a/code/frameworks/vue3-vite/src/preset.ts +++ b/code/frameworks/vue3-vite/src/preset.ts @@ -22,8 +22,10 @@ export const viteFinal: StorybookConfig['viteFinal'] = async (config, { presets plugins.push(vue()); } + const framework = await presets.apply('framework'); + // Add docgen plugin - plugins.push(vueDocgen()); + plugins.push(vueDocgen(typeof framework === 'string' ? undefined : framework.options.docgenOptions)); return mergeConfig(config, { plugins, diff --git a/code/frameworks/vue3-vite/src/types.ts b/code/frameworks/vue3-vite/src/types.ts index 1461f586aeed..fdce85ae8ece 100644 --- a/code/frameworks/vue3-vite/src/types.ts +++ b/code/frameworks/vue3-vite/src/types.ts @@ -1,11 +1,13 @@ import type { StorybookConfig as StorybookConfigBase } from '@storybook/types'; import type { StorybookConfigVite, BuilderOptions } from '@storybook/builder-vite'; +import type { DocGenOptions } from 'vue-docgen-api'; type FrameworkName = '@storybook/vue3-vite'; type BuilderName = '@storybook/builder-vite'; export type FrameworkOptions = { builder?: BuilderOptions; + docgenOptions?: DocGenOptions; }; type StorybookConfigFramework = {