vitepress 1.0.0-draft.2 → 1.0.0-draft.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +3 -1
  2. package/bin/vitepress.js +1 -1
  3. package/dist/client/app/composables/head.js +2 -2
  4. package/dist/client/app/data.js +2 -4
  5. package/dist/client/app/index.js +1 -5
  6. package/dist/client/index.d.ts +123 -134
  7. package/dist/client/index.js +1 -2
  8. package/dist/client/shared.js +21 -0
  9. package/dist/client/theme-default/Layout.vue +7 -0
  10. package/dist/client/theme-default/NotFound.vue +74 -14
  11. package/dist/client/theme-default/components/VPBox.vue +1 -5
  12. package/dist/client/theme-default/components/VPCarbonAds.vue +90 -0
  13. package/dist/client/theme-default/components/VPContent.vue +14 -10
  14. package/dist/client/theme-default/components/VPDoc.vue +73 -58
  15. package/dist/client/theme-default/components/VPDocAside.vue +34 -0
  16. package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +13 -0
  17. package/dist/client/theme-default/components/{VPDocOutline.vue → VPDocAsideOutline.vue} +14 -3
  18. package/dist/client/theme-default/components/VPDocAsideSponsors.vue +32 -0
  19. package/dist/client/theme-default/components/VPDocFooter.vue +1 -1
  20. package/dist/client/theme-default/components/VPFlyout.vue +2 -3
  21. package/dist/client/theme-default/components/VPFooter.vue +1 -1
  22. package/dist/client/theme-default/components/VPHero.vue +3 -3
  23. package/dist/client/theme-default/components/VPHomeSponsors.vue +3 -7
  24. package/dist/client/theme-default/components/VPLink.vue +2 -1
  25. package/dist/client/theme-default/components/VPLocalNav.vue +1 -1
  26. package/dist/client/theme-default/components/VPMenu.vue +8 -13
  27. package/dist/client/theme-default/components/VPMenuLink.vue +10 -4
  28. package/dist/client/theme-default/components/VPNav.vue +18 -1
  29. package/dist/client/theme-default/components/VPNavBar.vue +20 -8
  30. package/dist/client/theme-default/components/VPNavBarExtra.vue +20 -41
  31. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +2 -8
  32. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +3 -3
  33. package/dist/client/theme-default/components/VPNavBarSearch.vue +6 -6
  34. package/dist/client/theme-default/components/VPNavBarTitle.vue +4 -2
  35. package/dist/client/theme-default/components/VPNavBarTranslations.vue +10 -39
  36. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +1 -2
  37. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +1 -1
  38. package/dist/client/theme-default/components/VPSidebar.vue +12 -6
  39. package/dist/client/theme-default/components/VPSidebarGroup.vue +80 -17
  40. package/dist/client/theme-default/components/VPSidebarLink.vue +2 -9
  41. package/dist/client/theme-default/components/VPSocialLink.vue +2 -2
  42. package/dist/client/theme-default/components/VPSocialLinks.vue +1 -1
  43. package/dist/client/theme-default/components/VPSponsors.vue +15 -40
  44. package/dist/client/theme-default/components/VPSponsorsGrid.vue +2 -2
  45. package/dist/client/theme-default/components/icons/VPIconMinus.vue +5 -0
  46. package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +6 -0
  47. package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
  48. package/dist/client/theme-default/composables/aside.js +17 -0
  49. package/dist/client/theme-default/composables/copy-code.js +33 -0
  50. package/dist/client/theme-default/composables/outline.js +14 -4
  51. package/dist/client/theme-default/composables/sponsor-grid.js +8 -6
  52. package/dist/client/theme-default/index.js +4 -2
  53. package/dist/client/theme-default/styles/base.css +9 -1
  54. package/dist/client/theme-default/styles/components/custom-block.css +90 -0
  55. package/dist/client/theme-default/styles/{vp-doc.css → components/vp-doc.css} +152 -115
  56. package/dist/client/theme-default/styles/{vp-sponsor.css → components/vp-sponsor.css} +51 -7
  57. package/dist/client/theme-default/styles/vars.css +109 -58
  58. package/dist/node/cli.js +295 -37
  59. package/dist/node/index.d.ts +371 -361
  60. package/dist/node/index.js +22 -22
  61. package/dist/node/serve-f7c10936.js +64795 -0
  62. package/dist/node-cjs/cli.cjs +304 -0
  63. package/dist/node-cjs/index.cjs +38 -0
  64. package/dist/{node/serve-b5dc02b2.js → node-cjs/serve-c220f0a8.cjs} +27511 -28708
  65. package/package.json +47 -40
  66. package/theme.d.ts +7 -2
  67. package/types/default-theme.d.ts +15 -2
  68. package/types/shared.d.ts +3 -0
  69. package/dist/client/theme-default/composables/sponsor.js +0 -87
  70. package/dist/node/alias.js +0 -60
  71. package/dist/node/alias.js.map +0 -1
  72. package/dist/node/build/build.js +0 -57
  73. package/dist/node/build/build.js.map +0 -1
  74. package/dist/node/build/buildMPAClient.js +0 -44
  75. package/dist/node/build/buildMPAClient.js.map +0 -1
  76. package/dist/node/build/bundle.js +0 -163
  77. package/dist/node/build/bundle.js.map +0 -1
  78. package/dist/node/build/render.js +0 -185
  79. package/dist/node/build/render.js.map +0 -1
  80. package/dist/node/cli.js.map +0 -1
  81. package/dist/node/config.js +0 -176
  82. package/dist/node/config.js.map +0 -1
  83. package/dist/node/index.js.map +0 -1
  84. package/dist/node/markdown/markdown.js +0 -75
  85. package/dist/node/markdown/markdown.js.map +0 -1
  86. package/dist/node/markdown/plugins/component.js +0 -86
  87. package/dist/node/markdown/plugins/component.js.map +0 -1
  88. package/dist/node/markdown/plugins/containers.js +0 -41
  89. package/dist/node/markdown/plugins/containers.js.map +0 -1
  90. package/dist/node/markdown/plugins/headings.js +0 -25
  91. package/dist/node/markdown/plugins/headings.js.map +0 -1
  92. package/dist/node/markdown/plugins/highlight.js +0 -53
  93. package/dist/node/markdown/plugins/highlight.js.map +0 -1
  94. package/dist/node/markdown/plugins/highlightLines.js +0 -48
  95. package/dist/node/markdown/plugins/highlightLines.js.map +0 -1
  96. package/dist/node/markdown/plugins/hoist.js +0 -22
  97. package/dist/node/markdown/plugins/hoist.js.map +0 -1
  98. package/dist/node/markdown/plugins/image.js +0 -17
  99. package/dist/node/markdown/plugins/image.js.map +0 -1
  100. package/dist/node/markdown/plugins/lineNumbers.js +0 -23
  101. package/dist/node/markdown/plugins/lineNumbers.js.map +0 -1
  102. package/dist/node/markdown/plugins/link.js +0 -85
  103. package/dist/node/markdown/plugins/link.js.map +0 -1
  104. package/dist/node/markdown/plugins/preWrapper.js +0 -22
  105. package/dist/node/markdown/plugins/preWrapper.js.map +0 -1
  106. package/dist/node/markdown/plugins/slugify.js +0 -26
  107. package/dist/node/markdown/plugins/slugify.js.map +0 -1
  108. package/dist/node/markdown/plugins/snippet.js +0 -146
  109. package/dist/node/markdown/plugins/snippet.js.map +0 -1
  110. package/dist/node/markdownToVue.js +0 -166
  111. package/dist/node/markdownToVue.js.map +0 -1
  112. package/dist/node/plugin.js +0 -227
  113. package/dist/node/plugin.js.map +0 -1
  114. package/dist/node/serve/serve.js +0 -59
  115. package/dist/node/serve/serve.js.map +0 -1
  116. package/dist/node/server.js +0 -18
  117. package/dist/node/server.js.map +0 -1
  118. package/dist/node/shared.js +0 -72
  119. package/dist/node/shared.js.map +0 -1
  120. package/dist/node/staticDataPlugin.js +0 -99
  121. package/dist/node/staticDataPlugin.js.map +0 -1
  122. package/dist/node/utils/getGitTimestamp.js +0 -17
  123. package/dist/node/utils/getGitTimestamp.js.map +0 -1
  124. package/dist/node/utils/parseHeader.js +0 -57
  125. package/dist/node/utils/parseHeader.js.map +0 -1
  126. package/dist/node/utils/slash.js +0 -8
  127. package/dist/node/utils/slash.js.map +0 -1
