-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
types.ts
59 lines (50 loc) · 1.34 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { Heading as MDASTHeading } from 'mdast'
import { ProcessorOptions } from '@mdx-js/mdx'
import { Options as RehypePrettyCodeOptions } from 'rehype-pretty-code'
import { PageMapCache } from './plugin'
export interface LoaderOptions extends NextraConfig {
locales: string[]
defaultLocale: string
pageMapCache: PageMapCache
}
export interface PageMapItem {
name: string
route: string
locale?: string
children?: PageMapItem[]
timestamp?: number
frontMatter?: Record<string, any>
meta?: Record<string, any>
active?: boolean
}
export type Heading = MDASTHeading & {
value: string
}
export interface PageOpt {
filename: string
route: string
meta: Record<string, any>
pageMap: PageMapItem[]
titleText: string | null
headings?: Heading[]
hasH1: boolean
}
export type PageMapResult = [
pageMap: PageMapItem[],
route: string,
title: string
]
type Theme = string
export type NextraConfig = {
theme: Theme
themeConfig: string
unstable_flexsearch?: boolean | { codeblocks: boolean }
unstable_staticImage?: boolean
mdxOptions?: Pick<ProcessorOptions, 'rehypePlugins' | 'remarkPlugins'> & {
rehypePrettyCodeOptions?: Partial<RehypePrettyCodeOptions>
}
}
export type withNextra = (
...args: [NextraConfig] | [theme: Theme, themeConfig: string]
) => (nextConfig: Record<string, any>) => {}
export default withNextra