返回 slidev
options.ts
根目录 / packages / types / src / options.ts
1 import type { MarkdownItShikiOptions } from '@shikijs/markdown-it'
2 import type { KatexOptions } from 'katex'
3 import type { CodeOptionsThemes, ShorthandsBundle } from 'shiki/core'
4 import type { SlidevData } from './types'
5
6 export interface RootsInfo {
7 cliRoot: string
8 clientRoot: string
9 userRoot: string
10 userPkgJson: Record<string, any>
11 userWorkspaceRoot: string
12 }
13
14 export interface SlidevEntryOptions {
15 /**
16 * Markdown entry
17 */
18 entry: string
19
20 /**
21 * Theme id
22 */
23 theme?: string
24
25 /**
26 * Remote password
27 */
28 remote?: string
29
30 /**
31 * Enable inspect plugin
32 */
33 inspect?: boolean
34
35 /**
36 * Build with --download option
37 */
38 download?: boolean
39
40 /**
41 * Base URL in dev or build mode
42 */
43 base?: string
44
45 /**
46 * Exclude speaker notes from the built output
47 */
48 withoutNotes?: boolean
49
50 /**
51 * Override routerMode at build time
52 */
53 routerMode?: 'hash' | 'history' | 'memory'
54 }
55
56 export interface ResolvedSlidevOptions extends RootsInfo, SlidevEntryOptions {
57 data: SlidevData
58 themeRaw: string
59 themeRoots: string[]
60 addonRoots: string[]
61 /**
62 * =`[...themeRoots, ...addonRoots, userRoot]` (`clientRoot` excluded)
63 */
64 roots: string[]
65 mode: 'dev' | 'build' | 'export'
66 utils: ResolvedSlidevUtils
67 }
68
69 export interface ResolvedSlidevUtils {
70 shiki: ShorthandsBundle<string, string>
71 shikiOptions: MarkdownItShikiOptions & CodeOptionsThemes
72 katexOptions: KatexOptions | null
73 indexHtml: string
74 define: Record<string, string>
75 iconsResolvePath: string[]
76 isMonacoTypesIgnored: (pkg: string) => boolean
77 getLayouts: () => Promise<Record<string, string>>
78 }
79
80 export interface SlidevServerOptions {
81 /**
82 * @returns `false` if server should be restarted
83 */
84 loadData?: (loadedSource: Record<string, string>) => Promise<SlidevData | false>
85 }
86
86 lines TYPESCRIPT