@@ -1,361 +1,371 @@
1
- import { AliasOptions } from 'vite';
2
- import anchor from 'markdown-it-anchor';
3
- import { BuildOptions } from 'vite';
4
- import MarkdownIt from 'markdown-it';
5
- import { Options } from '@vitejs/plugin-vue';
6
- import { ServerOptions } from 'vite';
7
- import { UserConfig as UserConfig_2 } from 'vite';
8
- import { ViteDevServer } from 'vite';
9
-
10
- export declare function build(root: string, buildOptions?: BuildOptions & {
11
- mpa?: string;
12
- }): Promise<void>;
13
-
14
- export declare const createMarkdownRenderer: (srcDir: string, options: MarkdownOptions | undefined, base: string) => MarkdownRenderer;
15
-
16
- export declare function createServer(root?: string, serverOptions?: ServerOptions): Promise<ViteDevServer>;
17
-
18
- export declare namespace DefaultTheme {
19
- export interface Config {
20
- /**
21
- * The logo file of the site.
22
- *
23
- * @example '/logo.svg'
24
- */
25
- logo?: string
26
-
27
- /**
28
- * The nav items.
29
- */
30
- nav?: NavItem[]
31
-
32
- /**
33
- * The sidebar items.
34
- */
35
- sidebar?: Sidebar
36
-
37
- /**
38
- * Info for the edit link. If it's undefined, the edit link feature will
39
- * be disabled.
40
- */
41
- editLink?: EditLink
42
-
43
- /**
44
- * The social links to be displayed at the end of the nav bar. Perfect for
45
- * placing links to social services such as GitHub, Twitter, Facebook, etc.
46
- */
47
- socialLinks?: SocialLink[]
48
-
49
- /**
50
- * The footer configuration.
51
- */
52
- footer?: Footer
53
-
54
- /**
55
- * Adds locale menu to the nav. This option should be used when you have
56
- * your translated sites outside of the project.
57
- */
58
- localeLinks?: LocaleLinks
59
-
60
- /**
61
- * The algolia options. Leave it undefined to disable the search feature.
62
- */
63
- algolia?: AlgoliaSearchOptions
64
-
65
- /**
66
- * The carbon ads options. Leave it undefined to disable the ads feature.
67
- */
68
- carbonAds?: CarbonAdsOptions
69
- }
70
-
71
- // nav -----------------------------------------------------------------------
72
-
73
- export type NavItem = NavItemWithLink | NavItemWithChildren
74
-
75
- export type NavItemWithLink = {
76
- text: string
77
- link: string
78
-
79
- /**
80
- * `activeMatch` is expected to be a regex string. We can't use actual
81
- * RegExp object here because it isn't serializable
82
- */
83
- activeMatch?: string
84
- }
85
-
86
- export interface NavItemWithChildren {
87
- text?: string
88
- items: NavItemWithLink[]
89
- }
90
-
91
- // sidebar -------------------------------------------------------------------
92
-
93
- export type Sidebar = SidebarGroup[] | SidebarMulti
94
-
95
- export interface SidebarMulti {
96
- [path: string]: SidebarGroup[]
97
- }
98
-
99
- export interface SidebarGroup {
100
- text: string
101
- items: SidebarItem[]
102
- }
103
-
104
- export interface SidebarItem {
105
- text: string
106
- link: string
107
- }
108
-
109
- // edit link -----------------------------------------------------------------
110
-
111
- export interface EditLink {
112
- /**
113
- * Repo of the site.
114
- *
115
- * @example 'vuejs/docs'
116
- */
117
- repo: string
118
-
119
- /**
120
- * Branch of the repo.
121
- *
122
- * @default 'main'
123
- */
124
- branch?: string
125
-
126
- /**
127
- * If your docs are not at the root of the repo.
128
- *
129
- * @example 'docs'
130
- */
131
- dir?: string
132
-
133
- /**
134
- * Custom text for edit link.
135
- *
136
- * @default 'Edit this page'
137
- */
138
- text?: string
139
- }
140
-
141
- // social link ---------------------------------------------------------------
142
-
143
- export interface SocialLink {
144
- icon: SocialLinkIcon
145
- link: string
146
- }
147
-
148
- export type SocialLinkIcon =
149
- | 'discord'
150
- | 'facebook'
151
- | 'github'
152
- | 'instagram'
153
- | 'linkedin'
154
- | 'slack'
155
- | 'twitter'
156
- | 'youtube'
157
-
158
- // footer --------------------------------------------------------------------
159
-
160
- export interface Footer {
161
- message?: string
162
- copyright?: string
163
- }
164
-
165
- // locales -------------------------------------------------------------------
166
-
167
- export interface LocaleLinks {
168
- text: string
169
- items: LocaleLink[]
170
- }
171
-
172
- export interface LocaleLink {
173
- text: string
174
- link: string
175
- }
176
-
177
- // algolia ------------------------------------------------------------------
178
-
179
- /**
180
- * The Algolia search options. Partially copied from
181
- * `@docsearch/react/dist/esm/DocSearch.d.ts`
182
- */
183
- export interface AlgoliaSearchOptions {
184
- appId: string
185
- apiKey: string
186
- indexName: string
187
- placeholder?: string
188
- searchParameters?: any
189
- disableUserPersonalization?: boolean
190
- initialQuery?: string
191
- }
192
-
193
- // carbon ads ----------------------------------------------------------------
194
-
195
- export interface CarbonAdsOptions {
196
- carbon: string
197
- custom?: string
198
- placement: string
199
- }
200
- }
201
-
202
- /**
203
- * Type config helper
204
- */
205
- export declare function defineConfig(config: UserConfig<DefaultTheme.Config>): UserConfig<DefaultTheme.Config>;
206
-
207
- /**
208
- * Type config helper for custom theme config
209
- */
210
- export declare function defineConfigWithTheme<ThemeConfig>(config: UserConfig<ThemeConfig>): UserConfig<ThemeConfig>;
211
-
212
- export declare type HeadConfig =
213
- | [string, Record<string, string>]
214
- | [string, Record<string, string>, string]
215
-
216
- export declare interface Header {
217
- level: number
218
- title: string
219
- slug: string
220
- }
221
-
222
- export declare interface LocaleConfig {
223
- lang: string
224
- title?: string
225
- description?: string
226
- head?: HeadConfig[]
227
- label?: string
228
- selectText?: string
229
- }
230
-
231
- export declare interface MarkdownOptions extends MarkdownIt.Options {
232
- lineNumbers?: boolean;
233
- config?: (md: MarkdownIt) => void;
234
- anchor?: {
235
- permalink?: anchor.AnchorOptions['permalink'];
236
- };
237
- attrs?: {
238
- leftDelimiter?: string;
239
- rightDelimiter?: string;
240
- allowedAttributes?: string[];
241
- };
242
- toc?: any;
243
- externalLinks?: Record<string, string>;
244
- }
245
-
246
- export declare interface MarkdownParsedData {
247
- hoistedTags?: string[];
248
- links?: string[];
249
- headers?: Header[];
250
- }
251
-
252
- export declare interface MarkdownRenderer extends MarkdownIt {
253
- __path: string;
254
- __relativePath: string;
255
- __data: MarkdownParsedData;
256
- }
257
-
258
- export declare type RawConfigExports<ThemeConfig = any> = UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>> | (() => UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>>);
259
-
260
- export declare function resolveConfig(root?: string, command?: 'serve' | 'build', mode?: string): Promise<SiteConfig>;
261
-
262
- export declare function resolveSiteData(root: string, userConfig?: UserConfig, command?: 'serve' | 'build', mode?: string): Promise<SiteData>;
263
-
264
- export declare function resolveSiteDataByRoute(siteData: SiteData, route: string): SiteData;
265
-
266
- export declare function serve(options?: ServeOptions): Promise<void>;
267
-
268
- export declare interface ServeOptions {
269
- root?: string;
270
- port?: number;
271
- }
272
-
273
- export declare interface SiteConfig<ThemeConfig = any> extends Pick<UserConfig, 'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'mpa' | 'lastUpdated'> {
274
- root: string;
275
- srcDir: string;
276
- site: SiteData<ThemeConfig>;
277
- configPath: string | undefined;
278
- themeDir: string;
279
- outDir: string;
280
- tempDir: string;
281
- alias: AliasOptions;
282
- pages: string[];
283
- }
284
-
285
- export declare interface SiteData<ThemeConfig = any> {
286
- base: string
287
-
288
- /**
289
- * Language of the site as it should be set on the `html` element.
290
- *
291
- * @example `en-US`, `zh-CN`
292
- */
293
- lang: string
294
-
295
- title: string
296
- description: string
297
- head: HeadConfig[]
298
- appearance: boolean
299
- themeConfig: ThemeConfig
300
- scrollOffset: number | string
301
- locales: Record<string, LocaleConfig>
302
-
303
- /**
304
- * Available locales for the site when it has defined `locales` in its
305
- * `themeConfig`. This object is otherwise empty. Keys are paths like `/` or
306
- * `/zh/`.
307
- */
308
- langs: Record<
309
- string,
310
- {
311
- /**
312
- * Lang attribute as set on the `<html>` element.
313
- * @example `en-US`, `zh-CN`
314
- */
315
- lang: string
316
- /**
317
- * Label to display in the language menu.
318
- * @example `English`, `简体中文`
319
- */
320
- label: string
321
- }
322
- >
323
- }
324
-
325
- export declare interface UserConfig<ThemeConfig = any> {
326
- extends?: RawConfigExports<ThemeConfig>;
327
- base?: string;
328
- lang?: string;
329
- title?: string;
330
- description?: string;
331
- head?: HeadConfig[];
332
- appearance?: boolean;
333
- themeConfig?: ThemeConfig;
334
- locales?: Record<string, LocaleConfig>;
335
- markdown?: MarkdownOptions;
336
- lastUpdated?: boolean;
337
- /**
338
- * Options to pass on to `@vitejs/plugin-vue`
339
- */
340
- vue?: Options;
341
- /**
342
- * Vite config
343
- */
344
- vite?: UserConfig_2;
345
- srcDir?: string;
346
- srcExclude?: string[];
347
- outDir?: string;
348
- shouldPreload?: (link: string, page: string) => boolean;
349
- /**
350
- * Configure the scroll offset when the theme has a sticky header.
351
- * Can be a number or a selector element to get the offset from.
352
- */
353
- scrollOffset?: number | string;
354
- /**
355
- * Enable MPA / zero-JS mode
356
- * @experimental
357
- */
358
- mpa?: boolean;
359
- }
360
-
361
- export { }
1
+ import * as vite from 'vite';
2
+ import { UserConfig as UserConfig$1, AliasOptions, ServerOptions, BuildOptions } from 'vite';
3
+ import { Options } from '@vitejs/plugin-vue';
4
+ import MarkdownIt from 'markdown-it';
5
+ import { Theme } from 'shiki';
6
+ import anchor from 'markdown-it-anchor';
7
+
8
+ declare namespace DefaultTheme {
9
+ export interface Config {
10
+ /**
11
+ * The logo file of the site.
12
+ *
13
+ * @example '/logo.svg'
14
+ */
15
+ logo?: string
16
+
17
+ /**
18
+ * The nav items.
19
+ */
20
+ nav?: NavItem[]
21
+
22
+ /**
23
+ * The sidebar items.
24
+ */
25
+ sidebar?: Sidebar
26
+
27
+ /**
28
+ * Info for the edit link. If it's undefined, the edit link feature will
29
+ * be disabled.
30
+ */
31
+ editLink?: EditLink
32
+
33
+ /**
34
+ * The social links to be displayed at the end of the nav bar. Perfect for
35
+ * placing links to social services such as GitHub, Twitter, Facebook, etc.
36
+ */
37
+ socialLinks?: SocialLink[]
38
+
39
+ /**
40
+ * The footer configuration.
41
+ */
42
+ footer?: Footer
43
+
44
+ /**
45
+ * Adds locale menu to the nav. This option should be used when you have
46
+ * your translated sites outside of the project.
47
+ */
48
+ localeLinks?: LocaleLinks
49
+
50
+ /**
51
+ * The algolia options. Leave it undefined to disable the search feature.
52
+ */
53
+ algolia?: AlgoliaSearchOptions
54
+
55
+ /**
56
+ * The carbon ads options. Leave it undefined to disable the ads feature.
57
+ */
58
+ carbonAds?: CarbonAdsOptions
59
+ }
60
+
61
+ // nav -----------------------------------------------------------------------
62
+
63
+ export type NavItem = NavItemWithLink | NavItemWithChildren
64
+
65
+ export type NavItemWithLink = {
66
+ text: string
67
+ link: string
68
+
69
+ /**
70
+ * `activeMatch` is expected to be a regex string. We can't use actual
71
+ * RegExp object here because it isn't serializable
72
+ */
73
+ activeMatch?: string
74
+ }
75
+
76
+ export interface NavItemWithChildren {
77
+ text?: string
78
+ items: NavItemWithLink[]
79
+ }
80
+
81
+ // sidebar -------------------------------------------------------------------
82
+
83
+ export type Sidebar = SidebarGroup[] | SidebarMulti
84
+
85
+ export interface SidebarMulti {
86
+ [path: string]: SidebarGroup[]
87
+ }
88
+
89
+ export interface SidebarGroup {
90
+ text: string
91
+ items: SidebarItem[]
92
+
93
+ /**
94
+ * If `true`, toggle button is shown.
95
+ *
96
+ * @default false
97
+ */
98
+ collapsible?: boolean
99
+
100
+ /**
101
+ * If `true`, collapsible group is collapsed by default.
102
+ *
103
+ * @default false
104
+ */
105
+ collapsed?: boolean
106
+ }
107
+
108
+ export interface SidebarItem {
109
+ text: string
110
+ link: string
111
+ }
112
+
113
+ // edit link -----------------------------------------------------------------
114
+
115
+ export interface EditLink {
116
+ /**
117
+ * Repo of the site.
118
+ *
119
+ * @example 'vuejs/docs'
120
+ */
121
+ repo: string
122
+
123
+ /**
124
+ * Branch of the repo.
125
+ *
126
+ * @default 'main'
127
+ */
128
+ branch?: string
129
+
130
+ /**
131
+ * If your docs are not at the root of the repo.
132
+ *
133
+ * @example 'docs'
134
+ */
135
+ dir?: string
136
+
137
+ /**
138
+ * Custom text for edit link.
139
+ *
140
+ * @default 'Edit this page'
141
+ */
142
+ text?: string
143
+ }
144
+
145
+ // social link ---------------------------------------------------------------
146
+
147
+ export interface SocialLink {
148
+ icon: SocialLinkIcon
149
+ link: string
150
+ }
151
+
152
+ export type SocialLinkIcon =
153
+ | 'discord'
154
+ | 'facebook'
155
+ | 'github'
156
+ | 'instagram'
157
+ | 'linkedin'
158
+ | 'slack'
159
+ | 'twitter'
160
+ | 'youtube'
161
+
162
+ // footer --------------------------------------------------------------------
163
+
164
+ export interface Footer {
165
+ message?: string
166
+ copyright?: string
167
+ }
168
+
169
+ // locales -------------------------------------------------------------------
170
+
171
+ export interface LocaleLinks {
172
+ text: string
173
+ items: LocaleLink[]
174
+ }
175
+
176
+ export interface LocaleLink {
177
+ text: string
178
+ link: string
179
+ }
180
+
181
+ // algolia ------------------------------------------------------------------
182
+
183
+ /**
184
+ * The Algolia search options. Partially copied from
185
+ * `@docsearch/react/dist/esm/DocSearch.d.ts`
186
+ */
187
+ export interface AlgoliaSearchOptions {
188
+ appId: string
189
+ apiKey: string
190
+ indexName: string
191
+ placeholder?: string
192
+ searchParameters?: any
193
+ disableUserPersonalization?: boolean
194
+ initialQuery?: string
195
+ }
196
+
197
+ // carbon ads ----------------------------------------------------------------
198
+
199
+ export interface CarbonAdsOptions {
200
+ code: string
201
+ placement: string
202
+ }
203
+ }
204
+
205
+ // types shared between server and client
206
+
207
+
208
+ interface Header {
209
+ level: number
210
+ title: string
211
+ slug: string
212
+ }
213
+
214
+ interface SiteData<ThemeConfig = any> {
215
+ base: string
216
+
217
+ /**
218
+ * Language of the site as it should be set on the `html` element.
219
+ *
220
+ * @example `en-US`, `zh-CN`
221
+ */
222
+ lang: string
223
+
224
+ title: string
225
+ titleTemplate?: string | boolean
226
+ description: string
227
+ head: HeadConfig[]
228
+ appearance: boolean
229
+ themeConfig: ThemeConfig
230
+ scrollOffset: number | string
231
+ locales: Record<string, LocaleConfig>
232
+
233
+ /**
234
+ * Available locales for the site when it has defined `locales` in its
235
+ * `themeConfig`. This object is otherwise empty. Keys are paths like `/` or
236
+ * `/zh/`.
237
+ */
238
+ langs: Record<
239
+ string,
240
+ {
241
+ /**
242
+ * Lang attribute as set on the `<html>` element.
243
+ * @example `en-US`, `zh-CN`
244
+ */
245
+ lang: string
246
+ /**
247
+ * Label to display in the language menu.
248
+ * @example `English`, `简体中文`
249
+ */
250
+ label: string
251
+ }
252
+ >
253
+ }
254
+
255
+ type HeadConfig =
256
+ | [string, Record<string, string>]
257
+ | [string, Record<string, string>, string]
258
+
259
+ interface LocaleConfig {
260
+ lang: string
261
+ title?: string
262
+ titleTemplate?: string | boolean
263
+ description?: string
264
+ head?: HeadConfig[]
265
+ label?: string
266
+ selectText?: string
267
+ }
268
+
269
+ declare function resolveSiteDataByRoute(siteData: SiteData, route: string): SiteData;
270
+
271
+ interface MarkdownOptions extends MarkdownIt.Options {
272
+ lineNumbers?: boolean;
273
+ config?: (md: MarkdownIt) => void;
274
+ anchor?: {
275
+ permalink?: anchor.AnchorOptions['permalink'];
276
+ };
277
+ attrs?: {
278
+ leftDelimiter?: string;
279
+ rightDelimiter?: string;
280
+ allowedAttributes?: string[];
281
+ disable?: boolean;
282
+ };
283
+ theme?: Theme;
284
+ toc?: any;
285
+ externalLinks?: Record<string, string>;
286
+ }
287
+ interface MarkdownParsedData {
288
+ hoistedTags?: string[];
289
+ links?: string[];
290
+ headers?: Header[];
291
+ }
292
+ interface MarkdownRenderer extends MarkdownIt {
293
+ __path: string;
294
+ __relativePath: string;
295
+ __data: MarkdownParsedData;
296
+ }
297
+
298
+ declare const createMarkdownRenderer: (srcDir: string, options: MarkdownOptions | undefined, base: string) => Promise<MarkdownRenderer>;
299
+
300
+ interface UserConfig<ThemeConfig = any> {
301
+ extends?: RawConfigExports<ThemeConfig>;
302
+ base?: string;
303
+ lang?: string;
304
+ title?: string;
305
+ titleTemplate?: string | boolean;
306
+ description?: string;
307
+ head?: HeadConfig[];
308
+ appearance?: boolean;
309
+ themeConfig?: ThemeConfig;
310
+ locales?: Record<string, LocaleConfig>;
311
+ markdown?: MarkdownOptions;
312
+ lastUpdated?: boolean;
313
+ /**
314
+ * Options to pass on to `@vitejs/plugin-vue`
315
+ */
316
+ vue?: Options;
317
+ /**
318
+ * Vite config
319
+ */
320
+ vite?: UserConfig$1;
321
+ srcDir?: string;
322
+ srcExclude?: string[];
323
+ outDir?: string;
324
+ shouldPreload?: (link: string, page: string) => boolean;
325
+ /**
326
+ * Configure the scroll offset when the theme has a sticky header.
327
+ * Can be a number or a selector element to get the offset from.
328
+ */
329
+ scrollOffset?: number | string;
330
+ /**
331
+ * Enable MPA / zero-JS mode
332
+ * @experimental
333
+ */
334
+ mpa?: boolean;
335
+ }
336
+ declare type RawConfigExports<ThemeConfig = any> = UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>> | (() => UserConfig<ThemeConfig> | Promise<UserConfig<ThemeConfig>>);
337
+ interface SiteConfig<ThemeConfig = any> extends Pick<UserConfig, 'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'mpa' | 'lastUpdated'> {
338
+ root: string;
339
+ srcDir: string;
340
+ site: SiteData<ThemeConfig>;
341
+ configPath: string | undefined;
342
+ themeDir: string;
343
+ outDir: string;
344
+ tempDir: string;
345
+ alias: AliasOptions;
346
+ pages: string[];
347
+ }
348
+ /**
349
+ * Type config helper
350
+ */
351
+ declare function defineConfig(config: UserConfig<DefaultTheme.Config>): UserConfig<DefaultTheme.Config>;
352
+ /**
353
+ * Type config helper for custom theme config
354
+ */
355
+ declare function defineConfigWithTheme<ThemeConfig>(config: UserConfig<ThemeConfig>): UserConfig<ThemeConfig>;
356
+ declare function resolveConfig(root?: string, command?: 'serve' | 'build', mode?: string): Promise<SiteConfig>;
357
+ declare function resolveSiteData(root: string, userConfig?: UserConfig, command?: 'serve' | 'build', mode?: string): Promise<SiteData>;
358
+
359
+ declare function createServer(root?: string, serverOptions?: ServerOptions): Promise<vite.ViteDevServer>;
360
+
361
+ declare function build(root: string, buildOptions?: BuildOptions & {
362
+ mpa?: string;
363
+ }): Promise<void>;
364
+
365
+ interface ServeOptions {
366
+ root?: string;
367
+ port?: number;
368
+ }
369
+ declare function serve(options?: ServeOptions): Promise<void>;
370
+
371
+ export { DefaultTheme, HeadConfig, Header, LocaleConfig, MarkdownOptions, MarkdownParsedData, MarkdownRenderer, RawConfigExports, ServeOptions, SiteConfig, SiteData, UserConfig, build, createMarkdownRenderer, createServer, defineConfig, defineConfigWithTheme, resolveConfig, resolveSiteData, resolveSiteDataByRoute, serve };