| 1 | import type { ResolvedSlidevOptions, SlidevPluginOptions, SlidevServerOptions } from '@slidev/types' |
| 2 | import type { PluginOption } from 'vite' |
| 3 | import setupVitePlugins from '../setups/vite-plugins' |
| 4 | import { createVueCompilerFlagsPlugin } from './compilerFlagsVue' |
| 5 | import { createComponentsPlugin } from './components' |
| 6 | import { createContextInjectionPlugin } from './contextInjection' |
| 7 | import { createConfigPlugin } from './extendConfig' |
| 8 | import { createHmrPatchPlugin } from './hmrPatch' |
| 9 | import { createIconsPlugin } from './icons' |
| 10 | import { createSlideImportGuardPlugin } from './importGuard' |
| 11 | import { createInspectPlugin } from './inspect' |
| 12 | import { createLayoutWrapperPlugin } from './layoutWrapper' |
| 13 | import { createSlidesLoader } from './loaders' |
| 14 | import { createMarkdownPlugin } from './markdown' |
| 15 | import { createMcpPlugin } from './mcp' |
| 16 | import { createMonacoTypesLoader } from './monacoTypes' |
| 17 | import { createMonacoWriterPlugin } from './monacoWrite' |
| 18 | import { createPatchMonacoSourceMapPlugin } from './patchMonacoSourceMap' |
| 19 | import { createPWAPlugin } from './pwa' |
| 20 | import { createRemoteAssetsPlugin } from './remoteAssets' |
| 21 | import { createServerRefPlugin } from './serverRef' |
| 22 | import { createStaticCopyPlugin } from './staticCopy' |
| 23 | import { createUnocssPlugin } from './unocss' |
| 24 | import { createVuePlugin } from './vue' |
| 25 | |
| 26 | export function ViteSlidevPlugin( |
| 27 | options: ResolvedSlidevOptions, |
| 28 | pluginOptions: SlidevPluginOptions = {}, |
| 29 | serverOptions: SlidevServerOptions = {}, |
| 30 | ): Promise<PluginOption[]> { |
| 31 | return Promise.all([ |
| 32 | createSlidesLoader(options, serverOptions), |
| 33 | createMcpPlugin(options), |
| 34 | createMarkdownPlugin(options, pluginOptions), |
| 35 | createLayoutWrapperPlugin(options), |
| 36 | createContextInjectionPlugin(), |
| 37 | createVuePlugin(options, pluginOptions), |
| 38 | createSlideImportGuardPlugin(), |
| 39 | createHmrPatchPlugin(), |
| 40 | createComponentsPlugin(options, pluginOptions), |
| 41 | createIconsPlugin(options, pluginOptions), |
| 42 | createRemoteAssetsPlugin(options, pluginOptions), |
| 43 | createServerRefPlugin(options, pluginOptions), |
| 44 | createConfigPlugin(options), |
| 45 | createMonacoTypesLoader(options), |
| 46 | createMonacoWriterPlugin(options), |
| 47 | createVueCompilerFlagsPlugin(options), |
| 48 | createUnocssPlugin(options, pluginOptions), |
| 49 | createStaticCopyPlugin(options, pluginOptions), |
| 50 | createInspectPlugin(options, pluginOptions), |
| 51 | createPatchMonacoSourceMapPlugin(), |
| 52 | createPWAPlugin(options), |
| 53 | |
| 54 | setupVitePlugins(options), |
| 55 | ]) |
| 56 | } |
| 57 |